Compare commits
	
		
			9 Commits
		
	
	
		
			zh
			...
			b0ae9c7042
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| b0ae9c7042 | |||
| 11812253e6 | |||
| 45f2d6f4eb | |||
| dd003aa00d | |||
| ea94efb65f | |||
| fa3325580c | |||
| 0cf59afffd | |||
| 2b6edf70b9 | |||
| 484fe70e16 | 
							
								
								
									
										56
									
								
								src/Global/efflect/Sunshine/_element.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,56 @@ | ||||
| function html() { | ||||
|   return ` | ||||
|     <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="" min="0.01" max="999999" step="10" @model="speed"> | ||||
|                     <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="1" step="0.1" @model="darkness"> | ||||
|                     <span class="arrow"></span> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
|     <div class="div-item"> | ||||
|         <div class="row"> | ||||
|             <div class="col"> | ||||
|                 <span class="label">阴影优化</span> | ||||
|                 <input class="btn-switch" type="checkbox" @model="softShadow"> | ||||
|             </div> | ||||
|             <div class="col"> | ||||
|                 <span class="label" style="flex: 0 0 56px;">日期选择</span> | ||||
|                 <input class="sunshine-date" type="text" placeholder="YYYY-MM-DD" @model="time"> | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
|     <span class="custom-divider"></span> | ||||
|     <div class="div-item"> | ||||
|         <div class="row"> | ||||
|             <div class="col"> | ||||
|               <div class="timeline-container"> | ||||
|                   <div class="timeline" id="timeline"> | ||||
|                       <div class="progress" id="progress"> | ||||
|                           <div class="handle" id="handle"></div> | ||||
|                           <div class="current-time" id="currentTime">00:00:00</div> | ||||
|                       </div> | ||||
|                   </div> | ||||
|                   <div class="time-marks"> | ||||
|                   </div> | ||||
|                   <button id="timePause">暂停</button> | ||||
|               </div> | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
|     <span class="custom-divider"></span> | ||||
|     ` | ||||
| } | ||||
|  | ||||
| export { html } | ||||
							
								
								
									
										92
									
								
								src/Global/efflect/Sunshine/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; | ||||
							
								
								
									
										224
									
								
								src/Global/efflect/Sunshine/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,224 @@ | ||||
| /** | ||||
|  * @description 水面 | ||||
|  */ | ||||
| import Dialog from '../../../Obj/Element/Dialog'; | ||||
| import { html } from "./_element"; | ||||
| import EventBinding from '../../../Obj/Element/Dialog/eventBinding'; | ||||
| import { syncData } from '../../MultiViewportMode' | ||||
| import Tools from '../../../Tools' | ||||
| import TimeLine from './TimeLine' | ||||
| import { setSplitDirection, syncSplitData, setActiveId } from '../../SplitScreen' | ||||
|  | ||||
| export default class Sunshine { | ||||
|   /** | ||||
|    * @constructor | ||||
|    * @param sdk | ||||
|    * @description 光照 | ||||
|    * @param options {object} 光照属性 | ||||
|    * @param options.time=当前时间 {string} 当前时间 | ||||
|    * @param options.speed=1000 {number} 速度倍速 | ||||
|    * @param options.darkness=0.3 {number} 阴影不透明度--越大越不透明 | ||||
|    * @param options.softShadow=false {boolean} 阴影优化--true/false} | ||||
|    * @param Dialog {object} 弹框对象 | ||||
|    * @param Dialog.confirmCallBack {function} 弹框确认时的回调 | ||||
|    * */ | ||||
|   constructor(sdk, options = {}, _Dialog = {}) { | ||||
|     this.viewer = sdk.viewer | ||||
|     this.options = { ...options } | ||||
|     this.sdk = { ...sdk } | ||||
|     this.options.time = options.time || new Date() | ||||
|     this.options.speed = options.speed || 1000 | ||||
|     this.options.darkness = options.darkness || 0.4 | ||||
|     this.options.softShadow = options.softShadow || true | ||||
|     this.options.show = options.show === true ? true : false | ||||
|     this.Dialog = _Dialog | ||||
|     this.timeLine | ||||
|     this._EventBinding = new EventBinding() | ||||
|     this._elms = {}; | ||||
|     Sunshine.start(this) | ||||
|   } | ||||
|  | ||||
|  | ||||
|   static start(that) { | ||||
|     that.viewer.scene.globe.enableLighting = true | ||||
|     that.viewer.shadows = true | ||||
|     that.viewer.scene.globe.enableLighting = true; | ||||
|  | ||||
|     that.viewer.terrainShadows = Cesium.ShadowMode.RECEIVE_ONLY | ||||
|     that.viewer.shadowMap.darkness = 1.0 - that.options.darkness //阴影透明度--越大越透明 | ||||
|  | ||||
|     const now = new Date(); | ||||
|     now.setHours(0, 0, 0, 0); // 设置为当天0点 | ||||
|     that.viewer.clock.currentTime = Cesium.JulianDate.fromDate(now); | ||||
|     that.viewer.clock.multiplier = that.options.speed; | ||||
|     that.viewer.shadowMap.softShadows = that.options.softShadow; | ||||
|  | ||||
|     that.edit(true) | ||||
|   } | ||||
|   get darkness() { | ||||
|     return this.options.darkness | ||||
|   } | ||||
|   set darkness(v) { | ||||
|     this.options.darkness = v | ||||
|     this.viewer.shadowMap.darkness = 1.0 - this.options.darkness | ||||
|   } | ||||
|  | ||||
|   get speed() { | ||||
|     return this.options.speed | ||||
|   } | ||||
|   set speed(v) { | ||||
|     this.options.speed = v | ||||
|     this.viewer.clock.multiplier = this.options.speed; | ||||
|     this.timeLine.setSpeed(v) | ||||
|   } | ||||
|   get softShadow() { | ||||
|     return this.options.softShadow | ||||
|   } | ||||
|   set softShadow(v) { | ||||
|     this.options.softShadow = v | ||||
|     this.viewer.shadowMap.softShadows = this.options.softShadow; | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * @description 编辑框 | ||||
|    * @param state=false {boolean} 状态: true打开, false关闭 | ||||
|    */ | ||||
|   async edit(state = false) { | ||||
|     let tools = new Tools() | ||||
|     this.originalOptions = tools.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.originalOptions = tools.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() | ||||
|         }, | ||||
|         // removeCallBack: () => { | ||||
|         //   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() | ||||
|         }, | ||||
|         showCallBack: (show) => { | ||||
|           this.show = show | ||||
|           this.Dialog.showCallBack && this.Dialog.showCallBack() | ||||
|         } | ||||
|       }, true) | ||||
|       this._DialogObject._element.body.className = this._DialogObject._element.body.className + ' sun-shine-surface' | ||||
|       let contentElm = document.createElement('div'); | ||||
|       contentElm.innerHTML = html() | ||||
|       this._DialogObject.contentAppChild(contentElm) | ||||
|  | ||||
|       //时间轴 | ||||
|       let _that = this | ||||
|       this.timeLine = new TimeLine(this.sdk, this.options.speed) | ||||
|       // this.timeLine.setSpeed(1000) | ||||
|       this.timeLine.moveComplay(item => { | ||||
|         let timeData = _that.time + " " + item | ||||
|         _that.viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date(timeData)); | ||||
|         _that.viewer.scene.requestRender(); | ||||
|  | ||||
|  | ||||
|       }) | ||||
|       let jeDateObject | ||||
|       let printDateElm = contentElm.getElementsByClassName('sunshine-date')[0] | ||||
|       let text | ||||
|  | ||||
|       jeDateObject = jeDate(printDateElm, { | ||||
|         format: "YYYY-MM-DD", | ||||
|         isinitVal: true, | ||||
|         isClear: false, | ||||
|         donefun: function (obj) { | ||||
|           this.time = obj.val | ||||
|  | ||||
|           const now = new Date(); | ||||
|           let timeData = now.setHours(0, 0, 0, 0); // 设置为当天0点 | ||||
|           _that.viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date(timeData)); | ||||
|  | ||||
|           _that.timeLine.updateTime(timeData) | ||||
|         } | ||||
|       }); | ||||
|       if (this.time) { | ||||
|         jeDateObject.setValue(this.time) | ||||
|       } | ||||
|       else { | ||||
|         jeDateObject.nowBtn && jeDateObject.nowBtn() | ||||
|         this.time = jeDateObject.getValue() | ||||
|       } | ||||
|  | ||||
|       let all_elm = contentElm.getElementsByTagName("*") | ||||
|       this._EventBinding.on(this, all_elm) | ||||
|       this._elms = this._EventBinding.element | ||||
|       this._elms.color = [jeDateObject] | ||||
|     } 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.time = this.originalOptions.time | ||||
|     this.speed = this.originalOptions.speed | ||||
|     this.darkness = this.originalOptions.darkness | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * 飞到对应实体 | ||||
|    */ | ||||
|   async flyTo(options = {}) { | ||||
|   } | ||||
|   /** | ||||
|    * 删除 | ||||
|    */ | ||||
|   async remove() { | ||||
|  | ||||
|     this.viewer.scene.globe.enableLighting = false | ||||
|     this.viewer.shadows = false | ||||
|     this.viewer.clock.multiplier = 1.0 | ||||
|     this.viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date()); | ||||
|     this.entity = null | ||||
|     this.timeLine.clear() | ||||
|  | ||||
|     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() { } | ||||
| } | ||||
|  | ||||
							
								
								
									
										133
									
								
								src/Global/efflect/Sunshine/timeLIne.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,133 @@ | ||||
| export default class TimeLine { | ||||
|   constructor(sdk, speed) { | ||||
|     this.sdk = { ...sdk }; | ||||
|     this.progress = document.getElementById('progress'); | ||||
|     this.handle = document.getElementById('handle'); | ||||
|     this.timeline = document.getElementById('timeline'); | ||||
|     this.currentTime = document.getElementById('currentTime'); | ||||
|     this.timelineCon = document.getElementsByClassName('timeline-container')[0]; | ||||
|     this.speed = speed; | ||||
|     this.animationId; | ||||
|     this.startTime = Date.now(); | ||||
|     this.manualPosition = null; | ||||
|     this.isDragging = false; | ||||
|     this.pauseed = false; | ||||
|     this.time = ''; | ||||
|     this.update = this.update.bind(this); | ||||
|  | ||||
|     TimeLine.init(this) | ||||
|   } | ||||
|   static init(that) { | ||||
|     for (let i = 0; i <= 24; i++) { | ||||
|       if (i % 6 === 0) { | ||||
|         const label = document.createElement('div'); | ||||
|         label.className = 'time-mark'; | ||||
|         label.textContent = `${i}:00`; | ||||
|         label.style.left = `${(i / 24) * 100}%`; | ||||
|         document.getElementsByClassName('time-marks')[0].appendChild(label) | ||||
|       } | ||||
|     } | ||||
|  | ||||
|  | ||||
|     that.startTime = Date.now() - ((that.manualPosition || 0) * 86400 * 1000 / that.speed); | ||||
|  | ||||
|     that.timeline.addEventListener('mousedown', (e) => { | ||||
|       that.isDragging = true; | ||||
|       e.preventDefault(); | ||||
|     }); | ||||
|  | ||||
|     that.timeline.addEventListener('mousemove', (e) => { | ||||
|       if (!that.isDragging) return; | ||||
|  | ||||
|       const rect = that.timeline.getBoundingClientRect(); | ||||
|       let pos = (e.clientX - rect.left) / rect.width; | ||||
|       pos = Math.max(0, Math.min(1, pos)); | ||||
|  | ||||
|       that.manualPosition = pos; | ||||
|       that.progress.style.width = `${pos * 100}%`; | ||||
|  | ||||
|       const seconds = pos * 86400; | ||||
|       that.currentTime.textContent = that.formatTime(seconds); | ||||
|     }); | ||||
|     that.update(); | ||||
|  | ||||
|     document.getElementById('timePause').addEventListener('click', function () { | ||||
|       that.pauseed = !that.pauseed; | ||||
|       if (that.pauseed) { | ||||
|         document.getElementById('timePause').textContent = '播放'; | ||||
|         that.animationId && cancelAnimationFrame(that.animationId); | ||||
|         that.pausedTime = Date.now(); // 记录暂停时刻 | ||||
|         that.sdk.viewer.clock.shouldAnimate = false | ||||
|       } else { | ||||
|         document.getElementById('timePause').textContent = '暂停'; | ||||
|         that.manualPosition = null | ||||
|  | ||||
|         const pausedDuration = Date.now() - that.pausedTime; | ||||
|         that.startTime += pausedDuration; // 补偿暂停期间的时间差 | ||||
|         that.sdk.viewer.clock.shouldAnimate = true | ||||
|         that.update(); // 重启动画循环 | ||||
|       } | ||||
|     }); | ||||
|   } | ||||
|   moveComplay(func) { | ||||
|     let that = this | ||||
|     that.timeline.addEventListener('mouseup', () => { | ||||
|       that.isDragging = false; | ||||
|       if (that.manualPosition !== null) { | ||||
|         // that.sdk.viewer.clock.shouldAnimate = true | ||||
|         that.startTime = Date.now() - (that.manualPosition * 86400 * 1000 / that.speed); | ||||
|         that.manualPosition = null; | ||||
|  | ||||
|         if (!that.pauseed) { | ||||
|           that.update() | ||||
|           func(that.time) | ||||
|         } else { | ||||
|           that.pausedTime = Date.now(); // 记录暂停时刻 | ||||
|           func(that.currentTime.textContent) | ||||
|         } | ||||
|  | ||||
|       } | ||||
|     }); | ||||
|   } | ||||
|   formatTime(seconds) { | ||||
|     const hrs = Math.floor(seconds / 3600).toString().padStart(2, '0'); | ||||
|     const mins = Math.floor((seconds % 3600) / 60).toString().padStart(2, '0'); | ||||
|     const secs = Math.floor(seconds % 60).toString().padStart(2, '0'); | ||||
|     return `${hrs}:${mins}:${secs}`; | ||||
|   } | ||||
|  | ||||
|   update() { | ||||
|     if (this.manualPosition !== null) return; | ||||
|  | ||||
|     const elapsed = (Date.now() - this.startTime) * this.speed; | ||||
|     const totalSeconds = elapsed / 1000; | ||||
|     const daySeconds = totalSeconds % 86400; | ||||
|     const percentage = daySeconds / 86400; | ||||
|  | ||||
|     this.progress.style.width = `${percentage * 100}%`; | ||||
|     this.time = this.formatTime(daySeconds) | ||||
|     this.currentTime.textContent = this.time; | ||||
|     this.animationId = requestAnimationFrame(this.update); | ||||
|   } | ||||
|   setSpeed(v) { | ||||
|     const currentProgress = this.manualPosition ?? | ||||
|       (Date.now() - this.startTime) * this.speed / (86400 * 1000); | ||||
|  | ||||
|     this.speed = v; | ||||
|     this.startTime = Date.now() - (currentProgress * 86400 * 1000 / this.speed); | ||||
|     this.manualPosition = null; | ||||
|     this.update(); | ||||
|  | ||||
|   } | ||||
|   updateTime() { | ||||
|     this.startTime = Date.now() - (this.manualPosition * 86400 * 1000 / this.speed); | ||||
|     this.manualPosition = null; | ||||
|     this.update(); | ||||
|   } | ||||
|   clear() { | ||||
|     this.animationId && cancelAnimationFrame(this.animationId); | ||||
|     this.progress.style.width = '0%'; | ||||
|     this.currentTime.textContent = '00:00:00'; | ||||
|   } | ||||
|  | ||||
| } | ||||
| @ -183,6 +183,8 @@ import Dialog from '../Obj/Element/Dialog' | ||||
| import newAirLine from '../Obj/AirLine/pointRoute.js' | ||||
| import Frustum from '../Obj/AirLine/frustum' | ||||
| import DrawTakeOff from '../Obj/AirLine/DrawTakeOff' | ||||
| import FlowLine from '../Obj/Base/FlowLine' | ||||
| import Sunshine from '../Global/efflect/Sunshine' | ||||
|  | ||||
| const YJEarthismeasuring = Symbol('测量状态') | ||||
| const screenRecord = Symbol('录屏对象') | ||||
| @ -253,7 +255,8 @@ if (!window.YJ) { | ||||
|       newAirLine, | ||||
|       FRUSTUN: Frustum, | ||||
|       // GenerateRoute | ||||
|       Dialog | ||||
|       Dialog, | ||||
|       FlowLine | ||||
|     }, | ||||
|     YJEarth, | ||||
|     Tools, | ||||
| @ -292,7 +295,7 @@ if (!window.YJ) { | ||||
|         cease: FlyRoamCease | ||||
|       }, | ||||
|       flyTo, | ||||
|       efflect: { rain, snow, fog, nightVision, skyStarry, illumination }, | ||||
|       efflect: { rain, snow, fog, nightVision, skyStarry, illumination, Sunshine }, | ||||
|       CameraController, | ||||
|       CesiumContainer, | ||||
|       setBillboardDefaultUrl, | ||||
|  | ||||
							
								
								
									
										76
									
								
								src/Obj/Base/FlowLine/_element.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,76 @@ | ||||
