org.geotools.styling
Class GraphicImpl

java.lang.Object
  extended byorg.geotools.event.AbstractGTComponent
      extended byorg.geotools.styling.GraphicImpl
All Implemented Interfaces:
java.lang.Cloneable, org.opengis.util.Cloneable, Graphic, GTComponent

public class GraphicImpl
extends AbstractGTComponent
implements Graphic, org.opengis.util.Cloneable

DOCUMENT ME!

Version:
$Id: GraphicImpl.java 18021 2006-02-14 20:36:18Z jdeolive $
Author:
Ian Turton, CCG

Field Summary
 
Fields inherited from class org.geotools.event.AbstractGTComponent
notification
 
Fields inherited from interface org.geotools.styling.Graphic
DEFAULT, NULL
 
Constructor Summary
protected GraphicImpl()
          Creates a new instance of DefaultGraphic
  GraphicImpl(FilterFactory factory)
           
 
Method Summary
 void accept(StyleVisitor visitor)
          accepts a StyleVisitor - used by xmlencoder and other packages which need to walk the style tree
 void addExternalGraphic(ExternalGraphic externalGraphic)
           
 void addMark(Mark mark)
           
 void addSymbol(Symbol symbol)
           
 java.lang.Object clone()
          Creates a deep copy clone.
 boolean equals(java.lang.Object oth)
          Compares this GraphicImpl with another for equality.
 Displacement getDisplacement()
           
 ExternalGraphic[] getExternalGraphics()
          Provides a list of external graphics which can be used to represent this graphic.
 java.lang.String getGeometryPropertyName()
          Getter for property geometryPropertyName.
 Mark[] getMarks()
          Provides a list of suitable marks which can be used to represent this graphic.
 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()
          Provides a list of all the symbols which can be used to represent this graphic.
 int hashCode()
          Override of hashcode
 void setDisplacement(Displacement offset)
           
 void setExternalGraphics(ExternalGraphic[] externalGraphics)
           
 void setFilterFactory(FilterFactory factory)
           
 void setGeometryPropertyName(java.lang.String name)
          Setter for property geometryPropertyName.
 void setMarks(Mark[] marks)
           
 void setOpacity(double opacity)
           
 void setOpacity(Expression opacity)
          Setter for property opacity.
 void setRotation(double rotation)
           
 void setRotation(Expression rotation)
          Setter for property rotation.
 void setSize(Expression size)
          Setter for property size.
 void setSize(int size)
           
 void setSymbols(Symbol[] symbols)
           
 
Methods inherited from class org.geotools.event.AbstractGTComponent
changed, fireChanged, fireChildChanged, getNote, getParent, removed, setNote
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.geotools.event.GTComponent
changed, getNote, getParent, removed, setNote
 

Constructor Detail

GraphicImpl

protected GraphicImpl()
Creates a new instance of DefaultGraphic


GraphicImpl

public GraphicImpl(FilterFactory factory)
Method Detail

setFilterFactory

public void setFilterFactory(FilterFactory factory)

getExternalGraphics

public ExternalGraphic[] getExternalGraphics()
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.

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

setExternalGraphics

public void setExternalGraphics(ExternalGraphic[] externalGraphics)
Specified by:
setExternalGraphics in interface Graphic

addExternalGraphic

public void addExternalGraphic(ExternalGraphic externalGraphic)
Specified by:
addExternalGraphic in interface Graphic

getMarks

public Mark[] getMarks()
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.

Specified by:
getMarks in interface Graphic
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

public void setMarks(Mark[] marks)
Specified by:
setMarks in interface Graphic

addMark

public void addMark(Mark mark)
Specified by:
addMark in interface Graphic

getSymbols

public Symbol[] getSymbols()
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.

Specified by:
getSymbols in interface Graphic
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

public void setSymbols(Symbol[] symbols)
Specified by:
setSymbols in interface Graphic

addSymbol

public void addSymbol(Symbol symbol)
Specified by:
addSymbol 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()
Specified by:
getDisplacement in interface Graphic

setDisplacement

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

setOpacity

public void setOpacity(Expression opacity)
Setter for property opacity.

Specified by:
setOpacity in interface Graphic
Parameters:
opacity - New value of property opacity.

setOpacity

public void setOpacity(double opacity)

setRotation

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

Specified by:
setRotation in interface Graphic
Parameters:
rotation - New value of property rotation.

setRotation

public void setRotation(double rotation)

setSize

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

Specified by:
setSize in interface Graphic
Parameters:
size - New value of property size.

setSize

public void setSize(int size)

setGeometryPropertyName

public void setGeometryPropertyName(java.lang.String name)
Description copied from interface: Graphic
Setter for property geometryPropertyName.

Specified by:
setGeometryPropertyName in interface Graphic
Parameters:
name - New value of property geometryPropertyName.

getGeometryPropertyName

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

Specified by:
getGeometryPropertyName in interface Graphic
Returns:
Value of property geometryPropertyName.

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

Specified by:
clone in interface org.opengis.util.Cloneable
Overrides:
clone in class AbstractGTComponent
Returns:
The deep copy clone.
Throws:
java.lang.RuntimeException - DOCUMENT ME!

hashCode

public int hashCode()
Override of hashcode

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.

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


Copyright © GeoTools. All Rights Reserved.