Package org.geotools.styling

Allows for symbolization of geospatial data.

See:
          Description

Interface Summary
AnchorPoint An AnchorPoint identifies the location inside a label or graphic 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.
ColorReplacement Apply color replacement to an external graphic.
ContrastEnhancement The ContrastEnhancement object defines contrast enhancement for a channel of a false-color image or for a color image.
Description  
Displacement A Displacement gives X and Y offset displacements to use for rendering a text label near a point.
ExtensionSymbolizer Custom symbolizer support.
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.
ExternalMark Specify a mark using an image files (svg, png, gif) or using mark index a true type font file.
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.
GraphicLegend Used to represent a Rule (or other construct) in a user interface or legend.
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.
OtherText Allows open ended extensions for text oriented rendering formats.
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.
ResourceLocator Provides a hook to locate online resources in ExternalGraphic instances.
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 ?
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.
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.
AbstractStyleVisitor A basic implementation of the StyleVisitor interface.
AbstractSymbolizer  
AnchorPointImpl Direct implementation of AnchorPoint.
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 ChannelSelectionImpl
ColorMapEntryImpl Default color map entry implementation
ColorMapImpl A simple implementation of the color map interface.
ColorReplacementImpl An implementation of ColorReplacement; this is a wrapper around an implementaiton of the "Recode" function as defined by SymbologyEncoding 1.1.
ContrastEnhancementImpl The ContrastEnhancement object defines contrast enhancement for a channel of a false-color image or for a color image.
DefaultResourceLocator Default locator for online resources.
DescriptionImpl  
DisplacementImpl DOCUMENT ME!
ExtentImpl  
ExternalGraphicImpl DOCUMENT ME!
ExternalMarkImpl Default implementation of ExternalMark.
FeatureTypeConstraintImpl  
FeatureTypeStyleImpl Implementation of Feature Type Style; care is taken to ensure everything is mutable.
FillImpl  
FontImpl Provides a Java representation of the Font element of an SLD.
GraphicImpl Direct implementation of Graphic.
HaloImpl Direct implementation of Halo.
ImageOutlineImpl  
LayerFeatureConstraintsImpl  
LinePlacementImpl Default implementation of LinePlacement.
LineSymbolizerImpl Provides a representation of a LineSymbolizer in an SLD Document.
MarkImpl Default implementation of Mark.
NamedLayerImpl Default implementation of named layer.
NamedStyleImpl A NamedStyle is used to refer to a style that has a name in a WMS.
OtherTextImpl  
OverlapBehavior Deprecated. Please use org.opengis.style.OverlapBehavior
PointPlacementImpl DOCUMENT ME!
PointSymbolizerImpl Provides a Java representation of the PointSymbolizer.
PolygonSymbolizerImpl Provides a representation of a PolygonSymbolizer in an SLD Document.
RasterSymbolizerImpl Default implementation of RasterSymbolizer.
RemoteOWSImpl  
RuleImpl Provides the default implementation of Rule.
SelectedChannelTypeImpl Default implementation of SelectedChannelType.
ShadedReliefImpl Default implementation of ShadedRelief.
SLD Utility class that provides static helper methods for common operations on GeoTools styling objects (e.g.
SLDInlineFeatureParser  
SLDParser TODO: This really needs to be container ready
SLDTransformer Produces SLD to an output stream.
StrokeImpl Provides a Java representation of the Stroke object in an SLD document.
StyleAttributeExtractor 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
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 with convenience methods.
StyledLayerDescriptorImpl Holds styling information (from a StyleLayerDescriptor document).
StyledLayerImpl Default implementation of StyledLayer.
StyleFactoryFinder Deprecated. Replaced by CommonFactoryFinder.getStyleFactory(org.geotools.factory.Hints).
StyleFactoryImpl Factory for creating Styles.
StyleFactoryImpl2 Factory for creating Styles; based on the GeoAPI StyleFactory interface.
StyleImpl Implementation of style.
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.
VendorSymbolizerImpl ExtensioSymbolizer capturing a vendor specific extension.
 

Enum Summary
TextSymbolizer.PolygonAlignOptions Enumerated options that can be used with polygonAlign.
UomOgcMapping Defines the Units of Measure (UOMs) specified by the OGC SE standard and their mappings to Java Units defined in javax.measure.unit.
 

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
Author:
Ian Turton, CCG, James Macgill, CCG, Jody Garnett, Refractions Research


Copyright © 1996-2014 Geotools. All Rights Reserved.