org.geotools.styling

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » GeoTools 2.4.1 » org.geotools.styling 
org.geotools.styling
package org.geotools.styling 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):

  • These interfaces will reflect the current published specification
  • Our implementations will be BIGGER and more capabile then any one specification
  • We cannot defined explicit interfaces tracking each version until we move to Java 5 (perferably GeoAPI would hold these anyways)
  • We can provided javadocs indicating extentions, and isolate these using the normal java convention: TextSymbolizer and TextSymbolizer2 (In short you will have to go out of your way to work with a hack or experiment, you won't depend on one by accident)
  • We can use Factories (aka SLD1Factory and SLD1_1Factory and SEFactory) to support the creation of conformant datastructures. Code (such as user interfaces) can be parameratized with these factories when they need to confirm to an exact version supported by an individual service. We hope that specifications are always adative, and will be forced to throw unsupported exceptions when functionality is removed from a specification.

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:

  • At this time one implementation of StyleFactory is available, this will not provide true in the future (as SLD experiments, and code generation are brought to bare on future specifications).

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:
  • SLD 1.0.0
  • Design Patterns, GOF
@author Ian Turton, CCG @author James Macgill, CCG @author Jody Garnett, Refractions Research @since GeoTools 2.0 @version SLD 1.0
Java Source File NameTypeComment
AbstractStyleFactory.javaClass Abstract base class for implementing style factories.
AnchorPoint.javaInterface An AnchorPoint identifies the location inside a textlabel to use as an "anchor" for positioning it relative to a point geometry.
AnchorPointImpl.javaClass
BasicLineStyle.javaClass A style object is quite hard to set up, involving fills, strokes, symbolizers and rules.
BasicPolygonStyle.javaClass A style object is quite hard to set up, involving fills, strokes, symbolizers and rules.
ChannelSelection.javaInterface The ChannelSelection element specifies the false-color channel selection for a multi-spectral raster source (such as a multi-band satellite-imagery source).
ChannelSelectionImpl.javaClass
ColorMap.javaInterface The ColorMap element defines either the colors of a palette-type raster source or the mapping of fixed-numeric pixel values to colors.
 <xs:element name="ColorMap">
 <xs:complexType>
 <xs:choice minOccurs="0" maxOccurs="unbounded">
 <xs:element ref="sld:ColorMapEntry"/>
 </xs:choice>
 </xs:complexType>
 </xs:element>
 
For example, a DEM raster giving elevations in meters above sea level can be translated to a colored image with a ColorMap.
ColorMapEntry.javaInterface A basic interface for objects which can hold color map entries.
ColorMapEntryImpl.javaClass
ColorMapImpl.javaClass A simple implementation of the color map interface.
ContrastEnhancement.javaInterface The ContrastEnhancement object defines contrast enhancement for a channel of a false-color image or for a color image.
ContrastEnhancementImpl.javaClass The ContrastEnhancement object defines contrast enhancement for a channel of a false-color image or for a color image.
Displacement.javaInterface A Displacement gives X and Y offset displacements to use for rendering a text label near a point.
DisplacementImpl.javaClass
Extent.javaInterface An Extent gives feature/coverage/raster/matrix dimension extent.

 
 <xsd:element name="Extent">
 <xsd:annotation>
 <xsd:documentation>         An Extent gives
 feature/coverage/raster/matrix dimension extent.
ExtentImpl.javaClass
ExternalGraphic.javaInterface Holds a reference to an external graphics file with a URL to its location and its expected MIME type.
ExternalGraphicImpl.javaClass
FeatureTypeConstraint.javaInterface A FeatureTypeConstraint identifies a specific feature type and supplies fitlering.
FeatureTypeConstraintImpl.javaClass
FeatureTypeStyle.javaInterface How to style a feature type.
FeatureTypeStyleImpl.javaClass
Fill.javaInterface The Fill object encapsulates the graphical-symbolization parameters for areas of geometries.

There are two types of fill: solid-color and repeated graphic fill.

The details of this object are taken from the OGC Styled-Layer Descriptor Report (OGC 02-070) version 1.0.0.:


 <xsd:element name="Fill">
 <xsd:annotation>
 <xsd:documentation>
 A "Fill" specifies the pattern for filling an area geometry.
 The allowed CssParameters are: "fill" (color) and "fill-opacity".
 </xsd:documentation>
 </xsd:annotation>
 <xsd:complexType>
 <xsd:sequence>
 <xsd:element ref="sld:GraphicFill" minOccurs="0"/>
 <xsd:element ref="sld:CssParameter" minOccurs="0"
 maxOccurs="unbounded"/>
 </xsd:sequence>
 </xsd:complexType>
 </xsd:element>
 

Renderers can use this information when displaying styled features, though it must be remembered that not all renderers will be able to fully represent strokes as set out by this interface.

FillImpl.javaClass
Font.javaInterface A system-independent object for holding SLD font information.
FontImpl.javaClass Provides a Java representation of the Font element of an SLD.
Graphic.javaInterface A Graphic is a "graphical symbol" with an inherent shape, color(s), and possibly size.

A "graphic" can very informally be defined as "a little picture" and can be of either a raster or vector graphic source type.

GraphicImpl.javaClass
Halo.javaInterface A Halo fills an extended area outside the glyphs of a rendered textlabel to make it easier to read over a background.

The details of this object are taken from the OGC Styled-Layer Descriptor Report (OGC 02-070) version 1.0.0.:


 <xsd:element name="Halo">
 <xsd:annotation>
 <xsd:documentation>
 A "Halo" fills an extended area outside the glyphs of a rendered
 text label to make the label easier to read over a background.
 </xsd:documentation>
 </xsd:annotation>
 <xsd:complexType>
 <xsd:sequence>
 <xsd:element ref="sld:Radius" minOccurs="0"/>
 <xsd:element ref="sld:Fill" minOccurs="0"/>
 </xsd:sequence>
 </xsd:complexType>
 </xsd:element>
 

Renderers can use this information when displaying styled features, though it must be remembered that not all renderers will be able to fully represent strokes as set out by this interface.

HaloImpl.javaClass
ImageOutline.javaInterface 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. <xsd:element name="ImageOutline"> <xsd:annotation> <xsd:documentation> "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.
ImageOutlineImpl.javaClass
LabelPlacement.javaInterface The "LabelPlacement" specifies where and how a text label should be rendered relative to a geometry.

The details of this object are taken from the OGC Styled-Layer Descriptor Report (OGC 02-070) version 1.0.0.:


 <xsd:element name="LabelPlacement">
 <xsd:annotation>
 <xsd:documentation>
 The "LabelPlacement" specifies where and how a text label should
 be rendered relative to a geometry.
LayerFeatureConstraints.javaInterface LayerFeatureConstraints define what features and feature types are referenced in a layer.

 
 <xsd:element name="LayerFeatureConstraints">
 <xsd:annotation>
 <xsd:documentation>         LayerFeatureConstraints define what
 features & feature types are         referenced in a
 layer.
LayerFeatureConstraintsImpl.javaClass
LinePlacement.javaInterface The "LinePlacement" specifies where and how a text label should be rendered relative to a line.
LinePlacementImpl.javaClass
LineSymbolizer.javaInterface A symbolizer describes how a feature should appear on a map.

The symbolizer describes not just the shape that should appear but also such graphical properties as color and opacity.

A symbolizer is obtained by specifying one of a small number of different types of symbolizer and then supplying parameters to override its default behaviour.

The details of this object are taken from the OGC Styled-Layer Descriptor Report (OGC 02-070) version 1.0.0.:


 <xsd:element name="LineSymbolizer" substitutionGroup="sld:Symbolizer">
 <xsd:annotation>
 <xsd:documentation>
 A LineSymbolizer is used to render a "stroke" along a linear geometry.
 </xsd:documentation>
 </xsd:annotation>
 <xsd:complexType>
 <xsd:complexContent>
 <xsd:extension base="sld:SymbolizerType">
 <xsd:sequence>
 <xsd:element ref="sld:Geometry" minOccurs="0"/>
 <xsd:element ref="sld:Stroke" minOccurs="0"/>
 </xsd:sequence>
 </xsd:extension>
 </xsd:complexContent>
 </xsd:complexType>
 </xsd:element>
 

Renderers can use this information when displaying styled features, though it must be remembered that not all renderers will be able to fully represent strokes as set out by this interface.

LineSymbolizerImpl.javaClass Provides a representation of a LineSymbolizer in an SLD Document.
Mark.javaInterface A Mark element defines a "shape" which has coloring applied to it.

The details of this object are taken from the OGC Styled-Layer Descriptor Report (OGC 02-070) version 1.0.0.:


 <xsd:element name="Mark">
 <xsd:annotation>
 <xsd:documentation>
 A "Mark" specifies a geometric shape and applies coloring to it.
 </xsd:documentation>
 </xsd:annotation>
 <xsd:complexType>
 <xsd:sequence>
 <xsd:element ref="sld:WellKnownName" minOccurs="0"/>
 <xsd:element ref="sld:Fill" minOccurs="0"/>
 <xsd:element ref="sld:Stroke" minOccurs="0"/>
 </xsd:sequence>
 </xsd:complexType>
 </xsd:element>
 

Renderers can use this information when displaying styled features, though it must be remembered that not all renderers will be able to fully represent strokes as set out by this interface.

MarkImpl.javaClass
NamedLayer.javaInterface A NamedLayer is used to refer to a layer that has a name in a WMS.
NamedLayerImpl.javaClass
NamedStyle.javaInterface A NamedStyle is used to refer to a style that has a name in a WMS.
NamedStyleImpl.javaClass A NamedStyle is used to refer to a style that has a name in a WMS.
OverlapBehavior.javaClass OverlapBehavior tells a system how to behave when multiple raster images in a layer overlap each other, for example with satellite-image scenes.

 
 <xsd:element name="OverlapBehavior">
 <xsd:annotation>
 <xsd:documentation>         "OverlapBehavior" tells a
 system how to behave when multiple         raster images in
 a layer overlap each other, for example with
 satellite-image scenes.
PointPlacement.javaInterface A PointPlacement specifies how a text label is positioned relative to a geometric point.
PointPlacementImpl.javaClass
PointSymbolizer.javaInterface A symbolizer describes how a feature should appear on a map.

The symbolizer defines not just the shape that should appear but also such graphical properties as color and opacity.

A symbolizer is obtained by specifying one of a small number of different types of symbolizer and then supplying parameters to overide its default behaviour.

The details of this object are taken from the OGC Styled-Layer Descriptor Report (OGC 02-070) version 1.0.0.:


 <xsd:element name="PointSymbolizer" substitutionGroup="sld:Symbolizer">
 <xsd:annotation>
 <xsd:documentation>
 A "PointSymbolizer" specifies the rendering of a "graphic symbol"
 at a point.
 </xsd:documentation>
 </xsd:annotation>
 <xsd:complexType>
 <xsd:complexContent>
 <xsd:extension base="sld:SymbolizerType">
 <xsd:sequence>
 <xsd:element ref="sld:Geometry" minOccurs="0"/>
 <xsd:element ref="sld:Graphic" minOccurs="0"/>
 </xsd:sequence>
 </xsd:extension>
 </xsd:complexContent>
 </xsd:complexType>
 </xsd:element>
 

Renderers can use this information when displaying styled features, though it must be remembered that not all renderers will be able to fully represent strokes as set out by this interface.

PointSymbolizerImpl.javaClass Provides a Java representation of the PointSymbolizer.
PolygonSymbolizer.javaInterface A symbolizer describes how a polygon feature should appear on a map.

The symbolizer describes not just the shape that should appear but also such graphical properties as color and opacity.

A symbolizer is obtained by specifying one of a small number of different types of symbolizer and then supplying parameters to overide its default behaviour.

The details of this object are taken from the OGC Styled-Layer Descriptor Report (OGC 02-070) version 1.0.0.:


 <xsd:element name="PolygonSymbolizer" substitutionGroup="sld:Symbolizer">
 <xsd:annotation>
 <xsd:documentation>
 A "PolygonSymbolizer" specifies the rendering of a polygon or
 area geometry, including its interior fill and border stroke.
 </xsd:documentation>
 </xsd:annotation>
 <xsd:complexType>
 <xsd:complexContent>
 <xsd:extension base="sld:SymbolizerType">
 <xsd:sequence>
 <xsd:element ref="sld:Geometry" minOccurs="0"/>
 <xsd:element ref="sld:Fill" minOccurs="0"/>
 <xsd:element ref="sld:Stroke" minOccurs="0"/>
 </xsd:sequence>
 </xsd:extension>
 </xsd:complexContent>
 </xsd:complexType>
 </xsd:element>
 

Renderers can use this information when displaying styled features, though it must be remembered that not all renderers will be able to fully represent strokes as set out by this interface.

PolygonSymbolizerImpl.javaClass Provides a representation of a PolygonSymbolizer in an SLD Document.
RasterSymbolizer.javaInterface The RasterSymbolizer describes how to render raster/matrix-coverage data (e.g., satellite photos, DEMs).
RasterSymbolizerImpl.javaClass
RemoteOWS.javaInterface A RemoteOWS gives a reference to a remote WFS/WCS/other-OWS server.
RemoteOWSImpl.javaClass
Rule.javaInterface A rule is used to attach a condition to, and group, the individual symbolizers used for rendering.
RuleImpl.javaClass Provides the default implementation of Rule.
SelectedChannelType.javaInterface A class to hold Channel information for use in ChannelSelction objects.
SelectedChannelTypeImpl.javaClass
ShadedRelief.javaInterface The ShadedRelief element selects the application of relief shading (or ?hill shading?) to an image for a three-dimensional visual effect.
ShadedReliefImpl.javaClass
SLD.javaClass Utility class for working with Geotools SLD objects.
SLDInlineFeatureParser.javaClass
SLDParser.javaClass
SLDStyleTest.javaClass
SLDTransformer.javaClass Produces SLD to an output stream.
Stroke.javaInterface The Stroke object encapsulates the graphical-symbolization parameters for linear geometries.

There are three basic types of stroke: solid color, graphic fill (stipple), and repeated linear graphic stroke. A repeated linear graphic is plotted linearly and has its graphic symbol bent around the curves of the line string.

StrokeImpl.javaClass Provides a Java representation of the Stroke object in an SLD document.
Style.javaInterface 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)).
StyleAttributeExtractor.javaClass
StyleAttributeExtractorTest.javaClass
StyleAttributeExtractorTruncated.javaClass 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.javaClass An utility class designed to ease style building by convinience methods.
StyledLayer.javaInterface 'StyledLayer' is not part of the SLD 1.0 spec.
StyledLayerDescriptor.javaInterface Holds styling information (from a StyleLayerDescriptor document).

