|  |  | @ -2,7 +2,7 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  |  * @Author: cbwu 504-wuchengbo@htsdfp.com |  |  |  |  * @Author: cbwu 504-wuchengbo@htsdfp.com | 
			
		
	
		
		
			
				
					
					|  |  |  |  * @Date: 2024-03-27 08:43:44 |  |  |  |  * @Date: 2024-03-27 08:43:44 | 
			
		
	
		
		
			
				
					
					|  |  |  |  * @LastEditors: cbwu |  |  |  |  * @LastEditors: cbwu | 
			
		
	
		
		
			
				
					
					|  |  |  |  * @LastEditTime: 2024-04-13 10:46:58 |  |  |  |  * @LastEditTime: 2024-04-16 19:00:18 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  * @Description: 绘制Polyline类 |  |  |  |  * @Description: 绘制Polyline类 | 
			
		
	
		
		
			
				
					
					|  |  |  |  */ |  |  |  |  */ | 
			
		
	
		
		
			
				
					
					|  |  |  | import { |  |  |  | import { | 
			
		
	
	
		
		
			
				
					|  |  | @ -14,12 +14,19 @@ import { | 
			
		
	
		
		
			
				
					
					|  |  |  |   Entity, |  |  |  |   Entity, | 
			
		
	
		
		
			
				
					
					|  |  |  |   CallbackProperty, |  |  |  |   CallbackProperty, | 
			
		
	
		
		
			
				
					
					|  |  |  |   PolylineDashMaterialProperty, |  |  |  |   PolylineDashMaterialProperty, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   HeightReference, | 
			
		
	
		
		
			
				
					
					|  |  |  | } from 'cesium' |  |  |  | } from 'cesium' | 
			
		
	
		
		
			
				
					
					|  |  |  | import { cartesian2ToCartesian3 } from '@/utils/map/coordinate' |  |  |  | import { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   cartesian2ToCartesian3, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   cartesian3ToWGS84, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | } from '@/utils/map/coordinate' | 
			
		
	
		
		
			
				
					
					|  |  |  | // import { PointEntity, PolylineEntity } from '@/utils/map/geometry'
 |  |  |  | // import { PointEntity, PolylineEntity } from '@/utils/map/geometry'
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import { PolylineEntity } from '../geometry/polylineEntity' |  |  |  | import { PolylineEntity } from '../geometry/polylineEntity' | 
			
		
	
		
		
			
				
					
					|  |  |  | import { PointEntity } from '@/utils/map/geometry/pointEntity' |  |  |  | import { PointEntity } from '@/utils/map/geometry/pointEntity' | 
			
		
	
		
		
			
				
					
					|  |  |  | import EditGeometry from '@/utils/map/draw/editGeometry' |  |  |  | import EditGeometry from '@/utils/map/draw/editGeometry' | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import { getDistance } from '@/utils/map/geocomputation.ts' | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import { Angle } from '@/utils/map/angle.ts' | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import { TextLabel } from '@/utils/map/geometry/textLabel.ts' | 
			
		
	
		
		
			
				
					
					|  |  |  | type EntityOptions = { |  |  |  | type EntityOptions = { | 
			
		
	
		
		
			
				
					
					|  |  |  |   id?: string |  |  |  |   id?: string | 
			
		
	
		
		
			
				
					
					|  |  |  |   name?: string |  |  |  |   name?: string | 
			
		
	
	
		
		
			
				
					|  |  | @ -44,8 +51,12 @@ export default class CreatePolyline { | 
			
		
	
		
		
			
				
					
					|  |  |  |   moveSelectedPoint: PointEntity | null = null |  |  |  |   moveSelectedPoint: PointEntity | null = null | 
			
		
	
		
		
			
				
					
					|  |  |  |   positions: Cartesian3[] = [] |  |  |  |   positions: Cartesian3[] = [] | 
			
		
	
		
		
			
				
					
					|  |  |  |   bMove: boolean = false |  |  |  |   bMove: boolean = false | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   bMeasure: boolean | undefined = false //是否处于测距模式
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   totalDistance: number = 0 | 
			
		
	
		
		
			
				
					
					|  |  |  |   bLongClick: boolean = false |  |  |  |   bLongClick: boolean = false | 
			
		
	
		
		
			
				
					
					|  |  |  |   clickTimeout: any |  |  |  |   clickTimeout: any | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   altitudeOffset: number = 20 //相对高度
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   vDashLinePosition: Cartesian3[][] = [] //垂直辅助线坐标数组
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   // layer: CustomDataSource
 |  |  |  |   // layer: CustomDataSource
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   defaultStyle: EntityOptions = { |  |  |  |   defaultStyle: EntityOptions = { | 
			
		
	
		
		
			
				
					
					|  |  |  |     // id: 'Polyline' + String(PolylineEntity.id),
 |  |  |  |     // id: 'Polyline' + String(PolylineEntity.id),
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -54,13 +65,18 @@ export default class CreatePolyline { | 
			
		
	
		
		
			
				
					
					|  |  |  |     width: 2, |  |  |  |     width: 2, | 
			
		
	
		
		
			
				
					
					|  |  |  |     color: Color.GREEN, |  |  |  |     color: Color.GREEN, | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |   constructor(viewer: Viewer, options?: EntityOptions) { |  |  |  |   constructor( | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     viewer: Viewer, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     bMeasure: boolean = false, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     options?: EntityOptions, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   ) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     this.viewer = viewer |  |  |  |     this.viewer = viewer | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     this.bMeasure = bMeasure | 
			
		
	
		
		
			
				
					
					|  |  |  |     this.handler = new ScreenSpaceEventHandler(this.viewer.scene.canvas) |  |  |  |     this.handler = new ScreenSpaceEventHandler(this.viewer.scene.canvas) | 
			
		
	
		
		
			
				
					
					|  |  |  |     this.polyline = null |  |  |  |     this.polyline = null | 
			
		
	
		
		
			
				
					
					|  |  |  |     this.trackingLine = null |  |  |  |     this.trackingLine = null | 
			
		
	
		
		
			
				
					
					|  |  |  |     this.dashLine = null |  |  |  |     this.dashLine = null | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |     this.totalDistance = 0 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     this.controlPoints = [] |  |  |  |     this.controlPoints = [] | 
			
		
	
		
		
			
				
					
					|  |  |  |     this.defaultStyle = { ...this.defaultStyle, ...options } |  |  |  |     this.defaultStyle = { ...this.defaultStyle, ...options } | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
	
		
		
			
				
					|  |  | @ -90,23 +106,23 @@ export default class CreatePolyline { | 
			
		
	
		
		
			
				
					
					|  |  |  |   public end() { |  |  |  |   public end() { | 
			
		
	
		
		
			
				
					
					|  |  |  |     this.handler.removeInputAction(ScreenSpaceEventType.LEFT_CLICK) |  |  |  |     this.handler.removeInputAction(ScreenSpaceEventType.LEFT_CLICK) | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   //左单击回调事件
 |  |  |  |   //左单击回调事件
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   private leftClickCallBack = ( |  |  |  |   private leftClickCallBack = ( | 
			
		
	
		
		
			
				
					
					|  |  |  |     event: ScreenSpaceEventHandler.PositionedEvent, |  |  |  |     event: ScreenSpaceEventHandler.PositionedEvent, | 
			
		
	
		
		
			
				
					
					|  |  |  |   ) => { |  |  |  |   ) => { | 
			
		
	
		
		
			
				
					
					|  |  |  |     const pickedObject = this.viewer.scene.pick(event.position) |  |  |  |     const pickedObject = this.viewer.scene.pick(event.position) | 
			
		
	
		
		
			
				
					
					|  |  |  |     // console.log(pickedObject)
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     if (pickedObject) { |  |  |  |     if (pickedObject) { | 
			
		
	
		
		
			
				
					
					|  |  |  |       //点击同一位置,返回
 |  |  |  |       //点击同一位置,返回
 | 
			
		
	
		
		
			
				
					
					|  |  |  |       if ( |  |  |  |       if ( | 
			
		
	
		
		
			
				
					
					|  |  |  |         pickedObject.id.id === |  |  |  |         pickedObject.id.id === | 
			
		
	
		
		
			
				
					
					|  |  |  |         this.polyline?.controlPointsID[this.positions.length - 1] |  |  |  |         this.polyline?.controlPointsID[this.positions.length - 1] | 
			
		
	
		
		
			
				
					
					|  |  |  |       ) { |  |  |  |       ) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         console.log('********click the same point') | 
			
		
	
		
		
			
				
					
					|  |  |  |         return |  |  |  |         return | 
			
		
	
		
		
			
				
					
					|  |  |  |         // console.log('********click the same point')
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       } |  |  |  |       } | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |     const cartesian3 = cartesian2ToCartesian3(this.viewer, event.position) |  |  |  |     let cartesian3 = cartesian2ToCartesian3(this.viewer, event.position) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     if (cartesian3 != undefined) { |  |  |  |     if (cartesian3 != undefined) { | 
			
		
	
		
		
			
				
					
					|  |  |  |       if (!this.polyline) { |  |  |  |       if (!this.polyline) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         this.polyline = new PolylineEntity(this.positions) |  |  |  |         this.polyline = new PolylineEntity(this.positions) | 
			
		
	
	
		
		
			
				
					|  |  | @ -114,18 +130,60 @@ export default class CreatePolyline { | 
			
		
	
		
		
			
				
					
					|  |  |  |         this.viewer.entities.add(this.dashLine) |  |  |  |         this.viewer.entities.add(this.dashLine) | 
			
		
	
		
		
			
				
					
					|  |  |  |         this.viewer.dataSources.add(this.polyline) |  |  |  |         this.viewer.dataSources.add(this.polyline) | 
			
		
	
		
		
			
				
					
					|  |  |  |       } |  |  |  |       } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       const oldPosition = cartesian3 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       //计算高度偏移后的新坐标
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       cartesian3 = this.calculateAltitudeOffsetPosition( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         cartesian3, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         this.altitudeOffset, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       ) | 
			
		
	
		
		
			
				
					
					|  |  |  |       this.polyline.addPoint(cartesian3) |  |  |  |       this.polyline.addPoint(cartesian3) | 
			
		
	
		
		
			
				
					
					|  |  |  |       this.trackingLinePositions[0] = cartesian3 |  |  |  |       this.trackingLinePositions[0] = cartesian3 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       //垂直辅助线
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       const n = this.positions.length - 1 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       const ptArr = [oldPosition, cartesian3] | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       this.vDashLinePosition[n] = ptArr | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       this.viewer.entities.add( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         this.createTrackingLine(this.vDashLinePosition[n], Color.WHITE), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       //添加地表控制点
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       const groundControlPoint = new PointEntity(this.vDashLinePosition[n][0]) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       this.viewer.entities.add(groundControlPoint) | 
			
		
	
		
		
			
				
					
					|  |  |  |       this.bMove = true |  |  |  |       this.bMove = true | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       this.viewer.scene.requestRender() //刷新
 |  |  |  |       this.viewer.scene.requestRender() //刷新
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       // 计算2点距离
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       if (this.positions.length >= 2 && this.bMeasure) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         let distance = getDistance( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           this.positions[this.positions.length - 1], | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           this.positions[this.positions.length - 2], | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         this.totalDistance += distance | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         // 计算2点方位角
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         let azimuth = Angle.getAzimuth( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           this.positions[this.positions.length - 2], | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           this.positions[this.positions.length - 1], | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         // 计算2点的中间点
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         let midPoint = Cartesian3.midpoint( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           this.positions[this.positions.length - 1], | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           this.positions[this.positions.length - 2], | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           new Cartesian3(), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         // 添加label
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         let labelText = `距离: ${distance.toFixed(2)}km, 方位角: ${azimuth}°` | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         new TextLabel(this.viewer, midPoint, labelText) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       } | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |   // 移动回调事件
 |  |  |  |   // 移动回调事件
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   private moveCallBack = (event: ScreenSpaceEventHandler.MotionEvent) => { |  |  |  |   private moveCallBack = (event: ScreenSpaceEventHandler.MotionEvent) => { | 
			
		
	
		
		
			
				
					
					|  |  |  |     if (this.bMove) { |  |  |  |     if (this.bMove) { | 
			
		
	
		
		
			
				
					
					|  |  |  |       const cartesian3 = cartesian2ToCartesian3(this.viewer, event.endPosition) |  |  |  |       let cartesian3 = cartesian2ToCartesian3(this.viewer, event.endPosition) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |       if (cartesian3 != undefined) { |  |  |  |       if (cartesian3 != undefined) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //计算高度偏移后的新坐标
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         cartesian3 = this.calculateAltitudeOffsetPosition( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           cartesian3, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           this.altitudeOffset, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         ) | 
			
		
	
		
		
			
				
					
					|  |  |  |         //更新追踪线坐标
 |  |  |  |         //更新追踪线坐标
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         this.trackingLinePositions[1] = cartesian3 |  |  |  |         this.trackingLinePositions[1] = cartesian3 | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (!this.trackingLine) { |  |  |  |         if (!this.trackingLine) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -143,10 +201,7 @@ export default class CreatePolyline { | 
			
		
	
		
		
			
				
					
					|  |  |  |   private leftDoubleClickCallBack = ( |  |  |  |   private leftDoubleClickCallBack = ( | 
			
		
	
		
		
			
				
					
					|  |  |  |     event: ScreenSpaceEventHandler.PositionedEvent, |  |  |  |     event: ScreenSpaceEventHandler.PositionedEvent, | 
			
		
	
		
		
			
				
					
					|  |  |  |   ) => { |  |  |  |   ) => { | 
			
		
	
		
		
			
				
					
					|  |  |  |     // 清除可能已经设置的单击定时器
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     // clearTimeout(this.clickTimeout)
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     if (!this.polyline) return |  |  |  |     if (!this.polyline) return | 
			
		
	
		
		
			
				
					
					|  |  |  |     console.log('**************************** double click') |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     this.bMove = false |  |  |  |     this.bMove = false | 
			
		
	
		
		
			
				
					
					|  |  |  |     const cartesian3 = cartesian2ToCartesian3(this.viewer, event.position) |  |  |  |     const cartesian3 = cartesian2ToCartesian3(this.viewer, event.position) | 
			
		
	
		
		
			
				
					
					|  |  |  |     if (cartesian3 != undefined) { |  |  |  |     if (cartesian3 != undefined) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -156,9 +211,18 @@ export default class CreatePolyline { | 
			
		
	
		
		
			
				
					
					|  |  |  |       } |  |  |  |       } | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     if (this.bMeasure) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       // 添加总距离label
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       new TextLabel( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         this.viewer, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         this.positions[this.positions.length - 1], | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         `总距离: ${this.totalDistance.toFixed(2)}km`, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |     this.clearEvent() |  |  |  |     this.clearEvent() | 
			
		
	
		
		
			
				
					
					|  |  |  |     console.log('end:' + this.positions.length.toString()) |  |  |  |     console.log('end:' + this.positions.length.toString()) | 
			
		
	
		
		
			
				
					
					|  |  |  |     console.log(this.positions) |  |  |  |     console.log(this.positions) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     console.log(this.polyline.controlPointsID.length) | 
			
		
	
		
		
			
				
					
					|  |  |  |     //结束绘制进入编辑模式
 |  |  |  |     //结束绘制进入编辑模式
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     this.polyline.removeControlPoints() |  |  |  |     this.polyline.removeControlPoints() | 
			
		
	
		
		
			
				
					
					|  |  |  |     const editTool = new EditGeometry(this.viewer, this.polyline.geometry!) |  |  |  |     const editTool = new EditGeometry(this.viewer, this.polyline.geometry!) | 
			
		
	
	
		
		
			
				
					|  |  | @ -173,13 +237,27 @@ export default class CreatePolyline { | 
			
		
	
		
		
			
				
					
					|  |  |  |       this.viewer.entities.remove(this.controlPoints.pop() as Entity) |  |  |  |       this.viewer.entities.remove(this.controlPoints.pop() as Entity) | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |   clearEvent() { |  |  |  | 
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   private clearEvent() { | 
			
		
	
		
		
			
				
					
					|  |  |  |     this.handler.removeInputAction(ScreenSpaceEventType.LEFT_CLICK) |  |  |  |     this.handler.removeInputAction(ScreenSpaceEventType.LEFT_CLICK) | 
			
		
	
		
		
			
				
					
					|  |  |  |     this.handler.removeInputAction(ScreenSpaceEventType.MOUSE_MOVE) |  |  |  |     this.handler.removeInputAction(ScreenSpaceEventType.MOUSE_MOVE) | 
			
		
	
		
		
			
				
					
					|  |  |  |     this.handler.removeInputAction(ScreenSpaceEventType.LEFT_DOUBLE_CLICK) |  |  |  |     this.handler.removeInputAction(ScreenSpaceEventType.LEFT_DOUBLE_CLICK) | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //计算高度偏移后的坐标
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   calculateAltitudeOffsetPosition( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     oldPosition: Cartesian3, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     altitudeOffset: number, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   ): Cartesian3 { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     const newGeoPosition = cartesian3ToWGS84(oldPosition) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     newGeoPosition[2] = newGeoPosition[2] + altitudeOffset | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     return Cartesian3.fromDegrees( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       newGeoPosition[0], | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       newGeoPosition[1], | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       newGeoPosition[2], | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |   //创建追踪线
 |  |  |  |   //创建追踪线
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   createTrackingLine(positions: Cartesian3[]) { |  |  |  |   createTrackingLine(positions: Cartesian3[], color: Color = Color.GREEN) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     return new Entity({ |  |  |  |     return new Entity({ | 
			
		
	
		
		
			
				
					
					|  |  |  |       polyline: { |  |  |  |       polyline: { | 
			
		
	
		
		
			
				
					
					|  |  |  |         positions: new CallbackProperty(() => { |  |  |  |         positions: new CallbackProperty(() => { | 
			
		
	
	
		
		
			
				
					|  |  | @ -187,10 +265,10 @@ export default class CreatePolyline { | 
			
		
	
		
		
			
				
					
					|  |  |  |         }, false), |  |  |  |         }, false), | 
			
		
	
		
		
			
				
					
					|  |  |  |         width: 2, |  |  |  |         width: 2, | 
			
		
	
		
		
			
				
					
					|  |  |  |         material: new PolylineDashMaterialProperty({ |  |  |  |         material: new PolylineDashMaterialProperty({ | 
			
		
	
		
		
			
				
					
					|  |  |  |           color: Color.GREEN, |  |  |  |           color: color, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |           dashLength: 15, //短划线长度
 |  |  |  |           dashLength: 12, //短划线长度
 | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         }), |  |  |  |         }), | 
			
		
	
		
		
			
				
					
					|  |  |  |         clampToGround: true, |  |  |  |         // clampToGround: true,
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |       }, |  |  |  |       }, | 
			
		
	
		
		
			
				
					
					|  |  |  |     }) |  |  |  |     }) | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |