The MarkerCollection provides bindings between an array of arbitrary records and the corresponding markers.

  • Attributes: attributes are shared with all markers, for the position-attribute this has to be a dynamic attribute, all other attributes could be either static or dynamic attributes.
  • Data-updates: data in the collection can be updated after creation. This will assume that complete sets of records are passed on every update. If incremental updates are needed, those have to be applied to the data before updating the marker collection. When transitions are implemented (also for performance reasons), it will become important to recognize identical records, so those can be updated instead of re-created with every update.
const myData = [{position: [10, 53.5]}, {position: [-110, 23]}];

const markers = new MarkerCollection(myData, {
position: ({data}) => data.position
});

markers.map = map;

Type Parameters

  • TUserData extends object = object

Hierarchy (View Summary)

Constructors

Properties

Accessors

Methods

Constructors

Properties

key?: (data: TUserData) => string

The key function used to create string ids for the records in the collection. Specifying this function is highly recommended when the data needs to be updated.

Accessors

  • get map(): null | Map

    Returns the Google Map instance this collection was added to.

    Returns null | Map

  • set map(map: null | Map): void

    Adds this collection to the specified map instance. This will add all markers to the map.

    Parameters

    • map: null | Map

    Returns void

Methods

  • Generates a key for the passed user-data record. This implementation calls the key-function if specified or generates a random key and stores it.

    Parameters

    Returns string

  • Sets or updates the data for this collection. When updating data, the implementation will use the key-function provided with the Options to detrmine which records were added, removed or changed and update the underlying marker instances accordingly.

    Parameters

    Returns void

MMNEPVFCICPMFPCPTTAAATR