Package org.mapsforge.map.model
Interface IMapViewPosition
-
- All Known Implementing Classes:
MapViewPosition
public interface IMapViewPosition
An interface to being able to use different implementations of MapViewPosition.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addObserver(Observer observer)
Adds an observer to the class.void
animateTo(org.mapsforge.core.model.LatLong latLong)
Animates the map towards the given position (move).boolean
animationInProgress()
void
destroy()
Destroys the class.org.mapsforge.core.model.LatLong
getCenter()
Returns the current center position of the map.org.mapsforge.core.model.BoundingBox
getMapLimit()
org.mapsforge.core.model.MapPosition
getMapPosition()
Returns a newly instantiated object representing the current position and zoomlevel.org.mapsforge.core.model.LatLong
getPivot()
double
getScaleFactor()
Gets the current scale factor.byte
getZoomLevel()
byte
getZoomLevelMax()
byte
getZoomLevelMin()
void
init(PreferencesFacade preferencesFacade)
Initializes the class.void
moveCenter(double moveHorizontal, double moveVertical)
Moves the center position of the map by the given amount of pixels.void
moveCenter(double moveHorizontal, double moveVertical, boolean animated)
Moves the center position of the map by the given amount of pixels.void
moveCenterAndZoom(double moveHorizontal, double moveVertical, byte zoomLevelDiff)
Animates the center position of the map by the given amount of pixels.void
removeObserver(Observer observer)
Removes an observer from the class.void
save(PreferencesFacade preferencesFacade)
Saves the current state.void
setCenter(org.mapsforge.core.model.LatLong latLong)
Sets the new center position of the map.void
setMapLimit(org.mapsforge.core.model.BoundingBox mapLimit)
Sets the new limit of the map (might be null).void
setMapPosition(org.mapsforge.core.model.MapPosition mapPosition)
Sets the new center position and zoom level of the map.void
setMapPosition(org.mapsforge.core.model.MapPosition mapPosition, boolean animated)
Sets the new center position and zoom level of the map.void
setPivot(org.mapsforge.core.model.LatLong pivot)
void
setScaleFactorAdjustment(double scaleFactorCumulative)
void
setZoomLevel(byte zoomLevel)
Sets the new zoom level of the map.void
setZoomLevel(byte zoomLevel, boolean animated)
Sets the new zoom level of the map.void
setZoomLevelMax(byte zoomLevelMax)
void
setZoomLevelMin(byte zoomLevelMin)
void
zoom(byte zoomLevelDiff)
Stops running or queued animations and wait until the animation has been stopped.void
zoomIn()
Increases the current zoom level by one if possible.void
zoomIn(boolean animated)
Increases the current zoom level by one if possible.void
zoomOut()
Decreases the current zoom level by one if possible.void
zoomOut(boolean animated)
Decreases the current zoom level by one if possible.
-
-
-
Method Detail
-
addObserver
void addObserver(Observer observer)
Adds an observer to the class.Needed by mapsforge core classes.
-
animateTo
void animateTo(org.mapsforge.core.model.LatLong latLong)
Animates the map towards the given position (move). The given position will be at the center of the screen after the animation. The position is assured to be within the map limit.
-
animationInProgress
boolean animationInProgress()
- Returns:
- true if animation is in progress or animation is in the queue for being processed.
-
destroy
void destroy()
Destroys the class.
-
getCenter
org.mapsforge.core.model.LatLong getCenter()
Returns the current center position of the map. The position may change rapidly if an animation is in progress. If you are using animation consider keeping the positions and zoom factors in your code and not using this getter.- Returns:
- the current center position of the map.
-
getMapLimit
org.mapsforge.core.model.BoundingBox getMapLimit()
- Returns:
- the current limit of the map (might be null).
-
getMapPosition
org.mapsforge.core.model.MapPosition getMapPosition()
Returns a newly instantiated object representing the current position and zoomlevel. Note that the position or zoomlevel may change rapidly if an animation is in progress.- Returns:
- the current center position and zoom level of the map.
-
getPivot
org.mapsforge.core.model.LatLong getPivot()
-
getScaleFactor
double getScaleFactor()
Gets the current scale factor. The scale factor is normally 2^zoomLevel but it may differ if in between a zoom-animation or in between a pinch-to-zoom process.Needed by mapsforge core classes.
-
getZoomLevel
byte getZoomLevel()
- Returns:
- the current zoom level of the map.
-
getZoomLevelMax
byte getZoomLevelMax()
-
getZoomLevelMin
byte getZoomLevelMin()
-
init
void init(PreferencesFacade preferencesFacade)
Initializes the class.Needed by mapsforge core classes.
-
moveCenter
void moveCenter(double moveHorizontal, double moveVertical)
Moves the center position of the map by the given amount of pixels.Does NOT animate the move.
- Parameters:
moveHorizontal
- the amount of pixels to move this MapViewPosition horizontally.moveVertical
- the amount of pixels to move this MapViewPosition vertically.
-
moveCenter
void moveCenter(double moveHorizontal, double moveVertical, boolean animated)
Moves the center position of the map by the given amount of pixels.Used by TouchGestureHandler.
- Parameters:
moveHorizontal
- the amount of pixels to move this MapViewPosition horizontally.moveVertical
- the amount of pixels to move this MapViewPosition vertically.animated
- whether the move should be animated.
-
moveCenterAndZoom
void moveCenterAndZoom(double moveHorizontal, double moveVertical, byte zoomLevelDiff)
Animates the center position of the map by the given amount of pixels.This method is used by the TouchGestureHandler to perform a zoom on double-tap action.
- Parameters:
moveHorizontal
- the amount of pixels to move this MapViewPosition horizontally.moveVertical
- the amount of pixels to move this MapViewPosition vertically.zoomLevelDiff
- the difference in desired zoom level.
-
removeObserver
void removeObserver(Observer observer)
Removes an observer from the class.Needed by mapsforge core classes.
-
save
void save(PreferencesFacade preferencesFacade)
Saves the current state.Needed by mapsforge core classes.
-
setCenter
void setCenter(org.mapsforge.core.model.LatLong latLong)
Sets the new center position of the map.This is NOT animated.
-
setMapLimit
void setMapLimit(org.mapsforge.core.model.BoundingBox mapLimit)
Sets the new limit of the map (might be null).
-
setMapPosition
void setMapPosition(org.mapsforge.core.model.MapPosition mapPosition)
Sets the new center position and zoom level of the map. The default zoom level changes are animated.
-
setMapPosition
void setMapPosition(org.mapsforge.core.model.MapPosition mapPosition, boolean animated)
Sets the new center position and zoom level of the map.
-
setPivot
void setPivot(org.mapsforge.core.model.LatLong pivot)
-
setScaleFactorAdjustment
void setScaleFactorAdjustment(double scaleFactorCumulative)
-
setZoomLevel
void setZoomLevel(byte zoomLevel)
Sets the new zoom level of the map.Animation is NOT used.
Implemented for external use, NOT used internally.
- Parameters:
zoomLevel
- new zoom level.- Throws:
java.lang.IllegalArgumentException
- if the zoom level is negative.
-
setZoomLevel
void setZoomLevel(byte zoomLevel, boolean animated)
Sets the new zoom level of the map.- Parameters:
zoomLevel
- desired zoom levelanimated
- true if the transition should be animated, false otherwise- Throws:
java.lang.IllegalArgumentException
- if the zoom level is negative.
-
setZoomLevelMax
void setZoomLevelMax(byte zoomLevelMax)
-
setZoomLevelMin
void setZoomLevelMin(byte zoomLevelMin)
-
zoom
void zoom(byte zoomLevelDiff)
Stops running or queued animations and wait until the animation has been stopped.
-
zoomIn
void zoomIn()
Increases the current zoom level by one if possible. Zooming is always around the center. The default zoom level changes are animated.
-
zoomIn
void zoomIn(boolean animated)
Increases the current zoom level by one if possible. Zooming is always around the center.
-
zoomOut
void zoomOut()
Decreases the current zoom level by one if possible. Zooming is always around the center. The default zoom level changes are animated.
-
zoomOut
void zoomOut(boolean animated)
Decreases the current zoom level by one if possible. Zooming is always around the center.
-
-