Compare commits
	
		
			8 Commits
		
	
	
		
			fafd75f988
			...
			master
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 94e5698f5a | |||
| 147b0bb43a | |||
| 90466a4799 | |||
| f52d928b9b | |||
| 35010675e7 | |||
| 073fa8702d | |||
| 3e93971654 | |||
| 5a4515733e | 
| @ -322,11 +322,12 @@ const close = () => { | |||||||
|   //   _DialogObject = null |   //   _DialogObject = null | ||||||
|   // } |   // } | ||||||
|   let contentElm = document.getElementsByClassName('fly-roam')[0] |   let contentElm = document.getElementsByClassName('fly-roam')[0] | ||||||
|  |   if(contentElm) { | ||||||
|   let tableBody = contentElm.getElementsByClassName('table-body')[0]; |     let tableBody = contentElm.getElementsByClassName('table-body')[0]; | ||||||
|   let trList = tableBody.getElementsByClassName('tr') |     let trList = tableBody.getElementsByClassName('tr') | ||||||
|   for (let i = trList.length - 1; i >= 0; i--) { |     for (let i = trList.length - 1; i >= 0; i--) { | ||||||
|     tableBody.removeChild(trList[i]) |       tableBody.removeChild(trList[i]) | ||||||
|  |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   repeat = 0 |   repeat = 0 | ||||||
|  | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -166,5 +166,15 @@ function close(sdk) { | |||||||
|   } |   } | ||||||
|   sdk.viewer.scene.preRender.removeEventListener(syncViewer, syncObject) |   sdk.viewer.scene.preRender.removeEventListener(syncViewer, syncObject) | ||||||
| } | } | ||||||
|  | function destroy(sdk) { | ||||||
|  |   if (mapx.viewer) { | ||||||
|  |     if (mapx.viewer.entities) { | ||||||
|  |       mapx.viewer.entities.removeAll() | ||||||
|  |     } | ||||||
|  |     mapx.viewer.destroy && mapx.viewer.destroy() | ||||||
|  |   } | ||||||
|  |   mapx = {} | ||||||
|  |   sdk.viewer.scene.preRender.removeEventListener(syncViewer, syncObject) | ||||||
|  | } | ||||||
|  |  | ||||||
| export { open, close } | export { open, close, destroy } | ||||||
| @ -2,7 +2,7 @@ | |||||||
|  * 鼠标坐标 |  * 鼠标坐标 | ||||||
|  */ |  */ | ||||||
| import Tools from "../../Tools"; | import Tools from "../../Tools"; | ||||||
| import { getCoordinateSystem } from "../../Global/global"; | import { getCoordinateSystem, getDMS } from "../../Global/global"; | ||||||
| import MouseEvent from '../../Event/index' | import MouseEvent from '../../Event/index' | ||||||
| import { getSdk as get2DSdk } from '../../Global/MultiViewportMode' | import { getSdk as get2DSdk } from '../../Global/MultiViewportMode' | ||||||
| import { getSdk as getSplitScreenSdk } from "../../Global/SplitScreen"; | import { getSdk as getSplitScreenSdk } from "../../Global/SplitScreen"; | ||||||
| @ -21,11 +21,12 @@ const MouseCoordinate = (sdk, status) => { | |||||||
|   } |   } | ||||||
|   targetSdk = sdk |   targetSdk = sdk | ||||||
|   sdkD = get2DSdk().sdkD |   sdkD = get2DSdk().sdkD | ||||||
|   if(!sdkD) { |   if (!sdkD) { | ||||||
|     sdkD = getSplitScreenSdk().sdkD |     sdkD = getSplitScreenSdk().sdkD | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   let tools = new Tools(sdk) |   let tools = new Tools(sdk) | ||||||
|  |   let proj = sdk.proj | ||||||
|   if (status) { |   if (status) { | ||||||
|     if (event) { |     if (event) { | ||||||
|       event.destroy() |       event.destroy() | ||||||
| @ -67,13 +68,65 @@ const MouseCoordinate = (sdk, status) => { | |||||||
|       tmovement = { ...movement.endPosition } |       tmovement = { ...movement.endPosition } | ||||||
|     }) |     }) | ||||||
|  |  | ||||||
|  |     const posiToCoordinate = (coordinateSystem, position) => { | ||||||
|  |       let type | ||||||
|  |       switch (coordinateSystem) { | ||||||
|  |         case 'EPSG:32601'://WGS84 通用横轴墨卡托投影 | ||||||
|  |           //带号 = ⌊(经度 + 180)/6⌋ + 1 | ||||||
|  |           var dh = Math.round((position.lng + 180) / 6 + 1) | ||||||
|  |  | ||||||
|  |           if (position.lat > 0) {//北纬 | ||||||
|  |             type = 32600 + dh | ||||||
|  |             type = 'EPSG:' + type | ||||||
|  |           } else {//南纬 | ||||||
|  |             type = 32700 + dh | ||||||
|  |             type = 'EPSG:' + type | ||||||
|  |           } | ||||||
|  |           break; | ||||||
|  |         case 'EPSG:4534'://2000 坐标 3 度不带代号 | ||||||
|  |           //N = round(经度/3) | ||||||
|  |           //EPSG = N - 25 + 4534 | ||||||
|  |  | ||||||
|  |           var dh3y = Math.round(position.lng / 3) | ||||||
|  |           type = dh3y - 25 + 4534 | ||||||
|  |           type = 'EPSG:' + type | ||||||
|  |           break; | ||||||
|  |         case 'EPSG:4513'://2000 坐标 3 度带代号 | ||||||
|  |           //N = round(经度/3) | ||||||
|  |           //EPSG = N - 25 + 4513 | ||||||
|  |           var dh3w = Math.round(position.lng / 3) | ||||||
|  |           type = dh3w - 25 + 4513 | ||||||
|  |           type = 'EPSG:' + type | ||||||
|  |           break; | ||||||
|  |         case 'EPSG:4502'://2000 坐标 6 度不带代号 | ||||||
|  |           let zoneNumber = Math.floor(position.lng / 6) + 31 | ||||||
|  |           // 中国区域6度带带号范围为13-23 | ||||||
|  |           if (zoneNumber < 13) zoneNumber = 13; | ||||||
|  |           if (zoneNumber > 23) zoneNumber = 23; | ||||||
|  |           type = (zoneNumber - 13) + 4502 | ||||||
|  |           type = 'EPSG:' + type | ||||||
|  |           break; | ||||||
|  |         case 'EPSG:4491'://2000 坐标 6 度带代号 | ||||||
|  |           //N = floor(longitude/6) + 31 | ||||||
|  |           var dh6 = Math.floor(position.lng / 6) + 31 | ||||||
|  |           // 中国区域6度带带号范围为13-23 | ||||||
|  |           if (dh6 < 13) dh6 = 13; | ||||||
|  |           if (dh6 > 23) dh6 = 23; | ||||||
|  |           type = (dh6 - 13) + 4491 | ||||||
|  |           type = 'EPSG:' + type | ||||||
|  |           break; | ||||||
|  |         default: | ||||||
|  |           break; | ||||||
|  |       } | ||||||
|  |       return type | ||||||
|  |     } | ||||||
|     const getPosition = () => { |     const getPosition = () => { | ||||||
|       if (!targetSdk) { |       if (!targetSdk) { | ||||||
|         return |         return | ||||||
|       } |       } | ||||||
|       let canvas = sdk.viewer._element.getElementsByTagName('canvas')[0] |       let canvas = sdk.viewer._element.getElementsByTagName('canvas')[0] | ||||||
|       sdkD = get2DSdk().sdkD |       sdkD = get2DSdk().sdkD | ||||||
|       if(!sdkD) { |       if (!sdkD) { | ||||||
|         sdkD = getSplitScreenSdk().sdkD |         sdkD = getSplitScreenSdk().sdkD | ||||||
|       } |       } | ||||||
|       if (!event2 && sdkD) { |       if (!event2 && sdkD) { | ||||||
| @ -118,16 +171,31 @@ const MouseCoordinate = (sdk, status) => { | |||||||
|       if (cartesian) { |       if (cartesian) { | ||||||
|         let degrees = tools.cartesian3Towgs84(cartesian, sdk.viewer) |         let degrees = tools.cartesian3Towgs84(cartesian, sdk.viewer) | ||||||
|         let coordinateSystem = getCoordinateSystem() |         let coordinateSystem = getCoordinateSystem() | ||||||
|  |         let positionType = getDMS() | ||||||
|         if (coordinateSystem === 'EPSG:4326') { |         if (coordinateSystem === 'EPSG:4326') { | ||||||
|           position = { |           position = { | ||||||
|             x: degrees.lng, |             x: degrees.lng, | ||||||
|             y: degrees.lat, |             y: degrees.lat, | ||||||
|             z: degrees.alt |             z: degrees.alt | ||||||
|           } |           } | ||||||
|           contentElm.innerHTML = `<div style='width: 150px;position: absolute; z-index: 777; color: #ff0000; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:${degrees.lng.toFixed(6)}°</p><p style='margin: 0;'>维度:${degrees.lat.toFixed(6)}°</p><p style='margin: 0;'>海拔:${degrees.alt.toFixed(2)} m</p></div>` |           // contentElm.innerHTML = `<div style='width: 150px;position: absolute; z-index: 777; color: #ff0000; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:${degrees.lng.toFixed(6)}°</p><p style='margin: 0;'>维度:${degrees.lat.toFixed(6)}°</p><p style='margin: 0;'>海拔:${degrees.alt.toFixed(2)} m</p></div>` | ||||||
|  |           switch (positionType || '度') { | ||||||
|  |             case '度': | ||||||
|  |               contentElm.innerHTML = `<div style='width: 150px;position: absolute; z-index: 777; color: #ff0000; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:${degrees.lng.toFixed(6)}°</p><p style='margin: 0;'>维度:${degrees.lat.toFixed(6)}°</p><p style='margin: 0;'>海拔:${degrees.alt.toFixed(2)} m</p></div>` | ||||||
|  |               break; | ||||||
|  |             case '度分': | ||||||
|  |               contentElm.innerHTML = `<div style='width: 150px;position: absolute; z-index: 777; color: #ff0000; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:${proj.degreesToDMS(degrees.lng, true)}</p><p style='margin: 0;'>维度:${proj.degreesToDMS(degrees.lat, true)}</p><p style='margin: 0;'>海拔:${degrees.alt.toFixed(2)} m</p></div>` | ||||||
|  |               break; | ||||||
|  |             case '度分秒': | ||||||
|  |               contentElm.innerHTML = `<div style='width: 150px;position: absolute; z-index: 777; color: #ff0000; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:${proj.degreesToDMS(degrees.lng, false)}</p><p style='margin: 0;'>维度:${proj.degreesToDMS(degrees.lat, false)}</p><p style='margin: 0;'>海拔:${degrees.alt.toFixed(2)} m</p></div>` | ||||||
|  |               break; | ||||||
|  |             default: | ||||||
|  |               break; | ||||||
|  |           } | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
|           let result = tools.convert([{ x: degrees.lng, y: degrees.lat, z: degrees.alt }], 'EPSG:4326', coordinateSystem) |           // let result = tools.convert([{ x: degrees.lng, y: degrees.lat, z: degrees.alt }], 'EPSG:4326', coordinateSystem) | ||||||
|  |           let result = tools.convert([{ x: degrees.lng, y: degrees.lat, z: degrees.alt }], 'EPSG:4326', posiToCoordinate(coordinateSystem, degrees)) | ||||||
|           position = result.points[0] |           position = result.points[0] | ||||||
|           contentElm.innerHTML = `<div style='width: 150px;position: absolute; z-index: 777; color: #ff0000; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>x:${position.x.toFixed(6)}</p><p style='margin: 0;'>y:${position.y.toFixed(6)}</p><p style='margin: 0;'>z:${position.z.toFixed(6)}</p></div>` |           contentElm.innerHTML = `<div style='width: 150px;position: absolute; z-index: 777; color: #ff0000; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>x:${position.x.toFixed(6)}</p><p style='margin: 0;'>y:${position.y.toFixed(6)}</p><p style='margin: 0;'>z:${position.z.toFixed(6)}</p></div>` | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -76,11 +76,19 @@ async function ScreenShot(sdk, cd = () => { }) { | |||||||
| } | } | ||||||
|  |  | ||||||
| let _DialogObject | let _DialogObject | ||||||
|  | let startScreenShotObject | ||||||
|  |  | ||||||
| async function ScreenShotHD(sdk, options = {}, cd = () => { }) { | async function ScreenShotHD(sdk, confirm = true, params, cd = () => { }) { | ||||||
|   if (!sdk) { |   if (!sdk) { | ||||||
|     return |     return | ||||||
|   } |   } | ||||||
|  |   if (!confirm) { | ||||||
|  |     if (startScreenShotObject) { | ||||||
|  |       startScreenShotObject.desist() | ||||||
|  |       startScreenShotObject = null | ||||||
|  |     } | ||||||
|  |     return | ||||||
|  |   } | ||||||
|   offSplitScreen(sdk) |   offSplitScreen(sdk) | ||||||
|   offMultiViewportMode(sdk) |   offMultiViewportMode(sdk) | ||||||
|   if (_DialogObject) { |   if (_DialogObject) { | ||||||
| @ -92,84 +100,84 @@ async function ScreenShotHD(sdk, options = {}, cd = () => { }) { | |||||||
|   let enableTilt = sdk.viewer.scene.screenSpaceCameraController.enableTilt |   let enableTilt = sdk.viewer.scene.screenSpaceCameraController.enableTilt | ||||||
|   let enableLook = sdk.viewer.scene.screenSpaceCameraController.enableLook |   let enableLook = sdk.viewer.scene.screenSpaceCameraController.enableLook | ||||||
|  |  | ||||||
|   let scale = 1 |   let scale = params.scaleV * 1 | ||||||
|   let level |   let level | ||||||
|  |  | ||||||
|   let progressInputElm |   let progressInputElm | ||||||
|   let progressBarElm |   let progressBarElm | ||||||
|   let rangeNodeActive |   let rangeNodeActive | ||||||
|   let rangeNodeActiveText |   let rangeNodeActiveText | ||||||
|   let startScreenShotObject |   // let startScreenShotObject | ||||||
|   let tools = new Tools(); |   let tools = new Tools(); | ||||||
|   _DialogObject = await new Dialog(sdk, {}, { |   // _DialogObject = await new Dialog(sdk, {}, { | ||||||
|     title: '高清出图', left: '180px', top: '100px', |   //   title: '高清出图', left: '180px', top: '100px', | ||||||
|     confirmCallBack: (options) => { |   //   confirmCallBack: (options) => { | ||||||
|       if (startScreenShotObject) { |   //     if (startScreenShotObject) { | ||||||
|         startScreenShotObject.desist() |   //       startScreenShotObject.desist() | ||||||
|         startScreenShotObject = null |   //       startScreenShotObject = null | ||||||
|       } |   //     } | ||||||
|       progressInputElm && (progressInputElm.style.width = '0%') |   //     progressInputElm && (progressInputElm.style.width = '0%') | ||||||
|       rangeNodeActive && (rangeNodeActive.style.left = '0%') |   //     rangeNodeActive && (rangeNodeActive.style.left = '0%') | ||||||
|       progressBarElm && (progressBarElm.style.width = '0%') |   //     progressBarElm && (progressBarElm.style.width = '0%') | ||||||
|       rangeNodeActiveText && (rangeNodeActiveText.innerHTML = '0%') |   //     rangeNodeActiveText && (rangeNodeActiveText.innerHTML = '0%') | ||||||
|       startScreenShotObject = new startScreenShot() |   //     startScreenShotObject = new startScreenShot() | ||||||
|     }, |   //   }, | ||||||
|     closeCallBack: () => { |   //   closeCallBack: () => { | ||||||
|       sdk.viewer.scene.screenSpaceCameraController.enableTranslate = enableTranslate; |   //     sdk.viewer.scene.screenSpaceCameraController.enableTranslate = enableTranslate; | ||||||
|       sdk.viewer.scene.screenSpaceCameraController.enableTilt = enableTilt; |   //     sdk.viewer.scene.screenSpaceCameraController.enableTilt = enableTilt; | ||||||
|       sdk.viewer.scene.screenSpaceCameraController.enableLook = enableLook; |   //     sdk.viewer.scene.screenSpaceCameraController.enableLook = enableLook; | ||||||
|       sdk.viewer._element.getElementsByClassName('compass')[0].style.pointerEvents = 'auto' |   //     sdk.viewer._element.getElementsByClassName('compass')[0].style.pointerEvents = 'auto' | ||||||
|       if (startScreenShotObject) { |   //     if (startScreenShotObject) { | ||||||
|         startScreenShotObject.desist() |   //       startScreenShotObject.desist() | ||||||
|         startScreenShotObject = null |   //       startScreenShotObject = null | ||||||
|       } |   //     } | ||||||
|       _DialogObject = undefined |   //     _DialogObject = undefined | ||||||
|     } |   //   } | ||||||
|   }) |   // }) | ||||||
|   _DialogObject._element.body.className = _DialogObject._element.body.className + ' screenShotHD' |   // _DialogObject._element.body.className = _DialogObject._element.body.className + ' screenShotHD' | ||||||
|   let contentElm = document.createElement('div'); |   // let contentElm = document.createElement('div'); | ||||||
|   contentElm.innerHTML = ` |   // contentElm.innerHTML = ` | ||||||
|   <span class="custom-divider"></span> |   // <span class="custom-divider"></span> | ||||||
|   <div class="div-item"> |   // <div class="div-item"> | ||||||
|         <div class="row text" style="align-items: flex-start;"> |   //       <div class="row text" style="align-items: flex-start;"> | ||||||
|             <div class="col"> |   //           <div class="col"> | ||||||
|                 <span>当前窗口长宽:<span class="input-width">${sdk.viewer.canvas.width}</span>*<span class="input-height">${sdk.viewer.canvas.height}</span>像素</span> |   //               <span>当前窗口长宽:<span class="input-width">${sdk.viewer.canvas.width}</span>*<span class="input-height">${sdk.viewer.canvas.height}</span>像素</span> | ||||||
|             </div> |   //           </div> | ||||||
|         </div> |   //       </div> | ||||||
|         <div class="row scale-box" style="align-items: flex-start;"> |   //       <div class="row scale-box" style="align-items: flex-start;"> | ||||||
|             <div class="col"> |   //           <div class="col"> | ||||||
|                 <span class="label">图片大小</span> |   //               <span class="label">图片大小</span> | ||||||
|                 <div class="input input-select scale"></div> |   //               <div class="input input-select scale"></div> | ||||||
|                 <span>倍窗口</span> |   //               <span>倍窗口</span> | ||||||
|             </div> |   //           </div> | ||||||
|         </div> |   //       </div> | ||||||
|         <div class="row text" style="align-items: flex-start;"> |   //       <div class="row text" style="align-items: flex-start;"> | ||||||
|             <div class="col"> |   //           <div class="col"> | ||||||
|                 <span>输出图片长宽:<span class="output-width">${sdk.viewer.canvas.width * scale}</span>*<span class="output-height">${sdk.viewer.canvas.height * scale}</span>像素</span> |   //               <span>输出图片长宽:<span class="output-width">${sdk.viewer.canvas.width * scale}</span>*<span class="output-height">${sdk.viewer.canvas.height * scale}</span>像素</span> | ||||||
|             </div> |   //           </div> | ||||||
|         </div> |   //       </div> | ||||||
|         <div class="row" style="align-items: flex-start; margin-bottom: 20px;"> |   //       <div class="row" style="align-items: flex-start; margin-bottom: 20px;"> | ||||||
|             <div class="col"> |   //           <div class="col"> | ||||||
|                 <span class="label">输出进度</span> |   //               <span class="label">输出进度</span> | ||||||
|                 <div class="range-box"> |   //               <div class="range-box"> | ||||||
|                     <div class="range-bg"> |   //                   <div class="range-bg"> | ||||||
|                         <div class="range-process-box"> |   //                       <div class="range-process-box"> | ||||||
|                             <div class="range-process"></div> |   //                           <div class="range-process"></div> | ||||||
|                         </div> |   //                       </div> | ||||||
|                     </div> |   //                   </div> | ||||||
|                     <div class="range-node-box"> |   //                   <div class="range-node-box"> | ||||||
|                         <span class="range-node-text">0%</span> |   //                       <span class="range-node-text">0%</span> | ||||||
|                         <span class="range-node-text">100%</span> |   //                       <span class="range-node-text">100%</span> | ||||||
|                         <div class="range-node-active"><span class="range-node-active-text">0%</span></div> |   //                       <div class="range-node-active"><span class="range-node-active-text">0%</span></div> | ||||||
|                     </div> |   //                   </div> | ||||||
|                     <input class="progress-input" type="range" max="100" min="0" step="0.01"> |   //                   <input class="progress-input" type="range" max="100" min="0" step="0.01"> | ||||||
|                 </div> |   //               </div> | ||||||
|             </div> |   //           </div> | ||||||
|         </div> |   //       </div> | ||||||
|     </div> |   //   </div> | ||||||
|     <span class="custom-divider"></span> |   //   <span class="custom-divider"></span> | ||||||
|   ` |   // ` | ||||||
|   _DialogObject.contentAppChild(contentElm) |   // _DialogObject.contentAppChild(contentElm) | ||||||
|  |  | ||||||
|   sdk.viewer.scene.screenSpaceCameraController.enableTranslate = false; |   sdk.viewer.scene.screenSpaceCameraController.enableTranslate = false; | ||||||
|   sdk.viewer.scene.screenSpaceCameraController.enableTilt = false; |   sdk.viewer.scene.screenSpaceCameraController.enableTilt = false; | ||||||
| @ -210,28 +218,30 @@ async function ScreenShotHD(sdk, options = {}, cd = () => { }) { | |||||||
|       value: i |       value: i | ||||||
|     }) |     }) | ||||||
|   } |   } | ||||||
|   progressInputElm = document.getElementsByClassName('progress-input')[0] |   // progressInputElm = document.getElementsByClassName('progress-input')[0] | ||||||
|   progressBarElm = document.getElementsByClassName('range-process')[0] |   // progressBarElm = document.getElementsByClassName('range-process')[0] | ||||||
|   rangeNodeActive = contentElm.getElementsByClassName('range-node-active')[0] |   // rangeNodeActive = contentElm.getElementsByClassName('range-node-active')[0] | ||||||
|   rangeNodeActiveText = contentElm.getElementsByClassName('range-node-active-text')[0] |   // rangeNodeActiveText = contentElm.getElementsByClassName('range-node-active-text')[0] | ||||||
|   let scaleDataLegpObject = legp(_DialogObject._element.content.getElementsByClassName('scale-box')[0], ".scale") |   // let scaleDataLegpObject = legp(_DialogObject._element.content.getElementsByClassName('scale-box')[0], ".scale") | ||||||
|   if (scaleDataLegpObject) { |   // if (scaleDataLegpObject) { | ||||||
|     scaleDataLegpObject.legp_search(scaleData) |   //   scaleDataLegpObject.legp_search(scaleData) | ||||||
|     let scaleDataLegpElm = _DialogObject._element.content.getElementsByClassName('scale')[0].getElementsByTagName('input')[0] |   //   let scaleDataLegpElm = _DialogObject._element.content.getElementsByClassName('scale')[0].getElementsByTagName('input')[0] | ||||||
|     scale = scaleData[0].value |   //   scale = scaleData[0].value | ||||||
|     scaleDataLegpObject.legp_searchActive(scaleData[0].value) |   //   scaleDataLegpObject.legp_searchActive(scaleData[0].value) | ||||||
|     scaleDataLegpElm.value = scaleData[0].value |   //   scaleDataLegpElm.value = scaleData[0].value | ||||||
|     scaleDataLegpElm.addEventListener('input', () => { |   //   scaleDataLegpElm.addEventListener('input', () => { | ||||||
|       for (let i = 0; i < scaleData.length; i++) { |   //     for (let i = 0; i < scaleData.length; i++) { | ||||||
|         if (scaleData[i].value == scaleDataLegpElm.value) { |   //       if (scaleData[i].value == scaleDataLegpElm.value) { | ||||||
|           scale = scaleData[i].value |   //         scale = scaleData[i].value | ||||||
|           _DialogObject._element.content.getElementsByClassName('output-width')[0].innerHTML = sdk.viewer.canvas.width * scale |   //         _DialogObject._element.content.getElementsByClassName('output-width')[0].innerHTML = sdk.viewer.canvas.width * scale | ||||||
|           _DialogObject._element.content.getElementsByClassName('output-height')[0].innerHTML = sdk.viewer.canvas.height * scale |   //         _DialogObject._element.content.getElementsByClassName('output-height')[0].innerHTML = sdk.viewer.canvas.height * scale | ||||||
|           break |   //         break | ||||||
|         } |   //       } | ||||||
|       } |   //     } | ||||||
|     }) |   //   }) | ||||||
|   } |   // } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|   class startScreenShot { |   class startScreenShot { | ||||||
|     constructor() { |     constructor() { | ||||||
| @ -498,9 +508,10 @@ async function ScreenShotHD(sdk, options = {}, cd = () => { }) { | |||||||
|               for (const key in progress) { |               for (const key in progress) { | ||||||
|                 totalProgress = totalProgress + progress[key].value |                 totalProgress = totalProgress + progress[key].value | ||||||
|               } |               } | ||||||
|               progressBarElm.style.width = totalProgress * 0.99 + '%'; |               // progressBarElm.style.width = totalProgress * 0.99 + '%'; | ||||||
|               rangeNodeActive.style.left = totalProgress * 0.99 + '%'; |               // rangeNodeActive.style.left = totalProgress * 0.99 + '%'; | ||||||
|               rangeNodeActiveText.innerHTML = Math.floor(totalProgress * 0.99 * 100) / 100 + '%'; |               // rangeNodeActiveText.innerHTML = Math.floor(totalProgress * 0.99 * 100) / 100 + '%'; | ||||||
|  |               cd({ width: totalProgress * 0.99, left: totalProgress * 0.99, value: Math.floor(totalProgress * 0.99 * 100) / 100 }) | ||||||
|               if (count === (MaxTileX - MinTileX + 1) * (MaxTileY - MinTileY + 1)) { |               if (count === (MaxTileX - MinTileX + 1) * (MaxTileY - MinTileY + 1)) { | ||||||
|                 let ctx = canvas.getContext('2d'); |                 let ctx = canvas.getContext('2d'); | ||||||
|                 let cloneCanvas = canvas.cloneNode(true); |                 let cloneCanvas = canvas.cloneNode(true); | ||||||
| @ -525,10 +536,11 @@ async function ScreenShotHD(sdk, options = {}, cd = () => { }) { | |||||||
|                     tempCanvas.width = totalCanvas.width / scale |                     tempCanvas.width = totalCanvas.width / scale | ||||||
|                     tempCanvas.height = totalCanvas.height / scale |                     tempCanvas.height = totalCanvas.height / scale | ||||||
|                     tempCtx.drawImage(totalCanvas, 0, 0, tempCanvas.width, tempCanvas.height); |                     tempCtx.drawImage(totalCanvas, 0, 0, tempCanvas.width, tempCanvas.height); | ||||||
|                     MapPrint(sdk, tempCanvas.toDataURL('image/jpeg', 0.95), rectangle, imgBlobData) |                     new MapPrint(sdk, tempCanvas.toDataURL('image/jpeg', 0.95), rectangle, imgBlobData, params.modify) | ||||||
|                     progressBarElm.style.width = '100%'; |                     // progressBarElm.style.width = '100%'; | ||||||
|                     rangeNodeActive.style.left = '100%'; |                     // rangeNodeActive.style.left = '100%'; | ||||||
|                     rangeNodeActiveText.innerHTML = '100%'; |                     // rangeNodeActiveText.innerHTML = '100%'; | ||||||
|  |                     cd({ value: 100 }) | ||||||
|                     _this.state = false |                     _this.state = false | ||||||
|                   } |                   } | ||||||
|                 } |                 } | ||||||
| @ -548,10 +560,11 @@ async function ScreenShotHD(sdk, options = {}, cd = () => { }) { | |||||||
|                     tempCtx.drawImage(canvas, 0, 0, tempCanvas.width, tempCanvas.height); |                     tempCtx.drawImage(canvas, 0, 0, tempCanvas.width, tempCanvas.height); | ||||||
|                     // canvas.width = canvas.width / scale |                     // canvas.width = canvas.width / scale | ||||||
|                     // canvas.height = canvas.height / scale |                     // canvas.height = canvas.height / scale | ||||||
|                     MapPrint(sdk, tempCanvas.toDataURL('image/jpeg', 0.95), rectangle, imgBlobData) |                     new MapPrint(sdk, tempCanvas.toDataURL('image/jpeg', 0.95), rectangle, imgBlobData, params.modify) | ||||||
|                     progressBarElm.style.width = '100%'; |                     // progressBarElm.style.width = '100%'; | ||||||
|                     rangeNodeActive.style.left = '100%'; |                     // rangeNodeActive.style.left = '100%'; | ||||||
|                     rangeNodeActiveText.innerHTML = '100%'; |                     // rangeNodeActiveText.innerHTML = '100%'; | ||||||
|  |                     cd({ value: 100 }) | ||||||
|                     _this.state = false |                     _this.state = false | ||||||
|                   } |                   } | ||||||
|                 } |                 } | ||||||
| @ -706,6 +719,8 @@ async function ScreenShotHD(sdk, options = {}, cd = () => { }) { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   startScreenShotObject = new startScreenShot() | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
| export { ScreenShot, ScreenShotHD } | export { ScreenShot, ScreenShotHD } | ||||||
|  | |||||||
| @ -26,7 +26,12 @@ export default class Sunshine { | |||||||
|     this.viewer = sdk.viewer |     this.viewer = sdk.viewer | ||||||
|     this.options = { ...options } |     this.options = { ...options } | ||||||
|     this.sdk = { ...sdk } |     this.sdk = { ...sdk } | ||||||
|     this.options.time = options.time || new Date() |  | ||||||
|  |  | ||||||
|  |     const now = new Date(); | ||||||
|  |     now.setHours(0, 0, 0, 0); // 设置为当天0点 | ||||||
|  |     this.options.time = options.time | ||||||
|  |     this.options.hour = options.hour | ||||||
|     this.options.speed = options.speed || 1000 |     this.options.speed = options.speed || 1000 | ||||||
|     this.options.darkness = options.darkness || 0.4 |     this.options.darkness = options.darkness || 0.4 | ||||||
|     this.options.softShadow = options.softShadow || true |     this.options.softShadow = options.softShadow || true | ||||||
| @ -47,9 +52,16 @@ export default class Sunshine { | |||||||
|     that.viewer.terrainShadows = Cesium.ShadowMode.RECEIVE_ONLY |     that.viewer.terrainShadows = Cesium.ShadowMode.RECEIVE_ONLY | ||||||
|     that.viewer.shadowMap.darkness = 1.0 - that.options.darkness //阴影透明度--越大越透明 |     that.viewer.shadowMap.darkness = 1.0 - that.options.darkness //阴影透明度--越大越透明 | ||||||
|  |  | ||||||
|     const now = new Date(); |     // const now = new Date(); | ||||||
|     now.setHours(0, 0, 0, 0); // 设置为当天0点 |     // now.setHours(0, 0, 0, 0); // 设置为当天0点 | ||||||
|     that.viewer.clock.currentTime = Cesium.JulianDate.fromDate(now); |     let date | ||||||
|  |     if (that.options.time && that.options.hour) { | ||||||
|  |       date = new Date(that.options.time + " " + that.options.hour) | ||||||
|  |     } else { | ||||||
|  |       date = new Date(); | ||||||
|  |       date.setHours(0, 0, 0, 0); // 设置为当天0点 | ||||||
|  |     } | ||||||
|  |     that.viewer.clock.currentTime = Cesium.JulianDate.fromDate(date); | ||||||
|     that.viewer.clock.multiplier = that.options.speed; |     that.viewer.clock.multiplier = that.options.speed; | ||||||
|     that.viewer.shadowMap.softShadows = that.options.softShadow; |     that.viewer.shadowMap.softShadows = that.options.softShadow; | ||||||
|     that.viewer.shadowMap.cascadesEnabled = true |     that.viewer.shadowMap.cascadesEnabled = true | ||||||
| @ -61,7 +73,7 @@ export default class Sunshine { | |||||||
|     lightCamera.frustum.far = 10000;   // 扩大远平面距离 |     lightCamera.frustum.far = 10000;   // 扩大远平面距离 | ||||||
|     that.viewer.shadowMap.normalOffset = true; // 避免深度冲突导致的阴影闪烁 |     that.viewer.shadowMap.normalOffset = true; // 避免深度冲突导致的阴影闪烁 | ||||||
|  |  | ||||||
|     that.edit(true) |     // that.edit(true) | ||||||
|   } |   } | ||||||
|   get darkness() { |   get darkness() { | ||||||
|     return this.options.darkness |     return this.options.darkness | ||||||
| @ -74,6 +86,27 @@ export default class Sunshine { | |||||||
|         item.value = v |         item.value = v | ||||||
|       }) |       }) | ||||||
|   } |   } | ||||||
|  |   get time() { | ||||||
|  |     return this.options.time | ||||||
|  |   } | ||||||
|  |   set time(v) { | ||||||
|  |     this.options.time = v | ||||||
|  |     const now = new Date(); | ||||||
|  |     let timeData = now.setHours(0, 0, 0, 0); // 设置为当天0点 | ||||||
|  |     this.viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date(timeData)); | ||||||
|  |  | ||||||
|  |     // _that.timeLine.updateTime(timeData) | ||||||
|  |   } | ||||||
|  |   set timeBar(v) { | ||||||
|  |     let timeData = this.time + " " + v | ||||||
|  |     this.viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date(timeData)); | ||||||
|  |     this.viewer.scene.requestRender(); | ||||||
|  |   } | ||||||
|  |   set realTime(v) { | ||||||
|  |     const now = new Date(); | ||||||
|  |     this.viewer.clock.currentTime = Cesium.JulianDate.fromDate(now); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |  | ||||||
|   get speed() { |   get speed() { | ||||||
|     return this.options.speed |     return this.options.speed | ||||||
| @ -85,7 +118,7 @@ export default class Sunshine { | |||||||
|         item.value = v |         item.value = v | ||||||
|       }) |       }) | ||||||
|     this.viewer.clock.multiplier = this.options.speed; |     this.viewer.clock.multiplier = this.options.speed; | ||||||
|     this.timeLine.setSpeed(v) |     // this.timeLine.setSpeed(v) | ||||||
|   } |   } | ||||||
|   get softShadow() { |   get softShadow() { | ||||||
|     return this.options.softShadow |     return this.options.softShadow | ||||||
| @ -115,41 +148,41 @@ export default class Sunshine { | |||||||
|  |  | ||||||
|     if (state) { |     if (state) { | ||||||
|       let _this = this |       let _this = this | ||||||
|       this._DialogObject = await new Dialog(this.sdk, this.originalOptions, { |       // this._DialogObject = await new Dialog(this.sdk, this.originalOptions, { | ||||||
|         title: '光照属性', left: '180px', top: '100px', |       //   title: '光照属性', left: '180px', top: '100px', | ||||||
|         // confirmCallBack: (options) => { |       //   // confirmCallBack: (options) => { | ||||||
|         //   this.originalOptions = tools.deepCopyObj(this.options) |       //   //   this.originalOptions = tools.deepCopyObj(this.options) | ||||||
|         //   this._DialogObject.close() |       //   //   this._DialogObject.close() | ||||||
|         //   this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(this.originalOptions) |       //   //   this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(this.originalOptions) | ||||||
|         //   syncData(this.sdk, this.options.id) |       //   //   syncData(this.sdk, this.options.id) | ||||||
|         //   syncSplitData(this.sdk, this.options.id) |       //   //   syncSplitData(this.sdk, this.options.id) | ||||||
|         //   this.remove() |       //   //   this.remove() | ||||||
|         // }, |       //   // }, | ||||||
|         resetCallBack: () => { |       //   resetCallBack: () => { | ||||||
|           this.reset() |       //     this.reset() | ||||||
|           this.Dialog.resetCallBack && this.Dialog.resetCallBack() |       //     this.Dialog.resetCallBack && this.Dialog.resetCallBack() | ||||||
|         }, |       //   }, | ||||||
|         // removeCallBack: () => { |       //   // removeCallBack: () => { | ||||||
|         //   this.Dialog.removeCallBack && this.Dialog.removeCallBack() |       //   //   this.Dialog.removeCallBack && this.Dialog.removeCallBack() | ||||||
|         // }, |       //   // }, | ||||||
|         closeCallBack: () => { |       //   closeCallBack: () => { | ||||||
|           this.reset() |       //     this.reset() | ||||||
|           _this.remove() |       //     _this.remove() | ||||||
|           // this.entity.style = new Cesium.Cesium3DTileStyle({ |       //     // this.entity.style = new Cesium.Cesium3DTileStyle({ | ||||||
|           //   color: "color('rgba(255,255,255," + this.newData.transparency + ")')", |       //     //   color: "color('rgba(255,255,255," + this.newData.transparency + ")')", | ||||||
|           //   show: true, |       //     //   show: true, | ||||||
|           // }); |       //     // }); | ||||||
|           this.Dialog.closeCallBack && this.Dialog.closeCallBack() |       //     this.Dialog.closeCallBack && this.Dialog.closeCallBack() | ||||||
|         }, |       //   }, | ||||||
|         showCallBack: (show) => { |       //   showCallBack: (show) => { | ||||||
|           this.show = show |       //     this.show = show | ||||||
|           this.Dialog.showCallBack && this.Dialog.showCallBack() |       //     this.Dialog.showCallBack && this.Dialog.showCallBack() | ||||||
|         } |       //   } | ||||||
|       }, true) |       // }, true) | ||||||
|       this._DialogObject._element.body.className = this._DialogObject._element.body.className + ' sun-shine-surface' |       // this._DialogObject._element.body.className = this._DialogObject._element.body.className + ' sun-shine-surface' | ||||||
|       let contentElm = document.createElement('div'); |       // let contentElm = document.createElement('div'); | ||||||
|       contentElm.innerHTML = html() |       // contentElm.innerHTML = html() | ||||||
|       this._DialogObject.contentAppChild(contentElm) |       // this._DialogObject.contentAppChild(contentElm) | ||||||
|  |  | ||||||
|       //时间轴 |       //时间轴 | ||||||
|       let _that = this |       let _that = this | ||||||
| @ -159,8 +192,6 @@ export default class Sunshine { | |||||||
|         let timeData = _that.time + " " + item |         let timeData = _that.time + " " + item | ||||||
|         _that.viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date(timeData)); |         _that.viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date(timeData)); | ||||||
|         _that.viewer.scene.requestRender(); |         _that.viewer.scene.requestRender(); | ||||||
|  |  | ||||||
|  |  | ||||||
|       }) |       }) | ||||||
|       let jeDateObject |       let jeDateObject | ||||||
|       let printDateElm = contentElm.getElementsByClassName('sunshine-date')[0] |       let printDateElm = contentElm.getElementsByClassName('sunshine-date')[0] | ||||||
| @ -228,7 +259,7 @@ export default class Sunshine { | |||||||
|     this.viewer.clock.multiplier = 1.0 |     this.viewer.clock.multiplier = 1.0 | ||||||
|     this.viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date()); |     this.viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date()); | ||||||
|     this.entity = null |     this.entity = null | ||||||
|     this.timeLine.clear() |     this.timeLine && this.timeLine.clear() | ||||||
|  |  | ||||||
|     this.viewer.shadowMap.cascadesEnabled = false |     this.viewer.shadowMap.cascadesEnabled = false | ||||||
|     this.viewer.shadowMap.size = 1024; |     this.viewer.shadowMap.size = 1024; | ||||||
|  | |||||||
| @ -17,6 +17,7 @@ import { updateCluster } from './cluster/cluster' | |||||||
| import { getHost } from "../on"; | import { getHost } from "../on"; | ||||||
|  |  | ||||||
| let coordinateSystem = 'EPSG:4326' | let coordinateSystem = 'EPSG:4326' | ||||||
|  | let positionType = '度' | ||||||
| let _cartesian | let _cartesian | ||||||
| let GroundCover = true | let GroundCover = true | ||||||
| let bimPickObject = {} | let bimPickObject = {} | ||||||
| @ -197,19 +198,48 @@ function CesiumContainer(sdk, options) { | |||||||
|             let position = tools.cartesian3Towgs84(_cartesian, sdk.viewer) |             let position = tools.cartesian3Towgs84(_cartesian, sdk.viewer) | ||||||
|             // position.alt = height |             // position.alt = height | ||||||
|             if (coordinateSystem === 'EPSG:4326') { |             if (coordinateSystem === 'EPSG:4326') { | ||||||
|               infoElm.innerHTML = ` |               // infoElm.innerHTML = ` | ||||||
|  |               //     <span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span> | ||||||
|  |               //     <span>纬度:</span><span>${Number(position.lat.toFixed(6))}° </span> | ||||||
|  |               //     <span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span> | ||||||
|  |               //   ` | ||||||
|  |               switch (positionType || '度') { | ||||||
|  |                 case '度': | ||||||
|  |                   infoElm.innerHTML = ` | ||||||
|                   <span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span> |                   <span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span> | ||||||
|                   <span>纬度:</span><span>${Number(position.lat.toFixed(6))}° </span> |                   <span>纬度:</span><span>${Number(position.lat.toFixed(6))}° </span> | ||||||
|                   <span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span> |                   <span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span> | ||||||
|                 ` |                 ` | ||||||
|  |                   break; | ||||||
|  |                 case '度分': | ||||||
|  |                   infoElm.innerHTML = ` | ||||||
|  |                   <span>经度:</span><span>${proj.degreesToDMS(position.lng, true)}</span> | ||||||
|  |                   <span>纬度:</span><span>${proj.degreesToDMS(position.lat, true)}</span> | ||||||
|  |                   <span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span> | ||||||
|  |                 ` | ||||||
|  |                   break; | ||||||
|  |                 case '度分秒': | ||||||
|  |                   infoElm.innerHTML = ` | ||||||
|  |                   <span>经度:</span><span>${proj.degreesToDMS(position.lng, false)}</span> | ||||||
|  |                   <span>纬度:</span><span>${proj.degreesToDMS(position.lat, false)}</span> | ||||||
|  |                   <span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span> | ||||||
|  |                 ` | ||||||
|  |                   break; | ||||||
|  |                 default: | ||||||
|  |                   break; | ||||||
|  |               } | ||||||
|             } |             } | ||||||
|             else { |             else { | ||||||
|               let result = proj.convert([{ x: position.lng, y: position.lat, z: position.alt }], 'EPSG:4326', coordinateSystem) |               // let result = proj.convert([{ x: position.lng, y: position.lat, z: position.alt }], 'EPSG:4326', coordinateSystem) | ||||||
|               infoElm.innerHTML = ` |               let result = proj.convert([{ x: position.lng, y: position.lat, z: position.alt }], 'EPSG:4326', posiToCoordinate(coordinateSystem, position)) | ||||||
|  |               if (result.points.length) { | ||||||
|  |                 infoElm.innerHTML = ` | ||||||
|                   <span>x:</span><span>${Number(result.points[0].x.toFixed(6))}</span> |                   <span>x:</span><span>${Number(result.points[0].x.toFixed(6))}</span> | ||||||
|                   <span style="margin-left: 5px;">y:</span><span>${Number(result.points[0].y.toFixed(6))}</span> |                   <span style="margin-left: 5px;">y:</span><span>${Number(result.points[0].y.toFixed(6))}</span> | ||||||
|                   <span style="margin-left: 5px;">z:</span><span>${Number(result.points[0].z.toFixed(6))}</span> |                   <span style="margin-left: 5px;">z:</span><span>${Number(result.points[0].z.toFixed(6))}</span> | ||||||
|                 ` |                 ` | ||||||
|  |               } | ||||||
|  |  | ||||||
|             } |             } | ||||||
|           } |           } | ||||||
|         } |         } | ||||||
| @ -723,7 +753,6 @@ function splitScreen(sdk, status) { | |||||||
|           item.entity && (item.entity.splitDirection = value) |           item.entity && (item.entity.splitDirection = value) | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|       console.log() |  | ||||||
|     }) |     }) | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -745,14 +774,40 @@ function setCoordinateSystem(sdk, epsg) { | |||||||
|   let proj = sdk.proj |   let proj = sdk.proj | ||||||
|   let position = tools.cartesian3Towgs84(_cartesian, sdk.viewer) |   let position = tools.cartesian3Towgs84(_cartesian, sdk.viewer) | ||||||
|   if (coordinateSystem === 'EPSG:4326') { |   if (coordinateSystem === 'EPSG:4326') { | ||||||
|     infoElm.innerHTML = ` |     // infoElm.innerHTML = ` | ||||||
|  |     //               <span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span> | ||||||
|  |     //               <span>纬度:</span><span>${Number(position.lat.toFixed(6))}° </span> | ||||||
|  |     //               <span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span> | ||||||
|  |     //             ` | ||||||
|  |     switch (positionType || '度') { | ||||||
|  |       case '度': | ||||||
|  |         infoElm.innerHTML = ` | ||||||
|                   <span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span> |                   <span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span> | ||||||
|                   <span>纬度:</span><span>${Number(position.lat.toFixed(6))}° </span> |                   <span>纬度:</span><span>${Number(position.lat.toFixed(6))}° </span> | ||||||
|                   <span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span> |                   <span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span> | ||||||
|                 ` |                 ` | ||||||
|  |         break; | ||||||
|  |       case '度分': | ||||||
|  |         infoElm.innerHTML = ` | ||||||
|  |                   <span>经度:</span><span>${proj.degreesToDMS(position.lng, true)}</span> | ||||||
|  |                   <span>纬度:</span><span>${proj.degreesToDMS(position.lat, true)}</span> | ||||||
|  |                   <span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span> | ||||||
|  |                 ` | ||||||
|  |         break; | ||||||
|  |       case '度分秒': | ||||||
|  |         infoElm.innerHTML = ` | ||||||
|  |                   <span>经度:</span><span>${proj.degreesToDMS(position.lng, false)}</span> | ||||||
|  |                   <span>纬度:</span><span>${proj.degreesToDMS(position.lat, false)}</span> | ||||||
|  |                   <span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span> | ||||||
|  |                 ` | ||||||
|  |         break; | ||||||
|  |       default: | ||||||
|  |         break; | ||||||
|  |     } | ||||||
|   } |   } | ||||||
|   else { |   else { | ||||||
|     let result = proj.convert([{ x: position.lng, y: position.lat, z: position.alt }], 'EPSG:4326', coordinateSystem) |     // let result = proj.convert([{ x: position.lng, y: position.lat, z: position.alt }], 'EPSG:4326', coordinateSystem) | ||||||
|  |     let result = proj.convert([{ x: position.lng, y: position.lat, z: position.alt }], 'EPSG:4326', posiToCoordinate(coordinateSystem, position)) | ||||||
|     infoElm.innerHTML = ` |     infoElm.innerHTML = ` | ||||||
|                   <span>x:</span><span>${Number(result.points[0].x.toFixed(6))}</span> |                   <span>x:</span><span>${Number(result.points[0].x.toFixed(6))}</span> | ||||||
|                   <span style="margin-left: 5px;">y:</span><span>${Number(result.points[0].y.toFixed(6))}</span> |                   <span style="margin-left: 5px;">y:</span><span>${Number(result.points[0].y.toFixed(6))}</span> | ||||||
| @ -760,6 +815,103 @@ function setCoordinateSystem(sdk, epsg) { | |||||||
|                 ` |                 ` | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | function posiToCoordinate(coordinateSystem, position) { | ||||||
|  |   let type | ||||||
|  |   switch (coordinateSystem) { | ||||||
|  |     case 'EPSG:32601'://WGS84 通用横轴墨卡托投影 | ||||||
|  |       //带号 = ⌊(经度 + 180)/6⌋ + 1 | ||||||
|  |       var dh = Math.floor((position.lng + 180) / 6 + 1) | ||||||
|  |  | ||||||
|  |       if (position.lat > 0) {//北纬 | ||||||
|  |         type = 32600 + dh | ||||||
|  |         type = 'EPSG:' + type | ||||||
|  |       } else {//南纬 | ||||||
|  |         type = 32700 + dh | ||||||
|  |         type = 'EPSG:' + type | ||||||
|  |       } | ||||||
|  |       break; | ||||||
|  |     case 'EPSG:4534'://2000 坐标 3 度不带代号 | ||||||
|  |       //N = round(经度/3) | ||||||
|  |       //EPSG = N - 25 + 4534 | ||||||
|  |  | ||||||
|  |       var dh3y = Math.round(position.lng / 3) | ||||||
|  |       type = dh3y - 25 + 4534 | ||||||
|  |       type = 'EPSG:' + type | ||||||
|  |       break; | ||||||
|  |     case 'EPSG:4513'://2000 坐标 3 度带代号 | ||||||
|  |       //N = round(经度/3) | ||||||
|  |       //EPSG = N - 25 + 4513 | ||||||
|  |       var dh3w = Math.round(position.lng / 3) | ||||||
|  |       type = dh3w - 25 + 4513 | ||||||
|  |       type = 'EPSG:' + type | ||||||
|  |       break; | ||||||
|  |     case 'EPSG:4502'://2000 坐标 6 度不带代号 | ||||||
|  |       let zoneNumber = Math.floor(position.lng / 6) + 31 | ||||||
|  |       // 中国区域6度带带号范围为13-23 | ||||||
|  |       if (zoneNumber < 13) zoneNumber = 13; | ||||||
|  |       if (zoneNumber > 23) zoneNumber = 23; | ||||||
|  |       type = (zoneNumber - 13) + 4502 | ||||||
|  |       type = 'EPSG:' + type | ||||||
|  |       break; | ||||||
|  |     case 'EPSG:4491'://2000 坐标 6 度带代号 | ||||||
|  |       //N = floor(longitude/6) + 31 | ||||||
|  |       var dh6 = Math.floor(position.lng / 6) + 31 | ||||||
|  |       // 中国区域6度带带号范围为13-23 | ||||||
|  |       if (dh6 < 13) dh6 = 13; | ||||||
|  |       if (dh6 > 23) dh6 = 23; | ||||||
|  |       type = (dh6 - 13) + 4491 | ||||||
|  |       type = 'EPSG:' + type | ||||||
|  |       break; | ||||||
|  |     default: | ||||||
|  |       break; | ||||||
|  |   } | ||||||
|  |   return type | ||||||
|  | } | ||||||
|  | function getDMS() { | ||||||
|  |   return positionType | ||||||
|  | } | ||||||
|  | function setDMS(sdk, type) { | ||||||
|  |   if (coordinateSystem !== 'EPSG:4326') { | ||||||
|  |     return | ||||||
|  |   } | ||||||
|  |   positionType = type | ||||||
|  |   if (!sdk || !sdk.viewer || !sdk.viewer._element) { | ||||||
|  |     return | ||||||
|  |   } | ||||||
|  |   let infoElm = sdk.viewer._element.getElementsByClassName('cesium-info')[0] | ||||||
|  |   if (!_cartesian || !infoElm) { | ||||||
|  |     return | ||||||
|  |   } | ||||||
|  |   let tools = new Tools() | ||||||
|  |   let proj = sdk.proj | ||||||
|  |   let position = tools.cartesian3Towgs84(_cartesian, sdk.viewer) | ||||||
|  |   switch (type) { | ||||||
|  |     case '度': | ||||||
|  |       infoElm.innerHTML = ` | ||||||
|  |                   <span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span> | ||||||
|  |                   <span>纬度:</span><span>${Number(position.lat.toFixed(6))}° </span> | ||||||
|  |                   <span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span> | ||||||
|  |                 ` | ||||||
|  |       break; | ||||||
|  |     case '度分': | ||||||
|  |       infoElm.innerHTML = ` | ||||||
|  |                   <span>经度:</span><span>${proj.degreesToDMS(position.lng, true)}</span> | ||||||
|  |                   <span>纬度:</span><span>${proj.degreesToDMS(position.lat, true)}</span> | ||||||
|  |                   <span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span> | ||||||
|  |                 ` | ||||||
|  |       break; | ||||||
|  |     case '度分秒': | ||||||
|  |       infoElm.innerHTML = ` | ||||||
|  |                   <span>经度:</span><span>${proj.degreesToDMS(position.lng, false)}</span> | ||||||
|  |                   <span>纬度:</span><span>${proj.degreesToDMS(position.lat, false)}</span> | ||||||
|  |                   <span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span> | ||||||
|  |                 ` | ||||||
|  |       break; | ||||||
|  |     default: | ||||||
|  |       break; | ||||||
|  |   } | ||||||
|  |   proj.degreesToDMS(position.lng, true) | ||||||
|  | } | ||||||
|  |  | ||||||
| function cameraChanged(sdk, cb) { | function cameraChanged(sdk, cb) { | ||||||
|   let tools = new Tools() |   let tools = new Tools() | ||||||
| @ -846,4 +998,4 @@ function enablePerspective(sdk, alpha = 1) { | |||||||
|   sdk.viewer.scene.globe.translucency.frontFaceAlpha = alpha |   sdk.viewer.scene.globe.translucency.frontFaceAlpha = alpha | ||||||
| } | } | ||||||
|  |  | ||||||
| export { getCurrentView, setDefaultView, flyTo, CameraController, CesiumContainer, setBillboardDefaultUrl, getBillboardDefaultUrl, setGroundCover, getGroundCover, getBimPickStatus, setBimPickStatus, rotateAround, closeRotateAround, closeViewFollow, FlwStatusSwitch, JwwStatusSwitch, getFlwStatus, getJwwStatus, getCoordinateSystem, setCoordinateSystem, cameraChanged, setMaximumRequestsPerServer, setKeyboardEventActive, getTheme, setTheme, getCesiumIndexedDBMaxSize, setCesiumIndexedDBMaxSize, getCesiumManageIndexexDBState, setCesiumManageIndexexDBState, getCesiumIndexedDBCurrentSize, setActiveViewer, enablePerspective } | export { getCurrentView, setDefaultView, flyTo, CameraController, CesiumContainer, setBillboardDefaultUrl, getBillboardDefaultUrl, setGroundCover, getGroundCover, getBimPickStatus, setBimPickStatus, rotateAround, closeRotateAround, closeViewFollow, FlwStatusSwitch, JwwStatusSwitch, getFlwStatus, getJwwStatus, getCoordinateSystem, setCoordinateSystem, getDMS, setDMS, cameraChanged, setMaximumRequestsPerServer, setKeyboardEventActive, getTheme, setTheme, getCesiumIndexedDBMaxSize, setCesiumIndexedDBMaxSize, getCesiumManageIndexexDBState, setCesiumManageIndexexDBState, getCesiumIndexedDBCurrentSize, setActiveViewer, enablePerspective } | ||||||
|  | |||||||
| @ -17,6 +17,8 @@ import { | |||||||
|   rotateAround, |   rotateAround, | ||||||
|   getCoordinateSystem, |   getCoordinateSystem, | ||||||
|   setCoordinateSystem, |   setCoordinateSystem, | ||||||
|  |   getDMS, | ||||||
|  |   setDMS, | ||||||
|   cameraChanged, |   cameraChanged, | ||||||
|   setMaximumRequestsPerServer, |   setMaximumRequestsPerServer, | ||||||
|   setKeyboardEventActive, |   setKeyboardEventActive, | ||||||
| @ -324,6 +326,8 @@ if (!window.YJ) { | |||||||
|       rotateAround, |       rotateAround, | ||||||
|       getCoordinateSystem, |       getCoordinateSystem, | ||||||
|       setCoordinateSystem, |       setCoordinateSystem, | ||||||
|  |       getDMS, | ||||||
|  |       setDMS, | ||||||
|       DTH, |       DTH, | ||||||
|       cameraChanged, |       cameraChanged, | ||||||
|       setMaximumRequestsPerServer, |       setMaximumRequestsPerServer, | ||||||
|  | |||||||
| @ -28,8 +28,8 @@ class ArcgisLayer extends BaseLayer { | |||||||
|         url |         url | ||||||
|       }); |       }); | ||||||
|     } |     } | ||||||
|     if (this.options.hasOwnProperty("layer_index")) { |     if (this.options.hasOwnProperty("layerIndex")) { | ||||||
|       this.entity = this.sdk.viewer.imageryLayers.addImageryProvider(imageryProvider, this.options.layer_index) |       this.entity = this.sdk.viewer.imageryLayers.addImageryProvider(imageryProvider, this.options.layerIndex) | ||||||
|     } else { |     } else { | ||||||
|       this.entity = this.sdk.viewer.imageryLayers.addImageryProvider(imageryProvider,) |       this.entity = this.sdk.viewer.imageryLayers.addImageryProvider(imageryProvider,) | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -25,8 +25,8 @@ class GdImagery extends BaseLayer { | |||||||
|       tilingScheme: this.amapMercatorTilingScheme() |       tilingScheme: this.amapMercatorTilingScheme() | ||||||
|     }) |     }) | ||||||
|  |  | ||||||
|     if (this.options.hasOwnProperty("layer_index")) { |     if (this.options.hasOwnProperty("layerIndex")) { | ||||||
|       this.entity = this.sdk.viewer.imageryLayers.addImageryProvider(gdLayer, this.options.layer_index) |       this.entity = this.sdk.viewer.imageryLayers.addImageryProvider(gdLayer, this.options.layerIndex) | ||||||
|     } else { |     } else { | ||||||
|       this.entity = this.sdk.viewer.imageryLayers.addImageryProvider(gdLayer,) |       this.entity = this.sdk.viewer.imageryLayers.addImageryProvider(gdLayer,) | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -105,9 +105,9 @@ class Layer extends BaseLayer { | |||||||
|     if (!this.sdk || !this.sdk.viewer) { |     if (!this.sdk || !this.sdk.viewer) { | ||||||
|       return |       return | ||||||
|     } |     } | ||||||
|     if (this.options.hasOwnProperty("layer_index")) { |     if (this.options.hasOwnProperty("layerIndex")) { | ||||||
|       this.entity = |       this.entity = | ||||||
|         this.sdk.viewer.scene.imageryLayers.addImageryProvider(layer, this.options.layer_index) |         this.sdk.viewer.scene.imageryLayers.addImageryProvider(layer, this.options.layerIndex) | ||||||
|     } else { |     } else { | ||||||
|       this.entity = |       this.entity = | ||||||
|         this.sdk.viewer.scene.imageryLayers.addImageryProvider(layer,) |         this.sdk.viewer.scene.imageryLayers.addImageryProvider(layer,) | ||||||
|  | |||||||
| @ -30,9 +30,9 @@ class Layer3rdparty extends BaseLayer { | |||||||
|     let layer |     let layer | ||||||
|  |  | ||||||
|     layer = new Cesium.UrlTemplateImageryProvider(params) |     layer = new Cesium.UrlTemplateImageryProvider(params) | ||||||
|     if (this.options.hasOwnProperty("layer_index")) { |     if (this.options.hasOwnProperty("layerIndex")) { | ||||||
|       this.entity = |       this.entity = | ||||||
|         this.sdk.viewer.scene.imageryLayers.addImageryProvider(layer, this.options.layer_index) |         this.sdk.viewer.scene.imageryLayers.addImageryProvider(layer, this.options.layerIndex) | ||||||
|     } else { |     } else { | ||||||
|       this.entity = |       this.entity = | ||||||
|         this.sdk.viewer.scene.imageryLayers.addImageryProvider(layer,) |         this.sdk.viewer.scene.imageryLayers.addImageryProvider(layer,) | ||||||
|  | |||||||
| @ -73,7 +73,7 @@ class BaseLayer extends BaseSource { | |||||||
|         this.sdk.viewer.imageryLayers.raiseToTop(layer) |         this.sdk.viewer.imageryLayers.raiseToTop(layer) | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     this.options.layer_index = this.entity._layerIndex |     this.options.layerIndex = this.entity._layerIndex | ||||||
|     return this.entity._layerIndex |     return this.entity._layerIndex | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @ -84,7 +84,7 @@ class BaseLayer extends BaseSource { | |||||||
|    * */ |    * */ | ||||||
|   layerLower() { |   layerLower() { | ||||||
|     this.sdk.viewer.imageryLayers.lower(this.entity) |     this.sdk.viewer.imageryLayers.lower(this.entity) | ||||||
|     this.options.layer_index = this.entity._layerIndex |     this.options.layerIndex = this.entity._layerIndex | ||||||
|     return this.entity._layerIndex |     return this.entity._layerIndex | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @ -101,7 +101,7 @@ class BaseLayer extends BaseSource { | |||||||
|         this.sdk.viewer.imageryLayers.raiseToTop(layer) |         this.sdk.viewer.imageryLayers.raiseToTop(layer) | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     this.options.layer_index = this.entity._layerIndex |     this.options.layerIndex = this.entity._layerIndex | ||||||
|     return this.entity._layerIndex |     return this.entity._layerIndex | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @ -112,7 +112,7 @@ class BaseLayer extends BaseSource { | |||||||
|    * */ |    * */ | ||||||
|   layerToBottom() { |   layerToBottom() { | ||||||
|     this.sdk.viewer.imageryLayers.lowerToBottom(this.entity) |     this.sdk.viewer.imageryLayers.lowerToBottom(this.entity) | ||||||
|     this.options.layer_index = this.entity._layerIndex |     this.options.layerIndex = this.entity._layerIndex | ||||||
|     return this.entity._layerIndex |     return this.entity._layerIndex | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | |||||||
| @ -83,11 +83,9 @@ class GeoJson extends Base { | |||||||
|  |  | ||||||
|   async on() { |   async on() { | ||||||
|     let url = "" |     let url = "" | ||||||
|     if (this.options.host.endsWith("yjearth4.0")) |     this.options.host = this.options.host || getHost() | ||||||
|       url = this.options.host + '/data/service/getFile' |     url = this.options.host + '/fileInfo/previewLocal' | ||||||
|     else |     url += '?fileAbsolutePath=' + this.options.url | ||||||
|       url = this.options.host + '/yjearth4.0/data/service/getFile' |  | ||||||
|     url = url + '?path=' + encodeURIComponent(this.options.url) |  | ||||||
|     let rsp = await fetch(url, { |     let rsp = await fetch(url, { | ||||||
|       method: 'get', |       method: 'get', | ||||||
|       headers: { |       headers: { | ||||||
|  | |||||||
| @ -117,7 +117,6 @@ class TextBox extends Base { | |||||||
|         // alt: height |         // alt: height | ||||||
|       } |       } | ||||||
|       let posi = Cesium.Cartesian3.fromDegrees(longitude, latitude, cartographic.height) |       let posi = Cesium.Cartesian3.fromDegrees(longitude, latitude, cartographic.height) | ||||||
|  |  | ||||||
|       that.handler = function () { |       that.handler = function () { | ||||||
|         const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates( |         const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates( | ||||||
|           that.sdk.viewer.scene, posi |           that.sdk.viewer.scene, posi | ||||||
| @ -150,7 +149,6 @@ class TextBox extends Base { | |||||||
|     let that = this |     let that = this | ||||||
|     that.sdk.viewer.scene.postRender.removeEventListener(that.handler); |     that.sdk.viewer.scene.postRender.removeEventListener(that.handler); | ||||||
|     let posi = Cesium.Cartesian3.fromDegrees(position.lng, position.lat, position.alt) |     let posi = Cesium.Cartesian3.fromDegrees(position.lng, position.lat, position.alt) | ||||||
|  |  | ||||||
|     that.handler = function () { |     that.handler = function () { | ||||||
|       const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates( |       const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates( | ||||||
|         that.sdk.viewer.scene, posi |         that.sdk.viewer.scene, posi | ||||||
|  | |||||||
| @ -42,8 +42,8 @@ class Vector extends Base { | |||||||
|       return |       return | ||||||
|     } |     } | ||||||
|     this.colors = colors |     this.colors = colors | ||||||
|     this.options.head_tables = options.head_tables || [] |     this.options.headTables = options.headTables || [] | ||||||
|     this.options.fileName = options.fileName || '未命名对象' |     this.options.name = options.name || '未命名对象' | ||||||
|  |  | ||||||
|     if (!this.options.path.endsWith('.kml')) { |     if (!this.options.path.endsWith('.kml')) { | ||||||
|       ; (this.options.color = options.color || 'rgba(0,255,184,0.5)'), |       ; (this.options.color = options.color || 'rgba(0,255,184,0.5)'), | ||||||
| @ -120,34 +120,34 @@ class Vector extends Base { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   async init() { |   async init() { | ||||||
|     let url = '' |     return new Promise(async (resolve, reject) => { | ||||||
|     this.options.host = this.options.host || getHost() |       let url = '' | ||||||
|     if (this.options.host.endsWith('yjearth4.0')) { |       this.options.host = this.options.host || getHost() | ||||||
|       url = this.options.host + '/api/v1/vector/load2' |       url = this.options.host + '/gdal/import' | ||||||
|     } else { |       // url = 'json/shp.json' | ||||||
|       url = this.options.host + '/yjearth4.0/api/v1/vector/load2' |       let params = new FormData() | ||||||
|     } |       params.append('path', this.options.path) | ||||||
|     url += '?path=' + this.options.path |       let response = await fetch(url, { | ||||||
|     // url = 'json/shp.json' |         method: 'post', | ||||||
|     let response = await fetch(url, { |         headers: { | ||||||
|       method: 'get', |           Authorization: getToken() | ||||||
|       headers: { |         }, | ||||||
|         'Content-Type': 'application/json', |         body: params | ||||||
|         token: getToken(), |       }) | ||||||
|         Authorization: 'Bearer ' + getToken() |       console.log('response', response) | ||||||
|  |       if (response.status === 200) { | ||||||
|  |         let arrayBuffer = await response.arrayBuffer() | ||||||
|  |         let uint8Array = new Uint8Array(arrayBuffer) | ||||||
|  |         let string = this.decompressGzip(uint8Array) | ||||||
|  |         if (this.data.length === 0) { | ||||||
|  |           this.data = JSON.parse(string) | ||||||
|  |         } | ||||||
|  |         console.log('this.data', this.data) | ||||||
|  |         await this.formatData() | ||||||
|  |         Vector.create(this) | ||||||
|  |         resolve() | ||||||
|       } |       } | ||||||
|     }) |     }); | ||||||
|     if (response.status === 200) { |  | ||||||
|       let arrayBuffer = await response.arrayBuffer() |  | ||||||
|       let uint8Array = new Uint8Array(arrayBuffer) |  | ||||||
|       let string = this.decompressGzip(uint8Array) |  | ||||||
|       if(this.data.length===0) |  | ||||||
|       { |  | ||||||
|         this.data = JSON.parse(string) |  | ||||||
|       } |  | ||||||
|       await this.formatData() |  | ||||||
|       return Vector.create(this) |  | ||||||
|     } |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   // 格式化数据 |   // 格式化数据 | ||||||
| @ -195,16 +195,16 @@ class Vector extends Base { | |||||||
|       } |       } | ||||||
|       for (let m = 0; m < this.data.list[i].features.length; m++) { |       for (let m = 0; m < this.data.list[i].features.length; m++) { | ||||||
|         this.data.list[i].features[m].properties.id |         this.data.list[i].features[m].properties.id | ||||||
|         if(!this.data.list[i].features[m].properties) { |         if (!this.data.list[i].features[m].properties) { | ||||||
|           this.data.list[i].features[m].properties = {} |           this.data.list[i].features[m].properties = {} | ||||||
|         } |         } | ||||||
|         if(!this.data.list[i].features[m].properties.id) { |         if (!this.data.list[i].features[m].properties.id) { | ||||||
|           this.data.list[i].features[m].properties.id = Cesium.createGuid() |           this.data.list[i].features[m].properties.id = Cesium.createGuid() | ||||||
|         } |         } | ||||||
|         this.data.list[i].features[m].id = this.data.list[i].features[m].properties.id |         this.data.list[i].features[m].id = this.data.list[i].features[m].properties.id | ||||||
|         posConvert( |         posConvert( | ||||||
|           this.data.list[i].features[m].geometry, |           this.data.list[i].features[m].geometry, | ||||||
|           this.data.list[i].crs_src, |           this.data.list[i].crs_src || '+proj=longlat +datum=WGS84 +no_defs', | ||||||
|           this.data.list[i].crs_dst || '+proj=longlat +datum=WGS84 +no_defs' |           this.data.list[i].crs_dst || '+proj=longlat +datum=WGS84 +no_defs' | ||||||
|         ) |         ) | ||||||
|         this.data.list[i].features[m].geometry.geometries || |         this.data.list[i].features[m].geometry.geometries || | ||||||
| @ -231,12 +231,12 @@ class Vector extends Base { | |||||||
|     // } |     // } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   get fileName() { |   get name() { | ||||||
|     return this.options.fileName |     return this.options.name | ||||||
|   } |   } | ||||||
|   set fileName(v) { |   set name(v) { | ||||||
|     this.options.fileName = v |     this.options.name = v | ||||||
|     this._elms.fileName && (this._elms.fileName.value = v) |     this._elms.name && (this._elms.name.value = v) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   get field() { |   get field() { | ||||||
| @ -252,9 +252,9 @@ class Vector extends Base { | |||||||
|     //   } |     //   } | ||||||
|     // } |     // } | ||||||
|     let label = v |     let label = v | ||||||
|     for (let index = 0; index < this.options.head_tables.length; index++) { |     for (let index = 0; index < this.options.headTables.length; index++) { | ||||||
|       if (this.options.head_tables[index].key === v) { |       if (this.options.headTables[index].key === v) { | ||||||
|         label = this.options.head_tables[index].label |         label = this.options.headTables[index].label | ||||||
|         break |         break | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
| @ -348,13 +348,8 @@ class Vector extends Base { | |||||||
|     ) { |     ) { | ||||||
|       let url = '' |       let url = '' | ||||||
|       that.options.host = that.options.host || getHost() |       that.options.host = that.options.host || getHost() | ||||||
|       if (that.options.host.endsWith('yjearth4.0')) { |       url = that.options.host + '/fileInfo/previewLocal' | ||||||
|         url = that.options.host + '/api/v1/vector/getKml' |       url += '?fileAbsolutePath=' + that.options.path | ||||||
|       } else { |  | ||||||
|         url = that.options.host + '/yjearth4.0/api/v1/vector/getKml' |  | ||||||
|       } |  | ||||||
|       url += '?path=' + that.options.path |  | ||||||
|       // url = 'json/shp.json' |  | ||||||
|       fetch(url, { |       fetch(url, { | ||||||
|         method: 'get', |         method: 'get', | ||||||
|         headers: { |         headers: { | ||||||
| @ -734,17 +729,17 @@ class Vector extends Base { | |||||||
|         left: '180px', |         left: '180px', | ||||||
|         top: '100px', |         top: '100px', | ||||||
|         confirmCallBack: options => { |         confirmCallBack: options => { | ||||||
|           this.fileName = this.fileName.trim() |           this.name = this.name.trim() | ||||||
|           if (!this.fileName) { |           if (!this.name) { | ||||||
|             this.fileName = '未命名对象' |             this.name = '未命名对象' | ||||||
|           } |           } | ||||||
|           this.originalOptions.fileName = this.fileName |           this.originalOptions.name = this.name | ||||||
|           this.originalOptions.field = this.field |           this.originalOptions.field = this.field | ||||||
|           this._DialogObject.close() |           this._DialogObject.close() | ||||||
|           DialogEvent.confirmCallBack && |           DialogEvent.confirmCallBack && | ||||||
|             DialogEvent.confirmCallBack({ |             DialogEvent.confirmCallBack({ | ||||||
|               id: this.options.id, |               id: this.options.id, | ||||||
|               fileName: this.originalOptions.fileName, |               name: this.originalOptions.name, | ||||||
|               field: this.originalOptions.field |               field: this.originalOptions.field | ||||||
|             }) |             }) | ||||||
|         }, |         }, | ||||||
| @ -772,17 +767,17 @@ class Vector extends Base { | |||||||
|       this._DialogObject.contentAppChild(contentElm) |       this._DialogObject.contentAppChild(contentElm) | ||||||
|  |  | ||||||
|       let nameElm = contentElm.getElementsByClassName('flie-name')[0] |       let nameElm = contentElm.getElementsByClassName('flie-name')[0] | ||||||
|       nameElm.value = this.options.fileName |       nameElm.value = this.options.name | ||||||
|       nameElm.addEventListener('input', () => { |       nameElm.addEventListener('input', () => { | ||||||
|         this.options.fileName = nameElm.value |         this.options.name = nameElm.value | ||||||
|       }) |       }) | ||||||
|  |  | ||||||
|       let keyData = [] |       let keyData = [] | ||||||
|       for (let key in this.geojson.features[0].properties) { |       for (let key in this.geojson.features[0].properties) { | ||||||
|         let label = key |         let label = key | ||||||
|         for (let index = 0; index < this.options.head_tables.length; index++) { |         for (let index = 0; index < this.options.headTables.length; index++) { | ||||||
|           if (this.options.head_tables[index].key === key) { |           if (this.options.headTables[index].key === key) { | ||||||
|             label = this.options.head_tables[index].label |             label = this.options.headTables[index].label | ||||||
|             break |             break | ||||||
|           } |           } | ||||||
|         } |         } | ||||||
| @ -820,7 +815,7 @@ class Vector extends Base { | |||||||
|         }) |         }) | ||||||
|         this._elms.field = keyDataLegpElm |         this._elms.field = keyDataLegpElm | ||||||
|       } |       } | ||||||
|       this._elms.fileName = nameElm |       this._elms.name = nameElm | ||||||
|  |  | ||||||
|       return |       return | ||||||
|  |  | ||||||
| @ -833,9 +828,9 @@ class Vector extends Base { | |||||||
|  |  | ||||||
|       for (let key in this.geojson.features[0].properties) { |       for (let key in this.geojson.features[0].properties) { | ||||||
|         let label = key |         let label = key | ||||||
|         for (let index = 0; index < this.options.head_tables.length; index++) { |         for (let index = 0; index < this.options.headTables.length; index++) { | ||||||
|           if (this.options.head_tables[index].key === key) { |           if (this.options.headTables[index].key === key) { | ||||||
|             label = this.options.head_tables[index].label |             label = this.options.headTables[index].label | ||||||
|             break |             break | ||||||
|           } |           } | ||||||
|         } |         } | ||||||
| @ -848,7 +843,7 @@ class Vector extends Base { | |||||||
|         this.options.field = selectElm.value |         this.options.field = selectElm.value | ||||||
|       }) |       }) | ||||||
|  |  | ||||||
|       this._elms.fileName = nameElm |       this._elms.name = nameElm | ||||||
|       this._elms.field = selectElm |       this._elms.field = selectElm | ||||||
|     } else { |     } else { | ||||||
|       if (this._DialogObject && this._DialogObject.close) { |       if (this._DialogObject && this._DialogObject.close) { | ||||||
| @ -858,255 +853,6 @@ class Vector extends Base { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   async editById(status = false, nodeId, DialogEvent = {}) { |  | ||||||
|     // nodeId = this.dataArray[0].attr.id |  | ||||||
|     if (this._DialogObject && this._DialogObject.close) { |  | ||||||
|       this._DialogObject.close() |  | ||||||
|       this._DialogObject = null |  | ||||||
|     } |  | ||||||
|     let cameraName = '' |  | ||||||
|     let index |  | ||||||
|     if (status) { |  | ||||||
|       let options = {} |  | ||||||
|       for (let i = 0; i < this.geojson.features.length; i++) { |  | ||||||
|         if (this.geojson.features[i].id === nodeId) { |  | ||||||
|           if (this.geojson.features[i].content) { |  | ||||||
|             options = this.deepCopyObj(this.geojson.features[i].content) |  | ||||||
|           } |  | ||||||
|           index = i |  | ||||||
|           break |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|       options.id = options.id || nodeId |  | ||||||
|       options.link || (options.link = {}) |  | ||||||
|       options.link.content || (options.link.content = []) |  | ||||||
|       options.camera || (options.camera = []) |  | ||||||
|       options.richTextContent || (options.richTextContent = '') |  | ||||||
|       options.attributeType = options.attributeType || 'richText' |  | ||||||
|       this._DialogObject = await new Dialog(this.sdk, options, { |  | ||||||
|         title: '编辑属性', |  | ||||||
|         left: '180px', |  | ||||||
|         top: '100px', |  | ||||||
|         confirmCallBack: () => { |  | ||||||
|           this._DialogObject.close() |  | ||||||
|           this.geojson.features[index].content = this.deepCopyObj( |  | ||||||
|             this._DialogObject.attribute |  | ||||||
|           ) |  | ||||||
|           DialogEvent.confirmCallBack && |  | ||||||
|             DialogEvent.confirmCallBack(this._DialogObject.attribute) |  | ||||||
|         }, |  | ||||||
|         closeCallBack: () => { |  | ||||||
|           // this.reset() |  | ||||||
|           DialogEvent.closeCallBack && DialogEvent.closeCallBack() |  | ||||||
|         } |  | ||||||
|       }) |  | ||||||
|       this._DialogObject.event = DialogEvent |  | ||||||
|       this._DialogObject.attribute = this.deepCopyObj(options) |  | ||||||
|       let html = ` |  | ||||||
|         <div class="row"> |  | ||||||
|           <div class="col"> |  | ||||||
|             <span class="label">内容类型:</span> |  | ||||||
|             <select class="input input-select attribute-select" style="width: 120px;"> |  | ||||||
|               <option value="richText">富文本</option> |  | ||||||
|               <!--<option value="link">链接</option> |  | ||||||
|               <option value="camera">摄像头</option> |  | ||||||
|               <option value="sensor">传感器</option> |  | ||||||
|               <option value="vr">全景图</option>--> |  | ||||||
|             </select> |  | ||||||
|           </div> |  | ||||||
|           <div class="col attribute-content attribute-content-link"> |  | ||||||
|             <div class="input-group"> |  | ||||||
|               <input class="input link_add" type="text"> |  | ||||||
|               <button class="link_add_btn">+</button> |  | ||||||
|             </div> |  | ||||||
|           </div> |  | ||||||
|         </div> |  | ||||||
|         <div class="attribute-content attribute-content-richText"> |  | ||||||
|           <span>编辑内容:<button class="open-richText-btn">打开文本编辑器</button></span> |  | ||||||
|         </div> |  | ||||||
|         <div class="attribute-content attribute-content-link"> |  | ||||||
|           <div class="table"> |  | ||||||
|             <div class="table-head"> |  | ||||||
|               <div class="tr"> |  | ||||||
|                 <div class="th">名称</div> |  | ||||||
|                 <div class="th">链接</div> |  | ||||||
|                 <div class="th">操作</div> |  | ||||||
|               </div> |  | ||||||
|             </div> |  | ||||||
|             <div class="table-body"> |  | ||||||
|             </div> |  | ||||||
|             <div class="table-empty"> |  | ||||||
|               <div class="empty-img"></div> |  | ||||||
|               <p>暂无数据</p> |  | ||||||
|             </div> |  | ||||||
|           </div> |  | ||||||
|         </div> |  | ||||||
|         <div class="attribute-content attribute-content-camera"> |  | ||||||
|                 <div class="row"> |  | ||||||
|                     <div class="col"> |  | ||||||
|                         <span class="label">编辑内容:</span> |  | ||||||
|                         <input class="input camera-name" type="text" style="width: 100px;"> |  | ||||||
|                         <button class="select btn camera-select">搜索</button> |  | ||||||
|                     </div> |  | ||||||
|                 </div> |  | ||||||
|                 <div> |  | ||||||
|                     <div class="table camera-table"> |  | ||||||
|                         <div class="table-head"> |  | ||||||
|                             <div class="tr"> |  | ||||||
|                                 <div class="th">操作</div> |  | ||||||
|                                 <div class="th">设备名称</div> |  | ||||||
|                                 <div class="th" style="width: 80px; flex: 0 80px;min-width: 80px;">设备类型</div> |  | ||||||
|                                 <div class="th" style="width: 126px; flex: 0 126px;min-width: 126px;">设备IP</div> |  | ||||||
|                                 <div class="th" style="width: 80px; flex: 0 80px;min-width: 80px;">设备端口</div> |  | ||||||
|                                 <div class="th" style="width: 80px; flex: 0 80px;min-width: 80px;">用户名</div> |  | ||||||
|                                 <div class="th">密码</div> |  | ||||||
|                             </div> |  | ||||||
|                         </div> |  | ||||||
|                         <div class="table-body" style="display:none;"> |  | ||||||
|                             <div class="tr"> |  | ||||||
|                                 <div class="td"> |  | ||||||
|                                   <input type="checkbox" value="2"> |  | ||||||
|                                   <span>绑定</span> |  | ||||||
|                                 </div> |  | ||||||
|                                 <div class="td">设备名称</div> |  | ||||||
|                                 <div class="td">设备类型</div> |  | ||||||
|                                 <div class="td">设备IP</div> |  | ||||||
|                                 <div class="td">设备端口</div> |  | ||||||
|                                 <div class="td">用户名</div> |  | ||||||
|                                 <div class="td">密码</div> |  | ||||||
|                             </div> |  | ||||||
|                         </div> |  | ||||||
|                         <div class="table-empty"> |  | ||||||
|                             <div class="empty-img"></div> |  | ||||||
|                             <p>暂无数据</p> |  | ||||||
|                         </div> |  | ||||||
|                     </div> |  | ||||||
|                 </div> |  | ||||||
|                 <div class=""row> |  | ||||||
|                     <ul class="pagination"></ul> |  | ||||||
|                 </div> |  | ||||||
|             </div> |  | ||||||
|       ` |  | ||||||
|       let contentElm = document.createElement('div') |  | ||||||
|       contentElm.innerHTML = html |  | ||||||
|       this._DialogObject.contentAppChild(contentElm) |  | ||||||
|       let all_elm = contentElm.getElementsByTagName('*') |  | ||||||
|  |  | ||||||
|       this._DialogObject._element.body.style.width = '600px' |  | ||||||
|  |  | ||||||
|       let attributeSelectElm = contentElm.getElementsByClassName( |  | ||||||
|         'attribute-select' |  | ||||||
|       )[0] |  | ||||||
|       let linkAddBtnElm = contentElm.getElementsByClassName('link_add_btn')[0] |  | ||||||
|       let openRichTextBtnElm = contentElm.getElementsByClassName( |  | ||||||
|         'open-richText-btn' |  | ||||||
|       )[0] |  | ||||||
|  |  | ||||||
|       let attributeContent = this._DialogObject._element.content.getElementsByClassName( |  | ||||||
|         'attribute-content' |  | ||||||
|       ) |  | ||||||
|       for (let i = 0; i < attributeContent.length; i++) { |  | ||||||
|         if ( |  | ||||||
|           attributeContent[i].className.indexOf( |  | ||||||
|             'attribute-content-' + this._DialogObject.attribute.attributeType |  | ||||||
|           ) > -1 |  | ||||||
|         ) { |  | ||||||
|           attributeContent[i].style.display = 'block' |  | ||||||
|         } else { |  | ||||||
|           attributeContent[i].style.display = 'none' |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|       attributeSelectElm.addEventListener('change', () => { |  | ||||||
|         this._DialogObject.attribute.attributeType = attributeSelectElm.value |  | ||||||
|         for (let i = 0; i < attributeContent.length; i++) { |  | ||||||
|           if ( |  | ||||||
|             attributeContent[i].className.indexOf( |  | ||||||
|               'attribute-content-' + this._DialogObject.attribute.attributeType |  | ||||||
|             ) > -1 |  | ||||||
|           ) { |  | ||||||
|             attributeContent[i].style.display = 'block' |  | ||||||
|           } else { |  | ||||||
|             attributeContent[i].style.display = 'none' |  | ||||||
|           } |  | ||||||
|         } |  | ||||||
|       }) |  | ||||||
|  |  | ||||||
|       linkAddBtnElm.addEventListener('click', async () => { |  | ||||||
|         if ( |  | ||||||
|           this._DialogObject._element.content.getElementsByClassName( |  | ||||||
|             'link_add' |  | ||||||
|           )[0].value |  | ||||||
|         ) { |  | ||||||
|           this._DialogObject.attribute.link.content.push({ |  | ||||||
|             name: '链接', |  | ||||||
|             url: this._DialogObject._element.content.getElementsByClassName( |  | ||||||
|               'link_add' |  | ||||||
|             )[0].value |  | ||||||
|           }) |  | ||||||
|           this._DialogObject._element.content.getElementsByClassName( |  | ||||||
|             'link_add' |  | ||||||
|           )[0].value = '' |  | ||||||
|           this.setAttributeLinkById( |  | ||||||
|             nodeId, |  | ||||||
|             this._DialogObject.attribute.link.content |  | ||||||
|           ) |  | ||||||
|         } else { |  | ||||||
|           DialogEvent.clickAddLink && DialogEvent.clickAddLink(nodeId) |  | ||||||
|         } |  | ||||||
|       }) |  | ||||||
|  |  | ||||||
|       openRichTextBtnElm.addEventListener('click', () => { |  | ||||||
|         richText.open( |  | ||||||
|           nodeId, |  | ||||||
|           nodeId, |  | ||||||
|           this._DialogObject.attribute.richTextContent |  | ||||||
|         ) |  | ||||||
|         richText.primaryCallBack = content => { |  | ||||||
|           this._DialogObject.attribute.richTextContent = content |  | ||||||
|         } |  | ||||||
|       }) |  | ||||||
|  |  | ||||||
|       let cameraNameElm = contentElm.getElementsByClassName('camera-name')[0] |  | ||||||
|       let cameraSelectElm = contentElm.getElementsByClassName( |  | ||||||
|         'camera-select' |  | ||||||
|       )[0] |  | ||||||
|       cameraNameElm.addEventListener('input', () => { |  | ||||||
|         cameraName = cameraNameElm.value |  | ||||||
|       }) |  | ||||||
|       this.cameraSelect && this.cameraSelect(cameraName) |  | ||||||
|       cameraSelectElm.addEventListener('click', () => { |  | ||||||
|         this.cameraSelect && this.cameraSelect(cameraName) |  | ||||||
|       }) |  | ||||||
|  |  | ||||||
|       // let nameElm = contentElm.getElementsByClassName('flie-name')[0] |  | ||||||
|       // nameElm.value = this.options.fileName |  | ||||||
|       // nameElm.addEventListener('input', ()=>{ |  | ||||||
|       //   this.options.fileName = nameElm.value |  | ||||||
|       // }) |  | ||||||
|  |  | ||||||
|       // let selectElm = contentElm.getElementsByClassName('input-select')[0] |  | ||||||
|       // let option = '' |  | ||||||
|       // for(let key in this.dataArray[0].attr) { |  | ||||||
|       //   let o = `<option value="${key}">${key}</option>` |  | ||||||
|       //   option = option + o |  | ||||||
|       // } |  | ||||||
|       // selectElm.innerHTML = option |  | ||||||
|       // selectElm.value = this.options.field |  | ||||||
|       // selectElm.addEventListener('input', ()=>{ |  | ||||||
|       //   this.options.field = selectElm.value |  | ||||||
|       // }) |  | ||||||
|  |  | ||||||
|       // this._elms.fileName = nameElm |  | ||||||
|       // this._elms.field = selectElm |  | ||||||
|     } else { |  | ||||||
|       if (this._DialogObject && this._DialogObject.close) { |  | ||||||
|         this._DialogObject.close() |  | ||||||
|         this._DialogObject = null |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   editContentById(nodeId, content) { |   editContentById(nodeId, content) { | ||||||
|     for (let i = 0; i < this.geojson.features.length; i++) { |     for (let i = 0; i < this.geojson.features.length; i++) { | ||||||
|       if (this.geojson.features[i].id === nodeId) { |       if (this.geojson.features[i].id === nodeId) { | ||||||
| @ -1117,7 +863,7 @@ class Vector extends Base { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   reset() { |   reset() { | ||||||
|     this.fileName = this.originalOptions.fileName |     this.name = this.originalOptions.name | ||||||
|     this.field = this.originalOptions.field |     this.field = this.originalOptions.field | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @ -1332,7 +1078,7 @@ class Vector extends Base { | |||||||
|     return trsElm |     return trsElm | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   flyTo(id, options = {}) { |   async flyTo(id, options = {}) { | ||||||
|     setActiveViewer(0) |     setActiveViewer(0) | ||||||
|     closeRotateAround(this.sdk) |     closeRotateAround(this.sdk) | ||||||
|     closeViewFollow(this.sdk) |     closeViewFollow(this.sdk) | ||||||
| @ -1392,33 +1138,34 @@ class Vector extends Base { | |||||||
|         } |         } | ||||||
|       } |       } | ||||||
|     } else { |     } else { | ||||||
|       if ( |       if (this.range) { | ||||||
|         this.options.customView && |         if ( | ||||||
|         this.options.customView.relativePosition && |           this.options.customView && | ||||||
|         this.options.customView.orientation |           this.options.customView.relativePosition && | ||||||
|       ) { |           this.options.customView.orientation | ||||||
|         let orientation = { |         ) { | ||||||
|           heading: Cesium.Math.toRadians( |           let orientation = { | ||||||
|             this.options.customView.orientation.heading || 0.0 |             heading: Cesium.Math.toRadians( | ||||||
|           ), |               this.options.customView.orientation.heading || 0.0 | ||||||
|           pitch: Cesium.Math.toRadians( |             ), | ||||||
|             this.options.customView.orientation.pitch || -60.0 |             pitch: Cesium.Math.toRadians( | ||||||
|           ), |               this.options.customView.orientation.pitch || -60.0 | ||||||
|           roll: Cesium.Math.toRadians( |             ), | ||||||
|             this.options.customView.orientation.roll || 0.0 |             roll: Cesium.Math.toRadians( | ||||||
|           ) |               this.options.customView.orientation.roll || 0.0 | ||||||
|         } |             ) | ||||||
|  |           } | ||||||
|         let lng = this.options.customView.relativePosition.lng |           let position = { lng: this.range[0], lat: this.range[1] } | ||||||
|         let lat = this.options.customView.relativePosition.lat |           position.alt = await this.getClampToHeight(position) | ||||||
|         let alt = this.options.customView.relativePosition.alt |           let lng = this.options.customView.relativePosition.lng + position.lng | ||||||
|         let destination = Cesium.Cartesian3.fromDegrees(lng, lat, alt) |           let lat = this.options.customView.relativePosition.lat + position.lat | ||||||
|         this.sdk.viewer.camera.flyTo({ |           let alt = this.options.customView.relativePosition.alt + position.alt | ||||||
|           destination: destination, |           let destination = Cesium.Cartesian3.fromDegrees(lng, lat, alt) | ||||||
|           orientation: orientation |           this.sdk.viewer.camera.flyTo({ | ||||||
|         }) |             destination: destination, | ||||||
|       } else { |             orientation: orientation | ||||||
|         if (this.range) { |           }) | ||||||
|  |         } else { | ||||||
|           let array = [] |           let array = [] | ||||||
|           this.getClampToHeight({ |           this.getClampToHeight({ | ||||||
|             lng: this.range[0], |             lng: this.range[0], | ||||||
| @ -1537,164 +1284,6 @@ class Vector extends Base { | |||||||
|     this.imgEntity = [] |     this.imgEntity = [] | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   cameraSelect(cameraName, page) { |  | ||||||
|     const type = { |  | ||||||
|       '1': '海康', |  | ||||||
|       '2': '大华' |  | ||||||
|     } |  | ||||||
|     let host = this.options.host |  | ||||||
|     if ( |  | ||||||
|       this._DialogObject && |  | ||||||
|       this._DialogObject._element && |  | ||||||
|       this._DialogObject._element.content |  | ||||||
|     ) { |  | ||||||
|       let paginationElm = that._DialogObject._element.content.getElementsByClassName( |  | ||||||
|         'pagination' |  | ||||||
|       )[0] |  | ||||||
|       let attributeCameraElm = that._DialogObject._element.content.getElementsByClassName( |  | ||||||
|         'attribute-content-camera' |  | ||||||
|       )[0] |  | ||||||
|       if (!paginationElm) { |  | ||||||
|         return |  | ||||||
|       } |  | ||||||
|       if (!attributeCameraElm) { |  | ||||||
|         return |  | ||||||
|       } |  | ||||||
|       generatePagination(paginationElm, 1, 10, 1) |  | ||||||
|     } else { |  | ||||||
|       return |  | ||||||
|     } |  | ||||||
|     let url = '' |  | ||||||
|     const params = { |  | ||||||
|       cameraName: cameraName, |  | ||||||
|       page: !page || typeof page === 'object' ? 1 : page, |  | ||||||
|       pageSize: 5 |  | ||||||
|     } |  | ||||||
|     const queryString = new URLSearchParams(params).toString() |  | ||||||
|     if (host.endsWith('yjearth4.0')) |  | ||||||
|       url = `${host}/api/v1/cameraData/list?${queryString}` |  | ||||||
|     else url = `${host}/yjearth4.0/api/v1/cameraData/list?${queryString}` |  | ||||||
|     // url = this.options.path |  | ||||||
|     fetch(url, { |  | ||||||
|       method: 'get', |  | ||||||
|       headers: { |  | ||||||
|         'Content-Type': 'application/json', |  | ||||||
|         token: getToken(), |  | ||||||
|         Authorization: 'Bearer ' + getToken() |  | ||||||
|       } |  | ||||||
|     }).then(response => { |  | ||||||
|       if (response.status === 200) { |  | ||||||
|         response.json().then(data => { |  | ||||||
|           if (data.code === 200 || data.code === 0) { |  | ||||||
|             if ( |  | ||||||
|               !this._DialogObject || |  | ||||||
|               !this._DialogObject._element || |  | ||||||
|               !this._DialogObject._element.content |  | ||||||
|             ) { |  | ||||||
|               return |  | ||||||
|             } |  | ||||||
|             let paginationElm = this._DialogObject._element.content.getElementsByClassName( |  | ||||||
|               'pagination' |  | ||||||
|             )[0] |  | ||||||
|             let table = this._DialogObject._element.content.getElementsByClassName( |  | ||||||
|               'camera-table' |  | ||||||
|             )[0] |  | ||||||
|             let tableContent = table.getElementsByClassName('table-body')[0] |  | ||||||
|             tableContent.innerHTML = '' |  | ||||||
|             if (data.data) { |  | ||||||
|               if (data.data.list && data.data.list.length > 0) { |  | ||||||
|                 generatePagination( |  | ||||||
|                   paginationElm, |  | ||||||
|                   data.data.total, |  | ||||||
|                   10, |  | ||||||
|                   1, |  | ||||||
|                   pageIndex => { |  | ||||||
|                     this.cameraSelect && |  | ||||||
|                       this.cameraSelect(cameraName, pageIndex) |  | ||||||
|                   } |  | ||||||
|                 ) |  | ||||||
|                 table.getElementsByClassName('table-empty')[0].style.display = |  | ||||||
|                   'none' |  | ||||||
|                 tableContent.style.display = 'inline-flex' |  | ||||||
|                 for (let i = 0; i < data.data.list.length; i++) { |  | ||||||
|                   let tr = ` |  | ||||||
|                     <div class="tr"> |  | ||||||
|                       <div class="td"> |  | ||||||
|                         <input type="checkbox" value="${data.data.list[i].ID}"> |  | ||||||
|                         <span>绑定</span> |  | ||||||
|                       </div> |  | ||||||
|                       <div class="td">${data.data.list[i].cameraName}</div> |  | ||||||
|                       <div class="td" style="width: 80px; flex: 0 80px; min-width: 80px;">${type[data.data.list[i].type] |  | ||||||
|                     }</div> |  | ||||||
|                       <div class="td" style="width: 126px; flex: 0 126px;min-width: 126px;">${data.data.list[i].ip |  | ||||||
|                     }</div> |  | ||||||
|                       <div class="td" style="width: 80px; flex: 0 80px;min-width: 80px;">${data.data.list[i].port |  | ||||||
|                     }</div> |  | ||||||
|                       <div class="td" style="width: 80px; flex: 0 80px;min-width: 80px;">${data.data.list[i].userName |  | ||||||
|                     }</div> |  | ||||||
|                       <div class="td">${data.data.list[i].passWord}</div> |  | ||||||
|                     </div>` |  | ||||||
|                   let trElm = document |  | ||||||
|                     .createRange() |  | ||||||
|                     .createContextualFragment(tr) |  | ||||||
|                   let checkbox = trElm.querySelector('input[type="checkbox"]') |  | ||||||
|                   checkbox.addEventListener('change', () => { |  | ||||||
|                     if (checkbox.checked) { |  | ||||||
|                       this._DialogObject.attribute.camera.push( |  | ||||||
|                         data.data.list[i] |  | ||||||
|                       ) |  | ||||||
|                     } else { |  | ||||||
|                       let newArray = this._DialogObject.attribute.camera.filter( |  | ||||||
|                         item => { |  | ||||||
|                           return item.ID !== data.data.list[i].ID |  | ||||||
|                         } |  | ||||||
|                       ) |  | ||||||
|                       this._DialogObject.attribute.camera = newArray |  | ||||||
|                     } |  | ||||||
|                   }) |  | ||||||
|                   tableContent.appendChild(trElm) |  | ||||||
|  |  | ||||||
|                   for ( |  | ||||||
|                     let m = 0; |  | ||||||
|                     m < this._DialogObject.attribute.camera.length; |  | ||||||
|                     m++ |  | ||||||
|                   ) { |  | ||||||
|                     if ( |  | ||||||
|                       this._DialogObject.attribute.camera[m].ID === |  | ||||||
|                       data.data.list[i].ID |  | ||||||
|                     ) { |  | ||||||
|                       checkbox.checked = true |  | ||||||
|                       break |  | ||||||
|                     } |  | ||||||
|                   } |  | ||||||
|                 } |  | ||||||
|               } |  | ||||||
|               if (data.data && data.data.total) { |  | ||||||
|                 generatePagination( |  | ||||||
|                   paginationElm, |  | ||||||
|                   data.data.total, |  | ||||||
|                   10, |  | ||||||
|                   1, |  | ||||||
|                   pageIndex => { |  | ||||||
|                     this.cameraSelect && |  | ||||||
|                       this.cameraSelect(cameraName, pageIndex) |  | ||||||
|                   } |  | ||||||
|                 ) |  | ||||||
|               } |  | ||||||
|             } else { |  | ||||||
|               generatePagination(paginationElm, 1, 10, 1) |  | ||||||
|               table.getElementsByClassName('table-empty')[0].style.display = |  | ||||||
|                 'flex' |  | ||||||
|               tableContent.style.display = 'none' |  | ||||||
|             } |  | ||||||
|           } else { |  | ||||||
|             console.error(data.message) |  | ||||||
|           } |  | ||||||
|         }) |  | ||||||
|       } |  | ||||||
|     }) |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   load(callback) { |   load(callback) { | ||||||
|     if (this.#loaded) { |     if (this.#loaded) { | ||||||
|       callback() |       callback() | ||||||
|  | |||||||
| @ -27,6 +27,7 @@ import { | |||||||
| import { syncSplitData, setActiveId } from '../Global/SplitScreen' | import { syncSplitData, setActiveId } from '../Global/SplitScreen' | ||||||
| import { apiQueryGoodsList } from '../Tools/getGoodsList' | import { apiQueryGoodsList } from '../Tools/getGoodsList' | ||||||
| import YJColorPicker from "../Obj/Element/yj-color-picker"; | import YJColorPicker from "../Obj/Element/yj-color-picker"; | ||||||
|  | import { destroy as mapxDestroy } from "../Global/MapX"; | ||||||
| // window.check = check | // window.check = check | ||||||
|  |  | ||||||
| class YJEarth { | class YJEarth { | ||||||
| @ -168,6 +169,7 @@ class YJEarth { | |||||||
|     this.viewer = new Cesium.Viewer(this.div_id, this.options) |     this.viewer = new Cesium.Viewer(this.div_id, this.options) | ||||||
|     this.viewer.scene.imageryLayers._layers[0].notes = 'default-base-map' |     this.viewer.scene.imageryLayers._layers[0].notes = 'default-base-map' | ||||||
|     this.viewer._shadows = this.viewer.shadows |     this.viewer._shadows = this.viewer.shadows | ||||||
|  |     this.viewer._container.style.display = 'flex' | ||||||
|  |  | ||||||
|     this.viewer.scene.screenSpaceCameraController.maximumZoomDistance = 50000000 |     this.viewer.scene.screenSpaceCameraController.maximumZoomDistance = 50000000 | ||||||
|  |  | ||||||
| @ -472,8 +474,10 @@ class YJEarth { | |||||||
|           _this.isLeftClick = true |           _this.isLeftClick = true | ||||||
|           _this.entityMap.get(_this.clickTextDom.id).isClick(movement.position, _this.clickTextDom.id) |           _this.entityMap.get(_this.clickTextDom.id).isClick(movement.position, _this.clickTextDom.id) | ||||||
|  |  | ||||||
|  |           _this.blurFun && _this.clickTextDom.querySelector('textarea').removeEventListener('blur', _this.blurFun) | ||||||
|           _this.blurFun = () => { |           _this.blurFun = () => { | ||||||
|             _this.entityMap.get(_this.clickTextDom.id).isClick((movement && movement.position) || null, _this.clickTextDom.id) |             _this.entityMap.get(_this.clickTextDom.id).isClick((movement && movement.position) || null, _this.clickTextDom.id) | ||||||
|  |  | ||||||
|             _this.entityMap.get(_this.clickTextDom.id).getwords(_this.clickTextDom.getElementsByTagName('textarea')[0].value) |             _this.entityMap.get(_this.clickTextDom.id).getwords(_this.clickTextDom.getElementsByTagName('textarea')[0].value) | ||||||
|           } |           } | ||||||
|           _this.clickTextDom.querySelector('textarea').addEventListener('blur', _this.blurFun) |           _this.clickTextDom.querySelector('textarea').addEventListener('blur', _this.blurFun) | ||||||
| @ -531,7 +535,10 @@ class YJEarth { | |||||||
|         _this.clickTextDom.removeEventListener('mousedown', mousedown); |         _this.clickTextDom.removeEventListener('mousedown', mousedown); | ||||||
|         _this.viewer._element.removeEventListener('mousemove', mousemove); |         _this.viewer._element.removeEventListener('mousemove', mousemove); | ||||||
|         _this.viewer._element.removeEventListener('mouseup', mouseup); |         _this.viewer._element.removeEventListener('mouseup', mouseup); | ||||||
|         _this.entityMap.get(_this.clickTextDom.id).getwords(_this.clickTextDom.getElementsByTagName('textarea')[0].value) |         // if (!returnMsg) { | ||||||
|  |         //   _this.entityMap.get(_this.clickTextDom.id).getwords(_this.clickTextDom.getElementsByTagName('textarea')[0].value) | ||||||
|  |         //   returnMsg = true | ||||||
|  |         // } | ||||||
|  |  | ||||||
|         _this.clickTextDom.style['pointer-events'] = 'none' |         _this.clickTextDom.style['pointer-events'] = 'none' | ||||||
|         _this.clickTextDom = undefined |         _this.clickTextDom = undefined | ||||||
| @ -566,6 +573,7 @@ class YJEarth { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (this.viewer) { |     if (this.viewer) { | ||||||
|  |       mapxDestroy(this) | ||||||
|       if (this.viewer.entities) { |       if (this.viewer.entities) { | ||||||
|         this.viewer.entities.removeAll() |         this.viewer.entities.removeAll() | ||||||
|       } |       } | ||||||
|  | |||||||
| @ -17,7 +17,8 @@ function on( | |||||||
|     hls: false, |     hls: false, | ||||||
|     host: '', |     host: '', | ||||||
|     username: '', |     username: '', | ||||||
|     password: '' |     password: '', | ||||||
|  |     token: '' | ||||||
|   } |   } | ||||||
| ) { | ) { | ||||||
|   // window.THREE = THREE |   // window.THREE = THREE | ||||||
| @ -126,6 +127,7 @@ function on( | |||||||
|               resolve() |               resolve() | ||||||
|             }) |             }) | ||||||
|           } else { |           } else { | ||||||
|  |             setToken(options.token) | ||||||
|             resolve() |             resolve() | ||||||
|           } |           } | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -20096,8 +20096,8 @@ | |||||||
|         var testing = |         var testing = | ||||||
|           '<div class="compass" title="拖动外圈:旋转视图,' + |           '<div class="compass" title="拖动外圈:旋转视图,' + | ||||||
|           '拖动内陀螺仪:自由轨道,' + |           '拖动内陀螺仪:自由轨道,' + | ||||||
|           '双击:重置视图,' + |           '双击:重置视图' + | ||||||
|           '提示:您还可以按住CTRL键并拖动地图来释放轨道." data-bind="visible: showCompass, event: { mousedown: handleMouseDown, dblclick: handleDoubleClick }">' + |           '" data-bind="visible: showCompass, event: { mousedown: handleMouseDown, dblclick: handleDoubleClick }">' + | ||||||
|           '<div class="compass-outer-ring-background"></div>' + |           '<div class="compass-outer-ring-background"></div>' + | ||||||
|           " <div class=\"compass-rotation-marker\" data-bind=\"visible: isOrbiting, style: { transform: 'rotate(-' + orbitCursorAngle + 'rad)', '-webkit-transform': 'rotate(-' + orbitCursorAngle + 'rad)', opacity: orbitCursorOpacity }, cesiumSvgPath: { path: svgCompassRotationMarker, width: 145, height: 145 }\"></div>" + |           " <div class=\"compass-rotation-marker\" data-bind=\"visible: isOrbiting, style: { transform: 'rotate(-' + orbitCursorAngle + 'rad)', '-webkit-transform': 'rotate(-' + orbitCursorAngle + 'rad)', opacity: orbitCursorOpacity }, cesiumSvgPath: { path: svgCompassRotationMarker, width: 145, height: 145 }\"></div>" + | ||||||
|           " <div class=\"compass-outer-ring\" title=\"单击并拖动以旋转相机\" data-bind=\"style: { transform: 'rotate(-' + heading + 'rad)', '-webkit-transform': 'rotate(-' + heading + 'rad)' }, cesiumSvgPath: { path: svgCompassOuterRing, width: 145, height: 145 }\"></div>" + |           " <div class=\"compass-outer-ring\" title=\"单击并拖动以旋转相机\" data-bind=\"style: { transform: 'rotate(-' + heading + 'rad)', '-webkit-transform': 'rotate(-' + heading + 'rad)' }, cesiumSvgPath: { path: svgCompassOuterRing, width: 145, height: 145 }\"></div>" + | ||||||
|  | |||||||
| @ -3862,12 +3862,24 @@ | |||||||
| } | } | ||||||
|  |  | ||||||
| #YJ-custom-message.success { | #YJ-custom-message.success { | ||||||
|   background-color: #f0f9eb; |   /* background-color: #f0f9eb; */ | ||||||
|   color: rgb(82, 196, 26); |   /* color: rgb(82, 196, 26); */ | ||||||
|  |   background: | ||||||
|  |       linear-gradient(180deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), | ||||||
|  |       linear-gradient(0deg, rgba(27, 248, 195, 0.5) 0%, rgba(27, 248, 195, 0) 100%); | ||||||
|  |   font-size: 14px !important; | ||||||
|  |   font-weight: 500 !important; | ||||||
|  |   color: rgba(27, 248, 195, 1); | ||||||
| } | } | ||||||
| #YJ-custom-message.warning { | #YJ-custom-message.warning { | ||||||
|   background-color: #fdf6ec; |   /* background-color: #fdf6ec; | ||||||
|   color: #e6a23c; |   color: #e6a23c; */ | ||||||
|  |   background: | ||||||
|  |       linear-gradient(180deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), | ||||||
|  |       linear-gradient(0deg, rgba(255, 161, 69, 0.5) 0%, rgba(255, 161, 69, 0) 100%); | ||||||
|  |   font-size: 14px !important; | ||||||
|  |   font-weight: 500 !important; | ||||||
|  |   color: rgba(255, 161, 69, 1) | ||||||
| } | } | ||||||
|  |  | ||||||
| /* 滑入动画 */ | /* 滑入动画 */ | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user