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

    Class MarkerCollection

    Marker collection class

    Holds markers of a single visual style and geometry class for a map view.

    Common tasks are creating a collection for a specific marker kind and adding or removing markers, looking up markers by position or identifier, iterating or counting entries, querying the collection's geographic extent for layout or hit‑testing, grouping and retrieving related components.

    Can be presented on a map via the MapViewMarkerCollections object associated with a GemMapController.

    Also see MarkerSketches for a specialized marker collection with per-marker render settings.

    Index

    Constructors

    • Parameters

      • __namedParameters: { mapId: number; pointerId: number }

      Returns MarkerCollection

    Accessors

    • get id(): number

      Get collection id.

      Returns number

      collection id

    • get mapId(): number

      Returns number

    • get name(): string

      Get collection name.

      Returns string

      Collection name

    • set name(name: string): void

      Set collection name.

      Parameters

      • name: string

        Collection name

      Returns void

    • get pointerId(): number

      Returns number

    • get size(): number

      Get marker count.

      Returns number

      Collection size

    • get type(): MarkerType

      Get collection type.

      Returns MarkerType

      Collection type

    Methods

    • Add a new marker to collection.

      Parameters

      • marker: Marker

        The marker added to the collection

      • index: number = -1

        The new marker position in collection. -1 means at the collection end (topmost)

      Returns void

    • Get marker at a specific index (alias for getMarkerAt).

      Parameters

      • index: number

      Returns Marker | null

    • Delete all markers.

      Returns void

    • Delete a marker by index.

      Parameters

      • index: number

        The index of the marker to be deleted

      Returns void

    • Returns void

    • Get the marker at the given index.

      Return null if index is not valid.

      Parameters

      • index: number

        The marker index

      Returns Marker | null

      Marker object. If the index is not valid then null is returned

    • Get the marker with the given id.

      Parameters

      • id: number

        The marker id

      Returns Marker | null

      Marker object or null if not found

    • Gets the points group components.

      This requires the collection to be added to a map view collection with MarkerCollectionRenderSettings.buildPointsGroupConfig set to true

      If points group head info is not available the function will return a default list and will set the API error accordingly

      Parameters

      • groupId: number

        The group id. It needs to be the marker id returned by MarkerCollection.getPointsGroupHead method

      Returns Marker[]

      Points group components list if the groupId is valid, empty list otherwise. The list does not contain the group head marker.

    • Gets the points group head for the given marker id.

      This requires the collection to be added to a map view collection with MarkerCollectionRenderSettings.buildPointsGroupConfig set to true

      If points group head info is not available the function will return null and will set the API error accordingly

      If markerId is already a points group head the function will return a reference to the queried marker and will set the API error accordingly

      Parameters

      • markerId: number

        The marker id belonging to the points group

      Returns Marker | null

      Points group head marker or null if not found

    • Hit test in collection markers.

      Parameters

      • coordinates: Coordinates

        The coordinates of the position to be tested

      • OptionalignoreMarker: Marker

        The marker to be ignored in the test

      Returns MarkerMatch[]

      The list of marker matches

    • Get the index of the given marker.

      Parameters

      Returns number

      The index of the given marker if the marker is in the collection, -1 if the marker is not in the collection

    • Serialize to buffer.

      Returns Uint8Array<ArrayBufferLike> | null

      Serialized Uint8Array buffer on success, null otherwise

    • Serialize collection to JSON format.

      Returns any

    • Create a new marker collection.

      Parameters

      • markerType: MarkerType

        The type of markers this collection will hold

      • name: string

        The name of the collection

      Returns MarkerCollection

    • Deserialize from buffer.

      Parameters

      • buffer: Uint8Array

        The buffer to deserialize from

      Returns MarkerCollection | null

      Deserialized MarkerCollection object on success, null otherwise