Skip to content

Commit e960661

Browse files
authored
Merge pull request #2 from AnalyticalGraphicsInc/master
Update from original
2 parents 01d83c8 + aabc2ac commit e960661

File tree

480 files changed

+11719
-2854
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

480 files changed

+11719
-2854
lines changed

.github/ISSUE_TEMPLATE.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Thanks for contributing to the Cesium Community!
2+
3+
If you have a question, please search the forum:
4+
5+
http://cesiumjs.org/forum.html
6+
7+
and start a new forum thread, if needed, instead of creating this issue.
8+
9+
Otherwise, we look forward to your bug report or feature request in this issue.
10+
11+
---
12+
13+
Delete this message before clicking Submit.

.idea/cesium.iml

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/jsLibraryMappings.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/libraries/cesium_node_modules.xml

-14
This file was deleted.

.npmignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/.externalToolBuilders
22
/.gitattributes
3+
/.github
34
/.idea
45
/.metadata
56
/.npmignore
@@ -18,7 +19,6 @@
1819
/index.release.html
1920
/Instrumented
2021
/launches
21-
/logo.png
2222
/server.js
2323
/Source/copyrightHeader.js
2424
/Source/main.js

Apps/CesiumViewer/CesiumViewer.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ body {
3838
background-position: center;
3939
background-repeat: no-repeat;
4040
background-image: url(Images/ajax-loader.gif);
41-
}
41+
}

Apps/CesiumViewer/CesiumViewerStartup.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ require({
88
}, [
99
'CesiumViewer'
1010
], function() {
11-
});
11+
});

Apps/CesiumViewer/favicon.ico

0 Bytes
Binary file not shown.

Apps/CesiumViewer/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
<div id="cesiumContainer" class="fullWindow"></div>
1717
<div id="loadingIndicator" class="loadingIndicator"></div>
1818
</body>
19-
</html>
19+
</html>

Apps/HelloWorld.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
var viewer = new Cesium.Viewer('cesiumContainer');
2323
</script>
2424
</body>
25-
</html>
25+
</html>

Apps/Sandcastle/CesiumSandcastle.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,4 +267,4 @@ a.linkButton:focus, a.linkButton:hover {
267267
width: 16px;
268268
height: 16px;
269269
text-align: center;
270-
}
270+
}

Apps/Sandcastle/CesiumSandcastle.js

+61-42
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,16 @@ require({
160160
var currentTab = '';
161161
var newDemo;
162162
var demoHtml = '';
163-
var demoJs = '';
163+
var demoCode = '';
164164
var previousCode = '';
165+
var previousHtml = '';
165166
var runGist = false;
166167
var gistCode;
168+
var gistHtml;
167169
var sandcastleUrl = '';
168170

171+
var defaultHtml = '<style>\n@import url(../templates/bucket.css);\n</style>\n<div id=\"cesiumContainer\" class=\"fullSize\"></div>\n<div id=\"loadingOverlay\"><h1>Loading...</h1></div>\n<div id=\"toolbar\"></div>';
172+
169173
var galleryErrorMsg = document.createElement('span');
170174
galleryErrorMsg.className = 'galleryError';
171175
galleryErrorMsg.style.display = 'none';
@@ -504,7 +508,7 @@ require({
504508
window.onbeforeunload = function (e) {
505509
var htmlText = (htmlEditor.getValue()).replace(/\s/g, '');
506510
var jsText = (jsEditor.getValue()).replace(/\s/g, '');
507-
if (demoHtml !== htmlText || demoJs !== jsText) {
511+
if (demoHtml !== htmlText || demoCode !== jsText) {
508512
return 'Be sure to save a copy of any important edits before leaving this page.';
509513
}
510514
};
@@ -695,7 +699,7 @@ require({
695699

696700
if (demo.name === 'Gist Import') {
697701
jsEditor.setValue(gistCode);
698-
htmlEditor.setValue('<style>\n@import url(../templates/bucket.css);\n</style>\n<div id=\"cesiumContainer\" class=\"fullSize\"></div>\n<div id=\"loadingOverlay\"><h1>Loading...</h1></div>\n<div id=\"toolbar\"></div>');
702+
htmlEditor.setValue(gistHtml);
699703
document.title = 'Gist Import - Cesium Sandcastle';
700704
CodeMirror.commands.runCesium(jsEditor);
701705
return;
@@ -719,17 +723,23 @@ require({
719723
}
720724

721725
var scriptCode = scriptMatch[1];
722-
demoJs = scriptCode.replace(/\s/g, '');
726+
demoCode = scriptCode.replace(/\s/g, '');
723727

724728
if (Cesium.defined(queryObject.gistId)) {
725729
Cesium.loadJsonp('https://api.github.com/gists/' + queryObject.gistId + '?access_token=dd8f755c2e5d9bbb26806bb93eaa2291f2047c60')
726730
.then(function(data) {
727731
var files = data.data.files;
728-
var code = files[Object.keys(files)[0]].content;
732+
var code = files['Cesium-Sandcastle.js'].content;
733+
var htmlFile = files['Cesium-Sandcastle.html'];
734+
var html = Cesium.defined(htmlFile) ? htmlFile.content : defaultHtml; // Use the default html for old gists
729735
jsEditor.setValue(code);
730-
demoJs = code.replace(/\s/g, '');
736+
htmlEditor.setValue(html);
737+
demoCode = code.replace(/\s/g, '');
738+
demoHtml = html.replace(/\s/g, '');
731739
gistCode = code;
740+
gistHtml = html;
732741
previousCode = code;
742+
previousHtml = html;
733743
sandcastleUrl = Cesium.getBaseUri(window.location.href) + '?src=Hello%20World.html&label=Showcases&gist=' + gistId;
734744
CodeMirror.commands.runCesium(jsEditor);
735745
clearRun();
@@ -885,17 +895,22 @@ require({
885895
var textArea = document.getElementById('link');
886896
textArea.value = '\n\n';
887897
var code = jsEditor.getValue();
888-
if (code === previousCode) {
898+
var html = htmlEditor.getValue();
899+
if (code === previousCode && html === previousHtml) {
889900
textArea.value = sandcastleUrl;
890901
textArea.select();
891902
return;
892903
}
893904
previousCode = code;
905+
previousHtml = html;
894906
var data = {
895907
public : true,
896908
files : {
897909
'Cesium-Sandcastle.js' : {
898910
content : code
911+
},
912+
'Cesium-Sandcastle.html' : {
913+
content : html
899914
}
900915
}
901916
};
@@ -915,9 +930,10 @@ require({
915930

916931
registry.byId('buttonImport').on('click', function() {
917932
gistId = document.getElementById("gistId").value;
918-
if (gistId.indexOf('/') !== -1) {
919-
var index = gistId.lastIndexOf('/');
920-
gistId = gistId.substring(index + 1);
933+
var gistParameter = '&gist=';
934+
var gistIndex = gistId.indexOf(gistParameter);
935+
if (gistIndex !== -1) {
936+
gistId = gistId.substring(gistIndex + gistParameter.length);
921937
}
922938
window.location.href = Cesium.getBaseUri(window.location.href) + '?src=Hello%20World.html&label=Showcases&gist=' + gistId;
923939
});
@@ -926,7 +942,7 @@ require({
926942
var htmlText = (htmlEditor.getValue()).replace(/\s/g, '');
927943
var jsText = (jsEditor.getValue()).replace(/\s/g, '');
928944
var confirmChange = true;
929-
if (demoHtml !== htmlText || demoJs !== jsText) {
945+
if (demoHtml !== htmlText || demoCode !== jsText) {
930946
confirmChange = window.confirm('You have unsaved changes. Are you sure you want to navigate away from this demo?');
931947
}
932948
if (confirmChange) {
@@ -1044,9 +1060,7 @@ require({
10441060
});
10451061
}
10461062

1047-
function loadDemoFromFile(index) {
1048-
var demo = gallery_demos[index];
1049-
1063+
function loadDemoFromFile(demo) {
10501064
return requestDemo(demo.name).then(function(value) {
10511065
// Store the file contents for later searching.
10521066
demo.code = value;
@@ -1092,7 +1106,7 @@ require({
10921106
content : demo.description.replace(/\\n/g, '<br/>')
10931107
});
10941108

1095-
addFileToTab(index);
1109+
addFileToTab(demo);
10961110
return demo;
10971111
});
10981112
}
@@ -1104,10 +1118,21 @@ require({
11041118
loading = false;
11051119
}
11061120

1107-
function addFileToGallery(index) {
1121+
function insertSortedById(parentTab, galleryButton) {
1122+
var child;
1123+
for (child = parentTab.lastChild; child !== null; child = child.previousSibling) {
1124+
if (galleryButton.id >= child.id) {
1125+
parentTab.insertBefore(galleryButton, child.nextSibling);
1126+
return;
1127+
}
1128+
}
1129+
parentTab.appendChild(galleryButton);
1130+
}
1131+
1132+
function addFileToGallery(demo) {
11081133
var searchDemos = dom.byId('searchDemos');
1109-
createGalleryButton(index, searchDemos, 'searchDemo');
1110-
return loadDemoFromFile(index);
1134+
insertSortedById(searchDemos, createGalleryButton(demo, 'searchDemo'));
1135+
return loadDemoFromFile(demo);
11111136
}
11121137

11131138
function onShowCallback() {
@@ -1116,8 +1141,7 @@ require({
11161141
};
11171142
}
11181143

1119-
function addFileToTab(index) {
1120-
var demo = gallery_demos[index];
1144+
function addFileToTab(demo) {
11211145
if (demo.label !== '') {
11221146
var labels = demo.label.split(',');
11231147
for (var j = 0; j < labels.length; j++) {
@@ -1134,13 +1158,12 @@ require({
11341158
}
11351159
var tabName = label + 'Demos';
11361160
var tab = dom.byId(tabName);
1137-
createGalleryButton(index, tab, tabName);
1161+
insertSortedById(tab, createGalleryButton(demo, tabName));
11381162
}
11391163
}
11401164
}
11411165

1142-
function createGalleryButton(index, tab, tabName) {
1143-
var demo = gallery_demos[index];
1166+
function createGalleryButton(demo, tabName) {
11441167
var imgSrc = 'templates/Gallery_tile.jpg';
11451168
if (Cesium.defined(demo.img)) {
11461169
imgSrc = 'gallery/' + demo.img;
@@ -1150,7 +1173,6 @@ require({
11501173
demoLink.id = demo.name + tabName;
11511174
demoLink.className = 'linkButton';
11521175
demoLink.href = 'gallery/' + encodeURIComponent(demo.name) + '.html';
1153-
tab.appendChild(demoLink);
11541176

11551177
if (demo.name === "Hello World") {
11561178
newDemo = demo;
@@ -1163,7 +1185,7 @@ require({
11631185
var htmlText = (htmlEditor.getValue()).replace(/\s/g, '');
11641186
var jsText = (jsEditor.getValue()).replace(/\s/g, '');
11651187
var confirmChange = true;
1166-
if (demoHtml !== htmlText || demoJs !== jsText) {
1188+
if (demoHtml !== htmlText || demoCode !== jsText) {
11671189
confirmChange = window.confirm('You have unsaved changes. Are you sure you want to navigate away from this demo?');
11681190
}
11691191
if (confirmChange) {
@@ -1184,13 +1206,15 @@ require({
11841206
'<img src="' + imgSrc + '" class="demoTileThumbnail" alt="" onDragStart="return false;" />'
11851207
}).placeAt(demoLink);
11861208

1187-
on(dom.byId(demoLink.id), 'mouseover', function() {
1209+
on(demoLink, 'mouseover', function() {
11881210
scheduleGalleryTooltip(demo);
11891211
});
11901212

1191-
on(dom.byId(demoLink.id), 'mouseout', function() {
1213+
on(demoLink, 'mouseout', function() {
11921214
closeGalleryTooltip();
11931215
});
1216+
1217+
return demoLink;
11941218
}
11951219

11961220
var promise;
@@ -1212,18 +1236,11 @@ require({
12121236
var i;
12131237
var len = gallery_demos.length;
12141238

1215-
// Sort alphabetically. This will eventually be a user option.
1216-
gallery_demos.sort(function(a, b) {
1217-
var aName = a.name.toUpperCase();
1218-
var bName = b.name.toUpperCase();
1219-
return bName < aName ? 1 : bName > aName ? -1 : 0;
1220-
});
1221-
12221239
var queryInGalleryIndex = false;
12231240
var queryName = queryObject.src.replace('.html', '');
12241241
var promises = [];
12251242
for (i = 0; i < len; ++i) {
1226-
promises.push(addFileToGallery(i));
1243+
promises.push(addFileToGallery(gallery_demos[i]));
12271244
}
12281245

12291246
promise = all(promises).then(function(results) {
@@ -1247,17 +1264,19 @@ require({
12471264

12481265
var demos = dom.byId('allDemos');
12491266
for (i = 0; i < len; ++i) {
1250-
if (!/Development/i.test(gallery_demos[i].label)) {
1251-
createGalleryButton(i, demos, 'all');
1267+
var demo = gallery_demos[i];
1268+
if (!/Development/i.test(demo.label)) {
1269+
insertSortedById(demos, createGalleryButton(demo, 'all'));
12521270
}
12531271
}
12541272

12551273
if (!queryInGalleryIndex) {
1256-
gallery_demos.push({
1257-
name : queryName,
1258-
description : ''
1259-
});
1260-
return addFileToGallery(gallery_demos.length - 1);
1274+
var emptyDemo = {
1275+
name : queryName,
1276+
description : ''
1277+
};
1278+
gallery_demos.push(emptyDemo);
1279+
return addFileToGallery(emptyDemo);
12611280
}
12621281
});
12631282
}

Apps/Sandcastle/LinkButton.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ define([
3232
(this.containerNode || this.focusNode).innerHTML = content;
3333
}
3434
});
35-
});
35+
});

Apps/Sandcastle/Sandcastle-client.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,4 +164,4 @@
164164
'highlight' : 0
165165
}, '*');
166166
};
167-
}());
167+
}());

0 commit comments

Comments
 (0)