Hello,
I've mixed the mailing lists, I'm lost in my own mails, sorry for the
disturbance.
Thanks to your example Arnd, I've come up with an ugly solution to my problem.
I've changed my delete method like this:
/**
* Delete a feature
*/
function deleteFeature(feature) {
modifyTool.unselectFeature(feature); // modifyTool is my ModifyFeature
Control
getEditableLayer().removeFeatures(feature);
}
But it's not very satisfying. It seems that the ModifyFeature control register
the "featureselected" event on the layer and generate some temporary vertices
event is the control should be disabled (in the toolbar it is toogled off). The
cleaner solution would be to generate theses vertices only the the control is
on.
Tchule.
--------------------------------------------------------------------------------------------------------------------------------------------
Hi,
i have enhanced the ModifyFeature Control, so that I can delete a feature
with the key 'k' like kill.
OpenLayers.Control.ModifyFeature.prototype.deleteCodes = [46, 100, 107];
//Backspace, d, k
OpenLayers.Control.ModifyFeature.prototype.handleKeypress = function(code) {
...
...
...
else if(this.feature && OpenLayers.Util.indexOf(this.deleteCodes,
code) != -1 && code == 107)
{
var obj = this.feature;
var lyr = obj.layer;
this.unselectFeature(obj);
lyr.removeFeatures(obj);
msg ="201:" + code;
}
//alert(msg);
}
Arnd Wippermann
http://gis.ibbeck.de/ginfo/
> Hello,
>
> I've discovered that my problem is link with the presence of the
> "ModifyFeature" control that changes the behaviour of the Select control.
>
> I'm a bit lost with these controls and the removeFeatures/ eraseFeatures /
> destroyFeatures methods of the Vector class.
>
> Does someone have a clean example of how to create an Editing Toolbar with
> :
> - The create point / line / polygone buttons
> - A Delete Feature button
> - A Modify Feature button
>
> Thanks,
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Delete Feature
Date: Mon, 7 Apr 2008 15:36:30 +0000
Hello,
I have a stupid error when trying to delete a vector feature. I've updated
OpenLayers from 2.5 to 2.6 (latest from trunk) and when trying to delete a
feature I have the corners of the polygon that stay on the map.
I've added a control like this :
// Delete feature
var deleteTool = new OpenLayers.Control.SelectFeature(layer_vector,
{
onSelect:deleteFeature,
});
And the called method is like this :
function deleteFeature(feature) {
getEditableLayer().removeFeatures(feature);
}
The problem seems to be that when getting the vector layer (thru the
getLayersByName() method) the feature is set to "modification mode".
I've tried to look around for the "renderIntent" property of the
selectfeature control but I don't know the clean way to use it.
Thanks,
Benoit Pesty
_________________________________________________________________
More immediate than e-mail? Get instant access with Windows Live Messenger.
http://www.windowslive.com/messenger/overview.html?ocid=TXT_TAGLM_WL_Refresh_instantaccess_042008_______________________________________________
Dev mailing list
[email protected]
http://openlayers.org/mailman/listinfo/dev