Class GraphicImpl
- Object
-
- GraphicImpl
-
- All Implemented Interfaces:
Cloneable,Graphic,GraphicFill,GraphicLegend,GraphicStroke,Cloneable
public class GraphicImpl extends Object implements GraphicLegend, Graphic, GraphicFill, GraphicStroke, Cloneable
Direct implementation of Graphic.- Author:
- Ian Turton, CCG, Johann Sorel (Geomatys)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGraphicImpl.ConstantGraphic
-
Constructor Summary
Constructors Modifier Constructor Description protectedGraphicImpl()Creates a new instance of DefaultGraphicGraphicImpl(FilterFactory factory)GraphicImpl(FilterFactory factory, AnchorPoint anchor, Expression gap, Expression initialGap)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(StyleVisitor visitor)accepts a StyleVisitor - used by xmlencoder and other packages which need to walk the style treeObjectaccept(TraversingStyleVisitor visitor, Object data)Calls the visit method of a StyleVisitorObjectclone()Creates a deep copy clone.booleanequals(Object oth)Compares this GraphicImpl with another for equality.AnchorPointgetAnchorPoint()The AnchorPoint element of a PointSymbolizer gives the location inside of a Graphic (or label - see 11.4.4) to use for anchoring the graphic to the main-geometry point.DisplacementgetDisplacement()The Displacement gives the X and Y displacements from the "hot-spot" point.ExpressiongetGap()ExpressiongetInitialGap()ExpressiongetOpacity()This specifies the level of translucency to use when rendering the graphic.
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, with a linear scale of translucency for intermediate values.
For example, "0.65" would represent 65% opacity.ExpressiongetRotation()This parameter defines the rotation of a graphic in the clockwise direction about its centre point in decimal degrees.ExpressiongetSize()This paramteter gives the absolute size of the graphic in pixels encoded as a floating point number.List<GraphicalSymbol>graphicalSymbols()The items in this list are either a Mark or a ExternalGraphic.inthashCode()Override of hashcodevoidsetAnchorPoint(AnchorPoint anchor)voidsetDisplacement(Displacement offset)voidsetGap(Expression gap)voidsetInitialGap(Expression initialGap)voidsetOpacity(Expression opacity)Graphic opacity.voidsetRotation(Expression rotation)Setter for property rotation.voidsetSize(Expression size)Setter for property size.
-
-
-
Field Detail
-
DEFAULT
public static final Graphic DEFAULT
A default Graphic instance.For some attributes the standard does not define a default, so a reasonable value is supplied.
-
NULL
public static final Graphic NULL
Indicates an absense of graphic.This value is used to indicate that the Graphics based opperation should be skipped. Aka this is used by Stroke.Stroke as place holders for GRAPHIC_FILL and GRAPHIC_STROKE.
-
-
Constructor Detail
-
GraphicImpl
protected GraphicImpl()
Creates a new instance of DefaultGraphic
-
GraphicImpl
public GraphicImpl(FilterFactory factory)
-
GraphicImpl
public GraphicImpl(FilterFactory factory, AnchorPoint anchor, Expression gap, Expression initialGap)
-
-
Method Detail
-
graphicalSymbols
public List<GraphicalSymbol> graphicalSymbols()
Description copied from interface:GraphicThe items in this list are either a Mark or a ExternalGraphic.This list may be directly edited; the items are considered in order from most preferred (say an SVG file) to least preferred (a simple shape) with the intension that the system will make use of the first entry which it is capabile of displaying.
- Specified by:
graphicalSymbolsin interfaceGraphic
-
getAnchorPoint
public AnchorPoint getAnchorPoint()
Description copied from interface:GraphicThe AnchorPoint element of a PointSymbolizer gives the location inside of a Graphic (or label - see 11.4.4) to use for anchoring the graphic to the main-geometry point. The coordinates are given as two floating-point numbers in the AnchorPointX and AnchorPointY elements each with values between 0.0 and 1.0 inclusive. The bounding box of the graphic/label to be rendered is considered to be in a coordinate space from 0.0 (lower-left corner) to 1.0 (upper-right corner), and the anchor position is specified as a point in this space. The default point is X=0.5, Y=0.5, which is at the middle height and middle length of the graphic/label text. A system may choose different anchor points to de-conflict graphics/labels.- Specified by:
getAnchorPointin interfaceGraphic- Returns:
- AnchorPoint , if null should use a default point X=0.5 Y=0.5
-
setAnchorPoint
public void setAnchorPoint(AnchorPoint anchor)
- Specified by:
setAnchorPointin interfaceGraphic
-
getOpacity
public Expression getOpacity()
This specifies the level of translucency to use when rendering the graphic.
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, with a linear scale of translucency for intermediate values.
For example, "0.65" would represent 65% opacity. The default value is 1.0 (opaque).- Specified by:
getOpacityin interfaceGraphic- Returns:
- The opacity of the Graphic, where 0.0 is completely transparent and 1.0 is completely opaque.
-
getRotation
public Expression getRotation()
This parameter defines the rotation of a graphic in the clockwise direction about its centre point in decimal degrees. The value encoded as a floating point number.- Specified by:
getRotationin interfaceGraphic- Returns:
- The angle of rotation in decimal degrees. Negative values represent counter-clockwise rotation. The default is 0.0 (no rotation).
-
getSize
public Expression getSize()
This paramteter gives the absolute size of the graphic in pixels encoded as a floating point number.The default size of an image format (such as GIFD) is the inherent size of the image. The default size of a format without an inherent size (such as SVG) is defined to be 16 pixels in height and the corresponding aspect in width. If a size is specified, the height of the graphic will be scaled to that size and the corresponding aspect will be used for the width.
-
getDisplacement
public Displacement getDisplacement()
Description copied from interface:GraphicThe Displacement gives the X and Y displacements from the "hot-spot" point. This element may be used to avoid over-plotting of multiple graphic symbols used as part of the same point symbol. The displacements are in units of measure above and to the right of the point. The default displacement is X=0, Y=0.If Displacement is used in conjunction with Size and/or Rotation then the graphic symbol shall be scaled and/or rotated before it is displaced.s
- Specified by:
getDisplacementin interfaceGraphic- Returns:
- Displacement
-
getInitialGap
public Expression getInitialGap()
- Specified by:
getInitialGapin interfaceGraphic
-
setInitialGap
public void setInitialGap(Expression initialGap)
- Specified by:
setInitialGapin interfaceGraphic
-
getGap
public Expression getGap()
-
setGap
public void setGap(Expression gap)
-
setDisplacement
public void setDisplacement(Displacement offset)
- Specified by:
setDisplacementin interfaceGraphic
-
setOpacity
public void setOpacity(Expression opacity)
Description copied from interface:GraphicGraphic opacity.- Specified by:
setOpacityin interfaceGraphic- Parameters:
opacity- New value of property opacity.
-
setRotation
public void setRotation(Expression rotation)
Setter for property rotation.- Specified by:
setRotationin interfaceGraphic- Parameters:
rotation- New value of property rotation.
-
setSize
public void setSize(Expression size)
Setter for property size.
-
accept
public Object accept(TraversingStyleVisitor visitor, Object data)
Description copied from interface:GraphicCalls the visit method of a StyleVisitor
-
accept
public void accept(StyleVisitor visitor)
Description copied from interface:Graphicaccepts a StyleVisitor - used by xmlencoder and other packages which need to walk the style tree
-
clone
public Object clone()
Creates a deep copy clone.- Specified by:
clonein interfaceCloneable- Overrides:
clonein classObject- Returns:
- The deep copy clone.
- See Also:
Object.clone()
-
hashCode
public int hashCode()
Override of hashcode
-
equals
public boolean equals(Object oth)
Compares this GraphicImpl with another for equality.Two graphics are equal if and only if they both have the same geometry property name and the same list of symbols and the same rotation, size and opacity.
-
-