Package sld :: Class Filter
[hide private]
[frames] | no frames]

Class Filter

source code


A filter object that stores the property comparitors. A Filter is a child of a Rule element. Filter nodes are pythonic, and have some syntactic sugar that allows the creation of simple logical combinations.

To create an AND logical filter, use the '+' operator:

>>> rule.Filter = filter1 + filter2

To create an OR logical filter, use the '|' operator:

>>> rule.Filter = filter1 | filter2

Complex combinations can be created by chaining these operations together:

>>> rule.Filter = filter1 | (filter2 + filter3)

Properties:
Instance Methods [hide private]
 
__init__(self, parent, descendant=True)
Create a new Filter node.
source code
Filter
__add__(self, other)
Add two filters together to create one AND logical filter.
source code
Filter
__or__(self, other)
Or two filters together to create on OR logical filter.
source code
PropertyCriterion
__getattr__(self, name)
Get a named attribute from this Filter instance.
source code
 
__setattr__(self, name, value)
Set a named attribute on this Filter instance.
source code
 
__delattr__(self, name)
Delete the property from the Filter.
source code

Inherited from SLDNode: create_element, get_or_create_element

Inherited from object: __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]

Inherited from SLDNode: makeproperty

Class Variables [hide private]

Inherited from SLDNode (private): _nsmap

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, parent, descendant=True)
(Constructor)

source code 

Create a new Filter node.

Parameters:
  • parent (Rule) - The parent class object.
  • descendant (boolean) - A flag indicating if this is a descendant node of the parent.
Overrides: object.__init__

__add__(self, other)
(Addition operator)

source code 

Add two filters together to create one AND logical filter.

Parameters:
  • other (Filter) - A filter to AND with this one.
Returns: Filter
A new filter with an ogc:And element as its child.

__or__(self, other)
(Or operator)

source code 

Or two filters together to create on OR logical filter.

Parameters:
  • other (Filter) - A filter to OR with this one.
Returns: Filter
A new filter with an ogc:Or element as its child.

__getattr__(self, name)
(Qualification operator)

source code 

Get a named attribute from this Filter instance. This method allows properties with the prefix of 'PropertyIs' to be set, and raises an AttributeError for all other property names.

Parameters:
  • name (string) - The name of the property.
Returns: PropertyCriterion
The property comparitor.

__setattr__(self, name, value)

source code 

Set a named attribute on this Filter instance. If the property name begins with 'PropertyIs', the node value will be appended to the filter.

Parameters:
  • name (string) - The name of the property.
  • value (PropertyCriterion) - The new property comparitor.
Overrides: object.__setattr__

__delattr__(self, name)

source code 

Delete the property from the Filter. This removes the child node of this name from the Filter.

Parameters:
  • name (string) - The name of the property.
Overrides: object.__delattr__