toolbars - 副本 (2).vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <script setup>
  2. /**
  3. * element-plus组件
  4. */
  5. import {
  6. ElMessage
  7. } from 'element-plus';
  8. /**
  9. * element-plus字体
  10. */
  11. import {
  12. ArrowDown
  13. } from '@element-plus/icons-vue';
  14. import {
  15. Store
  16. } from '@/store/index';
  17. store = Store()
  18. import {
  19. inject
  20. } from "vue";
  21. const getMapInstance = inject("getMapInstance");
  22. jt3d = getMapInstance();
  23. </script>
  24. <template>
  25. <div class="jt-toolbars fadein-right">
  26. <template v-for="(item, i) in toolDatas" :key="i">
  27. <div v-if="item.widget && !item.children" class="toolbar-item" @click="showWidget(item.widget)">
  28. <i :class="item.icon" />
  29. <span class="title">{{ item.name }}</span>
  30. </div>
  31. <el-dropdown v-if="item.children && !item.widget" class="toolbar-item" :hide-on-click="false" @command="handleCommand">
  32. <span class="el-dropdown-link">
  33. <i :class="item.icon" />
  34. <span class="title">{{ item.name }}</span>
  35. <el-icon class="el-icon--right">
  36. <ArrowDown />
  37. </el-icon>
  38. </span>
  39. <template #dropdown>
  40. <span slot="slot" class="text"></span>
  41. <el-dropdown-menu>
  42. <el-dropdown-item v-for="child in item.children" :key="child.widget" :title="child.name" @click="showWidget(child.widget)">
  43. <i :class="child.icon" />
  44. <span>{{ child.name }}</span>
  45. </el-dropdown-item>
  46. </el-dropdown-menu>
  47. </template>
  48. </el-dropdown>
  49. </template>
  50. </div>
  51. </template>
  52. <script>
  53. let jt3d = undefined;
  54. let store = undefined
  55. export default {
  56. name: "jt-toolbars",
  57. data() {
  58. return {
  59. toolDatas: [
  60. // {
  61. // name: "绕点自旋",
  62. // icon: "iconfont icon-chaxunzuobiaozhi",
  63. // widget: "rotateCamera"
  64. // },
  65. // {
  66. // name: "全图",
  67. // icon: "iconfont icon-chaxunzuobiaozhi",
  68. // widget: "fullMap"
  69. // },
  70. {
  71. name: "底图",
  72. icon: "iconfont icon-dituzuobiao",
  73. widget: "basicLayer"
  74. },
  75. {
  76. name: "图层",
  77. icon: "iconfont icon-winfo-icon-tucengkongzhi",
  78. widget: "layers"
  79. },
  80. {
  81. name: "工具",
  82. icon: "iconfont icon-xitong1",
  83. children: [{
  84. name: "图上标绘",
  85. icon: "iconfont icon-dituhuizhi",
  86. widget: "DialogEdit"
  87. },
  88. {
  89. name: "地区导航",
  90. icon: "iconfont icon-zhijiantou",
  91. widget: "navigate"
  92. },
  93. {
  94. name: "视角标签",
  95. icon: "iconfont icon-fushi",
  96. widget: "viewerlabel"
  97. },
  98. ]
  99. },
  100. {
  101. name: "清除",
  102. icon: "iconfont icon-shanchu",
  103. widget: "clearAll"
  104. },
  105. ]
  106. }
  107. },
  108. /* 方法 */
  109. methods: {
  110. showWidget: function(type) {
  111. //全图
  112. if (type === "fullMap") {
  113. this.$parent.$refs.refMap3d.fullMap(jt3d);
  114. }
  115. //绕点自旋
  116. if (type === "rotateCamera") {
  117. ElMessage.warning('在地图上单击进行自旋,再次单击停止自旋')
  118. jt3d.SketchViewModel.sketchTools('point', {
  119. onComplete(cPoint, gPoint) {
  120. jt3d.setMapSpinByPoint(cPoint);
  121. },
  122. onError(message) {}
  123. });
  124. }
  125. //清除所有
  126. if (type == "clearAll") {
  127. jt3d.DrawToolsEdit.Clear();
  128. jt3d.DrawMilitaryPlot.clearAll();
  129. //清除测量
  130. jt3d.CommonTools.clear();
  131. this.$parent.$refs._refMeasure.currentIndex = -1;
  132. if (this.$parent.$refs._refMeasure.popup) {
  133. this.$parent.$refs._refMeasure.popup.close();
  134. }
  135. //移除光照分析
  136. if (!jt3d.statusBar.show) {
  137. jt3d.statusBar.show = true;
  138. }
  139. jt3d.SpatialAnalysis.SunshineShadow.remove();
  140. //移除剖面分析结果
  141. this.$parent.closeDrawerSectionAnalysis();
  142. //清除坐标定位
  143. this.$parent.$refs._refCoordsTool.empty();
  144. //清除空间分析
  145. this.$parent.$refs._refAnalysisSpace.init();
  146. //清除地形分析
  147. this.$parent.$refs._refAnalysisTerrain.init();
  148. //还原左键单击事件
  149. this.$parent.$refs.refMap3d.clickEntity(jt3d);
  150. /* 开启地形检测 必须开启 否则会导致获取地形高度时异常 导致鼠标移动时位置哆嗦 */
  151. jt3d._viewer.scene.globe.depthTestAgainstTerrain = true;
  152. }
  153. //图层控制
  154. if (type === "layers") {
  155. // this.closePopup()
  156. // this.$parent.$refs.refLayerPopup.isshow = true;
  157. this.$myPop('layer',{isShow:true})
  158. }
  159. //底图切换
  160. if (type === "basicLayer") {
  161. this.closePopup()
  162. this.$parent.showbasicLayer = true
  163. }
  164. //视角标签
  165. if (type == "viewerlabel") {
  166. this.closePopup()
  167. this.$parent.$refs.refviewerlabel.isshow = true
  168. }
  169. //图上绘制组件
  170. if (type === 'DialogEdit') {
  171. this.closePopup()
  172. this.$parent.$refs.refDialogEdit.isshow = true
  173. }
  174. //区域导航
  175. if (type === 'navigate') {
  176. this.closePopup()
  177. this.$parent.$refs.refmapNavigate.isshow = true
  178. }
  179. //视角标签
  180. if (type === 'viewerlabel') {
  181. this.closePopup()
  182. this.$parent.$refs.refviewerlabel.isshow = true
  183. }
  184. //打印地图
  185. if (type === 'printmap') {
  186. this.closePopup()
  187. // this.$bus.emit("screenshot")
  188. this.$parent.$refs._refprintmap.screenshot();
  189. setTimeout(() => {
  190. this.$parent.$refs.refprintmap.isshow = true
  191. }, 50);
  192. }
  193. //图上量算
  194. if (type === 'measure') {
  195. this.closePopup()
  196. this.$parent.$refs.refMeasure.isshow = true;
  197. }
  198. //图形查询
  199. if (type === 'query-graphics') {
  200. this.closePopup()
  201. this.$parent.$refs.refQueryGraphics.isshow = true;
  202. }
  203. //数据分析
  204. if (type === 'analysis-data') {
  205. this.closePopup()
  206. this.$parent.$refs.refAnalysisData.isshow = true;
  207. }
  208. //空间分析
  209. if (type === 'analysis-space') {
  210. this.closePopup()
  211. this.$parent.$refs.refAnalysisSpace.isshow = true;
  212. }
  213. //地形分析
  214. if (type === 'analysis-terrain') {
  215. this.closePopup()
  216. this.$parent.$refs.refAnalysisTerrain.isshow = true;
  217. }
  218. //特效效果
  219. if (type === 'special-effects') {
  220. this.closePopup()
  221. this.$parent.$refs.refSpecialEffects.isshow = true;
  222. }
  223. //坐标定位拾取
  224. if (type === 'coordsTool') {
  225. this.closePopup()
  226. this.$parent.$refs.refCoordsTool.isshow = true;
  227. }
  228. //飞行漫游
  229. if (type === 'TrackRoam') {
  230. this.closePopup()
  231. this.$parent.$refs.refTrackRoam.isshow = true;
  232. }
  233. //卷帘对比
  234. if (type === 'ImageLayerSplit') {
  235. this.closePopup();
  236. this.$parent.$refs.refImageLayerSplit.isshow = true;
  237. this.$parent.$refs._refImageLayerSplit.initSplitLayer(); //开启卷帘
  238. }
  239. //分屏对比
  240. if (type === 'ViewerSplitScreen') {
  241. this.closePopup();
  242. this.$parent.$refs.refViewerSplitScreen.isshow = true;
  243. this.$parent.$refs.refLayerPopup.isshow = true;
  244. this.$parent.$refs._refViewerSplitScreen.initSplitScreen(); //开启分屏
  245. }
  246. },
  247. //关闭所有弹框
  248. closePopup() {
  249. this.$parent.$refs.refMeasure.isshow = false;
  250. this.$parent.$refs.refQueryGraphics.isshow = false;
  251. this.$parent.$refs.refAnalysisData.isshow = false;
  252. this.$parent.$refs.refAnalysisSpace.isshow = false;
  253. this.$parent.$refs.refAnalysisTerrain.isshow = false;
  254. this.$parent.$refs.refSpecialEffects.isshow = false;
  255. this.$parent.$refs.refCoordsTool.isshow = false;
  256. this.$parent.$refs.refTrackRoam.isshow = false;
  257. this.$parent.$refs.refViewerSplitScreen.isshow = false;
  258. this.$parent.$refs.refImageLayerSplit.isshow = false;
  259. this.$parent.$refs.refmapNavigate.isshow = false;
  260. this.$parent.$refs.refviewerlabel.isshow = false;
  261. this.$parent.$refs.refprintmap.isshow = false;
  262. this.$parent.$refs.refDialogEdit.isshow = false;
  263. this.$parent.showbasicLayer = false;
  264. this.$parent.$refs.refLayerPopup.isshow = false;
  265. if (this.$parent.$refs._refImageLayerSplit) {
  266. this.$parent.$refs._refImageLayerSplit.removeSplitLayer(); //关闭卷帘
  267. }
  268. if (this.$parent.$refs._refViewerSplitScreen) {
  269. this.$parent.$refs._refViewerSplitScreen.removeSplitScreen(); //关闭分屏
  270. }
  271. },
  272. },
  273. mounted() {
  274. }
  275. };
  276. </script>
  277. <style lang="scss" scoped>
  278. .text::before {
  279. position: absolute;
  280. width: 0rem;
  281. height: 0rem;
  282. left: calc(50% - 5rem);
  283. top: -5rem;
  284. content: '';
  285. transform: rotate(45deg);
  286. z-index: 10;
  287. box-sizing: border-box;
  288. border-bottom: 5rem solid transparent;
  289. border-right: 5rem solid transparent;
  290. border-top: 5rem solid rgba(255, 255, 255, 1);
  291. border-left: 5rem solid rgba(255, 255, 255, 1);
  292. // background: rgba(5, 45, 115, .8) !important;
  293. }
  294. .jt-toolbars {
  295. position: absolute;
  296. top: 80rem;
  297. width: auto;
  298. right: 20rem;
  299. cursor: pointer !important;
  300. padding: 0rem 10rem !important;
  301. margin: 0rem !important;
  302. background-image: none !important;
  303. border: 1rem solid;
  304. border: none;
  305. border-radius: 2rem !important;
  306. background-color: rgb(0 44 126 / 65%);
  307. height: 40rem;
  308. box-sizing: border-box;
  309. line-height: 38rem;
  310. text-align: left;
  311. user-select: none;
  312. cursor: default;
  313. .toolbar-item {
  314. display: inline-block;
  315. padding: 0rem 10rem;
  316. margin: 0rem;
  317. height: calc(100% - 4rem);
  318. color: #fff;
  319. font-size: 15rem;
  320. vertical-align: middle;
  321. &:hover {
  322. background-color: rgba(255, 255, 255, 0.3);
  323. }
  324. .title {
  325. font-size: 16rem;
  326. }
  327. }
  328. .toolbar-item:nth-last-child(1) {
  329. padding-right: 0rem;
  330. }
  331. .el-icon {
  332. margin-right: 5rem;
  333. color: #fff;
  334. }
  335. .el-dropdown {
  336. // vertical-align: middle;
  337. height: 40rem;
  338. line-height: 38rem;
  339. box-sizing: border-box;
  340. }
  341. }
  342. </style>