@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
package/src/component.js CHANGED
@@ -20,10 +20,14 @@ export { default as Mapgis3dOgcWmsLayer } from "./components/Layer/OGC/OGCWMSLay
20
20
  export { default as Mapgis3dOgcReveserWmsLayer } from "./components/Layer/OGC/OGCReveserWMSLayer.vue";
21
21
 
22
22
  export { default as Mapgis3dIgsVectorLayer } from "./components/Layer/IGServer/IgsVectorLayer.vue";
23
+ export { default as Mapgis3dIgsFeatureLayer } from "./components/Layer/IGServer/IgsFeatureLayer.vue";
23
24
 
24
25
  export { default as Mapgis3dArcgisTileLayer } from "./components/Layer/ArcGISServer/ArcGISTileLayer";
25
26
  export { default as Mapgis3dArcgisMapLayer } from "./components/Layer/ArcGISServer/ArcGISMapLayer";
26
27
 
28
+ // 要素图层
29
+ export { default as Mapgis3dGeojsonLayer } from "./components/Layer/GeoJSON/GeoJsonLayer";
30
+
27
31
  // 矢量瓦片
28
32
  export { default as Mapgis3dVectortileLayer } from "./components/Layer/VectorTile/VectorTileLayer.vue";
29
33
 
@@ -34,8 +38,13 @@ export { default as Mapgis3dTileset } from "./components/M3D/3dTileset.vue";
34
38
 
35
39
  export { default as Mapgis3dPopup } from "./components/UI/Popup/Popup.vue";
36
40
  export { default as Mapgis3dMarker } from "./components/UI/Marker/Marker";
41
+ export { default as Mapgis3dMarkerPro } from "./components/Layer/Marker/Marker3dPro.vue";
42
+ export { default as Mapgis3dMarkerSetPro } from "./components/Layer/Marker/Marker3dSetPro.vue";
43
+ export { default as Mapgis3dDynamicMarkerLayer } from "./components/Layer/Marker/DynamicMarkerLayer.vue";
37
44
  export { default as Mapgis3dMapvLayer } from "./components/Overlay/Mapv3dLayer.vue";
38
- // export { default as Mapgis3dEchartsLayer } from "./components/Overlay/Echarts.vue";
45
+ export { default as Mapgis3dEchartsLayer } from "./components/Overlay/Echarts.vue";
46
+ export { default as Mapgis3dCesiumHeaterLayer } from "./components/Overlay/themeLayer/heater/CesiumHeater.vue";
47
+ export { default as Mapgis3dMapvHeaterLayer } from "./components/Overlay/themeLayer/heater/MapvHeater.vue";
39
48
 
40
49
  export { default as Mapgis3dIgsTerrain } from "./components/Provider/TerrainProvider/IgsTerrainProvider.vue";
41
50
  export { default as Mapgis3dTerrainProvider } from "./components/Provider/TerrainProvider/TerrainProvider.vue";
@@ -53,7 +62,14 @@ export { default as Mapgis3dExcavate } from "./components/Analysis/Excavate";
53
62
  export { default as Mapgis3dHeightlimited } from "./components/Analysis/HeightLimited";
54
63
  export { default as Mapgis3dShadow } from "./components/Analysis/Shadow";
55
64
  export { default as Mapgis3dDynamicCutting } from "./components/Analysis/DynamicCutting";
56
- export { default as Mapgis3dCutFill } from "./components/Analysis/Fill";
65
+ export { default as Mapgis3dDynamicSection } from "./components/Analysis/DynamicSection";
66
+ export { default as Mapgis3dFill } from "./components/Analysis/Fill";
67
+ export { default as Mapgis3dAspect } from "./components/Analysis/Aspect";
68
+ export { default as Mapgis3dSlope } from "./components/Analysis/Slope";
69
+ export { default as Mapgis3dContour } from "./components/Analysis/Contour";
70
+ export { default as Mapgis3dCutFill } from "./components/Analysis/CutFill";
71
+ export { default as Mapgis3dProfile } from "./components/Analysis/Profile";
72
+ export { default as Mapgis3dParticleEffects } from "./components/Overlay/ParticleEffects";
57
73
  export { default as Mapgis3dFlood } from "./components/Analysis/Flood";
58
74
 
59
75
  //融合组件
