@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,395 +1,828 @@
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="startViewshed"
110
- >点击绘制</mapgis-ui-button
111
- >
112
- <mapgis-ui-button
113
- class="content-clear"
114
- type="primary"
115
- @click="clearViewshed"
116
- >清除</mapgis-ui-button
117
- >
118
- </mapgis-ui-card>
119
- </div>
2
+ <div class="mapgis-widget-visual-analysis">
3
+ <mapgis-ui-setting-form v-model="formData" :wrapper-width="280">
4
+ <mapgis-ui-form-item label="水平视角">
5
+ <mapgis-ui-input
6
+ v-model.number="formData.horizontAngle"
7
+ :min="1"
8
+ type="number"
9
+ />
10
+ </mapgis-ui-form-item>
11
+ <mapgis-ui-form-item label="垂直视角">
12
+ <mapgis-ui-input
13
+ v-model.number="formData.verticalAngle"
14
+ :min="1"
15
+ type="number"
16
+ />
17
+ </mapgis-ui-form-item>
18
+ <mapgis-ui-form-item label="附加高度(米)">
19
+ <mapgis-ui-input
20
+ v-model.number="formData.exHeight"
21
+ type="number"
22
+ :min="0"
23
+ :step="0.1"
24
+ />
25
+ </mapgis-ui-form-item>
26
+ <mapgis-ui-form-item label="方向角">
27
+ <mapgis-ui-input
28
+ v-model.number="angleSet.heading"
29
+ :min="0"
30
+ :max="360"
31
+ type="number"
32
+ />
33
+ </mapgis-ui-form-item>
34
+ <mapgis-ui-form-item label="俯仰角">
35
+ <mapgis-ui-input
36
+ v-model.number="angleSet.pitch"
37
+ :min="-90"
38
+ :max="90"
39
+ type="number"
40
+ />
41
+ </mapgis-ui-form-item>
42
+ <mapgis-ui-form-item label="可视距离(米)">
43
+ <mapgis-ui-input
44
+ v-model.number="angleSet.viewRadius"
45
+ :min="0"
46
+ type="number"
47
+ />
48
+ </mapgis-ui-form-item>
49
+ <mapgis-ui-form-item label="观察点坐标">
50
+ <mapgis-ui-row>
51
+ <mapgis-ui-col :span="8">
52
+ <mapgis-ui-input
53
+ v-model.number="posData.viewPositionX"
54
+ :step="0.0001"
55
+ type="number"
56
+ placeholder="经度"
57
+ />
58
+ </mapgis-ui-col>
59
+ <mapgis-ui-col :span="8">
60
+ <mapgis-ui-input
61
+ v-model.number="posData.viewPositionY"
62
+ :step="0.0001"
63
+ type="number"
64
+ placeholder="纬度"
65
+ />
66
+ </mapgis-ui-col>
67
+ <mapgis-ui-col :span="8">
68
+ <mapgis-ui-input
69
+ v-model.number="posData.viewPositionZ"
70
+ type="number"
71
+ placeholder="高度"
72
+ />
73
+ </mapgis-ui-col>
74
+ </mapgis-ui-row>
75
+ </mapgis-ui-form-item>
76
+ <mapgis-ui-form-item label="目标点坐标">
77
+ <mapgis-ui-row>
78
+ <mapgis-ui-col :span="8">
79
+ <mapgis-ui-input
80
+ v-model.number="posData.targetPositionX"
81
+ :step="0.0001"
82
+ type="number"
83
+ placeholder="经度"
84
+ />
85
+ </mapgis-ui-col>
86
+ <mapgis-ui-col :span="8">
87
+ <mapgis-ui-input
88
+ v-model.number="posData.targetPositionY"
89
+ :step="0.0001"
90
+ type="number"
91
+ placeholder="纬度"
92
+ />
93
+ </mapgis-ui-col>
94
+ <mapgis-ui-col :span="8">
95
+ <mapgis-ui-input
96
+ v-model.number="posData.targetPositionZ"
97
+ type="number"
98
+ placeholder="高度"
99
+ />
100
+ </mapgis-ui-col>
101
+ </mapgis-ui-row>
102
+ </mapgis-ui-form-item>
103
+ <mapgis-ui-form-item label="不可视区域颜色">
104
+ <mapgis-ui-sketch-color-picker
105
+ :disableAlpha="false"
106
+ :color="formData.unVisibleColor"
107
+ @input="
108
+ val =>
109
+ (formData.unVisibleColor = `rgba(${val.rgba.r}, ${val.rgba.g}, ${val.rgba.b}, ${val.rgba.a})`)
110
+ "
111
+ ></mapgis-ui-sketch-color-picker>
112
+ </mapgis-ui-form-item>
113
+ <mapgis-ui-form-item label="可视区域颜色">
114
+ <mapgis-ui-sketch-color-picker
115
+ :disableAlpha="false"
116
+ :color="formData.visibleColor"
117
+ @input="
118
+ val =>
119
+ (formData.visibleColor = `rgba(${val.rgba.r}, ${val.rgba.g}, ${val.rgba.b}, ${val.rgba.a})`)
120
+ "
121
+ ></mapgis-ui-sketch-color-picker>
122
+ </mapgis-ui-form-item>
123
+ <mapgis-ui-form-item label="可视遮罩颜色">
124
+ <mapgis-ui-sketch-color-picker
125
+ :disableAlpha="false"
126
+ :color="formData.maskColor"
127
+ @input="
128
+ val =>
129
+ (formData.maskColor = `rgba(${val.rgba.r}, ${val.rgba.g}, ${val.rgba.b}, ${val.rgba.a})`)
130
+ "
131
+ ></mapgis-ui-sketch-color-picker>
132
+ </mapgis-ui-form-item>
133
+ </mapgis-ui-setting-form>
134
+ <!-- </div>-->
135
+ <mapgis-ui-setting-footer>
136
+ <mapgis-ui-button type="primary" @click="onClickStart"
137
+ >分析</mapgis-ui-button
138
+ >
139
+ <mapgis-ui-button @click="onClickStop">清除</mapgis-ui-button>
140
+ </mapgis-ui-setting-footer>
141
+ </div>
120
142
  </template>
