代码拉取完成,页面将自动刷新
同步操作将从 Dl12345/cesiumdemo 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<script src="./script/Cesium/Cesium.js"></script>
<link rel="stylesheet" href="./script/Cesium/Widgets/widgets.css" />
<style>
html,
body {
height: 100%;
margin: 0px;
padding: 0px;
}
</style>
</head>
<body>
<div id="cesiumContainer" style="width: 100%"></div>
<script>
const viewer = new Cesium.Viewer("cesiumContainer", {
// baseLayerPicker: false,
// navigationHelpButton: false,
// sceneModePicker: false,
terrainProvider: Cesium.createWorldTerrain(),
baseLayerPicker: false,
shouldAnimate: true,
});
const cartographicDegrees1 = [
0.0,
-6668447.2211117,
1201886.45913705,
146789.427467256,
60.0,
-6511432.84684144,
919677.673492462,
-214047.552431458,
90.0,
-6721319.92231553,
776899.784034099,
-394198.837519575,
150.0,
-6717826.447064,
488820.628328182,
-752924.980158179,
180.0,
-6504450.41462847,
343851.784836767,
-931084.800346031,
240.0,
-6654518.44949696,
52891.726433174,
-1283967.69137678,
];
const cartographicDegrees = [];
cartographicDegrees1.forEach((item, index) => {
if (index % 4 == 0) {
//item = item * 10;
}
if (index % 4 == 3) {
//item = item * 1000;
}
cartographicDegrees.push(item);
});
console.log(cartographicDegrees, "00000000");
function getCzml() {
var czml = [
{
id: "document",
name: "CZML Path",
version: "1.0",
clock: {
interval: "2012-08-04T10:00:00Z/2012-08-04T10:04:00Z",
currentTime: "2012-08-04T10:00:00Z",
multiplier: 10,
},
},
{
id: "path",
name: "path with GPS flight data",
description:
"<p>Hang gliding flight log data from Daniel H. Friedman.<br>Icon created by Larisa Skosyrska from the Noun Project</p>",
availability: "2012-08-04T10:00:00Z/2012-08-04T10:0400Z",
path: {
material: {
polylineOutline: {
color: {
rgba: [80, 80, 255, 255],
},
outlineColor: {
rgba: [0, 255, 255, 255],
},
outlineWidth: 5,
},
},
width: 8,
leadTime: 10,
trailTime: 1000,
resolution: 5,
},
point: {
color: {
rgba: [255, 0, 0, 255],
},
outlineColor: {
rgba: [255, 0, 0, 255],
},
outlineWidth: 2,
pixelSize: 20,
},
position: {
epoch: "2012-08-04T10:00:00Z",
//cartographicDegrees: cartographicDegrees,
cartesian: cartographicDegrees,
interpolationAlgorithm: "LAGRANGE",
interpolationDegree: 5,
},
},
];
return czml;
}
function startUp2() {
console.log("x");
const czml = getCzml();
// czml[1].position.cartographicDegrees.forEach((item, index) => {
// if (index % 4 == 3) {
// item = item + 30000;
// }
// });
console.log(czml);
const dataSourcePromise = Cesium.CzmlDataSource.load(czml);
dataSourcePromise.then((dataSource) => {
const entity = dataSource.entities.getById("launchvehicle");
console.log(entity);
viewer.trackedEntity = ds.entities.getById("path");
//setRotate(entity, { rotateX: 100, rotateY: 100, rotateZ: 100 });
//update3dtilesMaxtrix(entity);
});
viewer.dataSources.add(dataSourcePromise);
viewer.zoomTo(dataSourcePromise);
setTimeout(() => {
viewer.camera.setView({
destination: new Cesium.Cartesian3(
-16458617.941072896,
5107179.844358844,
-4565389.818112487
),
});
}, 2000);
}
startUp2();
function startUp() {
const czml = getCzml();
viewer.dataSources
.add(Cesium.CzmlDataSource.load(czml))
.then(function (ds) {
//viewer.trackedEntity = ds.entities.getById("path");
});
}
startUp();
</script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。