org.geotools.renderer.lite
Class StreamingRenderer

java.lang.Object
  extended byorg.geotools.renderer.lite.StreamingRenderer
All Implemented Interfaces:
GTRenderer

public class StreamingRenderer
extends java.lang.Object
implements GTRenderer

A streaming implementation of the GTRenderer interface.

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.

Version:
$Id: StreamingRenderer.java 18455 2006-03-03 17:31:38Z jeichar $
Author:
James Macgill, dblasby, jessie eichar, Andrea Aime

Field Summary
static org.geotools.renderer.lite.StreamingRenderer.DefaultRenderListener DEFAULT_LISTENER
          This listener is added to the list of listeners automatically.
 int defaultImageType
          This is used to control what type of image the system will draw into.
protected  LabelCache labelCache
           
 java.util.HashMap symbolizerAssociationHT
           
 
Constructor Summary
StreamingRenderer()
          Creates a new instance of LiteRenderer without a context.
 
Method Summary
 void addRenderListener(RenderListener listener)
          adds a listener that responds to error events of feature rendered events.
 MapContext getContext()
           
 double getGeneralizationDistance()
          Returns the generalization distance in the screen space.
 java.awt.RenderingHints getJava2DHints()
           
 java.util.Map getRendererHints()
           
 void paint(java.awt.Graphics2D graphics, java.awt.Rectangle paintArea, java.awt.geom.AffineTransform worldToScreen)
          Renders features based on the map layers and their styles as specified in the map context using setContext.
 void paint(java.awt.Graphics2D graphics, java.awt.Rectangle paintArea, com.vividsolutions.jts.geom.Envelope mapArea)
          Renders features based on the map layers and their styles as specified in the map context using setContext.
 void paint(java.awt.Graphics2D graphics, java.awt.Rectangle paintArea, com.vividsolutions.jts.geom.Envelope mapArea, java.awt.geom.AffineTransform worldToScreen)
          Renders features based on the map layers and their styles as specified in the map context using setContext.
 void removeRenderListener(RenderListener listener)
          Removes a render listener.
 void setContext(MapContext context)
           
 void setJava2DHints(java.awt.RenderingHints hints)
           
 void setRendererHints(java.util.Map hints)
           
 void stopRendering()
          If you call this method from another thread than the one that called paint or render the rendering will be forcefully stopped before termination
protected  org.opengis.coverage.SampleDimension transformColormap(int band, org.opengis.coverage.SampleDimension dimension, java.util.Map[] colorMaps)
          Transform the supplied RGB colors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

symbolizerAssociationHT

public java.util.HashMap symbolizerAssociationHT

DEFAULT_LISTENER

public static final org.geotools.renderer.lite.StreamingRenderer.DefaultRenderListener DEFAULT_LISTENER
This listener is added to the list of listeners automatically. It should be removed if the default logging is not needed.


defaultImageType

public int defaultImageType
This is used to control what type of image the system will draw into.


labelCache

protected LabelCache labelCache
Constructor Detail

StreamingRenderer

public StreamingRenderer()
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

Method Detail

addRenderListener

public void addRenderListener(RenderListener listener)
adds a listener that responds to error events of feature rendered events.

Specified by:
addRenderListener in interface GTRenderer
Parameters:
listener - the listener to add.
See Also:
RenderListener

removeRenderListener

public void removeRenderListener(RenderListener listener)
Removes a render listener.

Specified by:
removeRenderListener in interface GTRenderer
Parameters:
listener - the listener to remove.
See Also:
RenderListener

stopRendering

public void stopRendering()
If you call this method from another thread than the one that called paint or render the rendering will be forcefully stopped before termination

Specified by:
stopRendering in interface GTRenderer

paint

public void paint(java.awt.Graphics2D graphics,
                  java.awt.Rectangle paintArea,
                  java.awt.geom.AffineTransform worldToScreen)
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.

Specified by:
paint in interface GTRenderer
Parameters:
graphics - The graphics object to draw to.
paintArea - The size of the output area in output units (eg: pixels).
worldToScreen - A transform which converts World coordinates to Screen coordinates.
Task:
Need to check if the Layer CoordinateSystem is different to the BoundingBox rendering CoordinateSystem and if so, then transform the coordinates.

paint

public void paint(java.awt.Graphics2D graphics,
                  java.awt.Rectangle paintArea,
                  com.vividsolutions.jts.geom.Envelope mapArea)
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.

Specified by:
paint in interface GTRenderer
Parameters:
graphics - The graphics object to draw to.
paintArea - The size of the output area in output units (eg: pixels).

paint

public void paint(java.awt.Graphics2D graphics,
                  java.awt.Rectangle paintArea,
                  com.vividsolutions.jts.geom.Envelope mapArea,
                  java.awt.geom.AffineTransform worldToScreen)
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!

Specified by:
paint in interface GTRenderer
Parameters:
graphics - The graphics object to draw to.
paintArea - The size of the output area in output units (eg: pixels).
worldToScreen - A transform which converts World coordinates to Screen coordinates.

transformColormap

protected org.opengis.coverage.SampleDimension transformColormap(int band,
                                                                 org.opengis.coverage.SampleDimension dimension,
                                                                 java.util.Map[] colorMaps)
Transform the supplied RGB colors.


getGeneralizationDistance

public double getGeneralizationDistance()
Returns the generalization distance in the screen space.

Returns:

setJava2DHints

public void setJava2DHints(java.awt.RenderingHints hints)
Specified by:
setJava2DHints in interface GTRenderer

getJava2DHints

public java.awt.RenderingHints getJava2DHints()
Specified by:
getJava2DHints in interface GTRenderer

setRendererHints

public void setRendererHints(java.util.Map hints)
Specified by:
setRendererHints in interface GTRenderer

getRendererHints

public java.util.Map getRendererHints()
Specified by:
getRendererHints in interface GTRenderer

setContext

public void setContext(MapContext context)
Specified by:
setContext in interface GTRenderer

getContext

public MapContext getContext()
Specified by:
getContext in interface GTRenderer


Copyright © GeoTools. All Rights Reserved.