org.geotools.styling
Class RuleImpl

java.lang.Object
  extended by org.geotools.styling.RuleImpl
All Implemented Interfaces:
java.lang.Cloneable, org.opengis.style.Rule

public class RuleImpl
extends java.lang.Object
implements Rule, org.opengis.util.Cloneable

Provides the default implementation of Rule.

Version:
$Id: RuleImpl.java 33833 2009-09-04 12:26:28Z jive $
Author:
James Macgill, Johann Sorel (Geomatys)

Constructor Summary
protected RuleImpl()
          Creates a new instance of DefaultRule
  RuleImpl(org.opengis.style.Rule rule)
          Copy constructor
protected RuleImpl(Symbolizer[] symbolizers)
          Creates a new instance of DefaultRule
protected RuleImpl(Symbolizer[] symbolizers, org.opengis.style.Description desc, Graphic[] legends, java.lang.String name, org.opengis.filter.Filter filter, boolean isElseFilter, double maxScale, double minScale)
           
 
Method Summary
 void accept(StyleVisitor visitor)
          Used to traverse the style data structure.
 java.lang.Object accept(org.opengis.style.StyleVisitor visitor, java.lang.Object data)
           
 void addLegendGraphic(Graphic graphic)
          Deprecated. 
 void addSymbolizer(Symbolizer symb)
          Deprecated. 
 java.lang.Object clone()
          Creates a deep copy clone of the rule.
 boolean equals(java.lang.Object oth)
          Compares this Rule with another for equality.
 java.lang.String getAbstract()
          Getter for property abstractStr.
 DescriptionImpl getDescription()
          Description for this rule.
 org.opengis.filter.Filter getFilter()
          This is the filter used to select content for this rule to display
 org.opengis.style.GraphicLegend getLegend()
           
 Graphic[] getLegendGraphic()
          A set of equivalent Graphics in different formats which can be used as a legend against features stylized by the symbolizers in this rule.
 double getMaxScaleDenominator()
          Getter for property maxScaleDenominator.
 double getMinScaleDenominator()
          Getter for property minScaleDenominator.
 java.lang.String getName()
           
 org.opengis.metadata.citation.OnLineResource getOnlineResource()
           
 Symbolizer[] getSymbolizers()
          Deprecated. 
 java.lang.String getTitle()
          Getter for property title.
 boolean hasElseFilter()
          Deprecated. use isElseFilter instead.
 int hashCode()
          Generates a hashcode for the Rule.
 boolean isElseFilter()
           
 void setAbstract(java.lang.String abstractStr)
          Setter for property abstractStr.
 void setDescription(org.opengis.style.Description description)
          Description for this rule.
 void setElseFilter(boolean defaultb)
           
 void setFilter(org.opengis.filter.Filter filter)
          Filter used to select content for this rule to display.
 void setHasElseFilter()
          Deprecated. use setIsElseFilter(true)
 void setIsElseFilter(boolean flag)
           
 void setLegend(org.opengis.style.GraphicLegend legend)
           
 void setLegendGraphic(Graphic[] graphics)
          Deprecated. 
 void setMaxScaleDenominator(double maxScaleDenominator)
          Setter for property maxScaleDenominator.
 void setMinScaleDenominator(double minScaleDenominator)
          Setter for property minScaleDenominator.
 void setName(java.lang.String name)
          Sets the name of the rule.
 void setOnlineResource(org.opengis.metadata.citation.OnLineResource online)
           
 void setSymbolizers(Symbolizer[] syms)
          Deprecated. 
 void setTitle(java.lang.String title)
          Setter for property title.
 java.util.List<Symbolizer> symbolizers()
          Symbolizers used, in order, to portray the features selected by this rule.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RuleImpl

protected RuleImpl()
Creates a new instance of DefaultRule


RuleImpl

protected RuleImpl(Symbolizer[] symbolizers)
Creates a new instance of DefaultRule

Parameters:
symbolizers - DOCUMENT ME!

RuleImpl

protected RuleImpl(Symbolizer[] symbolizers,
                   org.opengis.style.Description desc,
                   Graphic[] legends,
                   java.lang.String name,
                   org.opengis.filter.Filter filter,
                   boolean isElseFilter,
                   double maxScale,
                   double minScale)

RuleImpl

public RuleImpl(org.opengis.style.Rule rule)
Copy constructor

Method Detail

getLegendGraphic

