org.geotools.renderer.j2d
Class RenderedLayer

java.lang.Object
  extended byorg.geotools.renderer.j2d.RenderedLayer
Direct Known Subclasses:
RenderedGeometries, RenderedGridCoverage, RenderedLegend, RenderedMarks

Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D as part of the port of J2D-renderer to the new GO-1 based API. Note that it is not possible to mix J2D-renderer classes with GO-1 rendering engine. Migration from J2D-renderer to the GO-1 API will requires the replacement of all deprecated classes together. Because the new GO-1 rendering engine is a work in progress, see GEOT-776 in order to determine if enough functionalites have been ported for yours need.

public abstract class RenderedLayer
extends java.lang.Object

Base class for layers to be rendered using the renderer for Java2D. When a layer is being added to a renderer, the following methods are automatically invoked:

 setCoordinateSystem(renderingCS);
 setVisible(true);
 

Version:
$Id: RenderedLayer.java 17916 2006-02-08 10:31:58Z desruisseaux $
Author:
Martin Desruisseaux
See Also:
Renderer, RenderingContext

Field Summary
protected  java.beans.PropertyChangeSupport listeners
          Deprecated. Listeners to be notified about any changes in this layer's properties.
 
Constructor Summary
RenderedLayer()
          Deprecated. Construct a new rendered layer.
RenderedLayer(CoordinateSystem cs)
          Deprecated. Construct a new rendered layer using the specified coordinate system.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#addPropertyChangeListener.
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#addPropertyChangeListener.
 void dispose()
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#dispose.
protected  javax.swing.Action getAction(GeoMouseEvent event)
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#getAction.
 CoordinateSystem getCoordinateSystem()
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#getObjectiveCRS.
 java.util.Locale getLocale()
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#getLocale.
 java.lang.String getName(java.util.Locale locale)
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#getName.
 java.awt.geom.Rectangle2D getPreferredArea()
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#getEnvelope.
 java.awt.geom.Dimension2D getPreferredPixelSize()
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#getTypicalCellDimension.
 Renderer getRenderer()
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#getCanvas.
protected  java.lang.String getToolTipText(GeoMouseEvent event)
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#getToolTipText.
protected  java.lang.Object getTreeLock()
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#getTreeLock.
 float getZOrder()
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#getZOrderHint.
 boolean isVisible()
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#getVisible.
protected abstract  void paint(RenderingContext context)
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#paint.
protected  void prefetch(RenderingContext context)
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#prefetch.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#removePropertyChangeListener.
 void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#removePropertyChangeListener.
 void repaint()
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#refresh().
 void repaint(java.awt.geom.Rectangle2D bounds)
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#refresh(Rectangle2D).
protected  void setCoordinateSystem(CoordinateSystem cs)
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#setObjectiveCRS.
 void setPreferredArea(java.awt.geom.Rectangle2D area)
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#setEnvelope.
 void setPreferredPixelSize(java.awt.geom.Dimension2D size)
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#setTypicalCellDimension.
 void setVisible(boolean visible)
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#setVisible.
 void setZOrder(float zOrder)
          Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#setZOrderHint.
 java.lang.String toString()
          Deprecated. Returns a string representation of this layer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

listeners

protected final java.beans.PropertyChangeSupport listeners
Deprecated. 
Listeners to be notified about any changes in this layer's properties. Examples of properties that may change are: "coordinateSystem", "preferredArea", "preferredPixelSize", "zOrder" and "visible".

Constructor Detail

RenderedLayer

public RenderedLayer()
Deprecated. 
Construct a new rendered layer. The coordinate system default to a local cartesian one and the z-order default to positive infinity (i.e. this layer is drawn on top of everything else). Subclasses should invokes setXXX methods in order to define properly this layer's properties.

See Also:
setCoordinateSystem(org.geotools.cs.CoordinateSystem), setPreferredArea(java.awt.geom.Rectangle2D), setPreferredPixelSize(java.awt.geom.Dimension2D), setZOrder(float)

RenderedLayer

public RenderedLayer(CoordinateSystem cs)
Deprecated. 
Construct a new rendered layer using the specified coordinate system. The z-order default to positive infinity (i.e. this layer is drawn on top of everything else). Subclasses should invokes setXXX methods in order to define properly this layer's properties.

Parameters:
cs - The coordinate system. If the specified coordinate system has more than two dimensions, then it must be a CompoundCoordinateSystem with a two dimensional headCS.
Throws:
java.lang.IllegalArgumentException - if cs is nul.
See Also:
setCoordinateSystem(org.geotools.cs.CoordinateSystem), setPreferredArea(java.awt.geom.Rectangle2D), setPreferredPixelSize(java.awt.geom.Dimension2D), setZOrder(float)
Method Detail

getName

public java.lang.String getName(java.util.Locale locale)
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#getName.

Returns this layer's name. The default implementation returns only the z-order formatted according the given locale.

Parameters:
locale - The desired locale, or null for a default locale.
Returns:
This layer's name.
See Also:
getLocale(), Renderer.getName(java.util.Locale)

getLocale

public java.util.Locale getLocale()
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#getLocale.

Returns to locale for this layer. The default implementation inherit the locale of its Renderer, if it has one. Otherwise, a default locale is returned.

See Also:
Renderer.getLocale(), Component.getLocale()

getRenderer

public Renderer getRenderer()
                     throws java.lang.IllegalStateException
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#getCanvas.

Returns the renderer which own this layer.

Returns:
The renderer (never null).
Throws:
java.lang.IllegalStateException - if this layer has not been added to any renderer.

getCoordinateSystem

public final CoordinateSystem getCoordinateSystem()
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#getObjectiveCRS.

Returns the two-dimensional rendering coordinate system. This is usually the renderer's coordinate system. This CS is always two-dimensional and is used by most methods like getPreferredArea() and getPreferredPixelSize().

Returns:
The coordinate system for this rendered layer.
See Also:
setCoordinateSystem(org.geotools.cs.CoordinateSystem), getPreferredArea(), getPreferredPixelSize(), RenderingContext.mapCS

setCoordinateSystem

protected void setCoordinateSystem(CoordinateSystem cs)
                            throws org.opengis.referencing.operation.TransformException
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#setObjectiveCRS.

Set the rendering coordinate system for this layer. This method is usually invoked in any of the following cases: This method transforms the preferred area if needed. Subclasses should overrides this method and transform their internal data here.

Parameters:
cs - The coordinate system. If the specified coordinate system has more than two dimensions, then it must be a CompoundCoordinateSystem with a two dimensional headCS.
Throws:
org.opengis.referencing.operation.TransformException - If cs can't be reduced to a two-dimensional coordinate system, or if this method do not accept the new coordinate system for some other reason. In case of failure, this method should keep the old CS and leave this layer in a consistent state.

getPreferredArea

public java.awt.geom.Rectangle2D getPreferredArea()
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#getEnvelope.

Returns the preferred area for this layer. This is the default area to show before any zoom is applied. This is usually (but not always) the bounding box of the underlying data.

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

setPreferredArea

public void setPreferredArea(java.awt.geom.Rectangle2D area)
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#setEnvelope.

Set the preferred area for this layer. This method do not change the georeferencing of the layer data. The preferred area change only the default area to be shown in a window.

See Also:
getPreferredArea(), setPreferredPixelSize(java.awt.geom.Dimension2D), getCoordinateSystem()

getPreferredPixelSize

public java.awt.geom.Dimension2D getPreferredPixelSize()
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#getTypicalCellDimension.

Returns the preferred pixel size in rendering coordinates. For image layers, this is the size of image's pixels. For other kind of layers, "pixel size" are to be understood as some dimension representative of the layer's resolution.

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

setPreferredPixelSize

public void setPreferredPixelSize(java.awt.geom.Dimension2D size)
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#setTypicalCellDimension.

Set the preferred pixel size in "real world" coordinates. For images, this is the size of image's pixels in units of getCoordinateSystem(). For other kind of layers, "pixel size" is to be understood as some raisonable resolution for the underlying data. For example a geometry layer may returns the geometry's mean resolution.

Parameters:
size - The preferred pixel size, or null if there is none.
See Also:
getPreferredPixelSize(), setPreferredArea(java.awt.geom.Rectangle2D), getCoordinateSystem()

getZOrder

public float getZOrder()
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#getZOrderHint.

Returns the z-order for this layer. Layers with highest z-order will be painted on top of layers with lowest z-order. The default value is Float.POSITIVE_INFINITY.

See Also:
setZOrder(float)

setZOrder

public void setZOrder(float zOrder)
               throws java.lang.IllegalArgumentException
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#setZOrderHint.

Set the z-order for this layer. Layers with highest z-order will be painted on top of layers with lowest z-order. The specified z-order replaces the default value returned by getZOrder().

Throws:
java.lang.IllegalArgumentException - if the specified zOrder is Float.NaN.

isVisible

public boolean isVisible()
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#getVisible.

Determines whether this layer should be visible when its container is visible.

Returns:
true if the layer is visible, false otherwise.

setVisible

public void setVisible(boolean visible)
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#setVisible.

Sp?cifie si cette couche doit ?tre visible ou non. Cette m?thode peut ?tre appel?e pour cacher momentan?ment une couche. Elle est aussi appel?e de fa?on syst?matique lorsque cette couche est ajout?e ou retir?e d'un Renderer:


repaint

public void repaint()
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#refresh().

Advises that this layer need to be repainted. The layer will not be repainted immediately, but at some later time depending on the widget implementation (e.g. Swing). This repaint() method can be invoked from any thread; it doesn't need to be the Swing thread.

Note that this method repaint only the area rendered during the last to paint(org.geotools.renderer.j2d.RenderingContext). If this layer now cover a wider area, then the area to repaint must be specified with a call to repaint(Rectangle2D) instead.


repaint

public void repaint(java.awt.geom.Rectangle2D bounds)
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#refresh(Rectangle2D).

Advises that some region need to be repainted. This layer will not be repainted immediately, but at some later time depending on the widget implementation (e.g. Swing). This repaint(...) method can be invoked from any thread; it doesn't need to be the Swing thread.

Parameters:
bounds - The dirty region to repaint, in the "real world" rendering coordinate system. A null value repaint everything.

paint

protected abstract void paint(RenderingContext context)
                       throws org.opengis.referencing.operation.TransformException
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#paint.

Paint this object. This method is invoked by Renderer every time this layer needs to be repainted. By default, painting is done in the rendering coordinate system (usually "real world" metres). This method is responsible for transformations from its own underlying data CS to the rendering CS if needed. The RenderingContext object provides informations for such transformations:

The RenderingContext object can takes care of configuring Graphics2D with the right transform for a limited set of particular CS (namely, only CS leading to an affine transform). This is convenient for switching between rendering CS (the one used for drawing map features) and Java2D CS (the one used for rendering texts and labels). Example:

  Shape paint(RenderingContext context) {
      Graphics2D graphics = context.getGraphics();
      // Paint here map features in geographic coordinates (usually m or ?)
      context.addPaintedArea(...); // Optional
  
      context.setCoordinateSystem(context.textCS);
      // Write here text or label. Coordinates are in dots.
      context.addPaintedArea(...); // Optional
  
      context.setCoordinateSystem(context.mapCS);
      // Continue here the rendering of map features in geographic coordinates
      context.addPaintedArea(...); // Optional
  }
 
During the rendering process, implementations are encouraged to declare a (potentially approximative) bounding shape of their painted area with calls to RenderingContext.addPaintedArea(Shape). This is an optional operation: providing those hints only help Renderer to speed up future rendering and events processing.

Parameters:
context - Information relatives to the rendering context. This object ontains the Graphics2D to use and methods for getting MathTransform objects. This temporary object will be destroy once the rendering is completed. Consequently, do not keep a reference to it outside this paint method.
Throws:
org.opengis.referencing.operation.TransformException - If a coordinate transformation failed during the rendering process.

prefetch

protected void prefetch(RenderingContext context)
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#prefetch.

Hints that this layer might be painted in the near future. Some implementations may spawn a thread to compute the data while others may ignore the hint. The default implementation does nothing.

