MapView

class MapView(address: Long) : Canvas

MapView object. It displays a map. MapView supports a wide range of operations like resize, zoom, rotate, animated fly to specific position or select map objects. The map appearance is fully customizable. By using the attached preferences it is possible to specify for each map what map objects to be visible and when; it is possible to change the colors, widths and other properties of the map objects; or to specify which landmarks should be visible on map. Multiple MapView objects can be created using the same Screen or a different one.

Constructors

Link copied to clipboard
constructor(address: Long)

Types

Link copied to clipboard
object Companion

Map View companion

Properties

Link copied to clipboard

Address of native referenced object. nullptr if not referencing any native allocated object. Note native allocation will happen only once.

Link copied to clipboard

Camera

Link copied to clipboard

The cursor screen position. The coordinates are relative to view parent screen

Link copied to clipboard

The list of landmarks under the cursor location.

Link copied to clipboard

The list of vectors data under the cursor location.

Link copied to clipboard

The list of overlay items under the cursor location.

Link copied to clipboard

Retrieve the path under the cursor location.

Link copied to clipboard

The list of routes under the cursor location.

Link copied to clipboard

Retrieve the scene object under the cursor selection.

Link copied to clipboard

The list of streets under the cursor location.

Link copied to clipboard

The list of traffic events under the cursor location.

Link copied to clipboard

The cursor WGS coordinates. returns ZERO on success else it returns -1. The only case when error occurs is when the cursor is not enabled.

Link copied to clipboard

Map customization.

Link copied to clipboard

Maximum slippy zoom level. Bigger zoom factor means closer to the map.

Link copied to clipboard

Maximum zoom level. Bigger zoom factor means closer to the map.

Link copied to clipboard
var onAllTouchesUp: () -> Unit?

Raw unprocessed detection of all pointers up from screen. Action where the last pointer goes up and no pointers are left on the screen.

Link copied to clipboard

This is called by the map service when the cursor is over a set of view components ( landmarks, markers, streets, vectors ). Current cursor selection can be obtained via MapView.cursorSelection... methods.

Link copied to clipboard

This is called by the map view when the cursor is over a set of landmarks. Lambda Signature: (LandmarkList) -> Unit

Link copied to clipboard

This is called by the map view when the cursor is over a set of markers. Lambda Signature: (MarkerMatchList) -> Unit

Link copied to clipboard

This is called by the map view when the cursor is over a set of overlay items. Lambda Signature: (OverlayItemList) -> Unit

Link copied to clipboard

This is called by the map view when the cursor is over a set of routes. Lambda Signature: (RouteList) -> Unit

Link copied to clipboard

This is called by the map view when the cursor is over a set of traffic events. Lambda Signature: (TrafficEventList) -> Unit

Link copied to clipboard
var onDoubleTouch: (pos: Xy) -> Unit?

Single pointer double touch event. Lambda Signature: (pos: Xy) -> Unit A double touch event is defined as two consecutive touches within a preset time duration in milliseconds, and distance between the two touches has to be less than a preset distance in millimeters. "pos" param represents the position where event occurred

Link copied to clipboard

This is called by the map view when it enters in following position mode

Link copied to clipboard

This is called by the map view when it exits the following position mode

Link copied to clipboard
var onLongDown: (pos: Xy) -> Unit?

Single pointer long touch event. Lambda Signature: (pos: Xy) -> Unit A long touch event is defined as a pointer down longer than a preset time in milliseconds and then pointer up, and pointer movement has to be less than a preset distance in millimeters. "pos" param represents the position where event occurred

Link copied to clipboard

Map angle changed notification

Link copied to clipboard

Map style changed notification. Lambda Signature: (styleId : Long, filepath : String) -> Unit "styleId" param represents style content store item id, ContentStoreItem.id "filepath" param represents style local file path, ContentStoreItem.filename

Link copied to clipboard
var onMove: (start: Xy, end: Xy) -> Unit?

