gis-map-xinjiang 0.0.2 → 0.0.4
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/package.json +6 -14
- package/packages/gisMapXinJiang/component/ClusterList.vue +0 -140
- package/packages/gisMapXinJiang/index.vue +0 -183
- package/packages/gisMapXinJiang/js/icon.js +0 -87
- package/packages/gisMapXinJiang/js/initBaseLayers.js +0 -550
- package/packages/gisMapXinJiang/js/olms.js +0 -28
- package/packages/gisMapXinJiang/js/utills.js +0 -315
- package/packages/index.js +0 -26
- /package/dist/{gismap.es.js → gis-map-xinjiang.mjs} +0 -0
- /package/dist/{gismap.umd.js → gis-map-xinjiang.umd.js} +0 -0
|
@@ -1,550 +0,0 @@
|
|
|
1
|
-
import "ol-ext/dist/ol-ext.css";
|
|
2
|
-
import StrokePattern from "ol-ext/style/StrokePattern";
|
|
3
|
-
import FillPattern from "ol-ext/style/FillPattern";
|
|
4
|
-
import { Feature } from "ol";
|
|
5
|
-
import {
|
|
6
|
-
Tile as TileLayer,
|
|
7
|
-
Vector as VectorLayer,
|
|
8
|
-
Image as ImageLayer,
|
|
9
|
-
Heatmap as HeatmapLayer,
|
|
10
|
-
} from "ol/layer";
|
|
11
|
-
import VectorTileLayer from "ol/layer/VectorTile";
|
|
12
|
-
import {
|
|
13
|
-
Vector as VectorSource,
|
|
14
|
-
TileArcGISRest,
|
|
15
|
-
TileWMS,
|
|
16
|
-
ImageStatic,
|
|
17
|
-
XYZ,
|
|
18
|
-
WMTS,
|
|
19
|
-
ImageCanvas,
|
|
20
|
-
TileImage,
|
|
21
|
-
} from "ol/source";
|
|
22
|
-
import { Point } from "ol/geom";
|
|
23
|
-
import {
|
|
24
|
-
Circle as CircleStyle,
|
|
25
|
-
Fill,
|
|
26
|
-
Stroke,
|
|
27
|
-
Style,
|
|
28
|
-
Text,
|
|
29
|
-
Icon,
|
|
30
|
-
Circle,
|
|
31
|
-
} from "ol/style";
|
|
32
|
-
import { boundingExtent } from "ol/extent";
|
|
33
|
-
import GeoJSON from "ol/format/GeoJSON";
|
|
34
|
-
import MVT from "ol/format/MVT";
|
|
35
|
-
import Overlay from "ol/Overlay";
|
|
36
|
-
import { fromLonLat, transformExtent} from "ol/proj";
|
|
37
|
-
import WMTSTileGrid from "ol/tilegrid/WMTS";
|
|
38
|
-
import { get as getProjection } from "ol/proj";
|
|
39
|
-
import { getTopLeft, getWidth } from "ol/extent";
|
|
40
|
-
import WFS from "ol/format/WFS";
|
|
41
|
-
import proj4 from "proj4";
|
|
42
|
-
import {
|
|
43
|
-
Tianditu,
|
|
44
|
-
TileSuperMapRest,
|
|
45
|
-
VectorTileSuperMapRest,
|
|
46
|
-
MapboxStyles,
|
|
47
|
-
} from "@supermap/iclient-ol";
|
|
48
|
-
import * as echarts from "echarts";
|
|
49
|
-
// import "./olms.js";
|
|
50
|
-
import * as turf from "@turf/turf";
|
|
51
|
-
import EChartsLayer from "ol-echarts";
|
|
52
|
-
import { ref, computed, watch } from 'vue';
|
|
53
|
-
import ClusterList from "../component/ClusterList.vue";
|
|
54
|
-
|
|
55
|
-
// 创建可组合函数替代原来的 mixin
|
|
56
|
-
export function useBaseLayers(mapRef, themeStyleRef, emit) {
|
|
57
|
-
// 响应式数据
|
|
58
|
-
const lastHoverFeature = ref(null); // 记录上一次悬停的要素
|
|
59
|
-
const isCluster = ref(false);
|
|
60
|
-
const echartslayer = ref(null);
|
|
61
|
-
const congestedRoadLayer = ref(null);
|
|
62
|
-
const tiandituLayer = ref(null);
|
|
63
|
-
const overlayPopup = ref(null);
|
|
64
|
-
const initialPoint = ref(null);
|
|
65
|
-
const popupHeight = ref(null);
|
|
66
|
-
const popupWidth = ref(null);
|
|
67
|
-
const china_full_Layer = ref(null);
|
|
68
|
-
const currentTabComponent = ref(null);
|
|
69
|
-
const popupAttributes = ref(null);
|
|
70
|
-
|
|
71
|
-
// URL 和样式配置
|
|
72
|
-
const darkUrl = "http://service.sdmap.gov.cn/tileservice/dsfg_asdxb?";
|
|
73
|
-
const lightUrl = "https://service.sdmap.gov.cn/tileservice/dsfg_qsb?";
|
|
74
|
-
const yingxiangUrl = "https://service.sdmap.gov.cn/tileservice/sdrasterpubmap?";
|
|
75
|
-
const geoJSONUrl = "/china_full.json";
|
|
76
|
-
const xjJSONUrl = "/xinjiang.json";
|
|
77
|
-
const sdAreaUrl = "/sdArea.json";
|
|
78
|
-
const subwayLineUrl = "/ditieline.json";
|
|
79
|
-
const darkFillColor = "#1b2639";
|
|
80
|
-
const lightFillColor = "#eeeee9";
|
|
81
|
-
const yingxiangFillColor = "#adb0aa";
|
|
82
|
-
const darkStrokeColor = "#3578E0";
|
|
83
|
-
const lightStrokeColor = "#b4b4b1";
|
|
84
|
-
const yingxiangStrokeColor = "#d3d3d3";
|
|
85
|
-
|
|
86
|
-
// 计算属性
|
|
87
|
-
const normalizedThemeStyle = computed(() => {
|
|
88
|
-
return ["dark", "light", "yingxiang"].includes(themeStyleRef.value)
|
|
89
|
-
? themeStyleRef.value
|
|
90
|
-
: "dark";
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
// 方法
|
|
94
|
-
const initBaseLayers = () => {
|
|
95
|
-
// 根据当前主题设置初始图层
|
|
96
|
-
let tiandituUrl, fillColor, strokeColor;
|
|
97
|
-
if (normalizedThemeStyle.value === "light") {
|
|
98
|
-
tiandituUrl = lightUrl;
|
|
99
|
-
fillColor = lightFillColor;
|
|
100
|
-
strokeColor = lightStrokeColor;
|
|
101
|
-
} else if (normalizedThemeStyle.value === "yingxiang") {
|
|
102
|
-
tiandituUrl = yingxiangUrl;
|
|
103
|
-
fillColor = yingxiangFillColor;
|
|
104
|
-
strokeColor = yingxiangStrokeColor;
|
|
105
|
-
} else {
|
|
106
|
-
tiandituUrl = darkUrl;
|
|
107
|
-
fillColor = darkFillColor;
|
|
108
|
-
strokeColor = darkStrokeColor;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
tiandituLayer.value = new TileLayer({
|
|
112
|
-
source: new Tianditu({
|
|
113
|
-
url: tiandituUrl,
|
|
114
|
-
key: "d02c0b2c57b4ba04f74cbccbb138f130",
|
|
115
|
-
projection: "EPSG:4326",
|
|
116
|
-
}),
|
|
117
|
-
zIndex: 1,
|
|
118
|
-
});
|
|
119
|
-
mapRef.value.addLayer(tiandituLayer.value);
|
|
120
|
-
|
|
121
|
-
// 测试新疆影像
|
|
122
|
-
let xinjiangYXLayer = new TileLayer({
|
|
123
|
-
layerName: "xinjiangYXLayer",
|
|
124
|
-
source: new TileSuperMapRest({
|
|
125
|
-
url: 'http://10.105.1.49:8090/iserver/services/XJyingxiang_2000/rest/maps/XJyingxiang_2000'
|
|
126
|
-
}),
|
|
127
|
-
zIndex: 12,
|
|
128
|
-
projection: 'EPSG:4326'
|
|
129
|
-
});
|
|
130
|
-
mapRef.value.addLayer(xinjiangYXLayer);
|
|
131
|
-
|
|
132
|
-
// 测试新疆高速路网
|
|
133
|
-
let xinjiangGSLayer = new TileLayer({
|
|
134
|
-
layerName: "xinjiangGSLayer",
|
|
135
|
-
source: new TileSuperMapRest({
|
|
136
|
-
url: 'http://10.105.1.49:8090/iserver/services/map-luxian/rest/maps/年报高速国道'
|
|
137
|
-
}),
|
|
138
|
-
zIndex: 13,
|
|
139
|
-
projection: 'EPSG:4326'
|
|
140
|
-
});
|
|
141
|
-
mapRef.value.addLayer(xinjiangGSLayer);
|
|
142
|
-
|
|
143
|
-
const addXinjiang3DEffect = () => {
|
|
144
|
-
fetch(xjJSONUrl)
|
|
145
|
-
.then(response => response.json())
|
|
146
|
-
.then(data => {
|
|
147
|
-
for (let i = 1; i <= 10; i++) {
|
|
148
|
-
const r = Math.round(5 * (1 - (i-1)/9) + 3 * ((i-1)/9));
|
|
149
|
-
const g = Math.round(126 * (1 - (i-1)/9) + 37 * ((i-1)/9));
|
|
150
|
-
const b = Math.round(230 * (1 - (i-1)/9) + 95 * ((i-1)/9));
|
|
151
|
-
const alpha = 1;
|
|
152
|
-
const shadowLayer = new VectorLayer({
|
|
153
|
-
source: new VectorSource({
|
|
154
|
-
features: new GeoJSON().readFeatures(data, {
|
|
155
|
-
dataProjection: 'EPSG:4326',
|
|
156
|
-
featureProjection: 'EPSG:4326'
|
|
157
|
-
})
|
|
158
|
-
}),
|
|
159
|
-
style: new Style({
|
|
160
|
-
fill: new Fill({
|
|
161
|
-
color: `rgba(${r}, ${g}, ${b}, ${alpha})`
|
|
162
|
-
})
|
|
163
|
-
}),
|
|
164
|
-
zIndex: 11 - i
|
|
165
|
-
});
|
|
166
|
-
shadowLayer.getSource().forEachFeature(feature => {
|
|
167
|
-
const geometry = feature.getGeometry();
|
|
168
|
-
if (geometry) {
|
|
169
|
-
const newGeometry = geometry.clone();
|
|
170
|
-
newGeometry.translate(0, -0.07 * i);
|
|
171
|
-
feature.setGeometry(newGeometry);
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
mapRef.value.addLayer(shadowLayer);
|
|
175
|
-
}
|
|
176
|
-
const topLayer = new VectorLayer({
|
|
177
|
-
source: new VectorSource({
|
|
178
|
-
features: new GeoJSON().readFeatures(data, {
|
|
179
|
-
dataProjection: 'EPSG:4326',
|
|
180
|
-
featureProjection: 'EPSG:4326'
|
|
181
|
-
})
|
|
182
|
-
}),
|
|
183
|
-
style: new Style({
|
|
184
|
-
fill: new Fill({
|
|
185
|
-
color: '#03255F'
|
|
186
|
-
}),
|
|
187
|
-
stroke: new Stroke({
|
|
188
|
-
color: '#057EE6',
|
|
189
|
-
width: 8
|
|
190
|
-
})
|
|
191
|
-
}),
|
|
192
|
-
zIndex: 11
|
|
193
|
-
});
|
|
194
|
-
mapRef.value.addLayer(topLayer);
|
|
195
|
-
})
|
|
196
|
-
.catch(error => {
|
|
197
|
-
console.error('加载新疆区域数据失败:', error);
|
|
198
|
-
});
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
setTimeout(addXinjiang3DEffect, 1000);
|
|
202
|
-
|
|
203
|
-
// 监听点击事件
|
|
204
|
-
mapRef.value.on("click", (e) => {
|
|
205
|
-
let mousePoint = e.coordinate;
|
|
206
|
-
initialPoint.value = mousePoint;
|
|
207
|
-
let popupHeaderTitle = document.getElementById("popupHeaderTitle");
|
|
208
|
-
let feature = mapRef.value.forEachFeatureAtPixel(e.pixel, (feature) => {
|
|
209
|
-
return feature;
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
if (feature) {
|
|
213
|
-
if (feature.getProperties().features) {
|
|
214
|
-
if (feature.getProperties().features.length > 1) {
|
|
215
|
-
const features = feature.getProperties().features;
|
|
216
|
-
if (mapRef.value.getView().getZoom() >= 18) {
|
|
217
|
-
popupHeight.value = 350;
|
|
218
|
-
popupWidth.value = 430;
|
|
219
|
-
currentTabComponent.value = ClusterList;
|
|
220
|
-
popupAttributes.value = features;
|
|
221
|
-
if (popupHeaderTitle) {
|
|
222
|
-
popupHeaderTitle.innerHTML = "";
|
|
223
|
-
popupHeaderTitle.innerHTML = "点位列表";
|
|
224
|
-
}
|
|
225
|
-
// showPopup 函数需要在主组件中实现
|
|
226
|
-
emit('showPopup');
|
|
227
|
-
let fontSize = Number(
|
|
228
|
-
document
|
|
229
|
-
.getElementsByTagName("html")[0]
|
|
230
|
-
.style.fontSize.split("px")[0]
|
|
231
|
-
);
|
|
232
|
-
let popupHeightValue = (popupHeight.value / 153.6) * fontSize;
|
|
233
|
-
let popupWidthValue = (popupWidth.value / 153.6) * fontSize;
|
|
234
|
-
|
|
235
|
-
overlayPopup.value.setPosition(mousePoint);
|
|
236
|
-
overlayPopup.value.setOffset([-popupWidthValue / 2, -popupHeightValue]);
|
|
237
|
-
|
|
238
|
-
let pixelPoint = mapRef.value.getPixelFromCoordinate(mousePoint);
|
|
239
|
-
let newpixelPoint = [pixelPoint[0], pixelPoint[1] - 150];
|
|
240
|
-
let newCenterPoint =
|
|
241
|
-
mapRef.value.getCoordinateFromPixel(newpixelPoint);
|
|
242
|
-
mapRef.value.getView().animate({
|
|
243
|
-
center: newCenterPoint,
|
|
244
|
-
duration: 800,
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
// overlayPopup.set("popupBS", "clusterList");
|
|
248
|
-
} else {
|
|
249
|
-
mapRef.value.getView().animate({
|
|
250
|
-
center: feature.getGeometry().getCoordinates(),
|
|
251
|
-
zoom: mapRef.value.getView().getZoom() * 2,
|
|
252
|
-
duration: 1200,
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
} else {
|
|
256
|
-
let properties = feature
|
|
257
|
-
.getProperties()
|
|
258
|
-
.features[0].getProperties();
|
|
259
|
-
if (properties) {
|
|
260
|
-
if (properties.isDrawn) return;
|
|
261
|
-
if (properties.popoup === false) {
|
|
262
|
-
emit("clickPointEvent", properties);
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
const type = properties.type;
|
|
266
|
-
const data = properties;
|
|
267
|
-
if (type) {
|
|
268
|
-
switch (type) {
|
|
269
|
-
// 根据需要添加 switch 逻辑
|
|
270
|
-
}
|
|
271
|
-
// showPopup 函数需要在主组件中实现
|
|
272
|
-
emit('showPopup');
|
|
273
|
-
}
|
|
274
|
-
} else {
|
|
275
|
-
// closePopup 函数需要在主组件中实现
|
|
276
|
-
emit('closePopup');
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
let fontSize = Number(
|
|
280
|
-
document
|
|
281
|
-
.getElementsByTagName("html")[0]
|
|
282
|
-
.style.fontSize.split("px")[0]
|
|
283
|
-
);
|
|
284
|
-
let popupHeightValue = (popupHeight.value / 153.6) * fontSize;
|
|
285
|
-
let popupWidthValue = (popupWidth.value / 153.6) * fontSize;
|
|
286
|
-
|
|
287
|
-
overlayPopup.value.setPosition(mousePoint);
|
|
288
|
-
overlayPopup.value.setOffset([-popupWidthValue / 2, -popupHeightValue]);
|
|
289
|
-
|
|
290
|
-
let pixelPoint = mapRef.value.getPixelFromCoordinate(mousePoint);
|
|
291
|
-
let newpixelPoint = [pixelPoint[0], pixelPoint[1] - 150];
|
|
292
|
-
let newCenterPoint =
|
|
293
|
-
mapRef.value.getCoordinateFromPixel(newpixelPoint);
|
|
294
|
-
mapRef.value.getView().animate({
|
|
295
|
-
center: newCenterPoint,
|
|
296
|
-
duration: 800,
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
} else {
|
|
300
|
-
let properties = feature.getProperties();
|
|
301
|
-
if (properties) {
|
|
302
|
-
if (properties.isDrawn) return;
|
|
303
|
-
if (properties.popoup === false) {
|
|
304
|
-
emit("clickPointEvent", properties);
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
const type = properties.type;
|
|
308
|
-
if (type) {
|
|
309
|
-
// 根据需要添加 switch 逻辑
|
|
310
|
-
} else {
|
|
311
|
-
// closePopup 函数需要在主组件中实现
|
|
312
|
-
emit('closePopup');
|
|
313
|
-
}
|
|
314
|
-
} else {
|
|
315
|
-
// closePopup 函数需要在主组件中实现
|
|
316
|
-
emit('closePopup');
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
let fontSize = Number(
|
|
320
|
-
document
|
|
321
|
-
.getElementsByTagName("html")[0]
|
|
322
|
-
.style.fontSize.split("px")[0]
|
|
323
|
-
);
|
|
324
|
-
let popupHeightValue = (popupHeight.value / 192) * fontSize;
|
|
325
|
-
let popupWidthValue = (popupWidth.value / 192) * fontSize;
|
|
326
|
-
|
|
327
|
-
overlayPopup.value.setPosition(mousePoint);
|
|
328
|
-
overlayPopup.value.setOffset([-popupWidthValue / 2, -popupHeightValue]);
|
|
329
|
-
let pixelPoint = mapRef.value.getPixelFromCoordinate(mousePoint);
|
|
330
|
-
let newpixelPoint = [pixelPoint[0], pixelPoint[1] - 150];
|
|
331
|
-
let newCenterPoint = mapRef.value.getCoordinateFromPixel(newpixelPoint);
|
|
332
|
-
mapRef.value.getView().animate({
|
|
333
|
-
center: newCenterPoint,
|
|
334
|
-
duration: 800,
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
} else {
|
|
338
|
-
// closePopup 函数需要在主组件中实现
|
|
339
|
-
emit('closePopup');
|
|
340
|
-
}
|
|
341
|
-
});
|
|
342
|
-
|
|
343
|
-
mapRef.value.on("pointermove", (e) => {
|
|
344
|
-
let feature = mapRef.value.forEachFeatureAtPixel(e.pixel, (feature) => {
|
|
345
|
-
return feature;
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
if (feature !== lastHoverFeature.value) {
|
|
349
|
-
if (lastHoverFeature.value) {
|
|
350
|
-
emit(
|
|
351
|
-
"pointerOutEvent",
|
|
352
|
-
lastHoverFeature.value.getProperties()
|
|
353
|
-
);
|
|
354
|
-
}
|
|
355
|
-
if (feature) {
|
|
356
|
-
let pixelPoint = null;
|
|
357
|
-
if (
|
|
358
|
-
feature.getProperties().longitude &&
|
|
359
|
-
feature.getProperties().latitude
|
|
360
|
-
) {
|
|
361
|
-
let latlon = [
|
|
362
|
-
feature.getProperties().longitude,
|
|
363
|
-
feature.getProperties().latitude,
|
|
364
|
-
];
|
|
365
|
-
pixelPoint = mapRef.value.getPixelFromCoordinate(latlon);
|
|
366
|
-
}
|
|
367
|
-
emit("pointerMoveEvent", feature.getProperties(), pixelPoint);
|
|
368
|
-
}
|
|
369
|
-
lastHoverFeature.value = feature;
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
|
-
};
|
|
373
|
-
|
|
374
|
-
// 监听主题样式变化
|
|
375
|
-
watch(themeStyleRef, (val) => {
|
|
376
|
-
if (val === "dark") {
|
|
377
|
-
if (tiandituLayer.value) {
|
|
378
|
-
mapRef.value.removeLayer(tiandituLayer.value);
|
|
379
|
-
if (china_full_Layer.value) {
|
|
380
|
-
mapRef.value.removeLayer(china_full_Layer.value);
|
|
381
|
-
}
|
|
382
|
-
tiandituLayer.value = new TileLayer({
|
|
383
|
-
source: new Tianditu({
|
|
384
|
-
url: darkUrl,
|
|
385
|
-
key: "d02c0b2c57b4ba04f74cbccbb138f130",
|
|
386
|
-
projection: "EPSG:4326",
|
|
387
|
-
}),
|
|
388
|
-
zIndex: 1,
|
|
389
|
-
});
|
|
390
|
-
mapRef.value.addLayer(tiandituLayer.value);
|
|
391
|
-
fetch(geoJSONUrl)
|
|
392
|
-
.then((response) => response.json())
|
|
393
|
-
.then((data) => {
|
|
394
|
-
let geoJSONFormat = new GeoJSON();
|
|
395
|
-
china_full_Layer.value = new VectorLayer({
|
|
396
|
-
layerName: "xxxx",
|
|
397
|
-
source: new VectorSource({
|
|
398
|
-
format: geoJSONFormat,
|
|
399
|
-
features: geoJSONFormat.readFeatures(data, {
|
|
400
|
-
dataProjection: "EPSG:4326",
|
|
401
|
-
featureProjection: "EPSG:4326",
|
|
402
|
-
}),
|
|
403
|
-
}),
|
|
404
|
-
zIndex: 3,
|
|
405
|
-
style: function (feature) {
|
|
406
|
-
return new Style({
|
|
407
|
-
fill: new Fill({
|
|
408
|
-
color: darkFillColor,
|
|
409
|
-
}),
|
|
410
|
-
stroke: new Stroke({
|
|
411
|
-
color: darkStrokeColor,
|
|
412
|
-
width: 1,
|
|
413
|
-
}),
|
|
414
|
-
});
|
|
415
|
-
},
|
|
416
|
-
});
|
|
417
|
-
mapRef.value.addLayer(china_full_Layer.value);
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
} else if (val === "light") {
|
|
421
|
-
mapRef.value.removeLayer(tiandituLayer.value);
|
|
422
|
-
if (china_full_Layer.value) {
|
|
423
|
-
mapRef.value.removeLayer(china_full_Layer.value);
|
|
424
|
-
}
|
|
425
|
-
tiandituLayer.value = new TileLayer({
|
|
426
|
-
source: new Tianditu({
|
|
427
|
-
url: lightUrl,
|
|
428
|
-
key: "d02c0b2c57b4ba04f74cbccbb138f130",
|
|
429
|
-
projection: "EPSG:4326",
|
|
430
|
-
}),
|
|
431
|
-
zIndex: 1,
|
|
432
|
-
});
|
|
433
|
-
mapRef.value.addLayer(tiandituLayer.value);
|
|
434
|
-
|
|
435
|
-
fetch(geoJSONUrl)
|
|
436
|
-
.then((response) => response.json())
|
|
437
|
-
.then((data) => {
|
|
438
|
-
let geoJSONFormat = new GeoJSON();
|
|
439
|
-
china_full_Layer.value = new VectorLayer({
|
|
440
|
-
layerName: "xxxx",
|
|
441
|
-
source: new VectorSource({
|
|
442
|
-
format: geoJSONFormat,
|
|
443
|
-
features: geoJSONFormat.readFeatures(data, {
|
|
444
|
-
dataProjection: "EPSG:4326",
|
|
445
|
-
featureProjection: "EPSG:4326",
|
|
446
|
-
}),
|
|
447
|
-
}),
|
|
448
|
-
zIndex: 3,
|
|
449
|
-
style: function (feature) {
|
|
450
|
-
return new Style({
|
|
451
|
-
fill: new Fill({
|
|
452
|
-
color: lightFillColor,
|
|
453
|
-
}),
|
|
454
|
-
stroke: new Stroke({
|
|
455
|
-
color: lightStrokeColor,
|
|
456
|
-
width: 1,
|
|
457
|
-
}),
|
|
458
|
-
});
|
|
459
|
-
},
|
|
460
|
-
});
|
|
461
|
-
mapRef.value.addLayer(china_full_Layer.value);
|
|
462
|
-
});
|
|
463
|
-
} else if (val === "yingxiang") {
|
|
464
|
-
mapRef.value.removeLayer(tiandituLayer.value);
|
|
465
|
-
if (china_full_Layer.value) {
|
|
466
|
-
mapRef.value.removeLayer(china_full_Layer.value);
|
|
467
|
-
}
|
|
468
|
-
tiandituLayer.value = new TileLayer({
|
|
469
|
-
source: new Tianditu({
|
|
470
|
-
url: yingxiangUrl,
|
|
471
|
-
key: "d02c0b2c57b4ba04f74cbccbb138f130",
|
|
472
|
-
projection: "EPSG:4326",
|
|
473
|
-
}),
|
|
474
|
-
zIndex: 1,
|
|
475
|
-
});
|
|
476
|
-
mapRef.value.addLayer(tiandituLayer.value);
|
|
477
|
-
|
|
478
|
-
fetch(geoJSONUrl)
|
|
479
|
-
.then((response) => response.json())
|
|
480
|
-
.then((data) => {
|
|
481
|
-
let geoJSONFormat = new GeoJSON();
|
|
482
|
-
china_full_Layer.value = new VectorLayer({
|
|
483
|
-
layerName: "xxxx",
|
|
484
|
-
source: new VectorSource({
|
|
485
|
-
format: geoJSONFormat,
|
|
486
|
-
features: geoJSONFormat.readFeatures(data, {
|
|
487
|
-
dataProjection: "EPSG:4326",
|
|
488
|
-
featureProjection: "EPSG:4326",
|
|
489
|
-
}),
|
|
490
|
-
}),
|
|
491
|
-
zIndex: 3,
|
|
492
|
-
style: function (feature) {
|
|
493
|
-
return new Style({
|
|
494
|
-
fill: new Fill({
|
|
495
|
-
color: yingxiangFillColor,
|
|
496
|
-
}),
|
|
497
|
-
stroke: new Stroke({
|
|
498
|
-
color: yingxiangStrokeColor,
|
|
499
|
-
width: 1,
|
|
500
|
-
}),
|
|
501
|
-
});
|
|
502
|
-
},
|
|
503
|
-
});
|
|
504
|
-
mapRef.value.addLayer(china_full_Layer.value);
|
|
505
|
-
});
|
|
506
|
-
}
|
|
507
|
-
});
|
|
508
|
-
|
|
509
|
-
// 返回需要在组件中使用的属性和方法
|
|
510
|
-
return {
|
|
511
|
-
// 数据属性
|
|
512
|
-
lastHoverFeature,
|
|
513
|
-
isCluster,
|
|
514
|
-
echartslayer,
|
|
515
|
-
congestedRoadLayer,
|
|
516
|
-
tiandituLayer,
|
|
517
|
-
overlayPopup,
|
|
518
|
-
initialPoint,
|
|
519
|
-
popupHeight,
|
|
520
|
-
popupWidth,
|
|
521
|
-
china_full_Layer,
|
|
522
|
-
currentTabComponent,
|
|
523
|
-
popupAttributes,
|
|
524
|
-
|
|
525
|
-
// URL 和样式配置
|
|
526
|
-
darkUrl,
|
|
527
|
-
lightUrl,
|
|
528
|
-
yingxiangUrl,
|
|
529
|
-
geoJSONUrl,
|
|
530
|
-
xjJSONUrl,
|
|
531
|
-
sdAreaUrl,
|
|
532
|
-
subwayLineUrl,
|
|
533
|
-
darkFillColor,
|
|
534
|
-
lightFillColor,
|
|
535
|
-
yingxiangFillColor,
|
|
536
|
-
darkStrokeColor,
|
|
537
|
-
lightStrokeColor,
|
|
538
|
-
yingxiangStrokeColor,
|
|
539
|
-
|
|
540
|
-
// 计算属性
|
|
541
|
-
normalizedThemeStyle,
|
|
542
|
-
|
|
543
|
-
// 方法
|
|
544
|
-
initBaseLayers,
|
|
545
|
-
};
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
export default {
|
|
549
|
-
useBaseLayers
|
|
550
|
-
};
|