MapPolyline
public class MapPolyline
extension MapPolyline: NativeBase
extension MapPolyline: Hashable
A visual representation of a line on the map.
The geometry to be visualized is represented by an instance of GeoPolyline.
Altitude component of GeoPolyline‘s vertices is ignored.
-
Creates a new
MapPolylineinstance with a specified visual representation.Altitude component of
GeoPolyline‘s vertices is ignored.After creating a
MapPolylinewith this representation, the deprecatedMapPolylineproperties do not work and any change to them will be ignored. Any modifications to polyline’s appearance must be done withMapPolyline.setRepresentation(...).Declaration
Swift
public init(geometry: GeoPolyline, representation: MapPolyline.Representation)Parameters
geometryThe list of vertices representing the polyline.
representationThe styling properties of the polyline.
-
The list of vertices that represent the geometry of the polyline. Altitude component of
GeoPolyline‘s vertices is ignored.Declaration
Swift
public var geometry: GeoPolyline { get set } -
The draw order of the polyline. Polylines with a higher draw order are drawn on top of polylines with a lower draw order.
In case multiple polylines have the same draw order, they can be rendered in different ways depending on the
MapPolyline.drawOrderTypeset.The value is clamped to the range [0; 1023]. The default draw order is 0.
Declaration
Swift
public var drawOrder: Int32 { get set } -
The draw order type of the polyline. The default value is
DrawOrderType.mapSceneAdditionOrderDependent.For
DrawOrderType.mapSceneAdditionOrderDependent, map polylines with outlines having the same draw order are drawn as a whole in the order of addition to a map scene. There is no possibility that parts of another polyline, regardless of its draw order value, are drawn between outline and mainline of another polyline.With
DrawOrderType.mapSceneAdditionOrderDependentpolylines are rendered one by one. ForDrawOrderType.mapSceneAdditionOrderIndependentfor multiple polylines with outlines having the same draw order, all outlines are rendered first in an arbitrary order and then all mainlines are drawn on top of those polylines in an arbitrary order.DrawOrderType.mapSceneAdditionOrderIndependentallows speeding up the rendering process and keeping high frame rates when many similar polylines (with same styling attributes andMapPolyline.Representation) are present in a map scene.Declaration
Swift
public var drawOrderType: DrawOrderType { get set } -
The list of visibility ranges. The map polyline 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.
When empty (the default), the map polyline is visible without map measure restrictions. Only
MapMeasureRange(s) ofMapMeasure.Kind.zoomLeveltype are supported.MapMeasureRange(s) of other unsupported types will be ignored.Declaration
Swift
public var visibilityRanges: [MapMeasureRange] { get set } -
The progress from the polyline’s starting point, as a ratio of its total length clamped to the range [0, 1]. As the progress varies, the equivalent part of the polyline gets covered by the progress color and progress outline color. The rest of the polyline until its end point retains the line color and outline color along with an optional dash pattern.
The default progress is 0.
Declaration
Swift
public var progress: Double { get set } -
The color used for the progress part of the polyline. The default progress color is opaque white.
Declaration
Swift
public var progressColor: UIColor { get set } -
The color used for outline of the progress part of the polyline. The default progress color is opaque white.
Declaration
Swift
public var progressOutlineColor: UIColor { get set } -
The maximum gradient length between
MapPolyline.lineColor' and 'MapPolyline.progressColorin zoom level dependent pixels. To achieve a constant gradient length, useMapMeasureDependentRenderSizewith a single value. To achieve a gradient length dependent on map zoom, useMapMeasureDependentRenderSizewith multiple values. The default value is a constant gradient length of zero pixels. The gradient is guaranteed to fit into polyline, i.e. the actual gradient can be shorter thenprogressGradientLength.For
MapMeasure.KindonlyMapMeasure.Kind.zoomLevelis supported. ForRenderSize.UnitonlyRenderSize.Unit.pixelsis supported. When setting the attribute with with unsupported values, the operation is ignored.Declaration
Swift
public var progressGradientLength: MapMeasureDependentRenderSize { get set } -
List of map content categories this polyline should block. Map content categories overlapping the polyline geometry (progress and non-progress) will be discarded from being rendered.
Duplicate entries will be ignored and will have no additional effect.
Default value is an empty list meaning none of the map categories will be blocked.
Declaration
Swift
public var mapContentCategoriesToBlock: [MapContentCategory] { get set } -
Base class to represent the visual appearance of a
See moreMapPolyline.Declaration
Swift
public class Representation : MapItemRepresentation -
Represents a dash pattern for the map polyline consisting of images rendered with certain gaps from each other.
This dash pattern representation consists only of images rendered at certain points along the polyline. For rendering them without any distortions, polyline gets sliced into series of straight segments that are multiple of sum of dash and gap lengths. For this reason, the new polyline geometry might not align fully with original geometry.
The
MapPolyline.DashImageRepresentation.dashImageis stretched according toMapPolyline.DashImageRepresentation.dashLengthandMapPolyline.DashImageRepresentation.dashWidth, with image’s width matched todashLengthand image’s height matched todashWidth. The image is oriented so that its bottom is on the left-hand side between verticesnandn+1.The spacing between images is specified by
MapPolyline.DashImageRepresentation.gapLength.Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.
See moreDeclaration
Swift
public class DashImageRepresentation : MapPolyline.Representation -
Representation for a solid line without outline.
Can represent polylines that have constant width or width dependent on the map zoom.
To achieve constant width lines, use
MapMeasureDependentRenderSizewith a single value.To achieve line width dependent on map zoom, use
MapMeasureDependentRenderSizewith multiple values.For
MapMeasure.KindonlyMapMeasure.Kind.zoomLevelis supported.For
See moreRenderSize.UnitonlyRenderSize.Unit.pixelsis supported.Declaration
Swift
public class SolidRepresentation : MapPolyline.Representation -
Represents a dash pattern for map polyline where the dash can be rendered as a colored line and the gap can be either empty or colored.
The length of the dash and gap are set independently, allowing for patterns like
See more' — — — —'(dash length = gap length) or' ——— ——— ———'(dash length != gap length).Declaration
Swift
public class DashRepresentation : MapPolyline.Representation -
Changes the appearance of the
MapPolylineinstance.Declaration
Swift
public func setRepresentation(_ representation: MapPolyline.Representation)Parameters
representationThe representation describing a new appearance of the
MapPolyline. -
Starts an animation of this map polyline.
The
MapPolylineAnimationmay be shared between multiple instances ofMapPolyline.Starting animation on one polyline does not influence any ongoing animations on other polylines. Any ongoing animation of this map polyline will get cancelled.
Declaration
Swift
public func startAnimation(_ animation: MapPolylineAnimation, animationDelegate: AnimationDelegate)Parameters
animationThe animation to start.
animationDelegateThe delegate to receive notifications about animation start, completion or cancellation.
-
Cancels single ongoing animation of this map polyline.
Does nothing if the specified animation is not currently in progress for this polyline. Does not affect other polylines that might be running this animation.
Declaration
Swift
public func cancelAnimation(_ animation: MapPolylineAnimation)Parameters
animationThe animation to cancel