Remove goog.isDef from more formats
This commit is contained in:
+31
-32
@@ -3,6 +3,7 @@ goog.provide('ol.format.WFS');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dom.NodeType');
|
||||
goog.require('goog.object');
|
||||
goog.require('ol');
|
||||
goog.require('ol.format.GML3');
|
||||
goog.require('ol.format.GMLBase');
|
||||
goog.require('ol.format.XMLFeature');
|
||||
@@ -27,7 +28,7 @@ goog.require('ol.xml');
|
||||
* @api stable
|
||||
*/
|
||||
ol.format.WFS = function(opt_options) {
|
||||
var options = goog.isDef(opt_options) ? opt_options : {};
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -45,14 +46,14 @@ ol.format.WFS = function(opt_options) {
|
||||
* @private
|
||||
* @type {ol.format.GMLBase}
|
||||
*/
|
||||
this.gmlFormat_ = goog.isDef(options.gmlFormat) ?
|
||||
this.gmlFormat_ = options.gmlFormat ?
|
||||
options.gmlFormat : new ol.format.GML3();
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {string}
|
||||
*/
|
||||
this.schemaLocation_ = goog.isDef(options.schemaLocation) ?
|
||||
this.schemaLocation_ = options.schemaLocation ?
|
||||
options.schemaLocation : ol.format.WFS.SCHEMA_LOCATION;
|
||||
|
||||
goog.base(this);
|
||||
@@ -123,7 +124,7 @@ ol.format.WFS.prototype.readFeaturesFromNode = function(node, opt_options) {
|
||||
'featureNS': this.featureNS_
|
||||
};
|
||||
goog.object.extend(context, this.getReadOptions(node,
|
||||
goog.isDef(opt_options) ? opt_options : {}));
|
||||
opt_options ? opt_options : {}));
|
||||
var objectStack = [context];
|
||||
this.gmlFormat_.FEATURE_COLLECTION_PARSERS[ol.format.GMLBase.GMLNS][
|
||||
'featureMember'] =
|
||||
@@ -131,7 +132,7 @@ ol.format.WFS.prototype.readFeaturesFromNode = function(node, opt_options) {
|
||||
var features = ol.xml.pushParseAndPop([],
|
||||
this.gmlFormat_.FEATURE_COLLECTION_PARSERS, node,
|
||||
objectStack, this.gmlFormat_);
|
||||
if (!goog.isDef(features)) {
|
||||
if (!features) {
|
||||
features = [];
|
||||
}
|
||||
return features;
|
||||
@@ -414,14 +415,14 @@ ol.format.WFS.writeDelete_ = function(node, feature, objectStack) {
|
||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||
var featureType = context['featureType'];
|
||||
var featurePrefix = context['featurePrefix'];
|
||||
featurePrefix = goog.isDef(featurePrefix) ? featurePrefix :
|
||||
featurePrefix = featurePrefix ? featurePrefix :
|
||||
ol.format.WFS.FEATURE_PREFIX;
|
||||
var featureNS = context['featureNS'];
|
||||
node.setAttribute('typeName', featurePrefix + ':' + featureType);
|
||||
ol.xml.setAttributeNS(node, ol.format.WFS.XMLNS, 'xmlns:' + featurePrefix,
|
||||
featureNS);
|
||||
var fid = feature.getId();
|
||||
if (goog.isDef(fid)) {
|
||||
if (fid) {
|
||||
ol.format.WFS.writeOgcFidFilter_(node, fid, objectStack);
|
||||
}
|
||||
};
|
||||
@@ -438,19 +439,19 @@ ol.format.WFS.writeUpdate_ = function(node, feature, objectStack) {
|
||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||
var featureType = context['featureType'];
|
||||
var featurePrefix = context['featurePrefix'];
|
||||
featurePrefix = goog.isDef(featurePrefix) ? featurePrefix :
|
||||
featurePrefix = featurePrefix ? featurePrefix :
|
||||
ol.format.WFS.FEATURE_PREFIX;
|
||||
var featureNS = context['featureNS'];
|
||||
node.setAttribute('typeName', featurePrefix + ':' + featureType);
|
||||
ol.xml.setAttributeNS(node, ol.format.WFS.XMLNS, 'xmlns:' + featurePrefix,
|
||||
featureNS);
|
||||
var fid = feature.getId();
|
||||
if (goog.isDef(fid)) {
|
||||
if (fid) {
|
||||
var keys = feature.getKeys();
|
||||
var values = [];
|
||||
for (var i = 0, ii = keys.length; i < ii; i++) {
|
||||
var value = feature.get(keys[i]);
|
||||
if (goog.isDef(value)) {
|
||||
if (ol.isDef(value)) {
|
||||
values.push({name: keys[i], value: value});
|
||||
}
|
||||
}
|
||||
@@ -495,13 +496,13 @@ ol.format.WFS.writeProperty_ = function(node, pair, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
ol.format.WFS.writeNative_ = function(node, nativeElement, objectStack) {
|
||||
if (goog.isDef(nativeElement.vendorId)) {
|
||||
if (nativeElement.vendorId) {
|
||||
node.setAttribute('vendorId', nativeElement.vendorId);
|
||||
}
|
||||
if (goog.isDef(nativeElement.safeToIgnore)) {
|
||||
if (ol.isDef(nativeElement.safeToIgnore)) {
|
||||
node.setAttribute('safeToIgnore', nativeElement.safeToIgnore);
|
||||
}
|
||||
if (goog.isDef(nativeElement.value)) {
|
||||
if (ol.isDef(nativeElement.value)) {
|
||||
ol.format.XSD.writeStringTextNode(node, nativeElement.value);
|
||||
}
|
||||
};
|
||||
@@ -535,12 +536,12 @@ ol.format.WFS.writeQuery_ = function(node, featureType, objectStack) {
|
||||
var featureNS = context['featureNS'];
|
||||
var propertyNames = context['propertyNames'];
|
||||
var srsName = context['srsName'];
|
||||
var prefix = goog.isDef(featurePrefix) ? featurePrefix + ':' : '';
|
||||
var prefix = featurePrefix ? featurePrefix + ':' : '';
|
||||
node.setAttribute('typeName', prefix + featureType);
|
||||
if (goog.isDef(srsName)) {
|
||||
if (srsName) {
|
||||
node.setAttribute('srsName', srsName);
|
||||
}
|
||||
if (goog.isDef(featureNS)) {
|
||||
if (featureNS) {
|
||||
ol.xml.setAttributeNS(node, ol.format.WFS.XMLNS, 'xmlns:' + featurePrefix,
|
||||
featureNS);
|
||||
}
|
||||
@@ -551,7 +552,7 @@ ol.format.WFS.writeQuery_ = function(node, featureType, objectStack) {
|
||||
ol.xml.makeSimpleNodeFactory('PropertyName'), propertyNames,
|
||||
objectStack);
|
||||
var bbox = context['bbox'];
|
||||
if (goog.isDef(bbox)) {
|
||||
if (bbox) {
|
||||
var child = ol.xml.createElementNS('http://www.opengis.net/ogc', 'Filter');
|
||||
ol.format.WFS.writeOgcBBOX_(child, bbox, objectStack);
|
||||
node.appendChild(child);
|
||||
@@ -632,23 +633,23 @@ ol.format.WFS.prototype.writeGetFeature = function(options) {
|
||||
'GetFeature');
|
||||
node.setAttribute('service', 'WFS');
|
||||
node.setAttribute('version', '1.1.0');
|
||||
if (goog.isDef(options)) {
|
||||
if (goog.isDef(options.handle)) {
|
||||
if (options) {
|
||||
if (options.handle) {
|
||||
node.setAttribute('handle', options.handle);
|
||||
}
|
||||
if (goog.isDef(options.outputFormat)) {
|
||||
if (options.outputFormat) {
|
||||
node.setAttribute('outputFormat', options.outputFormat);
|
||||
}
|
||||
if (goog.isDef(options.maxFeatures)) {
|
||||
if (ol.isDef(options.maxFeatures)) {
|
||||
node.setAttribute('maxFeatures', options.maxFeatures);
|
||||
}
|
||||
if (goog.isDef(options.resultType)) {
|
||||
if (options.resultType) {
|
||||
node.setAttribute('resultType', options.resultType);
|
||||
}
|
||||
if (goog.isDef(options.startIndex)) {
|
||||
if (ol.isDef(options.startIndex)) {
|
||||
node.setAttribute('startIndex', options.startIndex);
|
||||
}
|
||||
if (goog.isDef(options.count)) {
|
||||
if (ol.isDef(options.count)) {
|
||||
node.setAttribute('count', options.count);
|
||||
}
|
||||
}
|
||||
@@ -657,13 +658,11 @@ ol.format.WFS.prototype.writeGetFeature = function(options) {
|
||||
var context = {
|
||||
node: node,
|
||||
srsName: options.srsName,
|
||||
featureNS: goog.isDef(options.featureNS) ?
|
||||
options.featureNS : this.featureNS_,
|
||||
featureNS: options.featureNS ? options.featureNS : this.featureNS_,
|
||||
featurePrefix: options.featurePrefix,
|
||||
geometryName: options.geometryName,
|
||||
bbox: options.bbox,
|
||||
propertyNames: goog.isDef(options.propertyNames) ?
|
||||
options.propertyNames : []
|
||||
propertyNames: options.propertyNames ? options.propertyNames : []
|
||||
};
|
||||
goog.asserts.assert(goog.isArray(options.featureTypes),
|
||||
'options.featureTypes should be an array');
|
||||
@@ -690,9 +689,9 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
|
||||
node.setAttribute('service', 'WFS');
|
||||
node.setAttribute('version', '1.1.0');
|
||||
var baseObj, obj;
|
||||
if (goog.isDef(options)) {
|
||||
baseObj = goog.isDef(options.gmlOptions) ? options.gmlOptions : {};
|
||||
if (goog.isDef(options.handle)) {
|
||||
if (options) {
|
||||
baseObj = options.gmlOptions ? options.gmlOptions : {};
|
||||
if (options.handle) {
|
||||
node.setAttribute('handle', options.handle);
|
||||
}
|
||||
}
|
||||
@@ -723,7 +722,7 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
|
||||
ol.xml.makeSimpleNodeFactory('Delete'), deletes,
|
||||
objectStack);
|
||||
}
|
||||
if (goog.isDef(options.nativeElements)) {
|
||||
if (options.nativeElements) {
|
||||
ol.xml.pushSerializeAndPop({node: node, featureNS: options.featureNS,
|
||||
featureType: options.featureType, featurePrefix: options.featurePrefix},
|
||||
ol.format.WFS.TRANSACTION_SERIALIZERS_,
|
||||
|
||||
Reference in New Issue
Block a user