@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,25 +1,25 @@
1
1
  <template>
2
- <div class="mapgis-legend">
3
- <a-select
4
- default-value="全部"
5
- style="width: 100%"
6
- @change="handleChange"
7
- >
8
- <a-select-option value="全部"> 全部 </a-select-option>
9
- <a-select-option
10
- :value="index"
11
- v-for="(layer, index) in layers"
12
- :key="index"
13
- >{{ layer.layerName }}
14
- </a-select-option>
15
- </a-select>
16
- <div class="legend-area">
17
- <li v-for="(legend, index) in legends" :key="index">
18
- <img :src="'data:image/png;base64,' + legend.imageData" />
19
- <span>{{ legend.label }}</span>
20
- </li>
21
- </div>
2
+ <div class="mapgis-legend">
3
+ <mapgis-ui-select
4
+ default-value="全部"
5
+ style="width: 100%"
6
+ @change="handleChange"
7
+ >
8
+ <mapgis-ui-select-option value="全部"> 全部 </mapgis-ui-select-option>
9
+ <mapgis-ui-select-option
10
+ :value="index"
11
+ v-for="(layer, index) in layers"
12
+ :key="index"
13
+ >{{ layer.layerName }}
14
+ </mapgis-ui-select-option>
15
+ </mapgis-ui-select>
16
+ <div class="legend-area">
17
+ <li v-for="(legend, index) in legends" :key="index">
18
+ <img :src="'data:image/png;base64,' + legend.imageData" />
19
+ <span>{{ legend.label }}</span>
20
+ </li>
22
21
  </div>
22
+ </div>
23
23
  </template>
24
24
 
25
25
  <script>
@@ -38,25 +38,29 @@ export default {
38
38
  },
