[OpenLayers-Dev] Feature.style doesn't support contexts

Cédric Moullet cedric.moullet at camptocamp.com
Sun Jan 17 00:38:33 EST 2010


Hi Eric,
I have made a sample of what I'd like to reach:
http://dev.geoext.org/sandbox/cmoullet/ux/Redlining/examples/StylingExample.html
.
It does what I want, but I'd like to know if it's the correct way to do it.
I still don't understand why the usage of createSymbolizer is encouraged in
this case.
Thanks in advance,
Cédric

2010/1/16 Eric Lemoine <eric.lemoine at camptocamp.com>

> On Saturday, January 16, 2010, Cédric Moullet  wrote:
> > Hi Eric,Thanks for your answer.
> > However, I'm not sure that I have really understand it. The goal is to
> set a style to one feature (to assign feature.style).
> > I assume that the example
> http://www.openlayers.org/dev/examples/symbolizers-fill-stroke-graphic.html corresponds
> to the new way of symbolizing feature. Is it correct ?
>
> Yes it is.
>
> > What is not clear to me is how to assign a style to a specific feature.
> There is a function createSymbolizer(feature) in Style.js (
> http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Style.js#L148)
> and a function createSymbolizer(feature, intent) in StyleMap.js
> http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/StyleMap.js#L108
> >
> >
> > You proposed to use styleMap.createSymbolizer(feature), shouldn't it be
> styleMap.createSymbolizer(feature, intent) ?
>
> if intent is undefined createSymbolizer uses "default" as the render
> intent.
>
>
> > This implies that in order to manage "free style", it is required to add
> a Style in the StyleMap and assign to feature.style this style. Is it
> correct ?
>
> What do you mean by "free style"? A user-defined style that isn't
> derived by rules or a context?
>
> It seems to me that you want to mix context-based styling and
> per-feature user-defined styling.
>
> What about that: when user wants to modify a feature's style call
> createSymbolizer to get the feature's current style, modify the
> returned style object as requested by the user and store  it in
> feature.style.
>
> There may be other options, but this is the one I see at this point.
>
> Cheers,
>
> --
> Eric Lemoine
>
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac, Cedex
>
> Tel : 00 33 4 79 44 44 96
> Mail : eric.lemoine at camptocamp.com
> http://www.camptocamp.com
>



-- 
CTO Geospatial Camptocamp SA
Cédric Moullet
PSE A
CH-1015 Lausanne
www.camptocamp.com  / www.mapfish.org / twitter.com/cedricmoullet /
mapfishblog.blogspot.com/

+41 79 759 69 83 (mobile)
+41 21 619 10 21 (direct)
+41 21 619 10 10 (centrale)
+41 21 619 10 00 (fax)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20100117/774786a8/attachment.html


More information about the Dev mailing list