Use goog.DEBUG instead of ol.DEBUG for now

This commit is contained in:
Andreas Hocevar
2016-08-04 09:37:42 +02:00
parent 55ab5704d4
commit e0015b3d4e
121 changed files with 712 additions and 721 deletions

View File

@@ -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();

View File

@@ -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) {

View File

@@ -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;
}

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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;

View File

@@ -78,7 +78,7 @@ ol.geom.flat.interiorpoint.linearRings = function(flatCoordinates, offset,
* @return {Array.<number>} 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;

View File

@@ -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;
};

View File

@@ -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];

View File

@@ -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');

View File

@@ -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();

View File

@@ -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());

View File

@@ -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;

View File

@@ -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.<number>} */
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.<Array.<number>>} 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;

View File

@@ -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;

View File

@@ -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);
};