org.geotools.renderer.j2d
Class RenderedGeometries

java.lang.Object
  extended byorg.geotools.renderer.j2d.RenderedLayer
      extended byorg.geotools.renderer.j2d.RenderedGeometries
Direct Known Subclasses:
SLDRenderedGeometries

public class RenderedGeometries
extends RenderedLayer

A layer for a GeometryCollection object. Instances of this class are typically used for isobaths. Each isobath (e.g. sea-level, 50 meters, 100 meters...) may be rendererd with an instance of RenderedGeometries.

Version:
$Id: RenderedGeometries.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux

Field Summary
 
Fields inherited from class org.geotools.renderer.j2d.RenderedLayer
listeners
 
Constructor Summary
RenderedGeometries(GeometryCollection geometry)
          Construct a layer for the specified geometry.
 
Method Summary
 void dispose()
          Provides a hint that a layer will no longer be accessed from a reference in user space.
 java.awt.Paint getContour()
          Returns the default contouring color.
 java.awt.Paint getForeground()
          Returns the default filling color or paint.
 Geometry getGeometry()
          Returns the geometry for this layer.
 java.awt.geom.Rectangle2D getPreferredArea()
          Returns the preferred area for this layer.
 java.awt.geom.Dimension2D getPreferredPixelSize()
          Returns the preferred pixel size in rendering coordinates.
protected  boolean getRenderUsingMapCS()
          Returns true if polygon rendering uses the "real world" coordinate system, or false if it uses the output device coordinate system.
protected  java.lang.String getToolTipText(GeoMouseEvent event)
          Returns a tool tip text for the specified coordinates.
 float getZOrder()
          Returns the z-order for this layer.
protected  void paint(java.awt.Graphics2D graphics, java.awt.Shape polyline, Style2D style)
          Invoked automatically when a polyline is about to be draw.
protected  void paint(RenderingContext context)
          Draw the geometry.
 void setContour(java.awt.Paint paint)
          Sets the contouring color or paint.
protected  void setCoordinateSystem(CoordinateSystem cs)
          Set the rendering coordinate system for this layer.
 void setForeground(java.awt.Paint paint)
          Sets the filling color or paint.
 void setGeometry(GeometryCollection geometry)
          Set a new geometry for this layer.
protected  void setRenderUsingMapCS(boolean renderUsingMapCS)
          Specifies if polygon rendering uses the "real world" coordinate system.
 
Methods inherited from class org.geotools.renderer.j2d.RenderedLayer
addPropertyChangeListener, addPropertyChangeListener, getAction, getCoordinateSystem, getLocale, getName, getRenderer, getTreeLock, isVisible, prefetch, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, setPreferredArea, setPreferredPixelSize, setVisible, setZOrder, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RenderedGeometries

public RenderedGeometries(GeometryCollection geometry)
Construct a layer for the specified geometry.

Parameters:
geometry - The geometry, or null if none.
See Also:
setGeometry(org.geotools.renderer.geom.GeometryCollection)
Method Detail

getGeometry

public Geometry getGeometry()
Returns the geometry for this layer. This geometry should not be modified.

Returns:
The geometry, or null if none.
Task:
TODO: Can't freeze the geometry, because Geometry.freeze() is package-private. We could make this method public, but then we need to revisit its behavior. Should it freeze Geometry.setStyle(...) and setRenderingResolution(...) as well?

setGeometry

public void setGeometry(GeometryCollection geometry)
                 throws org.opengis.referencing.operation.TransformException
Set a new geometry for this layer.

Parameters:
geometry - The new geometry, or null if none.
Throws:
org.opengis.referencing.operation.TransformException - if the geometry can't be projected in the rendering coordinate system.

setCoordinateSystem

protected void setCoordinateSystem(CoordinateSystem cs)
                            throws org.opengis.referencing.operation.TransformException
Set the rendering coordinate system for this layer.

Overrides:
setCoordinateSystem in class RenderedLayer
Parameters:
cs - The coordinate system.
Throws:
org.opengis.referencing.operation.TransformException - if the geometry can't be projected to the specified coordinate system.

