org.geotools.renderer.style
Class SLDStyleFactory

Object
  extended by SLDStyleFactory

public class SLDStyleFactory
extends Object

Factory object that converts SLD style into rendered styles. DJB: I've made a few changes to this. The old behavior was for this class to convert tags to tags. (ie. there never was a LinePlacement option) This is *certainly* not the correct place to do this, and it was doing a very poor job of it too, and the renderer was not expecting it to be doing it! I added support in TextStyle3D for this and had this class correctly set Line/Point placement selection. NOTE: PointPlacement is the default if not present.

Author:
aaime, dblasby

Field Summary
static int DEFAULT_MARK_SIZE
          The default size for Marks when a mark is used, but no size is provided (got from the default size to be used for SVGs and other scalable graphics when no size is provided)
 
Constructor Summary
SLDStyleFactory()
           
 
Method Summary
 Style2D createDynamicStyle(SimpleFeature f, Symbolizer symbolizer, Range scaleRange)
          Creates a rendered style
 Style2D createStyle(Object drawMe, Symbolizer symbolizer, Range scaleRange)
           Creates a rendered style Makes use of a symbolizer cache based on identity to avoid recomputing over and over the same style object and to reduce memory usage.
protected  Composite getComposite(Fill fill, Object feature)
          Computes the Composite equivalent to the opacity in the SLD Fill
 double getHitRatio()
           
 long getHits()
           
 double getMapScaleDenominator()
          Getter for property mapScaleDenominator.
protected  Paint getPaint(Fill fill, Object feature, Symbolizer symbolizer)
           
 RenderingHints getRenderingHints()
          The factory builds a fair number of buffered images to deal with external graphics that need resizing and the like.
 long getRequests()
           
 boolean isLineOptimizationEnabled()
          Enabled by default, this optimization speeds up line rendering when the line width is less than 1.5 pixels when antialiasing is disblaed.
 boolean isVectorRenderingEnabled()
          Indicates whether vector rendering should be preferred when painting graphic fills (e.g., using a Mark as stipple) or vector Graphic objects such as SVG ExternalGraphics.
static int lookUpCap(String capType)
          DOCUMENT ME!
static int lookUpJoin(String joinType)
          DOCUMENT ME!
 void setLineOptimizationEnabled(boolean lineOptimizationEnabled)
           
 void setMapScaleDenominator(double mapScaleDenominator)
          Setter for property mapScaleDenominator.
 void setRenderingHints(RenderingHints renderingHints)
           
 void setVectorRenderingEnabled(boolean vectorRenderingEnabled)
          Sets whether vector rendering should be preferred when painting graphic fills (see isVectorRenderingEnabled() for more details).
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MARK_SIZE

public static final int DEFAULT_MARK_SIZE
The default size for Marks when a mark is used, but no size is provided (got from the default size to be used for SVGs and other scalable graphics when no size is provided)

See Also:
Constant Field Values
Constructor Detail

SLDStyleFactory

public SLDStyleFactory()
Method Detail

getRenderingHints

public RenderingHints getRenderingHints()
The factory builds a fair number of buffered images to deal with external graphics that need resizing and the like. This hints will be used in those drawing operations.


setRenderingHints

public void setRenderingHints(RenderingHints renderingHints)

isLineOptimizationEnabled

public boolean isLineOptimizationEnabled()
Enabled by default, this optimization speeds up line rendering when the line width is less than 1.5 pixels when antialiasing is disblaed. Unfortunately it also prevents fine line width control when antialiasing is enabled. Given that the optimization has been hard coded for more than six years, we give the user control on this one since turning this off will change the rendering of all existing styles using thin line widths.


setLineOptimizationEnabled

public void setLineOptimizationEnabled(boolean lineOptimizationEnabled)

isVectorRenderingEnabled

public boolean isVectorRenderingEnabled()
Indicates whether vector rendering should be preferred when painting graphic fills (e.g., using a Mark as stipple) or vector Graphic objects such as SVG ExternalGraphics. The default behavior is to be disabled, meaning that graphic fills are painted as raster images using Java TexturePaint, and SVGs are rendered to a BufferedImage prior to painting on the target Graphics. This common behavior is faster and more suitable for on-screen rendering. Enabling this flag is recommended for rendering to off-screen Graphics such as when printing, cases in which the full quality of the original data should normally be preserved.


setVectorRenderingEnabled

public void setVectorRenderingEnabled(boolean vectorRenderingEnabled)
Sets whether vector rendering should be preferred when painting graphic fills (see isVectorRenderingEnabled() for more details).

Parameters:
vectorRenderingEnabled - a boolean value indicating whether vector rendering should be enabled or not.

getHitRatio

public double getHitRatio()

getHits

public long getHits()

getRequests

public long getRequests()

createStyle

public Style2D createStyle(Object drawMe,
                           Symbolizer symbolizer,
                           Range scaleRange)

Creates a rendered style

Makes use of a symbolizer cache based on identity to avoid recomputing over and over the same style object and to reduce memory usage. The same Style2D object will be returned by subsequent calls using the same feature independent symbolizer with the same scaleRange.

Parameters:
drawMe - The feature
symbolizer - The SLD symbolizer
scaleRange - The scale range in which the feature should be painted according to the symbolizer
Returns:
A rendered style equivalent to the symbolizer

createDynamicStyle

public Style2D createDynamicStyle(SimpleFeature f,
                                  Symbolizer symbolizer,
                                  Range scaleRange)
Creates a rendered style

Parameters:
f - The feature
symbolizer - The SLD symbolizer
scaleRange - The scale range in which the feature should be painted according to the symbolizer
Returns:
A rendered style equivalent to the symbolizer
Throws:
UnsupportedOperationException - if an unknown symbolizer is passed to this method

getPaint

protected Paint getPaint(Fill fill,
                         Object feature,
                         Symbolizer symbolizer)

getComposite

protected Composite getComposite(Fill fill,
                                 Object feature)
Computes the Composite equivalent to the opacity in the SLD Fill

Parameters:
fill -
feature -

lookUpJoin

public static int lookUpJoin(String joinType)
DOCUMENT ME!

Parameters:
joinType - DOCUMENT ME!
Returns:
DOCUMENT ME!

lookUpCap

public static int lookUpCap(String capType)
DOCUMENT ME!

Parameters:
capType - DOCUMENT ME!
Returns:
DOCUMENT ME!

getMapScaleDenominator

public double getMapScaleDenominator()
Getter for property mapScaleDenominator.

Returns:
Value of property mapScaleDenominator.

setMapScaleDenominator

public void setMapScaleDenominator(double mapScaleDenominator)
Setter for property mapScaleDenominator.

Parameters:
mapScaleDenominator - New value of property mapScaleDenominator.


Copyright © 1996-2014 Geotools. All Rights Reserved.