Compare commits
	
		
			2 Commits
		
	
	
		
			5dd7303a6a
			...
			project
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| be1614b50b | |||
| 8287a00832 | 
| @ -187,7 +187,7 @@ import DrawTakeOff from '../Obj/AirLine/DrawTakeOff' | |||||||
| import FlowLine from '../Obj/Base/FlowLine' | import FlowLine from '../Obj/Base/FlowLine' | ||||||
| import Sunshine from '../Global/efflect/Sunshine' | import Sunshine from '../Global/efflect/Sunshine' | ||||||
| // import Road2 from '../Obj/Base/RoadObject' | // import Road2 from '../Obj/Base/RoadObject' | ||||||
| import TextBox from '../Obj/Base/TextBox' | // import TextBox from '../Obj/Base/TextBox' | ||||||
| import BatchModel from '../Obj/Base/BatchModel' | import BatchModel from '../Obj/Base/BatchModel' | ||||||
|  |  | ||||||
| const YJEarthismeasuring = Symbol('测量状态') | const YJEarthismeasuring = Symbol('测量状态') | ||||||
| @ -262,7 +262,7 @@ if (!window.YJ) { | |||||||
|       Dialog, |       Dialog, | ||||||
|       FlowLine, |       FlowLine, | ||||||
|       // Road2, |       // Road2, | ||||||
|       TextBox, |       // TextBox, | ||||||
|       BatchModel |       BatchModel | ||||||
|     }, |     }, | ||||||
|     YJEarth, |     YJEarth, | ||||||
|  | |||||||
| @ -40,11 +40,6 @@ import { | |||||||
| import { getGoodsList } from '../../../Tools/getGoodsList' | import { getGoodsList } from '../../../Tools/getGoodsList' | ||||||
|  |  | ||||||
| class BillboardObject extends Base { | class BillboardObject extends Base { | ||||||
|   #_postRenderEvent = null |  | ||||||
|   #_destroyMouseEvent = null |  | ||||||
|   #_billboardHeight = 0 |  | ||||||
|  |  | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * @constructor |    * @constructor | ||||||
|    * @description 创建点标注 |    * @description 创建点标注 | ||||||
| @ -123,7 +118,6 @@ class BillboardObject extends Base { | |||||||
|     this.options.positions.alt = Number( |     this.options.positions.alt = Number( | ||||||
|       Number(options.positions.alt || 0).toFixed(2) |       Number(options.positions.alt || 0).toFixed(2) | ||||||
|     ) |     ) | ||||||
|     this.#_billboardHeight = this.options.positions.alt |  | ||||||
|     // this.options.diffuseShow = options.diffuseShow || false |     // this.options.diffuseShow = options.diffuseShow || false | ||||||
|     // this.options.diffuseRadius = (options.diffuseRadius || options.diffuseRadius === 0) ? options.diffuseRadius : 10 |     // this.options.diffuseRadius = (options.diffuseRadius || options.diffuseRadius === 0) ? options.diffuseRadius : 10 | ||||||
|     // this.options.diffuseDuration = (options.diffuseDuration || options.diffuseDuration === 0) ? options.diffuseDuration : 2000 |     // this.options.diffuseDuration = (options.diffuseDuration || options.diffuseDuration === 0) ? options.diffuseDuration : 2000 | ||||||
| @ -151,18 +145,11 @@ class BillboardObject extends Base { | |||||||
|       this.options.attribute.goods.content || [] |       this.options.attribute.goods.content || [] | ||||||
|     this.options.attributeType = options.attributeType || 'richText' |     this.options.attributeType = options.attributeType || 'richText' | ||||||
|     this.options.coordinate = options.coordinate || '' |     this.options.coordinate = options.coordinate || '' | ||||||
|     this.options.attributeBoxState = options.attributeBoxState || false |  | ||||||
|     this.operate = {} |     this.operate = {} | ||||||
|     this._elms = {} |     this._elms = {} | ||||||
|     this.previous = { |     this.previous = { | ||||||
|       positions: { ...this.options.positions } |       positions: { ...this.options.positions } | ||||||
|     } |     } | ||||||
|     this.options.attributePos = options.attributePos || { |  | ||||||
|       x: 60, |  | ||||||
|       y: 60, |  | ||||||
|       width: 200, |  | ||||||
|       height: 120 |  | ||||||
|     } |  | ||||||
|     this.entity |     this.entity | ||||||
|     this._proj = this.sdk.proj |     this._proj = this.sdk.proj | ||||||
|  |  | ||||||
| @ -195,109 +182,7 @@ class BillboardObject extends Base { | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     this.#_destroyMouseEvent = () => { |  | ||||||
|       this.attributeElm && (this.attributeElm.style.pointerEvents = 'unset') |  | ||||||
|       this.sdk.viewer._element.onmousemove = null |  | ||||||
|       document.removeEventListener('mouseup', this.#_destroyMouseEvent) |  | ||||||
|       document.removeEventListener('mouseleave', this.#_destroyMouseEvent) |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     this.#_postRenderEvent = () => { |  | ||||||
|       let siteInfoPosition = Cesium.Cartesian3.fromDegrees( |  | ||||||
|         this.options.positions.lng, |  | ||||||
|         this.options.positions.lat, |  | ||||||
|         this.#_billboardHeight |  | ||||||
|       ) |  | ||||||
|       if (this.attributeElm && this.entity) { |  | ||||||
|         let winpos = this.sdk.viewer.scene.cartesianToCanvasCoordinates( |  | ||||||
|           siteInfoPosition |  | ||||||
|         ) |  | ||||||
|         let pixelOffset = this.entity.label.pixelOffset.getValue() |  | ||||||
|         if (winpos) { |  | ||||||
|           let scale = getCurrentBillboardScale(this.entity, this.sdk.viewer.scene) |  | ||||||
|           let height = ((this.entity.billboard.height.getValue() * (this.options.billboard.scale || 0)) + this.options.label.fontSize) * (1 - (scale * scale)) |  | ||||||
|           let flag = false |  | ||||||
|           let lineElm = this.attributeElm.getElementsByClassName('billboard-attribute-box-line')[0] |  | ||||||
|           let leftTopElm = this.attributeElm.getElementsByClassName('left-top')[0] |  | ||||||
|           let rightTopElm = this.attributeElm.getElementsByClassName('right-top')[0] |  | ||||||
|           this.attributeElm.style.left = (winpos.x + this.options.attributePos.x).toFixed(0) + 'px' |  | ||||||
|           this.attributeElm.style.top = (winpos.y + pixelOffset.y - (this.options.label.show ? (this.options.label.fontSize / 2) : -(this.options.label.fontSize / 2)) - this.attributeElm.offsetHeight - this.options.attributePos.y + height).toFixed(0) + 'px' |  | ||||||
|           this.attributeElm.style.width = this.options.attributePos.width + 'px' |  | ||||||
|           this.attributeElm.style.height = this.options.attributePos.height + 'px' |  | ||||||
|           lineElm.style.zIndex = '-1' |  | ||||||
|           if (this.options.attributePos.x < -this.options.attributePos.width / 2) { |  | ||||||
|             flag = true |  | ||||||
|             lineElm.style.left = 'unset' |  | ||||||
|             lineElm.style.right = '0' |  | ||||||
|             leftTopElm.style.display = 'block' |  | ||||||
|             rightTopElm.style.display = 'none' |  | ||||||
|           } |  | ||||||
|           else { |  | ||||||
|             lineElm.style.left = '0' |  | ||||||
|             lineElm.style.right = 'unset' |  | ||||||
|             leftTopElm.style.display = 'none' |  | ||||||
|             rightTopElm.style.display = 'block' |  | ||||||
|           } |  | ||||||
|  |  | ||||||
|           let lineLength |  | ||||||
|           let lineAngleRad |  | ||||||
|           let lineAngle |  | ||||||
|           let x |  | ||||||
|           let y |  | ||||||
|           if (flag) { |  | ||||||
|             x = this.attributeElm.offsetWidth + this.options.attributePos.x |  | ||||||
|             y = this.options.attributePos.y ? this.options.attributePos.y : 0 |  | ||||||
|           } |  | ||||||
|           else { |  | ||||||
|             x = this.options.attributePos.x |  | ||||||
|             y = this.options.attributePos.y ? this.options.attributePos.y : 0 |  | ||||||
|           } |  | ||||||
|           lineLength = Math.sqrt((x * x) + (y * y)).toFixed(2); |  | ||||||
|           lineAngleRad = Math.atan(x / y); |  | ||||||
|           lineAngle = parseFloat((lineAngleRad * 180 / Math.PI).toFixed(2)); |  | ||||||
|           if (this.options.attributePos.y < 0) { |  | ||||||
|             lineAngle = lineAngle + 180 |  | ||||||
|           } |  | ||||||
|           // if(this.options.attributePos.y<-this.options.attributePos.height/2) { |  | ||||||
|           //   lineElm.style.bottom = 'unset' |  | ||||||
|           //   lineElm.style.top = '0' |  | ||||||
|           // } |  | ||||||
|           // else { |  | ||||||
|           //   lineElm.style.bottom = -lineLength + 'px' |  | ||||||
|           //   lineElm.style.top = 'unset' |  | ||||||
|           // } |  | ||||||
|           lineElm.style.height = lineLength + 'px' |  | ||||||
|           lineElm.style.transform = 'rotate(' + lineAngle + 'deg)' |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     function getCurrentBillboardScale(entity, scene) { |  | ||||||
|       // 获取相机到Billboard的距离 |  | ||||||
|       const distance = Cesium.Cartesian3.distance( |  | ||||||
|         scene.camera.positionWC, |  | ||||||
|         entity.position.getValue() |  | ||||||
|       ); |  | ||||||
|       // 获取缩放距离配置 |  | ||||||
|       const scaleByDistance = entity.billboard.scaleByDistance ? entity.billboard.scaleByDistance.getValue() : undefined; |  | ||||||
|  |  | ||||||
|       if (!scaleByDistance) { |  | ||||||
|         // 如果没有设置距离缩放,则使用基础缩放值 |  | ||||||
|         return 1.0; |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|       // 解析缩放距离参数 [near, nearScale, far, farScale] |  | ||||||
|       const { near, nearValue, far, farValue } = scaleByDistance; |  | ||||||
|       if (distance <= near) { |  | ||||||
|         return nearValue; |  | ||||||
|       } else if (distance >= far) { |  | ||||||
|         return farValue; |  | ||||||
|       } else { |  | ||||||
|         // 计算中间距离的缩放值(线性插值) |  | ||||||
|         const t = (distance - near) / (far - near); |  | ||||||
|         return Cesium.Math.lerp(nearValue, farValue, t); |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     this.sdk.addIncetance(this.options.id, this) |     this.sdk.addIncetance(this.options.id, this) | ||||||
| @ -358,7 +243,6 @@ class BillboardObject extends Base { | |||||||
|             that.entity.billboard.imgHeight = 0 |             that.entity.billboard.imgHeight = 0 | ||||||
|             that.entity.billboard.image = canvas |             that.entity.billboard.image = canvas | ||||||
|             addCluster(that.sdk, that.entity) |             addCluster(that.sdk, that.entity) | ||||||
|             that.attributeBoxState && (that.attributeBoxState = true) |  | ||||||
|           } |           } | ||||||
|           return |           return | ||||||
|         } |         } | ||||||
| @ -383,7 +267,6 @@ class BillboardObject extends Base { | |||||||
|             return img |             return img | ||||||
|           }, false) |           }, false) | ||||||
|           addCluster(that.sdk, that.entity) |           addCluster(that.sdk, that.entity) | ||||||
|           that.attributeBoxState && (that.attributeBoxState = true) |  | ||||||
|         } |         } | ||||||
|       }) |       }) | ||||||
|     } |     } | ||||||
| @ -415,7 +298,6 @@ class BillboardObject extends Base { | |||||||
|           that.entity.billboard.imgHeight = height |           that.entity.billboard.imgHeight = height | ||||||
|           that.entity.billboard.image = canvas |           that.entity.billboard.image = canvas | ||||||
|           addCluster(that.sdk, that.entity) |           addCluster(that.sdk, that.entity) | ||||||
|           that.attributeBoxState && (that.attributeBoxState = true) |  | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|       image.onerror = function (err) { |       image.onerror = function (err) { | ||||||
| @ -427,7 +309,6 @@ class BillboardObject extends Base { | |||||||
|           that.entity.billboard.imgHeight = 0 |           that.entity.billboard.imgHeight = 0 | ||||||
|           that.entity.billboard.image = canvas |           that.entity.billboard.image = canvas | ||||||
|           addCluster(that.sdk, that.entity) |           addCluster(that.sdk, that.entity) | ||||||
|           that.attributeBoxState && (that.attributeBoxState = true) |  | ||||||
|         } |         } | ||||||
|       }; |       }; | ||||||
|     } |     } | ||||||
| @ -557,16 +438,16 @@ class BillboardObject extends Base { | |||||||
|       //   value: 'IP摄像头', |       //   value: 'IP摄像头', | ||||||
|       //   key: 'camera' |       //   key: 'camera' | ||||||
|       // }, |       // }, | ||||||
|       // // { |       // { | ||||||
|       // //   name: 'ISC摄像头', |       //   name: 'ISC摄像头', | ||||||
|       // //   value: 'ISC摄像头', |       //   value: 'ISC摄像头', | ||||||
|       // //   key: 'isc' |       //   key: 'isc' | ||||||
|       // // }, |       // }, | ||||||
|       // // { |       // { | ||||||
|       // //   name: '传感器', |       //   name: '传感器', | ||||||
|       // //   value: '传感器', |       //   value: '传感器', | ||||||
|       // //   key: 'sensor' |       //   key: 'sensor' | ||||||
|       // // }, |       // }, | ||||||
|       // { |       // { | ||||||
|       //   name: '全景图', |       //   name: '全景图', | ||||||
|       //   value: '全景图', |       //   value: '全景图', | ||||||
| @ -590,30 +471,9 @@ class BillboardObject extends Base { | |||||||
|     } |     } | ||||||
|     if(!this.showView || this.showView == 3) { |     if(!this.showView || this.showView == 3) { | ||||||
|       this.entity && (this.entity.show = this.options.show) |       this.entity && (this.entity.show = this.options.show) | ||||||
|       if (this.attributeBoxState && this.options.show) { |  | ||||||
|         this.attributeBoxState = this.options.show |  | ||||||
|       } |  | ||||||
|       else { |  | ||||||
|         // 关闭属性框 |  | ||||||
|         document.addEventListener('mouseup', this.#_destroyMouseEvent); |  | ||||||
|         document.addEventListener('mouseleave', this.#_destroyMouseEvent); |  | ||||||
|         if (this.attributeElm) { |  | ||||||
|           this.sdk.viewer._element.removeChild(this.attributeElm) |  | ||||||
|           this.attributeElm = null |  | ||||||
|         } |  | ||||||
|         this.sdk.viewer.scene.postRender.removeEventListener(this.#_postRenderEvent) |  | ||||||
|       } |  | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|       this.entity && (this.entity.show = false) |       this.entity && (this.entity.show = false) | ||||||
|       // 关闭属性框 |  | ||||||
|       document.addEventListener('mouseup', this.#_destroyMouseEvent); |  | ||||||
|       document.addEventListener('mouseleave', this.#_destroyMouseEvent); |  | ||||||
|       if (this.attributeElm) { |  | ||||||
|         this.sdk.viewer._element.removeChild(this.attributeElm) |  | ||||||
|         this.attributeElm = null |  | ||||||
|       } |  | ||||||
|       this.sdk.viewer.scene.postRender.removeEventListener(this.#_postRenderEvent) |  | ||||||
|     } |     } | ||||||
|     syncData(this.sdk, this.options.id) |     syncData(this.sdk, this.options.id) | ||||||
|     syncSplitData(this.sdk, this.options.id) |     syncSplitData(this.sdk, this.options.id) | ||||||
| @ -702,26 +562,6 @@ class BillboardObject extends Base { | |||||||
|     if (this.entity) { |     if (this.entity) { | ||||||
|       this.entity.billboard.heightReference = heightMode |       this.entity.billboard.heightReference = heightMode | ||||||
|       this.entity.label.heightReference = heightMode |       this.entity.label.heightReference = heightMode | ||||||
|       if(heightMode == Cesium.HeightReference.CLAMP_TO_GROUND) { |  | ||||||
|         if (this.sdk.viewer.scene.terrainProvider.availability) { |  | ||||||
|           Cesium.sampleTerrainMostDetailed( |  | ||||||
|             this.sdk.viewer.scene.terrainProvider, |  | ||||||
|             [ |  | ||||||
|               Cesium.Cartographic.fromDegrees( |  | ||||||
|                 this.options.positions.lng, |  | ||||||
|                 this.options.positions.lat |  | ||||||
|               ) |  | ||||||
|             ] |  | ||||||
|           ).then(position => { |  | ||||||
|             this.#_billboardHeight = position[0].height |  | ||||||
|           }) |  | ||||||
|         } else { |  | ||||||
|           this.#_billboardHeight = 0 |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|       else { |  | ||||||
|         this.#_billboardHeight = this.options.positions.alt |  | ||||||
|       } |  | ||||||
|     } |     } | ||||||
|     this._elms.heightMode && (this._elms.heightMode.value = heightModeName) |     this._elms.heightMode && (this._elms.heightMode.value = heightModeName) | ||||||
|   } |   } | ||||||
| @ -776,7 +616,6 @@ class BillboardObject extends Base { | |||||||
|   } |   } | ||||||
|   set alt(v) { |   set alt(v) { | ||||||
|     this.options.positions.alt = Number(Number(v).toFixed(2)) |     this.options.positions.alt = Number(Number(v).toFixed(2)) | ||||||
|     this.#_billboardHeight = this.options.positions.alt |  | ||||||
|     // this.scan && (this.scan.alt = v) |     // this.scan && (this.scan.alt = v) | ||||||
|     // this.diffuse && (this.diffuse.alt = v) |     // this.diffuse && (this.diffuse.alt = v) | ||||||
|     this.renewPoint() |     this.renewPoint() | ||||||
| @ -1877,22 +1716,6 @@ class BillboardObject extends Base { | |||||||
|         this.cameraSelect && this.cameraSelect() |         this.cameraSelect && this.cameraSelect() | ||||||
|         this.ISCSelect && this.ISCSelect() |         this.ISCSelect && this.ISCSelect() | ||||||
|         this.goodsSelect && this.goodsSelect() |         this.goodsSelect && this.goodsSelect() | ||||||
|  |  | ||||||
|         let col = document.createElement('div') |  | ||||||
|         col.className = 'col' |  | ||||||
|         col.style.flex = '0 0 110px' |  | ||||||
|         col.innerHTML = ` |  | ||||||
|           <span class="label">属性框</span> |  | ||||||
|           <input class="btn-switch" type="checkbox"> |  | ||||||
|         ` |  | ||||||
|  |  | ||||||
|         let row = this._DialogObject._element.content.getElementsByClassName('attribute')[0].getElementsByClassName('row')[0] |  | ||||||
|         row.appendChild(col) |  | ||||||
|         let boxSwitch = col.getElementsByClassName('btn-switch')[0] |  | ||||||
|         boxSwitch.checked = this.attributeBoxState |  | ||||||
|         boxSwitch.addEventListener('change', (e) => { |  | ||||||
|           this.attributeBoxState = boxSwitch.checked |  | ||||||
|         }) |  | ||||||
|         let tagData = this.attributeSelect |         let tagData = this.attributeSelect | ||||||
|         let attributeElm = this._DialogObject._element.content.getElementsByClassName( |         let attributeElm = this._DialogObject._element.content.getElementsByClassName( | ||||||
|           'attribute-select-box' |           'attribute-select-box' | ||||||
| @ -2404,7 +2227,6 @@ class BillboardObject extends Base { | |||||||
|     this.attributeCamera = this.options.attribute.camera.content |     this.attributeCamera = this.options.attribute.camera.content | ||||||
|     this.attributeGoods = this.options.attribute.goods.content |     this.attributeGoods = this.options.attribute.goods.content | ||||||
|     this.attributeISC = this.options.attribute.ISC.content |     this.attributeISC = this.options.attribute.ISC.content | ||||||
|     this.attributeBoxState = this.options.attributeBoxState |  | ||||||
|     this.cameraSelect && this.cameraSelect() |     this.cameraSelect && this.cameraSelect() | ||||||
|     this.goodsSelect && this.goodsSelect() |     this.goodsSelect && this.goodsSelect() | ||||||
|   } |   } | ||||||
| @ -2412,7 +2234,6 @@ class BillboardObject extends Base { | |||||||
|   async remove() { |   async remove() { | ||||||
|     await remove_entity_from_cluster(this.sdk.viewer, this.entity) |     await remove_entity_from_cluster(this.sdk.viewer, this.entity) | ||||||
|     this.entity = null |     this.entity = null | ||||||
|     this.attributeBoxState = false |  | ||||||
|     if (!this.sdk.viewer || !this.sdk.viewer.entities) { |     if (!this.sdk.viewer || !this.sdk.viewer.entities) { | ||||||
|       return |       return | ||||||
|     } |     } | ||||||
| @ -2603,7 +2424,6 @@ class BillboardObject extends Base { | |||||||
|     } |     } | ||||||
|     if (height !== undefined) { |     if (height !== undefined) { | ||||||
|       this.options.positions.alt = Number(Number(height).toFixed(2)) |       this.options.positions.alt = Number(Number(height).toFixed(2)) | ||||||
|       this.#_billboardHeight = this.options.positions.alt |  | ||||||
|       this._elms.alt && |       this._elms.alt && | ||||||
|         this._elms.alt.forEach(item => { |         this._elms.alt.forEach(item => { | ||||||
|           item.value = this.options.positions.alt |           item.value = this.options.positions.alt | ||||||
| @ -2619,7 +2439,6 @@ class BillboardObject extends Base { | |||||||
|           switch (this._elms.heightMode.value) { |           switch (this._elms.heightMode.value) { | ||||||
|             case '海拔高度': |             case '海拔高度': | ||||||
|               heightElm.value = this.options.positions.alt |               heightElm.value = this.options.positions.alt | ||||||
|               this.#_billboardHeight = this.options.positions.alt |  | ||||||
|               break |               break | ||||||
|             case '相对地表': |             case '相对地表': | ||||||
|               if (this.sdk.viewer.scene.terrainProvider.availability) { |               if (this.sdk.viewer.scene.terrainProvider.availability) { | ||||||
| @ -2635,18 +2454,15 @@ class BillboardObject extends Base { | |||||||
|                   heightElm.value = Number( |                   heightElm.value = Number( | ||||||
|                     (this.options.positions.alt - position[0].height).toFixed(2) |                     (this.options.positions.alt - position[0].height).toFixed(2) | ||||||
|                   ) |                   ) | ||||||
|                   this.#_billboardHeight = this.options.positions.alt |  | ||||||
|                 }) |                 }) | ||||||
|               } else { |               } else { | ||||||
|                 heightElm.value = this.options.positions.alt |                 heightElm.value = this.options.positions.alt | ||||||
|                 this.#_billboardHeight = this.options.positions.alt |  | ||||||
|               } |               } | ||||||
|               break |               break | ||||||
|             case '依附地表': |             case '依附地表': | ||||||
|               break |               break | ||||||
|             case '依附模型': |             case '依附模型': | ||||||
|               heightElm.value = this.options.positions.alt |               heightElm.value = this.options.positions.alt | ||||||
|               this.#_billboardHeight = this.options.positions.alt |  | ||||||
|               break |               break | ||||||
|           } |           } | ||||||
|         } |         } | ||||||
| @ -2920,216 +2736,6 @@ class BillboardObject extends Base { | |||||||
|         (this.originalOptions.customView = this.options.customView) |         (this.originalOptions.customView = this.options.customView) | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   get attributeBoxState() { |  | ||||||
|     return this.options.attributeBoxState |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   set attributeBoxState(state) { |  | ||||||
|     state = state ? true : false |  | ||||||
|     this.options.attributeBoxState = state |  | ||||||
|     document.addEventListener('mouseup', this.#_destroyMouseEvent); |  | ||||||
|     document.addEventListener('mouseleave', this.#_destroyMouseEvent); |  | ||||||
|     if (this.attributeElm) { |  | ||||||
|       this.sdk.viewer._element.removeChild(this.attributeElm) |  | ||||||
|       this.attributeElm = null |  | ||||||
|     } |  | ||||||
|     this.sdk.viewer.scene.postRender.removeEventListener(this.#_postRenderEvent) |  | ||||||
|     if (state && this.sdk && this.sdk.viewer && this.sdk.viewer._element && this.show) { |  | ||||||
|       let attributeElm = document.createElement('div') |  | ||||||
|       this.attributeElm = attributeElm |  | ||||||
|       attributeElm.className = 'billboard-attribute-box' |  | ||||||
|       attributeElm.style.top = '0px' |  | ||||||
|       attributeElm.style.left = '0px' |  | ||||||
|       attributeElm.style.width = 0 |  | ||||||
|       attributeElm.style.height = 0 |  | ||||||
|       // attributeElm.innerHTML = this.options.richTextContent |  | ||||||
|       this.sdk.viewer._element.appendChild(attributeElm) |  | ||||||
|       let linkHtml = '' |  | ||||||
|       let goodsHtml = '' |  | ||||||
|       let richTextHtml = '' |  | ||||||
|       for (let i = 0; i < this.options.attribute.link.content.length; i++) { |  | ||||||
|         linkHtml += `<DIV-cy-tab-pane label="${this.options.attribute.link.content[i].name}"><iframe width='100%' height='100%' src="${this.options.attribute.link.content[i].url}"></iframe></DIV-cy-tab-pane>` |  | ||||||
|       } |  | ||||||
|       if (this.options.attribute.goods && this.options.attribute.goods.content && this.options.attribute.goods.content.length > 0) { |  | ||||||
|         goodsHtml += `<DIV-cy-tab-pane label="物资"> |  | ||||||
|         <div class="table"> |  | ||||||
|           <div class="table-head"> |  | ||||||
|             <div class="tr"> |  | ||||||
|               <div class="th" style="width: 20%; flex: 0 20%;">序号</div> |  | ||||||
|               <div class="th" style="width: 40%; flex: 0 40%;">名称</div> |  | ||||||
|               <div class="th" style="width: 40%; flex: 0 40%;">数量</div> |  | ||||||
|             </div> |  | ||||||
|           </div> |  | ||||||
|           <div class="table-body"> |  | ||||||
|         ` |  | ||||||
|         for (let i = 0; i < this.options.attribute.goods.content.length; i++) { |  | ||||||
|           goodsHtml += `<div class="tr"> |  | ||||||
|             <div class="td" style="width: 20%; flex: 0 20%;">${i + 1}</div> |  | ||||||
|             <div class="td" style="width: 40%; flex: 0 40%;">${this.options.attribute.goods.content[i].name}</div> |  | ||||||
|             <div class="td" style="width: 40%; flex: 0 40%;">${this.options.attribute.goods.content[i].cnt}</div> |  | ||||||
|           </div>` |  | ||||||
|         } |  | ||||||
|         goodsHtml += `</div></div></DIV-cy-tab-pane>` |  | ||||||
|       } |  | ||||||
|       if (this.options.richTextContent) { |  | ||||||
|         richTextHtml = `<DIV-cy-tab-pane label="富文本"> |  | ||||||
|           ${this.options.richTextContent} |  | ||||||
|         </DIV-cy-tab-pane>` |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|       let boxHtml = ` |  | ||||||
|         <span class="drag-nook left-top"></span> |  | ||||||
|         <span class="drag-nook right-top"></span> |  | ||||||
|         ` |  | ||||||
|  |  | ||||||
|       if (!linkHtml && !goodsHtml && !richTextHtml) { |  | ||||||
|         boxHtml = boxHtml + '<p style="margin: 0;width: 100%;height: 100%;display: flex;justify-content: center;align-items: center;backdrop-filter: blur(2px);">暂无属性信息</p><div class="billboard-attribute-box-line"></div>' |  | ||||||
|       } |  | ||||||
|       else { |  | ||||||
|         boxHtml = boxHtml + ` |  | ||||||
|         <DIV-cy-tabs class="tabs"> |  | ||||||
|           ${richTextHtml} |  | ||||||
|           ${goodsHtml} |  | ||||||
|           ${linkHtml} |  | ||||||
|         </DIV-cy-tabs> |  | ||||||
|         <div class="billboard-attribute-box-line"></div>` |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|       attributeElm.innerHTML = boxHtml |  | ||||||
|  |  | ||||||
|       if (attributeElm.getElementsByClassName('tabs')[0]) { |  | ||||||
|         let tabsElm = new cy_tabs(attributeElm.getElementsByClassName('tabs')[0], undefined, this.sdk) |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|       let imgElm = attributeElm.getElementsByTagName('img') |  | ||||||
|       for (let i = 0; i < imgElm.length; i++) { |  | ||||||
|         if (!imgElm[i].style.width) { |  | ||||||
|           imgElm[i].style.width = '100%' |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|       this.sdk.viewer.scene.postRender.addEventListener(this.#_postRenderEvent) |  | ||||||
|       let leftOnmousedown = (e) => { |  | ||||||
|         if (this.options.attributePos.width < 200) { |  | ||||||
|           this.options.attributePos.width = 200 |  | ||||||
|         } |  | ||||||
|         if (this.options.attributePos.height < 120) { |  | ||||||
|           this.options.attributePos.height = 120 |  | ||||||
|         } |  | ||||||
|         let x = e.x |  | ||||||
|         let y = e.y |  | ||||||
|         let width = this.options.attributePos.width |  | ||||||
|         let height = this.options.attributePos.height |  | ||||||
|         let positionx = this.options.attributePos.x |  | ||||||
|         this.sdk.viewer._element.onmousemove = (e2) => { |  | ||||||
|           this.options.attributePos.width = width + (x - e2.x) |  | ||||||
|           this.options.attributePos.height = height + (y - e2.y) |  | ||||||
|           if (this.options.attributePos.width < 200) { |  | ||||||
|             this.options.attributePos.width = 200 |  | ||||||
|           } |  | ||||||
|           else { |  | ||||||
|             this.options.attributePos.x = positionx - (x - e2.x) |  | ||||||
|           } |  | ||||||
|           if (this.options.attributePos.height < 120) { |  | ||||||
|             this.options.attributePos.height = 120 |  | ||||||
|           } |  | ||||||
|           // this.options.attributePos.y = positiony + (y - e2.y) |  | ||||||
|         } |  | ||||||
|         document.addEventListener('mouseup', this.#_destroyMouseEvent); |  | ||||||
|         document.addEventListener('mouseleave', this.#_destroyMouseEvent); |  | ||||||
|       } |  | ||||||
|       let rightOnmousedown = (e) => { |  | ||||||
|         let x = e.x |  | ||||||
|         let y = e.y |  | ||||||
|         if (this.options.attributePos.width < 200) { |  | ||||||
|           this.options.attributePos.width = 200 |  | ||||||
|         } |  | ||||||
|         if (this.options.attributePos.height < 120) { |  | ||||||
|           this.options.attributePos.height = 120 |  | ||||||
|         } |  | ||||||
|         let width = this.options.attributePos.width |  | ||||||
|         let height = this.options.attributePos.height |  | ||||||
|         this.sdk.viewer._element.onmousemove = (e2) => { |  | ||||||
|           this.options.attributePos.width = width + (e2.x - x) |  | ||||||
|           this.options.attributePos.height = height + (y - e2.y) |  | ||||||
|         } |  | ||||||
|         document.addEventListener('mouseup', this.#_destroyMouseEvent); |  | ||||||
|         document.addEventListener('mouseleave', this.#_destroyMouseEvent); |  | ||||||
|       } |  | ||||||
|       // leftTopElm.onmousedown = (e) => { |  | ||||||
|       //   console.log(1111111111) |  | ||||||
|       //   if (this.options.attributePos.width < 200) { |  | ||||||
|       //     this.options.attributePos.width = 200 |  | ||||||
|       //   } |  | ||||||
|       //   if (this.options.attributePos.height < 120) { |  | ||||||
|       //     this.options.attributePos.height = 120 |  | ||||||
|       //   } |  | ||||||
|       //   let x = e.x |  | ||||||
|       //   let y = e.y |  | ||||||
|       //   let width = this.options.attributePos.width |  | ||||||
|       //   let height = this.options.attributePos.height |  | ||||||
|       //   let positionx = this.options.attributePos.x |  | ||||||
|       //   this.sdk.viewer._element.onmousemove = (e2) => { |  | ||||||
|       //     this.options.attributePos.width = width + (x - e2.x) |  | ||||||
|       //     this.options.attributePos.height = height + (y - e2.y) |  | ||||||
|       //     if (this.options.attributePos.width < 200) { |  | ||||||
|       //       this.options.attributePos.width = 200 |  | ||||||
|       //     } |  | ||||||
|       //     else { |  | ||||||
|       //       this.options.attributePos.x = positionx - (x - e2.x) |  | ||||||
|       //     } |  | ||||||
|       //     if (this.options.attributePos.height < 120) { |  | ||||||
|       //       this.options.attributePos.height = 120 |  | ||||||
|       //     } |  | ||||||
|       //     // this.options.attributePos.y = positiony + (y - e2.y) |  | ||||||
|       //   } |  | ||||||
|       //   document.addEventListener('mouseup', this.#_destroyMouseEvent); |  | ||||||
|       //   document.addEventListener('mouseleave', this.#_destroyMouseEvent); |  | ||||||
|       // } |  | ||||||
|       // rightTopElm.onmousedown = (e) => { |  | ||||||
|       //   let x = e.x |  | ||||||
|       //   let y = e.y |  | ||||||
|       //   if (this.options.attributePos.width < 200) { |  | ||||||
|       //     this.options.attributePos.width = 200 |  | ||||||
|       //   } |  | ||||||
|       //   if (this.options.attributePos.height < 120) { |  | ||||||
|       //     this.options.attributePos.height = 120 |  | ||||||
|       //   } |  | ||||||
|       //   let width = this.options.attributePos.width |  | ||||||
|       //   let height = this.options.attributePos.height |  | ||||||
|       //   this.sdk.viewer._element.onmousemove = (e2) => { |  | ||||||
|       //     this.options.attributePos.width = width + (e2.x - x) |  | ||||||
|       //     this.options.attributePos.height = height + (y - e2.y) |  | ||||||
|       //   } |  | ||||||
|       //   document.addEventListener('mouseup', this.#_destroyMouseEvent); |  | ||||||
|       //   document.addEventListener('mouseleave', this.#_destroyMouseEvent); |  | ||||||
|       // } |  | ||||||
|  |  | ||||||
|       attributeElm.onmousedown = (e) => { |  | ||||||
|         attributeElm.style.pointerEvents = 'none' |  | ||||||
|         if (e.target.className.indexOf('left-top') != -1) { |  | ||||||
|           leftOnmousedown(e) |  | ||||||
|         } |  | ||||||
|         else if (e.target.className.indexOf('right-top') != -1) { |  | ||||||
|           rightOnmousedown(e) |  | ||||||
|         } |  | ||||||
|         else { |  | ||||||
|           let x = e.x |  | ||||||
|           let y = e.y |  | ||||||
|           let oldX = this.options.attributePos.x |  | ||||||
|           let oldXY = this.options.attributePos.y |  | ||||||
|           let height = this.options.attributePos.height |  | ||||||
|           this.sdk.viewer._element.onmousemove = (e2) => { |  | ||||||
|             this.options.attributePos.x = oldX + (e2.x - x) |  | ||||||
|             this.options.attributePos.y = oldXY - (e2.y - y) |  | ||||||
|           } |  | ||||||
|           document.addEventListener('mouseup', this.#_destroyMouseEvent); |  | ||||||
|           document.addEventListener('mouseleave', this.#_destroyMouseEvent); |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
| } | } | ||||||
|  |  | ||||||
| export default BillboardObject | export default BillboardObject | ||||||
|  | |||||||
| @ -421,7 +421,10 @@ class GroundSvg extends Base { | |||||||
|   } |   } | ||||||
|   set textFontSize(v) { |   set textFontSize(v) { | ||||||
|     this.options.text.fontSize = v |     this.options.text.fontSize = v | ||||||
|     this.text && (this.text.fontSize = v) |     if(this.text) { | ||||||
|  |       this.text.fontSize = v | ||||||
|  |       this.text.pixelOffset = v | ||||||
|  |     } | ||||||
|     this._elms.textFontSize && this._elms.textFontSize.forEach((item) => { |     this._elms.textFontSize && this._elms.textFontSize.forEach((item) => { | ||||||
|       item.value = v |       item.value = v | ||||||
|     }) |     }) | ||||||
| @ -1532,7 +1535,7 @@ class GroundSvg extends Base { | |||||||
|         text: that.options.text.value, |         text: that.options.text.value, | ||||||
|         fontSize: that.options.text.fontSize, |         fontSize: that.options.text.fontSize, | ||||||
|         color: that.options.text.color, |         color: that.options.text.color, | ||||||
|         pixelOffset: that.options.text.pixelOffset, |         pixelOffset: that.options.text.fontSize, | ||||||
|         backgroundColor: that.options.text.backgroundColor, |         backgroundColor: that.options.text.backgroundColor, | ||||||
|         lineColor: that.options.text.lineColor, |         lineColor: that.options.text.lineColor, | ||||||
|         lineWidth: that.options.text.lineWidth, |         lineWidth: that.options.text.lineWidth, | ||||||
|  | |||||||
| @ -182,23 +182,6 @@ function html() { | |||||||
|     </div> |     </div> | ||||||
|   </div> |   </div> | ||||||
|   <span class="custom-divider"></span> |   <span class="custom-divider"></span> | ||||||
|     <div class="div-item"> |  | ||||||
|       <div class="row"> |  | ||||||
|         <div class="col"> |  | ||||||
|           <span class="label">油耗</span> |  | ||||||
|           <div class="input-number input-number-unit-6" style="width: 170px;"> |  | ||||||
|             <input class="input" type="number" title="" min="1" max="99999999" @model="unitFuelConsumption"> |  | ||||||
|             <span class="unit">L/100km</span> |  | ||||||
|             <span class="arrow"></span> |  | ||||||
|           </div> |  | ||||||
|         </div> |  | ||||||
|         <div class="col" style="flex: 0 0 0;"> |  | ||||||
|           <span class="label">总油耗</span> |  | ||||||
|           <input class="btn-switch" type="checkbox" @model="fuelShow"> |  | ||||||
|         </div> |  | ||||||
|       </div> |  | ||||||
|     </div> |  | ||||||
|     <span class="custom-divider"></span> |  | ||||||
|   ` |   ` | ||||||
| } | } | ||||||
|  |  | ||||||
|  | |||||||
| @ -78,7 +78,6 @@ class TrajectoryMotion extends Base { | |||||||
|     this.options.line.smooth = options.line.smooth ? options.line.smooth : false |     this.options.line.smooth = options.line.smooth ? options.line.smooth : false | ||||||
|     this.options.line.noseToTail = options.line.noseToTail ? options.line.noseToTail : false |     this.options.line.noseToTail = options.line.noseToTail ? options.line.noseToTail : false | ||||||
|     this.positions_smooth = [] |     this.positions_smooth = [] | ||||||
|     this.options.unitFuelConsumption = options.unitFuelConsumption || 0 |  | ||||||
|     this.options.ground = options.ground || false |     this.options.ground = options.ground || false | ||||||
|     this.options.state = (options.state || options.state === false) ? options.state : true |     this.options.state = (options.state || options.state === false) ? options.state : true | ||||||
|     this.options.routeDirection = (options.routeDirection || options.routeDirection === false) ? options.routeDirection : true |     this.options.routeDirection = (options.routeDirection || options.routeDirection === false) ? options.routeDirection : true | ||||||
| @ -181,8 +180,7 @@ class TrajectoryMotion extends Base { | |||||||
|         if (this.realTimeRoute) { |         if (this.realTimeRoute) { | ||||||
|           this.realTimeLine && (this.realTimeLine.show = (!this.showView || this.showView == 3 || !sdkD) ? true : false) |           this.realTimeLine && (this.realTimeLine.show = (!this.showView || this.showView == 3 || !sdkD) ? true : false) | ||||||
|         } |         } | ||||||
|         this.label && (this.label.show = (!this.showView || this.showView == 3) ? this.options.label.show : false) |         this.label && (this.label.show = (!this.showView || this.showView == 3 || !sdkD) ? this.options.label.show : false) | ||||||
|         this.fuelLabel && (this.fuelLabel.show = (!this.showView || this.showView == 3) ? this.options.fuelShow : false) |  | ||||||
|       } |       } | ||||||
|       else { |       else { | ||||||
|         this.model.show = (!this.showView || this.showView == 3 || !sdkD) ? this.options.show : false |         this.model.show = (!this.showView || this.showView == 3 || !sdkD) ? this.options.show : false | ||||||
| @ -205,7 +203,6 @@ class TrajectoryMotion extends Base { | |||||||
|           this.keyPoints[i].show = (!this.showView || this.showView == 3) ? show : false |           this.keyPoints[i].show = (!this.showView || this.showView == 3) ? show : false | ||||||
|         } |         } | ||||||
|         this.label && (this.label.show = false) |         this.label && (this.label.show = false) | ||||||
|         this.fuelLabel && (this.fuelLabel.show = false) |  | ||||||
|         this.viewFollow = false |         this.viewFollow = false | ||||||
|       } |       } | ||||||
|  |  | ||||||
| @ -260,17 +257,14 @@ class TrajectoryMotion extends Base { | |||||||
|       // Cesium.Matrix4.multiplyByTranslation(this.model.modelMatrix, new Cesium.Cartesian3(0, 0, -difference), this.model.modelMatrix) |       // Cesium.Matrix4.multiplyByTranslation(this.model.modelMatrix, new Cesium.Cartesian3(0, 0, -difference), this.model.modelMatrix) | ||||||
|       // Cesium.Matrix4.getTranslation(this.model.modelMatrix, this.model.position) |       // Cesium.Matrix4.getTranslation(this.model.modelMatrix, this.model.position) | ||||||
|       this.label && (this.label.show = this.label.show) |       this.label && (this.label.show = this.label.show) | ||||||
|       this.fuelLabel && (this.fuelLabel.show = this.fuelLabel.show) |  | ||||||
|       if (this.options.label.position) { |       if (this.options.label.position) { | ||||||
|         setTimeout(() => { |         setTimeout(() => { | ||||||
|           if (this.options.label.position.alt) { |           if (this.options.label.position.alt) { | ||||||
|             this.label && (this.label.position = [this.options.label.position.lng, this.options.label.position.lat, this.options.label.position.alt]) |             this.label && (this.label.position = [this.options.label.position.lng, this.options.label.position.lat, this.options.label.position.alt]) | ||||||
|             this.fuelLabel && (this.fuelLabel.position = [this.options.label.position.lng, this.options.label.position.lat, this.options.label.position.alt]) |  | ||||||
|           } |           } | ||||||
|           else { |           else { | ||||||
|             this.getClampToHeight({ lng: this.options.label.position.lng, lat: this.options.label.position.lat }).then((height) => { |             this.getClampToHeight({ lng: this.options.label.position.lng, lat: this.options.label.position.lat }).then((height) => { | ||||||
|               this.label && (this.label.position = [this.options.label.position.lng, this.options.label.position.lat, height]) |               this.label && (this.label.position = [this.options.label.position.lng, this.options.label.position.lat, height]) | ||||||
|               this.fuelLabel && (this.fuelLabel.position = [this.options.label.position.lng, this.options.label.position.lat, height]) |  | ||||||
|             }) |             }) | ||||||
|           } |           } | ||||||
|         }, 0) |         }, 0) | ||||||
| @ -1174,9 +1168,7 @@ class TrajectoryMotion extends Base { | |||||||
|       show = false |       show = false | ||||||
|     } |     } | ||||||
|     if (this.show) { |     if (this.show) { | ||||||
|       if (this.label) { |       this.label && (this.label.show = show) | ||||||
|         this.label.show = show |  | ||||||
|         this.label.pixelOffset = this.options.label.pixelOffset + (this.fuelShow ? this.labelFontSize + 20 : 0) |  | ||||||
|       if (this.options.label.position) { |       if (this.options.label.position) { | ||||||
|         setTimeout(() => { |         setTimeout(() => { | ||||||
|           if (this.options.label.position.alt) { |           if (this.options.label.position.alt) { | ||||||
| @ -1190,7 +1182,6 @@ class TrajectoryMotion extends Base { | |||||||
|         }, 0); |         }, 0); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     } |  | ||||||
|     else { |     else { | ||||||
|       this.label && (this.label.show = false) |       this.label && (this.label.show = false) | ||||||
|     } |     } | ||||||
| @ -1206,7 +1197,6 @@ class TrajectoryMotion extends Base { | |||||||
|   set labelFontFamily(v) { |   set labelFontFamily(v) { | ||||||
|     this.options.label.fontFamily = v || 0 |     this.options.label.fontFamily = v || 0 | ||||||
|     this.label && (this.label.fontFamily = this.options.label.fontFamily) |     this.label && (this.label.fontFamily = this.options.label.fontFamily) | ||||||
|     this.fuelLabel && (this.fuelLabel.fontFamily = this.options.label.fontFamily) |  | ||||||
|  |  | ||||||
|     let name = getFontFamilyName(this.labelFontFamily) || '' |     let name = getFontFamilyName(this.labelFontFamily) || '' | ||||||
|     this._elms.labelFontFamily && |     this._elms.labelFontFamily && | ||||||
| @ -1221,7 +1211,6 @@ class TrajectoryMotion extends Base { | |||||||
|   set labelColor(v) { |   set labelColor(v) { | ||||||
|     this.options.label.color = v |     this.options.label.color = v | ||||||
|     this.label && (this.label.color = v) |     this.label && (this.label.color = v) | ||||||
|     this.fuelLabel && (this.fuelLabel.color = v) |  | ||||||
|     if (this._elms.labelColor) { |     if (this._elms.labelColor) { | ||||||
|       this._elms.labelColor.forEach((item, i) => { |       this._elms.labelColor.forEach((item, i) => { | ||||||
|         let labelColorPicker = new YJColorPicker({ |         let labelColorPicker = new YJColorPicker({ | ||||||
| @ -1249,13 +1238,6 @@ class TrajectoryMotion extends Base { | |||||||
|   set labelFontSize(v) { |   set labelFontSize(v) { | ||||||
|     this.options.label.fontSize = v |     this.options.label.fontSize = v | ||||||
|     this.label && (this.label.fontSize = v) |     this.label && (this.label.fontSize = v) | ||||||
|     if (this.fuelLabel) { |  | ||||||
|       this.fuelLabel.fontSize = v |  | ||||||
|       this.label.pixelOffset = this.options.label.pixelOffset + v + 20 |  | ||||||
|     } |  | ||||||
|     else { |  | ||||||
|       this.label.pixelOffset = this.options.label.pixelOffset |  | ||||||
|     } |  | ||||||
|     this._elms.labelFontSize && this._elms.labelFontSize.forEach((item) => { |     this._elms.labelFontSize && this._elms.labelFontSize.forEach((item) => { | ||||||
|       item.value = v |       item.value = v | ||||||
|     }) |     }) | ||||||
| @ -1267,7 +1249,6 @@ class TrajectoryMotion extends Base { | |||||||
|   set labelScaleByDistance(v) { |   set labelScaleByDistance(v) { | ||||||
|     this.options.label.scaleByDistance = v |     this.options.label.scaleByDistance = v | ||||||
|     this.label && (this.label.scaleByDistance = v) |     this.label && (this.label.scaleByDistance = v) | ||||||
|     this.fuelLabel && (this.fuelLabel.scaleByDistance = v) |  | ||||||
|     this._elms.labelScaleByDistance && this._elms.labelScaleByDistance.forEach((item) => { |     this._elms.labelScaleByDistance && this._elms.labelScaleByDistance.forEach((item) => { | ||||||
|       item.checked = v |       item.checked = v | ||||||
|     }) |     }) | ||||||
| @ -1283,7 +1264,6 @@ class TrajectoryMotion extends Base { | |||||||
|     } |     } | ||||||
|     this.options.label.near = near |     this.options.label.near = near | ||||||
|     this.label && (this.label.near = near) |     this.label && (this.label.near = near) | ||||||
|     this.fuelLabel && (this.fuelLabel.near = near) |  | ||||||
|     this._elms.labelNear && this._elms.labelNear.forEach((item) => { |     this._elms.labelNear && this._elms.labelNear.forEach((item) => { | ||||||
|       item.value = near |       item.value = near | ||||||
|     }) |     }) | ||||||
| @ -1299,66 +1279,11 @@ class TrajectoryMotion extends Base { | |||||||
|     } |     } | ||||||
|     this.options.label.far = far |     this.options.label.far = far | ||||||
|     this.label && (this.label.far = far) |     this.label && (this.label.far = far) | ||||||
|     this.fuelLabel && (this.fuelLabel.far = far) |  | ||||||
|     this._elms.labelFar && this._elms.labelFar.forEach((item) => { |     this._elms.labelFar && this._elms.labelFar.forEach((item) => { | ||||||
|       item.value = far |       item.value = far | ||||||
|     }) |     }) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   get unitFuelConsumption() { |  | ||||||
|     return this.options.unitFuelConsumption |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   set unitFuelConsumption(v) { |  | ||||||
|     this.options.unitFuelConsumption = v |  | ||||||
|     this._elms.unitFuelConsumption && this._elms.unitFuelConsumption.forEach((item) => { |  | ||||||
|       item.value = v |  | ||||||
|     }) |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   get fuelShow() { |  | ||||||
|     return this.options.fuelShow |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   set fuelShow(v) { |  | ||||||
|     this.options.fuelShow = v |  | ||||||
|     let show = v |  | ||||||
|     if (this.show && (!this.showView || this.showView == 3)) { |  | ||||||
|       show = v |  | ||||||
|     } |  | ||||||
|     else { |  | ||||||
|       show = false |  | ||||||
|     } |  | ||||||
|     if (this.show) { |  | ||||||
|       if (this.fuelLabel) { |  | ||||||
|         this.fuelLabel.show = show |  | ||||||
|         this.label.pixelOffset = this.options.label.pixelOffset + (show ? this.labelFontSize + 20 : 0) |  | ||||||
|       } |  | ||||||
|       else { |  | ||||||
|         this.label.pixelOffset = this.options.label.pixelOffset |  | ||||||
|       } |  | ||||||
|       if (this.options.label.position) { |  | ||||||
|         setTimeout(() => { |  | ||||||
|           if (this.options.label.position.alt) { |  | ||||||
|             this.fuelLabel && (this.fuelLabel.position = [this.options.label.position.lng, this.options.label.position.lat, this.options.label.position.alt]) |  | ||||||
|           } |  | ||||||
|           else { |  | ||||||
|             this.getClampToHeight({ lng: this.options.label.position.lng, lat: this.options.label.position.lat }).then((height) => { |  | ||||||
|               this.fuelLabel && (this.fuelLabel.position = [this.options.label.position.lng, this.options.label.position.lat, height]) |  | ||||||
|             }) |  | ||||||
|           } |  | ||||||
|         }, 0); |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|     else { |  | ||||||
|       this.fuelLabel && (this.fuelLabel.show = false) |  | ||||||
|       this.label.pixelOffset = this.options.label.pixelOffset |  | ||||||
|     } |  | ||||||
|     this._elms.fuelShow && this._elms.fuelShow.forEach((item) => { |  | ||||||
|       item.checked = v |  | ||||||
|     }) |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   // 创建路径 |   // 创建路径 | ||||||
|   static addLine(that) { |   static addLine(that) { | ||||||
|     let positions_smooth = that.renewLinePositions(that.options.line.positions) |     let positions_smooth = that.renewLinePositions(that.options.line.positions) | ||||||
| @ -1477,7 +1402,6 @@ class TrajectoryMotion extends Base { | |||||||
|     } |     } | ||||||
|     let pos = that.smooth ? that.positions_smooth : Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArrayHeights) |     let pos = that.smooth ? that.positions_smooth : Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArrayHeights) | ||||||
|     TrajectoryMotion.createLabel(that) |     TrajectoryMotion.createLabel(that) | ||||||
|     TrajectoryMotion.createFuelLabel(that) |  | ||||||
|     that.modelMove(pos) |     that.modelMove(pos) | ||||||
|  |  | ||||||
|  |  | ||||||
| @ -1487,13 +1411,13 @@ class TrajectoryMotion extends Base { | |||||||
|   static async createLabel(that) { |   static async createLabel(that) { | ||||||
|     let labelPosition = that.cartesian3Towgs84(that.model.position, that.sdk.viewer) |     let labelPosition = that.cartesian3Towgs84(that.model.position, that.sdk.viewer) | ||||||
|     that.label = new LabelObject(that.sdk, { |     that.label = new LabelObject(that.sdk, { | ||||||
|       show: that.options.show ? (that.options.label.show ? true : false) : false, |       show: that.options.show ? (that.options.model.show ? that.options.label.show : false) : false, | ||||||
|       position: [labelPosition.lng, labelPosition.lat, labelPosition.alt], |       position: [labelPosition.lng, labelPosition.lat, labelPosition.alt], | ||||||
|       text: that.options.name, |       text: that.options.name, | ||||||
|       fontSize: that.options.label.fontSize, |       fontSize: that.options.label.fontSize, | ||||||
|       fontFamily: that.options.label.fontFamily, |       fontFamily: that.options.label.fontFamily, | ||||||
|       color: that.options.label.color, |       color: that.options.label.color, | ||||||
|       pixelOffset: that.options.label.pixelOffset + (that.options.fuelShow ? that.options.label.fontSize + 20 : 0), |       pixelOffset: that.options.label.pixelOffset, | ||||||
|       backgroundColor: that.options.label.backgroundColor, |       backgroundColor: that.options.label.backgroundColor, | ||||||
|       lineColor: that.options.label.lineColor, |       lineColor: that.options.label.lineColor, | ||||||
|       lineWidth: that.options.label.lineWidth, |       lineWidth: that.options.label.lineWidth, | ||||||
| @ -1503,26 +1427,6 @@ class TrajectoryMotion extends Base { | |||||||
|     }, that.model) |     }, that.model) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   static async createFuelLabel(that) { |  | ||||||
|     let labelPosition = that.cartesian3Towgs84(that.model.position, that.sdk.viewer) |  | ||||||
|     that.fuelLabel = new LabelObject(that.sdk, { |  | ||||||
|       show: that.options.show ? (that.options.fuelShow ? true : false) : false, |  | ||||||
|       // show: true, |  | ||||||
|       position: [labelPosition.lng, labelPosition.lat, labelPosition.alt], |  | ||||||
|       text: '总油耗:', |  | ||||||
|       fontSize: that.options.label.fontSize, |  | ||||||
|       fontFamily: that.options.label.fontFamily, |  | ||||||
|       color: that.options.label.color, |  | ||||||
|       pixelOffset: 0, |  | ||||||
|       backgroundColor: ['#6e6e6e', '#6e6e6e'], |  | ||||||
|       lineColor: '#00ffff00', |  | ||||||
|       lineWidth: 0, |  | ||||||
|       scaleByDistance: that.options.label.scaleByDistance, |  | ||||||
|       near: that.options.label.near, |  | ||||||
|       far: that.options.label.far |  | ||||||
|     }, that.model) |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   // 创建关键点 |   // 创建关键点 | ||||||
|   static async addKeyPoint(that) { |   static async addKeyPoint(that) { | ||||||
|     for (let i = 0; i < that.options.line.positions.length; i++) { |     for (let i = 0; i < that.options.line.positions.length; i++) { | ||||||
| @ -1627,8 +1531,8 @@ class TrajectoryMotion extends Base { | |||||||
|     else { |     else { | ||||||
|       setPosition(startDistance) |       setPosition(startDistance) | ||||||
|       setTimeout(() => { |       setTimeout(() => { | ||||||
|         _this.model.isMove = false |         _this.model && (_this.model.isMove = false) | ||||||
|       }, 1000); |       }, 500); | ||||||
|  |  | ||||||
|  |  | ||||||
|       animateUpdate() |       animateUpdate() | ||||||
| @ -1651,8 +1555,6 @@ class TrajectoryMotion extends Base { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     async function setPosition(distance) { |     async function setPosition(distance) { | ||||||
|       _this.totalFuelConsumption = Number((distance / 100 * _this.unitFuelConsumption).toFixed(2)) |  | ||||||
|       _this.fuelLabel.text = '总油耗:' + _this.totalFuelConsumption + ' L' |  | ||||||
|       _this.model.isMove = true |       _this.model.isMove = true | ||||||
|       let sdk2D = get2DView() |       let sdk2D = get2DView() | ||||||
|       let splitSdk = getSdk() |       let splitSdk = getSdk() | ||||||
| @ -1764,9 +1666,10 @@ class TrajectoryMotion extends Base { | |||||||
|         if (!cartesian3) { |         if (!cartesian3) { | ||||||
|           return |           return | ||||||
|         } |         } | ||||||
|         coordinates = _this.cartesian3Towgs84(cartesian3, viewer); |         let pos84 = _this.cartesian3Towgs84(cartesian3, viewer); | ||||||
|  |         coordinates = [pos84.lng, pos84.lat, pos84.alt + 1.8] | ||||||
|         position = cartesian3 |         position = cartesian3 | ||||||
|         positionCamera = Cesium.Cartesian3.fromDegrees(coordinates.lng, coordinates.lat, coordinates.alt + 1.8) |         positionCamera = Cesium.Cartesian3.fromDegrees(coordinates[0], coordinates[1], coordinates[2]) | ||||||
|         let positions_smooth = [] |         let positions_smooth = [] | ||||||
|         for (let i = 0; i <= 1000; i++) { |         for (let i = 0; i <= 1000; i++) { | ||||||
|           if ((i / 1000) > (distance / _this.distance)) { |           if ((i / 1000) > (distance / _this.distance)) { | ||||||
| @ -1864,7 +1767,6 @@ class TrajectoryMotion extends Base { | |||||||
|       } |       } | ||||||
|       let labelPosition = _this.cartesian3Towgs84(position, _this.sdk.viewer) |       let labelPosition = _this.cartesian3Towgs84(position, _this.sdk.viewer) | ||||||
|       _this.label.position = [labelPosition.lng, labelPosition.lat, labelPosition.alt] |       _this.label.position = [labelPosition.lng, labelPosition.lat, labelPosition.alt] | ||||||
|       _this.fuelLabel.position = [labelPosition.lng, labelPosition.lat, labelPosition.alt] |  | ||||||
|       lastDistance = distance |       lastDistance = distance | ||||||
|       // console.log(position) |       // console.log(position) | ||||||
|       _this.realTimeRouteArray.push(position) |       _this.realTimeRouteArray.push(position) | ||||||
| @ -1890,7 +1792,7 @@ class TrajectoryMotion extends Base { | |||||||
|           else { |           else { | ||||||
|             if (_this.sdk.viewer.trackedEntity) { |             if (_this.sdk.viewer.trackedEntity) { | ||||||
|               _this.sdk.viewer.camera.setView({ |               _this.sdk.viewer.camera.setView({ | ||||||
|                 destination: Cesium.Cartesian3.fromDegrees(coordinates.lng, coordinates.lat, _this.sdk.viewer.camera.positionCartographic.height), |                 destination: Cesium.Cartesian3.fromDegrees(coordinates[0], coordinates[1], _this.sdk.viewer.camera.positionCartographic.height), | ||||||
|                 orientation: { |                 orientation: { | ||||||
|                   heading: Cesium.Math.toRadians(-90), |                   heading: Cesium.Math.toRadians(-90), | ||||||
|                   pitch: 0, |                   pitch: 0, | ||||||
| @ -2186,7 +2088,7 @@ class TrajectoryMotion extends Base { | |||||||
|       rubricElm.style.color = '#ff5733'; |       rubricElm.style.color = '#ff5733'; | ||||||
|       rubricElm.style.display = 'none' |       rubricElm.style.display = 'none' | ||||||
|  |  | ||||||
|       rubricElm.innerHTML = `场景正东方向为轨迹前进正方向<div x-arrow="" class="custom__popper__arrow" style="left: 59px;"></div>` |       rubricElm.innerHTML = `场景正北方向为轨迹前进正方向<div x-arrow="" class="custom__popper__arrow" style="left: 59px;"></div>` | ||||||
|       let iconRubric = contentElm.getElementsByClassName('icon-rubric')[0] |       let iconRubric = contentElm.getElementsByClassName('icon-rubric')[0] | ||||||
|       iconRubric.addEventListener('mouseenter', (e) => { |       iconRubric.addEventListener('mouseenter', (e) => { | ||||||
|         rubricElm.style.display = 'block' |         rubricElm.style.display = 'block' | ||||||
| @ -2261,7 +2163,6 @@ class TrajectoryMotion extends Base { | |||||||
|     this.sdk.viewer.entities.remove(this.line) |     this.sdk.viewer.entities.remove(this.line) | ||||||
|     this.sdk.viewer.entities.remove(this.realTimeLine) |     this.sdk.viewer.entities.remove(this.realTimeLine) | ||||||
|     this.label && this.label.remove() |     this.label && this.label.remove() | ||||||
|     this.fuelLabel && this.fuelLabel.remove() |  | ||||||
|     for (let i = 0; i < this.keyPointShow.length; i++) { |     for (let i = 0; i < this.keyPointShow.length; i++) { | ||||||
|       this.sdk.viewer.entities.remove(this.keyPointShow[i]) |       this.sdk.viewer.entities.remove(this.keyPointShow[i]) | ||||||
|     } |     } | ||||||
| @ -2269,7 +2170,6 @@ class TrajectoryMotion extends Base { | |||||||
|     this.realTimeLine = null |     this.realTimeLine = null | ||||||
|     this.model = null |     this.model = null | ||||||
|     this.label = null |     this.label = null | ||||||
|     this.fuelLabel = null |  | ||||||
|     if (this._DialogObject && !this._DialogObject.isDestroy) { |     if (this._DialogObject && !this._DialogObject.isDestroy) { | ||||||
|       this._DialogObject.close() |       this._DialogObject.close() | ||||||
|       this._DialogObject = null |       this._DialogObject = null | ||||||
| @ -2323,7 +2223,6 @@ class TrajectoryMotion extends Base { | |||||||
|       this.model && (this.model.show = false) |       this.model && (this.model.show = false) | ||||||
|     } |     } | ||||||
|     this.labelShow = this.originalOptions.label.show |     this.labelShow = this.originalOptions.label.show | ||||||
|     this.fuelLabelShow = this.originalOptions.fuelShow |  | ||||||
|     this.labelColor = this.originalOptions.label.color |     this.labelColor = this.originalOptions.label.color | ||||||
|     this.labelFontSize = this.originalOptions.label.fontSize |     this.labelFontSize = this.originalOptions.label.fontSize | ||||||
|     this.labelFontFamily = this.originalOptions.label.fontFamily |     this.labelFontFamily = this.originalOptions.label.fontFamily | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user