Single pointer move event. Lambda Signature: (start: Xy, end: Xy) -> Unit A single pointer move event is defined as a pointer down, followed by a move, followed by a pointer up. "start" param represents the previous position involved in move action "end" param represents the current position involved in move action

Link copied to clipboard
var onPinch: (start1: Xy, start2: Xy, end1: Xy, end2: Xy, center: Xy) -> Unit?

Two pointers pinch event. Lambda Signature: (start1: Xy, start2: Xy, end1: Xy, end2: Xy, center: Xy) -> Unit A two pointers pinch event is defined as two pointers down, followed by moving one or both pointers toward or away from each other. "start1" param represents start of the previous position for first pointer "start2" param represents start of the previous position for second pointer "end1" param represents end of the current position for first pointer "end2" param represents end of the current position for second pointer "center" param represents the rotation center

Link copied to clipboard
var onPinchSwipe: (centerPosInPix: Xy, zoomingSpeedInMMPerSec: Double, rotatingSpeedInMMPerSec: Double) -> Unit?

Two pointer rotating and zooming, or just zooming, swipe event. Lambda Signature: (centerPosInPix: Xy, zoomingSpeedInMMPerSec: Double, rotatingSpeedInMMPerSec: Double) -> Unit

Link copied to clipboard
var onPointerDown: (ptrId: Long, pos: Xy) -> Unit?

Touch handler events listener. Lambda Signature: (ptrId: Long, pos: Xy) -> Unit Raw unprocessed pointer down started - used to determine when one of the other processed actions start. Set pointer down flag indicating that action started! The flag is cleared by the actual action, such as OnPinch, when it starts. "ptrId" param represents pointer id. "pos" param represents Xy position of the pointer.

Link copied to clipboard
var onPointerMove: (ptrId: Long, pos: Xy) -> Unit?

Raw unprocessed pointer move. Lambda Signature: (ptrId: Long, pos: Xy) -> Unit "ptrId" param represents pointer id. "pos" param represents Xy position of the pointer.

Link copied to clipboard
var onPointerUp: (ptrId: Long, pos: Xy) -> Unit?

Raw unprocessed pointer up. Lambda Signature: (ptrId: Long, pos: Xy) -> Unit "ptrId" param represents pointer id. "pos" param represents Xy position of the pointer.

Link copied to clipboard
var onReady: () -> Unit?

Called by the canvas / map view when is initialized and ready to be used

Link copied to clipboard
var onRender: () -> Unit?

Notifies user to render the canvas.

Link copied to clipboard
var onShove: (pointersAngleDeg: Double, initial: Xy, start: Xy, end: Xy) -> Unit?

Two pointers shove event. Lambda Signature: (pointersAngleDeg: Double, start: Xy, end: Xy) -> Unit Two pointers move with distance between pointers and pointers angle remaining inside predefined thresholds. "pointersAngleDeg" param represents the angle in degrees determined by the two pointers involved in gesture "initial" is the mid point of the segment determined by the two pointers initial touch down positions "start" param represents the mid point of the segment determined by the two pointers previous positions "end" param represents the mid point of the segment determined by the two pointers current positions

Link copied to clipboard
var onSwipe: (distX: Int, distY: Int, speedMMPerSec: Double) -> Unit?

Single pointer swipe event. Lambda Signature: (distX: Int, distY: Int, speedMMPerSec: Double) -> Unit A single pointer swipe event is defined as a pointer down, followed by a swipe/fast move. "distX" param represents the difference in pixels on X axis between last two points involved in move action "distY" param represents the difference in pixels on Y axis between last two points involved in move action "speedMMPerSec" param represents the moving speed in mm / s

Link copied to clipboard
var onTouch: (pos: Xy) -> Unit?

Single pointer touch down event. Lambda Signature: (pos: Xy) -> Unit A touch event is defined as a pointer down and up within a preset time in milliseconds, and pointer movement has to be less than a preset distance in millimeters. "pos" param represents the position where event occurred

Link copied to clipboard
var onTouchMove: (start: Xy, end: Xy) -> Unit?

