<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>
Hello,<br><br>I've mixed the mailing lists, I'm lost in my own mails, sorry for the disturbance.<br><br>Thanks to your example Arnd, I've come up with an ugly solution to my problem.<br><br>I've changed my delete method like this:<br>/**<br> * Delete a feature<br> */<br>function deleteFeature(feature) {<br> modifyTool.unselectFeature(feature); // modifyTool is my ModifyFeature Control <br> getEditableLayer().removeFeatures(feature);<br>}<br><br>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.<br><br>Tchule.<br><br>--------------------------------------------------------------------------------------------------------------------------------------------<br>Hi,<br><br>i have enhanced the ModifyFeature Control, so that I can delete a feature<br>with the key 'k' like kill.<br><br>OpenLayers.Control.ModifyFeature.prototype.deleteCodes = [46, 100, 107]; <br>//Backspace, d, k<br>OpenLayers.Control.ModifyFeature.prototype.handleKeypress = function(code) {<br><br>...<br>...<br>...<br><br> else if(this.feature && OpenLayers.Util.indexOf(this.deleteCodes,<br>code) != -1 && code == 107)<br> {<br> var obj = this.feature;<br> var lyr = obj.layer;<br> this.unselectFeature(obj);<br> lyr.removeFeatures(obj);<br> msg ="201:" + code;<br> }<br> //alert(msg);<br>}<br><br>Arnd Wippermann<br>http://gis.ibbeck.de/ginfo/<br><br><br>> Hello,<br>> <br>> I've discovered that my problem is link with the presence of the<br>> "ModifyFeature" control that changes the behaviour of the Select control.<br>> <br>> I'm a bit lost with these controls and the removeFeatures/ eraseFeatures /<br>> destroyFeatures methods of the Vector class.<br>> <br>> Does someone have a clean example of how to create an Editing Toolbar with<br>> :<br>> - The create point / line / polygone buttons<br>> - A Delete Feature button<br>> - A Modify Feature button<br>> <br>> Thanks,<br><br><br><br> From: tchule@hotmail.com<br> To: users@openlayers.org<br> Subject: Delete Feature<br> Date: Mon, 7 Apr 2008 15:36:30 +0000<br><br> Hello,<br><br> 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.<br><br> I've added a control like this :<br><br> // Delete feature<br> var deleteTool = new OpenLayers.Control.SelectFeature(layer_vector,<br> {<br> onSelect:deleteFeature,<br> });<br><br> And the called method is like this :<br> function deleteFeature(feature) {<br> getEditableLayer().removeFeatures(feature);<br> }<br><br><br> The problem seems to be that when getting the vector layer (thru the getLayersByName() method) the feature is set to "modification mode".<br><br> 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.<br><br> Thanks,<br><br> Benoit Pesty<br><br><br><br><br /><hr />More immediate than e-mail? <a href='http://www.windowslive.com/messenger/overview.html?ocid=TXT_TAGLM_WL_Refresh_instantaccess_042008' target='_new'>Get instant access with Windows Live Messenger.</a></body>
</html>