Package globus.glmap
Class GLMapViewRenderer
java.lang.Object
globus.glmap.GLNativeObject
globus.glmap.GLMapViewRenderer
- All Implemented Interfaces:
android.view.SurfaceHolder.Callback,android.view.SurfaceHolder.Callback2,android.view.TextureView.SurfaceTextureListener,AutoCloseable
public class GLMapViewRenderer
extends GLNativeObject
implements android.view.SurfaceHolder.Callback2, android.view.TextureView.SurfaceTextureListener
Renderer of map
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCallback that is called to automatically create animationstatic @interfacePlacement of screen-bound objectsstatic @interfaceState of tilestatic @interfaceFlags for enabled renderersstatic interfaceScreen capture callbackstatic interfaceRaw screen capture callbackstatic interfaceState capture callback -
Field Summary
FieldsModifier and TypeFieldDescriptionandroid.view.ViewView where this render is attachedfloatScreen scaleintSurface heightintSurface width -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(GLMapDrawObject drawObject) Adds aGLMapDrawObjectto the map.voidaddTextForbiddenArea(int name, MapPoint origin, int offsetX, int offsetY, int width, int height) Adds or updates area where text (and associated icon) must not drawanimate(GLMapViewRenderer.AnimateCallback callback) Create and starts animation using provided callbackanimate(GLMapViewRenderer.AnimateCallback callback, Runnable onFinish) Create and starts animation using provided callbackvoidattachToSurfaceView(android.view.SurfaceView surfaceView) Attach renderer to surface viewbooleanattachToTextureView(android.view.TextureView textureView) Attach renderer to texture viewvoidCancels all active animations on the map.voidCaptures frame when surface will be created and loading of resources finished.voidCaptures the state of the map (camera position, depth buffer, map style, etc.).voidchangeDrawOrder(GLMapDrawObject drawObject, int drawOrder) Changes the draw order of the specifiedGLMapDrawObject.convertDisplayDeltaToInternal(double dx, double dy) Converts a screen-space distance (pixels) to a map-space delta using the view’s current zoom level and rotation.convertDisplayDeltaToInternal(double dx, double dy, double mapZoom, float mapAngle, MapPoint result) Low-level variant that converts a screen-space distance to a map-space delta with explicit zoom and rotation.convertDisplayDeltaToInternal(double dx, double dy, MapPoint result) Same asconvertDisplayDeltaToInternal(double,double)but writes the result intoresultto avoid object allocation.convertDisplayToInternal(double x, double y) Converts a screen-space point (pixels) to a map coordinate.convertDisplayToInternal(double x, double y, MapPoint result) Same asconvertDisplayToInternal(double,double)but writes the result intoresult.android.graphics.PointFConverts a map coordinate to screen pixels.android.graphics.PointFconvertInternalToDisplay(MapPoint val, android.graphics.PointF result) Converts a map coordinate to screen pixels.doubleconvertMetersToInternal(double meters) Converts meters distance to internal distancestatic voidcrashNDK()Function to test native crashesstatic voidFunction to test native crashesvoidStops rendering and destroy rendering surfacevoidDisables clipping of visible map areastatic voidCall this function before creating GLMapView to disable background loading of resources.voiddispose()Explicitly releases native resources held by the object.voidRuns command on internal rendering thread.voidenableClipping(GLMapBBox bbox, float minLevel, float maxLevel) Enables clipping of the visible map area using the specified bounding box (BBox) and zoom levels.floatReturns actual rendered map FPS measured by the render thread.floatCurrent value of altitude scale.getBase()Retrieves the base tile source that was previously set.getBBox()Retrieves the bounding box (BBox) of the currently visible part of theGLMapView.getBBoxWithInsets(int left, int right, int top, int bottom) Retrieves the bounding box (BBox) of the visible part of theGLMapViewwith applied insets.intReturn state of center tilegetCurrentMapCenter(MapPoint point) Gets current coordinates of the origin point of the map.doubleGets current scale of the map.doubleGets current zoom level of the map.booleanRetrieves the visibility state of elevation lines.booleanRetrieves the visibility state of hill shades.booleanRetrieves the visibility state of slopes.floatRetrieves the current font scale.floatgetFps()Returns fpsRetrieves the previously set locale settings.floatGets current angle of the map.Retrieves the coordinates of the center point of the map.getMapCenter(MapPoint point) Gets coordinates of the origin point of the map.Retrieves the coordinates of the center point of the map.Retrieves the origin point of the map coordinate system.getMapOrigin(MapPoint point) Retrieves the origin point of the map coordinate system and fills the providedMapPointobject with its values.floatGets current pitch of the map.doubleGets scale of the map.doubleGet zoom level of the map.doubleGets maximum scale of the mapRetrieves the overlay tile sources that were previously set.booleanRetrieves the visibility state of hill shades.booleanChecks if clipping is enabledbooleanReturns whether the actual rendered FPS meter is visible.doublemapZoomForBBox(GLMapBBox bbox) Calculates zoom of map to fit given bbox into the current visible map area — the surface inset bysetVisibleMapInsets(int, int, int, int)— so the fitted box isn't hidden under safe-area / UI insets.doublemapZoomForBBox(GLMapBBox bbox, int mapWidth, int mapHeight) Calculates zoom of map to fit given bboxvoidonSurfaceTextureAvailable(android.graphics.SurfaceTexture surfaceTexture, int width, int height) booleanonSurfaceTextureDestroyed(android.graphics.SurfaceTexture surfaceTexture) voidonSurfaceTextureSizeChanged(android.graphics.SurfaceTexture surfaceTexture, int width, int height) voidonSurfaceTextureUpdated(android.graphics.SurfaceTexture surfaceTexture) voidForce reloading of all tiles.voidremove(GLMapDrawObject drawObject) Removes aGLMapDrawObjectfrom the map.voidRemoves all images, image groups, tracks, and marker layers from the map.voidremoveTextForbiddenArea(int name) Removes areavoidsetAltitudeScale(float altitudeScale) Sets the map altitude scale, clamped to the range 0.0 to 3.0.voidsetAttributionPosition(int placement) Sets the position of the map attribution.voidsetBase(GLMapTileSource base) Sets the base tile source.voidsetCenterTileStateChangedCallback(Runnable callback) Set callback that will be called when center tile state is changedvoidsetDrawElevationLines(boolean drawElevationLines) Sets the visibility of elevation lines.voidsetDrawHillshades(boolean drawHillshades) Sets the visibility of hill shades.voidsetDrawSlopes(boolean drawSlopes) Sets the visibility of slopes.static voidSetEnabledRenderers(int flags) Set allowed renderers.voidsetFontScale(float scale) Sets the scale of the font used in the map.voidsetFps(float fps) Sets fpsvoidsetLocaleSettings(GLMapLocaleSettings localeSettings) Sets map locale settingsvoidsetMapAngle(float newAngle) Sets angle of the map.voidsetMapCenter(MapPoint center) Sets the coordinates of the center point of the map.voidsetMapCenterXY(double x, double y) Sets the coordinates of the center point of the map.voidsetMapDidMoveCallback(Runnable callback) Sets callback that will be called after move animation finishedvoidsetMapGeoCenter(MapGeoPoint geoCenter) Sets the coordinates of the center point of the map.voidsetMapGeoCenterLatLon(double lat, double lon) Sets the coordinates of the center point of the map.voidsetMapOrigin(float x, float y) Sets the origin point of the map coordinate system (X, Y).voidsetMapPitch(float newAngle) Sets pitch of the map.voidsetMapScale(double newScale) Set scale of the map.voidsetMapZoom(double newZoom) Sets zoom level of the map.voidsetMaxScale(double maxScale) Sets maximum scale of the mapvoidForce redrawvoidsetOverlays(GLMapTileSource[] overlays) Sets the overlay tile sources.voidsetRotateHillshadesLight(boolean rotateHillshadesLight) Sets the visibility of hill shades.voidsetSafeArea(int left, int top, int right, int bottom) Sets the safe area insets for the scale ruler and other map objects.voidsetShowsFpsMeter(boolean showsFpsMeter) Shows or hides the actual rendered FPS meter in the top-left corner of the attached view.voidsetStyle(GLMapVectorCascadeStyle style) Sets map stylevoidsetSurface(android.view.Surface surface, int width, int height, float scale) Set surface for renderingstatic voidSetTerrainDrawDistance(float k) Sets maximum distance visible in terrain mode.voidsetVisibleMapInsets(int left, int top, int right, int bottom) Sets pixel insets for the visible map area.voidstartAnimation(GLMapAnimation animation) Starts the specified animation on the map.voidsurfaceChanged(android.view.SurfaceHolder holder, int format, int width, int height) voidsurfaceCreated(android.view.SurfaceHolder holder) voidsurfaceDestroyed(android.view.SurfaceHolder holder) voidsurfaceRedrawNeeded(android.view.SurfaceHolder holder) voidsurfaceRedrawNeededAsync(android.view.SurfaceHolder holder, Runnable drawingFinished) Methods inherited from class globus.glmap.GLNativeObject
close
-
Field Details
-
screenScale
public float screenScaleScreen scale -
attachedView
public android.view.View attachedViewView where this render is attached -
surfaceWidth
public int surfaceWidthSurface width -
surfaceHeight
public int surfaceHeightSurface height
-
-
Constructor Details
-
GLMapViewRenderer
public GLMapViewRenderer(android.content.Context context) Default constructor- Parameters:
context- context
-
-
Method Details
-
dispose
public void dispose()Description copied from class:GLNativeObjectExplicitly releases native resources held by the object. Equivalent toGLNativeObject.close().- Overrides:
disposein classGLNativeObject
-
setSurface
public void setSurface(@NonNull android.view.Surface surface, int width, int height, float scale) Set surface for rendering- Parameters:
surface- rendering surfacewidth- width of surfaceheight- height of surfacescale- screen scale
-
destroySurface
public void destroySurface()Stops rendering and destroy rendering surface -
attachToTextureView
public boolean attachToTextureView(@NonNull android.view.TextureView textureView) Attach renderer to texture view- Parameters:
textureView- texture view where renderer will be attached- Returns:
- true if restored. false if creates new surface
-
attachToSurfaceView
public void attachToSurfaceView(@NonNull android.view.SurfaceView surfaceView) Attach renderer to surface view- Parameters:
surfaceView- surface view where renderer will be attached
-
surfaceChanged
public void surfaceChanged(@NonNull android.view.SurfaceHolder holder, int format, int width, int height) - Specified by:
surfaceChangedin interfaceandroid.view.SurfaceHolder.Callback
-
surfaceCreated
public void surfaceCreated(@NonNull android.view.SurfaceHolder holder) - Specified by:
surfaceCreatedin interfaceandroid.view.SurfaceHolder.Callback
-
surfaceDestroyed
public void surfaceDestroyed(@NonNull android.view.SurfaceHolder holder) - Specified by:
surfaceDestroyedin interfaceandroid.view.SurfaceHolder.Callback
-
surfaceRedrawNeededAsync
public void surfaceRedrawNeededAsync(@NonNull android.view.SurfaceHolder holder, @NonNull Runnable drawingFinished) - Specified by:
surfaceRedrawNeededAsyncin interfaceandroid.view.SurfaceHolder.Callback2
-
surfaceRedrawNeeded
public void surfaceRedrawNeeded(@NonNull android.view.SurfaceHolder holder) - Specified by:
surfaceRedrawNeededin interfaceandroid.view.SurfaceHolder.Callback2
-
onSurfaceTextureAvailable
public void onSurfaceTextureAvailable(@NonNull android.graphics.SurfaceTexture surfaceTexture, int width, int height) - Specified by:
onSurfaceTextureAvailablein interfaceandroid.view.TextureView.SurfaceTextureListener
-
onSurfaceTextureSizeChanged
public void onSurfaceTextureSizeChanged(@NonNull android.graphics.SurfaceTexture surfaceTexture, int width, int height) - Specified by:
onSurfaceTextureSizeChangedin interfaceandroid.view.TextureView.SurfaceTextureListener
-
onSurfaceTextureDestroyed
public boolean onSurfaceTextureDestroyed(@NonNull android.graphics.SurfaceTexture surfaceTexture) - Specified by:
onSurfaceTextureDestroyedin interfaceandroid.view.TextureView.SurfaceTextureListener
-
onSurfaceTextureUpdated
public void onSurfaceTextureUpdated(@NonNull android.graphics.SurfaceTexture surfaceTexture) - Specified by:
onSurfaceTextureUpdatedin interfaceandroid.view.TextureView.SurfaceTextureListener
-
getFps
public float getFps()Returns fps- Returns:
- fps
-
setFps
public void setFps(float fps) Sets fps- Parameters:
fps- fps to set
-
getActualFps
public float getActualFps()Returns actual rendered map FPS measured by the render thread. This is independent fromgetFps(), which is the target render-rate limit.- Returns:
- actual rendered map FPS
-
setShowsFpsMeter
public void setShowsFpsMeter(boolean showsFpsMeter) Shows or hides the actual rendered FPS meter in the top-left corner of the attached view. The value is measured from rendered map frames, not fromgetFps().- Parameters:
showsFpsMeter- true to show the meter
-
isShowsFpsMeter
public boolean isShowsFpsMeter()Returns whether the actual rendered FPS meter is visible.- Returns:
- true when the meter is visible
-
setVisibleMapInsets
public void setVisibleMapInsets(@Px int left, @Px int top, @Px int right, @Px int bottom) Sets pixel insets for the visible map area.Screen-bound map content and overlays that follow the visible map should be placed inside these insets.
- Parameters:
left- left inset in pixelstop- top inset in pixelsright- right inset in pixelsbottom- bottom inset in pixels
-
setCenterTileStateChangedCallback
Set callback that will be called when center tile state is changed- Parameters:
callback- Runnable that will be post to main thread when center tile state is changed
-
getCenterTileState
public int getCenterTileState()Return state of center tile- Returns:
- state of center tile
-
convertDisplayDeltaToInternal
Converts a screen-space distance (pixels) to a map-space delta using the view’s current zoom level and rotation.- Parameters:
dx- horizontal distance on the screen, in pixelsdy- vertical distance on the screen, in pixels- Returns:
- a new
MapPointwhose coordinates represent the delta in map units - See Also:
-
convertDisplayDeltaToInternal
@NonNull public MapPoint convertDisplayDeltaToInternal(double dx, double dy, @NonNull MapPoint result) Same asconvertDisplayDeltaToInternal(double,double)but writes the result intoresultto avoid object allocation.- Parameters:
dx- horizontal distance on the screen, in pixelsdy- vertical distance on the screen, in pixelsresult- destination for the computed delta (must be non-null)- Returns:
result(for call-chaining)
-
convertDisplayDeltaToInternal
@NonNull public MapPoint convertDisplayDeltaToInternal(double dx, double dy, double mapZoom, float mapAngle, @NonNull MapPoint result) Low-level variant that converts a screen-space distance to a map-space delta with explicit zoom and rotation.- Parameters:
dx- horizontal distance on the screen, in pixelsdy- vertical distance on the screen, in pixelsmapZoom- zoom level to use (same scale asgetMapZoom())mapAngle- map rotation in degrees counter-clockwiseresult- destination for the computed delta (must be non-null)- Returns:
result- See Also:
-
convertDisplayToInternal
Converts a screen-space point (pixels) to a map coordinate.- Parameters:
x- screen x-coordinate, in pixelsy- screen y-coordinate, in pixels- Returns:
- a new
MapPointwhose coordinates are in map units - See Also:
-
convertDisplayToInternal
Same asconvertDisplayToInternal(double,double)but writes the result intoresult.- Parameters:
x- screen x-coordinate, in pixelsy- screen y-coordinate, in pixelsresult- destination for the converted point- Returns:
result
-
convertInternalToDisplay
@NonNull public android.graphics.PointF convertInternalToDisplay(@NonNull MapPoint val, @NonNull android.graphics.PointF result) Converts a map coordinate to screen pixels.- Parameters:
val- map coordinate to convert (map-space units)result- destination for the converted point- Returns:
- a new
PointFwhosexandyare in screen pixels - See Also:
-
convertInternalToDisplay
Converts a map coordinate to screen pixels.- Parameters:
val- map coordinate to convert (map-space units)- Returns:
- a new
PointFwhosexandyare in screen pixels - See Also:
-
convertMetersToInternal
public double convertMetersToInternal(double meters) Converts meters distance to internal distance- Parameters:
meters- The value to be converted- Returns:
- Returns distance in internal units
-
doWhenSurfaceCreated
Runs command on internal rendering thread. If surface does not exists at this moment Runnable will be executed when it will be created.final GLMapView mapView = (GLMapView) this.findViewById(R.id.map_view); mapView.doWhenSurfaceCreated(new Runnable() { public void run() { mapView.setMapCenter(center, false); mapView.scaleMap(scaleChange, null, false); } });- Parameters:
r- The Runnable to be executed at internal thread when surface will be created
-
setStyle
Sets map style- Parameters:
style- style to use for map
-
setLocaleSettings
Sets map locale settings- Parameters:
localeSettings- New locale settings to use for translating map labels
-
getLocaleSettings
Retrieves the previously set locale settings.- Returns:
- The
GLMapLocaleSettingsinstance that was previously set.
-
setBase
Sets the base tile source. By default, the base is a vector tile source.- Parameters:
base- TheGLMapTileSourceto use as the base tile source.
-
setOverlays
Sets the overlay tile sources. By default, overlays arenull.- Parameters:
overlays- An array ofGLMapTileSourceinstances to use as overlays, ornullto remove overlays.
-
getOverlays
Retrieves the overlay tile sources that were previously set.- Returns:
- An array of
GLMapTileSourceinstances representing the current overlays, ornullif no overlays were set.
-
getBase
Retrieves the base tile source that was previously set.- Returns:
- The
GLMapTileSourceinstance representing the current base tile source, ornullif no base source was set.
-
setDrawElevationLines
public void setDrawElevationLines(boolean drawElevationLines) Sets the visibility of elevation lines. By default, elevation lines are not drawn (false).- Parameters:
drawElevationLines-trueto enable elevation line visibility,falseto disable it.
-
getDrawElevationLines
public boolean getDrawElevationLines()Retrieves the visibility state of elevation lines.- Returns:
trueif elevation lines are visible,falseotherwise.
-
setDrawHillshades
public void setDrawHillshades(boolean drawHillshades) Sets the visibility of hill shades. By default, hill shades are not drawn (false).- Parameters:
drawHillshades-trueto enable hill shade visibility,falseto disable it.
-
getDrawHillshades
public boolean getDrawHillshades()Retrieves the visibility state of hill shades.- Returns:
trueif hill shades are visible,falseotherwise.
-
setRotateHillshadesLight
public void setRotateHillshadesLight(boolean rotateHillshadesLight) Sets the visibility of hill shades. By default, hill shades are not drawn (false).- Parameters:
rotateHillshadesLight-trueto enable hill shade visibility,falseto disable it.
-
getRotateHillshadesLight
public boolean getRotateHillshadesLight()Retrieves the visibility state of hill shades.- Returns:
trueif hill shades are visible,falseotherwise.
-
setDrawSlopes
public void setDrawSlopes(boolean drawSlopes) Sets the visibility of slopes. By default, slopes are not drawn (false).- Parameters:
drawSlopes-trueto enable slope visibility,falseto disable it.
-
setAltitudeScale
public void setAltitudeScale(float altitudeScale) Sets the map altitude scale, clamped to the range 0.0 to 3.0. If 0 no terrain geometry will be fetched.- Parameters:
altitudeScale- new value of altitude scale. Animatable.
-
getAltitudeScale
public float getAltitudeScale()Current value of altitude scale. By default 0.- Returns:
- current value of altitude scale.
-
getDrawSlopes
public boolean getDrawSlopes()Retrieves the visibility state of slopes.- Returns:
trueif slopes are visible,falseotherwise.
-
captureFrameWhenFinish
Captures frame when surface will be created and loading of resources finished.ScreenCaptureCallbackprovides Bitmap as a result- Parameters:
callback- ScreenCaptureCallback to call with result
-
captureState
Captures the state of the map (camera position, depth buffer, map style, etc.).- Parameters:
callback- The callback is called when the state is ready.
-
mapZoomForBBox
Calculates zoom of map to fit given bbox- Parameters:
bbox- bbox that you wish to fitmapWidth- width of visible areamapHeight- height of visible area- Returns:
- zoom of map to fit given bbox or NaN if bbox is empty.
-
mapZoomForBBox
Calculates zoom of map to fit given bbox into the current visible map area — the surface inset bysetVisibleMapInsets(int, int, int, int)— so the fitted box isn't hidden under safe-area / UI insets. To fit the full surface regardless of insets, callmapZoomForBBox(GLMapBBox, int, int)withsurfaceWidth/surfaceHeight.- Parameters:
bbox- bbox that you wish to fit- Returns:
- zoom of map to fit given bbox or NaN if bbox is empty.
-
getMapCenter
Gets coordinates of the origin point of the map. If animation is in progress - this value returns final value.MapPoint pt = mapView.getMapCenter(new MapPoint());- Parameters:
point- The point to be filled with values.- Returns:
- The same object that was passed to method call.
- See Also:
-
getCurrentMapCenter
Gets current coordinates of the origin point of the map.- Parameters:
point- The point to be filled with values.- Returns:
- The same object that was passed to method call.
-
getMapCenter
Retrieves the coordinates of the center point of the map.Example usage:
MapPoint pt = mapView.getMapCenter();- Returns:
- A
MapPointobject representing the coordinates of the map's center point. - See Also:
-
setMapCenter
Sets the coordinates of the center point of the map.Example usage:
mapView.setMapCenter(center);- Parameters:
center- AMapPointobject representing the new center coordinates of the map.- See Also:
-
setMapCenterXY
public void setMapCenterXY(@FloatRange(from=0.0,to=1.073741824E9) double x, @FloatRange(from=0.0,to=1.073741824E9) double y) Sets the coordinates of the center point of the map.Example usage:
mapView.setMapCenterXY(cx, cy);- Parameters:
x- A x component the new center coordinates of the map.y- A y component the new center coordinates of the map.- See Also:
-
getMapGeoCenter
Retrieves the coordinates of the center point of the map.Example usage:
MapPoint pt = mapView.getMapGeoCenter();- Returns:
- A
MapGeoPointobject representing the coordinates of the map's center point. - See Also:
-
setMapGeoCenterLatLon
public void setMapGeoCenterLatLon(@FloatRange(from=-90.0,to=90.0) double lat, @FloatRange(from=-180.0,to=180.0) double lon) Sets the coordinates of the center point of the map.Example usage:
mapView.setMapGeoCenter(center);- Parameters:
lat- A latitude the new center coordinates of the map.lon- A longitude the new center coordinates of the map.- See Also:
-
setMapGeoCenter
Sets the coordinates of the center point of the map.Example usage:
mapView.setMapGeoCenter(center);- Parameters:
geoCenter- AMapGeoPointobject representing the new center coordinates of the map.- See Also:
-
getMapOrigin
Retrieves the origin point of the map coordinate system and fills the providedMapPointobject with its values. -
getMapOrigin
Retrieves the origin point of the map coordinate system.- Returns:
- A new
MapPointobject containing the origin coordinates of the map.
-
setMapOrigin
public void setMapOrigin(@FloatRange(from=0.0,to=1.0) float x, float y) Sets the origin point of the map coordinate system (X, Y).Changing the values within the range [0, 1] in relative coordinates specifies the point in the
GLMapViewthat is considered the center point forgetMapCenter(MapPoint)andsetMapCenter(MapPoint).- Parameters:
x- The X-coordinate of the origin point, in relative coordinates.y- The Y-coordinate of the origin point, in relative coordinates.
-
setSafeArea
public void setSafeArea(int left, int top, int right, int bottom) Sets the safe area insets for the scale ruler and other map objects.The safe area defines the padding around the map view where interactive or visual elements like the scale ruler should not be placed.
- Parameters:
left- The left inset, in pixels.top- The top inset, in pixels.right- The right inset, in pixels.bottom- The bottom inset, in pixels.
-
getBBox
Retrieves the bounding box (BBox) of the currently visible part of theGLMapView.- Returns:
- A
GLMapBBoxobject representing the visible portion of the map.
-
getBBoxWithInsets
Retrieves the bounding box (BBox) of the visible part of theGLMapViewwith applied insets.If an animation is in progress, the method returns the final BBox value as it will appear after the animation completes.
- Parameters:
left- The left inset, in pixels.right- The right inset, in pixels.top- The top inset, in pixels.bottom- The bottom inset, in pixels.- Returns:
- A
GLMapBBoxobject representing the visible portion of the map with the specified insets applied.
-
enableClipping
public void enableClipping(@NonNull GLMapBBox bbox, @FloatRange(from=0.0) float minLevel, @FloatRange(from=0.0) float maxLevel) Enables clipping of the visible map area using the specified bounding box (BBox) and zoom levels.- Parameters:
bbox- TheGLMapBBoxobject defining the area to clip.minLevel- The minimum zoom level where the clipping is active.maxLevel- The maximum zoom level where the clipping is active.
-
disableClipping
public void disableClipping()Disables clipping of visible map area -
isClippingEnabled
public boolean isClippingEnabled()Checks if clipping is enabled- Returns:
- true if enabled
-
setFontScale
public void setFontScale(float scale) Sets the scale of the font used in the map. This method will automatically trigger a tile reload.- Parameters:
scale- The new font scale. The default value is1.
-
getFontScale
public float getFontScale()Retrieves the current font scale.- Returns:
- The current font scale as a
float.
-
getMapAngle
public float getMapAngle()Gets current angle of the map.- Returns:
- Current angle of the map.
-
setMapAngle
public void setMapAngle(float newAngle) Sets angle of the map.- Parameters:
newAngle- new angle for map.- See Also:
-
getMapPitch
public float getMapPitch()Gets current pitch of the map.- Returns:
- Current pitch of the map.
-
setMapPitch
public void setMapPitch(float newAngle) Sets pitch of the map.- Parameters:
newAngle- new pitch for map.- See Also:
-
getMapZoom
public double getMapZoom()Get zoom level of the map. If animation is in progress final value will return.double zoom = mapView.getMapZoom();- Returns:
- Current zoom of the map.
- See Also:
-
getCurrentMapZoom
public double getCurrentMapZoom()Gets current zoom level of the map.double zoom = mapView.getCurrentMapZoom();- Returns:
- Current zoom of the map.
- See Also:
-
getCurrentMapScale
public double getCurrentMapScale()Gets current scale of the map.- Returns:
- current scale of the map
-
getMapScale
public double getMapScale()Gets scale of the map.- Returns:
- scale of the map
- See Also:
-
setMapZoom
public void setMapZoom(double newZoom) Sets zoom level of the map.mapView.setMapZoom(16);- Parameters:
newZoom- new zoom level for map.- See Also:
-
setMaxScale
public void setMaxScale(double maxScale) Sets maximum scale of the map- Parameters:
maxScale- max scale to set
-
getMaxScale
public double getMaxScale()Gets maximum scale of the map- Returns:
- maximum scale of the map
-
setMapScale
public void setMapScale(double newScale) Set scale of the map. Same as setMapZoom(pow(2, zoomLevel))- Parameters:
newScale- new scale for map.- See Also:
-
setAttributionPosition
public void setAttributionPosition(int placement) Sets the position of the map attribution. The default attribution text is "GLOBUS | © OpenStreetMap". If you are using map data from another provider, you should specify the appropriate attribution text.
Note: You may choose to hide the attribution on the map by setting the position toGLMapViewRenderer.GLMapPlacement.Hidden. However, in this case, it is mandatory to display the attribution within the application's settings. When the attribution is tapped, it may navigate to https://globus.software/about/ and https://www.openstreetmap.org/about/ See Interactive MapsmapView.setAttributionPosition(GLMapPlacement.TopCenter);- Parameters:
placement- placement of attribution
-
removeAllObjects
public void removeAllObjects()Removes all images, image groups, tracks, and marker layers from the map.- See Also:
-
add
Adds aGLMapDrawObjectto the map.- Parameters:
drawObject- TheGLMapDrawObjectto add to the map.- See Also:
-
remove
Removes aGLMapDrawObjectfrom the map.- Parameters:
drawObject- TheGLMapDrawObjectto remove from the map.- See Also:
-
changeDrawOrder
Changes the draw order of the specifiedGLMapDrawObject.- Parameters:
drawObject- TheGLMapDrawObjectwhose draw order should be modified.drawOrder- The new draw order value for the object.- See Also:
-
startAnimation
Starts the specified animation on the map.- Parameters:
animation- TheGLMapAnimationto start.
-
cancelMapAnimations
public void cancelMapAnimations()Cancels all active animations on the map. -
addTextForbiddenArea
public void addTextForbiddenArea(int name, @NonNull MapPoint origin, @IntRange(from=-32768L,to=32767L) int offsetX, @IntRange(from=-32768L,to=32767L) int offsetY, @IntRange(from=1L,to=32767L) int width, @IntRange(from=1L,to=32767L) int height) Adds or updates area where text (and associated icon) must not draw- Parameters:
name- unique name for areaorigin- origin of areaoffsetX- x offset of area from origin (in screen points / dp)offsetY- y offset of area from origin (in screen points / dp)width- width of area (in screen points / dp)height- height of area (in screen points / dp)
-
removeTextForbiddenArea
public void removeTextForbiddenArea(int name) Removes area- Parameters:
name- name of area
-
animate
Create and starts animation using provided callback- Parameters:
callback- Callback that will configure animation- Returns:
- created animation.
-
animate
@NonNull public GLMapAnimation animate(@NonNull GLMapViewRenderer.AnimateCallback callback, @Nullable Runnable onFinish) Create and starts animation using provided callback- Parameters:
callback- Callback that will configure animationonFinish- Callback that will be called when animation is finished- Returns:
- created animation.
-
reloadTiles
public void reloadTiles()Force reloading of all tiles. -
setNeedRedraw
public void setNeedRedraw()Force redraw -
setMapDidMoveCallback
Sets callback that will be called after move animation finished- Parameters:
callback- callback that will be post to ui thread after animation finished
-
SetEnabledRenderers
public static void SetEnabledRenderers(int flags) Set allowed renderers. By default, the best possible will be used. Set this value before initializing any GLMapViewRenderer Some cheap Android devices have problems with drivers...- Parameters:
flags- allowed renderers
-
SetTerrainDrawDistance
public static void SetTerrainDrawDistance(@FloatRange(from=1.0,to=2.0) float k) Sets maximum distance visible in terrain mode. Set this value before initializing any GLMapViewRenderer- Parameters:
k- maximum distance visible in terrain mode
-
DisableOpenGLBackgroundLoading
public static void DisableOpenGLBackgroundLoading()Call this function before creating GLMapView to disable background loading of resources. In most cases this greatly speedup application, but some cheap Android devices can not handle it properly and this leads to lags or even crashes. -
crashNDK
public static void crashNDK()Function to test native crashes -
crashNDK2
public static void crashNDK2()Function to test native crashes
-