Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Bernstein committed Oct 23, 2017
2 parents 35d690f + 4414fc4 commit 9758800
Show file tree
Hide file tree
Showing 127 changed files with 4,954 additions and 3,498 deletions.
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Auto detect text files and perform LF normalization
* text=auto
* text=auto
package.json text eol=lf
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Thumbs.db
/node_modules
npm-debug.log
npm-debug.log.*
package-lock.json

# WebStorm user-specific
.idea/workspace.xml
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- "6"
- "8"
sudo: false
before_script:
- export DISPLAY=:99.0
Expand Down
81 changes: 48 additions & 33 deletions Apps/Sandcastle/CesiumSandcastle.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ require({
}, {
name : 'Source',
location : '.'
}, {
name: 'CesiumUnminified',
location : '../Build/CesiumUnminified',
main: 'Cesium'
}, {
name : 'CodeMirror',
location : '../ThirdParty/codemirror-4.6'
Expand Down Expand Up @@ -43,6 +47,10 @@ require({
'dojo/query',
'dojo/when',
'Sandcastle/LinkButton',
'Source/Core/defined',
'Source/Core/getBaseUri',
'Source/Core/loadJsonp',
'Source/Core/loadWithXhr',
'Source/Cesium',
'CodeMirror/addon/hint/show-hint',
'CodeMirror/addon/hint/javascript-hint',
Expand Down Expand Up @@ -86,11 +94,18 @@ require({
query,
when,
LinkButton,
Cesium) {
defined,
getBaseUri,
loadJsonp,
loadWithXhr,
Cesium
) {
'use strict';

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

parser.parse();

Expand Down Expand Up @@ -214,7 +229,7 @@ require({
}

function openDocTab(title, link) {
if (!Cesium.defined(docTabs[title])) {
if (!defined(docTabs[title])) {
docTabs[title] = new ContentPane({
title : title,
focused : true,
Expand Down Expand Up @@ -271,7 +286,7 @@ require({

function onCursorActivity() {
docNode.style.left = '-999px';
if (Cesium.defined(docTimer)) {
if (defined(docTimer)) {
window.clearTimeout(docTimer);
}
docTimer = window.setTimeout(showDocPopup, 500);
Expand All @@ -295,7 +310,7 @@ require({
}

function closeGalleryTooltip() {
if (Cesium.defined(activeGalleryTooltipDemo)) {
if (defined(activeGalleryTooltipDemo)) {
popup.close(demoTooltips[activeGalleryTooltipDemo.name]);
activeGalleryTooltipDemo = undefined;
}
Expand All @@ -312,7 +327,7 @@ require({
suffix = 'searchDemo';
}

if (Cesium.defined(activeGalleryTooltipDemo)) {
if (defined(activeGalleryTooltipDemo)) {
popup.open({
popup : demoTooltips[activeGalleryTooltipDemo.name],
around : dom.byId(activeGalleryTooltipDemo.name + suffix),
Expand All @@ -324,7 +339,7 @@ require({
function scheduleGalleryTooltip(demo) {
if (demo !== activeGalleryTooltipDemo) {
activeGalleryTooltipDemo = demo;
if (Cesium.defined(galleryTooltipTimer)) {
if (defined(galleryTooltipTimer)) {
window.clearTimeout(galleryTooltipTimer);
}
galleryTooltipTimer = window.setTimeout(openGalleryTooltip, 220);
Expand Down Expand Up @@ -372,7 +387,7 @@ require({
var hints = JSHINT.errors;
for (i = 0, len = hints.length; i < len; ++i) {
var hint = hints[i];
if (hint !== null && Cesium.defined(hint.reason) && hint.line > 0) {
if (hint !== null && defined(hint.reason) && hint.line > 0) {
line = jsEditor.setGutterMarker(scriptLineToEditorLine(hint.line), 'hintGutter', makeLineLabel(hint.reason, 'hintMarker'));
jsEditor.addLineClass(line, 'text', 'hintLine');
errorLines.push(line);
Expand All @@ -383,22 +398,22 @@ require({
}

function scheduleHint() {
if (Cesium.defined(hintTimer)) {
if (defined(hintTimer)) {
window.clearTimeout(hintTimer);
}
hintTimer = setTimeout(clearErrorsAddHints, 550);
highlightRun();
}

function scheduleHintNoChange() {
if (Cesium.defined(hintTimer)) {
if (defined(hintTimer)) {
window.clearTimeout(hintTimer);
}
hintTimer = setTimeout(clearErrorsAddHints, 550);
}

function scrollToLine(lineNumber) {
if (Cesium.defined(lineNumber)) {
if (defined(lineNumber)) {
jsEditor.setCursor(lineNumber);
// set selection twice in order to force the editor to scroll
// to this location if the cursor is already there
Expand Down Expand Up @@ -457,13 +472,13 @@ require({
function registerScroll(demoContainer) {
if (document.onmousewheel !== undefined) {
demoContainer.addEventListener('mousewheel', function(e) {
if (Cesium.defined(e.wheelDelta) && e.wheelDelta) {
if (defined(e.wheelDelta) && e.wheelDelta) {
demoContainer.scrollLeft -= e.wheelDelta * 70 / 120;
}
}, false);
} else {
demoContainer.addEventListener('DOMMouseScroll', function(e) {
if (Cesium.defined(e.detail) && e.detail) {
if (defined(e.detail) && e.detail) {
demoContainer.scrollLeft += e.detail * 70 / 3;
}
}, false);
Expand Down Expand Up @@ -662,7 +677,7 @@ require({
function loadBucket(bucketName) {
if (local.bucketName !== bucketName) {
local.bucketName = bucketName;
if (Cesium.defined(bucketTypes[bucketName])) {
if (defined(bucketTypes[bucketName])) {
local.headers = bucketTypes[bucketName];
} else {
local.headers = '<html><head></head><body data-sandcastle-bucket-loaded="no">';
Expand All @@ -686,13 +701,13 @@ require({
var gistId = ioQuery.queryToObject(window.location.search.substring(1)).gist;
if (window.location.search) {
queryObject = ioQuery.queryToObject(window.location.search.substring(1));
if (Cesium.defined(gistId)) {
if (defined(gistId)) {
queryObject.gistId = gistId;
}
} else {
queryObject.src = 'Hello World.html';
queryObject.label = 'Showcases';
if (Cesium.defined(gistId)) {
if (defined(gistId)) {
queryObject.gistId = gistId;
}
}
Expand Down Expand Up @@ -731,13 +746,13 @@ require({
var scriptCode = scriptMatch[1];
demoCode = scriptCode.replace(/\s/g, '');

if (Cesium.defined(queryObject.gistId)) {
Cesium.loadJsonp('https://api.github.com/gists/' + queryObject.gistId + '?access_token=dd8f755c2e5d9bbb26806bb93eaa2291f2047c60')
if (defined(queryObject.gistId)) {
loadJsonp('https://api.github.com/gists/' + queryObject.gistId + '?access_token=dd8f755c2e5d9bbb26806bb93eaa2291f2047c60')
.then(function(data) {
var files = data.data.files;
var code = files['Cesium-Sandcastle.js'].content;
var htmlFile = files['Cesium-Sandcastle.html'];
var html = Cesium.defined(htmlFile) ? htmlFile.content : defaultHtml; // Use the default html for old gists
var html = defined(htmlFile) ? htmlFile.content : defaultHtml; // Use the default html for old gists
jsEditor.setValue(code);
htmlEditor.setValue(html);
demoCode = code.replace(/\s/g, '');
Expand All @@ -746,7 +761,7 @@ require({
gistHtml = html;
previousCode = code;
previousHtml = html;
sandcastleUrl = Cesium.getBaseUri(window.location.href) + '?src=Hello%20World.html&label=Showcases&gist=' + gistId;
sandcastleUrl = getBaseUri(window.location.href) + '?src=Hello%20World.html&label=Showcases&gist=' + gistId;
CodeMirror.commands.runCesium(jsEditor);
clearRun();
}).otherwise(function(error) {
Expand Down Expand Up @@ -813,14 +828,14 @@ require({
appendConsole('consoleLog', 'Unable to load demo named ' + queryObject.src.replace('.html', '') + '. Redirecting to HelloWorld.\n', true);
}
}
} else if (Cesium.defined(e.data.log)) {
} else if (defined(e.data.log)) {
// Console log messages from the iframe display in Sandcastle.
appendConsole('consoleLog', e.data.log, false);
} else if (Cesium.defined(e.data.error)) {
} else if (defined(e.data.error)) {
// Console error messages from the iframe display in Sandcastle
var errorMsg = e.data.error;
var lineNumber = e.data.lineNumber;
if (Cesium.defined(lineNumber)) {
if (defined(lineNumber)) {
errorMsg += ' (on line ';

if (e.data.url) {
Expand All @@ -835,10 +850,10 @@ require({
}
}
appendConsole('consoleError', errorMsg, true);
} else if (Cesium.defined(e.data.warn)) {
} else if (defined(e.data.warn)) {
// Console warning messages from the iframe display in Sandcastle.
appendConsole('consoleWarn', e.data.warn, true);
} else if (Cesium.defined(e.data.highlight)) {
} else if (defined(e.data.highlight)) {
// Hovering objects in the embedded Cesium window.
highlightLine(e.data.highlight);
}
Expand Down Expand Up @@ -925,12 +940,12 @@ require({
}
}
};
return Cesium.loadWithXhr({
return loadWithXhr({
url : 'https://api.github.com/gists',
data : JSON.stringify(data),
method : 'POST'
}).then(function(content) {
sandcastleUrl = Cesium.getBaseUri(window.location.href) + '?src=Hello%20World.html&label=Showcases&gist=' + JSON.parse(content).id;
sandcastleUrl = getBaseUri(window.location.href) + '?src=Hello%20World.html&label=Showcases&gist=' + JSON.parse(content).id;
textArea.value = sandcastleUrl;
textArea.select();
}).otherwise(function(error) {
Expand All @@ -946,7 +961,7 @@ require({
if (gistIndex !== -1) {
gistId = gistId.substring(gistIndex + gistParameter.length);
}
window.location.href = Cesium.getBaseUri(window.location.href) + '?src=Hello%20World.html&label=Showcases&gist=' + gistId;
window.location.href = getBaseUri(window.location.href) + '?src=Hello%20World.html&label=Showcases&gist=' + gistId;
});

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

// Select the demo to load upon opening based on the query parameter.
if (Cesium.defined(queryObject.src)) {
if (defined(queryObject.src)) {
var gistDemo = {
name : 'Gist Import',
code : demo.code,
description: 'Code imported from GitHub Gist'
};
if (demo.name === queryObject.src.replace('.html', '')) {
loadFromGallery(demo).then(function() {
if (Cesium.defined(queryObject.gistId)) {
if (defined(queryObject.gistId)) {
window.history.replaceState(gistDemo, gistDemo.name, '?src=Hello World.html&label=' + queryObject.label + '&gist=' + queryObject.gistId);
document.title = 'Gist Import - Cesium Sandcastle';
} else {
Expand All @@ -1126,7 +1141,7 @@ require({

var loading = true;
function setSubtab(tabName) {
currentTab = Cesium.defined(tabName) && !loading ? tabName : queryObject.label;
currentTab = defined(tabName) && !loading ? tabName : queryObject.label;
queryObject.label = tabName;
loading = false;
}
Expand Down Expand Up @@ -1178,7 +1193,7 @@ require({

function createGalleryButton(demo, tabName) {
var imgSrc = 'templates/Gallery_tile.jpg';
if (Cesium.defined(demo.img)) {
if (defined(demo.img)) {
imgSrc = 'gallery/' + demo.img;
}

Expand Down Expand Up @@ -1231,7 +1246,7 @@ require({
}

var promise;
if (!Cesium.defined(gallery_demos)) {
if (!defined(gallery_demos)) {
galleryErrorMsg.textContent = 'No demos found, please run the build script.';
galleryErrorMsg.style.display = 'inline-block';
} else {
Expand Down
31 changes: 17 additions & 14 deletions Apps/Sandcastle/gallery/CZML Reference Properties.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.20/require.js"></script>
<script type="text/javascript">
require.config({
baseUrl : '../../../Source',
waitSeconds : 60
});
if(typeof require === "function") {
require.config({
baseUrl : '../../../Source',
waitSeconds : 120
});
}
</script>
</head>
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
Expand All @@ -38,7 +40,7 @@
"cartographicDegrees" : [-110.0, 50.0, 0]
}
}, {
"id" : "outlineColor-reference",
"id" : "fillColor-reference",
"name" : "Referencing Position",
"description" : "<p>For more examples of reference properties, see CZML Polygon - Interpolating References.</p>",
"billboard" : {
Expand All @@ -62,11 +64,11 @@
"text" : "referencing position"
},
"position" : {
"reference" : "position-reference#position"
"reference" : "position-reference#position"
}
}, {
"id" : "polygon",
"name" : "Referencing Outline Color",
"name" : "Referencing Fill Color",
"description" : "<p>For more examples of reference properties, see CZML Polygon - Interpolating References.</p>",
"label" : {
"fillColor" : {
Expand All @@ -78,7 +80,7 @@
"cartesian2" : [20, 0]
},
"style" : "FILL_AND_OUTLINE",
"text" : "referencing outlineColor"
"text" : "referencing fillColor"
},
"position" : {
"cartographicDegrees" : [-105, 35, 0]
Expand All @@ -94,17 +96,18 @@
]
},
"height" : 0,
"outline" : true,
"outlineColor" : {
"reference" : "outlineColor-reference#label.outlineColor"
},
"outlineWidth" : 5
"material" : {
"solidColor" : {
"color" : {
"reference" : "fillColor-reference#label.outlineColor"
}
}
}
}
}];

var viewer = new Cesium.Viewer('cesiumContainer');
viewer.dataSources.add(Cesium.CzmlDataSource.load(czml));

//Sandcastle_End
Sandcastle.finishedLoading();
}
Expand Down
Loading

0 comments on commit 9758800

Please sign in to comment.