MapMarker3D class - mapview library - Dart API
MapMarker3D class abstract
Represents a 3D shape drawn on the map at specified geodetic coordinates.
It can have a solid color or be textured, depending on the data from MapMarker3DModel.
By default, a 3D marker is drawn on top of all map content, including 3D map elements like extruded buildings or 3D landmarks. This can be changed by enabling depth check using MapMarker3D.isDepthCheckEnabled.
The display of a 3D marker is only guaranteed in case its origin is within the viewport. At the moment, this is a known limitation that mostly affects a 3D marker that is visually large and covers a sizeable part of the viewport.
Sizing and scaling
Two aspects determine how big the MapMarker3D will be on the screen
and how will it behave when the map is zoomed in and out.
The first, and most impactful is RenderSizeUnit, which specifies how the vertex coordinates of the 3D model are interpreted. Most importantly, it specifies whether the 3D model is placed in world or screen coordinate space.
RenderSizeUnit.meters will make the 3D model use world coordinate space, meaning that it will change size together with the map when it is zoomed in and out.
RenderSizeUnit.pixels makes the 3D model use screen coordinate space, meaning that it will have constant size on the screen regardless of how the map zoom changes. So a simple 10 by 10 (in model space) rectangle will have a size of 10 by 10 pixels on the screen.
RenderSizeUnit.densityIndependentPixels is similar to pixels, but the resulting size will take into account the pixel density of the display, meaning that physical size on the screen will be approximately the same regardless of the size or resolution of the display.
The second aspect that determines size of MapMarker3D is scale.
It can be specified at construction time and can be changed later
at any time using MapMarker3D.scale.
Modifying at runtime
A 3D marker can be moved around a map by updating its coordinates using MapMarker3D.coordinates.
Altitude component of the coordinates, if set, controls 3D marker's elevation above ground. If not set, the 3D marker is placed at ground level.
Its orientation is specified by bearing, pitch and roll and can be changed by using MapMarker3D.bearing, MapMarker3D.pitch and MapMarker3D.roll.
Flat marker
A flat marker is a special case of a 3D marker, where the 3D shape being drawn is a simple textured rectangle. In essence it's an image drawn "on the ground". Such 3D marker can be conveniently created using MapMarker3D.fromImage constructor. Of course, once created, it can be rotated to face any direction.
Constructors
- MapMarker3D(GeoCoordinates at, MapMarker3DModel model)
-
Creates an instance of a 3D marker.
factory
- MapMarker3D.fromImage(GeoCoordinates at, MapImage image, double scale, RenderSizeUnit unit)
-
Creates a flat marker from provided map image.
factory
- MapMarker3D.withScale(GeoCoordinates at, MapMarker3DModel model, double scale)
-
Creates an instance of a 3D marker with scale factor.
factory
- MapMarker3D.withUnit(GeoCoordinates at, MapMarker3DModel model, double scale, RenderSizeUnit unit)
-
Creates a new 3D marker at given world coordinates, using the supplied 3D model.
factory
Properties
- bearing ↔ double
-
The bearing of the 3D model in degrees, from the true North in clockwise direction.
The bearing axis is perpendicular to the ground and passes through the 3D marker's location.
The Z-axis of the model is aligned with bearing axis.
Gets the bearing of the 3D model in degrees.
getter/setter pair
- coordinates ↔ GeoCoordinates
-
The position of the 3D marker on the map corresponding to the origin of the 3D marker model coordinate system.
The altitude component of the coordinates, if set, controls 3D marker's elevation
above ground. If not set, the 3D marker is placed at ground level.
Gets the 3D marker's position on the map corresponding to the origin of the 3D marker model
coordinate system.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- isDepthCheckEnabled ↔ bool
-
Determines whether the depth of the 3D marker's vertices is considered during rendering.
If set to
false, the 3D marker will always appear in front of any other map objects. If set totruethe 3D marker might be occluded by other map objects like extruded buildings.getter/setter pair - isRenderInternalsEnabled ↔ bool
-
Indicates whether to render internal geometry of a 3D marker occluded by its front facing polygons.
Default value is
false. Can be used with translucent 3D marker.getter/setter pair - metadata ↔ Metadata?
-
The Metadata instance attached to this 3D marker.
Gets the Metadata instance attached to this 3D marker.
The default value is
null.getter/setter pair - opacity ↔ double
-
The opacity factor adjusting the opacity of a 3D marker.
The factor is applied to the alpha channel of the resulting texture of the marker.
Default value is 1.0 meaning marker is displayed with the default opacity of the texture image or the
specified fill color specified
in MapMarker3DModel.
Returns an opacity factor which specifies the translucency of a 3D map marker.
getter/setter pair
- pitch ↔ double
-
The pitch of the 3D model in degrees.
The pitch axis is parallel to the ground, passes through the location of the 3D marker
and aligns with the longitude axis if the bearing is 0. However, this axis rotates with
the 3D marker according to the bearing value. Negative values cause the top of the
3D marker to lean forward. The X-axis of the model is aligned with pitch axis.
Gets the pitch of the 3D model in degrees.
getter/setter pair
- roll ↔ double
-
The roll angle of the 3D model in degrees.
The roll axis is parallel to the ground, passes through the 3D marker's
location and is aligned initially with the true North. However, when the bearing changes,
it rotates around the bearing axis with the 3D marker.
Positive/negative values cause a clockwise/counterclockwise rotation when viewing along the axis
in the direction of the true North. The Y-axis of the model is aligned with the roll axis.
Gets the roll of the 3D model in degrees.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scale ↔ double
-
Scale factor applied to the 3D model before rendering.
Gets the scale factor applied to the 3D model before rendering.
getter/setter pair
-
visibilityRanges
↔ List<
MapMeasureRange> -
The list of visibility ranges. The 3D marker is visible only inside these map measure ranges.
A range is half open - [minimumZoomLevel, maximumZoomLevel), the given maximum value
is not contained in the range.
getter/setter pair
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited