source:
trunk/workshop-routing-foss4g/web/GeoExt/examples/wms-capabilities.js
@
76
Revision 76, 1.8 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 | |
10 | /** api: example[wms-capabilities] |
11 | * WMS Capabilities Store |
12 | * ---------------------- |
13 | * Create layer records from WMS capabilities documents. |
14 | */ |
15 | |
16 | var store; |
17 | Ext.onReady(function() { |
18 | |
19 | // create a new WMS capabilities store |
20 | store = new GeoExt.data.WMSCapabilitiesStore({ |
21 | url: "data/wmscap.xml" |
22 | }); |
23 | // load the store with records derived from the doc at the above url |
24 | store.load(); |
25 | |
26 | // create a grid to display records from the store |
27 | var grid = new Ext.grid.GridPanel({ |
28 | title: "WMS Capabilities", |
29 | store: store, |
30 | columns: [ |
31 | {header: "Title", dataIndex: "title", sortable: true}, |
32 | {header: "Name", dataIndex: "name", sortable: true}, |
33 | {header: "Queryable", dataIndex: "queryable", sortable: true, width: 70}, |
34 | {id: "description", header: "Description", dataIndex: "abstract"} |
35 | ], |
36 | autoExpandColumn: "description", |
37 | renderTo: "capgrid", |
38 | height: 300, |
39 | width: 650, |
40 | listeners: { |
41 | rowdblclick: mapPreview |
42 | } |
43 | }); |
44 | |
45 | function mapPreview(grid, index) { |
46 | var record = grid.getStore().getAt(index); |
47 | var layer = record.getLayer().clone(); |
48 | |
49 | var win = new Ext.Window({ |
50 | title: "Preview: " + record.get("title"), |
51 | width: 512, |
52 | height: 256, |
53 | layout: "fit", |
54 | items: [{ |
55 | xtype: "gx_mappanel", |
56 | layers: [layer], |
57 | extent: record.get("llbbox") |
58 | }] |
59 | }); |
60 | win.show(); |
61 | } |
62 | |
63 | }); |
Note: See TracBrowser
for help on using the repository browser.