@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,579 +1,487 @@
1
1
  <template>
2
2
  <div>
3
3
  <slot>
4
- <div class="flood-analyse-box" v-show="showOptionsPannel">
5
- <mapgis-ui-row>
6
- <mapgis-ui-col :span="8">
7
- <p class="flood-title">最大淹没高度(米):</p>
8
- </mapgis-ui-col>
9
- <mapgis-ui-col :span="16">
10
- <mapgis-ui-input v-model="maxHeightCopy"/>
11
- </mapgis-ui-col>
12
- </mapgis-ui-row>
13
- <mapgis-ui-row>
14
- <mapgis-ui-col :span="8">
15
- <p class="flood-title">最小淹没高度(米):</p>
16
- </mapgis-ui-col>
17
- <mapgis-ui-col :span="16">
18
- <mapgis-ui-input v-model="startHeightCopy"/>
19
- </mapgis-ui-col>
20
- </mapgis-ui-row>
21
- <mapgis-ui-row>
22
- <mapgis-ui-col :span="8">
23
- <p class="flood-title">颜色:</p>
24
- </mapgis-ui-col>
25
- <mapgis-ui-col :span="12">
26
- <mapgis-ui-input class="flood-input" v-model="floodColorCopy"/>
27
- </mapgis-ui-col>
28
- <div v-if="showPicker" class="flood-color-picker">
29
- <colorPicker v-model="floodColorCopy" v-on:change="headleChangeColor"/>
30
- </div>
31
- </mapgis-ui-row>
32
- <mapgis-ui-row>
33
- <mapgis-ui-col :span="8">
34
- <p class="flood-title">洪水淹没速度:</p>
35
- </mapgis-ui-col>
36
- <mapgis-ui-col :span="12">
37
- <mapgis-ui-input class="flood-input" v-model="floodSpeedCopy"/>
38
- </mapgis-ui-col>
39
- </mapgis-ui-row>
40
- <mapgis-ui-row>
41
- <mapgis-ui-col :span="8">
42
- <p class="flood-title">反射光强度:</p>
43
- </mapgis-ui-col>
44
- <mapgis-ui-col :span="12">
45
- <mapgis-ui-input class="flood-input" v-model="specularIntensityCopy"/>
46
- </mapgis-ui-col>
47
- </mapgis-ui-row>
48
- <mapgis-ui-row>
49
- <mapgis-ui-col :span="8">
50
- <p class="flood-title">水波高度:</p>
51
- </mapgis-ui-col>
52
- <mapgis-ui-col :span="12">
53
- <mapgis-ui-input class="flood-input" v-model="amplitudeCopy"/>
54
- </mapgis-ui-col>
55
- </mapgis-ui-row>
56
- <mapgis-ui-row>
57
- <mapgis-ui-col :span="8">
58
- <p class="flood-title">水纹速度:</p>
59
- </mapgis-ui-col>
60
- <mapgis-ui-col :span="12">
61
- <mapgis-ui-input class="flood-input" v-model="animationSpeedCopy"/>
62
- </mapgis-ui-col>
63
- </mapgis-ui-row>
64
- <mapgis-ui-row>
65
- <mapgis-ui-col :span="8">
66
- <p class="flood-title">水纹频率:</p>
67
- </mapgis-ui-col>
68
- <mapgis-ui-col :span="12">
69
- <mapgis-ui-input class="flood-input" v-model="frequencyCopy"/>
70
- </mapgis-ui-col>
71
- </mapgis-ui-row>
72
- <!-- <mapgis-ui-row>-->
73
- <!-- <mapgis-ui-col :span="8">-->
74
- <!-- <p class="flood-title">绘制工具:</p>-->
75
- <!-- </mapgis-ui-col>-->
76
- <!-- <mapgis-ui-col :span="8">-->
77
- <!-- <mapgis-ui-select-->
78
- <!-- class="flood-select"-->
79
- <!-- :default-value="selectDefault"-->
80
- <!-- @change="$_selectChange"-->
81
- <!-- >-->
82
- <!-- <mapgis-ui-select-option v-for="(tool,index) in tools" :key="tool.name">{{ tool.value }}</mapgis-ui-select-option>-->
83
- <!-- </mapgis-ui-select>-->
84
- <!-- </mapgis-ui-col>-->
85
- <!-- </mapgis-ui-row>-->
86
- <mapgis-ui-row>
87
- <mapgis-ui-button class="flood-button start" type="primary" @click="$_startAnalyse" :disabled="!disabled">开始分析
88
- </mapgis-ui-button>
89
- </mapgis-ui-row>
90
- </div>
91
- <div class="flood-analyse-box" style="height: 127px;" v-show="showResultPannel">
92
- <mapgis-ui-row>
93
- <mapgis-ui-col :span="8">
94
- <p class="flood-title">最大淹没高度(米):</p>
95
- </mapgis-ui-col>
96
- <mapgis-ui-col :span="16">
97
- <mapgis-ui-input v-model="maxHeightCopy"/>
98
- </mapgis-ui-col>
99
- </mapgis-ui-row>
100
- <mapgis-ui-row>
101
- <mapgis-ui-col :span="8">
102
- <p class="flood-title">高度选择(米):</p>
103
- </mapgis-ui-col>
104
- <mapgis-ui-col :span="16">
105
- <mapgis-ui-slider v-model="currentHeightCopy" :min="Number(startHeightCopyTwo)" :max="Number(maxHeightCopy)"
106
- :disabled="disabled"/>
107
- </mapgis-ui-col>
108
- </mapgis-ui-row>
109
- <mapgis-ui-row>
110
- <mapgis-ui-button class="flood-button back" style="right: 168px;" type="primary" @click="$_up" :disabled="upDisabled">{{upTitle}}</mapgis-ui-button>
111
- <mapgis-ui-button class="flood-button back" style="right: 95px;" type="primary" @click="$_down" :disabled="downDisabled">{{downTitle}}</mapgis-ui-button>
112
- <mapgis-ui-button class="flood-button back" @click="$_stopAnalyseToStart">停止分析</mapgis-ui-button>
113
- </mapgis-ui-row>
4
+ <div class="mapgis-widget-flood-analysis">
5
+ <mapgis-ui-group-tab title="参数设置">
6
+ <mapgis-ui-toolbar slot="handle" :bordered="false">
7
+ <mapgis-ui-toolbar-command
8
+ icon="mapgis-redo"
9
+ title="重新计算"
10
+ @click="refresh"
11
+ :disabled="!recalculate"
12
+ ></mapgis-ui-toolbar-command>
13
+ </mapgis-ui-toolbar>
14
+ </mapgis-ui-group-tab>
15
+ <mapgis-ui-setting-form>
16
+ <mapgis-ui-form-item label="淹没最低高度">
17
+ <mapgis-ui-input
18
+ v-model.number="startHeightCopy"
19
+ type="number"
20
+ :max="maxHeightCopy"
21
+ addon-after="(米)"
22
+ />
23
+ </mapgis-ui-form-item>
24
+ <mapgis-ui-form-item label="淹没最高高度">
25
+ <mapgis-ui-input
26
+ v-model.number="maxHeightCopy"
27
+ type="number"
28
+ :min="startHeightCopy"
29
+ addon-after="(米)"
30
+ />
31
+ </mapgis-ui-form-item>
32
+ <mapgis-ui-form-item label="洪水上涨速度">
33
+ <mapgis-ui-input
34
+ v-model.number="floodSpeedCopy"
35
+ type="number"
36
+ min="0"
37
+ addon-after="(米/秒)"
38
+ />
39
+ </mapgis-ui-form-item>
40
+ <mapgis-ui-form-item label="颜色">
41
+ <mapgis-ui-sketch-color-picker
42
+ :color.sync="floodColorCopy"
43
+ :disableAlpha="false"
44
+ ></mapgis-ui-sketch-color-picker>
45
+ </mapgis-ui-form-item>
46
+ </mapgis-ui-setting-form>
47
+ <mapgis-ui-setting-footer>
48
+ <mapgis-ui-button type="primary" @click="analysis"
49
+ >分析</mapgis-ui-button
50
+ >
51
+ <mapgis-ui-button @click="remove">清除</mapgis-ui-button>
52
+ </mapgis-ui-setting-footer>
114
53
  </div>
