org.geotools.swt.styling.simple
Class SLDs

Object
  extended by SLD
      extended by 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 String GENERIC_FEATURE_TYPENAME
          The type name that can be used in an SLD in the featuretypestyle that matches all feature types.
 
Fields inherited from class SLD
NOTFOUND
 
Constructor Summary
SLDs()
           
 
Method Summary
static Color color(Expression expr)
           
static String[] colors(Rule rule)
          Retrieves all colour names defined in a rule
static Font font(TextSymbolizer symbolizer)
           
static Style getDefaultStyle(StyledLayerDescriptor sld)
           
static FeatureTypeStyle getFeatureTypeStyle(Style s)
          gets the first FeatureTypeStyle
static Rule getRasterSymbolizerRule(Style s)
          Find the first rule which contains a rastersymbolizer, and return it
static boolean isLine(GeometryDescriptor geometryType)
           
static boolean isLine(SimpleFeatureType featureType)
           
static boolean isPoint(GeometryDescriptor geometryType)
           
static boolean isPoint(SimpleFeatureType featureType)
           
static boolean isPolygon(GeometryDescriptor geometryType)
           
static boolean isPolygon(SimpleFeatureType featureType)
           
static boolean isSemanticTypeMatch(FeatureTypeStyle fts, 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 Color pointFillWithAlpha(PointSymbolizer symbolizer)
          Extracts the fill color with a given opacity from the PointSymbolizer.
static Color pointStrokeColorWithAlpha(PointSymbolizer symbolizer)
          Extracts the stroke color with a given opacity from the PointSymbolizer.
static Color polyFill(PolygonSymbolizer symbolizer)
           
static int size(Graphic graphic)
           
static FontData[] textFont(TextSymbolizer symbolizer)
          Grabs the font from the first TextSymbolizer.
 
Methods inherited from class SLD
color, color, color, color, colors, colorToHex, createLineStyle, createLineStyle, createPointStyle, createPointStyle, createPolygonStyle, createPolygonStyle, createSimpleStyle, createSimpleStyle, createSimpleStyle, defaultStyle, featureTypeStyle, featureTypeStyle, featureTypeStyles, fill, fill, filters, filters, getPlacement, graphic, lineColor, lineDash, lineLinecap, lineLinejoin, lineOpacity, lineSymbolizer, lineSymbolizer, lineWidth, mark, mark, matchingStyle, opacity, opacity, opacity, pointBorderOpacity, pointColor, pointFill, pointGraphic, pointMark, pointOpacity, pointSize, pointSymbolizer, pointSymbolizer, pointWellKnownName, pointWidth, polyBorderOpacity, polyColor, polyFillOpacity, polySymbolizer, polySymbolizer, polyWidth, rasterOpacity, rasterOpacity, rasterSymbolizer, rasterSymbolizer, rules, setChannelSelection, setLineColour, setLineColour, setPointColour, setPointColour, setPolyColour, setPolyColour, setRasterOpacity, size, stroke, stroke, stroke, styles, symbolizer, symbolizer, symbolizers, symbolizers, textFontFill, textHaloFill, textHaloOpacity, textHaloWidth, textLabel, textLabelString, textSymbolizer, textSymbolizer, toColor, toHTMLColor, wellKnownName, width, width, wrapSymbolizers
 
Methods inherited from class 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 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

size

public static int size(Graphic graphic)

polyFill

public static Color polyFill(PolygonSymbolizer symbolizer)

color

public static Color color(Expression expr)

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.

colors

public static String[] colors(Rule rule)
Retrieves all colour names defined in a rule

Parameters:
rule - the rule
Returns:
an array of unique colour names

pointFillWithAlpha

public static Color pointFillWithAlpha(PointSymbolizer symbolizer)
Extracts the fill color with a given opacity from the PointSymbolizer.

Parameters:
symbolizer - the point symbolizer from which to get the color.
Returns:
the Color with transparency if available. Returns null if no color is available.

pointStrokeColorWithAlpha

public static Color pointStrokeColorWithAlpha(PointSymbolizer symbolizer)
Extracts the stroke color with a given opacity from the PointSymbolizer.

Parameters:
symbolizer - the point symbolizer from which to get the color.
Returns:
the Color with transparency if available. Returns null if no color is available.

font

public static Font font(TextSymbolizer symbolizer)

getDefaultStyle

public static Style getDefaultStyle(StyledLayerDescriptor sld)

isSemanticTypeMatch

public static boolean isSemanticTypeMatch(FeatureTypeStyle fts,
                                          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.

isPolygon

public static final boolean isPolygon(SimpleFeatureType featureType)

isPolygon

public static final boolean isPolygon(GeometryDescriptor geometryType)

isLine

public static final boolean isLine(SimpleFeatureType featureType)

isLine

public static final boolean isLine(GeometryDescriptor geometryType)

isPoint

public static final boolean isPoint(SimpleFeatureType featureType)

isPoint

public static final boolean isPoint(GeometryDescriptor geometryType)


Copyright © 1996-2014 Geotools. All Rights Reserved.