toolbars.vue 11 KB

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