115
54
  </slot>
116
55
  </div>
117
56
  </template>
118
57
 
119
58
  <script>
120
- import ServiceLayer from "./BaseLayer";
59
+ import VueOptions from "../Base/Vue/VueOptions";
60
+ import {
61
+ colorToCesiumColor,
62
+ isDepthTestAgainstTerrainEnable,
63
+ setDepthTestAgainstTerrainEnable
64
+ } from "../WebGlobe/util";
121
65
 
122
66
  export default {
123
- name: "mapgis-3d-flood",
124
- mixins: [ServiceLayer],
67
+ name: "mapgis-3d-analysis-flood",
68
+ inject: ["Cesium", "CesiumZondy", "webGlobe"],
125
69
  props: {
70
+ ...VueOptions,
71
+ /**
72
+ * @type Number
73
+ * @default 0
74
+ * @description 洪水淹没水体起始高度
75
+ */
126
76
  startHeight: {
127
77
  type: Number,
128
78
  default: 0
129
79
  },
80
+ /**
81
+ * @type Number
82
+ * @default 0
83
+ * @description 淹没动画高度起始点
84
+ */
130
85
  minHeight: {
131
86
  type: Number,
132
87
  default: 0
133
88
  },
134
- currentHeight: {
135
- type: Number,
136
- default: 0
137
- },
89
+ /**
90
+ * @type Number
91
+ * @default 2000
92
+ * @description 最大淹没高度,淹没动画高度终止点
93
+ */
138
94
  maxHeight: {
139
95
  type: Number,
140
- default: 200
96
+ default: 2000
141
97
  },
98
+ /**
99
+ * @type String
100
+ * @default "rgba(149,232,249,0.5)"
101
+ * @description 洪水颜色
102
+ */
142
103
  floodColor: {
143
104
  type: String,
144
- default: "#4e81bb"
105
+ default: "rgba(149,232,249,0.5)"
145
106
  },
107
+ /**
108
+ * @type Number
109
+ * @default 500
110
+ * @description 洪水淹没速度,单位 米/秒
111
+ */
146
112
  floodSpeed: {
147
113
  type: Number,
148
- default: 30
114
+ default: 500
149
115
  },
116
+ /**
117
+ * @type Number
118
+ * @default 2
119
+ * @description 反射光线强度
120
+ */
150
121
  specularIntensity: {
151
122
  type: Number,
152
- default: 1
123
+ default: 2
153
124
  },
125
+ /**
126
+ * @type Number
127
+ * @default 10
128
+ * @description 水波高度
129
+ */
154
130
  amplitude: {
155
131
  type: Number,
156
132
  default: 10
157
133
  },
134
+ /**
135
+ * @type Number
136
+ * @default 0.01
137
+ * @description 水纹速度
138
+ */
158
139
  animationSpeed: {
159
140
  type: Number,
160
141
  default: 0.01
161
142
  },
143
+ /**
144
+ * @type Number
145
+ * @default 500
146
+ * @description 水纹频率
147
+ */
162
148
  frequency: {
163
149
  type: Number,
164
- default: 1000
165
- },
166
- showPicker: {
167
- type: Boolean,
168
- default: true
150
+ default: 500
151
+ }
152
+ },
153
+ data() {
154
+ return {
155
+ startHeightCopy: 0, //洪水淹没水体起始高度
156
+ maxHeightCopy: 2000,
157
+ floodColorCopy: "rgba(149,232,249,0.5)",
158
+ floodSpeedCopy: 500,
159
+ positions: null,
160
+ recalculate: false,
161
+ isDepthTestAgainstTerrainEnable: undefined, // 深度检测是否已开启,默认为undefined,当这个值为undefined的时候,说明没有赋值,不做任何处理
162
+ mHeight: 2000, // 淹没最高高度变化前的值
163
+ timer: null
164
+ };
165
+ },
166
+ created() {},
167
+ mounted() {
168
+ this.mount();
169
+ },
170
+ destroyed() {
171
+ this.unmount();
172
+ },
173
+ computed: {
174
+ params() {
175
+ const { startHeightCopy, speedCopy, floodColorCopy } = this;
176
+ return { startHeightCopy, speedCopy, floodColorCopy };
169
177
  }
170
178
  },
171
179
  watch: {
172
- currentHeightCopy: {
173
- handler: function () {
174
- //开始分析后的下一帧,开启高度监听
175
- if (this.isFlood) {
176
- const {vueKey, vueIndex} = this;
177
- let webGlobe = window.CesiumZondy.getWebGlobe(vueKey);
178
- let floodAnalyse = window.floodAnalyse;
179
- if (floodAnalyse) {
180
- floodAnalyse.maxHeight = Number(this.currentHeightCopy);
181
- floodAnalyse.floodSpeed = Number(this.floodSpeedCopy);
182
- floodAnalyse.frequency = Number(this.frequencyCopy);
183
- floodAnalyse.animationSpeed = Number(this.animationSpeedCopy);
184
- floodAnalyse.amplitude = Number(this.amplitudeCopy);
185
- floodAnalyse.specularIntensity = Number(this.specularIntensityCopy);
186
- floodAnalyse.isDownFlood = Number(this.floodHeightCopyTwo) > Number(this.currentHeightCopy);
187
- //存储高度,方便下一次比较
188
- this.floodHeightCopyTwo = Number(this.currentHeightCopy);
189
- }
190
- if(this.currentHeightCopy === this.maxHeightCopy){
191
- this.upTitle = "上升";
192
- this.upDisabled = true;
193
- this.downDisabled = false;
194
- }else if(this.currentHeightCopy === parseInt(this.startHeightCopyTwo)){
195
- this.downTitle = "下降";
196
- this.upDisabled = false;
197
- this.downDisabled = true;
198
- }
180
+ params: {
181
+ handler: function(e) {
182
+ if (this.positions) {
183
+ this.recalculate = true;
199
184
  }
200
- }
185
+ },
186
+ deep: true,
187
+ immediate: true
201
188
  },
202
189
  startHeight: {
203
- handler: function () {
190
+ handler() {
204
191
  this.startHeightCopy = this.startHeight;
205
- }
192
+ },
193
+ immediate: true
206
194
  },
207
- minHeight: {
208
- handler: function () {
209
- this.minHeightCopy = this.minHeight;
210
- }
195
+ maxHeight: {
196
+ handler() {
197
+ this.maxHeightCopy = this.maxHeight;
198
+ },
199
+ immediate: true
211
200
  },
212
201
  floodColor: {
213
- handler: function () {
202
+ handler() {
214
203
  this.floodColorCopy = this.floodColor;
215
- }
216
- },
217
- maxHeight: {
218
- handler: function () {
219
- this.maxHeightCopy = this.maxHeight;
220
- }
204
+ },
205
+ immediate: true
221
206
  },
222
207
  floodSpeed: {
223
- handler: function () {
208
+ handler() {
224
209
  this.floodSpeedCopy = this.floodSpeed;
225
- }
226
- },
227
- specularIntensity: {
228
- handler: function () {
229
- this.specularIntensityCopy = this.specularIntensity;
230
- }
231
- },
232
- amplitude: {
233
- handler: function () {
234
- this.amplitudeCopy = this.amplitude;
235
- }
236
- },
237
- animationSpeed: {
238
- handler: function () {
239
- this.animationSpeedCopy = this.animationSpeed;
240
- }
241
- },
242
- frequency: {
243
- handler: function () {
244
- this.frequencyCopy = this.frequency;
245
- }
246
- },
247
- currentHeight: {
248
- handler: function () {
249
- this.currentHeightCopy = parseInt(Number(this.currentHeight));
250
- }
210
+ },
211
+ immediate: true
251
212
  },
252
213
  maxHeightCopy: {
253
- handler: function () {
254
- if(Number(this.maxHeightCopy) <= Number(this.currentHeightCopy)){
255
- this.maxHeightCopy = Number(this.currentHeightCopy);
256
- this.upDisabled = true;
214
+ handler: function(e) {
215
+ const { webGlobe, CesiumZondy, vueKey, vueIndex } = this;
216
+ const options = this._getSourceOptions();
217
+ const { floodAnalysis } = options;
218
+ if (!floodAnalysis) {
219
+ return;
220
+ }
221
+ if (!this.timer) {
222
+ this.timer = setTimeout(() => {
223
+ if (this.timer) clearTimeout(this.timer);
224
+ this.timer = null;
225
+ const { maxHeightCopy } = this;
226
+ floodAnalysis.maxHeight = maxHeightCopy;
227
+ if (this.mHeight > maxHeightCopy) {
228
+ // 下降
229
+ floodAnalysis.isDownFlood = true;
230
+ } else if (this.mHeight < maxHeightCopy) {
231
+ // 上升
232
+ floodAnalysis.isDownFlood = false;
233
+ }
234
+ this.mHeight = maxHeightCopy;
235
+ webGlobe.scene.requestRender();
236
+ }, 1000);
257
237
  }
258
238
  }
259
239
  }
260
240
  },
261
- data() {
262
- return {
263
- selectDefault: 'startDrawingPolygon',
264
- drawToolName: "startDrawingPolygon",
265
- // tools: [{
266
- // name: "startDrawingPolygon",
267
- // value: "多边形工具"
268
- // }, {
269
- // name: "startDrawingExtent",
270
- // value: "矩形工具"
271
- // }],
272
- showOptionsPannel: false,
273
- showResultPannel: false,
274
- startHeightCopy: 0,
275
- minHeightCopy: 0,
276
- startHeightCopyTwo: 0,
277
- currentHeightCopy: 0,
278
- currentHeightCopyTwo: 0,
279
- maxHeightCopy: 0,
280
- floodColorCopy: "#4e81bb",
281
- floodSpeedCopy: 0,
282
- specularIntensityCopy: 0,
283
- amplitudeCopy: 0,
284
- animationSpeedCopy: 0,
285
- frequencyCopy: 0,
286
- disabled: true,
287
- isFlood: false,
288
- isPlayer: false,
289
- upTitle: "上升",
290
- downTitle: "下降",
291
- upDisabled: false,
292
- downDisabled: false,
293
- }
294
- },
295
- mounted() {
296
- let vm = this;
297
- window.CesiumZondy.getWebGlobeByInterval(function (webGlobe) {
298
- vm.$_init();
299
- vm.showOptionsPannel = true;
300
- vm.$emit("load", vm, webGlobe);
301
- }, this.vueKey)
302
- },
303
241
  methods: {
304
- //对外的开始分析方法
305
- startAnalyse() {
306
- this.$_startAnalyse();
242
+ async createCesiumObject() {
243
+ return new Promise(
244
+ resolve => {
245
+ resolve();
246
+ },
247
+ reject => {}
248
+ );
249
+ },
250
+ mount() {
251
+ const { webGlobe, CesiumZondy, vueKey, vueIndex } = this;
252
+ const { viewer } = webGlobe;
253
+ const vm = this;
254
+ let promise = this.createCesiumObject();
255
+ promise.then(function(dataSource) {
256
+ vm.$emit("load", vm);
257
+ CesiumZondy.FloodAnalysisManager.addSource(
258
+ vueKey,
259
+ vueIndex,
260
+ dataSource,
261
+ {
262
+ drawElement: null,
263
+ floodAnalysis: null
264
+ }
265
+ );
266
+ });
307
267
  },
308
- //对外的停止分析方法
309
- stopAnalyse() {
310
- this.$_stopAnalyse();
268
+ unmount() {
269
+ let { CesiumZondy, vueKey, vueIndex } = this;
270
+ let find = CesiumZondy.FloodAnalysisManager.findSource(vueKey, vueIndex);
271
+ if (find) {
272
+ this.remove();
273
+ }
274
+ CesiumZondy.FloodAnalysisManager.deleteSource(vueKey, vueIndex);
275
+ this.$emit("unload", this);
311
276
  },
312
- //颜色拾取事件
313
- headleChangeColor(color) {
314
- this.floodColorCopy = color;
277
+ /**
278
+ * @description rgba值转cesium内部color对象
279
+ * @param rgba - {String} rgba值
280
+ * @return {Object} cesium内部color对象
281
+ */
282
+ _getColor(rgba) {
283
+ return colorToCesiumColor(rgba, this.webGlobe);
315
284
  },
316
- //由于无法改变props,因此复制这些值
317
- $_init() {
318
- let vm = this;
319
- Object.keys(this.$props).forEach(function (key) {
320
- vm[key + "Copy"] = vm.$props[key];
285
+ /**
286
+ * @description 开始绘制并分析
287
+ */
288
+ analysis() {
289
+ const { CesiumZondy, vueKey, vueIndex } = this;
290
+ const options = this._getSourceOptions();
291
+ let { drawElement } = options;
292
+ const { viewer } = this.webGlobe;
293
+ // 初始化交互式绘制控件
294
+ drawElement = drawElement || new Cesium.DrawElement(viewer);
295
+ CesiumZondy.FloodAnalysisManager.changeOptions(
296
+ vueKey,
297
+ vueIndex,
298
+ "drawElement",
299
+ drawElement
300
+ );
301
+
302
+ // 激活交互式绘制工具
303
+ drawElement.startDrawingPolygon({
304
+ // 绘制完成回调函数
305
+ callback: positions => {
306
+ this.remove();
307
+ this.positions = positions;
308
+ this._doAnalysis();
309
+ }
321
310
  });
322
311
  },
323
- // $_selectChange(value) {
324
- // this.drawToolName = value;
325
- // },
326
- //开始洪水淹没分析
327
- $_floodAnalyse(webGlobe, positions) {
328
- //确保开始洪水分析后,不会触发currentHeightCopy的更新操作,不然会出现分析失灵的情况
329
- this.isFlood = false;
330
- //如果没有注入Cesium,则取得window上面的
331
- let {Cesium, vueKey, vueIndex} = this;
332
- let vm = this;
333
- if (!Cesium) {
334
- Cesium = window.Cesium;
335
- }
336
- //开始分析前,删除上一次分析
337
- if (webGlobe.scene.VisualAnalysisManager._visualAnalysisList.length > 0) {
338
- webGlobe.scene.VisualAnalysisManager.removeAll();
339
- window.CesiumZondy.FloodAnalyseManager.deleteSource(vueKey, vueIndex);
312
+ /**
313
+ * @description 进行洪水淹没分析
314
+ */
315
+ _doAnalysis() {
316
+ const { positions } = this;
317
+ if (!positions) {
318
+ this.$message.warning("请绘制分析区域");
319
+ return;
340
320
  }
341
- //将笛卡尔坐标转为经纬度坐标
342
- let cartographics = [], height = 0;
343
- for (let i = 0; i < positions.length; i++) {
344
- cartographics.push(Cesium.Cartographic.fromCartesian(positions[i]));
345
- let cat = Cesium.Cartographic.fromCartesian(positions[i]);
346
- height += cat.height;
347
- if (Number(this.startHeightCopy) === 0) {
348
- if (i === 0) {
349
- this.startHeightCopyTwo = cat.height;
350
- } else {
351
- if (cat.height < this.startHeightCopyTwo) {
352
- this.startHeightCopyTwo = cat.height;
353
- }
354
- }
355
- } else {
356
- this.startHeightCopyTwo = this.startHeightCopy;
321
+ const { CesiumZondy, vueKey, vueIndex } = this;
322
+ const options = this._getSourceOptions();
323
+ let { floodAnalysis } = options;
324
+ const { viewer } = this.webGlobe;
325
+ const {
326
+ startHeightCopy,
327
+ minHeight,
328
+ maxHeightCopy,
329
+ floodColorCopy,
330
+ floodSpeedCopy,
331
+ specularIntensity,
332
+ amplitude,
333
+ animationSpeed,
334
+ frequency
335
+ } = this;
336
+ // 初始化高级分析功能管理类
337
+ const advancedAnalysisManager = new this.CesiumZondy.Manager.AdvancedAnalysisManager(
338
+ {
339
+ viewer: viewer
357
340
  }
341
+ );
342
+ // 初始化洪水淹没分析类
343
+ floodAnalysis =
344
+ floodAnalysis ||
345
+ advancedAnalysisManager.createFlood(positions, {
346
+ // 设置洪水淹没区域动画最低高度
347
+ minHeight: Number(minHeight), // 设置洪水淹没区域动画最低高度
348
+ // 设置洪水淹没区域最高高度
349
+ maxHeight: Number(maxHeightCopy),
350
+ // 设置洪水上涨速度
351
+ floodSpeed: Number(floodSpeedCopy)
352
+ });
353
+
354
+ // 洪水淹没区域最低高度
355
+ floodAnalysis.startHeight = Number(startHeightCopy);
356
+ // 洪水颜色
357
+ floodAnalysis.floodColor = this._getColor(floodColorCopy);
358
+ // 水纹频率 指波浪的个数
359
+ floodAnalysis.frequency = Number(frequency);
360
+ // 水纹速度
361
+ floodAnalysis.animationSpeed = Number(animationSpeed);
362
+ // 水波的高度
363
+ floodAnalysis.amplitude = Number(amplitude);
364
+ // 指定光线强度
365
+ floodAnalysis.specularIntensity = Number(specularIntensity);
366
+
367
+ this.isDepthTestAgainstTerrainEnable = isDepthTestAgainstTerrainEnable(
368
+ this.webGlobe
369
+ );
370
+ if (!this.isDepthTestAgainstTerrainEnable) {
371
+ // 如果深度检测没有开启,则开启
372
+ setDepthTestAgainstTerrainEnable(true, this.webGlobe);
358
373
  }
359
- //极端洪水淹没平均高度
360
- this.currentHeightCopy = parseInt(height / cartographics.length);
361
- this.currentHeightCopyTwo = this.currentHeightCopy;
362
- //初始化新的洪水淹没分析
363
- let floodAnalyse = new Cesium.FloodAnalysis(webGlobe.viewer, positions, {
364
- //设置洪水淹没水体起始高度
365
- startHeight: Number(this.startHeightCopyTwo),
366
- //设置洪水淹没区域动画最低高度
367
- minHeight: Number(this.minHeightCopy),
368
- //设置洪水淹没区域最高高度
369
- maxHeight: Number(this.currentHeightCopy),
370
- //设置洪水上涨速度
371
- floodSpeed: Number(this.floodSpeedCopy),
372
- floodColor: Cesium.Color.fromCssColorString(this.floodColorCopy),
373
- //水纹频率 指波浪的个数
374
- frequency: Number(this.frequencyCopy),
375
- //水纹速度
376
- animationSpeed: Number(this.animationSpeedCopy),
377
- //水波的高度
378
- amplitude: Number(this.amplitudeCopy),
379
- // 指定光线强度
380
- specularIntensity: Number(this.specularIntensityCopy),
381
- });
382
- window.floodAnalyse = floodAnalyse;
383
- //设置深度检测
384
- webGlobe.viewer.scene.globe.depthTestAgainstTerrain = true;
385
- //添加洪水淹没结果显示
386
- webGlobe.scene.VisualAnalysisManager.add(floodAnalyse);
387
- //一定是在下一帧,开启对currentHeightCopy的监听操作
388
- this.$nextTick(function () {
389
- this.showResultPannel = true;
390
- this.showOptionsPannel = false;
391
- //停止绘制
392
- window.drawElement.stopDrawing();
393
- this.isFlood = true;
394
- })
374
+ // 添加洪水淹没结果显示
375
+ this.webGlobe.scene.VisualAnalysisManager.add(floodAnalysis);
376
+ this.mHeight = maxHeightCopy;
377
+ CesiumZondy.FloodAnalysisManager.changeOptions(
378
+ vueKey,
379
+ vueIndex,
380
+ "floodAnalysis",
381
+ floodAnalysis
382
+ );
395
383
  },
396
- //开始洪水淹没分析
397
- $_startAnalyse() {
398
- //开始分析前先禁用进度条以及停止分析按钮
399
- this.disabled = false;
400
- this.$_initAnalysis(this.drawToolName, "$_floodAnalyse");
384
+ /**
385
+ * @description 获取SourceOptions,以方便获取洪水淹没分析对象和绘制对象
386
+ * @return SourceOptions对象
387
+ */
388
+ _getSourceOptions() {
389
+ const { CesiumZondy, vueKey, vueIndex } = this;
390
+ const find = CesiumZondy.FloodAnalysisManager.findSource(
391
+ vueKey,
392
+ vueIndex
393
+ );
394
+ const { options } = find;
395
+ return options;
401
396
  },
402
- $_stopAnalyseToStart() {
403
- this.$_stopAnalyse();
404
- this.showResultPannel = false;
405
- this.showOptionsPannel = true;
406
- this.startHeightCopyTwo = 0;
407
- this.isPlayer = true;
408
- this.$nextTick(function () {
409
- this.downDisabled = false;
410
- });
397
+ /**
398
+ * @description 重新进行洪水淹没分析
399
+ */
400
+ refresh() {
401
+ this._removeFlood();
402
+ this._doAnalysis();
411
403
  },
412
- $_up(){
413
- switch (this.upTitle){
414
- case "上升":
415
- this.$_playAnalyse(this.currentHeightCopy,this.maxHeightCopy,1);
416
- this.downDisabled = true;
417
- this.upTitle = "暂停";
418
- break;
419
- case "暂停":
420
- this.$_pause();
421
- this.downDisabled = false;
422
- this.upTitle = "上升";
423
- break;
424
- default:
425
- break;
404
+ /**
405
+ * @description 恢复深度检测设置
406
+ */
407
+ _restoreDepthTestAgainstTerrain() {
408
+ if (
409
+ this.isDepthTestAgainstTerrainEnable !== undefined &&
410
+ this.isDepthTestAgainstTerrainEnable !==
411
+ isDepthTestAgainstTerrainEnable(this.webGlobe)
412
+ ) {
413
+ setDepthTestAgainstTerrainEnable(
414
+ this.isDepthTestAgainstTerrainEnable,
415
+ this.webGlobe
416
+ );
426
417
  }
427
418
  },
428
- $_down(){
429
- switch (this.downTitle){
430
- case "下降":
431
- this.$_playAnalyse(this.startHeightCopyTwo,this.currentHeightCopy,-1);
432
- this.upDisabled = true;
433
- this.downTitle = "暂停";
434
- break;
435
- case "暂停":
436
- this.$_pause();
437
- this.upDisabled = false;
438
- this.downTitle = "下降";
439
- break;
440
- default:
441
- break;
419
+ /**
420
+ * @description 移除洪水淹没分析结果
421
+ */
422
+ _removeFlood() {
423
+ const { CesiumZondy, vueKey, vueIndex } = this;
424
+ const options = this._getSourceOptions();
425
+ const { floodAnalysis } = options;
426
+
427
+ // 判断是否已有洪水淹没分析结果
428
+ if (floodAnalysis) {
429
+ // 移除洪水淹没分析显示结果
430
+ this.webGlobe.scene.VisualAnalysisManager.remove(floodAnalysis);
431
+ CesiumZondy.FloodAnalysisManager.changeOptions(
432
+ vueKey,
433
+ vueIndex,
434
+ "floodAnalysis",
435
+ null
436
+ );
442
437
  }
443
- },
444
- $_pause(){
445
- this.isPlayer = false;
446
- },
447
- //对外的playAnalyse
448
- playAnalyse(start,end,forward,rate,timeDiff){
449
- this.$_playAnalyse(start,end,forward,rate,timeDiff);
450
- },
451
- //对外的上升方法
452
- up(){
453
- this.$_playAnalyse(this.currentHeightCopy,this.maxHeightCopy,1);
454
- },
455
- //对外的下降方法
456
- down(){
457
- this.$_playAnalyse(this.startHeightCopyTwo,this.currentHeightCopy,-1);
458
- },
459
- //对外暂停听方法
460
- pause(){
461
- this.$_pause();
438
+ this._restoreDepthTestAgainstTerrain();
462
439
  },
463
440
  /**
464
- * 洪水分析上升或下降方法
465
- * @param start 起始点
466
- * @param end 结束点
467
- * @param start forward 向上为1,向下为-1
468
- * @param rate 上升或下降频率
469
- * @param timeDiff Cesium和现实时间的倍率
470
- * */
471
- $_playAnalyse(start,end,forward,rate,timeDiff){
472
- rate = rate || 20;
473
- timeDiff = timeDiff || 1.5;
474
- let i = 0;
475
- let vm = this;
476
- let distance = end - start;
477
- let speed = this.floodSpeedCopy / rate;
478
- let time = Math.ceil(distance / speed);
479
- speed = distance / time;
480
- let timeOut = parseInt(parseInt(((distance / this.floodSpeedCopy) / time) * 1000));
481
- //因为Cesium的事件计算和现实不一样,这里试出来大概是1.5倍
482
- timeOut = timeOut * timeDiff;
483
- this.isPlayer = true;
484
- let interval = setInterval(function () {
485
- i++;
486
- vm.currentHeightCopy = parseInt(Number((vm.currentHeightCopy + speed * forward).toFixed(4)));
487
- if(!vm.isPlayer){
488
- vm.isPlayer = true;
489
- clearInterval(interval);
490
- }
491
- if(i === time){
492
- vm.currentHeightCopy = parseInt(forward > 0 ? Number(end) : Number(start));
493
- clearInterval(interval);
494
- }
495
- },timeOut)
496
- },
497
- //停止洪水淹没分析
498
- $_stopAnalyse() {
499
- const {vueKey, vyeIndex} = this;
500
- //删除淹没分析
501
- webGlobe.scene.VisualAnalysisManager.removeAll();
502
- //停止绘制
503
- window.drawElement.stopDrawing();
504
- //删除管理对象
505
- window.CesiumZondy.FloodAnalyseManager.deleteSource(vueKey, vyeIndex);
506
- //启用开始分析按钮
507
- this.disabled = true;
508
- //高度置零
509
- this.currentHeight = 0;
510
- this.currentHeightCopy = 0;
441
+ * @description 移除洪水淹没分析结果,取消交互式绘制事件激活状态,恢复深度检测设置
442
+ */
443
+ remove() {
444
+ this._removeFlood();
445
+ const { CesiumZondy, vueKey, vueIndex } = this;
446
+ const options = this._getSourceOptions();
447
+ const { drawElement } = options;
448
+
449
+ if (drawElement) {
450
+ // 取消交互式绘制事件激活状态
451
+ drawElement.stopDrawing();
452
+ CesiumZondy.FloodAnalysisManager.changeOptions(
453
+ vueKey,
454
+ vueIndex,
455
+ "drawElement",
456
+ null
457
+ );
458
+ }
459
+
460
+ this.positions = null;
461
+ this.recalculate = false;
511
462
  }
512
463
  }
513
- }
464
+ };
514
465
  </script>
515
-
516
466
  <style scoped>
517
- .flood-analyse-box {
518
- position: absolute;
519
- top: 10px;
520
- left: 10px;
521
- width: 376px;
522
- height: 364px;
523
- background: white;
524
- border-radius: 5px;
525
- padding: 10px;
526
- }
527
-
528
- .flood-title {
529
- text-align: left;
530
- margin-top: 0.3em;
531
- }
532
-
533
- .flood-input {
534
- width: 235px;
535
- }
536
-
537
- .flood-color-picker {
538
- position: absolute;
539
- right: 10px;
540
- top: 8px;
541
- }
542
-
543
- .flood-button {
544
- position: absolute;
545
- right: -140px;
546
- }
547
-
548
- .flood-button-stop {
549
- right: -117px;
550
- }
551
-
552
- .flood-select {
553
- position: absolute;
554
- left: 0;
555
- width: 235px;
467
+ .mapgis-widget-flood-analysis {
468
+ max-height: calc(50vh);
469
+ overflow-y: auto;
556
470
  }
557
471
 
558
- .flood-analyse-box .ant-slider {
559
- margin: 10px 6px 10px;
472
+ ::v-deep .mapgis-ui-form-item {
473
+ margin-bottom: 0;
560
474
  }
561
475
 
562
- .flood-analyse-box .currentHeight {
563
- padding-top: 0.5em;
564
- padding-left: 0.5em;
565
- text-align: left;
476
+ ::v-deep .mapgis-ui-form label {
477
+ font-size: 12px;
566
478
  }
567
479
 
568
- .flood-analyse-box .start {
569
- position: absolute;
570
- right: 1px;
571
- bottom: -32px;
480
+ ::v-deep .mapgis-ui-form-item-label {
481
+ line-height: 40px;
572
482
  }
573
483
 
574
- .flood-analyse-box .back {
575
- position: absolute;
576
- right: -1px;
577
- bottom: -28px;
484
+ ::v-deep .mapgis-ui-input {
485
+ padding: 4px 11px;
578
486
  }
579
- </style>
487
+ </style>