Single pointer touch move event. Lambda Signature: (start: Xy, end: Xy) -> Unit Touch move mode is enabled by performing a pointer touch immediately followed by a pointer down in same screen area, and then move. "start" param represents the previous position involved in move action "end" param represents the current position involved in move action

Link copied to clipboard
var onTouchPinch: (start1: Xy, start2: Xy, end1: Xy, end2: Xy) -> Unit?

Two pointers touch pinch event. Lambda Signature: (start1: Xy, start2: Xy, end1: Xy, end2: Xy) -> Unit Two fingers touch mode is enabled by performing a single pointer touch immediately followed by two pointers down, with one of the pointers close to the previous touch. "start1" param represents start of the previous position for first pointer "start2" param represents start of the previous position for second pointer "end1" param represents end of the current position for first pointer "end2" param represents end of the current position for second pointer

Link copied to clipboard
var onTwoDoubleTouches: (pos: Xy) -> Unit?

Two pointers double touch event. Lambda Signature: (pos: Xy) -> Unit A two pointers double touch event is defined as two consecutive two-pointer touches from which the pointer ups are within a preset time in milliseconds. "pos" param represents the mid position of the segment determined by the two pointers positions

Link copied to clipboard
var onTwoTouches: (pos: Xy) -> Unit?

Two pointers touch event. Lambda Signature: (pos: Xy) -> Unit A two pointers touch event is defined as two simultaneous touches from which the pointer ups are within a preset time in milliseconds. "pos" param represents the mid position of the segment determined by the two pointers positions

Link copied to clipboard
var onViewportResized: (rect: Rect) -> Unit?

Notifies that canvas was resized because of the screen resize. Lambda Signature: (rect: Rect) -> Unit

Link copied to clipboard

Called by the View before rendering is started

Link copied to clipboard

Called by the View after rendering is finished. Lambda Signature: (EViewDataTransitionStatus, EViewCameraTransitionStatus) -> Unit

Link copied to clipboard

View preferences

Link copied to clipboard

The parent screen

Link copied to clipboard

Get slippy zoom level.

Link copied to clipboard

Get view viewport in parent screen coordinates

Link copied to clipboard

Get screen viewport in parent screen ratio

Link copied to clipboard

Gets the zoom level.

Functions

Link copied to clipboard
fun activateHighlightLandmarks(landmark: Landmark, renderSettings: HighlightRenderSettings? = null, highlightId: Int = 0)

Enables the highlighting for the given landmark.

external fun activateHighlightLandmarks(landmarks: LandmarkList, renderSettings: HighlightRenderSettings? = null, highlightId: Int = 0)

Enables the highlighting for the given landmark list.

Link copied to clipboard
fun activateOverlayItemsHighlight(overlay: OverlayItem, renderSettings: HighlightRenderSettings? = null, highlightId: Int = 0)

Enable the highlighting for the given overlay list.

external fun activateOverlayItemsHighlight(overlays: OverlayItemList, renderSettings: HighlightRenderSettings? = null, highlightId: Int = 0)

Enables the highlighting for the given overlay list.

Link copied to clipboard
external fun addNavigationInstructionGeometry(dataBuffer: DataBuffer, navigationInstructionInnerColor: Rgba = Rgba.black(), navigationInstructionInnerSizeMm: Double = 6.0, navigationInstructionOuterColor: Rgba = Rgba.white(), navigationInstructionOuterSizeMm: Double = 1.0)

Add navigation instruction geometry

Link copied to clipboard
external fun addRouteGeometry(dataBuffer: DataBuffer, routeInnerColor: Rgba = Rgba(200, 200, 255, 255), routeInnerSizeMm: Double = 6.0, routeOuterColor: Rgba = Rgba(50, 50, 200, 255), routeOuterSizeMm: Double = 1.0, routeConnectionsInnerColor: Rgba = Rgba(100, 100, 100, 255), routeConnectionsInnerSizeMm: Double = 4.0, routeConnectionsOuterColor: Rgba = Rgba(0, 0, 0, 255), routeConnectionsOuterSizeMm: Double = 1.0)

Add route geometry

