@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,398 +1,416 @@
1
1
  <template>
2
- <div
3
- :class="[
4
- 'edit-wrapper-vshed',
5
- { right: position === 'right', left: position === 'left' },
6
- ]"
7
- >
8
- <div
9
- class="card-title"
10
- :style="{
11
- background: 'rgb(38, 151, 204)',
12
- padding: '5px',
13
- color: 'white',
14
- }"
15
- >
16
- 通视分析
17
- </div>
18
- <mapgis-ui-card class="box-card-vshed attr-table">
19
- <div class="starting">
20
- 起始点:
21
- <div class="inputs">
22
- <mapgis-ui-input v-model="form.startLon" :disabled="!form.startLon">
23
- <span slot="prefix">经度:</span>
24
- </mapgis-ui-input>
25
- <mapgis-ui-slider
26
- class="input"
27
- :step="0.0001"
28
- :max="startLonMax"
29
- :min="startLonMin"
30
- :disabled="!form.startLon"
31
- :value="parseFloat(form.startLon)"
32
- @change="setInput($event, 'startLon')"
33
- />
34
- </div>
35
- <div class="inputs">
36
- <mapgis-ui-input v-model="form.startLat" :disabled="!form.startLat">
37
- <span slot="prefix">纬度:</span>
38
- </mapgis-ui-input>
39
- <mapgis-ui-slider
40
- class="input"
41
- :step="0.0001"
42
- :max="startLatMax"
43
- :min="startLatMin"
44
- :disabled="!form.startLat"
45
- :value="parseFloat(form.startLat)"
46
- @change="setInput($event, 'startLat')"
47
- />
48
- </div>
49
- <div class="inputs">
50
- <mapgis-ui-input v-model="form.startAlt" :disabled="!form.startAlt">
51
- <span slot="prefix">高度:</span>
52
- </mapgis-ui-input>
53
- <mapgis-ui-slider
54
- class="input"
55
- :step="10"
56
- :max="startAltMax"
57
- :min="startAltMin"
58
- :disabled="!form.startAlt"
59
- :value="parseFloat(form.startAlt)"
60
- @change="setInput($event, 'startAlt')"
61
- />
62
- </div>
63
- </div>
64
- <div class="ending">
65
- 结束点:
66
- <div class="inputs">
67
- <mapgis-ui-input v-model="form.endLon" :disabled="!form.endLon">
68
- <span slot="prefix">经度:</span>
69
- </mapgis-ui-input>
70
- <mapgis-ui-slider
71
- class="input"
72
- :step="0.0001"
73
- :max="endLonMax"
74
- :min="endLonMin"
75
- :disabled="!form.endLon"
76
- :value="parseFloat(form.endLon)"
77
- @change="setInput($event, 'endLon')"
78
- />
79
- </div>
80
- <div class="inputs">
81
- <mapgis-ui-input v-model="form.endLat" :disabled="!form.endLat">
82
- <span slot="prefix">纬度:</span>
83
- </mapgis-ui-input>
84
- <mapgis-ui-slider
85
- class="input"
86
- :step="0.0001"
87
- :max="endLatMax"
88
- :min="endLatMin"
89
- :disabled="!form.endLat"
90
- :value="parseFloat(form.endLat)"
91
- @change="setInput($event, 'endLat')"
92
- />
93
- </div>
94
- <div class="inputs">
95
- <mapgis-ui-input v-model="form.endAlt" :disabled="!form.endAlt">
96
- <span slot="prefix">高度:</span>
97
- </mapgis-ui-input>
98
- <mapgis-ui-slider
99
- class="input"
100
- :step="10"
101
- :max="endAltMax"
102
- :min="endAltMin"
103
- :disabled="!form.endAlt"
104
- :value="parseFloat(form.endAlt)"
105
- @change="setInput($event, 'endAlt')"
106
- />
107
- </div>
108
- </div>
109
- <mapgis-ui-button class="content" type="primary" @click="initSightline"
110
- >点击绘制</mapgis-ui-button
111
- >
112
- <mapgis-ui-button
113
- class="content-clear"
114
- type="primary"
115
- @click="clearSightline"
116
- >清除</mapgis-ui-button
117
- >
118
- </mapgis-ui-card>
119
- </div>
2
+ <div class="mapgis-widget-visibility-analysis">
3
+ <mapgis-ui-setting-form v-model="formData" :wrapper-width="200">
4
+ <mapgis-ui-form-item label="附加高度(米)">
5
+ <mapgis-ui-input
6
+ v-model.number="formData.exHeight"
7
+ type="number"
8
+ :min="0"
9
+ :step="0.1"
10
+ />
11
+ </mapgis-ui-form-item>
12
+ <mapgis-ui-form-item label="不可视区域颜色">
13
+ <mapgis-ui-sketch-color-picker
14
+ :disableAlpha="false"
15
+ :color="formData.unVisibleColor"
16
+ @input="
17
+ val =>
18
+ (formData.unVisibleColor = `rgba(${val.rgba.r}, ${val.rgba.g}, ${val.rgba.b}, ${val.rgba.a})`)
19
+ "
20
+ ></mapgis-ui-sketch-color-picker>
21
+ </mapgis-ui-form-item>
22
+ <mapgis-ui-form-item label="可视区域颜色">
23
+ <mapgis-ui-sketch-color-picker
24
+ :disableAlpha="false"
25
+ :color="formData.visibleColor"
26
+ @input="
27
+ val =>
28
+ (formData.visibleColor = `rgba(${val.rgba.r}, ${val.rgba.g}, ${val.rgba.b}, ${val.rgba.a})`)
29
+ "
30
+ ></mapgis-ui-sketch-color-picker>
31
+ </mapgis-ui-form-item>
32
+ </mapgis-ui-setting-form>
33
+ <mapgis-ui-setting-footer>
34
+ <mapgis-ui-button type="primary" @click="onClickStart"
35
+ >分析</mapgis-ui-button
36
+ >
37
+ <mapgis-ui-button @click="onClickStop">清除</mapgis-ui-button>
38
+ </mapgis-ui-setting-footer>
39
+ </div>
120
40
  </template>
