Skip to content

Commit 2322f47

Browse files
author
oterral
authored
Merge branch 'master' into time
2 parents 64ff4fa + 2b6afbf commit 2322f47

37 files changed

+1336
-101
lines changed

.idea/encodings.xml

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
3+
<Document id="Document_65">
4+
<name>Eiffel Tower Flyto</name>
5+
<visibility>1</visibility>
6+
<open>0</open>
7+
<Folder id="Folder_66">
8+
<name>AutoPlay</name>
9+
<visibility>1</visibility>
10+
<open>0</open>
11+
</Folder>
12+
<gx:Tour id="Tour_69">
13+
<name>eiffel-tower-flyto</name>
14+
<gx:Playlist>
15+
<gx:Wait id="Wait_70">
16+
<gx:duration>0.2</gx:duration>
17+
</gx:Wait>
18+
<gx:FlyTo id="FlyTo_74">
19+
<gx:duration>6</gx:duration>
20+
<LookAt id="LookAt_72">
21+
<longitude>2.29448129999356</longitude>
22+
<latitude>48.8583700998311</latitude>
23+
<altitude>196.5753973788714</altitude>
24+
<heading>0.0</heading>
25+
<tilt>67.0</tilt>
26+
<range>1500.0</range>
27+
<gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode>
28+
</LookAt>
29+
</gx:FlyTo>
30+
<gx:Wait id="Wait_75">
31+
<gx:duration>4</gx:duration>
32+
</gx:Wait>
33+
<gx:FlyTo id="FlyTo_74">
34+
<gx:duration>6</gx:duration>
35+
<Camera>
36+
<longitude>170.157</longitude>
37+
<latitude>-43.671</latitude>
38+
<altitude>9700</altitude>
39+
<heading>-6.333</heading>
40+
<tilt>33.5</tilt>
41+
</Camera>
42+
</gx:FlyTo>
43+
</gx:Playlist>
44+
</gx:Tour>
45+
</Document>
46+
</kml>
Loading

Apps/Sandcastle/gallery/3D Tiles Interactivity.html

+14-12
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,20 @@
112112
function annotate(movement, feature) {
113113
if (scene.pickPositionSupported) {
114114
var cartesian = scene.pickPosition(movement.position);
115-
var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
116-
var height = cartographic.height.toFixed(2) + ' m';
117-
118-
annotations.add({
119-
position : cartesian,
120-
text : height,
121-
showBackground : true,
122-
font : '14px monospace',
123-
horizontalOrigin : Cesium.HorizontalOrigin.LEFT,
124-
verticalOrigin : Cesium.VerticalOrigin.BOTTOM,
125-
disableDepthTestDistance : Number.POSITIVE_INFINITY
126-
});
115+
if(Cesium.defined(cartesian)){
116+
var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
117+
var height = cartographic.height.toFixed(2) + ' m';
118+
119+
annotations.add({
120+
position : cartesian,
121+
text : height,
122+
showBackground : true,
123+
font : '14px monospace',
124+
horizontalOrigin : Cesium.HorizontalOrigin.LEFT,
125+
verticalOrigin : Cesium.VerticalOrigin.BOTTOM,
126+
disableDepthTestDistance : Number.POSITIVE_INFINITY
127+
});
128+
}
127129
}
128130
}
129131

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
7+
<meta name="description" content="A simple KML example.">
8+
<meta name="cesium-sandcastle-labels" content="Showcases, DataSources">
9+
<title>Cesium Demo</title>
10+
<script type="text/javascript" src="../Sandcastle-header.js"></script>
11+
<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.20/require.js"></script>
12+
<script type="text/javascript">
13+
require.config({
14+
baseUrl : '../../../Source',
15+
waitSeconds : 60
16+
});
17+
</script>
18+
</head>
19+
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
20+
<style>
21+
@import url(../templates/bucket.css);
22+
</style>
23+
<div id="cesiumContainer" class="fullSize"></div>
24+
<div id="loadingOverlay"><h1>Loading...</h1></div>
25+
<div id="toolbar"></div>
26+
27+
<script id="cesium_sandcastle_script">
28+
function startup(Cesium) {
29+
'use strict';
30+
//Sandcastle_Begin
31+
var viewer = new Cesium.Viewer('cesiumContainer');
32+
var options = {
33+
camera : viewer.scene.camera,
34+
canvas : viewer.scene.canvas
35+
};
36+
37+
var tour = null;
38+
viewer.dataSources.add(
39+
Cesium.KmlDataSource.load('../../SampleData/kml/eiffel-tower-flyto.kml', options))
40+
.then(function(dataSource) {
41+
tour = dataSource.kmlTours[0];
42+
tour.tourStart.addEventListener(function() {
43+
console.log('Start tour');
44+
});
45+
tour.tourEnd.addEventListener(function(terminated) {
46+
console.log((terminated ? 'Terminate' : 'End') + ' tour');
47+
});
48+
tour.entryStart.addEventListener(function(entry) {
49+
console.log('Play ' + entry.type + ' ('+ entry.duration + ')');
50+
});
51+
tour.entryEnd.addEventListener(function(entry, terminated) {
52+
console.log((terminated ? 'Terminate' : 'End') + ' ' + entry.type);
53+
});
54+
});
55+
56+
Sandcastle.addToolbarButton('Play', function(){
57+
tour.play(viewer);
58+
});
59+
60+
Sandcastle.addToolbarButton('Terminate', function(){
61+
tour.stop();
62+
});
63+
64+
Sandcastle.reset = function() {
65+
viewer.dataSources.removeAll();
66+
viewer.clock.clockRange = Cesium.ClockRange.UNBOUNDED;
67+
viewer.clock.clockStep = Cesium.ClockStep.SYSTEM_CLOCK;
68+
};
69+
//Sandcastle_End
70+
Sandcastle.finishedLoading();
71+
}
72+
if (typeof Cesium !== "undefined") {
73+
startup(Cesium);
74+
} else if (typeof require === "function") {
75+
require(["Cesium"], startup);
76+
}
77+
</script>
78+
</body>
79+
</html>

