<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>
<DIV>This works for me:</DIV>
<DIV>&nbsp;</DIV>
<DIV>var crop_style = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; crop_style.strokeWidth = 3;<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;&nbsp;&nbsp; crop_style.fillOpacity = 0.25; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; crop_style.pointRadius = 2;</DIV>
<DIV>&nbsp;</DIV>
<DIV>var geojson_format = new OpenLayers.Format.GeoJSON();</DIV>
<DIV>&nbsp;</DIV>
<DIV>var crops = new OpenLayers.Layer.Vector("Crop areas",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {isBaseLayer: false,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; style: crop_style, <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; extractAttributes: true }); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; crops.addFeatures(geojson_format.read(cropsresponse.responseText));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map.addLayer(crops);</DIV>
<DIV><BR>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])}})<BR>&nbsp;&nbsp;&nbsp;&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; 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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</DIV>
<DIV>Hope this helps,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Robert Sanson</DIV>
<DIV><BR>&gt;&gt;&gt; "Adorian Ardelean" &lt;mynature@gmail.com&gt; 5/12/2008 7:53 a.m. &gt;&gt;&gt;<BR>Hi Eric,<BR><BR>No...it is not working yet. There is some improvement indeed: I can see now the selection style, but vertexes are still not editable.<BR><BR>I have tried to adapt the suggestion in post I have mentioned earlier. <BR><BR><DEFANGHTML_SPAN style="COLOR: rgb(0,0,102)">var styleMap = new OpenLayers.StyleMap(); </DEFANGHTML_SPAN><BR defanghtml_style="color: rgb(0, 0, 102);"><BR defanghtml_style="color: rgb(0, 0, 102);"><DEFANGHTML_SPAN style="COLOR: rgb(0,0,102)">var rules = [new OpenLayers.Rule({</DEFANGHTML_SPAN><BR defanghtml_style="color: rgb(0, 0, 102);"><DEFANGHTML_SPAN style="COLOR: rgb(0,0,102)">symbolizer: template, </DEFANGHTML_SPAN><BR defanghtml_style="color: rgb(0, 0, 102);"><DEFANGHTML_SPAN style="COLOR: rgb(0,0,102)">elseFilter: true</DEFANGHTML_SPAN><BR defanghtml_style="color: rgb(0, 0, 102);"><DEFANGHTML_SPAN style="COLOR: rgb(0,0,102)">})];</DEFANGHTML_SPAN><BR defanghtml_style="color: rgb(0, 0, 102);"><DEFANGHTML_SPAN style="COLOR: rgb(0,0,102)">styleMap.styles["default"].addRules(rules); </DEFANGHTML_SPAN><BR><BR>Using this the edit polygon works!!!. However, I did not figured out how to include "context" within this. Select style is also not visible (but I do not mind this, I can most probably find a work around for selection style).<BR><BR>Initially I have used:<BR><DEFANGHTML_SPAN style="COLOR: rgb(0,0,153)">var mystyle = new OpenLayers.Style(template, {context: context}); </DEFANGHTML_SPAN><BR defanghtml_style="color: rgb(0, 0, 153);"><DEFANGHTML_SPAN style="COLOR: rgb(0,0,153)">var styleMap = new OpenLayers.StyleMap(mystyle); </DEFANGHTML_SPAN><BR>And context worked fine.<BR><BR>Any hints on how to include context with rules?<BR><BR>Thank you,<BR>Adorian<BR><BR><BR><BR></DIV>
<DIV class=gmail_quote>On Thu, Dec 4, 2008 at 5:58 PM, Eric Lemoine <DEFANGHTML_SPAN dir=ltr>&lt;<A href="mailto:eric.c2c@gmail.com">eric.c2c@gmail.com</A>&gt;</DEFANGHTML_SPAN> wrote:<BR>
<BLOCKQUOTE class=gmail_quote defanghtml_style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello<BR><BR>Try:<BR><BR>new OpenLayers.StyleMap({<BR>&nbsp; &nbsp;"default": yourStyle<BR>});<BR><BR>Hope this helps,<BR><BR>Eric<BR><BR>2008/12/4, Adorian Ardelean &lt;<A href="mailto:mynature@gmail.com">mynature@gmail.com</A>&gt;:<BR>
<DIV>
<DIV></DIV>
<DIV class=Wj3C7c>&gt; Hi again,<BR>&gt;<BR>&gt; I have eliminated also the context for style as a source of problem for the<BR>&gt; modifyFeature control not working. So it seems that just by specifying a<BR>&gt; styleMap as option when declaring the vector layer makes the modifyFeature<BR>&gt; control not functional.<BR>&gt;<BR>&gt; var template = {<BR>&gt; &nbsp; &nbsp; fillOpacity: 0.6,<BR>&gt; &nbsp; &nbsp; fillColor: "red",<BR>&gt; &nbsp; &nbsp; strokeColor:"orange",<BR>&gt; &nbsp; &nbsp; strokeWidth:"1"<BR>&gt; &nbsp; &nbsp; };<BR>&gt;<BR>&gt; var mystyle = new OpenLayers.Style(template);<BR>&gt;<BR>&gt; var regions = new OpenLayers.Layer.Vector("regions",{extractAttributes:true,<BR>&gt; format: OpenLayers.Format.GeoJSON, projection: new<BR>&gt; OpenLayers.Projection("EPSG:4326"), styleMap: new<BR>&gt; OpenLayers.StyleMap(mystyle)});<BR>&gt;<BR>&gt;<BR>&gt; I think the solution might be somewhere in the post:<BR>&gt; StyleMap and ModifyFeatures aren't compatible ?I will give it a try.<BR>&gt;<BR>&gt; All the best,<BR>&gt; Adorian<BR>&gt;<BR>&gt;<BR>&gt; Dr. Adorian Ardelean<BR>&gt; coordinator of myNature Project<BR>&gt;<BR>&gt; <A href="http://mybiosis.info/nature/portal.php?pagename=firstpage" target=_blank>http://mybiosis.info/nature/portal.php?pagename=firstpage</A> [a Romanian<BR>&gt; biodiversity-database]<BR>&gt; <A href="http://mybiosis.info/nature/portal.php?pagename=adorian" target=_blank>http://mybiosis.info/nature/portal.php?pagename=adorian</A> [CV]<BR>&gt;<BR></DIV></DIV></BLOCKQUOTE></DIV><BR><BR clear=all><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 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>Projects in which I was involved:<BR><A href="http://hercules.kgs.ku.edu/Hexacoral/Anemone2/">http://hercules.kgs.ku.edu/Hexacoral/Anemone2/</A> [Hexacorallians of the World]<BR><A href="http://www.ubio.org">http://www.ubio.org</A> [uBio Project]<BR><A href="http://portal.ubio.org">http://portal.ubio.org</A> [uBio Portal]<BR><A href="http://microscope.mbl.edu">http://microscope.mbl.edu</A> [micro*scope Project]<BR><A href="http://starcentral.mbl.edu/biopedia">http://starcentral.mbl.edu/biopedia</A> [BioPedia]<BR><A href="http://starcentral.mbl.edu/custar">http://starcentral.mbl.edu/custar</A> [CU*STAR]<BR><A href="http://planktonnet.awi.de/index.php">http://planktonnet.awi.de/index.php</A> [planktonNet]<BR><BR>Yahoo messenger: transylvaniasan<BR><BR><BR><FONT style="BACKGROUND-COLOR: #ffffff">
<P align=center><FONT style="BACKGROUND-COLOR: #ffffff">Click <A href="https://www.mailcontrol.com/sr/wQw0zmjPoHdJTZGyOCrrhg==">here</A> to report this email as spam.</FONT></P></FONT><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><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>