Interface Rule

  • @XmlElement("Rule")
    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.
    GeoAPI 2.2
    • Method Detail

      • getLegend

        GraphicLegend getLegend()
        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.

      • getFilter

        Filter getFilter()
        Returns the filter that will limit the features for which this Rule will fire. This can only be non-null if isElseFilter() returns false. If this value is null and isElseFilter is false, this means that this Rule should fire for all features.
        Filter, use Filter.INCLUDES to indicate everything; or Filter.EXCLUDES for an "else" rule
      • isElseFilter

        boolean isElseFilter()
        Returns true if this Rule 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.
        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 this Rule will fire. If, for example, the MinScaleDenominator 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.
        Min scale double value
      • getMaxScaleDenominator

        double getMaxScaleDenominator()
        Returns the maximum value (exclusive) in the denominator of the current map scale at which this Rule will fire. If, for example, the MaxScaleDenominator were 98765, then this rule would only fire at scales of 1:X where X is less than 98765. A value of Double.POSITIVE_INFINITY indicates that there is no maximum.
        Max scale double value
      • symbolizers

        List<? extends Symbolizer> symbolizers()
        This method returns the list of Symbolizer objects contained by this Rule. We use a list of <? extends Symbolizer> to enable the possibility for an implementation to return a special type of Symbolizer. This doesn't mean a Rule must return a list of PointSymbolizer or TextSymbolizer only, no. The purpose of this if to offer the solution to return different implementations like MutableSymbolizer or RichSymbolizer and then avoid redundant cast in the code. If you don't intend to use a special interface you can override this method by symbolizers();
        the list of Symbolizer
      • getOnlineResource

        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. 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.
        OnlineResource or null
      • accept

        Object accept​(StyleVisitor visitor,
                      Object extraData)
        calls the visit method of a StyleVisitor
        visitor - the style visitor