This interface is bound to version 1.0 of the SLD specification.

For many of us in geotools this is the reason we came along for the ride - a pretty picture.

StyledLayerDescriptorImpl.javaClass Holds styling information (from a StyleLayerDescriptor document).

This class is based on version 1.0 of the SLD specification.

For many of us in geotools this is the reason we came along for the ride - a pretty picture.

StyledLayerImpl.javaClass
StyleFactory.javaInterface Abstract base class for implementing style factories.
StyleFactory2.javaInterface Abstract base class for implementing style factories.
StyleFactoryCreationException.javaClass An exception that can be thrown by the StyleFactory if it fails to create the implementation of the StyleFactory.
StyleFactoryFinder.javaClass
StyleFactoryImpl.javaClass Factory for creating Styles.
StyleFactoryImplTest.javaClass
StyleImpl.javaClass
StyleObjectTest.javaClass
StyleVisitor.javaInterface An interface for classes that want to perform operations on a Style hierarchy.
Symbol.javaInterface
Symbolizer.javaInterface This is the parent interface of all Symbolizers.

A symbolizer describes how a feature should appear on a map.

TextMark.javaInterface
TextMarkImpl.javaClass
TextSymbolizer.javaInterface A symbolizer describes how a feature should appear on a map.

A symbolizer is obtained by specifying one of a small number of different types of symbolizer and then supplying parameters to override its default behaviour.

