Files
openlayers/master/examples/Minimalist.html
Éric Lemoine 5d14b9e2d4 Updated
2013-02-20 10:38:25 +01:00

113 lines
3.6 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> <!-- Use Chrome Frame in IE -->
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta name="description" content="An example of using the &quot;built&quot; Cesium with minimal dependencies (uses static imagery).">
<title>Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script type="text/javascript" src="../../../Build/Unminified/Cesium.js"></script>
<script type="text/javascript" src="../Sandcastle-warn.js"></script>
</head>
<body data-sandcastle-bucket="bucket-plain.html" data-sandcastle-title="Cesium (standalone)">
<style>
body {
background: #000;
color: #eee;
font-family: sans-serif;
font-size: 9pt;
padding: 0;
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
.fullSize {
display: block;
position: absolute;
top: 0;
left: 0;
border: none;
width: 100%;
height: 100%;
}
#toolbar {
margin: 5px;
padding: 2px 5px;
position: absolute;
}
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="toolbar">Loading...</div>
<script id="cesium_sandcastle_script">
(function () {
"use strict";
var canvas = document.createElement('canvas');
canvas.className = "fullSize";
document.getElementById('cesiumContainer').appendChild(canvas);
var ellipsoid = Cesium.Ellipsoid.WGS84;
var scene = new Cesium.Scene(canvas);
var primitives = scene.getPrimitives();
var imageryUrl = '../../../Source/Assets/Textures/';
var imageryProvider = new Cesium.SingleTileImageryProvider({
url : imageryUrl + 'NE2_LR_LC_SR_W_DR_2048.jpg'
});
var cb = new Cesium.CentralBody(ellipsoid);
cb.getImageryLayers().addImageryProvider(imageryProvider);
primitives.setCentralBody(cb);
scene.skyAtmosphere = new Cesium.SkyAtmosphere();
scene.skyBox = new Cesium.SkyBox({
positiveX: imageryUrl + 'SkyBox/tycho8_px_80.jpg',
negativeX: imageryUrl + 'SkyBox/tycho8_mx_80.jpg',
positiveY: imageryUrl + 'SkyBox/tycho8_py_80.jpg',
negativeY: imageryUrl + 'SkyBox/tycho8_my_80.jpg',
positiveZ: imageryUrl + 'SkyBox/tycho8_pz_80.jpg',
negativeZ: imageryUrl + 'SkyBox/tycho8_mz_80.jpg'
});
function animate() {
// INSERT CODE HERE to update primitives based on changes to animation time, camera parameters, etc.
}
function tick() {
scene.initializeFrame();
animate();
scene.render();
Cesium.requestAnimationFrame(tick);
}
tick();
// Prevent right-click from opening a context menu.
canvas.oncontextmenu = function () {
return false;
};
///////////////////////////////////////////////////////////////////////////
// Example resize handler
var onResize = function () {
var width = canvas.clientWidth;
var height = canvas.clientHeight;
if (canvas.width === width && canvas.height === height) {
return;
}
canvas.width = width;
canvas.height = height;
scene.getCamera().frustum.aspectRatio = width / height;
};
window.addEventListener('resize', onResize, false);
onResize();
document.getElementById('toolbar').innerHTML = '';
}());
</script>
</body>
</html>