[OpenLayers-Commits] r11670 - in trunk/openlayers: lib/OpenLayers/Protocol/WFS tests/Protocol

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Tue Mar 8 10:21:18 EST 2011


Author: bartvde
Date: 2011-03-08 07:21:14 -0800 (Tue, 08 Mar 2011)
New Revision: 11670

Modified:
   trunk/openlayers/lib/OpenLayers/Protocol/WFS/v1.js
   trunk/openlayers/tests/Protocol/WFS.html
Log:
OpenLayers.Protocol.WFS misses a setGeometryName method, p=fvanderbiest, r=me,erilem (closes #3037)

Modified: trunk/openlayers/lib/OpenLayers/Protocol/WFS/v1.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Protocol/WFS/v1.js	2011-03-08 10:16:03 UTC (rev 11669)
+++ trunk/openlayers/lib/OpenLayers/Protocol/WFS/v1.js	2011-03-08 15:21:14 UTC (rev 11670)
@@ -195,6 +195,18 @@
         this.featureType = featureType;
         this.format.featureType = featureType;
     },
+ 
+    /**
+     * APIMethod: setGeometryName
+     * Sets the geometryName option after instantiation.
+     *
+     * Parameters:
+     * geometryName - {String} Name of geometry attribute.
+     */
+    setGeometryName: function(geometryName) {
+        this.geometryName = geometryName;
+        this.format.geometryName = geometryName;
+    },
     
     /**
      * Method: handleRead

Modified: trunk/openlayers/tests/Protocol/WFS.html
===================================================================
--- trunk/openlayers/tests/Protocol/WFS.html	2011-03-08 10:16:03 UTC (rev 11669)
+++ trunk/openlayers/tests/Protocol/WFS.html	2011-03-08 15:21:14 UTC (rev 11670)
@@ -24,6 +24,23 @@
              "initialize returns instance of custom versioned protocol")
     }
 
+    function test_setGeometryName(t) {
+        t.plan(4);
+        var protocol = new OpenLayers.Protocol.WFS({
+            url: "http://some.url.org",
+            featureNS: "http://namespace.org",
+            featureType: "type",
+            geometryName: "geom"
+        });
+        t.eq(protocol.geometryName, "geom", "geometryName set correctly by constructor");
+        t.eq(protocol.format.geometryName, "geom", "geometryName correctly set on format by constructor");
+        // change the geometryName on the fly
+        protocol.setGeometryName("SHAPE");
+        t.eq(protocol.geometryName, "SHAPE", "geometryName changed correctly by setGeometryName");
+        t.eq(protocol.format.geometryName, "SHAPE", "geometryName correctly changed on format by setGeometryName");
+        protocol.destroy();
+    }
+
     function test_setFeatureType(t) {
         t.plan(4);
         var protocol = new OpenLayers.Protocol.WFS({



More information about the Commits mailing list