<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>Yes, I actually have select, draw and modify controls:</DIV>
<DIV>&nbsp;</DIV>
<DIV>//Select, Draw and Modify controls - these are specific to the layer</DIV>
<DIV>controls = {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; select: new OpenLayers.Control.SelectFeature(crops, {callbacks: {'over':feature_info}}),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dpolygon: new OpenLayers.Control.DrawFeature(crops,OpenLayers.Handler.Polygon),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; modify: new OpenLayers.Control.ModifyFeature(crops),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; delf: new OpenLayers.Control.SelectFeature(crops, {onSelect: function(feature) {crops.destroyFeatures([feature])}})</DIV>
<DIV>};<BR>for(var key in controls) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map.addControl(controls[key]);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>}</DIV>
<DIV><BR>//Later on I have a fucntion for activating, deactivating:</DIV>
<DIV>function toggleControl(element) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mode = element.value;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OpenLayers.Util.getElement('comments').innerHTML = "Mode:" + mode;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ((mode == "select") || (mode == "modify")){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; crop_style.strokeColor = "#0000ff";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; crop_style.strokeColor = "#ff0000";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for(key in controls) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var control = controls[key];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(element.value == key &amp;&amp; element.checked) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; control.activate();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; control.deactivate();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; crops.onFeatureInsert = function(feature) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lastFeature = feature;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; feature.attributes.prop0 = 'new'; //This should be modified to get actual ID<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; window.alert("New crop area inserted");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</DIV>
<DIV>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Robert</DIV>
<DIV><BR>&gt;&gt;&gt; "Eric Lemoine" &lt;eric.c2c@gmail.com&gt; 16/10/2008 5:48 p.m. &gt;&gt;&gt;<BR>Hi. Do you also have a modify feature control? The select feature and<BR>modify feature controls are known not to play well together. There<BR>already is a ticket about that, and patch attached to it. Eric<BR><BR>2008/10/16, Robert Sanson &lt;SansonR@asurequality.com&gt;:<BR>&gt; I have tried destroyFeatures, removeFeatures and eraseFeatures and they all<BR>&gt; seem to have the same behaviour. The polygon disappears but the vertices<BR>&gt; remain.<BR>&gt;<BR>&gt; var delf =&nbsp; new OpenLayers.Control.SelectFeature(crops, {onSelect:<BR>&gt; function(feature) {crops.destroyFeatures([feature])}});<BR>&gt; map.addControl(delf);<BR>&gt; delf.activate();<BR>&gt;<BR>&gt; Robert Sanson<BR>&gt;<BR>&gt;&gt;&gt;&gt; Tim Schaub &lt;tschaub@opengeo.org&gt; 5/08/2008 12:13 a.m. &gt;&gt;&gt;<BR>&gt; Hey-<BR>&gt;<BR>&gt; Adorian Ardelean wrote:<BR>&gt;&gt; Hi,<BR>&gt;&gt;<BR>&gt;&gt; After upgrading to OL 2.6, delete feature function does not work<BR>&gt;&gt; correctly:<BR>&gt;&gt; when a polygon or polyline is removed, the lines that define the<BR>&gt;&gt; disappear, but the vertexes not (the vertexes appear as the entity is<BR>&gt;&gt; selected). The code worked flawlessly in previous version. Is something<BR>&gt;&gt; that I have to be aware and/or modify?<BR>&gt;&gt;<BR>&gt;&gt; declaration of control<BR>&gt;&gt; deletefeature: new<BR>&gt;&gt; OpenLayers.Control.SelectFeature(vectors,{onSelect:deleteFeature})<BR>&gt;&gt;<BR>&gt;&gt; delete function<BR>&gt;&gt; function deleteFeature(geometry)<BR>&gt;&gt; {<BR>&gt;&gt;&nbsp;&nbsp; this.layer.removeFeatures(geometry);<BR>&gt;&gt; }<BR>&gt;&gt;<BR>&gt;&gt; Any hint that may solve this issue is appreciated,<BR>&gt;<BR>&gt; I just tried the following and confirmed that the above works.<BR>&gt;<BR>&gt; 1) open <A href="http://openlayers.org/dev/examples/draw-feature.html">http://openlayers.org/dev/examples/draw-feature.html</A><BR>&gt; 2) draw a polygon (note freehand is true here)<BR>&gt; 3) in the firebug console, run this code:<BR>&gt;<BR>&gt; var del = new OpenLayers.Control.SelectFeature(<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map.layers[3], {<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; onSelect: function(feature) {<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map.layers[3].removeFeatures([feature]);<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&gt; );<BR>&gt; map.addControl(del);<BR>&gt; del.activate();<BR>&gt;<BR>&gt; 4) click on your polygon to see it removed<BR>&gt;<BR>&gt; I suspect you really want to be calling destroyFeatures instead of<BR>&gt; removeFeatures - unless you call feature.destroy elsewhere.<BR>&gt;<BR>&gt; Tim<BR>&gt;<BR>&gt;&gt; Adorian<BR>&gt;&gt;<BR>&gt;&gt; --<BR>&gt;&gt; Dr. Adorian Ardelean<BR>&gt;&gt; coordinator of myNature Project<BR>&gt;&gt;<BR>&gt;&gt; proiectul myNature<BR>&gt;&gt; str. Rascoala din 1907 nr 12<BR>&gt;&gt; Timisoara 300523<BR>&gt;&gt; Romania<BR>&gt;&gt;<BR>&gt;&gt; <A href="http://mybiosis.info/nature/portal.php?pagename=firstpage">http://mybiosis.info/nature/portal.php?pagename=firstpage</A> [a Romanian<BR>&gt;&gt; biodiversity-database]<BR>&gt;&gt; <A href="http://mybiosis.info/nature/portal.php?pagename=adorian">http://mybiosis.info/nature/portal.php?pagename=adorian</A> [CV]<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt; ------------------------------------------------------------------------<BR>&gt;&gt;<BR>&gt;&gt; _______________________________________________<BR>&gt;&gt; Users mailing list<BR>&gt;&gt; Users@openlayers.org<BR>&gt;&gt; <A href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</A><BR>&gt;<BR>&gt; _______________________________________________<BR>&gt; Users mailing list<BR>&gt; Users@openlayers.org<BR>&gt; <A href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</A><BR>&gt;<BR>&gt; ------------------------------------------------------------------<BR>&gt; The contents of this email are confidential to AsureQuality. If you have<BR>&gt; received this communication in error please notify the sender immediately<BR>&gt; and delete the message and any attachments. The opinions expressed in this<BR>&gt; email are not necessarily those of AsureQuality. This message has been<BR>&gt; scanned for known viruses before delivery. AsureQuality supports the<BR>&gt; Unsolicited Electronic Messages Act 2007. If you do not wish to receive<BR>&gt; similar communications in future, please notify the sender of this message.<BR>&gt; ------------------------------------------------------------------<BR>&gt;<BR>&gt;<BR>&gt; This message has been scanned for malware by SurfControl plc.<BR>&gt; www.surfcontrol.com<BR>&gt;<BR><BR><BR><BR><BR></DIV><br><br><table bgcolor=white style="color:black"><tr><td><br>------------------------------------------------------------------<br>
The&nbsp;contents&nbsp;of&nbsp;this&nbsp;email&nbsp;are&nbsp;confidential&nbsp;to&nbsp;AsureQuality.&nbsp;If&nbsp;you&nbsp;have&nbsp;received&nbsp;this&nbsp;communication&nbsp;in&nbsp;error&nbsp;please&nbsp;notify&nbsp;the&nbsp;sender&nbsp;immediately&nbsp;and&nbsp;delete&nbsp;the&nbsp;message&nbsp;and&nbsp;any&nbsp;attachments.&nbsp;The&nbsp;opinions&nbsp;expressed&nbsp;in&nbsp;this&nbsp;email&nbsp;are&nbsp;not&nbsp;necessarily&nbsp;those&nbsp;of&nbsp;AsureQuality.&nbsp;This&nbsp;message&nbsp;has&nbsp;been&nbsp;scanned&nbsp;for&nbsp;known&nbsp;viruses&nbsp;before&nbsp;delivery.&nbsp;AsureQuality&nbsp;supports&nbsp;the&nbsp;Unsolicited&nbsp;Electronic&nbsp;Messages&nbsp;Act&nbsp;2007.&nbsp;If&nbsp;you&nbsp;do&nbsp;not&nbsp;wish&nbsp;to&nbsp;receive&nbsp;similar&nbsp;communications&nbsp;in&nbsp;future,&nbsp;please&nbsp;notify&nbsp;the&nbsp;sender&nbsp;of&nbsp;this&nbsp;message.<br>
------------------------------------------------------------------</td></tr></table></BODY></HTML>