vue-openlayers-plugin 1.0.72 → 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-034c9e0d.mjs → index-363194c0.mjs} +407 -88
- package/lib/{index.es-6551e4c0.mjs → index.es-a7ad7c48.mjs} +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.umd.js +406 -87
- package/package.json +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;
|
|
@@ -469103,7 +469413,11 @@ class MapManager {
|
|
|
469103
469413
|
initMap(targetId) {
|
|
469104
469414
|
var _a3;
|
|
469105
469415
|
const projection2 = this.config.projection || "EPSG:4326";
|
|
469106
|
-
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) {
|
|
469107
469421
|
setupEPSG4490();
|
|
469108
469422
|
}
|
|
469109
469423
|
const center2 = this.config.center || [116.404, 39.915];
|
|
@@ -479482,8 +479796,12 @@ class LayerTreeManager {
|
|
|
479482
479796
|
__publicField(this, "defaultCheckedKeys", computed(() => {
|
|
479483
479797
|
const checkedKeys = [];
|
|
479484
479798
|
const collectVisibleIds = (layer2) => {
|
|
479485
|
-
if (layer2.visible
|
|
479486
|
-
|
|
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
|
+
}
|
|
479487
479805
|
}
|
|
479488
479806
|
if (layer2.children && Array.isArray(layer2.children)) {
|
|
479489
479807
|
layer2.children.forEach((child) => collectVisibleIds(child));
|
|
@@ -479524,10 +479842,11 @@ class LayerTreeManager {
|
|
|
479524
479842
|
* @returns 树节点数据
|
|
479525
479843
|
*/
|
|
479526
479844
|
buildLayerNode(layer2) {
|
|
479845
|
+
const isGroup = layer2.type === "group" || layer2.children && Array.isArray(layer2.children) && layer2.children.length > 0;
|
|
479527
479846
|
const node = {
|
|
479528
479847
|
id: layer2.id,
|
|
479529
479848
|
label: layer2.name,
|
|
479530
|
-
type: "layer",
|
|
479849
|
+
type: isGroup ? "group" : "layer",
|
|
479531
479850
|
layerType: layer2.type,
|
|
479532
479851
|
layerData: layer2
|
|
479533
479852
|
};
|
|
@@ -480791,7 +481110,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
480791
481110
|
}
|
|
480792
481111
|
const willCheck = checkedKeys ? checkedKeys.includes(data.id) : !defaultCheckedKeys.value.includes(data.id);
|
|
480793
481112
|
const toggleNodeAndChildren = (node, checked) => {
|
|
480794
|
-
if (node.type === "layer" && node.layerData) {
|
|
481113
|
+
if ((node.type === "layer" || node.type === "group") && node.layerData) {
|
|
480795
481114
|
node.layerData.visible = checked;
|
|
480796
481115
|
handleLayerVisibilityChange(node.layerData);
|
|
480797
481116
|
if (node.layerData.type === "group") {
|
|
@@ -491499,7 +491818,7 @@ function(t3) {
|
|
|
491499
491818
|
*/
|
|
491500
491819
|
function(t3) {
|
|
491501
491820
|
function e8() {
|
|
491502
|
-
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) {
|
|
491503
491822
|
return Promise.reject(new Error("Could not load canvg: " + t4));
|
|
491504
491823
|
}).then(function(t4) {
|
|
491505
491824
|
return t4.default ? t4.default : t4;
|