Package org.geotools.styling

Allows for symbolization of geospatial data.

See:
          Description

Interface Summary
AnchorPoint An AnchorPoint identifies the location inside a textlabel to use as an "anchor" for positioning it relative to a point geometry.
ChannelSelection The ChannelSelection element specifies the false-color channel selection for a multi-spectral raster source (such as a multi-band satellite-imagery source).
ColorMap The ColorMap element defines either the colors of a palette-type raster source or the mapping of fixed-numeric pixel values to colors.
ColorMapEntry A basic interface for objects which can hold color map entries.
ContrastEnhancement The ContrastEnhancement object defines contrast enhancement for a channel of a false-color image or for a color image.
Displacement A Displacement gives X and Y offset displacements to use for rendering a text label near a point.
Extent An Extent gives feature/coverage/raster/matrix dimension extent.
ExternalGraphic Holds a reference to an external graphics file with a URL to its location and its expected MIME type.
FeatureTypeConstraint A FeatureTypeConstraint identifies a specific feature type and supplies fitlering.
FeatureTypeStyle How to style a feature type.
Fill The Fill object encapsulates the graphical-symbolization parameters for areas of geometries.
Font A system-independent object for holding SLD font information.
Font.Style Enumeration of allow font-style values.
Font.Weight Enumeration of allow font-weight values.
Graphic A Graphic is a "graphical symbol" with an inherent shape, color(s), and possibly size.
Halo A Halo fills an extended area outside the glyphs of a rendered textlabel to make it easier to read over a background.
ImageOutline ImageOutline specifies how individual source rasters in a multi-raster set (such as a set of satellite-image scenes) should be outlined to make the individual-image locations visible.
LabelPlacement The "LabelPlacement" specifies where and how a text label should be rendered relative to a geometry.
LayerFeatureConstraints LayerFeatureConstraints define what features and feature types are referenced in a layer.
LinePlacement The "LinePlacement" specifies where and how a text label should be rendered relative to a line.
LineSymbolizer A symbolizer describes how a feature should appear on a map.
Mark A Mark element defines a "shape" which has coloring applied to it.
NamedLayer A NamedLayer is used to refer to a layer that has a name in a WMS.
NamedStyle A NamedStyle is used to refer to a style that has a name in a WMS.
OverlapBehavior OverlapBehavior tells a system how to behave when multiple raster images in a layer overlap each other, for example with satellite-image scenes.
PointPlacement A PointPlacement specifies how a text label is positioned relative to a geometric point.
PointSymbolizer A symbolizer describes how a feature should appear on a map.
PolygonSymbolizer A symbolizer describes how a polygon feature should appear on a map.
RasterSymbolizer The RasterSymbolizer describes how to render raster/matrix-coverage data (e.g., satellite photos, DEMs).
RemoteOWS A RemoteOWS gives a reference to a remote WFS/WCS/other-OWS server.
Rule A rule is used to attach a condition to, and group, the individual symbolizers used for rendering.
SelectedChannelType A class to hold Channel information for use in ChannelSelction objects.
ShadedRelief The ShadedRelief element selects the application of relief shading (or ?hill shading?) to an image for a three-dimensional visual effect.
Stroke The Stroke object encapsulates the graphical-symbolization parameters for linear geometries.
Style Indicates how geographical content should be displayed (we call this a style for simplicity; in the spec it is called a UserStyle (user-defined style)).
StyledLayer 'StyledLayer' is not part of the SLD 1.0 spec.
StyledLayerDescriptor Holds styling information (from a StyleLayerDescriptor document).
StyleFactory Abstract base class for implementing style factories.
StyleFactory2 Abstract base class for implementing style factories.
StyleVisitor An interface for classes that want to perform operations on a Style hierarchy.
Symbol This an empty interface for styling symbol objects to implement
Symbolizer This is the parent interface of all Symbolizers.
TextMark Note: this isn't in the SLD spec
TextSymbolizer A symbolizer describes how a feature should appear on a map.
TextSymbolizer2 Contains label shield hack
UserLayer A UserLayer allows a user-defined layer to be built from WFS and WCS data.
 

