DeleteFeature.js

Summary
DeleteFeature.js
Properties
layer{<OpenLayers.Layer.Vector>}
selectControl{<OpenLayers.Control.SelectFeature>}
handlers{Object}
Functions
OpenLayers.Control.DeleteFeatureCreate a new delete feature control.
selectFeatureWhen a feature is selected by this control, set the state to DELETE.
unselectFeatureWhen a feature is unselected by this control, reset the state to null.
handleKeypressCalled by the feature handler on keypress.
deleteFeaturesTrigger “beforefeaturesdeleted” and “deletefeatures” events with layer selected features as features to delete.
setMapSet the map property for the control and all handlers.
activateExplicitly activates a control and it’s associated handlers if one has been set.
deactivateDeactivates a control and it’s associated handlers if any.

Properties

layer

{<OpenLayers.Layer.Vector>}

selectControl

{<OpenLayers.Control.SelectFeature>}

handlers

{Object}

Functions

OpenLayers.Control.DeleteFeature

Create a new delete feature control.

Parameters

layer{<OpenLayers.Layer.Vector>} Layer that contains features that will be deleted.
options{Object} Optional object whose properties will be set on the control.

selectFeature

selectFeature: function(feature)

When a feature is selected by this control, set the state to DELETE.  Draw the feature again with its new state.

Parameters

feature{OpenLayers.Feature.Vector}

unselectFeature

unselectFeature: function(feature)

When a feature is unselected by this control, reset the state to null.

Parameters

feature{OpenLayers.Feature.Vector}

handleKeypress

handleKeypress: function(evt)

Called by the feature handler on keypress.  This is used to trigger 2 kinds of events :

  • delete the selected features (on ‘del’ or ‘d’ keypress)
  • unselect the selected features (on ‘esc’ keypress)

Parameters

{Integer} Key code corresponding to the keypress event.

deleteFeatures

deleteFeatures: function (options)

Trigger “beforefeaturesdeleted” and “deletefeatures” events with layer selected features as features to delete.

options{Object} if {silent: true}, the function will skip the beforefeaturesdeleted and trigger deletefeatures

setMap

setMap: function(map)

Set the map property for the control and all handlers.

Parameters

map{<OpenLayers.Map>} The control’s map.

activate

activate: function ()

Explicitly activates a control and it’s associated handlers if one has been set.  Controls can be deactivated by calling the deactivate() method.

Returns

{Boolean} True if the control was successfully activated or false if the control was already active.

deactivate

deactivate: function ()

Deactivates a control and it’s associated handlers if any.  Unselect all selected features.

Returns

{Boolean} True if the control was effectively deactivated or false if the control was already inactive.

selectFeature: function(feature)
When a feature is selected by this control, set the state to DELETE.
unselectFeature: function(feature)
When a feature is unselected by this control, reset the state to null.
handleKeypress: function(evt)
Called by the feature handler on keypress.
deleteFeatures: function (options)
Trigger “beforefeaturesdeleted” and “deletefeatures” events with layer selected features as features to delete.
setMap: function(map)
Set the map property for the control and all handlers.
activate: function ()
Explicitly activates a control and it’s associated handlers if one has been set.
deactivate: function ()
Deactivates a control and it’s associated handlers if any.
Close