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)
  • Field Details

    • 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 Details

  • Method Details

    • graphicalSymbols

      public List<GraphicalSymbol> graphicalSymbols()
      Description copied from interface: Graphic
      The 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:
      graphicalSymbols in interface Graphic
    • getAnchorPoint

      public AnchorPoint getAnchorPoint()
      Description copied from interface: Graphic
      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. 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:
      getAnchorPoint in interface Graphic
      Returns:
      AnchorPoint , if null should use a default point X=0.5 Y=0.5
    • setAnchorPoint

      public void setAnchorPoint(AnchorPoint anchor)
      Specified by:
      setAnchorPoint in interface Graphic
    • 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:
      getOpacity in interface Graphic
      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:
      getRotation in interface Graphic
      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.

      Specified by:
      getSize in interface Graphic
      Returns:
      The size of the graphic, the default is context specific. Negative values are not possible.
    • getDisplacement

      public 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 interface Graphic
      Returns:
      Displacement
    • getInitialGap

      public Expression getInitialGap()
      Specified by:
      getInitialGap in interface Graphic
    • setInitialGap

      public void setInitialGap(Expression initialGap)
      Specified by:
      setInitialGap in interface Graphic
    • getGap

      public Expression getGap()
      Specified by:
      getGap in interface Graphic
    • setGap

      public void setGap(Expression gap)
      Specified by:
      setGap in interface Graphic
    • setDisplacement

      public void setDisplacement(Displacement offset)
      Specified by:
      setDisplacement in interface Graphic
    • setOpacity

      public void setOpacity(Expression opacity)
      Description copied from interface: Graphic
      Graphic opacity.
      Specified by:
      setOpacity in interface Graphic
      Parameters:
      opacity - New value of property opacity.
    • setRotation

      public void setRotation(Expression rotation)
      Setter for property rotation.
      Specified by:
      setRotation in interface Graphic
      Parameters:
      rotation - New value of property rotation.
    • setSize

      public void setSize(Expression size)
      Setter for property size.
      Specified by:
      setSize in interface Graphic
      Parameters:
      size - New value of property size.
    • accept

      public Object accept(TraversingStyleVisitor visitor, Object data)
      Description copied from interface: Graphic
      Calls the visit method of a StyleVisitor
      Specified by:
      accept in interface Graphic
      Parameters:
      visitor - the style visitor
    • accept

      public void accept(StyleVisitor visitor)
      Description copied from interface: Graphic
      accepts a StyleVisitor - used by xmlencoder and other packages which need to walk the style tree
      Specified by:
      accept in interface Graphic
      Parameters:
      visitor - - the visitor object
    • clone

      public Object clone()
      Creates a deep copy clone.
      Specified by:
      clone in interface Cloneable
      Overrides:
      clone in class Object
      Returns:
      The deep copy clone.
      See Also:
    • hashCode

      public int hashCode()
      Override of hashcode
      Overrides:
      hashCode in class Object
      Returns:
      The 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.

      Overrides:
      equals in class Object
      Parameters:
      oth - The other GraphicsImpl to compare with.
      Returns:
      True if this is equal to oth according to the above conditions.