Package net.pl3x.map.core.markers.option
Class Stroke
- All Implemented Interfaces:
JsonSerializable
Stroke properties of a marker.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Represents the shape to be used at the corners of the stroke.static enum
Represents the shape to be used at the corners of the stroke. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
static @NotNull Stroke
fromJson
(@NotNull com.google.gson.JsonObject obj) @Nullable Integer
getColor()
Get the color of this stroke rule.@Nullable String
Get the distance into the dash pattern to start the dash.@Nullable String
Get the stroke dash pattern.@Nullable Stroke.LineCapShape
Get the shape to be used at the end of the stroke.@Nullable Stroke.LineJoinShape
Get the shape to be used at the corners of the stroke.@Nullable Integer
Get the weight of this stroke rule.int
hashCode()
boolean
Check whether all options are defaults (all are null)@Nullable Boolean
Whether to draw stroke along the path.@NotNull Stroke
Set the color of this stroke rule.@NotNull Stroke
setDashOffset
(@Nullable String dashOffset) Set the distance into the dash pattern to start the dash.@NotNull Stroke
setDashPattern
(@Nullable String dashPattern) Set the stroke dash pattern.@NotNull Stroke
setEnabled
(@Nullable Boolean enabled) Set whether to draw stroke along the path.@NotNull Stroke
setLineCapShape
(@Nullable Stroke.LineCapShape lineCapShape) Set the shape to be used at the end of the stroke.@NotNull Stroke
setLineJoinShape
(@Nullable Stroke.LineJoinShape lineJoinShape) Set the shape to be used at the corners of the stroke.@NotNull Stroke
Set the weight for this stroke rule.@NotNull com.google.gson.JsonObject
toJson()
Jsonify this object.@NotNull String
toString()
-
Constructor Details
-
Stroke
public Stroke()Create a stroke rule with default options. -
Stroke
public Stroke(boolean enabled) Create a stroke rule. -
Stroke
public Stroke(int weight, int color) Create a stroke rule.- Parameters:
weight
- stroke weightcolor
- argb color
-
-
Method Details
-
isEnabled
Whether to draw stroke along the path.Defaults to '
true
' if null.- Returns:
- true if stroke is enabled
-
setEnabled
Set whether to draw stroke along the path.Setting to false will disable borders on polygons or circles.
Defaults to '
true
' if null.- Parameters:
enabled
- whether stroke is enabled- Returns:
- this stroke rule
-
getWeight
Get the weight of this stroke rule.Defaults to '
3
' if null.- Returns:
- stroke weight
-
setWeight
Set the weight for this stroke rule.Defaults to '
3
' if null.- Parameters:
weight
- new stroke weight- Returns:
- this stroke rule
-
getColor
Get the color of this stroke rule.Defaults to '
#FF3388FF
' if null.- Returns:
- argb color
-
setColor
Set the color of this stroke rule.Defaults to '
#FF3388FF
' if null.- Parameters:
color
- argb color- Returns:
- this stroke rule
-
getLineCapShape
Get the shape to be used at the end of the stroke.Defaults to '
' if null.Stroke.LineCapShape.ROUND
- Returns:
- line cap shape
- See Also:
-
setLineCapShape
@NotNull public @NotNull Stroke setLineCapShape(@Nullable @Nullable Stroke.LineCapShape lineCapShape) Set the shape to be used at the end of the stroke.Defaults to '
' if null.Stroke.LineCapShape.ROUND
- Parameters:
lineCapShape
- line cap shape- Returns:
- this stroke rule
- See Also:
-
getLineJoinShape
Get the shape to be used at the corners of the stroke.Defaults to '
' if null.Stroke.LineJoinShape.ROUND
- Returns:
- line join shape
- See Also:
-
setLineJoinShape
@NotNull public @NotNull Stroke setLineJoinShape(@Nullable @Nullable Stroke.LineJoinShape lineJoinShape) Set the shape to be used at the corners of the stroke.Defaults to '
' if null.Stroke.LineJoinShape.ROUND
- Parameters:
lineJoinShape
- line join shape- Returns:
- this stroke rule
- See Also:
-
getDashPattern
Get the stroke dash pattern.Note: Doesn't work in some old browsers.
- Returns:
- stroke dash pattern
- See Also:
-
setDashPattern
Set the stroke dash pattern.Note: Doesn't work in some old browsers.
- Parameters:
dashPattern
- dash pattern- Returns:
- this stroke rule
- See Also:
-
getDashOffset
Get the distance into the dash pattern to start the dash.Note: Doesn't work in some old browsers.
- Returns:
- dash offset
- See Also:
-
setDashOffset
Set the distance into the dash pattern to start the dash.Note: Doesn't work in some old browsers.
- Parameters:
dashOffset
- dash offset- Returns:
- this stroke rule
- See Also:
-
isDefault
public boolean isDefault()Description copied from class:Option
Check whether all options are defaults (all are null) -
toJson
@NotNull public @NotNull com.google.gson.JsonObject toJson()Description copied from interface:JsonSerializable
Jsonify this object.- Returns:
- object as json element
-
fromJson
-
equals
-
hashCode
public int hashCode() -
toString
-