From 3b4be791dce3e65573e25dd11d2a72f1f89953ed Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 23 Feb 2015 14:53:28 +0100 Subject: [PATCH 1/2] Use pitch instead of deprecated tilt --- Cesium.externs.js | 7 +++++++ src/camera.js | 10 ++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Cesium.externs.js b/Cesium.externs.js index 77af5519d..042aa8a13 100644 --- a/Cesium.externs.js +++ b/Cesium.externs.js @@ -306,6 +306,13 @@ Cesium.Camera.prototype.heading; Cesium.Camera.prototype.tilt; +/** + * @type {number} + * @const + */ +Cesium.Camera.prototype.pitch; + + /** * @param {!Cesium.Cartesian2} windowPosition * @param {Cesium.Ray=} opt_result diff --git a/src/camera.js b/src/camera.js index 6d188db94..4851be687 100644 --- a/src/camera.js +++ b/src/camera.js @@ -324,15 +324,13 @@ olcs.Camera.prototype.updateCamera_ = function() { var height = this.scene_.globe.getHeight(carto); carto.height = goog.isDef(height) ? height : 0; } + this.cam_.setView({ positionCartographic: carto, - pitch: -Cesium.Math.PI_OVER_TWO, - heading: this.view_.getRotation() + pitch: this.tilt_ - Cesium.Math.PI_OVER_TWO, + heading: -this.view_.getRotation() }); - if (this.tilt_) { - this.cam_.lookUp(this.tilt_); - } this.cam_.moveBackward(this.distance_); this.checkCameraChange(true); @@ -432,7 +430,7 @@ olcs.Camera.prototype.updateView = function() { } else { // fallback when there is no target this.view_.setRotation(this.cam_.heading); - this.tilt_ = -this.cam_.tilt + Math.PI / 2; + this.tilt_ = -this.cam_.pitch + Math.PI / 2; } this.viewUpdateInProgress_ = false; From 995a175787939026209efb81fbec2543f696f654 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 23 Feb 2015 15:04:18 +0100 Subject: [PATCH 2/2] Prevent use of APIs removed by Cesium --- Cesium.externs.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Cesium.externs.js b/Cesium.externs.js index 042aa8a13..33d5c2023 100644 --- a/Cesium.externs.js +++ b/Cesium.externs.js @@ -4,6 +4,13 @@ */ var Cesium = {}; +/** + * Prevent using a removed API. + * @constructor + */ +Cesium.RemovedAPI = function() {}; + + /** * @constructor * @param {number=} opt_r . @@ -301,7 +308,7 @@ Cesium.Camera.prototype.heading; /** - * @type {number} + * @type {!Cesium.RemovedAPI} */ Cesium.Camera.prototype.tilt; @@ -482,6 +489,13 @@ Cesium.CameraEventAggregator.prototype.isDestroyed = function() {}; */ Cesium.CameraEventAggregator.prototype.destroy = function() {}; + +/** + * @type{!Cesium.RemovedAPI} + */ +Cesium.Camera.prototype.setPositionCartographic; + + /** * @typedef {{ * position: (Cesium.Cartesian3|undefined),