|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.renderer.j2d.RenderingContext
org.geotools.display.canvas.RenderingContext
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.
Informations relatives to a rendering in progress. A RenderingContext
object is
automatically created by Renderer.paint(java.awt.Graphics2D, java.awt.geom.AffineTransform, java.awt.Rectangle)
at rendering time. Then the renderer iterates
over layers and invokes RenderedLayer.paint(org.geotools.renderer.j2d.RenderingContext)
for each of them. The rendering context
is disposed once the rendering is completed. RenderingContext
contains the
following informations:
Graphics2D
handler to use for rendering.RenderedLayer
while they are painting.
Renderer.paint(java.awt.Graphics2D, java.awt.geom.AffineTransform, java.awt.Rectangle)
,
RenderedLayer.paint(org.geotools.renderer.j2d.RenderingContext)
Field Summary | |
CoordinateSystem |
deviceCS
Deprecated. Renamed as org.geotools.display.canvas.RenderingContext#deviceCRS . |
CoordinateSystem |
mapCS
Deprecated. Renamed as org.geotools.display.canvas.RenderingContext#objectiveCRS . |
CoordinateSystem |
textCS
Deprecated. Renamed as org.geotools.display.canvas.RenderingContext#displayCRS . |
Method Summary | |
void |
addPaintedArea(java.awt.Shape area)
Deprecated. Declares that an area in graphics coordinates has been painted.
|
void |
addPaintedArea(java.awt.Shape area,
CoordinateSystem cs)
Deprecated. Declares that an area has been painted. |
java.awt.geom.AffineTransform |
getAffineTransform(CoordinateSystem sourceCS,
CoordinateSystem targetCS)
Deprecated. Returns an affine transform between two coordinate systems. |
java.awt.Graphics2D |
getGraphics()
Deprecated. Returns the graphics where painting occurs. |
MathTransform |
getMathTransform(CoordinateSystem sourceCS,
CoordinateSystem targetCS)
Deprecated. Returns a transform between two coordinate systems. |
java.awt.Shape |
getPaintingArea(CoordinateSystem cs)
Deprecated. Returns the painting area in the specified coordinate system. |
float |
getScale()
Deprecated. Returns the scale factor, or Float.NaN if the scale is unknow.
|
boolean |
isPrinting()
Deprecated. Returns true if the map is printed instead of painted on screen.
|
void |
setCoordinateSystem(CoordinateSystem cs)
Deprecated. Renamed as org.geotools.display.canvas.RenderingContext#setGraphicsCRS . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public final CoordinateSystem mapCS
org.geotools.display.canvas.RenderingContext#objectiveCRS
.
RenderedLayer
s will be
projected in this coordinate system before to be rendered. Units are usually "real
world" metres.
Renderer
and do not
change anymore, except if the user want to change the projection see on screen.
textCS
,
setCoordinateSystem(org.geotools.cs.CoordinateSystem)
public final CoordinateSystem textCS
org.geotools.display.canvas.RenderingContext#displayCRS
.
mapCS
,
deviceCS
,
setCoordinateSystem(org.geotools.cs.CoordinateSystem)
public final CoordinateSystem deviceCS
org.geotools.display.canvas.RenderingContext#deviceCRS
.
textCS
,
except if only a clipped area of the widget is in process of being rendered. When
rendering on printer or some other devices, it depends of the device's resolution.
This coordinate system is rarely used.
textCS
,
setCoordinateSystem(org.geotools.cs.CoordinateSystem)
Method Detail |
public final java.awt.Graphics2D getGraphics()
mapCS
coordinate system. The affine transform can be changed in
a convenient way with setCoordinateSystem(org.geotools.cs.CoordinateSystem)
.
public java.awt.Shape getPaintingArea(CoordinateSystem cs) throws org.opengis.referencing.operation.TransformException
textCS
, then this method will usually returns the widget's
bounds (Component.getBounds()
).
cs
- The coordinate system.
org.opengis.referencing.operation.TransformException
public void setCoordinateSystem(CoordinateSystem cs) throws org.opengis.referencing.operation.TransformException
org.geotools.display.canvas.RenderingContext#setGraphicsCRS
.
Graphics2D
. Invoking this
method do not alter the current renderer's
coordinate system. It is only a convenient way to set the
Graphics2D
's affine transform, for
example in order to alternate rendering mode between geographic features and texts.
The specified coordinate system (argument cs
) should be one of mapCS
,
textCS
or deviceCS
fields. Other coordinate systems may work, but most
of them will thrown an exception.
cs
- The graphics
coordinate system.
Should be mapCS
, textCS
or deviceCS
.
org.opengis.referencing.operation.TransformException
- if this method failed to find an affine transform from the
specified coordinate system to the device coordinate system (deviceCS
).getGraphics()
,
getAffineTransform(org.geotools.cs.CoordinateSystem, org.geotools.cs.CoordinateSystem)
,
Graphics2D.setTransform(java.awt.geom.AffineTransform)
public java.awt.geom.AffineTransform getAffineTransform(CoordinateSystem sourceCS, CoordinateSystem targetCS) throws CannotCreateTransformException
AffineTransform
.
return (AffineTransform)getMathTransform
(sourceCS, targetCS);
sourceCS
- The source coordinate system.targetCS
- The target coordinate system.
sourceCS
to targetCS
.
CannotCreateTransformException
- if the transform can't be created or is not affine.getMathTransform(org.geotools.cs.CoordinateSystem, org.geotools.cs.CoordinateSystem)
,
Renderer.getRenderingHint(java.awt.RenderingHints.Key)
,
Hints.COORDINATE_TRANSFORMATION_FACTORY
public MathTransform getMathTransform(CoordinateSystem sourceCS, CoordinateSystem targetCS) throws CannotCreateTransformException
Hints.COORDINATE_TRANSFORMATION_FACTORY
has been provided to the Renderer
,
then the specified CoordinateTransformationFactory
will be used. The arguments
are usually (but not necessarily) one of the following pairs:
(layerCS
, mapCS
)
:
Arbitrary transform from the data coordinate system (set in RenderedLayer
)
to the rendering coordinate system (set in Renderer
).(mapCS
, textCS
)
:
Affine transform from the rendering coordinate system
in "real world" units (usually metres or degrees) to the Java2D coordinate system
in dots (usually 1/72 of inch). This transform changes every time the zoom (or map
scale) changes.(textCS
, deviceCS
)
:
Affine transform from dots to device units. When
rendering target the screen, this transform is usually the identity transform
(except if the current rendering occurs only in a clipped area of the widget).
When printing, the affine transform is set up in such a way that rendering in
Java2D is isolated from the printer resolution: rendering in textCS
is performed as if printers always have a 72 DPI resolution (except that fractional
coordinates are valid, e.g. a dot of size 0.1×&0.1), and the transform maps
it to whatever the printer resolution is. This transform is zoom insensitive and
constant as long as the target device do not change.
sourceCS
- The source coordinate system.targetCS
- The target coordinate system.
sourceCS
to targetCS
.
CannotCreateTransformException
- if the transformation can't be created.getAffineTransform(org.geotools.cs.CoordinateSystem, org.geotools.cs.CoordinateSystem)
,
Renderer.getRenderingHint(java.awt.RenderingHints.Key)
,
Hints.COORDINATE_TRANSFORMATION_FACTORY
public boolean isPrinting()
true
if the map is printed instead of painted on screen.
When printing, layers like RenderedGridCoverage
should block until all
data are available instead of painting only available data and invokes
RenderedLayer.repaint()
later.
isPrinting
in interface RenderingContext
public void addPaintedArea(java.awt.Shape area)
graphics
coordinates has been painted.
The coordinate system for area
should be the same than the one just used for
painting in the graphics
handler, which depends of the affine transform currently set. This method is equivalents to
addPaintedArea
(area, null)
.
area
- A bounding shape of the area just painted. This shape may be approximative,
as long as it completely encloses the painted area. Simple shape with fast
contains(...)
and intersects(...)
methods are
encouraged. The coordinate system is infered from the current
graphics
state.Graphics2D.getTransform()
,
addPaintedArea(Shape, CoordinateSystem)
public float getScale()
Float.NaN
if the scale is unknow.
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.
getScale
in interface RenderingContext
Float.NaN
.Renderer.getScale()
public void addPaintedArea(java.awt.Shape area, CoordinateSystem cs) throws org.opengis.referencing.operation.TransformException
RenderedLayer.paint(org.geotools.renderer.j2d.RenderingContext)
at rendering time. The Renderer
uses
this information in order to determine which layers need to be repainted
when a screen area is damaged. If addPaintedArea(...)
methods
are never invoked from a particular RenderedLayer
, then the renderer
will assume that the painted area is unknow and conservatively repaint the full
layer during subsequent rendering.
area
- A bounding shape of the area just painted, in cs
coordinate
system. This shape may be approximative, as long as it completely encloses the
painted area. Simple shape with fast contains(...)
and
intersects(...)
methods are encouraged.cs
- The coordinate system for area
, or null
to infer it from the current graphics
state.
org.opengis.referencing.operation.TransformException
- if area
coordinates can't be transformed.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |