[OpenLayers-Users] poblems with style object in Layers object

Dave Potts dave.potts at pinan.co.uk
Tue Dec 6 02:48:28 EST 2011



I am having problems with the style object.

If I create a layer with no style object and attempt to access the style
object within a layer, its set to null.

If I look at some of the examples in the exmaples directory from
openlayers 2.11 , it seems to be used in several different ways

highlight-feature.html line 24 
Openlayers.Features.Vector.style['default']['strokeWidth']='2'
modify-feature.html    line 28 
Openlayers.Feature.Vector.style['default']['strokeWidth']='2'

but

osm-layer.html   line 54,56
feature.style.OpenLayers.Util.extend({'fill':'black'},
Openlayers.Featurte.Vector.style['default']);
feature.style.strokeWidth=5;
line 63 feature.style.strokeColor="black"

also found at line 25 in resize-feature.html,rotate-features.html

The problem being that in some case 'style' is address as either an hash
or as instance variable.

>From looking at Layer/Vector.js, the style object for the layer is just
described as type object, but from line 809, it can be a Symbolizer?


So I am confused what should the type of the style object should from the
Layer/Vector.js, it can be

A.  A single style object?
B.  A hash of style objects?
C.  A Symboolizer?


While I am at it there seems to be a style2 object defined as well, but
from the documentation,  I am confused as to when I should use Style2
instead of Style

regards

Dave.
Regards


Dave.




-- 




More information about the Users mailing list