无人机管理后台前端(已迁走)
罗广辉
2025-09-13 634ee52cd4997cd50688ef5eda6c2cc86ea03cb4
src/utils/cesium/createRouteLine.js
@@ -36,6 +36,34 @@
   speed: 5
})
let arrowLineMaterialPropertyOrange = new ArrowLineMaterialProperty({
   color: new Cesium.Color(255 / 255, 185 / 255, 58 / 255, 1),
   directionColor: new Cesium.Color(1, 1, 1, 1),
   outlineColor: new Cesium.Color(1, 1, 1, 1),
   outlineWidth: 0,
   speed: 5,
})
let arrowLineMaterialPropertyGreen = new ArrowLineMaterialProperty({
   color: new Cesium.Color(6 / 255, 217 / 255, 87 / 255, 1),
   directionColor: new Cesium.Color(1, 1, 1, 1),
   outlineColor: new Cesium.Color(1, 1, 1, 1),
   outlineWidth: 0,
   speed: 5,
})
// 记录index
let indexLog = 0
// 颜色
function getLineColor(lineNumber) {
   // 颜色顺序: 蓝(0), 黄(1), 绿(2)
   const colors = [arrowLineMaterialProperty, arrowLineMaterialPropertyOrange, arrowLineMaterialPropertyGreen]
   // 计算颜色索引 (从0开始)
   const colorIndex = (lineNumber - 1) % 3
   // 返回对应颜色
   return colors[colorIndex]
}
let runningLineMaterial = new LineTrailMaterial({
   color: Cesium.Color.fromCssColorString('#1FFF69'),
   opacity: 1,
@@ -94,6 +122,7 @@
    * @param {*} viewer 
    */
   initCreateRoute (viewer) {
      indexLog = 0
      this.viewer = viewer
   }
@@ -479,6 +508,7 @@
      // 路径线
      let polyline
      if (this.type === 'clusterScheduling') {
         filePositions.forEach((item, index) => {
            let position = Cesium.Cartesian3.fromDegrees(item.lng, item.lat, item.alt)
@@ -630,7 +660,7 @@
            polyline: {
               width: 4,
               positions: positionArray,
               material: arrowLineMaterialProperty,
               material: getLineColor(indexLog),
               clampToGround: false,
            },
@@ -681,6 +711,7 @@
    * @returns {} {positionArray: 带拼接点位置, filePositions:光航线点位置}
    */
   disposeData (lineObj, missionConfig, dronePosition, data, startPoint, wayline_type) {
      indexLog = indexLog + 1
      const { device_sn } = data
      const executeHeightMode = lineObj.executeHeightMode === "WGS84"