OpenLayers.Control.SLDSelect - OpenLayers

# OpenLayers.Control.SLDSelect

Perform selections on WMS layers using Styled Layer Descriptor (SLD)

#### Inherits from

- OpenLayers.Control

Summary

OpenLayers.Control.SLDSelect | Perform selections on WMS layers using Styled Layer Descriptor (SLD)
Properties |
events | {OpenLayers.Events} Events instance for listeners and triggering control specific events.
clearOnDeactivate | {Boolean} Should the selection be cleared when the control is deactivated.
layers | {Array(OpenLayers.Layer.WMS)} The WMS layers this control will work on.
callbacks | {Object} The functions that are sent to the handler for callback
selectionSymbolizer | {Object} Determines the styling of the selected objects.
layerOptions | {Object} The options to apply to the selection layer, by default the selection layer will be kept out of the layer switcher.
handlerOptions | {Object} Used to set non-default properties on the control’s handler
sketchStyle | {<OpenLayers.Style>|Object} Style or symbolizer to use for the sketch handler.
wfsCache | {Object} Cache to use for storing parsed results from OpenLayers.Format.WFSDescribeFeatureType.read.
layerCache | {Object} Cache to use for storing references to the selection layers.
Constructor |
OpenLayers.Control.SLDSelect | Create a new control for selecting features in WMS layers using Styled Layer Descriptor (SLD).
Functions |
destroy | Take care of things that are not handled in superclass.
coupleLayerVisiblity | Couple the selection layer and the source layer with respect to layer visibility.
createSelectionLayer | Creates a “clone” from the source layer in which the selection can be drawn.
createSLD | Create the SLD document for the layer using the supplied filters.
parseDescribeLayer | Parse the SLD WMS DescribeLayer response and issue the corresponding WFS DescribeFeatureType request
getGeometryAttributes | Look up the geometry attributes from the WFS DescribeFeatureType response
activate | Activate the control.
deactivate | Deactivate the control.
setLayers | Set the layers on which the selection should be performed.
createFilter | Create the filter to be used in the SLD.
select | When the handler is done, use SLD_BODY on the selection layer to display the selection in the map.
applySelection | Checks if all required wfs data is cached, and applies the selection

### Properties

### events

{OpenLayers.Events} Events instance for listeners and triggering control specific events.

#### Register a listener for a particular event with the following syntax

>     control.events.register(type, obj, listener);

#### Supported event types (in addition to those from OpenLayers.Control.events)

selected | Triggered when a selection occurs. Listeners receive an event with filters and layer properties. Filters will be an array of OpenLayers.Filter objects created in order to perform the particular selection.

### clearOnDeactivate

{Boolean} Should the selection be cleared when the control is deactivated. Default value is false.

### layers

{Array(OpenLayers.Layer.WMS)} The WMS layers this control will work on.

### callbacks

{Object} The functions that are sent to the handler for callback

### selectionSymbolizer

{Object} Determines the styling of the selected objects. Default is a selection in red.

### layerOptions

{Object} The options to apply to the selection layer, by default the selection layer will be kept out of the layer switcher.

### handlerOptions

{Object} Used to set non-default properties on the control’s handler

### sketchStyle

{<OpenLayers.Style>|Object} Style or symbolizer to use for the sketch handler. The recommended way of styling the sketch layer, however, is to configure an OpenLayers.StyleMap in the layerOptions of the handlerOptions:

>     new OpenLayers.Control.SLDSelect(OpenLayers.Handler.Path, {
>         handlerOptions: {
>             layerOptions: {
>                 styleMap: new OpenLayers.StyleMap({
>                     "default": {strokeColor: "yellow"}
>                 })
>             }
>         }
>     });

### wfsCache

{Object} Cache to use for storing parsed results from OpenLayers.Format.WFSDescribeFeatureType.read. If not provided, these will be cached on the prototype.

### layerCache

{Object} Cache to use for storing references to the selection layers. Normally each source layer will have exactly 1 selection layer of type OpenLayers.Layer.WMS. If not provided, layers will be cached on the prototype. Note that if clearOnDeactivate is true, the layer will no longer be cached after deactivating the control.

### Constructor

### OpenLayers.Control.SLDSelect

Create a new control for selecting features in WMS layers using Styled Layer Descriptor (SLD).

#### Parameters

handler | {OpenLayers.Class} A sketch handler class. This determines the type of selection, e.g. box (OpenLayers.Handler.Box), point (OpenLayers.Handler.Point), path (OpenLayers.Handler.Path) or polygon (OpenLayers.Handler.Polygon) selection. To use circle type selection, use OpenLayers.Handler.RegularPolygon and pass the number of desired sides (e.g. 40) as “sides” property to the handlerOptions.
options | {Object} An object containing all configuration properties for the control.

#### Valid options

layers | Array({OpenLayers.Layer.WMS}) The layers to perform the selection on.

