[Commits] r255 - in sandbox/opengeo/geoexplorer: . lib lib/GeoExt/data

commits at geoext.org commits at geoext.org
Mon Mar 23 23:52:13 CET 2009


Author: tschaub
Date: 2009-03-23 23:52:13 +0100 (Mon, 23 Mar 2009)
New Revision: 255

Added:
   sandbox/opengeo/geoexplorer/lib/GeoExt/data/WMSCapabilitiesReader.js
Modified:
   sandbox/opengeo/geoexplorer/lib/GeoExt.js
   sandbox/opengeo/geoexplorer/modifications.txt
Log:
initial code for wms capabilities reader (see #26)

Added: sandbox/opengeo/geoexplorer/lib/GeoExt/data/WMSCapabilitiesReader.js
===================================================================
--- sandbox/opengeo/geoexplorer/lib/GeoExt/data/WMSCapabilitiesReader.js	                        (rev 0)
+++ sandbox/opengeo/geoexplorer/lib/GeoExt/data/WMSCapabilitiesReader.js	2009-03-23 22:52:13 UTC (rev 255)
@@ -0,0 +1,37 @@
+Ext.namespace("GeoExt.data");
+
+GeoExt.data.WMSCapabilitiesReader = function(opts){
+    GeoExt.data.WMSCapabilitiesReader.superclass.constructor.apply(this, arguments);
+    this.recordType = this.recordType || Ext.data.Record.create([
+        {name: 'name', type: 'string'},
+        {name: 'abstract', type: 'string'},
+        {name: 'title', type: 'string'},
+        {name: 'prefix', type: 'string', defaultValue: ""},
+        {name: 'llbbox', type: 'auto'},
+        {name: 'styles', type: 'auto'},
+        {name: 'formats', type: 'auto'},
+        {name: 'queryable', type: 'boolean'}
+    ]);
+};
+
+Ext.extend(GeoExt.data.WMSCapabilitiesReader, Ext.data.DataReader, {
+    read: function (response) {
+        
+        var fmt = new OpenLayers.Format.WMSCapabilities();
+        var caps = fmt.read(response.responseXML);
+        var records = [];
+        
+        for (var i = 0; i < caps.capability.layers.length; i++){
+            var l = caps.capability.layers[i];
+            if (l.name){
+                records.push(new this.recordType(l));
+            }
+        }
+
+        return {
+            totalRecords: records.length,
+            success: true,
+            records: records
+        };
+    }
+});

Modified: sandbox/opengeo/geoexplorer/lib/GeoExt.js
===================================================================
--- sandbox/opengeo/geoexplorer/lib/GeoExt.js	2009-03-23 22:14:05 UTC (rev 254)
+++ sandbox/opengeo/geoexplorer/lib/GeoExt.js	2009-03-23 22:52:13 UTC (rev 255)
@@ -64,6 +64,7 @@
             "GeoExt/data/LayerRecord.js",
             "GeoExt/data/LayerStoreMediator.js",
             "GeoExt/data/ProtocolProxy.js",
+            "GeoExt/data/WMSCapabilitiesReader.js",
             "GeoExt/widgets/MapPanel.js",
             "GeoExt/widgets/tree/TristateCheckboxNode.js",
             "GeoExt/widgets/tree/TristateCheckboxNodeUI.js",

Modified: sandbox/opengeo/geoexplorer/modifications.txt
===================================================================
--- sandbox/opengeo/geoexplorer/modifications.txt	2009-03-23 22:14:05 UTC (rev 254)
+++ sandbox/opengeo/geoexplorer/modifications.txt	2009-03-23 22:52:13 UTC (rev 255)
@@ -2,4 +2,5 @@
 modifications to the trunk are listed below.
 
  * Added code required for layer tree (see #22)
+ * Add WMSCapabilitiesReader (see #26)
 



More information about the Commits mailing list