Activate rotateWithMap option in ol.render.canvas.Replay

This commit is contained in:
Tom Payne
2014-02-21 11:57:11 +01:00
parent fe420ce1eb
commit 222fafcb77
+30 -12
View File
@@ -231,10 +231,14 @@ ol.render.canvas.Replay.prototype.replay_ = function(
var anchorY = /** @type {number} */ (instruction[5]) * pixelRatio; var anchorY = /** @type {number} */ (instruction[5]) * pixelRatio;
var height = /** @type {number} */ (instruction[6]) * pixelRatio; var height = /** @type {number} */ (instruction[6]) * pixelRatio;
var opacity = /** @type {number} */ (instruction[7]); var opacity = /** @type {number} */ (instruction[7]);
var rotation = /** @type {number} */ (instruction[8]); var rotateWithMap = /** @type {boolean} */ (instruction[8]);
var scale = /** @type {number} */ (instruction[9]); var rotation = /** @type {number} */ (instruction[9]);
var snapToPixel = /** @type {boolean|undefined} */ (instruction[10]); var scale = /** @type {number} */ (instruction[10]);
var width = /** @type {number} */ (instruction[11]) * pixelRatio; var snapToPixel = /** @type {boolean|undefined} */ (instruction[11]);
var width = /** @type {number} */ (instruction[12]) * pixelRatio;
if (rotateWithMap) {
rotation += viewRotation;
}
for (; d < dd; d += 2) { for (; d < dd; d += 2) {
x = pixelCoordinates[d] - anchorX; x = pixelCoordinates[d] - anchorX;
y = pixelCoordinates[d + 1] - anchorY; y = pixelCoordinates[d + 1] - anchorY;
@@ -621,6 +625,12 @@ ol.render.canvas.ImageReplay = function(tolerance) {
*/ */
this.opacity_ = undefined; this.opacity_ = undefined;
/**
* @private
* @type {boolean|undefined}
*/
this.rotateWithMap_ = undefined;
/** /**
* @private * @private
* @type {number|undefined} * @type {number|undefined}
@@ -676,6 +686,7 @@ ol.render.canvas.ImageReplay.prototype.drawPointGeometry =
goog.asserts.assert(goog.isDef(this.anchorY_)); goog.asserts.assert(goog.isDef(this.anchorY_));
goog.asserts.assert(goog.isDef(this.height_)); goog.asserts.assert(goog.isDef(this.height_));
goog.asserts.assert(goog.isDef(this.opacity_)); goog.asserts.assert(goog.isDef(this.opacity_));
goog.asserts.assert(goog.isDef(this.rotateWithMap_));
goog.asserts.assert(goog.isDef(this.rotation_)); goog.asserts.assert(goog.isDef(this.rotation_));
goog.asserts.assert(goog.isDef(this.scale_)); goog.asserts.assert(goog.isDef(this.scale_));
goog.asserts.assert(goog.isDef(this.width_)); goog.asserts.assert(goog.isDef(this.width_));
@@ -689,15 +700,17 @@ ol.render.canvas.ImageReplay.prototype.drawPointGeometry =
this.instructions.push([ this.instructions.push([
ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd, this.image_, ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd, this.image_,
// Remaining arguments to DRAW_IMAGE are in alphabetical order // Remaining arguments to DRAW_IMAGE are in alphabetical order
this.anchorX_, this.anchorY_, this.height_, this.opacity_, this.rotation_, this.anchorX_, this.anchorY_, this.height_, this.opacity_,
this.scale_, this.snapToPixel_, this.width_ this.rotateWithMap_, this.rotation_, this.scale_, this.snapToPixel_,
this.width_
]); ]);
this.hitDetectionInstructions.push([ this.hitDetectionInstructions.push([
ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd, ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd,
this.hitDetectionImage_, this.hitDetectionImage_,
// Remaining arguments to DRAW_IMAGE are in alphabetical order // Remaining arguments to DRAW_IMAGE are in alphabetical order
this.anchorX_, this.anchorY_, this.height_, this.opacity_, this.rotation_, this.anchorX_, this.anchorY_, this.height_, this.opacity_,
this.scale_, this.snapToPixel_, this.width_ this.rotateWithMap_, this.rotation_, this.scale_, this.snapToPixel_,
this.width_
]); ]);
this.endGeometry(pointGeometry, data); this.endGeometry(pointGeometry, data);
}; };
@@ -715,6 +728,7 @@ ol.render.canvas.ImageReplay.prototype.drawMultiPointGeometry =
goog.asserts.assert(goog.isDef(this.anchorY_)); goog.asserts.assert(goog.isDef(this.anchorY_));
goog.asserts.assert(goog.isDef(this.height_)); goog.asserts.assert(goog.isDef(this.height_));
goog.asserts.assert(goog.isDef(this.opacity_)); goog.asserts.assert(goog.isDef(this.opacity_));
goog.asserts.assert(goog.isDef(this.rotateWithMap_));
goog.asserts.assert(goog.isDef(this.rotation_)); goog.asserts.assert(goog.isDef(this.rotation_));
goog.asserts.assert(goog.isDef(this.scale_)); goog.asserts.assert(goog.isDef(this.scale_));
goog.asserts.assert(goog.isDef(this.width_)); goog.asserts.assert(goog.isDef(this.width_));
@@ -728,15 +742,17 @@ ol.render.canvas.ImageReplay.prototype.drawMultiPointGeometry =
this.instructions.push([ this.instructions.push([
ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd, this.image_, ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd, this.image_,
// Remaining arguments to DRAW_IMAGE are in alphabetical order // Remaining arguments to DRAW_IMAGE are in alphabetical order
this.anchorX_, this.anchorY_, this.height_, this.opacity_, this.rotation_, this.anchorX_, this.anchorY_, this.height_, this.opacity_,
this.scale_, this.snapToPixel_, this.width_ this.rotateWithMap_, this.rotation_, this.scale_, this.snapToPixel_,
this.width_
]); ]);
this.hitDetectionInstructions.push([ this.hitDetectionInstructions.push([
ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd, ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd,
this.hitDetectionImage_, this.hitDetectionImage_,
// Remaining arguments to DRAW_IMAGE are in alphabetical order // Remaining arguments to DRAW_IMAGE are in alphabetical order
this.anchorX_, this.anchorY_, this.height_, this.opacity_, this.rotation_, this.anchorX_, this.anchorY_, this.height_, this.opacity_,
this.scale_, this.snapToPixel_, this.width_ this.rotateWithMap_, this.rotation_, this.scale_, this.snapToPixel_,
this.width_
]); ]);
this.endGeometry(multiPointGeometry, data); this.endGeometry(multiPointGeometry, data);
}; };
@@ -755,6 +771,7 @@ ol.render.canvas.ImageReplay.prototype.finish = function() {
this.height_ = undefined; this.height_ = undefined;
this.scale_ = undefined; this.scale_ = undefined;
this.opacity_ = undefined; this.opacity_ = undefined;
this.rotateWithMap_ = undefined;
this.rotation_ = undefined; this.rotation_ = undefined;
this.snapToPixel_ = undefined; this.snapToPixel_ = undefined;
this.width_ = undefined; this.width_ = undefined;
@@ -780,6 +797,7 @@ ol.render.canvas.ImageReplay.prototype.setImageStyle = function(imageStyle) {
this.image_ = image; this.image_ = image;
this.height_ = size[1]; this.height_ = size[1];
this.opacity_ = imageStyle.getOpacity(); this.opacity_ = imageStyle.getOpacity();
this.rotateWithMap_ = imageStyle.getRotateWithMap();
this.rotation_ = imageStyle.getRotation(); this.rotation_ = imageStyle.getRotation();
this.scale_ = imageStyle.getScale(); this.scale_ = imageStyle.getScale();
this.snapToPixel_ = imageStyle.getSnapToPixel(); this.snapToPixel_ = imageStyle.getSnapToPixel();