drawEdit.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. <script setup>
  2. /**
  3. * element-plus组件
  4. */
  5. import {
  6. ElMessage
  7. } from 'element-plus';
  8. import {
  9. inject
  10. } from "vue";
  11. import {
  12. ArrowLeft,
  13. ArrowRight,
  14. Delete,
  15. Edit,
  16. Share
  17. } from '@element-plus/icons-vue';
  18. const getMapInstance = inject("getMapInstance");
  19. jt3d = getMapInstance();
  20. </script>
  21. <template>
  22. <div class="jt-drawTool">
  23. <div style="margin-bottom: 0rem;">
  24. <el-select class="selectInfo" v-model="value" @change="handleClick" placeholder="请选择" style="width: 65%; margin-bottom: 10rem;margin-right: 10rem;">
  25. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
  26. </el-select>
  27. <el-button type="danger" :icon="Delete" style="margin-top: 8rem;width: 30%;" @click="removeAll()">清除</el-button>
  28. </div>
  29. <div v-show="value=='二维平面类'">
  30. <el-row :gutter="20" style="margin-left: 0rem; margin-right: 0rem">
  31. <el-col v-for="(item,index) in towDimension" :span="8" @click="createGraphics(item.drawType,index)">
  32. <el-avatar shape="circle" :size="70" :class="currentIndex===index?'selectStyle':'defaultStyle'">
  33. <i :class="[item.icon,currentIndex===index?'selectFontStyle':'']" />
  34. </el-avatar>
  35. <div style="margin-top: 5rem; font-size: 14rem;" :class="currentIndex===index?'selectFontStyle':''">{{item.label}}</div>
  36. </el-col>
  37. </el-row>
  38. </div>
  39. <div v-show="value=='三维立体类'">
  40. <el-row :gutter="20" style="margin-left: 0rem; margin-right: 0rem">
  41. <el-col v-for="(item,index) in threeDimension" :span="8" @click="createGraphics(item.drawType,index)">
  42. <el-avatar shape="circle" :size="70" :class="currentIndex===index?'selectStyle':'defaultStyle'">
  43. <i :class="[item.icon,currentIndex===index?'selectFontStyle':'']" />
  44. </el-avatar>
  45. <div style="margin-top: 5rem; font-size: 14rem;" :class="currentIndex===index?'selectFontStyle':''">{{item.label}}</div>
  46. </el-col>
  47. </el-row>
  48. </div>
  49. <div v-show="value=='军事标绘类'">
  50. <el-row :gutter="20" style="margin-left: 0rem; margin-right: 0rem">
  51. <el-col v-for="(item,index) in militaryPlotting" :span="8" @click="createMilitaryPlot(item.drawType,index)">
  52. <el-avatar shape="circle" :size="70" :class="currentIndex===index?'selectStyle':'defaultStyle'">
  53. <i :class="[item.icon,currentIndex===index?'selectFontStyle':'']" />
  54. </el-avatar>
  55. <div style="margin-top: 5rem; font-size: 14rem;" :class="currentIndex===index?'selectFontStyle':''">{{item.label}}</div>
  56. </el-col>
  57. </el-row>
  58. </div>
  59. </div>
  60. </template>
  61. <script>
  62. let jt3d = undefined;
  63. let tipEntity = undefined;
  64. export default {
  65. props: {},
  66. watch: {},
  67. /* 数据 */
  68. data() {
  69. return {
  70. currentIndex: -1,
  71. value: "二维平面类",
  72. options: [{
  73. value: '二维平面类',
  74. label: '二维平面类',
  75. },
  76. {
  77. value: '三维立体类',
  78. label: '三维立体类',
  79. },
  80. {
  81. value: '军事标绘类',
  82. label: '军事标绘类',
  83. },
  84. ],
  85. towDimension: [{
  86. label: '贴地线',
  87. drawType: 'polyline',
  88. number: 0,
  89. icon: 'iconfont icon-svgtiedixian'
  90. },
  91. {
  92. label: '箭头线',
  93. drawType: 'arrowPolyline',
  94. number: 1,
  95. icon: 'iconfont icon-svgjiantouxian'
  96. },
  97. {
  98. label: '贴地面',
  99. drawType: 'polygon', //polygon
  100. number: 2,
  101. icon: 'iconfont icon-svgtiedimian'
  102. },
  103. {
  104. label: '动态线',
  105. drawType: 'dynamicPolyline',
  106. number: 3,
  107. icon: 'iconfont icon-svgliudongxian'
  108. },
  109. {
  110. label: '发光线',
  111. drawType: '发光线',
  112. number: 4,
  113. icon: 'iconfont icon-svgfaguangxian'
  114. },
  115. {
  116. label: '描边线',
  117. drawType: 'outlinePolyline',
  118. number: 5,
  119. icon: 'iconfont icon-svgmiaobianxian'
  120. },
  121. {
  122. label: '动态圆',
  123. drawType: 'dynamicCircle',
  124. number: 6,
  125. icon: 'iconfont icon-svgdongtaiyuan'
  126. },
  127. {
  128. label: '普通圆',
  129. drawType: 'circle',
  130. number: 7,
  131. icon: 'iconfont icon-svgputongyuan'
  132. },
  133. {
  134. label: '矩形',
  135. drawType: 'rectangle',
  136. number: 8,
  137. icon: 'iconfont icon-svgjuxing'
  138. },
  139. ],
  140. threeDimension: [{
  141. label: '空间线',
  142. drawType: 'spatialLine',
  143. number: 0,
  144. icon: 'iconfont icon-svgkongjianxian'
  145. },
  146. {
  147. label: '动态墙',
  148. drawType: 'dynamicWall',
  149. number: 1,
  150. icon: 'iconfont icon-svgdongtaiqiang'
  151. },
  152. {
  153. label: '房屋',
  154. drawType: 'house',
  155. number: 2,
  156. icon: 'iconfont icon-svgfangwu'
  157. },
  158. {
  159. label: '文字',
  160. drawType: 'text',
  161. number: 3,
  162. icon: 'iconfont icon-svgzi'
  163. },
  164. {
  165. label: '视频墙',
  166. drawType: 'videoWall',
  167. number: 4,
  168. icon: 'iconfont icon-svgshipinqiang'
  169. },
  170. {
  171. label: '普通墙',
  172. drawType: 'normalWall',
  173. number: 5,
  174. icon: 'iconfont icon-svgputongqiang'
  175. },
  176. ],
  177. militaryPlotting: [{
  178. label: '直线箭头',
  179. drawType: 'straightArrow',
  180. number: 1,
  181. icon: 'iconfont icon-zhijiantou'
  182. },
  183. {
  184. label: '攻击箭头',
  185. drawType: 'attackArrow',
  186. number: 2,
  187. icon: 'iconfont icon-tujifangxiang'
  188. },
  189. {
  190. label: '钳击箭头',
  191. drawType: 'pincerArrow',
  192. number: 3,
  193. icon: 'iconfont icon-qianji'
  194. }
  195. ]
  196. }
  197. },
  198. /* 方法 */
  199. methods: {
  200. //清除全部
  201. removeAll() {
  202. jt3d.DrawToolsEdit.Clear()
  203. jt3d.DrawMilitaryPlot.clearAll()
  204. this.currentIndex = -1;
  205. //还原左键单击事件
  206. this.$parent.$parent.$refs.refMap3d.clickEntity(jt3d);
  207. },
  208. //选择绘制类型
  209. //头部标题点击事件
  210. handleClick(val) {
  211. console.log(val)
  212. this.currentIndex = -1;
  213. this.value = val
  214. },
  215. //创建军事标会
  216. createMilitaryPlot(type, index) {
  217. let _self = this;
  218. this.currentIndex = index;
  219. //移除左键单击事件
  220. if (jt3d.handlerLeftClick) {
  221. jt3d.handlerLeftClick.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK);
  222. }
  223. /* 创建监听 */
  224. jt3d.DrawMilitaryPlot.onEditProperty = {};
  225. // 开始绘制
  226. jt3d.DrawMilitaryPlot.draw(type, {
  227. onComplete(cPoint, gPoint) {
  228. // _self.$parent.$parent.param = param;
  229. // _self.$parent.$parent.showDialog = true;
  230. }
  231. });
  232. },
  233. //创建二维标会和三维标会
  234. createGraphics(type, index) {
  235. let _self = this;
  236. this.currentIndex = index;
  237. //移除左键单击事件
  238. if (jt3d.handlerLeftClick) {
  239. jt3d.handlerLeftClick.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK);
  240. }
  241. /* 创建监听 */
  242. jt3d.DrawToolsEdit.onEditProperty = {};
  243. // 开始绘制
  244. jt3d.DrawToolsEdit.draw(type, {
  245. isEdit: true,
  246. onComplete(cPoint, gPoint) {
  247. },
  248. onError(message) {
  249. console.log('错误原因', message)
  250. }
  251. });
  252. }
  253. },
  254. mounted() {
  255. }
  256. };
  257. </script>
  258. <style lang="scss" scoped>
  259. .el-avatar{
  260. width: 70rem !important;
  261. height: 70rem !important;
  262. font-size: 14px !important;
  263. cursor: pointer;
  264. }
  265. // .el-popper{
  266. // padding: 5rem 11rem;
  267. // font-size: 12rem;
  268. // line-height: 20rem;
  269. // min-height: 10rem;
  270. // width: 322rem;
  271. // height: 311rem;
  272. // left: 15rem !important;
  273. // top: 175rem !important;
  274. // }
  275. ::v-deep .el-scrollbar{
  276. background-color: gainsboro !important;
  277. }
  278. .el-select-dropdown__item{
  279. color: #409eff !important;
  280. padding: 0 32rem 0 20rem;
  281. height: 34rem;
  282. line-height: 34rem;
  283. font-size:14rem;
  284. }
  285. .jt-drawTool {
  286. --el-avatar-size: 70rem !important;
  287. .el-col {
  288. padding: 10rem;
  289. // color: rgba(90, 172, 255, 1.0);
  290. color: #fff;
  291. }
  292. i {
  293. display: inline-block;
  294. width: 100%;
  295. height: 36rem;
  296. line-height: 36rem;
  297. text-align: center;
  298. border-radius: 5rem;
  299. font-size: 40rem;
  300. // color: rgba(90, 172, 255, 1.0);
  301. color: #fff;
  302. transition: all .3s;
  303. -webkit-transition: all .3s
  304. }
  305. .selectStyle {
  306. // background: rgba(135, 182, 254, 0.5);
  307. background: rgb(0 44 126);
  308. --el-avatar-size: 70rem !important;
  309. }
  310. .defaultStyle {
  311. background: #ffffff00;
  312. --el-avatar-size: 70rem !important;
  313. }
  314. .selectFontStyle {
  315. color: #fff;
  316. }
  317. .el-button.is-text {
  318. background-color: rgba(255, 255, 255, 0.5);
  319. }
  320. el-option {
  321. margin-top: -15rem !important;
  322. }
  323. .iconactive {
  324. box-shadow: 0 0 3rem 3rem rgba(12, 123, 200, .6);
  325. }
  326. .active {
  327. color: #409eff
  328. }
  329. ::v-deep .el-input__wrapper {
  330. background-color: rgba(255, 255, 255, 0);
  331. color: #fff;
  332. }
  333. ::v-deep .el-input__inner {
  334. color: #fff;
  335. }
  336. .selectInfo {
  337. top: 10rem !important;
  338. }
  339. .el-select-dropdown__wrap {
  340. margin-top: 10rem;
  341. }
  342. .el-select-dropdown__item {
  343. background-color: rgba(255, 255, 255, 1) !important;
  344. }
  345. .el-select-dropdown__item:hover {
  346. background-color: rgba(255, 255, 235, 1) !important;
  347. }
  348. }
  349. </style>