Package org.geotools.styling
Class StrokeImpl
Object
StrokeImpl
Provides a Java representation of the Stroke object in an SLD document. A stroke defines how a line is rendered.
- Author:
- James Macgill, CCG
-
Nested Class Summary
Nested classes/interfaces inherited from interface Stroke
Stroke.ConstantStroke
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Creates a new instance of Strokeprotected
StrokeImpl
(FilterFactory factory) -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(StyleVisitor visitor) accept
(TraversingStyleVisitor visitor, Object data) calls the visit method of a StyleVisitorclone()
Clone the StrokeImpl object.This parameter encodes the dash pattern as a list of expressions.
The first expression gives the length in pixels of the dash to draw, the second gives the amount of space to leave, and this pattern repeats.
If an odd number of values is given, then the pattern is expanded by repeating it twice to give an even number of values.boolean
Compares this stroke with another stroke for equality.getColor()
This parameter gives the solid color that will be used for a stroke.
The color value is RGB-encoded using two hexidecimal digits per primary-color component in the order Red, Green, Blue, prefixed with the hash (#) sign.getColor
(SimpleFeature feature) float[]
Shortcut to retrieve dash array in the case where all expressions are literal numbers.This param determines where the dash pattern should start from.This parameter indicates that a stipple-fill repeated graphic will be used and specifies the fill graphic to use.This parameter indicates that a repeated-linear-graphic graphic stroke type will be used and specifies the graphic to use.This parameter controls how line strings should be capped.This parameter controls how line strings should be joined together.This specifies the level of translucency to use when rendering the stroke.
The value is encoded as a floating-point value between 0.0 and 1.0 with 0.0 representing totally transparent and 1.0 representing totally opaque.getWidth()
This parameter gives the absolute width (thickness) of a stroke in pixels encoded as a float.int
hashCode()
void
This parameter sets the solid color that will be used for a stroke.
The color value is RGB-encoded using two hexidecimal digits per primary-color component in the order Red, Green, Blue, prefixed with the hash (#) sign.void
setColor
(Expression color) This parameter sets the solid color that will be used for a stroke.
The color value is RGB-encoded using two hexidecimal digits per primary-color component in the order Red, Green, Blue, prefixed with the hash (#) sign.void
setDashArray
(float[] literalDashArray) Shortcut to define dash array using literal numbers.void
setDashArray
(List<Expression> dashArray) This parameter encodes the dash pattern as a list of expressions.
The first expression gives the length in pixels of the dash to draw, the second gives the amount of space to leave, and this pattern repeats.
If an odd number of values is given, then the pattern is expanded by repeating it twice to give an even number of values.void
setDashOffset
(Expression dashOffset) This param determines where the dash pattern should start from.void
setFilterFactory
(FilterFactory factory) void
setGraphicFill
(Graphic fillGraphic) This parameter indicates that a stipple-fill repeated graphic will be used and specifies the fill graphic to use.void
setGraphicStroke
(Graphic strokeGraphic) This parameter indicates that a repeated-linear-graphic graphic stroke type will be used and specifies the graphic to use.void
setLineCap
(Expression lineCap) This parameter controls how line strings should be capped.void
setLineJoin
(Expression lineJoin) This parameter controls how line strings should be joined together.void
setOpacity
(Expression opacity) This specifies the level of translucency to use when rendering the stroke.
The value is encoded as a floating-point value between 0.0 and 1.0 with 0.0 representing totally transparent and 1.0 representing totally opaque.void
setWidth
(Expression width) This parameter sets the absolute width (thickness) of a stroke in pixels encoded as a float.toString()
-
Field Details
-
DEFAULT
-
NULL
Null Stroke capturing the defaults indicated by the standard.This is a NullObject, it purpose is to prevent client code from having to do null checking.
-
-
Constructor Details
-
StrokeImpl
protected StrokeImpl()Creates a new instance of Stroke -
StrokeImpl
-
-
Method Details
-
setFilterFactory
-
getColor
This parameter gives the solid color that will be used for a stroke.
The color value is RGB-encoded using two hexidecimal digits per primary-color component in the order Red, Green, Blue, prefixed with the hash (#) sign. The hexidecimal digits between A and F may be in either upper or lower case. For example, full red is encoded as "#ff0000" (with no quotation marks). The default color is defined to be black ("#000000"). Note: in CSS this parameter is just called Stroke and not Color. -
setColor
This parameter sets the solid color that will be used for a stroke.
The color value is RGB-encoded using two hexidecimal digits per primary-color component in the order Red, Green, Blue, prefixed with the hash (#) sign. The hexidecimal digits between A and F may be in either upper or lower case. For example, full red is encoded as "#ff0000" (with no quotation marks). The default color is defined to be black ("#000000"). Note: in CSS this parameter is just called Stroke and not Color. -
setColor
This parameter sets the solid color that will be used for a stroke.
The color value is RGB-encoded using two hexidecimal digits per primary-color component in the order Red, Green, Blue, prefixed with the hash (#) sign. The hexidecimal digits between A and F may be in either upper or lower case. For example, full red is encoded as "#ff0000" (with no quotation marks). The default color is defined to be black ("#000000"). Note: in CSS this parameter is just called Stroke and not Color.- Parameters:
color
- The color of the stroke encoded as a hexidecimal RGB value.
-
getDashArray
public float[] getDashArray()Shortcut to retrieve dash array in the case where all expressions are literal numbers. Return the default value if one of the expressions is not a literal.- Specified by:
getDashArray
in interfaceStroke
- Returns:
- expression
-
setDashArray
public void setDashArray(float[] literalDashArray) Shortcut to define dash array using literal numbers.- Specified by:
setDashArray
in interfaceStroke
-
dashArray
This parameter encodes the dash pattern as a list of expressions.
The first expression gives the length in pixels of the dash to draw, the second gives the amount of space to leave, and this pattern repeats.
If an odd number of values is given, then the pattern is expanded by repeating it twice to give an even number of values.For example, "2 1 3 2" would produce:
-- --- -- --- -- --- -- --- -- --- --
-
setDashArray
This parameter encodes the dash pattern as a list of expressions.
The first expression gives the length in pixels of the dash to draw, the second gives the amount of space to leave, and this pattern repeats.
If an odd number of values is given, then the pattern is expanded by repeating it twice to give an even number of values.For example, "2 1 3 2" would produce:
-- --- -- --- -- --- -- --- -- --- --
- Specified by:
setDashArray
in interfaceStroke
-
getDashOffset
This param determines where the dash pattern should start from.- Specified by:
getDashOffset
in interfaceStroke
- Returns:
- where the dash should start from.
-
setDashOffset
This param determines where the dash pattern should start from.- Specified by:
setDashOffset
in interfaceStroke
- Parameters:
dashOffset
- The distance into the dash pattern that should act as the start.
-
getGraphicFill
This parameter indicates that a stipple-fill repeated graphic will be used and specifies the fill graphic to use.- Specified by:
getGraphicFill
in interfaceStroke
- Returns:
- The graphic to use as a stipple fill. If null, then no Stipple fill should be used.
-
setGraphicFill
This parameter indicates that a stipple-fill repeated graphic will be used and specifies the fill graphic to use.- Specified by:
setGraphicFill
in interfaceStroke
- Parameters:
fillGraphic
- The graphic to use as a stipple fill. If null, then no Stipple fill should be used.
-
getGraphicStroke
This parameter indicates that a repeated-linear-graphic graphic stroke type will be used and specifies the graphic to use. Proper stroking with a linear graphic requires two "hot-spot" points within the space of the graphic to indicate where the rendering line starts and stops. In the case of raster images with no special mark-up, this line will be assumed to be the middle pixel row of the image, starting from the first pixel column and ending at the last pixel column.- Specified by:
getGraphicStroke
in interfaceStroke
- Returns:
- The graphic to use as a linear graphic. If null, then no graphic stroke should be used.
-
setGraphicStroke
This parameter indicates that a repeated-linear-graphic graphic stroke type will be used and specifies the graphic to use. Proper stroking with a linear graphic requires two "hot-spot" points within the space of the graphic to indicate where the rendering line starts and stops. In the case of raster images with no special mark-up, this line will be assumed to be the middle pixel row of the image, starting from the first pixel column and ending at the last pixel column.- Specified by:
setGraphicStroke
in interfaceStroke
- Parameters:
strokeGraphic
- The graphic to use as a linear graphic. If null, then no graphic stroke should be used.
-
getLineCap
This parameter controls how line strings should be capped.- Specified by:
getLineCap
in interfaceStroke
- Returns:
- The cap style. This will be one of "butt", "round" and "square" There is no defined default.
-
setLineCap
This parameter controls how line strings should be capped.- Specified by:
setLineCap
in interfaceStroke
- Parameters:
lineCap
- The cap style. This can be one of "butt", "round" and "square" There is no defined default.
-
getLineJoin
This parameter controls how line strings should be joined together.- Specified by:
getLineJoin
in interfaceStroke
- Returns:
- The join style. This will be one of "mitre", "round" and "bevel". There is no defined default.
-
setLineJoin
This parameter controls how line strings should be joined together.- Specified by:
setLineJoin
in interfaceStroke
- Parameters:
lineJoin
- The join style. This will be one of "mitre", "round" and "bevel". There is no defined default.
-
getOpacity
This specifies the level of translucency to use when rendering the stroke.
The value is encoded as a floating-point value between 0.0 and 1.0 with 0.0 representing totally transparent and 1.0 representing totally opaque. A linear scale of translucency is used for intermediate values.
For example, "0.65" would represent 65% opacity. The default value is 1.0 (opaque).- Specified by:
getOpacity
in interfaceStroke
- Returns:
- The opacity of the stroke, where 0.0 is completely transparent and 1.0 is completely opaque.
-
setOpacity
This specifies the level of translucency to use when rendering the stroke.
The value is encoded as a floating-point value between 0.0 and 1.0 with 0.0 representing totally transparent and 1.0 representing totally opaque. A linear scale of translucency is used for intermediate values.
For example, "0.65" would represent 65% opacity. The default value is 1.0 (opaque).- Specified by:
setOpacity
in interfaceStroke
- Parameters:
opacity
- The opacity of the stroke, where 0.0 is completely transparent and 1.0 is completely opaque.
-
getWidth
This parameter gives the absolute width (thickness) of a stroke in pixels encoded as a float. The default is 1.0. Fractional numbers are allowed but negative numbers are not. -
setWidth
This parameter sets the absolute width (thickness) of a stroke in pixels encoded as a float. The default is 1.0. Fractional numbers are allowed but negative numbers are not. -
toString
-
getColor
-
accept
Description copied from interface:Stroke
calls the visit method of a StyleVisitor -
accept
-
clone
Clone the StrokeImpl object.The clone is a deep copy of the original, except for the expression values which are immutable.
-
hashCode
public int hashCode() -
equals
Compares this stroke with another stroke for equality.
-