@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.
- package/README.md +46 -49
- package/dist-libs/webclient-vue-cesium.common.js +191087 -0
- package/dist-libs/webclient-vue-cesium.css +1 -1
- package/dist-libs/webclient-vue-cesium.umd.js +191097 -0
- package/dist-libs/webclient-vue-cesium.umd.min.js +204 -194
- package/docs/.vuepress/config.js +47 -46
- package/docs/README.md +5 -4
- package/docs/api/analysis/Aspect.md +236 -0
- package/docs/api/analysis/Contour.md +240 -0
- package/docs/api/analysis/CutFill.md +306 -0
- package/docs/api/analysis/DynamicSection.md +336 -0
- package/docs/api/analysis/Excavate.md +3 -11
- package/docs/api/analysis/Flood.md +177 -200
- package/docs/api/analysis/HeightLimited.md +7 -4
- package/docs/api/analysis/ParticleEffects.md +549 -0
- package/docs/api/analysis/Profile.md +464 -0
- package/docs/api/analysis/Shadow.md +76 -13
- package/docs/api/analysis/Sightline.md +66 -13
- package/docs/api/analysis/Skyline.md +144 -29
- package/docs/api/analysis/Slope.md +236 -0
- package/docs/api/analysis/Viewshed.md +100 -21
- package/docs/api/layer/IGServer/IgsDocLayer.md +10 -0
- package/docs/api/layer/IGServer/IgsFeatureLayer.md +253 -0
- package/docs/api/layer/IGServer/IgsTileLayer.md +11 -0
- package/docs/api/layer/OGC/CesiumOgcWmsLayer.md +20 -19
- package/docs/api/layer/OGC/Wms.png +0 -0
- package/docs/api/layer/marker/DynamicMarker.md +81 -0
- package/docs/api/layer/marker/dynamicmarker.png +0 -0
- package/docs/api/layer/marker/selects.png +0 -0
- package/docs/api/layer/vectortile/vectortile.md +10 -0
- package/docs/api/m3d/image/layer_control_1.png +0 -0
- package/docs/api/m3d/image/layer_control_2.png +0 -0
- package/docs/api/m3d/image/layer_control_3.png +0 -0
- package/docs/api/m3d/m3d.md +13 -2
- package/docs/api/service/comprehensiveQuery/comprehensiveQuery.md +946 -0
- package/docs/api/ui/draw.md +68 -40
- package/docs/api/ui/link.md +8 -1
- package/docs/api/ui/marker.md +19 -1
- package/docs/api/ui/measure.md +82 -10
- package/docs/api/ui/table.md +6 -6
- package/docs/guide/README.md +26 -23
- package/docs/guide/basemap.md +35 -33
- package/docs/guide/markers&popups.md +46 -53
- package/docs/plugin_components/create_storybook.md +241 -0
- package/docs/plugin_components/img.png +0 -0
- package/docs/plugin_components/img_1.png +0 -0
- package/docs/plugin_components/img_10.png +0 -0
- package/docs/plugin_components/img_2.png +0 -0
- package/docs/plugin_components/img_3.png +0 -0
- package/docs/plugin_components/img_4.png +0 -0
- package/docs/plugin_components/img_5.png +0 -0
- package/docs/plugin_components/img_6.png +0 -0
- package/docs/plugin_components/img_7.png +0 -0
- package/docs/plugin_components/img_8.png +0 -0
- package/docs/version/diff.md +4 -4
- package/docs/version/version.md +81 -0
- package/package.json +5 -5
- package/src/cdn/cdn_component.js +62 -0
- package/src/component.js +20 -2
- package/src/components/Analysis/Aspect.vue +318 -0
- package/src/components/Analysis/Contour.vue +257 -0
- package/src/components/Analysis/CutFill.vue +581 -0
- package/src/components/Analysis/DynamicCutting.vue +98 -59
- package/src/components/Analysis/DynamicSection.vue +494 -0
- package/src/components/Analysis/Excavate.vue +133 -87
- package/src/components/Analysis/Flood.vue +395 -487
- package/src/components/Analysis/Flood.vue-- +630 -0
- package/src/components/Analysis/HeightLimited.vue +66 -47
- package/src/components/Analysis/ModelFlatten.vue +2 -2
- package/src/components/Analysis/Profile.vue +503 -0
- package/src/components/Analysis/Shadow.vue +220 -309
- package/src/components/Analysis/Sightline.vue +393 -375
- package/src/components/Analysis/SkyLine.vue +283 -93
- package/src/components/Analysis/Slope.vue +317 -0
- package/src/components/Analysis/Viewshed.vue +806 -373
- package/src/components/Analysis/skyline2dChartOptions.js +66 -0
- package/src/components/DataSource/Geojson/GeoJsonDataSource.vue +201 -3
- package/src/components/Layer/GeoJSON/GeoJsonLayer.vue +345 -0
- package/src/components/Layer/IGServer/IgsFeatureLayer.vue +227 -0
- package/src/components/Layer/Marker/DynamicMarkerLayer.vue +487 -0
- package/src/components/Layer/Marker/Marker3dPro.vue +196 -0
- package/src/components/Layer/Marker/Marker3dSetPro.vue +67 -0
- package/src/components/Layer/VectorTile/VectorTileLayer.vue +117 -33
- package/src/components/Layer/VectorTile/VectorTileOptions.js +1 -1
- package/src/components/M3D/3DTilesetOptions.js +23 -1
- package/src/components/M3D/G3D.vue +150 -0
- package/src/components/M3D/M3d.vue +142 -32
- package/src/components/M3D/M3dSet.vue +118 -0
- package/src/components/M3D/M3dType.js +24 -0
- package/src/components/Overlay/Mapv3dLayer.vue +2 -0
- package/src/components/Overlay/ParticleEffects.vue +545 -0
- package/src/components/Overlay/mapv/MapvBaseLayer.js +351 -172
- package/src/components/Overlay/mapv/MapvLayer.js +372 -324
- package/src/components/Overlay/mapv/SuperCluster.js +611 -0
- package/src/components/Overlay/themeLayer/heater/CesiumHeater.vue +152 -0
- package/src/components/Overlay/themeLayer/heater/MapvHeater.vue +161 -0
- package/src/components/UI/Controls/Draw/Draw.vue +320 -92
- package/src/components/UI/Controls/Legend/Legend.vue +55 -51
- package/src/components/UI/Controls/Link/Link.vue +59 -37
- package/src/components/UI/Controls/Measure/Measure.vue +75 -33
- package/src/components/UI/Controls/Measure/components/MeasureResult.vue +71 -0
- package/src/components/UI/Controls/Measure/components/MeasureSetting.vue +63 -0
- package/src/components/UI/Controls/Measure/components/MeasureTool.vue +155 -0
- package/src/components/UI/Geojson/Popup.vue +101 -0
- package/src/components/UI/Marker/Marker.vue +185 -48
- package/src/components/UI/Popup/Popup.vue +21 -64
- package/src/components/Utils/common/color-util.js +159 -0
- package/src/components/Utils/util.js +311 -231
- package/src/components/WebGlobe/manager.js +81 -3
- package/src/components/WebGlobe/mixins/withPrivateMethods.js +4 -2
- package/src/components/WebGlobe/util.js +173 -0
- package/src/components/service/comprehensive-query/ComprehensiveQuery.vue +156 -0
- package/src/components/service/comprehensive-query/PlaceNameCesium.vue +102 -0
- package/src/components/service/comprehensive-query/util/catalog/document.js +626 -0
- package/src/components/service/comprehensive-query/util/feature/arcgis-feature-query.js +448 -0
- package/src/components/service/comprehensive-query/util/feature/feature-convert.js +408 -0
- package/src/components/service/comprehensive-query/util/feature/feature-edit.js +50 -0
- package/src/components/service/comprehensive-query/util/feature/feature-geojson.js +100 -0
- package/src/components/service/comprehensive-query/util/feature/feature-query.js +723 -0
- package/src/components/service/comprehensive-query/util/feature/feature.js +1 -0
- package/src/components/service/comprehensive-query/util/feature/index.js +9 -0
- package/src/components/service/comprehensive-query/util/objects/geometry.js +58 -0
- package/src/components/Overlay/Mapv.vue +0 -142
- package/src/components/Overlay/MapvHeater.vue +0 -98
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<mp-3d-marker-pro
|
|
4
|
+
v-for="marker in markers"
|
|
5
|
+
:vue-key="vueKey"
|
|
6
|
+
:key="marker.fid"
|
|
7
|
+
:marker="marker"
|
|
8
|
+
:current-marker-id="currentMarkerId"
|
|
9
|
+
:field-configs="fieldConfigs"
|
|
10
|
+
@marker-id="updateCurrentMarkerId"
|
|
11
|
+
@mouseenter="mouseEnterEvent"
|
|
12
|
+
@mouseleave="mouseLeaveEvent"
|
|
13
|
+
@change="changePopup"
|
|
14
|
+
@popupload="popupLoad"
|
|
15
|
+
>
|
|
16
|
+
<template slot="popup" slot-scope="slotProps">
|
|
17
|
+
<slot name="popup" v-bind="slotProps"></slot>
|
|
18
|
+
</template>
|
|
19
|
+
</mp-3d-marker-pro>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
import Mp3dMarkerPro from './Marker3dPro.vue'
|
|
25
|
+
|
|
26
|
+
export default {
|
|
27
|
+
name: 'mapgis-3d-marker-set-pro',
|
|
28
|
+
components: { Mp3dMarkerPro },
|
|
29
|
+
props: {
|
|
30
|
+
vueKey: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: 'default'
|
|
33
|
+
},
|
|
34
|
+
markers: {
|
|
35
|
+
type: Array,
|
|
36
|
+
required: true
|
|
37
|
+
},
|
|
38
|
+
fieldConfigs: {
|
|
39
|
+
type: Array,
|
|
40
|
+
required: false,
|
|
41
|
+
default: () => []
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
data() {
|
|
45
|
+
return {
|
|
46
|
+
currentMarkerId: ''
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
methods: {
|
|
50
|
+
updateCurrentMarkerId(id) {
|
|
51
|
+
this.currentMarkerId = id
|
|
52
|
+
},
|
|
53
|
+
mouseEnterEvent(e, id) {
|
|
54
|
+
this.$emit('mouseenter', e, id)
|
|
55
|
+
},
|
|
56
|
+
mouseLeaveEvent(e, id) {
|
|
57
|
+
this.$emit('mouseleave', e, id)
|
|
58
|
+
},
|
|
59
|
+
popupLoad(fid) {
|
|
60
|
+
this.$emit('popupload', fid)
|
|
61
|
+
},
|
|
62
|
+
changePopup(val) {
|
|
63
|
+
this.currentMarkerId = val
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
</script>
|
|
@@ -1,32 +1,78 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import VectorTileOptions from "./VectorTileOptions";
|
|
3
|
+
import ServiceLayer from "../ServiceLayer";
|
|
4
|
+
import clonedeep from 'lodash.clonedeep'
|
|
5
|
+
|
|
3
6
|
export default {
|
|
4
7
|
name: "mapgis-3d-vectortile-layer",
|
|
8
|
+
mixins: [ServiceLayer],
|
|
5
9
|
props: { ...VectorTileOptions },
|
|
10
|
+
data() {
|
|
11
|
+
return {
|
|
12
|
+
managerName: "VectorTileManager"
|
|
13
|
+
};
|
|
14
|
+
},
|
|
6
15
|
inject: ["Cesium", "webGlobe", "CesiumZondy"],
|
|
7
16
|
created() {},
|
|
8
17
|
mounted() {
|
|
9
|
-
this
|
|
18
|
+
this.$_mount();
|
|
10
19
|
this.watchProp();
|
|
11
20
|
},
|
|
12
21
|
destroyed() {
|
|
13
|
-
this
|
|
22
|
+
this.$_unmount();
|
|
23
|
+
},
|
|
24
|
+
watch: {
|
|
25
|
+
layerStyle: {
|
|
26
|
+
handler: function(next, old) {
|
|
27
|
+
let { vueKey, vueIndex } = this;
|
|
28
|
+
let layer = window.CesiumZondy[this.managerName].findSource(
|
|
29
|
+
vueKey,
|
|
30
|
+
vueIndex
|
|
31
|
+
);
|
|
32
|
+
if (this.layerStyleCopy.visible !== this.layerStyle.visible) {
|
|
33
|
+
layer.source.show = this.layerStyle.visible;
|
|
34
|
+
}
|
|
35
|
+
if (this.layerStyleCopy.opacity !== this.layerStyle.opacity) {
|
|
36
|
+
layer.source.alpha = this.layerStyle.opacity;
|
|
37
|
+
}
|
|
38
|
+
if (this.layerStyleCopy.zIndex !== this.layerStyle.zIndex) {
|
|
39
|
+
this.$_moveLayer();
|
|
40
|
+
}
|
|
41
|
+
this.layerStyleCopy = clonedeep(next);
|
|
42
|
+
},
|
|
43
|
+
deep: true
|
|
44
|
+
}
|
|
14
45
|
},
|
|
15
46
|
methods: {
|
|
16
|
-
|
|
47
|
+
/* layerLoaded(e) {
|
|
48
|
+
console.log("layerLoaded", e);
|
|
49
|
+
}, */
|
|
50
|
+
async createCesiumObject() {
|
|
17
51
|
const { $props, webGlobe, CesiumZondy } = this;
|
|
18
52
|
const { tilingScheme } = $props;
|
|
19
53
|
const viewer = webGlobe.viewer;
|
|
20
54
|
let tileScheme;
|
|
21
|
-
|
|
22
|
-
if (typeof tilingScheme ===
|
|
55
|
+
|
|
56
|
+
if (typeof tilingScheme === "string") {
|
|
23
57
|
tileScheme = this.checkTiling(tilingScheme);
|
|
24
58
|
} else {
|
|
25
59
|
tileScheme = tilingScheme;
|
|
26
60
|
}
|
|
27
61
|
|
|
28
|
-
|
|
29
|
-
|
|
62
|
+
return new Promise(
|
|
63
|
+
resolve => {
|
|
64
|
+
let vectortile;
|
|
65
|
+
const opt = {
|
|
66
|
+
...$props,
|
|
67
|
+
tilingScheme: tileScheme,
|
|
68
|
+
callback: () => {
|
|
69
|
+
resolve(vectortile);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
vectortile = new CesiumZondy.Overlayer.VectorTileLayer(viewer, opt);
|
|
73
|
+
},
|
|
74
|
+
reject => {}
|
|
75
|
+
);
|
|
30
76
|
},
|
|
31
77
|
checkTiling(tileMatrixSetName) {
|
|
32
78
|
let tilingScheme;
|
|
@@ -52,16 +98,13 @@ export default {
|
|
|
52
98
|
vueIndex,
|
|
53
99
|
show,
|
|
54
100
|
mvtStyle,
|
|
55
|
-
vectortilejson
|
|
101
|
+
vectortilejson
|
|
56
102
|
} = this;
|
|
57
103
|
const viewer = webGlobe.viewer;
|
|
58
|
-
let find = CesiumZondy.VectorTileManager.findSource(
|
|
59
|
-
vueKey,
|
|
60
|
-
vueIndex
|
|
61
|
-
);
|
|
104
|
+
let find = CesiumZondy.VectorTileManager.findSource(vueKey, vueIndex);
|
|
62
105
|
|
|
63
106
|
if (show) {
|
|
64
|
-
this.$watch("show", function
|
|
107
|
+
this.$watch("show", function(next) {
|
|
65
108
|
if (this.initial) return;
|
|
66
109
|
if (find) {
|
|
67
110
|
!viewer.isDestroyed() && find.source.setVisible(next);
|
|
@@ -75,7 +118,7 @@ export default {
|
|
|
75
118
|
!viewer.isDestroyed() && this.$vectortile.updateStyle(nextStyle);
|
|
76
119
|
}
|
|
77
120
|
},
|
|
78
|
-
deep: true
|
|
121
|
+
deep: true
|
|
79
122
|
});
|
|
80
123
|
}
|
|
81
124
|
if (vectortilejson) {
|
|
@@ -85,46 +128,87 @@ export default {
|
|
|
85
128
|
!viewer.isDestroyed() && this.$vectortile.updateStyle(nextStyle);
|
|
86
129
|
}
|
|
87
130
|
},
|
|
88
|
-
deep: true
|
|
131
|
+
deep: true
|
|
89
132
|
});
|
|
90
133
|
}
|
|
91
134
|
},
|
|
92
135
|
updateStyle(style) {
|
|
93
136
|
this.$vectortile.updateStyle(style);
|
|
94
137
|
},
|
|
95
|
-
|
|
138
|
+
provider() {
|
|
139
|
+
return this.$vectortile ? this.$vectortile.provider : undefined;
|
|
140
|
+
},
|
|
141
|
+
$_mount() {
|
|
96
142
|
const { webGlobe, vueIndex, vueKey, CesiumZondy } = this;
|
|
143
|
+
const { layerStyle } = this;
|
|
144
|
+
const { visible, opacity, zIndex } = layerStyle;
|
|
145
|
+
//取得webGlobe对象,防止当页面有多个webGlobe只会取得
|
|
146
|
+
let webGlobeObj = this.$_getWebGlobe();
|
|
147
|
+
const { imageryLayers } = webGlobeObj.viewer;
|
|
97
148
|
const viewer = webGlobe.viewer;
|
|
98
149
|
|
|
99
150
|
if (viewer.isDestroyed()) return;
|
|
100
151
|
this.$emit("load", this);
|
|
152
|
+
const vm = this;
|
|
153
|
+
let promise = this.createCesiumObject();
|
|
154
|
+
promise.then(vectortile => {
|
|
155
|
+
vm.$vectortile = vectortile;
|
|
156
|
+
let imageryLayer = vectortile.provider;
|
|
101
157
|
|
|
102
|
-
|
|
103
|
-
|
|
158
|
+
if (vueKey && vueIndex) {
|
|
159
|
+
CesiumZondy.VectorTileManager.addSource(
|
|
160
|
+
vueKey,
|
|
161
|
+
vueIndex,
|
|
162
|
+
imageryLayer,
|
|
163
|
+
{ vectortile }
|
|
164
|
+
);
|
|
165
|
+
}
|
|
104
166
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
167
|
+
//初始化imageryLayers.addImageryProvider需要的index
|
|
168
|
+
let providerZIndex;
|
|
169
|
+
if (zIndex < 0) {
|
|
170
|
+
throw new Error("zIndex不能为负数");
|
|
171
|
+
} else if (!zIndex) {
|
|
172
|
+
//如果没有设置layerStyle.zIndex,则layer的zIndex统一设置为0,并且按照初始化的顺序向上叠放
|
|
173
|
+
providerZIndex = 0;
|
|
174
|
+
} else {
|
|
175
|
+
//确定zIndex不能重复
|
|
176
|
+
vm.$_checkZIndex(imageryLayers);
|
|
177
|
+
//如果有layerStyle.zIndex,则layer的zIndex为layerStyle.zIndex
|
|
178
|
+
providerZIndex = zIndex;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
//如果有zIndex,则保证zIndex大于0的layer始终在zIndex为0的layer上面,并按照zIndex从大到小排序
|
|
182
|
+
//如果没有zIndex,则按初始化顺序向上叠放,如果在此layer的下方含有zIndex大于0的layer,则layer向下一层,直到下方没有包含zIndex大于0的layer
|
|
183
|
+
//只会根据imageryLayers排序,不会影响其他图层
|
|
184
|
+
vm.$_initLayerIndex();
|
|
185
|
+
|
|
186
|
+
//设置图层是否可见
|
|
187
|
+
if (typeof visible === "boolean") {
|
|
188
|
+
imageryLayer.show = visible;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
//设置涂层的透明度
|
|
192
|
+
if (typeof opacity === "number") {
|
|
193
|
+
imageryLayer.alpha = opacity;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
//得到layerStyle的副本,供watch使用
|
|
197
|
+
vm.layerStyleCopy = clonedeep(layerStyle);
|
|
198
|
+
});
|
|
112
199
|
},
|
|
113
|
-
|
|
200
|
+
$_unmount() {
|
|
114
201
|
const { webGlobe, vueKey, vueIndex, CesiumZondy } = this;
|
|
115
202
|
const viewer = webGlobe.viewer;
|
|
116
|
-
let find = CesiumZondy.VectorTileManager.findSource(
|
|
117
|
-
vueKey,
|
|
118
|
-
vueIndex
|
|
119
|
-
);
|
|
203
|
+
let find = CesiumZondy.VectorTileManager.findSource(vueKey, vueIndex);
|
|
120
204
|
if (find) {
|
|
121
|
-
!viewer.isDestroyed() && find.
|
|
205
|
+
!viewer.isDestroyed() && find.options.vectortile.destroy();
|
|
122
206
|
}
|
|
123
207
|
CesiumZondy.VectorTileManager.deleteSource(vueKey, vueIndex);
|
|
124
|
-
}
|
|
208
|
+
}
|
|
125
209
|
},
|
|
126
210
|
render(createElement) {
|
|
127
211
|
return createElement("span");
|
|
128
|
-
}
|
|
212
|
+
}
|
|
129
213
|
};
|
|
130
214
|
</script>
|
|
@@ -14,6 +14,28 @@ export default {
|
|
|
14
14
|
type: [String, Number],
|
|
15
15
|
default: () => (Math.random() * 100000000).toFixed(0)
|
|
16
16
|
},
|
|
17
|
+
|
|
18
|
+
enableTips: {},
|
|
19
|
+
enablePopup: {},
|
|
20
|
+
tipsOptions: {
|
|
21
|
+
type: Object,
|
|
22
|
+
default: () => {
|
|
23
|
+
return { title: "name" };
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
popupOptions: {
|
|
27
|
+
type: Object,
|
|
28
|
+
default: () => {
|
|
29
|
+
return { title: "name" };
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
highlightStyle: {},
|
|
34
|
+
|
|
35
|
+
layers: {
|
|
36
|
+
type: [String],
|
|
37
|
+
default: undefined
|
|
38
|
+
},
|
|
17
39
|
/**
|
|
18
40
|
* @type Cesium.Resource.headers
|
|
19
41
|
* @example headers: { "szvsud-license-key": '3AE2IROq5nGn5K/+zQlUxSoHoNdjCoS1l5567rK5SKjHfRbQIvhtbInd7S9X6bFl' },
|
|
@@ -21,7 +43,7 @@ export default {
|
|
|
21
43
|
headers: {},
|
|
22
44
|
url: { type: String, required: true },
|
|
23
45
|
show: { type: Boolean, default: true },
|
|
24
|
-
opacity
|
|
46
|
+
opacity: { type: Number },
|
|
25
47
|
autoReset: { type: Boolean, default: true },
|
|
26
48
|
|
|
27
49
|
/**
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Tileset3dOptions from "./3DTilesetOptions";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
name: "mapgis-3d-igs-m3d",
|
|
6
|
+
inject: ["Cesium", "CesiumZondy", "webGlobe"],
|
|
7
|
+
props: {
|
|
8
|
+
...Tileset3dOptions
|
|
9
|
+
},
|
|
10
|
+
created() {},
|
|
11
|
+
mounted() {
|
|
12
|
+
this.mount();
|
|
13
|
+
this.watchProp();
|
|
14
|
+
},
|
|
15
|
+
destroyed() {
|
|
16
|
+
this.unmount();
|
|
17
|
+
},
|
|
18
|
+
methods: {
|
|
19
|
+
createCesiumObject() {
|
|
20
|
+
const { CesiumZondy, webGlobe } = this;
|
|
21
|
+
let m3dLayer = new CesiumZondy.Layer.M3DLayer({
|
|
22
|
+
viewer: webGlobe.viewer
|
|
23
|
+
});
|
|
24
|
+
return m3dLayer;
|
|
25
|
+
},
|
|
26
|
+
watchProp() {
|
|
27
|
+
let { show, opacity } = this;
|
|
28
|
+
if (show) {
|
|
29
|
+
this.$watch("show", function(next) {
|
|
30
|
+
if (this.initial) return;
|
|
31
|
+
this.changeShow(next);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
if (opacity >= 0 && opacity <= 1) {
|
|
35
|
+
this.$watch("opacity", function(next) {
|
|
36
|
+
if (this.initial) return;
|
|
37
|
+
this.changeOpacity(next);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
onM3dLoaded(e) {},
|
|
42
|
+
mount() {
|
|
43
|
+
const vm = this;
|
|
44
|
+
const {
|
|
45
|
+
webGlobe,
|
|
46
|
+
vueIndex,
|
|
47
|
+
vueKey,
|
|
48
|
+
$props,
|
|
49
|
+
offset,
|
|
50
|
+
scale,
|
|
51
|
+
opacity
|
|
52
|
+
} = this;
|
|
53
|
+
const viewer = webGlobe.viewer;
|
|
54
|
+
|
|
55
|
+
if (viewer.isDestroyed()) return;
|
|
56
|
+
// this.$emit("load", { component: this });
|
|
57
|
+
|
|
58
|
+
let m3dLayer = this.createCesiumObject();
|
|
59
|
+
let m3ds = m3dLayer.append(`${this.url}`, {
|
|
60
|
+
...$props,
|
|
61
|
+
loaded: tileset => {
|
|
62
|
+
if (vueKey && vueIndex) {
|
|
63
|
+
CesiumZondy.M3DIgsManager.addSource(vueKey, vueIndex, m3ds);
|
|
64
|
+
!vm.show && m3ds && m3ds.forEach(m3d => (m3d.show = vm.show));
|
|
65
|
+
}
|
|
66
|
+
if (offset) {
|
|
67
|
+
let boundingSphere = tileset.boundingSphere;
|
|
68
|
+
let cartographic = Cesium.Cartographic.fromCartesian(
|
|
69
|
+
boundingSphere.center
|
|
70
|
+
);
|
|
71
|
+
let surface = Cesium.Cartesian3.fromRadians(
|
|
72
|
+
cartographic.longitude,
|
|
73
|
+
cartographic.latitude,
|
|
74
|
+
0.0
|
|
75
|
+
);
|
|
76
|
+
let { longitude = 0, latitude = 0, height = 0 } = offset;
|
|
77
|
+
let offsetParam = Cesium.Cartesian3.fromRadians(
|
|
78
|
+
cartographic.longitude + longitude,
|
|
79
|
+
cartographic.latitude + latitude,
|
|
80
|
+
height
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
let translation = Cesium.Cartesian3.subtract(
|
|
84
|
+
offsetParam,
|
|
85
|
+
surface,
|
|
86
|
+
new Cesium.Cartesian3()
|
|
87
|
+
);
|
|
88
|
+
tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
|
|
89
|
+
}
|
|
90
|
+
if (scale) {
|
|
91
|
+
tileset.setScale(new Cesium.Cartesian3(scale.x, scale.y, scale.z));
|
|
92
|
+
}
|
|
93
|
+
if (opacity >= 0) {
|
|
94
|
+
m3ds.forEach(
|
|
95
|
+
m3d =>
|
|
96
|
+
(m3d.style = new Cesium.Cesium3DTileStyle({
|
|
97
|
+
color: `color('#FFFFFF', ${opacity})`
|
|
98
|
+
}))
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
vm.$emit("loaded", { tileset: tileset, m3ds: m3ds });
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
},
|
|
105
|
+
unmount() {
|
|
106
|
+
const { webGlobe, CesiumZondy, vueKey, vueIndex } = this;
|
|
107
|
+
const viewer = webGlobe.viewer;
|
|
108
|
+
let find = CesiumZondy.M3DIgsManager.findSource(vueKey, vueIndex);
|
|
109
|
+
if (find) {
|
|
110
|
+
let m3ds = find.source;
|
|
111
|
+
!viewer.isDestroyed() &&
|
|
112
|
+
m3ds &&
|
|
113
|
+
m3ds.forEach(l => {
|
|
114
|
+
l.destroy();
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
this.$emit("unload", { component: this });
|
|
118
|
+
CesiumZondy.M3DIgsManager.deleteSource(vueKey, vueIndex);
|
|
119
|
+
},
|
|
120
|
+
changeShow(show) {
|
|
121
|
+
const { vueKey, vueIndex } = this;
|
|
122
|
+
let find = CesiumZondy.M3DIgsManager.findSource(vueKey, vueIndex);
|
|
123
|
+
if (find) {
|
|
124
|
+
let m3ds = find.source;
|
|
125
|
+
m3ds && m3ds.forEach(m3d => (m3d.show = show));
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
changeOpacity(opacity) {
|
|
129
|
+
const { vueKey, vueIndex } = this;
|
|
130
|
+
let find = CesiumZondy.M3DIgsManager.findSource(vueKey, vueIndex);
|
|
131
|
+
console.log('find', find.source);
|
|
132
|
+
if (find) {
|
|
133
|
+
let m3ds = find.source;
|
|
134
|
+
m3ds &&
|
|
135
|
+
m3ds.forEach(m3d => {
|
|
136
|
+
m3d.style = new Cesium.Cesium3DTileStyle({
|
|
137
|
+
color: `color('#FFFFFF', ${opacity})`
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
render(h) {
|
|
144
|
+
return h("span", {
|
|
145
|
+
class: "mapgis-3d-igs-m3d",
|
|
146
|
+
ref: "m3d"
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
</script>
|