# OpenLayers.Rule

This class represents an SLD Rule, as being used for rule-based SLD styling.

Summary

OpenLayers.Rule | This class represents an SLD Rule, as being used for rule-based SLD styling.
Properties |
id | {String} A unique id for this session.
name | {String} name of this rule
title | {String} Title of this rule (set if included in SLD)
description | {String} Description of this rule (set if abstract is included in SLD)
context | {Object} An optional object with properties that the rule should be evaluated against.
filter | {OpenLayers.Filter} Optional filter for the rule.
elseFilter | {Boolean} Determines whether this rule is only to be applied only if no other rules match (ElseFilter according to the SLD specification).
symbolizer | {Object} Symbolizer or hash of symbolizers for this rule.
symbolizers | {Array} Collection of symbolizers associated with this rule.
minScaleDenominator | {Number} or {String} minimum scale at which to draw the feature.
maxScaleDenominator | {Number} or {String} maximum scale at which to draw the feature.
Constructor |
OpenLayers.Rule | Creates a Rule.
Functions |
destroy | nullify references to prevent circular references and memory leaks
evaluate | evaluates this rule for a specific feature
getContext | Gets the context for evaluating this rule
clone | Clones this rule.

### Properties

### id

{String} A unique id for this session.

### name

{String} name of this rule

### title

{String} Title of this rule (set if included in SLD)

### description

{String} Description of this rule (set if abstract is included in SLD)

### context

{Object} An optional object with properties that the rule should be evaluated against. If no context is specified, feature.attributes will be used.

### filter

{OpenLayers.Filter} Optional filter for the rule.

### elseFilter

{Boolean} Determines whether this rule is only to be applied only if no other rules match (ElseFilter according to the SLD specification). Default is false. For instances of OpenLayers.Rule, if elseFilter is false, the rule will always apply. For subclasses, the else property is ignored.

### symbolizer

{Object} Symbolizer or hash of symbolizers for this rule. If hash of symbolizers, keys are one or more of [“Point”, “Line”, “Polygon”]. The latter if useful if it is required to style e.g. vertices of a line with a point symbolizer. Note, however, that this is not implemented yet in OpenLayers, but it is the way how symbolizers are defined in SLD.

### symbolizers

{Array} Collection of symbolizers associated with this rule. If provided at construction, the symbolizers array has precedence over the deprecated symbolizer property. Note that multiple symbolizers are not currently supported by the vector renderers. Rules with multiple symbolizers are currently only useful for maintaining elements in an SLD document.

### minScaleDenominator

{Number} or {String} minimum scale at which to draw the feature. In the case of a String, this can be a combination of text and propertyNames in the form “literal ${propertyName}”

### maxScaleDenominator

{Number} or {String} maximum scale at which to draw the feature. In the case of a String, this can be a combination of text and propertyNames in the form “literal ${propertyName}”

### Constructor

### OpenLayers.Rule

Creates a Rule.

#### Parameters

options | {Object} An optional object with properties to set on the rule

#### Returns

{OpenLayers.Rule}

### Functions

### destroy

> destroy: function()

nullify references to prevent circular references and memory leaks

### evaluate

> evaluate: function( | feature | )

evaluates this rule for a specific feature

#### Parameters

feature | {OpenLayers.Feature} feature to apply the rule to.

#### Returns

{Boolean} true if the rule applies, false if it does not. This rule is the default rule and always returns true.

### getContext

> getContext: function( | feature | )

Gets the context for evaluating this rule

#### Paramters

feature | {OpenLayers.Feature} feature to take the context from if none is specified.

### clone

> clone: function()

Clones this rule.

#### Returns

{OpenLayers.Rule} Clone of this rule.

This class represents an OGC Filter.

> destroy: function()

nullify references to prevent circular references and memory leaks

> evaluate: function( | feature | )

evaluates this rule for a specific feature

> getContext: function( | feature | )

Gets the context for evaluating this rule

> clone: function()

Clones this rule.
Creates a Rule.
Features are combinations of geography and attributes.
Close