Remove goog.asserts.*
This pull requests replaces type check hint assertions with type casts, library sanity check assertions with conditional console.assert statements in debug mode, and runtime sanity checks with assertions that throw an ol.AssertionError with an error code for lookup outside the library.
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
goog.provide('ol.render.Box');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol.Disposable');
|
||||
goog.require('ol.geom.Polygon');
|
||||
|
||||
@@ -64,8 +63,8 @@ ol.render.Box.prototype.disposeInternal = function() {
|
||||
ol.render.Box.prototype.render_ = function() {
|
||||
var startPixel = this.startPixel_;
|
||||
var endPixel = this.endPixel_;
|
||||
goog.asserts.assert(startPixel, 'this.startPixel_ must be truthy');
|
||||
goog.asserts.assert(endPixel, 'this.endPixel_ must be truthy');
|
||||
ol.DEBUG && console.assert(startPixel, 'this.startPixel_ must be truthy');
|
||||
ol.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;
|
||||
@@ -107,11 +106,11 @@ ol.render.Box.prototype.setPixels = function(startPixel, endPixel) {
|
||||
* Creates or updates the cached geometry.
|
||||
*/
|
||||
ol.render.Box.prototype.createOrUpdateGeometry = function() {
|
||||
goog.asserts.assert(this.startPixel_,
|
||||
ol.DEBUG && console.assert(this.startPixel_,
|
||||
'this.startPixel_ must be truthy');
|
||||
goog.asserts.assert(this.endPixel_,
|
||||
ol.DEBUG && console.assert(this.endPixel_,
|
||||
'this.endPixel_ must be truthy');
|
||||
goog.asserts.assert(this.map_, 'this.map_ must be truthy');
|
||||
ol.DEBUG && console.assert(this.map_, 'this.map_ must be truthy');
|
||||
var startPixel = this.startPixel_;
|
||||
var endPixel = this.endPixel_;
|
||||
var pixels = [
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
goog.provide('ol.render.canvas.Immediate');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol.transform');
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.color');
|
||||
@@ -245,8 +244,8 @@ ol.render.canvas.Immediate.prototype.drawImages_ = function(flatCoordinates, off
|
||||
if (!this.image_) {
|
||||
return;
|
||||
}
|
||||
goog.asserts.assert(offset === 0, 'offset should be 0');
|
||||
goog.asserts.assert(end == flatCoordinates.length,
|
||||
ol.DEBUG && console.assert(offset === 0, 'offset should be 0');
|
||||
ol.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_,
|
||||
@@ -310,8 +309,8 @@ ol.render.canvas.Immediate.prototype.drawText_ = function(flatCoordinates, offse
|
||||
this.setContextStrokeState_(this.textStrokeState_);
|
||||
}
|
||||
this.setContextTextState_(this.textState_);
|
||||
goog.asserts.assert(offset === 0, 'offset should be 0');
|
||||
goog.asserts.assert(end == flatCoordinates.length,
|
||||
ol.DEBUG && console.assert(offset === 0, 'offset should be 0');
|
||||
ol.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_,
|
||||
@@ -477,7 +476,7 @@ ol.render.canvas.Immediate.prototype.drawGeometry = function(geometry) {
|
||||
this.drawCircle(/** @type {ol.geom.Circle} */ (geometry));
|
||||
break;
|
||||
default:
|
||||
goog.asserts.fail('Unsupported geometry type: ' + type);
|
||||
ol.DEBUG && console.assert(false, 'Unsupported geometry type: ' + type);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -499,7 +498,7 @@ ol.render.canvas.Immediate.prototype.drawFeature = function(feature, style) {
|
||||
return;
|
||||
}
|
||||
this.setStyle(style);
|
||||
goog.asserts.assert(geometry, 'geometry must be truthy');
|
||||
ol.DEBUG && console.assert(geometry, 'geometry must be truthy');
|
||||
this.drawGeometry(geometry);
|
||||
};
|
||||
|
||||
@@ -853,10 +852,10 @@ ol.render.canvas.Immediate.prototype.setImageStyle = function(imageStyle) {
|
||||
var imageImage = imageStyle.getImage(1);
|
||||
var imageOrigin = imageStyle.getOrigin();
|
||||
var imageSize = imageStyle.getSize();
|
||||
goog.asserts.assert(imageAnchor, 'imageAnchor must be truthy');
|
||||
goog.asserts.assert(imageImage, 'imageImage must be truthy');
|
||||
goog.asserts.assert(imageOrigin, 'imageOrigin must be truthy');
|
||||
goog.asserts.assert(imageSize, 'imageSize must be truthy');
|
||||
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');
|
||||
this.imageAnchorX_ = imageAnchor[0];
|
||||
this.imageAnchorY_ = imageAnchor[1];
|
||||
this.imageHeight_ = imageSize[1];
|
||||
|
||||
@@ -8,7 +8,6 @@ goog.provide('ol.render.canvas.Replay');
|
||||
goog.provide('ol.render.canvas.ReplayGroup');
|
||||
goog.provide('ol.render.canvas.TextReplay');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol.transform');
|
||||
goog.require('ol');
|
||||
goog.require('ol.array');
|
||||
@@ -246,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);
|
||||
goog.asserts.assert(pixelCoordinates === this.pixelCoordinates_,
|
||||
ol.DEBUG && console.assert(pixelCoordinates === this.pixelCoordinates_,
|
||||
'pixelCoordinates should be the same as this.pixelCoordinates_');
|
||||
}
|
||||
var skipFeatures = !ol.object.isEmpty(skippedFeaturesHash);
|
||||
@@ -280,7 +279,7 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
||||
++i;
|
||||
break;
|
||||
case ol.render.canvas.Instruction.CIRCLE:
|
||||
goog.asserts.assert(typeof instruction[1] === 'number',
|
||||
ol.DEBUG && console.assert(typeof instruction[1] === 'number',
|
||||
'second instruction should be a number');
|
||||
d = /** @type {number} */ (instruction[1]);
|
||||
var x1 = pixelCoordinates[d];
|
||||
@@ -298,10 +297,10 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
||||
++i;
|
||||
break;
|
||||
case ol.render.canvas.Instruction.DRAW_IMAGE:
|
||||
goog.asserts.assert(typeof instruction[1] === 'number',
|
||||
ol.DEBUG && console.assert(typeof instruction[1] === 'number',
|
||||
'second instruction should be a number');
|
||||
d = /** @type {number} */ (instruction[1]);
|
||||
goog.asserts.assert(typeof instruction[2] === 'number',
|
||||
ol.DEBUG && console.assert(typeof instruction[2] === 'number',
|
||||
'third instruction should be a number');
|
||||
dd = /** @type {number} */ (instruction[2]);
|
||||
var image = /** @type {HTMLCanvasElement|HTMLVideoElement|Image} */
|
||||
@@ -357,31 +356,31 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
||||
++i;
|
||||
break;
|
||||
case ol.render.canvas.Instruction.DRAW_TEXT:
|
||||
goog.asserts.assert(typeof instruction[1] === 'number',
|
||||
ol.DEBUG && console.assert(typeof instruction[1] === 'number',
|
||||
'2nd instruction should be a number');
|
||||
d = /** @type {number} */ (instruction[1]);
|
||||
goog.asserts.assert(typeof instruction[2] === 'number',
|
||||
ol.DEBUG && console.assert(typeof instruction[2] === 'number',
|
||||
'3rd instruction should be a number');
|
||||
dd = /** @type {number} */ (instruction[2]);
|
||||
goog.asserts.assert(typeof instruction[3] === 'string',
|
||||
ol.DEBUG && console.assert(typeof instruction[3] === 'string',
|
||||
'4th instruction should be a string');
|
||||
text = /** @type {string} */ (instruction[3]);
|
||||
goog.asserts.assert(typeof instruction[4] === 'number',
|
||||
ol.DEBUG && console.assert(typeof instruction[4] === 'number',
|
||||
'5th instruction should be a number');
|
||||
var offsetX = /** @type {number} */ (instruction[4]) * pixelRatio;
|
||||
goog.asserts.assert(typeof instruction[5] === 'number',
|
||||
ol.DEBUG && console.assert(typeof instruction[5] === 'number',
|
||||
'6th instruction should be a number');
|
||||
var offsetY = /** @type {number} */ (instruction[5]) * pixelRatio;
|
||||
goog.asserts.assert(typeof instruction[6] === 'number',
|
||||
ol.DEBUG && console.assert(typeof instruction[6] === 'number',
|
||||
'7th instruction should be a number');
|
||||
rotation = /** @type {number} */ (instruction[6]);
|
||||
goog.asserts.assert(typeof instruction[7] === 'number',
|
||||
ol.DEBUG && console.assert(typeof instruction[7] === 'number',
|
||||
'8th instruction should be a number');
|
||||
scale = /** @type {number} */ (instruction[7]) * pixelRatio;
|
||||
goog.asserts.assert(typeof instruction[8] === 'boolean',
|
||||
ol.DEBUG && console.assert(typeof instruction[8] === 'boolean',
|
||||
'9th instruction should be a boolean');
|
||||
fill = /** @type {boolean} */ (instruction[8]);
|
||||
goog.asserts.assert(typeof instruction[9] === 'boolean',
|
||||
ol.DEBUG && console.assert(typeof instruction[9] === 'boolean',
|
||||
'10th instruction should be a boolean');
|
||||
stroke = /** @type {boolean} */ (instruction[9]);
|
||||
for (; d < dd; d += 2) {
|
||||
@@ -442,10 +441,10 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
||||
++i;
|
||||
break;
|
||||
case ol.render.canvas.Instruction.MOVE_TO_LINE_TO:
|
||||
goog.asserts.assert(typeof instruction[1] === 'number',
|
||||
ol.DEBUG && console.assert(typeof instruction[1] === 'number',
|
||||
'2nd instruction should be a number');
|
||||
d = /** @type {number} */ (instruction[1]);
|
||||
goog.asserts.assert(typeof instruction[2] === 'number',
|
||||
ol.DEBUG && console.assert(typeof instruction[2] === 'number',
|
||||
'3rd instruction should be a number');
|
||||
dd = /** @type {number} */ (instruction[2]);
|
||||
x = pixelCoordinates[d];
|
||||
@@ -471,7 +470,7 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
||||
++i;
|
||||
break;
|
||||
case ol.render.canvas.Instruction.SET_FILL_STYLE:
|
||||
goog.asserts.assert(
|
||||
ol.DEBUG && console.assert(
|
||||
ol.colorlike.isColorLike(instruction[1]),
|
||||
'2nd instruction should be a string, ' +
|
||||
'CanvasPattern, or CanvasGradient');
|
||||
@@ -479,17 +478,17 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
||||
++i;
|
||||
break;
|
||||
case ol.render.canvas.Instruction.SET_STROKE_STYLE:
|
||||
goog.asserts.assert(typeof instruction[1] === 'string',
|
||||
ol.DEBUG && console.assert(typeof instruction[1] === 'string',
|
||||
'2nd instruction should be a string');
|
||||
goog.asserts.assert(typeof instruction[2] === 'number',
|
||||
ol.DEBUG && console.assert(typeof instruction[2] === 'number',
|
||||
'3rd instruction should be a number');
|
||||
goog.asserts.assert(typeof instruction[3] === 'string',
|
||||
ol.DEBUG && console.assert(typeof instruction[3] === 'string',
|
||||
'4rd instruction should be a string');
|
||||
goog.asserts.assert(typeof instruction[4] === 'string',
|
||||
ol.DEBUG && console.assert(typeof instruction[4] === 'string',
|
||||
'5th instruction should be a string');
|
||||
goog.asserts.assert(typeof instruction[5] === 'number',
|
||||
ol.DEBUG && console.assert(typeof instruction[5] === 'number',
|
||||
'6th instruction should be a number');
|
||||
goog.asserts.assert(instruction[6],
|
||||
ol.DEBUG && console.assert(instruction[6],
|
||||
'7th instruction should not be null');
|
||||
var usePixelRatio = instruction[7] !== undefined ?
|
||||
instruction[7] : true;
|
||||
@@ -507,11 +506,11 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
||||
++i;
|
||||
break;
|
||||
case ol.render.canvas.Instruction.SET_TEXT_STYLE:
|
||||
goog.asserts.assert(typeof instruction[1] === 'string',
|
||||
ol.DEBUG && console.assert(typeof instruction[1] === 'string',
|
||||
'2nd instruction should be a string');
|
||||
goog.asserts.assert(typeof instruction[2] === 'string',
|
||||
ol.DEBUG && console.assert(typeof instruction[2] === 'string',
|
||||
'3rd instruction should be a string');
|
||||
goog.asserts.assert(typeof instruction[3] === 'string',
|
||||
ol.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]);
|
||||
@@ -523,13 +522,13 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
||||
++i;
|
||||
break;
|
||||
default:
|
||||
goog.asserts.fail('Unknown canvas render instruction');
|
||||
ol.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
|
||||
goog.asserts.assert(i == instructions.length,
|
||||
ol.DEBUG && console.assert(i == instructions.length,
|
||||
'all instructions should be consumed');
|
||||
return undefined;
|
||||
};
|
||||
@@ -590,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) {
|
||||
goog.asserts.assert(begin == -1, 'begin should be -1');
|
||||
ol.DEBUG && console.assert(begin == -1, 'begin should be -1');
|
||||
begin = i;
|
||||
} else if (type == ol.render.canvas.Instruction.BEGIN_GEOMETRY) {
|
||||
instruction[2] = i;
|
||||
goog.asserts.assert(begin >= 0,
|
||||
ol.DEBUG && console.assert(begin >= 0,
|
||||
'begin should be larger than or equal to 0');
|
||||
ol.array.reverseSubArray(this.hitDetectionInstructions, begin, i);
|
||||
begin = -1;
|
||||
@@ -608,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) {
|
||||
goog.asserts.assert(this.beginGeometryInstruction1_,
|
||||
ol.DEBUG && console.assert(this.beginGeometryInstruction1_,
|
||||
'this.beginGeometryInstruction1_ should not be null');
|
||||
this.beginGeometryInstruction1_[2] = this.instructions.length;
|
||||
this.beginGeometryInstruction1_ = null;
|
||||
goog.asserts.assert(this.beginGeometryInstruction2_,
|
||||
ol.DEBUG && console.assert(this.beginGeometryInstruction2_,
|
||||
'this.beginGeometryInstruction2_ should not be null');
|
||||
this.beginGeometryInstruction2_[2] = this.hitDetectionInstructions.length;
|
||||
this.beginGeometryInstruction2_ = null;
|
||||
@@ -756,25 +755,25 @@ ol.render.canvas.ImageReplay.prototype.drawPoint = function(pointGeometry, featu
|
||||
if (!this.image_) {
|
||||
return;
|
||||
}
|
||||
goog.asserts.assert(this.anchorX_ !== undefined,
|
||||
ol.DEBUG && console.assert(this.anchorX_ !== undefined,
|
||||
'this.anchorX_ should be defined');
|
||||
goog.asserts.assert(this.anchorY_ !== undefined,
|
||||
ol.DEBUG && console.assert(this.anchorY_ !== undefined,
|
||||
'this.anchorY_ should be defined');
|
||||
goog.asserts.assert(this.height_ !== undefined,
|
||||
ol.DEBUG && console.assert(this.height_ !== undefined,
|
||||
'this.height_ should be defined');
|
||||
goog.asserts.assert(this.opacity_ !== undefined,
|
||||
ol.DEBUG && console.assert(this.opacity_ !== undefined,
|
||||
'this.opacity_ should be defined');
|
||||
goog.asserts.assert(this.originX_ !== undefined,
|
||||
ol.DEBUG && console.assert(this.originX_ !== undefined,
|
||||
'this.originX_ should be defined');
|
||||
goog.asserts.assert(this.originY_ !== undefined,
|
||||
ol.DEBUG && console.assert(this.originY_ !== undefined,
|
||||
'this.originY_ should be defined');
|
||||
goog.asserts.assert(this.rotateWithView_ !== undefined,
|
||||
ol.DEBUG && console.assert(this.rotateWithView_ !== undefined,
|
||||
'this.rotateWithView_ should be defined');
|
||||
goog.asserts.assert(this.rotation_ !== undefined,
|
||||
ol.DEBUG && console.assert(this.rotation_ !== undefined,
|
||||
'this.rotation_ should be defined');
|
||||
goog.asserts.assert(this.scale_ !== undefined,
|
||||
ol.DEBUG && console.assert(this.scale_ !== undefined,
|
||||
'this.scale_ should be defined');
|
||||
goog.asserts.assert(this.width_ !== undefined,
|
||||
ol.DEBUG && console.assert(this.width_ !== undefined,
|
||||
'this.width_ should be defined');
|
||||
this.beginGeometry(pointGeometry, feature);
|
||||
var flatCoordinates = pointGeometry.getFlatCoordinates();
|
||||
@@ -808,25 +807,25 @@ ol.render.canvas.ImageReplay.prototype.drawMultiPoint = function(multiPointGeome
|
||||
if (!this.image_) {
|
||||
return;
|
||||
}
|
||||
goog.asserts.assert(this.anchorX_ !== undefined,
|
||||
ol.DEBUG && console.assert(this.anchorX_ !== undefined,
|
||||
'this.anchorX_ should be defined');
|
||||
goog.asserts.assert(this.anchorY_ !== undefined,
|
||||
ol.DEBUG && console.assert(this.anchorY_ !== undefined,
|
||||
'this.anchorY_ should be defined');
|
||||
goog.asserts.assert(this.height_ !== undefined,
|
||||
ol.DEBUG && console.assert(this.height_ !== undefined,
|
||||
'this.height_ should be defined');
|
||||
goog.asserts.assert(this.opacity_ !== undefined,
|
||||
ol.DEBUG && console.assert(this.opacity_ !== undefined,
|
||||
'this.opacity_ should be defined');
|
||||
goog.asserts.assert(this.originX_ !== undefined,
|
||||
ol.DEBUG && console.assert(this.originX_ !== undefined,
|
||||
'this.originX_ should be defined');
|
||||
goog.asserts.assert(this.originY_ !== undefined,
|
||||
ol.DEBUG && console.assert(this.originY_ !== undefined,
|
||||
'this.originY_ should be defined');
|
||||
goog.asserts.assert(this.rotateWithView_ !== undefined,
|
||||
ol.DEBUG && console.assert(this.rotateWithView_ !== undefined,
|
||||
'this.rotateWithView_ should be defined');
|
||||
goog.asserts.assert(this.rotation_ !== undefined,
|
||||
ol.DEBUG && console.assert(this.rotation_ !== undefined,
|
||||
'this.rotation_ should be defined');
|
||||
goog.asserts.assert(this.scale_ !== undefined,
|
||||
ol.DEBUG && console.assert(this.scale_ !== undefined,
|
||||
'this.scale_ should be defined');
|
||||
goog.asserts.assert(this.width_ !== undefined,
|
||||
ol.DEBUG && console.assert(this.width_ !== undefined,
|
||||
'this.width_ should be defined');
|
||||
this.beginGeometry(multiPointGeometry, feature);
|
||||
var flatCoordinates = multiPointGeometry.getFlatCoordinates();
|
||||
@@ -879,18 +878,18 @@ ol.render.canvas.ImageReplay.prototype.finish = function() {
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.canvas.ImageReplay.prototype.setImageStyle = function(imageStyle) {
|
||||
goog.asserts.assert(imageStyle, 'imageStyle should not be null');
|
||||
ol.DEBUG && console.assert(imageStyle, 'imageStyle should not be null');
|
||||
var anchor = imageStyle.getAnchor();
|
||||
goog.asserts.assert(anchor, 'anchor should not be null');
|
||||
ol.DEBUG && console.assert(anchor, 'anchor should not be null');
|
||||
var size = imageStyle.getSize();
|
||||
goog.asserts.assert(size, 'size should not be null');
|
||||
ol.DEBUG && console.assert(size, 'size should not be null');
|
||||
var hitDetectionImage = imageStyle.getHitDetectionImage(1);
|
||||
goog.asserts.assert(hitDetectionImage,
|
||||
ol.DEBUG && console.assert(hitDetectionImage,
|
||||
'hitDetectionImage should not be null');
|
||||
var image = imageStyle.getImage(1);
|
||||
goog.asserts.assert(image, 'image should not be null');
|
||||
ol.DEBUG && console.assert(image, 'image should not be null');
|
||||
var origin = imageStyle.getOrigin();
|
||||
goog.asserts.assert(origin, 'origin should not be null');
|
||||
ol.DEBUG && console.assert(origin, 'origin should not be null');
|
||||
this.anchorX_ = anchor[0];
|
||||
this.anchorY_ = anchor[1];
|
||||
this.hitDetectionImage_ = hitDetectionImage;
|
||||
@@ -1002,13 +1001,13 @@ ol.render.canvas.LineStringReplay.prototype.setStrokeStyle_ = function() {
|
||||
var lineJoin = state.lineJoin;
|
||||
var lineWidth = state.lineWidth;
|
||||
var miterLimit = state.miterLimit;
|
||||
goog.asserts.assert(strokeStyle !== undefined,
|
||||
ol.DEBUG && console.assert(strokeStyle !== undefined,
|
||||
'strokeStyle should be defined');
|
||||
goog.asserts.assert(lineCap !== undefined, 'lineCap should be defined');
|
||||
goog.asserts.assert(lineDash, 'lineDash should not be null');
|
||||
goog.asserts.assert(lineJoin !== undefined, 'lineJoin should be defined');
|
||||
goog.asserts.assert(lineWidth !== undefined, 'lineWidth should be defined');
|
||||
goog.asserts.assert(miterLimit !== undefined, 'miterLimit 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');
|
||||
if (state.currentStrokeStyle != strokeStyle ||
|
||||
state.currentLineCap != lineCap ||
|
||||
!ol.array.equals(state.currentLineDash, lineDash) ||
|
||||
@@ -1039,7 +1038,7 @@ ol.render.canvas.LineStringReplay.prototype.setStrokeStyle_ = function() {
|
||||
*/
|
||||
ol.render.canvas.LineStringReplay.prototype.drawLineString = function(lineStringGeometry, feature) {
|
||||
var state = this.state_;
|
||||
goog.asserts.assert(state, 'state should not be null');
|
||||
ol.DEBUG && console.assert(state, 'state should not be null');
|
||||
var strokeStyle = state.strokeStyle;
|
||||
var lineWidth = state.lineWidth;
|
||||
if (strokeStyle === undefined || lineWidth === undefined) {
|
||||
@@ -1066,7 +1065,7 @@ ol.render.canvas.LineStringReplay.prototype.drawLineString = function(lineString
|
||||
*/
|
||||
ol.render.canvas.LineStringReplay.prototype.drawMultiLineString = function(multiLineStringGeometry, feature) {
|
||||
var state = this.state_;
|
||||
goog.asserts.assert(state, 'state should not be null');
|
||||
ol.DEBUG && console.assert(state, 'state should not be null');
|
||||
var strokeStyle = state.strokeStyle;
|
||||
var lineWidth = state.lineWidth;
|
||||
if (strokeStyle === undefined || lineWidth === undefined) {
|
||||
@@ -1098,7 +1097,7 @@ ol.render.canvas.LineStringReplay.prototype.drawMultiLineString = function(multi
|
||||
*/
|
||||
ol.render.canvas.LineStringReplay.prototype.finish = function() {
|
||||
var state = this.state_;
|
||||
goog.asserts.assert(state, 'state should not be null');
|
||||
ol.DEBUG && console.assert(state, 'state should not be null');
|
||||
if (state.lastStroke != this.coordinates.length) {
|
||||
this.instructions.push([ol.render.canvas.Instruction.STROKE]);
|
||||
}
|
||||
@@ -1111,9 +1110,9 @@ ol.render.canvas.LineStringReplay.prototype.finish = function() {
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.canvas.LineStringReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {
|
||||
goog.asserts.assert(this.state_, 'this.state_ should not be null');
|
||||
goog.asserts.assert(!fillStyle, 'fillStyle should be null');
|
||||
goog.asserts.assert(strokeStyle, 'strokeStyle should not be null');
|
||||
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');
|
||||
var strokeStyleColor = strokeStyle.getColor();
|
||||
this.state_.strokeStyle = ol.color.asString(strokeStyleColor ?
|
||||
strokeStyleColor : ol.render.canvas.defaultStrokeStyle);
|
||||
@@ -1227,7 +1226,7 @@ ol.render.canvas.PolygonReplay.prototype.drawFlatCoordinatess_ = function(flatCo
|
||||
this.instructions.push(fillInstruction);
|
||||
}
|
||||
if (state.strokeStyle !== undefined) {
|
||||
goog.asserts.assert(state.lineWidth !== undefined,
|
||||
ol.DEBUG && console.assert(state.lineWidth !== undefined,
|
||||
'state.lineWidth should be defined');
|
||||
var strokeInstruction = [ol.render.canvas.Instruction.STROKE];
|
||||
this.instructions.push(strokeInstruction);
|
||||
@@ -1242,14 +1241,14 @@ ol.render.canvas.PolygonReplay.prototype.drawFlatCoordinatess_ = function(flatCo
|
||||
*/
|
||||
ol.render.canvas.PolygonReplay.prototype.drawCircle = function(circleGeometry, feature) {
|
||||
var state = this.state_;
|
||||
goog.asserts.assert(state, 'state should not be null');
|
||||
ol.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) {
|
||||
goog.asserts.assert(state.lineWidth !== undefined,
|
||||
ol.DEBUG && console.assert(state.lineWidth !== undefined,
|
||||
'state.lineWidth should be defined');
|
||||
}
|
||||
this.setFillStrokeStyles_();
|
||||
@@ -1279,7 +1278,7 @@ ol.render.canvas.PolygonReplay.prototype.drawCircle = function(circleGeometry, f
|
||||
this.instructions.push(fillInstruction);
|
||||
}
|
||||
if (state.strokeStyle !== undefined) {
|
||||
goog.asserts.assert(state.lineWidth !== undefined,
|
||||
ol.DEBUG && console.assert(state.lineWidth !== undefined,
|
||||
'state.lineWidth should be defined');
|
||||
var strokeInstruction = [ol.render.canvas.Instruction.STROKE];
|
||||
this.instructions.push(strokeInstruction);
|
||||
@@ -1294,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_;
|
||||
goog.asserts.assert(state, 'state should not be null');
|
||||
ol.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) {
|
||||
goog.asserts.assert(state.lineWidth !== undefined,
|
||||
ol.DEBUG && console.assert(state.lineWidth !== undefined,
|
||||
'state.lineWidth should be defined');
|
||||
}
|
||||
this.setFillStrokeStyles_();
|
||||
@@ -1329,14 +1328,14 @@ ol.render.canvas.PolygonReplay.prototype.drawPolygon = function(polygonGeometry,
|
||||
*/
|
||||
ol.render.canvas.PolygonReplay.prototype.drawMultiPolygon = function(multiPolygonGeometry, feature) {
|
||||
var state = this.state_;
|
||||
goog.asserts.assert(state, 'state should not be null');
|
||||
ol.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) {
|
||||
goog.asserts.assert(state.lineWidth !== undefined,
|
||||
ol.DEBUG && console.assert(state.lineWidth !== undefined,
|
||||
'state.lineWidth should be defined');
|
||||
}
|
||||
this.setFillStrokeStyles_();
|
||||
@@ -1368,7 +1367,7 @@ ol.render.canvas.PolygonReplay.prototype.drawMultiPolygon = function(multiPolygo
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.canvas.PolygonReplay.prototype.finish = function() {
|
||||
goog.asserts.assert(this.state_, 'this.state_ should not be null');
|
||||
ol.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
|
||||
@@ -1405,8 +1404,8 @@ ol.render.canvas.PolygonReplay.prototype.getBufferedMaxExtent = function() {
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.canvas.PolygonReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {
|
||||
goog.asserts.assert(this.state_, 'this.state_ should not be null');
|
||||
goog.asserts.assert(fillStyle || strokeStyle,
|
||||
ol.DEBUG && console.assert(this.state_, 'this.state_ should not be null');
|
||||
ol.DEBUG && console.assert(fillStyle || strokeStyle,
|
||||
'fillStyle or strokeStyle should not be null');
|
||||
var state = this.state_;
|
||||
if (fillStyle) {
|
||||
@@ -1470,11 +1469,11 @@ ol.render.canvas.PolygonReplay.prototype.setFillStrokeStyles_ = function() {
|
||||
state.currentFillStyle = state.fillStyle;
|
||||
}
|
||||
if (strokeStyle !== undefined) {
|
||||
goog.asserts.assert(lineCap !== undefined, 'lineCap should be defined');
|
||||
goog.asserts.assert(lineDash, 'lineDash should not be null');
|
||||
goog.asserts.assert(lineJoin !== undefined, 'lineJoin should be defined');
|
||||
goog.asserts.assert(lineWidth !== undefined, 'lineWidth should be defined');
|
||||
goog.asserts.assert(miterLimit !== 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,
|
||||
'miterLimit should be defined');
|
||||
if (state.currentStrokeStyle != strokeStyle ||
|
||||
state.currentLineCap != lineCap ||
|
||||
@@ -1943,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];
|
||||
goog.asserts.assert(Constructor !== undefined,
|
||||
ol.DEBUG && console.assert(Constructor !== undefined,
|
||||
replayType +
|
||||
' constructor missing from ol.render.canvas.BATCH_CONSTRUCTORS_');
|
||||
replay = new Constructor(this.tolerance_, this.maxExtent_,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
goog.provide('ol.render.Feature');
|
||||
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
|
||||
@@ -26,7 +25,7 @@ ol.render.Feature = function(type, flatCoordinates, ends, properties) {
|
||||
*/
|
||||
this.extent_;
|
||||
|
||||
goog.asserts.assert(type === ol.geom.GeometryType.POINT ||
|
||||
ol.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 ||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
goog.provide('ol.renderer.vector');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol.render.Feature');
|
||||
goog.require('ol.render.IReplayGroup');
|
||||
goog.require('ol.style.ImageState');
|
||||
@@ -89,7 +88,7 @@ ol.renderer.vector.renderFeature = function(
|
||||
imageStyle.load();
|
||||
}
|
||||
imageState = imageStyle.getImageState();
|
||||
goog.asserts.assert(imageState == ol.style.ImageState.LOADING,
|
||||
ol.DEBUG && console.assert(imageState == ol.style.ImageState.LOADING,
|
||||
'imageState should be LOADING');
|
||||
imageStyle.listenImageChange(listener, thisArg);
|
||||
loading = true;
|
||||
@@ -117,7 +116,7 @@ ol.renderer.vector.renderFeature_ = function(
|
||||
var simplifiedGeometry = geometry.getSimplifiedGeometry(squaredTolerance);
|
||||
var geometryRenderer =
|
||||
ol.renderer.vector.GEOMETRY_RENDERERS_[simplifiedGeometry.getType()];
|
||||
goog.asserts.assert(geometryRenderer !== undefined,
|
||||
ol.DEBUG && console.assert(geometryRenderer !== undefined,
|
||||
'geometryRenderer should be defined');
|
||||
geometryRenderer(replayGroup, simplifiedGeometry, style, feature);
|
||||
};
|
||||
@@ -136,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()];
|
||||
goog.asserts.assert(geometryRenderer !== undefined,
|
||||
ol.DEBUG && console.assert(geometryRenderer !== undefined,
|
||||
'geometryRenderer should be defined');
|
||||
geometryRenderer(replayGroup, geometries[i], style, feature);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
goog.provide('ol.render.webgl.Immediate');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
goog.require('ol.render.VectorContext');
|
||||
@@ -99,7 +98,7 @@ ol.render.webgl.Immediate.prototype.drawGeometry = function(geometry) {
|
||||
this.drawGeometryCollection(/** @type {ol.geom.GeometryCollection} */ (geometry), null);
|
||||
break;
|
||||
default:
|
||||
goog.asserts.fail('Unsupported geometry type: ' + type);
|
||||
ol.DEBUG && console.assert(false, 'Unsupported geometry type: ' + type);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -115,7 +114,7 @@ ol.render.webgl.Immediate.prototype.drawFeature = function(feature, style) {
|
||||
return;
|
||||
}
|
||||
this.setStyle(style);
|
||||
goog.asserts.assert(geometry, 'geometry must be truthy');
|
||||
ol.DEBUG && console.assert(geometry, 'geometry must be truthy');
|
||||
this.drawGeometry(geometry);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
goog.provide('ol.render.webgl.ImageReplay');
|
||||
goog.provide('ol.render.webgl.ReplayGroup');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol.transform');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.object');
|
||||
@@ -226,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.
|
||||
goog.asserts.assert(this.verticesBuffer_,
|
||||
ol.DEBUG && console.assert(this.verticesBuffer_,
|
||||
'verticesBuffer must not be null');
|
||||
goog.asserts.assert(this.indicesBuffer_,
|
||||
ol.DEBUG && console.assert(this.indicesBuffer_,
|
||||
'indicesBuffer must not be null');
|
||||
var verticesBuffer = this.verticesBuffer_;
|
||||
var indicesBuffer = this.indicesBuffer_;
|
||||
@@ -260,32 +259,32 @@ ol.render.webgl.ImageReplay.prototype.getDeleteResourcesFunction = function(cont
|
||||
* @private
|
||||
*/
|
||||
ol.render.webgl.ImageReplay.prototype.drawCoordinates_ = function(flatCoordinates, offset, end, stride) {
|
||||
goog.asserts.assert(this.anchorX_ !== undefined, 'anchorX is defined');
|
||||
goog.asserts.assert(this.anchorY_ !== undefined, 'anchorY is defined');
|
||||
goog.asserts.assert(this.height_ !== undefined, 'height is defined');
|
||||
goog.asserts.assert(this.imageHeight_ !== undefined,
|
||||
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,
|
||||
'imageHeight is defined');
|
||||
goog.asserts.assert(this.imageWidth_ !== undefined, 'imageWidth is defined');
|
||||
goog.asserts.assert(this.opacity_ !== undefined, 'opacity is defined');
|
||||
goog.asserts.assert(this.originX_ !== undefined, 'originX is defined');
|
||||
goog.asserts.assert(this.originY_ !== undefined, 'originY is defined');
|
||||
goog.asserts.assert(this.rotateWithView_ !== undefined,
|
||||
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,
|
||||
'rotateWithView is defined');
|
||||
goog.asserts.assert(this.rotation_ !== undefined, 'rotation is defined');
|
||||
goog.asserts.assert(this.scale_ !== undefined, 'scale is defined');
|
||||
goog.asserts.assert(this.width_ !== undefined, 'width is defined');
|
||||
var anchorX = this.anchorX_;
|
||||
var anchorY = this.anchorY_;
|
||||
var height = this.height_;
|
||||
var imageHeight = this.imageHeight_;
|
||||
var imageWidth = this.imageWidth_;
|
||||
var opacity = this.opacity_;
|
||||
var originX = this.originX_;
|
||||
var originY = this.originY_;
|
||||
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');
|
||||
var anchorX = /** @type {number} */ (this.anchorX_);
|
||||
var anchorY = /** @type {number} */ (this.anchorY_);
|
||||
var height = /** @type {number} */ (this.height_);
|
||||
var imageHeight = /** @type {number} */ (this.imageHeight_);
|
||||
var imageWidth = /** @type {number} */ (this.imageWidth_);
|
||||
var opacity = /** @type {number} */ (this.opacity_);
|
||||
var originX = /** @type {number} */ (this.originX_);
|
||||
var originY = /** @type {number} */ (this.originY_);
|
||||
var rotateWithView = this.rotateWithView_ ? 1.0 : 0.0;
|
||||
var rotation = this.rotation_;
|
||||
var scale = this.scale_;
|
||||
var width = this.width_;
|
||||
var rotation = /** @type {number} */ (this.rotation_);
|
||||
var scale = /** @type {number} */ (this.scale_);
|
||||
var width = /** @type {number} */ (this.width_);
|
||||
var cos = Math.cos(rotation);
|
||||
var sin = Math.sin(rotation);
|
||||
var numIndices = this.indices_.length;
|
||||
@@ -400,10 +399,10 @@ ol.render.webgl.ImageReplay.prototype.finish = function(context) {
|
||||
var gl = context.getGL();
|
||||
|
||||
this.groupIndices_.push(this.indices_.length);
|
||||
goog.asserts.assert(this.images_.length === this.groupIndices_.length,
|
||||
ol.DEBUG && console.assert(this.images_.length === this.groupIndices_.length,
|
||||
'number of images and groupIndices match');
|
||||
this.hitDetectionGroupIndices_.push(this.indices_.length);
|
||||
goog.asserts.assert(this.hitDetectionImages_.length ===
|
||||
ol.DEBUG && console.assert(this.hitDetectionImages_.length ===
|
||||
this.hitDetectionGroupIndices_.length,
|
||||
'number of hitDetectionImages and hitDetectionGroupIndices match');
|
||||
|
||||
@@ -413,7 +412,7 @@ ol.render.webgl.ImageReplay.prototype.finish = function(context) {
|
||||
|
||||
var indices = this.indices_;
|
||||
var bits = context.hasOESElementIndexUint ? 32 : 16;
|
||||
goog.asserts.assert(indices[indices.length - 1] < Math.pow(2, bits),
|
||||
ol.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);
|
||||
|
||||
@@ -426,12 +425,12 @@ ol.render.webgl.ImageReplay.prototype.finish = function(context) {
|
||||
var texturePerImage = {};
|
||||
|
||||
this.createTextures_(this.textures_, this.images_, texturePerImage, gl);
|
||||
goog.asserts.assert(this.textures_.length === this.groupIndices_.length,
|
||||
ol.DEBUG && console.assert(this.textures_.length === this.groupIndices_.length,
|
||||
'number of textures and groupIndices match');
|
||||
|
||||
this.createTextures_(this.hitDetectionTextures_, this.hitDetectionImages_,
|
||||
texturePerImage, gl);
|
||||
goog.asserts.assert(this.hitDetectionTextures_.length ===
|
||||
ol.DEBUG && console.assert(this.hitDetectionTextures_.length ===
|
||||
this.hitDetectionGroupIndices_.length,
|
||||
'number of hitDetectionTextures and hitDetectionGroupIndices match');
|
||||
|
||||
@@ -463,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) {
|
||||
goog.asserts.assert(textures.length === 0,
|
||||
ol.DEBUG && console.assert(textures.length === 0,
|
||||
'upon creation, textures is empty');
|
||||
|
||||
var texture, image, uid, i;
|
||||
@@ -508,12 +507,12 @@ ol.render.webgl.ImageReplay.prototype.replay = function(context,
|
||||
var gl = context.getGL();
|
||||
|
||||
// bind the vertices buffer
|
||||
goog.asserts.assert(this.verticesBuffer_,
|
||||
ol.DEBUG && console.assert(this.verticesBuffer_,
|
||||
'verticesBuffer must not be null');
|
||||
context.bindBuffer(ol.webgl.ARRAY_BUFFER, this.verticesBuffer_);
|
||||
|
||||
// bind the indices buffer
|
||||
goog.asserts.assert(this.indicesBuffer_,
|
||||
ol.DEBUG && console.assert(this.indicesBuffer_,
|
||||
'indecesBuffer must not be null');
|
||||
context.bindBuffer(ol.webgl.ELEMENT_ARRAY_BUFFER, this.indicesBuffer_);
|
||||
|
||||
@@ -612,7 +611,7 @@ ol.render.webgl.ImageReplay.prototype.replay = function(context,
|
||||
* @param {Array.<number>} groupIndices Texture group indices.
|
||||
*/
|
||||
ol.render.webgl.ImageReplay.prototype.drawReplay_ = function(gl, context, skippedFeaturesHash, textures, groupIndices) {
|
||||
goog.asserts.assert(textures.length === groupIndices.length,
|
||||
ol.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;
|
||||
@@ -786,7 +785,7 @@ ol.render.webgl.ImageReplay.prototype.drawHitDetectionReplayAll_ = function(gl,
|
||||
*/
|
||||
ol.render.webgl.ImageReplay.prototype.drawHitDetectionReplayOneByOne_ = function(gl, context, skippedFeaturesHash, featureCallback,
|
||||
opt_hitExtent) {
|
||||
goog.asserts.assert(this.hitDetectionTextures_.length ===
|
||||
ol.DEBUG && console.assert(this.hitDetectionTextures_.length ===
|
||||
this.hitDetectionGroupIndices_.length,
|
||||
'number of hitDetectionTextures and hitDetectionGroupIndices match');
|
||||
var elementType = context.hasOESElementIndexUint ?
|
||||
@@ -851,21 +850,21 @@ ol.render.webgl.ImageReplay.prototype.setImageStyle = function(imageStyle) {
|
||||
var rotation = imageStyle.getRotation();
|
||||
var size = imageStyle.getSize();
|
||||
var scale = imageStyle.getScale();
|
||||
goog.asserts.assert(anchor, 'imageStyle anchor is not null');
|
||||
goog.asserts.assert(image, 'imageStyle image is not null');
|
||||
goog.asserts.assert(imageSize,
|
||||
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,
|
||||
'imageStyle imageSize is not null');
|
||||
goog.asserts.assert(hitDetectionImage,
|
||||
ol.DEBUG && console.assert(hitDetectionImage,
|
||||
'imageStyle hitDetectionImage is not null');
|
||||
goog.asserts.assert(hitDetectionImageSize,
|
||||
ol.DEBUG && console.assert(hitDetectionImageSize,
|
||||
'imageStyle hitDetectionImageSize is not null');
|
||||
goog.asserts.assert(opacity !== undefined, 'imageStyle opacity is defined');
|
||||
goog.asserts.assert(origin, 'imageStyle origin is not null');
|
||||
goog.asserts.assert(rotateWithView !== undefined,
|
||||
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,
|
||||
'imageStyle rotateWithView is defined');
|
||||
goog.asserts.assert(rotation !== undefined, 'imageStyle rotation is defined');
|
||||
goog.asserts.assert(size, 'imageStyle size is not null');
|
||||
goog.asserts.assert(scale !== undefined, 'imageStyle scale 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');
|
||||
|
||||
var currentImage;
|
||||
if (this.images_.length === 0) {
|
||||
@@ -874,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);
|
||||
goog.asserts.assert(this.groupIndices_.length === this.images_.length,
|
||||
ol.DEBUG && console.assert(this.groupIndices_.length === this.images_.length,
|
||||
'number of groupIndices and images match');
|
||||
this.images_.push(image);
|
||||
}
|
||||
@@ -887,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);
|
||||
goog.asserts.assert(this.hitDetectionGroupIndices_.length ===
|
||||
ol.DEBUG && console.assert(this.hitDetectionGroupIndices_.length ===
|
||||
this.hitDetectionImages_.length,
|
||||
'number of hitDetectionGroupIndices and hitDetectionImages match');
|
||||
this.hitDetectionImages_.push(hitDetectionImage);
|
||||
@@ -988,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];
|
||||
goog.asserts.assert(constructor !== undefined,
|
||||
ol.DEBUG && console.assert(constructor !== undefined,
|
||||
replayType +
|
||||
' constructor missing from ol.render.webgl.BATCH_CONSTRUCTORS_');
|
||||
replay = new constructor(this.tolerance_, this.maxExtent_);
|
||||
|
||||
Reference in New Issue
Block a user