Add assert messages for all assertions up until ol.renderer.vector.
This commit is contained in:
@@ -153,7 +153,7 @@ ol.geom.flat.closest.getClosestPoint = function(flatCoordinates, offset, end,
|
||||
return minSquaredDistance;
|
||||
}
|
||||
}
|
||||
goog.asserts.assert(maxDelta > 0);
|
||||
goog.asserts.assert(maxDelta > 0, 'maxDelta should be larger than 0');
|
||||
var tmpPoint = goog.isDef(opt_tmpPoint) ? opt_tmpPoint : [NaN, NaN];
|
||||
var index = offset + stride;
|
||||
while (index < end) {
|
||||
|
||||
@@ -67,7 +67,7 @@ ol.geom.flat.contains.linearRingContainsXY =
|
||||
*/
|
||||
ol.geom.flat.contains.linearRingsContainsXY =
|
||||
function(flatCoordinates, offset, ends, stride, x, y) {
|
||||
goog.asserts.assert(ends.length > 0);
|
||||
goog.asserts.assert(ends.length > 0, 'ends should not be an empty array');
|
||||
if (ends.length === 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -97,7 +97,7 @@ ol.geom.flat.contains.linearRingsContainsXY =
|
||||
*/
|
||||
ol.geom.flat.contains.linearRingssContainsXY =
|
||||
function(flatCoordinates, offset, endss, stride, x, y) {
|
||||
goog.asserts.assert(endss.length > 0);
|
||||
goog.asserts.assert(endss.length > 0, 'endss should not be an empty array');
|
||||
if (endss.length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@ goog.require('goog.asserts');
|
||||
*/
|
||||
ol.geom.flat.deflate.coordinate =
|
||||
function(flatCoordinates, offset, coordinate, stride) {
|
||||
goog.asserts.assert(coordinate.length == stride);
|
||||
goog.asserts.assert(coordinate.length == stride,
|
||||
'length of the coordinate array should match stride');
|
||||
var i, ii;
|
||||
for (i = 0, ii = coordinate.length; i < ii; ++i) {
|
||||
flatCoordinates[offset++] = coordinate[i];
|
||||
@@ -33,7 +34,8 @@ ol.geom.flat.deflate.coordinates =
|
||||
var i, ii;
|
||||
for (i = 0, ii = coordinates.length; i < ii; ++i) {
|
||||
var coordinate = coordinates[i];
|
||||
goog.asserts.assert(coordinate.length == stride);
|
||||
goog.asserts.assert(coordinate.length == stride,
|
||||
'length of coordinate array should match stride');
|
||||
var j;
|
||||
for (j = 0; j < stride; ++j) {
|
||||
flatCoordinates[offset++] = coordinate[j];
|
||||
|
||||
@@ -19,7 +19,8 @@ ol.geom.flat.flip.flipXY =
|
||||
dest = opt_dest;
|
||||
destOffset = goog.isDef(opt_destOffset) ? opt_destOffset : 0;
|
||||
} else {
|
||||
goog.asserts.assert(!goog.isDef(opt_destOffset));
|
||||
goog.asserts.assert(!goog.isDef(opt_destOffset),
|
||||
'opt_destOffSet should be defined');
|
||||
dest = [];
|
||||
destOffset = 0;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,8 @@ ol.geom.flat.geodesic.line_ =
|
||||
// segment.
|
||||
flatCoordinates.push(b[0], b[1]);
|
||||
key = fracB.toString();
|
||||
goog.asserts.assert(!goog.object.containsKey(fractions, key));
|
||||
goog.asserts.assert(!goog.object.containsKey(fractions, key),
|
||||
'fractions object should contain key : ' + key);
|
||||
fractions[key] = true;
|
||||
} else {
|
||||
// Otherwise, we need to subdivide the current line segment. Split it
|
||||
@@ -79,7 +80,8 @@ ol.geom.flat.geodesic.line_ =
|
||||
geoStack.push(geoB, geoM, geoM, geoA);
|
||||
}
|
||||
}
|
||||
goog.asserts.assert(maxIterations > 0);
|
||||
goog.asserts.assert(maxIterations > 0,
|
||||
'maxIterations should be more than 0');
|
||||
|
||||
return flatCoordinates;
|
||||
};
|
||||
|
||||
@@ -79,7 +79,8 @@ ol.geom.flat.interiorpoint.linearRings = function(flatCoordinates, offset,
|
||||
*/
|
||||
ol.geom.flat.interiorpoint.linearRingss =
|
||||
function(flatCoordinates, offset, endss, stride, flatCenters) {
|
||||
goog.asserts.assert(2 * endss.length == flatCenters.length);
|
||||
goog.asserts.assert(2 * endss.length == flatCenters.length,
|
||||
'endss.length times 2 should be flatCenters.length');
|
||||
var interiorPoints = [];
|
||||
var i, ii;
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
|
||||
@@ -17,12 +17,13 @@ goog.require('goog.math');
|
||||
ol.geom.flat.interpolate.lineString =
|
||||
function(flatCoordinates, offset, end, stride, fraction, opt_dest) {
|
||||
// FIXME interpolate extra dimensions
|
||||
goog.asserts.assert(0 <= fraction && fraction <= 1);
|
||||
goog.asserts.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) {
|
||||
goog.asserts.fail();
|
||||
goog.asserts.fail('n cannot be 0');
|
||||
} else if (n == 1) {
|
||||
pointX = flatCoordinates[offset];
|
||||
pointY = flatCoordinates[offset + 1];
|
||||
@@ -121,8 +122,8 @@ ol.geom.flat.lineStringCoordinateAtM =
|
||||
return flatCoordinates.slice((lo - 1) * stride, (lo - 1) * stride + stride);
|
||||
}
|
||||
var m1 = flatCoordinates[(lo + 1) * stride - 1];
|
||||
goog.asserts.assert(m0 < m);
|
||||
goog.asserts.assert(m <= m1);
|
||||
goog.asserts.assert(m0 < m, 'm0 should be less than m');
|
||||
goog.asserts.assert(m <= m1, 'm should be less than or equal to m1');
|
||||
var t = (m - m0) / (m1 - m0);
|
||||
coordinate = [];
|
||||
var i;
|
||||
@@ -131,7 +132,8 @@ ol.geom.flat.lineStringCoordinateAtM =
|
||||
flatCoordinates[lo * stride + i], t));
|
||||
}
|
||||
coordinate.push(m);
|
||||
goog.asserts.assert(coordinate.length == stride);
|
||||
goog.asserts.assert(coordinate.length == stride,
|
||||
'length of coordinate array should match stride');
|
||||
return coordinate;
|
||||
};
|
||||
|
||||
@@ -185,6 +187,7 @@ ol.geom.flat.lineStringsCoordinateAtM = function(
|
||||
}
|
||||
offset = end;
|
||||
}
|
||||
goog.asserts.fail();
|
||||
goog.asserts.fail(
|
||||
'ol.geom.flat.lineStringsCoordinateAtM should have returned');
|
||||
return null;
|
||||
};
|
||||
|
||||
@@ -111,7 +111,7 @@ ol.geom.flat.intersectsextent.linearRing =
|
||||
*/
|
||||
ol.geom.flat.intersectsextent.linearRings =
|
||||
function(flatCoordinates, offset, ends, stride, extent) {
|
||||
goog.asserts.assert(ends.length > 0);
|
||||
goog.asserts.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;
|
||||
@@ -140,7 +140,7 @@ ol.geom.flat.intersectsextent.linearRings =
|
||||
*/
|
||||
ol.geom.flat.intersectsextent.linearRingss =
|
||||
function(flatCoordinates, offset, endss, stride, extent) {
|
||||
goog.asserts.assert(endss.length > 0);
|
||||
goog.asserts.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];
|
||||
|
||||
Reference in New Issue
Block a user