YMKPolylineMapObject

class YMKPolylineMapObject : YMKMapObject

A polyline object with adjustable segment colors. Supports outlines, dash, arrows, and hiding parts of the polyline efficiently.

Summary

Instance methods

func select(withSelectionColor selectionColor: UIColor,
                                  subpolyline: YMKSubpolyline)
Highlights a subpolyline using the specified color

func hide(with subpolyline: YMKSubpolyline)
Hides the subpolyline, canceling any previous hides

func hide(with subpolylines: [YMKSubpolyline])
Hides multiple subpolylines, canceling any previous hides

func setStrokeColorsWithColors(_ colors: [NSNumber], weights: [NSNumber])
Sets indexes of colors in palette for line segments

func setStrokeColorsWithColors(_ colors: [NSNumber])
Sets indexes of colors in palette for line segments

func setPaletteColorWithColorIndex(_ colorIndex: UInt, color: UIColor)
Sets color in RGBA mode for colorIndex

func getPaletteColor(withColorIndex colorIndex: UInt) -> UIColor
Returns the palette color for the specified index

func setStrokeColorWith(_ color: UIColor)
Sets the polyline color

func getStrokeColor(withSegmentIndex segmentIndex: UInt) -> UInt
Returns the palette index used by segment with the specified index

func addArrow(with position: YMKPolylinePosition,
                     length: Float,
             fill fillColor: UIColor) -> YMKArrow
Adds an arrow

func arrows() -> [YMKArrow]
Provides arrows

Properties

var geometryYMKPolyline { get set }
The polyline's geometry

var strokeWidth: Float { get set }
The stroke width in units

var gradientLength: Float { get set }
Maximum length (in units) of the gradient from one color to another

var outlineColor: UIColor { get set }
The outline color

var outlineWidth: Float { get set }
Width of the outline in units

var isInnerOutlineEnabled: Bool { get set }
Enables the inner outline if true (a dark border along the edge of the outline)

var turnRadius: Float { get set }
Maximum radius of a turn

var arcApproximationStep: Float { get set }
Defines step of arc approximation

var dashLength: Float { get set }
Length of a dash in units

var gapLength: Float { get set }
Length of the gap between two dashes in units

var dashOffset: Float { get set }
Offset from the start of the polyline to the reference dash in units

Instance methods

select(withSelectionColor:subpolyline:)

func select(withSelectionColor selectionColor: UIColor,
                                  subpolyline: YMKSubpolyline)

Highlights a subpolyline using the specified color.


hide(with:)

func hide(with subpolyline: YMKSubpolyline)

Hides the subpolyline, canceling any previous hides.


hide(with:)

func hide(with subpolylines: [YMKSubpolyline])

Hides multiple subpolylines, canceling any previous hides.


setStrokeColorsWithColors(_:weights:)

func setStrokeColorsWithColors(_ colors: [NSNumber], weights: [NSNumber])

Sets indexes of colors in palette for line segments. Weights are used for generalization of colors. By default, all segments use palette index 0.


setStrokeColorsWithColors(_:)

func setStrokeColorsWithColors(_ colors: [NSNumber])

Sets indexes of colors in palette for line segments. All the weights are equal to 1.


setPaletteColorWithColorIndex(_:color:)

func setPaletteColorWithColorIndex(_ colorIndex: UInt, color: UIColor)

Sets color in RGBA mode for colorIndex. If the color is not provided for some index, the default value 0x0066FFFF is used.


getPaletteColor(withColorIndex:)

func getPaletteColor(withColorIndex colorIndex: UInt) -> UIColor

Returns the palette color for the specified index.


setStrokeColorWith(_:)

func setStrokeColorWith(_ color: UIColor)

Sets the polyline color. Effectively sets a single-color palette and sets all segments' palette indices to 0.


getStrokeColor(withSegmentIndex:)

func getStrokeColor(withSegmentIndex segmentIndex: UInt) -> UInt

Returns the palette index used by segment with the specified index.


addArrow(with:length:fill:)

func addArrow(with position: YMKPolylinePosition,
                     length: Float,
             fill fillColor: UIColor) -> YMKArrow

Adds an arrow.

Parameters

position

Coordinates of the center of the arrow.

length

Overall length of the arrow (including the tip) in units.

fillColor

Color of the arrow. Adding arrows disables dash for this polyline.


arrows()

func arrows() -> [YMKArrow]

Provides arrows.


Properties

geometry

var geometry: YMKPolyline { get set }

The polyline's geometry. Should contain at least 2 points. Changing geometry resets polyline color indices to 0.


strokeWidth

var strokeWidth: Float { get set }

The stroke width in units. Default: 5. The size of a unit is equal to the size of a pixel at the current zoom level when the camera position's tilt is equal to 0 and the scale factor is equal to 1.


gradientLength

var gradientLength: Float { get set }

Maximum length (in units) of the gradient from one color to another. Default: 0.


outlineColor

var outlineColor: UIColor { get set }

The outline color. Default: hexademical RGBA code 0x00000000.


outlineWidth

var outlineWidth: Float { get set }

Width of the outline in units. Default: 0.


isInnerOutlineEnabled

var isInnerOutlineEnabled: Bool { get set }

Enables the inner outline if true (a dark border along the edge of the outline). Default: false.


turnRadius

var turnRadius: Float { get set }

Maximum radius of a turn. Measured in units. Default: 10.


arcApproximationStep

var arcApproximationStep: Float { get set }

Defines step of arc approximation. Smaller values make polyline smoother. Measured in degrees. Default: 12.


dashLength

var dashLength: Float { get set }

Length of a dash in units. Default: 0 (dashing is turned off). Arrows are ignored in dashed polylines.


gapLength

var gapLength: Float { get set }

Length of the gap between two dashes in units. Default: 0 (dashing is turned off). Arrows are ignored in dashed polylines.


dashOffset

var dashOffset: Float { get set }

Offset from the start of the polyline to the reference dash in units. Default: 0.