39
39
  methods: {
40
40
  getLegendInfo(url) {
41
- const regExp = new RegExp("(?<=MapServer).*", 'i')
41
+ const regExp = new RegExp("(?<=MapServer).*", "i");
42
42
  let legendUrl = url.replace(regExp, "/legend?f=pjson");
43
43
  fetch(legendUrl)
44
- .then((res) => {
45
- return res.json();
46
- })
47
- .then((res) => {
44
+ .then((res) => {
45
+ return res.json();
46
+ })
47
+ .then((res) => {
48
+ if (res && res.error) {
49
+ this.$message.info(res.error.message);
50
+ } else {
48
51
  this.layers = this.layers.concat(res.layers);
49
52
  res.layers.forEach((layer) => {
50
53
  this.allLegends = this.allLegends.concat(layer.legend);
51
54
  });
52
55
  this.legends = this.allLegends;
53
- })
54
- .catch((err) => {
55
- console.log(err);
56
- });
56
+ }
57
+ })
58
+ .catch((err) => {
59
+ console.log(err);
60
+ });
57
61
  },
58
62
  getLegendUrl() {
59
- const {CesiumZondy} = this;
63
+ const { CesiumZondy } = this;
60
64
  let layers = [];
61
65
  Object.keys(CesiumZondy.ArcgisManager).forEach((key) => {
62
66
  if (key !== "vueKey") {
@@ -65,7 +69,7 @@ export default {
65
69
  });
66
70
  layers.forEach((layer) => {
67
71
  let url = layer.source._imageryProvider.url;
68
- const regExp = new RegExp("\\/arcgis\\/rest\\/services", 'i');
72
+ const regExp = new RegExp("\\/arcgis\\/rest\\/services", "i");
69
73
 
70
74
  // if (/\/arcgis\/rest\/services/i.test(url)) {
71
75
  // this.getLegendInfo(url);
@@ -88,37 +92,37 @@ export default {
88
92
 
89
93
  <style scoped>
90
94
  .mapgis-legend {
91
- z-index: 100;
92
- position: absolute;
93
- right: 20px;
94
- bottom: 20px;
95
- width: fit-content;
96
- height: fit-content;
97
- padding: 12px;
98
- border: 1px solid #333;
99
- border-radius: 3px;
100
- background: #fff;
101
- overflow: auto;
95
+ z-index: 100;
96
+ position: absolute;
97
+ right: 20px;
98
+ bottom: 20px;
99
+ width: fit-content;
100
+ height: fit-content;
101
+ padding: 12px;
102
+ border: 1px solid #333;
103
+ border-radius: 3px;
104
+ background: #fff;
105
+ overflow: auto;
102
106
  }
103
107
 
104
108
  .mapgis-legend .legend-area {
105
- width: 180px;
106
- height: 220px;
107
- margin-top: 10px;
108
- overflow: auto;
109
+ width: 180px;
110
+ height: 220px;
111
+ margin-top: 10px;
112
+ overflow: auto;
109
113
  }
110
114
 
111
115
  .mapgis-legend .legend-area li {
112
- display: flex;
116
+ display: flex;
113
117
  }
114
118
 
115
119
  .mapgis-legend .legend-area li img {
116
- height: 20px;
117
- width: 20px;
120
+ height: 20px;
121
+ width: 20px;
118
122
  }
119
123
 
120
124
  .mapgis-legend .legend-area li span {
121
- text-align: left;
122
- word-break: break-all;
125
+ text-align: left;
126
+ word-break: break-all;
123
127
  }
124
128
  </style>
@@ -34,6 +34,10 @@ export default {
34
34
  return Number((Math.random() * 100000000).toFixed(0));
35
35
  }
36
36
  },
37
+ timestamp: {
38
+ type: Number,
39
+ default: 0 // 毫秒
40
+ },
37
41
  interval: {
38
42
  type: Number,
39
43
  default: 60
@@ -46,6 +50,7 @@ export default {
46
50
  data() {
47
51
  return {
48
52
  time: 0,
53
+ stamp: -1,
49
54
  active: false
50
55
  };
51
56
  },
@@ -99,31 +104,43 @@ export default {
99
104
  }
100
105
  },
101
106
  updateView(camera) {
102
- let { interval } = this;
103
- // 一秒60帧,每秒更新一次,减少无效更新
104
- if (++this.time % interval === 0) {
105
- let view3d = {
106
- destination: deepCopy(camera.position),
107
- orientation: {
108
- direction: deepCopy(camera._direction),
109
- up: deepCopy(camera.up),
110
- heading: deepCopy(camera.heading),
111
- pitch: deepCopy(camera.pitch),
112
- roll: deepCopy(camera.roll)
113
- }
114
- };
115
- let rect = camera.computeViewRectangle();
116
- let rect2d = { west: 0, east: 0, north: 0, south: 0 };
117
- rect2d.west = Cesium.Math.toDegrees(rect.west);
118
- rect2d.east = Cesium.Math.toDegrees(rect.east);
119
- rect2d.north = Cesium.Math.toDegrees(rect.north);
120
- rect2d.south = Cesium.Math.toDegrees(rect.south);
121
- this.$emit("change", {
122
- "3d": view3d,
123
- "2d": rect2d
124
- });
107
+ let { interval, timestamp } = this;
108
+ // 针对按帧刷新或者按照时间戳刷新走不同的分支
109
+ if (timestamp > 0) {
110
+ let curstamp = new Date().getTime();
111
+ if (curstamp - this.stamp > timestamp) {
112
+ this.updateRect(camera);
113
+ this.stamp = curstamp;
114
+ }
115
+ } else {
116
+ // 一秒60帧,每秒更新一次,减少无效更新
117
+ if (++this.time % interval === 0) {
118
+ this.updateRect(camera);
119
+ }
120
+ if (this.time > 1000000) this.time = 0;
125
121
  }
126
- if (this.time > 1000000) this.time = 0;
122
+ },
123
+ updateRect(camera) {
124
+ let view3d = {
125
+ destination: deepCopy(camera.position),
126
+ orientation: {
127
+ direction: deepCopy(camera._direction),
128
+ up: deepCopy(camera.up),
129
+ heading: deepCopy(camera.heading),
130
+ pitch: deepCopy(camera.pitch),
131
+ roll: deepCopy(camera.roll)
132
+ }
133
+ };
134
+ let rect = camera.computeViewRectangle();
135
+ let rect2d = { west: 0, east: 0, north: 0, south: 0 };
136
+ rect2d.west = Cesium.Math.toDegrees(rect.west);
137
+ rect2d.east = Cesium.Math.toDegrees(rect.east);
138
+ rect2d.north = Cesium.Math.toDegrees(rect.north);
139
+ rect2d.south = Cesium.Math.toDegrees(rect.south);
140
+ this.$emit("change", {
141
+ "3d": view3d,
142
+ "2d": rect2d
143
+ });
127
144
  },
128
145
  setView(viewer, camera) {
129
146
  let view3d = {
@@ -144,6 +161,8 @@ export default {
144
161
  let sources = CesiumZondy.GlobesManager.flatAllSource();
145
162
  let vm = this;
146
163
 
164
+ this.stamp = new Date().getTime();
165
+
147
166
  for (let i = 0; i < sources.length; i++) {
148
167
  let s = sources[i];
149
168
  if (includes && includes.length > 0 && includes.indexOf(s.parent) < 0) {
@@ -162,6 +181,10 @@ export default {
162
181
  s.source.viewer.scene.canvas
163
182
  );
164
183
 
184
+ s.source.viewer.camera.changed.addEventListener(() => {
185
+ vm.updateView(s.source.viewer.camera);
186
+ });
187
+
165
188
  screenSpaceEventType.forEach(item => {
166
189
  s.options.ScreenSpaceEventHandler.setInputAction(function(movement) {
167
190
  if (item.type == "LEFT_DOWN" || item.type == "RIGHT_DOWN") {
@@ -184,7 +207,7 @@ export default {
184
207
  }
185
208
  },
186
209
  deleteHandler() {
187
- let { CesiumZondy } = this;
210
+ let { CesiumZondy, screenSpaceEventType } = this;
188
211
  CesiumZondy = CesiumZondy || window.CesiumZondy;
189
212
  /* 这段代码要结合WebGlobe里面的如下代码才能明白
190
213
  window.CesiumZondy.GlobesManager.addSource(vueKey, vueIndex, webGlobe, {
@@ -194,8 +217,9 @@ export default {
194
217
  if (instance) {
195
218
  const handler = instance.ScreenSpaceEventHandler;
196
219
  if (handler) {
197
- handler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
198
- handler.removeInputAction(Cesium.ScreenSpaceEventType.WHEEL);
220
+ screenSpaceEventType.forEach(item => {
221
+ handler.removeInputAction(Cesium.ScreenSpaceEventType[item.type]);
222
+ });
199
223
  handler.destroy();
200
224
  }
201
225
  }
@@ -203,16 +227,14 @@ export default {
203
227
  let sources = CesiumZondy.GlobesManager.flatAllSource();
204
228
  sources.forEach((s, i) => {
205
229
  if (s.options.ScreenSpaceEventHandler) {
206
- s.options.ScreenSpaceEventHandler.removeInputAction(
207
- Cesium.ScreenSpaceEventType.MOUSE_MOVE
208
- );
209
- s.options.ScreenSpaceEventHandler.removeInputAction(
210
- Cesium.ScreenSpaceEventType.WHEEL
211
- );
212
- s.options.ScreenSpaceEventHandler.setInputAction(function(
213
- movement
214
- ) {},
215
- Cesium.ScreenSpaceEventType.MOUSE_MOVE);
230
+ screenSpaceEventType.forEach(item => {
231
+ s.options.ScreenSpaceEventHandler.removeInputAction(
232
+ Cesium.ScreenSpaceEventType[item.type]
233
+ );
234
+ });
235
+ s.source.viewer.camera.changed.removeEventListener(() => {
236
+ vm.updateView(s.source.viewer.camera);
237
+ });
216
238
  // s.options.ScreenSpaceEventHandler.destroy();
217
239
  }
218
240
  });
@@ -1,6 +1,9 @@
1
1
  <template>
2
- <div>
2
+ <div class="mapgis-3d-measure">
3
3
  <slot v-if="initial"></slot>
4
+ <slot name="measureTool">
5
+ <measure-3d-tool/>
6
+ </slot>
4
7
  </div>
5
8
  </template>
6
9
 
@@ -8,21 +11,31 @@
8
11
 
9
12
  <script>
10
13
  import ServiceLayer from "../ServiceLayer";
14
+ import Measure3dTool from "./components/MeasureTool.vue";
11
15
 
12
16
  export default {
13
17
  name: "mapgis-3d-measure",
14
18
  mixins: [ServiceLayer],
19
+ components: {
20
+ "measure-3d-tool": Measure3dTool
21
+ },
15
22
  props: {
16
- styles:{
23
+ styles: {
17
24
  type: Object,
18
- default(){
25
+ default() {
19
26
  return {
20
27
  lineColor: "black"
21
- }
28
+ };
29
+ }
30
+ },
31
+ measureOptions: {
32
+ type: Object,
33
+ default() {
34
+ return {};
22
35
  }
23
36
  }
24
37
  },
25
- data () {
38
+ data() {
26
39
  return {
27
40
  measure: undefined,
28
41
  initial: false,
@@ -30,71 +43,100 @@ export default {
30
43
  waitManagerName: "GlobesManager"
31
44
  };
32
45
  },
33
- watch:{
46
+ watch: {
34
47
  styles: {
35
- handler: function() {
48
+ handler: function () {
36
49
  this.initStyles();
37
50
  },
38
51
  deep: true
52
+ },
53
+ measureOptions: {
54
+ handler: function () {
55
+ this.measureOptions = this.$_formatOptions(this.measureOptions);
56
+ },
57
+ deep: true
39
58
  }
40
59
  },
41
- mounted () {
60
+ mounted() {
42
61
  let vm = this;
62
+ this.measureOptions = this.$_formatOptions(this.measureOptions);
43
63
  this.$_init(function () {
44
64
  vm.initStyles();
45
65
  vm.initial = true;
46
- vm.$emit("load",vm);
47
- })
66
+ vm.$emit("load", vm);
67
+ });
48
68
  },
49
69
  destroyed() {
50
70
  this.deleteMeasure();
51
- vm.$emit("unload");
71
+ this.$emit("unload");
52
72
  },
53
73
  methods: {
54
- initStyles(){
55
- this.measureStyles.lineColor = Cesium.Color.fromCssColorString(this.styles.lineColor,this.measureStyles.lineColor);
74
+ initStyles() {
75
+ this.measureStyles.lineColor = Cesium.Color.fromCssColorString(
76
+ this.styles.lineColor,
77
+ this.measureStyles.lineColor
78
+ );
56
79
  },
57
- measureCallBack(result){
58
- if(result instanceof Array){
80
+ measureCallBack(result) {
81
+ if (result instanceof Array) {
59
82
  for (let i = 0; i < result.length; i++) {
60
83
  result[i] = result[i] / 1000;
61
84
  }
62
85
  }
63
- this.$emit("measured",result);
86
+ this.$emit("measured", result);
64
87
  },
65
- enableMeasureLength(){
88
+ enableMeasureLength() {
66
89
  this.$_enableMeasure("MeasureLengthTool");
67
-
68
90
  },
69
- enableMeasureArea(){
91
+ enableMeasureArea() {
70
92
  this.$_enableMeasure("MeasureAreaTool");
71
93
  },
72
- enableMeasureTriangle(){
94
+ enableMeasureTriangle() {
73
95
  this.$_enableMeasure("TriangulationTool");
74
96
  },
75
- enableMeasureSlope(){
97
+ enableMeasureSlope() {
76
98
  this.$_enableMeasure("MeasureSlopeTool");
77
99
  },
78
- $_enableMeasure(MeasureName){
79
- const { vueKey,vueIndex } = this;
80
- let webGlobe = this.$_getObject(this.waitManagerName,this.deleteMeasure);
81
- let measure = new Cesium[MeasureName](webGlobe.viewer,{
100
+ $_formatOptions(options) {
101
+ const colorArr = ["fillColor", "outlineColor", "backgroundColor", "lineColor", "areaColor"];
102
+ for (let i=0;i<colorArr.length;i++){
103
+ if(options.hasOwnProperty(colorArr[i]) && typeof options[colorArr[i]] === "string"){
104
+ options[colorArr[i]] = Cesium.Color.fromCssColorString(options[colorArr[i]]);
105
+ }
106
+ }
107
+ return options;
108
+ },
109
+ $_enableMeasure(MeasureName) {
110
+ const {vueKey, vueIndex} = this;
111
+ let webGlobe = this.$_getObject(this.waitManagerName, this.deleteMeasure);
112
+ let measureOptions = {
82
113
  lineColor: this.measureStyles.lineColor,
83
- callBack: this.measureCallBack
84
- });
114
+ callBack: result => {
115
+ if (typeof callback === "function") {
116
+ callback(result);
117
+ } else {
118
+ this.measureCallBack(result);
119
+ }
120
+ }
121
+ }
122
+ measureOptions = Object.assign(measureOptions, this.measureOptions);
123
+ let measure = new Cesium[MeasureName](webGlobe.viewer, measureOptions);
85
124
  window.CesiumZondy.MeasureToolManager.addSource(
86
- vueKey,
87
- vueIndex,
88
- measure
125
+ vueKey,
126
+ vueIndex,
127
+ measure
89
128
  );
90
129
  measure.startTool();
91
130
  },
92
- deleteMeasure(){
93
- this.$_deleteManger("MeasureToolManager",function (manager) {
94
- if(manager.source){
131
+ deleteMeasure() {
132
+ this.$_deleteManger("MeasureToolManager", function (manager) {
133
+ if (manager.source) {
95
134
  manager.source.stopTool();
96
135
  }
97
136
  });
137
+ },
138
+ remove() {
139
+ this.deleteMeasure();
98
140
  }
99
141
  }
100
142
  };
@@ -0,0 +1,71 @@
1
+ <template>
2
+ <div v-if="selfResult" class="measure-result">
3
+ <div v-for="{ label, value, unit } in selfResultOptions" :key="value">
4
+ {{ label }}:{{ selfResult[value] }} {{ unit }}
5
+ </div>
6
+ </div>
7
+ </template>
8
+ <script>
9
+ export const measureModeMap = {
10
+ MeasureLengthTool: "MeasureLengthTool",
11
+ MeasureAreaTool: "MeasureAreaTool",
12
+ TriangulationTool: "TriangulationTool"
13
+ };
14
+
15
+ export default {
16
+ name: "measure-3d-result",
17
+ props: {
18
+ mode: {
19
+ type: String
20
+ },
21
+ result: {
22
+ type: Object
23
+ }
24
+ },
25
+ data: vm => ({
26
+ selfResult: null,
27
+ selfResultMap: {
28
+ [measureModeMap.MeasureLengthTool]: [
29
+ {
30
+ label: "直线距离",
31
+ value: "cesiumLength",
32
+ unit: "千米"
33
+ }
34
+ ],
35
+ [measureModeMap.MeasureAreaTool]: [
36
+ {
37
+ label: "空间面积",
38
+ value: "cesiumArea",
39
+ unit: "平方公里"
40
+ }
41
+ ],
42
+ [measureModeMap.TriangulationTool]: [
43
+ {
44
+ label: "高差",
45
+ value: "verticalDiatance",
46
+ unit: "米"
47
+ },
48
+ {
49
+ label: "水平距离",
50
+ value: "horizontalDiatance",
51
+ unit: "米"
52
+ }
53
+ ]
54
+ }
55
+ }),
56
+ computed: {
57
+ selfResultOptions({ selfResultMap, mode }) {
58
+ return selfResultMap[mode];
59
+ }
60
+ },
61
+ watch: {
62
+ result: {
63
+ deep: true,
64
+ handler(nResult) {
65
+ this.selfResult = nResult;
66
+ }
67
+ }
68
+ }
69
+ };
70
+ </script>
71
+ <style lang="less" scoped></style>
@@ -0,0 +1,63 @@
1
+ <template>
2
+ <div class="measure-3d-setting">
3
+ <mapgis-ui-group-tab title="设置">
4
+ <mapgis-ui-toolbar-command
5
+ slot="handle"
6
+ title="重置"
7
+ icon="mapgis-redo"
8
+ @click="onReset"
9
+ />
10
+ </mapgis-ui-group-tab>
11
+ <mapgis-ui-setting-form layout="vertical">
12
+ <mapgis-ui-form-item label="线颜色">
13
+ <mapgis-ui-sketch-color-picker
14
+ @input="onColorChange($event, 'lineColor')"
15
+ :color="measureStyle.lineColor"
16
+ :disable-alpha="false"
17
+ />
18
+ </mapgis-ui-form-item>
19
+ </mapgis-ui-setting-form>
20
+ </div>
21
+ </template>
22
+ <script>
23
+ const initStyle = {
24
+ lineColor: "#1890ff"
25
+ };
26
+
27
+ export default {
28
+ name: "measure-3d-setting",
29
+ props: {},
30
+ data: vm => ({
31
+ measureStyle: { ...initStyle }
32
+ }),
33
+ watch: {
34
+ measureStyle: {
35
+ handler(nStyle) {
36
+ this.emitStyle(nStyle);
37
+ },
38
+ deep: true
39
+ }
40
+ },
41
+ methods: {
42
+ /**
43
+ * 抛出事件
44
+ */
45
+ emitStyle(nStyle) {
46
+ this.$emit("measure-style-change", nStyle);
47
+ },
48
+ /**
49
+ * 重置样式
50
+ */
51
+ onReset() {
52
+ this.measureStyle = { ...initStyle };
53
+ },
54
+ /**
55
+ * 颜色选择变化
56
+ */
57
+ onColorChange({ hex }, type) {
58
+ this.$set(this.measureStyle, type, hex);
59
+ }
60
+ }
61
+ };
62
+ </script>
63
+ <style lang="less" scoped></style>