| java.lang.Object org.geotools.renderer.lite.StreamingRenderer
StreamingRenderer | final public class StreamingRenderer implements GTRenderer(Code) | | A streaming implementation of the GTRenderer interface.
- The code is relatively simple to understand, so it can be used as a
simple example of an SLD compliant rendering code
- Uses as little memory as possible
Use this class if you need a stateless renderer that provides low memory
footprint and decent rendering performance on the first call but don't need
good optimal performance on subsequent calls on the same data. Notice: for
the time being, this class doesn't support GridCoverage stylers, that will be
rendered using the non geophisics version of the GridCoverage, if available,
with the geophisics one, otherwise.
At the moment the streaming renderer is not thread safe
author: James Macgill author: dblasby author: jessie eichar author: Simone Giannecchini author: Andrea Aime author: Alessio Fabiani version: $Id: StreamingRenderer.java 29443 2008-02-25 10:04:01Z jgarnett $ |
Constructor Summary | |
public | StreamingRenderer() Creates a new instance of LiteRenderer without a context. |
Method Summary | |
public void | addRenderListener(RenderListener listener) adds a listener that responds to error events of feature rendered events. | public boolean | getConcatTransforms() Flag which controls behaviour for applying affine transformation to the
graphics object.
a boolean flag. | public MapContext | getContext() | public double | getGeneralizationDistance() Returns the generalization distance in the screen space. | public RenderingHints | getJava2DHints() | public static MathTransform | getMathTransform(CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem destCRS) | public Map | getRendererHints() | public boolean | isCanTransform() | public boolean | isInteractive() Getter for property interactive. | public void | paint(Graphics2D graphics, Rectangle paintArea, AffineTransform worldToScreen) Renders features based on the map layers and their styles as specified in
the map context using setContext . | public void | paint(Graphics2D graphics, Rectangle paintArea, Envelope mapArea) Renders features based on the map layers and their styles as specified in
the map context using setContext . | public void | paint(Graphics2D graphics, Rectangle paintArea, ReferencedEnvelope mapArea) Renders features based on the map layers and their styles as specified in
the map context using setContext . | public void | paint(Graphics2D graphics, Rectangle paintArea, Envelope mapArea, AffineTransform worldToScreen) Renders features based on the map layers and their styles as specified in
the map context using setContext . | public void | paint(Graphics2D graphics, Rectangle paintArea, ReferencedEnvelope mapArea, AffineTransform worldToScreen) Renders features based on the map layers and their styles as specified in
the map context using setContext . | Collection | queryLayer(MapLayer currLayer, CollectionSource source) Queries a given layer's Source instance to be rendered. | FeatureCollection | queryLayer(MapLayer currLayer, FeatureSource source, FeatureType schema, LiteFeatureTypeStyle[] styles, Envelope mapArea, CoordinateReferenceSystem mapCRS, CoordinateReferenceSystem featCrs, Rectangle screenSize, GeometryAttributeType geometryAttribute, AffineTransform worldToScreenTransform) Queries a given layer's features to be rendered based on the target
rendering bounding box.
If optimizedDataLoadingEnabled attribute has been set to
true , the following optimization will be performed in
order to limit the number of features returned:
- Just the features whose geometric attributes lies within
envelope will be queried
- The queried attributes will be limited to just those needed to
perform the rendering, based on the requiered geometric and non geometric
attributes found in the Layer's style rules
- If a
Query has been set to limit the resulting
layer's features, the final filter to obtain them will respect it. | public void | removeRenderListener(RenderListener listener) Removes a render listener. | public void | setConcatTransforms(boolean flag) Sets the flag which controls behaviour for applying affine transformation
to the graphics object.
Parameters: flag - If true then the transform will be concatenated to theexisting transform. | public void | setContext(MapContext context) | public void | setGeneralizationDistance(double d)
Sets the generalizazion distance in the screen space. | public void | setInteractive(boolean interactive) Sets the interactive status of the renderer. | public void | setJava2DHints(RenderingHints hints) | public void | setRendererHints(Map hints) | public void | stopRendering() |
DECLARED_SCALE_DENOM_KEY | final public static String DECLARED_SCALE_DENOM_KEY(Code) | | |
LABEL_CACHE_KEY | final public static String LABEL_CACHE_KEY(Code) | | |
MEMORY_PRE_LOADING_KEY | final public static String MEMORY_PRE_LOADING_KEY(Code) | | |
OPTIMIZED_DATA_LOADING_KEY | final public static String OPTIMIZED_DATA_LOADING_KEY(Code) | | |
SCALE_ACCURATE | final public static String SCALE_ACCURATE(Code) | | Computes the scale as the ratio between map distances and real world distances,
assuming 90dpi and taking into consideration projection deformations and actual
earth shape.
Use this method only when in need of accurate computation. Will break if the
data extent is outside of the currenct projection definition area.
|
SCALE_COMPUTATION_METHOD_KEY | final public static String SCALE_COMPUTATION_METHOD_KEY(Code) | | |
SCALE_OGC | final public static String SCALE_OGC(Code) | | Very simple and lenient scale computation method that conforms to the OGC SLD
specification 1.0, page 26. This method is quite approximative, but should
never break and ensure constant scale even on lat/lon unprojected maps (because
in that case scale is computed as if the area was along the equator no matter
what the real position is).
|
TEXT_RENDERING_KEY | final public static String TEXT_RENDERING_KEY(Code) | | The text rendering method, either TEXT_RENDERING_OUTLINE or TEXT_RENDERING_STRING
|
TEXT_RENDERING_OUTLINE | final public static String TEXT_RENDERING_OUTLINE(Code) | | Text will be rendered using the associated
GlyphVector outline, that is, a
Shape .
This ensures perfect centering between the text and the halo, but introduces more text aliasing.
|
TEXT_RENDERING_STRING | final public static String TEXT_RENDERING_STRING(Code) | | Text will be rendered using the usual calls gc.drawString/drawGlyphVector.
This is a little faster, and more consistent with how the platform renders
the text in other applications. The downside is that on most platform the label
and its eventual halo are not properly centered.
|
StreamingRenderer | public StreamingRenderer()(Code) | | Creates a new instance of LiteRenderer without a context. Use it only to
gain access to utility methods of this class or if you want to render
random feature collections instead of using the map context interface
|
addRenderListener | public void addRenderListener(RenderListener listener)(Code) | | adds a listener that responds to error events of feature rendered events.
See Also: RenderListener Parameters: listener - the listener to add. |
getConcatTransforms | public boolean getConcatTransforms()(Code) | | Flag which controls behaviour for applying affine transformation to the
graphics object.
a boolean flag. If true then the transform will be concatenatedto the existing transform. If false it will be replaced. |
getGeneralizationDistance | public double getGeneralizationDistance()(Code) | | Returns the generalization distance in the screen space.
|
getMathTransform | public static MathTransform getMathTransform(CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem destCRS)(Code) | | |
getRendererHints | public Map getRendererHints()(Code) | | |
isCanTransform | public boolean isCanTransform()(Code) | | |
isInteractive | public boolean isInteractive()(Code) | | Getter for property interactive.
Value of property interactive. |
paint | public void paint(Graphics2D graphics, Rectangle paintArea, AffineTransform worldToScreen)(Code) | | Renders features based on the map layers and their styles as specified in
the map context using setContext . This version of
the method assumes that the size of the output area and the
transformation from coordinates to pixels are known. The latter
determines the map scale. The viewport (the visible part of the map) will
be calculated internally.
Parameters: graphics - The graphics object to draw to. Parameters: paintArea - The size of the output area in output units (eg: pixels). Parameters: worldToScreen - A transform which converts World coordinates to Screencoordinates. |
paint | public void paint(Graphics2D graphics, Rectangle paintArea, Envelope mapArea)(Code) | | Renders features based on the map layers and their styles as specified in
the map context using setContext . This version of
the method assumes that the area of the visible part of the map and the
size of the output area are known. The transform between the two is
calculated internally.
Parameters: graphics - The graphics object to draw to. Parameters: paintArea - The size of the output area in output units (eg: pixels). Parameters: mapArea - the map's visible area (viewport) in map coordinates. |
paint | public void paint(Graphics2D graphics, Rectangle paintArea, ReferencedEnvelope mapArea)(Code) | | Renders features based on the map layers and their styles as specified in
the map context using setContext . This version of
the method assumes that the area of the visible part of the map and the
size of the output area are known. The transform between the two is
calculated internally.
Parameters: graphics - The graphics object to draw to. Parameters: paintArea - The size of the output area in output units (eg: pixels). Parameters: mapArea - the map's visible area (viewport) in map coordinates. |
paint | public void paint(Graphics2D graphics, Rectangle paintArea, Envelope mapArea, AffineTransform worldToScreen)(Code) | | Renders features based on the map layers and their styles as specified in
the map context using setContext . This version of
the method assumes that paint area, enelope and worldToScreen transform
are already computed. Use this method to avoid recomputation. Note
however that no check is performed that they are really in sync!
Parameters: graphics - The graphics object to draw to. Parameters: paintArea - The size of the output area in output units (eg: pixels). Parameters: mapArea - the map's visible area (viewport) in map coordinates. Parameters: worldToScreen - A transform which converts World coordinates to Screencoordinates. |
paint | public void paint(Graphics2D graphics, Rectangle paintArea, ReferencedEnvelope mapArea, AffineTransform worldToScreen)(Code) | | Renders features based on the map layers and their styles as specified in
the map context using setContext . This version of
the method assumes that paint area, enelope and worldToScreen transform
are already computed. Use this method to avoid recomputation. Note
however that no check is performed that they are really in sync!
Parameters: graphics - The graphics object to draw to. Parameters: paintArea - The size of the output area in output units (eg: pixels). Parameters: mapArea - the map's visible area (viewport) in map coordinates. Itsassociate CRS is ALWAYS 2D Parameters: worldToScreen - A transform which converts World coordinates to Screencoordinates. |
queryLayer | Collection queryLayer(MapLayer currLayer, CollectionSource source)(Code) | | Queries a given layer's Source instance to be rendered.
Note: This is proof-of-concept quality only! At
the moment the query is not filtered, that means all objects with all
fields are read from the datastore for every call to this method. This
method should work like
StreamingRenderer.queryLayer(MapLayer,FeatureSource,FeatureType,LiteFeatureTypeStyle[],Envelope,CoordinateReferenceSystem,CoordinateReferenceSystem,Rectangle,GeometryAttributeType)
and eventually replace it.
Parameters: currLayer - The actually processed layer for rendering Parameters: source - Source to read data from |
queryLayer | FeatureCollection queryLayer(MapLayer currLayer, FeatureSource source, FeatureType schema, LiteFeatureTypeStyle[] styles, Envelope mapArea, CoordinateReferenceSystem mapCRS, CoordinateReferenceSystem featCrs, Rectangle screenSize, GeometryAttributeType geometryAttribute, AffineTransform worldToScreenTransform) throws IllegalFilterException, IOException, IllegalAttributeException(Code) | | Queries a given layer's features to be rendered based on the target
rendering bounding box.
If optimizedDataLoadingEnabled attribute has been set to
true , the following optimization will be performed in
order to limit the number of features returned:
- Just the features whose geometric attributes lies within
envelope will be queried
- The queried attributes will be limited to just those needed to
perform the rendering, based on the requiered geometric and non geometric
attributes found in the Layer's style rules
- If a
Query has been set to limit the resulting
layer's features, the final filter to obtain them will respect it. This
means that the bounding box filter and the Query filter will be combined,
also including maxFeatures from Query
- At least that the layer's definition query explicitly says to
retrieve some attribute, no attributes will be requested from it, for
performance reassons. So it is desirable to not use a Query for filtering
a layer wich includes attributes. Note that including the attributes in
the result is not necessary for the query's filter to get properly
processed.
NOTE : This is an internal method and should only be called by
paint(Graphics2D, Rectangle, AffineTransform) . It is
package protected just to allow unit testing it.
Parameters: currLayer - the actually processing layer for renderition Parameters: schema - Parameters: source - Parameters: envelope - the spatial extent wich is the target area fo the renderingprocess Parameters: destinationCrs - DOCUMENT ME! Parameters: sourceCrs - Parameters: screenSize - Parameters: geometryAttribute - the set of features resulting from currLayer afterquering its feature source throws: IllegalFilterException - if something goes wrong constructing the bbox filter throws: IOException - throws: IllegalAttributeException - See Also: MapLayer.setQuery(org.geotools.data.Query) |
removeRenderListener | public void removeRenderListener(RenderListener listener)(Code) | | Removes a render listener.
See Also: RenderListener Parameters: listener - the listener to remove. |
setConcatTransforms | public void setConcatTransforms(boolean flag)(Code) | | Sets the flag which controls behaviour for applying affine transformation
to the graphics object.
Parameters: flag - If true then the transform will be concatenated to theexisting transform. If false it will be replaced. |
setGeneralizationDistance | public void setGeneralizationDistance(double d)(Code) | |
Sets the generalizazion distance in the screen space.
Default value is 1, meaning that two subsequent points are collapsed to
one if their on screen distance is less than one pixel
Set the distance to 0 if you don't want any kind of generalization
Parameters: d - |
setInteractive | public void setInteractive(boolean interactive)(Code) | | Sets the interactive status of the renderer. An interactive renderer
won't wait for long image loading, preferring an alternative mark instead
Parameters: interactive - new value for the interactive property |
setRendererHints | public void setRendererHints(Map hints)(Code) | | |
stopRendering | public void stopRendering()(Code) | | If you call this method from another thread than the one that called
paint or render the rendering will be
forcefully stopped before termination
|
|
|