Parameters:
context - Information relatives to the rendering context. This object contains methods for querying the area to be painted in arbitrary coordinate system. This temporary object will be destroy once the rendering is completed. Consequently, do not keep a reference to it outside this prefetch method.
See Also:
PlanarImage.prefetchTiles(java.awt.Point[])

getToolTipText

protected java.lang.String getToolTipText(GeoMouseEvent event)
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#getToolTipText.

Retourne le texte ? afficher dans une bulle lorsque la souris tra?ne sur la couche. L'impl?mentation par d?faut retourne toujours null, ce qui signifie que cette couche n'a aucun texte ? afficher (les autres couches seront alors interrog?es). Les classes d?riv?es peuvent red?finir cette m?thode pour retourner un texte apr?s avoir v?rifi? que les coordonn?es de event correspondent bien ? un point de la couche. Note: This method is not a commited part of the API. It may moves elsewhere in a future version.

Parameters:
event - Coordonn?es du curseur de la souris.
Returns:
Le texte ? afficher lorsque la souris tra?ne sur la couche. Ce texte peut ?tre nul pour signifier qu'il ne faut rien ?crire.
See Also:
Renderer.getToolTipText(org.geotools.renderer.j2d.GeoMouseEvent)

getAction

protected javax.swing.Action getAction(GeoMouseEvent event)
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#getAction.

Returns the action to run when some mouse action occured over this layer. The default implementation return always null, which means that no action is defined for this layer. Subclasses which override this method should check if the mouse cursor is really over a component of this layer (for example over a geometry). Note: This method is not a commited part of the API. It may moves elsewhere in a future version.

Parameters:
event - The mouse event.
Returns:
The action for the layer, or null if none.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#addPropertyChangeListener.

Add a property change listener to the listener list. The listener is registered for all properties. For example, methods setVisible(boolean), setZOrder(float), setPreferredArea(java.awt.geom.Rectangle2D) and setPreferredPixelSize(java.awt.geom.Dimension2D) will fire "visible", "zOrder", "preferredArea" and "preferredPixelSize" change events respectively.

A particular event, namely "scale", is also fired everytime the zoom changes. It is particular in that this event results from a change in the renderer state rather than a change applied directly on this layer. However, since scale changes are propagated to all layers at rendering time, it makes sense to notify layer's listeners as well. A layer can changes its own state as a result of a scale change; for example a layer may hide or show more features. The scale factor is usually smaller than 1. For example for a 1:1000 scale, the scale factor will be 0.001. This scale factor takes in account the physical size of the rendering device (e.g. the screen size) if such information is available. Note that this scale can't be more accurate than the information supplied by the underlying system.

Parameters:
listener - The property change listener to be added.

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener listener)
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#addPropertyChangeListener.

Add a PropertyChangeListener for a specific property. The listener will be invoked only when that specific property changes.

Parameters:
propertyName - The name of the property to listen on.
listener - The PropertyChangeListener to be added.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#removePropertyChangeListener.

Remove a property change listener from the listener list. This removes a PropertyChangeListener that was registered for all properties.

Parameters:
listener - The property change listener to be removed

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String propertyName,
                                         java.beans.PropertyChangeListener listener)
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#removePropertyChangeListener.

Remove a PropertyChangeListener for a specific property.

Parameters:
propertyName - The name of the property that was listened on.
listener - The PropertyChangeListener to be removed.

getTreeLock

protected final java.lang.Object getTreeLock()
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#getTreeLock.

Returns the lock for synchronisation.


dispose

public void dispose()
Deprecated. Replaced by org.geotools.display.canvas.GraphicPrimitive2D#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.

The results of referencing a layer after a call to dispose() are undefined. However, invoking this method more than once is safe. Note that this method is invoked automatically by Renderer.dispose(), but not from any remove(...) method (in order to allow moving layers between different renderers).

See Also:
Renderer.dispose(), PlanarImage.dispose()

toString

public java.lang.String toString()
Deprecated. 
Returns a string representation of this layer. This method is for debugging purpose only and may changes in any future version.



Copyright © GeoTools. All Rights Reserved.