SPoint.html 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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="remove">移除点标记</button>
  17. </div>
  18. <div class="input-item">
  19. <button class="btn" id="setTop">置顶方块</button>
  20. </div>
  21. </div>
  22. </body>
  23. <script>
  24. // const viewer = new Cesium.Viewer("map", {
  25. // // homeButton: false, // 是否显示首页按钮
  26. // // geocoder: false, // 是否显示输入地名查找控件
  27. // sceneModePicker: false, // 是否显示投影方式控件(包含二维及三维投影)
  28. // baseLayerPicker: false, // 是否显示帮助控件
  29. // creditDisplay: false,
  30. // // timeline: true,
  31. // // infoBox: false, // 是否显示点击要素之后显示的信息
  32. // selectionIndicator: false,
  33. // imageryProvider: false,
  34. // fullscreenButton: false
  35. // })
  36. let map = new CTMapOl.cesiumComponent.ThrdimeInitMap({
  37. domId: 'map',
  38. center: [103.230695,35.624892],
  39. zoom: 14
  40. })
  41. let viewer = map._viewer;
  42. function initData() {
  43. let options = {
  44. lng: 103.230695,
  45. lat: 35.624892,
  46. id: "123",
  47. imgPath: '../assets/image/rect.jpg',
  48. iconSize: [50, 50],
  49. offset: [25, 25],
  50. clickBig: true,
  51. clickIcon: '../assets/image/rect2.jpg',
  52. zIndex: 1,
  53. sourceType: 'a',
  54. top: true,
  55. // zoomTo: false
  56. }
  57. let p = new CTMapOl.cesiumComponent.Point(viewer, options);
  58. document.getElementById('setTop').onclick = e => {
  59. p.top()
  60. // p.top({sourceType: 'b', zoomTo: false});
  61. }
  62. }
  63. initData();
  64. function initData2() {
  65. let options = {
  66. lng: 103.240695,
  67. lat: 35.624892,
  68. id: "123",
  69. imgPath: '../assets/image/circled.png',
  70. clickIcon: '../assets/image/cluster2.png',
  71. iconSize: [50, 50],
  72. offset: [25, 25],
  73. clickBig: false,
  74. zIndex: 3,
  75. sourceType: 'b'
  76. }
  77. let p = new CTMapOl.cesiumComponent.Point(viewer, options);
  78. }
  79. initData2();
  80. </script>
  81. <style>
  82. /*地图*/
  83. .mapDIV {
  84. height: 100vh;
  85. width: 100vw;
  86. z-index: 1;
  87. }
  88. .add-switch {
  89. position: absolute;
  90. right: 30px;
  91. height: 68px;
  92. width: 30px;
  93. bottom: 112px;
  94. background: #FFFFFF 100%;
  95. color: #172537;
  96. border-radius: 4px;
  97. display: flex;
  98. flex-direction: column;
  99. align-items: center;
  100. z-index: 2;
  101. }
  102. .add-s-block {
  103. height: 20px;
  104. display: flex;
  105. align-items: center;
  106. justify-content: center;
  107. width: 100%;
  108. line-height: 20px;
  109. font-size: 12px;
  110. margin-bottom: 2px;
  111. color: #172537;
  112. }
  113. .add-zoom {
  114. width: 20px;
  115. height: 20px;
  116. background-image: url('../../dist/assets/image/ar/switch/add-zoom.svg');
  117. background-size: 100% 100%;
  118. cursor: pointer;
  119. }
  120. .sub-zoom {
  121. width: 20px;
  122. height: 20px;
  123. background-image: url('../../dist/assets/image/ar/switch/sub-zoom.svg');
  124. background-size: 100% 100%;
  125. cursor: pointer;
  126. }
  127. .add-zoom-out {
  128. width: 20px;
  129. height: 20px;
  130. background-image: url('../../dist/assets/image/ar/switch/add-zoom-out.svg');
  131. background-size: 100% 100%;
  132. }
  133. .sub-zoom-out {
  134. width: 20px;
  135. height: 20px;
  136. background-image: url('../../dist/assets/image/ar/switch/sub-zoom-out.svg');
  137. background-size: 100% 100%;
  138. }
  139. .add-s-block.btn-click {
  140. cursor: pointer;
  141. }
  142. .input-card {
  143. position: absolute;
  144. right: 15px;
  145. bottom: 15px;
  146. z-index: 999;
  147. }
  148. </style>
  149. </html>