Skip to content

Commit b0a3834

Browse files
author
Josh Bernstein
committed
Pull and resolve merge conflict CesiumGS#5819
2 parents 6c40ecb + b5ffdff commit b0a3834

20 files changed

+171
-94
lines changed

Apps/Sandcastle/CesiumSandcastle.js

+48-33
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ require({
1616
}, {
1717
name : 'Source',
1818
location : '.'
19+
}, {
20+
name: 'CesiumUnminified',
21+
location : '../Build/CesiumUnminified',
22+
main: 'Cesium'
1923
}, {
2024
name : 'CodeMirror',
2125
location : '../ThirdParty/codemirror-4.6'
@@ -43,6 +47,10 @@ require({
4347
'dojo/query',
4448
'dojo/when',
4549
'Sandcastle/LinkButton',
50+
'Source/Core/defined',
51+
'Source/Core/getBaseUri',
52+
'Source/Core/loadJsonp',
53+
'Source/Core/loadWithXhr',
4654
'Source/Cesium',
4755
'CodeMirror/addon/hint/show-hint',
4856
'CodeMirror/addon/hint/javascript-hint',
@@ -86,11 +94,18 @@ require({
8694
query,
8795
when,
8896
LinkButton,
89-
Cesium) {
97+
defined,
98+
getBaseUri,
99+
loadJsonp,
100+
loadWithXhr,
101+
Cesium
102+
) {
90103
'use strict';
91104

92105
//In order for CodeMirror auto-complete to work, Cesium needs to be defined as a global.
93-
window.Cesium = Cesium;
106+
if (!defined(window.Cesium)) {
107+
window.Cesium = Cesium;
108+
}
94109

95110
parser.parse();
96111

@@ -214,7 +229,7 @@ require({
214229
}
215230

216231
function openDocTab(title, link) {
217-
if (!Cesium.defined(docTabs[title])) {
232+
if (!defined(docTabs[title])) {
218233
docTabs[title] = new ContentPane({
219234
title : title,
220235
focused : true,
@@ -271,7 +286,7 @@ require({
271286

272287
function onCursorActivity() {
273288
docNode.style.left = '-999px';
274-
if (Cesium.defined(docTimer)) {
289+
if (defined(docTimer)) {
275290
window.clearTimeout(docTimer);
276291
}
277292
docTimer = window.setTimeout(showDocPopup, 500);
@@ -295,7 +310,7 @@ require({
295310
}
296311

297312
function closeGalleryTooltip() {
298-
if (Cesium.defined(activeGalleryTooltipDemo)) {
313+
if (defined(activeGalleryTooltipDemo)) {
299314
popup.close(demoTooltips[activeGalleryTooltipDemo.name]);
300315
activeGalleryTooltipDemo = undefined;
301316
}
@@ -312,7 +327,7 @@ require({
312327
suffix = 'searchDemo';
313328
}
314329

315-
if (Cesium.defined(activeGalleryTooltipDemo)) {
330+
if (defined(activeGalleryTooltipDemo)) {
316331
popup.open({
317332
popup : demoTooltips[activeGalleryTooltipDemo.name],
318333
around : dom.byId(activeGalleryTooltipDemo.name + suffix),
@@ -324,7 +339,7 @@ require({
324339
function scheduleGalleryTooltip(demo) {
325340
if (demo !== activeGalleryTooltipDemo) {
326341
activeGalleryTooltipDemo = demo;
327-
if (Cesium.defined(galleryTooltipTimer)) {
342+
if (defined(galleryTooltipTimer)) {
328343
window.clearTimeout(galleryTooltipTimer);
329344
}
330345
galleryTooltipTimer = window.setTimeout(openGalleryTooltip, 220);
@@ -372,7 +387,7 @@ require({
372387
var hints = JSHINT.errors;
373388
for (i = 0, len = hints.length; i < len; ++i) {
374389
var hint = hints[i];
375-
if (hint !== null && Cesium.defined(hint.reason) && hint.line > 0) {
390+
if (hint !== null && defined(hint.reason) && hint.line > 0) {
376391
line = jsEditor.setGutterMarker(scriptLineToEditorLine(hint.line), 'hintGutter', makeLineLabel(hint.reason, 'hintMarker'));
377392
jsEditor.addLineClass(line, 'text', 'hintLine');
378393
errorLines.push(line);
@@ -383,22 +398,22 @@ require({
383398
}
384399

385400
function scheduleHint() {
386-
if (Cesium.defined(hintTimer)) {
401+
if (defined(hintTimer)) {
387402
window.clearTimeout(hintTimer);
388403
}
389404
hintTimer = setTimeout(clearErrorsAddHints, 550);
390405
highlightRun();
391406
}
392407

393408
function scheduleHintNoChange() {
394-
if (Cesium.defined(hintTimer)) {
409+
if (defined(hintTimer)) {
395410
window.clearTimeout(hintTimer);
396411
}
397412
hintTimer = setTimeout(clearErrorsAddHints, 550);
398413
}
399414

400415
function scrollToLine(lineNumber) {
401-
if (Cesium.defined(lineNumber)) {
416+
if (defined(lineNumber)) {
402417
jsEditor.setCursor(lineNumber);
403418
// set selection twice in order to force the editor to scroll
404419
// to this location if the cursor is already there
@@ -457,13 +472,13 @@ require({
457472
function registerScroll(demoContainer) {
458473
if (document.onmousewheel !== undefined) {
459474
demoContainer.addEventListener('mousewheel', function(e) {
460-
if (Cesium.defined(e.wheelDelta) && e.wheelDelta) {
475+
if (defined(e.wheelDelta) && e.wheelDelta) {
461476
demoContainer.scrollLeft -= e.wheelDelta * 70 / 120;
462477
}
463478
}, false);
464479
} else {
465480
demoContainer.addEventListener('DOMMouseScroll', function(e) {
466-
if (Cesium.defined(e.detail) && e.detail) {
481+
if (defined(e.detail) && e.detail) {
467482
demoContainer.scrollLeft += e.detail * 70 / 3;
468483
}
469484
}, false);
@@ -662,7 +677,7 @@ require({
662677
function loadBucket(bucketName) {
663678
if (local.bucketName !== bucketName) {
664679
local.bucketName = bucketName;
665-
if (Cesium.defined(bucketTypes[bucketName])) {
680+
if (defined(bucketTypes[bucketName])) {
666681
local.headers = bucketTypes[bucketName];
667682
} else {
668683
local.headers = '<html><head></head><body data-sandcastle-bucket-loaded="no">';
@@ -686,13 +701,13 @@ require({
686701
var gistId = ioQuery.queryToObject(window.location.search.substring(1)).gist;
687702
if (window.location.search) {
688703
queryObject = ioQuery.queryToObject(window.location.search.substring(1));
689-
if (Cesium.defined(gistId)) {
704+
if (defined(gistId)) {
690705
queryObject.gistId = gistId;
691706
}
692707
} else {
693708
queryObject.src = 'Hello World.html';
694709
queryObject.label = 'Showcases';
695-
if (Cesium.defined(gistId)) {
710+
if (defined(gistId)) {
696711
queryObject.gistId = gistId;
697712
}
698713
}
@@ -731,13 +746,13 @@ require({
731746
var scriptCode = scriptMatch[1];
732747
demoCode = scriptCode.replace(/\s/g, '');
733748

734-
if (Cesium.defined(queryObject.gistId)) {
735-
Cesium.loadJsonp('https://api.github.com/gists/' + queryObject.gistId + '?access_token=dd8f755c2e5d9bbb26806bb93eaa2291f2047c60')
749+
if (defined(queryObject.gistId)) {
750+
loadJsonp('https://api.github.com/gists/' + queryObject.gistId + '?access_token=dd8f755c2e5d9bbb26806bb93eaa2291f2047c60')
736751
.then(function(data) {
737752
var files = data.data.files;
738753
var code = files['Cesium-Sandcastle.js'].content;
739754
var htmlFile = files['Cesium-Sandcastle.html'];
740-
var html = Cesium.defined(htmlFile) ? htmlFile.content : defaultHtml; // Use the default html for old gists
755+
var html = defined(htmlFile) ? htmlFile.content : defaultHtml; // Use the default html for old gists
741756
jsEditor.setValue(code);
742757
htmlEditor.setValue(html);
743758
demoCode = code.replace(/\s/g, '');
@@ -746,7 +761,7 @@ require({
746761
gistHtml = html;
747762
previousCode = code;
748763
previousHtml = html;
749-
sandcastleUrl = Cesium.getBaseUri(window.location.href) + '?src=Hello%20World.html&label=Showcases&gist=' + gistId;
764+
sandcastleUrl = getBaseUri(window.location.href) + '?src=Hello%20World.html&label=Showcases&gist=' + gistId;
750765
CodeMirror.commands.runCesium(jsEditor);
751766
clearRun();
752767
}).otherwise(function(error) {
@@ -813,14 +828,14 @@ require({
813828
appendConsole('consoleLog', 'Unable to load demo named ' + queryObject.src.replace('.html', '') + '. Redirecting to HelloWorld.\n', true);
814829
}
815830
}
816-
} else if (Cesium.defined(e.data.log)) {
831+
} else if (defined(e.data.log)) {
817832
// Console log messages from the iframe display in Sandcastle.
818833
appendConsole('consoleLog', e.data.log, false);
819-
} else if (Cesium.defined(e.data.error)) {
834+
} else if (defined(e.data.error)) {
820835
// Console error messages from the iframe display in Sandcastle
821836
var errorMsg = e.data.error;
822837
var lineNumber = e.data.lineNumber;
823-
if (Cesium.defined(lineNumber)) {
838+
if (defined(lineNumber)) {
824839
errorMsg += ' (on line ';
825840

826841
if (e.data.url) {
@@ -835,10 +850,10 @@ require({
835850
}
836851
}
837852
appendConsole('consoleError', errorMsg, true);
838-
} else if (Cesium.defined(e.data.warn)) {
853+
} else if (defined(e.data.warn)) {
839854
// Console warning messages from the iframe display in Sandcastle.
840855
appendConsole('consoleWarn', e.data.warn, true);
841-
} else if (Cesium.defined(e.data.highlight)) {
856+
} else if (defined(e.data.highlight)) {
842857
// Hovering objects in the embedded Cesium window.
843858
highlightLine(e.data.highlight);
844859
}
@@ -925,12 +940,12 @@ require({
925940
}
926941
}
927942
};
928-
return Cesium.loadWithXhr({
943+
return loadWithXhr({
929944
url : 'https://api.github.com/gists',
930945
data : JSON.stringify(data),
931946
method : 'POST'
932947
}).then(function(content) {
933-
sandcastleUrl = Cesium.getBaseUri(window.location.href) + '?src=Hello%20World.html&label=Showcases&gist=' + JSON.parse(content).id;
948+
sandcastleUrl = getBaseUri(window.location.href) + '?src=Hello%20World.html&label=Showcases&gist=' + JSON.parse(content).id;
934949
textArea.value = sandcastleUrl;
935950
textArea.select();
936951
}).otherwise(function(error) {
@@ -946,7 +961,7 @@ require({
946961
if (gistIndex !== -1) {
947962
gistId = gistId.substring(gistIndex + gistParameter.length);
948963
}
949-
window.location.href = Cesium.getBaseUri(window.location.href) + '?src=Hello%20World.html&label=Showcases&gist=' + gistId;
964+
window.location.href = getBaseUri(window.location.href) + '?src=Hello%20World.html&label=Showcases&gist=' + gistId;
950965
});
951966

952967
registry.byId('buttonNew').on('click', function() {
@@ -1093,15 +1108,15 @@ require({
10931108
demo.label = labels ? labels : '';
10941109

10951110
// Select the demo to load upon opening based on the query parameter.
1096-
if (Cesium.defined(queryObject.src)) {
1111+
if (defined(queryObject.src)) {
10971112
var gistDemo = {
10981113
name : 'Gist Import',
10991114
code : demo.code,
11001115
description: 'Code imported from GitHub Gist'
11011116
};
11021117
if (demo.name === queryObject.src.replace('.html', '')) {
11031118
loadFromGallery(demo).then(function() {
1104-
if (Cesium.defined(queryObject.gistId)) {
1119+
if (defined(queryObject.gistId)) {
11051120
window.history.replaceState(gistDemo, gistDemo.name, '?src=Hello World.html&label=' + queryObject.label + '&gist=' + queryObject.gistId);
11061121
document.title = 'Gist Import - Cesium Sandcastle';
11071122
} else {
@@ -1126,7 +1141,7 @@ require({
11261141

11271142
var loading = true;
11281143
function setSubtab(tabName) {
1129-
currentTab = Cesium.defined(tabName) && !loading ? tabName : queryObject.label;
1144+
currentTab = defined(tabName) && !loading ? tabName : queryObject.label;
11301145
queryObject.label = tabName;
11311146
loading = false;
11321147
}
@@ -1178,7 +1193,7 @@ require({
11781193

11791194
function createGalleryButton(demo, tabName) {
11801195
var imgSrc = 'templates/Gallery_tile.jpg';
1181-
if (Cesium.defined(demo.img)) {
1196+
if (defined(demo.img)) {
11821197
imgSrc = 'gallery/' + demo.img;
11831198
}
11841199

@@ -1231,7 +1246,7 @@ require({
12311246
}
12321247

12331248
var promise;
1234-
if (!Cesium.defined(gallery_demos)) {
1249+
if (!defined(gallery_demos)) {
12351250
galleryErrorMsg.textContent = 'No demos found, please run the build script.';
12361251
galleryErrorMsg.style.display = 'inline-block';
12371252
} else {

Apps/Sandcastle/gallery/3D Models Coloring.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
viewer.entities.removeAll();
173173

174174
var position = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, height);
175-
var heading = Cesium.Math.toRadians(135);
175+
var heading = -Cesium.Math.toRadians(135);
176176
var pitch = 0;
177177
var roll = 0;
178178
var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);

Apps/Sandcastle/gallery/Classification.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
var center = new Cesium.Cartesian3(1216378.730451297, -4736275.917774027, 4081266.871000864);
5858
var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(center);
59-
var hprRotation = Cesium.Matrix3.fromHeadingPitchRoll(new Cesium.HeadingPitchRoll(2.619728786416368, 0.0, 0.0));
59+
var hprRotation = Cesium.Matrix3.fromHeadingPitchRoll(new Cesium.HeadingPitchRoll(-2.619728786416368, 0.0, 0.0));
6060
var hpr = Cesium.Matrix4.fromRotationTranslation(hprRotation, new Cesium.Cartesian3(0.0, 0.0, -2.0));
6161
Cesium.Matrix4.multiply(modelMatrix, hpr, modelMatrix);
6262

@@ -91,7 +91,7 @@
9191

9292
var center = new Cesium.Cartesian3(1216398.6054139996, -4736204.533089285, 4081338.6585485404);
9393
var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(center);
94-
var hprRotation = Cesium.Matrix3.fromHeadingPitchRoll(new Cesium.HeadingPitchRoll(5.785339046755887, 0.0, 0.0));
94+
var hprRotation = Cesium.Matrix3.fromHeadingPitchRoll(new Cesium.HeadingPitchRoll(-5.785339046755887, 0.0, 0.0));
9595
var hpr = Cesium.Matrix4.fromRotationTranslation(hprRotation, new Cesium.Cartesian3(0.4, 0.0, -2.0));
9696
Cesium.Matrix4.multiply(modelMatrix, hpr, modelMatrix);
9797

@@ -111,7 +111,7 @@
111111

112112
center = new Cesium.Cartesian3(1216394.3346955755, -4736207.431365568, 4081336.7768881875);
113113
modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(center);
114-
hprRotation = Cesium.Matrix3.fromHeadingPitchRoll(new Cesium.HeadingPitchRoll(5.785339046755887, 0.0, 0.0));
114+
hprRotation = Cesium.Matrix3.fromHeadingPitchRoll(new Cesium.HeadingPitchRoll(-5.785339046755887, 0.0, 0.0));
115115
hpr = Cesium.Matrix4.fromRotationTranslation(hprRotation, new Cesium.Cartesian3(-0.25, 0.0, -2.0));
116116
Cesium.Matrix4.multiply(modelMatrix, hpr, modelMatrix);
117117

Apps/Sandcastle/gallery/Distance Display Conditions.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
var position = Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883, 0.0);
5656
var heading = Cesium.Math.toRadians(135);
57-
var hpr = new Cesium.HeadingPitchRoll(heading, 0.0, 0.0);
57+
var hpr = new Cesium.HeadingPitchRoll(-heading, 0.0, 0.0);
5858
var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr);
5959

6060
viewer.entities.add({

Apps/Sandcastle/gallery/Projection.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
viewer.projectionPicker.viewModel.switchToOrthographic();
3737

3838
var position = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, 0.0);
39-
var hpr = new Cesium.HeadingPitchRoll(Cesium.Math.toRadians(135), 0.0, 0.0);
39+
var hpr = new Cesium.HeadingPitchRoll(-Cesium.Math.toRadians(135), 0.0, 0.0);
4040
var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr);
4141

4242
var entity = viewer.entities.add({

Apps/Sandcastle/gallery/development/3D Models.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@
123123

124124
function createModel(url, height, heading, pitch, roll) {
125125
height = Cesium.defaultValue(height, 0.0);
126-
heading = Cesium.defaultValue(heading, 0.0);
127-
pitch = Cesium.defaultValue(pitch, 0.0);
126+
heading = -Cesium.defaultValue(heading, 0.0);
127+
pitch = -Cesium.defaultValue(pitch, 0.0);
128128
roll = Cesium.defaultValue(roll, 0.0);
129129
var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
130130

Apps/Sandcastle/index.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
<script src="jsHintOptions.js"></script>
2222
<script src="gallery/gallery-index.js"></script>
2323
<script src="CesiumSandcastle.js"></script>
24-
<!-- The next three lines are for autocomplete -->
24+
<!-- Needed for autocomplete -->
2525
<link rel="stylesheet" href="../../ThirdParty/codemirror-4.6/addon/hint/show-hint.css">
2626
<!-- End of autocomplete -->
2727
<meta property="og:title" content="Cesium Sandcastle" />
2828
<meta property="og:description" content="The Cesium Sandcastle provides an interactive environment for testing Cesium code." />
2929
<meta property="og:type" content="website" />
30-
<meta property="og:url" content="http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html" />
31-
<meta property="og:image" content="http://cesiumjs.org/images/Sandcastle.png" />
30+
<meta property="og:url" content="https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/index.html" />
31+
<meta property="og:image" content="https://cesiumjs.org/images/Sandcastle.png" />
3232
<meta property="og:site_name" content="Cesium" />
3333
<meta property="fb:admins" content="1222088662,1322006496" />
3434
</head>

Apps/Sandcastle/templates/bucket-requirejs.html

+6-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
<script type="text/javascript" src="../Sandcastle-header.js"></script>
99
<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.20/require.js"></script>
1010
<script type="text/javascript">
11-
require.config({
12-
baseUrl : '../../../Source',
13-
waitSeconds : 60
14-
});
11+
if(typeof require === "function") {
12+
require.config({
13+
baseUrl : '../../../Source',
14+
waitSeconds : 120
15+
});
16+
}
1517
</script>
1618
</head>
1719
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">

0 commit comments

Comments
 (0)