[OpenLayers-Commits] r11689 - in sandbox/cmoullet/openlayers: . examples lib/OpenLayers/Format lib/OpenLayers/Layer tests/Format

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Thu Mar 10 14:51:41 EST 2011


Author: cmoullet
Date: 2011-03-10 11:51:40 -0800 (Thu, 10 Mar 2011)
New Revision: 11689

Modified:
   sandbox/cmoullet/openlayers/
   sandbox/cmoullet/openlayers/examples/fullScreen.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMSGetFeatureInfo.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/KaMap.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/MapGuide.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Zoomify.js
   sandbox/cmoullet/openlayers/tests/Format/WMSGetFeatureInfo.html
Log:
merge with trunk



Property changes on: sandbox/cmoullet/openlayers
___________________________________________________________________
Modified: svn:mergeinfo
   - /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:11161-11678
   + /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:11161-11688

Modified: sandbox/cmoullet/openlayers/examples/fullScreen.js
===================================================================
--- sandbox/cmoullet/openlayers/examples/fullScreen.js	2011-03-10 16:36:30 UTC (rev 11688)
+++ sandbox/cmoullet/openlayers/examples/fullScreen.js	2011-03-10 19:51:40 UTC (rev 11689)
@@ -13,18 +13,3 @@
     map.addControl(new OpenLayers.Control.LayerSwitcher());
     map.setCenter(new OpenLayers.LonLat(0, 0), 6);
 }
