Home > @magiclane/maps-sdk > GemView

GemView class

Abstract class representing a GemView. Implements EventHandler and IMapViewListener.

Core

Signature:

export declare abstract class GemView implements EventHandler, IMapViewListener 

Implements: EventHandler, IMapViewListener

Constructors

Constructor

Modifiers

Description

(constructor)(pointerId, mapId)

Constructs a new instance of the GemView class

Properties

Property

Modifiers

Type

Description

_camera?

protected

MapCamera

(Optional)

_extensions?

protected

MapViewExtensions

(Optional)

_mapId

protected

number

_pointerId

protected

any

_preferences?

protected

MapViewPreferences

(Optional)

camera

MapCamera

Get the camera

cursorScreenPosition

readonly

Point

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

cursorWgsPosition

readonly

Coordinates

Get the cursor WGS84 position.

extensions

readonly

MapViewExtensions

Get access to MapViewExtensions

hasTerrainTopography

readonly

boolean

Returns true if terrain topography is available for this map view.

isAnimationInProgress

readonly

boolean

Returns true if a map animation is currently in progress.

isCameraMoving

readonly

boolean

Returns true if the camera is currently moving.

isFollowingPosition

readonly

boolean

Returns true if the camera is following the current real/simulated position and false otherwise.

isRenderEnabled

boolean

Returns true if map rendering is enabled.

mapAngle

readonly

number

Get the map angle in degrees.

mapId

readonly

number

Get the map ID.

maxSlippyZoomLevel

readonly

number

Get the maximum slippy zoom level. Bigger zoom factor means closer to the map.

maxZoomLevel

number

Get the maximum zoom level. Bigger zoom factor means closer to the map.

minZoomLevel

number

Get the minimum zoom level. Bigger zoom factor means closer to the map.

pointerId

readonly

any

Get the pointer ID.

preferences

readonly

MapViewPreferences

Get access to this view's preferences.

scale

readonly

number

Get the map view current scale ( meters for 1 mm )

slippyZoomLevel

readonly

number

Get the slippy zoom level.

viewAngle

readonly

number

Get the view angle in degrees.

viewport

readonly

RectType<number>

The current viewport of the map view.

Fields RectType.x and RectType.y are 0 as they are measured from the top left corner of the map view. Fields RectType.width and RectType.height are the width and height of the map view in physical pixels.

To get the associated RectangleGeographicArea, use the appropriate coordinate transformation method.

viewportCenter

readonly

Point

Get the center of the current viewport in physical pixels.

viewportF

readonly

RectType<number>

The current viewport of the map view in parent screen ratio coordinates.

zoomLevel

readonly

number

Get the zoom level.

Methods

Method

Modifiers

Description

activateHighlight(landmarks, { renderSettings, highlightId, }, input)

Activate highlight

addGeoJsonAsMarkerCollection(buffer, name)

Adds a GeoJSON data buffer as a marker collection.

alignNorthUp(animation)

Set the map north-up oriented.

canZoom(zoomLevel, { screenPosition }, input)

Check if zooming to the given level is possible.

captureImage()

Make a screen region capture of the current map in JPEG format.

No cursor or on-screen information is included. On Android it includes the cursor and any on-screen information.

centerOnArea(area, options)

Center the view on the given WGS area

centerOnAreaRect(area, options)

Center a geographic area within the specified screen rectangle.

Positions the map to display the given area inside viewRc, which allows precise control over which portion of the screen shows the area. This is useful for reserving space for overlay UI or adding effective padding around the centered content.

The zoom level is automatically selected to fit the area within the rectangle unless an explicit value is provided.

centerOnCoordinates(coords, options)

Center the WGS coordinates on the specified screen coordinates.

centerOnMapRoutes({ displayMode, screenRect, animation, }, input)

Center on the routes visible on the map.

centerOnRoute(route, { screenRect, animation, }, input)

Center on the given route.