Apps/Sandcastle/gallery/KML Tours.jpg

8.89 KB
Loading

CHANGES.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
Change Log
22
==========
3-
43
### 1.37 - 2017-09-01
54

65
* Fixed `replaceState` bug that was causing the `CesiumViewer` demo application to crash in Safari and iOS
76
* Added `customTags` property to the UrlTemplateImageryProvider to allow custom keywords in the template URL.
7+
* Fixed issue where `Model` and `BillboardCollection` would throw an error if the globe is undefined [#5638](https://github.com/AnalyticalGraphicsInc/cesium/issues/5638)
8+
* Fixed issue where the `Model` glTF cache loses reference to the model's buffer data. [#5720](https://github.com/AnalyticalGraphicsInc/cesium/issues/5720)
9+
* Fixed some issues with `disableDepthTestDistance` [#5501](https://github.com/AnalyticalGraphicsInc/cesium/issues/5501) [#5331](https://github.com/AnalyticalGraphicsInc/cesium/issues/5331) [#5621](https://github.com/AnalyticalGraphicsInc/cesium/issues/5621)
10+
* Added several new Bing Maps styles: `CANVAS_DARK`, `CANVAS_LIGHT`, and `CANVAS_GRAY`.
11+
* Added small improvements to the atmosphere. [#5741](https://github.com/AnalyticalGraphicsInc/cesium/pull/5741)
12+
* Fixed a bug that caused imagery splitting to work incorrectly when CSS pixels were not equivalent to WebGL drawing buffer pixels, such as on high DPI displays in Microsoft Edge and Internet Explorer.
13+
* Added `Cesium3DTileset.loadJson` to support overriding the default tileset loading behavior. [#5685](https://github.com/AnalyticalGraphicsInc/cesium/pull/5685)
14+
* Fixed loading of binary glTFs containing CRN or KTX textures. [#5753](https://github.com/AnalyticalGraphicsInc/cesium/pull/5753)
15+
* Fixed specular computation for certain models using the `KHR_materials_common` extension. [#5773](https://github.com/AnalyticalGraphicsInc/cesium/pull/5773)
16+
* Fixed a bug where developer error was thrown in Sandcastle example [#5703](https://github.com/AnalyticalGraphicsInc/cesium/issues/5703)
17+
* Fixed a 3D Tiles traversal bug for tilesets using additive refinement. [#5766](https://github.com/AnalyticalGraphicsInc/cesium/issues/5766)
818

919
### 1.36 - 2017-08-01
1020

Source/Core/BingMapsApi.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ define([
4141
console.log(errorString);
4242
printedBingWarning = true;
4343
}
44-
return 'AihaXS6TtE_olKOVdtkMenAMq1L5nDlnU69mRtNisz1vZavr1HhdqGRNkB2Bcqvs';
44+
return 'AsWE_wlRITl2b5Pr5oThzDwMg7Zh6ghwinCT-QinakkCBU9H2BUb7YQlpZXfPoo4';
4545
}
4646

4747
return BingMapsApi.defaultKey;

Source/DataSources/KmlCamera.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
define([], function() {
2+
'use strict';
3+
/**
4+
* Representation of <Camera> from KML
5+
* @alias KmlCamera
6+
* @constructor
7+
*
8+
* @param {Cartesian3} position camera position
9+
* @param {HeadingPitchRoll} headingPitchRoll camera orientation
10+
*/
11+
function KmlCamera(position, headingPitchRoll) {
12+
this.position = position;
13+
this.headingPitchRoll = headingPitchRoll;
14+
}
15+
16+
return KmlCamera;
17+
});

Source/DataSources/KmlDataSource.js

+118-9
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ define([
3232
'../Core/RuntimeError',
3333
'../Core/TimeInterval',
3434
'../Core/TimeIntervalCollection',
35+
'../Core/HeadingPitchRoll',
36+
'../Core/HeadingPitchRange',
3537
'../Scene/HeightReference',
3638
'../Scene/HorizontalOrigin',
3739
'../Scene/LabelStyle',
@@ -58,7 +60,12 @@ define([
5860
'./SampledPositionProperty',
5961
'./ScaledPositionProperty',
6062
'./TimeIntervalCollectionProperty',
61-
'./WallGraphics'
63+
'./WallGraphics',
64+
'./KmlLookAt',
65+
'./KmlCamera',
66+
'./KmlTour',
67+
'./KmlTourFlyTo',
68+
'./KmlTourWait'
6269
], function(
6370
AssociativeArray,
6471
BoundingRectangle,
@@ -93,6 +100,8 @@ define([
93100
RuntimeError,
94101
TimeInterval,
95102
TimeIntervalCollection,
103+
HeadingPitchRoll,
104+
HeadingPitchRange,
96105
HeightReference,
97106
HorizontalOrigin,
98107
LabelStyle,
@@ -119,7 +128,12 @@ define([
119128
SampledPositionProperty,
120129
ScaledPositionProperty,
121130
TimeIntervalCollectionProperty,
122-
WallGraphics) {
131+
WallGraphics,
132+
KmlLookAt,
133+
KmlCamera,
134+
KmlTour,
135+
KmlTourFlyTo,
136+
KmlTourWait) {
123137
'use strict';
124138

125139
// IE 8 doesn't have a DOM parser and can't run Cesium anyway, so just bail.
@@ -1615,13 +1629,9 @@ define([
16151629

16161630
processExtendedData(featureNode, entity);
16171631
processDescription(featureNode, entity, styleEntity, uriResolver, dataSource._proxy, sourceUri);
1632+
processLookAt(featureNode, entity);
1633+
processCamera(featureNode, entity);
16181634

1619-
if (defined(queryFirstNode(featureNode, 'Camera', namespaces.kml))) {
1620-
oneTimeWarning('kml-camera', 'KML - Unsupported view: Camera');
1621-
}
1622-
if (defined(queryFirstNode(featureNode, 'LookAt', namespaces.kml))) {
1623-
oneTimeWarning('kml-lookAt', 'KML - Unsupported view: LookAt');
1624-
}
16251635
if (defined(queryFirstNode(featureNode, 'Region', namespaces.kml))) {
16261636
oneTimeWarning('kml-region', 'KML - Placemark Regions are unsupported');
16271637
}
@@ -1641,7 +1651,7 @@ define([
16411651
GroundOverlay : processGroundOverlay,
16421652
PhotoOverlay : processUnsupportedFeature,
16431653
ScreenOverlay : processUnsupportedFeature,
1644-
Tour : processUnsupportedFeature
1654+
Tour : processTour
16451655
};
16461656

16471657
function processDocument(dataSource, parent, node, entityCollection, styleCollection, sourceUri, uriResolver, promises, context, query) {
@@ -1693,6 +1703,105 @@ define([
16931703
}
16941704
}
16951705

1706+
var playlistNodeProcessors = {
1707+
FlyTo: processTourFlyTo,
1708+
Wait: processTourWait,
1709+
SoundCue: processTourUnsupportedNode,
1710+
AnimatedUpdate: processTourUnsupportedNode,
1711+
TourControl: processTourUnsupportedNode
1712+
};
1713+
1714+
function processTour(dataSource, parent, node, entityCollection, styleCollection, sourceUri, uriResolver, promises, context) {
1715+
var name = queryStringValue(node, 'name', namespaces.kml);
1716+
var id = queryStringAttribute(node, 'id');
1717+
var tour = new KmlTour(name, id);
1718+
1719+
var playlistNode = queryFirstNode(node, 'Playlist', namespaces.gx);
1720+
if(playlistNode) {
1721+
var childNodes = playlistNode.childNodes;
1722+
for(var i = 0; i < childNodes.length; i++) {
1723+
var entryNode = childNodes[i];
1724+
if (entryNode.localName) {
1725+
var playlistNodeProcessor = playlistNodeProcessors[entryNode.localName];
1726+
if (playlistNodeProcessor) {
1727+
playlistNodeProcessor(tour, entryNode);
1728+
}
1729+
else {
1730+
console.log('Unknown KML Tour playlist entry type ' + entryNode.localName);
1731+
}
1732+
}
1733+
}
1734+
}
1735+
1736+
if (!defined(dataSource.kmlTours)) {
1737+
dataSource.kmlTours = [];
1738+
}
1739+
1740+
dataSource.kmlTours.push(tour);
1741+
}
1742+
1743+
function processTourUnsupportedNode(tour, entryNode) {
1744+
oneTimeWarning('KML Tour unsupported node ' + entryNode.localName);
1745+
}
1746+
1747+
function processTourWait(tour, entryNode) {
1748+
var duration = queryNumericValue(entryNode, 'duration', namespaces.gx);
1749+
tour.addPlaylistEntry(new KmlTourWait(duration));
1750+
}
1751+
1752+
function processTourFlyTo(tour, entryNode) {
1753+
var duration = queryNumericValue(entryNode, 'duration', namespaces.gx);
1754+
var flyToMode = queryStringValue(entryNode, 'flyToMode', namespaces.gx);
1755+
1756+
var t = {kml: {}};
1757+
1758+
processLookAt(entryNode, t);
1759+
processCamera(entryNode, t);
1760+
1761+
var view = t.kml.lookAt || t.kml.camera;
1762+
1763+
var flyto = new KmlTourFlyTo(duration, flyToMode, view);
1764+
tour.addPlaylistEntry(flyto);
1765+
}
1766+
1767+
function processCamera(featureNode, entity) {
1768+
var camera = queryFirstNode(featureNode, 'Camera', namespaces.kml);
1769+
if(defined(camera)) {
1770+
var lon = defaultValue(queryNumericValue(camera, 'longitude', namespaces.kml), 0.0);
1771+
var lat = defaultValue(queryNumericValue(camera, 'latitude', namespaces.kml), 0.0);
1772+
var altitude = defaultValue(queryNumericValue(camera, 'altitude', namespaces.kml), 0.0);
1773+
1774+
var heading = defaultValue(queryNumericValue(camera, 'heading', namespaces.kml), 0.0);
1775+
var tilt = defaultValue(queryNumericValue(camera, 'tilt', namespaces.kml), 0.0);
1776+
var roll = defaultValue(queryNumericValue(camera, 'roll', namespaces.kml), 0.0);
1777+
1778+
var position = Cartesian3.fromDegrees(lon, lat, altitude);
1779+
var hpr = HeadingPitchRoll.fromDegrees(heading, tilt - 90.0, roll);
1780+
1781+
entity.kml.camera = new KmlCamera(position, hpr);
1782+
}
1783+
}
1784+
1785+
function processLookAt(featureNode, entity) {
1786+
var lookAt = queryFirstNode(featureNode, 'LookAt', namespaces.kml);
1787+
if(defined(lookAt)) {
1788+
var lon = defaultValue(queryNumericValue(lookAt, 'longitude', namespaces.kml), 0.0);
1789+
var lat = defaultValue(queryNumericValue(lookAt, 'latitude', namespaces.kml), 0.0);
1790+
var altitude = defaultValue(queryNumericValue(lookAt, 'altitude', namespaces.kml), 0.0);
1791+
var heading = queryNumericValue(lookAt, 'heading', namespaces.kml);
1792+
var tilt = queryNumericValue(lookAt, 'tilt', namespaces.kml);
1793+
var range = defaultValue(queryNumericValue(lookAt, 'range', namespaces.kml), 0.0);
1794+
1795+
tilt = CesiumMath.toRadians(defaultValue(tilt, 0.0));
1796+
heading = CesiumMath.toRadians(defaultValue(heading, 0.0));
1797+
1798+
var hpr = new HeadingPitchRange(heading, tilt - 90.0, range);
1799+
var viewPoint = Cartesian3.fromDegrees(lon, lat, altitude);
1800+
1801+
entity.kml.lookAt = new KmlLookAt(viewPoint, hpr);
1802+
}
1803+
}
1804+
16961805
function processGroundOverlay(dataSource, parent, groundOverlay, entityCollection, styleCollection, sourceUri, uriResolver, promises, context, query) {
16971806
var r = processFeature(dataSource, parent, groundOverlay, entityCollection, styleCollection, sourceUri, uriResolver, promises, context, query);
16981807
var entity = r.entity;

0 commit comments

Comments
 (0)