[OpenLayers-Users] Change style for a draw control "on the fly" inside the "measurepartial" event?

Wladimir Szczerban bolosig at gmail.com
Fri Apr 27 03:28:07 EDT 2012


Hi Martin,

I think you should change the "temporary" style not the "default" style.

Maybe this works for you. I haven't tried

function handleMeasurements(event) {
   var geometry = event.geometry;
   var measure = event.measure;
   if (measure.toFixed(3) > 10000){
     new_style_properties = {'fillColor':'#FF3300','
>
> fillOpacity': .5,
> 'strokeColor': '#FF3300', 'strokeWidth': 2};
>      new_style = new OpenLayers.Style();
>      new_style.addRules([
>          new OpenLayers.Rule({symbolizer: new_style_properties})
>      ]);
>      var new_styleMap = new OpenLayers.StyleMap({"*temporary*":
> new_style});
>      drawControls.handlerOptions.layerOptions = {styleMap: new_styleMap}
>    }
> }



-- 
Saludos,

Bolo
www.geoinquiets.cat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120427/5c807fd0/attachment.html


More information about the Users mailing list