Package org.geotools.api.style
Interface Rule
- All Known Implementing Classes:
RuleImpl
public interface Rule
A rule consists of two important parts: a filter and a list of symbols. When
it is time to draw a given feature, the rendering engine examines each rule in the FeatureStyle, first checking its
Filter (or ElseFilter). If the Filter passes, then every Symbolizer for that rule is applied to the given feature.
- Since:
- GeoAPI 2.2
- Author:
- Open Geospatial Consortium, Johann Sorel (Geomatys), Chris Dillard (SYS Technologies)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(StyleVisitor visitor) Used to traverse the style data structure.accept
(TraversingStyleVisitor visitor, Object extraData) calls the visit method of a StyleVisitorDescription for this rule.This is the filter used to select content for this rule to displaydouble
Returns the maximum value (exclusive) in the denominator of the current map scale at which thisRule
will fire.double
Returns the minimum value (inclusive) in the denominator of the current map scale at which thisRule
will fire.getName()
Returns a name for this rule.Map of vendor options for the Rule.The symbolizers contain the actual styling information for different geometry types.default boolean
Determines if a vendor option with the specific key has been set on this Rule.boolean
Returns true if thisRule
is to fire only if no other rules in the containing style have fired yet.void
setDescription
(Description description) Description for this rule.void
setElseFilter
(boolean isElse) void
Filter used to select content for this rule to display.void
setLegend
(GraphicLegend legend) 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
Sets the name of the rule.void
setOnlineResource
(OnLineResource resource) Symbolizers used, in order, to portray the features selected by this rule.
-
Method Details
-
getName
String getName()Returns a name for this rule. This can be any string that uniquely identifies this rule within a given canvas. It is not meant to be human-friendly. (The "title" property is meant to be human friendly.)- Returns:
- a name for this rule.
-
setName
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.- Returns:
- Human readable description for use in user interfaces
- Since:
- 2.5.x
-
setFilter
Filter used to select content for this rule to display.This filter is only consulted if isElseFilter is false.
-
setElseFilter
void setElseFilter(boolean isElse) - Parameters:
isElse
- if this rule should accept any features not already rendered
-
getLegend
GraphicLegend getLegend() -
setDescription
Description for this rule.- Parameters:
description
- Human readable title and abstract.
-
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- 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
-
isElseFilter
boolean isElseFilter()Returns true if thisRule
is to fire only if no other rules in the containing style have fired yet. If this is true, then the filter must be Filter.EXCLUDES.- Returns:
- true if the filter is an else filter
-
getMinScaleDenominator
double getMinScaleDenominator()Returns the minimum value (inclusive) in the denominator of the current map scale at which thisRule
will fire. If, for example, theMinScaleDenominator
were 10000, then this rule would only fire at scales of 1:X where X is greater than 10000. A value of zero indicates that there is no minimum.- Returns:
- Min scale double value
-
getMaxScaleDenominator
double getMaxScaleDenominator()Returns the maximum value (exclusive) in the denominator of the current map scale at which thisRule
will fire. If, for example, theMaxScaleDenominator
were 98765, then this rule would only fire at scales of 1:X where X is less than 98765. A value ofDouble.POSITIVE_INFINITY
indicates that there is no maximum.- Returns:
- Max scale double value
-
setLegend
- Parameters:
legend
-
-
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.- 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.
-
getOnlineResource
OnLineResource getOnlineResource()- Returns:
- Location where this style is defined; file or server; or null if unknown
-
accept
calls the visit method of a StyleVisitor- Parameters:
visitor
- the style visitor
-
setOnlineResource
- Parameters:
resource
- Indicates where this style is defined
-
hasOption
Determines if a vendor option with the specific key has been set on this Rule. -
getOptions
Map of vendor options for the Rule.Client code looking for the existence of a single option should use
hasOption(String)
-
accept
Used to traverse the style data structure.
-