[OpenLayers-Users] Modifying a vector object's styling

Tim Schaub tschaub at opengeo.org
Tue Nov 4 11:45:24 EST 2008


Hey-

gingerbbm wrote:
> 
> gingerbbm wrote:
>>
>> gingerbbm wrote:
>>> as I draw the point/line/polygon it appears in the default orange. When I
>>> finish drawing, the shape changes to the style defined above
>>>  
>> How do I ensure that my desired style is applied during the drawing
>> process?
>>
> 
> 
> Anyone?
> 

The sketch handlers should use the "temporary" rendering intent from the 
target layer's style map.  But they don't.  There is a ticket for this.

You can push a style map into the temporary layer managed by the sketch 
handlers by specifying layerOptions in your handlerOptions.  This is 
contorted and may not be forever supported, but it is a workaround given 
the current situation.

See the measure example for inspiration:
http://openlayers.org/dev/examples/measure.html

Basically, you'll want to pass the sketch handler (via handlerOptions in 
your DrawFeature control constructor) a StyleMap object to be used by 
the layer.

Good luck,
Tim


-- 
Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.



More information about the Users mailing list