[OpenLayers-Users] Re: Addming map object in GeoExt window panel

sqgs mxxerr at yahoo.com
Fri Mar 2 09:03:59 EST 2012


Thanks. 

so are you saying the map object is already declared in mapPanel?, so I can
directly adding map controls?

e.g.:

var mapPanel;
Ext.onReady(function() {
    new Ext.Window({
        title: "GeoExt MapPanel Window",
        height: 400,
        width: 600,
        layout: "fit",
        items: [{
            xtype: "gx_mappanel",
            id: "mappanel",
            layers: [new OpenLayers.Layer.WMS(
                "Global Imagery",
                "http://maps.opengeo.org/geowebcache/service/wms",
                {layers: "bluemarble"}
            )],
            extent: "-5,35,15,55"
        }]
    }).show();
    
    mapPanel = Ext.getCmp("mappanel");
 
    //Start from here I add map controls:
    //change center location
    mapPanel.map.setCenter(new OpenLayers.LonLat(-80, 44), 4);
    .....
    //add snap control: 
    var snap = new OpenLayers.Control.Snapping({layer: myLayer});
    mapPanel.map.addControl(snap);
    snap.activate();
    
   .....

});

I will try this. thanks.

Matt.


--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Addming-map-object-in-GeoExt-window-panel-tp4537963p4539651.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list