net.refractions.udig.ui.graphics
Class SLDs

java.lang.Object
  extended by SLD
      extended by net.refractions.udig.ui.graphics.SLDs

public class SLDs
extends SLD

Utility class for working with Geotools SLD objects.

This class assumes a subset of the SLD specification:

When you start to branch out to SLD information that contains multiple rules you will need to modify this class.

Since:
0.7.0
Author:
Jody Garnett, Refractions Research.

Field Summary
static double ALIGN_BOTTOM
           
static double ALIGN_CENTER
           
static double ALIGN_LEFT
           
static double ALIGN_MIDDLE
           
static double ALIGN_RIGHT
           
static double ALIGN_TOP
           
static java.lang.String GENERIC_FEATURE_TYPENAME
          The type name that can be used in an SLD in the featuretypestyle that matches all feature types.
 
Constructor Summary
SLDs()
           
 
Method Summary
static Font font(TextSymbolizer symbolizer)
           
static Style getDefaultStyle(StyledLayerDescriptor sld)
           
static FeatureTypeStyle getFeatureTypeStyle(Style s)
          gets the first FeatureTypeStyle
static PointPlacement getPlacement(double horizAlign, double vertAlign, double rotation)
           
static Rule getRasterSymbolizerRule(Style s)
          Find the first rule which contains a rastersymbolizer, and return it
static boolean isSemanticTypeMatch(FeatureTypeStyle fts, java.lang.String regex)
           
static double maxScale(FeatureTypeStyle fts)
          Returns the max scale of the default rule, or Double.NaN if none is set
static double minScale(FeatureTypeStyle fts)
          Returns the min scale of the default rule, or 0 if none is set
static FontData[] textFont(TextSymbolizer symbolizer)
          Grabs the font from the first TextSymbolizer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALIGN_LEFT

public static final double ALIGN_LEFT
See Also:
Constant Field Values

ALIGN_CENTER

public static final double ALIGN_CENTER
See Also:
Constant Field Values

ALIGN_RIGHT

public static final double ALIGN_RIGHT
See Also:
Constant Field Values

ALIGN_BOTTOM

public static final double ALIGN_BOTTOM
See Also:
Constant Field Values

ALIGN_MIDDLE

public static final double ALIGN_MIDDLE
See Also:
Constant Field Values

ALIGN_TOP

public static final double ALIGN_TOP
See Also:
Constant Field Values

GENERIC_FEATURE_TYPENAME

public static final java.lang.String GENERIC_FEATURE_TYPENAME
The type name that can be used in an SLD in the featuretypestyle that matches all feature types.

See Also:
Constant Field Values
Constructor Detail

SLDs

public SLDs()
Method Detail

textFont

public static FontData[] textFont(TextSymbolizer symbolizer)
Grabs the font from the first TextSymbolizer.

If you are using something fun like symbols you will need to do your own thing.

Parameters:
symbolizer - Text symbolizer information.
Returns:
FontData[] of the font's fill, or null if unavailable.

font

public static Font font(TextSymbolizer symbolizer)

getDefaultStyle

public static Style getDefaultStyle(StyledLayerDescriptor sld)

isSemanticTypeMatch

public static boolean isSemanticTypeMatch(FeatureTypeStyle fts,
                                          java.lang.String regex)

minScale

public static double minScale(FeatureTypeStyle fts)
Returns the min scale of the default rule, or 0 if none is set


maxScale

public static double maxScale(FeatureTypeStyle fts)
Returns the max scale of the default rule, or Double.NaN if none is set


getFeatureTypeStyle

public static FeatureTypeStyle getFeatureTypeStyle(Style s)
gets the first FeatureTypeStyle


getRasterSymbolizerRule

public static Rule getRasterSymbolizerRule(Style s)
Find the first rule which contains a rastersymbolizer, and return it

Parameters:
s - A style to search in
Returns:
a rule, or null if no raster symbolizers are found.

getPlacement

public static PointPlacement getPlacement(double horizAlign,
                                          double vertAlign,
                                          double rotation)