Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>GeoExt Workshop Application</title>
- <script src="../resources/js/ext-3.4.0/ext-base.js" type="text/javascript"></script>
- <script src="../resources/js/ext-3.4.0/ext-all.js" type="text/javascript"></script>
- <link rel="stylesheet" type="text/css" href="../resources/js/ext-3.4.0/resources/css/ext-all.css"/>
- <link rel="stylesheet" href="../resources/js/OpenLayers/theme/default/style.css" type="text/css" />
- <script src="../resources/js/OpenLayers/OpenLayers.js" type="text/javascript"></script>
- <script src="../resources/js/GeoExt/GeoExt.js" type="text/javascript"></script>
- <link rel="stylesheet" type="text/css" href="../resources/js/GeoExt/css/geoext-all.css"/>
- <script>
- Ext.BLANK_IMAGE_URL = "../resources/js/ext-3.4.0/resources/images/default/s.gif";
- var app, items = [], controls = [];
- var lon = 84.3;
- var lat = 28;
- var zoom = 8;
- var url = "http://192.168.70.65:8182/geoserver/wms";
- Ext.onReady(function() {
- app = new Ext.Viewport({
- layout: "border",
- items: items
- });
- });
- items.push({
- xtype: "gx_mappanel",
- ref: "mapPanel",
- region: "center",
- map: {
- numZoomLevels: 19,
- controls: controls
- },
- zoom:8,
- center:[lon,lat],
- layers: [
- new OpenLayers.Layer.WMS( "Border",
- url,
- {layers: 'GisData:BORDER' ,transparent: "true",format: "image/png"}),
- new OpenLayers.Layer.WMS( "2G Down Sites",
- url,
- {layers: 'GisData:sites', transparent: "true",format: "image/png"})
- ]
- });
- controls.push(
- new OpenLayers.Control.Navigation(),
- new OpenLayers.Control.Attribution(),
- new OpenLayers.Control.PanPanel(),
- new OpenLayers.Control.ZoomPanel()
- );
- items.push({
- xtype: "treepanel",
- ref: "tree",
- region: "west",
- width: 200,
- autoScroll: true,
- enableDD: true,
- animate: true,
- containerScroll: true,
- border: true,
- title: "Layers",
- split: true,
- collapsible: true,
- collapseMode: "mini",
- autoScroll: true,
- plugins: [
- new GeoExt.plugins.TreeNodeRadioButton()
- ],
- root: new GeoExt.tree.LayerContainer({
- expanded: true
- }),
- bbar: [{
- text: "Show legend Window",
- handler: function() {
- var window = new Ext.Window({
- title: "Legend",
- width: 200,
- height:200,
- layout: "fit",
- collapsible: true,
- autoScroll:true,
- maximizable: true,
- items: [{
- xtype: "gx_legendpanel",
- region: "east",
- width: 200,
- autoScroll: true,
- padding: 5
- }]
- });
- window.show();
- window.alignTo(Ext.getBody(), "tr-tr", [-10, 10]);
- }
- }]
- });
- controls.push(new OpenLayers.Control.WMSGetFeatureInfo({
- autoActivate: true,
- infoFormat: "application/vnd.ogc.gml",
- maxFeatures: 3,
- eventListeners: {
- "getfeatureinfo": function(e) {
- alert(e.xy);
- var items = [];
- Ext.each(e.features, function(feature) {
- items.push({
- xtype: "propertygrid",
- title: feature.fid,
- source: feature.attributes
- });
- });
- new GeoExt.Popup({
- title: "Info",
- width: 200,
- height: 200,
- layout: "accordion",
- map: app.mapPanel,
- location: e.xy,
- maximizable: true,
- collapsible: true,
- items: items
- }).show();
- }
- }
- }));
- </script>
- </head>
- <body>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement