diff --git a/src/ol/format/wfs.js b/src/ol/format/wfs.js index 21c6cd7ee9..40a98cb333 100644 --- a/src/ol/format/wfs.js +++ b/src/ol/format/wfs.js @@ -116,6 +116,22 @@ ol.format.WFS.SCHEMA_LOCATIONS = { ol.format.WFS.DEFAULT_VERSION = '1.1.0'; +/** + * @return {Array.|string|undefined} featureType + */ +ol.format.WFS.prototype.getFeatureType = function() { + return this.featureType_; +}; + + +/** + * @param {Array.|string|undefined} featureType Feature type(s) to parse. + */ +ol.format.WFS.prototype.setFeatureType = function(featureType) { + this.featureType_ = featureType; +}; + + /** * Read all features from a WFS FeatureCollection. * diff --git a/test/spec/ol/format/wfs.test.js b/test/spec/ol/format/wfs.test.js index 24d15bf9df..4bd6fb5423 100644 --- a/test/spec/ol/format/wfs.test.js +++ b/test/spec/ol/format/wfs.test.js @@ -1,5 +1,3 @@ - - goog.require('ol.Feature'); goog.require('ol.format.GML2'); goog.require('ol.format.WFS'); @@ -14,6 +12,20 @@ goog.require('ol.xml'); describe('ol.format.WFS', function() { + describe('featureType', function() { + + it('#getFeatureType #setFeatureType', function() { + var format = new ol.format.WFS({ + featureNS: 'http://www.openplans.org/topp', + featureType: ['foo', 'bar'] + }); + expect(format.getFeatureType()).to.eql(['foo', 'bar']); + format.setFeatureType('baz'); + expect(format.getFeatureType()).to.eql('baz'); + }); + + }); + describe('when parsing TOPP states GML from WFS', function() { var features, feature, xml;