move srsName and axisOrientation from the instance to the read and write functions as discussed with @ahocevar
This commit is contained in:
committed by
ahocevar
parent
6f3fa14c53
commit
2f4f508d1a
@@ -3,6 +3,7 @@ goog.provide('ol.parser.ogc.GML_v2');
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.object');
|
||||
goog.require('ol.parser.ogc.GML');
|
||||
goog.require('ol.proj');
|
||||
|
||||
|
||||
|
||||
@@ -112,17 +113,21 @@ goog.inherits(ol.parser.ogc.GML_v2, ol.parser.ogc.GML);
|
||||
|
||||
|
||||
/**
|
||||
* @param {Object} obj Object structure to write out as XML.
|
||||
* @return {string} An string representing the XML document.
|
||||
* @param {ol.parser.ReadFeaturesResult} obj Object structure to write out as
|
||||
* GML.
|
||||
* @return {string} A string representing the GML document.
|
||||
*/
|
||||
ol.parser.ogc.GML_v2.prototype.write = function(obj) {
|
||||
if (goog.isDef(obj.metadata)) {
|
||||
this.srsName = goog.isDef(obj.metadata.projection) ?
|
||||
ol.proj.get(obj.metadata.projection).getCode() : undefined;
|
||||
}
|
||||
var root = this.writeNode('FeatureCollection', obj.features,
|
||||
'http://www.opengis.net/wfs');
|
||||
this.setAttributeNS(
|
||||
root, 'http://www.w3.org/2001/XMLSchema-instance',
|
||||
'xsi:schemaLocation', this.schemaLocation);
|
||||
this.srsName_ = goog.isNull(this.srsName) ? undefined : this.srsName;
|
||||
this.axisOrientation_ = goog.isNull(this.axisOrientation) ?
|
||||
undefined : this.axisOrientation;
|
||||
return this.serialize(root);
|
||||
var gml = this.serialize(root);
|
||||
delete this.srsName;
|
||||
return gml;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user