| 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"> | ||||
|                 <span class="label">颜色</span> | ||||
|                 <div class="flowLine-color"></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="" min="1" max="99999" @model="pointNumber"> | ||||
|                     <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="width"> | ||||
|                     <span class="arrow"></span> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
|     <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="" min="0" max="999999" step="1" @model="height"> | ||||
|                     <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="0" step="1" @model="heightDifference"> | ||||
|                     <span class="arrow"></span> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
|     <div class="div-item"> | ||||
|         <div class="row"> | ||||
|             <div class="col"> | ||||
|                 <span class="label">单次运动时长(s)</span> | ||||
|                 <div class="input-number input-number-unit-1"> | ||||
|                     <input class="input" type="number" title="" max="999999999" min="1" step="1" @model="duration"> | ||||
|                     <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="1" min="0.01" step="0.01" @model="lineBackAlpha"> | ||||
|                     <span class="arrow"></span> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
|     <span class="custom-divider"></span> | ||||
|     ` | ||||
| } | ||||
|  | ||||
| export { html } | ||||
							
								
								
									
										92
									
								
								src/Obj/Base/FlowLine/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; | ||||
							
								
								
									
										476
									
								
								src/Obj/Base/FlowLine/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,476 @@ | ||||
| /** | ||||
|  * @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 DrawRect from '../../../Draw/drawRect' | ||||
| import drawPolygon from '../../../Draw/drawPolygon' | ||||
| import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen' | ||||
| import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global' | ||||
| import FlowLineMaterialProperty from "../../Materail/FlowLineMaterialProperty"; | ||||
|  | ||||
| class FlowLine extends Base { | ||||
|   /** | ||||
|    * @constructor | ||||
|    * @param sdk | ||||
|    * @description 流光飞线 | ||||
|    * @param options {object} 流光飞线属性 | ||||
|    * @param options.name=未命名对象 {string} 名称 | ||||
|    * @param options.pointNumber=300 {number} 线数量 | ||||
|    * @param options.height=200 {number} 线高度 | ||||
|    * @param options.heightDifference=3000 {number} 线高度差 | ||||
|    * @param options.width=2 {number} 线宽 | ||||
|    * @param options.duration=10.0 {number} 单次运动时间 | ||||
|    * @param options.color=rgba(255,255,255,1) {string} 颜色 | ||||
|    * @param options.lineBackAlpha=0.05 {number} 轨迹颜色(不能为0) | ||||
|    * @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.pointNumber = options.pointNumber || 200 | ||||
|     this.options.height = options.height || 200 | ||||
|     this.options.heightDifference = options.heightDifference || 3000 | ||||
|     this.options.width = options.width || 2 | ||||
|     this.options.duration = options.duration || 10.0 | ||||
|     this.options.color = options.color || "rgba(255,255,255,1)" | ||||
|     this.options.lineBackAlpha = options.lineBackAlpha || 0.05 | ||||
|     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.sdk.addIncetance(this.options.id, this) | ||||
|     FlowLine.create(this) | ||||
|   } | ||||
|  | ||||
|   // 创建水面 | ||||
|   static create(that) { | ||||
|     // let Draw = new DrawRect(that.sdk) | ||||
|     // Draw.start((a, positions) => { | ||||
|     //   that.positions = positions | ||||
|     //   that.getLine(that, that.positions) | ||||
|     //   that.edit(true) | ||||
|     // }) | ||||
|  | ||||
|     let Draw = new drawPolygon(that.sdk) | ||||
|     Draw.start((a, positions) => { | ||||
|       that.positionArea = positions | ||||
|       let posis = that.getRandomPointsInCesiumPolygon(positions, that.options.pointNumber) | ||||
|       that.positions = posis | ||||
|       that.getLine(that, posis) | ||||
|       that.edit(true) | ||||
|     }) | ||||
|   } | ||||
|   getRandomPointsInCesiumPolygon(positions, count) { | ||||
|     let lons = [], lats = [], posi = [] | ||||
|     positions.forEach(item => { | ||||
|       lons.push(item.lng) | ||||
|       lats.push(item.lat) | ||||
|       posi.push([item.lng, item.lat]) | ||||
|     }) | ||||
|     posi.push([posi[0][0], posi[0][1]]) | ||||
|     const minLon = Math.min(...lons), maxLon = Math.max(...lons); | ||||
|     const minLat = Math.min(...lats), maxLat = Math.max(...lats); | ||||
|  | ||||
|     const points = []; | ||||
|     while (points.length < count) { | ||||
|       const lon = minLon + Math.random() * (maxLon - minLon); | ||||
|       const lat = minLat + Math.random() * (maxLat - minLat); | ||||
|       // const cartesian = Cesium.Cartesian3.fromDegrees(lon, lat); | ||||
|       let point = turf.point([lon, lat]); | ||||
|       const polygon = turf.polygon([ | ||||
|         posi | ||||
|       ]); | ||||
|  | ||||
|       const isInside = turf.booleanPointInPolygon(point, polygon); | ||||
|       if (isInside) { | ||||
|         points.push([ | ||||
|           lon, | ||||
|           lat | ||||
|         ]); | ||||
|       } | ||||
|     } | ||||
|     return points; | ||||
|   } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|   getLine(that, positions) { | ||||
|     let num = 0 | ||||
|     let celiangEntity = null | ||||
|     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)) | ||||
|     } | ||||
|     celiangEntity = that.viewer.entities.add(new Cesium.Entity({ id: that.options.id, show: that.options.show })) | ||||
|  | ||||
|     positions.forEach((item, index) => { | ||||
|       let point = item | ||||
|       //根据点设置起始点位置 | ||||
|       let start = Cesium.Cartesian3.fromDegrees(point[0], point[1], 0) | ||||
|       //根据点设置结束点位置 | ||||
|       let end = Cesium.Cartesian3.fromDegrees(point[0], point[1], that.options.height + Math.random() * that.options.heightDifference) | ||||
|       //创建线 | ||||
|       that.viewer.entities.add({ | ||||
|         parent: celiangEntity, | ||||
|         polyline: { | ||||
|           positions: [start, end], | ||||
|           width: 2, | ||||
|           // material:Cesium.Color.RED | ||||
|           material: new Cesium.FlowLineMaterialProperty({ | ||||
|             color: that.options.color, | ||||
|             duration: that.options.duration, | ||||
|             lineBackAlpha: that.options.lineBackAlpha, | ||||
|             num: num | ||||
|           }) | ||||
|         } | ||||
|       }) | ||||
|     }); | ||||
|  | ||||
|   } | ||||
|  | ||||
|   get color() { | ||||
|     return this.options.color | ||||
|   } | ||||
|  | ||||
|   set color(v) { | ||||
|     this.options.color = v | ||||
|     let entity = this.viewer.entities.getById(this.options.id) | ||||
|     if (entity) { | ||||
|       entity._children.forEach(item => { | ||||
|         item.polyline.material.color = Cesium.Color.fromCssColorString(v) | ||||
|       }) | ||||
|     } | ||||
|  | ||||
|     if (this._elms.color) { | ||||
|       this._elms.color.forEach((item, i) => { | ||||
|         let picker = new ewPlugins('colorpicker', { | ||||
|           el: item.el, | ||||
|           size: 'mini',//颜色box类型 | ||||
|           alpha: true,//是否开启透明度 | ||||
|           defaultColor: v, | ||||
|           disabled: false,//是否禁止打开颜色选择器 | ||||
|           openPickerAni: 'opacity',//打开颜色选择器动画 | ||||
|           sure: (c) => { | ||||
|             this.color = c | ||||
|           },//点击确认按钮事件回调 | ||||
|           clear: () => { | ||||
|             this.color = 'rgba(255,255,255,1)' | ||||
|           },//点击清空按钮事件回调 | ||||
|         }) | ||||
|         this._elms.color[i] = picker | ||||
|       }) | ||||
|     } | ||||
|   } | ||||
|  | ||||
|  | ||||
|  | ||||
|   get pointNumber() { | ||||
|     return this.options.pointNumber | ||||
|   } | ||||
|   set pointNumber(v) { | ||||
|     this.options.pointNumber = v | ||||
|     let entity = this.viewer.entities.getById(this.options.id) | ||||
|     if (entity) { | ||||
|       let posis = this.getRandomPointsInCesiumPolygon(this.positionArea, this.options.pointNumber) | ||||
|       this.positions = posis | ||||
|       this.getLine(this, posis) | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   get height() { | ||||
|     return this.options.height | ||||
|   } | ||||
|  | ||||
|   set height(v) { | ||||
|     this.options.height = v | ||||
|     let entity = this.viewer.entities.getById(this.options.id) | ||||
|     if (entity) { | ||||
|       this.getLine(this, this.positions) | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   get heightDifference() { | ||||
|     return this.options.heightDifference | ||||
|   } | ||||
|  | ||||
|   set heightDifference(v) { | ||||
|     this.options.heightDifference = v | ||||
|     let entity = this.viewer.entities.getById(this.options.id) | ||||
|     if (entity) { | ||||
|       this.getLine(this, this.positions) | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   get width() { | ||||
|     return this.options.width | ||||
|   } | ||||
|  | ||||
|   set width(v) { | ||||
|     this.options.width = v | ||||
|     let entity = this.viewer.entities.getById(this.options.id) | ||||
|     if (entity) { | ||||
|       entity._children.forEach(item => { | ||||
|         item.polyline.width = v | ||||
|       }) | ||||
|     } | ||||
|   } | ||||
|   get duration() { | ||||
|     return this.options.duration | ||||
|   } | ||||
|   set duration(v) { | ||||
|     this.options.duration = v | ||||
|     let entity = this.viewer.entities.getById(this.options.id) | ||||
|     if (entity) { | ||||
|       entity._children.forEach(item => { | ||||
|         item.polyline.material.duration = v | ||||
|       }) | ||||
|     } | ||||
|   } | ||||
|   get lineBackAlpha() { | ||||
|     return this.options.lineBackAlpha | ||||
|   } | ||||
|   set lineBackAlpha(v) { | ||||
|     this.options.lineBackAlpha = v | ||||
|     let entity = this.viewer.entities.getById(this.options.id) | ||||
|     if (entity) { | ||||
|       entity._children.forEach(item => { | ||||
|         item.polyline.material.lineBackAlpha = 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 = '飞线' | ||||
|           } | ||||
|           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() | ||||
|         }, | ||||
|         // removeCallBack: () => { | ||||
|         //   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() | ||||
|         }, | ||||
|         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 ewPlugins('colorpicker', { | ||||
|         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 | ||||
|       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 | ||||
|       // } | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   reset() { | ||||
|     if (!this.viewer.entities.getById(this.options.id)) { | ||||
|       return | ||||
|     } | ||||
|     this.name = this.originalOptions.name | ||||
|     this.pointNumber = this.originalOptions.pointNumber | ||||
|     this.height = this.originalOptions.height | ||||
|     this.heightDifference = this.originalOptions.heightDifference | ||||
|     this.width = this.originalOptions.width | ||||
|     this.duration = this.originalOptions.duration | ||||
|     this.color = this.originalOptions.color | ||||
|     this.lineBackAlpha = this.originalOptions.lineBackAlpha | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * 飞到对应实体 | ||||
|    */ | ||||
|   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() { | ||||
|     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)) | ||||
|     } | ||||
|     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 FlowLine | ||||
| @ -9,22 +9,15 @@ function html(that) { | ||||
|                 <span class="label">名称</span> | ||||
|                 <input class="input" maxlength="40" type="text" @model="name"> | ||||
|             </div> | ||||
|             <div class="col" style="flex: 0 0 54%;"> | ||||
|             <div class="col" style="flex: 0 0 56%;"> | ||||
|                 <div> | ||||
|                     <div class="row"> | ||||
|                         <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"> | ||||
|                             <div class="input-select-unit"></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> | ||||
| @ -48,7 +41,7 @@ function html(that) { | ||||
|                                 <span class="unit">m</span> | ||||
|                                 <span class="arrow"></span> | ||||
|                             </div> | ||||
|                             <button class="confirm height-confirm" style="margin-left: 5px;">确认</button> | ||||
|                             <button class="confirm height-confirm" style="margin-left: 5px;">应用</button> | ||||
|                         </div> | ||||
|                     </div> | ||||
|                     <div class="row"> | ||||
| @ -72,7 +65,7 @@ function html(that) { | ||||
|                             <span class="label">线条颜色</span> | ||||
|                             <div class="color"></div> | ||||
|                         </div> | ||||
|                         <div class="col"> | ||||
|                         <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="1" max="999" @model="lineWidth"> | ||||
| @ -80,7 +73,7 @@ function html(that) { | ||||
|                                 <span class="arrow"></span> | ||||
|                             </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> | ||||
|                             <div class="input-select-line-type"></div> | ||||
|                         </div> | ||||
| @ -90,11 +83,33 @@ function html(that) { | ||||
|                             <span class="label">首尾相连</span> | ||||
|                             <input class="btn-switch" type="checkbox" @model="noseToTail"> | ||||
|                         </div> | ||||
|                         <div class="col"> | ||||
|                         <div class="col" style="flex: 0 0 33%;"> | ||||
|                             <span class="label">线段圆滑</span> | ||||
|                             <input class="btn-switch" type="checkbox" @model="smooth"> | ||||
|                         </div> | ||||
|                         <div class="col" style="flex: 0 0 37%;"> | ||||
|                         </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="0.1" @model="speed"> | ||||
|                                 <span class="unit">s</span> | ||||
|                                 <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"> | ||||
| @ -102,7 +117,7 @@ function html(that) { | ||||
|                             <span class="label">线段缓冲</span> | ||||
|                             <input class="btn-switch" type="checkbox" @model="extend"> | ||||
|                         </div> | ||||
|                         <div class="col"> | ||||
|                         <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" data-min="0.01" max="999999" @model="extendWidth"> | ||||
| @ -110,7 +125,7 @@ function html(that) { | ||||
|                                 <span class="arrow"></span> | ||||
|                             </div> | ||||
|                         </div> | ||||
|                         <div class="col"> | ||||
|                         <div class="col" style="flex: 0 0 37%;"> | ||||
|                             <span class="label">缓冲颜色</span> | ||||
|                             <div class="extendColor"></div> | ||||
|                         </div> | ||||
|  | ||||
| @ -40,9 +40,11 @@ class eventBinding { | ||||
|                     value = Number(value) | ||||
|                     if ((e.target.max) && value > Number(e.target.max)) { | ||||
|                       value = Number(e.target.max) | ||||
|                       e.target.value = value | ||||
|                     } | ||||
|                     if ((e.target.min) && value < Number(e.target.min)) { | ||||
|                       value = Number(e.target.min) | ||||
|                       e.target.value = value | ||||
|                     } | ||||
|                     if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) { | ||||
|                       value = Number(e.target.dataset.min) | ||||
|  | ||||
| @ -13,7 +13,6 @@ import MouseTip from '../../../MouseTip' | ||||
| import Controller from '../../../Controller/index' | ||||
| import { syncData } from '../../../Global/MultiViewportMode' | ||||
| import { legp } from '../../Element/datalist' | ||||
| import { getFontList, getFontFamilyName } from '../../Element/fontSelect' | ||||
| import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen' | ||||
| import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global' | ||||
|  | ||||
| @ -58,8 +57,13 @@ class PolylineObject extends Base { | ||||
|     this.options['nose-to-tail'] = options['nose-to-tail'] || false | ||||
|     this.options.smooth = options.smooth || false | ||||
|     this.options.extend = options.extend || false | ||||
|     this.options.rotate = options.rotate || true | ||||
|     this.options.space = options.space || 0.1 | ||||
|     this.options.speed = options.speed || 1 | ||||
|     this.options.dashSize = options.dashSize || 0.03 | ||||
|     this.options['length-unit'] = options['length-unit'] || '米' | ||||
|     this.options['fit-length-unit'] = options['fit-length-unit'] || '米' | ||||
|     this.options['words-name'] = options['words-name'] || '空间长度' | ||||
|     this.options['extend-width'] = | ||||
|       options['extend-width'] || options['extend-width'] === 0 | ||||
|         ? options['extend-width'] | ||||
| @ -78,7 +82,6 @@ class PolylineObject extends Base { | ||||
|         options.label.fontSize || options.label.fontSize === 0 | ||||
|           ? options.label.fontSize | ||||
|           : 20, | ||||
|       fontFamily: options.label.fontFamily ? options.label.fontFamily : 0, | ||||
|       color: options.label.color || '#ffffff', | ||||
|       lineWidth: | ||||
|         options.label.lineWidth || options.label.lineWidth === 0 | ||||
| @ -118,6 +121,7 @@ class PolylineObject extends Base { | ||||
|     this.options.attributeType = options.attributeType || 'richText' | ||||
|     this.operate = {} | ||||
|     this.nodePoints = [] | ||||
|     this.unitNum = 0 | ||||
|     this.Dialog = _Dialog | ||||
|     if (!this.options.positions || this.options.positions.length < 2) { | ||||
|       this._error = '线段最少需要两个坐标!' | ||||
| @ -146,7 +150,7 @@ class PolylineObject extends Base { | ||||
|   } | ||||
|   set color(v) { | ||||
|     this.options.color = v | ||||
|     this.entity.polyline.material = this.getMaterial(v, this.options.type) | ||||
|     this.entity.polyline.material = this.getMaterial(v, this.options.type, this.entity, this.options) | ||||
|     if (this._elms.color) { | ||||
|       this._elms.color.forEach((item, i) => { | ||||
|         let colorPicker = new ewPlugins('colorpicker', { | ||||
| @ -168,12 +172,56 @@ class PolylineObject extends Base { | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   get speed() { | ||||
|     return this.options.speed | ||||
|   } | ||||
|  | ||||
|   set speed(v) { | ||||
|     this.options.speed = v | ||||
|     this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) | ||||
|   } | ||||
|   get dashSize() { | ||||
|     return this.options.dashSize | ||||
|   } | ||||
|  | ||||
|   set dashSize(v) { | ||||
|     this.options.dashSize = v | ||||
|     this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) | ||||
|   } | ||||
|  | ||||
|   get rotate() { | ||||
|     return this.options.rotate | ||||
|   } | ||||
|  | ||||
|   set rotate(v) { | ||||
|     this.options.rotate = v | ||||
|     PolylineObject.closeNodeEdit(this) | ||||
|     this._elms.rotate && | ||||
|       this._elms.rotate.forEach(item => { | ||||
|         item.checked = v | ||||
|       }) | ||||
|  | ||||
|     this.options.rotate = v | ||||
|     this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) | ||||
|   } | ||||
|  | ||||
|   get space() { | ||||
|     return this.options.space | ||||
|   } | ||||
|  | ||||
|   set space(v) { | ||||
|     this.options.space = v | ||||
|     this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) | ||||
|   } | ||||
|  | ||||
|   get length() { | ||||
|     return this.options.length | ||||
|   } | ||||
|  | ||||
|   set length(v) { | ||||
|     this.options.length = v | ||||
|     //判断数值是否大于1000m | ||||
|  | ||||
|     this._elms.length && | ||||
|       this._elms.length.forEach(item => { | ||||
|         item.value = v | ||||
| @ -196,24 +244,63 @@ class PolylineObject extends Base { | ||||
|     return this.options['length-unit'] | ||||
|   } | ||||
|   set lengthUnit(v) { | ||||
|     this.unitNum++ | ||||
|     this.options['length-unit'] = v | ||||
|     this._elms.lengthUnit && | ||||
|       this._elms.lengthUnit.forEach(item => { | ||||
|         item.value = v | ||||
|       }) | ||||
|     if (this.options.lengthByMeter) { | ||||
|       if (this.unitNum > 2) { | ||||
|         switch (v) { | ||||
|           case '米': | ||||
|           this.length = this.options.lengthByMeter | ||||
|             this.length = this.noseToTail ? this.options.fitLengthByMeter : this.options.lengthByMeter | ||||
|             break | ||||
|           case '千米': | ||||
|           this.length = (this.options.lengthByMeter / 1000).toFixed(5) | ||||
|             this.length = this.noseToTail ? (this.options.fitLengthByMeter / 1000).toFixed(5) : (this.options.lengthByMeter / 1000).toFixed(5) | ||||
|             break | ||||
|           default: | ||||
|           this.length = this.options.lengthByMeter | ||||
|             this.length = this.noseToTail ? this.options.fitLengthByMeter : this.options.lengthByMeter | ||||
|         } | ||||
|       } else { | ||||
|         let length = this.noseToTail ? this.options.fitLengthByMeter : this.options.lengthByMeter | ||||
|         this.lengthUnit = length > 1000 || length == 1000 ? '千米' : '米' | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|   get wordsName() { | ||||
|     return this.options['words-name'] | ||||
|   } | ||||
|   set wordsName(v) { | ||||
|     this.options['words-name'] = v | ||||
|     this._elms.wordsName && | ||||
|       this._elms.wordsName.forEach(item => { | ||||
|         item.value = v | ||||
|       }) | ||||
|  | ||||
|     let _this = this | ||||
|  | ||||
|     if (!this.noseToTail) { | ||||
|       this.computeDistance( | ||||
|         this.options.positions, | ||||
|         2, | ||||
|         v | ||||
|       ).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 = '米' | ||||
|         } | ||||
|  | ||||
|       }) | ||||
|     } else { | ||||
|  | ||||
|     } | ||||
|  | ||||
|   } | ||||
|  | ||||
|   get fitLengthUnit() { | ||||
|     return this.options['fit-length-unit'] | ||||
| @ -262,19 +349,82 @@ class PolylineObject extends Base { | ||||
|   set lineType(v) { | ||||
|     let lineTypeData = [ | ||||
|       { | ||||
|         name: '实线', | ||||
|         name: '<i class="icon line"></i>实线', | ||||
|         value: '实线', | ||||
|         key: 0 | ||||
|         key: 0, | ||||
|         icon: 'line' | ||||
|       }, | ||||
|       { | ||||
|         name: '虚线', | ||||
|         name: '<i class="icon dash-line"></i>虚线', | ||||
|         value: '虚线', | ||||
|         key: 1 | ||||
|         key: 1, | ||||
|         icon: 'dash-line' | ||||
|       }, | ||||
|       { | ||||
|         name: '泛光', | ||||
|         name: '<i class="icon light-line"></i>泛光', | ||||
|         value: '泛光', | ||||
|         key: 2 | ||||
|         key: 2, | ||||
|         icon: 'light-line' | ||||
|       }, | ||||
|       { | ||||
|         name: '<i class="icon tail-line"></i>尾迹光线', | ||||
|         value: '尾迹光线', | ||||
|         key: 3, | ||||
|         icon: 'tail-line' | ||||
|       }, | ||||
|       { | ||||
|         name: '<i class="icon mult-tail-line"></i>多尾迹光线', | ||||
|         value: '多尾迹光线', | ||||
|         key: 4, | ||||
|         icon: 'mult-tail-line' | ||||
|       }, | ||||
|       { | ||||
|         name: '<i class="icon flow-dash-line1"></i>流动虚线1', | ||||
|         value: '流动虚线1', | ||||
|         key: 5, | ||||
|         icon: 'flow-dash-line1' | ||||
|       }, | ||||
|       { | ||||
|         name: '<i class="icon flow-dash-line2"></i>流动虚线2', | ||||
|         value: '流动虚线2', | ||||
|         key: 6, | ||||
|         icon: 'flow-dash-line2' | ||||
|       }, | ||||
|       { | ||||
|         name: '<i class="icon pic-line1"></i>流动箭头1', | ||||
|         value: '流动箭头1', | ||||
|         key: 7, | ||||
|         icon: 'pic-line1' | ||||
|       }, | ||||
|       { | ||||
|         name: '<i class="icon pic-line2"></i>流动箭头2', | ||||
|         value: '流动箭头2', | ||||
|         key: 8, | ||||
|         icon: 'pic-line2' | ||||
|       }, | ||||
|       { | ||||
|         name: '<i class="icon pic-line3"></i>流动箭头3', | ||||
|         value: '流动箭头3', | ||||
|         key: 9, | ||||
|         icon: 'pic-line3' | ||||
|       }, | ||||
|       { | ||||
|         name: '<i class="icon pic-line4"></i>流动箭头4', | ||||
|         value: '流动箭头4', | ||||
|         key: 10, | ||||
|         icon: 'pic-line4' | ||||
|       }, | ||||
|       { | ||||
|         name: '<i class="icon pic-line5"></i>流动箭头5', | ||||
|         value: '流动箭头5', | ||||
|         key: 11, | ||||
|         icon: 'pic-line5' | ||||
|       }, | ||||
|       { | ||||
|         name: '<i class="icon pic-line6"></i>流动箭头6', | ||||
|         value: '流动箭头6', | ||||
|         key: 12, | ||||
|         icon: 'pic-line6' | ||||
|       } | ||||
|     ] | ||||
|     this.options.type = Number(v) | ||||
| @ -283,6 +433,18 @@ class PolylineObject extends Base { | ||||
|         this._elms.lineType && | ||||
|           this._elms.lineType.forEach(item => { | ||||
|             item.value = lineTypeData[i].value | ||||
|             if (2 < item.value && item.value < 13) {//贴图参数 | ||||
|               document.getElementById('dashTextureDom').style.display = 'flex' | ||||
|             } else { | ||||
|               document.getElementById('dashTextureDom').style.display = 'none' | ||||
|             } | ||||
|             if (2 < item.value && item.value < 5) {//尾迹参数 | ||||
|               document.getElementsByClassName('lineSpace')[0].style.display = 'none' | ||||
|               document.getElementsByClassName('lineSpace')[1].style.display = 'none' | ||||
|             } else { | ||||
|               document.getElementsByClassName('lineSpace')[0].style.display = 'flex' | ||||
|               document.getElementsByClassName('lineSpace')[1].style.display = 'flex' | ||||
|             } | ||||
|           }) | ||||
|         break | ||||
|       } | ||||
| @ -291,7 +453,9 @@ class PolylineObject extends Base { | ||||
|       this.entity.polyline && | ||||
|       (this.entity.polyline.material = this.getMaterial( | ||||
|         this.options.color, | ||||
|         this.options.type | ||||
|         this.options.type, | ||||
|         this.entity, | ||||
|         this.options | ||||
|       )) | ||||
|   } | ||||
|   get noseToTail() { | ||||
| @ -312,6 +476,20 @@ class PolylineObject extends Base { | ||||
|       ) | ||||
|       this.renewPolygon(fromDegreesArray) | ||||
|     } | ||||
|     if (v) { | ||||
|       if (this.options.fitLengthByMeter > 1000 || this.options.fitLengthByMeter == 1000) { | ||||
|         document.getElementsByClassName('input-select-unit')[1].querySelectorAll('dd')[1].click() | ||||
|       } else { | ||||
|         document.getElementsByClassName('input-select-unit')[1].querySelectorAll('dd')[0].click() | ||||
|       } | ||||
|  | ||||
|     } else { | ||||
|       if (this.options.lengthByMeter > 1000 || this.options.lengthByMeter == 1000) { | ||||
|         document.getElementsByClassName('input-select-unit')[1].querySelectorAll('dd')[1].click() | ||||
|       } else { | ||||
|         document.getElementsByClassName('input-select-unit')[1].querySelectorAll('dd')[0].click() | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   get smooth() { | ||||
| @ -371,11 +549,11 @@ class PolylineObject extends Base { | ||||
|         break | ||||
|     } | ||||
|  | ||||
|     this.options.lengthByMeter = this.computeDistance( | ||||
|       this.options.positions, | ||||
|       2, | ||||
|       ground | ||||
|     ) | ||||
|     // this.options.lengthByMeter = this.computeDistance( | ||||
|     //   this.options.positions, | ||||
|     //   2, | ||||
|     //   ground | ||||
|     // ) | ||||
|     this.lengthUnit = this.lengthUnit | ||||
|     this._elms.heightMode && (this._elms.heightMode.value = heightModeName) | ||||
|     this._elms.heightModeObject && (this._elms.heightModeObject.legp_searchActive( | ||||
| @ -445,6 +623,7 @@ class PolylineObject extends Base { | ||||
|  | ||||
|   set extendWidth(v) { | ||||
|     this.options['extend-width'] = v | ||||
|     this.heightMode = this.heightMode | ||||
|     this._elms.extendWidth && | ||||
|       this._elms.extendWidth.forEach(item => { | ||||
|         item.value = v | ||||
| @ -507,21 +686,6 @@ 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() { | ||||
|     return this.options.label.color | ||||
|   } | ||||
| @ -1141,7 +1305,6 @@ class PolylineObject extends Base { | ||||
|       ], | ||||
|       text: that.options.name, | ||||
|       fontSize: that.options.label.fontSize, | ||||
|       fontFamily: that.options.label.fontFamily, | ||||
|       color: that.options.label.color, | ||||
|       pixelOffset: that.options.label.pixelOffset, | ||||
|       backgroundColor: that.options.label.backgroundColor, | ||||
| @ -1170,7 +1333,7 @@ class PolylineObject extends Base { | ||||
|         positions: Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArray), | ||||
|         width: that.options.width, | ||||
|         clampToGround: ground, | ||||
|         material: that.getMaterial(that.options.color, that.options.type), | ||||
|         material: that.getMaterial(that.options.color, that.options.type, that.entity, that.options), | ||||
|         zIndex: that.sdk._entityZIndex | ||||
|       } | ||||
|     }) | ||||
| @ -1178,12 +1341,18 @@ class PolylineObject extends Base { | ||||
|     PolylineObject.createLabel(that) | ||||
|     // that.entity.polyline.positionsLngLat = positions | ||||
|     that.renewPolygon(fromDegreesArray) | ||||
|     that.options.lengthByMeter = that.computeDistance(positions, 2, ground) | ||||
|     that.computeDistance( | ||||
|       positions, | ||||
|       2 | ||||
|     ).then(res => { | ||||
|       that.options.lengthByMeter = res | ||||
|       that.lengthUnit = that.options['length-unit'] | ||||
|       syncData(that.sdk, that.options.id) | ||||
|       if (that.options.show) { | ||||
|         setSplitDirection(0, that.options.id) | ||||
|       } | ||||
|     }) | ||||
|  | ||||
|  | ||||
|     // if (this.options['nose-to-tail']) { | ||||
|     //   let array = [] | ||||
| @ -1411,6 +1580,50 @@ class PolylineObject extends Base { | ||||
|           }) | ||||
|         } | ||||
|  | ||||
|         let nameData = [ | ||||
|           { | ||||
|             name: '空间长度', | ||||
|             value: '空间长度' | ||||
|           }, | ||||
|           { | ||||
|             name: '投影长度', | ||||
|             value: '投影长度' | ||||
|           }, | ||||
|           { | ||||
|             name: '地表长度', | ||||
|             value: '地表长度' | ||||
|           } | ||||
|         ] | ||||
|  | ||||
|         let nameDataLegpObject = legp( | ||||
|           this._DialogObject._element.content.getElementsByClassName( | ||||
|             'input-select-unit-box' | ||||
|           )[0], | ||||
|           '.input-select-unit' | ||||
|         ) | ||||
|         if (nameDataLegpObject) { | ||||
|           nameDataLegpObject.legp_search(nameData) | ||||
|           let nameDataLegpElm = this._DialogObject._element.content | ||||
|             .getElementsByClassName('input-select-unit')[0] | ||||
|             .getElementsByTagName('input')[0] | ||||
|           this._elms.wordsName = [nameDataLegpElm] | ||||
|           nameDataLegpElm.value = this.options['words-name'] | ||||
|           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.wordsName = nameData[i].value | ||||
|                 break | ||||
|               } | ||||
|             } | ||||
|           }) | ||||
|         } | ||||
|  | ||||
|         // 原始长度单位 | ||||
|         let unitData = [ | ||||
|           { | ||||
| @ -1427,12 +1640,13 @@ class PolylineObject extends Base { | ||||
|           this._DialogObject._element.content.getElementsByClassName( | ||||
|             'input-select-unit-box' | ||||
|           )[0], | ||||
|           '.input-select-unit' | ||||
|           '.input-select-unit', | ||||
|           1 | ||||
|         ) | ||||
|         if (unitDataLegpObject) { | ||||
|           unitDataLegpObject.legp_search(unitData) | ||||
|           let unitDataLegpElm = this._DialogObject._element.content | ||||
|             .getElementsByClassName('input-select-unit')[0] | ||||
|             .getElementsByClassName('input-select-unit')[1] | ||||
|             .getElementsByTagName('input')[0] | ||||
|           this._elms.lengthUnit = [unitDataLegpElm] | ||||
|           unitDataLegpElm.value = this.options['length-unit'] | ||||
| @ -1451,63 +1665,128 @@ class PolylineObject extends Base { | ||||
|             } | ||||
|           }) | ||||
|         } | ||||
|         // | ||||
|  | ||||
|  | ||||
|         // 拟合长度单位 | ||||
|         let fitUnitData = [ | ||||
|           { | ||||
|             name: '米', | ||||
|             value: '米' | ||||
|           }, | ||||
|           { | ||||
|             name: '千米', | ||||
|             value: '千米' | ||||
|           } | ||||
|         ] | ||||
|         // let fitUnitData = [ | ||||
|         //   { | ||||
|         //     name: '米', | ||||
|         //     value: '米' | ||||
|         //   }, | ||||
|         //   { | ||||
|         //     name: '千米', | ||||
|         //     value: '千米' | ||||
|         //   } | ||||
|         // ] | ||||
|  | ||||
|         let fitUnitDataLegpObject = legp( | ||||
|           this._DialogObject._element.content.getElementsByClassName( | ||||
|             'input-select-fit-unit-box' | ||||
|           )[0], | ||||
|           '.input-select-fit-unit' | ||||
|         ) | ||||
|         if (fitUnitDataLegpObject) { | ||||
|           fitUnitDataLegpObject.legp_search(fitUnitData) | ||||
|           let fitUnitDataLegpElm = this._DialogObject._element.content | ||||
|             .getElementsByClassName('input-select-fit-unit')[0] | ||||
|             .getElementsByTagName('input')[0] | ||||
|           this._elms.fitLengthUnit = [fitUnitDataLegpElm] | ||||
|           fitUnitDataLegpElm.value = this.options['fit-length-unit'] | ||||
|           for (let i = 0; i < fitUnitData.length; i++) { | ||||
|             if (fitUnitData[i].value === fitUnitDataLegpElm.value) { | ||||
|               fitUnitDataLegpObject.legp_searchActive(fitUnitData[i].value) | ||||
|               break | ||||
|             } | ||||
|           } | ||||
|           fitUnitDataLegpElm.addEventListener('input', () => { | ||||
|             for (let i = 0; i < fitUnitData.length; i++) { | ||||
|               if (fitUnitData[i].value === fitUnitDataLegpElm.value) { | ||||
|                 this.fitLengthUnit = fitUnitData[i].value | ||||
|                 break | ||||
|               } | ||||
|             } | ||||
|           }) | ||||
|         } | ||||
|         // let fitUnitDataLegpObject = legp( | ||||
|         //   this._DialogObject._element.content.getElementsByClassName( | ||||
|         //     'input-select-fit-unit-box' | ||||
|         //   )[0], | ||||
|         //   '.input-select-fit-unit' | ||||
|         // ) | ||||
|         // if (fitUnitDataLegpObject) { | ||||
|         //   fitUnitDataLegpObject.legp_search(fitUnitData) | ||||
|         //   let fitUnitDataLegpElm = this._DialogObject._element.content | ||||
|         //     .getElementsByClassName('input-select-fit-unit')[0] | ||||
|         //     .getElementsByTagName('input')[0] | ||||
|         //   this._elms.fitLengthUnit = [fitUnitDataLegpElm] | ||||
|         //   fitUnitDataLegpElm.value = this.options['fit-length-unit'] | ||||
|         //   for (let i = 0; i < fitUnitData.length; i++) { | ||||
|         //     if (fitUnitData[i].value === fitUnitDataLegpElm.value) { | ||||
|         //       fitUnitDataLegpObject.legp_searchActive(fitUnitData[i].value) | ||||
|         //       break | ||||
|         //     } | ||||
|         //   } | ||||
|         //   fitUnitDataLegpElm.addEventListener('input', () => { | ||||
|         //     for (let i = 0; i < fitUnitData.length; i++) { | ||||
|         //       if (fitUnitData[i].value === fitUnitDataLegpElm.value) { | ||||
|         //         this.fitLengthUnit = fitUnitData[i].value | ||||
|         //         break | ||||
|         //       } | ||||
|         //     } | ||||
|         //   }) | ||||
|         // } | ||||
|  | ||||
|         let lineTypeData = [ | ||||
|           { | ||||
|             name: '实线', | ||||
|             name: '<i class="icon line"></i>实线', | ||||
|             value: '实线', | ||||
|             key: 0 | ||||
|             key: 0, | ||||
|             icon: 'line' | ||||
|           }, | ||||
|           { | ||||
|             name: '虚线', | ||||
|             name: '<i class="icon dash-line"></i>虚线', | ||||
|             value: '虚线', | ||||
|             key: 1 | ||||
|             key: 1, | ||||
|             icon: 'dash-line' | ||||
|           }, | ||||
|           { | ||||
|             name: '泛光', | ||||
|             name: '<i class="icon light-line"></i>泛光', | ||||
|             value: '泛光', | ||||
|             key: 2 | ||||
|             key: 2, | ||||
|             icon: 'light-line' | ||||
|           }, | ||||
|           { | ||||
|             name: '<i class="icon tail-line"></i>尾迹光线', | ||||
|             value: '尾迹光线', | ||||
|             key: 3, | ||||
|             icon: 'tail-line' | ||||
|           }, | ||||
|           { | ||||
|             name: '<i class="icon mult-tail-line"></i>多尾迹光线', | ||||
|             value: '多尾迹光线', | ||||
|             key: 4, | ||||
|             icon: 'mult-tail-line' | ||||
|           }, | ||||
|           { | ||||
|             name: '<i class="icon flow-dash-line1"></i>流动虚线1', | ||||
|             value: '流动虚线1', | ||||
|             key: 5, | ||||
|             icon: 'flow-dash-line1' | ||||
|           }, | ||||
|           { | ||||
|             name: '<i class="icon flow-dash-line2"></i>流动虚线2', | ||||
|             value: '流动虚线2', | ||||
|             key: 6, | ||||
|             icon: 'flow-dash-line2' | ||||
|           }, | ||||
|           { | ||||
|             name: '<i class="icon pic-line1"></i>流动箭头1', | ||||
|             value: '流动箭头1', | ||||
|             key: 7, | ||||
|             icon: 'pic-line1' | ||||
|           }, | ||||
|           { | ||||
|             name: '<i class="icon pic-line2"></i>流动箭头2', | ||||
|             value: '流动箭头2', | ||||
|             key: 8, | ||||
|             icon: 'pic-line2' | ||||
|           }, | ||||
|           { | ||||
|             name: '<i class="icon pic-line3"></i>流动箭头3', | ||||
|             value: '流动箭头3', | ||||
|             key: 9, | ||||
|             icon: 'pic-line3' | ||||
|           }, | ||||
|           { | ||||
|             name: '<i class="icon pic-line4"></i>流动箭头4', | ||||
|             value: '流动箭头4', | ||||
|             key: 10, | ||||
|             icon: 'pic-line4' | ||||
|           }, | ||||
|           { | ||||
|             name: '<i class="icon pic-line5"></i>流动箭头5', | ||||
|             value: '流动箭头5', | ||||
|             key: 11, | ||||
|             icon: 'pic-line5' | ||||
|           }, | ||||
|           { | ||||
|             name: '<i class="icon pic-line6"></i>流动箭头6', | ||||
|             value: '流动箭头6', | ||||
|             key: 12, | ||||
|             icon: 'pic-line6' | ||||
|           } | ||||
|         ] | ||||
|         let lineTypeDataLegpObject = legp( | ||||
| @ -1518,6 +1797,11 @@ class PolylineObject extends Base { | ||||
|         ) | ||||
|         if (lineTypeDataLegpObject) { | ||||
|           lineTypeDataLegpObject.legp_search(lineTypeData) | ||||
|  | ||||
|           let iActiveElm2 = document.createElement('i') | ||||
|           iActiveElm2.className = 'icon icon-active' | ||||
|           this._DialogObject._element.content.getElementsByClassName('input-select-line-type')[0].getElementsByClassName('cy_datalist')[0].appendChild(iActiveElm2) | ||||
|  | ||||
|           let lineTypeDataLegpElm = this._DialogObject._element.content | ||||
|             .getElementsByClassName('input-select-line-type')[0] | ||||
|             .getElementsByTagName('input')[0] | ||||
| @ -1526,6 +1810,7 @@ class PolylineObject extends Base { | ||||
|             if (lineTypeData[i].key === this.options.type) { | ||||
|               lineTypeDataLegpObject.legp_searchActive(lineTypeData[i].value) | ||||
|               lineTypeDataLegpElm.value = lineTypeData[i].value | ||||
|               iActiveElm2.className = `icon icon-active ${lineTypeData[i].icon}` | ||||
|               break | ||||
|             } | ||||
|           } | ||||
| @ -1533,12 +1818,32 @@ class PolylineObject extends Base { | ||||
|             for (let i = 0; i < lineTypeData.length; i++) { | ||||
|               if (lineTypeData[i].value === lineTypeDataLegpElm.value) { | ||||
|                 this.lineType = lineTypeData[i].key | ||||
|                 iActiveElm2.className = `icon icon-active ${lineTypeData[i].icon}` | ||||
|  | ||||
|                 //控制参数显隐 | ||||
|                 if (2 < this.lineType && this.lineType < 13) {//贴图参数 | ||||
|                   document.getElementById('dashTextureDom').style.display = 'flex' | ||||
|                 } else { | ||||
|                   document.getElementById('dashTextureDom').style.display = 'none' | ||||
|                 } | ||||
|                 if (2 < this.lineType && this.lineType < 5) {//尾迹参数 | ||||
|                   document.getElementsByClassName('lineSpace')[0].style.display = 'none' | ||||
|                   document.getElementsByClassName('lineSpace')[1].style.display = 'none' | ||||
|                 } else { | ||||
|                   document.getElementsByClassName('lineSpace')[0].style.display = 'flex' | ||||
|                   document.getElementsByClassName('lineSpace')[1].style.display = 'flex' | ||||
|                 } | ||||
|                 break | ||||
|               } | ||||
|             } | ||||
|           }) | ||||
|         } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|         let heightBoxElm = this._DialogObject._element.content.getElementsByClassName('height-box')[0] | ||||
|         let heightElm = heightBoxElm.getElementsByClassName('height')[0] | ||||
|         let heightConfirmElm = this._DialogObject._element.content.getElementsByClassName('height-confirm')[0] | ||||
| @ -1760,37 +2065,6 @@ class PolylineObject extends Base { | ||||
|           this._elms.altInput.push(altInput) | ||||
|           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) | ||||
|     } else { | ||||
|       if (this._DialogObject && this._DialogObject.close) { | ||||
| @ -1893,21 +2167,39 @@ class PolylineObject extends Base { | ||||
|           alt: fromDegreesArray[i + 2] | ||||
|         }) | ||||
|       } | ||||
|       this.options.fitLengthByMeter = this.computeDistance( | ||||
|       // this.options.fitLengthByMeter = this.computeDistance( | ||||
|       //   array, | ||||
|       //   2, | ||||
|       //   ground | ||||
|       // ) | ||||
|       let _this = this | ||||
|       this.computeDistance( | ||||
|         array, | ||||
|         2, | ||||
|         ground | ||||
|       ) | ||||
|         this.options['words-name'] | ||||
|       ).then(res => { | ||||
|         _this.options.fitLengthByMeter | ||||
|       }) | ||||
|     } else { | ||||
|       this.options.fitLengthByMeter = this.computeDistance( | ||||
|       let _this = this | ||||
|       this.computeDistance( | ||||
|         positions, | ||||
|         2, | ||||
|         ground | ||||
|       ) | ||||
|         this.options['words-name'] | ||||
|       ).then(res => { | ||||
|         _this.options.fitLengthByMeter | ||||
|       }) | ||||
|     } | ||||
|     this.fitLengthUnit = this.options['fit-length-unit'] | ||||
|     this.options.lengthByMeter = this.computeDistance(positions, 2, ground) | ||||
|     this.lengthUnit = this.options['length-unit'] | ||||
|     let _this = this | ||||
|     this.computeDistance( | ||||
|       positions, | ||||
|       2, | ||||
|       this.options['words-name'] | ||||
|     ).then(res => { | ||||
|       _this.options.lengthByMeter | ||||
|       _this.lengthUnit = this.options['length-unit'] | ||||
|     }) | ||||
|     return fromDegreesArray | ||||
|   } | ||||
|  | ||||
| @ -1972,10 +2264,6 @@ class PolylineObject extends Base { | ||||
|     this.labelShow = this.originalOptions.label.show | ||||
|     this.labelColor = this.originalOptions.label.color | ||||
|     this.labelFontSize = this.originalOptions.label.fontSize | ||||
|     this.labelFontFamily = this.originalOptions.label.fontFamily | ||||
|     this.labelScaleByDistance = this.originalOptions.label.scaleByDistance | ||||
|     this.labelNear = this.originalOptions.label.near | ||||
|     this.labelFar = this.originalOptions.label.far | ||||
|     this.labelLineWidth = this.originalOptions.label.lineWidth | ||||
|     this.labelPixelOffset = this.originalOptions.label.pixelOffset | ||||
|     this.labelLineColor = this.originalOptions.label.lineColor | ||||
| @ -1987,6 +2275,10 @@ class PolylineObject extends Base { | ||||
|     this.attributeVr = this.options.attribute.vr.content | ||||
|     this.attributeCamera = this.options.attribute.camera.content | ||||
|     this.attributeGoods = this.options.attribute.goods.content | ||||
|     this.rotate = this.originalOptions.rotate | ||||
|     this.speed = this.originalOptions.speed | ||||
|     this.dashSize = this.originalOptions.dashSize | ||||
|     this.space = this.originalOptions.space | ||||
|     this.cameraSelect && this.cameraSelect() | ||||
|     this.goodsSelect && this.goodsSelect() | ||||
|  | ||||
| @ -2039,7 +2331,7 @@ class PolylineObject extends Base { | ||||
|         .value | ||||
|     ) { | ||||
|       this.options.attribute.link.content.push({ | ||||
|         name: '链接', | ||||
|         name: '链接' + (this.options.attribute.link.content.length + 1), | ||||
|         url: this._DialogObject._element.content.getElementsByClassName( | ||||
|           'link_add' | ||||
|         )[0].value | ||||
| @ -2057,7 +2349,7 @@ class PolylineObject extends Base { | ||||
|       // input.addEventListener('change', (event) => { | ||||
|       //   if (input.value) { | ||||
|       //     this.options.attribute.link.content.push({ | ||||
|       //       name: '链接', | ||||
|       //       name: '链接' + (this.options.attribute.link.content.length + 1), | ||||
|       //       url: input.value | ||||
|       //     }) | ||||
|       //     this.attributeLink = this.options.attribute.link.content | ||||
| @ -2067,7 +2359,7 @@ class PolylineObject extends Base { | ||||
|   } | ||||
|   addAttributeLink(link) { | ||||
|     this.options.attribute.link.content.push({ | ||||
|       name: '链接', | ||||
|       name: '链接' + (this.options.attribute.link.content.length + 1), | ||||
|       url: link | ||||
|     }) | ||||
|     this.attributeLink = this.options.attribute.link.content | ||||
| @ -2080,7 +2372,7 @@ class PolylineObject extends Base { | ||||
|       )[0].value | ||||
|     ) { | ||||
|       this.options.attribute.vr.content.push({ | ||||
|         name: '全景图' , | ||||
|         name: '全景图' + (this.options.attribute.vr.content.length + 1), | ||||
|         url: this._DialogObject._element.content.getElementsByClassName( | ||||
|           'vr_add' | ||||
|         )[0].value | ||||
| @ -2096,7 +2388,7 @@ class PolylineObject extends Base { | ||||
|  | ||||
|   addAttributeRr(vr) { | ||||
|     this.options.attribute.vr.content.push({ | ||||
|       name: '全景图' , | ||||
|       name: '全景图' + (this.options.attribute.vr.content.length + 1), | ||||
|       url: vr | ||||
|     }) | ||||
|     this.attributeVr = this.options.attribute.vr.content | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| var legp = function (parentElement, ele) { | ||||
| var legp = function (parentElement, ele, index = 0) { | ||||
|   let targetValue = null | ||||
|   return ({ | ||||
|     that: Array.prototype.slice.call(parentElement.querySelectorAll(ele), 0), | ||||
| @ -16,10 +16,14 @@ var legp = function (parentElement, ele) { | ||||
|         item.style.cssText += "display:none;"; | ||||
|       }); | ||||
|     }, | ||||
|     show: function () { | ||||
|     show: function (num) { | ||||
|       if (num !== undefined) { | ||||
|         legp(parentElement, ele).that[num].style.cssText += "display:block;"; | ||||
|       } else { | ||||
|         legp(parentElement, ele).that.forEach(function (item) { | ||||
|           item.style.cssText += "display:block;"; | ||||
|         }); | ||||
|       } | ||||
|     }, | ||||
|     legp_searchList: function (name) { | ||||
|       let arr = []; | ||||
| @ -29,11 +33,12 @@ var legp = function (parentElement, ele) { | ||||
|       return arr; | ||||
|     }, | ||||
|     legp_search: function (tagData, search = false) { | ||||
|       var domId = legp(parentElement, ele).that[0]; | ||||
|       // var domId = legp(parentElement, ele).that[0]; | ||||
|       var domId = legp(parentElement, ele).that[index]; | ||||
|       if (!domId) { | ||||
|         return | ||||
|       } | ||||
|       var html = `<div class="cy_datalist"><i class="yj-custom-icon-arrow-down"></i>\n  ${search ? '<input type="text" placeholder="\u8F93\u5165\u6216\u9009\u62E9" autocomplete="off">' : '<input type="text" class="datalist" readonly="readonly" placeholder="\u8bf7\u9009\u62e9" autocomplete="off">'}\n                    <dl style="display: none;position: absolute;background: rgba(0, 0, 0, 0.5);color: rgba(var(--color-sdk-base-rgb), 1);border: 1px solid rgba(var(--color-sdk-base-rgb), 0.2);border-radius: 3px;margin: 2px 0px;max-height: 300px;overflow-x: hidden;white-space: nowrap; font-size: 12px;z-index: 8;">\n                    </dl>\n                </div>`; | ||||
|       var html = `<div class="cy_datalist"><i class="yj-custom-icon-arrow-down"></i>\n  ${search ? '<input type="text" placeholder="\u8F93\u5165\u6216\u9009\u62E9" autocomplete="off">' : `<input type="text" class="datalist ${index}" readonly="readonly" placeholder="\u8bf7\u9009\u62e9" autocomplete="off">`}\n                    <dl style="display: none;position: absolute;background: rgba(0, 0, 0, 0.5);color: rgba(var(--color-sdk-base-rgb), 1);border: 1px solid rgba(var(--color-sdk-base-rgb), 0.2);border-radius: 3px;margin: 2px 0px;max-height: 300px;overflow-x: hidden;white-space: nowrap; font-size: 12px;z-index: 8;">\n                    </dl>\n                </div>`; | ||||
|       domId.innerHTML = html; | ||||
|       // domId.appendChild(dom); | ||||
|       //获取当前广告 | ||||
| @ -68,39 +73,42 @@ var legp = function (parentElement, ele) { | ||||
|       } | ||||
|  | ||||
|       //筛选 | ||||
|       legp(parentElement, ".cy_datalist input").that[0].oninput = function () { | ||||
|       legp(parentElement, ".cy_datalist input").that[index].oninput = function (e) { | ||||
|         var val = this.value; //获取input值 | ||||
|  | ||||
|         // legp(parentElement, ".cy_datalist dl").hide(); | ||||
|         legp(parentElement, ".cy_datalist dl").hide(); | ||||
|         if (tagData.length > 0) { | ||||
|           legp(parentElement, ".cy_datalist dl").show(); | ||||
|           var sear_1 = new RegExp(val); | ||||
|           var judge_1 = false; | ||||
|           legp(parentElement, ".cy_datalist dl").that[0].innerHTML = ""; | ||||
|           legp(parentElement, ".cy_datalist dl").that[index].innerHTML = ""; | ||||
|           tagData.forEach(function (item) { | ||||
|             if (sear_1.test(item.name)) { | ||||
|               judge_1 = true; | ||||
|               legp(parentElement, ".cy_datalist dl").that[0].innerHTML += "<dd class=\"" + ((targetValue === item.value) ? 'active' : '') + "\" style=\"margin: 0; padding: 5px 5px; color: #fff;cursor: pointer;\" value=\"" + item.value + "\">" + item.name + "</dd>"; | ||||
|               legp(parentElement, ".cy_datalist dl").that[index].innerHTML += "<dd class=\"" + ((targetValue === item.value) ? 'active' : '') + "\" style=\"margin: 0; padding: 5px 5px; color: #fff;cursor: pointer;\" value=\"" + item.value + "\">" + item.name + "</dd>"; | ||||
|             } | ||||
|           }); | ||||
|           if (!judge_1) { | ||||
|             legp(parentElement, ".cy_datalist dl").that[0].innerHTML = "<dd style=\"padding: 10px 20px; color: #fff;\">\u6682\u65E0\u6570\u636E</dd>"; | ||||
|             legp(parentElement, ".cy_datalist dl").that[index].innerHTML = "<dd style=\"padding: 10px 20px; color: #fff;\">\u6682\u65E0\u6570\u636E</dd>"; | ||||
|           } | ||||
|           myClick(); | ||||
|         } | ||||
|       }; | ||||
|       //显示没被选择的 | ||||
|       legp(parentElement, ".cy_datalist input").that[0].onclick = function (e) { | ||||
|         if(legp(parentElement, ".cy_datalist dl").that[0].style.display === 'none') { | ||||
|       legp(parentElement, ".cy_datalist input").that[index].onclick = function (e) { | ||||
|  | ||||
|         legp(parentElement, ".cy_datalist dl").hide(); | ||||
|         let num = e.srcElement.classList[1] * 1 | ||||
|         num = num || 0 | ||||
|         if (legp(parentElement, ".cy_datalist dl").that[num].style.display === 'none') { | ||||
|           if (tagData.length == 0) { | ||||
|             this.innerHTML = "暂无数据"; | ||||
|           } | ||||
|           else { | ||||
|             legp(parentElement, ".cy_datalist dl").show(); | ||||
|             legp(parentElement, ".cy_datalist dl").show(num); | ||||
|           } | ||||
|           legp(parentElement, ".cy_datalist dl").that[0].innerHTML = ""; | ||||
|           legp(parentElement, ".cy_datalist dl").that[num].innerHTML = ""; | ||||
|           tagData.forEach(function (item) { | ||||
|             legp(parentElement, ".cy_datalist dl").that[0].innerHTML += "<dd class=\"" + ((targetValue === item.value) ? 'active' : '') + "\" style=\"margin: 0; padding: 5px 5px; color: #fff;cursor: pointer;\" value=\"" + item.value + "\">" + item.name + "</dd>"; | ||||
|             legp(parentElement, ".cy_datalist dl").that[num].innerHTML += "<dd class=\"" + ((targetValue === item.value) ? 'active' : '') + "\" style=\"margin: 0; padding: 5px 5px; color: #fff;cursor: pointer;\" value=\"" + item.value + "\">" + item.name + "</dd>"; | ||||
|           }); | ||||
|           myClick(); | ||||
|         } | ||||
|  | ||||
							
								
								
									
										148
									
								
								src/Obj/Materail/FlowDashedLineFlowMaterialProperty.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,148 @@ | ||||
| /* | ||||
|  * @Description: 流动线 | ||||
|  */ | ||||
| function FlowDashedLine() { | ||||
|   class FlowDashedLineFlowMaterialProperty { | ||||
|     constructor(options) { | ||||
|       this._definitionChanged = new Cesium.Event(); | ||||
|       this._color = undefined; | ||||
|       this._speed = undefined; | ||||
|       this._uType = undefined; | ||||
|       this._space = undefined; | ||||
|       this._dashSize = undefined; | ||||
|       this.color = new Cesium.Color.fromCssColorString(options.color || "rgba(255,255,255,1)"); | ||||
|       this.speed = options.speed != undefined ? options.speed : 1.0;//速度 | ||||
|       this.space = options.space || 0.0;//速度 | ||||
|       this.dashSize = options.dashSize || 0.03;//速度 | ||||
|       this.uType = options.uType === undefined ? 1 : options.uType;//类型:0:普通流动线 1:虚化虚线 | ||||
|       this.lineBackAlpha = options.lineBackAlpha || 0.05; | ||||
|     } | ||||
|  | ||||
|     get isConstant() { | ||||
|       return false; | ||||
|     } | ||||
|  | ||||
|     get definitionChanged() { | ||||
|       return this._definitionChanged; | ||||
|     } | ||||
|  | ||||
|     getType(time) { | ||||
|       return Cesium.Material.FlowDashedLineMaterialType; | ||||
|     } | ||||
|  | ||||
|     getValue(time, result) { | ||||
|       if (!Cesium.defined(result)) { | ||||
|         result = {}; | ||||
|       } | ||||
|  | ||||
|       result.color = Cesium.Property.getValueOrDefault( | ||||
|         this._color, | ||||
|         time, | ||||
|         Cesium.Color.RED, | ||||
|         result.color | ||||
|       ); | ||||
|       result.speed = Cesium.Property.getValueOrDefault( | ||||
|         this._speed, | ||||
|         time, | ||||
|         10, | ||||
|         result.speed | ||||
|       ); | ||||
|       result.space = Cesium.Property.getValueOrDefault( | ||||
|         this._space, | ||||
|         time, | ||||
|         10, | ||||
|         result.space | ||||
|       ); | ||||
|       result.dashSize = Cesium.Property.getValueOrDefault( | ||||
|         this._dashSize, | ||||
|         time, | ||||
|         10, | ||||
|         result.dashSize | ||||
|       ); | ||||
|       result.uType = Cesium.Property.getValueOrDefault( | ||||
|         this._uType, | ||||
|         time, | ||||
|         1, | ||||
|         result.uType | ||||
|       ); | ||||
|       result.lineBackAlpha = this.lineBackAlpha; | ||||
|       result.frameNumber = Cesium.getTimestamp(); | ||||
|       return result; | ||||
|     } | ||||
|  | ||||
|     equals(other) { | ||||
|       return ( | ||||
|         this === other || | ||||
|         (other instanceof FlowDashedLineFlowMaterialProperty && | ||||
|           Cesium.Property.equals(this._color, other._color) && | ||||
|           Cesium.Property.equals(this._speed, other.speed) && | ||||
|           Cesium.Property.equals(this._uType, other.uType) && | ||||
|           Cesium.Property.equals(this.lineBackAlpha, other.lineBackAlpha)) | ||||
|       ); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   Object.defineProperties(FlowDashedLineFlowMaterialProperty.prototype, { | ||||
|     color: Cesium.createPropertyDescriptor("color"), | ||||
|     speed: Cesium.createPropertyDescriptor("speed"), | ||||
|     space: Cesium.createPropertyDescriptor("space"), | ||||
|     dashSize: Cesium.createPropertyDescriptor("dashSize"), | ||||
|     uType: Cesium.createPropertyDescriptor("uType"), | ||||
|     transparency: Cesium.createPropertyDescriptor("lineBackAlpha"), | ||||
|   }); | ||||
|  | ||||
|   Cesium.FlowDashedLineFlowMaterialProperty = FlowDashedLineFlowMaterialProperty; | ||||
|   Cesium.Material.FlowDashedLineFlowMaterialProperty = "FlowDashedLineFlowMaterialProperty"; | ||||
|   Cesium.Material.FlowDashedLineMaterialType = "FlowDashedLineMaterialType"; | ||||
|   Cesium.Material.FlowDashedLineMaterialSource = ` | ||||
|       uniform vec4 color; | ||||
|       uniform float speed; | ||||
|       // uniform int uType; | ||||
|       uniform float lineBackAlpha; | ||||
|  | ||||
|       czm_material czm_getMaterial(czm_materialInput materialInput) | ||||
|         { | ||||
|             czm_material material = czm_getDefaultMaterial(materialInput); | ||||
|             vec2 st = materialInput.st; | ||||
|  | ||||
|             float dashSize = 0.1; | ||||
|             float gapSize = space; | ||||
|             // speed现在表示完成一次完整动画循环的秒数 | ||||
|             float progress = speed==0.0 ? 0.0 : fract(frameNumber / 1000.0 / speed); | ||||
|             float pattern = fract(st.x / dashSize * (1.0 + gapSize) + progress / dashSize * (1.0 + gapSize)); | ||||
|             float dash1 = step(0.0, pattern) - step(1.0/(1.0 + gapSize), pattern); | ||||
|             float dash2 = smoothstep(0.0, 0.2, pattern) - | ||||
|                 smoothstep(1.0/(1.0 + gapSize), | ||||
|                         1.0/(1.0 + gapSize) + 0.2, | ||||
|                         pattern); | ||||
|             float dash = (float(uType) != 1.0)?dash1:dash2; | ||||
|             material.alpha = dash; | ||||
|             material.diffuse = color.rgb; | ||||
|             return material; | ||||
|         } | ||||
|        `; | ||||
|  | ||||
|   Cesium.Material._materialCache.addMaterial( | ||||
|     Cesium.Material.FlowDashedLineMaterialType, | ||||
|     { | ||||
|       fabric: { | ||||
|         type: Cesium.Material.FlowDashedLineMaterialType, | ||||
|         uniforms: { | ||||
|           color: new Cesium.Color(1.0, 1.0, 1.0, 1.0), | ||||
|           speed: 1, | ||||
|           space: 0.0, | ||||
|           dashSize: 0.03, | ||||
|           frameNumber: Cesium.getTimestamp(), | ||||
|           uType: 1, | ||||
|           lineBackAlpha: 0.05, | ||||
|         }, | ||||
|         source: Cesium.Material.FlowDashedLineMaterialSource, | ||||
|       }, | ||||
|       translucent: function (material) { | ||||
|         return true; | ||||
|       }, | ||||
|     } | ||||
|   ); | ||||
| } | ||||
|  | ||||
| export { FlowDashedLine } | ||||
							
								
								
									
										113
									
								
								src/Obj/Materail/FlowLineMaterialProperty.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,113 @@ | ||||
| /* | ||||
|  * @Description: 流动线 | ||||
|  */ | ||||
| function FlowLine() { | ||||
|   class FlowLineMaterialProperty { | ||||
|     constructor(options) { | ||||
|       this._definitionChanged = new Cesium.Event(); | ||||
|       this._color = undefined; | ||||
|       this._duration = undefined; | ||||
|       this.color = new Cesium.Color.fromCssColorString(options.color || "rgba(255,255,255,1)"); | ||||
|       this.duration = options.duration || 10.0; | ||||
|       this.lineBackAlpha = options.lineBackAlpha || 0.05; | ||||
|     } | ||||
|  | ||||
|     get isConstant() { | ||||
|       return false; | ||||
|     } | ||||
|  | ||||
|     get definitionChanged() { | ||||
|       return this._definitionChanged; | ||||
|     } | ||||
|  | ||||
|     getType(time) { | ||||
|       return Cesium.Material.FlowLineMaterialType; | ||||
|     } | ||||
|  | ||||
|     getValue(time, result) { | ||||
|       if (!Cesium.defined(result)) { | ||||
|         result = {}; | ||||
|       } | ||||
|  | ||||
|       result.color = Cesium.Property.getValueOrDefault( | ||||
|         this._color, | ||||
|         time, | ||||
|         Cesium.Color.RED, | ||||
|         result.color | ||||
|       ); | ||||
|       result.duration = Cesium.Property.getValueOrDefault( | ||||
|         this._duration, | ||||
|         time, | ||||
|         10, | ||||
|         result.duration | ||||
|       ); | ||||
|       result.lineBackAlpha = this.lineBackAlpha; | ||||
|       result.frameNumber = Cesium.getTimestamp(); | ||||
|       return result; | ||||
|     } | ||||
|  | ||||
|     equals(other) { | ||||
|       return ( | ||||
|         this === other || | ||||
|         (other instanceof FlowLineMaterialProperty && | ||||
|           Cesium.Property.equals(this._color, other._color) && | ||||
|           Cesium.Property.equals(this._duration, other.duration) && | ||||
|           Cesium.Property.equals(this.lineBackAlpha, other.lineBackAlpha)) | ||||
|       ); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   Object.defineProperties(FlowLineMaterialProperty.prototype, { | ||||
|     color: Cesium.createPropertyDescriptor("color"), | ||||
|     duration: Cesium.createPropertyDescriptor("duration"), | ||||
|     transparency: Cesium.createPropertyDescriptor("lineBackAlpha"), | ||||
|   }); | ||||
|  | ||||
|   Cesium.FlowLineMaterialProperty = FlowLineMaterialProperty; | ||||
|   Cesium.Material.FlowLineMaterialProperty = "FlowLineMaterialProperty"; | ||||
|   Cesium.Material.FlowLineMaterialType = "FlowLineMaterialType"; | ||||
|   Cesium.Material.FlowLineMaterialSource = ` | ||||
|       uniform vec4 color; | ||||
|       uniform float duration; | ||||
|       uniform float lineBackAlpha; | ||||
|  | ||||
|       czm_material czm_getMaterial(czm_materialInput materialInput) | ||||
|         { | ||||
|             //生成默认的基础材质 | ||||
|             czm_material material = czm_getDefaultMaterial(materialInput); | ||||
|             //获取st(uv) | ||||
|             vec2 st = materialInput.st; | ||||
|             //获取当前帧数,10秒内变化0-1 | ||||
|             float time = fract(czm_frameNumber / (60.0*duration)); | ||||
|             //长度1/10 | ||||
|             time = time * (1.0 + 0.1); | ||||
|             //平滑过渡函数 | ||||
|             float alpha = smoothstep(time-0.1,time,st.s) * step(-time,-st.s); | ||||
|             //光带轨迹(不会完全透明) | ||||
|             alpha += lineBackAlpha; | ||||
|             material.alpha = alpha; | ||||
|             material.diffuse = color.rgb; | ||||
|             return material; | ||||
|         } | ||||
|        `; | ||||
|  | ||||
|   Cesium.Material._materialCache.addMaterial( | ||||
|     Cesium.Material.FlowLineMaterialType, | ||||
|     { | ||||
|       fabric: { | ||||
|         type: Cesium.Material.FlowLineMaterialType, | ||||
|         uniforms: { | ||||
|           color: new Cesium.Color(1.0, 1.0, 1.0, 1.0), | ||||
|           duration: 10.0, | ||||
|           lineBackAlpha: 0.05, | ||||
|         }, | ||||
|         source: Cesium.Material.FlowLineMaterialSource, | ||||
|       }, | ||||
|       translucent: function (material) { | ||||
|         return true; | ||||
|       }, | ||||
|     } | ||||
|   ); | ||||
| } | ||||
|  | ||||
| export { FlowLine } | ||||
							
								
								
									
										123
									
								
								src/Obj/Materail/LineTextureMaterialProperty.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,123 @@ | ||||
| /* | ||||
|  * @Description: 流动线 | ||||
|  */ | ||||
| function LineTexture() { | ||||
|   class LineTextureMaterialProperty { | ||||
|     constructor(options) { | ||||
|       this._definitionChanged = new Cesium.Event(); | ||||
|       this._image = undefined; | ||||
|       this._color = undefined; | ||||
|       this._speed = undefined; | ||||
|       this._repeat = undefined; | ||||
|       this.image = options.image || ""; | ||||
|       this.color = new Cesium.Color.fromCssColorString(options.color || "rgba(255,255,255,1)"); | ||||
|       this.speed = options.speed != undefined ? options.speed : 1.0; | ||||
|       this.repeat = options.repeat || 1.0; | ||||
|     } | ||||
|  | ||||
|     get isConstant() { | ||||
|       return false; | ||||
|     } | ||||
|  | ||||
|     get definitionChanged() { | ||||
|       return this._definitionChanged; | ||||
|     } | ||||
|  | ||||
|     getType(time) { | ||||
|       return Cesium.Material.LineTextureMaterialType; | ||||
|     } | ||||
|  | ||||
|     getValue(time, result) { | ||||
|       if (!Cesium.defined(result)) { | ||||
|         result = {}; | ||||
|       } | ||||
|       result.image = Cesium.Property.getValueOrDefault( | ||||
|         this._image, | ||||
|         time, | ||||
|         "", | ||||
|         result.image | ||||
|       ); | ||||
|       result.color = Cesium.Property.getValueOrDefault( | ||||
|         this._color, | ||||
|         time, | ||||
|         Cesium.Color.RED, | ||||
|         result.color | ||||
|       ); | ||||
|       result.speed = Cesium.Property.getValueOrDefault( | ||||
|         this._speed, | ||||
|         time, | ||||
|         1.0, | ||||
|         result.speed | ||||
|       ); | ||||
|       result.repeat = Cesium.Property.getValueOrDefault( | ||||
|         this._repeat, | ||||
|         time, | ||||
|         1.0, | ||||
|         result.repeat | ||||
|       ); | ||||
|       result.frameNumber = Cesium.getTimestamp(); | ||||
|       return result; | ||||
|     } | ||||
|  | ||||
|     equals(other) { | ||||
|       return ( | ||||
|         this === other || | ||||
|         (other instanceof LineTextureMaterialProperty && | ||||
|           Cesium.Property.equals(this._image, other._image) && | ||||
|           Cesium.Property.equals(this._color, other._color) && | ||||
|           Cesium.Property.equals(this._imageW, other._imageW) && | ||||
|           Cesium.Property.equals(this._speed, other._speed)) | ||||
|       ); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   Object.defineProperties(LineTextureMaterialProperty.prototype, { | ||||
|     image: Cesium.createPropertyDescriptor("image"), | ||||
|     color: Cesium.createPropertyDescriptor("color"), | ||||
|     speed: Cesium.createPropertyDescriptor("speed"), | ||||
|     repeat: Cesium.createPropertyDescriptor("repeat"), | ||||
|   }); | ||||
|  | ||||
|   Cesium.LineTextureMaterialProperty = LineTextureMaterialProperty; | ||||
|   Cesium.Material.LineTextureMaterialProperty = "LineTextureMaterialProperty"; | ||||
|   Cesium.Material.LineTextureMaterialType = "LineTextureMaterialType"; | ||||
|   Cesium.Material.LineTextureMaterialSource = ` | ||||
|         uniform vec4 color; | ||||
|         uniform sampler2D image; | ||||
|         uniform float speed; | ||||
|         uniform float repeat; | ||||
|         czm_material czm_getMaterial(czm_materialInput materialInput) | ||||
|         { | ||||
|           czm_material material = czm_getDefaultMaterial(materialInput); | ||||
|           vec2 st = materialInput.st; | ||||
|           st.s *= repeat; // 关键:通过repeat控制纹理密度 | ||||
|           // vec4 colorImage = texture2D(image, vec2(fract(st.s + speed*czm_frameNumber* 0.01), st.t)); | ||||
|           vec4 colorImage = speed==0.0?texture2D(image, vec2(fract(st.s), st.t)):texture2D(image, vec2(fract(st.s + frameNumber / 1000.0 / speed * repeat ), st.t)); | ||||
|           material.alpha = colorImage.a * color.a; | ||||
|           material.diffuse = color.rgb; | ||||
|           return material; | ||||
|         } | ||||
|        `; | ||||
|   Cesium.Material._materialCache.addMaterial( | ||||
|     Cesium.Material.LineTextureMaterialType, | ||||
|     { | ||||
|       fabric: { | ||||
|         type: Cesium.Material.LineTextureMaterialType, | ||||
|         uniforms: { | ||||
|           color: new Cesium.Color(1.0, 1.0, 1.0, 1.0), | ||||
|           image: '', | ||||
|           repeat: 1.0, | ||||
|           speed: 1.0, | ||||
|           frameNumber: Cesium.getTimestamp(), | ||||
|           uTime: 1 | ||||
|         }, | ||||
|         source: Cesium.Material.LineTextureMaterialSource, | ||||
|       }, | ||||
|       translucent: function (material) { | ||||
|         return true; | ||||
|       }, | ||||
|     } | ||||
|   ); | ||||
| } | ||||
|  | ||||
| export { LineTexture } | ||||
							
								
								
									
										131
									
								
								src/Obj/Materail/PolylineFlowMaterialProperty.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,131 @@ | ||||
| /* | ||||
|  * @Description: 流动线 | ||||
|  */ | ||||
| function PolylineFlow() { | ||||
|   class PolylineFlowMaterialProperty { | ||||
|     constructor(options) { | ||||
|       this._definitionChanged = new Cesium.Event(); | ||||
|       this._color = undefined; | ||||
|       this._speed = undefined; | ||||
|       this._rotate = undefined; | ||||
|       this.color = new Cesium.Color.fromCssColorString(options.color || "rgba(255,255,255,1)"); | ||||
|       this.speed = options.speed != undefined ? options.speed : 1.0;//速度 | ||||
|       this.lineBackAlpha = options.lineBackAlpha || 0.05; | ||||
|       this.rotate = options.rotate; | ||||
|     } | ||||
|  | ||||
|     get isConstant() { | ||||
|       return false; | ||||
|     } | ||||
|  | ||||
|     get definitionChanged() { | ||||
|       return this._definitionChanged; | ||||
|     } | ||||
|  | ||||
|     getType(time) { | ||||
|       return Cesium.Material.PolylineFlowMaterialType; | ||||
|     } | ||||
|  | ||||
|     getValue(time, result) { | ||||
|       if (!Cesium.defined(result)) { | ||||
|         result = {}; | ||||
|       } | ||||
|  | ||||
|       result.color = Cesium.Property.getValueOrDefault( | ||||
|         this._color, | ||||
|         time, | ||||
|         Cesium.Color.RED, | ||||
|         result.color | ||||
|       ); | ||||
|       result.speed = Cesium.Property.getValueOrDefault( | ||||
|         this._speed, | ||||
|         time, | ||||
|         10, | ||||
|         result.speed | ||||
|       ); | ||||
|       result.rotate = Cesium.Property.getValueOrDefault( | ||||
|         this._rotate, | ||||
|         time, | ||||
|         true, | ||||
|         result.rotate | ||||
|       ); | ||||
|       result.lineBackAlpha = this.lineBackAlpha; | ||||
|       result.frameTime = Cesium.getTimestamp(); | ||||
|       // result.frameNumber = Cesium.getTimestamp(); | ||||
|       return result; | ||||
|     } | ||||
|  | ||||
|     equals(other) { | ||||
|       return ( | ||||
|         this === other || | ||||
|         (other instanceof PolylineFlowMaterialProperty && | ||||
|           Cesium.Property.equals(this._color, other._color) && | ||||
|           Cesium.Property.equals(this._speed, other.speed) && | ||||
|           Cesium.Property.equals(this.lineBackAlpha, other.lineBackAlpha)) | ||||
|       ); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   Object.defineProperties(PolylineFlowMaterialProperty.prototype, { | ||||
|     color: Cesium.createPropertyDescriptor("color"), | ||||
|     speed: Cesium.createPropertyDescriptor("speed"), | ||||
|     rotate: Cesium.createPropertyDescriptor("rotate"), | ||||
|     transparency: Cesium.createPropertyDescriptor("lineBackAlpha"), | ||||
|   }); | ||||
|  | ||||
|   Cesium.PolylineFlowMaterialProperty = PolylineFlowMaterialProperty; | ||||
|   Cesium.Material.PolylineFlowMaterialProperty = "PolylineFlowMaterialProperty"; | ||||
|   Cesium.Material.PolylineFlowMaterialType = "PolylineFlowMaterialType"; | ||||
|   Cesium.Material.PolylineFlowMaterialSource = ` | ||||
|       uniform vec4 color; | ||||
|       uniform float speed; | ||||
|       uniform float lineBackAlpha; | ||||
|  | ||||
|       czm_material czm_getMaterial(czm_materialInput materialInput) | ||||
|         { | ||||
|             //生成默认的基础材质 | ||||
|             czm_material material = czm_getDefaultMaterial(materialInput); | ||||
|             //获取st(uv) | ||||
|             vec2 st = materialInput.st; | ||||
|             //获取当前帧数,10秒内变化0-1 | ||||
|             // float time = fract(czm_frameNumber * speed / 60.0); | ||||
|             // float time = fract(abs(speed) * czm_frameNumber * 0.01); | ||||
|             float time = fract(frameTime / 1000.0  / abs(speed)); | ||||
|             //长度1/10 | ||||
|             // time = time * (1.0 + 0.1); | ||||
|             float staticAlpha = rotate?smoothstep(0.0,1.0, 1.0-st.s) * step(-1.0,-(1.0-st.s)):smoothstep(0.0,1.0, st.s) * step(-1.0,-st.s); | ||||
|  | ||||
|             //平滑过渡函数 | ||||
|             float alpha1 = smoothstep(time-0.1,time,1.0-st.s) * step(-time,- (1.0-st.s)); | ||||
|             float alpha2 = smoothstep(time-0.1,time,st.s) * step(-time,- st.s); | ||||
|             float alpha =(speed== 0.0)? staticAlpha:(speed < 0.0)?alpha2:alpha1; | ||||
|             //光带轨迹(不会完全透明) | ||||
|             alpha += lineBackAlpha; | ||||
|             material.alpha = alpha; | ||||
|             material.diffuse = color.rgb; | ||||
|             return material; | ||||
|         } | ||||
|        `; | ||||
|  | ||||
|   Cesium.Material._materialCache.addMaterial( | ||||
|     Cesium.Material.PolylineFlowMaterialType, | ||||
|     { | ||||
|       fabric: { | ||||
|         type: Cesium.Material.PolylineFlowMaterialType, | ||||
|         uniforms: { | ||||
|           color: new Cesium.Color(1.0, 1.0, 1.0, 1.0), | ||||
|           speed: 0.1, | ||||
|           rotate: true, | ||||
|           frameTime: Cesium.getTimestamp(), | ||||
|           lineBackAlpha: 0.05, | ||||
|         }, | ||||
|         source: Cesium.Material.PolylineFlowMaterialSource, | ||||
|       }, | ||||
|       translucent: function (material) { | ||||
|         return true; | ||||
|       }, | ||||
|     } | ||||
|   ); | ||||
| } | ||||
|  | ||||
| export { PolylineFlow } | ||||
							
								
								
									
										167
									
								
								src/Obj/Materail/PolylineFlowMultMaterialProperty.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,167 @@ | ||||
| /* | ||||
|  * @Description: 流动线 | ||||
|  */ | ||||
| function PolylineFlowMult() { | ||||
|   class PolylineFlowMultMaterialProperty { | ||||
|     constructor(options) { | ||||
|       this._definitionChanged = new Cesium.Event(); | ||||
|       this._color = undefined; | ||||
|       this._speed = undefined; | ||||
|       this._rotate = undefined; | ||||
|       this.color = new Cesium.Color.fromCssColorString(options.color || "rgba(255,255,255,1)"); | ||||
|       this.speed = options.speed != undefined ? options.speed : 1.0;//速度 | ||||
|       this.lineBackAlpha = options.lineBackAlpha || 0.05; | ||||
|       this.rotate = options.rotate; | ||||
|     } | ||||
|  | ||||
|     get isConstant() { | ||||
|       return false; | ||||
|     } | ||||
|  | ||||
|     get definitionChanged() { | ||||
|       return this._definitionChanged; | ||||
|     } | ||||
|  | ||||
|     getType(time) { | ||||
|       return Cesium.Material.PolylineFlowMultMaterialType; | ||||
|     } | ||||
|  | ||||
|     getValue(time, result) { | ||||
|       if (!Cesium.defined(result)) { | ||||
|         result = {}; | ||||
|       } | ||||
|  | ||||
|       result.color = Cesium.Property.getValueOrDefault( | ||||
|         this._color, | ||||
|         time, | ||||
|         Cesium.Color.RED, | ||||
|         result.color | ||||
|       ); | ||||
|       result.speed = Cesium.Property.getValueOrDefault( | ||||
|         this._speed, | ||||
|         time, | ||||
|         10, | ||||
|         result.speed | ||||
|       ); | ||||
|       result.rotate = Cesium.Property.getValueOrDefault( | ||||
|         this._rotate, | ||||
|         time, | ||||
|         true, | ||||
|         result.rotate | ||||
|       ); | ||||
|       result.lineBackAlpha = this.lineBackAlpha; | ||||
|       result.frameTime = Cesium.getTimestamp(); | ||||
|       return result; | ||||
|     } | ||||
|  | ||||
|     equals(other) { | ||||
|       return ( | ||||
|         this === other || | ||||
|         (other instanceof PolylineFlowMultMaterialProperty && | ||||
|           Cesium.Property.equals(this._color, other._color) && | ||||
|           Cesium.Property.equals(this._speed, other.speed) && | ||||
|           Cesium.Property.equals(this._rotate, other.rotate) && | ||||
|           Cesium.Property.equals(this.lineBackAlpha, other.lineBackAlpha)) | ||||
|       ); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   Object.defineProperties(PolylineFlowMultMaterialProperty.prototype, { | ||||
|     color: Cesium.createPropertyDescriptor("color"), | ||||
|     speed: Cesium.createPropertyDescriptor("speed"), | ||||
|     rotate: Cesium.createPropertyDescriptor("rotate"), | ||||
|     transparency: Cesium.createPropertyDescriptor("lineBackAlpha"), | ||||
|   }); | ||||
|  | ||||
|   Cesium.PolylineFlowMultMaterialProperty = PolylineFlowMultMaterialProperty; | ||||
|   Cesium.Material.PolylineFlowMultMaterialProperty = "PolylineFlowMultMaterialProperty"; | ||||
|   Cesium.Material.PolylineFlowMultMaterialType = "PolylineFlowMultMaterialType"; | ||||
|   Cesium.Material.PolylineFlowMaterialSource = ` | ||||
|       uniform vec4 color; | ||||
|       uniform float speed; | ||||
|       uniform float lineBackAlpha; | ||||
|  | ||||
|       czm_material czm_getMaterial(czm_materialInput materialInput) | ||||
|         { | ||||
|             czm_material material = czm_getDefaultMaterial(materialInput); | ||||
|             vec2 st = materialInput.st; | ||||
|  | ||||
|             // 基础时间轴(控制主光带) | ||||
|             float baseTime = fract(czm_frameNumber * speed / 60.0) * 1.1; | ||||
|  | ||||
|             // 高频时间轴(控制高光点) | ||||
|             // float highlightTime = fract(czm_frameNumber * speed * 3.0 / 60.0); | ||||
|             // float highlightTime = fract(abs(speed) * czm_frameNumber * 0.01); | ||||
|             float highlightTime = fract(frameTime / 1000.0  / abs(speed)); | ||||
|             float highlightSpacing = 0.3; // 高光点间隔 | ||||
|  | ||||
|             // 主光带透明度计算 | ||||
|             float mainAlpha = smoothstep(baseTime-0.1, baseTime, st.s) * step(-baseTime, -st.s); | ||||
|  | ||||
|             // 多高光点计算(3个周期性光斑) | ||||
|             float highlight11 = smoothstep(highlightTime-0.05, highlightTime, st.s) * | ||||
|                               step(-highlightTime, -st.s) * | ||||
|                               (1.0 - smoothstep(0.0, highlightSpacing, abs(st.s - highlightTime))); | ||||
|  | ||||
|             float highlight21 = smoothstep(highlightTime+highlightSpacing-0.05, | ||||
|                                         highlightTime+highlightSpacing, st.s) * | ||||
|                               step(-(highlightTime+highlightSpacing), -st.s) * | ||||
|                               (1.0 - smoothstep(0.0, highlightSpacing, abs(st.s - (highlightTime+highlightSpacing)))); | ||||
|  | ||||
|             float highlight31 = smoothstep(highlightTime+2.0*highlightSpacing-0.05, | ||||
|                                         highlightTime+2.0*highlightSpacing, st.s) * | ||||
|                               step(-(highlightTime+2.0*highlightSpacing), -st.s) * | ||||
|                               (1.0 - smoothstep(0.0, highlightSpacing, abs(st.s - (highlightTime+2.0*highlightSpacing)))); | ||||
|  | ||||
|  | ||||
|             float highlight12 = smoothstep(highlightTime-0.05, highlightTime, 1.0 - st.s) * | ||||
|                               step(-highlightTime, -(1.0-st.s)) * | ||||
|                               (1.0 - smoothstep(0.0, highlightSpacing, abs(1.0 - st.s - highlightTime))); | ||||
|  | ||||
|             float highlight22 = smoothstep(highlightTime+highlightSpacing-0.05, | ||||
|                                highlightTime+highlightSpacing, 1.0 - st.s) * | ||||
|                               step(-(highlightTime+highlightSpacing),-(1.0 - st.s)) * | ||||
|                               (1.0 - smoothstep(0.0, highlightSpacing, abs(1.0-st.s - (highlightTime+highlightSpacing)))); | ||||
|  | ||||
|             float highlight32 = smoothstep(highlightTime+2.0*highlightSpacing-0.05, | ||||
|                               highlightTime+2.0*highlightSpacing, 1.0 - st.s) * | ||||
|                               step(-(highlightTime+2.0*highlightSpacing), -(1.0-st.s)) * | ||||
|                               (1.0 - smoothstep(0.0, highlightSpacing, abs(1.0 - st.s - (highlightTime+2.0*highlightSpacing)))); | ||||
|  | ||||
|  | ||||
|             float highlight1 = !rotate?highlight11:highlight12; | ||||
|             float highlight2 = !rotate?highlight21:highlight22; | ||||
|             float highlight3 = !rotate?highlight31:highlight32; | ||||
|             // 合并效果 | ||||
|             // material.alpha = mainAlpha * 0.7 + | ||||
|             //                 (highlight1 + highlight2 + highlight3) * 0.5 + | ||||
|             //                 lineBackAlpha; | ||||
|             material.alpha = (highlight1 + highlight2 + highlight3) * 0.5 + | ||||
|                             lineBackAlpha; | ||||
|             material.diffuse = color.rgb; // 高光区变亮 | ||||
|             return material; | ||||
|         } | ||||
|        `; | ||||
|  | ||||
|   Cesium.Material._materialCache.addMaterial( | ||||
|     Cesium.Material.PolylineFlowMultMaterialType, | ||||
|     { | ||||
|       fabric: { | ||||
|         type: Cesium.Material.PolylineFlowMultMaterialType, | ||||
|         uniforms: { | ||||
|           color: new Cesium.Color(1.0, 1.0, 1.0, 1.0), | ||||
|           speed: 0.1, | ||||
|           rotate: true, | ||||
|           frameTime: Cesium.getTimestamp(), | ||||
|           lineBackAlpha: 0.05, | ||||
|         }, | ||||
|         source: Cesium.Material.PolylineFlowMaterialSource, | ||||
|       }, | ||||
|       translucent: function (material) { | ||||
|         return true; | ||||
|       }, | ||||
|     } | ||||
|   ); | ||||
| } | ||||
|  | ||||
| export { PolylineFlowMult } | ||||
| @ -2,6 +2,11 @@ import { StreamWall1, StreamWall2 } from './WallMaterialProperty' | ||||
| import { RadarScan } from './RadarScanMaterialProperty' | ||||
| import { CustomColorMaterialSource } from './CustomColorMaterialSource' | ||||
| import { CustomImageMaterialSource } from './CustomImageMaterialSource' | ||||
| import { FlowLine } from './FlowLineMaterialProperty' | ||||
| import { PolylineFlow } from './PolylineFlowMaterialProperty' | ||||
| import { PolylineFlowMult } from './PolylineFlowMultMaterialProperty' | ||||
| import { FlowDashedLine } from './FlowDashedLineFlowMaterialProperty' | ||||
| import { LineTexture } from './LineTextureMaterialProperty' | ||||
|  | ||||
| function init_material() { | ||||
|   StreamWall1() | ||||
| @ -9,6 +14,11 @@ function init_material() { | ||||
|   RadarScan() | ||||
|   CustomColorMaterialSource() | ||||
|   CustomImageMaterialSource() | ||||
|   FlowLine() | ||||
|   PolylineFlow() | ||||
|   PolylineFlowMult() | ||||
|   FlowDashedLine() | ||||
|   LineTexture() | ||||
| } | ||||
|  | ||||
| export { init_material } | ||||
| @ -10,6 +10,7 @@ import { Proj } from './proj' | ||||
| import { open as projConvertOpen, close as projConvertClose } from './projConvert' | ||||
| import { open as projectionConvertOpen, close as projectionConvertClose } from './projectionConvert' | ||||
| import { setActiveViewer, closeRotateAround, closeViewFollow } from '../Global/global' | ||||
| import FlowPictureMaterialProperty from '../Obj/Materail/FlowPictureMaterialProperty' | ||||
|  | ||||
| class Tools { | ||||
|   /** | ||||
| @ -138,30 +139,107 @@ class Tools { | ||||
|    * @param [fractionDigits=2] 保留小数点位数 | ||||
|    * @param [ground=true] 是否贴地 | ||||
|    * */ | ||||
|   computeDistance(positions = [], fractionDigits = 2, ground = true) { | ||||
|   // computeDistance(positions = [], fractionDigits = 2, ground = true) { | ||||
|   //   if (positions.length < 2) { | ||||
|   //     return 0 | ||||
|   //   } else { | ||||
|   //     let length = 0 | ||||
|   //     if (ground) { | ||||
|   //       let lineString = [] | ||||
|   //       positions.forEach((item) => { | ||||
|   //         lineString.push([item.lng, item.lat, item.alt]) | ||||
|   //       }) | ||||
|   //       let line = turf.lineString(lineString) | ||||
|   //       length = turf.length(line) * 1000 | ||||
|   //     } | ||||
|   //     else { | ||||
|   //       for (let i = 0; i < positions.length - 1; i++) { | ||||
|   //         const position1 = Cesium.Cartesian3.fromDegrees(positions[i].lng, positions[i].lat, positions[i].alt); | ||||
|   //         const position2 = Cesium.Cartesian3.fromDegrees(positions[i + 1].lng, positions[i + 1].lat, positions[i + 1].alt); | ||||
|   //         const distance = Cesium.Cartesian3.distance(position1, position2); | ||||
|   //         length = length + distance | ||||
|   //       } | ||||
|   //     } | ||||
|   //     return length.toFixed(fractionDigits) | ||||
|   //   } | ||||
|   // } | ||||
|   async computeDistance(positions = [], fractionDigits = 2, type = '空间长度') { | ||||
|     if (positions.length < 2) { | ||||
|       return 0 | ||||
|     } else { | ||||
|       let length = 0 | ||||
|       if (ground) { | ||||
|         let lineString = [] | ||||
|         positions.forEach((item) => { | ||||
|           lineString.push([item.lng, item.lat, item.alt]) | ||||
|         }) | ||||
|         let line = turf.lineString(lineString) | ||||
|         length = turf.length(line) * 1000 | ||||
|       } | ||||
|       else { | ||||
|       switch (type) { | ||||
|         case '空间长度': | ||||
|           for (let i = 0; i < positions.length - 1; i++) { | ||||
|             const position1 = Cesium.Cartesian3.fromDegrees(positions[i].lng, positions[i].lat, positions[i].alt); | ||||
|             const position2 = Cesium.Cartesian3.fromDegrees(positions[i + 1].lng, positions[i + 1].lat, positions[i + 1].alt); | ||||
|             const distance = Cesium.Cartesian3.distance(position1, position2); | ||||
|             length = length + distance | ||||
|           } | ||||
|           break | ||||
|         case '投影长度': | ||||
|           for (let i = 0; i < positions.length - 1; i++) { | ||||
|             const position1 = Cesium.Cartesian3.fromDegrees(positions[i].lng, positions[i].lat, 0); | ||||
|             const position2 = Cesium.Cartesian3.fromDegrees(positions[i + 1].lng, positions[i + 1].lat, 0); | ||||
|             const distance = Cesium.Cartesian3.distance(position1, position2); | ||||
|             length = length + distance | ||||
|           } | ||||
|           break | ||||
|         case '地表长度': | ||||
|           let meters | ||||
|           let lineString2 = [] | ||||
|           positions.forEach((item) => { | ||||
|             lineString2.push([item.lng, item.lat, item.alt]) | ||||
|           }) | ||||
|           let line2 = turf.lineString(lineString2) | ||||
|           let d = turf.length(line2) * 1000 | ||||
|           meters = d > 20 ? d / 20 : d | ||||
|  | ||||
|           let res = this.chunkLine(positions, meters) | ||||
|           let coordinates = [] | ||||
|           res.forEach((Feature, index) => { | ||||
|             if (index === 0) { | ||||
|               coordinates = [...Feature.geometry.coordinates] | ||||
|             } else { | ||||
|               coordinates.push(Feature.geometry.coordinates[1]) | ||||
|             } | ||||
|           }) | ||||
|           let arr = [] | ||||
|           for (const item of coordinates) { | ||||
|             const index = coordinates.indexOf(item); | ||||
|             let r = await this.sampleHeight({ lng: item[0], lat: item[1], alt: 0 }, index) | ||||
|             r.position.alt = r.position.alt < 0 ? 0 : r.position.alt | ||||
|             arr.push(r) | ||||
|           } | ||||
|           let l = arr.length - 1 | ||||
|           arr.forEach((item, index) => { | ||||
|             if (index !== l) { | ||||
|               let posi = [item.position, arr[index + 1].position] | ||||
|               let d1 = 0 | ||||
|               for (let i = 0; i < posi.length - 1; i++) { | ||||
|                 const position1 = Cesium.Cartesian3.fromDegrees(posi[i].lng, posi[i].lat, posi[i].alt); | ||||
|                 const position2 = Cesium.Cartesian3.fromDegrees(posi[i + 1].lng, posi[i + 1].lat, posi[i + 1].alt); | ||||
|                 const distance = Cesium.Cartesian3.distance(position1, position2); | ||||
|                 d1 = d1 + distance | ||||
|               } | ||||
|  | ||||
|               let d2 = Math.abs(item.position.alt - arr[index + 1].position.alt) | ||||
|               let d3 = Math.sqrt(d1 * d1 + d2 * d2) | ||||
|               length += d3 | ||||
|             } | ||||
|           }) | ||||
|           break | ||||
|         default: | ||||
|           break; | ||||
|       } | ||||
|       return length.toFixed(fractionDigits) | ||||
|     } | ||||
|   } | ||||
|   async sampleHeight(p1, index) { | ||||
|     let p2 = await this.sampleHeightMostDetailed([p1]) | ||||
|     p1.alt = p2[0].height | ||||
|     return { position: p1, index } | ||||
|   } | ||||
|  | ||||
|   /**@description 计算多边形面积 | ||||
|    * @method computeArea | ||||
| @ -513,8 +591,11 @@ class Tools { | ||||
|     return res | ||||
|   } | ||||
|  | ||||
|   getMaterial(color = '#2ab0c2', type = 0) { | ||||
|   getMaterial(color = '#2ab0c2', type = 0, entity = null, newParam = {}) { | ||||
|     let material = '' | ||||
|  | ||||
|  | ||||
|  | ||||
|     switch (Number(type)) { | ||||
|  | ||||
|       case 1: //虚线 | ||||
| @ -528,6 +609,54 @@ class Tools { | ||||
|           glowPower: 0.2, | ||||
|           color: Cesium.Color.fromCssColorString(color), | ||||
|         }) | ||||
|         break | ||||
|       case 3: //尾迹光线 | ||||
|         material = new Cesium.PolylineFlowMaterialProperty({ | ||||
|           color: color, | ||||
|           speed: newParam.rotate ? newParam.speed : 0 - newParam.speed, | ||||
|           rotate: newParam.rotate | ||||
|         }) | ||||
|         break | ||||
|       case 4: //多尾迹光线 | ||||
|         material = new Cesium.PolylineFlowMultMaterialProperty({ | ||||
|           color: color, | ||||
|           speed: newParam.rotate ? newParam.speed : 0 - newParam.speed, | ||||
|           rotate: newParam.rotate | ||||
|         }) | ||||
|         break | ||||
|       case 5: //普通流动虚线 | ||||
|         material = new Cesium.FlowDashedLineFlowMaterialProperty({ | ||||
|           color: color, | ||||
|           uType: 0, | ||||
|           speed: newParam.rotate ? newParam.speed : 0 - newParam.speed, | ||||
|           // dashSize: newParam.dashSize, | ||||
|           space: newParam.space | ||||
|         }) | ||||
|         break | ||||
|       case 6: //流动虚线2 | ||||
|         material = new Cesium.FlowDashedLineFlowMaterialProperty({ | ||||
|           color: color, | ||||
|           uType: 1, | ||||
|           speed: newParam.rotate ? newParam.speed : 0 - newParam.speed, | ||||
|           // dashSize: newParam.dashSize, | ||||
|           space: newParam.space | ||||
|         }) | ||||
|         break | ||||
|       case 7: //流动箭头1 | ||||
|       case 8: //流动箭头2 | ||||
|       case 9: //流动箭头3 | ||||
|       case 10: //流动箭头4 | ||||
|       case 11: //流动箭头5 | ||||
|       case 12: //流动箭头6 | ||||
|         let param = { | ||||
|           color: color, | ||||
|           image: this.getSourceRootPath() + `/img/arrow/${type - 6}.png`, | ||||
|           space: newParam.space, | ||||
|           speed: newParam.speed | ||||
|         } | ||||
|         param.speed = newParam.rotate ? param.speed : 0 - param.speed | ||||
|         this.getFlowTexture(this, param, entity) | ||||
|  | ||||
|         break | ||||
|       default: | ||||
|         material = Cesium.Color.fromCssColorString(color) | ||||
| @ -535,6 +664,81 @@ class Tools { | ||||
|     } | ||||
|     return material | ||||
|   } | ||||
|   getFlowTexture(that, options, entity) { | ||||
|  | ||||
|     const canvasEle = document.createElement('canvas'); | ||||
|     const ctx = canvasEle.getContext('2d') | ||||
|     const myImg = new Image() | ||||
|     // myImg.src = that.getSourceRootPath() + '/img/arrow/1.png' | ||||
|     myImg.src = options.image | ||||
|     myImg.onload = function () { | ||||
|       options.space = Math.max(0.1, options.space); | ||||
|       if (options.speed > 0 || options.speed == 0) { | ||||
|         canvasEle.width = myImg.width * (options.space + 1) | ||||
|         canvasEle.height = myImg.height | ||||
|         ctx.drawImage(myImg, myImg.width * (options.space / 2), 0) | ||||
|       } else { | ||||
|         ctx.clearRect(0, 0, canvasEle.width, canvasEle.height); | ||||
|         canvasEle.width = myImg.width * (options.space + 1) | ||||
|         canvasEle.height = myImg.height | ||||
|         ctx.save(); // 保存当前状态 | ||||
|         ctx.translate(canvasEle.width / 2, canvasEle.height / 2); // 移动原点至中心 | ||||
|         ctx.rotate(Math.PI); // (弧度制) | ||||
|         ctx.translate(-canvasEle.width / 2, -canvasEle.height / 2); // 移回原点 | ||||
|         ctx.drawImage(myImg, myImg.width * (options.space / 2), 0) | ||||
|         ctx.restore(); // 恢复状态 | ||||
|       } | ||||
|  | ||||
|       // let repeat = getRepeat() | ||||
|       // }, false) | ||||
|       entity.polyline.material = new Cesium.LineTextureMaterialProperty( | ||||
|         { | ||||
|           color: options.color, | ||||
|           // image: options.image, | ||||
|           image: canvasEle, | ||||
|           speed: options.speed, | ||||
|           // repeat: repeat | ||||
|           repeat: new Cesium.CallbackProperty(function () { | ||||
|             // function getRepeat() { | ||||
|             var positionProperty = entity.polyline.positions; | ||||
|             var positions = positionProperty.getValue(that.sdk.viewer.clock.currentTime); | ||||
|  | ||||
|             if (!Cesium.defined(positions)) { | ||||
|               // return new Cesium.Cartesian2(1.0, 1.0); | ||||
|               return 1.0; | ||||
|             } | ||||
|  | ||||
|             var distance = 0; | ||||
|             for (var i = 0; i < positions.length - 1; ++i) { | ||||
|               distance += Cesium.Cartesian3.distance(positions[i], positions[i + 1]); | ||||
|             } | ||||
|  | ||||
|             var repeatX = distance / entity.polyline.width.getValue(); | ||||
|             // 根据地图缩放程度调整repeatX | ||||
|             var cameraHeight = that.sdk.viewer.camera.positionCartographic.height; | ||||
|             var boundingSphere = new Cesium.BoundingSphere( | ||||
|               new Cesium.Cartesian3(-1000000, 0, 0), // 中心点坐标 | ||||
|               500000 // 半径(距离) | ||||
|             ); | ||||
|  | ||||
|             // 获取绘图缓冲区的宽度和高度(通常是屏幕的分辨率) | ||||
|             var drawingBufferWidth = that.sdk.viewer.canvas.clientWidth; | ||||
|             var drawingBufferHeight = that.sdk.viewer.canvas.clientHeight; | ||||
|  | ||||
|             // 使用 getPixelSize 方法获取包围球在屏幕上的像素大小 | ||||
|             var groundResolution = that.sdk.viewer.scene.camera.getPixelSize(boundingSphere, drawingBufferWidth, drawingBufferHeight) | ||||
|             // repeatX *= groundResolution / cameraHeight / ((myImg.width / myImg.height * 5) + 1); | ||||
|             repeatX *= groundResolution / cameraHeight / (options.space * (canvasEle.width / canvasEle.height * 5) + 1); | ||||
|             // if (repeatX < 3) { | ||||
|             //   repeatX = 3 | ||||
|             // } | ||||
|             // return new Cesium.Cartesian2(repeatX, 1.0); | ||||
|             return repeatX; | ||||
|           }) | ||||
|         } | ||||
|       ) | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   /*创建直箭头图片*/ | ||||
|   create_arrow1_picture(color) { | ||||
|  | ||||
| @ -1515,6 +1515,7 @@ | ||||
|   display: flex; | ||||
|   align-items: center; | ||||
|   height: 32px; | ||||
|   line-height: 32px; | ||||
| } | ||||
|  | ||||
| .YJ-custom-base-dialog>.content .cy_datalist dl dd:hover { | ||||
| @ -1784,6 +1785,89 @@ | ||||
| .YJ-custom-base-dialog.water-surface>.content>div .row .label { | ||||
|   flex: 0 0 60px; | ||||
| } | ||||
| /* 流光飞线 */ | ||||
| .YJ-custom-base-dialog.flow-line-surface>.content { | ||||
|   width: 586px; | ||||
| } | ||||
|  | ||||
| .YJ-custom-base-dialog.flow-line-surface>.content>div .row .label { | ||||
|   flex: 0 0 60px; | ||||
| } | ||||
|  | ||||
| /* 光照 */ | ||||
| .YJ-custom-base-dialog.sun-shine-surface>.content { | ||||
|   width: 586px; | ||||
| } | ||||
|  | ||||
| .YJ-custom-base-dialog.sun-shine-surface>.content>div .row .label { | ||||
|   flex: 0 0 60px; | ||||
| } | ||||
|  | ||||
| .YJ-custom-base-dialog.sun-shine-surface>.content>div .timeline-container { | ||||
|   width: 100%; | ||||
|   padding: 20px 0; | ||||
|   position: relative; | ||||
| } | ||||
|  | ||||
| .YJ-custom-base-dialog.sun-shine-surface>.content>div .timeline { | ||||
|   height: 8px; | ||||
|   background: #f0f0f0; | ||||
|   border-radius: 15px; | ||||
|   position: relative; | ||||
|   cursor: pointer; | ||||
| } | ||||
|  | ||||
| .YJ-custom-base-dialog.sun-shine-surface>.content>div .progress { | ||||
|   height: 100%; | ||||
|   width: 0; | ||||
|   background: rgba(var(--color-sdk-base-rgb), 1); | ||||
|   border-radius: 15px; | ||||
|   position: relative; | ||||
| } | ||||
|  | ||||
| .YJ-custom-base-dialog.sun-shine-surface>.content>div .handle { | ||||
|   width: 16px; | ||||
|   height: 16px; | ||||
|   background: white; | ||||
|   /* border: 3px solid #4285f4; */ | ||||
|   background: rgba(var(--color-sdk-base-rgb), 1); | ||||
|   border-radius: 50%; | ||||
|   position: absolute; | ||||
|   right: -8px; | ||||
|   top: 50%; | ||||
|   transform: translateY(-50%); | ||||
|   cursor: grab; | ||||
| } | ||||
|  | ||||
| .YJ-custom-base-dialog.sun-shine-surface>.content>div .time-marks { | ||||
|   display: flex; | ||||
|   justify-content: space-between; | ||||
|   margin-top: 5px; | ||||
| } | ||||
|  | ||||
| .YJ-custom-base-dialog.sun-shine-surface>.content>div .time-mark { | ||||
|   font-size: 12px; | ||||
|   color: #fff; | ||||
| } | ||||
|  | ||||
| .YJ-custom-base-dialog.sun-shine-surface>.content>div .controls { | ||||
|   margin: 15px 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| .YJ-custom-base-dialog.sun-shine-surface>.content>div .current-time { | ||||
|   font-size: 12px; | ||||
|   position: absolute; | ||||
|   width: 50px; | ||||
|   text-align: center; | ||||
|   right: -25px; | ||||
|   top: -200%; | ||||
|   transform: translateY(-50%); | ||||
| } | ||||
|  | ||||
| .YJ-custom-base-dialog.sun-shine-surface>.content>div #timePause { | ||||
|   margin-top: 10px; | ||||
| } | ||||
|  | ||||
| /* 电子围墙 */ | ||||
| .YJ-custom-base-dialog.wall-stereoscopic>.content { | ||||
| @ -2515,7 +2599,9 @@ | ||||
| .YJ-custom-base-dialog.polyline>.content { | ||||
|   width: 580px; | ||||
| } | ||||
|  | ||||
| .YJ-custom-base-dialog.polyline>.content>div #dashTextureDom { | ||||
|   display: none; | ||||
| } | ||||
| .YJ-custom-base-dialog.polyline>.content>div .row .col { | ||||
|   margin: 0 10px; | ||||
| } | ||||
| @ -2564,6 +2650,117 @@ | ||||
|   max-height: 185px; | ||||
| } | ||||
|  | ||||
| .YJ-custom-base-dialog.polyline>.content>div .input-select-unit-box textarea { | ||||
|   border-radius: unset!important; | ||||
| } | ||||
|  | ||||
| .YJ-custom-base-dialog.polyline>.content>div .input-select-unit .datalist { | ||||
|    background-color:rgba(var(--color-sdk-base-rgb), 0.1)!important; | ||||
|   border-radius: 4px 0px 0px 4px !important; | ||||
| } | ||||
| .YJ-custom-base-dialog.polyline>.content>div .input-select-unit:nth-of-type(1) .datalist { | ||||
|    background-color:rgba(var(--color-sdk-base-rgb), 0.1)!important; | ||||
|    border-radius: 4px 0px, 0px, 4px!important; | ||||
| } | ||||
| .YJ-custom-base-dialog.polyline>.content>div .input-select-unit:nth-of-type(2) .datalist { | ||||
|    background-color:rgba(var(--color-sdk-base-rgb), 0.1)!important; | ||||
|   border-radius: 0px 4px 4px 0px!important; | ||||
| } | ||||
|  | ||||
| .YJ-custom-base-dialog.polyline>.content>div .input-select-unit:nth-of-type(1) input { | ||||
|     border: 1px solid rgba(var(--color-sdk-base-rgb), 0.5)!important; | ||||
| } | ||||
| .YJ-custom-base-dialog.polyline>.content>div .input-select-unit:nth-of-type(2) input { | ||||
|   border: 1px solid rgba(var(--color-sdk-base-rgb), 0.5)!important; | ||||
| } | ||||
|  | ||||
| .YJ-custom-base-dialog.polyline>.content input.input-text{ | ||||
|     background-color: rgba(0, 0, 0, 0.5)!important; | ||||
|     border-radius: unset!important; | ||||
|     border-top: 1px solid rgba(var(--color-sdk-base-rgb), 0.5)!important; | ||||
|     border-bottom: 1px solid rgba(var(--color-sdk-base-rgb), 0.5) !important; | ||||
| } | ||||
|  | ||||
| .YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist input { | ||||
|   padding-left: 35px; | ||||
| } | ||||
|  | ||||
| .YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .icon-active { | ||||
|   position: absolute; | ||||
|   top: 11px; | ||||
|   left: 10px; | ||||
|   -webkit-pointer-events: none; | ||||
|   -moz-pointer-events: none; | ||||
|   -ms-pointer-events: none; | ||||
|   -o-pointer-events: none; | ||||
|   pointer-events: none; | ||||
| } | ||||
|  | ||||
| .YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.icon { | ||||
|   display: inline-block; | ||||
|   width: 22px; | ||||
|   height: 10px; | ||||
|   margin-right: 5px; | ||||
| } | ||||
| .YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.line { | ||||
|   border: 1px solid rgba(255, 255, 255, 1); | ||||
|   height: 0px; | ||||
|   margin-top: 4px; | ||||
| } | ||||
| .YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.dash-line { | ||||
|   border: 1px dashed rgba(255, 255, 255, 1); | ||||
|   height: 0px; | ||||
|   margin-top: 4px; | ||||
| } | ||||
| .YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.light-line { | ||||
|   border: 1px solid rgba(255, 255, 255, 1); | ||||
|   height: 0px; | ||||
|   margin-top: 4px; | ||||
|   box-shadow: 0 0 3px #fff | ||||
| } | ||||
| .YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.tail-line { | ||||
|   background: url(../../img/arrow/tail.png) 100% 100% no-repeat; | ||||
|   background-size: 100% 100%; | ||||
| } | ||||
| .YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.mult-tail-line { | ||||
|   background: url(../../img/arrow/tail.png) 100% 100% no-repeat; | ||||
|   background-size: 100% 100%; | ||||
| } | ||||
| .YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.flow-dash-line1 { | ||||
|   border: 1px dashed rgba(255, 255, 255, 1); | ||||
|   height: 0px; | ||||
|   margin-top: 4px; | ||||
| } | ||||
| .YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.flow-dash-line2 { | ||||
|   border: 1px dashed rgba(255, 255, 255, 1); | ||||
|   height: 0px; | ||||
|   margin-top: 4px; | ||||
| } | ||||
| .YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.pic-line1 { | ||||
|   background: url(../../img/arrow/1.png) 100% 100% no-repeat; | ||||
|   background-size: 100% 100%; | ||||
| } | ||||
| .YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.pic-line2 { | ||||
|   background: url(../../img/arrow/2.png) 100% 100% no-repeat; | ||||
|   background-size: 100% 100%; | ||||
| } | ||||
| .YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.pic-line3 { | ||||
|   background: url(../../img/arrow/3.png) 100% 100% no-repeat; | ||||
|   background-size: 100% 100%; | ||||
| } | ||||
| .YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.pic-line4 { | ||||
|   background: url(../../img/arrow/4.png) 100% 100% no-repeat; | ||||
|   background-size: 100% 100%; | ||||
| } | ||||
| .YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.pic-line5 { | ||||
|   background: url(../../img/arrow/5.png) 100% 100% no-repeat; | ||||
|   background-size: 100% 100%; | ||||
| } | ||||
| .YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.pic-line6 { | ||||
|   background: url(../../img/arrow/6.png) 100% 100% no-repeat; | ||||
|   background-size: 100% 100%; | ||||
| } | ||||
|  | ||||
| /* 贴地图片 */ | ||||
| .YJ-custom-base-dialog.ground-image>.content { | ||||
|   width: 500px; | ||||
|  | ||||
							
								
								
									
										
											BIN
										
									
								
								static/img/arrow/1.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 17 KiB | 
							
								
								
									
										
											BIN
										
									
								
								static/img/arrow/2.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 3.2 KiB | 
							
								
								
									
										
											BIN
										
									
								
								static/img/arrow/3.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 10 KiB | 
							
								
								
									
										
											BIN
										
									
								
								static/img/arrow/4.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 20 KiB | 
							
								
								
									
										
											BIN
										
									
								
								static/img/arrow/5.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 56 KiB | 
							
								
								
									
										
											BIN
										
									
								
								static/img/arrow/6.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 10 KiB | 
							
								
								
									
										
											BIN
										
									
								
								static/img/arrow/tail.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 511 B |