@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,66 @@
|
|
|
1
|
+
const chartOptions = ({ x, y }) => {
|
|
2
|
+
return {
|
|
3
|
+
tooltip: {
|
|
4
|
+
trigger: "axis",
|
|
5
|
+
axisPointer: {
|
|
6
|
+
type: "line",
|
|
7
|
+
lineStyle: {
|
|
8
|
+
color: "#41aeff",
|
|
9
|
+
type: "solid"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
textStyle: {
|
|
13
|
+
fontSize: 10
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
title: {
|
|
17
|
+
show: false
|
|
18
|
+
},
|
|
19
|
+
toolbox: {
|
|
20
|
+
feature: {
|
|
21
|
+
saveAsImage: {
|
|
22
|
+
type: "png",
|
|
23
|
+
show: true,
|
|
24
|
+
title: "保存为图片"
|
|
25
|
+
},
|
|
26
|
+
restore: { show: true, title: "刷新" }
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
grid: {
|
|
30
|
+
top: 20,
|
|
31
|
+
left: 25,
|
|
32
|
+
right: 0,
|
|
33
|
+
bottom: 20,
|
|
34
|
+
contentLabel: false
|
|
35
|
+
},
|
|
36
|
+
xAxis: {
|
|
37
|
+
show: false,
|
|
38
|
+
data: x,
|
|
39
|
+
axisLabel: {
|
|
40
|
+
rotate: 60
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
yAxis: {
|
|
44
|
+
min: 0,
|
|
45
|
+
max: 1,
|
|
46
|
+
splitLine: {
|
|
47
|
+
lineStyle: {
|
|
48
|
+
color: "#d9d9d9",
|
|
49
|
+
type: "dotted"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
series: [
|
|
54
|
+
{
|
|
55
|
+
type: "line",
|
|
56
|
+
data: y,
|
|
57
|
+
smooth: true,
|
|
58
|
+
itemStyle: {
|
|
59
|
+
color: "#40a9ff"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export default chartOptions;
|
|
@@ -1,23 +1,60 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<span
|
|
2
|
+
<span>
|
|
3
|
+
<Popup :position="position" v-model="visible" forceRender>
|
|
4
|
+
<PopupContent
|
|
5
|
+
ref="click"
|
|
6
|
+
:mode="clickMode"
|
|
7
|
+
:currentLayerInfo="currentClickInfo"
|
|
8
|
+
>
|
|
9
|
+
</PopupContent>
|
|
10
|
+
<PopupContent
|
|
11
|
+
ref="hover"
|
|
12
|
+
:mode="hoverMode"
|
|
13
|
+
:currentLayerInfo="currentHoverInfo"
|
|
14
|
+
>
|
|
15
|
+
</PopupContent
|
|
16
|
+
></Popup>
|
|
17
|
+
</span>
|
|
3
18
|
</template>
|
|
4
19
|
|
|
5
20
|
<script>
|
|
6
21
|
import VueOptions from "../../Base/Vue/VueOptions";
|
|
22
|
+
import Popup from "../../UI/Popup/Popup.vue";
|
|
23
|
+
import PopupContent from "../../UI/Geojson/Popup";
|
|
7
24
|
|
|
8
25
|
export default {
|
|
9
26
|
name: "mapgis-3d-geojson-datasource",
|
|
10
27
|
inject: ["Cesium", "CesiumZondy", "webGlobe"],
|
|
11
28
|
props: {
|
|
12
29
|
...VueOptions,
|
|
30
|
+
layerId: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: "矢量图层"
|
|
33
|
+
},
|
|
13
34
|
baseUrl: {
|
|
14
35
|
type: [String, Object],
|
|
15
36
|
required: true
|
|
16
37
|
},
|
|
38
|
+
enablePopup: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
defalut: false
|
|
41
|
+
},
|
|
42
|
+
popupOptions: {
|
|
43
|
+
type: Object
|
|
44
|
+
},
|
|
45
|
+
enableTips: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
defalut: false
|
|
48
|
+
},
|
|
49
|
+
tipsOptions: {
|
|
50
|
+
type: Object
|
|
51
|
+
},
|
|
17
52
|
options: {
|
|
18
53
|
type: Object,
|
|
19
54
|
default: () => {
|
|
20
55
|
return {
|
|
56
|
+
alpha: 0.75,
|
|
57
|
+
fillColor: "#ffff00",
|
|
21
58
|
markerSize: 48,
|
|
22
59
|
strokeWidth: 2,
|
|
23
60
|
clampToGround: true
|
|
@@ -25,6 +62,25 @@ export default {
|
|
|
25
62
|
}
|
|
26
63
|
}
|
|
27
64
|
},
|
|
65
|
+
data() {
|
|
66
|
+
return {
|
|
67
|
+
activeId: undefined,
|
|
68
|
+
visible: false,
|
|
69
|
+
position: {
|
|
70
|
+
longitude: 110,
|
|
71
|
+
latitude: 30,
|
|
72
|
+
height: 0
|
|
73
|
+
},
|
|
74
|
+
currentClickInfo: [],
|
|
75
|
+
currentHoverInfo: [],
|
|
76
|
+
clickMode: "click",
|
|
77
|
+
hoverMode: "hover"
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
components: {
|
|
81
|
+
Popup,
|
|
82
|
+
PopupContent
|
|
83
|
+
},
|
|
28
84
|
mounted() {
|
|
29
85
|
this.mount();
|
|
30
86
|
},
|
|
@@ -37,7 +93,7 @@ export default {
|
|
|
37
93
|
return new Cesium.GeoJsonDataSource.load(baseUrl, options);
|
|
38
94
|
},
|
|
39
95
|
mount() {
|
|
40
|
-
const { webGlobe, CesiumZondy, vueKey, vueIndex } = this;
|
|
96
|
+
const { webGlobe, CesiumZondy, vueKey, vueIndex, enablePopup } = this;
|
|
41
97
|
const { viewer } = webGlobe;
|
|
42
98
|
const vm = this;
|
|
43
99
|
let promise = this.createCesiumObject();
|
|
@@ -45,7 +101,13 @@ export default {
|
|
|
45
101
|
// viewer.zoomTo(dataSource);
|
|
46
102
|
viewer.dataSources.add(dataSource);
|
|
47
103
|
vm.$emit("load", { component: this });
|
|
48
|
-
|
|
104
|
+
let handler;
|
|
105
|
+
if (enablePopup) {
|
|
106
|
+
handler = vm.bindEvent();
|
|
107
|
+
}
|
|
108
|
+
CesiumZondy.GeojsonManager.addSource(vueKey, vueIndex, dataSource, {
|
|
109
|
+
handler: handler
|
|
110
|
+
});
|
|
49
111
|
});
|
|
50
112
|
},
|
|
51
113
|
unmount() {
|
|
@@ -60,6 +122,142 @@ export default {
|
|
|
60
122
|
}
|
|
61
123
|
CesiumZondy.GeojsonManager.deleteSource(vueKey, vueIndex);
|
|
62
124
|
this.$emit("unload", this);
|
|
125
|
+
},
|
|
126
|
+
bindEvent() {
|
|
127
|
+
const vm = this;
|
|
128
|
+
const { Cesium, webGlobe, popupOptions } = this;
|
|
129
|
+
const { viewer } = webGlobe;
|
|
130
|
+
let tempRay = new Cesium.Ray();
|
|
131
|
+
let tempPos = new Cesium.Cartesian3();
|
|
132
|
+
let handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
|
|
133
|
+
handler.setInputAction(function(movement) {
|
|
134
|
+
let foundPosition = false;
|
|
135
|
+
|
|
136
|
+
const scene = viewer.scene;
|
|
137
|
+
if (scene.mode !== Cesium.SceneMode.MORPHING) {
|
|
138
|
+
let cartesian = viewer.scene.pickPosition(movement.position);
|
|
139
|
+
let ray = scene.camera.getPickRay(movement.position, tempRay);
|
|
140
|
+
let cartesian2 = scene.globe.pick(ray, scene, tempPos);
|
|
141
|
+
|
|
142
|
+
// 多选模式
|
|
143
|
+
let entities = scene.drillPick(movement.position);
|
|
144
|
+
// 单选模式
|
|
145
|
+
/* let feature = scene.pick(movement.position);
|
|
146
|
+
if (feature instanceof Cesium.Cesium3DTileFeature) {
|
|
147
|
+
feature.color = Cesium.Color.RED;
|
|
148
|
+
} else if (feature instanceof Cesium.Primitive) {
|
|
149
|
+
let nc = new Cesium.Color.fromCssColorString("#ff0000").withAlpha(
|
|
150
|
+
1.0
|
|
151
|
+
);
|
|
152
|
+
feature.id.polygon.material = nc;
|
|
153
|
+
feature.id.polygon.outline = Cesium.Color.fromCssColorString("#000000");
|
|
154
|
+
} */
|
|
155
|
+
|
|
156
|
+
let longitudeString2, latitudeString2, heightString2;
|
|
157
|
+
|
|
158
|
+
if (Cesium.defined(cartesian2)) {
|
|
159
|
+
let cartographic2 = Cesium.Cartographic.fromCartesian(cartesian2);
|
|
160
|
+
longitudeString2 = Cesium.Math.toDegrees(cartographic2.longitude);
|
|
161
|
+
latitudeString2 = Cesium.Math.toDegrees(cartographic2.latitude);
|
|
162
|
+
heightString2 = cartographic2.height;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (cartesian || cartesian2) {
|
|
166
|
+
vm.visible = true;
|
|
167
|
+
vm.position = {
|
|
168
|
+
longitude: longitudeString2,
|
|
169
|
+
latitude: latitudeString2,
|
|
170
|
+
height: heightString2
|
|
171
|
+
};
|
|
172
|
+
vm.currentClickInfo = entities.map(e => {
|
|
173
|
+
let info = {
|
|
174
|
+
layer: { id: e.id ? e.id.id : "未知数据" },
|
|
175
|
+
properties: {}
|
|
176
|
+
};
|
|
177
|
+
vm.activeId = e.id ? e.id.id : undefined;
|
|
178
|
+
if (e.id && e.id.properties) {
|
|
179
|
+
Object.keys(e.id.properties)
|
|
180
|
+
.filter(p => {
|
|
181
|
+
let inner =
|
|
182
|
+
p.indexOf("Subscription") <= 0 &&
|
|
183
|
+
!["_propertyNames", "_definitionChanged"].find(
|
|
184
|
+
n => n == p
|
|
185
|
+
);
|
|
186
|
+
return inner;
|
|
187
|
+
})
|
|
188
|
+
.forEach(p => {
|
|
189
|
+
let name = p.substr(1);
|
|
190
|
+
info.properties[name] = e.id.properties[p]._value;
|
|
191
|
+
});
|
|
192
|
+
info.layer.id =
|
|
193
|
+
vm.layerId ||
|
|
194
|
+
info.properties["name"] ||
|
|
195
|
+
info.properties["title"];
|
|
196
|
+
let titlefield = popupOptions ? popupOptions.title : undefined;
|
|
197
|
+
if (titlefield) {
|
|
198
|
+
info.title = info.properties[titlefield];
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return info;
|
|
202
|
+
});
|
|
203
|
+
vm.highlight(entities);
|
|
204
|
+
} else {
|
|
205
|
+
vm.visible = false;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
|
209
|
+
return handler;
|
|
210
|
+
},
|
|
211
|
+
highlight(entities) {
|
|
212
|
+
const vm = this;
|
|
213
|
+
const { vueKey, vueIndex } = this;
|
|
214
|
+
const { webGlobe, CesiumZondy, enablePopup, options } = this;
|
|
215
|
+
const { fillColor, alpha } = options;
|
|
216
|
+
let outlineEntity;
|
|
217
|
+
if (!entities || entities.length <= 0 || !enablePopup) return;
|
|
218
|
+
let find = CesiumZondy.GeojsonManager.findSource(vueKey, vueIndex);
|
|
219
|
+
if (!find) return;
|
|
220
|
+
for (let i = 0; i < find.source.entities.values.length; i++) {
|
|
221
|
+
let entity = find.source.entities.values[i];
|
|
222
|
+
if (entity.id != vm.activeId) {
|
|
223
|
+
if (entity.polygon) {
|
|
224
|
+
entity.polygon.material = new Cesium.ColorMaterialProperty(
|
|
225
|
+
Cesium.Color.fromCssColorString(fillColor).withAlpha(alpha)
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
} else {
|
|
229
|
+
if (entity.polygon) {
|
|
230
|
+
outlineEntity = find.options.outlineEntity;
|
|
231
|
+
entity.polygon.material = new Cesium.ColorMaterialProperty(
|
|
232
|
+
Cesium.Color.fromCssColorString("#ff0000")
|
|
233
|
+
);
|
|
234
|
+
entity.polygon.outlineColor = Cesium.Color.fromCssColorString(
|
|
235
|
+
"#ff0000"
|
|
236
|
+
);
|
|
237
|
+
if (outlineEntity) {
|
|
238
|
+
webGlobe.viewer.entities.remove(outlineEntity);
|
|
239
|
+
}
|
|
240
|
+
outlineEntity = new Cesium.Entity({
|
|
241
|
+
polyline: {
|
|
242
|
+
width: 20,
|
|
243
|
+
positions: entity.polygon.hierarchy._value.positions,
|
|
244
|
+
material: new Cesium.PolylineGlowMaterialProperty({
|
|
245
|
+
glowPower: 0.7,
|
|
246
|
+
color: new Cesium.Color.fromCssColorString("#7cc4db")
|
|
247
|
+
}),
|
|
248
|
+
clampToGround: true
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
webGlobe.viewer.entities.add(outlineEntity);
|
|
252
|
+
CesiumZondy.GeojsonManager.changeOptions(
|
|
253
|
+
vueKey,
|
|
254
|
+
vueIndex,
|
|
255
|
+
"outlineEntity",
|
|
256
|
+
outlineEntity
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
63
261
|
}
|
|
64
262
|
}
|
|
65
263
|
};
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span>
|
|
3
|
+
<Popup :position="position" v-model="visible" forceRender>
|
|
4
|
+
<PopupContent
|
|
5
|
+
ref="click"
|
|
6
|
+
:mode="clickMode"
|
|
7
|
+
:currentLayerInfo="currentClickInfo"
|
|
8
|
+
>
|
|
9
|
+
</PopupContent>
|
|
10
|
+
<PopupContent
|
|
11
|
+
ref="hover"
|
|
12
|
+
:mode="hoverMode"
|
|
13
|
+
:currentLayerInfo="currentHoverInfo"
|
|
14
|
+
>
|
|
15
|
+
</PopupContent
|
|
16
|
+
></Popup>
|
|
17
|
+
</span>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
import VueOptions from "../../Base/Vue/VueOptions";
|
|
22
|
+
import Popup from "../../UI/Popup/Popup.vue";
|
|
23
|
+
import PopupContent from "../../UI/Geojson/Popup";
|
|
24
|
+
|
|
25
|
+
import { Style } from "@mapgis/webclient-es6-service";
|
|
26
|
+
const { MarkerStyle, LineStyle, PointStyle, FillStyle } = Style;
|
|
27
|
+
const DefaultActiveImagePlotting =
|
|
28
|
+
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABcCAYAAADNqvPKAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAD4FJREFUeJztXAl0VOUV/mefyWSbLIQtIawBUiAckEVaC7hUT+vpaU9pj7bao6eKR6BFisfl2GprES1Yai1QQaSIu2xVqy0VqIqKIIpWtMWyhoRsk1nfzJu3Te/933uTN1symcwWTu+cm5lkXt77/+//7nfv/d8kevJ/69X0+R5AoVuhAKTTeEFZrgFSQdBr3JDg+9if5Q3AbAOUDBB0I7hJ86x17XsGEg9azsDKFkDaFVdB0QJh1rgl5jn2tepGjecMrEwDpAUmGSgWxa0/GTdywp2NY2Y/esmkGx+bNemW38+adOv908YtXNk4evY0R2k5HqM5XgVNyzIVqKyBlCmAEgGjgkNBubTaUblq+oRrt86bsurVhTP3HbhqdtvN42s/XFQ/dO/8morHvzakYs1l4NeOHLJ70aihezfMmXzuratnd76+8JK3X7isafsfZzcuWTyhbhLpAU0FKxGjMmaZAEgbSlpgKEt+3TT+G89f1rTlwenjj185vPKZmZVlt08sK2oaU2oz1BdbySi7lYwsspCRdgsZAc+18P2oYhupBx9dXEQaym2N0ypKvnlpdfmqG8YO/+DVhTMO/mnu5BUAYh1JDlTGGDUQgJJpDAXmgWnjFuyZP2P/lcMqX5rmKPnO2GKbfVSRjYywWUmN1UKqTCbiMJtIuUn2MmPP63KTkVTAe1XgQywWMhSOrwXwRtttZGKpfeKsCscvbptQ9+Gf501Zfc2IqmGkByitqGcEpHQBSgQO1Zg7JtU3vfz16TuuGl61u6GsaGodTAoBqbSYSYnZSOwmA7Ea9MQEbtTpiB7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/JZmKk9y9Id3IhReAOob6E9JpnyEVK853NXhSyvajAK6ZT+cZds1MnA7UGZF8AnuIa9VMeJvRSaC+02r7zHc75nNk+qkObaqJezP1yRvOIPkaXYGUpBJrjLvOKez/l+SnU1Vkv+dxY9eAwnqvUIHU7uwah5xT2f8/20/Tk8ulE31NuyKujKhfrmrTSuqyIxo15Ni67Ga9TbLejtFR0lRF0nC8rDcufu3ampV7k2eqb/t2syz/WeXL1+M/1p50W0oeHh/hfN4b/d/gYnm2n24iputAAAAABJRU5ErkJggg==";
|
|
31
|
+
|
|
32
|
+
export default {
|
|
33
|
+
name: "mapgis-3d-geojson-layer",
|
|
34
|
+
inject: ["Cesium", "CesiumZondy", "webGlobe"],
|
|
35
|
+
props: {
|
|
36
|
+
...VueOptions,
|
|
37
|
+
layerId: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: "矢量图层"
|
|
40
|
+
},
|
|
41
|
+
baseUrl: {
|
|
42
|
+
type: [String, Object],
|
|
43
|
+
required: true
|
|
44
|
+
},
|
|
45
|
+
enablePopup: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false
|
|
48
|
+
},
|
|
49
|
+
popupOptions: {
|
|
50
|
+
type: Object
|
|
51
|
+
},
|
|
52
|
+
enableTips: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false
|
|
55
|
+
},
|
|
56
|
+
tipsOptions: {
|
|
57
|
+
type: Object
|
|
58
|
+
},
|
|
59
|
+
layerStyle: {
|
|
60
|
+
type: Object,
|
|
61
|
+
default: () => {
|
|
62
|
+
return {};
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
highlightStyle: {
|
|
66
|
+
type: Object,
|
|
67
|
+
default: () => {
|
|
68
|
+
return {
|
|
69
|
+
point: new PointStyle(),
|
|
70
|
+
line: new LineStyle(),
|
|
71
|
+
polygon: new FillStyle()
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
data() {
|
|
77
|
+
return {
|
|
78
|
+
activeId: undefined,
|
|
79
|
+
visible: false,
|
|
80
|
+
position: {
|
|
81
|
+
longitude: 110,
|
|
82
|
+
latitude: 30,
|
|
83
|
+
height: 0
|
|
84
|
+
},
|
|
85
|
+
currentClickInfo: [],
|
|
86
|
+
currentHoverInfo: [],
|
|
87
|
+
clickMode: "click",
|
|
88
|
+
hoverMode: "hover"
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
components: {
|
|
92
|
+
Popup,
|
|
93
|
+
PopupContent
|
|
94
|
+
},
|
|
95
|
+
mounted() {
|
|
96
|
+
this.mount();
|
|
97
|
+
},
|
|
98
|
+
destroyed() {
|
|
99
|
+
this.unmount();
|
|
100
|
+
},
|
|
101
|
+
methods: {
|
|
102
|
+
async createCesiumObject() {
|
|
103
|
+
const { baseUrl, options } = this;
|
|
104
|
+
return new Cesium.GeoJsonDataSource.load(baseUrl, options);
|
|
105
|
+
},
|
|
106
|
+
mount() {
|
|
107
|
+
const { webGlobe, CesiumZondy, vueKey, vueIndex, enablePopup } = this;
|
|
108
|
+
const { viewer } = webGlobe;
|
|
109
|
+
const vm = this;
|
|
110
|
+
let promise = this.createCesiumObject();
|
|
111
|
+
promise.then(function(dataSource) {
|
|
112
|
+
// viewer.zoomTo(dataSource);
|
|
113
|
+
viewer.dataSources.add(dataSource);
|
|
114
|
+
vm.changeColor(dataSource);
|
|
115
|
+
vm.$emit("load", { component: this });
|
|
116
|
+
let handler;
|
|
117
|
+
if (enablePopup) {
|
|
118
|
+
handler = vm.bindEvent();
|
|
119
|
+
}
|
|
120
|
+
CesiumZondy.GeojsonManager.addSource(vueKey, vueIndex, dataSource, {
|
|
121
|
+
handler: handler
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
unmount() {
|
|
126
|
+
let { webGlobe, CesiumZondy, vueKey, vueIndex } = this;
|
|
127
|
+
const { viewer } = webGlobe;
|
|
128
|
+
const { dataSources } = viewer;
|
|
129
|
+
let find = CesiumZondy.GeojsonManager.findSource(vueKey, vueIndex);
|
|
130
|
+
if (find) {
|
|
131
|
+
if (dataSources) {
|
|
132
|
+
dataSources.remove(find.source, true);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
CesiumZondy.GeojsonManager.deleteSource(vueKey, vueIndex);
|
|
136
|
+
this.$emit("unload", this);
|
|
137
|
+
},
|
|
138
|
+
bindEvent() {
|
|
139
|
+
const vm = this;
|
|
140
|
+
const { Cesium, webGlobe, popupOptions } = this;
|
|
141
|
+
const { viewer } = webGlobe;
|
|
142
|
+
let tempRay = new Cesium.Ray();
|
|
143
|
+
let tempPos = new Cesium.Cartesian3();
|
|
144
|
+
let handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
|
|
145
|
+
handler.setInputAction(function(movement) {
|
|
146
|
+
let foundPosition = false;
|
|
147
|
+
|
|
148
|
+
const scene = viewer.scene;
|
|
149
|
+
if (scene.mode !== Cesium.SceneMode.MORPHING) {
|
|
150
|
+
let cartesian = viewer.scene.pickPosition(movement.position);
|
|
151
|
+
let ray = scene.camera.getPickRay(movement.position, tempRay);
|
|
152
|
+
let cartesian2 = scene.globe.pick(ray, scene, tempPos);
|
|
153
|
+
|
|
154
|
+
// 多选模式
|
|
155
|
+
let entities = scene.drillPick(movement.position);
|
|
156
|
+
if (entities.length <= 0) return;
|
|
157
|
+
// 单选模式
|
|
158
|
+
/* let feature = scene.pick(movement.position);
|
|
159
|
+
if (feature instanceof Cesium.Cesium3DTileFeature) {
|
|
160
|
+
feature.color = Cesium.Color.RED;
|
|
161
|
+
} else if (feature instanceof Cesium.Primitive) {
|
|
162
|
+
let nc = new Cesium.Color.fromCssColorString("#ff0000").withAlpha(
|
|
163
|
+
1.0
|
|
164
|
+
);
|
|
165
|
+
feature.id.polygon.material = nc;
|
|
166
|
+
feature.id.polygon.outline = Cesium.Color.fromCssColorString("#000000");
|
|
167
|
+
} */
|
|
168
|
+
|
|
169
|
+
let longitudeString2, latitudeString2, heightString2;
|
|
170
|
+
|
|
171
|
+
if (Cesium.defined(cartesian2)) {
|
|
172
|
+
let cartographic2 = Cesium.Cartographic.fromCartesian(cartesian2);
|
|
173
|
+
longitudeString2 = Cesium.Math.toDegrees(cartographic2.longitude);
|
|
174
|
+
latitudeString2 = Cesium.Math.toDegrees(cartographic2.latitude);
|
|
175
|
+
heightString2 = cartographic2.height;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (cartesian || cartesian2) {
|
|
179
|
+
vm.visible = true;
|
|
180
|
+
vm.position = {
|
|
181
|
+
longitude: longitudeString2,
|
|
182
|
+
latitude: latitudeString2,
|
|
183
|
+
height: heightString2
|
|
184
|
+
};
|
|
185
|
+
vm.currentClickInfo = entities.map(e => {
|
|
186
|
+
let info = {
|
|
187
|
+
layer: { id: e.id ? e.id.id : "未知数据" },
|
|
188
|
+
properties: {}
|
|
189
|
+
};
|
|
190
|
+
vm.activeId = e.id ? e.id.id : undefined;
|
|
191
|
+
if (e.id && e.id.properties) {
|
|
192
|
+
Object.keys(e.id.properties)
|
|
193
|
+
.filter(p => {
|
|
194
|
+
let inner =
|
|
195
|
+
p.indexOf("Subscription") <= 0 &&
|
|
196
|
+
!["_propertyNames", "_definitionChanged"].find(
|
|
197
|
+
n => n == p
|
|
198
|
+
);
|
|
199
|
+
return inner;
|
|
200
|
+
})
|
|
201
|
+
.forEach(p => {
|
|
202
|
+
let name = p.substr(1);
|
|
203
|
+
info.properties[name] = e.id.properties[p]._value;
|
|
204
|
+
});
|
|
205
|
+
info.layer.id =
|
|
206
|
+
vm.layerId ||
|
|
207
|
+
info.properties["name"] ||
|
|
208
|
+
info.properties["title"];
|
|
209
|
+
let titlefield = popupOptions ? popupOptions.title : undefined;
|
|
210
|
+
if (titlefield) {
|
|
211
|
+
info.title = info.properties[titlefield];
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return info;
|
|
215
|
+
});
|
|
216
|
+
vm.highlight(entities);
|
|
217
|
+
} else {
|
|
218
|
+
vm.visible = false;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
|
222
|
+
return handler;
|
|
223
|
+
},
|
|
224
|
+
changeColor(dataSource) {
|
|
225
|
+
let entities = dataSource.entities.values;
|
|
226
|
+
const vm = this;
|
|
227
|
+
const { Cesium, layerStyle } = this;
|
|
228
|
+
const { type } = layerStyle;
|
|
229
|
+
|
|
230
|
+
for (let i = 0; i < entities.length; i++) {
|
|
231
|
+
let entity = entities[i];
|
|
232
|
+
if (type == 'point' || entity.billboard) {
|
|
233
|
+
entity.billboard.show = false;
|
|
234
|
+
const style = layerStyle.toCesiumStyle(Cesium);
|
|
235
|
+
const { material, radius, outline } = style;
|
|
236
|
+
entity.ellipse = new Cesium.EllipseGraphics({
|
|
237
|
+
semiMajorAxis: radius,
|
|
238
|
+
semiMinorAxis: radius,
|
|
239
|
+
outline: outline,
|
|
240
|
+
material: material
|
|
241
|
+
});
|
|
242
|
+
} else if (type == 'line' || entity.polyline) {
|
|
243
|
+
const style = layerStyle.toCesiumStyle(Cesium);
|
|
244
|
+
const { material, width } = style;
|
|
245
|
+
entity.polyline.material = material;
|
|
246
|
+
entity.polyline.width = width;
|
|
247
|
+
} else if (type == 'fill' || entity.polygon) {
|
|
248
|
+
const style = layerStyle.toCesiumStyle(Cesium);
|
|
249
|
+
const { material, outlineColor } = style;
|
|
250
|
+
entity.polygon.material = material;
|
|
251
|
+
entity.polygon.outlineColor = outlineColor;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
highlight(entities) {
|
|
256
|
+
const vm = this;
|
|
257
|
+
const { vueKey, vueIndex } = this;
|
|
258
|
+
const {
|
|
259
|
+
webGlobe,
|
|
260
|
+
Cesium,
|
|
261
|
+
CesiumZondy,
|
|
262
|
+
enablePopup,
|
|
263
|
+
layerStyle,
|
|
264
|
+
highlightStyle
|
|
265
|
+
} = this;
|
|
266
|
+
const { type } = layerStyle;
|
|
267
|
+
const hpolygon = highlightStyle.polygon;
|
|
268
|
+
const hline = highlightStyle.line;
|
|
269
|
+
const hpoint = highlightStyle.point;
|
|
270
|
+
let outlineEntity;
|
|
271
|
+
if (!entities || entities.length <= 0 || !enablePopup) return;
|
|
272
|
+
let find = CesiumZondy.GeojsonManager.findSource(vueKey, vueIndex);
|
|
273
|
+
if (!find) return;
|
|
274
|
+
for (let i = 0; i < find.source.entities.values.length; i++) {
|
|
275
|
+
let entity = find.source.entities.values[i];
|
|
276
|
+
if (entity.id == vm.activeId) {
|
|
277
|
+
if (entity.ellipse) {
|
|
278
|
+
const style = hpoint.toCesiumStyle(Cesium);
|
|
279
|
+
const { material, radius, outline } = style;
|
|
280
|
+
entity.ellipse = new Cesium.EllipseGraphics({
|
|
281
|
+
semiMajorAxis: radius,
|
|
282
|
+
semiMinorAxis: radius,
|
|
283
|
+
outline: outline,
|
|
284
|
+
material: material
|
|
285
|
+
});
|
|
286
|
+
} else if (entity.polyline) {
|
|
287
|
+
const style = hline.toCesiumStyle(Cesium);
|
|
288
|
+
const { material, width } = style;
|
|
289
|
+
entity.polyline.material = material;
|
|
290
|
+
entity.polyline.width = width;
|
|
291
|
+
} else if (entity.polygon) {
|
|
292
|
+
outlineEntity = find.options.outlineEntity;
|
|
293
|
+
const style = hpolygon.toCesiumStyle(Cesium);
|
|
294
|
+
const { material, outlineColor } = style;
|
|
295
|
+
entity.polygon.material = material;
|
|
296
|
+
entity.polygon.outlineColor = outlineColor;
|
|
297
|
+
if (outlineEntity) {
|
|
298
|
+
webGlobe.viewer.entities.remove(outlineEntity);
|
|
299
|
+
}
|
|
300
|
+
outlineEntity = new Cesium.Entity({
|
|
301
|
+
polyline: {
|
|
302
|
+
width: 20,
|
|
303
|
+
positions: entity.polygon.hierarchy._value.positions,
|
|
304
|
+
material: new Cesium.PolylineGlowMaterialProperty({
|
|
305
|
+
glowPower: 0.7,
|
|
306
|
+
color: new Cesium.Color.fromCssColorString("#7cc4db")
|
|
307
|
+
}),
|
|
308
|
+
clampToGround: true
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
webGlobe.viewer.entities.add(outlineEntity);
|
|
312
|
+
CesiumZondy.GeojsonManager.changeOptions(
|
|
313
|
+
vueKey,
|
|
314
|
+
vueIndex,
|
|
315
|
+
"outlineEntity",
|
|
316
|
+
outlineEntity
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
} else {
|
|
320
|
+
if (type == 'point' || entity.ellipse) {
|
|
321
|
+
const style = layerStyle.toCesiumStyle(Cesium);
|
|
322
|
+
const { material, radius, outline } = style;
|
|
323
|
+
entity.ellipse = new Cesium.EllipseGraphics({
|
|
324
|
+
semiMajorAxis: radius,
|
|
325
|
+
semiMinorAxis: radius,
|
|
326
|
+
outline: outline,
|
|
327
|
+
material: material
|
|
328
|
+
});
|
|
329
|
+
} else if (type == 'line' || entity.polyline) {
|
|
330
|
+
const style = layerStyle.toCesiumStyle(Cesium);
|
|
331
|
+
const { material, width } = style;
|
|
332
|
+
entity.polyline.material = material;
|
|
333
|
+
entity.polyline.width = width;
|
|
334
|
+
} else if (type == 'fill' || entity.polygon) {
|
|
335
|
+
const style = layerStyle.toCesiumStyle(Cesium);
|
|
336
|
+
const { material, outlineColor } = style;
|
|
337
|
+
entity.polygon.material = material;
|
|
338
|
+
entity.polygon.outlineColor = outlineColor;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
</script>
|