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

Andreas Hocevar ahocevar at opengeo.org
Wed Dec 7 12:25:14 EST 2011


Hi,

Style2 is only useful if you want to round-trip SLD with multiple
symbolizers per rule. For rendering vector layers, you have to use
Style.

Regarding your other questions: yes, there are several ways to define
styles and symbolizers. At the level of the renderers, we only work
with symbolizers (i.e. what you referred to as "style hash").

Does this help?
Andreas.

On Tue, Dec 6, 2011 at 8:48 AM, Dave Potts <dave.potts at pinan.co.uk> wrote:
>
>
> 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.
>
>
>
>
> --
>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Users mailing list