CameraLocationAnalysis.html 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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: 100vh; width: 100vw;"></div>
  21. <div class="box">
  22. <div class="itembox">
  23. <div class="title">经度:</div>
  24. <input class="iteminput" type="number" id="lon" value="116.39492695742041">
  25. </div>
  26. <div class="itembox">
  27. <div class="title">纬度:</div>
  28. <input class="iteminput" type="number" id="lat" value="39.91">
  29. </div>
  30. <div class="itembox">
  31. <div class="title">海拔(m):</div>
  32. <input class="iteminput" type="number" id="hb" value="200">
  33. </div>
  34. <div class="itembox">
  35. <div class="title">设置挂高(m):</div>
  36. <input class="iteminput" type="number" id="gg" value="20">
  37. </div>
  38. <div class="itembox">
  39. <div class="title">水平视角(°):</div>
  40. <input class="iteminput" type="number" id="spsj" value="90">
  41. </div>
  42. <div class="itembox">
  43. <div class="title">垂直视角(°):</div>
  44. <input class="iteminput" type="number" id="czsj" value="90">
  45. </div>
  46. <div class="itembox">
  47. <div class="title">方向角(°):</div>
  48. <input class="iteminput" type="number" id="fxj" value="3">
  49. </div>
  50. <div class="itembox">
  51. <div class="title">俯仰角(°):</div>
  52. <input class="iteminput" type="number" id="fyj" value="-30">
  53. </div>
  54. <div class="itembox">
  55. <div class="title">视野距离(Km):</div>
  56. <input class="iteminput" type="number" id="syjl" value="0.5">
  57. </div>
  58. <button class="btn" onclick="activeSearch()">绘制</button>
  59. </div>
  60. </div>
  61. </body>
  62. <script>
  63. window.CESIUM_BASE_URL = '../../cesium/Build/CesiumUnminified';
  64. Cesium.Ion.defaultAccessToken =
  65. 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI2MjIyODA4ZS0zNmRmLTQwNGMtYjZkNC0wOGY2NDdmODgyZTUiLCJpZCI6ODMyOCwiaWF0IjoxNjA2MjkyNDE1fQ.ZhhxNIJ-TzstpcavQBNL7xRwytBat3G2__3jr7lJ8yg'
  66. var viewer = CTMapOl.thrdime.viewercontrol.globalviewer('map', CTMapOl.thrdime.viewercontrol.globalvieweroptions())
  67. viewer._cesiumWidget._creditContainer.style.display = 'none'
  68. CTMapOl.thrdime.imagerylayercontrol.removeAll(viewer, true)
  69. CTMapOl.thrdime.imagerylayercontrol.addImageryProvider(viewer, CTMapOl.thrdime.imagerylayercontrol.gettdtImagery(
  70. 'img', "img_w"))
  71. CTMapOl.thrdime.imagerylayercontrol.addImageryProvider(viewer, CTMapOl.thrdime.imagerylayercontrol.gettdtImagery(
  72. 'cia', "cia_w"))
  73. CTMapOl.thrdime.cameracontrol.setDEFAULT_VIEW_RECTANGLE(116.38, 39.90, 116.40, 39.92)
  74. CTMapOl.thrdime.cameracontrol.setcamera(viewer, CTMapOl.thrdime.cameracontrol.getcameraoptionswithdetile(116.39,
  75. 39.91, 5000, 0, -90, 0))
  76. CTMapOl.thrdime.viewercontrol.addterrain(viewer)
  77. let CameraLocationAnalysis = new CTMapOl.cesiumComponent.CameraLocationAnalysis(viewer)
  78. console.log(CameraLocationAnalysis,'CameraLocationAnalysis')
  79. function activeSearch() {
  80. let form = {
  81. lon: Number(document.getElementById("lon").value),
  82. lat: Number(document.getElementById("lat").value),
  83. hb: Number(document.getElementById("hb").value),
  84. gg: Number(document.getElementById("gg").value),
  85. spsj: Number(document.getElementById("spsj").value),
  86. czsj: Number(document.getElementById("czsj").value),
  87. fxj: Number(document.getElementById("fxj").value),
  88. fyj: Number(document.getElementById("fyj").value),
  89. syjl: Number(document.getElementById("syjl").value),
  90. }
  91. CameraLocationAnalysis.active(form)
  92. alert('计算完成')
  93. CTMapOl.thrdime.cameracontrol.setcamera(viewer, CTMapOl.thrdime.cameracontrol.getcameraoptionswithdetile(form.lon,
  94. form.lat, 300, 0, -90, 0))
  95. }
  96. </script>
  97. <style>
  98. .box {
  99. position: absolute;
  100. z-index: 01;
  101. top: 5px;
  102. background: #fff;
  103. padding: 5px;
  104. }
  105. .itembox {
  106. display: flex;
  107. margin-bottom: 7px;
  108. }
  109. .iteminput {
  110. width: 180px;
  111. }
  112. .title {
  113. width: 118px;
  114. }
  115. </style>
  116. </html>