vue-openlayers-plugin 1.0.71 → 1.0.73
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/lib/{index-be67894d.mjs → index-363194c0.mjs} +462 -99
- package/lib/{index.es-77890a7c.mjs → index.es-a7ad7c48.mjs} +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.umd.js +461 -98
- package/package.json +1 -1
- package/types/src/components/CustomOpenlayer/components/MapPopup/ArrayPopup.vue.d.ts +1 -0
- package/types/src/components/CustomOpenlayer/components/MapPopup/ArrayPopup.vue.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/components/MapPopup/BasePopup.vue.d.ts +1 -0
- package/types/src/components/CustomOpenlayer/components/MapPopup/BasePopup.vue.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/components/MapPopup/HtmlPopup.vue.d.ts +1 -0
- package/types/src/components/CustomOpenlayer/components/MapPopup/HtmlPopup.vue.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/components/MapPopup/ImagePopup.vue.d.ts +1 -0
- package/types/src/components/CustomOpenlayer/components/MapPopup/ImagePopup.vue.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/components/MapPopup/PopupManager.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/components/MapPopup/types.d.ts +12 -2
- package/types/src/components/CustomOpenlayer/components/MapPopup/types.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/components/dialogs/LayerPanel.vue.d.ts +46 -164
- package/types/src/components/CustomOpenlayer/components/dialogs/LayerPanel.vue.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/types/index.d.ts +24 -3
- package/types/src/components/CustomOpenlayer/types/index.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/LayerManager.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/LayerTreeManager.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/coordinateTransform.d.ts +28 -0
- package/types/src/components/CustomOpenlayer/utils/coordinateTransform.d.ts.map +1 -0
- package/types/src/components/CustomOpenlayer/utils/index.d.ts +1 -0
- package/types/src/components/CustomOpenlayer/utils/index.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/layerManager.d.ts +13 -0
- package/types/src/components/CustomOpenlayer/utils/layers/BaseLayer.d.ts +5 -0
- package/types/src/components/CustomOpenlayer/utils/layers/BaseLayer.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/layers/GMLLayerHandler.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/layers/GeoJSONLayerHandler.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/layers/KMLLayerHandler.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/layers/TiandituLayerHandler.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/layers/TileLayerHandler.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/layers/VectorTileLayerHandler.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/layers/WKTLayerHandler.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/layers/WMSLayerHandler.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/layers/WMTSLayerHandler.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/mapManager.d.ts.map +1 -1
- package/types/tsconfig.tsbuildinfo +1 -1
|
@@ -81485,6 +81485,24 @@ let BaseLayer$2 = class BaseLayer2 {
|
|
|
81485
81485
|
this.config.opacity = this.config.opacity / 100;
|
|
81486
81486
|
}
|
|
81487
81487
|
}
|
|
81488
|
+
/**
|
|
81489
|
+
* 注册自定义投影
|
|
81490
|
+
* @returns 注册的投影代码,如果没有注册则返回 undefined
|
|
81491
|
+
*/
|
|
81492
|
+
registerCustomProjection() {
|
|
81493
|
+
const projectionCode = this.config.projection;
|
|
81494
|
+
const projectionDefinition = this.config.projectionDefinition;
|
|
81495
|
+
if (projectionCode && projectionDefinition) {
|
|
81496
|
+
try {
|
|
81497
|
+
proj4$1.defs(projectionCode, projectionDefinition);
|
|
81498
|
+
register$3(proj4$1);
|
|
81499
|
+
return projectionCode;
|
|
81500
|
+
} catch (error2) {
|
|
81501
|
+
console.error(`Failed to register projection ${projectionCode}:`, error2);
|
|
81502
|
+
}
|
|
81503
|
+
}
|
|
81504
|
+
return void 0;
|
|
81505
|
+
}
|
|
81488
81506
|
/**
|
|
81489
81507
|
* 获取图层实例(同步方法,用于向后兼容)
|
|
81490
81508
|
*/
|
|
@@ -81942,6 +81960,7 @@ class TileLayerHandler extends BaseLayer$2 {
|
|
|
81942
81960
|
* 创建瓦片数据源
|
|
81943
81961
|
*/
|
|
81944
81962
|
createTileSource() {
|
|
81963
|
+
this.registerCustomProjection();
|
|
81945
81964
|
let sourceType = this.getSourceTypeFromLayerType();
|
|
81946
81965
|
sourceType = sourceType || "xyz";
|
|
81947
81966
|
switch (sourceType.toLowerCase()) {
|
|
@@ -82060,7 +82079,8 @@ class WMSLayerHandler extends BaseLayer$2 {
|
|
|
82060
82079
|
* 创建WMS数据源
|
|
82061
82080
|
*/
|
|
82062
82081
|
createWMSSource() {
|
|
82063
|
-
|
|
82082
|
+
this.registerCustomProjection();
|
|
82083
|
+
const options = {
|
|
82064
82084
|
url: this.config.url,
|
|
82065
82085
|
params: {
|
|
82066
82086
|
"LAYERS": this.config.wmsLayers || "",
|
|
@@ -82070,7 +82090,11 @@ class WMSLayerHandler extends BaseLayer$2 {
|
|
|
82070
82090
|
},
|
|
82071
82091
|
ratio: 1,
|
|
82072
82092
|
crossOrigin: "anonymous"
|
|
82073
|
-
}
|
|
82093
|
+
};
|
|
82094
|
+
if (this.config.projection) {
|
|
82095
|
+
options.projection = this.config.projection;
|
|
82096
|
+
}
|
|
82097
|
+
return new ImageWMS$1(options);
|
|
82074
82098
|
}
|
|
82075
82099
|
/**
|
|
82076
82100
|
* 更新WMS参数
|
|
@@ -82355,13 +82379,17 @@ class WMTSLayerHandler extends BaseLayer$2 {
|
|
|
82355
82379
|
* 创建WMTS数据源
|
|
82356
82380
|
*/
|
|
82357
82381
|
createWMTSSource() {
|
|
82358
|
-
|
|
82359
|
-
|
|
82382
|
+
const wmtsConfig = this.config.wmtsConfig || {};
|
|
82383
|
+
const url = wmtsConfig.url || this.config.url;
|
|
82384
|
+
if (!url) {
|
|
82385
|
+
throw new Error("WMTS URL is required");
|
|
82360
82386
|
}
|
|
82387
|
+
if (this.config.url && !this.capabilities && !wmtsConfig.resolutions)
|
|
82388
|
+
;
|
|
82361
82389
|
if (this.capabilities) {
|
|
82362
82390
|
const options = optionsFromCapabilities(this.capabilities, {
|
|
82363
|
-
layer: this.config.
|
|
82364
|
-
matrixSet: this.config.
|
|
82391
|
+
layer: wmtsConfig.layer || this.config.layerName || "",
|
|
82392
|
+
matrixSet: wmtsConfig.matrixSet || this.config.matrixSet || "EPSG:4326"
|
|
82365
82393
|
});
|
|
82366
82394
|
if (!options) {
|
|
82367
82395
|
throw new Error("Failed to create WMTS options from capabilities");
|
|
@@ -82377,26 +82405,46 @@ class WMTSLayerHandler extends BaseLayer$2 {
|
|
|
82377
82405
|
crossOrigin: "anonymous"
|
|
82378
82406
|
});
|
|
82379
82407
|
} else {
|
|
82380
|
-
const
|
|
82381
|
-
const
|
|
82382
|
-
|
|
82383
|
-
|
|
82384
|
-
|
|
82385
|
-
for (let z2 = 0; z2 < 19; ++z2) {
|
|
82386
|
-
resolutions[z2] = size2 / Math.pow(2, z2);
|
|
82387
|
-
matrixIds[z2] = z2;
|
|
82408
|
+
const projectionCode = wmtsConfig.projection || this.config.projection || "EPSG:4326";
|
|
82409
|
+
const projectionDefinition = wmtsConfig.projectionDefinition || this.config.projectionDefinition;
|
|
82410
|
+
if (projectionDefinition) {
|
|
82411
|
+
proj4$1.defs(projectionCode, projectionDefinition);
|
|
82412
|
+
register$3(proj4$1);
|
|
82388
82413
|
}
|
|
82414
|
+
const projection2 = get$b(projectionCode);
|
|
82415
|
+
const projectionExtent = projection2.getExtent();
|
|
82416
|
+
let resolutions = wmtsConfig.resolutions || this.config.resolutions;
|
|
82417
|
+
let matrixIds = wmtsConfig.matrixIds || this.config.matrixIds;
|
|
82418
|
+
const tileSize = wmtsConfig.tileSize || 256;
|
|
82419
|
+
const tileSizeNumber = typeof tileSize === "number" ? tileSize : tileSize[0];
|
|
82420
|
+
if (!resolutions) {
|
|
82421
|
+
const width = projectionExtent[2] - projectionExtent[0];
|
|
82422
|
+
const size2 = width / tileSizeNumber;
|
|
82423
|
+
const zoomLevels = 19;
|
|
82424
|
+
resolutions = new Array(zoomLevels);
|
|
82425
|
+
for (let z2 = 0; z2 < zoomLevels; ++z2) {
|
|
82426
|
+
resolutions[z2] = size2 / Math.pow(2, z2);
|
|
82427
|
+
}
|
|
82428
|
+
}
|
|
82429
|
+
if (!matrixIds) {
|
|
82430
|
+
matrixIds = new Array(resolutions.length);
|
|
82431
|
+
for (let z2 = 0; z2 < resolutions.length; ++z2) {
|
|
82432
|
+
matrixIds[z2] = z2.toString();
|
|
82433
|
+
}
|
|
82434
|
+
}
|
|
82435
|
+
const origin = wmtsConfig.origin || this.config.origin || [projectionExtent[0], projectionExtent[3]];
|
|
82389
82436
|
return new WMTS$3({
|
|
82390
|
-
url
|
|
82391
|
-
layer: this.config.
|
|
82392
|
-
matrixSet: this.config.
|
|
82393
|
-
format: "image/png",
|
|
82394
|
-
projection:
|
|
82395
|
-
style: this.config.
|
|
82437
|
+
url,
|
|
82438
|
+
layer: wmtsConfig.layer || this.config.layerName || "",
|
|
82439
|
+
matrixSet: wmtsConfig.matrixSet || this.config.matrixSet || projectionCode,
|
|
82440
|
+
format: wmtsConfig.format || this.config.format || "image/png",
|
|
82441
|
+
projection: projectionCode,
|
|
82442
|
+
style: wmtsConfig.style || this.config.style || "default",
|
|
82396
82443
|
tileGrid: new WMTSTileGrid$3({
|
|
82397
|
-
origin
|
|
82444
|
+
origin,
|
|
82398
82445
|
resolutions,
|
|
82399
|
-
matrixIds
|
|
82446
|
+
matrixIds,
|
|
82447
|
+
tileSize
|
|
82400
82448
|
}),
|
|
82401
82449
|
crossOrigin: "anonymous"
|
|
82402
82450
|
});
|
|
@@ -82440,21 +82488,21 @@ class WMTSLayerHandler extends BaseLayer$2 {
|
|
|
82440
82488
|
* 设置图层
|
|
82441
82489
|
*/
|
|
82442
82490
|
setLayer(layer2) {
|
|
82443
|
-
this.config.
|
|
82491
|
+
this.config.layerName = layer2;
|
|
82444
82492
|
this.layer = null;
|
|
82445
82493
|
}
|
|
82446
82494
|
/**
|
|
82447
82495
|
* 设置矩阵集
|
|
82448
82496
|
*/
|
|
82449
82497
|
setMatrixSet(matrixSet) {
|
|
82450
|
-
this.config.
|
|
82498
|
+
this.config.matrixSet = matrixSet;
|
|
82451
82499
|
this.layer = null;
|
|
82452
82500
|
}
|
|
82453
82501
|
/**
|
|
82454
82502
|
* 设置样式
|
|
82455
82503
|
*/
|
|
82456
82504
|
setWMTSStyle(style) {
|
|
82457
|
-
this.config.
|
|
82505
|
+
this.config.style = style;
|
|
82458
82506
|
this.layer = null;
|
|
82459
82507
|
}
|
|
82460
82508
|
/**
|
|
@@ -83259,10 +83307,13 @@ class GeoJSONLayerHandler extends BaseLayer$2 {
|
|
|
83259
83307
|
*/
|
|
83260
83308
|
createVectorSource() {
|
|
83261
83309
|
var _a3;
|
|
83310
|
+
this.registerCustomProjection();
|
|
83262
83311
|
const format2 = new GeoJSON$4();
|
|
83263
83312
|
const mapProjection = ((_a3 = this.map) == null ? void 0 : _a3.getView().getProjection().getCode()) || "EPSG:4326";
|
|
83313
|
+
const dataProjection = this.config.projection || "EPSG:4326";
|
|
83264
83314
|
if (this.config.data) {
|
|
83265
83315
|
const features2 = format2.readFeatures(this.config.data, {
|
|
83316
|
+
dataProjection,
|
|
83266
83317
|
featureProjection: mapProjection
|
|
83267
83318
|
});
|
|
83268
83319
|
this.originalFeatures = features2;
|
|
@@ -83270,7 +83321,10 @@ class GeoJSONLayerHandler extends BaseLayer$2 {
|
|
|
83270
83321
|
} else if (this.config.url) {
|
|
83271
83322
|
const source = new VectorSource$2({
|
|
83272
83323
|
url: this.config.url,
|
|
83273
|
-
format: new GeoJSON$4({
|
|
83324
|
+
format: new GeoJSON$4({
|
|
83325
|
+
dataProjection,
|
|
83326
|
+
featureProjection: mapProjection
|
|
83327
|
+
})
|
|
83274
83328
|
});
|
|
83275
83329
|
source.on("featuresloadend", () => {
|
|
83276
83330
|
this.originalFeatures = source.getFeatures();
|
|
@@ -83663,6 +83717,7 @@ class GeoJSONLayerHandler extends BaseLayer$2 {
|
|
|
83663
83717
|
* 应用过滤器(实现基类的抽象方法)
|
|
83664
83718
|
*/
|
|
83665
83719
|
applyFilters() {
|
|
83720
|
+
debugger;
|
|
83666
83721
|
const layer2 = this.getLayer();
|
|
83667
83722
|
const source = layer2.getSource();
|
|
83668
83723
|
if (!source)
|
|
@@ -83909,6 +83964,7 @@ class KMLLayerHandler extends BaseLayer$2 {
|
|
|
83909
83964
|
* 创建图层
|
|
83910
83965
|
*/
|
|
83911
83966
|
createLayer() {
|
|
83967
|
+
this.registerCustomProjection();
|
|
83912
83968
|
this.vectorSource = new VectorSource$2({
|
|
83913
83969
|
url: this.config.url,
|
|
83914
83970
|
format: this.kmlFormat
|
|
@@ -84184,9 +84240,10 @@ class GMLLayerHandler extends BaseLayer$2 {
|
|
|
84184
84240
|
* 初始化GML格式处理器
|
|
84185
84241
|
*/
|
|
84186
84242
|
initializeGMLFormat() {
|
|
84243
|
+
this.registerCustomProjection();
|
|
84187
84244
|
const gmlConfig = this.config.gmlConfig || {};
|
|
84188
84245
|
this.gmlFormat = new GML$1({
|
|
84189
|
-
srsName: gmlConfig.srsName || "EPSG:4326"
|
|
84246
|
+
srsName: gmlConfig.srsName || this.config.projection || "EPSG:4326"
|
|
84190
84247
|
});
|
|
84191
84248
|
}
|
|
84192
84249
|
/**
|
|
@@ -84562,13 +84619,20 @@ class WKTLayerHandler extends BaseLayer$2 {
|
|
|
84562
84619
|
* 从WKT字符串加载数据
|
|
84563
84620
|
*/
|
|
84564
84621
|
loadWKTFromString(wktString) {
|
|
84622
|
+
var _a3;
|
|
84565
84623
|
if (!this.wktFormat || !this.vectorSource)
|
|
84566
84624
|
return;
|
|
84625
|
+
this.registerCustomProjection();
|
|
84626
|
+
const dataProjection = this.config.projection || "EPSG:4326";
|
|
84627
|
+
const featureProjection = ((_a3 = this.map) == null ? void 0 : _a3.getView().getProjection().getCode()) || "EPSG:4326";
|
|
84567
84628
|
try {
|
|
84568
84629
|
const wktLines = wktString.split("\n").filter((line2) => line2.trim());
|
|
84569
84630
|
wktLines.forEach((line2, index2) => {
|
|
84570
84631
|
try {
|
|
84571
|
-
const geometry2 = this.wktFormat.readGeometry(line2.trim()
|
|
84632
|
+
const geometry2 = this.wktFormat.readGeometry(line2.trim(), {
|
|
84633
|
+
dataProjection,
|
|
84634
|
+
featureProjection
|
|
84635
|
+
});
|
|
84572
84636
|
const feature2 = new Feature$6({
|
|
84573
84637
|
geometry: geometry2,
|
|
84574
84638
|
id: `wkt_feature_${index2}`,
|
|
@@ -84654,10 +84718,16 @@ class WKTLayerHandler extends BaseLayer$2 {
|
|
|
84654
84718
|
* 添加WKT几何
|
|
84655
84719
|
*/
|
|
84656
84720
|
addWKTGeometry(wktString, properties) {
|
|
84721
|
+
var _a3;
|
|
84657
84722
|
if (!this.wktFormat || !this.vectorSource)
|
|
84658
84723
|
return null;
|
|
84724
|
+
const dataProjection = this.config.projection || "EPSG:4326";
|
|
84725
|
+
const featureProjection = ((_a3 = this.map) == null ? void 0 : _a3.getView().getProjection().getCode()) || "EPSG:4326";
|
|
84659
84726
|
try {
|
|
84660
|
-
const geometry2 = this.wktFormat.readGeometry(wktString
|
|
84727
|
+
const geometry2 = this.wktFormat.readGeometry(wktString, {
|
|
84728
|
+
dataProjection,
|
|
84729
|
+
featureProjection
|
|
84730
|
+
});
|
|
84661
84731
|
const feature2 = new Feature$6({
|
|
84662
84732
|
geometry: geometry2,
|
|
84663
84733
|
wkt: wktString,
|
|
@@ -465456,6 +465526,7 @@ const _TiandituLayerHandler = class _TiandituLayerHandler extends BaseLayer$2 {
|
|
|
465456
465526
|
* 创建天地图XYZ数据源
|
|
465457
465527
|
*/
|
|
465458
465528
|
createTiandituSource() {
|
|
465529
|
+
this.registerCustomProjection();
|
|
465459
465530
|
const url = this.processUrl(this.config.url || "");
|
|
465460
465531
|
const xyzOptions = {
|
|
465461
465532
|
url,
|
|
@@ -465852,6 +465923,7 @@ class VectorTileLayerHandler extends BaseLayer$2 {
|
|
|
465852
465923
|
* 创建矢量瓦片数据源
|
|
465853
465924
|
*/
|
|
465854
465925
|
createVectorTileSource() {
|
|
465926
|
+
this.registerCustomProjection();
|
|
465855
465927
|
const config = this.config;
|
|
465856
465928
|
const format2 = this.createFormat();
|
|
465857
465929
|
const sourceOptions = {
|
|
@@ -465900,7 +465972,7 @@ class VectorTileLayerHandler extends BaseLayer$2 {
|
|
|
465900
465972
|
});
|
|
465901
465973
|
case "geojson":
|
|
465902
465974
|
return new GeoJSON$4({
|
|
465903
|
-
dataProjection: config.dataProjection || "EPSG:4326",
|
|
465975
|
+
dataProjection: config.dataProjection || config.projection || "EPSG:4326",
|
|
465904
465976
|
featureProjection: config.featureProjection || "EPSG:4326"
|
|
465905
465977
|
});
|
|
465906
465978
|
default:
|
|
@@ -466372,6 +466444,8 @@ class LayerManager {
|
|
|
466372
466444
|
__publicField(this, "storage");
|
|
466373
466445
|
// 存储baseLayers配置,用于判断图层是否为底图
|
|
466374
466446
|
__publicField(this, "baseLayerIds", /* @__PURE__ */ new Set());
|
|
466447
|
+
// 存储共享图层组信息
|
|
466448
|
+
__publicField(this, "sharedLayerGroups", /* @__PURE__ */ new Map());
|
|
466375
466449
|
this.map = map2;
|
|
466376
466450
|
this.eventBus = eventBus;
|
|
466377
466451
|
this.storage = storage2;
|
|
@@ -466381,6 +466455,7 @@ class LayerManager {
|
|
|
466381
466455
|
* 添加图层(支持按需加载)
|
|
466382
466456
|
*/
|
|
466383
466457
|
async addLayer(config) {
|
|
466458
|
+
var _a3, _b3;
|
|
466384
466459
|
try {
|
|
466385
466460
|
const layerId = config.id || `layer_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
466386
466461
|
if (this.layerHandlers.has(layerId) || this.pendingLayerConfigs.has(layerId)) {
|
|
@@ -466395,7 +466470,11 @@ class LayerManager {
|
|
|
466395
466470
|
opacity: config.opacity ?? 1,
|
|
466396
466471
|
zIndex: config.zIndex ?? 0
|
|
466397
466472
|
};
|
|
466398
|
-
|
|
466473
|
+
const isGroup = fullConfig.type === "group" || (((_a3 = fullConfig.children) == null ? void 0 : _a3.length) ?? 0) > 0 || (((_b3 = fullConfig.layers) == null ? void 0 : _b3.length) ?? 0) > 0;
|
|
466474
|
+
if (isGroup) {
|
|
466475
|
+
if (fullConfig.type !== "group") {
|
|
466476
|
+
fullConfig.type = "group";
|
|
466477
|
+
}
|
|
466399
466478
|
return this.addLayerGroup(fullConfig);
|
|
466400
466479
|
}
|
|
466401
466480
|
if (fullConfig.visible && this.isBasemapLayer(layerId)) {
|
|
@@ -466507,6 +466586,174 @@ class LayerManager {
|
|
|
466507
466586
|
console.error("执行定位动画失败:", error2);
|
|
466508
466587
|
}
|
|
466509
466588
|
}
|
|
466589
|
+
/**
|
|
466590
|
+
* 设置共享图层样式函数
|
|
466591
|
+
*/
|
|
466592
|
+
setupSharedLayerStyle(layer2, reuseId) {
|
|
466593
|
+
if (!(layer2 instanceof VectorLayer$3)) {
|
|
466594
|
+
return;
|
|
466595
|
+
}
|
|
466596
|
+
const originalStyleFunction = layer2.getStyleFunction();
|
|
466597
|
+
layer2.setStyle((function(feature2, resolution) {
|
|
466598
|
+
const group2 = this.sharedLayerGroups.get(reuseId);
|
|
466599
|
+
if (!group2)
|
|
466600
|
+
return null;
|
|
466601
|
+
let matched = false;
|
|
466602
|
+
let styleToUse = null;
|
|
466603
|
+
for (const layerId of group2.logicalLayers) {
|
|
466604
|
+
const config = this.layerConfigs.get(layerId);
|
|
466605
|
+
if (config && config.visible) {
|
|
466606
|
+
try {
|
|
466607
|
+
if (this.checkFeatureFilter(feature2, config.filters)) {
|
|
466608
|
+
matched = true;
|
|
466609
|
+
const handler = this.layerHandlers.get(layerId);
|
|
466610
|
+
if (handler) {
|
|
466611
|
+
const isFirst = group2.logicalLayers.values().next().value === layerId;
|
|
466612
|
+
if (isFirst) {
|
|
466613
|
+
if (originalStyleFunction) {
|
|
466614
|
+
styleToUse = originalStyleFunction(feature2, resolution);
|
|
466615
|
+
}
|
|
466616
|
+
} else {
|
|
466617
|
+
const logicalLayer = handler.getLayer();
|
|
466618
|
+
if (logicalLayer && logicalLayer instanceof VectorLayer$3 && logicalLayer !== layer2) {
|
|
466619
|
+
const styleFunc = logicalLayer.getStyleFunction();
|
|
466620
|
+
if (styleFunc) {
|
|
466621
|
+
styleToUse = styleFunc(feature2, resolution);
|
|
466622
|
+
}
|
|
466623
|
+
} else {
|
|
466624
|
+
if (originalStyleFunction) {
|
|
466625
|
+
styleToUse = originalStyleFunction(feature2, resolution);
|
|
466626
|
+
}
|
|
466627
|
+
}
|
|
466628
|
+
}
|
|
466629
|
+
if (styleToUse || matched) {
|
|
466630
|
+
break;
|
|
466631
|
+
}
|
|
466632
|
+
}
|
|
466633
|
+
}
|
|
466634
|
+
} catch (e8) {
|
|
466635
|
+
console.error("Error checking feature filter:", e8);
|
|
466636
|
+
}
|
|
466637
|
+
}
|
|
466638
|
+
}
|
|
466639
|
+
if (matched) {
|
|
466640
|
+
if (styleToUse)
|
|
466641
|
+
return styleToUse;
|
|
466642
|
+
if (originalStyleFunction)
|
|
466643
|
+
return originalStyleFunction(feature2, resolution);
|
|
466644
|
+
return void 0;
|
|
466645
|
+
}
|
|
466646
|
+
return null;
|
|
466647
|
+
}).bind(this));
|
|
466648
|
+
}
|
|
466649
|
+
/**
|
|
466650
|
+
* 更新共享图层状态(处理WMS参数更新或Vector重绘)
|
|
466651
|
+
*/
|
|
466652
|
+
updateSharedLayerState(reuseId) {
|
|
466653
|
+
const group2 = this.sharedLayerGroups.get(reuseId);
|
|
466654
|
+
if (!group2)
|
|
466655
|
+
return;
|
|
466656
|
+
const layer2 = group2.physicalLayer;
|
|
466657
|
+
const source = layer2.getSource();
|
|
466658
|
+
if (source && typeof source.updateParams === "function") {
|
|
466659
|
+
const visibleLayers = Array.from(group2.logicalLayers).filter((id) => {
|
|
466660
|
+
const config = this.layerConfigs.get(id);
|
|
466661
|
+
return config && config.visible;
|
|
466662
|
+
});
|
|
466663
|
+
const wmsLayersList = [];
|
|
466664
|
+
const cqlFilterList = [];
|
|
466665
|
+
visibleLayers.forEach((id) => {
|
|
466666
|
+
var _a3, _b3;
|
|
466667
|
+
const config = this.layerConfigs.get(id);
|
|
466668
|
+
if (config) {
|
|
466669
|
+
const layers = config.wmsLayers || ((_b3 = (_a3 = config.config) == null ? void 0 : _a3.wms) == null ? void 0 : _b3.layers);
|
|
466670
|
+
if (layers) {
|
|
466671
|
+
wmsLayersList.push(layers);
|
|
466672
|
+
let cql = "";
|
|
466673
|
+
if (config.filters && config.filters.length > 0) {
|
|
466674
|
+
const conditions = config.filters.filter((f2) => f2.enabled && f2.type === FilterType.ATTRIBUTE).map((f2) => {
|
|
466675
|
+
const attrFilter = f2;
|
|
466676
|
+
let val = attrFilter.value;
|
|
466677
|
+
if (typeof val === "string") {
|
|
466678
|
+
val = `'${val}'`;
|
|
466679
|
+
}
|
|
466680
|
+
switch (attrFilter.operator) {
|
|
466681
|
+
case FilterOperator.EQUAL:
|
|
466682
|
+
return `${attrFilter.property}=${val}`;
|
|
466683
|
+
case FilterOperator.NOT_EQUAL:
|
|
466684
|
+
return `${attrFilter.property}<>${val}`;
|
|
466685
|
+
case FilterOperator.GREATER_THAN:
|
|
466686
|
+
return `${attrFilter.property}>${val}`;
|
|
466687
|
+
case FilterOperator.LESS_THAN:
|
|
466688
|
+
return `${attrFilter.property}<${val}`;
|
|
466689
|
+
case FilterOperator.GREATER_EQUAL:
|
|
466690
|
+
return `${attrFilter.property}>=${val}`;
|
|
466691
|
+
case FilterOperator.LESS_EQUAL:
|
|
466692
|
+
return `${attrFilter.property}<=${val}`;
|
|
466693
|
+
case FilterOperator.LIKE:
|
|
466694
|
+
return `${attrFilter.property} LIKE ${val}`;
|
|
466695
|
+
case FilterOperator.IN:
|
|
466696
|
+
if (Array.isArray(attrFilter.value)) {
|
|
466697
|
+
const inVals = attrFilter.value.map((v5) => typeof v5 === "string" ? `'${v5}'` : v5).join(",");
|
|
466698
|
+
return `${attrFilter.property} IN (${inVals})`;
|
|
466699
|
+
}
|
|
466700
|
+
return `${attrFilter.property} IN (${attrFilter.value})`;
|
|
466701
|
+
default:
|
|
466702
|
+
return "";
|
|
466703
|
+
}
|
|
466704
|
+
}).filter((c2) => c2 !== "");
|
|
466705
|
+
if (conditions.length > 0) {
|
|
466706
|
+
cql = conditions.join(" AND ");
|
|
466707
|
+
}
|
|
466708
|
+
}
|
|
466709
|
+
cqlFilterList.push(cql === "" ? "INCLUDE" : cql);
|
|
466710
|
+
}
|
|
466711
|
+
}
|
|
466712
|
+
});
|
|
466713
|
+
if (wmsLayersList.length > 0) {
|
|
466714
|
+
const newLayersParam = wmsLayersList.join(",");
|
|
466715
|
+
const newCqlFilterParam = cqlFilterList.join(";");
|
|
466716
|
+
const params2 = { "LAYERS": newLayersParam };
|
|
466717
|
+
if (cqlFilterList.some((c2) => c2 !== "INCLUDE")) {
|
|
466718
|
+
params2["CQL_FILTER"] = newCqlFilterParam;
|
|
466719
|
+
} else {
|
|
466720
|
+
params2["CQL_FILTER"] = null;
|
|
466721
|
+
}
|
|
466722
|
+
source.updateParams(params2);
|
|
466723
|
+
console.log(`共享WMS图层 ${reuseId} 更新参数: LAYERS=${newLayersParam}, CQL_FILTER=${newCqlFilterParam}`);
|
|
466724
|
+
return;
|
|
466725
|
+
}
|
|
466726
|
+
}
|
|
466727
|
+
layer2.changed();
|
|
466728
|
+
}
|
|
466729
|
+
/**
|
|
466730
|
+
* 检查要素是否匹配过滤条件
|
|
466731
|
+
*/
|
|
466732
|
+
checkFeatureFilter(feature2, filters) {
|
|
466733
|
+
if (!filters || filters.length === 0) {
|
|
466734
|
+
return true;
|
|
466735
|
+
}
|
|
466736
|
+
for (const filter2 of filters) {
|
|
466737
|
+
if (!filter2.enabled)
|
|
466738
|
+
continue;
|
|
466739
|
+
if (filter2.type === FilterType.ATTRIBUTE) {
|
|
466740
|
+
const props = feature2.getProperties();
|
|
466741
|
+
const value = props[filter2.property];
|
|
466742
|
+
const targetValue = filter2.value;
|
|
466743
|
+
switch (filter2.operator) {
|
|
466744
|
+
case FilterOperator.EQUAL:
|
|
466745
|
+
if (value != targetValue)
|
|
466746
|
+
return false;
|
|
466747
|
+
break;
|
|
466748
|
+
case FilterOperator.NOT_EQUAL:
|
|
466749
|
+
if (value == targetValue)
|
|
466750
|
+
return false;
|
|
466751
|
+
break;
|
|
466752
|
+
}
|
|
466753
|
+
}
|
|
466754
|
+
}
|
|
466755
|
+
return true;
|
|
466756
|
+
}
|
|
466510
466757
|
/**
|
|
466511
466758
|
* 获取缓动函数
|
|
466512
466759
|
*/
|
|
@@ -466537,19 +466784,44 @@ class LayerManager {
|
|
|
466537
466784
|
* 异步添加图层
|
|
466538
466785
|
*/
|
|
466539
466786
|
async addLayerAsync(fullConfig, handler) {
|
|
466540
|
-
var _a3;
|
|
466787
|
+
var _a3, _b3;
|
|
466541
466788
|
try {
|
|
466542
466789
|
const layer2 = await handler.getLayerAsync();
|
|
466543
466790
|
layer2.set("layerId", fullConfig.id);
|
|
466544
466791
|
this.layerHandlers.set(fullConfig.id, handler);
|
|
466545
466792
|
this.layerConfigs.set(fullConfig.id, fullConfig);
|
|
466546
466793
|
console.log("kjthis.layerConfigs:", this.layerConfigs);
|
|
466547
|
-
|
|
466794
|
+
let isReuse = false;
|
|
466795
|
+
if (fullConfig.reuseId) {
|
|
466796
|
+
const reuseId = fullConfig.reuseId;
|
|
466797
|
+
let group2 = this.sharedLayerGroups.get(reuseId);
|
|
466798
|
+
if (group2) {
|
|
466799
|
+
console.log(`图层 ${fullConfig.id} 复用物理图层 ${reuseId}`);
|
|
466800
|
+
group2.logicalLayers.add(fullConfig.id);
|
|
466801
|
+
isReuse = true;
|
|
466802
|
+
this.updateSharedLayerState(reuseId);
|
|
466803
|
+
} else {
|
|
466804
|
+
console.log(`图层 ${fullConfig.id} 创建共享物理图层 ${reuseId}`);
|
|
466805
|
+
this.sharedLayerGroups.set(reuseId, {
|
|
466806
|
+
physicalLayer: layer2,
|
|
466807
|
+
logicalLayers: /* @__PURE__ */ new Set([fullConfig.id])
|
|
466808
|
+
});
|
|
466809
|
+
this.setupSharedLayerStyle(layer2, reuseId);
|
|
466810
|
+
this.map.addLayer(layer2);
|
|
466811
|
+
}
|
|
466812
|
+
} else {
|
|
466813
|
+
this.map.addLayer(layer2);
|
|
466814
|
+
}
|
|
466548
466815
|
if (fullConfig.zIndex !== void 0) {
|
|
466549
|
-
|
|
466816
|
+
if (fullConfig.reuseId && this.sharedLayerGroups.has(fullConfig.reuseId)) {
|
|
466817
|
+
const group2 = this.sharedLayerGroups.get(fullConfig.reuseId);
|
|
466818
|
+
group2.physicalLayer.setZIndex(fullConfig.zIndex);
|
|
466819
|
+
} else {
|
|
466820
|
+
handler.setZIndex(fullConfig.zIndex);
|
|
466821
|
+
}
|
|
466550
466822
|
console.log(`图层 ${fullConfig.id} 设置 zIndex: ${fullConfig.zIndex}`);
|
|
466551
466823
|
}
|
|
466552
|
-
if ("applyLayerStyles" in handler) {
|
|
466824
|
+
if ("applyLayerStyles" in handler && !isReuse) {
|
|
466553
466825
|
setTimeout(() => {
|
|
466554
466826
|
handler.applyLayerStyles();
|
|
466555
466827
|
}, 50);
|
|
@@ -466563,7 +466835,9 @@ class LayerManager {
|
|
|
466563
466835
|
layerConfig: fullConfig
|
|
466564
466836
|
});
|
|
466565
466837
|
if (((_a3 = fullConfig.locationAnimation) == null ? void 0 : _a3.enabled) && fullConfig.visible) {
|
|
466566
|
-
this.
|
|
466838
|
+
if (!isReuse || !((_b3 = this.sharedLayerGroups.get(fullConfig.reuseId)) == null ? void 0 : _b3.physicalLayer.getVisible())) {
|
|
466839
|
+
this.handleLocationAnimation(fullConfig.reuseId ? this.sharedLayerGroups.get(fullConfig.reuseId).physicalLayer : layer2, fullConfig);
|
|
466840
|
+
}
|
|
466567
466841
|
}
|
|
466568
466842
|
return true;
|
|
466569
466843
|
} catch (error2) {
|
|
@@ -466588,7 +466862,7 @@ class LayerManager {
|
|
|
466588
466862
|
const childLayers = [];
|
|
466589
466863
|
if (groupConfig.children) {
|
|
466590
466864
|
for (const childConfig of groupConfig.children) {
|
|
466591
|
-
const childLayerId = `${groupConfig.id}_child_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
466865
|
+
const childLayerId = childConfig.id || `${groupConfig.id}_child_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
466592
466866
|
const childFullConfig = {
|
|
466593
466867
|
...childConfig,
|
|
466594
466868
|
id: childLayerId,
|
|
@@ -466601,9 +466875,10 @@ class LayerManager {
|
|
|
466601
466875
|
}
|
|
466602
466876
|
}
|
|
466603
466877
|
}
|
|
466878
|
+
const layersList = [];
|
|
466604
466879
|
if (groupConfig.layers) {
|
|
466605
466880
|
for (const layerConfig of groupConfig.layers) {
|
|
466606
|
-
const layerLayerId = `${groupConfig.id}_layer_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
466881
|
+
const layerLayerId = layerConfig.id || `${groupConfig.id}_layer_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
466607
466882
|
const layerFullConfig = {
|
|
466608
466883
|
...layerConfig,
|
|
466609
466884
|
id: layerLayerId,
|
|
@@ -466612,10 +466887,14 @@ class LayerManager {
|
|
|
466612
466887
|
opacity: layerConfig.opacity ?? groupConfig.opacity
|
|
466613
466888
|
};
|
|
466614
466889
|
if (this.addLayer(layerFullConfig)) {
|
|
466890
|
+
layersList.push(layerFullConfig);
|
|
466615
466891
|
}
|
|
466616
466892
|
}
|
|
466617
466893
|
}
|
|
466618
466894
|
groupConfig.children = childLayers;
|
|
466895
|
+
if (layersList.length > 0) {
|
|
466896
|
+
groupConfig.layers = layersList;
|
|
466897
|
+
}
|
|
466619
466898
|
this.layerConfigs.set(groupConfig.id, groupConfig);
|
|
466620
466899
|
this.saveLayerConfigs();
|
|
466621
466900
|
this.eventBus.emit("layer-added", {
|
|
@@ -466642,15 +466921,26 @@ class LayerManager {
|
|
|
466642
466921
|
console.warn(`未找到图层配置: ${layerId}`);
|
|
466643
466922
|
return false;
|
|
466644
466923
|
}
|
|
466645
|
-
if (handler && this.layerConfigs.has(layerId)) {
|
|
466646
|
-
if (config.type === "group"
|
|
466647
|
-
|
|
466648
|
-
|
|
466924
|
+
if ((handler || config.type === "group") && this.layerConfigs.has(layerId)) {
|
|
466925
|
+
if (config.type === "group") {
|
|
466926
|
+
if (config.children) {
|
|
466927
|
+
for (const child of config.children) {
|
|
466928
|
+
this.removeLayer(child.id);
|
|
466929
|
+
}
|
|
466649
466930
|
}
|
|
466650
|
-
|
|
466931
|
+
if (config.layers) {
|
|
466932
|
+
for (const layer2 of config.layers) {
|
|
466933
|
+
this.removeLayer(layer2.id);
|
|
466934
|
+
}
|
|
466935
|
+
}
|
|
466936
|
+
if (handler)
|
|
466937
|
+
handler.destroy();
|
|
466938
|
+
} else if (handler) {
|
|
466651
466939
|
handler.destroy();
|
|
466652
466940
|
}
|
|
466653
|
-
|
|
466941
|
+
if (handler) {
|
|
466942
|
+
this.layerHandlers.delete(layerId);
|
|
466943
|
+
}
|
|
466654
466944
|
this.layerConfigs.delete(layerId);
|
|
466655
466945
|
}
|
|
466656
466946
|
this.pendingLayerConfigs.delete(layerId);
|
|
@@ -466722,7 +467012,7 @@ class LayerManager {
|
|
|
466722
467012
|
console.warn(`图层配置不存在: ${layerId}`);
|
|
466723
467013
|
return false;
|
|
466724
467014
|
}
|
|
466725
|
-
if (config.type === "group" && config.children) {
|
|
467015
|
+
if (config.type === "group" && (config.children || config.layers)) {
|
|
466726
467016
|
return await this.setGroupLayerVisible(layerId, visible);
|
|
466727
467017
|
}
|
|
466728
467018
|
if (visible && !this.layerHandlers.has(layerId)) {
|
|
@@ -466737,28 +467027,58 @@ class LayerManager {
|
|
|
466737
467027
|
if (visible && this.isBasemapLayer(layerId)) {
|
|
466738
467028
|
await this.hideOtherBasemaps(layerId);
|
|
466739
467029
|
}
|
|
466740
|
-
handler.setVisible(visible);
|
|
466741
467030
|
config.visible = visible;
|
|
466742
|
-
this.saveLayerConfigs();
|
|
466743
467031
|
if (this.pendingLayerConfigs.has(layerId)) {
|
|
466744
467032
|
this.pendingLayerConfigs.set(layerId, config);
|
|
466745
467033
|
}
|
|
466746
|
-
|
|
466747
|
-
|
|
466748
|
-
const
|
|
466749
|
-
|
|
466750
|
-
this.
|
|
466751
|
-
|
|
466752
|
-
|
|
466753
|
-
|
|
466754
|
-
|
|
466755
|
-
|
|
466756
|
-
|
|
466757
|
-
|
|
466758
|
-
|
|
466759
|
-
|
|
467034
|
+
this.layerConfigs.set(layerId, config);
|
|
467035
|
+
if (config.reuseId && this.sharedLayerGroups.has(config.reuseId)) {
|
|
467036
|
+
const group2 = this.sharedLayerGroups.get(config.reuseId);
|
|
467037
|
+
const anyVisible = Array.from(group2.logicalLayers).some((id) => {
|
|
467038
|
+
const c2 = this.layerConfigs.get(id);
|
|
467039
|
+
return c2 && c2.visible;
|
|
467040
|
+
});
|
|
467041
|
+
group2.physicalLayer.setVisible(anyVisible);
|
|
467042
|
+
this.updateSharedLayerState(config.reuseId);
|
|
467043
|
+
console.log(`共享图层 ${config.reuseId} 逻辑图层 ${layerId} 可见性设为 ${visible}, 物理图层可见性: ${anyVisible}`);
|
|
467044
|
+
if (visible) {
|
|
467045
|
+
if (anyVisible) {
|
|
467046
|
+
const layer2 = group2.physicalLayer;
|
|
467047
|
+
const animCfg = config.locationAnimation;
|
|
467048
|
+
if (animCfg && animCfg.enabled) {
|
|
467049
|
+
this.handleLocationAnimation(layer2, config);
|
|
467050
|
+
} else if (config.fitToExtent) {
|
|
467051
|
+
const defaultAnim = {
|
|
467052
|
+
enabled: true,
|
|
467053
|
+
duration: 1e3,
|
|
467054
|
+
easing: "ease-out",
|
|
467055
|
+
maxZoom: 16,
|
|
467056
|
+
padding: [50, 50, 50, 50]
|
|
467057
|
+
};
|
|
467058
|
+
this.performLocationAnimation(layer2, config, defaultAnim);
|
|
467059
|
+
}
|
|
467060
|
+
}
|
|
467061
|
+
}
|
|
467062
|
+
} else {
|
|
467063
|
+
handler.setVisible(visible);
|
|
467064
|
+
if (visible) {
|
|
467065
|
+
const layer2 = handler.getLayer();
|
|
467066
|
+
const animCfg = config.locationAnimation;
|
|
467067
|
+
if (animCfg && animCfg.enabled) {
|
|
467068
|
+
this.handleLocationAnimation(layer2, config);
|
|
467069
|
+
} else if (config.fitToExtent) {
|
|
467070
|
+
const defaultAnim = {
|
|
467071
|
+
enabled: true,
|
|
467072
|
+
duration: 1e3,
|
|
467073
|
+
easing: "ease-out",
|
|
467074
|
+
maxZoom: 16,
|
|
467075
|
+
padding: [50, 50, 50, 50]
|
|
467076
|
+
};
|
|
467077
|
+
this.performLocationAnimation(layer2, config, defaultAnim);
|
|
467078
|
+
}
|
|
466760
467079
|
}
|
|
466761
467080
|
}
|
|
467081
|
+
this.saveLayerConfigs();
|
|
466762
467082
|
this.eventBus.emit("layer-visibility-changed", {
|
|
466763
467083
|
layerId,
|
|
466764
467084
|
visible,
|
|
@@ -466810,10 +467130,9 @@ class LayerManager {
|
|
|
466810
467130
|
}
|
|
466811
467131
|
}
|
|
466812
467132
|
if (groupConfig.layers) {
|
|
466813
|
-
const
|
|
466814
|
-
|
|
466815
|
-
|
|
466816
|
-
const result = await this.setLayerVisible(layerId, visible);
|
|
467133
|
+
for (const layerConfig of groupConfig.layers) {
|
|
467134
|
+
if (layerConfig.id) {
|
|
467135
|
+
const result = await this.setLayerVisible(layerConfig.id, visible);
|
|
466817
467136
|
results.push(result);
|
|
466818
467137
|
}
|
|
466819
467138
|
}
|
|
@@ -467065,7 +467384,6 @@ class LayerManager {
|
|
|
467065
467384
|
* 按需加载图层(原loadLayerConfigs的单个图层版本)
|
|
467066
467385
|
*/
|
|
467067
467386
|
async loadLayerOnDemand(layerId) {
|
|
467068
|
-
var _a3;
|
|
467069
467387
|
try {
|
|
467070
467388
|
if (this.layerHandlers.has(layerId)) {
|
|
467071
467389
|
return true;
|
|
@@ -467077,23 +467395,15 @@ class LayerManager {
|
|
|
467077
467395
|
}
|
|
467078
467396
|
const handler = layerFactory.createLayerHandler(config);
|
|
467079
467397
|
handler.setMap(this.map);
|
|
467080
|
-
const
|
|
467081
|
-
|
|
467082
|
-
|
|
467083
|
-
|
|
467084
|
-
|
|
467085
|
-
|
|
467086
|
-
|
|
467087
|
-
|
|
467088
|
-
}
|
|
467089
|
-
this.pendingLayerConfigs.delete(layerId);
|
|
467090
|
-
if ("applyLayerStyles" in handler) {
|
|
467091
|
-
setTimeout(() => {
|
|
467092
|
-
handler.applyLayerStyles();
|
|
467093
|
-
}, 50);
|
|
467398
|
+
const success = await this.addLayerAsync(config, handler);
|
|
467399
|
+
if (success) {
|
|
467400
|
+
this.pendingLayerConfigs.delete(layerId);
|
|
467401
|
+
console.log(`图层 ${layerId} 按需加载完成`);
|
|
467402
|
+
return true;
|
|
467403
|
+
} else {
|
|
467404
|
+
console.error(`按需加载图层 ${layerId} 失败`);
|
|
467405
|
+
return false;
|
|
467094
467406
|
}
|
|
467095
|
-
console.log(`图层 ${layerId} 按需加载完成`);
|
|
467096
|
-
return true;
|
|
467097
467407
|
} catch (error2) {
|
|
467098
467408
|
console.error(`按需加载图层 ${layerId} 失败:`, error2);
|
|
467099
467409
|
return false;
|
|
@@ -467554,13 +467864,15 @@ class FeatureHighlightManager {
|
|
|
467554
467864
|
this.map.removeLayer(this.highlightLayer);
|
|
467555
467865
|
}
|
|
467556
467866
|
}
|
|
467867
|
+
const _hoisted_1$p = ["id"];
|
|
467557
467868
|
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
467558
467869
|
__name: "BasePopup",
|
|
467559
467870
|
props: {
|
|
467560
467871
|
config: {},
|
|
467561
467872
|
coordinate: {},
|
|
467562
467873
|
feature: {},
|
|
467563
|
-
visible: { type: Boolean, default: false }
|
|
467874
|
+
visible: { type: Boolean, default: false },
|
|
467875
|
+
id: {}
|
|
467564
467876
|
},
|
|
467565
467877
|
emits: ["close", "show", "hide", "content-change"],
|
|
467566
467878
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -467669,6 +467981,9 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
467669
467981
|
ref_key: "contentElement",
|
|
467670
467982
|
ref: contentElement
|
|
467671
467983
|
}, [
|
|
467984
|
+
createElementVNode("div", {
|
|
467985
|
+
id: `popup-slot-${_ctx.id}`
|
|
467986
|
+
}, null, 8, _hoisted_1$p),
|
|
467672
467987
|
renderSlot(_ctx.$slots, "default", {
|
|
467673
467988
|
feature: _ctx.feature,
|
|
467674
467989
|
coordinate: _ctx.coordinate,
|
|
@@ -467695,7 +468010,8 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
467695
468010
|
config: {},
|
|
467696
468011
|
coordinate: {},
|
|
467697
468012
|
feature: {},
|
|
467698
|
-
visible: { type: Boolean, default: false }
|
|
468013
|
+
visible: { type: Boolean, default: false },
|
|
468014
|
+
id: {}
|
|
467699
468015
|
},
|
|
467700
468016
|
emits: ["close", "show", "hide"],
|
|
467701
468017
|
setup(__props, { emit: __emit }) {
|
|
@@ -467741,6 +468057,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
467741
468057
|
coordinate: _ctx.coordinate,
|
|
467742
468058
|
feature: _ctx.feature,
|
|
467743
468059
|
visible: _ctx.visible,
|
|
468060
|
+
id: _ctx.id,
|
|
467744
468061
|
onClose: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close")),
|
|
467745
468062
|
onShow: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("show")),
|
|
467746
468063
|
onHide: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("hide"))
|
|
@@ -467758,7 +468075,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
467758
468075
|
];
|
|
467759
468076
|
}),
|
|
467760
468077
|
_: 1
|
|
467761
|
-
}, 8, ["config", "coordinate", "feature", "visible"]);
|
|
468078
|
+
}, 8, ["config", "coordinate", "feature", "visible", "id"]);
|
|
467762
468079
|
};
|
|
467763
468080
|
}
|
|
467764
468081
|
});
|
|
@@ -467808,7 +468125,8 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
467808
468125
|
config: {},
|
|
467809
468126
|
coordinate: {},
|
|
467810
468127
|
feature: {},
|
|
467811
|
-
visible: { type: Boolean, default: false }
|
|
468128
|
+
visible: { type: Boolean, default: false },
|
|
468129
|
+
id: {}
|
|
467812
468130
|
},
|
|
467813
468131
|
emits: ["close", "show", "hide"],
|
|
467814
468132
|
setup(__props, { emit: __emit }) {
|
|
@@ -467939,6 +468257,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
467939
468257
|
coordinate: _ctx.coordinate,
|
|
467940
468258
|
feature: _ctx.feature,
|
|
467941
468259
|
visible: _ctx.visible,
|
|
468260
|
+
id: _ctx.id,
|
|
467942
468261
|
onClose: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("close")),
|
|
467943
468262
|
onShow: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("show")),
|
|
467944
468263
|
onHide: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("hide"))
|
|
@@ -468050,7 +468369,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
468050
468369
|
])) : createCommentVNode("", true)
|
|
468051
468370
|
]),
|
|
468052
468371
|
_: 1
|
|
468053
|
-
}, 8, ["config", "coordinate", "feature", "visible"]);
|
|
468372
|
+
}, 8, ["config", "coordinate", "feature", "visible", "id"]);
|
|
468054
468373
|
};
|
|
468055
468374
|
}
|
|
468056
468375
|
});
|
|
@@ -468137,7 +468456,8 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
468137
468456
|
config: {},
|
|
468138
468457
|
coordinate: {},
|
|
468139
468458
|
feature: {},
|
|
468140
|
-
visible: { type: Boolean, default: false }
|
|
468459
|
+
visible: { type: Boolean, default: false },
|
|
468460
|
+
id: {}
|
|
468141
468461
|
},
|
|
468142
468462
|
emits: ["close", "show", "hide", "rowClick"],
|
|
468143
468463
|
setup(__props, { emit: __emit }) {
|
|
@@ -468281,6 +468601,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
468281
468601
|
coordinate: _ctx.coordinate,
|
|
468282
468602
|
feature: _ctx.feature,
|
|
468283
468603
|
visible: _ctx.visible,
|
|
468604
|
+
id: _ctx.id,
|
|
468284
468605
|
onClose: _cache[6] || (_cache[6] = ($event) => _ctx.$emit("close")),
|
|
468285
468606
|
onShow: _cache[7] || (_cache[7] = ($event) => _ctx.$emit("show")),
|
|
468286
468607
|
onHide: _cache[8] || (_cache[8] = ($event) => _ctx.$emit("hide"))
|
|
@@ -468485,7 +468806,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
468485
468806
|
])
|
|
468486
468807
|
]),
|
|
468487
468808
|
_: 1
|
|
468488
|
-
}, 8, ["config", "coordinate", "feature", "visible"]);
|
|
468809
|
+
}, 8, ["config", "coordinate", "feature", "visible", "id"]);
|
|
468489
468810
|
};
|
|
468490
468811
|
}
|
|
468491
468812
|
});
|
|
@@ -468701,7 +469022,8 @@ class PopupManager {
|
|
|
468701
469022
|
}
|
|
468702
469023
|
},
|
|
468703
469024
|
positioning: "bottom-center",
|
|
468704
|
-
|
|
469025
|
+
// 关键:阻止来自popup的事件传递到地图,避免点击关闭按钮触发地图单击
|
|
469026
|
+
stopEvent: true,
|
|
468705
469027
|
offset: [0, -10]
|
|
468706
469028
|
});
|
|
468707
469029
|
let component = null;
|
|
@@ -468709,6 +469031,7 @@ class PopupManager {
|
|
|
468709
469031
|
switch (type) {
|
|
468710
469032
|
case "html":
|
|
468711
469033
|
app = createApp(_sfc_main$p, {
|
|
469034
|
+
id: popupId,
|
|
468712
469035
|
config: { ...this.config.defaultConfig, ...config },
|
|
468713
469036
|
coordinate,
|
|
468714
469037
|
feature: feature2,
|
|
@@ -468718,6 +469041,7 @@ class PopupManager {
|
|
|
468718
469041
|
break;
|
|
468719
469042
|
case "image":
|
|
468720
469043
|
app = createApp(_sfc_main$o, {
|
|
469044
|
+
id: popupId,
|
|
468721
469045
|
config: { ...this.config.defaultConfig, ...config },
|
|
468722
469046
|
coordinate,
|
|
468723
469047
|
feature: feature2,
|
|
@@ -468727,6 +469051,7 @@ class PopupManager {
|
|
|
468727
469051
|
break;
|
|
468728
469052
|
case "array":
|
|
468729
469053
|
app = createApp(_sfc_main$n, {
|
|
469054
|
+
id: popupId,
|
|
468730
469055
|
config: { ...this.config.defaultConfig, ...config },
|
|
468731
469056
|
coordinate,
|
|
468732
469057
|
feature: feature2,
|
|
@@ -468742,6 +469067,7 @@ class PopupManager {
|
|
|
468742
469067
|
const allConfig = config;
|
|
468743
469068
|
if (allConfig.htmlContent) {
|
|
468744
469069
|
app = createApp(_sfc_main$p, {
|
|
469070
|
+
id: popupId,
|
|
468745
469071
|
config: {
|
|
468746
469072
|
...allConfig,
|
|
468747
469073
|
content: allConfig.htmlContent
|
|
@@ -468753,6 +469079,7 @@ class PopupManager {
|
|
|
468753
469079
|
});
|
|
468754
469080
|
} else if (allConfig.images) {
|
|
468755
469081
|
app = createApp(_sfc_main$o, {
|
|
469082
|
+
id: popupId,
|
|
468756
469083
|
config: {
|
|
468757
469084
|
...allConfig,
|
|
468758
469085
|
images: allConfig.images
|
|
@@ -468764,6 +469091,7 @@ class PopupManager {
|
|
|
468764
469091
|
});
|
|
468765
469092
|
} else if (allConfig.data) {
|
|
468766
469093
|
app = createApp(_sfc_main$n, {
|
|
469094
|
+
id: popupId,
|
|
468767
469095
|
config: {
|
|
468768
469096
|
...allConfig,
|
|
468769
469097
|
data: allConfig.data
|
|
@@ -468779,6 +469107,7 @@ class PopupManager {
|
|
|
468779
469107
|
});
|
|
468780
469108
|
} else {
|
|
468781
469109
|
app = createApp(_sfc_main$q, {
|
|
469110
|
+
id: popupId,
|
|
468782
469111
|
config: allConfig,
|
|
468783
469112
|
coordinate,
|
|
468784
469113
|
feature: feature2,
|
|
@@ -468787,6 +469116,28 @@ class PopupManager {
|
|
|
468787
469116
|
});
|
|
468788
469117
|
}
|
|
468789
469118
|
break;
|
|
469119
|
+
case "custom": {
|
|
469120
|
+
const customConfig = config;
|
|
469121
|
+
const CustomComp = customConfig.component;
|
|
469122
|
+
const computedProps = typeof customConfig.props === "function" ? customConfig.props(feature2, coordinate) : customConfig.props || {};
|
|
469123
|
+
const cfg = { ...this.config.defaultConfig, ...customConfig };
|
|
469124
|
+
const onClose = () => this.closePopup(popupId);
|
|
469125
|
+
const Root = defineComponent({
|
|
469126
|
+
name: "CustomPopupRoot",
|
|
469127
|
+
setup() {
|
|
469128
|
+
return { cfg, coordinate, feature: feature2, CustomComp, computedProps, onClose };
|
|
469129
|
+
},
|
|
469130
|
+
render() {
|
|
469131
|
+
return h$4(
|
|
469132
|
+
_sfc_main$q,
|
|
469133
|
+
{ config: this.cfg, coordinate: this.coordinate, feature: this.feature, visible: true, id: popupId, onClose: this.onClose },
|
|
469134
|
+
{ default: () => h$4(this.CustomComp, { ...this.computedProps, feature: this.feature, coordinate: this.coordinate, config: this.cfg }) }
|
|
469135
|
+
);
|
|
469136
|
+
}
|
|
469137
|
+
});
|
|
469138
|
+
app = createApp(Root);
|
|
469139
|
+
break;
|
|
469140
|
+
}
|
|
468790
469141
|
default:
|
|
468791
469142
|
console.error(`不支持的 popup 类型: ${type}`);
|
|
468792
469143
|
return null;
|
|
@@ -468815,24 +469166,26 @@ class PopupManager {
|
|
|
468815
469166
|
* 显示 popup
|
|
468816
469167
|
*/
|
|
468817
469168
|
showPopup(popup) {
|
|
468818
|
-
var _a3, _b3;
|
|
469169
|
+
var _a3, _b3, _c2, _d;
|
|
468819
469170
|
this.map.addOverlay(popup.overlay);
|
|
468820
469171
|
popup.overlay.setPosition(popup.coordinate);
|
|
468821
469172
|
(_b3 = (_a3 = popup.config.events) == null ? void 0 : _a3.onShow) == null ? void 0 : _b3.call(_a3);
|
|
469173
|
+
(_d = (_c2 = this.config).onShow) == null ? void 0 : _d.call(_c2, popup.id, popup.config, popup.feature, popup.coordinate);
|
|
468822
469174
|
}
|
|
468823
469175
|
/**
|
|
468824
469176
|
* 隐藏 popup
|
|
468825
469177
|
*/
|
|
468826
469178
|
hidePopup(popup) {
|
|
468827
|
-
var _a3, _b3;
|
|
469179
|
+
var _a3, _b3, _c2, _d;
|
|
468828
469180
|
this.map.removeOverlay(popup.overlay);
|
|
468829
469181
|
(_b3 = (_a3 = popup.config.events) == null ? void 0 : _a3.onHide) == null ? void 0 : _b3.call(_a3);
|
|
469182
|
+
(_d = (_c2 = this.config).onHide) == null ? void 0 : _d.call(_c2, popup.id);
|
|
468830
469183
|
}
|
|
468831
469184
|
/**
|
|
468832
469185
|
* 销毁 popup
|
|
468833
469186
|
*/
|
|
468834
469187
|
destroyPopup(popup) {
|
|
468835
|
-
var _a3, _b3;
|
|
469188
|
+
var _a3, _b3, _c2, _d;
|
|
468836
469189
|
try {
|
|
468837
469190
|
if (popup.app) {
|
|
468838
469191
|
popup.app.unmount();
|
|
@@ -468841,6 +469194,7 @@ class PopupManager {
|
|
|
468841
469194
|
popup.container.parentNode.removeChild(popup.container);
|
|
468842
469195
|
}
|
|
468843
469196
|
(_b3 = (_a3 = popup.config.events) == null ? void 0 : _a3.onClose) == null ? void 0 : _b3.call(_a3);
|
|
469197
|
+
(_d = (_c2 = this.config).onClose) == null ? void 0 : _d.call(_c2, popup.id);
|
|
468844
469198
|
} catch (error2) {
|
|
468845
469199
|
console.error("销毁 popup 失败:", error2);
|
|
468846
469200
|
}
|
|
@@ -469059,7 +469413,11 @@ class MapManager {
|
|
|
469059
469413
|
initMap(targetId) {
|
|
469060
469414
|
var _a3;
|
|
469061
469415
|
const projection2 = this.config.projection || "EPSG:4326";
|
|
469062
|
-
if (
|
|
469416
|
+
if (this.config.projectionDefinition) {
|
|
469417
|
+
proj4$1.defs(projection2, this.config.projectionDefinition);
|
|
469418
|
+
register$3(proj4$1);
|
|
469419
|
+
}
|
|
469420
|
+
if (projection2 === "EPSG:4490" && !this.config.projectionDefinition) {
|
|
469063
469421
|
setupEPSG4490();
|
|
469064
469422
|
}
|
|
469065
469423
|
const center2 = this.config.center || [116.404, 39.915];
|
|
@@ -479438,8 +479796,12 @@ class LayerTreeManager {
|
|
|
479438
479796
|
__publicField(this, "defaultCheckedKeys", computed(() => {
|
|
479439
479797
|
const checkedKeys = [];
|
|
479440
479798
|
const collectVisibleIds = (layer2) => {
|
|
479441
|
-
if (layer2.visible
|
|
479442
|
-
|
|
479799
|
+
if (layer2.visible) {
|
|
479800
|
+
const isGroup = layer2.type === "group";
|
|
479801
|
+
const hasChildren = layer2.children && Array.isArray(layer2.children) && layer2.children.length > 0;
|
|
479802
|
+
if (!isGroup || isGroup && !hasChildren) {
|
|
479803
|
+
checkedKeys.push(layer2.id);
|
|
479804
|
+
}
|
|
479443
479805
|
}
|
|
479444
479806
|
if (layer2.children && Array.isArray(layer2.children)) {
|
|
479445
479807
|
layer2.children.forEach((child) => collectVisibleIds(child));
|
|
@@ -479480,10 +479842,11 @@ class LayerTreeManager {
|
|
|
479480
479842
|
* @returns 树节点数据
|
|
479481
479843
|
*/
|
|
479482
479844
|
buildLayerNode(layer2) {
|
|
479845
|
+
const isGroup = layer2.type === "group" || layer2.children && Array.isArray(layer2.children) && layer2.children.length > 0;
|
|
479483
479846
|
const node = {
|
|
479484
479847
|
id: layer2.id,
|
|
479485
479848
|
label: layer2.name,
|
|
479486
|
-
type: "layer",
|
|
479849
|
+
type: isGroup ? "group" : "layer",
|
|
479487
479850
|
layerType: layer2.type,
|
|
479488
479851
|
layerData: layer2
|
|
479489
479852
|
};
|
|
@@ -480747,7 +481110,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
480747
481110
|
}
|
|
480748
481111
|
const willCheck = checkedKeys ? checkedKeys.includes(data.id) : !defaultCheckedKeys.value.includes(data.id);
|
|
480749
481112
|
const toggleNodeAndChildren = (node, checked) => {
|
|
480750
|
-
if (node.type === "layer" && node.layerData) {
|
|
481113
|
+
if ((node.type === "layer" || node.type === "group") && node.layerData) {
|
|
480751
481114
|
node.layerData.visible = checked;
|
|
480752
481115
|
handleLayerVisibilityChange(node.layerData);
|
|
480753
481116
|
if (node.layerData.type === "group") {
|
|
@@ -491455,7 +491818,7 @@ function(t3) {
|
|
|
491455
491818
|
*/
|
|
491456
491819
|
function(t3) {
|
|
491457
491820
|
function e8() {
|
|
491458
|
-
return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-
|
|
491821
|
+
return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-a7ad7c48.mjs")).catch(function(t4) {
|
|
491459
491822
|
return Promise.reject(new Error("Could not load canvg: " + t4));
|
|
491460
491823
|
}).then(function(t4) {
|
|
491461
491824
|
return t4.default ? t4.default : t4;
|