MMKPolylineMapObject
class MMKPolylineMapObject : MMKMapObject |
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, |
func hide(with subpolyline: MMKSubpolyline) |
func hide(with subpolylines: [MMKSubpolyline]) |
func setStrokeColorsWithColors(_ colors: [NSNumber], weights: [NSNumber]) |
func setStrokeColorsWithColors(_ colors: [NSNumber]) |
func setPaletteColorWithColorIndex(_ colorIndex: UInt, color: UIColor) |
func getPaletteColor(withColorIndex colorIndex: UInt) -> UIColor |
func setStrokeColorWith(_ color: UIColor) |
func getStrokeColor(withSegmentIndex segmentIndex: UInt) -> UInt |
func addArrow(with position: MMKPolylinePosition, |
Properties
var geometry: MMKPolyline { get set } |
var strokeWidth: Float { get set } |
var gradientLength: Float { get set } |
var outlineColor: UIColor { get set } |
var outlineWidth: Float { get set } |
var isInnerOutlineEnabled: Bool { get set } |
var turnRadius: Float { get set } |
var arcApproximationStep: Float { get set } |
var dashLength: Float { get set } |
var gapLength: Float { get set } |
var dashOffset: Float { get set } |
Instance methods
select(withSelectionColor:subpolyline:)
func select(withSelectionColor selectionColor: UIColor, |
Highlights a subpolyline using the specified color.
hide(with:)
func hide(with subpolyline: MMKSubpolyline) |
Hides the subpolyline, canceling any previous hides.
hide(with:)
func hide(with subpolylines: [MMKSubpolyline]) |
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: MMKPolylinePosition, |
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() -> [MMKArrow] |
Provides arrows.
Properties
geometry
var geometry: MMKPolyline { 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.