Skip to content

Commit

Permalink
Update to Cesium 1.14 (closes #44)
Browse files Browse the repository at this point in the history
  • Loading branch information
petrsloup committed Oct 22, 2015
1 parent b96f3f3 commit fab3004
Show file tree
Hide file tree
Showing 14 changed files with 113 additions and 168 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
/deploy/api.js
/deploy/index.js
/deploy/api_nocesium.js
/deploy/index_nocesium.js
/plovr-*.*
61 changes: 36 additions & 25 deletions Cesium.externs.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ Cesium.Billboard.prototype.show;


/**
* @type {number}
* @type {boolean}
*/
Cesium.Billboard.prototype.scale;
Cesium.Billboard.prototype.sizeInMeters;


/**
* @type {number}
*/
Cesium.Billboard.prototype.imageIndex;
Cesium.Billboard.prototype.scale;


/**
Expand Down Expand Up @@ -96,12 +96,6 @@ Cesium.BillboardCollection.prototype.add = function(opt_opts) {};
Cesium.BillboardCollection.prototype.remove = function(what) {};


/**
* @type {boolean} .
*/
Cesium.BillboardCollection.prototype.sizeReal;


/**
* @type {Cesium.TextureAtlas}
*/
Expand Down Expand Up @@ -335,17 +329,16 @@ Cesium.CameraEventAggregator.prototype.destroy = function() {};


/**
* @param {Cesium.Cartographic} carto
* @param {Object} props
*/
Cesium.Camera.prototype.setPositionCartographic = function(carto) {};
Cesium.Camera.prototype.setView = function(props) {};


/**
* @param {Cesium.Cartesian3} eye .
* @param {Cesium.Cartesian3} target .
* @param {Cesium.Cartesian3} up .
* @param {Cesium.Cartesian3} target
* @param {Cesium.Cartesian3} offset
*/
Cesium.Camera.prototype.lookAt = function(eye, target, up) {};
Cesium.Camera.prototype.lookAt = function(target, offset) {};


/**
Expand Down Expand Up @@ -457,6 +450,18 @@ Cesium.Cartesian3.prototype.y;
Cesium.Cartesian3.prototype.z;


/**
* @param {number} longitude
* @param {number} latitude
* @param {number=} opt_height
* @param {Cesium.Ellipsoid=} opt_ellipsoid
* @param {Cesium.Cartesian3=} opt_result
* @return {Cesium.Cartesian3}
*/
Cesium.Cartesian3.fromRadians = function(longitude, latitude, opt_height,
opt_ellipsoid, opt_result) {};


/**
* @param {Cesium.Cartesian3} left
* @return {number}
Expand Down Expand Up @@ -799,15 +804,15 @@ Cesium.ImageryLayerCollection.prototype.length;


/**
* @param {number} index
* @param {number} index
* @return {Cesium.ImageryLayer} layer
*/
Cesium.ImageryLayerCollection.prototype.get = function(index) {};


/**
* @param {Cesium.ImageryLayer} layer
* @param {number=} opt_index
* @param {number=} opt_index
*/
Cesium.ImageryLayerCollection.prototype.add = function(layer, opt_index) {};

Expand Down Expand Up @@ -901,7 +906,7 @@ Cesium.ImageryProvider.prototype.credit;
* @param {number} x The tile X coordinate.
* @param {number} y The tile Y coordinate.
* @param {number} level The tile level.
* @return {Object|undefined}
* @return {Object|undefined}
*/
Cesium.ImageryProvider.prototype.requestImage = function(x, y, level) {};

Expand Down Expand Up @@ -1090,10 +1095,10 @@ Cesium.Matrix4.fromTranslation = function(translation, opt_result) {};
/**
* @param {Cesium.Matrix4} left .
* @param {Cesium.Matrix4} right .
* @param {Cesium.Matrix4=} opt_result .
* @param {Cesium.Matrix4} result .
* @return {Cesium.Matrix4} .
*/
Cesium.Matrix4.multiply = function(left, right, opt_result) {};
Cesium.Matrix4.multiply = function(left, right, result) {};


/**
Expand All @@ -1112,19 +1117,19 @@ Cesium.Matrix4.prototype.clone = function(matrix) {};
/**
* @param {Cesium.Matrix4} matrix .
* @param {Cesium.Cartesian3} point .
* @param {Cesium.Cartesian3=} opt_result .
* @param {Cesium.Cartesian3} result .
* @return {Cesium.Cartesian3} .
*/
Cesium.Matrix4.multiplyByPoint = function(matrix, point, opt_result) {};
Cesium.Matrix4.multiplyByPoint = function(matrix, point, result) {};


/**
* @param {Cesium.Matrix4} matrix .
* @param {Cesium.Cartesian4} point .
* @param {Cesium.Cartesian4=} opt_result .
* @param {Cesium.Cartesian4} result .
* @return {Cesium.Cartesian4} .
*/
Cesium.Matrix4.multiplyByVector = function(matrix, point, opt_result) {};
Cesium.Matrix4.multiplyByVector = function(matrix, point, result) {};


/**
Expand Down Expand Up @@ -1182,6 +1187,12 @@ Cesium.PerspectiveFrustrum.prototype.aspectRatio;
Cesium.PerspectiveFrustrum.prototype.far;


/**
* @type {number}
*/
Cesium.PerspectiveFrustrum.prototype.fov;


/**
* @type {number}
*/
Expand Down Expand Up @@ -1595,4 +1606,4 @@ Cesium.BingMapsStyle.AERIAL;
Cesium.BingMapsStyle.AERIAL_WITH_LABELS;

/** @type {!Cesium.BingMapsStyle} */
Cesium.BingMapsStyle.ROAD;
Cesium.BingMapsStyle.ROAD;
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
PLOVR_VERSION=2.0.0
PLOVR=plovr-$(PLOVR_VERSION).jar

WEBGLEARTH_VERSION = $(firstword $(subst -, ,$(subst v,,$(shell git describe --tags))))

.PHONY: plovr cesium lint webserver

all: build
Expand All @@ -13,7 +15,13 @@ serve:
java -jar $(PLOVR) serve -p 9810 *.json
build:
java -jar $(PLOVR) build api.json > deploy/api_nocesium.js
sed -e 's#{WEBGLEARTH_VERSION}#$(WEBGLEARTH_VERSION)#' deploy/header.js > deploy/api.js
cat cesium/Build/Cesium/Cesium.js >> deploy/api.js
cat deploy/api_nocesium.js >> deploy/api.js
java -jar $(PLOVR) build app.json > deploy/index_nocesium.js
sed -e 's#{WEBGLEARTH_VERSION}#$(WEBGLEARTH_VERSION)#' deploy/header.js > deploy/index.js
cat cesium/Build/Cesium/Cesium.js >> deploy/index.js
cat deploy/index_nocesium.js >> deploy/index.js
lint:
fixjsstyle --strict -r ./src
fixjsstyle --strict -r ./src-app
Expand All @@ -22,9 +30,4 @@ lint:
webserver:
java -jar $(PLOVR) soyweb -p 9820 --dir .
cesium:
git submodule init
git submodule update
cd cesium && "./Tools/apache-ant-1.8.2/bin/ant" minify
library:
git submodule init
git submodule update
2 changes: 1 addition & 1 deletion api-debug.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"goog.DEBUG": true
},

