Remove goog.isDef from more formats
This commit is contained in:
@@ -22,7 +22,7 @@ goog.require('ol.xml');
|
||||
*/
|
||||
ol.format.GML2 = function(opt_options) {
|
||||
var options = /** @type {olx.format.GMLOptions} */
|
||||
(goog.isDef(opt_options) ? opt_options : {});
|
||||
(opt_options ? opt_options : {});
|
||||
|
||||
goog.base(this, options);
|
||||
|
||||
@@ -33,7 +33,7 @@ ol.format.GML2 = function(opt_options) {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
this.schemaLocation = goog.isDef(options.schemaLocation) ?
|
||||
this.schemaLocation = options.schemaLocation ?
|
||||
options.schemaLocation : ol.format.GML2.schemaLocation_;
|
||||
|
||||
};
|
||||
@@ -127,7 +127,7 @@ ol.format.GML2.prototype.innerBoundaryIsParser_ =
|
||||
var flatLinearRing = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<number>|undefined} */ (undefined),
|
||||
this.RING_PARSERS, node, objectStack, this);
|
||||
if (goog.isDef(flatLinearRing)) {
|
||||
if (flatLinearRing) {
|
||||
var flatLinearRings = /** @type {Array.<Array.<number>>} */
|
||||
(objectStack[objectStack.length - 1]);
|
||||
goog.asserts.assert(goog.isArray(flatLinearRings),
|
||||
@@ -153,7 +153,7 @@ ol.format.GML2.prototype.outerBoundaryIsParser_ =
|
||||
var flatLinearRing = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<number>|undefined} */ (undefined),
|
||||
this.RING_PARSERS, node, objectStack, this);
|
||||
if (goog.isDef(flatLinearRing)) {
|
||||
if (flatLinearRing) {
|
||||
var flatLinearRings = /** @type {Array.<Array.<number>>} */
|
||||
(objectStack[objectStack.length - 1]);
|
||||
goog.asserts.assert(goog.isArray(flatLinearRings),
|
||||
|
||||
@@ -41,7 +41,7 @@ goog.require('ol.xml');
|
||||
*/
|
||||
ol.format.GMLBase = function(opt_options) {
|
||||
var options = /** @type {olx.format.GMLOptions} */
|
||||
(goog.isDef(opt_options) ? opt_options : {});
|
||||
(opt_options ? opt_options : {});
|
||||
|
||||
/**
|
||||
* @protected
|
||||
@@ -116,7 +116,7 @@ ol.format.GMLBase.prototype.readFeaturesInternal = function(node, objectStack) {
|
||||
var featureType = context['featureType'];
|
||||
var featureNS = context['featureNS'];
|
||||
var i, ii, prefix = 'p', defaultPrefix = 'p0';
|
||||
if (!goog.isDef(featureType) && goog.isDefAndNotNull(node.childNodes)) {
|
||||
if (!featureType && goog.isDefAndNotNull(node.childNodes)) {
|
||||
featureType = [], featureNS = {};
|
||||
for (i = 0, ii = node.childNodes.length; i < ii; ++i) {
|
||||
var child = node.childNodes[i];
|
||||
@@ -162,7 +162,7 @@ ol.format.GMLBase.prototype.readFeaturesInternal = function(node, objectStack) {
|
||||
}
|
||||
features = ol.xml.pushParseAndPop([], parsersNS, node, objectStack);
|
||||
}
|
||||
if (!goog.isDef(features)) {
|
||||
if (!features) {
|
||||
features = [];
|
||||
}
|
||||
return features;
|
||||
@@ -222,7 +222,7 @@ ol.format.GMLBase.prototype.readFeatureElement = function(node, objectStack) {
|
||||
}
|
||||
}
|
||||
var feature = new ol.Feature(values);
|
||||
if (goog.isDef(geometryName)) {
|
||||
if (geometryName) {
|
||||
feature.setGeometryName(geometryName);
|
||||
}
|
||||
if (fid) {
|
||||
@@ -266,7 +266,7 @@ ol.format.GMLBase.prototype.readMultiPoint = function(node, objectStack) {
|
||||
var coordinates = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<Array.<number>>} */ ([]),
|
||||
this.MULTIPOINT_PARSERS_, node, objectStack, this);
|
||||
if (goog.isDef(coordinates)) {
|
||||
if (coordinates) {
|
||||
return new ol.geom.MultiPoint(coordinates);
|
||||
} else {
|
||||
return undefined;
|
||||
@@ -287,7 +287,7 @@ ol.format.GMLBase.prototype.readMultiLineString = function(node, objectStack) {
|
||||
var lineStrings = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<ol.geom.LineString>} */ ([]),
|
||||
this.MULTILINESTRING_PARSERS_, node, objectStack, this);
|
||||
if (goog.isDef(lineStrings)) {
|
||||
if (lineStrings) {
|
||||
var multiLineString = new ol.geom.MultiLineString(null);
|
||||
multiLineString.setLineStrings(lineStrings);
|
||||
return multiLineString;
|
||||
@@ -310,7 +310,7 @@ ol.format.GMLBase.prototype.readMultiPolygon = function(node, objectStack) {
|
||||
var polygons = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<ol.geom.Polygon>} */ ([]),
|
||||
this.MULTIPOLYGON_PARSERS_, node, objectStack, this);
|
||||
if (goog.isDef(polygons)) {
|
||||
if (polygons) {
|
||||
var multiPolygon = new ol.geom.MultiPolygon(null);
|
||||
multiPolygon.setPolygons(polygons);
|
||||
return multiPolygon;
|
||||
@@ -426,7 +426,7 @@ ol.format.GMLBase.prototype.readLinearRing = function(node, objectStack) {
|
||||
'localName should be LinearRing');
|
||||
var flatCoordinates =
|
||||
this.readFlatCoordinatesFromNode_(node, objectStack);
|
||||
if (goog.isDef(flatCoordinates)) {
|
||||
if (flatCoordinates) {
|
||||
var ring = new ol.geom.LinearRing(null);
|
||||
ring.setFlatCoordinates(ol.geom.GeometryLayout.XYZ, flatCoordinates);
|
||||
return ring;
|
||||
@@ -449,7 +449,7 @@ ol.format.GMLBase.prototype.readPolygon = function(node, objectStack) {
|
||||
var flatLinearRings = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<Array.<number>>} */ ([null]),
|
||||
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
|
||||
if (goog.isDef(flatLinearRings) &&
|
||||
if (flatLinearRings &&
|
||||
!goog.isNull(flatLinearRings[0])) {
|
||||
var polygon = new ol.geom.Polygon(null);
|
||||
var flatCoordinates = flatLinearRings[0];
|
||||
@@ -588,8 +588,8 @@ ol.format.GMLBase.prototype.RING_PARSERS = Object({
|
||||
ol.format.GMLBase.prototype.readGeometryFromNode =
|
||||
function(node, opt_options) {
|
||||
var geometry = this.readGeometryElement(node,
|
||||
[this.getReadOptions(node, goog.isDef(opt_options) ? opt_options : {})]);
|
||||
return goog.isDef(geometry) ? geometry : null;
|
||||
[this.getReadOptions(node, opt_options ? opt_options : {})]);
|
||||
return geometry ? geometry : null;
|
||||
};
|
||||
|
||||
|
||||
@@ -614,7 +614,7 @@ ol.format.GMLBase.prototype.readFeaturesFromNode =
|
||||
featureType: this.featureType,
|
||||
featureNS: this.featureNS
|
||||
};
|
||||
if (goog.isDef(opt_options)) {
|
||||
if (opt_options) {
|
||||
goog.object.extend(options, this.getReadOptions(node, opt_options));
|
||||
}
|
||||
return this.readFeaturesInternal(node, [options]);
|
||||
@@ -625,6 +625,6 @@ ol.format.GMLBase.prototype.readFeaturesFromNode =
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.format.GMLBase.prototype.readProjectionFromNode = function(node) {
|
||||
return ol.proj.get(goog.isDef(this.srsName_) ? this.srsName_ :
|
||||
return ol.proj.get(this.srsName_ ? this.srsName_ :
|
||||
node.firstElementChild.getAttribute('srsName'));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user