Link copied to clipboard
external fun alignNorthUp(animation: Animation? = null)

Sets the map north-up oriented

Link copied to clipboard
external fun captureAsImage(rect: Rect): Image?
external fun captureAsImage(buffer: DataBuffer, rect: Rect): Int
external fun captureAsImage(filePath: String, rect: Rect): Int

Make a screen region capture of the current map in JPEG format. No cursor/on-screen info is included.

Link copied to clipboard
external fun centerOnArea(area: GeographicArea, zoomLevel: Int = -1, xy: Xy? = null, animation: Animation? = Animation(EAnimation.Linear))

Centers WGS of Area center on screen coordinates. Note: Animation can be used only if automatic map rendering is active.

Link copied to clipboard
external fun centerOnCoordinates(coords: Coordinates, zoomLevel: Int = -1, xy: Xy? = null, animation: Animation? = Animation(EAnimation.Linear), mapAngle: Double = Double.MAX_VALUE, viewAngle: Double = Double.MAX_VALUE)
fun centerOnCoordinates(latitude: Double, longitude: Double, zoomLevel: Int = -1, xy: Xy? = null, animation: Animation? = Animation(EAnimation.Linear), mapAngle: Double = Double.MAX_VALUE, viewAngle: Double = Double.MAX_VALUE)

Centers WGS coordinates on screen coordinates. Animation can be used only if automatic map rendering is active.

Link copied to clipboard
external fun centerOnDistRoute(route: Route, startDist: Int, endDist: Int, viewRc: Rect? = null, animation: Animation? = Animation(EAnimation.Linear))

Center On the given route parts The zoom level is automatically selected so that the entire route part between start distance and end distance is visible on the map

Link copied to clipboard
external fun centerOnLocation(location: Landmark, rc: Rect? = null, animation: Animation? = null)

Center on the given landmark location

Link copied to clipboard
external fun centerOnRectArea(area: GeographicArea, zoomLevel: Int = -1, viewRc: Rect? = null, animation: Animation? = Animation(EAnimation.Linear))

Centers WGS of Area center on screen coordinates. Note: Animation can be used only if automatic map rendering is active.

Link copied to clipboard
external fun centerOnRoute(route: Route, rc: Rect? = null, animation: Animation? = Animation(EAnimation.Linear))

Centers WGS of the geographic area for the route on screen rectangle. The entire route is visible on map. The zoom level is automatically selected so that the entire route is visible on map. Note: Animation can be used only if automatic map rendering is active.

Link copied to clipboard
external fun centerOnRouteInstruction(instruction: RouteInstruction, zoomLevel: Int = -1, xy: Xy? = null, animation: Animation? = Animation(EAnimation.Linear), viewAngle: Double = Double.MAX_VALUE)

Centers WGS of route description on screen coordinates. The route instruction turn arrow is visible on map. The zoom level is automatically selected so that the entire turn arrow is visible on map. Note: Animation can be used only if automatic map rendering is active.

Link copied to clipboard
fun centerOnRoutes(routes: RouteList, displayMode: ERouteDisplayMode = ERouteDisplayMode.Full, viewRc: Rect? = null, animation: Animation? = Animation(EAnimation.Linear))

Centers WGS of the geographic area for the routes list on screen rectangle. All routes from the list will be visible on the map. The zoom level is automatically selected. Note: Animation can be used only if automatic map rendering is active.

Link copied to clipboard
external fun centerOnRouteTrafficEvent(event: RouteTrafficEvent, zoomLevel: Int = -1, rc: Rect? = null, animation: Animation? = Animation(EAnimation.Linear), viewAngle: Double = Double.MAX_VALUE)

Centers the specified route traffic event in screen rectangle. Note: Animation can be used only if automatic map rendering is active.

Link copied to clipboard

Disable all highlights

Link copied to clipboard
external fun deactivateHighlight(highlightId: Int = 0)

Disable highlighting.

Link copied to clipboard
external fun detach()

Detach canvas from rendering process If OpenGL context is not available anymore during canvas destruction, this method should be called when the context is still valid in order to do all needed cleanups

