Class LineStyleBuilder

java.lang.Object
com.massifmaps.styles.StyleBuilder
com.massifmaps.styles.LineStyleBuilder

public class LineStyleBuilder extends StyleBuilder
A builder class for LineStyle.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a LineStyleBuilder object with all parameters set to defaults.
  • Method Summary

    Modifier and Type
    Method
    Description
    Builds a new instance of the LineStyle object using previously set parameters.
    Returns the bitmap of the line.
    float
    Returns the width of the line used for click detection.
    int
    Returns the end point type of the line.
    int
    Returns the join type of the line.
    float
    Returns the stretch factor of the line.
    float
    Returns the width of the line.
    void
    setBitmap(Bitmap bitmap)
    Sets the bitmap that will be used for drawing the line.
    void
    setClickWidth(float clickWidth)
    Sets the width for the line that will be used for click detection.
    Units are screen density independent pixels (DP or DIP).
    void
    setLineEndType(int lineEndType)
    Sets the style in which the end points of the line will be drawn.
    void
    setLineJoinType(int lineJoinType)
    Sets the style in which the line segments will be connected with each other.
    void
    setStretchFactor(float stretchFactor)
    Sets the relative stretching coefficient for the line.
    void
    setWidth(float width)
    Sets the width of line in screen density independent pixels (DP or DIP).

    Methods inherited from class com.massifmaps.styles.StyleBuilder

    equals, getColor, hashCode, setColor

    Methods inherited from class java.lang.Object

    clone, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LineStyleBuilder

      public LineStyleBuilder()
      Constructs a LineStyleBuilder object with all parameters set to defaults.
  • Method Details

    • getBitmap

      public Bitmap getBitmap()
      Returns the bitmap of the line.
      Returns:
      The bitmap of the line.
    • setBitmap

      public void setBitmap(Bitmap bitmap)
      Sets the bitmap that will be used for drawing the line. The bitmap will be stretched
      horizontally to match the width of the line and repeated vertically along the length of the line.
      The default is "default_line.png".
      Parameters:
      bitmap - The new bitmap for the line.
    • getClickWidth

      public float getClickWidth()
      Returns the width of the line used for click detection.
      Returns:
      The width of the line used for click detection.
    • setClickWidth

      public void setClickWidth(float clickWidth)
      Sets the width for the line that will be used for click detection.
      Units are screen density independent pixels (DP or DIP). If set to -1 the click width will be
      calculated automatically. The default is -1.
      Parameters:
      clickWidth - The new point size in dp.
    • getLineEndType

      public int getLineEndType()
      Returns the end point type of the line.
      Returns:
      The end point type of the line.
    • setLineEndType

      public void setLineEndType(int lineEndType)
      Sets the style in which the end points of the line will be drawn. The default is LineEndType::ROUND.
      Parameters:
      lineEndType - The new line end point type.
    • getLineJoinType

      public int getLineJoinType()
      Returns the join type of the line.
      Returns:
      The join type of the line.
    • setLineJoinType

      public void setLineJoinType(int lineJoinType)
      Sets the style in which the line segments will be connected with each other. The default is LineJoinType::MITER.
      Parameters:
      lineJoinType - The new line join type.
    • getStretchFactor

      public float getStretchFactor()
      Returns the stretch factor of the line.
      Returns:
      The stretch factor of the line.
    • setStretchFactor

      public void setStretchFactor(float stretchFactor)
      Sets the relative stretching coefficient for the line. The bitmap of the line will be stretched
      vertically by the stretch factor and then repeated along the length of the line. For example,
      setting the stretch factor to 2.0 will stretch the bitmap vertically to double the original height
      and reduces the number of times the bitmap gets repeated by half. The default is 1.0.
      Parameters:
      stretchFactor - The new relative stretching coefficient for the line.
    • getWidth

      public float getWidth()
      Returns the width of the line.
      Returns:
      The width of the line in dp.
    • setWidth

      public void setWidth(float width)
      Sets the width of line in screen density independent pixels (DP or DIP). The default is 12.
      Parameters:
      width - The new line width in dp.
    • buildStyle

      public LineStyle buildStyle()
      Builds a new instance of the LineStyle object using previously set parameters.
      Returns:
      A new LineStyle object.