|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.renderer.j2d.RenderedLayer
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.
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);
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 |
protected final java.beans.PropertyChangeSupport listeners
"coordinateSystem"
,
"preferredArea"
,
"preferredPixelSize"
,
"zOrder"
and
"visible"
.
Constructor Detail |
public RenderedLayer()
setXXX
methods in
order to define properly this layer's properties.
setCoordinateSystem(org.geotools.cs.CoordinateSystem)
,
setPreferredArea(java.awt.geom.Rectangle2D)
,
setPreferredPixelSize(java.awt.geom.Dimension2D)
,
setZOrder(float)
public RenderedLayer(CoordinateSystem cs)
setXXX
methods in order to define properly this layer's properties.
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
.
java.lang.IllegalArgumentException
- if cs
is nul.setCoordinateSystem(org.geotools.cs.CoordinateSystem)
,
setPreferredArea(java.awt.geom.Rectangle2D)
,
setPreferredPixelSize(java.awt.geom.Dimension2D)
,
setZOrder(float)
Method Detail |
public java.lang.String getName(java.util.Locale locale)
org.geotools.display.canvas.GraphicPrimitive2D#getName
.
locale
- The desired locale, or null
for a default locale.
getLocale()
,
Renderer.getName(java.util.Locale)
public java.util.Locale getLocale()
org.geotools.display.canvas.GraphicPrimitive2D#getLocale
.
Renderer
, if it has one. Otherwise, a default locale is returned.
Renderer.getLocale()
,
Component.getLocale()
public Renderer getRenderer() throws java.lang.IllegalStateException
org.geotools.display.canvas.GraphicPrimitive2D#getCanvas
.
null
).
java.lang.IllegalStateException
- if this layer has not been added to any renderer.public final CoordinateSystem getCoordinateSystem()
org.geotools.display.canvas.GraphicPrimitive2D#getObjectiveCRS
.
getPreferredArea()
and getPreferredPixelSize()
.
setCoordinateSystem(org.geotools.cs.CoordinateSystem)
,
getPreferredArea()
,
getPreferredPixelSize()
,
RenderingContext.mapCS
protected void setCoordinateSystem(CoordinateSystem cs) throws org.opengis.referencing.operation.TransformException
org.geotools.display.canvas.GraphicPrimitive2D#setObjectiveCRS
.
RenderedLayer
's constructor.Renderer
.Renderer.setCoordinateSystem(org.geotools.cs.CoordinateSystem)
has been invoked.
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
.
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.public java.awt.geom.Rectangle2D getPreferredArea()
org.geotools.display.canvas.GraphicPrimitive2D#getEnvelope
.
null
if unknow or not applicable.getPreferredPixelSize()
,
getCoordinateSystem()
public void setPreferredArea(java.awt.geom.Rectangle2D area)
org.geotools.display.canvas.GraphicPrimitive2D#setEnvelope
.
getPreferredArea()
,
setPreferredPixelSize(java.awt.geom.Dimension2D)
,
getCoordinateSystem()
public java.awt.geom.Dimension2D getPreferredPixelSize()
org.geotools.display.canvas.GraphicPrimitive2D#getTypicalCellDimension
.
null
if none.getPreferredArea()
,
getCoordinateSystem()
public void setPreferredPixelSize(java.awt.geom.Dimension2D size)
org.geotools.display.canvas.GraphicPrimitive2D#setTypicalCellDimension
.
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.
size
- The preferred pixel size, or null
if there is none.getPreferredPixelSize()
,
setPreferredArea(java.awt.geom.Rectangle2D)
,
getCoordinateSystem()
public float getZOrder()
org.geotools.display.canvas.GraphicPrimitive2D#getZOrderHint
.
Float.POSITIVE_INFINITY
.
setZOrder(float)
public void setZOrder(float zOrder) throws java.lang.IllegalArgumentException
org.geotools.display.canvas.GraphicPrimitive2D#setZOrderHint
.
getZOrder()
.
java.lang.IllegalArgumentException
- if the specified zOrder
is Float.NaN
.public boolean isVisible()
org.geotools.display.canvas.GraphicPrimitive2D#getVisible
.
true
if the layer is visible, false
otherwise.public void setVisible(boolean visible)
org.geotools.display.canvas.GraphicPrimitive2D#setVisible
.
Renderer
:
Renderer.addLayer
(this)
appelera setVisible(true)
.Renderer.removeLayer
(this)
appelera setVisible(false)
.
public void repaint()
org.geotools.display.canvas.GraphicPrimitive2D#refresh()
.
repaint()
method can be invoked from any thread; it doesn't need to be
the Swing thread.
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.
public void repaint(java.awt.geom.Rectangle2D bounds)
org.geotools.display.canvas.GraphicPrimitive2D#refresh(Rectangle2D)
.
repaint(...)
method can be invoked from any thread; it doesn't need to
be the Swing thread.
bounds
- The dirty region to repaint, in the "real world"
rendering coordinate system. A
null
value repaint everything.protected abstract void paint(RenderingContext context) throws org.opengis.referencing.operation.TransformException
org.geotools.display.canvas.GraphicPrimitive2D#paint
.
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:
context.
getMathTransform
(underlyingCS,
context.mapCS
)
Returns a transform from the underlying CS to the rendering CS.
context.
getMathTransform
(
context.mapCS
,
context.textCS
)
Returns a transform from the rendering CS to the Java2D CS in "dots" units
(usually 1/72 of inch). This transformation is zoom dependent.
context.
getMathTransform
(
context.textCS
,
context.deviceCS
)
Returns a transform from the Java2D CS to the device CS. This transformation is
device dependent, but not zoom sensitive. When the output device is the screen,
then this is the identity transform (except if the rendering occurs in a clipped
area of the widget).
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:
During the rendering process, implementations are encouraged to declare a (potentially approximative) bounding shape of their painted area with calls toShape 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 }
RenderingContext.addPaintedArea(Shape)
. This is an optional operation: providing
those hints only help Renderer
to speed up future rendering and events processing.
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.
org.opengis.referencing.operation.TransformException
- If a coordinate transformation failed during the rendering
process.protected void prefetch(RenderingContext context)
org.geotools.display.canvas.GraphicPrimitive2D#prefetch
.
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.PlanarImage.prefetchTiles(java.awt.Point[])
protected java.lang.String getToolTipText(GeoMouseEvent event)
org.geotools.display.canvas.GraphicPrimitive2D#getToolTipText
.
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.
event
- Coordonn?es du curseur de la souris.
Renderer.getToolTipText(org.geotools.renderer.j2d.GeoMouseEvent)
protected javax.swing.Action getAction(GeoMouseEvent event)
org.geotools.display.canvas.GraphicPrimitive2D#getAction
.
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.
event
- The mouse event.
null
if none.public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
org.geotools.display.canvas.GraphicPrimitive2D#addPropertyChangeListener
.
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.
"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.
listener
- The property change listener to be added.public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
org.geotools.display.canvas.GraphicPrimitive2D#addPropertyChangeListener
.
PropertyChangeListener
for a specific property.
The listener will be invoked only when that specific property changes.
propertyName
- The name of the property to listen on.listener
- The PropertyChangeListener to be added.public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
org.geotools.display.canvas.GraphicPrimitive2D#removePropertyChangeListener
.
PropertyChangeListener
that
was registered for all properties.
listener
- The property change listener to be removedpublic void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
org.geotools.display.canvas.GraphicPrimitive2D#removePropertyChangeListener
.
propertyName
- The name of the property that was listened on.listener
- The PropertyChangeListener to be removed.protected final java.lang.Object getTreeLock()
org.geotools.display.canvas.GraphicPrimitive2D#getTreeLock
.
public void dispose()
org.geotools.display.canvas.GraphicPrimitive2D#dispose
.
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).
Renderer.dispose()
,
PlanarImage.dispose()
public java.lang.String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |