問題場景:
1. Mars3d的CorridorEntity只能在一個平面修改高度值,無法根據坐標點位制作有高度值的走廊效果,想要做大蜀山盤山走廊的效果實現不了。
解決方案:
1.使用原生cesium實現對應的走廊的截面形狀、走廊的坐標點,包括經度、緯度和高度
// 定義走廊的坐標點,包括經度、緯度和高度const positions = Cesium.Cartesian3.fromDegreesArrayHeights([117.180064, 31.853658, 0, 117.180123, 31.853244, 100, 117.177566, 31.850279, 0, 117.176191, 31.846989, 200, 117.17455, 31.845533, 40, 117.172612,31.844188, 80, 117.170165, 31.842203, 200])// 定義走廊的截面形狀const shape = [new Cesium.Cartesian2(-100, -100),new Cesium.Cartesian2(100, -100),new Cesium.Cartesian2(100, 100),new Cesium.Cartesian2(-100, 100)]const graphic = new mars3d.graphic.PolylineVolumeEntity({positions: positions,style: {shape: shape,cornerType: Cesium.CornerType.ROUNDED,color: "#3388ff",opacity: 0.6},attr: { remark: "示例1" },flyTo: true})graphicLayer.addGraphic(graphic)
實現效果: