starting to add tests for WFS 1.1.0
make sure we don't override the wfs:FeatureCollection reader with the one from GML
This commit is contained in:
@@ -57,6 +57,40 @@ ol.parser.ogc.WFS_v1 = function(opt_options) {
|
||||
goog.inherits(ol.parser.ogc.WFS_v1, ol.parser.XML);
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.parser.ogc.Filter_v1_0_0|ol.parser.ogc.Filter_v1_1_0} filter The
|
||||
* Filter parser to use.
|
||||
* @protected
|
||||
*/
|
||||
ol.parser.ogc.WFS_v1.prototype.setFilterParser = function(filter) {
|
||||
this.filter_ = filter;
|
||||
for (var uri in this.filter_.readers) {
|
||||
for (var key in this.filter_.readers[uri]) {
|
||||
if (!goog.isDef(this.readers[uri])) {
|
||||
this.readers[uri] = {};
|
||||
}
|
||||
// do not overwrite any readers
|
||||
if (!goog.isDef(this.readers[uri][key])) {
|
||||
this.readers[uri][key] = goog.bind(this.filter_.readers[uri][key],
|
||||
this.filter_);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (uri in this.filter_.writers) {
|
||||
for (key in this.filter_.writers[uri]) {
|
||||
if (!goog.isDef(this.writers[uri])) {
|
||||
this.writers[uri] = {};
|
||||
}
|
||||
// do not overwrite any writers
|
||||
if (!goog.isDef(this.writers[uri][key])) {
|
||||
this.writers[uri][key] = goog.bind(this.filter_.writers[uri][key],
|
||||
this.filter_);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {string|Document|Element} data Data to read.
|
||||
* @return {Object} An object representing the document.
|
||||
|
||||
@@ -74,25 +74,7 @@ ol.parser.ogc.WFS_v1_0_0 = function(opt_options) {
|
||||
return node;
|
||||
}
|
||||
});
|
||||
this.filter_ = new ol.parser.ogc.Filter_v1_0_0();
|
||||
for (var uri in this.filter_.readers) {
|
||||
for (var key in this.filter_.readers[uri]) {
|
||||
if (!goog.isDef(this.readers[uri])) {
|
||||
this.readers[uri] = {};
|
||||
}
|
||||
this.readers[uri][key] = goog.bind(this.filter_.readers[uri][key],
|
||||
this.filter_);
|
||||
}
|
||||
}
|
||||
for (uri in this.filter_.writers) {
|
||||
for (key in this.filter_.writers[uri]) {
|
||||
if (!goog.isDef(this.writers[uri])) {
|
||||
this.writers[uri] = {};
|
||||
}
|
||||
this.writers[uri][key] = goog.bind(this.filter_.writers[uri][key],
|
||||
this.filter_);
|
||||
}
|
||||
}
|
||||
this.setFilterParser(new ol.parser.ogc.Filter_v1_0_0());
|
||||
};
|
||||
goog.inherits(ol.parser.ogc.WFS_v1_0_0,
|
||||
ol.parser.ogc.WFS_v1);
|
||||
|
||||
@@ -2,6 +2,7 @@ goog.provide('ol.parser.ogc.WFS_v1_1_0');
|
||||
|
||||
goog.require('goog.functions');
|
||||
goog.require('goog.object');
|
||||
goog.require('ol.parser.ogc.Filter_v1_1_0');
|
||||
goog.require('ol.parser.ogc.WFS_v1');
|
||||
|
||||
|
||||
@@ -36,9 +37,11 @@ ol.parser.ogc.WFS_v1_1_0 = function() {
|
||||
this.readChildNodes(node, obj);
|
||||
},
|
||||
'Feature': function(node, container) {
|
||||
var obj = {fids: []};
|
||||
var obj = {};
|
||||
this.readChildNodes(node, obj);
|
||||
container.insertIds.push(obj.fids[0]);
|
||||
for (var key in obj.fids) {
|
||||
container.insertIds.push(key);
|
||||
}
|
||||
}
|
||||
});
|
||||
goog.object.extend(this.writers[this.defaultNamespaceURI], {
|
||||
@@ -88,7 +91,7 @@ ol.parser.ogc.WFS_v1_1_0 = function() {
|
||||
return node;
|
||||
}
|
||||
});
|
||||
// TODO ogc and gml namespaces
|
||||
this.setFilterParser(new ol.parser.ogc.Filter_v1_1_0());
|
||||
};
|
||||
goog.inherits(ol.parser.ogc.WFS_v1_1_0,
|
||||
ol.parser.ogc.WFS_v1);
|
||||
|
||||
Reference in New Issue
Block a user