OpenLayers.Control.SelectFeature - OpenLayers

# OpenLayers. Control. SelectFeature

Selects vector features from a given layer on click or hover.

#### Inherits from

- OpenLayers.Control

Summary

OpenLayers. Control. SelectFeature | Selects vector features from a given layer on click or hover.
Properties |
multipleKey | {String} An event modifier (‘altKey’ or ‘shiftKey’) that temporarily sets the multiple property to true.
toggleKey | {String} An event modifier (‘altKey’ or ‘shiftKey’) that temporarily sets the toggle property to true.
multiple | {Boolean} Allow selection of multiple geometries.
clickout | {Boolean} Unselect features when clicking outside any feature.
toggle | {Boolean} Unselect a selected feature on click.
hover | {Boolean} Select on mouse over and deselect on mouse out.
box | {Boolean} Allow feature selection by drawing a box.
onSelect | {Function} Optional function to be called when a feature is selected.
onUnselect | {Function} Optional function to be called when a feature is unselected.
geometryTypes | {Array(String)} To restrict selecting to a limited set of geometry types, send a list of strings corresponding to the geometry class names.
layer | {OpenLayers.Layer.Vector}
callbacks | {Object} The functions that are sent to the handlers.feature for callback
selectStyle | {Object} Hash of styles
renderIntent | {String} key used to retrieve the select style from the layer’s style map.
handlers | {Object} Object with references to multiple OpenLayers.Handler instances.
Constructor |
<OpenLayers. Control. SelectFeature> |
Functions |
activate | Activates the control.
deactivate | Deactivates the control.
unselectAll | Unselect all selected features.
clickFeature | Called on click in a feature Only responds if this.hover is false.
multipleSelect | Allow for multiple selected features based on multiple property and multipleKey event modifier.
toggleSelect | Event should toggle the selected state of a feature based on toggle property and toggleKey event modifier.
clickoutFeature | Called on click outside a previously clicked (selected) feature.
overFeature | Called on over a feature.
outFeature | Called on out of a selected feature.
select | Add feature to the layer’s selectedFeature array, render the feature as selected, and call the onSelect function.
unselect | Remove feature from the layer’s selectedFeature array, render the feature as normal, and call the onUnselect function.
selectBox | Callback from the handlers.box set up when box selection is true on.
setMap | Set the map property for the control.

### Properties

### multipleKey

{String} An event modifier (‘altKey’ or ‘shiftKey’) that temporarily sets the multiple property to true. Default is null.

### toggleKey

{String} An event modifier (‘altKey’ or ‘shiftKey’) that temporarily sets the toggle property to true. Default is null.

### multiple

{Boolean} Allow selection of multiple geometries. Default is false.

### clickout

{Boolean} Unselect features when clicking outside any feature. Default is true.

### toggle

{Boolean} Unselect a selected feature on click. Default is false. Only has meaning if hover is false.

### hover

{Boolean} Select on mouse over and deselect on mouse out. If true, this ignores clicks and only listens to mouse moves.

### box

{Boolean} Allow feature selection by drawing a box.

### onSelect

{Function} Optional function to be called when a feature is selected. The function should expect to be called with a feature.

### onUnselect

{Function} Optional function to be called when a feature is unselected. The function should expect to be called with a feature.

### geometryTypes

{Array(String)} To restrict selecting to a limited set of geometry types, send a list of strings corresponding to the geometry class names.

### layer

{OpenLayers.Layer.Vector}

### callbacks

{Object} The functions that are sent to the handlers.feature for callback

### selectStyle

{Object} Hash of styles

### renderIntent

{String} key used to retrieve the select style from the layer’s style map.

### handlers

{Object} Object with references to multiple OpenLayers.Handler instances.

### Constructor

### <OpenLayers. Control. SelectFeature>

#### Parameters

layer | {OpenLayers.Layer.Vector}
options | {Object}

### Functions

### activate

> activate: function ()

Activates the control.

#### Returns

{Boolean} The control was effectively activated.

