index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <div class="mapEditorOuter">
  3. <div :ref="refname" class="mapBox">
  4. </div>
  5. </div>
  6. </template>
  7. <script>
  8. // import * as maptalks from 'maptalks'
  9. // import axios from 'axios'
  10. import { MapEngine } from './mapEngine'
  11. const vGlobal = window.vueGlobal
  12. export default {
  13. name: 'mapTalksEditor',
  14. directives: {},
  15. components: { },
  16. filters: {},
  17. props: {
  18. refname: {
  19. type: String,
  20. default: 'mapCon'
  21. },
  22. rt: {
  23. type: Boolean,
  24. default: true
  25. },
  26. bearing: {
  27. type: Number,
  28. default: 0
  29. },
  30. centerX: {
  31. type: Number,
  32. default: 0
  33. },
  34. centerY: {
  35. type: Number,
  36. default: 0
  37. },
  38. editable: {
  39. type: Boolean,
  40. default: false
  41. },
  42. pitch: {
  43. type: Number,
  44. default: 0
  45. },
  46. resolutions: {
  47. type: Array,
  48. default: function() {
  49. return [64, 48, 32, 16, 12, 10, 8, 6, 5, 4, 3, 2, 1, 0.5, 0.25, 0.1]
  50. }
  51. },
  52. xmax: {
  53. type: Number,
  54. default: 1
  55. },
  56. xmin: {
  57. type: Number,
  58. default: 0
  59. },
  60. ymax: {
  61. type: Number,
  62. default: 1
  63. },
  64. ymin: {
  65. type: Number,
  66. default: 0
  67. },
  68. zoom: {
  69. type: Number,
  70. default: 5
  71. }
  72. },
  73. data() {
  74. return {
  75. isShowTool: false,
  76. isCreated: false,
  77. mapEngine: new MapEngine(),
  78. downloadLoading: false,
  79. drawSymbol: {
  80. 'lineWidth': 1,
  81. 'lineColor': 'rgba(0,0,0,1)',
  82. 'textSize': 10,
  83. 'textFill': 'rgba(0,0,0,1)',
  84. 'textHaloRadius': 1,
  85. 'textHaloFill': 'rgba(255,255,255,1)',
  86. 'fillColor': 'rgba(135,135,135,1)',
  87. 'altitude': 0,
  88. 'height': 0,
  89. 'boxWidth': 200,
  90. 'boxHeight': 30
  91. },
  92. drawMode: null,
  93. drawTool: null,
  94. drawEnable: false,
  95. fileList: [],
  96. imageLayer: null,
  97. isUpload: false,
  98. originView: null,
  99. raycaster: null,
  100. selectGeos: [],
  101. selectLayer: null,
  102. sortLayers: ['border', 'wall', 'thing', 'vec3d', 'sign', 'region', 'test'],
  103. threeLayer: null,
  104. vec3dHeight: 0
  105. }
  106. },
  107. computed: {},
  108. watch: {
  109. },
  110. created() {
  111. },
  112. mounted() {
  113. const cid = setInterval(() => {
  114. if (vGlobal.isInited()) {
  115. this.firstCreate()
  116. this.init()
  117. clearInterval(cid)
  118. vGlobal ? vGlobal.mapEngine = this.mapEngine : null
  119. }
  120. }, 100)
  121. },
  122. methods: {
  123. firstCreate() {
  124. this.mapEngine.editable = this.editable
  125. this.mapEngine.createAtlas(this.$refs[this.refname])
  126. this.mapEngine.createLaycons()
  127. vGlobal.mapEngine = this.mapEngine
  128. this.isCreated = true
  129. },
  130. init() {
  131. this.drawEnable = true
  132. },
  133. initPosition() {
  134. if (this.$refs.drawPanel) {
  135. this.$refs.drawPanel.initPosition()
  136. }
  137. if (this.$refs.symbolPanel) {
  138. this.$refs.symbolPanel.initPosition()
  139. }
  140. if (this.$refs.layerPanel) {
  141. this.$refs.layerPanel.initPosition()
  142. }
  143. if (this.$refs.objPanel) {
  144. this.$refs.objPanel.initPosition()
  145. }
  146. if (this.$refs.propPanel) {
  147. this.$refs.propPanel.initPosition()
  148. }
  149. if (this.$refs.scalePanel) {
  150. this.$refs.scalePanel.initPosition()
  151. }
  152. }
  153. }
  154. }
  155. </script>
  156. <style scoped>
  157. .mapEditorOuter{
  158. width: 100%;
  159. height: 100%;
  160. overflow-y: hidden;
  161. overflow-x: hidden;
  162. position: relative;
  163. }
  164. .toolButton{
  165. position: absolute;
  166. right: 4px;
  167. bottom: 0px;
  168. z-index: 10000;
  169. }
  170. .item-runPanel{
  171. position: absolute;
  172. right: 105px;
  173. bottom: 6px;
  174. }
  175. .mapBox{
  176. width: 100%;
  177. height: 100%;
  178. z-index: 10;
  179. /*border: 1px solid black;*/
  180. }
  181. </style>