org.geotools.renderer.shape
Class ShapefileRenderer

Object
  extended by ShapefileRenderer
All Implemented Interfaces:
GTRenderer

public class ShapefileRenderer
extends Object
implements GTRenderer

A LiteRenderer Implementations that is optimized for shapefiles.

Since:
2.1.x
Author:
jeichar
Module:

Field Summary
static String DECLARED_SCALE_DENOM_KEY
           
static ShapefileRenderer.DefaultRenderListener DEFAULT_LISTENER
          This listener is added to the list of listeners automatically.
static String DPI_KEY
           
static String FORCE_CRS_KEY
           
static String LABEL_CACHE_KEY
           
static Logger LOGGER
           
static String MEMORY_PRE_LOADING_KEY
           
static String OPTIMIZED_DATA_LOADING_KEY
           
static String SCALE_ACCURATE
          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.
static String SCALE_COMPUTATION_METHOD_KEY
           
static String SCALE_OGC
          Very simple and lenient scale computation method that conforms to the OGC SLD specification 1.0, page 26.
static String TEXT_RENDERING_KEY
          The text rendering method, either TEXT_RENDERING_OUTLINE or TEXT_RENDERING_STRING
static String TEXT_RENDERING_OUTLINE
          Text will be rendered using the associated GlyphVector outline, that is, a Shape.
static String TEXT_RENDERING_STRING
          Text will be rendered using the usual calls gc.drawString/drawGlyphVector.
 
Constructor Summary
ShapefileRenderer()
           
ShapefileRenderer(MapContext context)
           
 
Method Summary
 void addRenderListener(RenderListener listener)
          adds a listener that responds to error events of feature rendered events.
 MapContext getContext()
           
 RenderingHints getJava2DHints()
           
 Map getRendererHints()
           
 boolean isCaching()
          True if we are caching styles.
 boolean isConcatTransforms()
           
 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.
 void paint(Graphics2D graphics, Rectangle paintArea, Envelope mapArea)
          Deprecated.  
 void paint(Graphics2D graphics, Rectangle paintArea, Envelope mapArea, AffineTransform worldToScreen)
          Deprecated.  
 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 envelope, AffineTransform transform)
          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 setCaching(boolean caching)
          Set to true to cache styles.
 void setConcatTransforms(boolean concatTransforms)
           
 void setContext(MapContext context)
           
 void setJava2DHints(RenderingHints hints)
           
 void setRendererHints(Map hints)
           
protected  void setScaleDenominator(double scaleDenominator)
          Setter for property scaleDenominator.
 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
 IndexInfo useIndex(ShapefileDataStore ds)
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

public static final Logger LOGGER

SCALE_ACCURATE

public static final String SCALE_ACCURATE
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.

See Also:
Constant Field Values

SCALE_OGC

public static final String SCALE_OGC
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).

See Also:
Constant Field Values

DEFAULT_LISTENER

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


TEXT_RENDERING_STRING

public static final String TEXT_RENDERING_STRING
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.

See Also:
Constant Field Values

TEXT_RENDERING_OUTLINE

public static final String TEXT_RENDERING_OUTLINE
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.

See Also:
Constant Field Values

TEXT_RENDERING_KEY

public static final String TEXT_RENDERING_KEY
The text rendering method, either TEXT_RENDERING_OUTLINE or TEXT_RENDERING_STRING

See Also:
Constant Field Values

LABEL_CACHE_KEY

public static final String LABEL_CACHE_KEY
See Also:
Constant Field Values

FORCE_CRS_KEY

public static final String FORCE_CRS_KEY
See Also:
Constant Field Values

DPI_KEY

public static final String DPI_KEY
See Also:
Constant Field Values

DECLARED_SCALE_DENOM_KEY

public static final String DECLARED_SCALE_DENOM_KEY
See Also:
Constant Field Values

MEMORY_PRE_LOADING_KEY

public static final String MEMORY_PRE_LOADING_KEY
See Also:
Constant Field Values

OPTIMIZED_DATA_LOADING_KEY

public static final String OPTIMIZED_DATA_LOADING_KEY
See Also:
Constant Field Values

SCALE_COMPUTATION_METHOD_KEY

public static final String SCALE_COMPUTATION_METHOD_KEY
See Also:
Constant Field Values
Constructor Detail

ShapefileRenderer

public ShapefileRenderer(MapContext context)

ShapefileRenderer

public ShapefileRenderer()
Method Detail

paint

public void paint(Graphics2D graphics,
                  Rectangle paintArea,
                  ReferencedEnvelope mapArea)
Description copied from interface: GTRenderer
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).
mapArea - the map's visible area (viewport) in map coordinates.

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

setScaleDenominator

protected void setScaleDenominator(double scaleDenominator)
Setter for property scaleDenominator.

Parameters:
scaleDenominator - New value of property scaleDenominator.

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

isCaching

public boolean isCaching()
True if we are caching styles.

Returns:
ture if caching

setCaching

public void setCaching(boolean caching)
Set to true to cache styles.

Parameters:
caching - The caching to set.

getContext

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

isConcatTransforms

public boolean isConcatTransforms()

setConcatTransforms

public void setConcatTransforms(boolean concatTransforms)

useIndex

public IndexInfo useIndex(ShapefileDataStore ds)
                   throws IOException,
                          StoreException
Throws:
IOException
StoreException

setJava2DHints

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

getJava2DHints

public RenderingHints getJava2DHints()
Specified by:
getJava2DHints in interface GTRenderer

setRendererHints

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

getRendererHints

public Map getRendererHints()
Specified by:
getRendererHints in interface GTRenderer

setContext

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

paint

public void paint(Graphics2D graphics,
                  Rectangle paintArea,
                  AffineTransform worldToScreen)
Description copied from interface: GTRenderer
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.

paint

public void paint(Graphics2D graphics,
                  Rectangle paintArea,
                  ReferencedEnvelope envelope,
                  AffineTransform transform)
Description copied from interface: GTRenderer
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!

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).
envelope - the map's visible area (viewport) in map coordinates.
transform - A transform which converts World coordinates to Screen coordinates.

paint

public void paint(Graphics2D graphics,
                  Rectangle paintArea,
                  Envelope mapArea)
Deprecated. 

Description copied from interface: GTRenderer
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).
mapArea - the map's visible area (viewport) in map coordinates.

paint

public void paint(Graphics2D graphics,
                  Rectangle paintArea,
                  Envelope mapArea,
                  AffineTransform worldToScreen)
Deprecated. 

Description copied from interface: GTRenderer
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!

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).
mapArea - the map's visible area (viewport) in map coordinates.
worldToScreen - A transform which converts World coordinates to Screen coordinates.


Copyright © 1996-2009 Geotools. All Rights Reserved.