source:
trunk/workshop-routing-foss4g/web/GeoExt/examples/mappanel-viewport.js
@
81
Revision 76, 2.0 KB checked in by djay, 13 years ago (diff) | |
---|---|
|
Line | |
---|---|
1 | /** |
2 | * Copyright (c) 2008-2010 The Open Source Geospatial Foundation |
3 | * |
4 | * Published under the BSD license. |
5 | * See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text |
6 | * of the license. |
7 | */ |
8 | |
9 | /** api: example[mappanel-viewport] |
10 | * Map Panel (in a Viewport) |
11 | * ------------------------- |
12 | * Render a map panel in a viewport. |
13 | */ |
14 | |
15 | var mapPanel; |
16 | |
17 | Ext.onReady(function() { |
18 | |
19 | // if true a google layer is used, if false |
20 | // the bluemarble WMS layer is used |
21 | var google = false; |
22 | |
23 | var options, layer; |
24 | var extent = new OpenLayers.Bounds(-5, 35, 15, 55); |
25 | |
26 | if (google) { |
27 | |
28 | options = { |
29 | projection: new OpenLayers.Projection("EPSG:900913"), |
30 | units: "m", |
31 | numZoomLevels: 18, |
32 | maxResolution: 156543.0339, |
33 | maxExtent: new OpenLayers.Bounds(-20037508, -20037508, |
34 | 20037508, 20037508.34) |
35 | }; |
36 | |
37 | layer = new OpenLayers.Layer.Google( |
38 | "Google Satellite", |
39 | {type: G_SATELLITE_MAP, sphericalMercator: true} |
40 | ); |
41 | |
42 | extent.transform( |
43 | new OpenLayers.Projection("EPSG:4326"), options.projection |
44 | ); |
45 | |
46 | } else { |
47 | layer = new OpenLayers.Layer.WMS( |
48 | "Global Imagery", |
49 | "http://maps.opengeo.org/geowebcache/service/wms", |
50 | {layers: "bluemarble"}, |
51 | {isBaseLayer: true} |
52 | ); |
53 | } |
54 | |
55 | var map = new OpenLayers.Map(options); |
56 | |
57 | new Ext.Viewport({ |
58 | layout: "border", |
59 | items: [{ |
60 | region: "north", |
61 | contentEl: "title", |
62 | height: 50 |
63 | }, { |
64 | region: "center", |
65 | id: "mappanel", |
66 | title: "Map", |
67 | xtype: "gx_mappanel", |
68 | map: map, |
69 | layers: [layer], |
70 | extent: extent, |
71 | split: true |
72 | }, { |
73 | region: "east", |
74 | title: "Description", |
75 | contentEl: "description", |
76 | width: 200, |
77 | split: true |
78 | }] |
79 | }); |
80 | |
81 | mapPanel = Ext.getCmp("mappanel"); |
82 | }); |
Note: See TracBrowser
for help on using the repository browser.