吉安感知网项目-前端
shuishen
2026-01-29 cb43af5c2caf2184bbf1a8e417f44e9aeaa2fdd9
applications/drone-command/src/views/areaManage/partition/shapeTools/draw/DrawBufferCircleTool.js
@@ -18,8 +18,12 @@
      this.circleLevel1OutlineEntity = null
      this.circleLevel2OutlineEntity = null
      this.circleLevel3OutlineEntity = null
      this.radiusPoint1 = null
      this.radiusPoint2 = null
      this.radiusPoint3 = null
      this.isDrawing = false
      this.drawStep = 0
      this.isCompleted = false
   }
   start() {
@@ -29,10 +33,12 @@
      this.handler.setInputAction(click => this.handleLeftClick(click), Cesium.ScreenSpaceEventType.LEFT_CLICK)
      this.handler.setInputAction(movement => this.handleMouseMove(movement), Cesium.ScreenSpaceEventType.MOUSE_MOVE)
      this.drawStep = 0
      this.isCompleted = false
      this.tooltip.show('单击设置中心点', { x: 0, y: 0 })
   }
   handleLeftClick(click) {
      if (this.isCompleted) return
      const position = this.getPositionFromScreen(click.position)
      if (!position) return
@@ -53,6 +59,7 @@
         this.radiusLevel1 = radius
         this.radiusLevel2 = radius
         this.radiusLevel3 = radius
         this.radiusPoint1 = position
         this.drawStep = 2
         this.tooltip.show('单击设置二级缓冲圆', click.position)
         return
@@ -62,6 +69,7 @@
         const radius = Math.max(1, this.getSurfaceDistance(this.centerCartesian, position))
         this.radiusLevel2 = Math.max(radius, this.radiusLevel1)
         this.radiusLevel3 = this.radiusLevel2
         this.radiusPoint2 = position
         this.drawStep = 3
         this.tooltip.show('单击设置三级缓冲圆', click.position)
         return
@@ -70,14 +78,19 @@
      if (this.drawStep === 3) {
         const radius = Math.max(1, this.getSurfaceDistance(this.centerCartesian, position))
         this.radiusLevel3 = Math.max(radius, this.radiusLevel2)
         this.radiusPoint3 = position
         this.isDrawing = false
         this.drawStep = 0
         this.isCompleted = true
         const positions = buildEllipsePositions(this.centerCartesian, this.radiusLevel3, this.radiusLevel3)
         this.notify('getPolygonPositions', {
            positions,
            meta: {
               center: this.centerCartesian,
               bufferRadii: [this.radiusLevel1, this.radiusLevel2, this.radiusLevel3],
               controlPoints: [this.centerCartesian, this.radiusPoint1, this.radiusPoint2, this.radiusPoint3].filter(
                  Boolean
               ),
            },
         })
         this.tooltip.hide()
@@ -86,6 +99,7 @@
   }
   handleMouseMove(movement) {
      if (this.isCompleted) return
      this.tooltip.move(movement.endPosition)
      if (!this.isDrawing) return
      const position = this.getPositionFromScreen(movement.endPosition)
@@ -224,7 +238,11 @@
      this.radiusLevel1 = 0
      this.radiusLevel2 = 0
      this.radiusLevel3 = 0
      this.radiusPoint1 = null
      this.radiusPoint2 = null
      this.radiusPoint3 = null
      this.isDrawing = false
      this.drawStep = 0
      this.isCompleted = false
   }
}