Skip to content

Commit fab3004

Browse files
committed
Update to Cesium 1.14 (closes #44)
1 parent b96f3f3 commit fab3004

14 files changed

Lines changed: 113 additions & 168 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
/deploy/api.js
2+
/deploy/index.js
3+
/deploy/api_nocesium.js
4+
/deploy/index_nocesium.js
25
/plovr-*.*

Cesium.externs.js

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ Cesium.Billboard.prototype.show;
3535

3636

3737
/**
38-
* @type {number}
38+
* @type {boolean}
3939
*/
40-
Cesium.Billboard.prototype.scale;
40+
Cesium.Billboard.prototype.sizeInMeters;
4141

4242

4343
/**
4444
* @type {number}
4545
*/
46-
Cesium.Billboard.prototype.imageIndex;
46+
Cesium.Billboard.prototype.scale;
4747

4848

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

9898

99-
/**
100-
* @type {boolean} .
101-
*/
102-
Cesium.BillboardCollection.prototype.sizeReal;
103-
104-
10599
/**
106100
* @type {Cesium.TextureAtlas}
107101
*/
@@ -335,17 +329,16 @@ Cesium.CameraEventAggregator.prototype.destroy = function() {};
335329

336330

337331
/**
338-
* @param {Cesium.Cartographic} carto
332+
* @param {Object} props
339333
*/
340-
Cesium.Camera.prototype.setPositionCartographic = function(carto) {};
334+
Cesium.Camera.prototype.setView = function(props) {};
341335

342336

343337
/**
344-
* @param {Cesium.Cartesian3} eye .
345-
* @param {Cesium.Cartesian3} target .
346-
* @param {Cesium.Cartesian3} up .
338+
* @param {Cesium.Cartesian3} target
339+
* @param {Cesium.Cartesian3} offset
347340
*/
348-
Cesium.Camera.prototype.lookAt = function(eye, target, up) {};
341+
Cesium.Camera.prototype.lookAt = function(target, offset) {};
349342

350343

351344
/**
@@ -457,6 +450,18 @@ Cesium.Cartesian3.prototype.y;
457450
Cesium.Cartesian3.prototype.z;
458451

459452

453+
/**
454+
* @param {number} longitude
455+
* @param {number} latitude
456+
* @param {number=} opt_height
457+
* @param {Cesium.Ellipsoid=} opt_ellipsoid
458+
* @param {Cesium.Cartesian3=} opt_result
459+
* @return {Cesium.Cartesian3}
460+
*/
461+
Cesium.Cartesian3.fromRadians = function(longitude, latitude, opt_height,
462+
opt_ellipsoid, opt_result) {};
463+
464+
460465
/**
461466
* @param {Cesium.Cartesian3} left
462467
* @return {number}
@@ -799,15 +804,15 @@ Cesium.ImageryLayerCollection.prototype.length;
799804

800805

801806
/**
802-
* @param {number} index
807+
* @param {number} index
803808
* @return {Cesium.ImageryLayer} layer
804809
*/
805810
Cesium.ImageryLayerCollection.prototype.get = function(index) {};
806811

807812

808813
/**
809814
* @param {Cesium.ImageryLayer} layer
810-
* @param {number=} opt_index
815+
* @param {number=} opt_index
811816
*/
812817
Cesium.ImageryLayerCollection.prototype.add = function(layer, opt_index) {};
813818

@@ -901,7 +906,7 @@ Cesium.ImageryProvider.prototype.credit;
901906
* @param {number} x The tile X coordinate.
902907
* @param {number} y The tile Y coordinate.
903908
* @param {number} level The tile level.
904-
* @return {Object|undefined}
909+
* @return {Object|undefined}
905910
*/
906911
Cesium.ImageryProvider.prototype.requestImage = function(x, y, level) {};
907912

@@ -1090,10 +1095,10 @@ Cesium.Matrix4.fromTranslation = function(translation, opt_result) {};
10901095
/**
10911096
* @param {Cesium.Matrix4} left .
10921097
* @param {Cesium.Matrix4} right .
1093-
* @param {Cesium.Matrix4=} opt_result .
1098+
* @param {Cesium.Matrix4} result .
10941099
* @return {Cesium.Matrix4} .
10951100
*/
1096-
Cesium.Matrix4.multiply = function(left, right, opt_result) {};
1101+
Cesium.Matrix4.multiply = function(left, right, result) {};
10971102

10981103

10991104
/**
@@ -1112,19 +1117,19 @@ Cesium.Matrix4.prototype.clone = function(matrix) {};
11121117
/**
11131118
* @param {Cesium.Matrix4} matrix .
11141119
* @param {Cesium.Cartesian3} point .
1115-
* @param {Cesium.Cartesian3=} opt_result .
1120+
* @param {Cesium.Cartesian3} result .
11161121
* @return {Cesium.Cartesian3} .
11171122
*/
1118-
Cesium.Matrix4.multiplyByPoint = function(matrix, point, opt_result) {};
1123+
Cesium.Matrix4.multiplyByPoint = function(matrix, point, result) {};
11191124

11201125

11211126
/**
11221127
* @param {Cesium.Matrix4} matrix .
11231128
* @param {Cesium.Cartesian4} point .
1124-
* @param {Cesium.Cartesian4=} opt_result .
1129+
* @param {Cesium.Cartesian4} result .
11251130
* @return {Cesium.Cartesian4} .
11261131
*/
1127-
Cesium.Matrix4.multiplyByVector = function(matrix, point, opt_result) {};
1132+
Cesium.Matrix4.multiplyByVector = function(matrix, point, result) {};
11281133

11291134

11301135
/**
@@ -1182,6 +1187,12 @@ Cesium.PerspectiveFrustrum.prototype.aspectRatio;
11821187
Cesium.PerspectiveFrustrum.prototype.far;
11831188

11841189

1190+
/**
1191+
* @type {number}
1192+
*/
1193+
Cesium.PerspectiveFrustrum.prototype.fov;
1194+
1195+
11851196
/**
11861197
* @type {number}
11871198
*/
@@ -1595,4 +1606,4 @@ Cesium.BingMapsStyle.AERIAL;
15951606
Cesium.BingMapsStyle.AERIAL_WITH_LABELS;
15961607

15971608
/** @type {!Cesium.BingMapsStyle} */
1598-
Cesium.BingMapsStyle.ROAD;
1609+
Cesium.BingMapsStyle.ROAD;

Makefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
PLOVR_VERSION=2.0.0
22
PLOVR=plovr-$(PLOVR_VERSION).jar
33

4+
WEBGLEARTH_VERSION = $(firstword $(subst -, ,$(subst v,,$(shell git describe --tags))))
5+
46
.PHONY: plovr cesium lint webserver
57

68
all: build
@@ -13,7 +15,13 @@ serve:
1315
java -jar $(PLOVR) serve -p 9810 *.json
1416
build:
1517
java -jar $(PLOVR) build api.json > deploy/api_nocesium.js
18+
sed -e 's#{WEBGLEARTH_VERSION}#$(WEBGLEARTH_VERSION)#' deploy/header.js > deploy/api.js
19+
cat cesium/Build/Cesium/Cesium.js >> deploy/api.js
20+
cat deploy/api_nocesium.js >> deploy/api.js
1621
java -jar $(PLOVR) build app.json > deploy/index_nocesium.js
22+
sed -e 's#{WEBGLEARTH_VERSION}#$(WEBGLEARTH_VERSION)#' deploy/header.js > deploy/index.js
23+
cat cesium/Build/Cesium/Cesium.js >> deploy/index.js
24+
cat deploy/index_nocesium.js >> deploy/index.js
1725
lint:
1826
fixjsstyle --strict -r ./src
1927
fixjsstyle --strict -r ./src-app
@@ -22,9 +30,4 @@ lint:
2230
webserver:
2331
java -jar $(PLOVR) soyweb -p 9820 --dir .
2432
cesium:
25-
git submodule init
26-
git submodule update
2733
cd cesium && "./Tools/apache-ant-1.8.2/bin/ant" minify
28-
library:
29-
git submodule init
30-
git submodule update

api-debug.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"goog.DEBUG": true
77
},
88

