org.geotools.styling
Class GraphicImpl

java.lang.Object
  extended by org.geotools.styling.GraphicImpl
All Implemented Interfaces:
java.lang.Cloneable, org.opengis.style.Graphic, org.opengis.style.GraphicFill, org.opengis.style.GraphicLegend, org.opengis.style.GraphicStroke

public class GraphicImpl
extends java.lang.Object
implements Graphic, org.opengis.util.Cloneable

Direct implementation of Graphic.

Version:
$Id: GraphicImpl.java 33974 2009-09-23 21:11:28Z jive $
Author:
Ian Turton, CCG, Johann Sorel (Geomatys)

Field Summary
 
Fields inherited from interface org.geotools.styling.Graphic
DEFAULT, NULL
 
Constructor Summary
protected GraphicImpl()
          Creates a new instance of DefaultGraphic
  GraphicImpl(org.opengis.filter.FilterFactory factory)
           
  GraphicImpl(org.opengis.filter.FilterFactory factory, org.opengis.style.AnchorPoint anchor, org.opengis.filter.expression.Expression gap, org.opengis.filter.expression.Expression initialGap)
           
 
Method Summary
 void accept(StyleVisitor visitor)
          accepts a StyleVisitor - used by xmlencoder and other packages which need to walk the style tree
 java.lang.Object accept(org.opengis.style.StyleVisitor visitor, java.lang.Object data)
           
 void addExternalGraphic(ExternalGraphic externalGraphic)
          Deprecated. 
 void addMark(Mark mark)
          Deprecated. 
 void addSymbol(Symbol symbol)
          Deprecated. 
 java.lang.Object clone()
          Creates a deep copy clone.
 boolean equals(java.lang.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()
           
 ExternalGraphic[] getExternalGraphics()
          Deprecated. 
 org.opengis.filter.expression.Expression getGap()
           
 java.lang.String getGeometryPropertyName()
          Getter for property geometryPropertyName.
 org.opengis.filter.expression.Expression getInitialGap()
           
 Mark[] getMarks()
          Deprecated. 
 org.opengis.filter.expression.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.
 org.opengis.filter.expression.Expression getRotation()
          This parameter defines the rotation of a graphic in the clockwise direction about its centre point in decimal degrees.
 org.opengis.filter.expression.Expression getSize()
          This paramteter gives the absolute size of the graphic in pixels encoded as a floating point number.
 Symbol[] getSymbols()
          Deprecated. 
 java.util.List<org.opengis.style.GraphicalSymbol> graphicalSymbols()
          List of all symbols used to represent this graphic.
 int hashCode()
          Override of hashcode
 void setAnchorPoint(AnchorPoint anchor)
           
 void setAnchorPoint(org.opengis.style.AnchorPoint anchorPoint)
          Anchor point (expressed as an x/y percentage of the graphic size).
 void setDisplacement(org.opengis.style.Displacement offset)
           
 void setExternalGraphics(ExternalGraphic[] externalGraphics)
          Deprecated. 
 void setFilterFactory(org.opengis.filter.FilterFactory factory)
          Deprecated. 
 void setGap(org.opengis.filter.expression.Expression gap)
           
 void setGeometryPropertyName(java.lang.String name)
          Deprecated. 
 void setInitialGap(org.opengis.filter.expression.Expression initialGap)
           
 void setMarks(Mark[] marks)
          Deprecated. 
 void setOpacity(double opacity)
          Deprecated. 
 void setOpacity(org.opengis.filter.expression.Expression opacity)
          Graphic opacity.
 void setRotation(double rotation)
          Deprecated. 
 void setRotation(org.opengis.filter.expression.Expression rotation)
          Setter for property rotation.
 void setSize(org.opengis.filter.expression.Expression size)
          Setter for property size.
 void setSize(int size)
          Deprecated. 
 void setSymbols(Symbol[] symbols)
          Deprecated. 
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphicImpl

protected GraphicImpl()
Creates a new instance of DefaultGraphic


GraphicImpl

public GraphicImpl(org.opengis.filter.FilterFactory factory)

GraphicImpl

public GraphicImpl(org.opengis.filter.FilterFactory factory,
                   org.opengis.style.AnchorPoint anchor,
                   org.opengis.filter.expression.Expression gap,
                   org.opengis.filter.expression.Expression initialGap)
Method Detail

setFilterFactory

@Deprecated
public void setFilterFactory(org.opengis.filter.FilterFactory factory)
Deprecated. 


graphicalSymbols

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

Specified by:
graphicalSymbols in interface org.opengis.style.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 org.opengis.style.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(org.opengis.style.AnchorPoint anchorPoint)
Description copied from interface: Graphic
Anchor point (expressed as an x/y percentage of the graphic size).


getOpacity

public org.opengis.filter.expression.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 org.opengis.style.Graphic
Returns:
The opacity of the Graphic, where 0.0 is completely transparent and 1.0 is completely opaque.

getRotation

public org.opengis.filter.expression.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 org.opengis.style.Graphic
Returns:
The angle of rotation in decimal degrees. Negative values represent counter-clockwise rotation. The default is 0.0 (no rotation).

getSize

public org.opengis.filter.expression.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 org.opengis.style.Graphic
Returns:
The size of the graphic, the default is context specific. Negative values are not possible.

getDisplacement

public DisplacementImpl getDisplacement()
Specified by:
getDisplacement in interface org.opengis.style.Graphic
Returns:
Offset of graphic

getInitialGap

public org.opengis.filter.expression.Expression getInitialGap()
Specified by:
getInitialGap in interface org.opengis.style.GraphicStroke

setInitialGap

public void setInitialGap(org.opengis.filter.expression.Expression initialGap)

getGap

public org.opengis.filter.expression.Expression getGap()
Specified by:
getGap in interface org.opengis.style.GraphicStroke

setGap

public void setGap(org.opengis.filter.expression.Expression gap)

setDisplacement

public void setDisplacement(org.opengis.style.Displacement offset)
Parameters:
offset - Amount to offset graphic

setOpacity

public void setOpacity(org.opengis.filter.expression.Expression opacity)
Graphic opacity.

Parameters:
opacity - New value of property opacity.

setOpacity

@Deprecated
public void setOpacity(double opacity)
Deprecated. 


setRotation

public void setRotation(org.opengis.filter.expression.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(org.opengis.filter.expression.Expression size)
Setter for property size.

Parameters:
size - New value of property size.

setSize

@Deprecated
public void setSize(int size)
Deprecated. 


setGeometryPropertyName

@Deprecated
public void setGeometryPropertyName(java.lang.String name)
Deprecated. 

Description copied from interface: Graphic
Setter for property geometryPropertyName.

Parameters:
name - New value of property geometryPropertyName.

getGeometryPropertyName

public java.lang.String getGeometryPropertyName()
Getter for property geometryPropertyName.

Returns:
Value of property geometryPropertyName.

accept

public java.lang.Object accept(org.opengis.style.StyleVisitor visitor,
                               java.lang.Object data)
Specified by:
accept in interface org.opengis.style.Graphic
Specified by:
accept in interface org.opengis.style.GraphicFill
Specified by:
accept in interface org.opengis.style.GraphicLegend
Specified by:
accept in interface org.opengis.style.GraphicStroke

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 java.lang.Object clone()
Creates a deep copy clone.

Overrides:
clone in class java.lang.Object
Returns:
The deep copy clone.
Throws:
java.lang.RuntimeException - DOCUMENT ME!

hashCode

public int hashCode()
Override of hashcode

Overrides:
hashCode in class java.lang.Object
Returns:
The hashcode.

equals

public boolean equals(java.lang.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 java.lang.Object
Parameters:
oth - The other GraphicsImpl to compare with.
Returns:
True if this is equal to oth according to the above conditions.


Copyright © 1996-2010 Geotools. All Rights Reserved.