### deactivate

> deactivate: function ()

Deactivates the control.

#### Returns

{Boolean} The control was effectively deactivated.

### unselectAll

> unselectAll: function( | options | )

Unselect all selected features. To unselect all except for a single feature, set the options.except property to the feature.

#### Parameters

options | {Object} Optional configuration object.

### clickFeature

> clickFeature: function( | feature | )

Called on click in a feature Only responds if this.hover is false.

#### Parameters

feature | {OpenLayers.Feature.Vector}

### multipleSelect

> multipleSelect: function()

Allow for multiple selected features based on multiple property and multipleKey event modifier.

#### Returns

{Boolean} Allow for multiple selected features.

### toggleSelect

> toggleSelect: function()

Event should toggle the selected state of a feature based on toggle property and toggleKey event modifier.

#### Returns

{Boolean} Toggle the selected state of a feature.

### clickoutFeature

> clickoutFeature: function( | feature | )

Called on click outside a previously clicked (selected) feature. Only responds if this.hover is false.

#### Parameters

feature | {<OpenLayers.Vector.Feature>}

### overFeature

> overFeature: function( | feature | )

Called on over a feature. Only responds if this.hover is true.

#### Parameters

feature | {OpenLayers.Feature.Vector}

### outFeature

> outFeature: function( | feature | )

Called on out of a selected feature. Only responds if this.hover is true.

#### Parameters

feature | {OpenLayers.Feature.Vector}

### select

> select: function( | feature | )

Add feature to the layer’s selectedFeature array, render the feature as selected, and call the onSelect function.

#### Parameters

feature | {OpenLayers.Feature.Vector}

### unselect

> unselect: function( | feature | )

Remove feature from the layer’s selectedFeature array, render the feature as normal, and call the onUnselect function.

#### Parameters

feature | {OpenLayers.Feature.Vector}

### selectBox

> selectBox: function( | position | )

Callback from the handlers.box set up when box selection is true on.

#### Parameters

position | {OpenLayers.Bounds || OpenLayers.Pixel }

### setMap

> setMap: function( | map | )

Set the map property for the control.

#### Parameters

map | {OpenLayers.Map}

{Boolean} Allow selection of multiple geometries.
{Boolean} Unselect a selected feature on click.
Instances of OpenLayers.Layer.Vector are used to render vector data from a variety of sources.
Base class to construct a higher-level handler for event sequences.

> activate: function ()

Activates the control.

> deactivate: function ()

Deactivates the control.

> unselectAll: function( | options | )

Unselect all selected features.

> clickFeature: function( | feature | )

Called on click in a feature Only responds if this.hover is false.

> multipleSelect: function()

Allow for multiple selected features based on multiple property and multipleKey event modifier.
{String} An event modifier (‘altKey’ or ‘shiftKey’) that temporarily sets the multiple property to true.

> toggleSelect: function()

Event should toggle the selected state of a feature based on toggle property and toggleKey event modifier.
{String} An event modifier (‘altKey’ or ‘shiftKey’) that temporarily sets the toggle property to true.

> clickoutFeature: function( | feature | )

Called on click outside a previously clicked (selected) feature.

> overFeature: function( | feature | )

Called on over a feature.

> outFeature: function( | feature | )

Called on out of a selected feature.

> select: function( | feature | )

Add feature to the layer’s selectedFeature array, render the feature as selected, and call the onSelect function.

> unselect: function( | feature | )

Remove feature from the layer’s selectedFeature array, render the feature as normal, and call the onUnselect function.

> selectBox: function( | position | )

Callback from the handlers.box set up when box selection is true on.
{Boolean} Allow feature selection by drawing a box.

> setMap: function( | map | )

Set the map property for the control.
Controls affect the display or behavior of the map.
Vector features use the OpenLayers.Geometry classes as geometry description.
Instances of this class represent bounding boxes.
This class represents a screen coordinate, in x and y coordinates
Instances of OpenLayers.Map are interactive maps embedded in a web page.
Close