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
package/lib/index.umd.js
CHANGED
|
@@ -81994,6 +81994,24 @@ ${this.attributes_.map(
|
|
|
81994
81994
|
this.config.opacity = this.config.opacity / 100;
|
|
81995
81995
|
}
|
|
81996
81996
|
}
|
|
81997
|
+
/**
|
|
81998
|
+
* 注册自定义投影
|
|
81999
|
+
* @returns 注册的投影代码,如果没有注册则返回 undefined
|
|
82000
|
+
*/
|
|
82001
|
+
registerCustomProjection() {
|
|
82002
|
+
const projectionCode = this.config.projection;
|
|
82003
|
+
const projectionDefinition = this.config.projectionDefinition;
|
|
82004
|
+
if (projectionCode && projectionDefinition) {
|
|
82005
|
+
try {
|
|
82006
|
+
proj4$1.defs(projectionCode, projectionDefinition);
|
|
82007
|
+
register$3(proj4$1);
|
|
82008
|
+
return projectionCode;
|
|
82009
|
+
} catch (error2) {
|
|
82010
|
+
console.error(`Failed to register projection ${projectionCode}:`, error2);
|
|
82011
|
+
}
|
|
82012
|
+
}
|
|
82013
|
+
return void 0;
|
|
82014
|
+
}
|
|
81997
82015
|
/**
|
|
81998
82016
|
* 获取图层实例(同步方法,用于向后兼容)
|
|
81999
82017
|
*/
|
|
@@ -82451,6 +82469,7 @@ ${this.attributes_.map(
|
|
|
82451
82469
|
* 创建瓦片数据源
|
|
82452
82470
|
*/
|
|
82453
82471
|
createTileSource() {
|
|
82472
|
+
this.registerCustomProjection();
|
|
82454
82473
|
let sourceType = this.getSourceTypeFromLayerType();
|
|
82455
82474
|
sourceType = sourceType || "xyz";
|
|
82456
82475
|
switch (sourceType.toLowerCase()) {
|
|
@@ -82569,7 +82588,8 @@ ${this.attributes_.map(
|
|
|
82569
82588
|
* 创建WMS数据源
|
|
82570
82589
|
*/
|
|
82571
82590
|
createWMSSource() {
|
|
82572
|
-
|
|
82591
|
+
this.registerCustomProjection();
|
|
82592
|
+
const options = {
|
|
82573
82593
|
url: this.config.url,
|
|
82574
82594
|
params: {
|
|
82575
82595
|
"LAYERS": this.config.wmsLayers || "",
|
|
@@ -82579,7 +82599,11 @@ ${this.attributes_.map(
|
|
|
82579
82599
|
},
|
|
82580
82600
|
ratio: 1,
|
|
82581
82601
|
crossOrigin: "anonymous"
|
|
82582
|
-
}
|
|
82602
|
+
};
|
|
82603
|
+
if (this.config.projection) {
|
|
82604
|
+
options.projection = this.config.projection;
|
|
82605
|
+
}
|
|
82606
|
+
return new ImageWMS$1(options);
|
|
82583
82607
|
}
|
|
82584
82608
|
/**
|
|
82585
82609
|
* 更新WMS参数
|
|
@@ -82864,13 +82888,17 @@ ${this.attributes_.map(
|
|
|
82864
82888
|
* 创建WMTS数据源
|
|
82865
82889
|
*/
|
|
82866
82890
|
createWMTSSource() {
|
|
82867
|
-
|
|
82868
|
-
|
|
82891
|
+
const wmtsConfig = this.config.wmtsConfig || {};
|
|
82892
|
+
const url = wmtsConfig.url || this.config.url;
|
|
82893
|
+
if (!url) {
|
|
82894
|
+
throw new Error("WMTS URL is required");
|
|
82869
82895
|
}
|
|
82896
|
+
if (this.config.url && !this.capabilities && !wmtsConfig.resolutions)
|
|
82897
|
+
;
|
|
82870
82898
|
if (this.capabilities) {
|
|
82871
82899
|
const options = optionsFromCapabilities(this.capabilities, {
|
|
82872
|
-
layer: this.config.
|
|
82873
|
-
matrixSet: this.config.
|
|
82900
|
+
layer: wmtsConfig.layer || this.config.layerName || "",
|
|
82901
|
+
matrixSet: wmtsConfig.matrixSet || this.config.matrixSet || "EPSG:4326"
|
|
82874
82902
|
});
|
|
82875
82903
|
if (!options) {
|
|
82876
82904
|
throw new Error("Failed to create WMTS options from capabilities");
|
|
@@ -82886,26 +82914,46 @@ ${this.attributes_.map(
|
|
|
82886
82914
|
crossOrigin: "anonymous"
|
|
82887
82915
|
});
|
|
82888
82916
|
} else {
|
|
82889
|
-
const
|
|
82890
|
-
const
|
|
82891
|
-
|
|
82892
|
-
|
|
82893
|
-
|
|
82894
|
-
for (let z2 = 0; z2 < 19; ++z2) {
|
|
82895
|
-
resolutions[z2] = size2 / Math.pow(2, z2);
|
|
82896
|
-
matrixIds[z2] = z2;
|
|
82917
|
+
const projectionCode = wmtsConfig.projection || this.config.projection || "EPSG:4326";
|
|
82918
|
+
const projectionDefinition = wmtsConfig.projectionDefinition || this.config.projectionDefinition;
|
|
82919
|
+
if (projectionDefinition) {
|
|
82920
|
+
proj4$1.defs(projectionCode, projectionDefinition);
|
|
82921
|
+
register$3(proj4$1);
|
|
82897
82922
|
}
|
|
82923
|
+
const projection2 = get$c(projectionCode);
|
|
82924
|
+
const projectionExtent = projection2.getExtent();
|
|
82925
|
+
let resolutions = wmtsConfig.resolutions || this.config.resolutions;
|
|
82926
|
+
let matrixIds = wmtsConfig.matrixIds || this.config.matrixIds;
|
|
82927
|
+
const tileSize = wmtsConfig.tileSize || 256;
|
|
82928
|
+
const tileSizeNumber = typeof tileSize === "number" ? tileSize : tileSize[0];
|
|
82929
|
+
if (!resolutions) {
|
|
82930
|
+
const width = projectionExtent[2] - projectionExtent[0];
|
|
82931
|
+
const size2 = width / tileSizeNumber;
|
|
82932
|
+
const zoomLevels = 19;
|
|
82933
|
+
resolutions = new Array(zoomLevels);
|
|
82934
|
+
for (let z2 = 0; z2 < zoomLevels; ++z2) {
|
|
82935
|
+
resolutions[z2] = size2 / Math.pow(2, z2);
|
|
82936
|
+
}
|
|
82937
|
+
}
|
|
82938
|
+
if (!matrixIds) {
|
|
82939
|
+
matrixIds = new Array(resolutions.length);
|
|
82940
|
+
for (let z2 = 0; z2 < resolutions.length; ++z2) {
|
|
82941
|
+
matrixIds[z2] = z2.toString();
|
|
82942
|
+
}
|
|
82943
|
+
}
|
|
82944
|
+
const origin = wmtsConfig.origin || this.config.origin || [projectionExtent[0], projectionExtent[3]];
|
|
82898
82945
|
return new WMTS$3({
|
|
82899
|
-
url
|
|
82900
|
-
layer: this.config.
|
|
82901
|
-
matrixSet: this.config.
|
|
82902
|
-
format: "image/png",
|
|
82903
|
-
projection:
|
|
82904
|
-
style: this.config.
|
|
82946
|
+
url,
|
|
82947
|
+
layer: wmtsConfig.layer || this.config.layerName || "",
|
|
82948
|
+
matrixSet: wmtsConfig.matrixSet || this.config.matrixSet || projectionCode,
|
|
82949
|
+
format: wmtsConfig.format || this.config.format || "image/png",
|
|
82950
|
+
projection: projectionCode,
|
|
82951
|
+
style: wmtsConfig.style || this.config.style || "default",
|
|
82905
82952
|
tileGrid: new WMTSTileGrid$3({
|
|
82906
|
-
origin
|
|
82953
|
+
origin,
|
|
82907
82954
|
resolutions,
|
|
82908
|
-
matrixIds
|
|
82955
|
+
matrixIds,
|
|
82956
|
+
tileSize
|
|
82909
82957
|
}),
|
|
82910
82958
|
crossOrigin: "anonymous"
|
|
82911
82959
|
});
|
|
@@ -82949,21 +82997,21 @@ ${this.attributes_.map(
|
|
|
82949
82997
|
* 设置图层
|
|
82950
82998
|
*/
|
|
82951
82999
|
setLayer(layer2) {
|
|
82952
|
-
this.config.
|
|
83000
|
+
this.config.layerName = layer2;
|
|
82953
83001
|
this.layer = null;
|
|
82954
83002
|
}
|
|
82955
83003
|
/**
|
|
82956
83004
|
* 设置矩阵集
|
|
82957
83005
|
*/
|
|
82958
83006
|
setMatrixSet(matrixSet) {
|
|
82959
|
-
this.config.
|
|
83007
|
+
this.config.matrixSet = matrixSet;
|
|
82960
83008
|
this.layer = null;
|
|
82961
83009
|
}
|
|
82962
83010
|
/**
|
|
82963
83011
|
* 设置样式
|
|
82964
83012
|
*/
|
|
82965
83013
|
setWMTSStyle(style) {
|
|
82966
|
-
this.config.
|
|
83014
|
+
this.config.style = style;
|
|
82967
83015
|
this.layer = null;
|
|
82968
83016
|
}
|
|
82969
83017
|
/**
|
|
@@ -83768,10 +83816,13 @@ ${this.attributes_.map(
|
|
|
83768
83816
|
*/
|
|
83769
83817
|
createVectorSource() {
|
|
83770
83818
|
var _a3;
|
|
83819
|
+
this.registerCustomProjection();
|
|
83771
83820
|
const format2 = new GeoJSON$4();
|
|
83772
83821
|
const mapProjection = ((_a3 = this.map) == null ? void 0 : _a3.getView().getProjection().getCode()) || "EPSG:4326";
|
|
83822
|
+
const dataProjection = this.config.projection || "EPSG:4326";
|
|
83773
83823
|
if (this.config.data) {
|
|
83774
83824
|
const features2 = format2.readFeatures(this.config.data, {
|
|
83825
|
+
dataProjection,
|
|
83775
83826
|
featureProjection: mapProjection
|
|
83776
83827
|
});
|
|
83777
83828
|
this.originalFeatures = features2;
|
|
@@ -83779,7 +83830,10 @@ ${this.attributes_.map(
|
|
|
83779
83830
|
} else if (this.config.url) {
|
|
83780
83831
|
const source = new VectorSource$2({
|
|
83781
83832
|
url: this.config.url,
|
|
83782
|
-
format: new GeoJSON$4({
|
|
83833
|
+
format: new GeoJSON$4({
|
|
83834
|
+
dataProjection,
|
|
83835
|
+
featureProjection: mapProjection
|
|
83836
|
+
})
|
|
83783
83837
|
});
|
|
83784
83838
|
source.on("featuresloadend", () => {
|
|
83785
83839
|
this.originalFeatures = source.getFeatures();
|
|
@@ -84172,6 +84226,7 @@ ${this.attributes_.map(
|
|
|
84172
84226
|
* 应用过滤器(实现基类的抽象方法)
|
|
84173
84227
|
*/
|
|
84174
84228
|
applyFilters() {
|
|
84229
|
+
debugger;
|
|
84175
84230
|
const layer2 = this.getLayer();
|
|
84176
84231
|
const source = layer2.getSource();
|
|
84177
84232
|
if (!source)
|
|
@@ -84418,6 +84473,7 @@ ${this.attributes_.map(
|
|
|
84418
84473
|
* 创建图层
|
|
84419
84474
|
*/
|
|
84420
84475
|
createLayer() {
|
|
84476
|
+
this.registerCustomProjection();
|
|
84421
84477
|
this.vectorSource = new VectorSource$2({
|
|
84422
84478
|
url: this.config.url,
|
|
84423
84479
|
format: this.kmlFormat
|
|
@@ -84693,9 +84749,10 @@ ${this.attributes_.map(
|
|
|
84693
84749
|
* 初始化GML格式处理器
|
|
84694
84750
|
*/
|
|
84695
84751
|
initializeGMLFormat() {
|
|
84752
|
+
this.registerCustomProjection();
|
|
84696
84753
|
const gmlConfig = this.config.gmlConfig || {};
|
|
84697
84754
|
this.gmlFormat = new GML$1({
|
|
84698
|
-
srsName: gmlConfig.srsName || "EPSG:4326"
|
|
84755
|
+
srsName: gmlConfig.srsName || this.config.projection || "EPSG:4326"
|
|
84699
84756
|
});
|
|
84700
84757
|
}
|
|
84701
84758
|
/**
|
|
@@ -85071,13 +85128,20 @@ ${this.attributes_.map(
|
|
|
85071
85128
|
* 从WKT字符串加载数据
|
|
85072
85129
|
*/
|
|
85073
85130
|
loadWKTFromString(wktString) {
|
|
85131
|
+
var _a3;
|
|
85074
85132
|
if (!this.wktFormat || !this.vectorSource)
|
|
85075
85133
|
return;
|
|
85134
|
+
this.registerCustomProjection();
|
|
85135
|
+
const dataProjection = this.config.projection || "EPSG:4326";
|
|
85136
|
+
const featureProjection = ((_a3 = this.map) == null ? void 0 : _a3.getView().getProjection().getCode()) || "EPSG:4326";
|
|
85076
85137
|
try {
|
|
85077
85138
|
const wktLines = wktString.split("\n").filter((line2) => line2.trim());
|
|
85078
85139
|
wktLines.forEach((line2, index2) => {
|
|
85079
85140
|
try {
|
|
85080
|
-
const geometry2 = this.wktFormat.readGeometry(line2.trim()
|
|
85141
|
+
const geometry2 = this.wktFormat.readGeometry(line2.trim(), {
|
|
85142
|
+
dataProjection,
|
|
85143
|
+
featureProjection
|
|
85144
|
+
});
|
|
85081
85145
|
const feature2 = new ol$1.Feature({
|
|
85082
85146
|
geometry: geometry2,
|
|
85083
85147
|
id: `wkt_feature_${index2}`,
|
|
@@ -85163,10 +85227,16 @@ ${this.attributes_.map(
|
|
|
85163
85227
|
* 添加WKT几何
|
|
85164
85228
|
*/
|
|
85165
85229
|
addWKTGeometry(wktString, properties) {
|
|
85230
|
+
var _a3;
|
|
85166
85231
|
if (!this.wktFormat || !this.vectorSource)
|
|
85167
85232
|
return null;
|
|
85233
|
+
const dataProjection = this.config.projection || "EPSG:4326";
|
|
85234
|
+
const featureProjection = ((_a3 = this.map) == null ? void 0 : _a3.getView().getProjection().getCode()) || "EPSG:4326";
|
|
85168
85235
|
try {
|
|
85169
|
-
const geometry2 = this.wktFormat.readGeometry(wktString
|
|
85236
|
+
const geometry2 = this.wktFormat.readGeometry(wktString, {
|
|
85237
|
+
dataProjection,
|
|
85238
|
+
featureProjection
|
|
85239
|
+
});
|
|
85170
85240
|
const feature2 = new ol$1.Feature({
|
|
85171
85241
|
geometry: geometry2,
|
|
85172
85242
|
wkt: wktString,
|
|
@@ -466232,6 +466302,7 @@ ${this.attributes_.map(
|
|
|
466232
466302
|
* 创建天地图XYZ数据源
|
|
466233
466303
|
*/
|
|
466234
466304
|
createTiandituSource() {
|
|
466305
|
+
this.registerCustomProjection();
|
|
466235
466306
|
const url = this.processUrl(this.config.url || "");
|
|
466236
466307
|
const xyzOptions = {
|
|
466237
466308
|
url,
|
|
@@ -466628,6 +466699,7 @@ ${this.attributes_.map(
|
|
|
466628
466699
|
* 创建矢量瓦片数据源
|
|
466629
466700
|
*/
|
|
466630
466701
|
createVectorTileSource() {
|
|
466702
|
+
this.registerCustomProjection();
|
|
466631
466703
|
const config = this.config;
|
|
466632
466704
|
const format2 = this.createFormat();
|
|
466633
466705
|
const sourceOptions = {
|
|
@@ -466676,7 +466748,7 @@ ${this.attributes_.map(
|
|
|
466676
466748
|
});
|
|
466677
466749
|
case "geojson":
|
|
466678
466750
|
return new GeoJSON$4({
|
|
466679
|
-
dataProjection: config.dataProjection || "EPSG:4326",
|
|
466751
|
+
dataProjection: config.dataProjection || config.projection || "EPSG:4326",
|
|
466680
466752
|
featureProjection: config.featureProjection || "EPSG:4326"
|
|
466681
466753
|
});
|
|
466682
466754
|
default:
|
|
@@ -467148,6 +467220,8 @@ ${this.attributes_.map(
|
|
|
467148
467220
|
__publicField(this, "storage");
|
|
467149
467221
|
// 存储baseLayers配置,用于判断图层是否为底图
|
|
467150
467222
|
__publicField(this, "baseLayerIds", /* @__PURE__ */ new Set());
|
|
467223
|
+
// 存储共享图层组信息
|
|
467224
|
+
__publicField(this, "sharedLayerGroups", /* @__PURE__ */ new Map());
|
|
467151
467225
|
this.map = map2;
|
|
467152
467226
|
this.eventBus = eventBus;
|
|
467153
467227
|
this.storage = storage2;
|
|
@@ -467157,6 +467231,7 @@ ${this.attributes_.map(
|
|
|
467157
467231
|
* 添加图层(支持按需加载)
|
|
467158
467232
|
*/
|
|
467159
467233
|
async addLayer(config) {
|
|
467234
|
+
var _a3, _b3;
|
|
467160
467235
|
try {
|
|
467161
467236
|
const layerId = config.id || `layer_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
467162
467237
|
if (this.layerHandlers.has(layerId) || this.pendingLayerConfigs.has(layerId)) {
|
|
@@ -467171,7 +467246,11 @@ ${this.attributes_.map(
|
|
|
467171
467246
|
opacity: config.opacity ?? 1,
|
|
467172
467247
|
zIndex: config.zIndex ?? 0
|
|
467173
467248
|
};
|
|
467174
|
-
|
|
467249
|
+
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;
|
|
467250
|
+
if (isGroup) {
|
|
467251
|
+
if (fullConfig.type !== "group") {
|
|
467252
|
+
fullConfig.type = "group";
|
|
467253
|
+
}
|
|
467175
467254
|
return this.addLayerGroup(fullConfig);
|
|
467176
467255
|
}
|
|
467177
467256
|
if (fullConfig.visible && this.isBasemapLayer(layerId)) {
|
|
@@ -467283,6 +467362,174 @@ ${this.attributes_.map(
|
|
|
467283
467362
|
console.error("执行定位动画失败:", error2);
|
|
467284
467363
|
}
|
|
467285
467364
|
}
|
|
467365
|
+
/**
|
|
467366
|
+
* 设置共享图层样式函数
|
|
467367
|
+
*/
|
|
467368
|
+
setupSharedLayerStyle(layer2, reuseId) {
|
|
467369
|
+
if (!(layer2 instanceof VectorLayer$3)) {
|
|
467370
|
+
return;
|
|
467371
|
+
}
|
|
467372
|
+
const originalStyleFunction = layer2.getStyleFunction();
|
|
467373
|
+
layer2.setStyle((function(feature2, resolution) {
|
|
467374
|
+
const group2 = this.sharedLayerGroups.get(reuseId);
|
|
467375
|
+
if (!group2)
|
|
467376
|
+
return null;
|
|
467377
|
+
let matched = false;
|
|
467378
|
+
let styleToUse = null;
|
|
467379
|
+
for (const layerId of group2.logicalLayers) {
|
|
467380
|
+
const config = this.layerConfigs.get(layerId);
|
|
467381
|
+
if (config && config.visible) {
|
|
467382
|
+
try {
|
|
467383
|
+
if (this.checkFeatureFilter(feature2, config.filters)) {
|
|
467384
|
+
matched = true;
|
|
467385
|
+
const handler = this.layerHandlers.get(layerId);
|
|
467386
|
+
if (handler) {
|
|
467387
|
+
const isFirst = group2.logicalLayers.values().next().value === layerId;
|
|
467388
|
+
if (isFirst) {
|
|
467389
|
+
if (originalStyleFunction) {
|
|
467390
|
+
styleToUse = originalStyleFunction(feature2, resolution);
|
|
467391
|
+
}
|
|
467392
|
+
} else {
|
|
467393
|
+
const logicalLayer = handler.getLayer();
|
|
467394
|
+
if (logicalLayer && logicalLayer instanceof VectorLayer$3 && logicalLayer !== layer2) {
|
|
467395
|
+
const styleFunc = logicalLayer.getStyleFunction();
|
|
467396
|
+
if (styleFunc) {
|
|
467397
|
+
styleToUse = styleFunc(feature2, resolution);
|
|
467398
|
+
}
|
|
467399
|
+
} else {
|
|
467400
|
+
if (originalStyleFunction) {
|
|
467401
|
+
styleToUse = originalStyleFunction(feature2, resolution);
|
|
467402
|
+
}
|
|
467403
|
+
}
|
|
467404
|
+
}
|
|
467405
|
+
if (styleToUse || matched) {
|
|
467406
|
+
break;
|
|
467407
|
+
}
|
|
467408
|
+
}
|
|
467409
|
+
}
|
|
467410
|
+
} catch (e3) {
|
|
467411
|
+
console.error("Error checking feature filter:", e3);
|
|
467412
|
+
}
|
|
467413
|
+
}
|
|
467414
|
+
}
|
|
467415
|
+
if (matched) {
|
|
467416
|
+
if (styleToUse)
|
|
467417
|
+
return styleToUse;
|
|
467418
|
+
if (originalStyleFunction)
|
|
467419
|
+
return originalStyleFunction(feature2, resolution);
|
|
467420
|
+
return void 0;
|
|
467421
|
+
}
|
|
467422
|
+
return null;
|
|
467423
|
+
}).bind(this));
|
|
467424
|
+
}
|
|
467425
|
+
/**
|
|
467426
|
+
* 更新共享图层状态(处理WMS参数更新或Vector重绘)
|
|
467427
|
+
*/
|
|
467428
|
+
updateSharedLayerState(reuseId) {
|
|
467429
|
+
const group2 = this.sharedLayerGroups.get(reuseId);
|
|
467430
|
+
if (!group2)
|
|
467431
|
+
return;
|
|
467432
|
+
const layer2 = group2.physicalLayer;
|
|
467433
|
+
const source = layer2.getSource();
|
|
467434
|
+
if (source && typeof source.updateParams === "function") {
|
|
467435
|
+
const visibleLayers = Array.from(group2.logicalLayers).filter((id2) => {
|
|
467436
|
+
const config = this.layerConfigs.get(id2);
|
|
467437
|
+
return config && config.visible;
|
|
467438
|
+
});
|
|
467439
|
+
const wmsLayersList = [];
|
|
467440
|
+
const cqlFilterList = [];
|
|
467441
|
+
visibleLayers.forEach((id2) => {
|
|
467442
|
+
var _a3, _b3;
|
|
467443
|
+
const config = this.layerConfigs.get(id2);
|
|
467444
|
+
if (config) {
|
|
467445
|
+
const layers = config.wmsLayers || ((_b3 = (_a3 = config.config) == null ? void 0 : _a3.wms) == null ? void 0 : _b3.layers);
|
|
467446
|
+
if (layers) {
|
|
467447
|
+
wmsLayersList.push(layers);
|
|
467448
|
+
let cql = "";
|
|
467449
|
+
if (config.filters && config.filters.length > 0) {
|
|
467450
|
+
const conditions = config.filters.filter((f2) => f2.enabled && f2.type === FilterType.ATTRIBUTE).map((f2) => {
|
|
467451
|
+
const attrFilter = f2;
|
|
467452
|
+
let val = attrFilter.value;
|
|
467453
|
+
if (typeof val === "string") {
|
|
467454
|
+
val = `'${val}'`;
|
|
467455
|
+
}
|
|
467456
|
+
switch (attrFilter.operator) {
|
|
467457
|
+
case FilterOperator.EQUAL:
|
|
467458
|
+
return `${attrFilter.property}=${val}`;
|
|
467459
|
+
case FilterOperator.NOT_EQUAL:
|
|
467460
|
+
return `${attrFilter.property}<>${val}`;
|
|
467461
|
+
case FilterOperator.GREATER_THAN:
|
|
467462
|
+
return `${attrFilter.property}>${val}`;
|
|
467463
|
+
case FilterOperator.LESS_THAN:
|
|
467464
|
+
return `${attrFilter.property}<${val}`;
|
|
467465
|
+
case FilterOperator.GREATER_EQUAL:
|
|
467466
|
+
return `${attrFilter.property}>=${val}`;
|
|
467467
|
+
case FilterOperator.LESS_EQUAL:
|
|
467468
|
+
return `${attrFilter.property}<=${val}`;
|
|
467469
|
+
case FilterOperator.LIKE:
|
|
467470
|
+
return `${attrFilter.property} LIKE ${val}`;
|
|
467471
|
+
case FilterOperator.IN:
|
|
467472
|
+
if (Array.isArray(attrFilter.value)) {
|
|
467473
|
+
const inVals = attrFilter.value.map((v5) => typeof v5 === "string" ? `'${v5}'` : v5).join(",");
|
|
467474
|
+
return `${attrFilter.property} IN (${inVals})`;
|
|
467475
|
+
}
|
|
467476
|
+
return `${attrFilter.property} IN (${attrFilter.value})`;
|
|
467477
|
+
default:
|
|
467478
|
+
return "";
|
|
467479
|
+
}
|
|
467480
|
+
}).filter((c2) => c2 !== "");
|
|
467481
|
+
if (conditions.length > 0) {
|
|
467482
|
+
cql = conditions.join(" AND ");
|
|
467483
|
+
}
|
|
467484
|
+
}
|
|
467485
|
+
cqlFilterList.push(cql === "" ? "INCLUDE" : cql);
|
|
467486
|
+
}
|
|
467487
|
+
}
|
|
467488
|
+
});
|
|
467489
|
+
if (wmsLayersList.length > 0) {
|
|
467490
|
+
const newLayersParam = wmsLayersList.join(",");
|
|
467491
|
+
const newCqlFilterParam = cqlFilterList.join(";");
|
|
467492
|
+
const params2 = { "LAYERS": newLayersParam };
|
|
467493
|
+
if (cqlFilterList.some((c2) => c2 !== "INCLUDE")) {
|
|
467494
|
+
params2["CQL_FILTER"] = newCqlFilterParam;
|
|
467495
|
+
} else {
|
|
467496
|
+
params2["CQL_FILTER"] = null;
|
|
467497
|
+
}
|
|
467498
|
+
source.updateParams(params2);
|
|
467499
|
+
console.log(`共享WMS图层 ${reuseId} 更新参数: LAYERS=${newLayersParam}, CQL_FILTER=${newCqlFilterParam}`);
|
|
467500
|
+
return;
|
|
467501
|
+
}
|
|
467502
|
+
}
|
|
467503
|
+
layer2.changed();
|
|
467504
|
+
}
|
|
467505
|
+
/**
|
|
467506
|
+
* 检查要素是否匹配过滤条件
|
|
467507
|
+
*/
|
|
467508
|
+
checkFeatureFilter(feature2, filters) {
|
|
467509
|
+
if (!filters || filters.length === 0) {
|
|
467510
|
+
return true;
|
|
467511
|
+
}
|
|
467512
|
+
for (const filter2 of filters) {
|
|
467513
|
+
if (!filter2.enabled)
|
|
467514
|
+
continue;
|
|
467515
|
+
if (filter2.type === FilterType.ATTRIBUTE) {
|
|
467516
|
+
const props = feature2.getProperties();
|
|
467517
|
+
const value = props[filter2.property];
|
|
467518
|
+
const targetValue = filter2.value;
|
|
467519
|
+
switch (filter2.operator) {
|
|
467520
|
+
case FilterOperator.EQUAL:
|
|
467521
|
+
if (value != targetValue)
|
|
467522
|
+
return false;
|
|
467523
|
+
break;
|
|
467524
|
+
case FilterOperator.NOT_EQUAL:
|
|
467525
|
+
if (value == targetValue)
|
|
467526
|
+
return false;
|
|
467527
|
+
break;
|
|
467528
|
+
}
|
|
467529
|
+
}
|
|
467530
|
+
}
|
|
467531
|
+
return true;
|
|
467532
|
+
}
|
|
467286
467533
|
/**
|
|
467287
467534
|
* 获取缓动函数
|
|
467288
467535
|
*/
|
|
@@ -467313,19 +467560,44 @@ ${this.attributes_.map(
|
|
|
467313
467560
|
* 异步添加图层
|
|
467314
467561
|
*/
|
|
467315
467562
|
async addLayerAsync(fullConfig, handler) {
|
|
467316
|
-
var _a3;
|
|
467563
|
+
var _a3, _b3;
|
|
467317
467564
|
try {
|
|
467318
467565
|
const layer2 = await handler.getLayerAsync();
|
|
467319
467566
|
layer2.set("layerId", fullConfig.id);
|
|
467320
467567
|
this.layerHandlers.set(fullConfig.id, handler);
|
|
467321
467568
|
this.layerConfigs.set(fullConfig.id, fullConfig);
|
|
467322
467569
|
console.log("kjthis.layerConfigs:", this.layerConfigs);
|
|
467323
|
-
|
|
467570
|
+
let isReuse = false;
|
|
467571
|
+
if (fullConfig.reuseId) {
|
|
467572
|
+
const reuseId = fullConfig.reuseId;
|
|
467573
|
+
let group2 = this.sharedLayerGroups.get(reuseId);
|
|
467574
|
+
if (group2) {
|
|
467575
|
+
console.log(`图层 ${fullConfig.id} 复用物理图层 ${reuseId}`);
|
|
467576
|
+
group2.logicalLayers.add(fullConfig.id);
|
|
467577
|
+
isReuse = true;
|
|
467578
|
+
this.updateSharedLayerState(reuseId);
|
|
467579
|
+
} else {
|
|
467580
|
+
console.log(`图层 ${fullConfig.id} 创建共享物理图层 ${reuseId}`);
|
|
467581
|
+
this.sharedLayerGroups.set(reuseId, {
|
|
467582
|
+
physicalLayer: layer2,
|
|
467583
|
+
logicalLayers: /* @__PURE__ */ new Set([fullConfig.id])
|
|
467584
|
+
});
|
|
467585
|
+
this.setupSharedLayerStyle(layer2, reuseId);
|
|
467586
|
+
this.map.addLayer(layer2);
|
|
467587
|
+
}
|
|
467588
|
+
} else {
|
|
467589
|
+
this.map.addLayer(layer2);
|
|
467590
|
+
}
|
|
467324
467591
|
if (fullConfig.zIndex !== void 0) {
|
|
467325
|
-
|
|
467592
|
+
if (fullConfig.reuseId && this.sharedLayerGroups.has(fullConfig.reuseId)) {
|
|
467593
|
+
const group2 = this.sharedLayerGroups.get(fullConfig.reuseId);
|
|
467594
|
+
group2.physicalLayer.setZIndex(fullConfig.zIndex);
|
|
467595
|
+
} else {
|
|
467596
|
+
handler.setZIndex(fullConfig.zIndex);
|
|
467597
|
+
}
|
|
467326
467598
|
console.log(`图层 ${fullConfig.id} 设置 zIndex: ${fullConfig.zIndex}`);
|
|
467327
467599
|
}
|
|
467328
|
-
if ("applyLayerStyles" in handler) {
|
|
467600
|
+
if ("applyLayerStyles" in handler && !isReuse) {
|
|
467329
467601
|
setTimeout(() => {
|
|
467330
467602
|
handler.applyLayerStyles();
|
|
467331
467603
|
}, 50);
|
|
@@ -467339,7 +467611,9 @@ ${this.attributes_.map(
|
|
|
467339
467611
|
layerConfig: fullConfig
|
|
467340
467612
|
});
|
|
467341
467613
|
if (((_a3 = fullConfig.locationAnimation) == null ? void 0 : _a3.enabled) && fullConfig.visible) {
|
|
467342
|
-
this.
|
|
467614
|
+
if (!isReuse || !((_b3 = this.sharedLayerGroups.get(fullConfig.reuseId)) == null ? void 0 : _b3.physicalLayer.getVisible())) {
|
|
467615
|
+
this.handleLocationAnimation(fullConfig.reuseId ? this.sharedLayerGroups.get(fullConfig.reuseId).physicalLayer : layer2, fullConfig);
|
|
467616
|
+
}
|
|
467343
467617
|
}
|
|
467344
467618
|
return true;
|
|
467345
467619
|
} catch (error2) {
|
|
@@ -467364,7 +467638,7 @@ ${this.attributes_.map(
|
|
|
467364
467638
|
const childLayers = [];
|
|
467365
467639
|
if (groupConfig.children) {
|
|
467366
467640
|
for (const childConfig of groupConfig.children) {
|
|
467367
|
-
const childLayerId = `${groupConfig.id}_child_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
467641
|
+
const childLayerId = childConfig.id || `${groupConfig.id}_child_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
467368
467642
|
const childFullConfig = {
|
|
467369
467643
|
...childConfig,
|
|
467370
467644
|
id: childLayerId,
|
|
@@ -467377,9 +467651,10 @@ ${this.attributes_.map(
|
|
|
467377
467651
|
}
|
|
467378
467652
|
}
|
|
467379
467653
|
}
|
|
467654
|
+
const layersList = [];
|
|
467380
467655
|
if (groupConfig.layers) {
|
|
467381
467656
|
for (const layerConfig of groupConfig.layers) {
|
|
467382
|
-
const layerLayerId = `${groupConfig.id}_layer_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
467657
|
+
const layerLayerId = layerConfig.id || `${groupConfig.id}_layer_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
467383
467658
|
const layerFullConfig = {
|
|
467384
467659
|
...layerConfig,
|
|
467385
467660
|
id: layerLayerId,
|
|
@@ -467388,10 +467663,14 @@ ${this.attributes_.map(
|
|
|
467388
467663
|
opacity: layerConfig.opacity ?? groupConfig.opacity
|
|
467389
467664
|
};
|
|
467390
467665
|
if (this.addLayer(layerFullConfig)) {
|
|
467666
|
+
layersList.push(layerFullConfig);
|
|
467391
467667
|
}
|
|
467392
467668
|
}
|
|
467393
467669
|
}
|
|
467394
467670
|
groupConfig.children = childLayers;
|
|
467671
|
+
if (layersList.length > 0) {
|
|
467672
|
+
groupConfig.layers = layersList;
|
|
467673
|
+
}
|
|
467395
467674
|
this.layerConfigs.set(groupConfig.id, groupConfig);
|
|
467396
467675
|
this.saveLayerConfigs();
|
|
467397
467676
|
this.eventBus.emit("layer-added", {
|
|
@@ -467418,15 +467697,26 @@ ${this.attributes_.map(
|
|
|
467418
467697
|
console.warn(`未找到图层配置: ${layerId}`);
|
|
467419
467698
|
return false;
|
|
467420
467699
|
}
|
|
467421
|
-
if (handler && this.layerConfigs.has(layerId)) {
|
|
467422
|
-
if (config.type === "group"
|
|
467423
|
-
|
|
467424
|
-
|
|
467700
|
+
if ((handler || config.type === "group") && this.layerConfigs.has(layerId)) {
|
|
467701
|
+
if (config.type === "group") {
|
|
467702
|
+
if (config.children) {
|
|
467703
|
+
for (const child of config.children) {
|
|
467704
|
+
this.removeLayer(child.id);
|
|
467705
|
+
}
|
|
467425
467706
|
}
|
|
467426
|
-
|
|
467707
|
+
if (config.layers) {
|
|
467708
|
+
for (const layer2 of config.layers) {
|
|
467709
|
+
this.removeLayer(layer2.id);
|
|
467710
|
+
}
|
|
467711
|
+
}
|
|
467712
|
+
if (handler)
|
|
467713
|
+
handler.destroy();
|
|
467714
|
+
} else if (handler) {
|
|
467427
467715
|
handler.destroy();
|
|
467428
467716
|
}
|
|
467429
|
-
|
|
467717
|
+
if (handler) {
|
|
467718
|
+
this.layerHandlers.delete(layerId);
|
|
467719
|
+
}
|
|
467430
467720
|
this.layerConfigs.delete(layerId);
|
|
467431
467721
|
}
|
|
467432
467722
|
this.pendingLayerConfigs.delete(layerId);
|
|
@@ -467498,7 +467788,7 @@ ${this.attributes_.map(
|
|
|
467498
467788
|
console.warn(`图层配置不存在: ${layerId}`);
|
|
467499
467789
|
return false;
|
|
467500
467790
|
}
|
|
467501
|
-
if (config.type === "group" && config.children) {
|
|
467791
|
+
if (config.type === "group" && (config.children || config.layers)) {
|
|
467502
467792
|
return await this.setGroupLayerVisible(layerId, visible);
|
|
467503
467793
|
}
|
|
467504
467794
|
if (visible && !this.layerHandlers.has(layerId)) {
|
|
@@ -467513,28 +467803,58 @@ ${this.attributes_.map(
|
|
|
467513
467803
|
if (visible && this.isBasemapLayer(layerId)) {
|
|
467514
467804
|
await this.hideOtherBasemaps(layerId);
|
|
467515
467805
|
}
|
|
467516
|
-
handler.setVisible(visible);
|
|
467517
467806
|
config.visible = visible;
|
|
467518
|
-
this.saveLayerConfigs();
|
|
467519
467807
|
if (this.pendingLayerConfigs.has(layerId)) {
|
|
467520
467808
|
this.pendingLayerConfigs.set(layerId, config);
|
|
467521
467809
|
}
|
|
467522
|
-
|
|
467523
|
-
|
|
467524
|
-
const
|
|
467525
|
-
|
|
467526
|
-
this.
|
|
467527
|
-
|
|
467528
|
-
|
|
467529
|
-
|
|
467530
|
-
|
|
467531
|
-
|
|
467532
|
-
|
|
467533
|
-
|
|
467534
|
-
|
|
467535
|
-
|
|
467810
|
+
this.layerConfigs.set(layerId, config);
|
|
467811
|
+
if (config.reuseId && this.sharedLayerGroups.has(config.reuseId)) {
|
|
467812
|
+
const group2 = this.sharedLayerGroups.get(config.reuseId);
|
|
467813
|
+
const anyVisible = Array.from(group2.logicalLayers).some((id2) => {
|
|
467814
|
+
const c2 = this.layerConfigs.get(id2);
|
|
467815
|
+
return c2 && c2.visible;
|
|
467816
|
+
});
|
|
467817
|
+
group2.physicalLayer.setVisible(anyVisible);
|
|
467818
|
+
this.updateSharedLayerState(config.reuseId);
|
|
467819
|
+
console.log(`共享图层 ${config.reuseId} 逻辑图层 ${layerId} 可见性设为 ${visible}, 物理图层可见性: ${anyVisible}`);
|
|
467820
|
+
if (visible) {
|
|
467821
|
+
if (anyVisible) {
|
|
467822
|
+
const layer2 = group2.physicalLayer;
|
|
467823
|
+
const animCfg = config.locationAnimation;
|
|
467824
|
+
if (animCfg && animCfg.enabled) {
|
|
467825
|
+
this.handleLocationAnimation(layer2, config);
|
|
467826
|
+
} else if (config.fitToExtent) {
|
|
467827
|
+
const defaultAnim = {
|
|
467828
|
+
enabled: true,
|
|
467829
|
+
duration: 1e3,
|
|
467830
|
+
easing: "ease-out",
|
|
467831
|
+
maxZoom: 16,
|
|
467832
|
+
padding: [50, 50, 50, 50]
|
|
467833
|
+
};
|
|
467834
|
+
this.performLocationAnimation(layer2, config, defaultAnim);
|
|
467835
|
+
}
|
|
467836
|
+
}
|
|
467837
|
+
}
|
|
467838
|
+
} else {
|
|
467839
|
+
handler.setVisible(visible);
|
|
467840
|
+
if (visible) {
|
|
467841
|
+
const layer2 = handler.getLayer();
|
|
467842
|
+
const animCfg = config.locationAnimation;
|
|
467843
|
+
if (animCfg && animCfg.enabled) {
|
|
467844
|
+
this.handleLocationAnimation(layer2, config);
|
|
467845
|
+
} else if (config.fitToExtent) {
|
|
467846
|
+
const defaultAnim = {
|
|
467847
|
+
enabled: true,
|
|
467848
|
+
duration: 1e3,
|
|
467849
|
+
easing: "ease-out",
|
|
467850
|
+
maxZoom: 16,
|
|
467851
|
+
padding: [50, 50, 50, 50]
|
|
467852
|
+
};
|
|
467853
|
+
this.performLocationAnimation(layer2, config, defaultAnim);
|
|
467854
|
+
}
|
|
467536
467855
|
}
|
|
467537
467856
|
}
|
|
467857
|
+
this.saveLayerConfigs();
|
|
467538
467858
|
this.eventBus.emit("layer-visibility-changed", {
|
|
467539
467859
|
layerId,
|
|
467540
467860
|
visible,
|
|
@@ -467586,10 +467906,9 @@ ${this.attributes_.map(
|
|
|
467586
467906
|
}
|
|
467587
467907
|
}
|
|
467588
467908
|
if (groupConfig.layers) {
|
|
467589
|
-
const
|
|
467590
|
-
|
|
467591
|
-
|
|
467592
|
-
const result = await this.setLayerVisible(layerId, visible);
|
|
467909
|
+
for (const layerConfig of groupConfig.layers) {
|
|
467910
|
+
if (layerConfig.id) {
|
|
467911
|
+
const result = await this.setLayerVisible(layerConfig.id, visible);
|
|
467593
467912
|
results.push(result);
|
|
467594
467913
|
}
|
|
467595
467914
|
}
|
|
@@ -467841,7 +468160,6 @@ ${this.attributes_.map(
|
|
|
467841
468160
|
* 按需加载图层(原loadLayerConfigs的单个图层版本)
|
|
467842
468161
|
*/
|
|
467843
468162
|
async loadLayerOnDemand(layerId) {
|
|
467844
|
-
var _a3;
|
|
467845
468163
|
try {
|
|
467846
468164
|
if (this.layerHandlers.has(layerId)) {
|
|
467847
468165
|
return true;
|
|
@@ -467853,23 +468171,15 @@ ${this.attributes_.map(
|
|
|
467853
468171
|
}
|
|
467854
468172
|
const handler = layerFactory.createLayerHandler(config);
|
|
467855
468173
|
handler.setMap(this.map);
|
|
467856
|
-
const
|
|
467857
|
-
|
|
467858
|
-
|
|
467859
|
-
|
|
467860
|
-
|
|
467861
|
-
|
|
467862
|
-
|
|
467863
|
-
|
|
467864
|
-
}
|
|
467865
|
-
this.pendingLayerConfigs.delete(layerId);
|
|
467866
|
-
if ("applyLayerStyles" in handler) {
|
|
467867
|
-
setTimeout(() => {
|
|
467868
|
-
handler.applyLayerStyles();
|
|
467869
|
-
}, 50);
|
|
468174
|
+
const success = await this.addLayerAsync(config, handler);
|
|
468175
|
+
if (success) {
|
|
468176
|
+
this.pendingLayerConfigs.delete(layerId);
|
|
468177
|
+
console.log(`图层 ${layerId} 按需加载完成`);
|
|
468178
|
+
return true;
|
|
468179
|
+
} else {
|
|
468180
|
+
console.error(`按需加载图层 ${layerId} 失败`);
|
|
468181
|
+
return false;
|
|
467870
468182
|
}
|
|
467871
|
-
console.log(`图层 ${layerId} 按需加载完成`);
|
|
467872
|
-
return true;
|
|
467873
468183
|
} catch (error2) {
|
|
467874
468184
|
console.error(`按需加载图层 ${layerId} 失败:`, error2);
|
|
467875
468185
|
return false;
|
|
@@ -468330,13 +468640,15 @@ ${this.attributes_.map(
|
|
|
468330
468640
|
this.map.removeLayer(this.highlightLayer);
|
|
468331
468641
|
}
|
|
468332
468642
|
}
|
|
468643
|
+
const _hoisted_1$p = ["id"];
|
|
468333
468644
|
const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
|
|
468334
468645
|
__name: "BasePopup",
|
|
468335
468646
|
props: {
|
|
468336
468647
|
config: {},
|
|
468337
468648
|
coordinate: {},
|
|
468338
468649
|
feature: {},
|
|
468339
|
-
visible: { type: Boolean, default: false }
|
|
468650
|
+
visible: { type: Boolean, default: false },
|
|
468651
|
+
id: {}
|
|
468340
468652
|
},
|
|
468341
468653
|
emits: ["close", "show", "hide", "content-change"],
|
|
468342
468654
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -468445,6 +468757,9 @@ ${this.attributes_.map(
|
|
|
468445
468757
|
ref_key: "contentElement",
|
|
468446
468758
|
ref: contentElement
|
|
468447
468759
|
}, [
|
|
468760
|
+
vue.createElementVNode("div", {
|
|
468761
|
+
id: `popup-slot-${_ctx.id}`
|
|
468762
|
+
}, null, 8, _hoisted_1$p),
|
|
468448
468763
|
vue.renderSlot(_ctx.$slots, "default", {
|
|
468449
468764
|
feature: _ctx.feature,
|
|
468450
468765
|
coordinate: _ctx.coordinate,
|
|
@@ -468472,7 +468787,8 @@ ${this.attributes_.map(
|
|
|
468472
468787
|
config: {},
|
|
468473
468788
|
coordinate: {},
|
|
468474
468789
|
feature: {},
|
|
468475
|
-
visible: { type: Boolean, default: false }
|
|
468790
|
+
visible: { type: Boolean, default: false },
|
|
468791
|
+
id: {}
|
|
468476
468792
|
},
|
|
468477
468793
|
emits: ["close", "show", "hide"],
|
|
468478
468794
|
setup(__props, { emit: __emit }) {
|
|
@@ -468518,6 +468834,7 @@ ${this.attributes_.map(
|
|
|
468518
468834
|
coordinate: _ctx.coordinate,
|
|
468519
468835
|
feature: _ctx.feature,
|
|
468520
468836
|
visible: _ctx.visible,
|
|
468837
|
+
id: _ctx.id,
|
|
468521
468838
|
onClose: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close")),
|
|
468522
468839
|
onShow: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("show")),
|
|
468523
468840
|
onHide: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("hide"))
|
|
@@ -468535,7 +468852,7 @@ ${this.attributes_.map(
|
|
|
468535
468852
|
];
|
|
468536
468853
|
}),
|
|
468537
468854
|
_: 1
|
|
468538
|
-
}, 8, ["config", "coordinate", "feature", "visible"]);
|
|
468855
|
+
}, 8, ["config", "coordinate", "feature", "visible", "id"]);
|
|
468539
468856
|
};
|
|
468540
468857
|
}
|
|
468541
468858
|
});
|
|
@@ -468586,7 +468903,8 @@ ${this.attributes_.map(
|
|
|
468586
468903
|
config: {},
|
|
468587
468904
|
coordinate: {},
|
|
468588
468905
|
feature: {},
|
|
468589
|
-
visible: { type: Boolean, default: false }
|
|
468906
|
+
visible: { type: Boolean, default: false },
|
|
468907
|
+
id: {}
|
|
468590
468908
|
},
|
|
468591
468909
|
emits: ["close", "show", "hide"],
|
|
468592
468910
|
setup(__props, { emit: __emit }) {
|
|
@@ -468717,6 +469035,7 @@ ${this.attributes_.map(
|
|
|
468717
469035
|
coordinate: _ctx.coordinate,
|
|
468718
469036
|
feature: _ctx.feature,
|
|
468719
469037
|
visible: _ctx.visible,
|
|
469038
|
+
id: _ctx.id,
|
|
468720
469039
|
onClose: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("close")),
|
|
468721
469040
|
onShow: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("show")),
|
|
468722
469041
|
onHide: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("hide"))
|
|
@@ -468828,7 +469147,7 @@ ${this.attributes_.map(
|
|
|
468828
469147
|
])) : vue.createCommentVNode("", true)
|
|
468829
469148
|
]),
|
|
468830
469149
|
_: 1
|
|
468831
|
-
}, 8, ["config", "coordinate", "feature", "visible"]);
|
|
469150
|
+
}, 8, ["config", "coordinate", "feature", "visible", "id"]);
|
|
468832
469151
|
};
|
|
468833
469152
|
}
|
|
468834
469153
|
});
|
|
@@ -468916,7 +469235,8 @@ ${this.attributes_.map(
|
|
|
468916
469235
|
config: {},
|
|
468917
469236
|
coordinate: {},
|
|
468918
469237
|
feature: {},
|
|
468919
|
-
visible: { type: Boolean, default: false }
|
|
469238
|
+
visible: { type: Boolean, default: false },
|
|
469239
|
+
id: {}
|
|
468920
469240
|
},
|
|
468921
469241
|
emits: ["close", "show", "hide", "rowClick"],
|
|
468922
469242
|
setup(__props, { emit: __emit }) {
|
|
@@ -469060,6 +469380,7 @@ ${this.attributes_.map(
|
|
|
469060
469380
|
coordinate: _ctx.coordinate,
|
|
469061
469381
|
feature: _ctx.feature,
|
|
469062
469382
|
visible: _ctx.visible,
|
|
469383
|
+
id: _ctx.id,
|
|
469063
469384
|
onClose: _cache[6] || (_cache[6] = ($event) => _ctx.$emit("close")),
|
|
469064
469385
|
onShow: _cache[7] || (_cache[7] = ($event) => _ctx.$emit("show")),
|
|
469065
469386
|
onHide: _cache[8] || (_cache[8] = ($event) => _ctx.$emit("hide"))
|
|
@@ -469264,7 +469585,7 @@ ${this.attributes_.map(
|
|
|
469264
469585
|
])
|
|
469265
469586
|
]),
|
|
469266
469587
|
_: 1
|
|
469267
|
-
}, 8, ["config", "coordinate", "feature", "visible"]);
|
|
469588
|
+
}, 8, ["config", "coordinate", "feature", "visible", "id"]);
|
|
469268
469589
|
};
|
|
469269
469590
|
}
|
|
469270
469591
|
});
|
|
@@ -469481,7 +469802,8 @@ ${this.attributes_.map(
|
|
|
469481
469802
|
}
|
|
469482
469803
|
},
|
|
469483
469804
|
positioning: "bottom-center",
|
|
469484
|
-
|
|
469805
|
+
// 关键:阻止来自popup的事件传递到地图,避免点击关闭按钮触发地图单击
|
|
469806
|
+
stopEvent: true,
|
|
469485
469807
|
offset: [0, -10]
|
|
469486
469808
|
});
|
|
469487
469809
|
let component = null;
|
|
@@ -469489,6 +469811,7 @@ ${this.attributes_.map(
|
|
|
469489
469811
|
switch (type) {
|
|
469490
469812
|
case "html":
|
|
469491
469813
|
app = vue.createApp(_sfc_main$p, {
|
|
469814
|
+
id: popupId,
|
|
469492
469815
|
config: { ...this.config.defaultConfig, ...config },
|
|
469493
469816
|
coordinate,
|
|
469494
469817
|
feature: feature2,
|
|
@@ -469498,6 +469821,7 @@ ${this.attributes_.map(
|
|
|
469498
469821
|
break;
|
|
469499
469822
|
case "image":
|
|
469500
469823
|
app = vue.createApp(_sfc_main$o, {
|
|
469824
|
+
id: popupId,
|
|
469501
469825
|
config: { ...this.config.defaultConfig, ...config },
|
|
469502
469826
|
coordinate,
|
|
469503
469827
|
feature: feature2,
|
|
@@ -469507,6 +469831,7 @@ ${this.attributes_.map(
|
|
|
469507
469831
|
break;
|
|
469508
469832
|
case "array":
|
|
469509
469833
|
app = vue.createApp(_sfc_main$n, {
|
|
469834
|
+
id: popupId,
|
|
469510
469835
|
config: { ...this.config.defaultConfig, ...config },
|
|
469511
469836
|
coordinate,
|
|
469512
469837
|
feature: feature2,
|
|
@@ -469522,6 +469847,7 @@ ${this.attributes_.map(
|
|
|
469522
469847
|
const allConfig = config;
|
|
469523
469848
|
if (allConfig.htmlContent) {
|
|
469524
469849
|
app = vue.createApp(_sfc_main$p, {
|
|
469850
|
+
id: popupId,
|
|
469525
469851
|
config: {
|
|
469526
469852
|
...allConfig,
|
|
469527
469853
|
content: allConfig.htmlContent
|
|
@@ -469533,6 +469859,7 @@ ${this.attributes_.map(
|
|
|
469533
469859
|
});
|
|
469534
469860
|
} else if (allConfig.images) {
|
|
469535
469861
|
app = vue.createApp(_sfc_main$o, {
|
|
469862
|
+
id: popupId,
|
|
469536
469863
|
config: {
|
|
469537
469864
|
...allConfig,
|
|
469538
469865
|
images: allConfig.images
|
|
@@ -469544,6 +469871,7 @@ ${this.attributes_.map(
|
|
|
469544
469871
|
});
|
|
469545
469872
|
} else if (allConfig.data) {
|
|
469546
469873
|
app = vue.createApp(_sfc_main$n, {
|
|
469874
|
+
id: popupId,
|
|
469547
469875
|
config: {
|
|
469548
469876
|
...allConfig,
|
|
469549
469877
|
data: allConfig.data
|
|
@@ -469559,6 +469887,7 @@ ${this.attributes_.map(
|
|
|
469559
469887
|
});
|
|
469560
469888
|
} else {
|
|
469561
469889
|
app = vue.createApp(_sfc_main$q, {
|
|
469890
|
+
id: popupId,
|
|
469562
469891
|
config: allConfig,
|
|
469563
469892
|
coordinate,
|
|
469564
469893
|
feature: feature2,
|
|
@@ -469567,6 +469896,28 @@ ${this.attributes_.map(
|
|
|
469567
469896
|
});
|
|
469568
469897
|
}
|
|
469569
469898
|
break;
|
|
469899
|
+
case "custom": {
|
|
469900
|
+
const customConfig = config;
|
|
469901
|
+
const CustomComp = customConfig.component;
|
|
469902
|
+
const computedProps = typeof customConfig.props === "function" ? customConfig.props(feature2, coordinate) : customConfig.props || {};
|
|
469903
|
+
const cfg = { ...this.config.defaultConfig, ...customConfig };
|
|
469904
|
+
const onClose = () => this.closePopup(popupId);
|
|
469905
|
+
const Root = vue.defineComponent({
|
|
469906
|
+
name: "CustomPopupRoot",
|
|
469907
|
+
setup() {
|
|
469908
|
+
return { cfg, coordinate, feature: feature2, CustomComp, computedProps, onClose };
|
|
469909
|
+
},
|
|
469910
|
+
render() {
|
|
469911
|
+
return vue.h(
|
|
469912
|
+
_sfc_main$q,
|
|
469913
|
+
{ config: this.cfg, coordinate: this.coordinate, feature: this.feature, visible: true, id: popupId, onClose: this.onClose },
|
|
469914
|
+
{ default: () => vue.h(this.CustomComp, { ...this.computedProps, feature: this.feature, coordinate: this.coordinate, config: this.cfg }) }
|
|
469915
|
+
);
|
|
469916
|
+
}
|
|
469917
|
+
});
|
|
469918
|
+
app = vue.createApp(Root);
|
|
469919
|
+
break;
|
|
469920
|
+
}
|
|
469570
469921
|
default:
|
|
469571
469922
|
console.error(`不支持的 popup 类型: ${type}`);
|
|
469572
469923
|
return null;
|
|
@@ -469595,24 +469946,26 @@ ${this.attributes_.map(
|
|
|
469595
469946
|
* 显示 popup
|
|
469596
469947
|
*/
|
|
469597
469948
|
showPopup(popup) {
|
|
469598
|
-
var _a3, _b3;
|
|
469949
|
+
var _a3, _b3, _c2, _d;
|
|
469599
469950
|
this.map.addOverlay(popup.overlay);
|
|
469600
469951
|
popup.overlay.setPosition(popup.coordinate);
|
|
469601
469952
|
(_b3 = (_a3 = popup.config.events) == null ? void 0 : _a3.onShow) == null ? void 0 : _b3.call(_a3);
|
|
469953
|
+
(_d = (_c2 = this.config).onShow) == null ? void 0 : _d.call(_c2, popup.id, popup.config, popup.feature, popup.coordinate);
|
|
469602
469954
|
}
|
|
469603
469955
|
/**
|
|
469604
469956
|
* 隐藏 popup
|
|
469605
469957
|
*/
|
|
469606
469958
|
hidePopup(popup) {
|
|
469607
|
-
var _a3, _b3;
|
|
469959
|
+
var _a3, _b3, _c2, _d;
|
|
469608
469960
|
this.map.removeOverlay(popup.overlay);
|
|
469609
469961
|
(_b3 = (_a3 = popup.config.events) == null ? void 0 : _a3.onHide) == null ? void 0 : _b3.call(_a3);
|
|
469962
|
+
(_d = (_c2 = this.config).onHide) == null ? void 0 : _d.call(_c2, popup.id);
|
|
469610
469963
|
}
|
|
469611
469964
|
/**
|
|
469612
469965
|
* 销毁 popup
|
|
469613
469966
|
*/
|
|
469614
469967
|
destroyPopup(popup) {
|
|
469615
|
-
var _a3, _b3;
|
|
469968
|
+
var _a3, _b3, _c2, _d;
|
|
469616
469969
|
try {
|
|
469617
469970
|
if (popup.app) {
|
|
469618
469971
|
popup.app.unmount();
|
|
@@ -469621,6 +469974,7 @@ ${this.attributes_.map(
|
|
|
469621
469974
|
popup.container.parentNode.removeChild(popup.container);
|
|
469622
469975
|
}
|
|
469623
469976
|
(_b3 = (_a3 = popup.config.events) == null ? void 0 : _a3.onClose) == null ? void 0 : _b3.call(_a3);
|
|
469977
|
+
(_d = (_c2 = this.config).onClose) == null ? void 0 : _d.call(_c2, popup.id);
|
|
469624
469978
|
} catch (error2) {
|
|
469625
469979
|
console.error("销毁 popup 失败:", error2);
|
|
469626
469980
|
}
|
|
@@ -469839,7 +470193,11 @@ ${this.attributes_.map(
|
|
|
469839
470193
|
initMap(targetId) {
|
|
469840
470194
|
var _a3;
|
|
469841
470195
|
const projection2 = this.config.projection || "EPSG:4326";
|
|
469842
|
-
if (
|
|
470196
|
+
if (this.config.projectionDefinition) {
|
|
470197
|
+
proj4$1.defs(projection2, this.config.projectionDefinition);
|
|
470198
|
+
register$3(proj4$1);
|
|
470199
|
+
}
|
|
470200
|
+
if (projection2 === "EPSG:4490" && !this.config.projectionDefinition) {
|
|
469843
470201
|
setupEPSG4490();
|
|
469844
470202
|
}
|
|
469845
470203
|
const center2 = this.config.center || [116.404, 39.915];
|
|
@@ -480235,8 +480593,12 @@ ${this.attributes_.map(
|
|
|
480235
480593
|
__publicField(this, "defaultCheckedKeys", vue.computed(() => {
|
|
480236
480594
|
const checkedKeys = [];
|
|
480237
480595
|
const collectVisibleIds = (layer2) => {
|
|
480238
|
-
if (layer2.visible
|
|
480239
|
-
|
|
480596
|
+
if (layer2.visible) {
|
|
480597
|
+
const isGroup = layer2.type === "group";
|
|
480598
|
+
const hasChildren = layer2.children && Array.isArray(layer2.children) && layer2.children.length > 0;
|
|
480599
|
+
if (!isGroup || isGroup && !hasChildren) {
|
|
480600
|
+
checkedKeys.push(layer2.id);
|
|
480601
|
+
}
|
|
480240
480602
|
}
|
|
480241
480603
|
if (layer2.children && Array.isArray(layer2.children)) {
|
|
480242
480604
|
layer2.children.forEach((child) => collectVisibleIds(child));
|
|
@@ -480277,10 +480639,11 @@ ${this.attributes_.map(
|
|
|
480277
480639
|
* @returns 树节点数据
|
|
480278
480640
|
*/
|
|
480279
480641
|
buildLayerNode(layer2) {
|
|
480642
|
+
const isGroup = layer2.type === "group" || layer2.children && Array.isArray(layer2.children) && layer2.children.length > 0;
|
|
480280
480643
|
const node2 = {
|
|
480281
480644
|
id: layer2.id,
|
|
480282
480645
|
label: layer2.name,
|
|
480283
|
-
type: "layer",
|
|
480646
|
+
type: isGroup ? "group" : "layer",
|
|
480284
480647
|
layerType: layer2.type,
|
|
480285
480648
|
layerData: layer2
|
|
480286
480649
|
};
|
|
@@ -481547,7 +481910,7 @@ ${this.attributes_.map(
|
|
|
481547
481910
|
}
|
|
481548
481911
|
const willCheck = checkedKeys ? checkedKeys.includes(data2.id) : !defaultCheckedKeys.value.includes(data2.id);
|
|
481549
481912
|
const toggleNodeAndChildren = (node2, checked) => {
|
|
481550
|
-
if (node2.type === "layer" && node2.layerData) {
|
|
481913
|
+
if ((node2.type === "layer" || node2.type === "group") && node2.layerData) {
|
|
481551
481914
|
node2.layerData.visible = checked;
|
|
481552
481915
|
handleLayerVisibilityChange(node2.layerData);
|
|
481553
481916
|
if (node2.layerData.type === "group") {
|