org.geotools.renderer.j2d
Class RenderedGridMarks

java.lang.Object
  extended byorg.geotools.renderer.j2d.RenderedLayer
      extended byorg.geotools.renderer.j2d.RenderedMarks
          extended byorg.geotools.renderer.j2d.RenderedGridMarks

public class RenderedGridMarks
extends RenderedMarks

Renderer grid coverage data as marks. The default appearance depends on the number of bands:

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

Nested Class Summary
protected  class RenderedGridMarks.Iterator
          Iterates through all marks in a RenderedGridMarks.
 
Field Summary
 
Fields inherited from class org.geotools.renderer.j2d.RenderedMarks
AREAS_MASK, GLYPHS_MASK, ICONS_MASK, MARKS_MASK
 
Fields inherited from class org.geotools.renderer.j2d.RenderedLayer
listeners
 
Constructor Summary
RenderedGridMarks(GridCoverage coverage)
          Construct a new layer for the specified grid coverage.
 
Method Summary
 void dispose()
          Provides a hint that a layer will no longer be accessed from a reference in user space.
 Unit getAmplitudeUnit()
          Returns the units for marks amplitude.
 int[] getBands()
          Returns the bands to use for querying mark values.
 GridCoverage getGridCoverage()
          Returns the current grid coverage.
 MarkIterator getMarkIterator()
          Returns an iterator for iterating through the marks.
 java.awt.Paint getMarkPaint()
          Returns the default fill paint for marks.
 java.awt.Shape getMarkShape()
          Returns the shape to use for painting marks.
 java.lang.String getName(java.util.Locale locale)
          Returns the name of this layer.
 java.awt.geom.Rectangle2D getPreferredArea()
          Returns the preferred area for this layer.
 double getTypicalAmplitude()
          Returns the typical amplitude of marks.
 float getZOrder()
          Returns the z-order for this layer.
protected  void paint(RenderingContext context)
          Proc?de au tra?age des marques de cette grille.
 void setAutoDecimation(int spaceX, int spaceY)
          D?cime automatiquement les points de la grille de fa?on ? conserver un espace d'au moins spaceX et spaceY entre chaque point.
 void setBands(int[] bands)
          Set the bands to use for querying mark values.
protected  void setCoordinateSystem(CoordinateSystem cs)
          Set the rendering coordinate system for this layer.
 void setDecimation(int decimateX, int decimateY)
          Set a decimation factor.
 void setGridCoverage(GridCoverage coverage)
          Set the grid coverage for this layer.
 void setMarkPaint(java.awt.Paint paint)
          Set the default fill paint for marks.
 void setMarkShape(java.awt.Shape shape)
          Set the shape to use for painting marks.
 
Methods inherited from class org.geotools.renderer.j2d.RenderedMarks
getAction, getToolTipText, invalidate, invalidate, repaint
 
Methods inherited from class org.geotools.renderer.j2d.RenderedLayer
addPropertyChangeListener, addPropertyChangeListener, getCoordinateSystem, getLocale, getPreferredPixelSize, 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

RenderedGridMarks

public RenderedGridMarks(GridCoverage coverage)
Construct a new layer for the specified grid coverage. If the supplied grid coverage has only one band, then marks will be displayed as circles with area proportional to sample values. Otherwise, marks will be displayed as arrows with x and y components fetched from sample dimensions (bands) 0 and 1 respectively.

Parameters:
coverage - The grid coverage, or null if none.
Method Detail

getName

public java.lang.String getName(java.util.Locale locale)
Returns the name of this layer.

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

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. 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.

setGridCoverage

public void setGridCoverage(GridCoverage coverage)
                     throws org.opengis.referencing.operation.TransformException
Set the grid coverage for this layer.

Parameters:
coverage - The grid coverage, or null if none.
Throws:
org.opengis.referencing.operation.TransformException - is a transformation was required and failed.

getGridCoverage

public GridCoverage getGridCoverage()
Returns the current grid coverage.


setBands

public void setBands(int[] bands)
              throws java.lang.IllegalArgumentException
Set the bands to use for querying mark values.

Parameters:
bands - The band. This array length should 0, 1 or 2. A length of 0 is equivalents to a call to setVisible(false).
Throws:
java.lang.IllegalArgumentException - if the array length is illegal, or if a band is greater than the number of bands in the underlying grid coverage.

getBands

public int[] getBands()
Returns the bands to use for querying mark values.