Link copied to clipboard
external fun displayOverlayItemFieldOfView(settings: MarkerRenderSettings, overlayItem: OverlayItem, groupName: String)

Display overlay item field of view

Link copied to clipboard
fun displayPath(path: Path, border: Rgba? = null, fill: Rgba? = null): Boolean

Adds a path in the collection.

Link copied to clipboard
fun displayPaths(paths: ArrayList<Path>, border: Rgba? = null, fill: Rgba? = null)

Adds a path in the collection.

Link copied to clipboard
external fun displaySimplifiedRoute(dataBuffer: DataBuffer)

Display route in simplified mode

Link copied to clipboard
external fun displaySimplifiedRouteTurn(dataBuffer: DataBuffer)

Display route turn arrow in simplified mode

Link copied to clipboard
fun finalize()

Overrides finalize that garbage collector will call when needed.

Link copied to clipboard
external fun fling(velocityX: Float, velocityY: Float)

Fling map

Link copied to clipboard
fun followPosition(following: Boolean = true, animation: Animation = Animation(EAnimation.Linear, 900), zoomLevel: Int = -1, viewAngle: Double = Double.MAX_VALUE, navArrow: MapSceneObject? = null, trackMethod: CameraTrackMethod? = null, restoreCameraMode: Boolean = false)

Starts/Stops position follow.

Link copied to clipboard
external fun getClosestAddress(coordinates: Coordinates, radiusInMeters: Int, onlyCity: Boolean): Landmark?

Provides the closest address landmark to the provided coordinates

Link copied to clipboard
external fun getHighlightArea(highlightId: Int = 0): RectangleGeographicArea?

Get highlight geographic area

Link copied to clipboard
external fun getNearestLocations(coordinates: Coordinates?): LandmarkList?

Retrieve the set of landmarks on the specified location. This is a Quick synchronous reverse geocoding method.

Link copied to clipboard
external fun getOptimalHighlightCenterViewport(viewRc: Rect? = null): Rect?

Gets the optimal highlight center viewport given the user custom input

Link copied to clipboard
external fun getOptimalRoutesCenterViewport(routesList: RouteList, viewRc: Rect): Rect?

Gets the highlighted items optimal center viewport given the user custom input.

Link copied to clipboard

Gets style layer info at the given coordinates

Link copied to clipboard

Get the current tracked positions as a coordinates list

Link copied to clipboard

Gets data transfer statistics for a given service.

Link copied to clipboard
external fun getVisibleRouteInterval(route: Route, clipRect: Rect?): Xy?

Get the clipped part of the given route as a xy( startDistance, endDistance)

Link copied to clipboard

Handles a keyboard event

Link copied to clipboard
external fun hideCustomMarkers(groupName: String)

Hide custom landmarks

Link copied to clipboard
fun hidePath(path: Path)

Hides the path.

Link copied to clipboard

Hides all visible routes.

Link copied to clipboard
external fun highlightHoveredMapLabel(pt: Xy, selectMapObjects: Boolean): Int

Highlight the hovered map label under the given screen coordinates

Link copied to clipboard

Request redraw.

Link copied to clipboard

Check it there is an animation in progress.

Link copied to clipboard
external fun isCameraMoving(): Boolean

Check if view camera is moving

Link copied to clipboard

Tests if following the current position.

Link copied to clipboard

Test if following the current position is modified by the touch handler.

Link copied to clipboard
external fun isMapView(): Boolean

Check if canvas is a MapView object

Link copied to clipboard

True if keeps a reference to a C++ SDK object False if keeps a C++ SDK object

Link copied to clipboard
external fun isTrackedPositions(): Boolean

Check if tracked position is started in the map view

Link copied to clipboard
operator fun not(): Boolean

Checks if this object is valid.

Link copied to clipboard
fun presentPath(path: Path, border: Rgba? = null, fill: Rgba? = null, doCenterOn: Boolean = true, animation: Animation = Animation(animation = EAnimation.Linear, duration = 1000), zoomLevel: Int = -1)

