diff --git a/changelog/upgrade-notes.md b/changelog/upgrade-notes.md index eb14528278..b9dd996646 100644 --- a/changelog/upgrade-notes.md +++ b/changelog/upgrade-notes.md @@ -2,7 +2,7 @@ #### Changes in the way assertions are handled -Previously, minified builds of the library did not have any assertions. This caused applications to fail silently or with cryptic stack traces. Starting with this release, developers get notified of many runtime errors through the new `ol.AssertionError`. This error has a `code` property. The meaning of the code can be found on http://openlayers.org/en/latest/doc/errors/. There are additional console assertion checks when in debug mode when the new `ol.DEBUG` compiler flag (previously `goog.DEBUG`) is `true`. As this is `true` by default, it is recommended that those creating custom builds set this to `false` so these assertions are stripped.' +Previously, minified builds of the library did not have any assertions. This caused applications to fail silently or with cryptic stack traces. Starting with this release, developers get notified of many runtime errors through the new `ol.AssertionError`. This error has a `code` property. The meaning of the code can be found on http://openlayers.org/en/latest/doc/errors/. There are additional console assertion checks in debug mode when the `goog.DEBUG` compiler flag is `true`. As this is `true` by default, it is recommended that those creating custom builds set this to `false` so these assertions are stripped.' #### Removal of `ol.ENABLE_NAMED_COLORS` diff --git a/config/ol.json b/config/ol.json index 839ea7b984..fb8e681084 100644 --- a/config/ol.json +++ b/config/ol.json @@ -15,8 +15,7 @@ "externs/topojson.js" ], "define": [ - "goog.DEBUG=false", - "ol.DEBUG=false" + "goog.DEBUG=false" ], "jscomp_error": [ "*" diff --git a/src/ol/array.js b/src/ol/array.js index 356b578112..e54e8c0e1d 100644 --- a/src/ol/array.js +++ b/src/ol/array.js @@ -144,9 +144,9 @@ ol.array.linearFindNearest = function(arr, target, direction) { * @param {number} end End index. */ ol.array.reverseSubArray = function(arr, begin, end) { - ol.DEBUG && console.assert(begin >= 0, + goog.DEBUG && console.assert(begin >= 0, 'Array begin index should be equal to or greater than 0'); - ol.DEBUG && console.assert(end < arr.length, + goog.DEBUG && console.assert(end < arr.length, 'Array end index should be less than the array length'); while (begin < end) { var tmp = arr[begin]; diff --git a/src/ol/events/eventtarget.js b/src/ol/events/eventtarget.js index 2e6efb74ae..f3245470cf 100644 --- a/src/ol/events/eventtarget.js +++ b/src/ol/events/eventtarget.js @@ -143,7 +143,7 @@ ol.events.EventTarget.prototype.removeEventListener = function(type, listener) { var listeners = this.listeners_[type]; if (listeners) { var index = listeners.indexOf(listener); - ol.DEBUG && console.assert(index != -1, 'listener not found'); + goog.DEBUG && console.assert(index != -1, 'listener not found'); if (type in this.pendingRemovals_) { // make listener a no-op, and remove later in #dispatchEvent() listeners[index] = ol.nullFunction; diff --git a/src/ol/extent.js b/src/ol/extent.js index f96c886bdd..f9da4b4605 100644 --- a/src/ol/extent.js +++ b/src/ol/extent.js @@ -53,8 +53,8 @@ ol.extent.boundingExtent = function(coordinates) { * @return {ol.Extent} Extent. */ ol.extent.boundingExtentXYs_ = function(xs, ys, opt_extent) { - ol.DEBUG && console.assert(xs.length > 0, 'xs length should be larger than 0'); - ol.DEBUG && console.assert(ys.length > 0, 'ys length should be larger than 0'); + goog.DEBUG && console.assert(xs.length > 0, 'xs length should be larger than 0'); + goog.DEBUG && console.assert(ys.length > 0, 'ys length should be larger than 0'); var minX = Math.min.apply(null, xs); var minY = Math.min.apply(null, ys); var maxX = Math.max.apply(null, xs); diff --git a/src/ol/format/esrijsonformat.js b/src/ol/format/esrijsonformat.js index 79c4a68fa6..45452c21ff 100644 --- a/src/ol/format/esrijsonformat.js +++ b/src/ol/format/esrijsonformat.js @@ -80,7 +80,7 @@ ol.format.EsriJSON.readGeometry_ = function(object, opt_options) { } } var geometryReader = ol.format.EsriJSON.GEOMETRY_READERS_[type]; - ol.DEBUG && console.assert(geometryReader, + goog.DEBUG && console.assert(geometryReader, 'geometryReader should be defined'); return /** @type {ol.geom.Geometry} */ ( ol.format.Feature.transformWithOptions( @@ -144,8 +144,8 @@ ol.format.EsriJSON.convertRings_ = function(rings, layout) { * @return {ol.geom.Geometry} Point. */ ol.format.EsriJSON.readPointGeometry_ = function(object) { - ol.DEBUG && console.assert(typeof object.x === 'number', 'object.x should be number'); - ol.DEBUG && console.assert(typeof object.y === 'number', 'object.y should be number'); + goog.DEBUG && console.assert(typeof object.x === 'number', 'object.x should be number'); + goog.DEBUG && console.assert(typeof object.y === 'number', 'object.y should be number'); var point; if (object.m !== undefined && object.z !== undefined) { point = new ol.geom.Point([object.x, object.y, object.z, object.m], @@ -169,9 +169,9 @@ ol.format.EsriJSON.readPointGeometry_ = function(object) { * @return {ol.geom.Geometry} LineString. */ ol.format.EsriJSON.readLineStringGeometry_ = function(object) { - ol.DEBUG && console.assert(Array.isArray(object.paths), + goog.DEBUG && console.assert(Array.isArray(object.paths), 'object.paths should be an array'); - ol.DEBUG && console.assert(object.paths.length === 1, + goog.DEBUG && console.assert(object.paths.length === 1, 'object.paths array length should be 1'); var layout = ol.format.EsriJSON.getGeometryLayout_(object); return new ol.geom.LineString(object.paths[0], layout); @@ -184,9 +184,9 @@ ol.format.EsriJSON.readLineStringGeometry_ = function(object) { * @return {ol.geom.Geometry} MultiLineString. */ ol.format.EsriJSON.readMultiLineStringGeometry_ = function(object) { - ol.DEBUG && console.assert(Array.isArray(object.paths), + goog.DEBUG && console.assert(Array.isArray(object.paths), 'object.paths should be an array'); - ol.DEBUG && console.assert(object.paths.length > 1, + goog.DEBUG && console.assert(object.paths.length > 1, 'object.paths array length should be more than 1'); var layout = ol.format.EsriJSON.getGeometryLayout_(object); return new ol.geom.MultiLineString(object.paths, layout); @@ -217,7 +217,7 @@ ol.format.EsriJSON.getGeometryLayout_ = function(object) { * @return {ol.geom.Geometry} MultiPoint. */ ol.format.EsriJSON.readMultiPointGeometry_ = function(object) { - ol.DEBUG && console.assert(object.points, 'object.points should be defined'); + goog.DEBUG && console.assert(object.points, 'object.points should be defined'); var layout = ol.format.EsriJSON.getGeometryLayout_(object); return new ol.geom.MultiPoint(object.points, layout); }; @@ -229,8 +229,8 @@ ol.format.EsriJSON.readMultiPointGeometry_ = function(object) { * @return {ol.geom.Geometry} MultiPolygon. */ ol.format.EsriJSON.readMultiPolygonGeometry_ = function(object) { - ol.DEBUG && console.assert(object.rings); - ol.DEBUG && console.assert(object.rings.length > 1, + goog.DEBUG && console.assert(object.rings); + goog.DEBUG && console.assert(object.rings.length > 1, 'object.rings should have length larger than 1'); var layout = ol.format.EsriJSON.getGeometryLayout_(object); return new ol.geom.MultiPolygon( @@ -245,7 +245,7 @@ ol.format.EsriJSON.readMultiPolygonGeometry_ = function(object) { * @return {ol.geom.Geometry} Polygon. */ ol.format.EsriJSON.readPolygonGeometry_ = function(object) { - ol.DEBUG && console.assert(object.rings); + goog.DEBUG && console.assert(object.rings); var layout = ol.format.EsriJSON.getGeometryLayout_(object); return new ol.geom.Polygon(object.rings, layout); }; @@ -469,7 +469,7 @@ ol.format.EsriJSON.prototype.readFeatures; ol.format.EsriJSON.prototype.readFeatureFromObject = function( object, opt_options) { var esriJSONFeature = /** @type {EsriJSONFeature} */ (object); - ol.DEBUG && console.assert(esriJSONFeature.geometry || + goog.DEBUG && console.assert(esriJSONFeature.geometry || esriJSONFeature.attributes, 'geometry or attributes should be defined'); var geometry = ol.format.EsriJSON.readGeometry_(esriJSONFeature.geometry, @@ -481,7 +481,7 @@ ol.format.EsriJSON.prototype.readFeatureFromObject = function( feature.setGeometry(geometry); if (opt_options && opt_options.idField && esriJSONFeature.attributes[opt_options.idField]) { - ol.DEBUG && console.assert( + goog.DEBUG && console.assert( typeof esriJSONFeature.attributes[opt_options.idField] === 'number', 'objectIdFieldName value should be a number'); feature.setId(/** @type {number} */( @@ -575,7 +575,7 @@ ol.format.EsriJSON.prototype.readProjectionFromObject = function(object) { */ ol.format.EsriJSON.writeGeometry_ = function(geometry, opt_options) { var geometryWriter = ol.format.EsriJSON.GEOMETRY_WRITERS_[geometry.getType()]; - ol.DEBUG && console.assert(geometryWriter, 'geometryWriter should be defined'); + goog.DEBUG && console.assert(geometryWriter, 'geometryWriter should be defined'); return geometryWriter(/** @type {ol.geom.Geometry} */ ( ol.format.Feature.transformWithOptions(geometry, true, opt_options)), opt_options); diff --git a/src/ol/format/geojsonformat.js b/src/ol/format/geojsonformat.js index f53da82e55..906e58e2c3 100644 --- a/src/ol/format/geojsonformat.js +++ b/src/ol/format/geojsonformat.js @@ -70,7 +70,7 @@ ol.format.GeoJSON.readGeometry_ = function(object, opt_options) { return null; } var geometryReader = ol.format.GeoJSON.GEOMETRY_READERS_[object.type]; - ol.DEBUG && console.assert(geometryReader, 'geometryReader should be defined'); + goog.DEBUG && console.assert(geometryReader, 'geometryReader should be defined'); return /** @type {ol.geom.Geometry} */ ( ol.format.Feature.transformWithOptions( geometryReader(object), false, opt_options)); @@ -85,7 +85,7 @@ ol.format.GeoJSON.readGeometry_ = function(object, opt_options) { */ ol.format.GeoJSON.readGeometryCollectionGeometry_ = function( object, opt_options) { - ol.DEBUG && console.assert(object.type == 'GeometryCollection', + goog.DEBUG && console.assert(object.type == 'GeometryCollection', 'object.type should be GeometryCollection'); var geometries = object.geometries.map( /** @@ -105,7 +105,7 @@ ol.format.GeoJSON.readGeometryCollectionGeometry_ = function( * @return {ol.geom.Point} Point. */ ol.format.GeoJSON.readPointGeometry_ = function(object) { - ol.DEBUG && console.assert(object.type == 'Point', + goog.DEBUG && console.assert(object.type == 'Point', 'object.type should be Point'); return new ol.geom.Point(object.coordinates); }; @@ -117,7 +117,7 @@ ol.format.GeoJSON.readPointGeometry_ = function(object) { * @return {ol.geom.LineString} LineString. */ ol.format.GeoJSON.readLineStringGeometry_ = function(object) { - ol.DEBUG && console.assert(object.type == 'LineString', + goog.DEBUG && console.assert(object.type == 'LineString', 'object.type should be LineString'); return new ol.geom.LineString(object.coordinates); }; @@ -129,7 +129,7 @@ ol.format.GeoJSON.readLineStringGeometry_ = function(object) { * @return {ol.geom.MultiLineString} MultiLineString. */ ol.format.GeoJSON.readMultiLineStringGeometry_ = function(object) { - ol.DEBUG && console.assert(object.type == 'MultiLineString', + goog.DEBUG && console.assert(object.type == 'MultiLineString', 'object.type should be MultiLineString'); return new ol.geom.MultiLineString(object.coordinates); }; @@ -141,7 +141,7 @@ ol.format.GeoJSON.readMultiLineStringGeometry_ = function(object) { * @return {ol.geom.MultiPoint} MultiPoint. */ ol.format.GeoJSON.readMultiPointGeometry_ = function(object) { - ol.DEBUG && console.assert(object.type == 'MultiPoint', + goog.DEBUG && console.assert(object.type == 'MultiPoint', 'object.type should be MultiPoint'); return new ol.geom.MultiPoint(object.coordinates); }; @@ -153,7 +153,7 @@ ol.format.GeoJSON.readMultiPointGeometry_ = function(object) { * @return {ol.geom.MultiPolygon} MultiPolygon. */ ol.format.GeoJSON.readMultiPolygonGeometry_ = function(object) { - ol.DEBUG && console.assert(object.type == 'MultiPolygon', + goog.DEBUG && console.assert(object.type == 'MultiPolygon', 'object.type should be MultiPolygon'); return new ol.geom.MultiPolygon(object.coordinates); }; @@ -165,7 +165,7 @@ ol.format.GeoJSON.readMultiPolygonGeometry_ = function(object) { * @return {ol.geom.Polygon} Polygon. */ ol.format.GeoJSON.readPolygonGeometry_ = function(object) { - ol.DEBUG && console.assert(object.type == 'Polygon', + goog.DEBUG && console.assert(object.type == 'Polygon', 'object.type should be Polygon'); return new ol.geom.Polygon(object.coordinates); }; @@ -179,7 +179,7 @@ ol.format.GeoJSON.readPolygonGeometry_ = function(object) { */ ol.format.GeoJSON.writeGeometry_ = function(geometry, opt_options) { var geometryWriter = ol.format.GeoJSON.GEOMETRY_WRITERS_[geometry.getType()]; - ol.DEBUG && console.assert(geometryWriter, 'geometryWriter should be defined'); + goog.DEBUG && console.assert(geometryWriter, 'geometryWriter should be defined'); return geometryWriter(/** @type {ol.geom.Geometry} */ ( ol.format.Feature.transformWithOptions(geometry, true, opt_options)), opt_options); @@ -384,7 +384,7 @@ ol.format.GeoJSON.prototype.readFeatures; ol.format.GeoJSON.prototype.readFeatureFromObject = function( object, opt_options) { var geoJSONFeature = /** @type {GeoJSONFeature} */ (object); - ol.DEBUG && console.assert(geoJSONFeature.type == 'Feature', + goog.DEBUG && console.assert(geoJSONFeature.type == 'Feature', 'geoJSONFeature.type should be Feature'); var geometry = ol.format.GeoJSON.readGeometry_(geoJSONFeature.geometry, opt_options); diff --git a/src/ol/format/gml/gml2format.js b/src/ol/format/gml/gml2format.js index 24aec4a66d..5a23ed999a 100644 --- a/src/ol/format/gml/gml2format.js +++ b/src/ol/format/gml/gml2format.js @@ -99,9 +99,9 @@ ol.format.GML2.prototype.readFlatCoordinates_ = function(node, objectStack) { * @return {ol.Extent|undefined} Envelope. */ ol.format.GML2.prototype.readBox_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Box', 'localName should be Box'); + goog.DEBUG && console.assert(node.localName == 'Box', 'localName should be Box'); /** @type {Array.} */ var flatCoordinates = ol.xml.pushParseAndPop([null], this.BOX_PARSERS_, node, objectStack, this); @@ -117,9 +117,9 @@ ol.format.GML2.prototype.readBox_ = function(node, objectStack) { * @private */ ol.format.GML2.prototype.innerBoundaryIsParser_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'innerBoundaryIs', + goog.DEBUG && console.assert(node.localName == 'innerBoundaryIs', 'localName should be innerBoundaryIs'); /** @type {Array.|undefined} */ var flatLinearRing = ol.xml.pushParseAndPop(undefined, @@ -127,9 +127,9 @@ ol.format.GML2.prototype.innerBoundaryIsParser_ = function(node, objectStack) { if (flatLinearRing) { var flatLinearRings = /** @type {Array.>} */ (objectStack[objectStack.length - 1]); - ol.DEBUG && console.assert(Array.isArray(flatLinearRings), + goog.DEBUG && console.assert(Array.isArray(flatLinearRings), 'flatLinearRings should be an array'); - ol.DEBUG && console.assert(flatLinearRings.length > 0, + goog.DEBUG && console.assert(flatLinearRings.length > 0, 'flatLinearRings should have an array length larger than 0'); flatLinearRings.push(flatLinearRing); } @@ -142,9 +142,9 @@ ol.format.GML2.prototype.innerBoundaryIsParser_ = function(node, objectStack) { * @private */ ol.format.GML2.prototype.outerBoundaryIsParser_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'outerBoundaryIs', + goog.DEBUG && console.assert(node.localName == 'outerBoundaryIs', 'localName should be outerBoundaryIs'); /** @type {Array.|undefined} */ var flatLinearRing = ol.xml.pushParseAndPop(undefined, @@ -152,9 +152,9 @@ ol.format.GML2.prototype.outerBoundaryIsParser_ = function(node, objectStack) { if (flatLinearRing) { var flatLinearRings = /** @type {Array.>} */ (objectStack[objectStack.length - 1]); - ol.DEBUG && console.assert(Array.isArray(flatLinearRings), + goog.DEBUG && console.assert(Array.isArray(flatLinearRings), 'flatLinearRings should be an array'); - ol.DEBUG && console.assert(flatLinearRings.length > 0, + goog.DEBUG && console.assert(flatLinearRings.length > 0, 'flatLinearRings should have an array length larger than 0'); flatLinearRings[0] = flatLinearRing; } diff --git a/src/ol/format/gml/gml3format.js b/src/ol/format/gml/gml3format.js index b5b684e8e4..32455cfe23 100644 --- a/src/ol/format/gml/gml3format.js +++ b/src/ol/format/gml/gml3format.js @@ -92,9 +92,9 @@ ol.format.GML3.schemaLocation_ = ol.format.GMLBase.GMLNS + * @return {ol.geom.MultiLineString|undefined} MultiLineString. */ ol.format.GML3.prototype.readMultiCurve_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'MultiCurve', + goog.DEBUG && console.assert(node.localName == 'MultiCurve', 'localName should be MultiCurve'); /** @type {Array.} */ var lineStrings = ol.xml.pushParseAndPop([], @@ -116,9 +116,9 @@ ol.format.GML3.prototype.readMultiCurve_ = function(node, objectStack) { * @return {ol.geom.MultiPolygon|undefined} MultiPolygon. */ ol.format.GML3.prototype.readMultiSurface_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'MultiSurface', + goog.DEBUG && console.assert(node.localName == 'MultiSurface', 'localName should be MultiSurface'); /** @type {Array.} */ var polygons = ol.xml.pushParseAndPop([], @@ -139,9 +139,9 @@ ol.format.GML3.prototype.readMultiSurface_ = function(node, objectStack) { * @private */ ol.format.GML3.prototype.curveMemberParser_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'curveMember' || + goog.DEBUG && console.assert(node.localName == 'curveMember' || node.localName == 'curveMembers', 'localName should be curveMember or curveMembers'); ol.xml.parseNode(this.CURVEMEMBER_PARSERS_, node, objectStack, this); @@ -154,9 +154,9 @@ ol.format.GML3.prototype.curveMemberParser_ = function(node, objectStack) { * @private */ ol.format.GML3.prototype.surfaceMemberParser_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'surfaceMember' || + goog.DEBUG && console.assert(node.localName == 'surfaceMember' || node.localName == 'surfaceMembers', 'localName should be surfaceMember or surfaceMembers'); ol.xml.parseNode(this.SURFACEMEMBER_PARSERS_, @@ -171,9 +171,9 @@ ol.format.GML3.prototype.surfaceMemberParser_ = function(node, objectStack) { * @return {Array.<(Array.)>|undefined} flat coordinates. */ ol.format.GML3.prototype.readPatch_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'patches', + goog.DEBUG && console.assert(node.localName == 'patches', 'localName should be patches'); return ol.xml.pushParseAndPop([null], this.PATCHES_PARSERS_, node, objectStack, this); @@ -187,9 +187,9 @@ ol.format.GML3.prototype.readPatch_ = function(node, objectStack) { * @return {Array.|undefined} flat coordinates. */ ol.format.GML3.prototype.readSegment_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'segments', + goog.DEBUG && console.assert(node.localName == 'segments', 'localName should be segments'); return ol.xml.pushParseAndPop([null], this.SEGMENTS_PARSERS_, node, objectStack, this); @@ -203,9 +203,9 @@ ol.format.GML3.prototype.readSegment_ = function(node, objectStack) { * @return {Array.<(Array.)>|undefined} flat coordinates. */ ol.format.GML3.prototype.readPolygonPatch_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'npde.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'PolygonPatch', + goog.DEBUG && console.assert(node.localName == 'PolygonPatch', 'localName should be PolygonPatch'); return ol.xml.pushParseAndPop([null], this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this); @@ -219,9 +219,9 @@ ol.format.GML3.prototype.readPolygonPatch_ = function(node, objectStack) { * @return {Array.|undefined} flat coordinates. */ ol.format.GML3.prototype.readLineStringSegment_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'LineStringSegment', + goog.DEBUG && console.assert(node.localName == 'LineStringSegment', 'localName should be LineStringSegment'); return ol.xml.pushParseAndPop([null], this.GEOMETRY_FLAT_COORDINATES_PARSERS_, @@ -235,9 +235,9 @@ ol.format.GML3.prototype.readLineStringSegment_ = function(node, objectStack) { * @private */ ol.format.GML3.prototype.interiorParser_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'interior', + goog.DEBUG && console.assert(node.localName == 'interior', 'localName should be interior'); /** @type {Array.|undefined} */ var flatLinearRing = ol.xml.pushParseAndPop(undefined, @@ -245,9 +245,9 @@ ol.format.GML3.prototype.interiorParser_ = function(node, objectStack) { if (flatLinearRing) { var flatLinearRings = /** @type {Array.>} */ (objectStack[objectStack.length - 1]); - ol.DEBUG && console.assert(Array.isArray(flatLinearRings), + goog.DEBUG && console.assert(Array.isArray(flatLinearRings), 'flatLinearRings should be an array'); - ol.DEBUG && console.assert(flatLinearRings.length > 0, + goog.DEBUG && console.assert(flatLinearRings.length > 0, 'flatLinearRings should have an array length of 1 or more'); flatLinearRings.push(flatLinearRing); } @@ -260,9 +260,9 @@ ol.format.GML3.prototype.interiorParser_ = function(node, objectStack) { * @private */ ol.format.GML3.prototype.exteriorParser_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'exterior', + goog.DEBUG && console.assert(node.localName == 'exterior', 'localName should be exterior'); /** @type {Array.|undefined} */ var flatLinearRing = ol.xml.pushParseAndPop(undefined, @@ -270,9 +270,9 @@ ol.format.GML3.prototype.exteriorParser_ = function(node, objectStack) { if (flatLinearRing) { var flatLinearRings = /** @type {Array.>} */ (objectStack[objectStack.length - 1]); - ol.DEBUG && console.assert(Array.isArray(flatLinearRings), + goog.DEBUG && console.assert(Array.isArray(flatLinearRings), 'flatLinearRings should be an array'); - ol.DEBUG && console.assert(flatLinearRings.length > 0, + goog.DEBUG && console.assert(flatLinearRings.length > 0, 'flatLinearRings should have an array length of 1 or more'); flatLinearRings[0] = flatLinearRing; } @@ -286,9 +286,9 @@ ol.format.GML3.prototype.exteriorParser_ = function(node, objectStack) { * @return {ol.geom.Polygon|undefined} Polygon. */ ol.format.GML3.prototype.readSurface_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Surface', + goog.DEBUG && console.assert(node.localName == 'Surface', 'localName should be Surface'); /** @type {Array.>} */ var flatLinearRings = ol.xml.pushParseAndPop([null], @@ -318,9 +318,9 @@ ol.format.GML3.prototype.readSurface_ = function(node, objectStack) { * @return {ol.geom.LineString|undefined} LineString. */ ol.format.GML3.prototype.readCurve_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Curve', 'localName should be Curve'); + goog.DEBUG && console.assert(node.localName == 'Curve', 'localName should be Curve'); /** @type {Array.} */ var flatCoordinates = ol.xml.pushParseAndPop([null], this.CURVE_PARSERS_, node, objectStack, this); @@ -341,9 +341,9 @@ ol.format.GML3.prototype.readCurve_ = function(node, objectStack) { * @return {ol.Extent|undefined} Envelope. */ ol.format.GML3.prototype.readEnvelope_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Envelope', + goog.DEBUG && console.assert(node.localName == 'Envelope', 'localName should be Envelope'); /** @type {Array.} */ var flatCoordinates = ol.xml.pushParseAndPop([null], @@ -722,7 +722,7 @@ ol.format.GML3.ENVELOPE_SERIALIZERS_ = { * @param {Array.<*>} objectStack Node stack. */ ol.format.GML3.prototype.writeEnvelope = function(node, extent, objectStack) { - ol.DEBUG && console.assert(extent.length == 4, 'extent should have 4 items'); + goog.DEBUG && console.assert(extent.length == 4, 'extent should have 4 items'); var context = objectStack[objectStack.length - 1]; var srsName = context['srsName']; if (srsName) { @@ -1185,7 +1185,7 @@ ol.format.GML3.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = { */ ol.format.GML3.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { var parentNode = objectStack[objectStack.length - 1].node; - ol.DEBUG && console.assert(ol.xml.isNode(parentNode), + goog.DEBUG && console.assert(ol.xml.isNode(parentNode), 'parentNode should be a node'); return ol.xml.createElementNS('http://www.opengis.net/gml', ol.format.GML3.MULTIGEOMETRY_TO_MEMBER_NODENAME_[parentNode.nodeName]); @@ -1207,7 +1207,7 @@ ol.format.GML3.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, o var curve = context['curve']; var multiCurve = context['multiCurve']; var parentNode = objectStack[objectStack.length - 1].node; - ol.DEBUG && console.assert(ol.xml.isNode(parentNode), + goog.DEBUG && console.assert(ol.xml.isNode(parentNode), 'parentNode should be a node'); var nodeName; if (!Array.isArray(value)) { diff --git a/src/ol/format/gml/gmlbaseformat.js b/src/ol/format/gml/gmlbaseformat.js index ac5b42aaf0..2ade5560f1 100644 --- a/src/ol/format/gml/gmlbaseformat.js +++ b/src/ol/format/gml/gmlbaseformat.js @@ -107,7 +107,7 @@ ol.format.GMLBase.ONLY_WHITESPACE_RE_ = /^[\s\xa0]*$/; * @return {Array. | undefined} Features. */ ol.format.GMLBase.prototype.readFeaturesInternal = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); var localName = node.localName; var features = null; @@ -259,14 +259,14 @@ ol.format.GMLBase.prototype.readFeatureElement = function(node, objectStack) { * @return {ol.geom.Point|undefined} Point. */ ol.format.GMLBase.prototype.readPoint = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Point', 'localName should be Point'); + goog.DEBUG && console.assert(node.localName == 'Point', 'localName should be Point'); var flatCoordinates = this.readFlatCoordinatesFromNode_(node, objectStack); if (flatCoordinates) { var point = new ol.geom.Point(null); - ol.DEBUG && console.assert(flatCoordinates.length == 3, + goog.DEBUG && console.assert(flatCoordinates.length == 3, 'flatCoordinates should have a length of 3'); point.setFlatCoordinates(ol.geom.GeometryLayout.XYZ, flatCoordinates); return point; @@ -280,9 +280,9 @@ ol.format.GMLBase.prototype.readPoint = function(node, objectStack) { * @return {ol.geom.MultiPoint|undefined} MultiPoint. */ ol.format.GMLBase.prototype.readMultiPoint = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'MultiPoint', + goog.DEBUG && console.assert(node.localName == 'MultiPoint', 'localName should be MultiPoint'); /** @type {Array.>} */ var coordinates = ol.xml.pushParseAndPop([], @@ -301,9 +301,9 @@ ol.format.GMLBase.prototype.readMultiPoint = function(node, objectStack) { * @return {ol.geom.MultiLineString|undefined} MultiLineString. */ ol.format.GMLBase.prototype.readMultiLineString = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'MultiLineString', + goog.DEBUG && console.assert(node.localName == 'MultiLineString', 'localName should be MultiLineString'); /** @type {Array.} */ var lineStrings = ol.xml.pushParseAndPop([], @@ -324,9 +324,9 @@ ol.format.GMLBase.prototype.readMultiLineString = function(node, objectStack) { * @return {ol.geom.MultiPolygon|undefined} MultiPolygon. */ ol.format.GMLBase.prototype.readMultiPolygon = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'MultiPolygon', + goog.DEBUG && console.assert(node.localName == 'MultiPolygon', 'localName should be MultiPolygon'); /** @type {Array.} */ var polygons = ol.xml.pushParseAndPop([], @@ -347,9 +347,9 @@ ol.format.GMLBase.prototype.readMultiPolygon = function(node, objectStack) { * @private */ ol.format.GMLBase.prototype.pointMemberParser_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'pointMember' || + goog.DEBUG && console.assert(node.localName == 'pointMember' || node.localName == 'pointMembers', 'localName should be pointMember or pointMembers'); ol.xml.parseNode(this.POINTMEMBER_PARSERS_, @@ -363,9 +363,9 @@ ol.format.GMLBase.prototype.pointMemberParser_ = function(node, objectStack) { * @private */ ol.format.GMLBase.prototype.lineStringMemberParser_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'lineStringMember' || + goog.DEBUG && console.assert(node.localName == 'lineStringMember' || node.localName == 'lineStringMembers', 'localName should be LineStringMember or LineStringMembers'); ol.xml.parseNode(this.LINESTRINGMEMBER_PARSERS_, @@ -379,9 +379,9 @@ ol.format.GMLBase.prototype.lineStringMemberParser_ = function(node, objectStack * @private */ ol.format.GMLBase.prototype.polygonMemberParser_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'polygonMember' || + goog.DEBUG && console.assert(node.localName == 'polygonMember' || node.localName == 'polygonMembers', 'localName should be polygonMember or polygonMembers'); ol.xml.parseNode(this.POLYGONMEMBER_PARSERS_, node, @@ -395,9 +395,9 @@ ol.format.GMLBase.prototype.polygonMemberParser_ = function(node, objectStack) { * @return {ol.geom.LineString|undefined} LineString. */ ol.format.GMLBase.prototype.readLineString = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'LineString', + goog.DEBUG && console.assert(node.localName == 'LineString', 'localName should be LineString'); var flatCoordinates = this.readFlatCoordinatesFromNode_(node, objectStack); @@ -418,9 +418,9 @@ ol.format.GMLBase.prototype.readLineString = function(node, objectStack) { * @return {Array.|undefined} LinearRing flat coordinates. */ ol.format.GMLBase.prototype.readFlatLinearRing_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'LinearRing', + goog.DEBUG && console.assert(node.localName == 'LinearRing', 'localName should be LinearRing'); var ring = ol.xml.pushParseAndPop(null, this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, @@ -439,9 +439,9 @@ ol.format.GMLBase.prototype.readFlatLinearRing_ = function(node, objectStack) { * @return {ol.geom.LinearRing|undefined} LinearRing. */ ol.format.GMLBase.prototype.readLinearRing = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'LinearRing', + goog.DEBUG && console.assert(node.localName == 'LinearRing', 'localName should be LinearRing'); var flatCoordinates = this.readFlatCoordinatesFromNode_(node, objectStack); @@ -461,9 +461,9 @@ ol.format.GMLBase.prototype.readLinearRing = function(node, objectStack) { * @return {ol.geom.Polygon|undefined} Polygon. */ ol.format.GMLBase.prototype.readPolygon = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Polygon', + goog.DEBUG && console.assert(node.localName == 'Polygon', 'localName should be Polygon'); /** @type {Array.>} */ var flatLinearRings = ol.xml.pushParseAndPop([null], @@ -493,7 +493,7 @@ ol.format.GMLBase.prototype.readPolygon = function(node, objectStack) { * @return {Array.} Flat coordinates. */ ol.format.GMLBase.prototype.readFlatCoordinatesFromNode_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); return ol.xml.pushParseAndPop(null, this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, diff --git a/src/ol/format/gpxformat.js b/src/ol/format/gpxformat.js index 5cf04e8585..002dc63eb8 100644 --- a/src/ol/format/gpxformat.js +++ b/src/ol/format/gpxformat.js @@ -71,7 +71,7 @@ ol.format.GPX.SCHEMA_LOCATION_ = 'http://www.topografix.com/GPX/1/1 ' + * @return {Array.} Flat coordinates. */ ol.format.GPX.appendCoordinate_ = function(flatCoordinates, node, values) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); flatCoordinates.push( parseFloat(node.getAttribute('lon')), @@ -98,9 +98,9 @@ ol.format.GPX.appendCoordinate_ = function(flatCoordinates, node, values) { * @private */ ol.format.GPX.parseLink_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'link', 'localName should be link'); + goog.DEBUG && console.assert(node.localName == 'link', 'localName should be link'); var values = /** @type {Object} */ (objectStack[objectStack.length - 1]); var href = node.getAttribute('href'); if (href !== null) { @@ -116,9 +116,9 @@ ol.format.GPX.parseLink_ = function(node, objectStack) { * @private */ ol.format.GPX.parseExtensions_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'extensions', + goog.DEBUG && console.assert(node.localName == 'extensions', 'localName should be extensions'); var values = /** @type {Object} */ (objectStack[objectStack.length - 1]); values['extensionsNode_'] = node; @@ -131,9 +131,9 @@ ol.format.GPX.parseExtensions_ = function(node, objectStack) { * @private */ ol.format.GPX.parseRtePt_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'rtept', 'localName should be rtept'); + goog.DEBUG && console.assert(node.localName == 'rtept', 'localName should be rtept'); var values = ol.xml.pushParseAndPop( {}, ol.format.GPX.RTEPT_PARSERS_, node, objectStack); if (values) { @@ -151,9 +151,9 @@ ol.format.GPX.parseRtePt_ = function(node, objectStack) { * @private */ ol.format.GPX.parseTrkPt_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'trkpt', 'localName should be trkpt'); + goog.DEBUG && console.assert(node.localName == 'trkpt', 'localName should be trkpt'); var values = ol.xml.pushParseAndPop( {}, ol.format.GPX.TRKPT_PARSERS_, node, objectStack); if (values) { @@ -171,9 +171,9 @@ ol.format.GPX.parseTrkPt_ = function(node, objectStack) { * @private */ ol.format.GPX.parseTrkSeg_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'trkseg', + goog.DEBUG && console.assert(node.localName == 'trkseg', 'localName should be trkseg'); var values = /** @type {Object} */ (objectStack[objectStack.length - 1]); ol.xml.parseNode(ol.format.GPX.TRKSEG_PARSERS_, node, objectStack); @@ -191,9 +191,9 @@ ol.format.GPX.parseTrkSeg_ = function(node, objectStack) { * @return {ol.Feature|undefined} Track. */ ol.format.GPX.readRte_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'rte', 'localName should be rte'); + goog.DEBUG && console.assert(node.localName == 'rte', 'localName should be rte'); var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); var values = ol.xml.pushParseAndPop({ 'flatCoordinates': [] @@ -220,9 +220,9 @@ ol.format.GPX.readRte_ = function(node, objectStack) { * @return {ol.Feature|undefined} Track. */ ol.format.GPX.readTrk_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'trk', 'localName should be trk'); + goog.DEBUG && console.assert(node.localName == 'trk', 'localName should be trk'); var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); var values = ol.xml.pushParseAndPop({ 'flatCoordinates': [], @@ -253,9 +253,9 @@ ol.format.GPX.readTrk_ = function(node, objectStack) { * @return {ol.Feature|undefined} Waypoint. */ ol.format.GPX.readWpt_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'wpt', 'localName should be wpt'); + goog.DEBUG && console.assert(node.localName == 'wpt', 'localName should be wpt'); var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); var values = ol.xml.pushParseAndPop( {}, ol.format.GPX.WPT_PARSERS_, node, objectStack); @@ -455,7 +455,7 @@ ol.format.GPX.prototype.readFeature; * @inheritDoc */ ol.format.GPX.prototype.readFeatureFromNode = function(node, opt_options) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); if (!ol.array.includes(ol.format.GPX.NAMESPACE_URIS_, node.namespaceURI)) { return null; @@ -491,7 +491,7 @@ ol.format.GPX.prototype.readFeatures; * @inheritDoc */ ol.format.GPX.prototype.readFeaturesFromNode = function(node, opt_options) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); if (!ol.array.includes(ol.format.GPX.NAMESPACE_URIS_, node.namespaceURI)) { return []; @@ -551,7 +551,7 @@ ol.format.GPX.writeLink_ = function(node, value, objectStack) { ol.format.GPX.writeWptType_ = function(node, coordinate, objectStack) { var context = objectStack[objectStack.length - 1]; var parentNode = context.node; - ol.DEBUG && console.assert(ol.xml.isNode(parentNode), + goog.DEBUG && console.assert(ol.xml.isNode(parentNode), 'parentNode should be an XML node'); var namespaceURI = parentNode.namespaceURI; var properties = context['properties']; @@ -858,7 +858,7 @@ ol.format.GPX.GPX_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { var nodeName = ol.format.GPX.GEOMETRY_TYPE_TO_NODENAME_[geometry.getType()]; if (nodeName) { var parentNode = objectStack[objectStack.length - 1].node; - ol.DEBUG && console.assert(ol.xml.isNode(parentNode), + goog.DEBUG && console.assert(ol.xml.isNode(parentNode), 'parentNode should be an XML node'); return ol.xml.createElementNS(parentNode.namespaceURI, nodeName); } diff --git a/src/ol/format/igcformat.js b/src/ol/format/igcformat.js index 85dc44810b..7300a213c0 100644 --- a/src/ol/format/igcformat.js +++ b/src/ol/format/igcformat.js @@ -153,7 +153,7 @@ ol.format.IGC.prototype.readFeatureFromText = function(text, opt_options) { } else if (altitudeMode == ol.format.IGCZ.BAROMETRIC) { z = parseInt(m[12], 10); } else { - ol.DEBUG && console.assert(false, 'Unknown altitude mode.'); + goog.DEBUG && console.assert(false, 'Unknown altitude mode.'); z = 0; } flatCoordinates.push(z); diff --git a/src/ol/format/kmlformat.js b/src/ol/format/kmlformat.js index 921ff01c9f..ed23d994a7 100644 --- a/src/ol/format/kmlformat.js +++ b/src/ol/format/kmlformat.js @@ -542,9 +542,9 @@ ol.format.KML.readStyleMapValue_ = function(node, objectStack) { * @private */ ol.format.KML.IconStyleParser_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be an ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'IconStyle', + goog.DEBUG && console.assert(node.localName == 'IconStyle', 'localName should be IconStyle'); // FIXME refreshMode // FIXME refreshInterval @@ -641,9 +641,9 @@ ol.format.KML.IconStyleParser_ = function(node, objectStack) { * @private */ ol.format.KML.LabelStyleParser_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'LabelStyle', + goog.DEBUG && console.assert(node.localName == 'LabelStyle', 'localName should be LabelStyle'); // FIXME colorMode var object = ol.xml.pushParseAndPop( @@ -670,9 +670,9 @@ ol.format.KML.LabelStyleParser_ = function(node, objectStack) { * @private */ ol.format.KML.LineStyleParser_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'LineStyle', + goog.DEBUG && console.assert(node.localName == 'LineStyle', 'localName should be LineStyle'); // FIXME colorMode // FIXME gx:outerColor @@ -700,9 +700,9 @@ ol.format.KML.LineStyleParser_ = function(node, objectStack) { * @private */ ol.format.KML.PolyStyleParser_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'PolyStyle', + goog.DEBUG && console.assert(node.localName == 'PolyStyle', 'localName should be PolyStyle'); // FIXME colorMode var object = ol.xml.pushParseAndPop( @@ -735,9 +735,9 @@ ol.format.KML.PolyStyleParser_ = function(node, objectStack) { * @return {Array.} LinearRing flat coordinates. */ ol.format.KML.readFlatLinearRing_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'LinearRing', + goog.DEBUG && console.assert(node.localName == 'LinearRing', 'localName should be LinearRing'); return ol.xml.pushParseAndPop(null, ol.format.KML.FLAT_LINEAR_RING_PARSERS_, node, objectStack); @@ -750,12 +750,12 @@ ol.format.KML.readFlatLinearRing_ = function(node, objectStack) { * @private */ ol.format.KML.gxCoordParser_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(ol.array.includes( + goog.DEBUG && console.assert(ol.array.includes( ol.format.KML.GX_NAMESPACE_URIS_, node.namespaceURI), 'namespaceURI of the node should be known to the KML parser'); - ol.DEBUG && console.assert(node.localName == 'coord', 'localName should be coord'); + goog.DEBUG && console.assert(node.localName == 'coord', 'localName should be coord'); var gxTrackObject = /** @type {ol.KMLGxTrackObject_} */ (objectStack[objectStack.length - 1]); var flatCoordinates = gxTrackObject.flatCoordinates; @@ -781,12 +781,12 @@ ol.format.KML.gxCoordParser_ = function(node, objectStack) { * @return {ol.geom.MultiLineString|undefined} MultiLineString. */ ol.format.KML.readGxMultiTrack_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(ol.array.includes( + goog.DEBUG && console.assert(ol.array.includes( ol.format.KML.GX_NAMESPACE_URIS_, node.namespaceURI), 'namespaceURI of the node should be known to the KML parser'); - ol.DEBUG && console.assert(node.localName == 'MultiTrack', + goog.DEBUG && console.assert(node.localName == 'MultiTrack', 'localName should be MultiTrack'); var lineStrings = ol.xml.pushParseAndPop([], ol.format.KML.GX_MULTITRACK_GEOMETRY_PARSERS_, node, objectStack); @@ -806,12 +806,12 @@ ol.format.KML.readGxMultiTrack_ = function(node, objectStack) { * @return {ol.geom.LineString|undefined} LineString. */ ol.format.KML.readGxTrack_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(ol.array.includes( + goog.DEBUG && console.assert(ol.array.includes( ol.format.KML.GX_NAMESPACE_URIS_, node.namespaceURI), 'namespaceURI of the node should be known to the KML parser'); - ol.DEBUG && console.assert(node.localName == 'Track', 'localName should be Track'); + goog.DEBUG && console.assert(node.localName == 'Track', 'localName should be Track'); var gxTrackObject = ol.xml.pushParseAndPop( /** @type {ol.KMLGxTrackObject_} */ ({ flatCoordinates: [], @@ -822,7 +822,7 @@ ol.format.KML.readGxTrack_ = function(node, objectStack) { } var flatCoordinates = gxTrackObject.flatCoordinates; var whens = gxTrackObject.whens; - ol.DEBUG && console.assert(flatCoordinates.length / 4 == whens.length, + goog.DEBUG && console.assert(flatCoordinates.length / 4 == whens.length, 'the length of the flatCoordinates array divided by 4 should be the ' + 'length of the whens array'); var i, ii; @@ -843,9 +843,9 @@ ol.format.KML.readGxTrack_ = function(node, objectStack) { * @return {Object} Icon object. */ ol.format.KML.readIcon_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Icon', 'localName should be Icon'); + goog.DEBUG && console.assert(node.localName == 'Icon', 'localName should be Icon'); var iconObject = ol.xml.pushParseAndPop( {}, ol.format.KML.ICON_PARSERS_, node, objectStack); if (iconObject) { @@ -863,7 +863,7 @@ ol.format.KML.readIcon_ = function(node, objectStack) { * @return {Array.} Flat coordinates. */ ol.format.KML.readFlatCoordinatesFromNode_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); return ol.xml.pushParseAndPop(null, ol.format.KML.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, objectStack); @@ -877,9 +877,9 @@ ol.format.KML.readFlatCoordinatesFromNode_ = function(node, objectStack) { * @return {ol.geom.LineString|undefined} LineString. */ ol.format.KML.readLineString_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'LineString', + goog.DEBUG && console.assert(node.localName == 'LineString', 'localName should be LineString'); var properties = ol.xml.pushParseAndPop({}, ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node, @@ -904,9 +904,9 @@ ol.format.KML.readLineString_ = function(node, objectStack) { * @return {ol.geom.Polygon|undefined} Polygon. */ ol.format.KML.readLinearRing_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'LinearRing', + goog.DEBUG && console.assert(node.localName == 'LinearRing', 'localName should be LinearRing'); var properties = ol.xml.pushParseAndPop({}, ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node, @@ -932,9 +932,9 @@ ol.format.KML.readLinearRing_ = function(node, objectStack) { * @return {ol.geom.Geometry} Geometry. */ ol.format.KML.readMultiGeometry_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'MultiGeometry', + goog.DEBUG && console.assert(node.localName == 'MultiGeometry', 'localName should be MultiGeometry'); var geometries = ol.xml.pushParseAndPop([], ol.format.KML.MULTI_GEOMETRY_PARSERS_, node, objectStack); @@ -965,7 +965,7 @@ ol.format.KML.readMultiGeometry_ = function(node, objectStack) { flatCoordinates = point.getFlatCoordinates(); for (i = 1, ii = geometries.length; i < ii; ++i) { geometry = geometries[i]; - ol.DEBUG && console.assert(geometry.getLayout() == layout, + goog.DEBUG && console.assert(geometry.getLayout() == layout, 'geometry layout should be consistent'); ol.array.extend(flatCoordinates, geometry.getFlatCoordinates()); } @@ -999,9 +999,9 @@ ol.format.KML.readMultiGeometry_ = function(node, objectStack) { * @return {ol.geom.Point|undefined} Point. */ ol.format.KML.readPoint_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Point', 'localName should be Point'); + goog.DEBUG && console.assert(node.localName == 'Point', 'localName should be Point'); var properties = ol.xml.pushParseAndPop({}, ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node, objectStack); @@ -1009,7 +1009,7 @@ ol.format.KML.readPoint_ = function(node, objectStack) { ol.format.KML.readFlatCoordinatesFromNode_(node, objectStack); if (flatCoordinates) { var point = new ol.geom.Point(null); - ol.DEBUG && console.assert(flatCoordinates.length == 3, + goog.DEBUG && console.assert(flatCoordinates.length == 3, 'flatCoordinates should have a length of 3'); point.setFlatCoordinates(ol.geom.GeometryLayout.XYZ, flatCoordinates); point.setProperties(properties); @@ -1027,9 +1027,9 @@ ol.format.KML.readPoint_ = function(node, objectStack) { * @return {ol.geom.Polygon|undefined} Polygon. */ ol.format.KML.readPolygon_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Polygon', + goog.DEBUG && console.assert(node.localName == 'Polygon', 'localName should be Polygon'); var properties = ol.xml.pushParseAndPop(/** @type {Object} */ ({}), ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node, @@ -1062,9 +1062,9 @@ ol.format.KML.readPolygon_ = function(node, objectStack) { * @return {Array.} Style. */ ol.format.KML.readStyle_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Style', 'localName should be Style'); + goog.DEBUG && console.assert(node.localName == 'Style', 'localName should be Style'); var styleObject = ol.xml.pushParseAndPop( {}, ol.format.KML.STYLE_PARSERS_, node, objectStack); if (!styleObject) { @@ -1138,9 +1138,9 @@ ol.format.KML.setCommonGeometryProperties_ = function(multiGeometry, * @private */ ol.format.KML.DataParser_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Data', 'localName should be Data'); + goog.DEBUG && console.assert(node.localName == 'Data', 'localName should be Data'); var name = node.getAttribute('name'); if (name !== null) { var data = ol.xml.pushParseAndPop( @@ -1160,9 +1160,9 @@ ol.format.KML.DataParser_ = function(node, objectStack) { * @private */ ol.format.KML.ExtendedDataParser_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'ExtendedData', + goog.DEBUG && console.assert(node.localName == 'ExtendedData', 'localName should be ExtendedData'); ol.xml.parseNode(ol.format.KML.EXTENDED_DATA_PARSERS_, node, objectStack); }; @@ -1174,9 +1174,9 @@ ol.format.KML.ExtendedDataParser_ = function(node, objectStack) { * @private */ ol.format.KML.PairDataParser_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Pair', 'localName should be Pair'); + goog.DEBUG && console.assert(node.localName == 'Pair', 'localName should be Pair'); var pairObject = ol.xml.pushParseAndPop( {}, ol.format.KML.PAIR_PARSERS_, node, objectStack); if (!pairObject) { @@ -1205,9 +1205,9 @@ ol.format.KML.PairDataParser_ = function(node, objectStack) { * @private */ ol.format.KML.PlacemarkStyleMapParser_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'StyleMap', + goog.DEBUG && console.assert(node.localName == 'StyleMap', 'localName should be StyleMap'); var styleMapValue = ol.format.KML.readStyleMapValue_(node, objectStack); if (!styleMapValue) { @@ -1230,9 +1230,9 @@ ol.format.KML.PlacemarkStyleMapParser_ = function(node, objectStack) { * @private */ ol.format.KML.SchemaDataParser_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'SchemaData', + goog.DEBUG && console.assert(node.localName == 'SchemaData', 'localName should be SchemaData'); ol.xml.parseNode(ol.format.KML.SCHEMA_DATA_PARSERS_, node, objectStack); }; @@ -1244,9 +1244,9 @@ ol.format.KML.SchemaDataParser_ = function(node, objectStack) { * @private */ ol.format.KML.SimpleDataParser_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'SimpleData', + goog.DEBUG && console.assert(node.localName == 'SimpleData', 'localName should be SimpleData'); var name = node.getAttribute('name'); if (name !== null) { @@ -1264,9 +1264,9 @@ ol.format.KML.SimpleDataParser_ = function(node, objectStack) { * @private */ ol.format.KML.innerBoundaryIsParser_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'innerBoundaryIs', + goog.DEBUG && console.assert(node.localName == 'innerBoundaryIs', 'localName should be innerBoundaryIs'); /** @type {Array.|undefined} */ var flatLinearRing = ol.xml.pushParseAndPop(undefined, @@ -1274,9 +1274,9 @@ ol.format.KML.innerBoundaryIsParser_ = function(node, objectStack) { if (flatLinearRing) { var flatLinearRings = /** @type {Array.>} */ (objectStack[objectStack.length - 1]); - ol.DEBUG && console.assert(Array.isArray(flatLinearRings), + goog.DEBUG && console.assert(Array.isArray(flatLinearRings), 'flatLinearRings should be an array'); - ol.DEBUG && console.assert(flatLinearRings.length > 0, + goog.DEBUG && console.assert(flatLinearRings.length > 0, 'flatLinearRings array should not be empty'); flatLinearRings.push(flatLinearRing); } @@ -1289,9 +1289,9 @@ ol.format.KML.innerBoundaryIsParser_ = function(node, objectStack) { * @private */ ol.format.KML.outerBoundaryIsParser_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'outerBoundaryIs', + goog.DEBUG && console.assert(node.localName == 'outerBoundaryIs', 'localName should be outerBoundaryIs'); /** @type {Array.|undefined} */ var flatLinearRing = ol.xml.pushParseAndPop(undefined, @@ -1299,9 +1299,9 @@ ol.format.KML.outerBoundaryIsParser_ = function(node, objectStack) { if (flatLinearRing) { var flatLinearRings = /** @type {Array.>} */ (objectStack[objectStack.length - 1]); - ol.DEBUG && console.assert(Array.isArray(flatLinearRings), + goog.DEBUG && console.assert(Array.isArray(flatLinearRings), 'flatLinearRings should be an array'); - ol.DEBUG && console.assert(flatLinearRings.length > 0, + goog.DEBUG && console.assert(flatLinearRings.length > 0, 'flatLinearRings array should not be empty'); flatLinearRings[0] = flatLinearRing; } @@ -1314,9 +1314,9 @@ ol.format.KML.outerBoundaryIsParser_ = function(node, objectStack) { * @private */ ol.format.KML.LinkParser_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Link', 'localName should be Link'); + goog.DEBUG && console.assert(node.localName == 'Link', 'localName should be Link'); ol.xml.parseNode(ol.format.KML.LINK_PARSERS_, node, objectStack); }; @@ -1327,9 +1327,9 @@ ol.format.KML.LinkParser_ = function(node, objectStack) { * @private */ ol.format.KML.whenParser_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'when', 'localName should be when'); + goog.DEBUG && console.assert(node.localName == 'when', 'localName should be when'); var gxTrackObject = /** @type {ol.KMLGxTrackObject_} */ (objectStack[objectStack.length - 1]); var whens = gxTrackObject.whens; @@ -1668,10 +1668,10 @@ ol.format.KML.prototype.getExtensions = function() { * @return {Array.|undefined} Features. */ ol.format.KML.prototype.readDocumentOrFolder_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); var localName = node.localName; - ol.DEBUG && console.assert(localName == 'Document' || localName == 'Folder', + goog.DEBUG && console.assert(localName == 'Document' || localName == 'Folder', 'localName should be Document or Folder'); // FIXME use scope somehow var parsersNS = ol.xml.makeStructureNS( @@ -1699,9 +1699,9 @@ ol.format.KML.prototype.readDocumentOrFolder_ = function(node, objectStack) { * @return {ol.Feature|undefined} Feature. */ ol.format.KML.prototype.readPlacemark_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Placemark', + goog.DEBUG && console.assert(node.localName == 'Placemark', 'localName should be Placemark'); var object = ol.xml.pushParseAndPop({'geometry': null}, ol.format.KML.PLACEMARK_PARSERS_, node, objectStack); @@ -1746,9 +1746,9 @@ ol.format.KML.prototype.readPlacemark_ = function(node, objectStack) { * @private */ ol.format.KML.prototype.readSharedStyle_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Style', 'localName should be Style'); + goog.DEBUG && console.assert(node.localName == 'Style', 'localName should be Style'); var id = node.getAttribute('id'); if (id !== null) { var style = ol.format.KML.readStyle_(node, objectStack); @@ -1772,9 +1772,9 @@ ol.format.KML.prototype.readSharedStyle_ = function(node, objectStack) { * @private */ ol.format.KML.prototype.readSharedStyleMap_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'StyleMap', + goog.DEBUG && console.assert(node.localName == 'StyleMap', 'localName should be StyleMap'); var id = node.getAttribute('id'); if (id === null) { @@ -1813,12 +1813,12 @@ ol.format.KML.prototype.readFeature; * @inheritDoc */ ol.format.KML.prototype.readFeatureFromNode = function(node, opt_options) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); if (!ol.array.includes(ol.format.KML.NAMESPACE_URIS_, node.namespaceURI)) { return null; } - ol.DEBUG && console.assert(node.localName == 'Placemark', + goog.DEBUG && console.assert(node.localName == 'Placemark', 'localName should be Placemark'); var feature = this.readPlacemark_( node, [this.getReadOptions(node, opt_options)]); @@ -1848,7 +1848,7 @@ ol.format.KML.prototype.readFeatures; * @inheritDoc */ ol.format.KML.prototype.readFeaturesFromNode = function(node, opt_options) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); if (!ol.array.includes(ol.format.KML.NAMESPACE_URIS_, node.namespaceURI)) { return []; @@ -2344,7 +2344,7 @@ ol.format.KML.writePlacemark_ = function(node, feature, objectStack) { * @private */ ol.format.KML.writePrimitiveGeometry_ = function(node, geometry, objectStack) { - ol.DEBUG && console.assert( + goog.DEBUG && console.assert( (geometry instanceof ol.geom.Point) || (geometry instanceof ol.geom.LineString) || (geometry instanceof ol.geom.LinearRing), @@ -2369,7 +2369,7 @@ ol.format.KML.writePrimitiveGeometry_ = function(node, geometry, objectStack) { */ ol.format.KML.writePolygon_ = function(node, polygon, objectStack) { var linearRings = polygon.getLinearRings(); - ol.DEBUG && console.assert(linearRings.length > 0, + goog.DEBUG && console.assert(linearRings.length > 0, 'linearRings should not be empty'); var outerRing = linearRings.shift(); var /** @type {ol.XmlNodeStackItem} */ context = {node: node}; @@ -2768,7 +2768,7 @@ ol.format.KML.GX_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { ol.format.KML.DOCUMENT_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { var parentNode = objectStack[objectStack.length - 1].node; - ol.DEBUG && console.assert(ol.xml.isNode(parentNode), + goog.DEBUG && console.assert(ol.xml.isNode(parentNode), 'parentNode should be an XML node'); return ol.xml.createElementNS(parentNode.namespaceURI, 'Placemark'); }; @@ -2786,7 +2786,7 @@ ol.format.KML.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { if (value) { var parentNode = objectStack[objectStack.length - 1].node; - ol.DEBUG && console.assert(ol.xml.isNode(parentNode), + goog.DEBUG && console.assert(ol.xml.isNode(parentNode), 'parentNode should be an XML node'); return ol.xml.createElementNS(parentNode.namespaceURI, ol.format.KML.GEOMETRY_TYPE_TO_NODENAME_[/** @type {ol.geom.Geometry} */ (value).getType()]); diff --git a/src/ol/format/osmxmlformat.js b/src/ol/format/osmxmlformat.js index 5e83583d4b..f3b7500edc 100644 --- a/src/ol/format/osmxmlformat.js +++ b/src/ol/format/osmxmlformat.js @@ -56,9 +56,9 @@ ol.format.OSMXML.prototype.getExtensions = function() { * @private */ ol.format.OSMXML.readNode_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'node', 'localName should be node'); + goog.DEBUG && console.assert(node.localName == 'node', 'localName should be node'); var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); var state = /** @type {Object} */ (objectStack[objectStack.length - 1]); var id = node.getAttribute('id'); @@ -89,9 +89,9 @@ ol.format.OSMXML.readNode_ = function(node, objectStack) { * @private */ ol.format.OSMXML.readWay_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'way', 'localName should be way'); + goog.DEBUG && console.assert(node.localName == 'way', 'localName should be way'); var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); var id = node.getAttribute('id'); var values = ol.xml.pushParseAndPop({ @@ -129,9 +129,9 @@ ol.format.OSMXML.readWay_ = function(node, objectStack) { * @private */ ol.format.OSMXML.readNd_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'nd', 'localName should be nd'); + goog.DEBUG && console.assert(node.localName == 'nd', 'localName should be nd'); var values = /** @type {Object} */ (objectStack[objectStack.length - 1]); values.ndrefs.push(node.getAttribute('ref')); }; @@ -143,9 +143,9 @@ ol.format.OSMXML.readNd_ = function(node, objectStack) { * @private */ ol.format.OSMXML.readTag_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'tag', 'localName should be tag'); + goog.DEBUG && console.assert(node.localName == 'tag', 'localName should be tag'); var values = /** @type {Object} */ (objectStack[objectStack.length - 1]); values.tags[node.getAttribute('k')] = node.getAttribute('v'); }; @@ -212,7 +212,7 @@ ol.format.OSMXML.prototype.readFeatures; * @inheritDoc */ ol.format.OSMXML.prototype.readFeaturesFromNode = function(node, opt_options) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); var options = this.getReadOptions(node, opt_options); if (node.localName == 'osm') { diff --git a/src/ol/format/owsformat.js b/src/ol/format/owsformat.js index a650cfff5b..00d4484b85 100644 --- a/src/ol/format/owsformat.js +++ b/src/ol/format/owsformat.js @@ -21,7 +21,7 @@ ol.inherits(ol.format.OWS, ol.format.XML); * @return {Object} OWS object. */ ol.format.OWS.prototype.readFromDocument = function(doc) { - ol.DEBUG && console.assert(doc.nodeType == Node.DOCUMENT_NODE, + goog.DEBUG && console.assert(doc.nodeType == Node.DOCUMENT_NODE, 'doc.nodeType should be DOCUMENT'); for (var n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == Node.ELEMENT_NODE) { @@ -37,7 +37,7 @@ ol.format.OWS.prototype.readFromDocument = function(doc) { * @return {Object} OWS object. */ ol.format.OWS.prototype.readFromNode = function(node) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); var owsObject = ol.xml.pushParseAndPop({}, ol.format.OWS.PARSERS_, node, []); @@ -52,9 +52,9 @@ ol.format.OWS.prototype.readFromNode = function(node) { * @return {Object|undefined} The address. */ ol.format.OWS.readAddress_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Address', + goog.DEBUG && console.assert(node.localName == 'Address', 'localName should be Address'); return ol.xml.pushParseAndPop({}, ol.format.OWS.ADDRESS_PARSERS_, node, objectStack); @@ -68,9 +68,9 @@ ol.format.OWS.readAddress_ = function(node, objectStack) { * @return {Object|undefined} The values. */ ol.format.OWS.readAllowedValues_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'AllowedValues', + goog.DEBUG && console.assert(node.localName == 'AllowedValues', 'localName should be AllowedValues'); return ol.xml.pushParseAndPop({}, ol.format.OWS.ALLOWED_VALUES_PARSERS_, node, objectStack); @@ -84,9 +84,9 @@ ol.format.OWS.readAllowedValues_ = function(node, objectStack) { * @return {Object|undefined} The constraint. */ ol.format.OWS.readConstraint_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Constraint', + goog.DEBUG && console.assert(node.localName == 'Constraint', 'localName should be Constraint'); var name = node.getAttribute('name'); if (!name) { @@ -105,9 +105,9 @@ ol.format.OWS.readConstraint_ = function(node, objectStack) { * @return {Object|undefined} The contact info. */ ol.format.OWS.readContactInfo_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'ContactInfo', + goog.DEBUG && console.assert(node.localName == 'ContactInfo', 'localName should be ContactInfo'); return ol.xml.pushParseAndPop({}, ol.format.OWS.CONTACT_INFO_PARSERS_, node, objectStack); @@ -121,9 +121,9 @@ ol.format.OWS.readContactInfo_ = function(node, objectStack) { * @return {Object|undefined} The DCP. */ ol.format.OWS.readDcp_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'DCP', 'localName should be DCP'); + goog.DEBUG && console.assert(node.localName == 'DCP', 'localName should be DCP'); return ol.xml.pushParseAndPop({}, ol.format.OWS.DCP_PARSERS_, node, objectStack); }; @@ -136,9 +136,9 @@ ol.format.OWS.readDcp_ = function(node, objectStack) { * @return {Object|undefined} The GET object. */ ol.format.OWS.readGet_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Get', 'localName should be Get'); + goog.DEBUG && console.assert(node.localName == 'Get', 'localName should be Get'); var href = ol.format.XLink.readHref(node); if (!href) { return undefined; @@ -155,9 +155,9 @@ ol.format.OWS.readGet_ = function(node, objectStack) { * @return {Object|undefined} The HTTP object. */ ol.format.OWS.readHttp_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'HTTP', 'localName should be HTTP'); + goog.DEBUG && console.assert(node.localName == 'HTTP', 'localName should be HTTP'); return ol.xml.pushParseAndPop({}, ol.format.OWS.HTTP_PARSERS_, node, objectStack); }; @@ -170,9 +170,9 @@ ol.format.OWS.readHttp_ = function(node, objectStack) { * @return {Object|undefined} The operation. */ ol.format.OWS.readOperation_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Operation', + goog.DEBUG && console.assert(node.localName == 'Operation', 'localName should be Operation'); var name = node.getAttribute('name'); var value = ol.xml.pushParseAndPop({}, @@ -195,9 +195,9 @@ ol.format.OWS.readOperation_ = function(node, objectStack) { */ ol.format.OWS.readOperationsMetadata_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'OperationsMetadata', + goog.DEBUG && console.assert(node.localName == 'OperationsMetadata', 'localName should be OperationsMetadata'); return ol.xml.pushParseAndPop({}, ol.format.OWS.OPERATIONS_METADATA_PARSERS_, node, @@ -212,9 +212,9 @@ ol.format.OWS.readOperationsMetadata_ = function(node, * @return {Object|undefined} The phone. */ ol.format.OWS.readPhone_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Phone', 'localName should be Phone'); + goog.DEBUG && console.assert(node.localName == 'Phone', 'localName should be Phone'); return ol.xml.pushParseAndPop({}, ol.format.OWS.PHONE_PARSERS_, node, objectStack); }; @@ -228,9 +228,9 @@ ol.format.OWS.readPhone_ = function(node, objectStack) { */ ol.format.OWS.readServiceIdentification_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'ServiceIdentification', + goog.DEBUG && console.assert(node.localName == 'ServiceIdentification', 'localName should be ServiceIdentification'); return ol.xml.pushParseAndPop( {}, ol.format.OWS.SERVICE_IDENTIFICATION_PARSERS_, node, @@ -245,9 +245,9 @@ ol.format.OWS.readServiceIdentification_ = function(node, * @return {Object|undefined} The service contact. */ ol.format.OWS.readServiceContact_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'ServiceContact', + goog.DEBUG && console.assert(node.localName == 'ServiceContact', 'localName should be ServiceContact'); return ol.xml.pushParseAndPop( {}, ol.format.OWS.SERVICE_CONTACT_PARSERS_, node, @@ -262,9 +262,9 @@ ol.format.OWS.readServiceContact_ = function(node, objectStack) { * @return {Object|undefined} The service provider. */ ol.format.OWS.readServiceProvider_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'ServiceProvider', + goog.DEBUG && console.assert(node.localName == 'ServiceProvider', 'localName should be ServiceProvider'); return ol.xml.pushParseAndPop( {}, ol.format.OWS.SERVICE_PROVIDER_PARSERS_, node, @@ -279,9 +279,9 @@ ol.format.OWS.readServiceProvider_ = function(node, objectStack) { * @return {string|undefined} The value. */ ol.format.OWS.readValue_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Value', 'localName should be Value'); + goog.DEBUG && console.assert(node.localName == 'Value', 'localName should be Value'); return ol.format.XSD.readString(node); }; diff --git a/src/ol/format/polylineformat.js b/src/ol/format/polylineformat.js index c0b1116423..b00d2b2216 100644 --- a/src/ol/format/polylineformat.js +++ b/src/ol/format/polylineformat.js @@ -365,7 +365,7 @@ ol.format.Polyline.prototype.writeFeatureText = function(feature, opt_options) { * @inheritDoc */ ol.format.Polyline.prototype.writeFeaturesText = function(features, opt_options) { - ol.DEBUG && console.assert(features.length == 1, + goog.DEBUG && console.assert(features.length == 1, 'features array should have 1 item'); return this.writeFeatureText(features[0], opt_options); }; diff --git a/src/ol/format/topojsonformat.js b/src/ol/format/topojsonformat.js index 78e1bb4671..8673fd28e2 100644 --- a/src/ol/format/topojsonformat.js +++ b/src/ol/format/topojsonformat.js @@ -249,7 +249,7 @@ ol.format.TopoJSON.readFeatureFromGeometry_ = function(object, arcs, var geometry; var type = object.type; var geometryReader = ol.format.TopoJSON.GEOMETRY_READERS_[type]; - ol.DEBUG && console.assert(geometryReader, 'geometryReader should be defined'); + goog.DEBUG && console.assert(geometryReader, 'geometryReader should be defined'); if ((type === 'Point') || (type === 'MultiPoint')) { geometry = geometryReader(object, scale, translate); } else { diff --git a/src/ol/format/wfsformat.js b/src/ol/format/wfsformat.js index c5d5a67ad6..9b325d1207 100644 --- a/src/ol/format/wfsformat.js +++ b/src/ol/format/wfsformat.js @@ -176,7 +176,7 @@ ol.format.WFS.prototype.readFeatureCollectionMetadata = function(source) { * FeatureCollection metadata. */ ol.format.WFS.prototype.readFeatureCollectionMetadataFromDocument = function(doc) { - ol.DEBUG && console.assert(doc.nodeType == Node.DOCUMENT_NODE, + goog.DEBUG && console.assert(doc.nodeType == Node.DOCUMENT_NODE, 'doc.nodeType should be DOCUMENT'); for (var n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == Node.ELEMENT_NODE) { @@ -206,9 +206,9 @@ ol.format.WFS.FEATURE_COLLECTION_PARSERS_ = { * FeatureCollection metadata. */ ol.format.WFS.prototype.readFeatureCollectionMetadataFromNode = function(node) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'FeatureCollection', + goog.DEBUG && console.assert(node.localName == 'FeatureCollection', 'localName should be FeatureCollection'); var result = {}; var value = ol.format.XSD.readNonNegativeIntegerString( @@ -317,7 +317,7 @@ ol.format.WFS.TRANSACTION_RESPONSE_PARSERS_ = { * @return {ol.WFSTransactionResponse|undefined} Transaction response. */ ol.format.WFS.prototype.readTransactionResponseFromDocument = function(doc) { - ol.DEBUG && console.assert(doc.nodeType == Node.DOCUMENT_NODE, + goog.DEBUG && console.assert(doc.nodeType == Node.DOCUMENT_NODE, 'doc.nodeType should be DOCUMENT'); for (var n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == Node.ELEMENT_NODE) { @@ -333,9 +333,9 @@ ol.format.WFS.prototype.readTransactionResponseFromDocument = function(doc) { * @return {ol.WFSTransactionResponse|undefined} Transaction response. */ ol.format.WFS.prototype.readTransactionResponseFromNode = function(node) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'TransactionResponse', + goog.DEBUG && console.assert(node.localName == 'TransactionResponse', 'localName should be TransactionResponse'); return ol.xml.pushParseAndPop( /** @type {ol.WFSTransactionResponse} */({}), @@ -931,7 +931,7 @@ ol.format.WFS.prototype.readProjection; * @inheritDoc */ ol.format.WFS.prototype.readProjectionFromDocument = function(doc) { - ol.DEBUG && console.assert(doc.nodeType == Node.DOCUMENT_NODE, + goog.DEBUG && console.assert(doc.nodeType == Node.DOCUMENT_NODE, 'doc.nodeType should be a DOCUMENT'); for (var n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == Node.ELEMENT_NODE) { @@ -946,9 +946,9 @@ ol.format.WFS.prototype.readProjectionFromDocument = function(doc) { * @inheritDoc */ ol.format.WFS.prototype.readProjectionFromNode = function(node) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'FeatureCollection', + goog.DEBUG && console.assert(node.localName == 'FeatureCollection', 'localName should be FeatureCollection'); if (node.firstElementChild && diff --git a/src/ol/format/wktformat.js b/src/ol/format/wktformat.js index 9c3421b327..7e7cad0c44 100644 --- a/src/ol/format/wktformat.js +++ b/src/ol/format/wktformat.js @@ -166,7 +166,7 @@ ol.format.WKT.encodeMultiPolygonGeometry_ = function(geom) { ol.format.WKT.encode_ = function(geom) { var type = geom.getType(); var geometryEncoder = ol.format.WKT.GeometryEncoder_[type]; - ol.DEBUG && console.assert(geometryEncoder, 'geometryEncoder should be defined'); + goog.DEBUG && console.assert(geometryEncoder, 'geometryEncoder should be defined'); var enc = geometryEncoder(geom); type = type.toUpperCase(); if (enc.length === 0) { @@ -573,7 +573,7 @@ ol.format.WKT.Parser.prototype.match = function(type) { ol.format.WKT.Parser.prototype.parse = function() { this.consume_(); var geometry = this.parseGeometry_(); - ol.DEBUG && console.assert(this.token_.type == ol.format.WKT.TokenType.EOF, + goog.DEBUG && console.assert(this.token_.type == ol.format.WKT.TokenType.EOF, 'token type should be end of file'); return geometry; }; diff --git a/src/ol/format/wmscapabilitiesformat.js b/src/ol/format/wmscapabilitiesformat.js index a95066479d..bef899751f 100644 --- a/src/ol/format/wmscapabilitiesformat.js +++ b/src/ol/format/wmscapabilitiesformat.js @@ -43,7 +43,7 @@ ol.format.WMSCapabilities.prototype.read; * @return {Object} WMS Capability object. */ ol.format.WMSCapabilities.prototype.readFromDocument = function(doc) { - ol.DEBUG && console.assert(doc.nodeType == Node.DOCUMENT_NODE, + goog.DEBUG && console.assert(doc.nodeType == Node.DOCUMENT_NODE, 'doc.nodeType should be DOCUMENT'); for (var n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == Node.ELEMENT_NODE) { @@ -59,9 +59,9 @@ ol.format.WMSCapabilities.prototype.readFromDocument = function(doc) { * @return {Object} WMS Capability object. */ ol.format.WMSCapabilities.prototype.readFromNode = function(node) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'WMS_Capabilities' || + goog.DEBUG && console.assert(node.localName == 'WMS_Capabilities' || node.localName == 'WMT_MS_Capabilities', 'localName should be WMS_Capabilities or WMT_MS_Capabilities'); this.version = node.getAttribute('version').trim(); @@ -79,9 +79,9 @@ ol.format.WMSCapabilities.prototype.readFromNode = function(node) { * @return {Object|undefined} Attribution object. */ ol.format.WMSCapabilities.readAttribution_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Attribution', + goog.DEBUG && console.assert(node.localName == 'Attribution', 'localName should be Attribution'); return ol.xml.pushParseAndPop( {}, ol.format.WMSCapabilities.ATTRIBUTION_PARSERS_, node, objectStack); @@ -95,9 +95,9 @@ ol.format.WMSCapabilities.readAttribution_ = function(node, objectStack) { * @return {Object} Bounding box object. */ ol.format.WMSCapabilities.readBoundingBox_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'BoundingBox', + goog.DEBUG && console.assert(node.localName == 'BoundingBox', 'localName should be BoundingBox'); var extent = [ @@ -127,9 +127,9 @@ ol.format.WMSCapabilities.readBoundingBox_ = function(node, objectStack) { * @return {ol.Extent|undefined} Bounding box object. */ ol.format.WMSCapabilities.readEXGeographicBoundingBox_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'EX_GeographicBoundingBox', + goog.DEBUG && console.assert(node.localName == 'EX_GeographicBoundingBox', 'localName should be EX_GeographicBoundingBox'); var geographicBoundingBox = ol.xml.pushParseAndPop( {}, @@ -164,9 +164,9 @@ ol.format.WMSCapabilities.readEXGeographicBoundingBox_ = function(node, objectSt * @return {Object|undefined} Capability object. */ ol.format.WMSCapabilities.readCapability_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Capability', + goog.DEBUG && console.assert(node.localName == 'Capability', 'localName should be Capability'); return ol.xml.pushParseAndPop( {}, ol.format.WMSCapabilities.CAPABILITY_PARSERS_, node, objectStack); @@ -180,9 +180,9 @@ ol.format.WMSCapabilities.readCapability_ = function(node, objectStack) { * @return {Object|undefined} Service object. */ ol.format.WMSCapabilities.readService_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Service', + goog.DEBUG && console.assert(node.localName == 'Service', 'localName should be Service'); return ol.xml.pushParseAndPop( {}, ol.format.WMSCapabilities.SERVICE_PARSERS_, node, objectStack); @@ -196,9 +196,9 @@ ol.format.WMSCapabilities.readService_ = function(node, objectStack) { * @return {Object|undefined} Contact information object. */ ol.format.WMSCapabilities.readContactInformation_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType shpuld be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'ContactInformation', + goog.DEBUG && console.assert(node.localName == 'ContactInformation', 'localName should be ContactInformation'); return ol.xml.pushParseAndPop( {}, ol.format.WMSCapabilities.CONTACT_INFORMATION_PARSERS_, @@ -213,9 +213,9 @@ ol.format.WMSCapabilities.readContactInformation_ = function(node, objectStack) * @return {Object|undefined} Contact person object. */ ol.format.WMSCapabilities.readContactPersonPrimary_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'ContactPersonPrimary', + goog.DEBUG && console.assert(node.localName == 'ContactPersonPrimary', 'localName should be ContactPersonPrimary'); return ol.xml.pushParseAndPop( {}, ol.format.WMSCapabilities.CONTACT_PERSON_PARSERS_, @@ -230,9 +230,9 @@ ol.format.WMSCapabilities.readContactPersonPrimary_ = function(node, objectStack * @return {Object|undefined} Contact address object. */ ol.format.WMSCapabilities.readContactAddress_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'ContactAddress', + goog.DEBUG && console.assert(node.localName == 'ContactAddress', 'localName should be ContactAddress'); return ol.xml.pushParseAndPop( {}, ol.format.WMSCapabilities.CONTACT_ADDRESS_PARSERS_, @@ -247,9 +247,9 @@ ol.format.WMSCapabilities.readContactAddress_ = function(node, objectStack) { * @return {Array.|undefined} Format array. */ ol.format.WMSCapabilities.readException_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Exception', + goog.DEBUG && console.assert(node.localName == 'Exception', 'localName should be Exception'); return ol.xml.pushParseAndPop( [], ol.format.WMSCapabilities.EXCEPTION_PARSERS_, node, objectStack); @@ -263,9 +263,9 @@ ol.format.WMSCapabilities.readException_ = function(node, objectStack) { * @return {Object|undefined} Layer object. */ ol.format.WMSCapabilities.readCapabilityLayer_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Layer', 'localName should be Layer'); + goog.DEBUG && console.assert(node.localName == 'Layer', 'localName should be Layer'); return ol.xml.pushParseAndPop( {}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack); }; @@ -278,9 +278,9 @@ ol.format.WMSCapabilities.readCapabilityLayer_ = function(node, objectStack) { * @return {Object|undefined} Layer object. */ ol.format.WMSCapabilities.readLayer_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Layer', 'localName should be Layer'); + goog.DEBUG && console.assert(node.localName == 'Layer', 'localName should be Layer'); var parentLayerObject = /** @type {Object.} */ (objectStack[objectStack.length - 1]); @@ -360,9 +360,9 @@ ol.format.WMSCapabilities.readLayer_ = function(node, objectStack) { * @return {Object} Dimension object. */ ol.format.WMSCapabilities.readDimension_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Dimension', + goog.DEBUG && console.assert(node.localName == 'Dimension', 'localName should be Dimension'); var dimensionObject = { 'name': node.getAttribute('name'), @@ -387,7 +387,7 @@ ol.format.WMSCapabilities.readDimension_ = function(node, objectStack) { * @return {Object|undefined} Online resource object. */ ol.format.WMSCapabilities.readFormatOnlineresource_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); return ol.xml.pushParseAndPop( {}, ol.format.WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_, @@ -402,9 +402,9 @@ ol.format.WMSCapabilities.readFormatOnlineresource_ = function(node, objectStack * @return {Object|undefined} Request object. */ ol.format.WMSCapabilities.readRequest_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Request', + goog.DEBUG && console.assert(node.localName == 'Request', 'localName should be Request'); return ol.xml.pushParseAndPop( {}, ol.format.WMSCapabilities.REQUEST_PARSERS_, node, objectStack); @@ -418,9 +418,9 @@ ol.format.WMSCapabilities.readRequest_ = function(node, objectStack) { * @return {Object|undefined} DCP type object. */ ol.format.WMSCapabilities.readDCPType_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'DCPType', + goog.DEBUG && console.assert(node.localName == 'DCPType', 'localName should be DCPType'); return ol.xml.pushParseAndPop( {}, ol.format.WMSCapabilities.DCPTYPE_PARSERS_, node, objectStack); @@ -434,9 +434,9 @@ ol.format.WMSCapabilities.readDCPType_ = function(node, objectStack) { * @return {Object|undefined} HTTP object. */ ol.format.WMSCapabilities.readHTTP_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'HTTP', 'localName should be HTTP'); + goog.DEBUG && console.assert(node.localName == 'HTTP', 'localName should be HTTP'); return ol.xml.pushParseAndPop( {}, ol.format.WMSCapabilities.HTTP_PARSERS_, node, objectStack); }; @@ -449,7 +449,7 @@ ol.format.WMSCapabilities.readHTTP_ = function(node, objectStack) { * @return {Object|undefined} Operation type object. */ ol.format.WMSCapabilities.readOperationType_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); return ol.xml.pushParseAndPop( {}, ol.format.WMSCapabilities.OPERATIONTYPE_PARSERS_, node, objectStack); @@ -463,7 +463,7 @@ ol.format.WMSCapabilities.readOperationType_ = function(node, objectStack) { * @return {Object|undefined} Online resource object. */ ol.format.WMSCapabilities.readSizedFormatOnlineresource_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); var formatOnlineresource = ol.format.WMSCapabilities.readFormatOnlineresource_(node, objectStack); @@ -486,9 +486,9 @@ ol.format.WMSCapabilities.readSizedFormatOnlineresource_ = function(node, object * @return {Object|undefined} Authority URL object. */ ol.format.WMSCapabilities.readAuthorityURL_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'AuthorityURL', + goog.DEBUG && console.assert(node.localName == 'AuthorityURL', 'localName should be AuthorityURL'); var authorityObject = ol.format.WMSCapabilities.readFormatOnlineresource_(node, objectStack); @@ -507,9 +507,9 @@ ol.format.WMSCapabilities.readAuthorityURL_ = function(node, objectStack) { * @return {Object|undefined} Metadata URL object. */ ol.format.WMSCapabilities.readMetadataURL_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'MetadataURL', + goog.DEBUG && console.assert(node.localName == 'MetadataURL', 'localName should be MetadataURL'); var metadataObject = ol.format.WMSCapabilities.readFormatOnlineresource_(node, objectStack); @@ -528,9 +528,9 @@ ol.format.WMSCapabilities.readMetadataURL_ = function(node, objectStack) { * @return {Object|undefined} Style object. */ ol.format.WMSCapabilities.readStyle_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Style', 'localName should be Style'); + goog.DEBUG && console.assert(node.localName == 'Style', 'localName should be Style'); return ol.xml.pushParseAndPop( {}, ol.format.WMSCapabilities.STYLE_PARSERS_, node, objectStack); }; @@ -543,9 +543,9 @@ ol.format.WMSCapabilities.readStyle_ = function(node, objectStack) { * @return {Array.|undefined} Keyword list. */ ol.format.WMSCapabilities.readKeywordList_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'KeywordList', + goog.DEBUG && console.assert(node.localName == 'KeywordList', 'localName should be KeywordList'); return ol.xml.pushParseAndPop( [], ol.format.WMSCapabilities.KEYWORDLIST_PARSERS_, node, objectStack); diff --git a/src/ol/format/wmsgetfeatureinfoformat.js b/src/ol/format/wmsgetfeatureinfoformat.js index beeef2b35c..ef9bbe6359 100644 --- a/src/ol/format/wmsgetfeatureinfoformat.js +++ b/src/ol/format/wmsgetfeatureinfoformat.js @@ -71,7 +71,7 @@ ol.format.WMSGetFeatureInfo.layerIdentifier_ = '_layer'; ol.format.WMSGetFeatureInfo.prototype.readFeatures_ = function(node, objectStack) { node.setAttribute('namespaceURI', this.featureNS_); - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); var localName = node.localName; /** @type {Array.} */ @@ -87,7 +87,7 @@ ol.format.WMSGetFeatureInfo.prototype.readFeatures_ = function(node, objectStack } var context = objectStack[0]; - ol.DEBUG && console.assert(layer.localName.indexOf( + goog.DEBUG && console.assert(layer.localName.indexOf( ol.format.WMSGetFeatureInfo.layerIdentifier_) >= 0, 'localName of layer node should match layerIdentifier'); diff --git a/src/ol/format/wmtscapabilitiesformat.js b/src/ol/format/wmtscapabilitiesformat.js index e0565c1fc0..57faf143ba 100644 --- a/src/ol/format/wmtscapabilitiesformat.js +++ b/src/ol/format/wmtscapabilitiesformat.js @@ -44,7 +44,7 @@ ol.format.WMTSCapabilities.prototype.read; * @return {Object} WMTS Capability object. */ ol.format.WMTSCapabilities.prototype.readFromDocument = function(doc) { - ol.DEBUG && console.assert(doc.nodeType == Node.DOCUMENT_NODE, + goog.DEBUG && console.assert(doc.nodeType == Node.DOCUMENT_NODE, 'doc.nodeType should be DOCUMENT'); for (var n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == Node.ELEMENT_NODE) { @@ -60,9 +60,9 @@ ol.format.WMTSCapabilities.prototype.readFromDocument = function(doc) { * @return {Object} WMTS Capability object. */ ol.format.WMTSCapabilities.prototype.readFromNode = function(node) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Capabilities', + goog.DEBUG && console.assert(node.localName == 'Capabilities', 'localName should be Capabilities'); var version = node.getAttribute('version').trim(); var WMTSCapabilityObject = this.owsParser_.readFromNode(node); @@ -83,9 +83,9 @@ ol.format.WMTSCapabilities.prototype.readFromNode = function(node) { * @return {Object|undefined} Attribution object. */ ol.format.WMTSCapabilities.readContents_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Contents', + goog.DEBUG && console.assert(node.localName == 'Contents', 'localName should be Contents'); return ol.xml.pushParseAndPop({}, @@ -100,9 +100,9 @@ ol.format.WMTSCapabilities.readContents_ = function(node, objectStack) { * @return {Object|undefined} Layers object. */ ol.format.WMTSCapabilities.readLayer_ = function(node, objectStack) { - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); - ol.DEBUG && console.assert(node.localName == 'Layer', 'localName should be Layer'); + goog.DEBUG && console.assert(node.localName == 'Layer', 'localName should be Layer'); return ol.xml.pushParseAndPop({}, ol.format.WMTSCapabilities.LAYER_PARSERS_, node, objectStack); }; diff --git a/src/ol/format/xmlfeatureformat.js b/src/ol/format/xmlfeatureformat.js index 9d117913e3..c0a5cc32d0 100644 --- a/src/ol/format/xmlfeatureformat.js +++ b/src/ol/format/xmlfeatureformat.js @@ -208,7 +208,7 @@ ol.format.XMLFeature.prototype.readProjectionFromNode = function(node) { */ ol.format.XMLFeature.prototype.writeFeature = function(feature, opt_options) { var node = this.writeFeatureNode(feature, opt_options); - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); return this.xmlSerializer_.serializeToString(node); }; @@ -229,7 +229,7 @@ ol.format.XMLFeature.prototype.writeFeatureNode = function(feature, opt_options) */ ol.format.XMLFeature.prototype.writeFeatures = function(features, opt_options) { var node = this.writeFeaturesNode(features, opt_options); - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); return this.xmlSerializer_.serializeToString(node); }; @@ -249,7 +249,7 @@ ol.format.XMLFeature.prototype.writeFeaturesNode = function(features, opt_option */ ol.format.XMLFeature.prototype.writeGeometry = function(geometry, opt_options) { var node = this.writeGeometryNode(geometry, opt_options); - ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, + goog.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); return this.xmlSerializer_.serializeToString(node); }; diff --git a/src/ol/format/xsdformat.js b/src/ol/format/xsdformat.js index 32bff8a168..d56a28d219 100644 --- a/src/ol/format/xsdformat.js +++ b/src/ol/format/xsdformat.js @@ -145,8 +145,8 @@ ol.format.XSD.writeDecimalTextNode = function(node, decimal) { * @param {number} nonNegativeInteger Non negative integer. */ ol.format.XSD.writeNonNegativeIntegerTextNode = function(node, nonNegativeInteger) { - ol.DEBUG && console.assert(nonNegativeInteger >= 0, 'value should be more than 0'); - ol.DEBUG && console.assert(nonNegativeInteger == (nonNegativeInteger | 0), + goog.DEBUG && console.assert(nonNegativeInteger >= 0, 'value should be more than 0'); + goog.DEBUG && console.assert(nonNegativeInteger == (nonNegativeInteger | 0), 'value should be an integer value'); var string = nonNegativeInteger.toString(); node.appendChild(ol.xml.DOCUMENT.createTextNode(string)); diff --git a/src/ol/geom/circle.js b/src/ol/geom/circle.js index a0c1b1d4f0..1ccf620bea 100644 --- a/src/ol/geom/circle.js +++ b/src/ol/geom/circle.js @@ -162,7 +162,7 @@ ol.geom.Circle.prototype.intersectsExtent = function(extent) { */ ol.geom.Circle.prototype.setCenter = function(center) { var stride = this.stride; - ol.DEBUG && console.assert(center.length == stride, + goog.DEBUG && console.assert(center.length == stride, 'center array length should match stride'); var radius = this.flatCoordinates[stride] - this.flatCoordinates[0]; var flatCoordinates = center.slice(); @@ -222,7 +222,7 @@ ol.geom.Circle.prototype.setFlatCoordinates = function(layout, flatCoordinates) * @api */ ol.geom.Circle.prototype.setRadius = function(radius) { - ol.DEBUG && console.assert(this.flatCoordinates, + goog.DEBUG && console.assert(this.flatCoordinates, 'truthy this.flatCoordinates expected'); this.flatCoordinates[this.stride] = this.flatCoordinates[0] + radius; this.changed(); diff --git a/src/ol/geom/flat/closestflatgeom.js b/src/ol/geom/flat/closestflatgeom.js index 6686ad9a2f..1120d68f49 100644 --- a/src/ol/geom/flat/closestflatgeom.js +++ b/src/ol/geom/flat/closestflatgeom.js @@ -147,7 +147,7 @@ ol.geom.flat.closest.getClosestPoint = function(flatCoordinates, offset, end, return minSquaredDistance; } } - ol.DEBUG && console.assert(maxDelta > 0, 'maxDelta should be larger than 0'); + goog.DEBUG && console.assert(maxDelta > 0, 'maxDelta should be larger than 0'); var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN]; var index = offset + stride; while (index < end) { diff --git a/src/ol/geom/flat/containsflatgeom.js b/src/ol/geom/flat/containsflatgeom.js index 862594d16e..dc6290cec4 100644 --- a/src/ol/geom/flat/containsflatgeom.js +++ b/src/ol/geom/flat/containsflatgeom.js @@ -64,7 +64,7 @@ ol.geom.flat.contains.linearRingContainsXY = function(flatCoordinates, offset, e * @return {boolean} Contains (x, y). */ ol.geom.flat.contains.linearRingsContainsXY = function(flatCoordinates, offset, ends, stride, x, y) { - ol.DEBUG && console.assert(ends.length > 0, 'ends should not be an empty array'); + goog.DEBUG && console.assert(ends.length > 0, 'ends should not be an empty array'); if (ends.length === 0) { return false; } @@ -93,7 +93,7 @@ ol.geom.flat.contains.linearRingsContainsXY = function(flatCoordinates, offset, * @return {boolean} Contains (x, y). */ ol.geom.flat.contains.linearRingssContainsXY = function(flatCoordinates, offset, endss, stride, x, y) { - ol.DEBUG && console.assert(endss.length > 0, 'endss should not be an empty array'); + goog.DEBUG && console.assert(endss.length > 0, 'endss should not be an empty array'); if (endss.length === 0) { return false; } diff --git a/src/ol/geom/flat/deflateflatgeom.js b/src/ol/geom/flat/deflateflatgeom.js index bb59f67e5e..d8858ddcee 100644 --- a/src/ol/geom/flat/deflateflatgeom.js +++ b/src/ol/geom/flat/deflateflatgeom.js @@ -9,7 +9,7 @@ goog.provide('ol.geom.flat.deflate'); * @return {number} offset Offset. */ ol.geom.flat.deflate.coordinate = function(flatCoordinates, offset, coordinate, stride) { - ol.DEBUG && console.assert(coordinate.length == stride, + goog.DEBUG && console.assert(coordinate.length == stride, 'length of the coordinate array should match stride'); var i, ii; for (i = 0, ii = coordinate.length; i < ii; ++i) { @@ -30,7 +30,7 @@ ol.geom.flat.deflate.coordinates = function(flatCoordinates, offset, coordinates var i, ii; for (i = 0, ii = coordinates.length; i < ii; ++i) { var coordinate = coordinates[i]; - ol.DEBUG && console.assert(coordinate.length == stride, + goog.DEBUG && console.assert(coordinate.length == stride, 'length of coordinate array should match stride'); var j; for (j = 0; j < stride; ++j) { diff --git a/src/ol/geom/flat/flipflatgeom.js b/src/ol/geom/flat/flipflatgeom.js index d65884428a..4391f22bcc 100644 --- a/src/ol/geom/flat/flipflatgeom.js +++ b/src/ol/geom/flat/flipflatgeom.js @@ -16,7 +16,7 @@ ol.geom.flat.flip.flipXY = function(flatCoordinates, offset, end, stride, opt_de dest = opt_dest; destOffset = opt_destOffset !== undefined ? opt_destOffset : 0; } else { - ol.DEBUG && console.assert(opt_destOffset === undefined, + goog.DEBUG && console.assert(opt_destOffset === undefined, 'opt_destOffSet should be defined'); dest = []; destOffset = 0; diff --git a/src/ol/geom/flat/geodesicflatgeom.js b/src/ol/geom/flat/geodesicflatgeom.js index e91595161e..9c3c348f13 100644 --- a/src/ol/geom/flat/geodesicflatgeom.js +++ b/src/ol/geom/flat/geodesicflatgeom.js @@ -64,7 +64,7 @@ ol.geom.flat.geodesic.line_ = function(interpolate, transform, squaredTolerance) // segment. flatCoordinates.push(b[0], b[1]); key = fracB.toString(); - ol.DEBUG && console.assert(!(key in fractions), + goog.DEBUG && console.assert(!(key in fractions), 'fractions object should contain key : ' + key); fractions[key] = true; } else { @@ -75,7 +75,7 @@ ol.geom.flat.geodesic.line_ = function(interpolate, transform, squaredTolerance) geoStack.push(geoB, geoM, geoM, geoA); } } - ol.DEBUG && console.assert(maxIterations > 0, + goog.DEBUG && console.assert(maxIterations > 0, 'maxIterations should be more than 0'); return flatCoordinates; diff --git a/src/ol/geom/flat/interiorpointflatgeom.js b/src/ol/geom/flat/interiorpointflatgeom.js index d224814db8..8b3f6caa92 100644 --- a/src/ol/geom/flat/interiorpointflatgeom.js +++ b/src/ol/geom/flat/interiorpointflatgeom.js @@ -78,7 +78,7 @@ ol.geom.flat.interiorpoint.linearRings = function(flatCoordinates, offset, * @return {Array.} Interior points. */ ol.geom.flat.interiorpoint.linearRingss = function(flatCoordinates, offset, endss, stride, flatCenters) { - ol.DEBUG && console.assert(2 * endss.length == flatCenters.length, + goog.DEBUG && console.assert(2 * endss.length == flatCenters.length, 'endss.length times 2 should be flatCenters.length'); var interiorPoints = []; var i, ii; diff --git a/src/ol/geom/flat/interpolateflatgeom.js b/src/ol/geom/flat/interpolateflatgeom.js index a802949024..3d341bcf29 100644 --- a/src/ol/geom/flat/interpolateflatgeom.js +++ b/src/ol/geom/flat/interpolateflatgeom.js @@ -16,13 +16,13 @@ goog.require('ol.math'); ol.geom.flat.interpolate.lineString = function(flatCoordinates, offset, end, stride, fraction, opt_dest) { // FIXME does not work when vertices are repeated // FIXME interpolate extra dimensions - ol.DEBUG && console.assert(0 <= fraction && fraction <= 1, + goog.DEBUG && console.assert(0 <= fraction && fraction <= 1, 'fraction should be in between 0 and 1'); var pointX = NaN; var pointY = NaN; var n = (end - offset) / stride; if (n === 0) { - ol.DEBUG && console.assert(false, 'n cannot be 0'); + goog.DEBUG && console.assert(false, 'n cannot be 0'); } else if (n == 1) { pointX = flatCoordinates[offset]; pointY = flatCoordinates[offset + 1]; @@ -120,8 +120,8 @@ ol.geom.flat.lineStringCoordinateAtM = function(flatCoordinates, offset, end, st return flatCoordinates.slice((lo - 1) * stride, (lo - 1) * stride + stride); } var m1 = flatCoordinates[(lo + 1) * stride - 1]; - ol.DEBUG && console.assert(m0 < m, 'm0 should be less than m'); - ol.DEBUG && console.assert(m <= m1, 'm should be less than or equal to m1'); + goog.DEBUG && console.assert(m0 < m, 'm0 should be less than m'); + goog.DEBUG && console.assert(m <= m1, 'm should be less than or equal to m1'); var t = (m - m0) / (m1 - m0); coordinate = []; var i; @@ -130,7 +130,7 @@ ol.geom.flat.lineStringCoordinateAtM = function(flatCoordinates, offset, end, st flatCoordinates[lo * stride + i], t)); } coordinate.push(m); - ol.DEBUG && console.assert(coordinate.length == stride, + goog.DEBUG && console.assert(coordinate.length == stride, 'length of coordinate array should match stride'); return coordinate; }; @@ -185,7 +185,7 @@ ol.geom.flat.lineStringsCoordinateAtM = function( } offset = end; } - ol.DEBUG && console.assert(false, + goog.DEBUG && console.assert(false, 'ol.geom.flat.lineStringsCoordinateAtM should have returned'); return null; }; diff --git a/src/ol/geom/flat/intersectsextent.js b/src/ol/geom/flat/intersectsextent.js index 03381628f9..3d5c3efd01 100644 --- a/src/ol/geom/flat/intersectsextent.js +++ b/src/ol/geom/flat/intersectsextent.js @@ -106,7 +106,7 @@ ol.geom.flat.intersectsextent.linearRing = function(flatCoordinates, offset, end * @return {boolean} True if the geometry and the extent intersect. */ ol.geom.flat.intersectsextent.linearRings = function(flatCoordinates, offset, ends, stride, extent) { - ol.DEBUG && console.assert(ends.length > 0, 'ends should not be an empty array'); + goog.DEBUG && console.assert(ends.length > 0, 'ends should not be an empty array'); if (!ol.geom.flat.intersectsextent.linearRing( flatCoordinates, offset, ends[0], stride, extent)) { return false; @@ -134,7 +134,7 @@ ol.geom.flat.intersectsextent.linearRings = function(flatCoordinates, offset, en * @return {boolean} True if the geometry and the extent intersect. */ ol.geom.flat.intersectsextent.linearRingss = function(flatCoordinates, offset, endss, stride, extent) { - ol.DEBUG && console.assert(endss.length > 0, 'endss should not be an empty array'); + goog.DEBUG && console.assert(endss.length > 0, 'endss should not be an empty array'); var i, ii; for (i = 0, ii = endss.length; i < ii; ++i) { var ends = endss[i]; diff --git a/src/ol/geom/geometry.js b/src/ol/geom/geometry.js index f8466291da..8cf79a9a34 100644 --- a/src/ol/geom/geometry.js +++ b/src/ol/geom/geometry.js @@ -261,7 +261,7 @@ ol.geom.Geometry.prototype.translate = function(deltaX, deltaY) {}; * @api stable */ ol.geom.Geometry.prototype.transform = function(source, destination) { - ol.DEBUG && console.assert( + goog.DEBUG && console.assert( ol.proj.get(source).getUnits() !== ol.proj.Units.TILE_PIXELS && ol.proj.get(destination).getUnits() !== ol.proj.Units.TILE_PIXELS, 'cannot transform geometries with TILE_PIXELS units'); diff --git a/src/ol/geom/linestring.js b/src/ol/geom/linestring.js index 988b6e2db2..b86e4158af 100644 --- a/src/ol/geom/linestring.js +++ b/src/ol/geom/linestring.js @@ -66,7 +66,7 @@ ol.inherits(ol.geom.LineString, ol.geom.SimpleGeometry); * @api stable */ ol.geom.LineString.prototype.appendCoordinate = function(coordinate) { - ol.DEBUG && console.assert(coordinate.length == this.stride, + goog.DEBUG && console.assert(coordinate.length == this.stride, 'length of coordinate array should match stride'); if (!this.flatCoordinates) { this.flatCoordinates = coordinate.slice(); diff --git a/src/ol/geom/multilinestring.js b/src/ol/geom/multilinestring.js index 28e976379b..615d9e9bd6 100644 --- a/src/ol/geom/multilinestring.js +++ b/src/ol/geom/multilinestring.js @@ -59,7 +59,7 @@ ol.inherits(ol.geom.MultiLineString, ol.geom.SimpleGeometry); * @api stable */ ol.geom.MultiLineString.prototype.appendLineString = function(lineString) { - ol.DEBUG && console.assert(lineString.getLayout() == this.layout, + goog.DEBUG && console.assert(lineString.getLayout() == this.layout, 'layout of lineString should match the layout'); if (!this.flatCoordinates) { this.flatCoordinates = lineString.getFlatCoordinates().slice(); @@ -165,7 +165,7 @@ ol.geom.MultiLineString.prototype.getEnds = function() { * @api stable */ ol.geom.MultiLineString.prototype.getLineString = function(index) { - ol.DEBUG && console.assert(0 <= index && index < this.ends_.length, + goog.DEBUG && console.assert(0 <= index && index < this.ends_.length, 'index should be in between 0 and length of the this.ends_ array'); if (index < 0 || this.ends_.length <= index) { return null; @@ -286,13 +286,13 @@ ol.geom.MultiLineString.prototype.setCoordinates = function(coordinates, opt_lay */ ol.geom.MultiLineString.prototype.setFlatCoordinates = function(layout, flatCoordinates, ends) { if (!flatCoordinates) { - ol.DEBUG && console.assert(ends && ends.length === 0, + goog.DEBUG && console.assert(ends && ends.length === 0, 'ends must be truthy and ends.length should be 0'); } else if (ends.length === 0) { - ol.DEBUG && console.assert(flatCoordinates.length === 0, + goog.DEBUG && console.assert(flatCoordinates.length === 0, 'flatCoordinates should be an empty array'); } else { - ol.DEBUG && console.assert(flatCoordinates.length == ends[ends.length - 1], + goog.DEBUG && console.assert(flatCoordinates.length == ends[ends.length - 1], 'length of flatCoordinates array should match the last value of ends'); } this.setFlatCoordinatesInternal(layout, flatCoordinates); @@ -315,7 +315,7 @@ ol.geom.MultiLineString.prototype.setLineStrings = function(lineStrings) { layout = lineString.getLayout(); } else { // FIXME better handle the case of non-matching layouts - ol.DEBUG && console.assert(lineString.getLayout() == layout, + goog.DEBUG && console.assert(lineString.getLayout() == layout, 'layout of lineString should match layout'); } ol.array.extend(flatCoordinates, lineString.getFlatCoordinates()); diff --git a/src/ol/geom/multipoint.js b/src/ol/geom/multipoint.js index 1f3a633026..ee9f279f60 100644 --- a/src/ol/geom/multipoint.js +++ b/src/ol/geom/multipoint.js @@ -34,7 +34,7 @@ ol.inherits(ol.geom.MultiPoint, ol.geom.SimpleGeometry); * @api stable */ ol.geom.MultiPoint.prototype.appendPoint = function(point) { - ol.DEBUG && console.assert(point.getLayout() == this.layout, + goog.DEBUG && console.assert(point.getLayout() == this.layout, 'the layout of point should match layout'); if (!this.flatCoordinates) { this.flatCoordinates = point.getFlatCoordinates().slice(); @@ -103,7 +103,7 @@ ol.geom.MultiPoint.prototype.getCoordinates = function() { ol.geom.MultiPoint.prototype.getPoint = function(index) { var n = !this.flatCoordinates ? 0 : this.flatCoordinates.length / this.stride; - ol.DEBUG && console.assert(0 <= index && index < n, + goog.DEBUG && console.assert(0 <= index && index < n, 'index should be in between 0 and n'); if (index < 0 || n <= index) { return null; diff --git a/src/ol/geom/multipolygon.js b/src/ol/geom/multipolygon.js index 3e69ca3157..46f550fc01 100644 --- a/src/ol/geom/multipolygon.js +++ b/src/ol/geom/multipolygon.js @@ -88,7 +88,7 @@ ol.inherits(ol.geom.MultiPolygon, ol.geom.SimpleGeometry); * @api stable */ ol.geom.MultiPolygon.prototype.appendPolygon = function(polygon) { - ol.DEBUG && console.assert(polygon.getLayout() == this.layout, + goog.DEBUG && console.assert(polygon.getLayout() == this.layout, 'layout of polygon should match layout'); /** @type {Array.} */ var ends; @@ -279,7 +279,7 @@ ol.geom.MultiPolygon.prototype.getSimplifiedGeometryInternal = function(squaredT * @api stable */ ol.geom.MultiPolygon.prototype.getPolygon = function(index) { - ol.DEBUG && console.assert(0 <= index && index < this.endss_.length, + goog.DEBUG && console.assert(0 <= index && index < this.endss_.length, 'index should be in between 0 and the length of this.endss_'); if (index < 0 || this.endss_.length <= index) { return null; @@ -389,13 +389,13 @@ ol.geom.MultiPolygon.prototype.setCoordinates = function(coordinates, opt_layout * @param {Array.>} endss Endss. */ ol.geom.MultiPolygon.prototype.setFlatCoordinates = function(layout, flatCoordinates, endss) { - ol.DEBUG && console.assert(endss, 'endss must be truthy'); + goog.DEBUG && console.assert(endss, 'endss must be truthy'); if (!flatCoordinates || flatCoordinates.length === 0) { - ol.DEBUG && console.assert(endss.length === 0, 'the length of endss should be 0'); + goog.DEBUG && console.assert(endss.length === 0, 'the length of endss should be 0'); } else { - ol.DEBUG && console.assert(endss.length > 0, 'endss cannot be an empty array'); + goog.DEBUG && console.assert(endss.length > 0, 'endss cannot be an empty array'); var ends = endss[endss.length - 1]; - ol.DEBUG && console.assert(flatCoordinates.length == ends[ends.length - 1], + goog.DEBUG && console.assert(flatCoordinates.length == ends[ends.length - 1], 'the length of flatCoordinates should be the last value of ends'); } this.setFlatCoordinatesInternal(layout, flatCoordinates); @@ -418,7 +418,7 @@ ol.geom.MultiPolygon.prototype.setPolygons = function(polygons) { layout = polygon.getLayout(); } else { // FIXME better handle the case of non-matching layouts - ol.DEBUG && console.assert(polygon.getLayout() == layout, + goog.DEBUG && console.assert(polygon.getLayout() == layout, 'layout of polygon should be layout'); } var offset = flatCoordinates.length; diff --git a/src/ol/geom/polygon.js b/src/ol/geom/polygon.js index 4024561538..0bb336d276 100644 --- a/src/ol/geom/polygon.js +++ b/src/ol/geom/polygon.js @@ -88,7 +88,7 @@ ol.inherits(ol.geom.Polygon, ol.geom.SimpleGeometry); * @api stable */ ol.geom.Polygon.prototype.appendLinearRing = function(linearRing) { - ol.DEBUG && console.assert(linearRing.getLayout() == this.layout, + goog.DEBUG && console.assert(linearRing.getLayout() == this.layout, 'layout of linearRing should match layout'); if (!this.flatCoordinates) { this.flatCoordinates = linearRing.getFlatCoordinates().slice(); @@ -236,7 +236,7 @@ ol.geom.Polygon.prototype.getLinearRingCount = function() { * @api stable */ ol.geom.Polygon.prototype.getLinearRing = function(index) { - ol.DEBUG && console.assert(0 <= index && index < this.ends_.length, + goog.DEBUG && console.assert(0 <= index && index < this.ends_.length, 'index should be in between 0 and and length of this.ends_'); if (index < 0 || this.ends_.length <= index) { return null; @@ -357,13 +357,13 @@ ol.geom.Polygon.prototype.setCoordinates = function(coordinates, opt_layout) { */ ol.geom.Polygon.prototype.setFlatCoordinates = function(layout, flatCoordinates, ends) { if (!flatCoordinates) { - ol.DEBUG && console.assert(ends && ends.length === 0, + goog.DEBUG && console.assert(ends && ends.length === 0, 'ends must be an empty array'); } else if (ends.length === 0) { - ol.DEBUG && console.assert(flatCoordinates.length === 0, + goog.DEBUG && console.assert(flatCoordinates.length === 0, 'flatCoordinates should be an empty array'); } else { - ol.DEBUG && console.assert(flatCoordinates.length == ends[ends.length - 1], + goog.DEBUG && console.assert(flatCoordinates.length == ends[ends.length - 1], 'the length of flatCoordinates should be the last entry of ends'); } this.setFlatCoordinatesInternal(layout, flatCoordinates); @@ -460,7 +460,7 @@ ol.geom.Polygon.makeRegular = function(polygon, center, radius, opt_angle) { var layout = polygon.getLayout(); var stride = polygon.getStride(); var ends = polygon.getEnds(); - ol.DEBUG && console.assert(ends.length === 1, 'only 1 ring is supported'); + goog.DEBUG && console.assert(ends.length === 1, 'only 1 ring is supported'); var sides = flatCoordinates.length / stride - 1; var startAngle = opt_angle ? opt_angle : 0; var angle, offset; diff --git a/src/ol/geom/simplegeometry.js b/src/ol/geom/simplegeometry.js index 8ca829fb03..3eec6eabe0 100644 --- a/src/ol/geom/simplegeometry.js +++ b/src/ol/geom/simplegeometry.js @@ -57,7 +57,7 @@ ol.geom.SimpleGeometry.getLayoutForStride_ = function(stride) { } else if (stride == 4) { layout = ol.geom.GeometryLayout.XYZM; } - ol.DEBUG && console.assert(layout, 'unsupported stride: ' + stride); + goog.DEBUG && console.assert(layout, 'unsupported stride: ' + stride); return /** @type {ol.geom.GeometryLayout} */ (layout); }; @@ -75,7 +75,7 @@ ol.geom.SimpleGeometry.getStrideForLayout = function(layout) { } else if (layout == ol.geom.GeometryLayout.XYZM) { stride = 4; } - ol.DEBUG && console.assert(stride, 'unsupported layout: ' + layout); + goog.DEBUG && console.assert(stride, 'unsupported layout: ' + layout); return /** @type {number} */ (stride); }; diff --git a/src/ol/graticule.js b/src/ol/graticule.js index 6571448438..dc174f5631 100644 --- a/src/ol/graticule.js +++ b/src/ol/graticule.js @@ -92,7 +92,7 @@ ol.Graticule = function(opt_options) { * @private */ this.maxLines_ = options.maxLines !== undefined ? options.maxLines : 100; - ol.DEBUG && console.assert(this.maxLines_ > 0, + goog.DEBUG && console.assert(this.maxLines_ > 0, 'this.maxLines_ should be more than 0'); /** @@ -333,13 +333,13 @@ ol.Graticule.prototype.getMap = function() { */ ol.Graticule.prototype.getMeridian_ = function(lon, minLat, maxLat, squaredTolerance, index) { - ol.DEBUG && console.assert(lon >= this.minLon_, + goog.DEBUG && console.assert(lon >= this.minLon_, 'lon should be larger than or equal to this.minLon_'); - ol.DEBUG && console.assert(lon <= this.maxLon_, + goog.DEBUG && console.assert(lon <= this.maxLon_, 'lon should be smaller than or equal to this.maxLon_'); var flatCoordinates = ol.geom.flat.geodesic.meridian(lon, minLat, maxLat, this.projection_, squaredTolerance); - ol.DEBUG && console.assert(flatCoordinates.length > 0, + goog.DEBUG && console.assert(flatCoordinates.length > 0, 'flatCoordinates cannot be empty'); var lineString = this.meridians_[index] !== undefined ? this.meridians_[index] : new ol.geom.LineString(null); @@ -369,13 +369,13 @@ ol.Graticule.prototype.getMeridians = function() { */ ol.Graticule.prototype.getParallel_ = function(lat, minLon, maxLon, squaredTolerance, index) { - ol.DEBUG && console.assert(lat >= this.minLat_, + goog.DEBUG && console.assert(lat >= this.minLat_, 'lat should be larger than or equal to this.minLat_'); - ol.DEBUG && console.assert(lat <= this.maxLat_, + goog.DEBUG && console.assert(lat <= this.maxLat_, 'lat should be smaller than or equal to this.maxLat_'); var flatCoordinates = ol.geom.flat.geodesic.parallel(lat, this.minLon_, this.maxLon_, this.projection_, squaredTolerance); - ol.DEBUG && console.assert(flatCoordinates.length > 0, + goog.DEBUG && console.assert(flatCoordinates.length > 0, 'flatCoordinates cannot be empty'); var lineString = this.parallels_[index] !== undefined ? this.parallels_[index] : new ol.geom.LineString(null); @@ -455,7 +455,7 @@ ol.Graticule.prototype.handlePostCompose_ = function(e) { * @private */ ol.Graticule.prototype.updateProjectionInfo_ = function(projection) { - ol.DEBUG && console.assert(projection, 'projection cannot be null'); + goog.DEBUG && console.assert(projection, 'projection cannot be null'); var epsg4326Projection = ol.proj.get('EPSG:4326'); @@ -474,19 +474,19 @@ ol.Graticule.prototype.updateProjectionInfo_ = function(projection) { var minLatP = worldExtentP[1]; var minLonP = worldExtentP[0]; - ol.DEBUG && console.assert(extent, 'extent cannot be null'); - ol.DEBUG && console.assert(maxLat !== undefined, 'maxLat should be defined'); - ol.DEBUG && console.assert(maxLon !== undefined, 'maxLon should be defined'); - ol.DEBUG && console.assert(minLat !== undefined, 'minLat should be defined'); - ol.DEBUG && console.assert(minLon !== undefined, 'minLon should be defined'); + goog.DEBUG && console.assert(extent, 'extent cannot be null'); + goog.DEBUG && console.assert(maxLat !== undefined, 'maxLat should be defined'); + goog.DEBUG && console.assert(maxLon !== undefined, 'maxLon should be defined'); + goog.DEBUG && console.assert(minLat !== undefined, 'minLat should be defined'); + goog.DEBUG && console.assert(minLon !== undefined, 'minLon should be defined'); - ol.DEBUG && console.assert(maxLatP !== undefined, + goog.DEBUG && console.assert(maxLatP !== undefined, 'projected maxLat should be defined'); - ol.DEBUG && console.assert(maxLonP !== undefined, + goog.DEBUG && console.assert(maxLonP !== undefined, 'projected maxLon should be defined'); - ol.DEBUG && console.assert(minLatP !== undefined, + goog.DEBUG && console.assert(minLatP !== undefined, 'projected minLat should be defined'); - ol.DEBUG && console.assert(minLonP !== undefined, + goog.DEBUG && console.assert(minLonP !== undefined, 'projected minLon should be defined'); this.maxLat_ = maxLat; diff --git a/src/ol/image.js b/src/ol/image.js index 17a9ce9b1e..396960f451 100644 --- a/src/ol/image.js +++ b/src/ol/image.js @@ -130,7 +130,7 @@ ol.Image.prototype.load = function() { if (this.state == ol.ImageState.IDLE || this.state == ol.ImageState.ERROR) { this.state = ol.ImageState.LOADING; this.changed(); - ol.DEBUG && console.assert(!this.imageListenerKeys_, + goog.DEBUG && console.assert(!this.imageListenerKeys_, 'this.imageListenerKeys_ should be null'); this.imageListenerKeys_ = [ ol.events.listenOnce(this.image_, ol.events.EventType.ERROR, @@ -157,7 +157,7 @@ ol.Image.prototype.setImage = function(image) { * @private */ ol.Image.prototype.unlistenImage_ = function() { - ol.DEBUG && console.assert(this.imageListenerKeys_, + goog.DEBUG && console.assert(this.imageListenerKeys_, 'this.imageListenerKeys_ should not be null'); this.imageListenerKeys_.forEach(ol.events.unlistenByKey); this.imageListenerKeys_ = null; diff --git a/src/ol/imagebase.js b/src/ol/imagebase.js index b2d4f8d848..c8103f19e2 100644 --- a/src/ol/imagebase.js +++ b/src/ol/imagebase.js @@ -108,7 +108,7 @@ ol.ImageBase.prototype.getPixelRatio = function() { * @return {number} Resolution. */ ol.ImageBase.prototype.getResolution = function() { - ol.DEBUG && console.assert(this.resolution !== undefined, 'resolution not yet set'); + goog.DEBUG && console.assert(this.resolution !== undefined, 'resolution not yet set'); return /** @type {number} */ (this.resolution); }; diff --git a/src/ol/imagecanvas.js b/src/ol/imagecanvas.js index b442ba3693..453c5e6cba 100644 --- a/src/ol/imagecanvas.js +++ b/src/ol/imagecanvas.js @@ -76,7 +76,7 @@ ol.ImageCanvas.prototype.handleLoad_ = function(err) { */ ol.ImageCanvas.prototype.load = function() { if (this.state == ol.ImageState.IDLE) { - ol.DEBUG && console.assert(this.loader_, 'this.loader_ must be set'); + goog.DEBUG && console.assert(this.loader_, 'this.loader_ must be set'); this.state = ol.ImageState.LOADING; this.changed(); this.loader_(this.handleLoad_.bind(this)); diff --git a/src/ol/imagetile.js b/src/ol/imagetile.js index 4a6b9ee7ca..ddb84fe3e6 100644 --- a/src/ol/imagetile.js +++ b/src/ol/imagetile.js @@ -145,7 +145,7 @@ ol.ImageTile.prototype.load = function() { if (this.state == ol.TileState.IDLE || this.state == ol.TileState.ERROR) { this.state = ol.TileState.LOADING; this.changed(); - ol.DEBUG && console.assert(!this.imageListenerKeys_, + goog.DEBUG && console.assert(!this.imageListenerKeys_, 'this.imageListenerKeys_ should be null'); this.imageListenerKeys_ = [ ol.events.listenOnce(this.image_, ol.events.EventType.ERROR, @@ -164,7 +164,7 @@ ol.ImageTile.prototype.load = function() { * @private */ ol.ImageTile.prototype.unlistenImage_ = function() { - ol.DEBUG && console.assert(this.imageListenerKeys_, + goog.DEBUG && console.assert(this.imageListenerKeys_, 'this.imageListenerKeys_ should not be null'); this.imageListenerKeys_.forEach(ol.events.unlistenByKey); this.imageListenerKeys_ = null; diff --git a/src/ol/interaction/doubleclickzoominteraction.js b/src/ol/interaction/doubleclickzoominteraction.js index 98f0198743..bb47f5b448 100644 --- a/src/ol/interaction/doubleclickzoominteraction.js +++ b/src/ol/interaction/doubleclickzoominteraction.js @@ -54,7 +54,7 @@ ol.interaction.DoubleClickZoom.handleEvent = function(mapBrowserEvent) { var anchor = mapBrowserEvent.coordinate; var delta = browserEvent.shiftKey ? -this.delta_ : this.delta_; var view = map.getView(); - ol.DEBUG && console.assert(view, 'map must have a view'); + goog.DEBUG && console.assert(view, 'map must have a view'); ol.interaction.Interaction.zoomByDelta( map, view, delta, anchor, this.duration_); mapBrowserEvent.preventDefault(); diff --git a/src/ol/interaction/draganddropinteraction.js b/src/ol/interaction/draganddropinteraction.js index 30171d931a..def3cfefd1 100644 --- a/src/ol/interaction/draganddropinteraction.js +++ b/src/ol/interaction/draganddropinteraction.js @@ -96,13 +96,13 @@ ol.interaction.DragAndDrop.handleStop_ = function(event) { ol.interaction.DragAndDrop.prototype.handleResult_ = function(file, event) { var result = event.target.result; var map = this.getMap(); - ol.DEBUG && console.assert(map, 'map must be set'); + goog.DEBUG && console.assert(map, 'map must be set'); var projection = this.projection_; if (!projection) { var view = map.getView(); - ol.DEBUG && console.assert(view, 'map must have view'); + goog.DEBUG && console.assert(view, 'map must have view'); projection = view.getProjection(); - ol.DEBUG && console.assert(projection !== undefined, + goog.DEBUG && console.assert(projection !== undefined, 'projection should be defined'); } var formatConstructors = this.formatConstructors_; diff --git a/src/ol/interaction/dragpaninteraction.js b/src/ol/interaction/dragpaninteraction.js index b1c1a44075..a6454c1cf4 100644 --- a/src/ol/interaction/dragpaninteraction.js +++ b/src/ol/interaction/dragpaninteraction.js @@ -68,7 +68,7 @@ ol.inherits(ol.interaction.DragPan, ol.interaction.Pointer); * @private */ ol.interaction.DragPan.handleDragEvent_ = function(mapBrowserEvent) { - ol.DEBUG && console.assert(this.targetPointers.length >= 1, + goog.DEBUG && console.assert(this.targetPointers.length >= 1, 'the length of this.targetPointers should be more than 1'); var centroid = ol.interaction.Pointer.centroid(this.targetPointers); diff --git a/src/ol/interaction/drawinteraction.js b/src/ol/interaction/drawinteraction.js index 3337a74320..95a2097303 100644 --- a/src/ol/interaction/drawinteraction.js +++ b/src/ol/interaction/drawinteraction.js @@ -515,7 +515,7 @@ ol.interaction.Draw.prototype.startDrawing_ = function(event) { new ol.geom.LineString(this.sketchLineCoords_)); } var geometry = this.geometryFunction_(this.sketchCoords_); - ol.DEBUG && console.assert(geometry !== undefined, 'geometry should be defined'); + goog.DEBUG && console.assert(geometry !== undefined, 'geometry should be defined'); this.sketchFeature_ = new ol.Feature(); if (this.geometryName_) { this.sketchFeature_.setGeometryName(this.geometryName_); @@ -551,7 +551,7 @@ ol.interaction.Draw.prototype.modifyDrawing_ = function(event) { } last[0] = coordinate[0]; last[1] = coordinate[1]; - ol.DEBUG && console.assert(this.sketchCoords_, 'sketchCoords_ expected'); + goog.DEBUG && console.assert(this.sketchCoords_, 'sketchCoords_ expected'); this.geometryFunction_( /** @type {!ol.Coordinate|!Array.|!Array.>} */ (this.sketchCoords_), geometry); @@ -644,7 +644,7 @@ ol.interaction.Draw.prototype.removeLastPoint = function() { */ ol.interaction.Draw.prototype.finishDrawing = function() { var sketchFeature = this.abortDrawing_(); - ol.DEBUG && console.assert(sketchFeature, 'sketchFeature expected to be truthy'); + goog.DEBUG && console.assert(sketchFeature, 'sketchFeature expected to be truthy'); var coordinates = this.sketchCoords_; var geometry = /** @type {ol.geom.SimpleGeometry} */ (sketchFeature.getGeometry()); if (this.mode_ === ol.interaction.DrawMode.LINE_STRING) { @@ -710,10 +710,10 @@ ol.interaction.Draw.prototype.abortDrawing_ = function() { */ ol.interaction.Draw.prototype.extend = function(feature) { var geometry = feature.getGeometry(); - ol.DEBUG && console.assert(this.mode_ == ol.interaction.DrawMode.LINE_STRING, + goog.DEBUG && console.assert(this.mode_ == ol.interaction.DrawMode.LINE_STRING, 'interaction mode must be "line"'); - ol.DEBUG && console.assert(geometry, 'feature must have a geometry'); - ol.DEBUG && console.assert(geometry.getType() == ol.geom.GeometryType.LINE_STRING, + goog.DEBUG && console.assert(geometry, 'feature must have a geometry'); + goog.DEBUG && console.assert(geometry.getType() == ol.geom.GeometryType.LINE_STRING, 'feature geometry must be a line string'); var lineString = /** @type {ol.geom.LineString} */ (geometry); this.sketchFeature_ = feature; diff --git a/src/ol/interaction/keyboardpaninteraction.js b/src/ol/interaction/keyboardpaninteraction.js index 0ea4b2454a..48aea0a30c 100644 --- a/src/ol/interaction/keyboardpaninteraction.js +++ b/src/ol/interaction/keyboardpaninteraction.js @@ -87,7 +87,7 @@ ol.interaction.KeyboardPan.handleEvent = function(mapBrowserEvent) { keyCode == ol.events.KeyCode.UP)) { var map = mapBrowserEvent.map; var view = map.getView(); - ol.DEBUG && console.assert(view, 'map must have view'); + goog.DEBUG && console.assert(view, 'map must have view'); var mapUnitsDelta = view.getResolution() * this.pixelDelta_; var deltaX = 0, deltaY = 0; if (keyCode == ol.events.KeyCode.DOWN) { diff --git a/src/ol/interaction/keyboardzoominteraction.js b/src/ol/interaction/keyboardzoominteraction.js index 1ab6b2cd95..a543d6947b 100644 --- a/src/ol/interaction/keyboardzoominteraction.js +++ b/src/ol/interaction/keyboardzoominteraction.js @@ -74,7 +74,7 @@ ol.interaction.KeyboardZoom.handleEvent = function(mapBrowserEvent) { var delta = (charCode == '+'.charCodeAt(0)) ? this.delta_ : -this.delta_; map.render(); var view = map.getView(); - ol.DEBUG && console.assert(view, 'map must have view'); + goog.DEBUG && console.assert(view, 'map must have view'); ol.interaction.Interaction.zoomByDelta( map, view, delta, undefined, this.duration_); mapBrowserEvent.preventDefault(); diff --git a/src/ol/interaction/modifyinteraction.js b/src/ol/interaction/modifyinteraction.js index b507749a84..7ed29c5aa7 100644 --- a/src/ol/interaction/modifyinteraction.js +++ b/src/ol/interaction/modifyinteraction.js @@ -841,7 +841,7 @@ ol.interaction.Modify.prototype.insertVertex_ = function(segmentData, vertex) { this.setGeometryCoordinates_(geometry, coordinates); var rTree = this.rBush_; - ol.DEBUG && console.assert(segment !== undefined, 'segment should be defined'); + goog.DEBUG && console.assert(segment !== undefined, 'segment should be defined'); rTree.remove(segmentData); this.updateSegmentIndices_(geometry, index, depth, 1); var newSegmentData = /** @type {ol.ModifySegmentDataType} */ ({ @@ -982,7 +982,7 @@ ol.interaction.Modify.prototype.removeVertex_ = function() { segments.push(right.segment[1]); } if (left !== undefined && right !== undefined) { - ol.DEBUG && console.assert(newIndex >= 0, 'newIndex should be larger than 0'); + goog.DEBUG && console.assert(newIndex >= 0, 'newIndex should be larger than 0'); var newSegmentData = /** @type {ol.ModifySegmentDataType} */ ({ depth: segmentData.depth, diff --git a/src/ol/interaction/mousewheelzoominteraction.js b/src/ol/interaction/mousewheelzoominteraction.js index 32359b8170..f125a8fa13 100644 --- a/src/ol/interaction/mousewheelzoominteraction.js +++ b/src/ol/interaction/mousewheelzoominteraction.js @@ -131,7 +131,7 @@ ol.interaction.MouseWheelZoom.prototype.doZoom_ = function(map) { var delta = ol.math.clamp(this.delta_, -maxDelta, maxDelta); var view = map.getView(); - ol.DEBUG && console.assert(view, 'map must have view'); + goog.DEBUG && console.assert(view, 'map must have view'); map.render(); ol.interaction.Interaction.zoomByDelta(map, view, -delta, this.lastAnchor_, diff --git a/src/ol/interaction/pinchrotateinteraction.js b/src/ol/interaction/pinchrotateinteraction.js index cb593b9cce..21ce53fe22 100644 --- a/src/ol/interaction/pinchrotateinteraction.js +++ b/src/ol/interaction/pinchrotateinteraction.js @@ -73,7 +73,7 @@ ol.inherits(ol.interaction.PinchRotate, ol.interaction.Pointer); * @private */ ol.interaction.PinchRotate.handleDragEvent_ = function(mapBrowserEvent) { - ol.DEBUG && console.assert(this.targetPointers.length >= 2, + goog.DEBUG && console.assert(this.targetPointers.length >= 2, 'length of this.targetPointers should be greater than or equal to 2'); var rotationDelta = 0.0; diff --git a/src/ol/interaction/pinchzoominteraction.js b/src/ol/interaction/pinchzoominteraction.js index fd93339d84..f101fea0b7 100644 --- a/src/ol/interaction/pinchzoominteraction.js +++ b/src/ol/interaction/pinchzoominteraction.js @@ -61,7 +61,7 @@ ol.inherits(ol.interaction.PinchZoom, ol.interaction.Pointer); * @private */ ol.interaction.PinchZoom.handleDragEvent_ = function(mapBrowserEvent) { - ol.DEBUG && console.assert(this.targetPointers.length >= 2, + goog.DEBUG && console.assert(this.targetPointers.length >= 2, 'length of this.targetPointers should be 2 or more'); var scaleDelta = 1.0; diff --git a/src/ol/layer/heatmaplayer.js b/src/ol/layer/heatmaplayer.js index 1a8c8930fe..1c8366e303 100644 --- a/src/ol/layer/heatmaplayer.js +++ b/src/ol/layer/heatmaplayer.js @@ -100,12 +100,12 @@ ol.layer.Heatmap = function(opt_options) { } else { weightFunction = weight; } - ol.DEBUG && console.assert(typeof weightFunction === 'function', + goog.DEBUG && console.assert(typeof weightFunction === 'function', 'weightFunction should be a function'); this.setStyle(function(feature, resolution) { - ol.DEBUG && console.assert(this.styleCache_, 'this.styleCache_ expected'); - ol.DEBUG && console.assert(this.circleImage_ !== undefined, + goog.DEBUG && console.assert(this.styleCache_, 'this.styleCache_ expected'); + goog.DEBUG && console.assert(this.circleImage_ !== undefined, 'this.circleImage_ should be defined'); var weight = weightFunction(feature); var opacity = weight !== undefined ? ol.math.clamp(weight, 0, 1) : 1; @@ -173,7 +173,7 @@ ol.layer.Heatmap.createGradient_ = function(colors) { ol.layer.Heatmap.prototype.createCircle_ = function() { var radius = this.getRadius(); var blur = this.getBlur(); - ol.DEBUG && console.assert(radius !== undefined && blur !== undefined, + goog.DEBUG && console.assert(radius !== undefined && blur !== undefined, 'radius and blur should be defined'); var halfSize = radius + blur + 1; var size = 2 * halfSize; @@ -246,9 +246,9 @@ ol.layer.Heatmap.prototype.handleStyleChanged_ = function() { * @private */ ol.layer.Heatmap.prototype.handleRender_ = function(event) { - ol.DEBUG && console.assert(event.type == ol.render.EventType.RENDER, + goog.DEBUG && console.assert(event.type == ol.render.EventType.RENDER, 'event.type should be RENDER'); - ol.DEBUG && console.assert(this.gradient_, 'this.gradient_ expected'); + goog.DEBUG && console.assert(this.gradient_, 'this.gradient_ expected'); var context = event.context; var canvas = context.canvas; var image = context.getImageData(0, 0, canvas.width, canvas.height); diff --git a/src/ol/layer/layergroup.js b/src/ol/layer/layergroup.js index 50f7ff7985..87e6167b5a 100644 --- a/src/ol/layer/layergroup.js +++ b/src/ol/layer/layergroup.js @@ -130,7 +130,7 @@ ol.layer.Group.prototype.handleLayersChanged_ = function(event) { ol.layer.Group.prototype.handleLayersAdd_ = function(collectionEvent) { var layer = /** @type {ol.layer.Base} */ (collectionEvent.element); var key = ol.getUid(layer).toString(); - ol.DEBUG && console.assert(!(key in this.listenerKeys_), + goog.DEBUG && console.assert(!(key in this.listenerKeys_), 'listeners already registered'); this.listenerKeys_[key] = [ ol.events.listen(layer, ol.ObjectEventType.PROPERTYCHANGE, @@ -149,7 +149,7 @@ ol.layer.Group.prototype.handleLayersAdd_ = function(collectionEvent) { ol.layer.Group.prototype.handleLayersRemove_ = function(collectionEvent) { var layer = /** @type {ol.layer.Base} */ (collectionEvent.element); var key = ol.getUid(layer).toString(); - ol.DEBUG && console.assert(key in this.listenerKeys_, 'no listeners to unregister'); + goog.DEBUG && console.assert(key in this.listenerKeys_, 'no listeners to unregister'); this.listenerKeys_[key].forEach(ol.events.unlistenByKey); delete this.listenerKeys_[key]; this.changed(); diff --git a/src/ol/layer/vectorlayer.js b/src/ol/layer/vectorlayer.js index 6d9bf05e7e..c829cb7255 100644 --- a/src/ol/layer/vectorlayer.js +++ b/src/ol/layer/vectorlayer.js @@ -32,7 +32,7 @@ ol.layer.Vector = function(opt_options) { var options = opt_options ? opt_options : /** @type {olx.layer.VectorOptions} */ ({}); - ol.DEBUG && console.assert( + goog.DEBUG && console.assert( options.renderOrder === undefined || !options.renderOrder || typeof options.renderOrder === 'function', 'renderOrder must be a comparator function'); @@ -158,7 +158,7 @@ ol.layer.Vector.prototype.getUpdateWhileInteracting = function() { * Render order. */ ol.layer.Vector.prototype.setRenderOrder = function(renderOrder) { - ol.DEBUG && console.assert( + goog.DEBUG && console.assert( renderOrder === undefined || !renderOrder || typeof renderOrder === 'function', 'renderOrder must be a comparator function'); diff --git a/src/ol/map.js b/src/ol/map.js index 4b129366ae..776bf98ad1 100644 --- a/src/ol/map.js +++ b/src/ol/map.js @@ -479,7 +479,7 @@ ol.inherits(ol.Map, ol.Object); */ ol.Map.prototype.addControl = function(control) { var controls = this.getControls(); - ol.DEBUG && console.assert(controls !== undefined, 'controls should be defined'); + goog.DEBUG && console.assert(controls !== undefined, 'controls should be defined'); controls.push(control); }; @@ -491,7 +491,7 @@ ol.Map.prototype.addControl = function(control) { */ ol.Map.prototype.addInteraction = function(interaction) { var interactions = this.getInteractions(); - ol.DEBUG && console.assert(interactions !== undefined, + goog.DEBUG && console.assert(interactions !== undefined, 'interactions should be defined'); interactions.push(interaction); }; @@ -517,7 +517,7 @@ ol.Map.prototype.addLayer = function(layer) { */ ol.Map.prototype.addOverlay = function(overlay) { var overlays = this.getOverlays(); - ol.DEBUG && console.assert(overlays !== undefined, 'overlays should be defined'); + goog.DEBUG && console.assert(overlays !== undefined, 'overlays should be defined'); overlays.push(overlay); }; @@ -974,7 +974,7 @@ ol.Map.prototype.handleMapBrowserEvent = function(mapBrowserEvent) { this.focus_ = mapBrowserEvent.coordinate; mapBrowserEvent.frameState = this.frameState_; var interactions = this.getInteractions(); - ol.DEBUG && console.assert(interactions !== undefined, + goog.DEBUG && console.assert(interactions !== undefined, 'interactions should be defined'); var interactionsArray = interactions.getArray(); var i; @@ -1059,7 +1059,7 @@ ol.Map.prototype.handleTargetChanged_ = function() { var targetElement; if (this.getTarget()) { targetElement = this.getTargetElement(); - ol.DEBUG && console.assert(targetElement !== null, + goog.DEBUG && console.assert(targetElement !== null, 'expects a non-null value for targetElement'); } @@ -1200,7 +1200,7 @@ ol.Map.prototype.render = function() { */ ol.Map.prototype.removeControl = function(control) { var controls = this.getControls(); - ol.DEBUG && console.assert(controls !== undefined, 'controls should be defined'); + goog.DEBUG && console.assert(controls !== undefined, 'controls should be defined'); return controls.remove(control); }; @@ -1214,7 +1214,7 @@ ol.Map.prototype.removeControl = function(control) { */ ol.Map.prototype.removeInteraction = function(interaction) { var interactions = this.getInteractions(); - ol.DEBUG && console.assert(interactions !== undefined, + goog.DEBUG && console.assert(interactions !== undefined, 'interactions should be defined'); return interactions.remove(interaction); }; @@ -1242,7 +1242,7 @@ ol.Map.prototype.removeLayer = function(layer) { */ ol.Map.prototype.removeOverlay = function(overlay) { var overlays = this.getOverlays(); - ol.DEBUG && console.assert(overlays !== undefined, 'overlays should be defined'); + goog.DEBUG && console.assert(overlays !== undefined, 'overlays should be defined'); return overlays.remove(overlay); }; diff --git a/src/ol/mapbrowserevent.js b/src/ol/mapbrowserevent.js index e314857087..4599dea048 100644 --- a/src/ol/mapbrowserevent.js +++ b/src/ol/mapbrowserevent.js @@ -271,11 +271,11 @@ ol.MapBrowserEventHandler.prototype.handlePointerUp_ = function(pointerEvent) { // to 0). // See http://www.w3.org/TR/pointerevents/#button-states if (!this.dragging_ && this.isMouseActionButton_(pointerEvent)) { - ol.DEBUG && console.assert(this.down_, 'this.down_ must be truthy'); + goog.DEBUG && console.assert(this.down_, 'this.down_ must be truthy'); this.emulateClick_(this.down_); } - ol.DEBUG && console.assert(this.activePointers_ >= 0, + goog.DEBUG && console.assert(this.activePointers_ >= 0, 'this.activePointers_ should be equal to or larger than 0'); if (this.activePointers_ === 0) { this.dragListenerKeys_.forEach(ol.events.unlistenByKey); diff --git a/src/ol/math.js b/src/ol/math.js index 68e354140c..cd1e3dfd57 100644 --- a/src/ol/math.js +++ b/src/ol/math.js @@ -105,7 +105,7 @@ ol.math.squaredDistance = function(x1, y1, x2, y2) { ol.math.solveLinearSystem = function(mat) { var n = mat.length; - if (ol.DEBUG) { + if (goog.DEBUG) { for (var row = 0; row < n; row++) { console.assert(mat[row].length == n + 1, 'every row should have correct number of columns'); diff --git a/src/ol/ol.js b/src/ol/ol.js index 69219efda2..e195cff740 100644 --- a/src/ol/ol.js +++ b/src/ol/ol.js @@ -14,14 +14,6 @@ goog.provide('ol'); ol.ASSUME_TOUCH = false; -/** - * @define {boolean} Debug mode. When set to `false` (recommended for - * production), debug assertion checks will be stripped out of the build. - * Default is `true`. - */ -ol.DEBUG = true; - - /** * TODO: rename this to something having to do with tile grids * see https://github.com/openlayers/ol3/issues/2076 diff --git a/src/ol/overlay.js b/src/ol/overlay.js index 62548e7fb2..9ad9ef38b2 100644 --- a/src/ol/overlay.js +++ b/src/ol/overlay.js @@ -430,8 +430,8 @@ ol.Overlay.prototype.panIntoView_ = function() { * @private */ ol.Overlay.prototype.getRect_ = function(element, size) { - ol.DEBUG && console.assert(element, 'element should be defined'); - ol.DEBUG && console.assert(size !== undefined, 'size should be defined'); + goog.DEBUG && console.assert(element, 'element should be defined'); + goog.DEBUG && console.assert(size !== undefined, 'size should be defined'); var box = element.getBoundingClientRect(); var offsetX = box.left + ol.global.pageXOffset; @@ -494,14 +494,14 @@ ol.Overlay.prototype.updatePixelPosition = function() { * @protected */ ol.Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) { - ol.DEBUG && console.assert(pixel, 'pixel should not be null'); - ol.DEBUG && console.assert(mapSize !== undefined, 'mapSize should be defined'); + goog.DEBUG && console.assert(pixel, 'pixel should not be null'); + goog.DEBUG && console.assert(mapSize !== undefined, 'mapSize should be defined'); var style = this.element_.style; var offset = this.getOffset(); - ol.DEBUG && console.assert(Array.isArray(offset), 'offset should be an array'); + goog.DEBUG && console.assert(Array.isArray(offset), 'offset should be an array'); var positioning = this.getPositioning(); - ol.DEBUG && console.assert(positioning !== undefined, + goog.DEBUG && console.assert(positioning !== undefined, 'positioning should be defined'); var offsetX = offset[0]; diff --git a/src/ol/proj/epsg3857projection.js b/src/ol/proj/epsg3857projection.js index c90f5f5257..1c714aac9d 100644 --- a/src/ol/proj/epsg3857projection.js +++ b/src/ol/proj/epsg3857projection.js @@ -113,7 +113,7 @@ ol.proj.EPSG3857.fromEPSG4326 = function(input, opt_output, opt_dimension) { output = new Array(length); } } - ol.DEBUG && console.assert(output.length % dimension === 0, + goog.DEBUG && console.assert(output.length % dimension === 0, 'modulus of output.length with dimension should be 0'); for (var i = 0; i < length; i += dimension) { output[i] = ol.proj.EPSG3857.RADIUS * Math.PI * input[i] / 180; @@ -144,7 +144,7 @@ ol.proj.EPSG3857.toEPSG4326 = function(input, opt_output, opt_dimension) { output = new Array(length); } } - ol.DEBUG && console.assert(output.length % dimension === 0, + goog.DEBUG && console.assert(output.length % dimension === 0, 'modulus of output.length with dimension should be 0'); for (var i = 0; i < length; i += dimension) { output[i] = 180 * input[i] / (ol.proj.EPSG3857.RADIUS * Math.PI); diff --git a/src/ol/proj/proj.js b/src/ol/proj/proj.js index 17b688baec..d51972e760 100644 --- a/src/ol/proj/proj.js +++ b/src/ol/proj/proj.js @@ -136,7 +136,7 @@ ol.proj.Projection = function(options) { var projections = ol.proj.projections_; var code = options.code; - ol.DEBUG && console.assert(code !== undefined, + goog.DEBUG && console.assert(code !== undefined, 'Option "code" is required for constructing instance'); if (ol.ENABLE_PROJ4JS) { var proj4js = ol.proj.proj4_ || ol.global['proj4']; @@ -416,7 +416,7 @@ if (ol.ENABLE_PROJ4JS) { * @api */ ol.proj.setProj4 = function(proj4) { - ol.DEBUG && console.assert(typeof proj4 == 'function', + goog.DEBUG && console.assert(typeof proj4 == 'function', 'proj4 argument should be a function'); ol.proj.proj4_ = proj4; }; @@ -608,9 +608,9 @@ ol.proj.removeTransform = function(source, destination) { var sourceCode = source.getCode(); var destinationCode = destination.getCode(); var transforms = ol.proj.transforms_; - ol.DEBUG && console.assert(sourceCode in transforms, + goog.DEBUG && console.assert(sourceCode in transforms, 'sourceCode should be in transforms'); - ol.DEBUG && console.assert(destinationCode in transforms[sourceCode], + goog.DEBUG && console.assert(destinationCode in transforms[sourceCode], 'destinationCode should be in transforms of sourceCode'); var transform = transforms[sourceCode][destinationCode]; delete transforms[sourceCode][destinationCode]; @@ -741,7 +741,7 @@ ol.proj.getTransformFromProjections = function(sourceProjection, destinationProj transform = transforms[sourceCode][destinationCode]; } if (transform === undefined) { - ol.DEBUG && console.assert(transform !== undefined, 'transform should be defined'); + goog.DEBUG && console.assert(transform !== undefined, 'transform should be defined'); transform = ol.proj.identityTransform; } return transform; @@ -757,7 +757,7 @@ ol.proj.getTransformFromProjections = function(sourceProjection, destinationProj ol.proj.identityTransform = function(input, opt_output, opt_dimension) { if (opt_output !== undefined && input !== opt_output) { // TODO: consider making this a warning instead - ol.DEBUG && console.assert(false, 'This should not be used internally.'); + goog.DEBUG && console.assert(false, 'This should not be used internally.'); for (var i = 0, ii = input.length; i < ii; ++i) { opt_output[i] = input[i]; } diff --git a/src/ol/render/box.js b/src/ol/render/box.js index 935bb30310..ff5dabd2f6 100644 --- a/src/ol/render/box.js +++ b/src/ol/render/box.js @@ -63,8 +63,8 @@ ol.render.Box.prototype.disposeInternal = function() { ol.render.Box.prototype.render_ = function() { var startPixel = this.startPixel_; var endPixel = this.endPixel_; - ol.DEBUG && console.assert(startPixel, 'this.startPixel_ must be truthy'); - ol.DEBUG && console.assert(endPixel, 'this.endPixel_ must be truthy'); + goog.DEBUG && console.assert(startPixel, 'this.startPixel_ must be truthy'); + goog.DEBUG && console.assert(endPixel, 'this.endPixel_ must be truthy'); var px = 'px'; var style = this.element_.style; style.left = Math.min(startPixel[0], endPixel[0]) + px; @@ -106,11 +106,11 @@ ol.render.Box.prototype.setPixels = function(startPixel, endPixel) { * Creates or updates the cached geometry. */ ol.render.Box.prototype.createOrUpdateGeometry = function() { - ol.DEBUG && console.assert(this.startPixel_, + goog.DEBUG && console.assert(this.startPixel_, 'this.startPixel_ must be truthy'); - ol.DEBUG && console.assert(this.endPixel_, + goog.DEBUG && console.assert(this.endPixel_, 'this.endPixel_ must be truthy'); - ol.DEBUG && console.assert(this.map_, 'this.map_ must be truthy'); + goog.DEBUG && console.assert(this.map_, 'this.map_ must be truthy'); var startPixel = this.startPixel_; var endPixel = this.endPixel_; var pixels = [ diff --git a/src/ol/render/canvas/canvasimmediate.js b/src/ol/render/canvas/canvasimmediate.js index d44da1a579..514b889f5e 100644 --- a/src/ol/render/canvas/canvasimmediate.js +++ b/src/ol/render/canvas/canvasimmediate.js @@ -244,8 +244,8 @@ ol.render.canvas.Immediate.prototype.drawImages_ = function(flatCoordinates, off if (!this.image_) { return; } - ol.DEBUG && console.assert(offset === 0, 'offset should be 0'); - ol.DEBUG && console.assert(end == flatCoordinates.length, + goog.DEBUG && console.assert(offset === 0, 'offset should be 0'); + goog.DEBUG && console.assert(end == flatCoordinates.length, 'end should be equal to the length of flatCoordinates'); var pixelCoordinates = ol.geom.flat.transform.transform2D( flatCoordinates, offset, end, 2, this.transform_, @@ -309,8 +309,8 @@ ol.render.canvas.Immediate.prototype.drawText_ = function(flatCoordinates, offse this.setContextStrokeState_(this.textStrokeState_); } this.setContextTextState_(this.textState_); - ol.DEBUG && console.assert(offset === 0, 'offset should be 0'); - ol.DEBUG && console.assert(end == flatCoordinates.length, + goog.DEBUG && console.assert(offset === 0, 'offset should be 0'); + goog.DEBUG && console.assert(end == flatCoordinates.length, 'end should be equal to the length of flatCoordinates'); var pixelCoordinates = ol.geom.flat.transform.transform2D( flatCoordinates, offset, end, stride, this.transform_, @@ -476,7 +476,7 @@ ol.render.canvas.Immediate.prototype.drawGeometry = function(geometry) { this.drawCircle(/** @type {ol.geom.Circle} */ (geometry)); break; default: - ol.DEBUG && console.assert(false, 'Unsupported geometry type: ' + type); + goog.DEBUG && console.assert(false, 'Unsupported geometry type: ' + type); } }; @@ -498,7 +498,7 @@ ol.render.canvas.Immediate.prototype.drawFeature = function(feature, style) { return; } this.setStyle(style); - ol.DEBUG && console.assert(geometry, 'geometry must be truthy'); + goog.DEBUG && console.assert(geometry, 'geometry must be truthy'); this.drawGeometry(geometry); }; @@ -852,10 +852,10 @@ ol.render.canvas.Immediate.prototype.setImageStyle = function(imageStyle) { var imageImage = imageStyle.getImage(1); var imageOrigin = imageStyle.getOrigin(); var imageSize = imageStyle.getSize(); - ol.DEBUG && console.assert(imageAnchor, 'imageAnchor must be truthy'); - ol.DEBUG && console.assert(imageImage, 'imageImage must be truthy'); - ol.DEBUG && console.assert(imageOrigin, 'imageOrigin must be truthy'); - ol.DEBUG && console.assert(imageSize, 'imageSize must be truthy'); + goog.DEBUG && console.assert(imageAnchor, 'imageAnchor must be truthy'); + goog.DEBUG && console.assert(imageImage, 'imageImage must be truthy'); + goog.DEBUG && console.assert(imageOrigin, 'imageOrigin must be truthy'); + goog.DEBUG && console.assert(imageSize, 'imageSize must be truthy'); this.imageAnchorX_ = imageAnchor[0]; this.imageAnchorY_ = imageAnchor[1]; this.imageHeight_ = imageSize[1]; diff --git a/src/ol/render/canvas/canvasreplay.js b/src/ol/render/canvas/canvasreplay.js index 6e56823c4b..279446e14b 100644 --- a/src/ol/render/canvas/canvasreplay.js +++ b/src/ol/render/canvas/canvasreplay.js @@ -245,7 +245,7 @@ ol.render.canvas.Replay.prototype.replay_ = function( this.coordinates, 0, this.coordinates.length, 2, transform, this.pixelCoordinates_); ol.transform.setFromArray(this.renderedTransform_, transform); - ol.DEBUG && console.assert(pixelCoordinates === this.pixelCoordinates_, + goog.DEBUG && console.assert(pixelCoordinates === this.pixelCoordinates_, 'pixelCoordinates should be the same as this.pixelCoordinates_'); } var skipFeatures = !ol.object.isEmpty(skippedFeaturesHash); @@ -279,7 +279,7 @@ ol.render.canvas.Replay.prototype.replay_ = function( ++i; break; case ol.render.canvas.Instruction.CIRCLE: - ol.DEBUG && console.assert(typeof instruction[1] === 'number', + goog.DEBUG && console.assert(typeof instruction[1] === 'number', 'second instruction should be a number'); d = /** @type {number} */ (instruction[1]); var x1 = pixelCoordinates[d]; @@ -297,10 +297,10 @@ ol.render.canvas.Replay.prototype.replay_ = function( ++i; break; case ol.render.canvas.Instruction.DRAW_IMAGE: - ol.DEBUG && console.assert(typeof instruction[1] === 'number', + goog.DEBUG && console.assert(typeof instruction[1] === 'number', 'second instruction should be a number'); d = /** @type {number} */ (instruction[1]); - ol.DEBUG && console.assert(typeof instruction[2] === 'number', + goog.DEBUG && console.assert(typeof instruction[2] === 'number', 'third instruction should be a number'); dd = /** @type {number} */ (instruction[2]); var image = /** @type {HTMLCanvasElement|HTMLVideoElement|Image} */ @@ -356,31 +356,31 @@ ol.render.canvas.Replay.prototype.replay_ = function( ++i; break; case ol.render.canvas.Instruction.DRAW_TEXT: - ol.DEBUG && console.assert(typeof instruction[1] === 'number', + goog.DEBUG && console.assert(typeof instruction[1] === 'number', '2nd instruction should be a number'); d = /** @type {number} */ (instruction[1]); - ol.DEBUG && console.assert(typeof instruction[2] === 'number', + goog.DEBUG && console.assert(typeof instruction[2] === 'number', '3rd instruction should be a number'); dd = /** @type {number} */ (instruction[2]); - ol.DEBUG && console.assert(typeof instruction[3] === 'string', + goog.DEBUG && console.assert(typeof instruction[3] === 'string', '4th instruction should be a string'); text = /** @type {string} */ (instruction[3]); - ol.DEBUG && console.assert(typeof instruction[4] === 'number', + goog.DEBUG && console.assert(typeof instruction[4] === 'number', '5th instruction should be a number'); var offsetX = /** @type {number} */ (instruction[4]) * pixelRatio; - ol.DEBUG && console.assert(typeof instruction[5] === 'number', + goog.DEBUG && console.assert(typeof instruction[5] === 'number', '6th instruction should be a number'); var offsetY = /** @type {number} */ (instruction[5]) * pixelRatio; - ol.DEBUG && console.assert(typeof instruction[6] === 'number', + goog.DEBUG && console.assert(typeof instruction[6] === 'number', '7th instruction should be a number'); rotation = /** @type {number} */ (instruction[6]); - ol.DEBUG && console.assert(typeof instruction[7] === 'number', + goog.DEBUG && console.assert(typeof instruction[7] === 'number', '8th instruction should be a number'); scale = /** @type {number} */ (instruction[7]) * pixelRatio; - ol.DEBUG && console.assert(typeof instruction[8] === 'boolean', + goog.DEBUG && console.assert(typeof instruction[8] === 'boolean', '9th instruction should be a boolean'); fill = /** @type {boolean} */ (instruction[8]); - ol.DEBUG && console.assert(typeof instruction[9] === 'boolean', + goog.DEBUG && console.assert(typeof instruction[9] === 'boolean', '10th instruction should be a boolean'); stroke = /** @type {boolean} */ (instruction[9]); for (; d < dd; d += 2) { @@ -441,10 +441,10 @@ ol.render.canvas.Replay.prototype.replay_ = function( ++i; break; case ol.render.canvas.Instruction.MOVE_TO_LINE_TO: - ol.DEBUG && console.assert(typeof instruction[1] === 'number', + goog.DEBUG && console.assert(typeof instruction[1] === 'number', '2nd instruction should be a number'); d = /** @type {number} */ (instruction[1]); - ol.DEBUG && console.assert(typeof instruction[2] === 'number', + goog.DEBUG && console.assert(typeof instruction[2] === 'number', '3rd instruction should be a number'); dd = /** @type {number} */ (instruction[2]); x = pixelCoordinates[d]; @@ -470,7 +470,7 @@ ol.render.canvas.Replay.prototype.replay_ = function( ++i; break; case ol.render.canvas.Instruction.SET_FILL_STYLE: - ol.DEBUG && console.assert( + goog.DEBUG && console.assert( ol.colorlike.isColorLike(instruction[1]), '2nd instruction should be a string, ' + 'CanvasPattern, or CanvasGradient'); @@ -478,17 +478,17 @@ ol.render.canvas.Replay.prototype.replay_ = function( ++i; break; case ol.render.canvas.Instruction.SET_STROKE_STYLE: - ol.DEBUG && console.assert(typeof instruction[1] === 'string', + goog.DEBUG && console.assert(typeof instruction[1] === 'string', '2nd instruction should be a string'); - ol.DEBUG && console.assert(typeof instruction[2] === 'number', + goog.DEBUG && console.assert(typeof instruction[2] === 'number', '3rd instruction should be a number'); - ol.DEBUG && console.assert(typeof instruction[3] === 'string', + goog.DEBUG && console.assert(typeof instruction[3] === 'string', '4rd instruction should be a string'); - ol.DEBUG && console.assert(typeof instruction[4] === 'string', + goog.DEBUG && console.assert(typeof instruction[4] === 'string', '5th instruction should be a string'); - ol.DEBUG && console.assert(typeof instruction[5] === 'number', + goog.DEBUG && console.assert(typeof instruction[5] === 'number', '6th instruction should be a number'); - ol.DEBUG && console.assert(instruction[6], + goog.DEBUG && console.assert(instruction[6], '7th instruction should not be null'); var usePixelRatio = instruction[7] !== undefined ? instruction[7] : true; @@ -506,11 +506,11 @@ ol.render.canvas.Replay.prototype.replay_ = function( ++i; break; case ol.render.canvas.Instruction.SET_TEXT_STYLE: - ol.DEBUG && console.assert(typeof instruction[1] === 'string', + goog.DEBUG && console.assert(typeof instruction[1] === 'string', '2nd instruction should be a string'); - ol.DEBUG && console.assert(typeof instruction[2] === 'string', + goog.DEBUG && console.assert(typeof instruction[2] === 'string', '3rd instruction should be a string'); - ol.DEBUG && console.assert(typeof instruction[3] === 'string', + goog.DEBUG && console.assert(typeof instruction[3] === 'string', '4th instruction should be a string'); context.font = /** @type {string} */ (instruction[1]); context.textAlign = /** @type {string} */ (instruction[2]); @@ -522,13 +522,13 @@ ol.render.canvas.Replay.prototype.replay_ = function( ++i; break; default: - ol.DEBUG && console.assert(false, 'Unknown canvas render instruction'); + goog.DEBUG && console.assert(false, 'Unknown canvas render instruction'); ++i; // consume the instruction anyway, to avoid an infinite loop break; } } // assert that all instructions were consumed - ol.DEBUG && console.assert(i == instructions.length, + goog.DEBUG && console.assert(i == instructions.length, 'all instructions should be consumed'); return undefined; }; @@ -589,11 +589,11 @@ ol.render.canvas.Replay.prototype.reverseHitDetectionInstructions_ = function() instruction = hitDetectionInstructions[i]; type = /** @type {ol.render.canvas.Instruction} */ (instruction[0]); if (type == ol.render.canvas.Instruction.END_GEOMETRY) { - ol.DEBUG && console.assert(begin == -1, 'begin should be -1'); + goog.DEBUG && console.assert(begin == -1, 'begin should be -1'); begin = i; } else if (type == ol.render.canvas.Instruction.BEGIN_GEOMETRY) { instruction[2] = i; - ol.DEBUG && console.assert(begin >= 0, + goog.DEBUG && console.assert(begin >= 0, 'begin should be larger than or equal to 0'); ol.array.reverseSubArray(this.hitDetectionInstructions, begin, i); begin = -1; @@ -607,11 +607,11 @@ ol.render.canvas.Replay.prototype.reverseHitDetectionInstructions_ = function() * @param {ol.Feature|ol.render.Feature} feature Feature. */ ol.render.canvas.Replay.prototype.endGeometry = function(geometry, feature) { - ol.DEBUG && console.assert(this.beginGeometryInstruction1_, + goog.DEBUG && console.assert(this.beginGeometryInstruction1_, 'this.beginGeometryInstruction1_ should not be null'); this.beginGeometryInstruction1_[2] = this.instructions.length; this.beginGeometryInstruction1_ = null; - ol.DEBUG && console.assert(this.beginGeometryInstruction2_, + goog.DEBUG && console.assert(this.beginGeometryInstruction2_, 'this.beginGeometryInstruction2_ should not be null'); this.beginGeometryInstruction2_[2] = this.hitDetectionInstructions.length; this.beginGeometryInstruction2_ = null; @@ -755,25 +755,25 @@ ol.render.canvas.ImageReplay.prototype.drawPoint = function(pointGeometry, featu if (!this.image_) { return; } - ol.DEBUG && console.assert(this.anchorX_ !== undefined, + goog.DEBUG && console.assert(this.anchorX_ !== undefined, 'this.anchorX_ should be defined'); - ol.DEBUG && console.assert(this.anchorY_ !== undefined, + goog.DEBUG && console.assert(this.anchorY_ !== undefined, 'this.anchorY_ should be defined'); - ol.DEBUG && console.assert(this.height_ !== undefined, + goog.DEBUG && console.assert(this.height_ !== undefined, 'this.height_ should be defined'); - ol.DEBUG && console.assert(this.opacity_ !== undefined, + goog.DEBUG && console.assert(this.opacity_ !== undefined, 'this.opacity_ should be defined'); - ol.DEBUG && console.assert(this.originX_ !== undefined, + goog.DEBUG && console.assert(this.originX_ !== undefined, 'this.originX_ should be defined'); - ol.DEBUG && console.assert(this.originY_ !== undefined, + goog.DEBUG && console.assert(this.originY_ !== undefined, 'this.originY_ should be defined'); - ol.DEBUG && console.assert(this.rotateWithView_ !== undefined, + goog.DEBUG && console.assert(this.rotateWithView_ !== undefined, 'this.rotateWithView_ should be defined'); - ol.DEBUG && console.assert(this.rotation_ !== undefined, + goog.DEBUG && console.assert(this.rotation_ !== undefined, 'this.rotation_ should be defined'); - ol.DEBUG && console.assert(this.scale_ !== undefined, + goog.DEBUG && console.assert(this.scale_ !== undefined, 'this.scale_ should be defined'); - ol.DEBUG && console.assert(this.width_ !== undefined, + goog.DEBUG && console.assert(this.width_ !== undefined, 'this.width_ should be defined'); this.beginGeometry(pointGeometry, feature); var flatCoordinates = pointGeometry.getFlatCoordinates(); @@ -807,25 +807,25 @@ ol.render.canvas.ImageReplay.prototype.drawMultiPoint = function(multiPointGeome if (!this.image_) { return; } - ol.DEBUG && console.assert(this.anchorX_ !== undefined, + goog.DEBUG && console.assert(this.anchorX_ !== undefined, 'this.anchorX_ should be defined'); - ol.DEBUG && console.assert(this.anchorY_ !== undefined, + goog.DEBUG && console.assert(this.anchorY_ !== undefined, 'this.anchorY_ should be defined'); - ol.DEBUG && console.assert(this.height_ !== undefined, + goog.DEBUG && console.assert(this.height_ !== undefined, 'this.height_ should be defined'); - ol.DEBUG && console.assert(this.opacity_ !== undefined, + goog.DEBUG && console.assert(this.opacity_ !== undefined, 'this.opacity_ should be defined'); - ol.DEBUG && console.assert(this.originX_ !== undefined, + goog.DEBUG && console.assert(this.originX_ !== undefined, 'this.originX_ should be defined'); - ol.DEBUG && console.assert(this.originY_ !== undefined, + goog.DEBUG && console.assert(this.originY_ !== undefined, 'this.originY_ should be defined'); - ol.DEBUG && console.assert(this.rotateWithView_ !== undefined, + goog.DEBUG && console.assert(this.rotateWithView_ !== undefined, 'this.rotateWithView_ should be defined'); - ol.DEBUG && console.assert(this.rotation_ !== undefined, + goog.DEBUG && console.assert(this.rotation_ !== undefined, 'this.rotation_ should be defined'); - ol.DEBUG && console.assert(this.scale_ !== undefined, + goog.DEBUG && console.assert(this.scale_ !== undefined, 'this.scale_ should be defined'); - ol.DEBUG && console.assert(this.width_ !== undefined, + goog.DEBUG && console.assert(this.width_ !== undefined, 'this.width_ should be defined'); this.beginGeometry(multiPointGeometry, feature); var flatCoordinates = multiPointGeometry.getFlatCoordinates(); @@ -878,18 +878,18 @@ ol.render.canvas.ImageReplay.prototype.finish = function() { * @inheritDoc */ ol.render.canvas.ImageReplay.prototype.setImageStyle = function(imageStyle) { - ol.DEBUG && console.assert(imageStyle, 'imageStyle should not be null'); + goog.DEBUG && console.assert(imageStyle, 'imageStyle should not be null'); var anchor = imageStyle.getAnchor(); - ol.DEBUG && console.assert(anchor, 'anchor should not be null'); + goog.DEBUG && console.assert(anchor, 'anchor should not be null'); var size = imageStyle.getSize(); - ol.DEBUG && console.assert(size, 'size should not be null'); + goog.DEBUG && console.assert(size, 'size should not be null'); var hitDetectionImage = imageStyle.getHitDetectionImage(1); - ol.DEBUG && console.assert(hitDetectionImage, + goog.DEBUG && console.assert(hitDetectionImage, 'hitDetectionImage should not be null'); var image = imageStyle.getImage(1); - ol.DEBUG && console.assert(image, 'image should not be null'); + goog.DEBUG && console.assert(image, 'image should not be null'); var origin = imageStyle.getOrigin(); - ol.DEBUG && console.assert(origin, 'origin should not be null'); + goog.DEBUG && console.assert(origin, 'origin should not be null'); this.anchorX_ = anchor[0]; this.anchorY_ = anchor[1]; this.hitDetectionImage_ = hitDetectionImage; @@ -1001,13 +1001,13 @@ ol.render.canvas.LineStringReplay.prototype.setStrokeStyle_ = function() { var lineJoin = state.lineJoin; var lineWidth = state.lineWidth; var miterLimit = state.miterLimit; - ol.DEBUG && console.assert(strokeStyle !== undefined, + goog.DEBUG && console.assert(strokeStyle !== undefined, 'strokeStyle should be defined'); - ol.DEBUG && console.assert(lineCap !== undefined, 'lineCap should be defined'); - ol.DEBUG && console.assert(lineDash, 'lineDash should not be null'); - ol.DEBUG && console.assert(lineJoin !== undefined, 'lineJoin should be defined'); - ol.DEBUG && console.assert(lineWidth !== undefined, 'lineWidth should be defined'); - ol.DEBUG && console.assert(miterLimit !== undefined, 'miterLimit should be defined'); + goog.DEBUG && console.assert(lineCap !== undefined, 'lineCap should be defined'); + goog.DEBUG && console.assert(lineDash, 'lineDash should not be null'); + goog.DEBUG && console.assert(lineJoin !== undefined, 'lineJoin should be defined'); + goog.DEBUG && console.assert(lineWidth !== undefined, 'lineWidth should be defined'); + goog.DEBUG && console.assert(miterLimit !== undefined, 'miterLimit should be defined'); if (state.currentStrokeStyle != strokeStyle || state.currentLineCap != lineCap || !ol.array.equals(state.currentLineDash, lineDash) || @@ -1038,7 +1038,7 @@ ol.render.canvas.LineStringReplay.prototype.setStrokeStyle_ = function() { */ ol.render.canvas.LineStringReplay.prototype.drawLineString = function(lineStringGeometry, feature) { var state = this.state_; - ol.DEBUG && console.assert(state, 'state should not be null'); + goog.DEBUG && console.assert(state, 'state should not be null'); var strokeStyle = state.strokeStyle; var lineWidth = state.lineWidth; if (strokeStyle === undefined || lineWidth === undefined) { @@ -1065,7 +1065,7 @@ ol.render.canvas.LineStringReplay.prototype.drawLineString = function(lineString */ ol.render.canvas.LineStringReplay.prototype.drawMultiLineString = function(multiLineStringGeometry, feature) { var state = this.state_; - ol.DEBUG && console.assert(state, 'state should not be null'); + goog.DEBUG && console.assert(state, 'state should not be null'); var strokeStyle = state.strokeStyle; var lineWidth = state.lineWidth; if (strokeStyle === undefined || lineWidth === undefined) { @@ -1097,7 +1097,7 @@ ol.render.canvas.LineStringReplay.prototype.drawMultiLineString = function(multi */ ol.render.canvas.LineStringReplay.prototype.finish = function() { var state = this.state_; - ol.DEBUG && console.assert(state, 'state should not be null'); + goog.DEBUG && console.assert(state, 'state should not be null'); if (state.lastStroke != this.coordinates.length) { this.instructions.push([ol.render.canvas.Instruction.STROKE]); } @@ -1110,9 +1110,9 @@ ol.render.canvas.LineStringReplay.prototype.finish = function() { * @inheritDoc */ ol.render.canvas.LineStringReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) { - ol.DEBUG && console.assert(this.state_, 'this.state_ should not be null'); - ol.DEBUG && console.assert(!fillStyle, 'fillStyle should be null'); - ol.DEBUG && console.assert(strokeStyle, 'strokeStyle should not be null'); + goog.DEBUG && console.assert(this.state_, 'this.state_ should not be null'); + goog.DEBUG && console.assert(!fillStyle, 'fillStyle should be null'); + goog.DEBUG && console.assert(strokeStyle, 'strokeStyle should not be null'); var strokeStyleColor = strokeStyle.getColor(); this.state_.strokeStyle = ol.color.asString(strokeStyleColor ? strokeStyleColor : ol.render.canvas.defaultStrokeStyle); @@ -1226,7 +1226,7 @@ ol.render.canvas.PolygonReplay.prototype.drawFlatCoordinatess_ = function(flatCo this.instructions.push(fillInstruction); } if (state.strokeStyle !== undefined) { - ol.DEBUG && console.assert(state.lineWidth !== undefined, + goog.DEBUG && console.assert(state.lineWidth !== undefined, 'state.lineWidth should be defined'); var strokeInstruction = [ol.render.canvas.Instruction.STROKE]; this.instructions.push(strokeInstruction); @@ -1241,14 +1241,14 @@ ol.render.canvas.PolygonReplay.prototype.drawFlatCoordinatess_ = function(flatCo */ ol.render.canvas.PolygonReplay.prototype.drawCircle = function(circleGeometry, feature) { var state = this.state_; - ol.DEBUG && console.assert(state, 'state should not be null'); + goog.DEBUG && console.assert(state, 'state should not be null'); var fillStyle = state.fillStyle; var strokeStyle = state.strokeStyle; if (fillStyle === undefined && strokeStyle === undefined) { return; } if (strokeStyle !== undefined) { - ol.DEBUG && console.assert(state.lineWidth !== undefined, + goog.DEBUG && console.assert(state.lineWidth !== undefined, 'state.lineWidth should be defined'); } this.setFillStrokeStyles_(); @@ -1278,7 +1278,7 @@ ol.render.canvas.PolygonReplay.prototype.drawCircle = function(circleGeometry, f this.instructions.push(fillInstruction); } if (state.strokeStyle !== undefined) { - ol.DEBUG && console.assert(state.lineWidth !== undefined, + goog.DEBUG && console.assert(state.lineWidth !== undefined, 'state.lineWidth should be defined'); var strokeInstruction = [ol.render.canvas.Instruction.STROKE]; this.instructions.push(strokeInstruction); @@ -1293,14 +1293,14 @@ ol.render.canvas.PolygonReplay.prototype.drawCircle = function(circleGeometry, f */ ol.render.canvas.PolygonReplay.prototype.drawPolygon = function(polygonGeometry, feature) { var state = this.state_; - ol.DEBUG && console.assert(state, 'state should not be null'); + goog.DEBUG && console.assert(state, 'state should not be null'); var fillStyle = state.fillStyle; var strokeStyle = state.strokeStyle; if (fillStyle === undefined && strokeStyle === undefined) { return; } if (strokeStyle !== undefined) { - ol.DEBUG && console.assert(state.lineWidth !== undefined, + goog.DEBUG && console.assert(state.lineWidth !== undefined, 'state.lineWidth should be defined'); } this.setFillStrokeStyles_(); @@ -1328,14 +1328,14 @@ ol.render.canvas.PolygonReplay.prototype.drawPolygon = function(polygonGeometry, */ ol.render.canvas.PolygonReplay.prototype.drawMultiPolygon = function(multiPolygonGeometry, feature) { var state = this.state_; - ol.DEBUG && console.assert(state, 'state should not be null'); + goog.DEBUG && console.assert(state, 'state should not be null'); var fillStyle = state.fillStyle; var strokeStyle = state.strokeStyle; if (fillStyle === undefined && strokeStyle === undefined) { return; } if (strokeStyle !== undefined) { - ol.DEBUG && console.assert(state.lineWidth !== undefined, + goog.DEBUG && console.assert(state.lineWidth !== undefined, 'state.lineWidth should be defined'); } this.setFillStrokeStyles_(); @@ -1367,7 +1367,7 @@ ol.render.canvas.PolygonReplay.prototype.drawMultiPolygon = function(multiPolygo * @inheritDoc */ ol.render.canvas.PolygonReplay.prototype.finish = function() { - ol.DEBUG && console.assert(this.state_, 'this.state_ should not be null'); + goog.DEBUG && console.assert(this.state_, 'this.state_ should not be null'); this.reverseHitDetectionInstructions_(); this.state_ = null; // We want to preserve topology when drawing polygons. Polygons are @@ -1404,8 +1404,8 @@ ol.render.canvas.PolygonReplay.prototype.getBufferedMaxExtent = function() { * @inheritDoc */ ol.render.canvas.PolygonReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) { - ol.DEBUG && console.assert(this.state_, 'this.state_ should not be null'); - ol.DEBUG && console.assert(fillStyle || strokeStyle, + goog.DEBUG && console.assert(this.state_, 'this.state_ should not be null'); + goog.DEBUG && console.assert(fillStyle || strokeStyle, 'fillStyle or strokeStyle should not be null'); var state = this.state_; if (fillStyle) { @@ -1469,11 +1469,11 @@ ol.render.canvas.PolygonReplay.prototype.setFillStrokeStyles_ = function() { state.currentFillStyle = state.fillStyle; } if (strokeStyle !== undefined) { - ol.DEBUG && console.assert(lineCap !== undefined, 'lineCap should be defined'); - ol.DEBUG && console.assert(lineDash, 'lineDash should not be null'); - ol.DEBUG && console.assert(lineJoin !== undefined, 'lineJoin should be defined'); - ol.DEBUG && console.assert(lineWidth !== undefined, 'lineWidth should be defined'); - ol.DEBUG && console.assert(miterLimit !== undefined, + goog.DEBUG && console.assert(lineCap !== undefined, 'lineCap should be defined'); + goog.DEBUG && console.assert(lineDash, 'lineDash should not be null'); + goog.DEBUG && console.assert(lineJoin !== undefined, 'lineJoin should be defined'); + goog.DEBUG && console.assert(lineWidth !== undefined, 'lineWidth should be defined'); + goog.DEBUG && console.assert(miterLimit !== undefined, 'miterLimit should be defined'); if (state.currentStrokeStyle != strokeStyle || state.currentLineCap != lineCap || @@ -1942,7 +1942,7 @@ ol.render.canvas.ReplayGroup.prototype.getReplay = function(zIndex, replayType) var replay = replays[replayType]; if (replay === undefined) { var Constructor = ol.render.canvas.BATCH_CONSTRUCTORS_[replayType]; - ol.DEBUG && console.assert(Constructor !== undefined, + goog.DEBUG && console.assert(Constructor !== undefined, replayType + ' constructor missing from ol.render.canvas.BATCH_CONSTRUCTORS_'); replay = new Constructor(this.tolerance_, this.maxExtent_, diff --git a/src/ol/render/renderfeature.js b/src/ol/render/renderfeature.js index c3157b0025..2e09b5885c 100644 --- a/src/ol/render/renderfeature.js +++ b/src/ol/render/renderfeature.js @@ -25,7 +25,7 @@ ol.render.Feature = function(type, flatCoordinates, ends, properties) { */ this.extent_; - ol.DEBUG && console.assert(type === ol.geom.GeometryType.POINT || + goog.DEBUG && console.assert(type === ol.geom.GeometryType.POINT || type === ol.geom.GeometryType.MULTI_POINT || type === ol.geom.GeometryType.LINE_STRING || type === ol.geom.GeometryType.MULTI_LINE_STRING || diff --git a/src/ol/render/vector.js b/src/ol/render/vector.js index dc92528624..d5d0160c61 100644 --- a/src/ol/render/vector.js +++ b/src/ol/render/vector.js @@ -88,7 +88,7 @@ ol.renderer.vector.renderFeature = function( imageStyle.load(); } imageState = imageStyle.getImageState(); - ol.DEBUG && console.assert(imageState == ol.style.ImageState.LOADING, + goog.DEBUG && console.assert(imageState == ol.style.ImageState.LOADING, 'imageState should be LOADING'); imageStyle.listenImageChange(listener, thisArg); loading = true; @@ -116,7 +116,7 @@ ol.renderer.vector.renderFeature_ = function( var simplifiedGeometry = geometry.getSimplifiedGeometry(squaredTolerance); var geometryRenderer = ol.renderer.vector.GEOMETRY_RENDERERS_[simplifiedGeometry.getType()]; - ol.DEBUG && console.assert(geometryRenderer !== undefined, + goog.DEBUG && console.assert(geometryRenderer !== undefined, 'geometryRenderer should be defined'); geometryRenderer(replayGroup, simplifiedGeometry, style, feature); }; @@ -135,7 +135,7 @@ ol.renderer.vector.renderGeometryCollectionGeometry_ = function(replayGroup, geo for (i = 0, ii = geometries.length; i < ii; ++i) { var geometryRenderer = ol.renderer.vector.GEOMETRY_RENDERERS_[geometries[i].getType()]; - ol.DEBUG && console.assert(geometryRenderer !== undefined, + goog.DEBUG && console.assert(geometryRenderer !== undefined, 'geometryRenderer should be defined'); geometryRenderer(replayGroup, geometries[i], style, feature); } diff --git a/src/ol/render/webgl/webglimmediate.js b/src/ol/render/webgl/webglimmediate.js index 67d5d71363..c65ad5119b 100644 --- a/src/ol/render/webgl/webglimmediate.js +++ b/src/ol/render/webgl/webglimmediate.js @@ -98,7 +98,7 @@ ol.render.webgl.Immediate.prototype.drawGeometry = function(geometry) { this.drawGeometryCollection(/** @type {ol.geom.GeometryCollection} */ (geometry), null); break; default: - ol.DEBUG && console.assert(false, 'Unsupported geometry type: ' + type); + goog.DEBUG && console.assert(false, 'Unsupported geometry type: ' + type); } }; @@ -114,7 +114,7 @@ ol.render.webgl.Immediate.prototype.drawFeature = function(feature, style) { return; } this.setStyle(style); - ol.DEBUG && console.assert(geometry, 'geometry must be truthy'); + goog.DEBUG && console.assert(geometry, 'geometry must be truthy'); this.drawGeometry(geometry); }; diff --git a/src/ol/render/webgl/webglreplay.js b/src/ol/render/webgl/webglreplay.js index 8c718cc1a3..cbff43e21f 100644 --- a/src/ol/render/webgl/webglreplay.js +++ b/src/ol/render/webgl/webglreplay.js @@ -225,9 +225,9 @@ ol.render.webgl.ImageReplay.prototype.getDeleteResourcesFunction = function(cont // be used by other ImageReplay instances (for other layers). And // they will be deleted when disposing of the ol.webgl.Context // object. - ol.DEBUG && console.assert(this.verticesBuffer_, + goog.DEBUG && console.assert(this.verticesBuffer_, 'verticesBuffer must not be null'); - ol.DEBUG && console.assert(this.indicesBuffer_, + goog.DEBUG && console.assert(this.indicesBuffer_, 'indicesBuffer must not be null'); var verticesBuffer = this.verticesBuffer_; var indicesBuffer = this.indicesBuffer_; @@ -259,20 +259,20 @@ ol.render.webgl.ImageReplay.prototype.getDeleteResourcesFunction = function(cont * @private */ ol.render.webgl.ImageReplay.prototype.drawCoordinates_ = function(flatCoordinates, offset, end, stride) { - ol.DEBUG && console.assert(this.anchorX_ !== undefined, 'anchorX is defined'); - ol.DEBUG && console.assert(this.anchorY_ !== undefined, 'anchorY is defined'); - ol.DEBUG && console.assert(this.height_ !== undefined, 'height is defined'); - ol.DEBUG && console.assert(this.imageHeight_ !== undefined, + goog.DEBUG && console.assert(this.anchorX_ !== undefined, 'anchorX is defined'); + goog.DEBUG && console.assert(this.anchorY_ !== undefined, 'anchorY is defined'); + goog.DEBUG && console.assert(this.height_ !== undefined, 'height is defined'); + goog.DEBUG && console.assert(this.imageHeight_ !== undefined, 'imageHeight is defined'); - ol.DEBUG && console.assert(this.imageWidth_ !== undefined, 'imageWidth is defined'); - ol.DEBUG && console.assert(this.opacity_ !== undefined, 'opacity is defined'); - ol.DEBUG && console.assert(this.originX_ !== undefined, 'originX is defined'); - ol.DEBUG && console.assert(this.originY_ !== undefined, 'originY is defined'); - ol.DEBUG && console.assert(this.rotateWithView_ !== undefined, + goog.DEBUG && console.assert(this.imageWidth_ !== undefined, 'imageWidth is defined'); + goog.DEBUG && console.assert(this.opacity_ !== undefined, 'opacity is defined'); + goog.DEBUG && console.assert(this.originX_ !== undefined, 'originX is defined'); + goog.DEBUG && console.assert(this.originY_ !== undefined, 'originY is defined'); + goog.DEBUG && console.assert(this.rotateWithView_ !== undefined, 'rotateWithView is defined'); - ol.DEBUG && console.assert(this.rotation_ !== undefined, 'rotation is defined'); - ol.DEBUG && console.assert(this.scale_ !== undefined, 'scale is defined'); - ol.DEBUG && console.assert(this.width_ !== undefined, 'width is defined'); + goog.DEBUG && console.assert(this.rotation_ !== undefined, 'rotation is defined'); + goog.DEBUG && console.assert(this.scale_ !== undefined, 'scale is defined'); + goog.DEBUG && console.assert(this.width_ !== undefined, 'width is defined'); var anchorX = /** @type {number} */ (this.anchorX_); var anchorY = /** @type {number} */ (this.anchorY_); var height = /** @type {number} */ (this.height_); @@ -399,10 +399,10 @@ ol.render.webgl.ImageReplay.prototype.finish = function(context) { var gl = context.getGL(); this.groupIndices_.push(this.indices_.length); - ol.DEBUG && console.assert(this.images_.length === this.groupIndices_.length, + goog.DEBUG && console.assert(this.images_.length === this.groupIndices_.length, 'number of images and groupIndices match'); this.hitDetectionGroupIndices_.push(this.indices_.length); - ol.DEBUG && console.assert(this.hitDetectionImages_.length === + goog.DEBUG && console.assert(this.hitDetectionImages_.length === this.hitDetectionGroupIndices_.length, 'number of hitDetectionImages and hitDetectionGroupIndices match'); @@ -412,7 +412,7 @@ ol.render.webgl.ImageReplay.prototype.finish = function(context) { var indices = this.indices_; var bits = context.hasOESElementIndexUint ? 32 : 16; - ol.DEBUG && console.assert(indices[indices.length - 1] < Math.pow(2, bits), + goog.DEBUG && console.assert(indices[indices.length - 1] < Math.pow(2, bits), 'Too large element index detected [%s] (OES_element_index_uint "%s")', indices[indices.length - 1], context.hasOESElementIndexUint); @@ -425,12 +425,12 @@ ol.render.webgl.ImageReplay.prototype.finish = function(context) { var texturePerImage = {}; this.createTextures_(this.textures_, this.images_, texturePerImage, gl); - ol.DEBUG && console.assert(this.textures_.length === this.groupIndices_.length, + goog.DEBUG && console.assert(this.textures_.length === this.groupIndices_.length, 'number of textures and groupIndices match'); this.createTextures_(this.hitDetectionTextures_, this.hitDetectionImages_, texturePerImage, gl); - ol.DEBUG && console.assert(this.hitDetectionTextures_.length === + goog.DEBUG && console.assert(this.hitDetectionTextures_.length === this.hitDetectionGroupIndices_.length, 'number of hitDetectionTextures and hitDetectionGroupIndices match'); @@ -462,7 +462,7 @@ ol.render.webgl.ImageReplay.prototype.finish = function(context) { * @param {WebGLRenderingContext} gl Gl. */ ol.render.webgl.ImageReplay.prototype.createTextures_ = function(textures, images, texturePerImage, gl) { - ol.DEBUG && console.assert(textures.length === 0, + goog.DEBUG && console.assert(textures.length === 0, 'upon creation, textures is empty'); var texture, image, uid, i; @@ -507,12 +507,12 @@ ol.render.webgl.ImageReplay.prototype.replay = function(context, var gl = context.getGL(); // bind the vertices buffer - ol.DEBUG && console.assert(this.verticesBuffer_, + goog.DEBUG && console.assert(this.verticesBuffer_, 'verticesBuffer must not be null'); context.bindBuffer(ol.webgl.ARRAY_BUFFER, this.verticesBuffer_); // bind the indices buffer - ol.DEBUG && console.assert(this.indicesBuffer_, + goog.DEBUG && console.assert(this.indicesBuffer_, 'indecesBuffer must not be null'); context.bindBuffer(ol.webgl.ELEMENT_ARRAY_BUFFER, this.indicesBuffer_); @@ -611,7 +611,7 @@ ol.render.webgl.ImageReplay.prototype.replay = function(context, * @param {Array.} groupIndices Texture group indices. */ ol.render.webgl.ImageReplay.prototype.drawReplay_ = function(gl, context, skippedFeaturesHash, textures, groupIndices) { - ol.DEBUG && console.assert(textures.length === groupIndices.length, + goog.DEBUG && console.assert(textures.length === groupIndices.length, 'number of textures and groupIndeces match'); var elementType = context.hasOESElementIndexUint ? ol.webgl.UNSIGNED_INT : ol.webgl.UNSIGNED_SHORT; @@ -785,7 +785,7 @@ ol.render.webgl.ImageReplay.prototype.drawHitDetectionReplayAll_ = function(gl, */ ol.render.webgl.ImageReplay.prototype.drawHitDetectionReplayOneByOne_ = function(gl, context, skippedFeaturesHash, featureCallback, opt_hitExtent) { - ol.DEBUG && console.assert(this.hitDetectionTextures_.length === + goog.DEBUG && console.assert(this.hitDetectionTextures_.length === this.hitDetectionGroupIndices_.length, 'number of hitDetectionTextures and hitDetectionGroupIndices match'); var elementType = context.hasOESElementIndexUint ? @@ -850,21 +850,21 @@ ol.render.webgl.ImageReplay.prototype.setImageStyle = function(imageStyle) { var rotation = imageStyle.getRotation(); var size = imageStyle.getSize(); var scale = imageStyle.getScale(); - ol.DEBUG && console.assert(anchor, 'imageStyle anchor is not null'); - ol.DEBUG && console.assert(image, 'imageStyle image is not null'); - ol.DEBUG && console.assert(imageSize, + goog.DEBUG && console.assert(anchor, 'imageStyle anchor is not null'); + goog.DEBUG && console.assert(image, 'imageStyle image is not null'); + goog.DEBUG && console.assert(imageSize, 'imageStyle imageSize is not null'); - ol.DEBUG && console.assert(hitDetectionImage, + goog.DEBUG && console.assert(hitDetectionImage, 'imageStyle hitDetectionImage is not null'); - ol.DEBUG && console.assert(hitDetectionImageSize, + goog.DEBUG && console.assert(hitDetectionImageSize, 'imageStyle hitDetectionImageSize is not null'); - ol.DEBUG && console.assert(opacity !== undefined, 'imageStyle opacity is defined'); - ol.DEBUG && console.assert(origin, 'imageStyle origin is not null'); - ol.DEBUG && console.assert(rotateWithView !== undefined, + goog.DEBUG && console.assert(opacity !== undefined, 'imageStyle opacity is defined'); + goog.DEBUG && console.assert(origin, 'imageStyle origin is not null'); + goog.DEBUG && console.assert(rotateWithView !== undefined, 'imageStyle rotateWithView is defined'); - ol.DEBUG && console.assert(rotation !== undefined, 'imageStyle rotation is defined'); - ol.DEBUG && console.assert(size, 'imageStyle size is not null'); - ol.DEBUG && console.assert(scale !== undefined, 'imageStyle scale is defined'); + goog.DEBUG && console.assert(rotation !== undefined, 'imageStyle rotation is defined'); + goog.DEBUG && console.assert(size, 'imageStyle size is not null'); + goog.DEBUG && console.assert(scale !== undefined, 'imageStyle scale is defined'); var currentImage; if (this.images_.length === 0) { @@ -873,7 +873,7 @@ ol.render.webgl.ImageReplay.prototype.setImageStyle = function(imageStyle) { currentImage = this.images_[this.images_.length - 1]; if (ol.getUid(currentImage) != ol.getUid(image)) { this.groupIndices_.push(this.indices_.length); - ol.DEBUG && console.assert(this.groupIndices_.length === this.images_.length, + goog.DEBUG && console.assert(this.groupIndices_.length === this.images_.length, 'number of groupIndices and images match'); this.images_.push(image); } @@ -886,7 +886,7 @@ ol.render.webgl.ImageReplay.prototype.setImageStyle = function(imageStyle) { this.hitDetectionImages_[this.hitDetectionImages_.length - 1]; if (ol.getUid(currentImage) != ol.getUid(hitDetectionImage)) { this.hitDetectionGroupIndices_.push(this.indices_.length); - ol.DEBUG && console.assert(this.hitDetectionGroupIndices_.length === + goog.DEBUG && console.assert(this.hitDetectionGroupIndices_.length === this.hitDetectionImages_.length, 'number of hitDetectionGroupIndices and hitDetectionImages match'); this.hitDetectionImages_.push(hitDetectionImage); @@ -987,7 +987,7 @@ ol.render.webgl.ReplayGroup.prototype.getReplay = function(zIndex, replayType) { var replay = this.replays_[replayType]; if (replay === undefined) { var constructor = ol.render.webgl.BATCH_CONSTRUCTORS_[replayType]; - ol.DEBUG && console.assert(constructor !== undefined, + goog.DEBUG && console.assert(constructor !== undefined, replayType + ' constructor missing from ol.render.webgl.BATCH_CONSTRUCTORS_'); replay = new constructor(this.tolerance_, this.maxExtent_); diff --git a/src/ol/renderer/canvas/canvasimagelayerrenderer.js b/src/ol/renderer/canvas/canvasimagelayerrenderer.js index 6dce4f5e6b..367936a656 100644 --- a/src/ol/renderer/canvas/canvasimagelayerrenderer.js +++ b/src/ol/renderer/canvas/canvasimagelayerrenderer.js @@ -162,7 +162,7 @@ ol.renderer.canvas.ImageLayer.prototype.prepareFrame = function(frameState, laye if (!ol.ENABLE_RASTER_REPROJECTION) { var sourceProjection = imageSource.getProjection(); if (sourceProjection) { - ol.DEBUG && console.assert(ol.proj.equivalent(projection, sourceProjection), + goog.DEBUG && console.assert(ol.proj.equivalent(projection, sourceProjection), 'projection and sourceProjection are equivalent'); projection = sourceProjection; } diff --git a/src/ol/renderer/canvas/canvasmaprenderer.js b/src/ol/renderer/canvas/canvasmaprenderer.js index 2b7625e991..7ced0bde93 100644 --- a/src/ol/renderer/canvas/canvasmaprenderer.js +++ b/src/ol/renderer/canvas/canvasmaprenderer.js @@ -82,7 +82,7 @@ ol.renderer.canvas.Map.prototype.createLayerRenderer = function(layer) { } else if (ol.ENABLE_VECTOR && layer instanceof ol.layer.Vector) { return new ol.renderer.canvas.VectorLayer(layer); } else { - ol.DEBUG && console.assert(false, 'unexpected layer configuration'); + goog.DEBUG && console.assert(false, 'unexpected layer configuration'); return null; } }; diff --git a/src/ol/renderer/canvas/canvastilelayerrenderer.js b/src/ol/renderer/canvas/canvastilelayerrenderer.js index 18871191aa..d364f50403 100644 --- a/src/ol/renderer/canvas/canvastilelayerrenderer.js +++ b/src/ol/renderer/canvas/canvastilelayerrenderer.js @@ -142,7 +142,7 @@ ol.renderer.canvas.TileLayer.prototype.prepareFrame = function( if (!drawableTile(tile) && tile.interimTile) { tile = tile.interimTile; } - ol.DEBUG && console.assert(tile); + goog.DEBUG && console.assert(tile); if (drawableTile(tile)) { tilesToDrawByZ[z][tile.tileCoord.toString()] = tile; continue; diff --git a/src/ol/renderer/canvas/canvasvectorlayerrenderer.js b/src/ol/renderer/canvas/canvasvectorlayerrenderer.js index c7fa4c20ba..7134a8c025 100644 --- a/src/ol/renderer/canvas/canvasvectorlayerrenderer.js +++ b/src/ol/renderer/canvas/canvasvectorlayerrenderer.js @@ -172,7 +172,7 @@ ol.renderer.canvas.VectorLayer.prototype.forEachFeatureAtCoordinate = function(c * @return {?} Callback result. */ function(feature) { - ol.DEBUG && console.assert(feature !== undefined, 'received a feature'); + goog.DEBUG && console.assert(feature !== undefined, 'received a feature'); var key = ol.getUid(feature).toString(); if (!(key in features)) { features[key] = true; diff --git a/src/ol/renderer/canvas/canvasvectortilelayerrenderer.js b/src/ol/renderer/canvas/canvasvectortilelayerrenderer.js index da9b19322a..e5897c16fd 100644 --- a/src/ol/renderer/canvas/canvasvectortilelayerrenderer.js +++ b/src/ol/renderer/canvas/canvasvectortilelayerrenderer.js @@ -306,7 +306,7 @@ ol.renderer.canvas.VectorTileLayer.prototype.forEachFeatureAtCoordinate = functi * @return {?} Callback result. */ function(feature) { - ol.DEBUG && console.assert(feature, 'received a feature'); + goog.DEBUG && console.assert(feature, 'received a feature'); var key = ol.getUid(feature).toString(); if (!(key in features)) { features[key] = true; diff --git a/src/ol/renderer/dom/domimagelayerrenderer.js b/src/ol/renderer/dom/domimagelayerrenderer.js index f9a7d5fc1b..a8bc3c0616 100644 --- a/src/ol/renderer/dom/domimagelayerrenderer.js +++ b/src/ol/renderer/dom/domimagelayerrenderer.js @@ -96,7 +96,7 @@ ol.renderer.dom.ImageLayer.prototype.prepareFrame = function(frameState, layerSt if (!ol.ENABLE_RASTER_REPROJECTION) { var sourceProjection = imageSource.getProjection(); if (sourceProjection) { - ol.DEBUG && console.assert(ol.proj.equivalent(projection, sourceProjection), + goog.DEBUG && console.assert(ol.proj.equivalent(projection, sourceProjection), 'projection and sourceProjection are equivalent'); projection = sourceProjection; } diff --git a/src/ol/renderer/dom/dommaprenderer.js b/src/ol/renderer/dom/dommaprenderer.js index 6b909d7076..219daf2b10 100644 --- a/src/ol/renderer/dom/dommaprenderer.js +++ b/src/ol/renderer/dom/dommaprenderer.js @@ -100,7 +100,7 @@ ol.renderer.dom.Map.prototype.createLayerRenderer = function(layer) { } else if (ol.ENABLE_VECTOR && layer instanceof ol.layer.Vector) { layerRenderer = new ol.renderer.dom.VectorLayer(layer); } else { - ol.DEBUG && console.assert(false, 'unexpected layer configuration'); + goog.DEBUG && console.assert(false, 'unexpected layer configuration'); return null; } return layerRenderer; diff --git a/src/ol/renderer/dom/domtilelayerrenderer.js b/src/ol/renderer/dom/domtilelayerrenderer.js index 3459fc037f..b5cf1015a4 100644 --- a/src/ol/renderer/dom/domtilelayerrenderer.js +++ b/src/ol/renderer/dom/domtilelayerrenderer.js @@ -128,7 +128,7 @@ ol.renderer.dom.TileLayer.prototype.prepareFrame = function(frameState, layerSta if (!drawable && tile.interimTile) { tile = tile.interimTile; } - ol.DEBUG && console.assert(tile); + goog.DEBUG && console.assert(tile); tileState = tile.getState(); if (tileState == ol.TileState.LOADED) { tilesToDrawByZ[z][tile.tileCoord.toString()] = tile; @@ -332,7 +332,7 @@ ol.renderer.dom.TileLayerZ_.prototype.addTile = function(tile, tileGutter) { var tileCoordZ = tileCoord[0]; var tileCoordX = tileCoord[1]; var tileCoordY = tileCoord[2]; - ol.DEBUG && console.assert(tileCoordZ == this.tileCoordOrigin_[0], + goog.DEBUG && console.assert(tileCoordZ == this.tileCoordOrigin_[0], 'tileCoordZ matches z of tileCoordOrigin'); var tileCoordKey = tileCoord.toString(); if (tileCoordKey in this.tiles_) { diff --git a/src/ol/renderer/dom/domvectorlayerrenderer.js b/src/ol/renderer/dom/domvectorlayerrenderer.js index 3af6ad3d15..f4355fed4b 100644 --- a/src/ol/renderer/dom/domvectorlayerrenderer.js +++ b/src/ol/renderer/dom/domvectorlayerrenderer.js @@ -190,7 +190,7 @@ ol.renderer.dom.VectorLayer.prototype.forEachFeatureAtCoordinate = function(coor * @return {?} Callback result. */ function(feature) { - ol.DEBUG && console.assert(feature !== undefined, 'received a feature'); + goog.DEBUG && console.assert(feature !== undefined, 'received a feature'); var key = ol.getUid(feature).toString(); if (!(key in features)) { features[key] = true; diff --git a/src/ol/renderer/layerrenderer.js b/src/ol/renderer/layerrenderer.js index 6d251a88f4..8d8b663bb1 100644 --- a/src/ol/renderer/layerrenderer.js +++ b/src/ol/renderer/layerrenderer.js @@ -143,7 +143,7 @@ ol.renderer.Layer.prototype.loadImage = function(image) { imageState != ol.ImageState.ERROR) { // the image is either "idle" or "loading", register the change // listener (a noop if the listener was already registered) - ol.DEBUG && console.assert(imageState == ol.ImageState.IDLE || + goog.DEBUG && console.assert(imageState == ol.ImageState.IDLE || imageState == ol.ImageState.LOADING, 'imageState is "idle" or "loading"'); ol.events.listen(image, ol.events.EventType.CHANGE, @@ -152,7 +152,7 @@ ol.renderer.Layer.prototype.loadImage = function(image) { if (imageState == ol.ImageState.IDLE) { image.load(); imageState = image.getState(); - ol.DEBUG && console.assert(imageState == ol.ImageState.LOADING || + goog.DEBUG && console.assert(imageState == ol.ImageState.LOADING || imageState == ol.ImageState.LOADED, 'imageState is "loading" or "loaded"'); } diff --git a/src/ol/renderer/maprenderer.js b/src/ol/renderer/maprenderer.js index 368df0e2e0..dab4024c33 100644 --- a/src/ol/renderer/maprenderer.js +++ b/src/ol/renderer/maprenderer.js @@ -66,7 +66,7 @@ ol.renderer.Map.prototype.calculateMatrices2D = function(frameState) { var viewState = frameState.viewState; var coordinateToPixelTransform = frameState.coordinateToPixelTransform; var pixelToCoordinateTransform = frameState.pixelToCoordinateTransform; - ol.DEBUG && console.assert(coordinateToPixelTransform, + goog.DEBUG && console.assert(coordinateToPixelTransform, 'frameState has a coordinateToPixelTransform'); ol.transform.compose(coordinateToPixelTransform, @@ -135,7 +135,7 @@ ol.renderer.Map.prototype.forEachFeatureAtCoordinate = function(coordinate, fram * @return {?} Callback result. */ function forEachFeatureAtCoordinate(feature, layer) { - ol.DEBUG && console.assert(feature !== undefined, 'received a feature'); + goog.DEBUG && console.assert(feature !== undefined, 'received a feature'); var key = ol.getUid(feature).toString(); var managed = frameState.layerStates[ol.getUid(layer)].managed; if (!(key in frameState.skippedFeatureUids && !managed)) { @@ -264,7 +264,7 @@ ol.renderer.Map.prototype.getLayerRenderer = function(layer) { * @return {ol.renderer.Layer} Layer renderer. */ ol.renderer.Map.prototype.getLayerRendererByKey = function(layerKey) { - ol.DEBUG && console.assert(layerKey in this.layerRenderers_, + goog.DEBUG && console.assert(layerKey in this.layerRenderers_, 'given layerKey (%s) exists in layerRenderers', layerKey); return this.layerRenderers_[layerKey]; }; @@ -309,12 +309,12 @@ ol.renderer.Map.prototype.handleLayerRendererChange_ = function() { * @private */ ol.renderer.Map.prototype.removeLayerRendererByKey_ = function(layerKey) { - ol.DEBUG && console.assert(layerKey in this.layerRenderers_, + goog.DEBUG && console.assert(layerKey in this.layerRenderers_, 'given layerKey (%s) exists in layerRenderers', layerKey); var layerRenderer = this.layerRenderers_[layerKey]; delete this.layerRenderers_[layerKey]; - ol.DEBUG && console.assert(layerKey in this.layerRendererListeners_, + goog.DEBUG && console.assert(layerKey in this.layerRendererListeners_, 'given layerKey (%s) exists in layerRendererListeners', layerKey); ol.events.unlistenByKey(this.layerRendererListeners_[layerKey]); delete this.layerRendererListeners_[layerKey]; diff --git a/src/ol/renderer/webgl/webglimagelayerrenderer.js b/src/ol/renderer/webgl/webglimagelayerrenderer.js index 4467ab167a..e54dec1fcb 100644 --- a/src/ol/renderer/webgl/webglimagelayerrenderer.js +++ b/src/ol/renderer/webgl/webglimagelayerrenderer.js @@ -119,7 +119,7 @@ ol.renderer.webgl.ImageLayer.prototype.prepareFrame = function(frameState, layer if (!ol.ENABLE_RASTER_REPROJECTION) { var sourceProjection = imageSource.getProjection(); if (sourceProjection) { - ol.DEBUG && console.assert(ol.proj.equivalent(projection, sourceProjection), + goog.DEBUG && console.assert(ol.proj.equivalent(projection, sourceProjection), 'projection and sourceProjection are equivalent'); projection = sourceProjection; } @@ -150,7 +150,7 @@ ol.renderer.webgl.ImageLayer.prototype.prepareFrame = function(frameState, layer } if (image) { - ol.DEBUG && console.assert(texture, 'texture is truthy'); + goog.DEBUG && console.assert(texture, 'texture is truthy'); var canvas = this.mapRenderer.getContext().getCanvas(); diff --git a/src/ol/renderer/webgl/webglmaprenderer.js b/src/ol/renderer/webgl/webglmaprenderer.js index 99c9317544..3bc83b689d 100644 --- a/src/ol/renderer/webgl/webglmaprenderer.js +++ b/src/ol/renderer/webgl/webglmaprenderer.js @@ -85,7 +85,7 @@ ol.renderer.webgl.Map = function(container, map) { preserveDrawingBuffer: false, stencil: true }); - ol.DEBUG && console.assert(this.gl_, 'got a WebGLRenderingContext'); + goog.DEBUG && console.assert(this.gl_, 'got a WebGLRenderingContext'); /** * @private @@ -182,7 +182,7 @@ ol.renderer.webgl.Map.prototype.bindTileTexture = function(tile, tileSize, tileG var tileKey = tile.getKey(); if (this.textureCache_.containsKey(tileKey)) { var textureCacheEntry = this.textureCache_.get(tileKey); - ol.DEBUG && console.assert(textureCacheEntry, + goog.DEBUG && console.assert(textureCacheEntry, 'a texture cache entry exists for key %s', tileKey); gl.bindTexture(ol.webgl.TEXTURE_2D, textureCacheEntry.texture); if (textureCacheEntry.magFilter != magFilter) { @@ -248,7 +248,7 @@ ol.renderer.webgl.Map.prototype.createLayerRenderer = function(layer) { } else if (ol.ENABLE_VECTOR && layer instanceof ol.layer.Vector) { return new ol.renderer.webgl.VectorLayer(this, layer); } else { - ol.DEBUG && console.assert(false, 'unexpected layer configuration'); + goog.DEBUG && console.assert(false, 'unexpected layer configuration'); return null; } }; diff --git a/src/ol/renderer/webgl/webgltilelayerrenderer.js b/src/ol/renderer/webgl/webgltilelayerrenderer.js index 3789a9db5b..65e5aedb13 100644 --- a/src/ol/renderer/webgl/webgltilelayerrenderer.js +++ b/src/ol/renderer/webgl/webgltilelayerrenderer.js @@ -258,7 +258,7 @@ ol.renderer.webgl.TileLayer.prototype.prepareFrame = function(frameState, layerS if (!drawable && tile.interimTile) { tile = tile.interimTile; } - ol.DEBUG && console.assert(tile); + goog.DEBUG && console.assert(tile); tileState = tile.getState(); if (tileState == ol.TileState.LOADED) { if (mapRenderer.isTileTextureLoaded(tile)) { diff --git a/src/ol/renderer/webgl/webglvectorlayerrenderer.js b/src/ol/renderer/webgl/webglvectorlayerrenderer.js index 6637109b44..af11ceca83 100644 --- a/src/ol/renderer/webgl/webglvectorlayerrenderer.js +++ b/src/ol/renderer/webgl/webglvectorlayerrenderer.js @@ -120,7 +120,7 @@ ol.renderer.webgl.VectorLayer.prototype.forEachFeatureAtCoordinate = function(co * @return {?} Callback result. */ function(feature) { - ol.DEBUG && console.assert(feature !== undefined, 'received a feature'); + goog.DEBUG && console.assert(feature !== undefined, 'received a feature'); var key = ol.getUid(feature).toString(); if (!(key in features)) { features[key] = true; diff --git a/src/ol/reproj/image.js b/src/ol/reproj/image.js index c2744bba48..7b929ec552 100644 --- a/src/ol/reproj/image.js +++ b/src/ol/reproj/image.js @@ -194,7 +194,7 @@ ol.reproj.Image.prototype.load = function() { * @private */ ol.reproj.Image.prototype.unlistenSource_ = function() { - ol.DEBUG && console.assert(this.sourceListenerKey_, + goog.DEBUG && console.assert(this.sourceListenerKey_, 'this.sourceListenerKey_ should not be null'); ol.events.unlistenByKey(/** @type {!ol.EventsKey} */ (this.sourceListenerKey_)); this.sourceListenerKey_ = null; diff --git a/src/ol/reproj/tile.js b/src/ol/reproj/tile.js index 39aec3f06d..7a99b971b1 100644 --- a/src/ol/reproj/tile.js +++ b/src/ol/reproj/tile.js @@ -181,7 +181,7 @@ ol.reproj.Tile = function(sourceProj, sourceTileGrid, sourceExtent, this.sourceZ_); var tilesRequired = sourceRange.getWidth() * sourceRange.getHeight(); - if (ol.DEBUG && !(tilesRequired < ol.RASTER_REPROJECTION_MAX_SOURCE_TILES)) { + if (goog.DEBUG && !(tilesRequired < ol.RASTER_REPROJECTION_MAX_SOURCE_TILES)) { console.assert(false, 'reasonable number of tiles is required'); this.state = ol.TileState.ERROR; return; @@ -284,7 +284,7 @@ ol.reproj.Tile.prototype.load = function() { var leftToLoad = 0; - ol.DEBUG && console.assert(!this.sourcesListenerKeys_, + goog.DEBUG && console.assert(!this.sourcesListenerKeys_, 'this.sourcesListenerKeys_ should be null'); this.sourcesListenerKeys_ = []; @@ -302,7 +302,7 @@ ol.reproj.Tile.prototype.load = function() { state == ol.TileState.EMPTY) { ol.events.unlistenByKey(sourceListenKey); leftToLoad--; - ol.DEBUG && console.assert(leftToLoad >= 0, + goog.DEBUG && console.assert(leftToLoad >= 0, 'leftToLoad should not be negative'); if (leftToLoad === 0) { this.unlistenSources_(); @@ -332,7 +332,7 @@ ol.reproj.Tile.prototype.load = function() { * @private */ ol.reproj.Tile.prototype.unlistenSources_ = function() { - ol.DEBUG && console.assert(this.sourcesListenerKeys_, + goog.DEBUG && console.assert(this.sourcesListenerKeys_, 'this.sourcesListenerKeys_ should not be null'); this.sourcesListenerKeys_.forEach(ol.events.unlistenByKey); this.sourcesListenerKeys_ = null; diff --git a/src/ol/reproj/triangulation.js b/src/ol/reproj/triangulation.js index 5630cfa8bd..8a1aa2c149 100644 --- a/src/ol/reproj/triangulation.js +++ b/src/ol/reproj/triangulation.js @@ -117,7 +117,7 @@ ol.reproj.Triangulation = function(sourceProj, targetProj, targetExtent, // Fix coordinates (ol.proj returns wrapped coordinates, "unwrap" here). // This significantly simplifies the rest of the reprojection process. - ol.DEBUG && console.assert(this.sourceWorldWidth_ !== null); + goog.DEBUG && console.assert(this.sourceWorldWidth_ !== null); var leftBound = Infinity; this.triangles_.forEach(function(triangle, i, arr) { leftBound = Math.min(leftBound, diff --git a/src/ol/source/bingmapssource.js b/src/ol/source/bingmapssource.js index fd067936ca..21f534e8f1 100644 --- a/src/ol/source/bingmapssource.js +++ b/src/ol/source/bingmapssource.js @@ -90,7 +90,7 @@ ol.source.BingMaps.prototype.handleImageryMetadataResponse = function(response) } //var copyright = response.copyright; // FIXME do we need to display this? var resource = response.resourceSets[0].resources[0]; - ol.DEBUG && console.assert(resource.imageWidth == resource.imageHeight, + goog.DEBUG && console.assert(resource.imageWidth == resource.imageHeight, 'resource has imageWidth equal to imageHeight, i.e. is square'); var maxZoom = this.maxZoom_ == -1 ? resource.zoomMax : this.maxZoom_; @@ -121,7 +121,7 @@ ol.source.BingMaps.prototype.handleImageryMetadataResponse = function(response) * @return {string|undefined} Tile URL. */ function(tileCoord, pixelRatio, projection) { - ol.DEBUG && console.assert(ol.proj.equivalent( + goog.DEBUG && console.assert(ol.proj.equivalent( projection, sourceProjection), 'projections are equivalent'); if (!tileCoord) { diff --git a/src/ol/source/clustersource.js b/src/ol/source/clustersource.js index 8005e2bbf5..074ce99acd 100644 --- a/src/ol/source/clustersource.js +++ b/src/ol/source/clustersource.js @@ -136,7 +136,7 @@ ol.source.Cluster.prototype.cluster_ = function() { ol.extent.buffer(extent, mapDistance, extent); var neighbors = this.source_.getFeaturesInExtent(extent); - ol.DEBUG && console.assert(neighbors.length >= 1, 'at least one neighbor found'); + goog.DEBUG && console.assert(neighbors.length >= 1, 'at least one neighbor found'); neighbors = neighbors.filter(function(neighbor) { var uid = ol.getUid(neighbor).toString(); if (!(uid in clustered)) { @@ -150,7 +150,7 @@ ol.source.Cluster.prototype.cluster_ = function() { } } } - ol.DEBUG && console.assert( + goog.DEBUG && console.assert( Object.keys(clustered).length == this.source_.getFeatures().length, 'number of clustered equals number of features in the source'); }; diff --git a/src/ol/source/imagearcgisrestsource.js b/src/ol/source/imagearcgisrestsource.js index 5d55481593..d9e4cf0267 100644 --- a/src/ol/source/imagearcgisrestsource.js +++ b/src/ol/source/imagearcgisrestsource.js @@ -195,7 +195,7 @@ ol.source.ImageArcGISRest.prototype.getImageLoadFunction = function() { */ ol.source.ImageArcGISRest.prototype.getRequestUrl_ = function(extent, size, pixelRatio, projection, params) { - ol.DEBUG && console.assert(this.url_ !== undefined, 'url is defined'); + goog.DEBUG && console.assert(this.url_ !== undefined, 'url is defined'); // ArcGIS Server only wants the numeric portion of the projection ID. var srid = projection.getCode().split(':').pop(); diff --git a/src/ol/source/imagesource.js b/src/ol/source/imagesource.js index bb4637826e..3336ef0593 100644 --- a/src/ol/source/imagesource.js +++ b/src/ol/source/imagesource.js @@ -37,7 +37,7 @@ ol.source.Image = function(options) { */ this.resolutions_ = options.resolutions !== undefined ? options.resolutions : null; - ol.DEBUG && console.assert(!this.resolutions_ || + goog.DEBUG && console.assert(!this.resolutions_ || ol.array.isSorted(this.resolutions_, function(a, b) { return b - a; diff --git a/src/ol/source/imagevectorsource.js b/src/ol/source/imagevectorsource.js index b772b74578..00568958f8 100644 --- a/src/ol/source/imagevectorsource.js +++ b/src/ol/source/imagevectorsource.js @@ -168,7 +168,7 @@ ol.source.ImageVector.prototype.forEachFeatureAtCoordinate = function( * @return {?} Callback result. */ function(feature) { - ol.DEBUG && console.assert(feature !== undefined, 'passed a feature'); + goog.DEBUG && console.assert(feature !== undefined, 'passed a feature'); var key = ol.getUid(feature).toString(); if (!(key in features)) { features[key] = true; diff --git a/src/ol/source/imagewmssource.js b/src/ol/source/imagewmssource.js index ee2eb5bd85..3dc5cba63d 100644 --- a/src/ol/source/imagewmssource.js +++ b/src/ol/source/imagewmssource.js @@ -135,7 +135,7 @@ ol.source.ImageWMS.GETFEATUREINFO_IMAGE_SIZE_ = [101, 101]; */ ol.source.ImageWMS.prototype.getGetFeatureInfoUrl = function(coordinate, resolution, projection, params) { - ol.DEBUG && console.assert(!('VERSION' in params), + goog.DEBUG && console.assert(!('VERSION' in params), 'key VERSION is not allowed in params'); if (this.url_ === undefined) { diff --git a/src/ol/source/rastersource.js b/src/ol/source/rastersource.js index 48c90392b9..6ceb09750a 100644 --- a/src/ol/source/rastersource.js +++ b/src/ol/source/rastersource.js @@ -424,7 +424,7 @@ ol.source.Raster.createRenderer_ = function(source) { } else if (source instanceof ol.source.Image) { renderer = ol.source.Raster.createImageRenderer_(source); } else { - ol.DEBUG && console.assert(false, 'Unsupported source type: ' + source); + goog.DEBUG && console.assert(false, 'Unsupported source type: ' + source); } return renderer; }; diff --git a/src/ol/source/stamensource.js b/src/ol/source/stamensource.js index 762d16aa21..ee5becf812 100644 --- a/src/ol/source/stamensource.js +++ b/src/ol/source/stamensource.js @@ -88,11 +88,11 @@ ol.source.Stamen = function(options) { var i = options.layer.indexOf('-'); var provider = i == -1 ? options.layer : options.layer.slice(0, i); - ol.DEBUG && console.assert(provider in ol.source.StamenProviderConfig, + goog.DEBUG && console.assert(provider in ol.source.StamenProviderConfig, 'known provider configured'); var providerConfig = ol.source.StamenProviderConfig[provider]; - ol.DEBUG && console.assert(options.layer in ol.source.StamenLayerConfig, + goog.DEBUG && console.assert(options.layer in ol.source.StamenLayerConfig, 'known layer configured'); var layerConfig = ol.source.StamenLayerConfig[options.layer]; diff --git a/src/ol/source/tileimagesource.js b/src/ol/source/tileimagesource.js index bbe20f3296..d5abe6337f 100644 --- a/src/ol/source/tileimagesource.js +++ b/src/ol/source/tileimagesource.js @@ -301,8 +301,8 @@ ol.source.TileImage.prototype.getTileInternal = function(z, x, y, pixelRatio, pr // cases we attempt to assign an interim tile to the new tile. var /** @type {ol.Tile} */ interimTile = tile; if (tile.interimTile && tile.interimTile.key == key) { - ol.DEBUG && console.assert(tile.interimTile.getState() == ol.TileState.LOADED); - ol.DEBUG && console.assert(tile.interimTile.interimTile === null); + goog.DEBUG && console.assert(tile.interimTile.getState() == ol.TileState.LOADED); + goog.DEBUG && console.assert(tile.interimTile.interimTile === null); tile = tile.interimTile; if (interimTile.getState() == ol.TileState.LOADED) { tile.interimTile = interimTile; diff --git a/src/ol/source/tilejsonsource.js b/src/ol/source/tilejsonsource.js index df71bc75d1..f8267530fc 100644 --- a/src/ol/source/tilejsonsource.js +++ b/src/ol/source/tilejsonsource.js @@ -117,7 +117,7 @@ ol.source.TileJSON.prototype.handleTileJSONResponse = function(tileJSON) { } if (tileJSON.scheme !== undefined) { - ol.DEBUG && console.assert(tileJSON.scheme == 'xyz', 'tileJSON-scheme is "xyz"'); + goog.DEBUG && console.assert(tileJSON.scheme == 'xyz', 'tileJSON-scheme is "xyz"'); } var minZoom = tileJSON.minzoom || 0; var maxZoom = tileJSON.maxzoom || 22; diff --git a/src/ol/source/tilesource.js b/src/ol/source/tilesource.js index 99dca783e7..eb2d81e210 100644 --- a/src/ol/source/tilesource.js +++ b/src/ol/source/tilesource.js @@ -282,7 +282,7 @@ ol.source.Tile.prototype.getTileCoordForTileUrlFunction = function(tileCoord, op var projection = opt_projection !== undefined ? opt_projection : this.getProjection(); var tileGrid = this.getTileGridForProjection(projection); - ol.DEBUG && console.assert(tileGrid, 'tile grid needed'); + goog.DEBUG && console.assert(tileGrid, 'tile grid needed'); if (this.getWrapX() && projection.isGlobal()) { tileCoord = ol.tilecoord.wrapX(tileCoord, tileGrid, projection); } diff --git a/src/ol/source/tileutfgridsource.js b/src/ol/source/tileutfgridsource.js index b4cbc7b27b..aba70e5ef8 100644 --- a/src/ol/source/tileutfgridsource.js +++ b/src/ol/source/tileutfgridsource.js @@ -174,7 +174,7 @@ ol.source.TileUTFGrid.prototype.handleTileJSONResponse = function(tileJSON) { } if (tileJSON.scheme !== undefined) { - ol.DEBUG && console.assert(tileJSON.scheme == 'xyz', 'tileJSON-scheme is "xyz"'); + goog.DEBUG && console.assert(tileJSON.scheme == 'xyz', 'tileJSON-scheme is "xyz"'); } var minZoom = tileJSON.minzoom || 0; var maxZoom = tileJSON.maxzoom || 22; @@ -228,7 +228,7 @@ ol.source.TileUTFGrid.prototype.getTile = function(z, x, y, pixelRatio, projecti if (this.tileCache.containsKey(tileCoordKey)) { return /** @type {!ol.Tile} */ (this.tileCache.get(tileCoordKey)); } else { - ol.DEBUG && console.assert(projection, 'argument projection is truthy'); + goog.DEBUG && console.assert(projection, 'argument projection is truthy'); var tileCoord = [z, x, y]; var urlTileCoord = this.getTileCoordForTileUrlFunction(tileCoord, projection); diff --git a/src/ol/source/tilewmssource.js b/src/ol/source/tilewmssource.js index afe4a9f929..38fff284bb 100644 --- a/src/ol/source/tilewmssource.js +++ b/src/ol/source/tilewmssource.js @@ -116,7 +116,7 @@ ol.inherits(ol.source.TileWMS, ol.source.TileImage); */ ol.source.TileWMS.prototype.getGetFeatureInfoUrl = function(coordinate, resolution, projection, params) { - ol.DEBUG && console.assert(!('VERSION' in params), + goog.DEBUG && console.assert(!('VERSION' in params), 'key VERSION is not allowed in params'); var projectionObj = ol.proj.get(projection); diff --git a/src/ol/source/vectorsource.js b/src/ol/source/vectorsource.js index af03040ac6..4a0974515c 100644 --- a/src/ol/source/vectorsource.js +++ b/src/ol/source/vectorsource.js @@ -232,7 +232,7 @@ ol.source.Vector.prototype.addFeatureInternal = function(feature) { * @private */ ol.source.Vector.prototype.setupChangeEvents_ = function(featureKey, feature) { - ol.DEBUG && console.assert(!(featureKey in this.featureChangeKeys_), + goog.DEBUG && console.assert(!(featureKey in this.featureChangeKeys_), 'key (%s) not yet registered in featureChangeKey', featureKey); this.featureChangeKeys_[featureKey] = [ ol.events.listen(feature, ol.events.EventType.CHANGE, @@ -329,7 +329,7 @@ ol.source.Vector.prototype.addFeaturesInternal = function(features) { * @private */ ol.source.Vector.prototype.bindFeaturesCollection_ = function(collection) { - ol.DEBUG && console.assert(!this.featuresCollection_, + goog.DEBUG && console.assert(!this.featuresCollection_, 'bindFeaturesCollection can only be called once'); var modifyingCollection = false; ol.events.listen(this, ol.source.VectorEventType.ADDFEATURE, @@ -395,11 +395,11 @@ ol.source.Vector.prototype.clear = function(opt_fast) { if (this.featuresCollection_) { this.featuresCollection_.clear(); } - ol.DEBUG && console.assert(ol.object.isEmpty(this.featureChangeKeys_), + goog.DEBUG && console.assert(ol.object.isEmpty(this.featureChangeKeys_), 'featureChangeKeys is an empty object now'); - ol.DEBUG && console.assert(ol.object.isEmpty(this.idIndex_), + goog.DEBUG && console.assert(ol.object.isEmpty(this.idIndex_), 'idIndex is an empty object now'); - ol.DEBUG && console.assert(ol.object.isEmpty(this.undefIdIndex_), + goog.DEBUG && console.assert(ol.object.isEmpty(this.undefIdIndex_), 'undefIdIndex is an empty object now'); if (this.featuresRtree_) { @@ -452,7 +452,7 @@ ol.source.Vector.prototype.forEachFeatureAtCoordinateDirect = function(coordinat var extent = [coordinate[0], coordinate[1], coordinate[0], coordinate[1]]; return this.forEachFeatureInExtent(extent, function(feature) { var geometry = feature.getGeometry(); - ol.DEBUG && console.assert(geometry, 'feature geometry is defined and not null'); + goog.DEBUG && console.assert(geometry, 'feature geometry is defined and not null'); if (geometry.containsCoordinate(coordinate)) { return callback.call(opt_this, feature); } else { @@ -518,7 +518,7 @@ ol.source.Vector.prototype.forEachFeatureIntersectingExtent = function(extent, c */ function(feature) { var geometry = feature.getGeometry(); - ol.DEBUG && console.assert(geometry, + goog.DEBUG && console.assert(geometry, 'feature geometry is defined and not null'); if (geometry.intersectsExtent(extent)) { var result = callback.call(opt_this, feature); @@ -589,7 +589,7 @@ ol.source.Vector.prototype.getFeaturesAtCoordinate = function(coordinate) { * @api */ ol.source.Vector.prototype.getFeaturesInExtent = function(extent) { - ol.DEBUG && console.assert(this.featuresRtree_, + goog.DEBUG && console.assert(this.featuresRtree_, 'getFeaturesInExtent does not work when useSpatialIndex is set to false'); return this.featuresRtree_.getInExtent(extent); }; @@ -621,7 +621,7 @@ ol.source.Vector.prototype.getClosestFeatureToCoordinate = function(coordinate, var closestPoint = [NaN, NaN]; var minSquaredDistance = Infinity; var extent = [-Infinity, -Infinity, Infinity, Infinity]; - ol.DEBUG && console.assert(this.featuresRtree_, + goog.DEBUG && console.assert(this.featuresRtree_, 'getClosestFeatureToCoordinate does not work with useSpatialIndex set ' + 'to false'); var filter = opt_filter ? opt_filter : ol.functions.TRUE; @@ -632,7 +632,7 @@ ol.source.Vector.prototype.getClosestFeatureToCoordinate = function(coordinate, function(feature) { if (filter(feature)) { var geometry = feature.getGeometry(); - ol.DEBUG && console.assert(geometry, + goog.DEBUG && console.assert(geometry, 'feature geometry is defined and not null'); var previousMinSquaredDistance = minSquaredDistance; minSquaredDistance = geometry.closestPointXY( @@ -664,7 +664,7 @@ ol.source.Vector.prototype.getClosestFeatureToCoordinate = function(coordinate, * @api stable */ ol.source.Vector.prototype.getExtent = function() { - ol.DEBUG && console.assert(this.featuresRtree_, + goog.DEBUG && console.assert(this.featuresRtree_, 'getExtent does not work when useSpatialIndex is set to false'); return this.featuresRtree_.getExtent(); }; @@ -745,7 +745,7 @@ ol.source.Vector.prototype.handleFeatureChange_ = function(event) { } else { if (this.idIndex_[sid] !== feature) { removed = this.removeFromIdIndex_(feature); - ol.DEBUG && console.assert(removed, + goog.DEBUG && console.assert(removed, 'Expected feature to be removed from index'); this.idIndex_[sid] = feature; } @@ -753,11 +753,11 @@ ol.source.Vector.prototype.handleFeatureChange_ = function(event) { } else { if (!(featureKey in this.undefIdIndex_)) { removed = this.removeFromIdIndex_(feature); - ol.DEBUG && console.assert(removed, + goog.DEBUG && console.assert(removed, 'Expected feature to be removed from index'); this.undefIdIndex_[featureKey] = feature; } else { - ol.DEBUG && console.assert(this.undefIdIndex_[featureKey] === feature, + goog.DEBUG && console.assert(this.undefIdIndex_[featureKey] === feature, 'feature keyed under %s in undefIdKeys', featureKey); } } @@ -832,7 +832,7 @@ ol.source.Vector.prototype.removeFeature = function(feature) { */ ol.source.Vector.prototype.removeFeatureInternal = function(feature) { var featureKey = ol.getUid(feature).toString(); - ol.DEBUG && console.assert(featureKey in this.featureChangeKeys_, + goog.DEBUG && console.assert(featureKey in this.featureChangeKeys_, 'featureKey exists in featureChangeKeys'); this.featureChangeKeys_[featureKey].forEach(ol.events.unlistenByKey); delete this.featureChangeKeys_[featureKey]; diff --git a/src/ol/source/wmtssource.js b/src/ol/source/wmtssource.js index a481428d6f..f0d1e6a9f3 100644 --- a/src/ol/source/wmtssource.js +++ b/src/ol/source/wmtssource.js @@ -307,16 +307,16 @@ ol.source.WMTS.prototype.updateDimensions = function(dimensions) { ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) { // TODO: add support for TileMatrixLimits - ol.DEBUG && console.assert(config['layer'], + goog.DEBUG && console.assert(config['layer'], 'config "layer" must not be null'); var layers = wmtsCap['Contents']['Layer']; var l = ol.array.find(layers, function(elt, index, array) { return elt['Identifier'] == config['layer']; }); - ol.DEBUG && console.assert(l, 'found a matching layer in Contents/Layer'); + goog.DEBUG && console.assert(l, 'found a matching layer in Contents/Layer'); - ol.DEBUG && console.assert(l['TileMatrixSetLink'].length > 0, + goog.DEBUG && console.assert(l['TileMatrixSetLink'].length > 0, 'layer has TileMatrixSetLink'); var tileMatrixSets = wmtsCap['Contents']['TileMatrixSet']; var idx, matrixSet; @@ -346,7 +346,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) { matrixSet = /** @type {string} */ (l['TileMatrixSetLink'][idx]['TileMatrixSet']); - ol.DEBUG && console.assert(matrixSet, 'TileMatrixSet must not be null'); + goog.DEBUG && console.assert(matrixSet, 'TileMatrixSet must not be null'); var format = /** @type {string} */ (l['Format'][0]); if ('format' in config) { @@ -370,12 +370,12 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) { var key = elt['Identifier']; var value = elt['Default']; if (value !== undefined) { - ol.DEBUG && console.assert(ol.array.includes(elt['Value'], value), + goog.DEBUG && console.assert(ol.array.includes(elt['Value'], value), 'default value contained in values'); } else { value = elt['Value'][0]; } - ol.DEBUG && console.assert(value !== undefined, 'value could be found'); + goog.DEBUG && console.assert(value !== undefined, 'value could be found'); dimensions[key] = value; }); } @@ -384,7 +384,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) { var matrixSetObj = ol.array.find(matrixSets, function(elt, index, array) { return elt['Identifier'] == matrixSet; }); - ol.DEBUG && console.assert(matrixSetObj, + goog.DEBUG && console.assert(matrixSetObj, 'found matrixSet in Contents/TileMatrixSet'); var projection; @@ -421,21 +421,21 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) { var requestEncoding = config['requestEncoding']; requestEncoding = requestEncoding !== undefined ? requestEncoding : ''; - ol.DEBUG && console.assert( + goog.DEBUG && console.assert( ol.array.includes(['REST', 'RESTful', 'KVP', ''], requestEncoding), 'requestEncoding (%s) is one of "REST", "RESTful", "KVP" or ""', requestEncoding); if ('OperationsMetadata' in wmtsCap && 'GetTile' in wmtsCap['OperationsMetadata']) { var gets = wmtsCap['OperationsMetadata']['GetTile']['DCP']['HTTP']['Get']; - ol.DEBUG && console.assert(gets.length >= 1); + goog.DEBUG && console.assert(gets.length >= 1); for (var i = 0, ii = gets.length; i < ii; ++i) { var constraint = ol.array.find(gets[i]['Constraint'], function(element) { return element['name'] == 'GetEncoding'; }); var encodings = constraint['AllowedValues']['Value']; - ol.DEBUG && console.assert(encodings.length >= 1); + goog.DEBUG && console.assert(encodings.length >= 1); if (requestEncoding === '') { // requestEncoding not provided, use the first encoding from the list @@ -459,7 +459,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) { } }); } - ol.DEBUG && console.assert(urls.length > 0, 'At least one URL found'); + goog.DEBUG && console.assert(urls.length > 0, 'At least one URL found'); return { urls: urls, diff --git a/src/ol/structs/lrucache.js b/src/ol/structs/lrucache.js index 20e0f7c3e5..4c658c6243 100644 --- a/src/ol/structs/lrucache.js +++ b/src/ol/structs/lrucache.js @@ -40,7 +40,7 @@ ol.structs.LRUCache = function() { }; -if (ol.DEBUG) { +if (goog.DEBUG) { /** * FIXME empty description for jsdoc */ @@ -167,7 +167,7 @@ ol.structs.LRUCache.prototype.getKeys = function() { for (entry = this.newest_; entry; entry = entry.older) { keys[i++] = entry.key_; } - ol.DEBUG && console.assert(i == this.count_, 'iterated correct number of times'); + goog.DEBUG && console.assert(i == this.count_, 'iterated correct number of times'); return keys; }; @@ -182,7 +182,7 @@ ol.structs.LRUCache.prototype.getValues = function() { for (entry = this.newest_; entry; entry = entry.older) { values[i++] = entry.value_; } - ol.DEBUG && console.assert(i == this.count_, 'iterated correct number of times'); + goog.DEBUG && console.assert(i == this.count_, 'iterated correct number of times'); return values; }; @@ -191,7 +191,7 @@ ol.structs.LRUCache.prototype.getValues = function() { * @return {T} Last value. */ ol.structs.LRUCache.prototype.peekLast = function() { - ol.DEBUG && console.assert(this.oldest_, 'oldest must not be null'); + goog.DEBUG && console.assert(this.oldest_, 'oldest must not be null'); return this.oldest_.value_; }; @@ -200,7 +200,7 @@ ol.structs.LRUCache.prototype.peekLast = function() { * @return {string} Last key. */ ol.structs.LRUCache.prototype.peekLastKey = function() { - ol.DEBUG && console.assert(this.oldest_, 'oldest must not be null'); + goog.DEBUG && console.assert(this.oldest_, 'oldest must not be null'); return this.oldest_.key_; }; @@ -209,10 +209,10 @@ ol.structs.LRUCache.prototype.peekLastKey = function() { * @return {T} value Value. */ ol.structs.LRUCache.prototype.pop = function() { - ol.DEBUG && console.assert(this.oldest_, 'oldest must not be null'); - ol.DEBUG && console.assert(this.newest_, 'newest must not be null'); + goog.DEBUG && console.assert(this.oldest_, 'oldest must not be null'); + goog.DEBUG && console.assert(this.newest_, 'newest must not be null'); var entry = this.oldest_; - ol.DEBUG && console.assert(entry.key_ in this.entries_, + goog.DEBUG && console.assert(entry.key_ in this.entries_, 'oldest is indexed in entries'); delete this.entries_[entry.key_]; if (entry.newer) { @@ -242,7 +242,7 @@ ol.structs.LRUCache.prototype.replace = function(key, value) { * @param {T} value Value. */ ol.structs.LRUCache.prototype.set = function(key, value) { - ol.DEBUG && console.assert(!(key in {}), + goog.DEBUG && console.assert(!(key in {}), 'key is not a standard property of objects (e.g. "__proto__")'); ol.assert(!(key in this.entries_), 16); // Tried to set a value for a key that is used already diff --git a/src/ol/structs/priorityqueue.js b/src/ol/structs/priorityqueue.js index 35855d0e36..d00b8d0dca 100644 --- a/src/ol/structs/priorityqueue.js +++ b/src/ol/structs/priorityqueue.js @@ -60,7 +60,7 @@ ol.structs.PriorityQueue = function(priorityFunction, keyFunction) { ol.structs.PriorityQueue.DROP = Infinity; -if (ol.DEBUG) { +if (goog.DEBUG) { /** * FIXME empty description for jsdoc */ @@ -99,7 +99,7 @@ ol.structs.PriorityQueue.prototype.clear = function() { */ ol.structs.PriorityQueue.prototype.dequeue = function() { var elements = this.elements_; - ol.DEBUG && console.assert(elements.length > 0, + goog.DEBUG && console.assert(elements.length > 0, 'must have elements in order to be able to dequeue'); var priorities = this.priorities_; var element = elements[0]; @@ -112,7 +112,7 @@ ol.structs.PriorityQueue.prototype.dequeue = function() { this.siftUp_(0); } var elementKey = this.keyFunction_(element); - ol.DEBUG && console.assert(elementKey in this.queuedElements_, + goog.DEBUG && console.assert(elementKey in this.queuedElements_, 'key %s is not listed as queued', elementKey); delete this.queuedElements_[elementKey]; return element; diff --git a/src/ol/structs/rbush.js b/src/ol/structs/rbush.js index aabc695f42..9aca9027da 100644 --- a/src/ol/structs/rbush.js +++ b/src/ol/structs/rbush.js @@ -59,7 +59,7 @@ ol.structs.RBush.prototype.insert = function(extent, value) { this.rbush_.insert(item); // remember the object that was added to the internal rbush - ol.DEBUG && console.assert(!(ol.getUid(value) in this.items_), + goog.DEBUG && console.assert(!(ol.getUid(value) in this.items_), 'uid (%s) of value (%s) already exists', ol.getUid(value), value); this.items_[ol.getUid(value)] = item; }; @@ -74,7 +74,7 @@ ol.structs.RBush.prototype.load = function(extents, values) { if (goog.DEBUG && this.readers_) { throw new Error('Can not insert values while reading'); } - ol.DEBUG && console.assert(extents.length === values.length, + goog.DEBUG && console.assert(extents.length === values.length, 'extens and values must have same length (%s === %s)', extents.length, values.length); @@ -92,7 +92,7 @@ ol.structs.RBush.prototype.load = function(extents, values) { value: value }; items[i] = item; - ol.DEBUG && console.assert(!(ol.getUid(value) in this.items_), + goog.DEBUG && console.assert(!(ol.getUid(value) in this.items_), 'uid (%s) of value (%s) already exists', ol.getUid(value), value); this.items_[ol.getUid(value)] = item; } @@ -110,7 +110,7 @@ ol.structs.RBush.prototype.remove = function(value) { throw new Error('Can not remove value while reading'); } var uid = ol.getUid(value); - ol.DEBUG && console.assert(uid in this.items_, + goog.DEBUG && console.assert(uid in this.items_, 'uid (%s) of value (%s) does not exist', uid, value); // get the object in which the value was wrapped when adding to the @@ -127,7 +127,7 @@ ol.structs.RBush.prototype.remove = function(value) { * @param {T} value Value. */ ol.structs.RBush.prototype.update = function(extent, value) { - ol.DEBUG && console.assert(ol.getUid(value) in this.items_, + goog.DEBUG && console.assert(ol.getUid(value) in this.items_, 'uid (%s) of value (%s) does not exist', ol.getUid(value), value); var item = this.items_[ol.getUid(value)]; diff --git a/src/ol/style/atlasmanager.js b/src/ol/style/atlasmanager.js index ae4fe6832c..e606fc2ad2 100644 --- a/src/ol/style/atlasmanager.js +++ b/src/ol/style/atlasmanager.js @@ -119,9 +119,9 @@ ol.style.AtlasManager.prototype.getInfo_ = function(atlases, id) { * entry, or `null` if the entry is not part of the atlases. */ ol.style.AtlasManager.prototype.mergeInfos_ = function(info, hitInfo) { - ol.DEBUG && console.assert(info.offsetX === hitInfo.offsetX, + goog.DEBUG && console.assert(info.offsetX === hitInfo.offsetX, 'in order to merge, offsetX of info and hitInfo must be equal'); - ol.DEBUG && console.assert(info.offsetY === hitInfo.offsetY, + goog.DEBUG && console.assert(info.offsetY === hitInfo.offsetY, 'in order to merge, offsetY of info and hitInfo must be equal'); return /** @type {ol.AtlasManagerInfo} */ ({ offsetX: info.offsetX, @@ -220,7 +220,7 @@ ol.style.AtlasManager.prototype.add_ = function(isHitAtlas, id, width, height, ++ii; } } - ol.DEBUG && console.assert(false, 'Failed to add to atlasmanager'); + goog.DEBUG && console.assert(false, 'Failed to add to atlasmanager'); return null; }; diff --git a/src/ol/style/circlestyle.js b/src/ol/style/circlestyle.js index deab315710..64cdae2401 100644 --- a/src/ol/style/circlestyle.js +++ b/src/ol/style/circlestyle.js @@ -288,7 +288,7 @@ ol.style.Circle.prototype.render_ = function(atlasManager) { var info = atlasManager.add( id, size, size, this.draw_.bind(this, renderOptions), renderHitDetectionCallback); - ol.DEBUG && console.assert(info, 'circle radius is too large'); + goog.DEBUG && console.assert(info, 'circle radius is too large'); this.canvas_ = info.image; this.origin_ = [info.offsetX, info.offsetY]; diff --git a/src/ol/style/iconstyle.js b/src/ol/style/iconstyle.js index 295bcbe3d7..b16385087c 100644 --- a/src/ol/style/iconstyle.js +++ b/src/ol/style/iconstyle.js @@ -576,9 +576,9 @@ ol.style.IconImage_.prototype.getSrc = function() { */ ol.style.IconImage_.prototype.load = function() { if (this.imageState_ == ol.style.ImageState.IDLE) { - ol.DEBUG && console.assert(this.src_ !== undefined, + goog.DEBUG && console.assert(this.src_ !== undefined, 'this.src_ must not be undefined'); - ol.DEBUG && console.assert(!this.imageListenerKeys_, + goog.DEBUG && console.assert(!this.imageListenerKeys_, 'no listener keys existing'); this.imageState_ = ol.style.ImageState.LOADING; this.imageListenerKeys_ = [ @@ -604,7 +604,7 @@ ol.style.IconImage_.prototype.replaceColor_ = function() { return; } - ol.DEBUG && console.assert(this.canvas_ !== null, + goog.DEBUG && console.assert(this.canvas_ !== null, 'this.canvas_ must not be null'); this.canvas_.width = this.image_.width; @@ -634,7 +634,7 @@ ol.style.IconImage_.prototype.replaceColor_ = function() { * @private */ ol.style.IconImage_.prototype.unlistenImage_ = function() { - ol.DEBUG && console.assert(this.imageListenerKeys_, + goog.DEBUG && console.assert(this.imageListenerKeys_, 'we must have listeners registered'); this.imageListenerKeys_.forEach(ol.events.unlistenByKey); this.imageListenerKeys_ = null; @@ -675,7 +675,7 @@ goog.addSingletonGetter(ol.style.IconImageCache); * @return {string} Cache key. */ ol.style.IconImageCache.getKey = function(src, crossOrigin, color) { - ol.DEBUG && console.assert(crossOrigin !== undefined, + goog.DEBUG && console.assert(crossOrigin !== undefined, 'argument crossOrigin must be defined'); var colorString = color ? ol.color.asString(color) : 'null'; return crossOrigin + ':' + src + ':' + colorString; diff --git a/src/ol/style/regularshapestyle.js b/src/ol/style/regularshapestyle.js index 4ff1f1210c..9ea83b5881 100644 --- a/src/ol/style/regularshapestyle.js +++ b/src/ol/style/regularshapestyle.js @@ -26,7 +26,7 @@ goog.require('ol.style.Stroke'); */ ol.style.RegularShape = function(options) { - ol.DEBUG && console.assert( + goog.DEBUG && console.assert( options.radius !== undefined || options.radius1 !== undefined, 'must provide either "radius" or "radius1"'); @@ -366,7 +366,7 @@ ol.style.RegularShape.prototype.render_ = function(atlasManager) { var info = atlasManager.add( id, size, size, this.draw_.bind(this, renderOptions), renderHitDetectionCallback); - ol.DEBUG && console.assert(info, 'shape size is too large'); + goog.DEBUG && console.assert(info, 'shape size is too large'); this.canvas_ = info.image; this.origin_ = [info.offsetX, info.offsetY]; diff --git a/src/ol/style/style.js b/src/ol/style/style.js index fc5526e9b1..45b6cdfbed 100644 --- a/src/ol/style/style.js +++ b/src/ol/style/style.js @@ -335,6 +335,6 @@ ol.style.createDefaultEditingStyles = function() { * @return {ol.geom.Geometry|ol.render.Feature|undefined} Geometry to render. */ ol.style.defaultGeometryFunction = function(feature) { - ol.DEBUG && console.assert(feature, 'feature must not be null'); + goog.DEBUG && console.assert(feature, 'feature must not be null'); return feature.getGeometry(); }; diff --git a/src/ol/tilecoord.js b/src/ol/tilecoord.js index bb1f69ead2..60da04b7ec 100644 --- a/src/ol/tilecoord.js +++ b/src/ol/tilecoord.js @@ -21,7 +21,7 @@ ol.QuadKeyCharCode = { */ ol.tilecoord.createFromString = function(str) { var v = str.split('/'); - ol.DEBUG && console.assert(v.length === 3, + goog.DEBUG && console.assert(v.length === 3, 'must provide a string in "z/x/y" format, got "%s"', str); return v.map(function(e) { return parseInt(e, 10); diff --git a/src/ol/tilegrid/tilegrid.js b/src/ol/tilegrid/tilegrid.js index 312297e623..c5c528b8ec 100644 --- a/src/ol/tilegrid/tilegrid.js +++ b/src/ol/tilegrid/tilegrid.js @@ -119,11 +119,11 @@ ol.tilegrid.TileGrid = function(options) { this.tmpSize_ = [0, 0]; if (options.sizes !== undefined) { - ol.DEBUG && console.assert(options.sizes.length == this.resolutions_.length, + goog.DEBUG && console.assert(options.sizes.length == this.resolutions_.length, 'number of sizes and resolutions must be equal'); this.fullTileRanges_ = options.sizes.map(function(size, z) { - ol.DEBUG && console.assert(size[0] !== 0, 'width must not be 0'); - ol.DEBUG && console.assert(size[1] !== 0, 'height must not be 0'); + goog.DEBUG && console.assert(size[0] !== 0, 'width must not be 0'); + goog.DEBUG && console.assert(size[1] !== 0, 'height must not be 0'); var tileRange = new ol.TileRange( Math.min(0, size[0]), Math.max(size[0] - 1, -1), Math.min(0, size[1]), Math.max(size[1] - 1, -1)); @@ -228,9 +228,9 @@ ol.tilegrid.TileGrid.prototype.getOrigin = function(z) { if (this.origin_) { return this.origin_; } else { - ol.DEBUG && console.assert(this.origins_, + goog.DEBUG && console.assert(this.origins_, 'origins cannot be null if origin is null'); - ol.DEBUG && console.assert(this.minZoom <= z && z <= this.maxZoom, + goog.DEBUG && console.assert(this.minZoom <= z && z <= this.maxZoom, 'given z is not in allowed range (%s <= %s <= %s)', this.minZoom, z, this.maxZoom); return this.origins_[z]; @@ -245,7 +245,7 @@ ol.tilegrid.TileGrid.prototype.getOrigin = function(z) { * @api stable */ ol.tilegrid.TileGrid.prototype.getResolution = function(z) { - ol.DEBUG && console.assert(this.minZoom <= z && z <= this.maxZoom, + goog.DEBUG && console.assert(this.minZoom <= z && z <= this.maxZoom, 'given z is not in allowed range (%s <= %s <= %s)', this.minZoom, z, this.maxZoom); return this.resolutions_[z]; @@ -438,7 +438,7 @@ ol.tilegrid.TileGrid.prototype.getTileCoordForCoordAndZ = function(coordinate, z * @return {number} Tile resolution. */ ol.tilegrid.TileGrid.prototype.getTileCoordResolution = function(tileCoord) { - ol.DEBUG && console.assert( + goog.DEBUG && console.assert( this.minZoom <= tileCoord[0] && tileCoord[0] <= this.maxZoom, 'z of given tilecoord is not in allowed range (%s <= %s <= %s', this.minZoom, tileCoord[0], this.maxZoom); @@ -458,9 +458,9 @@ ol.tilegrid.TileGrid.prototype.getTileSize = function(z) { if (this.tileSize_) { return this.tileSize_; } else { - ol.DEBUG && console.assert(this.tileSizes_, + goog.DEBUG && console.assert(this.tileSizes_, 'tileSizes cannot be null if tileSize is null'); - ol.DEBUG && console.assert(this.minZoom <= z && z <= this.maxZoom, + goog.DEBUG && console.assert(this.minZoom <= z && z <= this.maxZoom, 'z is not in allowed range (%s <= %s <= %s', this.minZoom, z, this.maxZoom); return this.tileSizes_[z]; @@ -476,7 +476,7 @@ ol.tilegrid.TileGrid.prototype.getFullTileRange = function(z) { if (!this.fullTileRanges_) { return null; } else { - ol.DEBUG && console.assert(this.minZoom <= z && z <= this.maxZoom, + goog.DEBUG && console.assert(this.minZoom <= z && z <= this.maxZoom, 'z is not in allowed range (%s <= %s <= %s', this.minZoom, z, this.maxZoom); return this.fullTileRanges_[z]; diff --git a/src/ol/tilegrid/wmtstilegrid.js b/src/ol/tilegrid/wmtstilegrid.js index 4100c6ffd9..61277d7729 100644 --- a/src/ol/tilegrid/wmtstilegrid.js +++ b/src/ol/tilegrid/wmtstilegrid.js @@ -16,7 +16,7 @@ goog.require('ol.tilegrid.TileGrid'); */ ol.tilegrid.WMTS = function(options) { - ol.DEBUG && console.assert( + goog.DEBUG && console.assert( options.resolutions.length == options.matrixIds.length, 'options resolutions and matrixIds must have equal length (%s == %s)', options.resolutions.length, options.matrixIds.length); @@ -47,7 +47,7 @@ ol.inherits(ol.tilegrid.WMTS, ol.tilegrid.TileGrid); * @return {string} MatrixId.. */ ol.tilegrid.WMTS.prototype.getMatrixId = function(z) { - ol.DEBUG && console.assert(0 <= z && z < this.matrixIds_.length, + goog.DEBUG && console.assert(0 <= z && z < this.matrixIds_.length, 'attempted to retrive matrixId for illegal z (%s)', z); return this.matrixIds_[z]; }; diff --git a/src/ol/tilequeue.js b/src/ol/tilequeue.js index fe203218fc..e273804eab 100644 --- a/src/ol/tilequeue.js +++ b/src/ol/tilequeue.js @@ -96,7 +96,7 @@ ol.TileQueue.prototype.handleTileChange = function(event) { } this.tileChangeCallback_(); } - ol.DEBUG && console.assert(Object.keys(this.tilesLoadingKeys_).length === this.tilesLoading_); + goog.DEBUG && console.assert(Object.keys(this.tilesLoadingKeys_).length === this.tilesLoading_); }; @@ -117,6 +117,6 @@ ol.TileQueue.prototype.loadMoreTiles = function(maxTotalLoading, maxNewLoads) { ++newLoads; tile.load(); } - ol.DEBUG && console.assert(Object.keys(this.tilesLoadingKeys_).length === this.tilesLoading_); + goog.DEBUG && console.assert(Object.keys(this.tilesLoadingKeys_).length === this.tilesLoading_); } }; diff --git a/src/ol/tileurlfunction.js b/src/ol/tileurlfunction.js index a6c3bfc7b7..e27ef0e78e 100644 --- a/src/ol/tileurlfunction.js +++ b/src/ol/tileurlfunction.js @@ -34,7 +34,7 @@ ol.TileUrlFunction.createFromTemplate = function(template, tileGrid) { .replace(dashYRegEx, function() { var z = tileCoord[0]; var range = tileGrid.getFullTileRange(z); - ol.DEBUG && console.assert(range, + goog.DEBUG && console.assert(range, 'The {-y} template requires a tile grid with extent'); var y = range.getHeight() + tileCoord[2]; return y.toString(); @@ -65,7 +65,7 @@ ol.TileUrlFunction.createFromTemplates = function(templates, tileGrid) { * @return {ol.TileUrlFunctionType} Tile URL function. */ ol.TileUrlFunction.createFromTileUrlFunctions = function(tileUrlFunctions) { - ol.DEBUG && console.assert(tileUrlFunctions.length > 0, + goog.DEBUG && console.assert(tileUrlFunctions.length > 0, 'Length of tile url functions should be greater than 0'); if (tileUrlFunctions.length === 1) { return tileUrlFunctions[0]; diff --git a/src/ol/view.js b/src/ol/view.js index 8adb85dddd..b71ea3b169 100644 --- a/src/ol/view.js +++ b/src/ol/view.js @@ -385,7 +385,7 @@ ol.View.prototype.getResolutionForValueFunction = function(opt_power) { */ function(value) { var resolution = maxResolution / Math.pow(power, value * max); - ol.DEBUG && console.assert(resolution >= minResolution && + goog.DEBUG && console.assert(resolution >= minResolution && resolution <= maxResolution, 'calculated resolution outside allowed bounds (%s <= %s <= %s)', minResolution, resolution, maxResolution); @@ -424,7 +424,7 @@ ol.View.prototype.getValueForResolutionFunction = function(opt_power) { function(resolution) { var value = (Math.log(maxResolution / resolution) / Math.log(power)) / max; - ol.DEBUG && console.assert(value >= 0 && value <= 1, + goog.DEBUG && console.assert(value >= 0 && value <= 1, 'calculated value (%s) ouside allowed range (0-1)', value); return value; }); @@ -435,7 +435,7 @@ ol.View.prototype.getValueForResolutionFunction = function(opt_power) { * @return {olx.ViewState} View state. */ ol.View.prototype.getState = function() { - ol.DEBUG && console.assert(this.isDef(), + goog.DEBUG && console.assert(this.isDef(), 'the view was not defined (had no center and/or resolution)'); var center = /** @type {ol.Coordinate} */ (this.getCenter()); var projection = this.getProjection(); @@ -519,7 +519,7 @@ ol.View.prototype.fit = function(geometry, size, opt_options) { // calculate rotated extent var rotation = this.getRotation(); - ol.DEBUG && console.assert(rotation !== undefined, 'rotation was not defined'); + goog.DEBUG && console.assert(rotation !== undefined, 'rotation was not defined'); var cosAngle = Math.cos(-rotation); var sinAngle = Math.sin(-rotation); var minRotX = +Infinity; @@ -632,10 +632,10 @@ ol.View.prototype.setCenter = function(center) { * @return {number} New value. */ ol.View.prototype.setHint = function(hint, delta) { - ol.DEBUG && console.assert(0 <= hint && hint < this.hints_.length, + goog.DEBUG && console.assert(0 <= hint && hint < this.hints_.length, 'illegal hint (%s), must be between 0 and %s', hint, this.hints_.length); this.hints_[hint] += delta; - ol.DEBUG && console.assert(this.hints_[hint] >= 0, + goog.DEBUG && console.assert(this.hints_[hint] >= 0, 'Hint at %s must be positive, was %s', hint, this.hints_[hint]); return this.hints_[hint]; }; @@ -788,7 +788,7 @@ ol.View.createRotationConstraint_ = function(options) { } else if (typeof constrainRotation === 'number') { return ol.RotationConstraint.createSnapToN(constrainRotation); } else { - ol.DEBUG && console.assert(false, + goog.DEBUG && console.assert(false, 'illegal option for constrainRotation (%s)', constrainRotation); return ol.RotationConstraint.none; } diff --git a/src/ol/webgl/context.js b/src/ol/webgl/context.js index 57c7274ba0..ef0fdf2eb2 100644 --- a/src/ol/webgl/context.js +++ b/src/ol/webgl/context.js @@ -84,7 +84,7 @@ ol.webgl.Context = function(canvas, gl) { // use the OES_element_index_uint extension if available if (this.hasOESElementIndexUint) { var ext = gl.getExtension('OES_element_index_uint'); - ol.DEBUG && console.assert(ext, + goog.DEBUG && console.assert(ext, 'Failed to get extension "OES_element_index_uint"'); } @@ -114,7 +114,7 @@ ol.webgl.Context.prototype.bindBuffer = function(target, buf) { } else { var buffer = gl.createBuffer(); gl.bindBuffer(target, buffer); - ol.DEBUG && console.assert(target == ol.webgl.ARRAY_BUFFER || + goog.DEBUG && console.assert(target == ol.webgl.ARRAY_BUFFER || target == ol.webgl.ELEMENT_ARRAY_BUFFER, 'target is supposed to be an ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER'); var /** @type {ArrayBufferView} */ arrayBuffer; @@ -139,7 +139,7 @@ ol.webgl.Context.prototype.bindBuffer = function(target, buf) { ol.webgl.Context.prototype.deleteBuffer = function(buf) { var gl = this.getGL(); var bufferKey = String(ol.getUid(buf)); - ol.DEBUG && console.assert(bufferKey in this.bufferCache_, + goog.DEBUG && console.assert(bufferKey in this.bufferCache_, 'attempted to delete uncached buffer'); var bufferCacheEntry = this.bufferCache_[bufferKey]; if (!gl.isContextLost()) { @@ -219,7 +219,7 @@ ol.webgl.Context.prototype.getShader = function(shaderObject) { var shader = gl.createShader(shaderObject.getType()); gl.shaderSource(shader, shaderObject.getSource()); gl.compileShader(shader); - ol.DEBUG && console.assert( + goog.DEBUG && console.assert( gl.getShaderParameter(shader, ol.webgl.COMPILE_STATUS) || gl.isContextLost(), gl.getShaderInfoLog(shader) || 'illegal state, shader not compiled or context lost'); @@ -249,7 +249,7 @@ ol.webgl.Context.prototype.getProgram = function( gl.attachShader(program, this.getShader(fragmentShaderObject)); gl.attachShader(program, this.getShader(vertexShaderObject)); gl.linkProgram(program); - ol.DEBUG && console.assert( + goog.DEBUG && console.assert( gl.getProgramParameter(program, ol.webgl.LINK_STATUS) || gl.isContextLost(), gl.getProgramInfoLog(program) || 'illegal state, shader not linked or context lost'); diff --git a/src/ol/xml.js b/src/ol/xml.js index ff29626985..fc0595784f 100644 --- a/src/ol/xml.js +++ b/src/ol/xml.js @@ -133,11 +133,11 @@ ol.xml.makeArrayExtender = function(valueReader, opt_this) { function(node, objectStack) { var value = valueReader.call(opt_this, node, objectStack); if (value !== undefined) { - ol.DEBUG && console.assert(Array.isArray(value), + goog.DEBUG && console.assert(Array.isArray(value), 'valueReader function is expected to return an array of values'); var array = /** @type {Array.<*>} */ (objectStack[objectStack.length - 1]); - ol.DEBUG && console.assert(Array.isArray(array), + goog.DEBUG && console.assert(Array.isArray(array), 'objectStack is supposed to be an array of arrays'); ol.array.extend(array, value); } @@ -164,7 +164,7 @@ ol.xml.makeArrayPusher = function(valueReader, opt_this) { node, objectStack); if (value !== undefined) { var array = objectStack[objectStack.length - 1]; - ol.DEBUG && console.assert(Array.isArray(array), + goog.DEBUG && console.assert(Array.isArray(array), 'objectStack is supposed to be an array of arrays'); array.push(value); } @@ -206,7 +206,7 @@ ol.xml.makeReplacer = function(valueReader, opt_this) { * @template T */ ol.xml.makeObjectPropertyPusher = function(valueReader, opt_property, opt_this) { - ol.DEBUG && console.assert(valueReader !== undefined, + goog.DEBUG && console.assert(valueReader !== undefined, 'undefined valueReader, expected function(this: T, Node, Array.<*>)'); return ( /** @@ -242,7 +242,7 @@ ol.xml.makeObjectPropertyPusher = function(valueReader, opt_property, opt_this) * @template T */ ol.xml.makeObjectPropertySetter = function(valueReader, opt_property, opt_this) { - ol.DEBUG && console.assert(valueReader !== undefined, + goog.DEBUG && console.assert(valueReader !== undefined, 'undefined valueReader, expected function(this: T, Node, Array.<*>)'); return ( /** @@ -279,7 +279,7 @@ ol.xml.makeChildAppender = function(nodeWriter, opt_this) { node, value, objectStack); var parent = objectStack[objectStack.length - 1]; var parentNode = parent.node; - ol.DEBUG && console.assert(ol.xml.isNode(parentNode) || + goog.DEBUG && console.assert(ol.xml.isNode(parentNode) || ol.xml.isDocument(parentNode), 'expected parentNode %s to be a Node or a Document', parentNode); parentNode.appendChild(node); @@ -340,7 +340,7 @@ ol.xml.makeSimpleNodeFactory = function(opt_nodeName, opt_namespaceURI) { function(value, objectStack, opt_nodeName) { var context = objectStack[objectStack.length - 1]; var node = context.node; - ol.DEBUG && console.assert(ol.xml.isNode(node) || ol.xml.isDocument(node), + goog.DEBUG && console.assert(ol.xml.isNode(node) || ol.xml.isDocument(node), 'expected node %s to be a Node or a Document', node); var nodeName = fixedNodeName; if (nodeName === undefined) { @@ -350,7 +350,7 @@ ol.xml.makeSimpleNodeFactory = function(opt_nodeName, opt_namespaceURI) { if (opt_namespaceURI === undefined) { namespaceURI = node.namespaceURI; } - ol.DEBUG && console.assert(nodeName !== undefined, 'nodeName was undefined'); + goog.DEBUG && console.assert(nodeName !== undefined, 'nodeName was undefined'); return ol.xml.createElementNS(namespaceURI, /** @type {string} */ (nodeName)); } );