[OpenLayers-Users] Change style for a draw control "on the fly"
inside the "measurepartial" event?
Martin Ouellet
geomartino at gmail.com
Thu Apr 26 11:52:21 EDT 2012
Hi,
Regarding this example:
http://dev.openlayers.org/releases/OpenLayers-2.11/examples/measure.html
I've tried to change the styling "on the fly" (while setImmediate(true)) if
the area exceed a certain value with something like this but it's not
working:
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({"default": new_style});
drawControls.handlerOptions.layerOptions = {styleMap: new_styleMap}
}
}
Can we change the layeroptions "on the fly" or it will only consider the
one set at creation time of the control?
regards,
MartinO
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120426/ac43371a/attachment.html
More information about the Users
mailing list