[OpenLayers-Dev] using custom renderer on Layer.Vector
Bart van den Eijnden
bartvde at osgis.nl
Thu Jun 10 03:32:10 EDT 2010
Hi list,
I am trying to use a custom renderer for a Vector Layer. However, if I interpret the code correctly, there is an issue there right now. Hopefully somebody can clarify if I am doing something wrong.
I am defining my layer in the following way:
vectorLayer = new OpenLayers.Layer.Vector("Bekendmakingen", {
styleMap: new OpenLayers.StyleMap({'default':{
cssClass: "${category}"
}}),
renderer: new Geozet.Renderer.Anchor(),
strategies: [new Geozet.Strategy.PrintList()]
});
However, the constructor of the renderer normally gets the root div as the first argument, but since the vectorLayer has not yet been rendered, I cannot assign it as yet.
If I look in the Vector.js code I see in the initialize function:
OpenLayers.Layer.prototype.initialize.apply(this, arguments);
// allow user-set renderer, otherwise assign one
if (!this.renderer || !this.renderer.supported()) {
this.assignRenderer();
}
So after the prototype initialize has been called, this.div is there, and I need to "assign' it to my custom renderer.
So I would expect:
Renderer to have a setContainer function, and the constructor of the Vector layer to use that function if a user-set renderer has been used.
TIA.
Best regards,
Bart
More information about the Dev
mailing list