Add assert messages for all assertions up until ol.renderer.vector.

This commit is contained in:
Bart van den Eijnden
2015-03-30 16:41:32 +02:00
parent fb9ba22c30
commit 47ce127a10
74 changed files with 1173 additions and 682 deletions
+4 -2
View File
@@ -118,7 +118,8 @@ ol.proj.EPSG3857.fromEPSG4326 = function(input, opt_output, opt_dimension) {
output = new Array(length);
}
}
goog.asserts.assert(output.length % dimension === 0);
goog.asserts.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;
output[i + 1] = ol.proj.EPSG3857.RADIUS *
@@ -148,7 +149,8 @@ ol.proj.EPSG3857.toEPSG4326 = function(input, opt_output, opt_dimension) {
output = new Array(length);
}
}
goog.asserts.assert(output.length % dimension === 0);
goog.asserts.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);
output[i + 1] = 360 * Math.atan(
+7 -4
View File
@@ -470,7 +470,8 @@ ol.proj.createProjection = function(projection, defaultCode) {
} else if (goog.isString(projection)) {
return ol.proj.get(projection);
} else {
goog.asserts.assertInstanceof(projection, ol.proj.Projection);
goog.asserts.assertInstanceof(projection, ol.proj.Projection,
'projection should be an ol.proj.Projection');
return projection;
}
};
@@ -571,8 +572,10 @@ ol.proj.removeTransform = function(source, destination) {
var sourceCode = source.getCode();
var destinationCode = destination.getCode();
var transforms = ol.proj.transforms_;
goog.asserts.assert(sourceCode in transforms);
goog.asserts.assert(destinationCode in transforms[sourceCode]);
goog.asserts.assert(sourceCode in transforms,
'sourceCode should be in transforms');
goog.asserts.assert(destinationCode in transforms[sourceCode],
'destinationCode should be in transforms of sourceCode');
var transform = transforms[sourceCode][destinationCode];
delete transforms[sourceCode][destinationCode];
var keys = goog.object.getKeys(transforms[sourceCode]);
@@ -671,7 +674,7 @@ ol.proj.getTransformFromProjections =
transform = transforms[sourceCode][destinationCode];
}
if (!goog.isDef(transform)) {
goog.asserts.assert(goog.isDef(transform));
goog.asserts.assert(goog.isDef(transform), 'transform should be defined');
transform = ol.proj.identityTransform;
}
return transform;