getContour

public java.awt.Paint getContour()
Returns the default contouring color.


setContour

public void setContour(java.awt.Paint paint)
Sets the contouring color or paint. This is the default paint to use when no styling information is provided for a polyline.


getForeground

public java.awt.Paint getForeground()
Returns the default filling color or paint.


setForeground

public void setForeground(java.awt.Paint paint)
Sets the filling color or paint. This is the default paint to use when no styling information is provided for a polyline.


getPreferredArea

public java.awt.geom.Rectangle2D getPreferredArea()
Returns the preferred area for this layer. If no preferred area has been explicitely set, then this method returns the geometry's bounding box.

Overrides:
getPreferredArea in class RenderedLayer
Returns:
The preferred area in the rendering coordinate system, or null if unknow or not applicable.
See Also:
RenderedLayer.getPreferredPixelSize(), RenderedLayer.getCoordinateSystem()

getPreferredPixelSize

public java.awt.geom.Dimension2D getPreferredPixelSize()
Returns the preferred pixel size in rendering coordinates. If no preferred pixel size has been explicitely set, then this method returns the geometry's pixel size.

Overrides:
getPreferredPixelSize in class RenderedLayer
Returns:
The preferred pixel size in this rendering coordinate system, or null if none.
See Also:
RenderedLayer.getPreferredArea(), RenderedLayer.getCoordinateSystem()

getZOrder

public float getZOrder()
Returns the z-order for this layer. Layers with highest z-order will be painted on top of layers with lowest z-order. If no order has been explicitely set, then the default z-order is GeometryCollection.getValue().

Overrides:
getZOrder in class RenderedLayer
See Also:
RenderedLayer.setZOrder(float)

getRenderUsingMapCS

protected boolean getRenderUsingMapCS()
Returns true if polygon rendering uses the "real world" coordinate system, or false if it uses the output device coordinate system. If true, then stroke and texture attributes are in "real world" units (usually meters); otherwise, they are in device units (usually pixels).


setRenderUsingMapCS

protected void setRenderUsingMapCS(boolean renderUsingMapCS)
Specifies if polygon rendering uses the "real world" coordinate system. If true, then stroke and texture attributes are in "real world" units (usually meters); otherwise, they are in device units (usually pixels). When using "real world" units, the visual line width will changes with zoom. When using output device units, the visual line width are constant under any zoom.


paint

protected void paint(java.awt.Graphics2D graphics,
                     java.awt.Shape polyline,
                     Style2D style)
Invoked automatically when a polyline is about to be draw. The default implementation draw or fill the polyline according the current foreground color.

Parameters:
graphics - The graphics in which to draw.
polyline - The polyline to draw.
style - The style to apply, or null if none.

paint

protected void paint(RenderingContext context)
              throws org.opengis.referencing.operation.TransformException
Draw the geometry.

Specified by:
paint in class RenderedLayer
Parameters:
context - The set of transformations needed for transforming geographic coordinates (longitude,latitude) into pixels coordinates.
Throws:
org.opengis.referencing.operation.TransformException - If a transformation failed.

getToolTipText

protected java.lang.String getToolTipText(GeoMouseEvent event)
Returns a tool tip text for the specified coordinates. The default implementation delegates to GeometryCollection.getPolygonName(java.awt.geom.Point2D, java.util.Locale).

Overrides:
getToolTipText in class RenderedLayer
Parameters:
event - The mouve event with geographic coordin?tes.
Returns:
The tool tip text, or null if there in no tool tips for this location.
See Also:
Renderer.getToolTipText(org.geotools.renderer.j2d.GeoMouseEvent)

dispose

public void dispose()
Provides a hint that a layer will no longer be accessed from a reference in user space. The results are equivalent to those that occur when the program loses its last reference to this layer, the garbage collector discovers this, and finalize is called. This can be used as a hint in situations where waiting for garbage collection would be overly conservative.

Overrides:
dispose in class RenderedLayer
See Also:
Renderer.dispose(), PlanarImage.dispose()


Copyright © GeoTools. All Rights Reserved.