Skip to content

Commit

Permalink
Sandcastle demos.
Browse files Browse the repository at this point in the history
  • Loading branch information
mramato committed Nov 16, 2015
1 parent bf9e593 commit 8a4e49f
Show file tree
Hide file tree
Showing 3,301 changed files with 399,674 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
Empty file added .nojekyll
Empty file.
4 changes: 4 additions & 0 deletions Cesium/Apps/.jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "../.jshintrc",
"jasmine": false
}
41 changes: 41 additions & 0 deletions Cesium/Apps/CesiumViewer/CesiumViewer.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
@import url(../../Source/Widgets/widgets.css);
@import url(../../Source/Widgets/lighter.css);

html {
height: 100%;
}

body {
height: 100%;
width: 100%;
margin: 0;
overflow: hidden;
padding: 0;
background: #000;
}

.fullWindow {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
margin: 0;
overflow: hidden;
padding: 0;
font-family: sans-serif;
}

.loadingIndicator {
display: block;
position: absolute;
top: 50%;
left: 50%;
margin-top: -33px;
margin-left: -33px;
width: 66px;
height: 66px;
background-position: center;
background-repeat: no-repeat;
background-image: url(Images/ajax-loader.gif);
}
197 changes: 197 additions & 0 deletions Cesium/Apps/CesiumViewer/CesiumViewer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
/*global define*/
define([
'Cesium/Core/Cartesian3',
'Cesium/Core/defined',
'Cesium/Core/formatError',
'Cesium/Core/getFilenameFromUri',
'Cesium/Core/Math',
'Cesium/Core/objectToQuery',
'Cesium/Core/queryToObject',
'Cesium/DataSources/CzmlDataSource',
'Cesium/DataSources/GeoJsonDataSource',
'Cesium/DataSources/KmlDataSource',
'Cesium/Scene/TileMapServiceImageryProvider',
'Cesium/Widgets/Viewer/Viewer',
'Cesium/Widgets/Viewer/viewerCesiumInspectorMixin',
'Cesium/Widgets/Viewer/viewerDragDropMixin',
'domReady!'
], function(
Cartesian3,
defined,
formatError,
getFilenameFromUri,
CesiumMath,
objectToQuery,
queryToObject,
CzmlDataSource,
GeoJsonDataSource,
KmlDataSource,
TileMapServiceImageryProvider,
Viewer,
viewerCesiumInspectorMixin,
viewerDragDropMixin) {
"use strict";
/*global console*/

/*
* 'debug' : true/false, // Full WebGL error reporting at substantial performance cost.
* 'lookAt' : CZML id, // The CZML ID of the object to track at startup.
* 'source' : 'file.czml', // The relative URL of the CZML file to load at startup.
* 'stats' : true, // Enable the FPS performance display.
* 'theme' : 'lighter', // Use the dark-text-on-light-background theme.
* 'scene3DOnly' : false // Enable 3D only mode
* 'view' : longitude,latitude,[height,heading,pitch,roll]
* // Using degrees and meters
* // [height,heading,pitch,roll] default is looking straight down, [300,0,-90,0]
*/
var endUserOptions = queryToObject(window.location.search.substring(1));

var imageryProvider;
if (endUserOptions.tmsImageryUrl) {
imageryProvider = new TileMapServiceImageryProvider({
url : endUserOptions.tmsImageryUrl
});
}

var loadingIndicator = document.getElementById('loadingIndicator');
var viewer;
try {
viewer = new Viewer('cesiumContainer', {
imageryProvider : imageryProvider,
baseLayerPicker : !defined(imageryProvider),
scene3DOnly : endUserOptions.scene3DOnly
});
} catch (exception) {
loadingIndicator.style.display = 'none';
var message = formatError(exception);
console.error(message);
if (!document.querySelector('.cesium-widget-errorPanel')) {
window.alert(message);
}
return;
}

viewer.extend(viewerDragDropMixin);
if (endUserOptions.inspector) {
viewer.extend(viewerCesiumInspectorMixin);
}

var showLoadError = function(name, error) {
var title = 'An error occurred while loading the file: ' + name;
var message = 'An error occurred while loading the file, which may indicate that it is invalid. A detailed error report is below:';
viewer.cesiumWidget.showErrorPanel(title, message, error);
};

viewer.dropError.addEventListener(function(viewerArg, name, error) {
showLoadError(name, error);
});

var scene = viewer.scene;
var context = scene.context;
if (endUserOptions.debug) {
context.validateShaderProgram = true;
context.validateFramebuffer = true;
context.logShaderCompilation = true;
context.throwOnWebGLError = true;
}

var view = endUserOptions.view;
var source = endUserOptions.source;
if (defined(source)) {
var loadPromise;

if (/\.czml$/i.test(source)) {
loadPromise = CzmlDataSource.load(source);
} else if (/\.geojson$/i.test(source) || /\.json$/i.test(source) || /\.topojson$/i.test(source)) {
loadPromise = GeoJsonDataSource.load(source);
} else if (/\.kml$/i.test(source) || /\.kmz$/i.test(source)) {
loadPromise = KmlDataSource.load(source);
} else {
showLoadError(source, 'Unknown format.');
}

if (defined(loadPromise)) {
viewer.dataSources.add(loadPromise).then(function(dataSource) {
var lookAt = endUserOptions.lookAt;
if (defined(lookAt)) {
var entity = dataSource.entities.getById(lookAt);
if (defined(entity)) {
viewer.trackedEntity = entity;
} else {
var error = 'No entity with id "' + lookAt + '" exists in the provided data source.';
showLoadError(source, error);
}
} else if (!defined(view)) {
viewer.flyTo(dataSource);
}
}).otherwise(function(error) {
showLoadError(source, error);
});
}
}

if (endUserOptions.stats) {
scene.debugShowFramesPerSecond = true;
}

var theme = endUserOptions.theme;
if (defined(theme)) {
if (endUserOptions.theme === 'lighter') {
document.body.classList.add('cesium-lighter');
viewer.animation.applyThemeChanges();
} else {
var error = 'Unknown theme: ' + theme;
viewer.cesiumWidget.showErrorPanel(error, '');
}
}

if (defined(view)) {
var splitQuery = view.split(/[ ,]+/);
if (splitQuery.length > 1) {
var longitude = !isNaN(+splitQuery[0]) ? +splitQuery[0] : 0.0;
var latitude = !isNaN(+splitQuery[1]) ? +splitQuery[1] : 0.0;
var height = ((splitQuery.length > 2) && (!isNaN(+splitQuery[2]))) ? +splitQuery[2] : 300.0;
var heading = ((splitQuery.length > 3) && (!isNaN(+splitQuery[3]))) ? CesiumMath.toRadians(+splitQuery[3]) : undefined;
var pitch = ((splitQuery.length > 4) && (!isNaN(+splitQuery[4]))) ? CesiumMath.toRadians(+splitQuery[4]) : undefined;
var roll = ((splitQuery.length > 5) && (!isNaN(+splitQuery[5]))) ? CesiumMath.toRadians(+splitQuery[5]) : undefined;

viewer.camera.setView({
destination: Cartesian3.fromDegrees(longitude, latitude, height),
orientation: {
heading: heading,
pitch: pitch,
roll: roll
}
});
}
}

function saveCamera() {
var position = camera.positionCartographic;
var hpr = '';
if (defined(camera.heading)) {
hpr = ',' + CesiumMath.toDegrees(camera.heading) + ',' + CesiumMath.toDegrees(camera.pitch) + ',' + CesiumMath.toDegrees(camera.roll);
}
endUserOptions.view = CesiumMath.toDegrees(position.longitude) + ',' + CesiumMath.toDegrees(position.latitude) + ',' + position.height + hpr;
history.replaceState(undefined, '', '?' + objectToQuery(endUserOptions));
}

var updateTimer;
if (endUserOptions.saveCamera !== 'false') {
var camera = viewer.camera;
camera.moveStart.addEventListener(function() {
if (!defined(updateTimer)) {
updateTimer = window.setInterval(saveCamera, 1000);
}
});
camera.moveEnd.addEventListener(function() {
if (defined(updateTimer)) {
window.clearInterval(updateTimer);
updateTimer = undefined;
}
saveCamera();
});
}

loadingIndicator.style.display = 'none';
});
11 changes: 11 additions & 0 deletions Cesium/Apps/CesiumViewer/CesiumViewerStartup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*global require*/
require({
baseUrl : '.',
paths : {
domReady : '../../ThirdParty/requirejs-2.1.20/domReady',
Cesium : '../../Source'
}
}, [
'CesiumViewer'
], function() {
});
Binary file added Cesium/Apps/CesiumViewer/Images/ajax-loader.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Cesium/Apps/CesiumViewer/favicon.ico
Binary file not shown.
19 changes: 19 additions & 0 deletions Cesium/Apps/CesiumViewer/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Use correct character set. -->
<meta charset="utf-8">
<!-- Tell IE to use the latest, best version. -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Make the application on mobile take up the full browser screen and disable user scaling. -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<title>Cesium Viewer</title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="CesiumViewer.css" media="screen">
<script data-main="CesiumViewerStartup" src="../../ThirdParty/requirejs-2.1.20/require.js"></script>
</head>
<body style="background: #000;">
<div id="cesiumContainer" class="fullWindow"></div>
<div id="loadingIndicator" class="loadingIndicator"></div>
</body>
</html>
25 changes: 25 additions & 0 deletions Cesium/Apps/HelloWorld.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Use correct character set. -->
<meta charset="utf-8">
<!-- Tell IE to use the latest, best version. -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Make the application on mobile take up the full browser screen and disable user scaling. -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<title>Hello World!</title>
<script src="../Build/Cesium/Cesium.js"></script>
<style>
@import url(../Build/Cesium/Widgets/widgets.css);
html, body, #cesiumContainer {
width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden;
}
</style>
</head>
<body>
<div id="cesiumContainer"></div>
<script>
var viewer = new Cesium.Viewer('cesiumContainer');
</script>
</body>
</html>
Loading

0 comments on commit 8a4e49f

Please sign in to comment.