9-
"mode": "SIMPLE",
9+
"mode": "ADVANCED",
1010

1111
"pretty-print": true,
1212
"debug": true

cesium

Submodule cesium updated 2129 files

deploy/header.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* WebGL Earth {WEBGLEARTH_VERSION}
3+
* ===============
4+
* Copyright (C) 2014 - Klokan Technologies GmbH
5+
* http://www.webglearth.org/
6+
* Powered by Cesium (http://www.webglearth.org/cesium). Apache 2.0 license.
7+
*/
8+
9+
//------------------------------------------------------------------------------
10+
CESIUM_BASE_URL = ('https:' == document.location.protocol ? 'https:' : 'http:') + '//www.webglearth.com/v2/';

src-app/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ weapp.App.BING_KEY =
223223
/**
224224
* @define {number} default altitude in meters.
225225
*/
226-
weapp.App.DEFAULT_ALT = 7000000;
226+
weapp.App.DEFAULT_ALT = 17000000;
227227

228228

229229
/**

src/app.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ goog.provide('weapi.App');
1010
goog.require('goog.dom');
1111

1212
goog.require('weapi.Camera');
13-
goog.require('weapi.NoRepeatTextureAtlas');
1413
goog.require('weapi.maps');
1514
goog.require('weapi.markers.MarkerManager');
1615
goog.require('weapi.markers.PrettyMarker');
@@ -188,17 +187,10 @@ weapi.App = function(divid, opt_options) {
188187
*/
189188
this.composites = [];
190189

191-
/**
192-
* @type {!weapi.NoRepeatTextureAtlas}
193-
*/
194-
this.polyIconAtlas = new weapi.NoRepeatTextureAtlas(this);
195-
196190
/**
197191
* @type {!Cesium.BillboardCollection}
198192
*/
199193
this.polyIconCollection = new Cesium.BillboardCollection();
200-
this.polyIconCollection.textureAtlas = this.polyIconAtlas.atlas;
201-
this.polyIconCollection.sizeReal = true;
202194
primitives.add(this.polyIconCollection);
203195

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

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

315-
orig2.call(this, c, tp, ic);
308+
orig2(t, c, cl, tp, ic);
316309
};
310+
311+
setTimeout(function() {
312+
that.sceneChanged = true;
313+
}, 1);
317314
};
318315

