[OpenLayers-Dev] using custom renderer on Layer.Vector

Slawomir Messner slawomir.messner at staff.uni-marburg.de
Thu Jun 10 03:54:30 EDT 2010


  I think renderer should be an array.

Am 10.06.2010 09:32, schrieb Bart van den Eijnden:
> 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
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
>


-- 
-----------------------------------------------
Slawomir Messner
Forschungszentrum "Deutscher Sprachatlas"
06421-28-24981




More information about the Dev mailing list