OpenLayers.Control.SelectFeature

The SelectFeature control selects vector features from a given layer on click or hover.

Inherits from

Summary
OpenLayers.Control.SelectFeatureThe SelectFeature control selects vector features from a given layer on click or hover.
Properties
events{OpenLayers.Events} Events instance for listeners and triggering control specific events.
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.
highlightOnly{Boolean} If true do not actually select features (that is place them in the layer’s selected features array), just highlight them.
box{Boolean} Allow feature selection by drawing a box.
onBeforeSelect{Function} Optional function to be called before a feature is selected.
onSelect{Function} Optional function to be called when a feature is selected.
onUnselect{Function} Optional function to be called when a feature is unselected.
scope{Object} The scope to use with the onBeforeSelect, onSelect, onUnselect callbacks.
geometryTypes{Array(String)} To restrict selecting to a limited set of geometry types, send a list of strings corresponding to the geometry class names.
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.
Constructor
OpenLayers.Control.SelectFeatureCreate a new control for selecting features.
Functions
setLayerAttach a new layer to the control, overriding any existing layers.
addLayerAdd a layer to the control, making the existing layers still selectable

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)

beforefeaturehighlightedTriggered before a feature is highlighted
featurehighlightedTriggered when a feature is highlighted
featureunhighlightedTriggered when a feature is unhighlighted
boxselectionstartTriggered before box selection starts
boxselectionendTriggered after box selection ends

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.

highlightOnly

{Boolean} If true do not actually select features (that is place them in the layer’s selected features array), just highlight them.  This property has no effect if hover is false.  Defaults to false.

box

{Boolean} Allow feature selection by drawing a box.

onBeforeSelect

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

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.

scope

{Object} The scope to use with the onBeforeSelect, onSelect, onUnselect callbacks.  If null the scope will be this control.

geometryTypes

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

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.

Constructor

OpenLayers.Control.SelectFeature

Create a new control for selecting features.

Parameters

layers{OpenLayers.Layer.Vector}, or an array of vector layers.  The layer(s) this control will select features from.
options{Object}

Functions

setLayer

setLayer: function(layers)

Attach a new layer to the control, overriding any existing layers.

Parameters

layersArray of {OpenLayers.Layer.Vector} or a single {OpenLayers.Layer.Vector}

addLayer

addLayer: function(layer)

Add a layer to the control, making the existing layers still selectable

Parameters

layerelement OpenLayers.Layer.Vector
{Boolean} Allow selection of multiple geometries.
{Boolean} Unselect a selected feature on click.
setLayer: function(layers)
Attach a new layer to the control, overriding any existing layers.
addLayer: function(layer)
Add a layer to the control, making the existing layers still selectable
Controls affect the display or behavior of the map.
{OpenLayers.Events} Events instance for listeners and triggering control specific events.
Instances of OpenLayers.Layer.Vector are used to render vector data from a variety of sources.
Close