Package org.geotools.renderer.style
Class SLDStyleFactory
- Object
-
- SLDStyleFactory
-
public class SLDStyleFactory extends Object
Factory object that converts SLD style into rendered styles.- Author:
- aaime, dblasby
-
-
Field Summary
Fields Modifier and Type Field Description 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)static String
FONT_BOLD
static String
FONT_ITALIC
static String
FONT_NORMAL
static String
FONT_OBLIQUE
static String
USE_LEGACY_ANCHOR_POINT_KEY
Java System Property to enable legacy default anchor point.
-
Constructor Summary
Constructors Constructor Description SLDStyleFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Style2D
createDynamicStyle(SimpleFeature f, Symbolizer symbolizer, Range scaleRange)
Creates a rendered styleStyle2D
createStyle(Object drawMe, Symbolizer symbolizer)
Creates a rendered styleStyle2D
createStyle(Object drawMe, Symbolizer symbolizer, Range scaleRange)
Creates a rendered stylestatic float[]
evaluateDashArray(Stroke stroke, Object feature)
static Composite
getComposite(Map<String,String> options)
Looks up the composite from the vendor options, or returns null if no composite operation has been specified in the optionsstatic Composite
getComposite(Map<String,String> options, float defaultOpacity)
Looks up the composite from the vendor options, or returns null if no composite operation has been specified in the optionsComposite
getComposite(Fill fill, Object feature)
Computes the Composite equivalent to the opacity in the SLD Filldouble
getHitRatio()
long
getHits()
double
getMapScaleDenominator()
Getter for property mapScaleDenominator.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()
static SortBy[]
getSortBy(Map<String,String> options)
Returns the sorting directions found in the feature type styleboolean
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)
static int
lookUpJoin(String joinType)
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 (seeisVectorRenderingEnabled()
for more details).
-
-
-
Field Detail
-
USE_LEGACY_ANCHOR_POINT_KEY
public static final String USE_LEGACY_ANCHOR_POINT_KEY
Java System Property to enable legacy default anchor point.- See Also:
- Constant Field Values
-
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
-
FONT_NORMAL
public static final String FONT_NORMAL
- See Also:
- Constant Field Values
-
FONT_ITALIC
public static final String FONT_ITALIC
- See Also:
- Constant Field Values
-
FONT_OBLIQUE
public static final String FONT_OBLIQUE
- See Also:
- Constant Field Values
-
FONT_BOLD
public static final String FONT_BOLD
- See Also:
- Constant Field Values
-
-
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 (seeisVectorRenderingEnabled()
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)
Creates a rendered styleMakes 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 featuresymbolizer
- The SLD symbolizer- Returns:
- A rendered style equivalent to the symbolizer
-
createStyle
public Style2D createStyle(Object drawMe, Symbolizer symbolizer, Range scaleRange)
Creates a rendered styleMakes 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 featuresymbolizer
- The SLD symbolizerscaleRange
- 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 featuresymbolizer
- The SLD symbolizerscaleRange
- 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
-
evaluateDashArray
public static float[] evaluateDashArray(Stroke stroke, Object feature) throws NumberFormatException
- Throws:
NumberFormatException
-
getPaint
public Paint getPaint(Fill fill, Object feature, Symbolizer symbolizer)
-
getComposite
public Composite getComposite(Fill fill, Object feature)
Computes the Composite equivalent to the opacity in the SLD Fill
-
lookUpJoin
public static int lookUpJoin(String joinType)
-
lookUpCap
public static int lookUpCap(String capType)
-
getComposite
public static Composite getComposite(Map<String,String> options)
Looks up the composite from the vendor options, or returns null if no composite operation has been specified in the options
-
getComposite
public static Composite getComposite(Map<String,String> options, float defaultOpacity)
Looks up the composite from the vendor options, or returns null if no composite operation has been specified in the options
-
getSortBy
public static SortBy[] getSortBy(Map<String,String> options)
Returns the sorting directions found in the feature type style
-
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.
-
-