Package com.massifmaps.styles
Class LineStyleBuilder
java.lang.Object
com.massifmaps.styles.StyleBuilder
com.massifmaps.styles.LineStyleBuilder
A builder class for LineStyle.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a LineStyleBuilder object with all parameters set to defaults. -
Method Summary
Modifier and TypeMethodDescriptionBuilds a new instance of the LineStyle object using previously set parameters.Returns the bitmap of the line.floatReturns the width of the line used for click detection.intReturns the end point type of the line.intReturns the join type of the line.floatReturns the stretch factor of the line.floatgetWidth()Returns the width of the line.voidSets the bitmap that will be used for drawing the line.voidsetClickWidth(float clickWidth) Sets the width for the line that will be used for click detection.
Units are screen density independent pixels (DP or DIP).voidsetLineEndType(int lineEndType) Sets the style in which the end points of the line will be drawn.voidsetLineJoinType(int lineJoinType) Sets the style in which the line segments will be connected with each other.voidsetStretchFactor(float stretchFactor) Sets the relative stretching coefficient for the line.voidsetWidth(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
-
Constructor Details
-
LineStyleBuilder
public LineStyleBuilder()Constructs a LineStyleBuilder object with all parameters set to defaults.
-
-
Method Details
-
getBitmap
Returns the bitmap of the line.- Returns:
- The bitmap of the line.
-
setBitmap
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
Builds a new instance of the LineStyle object using previously set parameters.- Returns:
- A new LineStyle object.
-