<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> </DIV>
<DIV>var crop_style = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);<BR> crop_style.strokeWidth = 3;<BR> crop_style.strokeColor = "#ff0000";<BR> crop_style.fillOpacity = 0.25; <BR> crop_style.pointRadius = 2;</DIV>
<DIV> </DIV>
<DIV>var geojson_format = new OpenLayers.Format.GeoJSON();</DIV>
<DIV> </DIV>
<DIV>var crops = new OpenLayers.Layer.Vector("Crop areas",<BR> {isBaseLayer: false,<BR> style: crop_style, <BR> extractAttributes: true }); <BR> crops.addFeatures(geojson_format.read(cropsresponse.responseText));<BR> map.addLayer(crops);</DIV>
<DIV><BR>controls = {<BR> select: new OpenLayers.Control.SelectFeature(crops, {callbacks: {'over':feature_info}}),<BR> dpolygon: new OpenLayers.Control.DrawFeature(crops,OpenLayers.Handler.Polygon),<BR> modify: new OpenLayers.Control.ModifyFeature(crops),<BR> delf: new OpenLayers.Control.SelectFeature(crops, {onSelect: function(feature) {crops.destroyFeatures([feature])}})<BR> };<BR> for(var key in controls) {<BR> map.addControl(controls[key]);<BR> }<BR> }</DIV>
<DIV>Hope this helps,</DIV>
<DIV> </DIV>
<DIV>Robert Sanson</DIV>
<DIV><BR>>>> "Adorian Ardelean" <mynature@gmail.com> 5/12/2008 7:53 a.m. >>><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><<A href="mailto:eric.c2c@gmail.com">eric.c2c@gmail.com</A>></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> "default": yourStyle<BR>});<BR><BR>Hope this helps,<BR><BR>Eric<BR><BR>2008/12/4, Adorian Ardelean <<A href="mailto:mynature@gmail.com">mynature@gmail.com</A>>:<BR>
<DIV>
<DIV></DIV>
<DIV class=Wj3C7c>> Hi again,<BR>><BR>> I have eliminated also the context for style as a source of problem for the<BR>> modifyFeature control not working. So it seems that just by specifying a<BR>> styleMap as option when declaring the vector layer makes the modifyFeature<BR>> control not functional.<BR>><BR>> var template = {<BR>> fillOpacity: 0.6,<BR>> fillColor: "red",<BR>> strokeColor:"orange",<BR>> strokeWidth:"1"<BR>> };<BR>><BR>> var mystyle = new OpenLayers.Style(template);<BR>><BR>> var regions = new OpenLayers.Layer.Vector("regions",{extractAttributes:true,<BR>> format: OpenLayers.Format.GeoJSON, projection: new<BR>> OpenLayers.Projection("EPSG:4326"), styleMap: new<BR>> OpenLayers.StyleMap(mystyle)});<BR>><BR>><BR>> I think the solution might be somewhere in the post:<BR>> StyleMap and ModifyFeatures aren't compatible ?I will give it a try.<BR>><BR>> All the best,<BR>> Adorian<BR>><BR>><BR>> Dr. Adorian Ardelean<BR>> coordinator of myNature Project<BR>><BR>> <A href="http://mybiosis.info/nature/portal.php?pagename=firstpage" target=_blank>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" target=_blank>http://mybiosis.info/nature/portal.php?pagename=adorian</A> [CV]<BR>><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 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>