[Users] MapPanel Class and allOverlays properties

Arnaud Vandecasteele arnaud.sig at gmail.com
Mon Aug 3 15:36:40 CEST 2009


Hi all,

I'm playing with geoExt library and I'm trying to understand how it works in
deep.
I've created a mapPanel with no map constructor as above :

var mapPanel = new GeoExt.MapPanel({
        map: {
            controls: [
                new OpenLayers.Control.Navigation()
                ,new OpenLayers.Control.PanPanel()
                ,new OpenLayers.Control.ZoomPanel()
            ]
        }
        ,region : 'center'
        ,title : 'map'
        ,layers: [bluemarble]
        ,extent: [-5, 35, 15, 55]
    });


After that I have created a tree layer as above :

/* tree layer */
    var layerRoot = new Ext.tree.TreeNode({
        text: "All Layers"
        ,expanded: true
        ,loader: new GeoExt.tree.LayerLoader({
            applyLoader: true
        })
    });

    //Base Layers
    layerRoot.appendChild(new GeoExt.tree.BaseLayerContainer({
        text: "Base Layers"
        ,map: mapPanel.map
        ,expanded: true
    }));

    layerRoot.appendChild(new GeoExt.tree.OverlayLayerContainer({
        text: "Overlays"
        ,map: mapPanel.map
        ,expanded: true
    }));

    var layerTree = new Ext.tree.TreePanel({
        title: "Map Layers",
        root: layerRoot,
        expanded: true
    });

The things works almost perfectly but all my layers seems to be considering
as "overlays".

So I've looked in the MapPanel Class to understand what is wrong and I've
found in the line 101 why it doesn't work properly :

        if(!(this.map instanceof OpenLayers.Map)) {
            this.map = new OpenLayers.Map(
                Ext.applyIf(this.map || {}, {allOverlays: true})
            );
        }


So my question is why the GeoExt developpers have decided to force the
allOverlays properties to false instead of true?
Indeed if I modify the class and set it to true my tree layer chow me a
correct result.

Can someone help me to understand.

Regards


Arnaud

-- 
--------------------------------------------------------------------
Van De Casteele Arnaud
72 Rue de la colline des camélias 97400 Saint-Denis
0262 30 67 79 - 0692 76 24 48
SIG - WebMapping - GPS embarqué
Site internet : http://geotribu.net/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20090803/d0e93f97/attachment.htm 


More information about the Users mailing list