toolbars.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  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. import html2canvas from "html2canvas";
  22. const getMapInstance = inject("getMapInstance");
  23. jt3d = getMapInstance();
  24. </script>
  25. <template>
  26. <div class="toolbars fadein-right">
  27. <!-- <div class="toolbar-item" @click="PolylineObject()">
  28. <i class="iconfont icon-winfo-icon-tucengkongzhi"></i>
  29. <span class="title">
  30. 测试动态线
  31. </span>
  32. </div>
  33. <div class="toolbar-item" @click="showWidget('rotateCamera')">
  34. <i class="iconfont icon-chaxunzuobiaozhi" />
  35. <span class="title">
  36. 绕点旋转
  37. </span>
  38. </div> -->
  39. <div class="toolbar-item" @click="showWidget('fullMap')">
  40. <i class="iconfont icon-chaxunzuobiaozhi" />
  41. <span class="title">
  42. 全图
  43. </span>
  44. </div>
  45. <div class="toolbar-item" @click="showWidget('basicLayer')">
  46. <i class="iconfont icon-dituzuobiao" />
  47. <span class="title">
  48. 底图
  49. </span>
  50. </div>
  51. <div class="toolbar-item" @click="showWidget('layers')">
  52. <i class="iconfont icon-winfo-icon-tucengkongzhi"></i>
  53. <span class="title">
  54. 图层
  55. </span>
  56. </div>
  57. <el-dropdown class="toolbar-item" :hide-on-click="false" @command="handleCommand">
  58. <span class="el-dropdown-link">
  59. <i class="iconfont icon-xitong1" />
  60. <span class="title">
  61. 工具
  62. </span>
  63. <el-icon class="el-icon--right">
  64. <ArrowDown />
  65. </el-icon>
  66. </span>
  67. <template #dropdown>
  68. <span slot="slot" class="text"></span>
  69. <el-dropdown-menu>
  70. <el-dropdown-item command="DialogEdit"><i class="iconfont minsize icon-dituhuizhi"></i>绘制功能</el-dropdown-item>
  71. <!-- <el-dropdown-item command="navigate"><i class="iconfont icon-zhijiantou"></i>地区导航</el-dropdown-item> -->
  72. <!-- <el-dropdown-item command="viewerlabel"><i class="iconfont minsize icon-fushi"></i>视角标签</el-dropdown-item> -->
  73. <el-dropdown-item v-if="store.userport=='PC'" command="printmap"><i class="iconfont maxsize icon-svgdayin"></i>打印地图</el-dropdown-item>
  74. <el-dropdown-item command="measure"><i class="iconfont minsize icon-icon_measureTool"></i>图上量算</el-dropdown-item>
  75. <el-dropdown-item command="query-graphics"><i class="iconfont icon-search"></i>图形查询</el-dropdown-item>
  76. <el-dropdown-item command="analysis-data"><i class="iconfont maxsize icon-svgjiexiwenjian"></i>文件解析</el-dropdown-item>
  77. <el-dropdown-item command="analysis-space"><i class="iconfont icon-duodiankeshiyu"></i>空间分析</el-dropdown-item>
  78. <el-dropdown-item command="analysis-terrain"><i class="iconfont icon-iconfonttubiao_dixing"></i>地形分析</el-dropdown-item>
  79. <el-dropdown-item command="special-effects"><i class="iconfont icon-yu"></i>特效效果</el-dropdown-item>
  80. <el-dropdown-item command="coordsTool"><i class="iconfont icon-zuobiao"></i>坐标定位</el-dropdown-item>
  81. <!-- <el-dropdown-item command="TrackRoam"><i class="iconfont maxsize icon-jurassic_jiankong"></i>路径漫游</el-dropdown-item> -->
  82. <!-- <el-dropdown-item command="ImageLayerSplit"><i class="iconfont maxsize icon-juanlian"></i>卷帘对比</el-dropdown-item> -->
  83. <el-dropdown-item command="ViewerSplitScreen"><i class="iconfont minsize icon-fenping"></i>分屏对比</el-dropdown-item>
  84. </el-dropdown-menu>
  85. </template>
  86. </el-dropdown>
  87. </div>
  88. </template>
  89. <script>
  90. let jt3d = undefined;
  91. let store = undefined
  92. export default {
  93. name: "toolbars",
  94. data() {
  95. return {}
  96. },
  97. /* 方法 */
  98. methods: {
  99. /**
  100. * 测试动态线
  101. */
  102. PolylineObject() {
  103. let lines = [
  104. [
  105. [107.3609526659472, 26.405330345862833],
  106. [107.40025603208434, 26.402244579822174]
  107. ],
  108. [
  109. [107.3609801462563, 26.40314629662853],
  110. [107.3999374877451, 26.400165614674155]
  111. ],
  112. [
  113. [107.36081944593964, 26.40080706752495],
  114. [107.40012685036773, 26.39813952738571],
  115. ],
  116. [
  117. [107.36067906760677, 26.398625963837965],
  118. [107.40034550598207, 26.39670894997551],
  119. ],
  120. ];
  121. //定位
  122. jt3d._viewer.scene.camera.setView({
  123. duration: 1,
  124. destination: {
  125. x: -1709251.0767395466,
  126. y: 5461386.32337908,
  127. z: 2820645.238657382
  128. },
  129. orientation: {
  130. heading: 0.13762265446730737,
  131. pitch: -1.460307026543739,
  132. roll: 0.003401834066556475
  133. }
  134. });
  135. lines.forEach((item, index) => {
  136. if (index === 0) {
  137. let a1 = jt3d.PolylineObject.PolylineLinkPulseMaterialProperty(item, {
  138. width: 11,
  139. color: 'RED',
  140. duration: 20000,
  141. imgUrl: "/jt3dSDK/imgs/polylinematerial/LinkPulse.png",
  142. isImageAlpha: false,
  143. });
  144. a1.then(function() {
  145. });
  146. }
  147. if (index === 1) {
  148. jt3d.PolylineObject.PolylineArrowMaterialProperty(item, {
  149. width: 10,
  150. color: "YELLOW",
  151. duration: 1000,
  152. count: 5,
  153. direction: "horizontal",
  154. order: "+",
  155. imgUrl: "/jt3dSDK/imgs/polylinematerial/arrowopacity.png",
  156. isImageAlpha: false,
  157. });
  158. }
  159. if (index === 2) {
  160. jt3d.PolylineObject.PolylineArrowMaterialProperty(item, {
  161. width: 10,
  162. color: 'BLUE',
  163. duration: 1000,
  164. count: 20,
  165. direction: "horizontal",
  166. order: "+",
  167. imgUrl: "/jt3dSDK/imgs/polylinematerial/arrowopacity.png",
  168. isImageAlpha: false,
  169. });
  170. }
  171. if (index === 3) {
  172. jt3d.PolylineObject.PolylineLinkPulseMaterialProperty(item, {
  173. width: 10,
  174. color: 'GREEN',
  175. duration: 10000,
  176. imgUrl: "/jt3dSDK/imgs/polylinematerial/20201124170520929.png",
  177. isImageAlpha: false,
  178. });
  179. }
  180. });
  181. },
  182. showWidget: function(type) {
  183. if (type === "layers") {
  184. this.closePopup()
  185. this.$parent.$refs.refLayer.isshow = true;
  186. } else if (type === "fullMap") {
  187. this.$parent.$refs.refMap3d.fullMap(jt3d);
  188. } else if (type === "rotateCamera") {
  189. ElMessage.warning('在地图上单击进行自旋,再次单击停止自旋')
  190. jt3d.SketchViewModel.sketchTools('point', {
  191. onComplete(cPoint, gPoint) {
  192. jt3d.setMapSpinByPoint(cPoint);
  193. },
  194. onError(message) {}
  195. });
  196. } else if (type == "viewerlabel") {
  197. this.closePopup()
  198. this.$parent.$refs.refviewerlabel.isshow = true
  199. } else {
  200. this.closePopup()
  201. this.$parent.showbasicLayer = true
  202. }
  203. },
  204. //关闭所有弹框
  205. closePopup() {
  206. this.$parent.$refs.refMeasure.isshow = false;
  207. this.$parent.$refs.refQueryGraphics.isshow = false;
  208. this.$parent.$refs.refAnalysisData.isshow = false;
  209. this.$parent.$refs.refAnalysisSpace.isshow = false;
  210. this.$parent.$refs.refAnalysisTerrain.isshow = false;
  211. this.$parent.$refs.refSpecialEffects.isshow = false;
  212. this.$parent.$refs.refCoordsTool.isshow = false;
  213. this.$parent.$refs.refTrackRoam.isshow = false;
  214. this.$parent.$refs.refViewerSplitScreen.isshow = false;
  215. this.$parent.$refs.refImageLayerSplit.isshow = false;
  216. this.$parent.$refs.refmapNavigate.isshow = false;
  217. this.$parent.$refs.refviewerlabel.isshow = false;
  218. this.$parent.$refs.refprintmap.isshow = false;
  219. this.$parent.$refs.refDialogEdit.isshow = false;
  220. this.$parent.showbasicLayer = false;
  221. this.$parent.$refs.refLayer.isshow = false;
  222. if (this.$parent.$refs._refImageLayerSplit) {
  223. this.$parent.$refs._refImageLayerSplit.removeSplitLayer(); //关闭卷帘
  224. }
  225. if (this.$parent.$refs._refViewerSplitScreen) {
  226. this.$parent.$refs._refViewerSplitScreen.removeSplitScreen(); //关闭分屏
  227. }
  228. },
  229. /**
  230. * dropdown下拉列表事件
  231. */
  232. handleCommand(command) {
  233. //图上绘制组件
  234. if (command === 'DialogEdit') {
  235. this.closePopup()
  236. this.$parent.$refs.refDialogEdit.isshow = true
  237. }
  238. //区域导航
  239. if (command === 'navigate') {
  240. this.closePopup()
  241. this.$parent.$refs.refmapNavigate.isshow = true
  242. }
  243. //视角标签
  244. if (command === 'viewerlabel') {
  245. this.closePopup()
  246. this.$parent.$refs.refviewerlabel.isshow = true
  247. }
  248. //打印地图
  249. if (command === 'printmap') {
  250. this.closePopup()
  251. // this.$bus.emit("screenshot")
  252. this.$parent.$refs._refprintmap.screenshot();
  253. setTimeout(() => {
  254. this.$parent.$refs.refprintmap.isshow = true
  255. }, 50);
  256. }
  257. //图上量算
  258. if (command === 'measure') {
  259. this.closePopup()
  260. this.$parent.$refs.refMeasure.isshow = true;
  261. }
  262. //图形查询
  263. if (command === 'query-graphics') {
  264. this.closePopup()
  265. this.$parent.$refs.refQueryGraphics.isshow = true;
  266. }
  267. //数据分析
  268. if (command === 'analysis-data') {
  269. this.closePopup()
  270. this.$parent.$refs.refAnalysisData.isshow = true;
  271. }
  272. //空间分析
  273. if (command === 'analysis-space') {
  274. this.closePopup()
  275. this.$parent.$refs.refAnalysisSpace.isshow = true;
  276. }
  277. //地形分析
  278. if (command === 'analysis-terrain') {
  279. this.closePopup()
  280. this.$parent.$refs.refAnalysisTerrain.isshow = true;
  281. }
  282. //特效效果
  283. if (command === 'special-effects') {
  284. this.closePopup()
  285. this.$parent.$refs.refSpecialEffects.isshow = true;
  286. }
  287. //坐标定位拾取
  288. if (command === 'coordsTool') {
  289. this.closePopup()
  290. this.$parent.$refs.refCoordsTool.isshow = true;
  291. }
  292. //飞行漫游
  293. if (command === 'TrackRoam') {
  294. this.closePopup()
  295. this.$parent.$refs.refTrackRoam.isshow = true;
  296. }
  297. //卷帘对比
  298. if (command === 'ImageLayerSplit') {
  299. this.closePopup();
  300. this.$parent.$refs.refImageLayerSplit.isshow = true;
  301. this.$parent.$refs._refImageLayerSplit.initSplitLayer(); //开启卷帘
  302. }
  303. //分屏对比
  304. if (command === 'ViewerSplitScreen') {
  305. this.closePopup();
  306. this.$parent.$refs.refViewerSplitScreen.isshow = true;
  307. this.$parent.$refs.refLayer.isshow = true;
  308. this.$parent.$refs._refViewerSplitScreen.initSplitScreen(); //开启分屏
  309. }
  310. },
  311. },
  312. mounted() {
  313. }
  314. };
  315. </script>
  316. <style lang="scss" scoped>
  317. .text::before {
  318. position: absolute;
  319. width: 0rem;
  320. height: 0rem;
  321. left: calc(50% - 5rem);
  322. top: -5rem;
  323. content: '';
  324. transform: rotate(45deg);
  325. z-index: 10;
  326. box-sizing: border-box;
  327. border-bottom: 5rem solid transparent;
  328. border-right: 5rem solid transparent;
  329. border-top: 5rem solid rgba(255, 255, 255, 1);
  330. border-left: 5rem solid rgba(255, 255, 255, 1);
  331. // background: rgba(5, 45, 115, .8) !important;
  332. }
  333. .toolbars {
  334. position: absolute;
  335. top: 80rem;
  336. width: 340rem;
  337. // width: 450rem;
  338. // width: 580rem;
  339. right: 20rem;
  340. cursor: pointer !important;
  341. padding: 0rem !important;
  342. margin: 0rem !important;
  343. background-image: none !important;
  344. border: 1rem solid;
  345. border: none;
  346. border-radius: 2rem !important;
  347. background-color: rgb(0 44 126 / 65%);
  348. height: 40rem;
  349. box-sizing: border-box;
  350. line-height: 38rem;
  351. text-align: left;
  352. user-select: none;
  353. cursor: default;
  354. .toolbar-item {
  355. display: inline-block;
  356. padding: 0rem 12rem;
  357. margin: 0rem;
  358. height: calc(100% - 4rem);
  359. color: #fff;
  360. font-size: 15rem;
  361. vertical-align: middle;
  362. &:hover {
  363. background-color: rgba(255, 255, 255, 0.3);
  364. }
  365. .title {
  366. font-size: 16rem;
  367. }
  368. }
  369. .toolbar-item:nth-last-child(1) {
  370. padding-right: 0rem;
  371. }
  372. .el-icon {
  373. margin-right: 5rem;
  374. color: #fff;
  375. }
  376. .el-dropdown {
  377. // vertical-align: middle;
  378. height: 40rem;
  379. line-height: 38rem;
  380. box-sizing: border-box;
  381. }
  382. }
  383. </style>