[ka-Map-dev] [Bug 1439] New: _map.setLayerVisibility(layerName, false) doesn't work for layers not loaded

bugzilla-daemon at bugzilla.maptools.org bugzilla-daemon at bugzilla.maptools.org
Thu Apr 20 18:01:12 EDT 2006


http://bugzilla.maptools.org/show_bug.cgi?id=1439

           Summary: _map.setLayerVisibility(layerName, false) doesn't work
                    for layers not loaded
           Product: ka-Map
           Version: 0.3
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: core
        AssignedTo: ka-map-dev at lists.maptools.org
        ReportedBy: tim at commenspace.org


Though it may seem a bit useless, I'd like to be able to set the layer
visibility of "unloaded" layers to false with _map.setLayerVisibility().  This
currently produces an error because the layer has no properties (or methods)
before being loaded.  To fix, it requires a check in _map.setLayerVisibility() like

_map.prototype.setLayerVisibility = function( name, bVisible ) {
    var layer = this.getLayer( name );
    if(typeof(layer) != 'undefined') {
        layer.setVisibility( bVisible );
    }
}; 

The same could be done to setLayerQueryable and setLayerOpacity.  Though it may
be hard to imagine a use case, I've had reson to loop through all layers (from a
mapfile) and turn them all off (not visible).  Note that this error is triggered
by calling kaMap.setLayerVisibility(someUnloadedLayer, false).  

I'll commit this change if nobody objects.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


Please do NOT reply to this email, use the link above instead to 
login to bugzilla and submit your comment. Any email reply to this
address will be lost.


More information about the ka-Map-dev mailing list