Created
December 7, 2012 02:01
-
-
Save lydonchandra/4230133 to your computer and use it in GitHub Desktop.
OpenLayers Delete Feature Control Using Box Selection(inherits from OpenLayers.Control.SelectFeature)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var olDeleteControl = new OpenLayers.Control.SelectFeature( layerToDrawOn, { | |
clickout: false, toggle: false, | |
multiple: true, hover: false, | |
toggleKey: "ctrlKey", // ctrl key removes from selection | |
multipleKey: "shiftKey", // shift key adds to selection | |
box: true | |
}); | |
olDeleteControl.events.on({ | |
'boxselectionend': function(layers){ | |
try { | |
layers.layers[0].removeFeatures(layers.layers[0].selectedFeatures); | |
} | |
catch(err) { | |
alert('Error deleting features.') | |
} | |
} | |
}); | |
openlayersMap.addControl(olDeleteControl ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment