Merge pull request #3028 from fredj/wfsformat-cleanup

ol.format.WFS cleanup
This commit is contained in:
Frédéric Junod
2014-12-09 09:35:00 +01:00
+10 -12
View File
@@ -27,8 +27,7 @@ goog.require('ol.xml');
* @api stable * @api stable
*/ */
ol.format.WFS = function(opt_options) { ol.format.WFS = function(opt_options) {
var options = /** @type {olx.format.WFSOptions} */ var options = goog.isDef(opt_options) ? opt_options : {};
(goog.isDef(opt_options) ? opt_options : {});
/** /**
* @private * @private
@@ -54,7 +53,7 @@ ol.format.WFS = function(opt_options) {
* @type {string} * @type {string}
*/ */
this.schemaLocation_ = goog.isDef(options.schemaLocation) ? this.schemaLocation_ = goog.isDef(options.schemaLocation) ?
options.schemaLocation : ol.format.WFS.schemaLocation_; options.schemaLocation : ol.format.WFS.SCHEMA_LOCATION;
goog.base(this); goog.base(this);
}; };
@@ -65,14 +64,14 @@ goog.inherits(ol.format.WFS, ol.format.XMLFeature);
* @const * @const
* @type {string} * @type {string}
*/ */
ol.format.WFS.featurePrefix = 'feature'; ol.format.WFS.FEATURE_PREFIX = 'feature';
/** /**
* @const * @const
* @type {string} * @type {string}
*/ */
ol.format.WFS.xmlns = 'http://www.w3.org/2000/xmlns/'; ol.format.WFS.XMLNS = 'http://www.w3.org/2000/xmlns/';
/** /**
@@ -98,9 +97,8 @@ ol.format.WFS.TransactionResponse;
/** /**
* @const * @const
* @type {string} * @type {string}
* @private
*/ */
ol.format.WFS.schemaLocation_ = 'http://www.opengis.net/wfs ' + ol.format.WFS.SCHEMA_LOCATION = 'http://www.opengis.net/wfs ' +
'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd'; 'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd';
@@ -404,10 +402,10 @@ ol.format.WFS.writeDelete_ = function(node, feature, objectStack) {
var featureType = goog.object.get(context, 'featureType'); var featureType = goog.object.get(context, 'featureType');
var featurePrefix = goog.object.get(context, 'featurePrefix'); var featurePrefix = goog.object.get(context, 'featurePrefix');
featurePrefix = goog.isDef(featurePrefix) ? featurePrefix : featurePrefix = goog.isDef(featurePrefix) ? featurePrefix :
ol.format.WFS.featurePrefix; ol.format.WFS.FEATURE_PREFIX;
var featureNS = goog.object.get(context, 'featureNS'); var featureNS = goog.object.get(context, 'featureNS');
node.setAttribute('typeName', featurePrefix + ':' + featureType); node.setAttribute('typeName', featurePrefix + ':' + featureType);
ol.xml.setAttributeNS(node, ol.format.WFS.xmlns, 'xmlns:' + featurePrefix, ol.xml.setAttributeNS(node, ol.format.WFS.XMLNS, 'xmlns:' + featurePrefix,
featureNS); featureNS);
var fid = feature.getId(); var fid = feature.getId();
if (goog.isDef(fid)) { if (goog.isDef(fid)) {
@@ -428,10 +426,10 @@ ol.format.WFS.writeUpdate_ = function(node, feature, objectStack) {
var featureType = goog.object.get(context, 'featureType'); var featureType = goog.object.get(context, 'featureType');
var featurePrefix = goog.object.get(context, 'featurePrefix'); var featurePrefix = goog.object.get(context, 'featurePrefix');
featurePrefix = goog.isDef(featurePrefix) ? featurePrefix : featurePrefix = goog.isDef(featurePrefix) ? featurePrefix :
ol.format.WFS.featurePrefix; ol.format.WFS.FEATURE_PREFIX;
var featureNS = goog.object.get(context, 'featureNS'); var featureNS = goog.object.get(context, 'featureNS');
node.setAttribute('typeName', featurePrefix + ':' + featureType); node.setAttribute('typeName', featurePrefix + ':' + featureType);
ol.xml.setAttributeNS(node, ol.format.WFS.xmlns, 'xmlns:' + featurePrefix, ol.xml.setAttributeNS(node, ol.format.WFS.XMLNS, 'xmlns:' + featurePrefix,
featureNS); featureNS);
var fid = feature.getId(); var fid = feature.getId();
if (goog.isDef(fid)) { if (goog.isDef(fid)) {
@@ -530,7 +528,7 @@ ol.format.WFS.writeQuery_ = function(node, featureType, objectStack) {
node.setAttribute('srsName', srsName); node.setAttribute('srsName', srsName);
} }
if (goog.isDef(featureNS)) { if (goog.isDef(featureNS)) {
ol.xml.setAttributeNS(node, ol.format.WFS.xmlns, 'xmlns:' + featurePrefix, ol.xml.setAttributeNS(node, ol.format.WFS.XMLNS, 'xmlns:' + featurePrefix,
featureNS); featureNS);
} }
var item = goog.object.clone(context); var item = goog.object.clone(context);