@mapgis/webclient-vue-cesium 10.5.5-1 → 10.5.5-6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/README.md +46 -49
  2. package/dist-libs/webclient-vue-cesium.common.js +191087 -0
  3. package/dist-libs/webclient-vue-cesium.css +1 -1
  4. package/dist-libs/webclient-vue-cesium.umd.js +191097 -0
  5. package/dist-libs/webclient-vue-cesium.umd.min.js +204 -194
  6. package/docs/.vuepress/config.js +47 -46
  7. package/docs/README.md +5 -4
  8. package/docs/api/analysis/Aspect.md +236 -0
  9. package/docs/api/analysis/Contour.md +240 -0
  10. package/docs/api/analysis/CutFill.md +306 -0
  11. package/docs/api/analysis/DynamicSection.md +336 -0
  12. package/docs/api/analysis/Excavate.md +3 -11
  13. package/docs/api/analysis/Flood.md +177 -200
  14. package/docs/api/analysis/HeightLimited.md +7 -4
  15. package/docs/api/analysis/ParticleEffects.md +549 -0
  16. package/docs/api/analysis/Profile.md +464 -0
  17. package/docs/api/analysis/Shadow.md +76 -13
  18. package/docs/api/analysis/Sightline.md +66 -13
  19. package/docs/api/analysis/Skyline.md +144 -29
  20. package/docs/api/analysis/Slope.md +236 -0
  21. package/docs/api/analysis/Viewshed.md +100 -21
  22. package/docs/api/layer/IGServer/IgsDocLayer.md +10 -0
  23. package/docs/api/layer/IGServer/IgsFeatureLayer.md +253 -0
  24. package/docs/api/layer/IGServer/IgsTileLayer.md +11 -0
  25. package/docs/api/layer/OGC/CesiumOgcWmsLayer.md +20 -19
  26. package/docs/api/layer/OGC/Wms.png +0 -0
  27. package/docs/api/layer/marker/DynamicMarker.md +81 -0
  28. package/docs/api/layer/marker/dynamicmarker.png +0 -0
  29. package/docs/api/layer/marker/selects.png +0 -0
  30. package/docs/api/layer/vectortile/vectortile.md +10 -0
  31. package/docs/api/m3d/image/layer_control_1.png +0 -0
  32. package/docs/api/m3d/image/layer_control_2.png +0 -0
  33. package/docs/api/m3d/image/layer_control_3.png +0 -0
  34. package/docs/api/m3d/m3d.md +13 -2
  35. package/docs/api/service/comprehensiveQuery/comprehensiveQuery.md +946 -0
  36. package/docs/api/ui/draw.md +68 -40
  37. package/docs/api/ui/link.md +8 -1
  38. package/docs/api/ui/marker.md +19 -1
  39. package/docs/api/ui/measure.md +82 -10
  40. package/docs/api/ui/table.md +6 -6
  41. package/docs/guide/README.md +26 -23
  42. package/docs/guide/basemap.md +35 -33
  43. package/docs/guide/markers&popups.md +46 -53
  44. package/docs/plugin_components/create_storybook.md +241 -0
  45. package/docs/plugin_components/img.png +0 -0
  46. package/docs/plugin_components/img_1.png +0 -0
  47. package/docs/plugin_components/img_10.png +0 -0
  48. package/docs/plugin_components/img_2.png +0 -0
  49. package/docs/plugin_components/img_3.png +0 -0
  50. package/docs/plugin_components/img_4.png +0 -0
  51. package/docs/plugin_components/img_5.png +0 -0
  52. package/docs/plugin_components/img_6.png +0 -0
  53. package/docs/plugin_components/img_7.png +0 -0
  54. package/docs/plugin_components/img_8.png +0 -0
  55. package/docs/version/diff.md +4 -4
  56. package/docs/version/version.md +81 -0
  57. package/package.json +5 -5
  58. package/src/cdn/cdn_component.js +62 -0
  59. package/src/component.js +20 -2
  60. package/src/components/Analysis/Aspect.vue +318 -0
  61. package/src/components/Analysis/Contour.vue +257 -0
  62. package/src/components/Analysis/CutFill.vue +581 -0
  63. package/src/components/Analysis/DynamicCutting.vue +98 -59
  64. package/src/components/Analysis/DynamicSection.vue +494 -0
  65. package/src/components/Analysis/Excavate.vue +133 -87
  66. package/src/components/Analysis/Flood.vue +395 -487
  67. package/src/components/Analysis/Flood.vue-- +630 -0
  68. package/src/components/Analysis/HeightLimited.vue +66 -47
  69. package/src/components/Analysis/ModelFlatten.vue +2 -2
  70. package/src/components/Analysis/Profile.vue +503 -0
  71. package/src/components/Analysis/Shadow.vue +220 -309
  72. package/src/components/Analysis/Sightline.vue +393 -375
  73. package/src/components/Analysis/SkyLine.vue +283 -93
  74. package/src/components/Analysis/Slope.vue +317 -0
  75. package/src/components/Analysis/Viewshed.vue +806 -373
  76. package/src/components/Analysis/skyline2dChartOptions.js +66 -0
  77. package/src/components/DataSource/Geojson/GeoJsonDataSource.vue +201 -3
  78. package/src/components/Layer/GeoJSON/GeoJsonLayer.vue +345 -0
  79. package/src/components/Layer/IGServer/IgsFeatureLayer.vue +227 -0
  80. package/src/components/Layer/Marker/DynamicMarkerLayer.vue +487 -0
  81. package/src/components/Layer/Marker/Marker3dPro.vue +196 -0
  82. package/src/components/Layer/Marker/Marker3dSetPro.vue +67 -0
  83. package/src/components/Layer/VectorTile/VectorTileLayer.vue +117 -33
  84. package/src/components/Layer/VectorTile/VectorTileOptions.js +1 -1
  85. package/src/components/M3D/3DTilesetOptions.js +23 -1
  86. package/src/components/M3D/G3D.vue +150 -0
  87. package/src/components/M3D/M3d.vue +142 -32
  88. package/src/components/M3D/M3dSet.vue +118 -0
  89. package/src/components/M3D/M3dType.js +24 -0
  90. package/src/components/Overlay/Mapv3dLayer.vue +2 -0
  91. package/src/components/Overlay/ParticleEffects.vue +545 -0
  92. package/src/components/Overlay/mapv/MapvBaseLayer.js +351 -172
  93. package/src/components/Overlay/mapv/MapvLayer.js +372 -324
  94. package/src/components/Overlay/mapv/SuperCluster.js +611 -0
  95. package/src/components/Overlay/themeLayer/heater/CesiumHeater.vue +152 -0
  96. package/src/components/Overlay/themeLayer/heater/MapvHeater.vue +161 -0
  97. package/src/components/UI/Controls/Draw/Draw.vue +320 -92
  98. package/src/components/UI/Controls/Legend/Legend.vue +55 -51
  99. package/src/components/UI/Controls/Link/Link.vue +59 -37
  100. package/src/components/UI/Controls/Measure/Measure.vue +75 -33
  101. package/src/components/UI/Controls/Measure/components/MeasureResult.vue +71 -0
  102. package/src/components/UI/Controls/Measure/components/MeasureSetting.vue +63 -0
  103. package/src/components/UI/Controls/Measure/components/MeasureTool.vue +155 -0
  104. package/src/components/UI/Geojson/Popup.vue +101 -0
  105. package/src/components/UI/Marker/Marker.vue +185 -48
  106. package/src/components/UI/Popup/Popup.vue +21 -64
  107. package/src/components/Utils/common/color-util.js +159 -0
  108. package/src/components/Utils/util.js +311 -231
  109. package/src/components/WebGlobe/manager.js +81 -3
  110. package/src/components/WebGlobe/mixins/withPrivateMethods.js +4 -2
  111. package/src/components/WebGlobe/util.js +173 -0
  112. package/src/components/service/comprehensive-query/ComprehensiveQuery.vue +156 -0
  113. package/src/components/service/comprehensive-query/PlaceNameCesium.vue +102 -0
  114. package/src/components/service/comprehensive-query/util/catalog/document.js +626 -0
  115. package/src/components/service/comprehensive-query/util/feature/arcgis-feature-query.js +448 -0
  116. package/src/components/service/comprehensive-query/util/feature/feature-convert.js +408 -0
  117. package/src/components/service/comprehensive-query/util/feature/feature-edit.js +50 -0
  118. package/src/components/service/comprehensive-query/util/feature/feature-geojson.js +100 -0
  119. package/src/components/service/comprehensive-query/util/feature/feature-query.js +723 -0
  120. package/src/components/service/comprehensive-query/util/feature/feature.js +1 -0
  121. package/src/components/service/comprehensive-query/util/feature/index.js +9 -0
  122. package/src/components/service/comprehensive-query/util/objects/geometry.js +58 -0
  123. package/src/components/Overlay/Mapv.vue +0 -142
  124. package/src/components/Overlay/MapvHeater.vue +0 -98
