org.geotools.styling
Interface Rule

All Superinterfaces:
Rule

public interface Rule
extends Rule

A rule is used to attach a condition to, and group, the individual symbolizers used for rendering. The Title and Abstract describe the rule and may be used to generate a legend, as may the LegendGraphic. The Filter, ElseFilter, MinScale and MaxScale elements allow the selection of features and rendering scales for a rule. The scale selection works as follows. When a map is to be rendered, the scale denominator is computed and all rules in all UserStyles that have a scale outside of the request range are dropped. (This also includes Rules that have an ElseFilter.) An ElseFilter is simply an ELSE condition to the conditions (Filters) of all other rules in the same UserStyle. The exact meaning of the ElseFilter is determined after Rules have been eliminated for not fitting the rendering scale. This definition of the behaviour of ElseFilters may seem a little strange, but it allows for scale-dependent and scale-independent ELSE conditions. For the Filter, only SqlExpression is available for specification, but this is a hack and should be replaced with Filter as defined in WFS. A missing Filter element means "always true". If a set of Rules has no ElseFilters, then some features may not be rendered (which is presumably the desired behavior). The Scales are actually scale denominators (as double floats), so "10e6" would be interpreted as 1:10M. A missing MinScale means there is no lower bound to the scale-denominator range (lim[x->0+](x)), and a missing MaxScale means there is no upper bound (infinity). 0.28mm

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


 <xsd:element name="Rule">
   <xsd:annotation>
     <xsd:documentation>
       A Rule is used to attach property/scale conditions to and group
       the individual symbolizers used for rendering.
     </xsd:documentation>
   </xsd:annotation>
   <xsd:complexType>
     <xsd:sequence>
       <xsd:element ref="sld:Name" minOccurs="0"/>
       <xsd:element ref="sld:Title" minOccurs="0"/>
       <xsd:element ref="sld:Abstract" minOccurs="0"/>
       <xsd:element ref="sld:LegendGraphic" minOccurs="0"/>
       <xsd:choice minOccurs="0">
         <xsd:element ref="ogc:Filter"/>
         <xsd:element ref="sld:ElseFilter"/>
       </xsd:choice>
       <xsd:element ref="sld:MinScaleDenominator" minOccurs="0"/>
       <xsd:element ref="sld:MaxScaleDenominator" minOccurs="0"/>
       <xsd:element ref="sld:Symbolizer" maxOccurs="unbounded"/>
     </xsd:sequence>
   </xsd:complexType>
 </xsd:element>
 


Method Summary
 void accept(StyleVisitor visitor)
          Used to traverse the style data structure.
 String getAbstract()
          Deprecated. use getDescription().getAbstract().getString()
 Description getDescription()
          Description for this rule.
 Filter getFilter()
          This is the filter used to select content for this rule to display
 GraphicLegend getLegend()
          Returns a small Graphic that could be used by the rendering engine to draw a legend window.
 Graphic[] getLegendGraphic()
          Deprecated. Please use getLegend
 OnLineResource getOnlineResource()
          It is common to have a style coming from a external xml file, this method provide a way to get the original source if there is one.
 Symbolizer[] getSymbolizers()
          The symbolizers contain the actual styling information for different geometry types.
 String getTitle()
          Deprecated. use getDescription().getTitle().getString()
 boolean hasElseFilter()
          Deprecated. Please use isElseFilter
 void setAbstract(String abstractStr)
          Deprecated. use getDescription().setAbstract()
 void setDescription(Description description)
          Description for this rule.
 void setElseFilter(boolean isElse)
           
 void setFilter(Filter filter)
          Filter used to select content for this rule to display.
 void setIsElseFilter(boolean isElse)
           
 void setLegend(GraphicLegend legend)
           
 void setLegendGraphic(Graphic[] graphics)
          Deprecated. Please use setLegend
 void setMaxScaleDenominator(double scale)
          The largest value for scale denominator at which symbolizers contained by this rule should be applied.
 void setMinScaleDenominator(double scale)
          The smallest value for scale denominator at which symbolizers contained by this rule should be applied.
 void setName(String name)
          Sets the name of the rule.
 void setOnlineResource(OnLineResource online)
           
 void setSymbolizers(Symbolizer[] symbolizers)
          Deprecated. please use symbolizers().addAll()
 void setTitle(String title)
          Sets the title.
 List<Symbolizer> symbolizers()
          Symbolizers used, in order, to portray the features selected by this rule.
 
Methods inherited from interface Rule
accept, getMaxScaleDenominator, getMinScaleDenominator, getName, isElseFilter
 

Method Detail

setName

void setName(String name)
Sets the name of the rule.

Parameters:
name - The name of the rule. This provides a way to identify a rule.

getDescription

Description getDescription()
Description for this rule.

Specified by:
getDescription in interface Rule
Returns:
Human readable description for use in user interfaces
Since:
2.5.x

setDescription

void setDescription(Description description)
Description for this rule.

Parameters:
description - Human readable title and abstract.

getTitle

String getTitle()
Deprecated. use getDescription().getTitle().getString()

Gets the title.

Returns:
The title of the rule. This is a brief, human readable, description of the rule.

setTitle

void setTitle(String title)
Sets the title.

