public final class PolylinePatternBuilder extends Object implements AutoCloseable
The polyline's points must be set by calling the points method before calling build. All other methods are optional.
ComplexStrokePatternFactory#polylineBuilder()
Modifier and Type | Method and Description |
---|---|
ComplexStrokePattern |
build()
Build the polyline pattern as configured.
|
void |
close() |
protected void |
finalize() |
PolylinePatternBuilder |
lineColor(android.graphics.Color color)
Sets the line color.
|
PolylinePatternBuilder |
lineWidth(double lineWidth)
Sets the line width.
|
PolylinePatternBuilder |
points(List<Coordinate> points)
Sets the points of the polyline.
|
PolylinePatternBuilder |
relative(boolean relative)
Whether the x coordinates of the points need to be interpreted as pixel values or relative values.
|
public void close()
close
in interface AutoCloseable
@NotNull public ComplexStrokePattern build() throws IllegalStateException
ComplexStrokePattern
.IllegalStateException
- when the points have not been set.@NotNull public PolylinePatternBuilder points(@NotNull List<Coordinate> points) throws IllegalArgumentException
Depending on the option relative
, the x coordinates are interpreted as pixel value, or as coordinates relative ([0, 1]
) to the length of the entire line. the Y coordinates are always pixel values.
The coordinates are defined locally, so for example to define a line of length 10, the following coordinates can be used: (0,0), (10,0).
There must be at least 2 points.
points
- the points that make up the polyline.IllegalArgumentException
- when the amount of points is lower than 2.@NotNull public PolylinePatternBuilder relative(boolean relative)
Defaults to false.
relative
- whether the x coordinates need to be interpreted as relative values.@NotNull public PolylinePatternBuilder lineWidth(double lineWidth) throws IllegalArgumentException
lineWidth
- the line's width, defaults to 1
.IllegalArgumentException
- lineWidth must be >0
.@NotNull public PolylinePatternBuilder lineColor(@NotNull android.graphics.Color color)
color
- the line's color, defaults to black.