[OpenLayers-Commits] r11659 - in trunk/openlayers:
lib/OpenLayers/Protocol/WFS tests/Protocol
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Mon Mar 7 10:40:41 EST 2011
Author: bartvde
Date: 2011-03-07 07:40:37 -0800 (Mon, 07 Mar 2011)
New Revision: 11659
Modified:
trunk/openlayers/lib/OpenLayers/Protocol/WFS/v1.js
trunk/openlayers/tests/Protocol/WFS.html
Log:
need a setFeatureType function on Protocol.WFS, r=erilem (closes #2639)
Modified: trunk/openlayers/lib/OpenLayers/Protocol/WFS/v1.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Protocol/WFS/v1.js 2011-03-07 15:05:06 UTC (rev 11658)
+++ trunk/openlayers/lib/OpenLayers/Protocol/WFS/v1.js 2011-03-07 15:40:37 UTC (rev 11659)
@@ -183,6 +183,18 @@
return response;
},
+
+ /**
+ * APIMethod: setFeatureType
+ * Change the feature type on the fly.
+ *
+ * Parameters:
+ * featureType - {String} Local (without prefix) feature typeName.
+ */
+ setFeatureType: function(featureType) {
+ this.featureType = featureType;
+ this.format.featureType = featureType;
+ },
/**
* Method: handleRead
Modified: trunk/openlayers/tests/Protocol/WFS.html
===================================================================
--- trunk/openlayers/tests/Protocol/WFS.html 2011-03-07 15:05:06 UTC (rev 11658)
+++ trunk/openlayers/tests/Protocol/WFS.html 2011-03-07 15:40:37 UTC (rev 11659)
@@ -24,6 +24,22 @@
"initialize returns instance of custom versioned protocol")
}
+ function test_setFeatureType(t) {
+ t.plan(4);
+ var protocol = new OpenLayers.Protocol.WFS({
+ url: "http://some.url.org",
+ featureNS: "http://namespace.org",
+ featureType: "type"
+ });
+ t.eq(protocol.featureType, "type", "featureType set correctly by constructor");
+ t.eq(protocol.format.featureType, "type", "featureType correctly set on format by constructor");
+ // change the feature type on the fly
+ protocol.setFeatureType("foo");
+ t.eq(protocol.featureType, "foo", "featureType changed correctly by setFeatureType");
+ t.eq(protocol.format.featureType, "foo", "featureType correctly changed on format by setFeatureType");
+ protocol.destroy();
+ }
+
function test_read(t) {
t.plan(7);
More information about the Commits
mailing list