### Functions

### destroy

> destroy: function()

Take care of things that are not handled in superclass.

### coupleLayerVisiblity

> coupleLayerVisiblity: function( | evt | )

Couple the selection layer and the source layer with respect to layer visibility. So if the source layer is turned off, the selection layer is also turned off.

#### Context

- {OpenLayers.Layer}

#### Parameters

evt | {Object}

### createSelectionLayer

> createSelectionLayer: function( | source | )

Creates a “clone” from the source layer in which the selection can be drawn. This ensures both the source layer and the selection are visible and not only the selection.

#### Parameters

source | {OpenLayers.Layer.WMS} The source layer on which the selection is performed.

#### Returns

{OpenLayers.Layer.WMS} A WMS layer with maxGetUrlLength configured to 2048 since SLD selections can easily get quite long.

### createSLD

> createSLD: function( | layer,
> | filters,
> | geometryAttributes | )

Create the SLD document for the layer using the supplied filters.

#### Parameters

layer | {OpenLayers.Layer.WMS}
filters | Array({OpenLayers.Filter}) The filters to be applied.
geometryAttributes | Array({Object}) The geometry attributes of the layer.

#### Returns

{String} The SLD document generated as a string.

### parseDescribeLayer

> parseDescribeLayer: function( | request | )

Parse the SLD WMS DescribeLayer response and issue the corresponding WFS DescribeFeatureType request

request | {XMLHttpRequest} The request object.

### getGeometryAttributes

> getGeometryAttributes: function( | layer | )

Look up the geometry attributes from the WFS DescribeFeatureType response

#### Parameters

layer | {OpenLayers.Layer.WMS} The layer for which to look up the geometry attributes.

#### Returns

Array({Object}) Array of geometry attributes

### activate

> activate: function()

Activate the control. Activating the control will perform a SLD WMS DescribeLayer request followed by a WFS DescribeFeatureType request so that the proper symbolizers can be chosen based on the geometry type.

### deactivate

> deactivate: function()

Deactivate the control. If clearOnDeactivate is true, remove the selection layer(s).

### setLayers

> setLayers: function( | layers | )

Set the layers on which the selection should be performed. Call the setLayers method if the layer(s) to be used change and the same control should be used on a new set of layers. If the control is already active, it will be active after the new set of layers is set.

#### Parameters

layers | {Array(OpenLayers.Layer.WMS)} The new set of layers on which the selection should be performed.

### createFilter

> createFilter: function( | geometryAttribute,
> | geometry | )

Create the filter to be used in the SLD.

#### Parameters

geometryAttribute | {Object} Used to get the name of the geometry attribute which is needed for constructing the spatial filter.
geometry | {OpenLayers.Geometry} The geometry to use.

#### Returns

{OpenLayers.Filter.Spatial} The spatial filter created.

### select

> select: function( | geometry | )

When the handler is done, use SLD_BODY on the selection layer to display the selection in the map.

#### Parameters

geometry | {Object} or {OpenLayers.Geometry}

### applySelection

> applySelection: function()

Checks if all required wfs data is cached, and applies the selection

Instances of OpenLayers.Layer.WMS are used to display data from OGC Web Mapping Services.

> read: function( | data | )

> destroy: function()

Take care of things that are not handled in superclass.

> coupleLayerVisiblity: function( | evt | )

Couple the selection layer and the source layer with respect to layer visibility.

> createSelectionLayer: function( | source | )

Creates a “clone” from the source layer in which the selection can be drawn.

> createSLD: function( | layer,
> | filters,
> | geometryAttributes | )

Create the SLD document for the layer using the supplied filters.

> parseDescribeLayer: function( | request | )

Parse the SLD WMS DescribeLayer response and issue the corresponding WFS DescribeFeatureType request

> getGeometryAttributes: function( | layer | )

Look up the geometry attributes from the WFS DescribeFeatureType response

> activate: function()

Activate the control.

> deactivate: function()

Deactivate the control.

> setLayers: function( | layers | )

Set the layers on which the selection should be performed.

> createFilter: function( | geometryAttribute,
> | geometry | )

Create the filter to be used in the SLD.

> select: function( | geometry | )

When the handler is done, use SLD_BODY on the selection layer to display the selection in the map.

> applySelection: function()

Checks if all required wfs data is cached, and applies the selection
Controls affect the display or behavior of the map.
{OpenLayers.Events} Events instance for listeners and triggering control specific events.
{Object} Used to set non-default properties on the control’s handler
{Boolean} Should the selection be cleared when the control is deactivated.
Handler for dragging a rectangle across the map.
Handler to draw a point on the map.
Handler to draw a path on the map.
Handler to draw a polygon on the map.
Handler to draw a regular polygon on the map.
This class represents an OGC Filter.
A Geometry is a description of a geographic object.
This class represents a spatial filter.
Close