"mode": "SIMPLE",
"mode": "ADVANCED",

"pretty-print": true,
"debug": true
Expand Down
2 changes: 1 addition & 1 deletion cesium
Submodule cesium updated 2129 files
10 changes: 10 additions & 0 deletions deploy/header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* WebGL Earth {WEBGLEARTH_VERSION}
* ===============
* Copyright (C) 2014 - Klokan Technologies GmbH
* http://www.webglearth.org/
* Powered by Cesium (http://www.webglearth.org/cesium). Apache 2.0 license.
*/

//------------------------------------------------------------------------------
CESIUM_BASE_URL = ('https:' == document.location.protocol ? 'https:' : 'http:') + '//www.webglearth.com/v2/';
2 changes: 1 addition & 1 deletion src-app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ weapp.App.BING_KEY =
/**
* @define {number} default altitude in meters.
*/
weapp.App.DEFAULT_ALT = 7000000;
weapp.App.DEFAULT_ALT = 17000000;


/**
Expand Down
19 changes: 8 additions & 11 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ goog.provide('weapi.App');
goog.require('goog.dom');

goog.require('weapi.Camera');
goog.require('weapi.NoRepeatTextureAtlas');
goog.require('weapi.maps');
goog.require('weapi.markers.MarkerManager');
goog.require('weapi.markers.PrettyMarker');
Expand Down Expand Up @@ -188,17 +187,10 @@ weapi.App = function(divid, opt_options) {
*/
this.composites = [];

/**
* @type {!weapi.NoRepeatTextureAtlas}
*/
this.polyIconAtlas = new weapi.NoRepeatTextureAtlas(this);

/**
* @type {!Cesium.BillboardCollection}
*/
this.polyIconCollection = new Cesium.BillboardCollection();
this.polyIconCollection.textureAtlas = this.polyIconAtlas.atlas;
this.polyIconCollection.sizeReal = true;
primitives.add(this.polyIconCollection);

var tick = goog.bind(function() {
Expand Down Expand Up @@ -308,12 +300,17 @@ weapi.App = function(divid, opt_options) {

// + HACK for sceneChange detection after loading tiles:
var that = this;
var orig2 = Cesium['Tile'].prototype['processStateMachine'];
Cesium['Tile'].prototype['processStateMachine'] = function(c, tp, ic) {
var orig2 = Cesium['GlobeSurfaceTile']['processStateMachine'];
Cesium['GlobeSurfaceTile']['processStateMachine'] =
function(t, c, cl, tp, ic) {
/*if (this['isRenderable']) */that.sceneChanged = true;

orig2.call(this, c, tp, ic);
orig2(t, c, cl, tp, ic);
};

setTimeout(function() {
that.sceneChanged = true;
}, 1);
};


Expand Down
20 changes: 14 additions & 6 deletions src/camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ weapi.Camera.prototype.setPos = function(latitude, longitude, altitude) {
longitude = goog.isDefAndNotNull(longitude) ? longitude : oldPos[1];
altitude = altitude > 0 ? altitude : oldPos[2];
}
var carto = new Cesium.Cartographic(longitude, latitude, altitude);

this.camera.setPositionCartographic(carto);
var pos = Cesium.Cartesian3.fromRadians(longitude, latitude, altitude);
this.camera.setView({
'position': pos,
'heading': 0,
'pitch': -Math.PI / 2,
'roll': 0
});
};


Expand Down Expand Up @@ -139,9 +143,13 @@ weapi.Camera.prototype.setHeadingAndTilt = function(heading, tilt) {
*/
weapi.Camera.prototype.setPosHeadingAndTilt = function(lat, lng, alt,
heading, tilt) {
var carto = new Cesium.Cartographic(lng, lat, alt);

this.camera.setPositionCartographic(carto);
var pos = Cesium.Cartesian3.fromRadians(lng, lat, alt);
this.camera.setView({
'position': pos,
'heading': 0,
'pitch': -Math.PI / 2,
'roll': 0
});
this.camera.twistLeft(heading);
this.camera.lookUp(tilt);
};
Expand Down
12 changes: 4 additions & 8 deletions src/editablepolygon.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,11 @@ weapi.EditablePolygon.prototype.setStrokeColor = function(hexColor, opt_a) {

/**
* @param {string} src URL of the image to use.
* @param {number} height Desired height of the image in pixels
* when observed from the reference distance.
* @param {number=} opt_minHeight Minimal height of the image in pixels (TODO).
* @param {?number=} opt_maxHeight Maximal height of the image in pixels (TODO).
* @param {number} width Desired width of the image in meters.
* @param {number} height Desired height of the image in meters.
*/
weapi.EditablePolygon.prototype.setIcon = function(src, height,
opt_minHeight,
opt_maxHeight) {
this.icon_.setImage(src, height, opt_minHeight, opt_maxHeight);
weapi.EditablePolygon.prototype.setIcon = function(src, width, height) {
this.icon_.setImage(src, width, height);
this.repositionIcon_();
this.app.sceneChanged = true;
};
Expand Down
2 changes: 1 addition & 1 deletion src/miniglobe.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ weapi.MiniGlobe.prototype.draw = function() {
var frustum = this.app_.camera.camera.frustum;

var mvm = Cesium.Matrix4.fromTranslation(new Cesium.Cartesian3(
0, 0, -1.2 / Math.tan(frustum.fovy / 2)));
0, 0, -1.3 / Math.tan(frustum.fovy / 2)));
rotate100(mvm, pos[0]);
rotate010(mvm, -pos[1]);

Expand Down
50 changes: 0 additions & 50 deletions src/norepeattextureatlas.js

This file was deleted.

Loading

0 comments on commit fab3004

Please sign in to comment.