The text symbolizer describes how to display text labels and the like.

The details of this object are taken from the OGC Styled-Layer Descriptor Report (OGC 02-070) version 1.0.0.:


 <xsd:element name="TextSymbolizer" substitutionGroup="sld:Symbolizer">
 <xsd:annotation>
 <xsd:documentation>
 A "TextSymbolizer" is used to render text labels according to
 various graphical parameters.
 </xsd:documentation>
 </xsd:annotation>
 <xsd:complexType>
 <xsd:complexContent>
 <xsd:extension base="sld:SymbolizerType">
 <xsd:sequence>
 <xsd:element ref="sld:Geometry" minOccurs="0"/>
 <xsd:element ref="sld:Label" minOccurs="0"/>
 <xsd:element ref="sld:Font" minOccurs="0"/>
 <xsd:element ref="sld:LabelPlacement" minOccurs="0"/>
 <xsd:element ref="sld:Halo" minOccurs="0"/>
 <xsd:element ref="sld:Fill" minOccurs="0"/>
 </xsd:sequence>
 </xsd:extension>
 </xsd:complexContent>
 </xsd:complexType>
 </xsd:element>
 

Renderers can use this information when displaying styled features, though it must be remembered that not all renderers will be able to fully represent strokes as set out by this interface.

TextSymbolizer2.javaInterface
TextSymbolizerImpl.javaClass Provides a Java representation of an SLD TextSymbolizer that defines how text symbols should be rendered.
TextSymbolTest.javaClass Test for text symbols.
UserLayer.javaInterface A UserLayer allows a user-defined layer to be built from WFS and WCS data.
UserLayerImpl.javaClass DJB: on inlinefeature support: The inline features also lets you "sort of" make your WMS into a WFS-T. I was going to implement this after SLD POST on monday, but I was expecting the definition in the spec to be a bit "nicer".
UserLayerTest.javaClass
XmlnsNamespaceTest.javaClass Tests XMLNS attributes serialization that might be missed/ignored if the proper namespace is not specified.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.