YMKPolylineMapObject

@interface YMKPolylineMapObject : YMKMapObject

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

Summary

Instance methods

- (void)selectWithSelectionColor:(nonnull UIColor *)selectionColor
                     subpolyline:(nonnull YMKSubpolyline *)subpolyline;

Highlights a subpolyline using the specified color

- (void)hideWithSubpolyline:(nonnull YMKSubpolyline *)subpolyline;
Hides the subpolyline, canceling any previous hides

- (void)hideWithSubpolylines:(nonnull NSArray<YMKSubpolyline *> *)subpolylines;
Hides multiple subpolylines, canceling any previous hides

- (void)setStrokeColorsWithColors:(nonnull NSArray<NSNumber *> *)colors
                          weights:(nonnull NSArray<NSNumber *> *)weights;

Sets indexes of colors in palette for line segments

- (void)setStrokeColorsWithColors:(nonnull NSArray<NSNumber *> *)colors;
Sets indexes of colors in palette for line segments

- (void)setPaletteColorWithColorIndex:(NSUInteger)colorIndex
                                color:(nonnull UIColor *)color;

Sets color in RGBA mode for colorIndex

- (nonnull UIColor *)getPaletteColorWithColorIndex:(NSUInteger)colorIndex;
Returns the palette color for the specified index

- (void)setStrokeColorWithColor:(nonnull UIColor *)color;
Sets the polyline color

- (NSUInteger)getStrokeColorWithSegmentIndex:(NSUInteger)segmentIndex;
Returns the palette index used by segment with the specified index

- (nonnull YMKArrow *)addArrowWithPosition:
                          (nonnull YMKPolylinePosition *)position
                                    length:(float)length
                                 fillColor:(nonnull UIColor *)fillColor;

Adds an arrow

- (nonnull NSArray<YMKArrow *> *)arrows;
Provides arrows

Properties

@property (nonatomic, assign, unsafe_unretained, readwrite, nonnull)
    YMKPolyline *geometry;

The polyline's geometry

@property (nonatomic, assign, unsafe_unretained, readwrite) float strokeWidth;
The stroke width in units

@property (nonatomic, assign, unsafe_unretained, readwrite) float gradientLength;
Maximum length (in units) of the gradient from one color to another

@property (nonatomic, assign, unsafe_unretained, readwrite, nonnull)
    UIColor *outlineColor;

The outline color

@property (nonatomic, assign, unsafe_unretained, readwrite) float outlineWidth;
Width of the outline in units

@property (nonatomic, assign, unsafe_unretained, readwrite,
          getter=isInnerOutlineEnabled) BOOL innerOutlineEnabled;

Enables the inner outline if true (a dark border along the edge of the outline)

@property (nonatomic, assign, unsafe_unretained, readwrite) float turnRadius;
Maximum radius of a turn

@property (nonatomic, assign, unsafe_unretained, readwrite)
    float arcApproximationStep;

Defines step of arc approximation

@property (nonatomic, assign, unsafe_unretained, readwrite) float dashLength;
Length of a dash in units

@property (nonatomic, assign, unsafe_unretained, readwrite) float gapLength;
Length of the gap between two dashes in units

@property (nonatomic, assign, unsafe_unretained, readwrite) float dashOffset;
Offset from the start of the polyline to the reference dash in units

Instance methods

selectWithSelectionColor:subpolyline:

- (void)selectWithSelectionColor:(nonnull UIColor *)selectionColor
                     subpolyline:(nonnull YMKSubpolyline *)subpolyline;

Highlights a subpolyline using the specified color.


hideWithSubpolyline:

- (void)hideWithSubpolyline:(nonnull YMKSubpolyline *)subpolyline;

Hides the subpolyline, canceling any previous hides.


hideWithSubpolylines:

- (void)hideWithSubpolylines:(nonnull NSArray<YMKSubpolyline *> *)subpolylines;

Hides multiple subpolylines, canceling any previous hides.


setStrokeColorsWithColors:weights:

- (void)setStrokeColorsWithColors:(nonnull NSArray<NSNumber *> *)colors
                          weights:(nonnull NSArray<NSNumber *> *)weights;

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:

- (void)setStrokeColorsWithColors:(nonnull NSArray<NSNumber *> *)colors;

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


setPaletteColorWithColorIndex:color:

- (void)setPaletteColorWithColorIndex:(NSUInteger)colorIndex
                                color:(nonnull UIColor *)color;

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


getPaletteColorWithColorIndex:

- (nonnull UIColor *)getPaletteColorWithColorIndex:(NSUInteger)colorIndex;

Returns the palette color for the specified index.


setStrokeColorWithColor:

- (void)setStrokeColorWithColor:(nonnull UIColor *)color;

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


getStrokeColorWithSegmentIndex:

- (NSUInteger)getStrokeColorWithSegmentIndex:(NSUInteger)segmentIndex;

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


addArrowWithPosition:length:fillColor:

- (nonnull YMKArrow *)addArrowWithPosition:
                          (nonnull YMKPolylinePosition *)position
                                    length:(float)length
                                 fillColor:(nonnull UIColor *)fillColor;

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

- (nonnull NSArray<YMKArrow *> *)arrows;

Provides arrows.


Properties

geometry

@property (nonatomic, assign, unsafe_unretained, readwrite, nonnull)
    YMKPolyline *geometry;

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


strokeWidth

@property (nonatomic, assign, unsafe_unretained, readwrite) float strokeWidth;

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

@property (nonatomic, assign, unsafe_unretained, readwrite) float gradientLength;

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


outlineColor

@property (nonatomic, assign, unsafe_unretained, readwrite, nonnull)
    UIColor *outlineColor;

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


outlineWidth

@property (nonatomic, assign, unsafe_unretained, readwrite) float outlineWidth;

Width of the outline in units. Default: 0.


innerOutlineEnabled

@property (nonatomic, assign, unsafe_unretained, readwrite,
          getter=isInnerOutlineEnabled) BOOL innerOutlineEnabled;

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


turnRadius

@property (nonatomic, assign, unsafe_unretained, readwrite) float turnRadius;

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


arcApproximationStep

@property (nonatomic, assign, unsafe_unretained, readwrite)
    float arcApproximationStep;

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


dashLength

@property (nonatomic, assign, unsafe_unretained, readwrite) float dashLength;

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


gapLength

@property (nonatomic, assign, unsafe_unretained, readwrite) float gapLength;

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


dashOffset

@property (nonatomic, assign, unsafe_unretained, readwrite) float dashOffset;

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