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
package/lib/index.umd.js
CHANGED
|
@@ -41707,7 +41707,7 @@ var __publicField = (obj, key, value) => {
|
|
|
41707
41707
|
item
|
|
41708
41708
|
);
|
|
41709
41709
|
}
|
|
41710
|
-
function proj4$
|
|
41710
|
+
function proj4$2(fromProjOrToProj, toProjOrCoord, coord) {
|
|
41711
41711
|
var fromProj;
|
|
41712
41712
|
var toProj;
|
|
41713
41713
|
var single = false;
|
|
@@ -45707,7 +45707,7 @@ var __publicField = (obj, key, value) => {
|
|
|
45707
45707
|
proj42.Proj.projections.add(eqearth$1);
|
|
45708
45708
|
proj42.Proj.projections.add(bonne$1);
|
|
45709
45709
|
}
|
|
45710
|
-
const proj4$1 = Object.assign(proj4$
|
|
45710
|
+
const proj4$1 = Object.assign(proj4$2, {
|
|
45711
45711
|
defaultDatum: "WGS84",
|
|
45712
45712
|
Proj: Projection$3,
|
|
45713
45713
|
WGS84: new Projection$3("WGS84"),
|
|
@@ -45720,10 +45720,6 @@ var __publicField = (obj, key, value) => {
|
|
|
45720
45720
|
version: "__VERSION__"
|
|
45721
45721
|
});
|
|
45722
45722
|
includedProjections$1(proj4$1);
|
|
45723
|
-
const proj4$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
45724
|
-
__proto__: null,
|
|
45725
|
-
default: proj4$1
|
|
45726
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
45727
45723
|
let registered$1 = null;
|
|
45728
45724
|
function register$3(proj42) {
|
|
45729
45725
|
registered$1 = proj42;
|
|
@@ -465331,12 +465327,13 @@ ${this.attributes_.map(
|
|
|
465331
465327
|
return feature2;
|
|
465332
465328
|
}
|
|
465333
465329
|
setupEPSG4490() {
|
|
465334
|
-
(
|
|
465335
|
-
register$3(proj4$
|
|
465330
|
+
proj4$1.defs("EPSG:4490", "+proj=longlat +ellps=GRS80 +no_defs +type=crs");
|
|
465331
|
+
register$3(proj4$1);
|
|
465336
465332
|
console.log("EPSG:4490投影已注册");
|
|
465337
465333
|
}
|
|
465338
465334
|
async createLayer() {
|
|
465339
465335
|
var _a3;
|
|
465336
|
+
debugger;
|
|
465340
465337
|
const projection2 = this.resolveProjection();
|
|
465341
465338
|
const config = this.config;
|
|
465342
465339
|
const sourceOptions = config.autoFetchMetadata === true ? await this.buildSourceOptionsWithMetadata(projection2) : await this.buildSourceOptions(projection2);
|
|
@@ -465347,14 +465344,12 @@ ${this.attributes_.map(
|
|
|
465347
465344
|
opacity: config.opacity
|
|
465348
465345
|
});
|
|
465349
465346
|
const source = new TileSuperMapRest(sourceOptions);
|
|
465350
|
-
source.on("tileloadstart", () => {
|
|
465351
|
-
console.log(`🔄 SuperMap图层 ${config.name} 开始加载瓦片`);
|
|
465352
|
-
});
|
|
465353
|
-
source.on("tileloadend", () => {
|
|
465354
|
-
console.log(`✅ SuperMap图层 ${config.name} 瓦片加载完成`);
|
|
465355
|
-
});
|
|
465356
465347
|
source.on("tileloaderror", (event) => {
|
|
465357
|
-
|
|
465348
|
+
var _a4, _b3;
|
|
465349
|
+
const img = (_b3 = (_a4 = event == null ? void 0 : event.tile) == null ? void 0 : _a4.getImage) == null ? void 0 : _b3.call(_a4);
|
|
465350
|
+
const src2 = img == null ? void 0 : img.src;
|
|
465351
|
+
if (src2)
|
|
465352
|
+
console.error(`瓦片加载失败: ${src2}`);
|
|
465358
465353
|
});
|
|
465359
465354
|
const tileLayer = new TileLayer$2({
|
|
465360
465355
|
source,
|
|
@@ -465363,6 +465358,10 @@ ${this.attributes_.map(
|
|
|
465363
465358
|
// opacity: (config.opacity || 100) / 100,
|
|
465364
465359
|
});
|
|
465365
465360
|
this.layer = tileLayer;
|
|
465361
|
+
if (config.autoFetchMetadata === true) {
|
|
465362
|
+
this.fetchAndUpdateTileGrid(source).catch(() => {
|
|
465363
|
+
});
|
|
465364
|
+
}
|
|
465366
465365
|
console.log(`SuperMap图层 ${config.name} 创建完成:`, {
|
|
465367
465366
|
visible: tileLayer.getVisible(),
|
|
465368
465367
|
opacity: tileLayer.getOpacity(),
|
|
@@ -465381,23 +465380,17 @@ ${this.attributes_.map(
|
|
|
465381
465380
|
extent: mapExtent,
|
|
465382
465381
|
projection: mapView.getProjection().getCode()
|
|
465383
465382
|
});
|
|
465384
|
-
if (config.center && config.center.length >= 2) {
|
|
465385
|
-
|
|
465386
|
-
const isInView = layerCenter[0] >= mapExtent[0] && layerCenter[0] <= mapExtent[2] && layerCenter[1] >= mapExtent[1] && layerCenter[1] <= mapExtent[3];
|
|
465387
|
-
console.log(
|
|
465388
|
-
`图层中心点 [${layerCenter[0]}, ${layerCenter[1]}] 是否在当前视图内: ${isInView}`
|
|
465389
|
-
);
|
|
465390
|
-
if (!isInView) {
|
|
465391
|
-
console.warn(
|
|
465392
|
-
`⚠️ 图层 ${config.name} 的中心点不在当前地图视图范围内,可能需要缩放到图层位置`
|
|
465393
|
-
);
|
|
465394
|
-
}
|
|
465383
|
+
if (this.map && config.center && config.center.length >= 2) {
|
|
465384
|
+
this.map.getView().setCenter(config.center);
|
|
465395
465385
|
}
|
|
465396
465386
|
}
|
|
465397
465387
|
tileLayer.on("postrender", () => this.tryApplyStyles());
|
|
465398
465388
|
source.on("tileloadend", () => this.tryApplyStyles());
|
|
465399
465389
|
return tileLayer;
|
|
465400
465390
|
}
|
|
465391
|
+
applyFilters() {
|
|
465392
|
+
console.warn("TileSuperMapRestHandler a ");
|
|
465393
|
+
}
|
|
465401
465394
|
tryApplyStyles() {
|
|
465402
465395
|
if (this.styleApplied || this.styleApplyAttempts >= this.maxStyleApplyAttempts)
|
|
465403
465396
|
return;
|
|
@@ -465430,18 +465423,20 @@ ${this.attributes_.map(
|
|
|
465430
465423
|
}
|
|
465431
465424
|
}
|
|
465432
465425
|
resolveProjection() {
|
|
465433
|
-
var _a3;
|
|
465426
|
+
var _a3, _b3;
|
|
465434
465427
|
let projection2 = null;
|
|
465435
|
-
|
|
465436
|
-
|
|
465437
|
-
|
|
465428
|
+
const projectionCode = this.config.projection;
|
|
465429
|
+
if (projectionCode) {
|
|
465430
|
+
projection2 = get$c(projectionCode);
|
|
465431
|
+
if (!projection2 && projectionCode === "EPSG:4490") {
|
|
465438
465432
|
this.setupEPSG4490();
|
|
465439
465433
|
projection2 = get$c("EPSG:4490");
|
|
465440
465434
|
}
|
|
465441
465435
|
}
|
|
465442
465436
|
if (!projection2) {
|
|
465443
|
-
projection2 = ((_a3 = this.map) == null ? void 0 : _a3.getView().getProjection()) || get$c("EPSG:
|
|
465444
|
-
|
|
465437
|
+
projection2 = ((_a3 = this.map) == null ? void 0 : _a3.getView().getProjection()) || get$c("EPSG:3857");
|
|
465438
|
+
const code = ((_b3 = projection2 == null ? void 0 : projection2.getCode) == null ? void 0 : _b3.call(projection2)) || "EPSG:3857";
|
|
465439
|
+
console.log(`图层 '${this.config.name}' 未指定投影,回退到: ${code}`);
|
|
465445
465440
|
}
|
|
465446
465441
|
return projection2;
|
|
465447
465442
|
}
|
|
@@ -465449,14 +465444,11 @@ ${this.attributes_.map(
|
|
|
465449
465444
|
const config = this.config;
|
|
465450
465445
|
const sourceOptions = {
|
|
465451
465446
|
url: config.url,
|
|
465452
|
-
wrapX: config.wrapX ??
|
|
465453
|
-
format: config.format || "
|
|
465447
|
+
wrapX: config.wrapX ?? false,
|
|
465448
|
+
format: config.format || "png",
|
|
465454
465449
|
transparent: config.transparent ?? true,
|
|
465455
465450
|
crossOrigin: config.crossOrigin || "anonymous"
|
|
465456
465451
|
};
|
|
465457
|
-
const tileGrid = await this.createTileGrid(projection2.getCode(), config);
|
|
465458
|
-
if (tileGrid)
|
|
465459
|
-
sourceOptions.tileGrid = tileGrid;
|
|
465460
465452
|
if (config.serverType)
|
|
465461
465453
|
sourceOptions.serverType = config.serverType;
|
|
465462
465454
|
if (config.cacheEnabled !== void 0)
|
|
@@ -465467,69 +465459,51 @@ ${this.attributes_.map(
|
|
|
465467
465459
|
const config = this.config;
|
|
465468
465460
|
const sourceOptions = {
|
|
465469
465461
|
url: config.url,
|
|
465470
|
-
wrapX:
|
|
465471
|
-
|
|
465472
|
-
|
|
465462
|
+
wrapX: false,
|
|
465463
|
+
format: config.format || "webp",
|
|
465464
|
+
crossOrigin: config.crossOrigin || "anonymous",
|
|
465465
|
+
transparent: config.transparent ?? true,
|
|
465466
|
+
cacheEnabled: config.cacheEnabled ?? true
|
|
465473
465467
|
};
|
|
465474
|
-
|
|
465475
|
-
|
|
465476
|
-
|
|
465477
|
-
|
|
465478
|
-
|
|
465479
|
-
|
|
465480
|
-
|
|
465481
|
-
console.warn("无法从URL中提取map.json路径,跳过元数据获取");
|
|
465482
|
-
return sourceOptions;
|
|
465483
|
-
}
|
|
465468
|
+
let mapJsonUrl = config.url;
|
|
465469
|
+
let canFetchMetadata = false;
|
|
465470
|
+
if (mapJsonUrl.includes("/rest/maps/")) {
|
|
465471
|
+
const match2 = mapJsonUrl.match(/(.*\/rest\/maps\/[^/]+)/);
|
|
465472
|
+
if (match2 && match2.length > 1) {
|
|
465473
|
+
mapJsonUrl = match2[1] + ".json";
|
|
465474
|
+
canFetchMetadata = true;
|
|
465484
465475
|
}
|
|
465485
|
-
|
|
465486
|
-
|
|
465487
|
-
|
|
465488
|
-
|
|
465489
|
-
const
|
|
465490
|
-
|
|
465491
|
-
|
|
465492
|
-
|
|
465493
|
-
const
|
|
465494
|
-
|
|
465495
|
-
|
|
465496
|
-
const resolutions = [];
|
|
465497
|
-
for (let z2 = 0; z2 <= maxZoom; z2++) {
|
|
465498
|
-
resolutions[z2] = 180 / (tileSize * Math.pow(2, z2 - 1));
|
|
465499
|
-
}
|
|
465500
|
-
sourceOptions.tileGrid = new TileGrid$3({
|
|
465501
|
-
resolutions,
|
|
465502
|
-
origin: [bounds2.left, bounds2.top]
|
|
465503
|
-
// 使用左上角坐标
|
|
465504
|
-
});
|
|
465505
|
-
console.log("✅ 成功从map.json创建tileGrid配置:");
|
|
465506
|
-
console.log("📍 Origin坐标 (左上角):", [bounds2.left, bounds2.top]);
|
|
465507
|
-
console.log("📐 Extent范围:", extent3);
|
|
465508
|
-
console.log("🔍 分辨率数组:", resolutions.slice(0, 5));
|
|
465509
|
-
console.log("📏 瓦片大小:", tileSize);
|
|
465510
|
-
} else {
|
|
465511
|
-
console.warn("map.json中没有bounds信息,使用默认配置");
|
|
465512
|
-
const tileGrid = await this.createTileGrid(
|
|
465513
|
-
projection2.getCode(),
|
|
465514
|
-
config
|
|
465476
|
+
}
|
|
465477
|
+
if (canFetchMetadata) {
|
|
465478
|
+
try {
|
|
465479
|
+
console.log(`正在获取SuperMap服务元数据: ${mapJsonUrl}`);
|
|
465480
|
+
const response = await fetch(mapJsonUrl);
|
|
465481
|
+
if (response.ok) {
|
|
465482
|
+
const mapJson = await response.json();
|
|
465483
|
+
console.log("获取到的map.json数据:", mapJson);
|
|
465484
|
+
const options = TileSuperMapRest.optionsFromMapJSON(
|
|
465485
|
+
config.url,
|
|
465486
|
+
mapJson
|
|
465515
465487
|
);
|
|
465516
|
-
if (tileGrid)
|
|
465517
|
-
sourceOptions.tileGrid = tileGrid;
|
|
465488
|
+
if (options == null ? void 0 : options.tileGrid) {
|
|
465489
|
+
sourceOptions.tileGrid = options.tileGrid;
|
|
465490
|
+
if (options.extent)
|
|
465491
|
+
sourceOptions.extent = options.extent;
|
|
465492
|
+
console.log("✅ 使用 optionsFromMapJSON 构建 tileGrid 成功");
|
|
465493
|
+
} else {
|
|
465494
|
+
console.warn("map.json 未提供有效 tileGrid,将回退到手动创建");
|
|
465495
|
+
}
|
|
465518
465496
|
}
|
|
465519
|
-
}
|
|
465520
|
-
console.
|
|
465521
|
-
const tileGrid = await this.createTileGrid(
|
|
465522
|
-
projection2.getCode(),
|
|
465523
|
-
config
|
|
465524
|
-
);
|
|
465525
|
-
if (tileGrid)
|
|
465526
|
-
sourceOptions.tileGrid = tileGrid;
|
|
465497
|
+
} catch (error2) {
|
|
465498
|
+
console.error("获取或解析map.json时出错,将回退到手动创建:", error2);
|
|
465527
465499
|
}
|
|
465528
|
-
}
|
|
465529
|
-
|
|
465500
|
+
}
|
|
465501
|
+
if (!sourceOptions.tileGrid) {
|
|
465502
|
+
console.warn("未能从元数据创建tileGrid,执行手动创建作为备用方案");
|
|
465530
465503
|
const tileGrid = await this.createTileGrid(projection2.getCode(), config);
|
|
465531
|
-
if (tileGrid)
|
|
465504
|
+
if (tileGrid) {
|
|
465532
465505
|
sourceOptions.tileGrid = tileGrid;
|
|
465506
|
+
}
|
|
465533
465507
|
}
|
|
465534
465508
|
if (config.serverType)
|
|
465535
465509
|
sourceOptions.serverType = config.serverType;
|
|
@@ -465604,6 +465578,30 @@ ${this.attributes_.map(
|
|
|
465604
465578
|
(_a3 = source.setExtent) == null ? void 0 : _a3.call(source, options.extent);
|
|
465605
465579
|
}
|
|
465606
465580
|
source.changed();
|
|
465581
|
+
if (this.map) {
|
|
465582
|
+
const view = this.map.getView();
|
|
465583
|
+
const resolutions = options.tileGrid.getResolutions();
|
|
465584
|
+
if (view && resolutions && resolutions.length) {
|
|
465585
|
+
const currentRes = view.getResolution();
|
|
465586
|
+
if (typeof currentRes === "number") {
|
|
465587
|
+
let nearest = resolutions[0];
|
|
465588
|
+
let minDiff = Math.abs(currentRes - nearest);
|
|
465589
|
+
for (let i2 = 1; i2 < resolutions.length; i2++) {
|
|
465590
|
+
const diff = Math.abs(currentRes - resolutions[i2]);
|
|
465591
|
+
if (diff < minDiff) {
|
|
465592
|
+
minDiff = diff;
|
|
465593
|
+
nearest = resolutions[i2];
|
|
465594
|
+
}
|
|
465595
|
+
}
|
|
465596
|
+
view.setResolution(nearest);
|
|
465597
|
+
} else {
|
|
465598
|
+
const zoom = view.getZoom();
|
|
465599
|
+
if (typeof zoom === "number") {
|
|
465600
|
+
view.setZoom(Math.round(zoom));
|
|
465601
|
+
}
|
|
465602
|
+
}
|
|
465603
|
+
}
|
|
465604
|
+
}
|
|
465607
465605
|
} else {
|
|
465608
465606
|
console.warn("从map.json中未能获取到有效的tileGrid配置");
|
|
465609
465607
|
}
|
|
@@ -467265,6 +467263,22 @@ ${this.attributes_.map(
|
|
|
467265
467263
|
}
|
|
467266
467264
|
}
|
|
467267
467265
|
}
|
|
467266
|
+
const projCode = view.getProjection().getCode();
|
|
467267
|
+
const isWorldExtent = (ext2, code) => {
|
|
467268
|
+
if (!ext2 || !code)
|
|
467269
|
+
return false;
|
|
467270
|
+
const [minX, minY, maxX, maxY] = ext2;
|
|
467271
|
+
const w2 = Math.abs(maxX - minX);
|
|
467272
|
+
const h2 = Math.abs(maxY - minY);
|
|
467273
|
+
if (code === "EPSG:4326" || code === "EPSG:4490")
|
|
467274
|
+
return w2 >= 359.9 && h2 >= 179.9;
|
|
467275
|
+
if (code === "EPSG:3857" || code === "EPSG:900913")
|
|
467276
|
+
return w2 >= 4e7 * 0.9 && h2 >= 4e7 * 0.9;
|
|
467277
|
+
return false;
|
|
467278
|
+
};
|
|
467279
|
+
if (extent3 && isWorldExtent(extent3, projCode)) {
|
|
467280
|
+
extent3 = null;
|
|
467281
|
+
}
|
|
467268
467282
|
if (!extent3 || extent3.every((coord) => !isFinite(coord))) {
|
|
467269
467283
|
if (config.center && Array.isArray(config.center) && config.center.length === 2) {
|
|
467270
467284
|
const mapProjection = view.getProjection().getCode();
|
|
@@ -469866,6 +469880,9 @@ ${this.attributes_.map(
|
|
|
469866
469880
|
this.initManagers();
|
|
469867
469881
|
this.bindMapEvents();
|
|
469868
469882
|
this.emit("map-ready", this.map);
|
|
469883
|
+
setTimeout(() => {
|
|
469884
|
+
this.updateConfig(this.config);
|
|
469885
|
+
}, 0);
|
|
469869
469886
|
return this.map;
|
|
469870
469887
|
}
|
|
469871
469888
|
/**
|
|
@@ -471551,7 +471568,7 @@ ${this.attributes_.map(
|
|
|
471551
471568
|
vue.createElementVNode("div", {
|
|
471552
471569
|
ref_key: "headerRef",
|
|
471553
471570
|
ref: headerRef,
|
|
471554
|
-
class: vue.normalizeClass(["flex items-center justify-between px-5 py-4 border-b border-gray-200 bg-gray-50", { "cursor-move": _ctx.draggable && !isFullscreen.value }]),
|
|
471571
|
+
class: vue.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 }]),
|
|
471555
471572
|
onMousedown: startDrag
|
|
471556
471573
|
}, [
|
|
471557
471574
|
vue.createElementVNode("div", _hoisted_6$f, [
|