Style for a GML/WFS layer

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Style for a GML/WFS layer

Andreas Hocevar
Hi,

now that OpenLayers.Style is removed from OpenLayers trunk, GML and
WFS layer do not take a style as instantiation parameter any more.

How can I tell a vector layer (GML/WFS) which style it should use for
rendering every feature?

Thanks for your help!
Andreas.
_______________________________________________
Dev mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Style for a GML/WFS layer

Christopher Schmidt-2
On Sat, Mar 31, 2007 at 10:19:36AM +0200, Andreas Hocevar wrote:
> Hi,
>
> now that OpenLayers.Style is removed from OpenLayers trunk, GML and
> WFS layer do not take a style as instantiation parameter any more.
>
> How can I tell a vector layer (GML/WFS) which style it should use for
> rendering every feature?

There is a patch for this functionality on
http://trac.openlayers.org/ticket/543 , awaiting review.

So the answer is probably 'wait a couple days' ;)

Regards,
--
Christopher Schmidt
MetaCarta
_______________________________________________
Dev mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Style for a GML/WFS layer

Andreas Hocevar
On 3/31/07, Christopher Schmidt <[hidden email]> wrote:
> On Sat, Mar 31, 2007 at 10:19:36AM +0200, Andreas Hocevar wrote:
> > How can I tell a vector layer (GML/WFS) which style it should use for
> > rendering every feature?
>
> There is a patch for this functionality on
> http://trac.openlayers.org/ticket/543 , awaiting review.
>
> So the answer is probably 'wait a couple days' ;)

Great to hear that! Meanwhile I did an ugly workaround. I added a
style option to the layer, and then I added this event handler:

layer.onFeatureInsert=function(feature) {
        feature.style = feature.layer.options.style;
        feature.layer.renderer.drawGeometry(feature.geometry, feature.style);
}

This has the disadvantage that every feature is drawn twice when the
GML is laoding, so the preFeatureInsert event handler from the patch
would be the perfect solution!

Thank you!
Andreas.
_______________________________________________
Dev mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Style for a GML/WFS layer

Christopher Schmidt-2
On Sat, Mar 31, 2007 at 02:44:18PM +0200, Andreas Hocevar wrote:

> On 3/31/07, Christopher Schmidt <[hidden email]> wrote:
> >On Sat, Mar 31, 2007 at 10:19:36AM +0200, Andreas Hocevar wrote:
> >> How can I tell a vector layer (GML/WFS) which style it should use for
> >> rendering every feature?
> >
> >There is a patch for this functionality on
> >http://trac.openlayers.org/ticket/543 , awaiting review.
> >
> >So the answer is probably 'wait a couple days' ;)
>
> Great to hear that! Meanwhile I did an ugly workaround. I added a
> style option to the layer, and then I added this event handler:
>
> layer.onFeatureInsert=function(feature) {
> feature.style = feature.layer.options.style;
> feature.layer.renderer.drawGeometry(feature.geometry, feature.style);
> }
>
> This has the disadvantage that every feature is drawn twice when the
> GML is laoding, so the preFeatureInsert event handler from the patch
> would be the perfect solution!

Well, it's a slightly different solution, since the functionality you
added to onFeatureInsert is (in the latter patch) built in by default.
The patch you made is not really so much a workaround -- I've just
integrated it into the core instead of doing it from outside :)

Regards,
--
Christopher Schmidt
MetaCarta
_______________________________________________
Dev mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/dev