Class Stroke

java.lang.Object
net.pl3x.map.core.markers.option.Option<@NotNull Stroke>
net.pl3x.map.core.markers.option.Stroke
All Implemented Interfaces:
JsonSerializable

public class Stroke extends Option<@NotNull Stroke>
Stroke properties of a marker.
  • 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 weight
      color - argb color
  • Method Details

    • isEnabled

      @Nullable public @Nullable Boolean isEnabled()
      Whether to draw stroke along the path.

      Defaults to 'true' if null.

      Returns:
      true if stroke is enabled
    • setEnabled

      @NotNull public @NotNull Stroke setEnabled(@Nullable @Nullable Boolean enabled)
      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

      @Nullable public @Nullable Integer getWeight()
      Get the weight of this stroke rule.

      Defaults to '3' if null.

      Returns:
      stroke weight
    • setWeight

      @NotNull public @NotNull Stroke setWeight(@Nullable @Nullable Integer weight)
      Set the weight for this stroke rule.

      Defaults to '3' if null.

      Parameters:
      weight - new stroke weight
      Returns:
      this stroke rule
    • getColor

      @Nullable public @Nullable Integer getColor()
      Get the color of this stroke rule.

      Defaults to '#FF3388FF' if null.

      Returns:
      argb color
    • setColor

      @NotNull public @NotNull Stroke setColor(@Nullable @Nullable Integer color)
      Set the color of this stroke rule.

      Defaults to '#FF3388FF' if null.

      Parameters:
      color - argb color
      Returns:
      this stroke rule
    • getLineCapShape

      @Nullable public @Nullable Stroke.LineCapShape getLineCapShape()
      Get the shape to be used at the end of the stroke.

      Defaults to 'Stroke.LineCapShape.ROUND' if null.

      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 'Stroke.LineCapShape.ROUND' if null.

      Parameters:
      lineCapShape - line cap shape
      Returns:
      this stroke rule
      See Also:
    • getLineJoinShape

      @Nullable public @Nullable Stroke.LineJoinShape getLineJoinShape()
      Get the shape to be used at the corners of the stroke.

      Defaults to 'Stroke.LineJoinShape.ROUND' if null.

      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 'Stroke.LineJoinShape.ROUND' if null.

      Parameters:
      lineJoinShape - line join shape
      Returns:
      this stroke rule
      See Also:
    • getDashPattern

      @Nullable public @Nullable String getDashPattern()
      Get the stroke dash pattern.

      Note: Doesn't work in some old browsers.

      Returns:
      stroke dash pattern
      See Also:
    • setDashPattern

      @NotNull public @NotNull Stroke setDashPattern(@Nullable @Nullable String dashPattern)
      Set the stroke dash pattern.

      Note: Doesn't work in some old browsers.

      Parameters:
      dashPattern - dash pattern
      Returns:
      this stroke rule
      See Also:
    • getDashOffset

      @Nullable public @Nullable String 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

      @NotNull public @NotNull Stroke setDashOffset(@Nullable @Nullable String dashOffset)
      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)
      Specified by:
      isDefault in class Option<@NotNull Stroke>
      Returns:
      true if all options 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

      @NotNull public static @NotNull Stroke fromJson(@NotNull @NotNull com.google.gson.JsonObject obj)
    • equals

      public boolean equals(@Nullable @Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      @NotNull public @NotNull String toString()
      Overrides:
      toString in class Object