org.geotools.styling
Class StrokeImpl
java.lang.Object
org.geotools.styling.StrokeImpl
- All Implemented Interfaces:
- org.opengis.util.Cloneable, java.lang.Cloneable, Stroke
- public class StrokeImpl
- extends java.lang.Object
- implements Stroke, org.opengis.util.Cloneable
Provides a Java representation of the Stroke object in an SLD document. A
stroke defines how a line is rendered.
- Version:
- $Id: StrokeImpl.java,v 1.14 2003/09/06 04:52:31 seangeo Exp $
- Author:
- James Macgill, CCG
Constructor Summary |
protected |
StrokeImpl()
Creates a new instance of Stroke |
Method Summary |
void |
accept(StyleVisitor visitor)
|
java.lang.Object |
clone()
Clone the StrokeImpl object.
|
boolean |
equals(java.lang.Object oth)
Compares this stroke with another stroke for equality. |
Expression |
getColor()
This parameter gives the solid color that will be used for a stroke. |
java.awt.Color |
getColor(Feature feature)
This parameter gives the solid color that will be used for a stroke. |
float[] |
getDashArray()
This parameter encodes the dash pattern as a series of floats. |
Expression |
getDashOffset()
This param determines where the dash pattern should start from. |
Graphic |
getGraphicFill()
This parameter indicates that a stipple-fill repeated graphic will be
used and specifies the fill graphic to use. |
Graphic |
getGraphicStroke()
This parameter indicates that a repeated-linear-graphic graphic stroke
type will be used and specifies the graphic to use. |
Expression |
getLineCap()
This parameter controls how line strings should be capped. |
Expression |
getLineJoin()
This parameter controls how line strings should be joined together. |
Expression |
getOpacity()
This specifies the level of translucency to use when rendering the stroke. |
Expression |
getWidth()
This parameter gives the absolute width (thickness) of a stroke in
pixels encoded as a float. |
int |
hashCode()
|
void |
setColor(Expression color)
This parameter sets the solid color that will be used for a stroke. |
void |
setColor(java.lang.String color)
This parameter sets the solid color that will be used for a stroke. |
void |
setDashArray(float[] dashPattern)
This parameter encodes the dash pattern as a series of floats. |
void |
setDashOffset(Expression offset)
This param determines where the dash pattern should start from. |
void |
setGraphicFill(Graphic graphic)
This parameter indicates that a stipple-fill repeated graphic will be
used and specifies the fill graphic to use. |
void |
setGraphicStroke(Graphic graphic)
This parameter indicates that a repeated-linear-graphic graphic stroke
type will be used and specifies the graphic to use. |
void |
setLineCap(Expression cap)
This parameter controls how line strings should be capped. |
void |
setLineJoin(Expression join)
This parameter controls how line strings should be joined together. |
void |
setOpacity(Expression level)
This specifies the level of translucency to use when rendering the stroke. |
void |
setWidth(Expression expr)
This parameter sets the absolute width (thickness) of a stroke in pixels
encoded as a float. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
StrokeImpl
protected StrokeImpl()
- Creates a new instance of Stroke
getColor
public Expression 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.
- Specified by:
getColor
in interface Stroke
- Returns:
- The color of the stroke encoded as a hexidecimal RGB value.
setColor
public 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. 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.
- Specified by:
setColor
in interface Stroke
- Parameters:
color
- The color of the stroke encoded as a hexidecimal RGB value.
This must not be null.
setColor
public void setColor(java.lang.String 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. 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()
- This parameter encodes the dash pattern as a series of floats.
The first number 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. The default is to
draw an unbroken line.
For example, "2 1 3 2" would produce:
-- --- -- --- --
--- -- --- -- --- --
- Specified by:
getDashArray
in interface Stroke
- Returns:
- The dash pattern as an array of float values in the form
"dashlength gaplength ..."
setDashArray
public void setDashArray(float[] dashPattern)
- This parameter encodes the dash pattern as a series of floats.
The first number 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. The default is to
draw an unbroken line.
For example, "2 1 3 2" would produce:
-- --- -- ---
-- --- -- --- --
--- --
- Specified by:
setDashArray
in interface Stroke
- Parameters:
dashPattern
- The dash pattern as an array of float values in the
form "dashlength gaplength ..."
getDashOffset
public Expression getDashOffset()
- This param determines where the dash pattern should start from.
- Specified by:
getDashOffset
in interface Stroke
- Returns:
- where the dash should start from.
setDashOffset
public void setDashOffset(Expression offset)
- This param determines where the dash pattern should start from.
- Specified by:
setDashOffset
in interface Stroke
- Parameters:
offset
- The distance into the dash pattern that should act as the
start.
getGraphicFill
public Graphic getGraphicFill()
- This parameter indicates that a stipple-fill repeated graphic will be
used and specifies the fill graphic to use.
- Specified by:
getGraphicFill
in interface Stroke
- Returns:
- The graphic to use as a stipple fill. If null, then no Stipple
fill should be used.
setGraphicFill
public void setGraphicFill(Graphic graphic)
- This parameter indicates that a stipple-fill repeated graphic will be
used and specifies the fill graphic to use.
- Specified by:
setGraphicFill
in interface Stroke
- Parameters:
graphic
- The graphic to use as a stipple fill. If null, then no
Stipple fill should be used.
getGraphicStroke
public Graphic 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 interface Stroke
- Returns:
- The graphic to use as a linear graphic. If null, then no graphic
stroke should be used.
setGraphicStroke
public void setGraphicStroke(Graphic graphic)
- 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 interface Stroke
- Parameters:
graphic
- The graphic to use as a linear graphic. If null, then no
graphic stroke should be used.
getLineCap
public Expression getLineCap()
- This parameter controls how line strings should be capped.
- Specified by:
getLineCap
in interface Stroke
- Returns:
- The cap style. This will be one of "butt", "round" and "square"
There is no defined default.
setLineCap
public void setLineCap(Expression cap)
- This parameter controls how line strings should be capped.
- Specified by:
setLineCap
in interface Stroke
- Parameters:
cap
- The cap style. This can be one of "butt", "round" and
"square" There is no defined default.
getLineJoin
public Expression getLineJoin()
- This parameter controls how line strings should be joined together.
- Specified by:
getLineJoin
in interface Stroke
- Returns:
- The join style. This will be one of "mitre", "round" and
"bevel". There is no defined default.
setLineJoin
public void setLineJoin(Expression join)
- This parameter controls how line strings should be joined together.
- Specified by:
setLineJoin
in interface Stroke
- Parameters:
join
- The join style. This will be one of "mitre", "round" and
"bevel". There is no defined default.
getOpacity
public Expression 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 interface Stroke
- Returns:
- The opacity of the stroke, where 0.0 is completely transparent
and 1.0 is completely opaque.
setOpacity
public void setOpacity(Expression level)
- 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 interface Stroke
- Parameters:
level
- The opacity of the stroke, where 0.0 is completely
transparent and 1.0 is completely opaque.
getWidth
public Expression 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.
- Specified by:
getWidth
in interface Stroke
- Returns:
- The width of the stroke in pixels. This may be fractional but
not negative.
setWidth
public void setWidth(Expression expr)
- 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.
- Specified by:
setWidth
in interface Stroke
- Parameters:
expr
- The width of the stroke in pixels. This may be fractional
but not negative.
toString
public java.lang.String toString()
getColor
public java.awt.Color getColor(Feature feature)
- Description copied from interface:
Stroke
- This parameter gives the solid color that will be used for a stroke.
The color value returned here as a Java Color object, this is a convinence method
that goes above
The default color is defined to be Color.BLACK
Note: in CSS this parameter is just called Stroke and not Color.
- Specified by:
getColor
in interface Stroke
- Returns:
- The color of the stroke as a Color object
accept
public void accept(StyleVisitor visitor)
- Specified by:
accept
in interface Stroke
clone
public java.lang.Object clone()
- Clone the StrokeImpl object.
The clone is a deep copy of the original, except for the expression
values which are immutable.
- Specified by:
clone
in interface Stroke
- See Also:
Stroke.clone()
hashCode
public int hashCode()
equals
public boolean equals(java.lang.Object oth)
- Compares this stroke with another stroke for equality.
- Parameters:
oth
- The other StrokeImpl to compare
- Returns:
- True if this and oth are equal.
Copyright © GeoTools. All Rights Reserved.