Class RuleImpl

Object
RuleImpl
All Implemented Interfaces:
Cloneable, Rule, Cloneable

public class RuleImpl extends Object implements Rule, Cloneable
Provides the default implementation of Rule.
Author:
James Macgill, Johann Sorel (Geomatys)
  • Field Details

  • Constructor Details

    • RuleImpl

      protected RuleImpl()
      Creates a new instance of DefaultRule
    • RuleImpl

      protected RuleImpl(Symbolizer... symbolizers)
      Creates a new instance of DefaultRule
    • RuleImpl

      protected RuleImpl(Symbolizer[] symbolizers, Description desc, Graphic legend, String name, Filter filter, boolean isElseFilter, double maxScale, double minScale)
    • RuleImpl

      public RuleImpl(Rule rule)
      Copy constructor
  • Method Details

    • getLegend

      public GraphicLegend getLegend()
      Specified by:
      getLegend in interface Rule
    • setLegend

      public void setLegend(GraphicLegend legend)
      Specified by:
      setLegend in interface Rule
    • symbolizers

      public List<Symbolizer> symbolizers()
      Description copied from interface: Rule
      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
    • getSymbolizers

      public Symbolizer[] getSymbolizers()
      Description copied from interface: Rule
      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.
      Specified by:
      getSymbolizers in interface Rule
      Returns:
      An array of symbolizers to be applied, in sequence, to all of the features addressed by the FeatureTypeStyler which contains this rule.
    • getDescription

      public DescriptionImpl getDescription()
      Description copied from interface: Rule
      Description for this rule.
      Specified by:
      getDescription in interface Rule
      Returns:
      Human readable description for use in user interfaces
    • setDescription

      public void setDescription(Description description)
      Description copied from interface: Rule
      Description for this rule.
      Specified by:
      setDescription in interface Rule
      Parameters:
      description - Human readable title and abstract.
    • getName

      public String getName()
      Description copied from interface: Rule
      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.)
      Specified by:
      getName in interface Rule
      Returns:
      a name for this rule.
    • setName

      public void setName(String name)
      Description copied from interface: Rule
      Sets the name of the rule.
      Specified by:
      setName in interface Rule
      Parameters:
      name - The name of the rule. This provides a way to identify a rule.
    • getFilter

      public Filter getFilter()
      Description copied from interface: Rule
      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

      public void setFilter(Filter filter)
      Description copied from interface: Rule
      Filter used to select content for this rule to display.

      This filter is only consulted if isElseFilter is false.

      Specified by:
      setFilter in interface Rule
    • isElseFilter

      public boolean isElseFilter()
      Description copied from interface: Rule
      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.
      Specified by:
      isElseFilter in interface Rule
      Returns:
      true if the filter is an else filter
    • setElseFilter

      public void setElseFilter(boolean defaultb)
      Specified by:
      setElseFilter in interface Rule
      Parameters:
      defaultb - if this rule should accept any features not already rendered
    • getMaxScaleDenominator

      public double getMaxScaleDenominator()
      Getter for property maxScaleDenominator.
      Specified by:
      getMaxScaleDenominator in interface Rule
      Returns:
      Value of property maxScaleDenominator.
    • setMaxScaleDenominator

      public void setMaxScaleDenominator(double maxScaleDenominator)
      Setter for property maxScaleDenominator.
      Specified by:
      setMaxScaleDenominator in interface Rule
      Parameters:
      maxScaleDenominator - New value of property maxScaleDenominator.
    • getMinScaleDenominator

      public double getMinScaleDenominator()
      Getter for property minScaleDenominator.
      Specified by:
      getMinScaleDenominator in interface Rule
      Returns:
      Value of property minScaleDenominator.
    • setMinScaleDenominator

      public void setMinScaleDenominator(double minScaleDenominator)
      Setter for property minScaleDenominator.
      Specified by:
      setMinScaleDenominator in interface Rule
      Parameters:
      minScaleDenominator - New value of property minScaleDenominator.
    • accept

      public Object accept(TraversingStyleVisitor visitor, Object data)
      Description copied from interface: Rule
      calls the visit method of a StyleVisitor
      Specified by:
      accept in interface Rule
      Parameters:
      visitor - the style visitor
    • accept

      public void accept(StyleVisitor visitor)
      Description copied from interface: Rule
      Used to traverse the style data structure.
      Specified by:
      accept in interface Rule
    • clone

      public Object clone()
      Creates a deep copy clone of the rule.
      Specified by:
      clone in interface Cloneable
      Overrides:
      clone in class Object
      Returns:
      A copy of this object.
      See Also:
    • hashCode

      public int hashCode()
      Generates a hashcode for the Rule.

      For complex styles this can be an expensive operation since the hash code is computed using all the hashcodes of the object within the style.

      Overrides:
      hashCode in class Object
      Returns:
      The hashcode.
    • equals

      public boolean equals(Object oth)
      Compares this Rule with another for equality.

      Two RuleImpls are equal if all their properties are equal.

      For complex styles this can be an expensive operation since it checks all objects for equality.

      Overrides:
      equals in class Object
      Parameters:
      oth - The other rule to compare with.
      Returns:
      True if this and oth are equal.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getOnlineResource

      public OnLineResource getOnlineResource()
      Specified by:
      getOnlineResource in interface Rule
      Returns:
      Location where this style is defined; file or server; or null if unknown
    • setOnlineResource

      public void setOnlineResource(OnLineResource online)
      Specified by:
      setOnlineResource in interface Rule
      Parameters:
      online - Indicates where this style is defined
    • hasOption

      public boolean hasOption(String key)
      Description copied from interface: Rule
      Determines if a vendor option with the specific key has been set on this Rule.
      Specified by:
      hasOption in interface Rule
    • getOptions

      public Map<String,String> getOptions()
      Description copied from interface: Rule
      Map of vendor options for the Rule.

      Client code looking for the existence of a single option should use Rule.hasOption(String)

      Specified by:
      getOptions in interface Rule