org.geotools.styling
Class GraphicImpl

Object
  extended by GraphicImpl
All Implemented Interfaces:
Cloneable, Graphic, GraphicFill, GraphicLegend, GraphicStroke

public class GraphicImpl
extends Object
implements Graphic, Cloneable

Direct implementation of Graphic.

Author:
Ian Turton, CCG, Johann Sorel (Geomatys)

Field Summary
 
Fields inherited from interface Graphic
DEFAULT, NULL
 
Constructor Summary
protected GraphicImpl()
          Creates a new instance of DefaultGraphic
  GraphicImpl(FilterFactory factory)
           
  GraphicImpl(FilterFactory factory, AnchorPoint anchor, Expression gap, Expression initialGap)
           
 
Method Summary
 void accept(StyleVisitor visitor)
          accepts a StyleVisitor - used by xmlencoder and other packages which need to walk the style tree
 Object accept(StyleVisitor visitor, Object data)
          calls the visit method of a StyleVisitor
 void addExternalGraphic(ExternalGraphic externalGraphic)
          Deprecated. 
 void addMark(Mark mark)
          Deprecated. 
 void addSymbol(Symbol symbol)
          Deprecated. 
 Object clone()
          Creates a deep copy clone.
 boolean equals(Object oth)
          Compares this GraphicImpl with another for equality.
 AnchorPointImpl getAnchorPoint()
          Location inside of the Graphic (or Label) to position the main-geometry point.
 DisplacementImpl getDisplacement()
          The Displacement gives the X and Y displacements from the "hot-spot" point.
 ExternalGraphic[] getExternalGraphics()
          Deprecated. 
 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 line
 Mark[] getMarks()
          Deprecated. 
 Expression getOpacity()
          This specifies the level of translucency to use when rendering the graphic.
 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.
 Symbol[] getSymbols()
          Deprecated. 
 List<GraphicalSymbol> graphicalSymbols()
          List of all symbols used to represent this graphic.
 int hashCode()
          Override of hashcode
 void setAnchorPoint(AnchorPoint anchor)
           
 void setAnchorPoint(AnchorPoint anchorPoint)
          Anchor point (expressed as an x/y percentage of the graphic size).
 void setDisplacement(Displacement offset)
           
 void setExternalGraphics(ExternalGraphic[] externalGraphics)
          Deprecated. 
 void setFilterFactory(FilterFactory factory)
          Deprecated. 
 void setGap(Expression gap)
           
 void setInitialGap(Expression initialGap)
           
 void setMarks(Mark[] marks)
          Deprecated. 
 void setOpacity(double opacity)
          Deprecated. 
 void setOpacity(Expression opacity)
          Graphic opacity.
 void setRotation(double rotation)
          Deprecated. 
 void setRotation(Expression rotation)
          Setter for property rotation.
 void setSize(Expression size)
          Setter for property size.
 void setSize(int size)
          Deprecated. 
 void setSymbols(Symbol[] symbols)
          Deprecated. 
 
Methods inherited from class Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

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

setFilterFactory

@Deprecated
public void setFilterFactory(FilterFactory factory)
Deprecated. 


graphicalSymbols

public List<GraphicalSymbol> graphicalSymbols()
Description copied from interface: Graphic
List of all symbols used to represent this graphic.

Specified by:
graphicalSymbols in interface Graphic
Returns:
List of ExternalGraphic or Mark in the order provided.

getExternalGraphics

@Deprecated
public ExternalGraphic[] getExternalGraphics()
Deprecated. 

Provides a list of external graphics which can be used to represent this graphic. Each one should be an equivalent representation but in a different format. If none are provided, or if none of the formats are supported, then the list of Marks should be used instead.

Returns:
An array of ExternalGraphics objects which should be equivalents but in different formats. If null is returned use getMarks instead.

setExternalGraphics

@Deprecated
public void setExternalGraphics(ExternalGraphic[] externalGraphics)
Deprecated. 


addExternalGraphic

@Deprecated
public void addExternalGraphic(ExternalGraphic externalGraphic)
Deprecated. 


getMarks

@Deprecated
public Mark[] getMarks()
Deprecated. 

Provides a list of suitable marks which can be used to represent this graphic. These should only be used if no ExternalGraphic is provided, or if none of the external graphics formats are supported.

Returns:
An array of marks to use when displaying this Graphic. By default, a "square" with 50% gray fill and black outline with a size of 6 pixels (unless a size is specified) is provided.

setMarks

@Deprecated
public void setMarks(Mark[] marks)
Deprecated. 


addMark

@Deprecated
public void addMark(Mark mark)
Deprecated. 


getSymbols

@Deprecated
public Symbol[] getSymbols()
Deprecated. 

Provides a list of all the symbols which can be used to represent this graphic

A symbol is an ExternalGraphic, Mark or any other object which implements the Symbol interface. These are returned in the order they were set.

This class operates as a "view" on getMarks() and getExternalGraphics() with the added magic that if nothing has been set ever a single default MarkImpl will be provided. This default will not effect the internal state it is only there as a sensible default for rendering.

Returns:
An array of symbols to use when displaying this Graphic. By default, a "square" with 50% gray fill and black outline with a size of 6 pixels (unless a size is specified) is provided.

setSymbols

@Deprecated
public void setSymbols(Symbol[] symbols)
Deprecated. 


addSymbol

@Deprecated
public void addSymbol(Symbol symbol)
Deprecated. 


getAnchorPoint

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

setAnchorPoint

public void setAnchorPoint(AnchorPoint anchor)

setAnchorPoint

public void setAnchorPoint(AnchorPoint anchorPoint)
Description copied from interface: Graphic
Anchor point (expressed as an x/y percentage of the graphic size).


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 DisplacementImpl 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:
Offset of graphic

getInitialGap

public 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 interface GraphicStroke
Returns:
Expression

setInitialGap

public void setInitialGap(Expression initialGap)

getGap

public Expression getGap()
Description copied from interface: GraphicStroke
Gap gives the distance between two graphics.

Specified by:
getGap in interface GraphicStroke
Returns:
Expression

setGap

public void setGap(Expression gap)

setDisplacement

public void setDisplacement(Displacement offset)
Parameters:
offset - Amount to offset graphic

setOpacity

public void setOpacity(Expression opacity)
Graphic opacity.

Parameters:
opacity - New value of property opacity.

setOpacity

@Deprecated
public void setOpacity(double opacity)
Deprecated. 


setRotation

public void setRotation(Expression rotation)
Setter for property rotation.

Parameters:
rotation - New value of property rotation.

setRotation

@Deprecated
public void setRotation(double rotation)
Deprecated. 


setSize

public void setSize(Expression size)
Setter for property size.

Parameters:
size - New value of property size.

setSize

@Deprecated
public void setSize(int size)
Deprecated. 


accept

public Object accept(StyleVisitor visitor,
                     Object data)
Description copied from interface: GraphicLegend
calls the visit method of a StyleVisitor

Specified by:
accept in interface Graphic
Specified by:
accept in interface GraphicFill
Specified by:
accept in interface GraphicLegend
Specified by:
accept in interface GraphicStroke
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

Parameters:
visitor - - the visitor object

clone

public Object clone()
Creates a deep copy clone.

Overrides:
clone in class Object
Returns:
The deep copy clone.
Throws:
RuntimeException - DOCUMENT ME!
See Also:
Object.clone()

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.


Copyright © 1996-2014 Geotools. All Rights Reserved.