Presents a path on the map.

Link copied to clipboard
fun presentRoute(route: Route, displayBubble: Boolean = false, displayRouteName: Boolean = true, displayTrafficIcon: Boolean = true, displayFerryIcon: Boolean = true, displayTollIcon: Boolean = true, centerMapView: Boolean = true, animation: Animation = Animation(animation = EAnimation.Linear, duration = 1000), displayMode: ERouteDisplayMode = ERouteDisplayMode.Full, edgeAreaInsets: Rect? = null, routeRenderSettings: RouteRenderSettings? = null): Boolean

Presents the provided route on the map. If display bubble is false then no label will be visible.

Link copied to clipboard
fun presentRoutes(routes: RouteList, mainRoute: Route? = null, displayBubble: Boolean = false, displayRouteName: Boolean = true, displayTrafficIcon: Boolean = true, displayFerryIcon: Boolean = true, displayTollIcon: Boolean = true, centerMapView: Boolean = true, animation: Animation = Animation(EAnimation.Linear, 1000), displayMode: ERouteDisplayMode = ERouteDisplayMode.Full, edgeAreaInsets: Rect? = null): Boolean

Presents the provided routes on the map. If display bubble is false then no label will be visible.

Link copied to clipboard
fun release()

Releases the native referenced value of this object if:

Link copied to clipboard
external fun removeAllMarkers()

Remove all markers

Link copied to clipboard

Remove navigation instruction geometry

Link copied to clipboard
external fun removeRouteGeometry()

Remove route geometry

Link copied to clipboard

Reset follow position camera focus to center of viewport.

Link copied to clipboard
external fun resize(screenRatio: RectF)

Resize the view

Link copied to clipboard
external fun restoreFollowingPosition(animation: Animation? = null)

Restore following position from a manually adjusted state

Link copied to clipboard
external fun scroll(dx: Float, dy: Float)

Scroll map

Link copied to clipboard
external fun setClippingArea(area: RectF)

Sets the view clipping rectangle in parent screen ratio

Link copied to clipboard

Set the edge area insets in pixels.

Link copied to clipboard
fun setSlippyZoomLevel(zoomLevel: Double, duration: Int = 0, xy: Xy? = null): Double

Set a new zoom level based on slippy tile level. When "follow position" is active the current position will be used as the reference point for the operation. In rest the screen center will be used. This may be between 0 and maxSlippyZoomLevel.

Link copied to clipboard
fun setZoomLevel(zoomLevel: Int, duration: Int = 0, xy: Xy? = null): Int

Sets a new zoom level centered on the specified screen position. This may be between 0 and maxZoomLevel.

Link copied to clipboard
external fun skipAnimation()

Stops the current animation. When this will be finished the animation will be completed with error code GemError.Cancel.

Link copied to clipboard
external fun startFollowingPosition(animation: Animation = Animation(EAnimation.Linear, 900), zoomLevel: Int = -1, viewAngle: Double = Double.MAX_VALUE, navArrow: MapSceneObject? = null, trackMethod: CameraTrackMethod? = null)

Starts following the current position. Requires automatic map rendering. Disables the cursor if enabled.

Link copied to clipboard
external fun startTrackPositions(updatePositionMs: Int, settings: MarkerCollectionRenderSettings, dataSource: DataSource? = null): Int

Start the sense data source improved position tracking on map by rendering a marker polyline between relevant map links points

Link copied to clipboard
external fun stopFollowingPosition(restoreCameraMode: Boolean = false)

Stops following the current position.

Link copied to clipboard
external fun stopTrackPositions(): Int

Stops the sense data source improved position tracking on map

Link copied to clipboard
external fun transformScreenToWgs(xy: Xy): Coordinates?

Converts a point on area where map is rendered into WGS84 coordinates.

Link copied to clipboard

Converts a screen rectangle to WGS areas list

Link copied to clipboard
external fun transformWgsToScreen(coords: Coordinates): Xy?

Converts coordinates in WGS84 projection system into the coordinate system of the area where the map is rendered.