-var map;
-function init(){
-    map = new OpenLayers.Map('map');
-
-    var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
-        "http://vmap0.tiles.osgeo.org/wms/vmap0",
-        {layers: 'basic'} );
-        var ol_wms_nobuffer = new OpenLayers.Layer.WMS( "OpenLayers WMS (no tile buffer)",
-        "http://vmap0.tiles.osgeo.org/wms/vmap0",
-        {layers: 'basic'}, {buffer: 0});
-
-    map.addLayers([ol_wms, ol_wms_nobuffer]);
-    map.addControl(new OpenLayers.Control.LayerSwitcher());
-    map.setCenter(new OpenLayers.LonLat(0, 0), 6);
-}

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMSGetFeatureInfo.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMSGetFeatureInfo.js	2011-03-10 16:36:30 UTC (rev 11688)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMSGetFeatureInfo.js	2011-03-10 19:51:40 UTC (rev 11689)
@@ -230,12 +230,14 @@
                 var child = children[i];
                 if (child.nodeType == 1) {
                     var grandchildren = child.childNodes;
-                    if (grandchildren.length == 1) {
+                    var name = (child.prefix) ?
+                        child.nodeName.split(":")[1] : child.nodeName;
+                    if (grandchildren.length == 0) {
+                        attributes[name] = null
+                    } else if (grandchildren.length == 1) {
                         var grandchild = grandchildren[0];
                         if (grandchild.nodeType == 3 ||
                             grandchild.nodeType == 4) {
-                            var name = (child.prefix) ? 
-                                child.nodeName.split(":")[1] : child.nodeName;
                             var value = grandchild.nodeValue.replace(
                                 this.regExes.trimSpace, "");
                             attributes[name] = value;

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/KaMap.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/KaMap.js	2011-03-10 16:36:30 UTC (rev 11688)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/KaMap.js	2011-03-10 19:51:40 UTC (rev 11689)
@@ -102,14 +102,14 @@
      *
      * Parameters:
      * bounds - {<OpenLayers.Bound>}
-     * extent - {<OpenLayers.Bounds>}
+     * origin - {<OpenLayers.LonLat>}
      * resolution - {Number}
      *
      * Returns:
      * Object containing properties tilelon, tilelat, tileoffsetlat,
      * tileoffsetlat, tileoffsetx, tileoffsety
      */
-    calculateGridLayout: function(bounds, extent, resolution) {
+    calculateGridLayout: function(bounds, origin, resolution) {
         var tilelon = resolution*this.tileSize.w;
         var tilelat = resolution*this.tileSize.h;
         

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/MapGuide.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/MapGuide.js	2011-03-10 16:36:30 UTC (rev 11688)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/MapGuide.js	2011-03-10 19:51:40 UTC (rev 11689)
@@ -116,6 +116,12 @@
      **/
     defaultSize: new OpenLayers.Size(300,300),
 
+    /** 
+     * Property: tileOriginCorner
+     * {String} MapGuide tile server uses top-left as tile origin
+     **/
+    tileOriginCorner: "tl",
+
     /**
      * Constructor: OpenLayers.Layer.MapGuide
      * Create a new Mapguide layer, either tiled or untiled.  
@@ -439,28 +445,28 @@
      *
      * Parameters:
      * bounds - {<OpenLayers.Bound>}
-     * extent - {<OpenLayers.Bounds>}
+     * origin - {<OpenLayers.LonLat>}
      * resolution - {Number}
      *
      * Returns:
      * Object containing properties tilelon, tilelat, tileoffsetlat,
      * tileoffsetlat, tileoffsetx, tileoffsety
      */
-    calculateGridLayout: function(bounds, extent, resolution) {
+    calculateGridLayout: function(bounds, origin, resolution) {
         var tilelon = resolution * this.tileSize.w;
         var tilelat = resolution * this.tileSize.h;
         
-        var offsetlon = bounds.left - extent.left;
+        var offsetlon = bounds.left - origin.lon;
         var tilecol = Math.floor(offsetlon/tilelon) - this.buffer;
         var tilecolremain = offsetlon/tilelon - tilecol;
         var tileoffsetx = -tilecolremain * this.tileSize.w;
-        var tileoffsetlon = extent.left + tilecol * tilelon;
+        var tileoffsetlon = origin.lon + tilecol * tilelon;
         
-        var offsetlat = extent.top - bounds.top + tilelat; 
+        var offsetlat = origin.lat - bounds.top + tilelat; 
         var tilerow = Math.floor(offsetlat/tilelat) - this.buffer;
         var tilerowremain = tilerow - offsetlat/tilelat;
         var tileoffsety = tilerowremain * this.tileSize.h;
-        var tileoffsetlat = extent.top - tilelat*tilerow;
+        var tileoffsetlat = origin.lat - tilelat*tilerow;
         
         return { 
           tilelon: tilelon, tilelat: tilelat,

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Zoomify.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Zoomify.js	2011-03-10 16:36:30 UTC (rev 11688)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Zoomify.js	2011-03-10 19:51:40 UTC (rev 11689)
@@ -45,6 +45,12 @@
      */
     standardTileSize: 256,
 
+    /** 
+     * Property: tileOriginCorner
+     * {String} This layer uses top-left as tile origin
+     **/
+    tileOriginCorner: "tl",
+
     /**
      * Property: numberOfTiers
      * {Integer} Depth of the Zoomify pyramid, number of tiers (zoom levels)
@@ -258,28 +264,28 @@
      *
      * Parameters:
      * bounds - {<OpenLayers.Bound>}
-     * extent - {<OpenLayers.Bounds>}
+     * origin - {<OpenLayers.LonLat>}
      * resolution - {Number}
      *
      * Returns:
      * Object containing properties tilelon, tilelat, tileoffsetlat,
      * tileoffsetlat, tileoffsetx, tileoffsety
      */
-    calculateGridLayout: function(bounds, extent, resolution) {
+    calculateGridLayout: function(bounds, origin, resolution) {
         var tilelon = resolution * this.tileSize.w;
         var tilelat = resolution * this.tileSize.h;
 
-        var offsetlon = bounds.left - extent.left;
+        var offsetlon = bounds.left - origin.lon;
         var tilecol = Math.floor(offsetlon/tilelon) - this.buffer;
         var tilecolremain = offsetlon/tilelon - tilecol;
         var tileoffsetx = -tilecolremain * this.tileSize.w;
-        var tileoffsetlon = extent.left + tilecol * tilelon;
+        var tileoffsetlon = origin.lon + tilecol * tilelon;
 
-        var offsetlat = extent.top - bounds.top + tilelat;
+        var offsetlat = origin.lat - bounds.top + tilelat;
         var tilerow = Math.floor(offsetlat/tilelat) - this.buffer;
         var tilerowremain = tilerow - offsetlat/tilelat;
         var tileoffsety = tilerowremain * this.tileSize.h;
-        var tileoffsetlat = extent.top - tilelat*tilerow;
+        var tileoffsetlat = origin.lat - tilelat*tilerow;
 
         return {
           tilelon: tilelon, tilelat: tilelat,

Modified: sandbox/cmoullet/openlayers/tests/Format/WMSGetFeatureInfo.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Format/WMSGetFeatureInfo.html	2011-03-10 16:36:30 UTC (rev 11688)
+++ sandbox/cmoullet/openlayers/tests/Format/WMSGetFeatureInfo.html	2011-03-10 19:51:40 UTC (rev 11689)
@@ -52,7 +52,7 @@
     }
 
     function test_read_msGMLOutput(t) {
-        t.plan(12);
+        t.plan(13);
         
         var parser = new OpenLayers.Format.WMSGetFeatureInfo();
 
@@ -69,6 +69,28 @@
         t.eq(features.length, 0,
              "Parsing empty msGMLOutput response succesfull");
 
+        // read empty attribute
+        text =
+            '<?xml version="1.0" encoding="ISO-8859-1"?>' +
+            '<msGMLOutput ' +
+            '    xmlns:gml="http://www.opengis.net/gml"' +
+            '    xmlns:xlink="http://www.w3.org/1999/xlink"' +
+            '    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' +
+            '   <AAA64_layer>' +
+            '           <AAA64_feature>' +
+            '                   <gml:boundedBy>' +
+            '                           <gml:Box srsName="EPSG:28992">' +
+            '                                   <gml:coordinates>107397.266000,460681.063000 116568.188000,480609.250000</gml:coordinates>' +
+            '                           </gml:Box>' +
+            '                   </gml:boundedBy>' +
+            '                   <FOO>bar</FOO>' +
+            '                   <EMPTY></EMPTY>' +
+            '           </AAA64_feature>' +
+            '   </AAA64_layer>' +
+            '</msGMLOutput>';
+        features = parser.read(text);
+        t.eq((features[0].attributes.EMPTY === null), true, "Empty attribute is parsed as null");
+
         // read 1 feature from 1 layer
         text = 
             '<?xml version="1.0" encoding="ISO-8859-1"?>' +



More information about the Commits mailing list