The zoom level is automatically selected so that the entire route is visible on the map.

centerOnRouteInstruction(routeInstruction, { zoomLevel, screenPosition, viewAngle, animation, }, input)

Center on the given route instruction.

The route instruction turn arrow will be visible on the map.

centerOnRoutePart(route, startDist, endDist, { screenRect, animation, }, input)

Center on the given route part.

The zoom level is automatically selected so that the entire route is visible on the map.

centerOnRoutes({ routes, displayMode, screenRect, animation, }, input)

Center on the given routes collection.

All routes from the list will be visible on the map. The zoom level is automatically selected.

centerOnRouteTrafficEvent(routeTrafficEvent, { zoomLevel, rectangle, viewAngle, animation, }, input)

Center on the given traffic event.

checkObjectVisibility({ mapSceneObject, rect, }, input)

Check if a map scene object is visible within the provided rectangle.

clearRouteInstruction()

Clear the route instruction turn arrow.

cursorSelectionLandmarks()

Retrieve the list of landmarks under the cursor location.

Use setCursorScreenPosition to set the cursor location.

cursorSelectionMapSceneObject()

Retrieve the map scene object under the cursor location.

Use setCursorScreenPosition to set the cursor location.

cursorSelectionMarkers()

Retrieves a reference to a list of markers under the current cursor location.

Use setCursorScreenPosition to set the cursor location.

cursorSelectionOverlayItems()

Retrieve the list of overlay items under the cursor location.

Use setCursorScreenPosition to set the cursor location.

cursorSelectionOverlayItemsByType(overlayId)

Retrieve the list of overlay items under the cursor location filtered by overlay type.

Use setCursorScreenPosition to set the cursor location.

cursorSelectionPath()

Retrieve the path under the cursor location.

Use setCursorScreenPosition to set the cursor location.

cursorSelectionRoutes()

Retrieve the list of routes under the cursor location.

Use setCursorScreenPosition to set the cursor location.

cursorSelectionStreets()

Retrieve the list of streets under the cursor location.

Use setCursorScreenPosition to set the cursor location.

cursorSelectionTrafficEvents()

Retrieve the traffic events under the cursor location.

Use setCursorScreenPosition to set the cursor location.

deactivateAllHighlights()

Disable highlighting.

deactivateHighlight(highlightId)

Disable highlighting.

disableDrawMarkersMode()

Disables the draw markers mode.

dispose()

enableDrawMarkersMode(renderSettings)

Allows the user to draw markers on the map using touch gestures.

Panning/zooming the map is deactivated.

getAltitude(coordinates)

Get altitude for the given coordinates.

getClosestAddressLandmark(params)

Get the closest address landmark near the provided coordinates.

getHighlightArea(highlightId)

Get highlighted geographic area.

getIsFollowingPosition(alsoFlyToPosition)

Returns true if the camera is following the current real/simulated position and false otherwise.

getNearestLocations(coords)

Retrieve the set of landmarks on the specified coordinates.

This is a quick synchronous reverse geocoding method.

getOptimalHighlightCenterViewport({ screenRect, }, input)

Get the optimal viewport rectangle for centering on highlights.

getOptimalRoutesCenterViewport(routes, { screenRect }, input)

Get the optimal viewport rectangle for centering on routes.

getTransferStatistics(type)

Get transfer statistics for the given online service type.

getVisibleRouteInterval(route, { screenRect }, input)

Get the visible route interval in meters.

handleEvent(args)

handleTouchEvent(pointerIndex, touchType, x, y)

Handle a touch event.

highlightHoveredMapLabel(screenPosition, { selectMapObject }, input)

Highlight the hovered map label under the given screen coordinates.

To turn off the hover highlight, call this function with a (0, 0) screen position.

A recommended usage is to call highlightHoveredMapLabel(..., selectMapObject = false) to check if a label is hovered (and possibly update the tracking device cursor shape, etc.), and if the cursor position is stationary for a reasonable time period (e.g., 500 ms), call highlightHoveredMapLabel(..., selectMapObject = true) to retrieve the hovered map object data.