121
41
 
122
42
  <script>
43
+ import VueOptions from "../Base/Vue/VueOptions";
44
+ import {
45
+ isDepthTestAgainstTerrainEnable,
46
+ setDepthTestAgainstTerrainEnable
47
+ } from "../WebGlobe/util";
48
+
123
49
  export default {
124
- name: "mapgis-3d-sightline",
125
- inject: ["Cesium", "CesiumZondy", "webGlobe"],
126
- props: {
127
- index: {
128
- type: Number,
129
- default: 0,
130
- },
131
- position: {
132
- type: String,
133
- default: "right",
134
- },
50
+ name: "mapgis-3d-sightline",
51
+ inject: ["Cesium", "CesiumZondy", "webGlobe"],
52
+ props: {
53
+ ...VueOptions,
54
+ /**
55
+ * @type Number
56
+ * @default 1.85
57
+ * @description 观察点的附加高度
58
+ */
59
+ exHeight: {
60
+ type: Number,
61
+ default: 1.85
135
62
  },
136
- data() {
137
- return {
138
- //定义是否正在执行通视分析
139
- visiblitying: false,
140
- visiblityAn: false,
141
- visiblity3daction: false,
142
-
143
- startLonMin: 0,
144
- startLatMin: 0,
145
- startAltMin: 0,
146
- endLonMin: 0,
147
- endLatMin: 0,
148
- endAltMin: 0,
149
- startLonMax: 0,
150
- startLatMax: 0,
151
- startAltMax: 0,
152
- endLonMax: 0,
153
- endLatMax: 0,
154
- endAltMax: 0,
155
- form: {
156
- startLon: 0,
157
- startLat: 0,
158
- startAlt: 0,
159
- endLon: 0,
160
- endLat: 0,
161
- endAlt: 0,
162
- },
163
- };
63
+ /**
64
+ * @type String
65
+ * @default '#008000'
66
+ * @description 可视区域颜色
67
+ */
68
+ visibleColor: {
69
+ type: String,
70
+ default: "#008000"
164
71
  },
165
- watch: {
166
- form: {
167
- deep: true,
168
- handler: function (val) {
169
- let find = this.findSource();
170
- let visiblity = window.visiblity[this.index][find.index];
171
- if (visiblity !== null && typeof visiblity !== "undefined") {
172
- if (val.startLon && val.startLat && val.startAlt) {
173
- visiblity.viewPosition = Cesium.Cartesian3.fromDegrees(
174
- val.startLon,
175
- val.startLat,
176
- val.startAlt
177
- );
178
- }
179
- if (val.endLon && val.endLat && val.endAlt) {
180
- visiblity.targetPosition = Cesium.Cartesian3.fromDegrees(
181
- val.endLon,
182
- val.endLat,
183
- val.endAlt
184
- );
185
- }
186
- }
187
- },
188
- },
72
+ /**
73
+ * @type String
74
+ * @default '#ff0000'
75
+ * @description 不可视区域颜色
76
+ */
77
+ unVisibleColor: {
78
+ type: String,
79
+ default: "#ff0000"
80
+ }
81
+ },
82
+ data() {
83
+ return {
84
+ formData: {
85
+ exHeight: 1.85,
86
+ visibleColor: "#008000",
87
+ unVisibleColor: "#ff0000"
88
+ },
89
+ // 是否为鼠标注册了监听事件
90
+ isAddEventListener: false,
91
+
92
+ // 是否已选择观察点位置
93
+ hasViewPosition: false,
94
+
95
+ // 观察点
96
+ viewPoint: undefined,
97
+
98
+ // 目标点
99
+ targetPoint: undefined,
100
+
101
+ // 观察点坐标
102
+ viewPosition: undefined,
103
+
104
+ //通视分析结果集
105
+ visibilityArr: [],
106
+
107
+ isDepthTestAgainstTerrainEnable: undefined // 深度检测是否已开启,默认为undefined,当这个值为undefined的时候,说明没有赋值,不做任何处理
108
+ };
109
+ },
110
+ computed:{
111
+ formDataNew(){
112
+ return JSON.parse(JSON.stringify(this.formData));
113
+ }
114
+ },
115
+ watch: {
116
+ exHeight: {
117
+ handler: function(newVal, oldVal) {
118
+ this.formData.exHeight = newVal;
119
+ },
120
+ immediate: true
189
121
  },
190
- methods: {
191
- setInput(event, data) {
192
- this.form[data] = event;
193
- },
194
- findSource() {
195
- const vm = this;
196
- let index = -1;
197
- let find = window.visiblity[this.index].find((s, i) => {
198
- let result = false;
199
- let { layer } = vm;
200
- if (s instanceof Cesium.VisiblityAnalysis) {
201
- index = i;
202
- result = true;
203
- }
204
- return result;
205
- });
206
- return { index: index, value: find };
207
- },
208
- initSightline() {
209
- const { webGlobe } = this;
210
- let viewer = webGlobe.viewer;
211
- let that = this;
212
- viewer.scene.globe.depthTestAgainstTerrain = true;
213
- //注册鼠标左键点击事件
214
- function left(movement) {
215
- let find = that.findSource();
216
- let visiblity = window.visiblity[that.index][find.index];
217
- viewer.scene.globe.enableTransparent = false;
218
- //判断是否初始化过通视分析类
219
- if (that.visiblity3daction) {
220
- //获取鼠标点击位置
221
- var cartesian = viewer.getCartesian3Position(
222
- movement.position,
223
- cartesian
224
- );
225
- //第一个点
226
- if (cartesian != undefined && !that.visiblitying) {
227
- //设置通视分析观察点
228
- // visiblity.viewPosition = cartesian;
229
-
230
- let cartographic = Cesium.Cartographic.fromCartesian(
231
- cartesian
232
- );
233
- let lng = Cesium.Math.toDegrees(cartographic.longitude);
234
- let lat = Cesium.Math.toDegrees(cartographic.latitude);
235
- //模型高度
236
- let height = cartographic.height;
237
- that.form.startLon = lng;
238
- that.form.startLat = lat;
239
- that.form.startAlt = height;
240
-
241
- viewer.scene.VisualAnalysisManager.add(visiblity);
242
- //设置为正在通视分析
243
- that.visiblitying = true;
244
-
245
- that.startLonMin = that.form.startLon - 0.001;
246
- that.startLatMin = that.form.startLat - 0.001;
247
- that.startAltMin = that.form.startAlt - 100;
248
- that.startLonMax = that.form.startLon + 0.001;
249
- that.startLatMax = that.form.startLat + 0.001;
250
- that.startAltMax = that.form.startAlt + 100;
251
- } else {
252
- if (that.visiblitying) {
253
- //设置通视分析结果点
254
- // visiblity.targetPosition = cartesian;
255
- //设置为不在通视分析
256
- that.visiblitying = false;
257
- that.visiblity3daction = false;
258
- }
259
- }
260
- }
261
- }
262
- //鼠标右键结束
263
- function right(movement) {
264
- let find = that.findSource();
265
- let visiblity = window.visiblity[that.index][find.index];
266
- //判断是否正在通视分析
267
- if (that.visiblitying) {
268
- //设置通视分析结果点
269
- // visiblity.targetPosition = cartesian;
270
- //设置不在通视分析
271
- that.visiblitying = false;
272
- that.visiblity3daction = false;
273
- }
274
- }
275
- //鼠标移动事件
276
- function move(movement) {
277
- let find = that.findSource();
278
- let visiblity = window.visiblity[that.index][find.index];
279
- //判断是否正在通视分析
280
- if (that.visiblitying) {
281
- //获取鼠标位置
282
- var cartesian = viewer.getCartesian3Position(
283
- movement.endPosition,
284
- cartesian
285
- );
286
- if (cartesian) {
287
- //设置通视分析结果点
288
- // visiblity.targetPosition = cartesian;
289
-
290
- let cartographic = Cesium.Cartographic.fromCartesian(
291
- cartesian
292
- );
293
- let lng = Cesium.Math.toDegrees(cartographic.longitude);
294
- let lat = Cesium.Math.toDegrees(cartographic.latitude);
295
- //模型高度
296
- let height = cartographic.height;
297
- that.form.endLon = lng;
298
- that.form.endLat = lat;
299
- that.form.endAlt = height;
300
-
301
- that.endLonMin = that.form.endLon - 0.001;
302
- that.endLatMin = that.form.endLat - 0.001;
303
- that.endAltMin = that.form.endAlt - 100;
304
- that.endLonMax = that.form.endLon + 0.001;
305
- that.endLatMax = that.form.endLat + 0.001;
306
- that.endAltMax = that.form.endAlt + 100;
307
- }
308
- }
309
- }
310
- if (that.visiblityAn === false) {
311
- window.visiblity[that.index].push(
312
- new Cesium.VisiblityAnalysis(viewer.scene)
313
- );
314
- //获取三位场景视图对象
315
- that.visiblityAn = true;
316
- that.visiblitying = false;
317
- that.visiblity3daction = true;
318
- //注册事件
319
- webGlobe.registerMouseEvent("LEFT_CLICK", left);
320
- webGlobe.registerMouseEvent("RIGHT_CLICK", right);
321
- webGlobe.registerMouseEvent("MOUSE_MOVE", move);
322
- }
323
- },
324
- clearSightline() {
325
- const { webGlobe } = this;
326
- let that = this;
327
- let find = that.findSource();
328
- webGlobe.viewer.scene.globe.depthTestAgainstTerrain = true;
329
- if (that.visiblityAn === true) {
330
- //注销事件
331
- webGlobe.unRegisterMouseEvent("LEFT_CLICK");
332
- webGlobe.unRegisterMouseEvent("RIGHT_CLICK");
333
- webGlobe.unRegisterMouseEvent("MOUSE_MOVE");
334
- //移除通视分析结果
335
- webGlobe.viewer.scene.VisualAnalysisManager.remove(
336
- window.visiblity[this.index][find.index]
337
- );
338
- that.visiblityAn = false;
339
- that.visiblitying = false;
340
- that.visiblity3daction = false;
341
- //销毁通视分析类
342
- delete window.visiblity[this.index][find.index];
343
- that.form.endLon = 0;
344
- that.form.endLat = 0;
345
- that.form.endAlt = 0;
346
- that.form.startLon = 0;
347
- that.form.startLat = 0;
348
- that.form.startAlt = 0;
349
-
350
- that.startLonMin = 0;
351
- that.startLatMin = 0;
352
- that.startAltMin = 0;
353
- that.endLonMin = 0;
354
- that.endLatMin = 0;
355
- that.endAltMin = 0;
356
- that.startLonMax = 0;
357
- that.startLatMax = 0;
358
- that.startAltMax = 0;
359
- that.endLonMax = 0;
360
- that.endLatMax = 0;
361
- that.endAltMax = 0;
122
+ visibleColor: {
123
+ handler: function(newVal, oldVal) {
124
+ this.formData.visibleColor = newVal;
125
+ },
126
+ immediate: true
127
+ },
128
+ unVisibleColor: {
129
+ handler: function(newVal, oldVal) {
130
+ this.formData.unVisibleColor = newVal;
131
+ },
132
+ immediate: true
133
+ },
134
+ formDataNew: {
135
+ deep: true,
136
+ handler: function(newVal, oldVal) {
137
+ const unVisibleColor = new this.Cesium.Color.fromCssColorString(
138
+ newVal.unVisibleColor
139
+ );
140
+ const visibleColor = new this.Cesium.Color.fromCssColorString(
141
+ newVal.visibleColor
142
+ );
143
+ if (this.visibilityArr.length > 0) {
144
+ this.visibilityArr.forEach(item => {
145
+ item._unvisibleColor = unVisibleColor;
146
+ item._visibleColor = visibleColor;
147
+ if (newVal.exHeight !== oldVal.exHeight) {
148
+ // 改变通视分析工具的附加高度(分析工具的观察点坐标也会同时更新)
149
+ item.exHeight = newVal.exHeight - oldVal.exHeight;
150
+
151
+ // 改变观察点坐标
152
+ this.viewPoint.position._value = item.viewPosition;
153
+ // 记录新的观察点坐标
154
+ this.viewPosition = item.viewPosition;
362
155
  }
156
+ });
157
+ }
158
+ }
159
+ }
160
+ },
161
+ methods: {
162
+ async createCesiumObject() {
163
+ const { baseUrl, options } = this;
164
+ // return new Cesium.GeoJsonDataSource.load(baseUrl, options);
165
+ return new Promise(
166
+ resolve => {
167
+ resolve();
363
168
  },
169
+ reject => {}
170
+ );
171
+ },
172
+ mount() {
173
+ const { webGlobe, CesiumZondy, vueKey, vueIndex } = this;
174
+ const { viewer } = webGlobe;
175
+ const vm = this;
176
+ let promise = this.createCesiumObject();
177
+ promise.then(function(dataSource) {
178
+ vm.$emit("load", vm);
179
+ CesiumZondy.VisiblityAnalysisManager.addSource(
180
+ vueKey,
181
+ vueIndex,
182
+ dataSource,
183
+ {
184
+ visiblityAnalysis: null
185
+ }
186
+ );
187
+ });
188
+ },
189
+ unmount() {
190
+ let { CesiumZondy, vueKey, vueIndex } = this;
191
+ this.onClickStop();
192
+ CesiumZondy.VisiblityAnalysisManager.deleteSource(vueKey, vueIndex);
193
+ },
194
+
195
+ findSource() {
196
+ let { CesiumZondy, vueKey, vueIndex } = this;
197
+ let find = CesiumZondy.VisiblityAnalysisManager.findSource(
198
+ vueKey,
199
+ vueIndex
200
+ );
201
+ return find;
364
202
  },
365
- mounted() {
366
- window.visiblity = window.visiblity || [[], []];
203
+ // 点击“分析”按钮回调
204
+ onClickStart() {
205
+ this.onClickStop();
206
+ //深度检测开启
207
+ this.isDepthTestAgainstTerrainEnable = isDepthTestAgainstTerrainEnable(
208
+ this.webGlobe
209
+ );
210
+ if (!this.isDepthTestAgainstTerrainEnable) {
211
+ // 如果深度检测没有开启,则开启
212
+ setDepthTestAgainstTerrainEnable(true, this.webGlobe);
213
+ }
214
+ this.addEventListener();
367
215
  },
368
- destroyed() {
369
- const { webGlobe } = this;
370
- let find = this.findSource();
371
- webGlobe.viewer.scene.VisualAnalysisManager.remove(
372
- window.visiblity[this.index][find.index]
216
+ // 创建通视分析工具
217
+ createVisibility() {
218
+ const unVisibleColor = new this.Cesium.Color.fromCssColorString(
219
+ this.formData.unVisibleColor
220
+ );
221
+ const visibleColor = new this.Cesium.Color.fromCssColorString(
222
+ this.formData.visibleColor
223
+ );
224
+
225
+ // 初始化高级分析功能管理类
226
+ const advancedAnalysisManager = new window.CesiumZondy.Manager.AdvancedAnalysisManager(
227
+ {
228
+ viewer: this.webGlobe.viewer
229
+ }
230
+ );
231
+
232
+ // 初始化通视分析类
233
+ const visibility = advancedAnalysisManager.createVisibilityAnalysis();
234
+ visibility._unvisibleColor = unVisibleColor;
235
+ visibility._visibleColor = visibleColor;
236
+
237
+ this.visibilityArr.push(visibility);
238
+
239
+ return visibility;
240
+ },
241
+ /**
242
+ * @description 恢复深度检测设置
243
+ */
244
+ _restoreDepthTestAgainstTerrain() {
245
+ if (
246
+ this.isDepthTestAgainstTerrainEnable !== undefined &&
247
+ this.isDepthTestAgainstTerrainEnable !==
248
+ isDepthTestAgainstTerrainEnable(this.webGlobe)
249
+ ) {
250
+ setDepthTestAgainstTerrainEnable(
251
+ this.isDepthTestAgainstTerrainEnable,
252
+ this.webGlobe
373
253
  );
374
- delete window.visiblity;
375
- window.visiblity = [[], []];
254
+ }
376
255
  },
256
+
257
+ // 点击“结束分析”按钮回调
258
+ onClickStop() {
259
+ // 注销鼠标的各项监听事件
260
+ this.webGlobe.unRegisterMouseEvent("LEFT_CLICK");
261
+ this.webGlobe.unRegisterMouseEvent("RIGHT_CLICK");
262
+
263
+ this.webGlobe.viewer.entities.removeAll();
264
+
265
+ if (this.visibilityArr.length > 0) {
266
+ this.visibilityArr.forEach(item => {
267
+ // 移除通视分析结果
268
+ this.webGlobe.viewer.scene.VisualAnalysisManager.remove(item);
269
+ // 销毁通视分析类
270
+ item.destroy();
271
+ });
272
+ }
273
+
274
+ //恢复深度检测的原始设置
275
+ this._restoreDepthTestAgainstTerrain();
276
+ this.hasViewPosition = false;
277
+ this.isAddEventListener = false;
278
+ this.visibilityArr = [];
279
+ },
280
+
281
+ // 为鼠标的各种行为注册监听事件
282
+ addEventListener() {
283
+ if (!this.isAddEventListener) {
284
+ this.webGlobe.registerMouseEvent("LEFT_CLICK", event => {
285
+ this.registerMouseLClickEvent(event);
286
+ });
287
+ this.webGlobe.registerMouseEvent("RIGHT_CLICK", event => {
288
+ this.registerMouseRClickEvent(event);
289
+ });
290
+
291
+ this.isAddEventListener = true;
292
+ }
293
+ },
294
+
295
+ // 注册通视分析鼠标左键点击事件
296
+ registerMouseLClickEvent(event) {
297
+ let { vueKey, vueIndex } = this;
298
+ let cartesian = this.webGlobe.viewer.getCartesian3Position(
299
+ event.position
300
+ );
301
+
302
+ if (!this.hasViewPosition && cartesian !== undefined) {
303
+ // 若还未选择观察点,则记录下观察点坐标
304
+
305
+ // 获取当前坐标系标准
306
+ const ellipsoid = this.webGlobe.viewer.scene.globe.ellipsoid;
307
+ // 根据坐标系标准,将笛卡尔坐标转换为地理坐标
308
+ const cartographic = ellipsoid.cartesianToCartographic(cartesian);
309
+ // 抬高观察点
310
+ cartographic.height += this.formData.exHeight;
311
+
312
+ cartesian = this.Cesium.Cartographic.toCartesian(cartographic);
313
+ this.viewPosition = cartesian;
314
+
315
+ // 添加观察点到地图
316
+ this.addViewPoint(cartesian);
317
+ this.hasViewPosition = true;
318
+ } else {
319
+ const visibility = this.createVisibility();
320
+
321
+ // 设置通视分析观察点坐标
322
+ visibility.viewPosition = this.viewPosition;
323
+
324
+ // 设置通视分析结束点坐标
325
+ visibility.targetPosition = cartesian;
326
+
327
+ //修改manager的options
328
+ CesiumZondy.VisiblityAnalysisManager.changeOptions(
329
+ vueKey,
330
+ vueIndex,
331
+ "visualAnalysis",
332
+ visibility
333
+ );
334
+
335
+ // 添加目标点到地图
336
+ this.addTargetPoint(cartesian);
337
+ }
338
+ },
339
+
340
+ // 注册通视分析鼠标右键点击事件
341
+ registerMouseRClickEvent(event) {
342
+ // 注销鼠标的各项监听事件
343
+ this.webGlobe.unRegisterMouseEvent("LEFT_CLICK");
344
+ this.webGlobe.unRegisterMouseEvent("RIGHT_CLICK");
345
+ this.isAddEventListener = false;
346
+ },
347
+
348
+ // 添加观察点到地图上
349
+ addViewPoint(cartesian) {
350
+ this.removeViewPoint();
351
+
352
+ this.viewPoint = this.webGlobe.viewer.entities.add({
353
+ position: cartesian,
354
+ point: {
355
+ color: this.Cesium.Color.BLUE,
356
+ pixelSize: 10
357
+ }
358
+ });
359
+ },
360
+
361
+ // 添加目标点到地图上
362
+ addTargetPoint(cartesian) {
363
+ this.removeTargetPoint();
364
+
365
+ this.targetPoint = this.webGlobe.viewer.entities.add({
366
+ position: cartesian,
367
+ point: {
368
+ color: this.Cesium.Color.RED,
369
+ pixelSize: 10
370
+ }
371
+ });
372
+ },
373
+
374
+ // 从地图上移除观察点
375
+ removeViewPoint() {
376
+ if (this.viewPoint) this.webGlobe.viewer.entities.remove(this.viewPoint);
377
+ },
378
+
379
+ // 从地图上移除目标点
380
+ removeTargetPoint() {
381
+ if (this.targetPoint)
382
+ this.webGlobe.viewer.entities.remove(this.targetPoint);
383
+ }
384
+ },
385
+ mounted() {
386
+ this.mount();
387
+ },
388
+ destroyed() {
389
+ this.unmount();
390
+ }
377
391
  };
378
392
  </script>
379
393
 
380
394
  <style scoped>
381
395
  ::v-deep .mapgis-ui-card-body {
382
- max-height: 400px;
383
- overflow: auto;
396
+ /*max-height: 400px;*/
397
+ /*overflow: auto;*/
398
+ padding: 16px;
384
399
  }
385
- ::v-deep .mapgis-ui-input-affix-wrapper .mapgis-ui-input:not(:first-child) {
386
- padding-left: 45px;
400
+
401
+ ::v-deep .mapgis-ui-form-item-label {
402
+ line-height: 40px;
403
+ }
404
+
405
+ ::v-deep .mapgis-ui-form label {
406
+ font-size: 12px;
387
407
  }
388
- .edit-wrapper-vshed.right {
389
- position: absolute;
390
- top: 20px;
391
- right: 20px;
408
+
409
+ ::v-deep .mapgis-ui-form-item {
410
+ margin-bottom: 0;
392
411
  }
393
- .edit-wrapper-vshed.left {
394
- position: absolute;
395
- top: 20px;
396
- left: 20px;
412
+
413
+ ::v-deep .mapgis-ui-input-affix-wrapper .mapgis-ui-input:not(:first-child) {
414
+ padding-left: 45px;
397
415
  }
398
- </style>
416
+ </style>