[Commits] r1331 - in sandbox/camptocamp/geobretagne: lib/GeoExt/data tests/lib/GeoExt/data

commits at geoext.org commits at geoext.org
Wed Aug 19 19:04:49 CEST 2009


Author: bbinet
Date: 2009-08-19 19:04:49 +0200 (Wed, 19 Aug 2009)
New Revision: 1331

Modified:
   sandbox/camptocamp/geobretagne/lib/GeoExt/data/WMSCapabilitiesReader.js
   sandbox/camptocamp/geobretagne/tests/lib/GeoExt/data/WMSCapabilitiesReader.html
Log:
apply patch patch_152-r1330-A0.diff from geoext ticket 152: Add support for giving default layer options to WMSCapabilitiesReader

Modified: sandbox/camptocamp/geobretagne/lib/GeoExt/data/WMSCapabilitiesReader.js
===================================================================
--- sandbox/camptocamp/geobretagne/lib/GeoExt/data/WMSCapabilitiesReader.js	2009-08-19 09:32:05 UTC (rev 1330)
+++ sandbox/camptocamp/geobretagne/lib/GeoExt/data/WMSCapabilitiesReader.js	2009-08-19 17:04:49 UTC (rev 1331)
@@ -152,6 +152,20 @@
         for(var i=0, len=capability.layers.length; i<len; i++){
             layer = capability.layers[i];
             if(layer.name) {
+                var options = {
+                    queryable: layer.queryable != undefined ? 
+                        layer.queryable : undefined,
+                    minScale: layer.minScale != undefined ? 
+                        layer.minScale : undefined,
+                    maxScale: layer.maxScale != undefined ? 
+                        layer.maxScale : undefined,
+                    attribution: layer.attribution ?
+                        this.attributionMarkup(layer.attribution) :
+                        undefined
+                };
+                if (this.meta.layerOptions) {
+                    Ext.apply(options, this.meta.layerOptions);
+                }
                 var l = new OpenLayers.Layer.WMS(
                     layer.title || layer.name,
                     url, {
@@ -161,17 +175,8 @@
                         ),
                         format: this.imageFormat(layer),
                         version: data.version
-                    }, {
-                        queryable: layer.queryable != undefined ? 
-                            layer.queryable : undefined,
-                        minScale: layer.minScale != undefined ? 
-                            layer.minScale : undefined,
-                        maxScale: layer.maxScale != undefined ? 
-                            layer.maxScale : undefined,
-                        attribution: layer.attribution ?
-                            this.attributionMarkup(layer.attribution) :
-                            undefined
-                    }
+                    }, 
+                    options
                 );
                 records.push(new this.recordType(Ext.apply(layer, {
                     layer: l

Modified: sandbox/camptocamp/geobretagne/tests/lib/GeoExt/data/WMSCapabilitiesReader.html
===================================================================
--- sandbox/camptocamp/geobretagne/tests/lib/GeoExt/data/WMSCapabilitiesReader.html	2009-08-19 09:32:05 UTC (rev 1330)
+++ sandbox/camptocamp/geobretagne/tests/lib/GeoExt/data/WMSCapabilitiesReader.html	2009-08-19 17:04:49 UTC (rev 1331)
@@ -33,9 +33,13 @@
                  'field values set from configuration are correct');
         }
         function test_read(t) {
-            t.plan(34);
+            t.plan(35);
 
-            var reader = new GeoExt.data.WMSCapabilitiesReader();
+            var reader = new GeoExt.data.WMSCapabilitiesReader({
+                layerOptions: {
+                    singleTile: true
+                }
+            });
 
             var records = reader.read({responseXML: doc});
 
@@ -88,7 +92,7 @@
             t.eq(record.get("identifiers").gcmd, "id_value", "[2] correct identifiers attribute");
             // cannot test "dimensions" until we have nested layers: see http://trac.openlayers.org/ticket/2144
 
-            //7 tests -- Testing the layer field
+            //8 tests -- Testing the layer field
             var layer = record.get("layer");
             t.eq(layer.CLASS_NAME, "OpenLayers.Layer.WMS", "[2] layer field is of type OpenLayers.Layer.WMS");
             t.eq(layer.url, "http://publicus.opengeo.org:80/geoserver/wms?SERVICE=WMS&", "[2] layer field has correct URL");
@@ -97,6 +101,7 @@
             t.eq(typeof(layer.minScale), "number","[2] layer minScale has been set");
             t.eq(typeof(layer.maxScale), "number","[2] layer maxScale has been set");
             t.eq(layer.queryable, true, "[2] layer field has correct queryable attribute");
+            t.eq(layer.singleTile, true, "[2] layer field has correct singleTile attribute (from WMSCapabilitiesReader constructor)");
             
             // 3 tests -- attribution markup
             var attribution = layer.attribution;



More information about the Commits mailing list