Mars3d的走廊只能在一个平面的无法折叠的解决方案
问题场景:
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)
实现效果: