Package com.yandex.mapkit.map

Interface PolylineMapObject

All Superinterfaces:

MapObject

interface PolylineMapObject extends MapObject

A polyline object with adjustable segment colors.

Supports outlines, dash, arrows, and hiding parts of the polyline efficiently.

Summary

Methods

Type and modifiers

Method and Description

Polyline

getGeometry()
The polyline's geometry.

void

setGeometry(@NonNull Polyline geometry)

float

getStrokeWidth()
The stroke width in units.

void

setStrokeWidth(float strokeWidth)

float

getGradientLength()
Maximum length (in units) of the gradient from one color to another.

void

setGradientLength(float gradientLength)

int

getOutlineColor()
The outline color.

void

setOutlineColor(int outlineColor)

float

getOutlineWidth()
Width of the outline in units.

void

setOutlineWidth(float outlineWidth)

boolean

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

void

setInnerOutlineEnabled(boolean innerOutlineEnabled)

float

getTurnRadius()
Maximum radius of a turn.

void

setTurnRadius(float turnRadius)

float

getArcApproximationStep()
Defines step of arc approximation.

void

setArcApproximationStep(float arcApproximationStep)

float

getDashLength()
Length of a dash in units.

void

setDashLength(float dashLength)

float

getGapLength()
Length of the gap between two dashes in units.

void

setGapLength(float gapLength)

float

getDashOffset()
Offset from the start of the polyline to the reference dash in units.

void

setDashOffset(float dashOffset)

void

select(int selectionColor,
       @NonNull Subpolyline subpolyline)

Highlights a subpolyline using the specified color.

void

hide(@NonNull Subpolyline subpolyline)
Hides the subpolyline, canceling any previous hides.

void

hide(@NonNull java.util.List<Subpolyline> subpolylines)
Hides multiple subpolylines, canceling any previous hides.

void

setStrokeColors(@NonNull java.util.List<java.lang.Integer> colors,
                @NonNull java.util.List<java.lang.Double> weights)

Sets indexes of colors in palette for line segments.

void

setStrokeColors(@NonNull java.util.List<java.lang.Integer> colors)
Sets indexes of colors in palette for line segments.

void

setPaletteColor(int colorIndex,
                int color)

Sets color in RGBA mode for colorIndex.

int

getPaletteColor(int colorIndex)
Returns the palette color for the specified index.

void

setStrokeColor(int color)
Sets the polyline color.

int

getStrokeColor(int segmentIndex)
Returns the palette index used by segment with the specified index.

Arrow

addArrow(@NonNull PolylinePosition position,
         float length,
         int fillColor)

Adds an arrow.

java.util.List<Arrow>

arrows()
Provides arrows.

Methods

getGeometry

@NonNull
Polyline getGeometry()

The polyline's geometry.

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


setGeometry

void setGeometry(@NonNull Polyline geometry)


getStrokeWidth

float getStrokeWidth()

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.


setStrokeWidth

void setStrokeWidth(float strokeWidth)


getGradientLength

float getGradientLength()

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

Default: 0.


setGradientLength

void setGradientLength(float gradientLength)


getOutlineColor

int getOutlineColor()

The outline color.

Default: hexademical RGBA code 0x00000000.


setOutlineColor

void setOutlineColor(int outlineColor)


getOutlineWidth

float getOutlineWidth()

Width of the outline in units.

Default: 0.


setOutlineWidth

void setOutlineWidth(float outlineWidth)


isInnerOutlineEnabled

boolean isInnerOutlineEnabled()

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

Default: false.


setInnerOutlineEnabled

void setInnerOutlineEnabled(boolean innerOutlineEnabled)


getTurnRadius

float getTurnRadius()

Maximum radius of a turn.

Measured in units. Default: 10.


setTurnRadius

void setTurnRadius(float turnRadius)


getArcApproximationStep

float getArcApproximationStep()

Defines step of arc approximation.

Smaller values make polyline smoother. Measured in degrees. Default: 12.


setArcApproximationStep

void setArcApproximationStep(float arcApproximationStep)


getDashLength

float getDashLength()

Length of a dash in units.

Default: 0 (dashing is turned off). Arrows are ignored in dashed polylines.


setDashLength

void setDashLength(float dashLength)


getGapLength

float getGapLength()

Length of the gap between two dashes in units.

Default: 0 (dashing is turned off). Arrows are ignored in dashed polylines.


setGapLength

void setGapLength(float gapLength)


getDashOffset

float getDashOffset()

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

Default: 0.


setDashOffset

void setDashOffset(float dashOffset)


select

void select(int selectionColor,
            @NonNull Subpolyline subpolyline)

Highlights a subpolyline using the specified color.


hide

void hide(@NonNull Subpolyline subpolyline)

Hides the subpolyline, canceling any previous hides.


hide

void hide(@NonNull java.util.List<Subpolyline> subpolylines)

Hides multiple subpolylines, canceling any previous hides.


setStrokeColors

void setStrokeColors(@NonNull java.util.List<java.lang.Integer> colors,
                     @NonNull java.util.List<java.lang.Double> 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.


setStrokeColors

void setStrokeColors(@NonNull java.util.List<java.lang.Integer> colors)

Sets indexes of colors in palette for line segments.

All the weights are equal to 1.


setPaletteColor

void setPaletteColor(int colorIndex,
                     int color)

Sets color in RGBA mode for colorIndex.

If the color is not provided for some index, the default value 0x0066FFFF is used.


getPaletteColor

int getPaletteColor(int colorIndex)

Returns the palette color for the specified index.


setStrokeColor

void setStrokeColor(int color)

Sets the polyline color.

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


getStrokeColor

int getStrokeColor(int segmentIndex)

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


addArrow

@NonNull
Arrow addArrow(@NonNull PolylinePosition position,
               float length,
               int 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
java.util.List<Arrow> arrows()

Provides arrows.


Предыдущая
Следующая