navigation.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <script setup>
  2. import jt3dNavigation from 'cesium-navigation-es6';
  3. import {
  4. inject
  5. } from "vue";
  6. const getMapInstance = inject("getMapInstance");
  7. jt3d = getMapInstance();
  8. </script>
  9. <template>
  10. </template>
  11. <script>
  12. let jt3d = undefined;
  13. export default {
  14. props: {
  15. },
  16. /**
  17. * 数据
  18. */
  19. data() {
  20. return {
  21. }
  22. },
  23. /**
  24. * 方法
  25. */
  26. methods: {
  27. /**
  28. * 比例尺、指南针
  29. */
  30. initNavigation(jt3d) {
  31. let options = {};
  32. // 用于在使用重置导航重置地图视图时设置默认视图控制。接受的值是Cesium.Cartographic 和 Cesium.Rectangle.
  33. options.defaultResetView = Cesium.Rectangle.fromDegrees(121.13766, 36.99670, 121.94984, 37.55286);
  34. // options.defaultResetView = Cesium.Cartographic.fromDegrees(103.84,31.15,24000);
  35. // options.defaultResetView = Cesium.Cartographic.fromDegrees(Cesium.Math.toRadians(103.84),Cesium.Math.toRadians(31.15),Cesium.Math.toRadians(24000));
  36. options.orientation = {
  37. heading: Cesium.Math.toRadians(0),
  38. pitch: Cesium.Math.toRadians(-90),
  39. roll: 0
  40. };
  41. //相机延时
  42. options.duration = 4; //默认为3s
  43. // 用于启用或禁用罗盘。
  44. options.enableCompass = true;
  45. // 用于启用或禁用指南针外环。
  46. options.enableCompassOuterRing = true;
  47. // 用于启用或禁用缩放控件。
  48. options.enableZoomControls = true;
  49. // 用于启用或禁用距离图例。
  50. options.enableDistanceLegend = false;
  51. //修改重置视图的tooltip
  52. options.resetTooltip = "重置视图";
  53. //修改放大按钮的tooltip
  54. options.zoomInTooltip = "放大";
  55. //修改缩小按钮的tooltip
  56. options.zoomOutTooltip = "缩小";
  57. //如需自定义罗盘控件,请看下面的自定义罗盘控件
  58. new jt3dNavigation(jt3d._viewer, options);
  59. },
  60. },
  61. mounted() {
  62. //比例尺、指南针
  63. this.initNavigation(jt3d);
  64. }
  65. };
  66. </script>
  67. <style lang="scss" scoped>
  68. $jt3d-text-color:#fff;
  69. $jt3d-content-color:#fff;
  70. $jt3d-select-bg:red;
  71. .query-keyword {
  72. position: absolute;
  73. top: 80rem;
  74. width: 200rem;
  75. left: 10rem;
  76. border: 1rem solid rgb(0 44 126 / 100%);
  77. .el-input {
  78. --el-input-bg-color: rgb(0 44 126 / 50%);
  79. --el-input-border-color: rgb(0 44 126 / 50%);
  80. --el-input-placeholder-color: #fff;
  81. --el-fill-color-blank: rgb(0 44 126 / 80%);
  82. --el-text-color-regular: #fff;
  83. --el-color-primary: #fff --el-border-radius-base:0rem;
  84. --el-border-radius-base: 0rem;
  85. .el-button {
  86. background-color: rgb(0 44 126 / 100%);
  87. color: #fff;
  88. }
  89. }
  90. .autocomplete {
  91. --el-fill-color-blank: rgb(0 44 126 / 0%);
  92. }
  93. }
  94. .autocomplete ul {
  95. font-family: sans-serif;
  96. position: absolute;
  97. list-style: none;
  98. background: rgb(0 44 126 / 30%);
  99. margin: 0;
  100. width: 80%;
  101. margin-top: 1rem;
  102. margin-left: -1rem;
  103. border: 1rem solid rgb(0 44 126 / 100%);
  104. }
  105. .autocomplete ul li {
  106. text-decoration: none;
  107. display: block;
  108. background: rgb(0 44 126 / 30%);
  109. color: #fff;
  110. padding: 5rem;
  111. margin-left: -40rem;
  112. text-align: left;
  113. }
  114. .autocomplete ul li:hover,
  115. .autocomplete ul li.focus-list {
  116. color: white;
  117. background: #2F9AF7;
  118. }
  119. .query-result {
  120. position: absolute;
  121. border-top: none;
  122. padding-bottom: 0rem;
  123. width: 100%;
  124. z-index: 100;
  125. border: 1rem solid rgb(0 44 126 / 100%);
  126. background: rgb(0 44 126 / 30%);
  127. margin-left: -1rem;
  128. --el-fill-color-blank: rgb(0 44 126 / 0%);
  129. --color: #fff;
  130. --el-color-primary: #fff;
  131. .query-result__item {
  132. height: 80rem;
  133. padding: 0 10rem;
  134. display: flex;
  135. justify-content: flex-start;
  136. align-items: center;
  137. margin-left: -40rem;
  138. text-align: left;
  139. &:hover {
  140. // background-color: var(--mars-select-bg);
  141. }
  142. .query-result__context {
  143. flex-grow: 1;
  144. width: 90%;
  145. .query-result-text {
  146. font-size: 16rem;
  147. width: 200rem;
  148. font-family: Source Han Sans CN;
  149. font-weight: 400;
  150. // color: var($jt3d-text-color);
  151. color: $jt3d-text-color;
  152. .query-result-text_num {
  153. width: 20rem;
  154. height: 20rem;
  155. margin-right: 5rem;
  156. display: inline-block;
  157. text-align: center;
  158. background: rgb(0 44 126 / 100%);
  159. }
  160. }
  161. .query-result-sub {
  162. font-size: 14rem;
  163. width: 200rem;
  164. margin-left: 19rem;
  165. font-family: Source Han Sans CN;
  166. font-weight: 400;
  167. // color: var($jt3d-content-color);
  168. color: $jt3d-content-color;
  169. }
  170. }
  171. .query-result__more {
  172. font-size: 14rem;
  173. font-family: Source Han Sans CN;
  174. font-weight: 400;
  175. // color: var($jt3d-content-color);
  176. color: $jt3d-content-color;
  177. }
  178. }
  179. .query-result__page {
  180. display: flex;
  181. justify-content: space-between;
  182. padding: 5rem;
  183. .query-result-allcount {
  184. font-size: 14rem;
  185. // color: var($jt3d-text-color);
  186. color: $jt3d-text-color;
  187. }
  188. }
  189. }
  190. /* 四个边角样式 */
  191. // .borderstyle {
  192. // position: relative;
  193. // width: 100%;
  194. // height: 490rem;
  195. // padding: 10rem;
  196. // border: 1rem solid #008aff70 !important;
  197. // background-color: rgba(5, 45, 115, 0.7) !important;
  198. // box-shadow: 0 4rem 15rem 1rem #02213bb3;
  199. .angle-border {
  200. position: absolute;
  201. width: 12rem;
  202. height: 12rem;
  203. }
  204. .angle-border-blue {
  205. position: absolute;
  206. width: 70rem;
  207. height: 30rem;
  208. }
  209. .left-top-border {
  210. top: -2rem;
  211. left: -2rem;
  212. border-left: 2rem solid #008affdd;
  213. border-top: 2rem solid #008affdd;
  214. }
  215. .right-top-border {
  216. top: -2rem;
  217. right: -2rem;
  218. border-right: 2rem solid #008affdd;
  219. border-top: 2rem solid #008affdd;
  220. }
  221. .left-bottom-border {
  222. bottom: -2rem;
  223. left: -2rem;
  224. border-bottom: 2rem solid #FFFFFF;
  225. border-left: 2rem solid #FFFFFF;
  226. }
  227. .right-bottom-border {
  228. bottom: -2rem;
  229. right: -2rem;
  230. border-right: 2rem solid #FFFFFF;
  231. border-bottom: 2rem solid #FFFFFF;
  232. }
  233. // }
  234. </style>