@@ -64,3 +80,5 @@ export { default as Mapgis3dComponentLegend } from "./components/UI/mixComponent
64
80
  export { default as Mapgis3dRainEffect } from "./components/SceneEffect/RainEffect";
65
81
  export { default as Mapgis3dSnowEffect } from "./components/SceneEffect/SnowEffect";
66
82
  export { default as Mapgis3dFogEffect } from "./components/SceneEffect/FogEffect";
83
+
84
+ export { default as Mapgis3DComprehensiveQuery } from "./components/service/comprehensive-query/ComprehensiveQuery";
@@ -0,0 +1,318 @@
1
+ <template>
2
+ <div>
3
+ <slot>
4
+ <div class="mapgis-widget-aspect-analysis">
5
+ <mapgis-ui-group-tab title="坡向图例设置">
6
+ <mapgis-ui-tooltip slot="handle" placement="bottomRight">
7
+ <template slot="title">
8
+ <span>{{ info }}</span>
9
+ </template>
10
+ <mapgis-ui-iconfont type="mapgis-info"></mapgis-ui-iconfont>
11
+ </mapgis-ui-tooltip>
12
+ </mapgis-ui-group-tab>
13
+ <mapgis-ui-colors-setting
14
+ v-model="rampColorsCopy"
15
+ :rangeField="'坡向范围'"
16
+ ></mapgis-ui-colors-setting>
17
+ <mapgis-ui-setting-footer>
18
+ <mapgis-ui-button type="primary" @click="analysis"
19
+ >分析</mapgis-ui-button
20
+ >
21
+ <mapgis-ui-button @click="remove">清除</mapgis-ui-button>
22
+ </mapgis-ui-setting-footer>
23
+ </div>
24
+ </slot>
25
+ </div>
26
+ </template>
27
+
28
+ <script>
29
+ import { rgbaToHex } from "../Utils/common/color-util";
30
+ /* import { Util } from "@mapgis/webclient-vue-ui";
31
+ const { ColorUtil } = Util; */
32
+ import VueOptions from "../Base/Vue/VueOptions";
33
+ import {
34
+ isEnableLighting,
35
+ setEnableLighting,
36
+ getBrightness,
37
+ getBrightnessStatusAndUniformsBrightness,
38
+ setBrightnessStatusAndUniformsBrightness
39
+ } from "../WebGlobe/util";
40
+
41
+ export default {
42
+ name: "mapgis-3d-analysis-aspect",
43
+ inject: ["Cesium", "CesiumZondy", "webGlobe"],
44
+ props: {
45
+ ...VueOptions,
46
+ /**
47
+ * @type Object
48
+ * @description 坡向分析角度颜色数组
49
+ */
50
+ rampColors: {
51
+ type: Array,
52
+ default: () => {
53
+ return [
54
+ { min: 0, max: 60, color: "rgba(244, 67, 54, 0.5)" },
55
+ { min: 60, max: 120, color: "rgba(233, 30, 99, 0.5)" },
56
+ { min: 120, max: 180, color: "rgba(156, 39, 176, 0.5)" },
57
+ { min: 180, max: 240, color: "rgba(255, 235, 59, 0.5)" },
58
+ { min: 240, max: 300, color: "rgba(96, 125, 139, 0.5)" },
59
+ { min: 300, max: 360, color: "rgba(76, 175, 80, 0.5)" }
60
+ ];
61
+ }
62
+ }
63
+ },
64
+ watch: {
65
+ rampColors: {
66
+ handler() {
67
+ this.rampColorsCopy = this.rampColors;
68
+ },
69
+ deep: true,
70
+ immediate: true
71
+ }
72
+ },
73
+ data() {
74
+ return {
75
+ rampColorsCopy: [
76
+ { min: 0, max: 60, color: "rgba(244, 67, 54, 0.5)" },
77
+ { min: 60, max: 120, color: "rgba(233, 30, 99, 0.5)" },
78
+ { min: 120, max: 180, color: "rgba(156, 39, 176, 0.5)" },
79
+ { min: 180, max: 240, color: "rgba(255, 235, 59, 0.5)" },
80
+ { min: 240, max: 300, color: "rgba(96, 125, 139, 0.5)" },
81
+ { min: 300, max: 360, color: "rgba(76, 175, 80, 0.5)" }
82
+ ],
83
+
84
+ isEnableLighting: undefined, // 光照是否已开启
85
+
86
+ noBrightness: undefined, // 是否有brightness对象
87
+
88
+ brightnessStatusAndUniformsBrightness: undefined, // 光照参数
89
+
90
+ info:
91
+ "坡向分析需要带法线地形。\r\n坡向按照东北西南的顺序表示方向,即0°表示坡向指向正东方向。"
92
+ };
93
+ },
94
+
95
+ created() {},
96
+ mounted() {
97
+ this.mount();
98
+ },
99
+ destroyed() {
100
+ this.unmount();
101
+ },
102
+ methods: {
103
+ async createCesiumObject() {
104
+ const { baseUrl, options } = this;
105
+ return new Promise(
106
+ resolve => {
107
+ resolve();
108
+ },
109
+ reject => {}
110
+ );
111
+ },
112
+ mount() {
113
+ const { webGlobe, CesiumZondy, vueKey, vueIndex } = this;
114
+ const { viewer } = webGlobe;
115
+ const vm = this;
116
+ let promise = this.createCesiumObject();
117
+ promise.then(function(dataSource) {
118
+ vm.$emit("load", vm);
119
+ CesiumZondy.AspectAnalysisManager.addSource(
120
+ vueKey,
121
+ vueIndex,
122
+ dataSource,
123
+ {
124
+ drawElement: null,
125
+ aspectAnalysis: null
126
+ }
127
+ );
128
+ });
129
+ },
130
+ unmount() {
131
+ let { CesiumZondy, vueKey, vueIndex } = this;
132
+ let find = CesiumZondy.AspectAnalysisManager.findSource(vueKey, vueIndex);
133
+ if (find) {
134
+ this.remove();
135
+ }
136
+ CesiumZondy.AspectAnalysisManager.deleteSource(vueKey, vueIndex);
137
+ this.$emit("unload", this);
138
+ },
139
+ /**
140
+ * @description 开启光照
141
+ */
142
+ _enableBrightness() {
143
+ // 开启光照,不然放大地图,分析结果显示异常
144
+
145
+ this.isEnableLighting = isEnableLighting(this.webGlobe);
146
+ if (!this.isEnableLighting) {
147
+ // 未开启光照,开启
148
+ setEnableLighting(true, this.webGlobe);
149
+ }
150
+ // 调高亮度
151
+ const { viewer } = this.webGlobe;
152
+ const stages = viewer.scene.postProcessStages;
153
+ const brightness = getBrightness(this.webGlobe);
154
+ if (!brightness) {
155
+ // 初始没有brightness对象
156
+ this.noBrightness = true;
157
+ viewer.scene.brightness = stages.add(
158
+ this.Cesium.PostProcessStageLibrary.createBrightnessStage()
159
+ );
160
+ }
161
+ // 设置前记录原有光照参数
162
+ this.brightnessStatusAndUniformsBrightness = getBrightnessStatusAndUniformsBrightness(
163
+ this.webGlobe
164
+ );
165
+ const statusAndUniformsBrightness = {
166
+ enabled: true,
167
+ brightness: 1.2
168
+ };
169
+ setBrightnessStatusAndUniformsBrightness(
170
+ statusAndUniformsBrightness,
171
+ this.webGlobe
172
+ );
173
+ },
174
+ /**
175
+ * @description 开始绘制并分析
176
+ */
177
+ analysis() {
178
+ let { CesiumZondy, vueKey, vueIndex } = this;
179
+ let find = CesiumZondy.AspectAnalysisManager.findSource(vueKey, vueIndex);
180
+ let { options } = find;
181
+ let { aspectAnalysis, drawElement } = options;
182
+ const { viewer } = this.webGlobe;
183
+ // 初始化交互式绘制控件
184
+ drawElement = drawElement || new this.Cesium.DrawElement(viewer);
185
+ CesiumZondy.AspectAnalysisManager.changeOptions(
186
+ vueKey,
187
+ vueIndex,
188
+ "drawElement",
189
+ drawElement
190
+ );
191
+
192
+ const { rampColorsCopy } = this;
193
+
194
+ const colors = [];
195
+ const ramp = [];
196
+ rampColorsCopy.forEach(({ max, color }) => {
197
+ ramp.push((max / 360).toFixed(2));
198
+ colors.push(color);
199
+ });
200
+ const rampColor = this._transformColor(colors);
201
+
202
+ // 激活交互式绘制工具
203
+ drawElement.startDrawingPolygon({
204
+ // 绘制完成回调函数
205
+ callback: positions => {
206
+ this.remove();
207
+ this._enableBrightness(); // 开启光照
208
+ aspectAnalysis =
209
+ aspectAnalysis ||
210
+ new this.Cesium.TerrainAnalyse(viewer, {
211
+ aspectRampColor: rampColor,
212
+ aspectRamp: ramp
213
+ });
214
+ aspectAnalysis.enableContour(false);
215
+ aspectAnalysis.updateMaterial("aspect");
216
+ aspectAnalysis.changeAnalyseArea(positions);
217
+ CesiumZondy.AspectAnalysisManager.changeOptions(
218
+ vueKey,
219
+ vueIndex,
220
+ "aspectAnalysis",
221
+ aspectAnalysis
222
+ );
223
+ }
224
+ });
225
+ },
226
+ /**
227
+ * @description rgba数组转hex数组
228
+ * @param arrayColor - {Array} rgba数组
229
+ * @return hex数组
230
+ */
231
+ _transformColor(arrayColor) {
232
+ let isNull = false;
233
+ const arr = arrayColor.map(color => {
234
+ if (color) {
235
+ return rgbaToHex(color);
236
+ }
237
+ isNull = true;
238
+ return null;
239
+ });
240
+ if (isNull) {
241
+ return [];
242
+ }
243
+ return arr;
244
+ },
245
+ /**
246
+ * @description 移除坡向分析结果,取消交互式绘制事件激活状态
247
+ */
248
+ remove() {
249
+ let { CesiumZondy, vueKey, vueIndex } = this;
250
+ let find = CesiumZondy.AspectAnalysisManager.findSource(vueKey, vueIndex);
251
+ let { options } = find;
252
+ let { aspectAnalysis, drawElement } = options;
253
+
254
+ // 判断是否已有坡向分析结果
255
+ if (aspectAnalysis) {
256
+ // 移除坡向分析显示结果
257
+ aspectAnalysis.updateMaterial("none");
258
+ CesiumZondy.AspectAnalysisManager.changeOptions(
259
+ vueKey,
260
+ vueIndex,
261
+ "aspectAnalysis",
262
+ null
263
+ );
264
+ }
265
+
266
+ if (drawElement) {
267
+ // 取消交互式绘制矩形事件激活状态
268
+ drawElement.stopDrawing();
269
+ CesiumZondy.AspectAnalysisManager.changeOptions(
270
+ vueKey,
271
+ vueIndex,
272
+ "drawElement",
273
+ null
274
+ );
275
+ }
276
+
277
+ // 恢复光照设置
278
+ this._restoreEnableLighting();
279
+ },
280
+ /***
281
+ * 恢复光照设置
282
+ */
283
+ _restoreEnableLighting() {
284
+ // 恢复光照开启状态设置
285
+ if (
286
+ this.isEnableLighting !== undefined &&
287
+ this.isEnableLighting !== isEnableLighting(this.webGlobe)
288
+ ) {
289
+ setEnableLighting(this.isEnableLighting, this.webGlobe);
290
+ }
291
+ const stages = this.webGlobe.viewer.scene.postProcessStages;
292
+ if (this.noBrightness) {
293
+ // 如果开始没有brightness对象,恢复
294
+ stages.remove(this.webGlobe.viewer.scene.brightness);
295
+ this.webGlobe.viewer.scene.brightness = undefined;
296
+ } else {
297
+ // 恢复brightness参数设置
298
+ if (this.brightnessStatusAndUniformsBrightness !== undefined) {
299
+ const brightnessStatusAndUniformsBrightness = getBrightnessStatusAndUniformsBrightness(
300
+ this.webGlobe
301
+ );
302
+ if (
303
+ this.brightnessStatusAndUniformsBrightness.enabled !==
304
+ brightnessStatusAndUniformsBrightness.enabled ||
305
+ this.brightnessStatusAndUniformsBrightness.brightness !==
306
+ brightnessStatusAndUniformsBrightness.brightness
307
+ ) {
308
+ setBrightnessStatusAndUniformsBrightness(
309
+ this.brightnessStatusAndUniformsBrightness,
310
+ this.webGlobe
311
+ );
312
+ }
313
+ }
314
+ }
315
+ }
316
+ }
317
+ };
318
+ </script>
@@ -0,0 +1,257 @@
1
+ <template>
2
+ <div>
3
+ <slot>
4
+ <div class="mapgis-widget-contour-analysis">
5
+ <mapgis-ui-group-tab title="参数设置" />
6
+ <mapgis-ui-setting-form>
7
+ <mapgis-ui-form-item label="等值距">
8
+ <mapgis-ui-input
9
+ v-model.number="contourSpacingCopy"
10
+ type="number"
11
+ min="0"
12
+ addon-after="(米)"
13
+ />
14
+ </mapgis-ui-form-item>
15
+ <mapgis-ui-form-item label="线宽">
16
+ <mapgis-ui-input
17
+ v-model.number="contourWidthCopy"
18
+ type="number"
19
+ min="0"
20
+ />
21
+ </mapgis-ui-form-item>
22
+ <mapgis-ui-form-item label="线颜色">
23
+ <mapgis-ui-sketch-color-picker
24
+ :color.sync="contourColorCopy"
25
+ :disableAlpha="true"
26
+ ></mapgis-ui-sketch-color-picker>
27
+ </mapgis-ui-form-item>
28
+ </mapgis-ui-setting-form>
29
+ <mapgis-ui-setting-footer>
30
+ <mapgis-ui-button type="primary" @click="analysis"
31
+ >分析</mapgis-ui-button
32
+ >
33
+ <mapgis-ui-button @click="remove">清除</mapgis-ui-button>
34
+ </mapgis-ui-setting-footer>
35
+ </div>
36
+ </slot>
37
+ </div>
38
+ </template>
39
+
40
+ <script>
41
+ import VueOptions from "../Base/Vue/VueOptions";
42
+ import { colorToCesiumColor } from "../WebGlobe/util";
43
+
44
+ export default {
45
+ name: "mapgis-3d-analysis-contour",
46
+ inject: ["Cesium", "CesiumZondy", "webGlobe"],
47
+ props: {
48
+ ...VueOptions,
49
+ /**
50
+ * @type Number
51
+ * @default 150
52
+ * @description 等高线间距
53
+ */
54
+ contourSpacing: {
55
+ type: Number,
56
+ default: 150
57
+ },
58
+ /**
59
+ * @type Number
60
+ * @default 2
61
+ * @description 等高线宽度
62
+ */
63
+ contourWidth: {
64
+ type: Number,
65
+ default: 2
66
+ },
67
+ /**
68
+ * @type String
69
+ * @default "rgb(255,0,0)"
70
+ * @description 等高线颜色
71
+ */
72
+ contourColor: {
73
+ type: String,
74
+ default: "rgb(255,0,0)"
75
+ }
76
+ },
77
+ watch: {
78
+ contourSpacing: {
79
+ handler() {
80
+ this.contourSpacingCopy = this.contourSpacing;
81
+ },
82
+ immediate: true
83
+ },
84
+ contourWidth: {
85
+ handler() {
86
+ this.contourWidthCopy = this.contourWidth;
87
+ },
88
+ immediate: true
89
+ },
90
+ contourColor: {
91
+ handler() {
92
+ this.contourColorCopy = this.contourColor;
93
+ },
94
+ immediate: true
95
+ }
96
+ },
97
+ data() {
98
+ return {
99
+ contourSpacingCopy: 150,
100
+ contourWidthCopy: 2,
101
+ contourColorCopy: "rgb(255,0,0)"
102
+ };
103
+ },
104
+
105
+ created() {},
106
+ mounted() {
107
+ this.mount();
108
+ },
109
+ destroyed() {
110
+ this.unmount();
111
+ },
112
+ methods: {
113
+ async createCesiumObject() {
114
+ return new Promise(
115
+ resolve => {
116
+ resolve();
117
+ },
118
+ reject => {}
119
+ );
120
+ },
121
+ mount() {
122
+ const { webGlobe, CesiumZondy, vueKey, vueIndex } = this;
123
+ const { viewer } = webGlobe;
124
+ const vm = this;
125
+ let promise = this.createCesiumObject();
126
+ promise.then(function(dataSource) {
127
+ vm.$emit("load", vm);
128
+ CesiumZondy.ContourAnalysisManager.addSource(
129
+ vueKey,
130
+ vueIndex,
131
+ dataSource,
132
+ {
133
+ drawElement: null,
134
+ contourAnalysis: null
135
+ }
136
+ );
137
+ });
138
+ },
139
+ unmount() {
140
+ let { CesiumZondy, vueKey, vueIndex } = this;
141
+ let find = CesiumZondy.ContourAnalysisManager.findSource(
142
+ vueKey,
143
+ vueIndex
144
+ );
145
+ if (find) {
146
+ this.remove();
147
+ }
148
+ CesiumZondy.ContourAnalysisManager.deleteSource(vueKey, vueIndex);
149
+ this.$emit("unload", this);
150
+ },
151
+ /**
152
+ * @description rgba值转cesium内部color对象
153
+ * @return {Object} cesium内部color对象
154
+ */
155
+ _edgeColor() {
156
+ return colorToCesiumColor(this.contourColorCopy, this.webGlobe);
157
+ },
158
+ /**
159
+ * @description 开始绘制并分析
160
+ */
161
+ analysis() {
162
+ let { CesiumZondy, vueKey, vueIndex, Cesium } = this;
163
+ let find = CesiumZondy.ContourAnalysisManager.findSource(
164
+ vueKey,
165
+ vueIndex
166
+ );
167
+ let { options } = find;
168
+ let { contourAnalysis, drawElement } = options;
169
+ const { viewer } = this.webGlobe;
170
+ // 初始化交互式绘制控件
171
+ drawElement = drawElement || new Cesium.DrawElement(viewer);
172
+ CesiumZondy.ContourAnalysisManager.changeOptions(
173
+ vueKey,
174
+ vueIndex,
175
+ "drawElement",
176
+ drawElement
177
+ );
178
+ const { contourWidthCopy, contourSpacingCopy } = this;
179
+ const color = this._edgeColor();
180
+
181
+ // 激活交互式绘制工具
182
+ drawElement.startDrawingPolygon({
183
+ // 绘制完成回调函数
184
+ callback: positions => {
185
+ this.remove();
186
+ contourAnalysis =
187
+ contourAnalysis || new Cesium.TerrainAnalyse(viewer, {});
188
+ contourAnalysis.enableContour(true);
189
+ contourAnalysis.updateMaterial("none");
190
+ contourAnalysis.changeContourWidth(contourWidthCopy);
191
+ contourAnalysis.changeContourSpacing(contourSpacingCopy);
192
+ contourAnalysis.changeContourColor(color);
193
+ contourAnalysis.changeAnalyseArea(positions);
194
+ CesiumZondy.ContourAnalysisManager.changeOptions(
195
+ vueKey,
196
+ vueIndex,
197
+ "contourAnalysis",
198
+ contourAnalysis
199
+ );
200
+ }
201
+ });
202
+ },
203
+ /**
204
+ * @description 移除等值线分析结果,取消交互式绘制事件激活状态
205
+ */
206
+ remove() {
207
+ let { CesiumZondy, vueKey, vueIndex } = this;
208
+ let find = CesiumZondy.ContourAnalysisManager.findSource(
209
+ vueKey,
210
+ vueIndex
211
+ );
212
+ let { options } = find;
213
+ let { contourAnalysis, drawElement } = options;
214
+
215
+ // 判断是否已有等值线分析结果
216
+ if (contourAnalysis) {
217
+ // 移除等值线分析显示结果
218
+ contourAnalysis.enableContour(false);
219
+ contourAnalysis.updateMaterial("none");
220
+ CesiumZondy.ContourAnalysisManager.changeOptions(
221
+ vueKey,
222
+ vueIndex,
223
+ "contourAnalysis",
224
+ null
225
+ );
226
+ }
227
+
228
+ if (drawElement) {
229
+ // 取消交互式绘制矩形事件激活状态
230
+ drawElement.stopDrawing();
231
+ CesiumZondy.ContourAnalysisManager.changeOptions(
232
+ vueKey,
233
+ vueIndex,
234
+ "drawElement",
235
+ null
236
+ );
237
+ }
238
+ }
239
+ }
240
+ };
241
+ </script>
242
+ <style scoped>
243
+ ::v-deep .mapgis-ui-form-item {
244
+ margin-bottom: 0;
245
+ }
246
+ ::v-deep .mapgis-ui-form label {
247
+ font-size: 12px;
248
+ }
249
+
250
+ ::v-deep .mapgis-ui-form-item-label {
251
+ line-height: 40px;
252
+ }
253
+
254
+ ::v-deep .mapgis-ui-input {
255
+ padding: 4px 11px;
256
+ }
257
+ </style>