Compare commits
	
		
			146 Commits
		
	
	
		
			05c69c034e
			...
			project
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| be1614b50b | |||
| 8287a00832 | |||
| 5dd7303a6a | |||
| 56910ff8ab | |||
| 229fd9037f | |||
| 24a0078eea | |||
| 6c84baa3c2 | |||
| 22e4652528 | |||
| c6f3138e25 | |||
| 819166bae0 | |||
| 159ade36f0 | |||
| f8443b7f62 | |||
| 7feab0786a | |||
| 5ceaa3b649 | |||
| 9f216b7257 | |||
| 4247327bfa | |||
| 1a394336ff | |||
| 1856bc85e3 | |||
| dff3739a0f | |||
| 53d2f06918 | |||
| cb2741862a | |||
| ce065fb845 | |||
| f37f95d646 | |||
| 6117e74a44 | |||
| ec41c867d4 | |||
| a7a743a394 | |||
| fb2681fdbe | |||
| 427b38a6c3 | |||
| 1d6b635f7a | |||
| 5b788a74d4 | |||
| b5e21fec3c | |||
| 1a1aa9f6a5 | |||
| 1229226e8f | |||
| 979a285295 | |||
| 18cec0d742 | |||
| 1ea59d0f8a | |||
| 2d1bc61cca | |||
| 5f6211a01d | |||
| 97c0d13a88 | |||
| 8618508d3f | |||
| dd213e8337 | |||
| a293246c07 | |||
| 9d1c25e8ef | |||
| c08dfb0f85 | |||
| 15460702f9 | |||
| 2c27391058 | |||
| 80869050e1 | |||
| 8025a298a2 | |||
| 0f518ef6cb | |||
| 1af43bb6a9 | |||
| ea80fe325c | |||
| e8e1e320b3 | |||
| 4f0c0ca76d | |||
| 2aade7eef9 | |||
| 71988d8833 | |||
| dd1c7acde1 | |||
| b2d307b308 | |||
| 4f57ac3d9e | |||
| 3d0493e0dd | |||
| 65ee6b70ba | |||
| ed18fd776b | |||
| dd7af5aa4d | |||
| 4d35b29526 | |||
| 56ad8ae7a0 | |||
| e342fa1d80 | |||
| 8eb1bd98cc | |||
| 644c0d2e28 | |||
| e51357efa7 | |||
| 379a560fbc | |||
| a4cd365c83 | |||
| 3358221da9 | |||
| f1e0ac166e | |||
| 3fab8ea031 | |||
| de4aead219 | |||
| ef2c158727 | |||
| 9ecb3c7269 | |||
| 1936a142b1 | |||
| a9594ccec2 | |||
| 23420762ca | |||
| 04ccdc73ca | |||
| 2e301cd0fc | |||
| d1bcba6a13 | |||
| 6729b60806 | |||
| 7be9a6a41d | |||
| 25a7c967bb | |||
| 713f03284b | |||
| 08bdd515a9 | |||
| eec0ca44c0 | |||
| 9f35d752c2 | |||
| 22f9693957 | |||
| e022aa5ef1 | |||
| 4411c9d17d | |||
| b4f7e7ad8f | |||
| d7ecd6d865 | |||
| a6fb1af6f9 | |||
| d17b038388 | |||
| fff8041faa | |||
| 20ae03cc5e | |||
| ebaa10a79b | |||
| b7e0249757 | |||
| 67540c1808 | |||
| a888969c5d | |||
| 6bd3778ad9 | |||
| 0007343353 | |||
| e6da82c76c | |||
| d8962ff3cc | |||
| 7958e40494 | |||
| 00f1a40e2a | |||
| e38dd4d029 | |||
| 656a21a6dd | |||
| bdc7e58263 | |||
| d47ab3715d | |||
| 20a9388579 | |||
| ef3a682724 | |||
| 4954b51176 | |||
| 01e2422444 | |||
| 7a00e78145 | |||
| e2657ce0a8 | |||
| 76f4b707a6 | |||
| 01d82c16c9 | |||
| 8afd3138f4 | |||
| 3bbc71065a | |||
| 53ba8cb014 | |||
| 829d1a59f7 | |||
| 8ca3576c3e | |||
| a79c09b45d | |||
| f2a198ddaf | |||
| 72fc510167 | |||
| 552c086d3a | |||
| 603421ea87 | |||
| 9e0a43a75f | |||
| 60378db79d | |||
| 7b583f761b | |||
| 50b0866520 | |||
| 01b07a6fa2 | |||
| 3b5b026d43 | |||
| 8b00dcd56e | |||
| 294e38ed31 | |||
| 4bf05f109e | |||
| 6917b19ae8 | |||
| b3749b2a16 | |||
| 314f2a58b5 | |||
| 32066bbf99 | |||
| 6a71f41a19 | |||
| 3eadec9b11 | |||
| ea7feea226 | 
| @ -1,5 +1,5 @@ | |||||||
| class BaseDialog { | class BaseDialog { | ||||||
|   constructor(container, options = {}) { |   constructor(container, options = {}, only = true) { | ||||||
|     this.container = container |     this.container = container | ||||||
|     this.options = { ...options } |     this.options = { ...options } | ||||||
|     this.options.ismove = true |     this.options.ismove = true | ||||||
| @ -9,10 +9,13 @@ class BaseDialog { | |||||||
|     this.closeCallBack = options.closeCallBack |     this.closeCallBack = options.closeCallBack | ||||||
|     this._element = {} |     this._element = {} | ||||||
|     this._element_style = undefined |     this._element_style = undefined | ||||||
|  |     this.only = only | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   async init() { |   async init() { | ||||||
|     this.closeAll() |     if (this.only) { | ||||||
|  |       this.closeAll() | ||||||
|  |     } | ||||||
|     DialogAll.push(this) |     DialogAll.push(this) | ||||||
|     this.isDestroy = false |     this.isDestroy = false | ||||||
|     // body |     // body | ||||||
| @ -48,6 +51,15 @@ class BaseDialog { | |||||||
|     <button class="close">关闭</button> |     <button class="close">关闭</button> | ||||||
|     ` |     ` | ||||||
|     this._element.body.appendChild(this._element.foot) |     this._element.body.appendChild(this._element.foot) | ||||||
|  |     let curtain = await document.createElement('div') | ||||||
|  |     curtain.style.position = 'absolute' | ||||||
|  |     curtain.style.top = '0' | ||||||
|  |     curtain.style.left = '0' | ||||||
|  |     curtain.style.width = '100%' | ||||||
|  |     curtain.style.height = '100%' | ||||||
|  |     curtain.style.backdropFilter = 'blur(2px)' | ||||||
|  |     curtain.style.zIndex = '-999999' | ||||||
|  |     this._element.body.appendChild(curtain) | ||||||
|  |  | ||||||
|     // 关闭 |     // 关闭 | ||||||
|     let closeBtnsBox = this._element.body.getElementsByClassName('close-box')[0]; |     let closeBtnsBox = this._element.body.getElementsByClassName('close-box')[0]; | ||||||
|  | |||||||
| @ -59,12 +59,17 @@ export default class DrawAttackArrow extends Draw { | |||||||
|           return |           return | ||||||
|         } |         } | ||||||
|         into = '3D' |         into = '3D' | ||||||
|  |         let pos84 = this.cartesian3Towgs84(cartesian, this.viewer) | ||||||
|  |         let lastPos84 = cache_positions[cache_positions.length - 1] | ||||||
|  |         if(lastPos84 && (lastPos84.lng === pos84.lng && lastPos84.lat === pos84.lat)) { | ||||||
|  |           return | ||||||
|  |         } | ||||||
|         if (!this.entityHasCreated) { |         if (!this.entityHasCreated) { | ||||||
|           let polyline_id = DrawAttackArrow.create_arrow_polygon(this) |           let polyline_id = DrawAttackArrow.create_arrow_polygon(this) | ||||||
|           this.points_ids.push(polyline_id) |           this.points_ids.push(polyline_id) | ||||||
|         } |         } | ||||||
|         this.points_ids.push(this.create_point(cartesian)) |         this.points_ids.push(this.create_point(cartesian)) | ||||||
|         cache_positions.push(this.cartesian3Towgs84(cartesian, this.viewer)) |         cache_positions.push(pos84) | ||||||
|         isMove = false |         isMove = false | ||||||
|       }) |       }) | ||||||
|       this.event.mouse_right((movement, cartesian) => { |       this.event.mouse_right((movement, cartesian) => { | ||||||
|  | |||||||
| @ -13,6 +13,7 @@ class DrawPolygon extends Draw { | |||||||
|    * */ |    * */ | ||||||
|   constructor(sdk, options = {}) { |   constructor(sdk, options = {}) { | ||||||
|     super(sdk, options) |     super(sdk, options) | ||||||
|  |     this.color = options.color || 'rgba(255,0,0,0.5)' | ||||||
|     this.polygonHasCreated = false |     this.polygonHasCreated = false | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @ -34,8 +35,8 @@ class DrawPolygon extends Draw { | |||||||
|           positions: new Cesium.CallbackProperty((e) => { |           positions: new Cesium.CallbackProperty((e) => { | ||||||
|             return that.positions.concat(that.positions[0]) |             return that.positions.concat(that.positions[0]) | ||||||
|           }), |           }), | ||||||
|           width: 2, |           width: 3, | ||||||
|           material: Cesium.Color.fromCssColorString('#c1c505').withAlpha(0.5), |           material: Cesium.Color.fromCssColorString(that.color).withAlpha(1), | ||||||
|           clampToGround: true, |           clampToGround: true, | ||||||
|           zIndex: 99999999 |           zIndex: 99999999 | ||||||
|         }, |         }, | ||||||
|  | |||||||
							
								
								
									
										317
									
								
								src/Draw/drawThreeRect.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										317
									
								
								src/Draw/drawThreeRect.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,317 @@ | |||||||
|  | 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 | ||||||
| @ -162,7 +162,7 @@ async function dialog(sdk) { | |||||||
|   //     } |   //     } | ||||||
|   //   } |   //   } | ||||||
|   // }) |   // }) | ||||||
|   let activeColorPicker = new ewPlugins('colorpicker', { |   let activeColorPicker = new YJColorPicker({ | ||||||
|     el: contentElm.getElementsByClassName('active-color')[0], |     el: contentElm.getElementsByClassName('active-color')[0], | ||||||
|     size: 'mini',//颜色box类型 |     size: 'mini',//颜色box类型 | ||||||
|     alpha: true,//是否开启透明度 |     alpha: true,//是否开启透明度 | ||||||
| @ -193,7 +193,7 @@ async function dialog(sdk) { | |||||||
|     } |     } | ||||||
|   }) |   }) | ||||||
|   // 计曲线颜色 |   // 计曲线颜色 | ||||||
|   let indexContourColorPicker = new ewPlugins('colorpicker', { |   let indexContourColorPicker = new YJColorPicker({ | ||||||
|     el: contentElm.getElementsByClassName('index-contour-color')[0], |     el: contentElm.getElementsByClassName('index-contour-color')[0], | ||||||
|     size: 'mini',//颜色box类型 |     size: 'mini',//颜色box类型 | ||||||
|     alpha: true,//是否开启透明度 |     alpha: true,//是否开启透明度 | ||||||
| @ -235,7 +235,7 @@ async function dialog(sdk) { | |||||||
|     } |     } | ||||||
|   }) |   }) | ||||||
|   // 首曲线颜色 |   // 首曲线颜色 | ||||||
|   let intermediateContourColorPicker = new ewPlugins('colorpicker', { |   let intermediateContourColorPicker = new YJColorPicker({ | ||||||
|     el: contentElm.getElementsByClassName('intermediate-contour-color')[0], |     el: contentElm.getElementsByClassName('intermediate-contour-color')[0], | ||||||
|     size: 'mini',//颜色box类型 |     size: 'mini',//颜色box类型 | ||||||
|     alpha: true,//是否开启透明度 |     alpha: true,//是否开启透明度 | ||||||
| @ -277,7 +277,7 @@ async function dialog(sdk) { | |||||||
|     } |     } | ||||||
|   }) |   }) | ||||||
|   // 间曲线颜色 |   // 间曲线颜色 | ||||||
|   let halfIntervalContourColorPicker = new ewPlugins('colorpicker', { |   let halfIntervalContourColorPicker = new YJColorPicker({ | ||||||
|     el: contentElm.getElementsByClassName('halfInterval-contour-color')[0], |     el: contentElm.getElementsByClassName('halfInterval-contour-color')[0], | ||||||
|     size: 'mini',//颜色box类型 |     size: 'mini',//颜色box类型 | ||||||
|     alpha: true,//是否开启透明度 |     alpha: true,//是否开启透明度 | ||||||
| @ -319,7 +319,7 @@ async function dialog(sdk) { | |||||||
|     } |     } | ||||||
|   }) |   }) | ||||||
|   // 助曲线颜色 |   // 助曲线颜色 | ||||||
|   let supplementaryContourColorPicker = new ewPlugins('colorpicker', { |   let supplementaryContourColorPicker = new YJColorPicker({ | ||||||
|     el: contentElm.getElementsByClassName('supplementary-contour-color')[0], |     el: contentElm.getElementsByClassName('supplementary-contour-color')[0], | ||||||
|     size: 'mini',//颜色box类型 |     size: 'mini',//颜色box类型 | ||||||
|     alpha: true,//是否开启透明度 |     alpha: true,//是否开启透明度 | ||||||
|  | |||||||
| @ -135,6 +135,7 @@ 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']") | ||||||
|  | |||||||
| @ -263,7 +263,7 @@ async function MapPrint(sdk, thumbnailImg, rectangle, originalImg) { | |||||||
|       updateCanvas() |       updateCanvas() | ||||||
|     } |     } | ||||||
|   }) |   }) | ||||||
|   let borderColorPicker = new ewPlugins('colorpicker', { |   let borderColorPicker = new YJColorPicker({ | ||||||
|     el: contentElm.getElementsByClassName('border-color')[0], |     el: contentElm.getElementsByClassName('border-color')[0], | ||||||
|     size: 'mini', //颜色box类型 |     size: 'mini', //颜色box类型 | ||||||
|     alpha: false, //是否开启透明度 |     alpha: false, //是否开启透明度 | ||||||
| @ -564,7 +564,7 @@ async function MapPrint(sdk, thumbnailImg, rectangle, originalImg) { | |||||||
|  |  | ||||||
|   function changeMapBorderColor(color) { |   function changeMapBorderColor(color) { | ||||||
|     border.color = color || '#000000' |     border.color = color || '#000000' | ||||||
|     new ewPlugins('colorpicker', { |     new YJColorPicker({ | ||||||
|       el: contentElm.getElementsByClassName('border-color')[0], |       el: contentElm.getElementsByClassName('border-color')[0], | ||||||
|       size: 'mini', //颜色box类型 |       size: 'mini', //颜色box类型 | ||||||
|       alpha: false, //是否开启透明度 |       alpha: false, //是否开启透明度 | ||||||
| @ -1420,11 +1420,11 @@ async function MapPrint(sdk, thumbnailImg, rectangle, originalImg) { | |||||||
|         const url = URL.createObjectURL(blob); |         const url = URL.createObjectURL(blob); | ||||||
|         let downloadElement = document.createElement('a'); |         let downloadElement = document.createElement('a'); | ||||||
|         downloadElement.href = url; |         downloadElement.href = url; | ||||||
|         downloadElement.download = `高清出图-${getDateTimeString()}.jpg`; |         downloadElement.download = `高清出图-${getDateTimeString()}.png`; | ||||||
|         document.body.appendChild(downloadElement); |         document.body.appendChild(downloadElement); | ||||||
|         downloadElement.click(); |         downloadElement.click(); | ||||||
|         document.body.removeChild(downloadElement); |         document.body.removeChild(downloadElement); | ||||||
|       }, 'image/jpeg', 0.95); |       }, 'image/png', 0.95); | ||||||
|       exporting = false; |       exporting = false; | ||||||
|       exportBtn.innerHTML = '打印'; |       exportBtn.innerHTML = '打印'; | ||||||
|       // canvas2.toBlob(function (blob) { |       // canvas2.toBlob(function (blob) { | ||||||
|  | |||||||
| @ -124,7 +124,7 @@ function syncViewer() { | |||||||
|   if (height > 9000000) { |   if (height > 9000000) { | ||||||
|     height = 9000000 |     height = 9000000 | ||||||
|   } |   } | ||||||
|   if (height < 100000) { |   if (height < 400000) { | ||||||
|     this.entity.billboard.show = true |     this.entity.billboard.show = true | ||||||
|     this.entity.rectangle.show = false |     this.entity.rectangle.show = false | ||||||
|   } |   } | ||||||
|  | |||||||
| @ -4,18 +4,38 @@ | |||||||
| import Tools from "../../Tools"; | import Tools from "../../Tools"; | ||||||
| import { getCoordinateSystem } from "../../Global/global"; | import { getCoordinateSystem } from "../../Global/global"; | ||||||
| import MouseEvent from '../../Event/index' | import MouseEvent from '../../Event/index' | ||||||
|  | import { getSdk as get2DSdk } from '../../Global/MultiViewportMode' | ||||||
|  | import { getSdk as getSplitScreenSdk } from "../../Global/SplitScreen"; | ||||||
|  |  | ||||||
| let event | let event | ||||||
|  | let event2 | ||||||
| let MouseCoordinateElm | let MouseCoordinateElm | ||||||
| let requestAnimationFrameEventId | let requestAnimationFrameEventId | ||||||
|  | let tmovement | ||||||
|  | let targetSdk | ||||||
|  | let sdkD | ||||||
|  |  | ||||||
| const MouseCoordinate = (sdk, status) => { | const MouseCoordinate = (sdk, status) => { | ||||||
|  |   if (!sdk || !sdk.viewer) { | ||||||
|  |     return | ||||||
|  |   } | ||||||
|  |   targetSdk = sdk | ||||||
|  |   sdkD = get2DSdk().sdkD | ||||||
|  |   if(!sdkD) { | ||||||
|  |     sdkD = getSplitScreenSdk().sdkD | ||||||
|  |   } | ||||||
|  |  | ||||||
|   let tools = new Tools(sdk) |   let tools = new Tools(sdk) | ||||||
|   if (status) { |   if (status) { | ||||||
|     if (event) { |     if (event) { | ||||||
|       event.destroy() |       event.destroy() | ||||||
|     } |     } | ||||||
|  |     if (event2) { | ||||||
|  |       event2.destroy() | ||||||
|  |       event2 = undefined | ||||||
|  |     } | ||||||
|     event = new MouseEvent(sdk) |     event = new MouseEvent(sdk) | ||||||
|  |     tmovement = null | ||||||
|     let position = { |     let position = { | ||||||
|       x: '', |       x: '', | ||||||
|       y: '', |       y: '', | ||||||
| @ -40,22 +60,60 @@ const MouseCoordinate = (sdk, status) => { | |||||||
|       contentElm.style['background-size'] = `200% 200%`; |       contentElm.style['background-size'] = `200% 200%`; | ||||||
|       MouseCoordinateElm = contentElm |       MouseCoordinateElm = contentElm | ||||||
|     } |     } | ||||||
|     sdk.viewer._element.appendChild(contentElm) |     sdk.viewer.container.appendChild(contentElm) | ||||||
|     let tmovement |  | ||||||
|     event.mouse_move((movement, cartesian) => { |     event.mouse_move((movement, cartesian) => { | ||||||
|       tmovement = { ...movement } |       targetSdk = sdk | ||||||
|  |       tmovement = { ...movement.endPosition } | ||||||
|     }) |     }) | ||||||
|  |  | ||||||
|     const getPosition = () => { |     const getPosition = () => { | ||||||
|       if(!tmovement) { |       if (!targetSdk) { | ||||||
|         return |         return | ||||||
|       } |       } | ||||||
|       let canvas = sdk.viewer._element.getElementsByTagName('canvas')[0] |       let canvas = sdk.viewer._element.getElementsByTagName('canvas')[0] | ||||||
|       let left = tmovement.endPosition.x; |       sdkD = get2DSdk().sdkD | ||||||
|       let top = tmovement.endPosition.y; |       if(!sdkD) { | ||||||
|       let cartesian = event.getcartesian(tmovement) |         sdkD = getSplitScreenSdk().sdkD | ||||||
|       contentElm.style['background-position-x'] = `${-canvas.width + left + 4}px`; |       } | ||||||
|       contentElm.style['background-position-y'] = `${-canvas.height + top - 2}px`; |       if (!event2 && sdkD) { | ||||||
|  |         event2 = new MouseEvent(sdkD) | ||||||
|  |         event2.mouse_move((movement, cartesian) => { | ||||||
|  |           targetSdk = sdkD | ||||||
|  |           tmovement = { x: movement.endPosition.x, y: movement.endPosition.y } | ||||||
|  |         }) | ||||||
|  |       } | ||||||
|  |       if (!tmovement) { | ||||||
|  |         return | ||||||
|  |       } | ||||||
|  |       let left = tmovement.x; | ||||||
|  |       let top = tmovement.y; | ||||||
|  |       let cartesian | ||||||
|  |       if (targetSdk.viewer.scene.mode === 2) { | ||||||
|  |         left = left + canvas.width | ||||||
|  |         cartesian = targetSdk.viewer.camera.pickEllipsoid(tmovement, targetSdk.viewer.scene.globe.ellipsoid) | ||||||
|  |       } | ||||||
|  |       else { | ||||||
|  |         cartesian = targetSdk.viewer.scene.pickPosition(tmovement) | ||||||
|  |         if (!cartesian) { | ||||||
|  |           const ray = targetSdk.viewer.camera.getPickRay(position); //相交的射线 | ||||||
|  |           let pickedObjects = targetSdk.viewer.scene.drillPickFromRay(ray, 10); | ||||||
|  |           let result = {} | ||||||
|  |           for (let i = 0; i < pickedObjects.length; i++) { | ||||||
|  |             if (pickedObjects[i].position) { | ||||||
|  |               result = pickedObjects[i] | ||||||
|  |               break | ||||||
|  |             } | ||||||
|  |           } | ||||||
|  |           cartesian = result.position | ||||||
|  |           if (!cartesian) { | ||||||
|  |             cartesian = targetSdk.viewer.scene.globe.pick(ray, targetSdk.viewer.scene); | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |       contentElm.style['background-position-x'] = `${-sdk.viewer.container.clientWidth + left + 4}px`; | ||||||
|  |  | ||||||
|  |       contentElm.style['background-position-y'] = `${-sdk.viewer.container.clientHeight + top - 2}px`; | ||||||
|       // this.entity.position = cartesian |       // this.entity.position = cartesian | ||||||
|       if (cartesian) { |       if (cartesian) { | ||||||
|         let degrees = tools.cartesian3Towgs84(cartesian, sdk.viewer) |         let degrees = tools.cartesian3Towgs84(cartesian, sdk.viewer) | ||||||
| @ -97,10 +155,13 @@ const MouseCoordinate = (sdk, status) => { | |||||||
|   else { |   else { | ||||||
|     if (event) { |     if (event) { | ||||||
|       event.destroy() |       event.destroy() | ||||||
|       event = undefined |     } | ||||||
|  |     if (event2) { | ||||||
|  |       event2.destroy() | ||||||
|  |       event2 = undefined | ||||||
|     } |     } | ||||||
|     if (MouseCoordinateElm) { |     if (MouseCoordinateElm) { | ||||||
|       sdk.viewer._element.removeChild(MouseCoordinateElm) |       sdk.viewer.container.removeChild(MouseCoordinateElm) | ||||||
|       MouseCoordinateElm = undefined |       MouseCoordinateElm = undefined | ||||||
|     } |     } | ||||||
|     if (requestAnimationFrameEventId) { |     if (requestAnimationFrameEventId) { | ||||||
|  | |||||||
							
								
								
									
										578
									
								
								src/Global/MultiViewportMode/ClickCallback/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										578
									
								
								src/Global/MultiViewportMode/ClickCallback/index.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,578 @@ | |||||||
|  | /** | ||||||
|  |  * @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,6 +7,9 @@ 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 | ||||||
| @ -32,6 +35,16 @@ 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 } | ||||||
| @ -49,7 +62,16 @@ 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]._showView == 3) { | ||||||
|  |         entity.show = false | ||||||
|  |       } | ||||||
|  |     } | ||||||
|   } |   } | ||||||
|   // sdk.viewer.entities.collectionChanged.addEventListener(syncEntities) |   // sdk.viewer.entities.collectionChanged.addEventListener(syncEntities) | ||||||
|   // sdk.viewer.dataSources.dataSourceAdded.addEventListener(syncDataSources) |   // sdk.viewer.dataSources.dataSourceAdded.addEventListener(syncDataSources) | ||||||
| @ -61,6 +83,12 @@ async function init(sdk) { | |||||||
|     JwwStatusSwitch(sdk2, true) |     JwwStatusSwitch(sdk2, true) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   sdk.entityMap.forEach((item, key) => { | ||||||
|  |     if (item.showView == 2) { | ||||||
|  |       item.showView = 2 | ||||||
|  |     } | ||||||
|  |   }) | ||||||
|  |  | ||||||
| } | } | ||||||
| async function on(sdk) { | async function on(sdk) { | ||||||
|   if (sdk2D) { |   if (sdk2D) { | ||||||
| @ -94,6 +122,11 @@ function off(sdk) { | |||||||
|     activeViewer = null |     activeViewer = null | ||||||
|     syncObject = {} |     syncObject = {} | ||||||
|   } |   } | ||||||
|  |   sdk.entityMap.forEach((item, key) => { | ||||||
|  |     if (item.showView) { | ||||||
|  |       item.show = item.show | ||||||
|  |     } | ||||||
|  |   }) | ||||||
| } | } | ||||||
|  |  | ||||||
| async function syncData2(sdk, id, entityId) { | async function syncData2(sdk, id, entityId) { | ||||||
| @ -119,7 +152,11 @@ async function syncData2(sdk, id, entityId) { | |||||||
|         options.heightMode = 0 |         options.heightMode = 0 | ||||||
|         options.height = 0 |         options.height = 0 | ||||||
|       } |       } | ||||||
|       if (!that.type || (that.type !== 'tileset' && that.type !== 'bim' && that.type !== 'glb' && that.type !== 'layer')) { |  | ||||||
|  |       if (!that.type || (that.type !== 'tileset' && that.type !== 'bim' && that.type !== 'glb' && that.type !== 'layer' && that.type !== 'wallStereoscopic')) { | ||||||
|  |         if (that.showView == 3) { | ||||||
|  |           options.show = false | ||||||
|  |         } | ||||||
|         let newObject = await new that.constructor(sdk2D, options) |         let newObject = await new that.constructor(sdk2D, options) | ||||||
|         newObject.onClick = that.onClick |         newObject.onClick = that.onClick | ||||||
|         newObject.onRightClick = that.onRightClick |         newObject.onRightClick = that.onRightClick | ||||||
| @ -207,8 +244,15 @@ 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')) { |       if (!obj.type || (obj.type !== 'tileset' && obj.type !== 'bim' && obj.type !== 'glb' && obj.type !== 'layer' && obj.type !== 'wallStereoscopic')) { | ||||||
|         let target = await new obj.constructor(sdk2D, options) |         if (obj.showView == 3) { | ||||||
|  |           options.show = false | ||||||
|  |         } | ||||||
|  |         let target = await sdk2D.entityMap.get(options.id) | ||||||
|  |         if(target) { | ||||||
|  |           await target.remove() | ||||||
|  |         } | ||||||
|  |         target = await new obj.constructor(sdk2D, options) | ||||||
|         target.onClick = obj.onClick |         target.onClick = obj.onClick | ||||||
|         target.onRightClick = obj.onRightClick |         target.onRightClick = obj.onRightClick | ||||||
|         target.onMouseMove = obj.onMouseMove |         target.onMouseMove = obj.onMouseMove | ||||||
| @ -401,11 +445,25 @@ function syncImageryLayerRemoved(layer, index) { | |||||||
|   sdk2D.viewer.imageryLayers.remove(layer2d) |   sdk2D.viewer.imageryLayers.remove(layer2d) | ||||||
| } | } | ||||||
| function syncImageryLayerShownOrHidden(layer, index, state) { | function syncImageryLayerShownOrHidden(layer, index, state) { | ||||||
|  |   return | ||||||
|   let layer2d = sdk2D.viewer.imageryLayers._layers[index] |   let layer2d = sdk2D.viewer.imageryLayers._layers[index] | ||||||
|  |   let layer3d = sdk3D.viewer.imageryLayers._layers[index] | ||||||
|  |   console.log('layer2d', layer2d, sdk2D, layer3d) | ||||||
|  |  | ||||||
|   if (!layer2d) { |   if (!layer2d) { | ||||||
|     return |     return | ||||||
|   } |   } | ||||||
|   layer2d.show = state |   if (layer3d._objectState) { | ||||||
|  |     if (!layer3d._showView || layer3d._showView == 2) { | ||||||
|  |       layer2d.show = true | ||||||
|  |     } | ||||||
|  |     if (layer3d._showView == 3) { | ||||||
|  |       layer2d.show = false | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |   else { | ||||||
|  |     layer2d.show = state | ||||||
|  |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| async function syncPrimitives(primitive) { | async function syncPrimitives(primitive) { | ||||||
| @ -535,6 +593,7 @@ function syncViewer() { | |||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| function get2DView() { | function get2DView() { | ||||||
|   return sdk2D |   return sdk2D | ||||||
| } | } | ||||||
|  | |||||||
| @ -517,7 +517,7 @@ async function setSplitDirection(v, id, isoff = false, entityId) { | |||||||
|             thatD.textShow = thatP.textShow |             thatD.textShow = thatP.textShow | ||||||
|           } |           } | ||||||
|           if (thatP.label && thatP.labelShow) { |           if (thatP.label && thatP.labelShow) { | ||||||
|             thatP.label.entity.show = true |             thatP.labelShow = true | ||||||
|           } |           } | ||||||
|           if (thatD.label) { |           if (thatD.label) { | ||||||
|             thatD.label.options.ground = false |             thatD.label.options.ground = false | ||||||
|  | |||||||
| @ -1,45 +1,89 @@ | |||||||
| 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.push((e) => { that[m.value] = e.target.checked }) |               Event.change.push((e) => { that[m.value] = e.target.checked }) | ||||||
|               elements[i].checked = that[m.value] |               elements[i].checked = that[m.value] | ||||||
|             } |             } | ||||||
|             else { |             else { | ||||||
|               Event.push((e) => { |               if (elements[i].type == 'number') { | ||||||
|                 let value = e.target.value |                 Event.input.push((e) => { | ||||||
|                 if (e.target.type == 'number') { |                   if (e.target.value || e.target.value === 0) { | ||||||
|                   value = Number(value) |                     let value = e.target.value | ||||||
|                 } |                     value = Number(value) | ||||||
|                 that[m.value] = value |                     if (e.data != '.' && (e.data != '-' || e.target.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] | ||||||
|               } |               } | ||||||
| @ -57,13 +101,13 @@ class eventBinding { | |||||||
|             break; |             break; | ||||||
|           } |           } | ||||||
|           case '@click': { |           case '@click': { | ||||||
|             elements[i].addEventListener('click', (e) => { |             isEvent = true | ||||||
|               if (typeof (that.Dialog[m.value]) === 'function') { |             Event.click.push((e) => { | ||||||
|                 that.Dialog[m.value](e) |               if (typeof (that[m.value]) === 'function') { | ||||||
|  |                 that[m.value](e) | ||||||
|               } |               } | ||||||
|             }); |             }) | ||||||
|             removeName.push(m.name) |             removeName.push(m.name) | ||||||
|             // elements[i].attributes.removeNamedItem(m.name) |  | ||||||
|             break; |             break; | ||||||
|           } |           } | ||||||
|         } |         } | ||||||
| @ -74,19 +118,18 @@ class eventBinding { | |||||||
|       } |       } | ||||||
|  |  | ||||||
|       if (isEvent) { |       if (isEvent) { | ||||||
|         let ventType = 'input' |         for (let key in Event) { | ||||||
|         if (elements[i].tagName != 'INPUT' || elements[i].type == 'checkbox') { |           if (Event[key].length > 0) { | ||||||
|           ventType = 'change' |             elements[i].addEventListener(key, (e) => { | ||||||
|         } |               for (let t = 0; t < Event[key].length; t++) { | ||||||
|         elements[i].addEventListener(ventType, (e) => { |                 Event[key][t](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 '../../../Obj/Element/Dialog/eventBinding'; | import EventBinding from './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' | ||||||
| @ -52,6 +52,14 @@ export default class Sunshine { | |||||||
|     that.viewer.clock.currentTime = Cesium.JulianDate.fromDate(now); |     that.viewer.clock.currentTime = Cesium.JulianDate.fromDate(now); | ||||||
|     that.viewer.clock.multiplier = that.options.speed; |     that.viewer.clock.multiplier = that.options.speed; | ||||||
|     that.viewer.shadowMap.softShadows = that.options.softShadow; |     that.viewer.shadowMap.softShadows = that.options.softShadow; | ||||||
|  |     that.viewer.shadowMap.cascadesEnabled = true | ||||||
|  |     that.viewer.shadowMap.size = 2048; | ||||||
|  |     that.viewer.shadowMap.numberOfCascades = 4;   // 增加级联层数(默认3层) | ||||||
|  |     that.viewer.shadowMap.maximumDistance = 5000; // 扩大阴影渲染距离 | ||||||
|  |     const lightCamera = that.viewer.shadowMap._lightCamera; | ||||||
|  |     lightCamera.frustum.near = 0.1;    // 缩小近平面距离 | ||||||
|  |     lightCamera.frustum.far = 10000;   // 扩大远平面距离 | ||||||
|  |     that.viewer.shadowMap.normalOffset = true; // 避免深度冲突导致的阴影闪烁 | ||||||
|  |  | ||||||
|     that.edit(true) |     that.edit(true) | ||||||
|   } |   } | ||||||
| @ -61,6 +69,10 @@ export default class Sunshine { | |||||||
|   set darkness(v) { |   set darkness(v) { | ||||||
|     this.options.darkness = v |     this.options.darkness = v | ||||||
|     this.viewer.shadowMap.darkness = 1.0 - this.options.darkness |     this.viewer.shadowMap.darkness = 1.0 - this.options.darkness | ||||||
|  |     this._elms.darkness && | ||||||
|  |       this._elms.darkness.forEach(item => { | ||||||
|  |         item.value = v | ||||||
|  |       }) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   get speed() { |   get speed() { | ||||||
| @ -68,6 +80,10 @@ 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) | ||||||
|   } |   } | ||||||
| @ -101,14 +117,14 @@ export default class Sunshine { | |||||||
|       let _this = this |       let _this = this | ||||||
|       this._DialogObject = await new Dialog(this.sdk, this.originalOptions, { |       this._DialogObject = await new Dialog(this.sdk, this.originalOptions, { | ||||||
|         title: '光照属性', left: '180px', top: '100px', |         title: '光照属性', left: '180px', top: '100px', | ||||||
|         confirmCallBack: (options) => { |         // confirmCallBack: (options) => { | ||||||
|           this.originalOptions = tools.deepCopyObj(this.options) |         //   this.originalOptions = tools.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) | ||||||
|           this.remove() |         //   this.remove() | ||||||
|         }, |         // }, | ||||||
|         resetCallBack: () => { |         resetCallBack: () => { | ||||||
|           this.reset() |           this.reset() | ||||||
|           this.Dialog.resetCallBack && this.Dialog.resetCallBack() |           this.Dialog.resetCallBack && this.Dialog.resetCallBack() | ||||||
| @ -214,6 +230,12 @@ export default class Sunshine { | |||||||
|     this.entity = null |     this.entity = null | ||||||
|     this.timeLine.clear() |     this.timeLine.clear() | ||||||
|  |  | ||||||
|  |     this.viewer.shadowMap.cascadesEnabled = false | ||||||
|  |     this.viewer.shadowMap.size = 1024; | ||||||
|  |     this.viewer.shadowMap.numberOfCascades = 3;   // 增加级联层数(默认3层) | ||||||
|  |     const lightCamera = this.viewer.shadowMap._lightCamera; | ||||||
|  |     this.viewer.shadowMap.normalOffset = false; // 避免深度冲突导致的阴影闪烁 | ||||||
|  |  | ||||||
|     if (this._DialogObject && !this._DialogObject.isDestroy) { |     if (this._DialogObject && !this._DialogObject.isDestroy) { | ||||||
|       this._DialogObject.close() |       this._DialogObject.close() | ||||||
|       this._DialogObject = null |       this._DialogObject = null | ||||||
|  | |||||||
| @ -3,12 +3,13 @@ export default class TimeLine { | |||||||
|     this.sdk = { ...sdk }; |     this.sdk = { ...sdk }; | ||||||
|     this.progress = document.getElementById('progress'); |     this.progress = document.getElementById('progress'); | ||||||
|     this.handle = document.getElementById('handle'); |     this.handle = document.getElementById('handle'); | ||||||
|     this.timeline = document.getElementById('timeline'); |     // this.timeline = document.getElementById('timeline'); | ||||||
|  |     this.timeline = document.getElementsByClassName('timeline-container')[0]; | ||||||
|     this.currentTime = document.getElementById('currentTime'); |     this.currentTime = document.getElementById('currentTime'); | ||||||
|     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 = Date.now(); |     this.startTime = performance.now(); | ||||||
|     this.manualPosition = null; |     this.manualPosition = null; | ||||||
|     this.isDragging = false; |     this.isDragging = false; | ||||||
|     this.pauseed = false; |     this.pauseed = false; | ||||||
| @ -27,12 +28,12 @@ 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) => { | ||||||
|       that.isDragging = true; |       if (e.srcElement.className === 'handle') { | ||||||
|  |         that.isDragging = true; | ||||||
|  |       } | ||||||
|       e.preventDefault(); |       e.preventDefault(); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
| @ -53,17 +54,26 @@ 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.changeDateGrag) { | ||||||
|  |             that.changeDateGrag = undefined | ||||||
|  |           } else { | ||||||
|  |             that.startTime = now | ||||||
|  |           } | ||||||
|  |           that.changeDate = undefined | ||||||
|  |         } | ||||||
|         that.sdk.viewer.clock.shouldAnimate = true |         that.sdk.viewer.clock.shouldAnimate = true | ||||||
|         that.update(); // 重启动画循环 |         that.update(); // 重启动画循环 | ||||||
|       } |       } | ||||||
| @ -71,21 +81,24 @@ export default class TimeLine { | |||||||
|   } |   } | ||||||
|   moveComplay(func) { |   moveComplay(func) { | ||||||
|     let that = this |     let that = this | ||||||
|     that.timeline.addEventListener('mouseup', () => { |     // that.timeline.addEventListener('mouseup', () => { | ||||||
|       that.isDragging = false; |     document.addEventListener('mouseup', () => { | ||||||
|       if (that.manualPosition !== null) { |       if (that.isDragging) { | ||||||
|         // that.sdk.viewer.clock.shouldAnimate = true |         that.isDragging = false; | ||||||
|         that.startTime = Date.now() - (that.manualPosition * 86400 * 1000 / that.speed); |         if (that.manualPosition !== null) { | ||||||
|         that.manualPosition = null; |           // that.sdk.viewer.clock.shouldAnimate = true | ||||||
|  |           that.startTime = performance.now() - (that.manualPosition * 86400 * 1000 / that.speed); | ||||||
|  |           that.manualPosition = null; | ||||||
|  |           that.changeDate && (that.changeDateGrag = true) | ||||||
|  |           if (!that.pauseed) { | ||||||
|  |             that.update() | ||||||
|  |             func(that.time) | ||||||
|  |           } else { | ||||||
|  |             that.pausedTime = performance.now(); // 记录暂停时刻 | ||||||
|  |             func(that.currentTime.textContent) | ||||||
|  |           } | ||||||
|  |  | ||||||
|         if (!that.pauseed) { |  | ||||||
|           that.update() |  | ||||||
|           func(that.time) |  | ||||||
|         } else { |  | ||||||
|           that.pausedTime = Date.now(); // 记录暂停时刻 |  | ||||||
|           func(that.currentTime.textContent) |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|       } |       } | ||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
| @ -98,30 +111,55 @@ export default class TimeLine { | |||||||
|  |  | ||||||
|   update() { |   update() { | ||||||
|     if (this.manualPosition !== null) return; |     if (this.manualPosition !== null) return; | ||||||
|  |     if (this.changeDate) {//切换日期后让时间从0开始 | ||||||
|     const elapsed = (Date.now() - this.startTime) * this.speed; |       this.startTime = performance.now() | ||||||
|     const totalSeconds = elapsed / 1000; |     } | ||||||
|     const daySeconds = totalSeconds % 86400; |     let elapsed = (performance.now() - this.startTime) * this.speed; | ||||||
|  |     // if (this.elapsed) { | ||||||
|  |     //   elapsed = elapsed + this.elapsed | ||||||
|  |     //   this.elapsed = undefined | ||||||
|  |     // } | ||||||
|  |     const totalSeconds = elapsed / 1000;//秒 | ||||||
|  |     const daySeconds = totalSeconds % 86400;//天 | ||||||
|     const percentage = daySeconds / 86400; |     const percentage = daySeconds / 86400; | ||||||
|  |  | ||||||
|     this.progress.style.width = `${percentage * 100}%`; |     this.progress.style.width = `${percentage * 100}%`; | ||||||
|     this.time = this.formatTime(daySeconds) |     this.time = this.formatTime(daySeconds) | ||||||
|     this.currentTime.textContent = this.time; |     this.currentTime.textContent = this.time; | ||||||
|     this.animationId = requestAnimationFrame(this.update); |     if (!this.pauseed) { | ||||||
|  |       this.animationId && cancelAnimationFrame(this.animationId); | ||||||
|  |       this.animationId = requestAnimationFrame(this.update); | ||||||
|  |     } | ||||||
|   } |   } | ||||||
|   setSpeed(v) { |   setSpeed(v) { | ||||||
|     const currentProgress = this.manualPosition ?? |     let now = performance.now() | ||||||
|       (Date.now() - this.startTime) * this.speed / (86400 * 1000); |     if (!this.pauseed) { | ||||||
|  |       const currentProgress = this.manualPosition ?? | ||||||
|  |         (performance.now() - this.startTime) * this.speed / (86400 * 1000); | ||||||
|  |       this.speed = v; | ||||||
|  |       this.startTime = performance.now() - (currentProgress * 86400 * 1000 / this.speed); | ||||||
|  |  | ||||||
|     this.speed = v; |     } else { | ||||||
|     this.startTime = Date.now() - (currentProgress * 86400 * 1000 / this.speed); |       let pausedDuration = now - this.pausedTime; | ||||||
|  |       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暂停时刻 | ||||||
|  |       // this.speed = v; | ||||||
|  |     } | ||||||
|     this.manualPosition = null; |     this.manualPosition = null; | ||||||
|     this.update(); |  | ||||||
|  |     // this.update(); | ||||||
|  |  | ||||||
|   } |   } | ||||||
|   updateTime() { |   updateTime() { | ||||||
|     this.startTime = Date.now() - (this.manualPosition * 86400 * 1000 / this.speed); |  | ||||||
|     this.manualPosition = null; |     this.manualPosition = null; | ||||||
|  |     this.startTime = performance.now() - ((this.manualPosition || 0) * 86400 * 1000 / this.speed); | ||||||
|  |     this.pauseed && (this.changeDate = true) | ||||||
|  |     this.changeDateGrag = undefined | ||||||
|     this.update(); |     this.update(); | ||||||
|   } |   } | ||||||
|   clear() { |   clear() { | ||||||
|  | |||||||
| @ -25,13 +25,13 @@ function MouseRightMenu(sdk, status, callBack) { | |||||||
|   if (eventListener[sdk.div_id].click) { |   if (eventListener[sdk.div_id].click) { | ||||||
|     document.removeEventListener('click', eventListener[sdk.div_id].click) |     document.removeEventListener('click', eventListener[sdk.div_id].click) | ||||||
|   } |   } | ||||||
|   if(!eventListener[sdk.div_id].callBack) { |   if (!eventListener[sdk.div_id].callBack) { | ||||||
|     eventListener[sdk.div_id].callBack = callBack |     eventListener[sdk.div_id].callBack = callBack | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   if(sdk !== sdkD) { |   if (sdk !== sdkD) { | ||||||
|     eventListener[sdk.div_id].mouseRightMenuEvent && |     eventListener[sdk.div_id].mouseRightMenuEvent && | ||||||
|     eventListener[sdk.div_id].mouseRightMenuEvent.destroy() |       eventListener[sdk.div_id].mouseRightMenuEvent.destroy() | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   let menuElm = document.getElementById('custom-menu') |   let menuElm = document.getElementById('custom-menu') | ||||||
| @ -87,7 +87,7 @@ function MouseRightMenu(sdk, status, callBack) { | |||||||
|         } |         } | ||||||
|         let entityId = getEntityId(movement) |         let entityId = getEntityId(movement) | ||||||
|         let targetId |         let targetId | ||||||
|         if(Object.prototype.toString.call(entityId) === '[object Object]') { |         if (Object.prototype.toString.call(entityId) === '[object Object]') { | ||||||
|           targetId = entityId.id |           targetId = entityId.id | ||||||
|           entityId = entityId.parentId |           entityId = entityId.parentId | ||||||
|         } |         } | ||||||
| @ -100,14 +100,14 @@ function MouseRightMenu(sdk, status, callBack) { | |||||||
|           that = sdk.entityMap.get(entityId) |           that = sdk.entityMap.get(entityId) | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (that && that.picking) { |         // if (that && that.picking) { | ||||||
|           addedMenu = ` |         //   addedMenu = ` | ||||||
|         <span class="divider" style="display: block;border-top: 1px solid #ddd;margin: 5px;"></span> |         // <span class="divider" style="display: block;border-top: 1px solid #ddd;margin: 5px;"></span> | ||||||
|         <ul class="added" style="list-style: none;padding: 0;margin: 0;font-size: 12px;"> |         // <ul class="added" 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> | ||||||
|         ` |         // ` | ||||||
|         } |         // } | ||||||
|         let position = tools.cartesian3Towgs84(cartesian, sdk.viewer) |         let position = tools.cartesian3Towgs84(cartesian, sdk.viewer) | ||||||
|         menuElm = document.createElement('div') |         menuElm = document.createElement('div') | ||||||
|         menuElm.id = 'custom-menu' |         menuElm.id = 'custom-menu' | ||||||
| @ -123,7 +123,7 @@ function MouseRightMenu(sdk, status, callBack) { | |||||||
|         </ul> |         </ul> | ||||||
|         ${addedMenu} |         ${addedMenu} | ||||||
|       ` |       ` | ||||||
|       _element.appendChild(menuElm) |         _element.appendChild(menuElm) | ||||||
|         let left = movement.position.x |         let left = movement.position.x | ||||||
|         let top = movement.position.y |         let top = movement.position.y | ||||||
|         if ( |         if ( | ||||||
| @ -141,7 +141,7 @@ function MouseRightMenu(sdk, status, callBack) { | |||||||
|         menuElm.style.left = left + 'px' |         menuElm.style.left = left + 'px' | ||||||
|         menuElm.style.top = top + 'px' |         menuElm.style.top = top + 'px' | ||||||
|  |  | ||||||
|         menuElm.addEventListener('contextmenu', function(event) { |         menuElm.addEventListener('contextmenu', function (event) { | ||||||
|           event.preventDefault() |           event.preventDefault() | ||||||
|         }) |         }) | ||||||
|         let liElms = menuElm.getElementsByTagName('li') |         let liElms = menuElm.getElementsByTagName('li') | ||||||
| @ -162,7 +162,7 @@ function MouseRightMenu(sdk, status, callBack) { | |||||||
|                 // this.rotateAround(position) |                 // this.rotateAround(position) | ||||||
|                 break |                 break | ||||||
|               case '属性': |               case '属性': | ||||||
|                 if(targetId) { |                 if (targetId) { | ||||||
|                   object.id = targetId |                   object.id = targetId | ||||||
|                   object.parentId = that.options.id |                   object.parentId = that.options.id | ||||||
|                 } |                 } | ||||||
| @ -173,6 +173,10 @@ function MouseRightMenu(sdk, status, callBack) { | |||||||
|                 // that.edit(true) |                 // that.edit(true) | ||||||
|                 // this.attribute(entityId) |                 // this.attribute(entityId) | ||||||
|                 break |                 break | ||||||
|  |               case '文本框': | ||||||
|  |                 object.position = position | ||||||
|  |                 key = 'textBox' | ||||||
|  |                 break | ||||||
|             } |             } | ||||||
|             eventListener[sdk.div_id].callBack(key, object) |             eventListener[sdk.div_id].callBack(key, object) | ||||||
|             _element.removeChild(menuElm) |             _element.removeChild(menuElm) | ||||||
|  | |||||||
| @ -100,6 +100,7 @@ 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' | ||||||
| @ -185,6 +186,9 @@ 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 TextBox from '../Obj/Base/TextBox' | ||||||
|  | import BatchModel from '../Obj/Base/BatchModel' | ||||||
|  |  | ||||||
| const YJEarthismeasuring = Symbol('测量状态') | const YJEarthismeasuring = Symbol('测量状态') | ||||||
| const screenRecord = Symbol('录屏对象') | const screenRecord = Symbol('录屏对象') | ||||||
| @ -256,7 +260,10 @@ if (!window.YJ) { | |||||||
|       FRUSTUN: Frustum, |       FRUSTUN: Frustum, | ||||||
|       // GenerateRoute |       // GenerateRoute | ||||||
|       Dialog, |       Dialog, | ||||||
|       FlowLine |       FlowLine, | ||||||
|  |       // Road2, | ||||||
|  |       // TextBox, | ||||||
|  |       BatchModel | ||||||
|     }, |     }, | ||||||
|     YJEarth, |     YJEarth, | ||||||
|     Tools, |     Tools, | ||||||
| @ -374,6 +381,7 @@ if (!window.YJ) { | |||||||
|       DrawAssemble, |       DrawAssemble, | ||||||
|       DrawSector, |       DrawSector, | ||||||
|       DrawTakeOff, |       DrawTakeOff, | ||||||
|  |       DrawThreeRect | ||||||
|     }, |     }, | ||||||
|     // 分析 |     // 分析 | ||||||
|     Analysis: { |     Analysis: { | ||||||
|  | |||||||
| @ -91,7 +91,7 @@ class MeasureDistance extends Measure { | |||||||
|  |  | ||||||
|  |  | ||||||
|     //暂时固定取20个点 |     //暂时固定取20个点 | ||||||
|     if (d > 20) {//大于20m时,固定取20个点 |     if (d > 2) {//大于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 p2 = await this.sampleHeightMostDetailed([p1]) |     let height = await this.getClampToHeight(p1, [...this.sdk.viewer.entities.values]) | ||||||
|     p1.alt = p2[0].height |     p1.alt = height | ||||||
|     return {position: p1, index} |     return {position: p1, index} | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | |||||||
| @ -47,6 +47,11 @@ class ContourAnalysis { | |||||||
|     YJ.Analysis.AnalysesResults.push(this) |     YJ.Analysis.AnalysesResults.push(this) | ||||||
|     this.createNewLine(); |     this.createNewLine(); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   get type() { | ||||||
|  |     return 'ContourAnalysis' | ||||||
|  |   } | ||||||
|  |  | ||||||
|   createNewLine() { |   createNewLine() { | ||||||
|     ContourAnalysis.interpolatePoint(this); |     ContourAnalysis.interpolatePoint(this); | ||||||
|   } |   } | ||||||
|  | |||||||
| @ -63,11 +63,15 @@ class VisibilityAnalysis extends Tools { | |||||||
|         that.tip.set_text("左键创建视角终点,右键结束通视分析") |         that.tip.set_text("左键创建视角终点,右键结束通视分析") | ||||||
|         if (!that.resultObject.viewPoint) { |         if (!that.resultObject.viewPoint) { | ||||||
|           let pos84 = that.cartesian3Towgs84(cartesian, that.viewer) |           let pos84 = that.cartesian3Towgs84(cartesian, that.viewer) | ||||||
|           let positions = await Cesium.sampleTerrainMostDetailed( |           let positions | ||||||
|             that.sdk.viewer.terrainProvider, |           if(that.sdk.viewer.terrainProvider.availability) | ||||||
|             [Cesium.Cartographic.fromDegrees(pos84.lng, pos84.lat)] |           { | ||||||
|           ); |             positions = await Cesium.sampleTerrainMostDetailed( | ||||||
|           if (positions[0].height > pos84.alt) { |               that.sdk.viewer.terrainProvider, | ||||||
|  |               [Cesium.Cartographic.fromDegrees(pos84.lng, pos84.lat)] | ||||||
|  |             ); | ||||||
|  |           } | ||||||
|  |           if (positions && positions[0].height > pos84.alt) { | ||||||
|             pos84.alt = positions[0].height |             pos84.alt = positions[0].height | ||||||
|           } |           } | ||||||
|           pos84.alt = pos84.alt + that.viewPointHeight |           pos84.alt = pos84.alt + that.viewPointHeight | ||||||
|  | |||||||
| @ -105,7 +105,7 @@ class PolygonObject extends Base { | |||||||
|     this.entity.polygon.material = Cesium.Color.fromCssColorString(v) |     this.entity.polygon.material = Cesium.Color.fromCssColorString(v) | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -218,7 +218,7 @@ class PolygonObject extends Base { | |||||||
|     this.entity.polyline.material = Cesium.Color.fromCssColorString(v) |     this.entity.polyline.material = Cesium.Color.fromCssColorString(v) | ||||||
|     if (this._elms.lineColor) { |     if (this._elms.lineColor) { | ||||||
|       this._elms.lineColor.forEach((item, i) => { |       this._elms.lineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -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) { |     if (this.show && !this.showView || this.showView == 3) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @ -311,7 +311,7 @@ class PolygonObject extends Base { | |||||||
|     this.label.color = v |     this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -411,7 +411,7 @@ class PolygonObject extends Base { | |||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -438,7 +438,7 @@ class PolygonObject extends Base { | |||||||
|     this.label.backgroundColor = [v, this.label.backgroundColor[1]] |     this.label.backgroundColor = [v, this.label.backgroundColor[1]] | ||||||
|     if (this._elms.labelBackgroundColorStart) { |     if (this._elms.labelBackgroundColorStart) { | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |       this._elms.labelBackgroundColorStart.forEach((item, i) => { | ||||||
|         let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -464,7 +464,7 @@ class PolygonObject extends Base { | |||||||
|     this.label.backgroundColor = [this.label.backgroundColor[0], v] |     this.label.backgroundColor = [this.label.backgroundColor[0], v] | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -1013,7 +1013,7 @@ class PolygonObject extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs('polygon-object-edit-tabs', undefined, this.sdk) |       let tabsElm = new cy_tabs('polygon-object-edit-tabs', undefined, this.sdk) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1027,7 +1027,7 @@ class PolygonObject extends Base { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let linecolorPicker = new ewPlugins('colorpicker', { |       let linecolorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("lineColor")[0], |         el: contentElm.getElementsByClassName("lineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1041,7 +1041,7 @@ class PolygonObject extends Base { | |||||||
|           this.lineColor = 'rgba(255,255,255,1)' |           this.lineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |         el: contentElm.getElementsByClassName("labelColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1055,7 +1055,7 @@ class PolygonObject extends Base { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let lineColorPicker = new ewPlugins('colorpicker', { |       let lineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelLineColor")[0], |         el: contentElm.getElementsByClassName("labelLineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1069,7 +1069,7 @@ class PolygonObject extends Base { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -1083,7 +1083,7 @@ class PolygonObject extends Base { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         }, |         }, | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
|  | |||||||
| @ -40,7 +40,7 @@ class AssembleObject extends Base { | |||||||
|     this.options.positions = options.positions || [] |     this.options.positions = options.positions || [] | ||||||
|     this.options.line = options.line || {} |     this.options.line = options.line || {} | ||||||
|     this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3) |     this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3) | ||||||
|     this.options.line.color = this.options.line.color || '#ff000080' |     this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)' | ||||||
|     this.options['area-unit'] = options['area-unit'] || '平方米' |     this.options['area-unit'] = options['area-unit'] || '平方米' | ||||||
|     this.entity |     this.entity | ||||||
|     this.event = new MouseEvent(this.sdk) |     this.event = new MouseEvent(this.sdk) | ||||||
| @ -106,7 +106,7 @@ class AssembleObject extends Base { | |||||||
|     return this.options.color |     return this.options.color | ||||||
|   } |   } | ||||||
|   set color(v) { |   set color(v) { | ||||||
|     this.options.color = v || '#ff000080' |     this.options.color = v || 'rgba(255, 0, 0, 0.5)' | ||||||
|     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) { |     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) { | ||||||
|       return |       return | ||||||
|     } |     } | ||||||
| @ -119,7 +119,7 @@ class AssembleObject extends Base { | |||||||
|     this.entity.polygon.material = material |     this.entity.polygon.material = material | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -238,14 +238,14 @@ class AssembleObject extends Base { | |||||||
|     return this.options.line.color |     return this.options.line.color | ||||||
|   } |   } | ||||||
|   set lineColor(v) { |   set lineColor(v) { | ||||||
|     this.options.line.color = v || '#ff000080' |     this.options.line.color = v || 'rgba(255, 0, 0, 0.5)' | ||||||
|     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) { |     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) { | ||||||
|       return |       return | ||||||
|     } |     } | ||||||
|     this.entity.polyline.material = Cesium.Color.fromCssColorString(this.options.line.color) |     this.entity.polyline.material = Cesium.Color.fromCssColorString(this.options.line.color) | ||||||
|     if (this._elms.lineColor) { |     if (this._elms.lineColor) { | ||||||
|       this._elms.lineColor.forEach((item, i) => { |       this._elms.lineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -319,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) { |     if (this.show && !this.showView || this.showView == 3) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @ -353,7 +353,7 @@ class AssembleObject extends Base { | |||||||
|     this.label.color = v |     this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -453,7 +453,7 @@ class AssembleObject extends Base { | |||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -480,7 +480,7 @@ class AssembleObject extends Base { | |||||||
|     this.label.backgroundColor = [v, this.label.backgroundColor[1]] |     this.label.backgroundColor = [v, this.label.backgroundColor[1]] | ||||||
|     if (this._elms.labelBackgroundColorStart) { |     if (this._elms.labelBackgroundColorStart) { | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |       this._elms.labelBackgroundColorStart.forEach((item, i) => { | ||||||
|         let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -506,7 +506,7 @@ class AssembleObject extends Base { | |||||||
|     this.label.backgroundColor = [this.label.backgroundColor[0], v] |     this.label.backgroundColor = [this.label.backgroundColor[0], v] | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -1171,7 +1171,7 @@ class AssembleObject extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs('assemble-object-edit-tabs', undefined, this.sdk) |       let tabsElm = new cy_tabs('assemble-object-edit-tabs', undefined, this.sdk) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1185,7 +1185,7 @@ class AssembleObject extends Base { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let linecolorPicker = new ewPlugins('colorpicker', { |       let linecolorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("lineColor")[0], |         el: contentElm.getElementsByClassName("lineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1199,7 +1199,7 @@ class AssembleObject extends Base { | |||||||
|           this.lineColor = 'rgba(255,255,255,1)' |           this.lineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |         el: contentElm.getElementsByClassName("labelColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1213,7 +1213,7 @@ class AssembleObject extends Base { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labellineColorPicker = new ewPlugins('colorpicker', { |       let labellineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelLineColor")[0], |         el: contentElm.getElementsByClassName("labelLineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1227,7 +1227,7 @@ class AssembleObject extends Base { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -1241,7 +1241,7 @@ class AssembleObject extends Base { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         }, |         }, | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
|  | |||||||
| @ -40,7 +40,7 @@ class AttackArrowObject extends Base { | |||||||
|     this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2 |     this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2 | ||||||
|     this.options.line = options.line || {} |     this.options.line = options.line || {} | ||||||
|     this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3) |     this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3) | ||||||
|     this.options.line.color = this.options.line.color || '#ff000080' |     this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)' | ||||||
|     this.options['area-unit'] = options['area-unit'] || '平方米' |     this.options['area-unit'] = options['area-unit'] || '平方米' | ||||||
|     this.entity |     this.entity | ||||||
|     this.event = new MouseEvent(this.sdk) |     this.event = new MouseEvent(this.sdk) | ||||||
| @ -110,7 +110,7 @@ class AttackArrowObject extends Base { | |||||||
|     return this.options.color |     return this.options.color | ||||||
|   } |   } | ||||||
|   set color(v) { |   set color(v) { | ||||||
|     this.options.color = v || '#ff000080' |     this.options.color = v || 'rgba(255, 0, 0, 0.5)' | ||||||
|     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) { |     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) { | ||||||
|       return |       return | ||||||
|     } |     } | ||||||
| @ -123,7 +123,7 @@ class AttackArrowObject extends Base { | |||||||
|     this.entity.polygon.material = material |     this.entity.polygon.material = material | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -243,14 +243,14 @@ class AttackArrowObject extends Base { | |||||||
|     return this.options.line.color |     return this.options.line.color | ||||||
|   } |   } | ||||||
|   set lineColor(v) { |   set lineColor(v) { | ||||||
|     this.options.line.color = v || '#ff000080' |     this.options.line.color = v || 'rgba(255, 0, 0, 0.5)' | ||||||
|     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) { |     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) { | ||||||
|       return |       return | ||||||
|     } |     } | ||||||
|     this.entity.polyline.material = Cesium.Color.fromCssColorString(this.options.line.color) |     this.entity.polyline.material = Cesium.Color.fromCssColorString(this.options.line.color) | ||||||
|     if (this._elms.lineColor) { |     if (this._elms.lineColor) { | ||||||
|       this._elms.lineColor.forEach((item, i) => { |       this._elms.lineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -324,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) { |     if (this.show && !this.showView || this.showView == 3) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @ -358,7 +358,7 @@ class AttackArrowObject extends Base { | |||||||
|     this.label.color = v |     this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -458,7 +458,7 @@ class AttackArrowObject extends Base { | |||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -485,7 +485,7 @@ class AttackArrowObject extends Base { | |||||||
|     this.label.backgroundColor = [v, this.label.backgroundColor[1]] |     this.label.backgroundColor = [v, this.label.backgroundColor[1]] | ||||||
|     if (this._elms.labelBackgroundColorStart) { |     if (this._elms.labelBackgroundColorStart) { | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |       this._elms.labelBackgroundColorStart.forEach((item, i) => { | ||||||
|         let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -511,7 +511,7 @@ class AttackArrowObject extends Base { | |||||||
|     this.label.backgroundColor = [this.label.backgroundColor[0], v] |     this.label.backgroundColor = [this.label.backgroundColor[0], v] | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -1182,7 +1182,7 @@ class AttackArrowObject extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs('attack-arrow-object-edit-tabs', undefined, this.sdk) |       let tabsElm = new cy_tabs('attack-arrow-object-edit-tabs', undefined, this.sdk) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1196,7 +1196,7 @@ class AttackArrowObject extends Base { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let linecolorPicker = new ewPlugins('colorpicker', { |       let linecolorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("lineColor")[0], |         el: contentElm.getElementsByClassName("lineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1210,7 +1210,7 @@ class AttackArrowObject extends Base { | |||||||
|           this.lineColor = 'rgba(255,255,255,1)' |           this.lineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |         el: contentElm.getElementsByClassName("labelColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1224,7 +1224,7 @@ class AttackArrowObject extends Base { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labellineColorPicker = new ewPlugins('colorpicker', { |       let labellineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelLineColor")[0], |         el: contentElm.getElementsByClassName("labelLineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1238,7 +1238,7 @@ class AttackArrowObject extends Base { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -1252,7 +1252,7 @@ class AttackArrowObject extends Base { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         }, |         }, | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
|  | |||||||
| @ -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 } from '../../../../Global/MultiViewportMode' | import { syncData, get2DView } 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,8 +244,19 @@ 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() | ||||||
|  | |||||||
| @ -56,7 +56,7 @@ function html(that) { | |||||||
|         </div> |         </div> | ||||||
|       </div> |       </div> | ||||||
|       <div class="col"> |       <div class="col"> | ||||||
|         <span class="label">固定大小</span> |         <span class="label" style="flex: 0 0 60px;">固定大小</span> | ||||||
|         <input class="btn-switch" type="checkbox" @model="scaleByDistance"> |         <input class="btn-switch" type="checkbox" @model="scaleByDistance"> | ||||||
|       </div> |       </div> | ||||||
|     </div> |     </div> | ||||||
|  | |||||||
| @ -439,7 +439,7 @@ class Model extends BaseModel { | |||||||
|     this.entity.color = Cesium.Color.fromCssColorString(v) |     this.entity.color = Cesium.Color.fromCssColorString(v) | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -637,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) { |     if (this.show && !this.showView || this.showView == 3) { | ||||||
|       this.label && (this.label.show = v) |       this.label && (this.label.show = v) | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @ -671,7 +671,7 @@ class Model extends BaseModel { | |||||||
|     this.label && (this.label.color = v) |     this.label && (this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -772,7 +772,7 @@ class Model extends BaseModel { | |||||||
|     this.label && (this.label.lineColor = v) |     this.label && (this.label.lineColor = v) | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -799,7 +799,7 @@ class Model extends BaseModel { | |||||||
|     this.label && (this.label.backgroundColor = [v, this.label.backgroundColor[1]]) |     this.label && (this.label.backgroundColor = [v, this.label.backgroundColor[1]]) | ||||||
|     if (this._elms.labelBackgroundColorStart) { |     if (this._elms.labelBackgroundColorStart) { | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |       this._elms.labelBackgroundColorStart.forEach((item, i) => { | ||||||
|         let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -825,7 +825,7 @@ class Model extends BaseModel { | |||||||
|     this.label && (this.label.backgroundColor = [this.label.backgroundColor[0], v]) |     this.label && (this.label.backgroundColor = [this.label.backgroundColor[0], v]) | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -1419,7 +1419,7 @@ class Model extends BaseModel { | |||||||
|       } |       } | ||||||
|  |  | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1433,7 +1433,7 @@ class Model extends BaseModel { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |         el: contentElm.getElementsByClassName("labelColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1447,7 +1447,7 @@ class Model extends BaseModel { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let lineColorPicker = new ewPlugins('colorpicker', { |       let lineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelLineColor")[0], |         el: contentElm.getElementsByClassName("labelLineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1461,7 +1461,7 @@ class Model extends BaseModel { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -1475,7 +1475,7 @@ class Model extends BaseModel { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         }, |         }, | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
|  | |||||||
| @ -381,7 +381,7 @@ class Model2 extends BaseModel { | |||||||
|     this.entity.color = Cesium.Color.fromCssColorString(v) |     this.entity.color = Cesium.Color.fromCssColorString(v) | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -550,7 +550,7 @@ class Model2 extends BaseModel { | |||||||
|  |  | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show) { |     if (this.show && !this.showView || this.showView == 3) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @ -583,7 +583,7 @@ class Model2 extends BaseModel { | |||||||
|     this.label.color = v |     this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -676,7 +676,7 @@ class Model2 extends BaseModel { | |||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|     if (this._elms.lineColor) { |     if (this._elms.lineColor) { | ||||||
|       this._elms.lineColor.forEach((item, i) => { |       this._elms.lineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -704,7 +704,7 @@ class Model2 extends BaseModel { | |||||||
|     this.label.backgroundColor = [v, this.labelBackgroundColorEnd] |     this.label.backgroundColor = [v, this.labelBackgroundColorEnd] | ||||||
|     if (this._elms.labelBackgroundColorStart) { |     if (this._elms.labelBackgroundColorStart) { | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |       this._elms.labelBackgroundColorStart.forEach((item, i) => { | ||||||
|         let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -732,7 +732,7 @@ class Model2 extends BaseModel { | |||||||
|     this.label.backgroundColor = [this.labelBackgroundColorStart, v] |     this.label.backgroundColor = [this.labelBackgroundColorStart, v] | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -1098,7 +1098,7 @@ class Model2 extends BaseModel { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs('model-edit-tabs', undefined, this.sdk) |       let tabsElm = new cy_tabs('model-edit-tabs', undefined, this.sdk) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1112,7 +1112,7 @@ class Model2 extends BaseModel { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("label_color")[0], |         el: contentElm.getElementsByClassName("label_color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1126,7 +1126,7 @@ class Model2 extends BaseModel { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let lineColorPicker = new ewPlugins('colorpicker', { |       let lineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("line_color")[0], |         el: contentElm.getElementsByClassName("line_color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1140,7 +1140,7 @@ class Model2 extends BaseModel { | |||||||
|           this.lineColor = 'rgba(255,255,255,1)' |           this.lineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -1154,7 +1154,7 @@ class Model2 extends BaseModel { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         }, |         }, | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
|  | |||||||
| @ -8,7 +8,7 @@ | |||||||
| import Dialog from '../../../Element/Dialog'; | import Dialog from '../../../Element/Dialog'; | ||||||
| import { getHost } from "../../../../on"; | import { getHost } from "../../../../on"; | ||||||
| import BaseSource from "../index"; | import BaseSource from "../index"; | ||||||
| import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../../Global/global' | import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../../Global/global' | ||||||
| import { setSplitDirection, syncSplitData } from '../../../../Global/SplitScreen' | import { setSplitDirection, syncSplitData } from '../../../../Global/SplitScreen' | ||||||
|  |  | ||||||
| class BaseTerrain extends BaseSource { | class BaseTerrain extends BaseSource { | ||||||
| @ -78,6 +78,11 @@ class BaseTerrain extends BaseSource { | |||||||
|   close() { |   close() { | ||||||
|     this.sdk.viewer.scene.terrainProvider = |     this.sdk.viewer.scene.terrainProvider = | ||||||
|       new Cesium.EllipsoidTerrainProvider({}) |       new Cesium.EllipsoidTerrainProvider({}) | ||||||
|  |     for (let i = 0; i < YJ.Analysis.AnalysesResults.length; i++) { | ||||||
|  |       if (YJ.Analysis.AnalysesResults[i].type === 'ContourAnalysis') { | ||||||
|  |         YJ.Analysis.AnalysesResults[i].destroy() | ||||||
|  |       } | ||||||
|  |     } | ||||||
|     syncSplitData(this.sdk, this.options.id) |     syncSplitData(this.sdk, this.options.id) | ||||||
|  |  | ||||||
|     clearTimeout(this.#updateModelTimeout) |     clearTimeout(this.#updateModelTimeout) | ||||||
| @ -156,7 +161,7 @@ class BaseTerrain extends BaseSource { | |||||||
|     } |     } | ||||||
|     setActiveViewer(0) |     setActiveViewer(0) | ||||||
|     closeRotateAround(this.sdk) |     closeRotateAround(this.sdk) | ||||||
|   closeViewFollow(this.sdk) |     closeViewFollow(this.sdk) | ||||||
|  |  | ||||||
|     if (this.options.customView && this.options.customView.relativePosition && this.options.customView.orientation) { |     if (this.options.customView && this.options.customView.relativePosition && this.options.customView.orientation) { | ||||||
|       let orientation = { |       let orientation = { | ||||||
|  | |||||||
							
								
								
									
										24
									
								
								src/Obj/Base/BatchModel/_element.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								src/Obj/Base/BatchModel/_element.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,24 @@ | |||||||
|  | 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 } | ||||||
							
								
								
									
										229
									
								
								src/Obj/Base/BatchModel/_element_拓展.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										229
									
								
								src/Obj/Base/BatchModel/_element_拓展.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,229 @@ | |||||||
|  | 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 } | ||||||
							
								
								
									
										92
									
								
								src/Obj/Base/BatchModel/eventBinding.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										92
									
								
								src/Obj/Base/BatchModel/eventBinding.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,92 @@ | |||||||
|  | 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; | ||||||
							
								
								
									
										681
									
								
								src/Obj/Base/BatchModel/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										681
									
								
								src/Obj/Base/BatchModel/index.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,681 @@ | |||||||
|  | /** | ||||||
|  |  * @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 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 } 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 || 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) | ||||||
|  |     // BatchModel.computeDis(this) | ||||||
|  |     // if (this.options.positions.length > 0 || this.options.positions.lng) { | ||||||
|  |     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; | ||||||
|  |         // 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 | ||||||
| @ -273,7 +273,7 @@ class BillboardObject extends Base { | |||||||
|     else { |     else { | ||||||
|       let image = new Image() |       let image = new Image() | ||||||
|       image.src = |       image.src = | ||||||
|       url || |         url || | ||||||
|         that.getSourceRootPath() + '/img/A-ablu-blank.png' |         that.getSourceRootPath() + '/img/A-ablu-blank.png' | ||||||
|       switch (that.options.heightMode) { |       switch (that.options.heightMode) { | ||||||
|         case 2: |         case 2: | ||||||
| @ -433,11 +433,11 @@ class BillboardObject extends Base { | |||||||
|         value: '链接', |         value: '链接', | ||||||
|         key: 'link' |         key: 'link' | ||||||
|       }, |       }, | ||||||
|       { |       // { | ||||||
|         name: 'IP摄像头', |       //   name: 'IP摄像头', | ||||||
|         value: 'IP摄像头', |       //   value: 'IP摄像头', | ||||||
|         key: 'camera' |       //   key: 'camera' | ||||||
|       }, |       // }, | ||||||
|       // { |       // { | ||||||
|       //   name: 'ISC摄像头', |       //   name: 'ISC摄像头', | ||||||
|       //   value: 'ISC摄像头', |       //   value: 'ISC摄像头', | ||||||
| @ -448,16 +448,16 @@ class BillboardObject extends Base { | |||||||
|       //   value: '传感器', |       //   value: '传感器', | ||||||
|       //   key: 'sensor' |       //   key: 'sensor' | ||||||
|       // }, |       // }, | ||||||
|       { |       // { | ||||||
|         name: '全景图', |       //   name: '全景图', | ||||||
|         value: '全景图', |       //   value: '全景图', | ||||||
|         key: 'vr' |       //   key: 'vr' | ||||||
|       }, |       // }, | ||||||
|       { |       // { | ||||||
|         name: '物资', |       //   name: '物资', | ||||||
|         value: '物资', |       //   value: '物资', | ||||||
|         key: 'goods' |       //   key: 'goods' | ||||||
|       } |       // } | ||||||
|     ] |     ] | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @ -465,14 +465,24 @@ class BillboardObject extends Base { | |||||||
|     return this.options.show |     return this.options.show | ||||||
|   } |   } | ||||||
|   set show(v) { |   set show(v) { | ||||||
|     this.options.show = v |     if(!this.isShowView) { | ||||||
|     this.originalOptions.show = v |       this.options.show = v | ||||||
|     this.entity && (this.entity.show = v) |       this.originalOptions.show = v | ||||||
|  |     } | ||||||
|  |     if(!this.showView || this.showView == 3) { | ||||||
|  |       this.entity && (this.entity.show = this.options.show) | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |       this.entity && (this.entity.show = false) | ||||||
|  |     } | ||||||
|     syncData(this.sdk, this.options.id) |     syncData(this.sdk, this.options.id) | ||||||
|     syncSplitData(this.sdk, this.options.id) |     syncSplitData(this.sdk, this.options.id) | ||||||
|  |  | ||||||
|     if (this._DialogObject && this._DialogObject.showBtn) { |     if (this._DialogObject && this._DialogObject.showBtn) { | ||||||
|       this._DialogObject.showBtn.checked = v |       this._DialogObject.showBtn.checked = this.options.show | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     this.isShowView = false | ||||||
|     // if (v) { |     // if (v) { | ||||||
|     //   if (this.diffuseShow) { |     //   if (this.diffuseShow) { | ||||||
|     //     this.diffuseShow = true |     //     this.diffuseShow = true | ||||||
| @ -766,6 +776,8 @@ class BillboardObject extends Base { | |||||||
|       _this._frameImages = [] |       _this._frameImages = [] | ||||||
|       superGif.load(function (status) { |       superGif.load(function (status) { | ||||||
|         if (status == 404) { |         if (status == 404) { | ||||||
|  |           let width = 31 | ||||||
|  |           let height = 36 | ||||||
|           canvas = document.createElement('canvas') |           canvas = document.createElement('canvas') | ||||||
|           canvas.width = 0 |           canvas.width = 0 | ||||||
|           canvas.height = 0 |           canvas.height = 0 | ||||||
| @ -855,6 +867,8 @@ class BillboardObject extends Base { | |||||||
|         billboardH = height * (31 / width) |         billboardH = height * (31 / width) | ||||||
|       } |       } | ||||||
|       image.onerror = function (err) { |       image.onerror = function (err) { | ||||||
|  |         let width = 31 | ||||||
|  |         let height = 36 | ||||||
|         canvas.width = 0 |         canvas.width = 0 | ||||||
|         canvas.height = 0 |         canvas.height = 0 | ||||||
|         billboardH = 0 |         billboardH = 0 | ||||||
| @ -931,7 +945,7 @@ class BillboardObject extends Base { | |||||||
|     this.renewPoint() |     this.renewPoint() | ||||||
|     if (this._elms.labelColor) { |     if (this._elms.labelColor) { | ||||||
|       this._elms.labelColor.forEach((item, i) => { |       this._elms.labelColor.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini', //颜色box类型 |           size: 'mini', //颜色box类型 | ||||||
|           alpha: true, //是否开启透明度 |           alpha: true, //是否开启透明度 | ||||||
| @ -1004,7 +1018,7 @@ class BillboardObject extends Base { | |||||||
|   //   this.options.diffuseColor = v |   //   this.options.diffuseColor = v | ||||||
|   //   if (this._elms.diffuseColor) { |   //   if (this._elms.diffuseColor) { | ||||||
|   //     this._elms.diffuseColor.forEach((item, i) => { |   //     this._elms.diffuseColor.forEach((item, i) => { | ||||||
|   //       let diffuseColorPicker = new ewPlugins('colorpicker', { |   //       let diffuseColorPicker = new YJColorPicker({ | ||||||
|   //         el: item.el, |   //         el: item.el, | ||||||
|   //         size: 'mini',//颜色box类型 |   //         size: 'mini',//颜色box类型 | ||||||
|   //         alpha: false,//是否开启透明度 |   //         alpha: false,//是否开启透明度 | ||||||
| @ -1080,7 +1094,7 @@ class BillboardObject extends Base { | |||||||
|   //   this.options.scanColor = v |   //   this.options.scanColor = v | ||||||
|   //   if (this._elms.scanColor) { |   //   if (this._elms.scanColor) { | ||||||
|   //     this._elms.scanColor.forEach((item, i) => { |   //     this._elms.scanColor.forEach((item, i) => { | ||||||
|   //       let scanColorPicker = new ewPlugins('colorpicker', { |   //       let scanColorPicker = new YJColorPicker({ | ||||||
|   //         el: item.el, |   //         el: item.el, | ||||||
|   //         size: 'mini',//颜色box类型 |   //         size: 'mini',//颜色box类型 | ||||||
|   //         alpha: false,//是否开启透明度 |   //         alpha: false,//是否开启透明度 | ||||||
| @ -1645,7 +1659,7 @@ class BillboardObject extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs('point-object-edit-tabs', undefined, this.sdk) |       let tabsElm = new cy_tabs('point-object-edit-tabs', undefined, this.sdk) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName('labelColor')[0], |         el: contentElm.getElementsByClassName('labelColor')[0], | ||||||
|         size: 'mini', //颜色box类型 |         size: 'mini', //颜色box类型 | ||||||
|         alpha: true, //是否开启透明度 |         alpha: true, //是否开启透明度 | ||||||
| @ -1660,7 +1674,7 @@ class BillboardObject extends Base { | |||||||
|         } //点击清空按钮事件回调 |         } //点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|  |  | ||||||
|       // let diffuseColorPicker = new ewPlugins('colorpicker', { |       // let diffuseColorPicker = new YJColorPicker({ | ||||||
|       //   el: contentElm.getElementsByClassName("diffuseColor")[0], |       //   el: contentElm.getElementsByClassName("diffuseColor")[0], | ||||||
|       //   size: 'mini',//颜色box类型 |       //   size: 'mini',//颜色box类型 | ||||||
|       //   alpha: false,//是否开启透明度 |       //   alpha: false,//是否开启透明度 | ||||||
| @ -1674,7 +1688,7 @@ class BillboardObject extends Base { | |||||||
|       //     this.diffuseColor = 'rgba(255,255,255,1)' |       //     this.diffuseColor = 'rgba(255,255,255,1)' | ||||||
|       //   },//点击清空按钮事件回调 |       //   },//点击清空按钮事件回调 | ||||||
|       // }) |       // }) | ||||||
|       // let scanColorPicker = new ewPlugins('colorpicker', { |       // let scanColorPicker = new YJColorPicker({ | ||||||
|       //   el: contentElm.getElementsByClassName("scanColor")[0], |       //   el: contentElm.getElementsByClassName("scanColor")[0], | ||||||
|       //   size: 'mini',//颜色box类型 |       //   size: 'mini',//颜色box类型 | ||||||
|       //   alpha: false,//是否开启透明度 |       //   alpha: false,//是否开启透明度 | ||||||
| @ -2344,6 +2358,9 @@ class BillboardObject extends Base { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   async updateHeight() { |   async updateHeight() { | ||||||
|  |     if (!this.sdk || !this.sdk.viewer || !this.sdk.viewer.scene) { | ||||||
|  |       return | ||||||
|  |     } | ||||||
|     let height |     let height | ||||||
|     let height2 |     let height2 | ||||||
|     let point1 = new Cesium.Cartesian3.fromDegrees( |     let point1 = new Cesium.Cartesian3.fromDegrees( | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ import EventBinding from '../../Element/Dialog/eventBinding'; | |||||||
| import richText from "../../Element/richText"; | import richText from "../../Element/richText"; | ||||||
| import MouseEvent from '../../../Event/index' | import MouseEvent from '../../../Event/index' | ||||||
| import LabelObject from '../LabelObject' | import LabelObject from '../LabelObject' | ||||||
| import { syncData } from '../../../Global/MultiViewportMode' | import { syncData, getSdk as get2DSdk } from '../../../Global/MultiViewportMode' | ||||||
| import { legp } from '../../Element/datalist'; | import { legp } from '../../Element/datalist'; | ||||||
| import { getFontList, getFontFamilyName } from '../../Element/fontSelect' | import { getFontList, getFontFamilyName } from '../../Element/fontSelect' | ||||||
| import MouseTip from '../../../MouseTip' | import MouseTip from '../../../MouseTip' | ||||||
| @ -181,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 = 1000000 |         that.entity.ellipse.height = 1 | ||||||
|       } |       } | ||||||
|       CircleDiffuse.createLabel(that) |       CircleDiffuse.createLabel(that) | ||||||
|       syncData(that.sdk, that.options.id) |       syncData(that.sdk, that.options.id) | ||||||
| @ -223,16 +223,31 @@ class CircleDiffuse extends Base { | |||||||
|  |  | ||||||
|   set show(v) { |   set show(v) { | ||||||
|     if (typeof v === "boolean") { |     if (typeof v === "boolean") { | ||||||
|       this.options.show = v |       let sdkD = get2DSdk().sdkD | ||||||
|       this.entity.show = v |       if (!this.isShowView || !sdkD) { | ||||||
|  |         this.options.show = v | ||||||
|  |       } | ||||||
|  |       if (!this.showView || this.showView == 3 || !sdkD) { | ||||||
|  |         this.entity.show = this.options.show  | ||||||
|  |         if (this.options.label.show) { | ||||||
|  |           this.label.show = this.options.show  | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |       else { | ||||||
|  |         this.entity.show = false | ||||||
|  |         if (this.options.label.show) { | ||||||
|  |           this.label.show = false | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |  | ||||||
|  |       this.isShowView = false | ||||||
|  |        | ||||||
|       syncData(this.sdk, this.options.id) |       syncData(this.sdk, this.options.id) | ||||||
|       syncSplitData(this.sdk, this.options.id) |       syncSplitData(this.sdk, this.options.id) | ||||||
|       if (this._DialogObject && this._DialogObject.showBtn) { |       if (this._DialogObject && this._DialogObject.showBtn) { | ||||||
|         this._DialogObject.showBtn.checked = v |         this._DialogObject.showBtn.checked = v | ||||||
|       } |       } | ||||||
|       if (this.options.label.show) { |        | ||||||
|         this.label.show = v |  | ||||||
|       } |  | ||||||
|     } else { |     } else { | ||||||
|       console.error("参数必须为boolean") |       console.error("参数必须为boolean") | ||||||
|     } |     } | ||||||
| @ -362,6 +377,7 @@ class CircleDiffuse extends Base { | |||||||
|     return this.options.circle |     return this.options.circle | ||||||
|   } |   } | ||||||
|   set circle(v) { |   set circle(v) { | ||||||
|  |     console.log(v) | ||||||
|     this.options.circle = v || [{ radius: 10 }] |     this.options.circle = v || [{ radius: 10 }] | ||||||
|     for (let i = 0; i < this.options.circle.length; i++) { |     for (let i = 0; i < this.options.circle.length; i++) { | ||||||
|       if(this.options.circle[i].radius>999999) { |       if(this.options.circle[i].radius>999999) { | ||||||
| @ -427,8 +443,9 @@ class CircleDiffuse extends Base { | |||||||
|     return this.options.label.show |     return this.options.label.show | ||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|  |     let sdkD = get2DSdk().sdkD | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show) { |     if (this.show && (!this.showView || this.showView == 3 || !sdkD)) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @ -462,7 +479,7 @@ class CircleDiffuse extends Base { | |||||||
|     this.label.color = v |     this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -562,7 +579,7 @@ class CircleDiffuse extends Base { | |||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -589,7 +606,7 @@ class CircleDiffuse extends Base { | |||||||
|     this.label.backgroundColor = [v, this.label.backgroundColor[1]] |     this.label.backgroundColor = [v, this.label.backgroundColor[1]] | ||||||
|     if (this._elms.labelBackgroundColorStart) { |     if (this._elms.labelBackgroundColorStart) { | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |       this._elms.labelBackgroundColorStart.forEach((item, i) => { | ||||||
|         let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -615,7 +632,7 @@ class CircleDiffuse extends Base { | |||||||
|     this.label.backgroundColor = [this.label.backgroundColor[0], v] |     this.label.backgroundColor = [this.label.backgroundColor[0], v] | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -1104,7 +1121,7 @@ class CircleDiffuse extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs('circle-diffuse-edit-tabs', undefined, this.sdk) |       let tabsElm = new cy_tabs('circle-diffuse-edit-tabs', undefined, this.sdk) | ||||||
|  |  | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |         el: contentElm.getElementsByClassName("labelColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1118,7 +1135,7 @@ class CircleDiffuse extends Base { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let lineColorPicker = new ewPlugins('colorpicker', { |       let lineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelLineColor")[0], |         el: contentElm.getElementsByClassName("labelLineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1132,7 +1149,7 @@ class CircleDiffuse extends Base { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -1146,7 +1163,7 @@ class CircleDiffuse extends Base { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         }, |         }, | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -1321,7 +1338,7 @@ class CircleDiffuse extends Base { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   async remove() { |   async remove() { | ||||||
|     this.label.remove() |     this.label && this.label.remove() | ||||||
|     this.entity && this.sdk.viewer.entities.remove(this.entity) |     this.entity && this.sdk.viewer.entities.remove(this.entity) | ||||||
|     this.entity2 && this.sdk.viewer.entities.remove(this.entity2) |     this.entity2 && this.sdk.viewer.entities.remove(this.entity2) | ||||||
|     this.entity = null |     this.entity = null | ||||||
| @ -1405,7 +1422,7 @@ class CircleDiffuse extends Base { | |||||||
|                   } |                   } | ||||||
|                 } |                 } | ||||||
|                 this._radius = radius |                 this._radius = radius | ||||||
|                 inputElm.value = value |                 // inputElm.value = value | ||||||
|                 CircleDiffuse.create(this) |                 CircleDiffuse.create(this) | ||||||
|               } |               } | ||||||
|             } |             } | ||||||
| @ -1446,11 +1463,11 @@ class CircleDiffuse extends Base { | |||||||
|  |  | ||||||
|  |  | ||||||
|         // 颜色组件 |         // 颜色组件 | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: circleElm.getElementsByClassName("color")[0], |           el: circleElm.getElementsByClassName("color")[0], | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: false,//是否开启透明度 |           alpha: false,//是否开启透明度 | ||||||
|           defaultColor: this.options.circle[i].color, |           defaultColor: this.options.circle[i].color || this.options.color, | ||||||
|           disabled: false,//是否禁止打开颜色选择器 |           disabled: false,//是否禁止打开颜色选择器 | ||||||
|           openPickerAni: 'opacity',//打开颜色选择器动画 |           openPickerAni: 'opacity',//打开颜色选择器动画 | ||||||
|           sure: (color) => { |           sure: (color) => { | ||||||
|  | |||||||
| @ -45,7 +45,7 @@ class CircleObject extends Base { | |||||||
|     this.options.center = options.center || {} |     this.options.center = options.center || {} | ||||||
|     this.options.line = options.line || {} |     this.options.line = options.line || {} | ||||||
|     this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3) |     this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3) | ||||||
|     this.options.line.color = this.options.line.color || '#ff000080' |     this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)' | ||||||
|     this.options['area-unit'] = options['area-unit'] || '平方米' |     this.options['area-unit'] = options['area-unit'] || '平方米' | ||||||
|     options.label = options.label || {} |     options.label = options.label || {} | ||||||
|     this._elms = {}; |     this._elms = {}; | ||||||
| @ -216,7 +216,7 @@ class CircleObject extends Base { | |||||||
|     return this.options.color |     return this.options.color | ||||||
|   } |   } | ||||||
|   set color(v) { |   set color(v) { | ||||||
|     this.options.color = v || '#ff000080' |     this.options.color = v || 'rgba(255, 0, 0, 0.5)' | ||||||
|     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) { |     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) { | ||||||
|       return |       return | ||||||
|     } |     } | ||||||
| @ -229,7 +229,7 @@ class CircleObject extends Base { | |||||||
|     this.entity.polygon.material = material |     this.entity.polygon.material = material | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -252,14 +252,14 @@ class CircleObject extends Base { | |||||||
|     return this.options.line.color |     return this.options.line.color | ||||||
|   } |   } | ||||||
|   set lineColor(v) { |   set lineColor(v) { | ||||||
|     this.options.line.color = v || '#ff000080' |     this.options.line.color = v || 'rgba(255, 0, 0, 0.5)' | ||||||
|     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) { |     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) { | ||||||
|       return |       return | ||||||
|     } |     } | ||||||
|     this.entity.polyline.material = Cesium.Color.fromCssColorString(this.options.line.color) |     this.entity.polyline.material = Cesium.Color.fromCssColorString(this.options.line.color) | ||||||
|     if (this._elms.lineColor) { |     if (this._elms.lineColor) { | ||||||
|       this._elms.lineColor.forEach((item, i) => { |       this._elms.lineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -333,7 +333,7 @@ class CircleObject extends Base { | |||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show) { |     if (this.show && !this.showView || this.showView == 3) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @ -367,7 +367,7 @@ class CircleObject extends Base { | |||||||
|     this.label.color = v |     this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -467,7 +467,7 @@ class CircleObject extends Base { | |||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -494,7 +494,7 @@ class CircleObject extends Base { | |||||||
|     this.label.backgroundColor = [v, this.label.backgroundColor[1]] |     this.label.backgroundColor = [v, this.label.backgroundColor[1]] | ||||||
|     if (this._elms.labelBackgroundColorStart) { |     if (this._elms.labelBackgroundColorStart) { | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |       this._elms.labelBackgroundColorStart.forEach((item, i) => { | ||||||
|         let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -520,7 +520,7 @@ class CircleObject extends Base { | |||||||
|     this.label.backgroundColor = [this.label.backgroundColor[0], v] |     this.label.backgroundColor = [this.label.backgroundColor[0], v] | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -1151,7 +1151,7 @@ class CircleObject extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs('circle-object-edit-tabs', undefined, this.sdk) |       let tabsElm = new cy_tabs('circle-object-edit-tabs', undefined, this.sdk) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1165,7 +1165,7 @@ class CircleObject extends Base { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let linecolorPicker = new ewPlugins('colorpicker', { |       let linecolorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("lineColor")[0], |         el: contentElm.getElementsByClassName("lineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1179,7 +1179,7 @@ class CircleObject extends Base { | |||||||
|           this.lineColor = 'rgba(255,255,255,1)' |           this.lineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |         el: contentElm.getElementsByClassName("labelColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1193,7 +1193,7 @@ class CircleObject extends Base { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labellineColorPicker = new ewPlugins('colorpicker', { |       let labellineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelLineColor")[0], |         el: contentElm.getElementsByClassName("labelLineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1207,7 +1207,7 @@ class CircleObject extends Base { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -1221,7 +1221,7 @@ class CircleObject extends Base { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         }, |         }, | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| import { attributeElm, labelStyleElm1, labelStyleElm2 } from '../../Element/elm_html' | import { attributeElm, labelStyleElm1, labelStyleElm2 } from '../../Element/elm_html' | ||||||
|  |  | ||||||
| function html(that) { | function html(that) { | ||||||
|     return ` |   return ` | ||||||
|     <span class="custom-divider"></span> |     <span class="custom-divider"></span> | ||||||
|     <div class="div-item"> |     <div class="div-item"> | ||||||
|         <div class="row" style="align-items: flex-start;"> |         <div class="row" style="align-items: flex-start;"> | ||||||
| @ -9,22 +9,15 @@ function html(that) { | |||||||
|                 <span class="label">名称</span> |                 <span class="label">名称</span> | ||||||
|                 <input class="input" maxlength="40" type="text" @model="name"> |                 <input class="input" maxlength="40" type="text" @model="name"> | ||||||
|             </div> |             </div> | ||||||
|             <div class="col" style="flex: 0 0 54%;"> |             <div class="col" style="flex: 0 0 56%;"> | ||||||
|                 <div> |                 <div> | ||||||
|                     <div class="row"> |                     <div class="row"> | ||||||
|                         <div class="col input-select-unit-box"> |                         <div class="col input-select-unit-box"> | ||||||
|                             <span class="label">原始长度:</span> |                             <div class="input-select-unit"></div> | ||||||
|                             <input class="input input-text" readonly="readonly" type="text" style="flex: 0 0 130px;" @model="length"> |                             <input class="input input-text" readonly="readonly" type="text" style="flex: 0 0 130px;" @model="length"> | ||||||
|                             <div class="input-select-unit"></div> |                             <div class="input-select-unit"></div> | ||||||
|                         </div> |                         </div> | ||||||
|                     </div> |                     </div> | ||||||
|                     <div class="row"> |  | ||||||
|                         <div class="col input-select-fit-unit-box"> |  | ||||||
|                             <span class="label">拟合长度:</span> |  | ||||||
|                             <input class="input input-text" readonly="readonly" type="text" style="flex: 0 0 130px;" @model="fitLength"> |  | ||||||
|                             <div class="input-select-fit-unit"></div> |  | ||||||
|                         </div> |  | ||||||
|                     </div> |  | ||||||
|                 </div> |                 </div> | ||||||
|             </div> |             </div> | ||||||
|         </div> |         </div> | ||||||
| @ -72,7 +65,7 @@ function html(that) { | |||||||
|                             <span class="label">线条颜色</span> |                             <span class="label">线条颜色</span> | ||||||
|                             <div class="color"></div> |                             <div class="color"></div> | ||||||
|                         </div> |                         </div> | ||||||
|                         <div class="col"> |                         <div class="col" style="flex: 0 0 33%;"> | ||||||
|                             <span class="label">线条宽度</span> |                             <span class="label">线条宽度</span> | ||||||
|                             <div class="input-number input-number-unit-1" style="width: 80px;"> |                             <div class="input-number input-number-unit-1" style="width: 80px;"> | ||||||
|                                 <input class="input" type="number" title="" min="1" max="999" @model="lineWidth"> |                                 <input class="input" type="number" title="" min="1" max="999" @model="lineWidth"> | ||||||
| @ -80,7 +73,7 @@ function html(that) { | |||||||
|                                 <span class="arrow"></span> |                                 <span class="arrow"></span> | ||||||
|                             </div> |                             </div> | ||||||
|                         </div> |                         </div> | ||||||
|                         <div class="col input-select-line-type-box"> |                         <div class="col input-select-line-type-box" style="flex: 0 0 37%;"> | ||||||
|                             <span class="label">线条形式</span> |                             <span class="label">线条形式</span> | ||||||
|                             <div class="input-select-line-type"></div> |                             <div class="input-select-line-type"></div> | ||||||
|                         </div> |                         </div> | ||||||
| @ -90,7 +83,7 @@ function html(that) { | |||||||
|                             <span class="label">线段缓冲</span> |                             <span class="label">线段缓冲</span> | ||||||
|                             <input class="btn-switch" type="checkbox" @model="extend"> |                             <input class="btn-switch" type="checkbox" @model="extend"> | ||||||
|                         </div> |                         </div> | ||||||
|                         <div class="col"> |                         <div class="col" style="flex: 0 0 33%;"> | ||||||
|                             <span class="label">缓冲宽度</span> |                             <span class="label">缓冲宽度</span> | ||||||
|                             <div class="input-number input-number-unit-1" style="width: 80px;"> |                             <div class="input-number input-number-unit-1" style="width: 80px;"> | ||||||
|                                 <input class="input" type="number" title="" min="0" data-min="0.01" max="999999" @model="extendWidth"> |                                 <input class="input" type="number" title="" min="0" data-min="0.01" max="999999" @model="extendWidth"> | ||||||
| @ -98,21 +91,43 @@ function html(that) { | |||||||
|                                 <span class="arrow"></span> |                                 <span class="arrow"></span> | ||||||
|                             </div> |                             </div> | ||||||
|                         </div> |                         </div> | ||||||
|                         <div class="col"> |                         <div class="col" style="flex: 0 0 37%;"> | ||||||
|                             <span class="label">缓冲颜色</span> |                             <span class="label">缓冲颜色</span> | ||||||
|                             <div class="extendColor"></div> |                             <div class="extendColor"></div> | ||||||
|                         </div> |                         </div> | ||||||
|                     </div> |                     </div> | ||||||
|  |                     <div class="row" id="dashTextureDom"> | ||||||
|  |                         <div class="col"> | ||||||
|  |                             <span class="label">动画顺向</span> | ||||||
|  |                             <input class="btn-switch" type="checkbox" @model="rotate"> | ||||||
|  |                         </div> | ||||||
|  |                         <div class="col" style="flex: 0 0 33%;"> | ||||||
|  |                             <span class="label">流动速率</span> | ||||||
|  |                             <div class="input-number input-number-unit-1" style="width: 80px;"> | ||||||
|  |                                 <input class="input" type="number" title="" min="0" max="999999" step="1" @model="speed"> | ||||||
|  |                                 <span class="arrow"></span> | ||||||
|  |                             </div> | ||||||
|  |                         </div> | ||||||
|  |                         <div class="col" style="flex: 0 0 37%;"> | ||||||
|  |                               <span class="label lineSpace">间距</span> | ||||||
|  |                               <div class="input-number input-number-unit-1 lineSpace" style="width: 80px;"> | ||||||
|  |                                   <input class="input" type="number" title="" min="0" max="4.5" step="0.1" @model="space"> | ||||||
|  |                                   <span class="unit">倍</span> | ||||||
|  |                                   <span class="arrow"></span> | ||||||
|  |                               </div> | ||||||
|  |                         </div> | ||||||
|  |                     </div> | ||||||
|                     <div class="row"> |                     <div class="row"> | ||||||
|                         <div class="col"> |                         <div class="col"> | ||||||
|                             <span class="label">首尾相连</span> |                             <span class="label">首尾相连</span> | ||||||
|                             <input class="btn-switch" type="checkbox" @model="noseToTail"> |                             <input class="btn-switch" type="checkbox" @model="noseToTail"> | ||||||
|                         </div> |                         </div> | ||||||
|                         <div class="col"> |                         <div class="col" style="flex: 0 0 33%;"> | ||||||
|                         </div> |                         </div> | ||||||
|                         <div class="col"> |                         <div class="col" style="flex: 0 0 37%;"> | ||||||
|                         </div> |                         </div> | ||||||
|                     </div> |                     </div> | ||||||
|  |  | ||||||
|                 </DIV-cy-tab-pane> |                 </DIV-cy-tab-pane> | ||||||
|                 <DIV-cy-tab-pane label="标注风格"> |                 <DIV-cy-tab-pane label="标注风格"> | ||||||
|                     ${labelStyleElm1()} |                     ${labelStyleElm1()} | ||||||
|  | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -24,7 +24,7 @@ class EllipseObject extends Base { | |||||||
|    * @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="#ff000080" {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} 维度 | ||||||
|    * @param options.semiMinorAxis=10 {number} 短半轴长度 |    * @param options.semiMinorAxis=10 {number} 短半轴长度 | ||||||
| @ -32,14 +32,14 @@ class EllipseObject extends Base { | |||||||
|    * @param options.bearing=0 {number} 旋转角度 |    * @param options.bearing=0 {number} 旋转角度 | ||||||
|    * @param options.line {object} 边框 |    * @param options.line {object} 边框 | ||||||
|    * @param options.line.width=2 {string} 边框宽 |    * @param options.line.width=2 {string} 边框宽 | ||||||
|    * @param options.line.color="#ff000080" {string} 边框颜色 |    * @param options.line.color="rgba(255, 0, 0, 1)" {string} 边框颜色 | ||||||
|    * @param options.label {object} 标注 |    * @param options.label {object} 标注 | ||||||
|    * @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式) |    * @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式) | ||||||
|    */ |    */ | ||||||
|   constructor(sdk, options = {}) { |   constructor(sdk, options = {}) { | ||||||
|     super(sdk, options); |     super(sdk, options); | ||||||
|     this.options.name = options.name || '未命名对象' |     this.options.name = options.name || '未命名对象' | ||||||
|     this.options.color = options.color || "#ff000080" |     this.options.color = options.color || "rgba(255, 0, 0, 0.5)" | ||||||
|     this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2 |     this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2 | ||||||
|     this.options.semiMinorAxis = (options.semiMinorAxis || options.semiMinorAxis === 0) ? options.semiMinorAxis : 10 |     this.options.semiMinorAxis = (options.semiMinorAxis || options.semiMinorAxis === 0) ? options.semiMinorAxis : 10 | ||||||
|     this.options.semiMajorAxis = (options.semiMajorAxis || options.semiMajorAxis === 0) ? options.semiMajorAxis : 20 |     this.options.semiMajorAxis = (options.semiMajorAxis || options.semiMajorAxis === 0) ? options.semiMajorAxis : 20 | ||||||
| @ -47,7 +47,7 @@ class EllipseObject extends Base { | |||||||
|     this.options.center = options.center || {} |     this.options.center = options.center || {} | ||||||
|     this.options.line = options.line || {} |     this.options.line = options.line || {} | ||||||
|     this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3) |     this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3) | ||||||
|     this.options.line.color = this.options.line.color || '#ff000080' |     this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)' | ||||||
|     this.options['area-unit'] = options['area-unit'] || '平方米' |     this.options['area-unit'] = options['area-unit'] || '平方米' | ||||||
|     options.label = options.label || {} |     options.label = options.label || {} | ||||||
|     this._elms = {}; |     this._elms = {}; | ||||||
| @ -229,7 +229,7 @@ class EllipseObject extends Base { | |||||||
|     return this.options.color |     return this.options.color | ||||||
|   } |   } | ||||||
|   set color(v) { |   set color(v) { | ||||||
|     this.options.color = v || '#ff000080' |     this.options.color = v || 'rgba(255, 0, 0, 0.5)' | ||||||
|     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) { |     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) { | ||||||
|       return |       return | ||||||
|     } |     } | ||||||
| @ -243,7 +243,7 @@ class EllipseObject extends Base { | |||||||
|     this.entity.polyline.width = this.lineWidth |     this.entity.polyline.width = this.lineWidth | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -266,14 +266,14 @@ class EllipseObject extends Base { | |||||||
|     return this.options.line.color |     return this.options.line.color | ||||||
|   } |   } | ||||||
|   set lineColor(v) { |   set lineColor(v) { | ||||||
|     this.options.line.color = v || '#ff000080' |     this.options.line.color = v || 'rgba(255, 0, 0, 0.5)' | ||||||
|     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) { |     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) { | ||||||
|       return |       return | ||||||
|     } |     } | ||||||
|     this.entity.polyline.material = Cesium.Color.fromCssColorString(this.options.line.color) |     this.entity.polyline.material = Cesium.Color.fromCssColorString(this.options.line.color) | ||||||
|     if (this._elms.lineColor) { |     if (this._elms.lineColor) { | ||||||
|       this._elms.lineColor.forEach((item, i) => { |       this._elms.lineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -347,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) { |     if (this.show && !this.showView || this.showView == 3) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @ -381,7 +381,7 @@ class EllipseObject extends Base { | |||||||
|     this.label.color = v |     this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -481,7 +481,7 @@ class EllipseObject extends Base { | |||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -508,7 +508,7 @@ class EllipseObject extends Base { | |||||||
|     this.label.backgroundColor = [v, this.label.backgroundColor[1]] |     this.label.backgroundColor = [v, this.label.backgroundColor[1]] | ||||||
|     if (this._elms.labelBackgroundColorStart) { |     if (this._elms.labelBackgroundColorStart) { | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |       this._elms.labelBackgroundColorStart.forEach((item, i) => { | ||||||
|         let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -534,7 +534,7 @@ class EllipseObject extends Base { | |||||||
|     this.label.backgroundColor = [this.label.backgroundColor[0], v] |     this.label.backgroundColor = [this.label.backgroundColor[0], v] | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -1161,7 +1161,7 @@ class EllipseObject extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs('circle-object-edit-tabs', undefined, this.sdk) |       let tabsElm = new cy_tabs('circle-object-edit-tabs', undefined, this.sdk) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1175,7 +1175,7 @@ class EllipseObject extends Base { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let linecolorPicker = new ewPlugins('colorpicker', { |       let linecolorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("lineColor")[0], |         el: contentElm.getElementsByClassName("lineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1189,7 +1189,7 @@ class EllipseObject extends Base { | |||||||
|           this.lineColor = 'rgba(255,255,255,1)' |           this.lineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |         el: contentElm.getElementsByClassName("labelColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1203,7 +1203,7 @@ class EllipseObject extends Base { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labellineColorPicker = new ewPlugins('colorpicker', { |       let labellineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelLineColor")[0], |         el: contentElm.getElementsByClassName("labelLineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1217,7 +1217,7 @@ class EllipseObject extends Base { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -1231,7 +1231,7 @@ class EllipseObject extends Base { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         }, |         }, | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
|  | |||||||
| @ -89,6 +89,7 @@ class FlowLine extends Base { | |||||||
|     const minLat = Math.min(...lats), maxLat = Math.max(...lats); |     const minLat = Math.min(...lats), maxLat = Math.max(...lats); | ||||||
|  |  | ||||||
|     const points = []; |     const points = []; | ||||||
|  |     let that = this | ||||||
|     while (points.length < count) { |     while (points.length < count) { | ||||||
|       const lon = minLon + Math.random() * (maxLon - minLon); |       const lon = minLon + Math.random() * (maxLon - minLon); | ||||||
|       const lat = minLat + Math.random() * (maxLat - minLat); |       const lat = minLat + Math.random() * (maxLat - minLat); | ||||||
| @ -100,9 +101,14 @@ class FlowLine extends Base { | |||||||
|  |  | ||||||
|       const isInside = turf.booleanPointInPolygon(point, polygon); |       const isInside = turf.booleanPointInPolygon(point, polygon); | ||||||
|       if (isInside) { |       if (isInside) { | ||||||
|  |         let posi = Cesium.Cartesian3.fromDegrees(lon, lat); | ||||||
|  |         const cartographic = that.viewer.scene.globe.ellipsoid.cartesianToCartographic(posi); | ||||||
|  |         const height = cartographic.height; | ||||||
|  |  | ||||||
|         points.push([ |         points.push([ | ||||||
|           lon, |           lon, | ||||||
|           lat |           lat, | ||||||
|  |           height | ||||||
|         ]); |         ]); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
| @ -126,15 +132,17 @@ class FlowLine extends Base { | |||||||
|     positions.forEach((item, index) => { |     positions.forEach((item, index) => { | ||||||
|       let point = item |       let point = item | ||||||
|       //根据点设置起始点位置 |       //根据点设置起始点位置 | ||||||
|       let start = Cesium.Cartesian3.fromDegrees(point[0], point[1], 0) |       // let start = Cesium.Cartesian3.fromDegrees(point[0], point[1], 0) | ||||||
|  |       let start = Cesium.Cartesian3.fromDegrees(point[0], point[1], point[2]) | ||||||
|       //根据点设置结束点位置 |       //根据点设置结束点位置 | ||||||
|       let end = Cesium.Cartesian3.fromDegrees(point[0], point[1], that.options.height + Math.random() * that.options.heightDifference) |       let end = Cesium.Cartesian3.fromDegrees(point[0], point[1], point[2] + that.options.height + Math.random() * that.options.heightDifference) | ||||||
|       //创建线 |       //创建线 | ||||||
|       that.viewer.entities.add({ |       that.viewer.entities.add({ | ||||||
|         parent: celiangEntity, |         parent: celiangEntity, | ||||||
|  |         id: that.options.id + '-' + new Date().getTime() + index, | ||||||
|         polyline: { |         polyline: { | ||||||
|           positions: [start, end], |           positions: [start, end], | ||||||
|           width: 2, |           width: that.options.width, | ||||||
|           // material:Cesium.Color.RED |           // material:Cesium.Color.RED | ||||||
|           material: new Cesium.FlowLineMaterialProperty({ |           material: new Cesium.FlowLineMaterialProperty({ | ||||||
|             color: that.options.color, |             color: that.options.color, | ||||||
| @ -163,7 +171,7 @@ class FlowLine extends Base { | |||||||
|  |  | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let picker = new ewPlugins('colorpicker', { |         let picker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -208,6 +216,17 @@ class FlowLine extends Base { | |||||||
|       this.getLine(this, this.positions) |       this.getLine(this, this.positions) | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |   get show() { | ||||||
|  |     return this.options.show | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   set show(v) { | ||||||
|  |     this.options.show = v | ||||||
|  |     let entity = this.viewer.entities.getById(this.options.id) | ||||||
|  |     if (entity) { | ||||||
|  |       entity.show = v | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|   get heightDifference() { |   get heightDifference() { | ||||||
|     return this.options.heightDifference |     return this.options.heightDifference | ||||||
| @ -296,9 +315,9 @@ class FlowLine extends Base { | |||||||
|           this.reset() |           this.reset() | ||||||
|           this.Dialog.resetCallBack && this.Dialog.resetCallBack() |           this.Dialog.resetCallBack && this.Dialog.resetCallBack() | ||||||
|         }, |         }, | ||||||
|         // removeCallBack: () => { |         removeCallBack: () => { | ||||||
|         //   this.Dialog.removeCallBack && this.Dialog.removeCallBack() |           this.Dialog.removeCallBack && this.Dialog.removeCallBack() | ||||||
|         // }, |         }, | ||||||
|         closeCallBack: () => { |         closeCallBack: () => { | ||||||
|           this.reset() |           this.reset() | ||||||
|           // this.entity.style = new Cesium.Cesium3DTileStyle({ |           // this.entity.style = new Cesium.Cesium3DTileStyle({ | ||||||
| @ -317,7 +336,7 @@ class FlowLine extends Base { | |||||||
|       contentElm.innerHTML = html() |       contentElm.innerHTML = html() | ||||||
|       this._DialogObject.contentAppChild(contentElm) |       this._DialogObject.contentAppChild(contentElm) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let waterColorPicker = new ewPlugins('colorpicker', { |       let waterColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("flowLine-color")[0], |         el: contentElm.getElementsByClassName("flowLine-color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -425,7 +444,7 @@ class FlowLine extends Base { | |||||||
|         let a = Cesium.Cartesian3.fromDegrees( |         let a = Cesium.Cartesian3.fromDegrees( | ||||||
|           this.positions[i][0], |           this.positions[i][0], | ||||||
|           this.positions[i][1], |           this.positions[i][1], | ||||||
|           this.options.height + this.options.heightDifference / 2 |           this.positions[i][2] + this.options.height + this.options.heightDifference / 2 | ||||||
|         ) |         ) | ||||||
|         positionArray.push(a.x, a.y, a.z) |         positionArray.push(a.x, a.y, a.z) | ||||||
|       } |       } | ||||||
|  | |||||||
| @ -162,6 +162,7 @@ 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']") | ||||||
|  | |||||||
| @ -8,6 +8,8 @@ | |||||||
| import { getHost, getToken } from "../../../on"; | import { getHost, getToken } from "../../../on"; | ||||||
| import Base from '../index' | import Base from '../index' | ||||||
| import Tools from '../../../Tools' | import Tools from '../../../Tools' | ||||||
|  | import { syncSplitData } from "../../../Global/SplitScreen"; | ||||||
|  | import { syncData, getSdk as get2DSdk } from '../../../Global/MultiViewportMode' | ||||||
| import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../Global/global' | import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../Global/global' | ||||||
|  |  | ||||||
| class GeoJson extends Base { | class GeoJson extends Base { | ||||||
| @ -27,6 +29,7 @@ class GeoJson extends Base { | |||||||
|     this.primitive = undefined |     this.primitive = undefined | ||||||
|     this.positions = [] |     this.positions = [] | ||||||
|      |      | ||||||
|  |  | ||||||
|     this.loading = true |     this.loading = true | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @ -48,6 +51,27 @@ class GeoJson extends Base { | |||||||
|     return this.options.show |     return this.options.show | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   // set show(status) { | ||||||
|  |   //   let sdkD = get2DSdk().sdkD | ||||||
|  |   //   if (!this.isShowView || !sdkD) { | ||||||
|  |   //     this.options.show = status | ||||||
|  |   //   } | ||||||
|  |   //   if (this.entity) { | ||||||
|  |   //     if (!this.showView || this.showView == 3 || !sdkD) { | ||||||
|  |   //       for (let i = 0; i < this.entity.entities.values.length; i++) { | ||||||
|  |   //         this.entity.entities.values[i].show = this.options.show | ||||||
|  |   //       } | ||||||
|  |   //     } | ||||||
|  |   //     else { | ||||||
|  |   //       for (let i = 0; i < this.entity.entities.values.length; i++) { | ||||||
|  |   //         this.entity.entities.values[i].show = false | ||||||
|  |   //       } | ||||||
|  |   //     } | ||||||
|  |   //   } | ||||||
|  |   //   syncData(this.sdk, this.options.id) | ||||||
|  |   //   syncSplitData(this.sdk, this.options.id) | ||||||
|  |   //   this.isShowView = false | ||||||
|  |   // } | ||||||
|   set show(status) { |   set show(status) { | ||||||
|     this.options.show = status |     this.options.show = status | ||||||
|     if (this.entity) { |     if (this.entity) { | ||||||
| @ -74,6 +98,7 @@ class GeoJson extends Base { | |||||||
|     }) |     }) | ||||||
|     let json = await rsp.json() |     let json = await rsp.json() | ||||||
|     this.geojson = json |     this.geojson = json | ||||||
|  |     // this.sdk.addIncetance(this.options.id, this) | ||||||
|     return GeoJson.addDataToGlobe(this, json.features) |     return GeoJson.addDataToGlobe(this, json.features) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | |||||||
| @ -37,7 +37,7 @@ class Graffiti extends Draw { | |||||||
|     this.options.color = v |     this.options.color = v | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -77,7 +77,7 @@ class Graffiti extends Draw { | |||||||
|       contentElm.innerHTML = html() |       contentElm.innerHTML = html() | ||||||
|       that._DialogObject.contentAppChild(contentElm) |       that._DialogObject.contentAppChild(contentElm) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
|  | |||||||
| @ -1,5 +1,5 @@ | |||||||
| function html() { | function html() { | ||||||
|   return ` |     return ` | ||||||
|   <span class="custom-divider"></span> |   <span class="custom-divider"></span> | ||||||
|   <div class="div-item"> |   <div class="div-item"> | ||||||
|     <div class="row"> |     <div class="row"> | ||||||
| @ -7,13 +7,21 @@ function html() { | |||||||
|             <span class="label">名称</span> |             <span class="label">名称</span> | ||||||
|             <input class="input" maxlength="40" type="text" @model="name"> |             <input class="input" maxlength="40" type="text" @model="name"> | ||||||
|         </div> |         </div> | ||||||
|         <div class="col"> |         <div class="col"></div> | ||||||
|         </div> |  | ||||||
|     </div> |     </div> | ||||||
|   </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="row"> | ||||||
|  |         <div class="col"> | ||||||
|  |             <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 class="row" mode="0"> | ||||||
|         <div class="col"> |         <div class="col"> | ||||||
|             <span class="label">旋转角度</span> |             <span class="label">旋转角度</span> | ||||||
|             <input type="range" max="360" min="0" step="0.1" @model="angle"> |             <input type="range" max="360" min="0" step="0.1" @model="angle"> | ||||||
| @ -24,16 +32,85 @@ function html() { | |||||||
|             </div> |             </div> | ||||||
|         </div> |         </div> | ||||||
|     </div> |     </div> | ||||||
|     <div class="row"> |     <div class="row" mode="0"> | ||||||
|         <div class="col"> |         <div class="col"> | ||||||
|             <span class="label">调整大小</span> |             <span class="label">调整大小</span> | ||||||
|             <input type="range" max="99999" min="0" step="0.1" @model="scale"> |             <input type="range" max="40000" min="0" step="0.1" @model="scale"> | ||||||
|             <div class="input-number input-number-unit-1" style="width: 100px;flex: 0 0 100px;margin-left: 10px;"> |             <div class="input-number input-number-unit-1" style="width: 100px;flex: 0 0 100px;margin-left: 10px;"> | ||||||
|                 <input class="input" type="number" title="" min="0" max="99999" step="0.1" @model="scale"> |                 <input class="input" type="number" title="" min="0" max="40000" step="0.1" @model="scale"> | ||||||
|                 <span class="arrow"></span> |                 <span class="arrow"></span> | ||||||
|             </div> |             </div> | ||||||
|         </div> |         </div> | ||||||
|     </div> |     </div> | ||||||
|  |         <div class="row" mode="1"> | ||||||
|  |             <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" mode="1"> | ||||||
|  |             <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 mode="1">文字设置</h4> | ||||||
|  |                     <div class="row"  mode="1"> | ||||||
|  |                         <div class="col" style="flex: 0 0 80px;margin: 0 10px;"> | ||||||
|  |                             <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 150px;"> | ||||||
|  |                             <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" 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" style="margin-left: 10px;"> | ||||||
|  |                             <span class="label">文字颜色</span> | ||||||
|  |                             <div class="labelColor"></div> | ||||||
|  |                         </div> | ||||||
|  |                     </div> | ||||||
|   </div> |   </div> | ||||||
|   <span class="custom-divider"></span> |   <span class="custom-divider"></span> | ||||||
|   ` |   ` | ||||||
|  | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -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,7 +62,7 @@ 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> | ||||||
| @ -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="-999" 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="-999" 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"> | ||||||
|  | |||||||
| @ -123,7 +123,7 @@ class GroundSvg extends Base { | |||||||
|     } |     } | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -796,7 +796,7 @@ class GroundSvg extends Base { | |||||||
|       await this._DialogObject.contentAppChild(contentElm) |       await this._DialogObject.contentAppChild(contentElm) | ||||||
|  |  | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
|  | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -14,6 +14,8 @@ 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 | ||||||
| @ -65,6 +67,11 @@ class LabelObject extends Base { | |||||||
|     } |     } | ||||||
|     this.originalOptions = copyObj(this.options) |     this.originalOptions = copyObj(this.options) | ||||||
|  |  | ||||||
|  |     let id = this.options.id + '-label' | ||||||
|  |     let oldEntity = this.sdk.viewer.entities.getById(id) | ||||||
|  |     if(oldEntity) { | ||||||
|  |       this.sdk.viewer.entities.remove(oldEntity) | ||||||
|  |     } | ||||||
|     this.entity = this.sdk.viewer.entities.add({ |     this.entity = this.sdk.viewer.entities.add({ | ||||||
|       show: this.options.show, |       show: this.options.show, | ||||||
|       id: this.options.id + '-label', |       id: this.options.id + '-label', | ||||||
| @ -433,11 +440,12 @@ class LabelObject extends Base { | |||||||
|     this.updateBillboardImage() |     this.updateBillboardImage() | ||||||
|   } |   } | ||||||
|   updateBillboardImage() { |   updateBillboardImage() { | ||||||
|     clearTimeout(this.#updateBillboardImageTimeout) |     this.entity.billboard.image = this.getcanvas() | ||||||
|     this.#updateBillboardImageTimeout = setTimeout(() => { |     // clearTimeout(this.#updateBillboardImageTimeout) | ||||||
|       clearTimeout(this.#updateBillboardImageTimeout) |     // this.#updateBillboardImageTimeout = setTimeout(() => { | ||||||
|       this.entity.billboard.image = this.getcanvas() |     //   clearTimeout(this.#updateBillboardImageTimeout) | ||||||
|     }, 500) |     //   this.entity.billboard.image = this.getcanvas() | ||||||
|  |     // }, 500) | ||||||
|   } |   } | ||||||
|   get lineColor() { |   get lineColor() { | ||||||
|     return this.options.pixelOffset |     return this.options.pixelOffset | ||||||
| @ -484,9 +492,8 @@ class LabelObject extends Base { | |||||||
|   // } |   // } | ||||||
|  |  | ||||||
|   getcanvas() { |   getcanvas() { | ||||||
|     const canvas = document.createElement('canvas') |     const ctx = this.#canvas.getContext('2d') | ||||||
|     const ctx = canvas.getContext('2d') |     ctx.clearRect(0, 0, this.#canvas.width, this.#canvas.height); | ||||||
|  |  | ||||||
|     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 | ||||||
| @ -504,9 +511,8 @@ class LabelObject extends Base { | |||||||
|     if (canvasWidth < this.options.lineWidth) { |     if (canvasWidth < this.options.lineWidth) { | ||||||
|       canvasWidth = this.options.lineWidth |       canvasWidth = this.options.lineWidth | ||||||
|     } |     } | ||||||
|     canvas.width = canvasWidth |     this.#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, | ||||||
| @ -553,15 +559,14 @@ class LabelObject extends Base { | |||||||
|     ctx.stroke() |     ctx.stroke() | ||||||
|     ctx.closePath() |     ctx.closePath() | ||||||
|  |  | ||||||
|     const canvas2 = document.createElement('canvas') |     const ctx2 = this.#canvas2.getContext('2d') | ||||||
|     const ctx2 = canvas2.getContext('2d') |     this.#canvas2.width = this.#canvas.width + 10 | ||||||
|     canvas2.width = canvas.width + 10 |     this.#canvas2.height = this.#canvas.height + 10 | ||||||
|     canvas2.height = canvas.height + 10 |     ctx2.drawImage(this.#canvas, 5, 5); | ||||||
|     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 canvas2 |     return this.#canvas2.toDataURL("image/png") | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   remove() { |   remove() { | ||||||
|  | |||||||
| @ -7,7 +7,7 @@ import EventBinding from './eventBinding' | |||||||
| import Base from "../../index"; | import Base from "../../index"; | ||||||
| import MouseEvent from '../../../../Event/index' | import MouseEvent from '../../../../Event/index' | ||||||
| import { syncPrimitives } from '../../../../Global/MultiViewportMode' | import { syncPrimitives } from '../../../../Global/MultiViewportMode' | ||||||
| import { syncData } from '../../../../Global/MultiViewportMode' | import { syncData, getSdk as get2DSdk } from '../../../../Global/MultiViewportMode' | ||||||
| import MouseTip from '../../../../MouseTip' | import MouseTip from '../../../../MouseTip' | ||||||
| import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen' | import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen' | ||||||
| import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../../Global/global' | import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../../Global/global' | ||||||
| @ -82,18 +82,34 @@ class Flame extends Base { | |||||||
|  |  | ||||||
|   set show(v) { |   set show(v) { | ||||||
|     if (typeof v === "boolean") { |     if (typeof v === "boolean") { | ||||||
|       this.options.show = v |       let sdkD = get2DSdk().sdkD | ||||||
|       if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) { |       if (!this.isShowView || !sdkD) { | ||||||
|         this.entity.show = v |         this.options.show = v | ||||||
|       } |       } | ||||||
|  |       if (!this.showView || this.showView == 3 || !sdkD) { | ||||||
|  |         if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) { | ||||||
|  |           this.entity.show = this.options.show | ||||||
|  |         } | ||||||
|  |         if (this.options.label && this.options.label.show) { | ||||||
|  |           this.label.show = this.options.show | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |       else { | ||||||
|  |         if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) { | ||||||
|  |           this.entity.show = false | ||||||
|  |         } | ||||||
|  |         if (this.options.label && this.options.label.show) { | ||||||
|  |           this.label.show = false | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |        | ||||||
|       if (this._DialogObject && this._DialogObject.showBtn) { |       if (this._DialogObject && this._DialogObject.showBtn) { | ||||||
|         this._DialogObject.showBtn.checked = v |         this._DialogObject.showBtn.checked = v | ||||||
|       } |       } | ||||||
|       if (this.options.label && this.options.label.show) { |        | ||||||
|         this.label.show = v |  | ||||||
|       } |  | ||||||
|       syncData(this.sdk, this.options.id) |       syncData(this.sdk, this.options.id) | ||||||
|       syncSplitData(this.sdk, this.options.id) |       syncSplitData(this.sdk, this.options.id) | ||||||
|  |       this.isShowView = false | ||||||
|     } else { |     } else { | ||||||
|       console.error("参数必须为boolean") |       console.error("参数必须为boolean") | ||||||
|     } |     } | ||||||
| @ -245,7 +261,7 @@ class Flame extends Base { | |||||||
|     this.particleSystem.startColor = Cesium.Color.fromCssColorString(v) |     this.particleSystem.startColor = Cesium.Color.fromCssColorString(v) | ||||||
|     if (this._elms.startColor) { |     if (this._elms.startColor) { | ||||||
|       this._elms.startColor.forEach((item, i) => { |       this._elms.startColor.forEach((item, i) => { | ||||||
|         let picker = new ewPlugins('colorpicker', { |         let picker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -273,7 +289,7 @@ class Flame extends Base { | |||||||
|     this.particleSystem.endColor = Cesium.Color.fromCssColorString(v) |     this.particleSystem.endColor = Cesium.Color.fromCssColorString(v) | ||||||
|     if (this._elms.endColor) { |     if (this._elms.endColor) { | ||||||
|       this._elms.endColor.forEach((item, i) => { |       this._elms.endColor.forEach((item, i) => { | ||||||
|         let picker = new ewPlugins('colorpicker', { |         let picker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -496,7 +512,7 @@ class Flame extends Base { | |||||||
|       contentElm.innerHTML = html() |       contentElm.innerHTML = html() | ||||||
|       this._DialogObject.contentAppChild(contentElm) |       this._DialogObject.contentAppChild(contentElm) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let startColorPicker = new ewPlugins('colorpicker', { |       let startColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("start_color")[0], |         el: contentElm.getElementsByClassName("start_color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -510,7 +526,7 @@ class Flame extends Base { | |||||||
|           this.startColor = 'rgba(255,255,255,1)' |           this.startColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let endColorPicker = new ewPlugins('colorpicker', { |       let endColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("end_color")[0], |         el: contentElm.getElementsByClassName("end_color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ import { html } from "./_element"; | |||||||
| import EventBinding from './eventBinding' | import EventBinding from './eventBinding' | ||||||
| import Base from "../../index"; | import Base from "../../index"; | ||||||
| import MouseEvent from '../../../../Event/index' | import MouseEvent from '../../../../Event/index' | ||||||
| import { syncData } from '../../../../Global/MultiViewportMode' | import { syncData, getSdk as get2DSdk } from '../../../../Global/MultiViewportMode' | ||||||
| import MouseTip from '../../../../MouseTip' | import MouseTip from '../../../../MouseTip' | ||||||
| import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen' | import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen' | ||||||
| import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../../Global/global' | import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../../Global/global' | ||||||
| @ -83,18 +83,32 @@ class Fountain extends Base { | |||||||
|  |  | ||||||
|   set show(v) { |   set show(v) { | ||||||
|     if (typeof v === "boolean") { |     if (typeof v === "boolean") { | ||||||
|       this.options.show = v |       let sdkD = get2DSdk().sdkD | ||||||
|       if(this.entity && this.sdk.viewer.camera.positionCartographic.height <10000000) { |       if (!this.isShowView || !sdkD) { | ||||||
|         this.entity.show = v |         this.options.show = v | ||||||
|  |       } | ||||||
|  |       if (!this.showView || this.showView == 3 || !sdkD) { | ||||||
|  |         if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) { | ||||||
|  |           this.entity.show = this.options.show | ||||||
|  |         } | ||||||
|  |         if (this.options.label && this.options.label.show) { | ||||||
|  |           this.label.show = this.options.show | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |       else { | ||||||
|  |         if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) { | ||||||
|  |           this.entity.show = false | ||||||
|  |         } | ||||||
|  |         if (this.options.label && this.options.label.show) { | ||||||
|  |           this.label.show = false | ||||||
|  |         } | ||||||
|       } |       } | ||||||
|       if(this._DialogObject && this._DialogObject.showBtn) { |       if(this._DialogObject && this._DialogObject.showBtn) { | ||||||
|         this._DialogObject.showBtn.checked = v |         this._DialogObject.showBtn.checked = v | ||||||
|       } |       } | ||||||
|       if (this.options.label && this.options.label.show) { |  | ||||||
|         this.label.show = v |  | ||||||
|       } |  | ||||||
|       syncData(this.sdk, this.options.id) |       syncData(this.sdk, this.options.id) | ||||||
|       syncSplitData(this.sdk, this.options.id) |       syncSplitData(this.sdk, this.options.id) | ||||||
|  |       this.isShowView = false | ||||||
|     } else { |     } else { | ||||||
|       console.error("参数必须为boolean") |       console.error("参数必须为boolean") | ||||||
|     } |     } | ||||||
| @ -269,7 +283,7 @@ class Fountain extends Base { | |||||||
|     this.particleSystem.startColor = Cesium.Color.fromCssColorString(v) |     this.particleSystem.startColor = Cesium.Color.fromCssColorString(v) | ||||||
|     if (this._elms.startColor) { |     if (this._elms.startColor) { | ||||||
|       this._elms.startColor.forEach((item, i) => { |       this._elms.startColor.forEach((item, i) => { | ||||||
|         let picker = new ewPlugins('colorpicker', { |         let picker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -297,7 +311,7 @@ class Fountain extends Base { | |||||||
|     this.particleSystem.endColor = Cesium.Color.fromCssColorString(v) |     this.particleSystem.endColor = Cesium.Color.fromCssColorString(v) | ||||||
|     if (this._elms.endColor) { |     if (this._elms.endColor) { | ||||||
|       this._elms.endColor.forEach((item, i) => { |       this._elms.endColor.forEach((item, i) => { | ||||||
|         let picker = new ewPlugins('colorpicker', { |         let picker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -520,7 +534,7 @@ class Fountain extends Base { | |||||||
|       contentElm.innerHTML = html() |       contentElm.innerHTML = html() | ||||||
|       this._DialogObject.contentAppChild(contentElm) |       this._DialogObject.contentAppChild(contentElm) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let startColorPicker = new ewPlugins('colorpicker', { |       let startColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("start_color")[0], |         el: contentElm.getElementsByClassName("start_color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -534,7 +548,7 @@ class Fountain extends Base { | |||||||
|           this.startColor = 'rgba(255,255,255,1)' |           this.startColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let endColorPicker = new ewPlugins('colorpicker', { |       let endColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("end_color")[0], |         el: contentElm.getElementsByClassName("end_color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ import { html, css } from "./_element"; | |||||||
| import EventBinding from './eventBinding' | import EventBinding from './eventBinding' | ||||||
| import Base from "../../index"; | import Base from "../../index"; | ||||||
| import MouseEvent from '../../../../Event/index' | import MouseEvent from '../../../../Event/index' | ||||||
| import { syncData } from '../../../../Global/MultiViewportMode' | import { syncData, getSdk as get2DSdk } from '../../../../Global/MultiViewportMode' | ||||||
| import MouseTip from '../../../../MouseTip' | import MouseTip from '../../../../MouseTip' | ||||||
| import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen' | import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen' | ||||||
| import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../../Global/global' | import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../../Global/global' | ||||||
| @ -81,18 +81,32 @@ class Smoke extends Base { | |||||||
|  |  | ||||||
|   set show(v) { |   set show(v) { | ||||||
|     if (typeof v === "boolean") { |     if (typeof v === "boolean") { | ||||||
|       this.options.show = v |       let sdkD = get2DSdk().sdkD | ||||||
|       if(this.entity && this.sdk.viewer.camera.positionCartographic.height <10000000) { |       if (!this.isShowView || !sdkD) { | ||||||
|         this.entity.show = v |         this.options.show = v | ||||||
|  |       } | ||||||
|  |       if (!this.showView || this.showView == 3 || !sdkD) { | ||||||
|  |         if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) { | ||||||
|  |           this.entity.show = this.options.show | ||||||
|  |         } | ||||||
|  |         if (this.options.label && this.options.label.show) { | ||||||
|  |           this.label.show = this.options.show | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |       else { | ||||||
|  |         if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) { | ||||||
|  |           this.entity.show = false | ||||||
|  |         } | ||||||
|  |         if (this.options.label && this.options.label.show) { | ||||||
|  |           this.label.show = false | ||||||
|  |         } | ||||||
|       } |       } | ||||||
|       if(this._DialogObject && this._DialogObject.showBtn) { |       if(this._DialogObject && this._DialogObject.showBtn) { | ||||||
|         this._DialogObject.showBtn.checked = v |         this._DialogObject.showBtn.checked = v | ||||||
|       } |       } | ||||||
|       if (this.options.label && this.options.label.show) { |  | ||||||
|         this.label.show = v |  | ||||||
|       } |  | ||||||
|       syncData(this.sdk, this.options.id) |       syncData(this.sdk, this.options.id) | ||||||
|       syncSplitData(this.sdk, this.options.id) |       syncSplitData(this.sdk, this.options.id) | ||||||
|  |       this.isShowView = false | ||||||
|     } else { |     } else { | ||||||
|       console.error("参数必须为boolean") |       console.error("参数必须为boolean") | ||||||
|     } |     } | ||||||
| @ -243,7 +257,7 @@ class Smoke extends Base { | |||||||
|     this.particleSystem.startColor = Cesium.Color.fromCssColorString(v) |     this.particleSystem.startColor = Cesium.Color.fromCssColorString(v) | ||||||
|     if (this._elms.startColor) { |     if (this._elms.startColor) { | ||||||
|       this._elms.startColor.forEach((item, i) => { |       this._elms.startColor.forEach((item, i) => { | ||||||
|         let picker = new ewPlugins('colorpicker', { |         let picker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -271,7 +285,7 @@ class Smoke extends Base { | |||||||
|     this.particleSystem.endColor = Cesium.Color.fromCssColorString(v) |     this.particleSystem.endColor = Cesium.Color.fromCssColorString(v) | ||||||
|     if (this._elms.endColor) { |     if (this._elms.endColor) { | ||||||
|       this._elms.endColor.forEach((item, i) => { |       this._elms.endColor.forEach((item, i) => { | ||||||
|         let picker = new ewPlugins('colorpicker', { |         let picker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -494,7 +508,7 @@ class Smoke extends Base { | |||||||
|       contentElm.innerHTML = html() |       contentElm.innerHTML = html() | ||||||
|       this._DialogObject.contentAppChild(contentElm) |       this._DialogObject.contentAppChild(contentElm) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let startColorPicker = new ewPlugins('colorpicker', { |       let startColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("start_color")[0], |         el: contentElm.getElementsByClassName("start_color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -508,7 +522,7 @@ class Smoke extends Base { | |||||||
|           this.startColor = 'rgba(255,255,255,1)' |           this.startColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let endColorPicker = new ewPlugins('colorpicker', { |       let endColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("end_color")[0], |         el: contentElm.getElementsByClassName("end_color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
|  | |||||||
| @ -5,7 +5,7 @@ import Dialog from '../../../Element/Dialog'; | |||||||
| import { html, css } from "./_element"; | import { html, css } from "./_element"; | ||||||
| import Base from "../../index"; | import Base from "../../index"; | ||||||
| import MouseEvent from '../../../../Event/index' | import MouseEvent from '../../../../Event/index' | ||||||
| import { syncData } from '../../../../Global/MultiViewportMode' | import { syncData, getSdk as get2DSdk } from '../../../../Global/MultiViewportMode' | ||||||
| import MouseTip from '../../../../MouseTip' | import MouseTip from '../../../../MouseTip' | ||||||
| import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen' | import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen' | ||||||
| import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../../Global/global' | import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../../Global/global' | ||||||
| @ -84,18 +84,32 @@ class Spout extends Base { | |||||||
|  |  | ||||||
|   set show(v) { |   set show(v) { | ||||||
|     if (typeof v === "boolean") { |     if (typeof v === "boolean") { | ||||||
|       this.options.show = v |       let sdkD = get2DSdk().sdkD | ||||||
|       if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) { |       if (!this.isShowView || !sdkD) { | ||||||
|         this.entity.show = v |         this.options.show = v | ||||||
|       } |       } | ||||||
|       if (this._DialogObject && this._DialogObject.showBtn) { |       if (!this.showView || this.showView == 3 || !sdkD) { | ||||||
|  |         if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) { | ||||||
|  |           this.entity.show = this.options.show | ||||||
|  |         } | ||||||
|  |         if (this.options.label && this.options.label.show) { | ||||||
|  |           this.label.show = this.options.show | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |       else { | ||||||
|  |         if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) { | ||||||
|  |           this.entity.show = false | ||||||
|  |         } | ||||||
|  |         if (this.options.label && this.options.label.show) { | ||||||
|  |           this.label.show = false | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |       if(this._DialogObject && this._DialogObject.showBtn) { | ||||||
|         this._DialogObject.showBtn.checked = v |         this._DialogObject.showBtn.checked = v | ||||||
|       } |       } | ||||||
|       if (this.options.label && this.options.label.show) { |  | ||||||
|         this.label.show = v |  | ||||||
|       } |  | ||||||
|       syncData(this.sdk, this.options.id) |       syncData(this.sdk, this.options.id) | ||||||
|       syncSplitData(this.sdk, this.options.id) |       syncSplitData(this.sdk, this.options.id) | ||||||
|  |       this.isShowView = false | ||||||
|     } else { |     } else { | ||||||
|       console.error("参数必须为boolean") |       console.error("参数必须为boolean") | ||||||
|     } |     } | ||||||
| @ -360,7 +374,7 @@ class Spout extends Base { | |||||||
|     this.particleSystem.startColor = Cesium.Color.fromCssColorString(v) |     this.particleSystem.startColor = Cesium.Color.fromCssColorString(v) | ||||||
|     if (this._elms.startColor) { |     if (this._elms.startColor) { | ||||||
|       this._elms.startColor.forEach((item, i) => { |       this._elms.startColor.forEach((item, i) => { | ||||||
|         let picker = new ewPlugins('colorpicker', { |         let picker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -388,7 +402,7 @@ class Spout extends Base { | |||||||
|     this.particleSystem.endColor = Cesium.Color.fromCssColorString(v) |     this.particleSystem.endColor = Cesium.Color.fromCssColorString(v) | ||||||
|     if (this._elms.endColor) { |     if (this._elms.endColor) { | ||||||
|       this._elms.endColor.forEach((item, i) => { |       this._elms.endColor.forEach((item, i) => { | ||||||
|         let picker = new ewPlugins('colorpicker', { |         let picker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -634,7 +648,7 @@ class Spout extends Base { | |||||||
|       contentElm.innerHTML = html() |       contentElm.innerHTML = html() | ||||||
|       this._DialogObject.contentAppChild(contentElm) |       this._DialogObject.contentAppChild(contentElm) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let startColorPicker = new ewPlugins('colorpicker', { |       let startColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("start_color")[0], |         el: contentElm.getElementsByClassName("start_color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -648,7 +662,7 @@ class Spout extends Base { | |||||||
|           this.startColor = 'rgba(255,255,255,1)' |           this.startColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let endColorPicker = new ewPlugins('colorpicker', { |       let endColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("end_color")[0], |         el: contentElm.getElementsByClassName("end_color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
|  | |||||||
| @ -40,7 +40,7 @@ class PincerArrowObject extends Base { | |||||||
|     this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2 |     this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2 | ||||||
|     this.options.line = options.line || {} |     this.options.line = options.line || {} | ||||||
|     this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3) |     this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3) | ||||||
|     this.options.line.color = this.options.line.color || '#ff000080' |     this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)' | ||||||
|     this.options['area-unit'] = options['area-unit'] || '平方米' |     this.options['area-unit'] = options['area-unit'] || '平方米' | ||||||
|     this.options.height = options.height |     this.options.height = options.height | ||||||
|     this.options.loop = options.loop || false |     this.options.loop = options.loop || false | ||||||
| @ -122,7 +122,7 @@ class PincerArrowObject extends Base { | |||||||
|     return this.options.color |     return this.options.color | ||||||
|   } |   } | ||||||
|   set color(v) { |   set color(v) { | ||||||
|     this.options.color = v || '#ff000080' |     this.options.color = v || 'rgba(255, 0, 0, 0.5)' | ||||||
|     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) { |     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) { | ||||||
|       return |       return | ||||||
|     } |     } | ||||||
| @ -135,7 +135,7 @@ class PincerArrowObject extends Base { | |||||||
|     this.entity.polygon.material = material |     this.entity.polygon.material = material | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -253,14 +253,14 @@ class PincerArrowObject extends Base { | |||||||
|     return this.options.line.color |     return this.options.line.color | ||||||
|   } |   } | ||||||
|   set lineColor(v) { |   set lineColor(v) { | ||||||
|     this.options.line.color = v || '#ff000080' |     this.options.line.color = v || 'rgba(255, 0, 0, 0.5)' | ||||||
|     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) { |     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) { | ||||||
|       return |       return | ||||||
|     } |     } | ||||||
|     this.entity.polyline.material = Cesium.Color.fromCssColorString(this.options.line.color) |     this.entity.polyline.material = Cesium.Color.fromCssColorString(this.options.line.color) | ||||||
|     if (this._elms.lineColor) { |     if (this._elms.lineColor) { | ||||||
|       this._elms.lineColor.forEach((item, i) => { |       this._elms.lineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -334,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) { |     if (this.show && !this.showView || this.showView == 3) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @ -368,7 +368,7 @@ class PincerArrowObject extends Base { | |||||||
|     this.label.color = v |     this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -468,7 +468,7 @@ class PincerArrowObject extends Base { | |||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -495,7 +495,7 @@ class PincerArrowObject extends Base { | |||||||
|     this.label.backgroundColor = [v, this.label.backgroundColor[1]] |     this.label.backgroundColor = [v, this.label.backgroundColor[1]] | ||||||
|     if (this._elms.labelBackgroundColorStart) { |     if (this._elms.labelBackgroundColorStart) { | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |       this._elms.labelBackgroundColorStart.forEach((item, i) => { | ||||||
|         let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -521,7 +521,7 @@ class PincerArrowObject extends Base { | |||||||
|     this.label.backgroundColor = [this.label.backgroundColor[0], v] |     this.label.backgroundColor = [this.label.backgroundColor[0], v] | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -1192,7 +1192,7 @@ class PincerArrowObject extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs('pincer-arrow-object-edit-tabs', undefined, this.sdk) |       let tabsElm = new cy_tabs('pincer-arrow-object-edit-tabs', undefined, this.sdk) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1206,7 +1206,7 @@ class PincerArrowObject extends Base { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let linecolorPicker = new ewPlugins('colorpicker', { |       let linecolorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("lineColor")[0], |         el: contentElm.getElementsByClassName("lineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1220,7 +1220,7 @@ class PincerArrowObject extends Base { | |||||||
|           this.lineColor = 'rgba(255,255,255,1)' |           this.lineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |         el: contentElm.getElementsByClassName("labelColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1234,7 +1234,7 @@ class PincerArrowObject extends Base { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let lineColorPicker = new ewPlugins('colorpicker', { |       let lineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelLineColor")[0], |         el: contentElm.getElementsByClassName("labelLineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1248,7 +1248,7 @@ class PincerArrowObject extends Base { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -1262,7 +1262,7 @@ class PincerArrowObject extends Base { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         }, |         }, | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
|  | |||||||
| @ -25,7 +25,7 @@ class PolygonObject extends Base { | |||||||
|    * @param options.id {string} 唯一标识 |    * @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="#ff000080" {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.line {object} 边框 |    * @param options.line {object} 边框 | ||||||
| @ -39,7 +39,7 @@ class PolygonObject extends Base { | |||||||
|   constructor(sdk, options = {}, _Dialog = {}) { |   constructor(sdk, options = {}, _Dialog = {}) { | ||||||
|     super(sdk, options) |     super(sdk, options) | ||||||
|     this.options.name = options.name || '未命名对象' |     this.options.name = options.name || '未命名对象' | ||||||
|     this.options.color = options.color || '#ff000080' |     this.options.color = options.color || 'rgba(255, 0, 0, 0.5)' | ||||||
|     this.options.show = |     this.options.show = | ||||||
|       options.show || options.show === false ? options.show : true |       options.show || options.show === false ? options.show : true | ||||||
|     this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2 |     this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2 | ||||||
| @ -47,7 +47,7 @@ class PolygonObject extends Base { | |||||||
|     this.options.line = options.line || {} |     this.options.line = options.line || {} | ||||||
|     this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3) |     this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3) | ||||||
|     this.options.line.color = |     this.options.line.color = | ||||||
|       this.options.line.color || '#ff000080' |       this.options.line.color || 'rgba(255, 0, 0, 1)' | ||||||
|     this.options['area-unit'] = options['area-unit'] || '平方米' |     this.options['area-unit'] = options['area-unit'] || '平方米' | ||||||
|     this.entity |     this.entity | ||||||
|     this.event = new MouseEvent(this.sdk) |     this.event = new MouseEvent(this.sdk) | ||||||
| @ -133,7 +133,7 @@ class PolygonObject extends Base { | |||||||
|     return this.options.color |     return this.options.color | ||||||
|   } |   } | ||||||
|   set color(v) { |   set color(v) { | ||||||
|     this.options.color = v || '#ff000080' |     this.options.color = v || 'rgba(255, 0, 0, 0.5)' | ||||||
|     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) { |     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) { | ||||||
|       return |       return | ||||||
|     } |     } | ||||||
| @ -150,7 +150,7 @@ class PolygonObject extends Base { | |||||||
|     this.entity.polygon.material = material |     this.entity.polygon.material = material | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini', //颜色box类型 |           size: 'mini', //颜色box类型 | ||||||
|           alpha: true, //是否开启透明度 |           alpha: true, //是否开启透明度 | ||||||
| @ -269,14 +269,14 @@ class PolygonObject extends Base { | |||||||
|     return this.options.line.color |     return this.options.line.color | ||||||
|   } |   } | ||||||
|   set lineColor(v) { |   set lineColor(v) { | ||||||
|     this.options.line.color = v || '#ff000080' |     this.options.line.color = v || 'rgba(255, 0, 0, 0.5)' | ||||||
|     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) { |     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) { | ||||||
|       return |       return | ||||||
|     } |     } | ||||||
|     this.entity.polyline.material = Cesium.Color.fromCssColorString(this.options.line.color) |     this.entity.polyline.material = Cesium.Color.fromCssColorString(this.options.line.color) | ||||||
|     if (this._elms.lineColor) { |     if (this._elms.lineColor) { | ||||||
|       this._elms.lineColor.forEach((item, i) => { |       this._elms.lineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini', //颜色box类型 |           size: 'mini', //颜色box类型 | ||||||
|           alpha: true, //是否开启透明度 |           alpha: true, //是否开启透明度 | ||||||
| @ -355,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) { |     if (this.show && !this.showView || this.showView == 3) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } else { |     } else { | ||||||
|       this.label.show = false |       this.label.show = false | ||||||
| @ -389,7 +389,7 @@ class PolygonObject extends Base { | |||||||
|     this.label.color = v |     this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini', //颜色box类型 |           size: 'mini', //颜色box类型 | ||||||
|           alpha: true, //是否开启透明度 |           alpha: true, //是否开启透明度 | ||||||
| @ -493,7 +493,7 @@ class PolygonObject extends Base { | |||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini', //颜色box类型 |           size: 'mini', //颜色box类型 | ||||||
|           alpha: true, //是否开启透明度 |           alpha: true, //是否开启透明度 | ||||||
| @ -520,7 +520,7 @@ class PolygonObject extends Base { | |||||||
|     this.label.backgroundColor = [v, this.label.backgroundColor[1]] |     this.label.backgroundColor = [v, this.label.backgroundColor[1]] | ||||||
|     if (this._elms.labelBackgroundColorStart) { |     if (this._elms.labelBackgroundColorStart) { | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |       this._elms.labelBackgroundColorStart.forEach((item, i) => { | ||||||
|         let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini', //颜色box类型 |           size: 'mini', //颜色box类型 | ||||||
|           alpha: true, //是否开启透明度 |           alpha: true, //是否开启透明度 | ||||||
| @ -548,7 +548,7 @@ class PolygonObject extends Base { | |||||||
|     this.label.backgroundColor = [this.label.backgroundColor[0], v] |     this.label.backgroundColor = [this.label.backgroundColor[0], v] | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini', //颜色box类型 |           size: 'mini', //颜色box类型 | ||||||
|           alpha: true, //是否开启透明度 |           alpha: true, //是否开启透明度 | ||||||
| @ -1216,7 +1216,6 @@ class PolygonObject extends Base { | |||||||
|             alt: this.label.position[2] |             alt: this.label.position[2] | ||||||
|           } |           } | ||||||
|           this.originalOptions = this.deepCopyObj(this.options) |           this.originalOptions = this.deepCopyObj(this.options) | ||||||
|           console.log('000000000000',this.options.label.scaleByDistance) |  | ||||||
|           this._DialogObject.close() |           this._DialogObject.close() | ||||||
|           this.Dialog.confirmCallBack && |           this.Dialog.confirmCallBack && | ||||||
|             this.Dialog.confirmCallBack(this.originalOptions) |             this.Dialog.confirmCallBack(this.originalOptions) | ||||||
| @ -1270,7 +1269,7 @@ class PolygonObject extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs('polygon-object-edit-tabs', undefined, this.sdk) |       let tabsElm = new cy_tabs('polygon-object-edit-tabs', undefined, this.sdk) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName('color')[0], |         el: contentElm.getElementsByClassName('color')[0], | ||||||
|         size: 'mini', //颜色box类型 |         size: 'mini', //颜色box类型 | ||||||
|         alpha: true, //是否开启透明度 |         alpha: true, //是否开启透明度 | ||||||
| @ -1284,7 +1283,7 @@ class PolygonObject extends Base { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         } //点击清空按钮事件回调 |         } //点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let linecolorPicker = new ewPlugins('colorpicker', { |       let linecolorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName('lineColor')[0], |         el: contentElm.getElementsByClassName('lineColor')[0], | ||||||
|         size: 'mini', //颜色box类型 |         size: 'mini', //颜色box类型 | ||||||
|         alpha: true, //是否开启透明度 |         alpha: true, //是否开启透明度 | ||||||
| @ -1298,7 +1297,7 @@ class PolygonObject extends Base { | |||||||
|           this.lineColor = 'rgba(255,255,255,1)' |           this.lineColor = 'rgba(255,255,255,1)' | ||||||
|         } //点击清空按钮事件回调 |         } //点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName('labelColor')[0], |         el: contentElm.getElementsByClassName('labelColor')[0], | ||||||
|         size: 'mini', //颜色box类型 |         size: 'mini', //颜色box类型 | ||||||
|         alpha: true, //是否开启透明度 |         alpha: true, //是否开启透明度 | ||||||
| @ -1312,7 +1311,7 @@ class PolygonObject extends Base { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         } //点击清空按钮事件回调 |         } //点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let lineColorPicker = new ewPlugins('colorpicker', { |       let lineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName('labelLineColor')[0], |         el: contentElm.getElementsByClassName('labelLineColor')[0], | ||||||
|         size: 'mini', //颜色box类型 |         size: 'mini', //颜色box类型 | ||||||
|         alpha: true, //是否开启透明度 |         alpha: true, //是否开启透明度 | ||||||
| @ -1326,7 +1325,7 @@ class PolygonObject extends Base { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         } //点击清空按钮事件回调 |         } //点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName('labelBackgroundColorStart')[0], |         el: contentElm.getElementsByClassName('labelBackgroundColorStart')[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -1340,7 +1339,7 @@ class PolygonObject extends Base { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         } |         } | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName('labelBackgroundColorEnd')[0], |         el: contentElm.getElementsByClassName('labelBackgroundColorEnd')[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
|  | |||||||
| @ -21,6 +21,7 @@ class eventBinding { | |||||||
|       let Event = [] |       let Event = [] | ||||||
|       let isEvent = false |       let isEvent = false | ||||||
|       let removeName = [] |       let removeName = [] | ||||||
|  |       let blurEvent = () => { } | ||||||
|       if (!elements[i] || !elements[i].attributes) { |       if (!elements[i] || !elements[i].attributes) { | ||||||
|         continue  |         continue  | ||||||
|       } |       } | ||||||
| @ -36,7 +37,8 @@ class eventBinding { | |||||||
|               Event.push((e) => { |               Event.push((e) => { | ||||||
|                 let value = e.target.value |                 let value = e.target.value | ||||||
|                 if (e.target.type == 'number') { |                 if (e.target.type == 'number') { | ||||||
|                   if (e.data != '.' && (e.data != '-' || e.target.value)) { |                   let str = e.target.value + '' | ||||||
|  |                   if (e.data != '.' && (e.data != '-' || e.target.value) && !(str.charAt(str.length - 1) == '0' && e.target.value.toString().includes('.')) && e.target.value != '0') { | ||||||
|                     value = Number(value) |                     value = Number(value) | ||||||
|                     if((e.target.max) && value>Number(e.target.max)) { |                     if((e.target.max) && value>Number(e.target.max)) { | ||||||
|                       value = Number(e.target.max) |                       value = Number(e.target.max) | ||||||
| @ -57,6 +59,22 @@ class eventBinding { | |||||||
|                   that[m.value] = value |                   that[m.value] = value | ||||||
|                 } |                 } | ||||||
|               }) |               }) | ||||||
|  |               blurEvent = (e) => { | ||||||
|  |                 let value = e.target.value | ||||||
|  |                 if ((e.target.type == 'number') && (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 | ||||||
|  |               } | ||||||
|               if(elements[i].nodeName=='IMG') { |               if(elements[i].nodeName=='IMG') { | ||||||
|                 elements[i].src = that[m.value] |                 elements[i].src = that[m.value] | ||||||
|               } |               } | ||||||
| @ -114,6 +132,7 @@ class eventBinding { | |||||||
|             Event[t](e) |             Event[t](e) | ||||||
|           } |           } | ||||||
|         }); |         }); | ||||||
|  |         elements[i].addEventListener('blur', blurEvent) | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  | |||||||
| @ -394,7 +394,7 @@ class PolyhedronObject extends Base { | |||||||
|     this.entity.polygon.material = material |     this.entity.polygon.material = material | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -517,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) { |     if (this.show && !this.showView || this.showView == 3) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @ -551,7 +551,7 @@ class PolyhedronObject extends Base { | |||||||
|     this.label.color = v |     this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -651,7 +651,7 @@ class PolyhedronObject extends Base { | |||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -678,7 +678,7 @@ class PolyhedronObject extends Base { | |||||||
|     this.label.backgroundColor = [v, this.label.backgroundColor[1]] |     this.label.backgroundColor = [v, this.label.backgroundColor[1]] | ||||||
|     if (this._elms.labelBackgroundColorStart) { |     if (this._elms.labelBackgroundColorStart) { | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |       this._elms.labelBackgroundColorStart.forEach((item, i) => { | ||||||
|         let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -704,7 +704,7 @@ class PolyhedronObject extends Base { | |||||||
|     this.label.backgroundColor = [this.label.backgroundColor[0], v] |     this.label.backgroundColor = [this.label.backgroundColor[0], v] | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -1105,7 +1105,7 @@ class PolyhedronObject extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs('polygon-object-edit-tabs', undefined, this.sdk) |       let tabsElm = new cy_tabs('polygon-object-edit-tabs', undefined, this.sdk) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1119,7 +1119,7 @@ class PolyhedronObject extends Base { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |         el: contentElm.getElementsByClassName("labelColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1133,7 +1133,7 @@ class PolyhedronObject extends Base { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let lineColorPicker = new ewPlugins('colorpicker', { |       let lineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelLineColor")[0], |         el: contentElm.getElementsByClassName("labelLineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1147,7 +1147,7 @@ class PolyhedronObject extends Base { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -1161,7 +1161,7 @@ class PolyhedronObject extends Base { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         }, |         }, | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
|  | |||||||
| @ -347,7 +347,7 @@ class PolyhedronObject extends Base { | |||||||
|     this.entity.polygon.material = Cesium.Color.fromCssColorString(v) |     this.entity.polygon.material = Cesium.Color.fromCssColorString(v) | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -488,7 +488,7 @@ class PolyhedronObject extends Base { | |||||||
|     this.label.color = v |     this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -588,7 +588,7 @@ class PolyhedronObject extends Base { | |||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -615,7 +615,7 @@ class PolyhedronObject extends Base { | |||||||
|     this.label.backgroundColor = [v, this.label.backgroundColor[1]] |     this.label.backgroundColor = [v, this.label.backgroundColor[1]] | ||||||
|     if (this._elms.labelBackgroundColorStart) { |     if (this._elms.labelBackgroundColorStart) { | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |       this._elms.labelBackgroundColorStart.forEach((item, i) => { | ||||||
|         let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -641,7 +641,7 @@ class PolyhedronObject extends Base { | |||||||
|     this.label.backgroundColor = [this.label.backgroundColor[0], v] |     this.label.backgroundColor = [this.label.backgroundColor[0], v] | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -890,7 +890,7 @@ class PolyhedronObject extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs('polygon-object-edit-tabs', undefined, this.sdk) |       let tabsElm = new cy_tabs('polygon-object-edit-tabs', undefined, this.sdk) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -904,7 +904,7 @@ class PolyhedronObject extends Base { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |         el: contentElm.getElementsByClassName("labelColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -918,7 +918,7 @@ class PolyhedronObject extends Base { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let lineColorPicker = new ewPlugins('colorpicker', { |       let lineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelLineColor")[0], |         el: contentElm.getElementsByClassName("labelLineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -932,7 +932,7 @@ class PolyhedronObject extends Base { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -946,7 +946,7 @@ class PolyhedronObject extends Base { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         }, |         }, | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
|  | |||||||
| @ -90,27 +90,6 @@ function html(that) { | |||||||
|                         <div class="col" style="flex: 0 0 37%;"> |                         <div class="col" style="flex: 0 0 37%;"> | ||||||
|                         </div> |                         </div> | ||||||
|                     </div> |                     </div> | ||||||
|                     <div class="row" id="dashTextureDom"> |  | ||||||
|                         <div class="col"> |  | ||||||
|                             <span class="label">动画顺向</span> |  | ||||||
|                             <input class="btn-switch" type="checkbox" @model="rotate"> |  | ||||||
|                         </div> |  | ||||||
|                         <div class="col" style="flex: 0 0 33%;"> |  | ||||||
|                             <span class="label">流动速率</span> |  | ||||||
|                             <div class="input-number input-number-unit-1" style="width: 80px;"> |  | ||||||
|                                 <input class="input" type="number" title="" min="0" max="999999" step="1" @model="speed"> |  | ||||||
|                                 <span class="arrow"></span> |  | ||||||
|                             </div> |  | ||||||
|                         </div> |  | ||||||
|                         <div class="col" style="flex: 0 0 37%;"> |  | ||||||
|                               <span class="label lineSpace">间距</span> |  | ||||||
|                               <div class="input-number input-number-unit-1 lineSpace" style="width: 80px;"> |  | ||||||
|                                   <input class="input" type="number" title="" min="0" max="4.5" step="0.1" @model="space"> |  | ||||||
|                                   <span class="unit">倍</span> |  | ||||||
|                                   <span class="arrow"></span> |  | ||||||
|                               </div> |  | ||||||
|                         </div> |  | ||||||
|                     </div> |  | ||||||
|                     <div class="row"> |                     <div class="row"> | ||||||
|                         <div class="col"> |                         <div class="col"> | ||||||
|                             <span class="label">线段缓冲</span> |                             <span class="label">线段缓冲</span> | ||||||
| @ -129,6 +108,27 @@ function html(that) { | |||||||
|                             <div class="extendColor"></div> |                             <div class="extendColor"></div> | ||||||
|                         </div> |                         </div> | ||||||
|                     </div> |                     </div> | ||||||
|  |                     <div class="row" id="dashTextureDom"> | ||||||
|  |                         <div class="col"> | ||||||
|  |                             <span class="label">首尾反向</span> | ||||||
|  |                             <input class="btn-switch" type="checkbox" @model="rotate"> | ||||||
|  |                         </div> | ||||||
|  |                         <div class="col" style="flex: 0 0 33%;"> | ||||||
|  |                             <span class="label">流动速率</span> | ||||||
|  |                             <div class="input-number input-number-unit-1" style="width: 80px;"> | ||||||
|  |                                 <input class="input" type="number" title="" min="0" max="999999" step="1" @model="speed"> | ||||||
|  |                                 <span class="arrow"></span> | ||||||
|  |                             </div> | ||||||
|  |                         </div> | ||||||
|  |                         <div class="col" style="flex: 0 0 37%;"> | ||||||
|  |                               <span class="label lineSpace">线条间距</span> | ||||||
|  |                               <div class="input-number input-number-unit-1 lineSpace" style="width: 80px;"> | ||||||
|  |                                   <input class="input" type="number" title="" min="0" max="4.5" step="0.1" @model="space"> | ||||||
|  |                                   <span class="unit">倍</span> | ||||||
|  |                                   <span class="arrow"></span> | ||||||
|  |                               </div> | ||||||
|  |                         </div> | ||||||
|  |                     </div> | ||||||
|                 </DIV-cy-tab-pane> |                 </DIV-cy-tab-pane> | ||||||
|                 <DIV-cy-tab-pane label="标注风格"> |                 <DIV-cy-tab-pane label="标注风格"> | ||||||
|                     ${labelStyleElm1()} |                     ${labelStyleElm1()} | ||||||
|  | |||||||
| @ -11,12 +11,14 @@ import LabelObject from '../LabelObject' | |||||||
| import MouseEvent from '../../../Event/index' | import MouseEvent from '../../../Event/index' | ||||||
| import MouseTip from '../../../MouseTip' | import MouseTip from '../../../MouseTip' | ||||||
| import Controller from '../../../Controller/index' | import Controller from '../../../Controller/index' | ||||||
| import { syncData } from '../../../Global/MultiViewportMode' | import { syncData, get3DView } from '../../../Global/MultiViewportMode' | ||||||
| import { legp } from '../../Element/datalist' | import { legp } from '../../Element/datalist' | ||||||
|  | import { getFontList, getFontFamilyName } from '../../Element/fontSelect' | ||||||
| import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen' | import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen' | ||||||
| import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global' | import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global' | ||||||
|  |  | ||||||
| class PolylineObject extends Base { | class PolylineObject extends Base { | ||||||
|  |   #unitDataLegpObject | ||||||
|   /** |   /** | ||||||
|    * @constructor |    * @constructor | ||||||
|    * @param sdk |    * @param sdk | ||||||
| @ -30,8 +32,8 @@ class PolylineObject extends Base { | |||||||
|    * @param options['nose-to-tail']=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['extend-width']=1 {number} 线缓冲宽度 |    * @param options['extend-width']=10 {number} 线缓冲宽度 | ||||||
|    * @param options['extend-color']=#ffde00 {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 坐标数组 [{lng,lat},...] |    * @param {Array.<object>} options.positions 坐标数组 [{lng,lat},...] | ||||||
|    * @param options.label {object} 标注 |    * @param options.label {object} 标注 | ||||||
| @ -67,8 +69,8 @@ class PolylineObject extends Base { | |||||||
|     this.options['extend-width'] = |     this.options['extend-width'] = | ||||||
|       options['extend-width'] || options['extend-width'] === 0 |       options['extend-width'] || options['extend-width'] === 0 | ||||||
|         ? options['extend-width'] |         ? options['extend-width'] | ||||||
|         : 1 |         : 10 | ||||||
|     this.options['extend-color'] = options['extend-color'] || '#ffde00' |     this.options['extend-color'] = options['extend-color'] || 'rgba(255,255,80,0.3)' | ||||||
|     this.options.show = |     this.options.show = | ||||||
|       options.show || options.show === false ? options.show : true |       options.show || options.show === false ? options.show : true | ||||||
|     this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2 |     this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2 | ||||||
| @ -82,6 +84,7 @@ class PolylineObject extends Base { | |||||||
|         options.label.fontSize || options.label.fontSize === 0 |         options.label.fontSize || options.label.fontSize === 0 | ||||||
|           ? options.label.fontSize |           ? options.label.fontSize | ||||||
|           : 20, |           : 20, | ||||||
|  |       fontFamily: options.label.fontFamily ? options.label.fontFamily : 0, | ||||||
|       color: options.label.color || '#ffffff', |       color: options.label.color || '#ffffff', | ||||||
|       lineWidth: |       lineWidth: | ||||||
|         options.label.lineWidth || options.label.lineWidth === 0 |         options.label.lineWidth || options.label.lineWidth === 0 | ||||||
| @ -122,6 +125,7 @@ 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 = '线段最少需要两个坐标!' | ||||||
| @ -150,10 +154,13 @@ class PolylineObject extends Base { | |||||||
|   } |   } | ||||||
|   set color(v) { |   set color(v) { | ||||||
|     this.options.color = v || '#ff0000' |     this.options.color = v || '#ff0000' | ||||||
|     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) | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini', //颜色box类型 |           size: 'mini', //颜色box类型 | ||||||
|           alpha: true, //是否开启透明度 |           alpha: true, //是否开启透明度 | ||||||
| @ -177,9 +184,13 @@ class PolylineObject 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.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.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 | ||||||
| @ -187,7 +198,10 @@ class PolylineObject extends Base { | |||||||
|  |  | ||||||
|   set dashSize(v) { |   set dashSize(v) { | ||||||
|     this.options.dashSize = v |     this.options.dashSize = v | ||||||
|     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 rotate() { |   get rotate() { | ||||||
| @ -203,7 +217,10 @@ class PolylineObject extends Base { | |||||||
|       }) |       }) | ||||||
|  |  | ||||||
|     this.options.rotate = v |     this.options.rotate = v | ||||||
|     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 space() { |   get space() { | ||||||
| @ -212,7 +229,10 @@ class PolylineObject extends Base { | |||||||
|  |  | ||||||
|   set space(v) { |   set space(v) { | ||||||
|     this.options.space = v |     this.options.space = v | ||||||
|     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 length() { |   get length() { | ||||||
| @ -251,6 +271,7 @@ class PolylineObject extends Base { | |||||||
|       this._elms.lengthUnit.forEach(item => { |       this._elms.lengthUnit.forEach(item => { | ||||||
|         item.value = v |         item.value = v | ||||||
|       }) |       }) | ||||||
|  |     this.#unitDataLegpObject && this.#unitDataLegpObject.legp_searchActive(v) | ||||||
|     if (this.options.lengthByMeter) { |     if (this.options.lengthByMeter) { | ||||||
|       if (this.unitNum > 2) { |       if (this.unitNum > 2) { | ||||||
|         switch (v) { |         switch (v) { | ||||||
| @ -287,14 +308,16 @@ class PolylineObject extends Base { | |||||||
|         2, |         2, | ||||||
|         v |         v | ||||||
|       ).then(res => { |       ).then(res => { | ||||||
|  |         // _this.options.lengthByMeter = res | ||||||
|  |         // if (res > 1000 || res == 1000) { | ||||||
|  |         //   _this.length = (res / 1000).toFixed(5) | ||||||
|  |         //   _this.lengthUnit = '千米' | ||||||
|  |         // } else { | ||||||
|  |         //   _this.length = res | ||||||
|  |         //   _this.lengthUnit = '米' | ||||||
|  |         // } | ||||||
|         _this.options.lengthByMeter = res |         _this.options.lengthByMeter = res | ||||||
|         if (res > 1000 || res == 1000) { |         _this.lengthUnit = _this.options['length-unit'] | ||||||
|           _this.length = (res / 1000).toFixed(5) |  | ||||||
|           _this.lengthUnit = '千米' |  | ||||||
|         } else { |  | ||||||
|           _this.length = res |  | ||||||
|           _this.lengthUnit = '米' |  | ||||||
|         } |  | ||||||
|       }) |       }) | ||||||
|     } else { |     } else { | ||||||
|       let fromDegreesArray = this.renewPositions(this.options.positions) |       let fromDegreesArray = this.renewPositions(this.options.positions) | ||||||
| @ -437,28 +460,30 @@ class PolylineObject extends Base { | |||||||
|           this._elms.lineType.forEach(item => { |           this._elms.lineType.forEach(item => { | ||||||
|             item.value = lineTypeData[i].value |             item.value = lineTypeData[i].value | ||||||
|             if (2 < item.value && item.value < 13) {//贴图参数 |             if (2 < item.value && item.value < 13) {//贴图参数 | ||||||
|               document.getElementById('dashTextureDom').style.display = 'flex' |               document.getElementById('dashTextureDom') && (document.getElementById('dashTextureDom').style.display = 'flex') | ||||||
|             } else { |             } else { | ||||||
|               document.getElementById('dashTextureDom').style.display = 'none' |               document.getElementById('dashTextureDom') && (document.getElementById('dashTextureDom').style.display = 'none') | ||||||
|             } |             } | ||||||
|             if (2 < item.value && item.value < 5) {//尾迹参数 |             if (2 < item.value && item.value < 5) {//尾迹参数 | ||||||
|               document.getElementsByClassName('lineSpace')[0].style.display = 'none' |               document.getElementsByClassName('lineSpace')[0] && (document.getElementsByClassName('lineSpace')[0].style.display = 'none') | ||||||
|               document.getElementsByClassName('lineSpace')[1].style.display = 'none' |               document.getElementsByClassName('lineSpace')[1] && (document.getElementsByClassName('lineSpace')[1].style.display = 'none') | ||||||
|             } else { |             } else { | ||||||
|               document.getElementsByClassName('lineSpace')[0].style.display = 'flex' |               document.getElementsByClassName('lineSpace')[0] && (document.getElementsByClassName('lineSpace')[0].style.display = 'flex') | ||||||
|               document.getElementsByClassName('lineSpace')[1].style.display = 'flex' |               document.getElementsByClassName('lineSpace')[1] && (document.getElementsByClassName('lineSpace')[1].style.display = 'flex') | ||||||
|             } |             } | ||||||
|           }) |           }) | ||||||
|         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, | ||||||
|         this.options |         params | ||||||
|       )) |       )) | ||||||
|   } |   } | ||||||
|   get noseToTail() { |   get noseToTail() { | ||||||
| @ -479,24 +504,25 @@ class PolylineObject extends Base { | |||||||
|       ) |       ) | ||||||
|       this.renewPolygon(fromDegreesArray) |       this.renewPolygon(fromDegreesArray) | ||||||
|     } |     } | ||||||
|     if (v) { |     this.lengthUnit = this.options['length-unit'] | ||||||
|       if (this.options.fitLengthByMeter > 1000 || this.options.fitLengthByMeter == 1000) { |     // if (v) { | ||||||
|         let dom = document.getElementsByClassName('input-select-unit')[1] |     //   if (this.options.fitLengthByMeter > 1000 || this.options.fitLengthByMeter == 1000) { | ||||||
|         dom && dom.querySelectorAll('dd')[1] && dom.querySelectorAll('dd')[1].click() |     //     let dom = document.getElementsByClassName('input-select-unit')[1] | ||||||
|       } else { |     //     dom && dom.querySelectorAll('dd')[1] && dom.querySelectorAll('dd')[1].click() | ||||||
|         let dom = document.getElementsByClassName('input-select-unit')[1] |     //   } else { | ||||||
|         dom && dom.querySelectorAll('dd')[0] && dom.querySelectorAll('dd')[0].click() |     //     let dom = document.getElementsByClassName('input-select-unit')[1] | ||||||
|       } |     //     dom && dom.querySelectorAll('dd')[0] && dom.querySelectorAll('dd')[0].click() | ||||||
|  |     //   } | ||||||
|  |  | ||||||
|     } else { |     // } else { | ||||||
|       if (this.options.lengthByMeter > 1000 || this.options.lengthByMeter == 1000) { |     //   if (this.options.lengthByMeter > 1000 || this.options.lengthByMeter == 1000) { | ||||||
|         let dom = document.getElementsByClassName('input-select-unit')[1] |     //     let dom = document.getElementsByClassName('input-select-unit')[1] | ||||||
|         dom && dom.querySelectorAll('dd')[1] && dom.querySelectorAll('dd')[1].click() |     //     dom && dom.querySelectorAll('dd')[1] && dom.querySelectorAll('dd')[1].click() | ||||||
|       } else { |     //   } else { | ||||||
|         let dom = document.getElementsByClassName('input-select-unit')[1] |     //     let dom = document.getElementsByClassName('input-select-unit')[1] | ||||||
|         dom && dom.querySelectorAll('dd')[0] && dom.querySelectorAll('dd')[0].click() |     //     dom && dom.querySelectorAll('dd')[0] && dom.querySelectorAll('dd')[0].click() | ||||||
|       } |     //   } | ||||||
|     } |     // } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   get smooth() { |   get smooth() { | ||||||
| @ -646,7 +672,7 @@ class PolylineObject extends Base { | |||||||
|     this.options['extend-color'] = v |     this.options['extend-color'] = v | ||||||
|     if (this._elms.extendColor) { |     if (this._elms.extendColor) { | ||||||
|       this._elms.extendColor.forEach((item, i) => { |       this._elms.extendColor.forEach((item, i) => { | ||||||
|         let extendColorPicker = new ewPlugins('colorpicker', { |         let extendColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini', //颜色box类型 |           size: 'mini', //颜色box类型 | ||||||
|           alpha: true, //是否开启透明度 |           alpha: true, //是否开启透明度 | ||||||
| @ -675,7 +701,7 @@ class PolylineObject extends Base { | |||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show) { |     if (this.show && !this.showView || this.showView == 3) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|       setTimeout(() => { |       setTimeout(() => { | ||||||
|         this.label.position = [ |         this.label.position = [ | ||||||
| @ -693,6 +719,21 @@ class PolylineObject extends Base { | |||||||
|       }) |       }) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   get labelFontFamily() { | ||||||
|  |     return this.options.label.fontFamily | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   set labelFontFamily(v) { | ||||||
|  |     this.options.label.fontFamily = v || 0 | ||||||
|  |     this.label && (this.label.fontFamily = this.options.label.fontFamily) | ||||||
|  |  | ||||||
|  |     let name = getFontFamilyName(this.labelFontFamily) || '' | ||||||
|  |     this._elms.labelFontFamily && | ||||||
|  |       this._elms.labelFontFamily.forEach(item => { | ||||||
|  |         item.value = name | ||||||
|  |       }) | ||||||
|  |   } | ||||||
|  |  | ||||||
|   get labelColor() { |   get labelColor() { | ||||||
|     return this.options.label.color |     return this.options.label.color | ||||||
|   } |   } | ||||||
| @ -701,7 +742,7 @@ class PolylineObject extends Base { | |||||||
|     this.label.color = v |     this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini', //颜色box类型 |           size: 'mini', //颜色box类型 | ||||||
|           alpha: true, //是否开启透明度 |           alpha: true, //是否开启透明度 | ||||||
| @ -805,7 +846,7 @@ class PolylineObject extends Base { | |||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini', //颜色box类型 |           size: 'mini', //颜色box类型 | ||||||
|           alpha: true, //是否开启透明度 |           alpha: true, //是否开启透明度 | ||||||
| @ -817,6 +858,29 @@ 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: () => { | ||||||
| @ -829,6 +893,7 @@ class PolylineObject extends Base { | |||||||
|       }) |       }) | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |    | ||||||
|   get labelBackgroundColorEnd() { |   get labelBackgroundColorEnd() { | ||||||
|     return this.options.label.backgroundColor[1] |     return this.options.label.backgroundColor[1] | ||||||
|   } |   } | ||||||
| @ -837,7 +902,7 @@ class PolylineObject extends Base { | |||||||
|     this.label.backgroundColor = [this.label.backgroundColor[0], v] |     this.label.backgroundColor = [this.label.backgroundColor[0], v] | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini', //颜色box类型 |           size: 'mini', //颜色box类型 | ||||||
|           alpha: true, //是否开启透明度 |           alpha: true, //是否开启透明度 | ||||||
| @ -1289,6 +1354,7 @@ class PolylineObject extends Base { | |||||||
|       ], |       ], | ||||||
|       text: that.options.name, |       text: that.options.name, | ||||||
|       fontSize: that.options.label.fontSize, |       fontSize: that.options.label.fontSize, | ||||||
|  |       fontFamily: that.options.label.fontFamily, | ||||||
|       color: that.options.label.color, |       color: that.options.label.color, | ||||||
|       pixelOffset: that.options.label.pixelOffset, |       pixelOffset: that.options.label.pixelOffset, | ||||||
|       backgroundColor: that.options.label.backgroundColor, |       backgroundColor: that.options.label.backgroundColor, | ||||||
| @ -1302,6 +1368,7 @@ class PolylineObject extends Base { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   static create(that) { |   static create(that) { | ||||||
|  |  | ||||||
|     let ground |     let ground | ||||||
|     if (that.heightMode == 2) { |     if (that.heightMode == 2) { | ||||||
|       ground = true |       ground = true | ||||||
| @ -1317,12 +1384,21 @@ class PolylineObject 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, that.entity, that.options), |         // material: that.getMaterial(that.options.color, that.options.type, that.entity, that.options), | ||||||
|         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.options.color, | ||||||
|  |       that.options.type, | ||||||
|  |       that.entity, | ||||||
|  |       params | ||||||
|  |     ) | ||||||
|     that.sdk._entityZIndex++ |     that.sdk._entityZIndex++ | ||||||
|     PolylineObject.createLabel(that) |     PolylineObject.createLabel(that) | ||||||
|     // that.entity.polyline.positionsLngLat = positions |     // that.entity.polyline.positionsLngLat = positions | ||||||
| @ -1335,10 +1411,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']) { | ||||||
| @ -1411,9 +1487,17 @@ class PolylineObject extends Base { | |||||||
|         var groundResolution = that.sdk.viewer.scene.camera.getPixelSize(boundingSphere, drawingBufferWidth, drawingBufferHeight) |         var groundResolution = that.sdk.viewer.scene.camera.getPixelSize(boundingSphere, drawingBufferWidth, drawingBufferHeight) | ||||||
|         repeatX *= groundResolution / cameraHeight / (param.space * (canvasEle.width / canvasEle.height * 5) + 1); |         repeatX *= groundResolution / cameraHeight / (param.space * (canvasEle.width / canvasEle.height * 5) + 1); | ||||||
|         // if (entity.polyline.material.oriRepeat) { |         // if (entity.polyline.material.oriRepeat) { | ||||||
|         let speed = repeatX / entity.polyline.oriRepeat |  | ||||||
|         entity.polyline.oriSpeed = speed |         if (that.sdk.viewer.scene.mode === Cesium.SceneMode.SCENE3D) { | ||||||
|         entity.polyline.oriRepeatX = repeatX |           let speed = repeatX / entity.polyline.oriRepeat | ||||||
|  |           entity.polyline.oriSpeed = speed | ||||||
|  |           entity.polyline.oriRepeatX = repeatX | ||||||
|  |         } else { | ||||||
|  |           let sdk3d = get3DView() | ||||||
|  |           let sdk3dEntity = sdk3d.viewer.entities.getById(that.options.id) | ||||||
|  |           entity.polyline.oriSpeed = sdk3dEntity.polyline.oriSpeed | ||||||
|  |           entity.polyline.oriRepeatX = sdk3dEntity.polyline.oriRepeatX | ||||||
|  |         } | ||||||
|       } |       } | ||||||
|  |  | ||||||
|  |  | ||||||
| @ -1425,33 +1509,56 @@ class PolylineObject extends Base { | |||||||
|   getSceenLine(entity, options, canvasEle) { |   getSceenLine(entity, options, canvasEle) { | ||||||
|     let point1 = new Cesium.Cartesian2(0, this.sdk.viewer.canvas.clientHeight) |     let point1 = new Cesium.Cartesian2(0, this.sdk.viewer.canvas.clientHeight) | ||||||
|     let point2 = new Cesium.Cartesian2(this.sdk.viewer.canvas.clientWidth / 2, this.sdk.viewer.canvas.clientHeight) |     let point2 = new Cesium.Cartesian2(this.sdk.viewer.canvas.clientWidth / 2, this.sdk.viewer.canvas.clientHeight) | ||||||
|     var cartesian1 = this.sdk.viewer.scene.pickPosition(point1) |     // var cartesian1 = this.sdk.viewer.scene.pickPosition(point1) | ||||||
|     var cartesian2 = this.sdk.viewer.scene.pickPosition(point2) |     // var cartesian2 = this.sdk.viewer.scene.pickPosition(point2) | ||||||
|  |  | ||||||
|     var distance = Cesium.Cartesian3.distance(cartesian1, cartesian2); |     let ray = this.sdk.viewer.camera.getPickRay(point1); | ||||||
|  |     let cartesian1 = this.sdk.viewer.scene.globe.pick(ray, this.sdk.viewer.scene); | ||||||
|  |  | ||||||
|     var repeatX = distance / entity.polyline.width.getValue(); |     let ray2 = this.sdk.viewer.camera.getPickRay(point2); | ||||||
|     // 根据地图缩放程度调整repeatX |     let cartesian2 = this.sdk.viewer.scene.globe.pick(ray2, this.sdk.viewer.scene); | ||||||
|     var cameraHeight = this.sdk.viewer.camera.positionCartographic.height; |     // if (!cartesian1 || !cartesian2) { | ||||||
|     var boundingSphere = new Cesium.BoundingSphere( |     //   let ray = this.sdk.viewer.camera.getPickRay(point1); | ||||||
|       new Cesium.Cartesian3(-1000000, 0, 0), // 中心点坐标 |     //   cartesian1 = this.sdk.viewer.scene.globe.pick(ray, this.sdk.viewer.scene); | ||||||
|       500000 // 半径(距离) |  | ||||||
|     ); |  | ||||||
|  |  | ||||||
|     // 获取绘图缓冲区的宽度和高度(通常是屏幕的分辨率) |     //   let ray2 = this.sdk.viewer.camera.getPickRay(point2); | ||||||
|     var drawingBufferWidth = this.sdk.viewer.canvas.clientWidth; |     //   cartesian2 = this.sdk.viewer.scene.globe.pick(ray2, this.sdk.viewer.scene); | ||||||
|     var drawingBufferHeight = this.sdk.viewer.canvas.clientHeight; |     // } | ||||||
|  |     if (cartesian1 && cartesian2) { | ||||||
|  |  | ||||||
|     // 使用 getPixelSize 方法获取包围球在屏幕上的像素大小 |  | ||||||
|     var groundResolution = this.sdk.viewer.scene.camera.getPixelSize(boundingSphere, drawingBufferWidth, drawingBufferHeight) |       var distance = Cesium.Cartesian3.distance(cartesian1, cartesian2); | ||||||
|     // repeatX *= groundResolution / cameraHeight / ((myImg.width / myImg.height * 5) + 1); |  | ||||||
|     if (groundResolution > 700) { |       var repeatX = distance / entity.polyline.width.getValue(); | ||||||
|       repeatX *= groundResolution / cameraHeight / (options.space * (canvasEle.width / canvasEle.height * 5) + 1); |       // 根据地图缩放程度调整repeatX | ||||||
|     } else { |       var cameraHeight = this.sdk.viewer.camera.positionCartographic.height; | ||||||
|       repeatX = undefined; |       var boundingSphere = new Cesium.BoundingSphere( | ||||||
|  |         new Cesium.Cartesian3(-1000000, 0, 0), // 中心点坐标 | ||||||
|  |         500000 // 半径(距离) | ||||||
|  |       ); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |       // 获取绘图缓冲区的宽度和高度(通常是屏幕的分辨率) | ||||||
|  |       var drawingBufferWidth = this.sdk.viewer.canvas.clientWidth; | ||||||
|  |       var drawingBufferHeight = this.sdk.viewer.canvas.clientHeight; | ||||||
|  |  | ||||||
|  |       // 使用 getPixelSize 方法获取包围球在屏幕上的像素大小 | ||||||
|  |       var groundResolution = this.sdk.viewer.scene.camera.getPixelSize(boundingSphere, drawingBufferWidth, drawingBufferHeight) | ||||||
|  |       // repeatX *= groundResolution / cameraHeight / ((myImg.width / myImg.height * 5) + 1); | ||||||
|  |       if (groundResolution > 700) { | ||||||
|  |         repeatX *= groundResolution / cameraHeight / (options.space * (canvasEle.width / canvasEle.height * 5) + 1); | ||||||
|  |       } else { | ||||||
|  |         repeatX = undefined; | ||||||
|  |       } | ||||||
|  |  | ||||||
|  |       if (this.sdk.viewer.scene.mode === Cesium.SceneMode.SCENE3D) { | ||||||
|  |         return repeatX | ||||||
|  |       } else { | ||||||
|  |         let sdk3d = get3DView() | ||||||
|  |         let sdk3dEntity = sdk3d.viewer.entities.getById(this.options.id) | ||||||
|  |         return sdk3dEntity.polyline.oriRepeatX | ||||||
|  |       } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     return repeatX |  | ||||||
|   } |   } | ||||||
|   /** |   /** | ||||||
|    * 编辑框 |    * 编辑框 | ||||||
| @ -1501,6 +1608,9 @@ class PolylineObject extends Base { | |||||||
|           } |           } | ||||||
|           this.nodePoints = [] |           this.nodePoints = [] | ||||||
|           this.positionEditing = false |           this.positionEditing = false | ||||||
|  |           YJ.Measure.SetMeasureStatus(false) | ||||||
|  |           this.event && this.event.destroy() | ||||||
|  |           this.tip && this.tip.destroy() | ||||||
|         }, |         }, | ||||||
|         showCallBack: show => { |         showCallBack: show => { | ||||||
|           this.options.show = show |           this.options.show = show | ||||||
| @ -1529,14 +1639,24 @@ class PolylineObject 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 | ||||||
|  |  | ||||||
|  |       function tabClick(e) { | ||||||
|  |         if (e === '2' || e === 2) {//点击线条样式 | ||||||
|  |           if (2 < _this.options.type && _this.options.type < 13) {//贴图参数 | ||||||
|  |             document.getElementById('dashTextureDom') && (document.getElementById('dashTextureDom').style.display = 'flex') | ||||||
|  |           } else { | ||||||
|  |             document.getElementById('dashTextureDom') && (document.getElementById('dashTextureDom').style.display = 'none') | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |  | ||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs( |       let tabsElm = new cy_tabs( | ||||||
|         'polyline-object-edit-tabs', |         'polyline-object-edit-tabs', | ||||||
|         undefined, |         tabClick, | ||||||
|         this.sdk |         this.sdk | ||||||
|       ) |       ) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName('color')[0], |         el: contentElm.getElementsByClassName('color')[0], | ||||||
|         size: 'mini', //颜色box类型 |         size: 'mini', //颜色box类型 | ||||||
|         alpha: true, //是否开启透明度 |         alpha: true, //是否开启透明度 | ||||||
| @ -1550,7 +1670,7 @@ class PolylineObject extends Base { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         } //点击清空按钮事件回调 |         } //点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName('labelColor')[0], |         el: contentElm.getElementsByClassName('labelColor')[0], | ||||||
|         size: 'mini', //颜色box类型 |         size: 'mini', //颜色box类型 | ||||||
|         alpha: true, //是否开启透明度 |         alpha: true, //是否开启透明度 | ||||||
| @ -1564,7 +1684,7 @@ class PolylineObject extends Base { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         } //点击清空按钮事件回调 |         } //点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let extendColorPicker = new ewPlugins('colorpicker', { |       let extendColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName('extendColor')[0], |         el: contentElm.getElementsByClassName('extendColor')[0], | ||||||
|         size: 'mini', //颜色box类型 |         size: 'mini', //颜色box类型 | ||||||
|         alpha: true, //是否开启透明度 |         alpha: true, //是否开启透明度 | ||||||
| @ -1578,7 +1698,7 @@ class PolylineObject extends Base { | |||||||
|           this.extendColor = 'rgba(255,255,255,1)' |           this.extendColor = 'rgba(255,255,255,1)' | ||||||
|         } //点击清空按钮事件回调 |         } //点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let lineColorPicker = new ewPlugins('colorpicker', { |       let lineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName('labelLineColor')[0], |         el: contentElm.getElementsByClassName('labelLineColor')[0], | ||||||
|         size: 'mini', //颜色box类型 |         size: 'mini', //颜色box类型 | ||||||
|         alpha: true, //是否开启透明度 |         alpha: true, //是否开启透明度 | ||||||
| @ -1592,7 +1712,7 @@ class PolylineObject extends Base { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         } //点击清空按钮事件回调 |         } //点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       _this.labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName('labelBackgroundColorStart')[0], |         el: contentElm.getElementsByClassName('labelBackgroundColorStart')[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -1606,7 +1726,7 @@ class PolylineObject extends Base { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         } |         } | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName('labelBackgroundColorEnd')[0], |         el: contentElm.getElementsByClassName('labelBackgroundColorEnd')[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -1627,7 +1747,7 @@ class PolylineObject extends Base { | |||||||
|       this._elms.labelColor = [labelColorPicker] |       this._elms.labelColor = [labelColorPicker] | ||||||
|       this._elms.extendColor = [extendColorPicker] |       this._elms.extendColor = [extendColorPicker] | ||||||
|       this._elms.labelLineColor = [lineColorPicker] |       this._elms.labelLineColor = [lineColorPicker] | ||||||
|       this._elms.labelBackgroundColorStart = [labelBackgroundColorStartPicker] |       this._elms.labelBackgroundColorStart = [_this.labelBackgroundColorStartPicker] | ||||||
|       this._elms.labelBackgroundColorEnd = [labelBackgroundColorEndPicker] |       this._elms.labelBackgroundColorEnd = [labelBackgroundColorEndPicker] | ||||||
|  |  | ||||||
|       setTimeout(() => { |       setTimeout(() => { | ||||||
| @ -1725,6 +1845,7 @@ class PolylineObject extends Base { | |||||||
|           '.input-select-unit', |           '.input-select-unit', | ||||||
|           1 |           1 | ||||||
|         ) |         ) | ||||||
|  |         this.#unitDataLegpObject = unitDataLegpObject | ||||||
|         if (unitDataLegpObject) { |         if (unitDataLegpObject) { | ||||||
|           unitDataLegpObject.legp_search(unitData) |           unitDataLegpObject.legp_search(unitData) | ||||||
|           let unitDataLegpElm = this._DialogObject._element.content |           let unitDataLegpElm = this._DialogObject._element.content | ||||||
| @ -1904,16 +2025,16 @@ class PolylineObject extends Base { | |||||||
|  |  | ||||||
|                 //控制参数显隐 |                 //控制参数显隐 | ||||||
|                 if (2 < this.lineType && this.lineType < 13) {//贴图参数 |                 if (2 < this.lineType && this.lineType < 13) {//贴图参数 | ||||||
|                   document.getElementById('dashTextureDom').style.display = 'flex' |                   document.getElementById('dashTextureDom') && (document.getElementById('dashTextureDom').style.display = 'flex') | ||||||
|                 } else { |                 } else { | ||||||
|                   document.getElementById('dashTextureDom').style.display = 'none' |                   document.getElementById('dashTextureDom') && (document.getElementById('dashTextureDom').style.display = 'none') | ||||||
|                 } |                 } | ||||||
|                 if (2 < this.lineType && this.lineType < 5) {//尾迹参数 |                 if (2 < this.lineType && this.lineType < 5) {//尾迹参数 | ||||||
|                   document.getElementsByClassName('lineSpace')[0].style.display = 'none' |                   document.getElementsByClassName('lineSpace')[0] && (document.getElementsByClassName('lineSpace')[0].style.display = 'none') | ||||||
|                   document.getElementsByClassName('lineSpace')[1].style.display = 'none' |                   document.getElementsByClassName('lineSpace')[1] && (document.getElementsByClassName('lineSpace')[1].style.display = 'none') | ||||||
|                 } else { |                 } else { | ||||||
|                   document.getElementsByClassName('lineSpace')[0].style.display = 'flex' |                   document.getElementsByClassName('lineSpace')[0] && (document.getElementsByClassName('lineSpace')[0].style.display = 'flex') | ||||||
|                   document.getElementsByClassName('lineSpace')[1].style.display = 'flex' |                   document.getElementsByClassName('lineSpace')[1] && (document.getElementsByClassName('lineSpace')[1].style.display = 'flex') | ||||||
|                 } |                 } | ||||||
|                 break |                 break | ||||||
|               } |               } | ||||||
| @ -2147,6 +2268,37 @@ class PolylineObject extends Base { | |||||||
|           this._elms.altInput.push(altInput) |           this._elms.altInput.push(altInput) | ||||||
|           tBodyElm.appendChild(tr) |           tBodyElm.appendChild(tr) | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |         let fontData = getFontList() | ||||||
|  |         let fontObject = legp( | ||||||
|  |           this._DialogObject._element.content.getElementsByClassName( | ||||||
|  |             'font-select-box' | ||||||
|  |           )[0], | ||||||
|  |           '.font-select' | ||||||
|  |         ) | ||||||
|  |         if (fontObject) { | ||||||
|  |           fontObject.legp_search(fontData) | ||||||
|  |           let fontDataLegpElm = this._DialogObject._element.content | ||||||
|  |             .getElementsByClassName('font-select')[0] | ||||||
|  |             .getElementsByTagName('input')[0] | ||||||
|  |           fontDataLegpElm.value = fontData[this.labelFontFamily].value | ||||||
|  |           for (let i = 0; i < fontData.length; i++) { | ||||||
|  |             if (fontData[i].value == fontDataLegpElm.value) { | ||||||
|  |               fontObject.legp_searchActive(fontData[i].value) | ||||||
|  |               break | ||||||
|  |             } | ||||||
|  |           } | ||||||
|  |           fontDataLegpElm.addEventListener('input', () => { | ||||||
|  |             for (let i = 0; i < fontData.length; i++) { | ||||||
|  |               if (fontData[i].value === fontDataLegpElm.value) { | ||||||
|  |                 this.labelFontFamily = fontData[i].key | ||||||
|  |                 break | ||||||
|  |               } | ||||||
|  |             } | ||||||
|  |           }) | ||||||
|  |           this._elms.labelFontFamily = [fontDataLegpElm] | ||||||
|  |         } | ||||||
|       }, 0) |       }, 0) | ||||||
|     } else { |     } else { | ||||||
|       if (this._DialogObject && this._DialogObject.close) { |       if (this._DialogObject && this._DialogObject.close) { | ||||||
| @ -2348,6 +2500,7 @@ class PolylineObject extends Base { | |||||||
|     this.labelShow = this.originalOptions.label.show |     this.labelShow = this.originalOptions.label.show | ||||||
|     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.labelLineWidth = this.originalOptions.label.lineWidth |     this.labelLineWidth = this.originalOptions.label.lineWidth | ||||||
|     this.labelPixelOffset = this.originalOptions.label.pixelOffset |     this.labelPixelOffset = this.originalOptions.label.pixelOffset | ||||||
|     this.labelLineColor = this.originalOptions.label.lineColor |     this.labelLineColor = this.originalOptions.label.lineColor | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ import EventBinding from '../../Element/Dialog/eventBinding'; | |||||||
| import richText from "../../Element/richText"; | import richText from "../../Element/richText"; | ||||||
| import MouseEvent from '../../../Event/index' | import MouseEvent from '../../../Event/index' | ||||||
| import LabelObject from '../LabelObject' | import LabelObject from '../LabelObject' | ||||||
| import { syncData } from '../../../Global/MultiViewportMode' | import { syncData, getSdk as get2DSdk } from '../../../Global/MultiViewportMode' | ||||||
| import { legp } from '../../Element/datalist'; | import { legp } from '../../Element/datalist'; | ||||||
| import { getFontList, getFontFamilyName } from '../../Element/fontSelect' | import { getFontList, getFontFamilyName } from '../../Element/fontSelect' | ||||||
| import MouseTip from '../../../MouseTip' | import MouseTip from '../../../MouseTip' | ||||||
| @ -138,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 = 1000000 |       that.entity.ellipse.height = 1 | ||||||
|     } |     } | ||||||
|     RadarScan.createLabel(that) |     RadarScan.createLabel(that) | ||||||
|     syncData(that.sdk, that.options.id) |     syncData(that.sdk, that.options.id) | ||||||
| @ -246,16 +246,29 @@ class RadarScan extends Base { | |||||||
|  |  | ||||||
|   set show(v) { |   set show(v) { | ||||||
|     if (typeof v === "boolean") { |     if (typeof v === "boolean") { | ||||||
|       this.options.show = v |       let sdkD = get2DSdk().sdkD | ||||||
|       this.entity.show = v |       if (!this.isShowView || !sdkD) { | ||||||
|  |         this.options.show = v | ||||||
|  |       } | ||||||
|  |       if (!this.showView || this.showView == 3 || !sdkD) { | ||||||
|  |         this.entity.show = this.options.show | ||||||
|  |         if (this.options.label.show && this.label) { | ||||||
|  |           this.label.show = this.options.show | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |       else { | ||||||
|  |         this.entity.show = false | ||||||
|  |         if (this.options.label.show && this.label) { | ||||||
|  |           this.label.show = false | ||||||
|  |         } | ||||||
|  |       } | ||||||
|       if (this._DialogObject && this._DialogObject.showBtn) { |       if (this._DialogObject && this._DialogObject.showBtn) { | ||||||
|         this._DialogObject.showBtn.checked = v |         this._DialogObject.showBtn.checked = v | ||||||
|       } |       } | ||||||
|       if (this.options.label.show && this.label) { |        | ||||||
|         this.label.show = v |  | ||||||
|       } |  | ||||||
|       syncData(this.sdk, this.options.id) |       syncData(this.sdk, this.options.id) | ||||||
|       syncSplitData(this.sdk, this.options.id) |       syncSplitData(this.sdk, this.options.id) | ||||||
|  |       this.isShowView = false | ||||||
|     } else { |     } else { | ||||||
|       console.error("参数必须为boolean") |       console.error("参数必须为boolean") | ||||||
|     } |     } | ||||||
| @ -425,7 +438,7 @@ class RadarScan extends Base { | |||||||
|     this.changeMaterial() |     this.changeMaterial() | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -448,8 +461,9 @@ class RadarScan extends Base { | |||||||
|     return this.options.label.show |     return this.options.label.show | ||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|  |     let sdkD = get2DSdk().sdkD | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show) { |     if (this.show && (!this.showView || this.showView == 3 || !sdkD)) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @ -483,7 +497,7 @@ class RadarScan extends Base { | |||||||
|     this.label.color = v |     this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -583,7 +597,7 @@ class RadarScan extends Base { | |||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -610,7 +624,7 @@ class RadarScan extends Base { | |||||||
|     this.label.backgroundColor = [v, this.label.backgroundColor[1]] |     this.label.backgroundColor = [v, this.label.backgroundColor[1]] | ||||||
|     if (this._elms.labelBackgroundColorStart) { |     if (this._elms.labelBackgroundColorStart) { | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |       this._elms.labelBackgroundColorStart.forEach((item, i) => { | ||||||
|         let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -636,7 +650,7 @@ class RadarScan extends Base { | |||||||
|     this.label.backgroundColor = [this.label.backgroundColor[0], v] |     this.label.backgroundColor = [this.label.backgroundColor[0], v] | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -1124,7 +1138,7 @@ class RadarScan extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk) |       let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1138,7 +1152,7 @@ class RadarScan extends Base { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |         el: contentElm.getElementsByClassName("labelColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1152,7 +1166,7 @@ class RadarScan extends Base { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let lineColorPicker = new ewPlugins('colorpicker', { |       let lineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelLineColor")[0], |         el: contentElm.getElementsByClassName("labelLineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1166,7 +1180,7 @@ class RadarScan extends Base { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -1180,7 +1194,7 @@ class RadarScan extends Base { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         }, |         }, | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -1374,7 +1388,7 @@ class RadarScan extends Base { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   async remove() { |   async remove() { | ||||||
|     this.label.remove() |     this.label && this.label.remove() | ||||||
|     this.entity && this.sdk.viewer.entities.remove(this.entity) |     this.entity && this.sdk.viewer.entities.remove(this.entity) | ||||||
|     this.entity2 && this.sdk.viewer.entities.remove(this.entity2) |     this.entity2 && this.sdk.viewer.entities.remove(this.entity2) | ||||||
|     this.entity = null |     this.entity = null | ||||||
|  | |||||||
| @ -373,7 +373,7 @@ class RadarScanStereoscopic extends Base { | |||||||
|     this.entity.ellipsoid.outlineColor = Cesium.Color.fromCssColorString(v) |     this.entity.ellipsoid.outlineColor = Cesium.Color.fromCssColorString(v) | ||||||
|     if (this._elms.colorOut) { |     if (this._elms.colorOut) { | ||||||
|       this._elms.colorOut.forEach((item, i) => { |       this._elms.colorOut.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -400,7 +400,7 @@ class RadarScanStereoscopic extends Base { | |||||||
|     this.entity.wall.material = Cesium.Color.fromCssColorString(v) |     this.entity.wall.material = Cesium.Color.fromCssColorString(v) | ||||||
|     if (this._elms.colorIn) { |     if (this._elms.colorIn) { | ||||||
|       this._elms.colorIn.forEach((item, i) => { |       this._elms.colorIn.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -424,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) { |     if (this.show && !this.showView || this.showView == 3) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @ -458,7 +458,7 @@ class RadarScanStereoscopic extends Base { | |||||||
|     this.label.color = v |     this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -558,7 +558,7 @@ class RadarScanStereoscopic extends Base { | |||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -585,7 +585,7 @@ class RadarScanStereoscopic extends Base { | |||||||
|     this.label.backgroundColor = [v, this.label.backgroundColor[1]] |     this.label.backgroundColor = [v, this.label.backgroundColor[1]] | ||||||
|     if (this._elms.labelBackgroundColorStart) { |     if (this._elms.labelBackgroundColorStart) { | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |       this._elms.labelBackgroundColorStart.forEach((item, i) => { | ||||||
|         let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -611,7 +611,7 @@ class RadarScanStereoscopic extends Base { | |||||||
|     this.label.backgroundColor = [this.label.backgroundColor[0], v] |     this.label.backgroundColor = [this.label.backgroundColor[0], v] | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -1030,7 +1030,7 @@ class RadarScanStereoscopic extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk) |       let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorOutPicker = new ewPlugins('colorpicker', { |       let colorOutPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("colorOut")[0], |         el: contentElm.getElementsByClassName("colorOut")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1044,7 +1044,7 @@ class RadarScanStereoscopic extends Base { | |||||||
|           this.colorOut = 'rgba(255,255,255,1)' |           this.colorOut = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let colorInPicker = new ewPlugins('colorpicker', { |       let colorInPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("colorIn")[0], |         el: contentElm.getElementsByClassName("colorIn")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1058,7 +1058,7 @@ class RadarScanStereoscopic extends Base { | |||||||
|           this.colorIn = 'rgba(255,255,255,1)' |           this.colorIn = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |         el: contentElm.getElementsByClassName("labelColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1072,7 +1072,7 @@ class RadarScanStereoscopic extends Base { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let lineColorPicker = new ewPlugins('colorpicker', { |       let lineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelLineColor")[0], |         el: contentElm.getElementsByClassName("labelLineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1086,7 +1086,7 @@ class RadarScanStereoscopic extends Base { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -1100,7 +1100,7 @@ class RadarScanStereoscopic extends Base { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         }, |         }, | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
|  | |||||||
							
								
								
									
										39
									
								
								src/Obj/Base/RoadObject/_element.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								src/Obj/Base/RoadObject/_element.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,39 @@ | |||||||
|  | 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 } | ||||||
							
								
								
									
										92
									
								
								src/Obj/Base/RoadObject/eventBinding.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										92
									
								
								src/Obj/Base/RoadObject/eventBinding.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,92 @@ | |||||||
|  | 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; | ||||||
							
								
								
									
										1549
									
								
								src/Obj/Base/RoadObject/index-8.4.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1549
									
								
								src/Obj/Base/RoadObject/index-8.4.js
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1704
									
								
								src/Obj/Base/RoadObject/index-last.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1704
									
								
								src/Obj/Base/RoadObject/index-last.js
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										889
									
								
								src/Obj/Base/RoadObject/index-拐角连接.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										889
									
								
								src/Obj/Base/RoadObject/index-拐角连接.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,889 @@ | |||||||
|  | /** | ||||||
|  |  * @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 | ||||||
							
								
								
									
										615
									
								
								src/Obj/Base/RoadObject/index-直接连接.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										615
									
								
								src/Obj/Base/RoadObject/index-直接连接.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,615 @@ | |||||||
|  | /** | ||||||
|  |  * @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 | ||||||
							
								
								
									
										1023
									
								
								src/Obj/Base/RoadObject/index-面大小一致.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1023
									
								
								src/Obj/Base/RoadObject/index-面大小一致.js
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1207
									
								
								src/Obj/Base/RoadObject/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1207
									
								
								src/Obj/Base/RoadObject/index.js
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -23,7 +23,7 @@ class SectorObject extends Base { | |||||||
|    * @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="rgba(255, 0, 0, 0.5)" {string} 颜色 | ||||||
|    * @param options.center {object} 位置 |    * @param options.center {object} 位置 | ||||||
|    * @param options.center.lng {object} 经度 |    * @param options.center.lng {object} 经度 | ||||||
|    * @param options.center.lat {object} 维度 |    * @param options.center.lat {object} 维度 | ||||||
| @ -39,7 +39,7 @@ class SectorObject extends Base { | |||||||
|   constructor(sdk, options = {}) { |   constructor(sdk, options = {}) { | ||||||
|     super(sdk, options); |     super(sdk, options); | ||||||
|     this.options.name = options.name || '未命名对象' |     this.options.name = options.name || '未命名对象' | ||||||
|     this.options.color = options.color || "#ff000080" |     this.options.color = options.color || "rgba(255, 0, 0, 0.5)" | ||||||
|     this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2 |     this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2 | ||||||
|     this.options.semiMinorAxis = (options.semiMinorAxis || options.semiMinorAxis === 0) ? options.semiMinorAxis : 10 |     this.options.semiMinorAxis = (options.semiMinorAxis || options.semiMinorAxis === 0) ? options.semiMinorAxis : 10 | ||||||
|     this.options.semiMajorAxis = (options.semiMajorAxis || options.semiMajorAxis === 0) ? options.semiMajorAxis : 20 |     this.options.semiMajorAxis = (options.semiMajorAxis || options.semiMajorAxis === 0) ? options.semiMajorAxis : 20 | ||||||
| @ -47,7 +47,7 @@ class SectorObject extends Base { | |||||||
|     this.options.center = options.center || {} |     this.options.center = options.center || {} | ||||||
|     this.options.line = options.line || {} |     this.options.line = options.line || {} | ||||||
|     this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3) |     this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3) | ||||||
|     this.options.line.color = this.options.line.color || '#ff000080' |     this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)' | ||||||
|     this.options['area-unit'] = options['area-unit'] || '平方米' |     this.options['area-unit'] = options['area-unit'] || '平方米' | ||||||
|     options.label = options.label || {} |     options.label = options.label || {} | ||||||
|     this._elms = {}; |     this._elms = {}; | ||||||
| @ -226,7 +226,7 @@ class SectorObject extends Base { | |||||||
|     return this.options.color |     return this.options.color | ||||||
|   } |   } | ||||||
|   set color(v) { |   set color(v) { | ||||||
|     this.options.color = v || '#ff000080' |     this.options.color = v || 'rgba(255, 0, 0, 0.5)' | ||||||
|     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) { |     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) { | ||||||
|       return |       return | ||||||
|     } |     } | ||||||
| @ -240,7 +240,7 @@ class SectorObject extends Base { | |||||||
|     this.entity.polyline.width = this.lineWidth |     this.entity.polyline.width = this.lineWidth | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -263,14 +263,14 @@ class SectorObject extends Base { | |||||||
|     return this.options.line.color |     return this.options.line.color | ||||||
|   } |   } | ||||||
|   set lineColor(v) { |   set lineColor(v) { | ||||||
|     this.options.line.color = v || '#ff000080' |     this.options.line.color = v || 'rgba(255, 0, 0, 0.5)' | ||||||
|     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) { |     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) { | ||||||
|       return |       return | ||||||
|     } |     } | ||||||
|     this.entity.polyline.material = Cesium.Color.fromCssColorString(this.options.line.color) |     this.entity.polyline.material = Cesium.Color.fromCssColorString(this.options.line.color) | ||||||
|     if (this._elms.lineColor) { |     if (this._elms.lineColor) { | ||||||
|       this._elms.lineColor.forEach((item, i) => { |       this._elms.lineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -293,7 +293,7 @@ class SectorObject extends Base { | |||||||
|     return this.options.line.width |     return this.options.line.width | ||||||
|   } |   } | ||||||
|   set lineWidth(v) { |   set lineWidth(v) { | ||||||
|     this.options.line.width =  ((v || v === 0) ? v : 3) |     this.options.line.width = ((v || v === 0) ? v : 3) | ||||||
|     this.entity.polyline.width = this.options.line.width |     this.entity.polyline.width = this.options.line.width | ||||||
|     this._elms.lineWidth && this._elms.lineWidth.forEach((item) => { |     this._elms.lineWidth && this._elms.lineWidth.forEach((item) => { | ||||||
|       item.value = this.options.line.width |       item.value = this.options.line.width | ||||||
| @ -344,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) { |     if (this.show && !this.showView || this.showView == 3) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @ -378,7 +378,7 @@ class SectorObject extends Base { | |||||||
|     this.label.color = v |     this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -478,7 +478,7 @@ class SectorObject extends Base { | |||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -505,7 +505,7 @@ class SectorObject extends Base { | |||||||
|     this.label.backgroundColor = [v, this.label.backgroundColor[1]] |     this.label.backgroundColor = [v, this.label.backgroundColor[1]] | ||||||
|     if (this._elms.labelBackgroundColorStart) { |     if (this._elms.labelBackgroundColorStart) { | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |       this._elms.labelBackgroundColorStart.forEach((item, i) => { | ||||||
|         let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -531,7 +531,7 @@ class SectorObject extends Base { | |||||||
|     this.label.backgroundColor = [this.label.backgroundColor[0], v] |     this.label.backgroundColor = [this.label.backgroundColor[0], v] | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -1175,7 +1175,7 @@ class SectorObject extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs('circle-object-edit-tabs', undefined, this.sdk) |       let tabsElm = new cy_tabs('circle-object-edit-tabs', undefined, this.sdk) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1189,7 +1189,7 @@ class SectorObject extends Base { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let linecolorPicker = new ewPlugins('colorpicker', { |       let linecolorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("lineColor")[0], |         el: contentElm.getElementsByClassName("lineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1203,7 +1203,7 @@ class SectorObject extends Base { | |||||||
|           this.lineColor = 'rgba(255,255,255,1)' |           this.lineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |         el: contentElm.getElementsByClassName("labelColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1217,7 +1217,7 @@ class SectorObject extends Base { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labellineColorPicker = new ewPlugins('colorpicker', { |       let labellineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelLineColor")[0], |         el: contentElm.getElementsByClassName("labelLineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1231,7 +1231,7 @@ class SectorObject extends Base { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -1245,7 +1245,7 @@ class SectorObject extends Base { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         }, |         }, | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -1560,7 +1560,7 @@ class SectorObject extends Base { | |||||||
|   _addRr() { |   _addRr() { | ||||||
|     if (this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value) { |     if (this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value) { | ||||||
|       this.options.attribute.vr.content.push({ |       this.options.attribute.vr.content.push({ | ||||||
|         name: '全景图' , |         name: '全景图', | ||||||
|         url: this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value |         url: this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value | ||||||
|       }) |       }) | ||||||
|       this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value = '' |       this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value = '' | ||||||
| @ -1573,7 +1573,7 @@ class SectorObject extends Base { | |||||||
|  |  | ||||||
|   addAttributeRr(vr) { |   addAttributeRr(vr) { | ||||||
|     this.options.attribute.vr.content.push({ |     this.options.attribute.vr.content.push({ | ||||||
|       name: '全景图' , |       name: '全景图', | ||||||
|       url: vr |       url: vr | ||||||
|     }) |     }) | ||||||
|     this.attributeVr = this.options.attribute.vr.content |     this.attributeVr = this.options.attribute.vr.content | ||||||
| @ -1922,6 +1922,19 @@ class SectorObject extends Base { | |||||||
|         that.cartesian3Towgs84(positions[1], that.sdk.viewer), |         that.cartesian3Towgs84(positions[1], that.sdk.viewer), | ||||||
|         that.cartesian3Towgs84(positions[positions.length - 4], that.sdk.viewer) |         that.cartesian3Towgs84(positions[positions.length - 4], that.sdk.viewer) | ||||||
|       ] |       ] | ||||||
|  |       let objectsToExclude = [...that.sdk.viewer.entities.values] | ||||||
|  |       that | ||||||
|  |         .getClampToHeight({ | ||||||
|  |           lng: that.options.center.lng, | ||||||
|  |           lat: that.options.center.lat | ||||||
|  |         }, objectsToExclude) | ||||||
|  |         .then(height => { | ||||||
|  |           that.label.position = [ | ||||||
|  |             that.options.center.lng, | ||||||
|  |             that.options.center.lat, | ||||||
|  |             height | ||||||
|  |           ] | ||||||
|  |         }) | ||||||
|       setTimeout(() => { |       setTimeout(() => { | ||||||
|         createNodePoints(positions[1], 'sector-start') |         createNodePoints(positions[1], 'sector-start') | ||||||
|         createNodePoints(positions[positions.length - 4], 'sector-end') |         createNodePoints(positions[positions.length - 4], 'sector-end') | ||||||
|  | |||||||
| @ -40,7 +40,7 @@ class StraightArrowObject extends Base { | |||||||
|     this.options.positions = options.positions || [] |     this.options.positions = options.positions || [] | ||||||
|     this.options.line = options.line || {} |     this.options.line = options.line || {} | ||||||
|     this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3) |     this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3) | ||||||
|     this.options.line.color = this.options.line.color || '#ff000080' |     this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)' | ||||||
|     this.options['area-unit'] = options['area-unit'] || '平方米' |     this.options['area-unit'] = options['area-unit'] || '平方米' | ||||||
|     this.entity |     this.entity | ||||||
|     this.event = new MouseEvent(this.sdk) |     this.event = new MouseEvent(this.sdk) | ||||||
| @ -109,7 +109,7 @@ class StraightArrowObject extends Base { | |||||||
|     return this.options.color |     return this.options.color | ||||||
|   } |   } | ||||||
|   set color(v) { |   set color(v) { | ||||||
|     this.options.color = v || '#ff000080' |     this.options.color = v || 'rgba(255, 0, 0, 0.5)' | ||||||
|     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) { |     if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) { | ||||||
|       return |       return | ||||||
|     } |     } | ||||||
| @ -122,7 +122,7 @@ class StraightArrowObject extends Base { | |||||||
|     this.entity.polygon.material = material |     this.entity.polygon.material = material | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -247,7 +247,7 @@ class StraightArrowObject extends Base { | |||||||
|     this.entity.polyline.material = Cesium.Color.fromCssColorString(v) |     this.entity.polyline.material = Cesium.Color.fromCssColorString(v) | ||||||
|     if (this._elms.lineColor) { |     if (this._elms.lineColor) { | ||||||
|       this._elms.lineColor.forEach((item, i) => { |       this._elms.lineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -321,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) { |     if (this.show && !this.showView || this.showView == 3) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @ -355,7 +355,7 @@ class StraightArrowObject extends Base { | |||||||
|     this.label.color = v |     this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -455,7 +455,7 @@ class StraightArrowObject extends Base { | |||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -482,7 +482,7 @@ class StraightArrowObject extends Base { | |||||||
|     this.label.backgroundColor = [v, this.label.backgroundColor[1]] |     this.label.backgroundColor = [v, this.label.backgroundColor[1]] | ||||||
|     if (this._elms.labelBackgroundColorStart) { |     if (this._elms.labelBackgroundColorStart) { | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |       this._elms.labelBackgroundColorStart.forEach((item, i) => { | ||||||
|         let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -508,7 +508,7 @@ class StraightArrowObject extends Base { | |||||||
|     this.label.backgroundColor = [this.label.backgroundColor[0], v] |     this.label.backgroundColor = [this.label.backgroundColor[0], v] | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -1178,7 +1178,7 @@ class StraightArrowObject extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs('assemble-object-edit-tabs', undefined, this.sdk) |       let tabsElm = new cy_tabs('assemble-object-edit-tabs', undefined, this.sdk) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1192,7 +1192,7 @@ class StraightArrowObject extends Base { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let linecolorPicker = new ewPlugins('colorpicker', { |       let linecolorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("lineColor")[0], |         el: contentElm.getElementsByClassName("lineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1206,7 +1206,7 @@ class StraightArrowObject extends Base { | |||||||
|           this.lineColor = 'rgba(255,255,255,1)' |           this.lineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |         el: contentElm.getElementsByClassName("labelColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1220,7 +1220,7 @@ class StraightArrowObject extends Base { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labellineColorPicker = new ewPlugins('colorpicker', { |       let labellineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelLineColor")[0], |         el: contentElm.getElementsByClassName("labelLineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1234,7 +1234,7 @@ class StraightArrowObject extends Base { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -1248,7 +1248,7 @@ class StraightArrowObject extends Base { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         }, |         }, | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
|  | |||||||
							
								
								
									
										243
									
								
								src/Obj/Base/TextBox/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										243
									
								
								src/Obj/Base/TextBox/index.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,243 @@ | |||||||
|  | /** | ||||||
|  |  * 文本框 | ||||||
|  |  */ | ||||||
|  | import Base from "../index"; | ||||||
|  | import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global' | ||||||
|  | class TextBox extends Base { | ||||||
|  |   /** | ||||||
|  |    * @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.options = { ...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.handler = undefined | ||||||
|  |     this.textDom = undefined | ||||||
|  |     this.create(this) | ||||||
|  |     this.sdk.addIncetance(this.options.id, this) | ||||||
|  |     this.callback = callback | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   async create(that) { | ||||||
|  |     let viewer = that.sdk.viewer | ||||||
|  |     // 创建div元素 | ||||||
|  |     let dom = document.createElement('span'); | ||||||
|  |     dom.id = that.options.id | ||||||
|  |     dom.className = 'popup-textarea' | ||||||
|  |     // 创建textarea元素 | ||||||
|  |     var textarea = document.createElement('textarea'); | ||||||
|  |     textarea.className = 'textarea' | ||||||
|  |     textarea.value = that.options.text; | ||||||
|  |     // 设置textarea的属性,例如行数和列数 | ||||||
|  |     textarea.rows = 6; | ||||||
|  |     textarea.style.resize = 'none' | ||||||
|  |     // 将textarea添加到div中 | ||||||
|  |     dom.appendChild(textarea); | ||||||
|  |     (!that.options.show) && (dom.style.display = 'none') | ||||||
|  |     // 将div添加到body中 | ||||||
|  |     // document.body.appendChild(dom); | ||||||
|  |  | ||||||
|  |     // 配置CSS样式和内容结构 | ||||||
|  |     viewer.cesiumWidget.container.appendChild(dom); | ||||||
|  |     let posi = Cesium.Cartesian3.fromDegrees(that.options.position.lng, that.options.position.lat, that.options.position.alt) | ||||||
|  |     that.handler = function () { | ||||||
|  |       const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates( | ||||||
|  |         viewer.scene, posi | ||||||
|  |       ); | ||||||
|  |       if (position) { | ||||||
|  |         let width = dom.clientWidth * 1 | ||||||
|  |         let height = dom.clientHeight * 1 | ||||||
|  |         dom.style.left = `${position.x - width / 2}px`; | ||||||
|  |         dom.style.top = `${position.y - height}px`; | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |     viewer.scene.postRender.addEventListener(that.handler); | ||||||
|  |     that.textDom = dom; | ||||||
|  |  | ||||||
|  |   } | ||||||
|  |   async isClick(posi, id) { | ||||||
|  |     let params = [ | ||||||
|  |       { | ||||||
|  |         position: posi | ||||||
|  |       }, | ||||||
|  |       id, | ||||||
|  |       null | ||||||
|  |     ] | ||||||
|  |  | ||||||
|  |     this.clickCallBack({ position: posi }, id, null) | ||||||
|  |   } | ||||||
|  |   async setHandeler(data) { | ||||||
|  |     let that = this | ||||||
|  |  | ||||||
|  |     let cartesian = this.sdk.viewer.scene.pickPosition(new Cesium.Cartesian2(data.x, data.y)); //屏幕坐标转为笛卡尔空间坐标 | ||||||
|  |     // 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)) { | ||||||
|  |       that.sdk.viewer.scene.postRender.removeEventListener(that.handler); | ||||||
|  |  | ||||||
|  |       var cartographic = Cesium.Cartographic.fromCartesian(cartesian); | ||||||
|  |       var longitude = Cesium.Math.toDegrees(cartographic.longitude); | ||||||
|  |       var latitude = Cesium.Math.toDegrees(cartographic.latitude); | ||||||
|  |  | ||||||
|  |       let height = await that.getClampToHeight({ lng: longitude, lat: latitude }) | ||||||
|  |       that.position = { | ||||||
|  |         lng: longitude, | ||||||
|  |         lat: latitude, | ||||||
|  |         alt: cartographic.height | ||||||
|  |         // alt: height | ||||||
|  |       } | ||||||
|  |       let posi = Cesium.Cartesian3.fromDegrees(longitude, latitude, cartographic.height) | ||||||
|  |  | ||||||
|  |       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 getwords(words) { | ||||||
|  |     this.options.text = words | ||||||
|  |     this.callback(this.options) | ||||||
|  |   } | ||||||
|  |   async returnFun() { | ||||||
|  |     return this.handler | ||||||
|  |   } | ||||||
|  |   get onClick() { | ||||||
|  |     return this.clickCallBack | ||||||
|  |   } | ||||||
|  |   set onClick(val) { | ||||||
|  |     if (val && typeof val !== 'function') { | ||||||
|  |       console.error('val:', val, '不是一个function') | ||||||
|  |     } else { | ||||||
|  |       this.clickCallBack = val | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |   get show() { | ||||||
|  |     return this.options.show | ||||||
|  |   } | ||||||
|  |   set show(v) { | ||||||
|  |     this.options.show = v | ||||||
|  |     this.textDom && (this.textDom.style.display = v ? 'block' : 'none'); | ||||||
|  |   } | ||||||
|  |   get position() { | ||||||
|  |     return this.options.position | ||||||
|  |   } | ||||||
|  |   set position(v) { | ||||||
|  |     this.options.position = v | ||||||
|  |   } | ||||||
|  |   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.position) { | ||||||
|  |         position = { ...this.options.position[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 = [] | ||||||
|  |       let a = Cesium.Cartesian3.fromDegrees( | ||||||
|  |         this.position.lng, | ||||||
|  |         this.position.lat, | ||||||
|  |         this.position.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) | ||||||
|  |         } | ||||||
|  |       }) | ||||||
|  |  | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   async remove() { | ||||||
|  |     if (this.handler) { | ||||||
|  |       this.sdk.viewer.scene.postRender.removeEventListener(this.handler); | ||||||
|  |       this.handler = undefined | ||||||
|  |     } | ||||||
|  |     if (this.textDom && this.textDom.parentNode) { | ||||||
|  |       this.sdk.viewer.cesiumWidget.container.removeChild(this.textDom); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   flicker() { } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | export default TextBox | ||||||
| @ -52,7 +52,7 @@ class Text3D extends Base { | |||||||
|     }) |     }) | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -236,7 +236,7 @@ class Text3D extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       // let tabsElm = new cy_tabs('radar-scan-edit-tabs') |       // let tabsElm = new cy_tabs('radar-scan-edit-tabs') | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -250,7 +250,7 @@ class Text3D extends Base { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |         el: contentElm.getElementsByClassName("labelColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -264,7 +264,7 @@ class Text3D extends Base { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let lineColorPicker = new ewPlugins('colorpicker', { |       let lineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelLineColor")[0], |         el: contentElm.getElementsByClassName("labelLineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -278,7 +278,7 @@ class Text3D extends Base { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -292,7 +292,7 @@ class Text3D extends Base { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         }, |         }, | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
|  | |||||||
| @ -263,7 +263,7 @@ class GroundText extends Base { | |||||||
|     }) |     }) | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini', //颜色box类型 |           size: 'mini', //颜色box类型 | ||||||
|           alpha: true, //是否开启透明度 |           alpha: true, //是否开启透明度 | ||||||
| @ -401,7 +401,7 @@ class GroundText extends Base { | |||||||
|       this._elms = this._EventBinding.element |       this._elms = this._EventBinding.element | ||||||
|  |  | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName('color')[0], |         el: contentElm.getElementsByClassName('color')[0], | ||||||
|         size: 'mini', //颜色box类型 |         size: 'mini', //颜色box类型 | ||||||
|         alpha: true, //是否开启透明度 |         alpha: true, //是否开启透明度 | ||||||
| @ -649,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 = this.options.color |       ctx.fillStyle = 'rgba(255, 255, 255, 1)' | ||||||
|       ctx.font = '200px serif' |       ctx.font = '200px serif' | ||||||
|       ctx.fillText(textArray[i], 0, 210 * (i + 1)) |       ctx.fillText(textArray[i], 0, 210 * (i + 1)) | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -164,7 +164,7 @@ class GroundText extends Base { | |||||||
|     }) |     }) | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini', //颜色box类型 |           size: 'mini', //颜色box类型 | ||||||
|           alpha: true, //是否开启透明度 |           alpha: true, //是否开启透明度 | ||||||
| @ -302,7 +302,7 @@ class GroundText extends Base { | |||||||
|       this._elms = this._EventBinding.element |       this._elms = this._EventBinding.element | ||||||
|  |  | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName('color')[0], |         el: contentElm.getElementsByClassName('color')[0], | ||||||
|         size: 'mini', //颜色box类型 |         size: 'mini', //颜色box类型 | ||||||
|         alpha: true, //是否开启透明度 |         alpha: true, //是否开启透明度 | ||||||
|  | |||||||
| @ -118,7 +118,7 @@ class StandText extends Base { | |||||||
|     this.entity.wall.material = this.getMaterial() |     this.entity.wall.material = this.getMaterial() | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -403,7 +403,7 @@ class StandText extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       // let tabsElm = new cy_tabs('radar-scan-edit-tabs') |       // let tabsElm = new cy_tabs('radar-scan-edit-tabs') | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -417,71 +417,11 @@ class StandText extends Base { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |  | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |  | ||||||
|         size: 'mini',//颜色box类型 |  | ||||||
|         alpha: true,//是否开启透明度 |  | ||||||
|         defaultColor: this.labelColor, |  | ||||||
|         disabled: false,//是否禁止打开颜色选择器 |  | ||||||
|         openPickerAni: 'opacity',//打开颜色选择器动画 |  | ||||||
|         sure: (color) => { |  | ||||||
|           this.labelColor = color |  | ||||||
|         },//点击确认按钮事件回调 |  | ||||||
|         clear: () => { |  | ||||||
|           this.labelColor = 'rgba(255,255,255,1)' |  | ||||||
|         },//点击清空按钮事件回调 |  | ||||||
|       }) |  | ||||||
|       let lineColorPicker = new ewPlugins('colorpicker', { |  | ||||||
|         el: contentElm.getElementsByClassName("labelLineColor")[0], |  | ||||||
|         size: 'mini',//颜色box类型 |  | ||||||
|         alpha: true,//是否开启透明度 |  | ||||||
|         defaultColor: this.labelLineColor, |  | ||||||
|         disabled: false,//是否禁止打开颜色选择器 |  | ||||||
|         openPickerAni: 'opacity',//打开颜色选择器动画 |  | ||||||
|         sure: (color) => { |  | ||||||
|           this.labelLineColor = color |  | ||||||
|         },//点击确认按钮事件回调 |  | ||||||
|         clear: () => { |  | ||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |  | ||||||
|         },//点击清空按钮事件回调 |  | ||||||
|       }) |  | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |  | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |  | ||||||
|         size: 'mini', |  | ||||||
|         alpha: true, |  | ||||||
|         defaultColor: this.labelBackgroundColorStart, |  | ||||||
|         disabled: false, |  | ||||||
|         openPickerAni: 'opacity', |  | ||||||
|         sure: (color) => { |  | ||||||
|           this.labelBackgroundColorStart = color |  | ||||||
|         }, |  | ||||||
|         clear: () => { |  | ||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |  | ||||||
|         }, |  | ||||||
|       }) |  | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |  | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |  | ||||||
|         size: 'mini', |  | ||||||
|         alpha: true, |  | ||||||
|         defaultColor: this.labelBackgroundColorEnd, |  | ||||||
|         disabled: false, |  | ||||||
|         openPickerAni: 'opacity', |  | ||||||
|         sure: (color) => { |  | ||||||
|           this.labelBackgroundColorEnd = color |  | ||||||
|         }, |  | ||||||
|         clear: () => { |  | ||||||
|           this.labelBackgroundColorEnd = 'rgba(255,255,255,1)' |  | ||||||
|         }, |  | ||||||
|       }) |  | ||||||
|  |  | ||||||
|       let all_elm = contentElm.getElementsByTagName("*") |       let all_elm = contentElm.getElementsByTagName("*") | ||||||
|       this._EventBinding.on(this, all_elm) |       this._EventBinding.on(this, all_elm) | ||||||
|       this._elms = this._EventBinding.element |       this._elms = this._EventBinding.element | ||||||
|       this._elms.color = [colorPicker] |       this._elms.color = [colorPicker] | ||||||
|       this._elms.labelColor = [labelColorPicker] |  | ||||||
|       this._elms.labelLineColor = [lineColorPicker] |  | ||||||
|       this._elms.labelBackgroundColorStart = [labelBackgroundColorStartPicker] |  | ||||||
|       this._elms.labelBackgroundColorEnd = [labelBackgroundColorEndPicker] |  | ||||||
|     } else { |     } else { | ||||||
|       if (this._DialogObject && this._DialogObject.remove) { |       if (this._DialogObject && this._DialogObject.remove) { | ||||||
|         this._DialogObject.remove() |         this._DialogObject.remove() | ||||||
| @ -568,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 = this.options.color; |       ctx.fillStyle = 'rgba(255, 255, 255, 1)'; | ||||||
|       ctx.font = "200px serif"; |       ctx.font = "200px serif"; | ||||||
|       ctx.fillText(textArray[i], 0, 210 * (i+1)); |       ctx.fillText(textArray[i], 0, 210 * (i+1)); | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -1,188 +1,188 @@ | |||||||
| function html() { | function html() { | ||||||
|     return ` |   return ` | ||||||
|     <span class="custom-divider"></span> |   <span class="custom-divider"></span> | ||||||
|     <div class="div-item"> |   <div class="div-item"> | ||||||
|       <div class="row"> |     <div class="row"> | ||||||
|         <div class="col"> |       <div class="col"> | ||||||
|           <span class="label" style="flex: 0 0 70px;">名称</span> |         <span class="label" style="flex: 0 0 70px;">名称</span> | ||||||
|           <input class="input" maxlength="40" type="text" @model="name"> |         <input class="input" maxlength="40" type="text" @model="name"> | ||||||
|         </div> |  | ||||||
|         <div class="col"></div> |  | ||||||
|       </div> |       </div> | ||||||
|  |       <div class="col"></div> | ||||||
|     </div> |     </div> | ||||||
|     <span class="custom-divider"></span> |   </div> | ||||||
|     <div class="div-item"> |   <span class="custom-divider"></span> | ||||||
|       <div class="row"> |   <div class="div-item"> | ||||||
|         <div class="col"> |     <div class="row"> | ||||||
|           <span class="label" style="flex: 0 0 70px;">起始点高度</span> |       <div class="col"> | ||||||
|           <div class="input-number input-number-unit-1 height-box"> |         <span class="label" style="flex: 0 0 70px;">起始点高度</span> | ||||||
|             <input class="input" type="number" title="" min="-9999999" max="999999999" @model="height"> |         <div class="input-number input-number-unit-1 height-box"> | ||||||
|             <span class="unit">m</span> |           <input class="input" type="number" title="" min="-9999999" max="999999999" @model="height"> | ||||||
|             <span class="arrow"></span> |           <span class="unit">m</span> | ||||||
|           </div> |           <span class="arrow"></span> | ||||||
|         </div> |  | ||||||
|         <div class="col"> |  | ||||||
|           <span class="label">模型倍数</span> |  | ||||||
|           <div class="input-number input-number-unit-2"> |  | ||||||
|             <input class="input" type="number" title="" min="0" max="99999" step="1" @model="scale"> |  | ||||||
|             <span class="unit">倍</span> |  | ||||||
|             <span class="arrow"></span> |  | ||||||
|           </div> |  | ||||||
|         </div> |         </div> | ||||||
|       </div> |       </div> | ||||||
|       <div class="row"> |       <div class="col"> | ||||||
|         <div class="col"> |         <span class="label">模型倍数</span> | ||||||
|           <span class="label" style="flex: 0 0 70px;">运行速度</span> |         <div class="input-number input-number-unit-2"> | ||||||
|           <div class="input-number input-number-unit-3"> |           <input class="input" type="number" title="" min="0" max="99999" step="1" @model="scale"> | ||||||
|             <input class="input" type="number" title="" min="0" max="99999999" step="1" @model="speed"> |           <span class="unit">倍</span> | ||||||
|             <span class="unit">m/s</span> |           <span class="arrow"></span> | ||||||
|             <span class="arrow"></span> |  | ||||||
|           </div> |  | ||||||
|         </div> |  | ||||||
|         <div class="col"> |  | ||||||
|           <span class="label">延迟运动</span> |  | ||||||
|           <div class="input-number input-number-unit-3"> |  | ||||||
|             <input class="input" type="number" title="" min="0" max="9999999" @model="delay"> |  | ||||||
|             <span class="unit">ms</span> |  | ||||||
|             <span class="arrow"></span> |  | ||||||
|           </div> |  | ||||||
|         </div> |  | ||||||
|       </div> |  | ||||||
|       <div class="row"> |  | ||||||
|         <div class="col"> |  | ||||||
|           <span class="label" style="flex: 0 0 70px;">更换模型</span> |  | ||||||
|           <button class="btn" @click="clickChangeModel">选择</button> |  | ||||||
|         </div> |  | ||||||
|         <div class="col"> |  | ||||||
|           <span class="label">模型方向</span> |  | ||||||
|           <button class="btn model-rotate-btn" @click="modelRotate">开始调整</button> |  | ||||||
|           <svg class="icon-rubric"><use xlink:href="#yj-icon-rubric"></use></svg> |  | ||||||
|         </div> |         </div> | ||||||
|       </div> |       </div> | ||||||
|     </div> |     </div> | ||||||
|     <span class="custom-divider"></span> |     <div class="row"> | ||||||
|     <div class="div-item"> |       <div class="col"> | ||||||
|       <div class="row"> |         <span class="label" style="flex: 0 0 70px;">运行速度</span> | ||||||
|         <div class="col"> |         <div class="input-number input-number-unit-3"> | ||||||
|           <div class="btn-group"> |           <input class="input" type="number" title="" min="0" max="99999999" step="1" @model="speed"> | ||||||
|             <button class="btn" style="border-radius: 5px 0 0 5px;" name="firstPerson" |           <span class="unit">m/s</span> | ||||||
|               data-state="true"><span>第一视角</span></button> |           <span class="arrow"></span> | ||||||
|             <button class="btn" style="border-radius: 0 5px 5px 0;" name="firstPerson" |         </div> | ||||||
|               data-state="false"><span>第三视角</span></button> |       </div> | ||||||
|           </div> |       <div class="col"> | ||||||
|  |         <span class="label">延迟运动</span> | ||||||
|  |         <div class="input-number input-number-unit-3"> | ||||||
|  |           <input class="input" type="number" title="" min="0" max="9999999" @model="delay"> | ||||||
|  |           <span class="unit">ms</span> | ||||||
|  |           <span class="arrow"></span> | ||||||
|         </div> |         </div> | ||||||
|       </div> |       </div> | ||||||
|     </div> |     </div> | ||||||
|     <div class="div-item div-item-switch"> |     <div class="row"> | ||||||
|       <div class="row"> |       <div class="col"> | ||||||
|         <div class="col"> |         <span class="label" style="flex: 0 0 70px;">更换模型</span> | ||||||
|           <span class="label">路径显隐</span> |         <button class="btn" @click="clickChangeModel">选择</button> | ||||||
|           <input class="btn-switch" type="checkbox" @model="lineShow"> |  | ||||||
|         </div> |  | ||||||
|         <div class="col"> |  | ||||||
|           <span class="label">模型显隐</span> |  | ||||||
|           <input class="btn-switch" type="checkbox" @model="modelShow"> |  | ||||||
|         </div> |  | ||||||
|         <div class="col"> |  | ||||||
|           <span class="label">实时路径</span> |  | ||||||
|           <input class="btn-switch" type="checkbox" @model="realTimeRoute"> |  | ||||||
|         </div> |  | ||||||
|       </div> |       </div> | ||||||
|       <div class="row"> |       <div class="col"> | ||||||
|         <div class="col"> |         <span class="label">模型方向</span> | ||||||
|           <span class="label">编辑</span> |         <button class="btn model-rotate-btn" @click="modelRotate">开始调整</button> | ||||||
|           <input class="btn-switch" type="checkbox" @model="lineEdit"> |         <svg class="icon-rubric"><use xlink:href="#yj-icon-rubric"></use></svg> | ||||||
|         </div> |  | ||||||
|         <div class="col"> |  | ||||||
|           <span class="label">路径圆滑</span> |  | ||||||
|           <input class="btn-switch" type="checkbox" @model="smooth"> |  | ||||||
|         </div> |  | ||||||
|         <div class="col"> |  | ||||||
|           <span class="label">环线</span> |  | ||||||
|           <input class="btn-switch" type="checkbox" @model="noseToTail"> |  | ||||||
|         </div> |  | ||||||
|       </div> |       </div> | ||||||
|       <div class="row"> |     </div> | ||||||
|         <div class="col"> |   </div> | ||||||
|           <span class="label">轨迹贴地</span> |   <span class="custom-divider"></span> | ||||||
|           <input class="btn-switch" type="checkbox" @model="ground"> |   <div class="div-item"> | ||||||
|         </div> |     <div class="row"> | ||||||
|         <div class="col"> |       <div class="col"> | ||||||
|           <span class="label">轨迹循环</span> |         <div class="btn-group"> | ||||||
|           <input class="btn-switch" type="checkbox" @model="loop"> |           <button class="btn" style="border-radius: 5px 0 0 5px;" name="firstPerson" | ||||||
|         </div> |             data-state="true"><span>第一视角</span></button> | ||||||
|         <div class="col"> |           <button class="btn" style="border-radius: 0 5px 5px 0;" name="firstPerson" | ||||||
|           <span class="label">轨迹动画</span> |             data-state="false"><span>第三视角</span></button> | ||||||
|           <input class="btn-switch" type="checkbox" @model="state"> |  | ||||||
|         </div> |  | ||||||
|       </div> |  | ||||||
|       <div class="row"> |  | ||||||
|         <div class="col"> |  | ||||||
|           <span class="label">路径方向</span> |  | ||||||
|           <input class="btn-switch" type="checkbox" @model="routeDirection"> |  | ||||||
|         </div> |  | ||||||
|         <div class="col" style="margin-right: 33px;"> |  | ||||||
|           <span class="label">视角跟随</span> |  | ||||||
|           <input class="btn-switch" type="checkbox" @model="viewFollow"> |  | ||||||
|         </div> |  | ||||||
|         <div class="col" style="margin: 0px;"> |  | ||||||
|           <span class="label">模型动画</span> |  | ||||||
|           <div class="input input-select model-animate-select"></div> |  | ||||||
|         </div> |         </div> | ||||||
|       </div> |       </div> | ||||||
|     </div> |     </div> | ||||||
|     <span class="custom-divider"></span> |   </div> | ||||||
|     <div class="div-item"> |   <div class="div-item div-item-switch"> | ||||||
|       <div class="row"> |     <div class="row"> | ||||||
|         <div class="col"> |       <div class="col"> | ||||||
|           <span class="label">文字开关</span> |         <span class="label">路径显隐</span> | ||||||
|           <input class="btn-switch" type="checkbox" @model="labelShow"> |         <input class="btn-switch" type="checkbox" @model="lineShow"> | ||||||
|         </div> |  | ||||||
|         <div class="col"></div> |  | ||||||
|       </div> |       </div> | ||||||
|       <div class="row"> |       <div class="col"> | ||||||
|         <div class="col" style="margin-right: 14px;"> |         <span class="label">模型显隐</span> | ||||||
|           <span class="label">字体颜色</span> |         <input class="btn-switch" type="checkbox" @model="modelShow"> | ||||||
|           <div class="labelColor"></div> |  | ||||||
|         </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" style="width: 82px;"> |  | ||||||
|             <input class="input" type="number" title="" min="1" max="99" @model="labelFontSize"> |  | ||||||
|             <span class="unit">px</span> |  | ||||||
|             <span class="arrow"></span> |  | ||||||
|           </div> |  | ||||||
|         </div> |  | ||||||
|       </div> |       </div> | ||||||
|       <div class="row"> |       <div class="col"> | ||||||
|         <div class="col"> |         <span class="label">实时路径</span> | ||||||
|           <span class="label">视野缩放</span> |         <input class="btn-switch" type="checkbox" @model="realTimeRoute"> | ||||||
|           <input class="btn-switch" type="checkbox" @model="labelScaleByDistance"> |       </div> | ||||||
|         </div> |     </div> | ||||||
|         <div class="col"> |     <div class="row"> | ||||||
|           <span class="label">最近距离</span> |       <div class="col"> | ||||||
|           <div class="input-number input-number-unit-1" style="width: 82px;"> |         <span class="label">编辑</span> | ||||||
|             <input class="input" type="number" title="" min="1" max="99999999" @model="labelNear"> |         <input class="btn-switch" type="checkbox" @model="lineEdit"> | ||||||
|             <span class="unit">m</span> |       </div> | ||||||
|             <span class="arrow"></span> |       <div class="col"> | ||||||
|           </div> |         <span class="label">路径圆滑</span> | ||||||
|         </div> |         <input class="btn-switch" type="checkbox" @model="smooth"> | ||||||
|         <div class="col"> |       </div> | ||||||
|           <span class="label">最远距离</span> |       <div class="col"> | ||||||
|           <div class="input-number input-number-unit-1" style="width: 82px;"> |         <span class="label">环线</span> | ||||||
|             <input class="input" type="number" title="" min="1" max="99999999" @model="labelFar"> |         <input class="btn-switch" type="checkbox" @model="noseToTail"> | ||||||
|             <span class="unit">m</span> |       </div> | ||||||
|             <span class="arrow"></span> |     </div> | ||||||
|           </div> |     <div class="row"> | ||||||
|  |       <div class="col"> | ||||||
|  |         <span class="label">轨迹贴地</span> | ||||||
|  |         <input class="btn-switch" type="checkbox" @model="ground"> | ||||||
|  |       </div> | ||||||
|  |       <div class="col"> | ||||||
|  |         <span class="label">轨迹循环</span> | ||||||
|  |         <input class="btn-switch" type="checkbox" @model="loop"> | ||||||
|  |       </div> | ||||||
|  |       <div class="col"> | ||||||
|  |         <span class="label">轨迹动画</span> | ||||||
|  |         <input class="btn-switch" type="checkbox" @model="state"> | ||||||
|  |       </div> | ||||||
|  |     </div> | ||||||
|  |     <div class="row"> | ||||||
|  |       <div class="col"> | ||||||
|  |         <span class="label">路径方向</span> | ||||||
|  |         <input class="btn-switch" type="checkbox" @model="routeDirection"> | ||||||
|  |       </div> | ||||||
|  |       <div class="col" style="margin-right: 33px;"> | ||||||
|  |         <span class="label">视角跟随</span> | ||||||
|  |         <input class="btn-switch" type="checkbox" @model="viewFollow"> | ||||||
|  |       </div> | ||||||
|  |       <div class="col" style="margin: 0px;"> | ||||||
|  |         <span class="label">模型动画</span> | ||||||
|  |         <div class="input input-select model-animate-select"></div> | ||||||
|  |       </div> | ||||||
|  |     </div> | ||||||
|  |   </div> | ||||||
|  |   <span class="custom-divider"></span> | ||||||
|  |   <div class="div-item"> | ||||||
|  |     <div class="row"> | ||||||
|  |       <div class="col"> | ||||||
|  |         <span class="label">文字开关</span> | ||||||
|  |         <input class="btn-switch" type="checkbox" @model="labelShow"> | ||||||
|  |       </div> | ||||||
|  |       <div class="col"></div> | ||||||
|  |     </div> | ||||||
|  |     <div class="row"> | ||||||
|  |       <div class="col" style="margin-right: 14px;"> | ||||||
|  |         <span class="label">字体颜色</span> | ||||||
|  |         <div class="labelColor"></div> | ||||||
|  |       </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" style="width: 82px;"> | ||||||
|  |           <input class="input" type="number" title="" min="1" max="99" @model="labelFontSize"> | ||||||
|  |           <span class="unit">px</span> | ||||||
|  |           <span class="arrow"></span> | ||||||
|         </div> |         </div> | ||||||
|       </div> |       </div> | ||||||
|     </div> |     </div> | ||||||
|     <span class="custom-divider"></span> |     <div class="row"> | ||||||
|     ` |       <div class="col"> | ||||||
|  |         <span class="label">视野缩放</span> | ||||||
|  |         <input class="btn-switch" type="checkbox" @model="labelScaleByDistance"> | ||||||
|  |       </div> | ||||||
|  |       <div class="col"> | ||||||
|  |         <span class="label">最近距离</span> | ||||||
|  |         <div class="input-number input-number-unit-1" style="width: 82px;"> | ||||||
|  |           <input class="input" type="number" title="" min="1" max="99999999" @model="labelNear"> | ||||||
|  |           <span class="unit">m</span> | ||||||
|  |           <span class="arrow"></span> | ||||||
|  |         </div> | ||||||
|  |       </div> | ||||||
|  |       <div class="col"> | ||||||
|  |         <span class="label">最远距离</span> | ||||||
|  |         <div class="input-number input-number-unit-1" style="width: 82px;"> | ||||||
|  |           <input class="input" type="number" title="" min="1" max="99999999" @model="labelFar"> | ||||||
|  |           <span class="unit">m</span> | ||||||
|  |           <span class="arrow"></span> | ||||||
|  |         </div> | ||||||
|  |       </div> | ||||||
|  |     </div> | ||||||
|  |   </div> | ||||||
|  |   <span class="custom-divider"></span> | ||||||
|  |   ` | ||||||
| } | } | ||||||
|  |  | ||||||
| export { html } | export { html } | ||||||
|  | |||||||
| @ -99,7 +99,7 @@ class TrajectoryMotion extends Base { | |||||||
|       color: options.label.color || '#ffffff', |       color: options.label.color || '#ffffff', | ||||||
|       lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4, |       lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4, | ||||||
|       pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20, |       pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20, | ||||||
|       backgroundColor: options.label.backgroundColor || ['#42c6ef', '#42c6ef'], |       backgroundColor: options.label.backgroundColor || ['#00ffff80', '#00ffff80'], | ||||||
|       lineColor: options.label.lineColor || '#00ffff80', |       lineColor: options.label.lineColor || '#00ffff80', | ||||||
|       scaleByDistance: options.label.scaleByDistance || false, |       scaleByDistance: options.label.scaleByDistance || false, | ||||||
|       near: (options.label.near || options.label.near === 0) ? options.label.near : 2000, |       near: (options.label.near || options.label.near === 0) ? options.label.near : 2000, | ||||||
| @ -144,37 +144,55 @@ class TrajectoryMotion extends Base { | |||||||
|  |  | ||||||
|   set show(v) { |   set show(v) { | ||||||
|     if (typeof v === "boolean") { |     if (typeof v === "boolean") { | ||||||
|       this.options.show = v |       let sdkD = get2DView() | ||||||
|       if (this.originalOptions) { |       if (!this.isShowView || !sdkD) { | ||||||
|         this.originalOptions.show = v |         this.options.show = v | ||||||
|  |         if (this.originalOptions) { | ||||||
|  |           this.originalOptions.show = v | ||||||
|  |         } | ||||||
|       } |       } | ||||||
|       if (v) { |       if (this.options.show) { | ||||||
|         if (this.firstPersonView) { |         if (this.firstPersonView) { | ||||||
|           this.model.show = false |           this.model.show = false | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
|           this.model.show = this.modelShow |           this.model.show = (!this.showView || this.showView == 3 || !sdkD) ? this.modelShow : false | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         this.line.polyline.material = this.lineShow ? new Cesium.PolylineDashMaterialProperty({ |         if ((!this.showView || this.showView == 3 || !sdkD)) { | ||||||
|           color: new Cesium.Color.fromCssColorString('#00ffff'), |           this.line.polyline.material = this.lineShow ? new Cesium.PolylineDashMaterialProperty({ | ||||||
|           dashLength: 20, |             color: new Cesium.Color.fromCssColorString('#00ffff'), | ||||||
|         }) : new Cesium.PolylineDashMaterialProperty({ |             dashLength: 20, | ||||||
|           color: new Cesium.Color.fromCssColorString('#00ffff00'), |           }) : new Cesium.PolylineDashMaterialProperty({ | ||||||
|           dashLength: 20, |             color: new Cesium.Color.fromCssColorString('#00ffff00'), | ||||||
|         }) |             dashLength: 20, | ||||||
|  |           }) | ||||||
|  |         } | ||||||
|  |         else { | ||||||
|  |           this.line.polyline.material = new Cesium.PolylineDashMaterialProperty({ | ||||||
|  |             color: new Cesium.Color.fromCssColorString('#00ffff00'), | ||||||
|  |             dashLength: 20, | ||||||
|  |           }) | ||||||
|  |         } | ||||||
|         for (let i = 0; i < this.keyPoints.length; i++) { |         for (let i = 0; i < this.keyPoints.length; i++) { | ||||||
|           this.keyPoints[i].show = this.keyPointShow |           this.keyPoints[i].show = (!this.showView || this.showView == 3 || !sdkD) ? this.keyPointShow : false | ||||||
|         } |         } | ||||||
|         if (this.realTimeRoute) { |         if (this.realTimeRoute) { | ||||||
|           this.realTimeLine && (this.realTimeLine.show = true) |           this.realTimeLine && (this.realTimeLine.show = (!this.showView || this.showView == 3 || !sdkD) ? true : false) | ||||||
|         } |         } | ||||||
|         this.label && (this.label.show = this.options.label.show) |         this.label && (this.label.show = (!this.showView || this.showView == 3 || !sdkD) ? this.options.label.show : false) | ||||||
|       } |       } | ||||||
|       else { |       else { | ||||||
|         this.model.show = v |         this.model.show = (!this.showView || this.showView == 3 || !sdkD) ? this.options.show : false | ||||||
|  |         let show = this.options.show | ||||||
|  |         if ((!this.showView || this.showView == 3 || !sdkD)) { | ||||||
|  |           show = this.options.show | ||||||
|  |         } | ||||||
|  |         else { | ||||||
|  |           show = false | ||||||
|  |         } | ||||||
|         this.realTimeLine && (this.realTimeLine.show = false) |         this.realTimeLine && (this.realTimeLine.show = false) | ||||||
|         this.line.polyline.material = v ? new Cesium.PolylineDashMaterialProperty({ |         this.line.polyline.material = show ? new Cesium.PolylineDashMaterialProperty({ | ||||||
|           color: new Cesium.Color.fromCssColorString('#00ffff'), |           color: new Cesium.Color.fromCssColorString('#00ffff'), | ||||||
|           dashLength: 20, |           dashLength: 20, | ||||||
|         }) : new Cesium.PolylineDashMaterialProperty({ |         }) : new Cesium.PolylineDashMaterialProperty({ | ||||||
| @ -182,7 +200,7 @@ class TrajectoryMotion extends Base { | |||||||
|           dashLength: 20, |           dashLength: 20, | ||||||
|         }) |         }) | ||||||
|         for (let i = 0; i < this.keyPoints.length; i++) { |         for (let i = 0; i < this.keyPoints.length; i++) { | ||||||
|           this.keyPoints[i].show = v |           this.keyPoints[i].show = (!this.showView || this.showView == 3) ? show : false | ||||||
|         } |         } | ||||||
|         this.label && (this.label.show = false) |         this.label && (this.label.show = false) | ||||||
|         this.viewFollow = false |         this.viewFollow = false | ||||||
| @ -193,6 +211,7 @@ class TrajectoryMotion extends Base { | |||||||
|       } |       } | ||||||
|       syncData(this.sdk, this.options.id) |       syncData(this.sdk, this.options.id) | ||||||
|       syncSplitData(this.sdk, this.options.id) |       syncSplitData(this.sdk, this.options.id) | ||||||
|  |       this.isShowView = false | ||||||
|     } else { |     } else { | ||||||
|       console.error("参数必须为boolean") |       console.error("参数必须为boolean") | ||||||
|     } |     } | ||||||
| @ -636,7 +655,7 @@ class TrajectoryMotion extends Base { | |||||||
|         }) |         }) | ||||||
|         this.TweenAnimate.pause() |         this.TweenAnimate.pause() | ||||||
|         setTimeout(() => { |         setTimeout(() => { | ||||||
|           _this.model.isMove = false |           _this.model && (_this.model.isMove = false) | ||||||
|         }, 200); |         }, 200); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
| @ -655,9 +674,17 @@ class TrajectoryMotion extends Base { | |||||||
|     return this.options.model.show |     return this.options.model.show | ||||||
|   } |   } | ||||||
|   set modelShow(v) { |   set modelShow(v) { | ||||||
|  |     let sdkD = get2DView() | ||||||
|     this.options.model.show = v |     this.options.model.show = v | ||||||
|  |     let show = v | ||||||
|  |     if (this.show && (!this.showView || this.showView == 3 || !sdkD)) { | ||||||
|  |       show = v | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |       show = false | ||||||
|  |     } | ||||||
|     if (this.model && this.show) { |     if (this.model && this.show) { | ||||||
|       this.model.show = v |       this.model.show = show | ||||||
|     } |     } | ||||||
|     this._elms.modelShow && this._elms.modelShow.forEach((item) => { |     this._elms.modelShow && this._elms.modelShow.forEach((item) => { | ||||||
|       item.checked = v |       item.checked = v | ||||||
| @ -723,8 +750,16 @@ class TrajectoryMotion extends Base { | |||||||
|       this.realTimeRoute = false |       this.realTimeRoute = false | ||||||
|     } |     } | ||||||
|     this.options.line.show = v |     this.options.line.show = v | ||||||
|  |     let show = v | ||||||
|  |     let sdkD = get2DView() | ||||||
|  |     if ((!this.showView || this.showView == 3 || !sdkD)) { | ||||||
|  |       show = v | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |       show = false | ||||||
|  |     } | ||||||
|     if (this.line && this.show) { |     if (this.line && this.show) { | ||||||
|       this.line.polyline.material = v ? new Cesium.PolylineDashMaterialProperty({ |       this.line.polyline.material = show ? new Cesium.PolylineDashMaterialProperty({ | ||||||
|         color: new Cesium.Color.fromCssColorString('#00ffff'), |         color: new Cesium.Color.fromCssColorString('#00ffff'), | ||||||
|         dashLength: 20, //短划线长度 |         dashLength: 20, //短划线长度 | ||||||
|       }) : new Cesium.PolylineDashMaterialProperty({ |       }) : new Cesium.PolylineDashMaterialProperty({ | ||||||
| @ -941,6 +976,7 @@ class TrajectoryMotion extends Base { | |||||||
|  |  | ||||||
|   set firstPersonView(v) { |   set firstPersonView(v) { | ||||||
|     // this.state = true |     // this.state = true | ||||||
|  |     let sdkD = get2DView() | ||||||
|     let splitSdk = getSdk() |     let splitSdk = getSdk() | ||||||
|     if (get2DView() || splitSdk.sdkD || !this.show) { |     if (get2DView() || splitSdk.sdkD || !this.show) { | ||||||
|       v = false |       v = false | ||||||
| @ -994,7 +1030,14 @@ class TrajectoryMotion extends Base { | |||||||
|     else { |     else { | ||||||
|       CameraController(this.sdk, true) |       CameraController(this.sdk, true) | ||||||
|       if (this.model && this.modelShow && this.show) { |       if (this.model && this.modelShow && this.show) { | ||||||
|         this.model.show = true |         let show = true | ||||||
|  |         if (this.show && (!this.showView || this.showView == 3 || !sdkD)) { | ||||||
|  |           show = true | ||||||
|  |         } | ||||||
|  |         else { | ||||||
|  |           show = false | ||||||
|  |         } | ||||||
|  |         this.model.show = show | ||||||
|       } |       } | ||||||
|       if (this._DialogObject && this._DialogObject._element.content) { |       if (this._DialogObject && this._DialogObject._element.content) { | ||||||
|         let e_firstPerson = this._DialogObject._element.content.querySelectorAll("button[name='firstPerson']") |         let e_firstPerson = this._DialogObject._element.content.querySelectorAll("button[name='firstPerson']") | ||||||
| @ -1116,8 +1159,16 @@ class TrajectoryMotion extends Base { | |||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|  |     let sdkD = get2DView() | ||||||
|  |     let show = v | ||||||
|  |     if (this.show && (!this.showView || this.showView == 3 || !sdkD)) { | ||||||
|  |       show = v | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |       show = false | ||||||
|  |     } | ||||||
|     if (this.show) { |     if (this.show) { | ||||||
|       this.label && (this.label.show = v) |       this.label && (this.label.show = 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) { | ||||||
| @ -1162,7 +1213,7 @@ class TrajectoryMotion extends Base { | |||||||
|     this.label && (this.label.color = v) |     this.label && (this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -1480,7 +1531,7 @@ class TrajectoryMotion extends Base { | |||||||
|     else { |     else { | ||||||
|       setPosition(startDistance) |       setPosition(startDistance) | ||||||
|       setTimeout(() => { |       setTimeout(() => { | ||||||
|         _this.model.isMove = false |         _this.model && (_this.model.isMove = false) | ||||||
|       }, 500); |       }, 500); | ||||||
|  |  | ||||||
|  |  | ||||||
| @ -1615,9 +1666,10 @@ class TrajectoryMotion extends Base { | |||||||
|         if (!cartesian3) { |         if (!cartesian3) { | ||||||
|           return |           return | ||||||
|         } |         } | ||||||
|         coordinates = _this.cartesian3Towgs84(cartesian3, viewer); |         let pos84 = _this.cartesian3Towgs84(cartesian3, viewer); | ||||||
|  |         coordinates = [pos84.lng, pos84.lat, pos84.alt + 1.8] | ||||||
|         position = cartesian3 |         position = cartesian3 | ||||||
|         positionCamera = Cesium.Cartesian3.fromDegrees(coordinates.lng, coordinates.lat, coordinates.alt + 1.8) |         positionCamera = Cesium.Cartesian3.fromDegrees(coordinates[0], coordinates[1], coordinates[2]) | ||||||
|         let positions_smooth = [] |         let positions_smooth = [] | ||||||
|         for (let i = 0; i <= 1000; i++) { |         for (let i = 0; i <= 1000; i++) { | ||||||
|           if ((i / 1000) > (distance / _this.distance)) { |           if ((i / 1000) > (distance / _this.distance)) { | ||||||
| @ -1740,7 +1792,7 @@ class TrajectoryMotion extends Base { | |||||||
|           else { |           else { | ||||||
|             if (_this.sdk.viewer.trackedEntity) { |             if (_this.sdk.viewer.trackedEntity) { | ||||||
|               _this.sdk.viewer.camera.setView({ |               _this.sdk.viewer.camera.setView({ | ||||||
|                 destination: Cesium.Cartesian3.fromDegrees(coordinates.lng, coordinates.lat, _this.sdk.viewer.camera.positionCartographic.height), |                 destination: Cesium.Cartesian3.fromDegrees(coordinates[0], coordinates[1], _this.sdk.viewer.camera.positionCartographic.height), | ||||||
|                 orientation: { |                 orientation: { | ||||||
|                   heading: Cesium.Math.toRadians(-90), |                   heading: Cesium.Math.toRadians(-90), | ||||||
|                   pitch: 0, |                   pitch: 0, | ||||||
| @ -1888,10 +1940,10 @@ class TrajectoryMotion extends Base { | |||||||
|           this.tip && this.tip.destroy() |           this.tip && this.tip.destroy() | ||||||
|           this.tip = null |           this.tip = null | ||||||
|           this.ControllerObject.destroy() |           this.ControllerObject.destroy() | ||||||
|           if(this.firstPersonView !== this.originalOptions.firstPersonView) { |           if (this.firstPersonView !== this.originalOptions.firstPersonView) { | ||||||
|             this.firstPersonView = this.originalOptions.firstPersonView; |             this.firstPersonView = this.originalOptions.firstPersonView; | ||||||
|           } |           } | ||||||
|           if(this.firstPersonView && this.modelShow) { |           if (this.firstPersonView && this.modelShow) { | ||||||
|             this.model && (this.model.show = false) |             this.model && (this.model.show = false) | ||||||
|           } |           } | ||||||
|         }, |         }, | ||||||
| @ -1917,7 +1969,7 @@ class TrajectoryMotion extends Base { | |||||||
|         this._DialogObject._element.content.getElementsByClassName('model-rotate-btn')[0].className = 'btn model-rotate-btn' |         this._DialogObject._element.content.getElementsByClassName('model-rotate-btn')[0].className = 'btn model-rotate-btn' | ||||||
|       } |       } | ||||||
|  |  | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |         el: contentElm.getElementsByClassName("labelColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -2164,10 +2216,10 @@ class TrajectoryMotion extends Base { | |||||||
|     this.modelAnimate = this.originalOptions.model.animate; |     this.modelAnimate = this.originalOptions.model.animate; | ||||||
|     this.delay = this.originalOptions.delay; |     this.delay = this.originalOptions.delay; | ||||||
|     (this.ground !== this.originalOptions.ground) && (this.ground = this.originalOptions.ground); |     (this.ground !== this.originalOptions.ground) && (this.ground = this.originalOptions.ground); | ||||||
|     if(this.firstPersonView !== this.originalOptions.firstPersonView) { |     if (this.firstPersonView !== this.originalOptions.firstPersonView) { | ||||||
|       this.firstPersonView = this.originalOptions.firstPersonView; |       this.firstPersonView = this.originalOptions.firstPersonView; | ||||||
|     } |     } | ||||||
|     if(this.firstPersonView && this.modelShow) { |     if (this.firstPersonView && this.modelShow) { | ||||||
|       this.model && (this.model.show = false) |       this.model && (this.model.show = false) | ||||||
|     } |     } | ||||||
|     this.labelShow = this.originalOptions.label.show |     this.labelShow = this.originalOptions.label.show | ||||||
| @ -2229,7 +2281,6 @@ class TrajectoryMotion extends Base { | |||||||
|           this._DialogObject._element.content.getElementsByClassName('model-rotate-btn')[0].innerHTML = '结束调整' |           this._DialogObject._element.content.getElementsByClassName('model-rotate-btn')[0].innerHTML = '结束调整' | ||||||
|           this._DialogObject._element.content.getElementsByClassName('model-rotate-btn')[0].className = 'btn model-rotate-btn is-active' |           this._DialogObject._element.content.getElementsByClassName('model-rotate-btn')[0].className = 'btn model-rotate-btn is-active' | ||||||
|         } |         } | ||||||
|         console.log(this._DialogObject._element.content, this._DialogObject._element.content.getElementsByClassName('model-rotate-btn')[0]) |  | ||||||
|         this.state = false |         this.state = false | ||||||
|         this.editObj = new EditGltf(this.sdk, this.model) |         this.editObj = new EditGltf(this.sdk, this.model) | ||||||
|         this.editObj.editRtation() |         this.editObj.editRtation() | ||||||
|  | |||||||
| @ -21,6 +21,7 @@ class eventBinding { | |||||||
|       let Event = [] |       let Event = [] | ||||||
|       let isEvent = false |       let isEvent = false | ||||||
|       let removeName = [] |       let removeName = [] | ||||||
|  |       let blurEvent = ()=>{} | ||||||
|       if (!elements[i] ||!elements[i].attributes) { |       if (!elements[i] ||!elements[i].attributes) { | ||||||
|         continue;  |         continue;  | ||||||
|       } |       } | ||||||
| @ -37,14 +38,14 @@ class eventBinding { | |||||||
|                 let value = e.target.value |                 let value = e.target.value | ||||||
|                 if (e.target.type == 'number') { |                 if (e.target.type == 'number') { | ||||||
|                   if (e.data != '.' && (e.data != '-' || e.target.value)) { |                   if (e.data != '.' && (e.data != '-' || e.target.value)) { | ||||||
|                     value = Number(value) |                     let v = Number(value) | ||||||
|                     if((e.target.max) && value>Number(e.target.max)) { |                     if((e.target.max) && v>Number(e.target.max)) { | ||||||
|                       value = Number(e.target.max) |                       value = Number(e.target.max) | ||||||
|                     } |                     } | ||||||
|                     if((e.target.min) && value<Number(e.target.min)) { |                     if((e.target.min) && v<Number(e.target.min)) { | ||||||
|                       value = Number(e.target.min) |                       value = Number(e.target.min) | ||||||
|                     } |                     } | ||||||
|                     if((e.target.dataset.min) && value<Number(e.target.dataset.min)) { |                     if((e.target.dataset.min) && v<Number(e.target.dataset.min)) { | ||||||
|                       value = Number(e.target.dataset.min) |                       value = Number(e.target.dataset.min) | ||||||
|                     } |                     } | ||||||
|                     that[m.value] = value |                     that[m.value] = value | ||||||
| @ -54,6 +55,22 @@ class eventBinding { | |||||||
|                   that[m.value] = value |                   that[m.value] = value | ||||||
|                 } |                 } | ||||||
|               }) |               }) | ||||||
|  |               blurEvent = (e) => { | ||||||
|  |                 let value = e.target.value | ||||||
|  |                 if ((e.target.type == 'number') && (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 | ||||||
|  |               } | ||||||
|               if(elements[i].nodeName=='IMG') { |               if(elements[i].nodeName=='IMG') { | ||||||
|                 elements[i].src = that[m.value] |                 elements[i].src = that[m.value] | ||||||
|               } |               } | ||||||
| @ -111,6 +128,9 @@ class eventBinding { | |||||||
|             Event[t](e) |             Event[t](e) | ||||||
|           } |           } | ||||||
|         }); |         }); | ||||||
|  |         elements[i].addEventListener('blur', (e) => { | ||||||
|  |           blurEvent(e) | ||||||
|  |         }); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  | |||||||
| @ -142,7 +142,7 @@ class WallRealStereoscopic extends Base { | |||||||
|  |  | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: false,//是否开启透明度 |           alpha: false,//是否开启透明度 | ||||||
| @ -253,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) { |     if (this.show && !this.showView || this.showView == 3) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @ -287,7 +287,7 @@ class WallRealStereoscopic extends Base { | |||||||
|     this.label.color = v |     this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -387,7 +387,7 @@ class WallRealStereoscopic extends Base { | |||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -414,7 +414,7 @@ class WallRealStereoscopic extends Base { | |||||||
|     this.label.backgroundColor = [v, this.label.backgroundColor[1]] |     this.label.backgroundColor = [v, this.label.backgroundColor[1]] | ||||||
|     if (this._elms.labelBackgroundColorStart) { |     if (this._elms.labelBackgroundColorStart) { | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |       this._elms.labelBackgroundColorStart.forEach((item, i) => { | ||||||
|         let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -440,7 +440,7 @@ class WallRealStereoscopic extends Base { | |||||||
|     this.label.backgroundColor = [this.label.backgroundColor[0], v] |     this.label.backgroundColor = [this.label.backgroundColor[0], v] | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -1414,7 +1414,7 @@ class WallRealStereoscopic extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk) |       let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: false,//是否开启透明度 |         alpha: false,//是否开启透明度 | ||||||
| @ -1428,7 +1428,7 @@ class WallRealStereoscopic extends Base { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |         el: contentElm.getElementsByClassName("labelColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1442,7 +1442,7 @@ class WallRealStereoscopic extends Base { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let lineColorPicker = new ewPlugins('colorpicker', { |       let lineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelLineColor")[0], |         el: contentElm.getElementsByClassName("labelLineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1456,7 +1456,7 @@ class WallRealStereoscopic extends Base { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -1470,7 +1470,7 @@ class WallRealStereoscopic extends Base { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         }, |         }, | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
|  | |||||||
| @ -92,7 +92,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.entity.corridor.material = Cesium.Color.fromCssColorString(v) |     this.entity.corridor.material = Cesium.Color.fromCssColorString(v) | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -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) { |     if (this.show && !this.showView || this.showView == 3) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @ -176,7 +176,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.label.color = v |     this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -276,7 +276,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -303,7 +303,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.label.backgroundColor = [v, this.label.backgroundColor[1]] |     this.label.backgroundColor = [v, this.label.backgroundColor[1]] | ||||||
|     if (this._elms.labelBackgroundColorStart) { |     if (this._elms.labelBackgroundColorStart) { | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |       this._elms.labelBackgroundColorStart.forEach((item, i) => { | ||||||
|         let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -329,7 +329,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.label.backgroundColor = [this.label.backgroundColor[0], v] |     this.label.backgroundColor = [this.label.backgroundColor[0], v] | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -627,7 +627,7 @@ class WallStereoscopic extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs('radar-scan-edit-tabs',undefined,this.sdk) |       let tabsElm = new cy_tabs('radar-scan-edit-tabs',undefined,this.sdk) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -641,7 +641,7 @@ class WallStereoscopic extends Base { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |         el: contentElm.getElementsByClassName("labelColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -655,7 +655,7 @@ class WallStereoscopic extends Base { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let lineColorPicker = new ewPlugins('colorpicker', { |       let lineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelLineColor")[0], |         el: contentElm.getElementsByClassName("labelLineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -669,7 +669,7 @@ class WallStereoscopic extends Base { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -683,7 +683,7 @@ class WallStereoscopic extends Base { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         }, |         }, | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
|  | |||||||
| @ -135,7 +135,7 @@ class WallRealStereoscopic extends Base { | |||||||
|  |  | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: false,//是否开启透明度 |           alpha: false,//是否开启透明度 | ||||||
| @ -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) { |     if (this.show && !this.showView || this.showView == 3) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @ -262,7 +262,7 @@ class WallRealStereoscopic extends Base { | |||||||
|     this.label.color = v |     this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -362,7 +362,7 @@ class WallRealStereoscopic extends Base { | |||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -389,7 +389,7 @@ class WallRealStereoscopic extends Base { | |||||||
|     this.label.backgroundColor = [v, this.label.backgroundColor[1]] |     this.label.backgroundColor = [v, this.label.backgroundColor[1]] | ||||||
|     if (this._elms.labelBackgroundColorStart) { |     if (this._elms.labelBackgroundColorStart) { | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |       this._elms.labelBackgroundColorStart.forEach((item, i) => { | ||||||
|         let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -415,7 +415,7 @@ class WallRealStereoscopic extends Base { | |||||||
|     this.label.backgroundColor = [this.label.backgroundColor[0], v] |     this.label.backgroundColor = [this.label.backgroundColor[0], v] | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -1363,7 +1363,7 @@ class WallRealStereoscopic extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk) |       let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: false,//是否开启透明度 |         alpha: false,//是否开启透明度 | ||||||
| @ -1377,7 +1377,7 @@ class WallRealStereoscopic extends Base { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |         el: contentElm.getElementsByClassName("labelColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1391,7 +1391,7 @@ class WallRealStereoscopic extends Base { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let lineColorPicker = new ewPlugins('colorpicker', { |       let lineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelLineColor")[0], |         el: contentElm.getElementsByClassName("labelLineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -1405,7 +1405,7 @@ class WallRealStereoscopic extends Base { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -1419,7 +1419,7 @@ class WallRealStereoscopic extends Base { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         }, |         }, | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
|  | |||||||
| @ -92,7 +92,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.entity.corridor.material = Cesium.Color.fromCssColorString(v) |     this.entity.corridor.material = Cesium.Color.fromCssColorString(v) | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -176,7 +176,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.label.color = v |     this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -276,7 +276,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -303,7 +303,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.label.backgroundColor = [v, this.label.backgroundColor[1]] |     this.label.backgroundColor = [v, this.label.backgroundColor[1]] | ||||||
|     if (this._elms.labelBackgroundColorStart) { |     if (this._elms.labelBackgroundColorStart) { | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |       this._elms.labelBackgroundColorStart.forEach((item, i) => { | ||||||
|         let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -329,7 +329,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.label.backgroundColor = [this.label.backgroundColor[0], v] |     this.label.backgroundColor = [this.label.backgroundColor[0], v] | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -627,7 +627,7 @@ class WallStereoscopic extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs('radar-scan-edit-tabs',undefined,this.sdk) |       let tabsElm = new cy_tabs('radar-scan-edit-tabs',undefined,this.sdk) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -641,7 +641,7 @@ class WallStereoscopic extends Base { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |         el: contentElm.getElementsByClassName("labelColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -655,7 +655,7 @@ class WallStereoscopic extends Base { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let lineColorPicker = new ewPlugins('colorpicker', { |       let lineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelLineColor")[0], |         el: contentElm.getElementsByClassName("labelLineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -669,7 +669,7 @@ class WallStereoscopic extends Base { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -683,7 +683,7 @@ class WallStereoscopic extends Base { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         }, |         }, | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
|  | |||||||
| @ -21,7 +21,8 @@ class eventBinding { | |||||||
|       let Event = [] |       let Event = [] | ||||||
|       let isEvent = false |       let isEvent = false | ||||||
|       let removeName = [] |       let removeName = [] | ||||||
|       if (!elements[i] ||!elements[i].attributes) { |       let blurEvent = () => { } | ||||||
|  |       if (!elements[i] || !elements[i].attributes) { | ||||||
|         continue; |         continue; | ||||||
|       } |       } | ||||||
|       for (let m of elements[i].attributes) { |       for (let m of elements[i].attributes) { | ||||||
| @ -37,11 +38,11 @@ class eventBinding { | |||||||
|                 let value = e.target.value |                 let value = e.target.value | ||||||
|                 if (e.target.type == 'number') { |                 if (e.target.type == 'number') { | ||||||
|                   if (e.data != '.' && (e.data != '-' || e.target.value)) { |                   if (e.data != '.' && (e.data != '-' || e.target.value)) { | ||||||
|                     value = Number(value) |                     let v = Number(value) | ||||||
|                     if((e.target.max) && value>Number(e.target.max)) { |                     if ((e.target.max) && v > Number(e.target.max)) { | ||||||
|                       value = Number(e.target.max) |                       value = Number(e.target.max) | ||||||
|                     } |                     } | ||||||
|                     if((e.target.min) && value<Number(e.target.min)) { |                     if ((e.target.min) && v < Number(e.target.min)) { | ||||||
|                       value = Number(e.target.min) |                       value = Number(e.target.min) | ||||||
|                     } |                     } | ||||||
|                     that[m.value] = value |                     that[m.value] = value | ||||||
| @ -51,14 +52,32 @@ class eventBinding { | |||||||
|                   that[m.value] = value |                   that[m.value] = value | ||||||
|                 } |                 } | ||||||
|               }) |               }) | ||||||
|               if(elements[i].nodeName=='IMG') { |               blurEvent = (e) => { | ||||||
|  |                 let value = e.target.value | ||||||
|  |                 if ((e.target.type == 'number') && (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 | ||||||
|  |               } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |               if (elements[i].nodeName == 'IMG') { | ||||||
|                 elements[i].src = that[m.value] |                 elements[i].src = that[m.value] | ||||||
|               } |               } | ||||||
|               else { |               else { | ||||||
|                 elements[i].value = that[m.value] |                 elements[i].value = that[m.value] | ||||||
|               } |               } | ||||||
|             } |             } | ||||||
|             if(this.element[m.value]) { |             if (this.element[m.value]) { | ||||||
|               this.element[m.value].push(elements[i]) |               this.element[m.value].push(elements[i]) | ||||||
|             } |             } | ||||||
|             else { |             else { | ||||||
| @ -81,7 +100,7 @@ class eventBinding { | |||||||
|             isEvent = true |             isEvent = true | ||||||
|             Event.push((e) => { |             Event.push((e) => { | ||||||
|               let value = e.target.value |               let value = e.target.value | ||||||
|               if(e.target.type == 'number' && value!='') { |               if (e.target.type == 'number' && value != '') { | ||||||
|                 value = Number(value) |                 value = Number(value) | ||||||
|                 e.target.value = value |                 e.target.value = value | ||||||
|               } |               } | ||||||
| @ -94,7 +113,7 @@ class eventBinding { | |||||||
|         } |         } | ||||||
|         // elements[i].attributes[m] = undefined |         // elements[i].attributes[m] = undefined | ||||||
|       } |       } | ||||||
|       for(let n=0;n<removeName.length;n++) { |       for (let n = 0; n < removeName.length; n++) { | ||||||
|         elements[i].attributes.removeNamedItem(removeName[n]) |         elements[i].attributes.removeNamedItem(removeName[n]) | ||||||
|       } |       } | ||||||
|  |  | ||||||
| @ -108,6 +127,9 @@ class eventBinding { | |||||||
|             Event[t](e) |             Event[t](e) | ||||||
|           } |           } | ||||||
|         }); |         }); | ||||||
|  |         elements[i].addEventListener('blur', (e) => { | ||||||
|  |           blurEvent(e) | ||||||
|  |         }); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  | |||||||
| @ -88,6 +88,10 @@ 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, { | ||||||
| @ -117,7 +121,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.entity.polylineVolume.material = this.getMaterial() |     this.entity.polylineVolume.material = this.getMaterial() | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -191,7 +195,7 @@ class WallStereoscopic extends Base { | |||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show) { |     if (this.show && !this.showView || this.showView == 3) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @ -225,7 +229,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.label.color = v |     this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -325,7 +329,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -352,7 +356,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.label.backgroundColor = [v, this.label.backgroundColor[1]] |     this.label.backgroundColor = [v, this.label.backgroundColor[1]] | ||||||
|     if (this._elms.labelBackgroundColorStart) { |     if (this._elms.labelBackgroundColorStart) { | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |       this._elms.labelBackgroundColorStart.forEach((item, i) => { | ||||||
|         let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -378,7 +382,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.label.backgroundColor = [this.label.backgroundColor[0], v] |     this.label.backgroundColor = [this.label.backgroundColor[0], v] | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -900,7 +904,7 @@ class WallStereoscopic extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk) |       let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -914,7 +918,7 @@ class WallStereoscopic extends Base { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |         el: contentElm.getElementsByClassName("labelColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -928,7 +932,7 @@ class WallStereoscopic extends Base { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let lineColorPicker = new ewPlugins('colorpicker', { |       let lineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelLineColor")[0], |         el: contentElm.getElementsByClassName("labelLineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -942,7 +946,7 @@ class WallStereoscopic extends Base { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -956,7 +960,7 @@ class WallStereoscopic extends Base { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         }, |         }, | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
|  | |||||||
| @ -92,7 +92,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.entity.corridor.material = Cesium.Color.fromCssColorString(v) |     this.entity.corridor.material = Cesium.Color.fromCssColorString(v) | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -176,7 +176,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.label.color = v |     this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -276,7 +276,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -303,7 +303,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.label.backgroundColor = [v, this.label.backgroundColor[1]] |     this.label.backgroundColor = [v, this.label.backgroundColor[1]] | ||||||
|     if (this._elms.labelBackgroundColorStart) { |     if (this._elms.labelBackgroundColorStart) { | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |       this._elms.labelBackgroundColorStart.forEach((item, i) => { | ||||||
|         let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -329,7 +329,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.label.backgroundColor = [this.label.backgroundColor[0], v] |     this.label.backgroundColor = [this.label.backgroundColor[0], v] | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -633,7 +633,7 @@ class WallStereoscopic extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs('radar-scan-edit-tabs',undefined,this.sdk) |       let tabsElm = new cy_tabs('radar-scan-edit-tabs',undefined,this.sdk) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -647,7 +647,7 @@ class WallStereoscopic extends Base { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |         el: contentElm.getElementsByClassName("labelColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -661,7 +661,7 @@ class WallStereoscopic extends Base { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let lineColorPicker = new ewPlugins('colorpicker', { |       let lineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelLineColor")[0], |         el: contentElm.getElementsByClassName("labelLineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -675,7 +675,7 @@ class WallStereoscopic extends Base { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -689,7 +689,7 @@ class WallStereoscopic extends Base { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         }, |         }, | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
|  | |||||||
| @ -112,7 +112,7 @@ class WallStereoscopic2 extends Base { | |||||||
|     this.entity.polylineVolume.material = this.getMaterial() |     this.entity.polylineVolume.material = this.getMaterial() | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -195,7 +195,7 @@ class WallStereoscopic2 extends Base { | |||||||
|     this.label.color = v |     this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -295,7 +295,7 @@ class WallStereoscopic2 extends Base { | |||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -322,7 +322,7 @@ class WallStereoscopic2 extends Base { | |||||||
|     this.label.backgroundColor = [v, this.label.backgroundColor[1]] |     this.label.backgroundColor = [v, this.label.backgroundColor[1]] | ||||||
|     if (this._elms.labelBackgroundColorStart) { |     if (this._elms.labelBackgroundColorStart) { | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |       this._elms.labelBackgroundColorStart.forEach((item, i) => { | ||||||
|         let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -348,7 +348,7 @@ class WallStereoscopic2 extends Base { | |||||||
|     this.label.backgroundColor = [this.label.backgroundColor[0], v] |     this.label.backgroundColor = [this.label.backgroundColor[0], v] | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -889,7 +889,7 @@ class WallStereoscopic2 extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk) |       let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -903,7 +903,7 @@ class WallStereoscopic2 extends Base { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |         el: contentElm.getElementsByClassName("labelColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -917,7 +917,7 @@ class WallStereoscopic2 extends Base { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let lineColorPicker = new ewPlugins('colorpicker', { |       let lineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelLineColor")[0], |         el: contentElm.getElementsByClassName("labelLineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -931,7 +931,7 @@ class WallStereoscopic2 extends Base { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -945,7 +945,7 @@ class WallStereoscopic2 extends Base { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         }, |         }, | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
|  | |||||||
| @ -92,7 +92,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.entity.corridor.material = Cesium.Color.fromCssColorString(v) |     this.entity.corridor.material = Cesium.Color.fromCssColorString(v) | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let colorPicker = new ewPlugins('colorpicker', { |         let colorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -176,7 +176,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.label.color = v |     this.label.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 ewPlugins('colorpicker', { |         let labelColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -276,7 +276,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.label.lineColor = v |     this.label.lineColor = v | ||||||
|     if (this._elms.labelLineColor) { |     if (this._elms.labelLineColor) { | ||||||
|       this._elms.labelLineColor.forEach((item, i) => { |       this._elms.labelLineColor.forEach((item, i) => { | ||||||
|         let lineColorPicker = new ewPlugins('colorpicker', { |         let lineColorPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -303,7 +303,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.label.backgroundColor = [v, this.label.backgroundColor[1]] |     this.label.backgroundColor = [v, this.label.backgroundColor[1]] | ||||||
|     if (this._elms.labelBackgroundColorStart) { |     if (this._elms.labelBackgroundColorStart) { | ||||||
|       this._elms.labelBackgroundColorStart.forEach((item, i) => { |       this._elms.labelBackgroundColorStart.forEach((item, i) => { | ||||||
|         let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -329,7 +329,7 @@ class WallStereoscopic extends Base { | |||||||
|     this.label.backgroundColor = [this.label.backgroundColor[0], v] |     this.label.backgroundColor = [this.label.backgroundColor[0], v] | ||||||
|     if (this._elms.labelBackgroundColorEnd) { |     if (this._elms.labelBackgroundColorEnd) { | ||||||
|       this._elms.labelBackgroundColorEnd.forEach((item, i) => { |       this._elms.labelBackgroundColorEnd.forEach((item, i) => { | ||||||
|         let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |         let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -627,7 +627,7 @@ class WallStereoscopic extends Base { | |||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
|       let tabsElm = new cy_tabs('radar-scan-edit-tabs',undefined,this.sdk) |       let tabsElm = new cy_tabs('radar-scan-edit-tabs',undefined,this.sdk) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let colorPicker = new ewPlugins('colorpicker', { |       let colorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("color")[0], |         el: contentElm.getElementsByClassName("color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -641,7 +641,7 @@ class WallStereoscopic extends Base { | |||||||
|           this.color = 'rgba(255,255,255,1)' |           this.color = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelColorPicker = new ewPlugins('colorpicker', { |       let labelColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelColor")[0], |         el: contentElm.getElementsByClassName("labelColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -655,7 +655,7 @@ class WallStereoscopic extends Base { | |||||||
|           this.labelColor = 'rgba(255,255,255,1)' |           this.labelColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let lineColorPicker = new ewPlugins('colorpicker', { |       let lineColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelLineColor")[0], |         el: contentElm.getElementsByClassName("labelLineColor")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
| @ -669,7 +669,7 @@ class WallStereoscopic extends Base { | |||||||
|           this.labelLineColor = 'rgba(255,255,255,1)' |           this.labelLineColor = 'rgba(255,255,255,1)' | ||||||
|         },//点击清空按钮事件回调 |         },//点击清空按钮事件回调 | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorStartPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
| @ -683,7 +683,7 @@ class WallStereoscopic extends Base { | |||||||
|           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' |           this.labelBackgroundColorStart = 'rgba(255,255,255,1)' | ||||||
|         }, |         }, | ||||||
|       }) |       }) | ||||||
|       let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', { |       let labelBackgroundColorEndPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], |         el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0], | ||||||
|         size: 'mini', |         size: 'mini', | ||||||
|         alpha: true, |         alpha: true, | ||||||
|  | |||||||
| @ -35,7 +35,8 @@ class eventBinding { | |||||||
|             else { |             else { | ||||||
|               Event.push((e) => { |               Event.push((e) => { | ||||||
|                 let value = e.target.value |                 let value = e.target.value | ||||||
|                 if (e.target.type == 'number') { |                 let str = e.target.value + '' | ||||||
|  |                 if (e.target.type == 'number' && !(str.charAt(str.length - 1) == '0' && e.target.value.toString().includes('.'))) { | ||||||
|                   value = Number(value) |                   value = Number(value) | ||||||
|                 } |                 } | ||||||
|                 that[m.value] = value |                 that[m.value] = value | ||||||
|  | |||||||
| @ -105,7 +105,7 @@ class WaterSurface extends Base { | |||||||
|     this.entity && (this.entity.appearance.material.uniforms.baseWaterColor = Cesium.Color.fromCssColorString(v)) |     this.entity && (this.entity.appearance.material.uniforms.baseWaterColor = Cesium.Color.fromCssColorString(v)) | ||||||
|     if (this._elms.color) { |     if (this._elms.color) { | ||||||
|       this._elms.color.forEach((item, i) => { |       this._elms.color.forEach((item, i) => { | ||||||
|         let picker = new ewPlugins('colorpicker', { |         let picker = new YJColorPicker({ | ||||||
|           el: item.el, |           el: item.el, | ||||||
|           size: 'mini',//颜色box类型 |           size: 'mini',//颜色box类型 | ||||||
|           alpha: true,//是否开启透明度 |           alpha: true,//是否开启透明度 | ||||||
| @ -232,7 +232,7 @@ class WaterSurface extends Base { | |||||||
|       contentElm.innerHTML = html() |       contentElm.innerHTML = html() | ||||||
|       this._DialogObject.contentAppChild(contentElm) |       this._DialogObject.contentAppChild(contentElm) | ||||||
|       // 颜色组件 |       // 颜色组件 | ||||||
|       let waterColorPicker = new ewPlugins('colorpicker', { |       let waterColorPicker = new YJColorPicker({ | ||||||
|         el: contentElm.getElementsByClassName("water-color")[0], |         el: contentElm.getElementsByClassName("water-color")[0], | ||||||
|         size: 'mini',//颜色box类型 |         size: 'mini',//颜色box类型 | ||||||
|         alpha: true,//是否开启透明度 |         alpha: true,//是否开启透明度 | ||||||
|  | |||||||
| @ -9,11 +9,14 @@ 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 } 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' | ||||||
|  |  | ||||||
| class Base extends Tools { | class Base extends Tools { | ||||||
|  |   #_showView | ||||||
|  |   #_isShowView | ||||||
|   constructor(sdk, options = {}) { |   constructor(sdk, options = {}) { | ||||||
|     super(sdk, options); |     super(sdk, options); | ||||||
|     if (!sdk || !sdk.viewer) { |     if (!sdk || !sdk.viewer) { | ||||||
| @ -29,6 +32,7 @@ class Base extends Tools { | |||||||
|     this.rightClickCallBack = null |     this.rightClickCallBack = null | ||||||
|     this.picking = true |     this.picking = true | ||||||
|     this.options.host = this.options.host || getHost() |     this.options.host = this.options.host || getHost() | ||||||
|  |     // this.#_showView = this.options.showView || 0 | ||||||
|     this.setDefaultValue() |     this.setDefaultValue() | ||||||
|  |  | ||||||
|     // this.sdk.addIncetance(this.options.id, this) |     // this.sdk.addIncetance(this.options.id, this) | ||||||
| @ -55,6 +59,60 @@ class Base extends Tools { | |||||||
|   //   setSplitDirection(this._splitDirection, this.options.id) |   //   setSplitDirection(this._splitDirection, this.options.id) | ||||||
|   // } |   // } | ||||||
|  |  | ||||||
|  |   get showView() { | ||||||
|  |     return this.#_showView | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   set showView(v) { | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     let sdk2D = get2DSdk().sdkD | ||||||
|  |     if (!sdk2D) { | ||||||
|  |       this.#_showView = v | ||||||
|  |       if (this.entity) { | ||||||
|  |         this.entity._showView = v | ||||||
|  |       } | ||||||
|  |       return | ||||||
|  |     } | ||||||
|  |     if (this.sdk === sdk2D) { | ||||||
|  |       this.#_showView = 0 | ||||||
|  |       return | ||||||
|  |     } | ||||||
|  |     if (!this.#_showView && !this.show) { | ||||||
|  |       return | ||||||
|  |     } | ||||||
|  |     if (this.sdk === sdk2D) { | ||||||
|  |       this.#_showView = 0 | ||||||
|  |       return | ||||||
|  |     } | ||||||
|  |     if (v != 2 && v != 3) { | ||||||
|  |       this.#_showView = 0 | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |       this.#_showView = v | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     this.isShowView = true | ||||||
|  |  | ||||||
|  |     // if(!this.show) { | ||||||
|  |     //   return | ||||||
|  |     // } | ||||||
|  |  | ||||||
|  |     if (!this.#_showView) { | ||||||
|  |       this.show = true | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |       if (v == 2) { | ||||||
|  |         this.show = false | ||||||
|  |       } | ||||||
|  |       else { | ||||||
|  |         this.show = true | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|   get name() { |   get name() { | ||||||
|     return this.options.name |     return this.options.name | ||||||
|   } |   } | ||||||
| @ -72,19 +130,60 @@ class Base extends Tools { | |||||||
|  |  | ||||||
|   set show(v) { |   set show(v) { | ||||||
|     if (typeof v === "boolean") { |     if (typeof v === "boolean") { | ||||||
|       this.options.show = v |       let sdkD = get2DSdk().sdkD | ||||||
|       if (this.originalOptions) { |       if (!this.isShowView || !sdkD) { | ||||||
|         this.originalOptions.show = v |         this.options.show = v | ||||||
|  |         if (this.originalOptions) { | ||||||
|  |           this.originalOptions.show = v | ||||||
|  |         } | ||||||
|       } |       } | ||||||
|       this.entity && (this.entity.show = v) |       this.entity._showView = this.showView | ||||||
|  |       if (this.type == 'layer') { | ||||||
|  |         if (this.entity) { | ||||||
|  |           this.entity._objectState = this.options.show | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |       if (!this.showView || this.showView == 3 || !sdkD) { | ||||||
|  |         this.entity && (this.entity.show = this.options.show) | ||||||
|  |         if (this.options.label && this.options.label.show && this.label) { | ||||||
|  |           this.label.show = this.options.show | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |       else { | ||||||
|  |         this.entity && (this.entity.show = false) | ||||||
|  |         if (this.options.label && this.options.label.show && this.label) { | ||||||
|  |           this.label.show = false | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |  | ||||||
|       if (this._DialogObject && this._DialogObject.showBtn) { |       if (this._DialogObject && this._DialogObject.showBtn) { | ||||||
|         this._DialogObject.showBtn.checked = v |         this._DialogObject.showBtn.checked = this.options.show | ||||||
|       } |  | ||||||
|       if (this.options.label && this.options.label.show && this.label) { |  | ||||||
|         this.label.show = v |  | ||||||
|       } |       } | ||||||
|  |  | ||||||
|  |  | ||||||
|       syncData(this.sdk, this.options.id) |       syncData(this.sdk, this.options.id) | ||||||
|       syncSplitData(this.sdk, this.options.id) |       syncSplitData(this.sdk, this.options.id) | ||||||
|  |       this.isShowView = false | ||||||
|  |  | ||||||
|  |       if (this.type == 'layer' && sdkD) { | ||||||
|  |         let layer2d = sdkD.viewer.imageryLayers._layers[this.layerIndex] | ||||||
|  |         let layer3d = this.entity | ||||||
|  |  | ||||||
|  |         if (!layer2d) { | ||||||
|  |           return | ||||||
|  |         } | ||||||
|  |         if (layer3d._objectState) { | ||||||
|  |           if (!layer3d._showView || layer3d._showView == 2) { | ||||||
|  |             layer2d.show = true | ||||||
|  |           } | ||||||
|  |           if (layer3d._showView == 3) { | ||||||
|  |             layer2d.show = false | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |         else { | ||||||
|  |           layer2d.show = this.options.show | ||||||
|  |         } | ||||||
|  |       } | ||||||
|     } else { |     } else { | ||||||
|       console.error("参数必须为boolean") |       console.error("参数必须为boolean") | ||||||
|     } |     } | ||||||
| @ -192,7 +291,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) { |       if (this.options.position && Object.prototype.toString.call(this.options.position) === '[object Object]') { | ||||||
|         position = { ...this.options.position } |         position = { ...this.options.position } | ||||||
|       } |       } | ||||||
|       else if (this.options.positions) { |       else if (this.options.positions) { | ||||||
| @ -263,12 +362,17 @@ class Base extends Tools { | |||||||
|       console.error('val:', val, '不是一个function') |       console.error('val:', val, '不是一个function') | ||||||
|     } else { |     } else { | ||||||
|       let sdkD = getSdk().sdkD |       let sdkD = getSdk().sdkD | ||||||
|       if(sdkD && this.sdk === sdkD) { |       let sdk2D = get2DSdk().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 { |       else if (sdk2D && this.sdk === sdk2D) { | ||||||
|  |         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) | ||||||
|         } |         } | ||||||
| @ -286,12 +390,17 @@ class Base extends Tools { | |||||||
|       console.error('val:', val, '不是一个function') |       console.error('val:', val, '不是一个function') | ||||||
|     } else { |     } else { | ||||||
|       let sdkD = getSdk().sdkD |       let sdkD = getSdk().sdkD | ||||||
|       if(sdkD && this.sdk === sdkD) { |       let sdk2D = get2DSdk().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 { |       else if (sdk2D && this.sdk === sdk2D) { | ||||||
|  |         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) | ||||||
|         } |         } | ||||||
| @ -309,12 +418,17 @@ class Base extends Tools { | |||||||
|       console.error('val:', val, '不是一个function') |       console.error('val:', val, '不是一个function') | ||||||
|     } else { |     } else { | ||||||
|       let sdkD = getSdk().sdkD |       let sdkD = getSdk().sdkD | ||||||
|       if(sdkD && this.sdk === sdkD) { |       let sdk2D = get2DSdk().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 { |       else if (sdk2D && this.sdk === sdk2D) { | ||||||
|  |         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) | ||||||
|         } |         } | ||||||
| @ -338,7 +452,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) { |       if (this.options.position && Object.prototype.toString.call(this.options.position) === '[object Object]') { | ||||||
|         position = { ...this.options.position } |         position = { ...this.options.position } | ||||||
|       } |       } | ||||||
|       else if (this.options.positions) { |       else if (this.options.positions) { | ||||||
|  | |||||||
| @ -45,8 +45,14 @@ class EventBinding { | |||||||
|                     let value = e.target.value |                     let value = e.target.value | ||||||
|                     value = Number(value) |                     value = Number(value) | ||||||
|                     if (e.data != '.' && (e.data != '-' || e.target.value)) { |                     if (e.data != '.' && (e.data != '-' || e.target.value)) { | ||||||
|                       if (((!e.target.max) && (!e.target.min)) || ((value <= Number(e.target.max)) && value >= Number(e.target.min))) { |                       if ((e.target.max) && value > Number(e.target.max)) { | ||||||
|                         that[m.value] = value |                         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) | ||||||
|                       } |                       } | ||||||
|                     } |                     } | ||||||
|                   } |                   } | ||||||
| @ -61,7 +67,7 @@ class EventBinding { | |||||||
|                     if ((e.target.min) && value < Number(e.target.min)) { |                     if ((e.target.min) && value < Number(e.target.min)) { | ||||||
|                       value = Number(e.target.min) |                       value = Number(e.target.min) | ||||||
|                     } |                     } | ||||||
|                     if((e.target.dataset.min) && value<Number(e.target.dataset.min)) { |                     if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) { | ||||||
|                       value = Number(e.target.dataset.min) |                       value = Number(e.target.dataset.min) | ||||||
|                     } |                     } | ||||||
|                   } |                   } | ||||||
|  | |||||||
| @ -2,13 +2,10 @@ import BaseDialog from '../../../BaseDialog'; | |||||||
|  |  | ||||||
| class Dialog extends BaseDialog { | class Dialog extends BaseDialog { | ||||||
|   constructor(sdk, info, options, only) { |   constructor(sdk, info, options, only) { | ||||||
|     super(sdk.viewer._container, options); |     super(sdk.viewer._container, options, only); | ||||||
|     this.sdk = sdk |     this.sdk = sdk | ||||||
|     this.viewer = sdk.viewer |     this.viewer = sdk.viewer | ||||||
|     this.info = info |     this.info = info | ||||||
|     if (only) { |  | ||||||
|       this.closeAll() |  | ||||||
|     } |  | ||||||
|     this._init() |     this._init() | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @ -81,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,76 +1,86 @@ | |||||||
| class cy_tabs { | class cy_tabs { | ||||||
|     constructor(id, clickTabCallBack, sdk) { |   constructor(boxElm, clickTabCallBack, sdk) { | ||||||
|         let elm = document.getElementById(id); |     let elm | ||||||
|         let pane = elm.getElementsByTagName('DIV-cy-tab-pane') |     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 tabTop = `<div class="DIV-cy-tab-top">` |     let tabTop = `<div class="DIV-cy-tab-top">` | ||||||
|         let tabContent = `<div class="DIV-cy-tab-content">` |     let tabContent = `<div class="DIV-cy-tab-content">` | ||||||
|         let tabindex = 0 |     let tabindex = 0 | ||||||
|         for (let i = 0; i < pane.length; i++) { |     for (let i = 0; i < pane.length; i++) { | ||||||
|             let flag = false |       let flag = false | ||||||
|             if (sdk && sdk.tabHide && Array.isArray(sdk.tabHide)) { |       if (sdk && sdk.tabHide && Array.isArray(sdk.tabHide)) { | ||||||
|                 for (let m = 0; m < sdk.tabHide.length; m++) { |         for (let m = 0; m < sdk.tabHide.length; m++) { | ||||||
|                     if (pane[i].getAttribute('label') === sdk.tabHide[m]) { |           if (pane[i].getAttribute('label') === sdk.tabHide[m]) { | ||||||
|                         flag = true |             flag = true | ||||||
|                         break |             break | ||||||
|                     } |           } | ||||||
|                 } |         } | ||||||
|             } |       } | ||||||
|             if (flag) { |       if (flag) { | ||||||
|                 continue |         continue | ||||||
|             } |       } | ||||||
|             let style = 'display: none;' |       let style = 'display: none;' | ||||||
|             let active = '' |       let active = '' | ||||||
|             if (tabindex == 0) { |       if (tabindex == 0) { | ||||||
|                 style = '' |         style = '' | ||||||
|                 active = 'is-active' |         active = 'is-active' | ||||||
|             } |       } | ||||||
|             tabTop = tabTop + ` |       tabTop = tabTop + ` | ||||||
|             <div class="DIV-cy-tab-pane-title"> |             <div class="DIV-cy-tab-pane-title"> | ||||||
|                 <div class="DIV-cy-tab-pane-title-p `+ active + `" tabindex="` + tabindex + `"><span>` + pane[i].getAttribute('label') + `</span></div> |                 <div class="DIV-cy-tab-pane-title-p `+ active + `" tabindex="` + tabindex + `"><span>` + pane[i].getAttribute('label') + `</span></div> | ||||||
|             </div> |             </div> | ||||||
|             ` |             ` | ||||||
|             tabContent = tabContent + `<div class="DIV-cy-tab-content-pane ${pane[i].className}" style="` + style + `">` + pane[i].innerHTML + `</div>` |       tabContent = tabContent + `<div class="DIV-cy-tab-content-pane ${pane[i].className}" style="` + style + `">` + pane[i].innerHTML + `</div>` | ||||||
|             tabindex++ |       tabindex++ | ||||||
|  |     } | ||||||
|  |     tabTop = tabTop + `</div>` | ||||||
|  |     tabContent = tabContent + `</div>` | ||||||
|  |  | ||||||
|  |     let BoxElm = document.createElement('div'); | ||||||
|  |     if(typeof boxElm === 'string') { | ||||||
|  |       BoxElm.setAttribute('id', boxElm) | ||||||
|  |     } | ||||||
|  |     BoxElm.setAttribute('class', 'DIV-cy-tabs') | ||||||
|  |     BoxElm.innerHTML = tabTop + tabContent | ||||||
|  |     elm.parentNode.insertBefore(BoxElm, elm); | ||||||
|  |     elm.parentNode.removeChild(elm); | ||||||
|  |  | ||||||
|  |     // 点击事件 | ||||||
|  |     let tabs = BoxElm.getElementsByClassName('DIV-cy-tab-pane-title-p') | ||||||
|  |     for (let i = 0; i < tabs.length; i++) { | ||||||
|  |       tabs[i].addEventListener('click', (e) => { | ||||||
|  |         let tabindex = e.target.getAttribute('tabindex') | ||||||
|  |         let contentElm = BoxElm.getElementsByClassName('DIV-cy-tab-content-pane') | ||||||
|  |         clickTabCallBack && clickTabCallBack(tabindex) | ||||||
|  |         for (let i = 0; i < contentElm.length; i++) { | ||||||
|  |           if (i === parseInt(tabindex)) { | ||||||
|  |             contentElm[i].style.display = '' | ||||||
|  |             tabs[i].className = 'DIV-cy-tab-pane-title-p is-active' | ||||||
|  |           } | ||||||
|  |           else { | ||||||
|  |             contentElm[i].style.display = 'none' | ||||||
|  |             tabs[i].className = 'DIV-cy-tab-pane-title-p' | ||||||
|  |           } | ||||||
|         } |         } | ||||||
|         tabTop = tabTop + `</div>` |         contentElm[parseInt(tabindex)].style.display = '' | ||||||
|         tabContent = tabContent + `</div>` |       }) | ||||||
|  |  | ||||||
|         let BoxElm = document.createElement('div'); |  | ||||||
|         BoxElm.setAttribute('id', id) |  | ||||||
|         BoxElm.setAttribute('class', 'DIV-cy-tabs') |  | ||||||
|         BoxElm.innerHTML = tabTop + tabContent |  | ||||||
|         elm.parentNode.insertBefore(BoxElm, elm); |  | ||||||
|         elm.parentNode.removeChild(elm); |  | ||||||
|  |  | ||||||
|         // 点击事件 |  | ||||||
|         let tabs = BoxElm.getElementsByClassName('DIV-cy-tab-pane-title-p') |  | ||||||
|         for (let i = 0; i < tabs.length; i++) { |  | ||||||
|             tabs[i].addEventListener('click', (e) => { |  | ||||||
|                 let tabindex = e.target.getAttribute('tabindex') |  | ||||||
|                 let contentElm = BoxElm.getElementsByClassName('DIV-cy-tab-content-pane') |  | ||||||
|                 for (let i = 0; i < contentElm.length; i++) { |  | ||||||
|                     if (i === parseInt(tabindex)) { |  | ||||||
|                         contentElm[i].style.display = '' |  | ||||||
|                         tabs[i].className = 'DIV-cy-tab-pane-title-p is-active' |  | ||||||
|                     } |  | ||||||
|                     else { |  | ||||||
|                         contentElm[i].style.display = 'none' |  | ||||||
|                         tabs[i].className = 'DIV-cy-tab-pane-title-p' |  | ||||||
|                     } |  | ||||||
|                 } |  | ||||||
|                 contentElm[parseInt(tabindex)].style.display = '' |  | ||||||
|             }) |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         this.clickTabCallBack = clickTabCallBack |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     clickTabCallBack() { |     this.clickTabCallBack = clickTabCallBack | ||||||
|         if (this.clickTabCallBack) { |   } | ||||||
|             this.clickTabCallBack() |  | ||||||
|         } |   clickTabCallBack() { | ||||||
|  |     if (this.clickTabCallBack) { | ||||||
|  |       this.clickTabCallBack() | ||||||
|     } |     } | ||||||
|  |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| export default cy_tabs | export default cy_tabs | ||||||
| @ -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 | ||||||
|           //   // 最后插入图片 |             // 最后插入图片 | ||||||
|           //   console.log(file, insertFn) |             let url = await _this.upload(file) | ||||||
|           //   insertFn(url, file.name) |             insertFn((_this.host = _this.host || getHost()) + '/' + url) | ||||||
|           // } |           } | ||||||
|         }, |         }, | ||||||
|         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'], | ||||||
|           // 自定义上传 |           // 自定义上传 | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| let list = ['icon-py', 'icon-edit', 'icon-add', 'icon-add2', 'icon-minus', 'icon-play', 'icon-pause', 'icon-updateheight', 'icon-draw', 'icon-positions', 'icon-reset', 'icon-xj', 'icon-yj', 'icon-zj', 'icon-close', 'icon-query', 'icon-route', 'icon-copy', 'icon-load', 'icon-rubric', 'icon-pen', 'icon-cross'] | let list = ['icon-py', 'icon-edit', 'icon-add', 'icon-add2', 'icon-minus', 'icon-play', 'icon-pause', 'icon-updateheight', 'icon-draw', 'icon-positions', 'icon-reset', 'icon-xj', 'icon-yj', 'icon-zj', 'icon-close', 'icon-query', 'icon-route', 'icon-copy', 'icon-load', 'icon-rubric', 'icon-pen', 'icon-cross', 'icom-confirm'] | ||||||
| function setSvg() { | function setSvg() { | ||||||
|   let svgElm = document.createElement('svg'); |   let svgElm = document.createElement('svg'); | ||||||
|   svgElm.xmlns = 'http://www.w3.org/2000/svg' |   svgElm.xmlns = 'http://www.w3.org/2000/svg' | ||||||
|  | |||||||
| @ -1,95 +1,277 @@ | |||||||
| class YJColorPicker { | class YJColorPicker { | ||||||
|   constructor(options = {}) { |   constructor(options = {}) { | ||||||
|     let _this = this |     let _this = this | ||||||
|     let pickAlphaInput |     let RInput | ||||||
|  |     let GInput | ||||||
|  |     let BInput | ||||||
|  |     let AInput | ||||||
|  |  | ||||||
|     let config = { |     let config = { | ||||||
|       el: options.el, |       el: options.el, | ||||||
|       size: "mini", |       size: "mini", | ||||||
|       isLog: false, |       isLog: false, | ||||||
|       disabled: options.disabled || false, //是否禁止打开颜色选择器 |       disabled: options.disabled || false, //是否禁止打开颜色选择器 | ||||||
|       alpha: false, //是否开启透明度 |       alpha: false, //是否开启透明度 | ||||||
|       sure: (color) => { |       clickDefineColor: clickDefineColor, | ||||||
|         if (pickAlphaInput) { |       hasClear: true, | ||||||
|           let c = Cesium.Color.fromCssColorString(color).withAlpha(pickAlphaInput.value / 100) |       openPickerAni: 'opacity', | ||||||
|           this.pickAlphaInputValue = pickAlphaInput.value |       defaultColor: options.defaultColor, | ||||||
|           color = c.toCssHexString() |       pickerInputChange: pickerInputChange, | ||||||
|         } |       startMainCallback: (t) => { | ||||||
|         if (options.sure && typeof options.sure == 'function') { |         _this.colorPicker && (_this.colorPicker.picker.style.opacity = 0) | ||||||
|           options.sure(color) |  | ||||||
|         } |  | ||||||
|         setTimeout(() => { |         setTimeout(() => { | ||||||
|           customizeStyle() |           customizeStyle() | ||||||
|         }, this.colorPicker.config.pickerAnimationTime); |         }, 0); | ||||||
|       }, |       } | ||||||
|       clear: () => { |  | ||||||
|         options.clear() |  | ||||||
|       }, |  | ||||||
|       close: () => { |  | ||||||
|         pickAlphaInput.value = this.pickAlphaInputValue |  | ||||||
|       }, |  | ||||||
|       clickDefineColor: clickDefineColor, |  | ||||||
|       hasClear: false, |  | ||||||
|       defaultColor: options.defaultColor || '#ffffff' |  | ||||||
|     } |     } | ||||||
|     let CesiumColor = Cesium.Color.fromCssColorString(options.defaultColor) |     this.el = options.el | ||||||
|     if (!CesiumColor) { |     if (options.sure) { | ||||||
|       config.defaultColor = '#ffffff' |       config.sure = (color) => { | ||||||
|  |         // this.colorPicker.config.defaultColor = this.colorPicker.pickerInput.value | ||||||
|  |         let c = Cesium.Color.fromCssColorString(color) | ||||||
|  |         if (AInput) { | ||||||
|  |           c = c.withAlpha(AInput.value) | ||||||
|  |           this.pickAlphaInputValue = AInput.value | ||||||
|  |         } | ||||||
|  |         color = c.toCssHexString() | ||||||
|  |         if (typeof options.sure == 'function') { | ||||||
|  |           options.sure(color) | ||||||
|  |         } | ||||||
|  |         customizeStyle() | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |     if (options.clear) { | ||||||
|  |       config.clear = () => { | ||||||
|  |         if (AInput) { | ||||||
|  |           AInput.value = this.pickAlphaInputValue = 1 | ||||||
|  |         } | ||||||
|  |         this.colorPicker.config.defaultColor = '' | ||||||
|  |         customizeStyle() | ||||||
|  |         if (typeof options.clear == 'function') { | ||||||
|  |           options.clear() | ||||||
|  |         } | ||||||
|  |         // setTimeout(() => { | ||||||
|  |         //   this.pickAlphaInputValue = 100 | ||||||
|  |         //   this.colorPicker.$Dom.pickerInput.value = '' | ||||||
|  |         //   if (options.clear && typeof options.clear == 'function') { | ||||||
|  |         //     options.clear() | ||||||
|  |         //   } | ||||||
|  |         //   customizeStyle() | ||||||
|  |         // }, this.colorPicker.config.pickerAnimationTime); | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |     let CesiumColor | ||||||
|  |     if (config.defaultColor) { | ||||||
|       CesiumColor = Cesium.Color.fromCssColorString(config.defaultColor) |       CesiumColor = Cesium.Color.fromCssColorString(config.defaultColor) | ||||||
|     } |     } | ||||||
|     if (options.predefineColor) { |     // if (options.predefineColor) { | ||||||
|       config.predefineColor = ['rgba(255, 255, 255, 1)', 'rgba(255, 0, 0, 1)', 'rgba(208, 132, 209, 1)', 'rgba(100, 182, 217, 1)', 'rgba(42, 130, 228, 1)', 'rgba(214, 36, 36, 1)', 'rgba(252, 222, 111, 1)', 'rgba(67, 207, 124, 1)', 'rgba(176, 243, 143, 1)', 'rgba(121, 72, 234, 1)', 'rgba(255, 195, 0, 1)', 'rgba(0, 186, 173, 1)', 'rgba(165, 214, 63, 1)', 'rgba(0, 0, 0, 1)', 'rgba(46, 47, 51, 1)', 'rgba(172, 51, 193, 1)', 'rgba(130, 21, 21, 1)', 'rgba(255, 87, 51, 1)', 'rgba(255, 140, 0, 1)', 'rgba(125, 191, 255, 1)'] |     //   config.predefineColor = ['rgba(255, 255, 255, 1)', 'rgba(255, 0, 0, 1)', 'rgba(208, 132, 209, 1)', 'rgba(100, 182, 217, 1)', 'rgba(42, 130, 228, 1)', 'rgba(214, 36, 36, 1)', 'rgba(252, 222, 111, 1)', 'rgba(67, 207, 124, 1)', 'rgba(176, 243, 143, 1)', 'rgba(121, 72, 234, 1)', 'rgba(255, 195, 0, 1)', 'rgba(0, 186, 173, 1)', 'rgba(165, 214, 63, 1)', 'rgba(0, 0, 0, 1)', 'rgba(46, 47, 51, 1)', 'rgba(172, 51, 193, 1)', 'rgba(130, 21, 21, 1)', 'rgba(255, 87, 51, 1)', 'rgba(255, 140, 0, 1)', 'rgba(125, 191, 255, 1)'] | ||||||
|     } |     // } | ||||||
|     this.colorPicker = new ewColorPicker(config) |     config.predefineColor = ['rgba(255, 255, 255, 1)', 'rgba(255, 0, 0, 1)', 'rgba(208, 132, 209, 1)', 'rgba(100, 182, 217, 1)', 'rgba(42, 130, 228, 1)', 'rgba(214, 36, 36, 1)', 'rgba(252, 222, 111, 1)', 'rgba(67, 207, 124, 1)', 'rgba(176, 243, 143, 1)', 'rgba(121, 72, 234, 1)', 'rgba(255, 195, 0, 1)', 'rgba(0, 186, 173, 1)', 'rgba(165, 214, 63, 1)', 'rgba(0, 0, 0, 1)', 'rgba(46, 47, 51, 1)', 'rgba(172, 51, 193, 1)', 'rgba(130, 21, 21, 1)', 'rgba(255, 87, 51, 1)', 'rgba(255, 140, 0, 1)', 'rgba(125, 191, 255, 1)'] | ||||||
|     window.colorPicker = this.colorPicker  |     this.colorPicker = new ewPlugins('colorpicker', config) | ||||||
|     console.log('this.colorPicker', this.colorPicker, this.colorPicker.$Dom.pickerInput) |     // window.colorPicker = this.colorPicker | ||||||
|  |  | ||||||
|     customizeStyle() |     customizeStyle() | ||||||
|  |  | ||||||
|     function customizeStyle() { |     function customizeStyle() { | ||||||
|  |       if (!_this.colorPicker || !_this.colorPicker.picker) { | ||||||
|  |         return | ||||||
|  |       } | ||||||
|       let isSubtract = false |       let isSubtract = false | ||||||
|       let box = _this.colorPicker.$Dom.box |       let box = _this.colorPicker.box | ||||||
|       let picker = _this.colorPicker.$Dom.picker |       let picker = _this.colorPicker.picker | ||||||
|       picker.style.minWidth = '300px' |       let x = box.getBoundingClientRect().x | ||||||
|       let pickerContent = picker.getElementsByClassName('ew-color-picker-content')[0] |       let y = box.getBoundingClientRect().y | ||||||
|  |       let height = 0 | ||||||
|  |  | ||||||
|  |       // if (picker.style.display === 'none') { | ||||||
|  |       //   picker.style.display = 'block' | ||||||
|  |       //   height = picker.offsetHeight | ||||||
|  |       //   console.log('picker.style.display.opacity', picker.style.display.opacity) | ||||||
|  |       //   picker.style.display = 'none' | ||||||
|  |       // } | ||||||
|  |       // console.log('===========================================') | ||||||
|  |       // console.log((y + box.offsetHeight + 4),  height, window.innerHeight) | ||||||
|  |       // if ((y + box.offsetHeight + 4) + height > window.innerHeight) { | ||||||
|  |       //   console.log(y, height) | ||||||
|  |       //   picker.style.top = y - height + 'px' | ||||||
|  |       // } | ||||||
|  |       // else { | ||||||
|  |       //   picker.style.top = (y + box.offsetHeight + 4) + 'px' | ||||||
|  |       // } | ||||||
|  |  | ||||||
|  |       picker.style.left = x + 'px' | ||||||
|  |       picker.style.minWidth = '325px' | ||||||
|  |       // let pickerContent = picker.getElementsByClassName('ew-color-picker-content')[0] | ||||||
|       let pickAlphaSliderBar = picker.getElementsByClassName('ew-alpha-slider-bar')[0] |       let pickAlphaSliderBar = picker.getElementsByClassName('ew-alpha-slider-bar')[0] | ||||||
|       if (pickAlphaSliderBar) { |       if (pickAlphaSliderBar) { | ||||||
|         pickAlphaSliderBar.parentNode.style.width = '16px' |         pickAlphaSliderBar.parentNode.style.width = '16px' | ||||||
|         pickAlphaSliderBar.parentNode.removeChild(pickAlphaSliderBar) |         pickAlphaSliderBar.parentNode.removeChild(pickAlphaSliderBar) | ||||||
|       } |       } | ||||||
|       let customDivider = document.createElement('span') |  | ||||||
|       customDivider.className = 'custom-divider' |  | ||||||
|       pickerContent.parentNode.insertBefore(customDivider, pickerContent.nextSibling) |  | ||||||
|       let pickPen = document.createElement('div') |       let pickPen = document.createElement('div') | ||||||
|       pickPen.className = 'icon-pen-box' |       pickPen.className = 'icon-pen-box' | ||||||
|       pickPen.innerHTML = '<svg class="icon-pen"><use xlink:href="#yj-icon-pen"></use></svg>' |       pickPen.innerHTML = '<svg class="icon-pen"><use xlink:href="#yj-icon-pen"></use></svg>' | ||||||
|       let pickerInput = _this.colorPicker.$Dom.pickerInput |  | ||||||
|  |       /** 为完成、暂时隐藏 */////// | ||||||
|  |       pickPen.style.display = 'none' | ||||||
|  |       pickPen.style.cursor = 'unset' | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |       let pickerInput = _this.colorPicker.pickerInput | ||||||
|       pickerInput.parentNode.insertBefore(pickPen, pickerInput) |       pickerInput.parentNode.insertBefore(pickPen, pickerInput) | ||||||
|       pickerInput.style.width = 'calc(77% - 24px)' |       pickerInput.style.width = '188px' | ||||||
|  |       pickerInput.style.display = 'none' | ||||||
|  |  | ||||||
|  |       let colorInputBox = document.createElement('div') | ||||||
|  |       let row1Elm = document.createElement('div') | ||||||
|  |       row1Elm.className = 'row' | ||||||
|  |       row1Elm.style.margin = '6px 0 0 0' | ||||||
|  |       row1Elm.innerHTML = ` | ||||||
|  |           <div class="col">R</div> | ||||||
|  |           <div class="col">G</div> | ||||||
|  |           <div class="col">B</div> | ||||||
|  |           <div class="col" style="flex: 0 0 92px;"></div> | ||||||
|  |       ` | ||||||
|  |       let row2Elm = document.createElement('div') | ||||||
|  |       row2Elm.className = 'row' | ||||||
|  |       row2Elm.innerHTML = ` | ||||||
|  |           <div class="col"> | ||||||
|  |             <input type="number" step="1" min="0" max="255"> | ||||||
|  |           </div> | ||||||
|  |           <div class="col"> | ||||||
|  |             <input type="number" step="1" min="0" max="255"> | ||||||
|  |           </div> | ||||||
|  |           <div class="col"> | ||||||
|  |             <input type="number" step="1" min="0" max="255"> | ||||||
|  |           </div> | ||||||
|  |       ` | ||||||
|  |       colorInputBox.appendChild(row1Elm) | ||||||
|  |       colorInputBox.appendChild(row2Elm) | ||||||
|  |       let Inputs = row2Elm.getElementsByTagName('input') | ||||||
|  |       Inputs[0].style.width = '72px' | ||||||
|  |       Inputs[1].style.width = '72px' | ||||||
|  |       Inputs[2].style.width = '72px' | ||||||
|  |       RInput = Inputs[0] | ||||||
|  |       GInput = Inputs[1] | ||||||
|  |       BInput = Inputs[2] | ||||||
|  |  | ||||||
|  |       let dropbtns = picker.getElementsByClassName('ew-color-dropbtns')[0] | ||||||
|  |       picker.insertBefore(colorInputBox, dropbtns) | ||||||
|  |  | ||||||
|  |       RInput.addEventListener('blur', (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) | ||||||
|  |           } | ||||||
|  |           RInput.value = parseInt(value) | ||||||
|  |           _this.colorPicker.hsba = colorRgbaToHsba(`rgb(${RInput.value}, ${GInput.value}, ${BInput.value})`) | ||||||
|  |           _this.colorPicker.changeColor(_this.colorPicker, _this.colorPicker.pickerPanel.offsetWidth,_this.colorPicker.pickerPanel.offsetHeight) | ||||||
|  |         } | ||||||
|  |       }) | ||||||
|  |       GInput.addEventListener('blur', (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) | ||||||
|  |           } | ||||||
|  |           GInput.value = parseInt(value) | ||||||
|  |           _this.colorPicker.hsba = colorRgbaToHsba(`rgb(${RInput.value}, ${GInput.value}, ${BInput.value})`) | ||||||
|  |           _this.colorPicker.changeColor(_this.colorPicker, _this.colorPicker.pickerPanel.offsetWidth,_this.colorPicker.pickerPanel.offsetHeight) | ||||||
|  |         } | ||||||
|  |       }) | ||||||
|  |       BInput.addEventListener('blur', (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) | ||||||
|  |           } | ||||||
|  |           BInput.value = parseInt(value) | ||||||
|  |           _this.colorPicker.hsba = colorRgbaToHsba(`rgb(${RInput.value}, ${GInput.value}, ${BInput.value})`) | ||||||
|  |           _this.colorPicker.changeColor(_this.colorPicker, _this.colorPicker.pickerPanel.offsetWidth,_this.colorPicker.pickerPanel.offsetHeight) | ||||||
|  |         } | ||||||
|  |       }) | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|       if (options.alpha) { |       if (options.alpha) { | ||||||
|  |         Inputs[0].style.width = '52px' | ||||||
|  |         Inputs[1].style.width = '52px' | ||||||
|  |         Inputs[2].style.width = '52px' | ||||||
|         let pickAlpha = document.createElement('div') |         let pickAlpha = document.createElement('div') | ||||||
|         pickAlpha.className = 'input-number input-number-unit-1 color-alpha' |         pickAlpha.className = 'input-number input-number-unit color-alpha' | ||||||
|         pickAlpha.innerHTML = ` |         pickAlpha.innerHTML = ` | ||||||
|         <input class="input" type="number" title="" step="0.01" min="0" max="100"> |         <input class="input" type="number" title="" step="0.01" min="0" max="1"> | ||||||
|         <span class="unit">%</span> |  | ||||||
|         <span class="arrow"></span>` |         <span class="arrow"></span>` | ||||||
|         pickerInput.parentNode.insertBefore(pickAlpha, pickerInput.nextSibling) |         pickerInput.parentNode.insertBefore(pickAlpha, pickerInput.nextSibling) | ||||||
|         pickerInput.style.width = '39%' |         pickAlpha.style.width = '66px' | ||||||
|         pickAlpha.style.width = 'calc(32% - 12px)' |         pickAlpha.style.margin = '0 6px 0 0' | ||||||
|         pickAlphaInput = pickAlpha.getElementsByClassName('input')[0] |         AInput = pickAlpha.getElementsByClassName('input')[0] | ||||||
|  |         row1Elm.innerHTML = ` | ||||||
|  |           <div class="col">R</div> | ||||||
|  |           <div class="col">G</div> | ||||||
|  |           <div class="col">B</div> | ||||||
|  |           <div class="col">A</div> | ||||||
|  |           <div class="col" style="flex: 0 0 106px;"></div> | ||||||
|  |         ` | ||||||
|  |         row2Elm.appendChild(pickAlpha) | ||||||
|  |         AInput.addEventListener('blur', (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) | ||||||
|  |             } | ||||||
|  |             AInput.value = parseInt(value * 100) / 100 | ||||||
|  |           } | ||||||
|  |         }) | ||||||
|         if (_this.pickAlphaInputValue || _this.pickAlphaInputValue === 0 || _this.pickAlphaInputValue === '0') { |         if (_this.pickAlphaInputValue || _this.pickAlphaInputValue === 0 || _this.pickAlphaInputValue === '0') { | ||||||
|           pickAlphaInput.value = Number(Number(_this.pickAlphaInputValue).toFixed(2)) |           AInput.value = parseInt(_this.pickAlphaInputValue * 100) / 100 | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
|           pickAlphaInput.value = Number((CesiumColor.alpha * 100).toFixed(2)) |           AInput.value = CesiumColor ? parseInt(Number(CesiumColor.alpha.toFixed(2)) * 100) / 100 : 1 | ||||||
|         } |         } | ||||||
|         _this.pickAlphaInputValue = pickAlphaInput.value |         _this.pickAlphaInputValue = AInput.value | ||||||
|         box.style.background = Cesium.Color.fromCssColorString(_this.colorPicker._privateConfig.colorValue).withAlpha(pickAlphaInput.value / 100).toCssColorString() |         box.style.background = Cesium.Color.fromCssColorString(_this.colorPicker.config.defaultColor || '#ffffff').withAlpha(AInput.value).toCssColorString() | ||||||
|       } |       } | ||||||
|       else { |       else { | ||||||
|         CesiumColor = CesiumColor.withAlpha(1) |         CesiumColor = CesiumColor ? CesiumColor.withAlpha(1) : '' | ||||||
|  |         box.style.background = Cesium.Color.fromCssColorString(_this.colorPicker.config.defaultColor || '#ffffff').toCssColorString() | ||||||
|       } |       } | ||||||
|  |  | ||||||
|  |       let btngroup = picker.getElementsByClassName('ew-color-dropbtngroup')[0] | ||||||
|  |       row2Elm.appendChild(btngroup) | ||||||
|  |  | ||||||
|       let defineColorContainer = picker.getElementsByClassName('ew-pre-define-color-container')[0] |       let defineColorContainer = picker.getElementsByClassName('ew-pre-define-color-container')[0] | ||||||
|       if (defineColorContainer) { |       if (defineColorContainer) { | ||||||
|         let colorList = localStorage.getItem('custom-color') |         let colorList = localStorage.getItem('custom-color') | ||||||
| @ -101,6 +283,7 @@ class YJColorPicker { | |||||||
|         } |         } | ||||||
|         let customDivider2 = document.createElement('span') |         let customDivider2 = document.createElement('span') | ||||||
|         customDivider2.className = 'custom-divider' |         customDivider2.className = 'custom-divider' | ||||||
|  |         customDivider2.style.margin = '10px 0' | ||||||
|         let customDivider3 = document.createElement('span') |         let customDivider3 = document.createElement('span') | ||||||
|         customDivider3.className = 'custom-divider' |         customDivider3.className = 'custom-divider' | ||||||
|         defineColorContainer.parentNode.insertBefore(customDivider2, defineColorContainer) |         defineColorContainer.parentNode.insertBefore(customDivider2, defineColorContainer) | ||||||
| @ -115,8 +298,10 @@ class YJColorPicker { | |||||||
|         addColorBtn.className = 'yj-pre-collect-color add' |         addColorBtn.className = 'yj-pre-collect-color add' | ||||||
|  |  | ||||||
|         let subtractColorBtn = document.createElement('div') |         let subtractColorBtn = document.createElement('div') | ||||||
|         subtractColorBtn.innerHTML = '<svg class="icon-minus"><use xlink:href="#yj-icon-minus"></use></svg>' |         subtractColorBtn.innerHTML = '<svg class="icon-minus" style="display: unset;"><use xlink:href="#yj-icon-minus"></use></svg><svg class="icon-confirm" style="display: none;"><use xlink:href="#yj-icom-confirm"></use></svg>' | ||||||
|         subtractColorBtn.className = 'yj-pre-collect-color subtract' |         subtractColorBtn.className = 'yj-pre-collect-color subtract' | ||||||
|  |         let minusIcon = subtractColorBtn.getElementsByClassName('icon-minus')[0] | ||||||
|  |         let confirmIcon = subtractColorBtn.getElementsByClassName('icon-confirm')[0] | ||||||
|         collectColorContainer.appendChild(addColorBtn) |         collectColorContainer.appendChild(addColorBtn) | ||||||
|         collectColorContainer.appendChild(subtractColorBtn) |         collectColorContainer.appendChild(subtractColorBtn) | ||||||
|  |  | ||||||
| @ -124,6 +309,8 @@ class YJColorPicker { | |||||||
|         for (let key in colorList) { |         for (let key in colorList) { | ||||||
|           let colorElm = document.createElement('div') |           let colorElm = document.createElement('div') | ||||||
|           colorElm.className = 'yj-pre-collect-color' |           colorElm.className = 'yj-pre-collect-color' | ||||||
|  |           colorElm.setAttribute('tabindex', '0') | ||||||
|  |           colorElm.setAttribute('color-box-id', _this.colorPicker.uid) | ||||||
|           let colorItemElm = document.createElement('div') |           let colorItemElm = document.createElement('div') | ||||||
|           colorItemElm.className = 'yj-pre-define-color-item' |           colorItemElm.className = 'yj-pre-define-color-item' | ||||||
|           colorElm.appendChild(colorItemElm) |           colorElm.appendChild(colorItemElm) | ||||||
| @ -131,10 +318,14 @@ class YJColorPicker { | |||||||
|           let c = Cesium.Color.fromCssColorString(colorList[key]) |           let c = Cesium.Color.fromCssColorString(colorList[key]) | ||||||
|           let colorString = c.toCssHexString() |           let colorString = c.toCssHexString() | ||||||
|           colorItemElm.style.backgroundColor = colorString |           colorItemElm.style.backgroundColor = colorString | ||||||
|           colorItemElm.addEventListener('click', () => { |           colorItemElm.addEventListener('click', (e) => { | ||||||
|             _this.colorPicker.updateColor(c.toCssColorString()) |             _this.colorPicker.updateColor(e) | ||||||
|  |             colorElm.className = 'yj-pre-collect-color yj-pre-collect-color-active' | ||||||
|             clickDefineColor(colorString) |             clickDefineColor(colorString) | ||||||
|           }) |           }) | ||||||
|  |           colorElm.addEventListener("blur", function (e) { | ||||||
|  |             colorElm.className = 'yj-pre-collect-color' | ||||||
|  |           }) | ||||||
|  |  | ||||||
|           let subtractElm = document.createElement('div') |           let subtractElm = document.createElement('div') | ||||||
|           subtractElm.className = 'yj-pre-define-color-item subtract-btn' |           subtractElm.className = 'yj-pre-define-color-item subtract-btn' | ||||||
| @ -161,20 +352,27 @@ class YJColorPicker { | |||||||
|           } |           } | ||||||
|           let colorElm = document.createElement('div') |           let colorElm = document.createElement('div') | ||||||
|           colorElm.className = 'yj-pre-collect-color' |           colorElm.className = 'yj-pre-collect-color' | ||||||
|  |           colorElm.setAttribute('tabindex', '0') | ||||||
|  |           colorElm.setAttribute('color-box-id', _this.colorPicker.uid) | ||||||
|           let colorItemElm = document.createElement('div') |           let colorItemElm = document.createElement('div') | ||||||
|           colorItemElm.className = 'yj-pre-define-color-item' |           colorItemElm.className = 'yj-pre-define-color-item' | ||||||
|           colorElm.appendChild(colorItemElm) |           colorElm.appendChild(colorItemElm) | ||||||
|  |  | ||||||
|           let c = Cesium.Color.fromCssColorString(_this.colorPicker.prevInputValue) |           let color = colorRgbaToHex(colorHsbaToRgba(_this.colorPicker.hsba)) | ||||||
|           if (pickAlphaInput) { |           let c = Cesium.Color.fromCssColorString(color || '#ffffff') | ||||||
|             c = c.withAlpha(pickAlphaInput.value / 100) |           if (AInput) { | ||||||
|  |             c = c.withAlpha(AInput.value) | ||||||
|           } |           } | ||||||
|           let colorString = c.toCssHexString() |           let colorString = c.toCssHexString() | ||||||
|           colorItemElm.style.backgroundColor = colorString |           colorItemElm.style.backgroundColor = colorString | ||||||
|           colorItemElm.addEventListener('click', () => { |           colorItemElm.addEventListener('click', (e) => { | ||||||
|             _this.colorPicker.updateColor(c.toCssColorString()) |             _this.colorPicker.updateColor(e) | ||||||
|  |             colorElm.className = 'yj-pre-collect-color yj-pre-collect-color-active' | ||||||
|             clickDefineColor(colorString) |             clickDefineColor(colorString) | ||||||
|           }) |           }) | ||||||
|  |           colorElm.addEventListener("blur", function (e) { | ||||||
|  |             colorElm.className = 'yj-pre-collect-color' | ||||||
|  |           }) | ||||||
|           collectColorContainer.appendChild(colorElm) |           collectColorContainer.appendChild(colorElm) | ||||||
|  |  | ||||||
|           let subtractElm = document.createElement('div') |           let subtractElm = document.createElement('div') | ||||||
| @ -197,25 +395,175 @@ class YJColorPicker { | |||||||
|         subtractColorBtn.addEventListener('click', () => { |         subtractColorBtn.addEventListener('click', () => { | ||||||
|           isSubtract = !isSubtract |           isSubtract = !isSubtract | ||||||
|           if (isSubtract) { |           if (isSubtract) { | ||||||
|  |             minusIcon.style.display = 'none' | ||||||
|  |             confirmIcon.style.display = 'unset' | ||||||
|             for (let i = 0; i < subtractElmList.length; i++) { |             for (let i = 0; i < subtractElmList.length; i++) { | ||||||
|               subtractElmList[i].style.display = 'block' |               subtractElmList[i].style.display = 'block' | ||||||
|             } |             } | ||||||
|           } |           } | ||||||
|           else { |           else { | ||||||
|  |             minusIcon.style.display = 'unset' | ||||||
|  |             confirmIcon.style.display = 'none' | ||||||
|             for (let i = 0; i < subtractElmList.length; i++) { |             for (let i = 0; i < subtractElmList.length; i++) { | ||||||
|               subtractElmList[i].style.display = 'none' |               subtractElmList[i].style.display = 'none' | ||||||
|             } |             } | ||||||
|           } |           } | ||||||
|         }) |         }) | ||||||
|       } |       } | ||||||
|  |  | ||||||
|  |       height = picker.offsetHeight | ||||||
|  |       if (picker.style.display === 'none') { | ||||||
|  |         picker.style.display = 'block' | ||||||
|  |         height = picker.offsetHeight | ||||||
|  |         picker.style.display = 'none' | ||||||
|  |       } | ||||||
|  |       if ((y + box.offsetHeight + 4) + height > window.innerHeight) { | ||||||
|  |         picker.style.top = y - height + 'px' | ||||||
|  |       } | ||||||
|  |       else { | ||||||
|  |         picker.style.top = (y + box.offsetHeight + 4) + 'px' | ||||||
|  |       } | ||||||
|  |       _this.colorPicker.pancelTop = parseFloat(picker.style.top) - 2 | ||||||
|  |  | ||||||
|  |       pickerInputChange(Cesium.Color.fromCssColorString(_this.colorPicker.config.defaultColor || '#ffffff').toCssHexString()) | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     function clickDefineColor(color) { |     function clickDefineColor(color) { | ||||||
|       if (pickAlphaInput) { |       if (AInput) { | ||||||
|         let c = Cesium.Color.fromCssColorString(color) |         let c = Cesium.Color.fromCssColorString(color) | ||||||
|         pickAlphaInput.value = c.alpha * 100 |         AInput.value = parseInt(Number(c.alpha.toFixed(2)) * 100) / 100 | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     function colorHsbaToRgba(e) { | ||||||
|  |       var r, n, o, i = e.a, a = Math.round(e.h), s = Math.round(255 * e.s / 100), l = Math.round(255 * e.b / 100); | ||||||
|  |       if (0 === s) | ||||||
|  |         r = n = o = l; | ||||||
|  |       else { | ||||||
|  |         var c = (255 - s) * l / 255 | ||||||
|  |           , d = a % 60 * (l - c) / 60; | ||||||
|  |         360 === a ? (r = l, | ||||||
|  |           n = o = 0) : a < 60 ? (r = l, | ||||||
|  |             n = c + d, | ||||||
|  |             o = c) : a < 120 ? (r = l - d, | ||||||
|  |               n = l, | ||||||
|  |               o = c) : a < 180 ? (r = c, | ||||||
|  |                 n = l, | ||||||
|  |                 o = c + d) : a < 240 ? (r = c, | ||||||
|  |                   n = l - d, | ||||||
|  |                   o = l) : a < 300 ? (r = c + d, | ||||||
|  |                     n = c, | ||||||
|  |                     o = l) : a < 360 ? (r = l, | ||||||
|  |                       n = c, | ||||||
|  |                       o = l - d) : r = n = o = 0 | ||||||
|  |       } | ||||||
|  |       return "rgba(" + Math.round(r) + "," + Math.round(n) + "," + Math.round(o) + "," + i + ")" | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     function colorRgbaToHex(e) { | ||||||
|  |       var t = { | ||||||
|  |         10: "A", | ||||||
|  |         11: "B", | ||||||
|  |         12: "C", | ||||||
|  |         13: "D", | ||||||
|  |         14: "E", | ||||||
|  |         15: "F" | ||||||
|  |       }; | ||||||
|  |       if (/rgba?/.test(e)) { | ||||||
|  |         var r = e.replace(/rgba?\(/, "").replace(/\)/, "").replace(/[\s+]/g, "").split(",") | ||||||
|  |           , n = ""; | ||||||
|  |         r[3]; | ||||||
|  |         return r.map(function (e, r) { | ||||||
|  |           r <= 2 && (n += function (e) { | ||||||
|  |             e = Math.min(Math.round(e), 255); | ||||||
|  |             var r = Math.floor(e / 16) | ||||||
|  |               , n = e % 16; | ||||||
|  |             return "" + (t[r] || r) + (t[n] || n) | ||||||
|  |           }(e)) | ||||||
|  |         }), | ||||||
|  |           "#" + n | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     function colorHexToRgba(hex, alpha) { | ||||||
|  |       let a = alpha || 1, | ||||||
|  |         hColor = hex.toLowerCase(), | ||||||
|  |         hLen = hex.length, | ||||||
|  |         rgbaColor = []; | ||||||
|  |       hColor = Cesium.Color.fromCssColorString(hColor).toCssHexString().substring(0, 7) | ||||||
|  |       const colorRegExp = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/; | ||||||
|  |       if (hex && colorRegExp.test(hColor)) { | ||||||
|  |         //the hex length may be 4 or 7,contained the symbol of # | ||||||
|  |         if (hLen === 4) { | ||||||
|  |           let hSixColor = '#'; | ||||||
|  |  | ||||||
|  |           for (let i = 1; i < hLen; i++) { | ||||||
|  |             let sColor = hColor.slice(i, i + 1); | ||||||
|  |             hSixColor += sColor.concat(sColor); | ||||||
|  |           } | ||||||
|  |  | ||||||
|  |           hColor = hSixColor; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         for (let j = 1, len = hColor.length; j < len; j += 2) { | ||||||
|  |           rgbaColor.push(parseInt('0X' + hColor.slice(j, j + 2), 16)); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         // return "rgba(" + rgbaColor.join(",") + ',' + a + ")"; | ||||||
|  |         return rgbaColor; | ||||||
|  |       } else { | ||||||
|  |         return; | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     function colorRgbaToHsba(e) { | ||||||
|  |       var t = e.slice(e.indexOf("(") + 1, e.lastIndexOf(")")).split(",") | ||||||
|  |         , r = t.length < 4 ? 1 : Number(t[3]) | ||||||
|  |         , n = Number(t[0]) / 255 | ||||||
|  |         , o = Number(t[1]) / 255 | ||||||
|  |         , i = Number(t[2]) / 255 | ||||||
|  |         , a = void 0 | ||||||
|  |         , s = void 0 | ||||||
|  |         , l = void 0 | ||||||
|  |         , c = Math.min(n, o, i) | ||||||
|  |         , d = l = Math.max(n, o, i) | ||||||
|  |         , u = d - c; | ||||||
|  |       if (d === c) | ||||||
|  |           a = 0; | ||||||
|  |       else { | ||||||
|  |           switch (d) { | ||||||
|  |           case n: | ||||||
|  |               a = (o - i) / u + (o < i ? 6 : 0); | ||||||
|  |               break; | ||||||
|  |           case o: | ||||||
|  |               a = 2 + (i - n) / u; | ||||||
|  |               break; | ||||||
|  |           case i: | ||||||
|  |               a = 4 + (n - o) / u | ||||||
|  |           } | ||||||
|  |           a = Math.round(60 * a) | ||||||
|  |       } | ||||||
|  |       s = 0 === d ? 0 : 1 - c / d; | ||||||
|  |       return s = Math.round(100 * s), | ||||||
|  |       l = Math.round(100 * l), | ||||||
|  |       { | ||||||
|  |           h: a, | ||||||
|  |           s: s, | ||||||
|  |           b: l, | ||||||
|  |           a: r | ||||||
|  |       } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |     function pickerInputChange(v) { | ||||||
|  |       if (_this.colorPicker && _this.colorPicker.pickerInput) { | ||||||
|  |         let rgbaColor = colorHexToRgba(v || _this.colorPicker.pickerInput.value) | ||||||
|  |         RInput.value = rgbaColor[0] | ||||||
|  |         GInput.value = rgbaColor[1] | ||||||
|  |         BInput.value = rgbaColor[2] | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | window.YJColorPicker = YJColorPicker | ||||||
| export default YJColorPicker | export default YJColorPicker | ||||||
| @ -50,7 +50,8 @@ 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 = 1.5 * vec4(${color.red},${color.green},${color.blue},${color.alpha}).rgb; |           material.diffuse = vec4(0.0,0.0,0.0,0.0).rgb; | ||||||
|  |           material.emission = 1.0 * vec4(${color.red},${color.green},${color.blue},${color.alpha}).rgb; | ||||||
|         } |         } | ||||||
|         ` |         ` | ||||||
|     } |     } | ||||||
|  | |||||||
							
								
								
									
										113
									
								
								src/Obj/Materail/RoadTextureMaterialProperty.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										113
									
								
								src/Obj/Materail/RoadTextureMaterialProperty.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,113 @@ | |||||||
|  | /* | ||||||
|  |  * @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 = (colorImage.rgb+color.rgb)/2.0;\n\ |       material.diffuse = color.rgb/20.0;\n\ | ||||||
|       material.emission = fragColor.rgb;\n\ |       material.emission = fragColor.rgb;\n\ | ||||||
|       return material;\n\ |       return material;\n\ | ||||||
|       }"; |       }"; | ||||||
| @ -208,6 +208,14 @@ 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: { | ||||||
| @ -230,8 +238,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.4; |               material.emission = colorImage.rgb * color.rgb * 1.0; | ||||||
|               return material; |               return material; | ||||||
|           }`, |           }`, | ||||||
|           components: { |           components: { | ||||||
|  | |||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user