@@ -1,9 +1,37 @@
1
1
  <template>
2
2
  <div>
3
3
  <!-- slot for toolbar -->
4
- <slot name="toolbar" />
4
+ <slot name="toolbar"/>
5
5
  <!-- slot for toolbar-item -->
6
- <slot v-if="initial" />
6
+ <slot v-if="initial"/>
7
+ <mapgis-ui-card :customPosition="position" class="mapgis-3d-draw-control">
8
+ <div v-show="enableControl">
9
+ <mapgis-ui-space>
10
+ <mapgis-ui-tooltip
11
+ v-for="(item, i) in draws"
12
+ :key="i"
13
+ placement="bottom"
14
+ >
15
+ <template slot="title">
16
+ <span>{{ item.tip }}</span>
17
+ </template>
18
+ <mapgis-ui-button
19
+ shape="circle"
20
+ :type="item.type"
21
+ @click="item.click"
22
+ :class="item.className"
23
+ >
24
+ <mapgis-ui-iconfont
25
+ :type="item.icon"
26
+ :class="item.className"
27
+ theme="filled"
28
+ />
29
+ </mapgis-ui-button>
30
+ </mapgis-ui-tooltip>
31
+
32
+ </mapgis-ui-space>
33
+ </div>
34
+ </mapgis-ui-card>
7
35
  </div>
