# OpenLayers.Style

This class represents a UserStyle obtained from a SLD, containing styling rules.

Summary

OpenLayers.Style | This class represents a UserStyle obtained from a SLD, containing styling rules.
Properties |
name | {String}
layerName | {String} name of the layer that this style belongs to, usually according to the NamedLayer attribute of an SLD document.
isDefault | {Boolean}
context | {Object} An optional object with properties that symbolizers’ property values should be evaluated against.
Constructor |
OpenLayers.Style | Creates a UserStyle.
Functions |
destroy | nullify references to prevent circular references and memory leaks
addRules | Adds rules to this style.
setDefaultStyle | Sets the default style for this style object.
clone | Clones this style.
Constants |
OpenLayers.Style.SYMBOLIZER_PREFIXES | {Array} prefixes of the sld symbolizers.

### Properties

### name

{String}

### layerName

{String} name of the layer that this style belongs to, usually according to the NamedLayer attribute of an SLD document.

### isDefault

{Boolean}

### context

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

### Constructor

### OpenLayers.Style

Creates a UserStyle.

#### Parameters

style | {Object} Optional hash of style properties that will be used as default style for this style object. This style applies if no rules are specified. Symbolizers defined in rules will extend this default style.
options | {Object} An optional object with properties to set on the style.

#### Valid options

rules | {Array(OpenLayers.Rule)} List of rules to be added to the style.

#### Returns

{OpenLayers.Style}

### Functions

### destroy

> destroy: function()

nullify references to prevent circular references and memory leaks

### addRules

> addRules: function( | rules | )

Adds rules to this style.

#### Parameters

rules | {Array(OpenLayers.Rule)}

### setDefaultStyle

> setDefaultStyle: function( | style | )

Sets the default style for this style object.

#### Parameters

style | {Object} Hash of style properties

### clone

> clone: function()

Clones this style.

#### Returns

{OpenLayers.Style} Clone of this style.

### Constants

### OpenLayers.Style.SYMBOLIZER_PREFIXES

{Array} prefixes of the sld symbolizers. These are the same as the main geometry types

Contains convenience functions for string manipulation.

> destroy: function()

nullify references to prevent circular references and memory leaks

> addRules: function( | rules | )

Adds rules to this style.

> setDefaultStyle: function( | style | )

Sets the default style for this style object.

> clone: function()

Clones this style.
This class represents an SLD Rule, as being used for rule-based SLD styling.
Creates a UserStyle.
Close