MarkerCollection class Maps & 3D Scenes
A collection that holds markers of the same visual style and geometry.
MarkerCollection groups markers that share the same MarkerType and provides operations to add, remove, query and perform hit-testing on markers.
Collections are the unit presented on a map view via MapViewMarkerCollections and are commonly customized with MarkerCollectionRenderSettings.
Example:
final collection = MarkerCollection(markerType: MarkerType.point, name: 'POIs');
collection.add(Marker()..add(Coordinates(latitude: 52.0, longitude: 4.0)));
mapController.preferences.markers.add(collection);
See also:
- MapViewMarkerCollections for displaying collections on a map view.
- MarkerCollectionRenderSettings for customizing the rendering of collections.
- MarkerSketches for an alternative collection with rich styling, allowing for advanced visual customization.
- Implementers
Constructors
- MarkerCollection.new({required MarkerType markerType, required String name})
-
Create a new MarkerCollection.
factory
Properties
- area → RectangleGeographicArea
-
The geographic bounding rectangle that encloses all markers in the collection.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → int
-
The unique identifier assigned to this collection.
no setter
- mapId → int
-
no setter
- name ↔ String
-
The collection's human-readable name.
getter/setter pair
- pointerId → int
-
The pointer ID of the native object
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → int
-
Number of markers contained in this collection.
no setter
- type → MarkerType
-
The MarkerType of markers stored in this collection.
no setter
Methods
-
add(
Marker marker, {int index = -1}) → void - Add a marker to this collection.
-
clear(
) → void - Remove all markers from this collection.
-
delete(
int index) → void -
Remove the marker at
indexfrom this collection. -
dispose(
) → void -
Disposes the native object.
inherited
-
getMarkerAt(
int index) → Marker? -
Retrieve the marker at
index. -
getMarkerById(
int id) → Marker? - Find a marker in the collection by its unique id.
-
getPointsGroupComponents(
int groupId) → List< Marker> -
Return the components (members) of a points group identified by
groupId. -
getPointsGroupHead(
int markerId) → Marker? -
Get the head marker for the points group that contains
markerId. -
hitTest(
Coordinates coordinates, {Marker? ignoreMarker}) → List< MarkerMatch> - Perform a hit test against all markers in this collection.
-
indexOf(
Marker marker) → int -
Return the index of
markerin this collection. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerAutoReleaseObject(
int pointerId) → void -
Registers an object for auto release.
inherited
-
save(
) → Uint8List? - Serialize this collection to a binary buffer.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
load(
Uint8List buffer) → MarkerCollection? - Deserialize a MarkerCollection from a binary buffer previously returned by save.