isDefaultFollowingPosition()

Returns true if the camera is following the current real/simulated position in default auto-zoom mode and false otherwise.

isFollowingPositionTouchHandlerModified()

Returns true if the camera is following the current real/simulated position from a fixed relative position adjusted by user input and false otherwise.

onCursorSelectionUpdatedLandmarks(landmarks)

onCursorSelectionUpdatedMapSceneObject(mapSceneObject)

onCursorSelectionUpdatedMarkers(markerMatches)

onCursorSelectionUpdatedOverlayItems(overlayItems)

onCursorSelectionUpdatedPath(path)

onCursorSelectionUpdatedRoutes(routes)

onCursorSelectionUpdatedTrafficEvents(trafficEvents)

onDoubleTouch(pos)

onFollowPositionState(followPositionState)

onHoveredMapLabelHighlightedLandmark(object)

onHoveredMapLabelHighlightedOverlayItem(object)

onHoveredMapLabelHighlightedTrafficEvent(object)

onLongPress(pos)

onMapAngleUpdate(angle)

onMarkerRender(data)

onMove(startPos, endPos)

onPinch(start1, start2, end1, end2, center)

onPinchSwipe(centerPosInPix, zoomingSpeedInMMPerSec, rotatingSpeedInMMPerSec)

onPointerDown(pointerId, pos)

onPointerMove(pointerId, pos)

onPointerUp(pointerId, pos)

onRenderMapScale(scaleWidth, scaleValue, scaleUnits)

onSetMapStyle(id, stylePath, viaApi)

onShove(pointersAngleDeg, initial, start, end)

onSwipe(distX, distY, speedMmPerSec)

onTouch(pos)

onTouchHandlerModifyFollowPosition(followPositionState)

onTouchMove(startPos, endPos)

onTouchPinch(start1, start2, end1, end2)

onTwoDoubleTouches(pos)

onTwoTouches(pos)

onViewportResized(viewport)

onViewRendered(data)

registerCursorSelectionMapSceneObjectCallback(cursorSelectionMapSceneObjectCallback)

Register a callback for cursor selection map scene object updates.

registerCursorSelectionUpdatedLandmarksCallback(cursorSelectionLandmarksCallback)

Register a callback for cursor selection landmark updates.

registerCursorSelectionUpdatedMarkersCallback(cursorSelectionMarkersCallback)

Register a callback for cursor selection marker match updates.

registerCursorSelectionUpdatedOverlayItemsCallback(cursorSelectionOverlayItemsCallback)

Register a callback for cursor selection overlay item updates.

registerCursorSelectionUpdatedPathCallback(cursorSelectionPathCallback)

Register a callback for cursor selection path updates.

registerCursorSelectionUpdatedRoutesCallback(cursorSelectionRoutesCallback)

Register a callback for cursor selection route updates.

registerCursorSelectionUpdatedTrafficEventsCallback(cursorSelectionRouteTrafficCallback)

Register a callback for cursor selection traffic event updates.

registerDoubleTouchCallback(doubleTouchCallback)

Register a callback for double-touch events.

registerFollowPositionStateCallback(followPositionStateUpdatedCallback)

Register a callback for follow-position state transitions.

registerForEventsHandler()

Register this view for event handling. Initializes event filtering and handler registration.

registerHoveredMapLabelHighlightedLandmarkCallback(hoveredMapLabelHighlightedLandmarkCallback)

Register a callback for hovered map label landmark highlight updates.

registerHoveredMapLabelHighlightedOverlayItemCallback(hoveredMapLabelHighlightedOverlayItemCallback)

Register a callback for hovered map label overlay item highlight updates.

registerHoveredMapLabelHighlightedTrafficEventCallback(hoveredMapLabelHighlightedTrafficEventCallback)

