org.geotools.renderer
Interface GTRenderer

All Known Implementing Classes:
StreamingRenderer

public interface GTRenderer

GeoTools renderer for rendering spatial content into a Graphics2D. Typical usage:

          Rectangle paintArea = new Rectangle(width, height);
          ReferencedEnvelope mapArea = map.getBounds();

          renderer = new StreamingRenderer();
          renderer.setContext(map);

          RenderingHints hints = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
          renderer.setJava2DHints(hints);

          Map rendererParams = new HashMap();
          rendererParams.put("optimizedDataLoadingEnabled",new Boolean(true) );
          
          renderer.setRendererHints( renderParams );
          
          renderer.paint(graphic, paintArea, mapArea);

Author:
David Blasby, Simone Giannecchini

Method Summary
 void addRenderListener(RenderListener listener)
          adds a listener that responds to error events of feature rendered events.
 MapContext getContext()
          Deprecated. The MapContext class is being phased out. Please use getMapContent().
 RenderingHints getJava2DHints()
          Hints used to configure Java2D Graphics prior to rendering.
 MapContent getMapContent()
          Gets the MapContent instance which contains the data being rendered.
 Map<Object,Object> getRendererHints()
          Hints used to configure rendering process
 void paint(Graphics2D graphics, Rectangle paintArea, AffineTransform worldToScreen)
          Renders features based on the map layers and their styles as specified in the map content using setContext.
 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.
 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.
 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.
 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.
 void removeRenderListener(RenderListener listener)
          Removes a render listener.
 void setContext(MapContext context)
          Deprecated. The MapContext class is being phased out. Please use setMapContent(org.geotools.map.MapContent).
 void setJava2DHints(RenderingHints hints)
          Hints used to configure Java2D Graphics prior to rendering.
 void setMapContent(MapContent mapContent)
          Sets the MapContent which contains the data to be rendered.
 void setRendererHints(Map<Object,Object> hints)
          Hints used to configure rendering process.
 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.
 

Method Detail

stopRendering

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.


addRenderListener

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

Parameters:
listener - the listener to add.
See Also:
RenderListener

removeRenderListener

void removeRenderListener(RenderListener listener)
Removes a render listener.

Parameters:
listener - the listener to remove.
See Also:
RenderListener

setJava2DHints

void setJava2DHints(RenderingHints hints)
Hints used to configure Java2D Graphics prior to rendering.


getJava2DHints

RenderingHints getJava2DHints()
Hints used to configure Java2D Graphics prior to rendering.

Returns:
Hints

setRendererHints

void setRendererHints(Map<Object,Object> hints)
Hints used to configure rendering process.

Parameters:
hints -

getRendererHints

Map<Object,Object> getRendererHints()
Hints used to configure rendering process

Returns:
Hints used to configure rendering process

setContext

void setContext(MapContext context)
Deprecated. The MapContext class is being phased out. Please use setMapContent(org.geotools.map.MapContent).

Map content to render.

Parameters:
context -

setMapContent

void setMapContent(MapContent mapContent)
Sets the MapContent which contains the data to be rendered.

Parameters:
mapContent - the map content

getContext

MapContext getContext()
Deprecated. The MapContext class is being phased out. Please use getMapContent().

Map content being rendered.

Returns:
Map content being rendered.

getMapContent

MapContent getMapContent()
Gets the MapContent instance which contains the data being rendered.

Returns:
the MapContent instance

paint

void paint(Graphics2D graphics,
           Rectangle paintArea,
           AffineTransform worldToScreen)
Renders features based on the map layers and their styles as specified in the map content 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.
paintArea - The size of the output area in output units (eg: pixels).
worldToScreen - A transform which converts World coordinates to Screen coordinates.

paint

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.

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.
paintArea - The size of the output area in output units (eg: pixels).
mapArea - the map's visible area (viewport) in map coordinates.

paint

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.

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.
paintArea - The size of the output area in output units (eg: pixels).
mapArea - the map's visible area (viewport) in map coordinates.

paint

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.

This version of the method assumes that paint area, enelope and worldToScreen transform are already computed and in sync. Use this method to avoid recomputation. Note however that no check is performed that they are really synchronized!

Parameters:
graphics - The graphics object to draw to.
paintArea - The size of the output area in output units (eg: pixels).
mapArea - the map's visible area (viewport) in map coordinates.
worldToScreen - A transform which converts World coordinates to Screen coordinates.

paint

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.

This version of the method assumes that paint area, enelope and worldToScreen transform are already computed and in sync. Use this method to avoid recomputation. Note however that no check is performed that they are really synchronized!

Parameters:
graphics - The graphics object to draw to.
paintArea - The size of the output area in output units (eg: pixels).
mapArea - the map's visible area (viewport) in map coordinates.
worldToScreen - A transform which converts World coordinates to Screen coordinates.


Copyright © 1996-2014 Geotools. All Rights Reserved.