need a setFeatureType function on Protocol.WFS, r=erilem (closes #2639)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11659 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -183,6 +183,18 @@ OpenLayers.Protocol.WFS.v1 = OpenLayers.Class(OpenLayers.Protocol, {
|
||||
|
||||
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
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user