ViewShed3D.html 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>地形可视域分析</title>
  7. <link rel="stylesheet" href="../../dist/index.css" />
  8. <link href="../../cesium/Source/Widgets/widgets.css" rel="stylesheet">
  9. <script src="../../cesium/Build/Cesium/Cesium.js"></script>
  10. <script src="../../dist/index.js"></script>
  11. <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  12. <style>
  13. * {
  14. padding: 0;
  15. margin: 0;
  16. }
  17. </style>
  18. </head>
  19. <body>
  20. <div id="map" style="height: 90vh; width: 100vw;"></div>
  21. <div id="func" style="height: 10vh; width: 100vw;">
  22. <button onclick="clearfunc()">清除</button>
  23. <button onclick="destoryfunc()">销毁</button>
  24. </div>
  25. </body>
  26. <script>
  27. window.CESIUM_BASE_URL = '../../cesium/Build/CesiumUnminified';
  28. Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI2MjIyODA4ZS0zNmRmLTQwNGMtYjZkNC0wOGY2NDdmODgyZTUiLCJpZCI6ODMyOCwiaWF0IjoxNjA2MjkyNDE1fQ.ZhhxNIJ-TzstpcavQBNL7xRwytBat3G2__3jr7lJ8yg'
  29. let opt = CTMapOl.thrdime.viewercontrol.globalvieweroptions()
  30. // opt.contextOptions = {
  31. // requestWebgl1: true,
  32. // }
  33. let viewer = CTMapOl.thrdime.viewercontrol.globalviewer('map', opt)
  34. viewer._cesiumWidget._creditContainer.style.display = 'none'
  35. CTMapOl.thrdime.imagerylayercontrol.removeAll(viewer, true)
  36. CTMapOl.thrdime.imagerylayercontrol.addImageryProvider(viewer, CTMapOl.thrdime.imagerylayercontrol.gettdtImagery('img', "img_w"))
  37. CTMapOl.thrdime.imagerylayercontrol.addImageryProvider(viewer, CTMapOl.thrdime.imagerylayercontrol.gettdtImagery('cia', "cia_w"))
  38. CTMapOl.thrdime.cameracontrol.setDEFAULT_VIEW_RECTANGLE(116.38, 39.90, 116.40, 39.92)
  39. CTMapOl.thrdime.cameracontrol.setcamera(viewer, CTMapOl.thrdime.cameracontrol.getcameraoptionswithdetile(116.39, 39.91, 5000, 0, -90, 0))
  40. CTMapOl.thrdime.viewercontrol.addterrainct(viewer)
  41. let viewShedAnalysis =CTMapOl.cesiumComponent.ViewShedAnalysis(viewer);
  42. function clearfunc()
  43. {
  44. viewShedAnalysis.clear()
  45. }
  46. function destoryfunc()
  47. {
  48. viewShedAnalysis.clear()
  49. }
  50. </script>
  51. </html>