root/sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserInWindowExample.js

Revision 2002, 2.3 kB (checked in by adube, 6 months ago)

minor change

  • Property svn:mime-type set to text/plain
  • Property svn:eol-style set to native
Line 
1 var WMSBrowser, mapPanel, browserWindow, tree;
2
3 //OpenLayers.ProxyHost = "./proxy.php?url=";
4
5 Ext.onReady(function() {
6
7     Ext.QuickTips.init();
8
9     var actions = [];
10
11     var action = new Ext.Action({
12       text: 'WMSBrowser',
13       handler: openWindow,
14       scope: this,
15       tooltip: OpenLayers.i18n('Add currently selected layers')
16     });
17     actions.push(action);
18
19     var options = {
20         projection: new OpenLayers.Projection("EPSG:900913"),
21         displayProjection: new OpenLayers.Projection("EPSG:4326"),
22         units: "m",
23         numZoomLevels: 18,
24         maxResolution: 156543.0339,
25         maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
26                                          20037508, 20037508.34)
27     };
28     map = new OpenLayers.Map('map', options);
29
30     mapPanel = new GeoExt.MapPanel({
31         region: "center",
32         layers: [
33             new OpenLayers.Layer.Google("Google Physical",{'sphericalMercator': true, type: G_PHYSICAL_MAP})
34         ],
35         map: map,
36         tbar: new Ext.Toolbar(actions)
37     });
38
39     tree = new Ext.tree.TreePanel({
40         region: 'east',
41         root: new GeoExt.tree.LayerContainer({
42             text: 'Map Layers',
43             layerStore: mapPanel.layers,
44             leaf: false,
45             expanded: true
46         }),
47         enableDD: true,
48         width: 170
49     });
50
51     new Ext.Panel({
52         renderTo: "content",
53         layout: "border",
54         width: 570,
55         height: 350,
56         items: [mapPanel, tree]
57     });
58
59     map.setCenter(new OpenLayers.LonLat(-10762333.581055,5968203.1676758), 2);
60 });
61
62 var openWindow = function() {
63     if(!browserWindow) {
64         WMSBrowser = new GeoExt.ux.WMSBrowser({
65             border: false,
66             region: "east",
67             gridPanelOptions: {'height': 260},
68             // comment the below line to have a 'textfield' instead of a
69             // 'combobox'.  oServerStore is in ./store.js
70             serverStore: oServerStore,
71             mapPanel: mapPanel
72         });
73
74         browserWindow = new Ext.Window({
75             resizable: false,
76             modal: true,
77             closeAction: 'hide',
78             width: 600,
79             height: 400,
80             title: OpenLayers.i18n("WMSBrowser"),
81             layout: 'fit',
82             items: [WMSBrowser]
83         });
84     }
85
86     browserWindow.show();
87
88 };
Note: See TracBrowser for help on using the browser.