Compare commits
	
		
			1 Commits
		
	
	
		
			master
			...
			56ad8ae7a0
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 56ad8ae7a0 | 
| @ -1,317 +0,0 @@ | |||||||
| import MouseTip from '../MouseTip' |  | ||||||
| import MouseEvent from '../Event' |  | ||||||
| import Draw from './draw' |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @extends Draw*/ |  | ||||||
| class DrawThreeRect extends Draw { |  | ||||||
|   /** |  | ||||||
|    * @constructor |  | ||||||
|    * @param [options] {object} 三点矩形属性 |  | ||||||
|    * @param [options.color=rgba(185,14,14,0.58)] {object} 线属性 |  | ||||||
|  |  | ||||||
|    * */ |  | ||||||
|   constructor(sdk, options = {}) { |  | ||||||
|     super(sdk, options) |  | ||||||
|     this.polygonHasCreated = false |  | ||||||
|     this.rectObject = [] |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   static create_polygon(that, viewer = that.viewer) { |  | ||||||
|     that.polygonHasCreated = true |  | ||||||
|     let id = that.randomString() |  | ||||||
|     viewer.entities.add( |  | ||||||
|       new Cesium.Entity({ |  | ||||||
|         id: id, |  | ||||||
|         polygon: { |  | ||||||
|           classificationType: Cesium.ClassificationType.BOTH, |  | ||||||
|           hierarchy: new Cesium.CallbackProperty((e) => { |  | ||||||
|             return new Cesium.PolygonHierarchy(that.positions) |  | ||||||
|           }), |  | ||||||
|           material: Cesium.Color.fromCssColorString(that.color), |  | ||||||
|           zIndex: 99999999 |  | ||||||
|         }, |  | ||||||
|         polyline: { |  | ||||||
|           positions: new Cesium.CallbackProperty((e) => { |  | ||||||
|             return that.positions.concat(that.positions[0]) |  | ||||||
|           }), |  | ||||||
|           width: 2, |  | ||||||
|           material: Cesium.Color.fromCssColorString('#c1c505').withAlpha(0.5), |  | ||||||
|           clampToGround: true, |  | ||||||
|           zIndex: 99999999 |  | ||||||
|         }, |  | ||||||
|       }) |  | ||||||
|     ) |  | ||||||
|     return id |  | ||||||
|   } |  | ||||||
|   computedLastPoint(arr) { |  | ||||||
|     const start = arr[0]; |  | ||||||
|     const end = arr[1]; |  | ||||||
|     // 计算点到线的距离 |  | ||||||
|     const directionVector = Cesium.Cartesian3.subtract(end, start, new Cesium.Cartesian3()); |  | ||||||
|     const pointToStart = Cesium.Cartesian3.subtract(arr[2], start, new Cesium.Cartesian3()); |  | ||||||
|     const projectionLength = Cesium.Cartesian3.dot(pointToStart, directionVector) / Cesium.Cartesian3.magnitudeSquared(directionVector); |  | ||||||
|     const projectionVector = Cesium.Cartesian3.multiplyByScalar(directionVector, projectionLength, new Cesium.Cartesian3()); |  | ||||||
|     const projectionPoint = Cesium.Cartesian3.add(start, projectionVector, new Cesium.Cartesian3()); |  | ||||||
|     const distance = Cesium.Cartesian3.distance(arr[2], projectionPoint) |  | ||||||
|  |  | ||||||
|     const perp = Cesium.Cartesian3.subtract(arr[2], projectionPoint, new Cesium.Cartesian3()); |  | ||||||
|     Cesium.Cartesian3.normalize(perp, perp); |  | ||||||
|     // 生成偏移向量 |  | ||||||
|     const offset = Cesium.Cartesian3.multiplyByScalar(perp, distance, new Cesium.Cartesian3()); |  | ||||||
|     let threePoint = Cesium.Cartesian3.add(end, offset, new Cesium.Cartesian3()) |  | ||||||
|     let lastPoint = Cesium.Cartesian3.add(start, offset, new Cesium.Cartesian3()) |  | ||||||
|     return [{ ...threePoint }, { ...lastPoint }] |  | ||||||
|   } |  | ||||||
|   /** |  | ||||||
|    * @desc 开始动态绘制面 |  | ||||||
|    * @method start |  | ||||||
|    * @param cb {function} 回调函数 |  | ||||||
|    * @memberOf DrawPolygon |  | ||||||
|    * @example draw.start((err,positions)=>{ |  | ||||||
|    * |  | ||||||
|    * }) |  | ||||||
|    * */ |  | ||||||
|   start(cb) { |  | ||||||
|     if (YJ.Measure.GetMeasureStatus()) { |  | ||||||
|       cb('上一次测量未结束') |  | ||||||
|     } else { |  | ||||||
|       this.polygonHasCreated = false |  | ||||||
|       super.start() |  | ||||||
|       YJ.Measure.SetMeasureStatus(true) |  | ||||||
|       let into |  | ||||||
|       this.tip = new MouseTip('左键确定,右键结束;CTRL+右键撤销', this.sdk) |  | ||||||
|       this.event = new MouseEvent(this.sdk) |  | ||||||
|       let cnt = 0 |  | ||||||
|       this.positions = [] |  | ||||||
|       this.positionsLine = [] |  | ||||||
|       this.points_ids = [] //存放左键点击时临时添加的point的id |  | ||||||
|       let cache_positions = [] |  | ||||||
|       let cache_84_position = [] |  | ||||||
|       this.event.mouse_left((movement, cartesian) => { |  | ||||||
|         if (into === '2D') { |  | ||||||
|           return |  | ||||||
|         } |  | ||||||
|         into = '3D' |  | ||||||
|         cnt++ |  | ||||||
|         this.positions = cache_positions.concat({ ...cartesian }) |  | ||||||
|         this.tip.setPosition( |  | ||||||
|           cartesian, |  | ||||||
|           movement.position.x, |  | ||||||
|           movement.position.y |  | ||||||
|         ) |  | ||||||
|         if (!this.polygonHasCreated) { |  | ||||||
|           let polyline_id = DrawThreeRect.create_polygon(this) |  | ||||||
|           this.points_ids.push(polyline_id) |  | ||||||
|         } |  | ||||||
|         cache_positions.push(cartesian) |  | ||||||
|         cache_84_position.push(this.cartesian3Towgs84(cartesian, this.viewer)) |  | ||||||
|         this.points_ids.push(this.create_point(cartesian)) |  | ||||||
|         if (cnt == 3) { |  | ||||||
|           this.end() |  | ||||||
|           cb(null, this.rectObject) |  | ||||||
|         } |  | ||||||
|       }) |  | ||||||
|       this.event.mouse_right((movement, cartesian) => { |  | ||||||
|         if (into === '2D') { |  | ||||||
|           return |  | ||||||
|         } |  | ||||||
|         // let positions = [] |  | ||||||
|         // console.log(cache_positions) |  | ||||||
|         // cache_positions.forEach((item) => { |  | ||||||
|         //   let p = this.cartesian3Towgs84(item) |  | ||||||
|         //   console.log(item) |  | ||||||
|         //   positions.push(p) |  | ||||||
|         // }) |  | ||||||
|         this.end() |  | ||||||
|         cb('取消', '') |  | ||||||
|       }) |  | ||||||
|       this.event.mouse_move((movement, cartesian) => { |  | ||||||
|         if (into === '2D') { |  | ||||||
|           return |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         // this.positions = cache_positions.concat({ ...cartesian }) |  | ||||||
|         this.tip.setPosition( |  | ||||||
|           cartesian, |  | ||||||
|           movement.endPosition.x, |  | ||||||
|           movement.endPosition.y |  | ||||||
|         ) |  | ||||||
|  |  | ||||||
|         if (cnt == 2) { |  | ||||||
|           let arr = JSON.parse(JSON.stringify(cache_positions)) |  | ||||||
|           let arr1 = arr.concat({ ...cartesian }) |  | ||||||
|           let pointArr = this.computedLastPoint(arr1) |  | ||||||
|           arr = arr.concat(pointArr) |  | ||||||
|           this.positions = arr |  | ||||||
|           let arr_84 = arr.map(item => { |  | ||||||
|             return this.cartesian3Towgs84(item, this.viewer) |  | ||||||
|           }) |  | ||||||
|           this.rectObject = arr_84 |  | ||||||
|         } |  | ||||||
|       }) |  | ||||||
|       this.event.mouse_right_keyboard_ctrl((movement, cartesian) => { |  | ||||||
|         if (into === '2D') { |  | ||||||
|           return |  | ||||||
|         } |  | ||||||
|         if (this.points_ids.length > 1) { |  | ||||||
|           this.remove_entity(this.points_ids.pop()) //移除point |  | ||||||
|           cache_positions.pop() |  | ||||||
|           cache_84_position.pop() |  | ||||||
|         } |  | ||||||
|       }) |  | ||||||
|  |  | ||||||
|       this.event.gesture_pinck_start_keyboard_ctrl(() => { |  | ||||||
|         if (into === '2D') { |  | ||||||
|           return |  | ||||||
|         } |  | ||||||
|         if (this.points_ids.length > 1) { |  | ||||||
|           this.remove_entity(this.points_ids.pop()) //移除point |  | ||||||
|           cache_positions.pop() |  | ||||||
|           cache_84_position.pop() |  | ||||||
|           this.positions = cache_positions.concat(cartesian) |  | ||||||
|         } |  | ||||||
|       }) |  | ||||||
|  |  | ||||||
|       this.event.gesture_pinck_start((movement, cartesian) => { |  | ||||||
|         if (into === '2D') { |  | ||||||
|           return |  | ||||||
|         } |  | ||||||
|         let startTime = new Date() |  | ||||||
|         this.event.gesture_pinck_end(() => { |  | ||||||
|           let endTime = new Date() |  | ||||||
|           if (endTime - startTime >= 500) { |  | ||||||
|             cb(null, cache_84_position) |  | ||||||
|             this.end() |  | ||||||
|           } |  | ||||||
|           else { |  | ||||||
|             this.tip.setPosition( |  | ||||||
|               cartesian, |  | ||||||
|               (movement.position1.x + movement.position2.x) / 2, |  | ||||||
|               (movement.position1.y + movement.position2.y) / 2 |  | ||||||
|             ) |  | ||||||
|             if (!this.polygonHasCreated) { |  | ||||||
|               let polyline_id = DrawThreeRect.create_polygon(this) |  | ||||||
|               this.points_ids.push(polyline_id) |  | ||||||
|             } |  | ||||||
|             cache_positions.push(cartesian) |  | ||||||
|             cache_84_position.push(this.cartesian3Towgs84(cartesian, this.viewer)) |  | ||||||
|             this.points_ids.push(this.create_point(cartesian)) |  | ||||||
|             this.positions = cache_positions.concat(cartesian) |  | ||||||
|           } |  | ||||||
|         }) |  | ||||||
|       }) |  | ||||||
|  |  | ||||||
|       if (!this._is2D && this._sdk2D) { |  | ||||||
|         this.event2D = new MouseEvent(this._sdk2D) |  | ||||||
|         this.event2D.mouse_left((movement, cartesian) => { |  | ||||||
|           if (into === '3D') { |  | ||||||
|             return |  | ||||||
|           } |  | ||||||
|           into = '2D' |  | ||||||
|           cnt++ |  | ||||||
|           this.positions = cache_positions.concat({ ...cartesian }) |  | ||||||
|           this.tip.setPosition( |  | ||||||
|             cartesian, |  | ||||||
|             movement.position.x + this.viewer.canvas.width, |  | ||||||
|             movement.position.y |  | ||||||
|           ) |  | ||||||
|           if (!this.polygonHasCreated) { |  | ||||||
|             let polyline_id = DrawThreeRect.create_polygon(this, this._sdk2D.viewer) |  | ||||||
|             this.points_ids.push(polyline_id) |  | ||||||
|           } |  | ||||||
|           cache_positions.push(cartesian) |  | ||||||
|           cache_84_position.push(this.cartesian3Towgs84(cartesian, this.viewer)) |  | ||||||
|           this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer)) |  | ||||||
|           if (cnt == 3) { |  | ||||||
|             this.end() |  | ||||||
|             cb(null, this.rectObject) |  | ||||||
|           } |  | ||||||
|         }) |  | ||||||
|         this.event2D.mouse_right((movement, cartesian) => { |  | ||||||
|           if (into === '3D') { |  | ||||||
|             return |  | ||||||
|           } |  | ||||||
|           this.end() |  | ||||||
|           cb('取消', '') |  | ||||||
|         }) |  | ||||||
|         this.event2D.mouse_move((movement, cartesian) => { |  | ||||||
|           if (into === '3D') { |  | ||||||
|             return |  | ||||||
|           } |  | ||||||
|           // this.positions = cache_positions.concat({ ...cartesian }) |  | ||||||
|           this.tip.setPosition( |  | ||||||
|             cartesian, |  | ||||||
|             movement.endPosition.x + this.viewer.canvas.width, |  | ||||||
|             movement.endPosition.y |  | ||||||
|           ) |  | ||||||
|  |  | ||||||
|           if (cnt == 2) { |  | ||||||
|             let arr = JSON.parse(JSON.stringify(cache_positions)) |  | ||||||
|             let arr1 = arr.concat({ ...cartesian }) |  | ||||||
|             let pointArr = this.computedLastPoint(arr1) |  | ||||||
|             arr = arr.concat(pointArr) |  | ||||||
|             this.positions = arr |  | ||||||
|             let arr_84 = arr.map(item => { |  | ||||||
|               return this.cartesian3Towgs84(item, this.viewer) |  | ||||||
|             }) |  | ||||||
|             this.rectObject = arr_84 |  | ||||||
|           } |  | ||||||
|         }) |  | ||||||
|         this.event2D.mouse_right_keyboard_ctrl((movement, cartesian) => { |  | ||||||
|           if (into === '3D') { |  | ||||||
|             return |  | ||||||
|           } |  | ||||||
|           if (this.points_ids.length > 1) { |  | ||||||
|             this.remove_entity(this.points_ids.pop()) //移除point |  | ||||||
|             cache_positions.pop() |  | ||||||
|             cache_84_position.pop() |  | ||||||
|           } |  | ||||||
|         }) |  | ||||||
|  |  | ||||||
|         this.event2D.gesture_pinck_start_keyboard_ctrl(() => { |  | ||||||
|           if (into === '3D') { |  | ||||||
|             return |  | ||||||
|           } |  | ||||||
|           if (this.points_ids.length > 1) { |  | ||||||
|             this.remove_entity(this.points_ids.pop()) //移除point |  | ||||||
|             cache_positions.pop() |  | ||||||
|             cache_84_position.pop() |  | ||||||
|             this.positions = cache_positions.concat(cartesian) |  | ||||||
|           } |  | ||||||
|         }) |  | ||||||
|  |  | ||||||
|         this.event2D.gesture_pinck_start((movement, cartesian) => { |  | ||||||
|           if (into === '3D') { |  | ||||||
|             return |  | ||||||
|           } |  | ||||||
|           let startTime = new Date() |  | ||||||
|           this.event2D.gesture_pinck_end(() => { |  | ||||||
|             let endTime = new Date() |  | ||||||
|             if (endTime - startTime >= 500) { |  | ||||||
|               cb(null, cache_84_position) |  | ||||||
|               this.end() |  | ||||||
|             } |  | ||||||
|             else { |  | ||||||
|               this.tip.setPosition( |  | ||||||
|                 cartesian, |  | ||||||
|                 ((movement.position1.x + movement.position2.x) / 2) + this.viewer.canvas.width, |  | ||||||
|                 (movement.position1.y + movement.position2.y) / 2 |  | ||||||
|               ) |  | ||||||
|               if (!this.polygonHasCreated) { |  | ||||||
|                 let polyline_id = DrawThreeRect.create_polygon(this, this._sdk2D.viewer) |  | ||||||
|                 this.points_ids.push(polyline_id) |  | ||||||
|               } |  | ||||||
|               cache_positions.push(cartesian) |  | ||||||
|               cache_84_position.push(this.cartesian3Towgs84(cartesian, this.viewer)) |  | ||||||
|               this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer)) |  | ||||||
|               this.positions = cache_positions.concat(cartesian) |  | ||||||
|             } |  | ||||||
|           }) |  | ||||||
|         }) |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| export default DrawThreeRect |  | ||||||
| @ -135,7 +135,6 @@ const open = async (sdk, options = {}, _Dialog = {}) => { | |||||||
|       pitch: viewer.camera.pitch, |       pitch: viewer.camera.pitch, | ||||||
|       roll: viewer.camera.roll |       roll: viewer.camera.roll | ||||||
|     } |     } | ||||||
|     tools.message({text: '操作成功'}) |  | ||||||
|   }) |   }) | ||||||
|  |  | ||||||
|   let totalTimeElm = contentElm.querySelector("input[name='totalTime']") |   let totalTimeElm = contentElm.querySelector("input[name='totalTime']") | ||||||
|  | |||||||
| @ -101,7 +101,6 @@ function getFlagFromKeyboard(key) { | |||||||
|  */ |  */ | ||||||
| function keyDown(event) { | function keyDown(event) { | ||||||
|   let _viewer = this |   let _viewer = this | ||||||
|  |  | ||||||
|   // 判断是否有输入框聚焦 |   // 判断是否有输入框聚焦 | ||||||
|   function isInputFocused() { |   function isInputFocused() { | ||||||
|     const activeElement = document.activeElement; |     const activeElement = document.activeElement; | ||||||
| @ -165,51 +164,32 @@ function keyUp(event) { | |||||||
|  * @return {*} |  * @return {*} | ||||||
|  */ |  */ | ||||||
| function keyboardMapRoamingRender(_viewer) { | function keyboardMapRoamingRender(_viewer) { | ||||||
|   if(!_viewer || !_viewer.scene || !_viewer.scene.screenSpaceCameraController.enableTilt) { |   if(!_viewer.scene.screenSpaceCameraController.enableTilt) { | ||||||
|     return |     return | ||||||
|   } |   } | ||||||
|   let camera = _viewer.camera; |   let camera = _viewer.camera; | ||||||
|   let ellipsoid = _viewer.scene.globe.ellipsoid; |   let ellipsoid = _viewer.scene.globe.ellipsoid; | ||||||
|   let cameraHeight = ellipsoid.cartesianToCartographic(camera.position).height; |   let cameraHeight = ellipsoid.cartesianToCartographic(camera.position).height; | ||||||
|   let cameraHeight2 = camera.positionCartographic.height; |  | ||||||
|  |  | ||||||
|  |  | ||||||
|   // 根据相机高度设置移动距离,比默认距离移动效果更好 |   // 根据相机高度设置移动距离,比默认距离移动效果更好 | ||||||
|   let moveRate = cameraHeight / 20.0; |   let moveRate = cameraHeight / 20.0; | ||||||
|   let rotationRate = moveRate / 500000 / Cesium.Math.toDegrees(camera.pitch); |   let rotationRate = moveRate / 500000 / Cesium.Math.toDegrees(camera.pitch); | ||||||
|   let moveRate2 = cameraHeight2 / 100.0; |  | ||||||
|  |  | ||||||
|   if (flags.moveForward) { |   if (flags.moveForward) { | ||||||
|     if(_viewer.scene.mode == 2) { |     // camera.moveForward(moveRate); | ||||||
|       camera.moveUp(moveRate2); |     camera.rotate(camera.right, -rotationRate); | ||||||
|     } |  | ||||||
|     else { |  | ||||||
|       camera.rotate(camera.right, -rotationRate); |  | ||||||
|     } |  | ||||||
|   } |   } | ||||||
|   if (flags.moveBackward) { |   if (flags.moveBackward) { | ||||||
|     if(_viewer.scene.mode == 2) { |     // camera.moveBackward(moveRate); | ||||||
|       camera.moveDown(moveRate2); |     camera.rotate(camera.right, rotationRate); | ||||||
|     } |  | ||||||
|     else { |  | ||||||
|       camera.rotate(camera.right, rotationRate); |  | ||||||
|     } |  | ||||||
|   } |   } | ||||||
|   if (flags.moveLeft) { |   if (flags.moveLeft) { | ||||||
|     if(_viewer.scene.mode == 2) { |     // camera.moveLeft(moveRate); | ||||||
|       camera.moveLeft(moveRate2); |     camera.rotate(camera.up, -rotationRate); | ||||||
|     } |  | ||||||
|     else { |  | ||||||
|       camera.rotate(camera.up, -rotationRate); |  | ||||||
|     } |  | ||||||
|   } |   } | ||||||
|   if (flags.moveRight) { |   if (flags.moveRight) { | ||||||
|     if(_viewer.scene.mode == 2) { |     // camera.moveRight(moveRate); | ||||||
|       camera.moveRight(moveRate2); |     camera.rotate(camera.up, rotationRate); | ||||||
|     } |  | ||||||
|     else { |  | ||||||
|       camera.rotate(camera.up, rotationRate); |  | ||||||
|     } |  | ||||||
|   } |   } | ||||||
|   if (flags.moveUp) { |   if (flags.moveUp) { | ||||||
|     camera.moveUp(moveRate); |     camera.moveUp(moveRate); | ||||||
|  | |||||||
| @ -1,578 +0,0 @@ | |||||||
| /** |  | ||||||
|  * @name: click |  | ||||||
|  * @author: Administrator |  | ||||||
|  * @date: 2023-05-28 11:05 |  | ||||||
|  * @description:click |  | ||||||
|  * @update: 2023-05-28 11:05 |  | ||||||
|  */ |  | ||||||
| let leftClickHandler = null |  | ||||||
| let rightClickHandler = null |  | ||||||
| let MoveHandler = null |  | ||||||
| let leftClickCallbackMap = new Map() |  | ||||||
| let rightClickCallbackMap = new Map() |  | ||||||
| let MoveCallbackMap = new Map() |  | ||||||
| let selectedFeature; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| function cartesian3Towgs84(cartesian, viewer) { |  | ||||||
|   var ellipsoid = viewer.scene.globe.ellipsoid |  | ||||||
|   var cartesian3 = new Cesium.Cartesian3( |  | ||||||
|     cartesian.x, |  | ||||||
|     cartesian.y, |  | ||||||
|     cartesian.z |  | ||||||
|   ) |  | ||||||
|   var cartographic = ellipsoid.cartesianToCartographic(cartesian3) |  | ||||||
|   var lat = Cesium.Math.toDegrees(cartographic.latitude) |  | ||||||
|   var lng = Cesium.Math.toDegrees(cartographic.longitude) |  | ||||||
|   var alt = cartographic.height < 0 ? 0 : cartographic.height |  | ||||||
|   return { |  | ||||||
|     lng: lng, |  | ||||||
|     lat: lat, |  | ||||||
|     alt: alt, |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| function getcartesian(sdk, movement) { |  | ||||||
|   if (movement.endPosition) { |  | ||||||
|     movement.endPosition.y -= 2 |  | ||||||
|   } |  | ||||||
|   let position = movement.position || movement.endPosition |  | ||||||
|   // 获取世界坐标系地表坐标,考虑地形,不包括模型,倾斜摄影模型表面; |  | ||||||
|   let cartesian = sdk.viewer.scene.pickPosition(position) |  | ||||||
|   if (!cartesian) { |  | ||||||
|     const ray = sdk.viewer.camera.getPickRay(position); //相交的射线 |  | ||||||
|     cartesian = sdk.viewer.scene.globe.pick(ray, sdk.viewer.scene); |  | ||||||
|   } |  | ||||||
|   return cartesian |  | ||||||
| } |  | ||||||
|  |  | ||||||
| function openLeftClick(sdk, cb) { |  | ||||||
|   if (!sdk || !sdk.viewer) { |  | ||||||
|     return |  | ||||||
|   } |  | ||||||
|   let click = true |  | ||||||
|   leftClickHandler = new Cesium.ScreenSpaceEventHandler(sdk.viewer.canvas) |  | ||||||
|   leftClickHandler.setInputAction((movement) => { |  | ||||||
|     let cartesian = sdk.viewer.scene.pickPosition(movement.position) |  | ||||||
|     if (!cartesian) { |  | ||||||
|       const ray = sdk.viewer.camera.getPickRay(movement.position); //相交的射线 |  | ||||||
|       cartesian = sdk.viewer.scene.globe.pick(ray, sdk.viewer.scene); |  | ||||||
|     } |  | ||||||
|     if (!cartesian) { |  | ||||||
|       return |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     let pos84 = cartesian3Towgs84(cartesian, sdk.viewer) |  | ||||||
|  |  | ||||||
|     cb && cb(pos84) |  | ||||||
|  |  | ||||||
|     if (click) { |  | ||||||
|       click = false |  | ||||||
|       setTimeout(() => { |  | ||||||
|         click = true |  | ||||||
|       }, 600); |  | ||||||
|       if (!YJ.Measure.GetMeasureStatus() && cartesian) { |  | ||||||
|         let flag = false |  | ||||||
|         for (let i = leftClickCallbackMap.size - 1; i >= 0; i--) { |  | ||||||
|           let key = Array.from(leftClickCallbackMap.keys())[i] |  | ||||||
|           let obj = leftClickCallbackMap.get(key) |  | ||||||
|           if (obj) { |  | ||||||
|  |  | ||||||
|             if (obj.that) { |  | ||||||
|               // 是否为多边形 |  | ||||||
|               if (obj.that.type === 'PolygonObject') { |  | ||||||
|                 // 是否可点击y |  | ||||||
|                 if (obj.that.picking) { |  | ||||||
|                   if (obj.that.options.positions && obj.that.options.positions.length >= 3) { |  | ||||||
|                     let pt = turf.point([pos84.lng, pos84.lat]); |  | ||||||
|                     let polyPos = [] |  | ||||||
|                     for (let i = 0; i < obj.that.options.positions.length; i++) { |  | ||||||
|                       polyPos.push([ |  | ||||||
|                         obj.that.options.positions[i].lng, |  | ||||||
|                         obj.that.options.positions[i].lat |  | ||||||
|                       ]) |  | ||||||
|                     } |  | ||||||
|                     polyPos.push([ |  | ||||||
|                       obj.that.options.positions[0].lng, |  | ||||||
|                       obj.that.options.positions[0].lat |  | ||||||
|                     ]) |  | ||||||
|                     let poly = turf.polygon([polyPos]); |  | ||||||
|                     let contain = turf.booleanPointInPolygon(pt, poly); |  | ||||||
|                     if (contain) { |  | ||||||
|                       obj.callback( |  | ||||||
|                         movement, |  | ||||||
|                         obj.that.options.id, |  | ||||||
|                         cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that) |  | ||||||
|                       flag = true |  | ||||||
|                       break |  | ||||||
|                     } |  | ||||||
|                   } |  | ||||||
|                 } |  | ||||||
|               } |  | ||||||
|               // 聚集地 |  | ||||||
|               else if (obj.that.type === 'AssembleObject') { |  | ||||||
|                 if (obj.that.picking) { |  | ||||||
|                   if (obj.that.options.positions && obj.that.options.positions.length >= 3) { |  | ||||||
|                     let positions = obj.that.computeAssemble(obj.that.options.positions, true) |  | ||||||
|                     let pt = turf.point([pos84.lng, pos84.lat]); |  | ||||||
|                     let polyPos = [] |  | ||||||
|                     for (let i = 0; i < positions.length; i += 2) { |  | ||||||
|                       polyPos.push([ |  | ||||||
|                         positions[i], |  | ||||||
|                         positions[i + 1] |  | ||||||
|                       ]) |  | ||||||
|                     } |  | ||||||
|                     let poly = turf.polygon([polyPos]); |  | ||||||
|                     let contain = turf.booleanPointInPolygon(pt, poly); |  | ||||||
|                     if (contain) { |  | ||||||
|                       obj.callback( |  | ||||||
|                         movement, |  | ||||||
|                         obj.that.options.id, |  | ||||||
|                         cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that) |  | ||||||
|                       flag = true |  | ||||||
|                       break |  | ||||||
|                     } |  | ||||||
|                   } |  | ||||||
|                 } |  | ||||||
|               } |  | ||||||
|               // 单箭头 |  | ||||||
|               else if (obj.that.type === 'AttackArrowObject') { |  | ||||||
|                 if (obj.that.picking) { |  | ||||||
|                   if (obj.that.options.positions && obj.that.options.positions.length >= 3) { |  | ||||||
|                     let pt = turf.point([pos84.lng, pos84.lat]); |  | ||||||
|                     let positions = obj.that.computeAttackArrow(obj.that.options.positions) |  | ||||||
|                     let polyPos = [] |  | ||||||
|                     for (let m = 0; m < positions.length; m++) { |  | ||||||
|                       let pos84 = cartesian3Towgs84(positions[m], sdk.viewer) |  | ||||||
|                       polyPos.push([pos84.lng, pos84.lat]) |  | ||||||
|                     } |  | ||||||
|                     let poly = turf.polygon([polyPos]); |  | ||||||
|                     let contain = turf.booleanPointInPolygon(pt, poly); |  | ||||||
|                     if (contain) { |  | ||||||
|                       obj.callback( |  | ||||||
|                         movement, |  | ||||||
|                         obj.that.options.id, |  | ||||||
|                         cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that) |  | ||||||
|                       flag = true |  | ||||||
|                       break |  | ||||||
|                     } |  | ||||||
|                   } |  | ||||||
|                 } |  | ||||||
|               } |  | ||||||
|               // 双箭头 |  | ||||||
|               else if (obj.that.type === 'PincerArrowObject') { |  | ||||||
|                 if (obj.that.picking) { |  | ||||||
|                   if (obj.that.options.positions && obj.that.options.positions.length >= 5) { |  | ||||||
|                     let pt = turf.point([pos84.lng, pos84.lat]); |  | ||||||
|                     let positions = obj.that.computePincerArrow(obj.that.options.positions) |  | ||||||
|                     let polyPos = [] |  | ||||||
|                     for (let m = 0; m < positions.length; m++) { |  | ||||||
|                       let pos84 = cartesian3Towgs84(positions[m], sdk.viewer) |  | ||||||
|                       polyPos.push([pos84.lng, pos84.lat]) |  | ||||||
|                     } |  | ||||||
|                     let pos84_0 = cartesian3Towgs84(positions[0], sdk.viewer) |  | ||||||
|                     polyPos.push([pos84_0.lng, pos84_0.lat]) |  | ||||||
|                     let poly = turf.polygon([polyPos]); |  | ||||||
|                     let contain = turf.booleanPointInPolygon(pt, poly); |  | ||||||
|                     if (contain) { |  | ||||||
|                       obj.callback( |  | ||||||
|                         movement, |  | ||||||
|                         obj.that.options.id, |  | ||||||
|                         cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that) |  | ||||||
|                       flag = true |  | ||||||
|                       break |  | ||||||
|                     } |  | ||||||
|                   } |  | ||||||
|                 } |  | ||||||
|               } |  | ||||||
|               // 圆 |  | ||||||
|               else if (obj.that.type === 'CircleObject') { |  | ||||||
|                 if (obj.that.picking) { |  | ||||||
|                   let pt = turf.point([pos84.lng, pos84.lat]); |  | ||||||
|                   if (obj.that.options.center && obj.that.options.radius) { |  | ||||||
|                     let center = [obj.that.options.center.lng, obj.that.options.center.lat]; |  | ||||||
|                     let radius = obj.that.options.radius / 1000; |  | ||||||
|                     let options = { steps: 360, units: 'kilometers' }; |  | ||||||
|                     let circle = turf.circle(center, radius, options); |  | ||||||
|                     let contain = turf.booleanPointInPolygon(pt, circle); |  | ||||||
|                     if (contain) { |  | ||||||
|                       obj.callback( |  | ||||||
|                         movement, |  | ||||||
|                         obj.that.options.id, |  | ||||||
|                         cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that) |  | ||||||
|                       flag = true |  | ||||||
|                       break |  | ||||||
|                     } |  | ||||||
|                   } |  | ||||||
|  |  | ||||||
|                 } |  | ||||||
|               } |  | ||||||
|               // 扇形 |  | ||||||
|               else if (obj.that.type === 'SectorObject') { |  | ||||||
|                 if (obj.that.picking) { |  | ||||||
|                   let pt = turf.point([pos84.lng, pos84.lat]); |  | ||||||
|                   if (obj.that.options.center && obj.that.options.radius && obj.that.options.startAngle && obj.that.options.endAngle) { |  | ||||||
|                     let positions = obj.that.calSector(obj.that.options.center, obj.that.options.radius, obj.that.options.startAngle, obj.that.options.endAngle, undefined, true) |  | ||||||
|                     let polyPos = [] |  | ||||||
|                     for (let m = 0; m < positions.length; m++) { |  | ||||||
|                       polyPos.push([positions[m].lng, positions[m].lat]) |  | ||||||
|                     } |  | ||||||
|                     let poly = turf.polygon([polyPos]); |  | ||||||
|                     let contain = turf.booleanPointInPolygon(pt, poly); |  | ||||||
|                     if (contain) { |  | ||||||
|                       obj.callback( |  | ||||||
|                         movement, |  | ||||||
|                         obj.that.options.id, |  | ||||||
|                         cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that) |  | ||||||
|                       flag = true |  | ||||||
|                       break |  | ||||||
|                     } |  | ||||||
|                   } |  | ||||||
|  |  | ||||||
|                 } |  | ||||||
|               } |  | ||||||
|             } |  | ||||||
|           } |  | ||||||
|         } |  | ||||||
|         if (!flag) { |  | ||||||
|           const pick = sdk.viewer.scene.pick(movement.position) |  | ||||||
|           if (pick) { |  | ||||||
|             if (pick.id) { |  | ||||||
|               let entityId |  | ||||||
|               // 矢量 |  | ||||||
|               if (pick.id.type && pick.id.type === 'vector' && pick.id.parentId) { |  | ||||||
|                 let obj = leftClickCallbackMap.get(pick.id.parentId) |  | ||||||
|                 if (obj.that.picking && obj.that.geojson) { |  | ||||||
|                   for (let i = 0; i < obj.that.geojson.features.length; i++) { |  | ||||||
|                     if (obj.that.geojson.features[i].id === pick.id._id) { |  | ||||||
|                       obj.callback( |  | ||||||
|                         movement, |  | ||||||
|                         obj.that.geojson.features[i].id, |  | ||||||
|                         cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that) |  | ||||||
|                     } |  | ||||||
|                   } |  | ||||||
|                 } |  | ||||||
|               } |  | ||||||
|               else if (typeof pick.id.id == 'string') { |  | ||||||
|                 let array = pick.id.id.split('-') |  | ||||||
|                 array.splice(array.length - 1, 1) |  | ||||||
|                 entityId = array.join('-') |  | ||||||
|               } |  | ||||||
|  |  | ||||||
|               if (pick.id.properties && pick.id.properties.id && leftClickCallbackMap.has(pick.id.properties.id._value)) { |  | ||||||
|                 let obj = leftClickCallbackMap.get(pick.id.properties.id._value) |  | ||||||
|                 if (obj.that.picking) { |  | ||||||
|                   obj.callback( |  | ||||||
|                     movement, |  | ||||||
|                     pick.id.properties.id._value, |  | ||||||
|                     cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that) |  | ||||||
|                 } |  | ||||||
|               } |  | ||||||
|               else if (leftClickCallbackMap.has(pick.id.id)) { |  | ||||||
|                 let obj = leftClickCallbackMap.get(pick.id.id) |  | ||||||
|                 if (obj.that.picking) { |  | ||||||
|                   obj.callback( |  | ||||||
|                     movement, |  | ||||||
|                     pick.id.id, |  | ||||||
|                     cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that) |  | ||||||
|                 } |  | ||||||
|               } |  | ||||||
|               else if (entityId && leftClickCallbackMap.has(entityId)) { |  | ||||||
|                 let obj = leftClickCallbackMap.get(entityId) |  | ||||||
|                 if (obj.that.picking) { |  | ||||||
|                   obj.callback( |  | ||||||
|                     movement, |  | ||||||
|                     entityId, |  | ||||||
|                     cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that) |  | ||||||
|                 } |  | ||||||
|               } |  | ||||||
|               else if (pick.primitive) { |  | ||||||
|                 if (typeof pick.id == 'string' && leftClickCallbackMap.has(pick.id)) { |  | ||||||
|                   let obj = leftClickCallbackMap.get(pick.id) |  | ||||||
|                   obj.callback( |  | ||||||
|                     movement, |  | ||||||
|                     pick.id, |  | ||||||
|                     cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that) |  | ||||||
|                 } |  | ||||||
|               } |  | ||||||
|             } |  | ||||||
|             else { |  | ||||||
|               if (pick.primitive && pick.primitive.id) { |  | ||||||
|                 if (leftClickCallbackMap.has(pick.primitive.id)) { |  | ||||||
|                   let obj = leftClickCallbackMap.get(pick.primitive.id) |  | ||||||
|                   if (obj.that.picking) { |  | ||||||
|                     if (obj.that.type === 'bim') { |  | ||||||
|                       if (YJ.Global.getBimPickStatus(sdk)) { |  | ||||||
|                         obj.callback( |  | ||||||
|                           movement, |  | ||||||
|                           pick.primitive, |  | ||||||
|                           cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that) |  | ||||||
|                       } |  | ||||||
|                     } |  | ||||||
|                     else { |  | ||||||
|                       obj.callback( |  | ||||||
|                         movement, |  | ||||||
|                         pick.primitive.id, |  | ||||||
|                         cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that) |  | ||||||
|                     } |  | ||||||
|                   } |  | ||||||
|                 } |  | ||||||
|               } |  | ||||||
|             } |  | ||||||
|             if (pick.content && (!pick.primitive || !pick.primitive.id)) { |  | ||||||
|               if (leftClickCallbackMap.has(pick.content.tileset.id)) { |  | ||||||
|                 let obj = leftClickCallbackMap.get(pick.content.tileset.id) |  | ||||||
|                 if (obj.that.picking) { |  | ||||||
|                   if (obj.that.type === 'bim') { |  | ||||||
|                     if (YJ.Global.getBimPickStatus(sdk)) { |  | ||||||
|                       obj.callback( |  | ||||||
|                         movement, |  | ||||||
|                         pick.content.tileset, |  | ||||||
|                         cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that) |  | ||||||
|                     } |  | ||||||
|                   } |  | ||||||
|                   else { |  | ||||||
|                     obj.callback( |  | ||||||
|                       movement, |  | ||||||
|                       pick.content.tileset.id, |  | ||||||
|                       cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that) |  | ||||||
|                   } |  | ||||||
|                 } |  | ||||||
|               } |  | ||||||
|             } |  | ||||||
|           } |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     // if (click) { |  | ||||||
|     //   click = false |  | ||||||
|     //   setTimeout(() => { |  | ||||||
|     //     click = true |  | ||||||
|     //   }, 300); |  | ||||||
|     //   if (!YJ.Measure.GetMeasureStatus()) { |  | ||||||
|  |  | ||||||
|     //   } |  | ||||||
|     // } |  | ||||||
|   }, Cesium.ScreenSpaceEventType.LEFT_CLICK) |  | ||||||
|  |  | ||||||
|   // leftClickHandler.setInputAction(function (movement) { |  | ||||||
|   //   const feature = sdk.viewer.scene.pick(movement.endPosition); |  | ||||||
|   //   // unselectFeature(selectedFeature); |  | ||||||
|   //   if (selectedFeature) { |  | ||||||
|   //     selectedFeature.color = Cesium.Color.WHITE; |  | ||||||
|   //   } |  | ||||||
|   //   selectedFeature = feature |  | ||||||
|   //   if (feature) { |  | ||||||
|   //     feature.color = Cesium.Color.YELLOW; |  | ||||||
|   //   } |  | ||||||
|   // }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); |  | ||||||
|   // } |  | ||||||
|  |  | ||||||
| } |  | ||||||
|  |  | ||||||
| function closeLeftClick(sdk) { |  | ||||||
|   leftClickHandler.destroy() //关闭事件句柄 |  | ||||||
|   leftClickHandler = null |  | ||||||
|   // } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| function openRightClick(sdk) { |  | ||||||
|   if (!sdk || !sdk.viewer) { |  | ||||||
|     return |  | ||||||
|   } |  | ||||||
|   rightClickHandler = new Cesium.ScreenSpaceEventHandler(sdk.viewer.canvas) |  | ||||||
|   rightClickHandler.setInputAction((movement) => { |  | ||||||
|     if (!YJ.Measure.GetMeasureStatus()) { |  | ||||||
|       const pick = sdk.viewer.scene.pick(movement.position) |  | ||||||
|       if (pick && pick.id) { |  | ||||||
|         let id |  | ||||||
|         if (pick.id.type && pick.id.type === 'vector' && pick.id.parentId) { |  | ||||||
|           let obj = rightClickCallbackMap.get(pick.id.parentId) |  | ||||||
|           if (obj.that.picking && obj.that.geojson) { |  | ||||||
|             for (let i = 0; i < obj.that.geojson.features.length; i++) { |  | ||||||
|               if (obj.that.geojson.features[i].id === pick.id._id) { |  | ||||||
|                 obj.callback( |  | ||||||
|                   movement, |  | ||||||
|                   obj.that.geojson.features[i].id, |  | ||||||
|                   cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that) |  | ||||||
|               } |  | ||||||
|             } |  | ||||||
|           } |  | ||||||
|         } |  | ||||||
|         else { |  | ||||||
|           if (typeof pick.id === 'string') { |  | ||||||
|             id = pick.id |  | ||||||
|           } |  | ||||||
|           else { |  | ||||||
|             id = pick.id.id |  | ||||||
|           } |  | ||||||
|           if (rightClickCallbackMap.has(id)) { |  | ||||||
|             let obj = rightClickCallbackMap.get(id) |  | ||||||
|             if (obj.that.picking) { |  | ||||||
|               let cartesian = getcartesian(sdk, movement) |  | ||||||
|               if (!cartesian) { |  | ||||||
|                 return |  | ||||||
|               } |  | ||||||
|               obj.callback( |  | ||||||
|                 movement, |  | ||||||
|                 id, |  | ||||||
|                 cartesian3Towgs84(cartesian, sdk.viewer), obj.that) |  | ||||||
|             } |  | ||||||
|           } |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|       if (pick && pick.content) { |  | ||||||
|         if (rightClickCallbackMap.has(pick.content.tileset.id)) { |  | ||||||
|           let obj = rightClickCallbackMap.get(pick.content.tileset.id) |  | ||||||
|           if (obj.that.picking) { |  | ||||||
|             if (obj.that.type === 'bim') { |  | ||||||
|               if (YJ.Global.getBimPickStatus(sdk)) { |  | ||||||
|                 let cartesian = getcartesian(sdk, movement) |  | ||||||
|                 if (!cartesian) { |  | ||||||
|                   return |  | ||||||
|                 } |  | ||||||
|                 obj.callback( |  | ||||||
|                   movement, |  | ||||||
|                   pick.getProperty('id'), |  | ||||||
|                   cartesian3Towgs84(cartesian, sdk.viewer), obj.that) |  | ||||||
|               } |  | ||||||
|             } |  | ||||||
|             else { |  | ||||||
|               let cartesian = getcartesian(sdk, movement) |  | ||||||
|               if (!cartesian) { |  | ||||||
|                 return |  | ||||||
|               } |  | ||||||
|               obj.callback( |  | ||||||
|                 movement, |  | ||||||
|                 pick.content.tileset.id, |  | ||||||
|                 cartesian3Towgs84(cartesian, sdk.viewer), obj.that) |  | ||||||
|             } |  | ||||||
|           } |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|   }, Cesium.ScreenSpaceEventType.RIGHT_CLICK) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| function closeRightClick() { |  | ||||||
|   if (rightClickHandler) { |  | ||||||
|     rightClickHandler.destroy() //关闭事件句柄 |  | ||||||
|     rightClickHandler = null |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| function openMove(sdk) { |  | ||||||
|   MoveHandler = new Cesium.ScreenSpaceEventHandler(sdk.viewer.canvas) |  | ||||||
|   MoveHandler.setInputAction(function (movement) { |  | ||||||
|     const pick = sdk.viewer.scene.pick(movement.endPosition); |  | ||||||
|     // unselectFeature(selectedFeature); |  | ||||||
|     // if (selectedFeature) { |  | ||||||
|     //   let color = '#fff' |  | ||||||
|     //   let state = selectedFeature.getProperty('state') |  | ||||||
|     //   switch (state) { |  | ||||||
|     //     case '0': |  | ||||||
|     //       color = '#fff' |  | ||||||
|     //       break; |  | ||||||
|     //     case '1': |  | ||||||
|     //       color = '#f00' |  | ||||||
|     //       break; |  | ||||||
|     //     case '2': |  | ||||||
|     //       color = '#0f0' |  | ||||||
|     //       break; |  | ||||||
|     //     case '3': |  | ||||||
|     //       color = '#00f' |  | ||||||
|     //       break; |  | ||||||
|     //     default: |  | ||||||
|     //   } |  | ||||||
|     //   selectedFeature.color = Cesium.Color.fromCssColorString(color).withAlpha(selectedFeature.tileset.transparency) |  | ||||||
|     // } |  | ||||||
|     // if (pick && pick.id) { } |  | ||||||
|     // if (pick && pick.content) { |  | ||||||
|     //   if (MoveCallbackMap.has(pick.content.tileset.id)) { |  | ||||||
|     //     let obj = MoveCallbackMap.get(pick.content.tileset.id) |  | ||||||
|     //     if (obj.that.picking) { |  | ||||||
|     //       if (obj.that.type === 'bim') { |  | ||||||
|     //         if (YJ.Global.getBimPickStatus(sdk)) { |  | ||||||
|     //           selectedFeature = pick |  | ||||||
|     //           pick.color = Cesium.Color.YELLOW; |  | ||||||
|     //         } |  | ||||||
|     //         else { |  | ||||||
|     //           selectedFeature = null |  | ||||||
|     //         } |  | ||||||
|     //       } |  | ||||||
|     //       else { |  | ||||||
|     //         selectedFeature = pick |  | ||||||
|     //         pick.color = Cesium.Color.YELLOW; |  | ||||||
|     //       } |  | ||||||
|     //     } |  | ||||||
|     //     else { |  | ||||||
|     //       selectedFeature = null |  | ||||||
|     //     } |  | ||||||
|     //   } |  | ||||||
|     // } |  | ||||||
|   }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| function closeMove() { |  | ||||||
|   if (MoveHandler) { |  | ||||||
|     MoveHandler.destroy() //关闭事件句柄 |  | ||||||
|     MoveHandler = null |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /*注册左键回调*/ |  | ||||||
| function regLeftClickCallback(id, callback, that) { |  | ||||||
|  |  | ||||||
|   leftClickCallbackMap.set(id, { callback, that }) |  | ||||||
| }/*取消左键回调*/ |  | ||||||
| function unRegLeftClickCallback(id,) { |  | ||||||
|   leftClickCallbackMap.delete(id,) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /*注册右键回调*/ |  | ||||||
| function regRightClickCallback(id, callback, that) { |  | ||||||
|   rightClickCallbackMap.set(id, { callback, that }) |  | ||||||
| }/*取消右键回调*/ |  | ||||||
| function unRegRightClickCallback(id,) { |  | ||||||
|   rightClickCallbackMap.delete(id,) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /*注册左键回调*/ |  | ||||||
| function regMoveCallback(id, callback, that) { |  | ||||||
|   MoveCallbackMap.set(id, { callback, that }) |  | ||||||
| }/*取消左键回调*/ |  | ||||||
| function unregMoveCallback(id,) { |  | ||||||
|   MoveCallbackMap.delete(id,) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| function getLeftClickState() { |  | ||||||
|   if (leftClickHandler) { |  | ||||||
|     return true |  | ||||||
|   } |  | ||||||
|   else { |  | ||||||
|     false |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| function getRightClickState() { |  | ||||||
|   if (rightClickHandler) { |  | ||||||
|     return true |  | ||||||
|   } |  | ||||||
|   else { |  | ||||||
|     false |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| function getMoveState() { |  | ||||||
|   if (MoveHandler) { |  | ||||||
|     return true |  | ||||||
|   } |  | ||||||
|   else { |  | ||||||
|     false |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| export { openLeftClick, closeLeftClick, regLeftClickCallback, unRegLeftClickCallback, openRightClick, closeRightClick, regRightClickCallback, unRegRightClickCallback, openMove, closeMove, regMoveCallback, unregMoveCallback, getLeftClickState, getRightClickState, getMoveState } |  | ||||||
| @ -7,9 +7,6 @@ import { CesiumContainer } from '../global' | |||||||
| import { off as offSplitScreen } from "../SplitScreen"; | import { off as offSplitScreen } from "../SplitScreen"; | ||||||
| import { FlwStatusSwitch, JwwStatusSwitch, getFlwStatus, getJwwStatus } from "../global" | import { FlwStatusSwitch, JwwStatusSwitch, getFlwStatus, getJwwStatus } from "../global" | ||||||
| import { SheetIndexStatusSwitch, getStatus } from '../SheetIndex' | import { SheetIndexStatusSwitch, getStatus } from '../SheetIndex' | ||||||
| import { getLeftClickState, getRightClickState, getMoveState } from "../../Global/ClickCallback" |  | ||||||
| import { openLeftClick, openRightClick, openMove } from "./ClickCallback" |  | ||||||
|  |  | ||||||
|  |  | ||||||
| let sdk2D | let sdk2D | ||||||
| let sdk3D | let sdk3D | ||||||
| @ -35,16 +32,6 @@ async function init(sdk) { | |||||||
|   }) |   }) | ||||||
|   sdk2.viewer.scene.mode = Cesium.SceneMode.SCENE2D |   sdk2.viewer.scene.mode = Cesium.SceneMode.SCENE2D | ||||||
|   sdk2D = await sdk2 |   sdk2D = await sdk2 | ||||||
|   if(getLeftClickState()) { |  | ||||||
|     openLeftClick(sdk2D) |  | ||||||
|   } |  | ||||||
|   if(getRightClickState()) { |  | ||||||
|     openRightClick(sdk2D) |  | ||||||
|   } |  | ||||||
|   if(getMoveState()) { |  | ||||||
|     openMove(sdk2D) |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   // window.sdk2D = sdk2D |   // window.sdk2D = sdk2D | ||||||
|   solveBug() |   solveBug() | ||||||
|   syncObject = { sdks: [sdk, sdk2], tools } |   syncObject = { sdks: [sdk, sdk2], tools } | ||||||
| @ -62,11 +49,7 @@ async function init(sdk) { | |||||||
|   sdk2D.viewer.imageryLayers.removeAll() |   sdk2D.viewer.imageryLayers.removeAll() | ||||||
|   for (let i = 0; i < imageryLayers.length; i++) { |   for (let i = 0; i < imageryLayers.length; i++) { | ||||||
|     let entity = sdk2D.viewer.imageryLayers.addImageryProvider(imageryLayers[i].imageryProvider, imageryLayers[i]._layerIndex) |     let entity = sdk2D.viewer.imageryLayers.addImageryProvider(imageryLayers[i].imageryProvider, imageryLayers[i]._layerIndex) | ||||||
|     if(imageryLayers[i]._id) { |  | ||||||
|       entity._id = imageryLayers[i]._id |  | ||||||
|     } |  | ||||||
|     entity.show = imageryLayers[i].show |     entity.show = imageryLayers[i].show | ||||||
|     entity.alpha = imageryLayers[i].alpha |  | ||||||
|     if (imageryLayers[i]._objectState) { |     if (imageryLayers[i]._objectState) { | ||||||
|       if (imageryLayers[i]._showView == 3) { |       if (imageryLayers[i]._showView == 3) { | ||||||
|         entity.show = false |         entity.show = false | ||||||
| @ -153,16 +136,11 @@ async function syncData2(sdk, id, entityId) { | |||||||
|         options.height = 0 |         options.height = 0 | ||||||
|       } |       } | ||||||
|  |  | ||||||
|       if (!that.type || (that.type !== 'tileset' && that.type !== 'bim' && that.type !== 'glb' && that.type !== 'layer' && that.type !== 'wallStereoscopic')) { |       if (!that.type || (that.type !== 'tileset' && that.type !== 'bim' && that.type !== 'glb' && that.type !== 'layer')) { | ||||||
|         if (that.showView == 3) { |         if (that.showView == 3) { | ||||||
|           options.show = false |           options.show = false | ||||||
|         } |         } | ||||||
|         let callback |         let newObject = await new that.constructor(sdk2D, options) | ||||||
|         if(that.type === 'TextBox') { |  | ||||||
|           callback = that.callback |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         let newObject = await new that.constructor(sdk2D, options, callback) |  | ||||||
|         newObject.onClick = that.onClick |         newObject.onClick = that.onClick | ||||||
|         newObject.onRightClick = that.onRightClick |         newObject.onRightClick = that.onRightClick | ||||||
|         newObject.onMouseMove = that.onMouseMove |         newObject.onMouseMove = that.onMouseMove | ||||||
| @ -249,7 +227,7 @@ async function syncData2(sdk, id, entityId) { | |||||||
|         obj.options.heightReference = 1 |         obj.options.heightReference = 1 | ||||||
|       } |       } | ||||||
|       let options = syncObject.tools.deepCopyObj(obj.options) |       let options = syncObject.tools.deepCopyObj(obj.options) | ||||||
|       if (!obj.type || (obj.type !== 'tileset' && obj.type !== 'bim' && obj.type !== 'glb' && obj.type !== 'layer' && obj.type !== 'wallStereoscopic')) { |       if (!obj.type || (obj.type !== 'tileset' && obj.type !== 'bim' && obj.type !== 'glb' && obj.type !== 'layer')) { | ||||||
|         if (obj.showView == 3) { |         if (obj.showView == 3) { | ||||||
|           options.show = false |           options.show = false | ||||||
|         } |         } | ||||||
| @ -257,11 +235,7 @@ async function syncData2(sdk, id, entityId) { | |||||||
|         if(target) { |         if(target) { | ||||||
|           await target.remove() |           await target.remove() | ||||||
|         } |         } | ||||||
|         let callback |         target = await new obj.constructor(sdk2D, options) | ||||||
|         if(obj.type === 'TextBox') { |  | ||||||
|           callback = obj.callback |  | ||||||
|         } |  | ||||||
|         target = await new obj.constructor(sdk2D, options, callback) |  | ||||||
|         target.onClick = obj.onClick |         target.onClick = obj.onClick | ||||||
|         target.onRightClick = obj.onRightClick |         target.onRightClick = obj.onRightClick | ||||||
|         target.onMouseMove = obj.onMouseMove |         target.onMouseMove = obj.onMouseMove | ||||||
|  | |||||||
| @ -102,20 +102,11 @@ function off() { | |||||||
|   let leftCanvas = leftBox.getElementsByTagName('canvas')[0] |   let leftCanvas = leftBox.getElementsByTagName('canvas')[0] | ||||||
|   leftBox.style.width = '100%' |   leftBox.style.width = '100%' | ||||||
|   leftCanvas.style.width = '100%' |   leftCanvas.style.width = '100%' | ||||||
|   let billboardAttributeBoxs = sdkP.viewer._element.getElementsByClassName('billboard-attribute-box') |  | ||||||
|   for (let i = 0; i < billboardAttributeBoxs.length; i++) { |  | ||||||
|     billboardAttributeBoxs[i].style.display = 'block' |  | ||||||
|   } |  | ||||||
|   sdkP = null |   sdkP = null | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| async function init(sdk) { | async function init(sdk) { | ||||||
|   let billboardAttributeBoxs = sdk.viewer._element.getElementsByClassName('billboard-attribute-box') |  | ||||||
|   for (let i = 0; i < billboardAttributeBoxs.length; i++) { |  | ||||||
|     billboardAttributeBoxs[i].style.display = 'none' |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   sdk.entityMap.forEach((item, key) => { |   sdk.entityMap.forEach((item, key) => { | ||||||
|     if (item.type && item.type == 'TrajectoryMotion' && item.viewFollow) { |     if (item.type && item.type == 'TrajectoryMotion' && item.viewFollow) { | ||||||
|       item.viewFollow = false |       item.viewFollow = false | ||||||
| @ -146,8 +137,10 @@ async function init(sdk) { | |||||||
|   rightElm.style.position = 'absolute' |   rightElm.style.position = 'absolute' | ||||||
|   rightElm.style.right = 'calc(50% - 50px)' |   rightElm.style.right = 'calc(50% - 50px)' | ||||||
|  |  | ||||||
|   leftElm.style.display = 'none' |   if (!activeIds || activeIds.length == 0) { | ||||||
|   rightElm.style.display = 'none' |     leftElm.style.display = 'none' | ||||||
|  |     rightElm.style.display = 'none' | ||||||
|  |   } | ||||||
|  |  | ||||||
|   sdk.viewer._element.appendChild(leftElm) |   sdk.viewer._element.appendChild(leftElm) | ||||||
|   sdk.viewer._element.appendChild(rightElm) |   sdk.viewer._element.appendChild(rightElm) | ||||||
| @ -156,12 +149,6 @@ async function init(sdk) { | |||||||
|   let right = 0 |   let right = 0 | ||||||
|   if (activeIds) { |   if (activeIds) { | ||||||
|     for (let i = 0; i < activeIds.length; i++) { |     for (let i = 0; i < activeIds.length; i++) { | ||||||
|       let thatP = sdk.entityMap.get(activeIds[i]) |  | ||||||
|       if (!thatP || (thatP.type === 'terrain' || !thatP.show) || thatP.type === 'TextBox') { |  | ||||||
|         continue |  | ||||||
|       } |  | ||||||
|       leftElm.style.display = 'unset' |  | ||||||
|       rightElm.style.display = 'unset' |  | ||||||
|       let status = statusMap.get(activeIds[i]) |       let status = statusMap.get(activeIds[i]) | ||||||
|       if (status) { |       if (status) { | ||||||
|         if (status.P) { |         if (status.P) { | ||||||
| @ -924,7 +911,7 @@ async function setSplitDirection(v, id, isoff = false, entityId) { | |||||||
|           } |           } | ||||||
|           if (thatP.type === 'GroundSvg' && thatP.text) { |           if (thatP.type === 'GroundSvg' && thatP.text) { | ||||||
|             thatP.text.show = thatP.textShow |             thatP.text.show = thatP.textShow | ||||||
|             target && (target.textShow = false) |             target.textShow = false | ||||||
|           } |           } | ||||||
|           if (thatP.label && thatP.labelShow) { |           if (thatP.label && thatP.labelShow) { | ||||||
|             thatP.label.entity.show = true |             thatP.label.entity.show = true | ||||||
| @ -1294,8 +1281,6 @@ function setActiveId(ids = []) { | |||||||
|   } |   } | ||||||
|   else { |   else { | ||||||
|     if (leftElm && rightElm) { |     if (leftElm && rightElm) { | ||||||
|       leftElm.style.display = 'none' |  | ||||||
|       rightElm.style.display = 'none' |  | ||||||
|       let left = 0 |       let left = 0 | ||||||
|       let right = 0 |       let right = 0 | ||||||
|       for (let i = 0; i < activeIds.length; i++) { |       for (let i = 0; i < activeIds.length; i++) { | ||||||
| @ -1313,8 +1298,10 @@ function setActiveId(ids = []) { | |||||||
|  |  | ||||||
|  |  | ||||||
|         let thatP = sdkP.entityMap.get(activeIds[i]) |         let thatP = sdkP.entityMap.get(activeIds[i]) | ||||||
|         // let thatD = sdkD.entityMap.get(activeIds[i]) |         let thatD = sdkD.entityMap.get(activeIds[i]) | ||||||
|         if (!thatP || (thatP.type === 'terrain' || !thatP.show) || thatP.type === 'TextBox') { |         if (!thatP || (thatP.type === 'terrain' || !thatP.show)) { | ||||||
|  |           leftElm.style.display = 'none' | ||||||
|  |           rightElm.style.display = 'none' | ||||||
|           continue |           continue | ||||||
|         } |         } | ||||||
|         leftElm.style.display = 'unset' |         leftElm.style.display = 'unset' | ||||||
|  | |||||||
| @ -1,89 +1,45 @@ | |||||||
| class EventBinding { | class eventBinding { | ||||||
|   constructor() { |   constructor() { | ||||||
|     this.element = {} |     this.element = {} | ||||||
|   } |   } | ||||||
|   static event = {} |   static event = {} | ||||||
|  |  | ||||||
|   getEvent(name) { |   getEvent(name) { | ||||||
|     return EventBinding.event[name] |     return eventBinding.event[name] | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   getEventAll() { |   getEventAll() { | ||||||
|     return EventBinding.event |     return eventBinding.event | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   setEvent(name, event) { |   setEvent(name, event) { | ||||||
|     EventBinding.event[name] = event |     eventBinding.event[name] = event | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   on(that, elements) { |   on(that, elements) { | ||||||
|     this.element = {} |  | ||||||
|     for (let i = 0; i < elements.length; i++) { |     for (let i = 0; i < elements.length; i++) { | ||||||
|  |       let Event = [] | ||||||
|  |       let isEvent = false | ||||||
|  |       let removeName = [] | ||||||
|       if (!elements[i] || !elements[i].attributes) { |       if (!elements[i] || !elements[i].attributes) { | ||||||
|         continue; |         continue; | ||||||
|       } |       } | ||||||
|       let Event = { |  | ||||||
|         'input': [], |  | ||||||
|         'change': [], |  | ||||||
|         'blur': [], |  | ||||||
|         'click': [] |  | ||||||
|       } |  | ||||||
|       let isEvent = false |  | ||||||
|       let removeName = [] |  | ||||||
|       for (let m of elements[i].attributes) { |       for (let m of elements[i].attributes) { | ||||||
|         switch (m.name) { |         switch (m.name) { | ||||||
|           case '@model': { |           case '@model': { | ||||||
|             isEvent = true |             isEvent = true | ||||||
|             if (elements[i].type == 'checkbox') { |             if (elements[i].type == 'checkbox') { | ||||||
|               Event.change.push((e) => { that[m.value] = e.target.checked }) |               Event.push((e) => { that[m.value] = e.target.checked }) | ||||||
|               elements[i].checked = that[m.value] |               elements[i].checked = that[m.value] | ||||||
|             } |             } | ||||||
|             else { |             else { | ||||||
|               if (elements[i].type == 'number') { |               Event.push((e) => { | ||||||
|                 Event.input.push((e) => { |                 let value = e.target.value | ||||||
|                   if (e.target.value || e.target.value === 0) { |                 if (e.target.type == 'number') { | ||||||
|                     let value = e.target.value |                   value = Number(value) | ||||||
|                     value = Number(value) |                 } | ||||||
|                     if (e.data != '.' && (e.data != '-' || e.target.value)) { |                 that[m.value] = value | ||||||
|                       if (((!e.target.max) && (!e.target.min)) || ((value <= Number(e.target.max)) && value >= Number(e.target.min))) { |               }) | ||||||
|                         // that[m.value] = value |  | ||||||
|                         value = value |  | ||||||
|                       } |  | ||||||
|                       if ((e.target.max) && value > Number(e.target.max)) { |  | ||||||
|                         value = Number(e.target.max) |  | ||||||
|                       } |  | ||||||
|                       if ((e.target.min) && value < Number(e.target.min)) { |  | ||||||
|                         value = Number(e.target.min) |  | ||||||
|                       } |  | ||||||
|                       // if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) { |  | ||||||
|                       //   value = Number(e.target.dataset.min) |  | ||||||
|                       // } |  | ||||||
|                       that[m.value] = value |  | ||||||
|                     } |  | ||||||
|                   } |  | ||||||
|                 }) |  | ||||||
|                 Event.blur.push((e) => { |  | ||||||
|                   let value = e.target.value |  | ||||||
|                   if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) { |  | ||||||
|                     value = Number(value) |  | ||||||
|                     if ((e.target.max) && value > Number(e.target.max)) { |  | ||||||
|                       value = Number(e.target.max) |  | ||||||
|                     } |  | ||||||
|                     if ((e.target.min) && value < Number(e.target.min)) { |  | ||||||
|                       value = Number(e.target.min) |  | ||||||
|                     } |  | ||||||
|                     if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) { |  | ||||||
|                       value = Number(e.target.dataset.min) |  | ||||||
|                     } |  | ||||||
|                   } |  | ||||||
|                   that[m.value] = value |  | ||||||
|                 }) |  | ||||||
|               } |  | ||||||
|               else { |  | ||||||
|                 Event.input.push((e) => { |  | ||||||
|                   that[m.value] = e.target.value |  | ||||||
|                 }) |  | ||||||
|               } |  | ||||||
|               if (elements[i].nodeName == 'IMG') { |               if (elements[i].nodeName == 'IMG') { | ||||||
|                 elements[i].src = that[m.value] |                 elements[i].src = that[m.value] | ||||||
|               } |               } | ||||||
| @ -101,13 +57,13 @@ class EventBinding { | |||||||
|             break; |             break; | ||||||
|           } |           } | ||||||
|           case '@click': { |           case '@click': { | ||||||
|             isEvent = true |             elements[i].addEventListener('click', (e) => { | ||||||
|             Event.click.push((e) => { |               if (typeof (that.Dialog[m.value]) === 'function') { | ||||||
|               if (typeof (that[m.value]) === 'function') { |                 that.Dialog[m.value](e) | ||||||
|                 that[m.value](e) |  | ||||||
|               } |               } | ||||||
|             }) |             }); | ||||||
|             removeName.push(m.name) |             removeName.push(m.name) | ||||||
|  |             // elements[i].attributes.removeNamedItem(m.name) | ||||||
|             break; |             break; | ||||||
|           } |           } | ||||||
|         } |         } | ||||||
| @ -118,18 +74,19 @@ class EventBinding { | |||||||
|       } |       } | ||||||
|  |  | ||||||
|       if (isEvent) { |       if (isEvent) { | ||||||
|         for (let key in Event) { |         let ventType = 'input' | ||||||
|           if (Event[key].length > 0) { |         if (elements[i].tagName != 'INPUT' || elements[i].type == 'checkbox') { | ||||||
|             elements[i].addEventListener(key, (e) => { |           ventType = 'change' | ||||||
|               for (let t = 0; t < Event[key].length; t++) { |  | ||||||
|                 Event[key][t](e) |  | ||||||
|               } |  | ||||||
|             }); |  | ||||||
|           } |  | ||||||
|         } |         } | ||||||
|  |         elements[i].addEventListener(ventType, (e) => { | ||||||
|  |           for (let t = 0; t < Event.length; t++) { | ||||||
|  |             Event[t](e) | ||||||
|  |           } | ||||||
|  |         }); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | const EventBinding = new eventBinding(); | ||||||
| export default EventBinding; | export default EventBinding; | ||||||
|  | |||||||
| @ -3,7 +3,7 @@ | |||||||
|  */ |  */ | ||||||
| import Dialog from '../../../Obj/Element/Dialog'; | import Dialog from '../../../Obj/Element/Dialog'; | ||||||
| import { html } from "./_element"; | import { html } from "./_element"; | ||||||
| import EventBinding from './eventBinding'; | import EventBinding from '../../../Obj/Element/Dialog/eventBinding'; | ||||||
| import { syncData } from '../../MultiViewportMode' | import { syncData } from '../../MultiViewportMode' | ||||||
| import Tools from '../../../Tools' | import Tools from '../../../Tools' | ||||||
| import TimeLine from './TimeLine' | import TimeLine from './TimeLine' | ||||||
| @ -80,10 +80,6 @@ export default class Sunshine { | |||||||
|   } |   } | ||||||
|   set speed(v) { |   set speed(v) { | ||||||
|     this.options.speed = v |     this.options.speed = v | ||||||
|     this._elms.speed && |  | ||||||
|       this._elms.speed.forEach(item => { |  | ||||||
|         item.value = v |  | ||||||
|       }) |  | ||||||
|     this.viewer.clock.multiplier = this.options.speed; |     this.viewer.clock.multiplier = this.options.speed; | ||||||
|     this.timeLine.setSpeed(v) |     this.timeLine.setSpeed(v) | ||||||
|   } |   } | ||||||
|  | |||||||
| @ -9,7 +9,7 @@ export default class TimeLine { | |||||||
|     this.timelineCon = document.getElementsByClassName('timeline-container')[0]; |     this.timelineCon = document.getElementsByClassName('timeline-container')[0]; | ||||||
|     this.speed = speed; |     this.speed = speed; | ||||||
|     this.animationId; |     this.animationId; | ||||||
|     this.startTime = performance.now(); |     this.startTime = Date.now(); | ||||||
|     this.manualPosition = null; |     this.manualPosition = null; | ||||||
|     this.isDragging = false; |     this.isDragging = false; | ||||||
|     this.pauseed = false; |     this.pauseed = false; | ||||||
| @ -28,7 +28,9 @@ export default class TimeLine { | |||||||
|         document.getElementsByClassName('time-marks')[0].appendChild(label) |         document.getElementsByClassName('time-marks')[0].appendChild(label) | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     that.startTime = performance.now() - ((that.manualPosition || 0) * 86400 * 1000 / that.speed); |  | ||||||
|  |  | ||||||
|  |     that.startTime = Date.now() - ((that.manualPosition || 0) * 86400 * 1000 / that.speed); | ||||||
|  |  | ||||||
|     that.timeline.addEventListener('mousedown', (e) => { |     that.timeline.addEventListener('mousedown', (e) => { | ||||||
|       if (e.srcElement.className === 'handle') { |       if (e.srcElement.className === 'handle') { | ||||||
| @ -55,22 +57,21 @@ export default class TimeLine { | |||||||
|     document.getElementById('timePause').addEventListener('click', function () { |     document.getElementById('timePause').addEventListener('click', function () { | ||||||
|       that.pauseed = !that.pauseed; |       that.pauseed = !that.pauseed; | ||||||
|       if (that.pauseed) {//暂停 |       if (that.pauseed) {//暂停 | ||||||
|         that.pausedTime = performance.now(); // 记录暂停时刻 |  | ||||||
|         document.getElementById('timePause').textContent = '播放'; |         document.getElementById('timePause').textContent = '播放'; | ||||||
|         that.animationId && cancelAnimationFrame(that.animationId); |         that.animationId && cancelAnimationFrame(that.animationId); | ||||||
|  |         that.pausedTime = Date.now(); // 记录暂停时刻 | ||||||
|         that.sdk.viewer.clock.shouldAnimate = false |         that.sdk.viewer.clock.shouldAnimate = false | ||||||
|       } else {//播放 |       } else {//播放 | ||||||
|         let now = performance.now() |  | ||||||
|         const pausedDuration = now - that.pausedTime; |  | ||||||
|         document.getElementById('timePause').textContent = '暂停'; |         document.getElementById('timePause').textContent = '暂停'; | ||||||
|         that.manualPosition = null |         that.manualPosition = null | ||||||
|  |         const pausedDuration = Date.now() - that.pausedTime; | ||||||
|         that.startTime += pausedDuration; // 补偿暂停期间的时间差 |         that.startTime += pausedDuration; // 补偿暂停期间的时间差 | ||||||
|  |  | ||||||
|         if (that.changeDate) {//切换日期后让时间从0开始 |         if (that.changeDate) {//切换日期后让时间从0开始 | ||||||
|           if (that.changeDateGrag) { |           if (that.changeDateGrag) { | ||||||
|             that.changeDateGrag = undefined |             that.changeDateGrag = undefined | ||||||
|           } else { |           } else { | ||||||
|             that.startTime = now |             that.startTime = Date.now() | ||||||
|           } |           } | ||||||
|           that.changeDate = undefined |           that.changeDate = undefined | ||||||
|         } |         } | ||||||
| @ -87,14 +88,14 @@ export default class TimeLine { | |||||||
|         that.isDragging = false; |         that.isDragging = false; | ||||||
|         if (that.manualPosition !== null) { |         if (that.manualPosition !== null) { | ||||||
|           // that.sdk.viewer.clock.shouldAnimate = true |           // that.sdk.viewer.clock.shouldAnimate = true | ||||||
|           that.startTime = performance.now() - (that.manualPosition * 86400 * 1000 / that.speed); |           that.startTime = Date.now() - (that.manualPosition * 86400 * 1000 / that.speed); | ||||||
|           that.manualPosition = null; |           that.manualPosition = null; | ||||||
|           that.changeDate && (that.changeDateGrag = true) |           that.changeDate && (that.changeDateGrag = true) | ||||||
|           if (!that.pauseed) { |           if (!that.pauseed) { | ||||||
|             that.update() |             that.update() | ||||||
|             func(that.time) |             func(that.time) | ||||||
|           } else { |           } else { | ||||||
|             that.pausedTime = performance.now(); // 记录暂停时刻 |             that.pausedTime = Date.now(); // 记录暂停时刻 | ||||||
|             func(that.currentTime.textContent) |             func(that.currentTime.textContent) | ||||||
|           } |           } | ||||||
|  |  | ||||||
| @ -112,9 +113,9 @@ export default class TimeLine { | |||||||
|   update() { |   update() { | ||||||
|     if (this.manualPosition !== null) return; |     if (this.manualPosition !== null) return; | ||||||
|     if (this.changeDate) {//切换日期后让时间从0开始 |     if (this.changeDate) {//切换日期后让时间从0开始 | ||||||
|       this.startTime = performance.now() |       this.startTime = Date.now() | ||||||
|     } |     } | ||||||
|     let elapsed = (performance.now() - this.startTime) * this.speed; |     let elapsed = (Date.now() - this.startTime) * this.speed; | ||||||
|     // if (this.elapsed) { |     // if (this.elapsed) { | ||||||
|     //   elapsed = elapsed + this.elapsed |     //   elapsed = elapsed + this.elapsed | ||||||
|     //   this.elapsed = undefined |     //   this.elapsed = undefined | ||||||
| @ -132,23 +133,23 @@ export default class TimeLine { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   setSpeed(v) { |   setSpeed(v) { | ||||||
|     let now = performance.now() |  | ||||||
|     if (!this.pauseed) { |     if (!this.pauseed) { | ||||||
|       const currentProgress = this.manualPosition ?? |       const currentProgress = this.manualPosition ?? | ||||||
|         (performance.now() - this.startTime) * this.speed / (86400 * 1000); |         (Date.now() - this.startTime) * this.speed / (86400 * 1000); | ||||||
|       this.speed = v; |       this.speed = v; | ||||||
|       this.startTime = performance.now() - (currentProgress * 86400 * 1000 / this.speed); |       this.startTime = Date.now() - (currentProgress * 86400 * 1000 / this.speed); | ||||||
|  |  | ||||||
|     } else { |     } else { | ||||||
|       let pausedDuration = now - this.pausedTime; |       let pausedDuration = Date.now() - this.pausedTime; | ||||||
|       this.startTime += pausedDuration; // 补偿暂停期间的时间差 |       this.startTime += pausedDuration; // 补偿暂停期间的时间差 | ||||||
|       const currentProgress = this.manualPosition ?? |  | ||||||
|         (now - this.startTime) * this.speed / (86400 * 1000); |  | ||||||
|       this.speed = v; |  | ||||||
|       this.startTime = now - (currentProgress * 86400 * 1000 / this.speed); |  | ||||||
|  |  | ||||||
|       this.pausedTime = now; // 记录切换speed暂停时刻 |       const currentProgress = this.manualPosition ?? | ||||||
|       // this.speed = v; |         (Date.now() - this.startTime) * this.speed / (86400 * 1000); | ||||||
|  |       this.speed = v; | ||||||
|  |       this.startTime = Date.now() - (currentProgress * 86400 * 1000 / this.speed); | ||||||
|  |  | ||||||
|  |       this.pausedTime = Date.now(); // 记录切换speed暂停时刻 | ||||||
|  |       this.speed = v; | ||||||
|     } |     } | ||||||
|     this.manualPosition = null; |     this.manualPosition = null; | ||||||
|  |  | ||||||
| @ -157,7 +158,7 @@ export default class TimeLine { | |||||||
|   } |   } | ||||||
|   updateTime() { |   updateTime() { | ||||||
|     this.manualPosition = null; |     this.manualPosition = null; | ||||||
|     this.startTime = performance.now() - ((this.manualPosition || 0) * 86400 * 1000 / this.speed); |     this.startTime = Date.now() - ((this.manualPosition || 0) * 86400 * 1000 / this.speed); | ||||||
|     this.pauseed && (this.changeDate = true) |     this.pauseed && (this.changeDate = true) | ||||||
|     this.changeDateGrag = undefined |     this.changeDateGrag = undefined | ||||||
|     this.update(); |     this.update(); | ||||||
|  | |||||||
| @ -121,9 +121,6 @@ function MouseRightMenu(sdk, status, callBack) { | |||||||
|         <ul class="base" style="list-style: none;padding: 0;margin: 0;font-size: 12px;"> |         <ul class="base" style="list-style: none;padding: 0;margin: 0;font-size: 12px;"> | ||||||
|           <li style="padding: 3px 10px;cursor: pointer;">绕鼠标点旋转</li> |           <li style="padding: 3px 10px;cursor: pointer;">绕鼠标点旋转</li> | ||||||
|         </ul> |         </ul> | ||||||
|         <ul class="base" style="list-style: none;padding: 0;margin: 0;font-size: 12px;"> |  | ||||||
|           <li style="padding: 3px 10px;cursor: pointer;">文本框</li> |  | ||||||
|         </ul> |  | ||||||
|         ${addedMenu} |         ${addedMenu} | ||||||
|       ` |       ` | ||||||
|         _element.appendChild(menuElm) |         _element.appendChild(menuElm) | ||||||
| @ -178,7 +175,6 @@ function MouseRightMenu(sdk, status, callBack) { | |||||||
|                 break |                 break | ||||||
|               case '文本框': |               case '文本框': | ||||||
|                 object.position = position |                 object.position = position | ||||||
|                 key = 'textBox' |  | ||||||
|                 break |                 break | ||||||
|             } |             } | ||||||
|             eventListener[sdk.div_id].callBack(key, object) |             eventListener[sdk.div_id].callBack(key, object) | ||||||
|  | |||||||
| @ -100,7 +100,6 @@ import MeasureAngle from '../Measure/MeasureAngle' | |||||||
| import MeasureAzimuth from '../Measure/MeasureAzimuth' | import MeasureAzimuth from '../Measure/MeasureAzimuth' | ||||||
| import DrawPolyline from '../Draw/drawPolyline' | import DrawPolyline from '../Draw/drawPolyline' | ||||||
| import DrawPolygon from '../Draw/drawPolygon' | import DrawPolygon from '../Draw/drawPolygon' | ||||||
| import DrawThreeRect from '../Draw/drawThreeRect' |  | ||||||
| import DrawPoint from '../Draw/drawPoint' | import DrawPoint from '../Draw/drawPoint' | ||||||
| import DrawCircle from '../Draw/drawCircle' | import DrawCircle from '../Draw/drawCircle' | ||||||
| import DrawElliptic from '../Draw/drawElliptic' | import DrawElliptic from '../Draw/drawElliptic' | ||||||
| @ -186,9 +185,8 @@ import Frustum from '../Obj/AirLine/frustum' | |||||||
| import DrawTakeOff from '../Obj/AirLine/DrawTakeOff' | 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' |  | ||||||
|  |  | ||||||
| const YJEarthismeasuring = Symbol('测量状态') | const YJEarthismeasuring = Symbol('测量状态') | ||||||
| const screenRecord = Symbol('录屏对象') | const screenRecord = Symbol('录屏对象') | ||||||
| @ -261,9 +259,8 @@ if (!window.YJ) { | |||||||
|       // GenerateRoute |       // GenerateRoute | ||||||
|       Dialog, |       Dialog, | ||||||
|       FlowLine, |       FlowLine, | ||||||
|       Road2, |       // Road2, | ||||||
|       TextBox, |       TextBox | ||||||
|       BatchModel |  | ||||||
|     }, |     }, | ||||||
|     YJEarth, |     YJEarth, | ||||||
|     Tools, |     Tools, | ||||||
| @ -381,7 +378,6 @@ if (!window.YJ) { | |||||||
|       DrawAssemble, |       DrawAssemble, | ||||||
|       DrawSector, |       DrawSector, | ||||||
|       DrawTakeOff, |       DrawTakeOff, | ||||||
|       DrawThreeRect |  | ||||||
|     }, |     }, | ||||||
|     // 分析 |     // 分析 | ||||||
|     Analysis: { |     Analysis: { | ||||||
|  | |||||||
| @ -91,7 +91,7 @@ class MeasureDistance extends Measure { | |||||||
|  |  | ||||||
|  |  | ||||||
|     //暂时固定取20个点 |     //暂时固定取20个点 | ||||||
|     if (d > 2) {//大于20m时,固定取20个点 |     if (d > 20) {//大于20m时,固定取20个点 | ||||||
|       meters = d / 20 |       meters = d / 20 | ||||||
|       await start(meters) |       await start(meters) | ||||||
|     } else if (d < 1) { |     } else if (d < 1) { | ||||||
| @ -106,8 +106,8 @@ class MeasureDistance extends Measure { | |||||||
|  |  | ||||||
|  |  | ||||||
|   async sampleHeight(p1, index) { |   async sampleHeight(p1, index) { | ||||||
|     let height = await this.getClampToHeight(p1, [...this.sdk.viewer.entities.values]) |     let p2 = await this.sampleHeightMostDetailed([p1]) | ||||||
|     p1.alt = height |     p1.alt = p2[0].height | ||||||
|     return {position: p1, index} |     return {position: p1, index} | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | |||||||
| @ -292,7 +292,7 @@ class PolygonObject extends Base { | |||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show && !this.showView || this.showView == 3) { |     if (this.show) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|  | |||||||
| @ -22,53 +22,14 @@ class AssembleObject extends Base { | |||||||
|    * @param sdk |    * @param sdk | ||||||
|    * @description 集结地 |    * @description 集结地 | ||||||
|    * @param options {object} 属性 |    * @param options {object} 属性 | ||||||
|    * @param options.id {string} 唯一标识 |  | ||||||
|    * @param options.show=true {boolean} 显示/隐藏 |    * @param options.show=true {boolean} 显示/隐藏 | ||||||
|    * @param options.name {string} 名称 |    * @param options.name {string} 名称 | ||||||
|    * @param options.color='rgba(255, 0, 0, 0.5)' {string} 颜色 |    * @param options.color="#ff000080" {string} 颜色 | ||||||
|    * @param options.height {number} 高度 |    * @param options.height {number} 高度 | ||||||
|    * @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式) |    * @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式) | ||||||
|    * @param options.areaUnit='平方米' {string} 面积单位 |    * @param {Array.<object>} options.positions 坐标数组 [{lon,lat,alt},...] | ||||||
|    * @param options.line {object} 边框 |    * @param _Dialog {object} 弹框事件 | ||||||
|    * @param options.line.width=2 {string} 边框宽 |    * @param _Dialog.confirmCallBack {function} 弹框确认时的回调 | ||||||
|    * @param options.line.color="rgba(155, 155, 124, 0.89)" {string} 边框颜色 |  | ||||||
|    * @param {Array.<object>} options.positions 必填,经纬度和高度的列表,值交替 [{lon,lat,alt},...] |  | ||||||
|    * @param options.positions[].lng {number} 经度 |  | ||||||
|    * @param options.positions[].lat {number} 纬度 |  | ||||||
|    * @param options.positions[].alt {number} 高度 |  | ||||||
|    * @param options.label {object} 标签对象 |  | ||||||
|    * @param options.label.text {string} 标签文本 |  | ||||||
|    * @param options.label.show {string} 标签显隐 |  | ||||||
|    * @param options.label.position {string} 标签位置 |  | ||||||
|    * @param options.label.position {object} 标签位置 |  | ||||||
|    * @param options.label.position.lng {number} 经度 |  | ||||||
|    * @param options.label.position.lat {number} 纬度 |  | ||||||
|    * @param options.label.position.alt {number} 高度 |  | ||||||
|    * @param options.label.fontSize=20 {number} 字体大小 |  | ||||||
|    * @param options.label.fontFamily=0 {number} 字体项 0:黑体;1:思源黑体;2:庞门正道标题体;3:数黑体 |  | ||||||
|    * @param options.label.color=#ffffff {string} 字体颜色 |  | ||||||
|    * @param options.label.lineWidth=4 {number} 引线宽 |  | ||||||
|    * @param options.label.lineColor=#00ffff80 {string} 引线颜色 |  | ||||||
|    * @param options.label.pixelOffset=20 {number} 字体偏移(引线长度) |  | ||||||
|    * @param options.label.backgroundColor=['#00ffff80', '#00ffff80'] {array} 背景颜色 |  | ||||||
|    * @param options.label.scaleByDistance {boolean} 距离缩放 |  | ||||||
|    * @param options.label.near=2000 {number} 视野缩放最近距离 |  | ||||||
|    * @param options.label.far=100000 {number} 视野缩放最远距离 |  | ||||||
|    * @param options.attribute {object} 属性内容 |  | ||||||
|    * @param options.attribute.link={} {object} 链接 |  | ||||||
|    * @param options.attribute.link.content=[]] {array} 链接内容 |  | ||||||
|    * @param options.attribute.link.content[].name {string} 链接名称 |  | ||||||
|    * @param options.attribute.link.content[].url {string} 链接地址 |  | ||||||
|    * @param options.richTextContent {string} 富文本内容 |  | ||||||
|    * @param options.customView {object} 默认视角 |  | ||||||
|    * @param options.customView.orientation {object} 默认视角方位 |  | ||||||
|    * @param options.customView.orientation.heading {number} 航向角 |  | ||||||
|    * @param options.customView.orientation.pitch {number} 俯仰角 |  | ||||||
|    * @param options.customView.orientation.roll {number} 翻滚角 |  | ||||||
|    * @param options.customView.relativePosition {object} 视角相对位置 |  | ||||||
|    * @param options.customView.relativePosition.lng {number} 经度 |  | ||||||
|    * @param options.customView.relativePosition.lat {number} 纬度 |  | ||||||
|    * @param options.customView.relativePosition.alt {number} 高度 |  | ||||||
|    * */ |    * */ | ||||||
|   constructor(sdk, options = {}, _Dialog = {}) { |   constructor(sdk, options = {}, _Dialog = {}) { | ||||||
|     super(sdk, options); |     super(sdk, options); | ||||||
| @ -358,7 +319,7 @@ class AssembleObject extends Base { | |||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show && !this.showView || this.showView == 3) { |     if (this.show) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|  | |||||||
| @ -22,56 +22,14 @@ class AttackArrowObject extends Base { | |||||||
|    * @param sdk |    * @param sdk | ||||||
|    * @description 箭头面 |    * @description 箭头面 | ||||||
|    * @param options {object} 属性 |    * @param options {object} 属性 | ||||||
|    * @param options.id {string} 唯一标识 |  | ||||||
|    * @param options.show=true {boolean} 显示/隐藏 |    * @param options.show=true {boolean} 显示/隐藏 | ||||||
|    * @param options.name {string} 名称 |    * @param options.name {string} 名称 | ||||||
|    * @param options.color='rgba(255, 0, 0, 0.5)' {string} 颜色 |    * @param options.color="#ff000080" {string} 颜色 | ||||||
|    * @param options.height {number} 高度 |    * @param options.height {number} 高度 | ||||||
|    * @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式) |    * @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式) | ||||||
|    * @param options.areaUnit='平方米' {string} 面积单位 |    * @param {Array.<object>} options.positions 坐标数组 [{lon,lat,alt},...] | ||||||
|    * @param options.line {object} 边框 |    * @param _Dialog {object} 弹框事件 | ||||||
|    * @param options.line.width=2 {string} 边框宽 |    * @param _Dialog.confirmCallBack {function} 弹框确认时的回调 | ||||||
|    * @param options.line.color="rgba(155, 155, 124, 0.89)" {string} 边框颜色 |  | ||||||
|    * @param {Array.<object>} options.positions 必填,经纬度和高度的列表,值交替 [{lon,lat,alt},...] |  | ||||||
|    * @param options.positions[].lng {number} 经度 |  | ||||||
|    * @param options.positions[].lat {number} 纬度 |  | ||||||
|    * @param options.positions[].alt {number} 高度 |  | ||||||
|    * @param options.spreadState=false {boolean} 动画 |  | ||||||
|    * @param options.loop=false {loop} 动画重复 |  | ||||||
|    * @param options.spreadTime=3000 {number} 动画持续时长(毫秒) |  | ||||||
|    * @param options.label {object} 标签对象 |  | ||||||
|    * @param options.label.text {string} 标签文本 |  | ||||||
|    * @param options.label.show {string} 标签显隐 |  | ||||||
|    * @param options.label.position {string} 标签位置 |  | ||||||
|    * @param options.label.position {object} 标签位置 |  | ||||||
|    * @param options.label.position.lng {number} 经度 |  | ||||||
|    * @param options.label.position.lat {number} 纬度 |  | ||||||
|    * @param options.label.position.alt {number} 高度 |  | ||||||
|    * @param options.label.fontSize=20 {number} 字体大小 |  | ||||||
|    * @param options.label.fontFamily=0 {number} 字体项 0:黑体;1:思源黑体;2:庞门正道标题体;3:数黑体 |  | ||||||
|    * @param options.label.color=#ffffff {string} 字体颜色 |  | ||||||
|    * @param options.label.lineWidth=4 {number} 引线宽 |  | ||||||
|    * @param options.label.lineColor=#00ffff80 {string} 引线颜色 |  | ||||||
|    * @param options.label.pixelOffset=20 {number} 字体偏移(引线长度) |  | ||||||
|    * @param options.label.backgroundColor=['#00ffff80', '#00ffff80'] {array} 背景颜色 |  | ||||||
|    * @param options.label.scaleByDistance {boolean} 距离缩放 |  | ||||||
|    * @param options.label.near=2000 {number} 视野缩放最近距离 |  | ||||||
|    * @param options.label.far=100000 {number} 视野缩放最远距离 |  | ||||||
|    * @param options.attribute {object} 属性内容 |  | ||||||
|    * @param options.attribute.link={} {object} 链接 |  | ||||||
|    * @param options.attribute.link.content=[]] {array} 链接内容 |  | ||||||
|    * @param options.attribute.link.content[].name {string} 链接名称 |  | ||||||
|    * @param options.attribute.link.content[].url {string} 链接地址 |  | ||||||
|    * @param options.richTextContent {string} 富文本内容 |  | ||||||
|    * @param options.customView {object} 默认视角 |  | ||||||
|    * @param options.customView.orientation {object} 默认视角方位 |  | ||||||
|    * @param options.customView.orientation.heading {number} 航向角 |  | ||||||
|    * @param options.customView.orientation.pitch {number} 俯仰角 |  | ||||||
|    * @param options.customView.orientation.roll {number} 翻滚角 |  | ||||||
|    * @param options.customView.relativePosition {object} 视角相对位置 |  | ||||||
|    * @param options.customView.relativePosition.lng {number} 经度 |  | ||||||
|    * @param options.customView.relativePosition.lat {number} 纬度 |  | ||||||
|    * @param options.customView.relativePosition.alt {number} 高度 |  | ||||||
|    * */ |    * */ | ||||||
|   constructor(sdk, options = {}, _Dialog = {}) { |   constructor(sdk, options = {}, _Dialog = {}) { | ||||||
|     super(sdk, options); |     super(sdk, options); | ||||||
| @ -366,7 +324,7 @@ class AttackArrowObject extends Base { | |||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show && !this.showView || this.showView == 3) { |     if (this.show) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|  | |||||||
| @ -9,7 +9,7 @@ | |||||||
| import Dialog from '../../../Element/Dialog'; | import Dialog from '../../../Element/Dialog'; | ||||||
| import CoordTransform from "../../../../transform/CoordTransform"; | import CoordTransform from "../../../../transform/CoordTransform"; | ||||||
| import BaseSource from "../index"; | import BaseSource from "../index"; | ||||||
| import { syncData, get2DView } from '../../../../Global/MultiViewportMode' | import { syncData } from '../../../../Global/MultiViewportMode' | ||||||
| import { setSplitDirection, syncSplitData } from '../../../../Global/SplitScreen' | import { setSplitDirection, syncSplitData } from '../../../../Global/SplitScreen' | ||||||
| import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../../Global/global' | import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../../Global/global' | ||||||
|  |  | ||||||
| @ -244,19 +244,8 @@ class BaseLayer extends BaseSource { | |||||||
|         this.originalOptions = this.deepCopyObj(this.options) |         this.originalOptions = this.deepCopyObj(this.options) | ||||||
|         this._DialogObject.close() |         this._DialogObject.close() | ||||||
|         this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(this.originalOptions) |         this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(this.originalOptions) | ||||||
|         // syncData(this.sdk, this.options.id) |         syncData(this.sdk, this.options.id) | ||||||
|         syncSplitData(this.sdk, this.options.id) |         syncSplitData(this.sdk, this.options.id) | ||||||
|         let sdk2D = get2DView() |  | ||||||
|         if (sdk2D && sdk2D != this.sdk) { |  | ||||||
|           for(let i=0;i<sdk2D.viewer.imageryLayers._layers.length;i++) { |  | ||||||
|             let layer = sdk2D.viewer.imageryLayers._layers[i] |  | ||||||
|             if(layer._id && layer._id == this.options.id) { |  | ||||||
|               layer.alpha = this.options.alpha |  | ||||||
|               break |  | ||||||
|             } |  | ||||||
|           } |  | ||||||
|  |  | ||||||
|         } |  | ||||||
|       }, |       }, | ||||||
|       closeCallBack: () => { |       closeCallBack: () => { | ||||||
|         this.reset() |         this.reset() | ||||||
|  | |||||||
| @ -17,62 +17,30 @@ import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../.. | |||||||
| class Model extends BaseModel { | class Model extends BaseModel { | ||||||
|   #timeoutEventObject = null |   #timeoutEventObject = null | ||||||
|   /** |   /** | ||||||
|    * @constructor | * @constructor | ||||||
|    * @description 加载模型 | * @description 加载模型 | ||||||
|    * @param sdk {object} sdk | * @param sdk {object} sdk | ||||||
|    * @param options {object} 模型参数 | * @param options {object} 模型参数 | ||||||
|    * @param options.id {string} 唯一标识 | * @param options.id {string} 对象id | ||||||
|    * @param options.show=true {boolean} 模型显隐 | * @param options.show=true {boolean} 模型显隐 | ||||||
|    * @param options.name {string} 名称 | * @param options.name {string} 名称 | ||||||
|    * @param options.url {string} 资源地址 | * @param options.url {string} 资源地址 | ||||||
|    * @param options.position {object} 模型位置 | * @param options.position {object} 模型位置 | ||||||
|    * @param options.position.lng {number} 经度 | * @param options.position.lng {number} 经度 | ||||||
|    * @param options.position.lat {number} 纬度 | * @param options.position.lat {number} 纬度 | ||||||
|    * @param options.position.alt {number} 高度 | * @param options.position.alt {number} 高度 | ||||||
|    * @param options.scale {object} 比例 | * @param options.scale {object} 比例 | ||||||
|    * @param options.scale.x=1 {number} x轴比例 | * @param options.scale.x=1 {number} 比例 | ||||||
|    * @param options.scale.y=1 {number} y轴比例 | * @param options.scale.y=1 {number} 比例 | ||||||
|    * @param options.scale.z=1 {number} z轴比例 | * @param options.scale.z=1 {number} 比例 | ||||||
|    * @param options.maximumScale=100 {number} 最大比例 | * @param options.maximumScale=100 {number} 最大比例 | ||||||
|    * @param options.minimumPixelSize=60 {number} 最小像素 | * @param options.minimumPixelSize=60 {number} 最小像素 | ||||||
|    * @param options.scaleByDistance=true {boolean} 随视野缩放 | * @param options.scaleByDistance=true {boolean} 随视野缩放 | ||||||
|    * @param options.rotate {object} 旋转角度 | * @param options.rotate {object} 旋转角度 | ||||||
|    * @param options.rotate.x {number} x轴旋转度数 | * @param options.rotate.x {number} x轴旋转度数 | ||||||
|    * @param options.rotate.y {number} y轴旋转度数 | * @param options.rotate.y {number} y轴旋转度数 | ||||||
|    * @param options.rotate.z {number} z轴旋转度数 | * @param options.rotate.z {number} z轴旋转度数 | ||||||
|    * @param options.label {object} 标签对象 | * @param options.img {string} 图片地址 | ||||||
|    * @param options.label.text {string} 标签文本 |  | ||||||
|    * @param options.label.show {string} 标签显隐 |  | ||||||
|    * @param options.label.position {string} 标签位置 |  | ||||||
|    * @param options.label.position {object} 标签位置 |  | ||||||
|    * @param options.label.position.lng {number} 经度 |  | ||||||
|    * @param options.label.position.lat {number} 纬度 |  | ||||||
|    * @param options.label.position.alt {number} 高度 |  | ||||||
|    * @param options.label.fontSize=20 {number} 字体大小 |  | ||||||
|    * @param options.label.fontFamily=0 {number} 字体项 0:黑体;1:思源黑体;2:庞门正道标题体;3:数黑体 |  | ||||||
|    * @param options.label.color=#ffffff {string} 字体颜色 |  | ||||||
|    * @param options.label.lineWidth=4 {number} 引线宽 |  | ||||||
|    * @param options.label.lineColor=#00ffff80 {string} 引线颜色 |  | ||||||
|    * @param options.label.pixelOffset=20 {number} 字体偏移(引线长度) |  | ||||||
|    * @param options.label.backgroundColor=['#00ffff80', '#00ffff80'] {array} 背景颜色 |  | ||||||
|    * @param options.label.scaleByDistance {boolean} 距离缩放 |  | ||||||
|    * @param options.label.near=2000 {number} 视野缩放最近距离 |  | ||||||
|    * @param options.label.far=100000 {number} 视野缩放最远距离 |  | ||||||
|    * @param options.attribute {object} 属性内容 |  | ||||||
|    * @param {object} options.attribute.link={} 链接 |  | ||||||
|    * @param options.attribute.link.content=[]] {array} 链接内容 |  | ||||||
|    * @param options.attribute.link.content[].name {string} 链接名称 |  | ||||||
|    * @param options.attribute.link.content[].url {string} 链接地址 |  | ||||||
|    * @param options.richTextContent {string} 富文本内容 |  | ||||||
|    * @param options.customView {object} 默认视角 |  | ||||||
|    * @param options.customView.orientation {object} 默认视角方位 |  | ||||||
|    * @param options.customView.orientation.heading {number} 航向角 |  | ||||||
|    * @param options.customView.orientation.pitch {number} 俯仰角 |  | ||||||
|    * @param options.customView.orientation.roll {number} 翻滚角 |  | ||||||
|    * @param options.customView.relativePosition {object} 视角相对位置 |  | ||||||
|    * @param options.customView.relativePosition.lng {number} 经度 |  | ||||||
|    * @param options.customView.relativePosition.lat {number} 纬度 |  | ||||||
|    * @param options.customView.relativePosition.alt {number} 高度 |  | ||||||
| * */ | * */ | ||||||
|   constructor(earth, options = {}, _Dialog = {}) { |   constructor(earth, options = {}, _Dialog = {}) { | ||||||
|     super(earth, options, _Dialog = {}) |     super(earth, options, _Dialog = {}) | ||||||
| @ -669,7 +637,7 @@ class Model extends BaseModel { | |||||||
|  |  | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show && !this.showView || this.showView == 3) { |     if (this.show) { | ||||||
|       this.label && (this.label.show = v) |       this.label && (this.label.show = v) | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|  | |||||||
| @ -1,24 +0,0 @@ | |||||||
| function html() { |  | ||||||
|   return ` |  | ||||||
|     <span class="custom-divider"></span> |  | ||||||
|     <div class="div-item"> |  | ||||||
|         <div class="row"> |  | ||||||
|             <div class="col add-type-box"> |  | ||||||
|                 <span class="label" style="flex: 0 0 56px;">添加方式</span> |  | ||||||
|                 <div class="add-type"></div> |  | ||||||
|             </div> |  | ||||||
|             <div class="col"> |  | ||||||
|                 <span class="label">间距</span> |  | ||||||
|                 <div class="input-number input-number-unit-1"> |  | ||||||
|                     <input class="input" type="number" title="" min="1" max="99999" @model="spacing"> |  | ||||||
|                     <span class="unit">米</span> |  | ||||||
|                     <span class="arrow"></span> |  | ||||||
|                 </div> |  | ||||||
|             </div> |  | ||||||
|         </div> |  | ||||||
|     </div> |  | ||||||
|     <span class="custom-divider"></span> |  | ||||||
|     ` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| export { html } |  | ||||||
| @ -1,229 +0,0 @@ | |||||||
| import { attributeElm } from '../../Element/elm_html' |  | ||||||
|  |  | ||||||
| function html(that) { |  | ||||||
|   return ` |  | ||||||
|     <span class="custom-divider"></span> |  | ||||||
|     <div class="div-item"> |  | ||||||
|         <div class="row"> |  | ||||||
|             <div class="col"> |  | ||||||
|                 <span class="label">颜色</span> |  | ||||||
|                 <div class="color"></div> |  | ||||||
|             </div> |  | ||||||
|             <div class="col"> |  | ||||||
|             </div> |  | ||||||
|         </div> |  | ||||||
|     </div> |  | ||||||
|     <span class="custom-divider"></span> |  | ||||||
|     <div class="div-item"> |  | ||||||
|         <div class="row"> |  | ||||||
|             <div style="width: 46%;"> |  | ||||||
|                 <div class="row add-type-box"> |  | ||||||
|                     <div class="lable-left-line">添加方式 |  | ||||||
|                         <div class="input input-select add-type" style="margin-left: 20px;"></div> |  | ||||||
|                     </div> |  | ||||||
|                 </div> |  | ||||||
|             </div> |  | ||||||
|             <div style="width: 50%;"> |  | ||||||
|                 <div class="row" style="margin-bottom: 5px;"> |  | ||||||
|                     <div class="col"> |  | ||||||
|                         <span class="label">朝向偏移</span> |  | ||||||
|                         <div class="input-number input-number-unit-1"> |  | ||||||
|                             <input class="input" type="number" title="" min="0" max="360" @model="deviation"> |  | ||||||
|                             <span class="unit">°</span> |  | ||||||
|                             <span class="arrow"></span> |  | ||||||
|                         </div> |  | ||||||
|                     </div> |  | ||||||
|                 </div> |  | ||||||
|             </div> |  | ||||||
|         </div> |  | ||||||
|         <h4>模型间隔</h4> |  | ||||||
|         <div class="row"> |  | ||||||
|             <div class="col"> |  | ||||||
|                 <div class="YJ-custom-checkbox-box" style="display: flex;align-items: center;cursor: pointer;"> |  | ||||||
|                     <input type="checkbox" class="YJ-custom-checkbox"> |  | ||||||
|                     <span style="margin-left: 10px; margin-bottom: 1px;user-select: none;">自定义距离</span> |  | ||||||
|                 </div> |  | ||||||
|             </div> |  | ||||||
|             <div class="col"> |  | ||||||
|                 <div class="YJ-custom-checkbox-box" style="display: flex;align-items: center;cursor: pointer;"> |  | ||||||
|                     <input type="checkbox" class="YJ-custom-checkbox"> |  | ||||||
|                     <span style="margin-left: 10px; margin-bottom: 1px;user-select: none;">固定距离</span> |  | ||||||
|                 </div> |  | ||||||
|             </div> |  | ||||||
|             <div class="col"> |  | ||||||
|                 <span class="label">模型间隔</span> |  | ||||||
|                 <div class="input-number input-number-unit-1"> |  | ||||||
|                     <input class="input" type="number" title="" min="0" max="360" @model="spacing"> |  | ||||||
|                     <span class="unit">米</span> |  | ||||||
|                     <span class="arrow"></span> |  | ||||||
|                 </div> |  | ||||||
|             </div> |  | ||||||
|         </div> |  | ||||||
|         <h4>线型选择</h4> |  | ||||||
|         <div class="row"> |  | ||||||
|             <div class="col"> |  | ||||||
|                 <div class="YJ-custom-checkbox-box" style="display: flex;align-items: center;cursor: pointer;"> |  | ||||||
|                     <input type="checkbox" class="YJ-custom-checkbox"> |  | ||||||
|                     <span style="margin-left: 10px; margin-bottom: 1px;user-select: none;">折线</span> |  | ||||||
|                 </div> |  | ||||||
|             </div> |  | ||||||
|             <div class="col"> |  | ||||||
|                 <div class="YJ-custom-checkbox-box" style="display: flex;align-items: center;cursor: pointer;"> |  | ||||||
|                     <input type="checkbox" class="YJ-custom-checkbox"> |  | ||||||
|                     <span style="margin-left: 10px; margin-bottom: 1px;user-select: none;">曲线</span> |  | ||||||
|                 </div> |  | ||||||
|             </div> |  | ||||||
|             <div class="col"> |  | ||||||
|                 <span class="label">线条数量</span> |  | ||||||
|                 <div class="input-number input-number-unit-1"> |  | ||||||
|                     <input class="input" type="number" title="" min="0" max="360" @model="lineNum"> |  | ||||||
|                     <span class="unit">条</span> |  | ||||||
|                     <span class="arrow"></span> |  | ||||||
|                 </div> |  | ||||||
|             </div> |  | ||||||
|             <div class="col"> |  | ||||||
|                 <span class="label">线条间隔</span> |  | ||||||
|                 <div class="input-number input-number-unit-1"> |  | ||||||
|                     <input class="input" type="number" title="" min="0" max="360" @model="lineSpacing"> |  | ||||||
|                     <span class="unit">米</span> |  | ||||||
|                     <span class="arrow"></span> |  | ||||||
|                 </div> |  | ||||||
|             </div> |  | ||||||
|         </div> |  | ||||||
|         <div class="row"> |  | ||||||
|             <div class="col"> |  | ||||||
|                 <div class="YJ-custom-checkbox-box" style="display: flex;align-items: center;cursor: pointer;"> |  | ||||||
|                     <input type="checkbox" class="YJ-custom-checkbox"> |  | ||||||
|                     <span style="margin-left: 10px; margin-bottom: 1px;user-select: none;">随机采样</span> |  | ||||||
|                 </div> |  | ||||||
|             </div> |  | ||||||
|             <div class="col"> |  | ||||||
|                 <span class="label">随机数量</span> |  | ||||||
|                 <div class="input-number input-number-unit-1"> |  | ||||||
|                     <input class="input" type="number" title="" min="0" max="360" @model="lineNum"> |  | ||||||
|                     <span class="unit">个</span> |  | ||||||
|                     <span class="arrow"></span> |  | ||||||
|                 </div> |  | ||||||
|             </div> |  | ||||||
|             <div class="col"></div> |  | ||||||
|         </div> |  | ||||||
|         <div class="row"> |  | ||||||
|             <div class="col"> |  | ||||||
|                 <div class="YJ-custom-checkbox-box" style="display: flex;align-items: center;cursor: pointer;"> |  | ||||||
|                     <input type="checkbox" class="YJ-custom-checkbox"> |  | ||||||
|                     <span style="margin-left: 10px; margin-bottom: 1px;user-select: none;">网格采样</span> |  | ||||||
|                 </div> |  | ||||||
|             </div> |  | ||||||
|             <div class="col"> |  | ||||||
|                 <span class="label">首边间隔</span> |  | ||||||
|                 <div class="input-number input-number-unit-1"> |  | ||||||
|                     <input class="input" type="number" title="" min="0" max="360" @model="fistLineSpacing"> |  | ||||||
|                     <span class="unit">米</span> |  | ||||||
|                     <span class="arrow"></span> |  | ||||||
|                 </div> |  | ||||||
|             </div> |  | ||||||
|             <div class="col"> |  | ||||||
|                 <span class="label">次边间隔</span> |  | ||||||
|                 <div class="input-number input-number-unit-1"> |  | ||||||
|                     <input class="input" type="number" title="" min="0" max="360" @model="secondLineSpacing"> |  | ||||||
|                     <span class="unit">米</span> |  | ||||||
|                     <span class="arrow"></span> |  | ||||||
|                 </div> |  | ||||||
|             </div> |  | ||||||
|         </div> |  | ||||||
|     </div> |  | ||||||
|     <span class="custom-divider"></span> |  | ||||||
|     <div class="row"> |  | ||||||
|         <DIV-cy-tabs id="point-object-edit-tabs"> |  | ||||||
|             <DIV-cy-tab-pane label="空间信息"> |  | ||||||
|                 <div class="row"> |  | ||||||
|                     <div class="col height-mode-box"> |  | ||||||
|                         <span class="label" style="flex: 0 0 56px;">高度模式</span> |  | ||||||
|                         <div class="height-mode"></div> |  | ||||||
|                     </div> |  | ||||||
|                 </div> |  | ||||||
|                 <div class="row"> |  | ||||||
|                     <div style="width: 46%;"> |  | ||||||
|                         <div class="row add-type-box"> |  | ||||||
|                             <div class="lable-left-line">缩放 |  | ||||||
|                                 <div class="YJ-custom-checkbox-box" style="display: flex;align-items: center;cursor: pointer;"> |  | ||||||
|                                     <input type="checkbox" class="YJ-custom-checkbox"> |  | ||||||
|                                     <span style="margin-left: 10px; margin-bottom: 1px;user-select: none;">是否等比例缩放</span> |  | ||||||
|                                 </div> |  | ||||||
|                             </div> |  | ||||||
|                         </div> |  | ||||||
|                     </div> |  | ||||||
|                 </div> |  | ||||||
|             </DIV-cy-tab-pane> |  | ||||||
|             <DIV-cy-tab-pane label="标注风格"> |  | ||||||
|                 <div> |  | ||||||
|                     <div class="row" style="margin-bottom: 10px;"> |  | ||||||
|                       <div class="col"> |  | ||||||
|                           <span class="label">新增模型风格设置</span> |  | ||||||
|                           <button @click="openRichTextEditor">初始风格</button> |  | ||||||
|                       </div> |  | ||||||
|                       <div class="col"> |  | ||||||
|                           <button @click="openRichTextEditor">当前风格</button> |  | ||||||
|                       </div> |  | ||||||
|                     </div> |  | ||||||
|  |  | ||||||
|                     <div class="row" style="margin-bottom: 10px;"> |  | ||||||
|                         <div class="col" style="flex: 0 0 80px;"> |  | ||||||
|                             <span class="label" style="flex: none;">显隐</span> |  | ||||||
|                             <input class="btn-switch" type="checkbox" @model="billboardShow"> |  | ||||||
|                         </div> |  | ||||||
|                         <div class="col" style="flex: 0 0 90px;"> |  | ||||||
|                             <span class="label" style="flex: none;">图标</span> |  | ||||||
|                             <div class="image-box" @click="clickChangeImage"> |  | ||||||
|                                 <img class="image" src="" alt="" @model="billboardImage"> |  | ||||||
|                             </div> |  | ||||||
|                         </div> |  | ||||||
|                         <div class="col" style="flex: 0 0 90px;"> |  | ||||||
|                             <span class="label" style="flex: none;">默认图标</span> |  | ||||||
|                             <div class="image-box" @click="clickChangeDefaultImage"> |  | ||||||
|                                 <img class="image" src="" alt="" @model="billboardDefaultImage"> |  | ||||||
|                             </div> |  | ||||||
|                         </div> |  | ||||||
|                         <div class="col"> |  | ||||||
|                             <span class="label">图标倍数</span> |  | ||||||
|                             <div class="input-number input-number-unit-2"> |  | ||||||
|                                 <input class="input" type="number" title="" min="0.1" max="99" @model="billboardScale"> |  | ||||||
|                                 <span class="unit">倍</span> |  | ||||||
|                                 <span class="arrow"></span> |  | ||||||
|                             </div> |  | ||||||
|                         </div> |  | ||||||
|                     </div> |  | ||||||
|                 </div> |  | ||||||
|                 <div> |  | ||||||
|                     <h4>文字设置</h4> |  | ||||||
|                     <div class="row"> |  | ||||||
|                         <div class="col" style="flex: 0 0 80px;"> |  | ||||||
|                             <span class="label" style="flex: none;">显隐</span> |  | ||||||
|                             <input class="btn-switch" type="checkbox" @model="labelShow"> |  | ||||||
|                         </div> |  | ||||||
|                         <div class="col font-select-box"> |  | ||||||
|                             <span class="label" style="flex: none;">字体选择</span> |  | ||||||
|                             <div class="input input-select font-select"></div> |  | ||||||
|                         </div> |  | ||||||
|                         <div class="col"> |  | ||||||
|                             <span class="label">文字大小</span> |  | ||||||
|                             <div class="input-number input-number-unit-2"> |  | ||||||
|                                 <input class="input" type="number" title="" min="1" max="99" @model="labelFontSize" style="width: 70px;"> |  | ||||||
|                                 <span class="unit">px</span> |  | ||||||
|                                 <span class="arrow"></span> |  | ||||||
|                             </div> |  | ||||||
|                         </div> |  | ||||||
|                         <div class="col"> |  | ||||||
|                             <span class="label">文字颜色</span> |  | ||||||
|                             <div class="labelColor"></div> |  | ||||||
|                         </div> |  | ||||||
|                     </div> |  | ||||||
|                 </div> |  | ||||||
|             </DIV-cy-tab-pane> |  | ||||||
|         </DIV-cy-tabs> |  | ||||||
|     </div> |  | ||||||
|     <span class="custom-divider"></span> |  | ||||||
|     ` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| export { html } |  | ||||||
| @ -1,92 +0,0 @@ | |||||||
| class eventBinding { |  | ||||||
|   constructor() { |  | ||||||
|     this.element = {} |  | ||||||
|   } |  | ||||||
|   static event = {} |  | ||||||
|  |  | ||||||
|   getEvent(name) { |  | ||||||
|     return eventBinding.event[name] |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   getEventAll() { |  | ||||||
|     return eventBinding.event |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   setEvent(name, event) { |  | ||||||
|     eventBinding.event[name] = event |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   on(that, elements) { |  | ||||||
|     for (let i = 0; i < elements.length; i++) { |  | ||||||
|       let Event = [] |  | ||||||
|       let isEvent = false |  | ||||||
|       let removeName = [] |  | ||||||
|       if (!elements[i] || !elements[i].attributes) { |  | ||||||
|         continue; |  | ||||||
|       } |  | ||||||
|       for (let m of elements[i].attributes) { |  | ||||||
|         switch (m.name) { |  | ||||||
|           case '@model': { |  | ||||||
|             isEvent = true |  | ||||||
|             if (elements[i].type == 'checkbox') { |  | ||||||
|               Event.push((e) => { that[m.value] = e.target.checked }) |  | ||||||
|               elements[i].checked = that[m.value] |  | ||||||
|             } |  | ||||||
|             else { |  | ||||||
|               Event.push((e) => { |  | ||||||
|                 let value = e.target.value |  | ||||||
|                 if (e.target.type == 'number') { |  | ||||||
|                   value = Number(value) |  | ||||||
|                 } |  | ||||||
|                 that[m.value] = value |  | ||||||
|               }) |  | ||||||
|               if (elements[i].nodeName == 'IMG') { |  | ||||||
|                 elements[i].src = that[m.value] |  | ||||||
|               } |  | ||||||
|               else { |  | ||||||
|                 elements[i].value = that[m.value] |  | ||||||
|               } |  | ||||||
|             } |  | ||||||
|             if (this.element[m.value]) { |  | ||||||
|               this.element[m.value].push(elements[i]) |  | ||||||
|             } |  | ||||||
|             else { |  | ||||||
|               this.element[m.value] = [elements[i]] |  | ||||||
|             } |  | ||||||
|             removeName.push(m.name) |  | ||||||
|             break; |  | ||||||
|           } |  | ||||||
|           case '@click': { |  | ||||||
|             elements[i].addEventListener('click', (e) => { |  | ||||||
|               if (typeof (that.Dialog[m.value]) === 'function') { |  | ||||||
|                 that.Dialog[m.value](e) |  | ||||||
|               } |  | ||||||
|             }); |  | ||||||
|             removeName.push(m.name) |  | ||||||
|             // elements[i].attributes.removeNamedItem(m.name) |  | ||||||
|             break; |  | ||||||
|           } |  | ||||||
|         } |  | ||||||
|         // elements[i].attributes[m] = undefined |  | ||||||
|       } |  | ||||||
|       for (let n = 0; n < removeName.length; n++) { |  | ||||||
|         elements[i].attributes.removeNamedItem(removeName[n]) |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|       if (isEvent) { |  | ||||||
|         let ventType = 'input' |  | ||||||
|         if (elements[i].tagName != 'INPUT' || elements[i].type == 'checkbox') { |  | ||||||
|           ventType = 'change' |  | ||||||
|         } |  | ||||||
|         elements[i].addEventListener(ventType, (e) => { |  | ||||||
|           for (let t = 0; t < Event.length; t++) { |  | ||||||
|             Event[t](e) |  | ||||||
|           } |  | ||||||
|         }); |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| const EventBinding = new eventBinding(); |  | ||||||
| export default EventBinding; |  | ||||||
| @ -1,713 +0,0 @@ | |||||||
| /** |  | ||||||
|  * @description 批量模型 |  | ||||||
|  */ |  | ||||||
| import Dialog from '../../Element/Dialog'; |  | ||||||
| import { html } from "./_element"; |  | ||||||
| import EventBinding from '../../Element/Dialog/eventBinding'; |  | ||||||
| import Base from "../index"; |  | ||||||
| import Tools from "../../../Tools"; |  | ||||||
| import { syncData } from '../../../Global/MultiViewportMode' |  | ||||||
| import Model from '../BaseSource/BaseModel/Model' |  | ||||||
| import { legp } from '../../Element/datalist' |  | ||||||
|  |  | ||||||
| import DrawPolyline from '../../../Draw/drawPolyline' |  | ||||||
| import DrawPolygon from '../../../Draw/drawPolygon' |  | ||||||
| import DrawThreeRect from '../../../Draw/drawThreeRect' |  | ||||||
| import DrawPoint from '../../../Draw/drawPoint' |  | ||||||
| import { setActiveViewer, closeRotateAround, closeViewFollow, CesiumContainer } from '../../../Global/global' |  | ||||||
|  |  | ||||||
| import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen' |  | ||||||
|  |  | ||||||
| class BatchModel extends Base { |  | ||||||
|   /** |  | ||||||
|    * @constructor |  | ||||||
|    * @param sdk |  | ||||||
|    * @description 批量模型 |  | ||||||
|    * @param options {object} 批量模型属性 |  | ||||||
|    * @param options.name=未命名对象 {string} 名称 |  | ||||||
|    * @param options.type=polygon {string} 线类型(line,polygon) |  | ||||||
|    * @param options.url=polygon {string} 线类型(line,polygon,point) |  | ||||||
|    * @param options.spacing= {number} 间距 |  | ||||||
|    * @param options.show=true {boolean} |  | ||||||
|    * @param Dialog {object} 弹框对象 |  | ||||||
|    * @param Dialog.confirmCallBack {function} 弹框确认时的回调 |  | ||||||
|    * */ |  | ||||||
|   constructor(sdk, options = {}, callback = null, _Dialog = {}) { |  | ||||||
|     super(sdk, options); |  | ||||||
|     this.viewer = this.sdk.viewer |  | ||||||
|     this.options.name = options.name || '批量模型' |  | ||||||
|     this.options.type = options.type || '面' |  | ||||||
|     this.options.url = options.url || '' |  | ||||||
|     this.options.spacing = options.spacing * 1 || 50 |  | ||||||
|     this.options.positions = options.positions || [] |  | ||||||
|     this.options.show = (options.show || options.show === false) ? options.show : true |  | ||||||
|     this.callback = callback |  | ||||||
|     this.Dialog = _Dialog |  | ||||||
|     this._EventBinding = new EventBinding() |  | ||||||
|     this._elms = {}; |  | ||||||
|     this.pointArr = [] |  | ||||||
|     this.sdk.addIncetance(this.options.id, this) |  | ||||||
|     let tools = new Tools(sdk) |  | ||||||
|     // BatchModel.computeDis(this) |  | ||||||
|     // if (this.options.positions.length > 0 || this.options.positions.lng) { |  | ||||||
|     if (this.options.spacing < 0 || options.spacing * 1 === 0) { |  | ||||||
|       tools.message({ type: 'warning', text: '请输入正确的间距!' }) |  | ||||||
|       return; |  | ||||||
|     } |  | ||||||
|     if ((options.type && options.spacing != undefined) || options.type == '点') { |  | ||||||
|       // BatchModel.computeDis(this) |  | ||||||
|  |  | ||||||
|       let Draw |  | ||||||
|       switch (options.type) { |  | ||||||
|         case '点': |  | ||||||
|           Draw = new DrawPoint(this.sdk) |  | ||||||
|           break; |  | ||||||
|         case '线': |  | ||||||
|           Draw = new DrawPolyline(this.sdk) |  | ||||||
|           break; |  | ||||||
|         case '面': |  | ||||||
|           Draw = new DrawThreeRect(this.sdk) |  | ||||||
|           break; |  | ||||||
|         default: |  | ||||||
|           break; |  | ||||||
|       } |  | ||||||
|       Draw && Draw.start((a, positions) => { |  | ||||||
|         this.options.positions = positions; |  | ||||||
|         //判断范围是否过大 |  | ||||||
|         if (options.type == '面') { |  | ||||||
|           let posi = positions.map(v => { |  | ||||||
|             return Cesium.Cartesian3.fromDegrees(v.lng, v.lat) |  | ||||||
|           }) |  | ||||||
|           let dis1 = Cesium.Cartesian3.distance(posi[0], posi[1]) |  | ||||||
|           let dis2 = Cesium.Cartesian3.distance(posi[1], posi[2]) |  | ||||||
|           let num1 = dis1 / this.options.spacing |  | ||||||
|           let num2 = dis2 / this.options.spacing |  | ||||||
|           if (num1 * num2 > 100) { |  | ||||||
|             tools.message({ type: 'warning', text: '数量大于100,请重新绘制' }) |  | ||||||
|             return; |  | ||||||
|           } |  | ||||||
|         } else if (options.type == '线') { |  | ||||||
|           let posi = positions.map(v => { |  | ||||||
|             return Cesium.Cartesian3.fromDegrees(v.lng, v.lat) |  | ||||||
|           }) |  | ||||||
|           let dis = 0 |  | ||||||
|           for (let i = 0; i < posi.length - 2; i++) { |  | ||||||
|             dis += Cesium.Cartesian3.distance(posi[i], posi[i + 1]) |  | ||||||
|           } |  | ||||||
|           if (dis / this.options.spacing > 100) { |  | ||||||
|             tools.message({ type: 'warning', text: '数量大于100,请重新绘制' }) |  | ||||||
|             return; |  | ||||||
|           } |  | ||||||
|         } |  | ||||||
|         // this.callback(this.options); |  | ||||||
|         (this.options.positions.length || this.options.positions.lng) && BatchModel.computeDis(this) |  | ||||||
|       }) |  | ||||||
|  |  | ||||||
|     } else { |  | ||||||
|       this.edit(true) |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   // 计算距离 |  | ||||||
|   static async computeDis(that) { |  | ||||||
|     let fromDegreesArray = [] |  | ||||||
|     let arr |  | ||||||
|     let posiArr = [] |  | ||||||
|     let array = [] |  | ||||||
|     if (that.options.type == '面') { |  | ||||||
|       that.options.positions.forEach(item => { |  | ||||||
|         fromDegreesArray.push(item.lng, item.lat) |  | ||||||
|       }) |  | ||||||
|       // arr = that.generateInterpolatedPoints(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray), that.options.spacing) |  | ||||||
|       arr = await that.computedArea(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray), that.options.spacing) |  | ||||||
|       array[0] = arr |  | ||||||
|       array[1] = that.calculateRoadAngle(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)[0], Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)[3]) |  | ||||||
|       arr.forEach((item, index) => { |  | ||||||
|         const cartographic = Cesium.Cartographic.fromCartesian( |  | ||||||
|           item // Cartesian3对象 {x, y, z} |  | ||||||
|         ); |  | ||||||
|         const longitude = Cesium.Math.toDegrees(cartographic.longitude); |  | ||||||
|         const latitude = Cesium.Math.toDegrees(cartographic.latitude); |  | ||||||
|         const height = cartographic.height; |  | ||||||
|         posiArr.push({ |  | ||||||
|           lng: longitude, |  | ||||||
|           lat: latitude, |  | ||||||
|           alt: height |  | ||||||
|         }) |  | ||||||
|       }) |  | ||||||
|     } else if (that.options.type == '线') { |  | ||||||
|       that.options.positions.forEach(item => { |  | ||||||
|         fromDegreesArray.push(item.lng, item.lat) |  | ||||||
|       }) |  | ||||||
|       array = await that.linePoint(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray), that.options.spacing) |  | ||||||
|       arr = array[0] |  | ||||||
|       that.pointArr = arr |  | ||||||
|       arr.forEach((item, index) => { |  | ||||||
|         const cartographic = Cesium.Cartographic.fromCartesian( |  | ||||||
|           item // Cartesian3对象 {x, y, z} |  | ||||||
|         ); |  | ||||||
|         const longitude = Cesium.Math.toDegrees(cartographic.longitude); |  | ||||||
|         const latitude = Cesium.Math.toDegrees(cartographic.latitude); |  | ||||||
|         const height = cartographic.height; |  | ||||||
|         posiArr.push({ |  | ||||||
|           lng: longitude, |  | ||||||
|           lat: latitude, |  | ||||||
|           alt: height |  | ||||||
|         }) |  | ||||||
|       }) |  | ||||||
|     } else if (that.options.type == '点') { |  | ||||||
|       let height = await that.getClampToHeight({ lng: that.options.positions.lng, lat: that.options.positions.lat }) |  | ||||||
|       posiArr = [{ lng: that.options.positions.lng, lat: that.options.positions.lat, alt: height }] |  | ||||||
|       // posiArr = [that.options.positions] |  | ||||||
|       that.pointArr = posiArr |  | ||||||
|     } |  | ||||||
|     let params = { |  | ||||||
|       type: that.options.type, |  | ||||||
|       positions: posiArr, |  | ||||||
|       rotate: that.options.type == '点' ? undefined : array[1] |  | ||||||
|     } |  | ||||||
|     that.callback(params) |  | ||||||
|     // posiArr.forEach((item, index) => { |  | ||||||
|     //   let model = new Model(that.sdk, { |  | ||||||
|     //     id: 'model' + index, |  | ||||||
|     //     show: that.options.show, |  | ||||||
|     //     url: that.options.url, |  | ||||||
|     //     position: item, |  | ||||||
|     //     rotate: that.options.type == '点' ? undefined : { x: 0, y: 0, z: array[1] && (array[1][index] || array[1]) } |  | ||||||
|     //   }) |  | ||||||
|     //   that.pointArr.push(model) |  | ||||||
|     // }) |  | ||||||
|   } |  | ||||||
|   async linePoint(polygonPositions, spacing) { |  | ||||||
|     let boundaryPoints = []; |  | ||||||
|     let boundaryAngle = []; |  | ||||||
|     for (let i = 0; i < polygonPositions.length - 1; i++) { |  | ||||||
|  |  | ||||||
|       const start = polygonPositions[i]; |  | ||||||
|       const end = polygonPositions[(i + 1) % polygonPositions.length]; |  | ||||||
|       const segmentLength = Cesium.Cartesian3.distance(start, end); |  | ||||||
|       const segments = Math.ceil(segmentLength / spacing); |  | ||||||
|  |  | ||||||
|       for (let j = 0; j <= segments; j++) { |  | ||||||
|         const ratio = j / segments; |  | ||||||
|         let point = Cesium.Cartesian3.lerp( |  | ||||||
|           start, end, ratio, new Cesium.Cartesian3() |  | ||||||
|         ); |  | ||||||
|  |  | ||||||
|         const cartographic = Cesium.Cartographic.fromCartesian( |  | ||||||
|           point // Cartesian3对象 {x, y, z} |  | ||||||
|         ); |  | ||||||
|         const longitude = Cesium.Math.toDegrees(cartographic.longitude); |  | ||||||
|         const latitude = Cesium.Math.toDegrees(cartographic.latitude); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         let height = await this.getClampToHeight({ lng: longitude, lat: latitude }) |  | ||||||
|         point = Cesium.Cartesian3.fromDegrees(longitude, latitude, height); |  | ||||||
|  |  | ||||||
|         boundaryPoints.push(point); |  | ||||||
|         if (j != segments || i == polygonPositions.length - 2) { |  | ||||||
|           boundaryAngle.push(this.calculateRoadAngle(start, end)) |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|     return [[...new Set(boundaryPoints |  | ||||||
|       .map(p => `${p.x},${p.y},${p.z}`))] |  | ||||||
|       .map(str => { |  | ||||||
|         const [x, y, z] = str.split(',').map(Number); |  | ||||||
|         return new Cesium.Cartesian3(x, y, z); |  | ||||||
|       }), boundaryAngle]; |  | ||||||
|   } |  | ||||||
|   calculateRoadAngle(startPoint, endPoint) { |  | ||||||
|     const normal = Cesium.Ellipsoid.WGS84.geodeticSurfaceNormal(startPoint); |  | ||||||
|     const enuMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(startPoint, undefined, normal); |  | ||||||
|     const inverseMatrix = Cesium.Matrix4.inverse(enuMatrix, new Cesium.Matrix4()); |  | ||||||
|  |  | ||||||
|     const localEnd = Cesium.Matrix4.multiplyByPoint(inverseMatrix, endPoint, new Cesium.Cartesian3()); |  | ||||||
|     const horizontalVec = new Cesium.Cartesian2(localEnd.x, localEnd.y); |  | ||||||
|     Cesium.Cartesian2.normalize(horizontalVec, horizontalVec); |  | ||||||
|  |  | ||||||
|     const north = new Cesium.Cartesian2(1, 0); |  | ||||||
|  |  | ||||||
|     let angle = Cesium.Cartesian2.angleBetween(north, horizontalVec); |  | ||||||
|     angle = Cesium.Math.toDegrees(angle) |  | ||||||
|     const cross = Cesium.Cartesian2.cross(north, horizontalVec, new Cesium.Cartesian2()); |  | ||||||
|     // return cross < 0 ? angle : - angle; |  | ||||||
|     return cross < 0 ? -angle : angle; |  | ||||||
|   } |  | ||||||
|   generateInterpolatedPoints(polygonPositions, spacing) { |  | ||||||
|     // 1. 边界点插值 |  | ||||||
|     const boundaryPoints = []; |  | ||||||
|  |  | ||||||
|     for (let i = 0; i < polygonPositions.length; i++) { |  | ||||||
|  |  | ||||||
|       const start = polygonPositions[i]; |  | ||||||
|       const end = polygonPositions[(i + 1) % polygonPositions.length]; |  | ||||||
|       const segmentLength = Cesium.Cartesian3.distance(start, end); |  | ||||||
|       const segments = Math.ceil(segmentLength / spacing); |  | ||||||
|  |  | ||||||
|       for (let j = 0; j <= segments; j++) { |  | ||||||
|         const ratio = j / segments; |  | ||||||
|         const point = Cesium.Cartesian3.lerp( |  | ||||||
|           start, end, ratio, new Cesium.Cartesian3() |  | ||||||
|         ); |  | ||||||
|         boundaryPoints.push(point); |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     // 2. 内部网格生成 |  | ||||||
|     const extent = this.computePolygonExtent(polygonPositions); |  | ||||||
|     let result = this.createGridFromBBox(extent, this.options.spacing) |  | ||||||
|     // const extent = Cesium.Rectangle.fromCartesianArray(polygonPositions); |  | ||||||
|  |  | ||||||
|     const gridPoints = []; |  | ||||||
|     // const polygon = new Cesium.PolygonHierarchy(polygonPositions); |  | ||||||
|     var polygon = [] |  | ||||||
|     this.options.positions.forEach(item => { |  | ||||||
|       polygon.push([item.lng, item.lat]) |  | ||||||
|     }) |  | ||||||
|     polygon.push(polygon[0]) |  | ||||||
|     for (let x = extent.west; x <= extent.east; x += result.lonStep) { |  | ||||||
|       for (let y = extent.south; y <= extent.north; y += result.latStep) { |  | ||||||
|         const position = Cesium.Cartesian3.fromDegrees(x, y); |  | ||||||
|         const point = turf.point([x, y]); |  | ||||||
|         const polygonTurf = turf.polygon([polygon]); |  | ||||||
|         const isInside = turf.booleanPointInPolygon(point, polygonTurf); |  | ||||||
|         isInside && gridPoints.push(position) |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     // 3. 合并结果并去重 |  | ||||||
|     // return [...new Set([...boundaryPoints, ...gridPoints] |  | ||||||
|     return [...new Set([...gridPoints] |  | ||||||
|       .map(p => `${p.x},${p.y},${p.z}`))] |  | ||||||
|       .map(str => { |  | ||||||
|         const [x, y, z] = str.split(',').map(Number); |  | ||||||
|         return new Cesium.Cartesian3(x, y, z); |  | ||||||
|       }); |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   createGridFromBBox(bbox, spacing) { |  | ||||||
|     const earthRadius = 6378137; // WGS84椭球体长半轴 |  | ||||||
|     // 计算经度方向网格数 |  | ||||||
|     const lonDistance = Cesium.Cartesian3.distance( |  | ||||||
|       Cesium.Cartesian3.fromDegrees(bbox.west, (bbox.south + bbox.north) / 2, 0), |  | ||||||
|       Cesium.Cartesian3.fromDegrees(bbox.east, (bbox.south + bbox.north) / 2, 0) |  | ||||||
|     ); |  | ||||||
|     const lonCount = Math.ceil(lonDistance / spacing); |  | ||||||
|  |  | ||||||
|     // 计算纬度方向网格数 |  | ||||||
|     const latDistance = Cesium.Cartesian3.distance( |  | ||||||
|       Cesium.Cartesian3.fromDegrees((bbox.west + bbox.east) / 2, bbox.south, 0), |  | ||||||
|       Cesium.Cartesian3.fromDegrees((bbox.west + bbox.east) / 2, bbox.north, 0) |  | ||||||
|     ); |  | ||||||
|     const latCount = Math.ceil(latDistance / spacing); |  | ||||||
|     // 生成网格线 |  | ||||||
|     const lonStep = (bbox.east - bbox.west) / lonCount; |  | ||||||
|     const latStep = (bbox.north - bbox.south) / latCount; |  | ||||||
|     return { lonStep, latStep } |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   computePolygonExtent(positions) { |  | ||||||
|     // 计算多边形经纬度范围 |  | ||||||
|     const cartographics = positions.map(p => |  | ||||||
|       Cesium.Cartographic.fromCartesian(p)); |  | ||||||
|     const lons = cartographics.map(c => Cesium.Math.toDegrees(c.longitude)); |  | ||||||
|     const lats = cartographics.map(c => Cesium.Math.toDegrees(c.latitude)); |  | ||||||
|     return { |  | ||||||
|       west: Math.min(...lons), |  | ||||||
|       east: Math.max(...lons), |  | ||||||
|       south: Math.min(...lats), |  | ||||||
|       north: Math.max(...lats) |  | ||||||
|     }; |  | ||||||
|   } |  | ||||||
|   async computedArea(polygonPositions, spacing) { |  | ||||||
|     let dis12 = Cesium.Cartesian3.distance(polygonPositions[0], polygonPositions[1]); |  | ||||||
|     let dis23 = Cesium.Cartesian3.distance(polygonPositions[1], polygonPositions[2]); |  | ||||||
|     let vec12 = Cesium.Cartesian3.subtract(polygonPositions[1], polygonPositions[0], new Cesium.Cartesian3()); |  | ||||||
|     let vec23 = Cesium.Cartesian3.subtract(polygonPositions[2], polygonPositions[1], new Cesium.Cartesian3()); |  | ||||||
|  |  | ||||||
|     let num12 = Math.ceil(dis12 / spacing); |  | ||||||
|     let num23 = Math.ceil(dis23 / spacing); |  | ||||||
|  |  | ||||||
|     let line1 = [] |  | ||||||
|     for (let i = 0; i < num12; i++) { |  | ||||||
|       line1.push(await this.calculatePointB(polygonPositions[0], polygonPositions[1], i * spacing)) |  | ||||||
|     } |  | ||||||
|     let line2 = [] |  | ||||||
|     for (let i = 0; i < num12; i++) { |  | ||||||
|       line2.push(await this.calculatePointB(polygonPositions[3], polygonPositions[2], i * spacing)) |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     let allPoints = [] |  | ||||||
|     for (let i = 0; i < line1.length; i++) { |  | ||||||
|       for (let j = 0; j < num23; j++) { |  | ||||||
|         allPoints.push(await this.calculatePointB(line1[i], line2[i], j * spacing)) |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|     return allPoints |  | ||||||
|   } |  | ||||||
|   async calculatePointB(pointA, pointC, distance) { |  | ||||||
|     // 将输入坐标转换为Cartesian3类型 |  | ||||||
|     // const pointA = Cesium.Cartesian3.fromDegrees(a.longitude, a.latitude, a.height); |  | ||||||
|     // const pointC = Cesium.Cartesian3.fromDegrees(c.longitude, c.latitude, c.height); |  | ||||||
|  |  | ||||||
|     // 计算向量AC |  | ||||||
|     const vectorAC = Cesium.Cartesian3.subtract(pointC, pointA, new Cesium.Cartesian3()); |  | ||||||
|  |  | ||||||
|     // 计算向量AC的长度 |  | ||||||
|     const lengthAC = Cesium.Cartesian3.magnitude(vectorAC); |  | ||||||
|  |  | ||||||
|     // 归一化向量AC |  | ||||||
|     const unitVector = Cesium.Cartesian3.normalize(vectorAC, new Cesium.Cartesian3()); |  | ||||||
|  |  | ||||||
|     // 计算点B坐标 |  | ||||||
|     const scaledVector = Cesium.Cartesian3.multiplyByScalar(unitVector, distance, new Cesium.Cartesian3()); |  | ||||||
|     const pointB = Cesium.Cartesian3.add(pointA, scaledVector, new Cesium.Cartesian3()); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     const cartographic = Cesium.Cartographic.fromCartesian( |  | ||||||
|       pointB // Cartesian3对象 {x, y, z} |  | ||||||
|     ); |  | ||||||
|     const longitude = Cesium.Math.toDegrees(cartographic.longitude); |  | ||||||
|     const latitude = Cesium.Math.toDegrees(cartographic.latitude); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     let height = await this.getClampToHeight({ lng: longitude, lat: latitude }) |  | ||||||
|     let point = Cesium.Cartesian3.fromDegrees(longitude, latitude, height); |  | ||||||
|     // 转换回经纬度 |  | ||||||
|     // const cartographic = Cesium.Cartographic.fromCartesian(pointB); |  | ||||||
|     // return { |  | ||||||
|     //   longitude: Cesium.Math.toDegrees(cartographic.longitude), |  | ||||||
|     //   latitude: Cesium.Math.toDegrees(cartographic.latitude), |  | ||||||
|     //   height: cartographic.height |  | ||||||
|     // }; |  | ||||||
|     // return pointB |  | ||||||
|     return point |  | ||||||
|   } |  | ||||||
|   get show() { |  | ||||||
|     return this.options.show |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   set show(v) { |  | ||||||
|     this.options.show = v |  | ||||||
|     for (let i = 0; i < this.pointArr.length; i++) { |  | ||||||
|       this.pointArr[i].show = v |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|   get type() { |  | ||||||
|     return this.options.type |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   set type(v) { |  | ||||||
|     this.options.type = v |  | ||||||
|     this._elms.type && |  | ||||||
|       this._elms.type.forEach(item => { |  | ||||||
|         item.value = v |  | ||||||
|       }) |  | ||||||
|   } |  | ||||||
|   get spacing() { |  | ||||||
|     return this.options.spacing |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   set spacing(v) { |  | ||||||
|     this.options.spacing = v |  | ||||||
|     this._elms.spacing && |  | ||||||
|       this._elms.spacing.forEach(item => { |  | ||||||
|         item.value = v |  | ||||||
|       }) |  | ||||||
|   } |  | ||||||
|   /** |  | ||||||
|    * @description 编辑框 |  | ||||||
|    * @param state=false {boolean} 状态: true打开, false关闭 |  | ||||||
|    */ |  | ||||||
|   async edit(state = false) { |  | ||||||
|     let _this = this |  | ||||||
|     this.originalOptions = this.deepCopyObj(this.options) |  | ||||||
|  |  | ||||||
|     // let elms = this.sdk.viewer._container.getElementsByClassName('YJ-custom-base-dialog') |  | ||||||
|     // for (let i = elms.length - 1; i >= 0; i--) { |  | ||||||
|     //   this.sdk.viewer._container.removeChild(elms[i]) |  | ||||||
|     // } |  | ||||||
|  |  | ||||||
|     if (this._DialogObject && this._DialogObject.close) { |  | ||||||
|       this._DialogObject.close() |  | ||||||
|       this._DialogObject = null |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     if (state) { |  | ||||||
|       this._DialogObject = await new Dialog(this.sdk, this.originalOptions, { |  | ||||||
|         title: '默认模型参数设置', left: '180px', top: '100px', |  | ||||||
|         confirmCallBack: (options) => { |  | ||||||
|           this.name = this.name.trim() |  | ||||||
|           if (!this.name) { |  | ||||||
|             // this.name = '未命名对象' |  | ||||||
|             this.name = '飞线' |  | ||||||
|           } |  | ||||||
|  |  | ||||||
|           let Draw |  | ||||||
|           switch (this.options.type) { |  | ||||||
|             case '点': |  | ||||||
|               Draw = new DrawPoint(this.sdk) |  | ||||||
|               break; |  | ||||||
|             case '线': |  | ||||||
|               Draw = new DrawPolyline(this.sdk) |  | ||||||
|               break; |  | ||||||
|             case '面': |  | ||||||
|               Draw = new DrawThreeRect(this.sdk) |  | ||||||
|               break; |  | ||||||
|             default: |  | ||||||
|               break; |  | ||||||
|           } |  | ||||||
|           Draw && Draw.start((a, positions) => { |  | ||||||
|             this.options.positions = positions; |  | ||||||
|             // this.callback(this.options); |  | ||||||
|             (this.options.positions.length || this.options.positions.lng) && BatchModel.computeDis(this) |  | ||||||
|           }) |  | ||||||
|  |  | ||||||
|           this.originalOptions = this.deepCopyObj(this.options) |  | ||||||
|           this._DialogObject.close() |  | ||||||
|           this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(this.originalOptions) |  | ||||||
|           syncData(this.sdk, this.options.id) |  | ||||||
|           syncSplitData(this.sdk, this.options.id) |  | ||||||
|         }, |  | ||||||
|         // resetCallBack: () => { |  | ||||||
|         //   this.reset() |  | ||||||
|         //   console.log('22222') |  | ||||||
|         //   this.Dialog.resetCallBack && this.Dialog.resetCallBack() |  | ||||||
|         // }, |  | ||||||
|         // removeCallBack: () => { |  | ||||||
|         //   console.log('33333') |  | ||||||
|         //   this.Dialog.removeCallBack && this.Dialog.removeCallBack() |  | ||||||
|         // }, |  | ||||||
|         closeCallBack: () => { |  | ||||||
|           this.reset() |  | ||||||
|           // this.entity.style = new Cesium.Cesium3DTileStyle({ |  | ||||||
|           //   color: "color('rgba(255,255,255," + this.newData.transparency + ")')", |  | ||||||
|           //   show: true, |  | ||||||
|           // }); |  | ||||||
|           this.Dialog.closeCallBack && this.Dialog.closeCallBack() |  | ||||||
|         }, |  | ||||||
|         addFootElm: [ |  | ||||||
|           { |  | ||||||
|             tagName: 'button', |  | ||||||
|             className: 'flipe-over-y', |  | ||||||
|             innerHTML: '重置', |  | ||||||
|             event: [ |  | ||||||
|               'click', |  | ||||||
|               () => { |  | ||||||
|                 this.reset() |  | ||||||
|               } |  | ||||||
|             ] |  | ||||||
|           } |  | ||||||
|         ] |  | ||||||
|         // showCallBack: (show) => { |  | ||||||
|         //   this.show = show |  | ||||||
|         //   this.Dialog.showCallBack && this.Dialog.showCallBack() |  | ||||||
|         // } |  | ||||||
|       }, true) |  | ||||||
|       this._DialogObject._element.body.className = this._DialogObject._element.body.className + ' flow-line-surface' |  | ||||||
|       let contentElm = document.createElement('div'); |  | ||||||
|       contentElm.innerHTML = html() |  | ||||||
|       this._DialogObject.contentAppChild(contentElm) |  | ||||||
|       // 颜色组件 |  | ||||||
|       // let waterColorPicker = new YJColorPicker({ |  | ||||||
|       //   el: contentElm.getElementsByClassName("flowLine-color")[0], |  | ||||||
|       //   size: 'mini',//颜色box类型 |  | ||||||
|       //   alpha: true,//是否开启透明度 |  | ||||||
|       //   defaultColor: this.color, |  | ||||||
|       //   disabled: false,//是否禁止打开颜色选择器 |  | ||||||
|       //   openPickerAni: 'opacity',//打开颜色选择器动画 |  | ||||||
|       //   sure: (color) => { |  | ||||||
|       //     this.color = color |  | ||||||
|       //   },//点击确认按钮事件回调 |  | ||||||
|       //   clear: () => { |  | ||||||
|       //     this.color = 'rgba(255,255,255,1)' |  | ||||||
|       //   },//点击清空按钮事件回调 |  | ||||||
|       // }) |  | ||||||
|  |  | ||||||
|       let all_elm = contentElm.getElementsByTagName("*") |  | ||||||
|       this._EventBinding.on(this, all_elm) |  | ||||||
|       this._elms = this._EventBinding.element |  | ||||||
|  |  | ||||||
|       let nameData = [ |  | ||||||
|         { |  | ||||||
|           name: '点', |  | ||||||
|           value: '点', |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           name: '线', |  | ||||||
|           value: '线', |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           name: '面', |  | ||||||
|           value: '面', |  | ||||||
|         } |  | ||||||
|       ] |  | ||||||
|  |  | ||||||
|       let nameDataLegpObject = legp( |  | ||||||
|         this._DialogObject._element.content.getElementsByClassName( |  | ||||||
|           'add-type-box' |  | ||||||
|         )[0], |  | ||||||
|         '.add-type' |  | ||||||
|       ) |  | ||||||
|       if (nameDataLegpObject) { |  | ||||||
|         nameDataLegpObject.legp_search(nameData) |  | ||||||
|         let nameDataLegpElm = this._DialogObject._element.content |  | ||||||
|           .getElementsByClassName('add-type')[0] |  | ||||||
|           .getElementsByTagName('input')[0] |  | ||||||
|         this._elms.type = [nameDataLegpElm] |  | ||||||
|         nameDataLegpElm.value = this.options.type |  | ||||||
|         for (let i = 0; i < nameData.length; i++) { |  | ||||||
|           if (nameData[i].value === nameDataLegpElm.value) { |  | ||||||
|             nameDataLegpObject.legp_searchActive(nameData[i].value) |  | ||||||
|             break |  | ||||||
|           } |  | ||||||
|         } |  | ||||||
|         nameDataLegpElm.addEventListener('input', () => { |  | ||||||
|           for (let i = 0; i < nameData.length; i++) { |  | ||||||
|             if (nameData[i].value === nameDataLegpElm.value) { |  | ||||||
|               this.type = nameData[i].value |  | ||||||
|               break |  | ||||||
|             } |  | ||||||
|           } |  | ||||||
|         }) |  | ||||||
|       } |  | ||||||
|       // this._elms.color = [waterColorPicker] |  | ||||||
|     } else { |  | ||||||
|       // if (this._element_style) { |  | ||||||
|       //   document.getElementsByTagName('head')[0].removeChild(this._element_style) |  | ||||||
|       //   this._element_style = null |  | ||||||
|       // } |  | ||||||
|       // if (this._DialogObject && this._DialogObject.remove) { |  | ||||||
|       //   this._DialogObject.remove() |  | ||||||
|       //   this._DialogObject = null |  | ||||||
|       // } |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|   drawArea() { |  | ||||||
|  |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   reset() { |  | ||||||
|     this.name = this.originalOptions.name |  | ||||||
|     this.type = this.originalOptions.type |  | ||||||
|     this.spacing = this.originalOptions.spacing |  | ||||||
|     this.show = this.originalOptions.show |  | ||||||
|     this.options.spacing = this.originalOptions.spacing |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   /** |  | ||||||
|    * 飞到对应实体 |  | ||||||
|    */ |  | ||||||
|   async flyTo(options = {}) { |  | ||||||
|     setActiveViewer(0) |  | ||||||
|     closeRotateAround(this.sdk) |  | ||||||
|     closeViewFollow(this.sdk) |  | ||||||
|  |  | ||||||
|     if (this.options.customView && this.options.customView.relativePosition && this.options.customView.orientation) { |  | ||||||
|       let orientation = { |  | ||||||
|         heading: Cesium.Math.toRadians(this.options.customView.orientation.heading || 0.0), |  | ||||||
|         pitch: Cesium.Math.toRadians(this.options.customView.orientation.pitch || -60.0), |  | ||||||
|         roll: Cesium.Math.toRadians(this.options.customView.orientation.roll || 0.0) |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|       let lng = this.options.customView.relativePosition.lng |  | ||||||
|       let lat = this.options.customView.relativePosition.lat |  | ||||||
|       let alt = this.options.customView.relativePosition.alt |  | ||||||
|       let destination = Cesium.Cartesian3.fromDegrees(lng, lat, alt) |  | ||||||
|  |  | ||||||
|       let position = { lng: 0, lat: 0 } |  | ||||||
|       if (this.options.position) { |  | ||||||
|         position = { ...this.options.position } |  | ||||||
|       } |  | ||||||
|       else if (this.options.positions) { |  | ||||||
|         position = { ...this.options.positions[0] } |  | ||||||
|       } |  | ||||||
|       else if (this.options.center) { |  | ||||||
|         position = { ...this.options.center } |  | ||||||
|       } |  | ||||||
|       else if (this.options.start) { |  | ||||||
|         position = { ...this.options.start } |  | ||||||
|       } |  | ||||||
|       else { |  | ||||||
|         if (this.options.hasOwnProperty('lng')) { |  | ||||||
|           position.lng = this.options.lng |  | ||||||
|         } |  | ||||||
|         if (this.options.hasOwnProperty('lat')) { |  | ||||||
|           position.lat = this.options.lat |  | ||||||
|         } |  | ||||||
|         if (this.options.hasOwnProperty('alt')) { |  | ||||||
|           position.alt = this.options.alt |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|       // 如果没有高度值,则获取紧贴高度计算 |  | ||||||
|       // if (!position.hasOwnProperty('alt')) { |  | ||||||
|       //   position.alt = await this.getClampToHeight(position) |  | ||||||
|       // } |  | ||||||
|       lng = this.options.customView.relativePosition.lng + position.lng |  | ||||||
|       lat = this.options.customView.relativePosition.lat + position.lat |  | ||||||
|       alt = this.options.customView.relativePosition.alt + position.alt |  | ||||||
|       destination = Cesium.Cartesian3.fromDegrees(lng, lat, alt) |  | ||||||
|       this.sdk.viewer.camera.flyTo({ |  | ||||||
|         destination: destination, |  | ||||||
|         orientation: orientation |  | ||||||
|       }) |  | ||||||
|     } |  | ||||||
|     else { |  | ||||||
|       let positionArray = [] |  | ||||||
|       if (this.options.positions.length > 0) { |  | ||||||
|         for (let i = 0; i < this.options.positions.length; i++) { |  | ||||||
|           let a = Cesium.Cartesian3.fromDegrees( |  | ||||||
|             this.options.positions[i].lng, |  | ||||||
|             this.options.positions[i].lat, |  | ||||||
|             this.options.positions[i].alt |  | ||||||
|           ) |  | ||||||
|           positionArray.push(a.x, a.y, a.z) |  | ||||||
|         } |  | ||||||
|         let BoundingSphere = Cesium.BoundingSphere.fromVertices(positionArray) |  | ||||||
|         this.viewer.camera.flyToBoundingSphere(BoundingSphere, { |  | ||||||
|           offset: { |  | ||||||
|             heading: Cesium.Math.toRadians(0.0), |  | ||||||
|             pitch: Cesium.Math.toRadians(-20.0), |  | ||||||
|             roll: Cesium.Math.toRadians(0.0) |  | ||||||
|           } |  | ||||||
|         }) |  | ||||||
|       } else if (this.options.positions.lng) { |  | ||||||
|         let orientation = { |  | ||||||
|           heading: Cesium.Math.toRadians(0.0), |  | ||||||
|           pitch: Cesium.Math.toRadians(-60.0), |  | ||||||
|           roll: Cesium.Math.toRadians(0.0) |  | ||||||
|         } |  | ||||||
|         this.sdk.viewer.camera.flyTo({ |  | ||||||
|           destination: Cesium.Cartesian3.fromDegrees(this.options.positions.lng, this.options.positions.lat, this.options.positions.alt + 100), |  | ||||||
|           // orientation: orientation |  | ||||||
|         }) |  | ||||||
|  |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|   /** |  | ||||||
|    * 删除 |  | ||||||
|    */ |  | ||||||
|   async remove() { |  | ||||||
|     for (let i = 0; i < this.pointArr.length; i++) { |  | ||||||
|       this.pointArr[i].remove() |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     this.pointArr = [] |  | ||||||
|     this.positions = [] |  | ||||||
|     this.entity = null |  | ||||||
|  |  | ||||||
|     if (this._DialogObject && !this._DialogObject.isDestroy) { |  | ||||||
|       this._DialogObject.close() |  | ||||||
|       this._DialogObject = null |  | ||||||
|     } |  | ||||||
|     await this.sdk.removeIncetance(this.options.id) |  | ||||||
|     await syncData(this.sdk, this.options.id) |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   flicker() { } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| export default BatchModel |  | ||||||
| @ -29,8 +29,7 @@ import MouseTip from '../../../MouseTip' | |||||||
| import { | import { | ||||||
|   setSplitDirection, |   setSplitDirection, | ||||||
|   syncSplitData, |   syncSplitData, | ||||||
|   setActiveId, |   setActiveId | ||||||
|   getState |  | ||||||
| } from '../../../Global/SplitScreen' | } from '../../../Global/SplitScreen' | ||||||
| import { | import { | ||||||
|   setActiveViewer, |   setActiveViewer, | ||||||
| @ -41,71 +40,32 @@ 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 创建点标注 | ||||||
|    * @param options {object} 属性 |    * @param sdk {object} sdk | ||||||
|  |    * @param options {object} 标注参数 | ||||||
|    * @param options.id {string} 标注id |    * @param options.id {string} 标注id | ||||||
|    * @param options.show=true {boolean} 标注整体的显隐 |    * @param {object} options.positions 位置 | ||||||
|    * @param options.name {string} 名称 |    * @param {number} options.positions.lng 经度 | ||||||
|    * @param {object} options.position={} 必填,位置 |    * @param {number} options.positions.lat 纬度 | ||||||
|    * @param {number} options.position.lng 经度 |    * @param {number} options.positions.alt 高度 | ||||||
|    * @param {number} options.position.lat 纬度 |  | ||||||
|    * @param {number} options.position.alt 高度 |  | ||||||
|    * @param {number} options.heightMode=3 高度模式(0:海拔高度;1:相对地表;2:依附地表; 3:依附模型) |    * @param {number} options.heightMode=3 高度模式(0:海拔高度;1:相对地表;2:依附地表; 3:依附模型) | ||||||
|    * @param [options.scaleByDistance=true] {boolean} 是否开启跟随视野缩放 |    * @param [options.scaleByDistance=true] {boolean} 图标是否跟随视角变化进行字段缩放 | ||||||
|    * @param [options.near=2000] {number} 视野缩放最近距离 |    * @param [options.show=true] {boolean} 标注整体的显示/隐藏 | ||||||
|    * @param [options.far=100000]  {number} 视野缩放最远距离 |    * @param [options.near=2000] {number} 近端可视距离 scaleByDistance为true时生效 | ||||||
|    * @param options.billboard {object} 图标参数 |    * @param [options.far=100000]  {number} 远端可视距离 scaleByDistance为true时生效 | ||||||
|    * @param [options.billboard.show=true] {boolean} 图标显隐 |    * @param options.billboard {object} 标注中图标的参数 | ||||||
|  |    * @param [options.billboard.show=true] {boolean} 标注中图标的显示与隐藏 | ||||||
|    * @param options.billboard.image {string} 图标路径 |    * @param options.billboard.image {string} 图标路径 | ||||||
|    * @param options.billboard.defaultImage {string} 默认图标的唯一标识 |    * @param options.billboard.defaultImage {string} 默认图标的唯一标识 | ||||||
|    * @param [options.billboard.scale=3] {number} 图标放大倍数 |    * @param [options.billboard.scale=3] {number} 图标倍数 | ||||||
|    * @param options.label {object} 文字参数 |    *@param options.label {object} 标注文字的参数 | ||||||
|    * @param [options.label.text] {string} 文字内容 |    *@param [options.label.text] {string} 标注中文字 | ||||||
|    * @param [options.label.show=true] {boolean} 文字显隐 |    *@param [options.label.show=true] {boolean} 标注文字显示/隐藏 | ||||||
|    * @param [options.label.fontFamily=0] {number} 文字字体项 0:黑体;1:思源黑体;2:庞门正道标题体;3:数黑体 |    *@param [options.label.fontFamily=0] {number} 标注文字字体 0:黑体;1:思源黑体;2:庞门正道标题体;3:数黑体 | ||||||
|    * @param [options.label.fontSize=39] {number} 文字大小, 单位px |    *@param [options.label.fontSize=39] {number} 标注文字大小 单位px,微软雅黑 | ||||||
|    * @param [options.label.color=#00ffff] {string} 文字颜色 |    *@param [options.label.color=#00ffff] {string} 标注文字颜色 | ||||||
|    * @param options.attribute {object} 属性内容 |  | ||||||
|    * @param {object} options.attribute.link={}  链接 |  | ||||||
|    * @param options.attribute.link.content=[]] {array} 链接内容 |  | ||||||
|    * @param options.attribute.link.content[].name {string} 链接名称 |  | ||||||
|    * @param options.attribute.link.content[].url {string} 链接地址 |  | ||||||
|    * @param {object} options.attribute.vr={} 全景图 |  | ||||||
|    * @param options.attribute.vr.content=[]] {array} 全景图内容 |  | ||||||
|    * @param options.attribute.vr.content[].name {string} 名称 |  | ||||||
|    * @param options.attribute.vr.content[].url {string} 地址 |  | ||||||
|    * @param {object} ptions.attribute.camera={} 摄像头 |  | ||||||
|    * @param options.attribute.camera.content=[]] {array} 摄像头内容 |  | ||||||
|    * @param {object} options.attribute.ISC={} ISC |  | ||||||
|    * @param options.attribute.ISC.content=[]] {array} ISC内容 |  | ||||||
|    * @param {object} options.attribute.goods={} 物资 |  | ||||||
|    * @param options.attribute.goods.content=[]] {array} 物资内容 |  | ||||||
|    * @param options.attribute.goods.content[].ID {string} ID |  | ||||||
|    * @param options.attribute.goods.content[].name {string} 名称 |  | ||||||
|    * @param options.attribute.goods.content[].cnt {string} 数量 |  | ||||||
|    * @param options.richTextContent {string} 富文本内容 |  | ||||||
|    * @param options.customView {object} 默认视角 |  | ||||||
|    * @param options.customView.orientation {object} 默认视角方位 |  | ||||||
|    * @param options.customView.orientation.heading {number} 航向角 |  | ||||||
|    * @param options.customView.orientation.pitch {number} 俯仰角 |  | ||||||
|    * @param options.customView.orientation.roll {number} 翻滚角 |  | ||||||
|    * @param options.customView.relativePosition {object} 视角相对位置 |  | ||||||
|    * @param options.customView.relativePosition.lng {number} 经度 |  | ||||||
|    * @param options.customView.relativePosition.lat {number} 纬度 |  | ||||||
|    * @param options.customView.relativePosition.alt {number} 高度 |  | ||||||
|    *  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|    *@param _Dialog {object} 弹框事件 |    *@param _Dialog {object} 弹框事件 | ||||||
|    *@param _Dialog.confirmCallBack {function} 弹框确认时的回调 |    *@param _Dialog.confirmCallBack {function} 弹框确认时的回调 | ||||||
|    *@param _Dialog.instructSubmit(id,name,instruct) {function} 提交指令(ID, 名称,指令内容) |    *@param _Dialog.instructSubmit(id,name,instruct) {function} 提交指令(ID, 名称,指令内容) | ||||||
| @ -158,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 | ||||||
| @ -186,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 | ||||||
|  |  | ||||||
| @ -230,111 +182,7 @@ class BillboardObject extends Base { | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     this.#_destroyMouseEvent = () => { |  | ||||||
|       this.attributeElm && (this.attributeElm.style.pointerEvents = 'unset') |  | ||||||
|       if(this.sdk && this.sdk.viewer && this.sdk.viewer._element) { |  | ||||||
|         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) | ||||||
| @ -395,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 | ||||||
|         } |         } | ||||||
| @ -420,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) |  | ||||||
|         } |         } | ||||||
|       }) |       }) | ||||||
|     } |     } | ||||||
| @ -452,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) { | ||||||
| @ -464,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) |  | ||||||
|         } |         } | ||||||
|       }; |       }; | ||||||
|     } |     } | ||||||
| @ -621,36 +465,15 @@ class BillboardObject extends Base { | |||||||
|     return this.options.show |     return this.options.show | ||||||
|   } |   } | ||||||
|   set show(v) { |   set show(v) { | ||||||
|     if (!this.isShowView) { |     if(!this.isShowView) { | ||||||
|       this.options.show = v |       this.options.show = v | ||||||
|       this.originalOptions.show = v |       this.originalOptions.show = v | ||||||
|     } |     } | ||||||
|     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) | ||||||
| @ -739,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) | ||||||
|   } |   } | ||||||
| @ -813,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() | ||||||
| @ -1914,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' | ||||||
| @ -2441,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() | ||||||
|   } |   } | ||||||
| @ -2449,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 | ||||||
|     } |     } | ||||||
| @ -2640,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 | ||||||
| @ -2656,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) { | ||||||
| @ -2672,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 | ||||||
|           } |           } | ||||||
|         } |         } | ||||||
| @ -2957,219 +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 |  | ||||||
|       if(getState()) { |  | ||||||
|         attributeElm.style.display = 'none' |  | ||||||
|       } |  | ||||||
|       // 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 | ||||||
|  | |||||||
| @ -21,53 +21,23 @@ class CircleDiffuse extends Base { | |||||||
|    * @param sdk  |    * @param sdk  | ||||||
|    * @param options {object} 圆属性 |    * @param options {object} 圆属性 | ||||||
|    * @param options.id {string} 标注id |    * @param options.id {string} 标注id | ||||||
|    * @param options.show=true {boolean} 显示/隐藏 |    * @param [options.show=true] {boolean} 显示/隐藏 | ||||||
|    * @param options.lng {number} 经度 |    * @param options.lng {number} 经度 | ||||||
|    * @param options.lat {number} 维度 |    * @param options.lat {number} 维度 | ||||||
|    * @param options.color=#1FA8E3 {string} 基础颜色 |    * @param options.color=#1FA8E3 {string} 基础颜色 | ||||||
|  |    * @param options.colors=[] {string} 范围颜色 | ||||||
|    * @param options.speed=5 {number} 速度 |    * @param options.speed=5 {number} 速度 | ||||||
|    * @param options.count=3 {number} 波纹数量 |    * @param options.count=3 {number} 波纹数量 | ||||||
|    * @param options.circle=[]] {array} 圆属性 |    * @param options.circle=[{radius, color}] {object} 圆属性;radius:半径,color:颜色 | ||||||
|    * @param options.circle[].radius {number} 半径 |    * @param _Dialog {object} 弹框事件 | ||||||
|    * @param options.circle[].color {string} 颜色 |    * @param _Dialog.confirmCallBack {function} 弹框确认时的回调 | ||||||
|    * @param options.label {object} 标签对象 |  | ||||||
|    * @param options.label.show {string} 标签显隐 |  | ||||||
|    * @param options.label.position {string} 标签位置 |  | ||||||
|    * @param options.label.position {object} 标签位置 |  | ||||||
|    * @param options.label.position.lng {number} 经度 |  | ||||||
|    * @param options.label.position.lat {number} 纬度 |  | ||||||
|    * @param options.label.position.alt {number} 高度 |  | ||||||
|    * @param options.label.fontSize=20 {number} 字体大小 |  | ||||||
|    * @param options.label.fontFamily=0 {number} 字体项 0:黑体;1:思源黑体;2:庞门正道标题体;3:数黑体 |  | ||||||
|    * @param options.label.color=#ffffff {string} 字体颜色 |  | ||||||
|    * @param options.label.lineWidth=4 {number} 引线宽 |  | ||||||
|    * @param options.label.lineColor=#00ffff80 {string} 引线颜色 |  | ||||||
|    * @param options.label.pixelOffset=20 {number} 字体偏移(引线长度) |  | ||||||
|    * @param options.label.backgroundColor=['#00ffff80', '#00ffff80'] {array} 背景颜色 |  | ||||||
|    * @param options.label.scaleByDistance {boolean} 距离缩放 |  | ||||||
|    * @param options.label.near=2000 {number} 视野缩放最近距离 |  | ||||||
|    * @param options.label.far=100000 {number} 视野缩放最远距离 |  | ||||||
|    * @param options.attribute {object} 属性内容 |  | ||||||
|    * @param {object} options.attribute.link={} 链接 |  | ||||||
|    * @param options.attribute.link.content=[]] {array} 链接内容 |  | ||||||
|    * @param options.attribute.link.content[].name {string} 链接名称 |  | ||||||
|    * @param options.attribute.link.content[].url {string} 链接地址 |  | ||||||
|    * @param options.richTextContent {string} 富文本内容 |  | ||||||
|    * @param options.customView {object} 默认视角 |  | ||||||
|    * @param options.customView.orientation {object} 默认视角方位 |  | ||||||
|    * @param options.customView.orientation.heading {number} 航向角 |  | ||||||
|    * @param options.customView.orientation.pitch {number} 俯仰角 |  | ||||||
|    * @param options.customView.orientation.roll {number} 翻滚角 |  | ||||||
|    * @param options.customView.relativePosition {object} 视角相对位置 |  | ||||||
|    * @param options.customView.relativePosition.lng {number} 经度 |  | ||||||
|    * @param options.customView.relativePosition.lat {number} 纬度 |  | ||||||
|    * @param options.customView.relativePosition.alt {number} 高度 |  | ||||||
|    */ |    */ | ||||||
|   constructor(sdk, options = {}, _Dialog = {}) { |   constructor(sdk, options = {}, _Dialog = {}) { | ||||||
|     super(sdk, options); |     super(sdk, options); | ||||||
|     this.options.lng = options.lng |     this.options.lng = options.lng | ||||||
|     this.options.lat = options.lat |     this.options.lat = options.lat | ||||||
|     this.options.color = options.color || '#1FA8E3' |     this.options.color = options.color || '#1FA8E3' | ||||||
|  |     this.options.colors = options.colors || [] | ||||||
|     this.options.transparency = (options.transparency || options.transparency === 0) ? options.transparency : 1 |     this.options.transparency = (options.transparency || options.transparency === 0) ? options.transparency : 1 | ||||||
|     if (this.options.transparency > 1) { |     if (this.options.transparency > 1) { | ||||||
|       this.options.transparency = 1 |       this.options.transparency = 1 | ||||||
| @ -211,7 +181,7 @@ class CircleDiffuse extends Base { | |||||||
|       } |       } | ||||||
|       that.sdk._entityZIndex++ |       that.sdk._entityZIndex++ | ||||||
|       if (that.sdk.viewer._element.className === 'cesium-viewer 2d') { |       if (that.sdk.viewer._element.className === 'cesium-viewer 2d') { | ||||||
|         that.entity.ellipse.height = 1 |         that.entity.ellipse.height = 1000000 | ||||||
|       } |       } | ||||||
|       CircleDiffuse.createLabel(that) |       CircleDiffuse.createLabel(that) | ||||||
|       syncData(that.sdk, that.options.id) |       syncData(that.sdk, that.options.id) | ||||||
| @ -460,6 +430,15 @@ class CircleDiffuse extends Base { | |||||||
|     }) |     }) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   get colors() { | ||||||
|  |     return this.options.colors | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   set colors(v) { | ||||||
|  |     this.options.colors = v | ||||||
|  |     CircleDiffuse.create(this) | ||||||
|  |   } | ||||||
|  |  | ||||||
|   get labelShow() { |   get labelShow() { | ||||||
|     return this.options.label.show |     return this.options.label.show | ||||||
|   } |   } | ||||||
|  | |||||||
| @ -18,63 +18,22 @@ import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Gl | |||||||
| class CircleObject extends Base { | class CircleObject extends Base { | ||||||
|   /** |   /** | ||||||
|    * @constructor |    * @constructor | ||||||
|    * @param sdk |  | ||||||
|    * @description 创建圆 |    * @description 创建圆 | ||||||
|  |    * @param options {object} 圆属性 | ||||||
|    * @param options.id {string} 标注id |    * @param options.id {string} 标注id | ||||||
|    * @param options.name {string} 名称 |    * @param options.name {string} 名称 | ||||||
|    * @param options.show=true {boolean} 显示/隐藏 |    * @param options.show=true {boolean} 显示/隐藏 | ||||||
|    * @param options.color="#ff000080" {string} 颜色 |    * @param options.color="#ff000080" {string} 颜色 | ||||||
|    * @param options.center {object} 中心位置 |    * @param options.center {object} 位置 | ||||||
|    * @param options.center.lng {number} 经度 |    * @param options.center.lng {object} 经度 | ||||||
|    * @param options.center.lat {number} 纬度 |    * @param options.center.lat {object} 纬度 | ||||||
|    * @param options.center.alt {number} 高度 |    * @param options.center.alt {object} 高度 | ||||||
|    * @param options.radius=10 {number}半径 |    * @param options.radius=10 {object}半径 | ||||||
|    * @param options.line {object} 边框 |    * @param options.line {object} 边框 | ||||||
|    * @param options.line.width=3 {number} 边框宽 |    * @param options.line.width=2 {string} 边框宽 | ||||||
|    * @param options.line.color="#ff000080" {string} 边框颜色 |    * @param options.line.color="#ff000080" {string} 边框颜色 | ||||||
|  |    * @param options.label {object} 标注 | ||||||
|    * @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式) |    * @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式) | ||||||
|    * @param options.areaUnit='平方米' {string} 面积单位 |  | ||||||
|    * @param options.customView {object} 默认视角 |  | ||||||
|    * @param options.customView.orientation {object} 默认视角方位 |  | ||||||
|    * @param options.customView.orientation.heading {number} 航向角 |  | ||||||
|    * @param options.customView.orientation.pitch {number} 俯仰角 |  | ||||||
|    * @param options.customView.orientation.roll {number} 翻滚角 |  | ||||||
|    * @param options.customView.relativePosition {object} 视角相对位置 |  | ||||||
|    * @param options.customView.relativePosition.lng {number} 经度 |  | ||||||
|    * @param options.customView.relativePosition.lat {number} 纬度 |  | ||||||
|    * @param options.customView.relativePosition.alt {number} 高度 |  | ||||||
|    * @param options.label {object} 标签对象 |  | ||||||
|    * @param options.label.text {string} 标签文本 |  | ||||||
|    * @param options.label.show {string} 标签显隐 |  | ||||||
|    * @param options.label.position {object} 标签位置 |  | ||||||
|    * @param options.label.position.lng {number} 经度 |  | ||||||
|    * @param options.label.position.lat {number} 纬度 |  | ||||||
|    * @param options.label.position.alt {number} 高度 |  | ||||||
|    * @param options.label.fontSize=20 {number} 字体大小 |  | ||||||
|    * @param options.label.fontFamily=0 {number} 字体项 0:黑体;1:思源黑体;2:庞门正道标题体;3:数黑体 |  | ||||||
|    * @param options.label.color=#ffffff {string} 字体颜色 |  | ||||||
|    * @param options.label.lineWidth=4 {number} 引线宽 |  | ||||||
|    * @param options.label.lineColor=#00ffff80 {string} 引线颜色 |  | ||||||
|    * @param options.label.pixelOffset=20 {number} 字体偏移(引线长度) |  | ||||||
|    * @param options.label.backgroundColor=['#00ffff80', '#00ffff80'] {array} 背景颜色 |  | ||||||
|    * @param options.label.scaleByDistance {boolean} 距离缩放 |  | ||||||
|    * @param options.label.near=2000 {number} 视野缩放最近距离 |  | ||||||
|    * @param options.label.far=100000 {number} 视野缩放最远距离 |  | ||||||
|    * @param options.attribute {object} 属性内容 |  | ||||||
|    * @param options.attribute.link {object} 链接 |  | ||||||
|    * @param options.attribute.link.content=[]] {array} 链接内容 |  | ||||||
|    * @param options.attribute.link.content[].name {string} 链接名称 |  | ||||||
|    * @param options.attribute.link.content[].url {string} 链接地址 |  | ||||||
|    * @param options.richTextContent {string} 富文本内容 |  | ||||||
|    * @param options.customView {object} 默认视角 |  | ||||||
|    * @param options.customView.orientation {object} 默认视角方位 |  | ||||||
|    * @param options.customView.orientation.heading {number} 航向角 |  | ||||||
|    * @param options.customView.orientation.pitch {number} 俯仰角 |  | ||||||
|    * @param options.customView.orientation.roll {number} 翻滚角 |  | ||||||
|    * @param options.customView.relativePosition {object} 视角相对位置 |  | ||||||
|    * @param options.customView.relativePosition.lng {number} 经度 |  | ||||||
|    * @param options.customView.relativePosition.lat {number} 纬度 |  | ||||||
|    * @param options.customView.relativePosition.alt {number} 高度 |  | ||||||
|    */ |    */ | ||||||
|   constructor(sdk, options = {}) { |   constructor(sdk, options = {}) { | ||||||
|     super(sdk, options); |     super(sdk, options); | ||||||
|  | |||||||
| @ -21,57 +21,30 @@ class CurvelineObject extends Base { | |||||||
|   /** |   /** | ||||||
|    * @constructor |    * @constructor | ||||||
|    * @param sdk |    * @param sdk | ||||||
|    * @description 曲线 |    * @description 折线 | ||||||
|    * @param options {object} 线属性 |    * @param options {object} 线属性 | ||||||
|    * @param options.name{string} 名称 |    * @param options.name{string} 名称 | ||||||
|    * @param options.width=3{number} 线宽 |    * @param options.width=3{number} 线宽 | ||||||
|    * @param options.color=#ff0000 {string} 颜色 |    * @param options.color=#ff0000 {string} 颜色 | ||||||
|    * @param options.type=0 {number} 材质类型 0-实线 1-虚线 2-泛光... |    * @param options.type=0 {number} 材质类型 0-实线 1-虚线 2-泛光 | ||||||
|    * @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对高度;2:依附模式) |    * @param options.heightMode{number} 高度模式(0:海拔高度;1:相对高度;2:依附模式) | ||||||
|    * @param options.noseToTail=false {boolean} 首尾相连 |    * @param options['nose-to-tail']=false {boolean} 首尾相连 | ||||||
|    * @param options.extend=false {boolean} 线缓冲 |    * @param options.extend=false {boolean} 线缓冲 | ||||||
|    * @param options.extendWidth=10 {number} 线缓冲宽度 |    * @param options['extend-width']=10 {number} 线缓冲宽度 | ||||||
|    * @param options.extendColor=rgba(255,255,80,0.3) {number} 线缓冲颜色 |    * @param options['extend-color']=#ffde00 {number} 线缓冲颜色 | ||||||
|    * @param options.show=true {boolean} 显隐 |    * @param options.show=true {boolean} 显隐 | ||||||
|    * @param {Array.<object>} options.positions 必填,经纬度和高度的列表,值交替 [{lon,lat,alt},...] |    * @param {Array.<object>} options.positions 坐标数组 [{lng,lat},...] | ||||||
|    * @param options.positions[].lng {number} 经度 |    * @param options.label {object} 标注 | ||||||
|    * @param options.positions[].lat {number} 纬度 |    * @param options.label.show=false {boolean} 标注显隐 | ||||||
|    * @param options.positions[].alt {number} 高度 |    * @param options.label.fontSize=20 {number} 标注字体大小 | ||||||
|    * @param options.label {object} 标签对象 |    * @param options.label.color=#ffffff {string} 标注字体颜色 | ||||||
|    * @param options.label.text {string} 标签文本 |    * @param options.label.lineWidth=1 {number} 标注引线宽 | ||||||
|    * @param options.label.show {string} 标签显隐 |    * @param options.label.pixelOffset=20 {string} 标注引线长度 | ||||||
|    * @param options.label.position {string} 标签位置 |    * @param options.label.backgroundColor=['#42c6ef', '#42c6ef'] {Array} 标注背景 | ||||||
|    * @param options.label.position {object} 标签位置 |    * @param options.label.lineColor=#fff000 {string} 标注引线颜色 | ||||||
|    * @param options.label.position.lng {number} 经度 |    * @param options.label.scaleByDistance=false {boolean} 标注是否随视野缩放 | ||||||
|    * @param options.label.position.lat {number} 纬度 |    * @param options.label.near=2000 {boolean} 标注随视野缩放最近距离 | ||||||
|    * @param options.label.position.alt {number} 高度 |    * @param options.label.far=100000 {boolean} 标注随视野缩放最远距离 | ||||||
|    * @param options.label.fontSize=20 {number} 字体大小 |  | ||||||
|    * @param options.label.fontFamily=0 {number} 字体项 0:黑体;1:思源黑体;2:庞门正道标题体;3:数黑体 |  | ||||||
|    * @param options.label.color=#ffffff {string} 字体颜色 |  | ||||||
|    * @param options.label.lineWidth=4 {number} 引线宽 |  | ||||||
|    * @param options.label.lineColor=#00ffff80 {string} 引线颜色 |  | ||||||
|    * @param options.label.pixelOffset=20 {number} 字体偏移(引线长度) |  | ||||||
|    * @param options.label.backgroundColor=['#00ffff80', '#00ffff80'] {array} 背景颜色 |  | ||||||
|    * @param options.label.scaleByDistance {boolean} 距离缩放 |  | ||||||
|    * @param options.label.near=2000 {number} 视野缩放最近距离 |  | ||||||
|    * @param options.label.far=100000 {number} 视野缩放最远距离 |  | ||||||
|    * @param options.attribute {object} 属性内容 |  | ||||||
|    * @param options.attribute.link={} {string} 链接 |  | ||||||
|    * @param options.attribute.link.content=[]] {array} 链接内容 |  | ||||||
|    * @param options.attribute.link.content[].name {string} 链接名称 |  | ||||||
|    * @param options.attribute.link.content[].url {string} 链接地址 |  | ||||||
|    * @param options.richTextContent {string} 富文本内容 |  | ||||||
|    * @param options.customView {object} 默认视角 |  | ||||||
|    * @param options.customView.orientation {object} 默认视角方位 |  | ||||||
|    * @param options.customView.orientation.heading {number} 航向角 |  | ||||||
|    * @param options.customView.orientation.pitch {number} 俯仰角 |  | ||||||
|    * @param options.customView.orientation.roll {number} 翻滚角 |  | ||||||
|    * @param options.customView.relativePosition {object} 视角相对位置 |  | ||||||
|    * @param options.customView.relativePosition.lng {number} 经度 |  | ||||||
|    * @param options.customView.relativePosition.lat {number} 纬度 |  | ||||||
|    * @param options.customView.relativePosition.alt {number} 高度 |  | ||||||
|    *  |  | ||||||
|    *  |  | ||||||
|    * @param _Dialog {object} 弹框事件 |    * @param _Dialog {object} 弹框事件 | ||||||
|    * @param _Dialog.confirmCallBack {function} 弹框确认时的回调 |    * @param _Dialog.confirmCallBack {function} 弹框确认时的回调 | ||||||
|    * */ |    * */ | ||||||
| @ -149,7 +122,6 @@ class CurvelineObject extends Base { | |||||||
|     this.operate = {} |     this.operate = {} | ||||||
|     this.nodePoints = [] |     this.nodePoints = [] | ||||||
|     this.unitNum = 0 |     this.unitNum = 0 | ||||||
|     this.inputSpeed = (options.speed && Math.pow(options.speed, -1) * 100) || 10 |  | ||||||
|     this.Dialog = _Dialog |     this.Dialog = _Dialog | ||||||
|     if (!this.options.positions || this.options.positions.length < 2) { |     if (!this.options.positions || this.options.positions.length < 2) { | ||||||
|       this._error = '线段最少需要两个坐标!' |       this._error = '线段最少需要两个坐标!' | ||||||
| @ -179,10 +151,7 @@ class CurvelineObject extends Base { | |||||||
|   set color(v) { |   set color(v) { | ||||||
|     this.options.color = v || '#ff0000' |     this.options.color = v || '#ff0000' | ||||||
|     // this.entity.polyline.material = this.getMaterial(v, this.options.type) |     // this.entity.polyline.material = this.getMaterial(v, this.options.type) | ||||||
|     let params = { ...this.options } |     this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) | ||||||
|     params.speed = this.inputSpeed |  | ||||||
|     // this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) |  | ||||||
|     this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, params) |  | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new YJColorPicker({ |         let colorPicker = new YJColorPicker({ | ||||||
| @ -208,13 +177,9 @@ class CurvelineObject extends Base { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   set speed(v) { |   set speed(v) { | ||||||
|     this.options.speed = v |     // this.options.speed = v | ||||||
|     // this.options.speed = v !== 0 ? Math.pow(v, -1) * 100 : 0 |     this.options.speed = v !== 0 ? Math.pow(v, -1) * 100 : 0 | ||||||
|     this.inputSpeed = v !== 0 ? Math.pow(v, -1) * 100 : 0 |     this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) | ||||||
|     let params = { ...this.options } |  | ||||||
|     params.speed = this.inputSpeed |  | ||||||
|     // this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) |  | ||||||
|     this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, params) |  | ||||||
|   } |   } | ||||||
|   get dashSize() { |   get dashSize() { | ||||||
|     return this.options.dashSize |     return this.options.dashSize | ||||||
| @ -222,10 +187,7 @@ class CurvelineObject extends Base { | |||||||
|  |  | ||||||
|   set dashSize(v) { |   set dashSize(v) { | ||||||
|     this.options.dashSize = v |     this.options.dashSize = v | ||||||
|     let params = { ...this.options } |     this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) | ||||||
|     params.speed = this.inputSpeed |  | ||||||
|     // this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) |  | ||||||
|     this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, params) |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   get rotate() { |   get rotate() { | ||||||
| @ -250,10 +212,7 @@ class CurvelineObject extends Base { | |||||||
|  |  | ||||||
|   set space(v) { |   set space(v) { | ||||||
|     this.options.space = v |     this.options.space = v | ||||||
|     let params = { ...this.options } |     this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) | ||||||
|     params.speed = this.inputSpeed |  | ||||||
|     // this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) |  | ||||||
|     this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, params) |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   get length() { |   get length() { | ||||||
| @ -487,15 +446,13 @@ class CurvelineObject extends Base { | |||||||
|         break |         break | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     let params = { ...this.options } |  | ||||||
|     params.speed = this.inputSpeed |  | ||||||
|     this.entity && |     this.entity && | ||||||
|       this.entity.polyline && |       this.entity.polyline && | ||||||
|       (this.entity.polyline.material = this.getMaterial( |       (this.entity.polyline.material = this.getMaterial( | ||||||
|         this.options.color, |         this.options.color, | ||||||
|         this.options.type, |         this.options.type, | ||||||
|         this.entity, |         this.entity, | ||||||
|         params |         this.options | ||||||
|       )) |       )) | ||||||
|   } |   } | ||||||
|   get noseToTail() { |   get noseToTail() { | ||||||
| @ -693,7 +650,7 @@ class CurvelineObject extends Base { | |||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show && !this.showView || this.showView == 3) { |     if (this.show) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|       setTimeout(() => { |       setTimeout(() => { | ||||||
|         this.label.position = [ |         this.label.position = [ | ||||||
| @ -1375,21 +1332,18 @@ class CurvelineObject extends Base { | |||||||
|         positions: Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArray), |         positions: Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArray), | ||||||
|         width: that.options.width, |         width: that.options.width, | ||||||
|         clampToGround: ground, |         clampToGround: ground, | ||||||
|         // material: that.getMaterial(that.options.color, that.options.type), |         material: that.getMaterial(that.options.color, that.options.type), | ||||||
|         zIndex: that.sdk._entityZIndex |         zIndex: that.sdk._entityZIndex | ||||||
|       } |       } | ||||||
|     }) |     }) | ||||||
|  |  | ||||||
|     that.entity.polyline.oriWidth = that.options.width |     that.entity.polyline.oriWidth = that.options.width | ||||||
|     that.judgeLine(that.entity, that.options) |     that.judgeLine(that.entity, that.options) | ||||||
|  |  | ||||||
|     let params = { ...that.options } |  | ||||||
|     params.speed = that.inputSpeed |  | ||||||
|     that.entity.polyline.material = that.getMaterial( |     that.entity.polyline.material = that.getMaterial( | ||||||
|       that.options.color, |       that.options.color, | ||||||
|       that.options.type, |       that.options.type, | ||||||
|       that.entity, |       that.entity, | ||||||
|       params |       that.options | ||||||
|     ) |     ) | ||||||
|  |  | ||||||
|     that.sdk._entityZIndex++ |     that.sdk._entityZIndex++ | ||||||
| @ -1411,10 +1365,10 @@ class CurvelineObject extends Base { | |||||||
|       that.options.lengthByMeter = res |       that.options.lengthByMeter = res | ||||||
|       that.lengthUnit = that.options['length-unit'] |       that.lengthUnit = that.options['length-unit'] | ||||||
|       syncData(that.sdk, that.options.id) |       syncData(that.sdk, that.options.id) | ||||||
|  |       if (that.options.show) { | ||||||
|  |         setSplitDirection(0, that.options.id) | ||||||
|  |       } | ||||||
|     }) |     }) | ||||||
|     if (that.options.show) { |  | ||||||
|       setSplitDirection(0, that.options.id) |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     // if (this.options['nose-to-tail']) { |     // if (this.options['nose-to-tail']) { | ||||||
|     //   let array = [] |     //   let array = [] | ||||||
|  | |||||||
| @ -18,13 +18,12 @@ import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Gl | |||||||
| class EllipseObject extends Base { | class EllipseObject extends Base { | ||||||
|   /** |   /** | ||||||
|    * @constructor |    * @constructor | ||||||
|    * @param sdk |  | ||||||
|    * @description 创建椭圆 |    * @description 创建椭圆 | ||||||
|    * @param options {object} 圆属性 |    * @param options {object} 圆属性 | ||||||
|    * @param options.id {string} 标注id |    * @param options.id {string} 标注id | ||||||
|    * @param options.name {string} 名称 |    * @param options.name {string} 名称 | ||||||
|    * @param options.show=true {boolean} 显示/隐藏 |    * @param options.show=true {boolean} 显示/隐藏 | ||||||
|    * @param options.center {object} 中心位置 |    * @param options.center {object} 位置 | ||||||
|    * @param options.color="rgba(255, 0, 0, 0.5)" {string} 颜色 |    * @param options.color="rgba(255, 0, 0, 0.5)" {string} 颜色 | ||||||
|    * @param options.center.lng {object} 经度 |    * @param options.center.lng {object} 经度 | ||||||
|    * @param options.center.lat {object} 维度 |    * @param options.center.lat {object} 维度 | ||||||
| @ -34,41 +33,8 @@ class EllipseObject extends Base { | |||||||
|    * @param options.line {object} 边框 |    * @param options.line {object} 边框 | ||||||
|    * @param options.line.width=2 {string} 边框宽 |    * @param options.line.width=2 {string} 边框宽 | ||||||
|    * @param options.line.color="rgba(255, 0, 0, 1)" {string} 边框颜色 |    * @param options.line.color="rgba(255, 0, 0, 1)" {string} 边框颜色 | ||||||
|  |    * @param options.label {object} 标注 | ||||||
|    * @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式) |    * @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式) | ||||||
|    * @param options.areaUnit='平方米' {string} 面积单位 |  | ||||||
|    * @param options.label {object} 标签对象 |  | ||||||
|    * @param options.label.text {string} 标签文本 |  | ||||||
|    * @param options.label.show {string} 标签显隐 |  | ||||||
|    * @param options.label.position {string} 标签位置 |  | ||||||
|    * @param options.label.position {object} 标签位置 |  | ||||||
|    * @param options.label.position.lng {number} 经度 |  | ||||||
|    * @param options.label.position.lat {number} 纬度 |  | ||||||
|    * @param options.label.position.alt {number} 高度 |  | ||||||
|    * @param options.label.fontSize=20 {number} 字体大小 |  | ||||||
|    * @param options.label.fontFamily=0 {number} 字体项 0:黑体;1:思源黑体;2:庞门正道标题体;3:数黑体 |  | ||||||
|    * @param options.label.color=#ffffff {string} 字体颜色 |  | ||||||
|    * @param options.label.lineWidth=4 {number} 引线宽 |  | ||||||
|    * @param options.label.lineColor=#00ffff80 {string} 引线颜色 |  | ||||||
|    * @param options.label.pixelOffset=20 {number} 字体偏移(引线长度) |  | ||||||
|    * @param options.label.backgroundColor=['#00ffff80', '#00ffff80'] {array} 背景颜色 |  | ||||||
|    * @param options.label.scaleByDistance {boolean} 距离缩放 |  | ||||||
|    * @param options.label.near=2000 {number} 视野缩放最近距离 |  | ||||||
|    * @param options.label.far=100000 {number} 视野缩放最远距离 |  | ||||||
|    * @param options.attribute {object} 属性内容 |  | ||||||
|    * @param options.attribute.link {object} 链接 |  | ||||||
|    * @param options.attribute.link.content=[]] {array} 链接内容 |  | ||||||
|    * @param options.attribute.link.content[].name {string} 链接名称 |  | ||||||
|    * @param options.attribute.link.content[].url {string} 链接地址 |  | ||||||
|    * @param options.richTextContent {string} 富文本内容 |  | ||||||
|    * @param options.customView {object} 默认视角 |  | ||||||
|    * @param options.customView.orientation {object} 默认视角方位 |  | ||||||
|    * @param options.customView.orientation.heading {number} 航向角 |  | ||||||
|    * @param options.customView.orientation.pitch {number} 俯仰角 |  | ||||||
|    * @param options.customView.orientation.roll {number} 翻滚角 |  | ||||||
|    * @param options.customView.relativePosition {object} 视角相对位置 |  | ||||||
|    * @param options.customView.relativePosition.lng {number} 经度 |  | ||||||
|    * @param options.customView.relativePosition.lat {number} 纬度 |  | ||||||
|    * @param options.customView.relativePosition.alt {number} 高度 |  | ||||||
|    */ |    */ | ||||||
|   constructor(sdk, options = {}) { |   constructor(sdk, options = {}) { | ||||||
|     super(sdk, options); |     super(sdk, options); | ||||||
| @ -381,7 +347,7 @@ class EllipseObject extends Base { | |||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show && !this.showView || this.showView == 3) { |     if (this.show) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|  | |||||||
| @ -13,15 +13,6 @@ class Explosion extends Base { | |||||||
|   * @description 爆炸 |   * @description 爆炸 | ||||||
|   * @param sdk |   * @param sdk | ||||||
|   * @param options {object} 爆炸属性 |   * @param options {object} 爆炸属性 | ||||||
|   * @param options.id {string} 唯一标识 |  | ||||||
|   * @param options.show=true {boolean} 显隐 |  | ||||||
|   * @param options.name {string} 名称 |  | ||||||
|   * @param {object} options.position={} 位置 |  | ||||||
|   * @param {number} options.position.lng 经度 |  | ||||||
|   * @param {number} options.position.lat 纬度 |  | ||||||
|   * @param {number} options.position.alt 高度 |  | ||||||
|   * @param options.scaleByDistance=true {boolean} 是否开启跟随视野缩放 |  | ||||||
|   * @param options.size=80 {number} 大小(爆炸范围) |  | ||||||
|   * */ |   * */ | ||||||
|   constructor(sdk, options = {}, _Dialog = {}) { |   constructor(sdk, options = {}, _Dialog = {}) { | ||||||
|     super(sdk, options); |     super(sdk, options); | ||||||
|  | |||||||
| @ -9,25 +9,6 @@ import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../Glo | |||||||
|  |  | ||||||
| class FlyRoam extends Base { | class FlyRoam extends Base { | ||||||
|   #clickHandler = undefined |   #clickHandler = undefined | ||||||
|   /** |  | ||||||
|    * @constructor |  | ||||||
|    * @param sdk |  | ||||||
|    * @description 飞行漫游 |  | ||||||
|    * @param options {object} |  | ||||||
|    * @param options.id {string} 标注id |  | ||||||
|    * @param options.name {string} 名称 |  | ||||||
|    * @param options.repeat=0 {number} 重复次数 |  | ||||||
|    * @param options.points=[]] {array} 视点列表 |  | ||||||
|    * @param options.points[].position {object} 视点位置 |  | ||||||
|    * @param options.points[].position.lng {number} 经度 |  | ||||||
|    * @param options.points[].position.lat {number} 纬度 |  | ||||||
|    * @param options.points[].position.alt {number} 高度 |  | ||||||
|    * @param options.points[].orientation {object} 视点方向 |  | ||||||
|    * @param options.points[].orientation.heading=0 {number} 视点航向角 |  | ||||||
|    * @param options.points[].orientation.pitch=0 {number} 视点俯仰角 |  | ||||||
|    * @param options.points[].orientation.roll=0 {number} 视点翻滚角 |  | ||||||
|    * @param options.points[].duration=0 {number} 持续时间 |  | ||||||
|    **/ |  | ||||||
|   constructor(sdk, options = {}, _Dialog = {}) { |   constructor(sdk, options = {}, _Dialog = {}) { | ||||||
|     super(sdk, options) |     super(sdk, options) | ||||||
|     this.options.id = options.id || this.randomString() |     this.options.id = options.id || this.randomString() | ||||||
| @ -181,7 +162,6 @@ class FlyRoam extends Base { | |||||||
|           pitch: viewer.camera.pitch, |           pitch: viewer.camera.pitch, | ||||||
|           roll: viewer.camera.roll |           roll: viewer.camera.roll | ||||||
|         } |         } | ||||||
|         this.message({text: '操作成功'}) |  | ||||||
|       }) |       }) | ||||||
|  |  | ||||||
|       let totalTimeElm = contentElm.querySelector("input[name='totalTime']") |       let totalTimeElm = contentElm.querySelector("input[name='totalTime']") | ||||||
|  | |||||||
| @ -17,6 +17,18 @@ function html(that) { | |||||||
|     </div> |     </div> | ||||||
|     <span class="custom-divider"></span> |     <span class="custom-divider"></span> | ||||||
|     <div class="div-item"> |     <div class="div-item"> | ||||||
|  |         <div class="row"> | ||||||
|  |             <div class="col" mode="0"> | ||||||
|  |                 <button class="anchor btn">调整锚点</button> | ||||||
|  |             </div> | ||||||
|  |             <div class="col mode-box"> | ||||||
|  |                 <span class="label" style="flex: unset;">军标模式</span> | ||||||
|  |                 <div class="mode"></div> | ||||||
|  |             </div> | ||||||
|  |         </div> | ||||||
|  |     </div> | ||||||
|  |     <span class="custom-divider" mode="0"></span> | ||||||
|  |     <div class="div-item" mode="0"> | ||||||
|         <div class="row"> |         <div class="row"> | ||||||
|             <div class="col"> |             <div class="col"> | ||||||
|                 <span class="label">旋转角度</span> |                 <span class="label">旋转角度</span> | ||||||
| @ -50,11 +62,11 @@ function html(that) { | |||||||
|         </div> |         </div> | ||||||
|     </div> |     </div> | ||||||
|     <span class="custom-divider"></span> |     <span class="custom-divider"></span> | ||||||
|     <div class="div-item"> |     <div class="div-item" mode="0"> | ||||||
|         <div class="row"> |         <div class="row"> | ||||||
|             <div class="col" style="flex: 5;"> |             <div class="col" style="flex: 5;"> | ||||||
|                 <span class="label">文字内容</span> |                 <span class="label">文字内容</span> | ||||||
|                 <input class="input" type="text" @model="textValue" maxlength="30"> |                 <input class="input" type="text" @model="textValue"> | ||||||
|             </div> |             </div> | ||||||
|             <div class="col"> |             <div class="col"> | ||||||
|                 <button class="btn" @click="textPosPick">设置位置</span> |                 <button class="btn" @click="textPosPick">设置位置</span> | ||||||
| @ -70,9 +82,9 @@ function html(that) { | |||||||
|                 <div class="textColor"></div> |                 <div class="textColor"></div> | ||||||
|             </div> |             </div> | ||||||
|             <div class="col"> |             <div class="col"> | ||||||
|                 <span class="label">字体大小</span> |                 <span class="label">文字大小</span> | ||||||
|                 <div class="input-number input-number-unit-2"> |                 <div class="input-number input-number-unit-2"> | ||||||
|                     <input class="input" type="number" title="" min="1" max="99" @model="textFontSize"> |                     <input class="input" type="number" title="" min="1" max="99" step="1" @model="textFontSize"> | ||||||
|                     <span class="unit">px</span> |                     <span class="unit">px</span> | ||||||
|                     <span class="arrow"></span> |                     <span class="arrow"></span> | ||||||
|                 </div> |                 </div> | ||||||
| @ -101,6 +113,98 @@ function html(that) { | |||||||
|             </div> |             </div> | ||||||
|         </div> |         </div> | ||||||
|     </div> |     </div> | ||||||
|  |     <div class="div-item" mode="1"> | ||||||
|  |         <div class="row"> | ||||||
|  |             <div class="col height-mode-box" style="flex: 0 0 155px;margin-right: 10px;"> | ||||||
|  |                 <span class="label" style="flex: 0 0 56px;">高度模式</span> | ||||||
|  |                 <div class="height-mode"></div> | ||||||
|  |             </div> | ||||||
|  |             <div class="col" style="margin: 0 10px;"> | ||||||
|  |                 <div class="height-box" style="display: flex; align-items: center;"> | ||||||
|  |                     <span class="label" style="flex: 0 0 56px;">高度</span> | ||||||
|  |                     <div class="input-number input-number-unit-1"> | ||||||
|  |                         <input class="input height" type="number" title="" min="-9999999" max="999999999"> | ||||||
|  |                         <span class="unit">m</span> | ||||||
|  |                         <span class="arrow"></span> | ||||||
|  |                     </div> | ||||||
|  |                 </div> | ||||||
|  |             </div> | ||||||
|  |             <div class="col" style="margin-left: 10px;"> | ||||||
|  |                 <span class="label">图标倍数</span> | ||||||
|  |                 <div class="input-number input-number-unit-1"> | ||||||
|  |                     <input class="input" type="number" title="" data-min="0.1" max="99" @model="billboardScale"> | ||||||
|  |                     <span class="unit">倍</span> | ||||||
|  |                     <span class="arrow"></span> | ||||||
|  |                 </div> | ||||||
|  |             </div> | ||||||
|  |         </div> | ||||||
|  |         <div class="row"> | ||||||
|  |             <div class="col" style="flex: 0 0 155px;margin-right: 10px;"> | ||||||
|  |                 <span class="label">视野缩放</span> | ||||||
|  |                 <input class="btn-switch" type="checkbox" @model="billboardScaleByDistance"> | ||||||
|  |             </div> | ||||||
|  |             <div class="col" style="margin: 0 10px;"> | ||||||
|  |                 <span class="label">最近距离</span> | ||||||
|  |                 <div class="input-number input-number-unit-1"> | ||||||
|  |                     <input class="input" type="number" title="" min="1" max="99999999" @model="billboardNear"> | ||||||
|  |                     <span class="unit">m</span> | ||||||
|  |                     <span class="arrow"></span> | ||||||
|  |                 </div> | ||||||
|  |             </div> | ||||||
|  |             <div class="col" style="margin-left: 10px;"> | ||||||
|  |                 <span class="label">最远距离</span> | ||||||
|  |                 <div class="input-number input-number-unit-1"> | ||||||
|  |                     <input class="input" type="number" title="" min="1" max="99999999" @model="billboardFar"> | ||||||
|  |                     <span class="unit">m</span> | ||||||
|  |                     <span class="arrow"></span> | ||||||
|  |                 </div> | ||||||
|  |             </div> | ||||||
|  |         </div> | ||||||
|  |         <h4>文字设置</h4> | ||||||
|  |         <div class="row"> | ||||||
|  |             <div class="col" style="flex: 0 0 80px;margin: 0 10px 0 0;;"> | ||||||
|  |                 <span class="label" style="flex: none;">显隐</span> | ||||||
|  |                 <input class="btn-switch" type="checkbox" @model="labelShow"> | ||||||
|  |             </div> | ||||||
|  |             <div class="col font-select-box" style="margin: 0 0px;flex: 0 0 160px;"> | ||||||
|  |                 <span class="label" style="flex: none;">字体选择</span> | ||||||
|  |                 <div class="input input-select font-select"></div> | ||||||
|  |             </div> | ||||||
|  |             <div class="col" style="margin: 0 10px;"> | ||||||
|  |                 <span class="label">文字大小</span> | ||||||
|  |                 <div class="input-number input-number-unit-2"> | ||||||
|  |                     <input class="input label-font-size" type="number" title="" min="1" max="99" step="1" style="width: 70px;"> | ||||||
|  |                     <span class="unit">px</span> | ||||||
|  |                     <span class="arrow"></span> | ||||||
|  |                 </div> | ||||||
|  |             </div> | ||||||
|  |             <div class="col" style="margin-left: 10px;"> | ||||||
|  |                 <span class="label">文字颜色</span> | ||||||
|  |                 <div class="labelColor"></div> | ||||||
|  |             </div> | ||||||
|  |         </div> | ||||||
|  |         <div class="row" style="justify-content: flex-start;"> | ||||||
|  |             <div class="col font-select-box" style="margin: 0 0px;flex: 0 0 70px;"> | ||||||
|  |                 <span class="label" style="flex: none;">文字偏移</span> | ||||||
|  |             </div> | ||||||
|  |             <div class="col" style="margin: 0 10px;flex: 0 0 100px;"> | ||||||
|  |                 <span class="label">x</span> | ||||||
|  |                 <div class="input-number input-number-unit-2"> | ||||||
|  |                     <input class="input label-offset-x" type="number" title="" min="0" max="999" step="1"> | ||||||
|  |                     <span class="unit">px</span> | ||||||
|  |                     <span class="arrow"></span> | ||||||
|  |                 </div> | ||||||
|  |             </div> | ||||||
|  |             <div class="col" style="margin: 0 10px;flex: 0 0 100px;"> | ||||||
|  |                 <span class="label">y</span> | ||||||
|  |                 <div class="input-number input-number-unit-2"> | ||||||
|  |                     <input class="input label-offset-y" type="number" title="" min="0" max="999" step="1"> | ||||||
|  |                     <span class="unit">px</span> | ||||||
|  |                     <span class="arrow"></span> | ||||||
|  |                 </div> | ||||||
|  |             </div> | ||||||
|  |         </div> | ||||||
|  |     </div> | ||||||
|     <span class="custom-divider"></span> |     <span class="custom-divider"></span> | ||||||
|     <div class="div-item attribute-info"> |     <div class="div-item attribute-info"> | ||||||
|         <div class="row"> |         <div class="row"> | ||||||
|  | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -14,8 +14,6 @@ import { | |||||||
|  |  | ||||||
| class LabelObject extends Base { | class LabelObject extends Base { | ||||||
|   #updateBillboardImageTimeout |   #updateBillboardImageTimeout | ||||||
|   #canvas = document.createElement('canvas') |  | ||||||
|   #canvas2 = document.createElement('canvas') |  | ||||||
|   constructor(sdk, options = {}, model) { |   constructor(sdk, options = {}, model) { | ||||||
|     super(sdk, options) |     super(sdk, options) | ||||||
|     this.model = model |     this.model = model | ||||||
| @ -440,12 +438,11 @@ class LabelObject extends Base { | |||||||
|     this.updateBillboardImage() |     this.updateBillboardImage() | ||||||
|   } |   } | ||||||
|   updateBillboardImage() { |   updateBillboardImage() { | ||||||
|     this.entity.billboard.image = this.getcanvas() |     clearTimeout(this.#updateBillboardImageTimeout) | ||||||
|     // clearTimeout(this.#updateBillboardImageTimeout) |     this.#updateBillboardImageTimeout = setTimeout(() => { | ||||||
|     // this.#updateBillboardImageTimeout = setTimeout(() => { |       clearTimeout(this.#updateBillboardImageTimeout) | ||||||
|     //   clearTimeout(this.#updateBillboardImageTimeout) |       this.entity && (this.entity.billboard.image = this.getcanvas()) | ||||||
|     //   this.entity.billboard.image = this.getcanvas() |     }, 500) | ||||||
|     // }, 500) |  | ||||||
|   } |   } | ||||||
|   get lineColor() { |   get lineColor() { | ||||||
|     return this.options.pixelOffset |     return this.options.pixelOffset | ||||||
| @ -492,8 +489,9 @@ class LabelObject extends Base { | |||||||
|   // } |   // } | ||||||
|  |  | ||||||
|   getcanvas() { |   getcanvas() { | ||||||
|     const ctx = this.#canvas.getContext('2d') |     const canvas = document.createElement('canvas') | ||||||
|     ctx.clearRect(0, 0, this.#canvas.width, this.#canvas.height); |     const ctx = canvas.getContext('2d') | ||||||
|  |  | ||||||
|     ctx.font = this.options.fontSize + 'px ' + this.font |     ctx.font = this.options.fontSize + 'px ' + this.font | ||||||
|     let texts = this.options.text.split('\n') |     let texts = this.options.text.split('\n') | ||||||
|     let canvasWidth = 0 |     let canvasWidth = 0 | ||||||
| @ -511,8 +509,9 @@ class LabelObject extends Base { | |||||||
|     if (canvasWidth < this.options.lineWidth) { |     if (canvasWidth < this.options.lineWidth) { | ||||||
|       canvasWidth = this.options.lineWidth |       canvasWidth = this.options.lineWidth | ||||||
|     } |     } | ||||||
|     this.#canvas.width = canvasWidth |     canvas.width = canvasWidth | ||||||
|     this.#canvas.height = this.options.pixelOffset + canvasHeight |  | ||||||
|  |     canvas.height = this.options.pixelOffset + canvasHeight | ||||||
|     const linearGradient = ctx.createLinearGradient( |     const linearGradient = ctx.createLinearGradient( | ||||||
|       0, |       0, | ||||||
|       0, |       0, | ||||||
| @ -559,14 +558,15 @@ class LabelObject extends Base { | |||||||
|     ctx.stroke() |     ctx.stroke() | ||||||
|     ctx.closePath() |     ctx.closePath() | ||||||
|  |  | ||||||
|     const ctx2 = this.#canvas2.getContext('2d') |     const canvas2 = document.createElement('canvas') | ||||||
|     this.#canvas2.width = this.#canvas.width + 10 |     const ctx2 = canvas2.getContext('2d') | ||||||
|     this.#canvas2.height = this.#canvas.height + 10 |     canvas2.width = canvas.width + 10 | ||||||
|     ctx2.drawImage(this.#canvas, 5, 5); |     canvas2.height = canvas.height + 10 | ||||||
|  |     ctx2.drawImage(canvas, 5, 5); | ||||||
|  |  | ||||||
|     // const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); |     // const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); | ||||||
|     // ctx.putImageData(imageData, 40, 40); |     // ctx.putImageData(imageData, 40, 40); | ||||||
|     return this.#canvas2.toDataURL("image/png") |     return canvas2 | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   remove() { |   remove() { | ||||||
|  | |||||||
| @ -18,10 +18,9 @@ class Flame extends Base { | |||||||
|    * @description 火焰特效 |    * @description 火焰特效 | ||||||
|    * @param sdk  |    * @param sdk  | ||||||
|    * @param options {object} 粒子属性 |    * @param options {object} 粒子属性 | ||||||
|    * @param options.id {string} 标注id |  | ||||||
|    * @param options.show=true {boolean} 显示/隐藏 |    * @param options.show=true {boolean} 显示/隐藏 | ||||||
|    * @param options.name {string} 名称 |    * @param options.name {string} 名称 | ||||||
|    * @param options.url {string} 贴图地址 |    * @param options.url {string | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement} 指定 Image、URL或Canvas 的属性 | ||||||
|    * @param options.startColor="#ff0000" {string} 起始颜色 |    * @param options.startColor="#ff0000" {string} 起始颜色 | ||||||
|    * @param options.endColor="#fff000" {string} 结束颜色 |    * @param options.endColor="#fff000" {string} 结束颜色 | ||||||
|    * @param options.startScale=0.5 {number} 初始比例 |    * @param options.startScale=0.5 {number} 初始比例 | ||||||
| @ -35,15 +34,8 @@ class Flame extends Base { | |||||||
|    * @param options.lng 经度 |    * @param options.lng 经度 | ||||||
|    * @param options.lat 纬度 |    * @param options.lat 纬度 | ||||||
|    * @param options.alt 高度 |    * @param options.alt 高度 | ||||||
|    * @param options.customView {object} 默认视角 |    * @param _Dialog {object} 弹框事件 | ||||||
|    * @param options.customView.orientation {object} 默认视角方位 |    * @param _Dialog.confirmCallBack {function} 弹框确认时的回调 | ||||||
|    * @param options.customView.orientation.heading {number} 航向角 |  | ||||||
|    * @param options.customView.orientation.pitch {number} 俯仰角 |  | ||||||
|    * @param options.customView.orientation.roll {number} 翻滚角 |  | ||||||
|    * @param options.customView.relativePosition {object} 视角相对位置 |  | ||||||
|    * @param options.customView.relativePosition.lng {number} 经度 |  | ||||||
|    * @param options.customView.relativePosition.lat {number} 纬度 |  | ||||||
|    * @param options.customView.relativePosition.alt {number} 高度 |  | ||||||
|    * */ |    * */ | ||||||
|   constructor(sdk, options, _Dialog = {}) { |   constructor(sdk, options, _Dialog = {}) { | ||||||
|     super(sdk, options); |     super(sdk, options); | ||||||
|  | |||||||
| @ -17,10 +17,9 @@ class Fountain extends Base { | |||||||
|    * @description 喷泉特效 |    * @description 喷泉特效 | ||||||
|    * @param sdk  |    * @param sdk  | ||||||
|    * @param options {object} 粒子属性 |    * @param options {object} 粒子属性 | ||||||
|    * @param options.id {string} 标注id |  | ||||||
|    * @param options.show=true {boolean} 显示/隐藏 |    * @param options.show=true {boolean} 显示/隐藏 | ||||||
|    * @param options.name {string} 名称 |    * @param options.name {string} 名称 | ||||||
|    * @param options.url {string} 贴图地址 |    * @param options.url {string | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement} 指定 Image、URL或Canvas 的属性 | ||||||
|    * @param options.startColor="#c1f7f24d" {string} 起始颜色 |    * @param options.startColor="#c1f7f24d" {string} 起始颜色 | ||||||
|    * @param options.endColor="#ffffff00" {string} 结束颜色 |    * @param options.endColor="#ffffff00" {string} 结束颜色 | ||||||
|    * @param options.startScale=1 {number} 初始比例 |    * @param options.startScale=1 {number} 初始比例 | ||||||
| @ -31,18 +30,12 @@ class Fountain extends Base { | |||||||
|    * @param options.maximumParticleLife=7 {number} 最大存在时间(秒) |    * @param options.maximumParticleLife=7 {number} 最大存在时间(秒) | ||||||
|    * @param options.emissionRate=20 {number} 发射速率(个/每秒) |    * @param options.emissionRate=20 {number} 发射速率(个/每秒) | ||||||
|    * @param options.particleSize=0.5{number} 粒子尺大小 |    * @param options.particleSize=0.5{number} 粒子尺大小 | ||||||
|  |    * @param options.gravity=-3.5{number} 重力值 | ||||||
|    * @param options.lng 经度 |    * @param options.lng 经度 | ||||||
|    * @param options.lat 纬度 |    * @param options.lat 纬度 | ||||||
|    * @param options.alt 高度 |    * @param options.alt 高度 | ||||||
|    * @param options.customView {object} 默认视角 |    * @param _Dialog {object} 弹框事件 | ||||||
|    * @param options.customView.orientation {object} 默认视角方位 |    * @param _Dialog.confirmCallBack {function} 弹框确认时的回调 | ||||||
|    * @param options.customView.orientation.heading {number} 航向角 |  | ||||||
|    * @param options.customView.orientation.pitch {number} 俯仰角 |  | ||||||
|    * @param options.customView.orientation.roll {number} 翻滚角 |  | ||||||
|    * @param options.customView.relativePosition {object} 视角相对位置 |  | ||||||
|    * @param options.customView.relativePosition.lng {number} 经度 |  | ||||||
|    * @param options.customView.relativePosition.lat {number} 纬度 |  | ||||||
|    * @param options.customView.relativePosition.alt {number} 高度 |  | ||||||
|    * */ |    * */ | ||||||
|   constructor(sdk, options, _Dialog = {}) { |   constructor(sdk, options, _Dialog = {}) { | ||||||
|     super(sdk, options); |     super(sdk, options); | ||||||
| @ -57,7 +50,7 @@ class Fountain extends Base { | |||||||
|     this.options.maximumSpeed = options.maximumSpeed || 9.5 |     this.options.maximumSpeed = options.maximumSpeed || 9.5 | ||||||
|     this.options.emissionRate = options.emissionRate || 20 |     this.options.emissionRate = options.emissionRate || 20 | ||||||
|     this.options.particleSize = options.particleSize || 0.5 |     this.options.particleSize = options.particleSize || 0.5 | ||||||
|     // this.options.gravity = (options.gravity || options.gravity === 0) ? options.gravity : -3.5 |     this.options.gravity = (options.gravity || options.gravity === 0) ? options.gravity : -3.5 | ||||||
|     this.options.show = options.show === false ? false : true |     this.options.show = options.show === false ? false : true | ||||||
|     this._elms = {}; |     this._elms = {}; | ||||||
|     this.positionCallBack = null |     this.positionCallBack = null | ||||||
|  | |||||||
| @ -17,10 +17,9 @@ class Smoke extends Base { | |||||||
|    * @description 烟雾特效 |    * @description 烟雾特效 | ||||||
|    * @param sdk |    * @param sdk | ||||||
|    * @param options {object} 粒子属性 |    * @param options {object} 粒子属性 | ||||||
|    * @param options.id {string} 标注id |  | ||||||
|    * @param options.show=true {boolean} 显示/隐藏 |    * @param options.show=true {boolean} 显示/隐藏 | ||||||
|    * @param options.name {string} 名称 |    * @param options.name {string} 名称 | ||||||
|    * @param options.url {string} 贴图地址 |    * @param options.url {string | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement} 指定 Image、URL或Canvas 的属性 | ||||||
|    * @param options.startColor="#00000000" {string} 起始颜色 |    * @param options.startColor="#00000000" {string} 起始颜色 | ||||||
|    * @param options.endColor="#0000001a" {string} 结束颜色 |    * @param options.endColor="#0000001a" {string} 结束颜色 | ||||||
|    * @param options.startScale=0.1 {number} 初始比例 |    * @param options.startScale=0.1 {number} 初始比例 | ||||||
| @ -34,15 +33,8 @@ class Smoke extends Base { | |||||||
|    * @param options.lng 经度 |    * @param options.lng 经度 | ||||||
|    * @param options.lat 纬度 |    * @param options.lat 纬度 | ||||||
|    * @param options.alt 高度 |    * @param options.alt 高度 | ||||||
|    * @param options.customView {object} 默认视角 |    * @param _Dialog {object} 弹框事件 | ||||||
|    * @param options.customView.orientation {object} 默认视角方位 |    * @param _Dialog.confirmCallBack {function} 弹框确认时的回调 | ||||||
|    * @param options.customView.orientation.heading {number} 航向角 |  | ||||||
|    * @param options.customView.orientation.pitch {number} 俯仰角 |  | ||||||
|    * @param options.customView.orientation.roll {number} 翻滚角 |  | ||||||
|    * @param options.customView.relativePosition {object} 视角相对位置 |  | ||||||
|    * @param options.customView.relativePosition.lng {number} 经度 |  | ||||||
|    * @param options.customView.relativePosition.lat {number} 纬度 |  | ||||||
|    * @param options.customView.relativePosition.alt {number} 高度 |  | ||||||
|    * */ |    * */ | ||||||
|   constructor(sdk, options, _Dialog = {}) { |   constructor(sdk, options, _Dialog = {}) { | ||||||
|     super(sdk, options); |     super(sdk, options); | ||||||
|  | |||||||
| @ -16,10 +16,9 @@ class Spout extends Base { | |||||||
|    * @description 水柱 |    * @description 水柱 | ||||||
|    * @param sdk  |    * @param sdk  | ||||||
|    * @param options {object} 粒子属性 |    * @param options {object} 粒子属性 | ||||||
|    * @param options.id {string} 标注id |  | ||||||
|    * @param options.show=true {boolean} 显示/隐藏 |    * @param options.show=true {boolean} 显示/隐藏 | ||||||
|    * @param options.name {string} 名称 |    * @param options.name {string} 名称 | ||||||
|    * @param options.url {string} 贴图地址 |    * @param options.url {string | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement} 指定 Image、URL或Canvas 的属性 | ||||||
|    * @param options.startColor="#c1f7f2" {string} 起始颜色 |    * @param options.startColor="#c1f7f2" {string} 起始颜色 | ||||||
|    * @param options.endColor="#ffffff00" {string} 结束颜色 |    * @param options.endColor="#ffffff00" {string} 结束颜色 | ||||||
|    * @param options.startScale=0.2 {number} 初始比例 |    * @param options.startScale=0.2 {number} 初始比例 | ||||||
| @ -29,8 +28,8 @@ class Spout extends Base { | |||||||
|    * @param options.maximumParticleLife=12 {number} 最大存在时间(秒) |    * @param options.maximumParticleLife=12 {number} 最大存在时间(秒) | ||||||
|    * @param options.emissionRate=100 {number} 发射速率(个/每秒) |    * @param options.emissionRate=100 {number} 发射速率(个/每秒) | ||||||
|    * @param options.particleSize=1 {number} 粒子尺大小 |    * @param options.particleSize=1 {number} 粒子尺大小 | ||||||
|    * @param options.heading 航向角 |    * @param options.heading 朝向 | ||||||
|    * @param options.pitch 俯仰角 |    * @param options.pitch 俯仰角度 | ||||||
|    * @param options.start {object} 开始位置 |    * @param options.start {object} 开始位置 | ||||||
|    * @param options.start.lng 经度 |    * @param options.start.lng 经度 | ||||||
|    * @param options.start.lat 纬度 |    * @param options.start.lat 纬度 | ||||||
| @ -39,15 +38,8 @@ class Spout extends Base { | |||||||
|    * @param options.end.lng 经度 |    * @param options.end.lng 经度 | ||||||
|    * @param options.end.lat 纬度 |    * @param options.end.lat 纬度 | ||||||
|    * @param options.end.alt 高度 |    * @param options.end.alt 高度 | ||||||
|    * @param options.customView {object} 默认视角 |    * @param _Dialog {object} 弹框事件 | ||||||
|    * @param options.customView.orientation {object} 默认视角方位 |    * @param _Dialog.confirmCallBack {function} 弹框确认时的回调 | ||||||
|    * @param options.customView.orientation.heading {number} 航向角 |  | ||||||
|    * @param options.customView.orientation.pitch {number} 俯仰角 |  | ||||||
|    * @param options.customView.orientation.roll {number} 翻滚角 |  | ||||||
|    * @param options.customView.relativePosition {object} 视角相对位置 |  | ||||||
|    * @param options.customView.relativePosition.lng {number} 经度 |  | ||||||
|    * @param options.customView.relativePosition.lat {number} 纬度 |  | ||||||
|    * @param options.customView.relativePosition.alt {number} 高度 |  | ||||||
|    * */ |    * */ | ||||||
|   constructor(sdk, options, _Dialog = {}) { |   constructor(sdk, options, _Dialog = {}) { | ||||||
|     super(sdk, options); |     super(sdk, options); | ||||||
|  | |||||||
| @ -22,56 +22,14 @@ class PincerArrowObject extends Base { | |||||||
|    * @param sdk  |    * @param sdk  | ||||||
|    * @description 双箭头 |    * @description 双箭头 | ||||||
|    * @param options {object} 属性 |    * @param options {object} 属性 | ||||||
|    * @param options.id {string} 唯一标识 |  | ||||||
|    * @param options.show=true {boolean} 显示/隐藏 |    * @param options.show=true {boolean} 显示/隐藏 | ||||||
|    * @param options.name {string} 名称 |    * @param options.name {string} 名称 | ||||||
|    * @param options.color='rgba(255, 0, 0, 0.5)' {string} 颜色 |    * @param options.color="#ff000080" {string} 颜色 | ||||||
|    * @param options.height {number} 高度 |    * @param options.height {number} 高度 | ||||||
|    * @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式) |    * @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式) | ||||||
|    * @param options.areaUnit='平方米' {string} 面积单位 |    * @param {Array.<object>} options.positions 坐标数组 [{lon,lat,alt},...] | ||||||
|    * @param options.line {object} 边框 |    * @param _Dialog {object} 弹框事件 | ||||||
|    * @param options.line.width=2 {string} 边框宽 |    * @param _Dialog.confirmCallBack {function} 弹框确认时的回调 | ||||||
|    * @param options.line.color="rgba(155, 155, 124, 0.89)" {string} 边框颜色 |  | ||||||
|    * @param {Array.<object>} options.positions 必填,经纬度和高度的列表,值交替 [{lon,lat,alt},...] |  | ||||||
|    * @param options.positions[].lng {number} 经度 |  | ||||||
|    * @param options.positions[].lat {number} 纬度 |  | ||||||
|    * @param options.positions[].alt {number} 高度 |  | ||||||
|    * @param options.spreadState=false {boolean} 动画 |  | ||||||
|    * @param options.loop=false {loop} 动画重复 |  | ||||||
|    * @param options.spreadTime=3000 {number} 动画持续时长(毫秒) |  | ||||||
|    * @param options.label {object} 标签对象 |  | ||||||
|    * @param options.label.text {string} 标签文本 |  | ||||||
|    * @param options.label.show {string} 标签显隐 |  | ||||||
|    * @param options.label.position {string} 标签位置 |  | ||||||
|    * @param options.label.position {object} 标签位置 |  | ||||||
|    * @param options.label.position.lng {number} 经度 |  | ||||||
|    * @param options.label.position.lat {number} 纬度 |  | ||||||
|    * @param options.label.position.alt {number} 高度 |  | ||||||
|    * @param options.label.fontSize=20 {number} 字体大小 |  | ||||||
|    * @param options.label.fontFamily=0 {number} 字体项 0:黑体;1:思源黑体;2:庞门正道标题体;3:数黑体 |  | ||||||
|    * @param options.label.color=#ffffff {string} 字体颜色 |  | ||||||
|    * @param options.label.lineWidth=4 {number} 引线宽 |  | ||||||
|    * @param options.label.lineColor=#00ffff80 {string} 引线颜色 |  | ||||||
|    * @param options.label.pixelOffset=20 {number} 字体偏移(引线长度) |  | ||||||
|    * @param options.label.backgroundColor=['#00ffff80', '#00ffff80'] {array} 背景颜色 |  | ||||||
|    * @param options.label.scaleByDistance {boolean} 距离缩放 |  | ||||||
|    * @param options.label.near=2000 {number} 视野缩放最近距离 |  | ||||||
|    * @param options.label.far=100000 {number} 视野缩放最远距离 |  | ||||||
|    * @param options.attribute {object} 属性内容 |  | ||||||
|    * @param options.attribute.link={} {object} 链接 |  | ||||||
|    * @param options.attribute.link.content=[]] {array} 链接内容 |  | ||||||
|    * @param options.attribute.link.content[].name {string} 链接名称 |  | ||||||
|    * @param options.attribute.link.content[].url {string} 链接地址 |  | ||||||
|    * @param options.richTextContent {string} 富文本内容 |  | ||||||
|    * @param options.customView {object} 默认视角 |  | ||||||
|    * @param options.customView.orientation {object} 默认视角方位 |  | ||||||
|    * @param options.customView.orientation.heading {number} 航向角 |  | ||||||
|    * @param options.customView.orientation.pitch {number} 俯仰角 |  | ||||||
|    * @param options.customView.orientation.roll {number} 翻滚角 |  | ||||||
|    * @param options.customView.relativePosition {object} 视角相对位置 |  | ||||||
|    * @param options.customView.relativePosition.lng {number} 经度 |  | ||||||
|    * @param options.customView.relativePosition.lat {number} 纬度 |  | ||||||
|    * @param options.customView.relativePosition.alt {number} 高度 |  | ||||||
|    * */ |    * */ | ||||||
|   constructor(sdk, options = {}, _Dialog = {}) { |   constructor(sdk, options = {}, _Dialog = {}) { | ||||||
|     super(sdk, options); |     super(sdk, options); | ||||||
| @ -376,7 +334,7 @@ class PincerArrowObject extends Base { | |||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show && !this.showView || this.showView == 3) { |     if (this.show) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|  | |||||||
| @ -19,8 +19,8 @@ import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Gl | |||||||
| class PolygonObject extends Base { | class PolygonObject extends Base { | ||||||
|   /** |   /** | ||||||
|    * @constructor |    * @constructor | ||||||
|    * @description 多边形 |  | ||||||
|    * @param sdk |    * @param sdk | ||||||
|  |    * @description 多边形 | ||||||
|    * @param options {object} 属性 |    * @param options {object} 属性 | ||||||
|    * @param options.id {string} 唯一标识 |    * @param options.id {string} 唯一标识 | ||||||
|    * @param options.show=true {boolean} 显示/隐藏 |    * @param options.show=true {boolean} 显示/隐藏 | ||||||
| @ -28,51 +28,11 @@ class PolygonObject extends Base { | |||||||
|    * @param options.color='rgba(255, 0, 0, 0.5)' {string} 颜色 |    * @param options.color='rgba(255, 0, 0, 0.5)' {string} 颜色 | ||||||
|    * @param options.height {number} 高度 |    * @param options.height {number} 高度 | ||||||
|    * @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式) |    * @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式) | ||||||
|    * @param options.areaUnit='平方米' {string} 面积单位 |  | ||||||
|    * @param options.line {object} 边框 |    * @param options.line {object} 边框 | ||||||
|    * @param options.line.width=2 {string} 边框宽 |    * @param options.line.width=2 {string} 边框宽 | ||||||
|    * @param options.line.color="rgba(155, 155, 124, 0.89)" {string} 边框颜色 |    * @param options.line.color="rgba(155, 155, 124, 0.89)" {string} 边框颜色 | ||||||
|    * @param {Array.<object>} options.positions 必填,经纬度和高度的列表,值交替 [{lon,lat,alt},...] |    * @param {Array.<object>} options.positions 经纬度和高度的列表,值交替 [{lon,lat,alt},...] | ||||||
|    * @param options.positions[].lng {number} 经度 |  | ||||||
|    * @param options.positions[].lat {number} 纬度 |  | ||||||
|    * @param options.positions[].alt {number} 高度 |  | ||||||
|    * @param options.label {object} 标签对象 |  | ||||||
|    * @param options.label.text {string} 标签文本 |  | ||||||
|    * @param options.label.show {string} 标签显隐 |  | ||||||
|    * @param options.label.position {string} 标签位置 |  | ||||||
|    * @param options.label.position {object} 标签位置 |  | ||||||
|    * @param options.label.position.lng {number} 经度 |  | ||||||
|    * @param options.label.position.lat {number} 纬度 |  | ||||||
|    * @param options.label.position.alt {number} 高度 |  | ||||||
|    * @param options.label.fontSize=20 {number} 字体大小 |  | ||||||
|    * @param options.label.fontFamily=0 {number} 字体项 0:黑体;1:思源黑体;2:庞门正道标题体;3:数黑体 |  | ||||||
|    * @param options.label.color=#ffffff {string} 字体颜色 |  | ||||||
|    * @param options.label.lineWidth=4 {number} 引线宽 |  | ||||||
|    * @param options.label.lineColor=#00ffff80 {string} 引线颜色 |  | ||||||
|    * @param options.label.pixelOffset=20 {number} 字体偏移(引线长度) |  | ||||||
|    * @param options.label.backgroundColor=['#00ffff80', '#00ffff80'] {array} 背景颜色 |  | ||||||
|    * @param options.label.scaleByDistance {boolean} 距离缩放 |  | ||||||
|    * @param options.label.near=2000 {number} 视野缩放最近距离 |  | ||||||
|    * @param options.label.far=100000 {number} 视野缩放最远距离 |  | ||||||
|    * @param options.attribute {object} 属性内容 |  | ||||||
|    * @param {object} options.attribute.link={} 链接 |  | ||||||
|    * @param options.attribute.link.content=[]] {array} 链接内容 |  | ||||||
|    * @param options.attribute.link.content[].name {string} 链接名称 |  | ||||||
|    * @param options.attribute.link.content[].url {string} 链接地址 |  | ||||||
|    * @param options.richTextContent {string} 富文本内容 |  | ||||||
|    * @param options.customView {object} 默认视角 |  | ||||||
|    * @param options.customView.orientation {object} 默认视角方位 |  | ||||||
|    * @param options.customView.orientation.heading {number} 航向角 |  | ||||||
|    * @param options.customView.orientation.pitch {number} 俯仰角 |  | ||||||
|    * @param options.customView.orientation.roll {number} 翻滚角 |  | ||||||
|    * @param options.customView.relativePosition {object} 视角相对位置 |  | ||||||
|    * @param options.customView.relativePosition.lng {number} 经度 |  | ||||||
|    * @param options.customView.relativePosition.lat {number} 纬度 |  | ||||||
|    * @param options.customView.relativePosition.alt {number} 高度 |  | ||||||
|    *  |  | ||||||
|     |     | ||||||
|  |  | ||||||
|    *  |  | ||||||
|    * @param _Dialog {object} 弹框事件 |    * @param _Dialog {object} 弹框事件 | ||||||
|    * @param _Dialog.confirmCallBack {function} 弹框确认时的回调 |    * @param _Dialog.confirmCallBack {function} 弹框确认时的回调 | ||||||
|    * */ |    * */ | ||||||
| @ -395,7 +355,7 @@ class PolygonObject extends Base { | |||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show && !this.showView || this.showView == 3) { |     if (this.show) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } else { |     } else { | ||||||
|       this.label.show = false |       this.label.show = false | ||||||
|  | |||||||
| @ -26,44 +26,9 @@ class PolyhedronObject extends Base { | |||||||
|    * @param options.name {string} 名称 |    * @param options.name {string} 名称 | ||||||
|    * @param options.color="#ff0000" {string} 颜色 |    * @param options.color="#ff0000" {string} 颜色 | ||||||
|    * @param options.height=10 {number} 高 |    * @param options.height=10 {number} 高 | ||||||
|    * @param options.areaUnit='平方米' {string} 投影面积单位 |    * @param {Array.<object>} options.positions 经纬度和高度的列表,值交替 [{lon,lat,alt},...] | ||||||
|    * @param {Array.<object>} options.positions 必填,经纬度和高度的列表,值交替 [{lon,lat,alt},...] |    * @param _Dialog {object} 弹框事件 | ||||||
|    * @param options.positions[].lng {number} 经度 |    * @param _Dialog.confirmCallBack {function} 弹框确认时的回调 | ||||||
|    * @param options.positions[].lat {number} 纬度 |  | ||||||
|    * @param options.positions[].alt {number} 高度 |  | ||||||
|    * @param options.label {object} 标签对象 |  | ||||||
|    * @param options.label.text {string} 标签文本 |  | ||||||
|    * @param options.label.show {string} 标签显隐 |  | ||||||
|    * @param options.label.position {string} 标签位置 |  | ||||||
|    * @param options.label.position {object} 标签位置 |  | ||||||
|    * @param options.label.position.lng {number} 经度 |  | ||||||
|    * @param options.label.position.lat {number} 纬度 |  | ||||||
|    * @param options.label.position.alt {number} 高度 |  | ||||||
|    * @param options.label.fontSize=20 {number} 字体大小 |  | ||||||
|    * @param options.label.fontFamily=0 {number} 字体项 0:黑体;1:思源黑体;2:庞门正道标题体;3:数黑体 |  | ||||||
|    * @param options.label.color=#ffffff {string} 字体颜色 |  | ||||||
|    * @param options.label.lineWidth=4 {number} 引线宽 |  | ||||||
|    * @param options.label.lineColor=#00ffff80 {string} 引线颜色 |  | ||||||
|    * @param options.label.pixelOffset=20 {number} 字体偏移(引线长度) |  | ||||||
|    * @param options.label.backgroundColor=['#00ffff80', '#00ffff80'] {array} 背景颜色 |  | ||||||
|    * @param options.label.scaleByDistance {boolean} 距离缩放 |  | ||||||
|    * @param options.label.near=2000 {number} 视野缩放最近距离 |  | ||||||
|    * @param options.label.far=100000 {number} 视野缩放最远距离 |  | ||||||
|    * @param options.attribute {object} 属性内容 |  | ||||||
|    * @param {object} options.attribute.link={} 链接 |  | ||||||
|    * @param options.attribute.link.content=[]] {array} 链接内容 |  | ||||||
|    * @param options.attribute.link.content[].name {string} 链接名称 |  | ||||||
|    * @param options.attribute.link.content[].url {string} 链接地址 |  | ||||||
|    * @param options.richTextContent {string} 富文本内容 |  | ||||||
|    * @param options.customView {object} 默认视角 |  | ||||||
|    * @param options.customView.orientation {object} 默认视角方位 |  | ||||||
|    * @param options.customView.orientation.heading {number} 航向角 |  | ||||||
|    * @param options.customView.orientation.pitch {number} 俯仰角 |  | ||||||
|    * @param options.customView.orientation.roll {number} 翻滚角 |  | ||||||
|    * @param options.customView.relativePosition {object} 视角相对位置 |  | ||||||
|    * @param options.customView.relativePosition.lng {number} 经度 |  | ||||||
|    * @param options.customView.relativePosition.lat {number} 纬度 |  | ||||||
|    * @param options.customView.relativePosition.alt {number} 高度 |  | ||||||
|    * */ |    * */ | ||||||
|   constructor(sdk, options = {}, _Dialog = {}) { |   constructor(sdk, options = {}, _Dialog = {}) { | ||||||
|     super(sdk, options); |     super(sdk, options); | ||||||
| @ -552,7 +517,7 @@ class PolyhedronObject extends Base { | |||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show && !this.showView || this.showView == 3) { |     if (this.show) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|  | |||||||
| @ -25,46 +25,28 @@ class PolylineObject extends Base { | |||||||
|    * @description 折线 |    * @description 折线 | ||||||
|    * @param options {object} 线属性 |    * @param options {object} 线属性 | ||||||
|    * @param options.name{string} 名称 |    * @param options.name{string} 名称 | ||||||
|    * @param options.width=3{number} 线宽 |    * @param options.width   * @param options.width=3{number} 线宽 | ||||||
|    * @param options.color=#ff0000 {string} 颜色 |    * @param options.color=#ff0000 {string} 颜色 | ||||||
|    * @param options.type=0 {number} 材质类型 0-实线 1-虚线 2-泛光... |    * @param options.type=0 {number} 材质类型 0-实线 1-虚线 2-泛光 | ||||||
|    * @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对高度;2:依附模式) |    * @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对高度;2:依附模式) | ||||||
|    * @param options.noseToTail=false {boolean} 首尾相连 |    * @param options['nose-to-tail']=false {boolean} 首尾相连 | ||||||
|    * @param options.smooth=false {boolean} 线段圆滑 |    * @param options.smooth=false {boolean} 线段圆滑 | ||||||
|    * @param options.extend=false {boolean} 线缓冲 |    * @param options.extend=false {boolean} 线缓冲 | ||||||
|    * @param options.extendWidth=10 {number} 线缓冲宽度 |    * @param options['extend-width']=10 {number} 线缓冲宽度 | ||||||
|    * @param options.extendColor=rgba(255,255,80,0.3) {number} 线缓冲颜色 |    * @param options['extend-color']=rgba(255,255,80,0.3) {number} 线缓冲颜色 | ||||||
|    * @param options.show=true {boolean} 显隐 |    * @param options.show=true {boolean} 显隐 | ||||||
|    * @param {Array.<object>} options.positions 必填,经纬度和高度的列表,值交替 [{lon,lat,alt},...] |    * @param {Array.<object>} options.positions 坐标数组 [{lng,lat},...] | ||||||
|    * @param options.positions[].lng {number} 经度 |    * @param options.label {object} 标注 | ||||||
|    * @param options.positions[].lat {number} 纬度 |    * @param options.label.show=false {boolean} 标注显隐 | ||||||
|    * @param options.positions[].alt {number} 高度 |    * @param options.label.fontSize=20 {number} 标注字体大小 | ||||||
|    * @param options.label {object} 标签对象 |    * @param options.label.color=#ffffff {string} 标注字体颜色 | ||||||
|    * @param options.label.text {string} 标签文本 |    * @param options.label.lineWidth=1 {number} 标注引线宽 | ||||||
|    * @param options.label.show {string} 标签显隐 |    * @param options.label.pixelOffset=20 {string} 标注引线长度 | ||||||
|    * @param options.label.position {string} 标签位置 |    * @param options.label.backgroundColor=['#42c6ef', '#42c6ef'] {Array} 标注背景 | ||||||
|    * @param options.label.position {object} 标签位置 |    * @param options.label.lineColor=#fff000 {string} 标注引线颜色 | ||||||
|    * @param options.label.position.lng {number} 经度 |    * @param options.label.scaleByDistance=false {boolean} 标注是否随视野缩放 | ||||||
|    * @param options.label.position.lat {number} 纬度 |    * @param options.label.near=2000 {boolean} 标注随视野缩放最近距离 | ||||||
|    * @param options.label.position.alt {number} 高度 |    * @param options.label.far=100000 {boolean} 标注随视野缩放最远距离 | ||||||
|    * @param options.label.fontSize=20 {number} 字体大小 |  | ||||||
|    * @param options.label.fontFamily=0 {number} 字体项 0:黑体;1:思源黑体;2:庞门正道标题体;3:数黑体 |  | ||||||
|    * @param options.label.color=#ffffff {string} 字体颜色 |  | ||||||
|    * @param options.label.lineWidth=4 {number} 引线宽 |  | ||||||
|    * @param options.label.lineColor=#00ffff80 {string} 引线颜色 |  | ||||||
|    * @param options.label.pixelOffset=20 {number} 字体偏移(引线长度) |  | ||||||
|    * @param options.label.backgroundColor=['#00ffff80', '#00ffff80'] {array} 背景颜色 |  | ||||||
|    * @param options.label.scaleByDistance {boolean} 距离缩放 |  | ||||||
|    * @param options.label.near=2000 {number} 视野缩放最近距离 |  | ||||||
|    * @param options.label.far=100000 {number} 视野缩放最远距离 |  | ||||||
|    * @param options.attribute {object} 属性内容 |  | ||||||
|    * @param options.attribute.link={} {string} 链接 |  | ||||||
|    * @param options.attribute.link.content=[]] {array} 链接内容 |  | ||||||
|    * @param options.attribute.link.content[].name {string} 链接名称 |  | ||||||
|    * @param options.attribute.link.content[].url {string} 链接地址 |  | ||||||
|    * @param options.richTextContent {string} 富文本内容 |  | ||||||
|    *  |  | ||||||
|    *  |  | ||||||
|    * @param _Dialog {object} 弹框事件 |    * @param _Dialog {object} 弹框事件 | ||||||
|    * @param _Dialog.confirmCallBack {function} 弹框确认时的回调 |    * @param _Dialog.confirmCallBack {function} 弹框确认时的回调 | ||||||
|    * */ |    * */ | ||||||
| @ -143,7 +125,6 @@ class PolylineObject extends Base { | |||||||
|     this.operate = {} |     this.operate = {} | ||||||
|     this.nodePoints = [] |     this.nodePoints = [] | ||||||
|     this.unitNum = 0 |     this.unitNum = 0 | ||||||
|     this.inputSpeed = (options.speed && Math.pow(options.speed, -1) * 100) || 10 |  | ||||||
|     this.Dialog = _Dialog |     this.Dialog = _Dialog | ||||||
|     if (!this.options.positions || this.options.positions.length < 2) { |     if (!this.options.positions || this.options.positions.length < 2) { | ||||||
|       this._error = '线段最少需要两个坐标!' |       this._error = '线段最少需要两个坐标!' | ||||||
| @ -172,10 +153,7 @@ class PolylineObject extends Base { | |||||||
|   } |   } | ||||||
|   set color(v) { |   set color(v) { | ||||||
|     this.options.color = v || '#ff0000' |     this.options.color = v || '#ff0000' | ||||||
|     let params = { ...this.options } |     this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) | ||||||
|     params.speed = this.inputSpeed |  | ||||||
|     // this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) |  | ||||||
|     this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, params) |  | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new YJColorPicker({ |         let colorPicker = new YJColorPicker({ | ||||||
| @ -202,13 +180,9 @@ class PolylineObject extends Base { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   set speed(v) { |   set speed(v) { | ||||||
|     this.options.speed = v |     // this.options.speed = v | ||||||
|     this.inputSpeed = v !== 0 ? Math.pow(v, -1) * 100 : 0 |     this.options.speed = v !== 0 ? Math.pow(v, -1) * 100 : 0 | ||||||
|     let params = { ...this.options } |     this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) | ||||||
|     params.speed = this.inputSpeed |  | ||||||
|     // this.options.speed = v !== 0 ? Math.pow(v, -1) * 100 : 0 |  | ||||||
|     // this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) |  | ||||||
|     this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, params) |  | ||||||
|   } |   } | ||||||
|   get dashSize() { |   get dashSize() { | ||||||
|     return this.options.dashSize |     return this.options.dashSize | ||||||
| @ -216,10 +190,7 @@ class PolylineObject extends Base { | |||||||
|  |  | ||||||
|   set dashSize(v) { |   set dashSize(v) { | ||||||
|     this.options.dashSize = v |     this.options.dashSize = v | ||||||
|     let params = { ...this.options } |     this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) | ||||||
|     params.speed = this.inputSpeed |  | ||||||
|     // this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) |  | ||||||
|     this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, params) |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   get rotate() { |   get rotate() { | ||||||
| @ -235,10 +206,7 @@ class PolylineObject extends Base { | |||||||
|       }) |       }) | ||||||
|  |  | ||||||
|     this.options.rotate = v |     this.options.rotate = v | ||||||
|     let params = { ...this.options } |     this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) | ||||||
|     params.speed = this.inputSpeed |  | ||||||
|     // this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) |  | ||||||
|     this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, params) |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   get space() { |   get space() { | ||||||
| @ -247,10 +215,7 @@ class PolylineObject extends Base { | |||||||
|  |  | ||||||
|   set space(v) { |   set space(v) { | ||||||
|     this.options.space = v |     this.options.space = v | ||||||
|     let params = { ...this.options } |     this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) | ||||||
|     params.speed = this.inputSpeed |  | ||||||
|     // this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) |  | ||||||
|     this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, params) |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   get length() { |   get length() { | ||||||
| @ -493,15 +458,13 @@ class PolylineObject extends Base { | |||||||
|         break |         break | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     let params = { ...this.options } |  | ||||||
|     params.speed = this.inputSpeed |  | ||||||
|     this.entity && |     this.entity && | ||||||
|       this.entity.polyline && |       this.entity.polyline && | ||||||
|       (this.entity.polyline.material = this.getMaterial( |       (this.entity.polyline.material = this.getMaterial( | ||||||
|         this.options.color, |         this.options.color, | ||||||
|         this.options.type, |         this.options.type, | ||||||
|         this.entity, |         this.entity, | ||||||
|         params |         this.options | ||||||
|       )) |       )) | ||||||
|   } |   } | ||||||
|   get noseToTail() { |   get noseToTail() { | ||||||
| @ -719,7 +682,7 @@ class PolylineObject extends Base { | |||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show && !this.showView || this.showView == 3) { |     if (this.show) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|       setTimeout(() => { |       setTimeout(() => { | ||||||
|         this.label.position = [ |         this.label.position = [ | ||||||
| @ -862,6 +825,7 @@ class PolylineObject extends Base { | |||||||
|   set labelLineColor(v) { |   set labelLineColor(v) { | ||||||
|     this.options.label.lineColor = v |     this.options.label.lineColor = v | ||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|  |     let _this = this | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new YJColorPicker({ |         let lineColorPicker = new YJColorPicker({ | ||||||
| @ -876,29 +840,6 @@ class PolylineObject extends Base { | |||||||
|           }, //点击确认按钮事件回调 |           }, //点击确认按钮事件回调 | ||||||
|           clear: () => { |           clear: () => { | ||||||
|             this.labelLineColor = 'rgba(0,255,255,0.5)' |             this.labelLineColor = 'rgba(0,255,255,0.5)' | ||||||
|           } //点击清空按钮事件回调 |  | ||||||
|         }) |  | ||||||
|         this._elms.labelLineColor[i] = lineColorPicker |  | ||||||
|       }) |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   get labelBackgroundColorStart() { |  | ||||||
|     return this.options.label.backgroundColor[0] |  | ||||||
|   } |  | ||||||
|   set labelBackgroundColorStart(v) { |  | ||||||
|     this.options.label.backgroundColor[0] = v |  | ||||||
|     this.label.backgroundColor = [v, this.label.backgroundColor[1]] |  | ||||||
|     if (this._elms.labelBackgroundColorStart) { |  | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |  | ||||||
|         let labelBackgroundColorStartPicker = new YJColorPicker({ |  | ||||||
|           el: item.el, |  | ||||||
|           size: 'mini', //颜色box类型 |  | ||||||
|           alpha: true, //是否开启透明度 |  | ||||||
|           defaultColor: this.labelBackgroundColorStart, |  | ||||||
|           disabled: false, //是否禁止打开颜色选择器 |  | ||||||
|           openPickerAni: 'opacity', //打开颜色选择器动画 |  | ||||||
|           sure: color => { |  | ||||||
|             this.labelBackgroundColorStart = color |             this.labelBackgroundColorStart = color | ||||||
|           }, //点击确认按钮事件回调 |           }, //点击确认按钮事件回调 | ||||||
|           clear: () => { |           clear: () => { | ||||||
| @ -907,7 +848,7 @@ class PolylineObject extends Base { | |||||||
|         }) |         }) | ||||||
|         this._elms.labelBackgroundColorStart[ |         this._elms.labelBackgroundColorStart[ | ||||||
|           i |           i | ||||||
|         ] = labelBackgroundColorStartPicker |         ] = _this.labelBackgroundColorStartPicker | ||||||
|       }) |       }) | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| @ -1408,13 +1349,11 @@ class PolylineObject extends Base { | |||||||
|  |  | ||||||
|     that.entity.polyline.oriWidth = that.options.width |     that.entity.polyline.oriWidth = that.options.width | ||||||
|     that.judgeLine(that.entity, that.options) |     that.judgeLine(that.entity, that.options) | ||||||
|     let params = { ...that.options } |  | ||||||
|     params.speed = that.inputSpeed |  | ||||||
|     that.entity.polyline.material = that.getMaterial( |     that.entity.polyline.material = that.getMaterial( | ||||||
|       that.options.color, |       that.options.color, | ||||||
|       that.options.type, |       that.options.type, | ||||||
|       that.entity, |       that.entity, | ||||||
|       params |       that.options | ||||||
|     ) |     ) | ||||||
|     that.sdk._entityZIndex++ |     that.sdk._entityZIndex++ | ||||||
|     PolylineObject.createLabel(that) |     PolylineObject.createLabel(that) | ||||||
| @ -1428,10 +1367,10 @@ class PolylineObject extends Base { | |||||||
|       that.options.lengthByMeter = res |       that.options.lengthByMeter = res | ||||||
|       that.lengthUnit = that.options['length-unit'] |       that.lengthUnit = that.options['length-unit'] | ||||||
|       syncData(that.sdk, that.options.id) |       syncData(that.sdk, that.options.id) | ||||||
|  |       if (that.options.show) { | ||||||
|  |         setSplitDirection(0, that.options.id) | ||||||
|  |       } | ||||||
|     }) |     }) | ||||||
|     if (that.options.show) { |  | ||||||
|       setSplitDirection(0, that.options.id) |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     // if (this.options['nose-to-tail']) { |     // if (this.options['nose-to-tail']) { | ||||||
|  | |||||||
| @ -20,44 +20,14 @@ class RadarScan extends Base { | |||||||
|    * @param sdk  |    * @param sdk  | ||||||
|    * @param options {object} 圆属性 |    * @param options {object} 圆属性 | ||||||
|    * @param options.id {string} 标注id |    * @param options.id {string} 标注id | ||||||
|    * @param options.show=true {boolean} 显示/隐藏 |    * @param [options.show=true] {boolean} 显示/隐藏 | ||||||
|    * @param options.lng {number} 经度 |    * @param options.lng {number} 经度 | ||||||
|    * @param options.lat {number} 维度 |    * @param options.lat {number} 维度 | ||||||
|    * @param options.color=#FFEB3B {string} 颜色 |    * @param options.color=#1FA8E3 {string} 颜色 | ||||||
|    * @param options.radius=10 {number} 半径 |    * @param options.radius=10 {number} 半径 | ||||||
|    * @param options.speed=20 {number} 速度 |    * @param options.speed=20 {number} 速度 | ||||||
|    * @param options.label {object} 标签对象 |    * @param _Dialog {object} 弹框事件 | ||||||
|    * @param options.label.show {string} 标签显隐 |    * @param _Dialog.confirmCallBack {function} 弹框确认时的回调 | ||||||
|    * @param options.label.position {string} 标签位置 |  | ||||||
|    * @param options.label.position {object} 标签位置 |  | ||||||
|    * @param options.label.position.lng {number} 经度 |  | ||||||
|    * @param options.label.position.lat {number} 纬度 |  | ||||||
|    * @param options.label.position.alt {number} 高度 |  | ||||||
|    * @param options.label.fontSize=20 {number} 字体大小 |  | ||||||
|    * @param options.label.fontFamily=0 {number} 字体项 0:黑体;1:思源黑体;2:庞门正道标题体;3:数黑体 |  | ||||||
|    * @param options.label.color=#ffffff {string} 字体颜色 |  | ||||||
|    * @param options.label.lineWidth=4 {number} 引线宽 |  | ||||||
|    * @param options.label.lineColor=#00ffff80 {string} 引线颜色 |  | ||||||
|    * @param options.label.pixelOffset=20 {number} 字体偏移(引线长度) |  | ||||||
|    * @param options.label.backgroundColor=['#00ffff80', '#00ffff80'] {array} 背景颜色 |  | ||||||
|    * @param options.label.scaleByDistance {boolean} 距离缩放 |  | ||||||
|    * @param options.label.near=2000 {number} 视野缩放最近距离 |  | ||||||
|    * @param options.label.far=100000 {number} 视野缩放最远距离 |  | ||||||
|    * @param options.attribute {object} 属性内容 |  | ||||||
|    * @param {object} options.attribute.link={} 链接 |  | ||||||
|    * @param options.attribute.link.content=[]] {array} 链接内容 |  | ||||||
|    * @param options.attribute.link.content[].name {string} 链接名称 |  | ||||||
|    * @param options.attribute.link.content[].url {string} 链接地址 |  | ||||||
|    * @param options.richTextContent {string} 富文本内容 |  | ||||||
|    * @param options.customView {object} 默认视角 |  | ||||||
|    * @param options.customView.orientation {object} 默认视角方位 |  | ||||||
|    * @param options.customView.orientation.heading {number} 航向角 |  | ||||||
|    * @param options.customView.orientation.pitch {number} 俯仰角 |  | ||||||
|    * @param options.customView.orientation.roll {number} 翻滚角 |  | ||||||
|    * @param options.customView.relativePosition {object} 视角相对位置 |  | ||||||
|    * @param options.customView.relativePosition.lng {number} 经度 |  | ||||||
|    * @param options.customView.relativePosition.lat {number} 纬度 |  | ||||||
|    * @param options.customView.relativePosition.alt {number} 高度 |  | ||||||
|    */ |    */ | ||||||
|   constructor(sdk, options = {}, _Dialog = {}) { |   constructor(sdk, options = {}, _Dialog = {}) { | ||||||
|     super(sdk, options); |     super(sdk, options); | ||||||
| @ -168,7 +138,7 @@ class RadarScan extends Base { | |||||||
|     }) |     }) | ||||||
|     that.sdk._entityZIndex++ |     that.sdk._entityZIndex++ | ||||||
|     if (that.sdk.viewer._element.className === 'cesium-viewer 2d') { |     if (that.sdk.viewer._element.className === 'cesium-viewer 2d') { | ||||||
|       that.entity.ellipse.height = 1 |       that.entity.ellipse.height = 1000000 | ||||||
|     } |     } | ||||||
|     RadarScan.createLabel(that) |     RadarScan.createLabel(that) | ||||||
|     syncData(that.sdk, that.options.id) |     syncData(that.sdk, that.options.id) | ||||||
|  | |||||||
| @ -23,46 +23,16 @@ class RadarScanStereoscopic extends Base { | |||||||
|    * @param sdk  |    * @param sdk  | ||||||
|    * @param options {object} 属性 |    * @param options {object} 属性 | ||||||
|    * @param options.id {string} 标注id |    * @param options.id {string} 标注id | ||||||
|    * @param options.show=true {boolean} 显示/隐藏 |    * @param [options.show=true] {boolean} 显示/隐藏 | ||||||
|    * @param options.lng {number} 经度 |    * @param options.lng {number} 经度 | ||||||
|    * @param options.lat {number} 纬度 |    * @param options.lat {number} 纬度 | ||||||
|    * @param options.alt {number} 高度 |    * @param options.alt {number} 高度 | ||||||
|    * @param options.colorOut=rgba(255,255,0,0.3){string} 范围颜色 |    * @param options.colorOut=#ff0000 {string} 范围颜色 | ||||||
|    * @param options.colorIn=rgba(255,0,0,0.3){string} 扫描颜色 |    * @param options.colorIn=#ff0000 {string} 扫描颜色 | ||||||
|    * @param options.radius=10 {number} 半径 |    * @param options.radius=10 {number} 半径 | ||||||
|    * @param options.duration=2000 {number} 持续时间 |    * @param options.duration=2000 {number} 持续时间 | ||||||
|    * @param options.label {object} 标签对象 |    * @param _Dialog {object} 弹框事件 | ||||||
|    * @param options.label.show {string} 标签显隐 |    * @param _Dialog.confirmCallBack {function} 弹框确认时的回调 | ||||||
|    * @param options.label.position {string} 标签位置 |  | ||||||
|    * @param options.label.position {object} 标签位置 |  | ||||||
|    * @param options.label.position.lng {number} 经度 |  | ||||||
|    * @param options.label.position.lat {number} 纬度 |  | ||||||
|    * @param options.label.position.alt {number} 高度 |  | ||||||
|    * @param options.label.fontSize=20 {number} 字体大小 |  | ||||||
|    * @param options.label.fontFamily=0 {number} 字体项 0:黑体;1:思源黑体;2:庞门正道标题体;3:数黑体 |  | ||||||
|    * @param options.label.color=#ffffff {string} 字体颜色 |  | ||||||
|    * @param options.label.lineWidth=4 {number} 引线宽 |  | ||||||
|    * @param options.label.lineColor=#00ffff80 {string} 引线颜色 |  | ||||||
|    * @param options.label.pixelOffset=20 {number} 字体偏移(引线长度) |  | ||||||
|    * @param options.label.backgroundColor=['#00ffff80', '#00ffff80'] {array} 背景颜色 |  | ||||||
|    * @param options.label.scaleByDistance {boolean} 距离缩放 |  | ||||||
|    * @param options.label.near=2000 {number} 视野缩放最近距离 |  | ||||||
|    * @param options.label.far=100000 {number} 视野缩放最远距离 |  | ||||||
|    * @param options.attribute {object} 属性内容 |  | ||||||
|    * @param {object} options.attribute.link={} 链接 |  | ||||||
|    * @param options.attribute.link.content=[]] {array} 链接内容 |  | ||||||
|    * @param options.attribute.link.content[].name {string} 链接名称 |  | ||||||
|    * @param options.attribute.link.content[].url {string} 链接地址 |  | ||||||
|    * @param options.richTextContent {string} 富文本内容 |  | ||||||
|    * @param options.customView {object} 默认视角 |  | ||||||
|    * @param options.customView.orientation {object} 默认视角方位 |  | ||||||
|    * @param options.customView.orientation.heading {number} 航向角 |  | ||||||
|    * @param options.customView.orientation.pitch {number} 俯仰角 |  | ||||||
|    * @param options.customView.orientation.roll {number} 翻滚角 |  | ||||||
|    * @param options.customView.relativePosition {object} 视角相对位置 |  | ||||||
|    * @param options.customView.relativePosition.lng {number} 经度 |  | ||||||
|    * @param options.customView.relativePosition.lat {number} 纬度 |  | ||||||
|    * @param options.customView.relativePosition.alt {number} 高度 |  | ||||||
|    */ |    */ | ||||||
|   constructor(sdk, options, _Dialog = {}) { |   constructor(sdk, options, _Dialog = {}) { | ||||||
|     super(sdk, options); |     super(sdk, options); | ||||||
| @ -454,7 +424,7 @@ class RadarScanStereoscopic extends Base { | |||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show && !this.showView || this.showView == 3) { |     if (this.show) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|  | |||||||
| @ -1,39 +0,0 @@ | |||||||
| function html() { |  | ||||||
|   return ` |  | ||||||
|     <span class="custom-divider"></span> |  | ||||||
|     <div class="div-item"> |  | ||||||
|         <div class="row"> |  | ||||||
|             <div class="col"> |  | ||||||
|                 <span class="label">名称</span> |  | ||||||
|                 <input class="input" maxlength="40" type="text" @model="name"> |  | ||||||
|             </div> |  | ||||||
|             <div class="col road-box"> |  | ||||||
|                 <span class="label" style="flex: 0 0 56px;">道路类型</span> |  | ||||||
|                 <div class="road-type"></div> |  | ||||||
|             </div> |  | ||||||
|         </div> |  | ||||||
|     </div> |  | ||||||
|     <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-1"> |  | ||||||
|                     <input class="input" type="number" title="" max="99999" min="1" step="1" @model="carRoadWidth"> |  | ||||||
|                     <span class="arrow"></span> |  | ||||||
|                 </div> |  | ||||||
|             </div> |  | ||||||
|             <div class="col"> |  | ||||||
|                 <span class="label">人行道宽度</span> |  | ||||||
|                 <div class="input-number input-number-unit-1"> |  | ||||||
|                     <input class="input" type="number" title="" max="99999" min="1" step="1" @model="sideWidth"> |  | ||||||
|                     <span class="arrow"></span> |  | ||||||
|                 </div> |  | ||||||
|             </div> |  | ||||||
|         </div> |  | ||||||
|     </div> |  | ||||||
|     <span class="custom-divider"></span> |  | ||||||
|     ` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| export { html } |  | ||||||
| @ -1,92 +0,0 @@ | |||||||
| class eventBinding { |  | ||||||
|   constructor() { |  | ||||||
|     this.element = {} |  | ||||||
|   } |  | ||||||
|   static event = {} |  | ||||||
|  |  | ||||||
|   getEvent(name) { |  | ||||||
|     return eventBinding.event[name] |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   getEventAll() { |  | ||||||
|     return eventBinding.event |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   setEvent(name, event) { |  | ||||||
|     eventBinding.event[name] = event |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   on(that, elements) { |  | ||||||
|     for (let i = 0; i < elements.length; i++) { |  | ||||||
|       let Event = [] |  | ||||||
|       let isEvent = false |  | ||||||
|       let removeName = [] |  | ||||||
|       if (!elements[i] || !elements[i].attributes) { |  | ||||||
|         continue; |  | ||||||
|       } |  | ||||||
|       for (let m of elements[i].attributes) { |  | ||||||
|         switch (m.name) { |  | ||||||
|           case '@model': { |  | ||||||
|             isEvent = true |  | ||||||
|             if (elements[i].type == 'checkbox') { |  | ||||||
|               Event.push((e) => { that[m.value] = e.target.checked }) |  | ||||||
|               elements[i].checked = that[m.value] |  | ||||||
|             } |  | ||||||
|             else { |  | ||||||
|               Event.push((e) => { |  | ||||||
|                 let value = e.target.value |  | ||||||
|                 if (e.target.type == 'number') { |  | ||||||
|                   value = Number(value) |  | ||||||
|                 } |  | ||||||
|                 that[m.value] = value |  | ||||||
|               }) |  | ||||||
|               if (elements[i].nodeName == 'IMG') { |  | ||||||
|                 elements[i].src = that[m.value] |  | ||||||
|               } |  | ||||||
|               else { |  | ||||||
|                 elements[i].value = that[m.value] |  | ||||||
|               } |  | ||||||
|             } |  | ||||||
|             if (this.element[m.value]) { |  | ||||||
|               this.element[m.value].push(elements[i]) |  | ||||||
|             } |  | ||||||
|             else { |  | ||||||
|               this.element[m.value] = [elements[i]] |  | ||||||
|             } |  | ||||||
|             removeName.push(m.name) |  | ||||||
|             break; |  | ||||||
|           } |  | ||||||
|           case '@click': { |  | ||||||
|             elements[i].addEventListener('click', (e) => { |  | ||||||
|               if (typeof (that.Dialog[m.value]) === 'function') { |  | ||||||
|                 that.Dialog[m.value](e) |  | ||||||
|               } |  | ||||||
|             }); |  | ||||||
|             removeName.push(m.name) |  | ||||||
|             // elements[i].attributes.removeNamedItem(m.name) |  | ||||||
|             break; |  | ||||||
|           } |  | ||||||
|         } |  | ||||||
|         // elements[i].attributes[m] = undefined |  | ||||||
|       } |  | ||||||
|       for (let n = 0; n < removeName.length; n++) { |  | ||||||
|         elements[i].attributes.removeNamedItem(removeName[n]) |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|       if (isEvent) { |  | ||||||
|         let ventType = 'input' |  | ||||||
|         if (elements[i].tagName != 'INPUT' || elements[i].type == 'checkbox') { |  | ||||||
|           ventType = 'change' |  | ||||||
|         } |  | ||||||
|         elements[i].addEventListener(ventType, (e) => { |  | ||||||
|           for (let t = 0; t < Event.length; t++) { |  | ||||||
|             Event[t](e) |  | ||||||
|           } |  | ||||||
|         }); |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| const EventBinding = new eventBinding(); |  | ||||||
| export default EventBinding; |  | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -1,889 +0,0 @@ | |||||||
| /** |  | ||||||
|  * @description 道路 |  | ||||||
|  */ |  | ||||||
| import Dialog from '../../Element/Dialog'; |  | ||||||
| import { html } from "./_element"; |  | ||||||
| import EventBinding from '../../Element/Dialog/eventBinding'; |  | ||||||
| import Base from "../index"; |  | ||||||
| import { syncData } from '../../../Global/MultiViewportMode' |  | ||||||
| import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen' |  | ||||||
| import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global' |  | ||||||
|  |  | ||||||
| class Road extends Base { |  | ||||||
|   /** |  | ||||||
|    * @constructor |  | ||||||
|    * @param sdk |  | ||||||
|    * @description 道路 |  | ||||||
|    * @param options {object} 道路属性 |  | ||||||
|    * @param options.name=未命名对象 {string} 名称 |  | ||||||
|    * @param options.carRoadWidth=2 {number} 车道宽度 |  | ||||||
|    * @param options.sideWidth=2 {number} 人行道宽度 |  | ||||||
|    * @param options.positions=[] {array} 道路positions |  | ||||||
|    * @param options.roadImage='' {string} 车道贴图 |  | ||||||
|    * @param options.sideImage='' {string} 人行道贴图 |  | ||||||
|    * @param Dialog {object} 弹框对象 |  | ||||||
|    * @param Dialog.confirmCallBack {function} 弹框确认时的回调 |  | ||||||
|    * */ |  | ||||||
|   constructor(sdk, options = {}, _Dialog = {}) { |  | ||||||
|     super(sdk, options); |  | ||||||
|     this.viewer = this.sdk.viewer |  | ||||||
|     this.options.name = options.name || '道路' |  | ||||||
|     this.options.carRoadWidth = options.carRoadWidth || 10 |  | ||||||
|     this.options.sideWidth = options.sideWidth || 5 |  | ||||||
|     this.options.positions = options.positions || [] |  | ||||||
|     this.options.roadImage = options.roadImage || (this.getSourceRootPath() + '/img/roadPhoto.png') |  | ||||||
|     this.options.sideImage = options.sideImage || (this.getSourceRootPath() + '/img/sidePhoto.png') |  | ||||||
|     this.options.show = (options.show || options.show === false) ? options.show : true |  | ||||||
|     this.Dialog = _Dialog |  | ||||||
|     this._EventBinding = new EventBinding() |  | ||||||
|     this._elms = {}; |  | ||||||
|     this.positionArea = [] |  | ||||||
|     this.positions = [] |  | ||||||
|     this.lineEntity = '' |  | ||||||
|  |  | ||||||
|     this.sdk.addIncetance(this.options.id, this) |  | ||||||
|     Road.create(this) |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   // 创建道路 |  | ||||||
|   static create(that) { |  | ||||||
|     let positions = [] |  | ||||||
|     that.options.positions.forEach(v => { |  | ||||||
|       positions.push(new Cesium.Cartesian3.fromDegrees(v.lng, v.lat, v.alt)) |  | ||||||
|     }) |  | ||||||
|  |  | ||||||
|     let area = [[], [], []] |  | ||||||
|     area[1] = that.createLineBufferPolygon2(positions, that.options.carRoadWidth / 2) |  | ||||||
|     area[0] = that.createLineBufferPolygonSide(area[1][2], -that.options.sideWidth) |  | ||||||
|     area[2] = that.createLineBufferPolygonSide(area[1][1], that.options.sideWidth) |  | ||||||
|  |  | ||||||
|     //判断道路边是否相交 |  | ||||||
|     for (let i = 0; i < area[0].length - 1; i++) { |  | ||||||
|  |  | ||||||
|       let leftItem = area[0][i] |  | ||||||
|       let leftItem2 = area[0][i + 1] |  | ||||||
|       let rightItem = area[2][i] |  | ||||||
|       let rightItem2 = area[2][i + 1] |  | ||||||
|       let carItem = area[1][0][i] |  | ||||||
|       let carItem2 = area[1][0][i + 1] |  | ||||||
|       let leftLine = that.getIntersects(leftItem[1], leftItem[2], leftItem2[1], leftItem2[2]) |  | ||||||
|       let rightLine = that.getIntersects(rightItem[1], rightItem[2], rightItem2[1], rightItem2[2]) |  | ||||||
|  |  | ||||||
|       console.log(leftLine, 'leftLine') |  | ||||||
|       if (leftLine) {//左侧相交 |  | ||||||
|         //获取右侧延长交点 |  | ||||||
|         let point1 = that.getExtendPoint(rightItem[1], rightItem[2], 1000) |  | ||||||
|         let point2 = that.getExtendPoint(rightItem2[2], rightItem2[1], 1000) |  | ||||||
|         let rightIntersection = that.getIntersects(rightItem[2], point1, rightItem2[1], point2) |  | ||||||
|         //将其他几条边都延长 |  | ||||||
|         let leftLineNeiPoint = that.getExtendPoint(leftItem[0], leftItem[3], 1000) |  | ||||||
|         let carLeftPoint = that.getExtendPoint(carItem[3], carItem[2], 1000) |  | ||||||
|         let carRightPoint = that.getExtendPoint(carItem[0], carItem[1], 1000) |  | ||||||
|         let rightLineNeiPoint = that.getExtendPoint(rightItem[0], rightItem[3], 1000) |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         //跟左侧里相交点 |  | ||||||
|         let leftLineNei = that.getIntersects(leftLine, rightIntersection, leftItem[0], leftLineNeiPoint) |  | ||||||
|         //跟车道左侧相交点 |  | ||||||
|         let carLeft = that.getIntersects(leftLine, rightIntersection, carItem[3], carLeftPoint) |  | ||||||
|         //跟车道右侧相交点 |  | ||||||
|         let carRight = that.getIntersects(leftLine, rightIntersection, carItem[0], carRightPoint) |  | ||||||
|         let rightLineNei = that.getIntersects(leftLine, rightIntersection, rightItem[0], rightLineNeiPoint) |  | ||||||
|  |  | ||||||
|         // let leftLineNei = that.getIntersects(leftLine, rightItem[2], leftItem[0], leftItem[3]) |  | ||||||
|         // let carLeft = that.getIntersects(leftLine, rightItem[2], carItem[3], carItem[2]) |  | ||||||
|         // let carRight = that.getIntersects(leftLine, rightItem[2], carItem[0], carItem[1]) |  | ||||||
|         // let rightLineNei = that.getIntersects(leftLine, rightItem[2], rightItem[0], rightItem[3]) |  | ||||||
|  |  | ||||||
|         // let leftLineNei = that.getIntersects(leftLine, intersection, leftItem[0], leftItem[3]) |  | ||||||
|         // //跟车道左侧相交点 |  | ||||||
|         // let carLeft = that.getIntersects(leftLine, intersection, carItem[3], carItem[2]) |  | ||||||
|         // //跟车道右侧相交点 |  | ||||||
|         // let carRight = that.getIntersects(leftLine, intersection, carItem[0], carItem[1]) |  | ||||||
|         // let rightLineNei = that.getIntersects(leftLine, intersection, rightItem[0], rightItem[3]) |  | ||||||
|  |  | ||||||
|         leftItem[2] = leftLine |  | ||||||
|         leftItem[3] = leftLineNei |  | ||||||
|         carItem[2] = carLeft |  | ||||||
|         carItem[1] = carRight |  | ||||||
|         rightItem[3] = rightLineNei |  | ||||||
|         rightItem[2] = rightIntersection |  | ||||||
|         console.log(leftItem, carItem, rightItem, 'leftItemleft') |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         //将其他几条边都延长 |  | ||||||
|         let leftLineNeiPoint2 = that.getExtendPoint(leftItem2[3], leftItem2[0], 1000) |  | ||||||
|         let carLeftPoint2 = that.getExtendPoint(carItem2[2], carItem2[3], 1000) |  | ||||||
|         let carRightPoint2 = that.getExtendPoint(carItem2[1], carItem2[0], 1000) |  | ||||||
|         let rightLineNeiPoint2 = that.getExtendPoint(rightItem2[3], rightItem2[0], 1000) |  | ||||||
|  |  | ||||||
|         // let leftLineNei2 = that.getIntersects(leftLine, rightItem2[1], leftItem2[0], leftItem2[3]) |  | ||||||
|         // let carLeft2 = that.getIntersects(leftLine, rightItem2[1], carItem2[3], carItem2[2]) |  | ||||||
|         // let carRight2 = that.getIntersects(leftLine, rightItem2[1], carItem2[0], carItem2[1]) |  | ||||||
|         // let rightLineNei2 = that.getIntersects(leftLine, rightItem2[1], rightItem2[0], rightItem2[3]) |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         let leftLineNei2 = that.getIntersects(leftLine, rightIntersection, leftItem2[3], leftLineNeiPoint2) |  | ||||||
|         let carLeft2 = that.getIntersects(leftLine, rightIntersection, carItem2[2], carLeftPoint2) |  | ||||||
|         let carRight2 = that.getIntersects(leftLine, rightIntersection, carItem2[1], carRightPoint2) |  | ||||||
|         let rightLineNei2 = that.getIntersects(leftLine, rightIntersection, rightItem2[3], rightLineNeiPoint2) |  | ||||||
|  |  | ||||||
|         // let arr = [leftLine, rightIntersection, leftItem2[3], leftLineNeiPoint2] |  | ||||||
|         // arr.forEach((item, index) => { |  | ||||||
|         //   that.sdk.viewer.entities.add({ |  | ||||||
|         //     name: 'node-secondary-edit-point', |  | ||||||
|         //     index: i, |  | ||||||
|         //     position: item, |  | ||||||
|         //     billboard: { |  | ||||||
|         //       image: that.getSourceRootPath() + '/img/point.png', |  | ||||||
|         //       width: 15, |  | ||||||
|         //       height: 15, |  | ||||||
|         //       disableDepthTestDistance: Number.POSITIVE_INFINITY, |  | ||||||
|         //       color: Cesium.Color.WHITE.withAlpha(0.99) |  | ||||||
|         //     }, |  | ||||||
|         //     label: { |  | ||||||
|         //       text: '' + index, |  | ||||||
|         //       pixelOffset: { x: 0, y: -20 }, |  | ||||||
|         //     }, |  | ||||||
|         //   }) |  | ||||||
|         // }) |  | ||||||
|  |  | ||||||
|         // let leftLineNei2 = that.getIntersects(leftLine, intersection, leftItem2[0], leftItem2[3]) |  | ||||||
|         // //跟车道左侧相交点 |  | ||||||
|         // let carLeft2 = that.getIntersects(leftLine, intersection, carItem2[3], carItem2[2]) |  | ||||||
|         // //跟车道右侧相交点 |  | ||||||
|         // let carRight2 = that.getIntersects(leftLine, intersection, carItem2[0], carItem2[1]) |  | ||||||
|         // let rightLineNei2 = that.getIntersects(leftLine, intersection, rightItem2[0], rightItem2[3]) |  | ||||||
|  |  | ||||||
|         leftItem2[1] = leftLine |  | ||||||
|         leftItem2[0] = leftLineNei2 |  | ||||||
|         carItem2[3] = carLeft2 |  | ||||||
|         carItem2[0] = carRight2 |  | ||||||
|         rightItem2[0] = rightLineNei2 |  | ||||||
|         rightItem2[1] = rightIntersection |  | ||||||
|         console.log(leftItem2, carItem2, rightItem2, 'leftItem2left') |  | ||||||
|  |  | ||||||
|       } else if (rightLine) {//右侧相交 |  | ||||||
|  |  | ||||||
|         //获取左侧延长交点 |  | ||||||
|         let point1 = that.getExtendPoint(leftItem[1], leftItem[2], 1000) |  | ||||||
|         let point2 = that.getExtendPoint(leftItem2[2], leftItem2[1], 1000) |  | ||||||
|         let rightIntersection = that.getIntersects(leftItem[2], point1, leftItem2[1], point2) |  | ||||||
|         //将其他几条边都延长 |  | ||||||
|         let leftLineNeiPoint = that.getExtendPoint(leftItem[0], leftItem[3], 1000) |  | ||||||
|         let carLeftPoint = that.getExtendPoint(carItem[3], carItem[2], 1000) |  | ||||||
|         let carRightPoint = that.getExtendPoint(carItem[0], carItem[1], 1000) |  | ||||||
|         let rightLineNeiPoint = that.getExtendPoint(rightItem[0], rightItem[3], 1000) |  | ||||||
|  |  | ||||||
|         // //跟左侧里相交点 |  | ||||||
|         let leftLineNei = that.getIntersects(rightLine, rightIntersection, leftItem[0], leftLineNeiPoint) |  | ||||||
|         //跟车道左侧相交点 |  | ||||||
|         let carLeft = that.getIntersects(rightLine, rightIntersection, carItem[3], carLeftPoint) |  | ||||||
|         //跟车道右侧相交点 |  | ||||||
|         let carRight = that.getIntersects(rightLine, rightIntersection, carItem[0], carRightPoint) |  | ||||||
|         let rightLineNei = that.getIntersects(rightLine, rightIntersection, rightItem[0], rightLineNeiPoint) |  | ||||||
|         // //跟左侧里相交点 |  | ||||||
|         // let leftLineNei = that.getIntersects(rightLine, leftItem[2], leftItem[0], leftItem[3]) |  | ||||||
|         // //跟车道左侧相交点 |  | ||||||
|         // let carLeft = that.getIntersects(rightLine, leftItem[2], carItem[3], carItem[2]) |  | ||||||
|         // //跟车道右侧相交点 |  | ||||||
|         // let carRight = that.getIntersects(rightLine, leftItem[2], carItem[0], carItem[1]) |  | ||||||
|         // let rightLineNei = that.getIntersects(rightLine, leftItem[2], rightItem[0], rightItem[3]) |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         leftItem[2] = rightIntersection |  | ||||||
|         leftItem[3] = leftLineNei |  | ||||||
|         carItem[2] = carLeft |  | ||||||
|         carItem[1] = carRight |  | ||||||
|         rightItem[3] = rightLineNei |  | ||||||
|         rightItem[2] = rightLine |  | ||||||
|         console.log(leftItem, carItem, rightItem, 'leftItemright') |  | ||||||
|  |  | ||||||
|         //将其他几条边都延长 |  | ||||||
|         let leftLineNeiPoint2 = that.getExtendPoint(leftItem2[3], leftItem2[0], 1000) |  | ||||||
|         let carLeftPoint2 = that.getExtendPoint(carItem2[2], carItem2[3], 1000) |  | ||||||
|         let carRightPoint2 = that.getExtendPoint(carItem2[1], carItem2[0], 1000) |  | ||||||
|         let rightLineNeiPoint2 = that.getExtendPoint(rightItem2[3], rightItem2[0], 1000) |  | ||||||
|  |  | ||||||
|         let leftLineNei2 = that.getIntersects(rightLine, rightIntersection, leftItem2[3], leftLineNeiPoint2) |  | ||||||
|         //跟车道左侧相交点 |  | ||||||
|         let carLeft2 = that.getIntersects(rightLine, rightIntersection, carItem2[2], carLeftPoint2) |  | ||||||
|         //跟车道右侧相交点 |  | ||||||
|         let carRight2 = that.getIntersects(rightLine, rightIntersection, carItem2[1], carRightPoint2) |  | ||||||
|         let rightLineNei2 = that.getIntersects(rightLine, rightIntersection, rightItem2[3], rightLineNeiPoint2) |  | ||||||
|         // let leftLineNei2 = that.getIntersects(rightLine, leftItem2[1], leftItem2[0], leftItem2[3]) |  | ||||||
|         // //跟车道左侧相交点 |  | ||||||
|         // let carLeft2 = that.getIntersects(rightLine, leftItem2[1], carItem2[3], carItem2[2]) |  | ||||||
|         // //跟车道右侧相交点 |  | ||||||
|         // let carRight2 = that.getIntersects(rightLine, leftItem2[1], carItem2[0], carItem2[1]) |  | ||||||
|         // let rightLineNei2 = that.getIntersects(rightLine, leftItem2[1], rightItem2[0], rightItem2[3]) |  | ||||||
|  |  | ||||||
|         leftItem2[1] = rightIntersection |  | ||||||
|         leftItem2[0] = leftLineNei2 |  | ||||||
|         carItem2[3] = carLeft2 |  | ||||||
|         carItem2[0] = carRight2 |  | ||||||
|         rightItem2[0] = rightLineNei2 |  | ||||||
|         rightItem2[1] = rightLine |  | ||||||
|         console.log(leftItem2, carItem2, rightItem2, 'leftItem2right') |  | ||||||
|  |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     console.log(area[0], 'area') |  | ||||||
|  |  | ||||||
|     if (that.viewer.entities.getById(that.options.id)) { |  | ||||||
|       that.viewer.entities.getById(that.options.id)._children.forEach((item) => { |  | ||||||
|         that.viewer.entities.remove(item); |  | ||||||
|       }); |  | ||||||
|       that.viewer.entities.remove(that.viewer.entities.getById(that.options.id)) |  | ||||||
|     } |  | ||||||
|     that.lineEntity = that.viewer.entities.add(new Cesium.Entity({ id: that.options.id, show: that.options.show })) |  | ||||||
|  |  | ||||||
|     const myImg = new Image() |  | ||||||
|     myImg.src = that.options.roadImage |  | ||||||
|     myImg.onload = function () { |  | ||||||
|       console.log(area[1][0], 'arr') |  | ||||||
|       area[1][0].forEach((item, index) => { |  | ||||||
|         that.viewer.entities.add({ |  | ||||||
|           // id: that.options.id, |  | ||||||
|           parent: that.lineEntity, |  | ||||||
|           polygon: { |  | ||||||
|             hierarchy: new Cesium.PolygonHierarchy(item), |  | ||||||
|             material: new Cesium.ImageMaterialProperty({ |  | ||||||
|               image: that.options.roadImage, |  | ||||||
|               transparent: true,// 如果图片有透明部分,需要设置为 true |  | ||||||
|               repeat: that.calculateTextureRepeat(item, myImg) |  | ||||||
|             }), |  | ||||||
|             stRotation: that.calculateRoadAngle(positions[index], positions[index + 1]) |  | ||||||
|           } |  | ||||||
|         }); |  | ||||||
|       }) |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     const myImg2 = new Image() |  | ||||||
|     myImg2.src = that.options.sideImage |  | ||||||
|     myImg2.onload = function () { |  | ||||||
|       area[0].forEach((item, index) => { |  | ||||||
|         that.viewer.entities.add({ |  | ||||||
|           parent: that.lineEntity, |  | ||||||
|           polygon: { |  | ||||||
|             hierarchy: new Cesium.PolygonHierarchy(item), |  | ||||||
|             material: new Cesium.ImageMaterialProperty({ |  | ||||||
|               image: that.options.sideImage, |  | ||||||
|               transparent: true,// 如果图片有透明部分,需要设置为 true |  | ||||||
|               repeat: that.calculateTextureRepeat(item, myImg2) |  | ||||||
|             }), |  | ||||||
|             stRotation: that.calculateRoadAngle(positions[index], positions[index + 1]) |  | ||||||
|           } |  | ||||||
|         }); |  | ||||||
|       }) |  | ||||||
|  |  | ||||||
|       area[2].forEach((item, index) => { |  | ||||||
|         that.viewer.entities.add({ |  | ||||||
|           polygon: { |  | ||||||
|             hierarchy: new Cesium.PolygonHierarchy(item), |  | ||||||
|             material: new Cesium.ImageMaterialProperty({ |  | ||||||
|               image: that.options.sideImage, |  | ||||||
|               transparent: true,// 如果图片有透明部分,需要设置为 true |  | ||||||
|               repeat: that.calculateTextureRepeat(item, myImg2) |  | ||||||
|             }), |  | ||||||
|             stRotation: that.calculateRoadAngle(positions[index], positions[index + 1]) |  | ||||||
|           } |  | ||||||
|         }); |  | ||||||
|       }) |  | ||||||
|  |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|   } |  | ||||||
|   getExtendPoint(position1, position2, distance) { |  | ||||||
|     // let position1 = Cesium.Cartesian3.fromDegrees(p1[0], p1[1], 0); |  | ||||||
|     // let position2 = Cesium.Cartesian3.fromDegrees(p2[0], p2[1], 0); |  | ||||||
|     let pot = Cesium.Cartesian3.subtract(position2, position1, new Cesium.Cartesian3());//方向 |  | ||||||
|     var dir = Cesium.Cartesian3.normalize(pot, new Cesium.Cartesian3());//向量归一化 |  | ||||||
|  |  | ||||||
|     var ray = new Cesium.Ray(position1, dir); |  | ||||||
|     let np = Cesium.Ray.getPoint(ray, distance * 10);//计算延长点 |  | ||||||
|     return np |  | ||||||
|   } |  | ||||||
|   getArr(arr1, arr2) { |  | ||||||
|     arr2 = arr2.reverse() |  | ||||||
|     let polygon = [] |  | ||||||
|     for (let index = 0; index < arr1.length - 1; index++) { |  | ||||||
|       polygon.push([arr1[index], arr1[index + 1], arr2[index + 1], arr2[index]]) |  | ||||||
|     } |  | ||||||
|     return polygon |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   calculateRoadAngle(startPoint, endPoint) { |  | ||||||
|     // 1. 获取地表法向量 |  | ||||||
|     const normal = Cesium.Ellipsoid.WGS84.geodeticSurfaceNormal(startPoint); |  | ||||||
|  |  | ||||||
|     // 2. 构建精确ENU坐标系 |  | ||||||
|     const enuMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(startPoint, undefined, normal); |  | ||||||
|     const inverseMatrix = Cesium.Matrix4.inverse(enuMatrix, new Cesium.Matrix4()); |  | ||||||
|  |  | ||||||
|     // 3. 转换终点并计算水平向量 |  | ||||||
|     const localEnd = Cesium.Matrix4.multiplyByPoint(inverseMatrix, endPoint, new Cesium.Cartesian3()); |  | ||||||
|     const horizontalVec = new Cesium.Cartesian2(localEnd.x, localEnd.y); |  | ||||||
|     Cesium.Cartesian2.normalize(horizontalVec, horizontalVec); |  | ||||||
|  |  | ||||||
|     const north = new Cesium.Cartesian2(1, 0); |  | ||||||
|  |  | ||||||
|     const angle = Cesium.Cartesian2.angleBetween(north, horizontalVec); |  | ||||||
|     const cross = Cesium.Cartesian2.cross(north, horizontalVec, new Cesium.Cartesian2()); |  | ||||||
|     return cross < 0 ? angle : -angle; |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   calculatePolygonOrientation(positions) { |  | ||||||
|  |  | ||||||
|     // 假设 position 是 Cesium.Cartesian3 对象,表示地球上的某个点 |  | ||||||
|     var position = positions[0] |  | ||||||
|     // 获取东、北、上坐标系 |  | ||||||
|     var eastNorthUp = Cesium.Transforms.eastNorthUpToFixedFrame(position); |  | ||||||
|     // northAxis 是北方向向量 |  | ||||||
|     var northAxis = eastNorthUp.getColumn(1, new Cesium.Cartesian3()); |  | ||||||
|     Cesium.Cartesian3.normalize(northAxis, northAxis); |  | ||||||
|  |  | ||||||
|     const direction = Cesium.Cartesian3.subtract(positions[0], positions[1], new Cesium.Cartesian3()); |  | ||||||
|     Cesium.Cartesian3.normalize(direction, direction); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     const dot = Cesium.Cartesian3.dot(northAxis, direction); |  | ||||||
|     const magA = Cesium.Cartesian3.magnitude(northAxis); |  | ||||||
|     const magB = Cesium.Cartesian3.magnitude(direction); |  | ||||||
|     return Math.acos(dot / (magA * magB)); |  | ||||||
|   } |  | ||||||
|   calculateTextureRepeat(polygonPositions, textureSize, meterPerPixel = 0.01) { |  | ||||||
|     // 验证纹理尺寸 |  | ||||||
|     if (!textureSize.width || !textureSize.height) { |  | ||||||
|       throw new Error('Texture size must contain width and height in pixels'); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     // 创建多边形几何体 |  | ||||||
|     const geometry = Cesium.PolygonGeometry.createGeometry( |  | ||||||
|       new Cesium.PolygonGeometry({ |  | ||||||
|         polygonHierarchy: new Cesium.PolygonHierarchy(polygonPositions), |  | ||||||
|         vertexFormat: Cesium.VertexFormat.POSITION_ONLY |  | ||||||
|       }) |  | ||||||
|     ); |  | ||||||
|  |  | ||||||
|     // 计算多边形面积(平方米) |  | ||||||
|     let area = 0; |  | ||||||
|     const indices = geometry.indices; |  | ||||||
|     const positions = geometry.attributes.position.values; |  | ||||||
|     for (let i = 0; i < indices.length; i += 3) { |  | ||||||
|       const i0 = indices[i] * 3; |  | ||||||
|       const i1 = indices[i + 1] * 3; |  | ||||||
|       const i2 = indices[i + 2] * 3; |  | ||||||
|  |  | ||||||
|       const p0 = new Cesium.Cartesian3(positions[i0], positions[i0 + 1], positions[i0 + 2]); |  | ||||||
|       const p1 = new Cesium.Cartesian3(positions[i1], positions[i1 + 1], positions[i1 + 2]); |  | ||||||
|       const p2 = new Cesium.Cartesian3(positions[i2], positions[i2 + 1], positions[i2 + 2]); |  | ||||||
|  |  | ||||||
|       const cross = Cesium.Cartesian3.cross( |  | ||||||
|         Cesium.Cartesian3.subtract(p1, p0, new Cesium.Cartesian3()), |  | ||||||
|         Cesium.Cartesian3.subtract(p2, p0, new Cesium.Cartesian3()), |  | ||||||
|         new Cesium.Cartesian3() |  | ||||||
|       ); |  | ||||||
|       area += Cesium.Cartesian3.magnitude(cross) * 0.5; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     // 将像素尺寸转换为实际尺寸(平方米) |  | ||||||
|     const textureWidthMeters = textureSize.width * meterPerPixel; |  | ||||||
|     const textureHeightMeters = textureSize.height * meterPerPixel; |  | ||||||
|     const textureArea = textureWidthMeters * textureHeightMeters; |  | ||||||
|  |  | ||||||
|     // 计算各轴向重复次数 |  | ||||||
|     const repeatX = Math.sqrt(area) / textureWidthMeters; |  | ||||||
|     const repeatY = Math.sqrt(area) / textureHeightMeters; |  | ||||||
|  |  | ||||||
|     return new Cesium.Cartesian2(Math.max(1, Math.ceil(repeatX)), 1.0); |  | ||||||
|   } |  | ||||||
|   swapLastElements(arr1, arr2) { |  | ||||||
|     const last = arr1[arr1.length - 1] |  | ||||||
|     const first = arr2[0] |  | ||||||
|     arr1[arr1.length - 1] = first |  | ||||||
|     arr2[0] = last |  | ||||||
|  |  | ||||||
|     return [arr1, arr2]; |  | ||||||
|   } |  | ||||||
|   createLineBufferPolygonSide(positions, width) { |  | ||||||
|     let area = [] |  | ||||||
|     for (let i = 0; i < positions.length; i++) { |  | ||||||
|       const posi = positions[i]; |  | ||||||
|  |  | ||||||
|       const dir = Cesium.Cartesian3.subtract(posi[1], posi[0], new Cesium.Cartesian3()); |  | ||||||
|       Cesium.Cartesian3.normalize(dir, dir); |  | ||||||
|  |  | ||||||
|       // 获取垂直向量(基于Z轴) |  | ||||||
|       const perp = Cesium.Cartesian3.cross(dir, Cesium.Cartesian3.UNIT_Z, new Cesium.Cartesian3()); |  | ||||||
|       Cesium.Cartesian3.normalize(perp, perp); |  | ||||||
|  |  | ||||||
|       // 生成偏移向量 |  | ||||||
|       const offset = Cesium.Cartesian3.multiplyByScalar(perp, width, new Cesium.Cartesian3()); |  | ||||||
|       let point1 = Cesium.Cartesian3.add(posi[0], offset, new Cesium.Cartesian3()) |  | ||||||
|       let point3 = Cesium.Cartesian3.add(posi[1], offset, new Cesium.Cartesian3()) |  | ||||||
|  |  | ||||||
|       // i == positions.length - 2 ? area.push(start, point1, end, point3) : area.push(start, point1) |  | ||||||
|       area.push([posi[0], point1, point3, posi[1]]) |  | ||||||
|     } |  | ||||||
|     // let arr = [] |  | ||||||
|     // for (let i = 0; i < area.length - 2; i += 2) { |  | ||||||
|     //   arr.push([area[i], area[i + 1], area[i + 3], area[i + 2]]) |  | ||||||
|     // } |  | ||||||
|     return area |  | ||||||
|   } |  | ||||||
|   createLineBufferPolygon2(positions, width) { |  | ||||||
|     let area = [] |  | ||||||
|     let leftPositions = []; |  | ||||||
|     let rightPositions = []; |  | ||||||
|  |  | ||||||
|     for (let i = 0; i < positions.length - 1; i++) { |  | ||||||
|       const start = positions[i]; |  | ||||||
|       // const end = positions[i + 1] || positions[i - 1]; |  | ||||||
|       const end = positions[i + 1]; |  | ||||||
|  |  | ||||||
|       const dir = Cesium.Cartesian3.subtract(end, start, new Cesium.Cartesian3()); |  | ||||||
|       Cesium.Cartesian3.normalize(dir, dir); |  | ||||||
|  |  | ||||||
|       // 获取垂直向量(基于Z轴) |  | ||||||
|       const perp = Cesium.Cartesian3.cross(dir, Cesium.Cartesian3.UNIT_Z, new Cesium.Cartesian3()); |  | ||||||
|       Cesium.Cartesian3.normalize(perp, perp); |  | ||||||
|  |  | ||||||
|       const dir2 = Cesium.Cartesian3.subtract(start, end, new Cesium.Cartesian3()); |  | ||||||
|       Cesium.Cartesian3.normalize(dir2, dir2); |  | ||||||
|  |  | ||||||
|       // 获取垂直向量(基于Z轴) |  | ||||||
|       const perp2 = Cesium.Cartesian3.cross(dir2, Cesium.Cartesian3.UNIT_Z, new Cesium.Cartesian3()); |  | ||||||
|       Cesium.Cartesian3.normalize(perp2, perp2); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|       // 生成偏移向量 |  | ||||||
|       const offset = Cesium.Cartesian3.multiplyByScalar(perp, width, new Cesium.Cartesian3()); |  | ||||||
|       const offset2 = Cesium.Cartesian3.multiplyByScalar(perp, -width, new Cesium.Cartesian3()); |  | ||||||
|  |  | ||||||
|       const offsetEnd = Cesium.Cartesian3.multiplyByScalar(perp2, -width, new Cesium.Cartesian3()); |  | ||||||
|       const offsetEnd2 = Cesium.Cartesian3.multiplyByScalar(perp2, width, new Cesium.Cartesian3()); |  | ||||||
|  |  | ||||||
|       let point1 = Cesium.Cartesian3.add(start, offset, new Cesium.Cartesian3()) |  | ||||||
|       let point2 = Cesium.Cartesian3.add(start, offset2, new Cesium.Cartesian3()) |  | ||||||
|       let point3 = Cesium.Cartesian3.add(end, offsetEnd, new Cesium.Cartesian3()) |  | ||||||
|       let point4 = Cesium.Cartesian3.add(end, offsetEnd2, new Cesium.Cartesian3()) |  | ||||||
|  |  | ||||||
|       area.push([point1, point3, point4, point2]) |  | ||||||
|  |  | ||||||
|       rightPositions.push([point1, point3]) |  | ||||||
|       leftPositions.push([point2, point4]) |  | ||||||
|  |  | ||||||
|       // if (i == positions.length - 2) { |  | ||||||
|       //   area.push(point1, point2, point3, point4) |  | ||||||
|       //   rightPositions.push(point1) |  | ||||||
|       //   leftPositions.push(point2) |  | ||||||
|       //   leftPositions.push(point4) |  | ||||||
|       //   rightPositions.push(point3) |  | ||||||
|       // } else { |  | ||||||
|       //   area.push(point1, point2) |  | ||||||
|       //   rightPositions.push(point1) |  | ||||||
|       //   leftPositions.push(point2) |  | ||||||
|       // } |  | ||||||
|     } |  | ||||||
|     // let arr = [] |  | ||||||
|     // for (let i = 0; i < area.length - 2; i += 2) { |  | ||||||
|     //   arr.push([area[i], area[i + 1], area[i + 3], area[i + 2]]) |  | ||||||
|     // } |  | ||||||
|     console.log(area, rightPositions, 'rightPositions') |  | ||||||
|     let that = this |  | ||||||
|     // return [arr, rightPositions, leftPositions] |  | ||||||
|     return [area, rightPositions, leftPositions] |  | ||||||
|   } |  | ||||||
|   getIntersects(point1, point2, point3, point4) { |  | ||||||
|     let carPoint1 = this.getLonLat(point1) |  | ||||||
|     let carPoint2 = this.getLonLat(point2) |  | ||||||
|     let carPoint3 = this.getLonLat(point3) |  | ||||||
|     let carPoint4 = this.getLonLat(point4) |  | ||||||
|     var line1 = turf.lineString([ |  | ||||||
|       [carPoint1.lon, carPoint1.lat], |  | ||||||
|       [carPoint2.lon, carPoint2.lat] |  | ||||||
|     ]); |  | ||||||
|     var line2 = turf.lineString([ |  | ||||||
|       [carPoint3.lon, carPoint3.lat], |  | ||||||
|       [carPoint4.lon, carPoint4.lat] |  | ||||||
|     ]); |  | ||||||
|     var intersects = turf.lineIntersect(line1, line2); |  | ||||||
|     if (intersects.features.length > 0) { |  | ||||||
|       console.log(intersects.features, 'ooooo') |  | ||||||
|       return Cesium.Cartesian3.fromDegrees(intersects.features[0].geometry.coordinates[0], intersects.features[0].geometry.coordinates[1]) |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|   getLonLat(point) { |  | ||||||
|     let pointDe = Cesium.Cartographic.fromCartesian(point) |  | ||||||
|     const longitude = Cesium.Math.toDegrees(pointDe.longitude); |  | ||||||
|     const latitude = Cesium.Math.toDegrees(pointDe.latitude); |  | ||||||
|     return { lon: longitude, lat: latitude } |  | ||||||
|  |  | ||||||
|   } |  | ||||||
|   createLineBufferPolygon(viewer, positions, width) { |  | ||||||
|     // 计算每个线段的左右偏移点 |  | ||||||
|     const leftPositions = []; |  | ||||||
|     const rightPositions = []; |  | ||||||
|  |  | ||||||
|     for (let i = 0; i < positions.length; i++) { |  | ||||||
|       const start = positions[i]; |  | ||||||
|       const end = positions[i + 1] || positions[i - 1]; |  | ||||||
|  |  | ||||||
|       // 计算线段方向向量 |  | ||||||
|       const direction = Cesium.Cartesian3.subtract(end, start, new Cesium.Cartesian3()); |  | ||||||
|       // const direction = Cesium.Cartesian3.subtract(start, end, new Cesium.Cartesian3()); |  | ||||||
|       Cesium.Cartesian3.normalize(direction, direction); |  | ||||||
|  |  | ||||||
|       // 计算垂直向量(使用上向量叉积) |  | ||||||
|       const up = Cesium.Cartesian3.UNIT_Z; |  | ||||||
|       const perpendicular = Cesium.Cartesian3.cross(direction, up, new Cesium.Cartesian3()); |  | ||||||
|       Cesium.Cartesian3.normalize(perpendicular, perpendicular); |  | ||||||
|  |  | ||||||
|       // 计算左右偏移点 |  | ||||||
|       const leftOffset = Cesium.Cartesian3.multiplyByScalar( |  | ||||||
|         perpendicular, |  | ||||||
|         width, |  | ||||||
|         new Cesium.Cartesian3() |  | ||||||
|       ); |  | ||||||
|  |  | ||||||
|       if (width > 0) { |  | ||||||
|         rightPositions.unshift(Cesium.Cartesian3.add(start, leftOffset, new Cesium.Cartesian3())); |  | ||||||
|       } else if (width < 0) { |  | ||||||
|         rightPositions.push(Cesium.Cartesian3.add(start, leftOffset, new Cesium.Cartesian3())); |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|     } |  | ||||||
|     return rightPositions |  | ||||||
|   } |  | ||||||
|   //计算角度 |  | ||||||
|   calculateAangle(arr) { |  | ||||||
|     // let fromDegreesArray = that.calSector(that.options.center, that.options.radius, that.options.startAngle, that.options.endAngle, 360, true) |  | ||||||
|  |  | ||||||
|     function getAangle(start, end) { |  | ||||||
|       let rad = Math.PI / 180, |  | ||||||
|         lat1 = start.y * rad, |  | ||||||
|         lat2 = end.y * rad, |  | ||||||
|         lon1 = start.x * rad, |  | ||||||
|         lon2 = end.x * rad; |  | ||||||
|       const a = Math.sin(lon2 - lon1) * Math.cos(lat2); |  | ||||||
|       const b = |  | ||||||
|         Math.cos(lat1) * Math.sin(lat2) - |  | ||||||
|         Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon2 - lon1); |  | ||||||
|       const radians = Math.atan2(a, b) |  | ||||||
|       const degrees = radians % (2 * Math.PI); |  | ||||||
|       let bearing = 450 - ((degrees * 180) / Math.PI < 0 |  | ||||||
|         ? 360 + (degrees * 180) / Math.PI |  | ||||||
|         : (degrees * 180) / Math.PI) - 90; |  | ||||||
|       return 360 - (bearing % 360) |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     let center = arr[0] |  | ||||||
|     let pos84_1 = arr[1] |  | ||||||
|     let pos84_2 = arr[2] |  | ||||||
|  |  | ||||||
|     let start = { x: center.lng, y: center.lat } |  | ||||||
|     let end1 = { x: pos84_1.lng, y: pos84_1.lat } |  | ||||||
|     let end2 = { x: pos84_2.lng, y: pos84_2.lat } |  | ||||||
|  |  | ||||||
|     let angle1 = getAangle(start, end1) |  | ||||||
|     let angle2 = getAangle(start, end2) |  | ||||||
|  |  | ||||||
|     return { |  | ||||||
|       angle1, |  | ||||||
|       angle2 |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   get carRoadWidth() { |  | ||||||
|     return this.options.carRoadWidth |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   set carRoadWidth(v) { |  | ||||||
|     this.options.carRoadWidth = v |  | ||||||
|     Road.create(this) |  | ||||||
|  |  | ||||||
|   } |  | ||||||
|   get sideWidth() { |  | ||||||
|     return this.options.sideWidth |  | ||||||
|   } |  | ||||||
|   set sideWidth(v) { |  | ||||||
|     this.options.sideWidth = v |  | ||||||
|     Road.create(this) |  | ||||||
|   } |  | ||||||
|   /** |  | ||||||
|    * @description 编辑框 |  | ||||||
|    * @param state=false {boolean} 状态: true打开, false关闭 |  | ||||||
|    */ |  | ||||||
|   async edit(state = false) { |  | ||||||
|     let _this = this |  | ||||||
|     this.originalOptions = this.deepCopyObj(this.options) |  | ||||||
|  |  | ||||||
|     if (this._DialogObject && this._DialogObject.close) { |  | ||||||
|       this._DialogObject.close() |  | ||||||
|       this._DialogObject = null |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     if (state) { |  | ||||||
|       this._DialogObject = await new Dialog(this.sdk, this.originalOptions, { |  | ||||||
|         title: '道路属性', left: '180px', top: '100px', |  | ||||||
|         confirmCallBack: (options) => { |  | ||||||
|           this.name = this.name.trim() |  | ||||||
|           if (!this.name) { |  | ||||||
|             this.name = '道路' |  | ||||||
|           } |  | ||||||
|           this.originalOptions = this.deepCopyObj(this.options) |  | ||||||
|           this._DialogObject.close() |  | ||||||
|           this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(this.originalOptions) |  | ||||||
|           syncData(this.sdk, this.options.id) |  | ||||||
|           syncSplitData(this.sdk, this.options.id) |  | ||||||
|         }, |  | ||||||
|         resetCallBack: () => { |  | ||||||
|           this.reset() |  | ||||||
|           this.Dialog.resetCallBack && this.Dialog.resetCallBack() |  | ||||||
|         }, |  | ||||||
|         closeCallBack: () => { |  | ||||||
|           this.reset() |  | ||||||
|           this.Dialog.closeCallBack && this.Dialog.closeCallBack() |  | ||||||
|         }, |  | ||||||
|         showCallBack: (show) => { |  | ||||||
|           this.show = show |  | ||||||
|           this.Dialog.showCallBack && this.Dialog.showCallBack() |  | ||||||
|         } |  | ||||||
|       }, true) |  | ||||||
|       this._DialogObject._element.body.className = this._DialogObject._element.body.className + ' road-surface' |  | ||||||
|       let contentElm = document.createElement('div'); |  | ||||||
|       contentElm.innerHTML = html() |  | ||||||
|       this._DialogObject.contentAppChild(contentElm) |  | ||||||
|  |  | ||||||
|  |  | ||||||
|       // 下拉选项 |  | ||||||
|       // let heightModeData = [ |  | ||||||
|       //   { |  | ||||||
|       //     name: '海拔高度', |  | ||||||
|       //     value: '海拔高度', |  | ||||||
|       //     key: '0', |  | ||||||
|       //   }, |  | ||||||
|       //   { |  | ||||||
|       //     name: '相对地表', |  | ||||||
|       //     value: '相对地表', |  | ||||||
|       //     key: '1', |  | ||||||
|       //   }, |  | ||||||
|       //   { |  | ||||||
|       //     name: '依附模型', |  | ||||||
|       //     value: '依附模型', |  | ||||||
|       //     key: '2', |  | ||||||
|       //   } |  | ||||||
|       // ] |  | ||||||
|       // let heightModeObject = legp( |  | ||||||
|       //   this._DialogObject._element.content.getElementsByClassName( |  | ||||||
|       //     'road-box' |  | ||||||
|       //   )[0], |  | ||||||
|       //   '.road-type' |  | ||||||
|       // ) |  | ||||||
|       // if (heightModeObject) { |  | ||||||
|       //   heightModeObject.legp_search(heightModeData) |  | ||||||
|       //   let heightModeDataLegpElm = this._DialogObject._element.content |  | ||||||
|       //     .getElementsByClassName('road-type')[0] |  | ||||||
|       //     .getElementsByTagName('input')[0] |  | ||||||
|       //   for (let i = 0; i < heightModeData.length; i++) { |  | ||||||
|       //     if (heightModeData[i].key == this.heightMode) { |  | ||||||
|       //       heightModeDataLegpElm.value = heightModeData[i].value |  | ||||||
|       //       heightModeObject.legp_searchActive( |  | ||||||
|       //         heightModeData[i].value |  | ||||||
|       //       ) |  | ||||||
|       //       break |  | ||||||
|       //     } |  | ||||||
|       //   } |  | ||||||
|       //   heightModeDataLegpElm.addEventListener('input', () => { |  | ||||||
|       //     for (let i = 0; i < heightModeData.length; i++) { |  | ||||||
|       //       if (heightModeData[i].value === heightModeDataLegpElm.value) { |  | ||||||
|       //         this.heightMode = heightModeData[i].key |  | ||||||
|       //         break |  | ||||||
|       //       } |  | ||||||
|       //     } |  | ||||||
|       //   }) |  | ||||||
|  |  | ||||||
|  |  | ||||||
|       //   this._elms.height = heightElm |  | ||||||
|       //   this._elms.heightBox = heightBoxElm |  | ||||||
|       //   this._elms.heightMode = heightModeDataLegpElm |  | ||||||
|       //   this._elms.heightConfirm = heightConfirmElm |  | ||||||
|       //   this._elms.heightModeObject = heightModeObject |  | ||||||
|  |  | ||||||
|       //   heightConfirmElm.addEventListener('click', () => { |  | ||||||
|       //     this.positionEditing = false |  | ||||||
|       //     for (let i = 0; i < this.options.positions.length; i++) { |  | ||||||
|       //       this.options.positions[i].alt = Number((this.options.positions[i].alt + Number(heightElm.value)).toFixed(2)) |  | ||||||
|       //       this._elms.alt[i].innerHTML = this.options.positions[i].alt |  | ||||||
|       //     } |  | ||||||
|       //     let fromDegreesArray = this.renewPositions(this.options.positions) |  | ||||||
|       //     this.entity.polyline.positions = Cesium.Cartesian3.fromDegreesArrayHeights( |  | ||||||
|       //       fromDegreesArray |  | ||||||
|       //     ) |  | ||||||
|  |  | ||||||
|       //     this.positionEditing = false |  | ||||||
|       //     PolylineObject.closeNodeEdit(this) |  | ||||||
|       //   }) |  | ||||||
|       // } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|       let all_elm = contentElm.getElementsByTagName("*") |  | ||||||
|       this._EventBinding.on(this, all_elm) |  | ||||||
|       this._elms = this._EventBinding.element |  | ||||||
|     } else { |  | ||||||
|       // if (this._element_style) { |  | ||||||
|       //   document.getElementsByTagName('head')[0].removeChild(this._element_style) |  | ||||||
|       //   this._element_style = null |  | ||||||
|       // } |  | ||||||
|       // if (this._DialogObject && this._DialogObject.remove) { |  | ||||||
|       //   this._DialogObject.remove() |  | ||||||
|       //   this._DialogObject = null |  | ||||||
|       // } |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   reset() { |  | ||||||
|     if (!this.viewer.entities.getById(this.options.id)) { |  | ||||||
|       return |  | ||||||
|     } |  | ||||||
|     this.name = this.originalOptions.name |  | ||||||
|     this.carRoadWidth = this.originalOptions.carRoadWidth |  | ||||||
|     this.sideWidth = this.originalOptions.sideWidth |  | ||||||
|     this.positions = this.originalOptions.positions |  | ||||||
|     this.roadImage = this.originalOptions.roadImage |  | ||||||
|     this.sideImage = this.originalOptions.sideImage |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   /** |  | ||||||
|    * 飞到对应实体 |  | ||||||
|    */ |  | ||||||
|   async flyTo(options = {}) { |  | ||||||
|     setActiveViewer(0) |  | ||||||
|     closeRotateAround(this.sdk) |  | ||||||
|     closeViewFollow(this.sdk) |  | ||||||
|  |  | ||||||
|     if (this.options.customView && this.options.customView.relativePosition && this.options.customView.orientation) { |  | ||||||
|       let orientation = { |  | ||||||
|         heading: Cesium.Math.toRadians(this.options.customView.orientation.heading || 0.0), |  | ||||||
|         pitch: Cesium.Math.toRadians(this.options.customView.orientation.pitch || -60.0), |  | ||||||
|         roll: Cesium.Math.toRadians(this.options.customView.orientation.roll || 0.0) |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|       let lng = this.options.customView.relativePosition.lng |  | ||||||
|       let lat = this.options.customView.relativePosition.lat |  | ||||||
|       let alt = this.options.customView.relativePosition.alt |  | ||||||
|       let destination = Cesium.Cartesian3.fromDegrees(lng, lat, alt) |  | ||||||
|  |  | ||||||
|       let position = { lng: 0, lat: 0 } |  | ||||||
|       if (this.options.position) { |  | ||||||
|         position = { ...this.options.position } |  | ||||||
|       } |  | ||||||
|       else if (this.options.positions) { |  | ||||||
|         position = { ...this.options.positions[0] } |  | ||||||
|       } |  | ||||||
|       else if (this.options.center) { |  | ||||||
|         position = { ...this.options.center } |  | ||||||
|       } |  | ||||||
|       else if (this.options.start) { |  | ||||||
|         position = { ...this.options.start } |  | ||||||
|       } |  | ||||||
|       else { |  | ||||||
|         if (this.options.hasOwnProperty('lng')) { |  | ||||||
|           position.lng = this.options.lng |  | ||||||
|         } |  | ||||||
|         if (this.options.hasOwnProperty('lat')) { |  | ||||||
|           position.lat = this.options.lat |  | ||||||
|         } |  | ||||||
|         if (this.options.hasOwnProperty('alt')) { |  | ||||||
|           position.alt = this.options.alt |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|       // 如果没有高度值,则获取紧贴高度计算 |  | ||||||
|       // if (!position.hasOwnProperty('alt')) { |  | ||||||
|       //   position.alt = await this.getClampToHeight(position) |  | ||||||
|       // } |  | ||||||
|       lng = this.options.customView.relativePosition.lng + position.lng |  | ||||||
|       lat = this.options.customView.relativePosition.lat + position.lat |  | ||||||
|       alt = this.options.customView.relativePosition.alt + position.alt |  | ||||||
|       destination = Cesium.Cartesian3.fromDegrees(lng, lat, alt) |  | ||||||
|       this.sdk.viewer.camera.flyTo({ |  | ||||||
|         destination: destination, |  | ||||||
|         orientation: orientation |  | ||||||
|       }) |  | ||||||
|     } |  | ||||||
|     else { |  | ||||||
|       let positionArray = [] |  | ||||||
|       for (let i = 0; i < this.positions.length; i++) { |  | ||||||
|         let a = Cesium.Cartesian3.fromDegrees( |  | ||||||
|           this.positions[i][0], |  | ||||||
|           this.positions[i][1], |  | ||||||
|           this.options.height + this.options.heightDifference / 2 |  | ||||||
|         ) |  | ||||||
|         positionArray.push(a.x, a.y, a.z) |  | ||||||
|       } |  | ||||||
|       let BoundingSphere = Cesium.BoundingSphere.fromVertices(positionArray) |  | ||||||
|       this.viewer.camera.flyToBoundingSphere(BoundingSphere, { |  | ||||||
|         offset: { |  | ||||||
|           heading: Cesium.Math.toRadians(0.0), |  | ||||||
|           pitch: Cesium.Math.toRadians(-20.0), |  | ||||||
|           roll: Cesium.Math.toRadians(0.0) |  | ||||||
|         } |  | ||||||
|       }) |  | ||||||
|  |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   getSphere() { |  | ||||||
|     return new Promise((resolve) => { |  | ||||||
|       // entity没有加载完成时 state 不会等于0 所以设置定时器直到获取到为止 |  | ||||||
|       const interval = setInterval(() => { |  | ||||||
|         const sphere = new Cesium.BoundingSphere() |  | ||||||
|         const state = this.sdk.viewer._dataSourceDisplay.getBoundingSphere( |  | ||||||
|           this.viewer.entities.getById(this.options.id), |  | ||||||
|           false, |  | ||||||
|           sphere |  | ||||||
|         ) |  | ||||||
|         if (state === Cesium.BoundingSphereState.DONE) { |  | ||||||
|           clearInterval(interval) |  | ||||||
|         } |  | ||||||
|       }, 1000) |  | ||||||
|     }) |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   /** |  | ||||||
|    * 删除 |  | ||||||
|    */ |  | ||||||
|   async remove() { |  | ||||||
|     this.positions = [] |  | ||||||
|     this.lineEntity = null |  | ||||||
|  |  | ||||||
|     if (this.viewer.entities.getById(this.options.id)) { |  | ||||||
|       this.viewer.entities.getById(this.options.id)._children.forEach((item) => { |  | ||||||
|         this.viewer.entities.remove(item); |  | ||||||
|       }); |  | ||||||
|       this.viewer.entities.remove(this.viewer.entities.getById(this.options.id)) |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     if (this._DialogObject && !this._DialogObject.isDestroy) { |  | ||||||
|       this._DialogObject.close() |  | ||||||
|       this._DialogObject = null |  | ||||||
|     } |  | ||||||
|     await this.sdk.removeIncetance(this.options.id) |  | ||||||
|     await syncData(this.sdk, this.options.id) |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   flicker() { } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| export default Road |  | ||||||
| @ -1,615 +0,0 @@ | |||||||
| /** |  | ||||||
|  * @description 道路 |  | ||||||
|  */ |  | ||||||
| import Dialog from '../../Element/Dialog'; |  | ||||||
| import { html } from "./_element"; |  | ||||||
| import EventBinding from '../../Element/Dialog/eventBinding'; |  | ||||||
| import Base from "../index"; |  | ||||||
| import { syncData } from '../../../Global/MultiViewportMode' |  | ||||||
| import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen' |  | ||||||
| import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global' |  | ||||||
|  |  | ||||||
| class Road extends Base { |  | ||||||
|   /** |  | ||||||
|    * @constructor |  | ||||||
|    * @param sdk |  | ||||||
|    * @description 道路 |  | ||||||
|    * @param options {object} 道路属性 |  | ||||||
|    * @param options.name=未命名对象 {string} 名称 |  | ||||||
|    * @param options.carRoadWidth=2 {number} 车道宽度 |  | ||||||
|    * @param options.sideWidth=2 {number} 人行道宽度 |  | ||||||
|    * @param options.positions=[] {array} 道路positions |  | ||||||
|    * @param options.roadImage='' {string} 车道贴图 |  | ||||||
|    * @param options.sideImage='' {string} 人行道贴图 |  | ||||||
|    * @param Dialog {object} 弹框对象 |  | ||||||
|    * @param Dialog.confirmCallBack {function} 弹框确认时的回调 |  | ||||||
|    * */ |  | ||||||
|   constructor(sdk, options = {}, _Dialog = {}) { |  | ||||||
|     super(sdk, options); |  | ||||||
|     this.viewer = this.sdk.viewer |  | ||||||
|     this.options.name = options.name || '道路' |  | ||||||
|     this.options.carRoadWidth = options.carRoadWidth || 10 |  | ||||||
|     this.options.sideWidth = options.sideWidth || 5 |  | ||||||
|     this.options.positions = options.positions || [] |  | ||||||
|     this.options.roadImage = options.roadImage || (this.getSourceRootPath() + '/img/roadPhoto.png') |  | ||||||
|     this.options.sideImage = options.sideImage || (this.getSourceRootPath() + '/img/sidePhoto.png') |  | ||||||
|     this.options.show = (options.show || options.show === false) ? options.show : true |  | ||||||
|     this.Dialog = _Dialog |  | ||||||
|     this._EventBinding = new EventBinding() |  | ||||||
|     this._elms = {}; |  | ||||||
|     this.positionArea = [] |  | ||||||
|     this.positions = [] |  | ||||||
|     this.lineEntity = '' |  | ||||||
|  |  | ||||||
|     this.sdk.addIncetance(this.options.id, this) |  | ||||||
|     Road.create(this) |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   // 创建道路 |  | ||||||
|   static create(that) { |  | ||||||
|     let positions = [] |  | ||||||
|     that.options.positions.forEach(v => { |  | ||||||
|       positions.push(new Cesium.Cartesian3.fromDegrees(v.lng, v.lat, v.alt)) |  | ||||||
|     }) |  | ||||||
|  |  | ||||||
|     let area = [[], [], []] |  | ||||||
|     area[1] = that.createLineBufferPolygon2(positions, that.options.carRoadWidth / 2) |  | ||||||
|     area[0] = that.createLineBufferPolygonSide(area[1][2], -that.options.sideWidth) |  | ||||||
|     area[2] = that.createLineBufferPolygonSide(area[1][1], that.options.sideWidth) |  | ||||||
|  |  | ||||||
|     if (that.viewer.entities.getById(that.options.id)) { |  | ||||||
|       that.viewer.entities.getById(that.options.id)._children.forEach((item) => { |  | ||||||
|         that.viewer.entities.remove(item); |  | ||||||
|       }); |  | ||||||
|       that.viewer.entities.remove(that.viewer.entities.getById(that.options.id)) |  | ||||||
|     } |  | ||||||
|     that.lineEntity = that.viewer.entities.add(new Cesium.Entity({ id: that.options.id, show: that.options.show })) |  | ||||||
|  |  | ||||||
|     const myImg = new Image() |  | ||||||
|     myImg.src = that.options.roadImage |  | ||||||
|     myImg.onload = function () { |  | ||||||
|       area[1][0].forEach((item, index) => { |  | ||||||
|         that.viewer.entities.add({ |  | ||||||
|           // id: that.options.id, |  | ||||||
|           parent: that.lineEntity, |  | ||||||
|           polygon: { |  | ||||||
|             hierarchy: new Cesium.PolygonHierarchy(item), |  | ||||||
|             material: new Cesium.ImageMaterialProperty({ |  | ||||||
|               image: that.options.roadImage, |  | ||||||
|               transparent: true,// 如果图片有透明部分,需要设置为 true |  | ||||||
|               repeat: that.calculateTextureRepeat(item, myImg) |  | ||||||
|             }), |  | ||||||
|             stRotation: that.calculateRoadAngle(positions[index], positions[index + 1]) |  | ||||||
|           } |  | ||||||
|         }); |  | ||||||
|       }) |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     const myImg2 = new Image() |  | ||||||
|     myImg2.src = that.options.sideImage |  | ||||||
|     myImg2.onload = function () { |  | ||||||
|       area[0].forEach((item, index) => { |  | ||||||
|         that.viewer.entities.add({ |  | ||||||
|           parent: that.lineEntity, |  | ||||||
|           polygon: { |  | ||||||
|             hierarchy: new Cesium.PolygonHierarchy(item), |  | ||||||
|             material: new Cesium.ImageMaterialProperty({ |  | ||||||
|               image: that.options.sideImage, |  | ||||||
|               transparent: true,// 如果图片有透明部分,需要设置为 true |  | ||||||
|               repeat: that.calculateTextureRepeat(item, myImg2) |  | ||||||
|             }), |  | ||||||
|             stRotation: that.calculateRoadAngle(positions[index], positions[index + 1]) |  | ||||||
|           } |  | ||||||
|         }); |  | ||||||
|       }) |  | ||||||
|  |  | ||||||
|       area[2].forEach((item, index) => { |  | ||||||
|         that.viewer.entities.add({ |  | ||||||
|           polygon: { |  | ||||||
|             hierarchy: new Cesium.PolygonHierarchy(item), |  | ||||||
|             material: new Cesium.ImageMaterialProperty({ |  | ||||||
|               image: that.options.sideImage, |  | ||||||
|               transparent: true,// 如果图片有透明部分,需要设置为 true |  | ||||||
|               repeat: that.calculateTextureRepeat(item, myImg2) |  | ||||||
|             }), |  | ||||||
|             stRotation: that.calculateRoadAngle(positions[index], positions[index + 1]) |  | ||||||
|           } |  | ||||||
|         }); |  | ||||||
|       }) |  | ||||||
|  |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|   } |  | ||||||
|   getArr(arr1, arr2) { |  | ||||||
|     arr2 = arr2.reverse() |  | ||||||
|     let polygon = [] |  | ||||||
|     for (let index = 0; index < arr1.length - 1; index++) { |  | ||||||
|       polygon.push([arr1[index], arr1[index + 1], arr2[index + 1], arr2[index]]) |  | ||||||
|     } |  | ||||||
|     return polygon |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   calculateRoadAngle(startPoint, endPoint) { |  | ||||||
|     // 1. 获取地表法向量 |  | ||||||
|     const normal = Cesium.Ellipsoid.WGS84.geodeticSurfaceNormal(startPoint); |  | ||||||
|  |  | ||||||
|     // 2. 构建精确ENU坐标系 |  | ||||||
|     const enuMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(startPoint, undefined, normal); |  | ||||||
|     const inverseMatrix = Cesium.Matrix4.inverse(enuMatrix, new Cesium.Matrix4()); |  | ||||||
|  |  | ||||||
|     // 3. 转换终点并计算水平向量 |  | ||||||
|     const localEnd = Cesium.Matrix4.multiplyByPoint(inverseMatrix, endPoint, new Cesium.Cartesian3()); |  | ||||||
|     const horizontalVec = new Cesium.Cartesian2(localEnd.x, localEnd.y); |  | ||||||
|     Cesium.Cartesian2.normalize(horizontalVec, horizontalVec); |  | ||||||
|  |  | ||||||
|     const north = new Cesium.Cartesian2(1, 0); |  | ||||||
|  |  | ||||||
|     const angle = Cesium.Cartesian2.angleBetween(north, horizontalVec); |  | ||||||
|     const cross = Cesium.Cartesian2.cross(north, horizontalVec, new Cesium.Cartesian2()); |  | ||||||
|     return cross < 0 ? angle : -angle; |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   calculatePolygonOrientation(positions) { |  | ||||||
|  |  | ||||||
|     // 假设 position 是 Cesium.Cartesian3 对象,表示地球上的某个点 |  | ||||||
|     var position = positions[0] |  | ||||||
|     // 获取东、北、上坐标系 |  | ||||||
|     var eastNorthUp = Cesium.Transforms.eastNorthUpToFixedFrame(position); |  | ||||||
|     // northAxis 是北方向向量 |  | ||||||
|     var northAxis = eastNorthUp.getColumn(1, new Cesium.Cartesian3()); |  | ||||||
|     Cesium.Cartesian3.normalize(northAxis, northAxis); |  | ||||||
|  |  | ||||||
|     const direction = Cesium.Cartesian3.subtract(positions[0], positions[1], new Cesium.Cartesian3()); |  | ||||||
|     Cesium.Cartesian3.normalize(direction, direction); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     const dot = Cesium.Cartesian3.dot(northAxis, direction); |  | ||||||
|     const magA = Cesium.Cartesian3.magnitude(northAxis); |  | ||||||
|     const magB = Cesium.Cartesian3.magnitude(direction); |  | ||||||
|     return Math.acos(dot / (magA * magB)); |  | ||||||
|   } |  | ||||||
|   calculateTextureRepeat(polygonPositions, textureSize, meterPerPixel = 0.01) { |  | ||||||
|     // 验证纹理尺寸 |  | ||||||
|     if (!textureSize.width || !textureSize.height) { |  | ||||||
|       throw new Error('Texture size must contain width and height in pixels'); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     // 创建多边形几何体 |  | ||||||
|     const geometry = Cesium.PolygonGeometry.createGeometry( |  | ||||||
|       new Cesium.PolygonGeometry({ |  | ||||||
|         polygonHierarchy: new Cesium.PolygonHierarchy(polygonPositions), |  | ||||||
|         vertexFormat: Cesium.VertexFormat.POSITION_ONLY |  | ||||||
|       }) |  | ||||||
|     ); |  | ||||||
|  |  | ||||||
|     // 计算多边形面积(平方米) |  | ||||||
|     let area = 0; |  | ||||||
|     const indices = geometry.indices; |  | ||||||
|     const positions = geometry.attributes.position.values; |  | ||||||
|     for (let i = 0; i < indices.length; i += 3) { |  | ||||||
|       const i0 = indices[i] * 3; |  | ||||||
|       const i1 = indices[i + 1] * 3; |  | ||||||
|       const i2 = indices[i + 2] * 3; |  | ||||||
|  |  | ||||||
|       const p0 = new Cesium.Cartesian3(positions[i0], positions[i0 + 1], positions[i0 + 2]); |  | ||||||
|       const p1 = new Cesium.Cartesian3(positions[i1], positions[i1 + 1], positions[i1 + 2]); |  | ||||||
|       const p2 = new Cesium.Cartesian3(positions[i2], positions[i2 + 1], positions[i2 + 2]); |  | ||||||
|  |  | ||||||
|       const cross = Cesium.Cartesian3.cross( |  | ||||||
|         Cesium.Cartesian3.subtract(p1, p0, new Cesium.Cartesian3()), |  | ||||||
|         Cesium.Cartesian3.subtract(p2, p0, new Cesium.Cartesian3()), |  | ||||||
|         new Cesium.Cartesian3() |  | ||||||
|       ); |  | ||||||
|       area += Cesium.Cartesian3.magnitude(cross) * 0.5; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     // 将像素尺寸转换为实际尺寸(平方米) |  | ||||||
|     const textureWidthMeters = textureSize.width * meterPerPixel; |  | ||||||
|     const textureHeightMeters = textureSize.height * meterPerPixel; |  | ||||||
|     const textureArea = textureWidthMeters * textureHeightMeters; |  | ||||||
|  |  | ||||||
|     // 计算各轴向重复次数 |  | ||||||
|     const repeatX = Math.sqrt(area) / textureWidthMeters; |  | ||||||
|     const repeatY = Math.sqrt(area) / textureHeightMeters; |  | ||||||
|  |  | ||||||
|     return new Cesium.Cartesian2(Math.max(1, Math.ceil(repeatX)), 1.0); |  | ||||||
|   } |  | ||||||
|   swapLastElements(arr1, arr2) { |  | ||||||
|     const last = arr1[arr1.length - 1] |  | ||||||
|     const first = arr2[0] |  | ||||||
|     arr1[arr1.length - 1] = first |  | ||||||
|     arr2[0] = last |  | ||||||
|  |  | ||||||
|     return [arr1, arr2]; |  | ||||||
|   } |  | ||||||
|   createLineBufferPolygonSide(positions, width) { |  | ||||||
|     let area = [] |  | ||||||
|     for (let i = 0; i < positions.length - 1; i++) { |  | ||||||
|       const start = positions[i]; |  | ||||||
|       const end = positions[i + 1]; |  | ||||||
|  |  | ||||||
|       const dir = Cesium.Cartesian3.subtract(end, start, new Cesium.Cartesian3()); |  | ||||||
|       Cesium.Cartesian3.normalize(dir, dir); |  | ||||||
|  |  | ||||||
|       // 获取垂直向量(基于Z轴) |  | ||||||
|       const perp = Cesium.Cartesian3.cross(dir, Cesium.Cartesian3.UNIT_Z, new Cesium.Cartesian3()); |  | ||||||
|       Cesium.Cartesian3.normalize(perp, perp); |  | ||||||
|  |  | ||||||
|       // 生成偏移向量 |  | ||||||
|       const offset = Cesium.Cartesian3.multiplyByScalar(perp, width, new Cesium.Cartesian3()); |  | ||||||
|       let point1 = Cesium.Cartesian3.add(start, offset, new Cesium.Cartesian3()) |  | ||||||
|       let point3 = Cesium.Cartesian3.add(end, offset, new Cesium.Cartesian3()) |  | ||||||
|  |  | ||||||
|       i == positions.length - 2 ? area.push(start, point1, end, point3) : area.push(start, point1) |  | ||||||
|     } |  | ||||||
|     let arr = [] |  | ||||||
|     for (let i = 0; i < area.length - 2; i += 2) { |  | ||||||
|       arr.push([area[i], area[i + 1], area[i + 3], area[i + 2]]) |  | ||||||
|     } |  | ||||||
|     return arr |  | ||||||
|   } |  | ||||||
|   createLineBufferPolygon2(positions, width) { |  | ||||||
|     let area = [] |  | ||||||
|     let leftPositions = []; |  | ||||||
|     let rightPositions = []; |  | ||||||
|  |  | ||||||
|     for (let i = 0; i < positions.length - 1; i++) { |  | ||||||
|       const start = positions[i]; |  | ||||||
|       // const end = positions[i + 1] || positions[i - 1]; |  | ||||||
|       const end = positions[i + 1]; |  | ||||||
|  |  | ||||||
|       const dir = Cesium.Cartesian3.subtract(end, start, new Cesium.Cartesian3()); |  | ||||||
|       Cesium.Cartesian3.normalize(dir, dir); |  | ||||||
|  |  | ||||||
|       // 获取垂直向量(基于Z轴) |  | ||||||
|       const perp = Cesium.Cartesian3.cross(dir, Cesium.Cartesian3.UNIT_Z, new Cesium.Cartesian3()); |  | ||||||
|       Cesium.Cartesian3.normalize(perp, perp); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|       // 生成偏移向量 |  | ||||||
|       const offset = Cesium.Cartesian3.multiplyByScalar(perp, width, new Cesium.Cartesian3()); |  | ||||||
|       const offset2 = Cesium.Cartesian3.multiplyByScalar(perp, -width, new Cesium.Cartesian3()); |  | ||||||
|       let point1 = Cesium.Cartesian3.add(start, offset, new Cesium.Cartesian3()) |  | ||||||
|       let point2 = Cesium.Cartesian3.add(start, offset2, new Cesium.Cartesian3()) |  | ||||||
|       let point3 = Cesium.Cartesian3.add(end, offset, new Cesium.Cartesian3()) |  | ||||||
|       let point4 = Cesium.Cartesian3.add(end, offset2, new Cesium.Cartesian3()) |  | ||||||
|  |  | ||||||
|       if (i == positions.length - 2) { |  | ||||||
|         area.push(point1, point2, point3, point4) |  | ||||||
|         rightPositions.push(point1) |  | ||||||
|         leftPositions.push(point2) |  | ||||||
|         leftPositions.push(point4) |  | ||||||
|         rightPositions.push(point3) |  | ||||||
|       } else { |  | ||||||
|         area.push(point1, point2) |  | ||||||
|         rightPositions.push(point1) |  | ||||||
|         leftPositions.push(point2) |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|     let arr = [] |  | ||||||
|     for (let i = 0; i < area.length - 2; i += 2) { |  | ||||||
|       arr.push([area[i], area[i + 1], area[i + 3], area[i + 2]]) |  | ||||||
|     } |  | ||||||
|     return [arr, rightPositions, leftPositions] |  | ||||||
|   } |  | ||||||
|   createLineBufferPolygon(viewer, positions, width) { |  | ||||||
|     // 计算每个线段的左右偏移点 |  | ||||||
|     const leftPositions = []; |  | ||||||
|     const rightPositions = []; |  | ||||||
|  |  | ||||||
|     for (let i = 0; i < positions.length; i++) { |  | ||||||
|       const start = positions[i]; |  | ||||||
|       const end = positions[i + 1] || positions[i - 1]; |  | ||||||
|  |  | ||||||
|       // 计算线段方向向量 |  | ||||||
|       const direction = Cesium.Cartesian3.subtract(end, start, new Cesium.Cartesian3()); |  | ||||||
|       // const direction = Cesium.Cartesian3.subtract(start, end, new Cesium.Cartesian3()); |  | ||||||
|       Cesium.Cartesian3.normalize(direction, direction); |  | ||||||
|  |  | ||||||
|       // 计算垂直向量(使用上向量叉积) |  | ||||||
|       const up = Cesium.Cartesian3.UNIT_Z; |  | ||||||
|       const perpendicular = Cesium.Cartesian3.cross(direction, up, new Cesium.Cartesian3()); |  | ||||||
|       Cesium.Cartesian3.normalize(perpendicular, perpendicular); |  | ||||||
|  |  | ||||||
|       // 计算左右偏移点 |  | ||||||
|       const leftOffset = Cesium.Cartesian3.multiplyByScalar( |  | ||||||
|         perpendicular, |  | ||||||
|         width, |  | ||||||
|         new Cesium.Cartesian3() |  | ||||||
|       ); |  | ||||||
|  |  | ||||||
|       if (width > 0) { |  | ||||||
|         rightPositions.unshift(Cesium.Cartesian3.add(start, leftOffset, new Cesium.Cartesian3())); |  | ||||||
|       } else if (width < 0) { |  | ||||||
|         rightPositions.push(Cesium.Cartesian3.add(start, leftOffset, new Cesium.Cartesian3())); |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|     } |  | ||||||
|     return rightPositions |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   get carRoadWidth() { |  | ||||||
|     return this.options.carRoadWidth |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   set carRoadWidth(v) { |  | ||||||
|     this.options.carRoadWidth = v |  | ||||||
|     Road.create(this) |  | ||||||
|  |  | ||||||
|   } |  | ||||||
|   get sideWidth() { |  | ||||||
|     return this.options.sideWidth |  | ||||||
|   } |  | ||||||
|   set sideWidth(v) { |  | ||||||
|     this.options.sideWidth = v |  | ||||||
|     Road.create(this) |  | ||||||
|   } |  | ||||||
|   /** |  | ||||||
|    * @description 编辑框 |  | ||||||
|    * @param state=false {boolean} 状态: true打开, false关闭 |  | ||||||
|    */ |  | ||||||
|   async edit(state = false) { |  | ||||||
|     let _this = this |  | ||||||
|     this.originalOptions = this.deepCopyObj(this.options) |  | ||||||
|  |  | ||||||
|     if (this._DialogObject && this._DialogObject.close) { |  | ||||||
|       this._DialogObject.close() |  | ||||||
|       this._DialogObject = null |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     if (state) { |  | ||||||
|       this._DialogObject = await new Dialog(this.sdk, this.originalOptions, { |  | ||||||
|         title: '道路属性', left: '180px', top: '100px', |  | ||||||
|         confirmCallBack: (options) => { |  | ||||||
|           this.name = this.name.trim() |  | ||||||
|           if (!this.name) { |  | ||||||
|             this.name = '道路' |  | ||||||
|           } |  | ||||||
|           this.originalOptions = this.deepCopyObj(this.options) |  | ||||||
|           this._DialogObject.close() |  | ||||||
|           this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(this.originalOptions) |  | ||||||
|           syncData(this.sdk, this.options.id) |  | ||||||
|           syncSplitData(this.sdk, this.options.id) |  | ||||||
|         }, |  | ||||||
|         resetCallBack: () => { |  | ||||||
|           this.reset() |  | ||||||
|           this.Dialog.resetCallBack && this.Dialog.resetCallBack() |  | ||||||
|         }, |  | ||||||
|         closeCallBack: () => { |  | ||||||
|           this.reset() |  | ||||||
|           this.Dialog.closeCallBack && this.Dialog.closeCallBack() |  | ||||||
|         }, |  | ||||||
|         showCallBack: (show) => { |  | ||||||
|           this.show = show |  | ||||||
|           this.Dialog.showCallBack && this.Dialog.showCallBack() |  | ||||||
|         } |  | ||||||
|       }, true) |  | ||||||
|       this._DialogObject._element.body.className = this._DialogObject._element.body.className + ' road-surface' |  | ||||||
|       let contentElm = document.createElement('div'); |  | ||||||
|       contentElm.innerHTML = html() |  | ||||||
|       this._DialogObject.contentAppChild(contentElm) |  | ||||||
|  |  | ||||||
|  |  | ||||||
|       // 下拉选项 |  | ||||||
|       // let heightModeData = [ |  | ||||||
|       //   { |  | ||||||
|       //     name: '海拔高度', |  | ||||||
|       //     value: '海拔高度', |  | ||||||
|       //     key: '0', |  | ||||||
|       //   }, |  | ||||||
|       //   { |  | ||||||
|       //     name: '相对地表', |  | ||||||
|       //     value: '相对地表', |  | ||||||
|       //     key: '1', |  | ||||||
|       //   }, |  | ||||||
|       //   { |  | ||||||
|       //     name: '依附模型', |  | ||||||
|       //     value: '依附模型', |  | ||||||
|       //     key: '2', |  | ||||||
|       //   } |  | ||||||
|       // ] |  | ||||||
|       // let heightModeObject = legp( |  | ||||||
|       //   this._DialogObject._element.content.getElementsByClassName( |  | ||||||
|       //     'road-box' |  | ||||||
|       //   )[0], |  | ||||||
|       //   '.road-type' |  | ||||||
|       // ) |  | ||||||
|       // if (heightModeObject) { |  | ||||||
|       //   heightModeObject.legp_search(heightModeData) |  | ||||||
|       //   let heightModeDataLegpElm = this._DialogObject._element.content |  | ||||||
|       //     .getElementsByClassName('road-type')[0] |  | ||||||
|       //     .getElementsByTagName('input')[0] |  | ||||||
|       //   for (let i = 0; i < heightModeData.length; i++) { |  | ||||||
|       //     if (heightModeData[i].key == this.heightMode) { |  | ||||||
|       //       heightModeDataLegpElm.value = heightModeData[i].value |  | ||||||
|       //       heightModeObject.legp_searchActive( |  | ||||||
|       //         heightModeData[i].value |  | ||||||
|       //       ) |  | ||||||
|       //       break |  | ||||||
|       //     } |  | ||||||
|       //   } |  | ||||||
|       //   heightModeDataLegpElm.addEventListener('input', () => { |  | ||||||
|       //     for (let i = 0; i < heightModeData.length; i++) { |  | ||||||
|       //       if (heightModeData[i].value === heightModeDataLegpElm.value) { |  | ||||||
|       //         this.heightMode = heightModeData[i].key |  | ||||||
|       //         break |  | ||||||
|       //       } |  | ||||||
|       //     } |  | ||||||
|       //   }) |  | ||||||
|  |  | ||||||
|  |  | ||||||
|       //   this._elms.height = heightElm |  | ||||||
|       //   this._elms.heightBox = heightBoxElm |  | ||||||
|       //   this._elms.heightMode = heightModeDataLegpElm |  | ||||||
|       //   this._elms.heightConfirm = heightConfirmElm |  | ||||||
|       //   this._elms.heightModeObject = heightModeObject |  | ||||||
|  |  | ||||||
|       //   heightConfirmElm.addEventListener('click', () => { |  | ||||||
|       //     this.positionEditing = false |  | ||||||
|       //     for (let i = 0; i < this.options.positions.length; i++) { |  | ||||||
|       //       this.options.positions[i].alt = Number((this.options.positions[i].alt + Number(heightElm.value)).toFixed(2)) |  | ||||||
|       //       this._elms.alt[i].innerHTML = this.options.positions[i].alt |  | ||||||
|       //     } |  | ||||||
|       //     let fromDegreesArray = this.renewPositions(this.options.positions) |  | ||||||
|       //     this.entity.polyline.positions = Cesium.Cartesian3.fromDegreesArrayHeights( |  | ||||||
|       //       fromDegreesArray |  | ||||||
|       //     ) |  | ||||||
|  |  | ||||||
|       //     this.positionEditing = false |  | ||||||
|       //     PolylineObject.closeNodeEdit(this) |  | ||||||
|       //   }) |  | ||||||
|       // } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|       let all_elm = contentElm.getElementsByTagName("*") |  | ||||||
|       this._EventBinding.on(this, all_elm) |  | ||||||
|       this._elms = this._EventBinding.element |  | ||||||
|     } else { |  | ||||||
|       // if (this._element_style) { |  | ||||||
|       //   document.getElementsByTagName('head')[0].removeChild(this._element_style) |  | ||||||
|       //   this._element_style = null |  | ||||||
|       // } |  | ||||||
|       // if (this._DialogObject && this._DialogObject.remove) { |  | ||||||
|       //   this._DialogObject.remove() |  | ||||||
|       //   this._DialogObject = null |  | ||||||
|       // } |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   reset() { |  | ||||||
|     if (!this.viewer.entities.getById(this.options.id)) { |  | ||||||
|       return |  | ||||||
|     } |  | ||||||
|     this.name = this.originalOptions.name |  | ||||||
|     this.carRoadWidth = this.originalOptions.carRoadWidth |  | ||||||
|     this.sideWidth = this.originalOptions.sideWidth |  | ||||||
|     this.positions = this.originalOptions.positions |  | ||||||
|     this.roadImage = this.originalOptions.roadImage |  | ||||||
|     this.sideImage = this.originalOptions.sideImage |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   /** |  | ||||||
|    * 飞到对应实体 |  | ||||||
|    */ |  | ||||||
|   async flyTo(options = {}) { |  | ||||||
|     setActiveViewer(0) |  | ||||||
|     closeRotateAround(this.sdk) |  | ||||||
|     closeViewFollow(this.sdk) |  | ||||||
|  |  | ||||||
|     if (this.options.customView && this.options.customView.relativePosition && this.options.customView.orientation) { |  | ||||||
|       let orientation = { |  | ||||||
|         heading: Cesium.Math.toRadians(this.options.customView.orientation.heading || 0.0), |  | ||||||
|         pitch: Cesium.Math.toRadians(this.options.customView.orientation.pitch || -60.0), |  | ||||||
|         roll: Cesium.Math.toRadians(this.options.customView.orientation.roll || 0.0) |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|       let lng = this.options.customView.relativePosition.lng |  | ||||||
|       let lat = this.options.customView.relativePosition.lat |  | ||||||
|       let alt = this.options.customView.relativePosition.alt |  | ||||||
|       let destination = Cesium.Cartesian3.fromDegrees(lng, lat, alt) |  | ||||||
|  |  | ||||||
|       let position = { lng: 0, lat: 0 } |  | ||||||
|       if (this.options.position) { |  | ||||||
|         position = { ...this.options.position } |  | ||||||
|       } |  | ||||||
|       else if (this.options.positions) { |  | ||||||
|         position = { ...this.options.positions[0] } |  | ||||||
|       } |  | ||||||
|       else if (this.options.center) { |  | ||||||
|         position = { ...this.options.center } |  | ||||||
|       } |  | ||||||
|       else if (this.options.start) { |  | ||||||
|         position = { ...this.options.start } |  | ||||||
|       } |  | ||||||
|       else { |  | ||||||
|         if (this.options.hasOwnProperty('lng')) { |  | ||||||
|           position.lng = this.options.lng |  | ||||||
|         } |  | ||||||
|         if (this.options.hasOwnProperty('lat')) { |  | ||||||
|           position.lat = this.options.lat |  | ||||||
|         } |  | ||||||
|         if (this.options.hasOwnProperty('alt')) { |  | ||||||
|           position.alt = this.options.alt |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|       // 如果没有高度值,则获取紧贴高度计算 |  | ||||||
|       // if (!position.hasOwnProperty('alt')) { |  | ||||||
|       //   position.alt = await this.getClampToHeight(position) |  | ||||||
|       // } |  | ||||||
|       lng = this.options.customView.relativePosition.lng + position.lng |  | ||||||
|       lat = this.options.customView.relativePosition.lat + position.lat |  | ||||||
|       alt = this.options.customView.relativePosition.alt + position.alt |  | ||||||
|       destination = Cesium.Cartesian3.fromDegrees(lng, lat, alt) |  | ||||||
|       this.sdk.viewer.camera.flyTo({ |  | ||||||
|         destination: destination, |  | ||||||
|         orientation: orientation |  | ||||||
|       }) |  | ||||||
|     } |  | ||||||
|     else { |  | ||||||
|       let positionArray = [] |  | ||||||
|       for (let i = 0; i < this.positions.length; i++) { |  | ||||||
|         let a = Cesium.Cartesian3.fromDegrees( |  | ||||||
|           this.positions[i][0], |  | ||||||
|           this.positions[i][1], |  | ||||||
|           this.options.height + this.options.heightDifference / 2 |  | ||||||
|         ) |  | ||||||
|         positionArray.push(a.x, a.y, a.z) |  | ||||||
|       } |  | ||||||
|       let BoundingSphere = Cesium.BoundingSphere.fromVertices(positionArray) |  | ||||||
|       this.viewer.camera.flyToBoundingSphere(BoundingSphere, { |  | ||||||
|         offset: { |  | ||||||
|           heading: Cesium.Math.toRadians(0.0), |  | ||||||
|           pitch: Cesium.Math.toRadians(-20.0), |  | ||||||
|           roll: Cesium.Math.toRadians(0.0) |  | ||||||
|         } |  | ||||||
|       }) |  | ||||||
|  |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   getSphere() { |  | ||||||
|     return new Promise((resolve) => { |  | ||||||
|       // entity没有加载完成时 state 不会等于0 所以设置定时器直到获取到为止 |  | ||||||
|       const interval = setInterval(() => { |  | ||||||
|         const sphere = new Cesium.BoundingSphere() |  | ||||||
|         const state = this.sdk.viewer._dataSourceDisplay.getBoundingSphere( |  | ||||||
|           this.viewer.entities.getById(this.options.id), |  | ||||||
|           false, |  | ||||||
|           sphere |  | ||||||
|         ) |  | ||||||
|         if (state === Cesium.BoundingSphereState.DONE) { |  | ||||||
|           clearInterval(interval) |  | ||||||
|         } |  | ||||||
|       }, 1000) |  | ||||||
|     }) |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   /** |  | ||||||
|    * 删除 |  | ||||||
|    */ |  | ||||||
|   async remove() { |  | ||||||
|     this.positions = [] |  | ||||||
|     this.lineEntity = null |  | ||||||
|  |  | ||||||
|     if (this.viewer.entities.getById(this.options.id)) { |  | ||||||
|       this.viewer.entities.getById(this.options.id)._children.forEach((item) => { |  | ||||||
|         this.viewer.entities.remove(item); |  | ||||||
|       }); |  | ||||||
|       this.viewer.entities.remove(this.viewer.entities.getById(this.options.id)) |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     if (this._DialogObject && !this._DialogObject.isDestroy) { |  | ||||||
|       this._DialogObject.close() |  | ||||||
|       this._DialogObject = null |  | ||||||
|     } |  | ||||||
|     await this.sdk.removeIncetance(this.options.id) |  | ||||||
|     await syncData(this.sdk, this.options.id) |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   flicker() { } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| export default Road |  | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -19,56 +19,22 @@ class SectorObject extends Base { | |||||||
|   /** |   /** | ||||||
|    * @constructor |    * @constructor | ||||||
|    * @description 创建扇形 |    * @description 创建扇形 | ||||||
|    * @param sdk |  | ||||||
|    * @param options {object} 扇形属性 |    * @param options {object} 扇形属性 | ||||||
|    * @param options.id {string} 标注id |    * @param options.id {string} 标注id | ||||||
|    * @param options.name {string} 名称 |    * @param options.name {string} 名称 | ||||||
|    * @param options.show=true {boolean} 显示/隐藏 |    * @param options.show=true {boolean} 显示/隐藏 | ||||||
|    * @param options.color="rgba(255, 0, 0, 0.5)" {string} 颜色 |    * @param options.color="rgba(255, 0, 0, 0.5)" {string} 颜色 | ||||||
|    * @param options.center {object} 位置 |    * @param options.center {object} 位置 | ||||||
|    * @param options.center.lng {number} 经度 |    * @param options.center.lng {object} 经度 | ||||||
|    * @param options.center.lat {number} 纬度 |    * @param options.center.lat {object} 维度 | ||||||
|    * @param options.center.alt {number} 高度 |  | ||||||
|    * @param options.radius=10 {number} 半径 |    * @param options.radius=10 {number} 半径 | ||||||
|    * @param options.startAngle=10 {number} 起始方向 |    * @param options.startAngle=10 {number} 起始方向 | ||||||
|    * @param options.endAngle=0 {number} 结束方向 |    * @param options.endAngle=0 {number} 结束方向 | ||||||
|    * @param options.line {object} 边框 |    * @param options.line {object} 边框 | ||||||
|    * @param options.line.width=3 {number} 边框宽 |    * @param options.line.width=3 {string} 边框宽 | ||||||
|    * @param options.line.color="rgba(155, 155, 124, 0.89)" {string} 边框颜色 |    * @param options.line.color="rgba(155, 155, 124, 0.89)" {string} 边框颜色 | ||||||
|  |    * @param options.label {object} 标注 | ||||||
|    * @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式) |    * @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式) | ||||||
|    * @param options.areaUnit='平方米' {string} 面积单位 |  | ||||||
|    * @param options.label {object} 标签对象 |  | ||||||
|    * @param options.label.text {string} 标签文本 |  | ||||||
|    * @param options.label.show {string} 标签显隐 |  | ||||||
|    * @param options.label.position {string} 标签位置 |  | ||||||
|    * @param options.label.position.lng {number} 经度 |  | ||||||
|    * @param options.label.position.lat {number} 纬度 |  | ||||||
|    * @param options.label.position.alt {number} 高度 |  | ||||||
|    * @param options.label.fontSize=20 {number} 字体大小 |  | ||||||
|    * @param options.label.fontFamily=0 {number} 字体项 0:黑体;1:思源黑体;2:庞门正道标题体;3:数黑体 |  | ||||||
|    * @param options.label.color=#ffffff {string} 字体颜色 |  | ||||||
|    * @param options.label.lineWidth=4 {number} 引线宽 |  | ||||||
|    * @param options.label.lineColor=#00ffff80 {string} 引线颜色 |  | ||||||
|    * @param options.label.pixelOffset=20 {number} 字体偏移(引线长度) |  | ||||||
|    * @param options.label.backgroundColor=['#00ffff80', '#00ffff80'] {array} 背景颜色 |  | ||||||
|    * @param options.label.scaleByDistance {boolean} 距离缩放 |  | ||||||
|    * @param options.label.near=2000 {number} 视野缩放最近距离 |  | ||||||
|    * @param options.label.far=100000 {number} 视野缩放最远距离 |  | ||||||
|    * @param options.attribute {object} 属性内容 |  | ||||||
|    * @param options.attribute.link {object} 链接 |  | ||||||
|    * @param options.attribute.link.content=[]] {array} 链接内容 |  | ||||||
|    * @param options.attribute.link.content[].name {string} 链接名称 |  | ||||||
|    * @param options.attribute.link.content[].url {string} 链接地址 |  | ||||||
|    * @param options.richTextContent {string} 富文本内容 |  | ||||||
|    * @param options.customView {object} 默认视角 |  | ||||||
|    * @param options.customView.orientation {object} 默认视角方位 |  | ||||||
|    * @param options.customView.orientation.heading {number} 航向角 |  | ||||||
|    * @param options.customView.orientation.pitch {number} 俯仰角 |  | ||||||
|    * @param options.customView.orientation.roll {number} 翻滚角 |  | ||||||
|    * @param options.customView.relativePosition {object} 视角相对位置 |  | ||||||
|    * @param options.customView.relativePosition.lng {number} 经度 |  | ||||||
|    * @param options.customView.relativePosition.lat {number} 纬度 |  | ||||||
|    * @param options.customView.relativePosition.alt {number} 高度 |  | ||||||
|    */ |    */ | ||||||
|   constructor(sdk, options = {}) { |   constructor(sdk, options = {}) { | ||||||
|     super(sdk, options); |     super(sdk, options); | ||||||
| @ -378,7 +344,7 @@ class SectorObject extends Base { | |||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show && !this.showView || this.showView == 3) { |     if (this.show) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|  | |||||||
| @ -22,56 +22,14 @@ class StraightArrowObject extends Base { | |||||||
|    * @param sdk |    * @param sdk | ||||||
|    * @description 直线箭头 |    * @description 直线箭头 | ||||||
|    * @param options {object} 属性 |    * @param options {object} 属性 | ||||||
|    * @param options.id {string} 唯一标识 |  | ||||||
|    * @param options.show=true {boolean} 显示/隐藏 |    * @param options.show=true {boolean} 显示/隐藏 | ||||||
|    * @param options.name {string} 名称 |    * @param options.name {string} 名称 | ||||||
|    * @param options.color='rgba(255, 0, 0, 0.5)' {string} 颜色 |    * @param options.color="#ff000080" {string} 颜色 | ||||||
|    * @param options.height {number} 高度 |    * @param options.height {number} 高度 | ||||||
|    * @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式) |    * @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式) | ||||||
|    * @param options.areaUnit='平方米' {string} 面积单位 |    * @param {Array.<object>} options.positions 坐标数组 [{lon,lat,alt},...] | ||||||
|    * @param options.line {object} 边框 |    * @param _Dialog {object} 弹框事件 | ||||||
|    * @param options.line.width=2 {string} 边框宽 |    * @param _Dialog.confirmCallBack {function} 弹框确认时的回调 | ||||||
|    * @param options.line.color="rgba(155, 155, 124, 0.89)" {string} 边框颜色 |  | ||||||
|    * @param {Array.<object>} options.positions 必填,经纬度和高度的列表,值交替 [{lon,lat,alt},...] |  | ||||||
|    * @param options.positions[].lng {number} 经度 |  | ||||||
|    * @param options.positions[].lat {number} 纬度 |  | ||||||
|    * @param options.positions[].alt {number} 高度 |  | ||||||
|    * @param options.spreadState=false {boolean} 动画 |  | ||||||
|    * @param options.loop=false {loop} 动画重复 |  | ||||||
|    * @param options.spreadTime=3000 {number} 动画持续时长(毫秒) |  | ||||||
|    * @param options.label {object} 标签对象 |  | ||||||
|    * @param options.label.text {string} 标签文本 |  | ||||||
|    * @param options.label.show {string} 标签显隐 |  | ||||||
|    * @param options.label.position {string} 标签位置 |  | ||||||
|    * @param options.label.position {object} 标签位置 |  | ||||||
|    * @param options.label.position.lng {number} 经度 |  | ||||||
|    * @param options.label.position.lat {number} 纬度 |  | ||||||
|    * @param options.label.position.alt {number} 高度 |  | ||||||
|    * @param options.label.fontSize=20 {number} 字体大小 |  | ||||||
|    * @param options.label.fontFamily=0 {number} 字体项 0:黑体;1:思源黑体;2:庞门正道标题体;3:数黑体 |  | ||||||
|    * @param options.label.color=#ffffff {string} 字体颜色 |  | ||||||
|    * @param options.label.lineWidth=4 {number} 引线宽 |  | ||||||
|    * @param options.label.lineColor=#00ffff80 {string} 引线颜色 |  | ||||||
|    * @param options.label.pixelOffset=20 {number} 字体偏移(引线长度) |  | ||||||
|    * @param options.label.backgroundColor=['#00ffff80', '#00ffff80'] {array} 背景颜色 |  | ||||||
|    * @param options.label.scaleByDistance {boolean} 距离缩放 |  | ||||||
|    * @param options.label.near=2000 {number} 视野缩放最近距离 |  | ||||||
|    * @param options.label.far=100000 {number} 视野缩放最远距离 |  | ||||||
|    * @param options.attribute {object} 属性内容 |  | ||||||
|    * @param options.attribute.link={} {object} 链接 |  | ||||||
|    * @param options.attribute.link.content=[]] {array} 链接内容 |  | ||||||
|    * @param options.attribute.link.content[].name {string} 链接名称 |  | ||||||
|    * @param options.attribute.link.content[].url {string} 链接地址 |  | ||||||
|    * @param options.richTextContent {string} 富文本内容 |  | ||||||
|    * @param options.customView {object} 默认视角 |  | ||||||
|    * @param options.customView.orientation {object} 默认视角方位 |  | ||||||
|    * @param options.customView.orientation.heading {number} 航向角 |  | ||||||
|    * @param options.customView.orientation.pitch {number} 俯仰角 |  | ||||||
|    * @param options.customView.orientation.roll {number} 翻滚角 |  | ||||||
|    * @param options.customView.relativePosition {object} 视角相对位置 |  | ||||||
|    * @param options.customView.relativePosition.lng {number} 经度 |  | ||||||
|    * @param options.customView.relativePosition.lat {number} 纬度 |  | ||||||
|    * @param options.customView.relativePosition.alt {number} 高度 |  | ||||||
|    * */ |    * */ | ||||||
|   constructor(sdk, options = {}, _Dialog = {}) { |   constructor(sdk, options = {}, _Dialog = {}) { | ||||||
|     super(sdk, options); |     super(sdk, options); | ||||||
| @ -363,7 +321,7 @@ class StraightArrowObject extends Base { | |||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show && !this.showView || this.showView == 3) { |     if (this.show) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|  | |||||||
| @ -2,43 +2,17 @@ | |||||||
|  * 文本框 |  * 文本框 | ||||||
|  */ |  */ | ||||||
| import Base from "../index"; | import Base from "../index"; | ||||||
| import { syncData, getSdk } from '../../../Global/MultiViewportMode' |  | ||||||
| import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global' | import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global' | ||||||
| class TextBox extends Base { | class TextBox extends Base { | ||||||
|   /** |   constructor(sdk, options = {}) { | ||||||
|    * @constructor |  | ||||||
|    * @param sdk |  | ||||||
|    * @description 文本框 |  | ||||||
|    * @param options {object} 属性 |  | ||||||
|    * @param options.id=id |  | ||||||
|    * @param options.position=[]位置 |  | ||||||
|    * @param options.text=文本框内容 |  | ||||||
|    * @param options.show=true {boolean}是否显示 |  | ||||||
|    * @param callback=方法回调 |  | ||||||
|    * @param Dialog {object} 弹框对象 |  | ||||||
|    * @param Dialog.confirmCallBack {function} 弹框确认时的回调 |  | ||||||
|    * */ |  | ||||||
|   constructor(sdk, options = {}, callback = null) { |  | ||||||
|     // this.sdk = { ...sdk } |     // this.sdk = { ...sdk } | ||||||
|     // this.options = { ...options } |     // this.options = { ...options } | ||||||
|     super(sdk, options) |     super(sdk, options) | ||||||
|     this.options.position = options.position || [] |  | ||||||
|     this.options.text = options.text || '' |  | ||||||
|     this.options.show = (options.show || options.show === false) ? options.show : true |  | ||||||
|     this.clickTextDom = undefined |     this.clickTextDom = undefined | ||||||
|     this.handler = undefined |     this.handler = undefined | ||||||
|     this.textDom = undefined |     this.textDom = undefined | ||||||
|     this.create(this) |     this.create(this) | ||||||
|     this.sdk.addIncetance(this.options.id, this) |     this.sdk.addIncetance(this.options.id, this) | ||||||
|  |  | ||||||
|     this.callback = callback |  | ||||||
|  |  | ||||||
|     // syncData(this.sdk, this.options.id) |  | ||||||
|  |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   get type() { |  | ||||||
|     return 'TextBox' |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   async create(that) { |   async create(that) { | ||||||
| @ -47,23 +21,21 @@ class TextBox extends Base { | |||||||
|     let dom = document.createElement('span'); |     let dom = document.createElement('span'); | ||||||
|     dom.id = that.options.id |     dom.id = that.options.id | ||||||
|     dom.className = 'popup-textarea' |     dom.className = 'popup-textarea' | ||||||
|     dom.style.zIndex = 1 |  | ||||||
|     // 创建textarea元素 |     // 创建textarea元素 | ||||||
|     var textarea = document.createElement('textarea'); |     var textarea = document.createElement('textarea'); | ||||||
|     textarea.className = 'textarea' |     textarea.className = 'textarea' | ||||||
|     textarea.value = that.options.text; |  | ||||||
|     // 设置textarea的属性,例如行数和列数 |     // 设置textarea的属性,例如行数和列数 | ||||||
|     textarea.rows = 6; |     textarea.rows = 6; | ||||||
|     textarea.style.resize = 'none' |     textarea.style.resize = 'none' | ||||||
|     // 将textarea添加到div中 |     // 将textarea添加到div中 | ||||||
|     dom.appendChild(textarea); |     dom.appendChild(textarea); | ||||||
|     (!that.options.show) && (dom.style.display = 'none') |  | ||||||
|     // 将div添加到body中 |     // 将div添加到body中 | ||||||
|     // document.body.appendChild(dom); |     // document.body.appendChild(dom); | ||||||
|  |  | ||||||
|     // 配置CSS样式和内容结构 |     // 配置CSS样式和内容结构 | ||||||
|     viewer.cesiumWidget.container.appendChild(dom); |     viewer.cesiumWidget.container.appendChild(dom); | ||||||
|     let posi = Cesium.Cartesian3.fromDegrees(that.options.position.lng, that.options.position.lat, that.options.position.alt) |     let posi = Cesium.Cartesian3.fromDegrees(that.options.positions.lng, that.options.positions.lat, that.options.positions.alt) | ||||||
|  |  | ||||||
|     that.handler = function () { |     that.handler = function () { | ||||||
|       const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates( |       const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates( | ||||||
|         viewer.scene, posi |         viewer.scene, posi | ||||||
| @ -76,45 +48,22 @@ class TextBox extends Base { | |||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     viewer.scene.postRender.addEventListener(that.handler); |     viewer.scene.postRender.addEventListener(that.handler); | ||||||
|     that.textDom = dom; |     that.textDom = dom | ||||||
|  |  | ||||||
|   } |  | ||||||
|   async isClick(posi, id) { |  | ||||||
|     let params = [ |  | ||||||
|       { |  | ||||||
|         position: posi |  | ||||||
|       }, |  | ||||||
|       id, |  | ||||||
|       null |  | ||||||
|     ] |  | ||||||
|  |  | ||||||
|     this.clickCallBack({ position: posi }, id, null) |  | ||||||
|   } |   } | ||||||
|   async setHandeler(data) { |   async setHandeler(data) { | ||||||
|     let that = this |     let that = this | ||||||
|  |     const ray = this.sdk.viewer.camera.getPickRay(new Cesium.Cartesian2(data.x, data.y)); | ||||||
|     let cartesian = this.sdk.viewer.scene.pickPosition(new Cesium.Cartesian2(data.x, data.y)); //屏幕坐标转为笛卡尔空间坐标 |     var cartesian = this.sdk.viewer.scene.globe.pick(ray, this.sdk.viewer.scene); | ||||||
|     // if (!cartesian) return; |  | ||||||
|  |  | ||||||
|     // let c = Cesium.Cartographic.fromCartesian(position); |  | ||||||
|     if (!cartesian) { |  | ||||||
|       const ray = this.sdk.viewer.camera.getPickRay(new Cesium.Cartesian2(data.x, data.y)); |  | ||||||
|       cartesian = this.sdk.viewer.scene.globe.pick(ray, this.sdk.viewer.scene); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     if (Cesium.defined(cartesian)) { |     if (Cesium.defined(cartesian)) { | ||||||
|       that.sdk.viewer.scene.postRender.removeEventListener(that.handler); |       that.sdk.viewer.scene.postRender.removeEventListener(that.handler); | ||||||
|  |  | ||||||
|       var cartographic = Cesium.Cartographic.fromCartesian(cartesian); |       var cartographic = Cesium.Cartographic.fromCartesian(cartesian); | ||||||
|       var longitude = Cesium.Math.toDegrees(cartographic.longitude); |       var longitude = Cesium.Math.toDegrees(cartographic.longitude); | ||||||
|       var latitude = Cesium.Math.toDegrees(cartographic.latitude); |       var latitude = Cesium.Math.toDegrees(cartographic.latitude); | ||||||
|  |       that.positions = { | ||||||
|       let height = await that.getClampToHeight({ lng: longitude, lat: latitude }) |  | ||||||
|       that.position = { |  | ||||||
|         lng: longitude, |         lng: longitude, | ||||||
|         lat: latitude, |         lat: latitude, | ||||||
|         alt: cartographic.height |         alt: cartographic.height | ||||||
|         // alt: height |  | ||||||
|       } |       } | ||||||
|       let posi = Cesium.Cartesian3.fromDegrees(longitude, latitude, cartographic.height) |       let posi = Cesium.Cartesian3.fromDegrees(longitude, latitude, cartographic.height) | ||||||
|  |  | ||||||
| @ -132,72 +81,21 @@ class TextBox extends Base { | |||||||
|       that.sdk.viewer.scene.postRender.addEventListener(that.handler); |       that.sdk.viewer.scene.postRender.addEventListener(that.handler); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   async getwords(words) { |  | ||||||
|     this.options.text = words |  | ||||||
|     this.callback(this.options) |  | ||||||
|     let { sdkP } = getSdk() |  | ||||||
|     if (this.sdk === sdkP && sdkP) {//三维 |  | ||||||
|       syncData(this.sdk, this.options.id) |  | ||||||
|     } |  | ||||||
|     else if (sdkP) {//二维 |  | ||||||
|       sdkP.entityMap.get(this.options.id).text = words |  | ||||||
|       sdkP.entityMap.get(this.options.id).twoToThree(this.options.position) |  | ||||||
|     } else if (!sdkP) { |  | ||||||
|       syncData(this.sdk, this.options.id) |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|   async twoToThree(position) { |  | ||||||
|     let that = this |  | ||||||
|     that.sdk.viewer.scene.postRender.removeEventListener(that.handler); |  | ||||||
|     let posi = Cesium.Cartesian3.fromDegrees(position.lng, position.lat, position.alt) |  | ||||||
|  |  | ||||||
|     that.handler = function () { |  | ||||||
|       const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates( |  | ||||||
|         that.sdk.viewer.scene, posi |  | ||||||
|       ); |  | ||||||
|       if (position) { |  | ||||||
|         let width = that.textDom.clientWidth * 1 |  | ||||||
|         let height = that.textDom.clientHeight * 1 |  | ||||||
|         that.textDom.style.left = `${position.x - width / 2}px`; |  | ||||||
|         that.textDom.style.top = `${position.y - height}px`; |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|     that.sdk.viewer.scene.postRender.addEventListener(that.handler); |  | ||||||
|   } |  | ||||||
|   async returnFun() { |   async returnFun() { | ||||||
|     return this.handler |     return this.handler | ||||||
|   } |   } | ||||||
|   get text() { |  | ||||||
|     return this.options.text |  | ||||||
|   } |  | ||||||
|   set text(val) { |  | ||||||
|     this.options.text = val |  | ||||||
|     this.textDom.querySelector('textarea').value = val |  | ||||||
|     this.callback(this.options) |  | ||||||
|   } |  | ||||||
|   get onClick() { |  | ||||||
|     return this.clickCallBack |  | ||||||
|   } |  | ||||||
|   set onClick(val) { |  | ||||||
|     if (val && typeof val !== 'function') { |  | ||||||
|       console.error('val:', val, '不是一个function') |  | ||||||
|     } else { |  | ||||||
|       this.clickCallBack = val |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|   get show() { |   get show() { | ||||||
|     return this.options.show |     return this.options.show | ||||||
|   } |   } | ||||||
|   set show(v) { |   set show(v) { | ||||||
|     this.options.show = v |     this.options.show = v | ||||||
|     this.textDom && (this.textDom.style.display = v ? 'block' : 'none'); |     this.textDom && (this.textDom.style.display = v ? 'block' : 'none'); | ||||||
|     syncData(this.sdk, this.options.id) |  | ||||||
|   } |   } | ||||||
|   get position() { |   get positions() { | ||||||
|     return this.options.position |     return this.options.positions | ||||||
|   } |   } | ||||||
|   set position(v) { |   set positions(v) { | ||||||
|     this.options.position = v |     this.options.positions = v | ||||||
|   } |   } | ||||||
|   async flyTo(options = {}) { |   async flyTo(options = {}) { | ||||||
|     setActiveViewer(0) |     setActiveViewer(0) | ||||||
| @ -220,8 +118,8 @@ class TextBox extends Base { | |||||||
|       if (this.options.position) { |       if (this.options.position) { | ||||||
|         position = { ...this.options.position } |         position = { ...this.options.position } | ||||||
|       } |       } | ||||||
|       else if (this.options.position) { |       else if (this.options.positions) { | ||||||
|         position = { ...this.options.position[0] } |         position = { ...this.options.positions[0] } | ||||||
|       } |       } | ||||||
|       else if (this.options.center) { |       else if (this.options.center) { | ||||||
|         position = { ...this.options.center } |         position = { ...this.options.center } | ||||||
| @ -256,9 +154,9 @@ class TextBox extends Base { | |||||||
|     else { |     else { | ||||||
|       let positionArray = [] |       let positionArray = [] | ||||||
|       let a = Cesium.Cartesian3.fromDegrees( |       let a = Cesium.Cartesian3.fromDegrees( | ||||||
|         this.position.lng, |         this.positions.lng, | ||||||
|         this.position.lat, |         this.positions.lat, | ||||||
|         this.position.alt |         this.positions.alt | ||||||
|       ) |       ) | ||||||
|       positionArray.push(a.x, a.y, a.z) |       positionArray.push(a.x, a.y, a.z) | ||||||
|  |  | ||||||
| @ -282,7 +180,6 @@ class TextBox extends Base { | |||||||
|     if (this.textDom && this.textDom.parentNode) { |     if (this.textDom && this.textDom.parentNode) { | ||||||
|       this.sdk.viewer.cesiumWidget.container.removeChild(this.textDom); |       this.sdk.viewer.cesiumWidget.container.removeChild(this.textDom); | ||||||
|     } |     } | ||||||
|     await this.sdk.removeIncetance(this.options.id) |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   flicker() { } |   flicker() { } | ||||||
|  | |||||||
| @ -14,27 +14,14 @@ class GroundText extends Base { | |||||||
|    * @param sdk |    * @param sdk | ||||||
|    * @description 贴地文字 |    * @description 贴地文字 | ||||||
|    * @param options {object} 属性 |    * @param options {object} 属性 | ||||||
|    * @param options.id {string} 唯一标识 |  | ||||||
|    * @param options.show=true {boolean} 显示/隐藏 |    * @param options.show=true {boolean} 显示/隐藏 | ||||||
|    * @param options.text {string} 文字 |    * @param options.text {string} 文字 | ||||||
|    * @param options.angle=0 {number} 旋转角度 |    * @param options.angle=0 {number} 旋转角度 | ||||||
|    * @param options.scale=1 {number} 缩放比例 |    * @param options.scale=1 {number} 比例 | ||||||
|    * @param options.speed=1 {number} 文字滚动速度 |    * @param {object} options.position 经纬度{lon,lat} | ||||||
|    * @param {object} options.position 位置 |    * @param {object} options.positions 经纬度集[{lon,lat}]仅在未定义 position 时有效 | ||||||
|    * @param {number} options.position.lng 经度 |    * @param _Dialog {object} 弹框事件 | ||||||
|    * @param {number} options.position.lat 纬度 |    * @param _Dialog.confirmCallBack {function} 弹框确认时的回调 | ||||||
|    * @param {object} options.positions 坐标集[{lon,lat}]仅在未定义 position 时有效 |  | ||||||
|    * @param options.positions[].lng {number} 经度 |  | ||||||
|    * @param options.positions[].lat {number} 纬度 |  | ||||||
|    * @param options.customView {object} 默认视角 |  | ||||||
|    * @param options.customView.orientation {object} 默认视角方位 |  | ||||||
|    * @param options.customView.orientation.heading {number} 航向角 |  | ||||||
|    * @param options.customView.orientation.pitch {number} 俯仰角 |  | ||||||
|    * @param options.customView.orientation.roll {number} 翻滚角 |  | ||||||
|    * @param options.customView.relativePosition {object} 视角相对位置 |  | ||||||
|    * @param options.customView.relativePosition.lng {number} 经度 |  | ||||||
|    * @param options.customView.relativePosition.lat {number} 纬度 |  | ||||||
|    * @param options.customView.relativePosition.alt {number} 高度 |  | ||||||
|    * */ |    * */ | ||||||
|   constructor(sdk, options = {}, _Dialog = {}) { |   constructor(sdk, options = {}, _Dialog = {}) { | ||||||
|     super(sdk, options) |     super(sdk, options) | ||||||
| @ -662,7 +649,7 @@ class GroundText extends Base { | |||||||
|       ctx.font = 200 + 'px serif' |       ctx.font = 200 + 'px serif' | ||||||
|       ctx.fillStyle = 'rgba(255, 255, 255, 0)' |       ctx.fillStyle = 'rgba(255, 255, 255, 0)' | ||||||
|       ctx.fillRect(0, 0, maxWidth + 30, 210) |       ctx.fillRect(0, 0, maxWidth + 30, 210) | ||||||
|       ctx.fillStyle = 'rgba(255, 255, 255, 1)' |       ctx.fillStyle = this.options.color | ||||||
|       ctx.font = '200px serif' |       ctx.font = '200px serif' | ||||||
|       ctx.fillText(textArray[i], 0, 210 * (i + 1)) |       ctx.fillText(textArray[i], 0, 210 * (i + 1)) | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -16,23 +16,12 @@ class StandText extends Base { | |||||||
|    * @param sdk |    * @param sdk | ||||||
|    * @description 立体文字 |    * @description 立体文字 | ||||||
|    * @param options {object} |    * @param options {object} | ||||||
|    * @param options.id {string} 唯一标识 |  | ||||||
|    * @param options.text {string} 文字 |    * @param options.text {string} 文字 | ||||||
|    * @param options.color="#FFC107" {string} 颜色 |    * @param options.color="#FFC107" {string} 颜色 | ||||||
|    * @param options.speed=1 {number} 文字移动速度 |    * @param options.speed=1 {number} 文字移动速度 | ||||||
|    * @param {Array.<object>} positions 经纬度和高度的列表,值交替 [{lon,lat,alt},...] |    * @param {Array.<object>} positions 经纬度和高度的列表,值交替 [{lon,lat,alt},...] | ||||||
|    * @param options.positions[].lng {number} 经度 |    * @param _Dialog {object} 弹框事件 | ||||||
|    * @param options.positions[].lat {number} 纬度 |    * @param _Dialog.confirmCallBack {function} 弹框确认时的回调 | ||||||
|    * @param options.positions[].alt {number} 高度 |  | ||||||
|    * @param options.customView {object} 默认视角 |  | ||||||
|    * @param options.customView.orientation {object} 默认视角方位 |  | ||||||
|    * @param options.customView.orientation.heading {number} 航向角 |  | ||||||
|    * @param options.customView.orientation.pitch {number} 俯仰角 |  | ||||||
|    * @param options.customView.orientation.roll {number} 翻滚角 |  | ||||||
|    * @param options.customView.relativePosition {object} 视角相对位置 |  | ||||||
|    * @param options.customView.relativePosition.lng {number} 经度 |  | ||||||
|    * @param options.customView.relativePosition.lat {number} 纬度 |  | ||||||
|    * @param options.customView.relativePosition.alt {number} 高度 |  | ||||||
|    * */ |    * */ | ||||||
|   constructor(sdk, options, _Dialog = {}) { |   constructor(sdk, options, _Dialog = {}) { | ||||||
|     super(sdk, options); |     super(sdk, options); | ||||||
| @ -519,7 +508,7 @@ class StandText extends Base { | |||||||
|       ctx.font = 200 + "px serif"; |       ctx.font = 200 + "px serif"; | ||||||
|       ctx.fillStyle = 'rgba(255, 255, 255, 0)' |       ctx.fillStyle = 'rgba(255, 255, 255, 0)' | ||||||
|       ctx.fillRect(0, 0, maxWidth + 30, 210) |       ctx.fillRect(0, 0, maxWidth + 30, 210) | ||||||
|       ctx.fillStyle = 'rgba(255, 255, 255, 1)'; |       ctx.fillStyle = this.options.color; | ||||||
|       ctx.font = "200px serif"; |       ctx.font = "200px serif"; | ||||||
|       ctx.fillText(textArray[i], 0, 210 * (i+1)); |       ctx.fillText(textArray[i], 0, 210 * (i+1)); | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -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> |  | ||||||
|     ` |     ` | ||||||
| } | } | ||||||
|  |  | ||||||
|  | |||||||
| @ -23,9 +23,7 @@ class TrajectoryMotion extends Base { | |||||||
|   /** |   /** | ||||||
|  * @constructor |  * @constructor | ||||||
|  * @description 轨迹运动 |  * @description 轨迹运动 | ||||||
|  * @param sdk |  | ||||||
|  * @param options {object} |  * @param options {object} | ||||||
|  * @param options.id {string} 唯一标识 |  | ||||||
|  * @param options.name {string} 名称 |  * @param options.name {string} 名称 | ||||||
|  * @param options.speed=1 {number} 运行速度 |  * @param options.speed=1 {number} 运行速度 | ||||||
|  * @param options.delay=0 {number} 运动延迟时间(毫秒) |  * @param options.delay=0 {number} 运动延迟时间(毫秒) | ||||||
| @ -35,41 +33,22 @@ class TrajectoryMotion extends Base { | |||||||
|  * @param options.state=true {boolean} 模型运动 |  * @param options.state=true {boolean} 模型运动 | ||||||
|  * @param options.routeDirection=true {boolean} 路径方向 |  * @param options.routeDirection=true {boolean} 路径方向 | ||||||
|  * @param options.viewFollow=false {boolean} 视角跟随 |  * @param options.viewFollow=false {boolean} 视角跟随 | ||||||
|  * @param options.realTimeRoute=false {boolean} 实时路径 |  | ||||||
|  * @param options.model {object} 模型参数 |  * @param options.model {object} 模型参数 | ||||||
|  * @param options.model.show=true {boolean} 模型显隐 |  * @param options.model.show=true {boolean} 模型显隐 | ||||||
|  * @param options.model.url {string} 模型地址 |  * @param options.model.url {url} 模型地址 | ||||||
|  * @param options.model.pixelSize=70 {number} 模型像素大小 |  * @param options.model.pixelSize=70 {number} 模型像素大小 | ||||||
|  * @param options.model.heading=0 {number} 模型航向角 |  * @param options.model.heading=0 {number}  | ||||||
|  * @param options.model.pitch=0 {number} 模型俯仰角 |  * @param options.model.pitch=0 {number}  | ||||||
|  * @param options.model.roll=0 {number} 模型翻滚角 |  * @param options.model.roll=0 {number}  | ||||||
|  * @param options.model.scale=1 {number} 模型比例 |  * @param options.model.scale=1 {number} 模型比例 | ||||||
|  * @param options.model.animate {string} 模型动画 |  * @param options.model.animate {string} 模型动画 | ||||||
|  * @param options.line {object} 路径参数 |  * @param options.line {object} 路径参数 | ||||||
|  * @param options.line.show=true {boolean} 路径显隐 |  * @param options.line.show=true {boolean} 路径显隐 | ||||||
|  * @param options.line.smooth=false {boolean} 路径圆滑 |  * @param options.line.smooth=false {boolean} 路径圆滑 | ||||||
|  * @param options.line.noseToTail=false {boolean} 路径首尾相联 |  * @param options.line.noseToTail=false {boolean} 路径收尾相联 | ||||||
|  * @param {Array.<object>} options.line.positions 经纬度和高度的列表,值交替 [{lon,lat,alt},...] |  * @param {Array.<object>} options.line.positions 经纬度和高度的列表,值交替 [{lon,lat,alt},...] | ||||||
|  * @param options.positions[].lng {number} 经度 |  * @param _Dialog {object} 弹框事件 | ||||||
|  * @param options.positions[].lat {number} 纬度 |  * @param _Dialog.confirmCallBack {function} 弹框确认时的回调 | ||||||
|  * @param options.positions[].alt {number} 高度 |  | ||||||
|  * @param options.label {object} 标签对象 |  | ||||||
|  * @param options.label.show {string} 标签显隐 |  | ||||||
|  * @param options.label.position {string} 标签位置 |  | ||||||
|  * @param options.label.position {object} 标签位置 |  | ||||||
|  * @param options.label.position.lng {number} 经度 |  | ||||||
|  * @param options.label.position.lat {number} 纬度 |  | ||||||
|  * @param options.label.position.alt {number} 高度 |  | ||||||
|  * @param options.label.fontSize=20 {number} 字体大小 |  | ||||||
|  * @param options.label.fontFamily=0 {number} 字体项 0:黑体;1:思源黑体;2:庞门正道标题体;3:数黑体 |  | ||||||
|  * @param options.label.color=#ffffff {string} 字体颜色 |  | ||||||
|  * @param options.label.lineWidth=4 {number} 引线宽 |  | ||||||
|  * @param options.label.lineColor=#00ffff80 {string} 引线颜色 |  | ||||||
|  * @param options.label.pixelOffset=20 {number} 字体偏移(引线长度) |  | ||||||
|  * @param options.label.backgroundColor=['#00ffff80', '#00ffff80'] {array} 背景颜色 |  | ||||||
|  * @param options.label.scaleByDistance {boolean} 距离缩放 |  | ||||||
|  * @param options.label.near=2000 {number} 视野缩放最近距离 |  | ||||||
|  * @param options.label.far=100000 {number} 视野缩放最远距离 |  | ||||||
|  * */ |  * */ | ||||||
|   constructor(sdk, options = {}, _Dialog = {}) { |   constructor(sdk, options = {}, _Dialog = {}) { | ||||||
|     super(sdk, options); |     super(sdk, options); | ||||||
| @ -99,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 | ||||||
| @ -202,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 | ||||||
| @ -226,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 | ||||||
|       } |       } | ||||||
|  |  | ||||||
| @ -281,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) | ||||||
| @ -1195,21 +1168,18 @@ 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 |       if (this.options.label.position) { | ||||||
|         this.label.pixelOffset = this.options.label.pixelOffset + (this.fuelShow ? this.labelFontSize + 20 : 0) |         setTimeout(() => { | ||||||
|         if (this.options.label.position) { |           if (this.options.label.position.alt) { | ||||||
|           setTimeout(() => { |             this.label && (this.label.position = [this.options.label.position.lng, this.options.label.position.lat, 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]) |           else { | ||||||
|             } |             this.getClampToHeight({ lng: this.options.label.position.lng, lat: this.options.label.position.lat }).then((height) => { | ||||||
|             else { |               this.label && (this.label.position = [this.options.label.position.lng, this.options.label.position.lat, 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]) |           } | ||||||
|               }) |         }, 0); | ||||||
|             } |  | ||||||
|           }, 0); |  | ||||||
|         } |  | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @ -1227,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 && | ||||||
| @ -1242,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({ | ||||||
| @ -1270,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 | ||||||
|     }) |     }) | ||||||
| @ -1288,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 | ||||||
|     }) |     }) | ||||||
| @ -1304,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 | ||||||
|     }) |     }) | ||||||
| @ -1320,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) | ||||||
| @ -1498,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) | ||||||
|  |  | ||||||
|  |  | ||||||
| @ -1508,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, | ||||||
| @ -1524,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++) { | ||||||
| @ -1648,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() | ||||||
| @ -1672,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() | ||||||
| @ -1785,10 +1666,9 @@ class TrajectoryMotion extends Base { | |||||||
|         if (!cartesian3) { |         if (!cartesian3) { | ||||||
|           return |           return | ||||||
|         } |         } | ||||||
|         let pos84 = _this.cartesian3Towgs84(cartesian3, viewer); |         coordinates = _this.cartesian3Towgs84(cartesian3, viewer); | ||||||
|         coordinates = [pos84.lng, pos84.lat, pos84.alt + 1.8] |  | ||||||
|         position = cartesian3 |         position = cartesian3 | ||||||
|         positionCamera = Cesium.Cartesian3.fromDegrees(coordinates[0], coordinates[1], coordinates[2]) |         positionCamera = Cesium.Cartesian3.fromDegrees(coordinates.lng, coordinates.lat, coordinates.alt + 1.8) | ||||||
|         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)) { | ||||||
| @ -1886,7 +1766,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) | ||||||
| @ -1912,7 +1791,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[0], coordinates[1], _this.sdk.viewer.camera.positionCartographic.height), |                 destination: Cesium.Cartesian3.fromDegrees(coordinates.lng, coordinates.lat, _this.sdk.viewer.camera.positionCartographic.height), | ||||||
|                 orientation: { |                 orientation: { | ||||||
|                   heading: Cesium.Math.toRadians(-90), |                   heading: Cesium.Math.toRadians(-90), | ||||||
|                   pitch: 0, |                   pitch: 0, | ||||||
| @ -2208,7 +2087,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' | ||||||
| @ -2283,7 +2162,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]) | ||||||
|     } |     } | ||||||
| @ -2291,7 +2169,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 | ||||||
| @ -2345,7 +2222,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 | ||||||
|  | |||||||
| @ -29,47 +29,13 @@ class WallRealStereoscopic extends Base { | |||||||
|    * @param options.color="#ffffff" {string} 颜色 |    * @param options.color="#ffffff" {string} 颜色 | ||||||
|    * @param options.width=0.24 {number} 宽 |    * @param options.width=0.24 {number} 宽 | ||||||
|    * @param options.show=true {boolean} 显隐 |    * @param options.show=true {boolean} 显隐 | ||||||
|    * @param options.noseToTail=false {boolean} 首尾相连 |    * @param options['nose-to-tail']=false {boolean} 首尾相连 | ||||||
|    * @param options.extrudedHeight=2.4 {number} 拉伸高度 |    * @param options.extrudedHeight=2.4 {number} 拉伸高度 | ||||||
|    * @param options.cornerType=0 {string} 拐角类型;0:直角;1:斜角;2:圆角 |    * @param options.cornerType=0 {string} 拐角类型;0:直角;1:斜角;2:圆角 | ||||||
|    * @param options.material=0 {number} 材质,0:纯色墙;1:红砖;2:黄砖;3:灰瓷 |    * @param options.material=0 {number} 材质,0:纯色墙;1:红砖;2:黄砖;3:灰瓷 | ||||||
|    * @param {Array.<object>} options.positions 必填,经纬度和高度的列表,值交替 [{lon,lat,alt},...] |    * @param {Array.<object>} positions 经纬度和高度的列表,值交替 [{lon,lat,alt},...] | ||||||
|    * @param options.positions[].lng {number} 经度 |    * @param _Dialog {object} 弹框事件 | ||||||
|    * @param options.positions[].lat {number} 纬度 |    * @param _Dialog.confirmCallBack {function} 弹框确认时的回调 | ||||||
|    * @param options.positions[].alt {number} 高度 |  | ||||||
|    * @param options.label {object} 标签对象 |  | ||||||
|    * @param options.label.text {string} 标签文本 |  | ||||||
|    * @param options.label.show {string} 标签显隐 |  | ||||||
|    * @param options.label.position {string} 标签位置 |  | ||||||
|    * @param options.label.position {object} 标签位置 |  | ||||||
|    * @param options.label.position.lng {number} 经度 |  | ||||||
|    * @param options.label.position.lat {number} 纬度 |  | ||||||
|    * @param options.label.position.alt {number} 高度 |  | ||||||
|    * @param options.label.fontSize=20 {number} 字体大小 |  | ||||||
|    * @param options.label.fontFamily=0 {number} 字体项 0:黑体;1:思源黑体;2:庞门正道标题体;3:数黑体 |  | ||||||
|    * @param options.label.color=#ffffff {string} 字体颜色 |  | ||||||
|    * @param options.label.lineWidth=4 {number} 引线宽 |  | ||||||
|    * @param options.label.lineColor=#00ffff80 {string} 引线颜色 |  | ||||||
|    * @param options.label.pixelOffset=20 {number} 字体偏移(引线长度) |  | ||||||
|    * @param options.label.backgroundColor=['#00ffff80', '#00ffff80'] {array} 背景颜色 |  | ||||||
|    * @param options.label.scaleByDistance {boolean} 距离缩放 |  | ||||||
|    * @param options.label.near=2000 {number} 视野缩放最近距离 |  | ||||||
|    * @param options.label.far=100000 {number} 视野缩放最远距离 |  | ||||||
|    * @param options.attribute {object} 属性内容 |  | ||||||
|    * @param {object} options.attribute.link={} 链接 |  | ||||||
|    * @param options.attribute.link.content=[]] {array} 链接内容 |  | ||||||
|    * @param options.attribute.link.content[].name {string} 链接名称 |  | ||||||
|    * @param options.attribute.link.content[].url {string} 链接地址 |  | ||||||
|    * @param options.richTextContent {string} 富文本内容 |  | ||||||
|    * @param options.customView {object} 默认视角 |  | ||||||
|    * @param options.customView.orientation {object} 默认视角方位 |  | ||||||
|    * @param options.customView.orientation.heading {number} 航向角 |  | ||||||
|    * @param options.customView.orientation.pitch {number} 俯仰角 |  | ||||||
|    * @param options.customView.orientation.roll {number} 翻滚角 |  | ||||||
|    * @param options.customView.relativePosition {object} 视角相对位置 |  | ||||||
|    * @param options.customView.relativePosition.lng {number} 经度 |  | ||||||
|    * @param options.customView.relativePosition.lat {number} 纬度 |  | ||||||
|    * @param options.customView.relativePosition.alt {number} 高度 |  | ||||||
|    * */ |    * */ | ||||||
|   constructor(sdk, options, _Dialog = {}) { |   constructor(sdk, options, _Dialog = {}) { | ||||||
|     super(sdk, options); |     super(sdk, options); | ||||||
| @ -287,7 +253,7 @@ class WallRealStereoscopic extends Base { | |||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show && !this.showView || this.showView == 3) { |     if (this.show) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|  | |||||||
| @ -157,7 +157,7 @@ class WallStereoscopic extends Base { | |||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show && !this.showView || this.showView == 3) { |     if (this.show) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|  | |||||||
| @ -243,7 +243,7 @@ class WallRealStereoscopic extends Base { | |||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show && !this.showView || this.showView == 3) { |     if (this.show) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|  | |||||||
| @ -23,46 +23,12 @@ class WallStereoscopic extends Base { | |||||||
|    * @param options.color="#00d9ff" {string} 颜色 |    * @param options.color="#00d9ff" {string} 颜色 | ||||||
|    * @param options.show=true {boolean} 显隐 |    * @param options.show=true {boolean} 显隐 | ||||||
|    * @param options.extrudedHeight=2.4 {number} 拉伸高度 |    * @param options.extrudedHeight=2.4 {number} 拉伸高度 | ||||||
|    * @param options.noseToTail=false {boolean} 首尾相连 |    * @param options['nose-to-tail']=false {boolean} 首尾相连 | ||||||
|    * @param options.material=0 {number} 材质,0:纯色墙;1:上升墙;2:箭头墙;3:警戒墙 |    * @param options.material=0 {number} 材质,0:纯色墙;1:上升墙;2:箭头墙;3:警戒墙 | ||||||
|    * @param options.duration=1000 {number} 持续时间 |    * @param options.duration=1000 {number} 持续时间 | ||||||
|    * @param {Array.<object>} options.positions 必填,经纬度和高度的列表,值交替 [{lon,lat,alt},...] |    * @param {Array.<object>} positions 经纬度和高度的列表,值交替 [{lon,lat,alt},...] | ||||||
|    * @param options.positions[].lng {number} 经度 |    * @param _Dialog {object} 弹框事件 | ||||||
|    * @param options.positions[].lat {number} 纬度 |    * @param _Dialog.confirmCallBack {function} 弹框确认时的回调 | ||||||
|    * @param options.positions[].alt {number} 高度 |  | ||||||
|    * @param options.label {object} 标签对象 |  | ||||||
|    * @param options.label.text {string} 标签文本 |  | ||||||
|    * @param options.label.show {string} 标签显隐 |  | ||||||
|    * @param options.label.position {string} 标签位置 |  | ||||||
|    * @param options.label.position {object} 标签位置 |  | ||||||
|    * @param options.label.position.lng {number} 经度 |  | ||||||
|    * @param options.label.position.lat {number} 纬度 |  | ||||||
|    * @param options.label.position.alt {number} 高度 |  | ||||||
|    * @param options.label.fontSize=20 {number} 字体大小 |  | ||||||
|    * @param options.label.fontFamily=0 {number} 字体项 0:黑体;1:思源黑体;2:庞门正道标题体;3:数黑体 |  | ||||||
|    * @param options.label.color=#ffffff {string} 字体颜色 |  | ||||||
|    * @param options.label.lineWidth=4 {number} 引线宽 |  | ||||||
|    * @param options.label.lineColor=#00ffff80 {string} 引线颜色 |  | ||||||
|    * @param options.label.pixelOffset=20 {number} 字体偏移(引线长度) |  | ||||||
|    * @param options.label.backgroundColor=['#00ffff80', '#00ffff80'] {array} 背景颜色 |  | ||||||
|    * @param options.label.scaleByDistance {boolean} 距离缩放 |  | ||||||
|    * @param options.label.near=2000 {number} 视野缩放最近距离 |  | ||||||
|    * @param options.label.far=100000 {number} 视野缩放最远距离 |  | ||||||
|    * @param options.attribute {object} 属性内容 |  | ||||||
|    * @param {object} options.attribute.link={} 链接 |  | ||||||
|    * @param options.attribute.link.content=[]] {array} 链接内容 |  | ||||||
|    * @param options.attribute.link.content[].name {string} 链接名称 |  | ||||||
|    * @param options.attribute.link.content[].url {string} 链接地址 |  | ||||||
|    * @param options.richTextContent {string} 富文本内容 |  | ||||||
|    * @param options.customView {object} 默认视角 |  | ||||||
|    * @param options.customView.orientation {object} 默认视角方位 |  | ||||||
|    * @param options.customView.orientation.heading {number} 航向角 |  | ||||||
|    * @param options.customView.orientation.pitch {number} 俯仰角 |  | ||||||
|    * @param options.customView.orientation.roll {number} 翻滚角 |  | ||||||
|    * @param options.customView.relativePosition {object} 视角相对位置 |  | ||||||
|    * @param options.customView.relativePosition.lng {number} 经度 |  | ||||||
|    * @param options.customView.relativePosition.lat {number} 纬度 |  | ||||||
|    * @param options.customView.relativePosition.alt {number} 高度 |  | ||||||
|    * */ |    * */ | ||||||
|   constructor(sdk, options, _Dialog = {}) { |   constructor(sdk, options, _Dialog = {}) { | ||||||
|     super(sdk, options); |     super(sdk, options); | ||||||
| @ -122,10 +88,6 @@ class WallStereoscopic extends Base { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   get type() { |  | ||||||
|     return 'wallStereoscopic' |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   static createLabel(that) { |   static createLabel(that) { | ||||||
|     // 标签 |     // 标签 | ||||||
|     that.label = new LabelObject(that.sdk, { |     that.label = new LabelObject(that.sdk, { | ||||||
| @ -229,7 +191,7 @@ class WallStereoscopic extends Base { | |||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show && !this.showView || this.showView == 3) { |     if (this.show) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|  | |||||||
| @ -15,17 +15,14 @@ class WaterSurface extends Base { | |||||||
|    * @param sdk  |    * @param sdk  | ||||||
|    * @description 水面 |    * @description 水面 | ||||||
|    * @param options {object} 面属性 |    * @param options {object} 面属性 | ||||||
|    * @param options.id {string} 唯一标识 |  | ||||||
|    * @param options.show=true {boolean} 显隐 |  | ||||||
|    * @param options.name=未命名对象 {string} 名称 |    * @param options.name=未命名对象 {string} 名称 | ||||||
|    * @param {Array.<object>} options.positions 坐标列表 |    * @param options.positions {Array.<{lng:number, lat:number, alt:number}>} 坐标数组 | ||||||
|    * @param options.positions[].lng {number} 经度 |  | ||||||
|    * @param options.positions[].lat {number} 纬度 |  | ||||||
|    * @param options.positions[].alt {number} 高度 |  | ||||||
|    * @param options.color=rgba(32,67,135,0.5) {string} 颜色 |    * @param options.color=rgba(32,67,135,0.5) {string} 颜色 | ||||||
|    * @param options.frequency=10 {number} 频率 |    * @param options.frequency=100 {number} 频率 | ||||||
|    * @param options.animationSpeed=1 {number} 动画速度 |    * @param options.animationSpeed=0.02 {number} 动画速度 | ||||||
|    * @param options.amplitude=10 {number} 振幅 |    * @param options.amplitude=10 {number} 振幅 | ||||||
|  |    * @param Dialog {object} 弹框对象 | ||||||
|  |    * @param Dialog.confirmCallBack {function} 弹框确认时的回调 | ||||||
|    * */ |    * */ | ||||||
|   constructor(sdk, options = {}, _Dialog = {}) { |   constructor(sdk, options = {}, _Dialog = {}) { | ||||||
|     super(sdk, options); |     super(sdk, options); | ||||||
|  | |||||||
| @ -9,7 +9,6 @@ import Tools from "../../Tools"; | |||||||
| import { getHost, getToken } from "../../on"; | import { getHost, getToken } from "../../on"; | ||||||
| import { regLeftClickCallback, regRightClickCallback, regMoveCallback } from "../../Global/ClickCallback"; | import { regLeftClickCallback, regRightClickCallback, regMoveCallback } from "../../Global/ClickCallback"; | ||||||
| import { regLeftClickCallback as regLeftClickCallback2, regRightClickCallback as regRightClickCallback2, regMoveCallback as regMoveCallback2 } from "../../Global/SplitScreen/ClickCallback"; | import { regLeftClickCallback as regLeftClickCallback2, regRightClickCallback as regRightClickCallback2, regMoveCallback as regMoveCallback2 } from "../../Global/SplitScreen/ClickCallback"; | ||||||
| import { regLeftClickCallback as regLeftClickCallback3, regRightClickCallback as regRightClickCallback3, regMoveCallback as regMoveCallback3 } from "../../Global/MultiViewportMode/ClickCallback"; |  | ||||||
| import { setSplitDirection, syncSplitData, getSdk } from "../../Global/SplitScreen"; | import { setSplitDirection, syncSplitData, getSdk } from "../../Global/SplitScreen"; | ||||||
| import { syncData, getSdk as get2DSdk } from '../../Global/MultiViewportMode' | import { syncData, getSdk as get2DSdk } from '../../Global/MultiViewportMode' | ||||||
| import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../Global/global' | import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../Global/global' | ||||||
| @ -69,7 +68,7 @@ class Base extends Tools { | |||||||
|     let sdk2D = get2DSdk().sdkD |     let sdk2D = get2DSdk().sdkD | ||||||
|     if (!sdk2D) { |     if (!sdk2D) { | ||||||
|       this.#_showView = v |       this.#_showView = v | ||||||
|       if (this.entity) { |       if(this.entity) { | ||||||
|         this.entity._showView = v |         this.entity._showView = v | ||||||
|       } |       } | ||||||
|       return |       return | ||||||
| @ -137,7 +136,7 @@ class Base extends Tools { | |||||||
|           this.originalOptions.show = v |           this.originalOptions.show = v | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|       this.entity && (this.entity._showView = this.showView) |       this.entity._showView = this.showView | ||||||
|       if (this.type == 'layer') { |       if (this.type == 'layer') { | ||||||
|         if (this.entity) { |         if (this.entity) { | ||||||
|           this.entity._objectState = this.options.show |           this.entity._objectState = this.options.show | ||||||
| @ -291,7 +290,7 @@ class Base extends Tools { | |||||||
|       let destination = Cesium.Cartesian3.fromDegrees(lng, lat, alt) |       let destination = Cesium.Cartesian3.fromDegrees(lng, lat, alt) | ||||||
|  |  | ||||||
|       let position = { lng: 0, lat: 0 } |       let position = { lng: 0, lat: 0 } | ||||||
|       if (this.options.position && Object.prototype.toString.call(this.options.position) === '[object Object]') { |       if (this.options.position) { | ||||||
|         position = { ...this.options.position } |         position = { ...this.options.position } | ||||||
|       } |       } | ||||||
|       else if (this.options.positions) { |       else if (this.options.positions) { | ||||||
| @ -362,17 +361,12 @@ class Base extends Tools { | |||||||
|       console.error('val:', val, '不是一个function') |       console.error('val:', val, '不是一个function') | ||||||
|     } else { |     } else { | ||||||
|       let sdkD = getSdk().sdkD |       let sdkD = getSdk().sdkD | ||||||
|       let sdk2D = get2DSdk().sdkD |  | ||||||
|       if (sdkD && this.sdk === sdkD) { |       if (sdkD && this.sdk === sdkD) { | ||||||
|         if (this.clickCallBack == null && this.options && this.options.id) { |         if (this.clickCallBack == null && this.options && this.options.id) { | ||||||
|           regLeftClickCallback2(this.options.id, this.leftClickCB, this) |           regLeftClickCallback2(this.options.id, this.leftClickCB, this) | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|       else if (sdk2D && this.sdk === sdk2D) { |       else { | ||||||
|         if (this.clickCallBack == null && this.options && this.options.id) { |  | ||||||
|           regLeftClickCallback3(this.options.id, this.leftClickCB, this) |  | ||||||
|         } |  | ||||||
|       } else { |  | ||||||
|         if (this.clickCallBack == null && this.options && this.options.id) { |         if (this.clickCallBack == null && this.options && this.options.id) { | ||||||
|           regLeftClickCallback(this.options.id, this.leftClickCB, this) |           regLeftClickCallback(this.options.id, this.leftClickCB, this) | ||||||
|         } |         } | ||||||
| @ -390,17 +384,12 @@ class Base extends Tools { | |||||||
|       console.error('val:', val, '不是一个function') |       console.error('val:', val, '不是一个function') | ||||||
|     } else { |     } else { | ||||||
|       let sdkD = getSdk().sdkD |       let sdkD = getSdk().sdkD | ||||||
|       let sdk2D = get2DSdk().sdkD |  | ||||||
|       if (sdkD && this.sdk === sdkD) { |       if (sdkD && this.sdk === sdkD) { | ||||||
|         if (this.rightClickCallBack == null && this.entity && this.entity.id) { |         if (this.rightClickCallBack == null && this.entity && this.entity.id) { | ||||||
|           regRightClickCallback2(this.entity.id, this.rightClickCB, this) |           regRightClickCallback2(this.entity.id, this.rightClickCB, this) | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|       else if (sdk2D && this.sdk === sdk2D) { |       else { | ||||||
|         if (this.clickCallBack == null && this.options && this.options.id) { |  | ||||||
|           regRightClickCallback3(this.options.id, this.leftClickCB, this) |  | ||||||
|         } |  | ||||||
|       } else { |  | ||||||
|         if (this.rightClickCallBack == null && this.entity && this.entity.id) { |         if (this.rightClickCallBack == null && this.entity && this.entity.id) { | ||||||
|           regRightClickCallback(this.entity.id, this.rightClickCB, this) |           regRightClickCallback(this.entity.id, this.rightClickCB, this) | ||||||
|         } |         } | ||||||
| @ -418,17 +407,12 @@ class Base extends Tools { | |||||||
|       console.error('val:', val, '不是一个function') |       console.error('val:', val, '不是一个function') | ||||||
|     } else { |     } else { | ||||||
|       let sdkD = getSdk().sdkD |       let sdkD = getSdk().sdkD | ||||||
|       let sdk2D = get2DSdk().sdkD |  | ||||||
|       if (sdkD && this.sdk === sdkD) { |       if (sdkD && this.sdk === sdkD) { | ||||||
|         if (this.mouseMoveCallBack == null && this.entity && this.entity.id) { |         if (this.mouseMoveCallBack == null && this.entity && this.entity.id) { | ||||||
|           regMoveCallback2(this.entity.id, this.mouseMoveCB, this) |           regMoveCallback2(this.entity.id, this.mouseMoveCB, this) | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|       else if (sdk2D && this.sdk === sdk2D) { |       else { | ||||||
|         if (this.clickCallBack == null && this.options && this.options.id) { |  | ||||||
|           regMoveCallback3(this.options.id, this.leftClickCB, this) |  | ||||||
|         } |  | ||||||
|       } else { |  | ||||||
|         if (this.mouseMoveCallBack == null && this.entity && this.entity.id) { |         if (this.mouseMoveCallBack == null && this.entity && this.entity.id) { | ||||||
|           regMoveCallback(this.entity.id, this.mouseMoveCB, this) |           regMoveCallback(this.entity.id, this.mouseMoveCB, this) | ||||||
|         } |         } | ||||||
| @ -452,7 +436,7 @@ class Base extends Tools { | |||||||
|  |  | ||||||
|       let position = { lng: 0, lat: 0 } |       let position = { lng: 0, lat: 0 } | ||||||
|       let relativePosition = { ...cameraPosition84 } |       let relativePosition = { ...cameraPosition84 } | ||||||
|       if (this.options.position && Object.prototype.toString.call(this.options.position) === '[object Object]') { |       if (this.options.position) { | ||||||
|         position = { ...this.options.position } |         position = { ...this.options.position } | ||||||
|       } |       } | ||||||
|       else if (this.options.positions) { |       else if (this.options.positions) { | ||||||
|  | |||||||
| @ -78,6 +78,7 @@ class Dialog extends BaseDialog { | |||||||
|       this.footAppChild(div) |       this.footAppChild(div) | ||||||
|       if (this.options.updateHeightCallBack) { |       if (this.options.updateHeightCallBack) { | ||||||
|         let heightBtn = document.createElement('button'); |         let heightBtn = document.createElement('button'); | ||||||
|  |         heightBtn.className = 'update-height' | ||||||
|         heightBtn.innerHTML = '<svg class="icon-updateheigh"><use xlink:href="#yj-icon-updateheight"></use></svg>更新高程' |         heightBtn.innerHTML = '<svg class="icon-updateheigh"><use xlink:href="#yj-icon-updateheight"></use></svg>更新高程' | ||||||
|         heightBtn.style.width = 'auto' |         heightBtn.style.width = 'auto' | ||||||
|         heightBtn.addEventListener('click', () => { |         heightBtn.addEventListener('click', () => { | ||||||
|  | |||||||
| @ -1,13 +1,6 @@ | |||||||
| class cy_tabs { | class cy_tabs { | ||||||
|   constructor(boxElm, clickTabCallBack, sdk) { |   constructor(id, clickTabCallBack, sdk) { | ||||||
|     let elm |     let elm = document.getElementById(id); | ||||||
|     if(typeof boxElm === 'string') { |  | ||||||
|       elm = document.getElementById(boxElm); |  | ||||||
|     } |  | ||||||
|     else { |  | ||||||
|       elm = boxElm |  | ||||||
|     } |  | ||||||
|     // let elm = document.getElementById(id); |  | ||||||
|     let pane = elm.getElementsByTagName('DIV-cy-tab-pane') |     let pane = elm.getElementsByTagName('DIV-cy-tab-pane') | ||||||
|  |  | ||||||
|     let tabTop = `<div class="DIV-cy-tab-top">` |     let tabTop = `<div class="DIV-cy-tab-top">` | ||||||
| @ -44,9 +37,7 @@ | |||||||
|     tabContent = tabContent + `</div>` |     tabContent = tabContent + `</div>` | ||||||
|  |  | ||||||
|     let BoxElm = document.createElement('div'); |     let BoxElm = document.createElement('div'); | ||||||
|     if(typeof boxElm === 'string') { |     BoxElm.setAttribute('id', id) | ||||||
|       BoxElm.setAttribute('id', boxElm) |  | ||||||
|     } |  | ||||||
|     BoxElm.setAttribute('class', 'DIV-cy-tabs') |     BoxElm.setAttribute('class', 'DIV-cy-tabs') | ||||||
|     BoxElm.innerHTML = tabTop + tabContent |     BoxElm.innerHTML = tabTop + tabContent | ||||||
|     elm.parentNode.insertBefore(BoxElm, elm); |     elm.parentNode.insertBefore(BoxElm, elm); | ||||||
|  | |||||||
| @ -100,7 +100,7 @@ function attributeElm(that) { | |||||||
|                   let tr = ` |                   let tr = ` | ||||||
|                     <div class="tr"> |                     <div class="tr"> | ||||||
|                       <div class="td"> |                       <div class="td"> | ||||||
|                         <input type="checkbox" value="${data.data.list[i].deviceId}"> |                         <input type="checkbox" value="${'ID' in data.data.list[i] ? data.data.list[i].ID : data.data.list[i].id}"> | ||||||
|                         <span>绑定</span> |                         <span>绑定</span> | ||||||
|                       </div> |                       </div> | ||||||
|                       <div class="td">${data.data.list[i].cameraName}</div> |                       <div class="td">${data.data.list[i].cameraName}</div> | ||||||
| @ -126,8 +126,11 @@ function attributeElm(that) { | |||||||
|                     } |                     } | ||||||
|                     else { |                     else { | ||||||
|                       let newArray = that.attributeCamera.filter((item) => { |                       let newArray = that.attributeCamera.filter((item) => { | ||||||
|                         if ('deviceId' in data.data.list[i]) { |                         if ('ID' in data.data.list[i]) { | ||||||
|                           return item.deviceId !== data.data.list[i].deviceId |                           return item.ID !== data.data.list[i].ID | ||||||
|  |                         } | ||||||
|  |                         else { | ||||||
|  |                           return item.id !== data.data.list[i].id | ||||||
|                         } |                         } | ||||||
|                       }) |                       }) | ||||||
|                       that.attributeCamera = newArray |                       that.attributeCamera = newArray | ||||||
| @ -136,7 +139,7 @@ function attributeElm(that) { | |||||||
|                   tableContent.appendChild(trElm) |                   tableContent.appendChild(trElm) | ||||||
|  |  | ||||||
|                   for (let m = 0; m < that.attributeCamera.length; m++) { |                   for (let m = 0; m < that.attributeCamera.length; m++) { | ||||||
|                     if (('deviceId' in data.data.list[i]) ? (that.attributeCamera[m].deviceId === data.data.list[i].deviceId):false) { |                     if (('ID' in data.data.list[i]) ? (that.attributeCamera[m].ID === data.data.list[i].ID) : (that.attributeCamera[m].id === data.data.list[i].id)) { | ||||||
|                       checkbox.checked = true |                       checkbox.checked = true | ||||||
|                       break |                       break | ||||||
|                     } |                     } | ||||||
| @ -197,9 +200,17 @@ function attributeElm(that) { | |||||||
|                   for (let i = that.attributeCamera.length - 1; i >= 0; i--) { |                   for (let i = that.attributeCamera.length - 1; i >= 0; i--) { | ||||||
|                     let flag = false |                     let flag = false | ||||||
|                     for (let m = 0; m < data.data.list.length; m++) { |                     for (let m = 0; m < data.data.list.length; m++) { | ||||||
|                       if (that.attributeCamera[i].deviceId === data.data.list[m].deviceId) { |                       if ('ID' in data.data.list[m]) { | ||||||
|                         flag = true |                         if (that.attributeCamera[i].ID === data.data.list[m].ID) { | ||||||
|                         break |                           flag = true | ||||||
|  |                           break | ||||||
|  |                         } | ||||||
|  |                       } | ||||||
|  |                       if ('id' in data.data.list[m]) { | ||||||
|  |                         if (that.attributeCamera[i].id === data.data.list[m].id) { | ||||||
|  |                           flag = true | ||||||
|  |                           break | ||||||
|  |                         } | ||||||
|                       } |                       } | ||||||
|                     } |                     } | ||||||
|                     if (!flag) { |                     if (!flag) { | ||||||
|  | |||||||
| @ -56,8 +56,8 @@ class richText { | |||||||
|       MENU_CONF: { |       MENU_CONF: { | ||||||
|         uploadImage: { |         uploadImage: { | ||||||
|           fieldName: 'file', |           fieldName: 'file', | ||||||
|           // maxFileSize: 50 * 1024 * 1024, |           maxFileSize: 50 * 1024 * 1024, | ||||||
|           // base64LimitSize: 50 * 1024 * 1024, // 50M 以下插入 base64 |           base64LimitSize: 50 * 1024 * 1024, // 50M 以下插入 base64 | ||||||
|           server: this.uploadImageServer, |           server: this.uploadImageServer, | ||||||
|           // // 上传之前触发 |           // // 上传之前触发 | ||||||
|           // onBeforeUpload(file) { // TS 语法 |           // onBeforeUpload(file) { // TS 语法 | ||||||
| @ -95,18 +95,18 @@ class richText { | |||||||
|           //   console.log(`${file.name} 上传出错`, err, res) |           //   console.log(`${file.name} 上传出错`, err, res) | ||||||
|           // }, |           // }, | ||||||
|  |  | ||||||
|           // 自定义上传 |           // // 自定义上传 | ||||||
|           async customUpload(file, insertFn) {  // TS 语法 |           // async customUpload(file, insertFn) {  // TS 语法 | ||||||
|             // async customUpload(file, insertFn) {                   // JS 语法 |           //   // async customUpload(file, insertFn) {                   // JS 语法 | ||||||
|             // file 即选中的文件 |           //   // file 即选中的文件 | ||||||
|             // 自己实现上传,并得到图片 url alt href |           //   // 自己实现上传,并得到图片 url alt href | ||||||
|             // 最后插入图片 |           //   // 最后插入图片 | ||||||
|             let url = await _this.upload(file) |           //   console.log(file, insertFn) | ||||||
|             insertFn((_this.host = _this.host || getHost()) + '/' + url) |           //   insertFn(url, file.name) | ||||||
|           } |           // } | ||||||
|         }, |         }, | ||||||
|         uploadVideo: { |         uploadVideo: { | ||||||
|           // maxFileSize: 500 * 1024 * 1024, |           maxFileSize: 500 * 1024 * 1024, | ||||||
|           server: this.uploadVideoServer, |           server: this.uploadVideoServer, | ||||||
|           allowedFileTypes: ['video/mp4', 'video/mp3', 'video/ogg', 'video/webm', 'video/avi'], |           allowedFileTypes: ['video/mp4', 'video/mp3', 'video/ogg', 'video/webm', 'video/avi'], | ||||||
|           // 自定义上传 |           // 自定义上传 | ||||||
|  | |||||||
| @ -50,8 +50,7 @@ export default class CircleDiffuseMaterialProperty { | |||||||
|       let color = this.colors[ratio[i]] |       let color = this.colors[ratio[i]] | ||||||
|       _sourceColor = _sourceColor + ` |       _sourceColor = _sourceColor + ` | ||||||
|         if(dis < float(${Number(ratio[i]) / 2})) { |         if(dis < float(${Number(ratio[i]) / 2})) { | ||||||
|           material.diffuse = vec4(0.0,0.0,0.0,0.0).rgb; |           material.diffuse = 1.5 * vec4(${color.red},${color.green},${color.blue},${color.alpha}).rgb; | ||||||
|           material.emission = 1.0 * vec4(${color.red},${color.green},${color.blue},${color.alpha}).rgb; |  | ||||||
|         } |         } | ||||||
|         ` |         ` | ||||||
|     } |     } | ||||||
| @ -111,7 +110,7 @@ export default class CircleDiffuseMaterialProperty { | |||||||
|             transparency: 1, |             transparency: 1, | ||||||
|             count: 4, |             count: 4, | ||||||
|             gradient: 0.2, |             gradient: 0.2, | ||||||
|             frameNumber: Cesium.getTimestamp(), |             frameNumber:  Cesium.getTimestamp(), | ||||||
|           }, |           }, | ||||||
|           source: this._source, |           source: this._source, | ||||||
|         }, |         }, | ||||||
|  | |||||||
| @ -1,113 +0,0 @@ | |||||||
| /* |  | ||||||
|  * @Description: 流动线 |  | ||||||
|  */ |  | ||||||
| function RoadTexture() { |  | ||||||
|   class RoadTextureMaterialProperty { |  | ||||||
|     constructor(options) { |  | ||||||
|       this._definitionChanged = new Cesium.Event(); |  | ||||||
|       this._image = undefined; |  | ||||||
|       this._repeat = undefined; |  | ||||||
|       this._stRotation = undefined; |  | ||||||
|       this._repeatLength = undefined; |  | ||||||
|       this.image = options.image || ""; |  | ||||||
|       this.repeat = options.repeat || 1.0; |  | ||||||
|       this.stRotation = options.stRotation || 0.0; |  | ||||||
|       // this.rotations = options.rotations || new Array(100).fill(0.0); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     get isConstant() { |  | ||||||
|       return false; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     get definitionChanged() { |  | ||||||
|       return this._definitionChanged; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     getType(time) { |  | ||||||
|       return Cesium.Material.RoadTextureMaterialType; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     getValue(time, result) { |  | ||||||
|       if (!Cesium.defined(result)) { |  | ||||||
|         result = {}; |  | ||||||
|       } |  | ||||||
|       result.image = Cesium.Property.getValueOrDefault( |  | ||||||
|         this._image, |  | ||||||
|         time, |  | ||||||
|         "", |  | ||||||
|         result.image |  | ||||||
|       ); |  | ||||||
|       result.repeat = Cesium.Property.getValueOrDefault( |  | ||||||
|         this._repeat, |  | ||||||
|         time, |  | ||||||
|         1.0, |  | ||||||
|         result.repeat |  | ||||||
|       ); |  | ||||||
|       result.stRotation = Cesium.Property.getValueOrDefault( |  | ||||||
|         this._stRotation, |  | ||||||
|         time, |  | ||||||
|         0.0, |  | ||||||
|         result.stRotation |  | ||||||
|       ); |  | ||||||
|       console.log(result, 'result') |  | ||||||
|       return result; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     equals(other) { |  | ||||||
|       return ( |  | ||||||
|         this === other || |  | ||||||
|         (other instanceof RoadTextureMaterialProperty && |  | ||||||
|           Cesium.Property.equals(this._image, other._image) && |  | ||||||
|           Cesium.Property.equals(this._repeat, other._repeat) && |  | ||||||
|           // Cesium.Property.equals(this._rotations, other._rotations) && |  | ||||||
|           Cesium.Property.equals(this._stRotation, other._stRotation) |  | ||||||
|         ) |  | ||||||
|       ); |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   Object.defineProperties(RoadTextureMaterialProperty.prototype, { |  | ||||||
|     image: Cesium.createPropertyDescriptor("image"), |  | ||||||
|     repeat: Cesium.createPropertyDescriptor("repeat"), |  | ||||||
|     repeatLength: Cesium.createPropertyDescriptor("stRotation"), |  | ||||||
|   }); |  | ||||||
|  |  | ||||||
|   Cesium.RoadTextureMaterialProperty = RoadTextureMaterialProperty; |  | ||||||
|   Cesium.Material.RoadTextureMaterialProperty = "RoadTextureMaterialProperty"; |  | ||||||
|   Cesium.Material.RoadTextureMaterialType = "RoadTextureMaterialType"; |  | ||||||
|   Cesium.Material.RoadTextureMaterialSource = ` |  | ||||||
|         uniform sampler2D image; |  | ||||||
|         uniform float repeat; |  | ||||||
|         czm_material czm_getMaterial(czm_materialInput materialInput) |  | ||||||
|         { |  | ||||||
|           czm_material material = czm_getDefaultMaterial(materialInput); |  | ||||||
|           vec2 st = materialInput.st; |  | ||||||
|           st.s *= repeat; |  | ||||||
|           mat2 rot = mat2(cos(stRotation), -sin(stRotation), sin(stRotation), cos(stRotation)); |  | ||||||
|           vec2 newSt = rot * (st - 0.5) + 0.5; |  | ||||||
|  |  | ||||||
|           vec4 colorImage = texture2D(image, newSt); |  | ||||||
|           material.diffuse = colorImage.rgb; |  | ||||||
|           return material; |  | ||||||
|         } |  | ||||||
|        `; |  | ||||||
|   Cesium.Material._materialCache.addMaterial( |  | ||||||
|     Cesium.Material.RoadTextureMaterialType, |  | ||||||
|     { |  | ||||||
|       fabric: { |  | ||||||
|         type: Cesium.Material.RoadTextureMaterialType, |  | ||||||
|         uniforms: { |  | ||||||
|           image: '', |  | ||||||
|           repeat: 1.0, |  | ||||||
|           stRotation: 0.0, |  | ||||||
|         }, |  | ||||||
|         source: Cesium.Material.RoadTextureMaterialSource, |  | ||||||
|       }, |  | ||||||
|       translucent: function (material) { |  | ||||||
|         return true; |  | ||||||
|       }, |  | ||||||
|     } |  | ||||||
|   ); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| export { RoadTexture } |  | ||||||
| @ -70,7 +70,7 @@ function StreamWall1() { | |||||||
|       fragColor.rgb = color.rgb / 1.0;\n\ |       fragColor.rgb = color.rgb / 1.0;\n\ | ||||||
|       fragColor = czm_gammaCorrect(fragColor);\n\ |       fragColor = czm_gammaCorrect(fragColor);\n\ | ||||||
|       material.alpha = colorImage.a * color.a;\n\ |       material.alpha = colorImage.a * color.a;\n\ | ||||||
|       material.diffuse = color.rgb/20.0;\n\ |       material.diffuse = (colorImage.rgb+color.rgb)/2.0;\n\ | ||||||
|       material.emission = fragColor.rgb;\n\ |       material.emission = fragColor.rgb;\n\ | ||||||
|       return material;\n\ |       return material;\n\ | ||||||
|       }"; |       }"; | ||||||
| @ -208,14 +208,6 @@ function StreamWall2() { | |||||||
|           Property.equals(this.repeat, other._repeat) && |           Property.equals(this.repeat, other._repeat) && | ||||||
|           Property.equals(this.repeats, other._repeats) |           Property.equals(this.repeats, other._repeats) | ||||||
|       }; |       }; | ||||||
|       // let code2 = 'material.diffuse = color.rgb*1.0;' |  | ||||||
|       // if (uniforms.is2D) { |  | ||||||
|       //   code2 = ` |  | ||||||
|       //     material.diffuse = color.rgb*0.0; |  | ||||||
|       //     material.emission = color.rgb * 1.0; |  | ||||||
|       //   ` |  | ||||||
|       // } |  | ||||||
|       // console.log(code2, uniforms.is2D) |  | ||||||
|       // 将定义的材质对象添加到cesium的材质队列中 |       // 将定义的材质对象添加到cesium的材质队列中 | ||||||
|       Material._materialCache.addMaterial(MaterialType, { |       Material._materialCache.addMaterial(MaterialType, { | ||||||
|         fabric: { |         fabric: { | ||||||
| @ -238,8 +230,8 @@ function StreamWall2() { | |||||||
|               else { |               else { | ||||||
|                 material.alpha = 1.0; |                 material.alpha = 1.0; | ||||||
|               } |               } | ||||||
|               material.diffuse = colorImage.rgb * color.rgb*0.0; |               material.diffuse = colorImage.rgb*color.rgb*0.0; | ||||||
|               material.emission = colorImage.rgb * color.rgb * 1.0; |               material.emission = colorImage.rgb*color.rgb * 1.4; | ||||||
|               return material; |               return material; | ||||||
|           }`, |           }`, | ||||||
|           components: { |           components: { | ||||||
|  | |||||||
| @ -7,7 +7,6 @@ import { PolylineFlow } from './PolylineFlowMaterialProperty' | |||||||
| import { PolylineFlowMult } from './PolylineFlowMultMaterialProperty' | import { PolylineFlowMult } from './PolylineFlowMultMaterialProperty' | ||||||
| import { FlowDashedLine } from './FlowDashedLineFlowMaterialProperty' | import { FlowDashedLine } from './FlowDashedLineFlowMaterialProperty' | ||||||
| import { LineTexture } from './LineTextureMaterialProperty' | import { LineTexture } from './LineTextureMaterialProperty' | ||||||
| import { RoadTexture } from './RoadTextureMaterialProperty' |  | ||||||
|  |  | ||||||
| function init_material() { | function init_material() { | ||||||
|   StreamWall1() |   StreamWall1() | ||||||
| @ -20,7 +19,6 @@ function init_material() { | |||||||
|   PolylineFlowMult() |   PolylineFlowMult() | ||||||
|   FlowDashedLine() |   FlowDashedLine() | ||||||
|   LineTexture() |   LineTexture() | ||||||
|   RoadTexture() |  | ||||||
| } | } | ||||||
|  |  | ||||||
| export { init_material } | export { init_material } | ||||||
|  | |||||||
| @ -598,6 +598,7 @@ class Tools { | |||||||
|     if (entity) { |     if (entity) { | ||||||
|       arr[type + ''] ? (entity.polyline.width = entity.polyline.oriWidth + arr[type + '']) : (entity.polyline.width = entity.polyline.oriWidth) |       arr[type + ''] ? (entity.polyline.width = entity.polyline.oriWidth + arr[type + '']) : (entity.polyline.width = entity.polyline.oriWidth) | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     switch (Number(type)) { |     switch (Number(type)) { | ||||||
|  |  | ||||||
|       case 1: //虚线 |       case 1: //虚线 | ||||||
| @ -1493,30 +1494,6 @@ class Tools { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   message(option = {}) { |  | ||||||
|     let type = option.type || 'success' |  | ||||||
|     let text = option.text || '' |  | ||||||
|     let duration = option.duration || 1500 |  | ||||||
|  |  | ||||||
|     let message = document.getElementById('YJ-custom-message'); |  | ||||||
|     if (message) { |  | ||||||
|       document.body.removeChild(message) |  | ||||||
|     } |  | ||||||
|     message = document.createElement('div') |  | ||||||
|     message.id = 'YJ-custom-message' |  | ||||||
|     if (type == 'success') { |  | ||||||
|       message.innerHTML = ` |  | ||||||
|       <i><?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1755929961282" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5064" width="16" height="16" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M874.119618 149.859922A510.816461 510.816461 0 0 0 511.997 0.00208a509.910462 509.910462 0 0 0-362.119618 149.857842c-199.817789 199.679789-199.817789 524.581447 0 724.260236a509.969462 509.969462 0 0 0 362.119618 149.857842A508.872463 508.872463 0 0 0 874.119618 874.120158c199.836789-199.679789 199.836789-524.581447 0-724.260236zM814.94268 378.210681L470.999043 744.132295a15.359984 15.359984 0 0 1-5.887994 4.095996c-1.751998 1.180999-2.913997 2.362998-5.276994 2.913997a34.499964 34.499964 0 0 1-13.469986 2.914997 45.547952 45.547952 0 0 1-12.897986-2.303998l-4.095996-2.363997a45.291952 45.291952 0 0 1-7.009992-4.095996l-196.902793-193.789796a34.126964 34.126964 0 0 1-10.555989-25.186973c0-9.37399 3.583996-18.74698 9.98399-25.186974a36.429962 36.429962 0 0 1 50.372947 0l169.98382 167.423824L763.389735 330.220732a37.059961 37.059961 0 0 1 50.371947-1.732998 33.647965 33.647965 0 0 1 11.165988 25.186973 35.544963 35.544963 0 0 1-9.98399 24.575974v-0.04z m0 0" fill="#52C41A" p-id="5065"></path></svg></i>${text} |  | ||||||
|     ` |  | ||||||
|     } else if (type == 'warning') { |  | ||||||
|       message.innerHTML = ` |  | ||||||
|       <i><?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1756093599258" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1648" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16"><path d="M512.002558 64.24521c-247.292176 0-447.75786 200.464661-447.75786 447.756837 0 247.287059 200.464661 447.752744 447.75786 447.752744 247.286036 0 447.75172-200.464661 447.75172-447.752744C959.754279 264.710894 759.288594 64.24521 512.002558 64.24521zM512.010745 735.87586c-20.602224 0-37.319977-16.718777-37.319977-37.323047 0-20.597107 16.717753-37.319977 37.319977-37.319977 20.60427 0 37.297464 16.72287 37.297464 37.319977C549.308209 719.158107 532.613992 735.87586 512.010745 735.87586zM549.308209 567.969733c0 20.600177-16.693194 37.293371-37.297464 37.293371-20.602224 0-37.319977-16.693194-37.319977-37.293371L474.690768 325.420581c0-20.605294 16.717753-37.297464 37.319977-37.297464 20.60427 0 37.297464 16.693194 37.297464 37.297464L549.308209 567.969733z" fill="#e98f36" p-id="1649"></path></svg></i>${text} |  | ||||||
|     ` |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     document.body.appendChild(message) |  | ||||||
|     message.classList.add(type) |  | ||||||
|   } |  | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | |||||||
| @ -10,7 +10,6 @@ import AModelLoader from '../Obj/Base/LoadObjModel/AModelLoader' | |||||||
| import { setSvg } from '../Obj/Element/svg' | import { setSvg } from '../Obj/Element/svg' | ||||||
| import Tools from '../Tools' | import Tools from '../Tools' | ||||||
| import { Proj } from '../Tools/proj' | import { Proj } from '../Tools/proj' | ||||||
| import { syncData, getSdk } from '../Global/MultiViewportMode' |  | ||||||
| import { | import { | ||||||
|   unRegLeftClickCallback, |   unRegLeftClickCallback, | ||||||
|   unRegRightClickCallback, |   unRegRightClickCallback, | ||||||
| @ -63,9 +62,9 @@ class YJEarth { | |||||||
|  |  | ||||||
|   removeIncetance(id) { |   removeIncetance(id) { | ||||||
|     this.entityMap.delete(id) |     this.entityMap.delete(id) | ||||||
|     unRegLeftClickCallback(this, id) |     unRegLeftClickCallback(id) | ||||||
|     unRegRightClickCallback(this, id) |     unRegRightClickCallback(id) | ||||||
|     unregMoveCallback(this, id) |     unregMoveCallback(id) | ||||||
|  |  | ||||||
|     syncSplitData(this, id) |     syncSplitData(this, id) | ||||||
|   } |   } | ||||||
| @ -152,7 +151,7 @@ class YJEarth { | |||||||
|     } |     } | ||||||
|     this.options.contextOptions = { |     this.options.contextOptions = { | ||||||
|       webgl: { |       webgl: { | ||||||
|         // alpha: true, |         alpha: true, | ||||||
|         depth: true, |         depth: true, | ||||||
|         stencil: true, |         stencil: true, | ||||||
|         antialias: true, |         antialias: true, | ||||||
| @ -420,8 +419,7 @@ class YJEarth { | |||||||
|  |  | ||||||
|     let ClickHandler = new Cesium.ScreenSpaceEventHandler(_this.viewer.canvas) |     let ClickHandler = new Cesium.ScreenSpaceEventHandler(_this.viewer.canvas) | ||||||
|     ClickHandler.setInputAction((movement) => { |     ClickHandler.setInputAction((movement) => { | ||||||
|       // let textList = document.getElementsByClassName('popup-textarea') |       let textList = document.getElementsByClassName('popup-textarea') | ||||||
|       let textList = _this.viewer._element.getElementsByClassName('popup-textarea') |  | ||||||
|       _this.isLeftClick = false |       _this.isLeftClick = false | ||||||
|       for (let i = textList.length - 1; i > -1; i--) { |       for (let i = textList.length - 1; i > -1; i--) { | ||||||
|         let left = returnNumber(textList[i].style.left) |         let left = returnNumber(textList[i].style.left) | ||||||
| @ -433,20 +431,11 @@ class YJEarth { | |||||||
|         if (x > left && x < left + width && y > top && y < top + height) { |         if (x > left && x < left + width && y > top && y < top + height) { | ||||||
|           if (_this.clickTextDom) { |           if (_this.clickTextDom) { | ||||||
|             _this.clickTextDom.style['pointer-events'] = 'none' |             _this.clickTextDom.style['pointer-events'] = 'none' | ||||||
|             _this.clickTextDom.querySelector('textarea').removeEventListener('blur', _this.blurFun) |  | ||||||
|           } |           } | ||||||
|  |  | ||||||
|           _this.clickTextDom = textList[i] |           _this.clickTextDom = textList[i] | ||||||
|           textList[i].style['pointer-events'] = 'all' |           textList[i].style['pointer-events'] = 'all' | ||||||
|           textList[i].querySelector('textarea').focus() |           textList[i].querySelector('textarea').focus() | ||||||
|           _this.isLeftClick = true |           _this.isLeftClick = true | ||||||
|           _this.entityMap.get(_this.clickTextDom.id).isClick(movement.position, _this.clickTextDom.id) |  | ||||||
|  |  | ||||||
|           _this.blurFun = () => { |  | ||||||
|             _this.entityMap.get(_this.clickTextDom.id).isClick((movement && movement.position) || null, _this.clickTextDom.id) |  | ||||||
|             _this.entityMap.get(_this.clickTextDom.id).getwords(_this.clickTextDom.getElementsByTagName('textarea')[0].value) |  | ||||||
|           } |  | ||||||
|           _this.clickTextDom.querySelector('textarea').addEventListener('blur', _this.blurFun) |  | ||||||
|           break; |           break; | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
| @ -477,11 +466,6 @@ class YJEarth { | |||||||
|             x: e.clientX - layerX + width / 2, |             x: e.clientX - layerX + width / 2, | ||||||
|             y: e.clientY - layerY + height, |             y: e.clientY - layerY + height, | ||||||
|           } |           } | ||||||
|           let { sdkP } = getSdk() |  | ||||||
|           if (_this != sdkP && sdkP) {//二维 |  | ||||||
|             let num = sdkP.viewer._element.clientWidth |  | ||||||
|             param.x = param.x - num |  | ||||||
|           } |  | ||||||
|           _this.entityMap.get(_this.clickTextDom.id).setHandeler(param) |           _this.entityMap.get(_this.clickTextDom.id).setHandeler(param) | ||||||
|  |  | ||||||
|         } |         } | ||||||
| @ -493,15 +477,14 @@ class YJEarth { | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         _this.clickTextDom.addEventListener('mousedown', mousedown); |         _this.clickTextDom.addEventListener('mousedown', mousedown); | ||||||
|         _this.viewer._element.addEventListener('mousemove', mousemove); |         document.addEventListener('mousemove', mousemove); | ||||||
|         _this.viewer._element.addEventListener('mouseup', mouseup); |         document.addEventListener('mouseup', mouseup); | ||||||
|       } |       } | ||||||
|       // 点击其他地方取消 |       // 点击其他地方取消 | ||||||
|       if (!_this.isLeftClick && _this.clickTextDom) { |       if (!_this.isLeftClick && _this.clickTextDom) { | ||||||
|         _this.clickTextDom.removeEventListener('mousedown', mousedown); |         _this.clickTextDom.removeEventListener('mousedown', mousedown); | ||||||
|         _this.viewer._element.removeEventListener('mousemove', mousemove); |         document.removeEventListener('mousemove', mousemove); | ||||||
|         _this.viewer._element.removeEventListener('mouseup', mouseup); |         document.removeEventListener('mouseup', mouseup); | ||||||
|         _this.entityMap.get(_this.clickTextDom.id).getwords(_this.clickTextDom.getElementsByTagName('textarea')[0].value) |  | ||||||
|  |  | ||||||
|         _this.clickTextDom.style['pointer-events'] = 'none' |         _this.clickTextDom.style['pointer-events'] = 'none' | ||||||
|         _this.clickTextDom = undefined |         _this.clickTextDom = undefined | ||||||
|  | |||||||
| @ -1429,24 +1429,6 @@ | |||||||
|   margin-bottom: 10px; |   margin-bottom: 10px; | ||||||
|   display: flex; |   display: flex; | ||||||
|   position: relative; |   position: relative; | ||||||
|   overflow-y: auto; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .DIV-cy-tabs .DIV-cy-tab-top::-webkit-scrollbar { |  | ||||||
|   width: 4px; |  | ||||||
|   height: 4px; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .DIV-cy-tabs .DIV-cy-tab-top::-webkit-scrollbar-thumb { |  | ||||||
|   border-radius: 5px; |  | ||||||
|   -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2); |  | ||||||
|   background-color: rgba(var(--color-sdk-base-rgb)); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .DIV-cy-tabs .DIV-cy-tab-top::-webkit-scrollbar-track { |  | ||||||
|   -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2); |  | ||||||
|   border-radius: 5px; |  | ||||||
|   background-color: rgba(var(--color-sdk-base-rgb), 0.1); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| .DIV-cy-tabs .DIV-cy-tab-top::after { | .DIV-cy-tabs .DIV-cy-tab-top::after { | ||||||
| @ -1491,14 +1473,7 @@ | |||||||
|   border-bottom: 2px solid #dddddd00; |   border-bottom: 2px solid #dddddd00; | ||||||
|   position: relative; |   position: relative; | ||||||
|   z-index: 2; |   z-index: 2; | ||||||
|   white-space: nowrap; |  | ||||||
|   user-select: none; |  | ||||||
|   cursor: pointer; |   cursor: pointer; | ||||||
|   -webkit-pointer-events: auto; |  | ||||||
|   -moz-pointer-events: auto; |  | ||||||
|   -ms-pointer-events: auto; |  | ||||||
|   -o-pointer-events: auto; |  | ||||||
|   pointer-events: auto; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| .DIV-cy-tabs .DIV-cy-tab-pane-title-p span { | .DIV-cy-tabs .DIV-cy-tab-pane-title-p span { | ||||||
| @ -2743,7 +2718,7 @@ | |||||||
|  |  | ||||||
| /* 贴地svg */ | /* 贴地svg */ | ||||||
| .YJ-custom-base-dialog.ground-svg>.content { | .YJ-custom-base-dialog.ground-svg>.content { | ||||||
|   width: 535px; |   width: 560px; | ||||||
| } | } | ||||||
|  |  | ||||||
| .YJ-custom-base-dialog.ground-svg>.content>div .div-item:nth-of-type(2) .row .col .label { | .YJ-custom-base-dialog.ground-svg>.content>div .div-item:nth-of-type(2) .row .col .label { | ||||||
| @ -3122,9 +3097,9 @@ | |||||||
| /* 文本框 */ | /* 文本框 */ | ||||||
| .popup-textarea{ | .popup-textarea{ | ||||||
|   /* width: 212px; */ |   /* width: 212px; */ | ||||||
|   width: 161px; |   width: 161.6px; | ||||||
|   /* height: 154px; */ |   /* height: 154px; */ | ||||||
|   height: 119px; |   height: 119.2px; | ||||||
|   display: block; |   display: block; | ||||||
|   pointer-events: none; |   pointer-events: none; | ||||||
|   position: absolute; |   position: absolute; | ||||||
| @ -3134,8 +3109,6 @@ | |||||||
|   padding: 5px 5px 0px 5px; |   padding: 5px 5px 0px 5px; | ||||||
| } | } | ||||||
| .popup-textarea textarea{ | .popup-textarea textarea{ | ||||||
|   width: 158px; |  | ||||||
|   height: 95px; |  | ||||||
|   background-color: unset!important; |   background-color: unset!important; | ||||||
|   border: unset!important; |   border: unset!important; | ||||||
|   color: #fff; |   color: #fff; | ||||||
| @ -3493,7 +3466,6 @@ | |||||||
|   cursor: e-resize; |   cursor: e-resize; | ||||||
|   background-color: #d3d3d3; |   background-color: #d3d3d3; | ||||||
|   user-select: none; |   user-select: none; | ||||||
|   z-index: 1; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| .cesium-performanceDisplay-defaultContainer { | .cesium-performanceDisplay-defaultContainer { | ||||||
| @ -3614,36 +3586,22 @@ | |||||||
|   border: 1.5px solid; |   border: 1.5px solid; | ||||||
|   border-image: linear-gradient(to bottom, var(--color-sdk-gradual)) 1; |   border-image: linear-gradient(to bottom, var(--color-sdk-gradual)) 1; | ||||||
|   color: #fff; |   color: #fff; | ||||||
|   min-width: 200px; |  | ||||||
|   min-height: 120px; |  | ||||||
|   box-sizing: border-box; |  | ||||||
|   /* -webkit-pointer-events: none; |  | ||||||
|   -moz-pointer-events: none; |  | ||||||
|   -ms-pointer-events: none; |  | ||||||
|   -o-pointer-events: none; |  | ||||||
|   pointer-events: none; */ |  | ||||||
| } | } | ||||||
|  |  | ||||||
| .billboard-attribute-box .DIV-cy-tabs { | .billboard-attribute-box .DIV-cy-tabs { | ||||||
|   height: 100%; |   height: 100%; | ||||||
|   display: flex; |   display: flex; | ||||||
|   flex-direction: column; |   flex-direction: column; | ||||||
|   backdrop-filter: blur(2px); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| .billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-top .DIV-cy-tab-pane-title { | .billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-top .DIV-cy-tab-pane-title { | ||||||
|   padding: 0 2px; |   padding: 0 2px; | ||||||
| } | } | ||||||
|  |  | ||||||
| .billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-top .DIV-cy-tab-pane-title:first-child { | .billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-top .DIV-cy-tab-pane-title:first-child { | ||||||
|   padding-left: 0; |   padding-left: 0; | ||||||
| } | } | ||||||
|  |  | ||||||
| .billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-top .DIV-cy-tab-pane-title:last-child { | .billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-top .DIV-cy-tab-pane-title:last-child { | ||||||
|   padding-right: 0; |   padding-right: 0; | ||||||
| } | } | ||||||
|  | .billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-top .DIV-cy-tab-pane-title span{ | ||||||
| .billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-top .DIV-cy-tab-pane-title span { |  | ||||||
|   margin: 0 5px; |   margin: 0 5px; | ||||||
| } | } | ||||||
|  |  | ||||||
| @ -3651,173 +3609,4 @@ | |||||||
|   padding: 0 5px 5px 5px; |   padding: 0 5px 5px 5px; | ||||||
|   box-sizing: border-box; |   box-sizing: border-box; | ||||||
|   flex: 1; |   flex: 1; | ||||||
|   overflow: auto; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-content::-webkit-scrollbar { |  | ||||||
|   width: 8px; |  | ||||||
|   height: 8px; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-content::-webkit-scrollbar-thumb { |  | ||||||
|   border-radius: 5px; |  | ||||||
|   -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2); |  | ||||||
|   background-color: rgba(var(--color-sdk-base-rgb)); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-content::-webkit-scrollbar-track { |  | ||||||
|   -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2); |  | ||||||
|   border-radius: 5px; |  | ||||||
|   background-color: rgba(var(--color-sdk-base-rgb), 0.1); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-content-pane { |  | ||||||
|   width: 100%; |  | ||||||
|   height: 100%; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-content-pane iframe { |  | ||||||
|   border: none; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .billboard-attribute-box .billboard-attribute-box-line { |  | ||||||
|   position: absolute; |  | ||||||
|   width: 0px; |  | ||||||
|   /* border-left: 1px solid rgba(var(--color-sdk-base-rgb), 0.5); */ |  | ||||||
|   border-left: 1px solid rgba(var(--color-sdk-base-rgb), 1); |  | ||||||
|   /* transform: rotate(45deg); */ |  | ||||||
|   transform-origin: 0px 0px; |  | ||||||
|   -webkit-pointer-events: none; |  | ||||||
|   -moz-pointer-events: none; |  | ||||||
|   -ms-pointer-events: none; |  | ||||||
|   -o-pointer-events: none; |  | ||||||
|   pointer-events: none; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .billboard-attribute-box .drag-nook { |  | ||||||
|   position: absolute; |  | ||||||
|   width: 12px; |  | ||||||
|   height: 12px; |  | ||||||
|   display: block; |  | ||||||
|   user-select: none; |  | ||||||
|   -webkit-pointer-events: auto; |  | ||||||
|   -moz-pointer-events: auto; |  | ||||||
|   -ms-pointer-events: auto; |  | ||||||
|   -o-pointer-events: auto; |  | ||||||
|   pointer-events: auto; |  | ||||||
|   z-index: 3; |  | ||||||
|   clip-path: polygon(0% 100%, 100% 100%, 50% 50%); |  | ||||||
|   background-image: linear-gradient(to top, #ffffff 1px, #00000000 1px); |  | ||||||
|   background-size: 100% 3px; |  | ||||||
|   /* background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAJRJREFUWEftltsJgFAMQ5NNdBJ1Eh3NTdRJdJPIBQXF50/p/WgHSNNDCSGch877EQbyIyCpBtAa/cZEsj9qXwhImgEURgZA8rTzzkAiYGVgITm+ErC6/Ek3vycMAkHAnYCkAUDKAosZSTaeSZiCqIwgCgJBIG8CWyXzKySSZBGBu+afStYBqIxMfJdSo8WPslHJgsAKWjkmIRBy/c8AAAAASUVORK5CYII='); */ |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .billboard-attribute-box .drag-nook.left-top { |  | ||||||
|   top: -6px; |  | ||||||
|   left: -6px; |  | ||||||
|   cursor: se-resize; |  | ||||||
|   transform: rotate(-45deg); |  | ||||||
|   display: none; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .billboard-attribute-box .drag-nook.right-top { |  | ||||||
|   top: -6px; |  | ||||||
|   right: -6px; |  | ||||||
|   cursor: ne-resize; |  | ||||||
|   transform: rotate(45deg); |  | ||||||
|   display: none; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .billboard-attribute-box .table { |  | ||||||
|   background-color: #ffffff00; |  | ||||||
|   color: #ffffff; |  | ||||||
|   overflow: hidden; |  | ||||||
|   border: 1px solid rgba(var(--color-sdk-base-rgb), 0.5); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .billboard-attribute-box .table .table-head .tr { |  | ||||||
|   border-top: none; |  | ||||||
|   border-left: none; |  | ||||||
|   border-right: none; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .billboard-attribute-box .table .tr { |  | ||||||
|   display: flex; |  | ||||||
|   border: 1px solid rgba(var(--color-sdk-base-rgb), 0.5); |  | ||||||
|   border-right: none; |  | ||||||
| } |  | ||||||
| .billboard-attribute-box .table .tr .th, .billboard-attribute-box .table .tr .td { |  | ||||||
|   border-right: 1px solid rgba(var(--color-sdk-base-rgb), 0.5); |  | ||||||
|   display: flex; |  | ||||||
|   justify-content: center; |  | ||||||
| } |  | ||||||
| .billboard-attribute-box .table .tr .th:last-child, .billboard-attribute-box .table .tr .td:last-child { |  | ||||||
|   border-right: none; |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| .billboard-attribute-box .table .table-body .tr { |  | ||||||
|   border-bottom: none; |  | ||||||
|   border-left: none; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .billboard-attribute-box .table .table-body .tr:first-child { |  | ||||||
|   border-top: none; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* 自定义提示 */ |  | ||||||
| #YJ-custom-message { |  | ||||||
|   /* 固定在顶部中央 */ |  | ||||||
|   position: fixed; |  | ||||||
|   top: 0; |  | ||||||
|   left: 50%; |  | ||||||
|   transform: translate(-50%, 0%); |  | ||||||
|   /* 初始位置在屏幕顶部外 */ |  | ||||||
|  |  | ||||||
|   /* 样式美化 */ |  | ||||||
|   display: flex; |  | ||||||
|   border-radius: 4px; |  | ||||||
|   font-size: 14px; |  | ||||||
|   padding: 15px 20px; |  | ||||||
|   width: 380px; |  | ||||||
|   box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); |  | ||||||
|   z-index: 9999999; |  | ||||||
|  |  | ||||||
|  |  | ||||||
|   /* 动画定义 */ |  | ||||||
|   animation: YJ-custom-message-slideDown 0.5s forwards, |  | ||||||
|     YJ-custom-message-fadeOut 0.5s 1500ms forwards; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| #YJ-custom-message i { |  | ||||||
|   margin: 2px 10px 0 0; |  | ||||||
|   display: flex; |  | ||||||
|   align-items: center; |  | ||||||
|   width: 16px; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| #YJ-custom-message.success { |  | ||||||
|   background-color: #f0f9eb; |  | ||||||
|   color: rgb(82, 196, 26); |  | ||||||
| } |  | ||||||
| #YJ-custom-message.warning { |  | ||||||
|   background-color: #fdf6ec; |  | ||||||
|   color: #e6a23c; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* 滑入动画 */ |  | ||||||
| @keyframes YJ-custom-message-slideDown { |  | ||||||
|   to { |  | ||||||
|     top: 20px; |  | ||||||
|     /* 移动到屏幕顶部 */ |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* 淡出动画 - 1500ms后执行 */ |  | ||||||
| @keyframes YJ-custom-message-fadeOut { |  | ||||||
|   to { |  | ||||||
|     opacity: 0; |  | ||||||
|     top: -200px |  | ||||||
|       /* 移回顶部外 */ |  | ||||||
|   } |  | ||||||
| } | } | ||||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 40 KiB | 
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 1.9 KiB | 
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 47 KiB | 
		Reference in New Issue
	
	Block a user