Skip to content

Commit

Permalink
Merge branch 'master' into model-color
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Nov 25, 2016
2 parents d1d09f9 + 00cee6b commit f8d2ac1
Show file tree
Hide file tree
Showing 213 changed files with 1,133 additions and 1,340 deletions.
13 changes: 0 additions & 13 deletions .idea/misc.xml

This file was deleted.

1 change: 0 additions & 1 deletion .npmignore
Expand Up @@ -19,7 +19,6 @@
/index.release.html
/Instrumented
/launches
/logo.png
/server.js
/Source/copyrightHeader.js
/Source/main.js
Expand Down
2 changes: 0 additions & 2 deletions Apps/CesiumViewer/CesiumViewer.js
Expand Up @@ -3,7 +3,6 @@ define([
'Cesium/Core/Cartesian3',
'Cesium/Core/defined',
'Cesium/Core/formatError',
'Cesium/Core/getFilenameFromUri',
'Cesium/Core/Math',
'Cesium/Core/objectToQuery',
'Cesium/Core/queryToObject',
Expand All @@ -19,7 +18,6 @@ define([
Cartesian3,
defined,
formatError,
getFilenameFromUri,
CesiumMath,
objectToQuery,
queryToObject,
Expand Down
Binary file modified Apps/CesiumViewer/favicon.ico
Binary file not shown.
40 changes: 28 additions & 12 deletions Apps/Sandcastle/CesiumSandcastle.js
Expand Up @@ -160,12 +160,16 @@ require({
var currentTab = '';
var newDemo;
var demoHtml = '';
var demoJs = '';
var demoCode = '';
var previousCode = '';
var previousHtml = '';
var runGist = false;
var gistCode;
var gistHtml;
var sandcastleUrl = '';

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>';

var galleryErrorMsg = document.createElement('span');
galleryErrorMsg.className = 'galleryError';
galleryErrorMsg.style.display = 'none';
Expand Down Expand Up @@ -504,7 +508,7 @@ require({
window.onbeforeunload = function (e) {
var htmlText = (htmlEditor.getValue()).replace(/\s/g, '');
var jsText = (jsEditor.getValue()).replace(/\s/g, '');
if (demoHtml !== htmlText || demoJs !== jsText) {
if (demoHtml !== htmlText || demoCode !== jsText) {
return 'Be sure to save a copy of any important edits before leaving this page.';
}
};
Expand Down Expand Up @@ -695,7 +699,7 @@ require({

if (demo.name === 'Gist Import') {
jsEditor.setValue(gistCode);
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>');
htmlEditor.setValue(gistHtml);
document.title = 'Gist Import - Cesium Sandcastle';
CodeMirror.commands.runCesium(jsEditor);
return;
Expand All @@ -719,17 +723,23 @@ require({
}

var scriptCode = scriptMatch[1];
demoJs = scriptCode.replace(/\s/g, '');
demoCode = scriptCode.replace(/\s/g, '');

if (Cesium.defined(queryObject.gistId)) {
Cesium.loadJsonp('https://api.github.com/gists/' + queryObject.gistId + '?access_token=dd8f755c2e5d9bbb26806bb93eaa2291f2047c60')
.then(function(data) {
var files = data.data.files;
var code = files[Object.keys(files)[0]].content;
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
jsEditor.setValue(code);
demoJs = code.replace(/\s/g, '');
htmlEditor.setValue(html);
demoCode = code.replace(/\s/g, '');
demoHtml = html.replace(/\s/g, '');
gistCode = code;
gistHtml = html;
previousCode = code;
previousHtml = html;
sandcastleUrl = Cesium.getBaseUri(window.location.href) + '?src=Hello%20World.html&label=Showcases&gist=' + gistId;
CodeMirror.commands.runCesium(jsEditor);
clearRun();
Expand Down Expand Up @@ -885,17 +895,22 @@ require({
var textArea = document.getElementById('link');
textArea.value = '\n\n';
var code = jsEditor.getValue();
if (code === previousCode) {
var html = htmlEditor.getValue();
if (code === previousCode && html === previousHtml) {
textArea.value = sandcastleUrl;
textArea.select();
return;
}
previousCode = code;
previousHtml = html;
var data = {
public : true,
files : {
'Cesium-Sandcastle.js' : {
content : code
},
'Cesium-Sandcastle.html' : {
content : html
}
}
};
Expand All @@ -915,9 +930,10 @@ require({

registry.byId('buttonImport').on('click', function() {
gistId = document.getElementById("gistId").value;
if (gistId.indexOf('/') !== -1) {
var index = gistId.lastIndexOf('/');
gistId = gistId.substring(index + 1);
var gistParameter = '&gist=';
var gistIndex = gistId.indexOf(gistParameter);
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;
});
Expand All @@ -926,7 +942,7 @@ require({
var htmlText = (htmlEditor.getValue()).replace(/\s/g, '');
var jsText = (jsEditor.getValue()).replace(/\s/g, '');
var confirmChange = true;
if (demoHtml !== htmlText || demoJs !== jsText) {
if (demoHtml !== htmlText || demoCode !== jsText) {
confirmChange = window.confirm('You have unsaved changes. Are you sure you want to navigate away from this demo?');
}
if (confirmChange) {
Expand Down Expand Up @@ -1169,7 +1185,7 @@ require({
var htmlText = (htmlEditor.getValue()).replace(/\s/g, '');
var jsText = (jsEditor.getValue()).replace(/\s/g, '');
var confirmChange = true;
if (demoHtml !== htmlText || demoJs !== jsText) {
if (demoHtml !== htmlText || demoCode !== jsText) {
confirmChange = window.confirm('You have unsaved changes. Are you sure you want to navigate away from this demo?');
}
if (confirmChange) {
Expand Down
24 changes: 24 additions & 0 deletions Apps/Sandcastle/Sandcastle-header.js
Expand Up @@ -26,6 +26,30 @@

document.body.className = document.body.className.replace(/(?:\s|^)sandcastle-loading(?:\s|$)/, ' ');
},
addToggleButton : function(text, checked, onchange, toolbarID) {
window.Sandcastle.declare(onchange);
var input = document.createElement('input');
input.checked = checked;
input.type = 'checkbox';
input.style.pointerEvents = 'none';
var label = document.createElement('label');
label.appendChild(input);
label.appendChild(document.createTextNode(text));
label.style.pointerEvents = 'none';
var button = document.createElement('button');
button.type = 'button';
button.className = 'cesium-button';
button.appendChild(label);

button.onclick = function() {
window.Sandcastle.reset();
window.Sandcastle.highlight(onchange);
input.checked = !input.checked;
onchange(input.checked);
};

document.getElementById(toolbarID || 'toolbar').appendChild(button);
},
addToolbarButton : function(text, onclick, toolbarID) {
window.Sandcastle.declare(onclick);
var button = document.createElement('button');
Expand Down
18 changes: 9 additions & 9 deletions Apps/Sandcastle/gallery/Atmosphere Color.html
Expand Up @@ -56,14 +56,14 @@
</td>
</tr>
</tbody></table>
<div id="toggleLighting"></div>
<div id="toggleFog"></div>
</div>
<script id="cesium_sandcastle_script">
function startup(Cesium) {
'use strict';
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer');
var viewer = new Cesium.Viewer('cesiumContainer', {
sceneModePicker:false
});
var scene = viewer.scene;
var skyAtmosphere = scene.skyAtmosphere;

Expand Down Expand Up @@ -93,13 +93,13 @@
subscribeParameter('saturationShift');
subscribeParameter('brightnessShift');

Sandcastle.addToolbarButton('Toggle Lighting', function() {
scene.globe.enableLighting = !scene.globe.enableLighting;
}, 'toggleLighting');
Sandcastle.addToggleButton('Lighting', scene.globe.enableLighting, function(checked) {
scene.globe.enableLighting = checked;
});

Sandcastle.addToolbarButton('Toggle Fog', function() {
scene.fog.enabled = !scene.fog.enabled;
}, 'toggleFog');
Sandcastle.addToggleButton('Fog', scene.fog.enabled, function(checked) {
scene.fog.enabled = checked;
});

var camera = viewer.camera;
camera.setView({
Expand Down
16 changes: 9 additions & 7 deletions Apps/Sandcastle/gallery/Clustering.html
Expand Up @@ -48,8 +48,6 @@
<input type="text" size="2" data-bind="value: minimumClusterSize">
</td>
</tr>
<tr><td><input type="checkbox" data-bind="checked: enabled"/>Enabled</td></tr>
<tr><td><input type="checkbox" data-bind="checked: customStyle"/>Custom Styling</td></tr>
</tbody>
</table>
</div>
Expand Down Expand Up @@ -124,9 +122,7 @@

var viewModel = {
pixelRange: pixelRange,
minimumClusterSize: minimumClusterSize,
enabled : enabled,
customStyle : true
minimumClusterSize: minimumClusterSize
};
Cesium.knockout.track(viewModel);

Expand All @@ -143,8 +139,14 @@

subscribeParameter('pixelRange');
subscribeParameter('minimumClusterSize');
subscribeParameter('enabled');
Cesium.knockout.getObservable(viewModel, 'customStyle').subscribe(customStyle);

Sandcastle.addToggleButton('Enabled', true, function(checked) {
dataSource.clustering.enabled = checked;
});

Sandcastle.addToggleButton('Custom Styling', true, function(checked) {
customStyle();
});

var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
handler.setInputAction(function(movement) {
Expand Down
17 changes: 8 additions & 9 deletions Apps/Sandcastle/gallery/Shadows.html
Expand Up @@ -226,26 +226,25 @@

Sandcastle.addToolbarMenu(entityToolbarOptions);

Sandcastle.addToolbarButton('Toggle Shadows', function() {
viewer.shadows = !viewer.shadows;
Sandcastle.addToggleButton('Shadows', viewer.shadows, function(checked) {
viewer.shadows = checked;
});

var entityShadows = Cesium.ShadowMode.ENABLED;
Sandcastle.addToolbarButton('Toggle Entity Shadows', function() {
entityShadows = (entityShadows === Cesium.ShadowMode.ENABLED) ? Cesium.ShadowMode.DISABLED : Cesium.ShadowMode.ENABLED;
Sandcastle.addToggleButton('Entity Shadows', true, function(checked) {
var entityShadows = checked ? Cesium.ShadowMode.ENABLED : Cesium.ShadowMode.DISABLED;
for (i = 0; i < entitiesLength; ++i) {
var entity = entities[i];
var visual = entity.model || entity.box || entity.ellipsoid;
visual.shadows = entityShadows;
}
});

Sandcastle.addToolbarButton('Toggle Terrain Shadows', function() {
viewer.terrainShadows = (viewer.terrainShadows === Cesium.ShadowMode.ENABLED) ? Cesium.ShadowMode.DISABLED : Cesium.ShadowMode.ENABLED;
Sandcastle.addToggleButton('Terrain Shadows', viewer.terrainShadows === Cesium.ShadowMode.ENABLED, function(checked) {
viewer.terrainShadows = checked ? Cesium.ShadowMode.ENABLED : Cesium.ShadowMode.DISABLED;
});

Sandcastle.addToolbarButton('Soft Shadows', function() {
shadowMap.softShadows = !shadowMap.softShadows;
Sandcastle.addToggleButton('Soft Shadows', shadowMap.softShadows, function(checked) {
shadowMap.softShadows = checked;
});

Sandcastle.addToolbarMenu([{
Expand Down
42 changes: 19 additions & 23 deletions Apps/Sandcastle/gallery/Terrain.html
Expand Up @@ -25,21 +25,17 @@
<div id="toolbar">
<div id="terrainMenu"></div>
<div id="zoomButtons"></div>
<div id="toggleLighting"></div>
<div id="sampleButtons"></div>
<table><tbody>
<tr>
<td>Enable fog</td>
<td><input type="checkbox" data-bind="checked: fogEnabled"/></td>
</tr>
</tbody></table>
</div>
<script id="cesium_sandcastle_script">
function startup(Cesium) {
'use strict';
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer');

// set lighting to true
viewer.scene.globe.enableLighting = true;

var cesiumTerrainProviderMeshes = new Cesium.CesiumTerrainProvider({
url : 'https://assets.agi.com/stk-terrain/world',
requestWaterMask : true,
Expand Down Expand Up @@ -100,10 +96,7 @@
Sandcastle.addDefaultToolbarMenu([{
text : 'Mount Everest',
onselect : function() {
var target = new Cesium.Cartesian3(300770.50872389384, 5634912.131394585, 2978152.2865545116);
var offset = new Cesium.Cartesian3(6344.974098678562, -793.3419798081741, 2499.9508860763162);
viewer.camera.lookAt(target, offset);
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
lookAtMtEverest();
}
}, {
text : 'Half Dome',
Expand All @@ -125,6 +118,13 @@

var terrainSamplePositions;

function lookAtMtEverest() {
var target = new Cesium.Cartesian3(300770.50872389384, 5634912.131394585, 2978152.2865545116);
var offset = new Cesium.Cartesian3(6344.974098678562, -793.3419798081741, 2499.9508860763162);
viewer.camera.lookAt(target, offset);
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
}

function sampleTerrainSuccess() {
var ellipsoid = Cesium.Ellipsoid.WGS84;

Expand Down Expand Up @@ -159,10 +159,13 @@
viewer.entities.resumeEvents();
}

Sandcastle.addToolbarButton('Toggle Lighting', function() {
viewer.scene.globe.enableLighting = !viewer.scene.globe.enableLighting;
}, 'toggleLighting');
Sandcastle.addToggleButton('Enable Lighting', viewer.scene.globe.enableLighting, function(checked) {
viewer.scene.globe.enableLighting = checked;
});

Sandcastle.addToggleButton('Enable fog', viewer.scene.fog.enabled, function(checked) {
viewer.scene.fog.enabled = checked;
});

Sandcastle.addToolbarButton('Sample Everest Terrain', function() {
var gridWidth = 41;
Expand All @@ -182,17 +185,10 @@
}

Cesium.when(Cesium.sampleTerrain(viewer.terrainProvider, 9, terrainSamplePositions), sampleTerrainSuccess);
}, 'sampleButtons');

var viewModel = { fogEnabled : true };
Cesium.knockout.track(viewModel);
lookAtMtEverest();
}, 'sampleButtons');

var toolbar = document.getElementById('toolbar');
Cesium.knockout.applyBindings(viewModel, toolbar);
Cesium.knockout.getObservable(viewModel, 'fogEnabled').subscribe(function(newValue) {
viewer.scene.fog.enabled = newValue;
});
viewModel.enabled = viewer.scene.fog.enabled;
//Sandcastle_End
Sandcastle.finishedLoading();
}
Expand Down

0 comments on commit f8d2ac1

Please sign in to comment.