org.geotools.renderer.j2d
Class RenderedMarks

java.lang.Object
  extended byorg.geotools.renderer.j2d.RenderedLayer
      extended byorg.geotools.renderer.j2d.RenderedMarks
Direct Known Subclasses:
RenderedGridMarks, StyledMark

public abstract class RenderedMarks
extends RenderedLayer

A set of marks and/or labels to be rendered. Marks can have different sizes and orientations (for example a field of wind arrows). This abstract class is not a container for marks. Subclasses must override the getMarkIterator() method in order to returns informations about marks.

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

Field Summary
protected static int AREAS_MASK
          A bitmask to specify the validity of geographic areas.
protected static int GLYPHS_MASK
          A bitmask to specify the validity of labels and their positions.
protected static int ICONS_MASK
          A bitmask to specify the validity of mark's icon.
protected static int MARKS_MASK
          A bitmask to specify the validity of mark's shapes, position, amplitude and direction.
 
Fields inherited from class org.geotools.renderer.j2d.RenderedLayer
listeners
 
Constructor Summary
RenderedMarks()
          Construct a new layer of marks using a default coordinate system.
RenderedMarks(CoordinateSystem cs)
          Construct a new layer of marks using the specified coordinate system.
 
Method Summary
protected  javax.swing.Action getAction(GeoMouseEvent event)
          Returns the action to run when some mouse action occured over the map.
 Unit getAmplitudeUnit()
          Returns the units for marks amplitude, or null if unknow.
abstract  MarkIterator getMarkIterator()
          Returns an iterator for iterating through the marks.
protected  java.lang.String getToolTipText(GeoMouseEvent event)
          Returns the tooltip text to display when the mouse cursor is located over the map.
 double getTypicalAmplitude()
          Returns the typical amplitude of marks.
protected  void invalidate()
          Tells that some data has changed in all aspects of marks.
protected  void invalidate(int mask)
          Tells that some data has changed.
protected  void paint(RenderingContext context)
          Proc?de au tra?age des marques de cette couche.
protected  void repaint(MarkIterator iterator)
          Tells that a single mark need to be repainted.
 
Methods inherited from class org.geotools.renderer.j2d.RenderedLayer
addPropertyChangeListener, addPropertyChangeListener, dispose, getCoordinateSystem, getLocale, getName, getPreferredArea, getPreferredPixelSize, getRenderer, getTreeLock, getZOrder, isVisible, prefetch, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, setCoordinateSystem, setPreferredArea, setPreferredPixelSize, setVisible, setZOrder, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

AREAS_MASK

protected static final int AREAS_MASK
A bitmask to specify the validity of geographic areas.

See Also:
invalidate(int), Constant Field Values

MARKS_MASK

protected static final int MARKS_MASK
A bitmask to specify the validity of mark's shapes, position, amplitude and direction.

See Also:
invalidate(int), Constant Field Values

ICONS_MASK

protected static final int ICONS_MASK
A bitmask to specify the validity of mark's icon.

See Also:
invalidate(int), Constant Field Values

GLYPHS_MASK

protected static final int GLYPHS_MASK
A bitmask to specify the validity of labels and their positions.

See Also:
invalidate(int), Constant Field Values
Constructor Detail

RenderedMarks

public RenderedMarks()
Construct a new layer of marks using a default coordinate system.


RenderedMarks

public RenderedMarks(CoordinateSystem cs)
Construct a new layer of marks using the specified coordinate system.

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

getMarkIterator

public abstract MarkIterator getMarkIterator()
Returns an iterator for iterating through the marks. Whenever it is invoked on the same RenderedMarks more than once, the mark iterator must consistently iterates through the same marks in the same order, unless invalidate() has been invoked. If some marks are added, removed or changed, then invalidate() must be invoked first (usually by the methods implementing the addition, change or removal of marks).

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, or null if unknow. All marks must use the same units. The default implementation returns always null.


getTypicalAmplitude

public double getTypicalAmplitude()
Returns the typical amplitude of marks. The default implementation computes the Root Mean Square (RMS) value of all marks amplitude. This information is used with mark's amplitude and shape in order to determine how big they should be rendered. Marks with an amplitude equals to the typical amplitude will be rendered with their shape unscaled. Other marks will be rendered with scaled versions of their shapes.


paint

protected void paint(RenderingContext context)
              throws org.opengis.referencing.operation.TransformException
Proc?de au tra?age des marques de cette couche. Les classes d?riv?es ne devraient pas avoir besoin de red?finir cette m?thode. Pour modifier la fa?on de dessiner les marques, red?finissez plut?t les m?thodes de MarkIterator.

Specified by:
paint in class RenderedLayer
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 was required and failed.
See Also:
MarkIterator.position(), MarkIterator.markShape(), MarkIterator.markIcon(), MarkIterator.geographicArea(), MarkIterator.label(), getTypicalAmplitude(), 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)

repaint

protected void repaint(MarkIterator iterator)
Tells that a single mark need to be repainted. This method can be invoked iteratively when few marks changed, and when the change was slight (e.g. a change of color). If a lot of marks changed, then invoking RenderedLayer.repaint() may be more effective.

Parameters:
iterator - An iterator over the mark to be repainted. Only the current mark will be repainted.
Task:
TODO: If the shape expanded or if the mark moved, we would need to repaint a bigger area. We can do this with the information provided by the iterator.

invalidate

protected void invalidate(int mask)
Tells that some data has changed. This method must be invoked when the internal state of this object changed in such a way that its MarkIterator will iterates through marks in a different order, returns different geographic areas, mark shapes, icons and/or labels. This method do not invokes repaint(org.geotools.renderer.j2d.MarkIterator). This is the caller's responsability to invokes repaint() after an invalidate(...) call, if needed.

Parameters:
mask - A bitwise combinaison of AREAS_MASK, MARKS_MASK, ICONS_MASK and/or GLYPHS_MASK.
See Also:
AREAS_MASK, MARKS_MASK, ICONS_MASK, GLYPHS_MASK

invalidate

protected void invalidate()
Tells that some data has changed in all aspects of marks. This method invokes invalidate(int) with all flags set.


getToolTipText

protected final java.lang.String getToolTipText(GeoMouseEvent event)
Returns the tooltip text to display when the mouse cursor is located over the map. The default implementation localize the mark under the cursor and invokes MarkIterator.getToolTipText(org.geotools.renderer.j2d.GeoMouseEvent).

Overrides:
getToolTipText in class RenderedLayer
Parameters:
event - The mouse event.
Returns:
The tool tip text for the current mark, or null if none.
See Also:
Renderer.getToolTipText(org.geotools.renderer.j2d.GeoMouseEvent)

getAction

protected final javax.swing.Action getAction(GeoMouseEvent event)
Returns the action to run when some mouse action occured over the map. The default implementation localize the mark under the cursor and invokes MarkIterator.getAction(org.geotools.renderer.j2d.GeoMouseEvent).

Overrides:
getAction in class RenderedLayer
Parameters:
event - The mouse event.
Returns:
The action for the current mark, or null if none.


Copyright © GeoTools. All Rights Reserved.