setDecimation

public void setDecimation(int decimateX,
                          int decimateY)
Set a decimation factor. A value greater than 1 will reduces the number of points iterated by the MarkIterator. Note that points are not actually decimated, but rather averaged. For example a "decimation" factor of 2 will average two neighbor points and replace them with new one in the middle of the original points.

Parameters:
decimateX - Decimation among x, or 1 for none.
decimateY - Decimation among y, or 1 for none.

setAutoDecimation

public void setAutoDecimation(int spaceX,
                              int spaceY)
D?cime automatiquement les points de la grille de fa?on ? conserver un espace d'au moins spaceX et spaceY entre chaque point.

Parameters:
spaceX - Espace minimal (en points) selon x ? laisser entre les points de la grille. La valeur 0 d?sactive la d?cimation selon cet axe.
spaceY - Espace minimal (en points) selon y ? laisser entre les points de la grille. La valeur 0 d?sactive la d?cimation selon cet axe.

getMarkShape

public java.awt.Shape getMarkShape()
Returns the shape to use for painting marks. If this layer paint labels rather than marks, then this method returns null.

See Also:
setMarkShape(java.awt.Shape), RenderedGridMarks.Iterator.markShape()

setMarkShape

public void setMarkShape(java.awt.Shape shape)
Set the shape to use for painting marks. This shape must be centred at the origin (0,0) and its coordinates must be expressed in dots (1/72 of inch). For example in order to paint wind arrows, this shape should be oriented toward positives x (i.e. toward 0 arithmetic radians), has a base centred at (0,0) and have a raisonable size (for example 16×4 pixels). The method RenderedMarks.paint(RenderingContext) will automatically takes care of rotation, translation and scale in order to adjust this model to each mark properties.

A value of null is legal. In this case, this layer will renderer amplitudes as labels rather than marks.

See Also:
getMarkShape(), RenderedGridMarks.Iterator.markShape()

getMarkPaint

public java.awt.Paint getMarkPaint()
Returns the default fill paint for marks.

See Also:
setMarkPaint(java.awt.Paint), RenderedGridMarks.Iterator.markPaint()

setMarkPaint

public void setMarkPaint(java.awt.Paint paint)
Set the default fill paint for marks.

See Also:
getMarkPaint(), RenderedGridMarks.Iterator.markPaint()

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 grid coverage'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()

getZOrder

public float getZOrder()
Returns the z-order for this layer. If the grid coverage has at least 3 dimension, then the default z-order is gridCoverage.getEnvelope().getCenter(2). Otherwise, the default value is Float.POSITIVE_INFINITY in order to paint the marks over everything else. The default value can be overriden with a call to RenderedLayer.setZOrder(float).

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

getMarkIterator

public MarkIterator getMarkIterator()
Returns an iterator for iterating through the marks. The default implementation returns an instance of RenderedGridMarks.Iterator.

Specified by:
getMarkIterator in class RenderedMarks
Returns:
An iterator for iterating through the marks. This iterator doesn't need to be thread-safe.

getAmplitudeUnit

public Unit getAmplitudeUnit()
Returns the units for marks amplitude. The default implementation infers the units from the underlying grid coverage.

Overrides:
getAmplitudeUnit in class RenderedMarks

getTypicalAmplitude

public double getTypicalAmplitude()
Returns the typical amplitude of marks. The default implementation computes the Root Mean Square (RMS) value of sample values in the underlying grid coverage, no matter what the decimation factor is (if any).

Overrides:
getTypicalAmplitude in class RenderedMarks

paint

protected void paint(RenderingContext context)
              throws org.opengis.referencing.operation.TransformException
Proc?de au tra?age des marques de cette grille.

Overrides:
paint in class RenderedMarks
Throws:
org.opengis.referencing.operation.TransformException - si une projection cartographique ?tait n?cessaire et a ?chou?e.
See Also:
MarkIterator.position(), MarkIterator.markShape(), MarkIterator.markIcon(), MarkIterator.geographicArea(), MarkIterator.label(), RenderedMarks.getTypicalAmplitude(), RenderedMarks.getAmplitudeUnit(), MarkIterator.paint(java.awt.Graphics2D, java.awt.Shape, java.awt.Shape, java.awt.image.RenderedImage, java.awt.geom.AffineTransform, java.awt.font.GlyphVector, java.awt.geom.Point2D.Float)

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.