MapMarker class abstract
MapMarker is used to draw images on the map, for example to mark a specific location.
By default, the marker is centered on the given geographic coordinates. Markers keep their size regardless of the current zoom level of the map view.
The image to be displayed is represented by MapImage object. For performance reasons, it is highly recommended to reuse a single instance of the image when creating multiple identical markers.
To display the map marker, it needs to be added to the scene using MapScene.addMapMarker. To stop displaying it, remove it from the scene using MapScene.removeMapMarker.
The display of a map marker is only guaranteed in case its origin is within the viewport. At the moment, this is a known limitation that mostly affects map markers which are visually large and cover a sizeable part of the viewport.
Note: Due to technical limitations using the MapMarkers API to add a very large number of markers (several thousands, especially 10000+) is not recommended. Adding this many markers will have a negative impact on the performance leading to stuttering of the app and lower frame rates. To work around this limitation the following approach can be used: Register to map camera updates using MapCamera.addListener. Query the bounding box of the camera viewport using MapCamera.boundingBox (it may be extended) and then use the method GeoBox.containsGeoCoordinates in combination with MapCameraState.distanceToTargetInMeters to determine which MapMarkers are actually visible to the user in the current camera viewport and thus need to be added to the map.
Constructors
- MapMarker(GeoCoordinates coordinates, MapImage image)
-
Creates an instance of a marker at given coordinates, represented by specified image.
factory
- MapMarker.withAnchor(GeoCoordinates coordinates, MapImage image, Anchor2D anchor)
-
Creates an instance of a marker at given coordinates, represented by specified image,
with anchor point specifying how the image is positioned relative to the marker's coordinates.
factory
- MapMarker.withImageAndText(GeoCoordinates coordinates, MapImage image, String text)
-
Creates a
MapMarkerinstance at given coordinates with specified image and text and a default text style.factory
Properties
- anchor ↔ Anchor2D
-
The anchor point for the marker image which specifies the position offset relative
to the marker's coordinates.
Gets current anchor point for the marker image.
getter/setter pair
- coordinates ↔ GeoCoordinates
-
The point on the map where the map marker is drawn.
Gets the point on the map where the marker is drawn.
getter/setter pair
- drawOrder ↔ int
-
The draw order of this marker relative to other markers.
Gets draw order of this marker relative to other markers. The default value is 0.
getter/setter pair
- fadeDuration ↔ Duration
-
Duration of a fade-in effect on marker addition to a scene or a fade-out effect on marker removal from a scene.
Gets the current duration of a fade-in effect on marker addition to a scene or a fade-out effect on marker removal from a scene.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- image ↔ MapImage
-
Image representing the marker on the screen.
Gets currently used map image.
getter/setter pair
- isOverlapAllowed ↔ bool
-
Determines whether or not the marker can overlap other markers.
Returns
trueif the marker allows overlap with other markers,falseotherwise. Defaults totrue.getter/setter pair - isTextOptional ↔ bool
-
Determines if the marker can be displayed with icon and without text.
Returns
trueif the marker allows text to be hidden,falseotherwise. Defaults tofalse.getter/setter pair - metadata ↔ Metadata?
-
The Metadata instance attached to this marker, see Metadata.
Gets the Metadata instance attached to this marker.
This will be
nullif nothing has been attached before.getter/setter pair - opacity ↔ double
-
Opacity, the factor applied to the alpha channel of the marker image.
Gets the current opacity of the marker image. Value is in the range of [0.0, 1.0].
Default value is 1.0.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- text ↔ String
-
The text to be drawn on the map along with the image of the
MapMarker. Gets the text drawn on the map by theMapMarker.getter/setter pair - textStyle ↔ MapMarkerTextStyle
-
The
TextStyleapplied to the text of theMapMarker. Gets a copy of theTextStylecurrently in use by theMapMarker.getter/setter pair -
visibilityRanges
↔ List<
MapMeasureRange> -
The list of visibility ranges. The map marker is visible only inside these map measure ranges.
Gets the list of visibility ranges. The map marker is visible only inside these map measure
ranges. When empty (the default), the map marker is visible without map measure restrictions.
getter/setter pair
Methods
-
cancelAnimation(
MapMarkerAnimation animation) → void - Cancels single ongoing animation.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
startAnimation(
MapMarkerAnimation animation, AnimationListener? animationListener) → void - Starts animation of this map marker according to provided MapMarkerAnimation.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited