无人机管理后台前端(已迁走)
chenyao
2025-09-18 6c220d64befec39fb2b982558eb837ab6da8087d
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
   }
@@ -469,7 +498,7 @@
    */
   async drawPointRoute (lineObj, missionConfig, dronePosition, data, startPoint, isShowDock, isShowPointBillboard, wayline_type) {
      const { positionArray, filePositions } = this.disposeData(lineObj, missionConfig, dronePosition, data, startPoint, wayline_type)
      const droneTransformPosition = Cesium.Cartesian3.fromDegrees(
         Number(dronePosition.longitude),
         Number(dronePosition.latitude),
@@ -478,6 +507,7 @@
      // 路径线
      let polyline
      if (this.type === 'clusterScheduling') {
         filePositions.forEach((item, index) => {
@@ -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"