[ka-Map-users] addMapLayer function

Sébastien Roch sebastien.roch at epfl.ch
Wed May 9 06:53:30 EDT 2007


Hello,
I'm generating layers on the fly and had a small problem with the
addMapLayer function :
If the layer we are trying to create is not visible at current scale, the
paintLayer function (called by addMapLayer) will fail because the layer's
domObj property is null.

The function was : 
kaMap.prototype.addMapLayer = function( l ) {
    var map = this.getCurrentMap();
    map.addLayer(l);
    this.setMapLayers();
    this.paintLayer(l);
    this.triggerEvent( KAMAP_LAYERS_CHANGED, this.currentMap );
};

correction suggestion :
kaMap.prototype.addMapLayer = function( l ) {
    var map = this.getCurrentMap();
    map.addLayer(l);
    this.setMapLayers();
    if(l.domObj)
	    this.paintLayer(l);
    this.triggerEvent( KAMAP_LAYERS_CHANGED, this.currentMap );
};

I think this have to be corrected in CVS for next version.
Sebastien



More information about the ka-Map-users mailing list