[Users] Rendering Overviewmap in Ext.Panel using viewport

Eric Lemoine eric.lemoine at camptocamp.com
Tue Sep 28 17:01:02 CEST 2010


On Tue, Sep 28, 2010 at 4:10 PM, Andrew Stewart
<Andrew.Stewart at reddeer.ca> wrote:
>   Hi, thanks for your suggestion. I am not sure if I have this correctly since I have never used a BoxComponent before. Unfortunately I tried the below code and my overview map doesn't seem to show up anywhere, any idea what could be wrong? Appreciate the assistance.
>
>  //Define options for overview Map
>        var options = {layers: [layer_Overview], units: 'km', maxExtent: new
>        OpenLayers.Bounds(-114.167163950302,52.0782516055391,-113.454306937636,52.4066932849551).transform(new
>        OpenLayers.Projection("EPSG:4326"), new
>        OpenLayers.Projection("EPSG:900913")),
>        numZoomLevels: 1,
>        projection: new OpenLayers.Projection("EPSG:900913"),
>        displayProjection: new
>        OpenLayers.Bounds(-114.167163950302,52.0782516055391,-113.454306937636,52.4066932849551).transform(new
>        OpenLayers.Projection("EPSG:4326"), new
>        OpenLayers.Projection("EPSG:900913"))}
>
>
>        var overviewBox = Ext.extend(Ext.BoxComponent, {
>        map: map,
>        afterRender: function() {
>        var redgisOverview = new OpenLayers.Control.OverviewMap({
>            div: this.getEl(overview).dom,
>            mapOptions: options
>            //div: container_overview
>        });
>        this.map.addControl(redgisOverview);
>        redgisOverview.superclass.afterRender.apply(this, arguments);
>        }
>        });

What I gave you is the class definition. That class need be instantiated.

// class definition
var OverviewMapBox = Ext.extend(Ext.BoxComponent, {
   map: null,
   ctrlOptions: null,
   afterRender: function() {
       var control = new OpenLayers.Control.OverviewMap(Ext.applyIf({
           div: this.getEl().dom,
           mapOptions:
       }, this.ctrlOptions));
       this.map.addControl(control);
       MousePositionBox.superclass.afterRender.apply(this, arguments);
   }
});

// instantiation
var overviewMapBox = new OverviewMapBox({
    renderTo: "overview",
    map: map,
    ctrlOptions: {
        mapOptions: mapOptions
    }
});

> <body onload="init();">
>        <div id="themes">test
>        </div>
>         <div id="legend">
>        </div>
>        <div id="tools">
>        </div>
>        <div id="overview"></div>
>    </body>



-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com


More information about the Users mailing list