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

Bart van den Eijnden bartvde at osgis.nl
Thu Jun 10 06:15:53 EDT 2010


Yes I know that option exists, but in that case I need to put my custom Renderer in the OpenLayers namespace, which is not what I want.

Best regards,
Bart

On Jun 10, 2010, at 9:57 AM, Slawomir Messner wrote:

>  Ok, the last mail was maybe a little short. We do it like this:
> renderers: ["REDESVG", "SVG", "VML"]
> As you see we use rendereS and an array, so for you it would be
> 
> renderers: [new Geozet.Renderer.Anchor()]
> Regards,
> Slawomir
> 
> 
> 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
> 
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
> 




More information about the Dev mailing list