Polyline

class Polyline(points: List<LatLng>, strokeColor: Color = Color.Black, strokeWidth: Float = 10.0f, strokePattern: PathEffect? = null, pattern: List<PatternItem>? = null, startCap: StrokeCap = StrokeCap.Butt, endCap: StrokeCap = StrokeCap.Butt, strokeJoin: StrokeJoin = StrokeJoin.Round, geodesic: Boolean = false, spans: List<StyleSpan> = emptyList(), visible: Boolean = true, clickable: Boolean = false, zIndex: Float = 0.0f, tag: Any? = null)(source)

A polyline on the map: connected line segments.

The polyline is a live handle, as returned by OpenMapView.addPolyline: setting a property, e.g. polyline.strokeWidth = 16f, redraws the map right away, and remove takes it off the map. Java code uses the getters and setters, e.g. polyline.setWidth(16f).

Parameters

points

the geographic coordinates of the path, at least 2

strokeColor

the line color, used where no spans apply

strokeWidth

the line width in pixels

strokePattern

the stroke pattern, e.g. dashed; null for a solid line

pattern

the stroke pattern as dots, dashes and gaps, used instead of strokePattern if not null

startCap

the shape of the start

endCap

the shape of the end

strokeJoin

the shape of the corners

geodesic

whether segments are drawn as great-circle paths instead of straight lines on the Mercator map

spans

style spans for a multi-colored line, overriding strokeColor for their segments

visible

whether the polyline is visible

clickable

whether a tap on the polyline is reported to its click listener

zIndex

draw order: polylines with a higher zIndex are drawn on top

tag

optional user data

Constructors

Link copied to clipboard
constructor(points: List<LatLng>, strokeColor: Color = Color.Black, strokeWidth: Float = 10.0f, strokePattern: PathEffect? = null, pattern: List<PatternItem>? = null, startCap: StrokeCap = StrokeCap.Butt, endCap: StrokeCap = StrokeCap.Butt, strokeJoin: StrokeJoin = StrokeJoin.Round, geodesic: Boolean = false, spans: List<StyleSpan> = emptyList(), visible: Boolean = true, clickable: Boolean = false, zIndex: Float = 0.0f, tag: Any? = null)

Properties

Link copied to clipboard

Whether a tap on the polyline is reported to its click listener

Link copied to clipboard

The shape of the end

Link copied to clipboard

Whether segments are drawn as great-circle paths instead of straight lines on the Mercator map

Link copied to clipboard
val id: String

The unique id of this polyline, e.g. "pl0", which stays the same for its lifetime. copy returns a polyline with a new id.

Link copied to clipboard

The stroke pattern as dots, dashes and gaps, used instead of strokePattern if not null

Link copied to clipboard

The geographic coordinates of the path, at least 2

Link copied to clipboard

Style spans for a multi-colored line, overriding strokeColor for their segments

Link copied to clipboard

The shape of the start

Link copied to clipboard

The line color, used where no spans apply

Link copied to clipboard

strokeColor as an ARGB color int, e.g. for Java code.

Link copied to clipboard

The shape of the corners

Link copied to clipboard

The stroke pattern, e.g. dashed; null for a solid line

Link copied to clipboard

The line width in pixels

Link copied to clipboard
var tag: Any?

Optional user data

Link copied to clipboard

Whether the polyline is visible

Link copied to clipboard

Draw order: polylines with a higher zIndex are drawn on top

Functions

Link copied to clipboard
fun copy(points: List<LatLng> = this.points, strokeColor: Color = this.strokeColor, strokeWidth: Float = this.strokeWidth, strokePattern: PathEffect? = this.strokePattern, pattern: List<PatternItem>? = this.pattern, startCap: StrokeCap = this.startCap, endCap: StrokeCap = this.endCap, strokeJoin: StrokeJoin = this.strokeJoin, geodesic: Boolean = this.geodesic, spans: List<StyleSpan> = this.spans, visible: Boolean = this.visible, clickable: Boolean = this.clickable, zIndex: Float = this.zIndex, tag: Any? = this.tag): Polyline

Returns a new polyline with the given properties changed, not added to any map.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
fun getColor(): Int

The stroke color as an ARGB color int, like getColor() of the Maps SDK.

Link copied to clipboard
fun getEndCap(): Cap

The shape of the end, like getEndCap() of the Maps SDK.

Link copied to clipboard

The shape of the corners as a JointType constant, like getJointType() of the Maps SDK.

Link copied to clipboard

The shape of the start, like getStartCap() of the Maps SDK.

Link copied to clipboard

The stroke color as an ARGB color int, the same as getColor.

Link copied to clipboard

The stroke width in pixels, like getWidth() of the Maps SDK.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun remove()

Removes the polyline from the map that shows it.

Link copied to clipboard
fun setColor(color: Int)

Sets the stroke color from an ARGB color int, like setColor(int) of the Maps SDK.

Link copied to clipboard
fun setEndCap(cap: Cap)

Sets the shape of the end, like setEndCap(Cap) of the Maps SDK.

Link copied to clipboard
fun setJointType(jointType: Int)

Sets the shape of the corners from a JointType constant, like setJointType(int) of the Maps SDK.

Link copied to clipboard
fun setStartCap(cap: Cap)

Sets the shape of the start, like setStartCap(Cap) of the Maps SDK.

Link copied to clipboard
fun setStrokeColor(color: Int)

Sets the stroke color from an ARGB color int, the same as setColor.

Link copied to clipboard

Sets strokePattern from an android.graphics.PathEffect, e.g. a DashPathEffect from Java.

Link copied to clipboard
fun setWidth(width: Float)

Sets the stroke width in pixels, like setWidth(float) of the Maps SDK.