Add assert messages for all assertions up until ol.renderer.vector.
This commit is contained in:
@@ -253,8 +253,9 @@ ol.render.canvas.Immediate.prototype.drawImages_ =
|
||||
if (goog.isNull(this.image_)) {
|
||||
return;
|
||||
}
|
||||
goog.asserts.assert(offset === 0);
|
||||
goog.asserts.assert(end == flatCoordinates.length);
|
||||
goog.asserts.assert(offset === 0, 'offset should be 0');
|
||||
goog.asserts.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_,
|
||||
this.pixelCoordinates_);
|
||||
@@ -322,8 +323,9 @@ ol.render.canvas.Immediate.prototype.drawText_ =
|
||||
this.setContextStrokeState_(this.textStrokeState_);
|
||||
}
|
||||
this.setContextTextState_(this.textState_);
|
||||
goog.asserts.assert(offset === 0);
|
||||
goog.asserts.assert(end == flatCoordinates.length);
|
||||
goog.asserts.assert(offset === 0, 'offset should be 0');
|
||||
goog.asserts.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_,
|
||||
this.pixelCoordinates_);
|
||||
@@ -492,7 +494,8 @@ ol.render.canvas.Immediate.prototype.drawFeature = function(feature, style) {
|
||||
render.setTextStyle(style.getText());
|
||||
var renderGeometry =
|
||||
ol.render.canvas.Immediate.GEOMETRY_RENDERERS_[geometry.getType()];
|
||||
goog.asserts.assert(goog.isDef(renderGeometry));
|
||||
goog.asserts.assert(goog.isDef(renderGeometry),
|
||||
'renderGeometry should be defined');
|
||||
renderGeometry.call(render, geometry, null);
|
||||
});
|
||||
};
|
||||
@@ -514,7 +517,8 @@ ol.render.canvas.Immediate.prototype.drawGeometryCollectionGeometry =
|
||||
var geometry = geometries[i];
|
||||
var geometryRenderer =
|
||||
ol.render.canvas.Immediate.GEOMETRY_RENDERERS_[geometry.getType()];
|
||||
goog.asserts.assert(goog.isDef(geometryRenderer));
|
||||
goog.asserts.assert(goog.isDef(geometryRenderer),
|
||||
'geometryRenderer should be defined');
|
||||
geometryRenderer.call(this, geometry, feature);
|
||||
}
|
||||
};
|
||||
@@ -901,10 +905,14 @@ ol.render.canvas.Immediate.prototype.setImageStyle = function(imageStyle) {
|
||||
var imageImage = imageStyle.getImage(1);
|
||||
var imageOrigin = imageStyle.getOrigin();
|
||||
var imageSize = imageStyle.getSize();
|
||||
goog.asserts.assert(!goog.isNull(imageAnchor));
|
||||
goog.asserts.assert(!goog.isNull(imageImage));
|
||||
goog.asserts.assert(!goog.isNull(imageOrigin));
|
||||
goog.asserts.assert(!goog.isNull(imageSize));
|
||||
goog.asserts.assert(!goog.isNull(imageAnchor),
|
||||
'imageAnchor should not be null');
|
||||
goog.asserts.assert(!goog.isNull(imageImage),
|
||||
'imageImage should not be null');
|
||||
goog.asserts.assert(!goog.isNull(imageOrigin),
|
||||
'imageOrigin should not be null');
|
||||
goog.asserts.assert(!goog.isNull(imageSize),
|
||||
'imageSize should not be null');
|
||||
this.imageAnchorX_ = imageAnchor[0];
|
||||
this.imageAnchorY_ = imageAnchor[1];
|
||||
this.imageHeight_ = imageSize[1];
|
||||
|
||||
@@ -235,7 +235,8 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
||||
this.coordinates, 0, this.coordinates.length, 2,
|
||||
transform, this.pixelCoordinates_);
|
||||
goog.vec.Mat4.setFromArray(this.renderedTransform_, transform);
|
||||
goog.asserts.assert(pixelCoordinates === this.pixelCoordinates_);
|
||||
goog.asserts.assert(pixelCoordinates === this.pixelCoordinates_,
|
||||
'pixelCoordinates should be the same as this.pixelCoordinates_');
|
||||
}
|
||||
var i = 0; // instruction index
|
||||
var ii = instructions.length; // end of instructions
|
||||
@@ -264,7 +265,8 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
||||
++i;
|
||||
break;
|
||||
case ol.render.canvas.Instruction.CIRCLE:
|
||||
goog.asserts.assert(goog.isNumber(instruction[1]));
|
||||
goog.asserts.assert(goog.isNumber(instruction[1]),
|
||||
'second instruction should be a number');
|
||||
d = /** @type {number} */ (instruction[1]);
|
||||
var x1 = pixelCoordinates[d];
|
||||
var y1 = pixelCoordinates[d + 1];
|
||||
@@ -281,9 +283,11 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
||||
++i;
|
||||
break;
|
||||
case ol.render.canvas.Instruction.DRAW_IMAGE:
|
||||
goog.asserts.assert(goog.isNumber(instruction[1]));
|
||||
goog.asserts.assert(goog.isNumber(instruction[1]),
|
||||
'second instruction should be a number');
|
||||
d = /** @type {number} */ (instruction[1]);
|
||||
goog.asserts.assert(goog.isNumber(instruction[2]));
|
||||
goog.asserts.assert(goog.isNumber(instruction[2]),
|
||||
'third instruction should be a number');
|
||||
dd = /** @type {number} */ (instruction[2]);
|
||||
var image = /** @type {HTMLCanvasElement|HTMLVideoElement|Image} */
|
||||
(instruction[3]);
|
||||
@@ -341,23 +345,32 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
||||
++i;
|
||||
break;
|
||||
case ol.render.canvas.Instruction.DRAW_TEXT:
|
||||
goog.asserts.assert(goog.isNumber(instruction[1]));
|
||||
goog.asserts.assert(goog.isNumber(instruction[1]),
|
||||
'2nd instruction should be a number');
|
||||
d = /** @type {number} */ (instruction[1]);
|
||||
goog.asserts.assert(goog.isNumber(instruction[2]));
|
||||
goog.asserts.assert(goog.isNumber(instruction[2]),
|
||||
'3rd instruction should be a number');
|
||||
dd = /** @type {number} */ (instruction[2]);
|
||||
goog.asserts.assert(goog.isString(instruction[3]));
|
||||
goog.asserts.assert(goog.isString(instruction[3]),
|
||||
'4th instruction should be a number');
|
||||
text = /** @type {string} */ (instruction[3]);
|
||||
goog.asserts.assert(goog.isNumber(instruction[4]));
|
||||
goog.asserts.assert(goog.isNumber(instruction[4]),
|
||||
'5th instruction should be a number');
|
||||
var offsetX = /** @type {number} */ (instruction[4]) * pixelRatio;
|
||||
goog.asserts.assert(goog.isNumber(instruction[5]));
|
||||
goog.asserts.assert(goog.isNumber(instruction[5]),
|
||||
'6th instruction should be a number');
|
||||
var offsetY = /** @type {number} */ (instruction[5]) * pixelRatio;
|
||||
goog.asserts.assert(goog.isNumber(instruction[6]));
|
||||
goog.asserts.assert(goog.isNumber(instruction[6]),
|
||||
'7th instruction should be a number');
|
||||
rotation = /** @type {number} */ (instruction[6]);
|
||||
goog.asserts.assert(goog.isNumber(instruction[7]));
|
||||
goog.asserts.assert(goog.isNumber(instruction[7]),
|
||||
'8th instruction should be a number');
|
||||
scale = /** @type {number} */ (instruction[7]) * pixelRatio;
|
||||
goog.asserts.assert(goog.isBoolean(instruction[8]));
|
||||
goog.asserts.assert(goog.isBoolean(instruction[8]),
|
||||
'9th instruction should be a boolean');
|
||||
fill = /** @type {boolean} */ (instruction[8]);
|
||||
goog.asserts.assert(goog.isBoolean(instruction[9]));
|
||||
goog.asserts.assert(goog.isBoolean(instruction[9]),
|
||||
'10th instruction should be a boolean');
|
||||
stroke = /** @type {boolean} */ (instruction[9]);
|
||||
for (; d < dd; d += 2) {
|
||||
x = pixelCoordinates[d] + offsetX;
|
||||
@@ -400,9 +413,11 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
||||
++i;
|
||||
break;
|
||||
case ol.render.canvas.Instruction.MOVE_TO_LINE_TO:
|
||||
goog.asserts.assert(goog.isNumber(instruction[1]));
|
||||
goog.asserts.assert(goog.isNumber(instruction[1]),
|
||||
'2nd instruction should be a number');
|
||||
d = /** @type {number} */ (instruction[1]);
|
||||
goog.asserts.assert(goog.isNumber(instruction[2]));
|
||||
goog.asserts.assert(goog.isNumber(instruction[2]),
|
||||
'3rd instruction should be a number');
|
||||
dd = /** @type {number} */ (instruction[2]);
|
||||
context.moveTo(pixelCoordinates[d], pixelCoordinates[d + 1]);
|
||||
for (d += 2; d < dd; d += 2) {
|
||||
@@ -411,17 +426,24 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
||||
++i;
|
||||
break;
|
||||
case ol.render.canvas.Instruction.SET_FILL_STYLE:
|
||||
goog.asserts.assert(goog.isString(instruction[1]));
|
||||
goog.asserts.assert(goog.isString(instruction[1]),
|
||||
'2nd instruction should be a string');
|
||||
context.fillStyle = /** @type {string} */ (instruction[1]);
|
||||
++i;
|
||||
break;
|
||||
case ol.render.canvas.Instruction.SET_STROKE_STYLE:
|
||||
goog.asserts.assert(goog.isString(instruction[1]));
|
||||
goog.asserts.assert(goog.isNumber(instruction[2]));
|
||||
goog.asserts.assert(goog.isString(instruction[3]));
|
||||
goog.asserts.assert(goog.isString(instruction[4]));
|
||||
goog.asserts.assert(goog.isNumber(instruction[5]));
|
||||
goog.asserts.assert(!goog.isNull(instruction[6]));
|
||||
goog.asserts.assert(goog.isString(instruction[1]),
|
||||
'2nd instruction should be a string');
|
||||
goog.asserts.assert(goog.isNumber(instruction[2]),
|
||||
'3rd instruction should be a number');
|
||||
goog.asserts.assert(goog.isString(instruction[3]),
|
||||
'4rd instruction should be a string');
|
||||
goog.asserts.assert(goog.isString(instruction[4]),
|
||||
'5th instruction should be a string');
|
||||
goog.asserts.assert(goog.isNumber(instruction[5]),
|
||||
'6th instruction should be a number');
|
||||
goog.asserts.assert(!goog.isNull(instruction[6]),
|
||||
'7th instruction should not be null');
|
||||
var usePixelRatio = goog.isDef(instruction[7]) ? instruction[7] : true;
|
||||
var lineWidth = /** @type {number} */ (instruction[2]);
|
||||
context.strokeStyle = /** @type {string} */ (instruction[1]);
|
||||
@@ -435,9 +457,12 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
||||
++i;
|
||||
break;
|
||||
case ol.render.canvas.Instruction.SET_TEXT_STYLE:
|
||||
goog.asserts.assert(goog.isString(instruction[1]));
|
||||
goog.asserts.assert(goog.isString(instruction[2]));
|
||||
goog.asserts.assert(goog.isString(instruction[3]));
|
||||
goog.asserts.assert(goog.isString(instruction[1]),
|
||||
'2nd instruction should be a string');
|
||||
goog.asserts.assert(goog.isString(instruction[2]),
|
||||
'3rd instruction should be a string');
|
||||
goog.asserts.assert(goog.isString(instruction[3]),
|
||||
'4th instruction should be a string');
|
||||
context.font = /** @type {string} */ (instruction[1]);
|
||||
context.textAlign = /** @type {string} */ (instruction[2]);
|
||||
context.textBaseline = /** @type {string} */ (instruction[3]);
|
||||
@@ -448,13 +473,14 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
||||
++i;
|
||||
break;
|
||||
default:
|
||||
goog.asserts.fail();
|
||||
goog.asserts.fail('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);
|
||||
goog.asserts.assert(i == instructions.length,
|
||||
'all instructions should be consumed');
|
||||
return undefined;
|
||||
};
|
||||
|
||||
@@ -512,11 +538,12 @@ ol.render.canvas.Replay.prototype.reverseHitDetectionInstructions_ =
|
||||
instruction = hitDetectionInstructions[i];
|
||||
type = /** @type {ol.render.canvas.Instruction} */ (instruction[0]);
|
||||
if (type == ol.render.canvas.Instruction.END_GEOMETRY) {
|
||||
goog.asserts.assert(begin == -1);
|
||||
goog.asserts.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);
|
||||
goog.asserts.assert(begin >= 0,
|
||||
'begin should be larger than or equal to 0');
|
||||
ol.array.reverseSubArray(this.hitDetectionInstructions, begin, i);
|
||||
begin = -1;
|
||||
}
|
||||
@@ -598,10 +625,12 @@ ol.render.canvas.Replay.prototype.drawText = goog.abstractMethod;
|
||||
* @param {ol.Feature} feature Feature.
|
||||
*/
|
||||
ol.render.canvas.Replay.prototype.endGeometry = function(geometry, feature) {
|
||||
goog.asserts.assert(!goog.isNull(this.beginGeometryInstruction1_));
|
||||
goog.asserts.assert(!goog.isNull(this.beginGeometryInstruction1_),
|
||||
'this.beginGeometryInstruction1_ should not be null');
|
||||
this.beginGeometryInstruction1_[2] = this.instructions.length;
|
||||
this.beginGeometryInstruction1_ = null;
|
||||
goog.asserts.assert(!goog.isNull(this.beginGeometryInstruction2_));
|
||||
goog.asserts.assert(!goog.isNull(this.beginGeometryInstruction2_),
|
||||
'this.beginGeometryInstruction2_ should not be null');
|
||||
this.beginGeometryInstruction2_[2] = this.hitDetectionInstructions.length;
|
||||
this.beginGeometryInstruction2_ = null;
|
||||
var endGeometryInstruction =
|
||||
@@ -766,16 +795,26 @@ ol.render.canvas.ImageReplay.prototype.drawPointGeometry =
|
||||
if (goog.isNull(this.image_)) {
|
||||
return;
|
||||
}
|
||||
goog.asserts.assert(goog.isDef(this.anchorX_));
|
||||
goog.asserts.assert(goog.isDef(this.anchorY_));
|
||||
goog.asserts.assert(goog.isDef(this.height_));
|
||||
goog.asserts.assert(goog.isDef(this.opacity_));
|
||||
goog.asserts.assert(goog.isDef(this.originX_));
|
||||
goog.asserts.assert(goog.isDef(this.originY_));
|
||||
goog.asserts.assert(goog.isDef(this.rotateWithView_));
|
||||
goog.asserts.assert(goog.isDef(this.rotation_));
|
||||
goog.asserts.assert(goog.isDef(this.scale_));
|
||||
goog.asserts.assert(goog.isDef(this.width_));
|
||||
goog.asserts.assert(goog.isDef(this.anchorX_),
|
||||
'this.anchorX_ should be defined');
|
||||
goog.asserts.assert(goog.isDef(this.anchorY_),
|
||||
'this.anchorY_ should be defined');
|
||||
goog.asserts.assert(goog.isDef(this.height_),
|
||||
'this.height_ should be defined');
|
||||
goog.asserts.assert(goog.isDef(this.opacity_),
|
||||
'this.opacity_ should be defined');
|
||||
goog.asserts.assert(goog.isDef(this.originX_),
|
||||
'this.originX_ should be defined');
|
||||
goog.asserts.assert(goog.isDef(this.originY_),
|
||||
'this.originY_ should be defined');
|
||||
goog.asserts.assert(goog.isDef(this.rotateWithView_),
|
||||
'this.rotateWithView_ should be defined');
|
||||
goog.asserts.assert(goog.isDef(this.rotation_),
|
||||
'this.rotation_ should be defined');
|
||||
goog.asserts.assert(goog.isDef(this.scale_),
|
||||
'this.scale_ should be defined');
|
||||
goog.asserts.assert(goog.isDef(this.width_),
|
||||
'this.width_ should be defined');
|
||||
this.beginGeometry(pointGeometry, feature);
|
||||
var flatCoordinates = pointGeometry.getFlatCoordinates();
|
||||
var stride = pointGeometry.getStride();
|
||||
@@ -809,16 +848,26 @@ ol.render.canvas.ImageReplay.prototype.drawMultiPointGeometry =
|
||||
if (goog.isNull(this.image_)) {
|
||||
return;
|
||||
}
|
||||
goog.asserts.assert(goog.isDef(this.anchorX_));
|
||||
goog.asserts.assert(goog.isDef(this.anchorY_));
|
||||
goog.asserts.assert(goog.isDef(this.height_));
|
||||
goog.asserts.assert(goog.isDef(this.opacity_));
|
||||
goog.asserts.assert(goog.isDef(this.originX_));
|
||||
goog.asserts.assert(goog.isDef(this.originY_));
|
||||
goog.asserts.assert(goog.isDef(this.rotateWithView_));
|
||||
goog.asserts.assert(goog.isDef(this.rotation_));
|
||||
goog.asserts.assert(goog.isDef(this.scale_));
|
||||
goog.asserts.assert(goog.isDef(this.width_));
|
||||
goog.asserts.assert(goog.isDef(this.anchorX_),
|
||||
'this.anchorX_ should be defined');
|
||||
goog.asserts.assert(goog.isDef(this.anchorY_),
|
||||
'this.anchorY_ should be defined');
|
||||
goog.asserts.assert(goog.isDef(this.height_),
|
||||
'this.height_ should be defined');
|
||||
goog.asserts.assert(goog.isDef(this.opacity_),
|
||||
'this.opacity_ should be defined');
|
||||
goog.asserts.assert(goog.isDef(this.originX_),
|
||||
'this.originX_ should be defined');
|
||||
goog.asserts.assert(goog.isDef(this.originY_),
|
||||
'this.originY_ should be defined');
|
||||
goog.asserts.assert(goog.isDef(this.rotateWithView_),
|
||||
'this.rotateWithView_ should be defined');
|
||||
goog.asserts.assert(goog.isDef(this.rotation_),
|
||||
'this.rotation_ should be defined');
|
||||
goog.asserts.assert(goog.isDef(this.scale_),
|
||||
'this.scale_ should be defined');
|
||||
goog.asserts.assert(goog.isDef(this.width_),
|
||||
'this.width_ should be defined');
|
||||
this.beginGeometry(multiPointGeometry, feature);
|
||||
var flatCoordinates = multiPointGeometry.getFlatCoordinates();
|
||||
var stride = multiPointGeometry.getStride();
|
||||
@@ -870,17 +919,19 @@ ol.render.canvas.ImageReplay.prototype.finish = function() {
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.canvas.ImageReplay.prototype.setImageStyle = function(imageStyle) {
|
||||
goog.asserts.assert(!goog.isNull(imageStyle));
|
||||
goog.asserts.assert(!goog.isNull(imageStyle),
|
||||
'imageStyle should not be null');
|
||||
var anchor = imageStyle.getAnchor();
|
||||
goog.asserts.assert(!goog.isNull(anchor));
|
||||
goog.asserts.assert(!goog.isNull(anchor), 'anchor should not be null');
|
||||
var size = imageStyle.getSize();
|
||||
goog.asserts.assert(!goog.isNull(size));
|
||||
goog.asserts.assert(!goog.isNull(size), 'size should not be null');
|
||||
var hitDetectionImage = imageStyle.getHitDetectionImage(1);
|
||||
goog.asserts.assert(!goog.isNull(hitDetectionImage));
|
||||
goog.asserts.assert(!goog.isNull(hitDetectionImage),
|
||||
'hitDetectionImage should not be null');
|
||||
var image = imageStyle.getImage(1);
|
||||
goog.asserts.assert(!goog.isNull(image));
|
||||
goog.asserts.assert(!goog.isNull(image), 'image should not be null');
|
||||
var origin = imageStyle.getOrigin();
|
||||
goog.asserts.assert(!goog.isNull(origin));
|
||||
goog.asserts.assert(!goog.isNull(origin), 'origin should not be null');
|
||||
this.anchorX_ = anchor[0];
|
||||
this.anchorY_ = anchor[1];
|
||||
this.hitDetectionImage_ = hitDetectionImage;
|
||||
@@ -994,12 +1045,13 @@ ol.render.canvas.LineStringReplay.prototype.setStrokeStyle_ = function() {
|
||||
var lineJoin = state.lineJoin;
|
||||
var lineWidth = state.lineWidth;
|
||||
var miterLimit = state.miterLimit;
|
||||
goog.asserts.assert(goog.isDef(strokeStyle));
|
||||
goog.asserts.assert(goog.isDef(lineCap));
|
||||
goog.asserts.assert(!goog.isNull(lineDash));
|
||||
goog.asserts.assert(goog.isDef(lineJoin));
|
||||
goog.asserts.assert(goog.isDef(lineWidth));
|
||||
goog.asserts.assert(goog.isDef(miterLimit));
|
||||
goog.asserts.assert(goog.isDef(strokeStyle),
|
||||
'strokeStyle should be defined');
|
||||
goog.asserts.assert(goog.isDef(lineCap), 'lineCap should be defined');
|
||||
goog.asserts.assert(!goog.isNull(lineDash), 'lineDash should not be null');
|
||||
goog.asserts.assert(goog.isDef(lineJoin), 'lineJoin should be defined');
|
||||
goog.asserts.assert(goog.isDef(lineWidth), 'lineWidth should be defined');
|
||||
goog.asserts.assert(goog.isDef(miterLimit), 'miterLimit should be defined');
|
||||
if (state.currentStrokeStyle != strokeStyle ||
|
||||
state.currentLineCap != lineCap ||
|
||||
!goog.array.equals(state.currentLineDash, lineDash) ||
|
||||
@@ -1031,7 +1083,7 @@ ol.render.canvas.LineStringReplay.prototype.setStrokeStyle_ = function() {
|
||||
ol.render.canvas.LineStringReplay.prototype.drawLineStringGeometry =
|
||||
function(lineStringGeometry, feature) {
|
||||
var state = this.state_;
|
||||
goog.asserts.assert(!goog.isNull(state));
|
||||
goog.asserts.assert(!goog.isNull(state), 'state should not be null');
|
||||
var strokeStyle = state.strokeStyle;
|
||||
var lineWidth = state.lineWidth;
|
||||
if (!goog.isDef(strokeStyle) || !goog.isDef(lineWidth)) {
|
||||
@@ -1059,7 +1111,7 @@ ol.render.canvas.LineStringReplay.prototype.drawLineStringGeometry =
|
||||
ol.render.canvas.LineStringReplay.prototype.drawMultiLineStringGeometry =
|
||||
function(multiLineStringGeometry, feature) {
|
||||
var state = this.state_;
|
||||
goog.asserts.assert(!goog.isNull(state));
|
||||
goog.asserts.assert(!goog.isNull(state), 'state should not be null');
|
||||
var strokeStyle = state.strokeStyle;
|
||||
var lineWidth = state.lineWidth;
|
||||
if (!goog.isDef(strokeStyle) || !goog.isDef(lineWidth)) {
|
||||
@@ -1091,7 +1143,7 @@ ol.render.canvas.LineStringReplay.prototype.drawMultiLineStringGeometry =
|
||||
*/
|
||||
ol.render.canvas.LineStringReplay.prototype.finish = function() {
|
||||
var state = this.state_;
|
||||
goog.asserts.assert(!goog.isNull(state));
|
||||
goog.asserts.assert(!goog.isNull(state), 'state should not be null');
|
||||
if (state.lastStroke != this.coordinates.length) {
|
||||
this.instructions.push([ol.render.canvas.Instruction.STROKE]);
|
||||
}
|
||||
@@ -1105,9 +1157,11 @@ ol.render.canvas.LineStringReplay.prototype.finish = function() {
|
||||
*/
|
||||
ol.render.canvas.LineStringReplay.prototype.setFillStrokeStyle =
|
||||
function(fillStyle, strokeStyle) {
|
||||
goog.asserts.assert(!goog.isNull(this.state_));
|
||||
goog.asserts.assert(goog.isNull(fillStyle));
|
||||
goog.asserts.assert(!goog.isNull(strokeStyle));
|
||||
goog.asserts.assert(!goog.isNull(this.state_),
|
||||
'this.state_ should not be null');
|
||||
goog.asserts.assert(goog.isNull(fillStyle), 'fillStyle should be null');
|
||||
goog.asserts.assert(!goog.isNull(strokeStyle),
|
||||
'strokeStyle should not be null');
|
||||
var strokeStyleColor = strokeStyle.getColor();
|
||||
this.state_.strokeStyle = ol.color.asString(!goog.isNull(strokeStyleColor) ?
|
||||
strokeStyleColor : ol.render.canvas.defaultStrokeStyle);
|
||||
@@ -1223,7 +1277,8 @@ ol.render.canvas.PolygonReplay.prototype.drawFlatCoordinatess_ =
|
||||
this.instructions.push(fillInstruction);
|
||||
}
|
||||
if (goog.isDef(state.strokeStyle)) {
|
||||
goog.asserts.assert(goog.isDef(state.lineWidth));
|
||||
goog.asserts.assert(goog.isDef(state.lineWidth),
|
||||
'state.lineWidth should be defined');
|
||||
var strokeInstruction = [ol.render.canvas.Instruction.STROKE];
|
||||
this.instructions.push(strokeInstruction);
|
||||
this.hitDetectionInstructions.push(strokeInstruction);
|
||||
@@ -1238,14 +1293,15 @@ ol.render.canvas.PolygonReplay.prototype.drawFlatCoordinatess_ =
|
||||
ol.render.canvas.PolygonReplay.prototype.drawCircleGeometry =
|
||||
function(circleGeometry, feature) {
|
||||
var state = this.state_;
|
||||
goog.asserts.assert(!goog.isNull(state));
|
||||
goog.asserts.assert(!goog.isNull(state), 'state should not be null');
|
||||
var fillStyle = state.fillStyle;
|
||||
var strokeStyle = state.strokeStyle;
|
||||
if (!goog.isDef(fillStyle) && !goog.isDef(strokeStyle)) {
|
||||
return;
|
||||
}
|
||||
if (goog.isDef(strokeStyle)) {
|
||||
goog.asserts.assert(goog.isDef(state.lineWidth));
|
||||
goog.asserts.assert(goog.isDef(state.lineWidth),
|
||||
'state.lineWidth should be defined');
|
||||
}
|
||||
this.setFillStrokeStyles_();
|
||||
this.beginGeometry(circleGeometry, feature);
|
||||
@@ -1274,7 +1330,8 @@ ol.render.canvas.PolygonReplay.prototype.drawCircleGeometry =
|
||||
this.instructions.push(fillInstruction);
|
||||
}
|
||||
if (goog.isDef(state.strokeStyle)) {
|
||||
goog.asserts.assert(goog.isDef(state.lineWidth));
|
||||
goog.asserts.assert(goog.isDef(state.lineWidth),
|
||||
'state.lineWidth should be defined');
|
||||
var strokeInstruction = [ol.render.canvas.Instruction.STROKE];
|
||||
this.instructions.push(strokeInstruction);
|
||||
this.hitDetectionInstructions.push(strokeInstruction);
|
||||
@@ -1289,14 +1346,15 @@ ol.render.canvas.PolygonReplay.prototype.drawCircleGeometry =
|
||||
ol.render.canvas.PolygonReplay.prototype.drawPolygonGeometry =
|
||||
function(polygonGeometry, feature) {
|
||||
var state = this.state_;
|
||||
goog.asserts.assert(!goog.isNull(state));
|
||||
goog.asserts.assert(!goog.isNull(state), 'state should not be null');
|
||||
var fillStyle = state.fillStyle;
|
||||
var strokeStyle = state.strokeStyle;
|
||||
if (!goog.isDef(fillStyle) && !goog.isDef(strokeStyle)) {
|
||||
return;
|
||||
}
|
||||
if (goog.isDef(strokeStyle)) {
|
||||
goog.asserts.assert(goog.isDef(state.lineWidth));
|
||||
goog.asserts.assert(goog.isDef(state.lineWidth),
|
||||
'state.lineWidth should be defined');
|
||||
}
|
||||
this.setFillStrokeStyles_();
|
||||
this.beginGeometry(polygonGeometry, feature);
|
||||
@@ -1324,14 +1382,15 @@ ol.render.canvas.PolygonReplay.prototype.drawPolygonGeometry =
|
||||
ol.render.canvas.PolygonReplay.prototype.drawMultiPolygonGeometry =
|
||||
function(multiPolygonGeometry, feature) {
|
||||
var state = this.state_;
|
||||
goog.asserts.assert(!goog.isNull(state));
|
||||
goog.asserts.assert(!goog.isNull(state), 'state should not be null');
|
||||
var fillStyle = state.fillStyle;
|
||||
var strokeStyle = state.strokeStyle;
|
||||
if (!goog.isDef(fillStyle) && !goog.isDef(strokeStyle)) {
|
||||
return;
|
||||
}
|
||||
if (goog.isDef(strokeStyle)) {
|
||||
goog.asserts.assert(goog.isDef(state.lineWidth));
|
||||
goog.asserts.assert(goog.isDef(state.lineWidth),
|
||||
'state.lineWidth should be defined');
|
||||
}
|
||||
this.setFillStrokeStyles_();
|
||||
this.beginGeometry(multiPolygonGeometry, feature);
|
||||
@@ -1362,7 +1421,8 @@ ol.render.canvas.PolygonReplay.prototype.drawMultiPolygonGeometry =
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.canvas.PolygonReplay.prototype.finish = function() {
|
||||
goog.asserts.assert(!goog.isNull(this.state_));
|
||||
goog.asserts.assert(!goog.isNull(this.state_),
|
||||
'this.state_ should not be null');
|
||||
this.reverseHitDetectionInstructions_();
|
||||
this.state_ = null;
|
||||
// We want to preserve topology when drawing polygons. Polygons are
|
||||
@@ -1400,8 +1460,10 @@ ol.render.canvas.PolygonReplay.prototype.getBufferedMaxExtent = function() {
|
||||
*/
|
||||
ol.render.canvas.PolygonReplay.prototype.setFillStrokeStyle =
|
||||
function(fillStyle, strokeStyle) {
|
||||
goog.asserts.assert(!goog.isNull(this.state_));
|
||||
goog.asserts.assert(!goog.isNull(fillStyle) || !goog.isNull(strokeStyle));
|
||||
goog.asserts.assert(!goog.isNull(this.state_),
|
||||
'this.state_ should not be null');
|
||||
goog.asserts.assert(!goog.isNull(fillStyle) || !goog.isNull(strokeStyle),
|
||||
'fillStyle or strokeStyle should not be null');
|
||||
var state = this.state_;
|
||||
if (!goog.isNull(fillStyle)) {
|
||||
var fillStyleColor = fillStyle.getColor();
|
||||
@@ -1464,11 +1526,11 @@ ol.render.canvas.PolygonReplay.prototype.setFillStrokeStyles_ = function() {
|
||||
state.currentFillStyle = state.fillStyle;
|
||||
}
|
||||
if (goog.isDef(strokeStyle)) {
|
||||
goog.asserts.assert(goog.isDef(lineCap));
|
||||
goog.asserts.assert(!goog.isNull(lineDash));
|
||||
goog.asserts.assert(goog.isDef(lineJoin));
|
||||
goog.asserts.assert(goog.isDef(lineWidth));
|
||||
goog.asserts.assert(goog.isDef(miterLimit));
|
||||
goog.asserts.assert(goog.isDef(lineCap), 'lineCap should be defined');
|
||||
goog.asserts.assert(!goog.isNull(lineDash), 'lineDash should not be null');
|
||||
goog.asserts.assert(goog.isDef(lineJoin), 'lineJoin should be defined');
|
||||
goog.asserts.assert(goog.isDef(lineWidth), 'lineWidth should be defined');
|
||||
goog.asserts.assert(goog.isDef(miterLimit), 'miterLimit should be defined');
|
||||
if (state.currentStrokeStyle != strokeStyle ||
|
||||
state.currentLineCap != lineCap ||
|
||||
state.currentLineDash != lineDash ||
|
||||
@@ -1942,7 +2004,8 @@ ol.render.canvas.ReplayGroup.prototype.getReplay =
|
||||
var replay = replays[replayType];
|
||||
if (!goog.isDef(replay)) {
|
||||
var Constructor = ol.render.canvas.BATCH_CONSTRUCTORS_[replayType];
|
||||
goog.asserts.assert(goog.isDef(Constructor));
|
||||
goog.asserts.assert(goog.isDef(Constructor),
|
||||
'Constructor should be defined');
|
||||
replay = new Constructor(this.tolerance_, this.maxExtent_,
|
||||
this.resolution_);
|
||||
replays[replayType] = replay;
|
||||
|
||||
Reference in New Issue
Block a user