<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-15">
<META content="MSHTML 6.00.2900.3243" name=GENERATOR></HEAD>
<BODY style="MARGIN: 4px 4px 1px">
<DIV>I have found a similar problem to Adorian using OL2.7. When I click on the feature to delete it, the polygon disappears, but not the vertices. In the code below, crops is a Vector polygon layer loaded from a geoJSON file:</DIV>
<DIV> </DIV>
<DIV>var delf = new OpenLayers.Control.SelectFeature(crops, {onSelect: function(feature) {crops.destroyFeatures([feature])}});</DIV>
<DIV>map.addControl(delf);</DIV>
<DIV>delf.activate();</DIV>
<DIV> </DIV>
<DIV>Robert Sanson<BR><BR>>>> Tim Schaub <tschaub@opengeo.org> 5/08/2008 12:13 a.m. >>><BR>Hey-<BR><BR>Adorian Ardelean wrote:<BR>> Hi,<BR>> <BR>> After upgrading to OL 2.6, delete feature function does not work correctly:<BR>> when a polygon or polyline is removed, the lines that define the <BR>> disappear, but the vertexes not (the vertexes appear as the entity is <BR>> selected). The code worked flawlessly in previous version. Is something <BR>> that I have to be aware and/or modify?<BR>> <BR>> declaration of control<BR>> deletefeature: new <BR>> OpenLayers.Control.SelectFeature(vectors,{onSelect:deleteFeature})<BR>> <BR>> delete function<BR>> function deleteFeature(geometry)<BR>> {<BR>> this.layer.removeFeatures(geometry);<BR>> }<BR>> <BR>> Any hint that may solve this issue is appreciated,<BR><BR>I just tried the following and confirmed that the above works.<BR><BR>1) open <A href="http://openlayers.org/dev/examples/draw">http://openlayers.org/dev/examples/draw</A>-feature.html<BR>2) draw a polygon (note freehand is true here)<BR>3) in the firebug console, run this code:<BR><BR>var del = new OpenLayers.Control.SelectFeature(<BR> map.layers[3], {<BR> onSelect: function(feature) {<BR> map.layers[3].removeFeatures([feature]);<BR> }<BR> }<BR>);<BR>map.addControl(del);<BR>del.activate();<BR><BR>4) click on your polygon to see it removed<BR><BR>I suspect you really want to be calling destroyFeatures instead of <BR>removeFeatures - unless you call feature.destroy elsewhere.<BR><BR>Tim<BR><BR>> Adorian<BR>> <BR>> -- <BR>> Dr. Adorian Ardelean<BR>> coordinator of myNature Project<BR>> <BR>> proiectul myNature<BR>> str. Rascoala din 1907 nr 12<BR>> Timisoara 300523<BR>> Romania<BR>> <BR>> <A href="http://mybiosis.info/nature/portal.php?pagename=firstpage">http://mybiosis.info/nature/portal.php?pagename=firstpage</A> [a Romanian <BR>> biodiversity-database]<BR>> <A href="http://mybiosis.info/nature/portal.php?pagename=adorian">http://mybiosis.info/nature/portal.php?pagename=adorian</A> [CV]<BR>> <BR>> <BR>> ------------------------------------------------------------------------<BR>> <BR>> _______________________________________________<BR>> Users mailing list<BR>> Users@openlayers.org<BR>> <A href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</A><BR><BR>_______________________________________________<BR>Users mailing list<BR>Users@openlayers.org<BR><A href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</A><BR><BR></DIV><br><br><table bgcolor=white style="color:black"><tr><td><br>------------------------------------------------------------------<br>
The contents of this email are confidential to AsureQuality. If you have received this communication in error please notify the sender immediately and delete the message and any attachments. The opinions expressed in this email are not necessarily those of AsureQuality. This message has been scanned for known viruses before delivery. AsureQuality supports the Unsolicited Electronic Messages Act 2007. If you do not wish to receive similar communications in future, please notify the sender of this message.<br>
------------------------------------------------------------------</td></tr></table><br><br>
<P align=center><FONT style="BACKGROUND-COLOR: #ffffff">This message has been scanned for malware by SurfControl plc. </FONT><A href="http://www.surfcontrol.com/"><FONT style="BACKGROUND-COLOR: #ffffff" color=#000000>www.surfcontrol.com</FONT></A></P>
</body></HTML>