Interface Graphic
-
- All Superinterfaces:
Graphic
,GraphicFill
,GraphicLegend
,GraphicLegend
,GraphicStroke
- All Known Implementing Classes:
GraphicImpl
public interface Graphic extends GraphicLegend, Graphic, GraphicFill, GraphicStroke
A Graphic is a "graphical symbol" with an inherent shape, color(s), and possibly size.A "graphic" can very informally be defined as "a little picture" and can be of either a raster or vector graphic source type. The term graphic is used since the term "symbol" is similar to "symbolizer" which is used in a difference context in SLD. The graphical symbol to display can be provided either as an external graphical resource or as a Mark.
Multiple external URLs and marks can be referenced with the proviso that they all provide equivalent graphics in different formats. The 'hot spot' to use for positioning the rendering at a point must either be inherent from the external format or be defined to be the "central point" of the graphic.The details of this object are taken from the OGC Styled-Layer Descriptor Report (OGC 02-070) version 1.0.0.:
<xsd:element name="Graphic"> <xsd:annotation> <xsd:documentation> A "Graphic" specifies or refers to a "graphic symbol" with inherent shape, size, and coloring. </xsd:documentation> </xsd:annotation> <xsd:complexType> <xsd:sequence> <xsd:choice minOccurs="0" maxOccurs="unbounded"> <xsd:element ref="sld:ExternalGraphic"/> <xsd:element ref="sld:Mark"/> </xsd:choice> <xsd:sequence> <xsd:element ref="sld:Opacity" minOccurs="0"/> <xsd:element ref="sld:Size" minOccurs="0"/> <xsd:element ref="sld:Rotation" minOccurs="0"/> </xsd:sequence> </xsd:sequence> </xsd:complexType> </xsd:element>
Renderers can ue this information when displaying styled features, though it must be remembered that not all renderers will be able to fully represent strokes as set out by this interface. For example, opacity may not be supported.
Notes:
- The graphical parameters and their values are derived from SVG/CSS2 standards with names and semantics which are as close as possible.
- TODO:
- REVISIT: There are no setter methods in this interface, is this a problem?
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
accept(StyleVisitor visitor)
accepts a StyleVisitor - used by xmlencoder and other packages which need to walk the style treeAnchorPoint
getAnchorPoint()
Location inside of the Graphic (or Label) to position the main-geometry point.Displacement
getDisplacement()
The Displacement gives the X and Y displacements from the "hot-spot" point.Expression
getGap()
Gap gives the distance between two graphics.Expression
getInitialGap()
InitialGap specifies how far away the first graphic will be drawn relative to the start of the rendering lineExpression
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.Expression
getRotation()
This parameter defines the rotation of a graphic in the clockwise direction about its centre point in decimal degrees.Expression
getSize()
This paramteter gives the absolute size of the graphic in pixels encoded as a floating point number.List<GraphicalSymbol>
graphicalSymbols()
List of all symbols used to represent this graphic.void
setAnchorPoint(AnchorPoint anchorPoint)
Anchor point (expressed as an x/y percentage of the graphic size).void
setDisplacement(Displacement offset)
void
setGap(Expression gap)
void
setInitialGap(Expression initialGap)
void
setOpacity(Expression opacity)
Graphic opacity.void
setRotation(Expression rotation)
This parameter defines the rotation of a graphic in the clockwise direction about its centre point in decimal degrees.void
setSize(Expression size)
Indicates the size at which the graphic should be displayed.-
Methods inherited from interface GraphicFill
accept
-
Methods inherited from interface GraphicLegend
accept
-
Methods inherited from interface GraphicStroke
accept
-
-
-
-
Field Detail
-
DEFAULT
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
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.
-
-
Method Detail
-
graphicalSymbols
List<GraphicalSymbol> graphicalSymbols()
List of all symbols used to represent this graphic.- Specified by:
graphicalSymbols
in interfaceGraphic
- Specified by:
graphicalSymbols
in interfaceGraphicLegend
- Returns:
- List of ExternalGraphic or Mark in the order provided.
-
getAnchorPoint
AnchorPoint getAnchorPoint()
Location inside of the Graphic (or Label) to position the main-geometry point.The coordinates are provided as 0.0 to 1.0 range amounting to a percentage of the graphic width/height. So the default of 0.5/0.5 indicates that the graphic would be centered.
Please keep in mind that a system may shuffle things around a bit in order to prevent graphics from overlapping (so this AnchorPoint is only a hint about how things should be if there is enough room).
- Specified by:
getAnchorPoint
in interfaceGraphic
- Specified by:
getAnchorPoint
in interfaceGraphicLegend
- Returns:
- AnchorPoint , if null should use a default point X=0.5 Y=0.5
-
setAnchorPoint
void setAnchorPoint(AnchorPoint anchorPoint)
Anchor point (expressed as an x/y percentage of the graphic size).- Specified by:
setAnchorPoint
in interfaceGraphicLegend
-
getOpacity
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:
getOpacity
in interfaceGraphic
- Specified by:
getOpacity
in interfaceGraphicLegend
- Returns:
- The opacity of the Graphic, where 0.0 is completely transparent and 1.0 is completely opaque.
-
setOpacity
void setOpacity(Expression opacity)
Description copied from interface:GraphicLegend
Graphic opacity.- Specified by:
setOpacity
in interfaceGraphicLegend
- Parameters:
opacity
- opacity between 0 and 1
-
getSize
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.
- Specified by:
getSize
in interfaceGraphic
- Specified by:
getSize
in interfaceGraphicLegend
- Returns:
- The size of the graphic. The default is context specific. Negative values are not possible.
-
setSize
void setSize(Expression size)
Description copied from interface:GraphicLegend
Indicates the size at which the graphic should be displayed.If this value is null the natural size of the graphic will be used; or for graphics without a natural size like SVG files 16x16 will be used.
- Specified by:
setSize
in interfaceGraphicLegend
- Parameters:
size
- Size of graphic
-
getDisplacement
Displacement getDisplacement()
Description copied from interface:Graphic
The 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:
getDisplacement
in interfaceGraphic
- Specified by:
getDisplacement
in interfaceGraphicLegend
- Returns:
- Offset of graphic
-
setDisplacement
void setDisplacement(Displacement offset)
- Specified by:
setDisplacement
in interfaceGraphicLegend
- Parameters:
offset
- Amount to offset graphic
-
getRotation
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:
getRotation
in interfaceGraphic
- Specified by:
getRotation
in interfaceGraphicLegend
- Returns:
- The angle of rotation in decimal degrees. Negative values represent counter-clockwise rotation. The default is 0.0 (no rotation).
-
setRotation
void setRotation(Expression rotation)
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:
setRotation
in interfaceGraphicLegend
- Parameters:
rotation
- in decimal degrees
-
getGap
Expression getGap()
Description copied from interface:GraphicStroke
Gap gives the distance between two graphics.- Specified by:
getGap
in interfaceGraphicStroke
- Returns:
- Expression
-
setGap
void setGap(Expression gap)
-
getInitialGap
Expression getInitialGap()
Description copied from interface:GraphicStroke
InitialGap specifies how far away the first graphic will be drawn relative to the start of the rendering line- Specified by:
getInitialGap
in interfaceGraphicStroke
- Returns:
- Expression
-
setInitialGap
void setInitialGap(Expression initialGap)
-
accept
void accept(StyleVisitor visitor)
accepts a StyleVisitor - used by xmlencoder and other packages which need to walk the style tree- Parameters:
visitor
- - the visitor object
-
-