Class Summary
AbstractStyleFactory Abstract base class for implementing style factories.
AnchorPointImpl DOCUMENT ME!
BasicLineStyle A style object is quite hard to set up, involving fills, strokes, symbolizers and rules.
BasicPolygonStyle A style object is quite hard to set up, involving fills, strokes, symbolizers and rules.
ChannelSelectionImpl DOCUMENT ME!
ColorMapEntryImpl Default color map entry implementation
ColorMapImpl A simple implementation of the color map interface.
ContrastEnhancementImpl The ContrastEnhancement object defines contrast enhancement for a channel of a false-color image or for a color image.
DisplacementImpl DOCUMENT ME!
ExtentImpl  
ExternalGraphicImpl DOCUMENT ME!
FeatureTypeConstraintImpl  
FeatureTypeStyleImpl DOCUMENT ME!
FillImpl  
FontImpl Provides a Java representation of the Font element of an SLD.
GraphicImpl DOCUMENT ME!
HaloImpl DOCUMENT ME!
ImageOutlineImpl  
LayerFeatureConstraintsImpl  
LinePlacementImpl DOCUMENT ME!
LineSymbolizerImpl Provides a representation of a LineSymbolizer in an SLD Document.
MarkImpl DOCUMENT ME!
NamedLayerImpl DOCUMENT ME!
NamedStyleImpl A NamedStyle is used to refer to a style that has a name in a WMS.
PointPlacementImpl DOCUMENT ME!
PointSymbolizerImpl Provides a Java representation of the PointSymbolizer.
PolygonSymbolizerImpl Provides a representation of a PolygonSymbolizer in an SLD Document.
RasterSymbolizerImpl DOCUMENT ME!
RemoteOWSImpl  
RuleImpl Provides the default implementation of Rule.
SelectedChannelTypeImpl DOCUMENT ME!
ShadedReliefImpl DOCUMENT ME!
SLD Utility class for working with Geotools SLD objects.
SLDInlineFeatureParser  
SLDParser TODO: This really needs to be container ready
SLDTransformer Producers SLD to an output stream.
StrokeImpl Provides a Java representation of the Stroke object in an SLD document.
StyleAttributeExtractor =========================================================================== if you're modifying this, you probably should also take a look at StyleAttributeExtractorTruncated ===========================================================================
StyleAttributeExtractorTruncated A simple visitor whose purpose is to extract the set of attributes used by a Style, that is, those that the Style expects to find in order to work properly This is very similiar to StyleAttributeExtractor, but with these differences: a) it doesnt the count the tag in the b) it doesnt count anything in the 's tag c) it doesnt count anything in the 's
StyleBuilder An utility class designed to ease style building by convinience methods.
StyledLayerDescriptorImpl Holds styling information (from a StyleLayerDescriptor document).
StyledLayerImpl DOCUMENT ME!
StyleFactoryFinder  
StyleFactoryImpl Factory for creating Styles.
StyleImpl DOCUMENT ME!
TextMarkImpl DOCUMENT ME!
TextSymbolizerImpl Provides a Java representation of an SLD TextSymbolizer that defines how text symbols should be rendered.
UserLayerImpl DJB: on inlinefeature support: The inline features also lets you "sort of" make your WMS into a WFS-T.
XMLEncoder Deprecated. Use org.geotools.styling.SLDTransformer
 

Exception Summary
StyleFactoryCreationException An exception that can be thrown by the StyleFactory if it fails to create the implementation of the StyleFactory.
 

Package org.geotools.styling Description

Allows for symbolization of geospatial data.

For many of us in geotools *this* is the reason we came along for the ride - a pretty picture. The contents of this package are adapted from the OpenGIS® Styled Layer Descriptor specification v1.0.0.

Conformance to SLD 1.0.0

We may experiment with our own (or SLD 1.1) ideas but will mark such experiments for you. This is only an issue of you are considering writing out these objects for interoptability with other systems.

General stratagy for supporting multiple SLD versions (and experiments):

Care and Feeding of Style Objects

SLD is an XML specification, the definition of objects capturing this information, the binding of objects to these XML documents, and the provision of events on object modification all need to be accounted for.

StyleFactory

As with all geotools work construction of styling constructs is handled by a Factory(GOF). Quickly a Factory is used when working with interfaces, anything that would of been a constructor is set up as an create method.

  StyleFactory factory = StyleFactoryFinder.createStyleFactory();
  StyleLayerDescriptor sld = factory.createStyleLayerDescriptor();
  // an empty sld document
  sld.setTitle("Basic Black");
  sld.setAbstract("Grayscale style suitable for use with photocopiers");
  
  

When creating a complex data structure direct use of a Factory is a pain. Which leads us to the next section.

Notes:

StyleBuilder

When constructing a complex data structure, such as an SLD document, the use of a Factory is a bit of a pain. That is where StyleBuilder is brought to bare. A Builder is simply a class that help you construct a complicated data structure, for a make involved/interesting example of a builder have a look at the graph package.


  
  

Example

The following code example has been borrowed from the geotools website, for additional examples (and advice) please consult the user documentation.


    private Style buildStyle() throws Exception {
        StyleBuilder sb = new StyleBuilder();
        FilterFactory ff = sb.getFilterFactory();
        Style style = sb.createStyle();
        style.setName("MyStyle");

        // "testPoint" feature type style
        Mark testMark = sb.createMark(sb.attributeExpression("name"),
                sb.createFill(Color.RED, 0.5), null);
        Graphic graph = sb.createGraphic(null, new Mark[] { testMark }, null,
                sb.literalExpression(1), sb.attributeExpression("size"),
                sb.attributeExpression("rotation"));
        style.addFeatureTypeStyle(sb.createFeatureTypeStyle("testPoint",
                new Symbolizer[] { sb.createPointSymbolizer(graph) }));

        // "labelPoint" feature type style
        AnchorPoint anchorPoint = sb.createAnchorPoint(sb.attributeExpression("X"),
                sb.attributeExpression("Y"));
        PointPlacement pointPlacement = sb.createPointPlacement(anchorPoint, null,
                sb.literalExpression(0));
        TextSymbolizer textSymbolizer = sb.createTextSymbolizer(sb.createFill(Color.BLACK),
                new Font[] { sb.createFont("Lucida Sans", 10), sb.createFont("Arial", 10) },
                sb.createHalo(), sb.attributeExpression("name"), pointPlacement, null);
        Mark circle = sb.createMark(StyleBuilder.MARK_CIRCLE, Color.RED);
        Graphic graph2 = sb.createGraphic(null, circle, null, 1, 4, 0);
        PointSymbolizer pointSymbolizer = sb.createPointSymbolizer(graph2);
        style.addFeatureTypeStyle(sb.createFeatureTypeStyle("labelPoint",
                new Symbolizer[] { textSymbolizer, pointSymbolizer }));

        return style;
    }

References

The following links will be of interest:

Since:
GeoTools 2.0
Version:
SLD 1.0
Author:
Ian Turton, CCG, James Macgill, CCG, Jody Garnett, Refractions Research


Copyright © GeoTools. All Rights Reserved.