Parameters:
title - The title of the rule. This is a brief, human readable, description of the rule.

getAbstract

String getAbstract()
Deprecated. use getDescription().getAbstract().getString()

Gets the abstract text for the rule.

Returns:
The abstract text, a more detailed description of the rule.

setAbstract

void setAbstract(String abstractStr)
Deprecated. use getDescription().setAbstract()

Sets the abstract text for the rule.

Parameters:
abstractStr - The abstract text, a more detailed description of the rule.

setMinScaleDenominator

void setMinScaleDenominator(double scale)
The smallest value for scale denominator at which symbolizers contained by this rule should be applied.

Parameters:
scale - The smallest (inclusive) denominator value that this rule will be active for.

setMaxScaleDenominator

void setMaxScaleDenominator(double scale)
The largest value for scale denominator at which symbolizers contained by this rule should be applied.

Parameters:
scale - The largest (exclusive) denominator value that this rule will be active for.

getFilter

Filter getFilter()
This is the filter used to select content for this rule to display

Specified by:
getFilter in interface Rule
Returns:
Filter use to select content for this rule to display, Filter.INCLUDES to include all content; or use Filter.EXCLUDES to mark this as an "else" Rule accepting all remaining content

setFilter

void setFilter(Filter filter)
Filter used to select content for this rule to display.

This filter is only consulted if isElseFilter is false.

Parameters:
filter -

hasElseFilter

boolean hasElseFilter()
Deprecated. Please use isElseFilter


setElseFilter

void setElseFilter(boolean isElse)
Parameters:
isElse - if this rule should accept any features not already rendered

setIsElseFilter

void setIsElseFilter(boolean isElse)
Parameters:
isElse -

getLegend

GraphicLegend getLegend()
Description copied from interface: Rule
Returns a small Graphic that could be used by the rendering engine to draw a legend window.

A nice user interface may want to present the user with a legend that indicates how features of a given type are being portrayed. Through its LegendGraphic property, a Rule may provide a custom picture to be used in such a legend window.

Specified by:
getLegend in interface Rule
Returns:

setLegend

void setLegend(GraphicLegend legend)
Parameters:
legend -

getLegendGraphic

Graphic[] getLegendGraphic()
Deprecated. Please use getLegend

A set of equivalent Graphics in different formats which can be used as a legend against features stylized by the symbolizers in this rule.

Returns:
A single Graphic matching the getLegend()

setLegendGraphic

void setLegendGraphic(Graphic[] graphics)
Deprecated. Please use setLegend

A set of equivalent Graphics in different formats which can be used as a legend against features stylized by the symbolizers in this rule.

Parameters:
graphics - Graphic objects; the first one will be used to configure getGraphicLenged

getSymbolizers

Symbolizer[] getSymbolizers()
The symbolizers contain the actual styling information for different geometry types. A single feature may be rendered by more than one of the symbolizers returned by this method. It is important that the symbolizers be applied in the order in which they are returned if the end result is to be as intended. All symbolizers should be applied to all features which make it through the filters in this rule regardless of the features' geometry. For example, a polygon symbolizer should be applied to line geometries and even points. If this is not the desired beaviour, ensure that either the filters block inappropriate features or that the FeatureTypeStyler which contains this rule has its FeatureTypeName or SemanticTypeIdentifier set appropriately.

Parameters:
Please - use symbolizers().toArray( new Symbolizer[0] )
Returns:
An array of symbolizers to be applied, in sequence, to all of the features addressed by the FeatureTypeStyler which contains this rule.

symbolizers

List<Symbolizer> symbolizers()
Symbolizers used, in order, to portray the features selected by this rule.

Please note that this list may be modified direct.

Specified by:
symbolizers in interface Rule
Returns:
the list of Symbolizer

setSymbolizers

void setSymbolizers(Symbolizer[] symbolizers)
Deprecated. please use symbolizers().addAll()

The symbolizers contain the actual styling information for different geometry types. A single feature may be rendered by more than one of the symbolizers returned by this method. It is important that the symbolizers be applied in the order in which they are returned if the end result is to be as intended. All symbolizers should be applied to all features which make it through the filters in this rule regardless of the features' geometry. For example, a polygon symbolizer should be applied to line geometries and even points. If this is not the desired beaviour, ensure that either the filters block inappropriate features or that the FeatureTypeStyler which contains this rule has its FeatureTypeName or SemanticTypeIdentifier set appropriately.

Parameters:
symbolizers - An array of symbolizers to be applied, in sequence, to all of the features addressed by the FeatureTypeStyler which contains this rule.

getOnlineResource

OnLineResource getOnlineResource()
Description copied from interface: Rule
It is common to have a style coming from a external xml file, this method provide a way to get the original source if there is one. OGC SLD specification can use this method to know if a style must be written completely or if writing the online resource path is enough.

Specified by:
getOnlineResource in interface Rule
Returns:
Location where this style is defined; file or server; or null if unknown

setOnlineResource

void setOnlineResource(OnLineResource online)
Parameters:
resource - Indicates where this style is defined

accept

void accept(StyleVisitor visitor)
Used to traverse the style data structure.

Parameters:
visitor -


Copyright © 1996-2014 Geotools. All Rights Reserved.