Register a callback for hovered map label traffic event highlight updates.

registerLongPressCallback(touchCallback)

Register a callback for long-press touch events.

registerMapAngleUpdateCallback(mapAngleUpdatedCallback)

Register a callback for map angle update events.

registerMapViewMoveStateChangedCallback(onMapViewMoveStateChangedCallback)

Register a callback for map movement state changes.

registerMarkerRenderCallback(callback)

Register a callback for marker render events.

registerMoveCallback(moveCallback)

Register a callback for move gesture events.

registerPinchCallback(pinchCallback)

Register a callback for pinch gesture events.

registerPinchSwipeCallback(pinchSwipeCallback)

Register a callback for pinch-swipe gesture events.

registerRenderMapScaleCallback(scaleCallback)

Register a callback for rendered map scale changes.

registerSetMapStyleCallback(callback)

Register a callback for map style change events.

registerShoveCallback(shoveCallback)

Register a callback for shove gesture events.

registerSwipeCallback(swipeCallback)

Register a callback for swipe gesture events.

registerTouchCallback(touchCallback)

Register a touch callback.

registerTouchHandlerModifyFollowPositionCallback(touchHandlerModifyFollowPositionCallback)

Register a callback for touch-handler follow-position modification state transitions.

registerTouchMoveCallback(touchMoveCallback)

Register a callback for touch-move gesture events.

registerTouchPinchCallback(touchPinchCallback)

Register a callback for touch-pinch gesture events.

registerTwoDoubleTouchesCallback(twoDoubleTouchCallback)

Register a callback for two-double-touch events.

registerTwoTouchesCallback(twoTouchCallback)

Register a callback for two-touch events.

registerViewportResizedCallback(viewportResizedCallback)

Register a callback for viewport resize events.

registerViewRenderedCallback(callback)

Register a callback for view rendered events.

resetMapSelection()

Reset the map selection to the viewport center.

Moves the cursor screen position back to the center of the current viewport, clearing any previous custom cursor placement used for selection operations.

restoreFollowingPosition(animation)

Restore following position from a manually adjusted mode (camera position fixed relative to the current/simulated position) to default auto-zoom mode.

scroll({ dx, dy }, input)

Scroll map.

setClippingArea(area)

Set the view clipping rectangle in parent screen ratio coordinates.

setCursorScreenPosition(screenPosition)

Set the cursor screen position.

Use this function to trigger a map view selection (POI, landmark, overlay, route, path, marker) at the given screen coordinates. The current view selection can be queried via cursorSelectionRoutes, cursorSelectionLandmarks, cursorSelectionStreets, cursorSelectionOverlayItems, cursorSelectionMarkers methods.

setSlippyZoomLevel(zoomLevel, { duration, screenPosition, }, input)

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. Otherwise, the screen center will be used. The zoom level may be between 0 and MaxSlippyZoomLevel.

setZoomLevel(zoomLevel, { duration, screenPosition }, input)

Set a new zoom level centered on the specified screen position.

This may be between 0 and maxZoomLevel

skipAnimation(jumpToDestination)

Stop the current map animation.

Immediately stops any ongoing animated transition triggered by centering methods. By default, the map completes the animation instantaneously by jumping to the target destination. Set jumpToDestination to false to stop at the current intermediate position instead.

startFollowingPosition({ animation, zoomLevel, viewAngle, positionObj, }, input)

Start following the current position.

Requires automatic map rendering. Disables the cursor if it is enabled.

stopFollowingPosition({ restoreCameraMode }, input)

Stop the camera from following the current real/simulated position.

transformScreenToWgs(screenCoordinates)

Convert a screen(x, y) coordinate to a WGS(lon, lat) coordinate.

transformWgsListToScreen(coords)

Convert a list of WGS84 coordinates to screen coordinates.

transformWgsToScreen(coords)

Convert a WGS84 coordinate to a screen coordinate.