8
36
  </template>
9
37
 
@@ -25,56 +53,142 @@ export default {
25
53
  type: Boolean,
26
54
  default: false
27
55
  },
28
- vueKey:{
56
+ enableControl: {
57
+ type: Boolean,
58
+ default: false
59
+ },
60
+ position: {
61
+ type: String,
62
+ default: "top-right"
63
+ },
64
+ clampToGround: {
65
+ type: Boolean,
66
+ default: true
67
+ },
68
+ drawStyle: {
69
+ type: Object,
70
+ default: () => {
71
+ return {}
72
+ }
73
+ },
74
+ vueKey: {
29
75
  type: String,
30
76
  default: ""
31
77
  },
32
- vueIndex:{
78
+ vueIndex: {
33
79
  type: Number,
34
80
  default() {
35
81
  return Number((Math.random() * 100000000).toFixed(0));
36
82
  }
37
83
  }
38
84
  },
39
-
40
- data () {
85
+ data() {
41
86
  return {
87
+ drawStyleCopy: {
88
+ color: '#FF0000',
89
+ opacity: 1,
90
+ outlineWidth: 1,
91
+ //边线颜色
92
+ outlineColor: '#000000',
93
+ //线宽
94
+ width: 2,
95
+ },
42
96
  initial: false,
43
- drawOption:""
97
+ drawOption: "",
98
+ draws: [
99
+ {
100
+ icon: "mapgis-huizhidian2",
101
+ type: "primary",
102
+ tip: "画点",
103
+ click: this.enableDrawPoint
104
+ },
105
+ {
106
+ icon: "mapgis-huizhixian1",
107
+ type: "primary",
108
+ tip: "画线",
109
+ click: this.enableDrawLine
110
+ },
111
+ {
112
+ icon: "mapgis-huizhijuxing",
113
+ type: "primary",
114
+ tip: "画矩形",
115
+ click: this.enableDrawRectangle
116
+ },
117
+ {
118
+ icon: "mapgis-draw-polygon",
119
+ type: "primary",
120
+ tip: "画多边形",
121
+ click: this.enableDrawPolygon
122
+ },
123
+ {
124
+ icon: "mapgis-huizhiyuan1",
125
+ type: "primary",
126
+ tip: "画圆",
127
+ click: this.enableDrawCircle
128
+ },
129
+ // {
130
+ // icon: "mapgis-icon_huizhiyuanxing",
131
+ // type: "primary",
132
+ // tip: "画半径",
133
+ // click: this.toggleRadius
134
+ // },
135
+ {
136
+ icon: "mapgis-shanchu_dianji",
137
+ type: "primary",
138
+ tip: "删除绘制",
139
+ click: this.removeEntities
140
+ }
141
+ ]
44
142
  };
45
143
  },
46
144
 
47
- created () { },
48
- mounted () {
145
+ created() {
146
+ },
147
+ mounted() {
148
+ this.drawStyleCopy = Object.assign(this.drawStyleCopy, this.drawStyle);
49
149
  this.mount();
50
150
  },
51
- destroyed () {
151
+ destroyed() {
52
152
  this.unmount();
53
153
  },
54
- watch: {},
154
+ watch: {
155
+ //贴地
156
+ clampToGround: {
157
+ handler: function (newVal, oldVal) {
158
+ this.unmount();
159
+ this.mount();
160
+ }
161
+ },
162
+ drawStyle: {
163
+ handler: function () {
164
+ this.drawStyleCopy = Object.assign(this.drawStyleCopy, this.drawStyle);
165
+ },
166
+ deep: true
167
+ }
168
+ },
55
169
  methods: {
56
- mount () {
170
+ mount() {
57
171
  let vm = this;
58
- const {vueKey,vueIndex} = this;
59
- //轮询,知道webGlobe有值,才会显示slot,这是为了保证draw组件不在webscene组件里面也能正常使用
172
+ const {vueKey, vueIndex} = this;
173
+ //轮询,直到webGlobe有值,才会显示slot,这是为了保证draw组件不在webscene组件里面也能正常使用
60
174
  let interval = setInterval(function () {
61
175
  let webGlobe = vm.getWebGlobe();
62
- if(webGlobe){
176
+ if (webGlobe) {
63
177
  clearInterval(interval);
64
178
  vm.initial = true;
65
- vm.$emit("load",vm);
179
+ vm.$emit("load", vm);
66
180
  window.CesiumZondy.DrawToolManager.addSource(
67
181
  vueKey,
68
182
  vueIndex,
69
183
  []
70
184
  );
71
185
  }
72
- },50);
186
+ }, 50);
73
187
  },
74
188
 
75
- unmount () {
76
- let { vueKey, vueIndex, CesiumZondy } = this;
77
- if(!CesiumZondy){
189
+ unmount() {
190
+ let {vueKey, vueIndex, CesiumZondy} = this;
191
+ if (!CesiumZondy) {
78
192
  CesiumZondy = window.CesiumZondy;
79
193
  }
80
194
  let find = CesiumZondy.DrawToolManager.findSource(vueKey, vueIndex);
@@ -84,7 +198,7 @@ export default {
84
198
  CesiumZondy.DrawToolManager.deleteSource(vueKey, vueIndex);
85
199
  }
86
200
  //清空drawElement
87
- if(window.drawElement){
201
+ if (window.drawElement) {
88
202
  window.drawElement.stopDrawing();
89
203
  }
90
204
  delete window.drawElement;
@@ -92,75 +206,95 @@ export default {
92
206
  this.$emit("unload", this);
93
207
  },
94
208
 
95
- removeEntities (unmount) {
209
+ removeEntities(unmount) {
210
+ let {vueKey, vueIndex} = this;
96
211
  //移除所有实体
97
- this.getWebGlobe();
98
- if(!unmount){
99
- if(this.drawOption.length > 0){
212
+ let webGlobeDraw = this.getWebGlobe();
213
+ // 取得webGlobe后,清空当前绘制
214
+ if (webGlobeDraw) {
215
+ let drawEntities = window.CesiumZondy.DrawToolManager.findSource(vueKey, vueIndex);
216
+ if (drawEntities) {
217
+ drawEntities = drawEntities.source;
218
+ for (let i = 0; i < drawEntities.length; i++) {
219
+ webGlobeDraw.viewer.scene.primitives.remove(drawEntities[i]);
220
+ webGlobeDraw.viewer.entities.remove(drawEntities[i]);
221
+ }
222
+ drawEntities.source = [];
223
+ }
224
+ }
225
+ if (!unmount) {
226
+ if (this.drawOption.length > 0) {
100
227
  this[this.drawOption]();
101
228
  }
102
229
  }
103
230
  },
104
- getWebGlobe(){
231
+ getWebGlobe() {
105
232
  let webGlobeDraw;
106
- let {webGlobe,CesiumZondy,Cesium,vueKey,vueIndex} = this;
107
- if(!CesiumZondy){
233
+ let {webGlobe, CesiumZondy, Cesium, vueKey, vueIndex} = this;
234
+ if (!CesiumZondy) {
108
235
  CesiumZondy = window.CesiumZondy;
109
236
  }
110
- if(!Cesium){
237
+ if (!Cesium) {
111
238
  Cesium = window.Cesium;
112
239
  }
113
240
  //当webGlobe存在,则表示在web-scene组建中,使用注入的webGlobe
114
- if(this.vueKey.length === 0){
241
+ if (this.vueKey.length === 0) {
115
242
  webGlobeDraw = webGlobe;
116
- }else {
243
+ } else {
117
244
  //当webGlobe不存在,则表示要通过vueKey获取
118
245
  let GlobesManager = CesiumZondy.GlobesManager;
119
- if(GlobesManager.hasOwnProperty(this.vueKey) && GlobesManager[this.vueKey].length > 0 && GlobesManager[this.vueKey][0].hasOwnProperty("source")){
246
+ if (GlobesManager.hasOwnProperty(this.vueKey) && GlobesManager[this.vueKey].length > 0 && GlobesManager[this.vueKey][0].hasOwnProperty("source")) {
120
247
  webGlobeDraw = GlobesManager[this.vueKey][0].source;
121
248
  }
122
249
  }
123
- //取得webGlobe后,清空当前绘制
124
- if(webGlobeDraw){
125
- let drawEntities = window.CesiumZondy.DrawToolManager.findSource(vueKey,vueIndex);
126
- if(drawEntities){
250
+ if (!this.infinite) {
251
+ let drawEntities = window.CesiumZondy.DrawToolManager.findSource(vueKey, vueIndex);
252
+ if (drawEntities) {
127
253
  drawEntities = drawEntities.source;
128
- for (let i = 0;i < drawEntities.length;i++){
254
+ for (let i = 0; i < drawEntities.length; i++) {
129
255
  webGlobeDraw.viewer.scene.primitives.remove(drawEntities[i]);
130
256
  webGlobeDraw.viewer.entities.remove(drawEntities[i]);
131
257
  }
132
258
  drawEntities.source = [];
133
259
  }
134
- if(window.drawElement){
135
- window.drawElement.stopDrawing();
136
- }
137
260
  }
138
261
  return webGlobeDraw;
139
262
  },
140
- getDrawElement(webGlobe){
141
- if (window.drawElement){
142
- window.drawElement.stopDrawing();
263
+ getDrawElement(webGlobe) {
264
+ if (window.drawElement) {
265
+ if (!this.infinite) {
266
+ window.drawElement.stopDrawing();
267
+ }
268
+ } else {
269
+ window.drawElement = new Cesium.DrawElement(webGlobe.viewer);
143
270
  }
144
- window.drawElement = new Cesium.DrawElement(webGlobe.viewer);
145
271
  return window.drawElement;
146
272
  },
147
- enableDrawPoint () {
273
+ enableDrawPoint() {
148
274
  this.drawOption = "enableDrawPoint";
149
275
  let webGlobeDraw = this.getWebGlobe();
150
276
  const vm = this;
151
- let { CesiumZondy,Cesium,vueKey,vueIndex } = this;
152
- if(!CesiumZondy){
277
+ let {CesiumZondy, Cesium, vueKey, vueIndex, drawStyleCopy} = this;
278
+ if (!CesiumZondy) {
153
279
  CesiumZondy = window.CesiumZondy;
154
280
  }
155
- if(!Cesium){
281
+ if (!Cesium) {
156
282
  Cesium = window.Cesium;
157
283
  }
158
284
  let entityController = new CesiumZondy.Manager.EntityController({
159
285
  viewer: webGlobeDraw.viewer
160
286
  });
161
287
  let drawElement = this.getDrawElement(webGlobeDraw);
288
+ if (this.clampToGround) {
289
+ drawElement.setGroundPrimitiveType('BOTH');
290
+ } else {
291
+ drawElement.setGroundPrimitiveType('NONE');
292
+ }
293
+ const outlineColor = new Cesium.Color.fromCssColorString(drawStyleCopy.outlineColor).withAlpha(drawStyleCopy.opacity);
294
+ const color = new Cesium.Color.fromCssColorString(drawStyleCopy.color).withAlpha(drawStyleCopy.opacity);
162
295
  drawElement.startDrawingMarker({
163
296
  addDefaultMark: false,
297
+ color: color,
164
298
  callback: function (position) {
165
299
  let cartographic = Cesium.Cartographic.fromCartesian(position);
166
300
  let lng = Cesium.Math.toDegrees(cartographic.longitude);
@@ -168,129 +302,223 @@ export default {
168
302
  let height = cartographic.height; //模型高度
169
303
  //添加点:经度、纬度、高程、名称、像素大小、颜色、外边线颜色、边线宽度
170
304
  let drawEntity = entityController.appendPoint(lng, lat, height, '点', 10,
171
- new Cesium.Color(255 / 255, 0 / 255, 0 / 255, 1),
172
- new Cesium.Color(255 / 255, 255 / 255, 0 / 255, 1),
173
- 2);
174
- let drawEntities = window.CesiumZondy.DrawToolManager.findSource(vueKey,vueIndex).source;
305
+ color,
306
+ outlineColor,
307
+ drawStyleCopy.outlineWidth);
308
+ let drawEntities = window.CesiumZondy.DrawToolManager.findSource(vueKey, vueIndex).source;
175
309
  drawEntities.push(drawEntity);
176
- if(!vm.infinite){
310
+ if (!vm.infinite) {
177
311
  drawElement.stopDrawing();
178
312
  }
179
- vm.$emit('drawCreate', position, [lng, lat, height],webGlobeDraw);
180
- vm.$emit('drawcreate', position, [lng, lat, height],webGlobeDraw);
313
+ vm.$emit('drawCreate', position, [lng, lat, height], webGlobeDraw);
314
+ vm.$emit('drawcreate', position, [lng, lat, height], webGlobeDraw);
181
315
  }
182
316
  });
183
317
  },
184
- enableDrawLine () {
318
+ enableDrawLine() {
185
319
  this.drawOption = "enableDrawLine";
186
320
  let webGlobeDraw = this.getWebGlobe();
187
- let {Cesium,vueKey,vueIndex} = this;
188
- if(!Cesium){
321
+ let {Cesium, vueKey, vueIndex, drawStyleCopy} = this;
322
+ if (!Cesium) {
189
323
  Cesium = window.Cesium;
190
324
  }
191
325
  let vm = this;
192
326
  let drawElement = this.getDrawElement(webGlobeDraw);
327
+ if (this.clampToGround) {
328
+ drawElement.setGroundPrimitiveType('BOTH');
329
+ } else {
330
+ drawElement.setGroundPrimitiveType('NONE');
331
+ }
332
+ const color = new Cesium.Color.fromCssColorString(drawStyleCopy.color).withAlpha(drawStyleCopy.opacity);
193
333
  drawElement.startDrawingPolyline({
334
+ color: color,
194
335
  callback: function (positions) {
195
336
  let degreeArr = [];
196
- for (let i = 0;i < positions.length;i++){
337
+ for (let i = 0; i < positions.length; i++) {
197
338
  let cartographic = Cesium.Cartographic.fromCartesian(positions[i]);
198
339
  let lng = Cesium.Math.toDegrees(cartographic.longitude);
199
340
  let lat = Cesium.Math.toDegrees(cartographic.latitude);
200
341
  let height = cartographic.height;
201
- degreeArr.push([lng,lat,height]);
342
+ degreeArr.push([lng, lat, height]);
202
343
  }
203
344
  let polyline = new Cesium.DrawElement.PolylinePrimitive({
204
- id:"polyline",
345
+ id: "polyline",
205
346
  positions: positions,
206
- width: 1,
347
+ width: drawStyleCopy.width,
207
348
  geodesic: true
208
349
  });
209
350
  let drawEntity = webGlobeDraw.viewer.scene.primitives.add(polyline);
210
- let drawEntities = window.CesiumZondy.DrawToolManager.findSource(vueKey,vueIndex).source;
351
+ let drawEntities = window.CesiumZondy.DrawToolManager.findSource(vueKey, vueIndex).source;
211
352
  drawEntities.push(drawEntity);
212
- if(!vm.infinite){
353
+
354
+ if (!vm.infinite) {
213
355
  drawElement.stopDrawing();
214
356
  }
215
- vm.$emit('drawCreate', positions,degreeArr,webGlobeDraw);
216
- vm.$emit('drawcreate', positions,degreeArr,webGlobeDraw);
357
+ vm.$emit('drawCreate', positions, degreeArr, webGlobeDraw);
358
+ vm.$emit('drawcreate', positions, degreeArr, webGlobeDraw);
217
359
  }
218
360
  });
219
361
  },
220
- enableDrawPolygon () {
362
+ //绘制多边形
363
+ enableDrawPolygon() {
221
364
  this.drawOption = "enableDrawPolygon";
222
365
  let webGlobeDraw = this.getWebGlobe();
223
- let {Cesium,vueKey,vueIndex} = this;
224
- if(!Cesium){
366
+ let {Cesium, vueKey, vueIndex} = this;
367
+ if (!Cesium) {
225
368
  Cesium = window.Cesium;
226
369
  }
227
370
  let vm = this;
371
+ let {drawStyleCopy} = this;
228
372
  let drawElement = this.getDrawElement(webGlobeDraw);
373
+ if (this.clampToGround) {
374
+ drawElement.setGroundPrimitiveType('BOTH');
375
+ } else {
376
+ drawElement.setGroundPrimitiveType('NONE');
377
+ }
378
+ const colorStyle = new Cesium.Color.fromCssColorString(drawStyleCopy.color).withAlpha(drawStyleCopy.opacity);
229
379
  drawElement.startDrawingPolygon({
380
+ color: colorStyle,
230
381
  callback: function (positions) {
231
382
  let degreeArr = [];
232
- for (let i = 0;i < positions.length;i++){
383
+ for (let i = 0; i < positions.length; i++) {
233
384
  let cartographic = Cesium.Cartographic.fromCartesian(positions[i]);
234
385
  let lng = Cesium.Math.toDegrees(cartographic.longitude);
235
386
  let lat = Cesium.Math.toDegrees(cartographic.latitude);
236
387
  let height = cartographic.height;
237
- degreeArr.push([lng,lat,height]);
388
+ degreeArr.push([lng, lat, height]);
238
389
  }
239
390
  let polygon = new Cesium.DrawElement.PolygonPrimitive({
240
391
  positions: positions,
241
392
  material: Cesium.Material.fromType('Color', {
242
- color: new Cesium.Color(1.0, 0.0, 0.0, 1.0)
393
+ color: colorStyle
243
394
  }),
244
395
  });
245
396
  let drawEntity = webGlobeDraw.viewer.scene.primitives.add(polygon);
246
- let drawEntities = window.CesiumZondy.DrawToolManager.findSource(vueKey,vueIndex).source;
397
+ let drawEntities = window.CesiumZondy.DrawToolManager.findSource(vueKey, vueIndex).source;
247
398
  drawEntities.push(drawEntity);
248
- if(!vm.infinite){
399
+
400
+ if (!vm.infinite) {
249
401
  drawElement.stopDrawing();
250
402
  }
251
- vm.$emit('drawCreate', positions,degreeArr,webGlobeDraw);
252
- vm.$emit('drawcreate', positions,degreeArr,webGlobeDraw);
403
+
404
+ vm.$emit('drawCreate', positions, degreeArr, webGlobeDraw);
405
+ vm.$emit('drawcreate', positions, degreeArr, webGlobeDraw);
253
406
  }
254
407
  });
255
408
  },
256
409
 
257
- enableDrawRectangle(){
410
+ //绘制矩形
411
+ enableDrawRectangle() {
258
412
  this.drawOption = "enableDrawRectangle";
259
413
  let webGlobeDraw = this.getWebGlobe();
260
- let {Cesium,vueKey,vueIndex} = this;
261
- if(!Cesium){
414
+ let {Cesium, vueKey, vueIndex, drawStyleCopy} = this;
415
+ if (!Cesium) {
262
416
  Cesium = window.Cesium;
263
417
  }
264
418
  let vm = this;
265
419
  let drawElement = this.getDrawElement(webGlobeDraw);
420
+ if (this.clampToGround) {
421
+ drawElement.setGroundPrimitiveType('BOTH');
422
+ } else {
423
+ drawElement.setGroundPrimitiveType('NONE');
424
+ }
425
+ const colorStyle = new Cesium.Color.fromCssColorString(drawStyleCopy.color).withAlpha(drawStyleCopy.opacity);
426
+
266
427
  drawElement.startDrawingExtent({
428
+ color: colorStyle,
267
429
  callback: function (positions) {
268
- let drawEntity = webGlobeDraw.viewer.entities.add({
269
- rectangle: {
270
- coordinates: positions,
271
- material: Cesium.Color.RED.withAlpha(0.5)
272
- }
430
+ let rectangle = new Cesium.DrawElement.ExtentPrimitive({
431
+ extent: positions,
432
+ material: Cesium.Material.fromType('Color', {
433
+ color: colorStyle
434
+ }),
273
435
  });
274
- let drawEntities = window.CesiumZondy.DrawToolManager.findSource(vueKey,vueIndex).source;
436
+ let drawEntity = webGlobeDraw.viewer.scene.primitives.add(rectangle);
437
+
438
+ let drawEntities = window.CesiumZondy.DrawToolManager.findSource(vueKey, vueIndex).source;
275
439
  drawEntities.push(drawEntity);
276
- let radianPoints = [positions.west,positions.north,positions.east,positions.south];
277
- let Cartesian3Points = Cesium.Cartesian3.fromRadiansArray(radianPoints,webGlobeDraw.ellipsoid);
440
+ let radianPoints = [positions.west, positions.north, positions.east, positions.south];
441
+ let Cartesian3Points = Cesium.Cartesian3.fromRadiansArray(radianPoints, webGlobeDraw.ellipsoid);
278
442
  let degreeArr = [];
279
- for (let i = 0;i < Cartesian3Points.length;i++){
443
+ for (let i = 0; i < Cartesian3Points.length; i++) {
280
444
  let cartographic = Cesium.Cartographic.fromCartesian(Cartesian3Points[i]);
281
445
  let lng = Cesium.Math.toDegrees(cartographic.longitude);
282
446
  let lat = Cesium.Math.toDegrees(cartographic.latitude);
283
447
  let height = positions.height;
284
- degreeArr.push([lng,lat,height]);
448
+ degreeArr.push([lng, lat, height]);
285
449
  }
286
- if(!vm.infinite){
450
+
451
+ if (!vm.infinite) {
287
452
  drawElement.stopDrawing();
288
453
  }
289
- vm.$emit('drawCreate', Cartesian3Points, degreeArr,webGlobeDraw);
290
- vm.$emit('drawcreate', Cartesian3Points, degreeArr,webGlobeDraw);
454
+ vm.$emit('drawCreate', Cartesian3Points, degreeArr, webGlobeDraw);
455
+ vm.$emit('drawcreate', Cartesian3Points, degreeArr, webGlobeDraw);
456
+ }
457
+ });
458
+ },
459
+
460
+ //绘制圆
461
+ enableDrawCircle() {
462
+ this.drawOption = "enableDrawCircle";
463
+ let webGlobeDraw = this.getWebGlobe();
464
+ let {Cesium, vueKey, vueIndex, drawStyleCopy} = this;
465
+ if (!Cesium) {
466
+ Cesium = window.Cesium;
467
+ }
468
+ let vm = this;
469
+ let drawElement = this.getDrawElement(webGlobeDraw);
470
+ if (this.clampToGround) {
471
+ drawElement.setGroundPrimitiveType('BOTH');
472
+ } else {
473
+ drawElement.setGroundPrimitiveType('NONE');
474
+ }
475
+ const colorStyle = new Cesium.Color.fromCssColorString(drawStyleCopy.color).withAlpha(drawStyleCopy.opacity);
476
+ drawElement.startDrawingCircle({
477
+ color: colorStyle,
478
+ callback: function (center, radius) {
479
+ // alert(center.toString() + ' ' + radius.toString());
480
+ var centerCartographic = Cesium.Cartographic.fromCartesian(center);
481
+ let height = centerCartographic.height;
482
+ let redCircle = new Cesium.DrawElement.CirclePrimitive({
483
+ center: center,
484
+ radius: radius,
485
+ height: height,
486
+ asynchronous: false,
487
+ material: Cesium.Material.fromType('Color', {
488
+ color: colorStyle
489
+ })
490
+ });
491
+
492
+ let drawEntity = webGlobeDraw.viewer.scene.primitives.add(redCircle);
493
+
494
+ if (!vm.infinite) {
495
+ drawElement.stopDrawing();
496
+ }
497
+
498
+ let drawEntities = window.CesiumZondy.DrawToolManager.findSource(vueKey, vueIndex).source;
499
+ drawEntities.push(drawEntity);
500
+
501
+ vm.$emit('drawCreate', center, radius, webGlobeDraw);
502
+ vm.$emit('drawcreate', center, radius, webGlobeDraw);
291
503
  }
292
504
  });
293
505
  }
294
506
  }
295
507
  };
296
508
  </script>
509
+ <style scoped>
510
+ .mapgis-3d-draw-control {
511
+ z-index: 1000;
512
+ position: absolute;
513
+ background: rgba(255, 255, 255, 0);
514
+ }
515
+
516
+ ::v-deep .mapgis-ui-card-body {
517
+ padding: 0;
518
+ background: rgba(255, 255, 255, 0);
519
+ }
520
+
521
+ ::v-deep .mapgis-ui-card-bordered {
522
+ border: unset;
523
+ }
524
+ </style>