function initEntityLine(Cesium, viewer) {
const entities = viewer.entities
const position = new Cesium.Cartesian3.fromDegrees(112.200384, 26.541969, 100)
// 创建两个点的位置
let startPoint = Cesium.Cartesian3.fromDegrees(112.200384, 26.541969);
let endPoint = Cesium.Cartesian3.fromDegrees(112.200384, 26.551969);
// 创建线的实体
entities.add({
polyline: {
positions: [startPoint, endPoint],
width: 5,
material: Cesium.Color.RED
}
});
let threePoint = Cesium.Cartesian3.fromDegrees(112.210989, 26.552195)
entities.add({
polyline: {
positions: [startPoint, threePoint],
width: 5,
material: Cesium.Color.RED
}
});
entities.add({
polyline: {
positions: [endPoint, threePoint],
width: 5,
material: Cesium.Color.RED
}
});
viewer.camera.flyToBoundingSphere(new Cesium.BoundingSphere(position, 100));
}
效果