@magiclane/maps-sdk
    Preparing search index...

    Class GemViewAbstract

    Abstract class representing a GemView. Implements EventHandler and IMapViewListener.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    Accessors

    Methods

    activateHighlight addGeoJsonAsMarkerCollection alignNorthUp captureImage centerOnArea centerOnAreaRect centerOnCoordinates centerOnMapRoutes centerOnRoute centerOnRoutes centerOnRouteTrafficEvent cursorSelectionLandmarks cursorSelectionMarkers cursorSelectionOverlayItems cursorSelectionOverlayItemsByType cursorSelectionRoutes cursorSelectionStreets deactivateAllHighlights deactivateHighlight disableDrawMarkersMode dispose enableDrawMarkersMode getHighlightArea getNearestLocations handleEvent handleTouchEvent highlightHoveredMapLabel isDefaultFollowingPosition isFollowingPositionTouchHandlerModified onCursorSelectionUpdatedLandmarks onCursorSelectionUpdatedRoutes onDoubleTouch onFollowPositionState onLongPress onMapAngleUpdate onMarkerRender onMove onPinch onPinchSwipe onPointerDown onPointerMove onPointerUp onRenderMapScale onSetMapStyle onShove onSwipe onTouch onTouchHandlerModifyFollowPosition onTouchMove onTouchPinch onTwoDoubleTouches onTwoTouches onViewRendered registerCursorSelectionUpdatedLandmarksCallback registerCursorSelectionUpdatedRoutesCallback registerDoubleTouchCallback registerFollowPositionStateCallback registerForEventsHandler registerLongPressCallback registerMapAngleUpdateCallback registerMapViewMoveStateChangedCallback registerMarkerRenderCallback registerMoveCallback registerPinchCallback registerPinchSwipeCallback registerRenderMapScaleCallback registerShoveCallback registerSwipeCallback registerTouchCallback registerTouchHandlerModifyFollowPositionCallback registerTouchMoveCallback registerTouchPinchCallback registerTwoDoubleTouchesCallback registerTwoTouchesCallback registerViewRenderedCallback releaseView resetMapSelection restoreFollowingPosition scroll setCursorScreenPosition setSlippyZoomLevel setZoomLevel skipAnimation startFollowingPosition stopFollowingPosition transformScreenToWgs transformWgsListToScreen transformWgsToScreen

    Constructors

    • Parameters

      • pointerId: any
      • mapId: number

      Returns GemView

    Properties

    _camera?: MapCamera
    _extensions?: MapViewExtensions
    _mapId: number
    _pointerId: any
    _preferences?: MapViewPreferences

    Accessors

    • get camera(): MapCamera

      Get the camera

      Returns MapCamera

      MapCamera object representing the current camera state

      An exception if it fails.

    • set camera(camera: MapCamera): void

      Set the camera

      Parameters

      • camera: MapCamera

        The MapCamera object to set

      Returns void

      An exception if it fails.

    • get cursorScreenPosition(): Point

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

      Returns Point

      The current screen coordinates (Xy) of the cursor, relative to the view's parent screen.

      An exception if it fails.

    • get extensions(): MapViewExtensions

      Get access to MapViewExtensions

      Returns MapViewExtensions

      A MapViewExtensions object, providing additional functionalities and extensions specific to the MapView.

      An exception if it fails.

    • get isFollowingPosition(): boolean

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

      Returns boolean

      True if the map is currently following the current position.

      An exception if it fails.

    • get mapId(): number

      Get the map ID.

      Returns number

    • get maxSlippyZoomLevel(): number

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

      Returns number

      The maximum slippy zoom level configured for the map view.

      An exception if it fails.

    • get maxZoomLevel(): number

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

      Returns number

      The maximum zoom level configured for the map view.

      An exception if it fails.

    • get pointerId(): any

      Get the pointer ID.

      Returns any

    • get preferences(): MapViewPreferences

      Get access to this view's preferences.

      Returns MapViewPreferences

      MapViewPreferences object

      An exception if it fails.

    • get scale(): number

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

      Returns number

      The map view current scale ( meters for 1 mm )

      An exception if it fails.

    • get slippyZoomLevel(): number

      Get the slippy zoom level.

      Returns number

      The current slippy zoom level.

      An exception if it fails.

    • get viewport(): 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.

      Returns RectType<number>

      The current viewport.

      An exception if it fails.

    • get zoomLevel(): number

      Get the zoom level.

      Returns number

      The current zoom level.

      An exception if it fails.

    Methods

    • Activate highlight

      Parameters

      • landmarks: Landmark[]

        The landmarks to be highlighted

      • options: { highlightId?: number | null; renderSettings?: HighlightRenderSettings } = {}

        Options for highlight activation.

        • OptionalhighlightId?: number | null

          The highlighted collection id (optional). If a highlighted collection with this id already exists, it will be replaced

          Highlighted collections will be displayed in ascending order sorted by highlightId

        • OptionalrenderSettings?: HighlightRenderSettings

          Specifies the way the provided landmarks are displayed on the map

      Returns void

      An exception if it fails.

    • Adds a GeoJSON data buffer as a marker collection.

      Parameters

      • buffer: string

        The GeoJSON data buffer to be added as a marker collection.

      • name: string

        The name of the marker collection.

      Returns MarkerCollection[]

      The created marker collections

      An exception if it fails.

    • Set the map north-up oriented.

      Parameters

      • Optionalanimation: GemAnimation

        Specifies the animation to be used by the operation.

      Returns void

      An exception if it fails.

    • 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.

      Returns Promise<Uint8Array<ArrayBufferLike> | null>

      An image of the map shown on the screen.

      An exception if it fails.

    • Center the view on the given WGS area

      Parameters

      • area: RectangleGeographicArea

        Geographic area

      • options: {
            animation?: GemAnimation | null;
            screenPosition?: Point | null;
            zoomLevel?: number;
        } = {}

        Options for centering.

        • Optionalanimation?: GemAnimation | null

          Specifies the animation to be used by the operation.

        • OptionalscreenPosition?: Point | null

          Screen position where the coordinates should project (default uses the specified cursor coordinates). The coordinates are relative to the parent view screen.

        • OptionalzoomLevel?: number

          Zoom level. When -1 is used, the zoom level is automatically selected so that the entire area is visible on the map.

      Returns void

      An exception if it fails.

    • Center the WGS coordinates on the specified screen coordinates.

      Parameters

      • coords: Coordinates

        Coordinates to center on.

      • options: {
            animation?: GemAnimation;
            mapAngle?: number;
            screenPosition?: Point;
            slippyZoomLevel?: number;
            viewAngle?: number;
            zoomLevel?: number;
        } = {}

        Options for centering.

        • Optionalanimation?: GemAnimation

          Specifies the animation to be used by the operation.

        • OptionalmapAngle?: number

          Map rotation angle in the range 0.0 - 360.0 degrees (use Infinity for automatic selection).

        • OptionalscreenPosition?: Point

          Screen position where the coordinates should project (default uses the specified cursor coordinates). The coordinates are relative to the parent view screen.

        • OptionalslippyZoomLevel?: number

          Slippy zoom level (use -1.0 for automatic selection).

        • OptionalviewAngle?: number

          Map view angle in the range -90.0 - 90.0 degrees (use Infinity for automatic selection).

        • OptionalzoomLevel?: number

          Zoom level (use -1 for automatic selection).

      Returns void

      An exception if the operation fails.

    • Center on the routes visible on the map.

      Parameters

      • options: {
            animation?: GemAnimation | null;
            displayMode?: RouteDisplayMode | null;
            screenRect?: RectType<number> | null;
        } = {}

        Options for centering.

        • Optionalanimation?: GemAnimation | null

          Specifies the animation to be used by the operation.

        • OptionaldisplayMode?: RouteDisplayMode | null

          Route display mode.

        • OptionalscreenRect?: RectType<number> | null

          Screen viewport rectangle where routes should be centered. The coordinates are relative to view parent screen.

      Returns void

      An exception if it fails.

    • Center on the given route.

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

      Parameters

      • route: Route

        Route to be shown.

      • options: { animation?: GemAnimation; screenRect?: RectType<number> } = {}

        Options for centering.

        • Optionalanimation?: GemAnimation

          Specifies the animation to be used by the operation.

        • OptionalscreenRect?: RectType<number>

          Screen rectangle where area should be centered. The coordinates are relative to view parent screen.

      Returns void

      An exception if it fails.

    • Center on the given routes collection.

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

      Parameters

      • options: {
            animation?: GemAnimation | null;
            displayMode?: RouteDisplayMode;
            routes?: Route[];
            screenRect?: RectType<number> | null;
        } = {}

        Options for centering.

        • Optionalanimation?: GemAnimation | null

          Specifies the animation to be used by the operation.

        • OptionaldisplayMode?: RouteDisplayMode

          Route display mode.

        • Optionalroutes?: Route[]

          Route list to be shown. If no routes are provided then centering is done on the visible routes from MapViewRoutesCollection.

        • OptionalscreenRect?: RectType<number> | null

          Screen viewport rectangle where routes should be centered. The coordinates are relative to view parent screen.

      Returns void

      An exception if it fails.

    • Center on the given traffic event.

      Parameters

      • routeTrafficEvent: RouteTrafficEvent

        RouteTrafficEvent to be shown.

      • options: {
            animation?: GemAnimation;
            rectangle?: RectType<number>;
            viewAngle?: number;
            zoomLevel?: number;
        } = {}

        Options for centering.

        • Optionalanimation?: GemAnimation

          Specifies the animation to be used by the operation.

        • Optionalrectangle?: RectType<number>

          Screen rectangle where area should be centered. The coordinates are relative to view parent screen.

        • OptionalviewAngle?: number

          Specifies the map pitch angle.

        • OptionalzoomLevel?: number

          Zoom level (use -1 for automatic selection).

      Returns void

      An exception if it fails.

    • Retrieve the list of landmarks under the cursor location.

      Use setCursorScreenPosition to set the cursor location.

      Returns Landmark[]

      A list of Landmark objects under the cursor. If no landmarks are found, the list will be empty.

      An exception if it fails.

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

      Use setCursorScreenPosition to set the cursor location.

      Returns MarkerMatch[]

      A list of MarkerMatch objects under the cursor. If no markers are found, the list will be empty.

      An exception if it fails.

    • Retrieve the list of overlay items under the cursor location.

      Use setCursorScreenPosition to set the cursor location.

      Returns OverlayItem[]

      A list of OverlayItem objects under the cursor. If no overlay items are found, the list will be empty.

      An exception if it fails.

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

      Use setCursorScreenPosition to set the cursor location.

      Parameters

      Returns OverlayItem[]

      A list of OverlayItem objects under the cursor filtered by the given overlay type. If no overlay items are found, the list will be empty.

      An exception if it fails.

    • Retrieve the list of routes under the cursor location.

      Use setCursorScreenPosition to set the cursor location.

      Returns Route[]

      A list of Route objects under the cursor. If no routes are found, the list will be empty.

      An exception if it fails.

    • Retrieve the list of streets under the cursor location.

      Use setCursorScreenPosition to set the cursor location.

      Returns Landmark[]

      A list of Street objects under the cursor. If no streets are found, the list will be empty.

      An exception if it fails.

    • Disable highlighting.

      Returns void

      An exception if it fails.

    • Disable highlighting.

      Parameters

      • OptionalhighlightId: number

        The highlighted collection id (optional).

      Returns void

      An exception if it fails.

    • Disables the draw markers mode.

      Returns Landmark[]

      Landmarks generated during the draw markers mode.

      An exception if it fails.

    • Cleans up any resources.

      Returns Promise<void>

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

      Panning/zooming the map is deactivated.

      Parameters

      Returns void

      An exception if it fails.

    • Get highlighted geographic area.

      Parameters

      • highlightId: number = 0

        An identifier for the highlight whose area is to be retrieved, with a default value of 0.

      Returns RectangleGeographicArea | null

      A RectangleGeographicArea object representing the geographic bounds of the highlighted area

      An exception if it fails.

    • Retrieve the set of landmarks on the specified coordinates.

      This is a quick synchronous reverse geocoding method.

      Parameters

      • coords: Coordinates

        Reference Coordinates for this operation.

      Returns Landmark[]

      A Landmark list containing the nearest locations to the specified coordinates. If no landmarks are found, the list will be empty.

      An exception if it fails.

    • Method called when an event is triggered from the native side.

      Should not be called by the user.

      Parameters

      • args: Record<string, any>

        The event data.

      Returns void

    • Handle a touch event.

      Parameters

      • pointerIndex: number

        The pointer index of the touch event.

      • touchType: number

        The type of touch event (0 = down, 1 = move, 2 = up, 3 = cancel).

      • x: number

        The x-coordinate of the touch event.

      • y: number

        The y-coordinate of the touch event.

      Returns number

      GemError.success if successful, or other error codes.

    • 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.

      Parameters

      • screenPosition: Point

        The hovered screen point.

      • selectMapObject: { selectMapObject?: boolean } = {}

        If true and a label is hovered, map objects attached to the label are returned via IMapViewListener.onHoveredMapLabelHighlighted. If false, no call to onHoveredMapLabelHighlighted is issued.

      Returns GemError

      GemError.success if successful, GemError.notFound if no label was found, GemError.activation if the map is invalid, GemError.noMemory if memory could not be allocated for the highlighted object, GemError.inUse if another operation is in progress, or another GemError code if an error occurs.

      An exception if the operation fails.

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

      Returns boolean

      True if the map is in the default auto-zoom follow position mode, false if it has been manually adjusted or is not in follow position mode.

      An exception if it fails.

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

      Returns boolean

      True if the follow position mode has been manually adjusted by the user, false if it remains in its default state.

      An exception if it fails.

    • Called when a double touch is detected.

      Parameters

      • pos: Point

        The position of the double touch.

      Returns void

    • Called when a long press is detected.

      Parameters

      • pos: Point

        The position of the long press.

      Returns void

    • Called when the map angle is updated.

      Parameters

      • angle: number

        The new map angle.

      Returns void

    • Called when a marker is rendered.

      Parameters

      • data: any

        The marker data.

      Returns void

    • Called when a move gesture is detected.

      Parameters

      • startPos: Point

        The start position.

      • endPos: Point

        The end position.

      Returns void

    • Called when a pinch gesture is detected.

      Parameters

      • start1: Point

        The first start point.

      • start2: Point

        The second start point.

      • end1: Point

        The first end point.

      • end2: Point

        The second end point.

      • center: Point

        The center point.

      Returns void

    • Called when a pinch swipe gesture is detected.

      Parameters

      • centerPosInPix: Point

        The center position in pixels.

      • zoomingSpeedInMMPerSec: number

        The zooming speed in mm/sec.

      • rotatingSpeedInMMPerSec: number

        The rotating speed in mm/sec.

      Returns void

    • Called when a pointer is pressed down.

      Parameters

      • pointerId: number

        The pointer identifier.

      • pos: Point

        The position of the pointer.

      Returns void

    • Called when a pointer moves.

      Parameters

      • pointerId: number

        The pointer identifier.

      • pos: Point

        The position of the pointer.

      Returns void

    • Called when a pointer is released.

      Parameters

      • pointerId: number

        The pointer identifier.

      • pos: Point

        The position of the pointer.

      Returns void

    • Called when the map scale is rendered.

      Parameters

      • scaleWidth: number

        The scale width.

      • scaleValue: number

        The scale value.

      • scaleUnits: string

        The scale units.

      Returns void

    • Called when the map style is set.

      Parameters

      • id: number

        The style id.

      • stylePath: string

        The style path.

      • viaApi: boolean

        Whether the style was set via API.

      Returns void

    • Called when a shove gesture is detected.

      Parameters

      • pointersAngleDeg: number

        The angle between pointers in degrees.

      • initial: Point

        The initial point.

      • start: Point

        The start point.

      • end: Point

        The end point.

      Returns void

    • Called when a swipe gesture is detected.

      Parameters

      • distX: number

        The horizontal distance.

      • distY: number

        The vertical distance.

      • speedMmPerSec: number

        The swipe speed in mm/sec.

      Returns void

    • Called when the map view is touched.

      Parameters

      • pos: Point

        The position of the touch event.

      Returns void

    • Called when a touch move gesture is detected.

      Parameters

      • startPos: Point

        The start position.

      • endPos: Point

        The end position.

      Returns void

    • Called when a touch pinch gesture is detected.

      Parameters

      • start1: Point

        The first start point.

      • start2: Point

        The second start point.

      • end1: Point

        The first end point.

      • end2: Point

        The second end point.

      Returns void

    • Called when two double touches are detected.

      Parameters

      • pos: Point

        The position of the touches.

      Returns void

    • Called when two touches are detected.

      Parameters

      • pos: Point

        The position of the touches.

      Returns void

    • Called when the view is rendered.

      Parameters

      • data: any

        The render data.

      Returns void

    • Parameters

      Returns void

    • Internal

      Returns void

    • Parameters

      Returns void

    • Register a callback for marker render events. Can only be called from inherited classes.

      Parameters

      • callback: ((data: any) => void) | null

        The callback to invoke when a marker is rendered.

      Returns void

    • Parameters

      Returns void

    • Parameters

      Returns void

    • Parameters

      Returns void

    • Parameters

      Returns void

    • Register a touch callback.

      Parameters

      • OptionaltouchCallback: (pos: Point) => void

        The touch callback to register.

      Returns void

    • Parameters

      Returns void

    • Parameters

      Returns void

    • Parameters

      Returns void

    • Parameters

      Returns void

    • Register a callback for view rendered events. Can only be called from inherited classes.

      Parameters

      Returns void

    • Internal

      Returns Promise<void>

    • Returns void

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

      Parameters

      • Optionalanimation: GemAnimation

        Specifies the animation to be used by the operation.

      Returns void

      An exception if it fails.

    • Scroll map.

      Parameters

      • options: { dx: number; dy: number }

        Options for scrolling.

        • dx: number

          Horizontal scroll offset

        • dy: number

          Vertical scroll offset

      Returns void

      An exception if it fails.

    • 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.

      Parameters

      • screenPosition: Point

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

      Returns Promise<any>

      An exception if it fails.

    • 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.

      Parameters

      • zoomLevel: number

        Zoom level

      • options: { duration?: number; screenPosition?: Point | null }

        Options for zooming.

        • Optionalduration?: number

          The animation duration in milliseconds (0 means no animation).

        • OptionalscreenPosition?: Point | null

          Screen coordinates on which the map should stay centered. The coordinates are relative to the parent view screen.

      Returns number

      The previous zoom level.

      An exception if it fails.

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

      This may be between 0 and maxZoomLevel

      Parameters

      • zoomLevel: number

        Zoom level

      • options: { duration?: number; screenPosition?: Point | null }

        Options for zooming.

        • Optionalduration?: number

          The animation duration in milliseconds (0 means no animation).

        • OptionalscreenPosition?: Point | null

          Screen coordinates on which the map should stay centered. The coordinates are relative to the parent view screen.

      Returns number

      On success, the previous zoom level. On error, the error code.

      An exception if it fails.

    • Parameters

      • jumpToDestination: boolean = true

      Returns void

    • Start following the current position.

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

      Parameters

      • options: { animation?: GemAnimation; viewAngle?: number; zoomLevel?: number } = {}

        Options for following position.

        • Optionalanimation?: GemAnimation

          Specifies the animation to be used by the operation.

        • OptionalviewAngle?: number

          Map view angle. Default is Infinity meaning use default specified.

        • OptionalzoomLevel?: number

          Zoom level where the animation stops. (Use -1 for automatic selection)

      Returns void

      An exception if it fails.

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

      Returns void

      An exception if it fails.

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

      Parameters

      • screenCoordinates: Point

        Screen coordinate. The coordinates are relative to the parent view screen

      Returns Coordinates

      WGS 84 coordinates of the given screen coordinate

      An exception if it fails.

    • Convert a list of WGS84 coordinates to screen coordinates.

      Parameters

      Returns Point[]

      The screen coordinates relative to view parent screen

      An exception if it fails.

    • Convert a WGS84 coordinate to a screen coordinate.

      Parameters

      Returns Point

      The screen coordinates relative to view parent screen

      An exception if it fails.