public class MapView
extends GLSurfaceView
Constructor and Description |
---|
MapView(Context context)
Creates a new MapView object from a context object.
|
MapView(Context context,
AttributeSet attrs)
Creates a new MapView object from a context object and attributes.
|
Modifier and Type | Method and Description |
---|---|
void |
cancelAllTasks()
Cancels all qued tasks such as tile and vector data fetches.
|
void |
captureRendering(MapRenderListener listener,
boolean waitWhileUpdating)
Captures map rendering as a bitmap.
|
void |
clearAllCaches()
Releases memory occupied by all caches.
|
void |
clearPreloadingCaches()
Releases the memory occupied by the preloading area.
|
void |
delete()
Deletes the resources associated with the MapView.
|
MapPos |
getFocusPos()
Returns the position that the camera is currently looking at.
|
Layers |
getLayers()
Returns the Layers object, that can be used for adding and removing map layers.
|
MapEventListener |
getMapEventListener()
Returns the map event listener.
|
float |
getMapRotation()
Returns the map rotation in degrees.
|
Options |
getOptions()
Returns the Options object, that can be used for modifying various map options.
|
float |
getTilt()
Returns the tilt angle in degrees.
|
float |
getZoom()
Returns the zoom level.
|
ScreenPos |
mapToScreen(MapPos mapPos)
Calculates the screen position corresponding to a map position, using the current view parameters.
|
void |
moveToFitBounds(MapBounds mapBounds,
ScreenBounds screenBounds,
boolean integerZoom,
boolean resetRotation,
boolean resetTilt,
float durationSeconds)
Animate the view parameters (focus position, tilt, rotation, zoom) so that the specified bounding box becomes fully visible.
Also supports resetting the tilt and rotation angles over the course of the animation. This method does not work before the screen size is set. |
void |
moveToFitBounds(MapBounds mapBounds,
ScreenBounds screenBounds,
boolean integerZoom,
float durationSeconds)
Animate the view parameters (focus position, tilt, rotation, zoom) so that the specified bounding box becomes fully visible.
This method does not work before the screen size is set. |
void |
onDrawFrame(GL10 gl)
Not part of public API.
|
void |
onSurfaceChanged(GL10 gl,
int width,
int height)
Not part of public API.
|
void |
onSurfaceCreated(GL10 gl,
EGLConfig config)
Not part of public API.
|
boolean |
onTouchEvent(MotionEvent event)
Not part of public API.
|
void |
pan(MapVec deltaPos,
float durationSeconds)
Pans the view relative to the current focus position.
|
static boolean |
registerLicense(java.lang.String licenseKey,
Context context)
Registers the SDK license.
|
void |
rotate(float deltaAngle,
float durationSeconds)
Rotates the view relative to the current rotation value.
|
void |
rotate(float deltaAngle,
MapPos targetPos,
float durationSeconds)
Rotates the view relative to the current rotation value.
|
MapPos |
screenToMap(ScreenPos screenPos)
Calculates the map position corresponding to a screen position, using the current view parameters.
|
void |
setFocusPos(MapPos pos,
float durationSeconds)
Sets the new absolute focus position.
|
void |
setMapEventListener(MapEventListener mapEventListener)
Sets the map event listener.
|
void |
setMapRotation(float angle,
float durationSeconds)
Sets the new absolute rotation value.
|
void |
setMapRotation(float angle,
MapPos targetPos,
float durationSeconds)
Sets the new absolute rotation value.
|
void |
setTilt(float tilt,
float durationSeconds)
Sets the new absolute tilt value.
|
void |
setZoom(float zoom,
float durationSeconds)
Sets the new absolute zoom value.
|
void |
setZoom(float zoom,
MapPos targetPos,
float durationSeconds)
Sets the new absolute zoom value.
|
void |
tilt(float deltaTilt,
float durationSeconds)
Tilts the view relative to the current tilt value.
|
void |
zoom(float deltaZoom,
float durationSeconds)
Zooms the view relative to the current zoom value.
|
void |
zoom(float deltaZoom,
MapPos targetPos,
float durationSeconds)
Zooms the view relative to the current zoom value.
|
public MapView(Context context)
context
- The context object.public MapView(Context context, AttributeSet attrs)
context
- The context object.attrs
- The attributes.public static boolean registerLicense(java.lang.String licenseKey, Context context)
licenseKey
- The license string provided for this application.context
- Application context for the license.public void delete()
public void onSurfaceCreated(GL10 gl, EGLConfig config)
public void onSurfaceChanged(GL10 gl, int width, int height)
public void onDrawFrame(GL10 gl)
public boolean onTouchEvent(MotionEvent event)
public Layers getLayers()
public Options getOptions()
public MapPos getFocusPos()
public float getMapRotation()
public float getTilt()
public float getZoom()
public void pan(MapVec deltaPos, float durationSeconds)
deltaPos
- The coordinate difference the map should be moved by.durationSeconds
- The duration in which the tilting operation will be completed in seconds.public void setFocusPos(MapPos pos, float durationSeconds)
pos
- The new focus point position in base coordinate system.durationSeconds
- The duration in which the tilting operation will be completed in seconds.public void rotate(float deltaAngle, float durationSeconds)
deltaAngle
- The delta angle value in degrees.durationSeconds
- The duration in which the zooming operation will be completed in seconds.public void rotate(float deltaAngle, MapPos targetPos, float durationSeconds)
deltaAngle
- The delta angle value in degrees.targetPos
- The zooming target position in the coordinate system of the base projection.durationSeconds
- The duration in which the zooming operation will be completed in seconds.public void setMapRotation(float angle, float durationSeconds)
angle
- The new absolute rotation angle value in degrees.durationSeconds
- The duration in which the zooming operation will be completed in seconds.public void setMapRotation(float angle, MapPos targetPos, float durationSeconds)
angle
- The new absolute rotation angle value in degrees.targetPos
- The zooming target position in the coordinate system of the base projection.durationSeconds
- The duration in which the zooming operation will be completed in seconds.public void tilt(float deltaTilt, float durationSeconds)
deltaTilt
- The number of degrees the camera should be tilted by.durationSeconds
- The duration in which the tilting operation will be completed in seconds.public void setTilt(float tilt, float durationSeconds)
tilt
- The new absolute tilt value in degrees.durationSeconds
- The duration in which the tilting operation will be completed in seconds.public void zoom(float deltaZoom, float durationSeconds)
deltaZoom
- The delta zoom value.durationSeconds
- The duration in which the zooming operation will be completed in seconds.public void zoom(float deltaZoom, MapPos targetPos, float durationSeconds)
deltaZoom
- The delta zoom value.targetPos
- The zooming target position in the coordinate system of the base projection.durationSeconds
- The duration in which the zooming operation will be completed in seconds.public void setZoom(float zoom, float durationSeconds)
zoom
- The new absolute zoom value.durationSeconds
- The duration in which the zooming operation will be completed in seconds.public void setZoom(float zoom, MapPos targetPos, float durationSeconds)
zoom
- The new absolute zoom value.targetPos
- The zooming target position in the coordinate system of the base projection.durationSeconds
- The duration in which the zooming operation will be completed in seconds.public void moveToFitBounds(MapBounds mapBounds, ScreenBounds screenBounds, boolean integerZoom, float durationSeconds)
mapBounds
- The bounding box on the map to be made visible in the base projection's coordinate system.screenBounds
- The screen bounding box where to fit the map bounding box.integerZoom
- If true, then closest integer zoom level will be used. If false, exact fractional zoom level will be used.durationSeconds
- The duration in which the operation will be completed in seconds.public void moveToFitBounds(MapBounds mapBounds, ScreenBounds screenBounds, boolean integerZoom, boolean resetRotation, boolean resetTilt, float durationSeconds)
mapBounds
- The bounding box on the map to be made visible in the base projection's coordinate system.screenBounds
- The screen bounding box where to fit the map bounding box.integerZoom
- If true, then closest integer zoom level will be used. If false, exact fractional zoom level will be used.resetTilt
- If true, view will be untilted. If false, current tilt will be kept.resetRotation
- If true, rotation will be reset. If false, current rotation will be kept.durationSeconds
- The duration in which the operation will be completed in seconds.public MapEventListener getMapEventListener()
public void setMapEventListener(MapEventListener mapEventListener)
mapEventListener
- The new map event listener.public MapPos screenToMap(ScreenPos screenPos)
screenPos
- The screen position.public ScreenPos mapToScreen(MapPos mapPos)
mapPos
- The map position in base projection coordinate system.public void cancelAllTasks()
public void clearPreloadingCaches()
public void clearAllCaches()
public void captureRendering(MapRenderListener listener, boolean waitWhileUpdating)
listener
- The listener interface that will receive the callback once rendering is available.waitWhileUpdating
- If true, delay the capture until all asynchronous processes are finished (for example, until all tiles are loaded).