diff --git a/src/ol/format/esrijsonformat.js b/src/ol/format/esrijsonformat.js index 2863816334..4465a30a82 100644 --- a/src/ol/format/esrijsonformat.js +++ b/src/ol/format/esrijsonformat.js @@ -54,7 +54,7 @@ goog.inherits(ol.format.EsriJSON, ol.format.JSONFeature); * @return {ol.geom.Geometry} Geometry. */ ol.format.EsriJSON.readGeometry_ = function(object, opt_options) { - if (goog.isNull(object)) { + if (!object) { return null; } var type; diff --git a/src/ol/format/featureformat.js b/src/ol/format/featureformat.js index 6f6f58aa1a..59d0c77943 100644 --- a/src/ol/format/featureformat.js +++ b/src/ol/format/featureformat.js @@ -165,7 +165,7 @@ ol.format.Feature.transformWithOptions = function( ol.proj.get(opt_options.featureProjection) : null; var dataProjection = opt_options ? ol.proj.get(opt_options.dataProjection) : null; - if (!goog.isNull(featureProjection) && !goog.isNull(dataProjection) && + if (featureProjection && dataProjection && !ol.proj.equivalent(featureProjection, dataProjection)) { if (geometry instanceof ol.geom.Geometry) { return (write ? geometry.clone() : geometry).transform( diff --git a/src/ol/format/geojsonformat.js b/src/ol/format/geojsonformat.js index cb6db7aa0c..d87be696a4 100644 --- a/src/ol/format/geojsonformat.js +++ b/src/ol/format/geojsonformat.js @@ -68,7 +68,7 @@ ol.format.GeoJSON.EXTENSIONS_ = ['.geojson']; * @return {ol.geom.Geometry} Geometry. */ ol.format.GeoJSON.readGeometry_ = function(object, opt_options) { - if (goog.isNull(object)) { + if (!object) { return null; } var geometryReader = ol.format.GeoJSON.GEOMETRY_READERS_[object.type]; diff --git a/src/ol/format/gml/gml2format.js b/src/ol/format/gml/gml2format.js index 88ff8a5671..30179f6b6b 100644 --- a/src/ol/format/gml/gml2format.js +++ b/src/ol/format/gml/gml2format.js @@ -62,20 +62,20 @@ ol.format.GML2.prototype.readFlatCoordinates_ = function(node, objectStack) { var containerSrs = context['srsName']; var containerDimension = node.parentNode.getAttribute('srsDimension'); var axisOrientation = 'enu'; - if (!goog.isNull(containerSrs)) { + if (containerSrs) { var proj = ol.proj.get(containerSrs); axisOrientation = proj.getAxisOrientation(); } var coords = s.split(/[\s,]+/); // The "dimension" attribute is from the GML 3.0.1 spec. var dim = 2; - if (!goog.isNull(node.getAttribute('srsDimension'))) { + if (node.getAttribute('srsDimension')) { dim = ol.format.XSD.readNonNegativeIntegerString( node.getAttribute('srsDimension')); - } else if (!goog.isNull(node.getAttribute('dimension'))) { + } else if (node.getAttribute('dimension')) { dim = ol.format.XSD.readNonNegativeIntegerString( node.getAttribute('dimension')); - } else if (!goog.isNull(containerDimension)) { + } else if (containerDimension) { dim = ol.format.XSD.readNonNegativeIntegerString(containerDimension); } var x, y, z; diff --git a/src/ol/format/gml/gml3format.js b/src/ol/format/gml/gml3format.js index b908744af3..94f04feb2d 100644 --- a/src/ol/format/gml/gml3format.js +++ b/src/ol/format/gml/gml3format.js @@ -301,7 +301,7 @@ ol.format.GML3.prototype.readSurface_ = function(node, objectStack) { var flatLinearRings = ol.xml.pushParseAndPop( /** @type {Array.>} */ ([null]), this.SURFACE_PARSERS_, node, objectStack, this); - if (flatLinearRings && !goog.isNull(flatLinearRings[0])) { + if (flatLinearRings && flatLinearRings[0]) { var polygon = new ol.geom.Polygon(null); var flatCoordinates = flatLinearRings[0]; var ends = [flatCoordinates.length]; @@ -385,7 +385,7 @@ ol.format.GML3.prototype.readFlatPos_ = function(node, objectStack) { goog.asserts.assert(goog.isObject(context), 'context should be an Object'); var containerSrs = context['srsName']; var axisOrientation = 'enu'; - if (!goog.isNull(containerSrs)) { + if (containerSrs) { var proj = ol.proj.get(containerSrs); axisOrientation = proj.getAxisOrientation(); } @@ -422,20 +422,20 @@ ol.format.GML3.prototype.readFlatPosList_ = function(node, objectStack) { var containerSrs = context['srsName']; var containerDimension = node.parentNode.getAttribute('srsDimension'); var axisOrientation = 'enu'; - if (!goog.isNull(containerSrs)) { + if (containerSrs) { var proj = ol.proj.get(containerSrs); axisOrientation = proj.getAxisOrientation(); } var coords = s.split(/\s+/); // The "dimension" attribute is from the GML 3.0.1 spec. var dim = 2; - if (!goog.isNull(node.getAttribute('srsDimension'))) { + if (node.getAttribute('srsDimension')) { dim = ol.format.XSD.readNonNegativeIntegerString( node.getAttribute('srsDimension')); - } else if (!goog.isNull(node.getAttribute('dimension'))) { + } else if (node.getAttribute('dimension')) { dim = ol.format.XSD.readNonNegativeIntegerString( node.getAttribute('dimension')); - } else if (!goog.isNull(containerDimension)) { + } else if (containerDimension) { dim = ol.format.XSD.readNonNegativeIntegerString(containerDimension); } var x, y, z; @@ -1067,7 +1067,7 @@ ol.format.GML3.prototype.writeFeatureElement = var keys = [], values = []; for (var key in properties) { var value = properties[key]; - if (!goog.isNull(value)) { + if (value !== null) { keys.push(key); values.push(value); if (key == geometryName) { diff --git a/src/ol/format/gml/gmlbaseformat.js b/src/ol/format/gml/gmlbaseformat.js index 5f7cc9826a..e82c292160 100644 --- a/src/ol/format/gml/gmlbaseformat.js +++ b/src/ol/format/gml/gmlbaseformat.js @@ -199,8 +199,7 @@ ol.format.GMLBase.prototype.readFeatureElement = function(node, objectStack) { var fid = node.getAttribute('fid') || ol.xml.getAttributeNS(node, ol.format.GMLBase.GMLNS, 'id'); var values = {}, geometryName; - for (n = node.firstElementChild; !goog.isNull(n); - n = n.nextElementSibling) { + for (n = node.firstElementChild; n; n = n.nextElementSibling) { var localName = ol.xml.getLocalName(n); // Assume attribute elements have one child node and that the child // is a text or CDATA node (to be treated as text). @@ -449,8 +448,7 @@ ol.format.GMLBase.prototype.readPolygon = function(node, objectStack) { var flatLinearRings = ol.xml.pushParseAndPop( /** @type {Array.>} */ ([null]), this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this); - if (flatLinearRings && - !goog.isNull(flatLinearRings[0])) { + if (flatLinearRings && flatLinearRings[0]) { var polygon = new ol.geom.Polygon(null); var flatCoordinates = flatLinearRings[0]; var ends = [flatCoordinates.length]; diff --git a/src/ol/format/gpxformat.js b/src/ol/format/gpxformat.js index 25a7363357..bb83768e7d 100644 --- a/src/ol/format/gpxformat.js +++ b/src/ol/format/gpxformat.js @@ -97,7 +97,7 @@ ol.format.GPX.parseLink_ = function(node, objectStack) { goog.asserts.assert(node.localName == 'link', 'localName should be link'); var values = /** @type {Object} */ (objectStack[objectStack.length - 1]); var href = node.getAttribute('href'); - if (!goog.isNull(href)) { + if (href !== null) { values['link'] = href; } ol.xml.parseNode(ol.format.GPX.LINK_PARSERS_, node, objectStack); @@ -417,7 +417,7 @@ ol.format.GPX.WPT_PARSERS_ = ol.xml.makeStructureNS( * @private */ ol.format.GPX.prototype.handleReadExtensions_ = function(features) { - if (goog.isNull(features)) { + if (!features) { features = []; } for (var i = 0, ii = features.length; i < ii; ++i) { diff --git a/src/ol/format/igcformat.js b/src/ol/format/igcformat.js index 8a2f7a0bb4..a03b48375b 100644 --- a/src/ol/format/igcformat.js +++ b/src/ol/format/igcformat.js @@ -202,7 +202,7 @@ ol.format.IGC.prototype.readFeatures; */ ol.format.IGC.prototype.readFeaturesFromText = function(text, opt_options) { var feature = this.readFeatureFromText(text, opt_options); - if (!goog.isNull(feature)) { + if (feature) { return [feature]; } else { return []; diff --git a/src/ol/format/kmlformat.js b/src/ol/format/kmlformat.js index 9f7cf28940..dbb1d42540 100644 --- a/src/ol/format/kmlformat.js +++ b/src/ol/format/kmlformat.js @@ -979,7 +979,7 @@ ol.format.KML.readPolygon_ = function(node, objectStack) { var flatLinearRings = ol.xml.pushParseAndPop( /** @type {Array.>} */ ([null]), ol.format.KML.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack); - if (flatLinearRings && !goog.isNull(flatLinearRings[0])) { + if (flatLinearRings && flatLinearRings[0]) { var polygon = new ol.geom.Polygon(null); var flatCoordinates = flatLinearRings[0]; var ends = [flatCoordinates.length]; @@ -1085,7 +1085,7 @@ ol.format.KML.DataParser_ = function(node, objectStack) { 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'Data', 'localName should be Data'); var name = node.getAttribute('name'); - if (!goog.isNull(name)) { + if (name !== null) { var data = ol.xml.pushParseAndPop( undefined, ol.format.KML.DATA_PARSERS_, node, objectStack); if (data) { @@ -1196,7 +1196,7 @@ ol.format.KML.SimpleDataParser_ = function(node, objectStack) { goog.asserts.assert(node.localName == 'SimpleData', 'localName should be SimpleData'); var name = node.getAttribute('name'); - if (!goog.isNull(name)) { + if (name !== null) { var data = ol.format.XSD.readString(node); var featureObject = /** @type {Object} */ (objectStack[objectStack.length - 1]); @@ -1679,7 +1679,7 @@ ol.format.KML.prototype.readPlacemark_ = function(node, objectStack) { } var feature = new ol.Feature(); var id = node.getAttribute('id'); - if (!goog.isNull(id)) { + if (id !== null) { feature.setId(id); } var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); @@ -1718,7 +1718,7 @@ ol.format.KML.prototype.readSharedStyle_ = function(node, objectStack) { 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'Style', 'localName should be Style'); var id = node.getAttribute('id'); - if (!goog.isNull(id)) { + if (id !== null) { var style = ol.format.KML.readStyle_(node, objectStack); if (style) { var styleUri; @@ -1744,7 +1744,7 @@ ol.format.KML.prototype.readSharedStyleMap_ = function(node, objectStack) { goog.asserts.assert(node.localName == 'StyleMap', 'localName should be StyleMap'); var id = node.getAttribute('id'); - if (goog.isNull(id)) { + if (id === null) { return; } var styleMapValue = ol.format.KML.readStyleMapValue_(node, objectStack); @@ -1836,8 +1836,7 @@ ol.format.KML.prototype.readFeaturesFromNode = function(node, opt_options) { } else if (localName == 'kml') { features = []; var n; - for (n = node.firstElementChild; !goog.isNull(n); - n = n.nextElementSibling) { + for (n = node.firstElementChild; n; n = n.nextElementSibling) { var fs = this.readFeaturesFromNode(n, opt_options); if (fs) { goog.array.extend(features, fs); @@ -1878,7 +1877,7 @@ ol.format.KML.prototype.readName = function(source) { */ ol.format.KML.prototype.readNameFromDocument = function(doc) { var n; - for (n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) { + for (n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == goog.dom.NodeType.ELEMENT) { var name = this.readNameFromNode(n); if (name) { @@ -1896,13 +1895,13 @@ ol.format.KML.prototype.readNameFromDocument = function(doc) { */ ol.format.KML.prototype.readNameFromNode = function(node) { var n; - for (n = node.firstElementChild; !goog.isNull(n); n = n.nextElementSibling) { + for (n = node.firstElementChild; n; n = n.nextElementSibling) { if (ol.array.includes(ol.format.KML.NAMESPACE_URIS_, n.namespaceURI) && n.localName == 'name') { return ol.format.XSD.readString(n); } } - for (n = node.firstElementChild; !goog.isNull(n); n = n.nextElementSibling) { + for (n = node.firstElementChild; n; n = n.nextElementSibling) { var localName = ol.xml.getLocalName(n); if (ol.array.includes(ol.format.KML.NAMESPACE_URIS_, n.namespaceURI) && (localName == 'Document' || @@ -1950,7 +1949,7 @@ ol.format.KML.prototype.readNetworkLinks = function(source) { */ ol.format.KML.prototype.readNetworkLinksFromDocument = function(doc) { var n, networkLinks = []; - for (n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) { + for (n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == goog.dom.NodeType.ELEMENT) { goog.array.extend(networkLinks, this.readNetworkLinksFromNode(n)); } @@ -1965,7 +1964,7 @@ ol.format.KML.prototype.readNetworkLinksFromDocument = function(doc) { */ ol.format.KML.prototype.readNetworkLinksFromNode = function(node) { var n, networkLinks = []; - for (n = node.firstElementChild; !goog.isNull(n); n = n.nextElementSibling) { + for (n = node.firstElementChild; n; n = n.nextElementSibling) { if (ol.array.includes(ol.format.KML.NAMESPACE_URIS_, n.namespaceURI) && n.localName == 'NetworkLink') { var obj = ol.xml.pushParseAndPop({}, ol.format.KML.NETWORK_LINK_PARSERS_, @@ -1973,7 +1972,7 @@ ol.format.KML.prototype.readNetworkLinksFromNode = function(node) { networkLinks.push(obj); } } - for (n = node.firstElementChild; !goog.isNull(n); n = n.nextElementSibling) { + for (n = node.firstElementChild; n; n = n.nextElementSibling) { var localName = ol.xml.getLocalName(n); if (ol.array.includes(ol.format.KML.NAMESPACE_URIS_, n.namespaceURI) && (localName == 'Document' || @@ -2110,20 +2109,18 @@ ol.format.KML.writeIconStyle_ = function(node, style, objectStack) { 'href': src }; - if (!goog.isNull(size)) { + if (size) { iconProperties['w'] = size[0]; iconProperties['h'] = size[1]; var anchor = style.getAnchor(); // top-left var origin = style.getOrigin(); // top-left - if (!goog.isNull(origin) && !goog.isNull(iconImageSize) && - origin[0] !== 0 && origin[1] !== size[1]) { + if (origin && iconImageSize && origin[0] !== 0 && origin[1] !== size[1]) { iconProperties['x'] = origin[0]; iconProperties['y'] = iconImageSize[1] - (origin[1] + size[1]); } - if (!goog.isNull(anchor) && - anchor[0] !== 0 && anchor[1] !== size[1]) { + if (anchor && anchor[0] !== 0 && anchor[1] !== size[1]) { var /** @type {ol.format.KMLVec2_} */ hotSpot = { x: anchor[0], xunits: ol.style.IconAnchorUnits.PIXELS, @@ -2164,7 +2161,7 @@ ol.format.KML.writeLabelStyle_ = function(node, style, objectStack) { var /** @type {ol.xml.NodeStackItem} */ context = {node: node}; var properties = {}; var fill = style.getFill(); - if (!goog.isNull(fill)) { + if (fill) { properties['color'] = fill.getColor(); } var scale = style.getScale(); @@ -2279,10 +2276,10 @@ ol.format.KML.writePlacemark_ = function(node, feature, objectStack) { // FIXME the styles returned by the style function are supposed to be // resolution-independent here var styles = styleFunction.call(feature, 0); - if (!goog.isNull(styles) && styles.length > 0) { + if (styles && styles.length > 0) { properties['Style'] = styles[0]; var textStyle = styles[0].getText(); - if (!goog.isNull(textStyle)) { + if (textStyle) { properties['name'] = textStyle.getText(); } } @@ -2392,16 +2389,16 @@ ol.format.KML.writeStyle_ = function(node, style, objectStack) { var strokeStyle = style.getStroke(); var imageStyle = style.getImage(); var textStyle = style.getText(); - if (!goog.isNull(imageStyle)) { + if (imageStyle) { properties['IconStyle'] = imageStyle; } - if (!goog.isNull(textStyle)) { + if (textStyle) { properties['LabelStyle'] = textStyle; } - if (!goog.isNull(strokeStyle)) { + if (strokeStyle) { properties['LineStyle'] = strokeStyle; } - if (!goog.isNull(fillStyle)) { + if (fillStyle) { properties['PolyStyle'] = fillStyle; } var parentNode = objectStack[objectStack.length - 1].node; diff --git a/src/ol/format/owsformat.js b/src/ol/format/owsformat.js index 1ebd2df650..701abb25b2 100644 --- a/src/ol/format/owsformat.js +++ b/src/ol/format/owsformat.js @@ -26,7 +26,7 @@ goog.inherits(ol.format.OWS, ol.format.XML); ol.format.OWS.prototype.readFromDocument = function(doc) { goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT, 'doc.nodeType should be DOCUMENT'); - for (var n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) { + for (var n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == goog.dom.NodeType.ELEMENT) { return this.readFromNode(n); } diff --git a/src/ol/format/topojsonformat.js b/src/ol/format/topojsonformat.js index ae275793cd..1a4cdb87b8 100644 --- a/src/ol/format/topojsonformat.js +++ b/src/ol/format/topojsonformat.js @@ -97,7 +97,7 @@ ol.format.TopoJSON.concatenateArcs_ = function(indices, arcs) { */ ol.format.TopoJSON.readPointGeometry_ = function(object, scale, translate) { var coordinates = object.coordinates; - if (!goog.isNull(scale) && !goog.isNull(translate)) { + if (scale && translate) { ol.format.TopoJSON.transformVertex_(coordinates, scale, translate); } return new ol.geom.Point(coordinates); @@ -117,7 +117,7 @@ ol.format.TopoJSON.readMultiPointGeometry_ = function(object, scale, translate) { var coordinates = object.coordinates; var i, ii; - if (!goog.isNull(scale) && !goog.isNull(translate)) { + if (scale && translate) { for (i = 0, ii = coordinates.length; i < ii; ++i) { ol.format.TopoJSON.transformVertex_(coordinates[i], scale, translate); } diff --git a/src/ol/format/wfsformat.js b/src/ol/format/wfsformat.js index 63dd77bfb1..10b463b828 100644 --- a/src/ol/format/wfsformat.js +++ b/src/ol/format/wfsformat.js @@ -196,7 +196,7 @@ ol.format.WFS.prototype.readFeatureCollectionMetadataFromDocument = function(doc) { goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT, 'doc.nodeType should be DOCUMENT'); - for (var n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) { + for (var n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == goog.dom.NodeType.ELEMENT) { return this.readFeatureCollectionMetadataFromNode(n); } @@ -337,7 +337,7 @@ ol.format.WFS.TRANSACTION_RESPONSE_PARSERS_ = { ol.format.WFS.prototype.readTransactionResponseFromDocument = function(doc) { goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT, 'doc.nodeType should be DOCUMENT'); - for (var n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) { + for (var n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == goog.dom.NodeType.ELEMENT) { return this.readTransactionResponseFromNode(n); } @@ -750,7 +750,7 @@ ol.format.WFS.prototype.readProjection; ol.format.WFS.prototype.readProjectionFromDocument = function(doc) { goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT, 'doc.nodeType should be a DOCUMENT'); - for (var n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) { + for (var n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == goog.dom.NodeType.ELEMENT) { return this.readProjectionFromNode(n); } @@ -771,8 +771,7 @@ ol.format.WFS.prototype.readProjectionFromNode = function(node) { if (node.firstElementChild && node.firstElementChild.firstElementChild) { node = node.firstElementChild.firstElementChild; - for (var n = node.firstElementChild; !goog.isNull(n); - n = n.nextElementSibling) { + for (var n = node.firstElementChild; n; n = n.nextElementSibling) { if (!(n.childNodes.length === 0 || (n.childNodes.length === 1 && n.firstChild.nodeType === 3))) { diff --git a/src/ol/format/wmscapabilitiesformat.js b/src/ol/format/wmscapabilitiesformat.js index d3c5a38d0a..5612b93d13 100644 --- a/src/ol/format/wmscapabilitiesformat.js +++ b/src/ol/format/wmscapabilitiesformat.js @@ -50,7 +50,7 @@ ol.format.WMSCapabilities.prototype.read; ol.format.WMSCapabilities.prototype.readFromDocument = function(doc) { goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT, 'doc.nodeType should be DOCUMENT'); - for (var n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) { + for (var n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == goog.dom.NodeType.ELEMENT) { return this.readFromNode(n); } diff --git a/src/ol/format/wmtscapabilitiesformat.js b/src/ol/format/wmtscapabilitiesformat.js index 11cc05ec4d..628b4810b0 100644 --- a/src/ol/format/wmtscapabilitiesformat.js +++ b/src/ol/format/wmtscapabilitiesformat.js @@ -50,7 +50,7 @@ ol.format.WMTSCapabilities.prototype.read; ol.format.WMTSCapabilities.prototype.readFromDocument = function(doc) { goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT, 'doc.nodeType should be DOCUMENT'); - for (var n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) { + for (var n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == goog.dom.NodeType.ELEMENT) { return this.readFromNode(n); } diff --git a/src/ol/format/xmlfeatureformat.js b/src/ol/format/xmlfeatureformat.js index 8c1d6baa15..dbc930e6af 100644 --- a/src/ol/format/xmlfeatureformat.js +++ b/src/ol/format/xmlfeatureformat.js @@ -107,7 +107,7 @@ ol.format.XMLFeature.prototype.readFeaturesFromDocument = function( /** @type {Array.} */ var features = []; var n; - for (n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) { + for (n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == goog.dom.NodeType.ELEMENT) { goog.array.extend(features, this.readFeaturesFromNode(n, opt_options)); }