java.lang.Object | |||
↳ | TextureView | ||
↳ | com.carto.ui.GLTextureView | ||
↳ | com.carto.ui.TextureMapView |
MapView is a view class supporting map rendering and interaction.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
TextureMapView(Context context)
Creates a new MapView object from a context object.
| |||||||||||
TextureMapView(Context context, AttributeSet attrs)
Creates a new MapView object from a context object and attributes.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
cancelAllTasks()
Cancels all qued tasks such as tile and vector data fetches.
| ||||||||||
void |
clearAllCaches()
Releases memory occupied by all caches.
| ||||||||||
void |
clearPreloadingCaches()
Releases the memory occupied by the preloading area.
| ||||||||||
synchronized 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.
| ||||||||||
MapRenderer |
getMapRenderer()
Returns the MapRenderer object, that can be used for controlling rendering related options.
| ||||||||||
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, float durationSeconds)
Animate the view parameters (focus position, tilt, rotation, zoom) so that the specified bounding box becomes fully visible.
| ||||||||||
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.
| ||||||||||
synchronized void | onDrawFrame(GL10 gl) | ||||||||||
synchronized void | onSurfaceChanged(GL10 gl, int width, int height) | ||||||||||
synchronized void | onSurfaceCreated(GL10 gl, EGLConfig config) | ||||||||||
synchronized boolean | onTouchEvent(MotionEvent event) | ||||||||||
void |
pan(MapVec deltaPos, float durationSeconds)
Pans the view relative to the current focus position.
| ||||||||||
static boolean |
registerLicense(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, MapPos targetPos, float durationSeconds)
Sets the new absolute rotation value.
| ||||||||||
void |
setMapRotation(float angle, 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, MapPos targetPos, float durationSeconds)
Zooms the view relative to the current zoom value.
| ||||||||||
void |
zoom(float deltaZoom, float durationSeconds)
Zooms the view relative to the current zoom value.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |
Creates a new MapView object from a context object.
context | The context object. |
---|
Creates a new MapView object from a context object and attributes.
context | The context object. |
---|---|
attrs | The attributes. |
Cancels all qued tasks such as tile and vector data fetches. Tasks that have already started may continue until they finish. Tasks that are added after this method call are not affected.
Releases memory occupied by all caches. Calling this means that everything has to be fetched again, including the visible area.
Releases the memory occupied by the preloading area. Calling this method releases some memory if preloading is enabled, but means that the area right outside the visible area has to be fetched again.
Deletes the resources associated with the MapView. The method can be used to dispose native objects immediately, without waiting for next GC cycle.
Returns the position that the camera is currently looking at.
Returns the Layers object, that can be used for adding and removing map layers.
Returns the map event listener. May be null.
Returns the MapRenderer object, that can be used for controlling rendering related options.
Returns the map rotation in degrees. 0 means looking north, 90 means west, -90 means east and 180 means south.
Returns the Options object, that can be used for modifying various map options.
Returns the tilt angle in degrees. 0 means looking directly at the horizon, 90 means looking directly down.
Returns the zoom level. The value returned is never negative, 0 means absolutely zoomed out and all other values describe some level of zoom.
Calculates the screen position corresponding to a map position, using the current view parameters.
mapPos | The map position in base projection coordinate system. |
---|
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.
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. |
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.
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. |
resetRotation | If true, rotation will be reset. If false, current rotation will be kept. |
resetTilt | If true, view will be untilted. If false, current tilt will be kept. |
durationSeconds | The duration in which the operation will be completed in seconds. |
Pans the view relative to the current focus position. The deltaPos vector is expected to be in the coordinate system of the base projection. The new calculated focus position will be clamped to the world bounds and to the bounds set by Options::setPanBounds. If durationSeconds > 0 the panning operation will be animated over time. If the previous panning animation has not finished by the time this method is called, it will be stopped.
deltaPos | The coordinate difference the map should be moved by. |
---|---|
durationSeconds | The duration in which the tilting operation will be completed in seconds. |
Registers the SDK license. This class method and must be called before creating any actual MapView instances.
licenseKey | The license string provided for this application. |
---|---|
context | Application context for the license. |
Rotates the view relative to the current rotation value. Positive values rotate clockwise, negative values counterclockwise. The new calculated rotation value will be wrapped to the range of (-180 .. 180]. Rotations are ignored if Options::setRotatable is set to false. If durationSeconds > 0 the rotating operation will be animated over time. If the previous rotating animation has not finished by the time this method is called, it will be stopped.
deltaAngle | The delta angle value in degrees. |
---|---|
durationSeconds | The duration in which the zooming operation will be completed in seconds. |
Rotates the view relative to the current rotation value. Positive values rotate clockwise, negative values counterclockwise. The new calculated rotation value will be wrapped to the range of (-180 .. 180]. Rotations are ignored if Options::setRotatable is set to false. Rotating is done around the specified target position, keeping it at the same location on the screen. If durationSeconds > 0 the rotating operation will be animated over time. If the previous rotating animation has not finished by the time this method is called, it will be stopped.
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. |
Calculates the map position corresponding to a screen position, using the current view parameters.
screenPos | The screen position. |
---|
Sets the new absolute focus position. The new focus position is expected to be in the coordinate system of the base projection. The new focus position will be clamped to the world bounds and to the bounds set by Options::setPanBounds. If durationSeconds > 0 the panning operation will be animated over time. If the previous panning animation has not finished by the time this method is called, it will be stopped.
pos | The new focus point position in base coordinate system. |
---|---|
durationSeconds | The duration in which the tilting operation will be completed in seconds. |
Sets the map event listener. If a null pointer is passed no map events will be generated. The default is null.
mapEventListener | The new map event listener. |
---|
Sets the new absolute rotation value. 0 means look north, 90 means west, -90 means east and 180 means south. The rotation value will be wrapped to the range of (-180 .. 180]. Rotations are ignored if Options::setRotatable is set to false. Rotating is done around the specified target position, keeping it at the same location on the screen. If durationSeconds > 0 the rotating operation will be animated over time. If the previous rotating animation has not finished by the time this method is called, it will be stopped.
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. |
Sets the new absolute rotation value. 0 means look north, 90 means west, -90 means east and 180 means south. The rotation value will be wrapped to the range of (-180 .. 180]. Rotations are ignored if Options::setRotatable is set to false. If durationSeconds > 0 the rotating operation will be animated over time. If the previous rotating animation has not finished by the time this method is called, it will be stopped.
angle | The new absolute rotation angle value in degrees. |
---|---|
durationSeconds | The duration in which the zooming operation will be completed in seconds. |
Sets the new absolute tilt value. 0 means look directly at the horizon, 90 means look directly down. The minimum tilt angle is 30 degrees and the maximum is 90 degrees. The tilt value can be further constrained by the Options::setTiltRange method. Values exceeding these ranges will be clamped. If durationSeconds > 0 the tilting operation will be animated over time. If the previous tilting animation has not finished by the time this method is called, it will be stopped.
tilt | The new absolute tilt value in degrees. |
---|---|
durationSeconds | The duration in which the tilting operation will be completed in seconds. |
Sets the new absolute zoom value. The minimum zoom value is 0, which means absolutely zoomed out and the maximum zoom value is 24. The zoom value can be further constrained by the Options::setZoomRange method. Values exceeding these ranges will be clamped. If durationSeconds > 0 the zooming operation will be animated over time. If the previous zooming animation has not finished by the time this method is called, it will be stopped.
zoom | The new absolute zoom value. |
---|---|
durationSeconds | The duration in which the zooming operation will be completed in seconds. |
Sets the new absolute zoom value. The minimum zoom value is 0, which means absolutely zoomed out and the maximum zoom value is 24. The zoom value can be further constrained by the Options::setZoomRange method. Values exceeding these ranges will be clamped. Zooming is done towards the specified target position, keeping it at the same location on the screen. If durationSeconds > 0, the zooming operation will be animated over time. If the previous zooming animation has not finished by the time this method is called, it will be stopped.
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. |
Tilts the view relative to the current tilt value. Positive values tilt the view down towards the map, negative values tilt the view up towards the horizon. The new calculated tilt value will be clamped to the range of [30 .. 90] and to the range set by Options::setZoomRange. If durationSeconds > 0 the tilting operation will be animated over time. If the previous tilting animation has not finished by the time this method is called, it will be stopped.
deltaTilt | The number of degrees the camera should be tilted by. |
---|---|
durationSeconds | The duration in which the tilting operation will be completed in seconds. |
Zooms the view relative to the current zoom value. Positive values zoom in, negative values zoom out. The new calculated zoom value will be clamped to the range of [0 .. 24] and to the range set by Options::setZoomRange. Zooming is done towards the specified target position, keeping it at the same location on the screen. If durationSeconds > 0 the zooming operation will be animated over time. If the previous zooming animation has not finished by the time this method is called, it will be stopped.
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. |
Zooms the view relative to the current zoom value. Positive values zoom in, negative values zoom out. The new calculated zoom value will be clamped to the range of [0 .. 24] and to the range set by Options::setZoomRange. If durationSeconds > 0 the zooming operation will be animated over time. If the previous zooming animation has not finished by the time this method is called, it will be stopped.
deltaZoom | The delta zoom value. |
---|---|
durationSeconds | The duration in which the zooming operation will be completed in seconds. |