121
143
 
122
144
  <script>
145
+ import VueOptions from "../Base/Vue/VueOptions";
146
+ import {
147
+ isDepthTestAgainstTerrainEnable,
148
+ setDepthTestAgainstTerrainEnable
149
+ } from "../WebGlobe/util";
150
+
123
151
  export default {
124
- name: "mapgis-3d-viewshed",
125
- props: {
126
- index: {
127
- type: Number,
128
- default: 0,
129
- },
130
- position: {
131
- type: String,
132
- default: "right",
133
- },
152
+ name: "mapgis-3d-viewshed",
153
+ props: {
154
+ ...VueOptions,
155
+ /**
156
+ * @type Number
157
+ * @default 60
158
+ * @description 观察点的水平视角
159
+ */
160
+ horizontAngle: {
161
+ type: Number,
162
+ default: 60
134
163
  },
135
- inject: ["Cesium", "CesiumZondy", "webGlobe"],
136
- data() {
137
- return {
138
- //定义鼠标事件类
139
- viewshedAn: false,
140
- viewshed3daction: false,
141
- viewshed3ding: 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
- };
164
+ /**
165
+ * @type Number
166
+ * @default 60
167
+ * @description 观察点的垂直视角
168
+ */
169
+ verticalAngle: {
170
+ type: Number,
171
+ default: 60
164
172
  },
165
- watch: {
166
- form: {
167
- deep: true,
168
- handler: function (val) {
169
- let find = this.findSource();
170
- let vshed3d = window.viewshed3d[this.index][find.index];
171
- if (vshed3d !== null && typeof vshed3d !== "undefined") {
172
- if (val.startLon && val.startLat && val.startAlt) {
173
- vshed3d.viewPosition = Cesium.Cartesian3.fromDegrees(
174
- val.startLon,
175
- val.startLat,
176
- val.startAlt
177
- );
178
- }
179
- if (val.endLon && val.endLat && val.endAlt) {
180
- vshed3d.targetPosition = Cesium.Cartesian3.fromDegrees(
181
- val.endLon,
182
- val.endLat,
183
- val.endAlt
184
- );
185
- }
186
- }
187
- },
188
- },
173
+ /**
174
+ * @type String
175
+ * @default '#ff0000'
176
+ * @description 不可视区域颜色
177
+ */
178
+ unVisibleColor: {
179
+ type: String,
180
+ default: "#ff0000"
189
181
  },
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.viewshed3d[this.index].find((s, i) => {
198
- let result = false;
199
- let { layer } = vm;
200
- if (s instanceof Cesium.ViewshedAnalysis) {
201
- index = i;
202
- result = true;
203
- }
204
- return result;
205
- });
206
- return { index: index, value: find };
207
- },
208
- startViewshed() {
209
- let that = this;
210
- let viewer = that.webGlobe.viewer;
211
- viewer.scene.globe.depthTestAgainstTerrain = true;
212
- function left(movement) {
213
- let find = that.findSource();
214
- let vshed3d = window.viewshed3d[that.index][find.index];
215
- that.webGlobe.viewer.scene.globe.enableTransparent = false;
216
- if (that.viewshedAn) {
217
- // 可视域分析
218
- if (that.viewshed3daction) {
219
- //获取鼠标位置
220
- let cartesian = viewer.getCartesian3Position(
221
- movement.position,
222
- cartesian
223
- );
224
- if (cartesian !== undefined && !that.viewshed3ding) {
225
- cartesian.z += 3.6;
226
- let cartographic = Cesium.Cartographic.fromCartesian(
227
- cartesian
228
- );
229
- let lng = Cesium.Math.toDegrees(
230
- cartographic.longitude
231
- );
232
- let lat = Cesium.Math.toDegrees(
233
- cartographic.latitude
234
- );
235
- //模型高度
236
- let height = cartographic.height;
237
- that.form.startLon = lng;
238
- that.form.startLat = lat;
239
- that.form.startAlt = height;
240
- //设置观察点坐标
241
- vshed3d.viewPosition = cartesian;
242
- //添加可视域分析结果显示
243
- viewer.scene.VisualAnalysisManager.add(vshed3d);
244
- that.viewshed3ding = true;
245
-
246
- that.startLonMin = that.form.startLon - 0.001;
247
- that.startLatMin = that.form.startLat - 0.001;
248
- that.startAltMin = that.form.startAlt - 100;
249
- that.startLonMax = that.form.startLon + 0.001;
250
- that.startLatMax = that.form.startLat + 0.001;
251
- that.startAltMax = that.form.startAlt + 100;
252
- } else {
253
- // //设置可视域结果点
254
- vshed3d.targetPosition = cartesian;
255
- that.viewshed3daction = false;
256
- that.viewshed3ding = false;
257
- }
258
- }
259
- }
260
- }
261
- //鼠标右键结束
262
- function right(movement) {
263
- let find = that.findSource();
264
- let vshed3d = window.viewshed3d[that.index][find.index];
265
- if (that.viewshed3ding) {
266
- if (that.viewshedAn) {
267
- that.viewshed3daction = false;
268
- that.viewshed3ding = false;
269
- }
270
- }
271
- }
272
-
273
- function move(movement) {
274
- let find = that.findSource();
275
- let vshed3d = window.viewshed3d[that.index][find.index];
276
- if (that.viewshed3ding) {
277
- let cartesian = viewer.getCartesian3Position(
278
- movement.endPosition,
279
- cartesian
280
- );
281
- if (cartesian) {
282
- vshed3d.targetPosition = cartesian;
283
- let cartographic = Cesium.Cartographic.fromCartesian(
284
- cartesian
285
- );
286
- let lng = Cesium.Math.toDegrees(cartographic.longitude);
287
- let lat = Cesium.Math.toDegrees(cartographic.latitude);
288
- //模型高度
289
- let height = cartographic.height;
290
- that.form.endLon = lng;
291
- that.form.endLat = lat;
292
- that.form.endAlt = height;
293
-
294
- that.endLonMin = that.form.endLon - 0.001;
295
- that.endLatMin = that.form.endLat - 0.001;
296
- that.endAltMin = that.form.endAlt - 100;
297
- that.endLonMax = that.form.endLon + 0.001;
298
- that.endLatMax = that.form.endLat + 0.001;
299
- that.endAltMax = that.form.endAlt + 100;
300
- }
301
- }
302
- }
303
- if (that.viewshedAn === false) {
304
- //获取三位场景视图对象
305
- that.viewshedAn = true;
306
- //可视域分析(新)
307
-
308
- window.viewshed3d[that.index].push(
309
- new Cesium.ViewshedAnalysis(viewer.scene)
310
- );
311
- that.viewshed3daction = true;
312
- that.viewshed3ding = false;
313
-
314
- //注册事件
315
- that.webGlobe.registerMouseEvent("LEFT_CLICK", left);
316
- that.webGlobe.registerMouseEvent("RIGHT_CLICK", right);
317
- that.webGlobe.registerMouseEvent("MOUSE_MOVE", move);
318
- }
319
- },
320
- clearViewshed() {
321
- let that = this;
322
- let viewer = that.webGlobe.viewer;
323
- let find = that.findSource();
324
- viewer.scene.globe.depthTestAgainstTerrain = true;
325
- if (that.viewshedAn === true) {
326
- that.webGlobe.unRegisterMouseEvent("LEFT_CLICK");
327
- that.webGlobe.unRegisterMouseEvent("MOUSE_MOVE");
328
- that.webGlobe.unRegisterMouseEvent("RIGHT_CLICK");
329
-
330
- // window.webGlobe.viewer.entities.removeById("vshedPos");
331
- viewer.scene.VisualAnalysisManager.remove(
332
- window.viewshed3d[this.index][find.index]
333
- );
334
- that.viewshedAn = false;
335
- that.viewshed3daction = false;
336
- that.viewshed3ding = false;
337
- //定义可视域分析类
338
- delete window.viewshed3d[this.index][find.index];
339
- that.form.endLon = 0;
340
- that.form.endLat = 0;
341
- that.form.endAlt = 0;
342
- that.form.startLon = 0;
343
- that.form.startLat = 0;
344
- that.form.startAlt = 0;
345
-
346
- that.startLonMin = 0;
347
- that.startLatMin = 0;
348
- that.startAltMin = 0;
349
- that.endLonMin = 0;
350
- that.endLatMin = 0;
351
- that.endAltMin = 0;
352
- that.startLonMax = 0;
353
- that.startLatMax = 0;
354
- that.startAltMax = 0;
355
- that.endLonMax = 0;
356
- that.endLatMax = 0;
357
- that.endAltMax = 0;
358
- }
182
+ /**
183
+ * @type String
184
+ * @default '#00ff00'
185
+ * @description 可视区域颜色
186
+ */
187
+ visibleColor: {
188
+ type: String,
189
+ default: "#00ff00"
190
+ },
191
+ /**
192
+ * @type String
193
+ * @default 'rgba(37, 218, 169, 0.2)'
194
+ * @description 可视遮罩颜色
195
+ */
196
+ maskColor: {
197
+ type: String,
198
+ default: "rgba(37, 218, 169, 0.2)"
199
+ },
200
+ /**
201
+ * @type Number
202
+ * @default 1.85
203
+ * @description 观察点的附加高度/米
204
+ */
205
+ exHeight: {
206
+ type: Number,
207
+ default: 1.85
208
+ }
209
+ },
210
+ inject: ["Cesium", "CesiumZondy", "webGlobe"],
211
+ data() {
212
+ return {
213
+ formData: {
214
+ horizontAngle: 60,
215
+ verticalAngle: 60,
216
+ unVisibleColor: "#ff0000",
217
+ visibleColor: "#00ff00",
218
+ maskColor: "rgba(37, 218, 169, 0.2)",
219
+ exHeight: 1.85
220
+ },
221
+ angleSet: {
222
+ //方向角
223
+ heading: 0,
224
+ // 俯仰角
225
+ pitch: 0,
226
+ // 可视距离
227
+ viewRadius: 0
228
+ },
229
+ // 坐标数据
230
+ posData: {
231
+ viewPositionX: "",
232
+ viewPositionY: "",
233
+ viewPositionZ: "",
234
+ targetPositionX: "",
235
+ targetPositionY: "",
236
+ targetPositionZ: ""
237
+ },
238
+
239
+ // 是否为鼠标注册了监听事件
240
+ isAddEventListener: false,
241
+
242
+ // 是否已选择观察点位置
243
+ hasViewPosition: false,
244
+
245
+ // 是否可以进行可视域分析
246
+ isAnalyze: false,
247
+
248
+ // 是否具有初始目标点
249
+ isHasTargetPos: false,
250
+
251
+ // 观察点
252
+ viewPoint: undefined,
253
+
254
+ isDepthTestAgainstTerrainEnable: undefined // 深度检测是否已开启,默认为undefined,当这个值为undefined的时候,说明没有赋值,不做任何处理
255
+ };
256
+ },
257
+ watch: {
258
+ horizontAngle: {
259
+ handler: function(newVal, oldVal) {
260
+ this.formData.horizontAngle = newVal;
261
+ },
262
+ immediate: true
263
+ },
264
+ verticalAngle: {
265
+ handler: function(newVal, oldVal) {
266
+ this.formData.verticalAngle = newVal;
267
+ },
268
+ immediate: true
269
+ },
270
+ unVisibleColor: {
271
+ handler: function(newVal, oldVal) {
272
+ this.formData.unVisibleColor = newVal;
273
+ },
274
+ immediate: true
275
+ },
276
+ visibleColor: {
277
+ handler: function(newVal, oldVal) {
278
+ this.formData.visibleColor = newVal;
279
+ },
280
+ immediate: true
281
+ },
282
+ maskColor: {
283
+ handler: function(newVal, oldVal) {
284
+ this.formData.maskColor = newVal;
285
+ },
286
+ immediate: true
287
+ },
288
+ exHeight: {
289
+ handler: function(newVal, oldVal) {
290
+ this.formData.exHeight = newVal;
291
+ },
292
+ immediate: true
293
+ },
294
+ formData: {
295
+ deep: true,
296
+ handler: function(newVal, oldVal) {
297
+ let { Cesium } = this;
298
+ let find = this.findSource();
299
+ const unVisibleColor = new Cesium.Color.fromCssColorString(
300
+ newVal.unVisibleColor
301
+ );
302
+ const visibleColor = new Cesium.Color.fromCssColorString(
303
+ newVal.visibleColor
304
+ );
305
+ const maskColor = new Cesium.Color.fromCssColorString(newVal.maskColor);
306
+
307
+ if (find.options.visualAnalysis) {
308
+ let visualAnalysis = find.options.visualAnalysis;
309
+ visualAnalysis.unVisibleColor = unVisibleColor;
310
+ visualAnalysis.visibleColor = visibleColor;
311
+ visualAnalysis._fanColor = maskColor;
312
+ visualAnalysis.horizontAngle = newVal.horizontAngle;
313
+ visualAnalysis.verticalAngle = newVal.verticalAngle;
314
+
315
+ if (newVal.exHeight !== oldVal.exHeight) {
316
+ let cartesian = visualAnalysis.viewPosition;
317
+ // 获取当前坐标系标准
318
+ const ellipsoid = this.webGlobe.viewer.scene.globe.ellipsoid;
319
+ // 根据坐标系标准,将笛卡尔坐标转换为地理坐标
320
+ const cartographic = ellipsoid.cartesianToCartographic(cartesian);
321
+ cartographic.height += newVal.exHeight - oldVal.exHeight;
322
+
323
+ cartesian = Cesium.Cartographic.toCartesian(cartographic);
324
+ visualAnalysis.viewPosition = cartesian;
325
+ //赋值给manager
326
+ CesiumZondy.ViewshedAnalysisManager.changeOptions(
327
+ vueKey,
328
+ vueIndex,
329
+ "visualAnalysis",
330
+ visualAnalysis
331
+ );
332
+ // 改变观察点坐标
333
+ this.viewPoint.position._value = cartesian;
334
+ }
335
+ }
336
+ }
337
+ },
338
+ angleSet: {
339
+ deep: true,
340
+ handler: function(newVal) {
341
+ let { vueKey, vueIndex } = this;
342
+ let find = this.findSource();
343
+ if (find && find.options.visualAnalysis) {
344
+ let visualAnalysis = find.options.visualAnalysis;
345
+ visualAnalysis.heading = newVal.heading;
346
+ visualAnalysis.pitch = newVal.pitch;
347
+ visualAnalysis.viewRadius = newVal.viewRadius;
348
+ CesiumZondy.ViewshedAnalysisManager.changeOptions(
349
+ vueKey,
350
+ vueIndex,
351
+ "visualAnalysis",
352
+ visualAnalysis
353
+ );
354
+ this.updateTargetPosition(find.options.visualAnalysis.targetPosition);
355
+ }
356
+ }
357
+ }
358
+ },
359
+ mounted() {
360
+ this.mount();
361
+ },
362
+ destroyed() {
363
+ this.unmount();
364
+ },
365
+ methods: {
366
+ async createCesiumObject() {
367
+ const { baseUrl, options } = this;
368
+ // return new Cesium.GeoJsonDataSource.load(baseUrl, options);
369
+ return new Promise(
370
+ resolve => {
371
+ resolve();
359
372
  },
373
+ reject => {}
374
+ );
375
+ },
376
+ mount() {
377
+ const { webGlobe, CesiumZondy, vueKey, vueIndex } = this;
378
+ const { viewer } = webGlobe;
379
+ const vm = this;
380
+ let promise = this.createCesiumObject();
381
+ promise.then(function(dataSource) {
382
+ vm.$emit("load", vm);
383
+ CesiumZondy.ViewshedAnalysisManager.addSource(
384
+ vueKey,
385
+ vueIndex,
386
+ dataSource,
387
+ {
388
+ visualAnalysis: null
389
+ }
390
+ );
391
+ });
392
+ },
393
+ unmount() {
394
+ let { vueKey, vueIndex } = this;
395
+ this.onClickStop();
396
+ CesiumZondy.ViewshedAnalysisManager.deleteSource(vueKey, vueIndex);
397
+ },
398
+ formDataClone() {
399
+ let vm = this;
400
+ vm.formDataCloneVal = JSON.parse(JSON.stringify(this.formData));
401
+ return vm.formDataCloneVal;
402
+ },
403
+
404
+ // 若分析完成后,当方向角、俯仰角、可视距离变化时,更新目标点坐标
405
+ updateTargetPosition(cartesian) {
406
+ this.convertPosition(cartesian, "target");
360
407
  },
361
- mounted() {
362
- window.viewshed3d = window.viewshed3d || [[], []];
408
+
409
+ // 将三维笛卡尔坐标转换为经纬度坐标
410
+ convertPosition(position, type) {
411
+ // 获取当前坐标系标准
412
+ const ellipsoid = this.webGlobe.viewer.scene.globe.ellipsoid;
413
+ // 根据坐标系标准,将笛卡尔坐标转换为地理坐标
414
+ const cartographic = ellipsoid.cartesianToCartographic(position);
415
+ // 获取高度
416
+ const height = cartographic.height.toFixed(8);
417
+
418
+ // 获取该位置的经纬度坐标
419
+ const centerLon = parseFloat(
420
+ this.Cesium.Math.toDegrees(cartographic.longitude).toFixed(8)
421
+ );
422
+ const centerLat = parseFloat(
423
+ this.Cesium.Math.toDegrees(cartographic.latitude).toFixed(8)
424
+ );
425
+
426
+ if (type === "view") {
427
+ this.posData.viewPositionX = centerLon;
428
+ this.posData.viewPositionY = centerLat;
429
+ this.posData.viewPositionZ = height;
430
+ } else {
431
+ this.posData.targetPositionX = centerLon;
432
+ this.posData.targetPositionY = centerLat;
433
+ this.posData.targetPositionZ = height;
434
+ }
363
435
  },
364
- destroyed() {
365
- const { webGlobe } = this;
436
+
437
+ // 点击开始分析按钮回调
438
+ onClickStart() {
439
+ this.startVisualAnalysis();
440
+
441
+ if (
442
+ this.posData.viewPositionX !== "" &&
443
+ this.posData.viewPositionY !== "" &&
444
+ this.posData.viewPositionZ !== "" &&
445
+ this.posData.targetPositionX !== "" &&
446
+ this.posData.targetPositionY !== "" &&
447
+ this.posData.targetPositionZ !== ""
448
+ ) {
449
+ this.isHasTargetPos = false;
450
+ // 注销鼠标的各项监听事件
451
+ this.webGlobe.unRegisterMouseEvent("MOUSE_MOVE");
452
+ this.webGlobe.unRegisterMouseEvent("LEFT_CLICK");
453
+ this.webGlobe.unRegisterMouseEvent("RIGHT_CLICK");
454
+ this.isAddEventListener = false;
455
+
456
+ this.onInputStart();
457
+ } else if (
458
+ this.posData.viewPositionX === "" &&
459
+ this.posData.viewPositionY === "" &&
460
+ this.posData.viewPositionZ === "" &&
461
+ this.posData.targetPositionX === "" &&
462
+ this.posData.targetPositionY === "" &&
463
+ this.posData.targetPositionZ === ""
464
+ ) {
465
+ this.isHasTargetPos = false;
466
+ this.addEventListener();
467
+ } else if (
468
+ this.posData.viewPositionX !== "" &&
469
+ this.posData.viewPositionY !== "" &&
470
+ this.posData.viewPositionZ !== "" &&
471
+ this.posData.targetPositionX === "" &&
472
+ this.posData.targetPositionY === "" &&
473
+ this.posData.targetPositionZ === ""
474
+ ) {
475
+ this.isHasTargetPos = false;
476
+ let viewCartesian = this.Cesium.Cartesian3.fromDegrees(
477
+ this.posData.viewPositionX,
478
+ this.posData.viewPositionY,
479
+ this.posData.viewPositionZ
480
+ );
481
+
482
+ const cartographic = this.updateExheight(viewCartesian);
483
+ viewCartesian = this.Cesium.Cartographic.toCartesian(cartographic);
484
+
485
+ // window.VisualAnalysisManage.visualAnalysis.viewPosition = viewCartesian;
366
486
  let find = this.findSource();
367
- webGlobe.viewer.scene.VisualAnalysisManager.remove(
368
- window.viewshed3d[this.index][find.index]
487
+ find.options.visualAnalysis.viewPosition = viewCartesian;
488
+
489
+ this.convertPosition(viewCartesian, "view");
490
+ // 添加观察点到地图
491
+ this.addViewPoint(viewCartesian);
492
+ this.hasViewPosition = true;
493
+ this.addEventListener();
494
+ } else if (
495
+ this.posData.viewPositionX === "" &&
496
+ this.posData.viewPositionY === "" &&
497
+ this.posData.viewPositionZ === "" &&
498
+ this.posData.targetPositionX !== "" &&
499
+ this.posData.targetPositionY !== "" &&
500
+ this.posData.targetPositionZ !== ""
501
+ ) {
502
+ this.isHasTargetPos = true;
503
+ this.addEventListener();
504
+ } else {
505
+ this.isHasTargetPos = false;
506
+ this.addEventListener();
507
+ }
508
+ },
509
+
510
+ // 开启可视域分析工具
511
+ startVisualAnalysis() {
512
+ let { webGlobe, Cesium, vueKey, vueIndex } = this;
513
+ const viewer = webGlobe;
514
+ this.isAnalyze = true;
515
+ this.tilesetArray = this.webGlobe._m3dServerLayer;
516
+ //深度检测开启
517
+ this.isDepthTestAgainstTerrainEnable = isDepthTestAgainstTerrainEnable(
518
+ this.webGlobe
519
+ );
520
+ if (!this.isDepthTestAgainstTerrainEnable) {
521
+ // 如果深度检测没有开启,则开启
522
+ setDepthTestAgainstTerrainEnable(true, this.webGlobe);
523
+ }
524
+ // 初始化分析工具
525
+ let find = this.findSource();
526
+ let { options } = find;
527
+ let visualAnalysis = options.visualAnalysis;
528
+ visualAnalysis = new Cesium.ViewshedAnalysis(viewer.scene);
529
+
530
+ // 锁定图层帧数,只显示一个可视域结果
531
+ for (let i = 0; i < this.tilesetArray.length; i++) {
532
+ this.tilesetArray[i][0].debugFreezeFrame = true;
533
+ }
534
+
535
+ // 移除可视域分析结果
536
+ this.webGlobe.viewer.scene.VisualAnalysisManager._visualAnalysisList = [];
537
+
538
+ // 移除所有观察点
539
+ this.webGlobe.viewer.entities.removeAll();
540
+
541
+ // 设置可视域分析工具的配置
542
+ const unVisibleColor = new this.Cesium.Color.fromCssColorString(
543
+ this.formData.unVisibleColor
544
+ );
545
+ const visibleColor = new this.Cesium.Color.fromCssColorString(
546
+ this.formData.visibleColor
547
+ );
548
+ const maskColor = new this.Cesium.Color.fromCssColorString(
549
+ this.formData.maskColor
550
+ );
551
+
552
+ visualAnalysis.horizontAngle = this.formData.horizontAngle;
553
+ visualAnalysis.verticalAngle = this.formData.verticalAngle;
554
+ visualAnalysis._unVisibleColor = unVisibleColor;
555
+ visualAnalysis._visibleColor = visibleColor;
556
+ visualAnalysis._fanColor = maskColor;
557
+
558
+ // 添加可视域分析结果显示
559
+ this.webGlobe.viewer.scene.VisualAnalysisManager.add(visualAnalysis);
560
+ //更新manager
561
+ CesiumZondy.ViewshedAnalysisManager.changeOptions(
562
+ vueKey,
563
+ vueIndex,
564
+ "visualAnalysis",
565
+ visualAnalysis
566
+ );
567
+ },
568
+ // 通过输入坐标开始分析按钮
569
+ onInputStart() {
570
+ let viewCartesian = this.Cesium.Cartesian3.fromDegrees(
571
+ this.posData.viewPositionX,
572
+ this.posData.viewPositionY,
573
+ this.posData.viewPositionZ
574
+ );
575
+
576
+ const cartographic = this.updateExheight(viewCartesian);
577
+ viewCartesian = this.Cesium.Cartographic.toCartesian(cartographic);
578
+
579
+ const targetCartesian = this.Cesium.Cartesian3.fromDegrees(
580
+ this.posData.targetPositionX,
581
+ this.posData.targetPositionY,
582
+ this.posData.targetPositionZ
583
+ );
584
+
585
+ let find = this.findSource();
586
+ find.options.visualAnalysis.viewPosition = viewCartesian;
587
+ find.options.visualAnalysis.targetPosition = targetCartesian;
588
+
589
+ this.setVisualAttrs();
590
+
591
+ // 添加观察点到地图
592
+ this.addViewPoint(viewCartesian);
593
+ },
594
+
595
+ // 获取更新附加高度后的地理坐标
596
+ updateExheight(cartesian) {
597
+ // 获取当前坐标系标准
598
+ const ellipsoid = this.webGlobe.viewer.scene.globe.ellipsoid;
599
+ // 根据坐标系标准,将笛卡尔坐标转换为地理坐标
600
+ const cartographic = ellipsoid.cartesianToCartographic(cartesian);
601
+ // 抬高观察点
602
+ cartographic.height += this.formData.exHeight;
603
+
604
+ return cartographic;
605
+ },
606
+
607
+ // 分析完成时显示方向角、俯仰角、可视距离三种属性
608
+ setVisualAttrs() {
609
+ let find = this.findSource();
610
+ const { heading, pitch, viewRadius } = find.options.visualAnalysis;
611
+
612
+ this.angleSet.heading = heading.toFixed(2);
613
+ this.angleSet.pitch = pitch.toFixed(2);
614
+ this.angleSet.viewRadius = parseInt(viewRadius);
615
+ },
616
+
617
+ // 添加观察点到地图上
618
+ addViewPoint(cartesian) {
619
+ if (this.viewPoint) this.webGlobe.viewer.entities.remove(this.viewPoint);
620
+
621
+ this.viewPoint = this.webGlobe.viewer.entities.add({
622
+ position: cartesian,
623
+ point: {
624
+ color: this.Cesium.Color.BLUE,
625
+ pixelSize: 10
626
+ }
627
+ });
628
+ },
629
+
630
+ /**
631
+ * @description 恢复深度检测设置
632
+ */
633
+ _restoreDepthTestAgainstTerrain() {
634
+ if (
635
+ this.isDepthTestAgainstTerrainEnable !== undefined &&
636
+ this.isDepthTestAgainstTerrainEnable !==
637
+ isDepthTestAgainstTerrainEnable(this.webGlobe)
638
+ ) {
639
+ setDepthTestAgainstTerrainEnable(
640
+ this.isDepthTestAgainstTerrainEnable,
641
+ this.webGlobe
642
+ );
643
+ }
644
+ },
645
+
646
+ // 点击结束分析按钮回调
647
+ onClickStop() {
648
+ let { vueKey, vueIndex } = this;
649
+ // 注销鼠标的各项监听事件
650
+ this.webGlobe.unRegisterMouseEvent("MOUSE_MOVE");
651
+ this.webGlobe.unRegisterMouseEvent("LEFT_CLICK");
652
+ this.webGlobe.unRegisterMouseEvent("RIGHT_CLICK");
653
+
654
+ // 清空观察点与目标点坐标
655
+ this.posData.viewPositionX = "";
656
+ this.posData.viewPositionY = "";
657
+ this.posData.viewPositionZ = "";
658
+ this.posData.targetPositionX = "";
659
+ this.posData.targetPositionY = "";
660
+ this.posData.targetPositionZ = "";
661
+
662
+ // 清空方向角、俯仰角、可视距离
663
+ this.angleSet.heading = 0;
664
+ this.angleSet.pitch = 0;
665
+ this.angleSet.viewRadius = 0;
666
+
667
+ // 移除所有观察点
668
+ this.webGlobe.viewer.entities.removeAll();
669
+
670
+ for (let i = 0; i < (this.tilesetArray || []).length; i++) {
671
+ this.tilesetArray[i][0].debugFreezeFrame = false;
672
+ }
673
+
674
+ // 移除可视域分析工具
675
+ let find = this.findSource();
676
+ if (find && find.options) {
677
+ find.options.visualAnalysis = null;
678
+ }
679
+
680
+ // 移除可视域分析结果
681
+ this.webGlobe.viewer.scene.VisualAnalysisManager._visualAnalysisList = [];
682
+
683
+ this.isAddEventListener = false;
684
+
685
+ //恢复深度检测的原始设置
686
+ this._restoreDepthTestAgainstTerrain();
687
+ this.hasViewPosition = false;
688
+ this.isAnalyze = false;
689
+ },
690
+
691
+ // 为鼠标的各种行为注册监听事件
692
+ addEventListener() {
693
+ if (!this.isAddEventListener) {
694
+ this.webGlobe.registerMouseEvent("MOUSE_MOVE", event => {
695
+ this.registerMouseMoveEvent(event);
696
+ });
697
+ this.webGlobe.registerMouseEvent("LEFT_CLICK", event => {
698
+ this.registerMouseLClickEvent(event);
699
+ });
700
+ this.webGlobe.registerMouseEvent("RIGHT_CLICK", event => {
701
+ this.registerMouseRClickEvent(event);
702
+ });
703
+ this.isAddEventListener = true;
704
+ }
705
+ },
706
+ // 注册可视域分析鼠标移动事件
707
+ registerMouseMoveEvent(event) {
708
+ if (this.hasViewPosition) {
709
+ const cartesian = this.webGlobe.viewer.getCartesian3Position(
710
+ event.endPosition
369
711
  );
370
- delete window.viewshed3d;
371
- window.viewshed3d = [[], []];
712
+ if (cartesian) {
713
+ // 设置可视域结束点坐标
714
+ let find = this.findSource();
715
+ find.options.visualAnalysis.targetPosition = cartesian;
716
+ }
717
+ }
718
+ },
719
+
720
+ // 注册可视域分析鼠标左键点击事件
721
+ registerMouseLClickEvent(event) {
722
+ let cartesian = this.webGlobe.viewer.getCartesian3Position(
723
+ event.position
724
+ );
725
+ let find = this.findSource();
726
+
727
+ if (this.isAnalyze) {
728
+ if (!this.hasViewPosition && cartesian !== undefined) {
729
+ // 若还未选择观察点
730
+ const cartographic = this.updateExheight(cartesian);
731
+ cartesian = this.Cesium.Cartographic.toCartesian(cartographic);
732
+
733
+ // 设置可视域观察点坐标
734
+ find.options.visualAnalysis.viewPosition = cartesian;
735
+ this.convertPosition(cartesian, "view");
736
+
737
+ // 添加观察点到地图
738
+ this.addViewPoint(cartesian);
739
+ this.hasViewPosition = true;
740
+
741
+ // 如果拥有初始目标点,则相当于在选择观察点后,又自动点击了鼠标左键一次来选择目标点
742
+ if (this.isHasTargetPos) {
743
+ const targetCartesian = this.Cesium.Cartesian3.fromDegrees(
744
+ this.posData.targetPositionX,
745
+ this.posData.targetPositionY,
746
+ this.posData.targetPositionZ
747
+ );
748
+ find.options.visualAnalysis.targetPosition = targetCartesian;
749
+
750
+ this.setVisualAttrs();
751
+ this.convertPosition(targetCartesian, "target");
752
+
753
+ this.hasViewPosition = false;
754
+ this.isAnalyze = false;
755
+ }
756
+ } else {
757
+ // 已经选择了观察点,则这次是选择结束点
758
+
759
+ // 设置可视域结束点坐标
760
+ find.options.visualAnalysis.targetPosition = cartesian;
761
+
762
+ this.setVisualAttrs();
763
+ this.convertPosition(cartesian, "target");
764
+
765
+ this.hasViewPosition = false;
766
+ this.isAnalyze = false;
767
+ }
768
+ }
372
769
  },
770
+
771
+ // 注册可视域分析鼠标右键点击事件
772
+ registerMouseRClickEvent(event) {
773
+ const cartesian = this.webGlobe.viewer.getCartesian3Position(
774
+ event.position
775
+ );
776
+ let find = this.findSource();
777
+
778
+ if (this.hasViewPosition) {
779
+ // 设置可视域结束点坐标
780
+ find.options.visualAnalysis.targetPosition = cartesian;
781
+
782
+ this.setVisualAttrs();
783
+ this.convertPosition(cartesian, "target");
784
+ }
785
+
786
+ this.hasViewPosition = false;
787
+ this.isAnalyze = false;
788
+ },
789
+ findSource() {
790
+ let { CesiumZondy, vueKey, vueIndex } = this;
791
+ let find = CesiumZondy.ViewshedAnalysisManager.findSource(
792
+ vueKey,
793
+ vueIndex
794
+ );
795
+ return find;
796
+ }
797
+ }
373
798
  };
374
799
  </script>
375
800
 
376
-
377
801
  <style scoped>
378
- ::v-deep .mapgis-ui-card-body {
379
- max-height: 400px;
380
- overflow: auto;
802
+ .mapgis-widget-visual-analysis {
803
+ /*max-width: calc(42vw);*/
804
+ max-height: calc(60vh);
805
+ overflow-y: auto;
381
806
  }
382
- ::v-deep .mapgis-ui-input-affix-wrapper .mapgis-ui-input:not(:first-child) {
383
- padding-left: 45px;
807
+
808
+ ::v-deep .mapgis-ui-form-item {
809
+ margin-bottom: 0;
384
810
  }
385
- .edit-wrapper-vshed.right {
386
- position: absolute;
387
- top: 20px;
388
- right: 20px;
811
+
812
+ ::v-deep .mapgis-ui-form label {
813
+ font-size: 12px;
814
+ }
815
+
816
+ ::v-deep .mapgis-ui-form-item-label {
817
+ line-height: 40px;
389
818
  }
390
- .edit-wrapper-vshed.left {
391
- position: absolute;
392
- top: 20px;
393
- left: 20px;
819
+
820
+ ::v-deep .mapgis-ui-input {
821
+ padding: 4px 11px;
822
+ }
823
+
824
+ ::v-deep .mapgis-ui-card.mapgis-ui-card-bordered {
825
+ max-height: 100%;
826
+ overflow-y: auto;
394
827
  }
395
- </style>
828
+ </style>