|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.renderer.j2d.MarkIterator
Provides the mechanism for RenderedGridMarks
layer to return the appearance of
their marks. This class allows the layer to retrieve the appearance of its marks a mark
at a time. The default implementation paints circles at mark locations. Subclasses must
implement at least the following methods:
Constructor Summary | |
MarkIterator()
Construct a mark iterator. |
Method Summary | |
double |
amplitude()
Returns the horizontal amplitude for the current mark. |
double |
direction()
Returns the arithmetic direction for the current mark. |
java.awt.Font |
font()
Returns the font for current label. |
java.awt.Shape |
geographicArea()
Returns the geographic area around the current mark, or null if none.
|
protected javax.swing.Action |
getAction(GeoMouseEvent event)
Returns an action text for the current mark, or null if none.
|
abstract int |
getIteratorPosition()
Returns the current iterator position. |
protected java.lang.String |
getToolTipText(GeoMouseEvent event)
Returns a tooltip text for the current mark, or null if none.
|
java.lang.String |
label()
Returns the label for the current mark, or null if none.
|
LegendPosition |
labelPosition()
Returns the label position relative to the mark's position. |
java.awt.image.RenderedImage |
markIcon()
Returns the icon for the current mark, or null if none.
|
java.awt.Paint |
markPaint()
Returns the paint for current mark. |
java.awt.Shape |
markShape()
Returns the geometric shape for the current mark. |
abstract boolean |
next()
Moves the iterator to the next marks. |
protected void |
paint(java.awt.Graphics2D graphics,
java.awt.Shape geographicArea,
java.awt.Shape markShape,
java.awt.image.RenderedImage markIcon,
java.awt.geom.AffineTransform iconXY,
java.awt.font.GlyphVector label,
java.awt.geom.Point2D.Float labelXY)
Paint a mark, its geographic area and its label. |
abstract java.awt.geom.Point2D |
position()
Returns the (x,y) coordinates for the current mark. |
abstract void |
setIteratorPosition(int index)
Moves the iterator the specified mark. |
boolean |
visible()
Returns true if the current mark should be painted.
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MarkIterator()
MarkIterator
is initially positioned
before the first mark. A call to next()
must be done before the first mark
can be read.
Method Detail |
public abstract int getIteratorPosition()
MarkIterator
will
returns -1, since new iterators are initially positioned before the first mark.
public abstract void setIteratorPosition(int index) throws java.lang.IllegalArgumentException
setIteratorPosition(0)
moves
the iterator on the first mark. A call to setIteratorPosition(-1)
moves the
iterator to the front of this MarkIterator
object, just before the first mark
(i.e. in the same position as when this MarkIterator
object was just created).
index
- The new position (0 for the first mark, 1 for the second one, etc.).
java.lang.IllegalArgumentException
- if index
is smaller than -1 or greater
than the last position allowed.public abstract boolean next()
MarkIterator
is initially positioned
before the first mark; the first call to the method next()
makes the first
mark the current mark; the second call makes the second mark the current mark, and so on.
This method is usually invoked in a while
loop as below:
MarkIterator it = layer.getMarkIterator(); while (it.next()) { // Query current mark properties here... }
true
if the new current mark is valid;
false
if there are no more marks.public boolean visible()
true
if the current mark should be painted.
The default implementation returns always true
.
public abstract java.awt.geom.Point2D position() throws org.opengis.referencing.operation.TransformException
null
if the
current mark location is unknow.
org.opengis.referencing.operation.TransformException
- if a transform was required and failed.geographicArea()
public double amplitude()
public double direction()
public java.awt.Shape markShape()
RenderedMarks.paint(RenderingContext)
will automatically takes care of
rotation, translation and scale in order to adjust this model to each mark properties.
The default implementation returns a circle centred at (0,0) with a diameter of 10 dots.
public java.awt.image.RenderedImage markIcon()
null
if none.
The default implementation returns always null
.
public java.awt.Shape geographicArea()
null
if none.
This area must be expressed according the layer's coordinate system. Usually (but not mandatory), this area will contains the point
returned by position()
. A typical use of this method is for painting the land which
belong to a building (the mark). The default implementation returns always null
,
which means that this layer paint marks without geographic area.
public java.awt.Font font()
public java.lang.String label()
null
if none.
The default implementation returns always null
.
public LegendPosition labelPosition()
LegendPosition.CENTER
.
public java.awt.Paint markPaint()
protected void paint(java.awt.Graphics2D graphics, java.awt.Shape geographicArea, java.awt.Shape markShape, java.awt.image.RenderedImage markIcon, java.awt.geom.AffineTransform iconXY, java.awt.font.GlyphVector label, java.awt.geom.Point2D.Float labelXY)
RenderedMarks.paint(RenderingContext)
at rendering time. Subclasses can override
this method in order to gets finer control on the rendering process of marks (e.g. colors,
stroke, painting order, etc.). The default implementation use the following pseudo-code:
if (geographicArea != null) { graphics.setColor(some default color); graphics.draw(geographicArea); } if (markIcon != null) { graphics.drawRenderedImage(markIcon, iconXY); } if (markShape != null) { graphics.setPaint(markPaint()); graphics.fill(markShape); } if (label != null) { graphics.setColor(some default color); graphics.drawGlyphVector(label, labelXY.x, labelXY.y); }
graphics
- The graphics where painting while occurs. The affine transform is set to
the Java2D default, also know as the text coordinate system in this library.geographicArea
- The geographic area which belong to the mark, or null
if
none. This shape is already transformed in the Java2D coordinate system.markShape
- The shape for the mark, or null
if none. This shape is already
transformed in the Java2D coordinate system.markIcon
- The icon for the mark, or null
if none.iconXY
- The affine transform to apply on markIcon
. May be
null
if markIcon
was null
.label
- The label to draw, or null
if none.labelXY
- The label position. May be null
if label
was
null
.protected java.lang.String getToolTipText(GeoMouseEvent event)
null
if none.
The default implementation returns always null
.
Note: This method is not a commited part of the API.
It may moves elsewhere in a future version.
event
- The mouse event.
null
if none.protected javax.swing.Action getAction(GeoMouseEvent event)
null
if none.
This method may be call for example on mouse click. The action doesn't need
to be executed immediately. For example it may be put in a tool bar, or saved
in a macro recorder. The default implementation returns always null
.
Note: This method is not a commited part of the API.
It may moves elsewhere in a future version.
event
- The mouse event.
null
if none.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |