vue-openlayers-plugin 1.0.68 → 1.0.70
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/bundle_map.js +46 -0
- package/lib/{index-022dd5b2.mjs → index-5d51e04b.mjs} +112 -95
- package/lib/{index.es-9fec9ea8.mjs → index.es-60380a58.mjs} +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.umd.js +111 -94
- package/lib/style.css +168 -168
- package/package.json +1 -1
- package/types/src/components/CustomOpenlayer/components/dialogs/LayerPanel.vue.d.ts +14 -84
- package/types/src/components/CustomOpenlayer/components/dialogs/LayerPanel.vue.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/types/index.d.ts +13 -2
- package/types/src/components/CustomOpenlayer/types/index.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/{layerManager.d.ts.map → LayerManager.d.ts.map} +1 -1
- package/types/src/components/CustomOpenlayer/utils/layers/TileSuperMapRestHandler.d.ts +1 -0
- package/types/src/components/CustomOpenlayer/utils/layers/TileSuperMapRestHandler.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/mapManager.d.ts.map +1 -1
- package/types/tsconfig.tsbuildinfo +1 -1
|
@@ -41751,7 +41751,7 @@ function checkProj$1(item) {
|
|
|
41751
41751
|
item
|
|
41752
41752
|
);
|
|
41753
41753
|
}
|
|
41754
|
-
function proj4$
|
|
41754
|
+
function proj4$2(fromProjOrToProj, toProjOrCoord, coord) {
|
|
41755
41755
|
var fromProj;
|
|
41756
41756
|
var toProj;
|
|
41757
41757
|
var single = false;
|
|
@@ -45755,7 +45755,7 @@ function includedProjections$1(proj42) {
|
|
|
45755
45755
|
proj42.Proj.projections.add(eqearth$1);
|
|
45756
45756
|
proj42.Proj.projections.add(bonne$1);
|
|
45757
45757
|
}
|
|
45758
|
-
const proj4$1 = Object.assign(proj4$
|
|
45758
|
+
const proj4$1 = Object.assign(proj4$2, {
|
|
45759
45759
|
defaultDatum: "WGS84",
|
|
45760
45760
|
Proj: Projection$3,
|
|
45761
45761
|
WGS84: new Projection$3("WGS84"),
|
|
@@ -45768,10 +45768,6 @@ const proj4$1 = Object.assign(proj4$3, {
|
|
|
45768
45768
|
version: "__VERSION__"
|
|
45769
45769
|
});
|
|
45770
45770
|
includedProjections$1(proj4$1);
|
|
45771
|
-
const proj4$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
45772
|
-
__proto__: null,
|
|
45773
|
-
default: proj4$1
|
|
45774
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
45775
45771
|
let registered$1 = null;
|
|
45776
45772
|
function register$3(proj42) {
|
|
45777
45773
|
registered$1 = proj42;
|
|
@@ -464555,12 +464551,13 @@ class TileSuperMapRestHandler extends BaseLayer$2 {
|
|
|
464555
464551
|
return feature2;
|
|
464556
464552
|
}
|
|
464557
464553
|
setupEPSG4490() {
|
|
464558
|
-
(
|
|
464559
|
-
register$3(proj4$
|
|
464554
|
+
proj4$1.defs("EPSG:4490", "+proj=longlat +ellps=GRS80 +no_defs +type=crs");
|
|
464555
|
+
register$3(proj4$1);
|
|
464560
464556
|
console.log("EPSG:4490投影已注册");
|
|
464561
464557
|
}
|
|
464562
464558
|
async createLayer() {
|
|
464563
464559
|
var _a3;
|
|
464560
|
+
debugger;
|
|
464564
464561
|
const projection2 = this.resolveProjection();
|
|
464565
464562
|
const config = this.config;
|
|
464566
464563
|
const sourceOptions = config.autoFetchMetadata === true ? await this.buildSourceOptionsWithMetadata(projection2) : await this.buildSourceOptions(projection2);
|
|
@@ -464571,14 +464568,12 @@ class TileSuperMapRestHandler extends BaseLayer$2 {
|
|
|
464571
464568
|
opacity: config.opacity
|
|
464572
464569
|
});
|
|
464573
464570
|
const source = new TileSuperMapRest(sourceOptions);
|
|
464574
|
-
source.on("tileloadstart", () => {
|
|
464575
|
-
console.log(`🔄 SuperMap图层 ${config.name} 开始加载瓦片`);
|
|
464576
|
-
});
|
|
464577
|
-
source.on("tileloadend", () => {
|
|
464578
|
-
console.log(`✅ SuperMap图层 ${config.name} 瓦片加载完成`);
|
|
464579
|
-
});
|
|
464580
464571
|
source.on("tileloaderror", (event) => {
|
|
464581
|
-
|
|
464572
|
+
var _a4, _b3;
|
|
464573
|
+
const img = (_b3 = (_a4 = event == null ? void 0 : event.tile) == null ? void 0 : _a4.getImage) == null ? void 0 : _b3.call(_a4);
|
|
464574
|
+
const src2 = img == null ? void 0 : img.src;
|
|
464575
|
+
if (src2)
|
|
464576
|
+
console.error(`瓦片加载失败: ${src2}`);
|
|
464582
464577
|
});
|
|
464583
464578
|
const tileLayer = new TileLayer$2({
|
|
464584
464579
|
source,
|
|
@@ -464587,6 +464582,10 @@ class TileSuperMapRestHandler extends BaseLayer$2 {
|
|
|
464587
464582
|
// opacity: (config.opacity || 100) / 100,
|
|
464588
464583
|
});
|
|
464589
464584
|
this.layer = tileLayer;
|
|
464585
|
+
if (config.autoFetchMetadata === true) {
|
|
464586
|
+
this.fetchAndUpdateTileGrid(source).catch(() => {
|
|
464587
|
+
});
|
|
464588
|
+
}
|
|
464590
464589
|
console.log(`SuperMap图层 ${config.name} 创建完成:`, {
|
|
464591
464590
|
visible: tileLayer.getVisible(),
|
|
464592
464591
|
opacity: tileLayer.getOpacity(),
|
|
@@ -464605,23 +464604,17 @@ class TileSuperMapRestHandler extends BaseLayer$2 {
|
|
|
464605
464604
|
extent: mapExtent,
|
|
464606
464605
|
projection: mapView.getProjection().getCode()
|
|
464607
464606
|
});
|
|
464608
|
-
if (config.center && config.center.length >= 2) {
|
|
464609
|
-
|
|
464610
|
-
const isInView = layerCenter[0] >= mapExtent[0] && layerCenter[0] <= mapExtent[2] && layerCenter[1] >= mapExtent[1] && layerCenter[1] <= mapExtent[3];
|
|
464611
|
-
console.log(
|
|
464612
|
-
`图层中心点 [${layerCenter[0]}, ${layerCenter[1]}] 是否在当前视图内: ${isInView}`
|
|
464613
|
-
);
|
|
464614
|
-
if (!isInView) {
|
|
464615
|
-
console.warn(
|
|
464616
|
-
`⚠️ 图层 ${config.name} 的中心点不在当前地图视图范围内,可能需要缩放到图层位置`
|
|
464617
|
-
);
|
|
464618
|
-
}
|
|
464607
|
+
if (this.map && config.center && config.center.length >= 2) {
|
|
464608
|
+
this.map.getView().setCenter(config.center);
|
|
464619
464609
|
}
|
|
464620
464610
|
}
|
|
464621
464611
|
tileLayer.on("postrender", () => this.tryApplyStyles());
|
|
464622
464612
|
source.on("tileloadend", () => this.tryApplyStyles());
|
|
464623
464613
|
return tileLayer;
|
|
464624
464614
|
}
|
|
464615
|
+
applyFilters() {
|
|
464616
|
+
console.warn("TileSuperMapRestHandler a ");
|
|
464617
|
+
}
|
|
464625
464618
|
tryApplyStyles() {
|
|
464626
464619
|
if (this.styleApplied || this.styleApplyAttempts >= this.maxStyleApplyAttempts)
|
|
464627
464620
|
return;
|
|
@@ -464654,18 +464647,20 @@ class TileSuperMapRestHandler extends BaseLayer$2 {
|
|
|
464654
464647
|
}
|
|
464655
464648
|
}
|
|
464656
464649
|
resolveProjection() {
|
|
464657
|
-
var _a3;
|
|
464650
|
+
var _a3, _b3;
|
|
464658
464651
|
let projection2 = null;
|
|
464659
|
-
|
|
464660
|
-
|
|
464661
|
-
|
|
464652
|
+
const projectionCode = this.config.projection;
|
|
464653
|
+
if (projectionCode) {
|
|
464654
|
+
projection2 = get$b(projectionCode);
|
|
464655
|
+
if (!projection2 && projectionCode === "EPSG:4490") {
|
|
464662
464656
|
this.setupEPSG4490();
|
|
464663
464657
|
projection2 = get$b("EPSG:4490");
|
|
464664
464658
|
}
|
|
464665
464659
|
}
|
|
464666
464660
|
if (!projection2) {
|
|
464667
|
-
projection2 = ((_a3 = this.map) == null ? void 0 : _a3.getView().getProjection()) || get$b("EPSG:
|
|
464668
|
-
|
|
464661
|
+
projection2 = ((_a3 = this.map) == null ? void 0 : _a3.getView().getProjection()) || get$b("EPSG:3857");
|
|
464662
|
+
const code = ((_b3 = projection2 == null ? void 0 : projection2.getCode) == null ? void 0 : _b3.call(projection2)) || "EPSG:3857";
|
|
464663
|
+
console.log(`图层 '${this.config.name}' 未指定投影,回退到: ${code}`);
|
|
464669
464664
|
}
|
|
464670
464665
|
return projection2;
|
|
464671
464666
|
}
|
|
@@ -464673,14 +464668,11 @@ class TileSuperMapRestHandler extends BaseLayer$2 {
|
|
|
464673
464668
|
const config = this.config;
|
|
464674
464669
|
const sourceOptions = {
|
|
464675
464670
|
url: config.url,
|
|
464676
|
-
wrapX: config.wrapX ??
|
|
464677
|
-
format: config.format || "
|
|
464671
|
+
wrapX: config.wrapX ?? false,
|
|
464672
|
+
format: config.format || "png",
|
|
464678
464673
|
transparent: config.transparent ?? true,
|
|
464679
464674
|
crossOrigin: config.crossOrigin || "anonymous"
|
|
464680
464675
|
};
|
|
464681
|
-
const tileGrid = await this.createTileGrid(projection2.getCode(), config);
|
|
464682
|
-
if (tileGrid)
|
|
464683
|
-
sourceOptions.tileGrid = tileGrid;
|
|
464684
464676
|
if (config.serverType)
|
|
464685
464677
|
sourceOptions.serverType = config.serverType;
|
|
464686
464678
|
if (config.cacheEnabled !== void 0)
|
|
@@ -464691,69 +464683,51 @@ class TileSuperMapRestHandler extends BaseLayer$2 {
|
|
|
464691
464683
|
const config = this.config;
|
|
464692
464684
|
const sourceOptions = {
|
|
464693
464685
|
url: config.url,
|
|
464694
|
-
wrapX:
|
|
464695
|
-
|
|
464696
|
-
|
|
464686
|
+
wrapX: false,
|
|
464687
|
+
format: config.format || "webp",
|
|
464688
|
+
crossOrigin: config.crossOrigin || "anonymous",
|
|
464689
|
+
transparent: config.transparent ?? true,
|
|
464690
|
+
cacheEnabled: config.cacheEnabled ?? true
|
|
464697
464691
|
};
|
|
464698
|
-
|
|
464699
|
-
|
|
464700
|
-
|
|
464701
|
-
|
|
464702
|
-
|
|
464703
|
-
|
|
464704
|
-
|
|
464705
|
-
console.warn("无法从URL中提取map.json路径,跳过元数据获取");
|
|
464706
|
-
return sourceOptions;
|
|
464707
|
-
}
|
|
464692
|
+
let mapJsonUrl = config.url;
|
|
464693
|
+
let canFetchMetadata = false;
|
|
464694
|
+
if (mapJsonUrl.includes("/rest/maps/")) {
|
|
464695
|
+
const match2 = mapJsonUrl.match(/(.*\/rest\/maps\/[^/]+)/);
|
|
464696
|
+
if (match2 && match2.length > 1) {
|
|
464697
|
+
mapJsonUrl = match2[1] + ".json";
|
|
464698
|
+
canFetchMetadata = true;
|
|
464708
464699
|
}
|
|
464709
|
-
|
|
464710
|
-
|
|
464711
|
-
|
|
464712
|
-
|
|
464713
|
-
const
|
|
464714
|
-
|
|
464715
|
-
|
|
464716
|
-
|
|
464717
|
-
const
|
|
464718
|
-
|
|
464719
|
-
|
|
464720
|
-
const resolutions = [];
|
|
464721
|
-
for (let z2 = 0; z2 <= maxZoom; z2++) {
|
|
464722
|
-
resolutions[z2] = 180 / (tileSize * Math.pow(2, z2 - 1));
|
|
464723
|
-
}
|
|
464724
|
-
sourceOptions.tileGrid = new TileGrid$3({
|
|
464725
|
-
resolutions,
|
|
464726
|
-
origin: [bounds2.left, bounds2.top]
|
|
464727
|
-
// 使用左上角坐标
|
|
464728
|
-
});
|
|
464729
|
-
console.log("✅ 成功从map.json创建tileGrid配置:");
|
|
464730
|
-
console.log("📍 Origin坐标 (左上角):", [bounds2.left, bounds2.top]);
|
|
464731
|
-
console.log("📐 Extent范围:", extent3);
|
|
464732
|
-
console.log("🔍 分辨率数组:", resolutions.slice(0, 5));
|
|
464733
|
-
console.log("📏 瓦片大小:", tileSize);
|
|
464734
|
-
} else {
|
|
464735
|
-
console.warn("map.json中没有bounds信息,使用默认配置");
|
|
464736
|
-
const tileGrid = await this.createTileGrid(
|
|
464737
|
-
projection2.getCode(),
|
|
464738
|
-
config
|
|
464700
|
+
}
|
|
464701
|
+
if (canFetchMetadata) {
|
|
464702
|
+
try {
|
|
464703
|
+
console.log(`正在获取SuperMap服务元数据: ${mapJsonUrl}`);
|
|
464704
|
+
const response = await fetch(mapJsonUrl);
|
|
464705
|
+
if (response.ok) {
|
|
464706
|
+
const mapJson = await response.json();
|
|
464707
|
+
console.log("获取到的map.json数据:", mapJson);
|
|
464708
|
+
const options = TileSuperMapRest.optionsFromMapJSON(
|
|
464709
|
+
config.url,
|
|
464710
|
+
mapJson
|
|
464739
464711
|
);
|
|
464740
|
-
if (tileGrid)
|
|
464741
|
-
sourceOptions.tileGrid = tileGrid;
|
|
464712
|
+
if (options == null ? void 0 : options.tileGrid) {
|
|
464713
|
+
sourceOptions.tileGrid = options.tileGrid;
|
|
464714
|
+
if (options.extent)
|
|
464715
|
+
sourceOptions.extent = options.extent;
|
|
464716
|
+
console.log("✅ 使用 optionsFromMapJSON 构建 tileGrid 成功");
|
|
464717
|
+
} else {
|
|
464718
|
+
console.warn("map.json 未提供有效 tileGrid,将回退到手动创建");
|
|
464719
|
+
}
|
|
464742
464720
|
}
|
|
464743
|
-
}
|
|
464744
|
-
console.
|
|
464745
|
-
const tileGrid = await this.createTileGrid(
|
|
464746
|
-
projection2.getCode(),
|
|
464747
|
-
config
|
|
464748
|
-
);
|
|
464749
|
-
if (tileGrid)
|
|
464750
|
-
sourceOptions.tileGrid = tileGrid;
|
|
464721
|
+
} catch (error2) {
|
|
464722
|
+
console.error("获取或解析map.json时出错,将回退到手动创建:", error2);
|
|
464751
464723
|
}
|
|
464752
|
-
}
|
|
464753
|
-
|
|
464724
|
+
}
|
|
464725
|
+
if (!sourceOptions.tileGrid) {
|
|
464726
|
+
console.warn("未能从元数据创建tileGrid,执行手动创建作为备用方案");
|
|
464754
464727
|
const tileGrid = await this.createTileGrid(projection2.getCode(), config);
|
|
464755
|
-
if (tileGrid)
|
|
464728
|
+
if (tileGrid) {
|
|
464756
464729
|
sourceOptions.tileGrid = tileGrid;
|
|
464730
|
+
}
|
|
464757
464731
|
}
|
|
464758
464732
|
if (config.serverType)
|
|
464759
464733
|
sourceOptions.serverType = config.serverType;
|
|
@@ -464828,6 +464802,30 @@ class TileSuperMapRestHandler extends BaseLayer$2 {
|
|
|
464828
464802
|
(_a3 = source.setExtent) == null ? void 0 : _a3.call(source, options.extent);
|
|
464829
464803
|
}
|
|
464830
464804
|
source.changed();
|
|
464805
|
+
if (this.map) {
|
|
464806
|
+
const view = this.map.getView();
|
|
464807
|
+
const resolutions = options.tileGrid.getResolutions();
|
|
464808
|
+
if (view && resolutions && resolutions.length) {
|
|
464809
|
+
const currentRes = view.getResolution();
|
|
464810
|
+
if (typeof currentRes === "number") {
|
|
464811
|
+
let nearest = resolutions[0];
|
|
464812
|
+
let minDiff = Math.abs(currentRes - nearest);
|
|
464813
|
+
for (let i = 1; i < resolutions.length; i++) {
|
|
464814
|
+
const diff = Math.abs(currentRes - resolutions[i]);
|
|
464815
|
+
if (diff < minDiff) {
|
|
464816
|
+
minDiff = diff;
|
|
464817
|
+
nearest = resolutions[i];
|
|
464818
|
+
}
|
|
464819
|
+
}
|
|
464820
|
+
view.setResolution(nearest);
|
|
464821
|
+
} else {
|
|
464822
|
+
const zoom = view.getZoom();
|
|
464823
|
+
if (typeof zoom === "number") {
|
|
464824
|
+
view.setZoom(Math.round(zoom));
|
|
464825
|
+
}
|
|
464826
|
+
}
|
|
464827
|
+
}
|
|
464828
|
+
}
|
|
464831
464829
|
} else {
|
|
464832
464830
|
console.warn("从map.json中未能获取到有效的tileGrid配置");
|
|
464833
464831
|
}
|
|
@@ -466489,6 +466487,22 @@ class LayerManager {
|
|
|
466489
466487
|
}
|
|
466490
466488
|
}
|
|
466491
466489
|
}
|
|
466490
|
+
const projCode = view.getProjection().getCode();
|
|
466491
|
+
const isWorldExtent = (ext2, code) => {
|
|
466492
|
+
if (!ext2 || !code)
|
|
466493
|
+
return false;
|
|
466494
|
+
const [minX, minY, maxX, maxY] = ext2;
|
|
466495
|
+
const w2 = Math.abs(maxX - minX);
|
|
466496
|
+
const h2 = Math.abs(maxY - minY);
|
|
466497
|
+
if (code === "EPSG:4326" || code === "EPSG:4490")
|
|
466498
|
+
return w2 >= 359.9 && h2 >= 179.9;
|
|
466499
|
+
if (code === "EPSG:3857" || code === "EPSG:900913")
|
|
466500
|
+
return w2 >= 4e7 * 0.9 && h2 >= 4e7 * 0.9;
|
|
466501
|
+
return false;
|
|
466502
|
+
};
|
|
466503
|
+
if (extent3 && isWorldExtent(extent3, projCode)) {
|
|
466504
|
+
extent3 = null;
|
|
466505
|
+
}
|
|
466492
466506
|
if (!extent3 || extent3.every((coord) => !isFinite(coord))) {
|
|
466493
466507
|
if (config.center && Array.isArray(config.center) && config.center.length === 2) {
|
|
466494
466508
|
const mapProjection = view.getProjection().getCode();
|
|
@@ -469086,6 +469100,9 @@ class MapManager {
|
|
|
469086
469100
|
this.initManagers();
|
|
469087
469101
|
this.bindMapEvents();
|
|
469088
469102
|
this.emit("map-ready", this.map);
|
|
469103
|
+
setTimeout(() => {
|
|
469104
|
+
this.updateConfig(this.config);
|
|
469105
|
+
}, 0);
|
|
469089
469106
|
return this.map;
|
|
469090
469107
|
}
|
|
469091
469108
|
/**
|
|
@@ -470770,7 +470787,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
470770
470787
|
createElementVNode("div", {
|
|
470771
470788
|
ref_key: "headerRef",
|
|
470772
470789
|
ref: headerRef,
|
|
470773
|
-
class: normalizeClass(["flex items-center justify-between px-5 py-4 border-b border-gray-200 bg-gray-50", { "cursor-move": _ctx.draggable && !isFullscreen.value }]),
|
|
470790
|
+
class: normalizeClass(["header flex items-center justify-between px-5 py-4 border-b border-gray-200 bg-gray-50", { "cursor-move": _ctx.draggable && !isFullscreen.value }]),
|
|
470774
470791
|
onMousedown: startDrag
|
|
470775
470792
|
}, [
|
|
470776
470793
|
createElementVNode("div", _hoisted_6$f, [
|
|
@@ -491445,7 +491462,7 @@ function(t3) {
|
|
|
491445
491462
|
*/
|
|
491446
491463
|
function(t3) {
|
|
491447
491464
|
function e8() {
|
|
491448
|
-
return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-
|
|
491465
|
+
return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-60380a58.mjs")).catch(function(t4) {
|
|
491449
491466
|
return Promise.reject(new Error("Could not load canvg: " + t4));
|
|
491450
491467
|
}).then(function(t4) {
|
|
491451
491468
|
return t4.default ? t4.default : t4;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as commonjsGlobal, R as RGBColor, r as requestAnimationFrame, _ as _asyncToGenerator, a as _, p as processCanvasRGBA, b as _defineProperty } from "./index-
|
|
1
|
+
import { c as commonjsGlobal, R as RGBColor, r as requestAnimationFrame, _ as _asyncToGenerator, a as _, p as processCanvasRGBA, b as _defineProperty } from "./index-5d51e04b.mjs";
|
|
2
2
|
import "vue";
|
|
3
3
|
import "ol";
|
|
4
4
|
var check = function(it) {
|
package/lib/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A, B, e, d, D, a2, a3, w, z, a7, a6, I, H, Z, $, L, J, K, a4, j, M, a0, a1, X, Y, U, W, Q, S, P, C, F, G, N, O, a8, f, T, E, V, y, k, q, u, g, m, h, x, s, n, o, a5, i, t, l, v } from "./index-
|
|
1
|
+
import { A, B, e, d, D, a2, a3, w, z, a7, a6, I, H, Z, $, L, J, K, a4, j, M, a0, a1, X, Y, U, W, Q, S, P, C, F, G, N, O, a8, f, T, E, V, y, k, q, u, g, m, h, x, s, n, o, a5, i, t, l, v } from "./index-5d51e04b.mjs";
|
|
2
2
|
import "vue";
|
|
3
3
|
import "ol";
|
|
4
4
|
export {
|