Circle.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. <script src="../../dist/index.js"></script>
  9. <link href="../../cesium/Source/Widgets/widgets.css" rel="stylesheet">
  10. <script src="../../cesium/Build/Cesium/Cesium.js"></script>
  11. </head>
  12. <body style="margin: 0; padding: 0;">
  13. <div id="map" style="height: 100vh; width: 100vw;"></div>
  14. <div class="input-card">
  15. <div class="input-item">
  16. <button class="btn" id="btn1" onclick="remove()">移除</button>
  17. </div>
  18. </div>
  19. </body>
  20. <script>
  21. const viewer = new Cesium.Viewer("map", {
  22. // homeButton: false, // 是否显示首页按钮
  23. // geocoder: false, // 是否显示输入地名查找控件
  24. sceneModePicker: false, // 是否显示投影方式控件(包含二维及三维投影)
  25. // baseLayerPicker: false, // 是否显示帮助控件
  26. creditDisplay: false,
  27. // timeline: true,
  28. // infoBox: false, // 是否显示点击要素之后显示的信息
  29. selectionIndicator: false,
  30. imageryProvider: false,
  31. fullscreenButton: false
  32. })
  33. var circle;
  34. function initData() {
  35. let options = {
  36. center:[116.43, 39.23],
  37. radius: 500,
  38. strokeColor: "red",
  39. strokeWeight: 2,
  40. strokeOpacity: 0.5,
  41. fillOpacity: 1,
  42. fillColor: 'green',
  43. zIndex: 50,
  44. bubble: true,
  45. zoomto: true, // 是否自动缩放到
  46. }
  47. circle = new CTMapOl.cesiumComponent.Circle(options);
  48. circle.addTo({ viewer })
  49. }
  50. initData();
  51. function remove() {
  52. circle.remove();
  53. }
  54. </script>
  55. <style>
  56. /*地图*/
  57. .mapDIV {
  58. height: 100vh;
  59. width: 100vw;
  60. z-index: 1;
  61. }
  62. .add-switch {
  63. position: absolute;
  64. right: 30px;
  65. height: 68px;
  66. width: 30px;
  67. bottom: 112px;
  68. background: #FFFFFF 100%;
  69. color: #172537;
  70. border-radius: 4px;
  71. display: flex;
  72. flex-direction: column;
  73. align-items: center;
  74. z-index: 2;
  75. }
  76. .add-s-block {
  77. height: 20px;
  78. display: flex;
  79. align-items: center;
  80. justify-content: center;
  81. width: 100%;
  82. line-height: 20px;
  83. font-size: 12px;
  84. margin-bottom: 2px;
  85. color: #172537;
  86. }
  87. .add-zoom {
  88. width: 20px;
  89. height: 20px;
  90. background-image: url('../../dist/assets/image/ar/switch/add-zoom.svg');
  91. background-size: 100% 100%;
  92. cursor: pointer;
  93. }
  94. .sub-zoom {
  95. width: 20px;
  96. height: 20px;
  97. background-image: url('../../dist/assets/image/ar/switch/sub-zoom.svg');
  98. background-size: 100% 100%;
  99. cursor: pointer;
  100. }
  101. .add-zoom-out {
  102. width: 20px;
  103. height: 20px;
  104. background-image: url('../../dist/assets/image/ar/switch/add-zoom-out.svg');
  105. background-size: 100% 100%;
  106. }
  107. .sub-zoom-out {
  108. width: 20px;
  109. height: 20px;
  110. background-image: url('../../dist/assets/image/ar/switch/sub-zoom-out.svg');
  111. background-size: 100% 100%;
  112. }
  113. .add-s-block.btn-click {
  114. cursor: pointer;
  115. }
  116. .input-card {
  117. position: absolute;
  118. right: 15px;
  119. bottom: 15px;
  120. z-index: 999;
  121. }
  122. </style>
  123. </html>