OpenLayers.Control.GetFeature
Gets vector features for locations underneath the mouse cursor. Can be configured to act on click, hover or dragged boxes. Uses an OpenLayers.Protocol that supports spatial filters (BBOX) to retrieve features from a server and fires events that notify applications of the selected features.
Inherits from
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.
modifiers
{Object} The event modifiers to use, according to the current event being handled by this control’s handlers
multiple
{Boolean} Allow selection of multiple geometries. Default is false.
click
{Boolean} Use a click handler for selecting/unselecting features. Default is true.
clickout
{Boolean} Unselect features when clicking outside any feature. Applies only if click is true. Default is true.
toggle
{Boolean} Unselect a selected feature on click. Applies only if click is true. Default is false.
clickTolerance
{Integer} Tolerance for the BBOX query in pixels. This has the same effect as the tolerance parameter on WMS GetFeatureInfo requests. Will be ignored for box selections. Applies only if click is true. Default is 5.
hover
{Boolean} Send feature requests on mouse moves. Default is false.
box
{Boolean} Allow feature selection by drawing a box.
maxFeatures
{Integer} Maximum number of features to return from a query, if supported by the protocol. Default is 10.
handlerOptions
{Object} Additional options for the handlers used by this control. This is a hash with the keys “click”, “box” and “hover”.
EVENT_TYPES
Supported event types
beforefeatureselected | Triggered when click is true before a feature is selected. The event object has a feature property with the feature about to select |
featureselected | Triggered when click is true and a feature is selected. The event object has a feature property with the selected feature |
featureunselected | Triggered when click is true and a feature is unselected. The event object has a feature property with the unselected feature |
clickout | Triggered when when click is true and no feature was selected. |
hoverfeature | Triggered when hover is true and the mouse has stopped over a feature |
outfeature | Triggered when hover is true and the mouse moves moved away from a hover-selected feature |
OpenLayers.Control.GetFeature
Create a new control for fetching remote features.
Parameters
options | {Object} A configuration object which at least has to contain a protocol property |
activate
Activates the control.
Returns
{Boolean} The control was effectively activated.
deactivate
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. |
selectSingle
selectSingle: function( | evt | ) |
|
Called on click
Parameters
selectBox
selectBox: function( | position | ) |
|
Callback from the handlers.box set up when box selection is on
Parameters
cancelHover
Callback from the handlers.hover set up when hover selection is on
request
request: function( | bounds, | | options | ) |
|
Sends a GetFeature request to the WFS
Parameters
bounds | {OpenLayers.Bounds} bounds for the request’s BBOX filter |
options | {Object} additional options for this method. |
Supported options include
single | {Boolean} A single feature should be returned. Note that this will be ignored if the protocol does not return the geometries of the features. |
hover | {Boolean} Do the request for the hover handler. |
selectBestFeature
selectBestFeature: function( | features, | | clickPosition, | | options | ) |
|
Selects the feature from an array of features that is the best match for the click position.
Parameters
Supported options include
hover | {Boolean} Do the selection for the hover handler. |
setModifiers
setModifiers: function( | evt | ) |
|
Sets the multiple and toggle modifiers according to the current event
Parameters
evt {OpenLayers.Event}
select
select: function( | features | ) |
|
Add feature to the hash of selected features and trigger the featureselected event.
Parameters
hoverSelect
hoverSelect: function( | feature | ) |
|
Sets/unsets the <hoverFeature>
Parameters
feature | {OpenLayers.Feature.Vector} the feature to hover-select. If none is provided, the current <hoverFeature> will be nulled and the outfeature event will be triggered. |
unselect
unselect: function( | feature | ) |
|
Remove feature from the hash of selected features and trigger the featureunselected event.
Parameters
unselectAll
Unselect all selected features.
setMap
Set the map property for the control.
Parameters
pixelToBounds
pixelToBounds: function( | pixel | ) |
|
Takes a pixel as argument and creates bounds after adding the clickTolerance.
Parameters