319316

src/camera.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,13 @@ weapi.Camera.prototype.setPos = function(latitude, longitude, altitude) {
5252
longitude = goog.isDefAndNotNull(longitude) ? longitude : oldPos[1];
5353
altitude = altitude > 0 ? altitude : oldPos[2];
5454
}
55-
var carto = new Cesium.Cartographic(longitude, latitude, altitude);
56-
57-
this.camera.setPositionCartographic(carto);
55+
var pos = Cesium.Cartesian3.fromRadians(longitude, latitude, altitude);
56+
this.camera.setView({
57+
'position': pos,
58+
'heading': 0,
59+
'pitch': -Math.PI / 2,
60+
'roll': 0
61+
});
5862
};
5963

6064

@@ -139,9 +143,13 @@ weapi.Camera.prototype.setHeadingAndTilt = function(heading, tilt) {
139143
*/
140144
weapi.Camera.prototype.setPosHeadingAndTilt = function(lat, lng, alt,
141145
heading, tilt) {
142-
var carto = new Cesium.Cartographic(lng, lat, alt);
143-
144-
this.camera.setPositionCartographic(carto);
146+
var pos = Cesium.Cartesian3.fromRadians(lng, lat, alt);
147+
this.camera.setView({
148+
'position': pos,
149+
'heading': 0,
150+
'pitch': -Math.PI / 2,
151+
'roll': 0
152+
});
145153
this.camera.twistLeft(heading);
146154
this.camera.lookUp(tilt);
147155
};

src/editablepolygon.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,11 @@ weapi.EditablePolygon.prototype.setStrokeColor = function(hexColor, opt_a) {
181181

182182
/**
183183
* @param {string} src URL of the image to use.
184-
* @param {number} height Desired height of the image in pixels
185-
* when observed from the reference distance.
186-
* @param {number=} opt_minHeight Minimal height of the image in pixels (TODO).
187-
* @param {?number=} opt_maxHeight Maximal height of the image in pixels (TODO).
184+
* @param {number} width Desired width of the image in meters.
185+
* @param {number} height Desired height of the image in meters.
188186
*/
189-
weapi.EditablePolygon.prototype.setIcon = function(src, height,
190-
opt_minHeight,
191-
opt_maxHeight) {
192-
this.icon_.setImage(src, height, opt_minHeight, opt_maxHeight);
187+
weapi.EditablePolygon.prototype.setIcon = function(src, width, height) {
188+
this.icon_.setImage(src, width, height);
193189
this.repositionIcon_();
194190
this.app.sceneChanged = true;
195191
};

0 commit comments

Comments
 (0)