public Graphic[] getLegendGraphic()
Description copied from interface: Rule
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()

addLegendGraphic

@Deprecated
public void addLegendGraphic(Graphic graphic)
Deprecated. 


setLegendGraphic

@Deprecated
public void setLegendGraphic(Graphic[] graphics)
Deprecated. 

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 - An array of Graphic objects, any of which can be used as the legend.

getLegend

public org.opengis.style.GraphicLegend getLegend()
Specified by:
getLegend in interface org.opengis.style.Rule

setLegend

public void setLegend(org.opengis.style.GraphicLegend legend)

symbolizers

public java.util.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 org.opengis.style.Rule

addSymbolizer

@Deprecated
public void addSymbolizer(Symbolizer symb)
Deprecated. 


setSymbolizers

@Deprecated
public void setSymbolizers(Symbolizer[] syms)
Deprecated. 

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.

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

getSymbolizers

@Deprecated
public Symbolizer[] getSymbolizers()
Deprecated. 

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.

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 org.opengis.style.Rule
Returns:
Human readable description for use in user interfaces

setDescription

public void setDescription(org.opengis.style.Description description)
Description copied from interface: Rule
Description for this rule.

Parameters:
description - Human readable title and abstract.

getName

public java.lang.String getName()
Specified by:
getName in interface org.opengis.style.Rule

getAbstract

public java.lang.String getAbstract()
Getter for property abstractStr.

Returns:
Value of property abstractStr.

setName

public void setName(java.lang.String name)
Description copied from interface: Rule
Sets the name of the rule.

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

setAbstract

public void setAbstract(java.lang.String abstractStr)
Setter for property abstractStr.

Parameters:
abstractStr - New value of property abstractStr.

getTitle

public java.lang.String getTitle()
Getter for property title.

Returns:
Value of property title.

setTitle

public void setTitle(java.lang.String title)
Setter for property title.

Parameters:
title - New value of property title.

getFilter

public org.opengis.filter.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 org.opengis.style.Rule
Returns:
Filter use to select content for this rule to display, Filter.INCLUDES to include all content; of isElseFilter for null

setFilter

public void setFilter(org.opengis.filter.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.


isElseFilter

public boolean isElseFilter()
Specified by:
isElseFilter in interface org.opengis.style.Rule

hasElseFilter

@Deprecated
public boolean hasElseFilter()
Deprecated. use isElseFilter instead.


setIsElseFilter

public void setIsElseFilter(boolean flag)

setElseFilter

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

setHasElseFilter

@Deprecated
public void setHasElseFilter()
Deprecated. use setIsElseFilter(true)


getMaxScaleDenominator

public double getMaxScaleDenominator()
Getter for property maxScaleDenominator.

Specified by:
getMaxScaleDenominator in interface org.opengis.style.Rule
Returns:
Value of property maxScaleDenominator.

setMaxScaleDenominator

public void setMaxScaleDenominator(double maxScaleDenominator)
Setter for property maxScaleDenominator.

Parameters:
maxScaleDenominator - New value of property maxScaleDenominator.

getMinScaleDenominator

public double getMinScaleDenominator()
Getter for property minScaleDenominator.

Specified by:
getMinScaleDenominator in interface org.opengis.style.Rule
Returns:
Value of property minScaleDenominator.

setMinScaleDenominator

public void setMinScaleDenominator(double minScaleDenominator)
Setter for property minScaleDenominator.

Parameters:
minScaleDenominator - New value of property minScaleDenominator.

accept

public java.lang.Object accept(org.opengis.style.StyleVisitor visitor,
                               java.lang.Object data)
Specified by:
accept in interface org.opengis.style.Rule

accept

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


clone

public java.lang.Object clone()
Creates a deep copy clone of the rule.

Overrides:
clone in class java.lang.Object
See Also:
org.geotools.styling.Rule#clone()

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 java.lang.Object
Returns:
The hashcode.

equals

public boolean equals(java.lang.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 java.lang.Object
Parameters:
oth - The other rule to compare with.
Returns:
True if this and oth are equal.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getOnlineResource

public org.opengis.metadata.citation.OnLineResource getOnlineResource()
Specified by:
getOnlineResource in interface org.opengis.style.Rule
Returns:
Location where this style is defined; file or server; or null if unknown

setOnlineResource

public void setOnlineResource(org.opengis.metadata.citation.OnLineResource online)


Copyright © 1996-2010 Geotools. All Rights Reserved.