From 288641e00dde626f522b40971dd85b26d49585ed Mon Sep 17 00:00:00 2001 From: bartvde Date: Tue, 8 Mar 2011 15:21:14 +0000 Subject: [PATCH] OpenLayers.Protocol.WFS misses a setGeometryName method, p=fvanderbiest, r=me,erilem (closes #3037) git-svn-id: http://svn.openlayers.org/trunk/openlayers@11670 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Protocol/WFS/v1.js | 12 ++++++++++++ tests/Protocol/WFS.html | 17 +++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/lib/OpenLayers/Protocol/WFS/v1.js b/lib/OpenLayers/Protocol/WFS/v1.js index 7c8445cafb..981c887e98 100644 --- a/lib/OpenLayers/Protocol/WFS/v1.js +++ b/lib/OpenLayers/Protocol/WFS/v1.js @@ -195,6 +195,18 @@ OpenLayers.Protocol.WFS.v1 = OpenLayers.Class(OpenLayers.Protocol, { 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 diff --git a/tests/Protocol/WFS.html b/tests/Protocol/WFS.html index 2945e5052d..146c30ca66 100644 --- a/tests/Protocol/WFS.html +++ b/tests/Protocol/WFS.html @@ -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({