-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Terrain #510
Terrain #510
Changes from all commits
43d4595
7a4be28
b0f6603
06a2e3f
5d56c64
312b0e7
6b91652
4a8ac94
eef53e0
b8f6489
22d5dba
24f9e1f
8197d4c
0d9ee12
2330d10
2612e19
41af797
92a5629
12f0633
7e3c189
aa655ac
17172c3
35937d0
9f8db91
e9bfec5
4609b4c
45bb4bb
205475f
e26104c
354c296
011757c
d237da3
f581b9d
f534ace
e5ca51f
c2ae2fd
6085e2c
b37237d
68ff428
9417ed9
135954d
5b38c60
887bfdc
05e0558
3fcc021
d36074a
8f8929d
8669122
618b806
60e0e79
b5a2078
c232e19
a566998
70efd84
aba85dd
2c98549
71a38d7
cf691c2
8479405
28efcbc
162ea31
1ce0c1c
d6c86f2
fcca8e5
80cb21e
47237dd
abdf1b4
6e081ce
81e9cd2
31956fe
29b0381
043e631
b540e63
a0a5624
c090b1c
881ad1d
9d42179
89c0f5d
15d213b
31a606c
50bf74c
0904777
d7e06c8
15ea3af
b02b935
5ff6291
ea578d5
28e8d1c
e88ff8b
d7aafcd
e101262
09580e0
fd54bf4
7011677
5a6ae53
ecfa351
8cdff05
50b47b2
ac3923a
5945bce
8d94cbd
134a4df
249f183
9b712d1
b5f913b
08a8b78
0b2c737
1bbae82
e4bc7ea
d1c0e78
8ddb73b
a09a145
e190b4b
4aa3179
62f8b4f
52628da
3fb37b8
c49fa46
3b30bc0
93bd476
86abdc2
42e0527
58ce03f
60f8cc4
e02c82d
3bf3c37
7ed561a
0aab855
400b46a
3c76874
5d5a5cd
72c9288
d0b393e
76d7c6c
e9f952f
f05734a
da34e8d
924c3a9
f63760a
5568a06
d56acae
5ebc2b4
fe4c6d7
c95ee3c
55e8902
398e182
fd07c6b
6418173
decc785
172fa42
16927ab
9f541d0
ab54c77
a63529f
408929a
e968e3c
55a32dc
61cf3b1
518ce65
66c394e
f8c78dc
2578165
0c0b5c9
0688d56
31ae185
67ae947
8013678
9106492
9d30cc5
e5762b2
2664268
7800747
e24368e
349f708
4064d47
cfbf753
3ff2dcc
d84529f
fa73a84
4ee1c93
126987e
471408a
630817b
b52e857
fe66cec
79192d8
e08acdd
0c17b87
bc53d7b
a99ce98
34bb13c
4f5c740
45bc7e3
c97594e
a77b692
785cf4d
7b36d69
875b6ca
e97fd85
82684aa
f73c78a
68214e4
386e7e0
77ba47c
a00c61d
60fe38f
fd7e61a
de20c66
b2df538
0ec8e1f
d886402
22f66cb
c6dfd9c
653b7f1
657596d
81d34fe
3df75cc
b25be19
c5c9ca1
ffc9b4a
6f9a026
8b2b5b7
d148d1f
5b8484e
44dcef7
e32afd9
23112e6
db07974
44e2723
73f760f
996168c
9edfcf1
9d58735
4c673fc
b25cd3d
e10853a
1d99511
a875191
397b42e
69908b3
3b6f3fc
5102766
0727084
00742b4
a6c59eb
a2fd7cf
f9471f4
7ca3e4d
9ca73fb
ddbaee3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> <!-- Use Chrome Frame in IE --> | ||
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"> | ||
<meta name="description" content="Visualize worldwide, high-resolution terrain."> | ||
<title>Cesium Demo</title> | ||
<script type="text/javascript" src="../Sandcastle-header.js"></script> | ||
<script type="text/javascript"> | ||
var dojoConfig = { | ||
baseUrl : '../../../Source', | ||
packages: [ | ||
{ name: 'dojo', location: '../ThirdParty/dojo-release-1.8.3-src/dojo' }, | ||
{ name: 'dijit', location: '../ThirdParty/dojo-release-1.8.3-src/dijit' }, | ||
{ name: 'dojox', location: '../ThirdParty/dojo-release-1.8.3-src/dojox' } | ||
] | ||
}; | ||
</script> | ||
<script data-dojo-config="async: 1, tlmSiblingOfDojo: 0" src="../../../ThirdParty/dojo-release-1.8.3-src/dojo/dojo.js"></script> | ||
<link rel="stylesheet" href="../../../ThirdParty/dojo-release-1.8.3-src/dijit/themes/claro/claro.css" type="text/css"> | ||
<link rel="stylesheet" href="../../../Source/Widgets/Dojo/CesiumViewerWidget.css" type="text/css"> | ||
</head> | ||
<body class="claro sandcastle-loading" data-sandcastle-bucket="bucket-dojo.html" data-sandcastle-title="Cesium + Dojo"> | ||
<style> | ||
@import url(../templates/bucket.css); | ||
</style> | ||
<div id="cesiumContainer" class="fullSize"></div> | ||
<div id="loadingOverlay"><h1>Loading...</h1></div> | ||
<div id="toolbar"> | ||
<div id="terrainMenu"></div> | ||
<div id="zoomButtons"></div> | ||
</div> | ||
<script id="cesium_sandcastle_script"> | ||
require([ | ||
'Cesium', | ||
'Widgets/Dojo/CesiumViewerWidget', | ||
'dijit/DropDownMenu', | ||
'dijit/MenuItem', | ||
'dijit/form/Button', | ||
'dijit/form/DropDownButton' | ||
], function( | ||
Cesium, | ||
CesiumViewerWidget, | ||
DropDownMenu, | ||
MenuItem, | ||
Button, | ||
DropDownButton) { | ||
"use strict"; | ||
|
||
function createTerrainMenu(terrainProviders) { | ||
var menu = new DropDownMenu(); | ||
var button = new DropDownButton({ | ||
label : terrainProviders[0].name, | ||
dropDown : menu | ||
}); | ||
|
||
function createTerrainMenuItem(button, providerInfo) { | ||
return new MenuItem({ | ||
label : providerInfo.name, | ||
onClick : function() { | ||
centralBody.terrainProvider = providerInfo.provider; | ||
button.set('label', providerInfo.name); | ||
} | ||
}); | ||
} | ||
|
||
for (var i = 0, len = terrainProviders.length; i < len; ++i) { | ||
menu.addChild(createTerrainMenuItem(button, terrainProviders[i])); | ||
} | ||
|
||
button.placeAt('terrainMenu'); | ||
|
||
new Button({ | ||
label: 'Mount Everest', | ||
onClick: function() { | ||
var eye, target, up; | ||
|
||
if (scene.mode === Cesium.SceneMode.SCENE3D) { | ||
eye = new Cesium.Cartesian3(294572.0645397696, 5637826.573008351, 2978624.6868285); | ||
target = eye.add(new Cesium.Cartesian3(0.9028130862217908, -0.42449297750082904, -0.06880583840911567)); | ||
up = new Cesium.Cartesian3(0.40668971896562117, 0.790807045510862, 0.45741413322152297); | ||
scene.getCamera().controller.lookAt(eye, target, up); | ||
} else if (scene.mode === Cesium.SceneMode.COLUMBUS_VIEW) { | ||
eye = new Cesium.Cartesian3(9684590.891310014, 3114799.076252769, 9849.375792522824); | ||
target = eye.add(new Cesium.Cartesian3(-0.8929328433855669, -0.00005779973945286486, -0.45018988645076763)); | ||
up = new Cesium.Cartesian3(-0.4501898855076042, -0.0000291369789812141, 0.8929328452557279); | ||
scene.getCamera().controller.lookAt(eye, target, up); | ||
} else { | ||
scene.getCamera().controller.viewExtent(new Cesium.Extent(1.516102969, 0.48744464, 1.518102969, 0.48944464)); | ||
} | ||
} | ||
}).placeAt('zoomButtons'); | ||
|
||
new Button({ | ||
label: 'Half Dome', | ||
onClick: function() { | ||
var eye, target, up; | ||
|
||
if (scene.mode === Cesium.SceneMode.SCENE3D) { | ||
eye = new Cesium.Cartesian3(-2496304.1498512086, -4391818.97382059, 3884176.4503971986); | ||
target = eye.add(new Cesium.Cartesian3(0.9279518715011381, -0.29488412129953234, -0.22792252890604328)); | ||
up = new Cesium.Cartesian3(-0.11836693744723503, -0.8130611584421428, 0.5700182635106171); | ||
scene.getCamera().controller.lookAt(eye, target, up); | ||
} else if (scene.mode === Cesium.SceneMode.COLUMBUS_VIEW) { | ||
eye = new Cesium.Cartesian3(-13314946.646404704, 4200941.442507448, 2468.225945515426); | ||
target = eye.add(new Cesium.Cartesian3(0.9624895834866811, 0.04124314776883213, -0.26816562874787864)); | ||
up = new Cesium.Cartesian3(0.2679197697914868, 0.011480478929947842, 0.9633728227203466); | ||
scene.getCamera().controller.lookAt(eye, target, up); | ||
} else { | ||
scene.getCamera().controller.viewExtent(new Cesium.Extent(-2.08724538, 0.6577939, -2.08524538, 0.6597939)); | ||
} | ||
} | ||
}).placeAt('zoomButtons'); | ||
|
||
new Button({ | ||
label: 'San Francisco Bay', | ||
onClick: function() { | ||
var eye, target, up; | ||
|
||
if (scene.mode === Cesium.SceneMode.SCENE3D) { | ||
eye = new Cesium.Cartesian3(-2674718.9291375633, -4332137.224608461, 3888180.6614196445); | ||
target = eye.add(new Cesium.Cartesian3(-0.40034097132786534, 0.9155843741828319, 0.03784653786617176)); | ||
up = new Cesium.Cartesian3(-0.6502679490649945, -0.3129458646313862, 0.6922546353438556); | ||
scene.getCamera().controller.lookAt(eye, target, up); | ||
} else if (scene.mode === Cesium.SceneMode.COLUMBUS_VIEW) { | ||
eye = new Cesium.Cartesian3(-13562569.113918452, 4176598.9965795614, 37656.37201701476); | ||
target = eye.add(new Cesium.Cartesian3(-0.8108519561707095, 0.4023795334200999, -0.42498213639958615)); | ||
up = new Cesium.Cartesian3(-0.3806859699462094, 0.18891270085627615, 0.905201736488051); | ||
scene.getCamera().controller.lookAt(eye, target, up); | ||
} else { | ||
scene.getCamera().controller.viewExtent(new Cesium.Extent(-2.147621889, 0.64829691, -2.125621889, 0.67029691)); | ||
} | ||
} | ||
}).placeAt('zoomButtons'); | ||
} | ||
|
||
var widget = new CesiumViewerWidget(); | ||
widget.placeAt('cesiumContainer'); | ||
widget.fullscreenElement = document.body; | ||
widget.startup(); | ||
|
||
var scene = widget.scene; | ||
var centralBody = scene.getPrimitives().getCentralBody(); | ||
|
||
var terrainProvider = new Cesium.CesiumTerrainProvider({ | ||
url : 'http://cesium.agi.com/smallterrain' | ||
}); | ||
|
||
centralBody.terrainProvider = terrainProvider; | ||
|
||
var ellipsoidProvider = new Cesium.EllipsoidTerrainProvider(); | ||
|
||
var terrainProviders = [ | ||
{ name : 'CesiumTerrainProvider', provider : terrainProvider }, | ||
{ name : 'EllipsoidTerrainProvider', provider : ellipsoidProvider } | ||
]; | ||
|
||
createTerrainMenu(terrainProviders); | ||
|
||
Sandcastle.finishedLoading(); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,6 +70,35 @@ define([ | |
this._centerToleranceSquared = CesiumMath.EPSILON1; | ||
}; | ||
|
||
/** | ||
* Duplicates an Ellipsoid instance. | ||
* | ||
* @memberof Ellipsoid | ||
* | ||
* @param {Ellipsoid} ellipsoid The ellipsoid to duplicate. | ||
* @param {Ellipsoid} [result] The object onto which to store the result, or undefined if a new | ||
* instance should be created. | ||
* @returns {Ellipsoid} The cloned Ellipsoid. | ||
*/ | ||
Ellipsoid.clone = function(ellipsoid, result) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it make sense for this to be a "static" function? Everything else in this file is on the prototype. At the very least we should provide a prototype version (and my vote would be to get rid of the static version). Also, we usually treat There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm using this to reconstitute an ellipsoid after passing it to a web worker. All the functions get stripped away and only the fields are left. By taking this neutered Ellipsoid and passing it through Ellipsoid.clone, I get back an actual Ellipsoid that is equivalent to the original. A prototype method won't work for that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good enough for me. |
||
var radii = ellipsoid._radii; | ||
|
||
if (typeof result === 'undefined') { | ||
return new Ellipsoid(radii.x, radii.y, radii.z); | ||
} | ||
|
||
Cartesian3.clone(radii, result._radii); | ||
Cartesian3.clone(ellipsoid._radiiSquared, result._radiiSquared); | ||
Cartesian3.clone(ellipsoid._radiiToTheFourth, result._radiiToTheFourth); | ||
Cartesian3.clone(ellipsoid._oneOverRadii, result._oneOverRadii); | ||
Cartesian3.clone(ellipsoid._oneOverRadiiSquared, result._oneOverRadiiSquared); | ||
result._minimumRadius = ellipsoid._minimumRadius; | ||
result._maximumRadius = ellipsoid._maximumRadius; | ||
result._centerToleranceSquared = ellipsoid._centerToleranceSquared; | ||
|
||
return result; | ||
}; | ||
|
||
/** | ||
* Computes an Ellipsoid from a Cartesian specifying the radii in x, y, and z directions. | ||
* | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to add
widget.fullscreenElement = document.body;
here so that everything shows up in full screen mode and not just the viewer widget.