[OpenLayers-Dev] Style for a GML/WFS layer

Andreas Hocevar andreas.hocevar at gmail.com
Sat Mar 31 08:44:18 EDT 2007


On 3/31/07, Christopher Schmidt <crschmidt at metacarta.com> 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.



More information about the Dev mailing list