You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cesium/geometries-zml.html

112 lines
2.6 KiB
HTML

<!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="./Cesium/Cesium.js"></script>
<style>
@import url(./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>
const czml = [
{
id: "document",
name: "CZML Geometries: Cones and Cylinders",
version: "1.0",
},
{
id: "shape0",
name: "Red box with black outline",
position: {
cartographicDegrees: [116.407001,39.904592, 10],
},
box: {
dimensions: {
cartesian: [20.0, 20.0, 20.0],
},
material: {
solidColor: {
color: {
rgba: [255, 0, 0, 128],
},
},
},
outline: true,
outlineColor: {
rgba: [0, 0, 0, 255],
},
},
},
{
id: "shape1",
name: "Green cylinder with black outline",
position: {
cartographicDegrees: [116.408001,39.904592, 20.0],
},
cylinder: {
length: 40.0,
topRadius: 20.0,
bottomRadius: 20.0,
material: {
solidColor: {
color: {
rgba: [0, 255, 0, 128],
},
},
},
outline: true,
outlineColor: {
rgba: [0, 0, 0, 255],
},
},
},
{
id: "shape2",
name: "Red cone",
position: {
cartographicDegrees: [116.409001,39.904592, 20.0],
},
cylinder: {
length: 40.0,
topRadius: 0.0,
bottomRadius: 20.0,
material: {
solidColor: {
color: {
rgba: [255, 0, 0, 255],
},
},
},
},
},
];
var viewer = new Cesium.Viewer('cesiumContainer');
const dataSourcePromise = Cesium.CzmlDataSource.load(czml);
viewer.dataSources.add(dataSourcePromise);
viewer.zoomTo(dataSourcePromise);
viewer.baseLayerPicker.viewModel.selectedImagery = viewer.baseLayerPicker.viewModel.imageryProviderViewModels[4];
</script>
</body>
</html>