Add getFeatureType and setFeatureType functions to ol.format.WFS
This commit is contained in:
@@ -116,6 +116,22 @@ ol.format.WFS.SCHEMA_LOCATIONS = {
|
|||||||
ol.format.WFS.DEFAULT_VERSION = '1.1.0';
|
ol.format.WFS.DEFAULT_VERSION = '1.1.0';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {Array.<string>|string|undefined} featureType
|
||||||
|
*/
|
||||||
|
ol.format.WFS.prototype.getFeatureType = function() {
|
||||||
|
return this.featureType_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Array.<string>|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.
|
* Read all features from a WFS FeatureCollection.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
goog.require('ol.Feature');
|
goog.require('ol.Feature');
|
||||||
goog.require('ol.format.GML2');
|
goog.require('ol.format.GML2');
|
||||||
goog.require('ol.format.WFS');
|
goog.require('ol.format.WFS');
|
||||||
@@ -14,6 +12,20 @@ goog.require('ol.xml');
|
|||||||
|
|
||||||
describe('ol.format.WFS', function() {
|
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() {
|
describe('when parsing TOPP states GML from WFS', function() {
|
||||||
|
|
||||||
var features, feature, xml;
|
var features, feature, xml;
|
||||||
|
|||||||
Reference in New Issue
Block a user