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

gingerbbm stuart.jones at jacobs.com
Mon Nov 3 12:18:11 EST 2008


Well I continued searching and found  http://trac.openlayers.org/wiki/Styles
http://trac.openlayers.org/wiki/Styles  which inspired me to the following:

    var pointStyle = {
        fillColor: 'green',
        fillOpacity: '0.7',
        strokeColor: 'blue',
        strokeWidth: 3
    };
    var styleMap = new OpenLayers.StyleMap(
        OpenLayers.Util.applyDefaults(
            pointStyle,
            OpenLayers.Feature.Vector.style['default']
        )
    );	
    vectorLayer = new OpenLayers.Layer.Vector("Vector Layer", { styleMap:
styleMap} );

While this does appear to work it exhibits a behaviour I'd like to have
control over. If I include an editing toolbar as follows...

    map.addControl(new OpenLayers.Control.EditingToolbar(vectorLayer));

...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?

Thanks
Stuart

-- 
View this message in context: http://n2.nabble.com/Modifying-a-vector-object%27s-styling-tp1449984p1450355.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list