vue-openlayers-plugin 1.1.13 → 1.1.15
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/README.md +209 -0
- package/lib/{BasemapPanel-a8d7373d.mjs → BasemapPanel-7664fc20.mjs} +1 -1
- package/lib/{CoordinateLocationDialog-274aff1a.mjs → CoordinateLocationDialog-f505c006.mjs} +1 -1
- package/lib/{MapPrintDialog-97054260.mjs → FilterPanel-4cfbbfeb.mjs} +1 -1
- package/lib/{FilterPanel-ccdaaac3.mjs → LayerPanel-354b6ac7.mjs} +1 -1
- package/lib/{LayerPanel-c716b7cc.mjs → MapPrintDialog-0cf04cae.mjs} +1 -1
- package/lib/{MeasurementDialog-7c08ba58.mjs → MeasurementDialog-4fd11413.mjs} +1 -1
- package/lib/{MyMarkersDialog-89bd594e.mjs → MyMarkersDialog-f413337c.mjs} +1 -1
- package/lib/{QuadCompareDialog-78dd2cf6.mjs → QuadCompareDialog-176a8178.mjs} +1 -1
- package/lib/{RegionNavigationDialog-4b7b4e5f.mjs → RegionNavigationDialog-1edd078f.mjs} +1 -1
- package/lib/{SplitCompareDialog-b51b55c1.mjs → SplitCompareDialog-3fe419de.mjs} +1 -1
- package/lib/{SwipeCompareDialog-2b89b65e.mjs → SwipeCompareDialog-e2c28122.mjs} +1 -1
- package/lib/{ViewBookmarksDialog-7ee33d4e.mjs → ViewBookmarksDialog-9873fb3c.mjs} +1 -1
- package/lib/{index-98c677b7.mjs → index-923f7253.mjs} +549 -48
- package/lib/{index-3699244d.mjs → index-a30f4100.mjs} +1 -1
- package/lib/{index.es-e3be4489.mjs → index.es-b7728855.mjs} +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.umd.js +536 -35
- package/lib/style.css +5 -5
- package/package.json +1 -1
- package/types/components/OlDialogs/LayerPanel.vue.d.ts +204 -0
- package/types/components/OlDialogs/LayerPanel.vue.d.ts.map +1 -1
- package/types/components/OlMap.vue.d.ts +413 -0
- package/types/components/OlMap.vue.d.ts.map +1 -1
- package/types/components/OlMapContainer.vue.d.ts +1 -0
- package/types/components/OlMapContainer.vue.d.ts.map +1 -1
- package/types/core/LayerManager.d.ts +5 -0
- package/types/core/LayerManager.d.ts.map +1 -1
- package/types/core/layers/GeoJSONLayerHandler.d.ts +31 -2
- package/types/core/layers/GeoJSONLayerHandler.d.ts.map +1 -1
- package/types/core/layers/interfaces.d.ts +5 -0
- package/types/core/layers/interfaces.d.ts.map +1 -1
- package/types/core/storage.d.ts.map +1 -1
- package/types/lowcode-entry.d.ts +423 -0
- package/types/lowcode-entry.d.ts.map +1 -1
- package/types/types/map.d.ts +64 -0
- package/types/types/map.d.ts.map +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { inject, computed, ref, onMounted, resolveComponent, openBlock, createElementBlock, createVNode, withCtx, Fragment, renderList, createElementVNode, normalizeClass, toDisplayString, unref, createTextVNode, createCommentVNode, createBlock } from "vue";
|
|
2
2
|
import { Close } from "@element-plus/icons-vue";
|
|
3
|
-
import { b as _export_sfc, D as DrawingManager, X } from "./index-
|
|
3
|
+
import { b as _export_sfc, D as DrawingManager, X } from "./index-923f7253.mjs";
|
|
4
4
|
import "ol";
|
|
5
5
|
import "proj4";
|
|
6
6
|
import "@supermapgis/iclient-ol";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as commonjsGlobal, g as getDefaultExportFromCjs, _ as _asyncToGenerator, a as _defineProperty } from "./index-
|
|
1
|
+
import { c as commonjsGlobal, g as getDefaultExportFromCjs, _ as _asyncToGenerator, a as _defineProperty } from "./index-923f7253.mjs";
|
|
2
2
|
import "vue";
|
|
3
3
|
import "@element-plus/icons-vue";
|
|
4
4
|
import "ol";
|
package/lib/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ad, a0, K, O, a4, D, aA, a9, ac, aF, aE, ak, al, aw, ax, Y, am, an, aD, aB, $, Z, ay, az, B, E, F, A, J, y, C, z, G, au, av, as, at, aq, ar, x, s, q, w, O as O2, p, u, v, ae, af, ai, aj, ao, ap, aG, N, ag, ah, U, ab, a1, a5, a8, Q, f, W, aa, a6, a2, a3, aC, P, a7, l, S, r, R } from "./index-
|
|
1
|
+
import { ad, a0, K, O, a4, D, aA, a9, ac, aF, aE, ak, al, aw, ax, Y, am, an, aD, aB, $, Z, ay, az, B, E, F, A, J, y, C, z, G, au, av, as, at, aq, ar, x, s, q, w, O as O2, p, u, v, ae, af, ai, aj, ao, ap, aG, N, ag, ah, U, ab, a1, a5, a8, Q, f, W, aa, a6, a2, a3, aC, P, a7, l, S, r, R } from "./index-923f7253.mjs";
|
|
2
2
|
import "vue";
|
|
3
3
|
import "@element-plus/icons-vue";
|
|
4
4
|
import "ol";
|
package/lib/index.umd.js
CHANGED
|
@@ -53759,10 +53759,33 @@ ${this.attributes_.map(
|
|
|
53759
53759
|
};
|
|
53760
53760
|
if (config.url)
|
|
53761
53761
|
optimizedConfig.url = config.url;
|
|
53762
|
+
if (config.method)
|
|
53763
|
+
optimizedConfig.method = config.method;
|
|
53764
|
+
if (config.params && Object.keys(config.params).length > 0) {
|
|
53765
|
+
optimizedConfig.params = config.params;
|
|
53766
|
+
}
|
|
53767
|
+
if (config.headers && Object.keys(config.headers).length > 0) {
|
|
53768
|
+
optimizedConfig.headers = config.headers;
|
|
53769
|
+
}
|
|
53770
|
+
if (config.body !== void 0)
|
|
53771
|
+
optimizedConfig.body = config.body;
|
|
53772
|
+
if (config.dataPath)
|
|
53773
|
+
optimizedConfig.dataPath = config.dataPath;
|
|
53762
53774
|
if (config.opacity !== void 0 && config.opacity !== 1)
|
|
53763
53775
|
optimizedConfig.opacity = config.opacity;
|
|
53764
53776
|
if (config.zIndex !== void 0 && config.zIndex !== 0)
|
|
53765
53777
|
optimizedConfig.zIndex = config.zIndex;
|
|
53778
|
+
if (config.geojsonConfig)
|
|
53779
|
+
optimizedConfig.geojsonConfig = config.geojsonConfig;
|
|
53780
|
+
if (config.config)
|
|
53781
|
+
optimizedConfig.config = config.config;
|
|
53782
|
+
if (config.projection)
|
|
53783
|
+
optimizedConfig.projection = config.projection;
|
|
53784
|
+
if (config.projectionDefinition) {
|
|
53785
|
+
optimizedConfig.projectionDefinition = config.projectionDefinition;
|
|
53786
|
+
}
|
|
53787
|
+
if (config.style)
|
|
53788
|
+
optimizedConfig.style = config.style;
|
|
53766
53789
|
if (config.legend)
|
|
53767
53790
|
optimizedConfig.legend = config.legend;
|
|
53768
53791
|
if (config.metadata && Object.keys(config.metadata).length > 0) {
|
|
@@ -68300,13 +68323,17 @@ ${this.attributes_.map(
|
|
|
68300
68323
|
constructor(config, map2) {
|
|
68301
68324
|
super(config);
|
|
68302
68325
|
__publicField(this, "styleConfig");
|
|
68303
|
-
// 新增:缓存启用的过滤器和原始要素集合
|
|
68304
|
-
__publicField(this, "currentFilters", []);
|
|
68305
68326
|
__publicField(this, "originalFeatures", []);
|
|
68327
|
+
__publicField(this, "vectorSource", null);
|
|
68328
|
+
__publicField(this, "refreshTimer", null);
|
|
68329
|
+
__publicField(this, "refreshDebounceTimer", null);
|
|
68330
|
+
__publicField(this, "moveEndListener", null);
|
|
68331
|
+
__publicField(this, "lastKnownZoom");
|
|
68332
|
+
__publicField(this, "isRefreshing", false);
|
|
68306
68333
|
if (map2)
|
|
68307
68334
|
this.setMap(map2);
|
|
68308
68335
|
}
|
|
68309
|
-
createLayer() {
|
|
68336
|
+
async createLayer() {
|
|
68310
68337
|
var _a2, _b2, _c2;
|
|
68311
68338
|
const vectorSource = this.createVectorSource();
|
|
68312
68339
|
const declutterOpt = (_c2 = (_b2 = (_a2 = this.config) == null ? void 0 : _a2.config) == null ? void 0 : _b2.vector) == null ? void 0 : _c2.declutter;
|
|
@@ -68314,42 +68341,401 @@ ${this.attributes_.map(
|
|
|
68314
68341
|
className: this.config.className,
|
|
68315
68342
|
source: vectorSource,
|
|
68316
68343
|
style: this.createStyleFunction(),
|
|
68317
|
-
// 默认关闭 declutter;如需避免标签重叠,可在 config.vector.declutter 设为 true
|
|
68318
68344
|
declutter: declutterOpt !== void 0 ? !!declutterOpt : false
|
|
68319
68345
|
});
|
|
68346
|
+
this.vectorSource = vectorSource;
|
|
68347
|
+
await this.initializeSource();
|
|
68348
|
+
this.setupRefreshBehavior();
|
|
68320
68349
|
return vectorLayer;
|
|
68321
68350
|
}
|
|
68322
68351
|
/**
|
|
68323
68352
|
* 创建矢量数据源
|
|
68324
68353
|
*/
|
|
68325
68354
|
createVectorSource() {
|
|
68326
|
-
var _a2;
|
|
68327
68355
|
this.registerCustomProjection();
|
|
68356
|
+
return new VectorSource$1();
|
|
68357
|
+
}
|
|
68358
|
+
getGeoJSONConfig() {
|
|
68359
|
+
var _a2, _b2, _c2;
|
|
68360
|
+
const nestedConfig = this.config.geojsonConfig || ((_b2 = (_a2 = this.config.config) == null ? void 0 : _a2.vector) == null ? void 0 : _b2.geojson) || ((_c2 = this.config.config) == null ? void 0 : _c2.geojson);
|
|
68361
|
+
const requestConfig = {
|
|
68362
|
+
url: this.config.url,
|
|
68363
|
+
method: this.config.method,
|
|
68364
|
+
headers: this.config.headers,
|
|
68365
|
+
params: this.config.params,
|
|
68366
|
+
body: this.config.body,
|
|
68367
|
+
dataPath: this.config.dataPath,
|
|
68368
|
+
...(nestedConfig == null ? void 0 : nestedConfig.request) || {}
|
|
68369
|
+
};
|
|
68370
|
+
const normalizedRequestConfig = this.normalizeRequestConfig(requestConfig);
|
|
68371
|
+
return {
|
|
68372
|
+
data: (nestedConfig == null ? void 0 : nestedConfig.data) ?? this.config.data,
|
|
68373
|
+
dataPath: (nestedConfig == null ? void 0 : nestedConfig.dataPath) ?? this.config.dataPath,
|
|
68374
|
+
clearOnError: (nestedConfig == null ? void 0 : nestedConfig.clearOnError) ?? false,
|
|
68375
|
+
refresh: nestedConfig == null ? void 0 : nestedConfig.refresh,
|
|
68376
|
+
request: normalizedRequestConfig.url || (nestedConfig == null ? void 0 : nestedConfig.request) ? normalizedRequestConfig : void 0
|
|
68377
|
+
};
|
|
68378
|
+
}
|
|
68379
|
+
normalizeRequestConfig(requestConfig) {
|
|
68380
|
+
var _a2;
|
|
68381
|
+
const normalizedParams = {
|
|
68382
|
+
...requestConfig.params || {}
|
|
68383
|
+
};
|
|
68384
|
+
const layerConfig = this.config;
|
|
68385
|
+
const landTypeParamName = requestConfig.landTypeParamName || "landType";
|
|
68386
|
+
const landTypeValue = requestConfig.landType ?? layerConfig.geojsonLandType ?? normalizedParams[landTypeParamName] ?? normalizedParams.landType;
|
|
68387
|
+
if (landTypeValue !== void 0 && normalizedParams[landTypeParamName] === void 0) {
|
|
68388
|
+
normalizedParams[landTypeParamName] = landTypeValue;
|
|
68389
|
+
}
|
|
68390
|
+
const managementUnitParamName = requestConfig.managementUnitParamName || "managementUnit";
|
|
68391
|
+
const managementUnitValue = requestConfig.managementUnit ?? layerConfig.managementUnit ?? ((_a2 = this.config.metadata) == null ? void 0 : _a2.managementUnit) ?? normalizedParams[managementUnitParamName] ?? normalizedParams.managementUnit;
|
|
68392
|
+
if (managementUnitValue !== void 0 && normalizedParams[managementUnitParamName] === void 0) {
|
|
68393
|
+
normalizedParams[managementUnitParamName] = managementUnitValue;
|
|
68394
|
+
}
|
|
68395
|
+
return {
|
|
68396
|
+
...requestConfig,
|
|
68397
|
+
params: normalizedParams
|
|
68398
|
+
};
|
|
68399
|
+
}
|
|
68400
|
+
getDataProjection() {
|
|
68401
|
+
return this.config.projection || "EPSG:4326";
|
|
68402
|
+
}
|
|
68403
|
+
getMapProjection() {
|
|
68404
|
+
var _a2;
|
|
68405
|
+
return ((_a2 = this.map) == null ? void 0 : _a2.getView().getProjection().getCode()) || "EPSG:4326";
|
|
68406
|
+
}
|
|
68407
|
+
async initializeSource() {
|
|
68408
|
+
var _a2;
|
|
68409
|
+
const source = this.getVectorSource();
|
|
68410
|
+
if (!source)
|
|
68411
|
+
return;
|
|
68412
|
+
const geojsonConfig = this.getGeoJSONConfig();
|
|
68413
|
+
if (geojsonConfig.data) {
|
|
68414
|
+
this.applyGeoJSONData(geojsonConfig.data);
|
|
68415
|
+
return;
|
|
68416
|
+
}
|
|
68417
|
+
if (((_a2 = geojsonConfig.request) == null ? void 0 : _a2.url) || this.config.url) {
|
|
68418
|
+
await this.refresh();
|
|
68419
|
+
return;
|
|
68420
|
+
}
|
|
68421
|
+
source.clear();
|
|
68422
|
+
this.originalFeatures = [];
|
|
68423
|
+
}
|
|
68424
|
+
getVectorSource() {
|
|
68425
|
+
if (this.vectorSource) {
|
|
68426
|
+
return this.vectorSource;
|
|
68427
|
+
}
|
|
68428
|
+
if (!this.layer) {
|
|
68429
|
+
return null;
|
|
68430
|
+
}
|
|
68431
|
+
const source = this.layer.getSource();
|
|
68432
|
+
this.vectorSource = source || null;
|
|
68433
|
+
return this.vectorSource;
|
|
68434
|
+
}
|
|
68435
|
+
applyGeoJSONData(data2) {
|
|
68436
|
+
const source = this.getVectorSource();
|
|
68437
|
+
if (!source)
|
|
68438
|
+
return;
|
|
68439
|
+
const features2 = this.readFeaturesFromData(data2);
|
|
68440
|
+
source.clear();
|
|
68441
|
+
source.addFeatures(features2);
|
|
68442
|
+
this.originalFeatures = [...features2];
|
|
68443
|
+
if (this.getEnabledFilters().length > 0) {
|
|
68444
|
+
this.applyFilters();
|
|
68445
|
+
}
|
|
68446
|
+
}
|
|
68447
|
+
readFeaturesFromData(data2) {
|
|
68328
68448
|
const format2 = new GeoJSON$2();
|
|
68329
|
-
|
|
68330
|
-
|
|
68331
|
-
|
|
68332
|
-
|
|
68333
|
-
|
|
68334
|
-
|
|
68335
|
-
|
|
68336
|
-
|
|
68337
|
-
|
|
68338
|
-
|
|
68339
|
-
|
|
68340
|
-
|
|
68341
|
-
|
|
68342
|
-
|
|
68343
|
-
|
|
68344
|
-
|
|
68345
|
-
|
|
68346
|
-
|
|
68347
|
-
|
|
68449
|
+
return format2.readFeatures(this.normalizeGeoJSONData(data2), {
|
|
68450
|
+
dataProjection: this.getDataProjection(),
|
|
68451
|
+
featureProjection: this.getMapProjection()
|
|
68452
|
+
});
|
|
68453
|
+
}
|
|
68454
|
+
normalizeGeoJSONData(data2) {
|
|
68455
|
+
if (typeof data2 === "string") {
|
|
68456
|
+
const trimmed = data2.trim();
|
|
68457
|
+
if (!trimmed) {
|
|
68458
|
+
return { type: "FeatureCollection", features: [] };
|
|
68459
|
+
}
|
|
68460
|
+
try {
|
|
68461
|
+
return this.normalizeGeoJSONData(JSON.parse(trimmed));
|
|
68462
|
+
} catch (error2) {
|
|
68463
|
+
throw new Error("GeoJSON 字符串解析失败");
|
|
68464
|
+
}
|
|
68465
|
+
}
|
|
68466
|
+
if (Array.isArray(data2)) {
|
|
68467
|
+
return {
|
|
68468
|
+
type: "FeatureCollection",
|
|
68469
|
+
features: data2
|
|
68470
|
+
};
|
|
68471
|
+
}
|
|
68472
|
+
if (!data2 || typeof data2 !== "object") {
|
|
68473
|
+
return {
|
|
68474
|
+
type: "FeatureCollection",
|
|
68475
|
+
features: []
|
|
68476
|
+
};
|
|
68477
|
+
}
|
|
68478
|
+
if (data2.type === "FeatureCollection") {
|
|
68479
|
+
return data2;
|
|
68480
|
+
}
|
|
68481
|
+
if (data2.type === "Feature") {
|
|
68482
|
+
return {
|
|
68483
|
+
type: "FeatureCollection",
|
|
68484
|
+
features: [data2]
|
|
68485
|
+
};
|
|
68486
|
+
}
|
|
68487
|
+
if (Array.isArray(data2.features)) {
|
|
68488
|
+
return {
|
|
68489
|
+
type: "FeatureCollection",
|
|
68490
|
+
features: data2.features
|
|
68491
|
+
};
|
|
68492
|
+
}
|
|
68493
|
+
return data2;
|
|
68494
|
+
}
|
|
68495
|
+
getNestedValue(target, path2) {
|
|
68496
|
+
if (!path2) {
|
|
68497
|
+
return target;
|
|
68498
|
+
}
|
|
68499
|
+
const keys2 = path2.replace(/\[(\d+)\]/g, ".$1").split(".").filter(Boolean);
|
|
68500
|
+
return keys2.reduce(
|
|
68501
|
+
(current, key2) => current !== null && current !== void 0 ? current[key2] : void 0,
|
|
68502
|
+
target
|
|
68503
|
+
);
|
|
68504
|
+
}
|
|
68505
|
+
buildRequestContext(overrides) {
|
|
68506
|
+
const requestConfig = this.getGeoJSONConfig().request;
|
|
68507
|
+
return {
|
|
68508
|
+
config: this.config,
|
|
68509
|
+
params: {
|
|
68510
|
+
...(requestConfig == null ? void 0 : requestConfig.params) || {},
|
|
68511
|
+
...(overrides == null ? void 0 : overrides.params) || {}
|
|
68512
|
+
},
|
|
68513
|
+
body: (overrides == null ? void 0 : overrides.body) ?? (requestConfig == null ? void 0 : requestConfig.body),
|
|
68514
|
+
map: this.map || void 0
|
|
68515
|
+
};
|
|
68516
|
+
}
|
|
68517
|
+
buildExtentPayload(refreshConfig) {
|
|
68518
|
+
if (!(refreshConfig == null ? void 0 : refreshConfig.useExtent) || !this.map) {
|
|
68519
|
+
return {};
|
|
68520
|
+
}
|
|
68521
|
+
const size2 = this.map.getSize();
|
|
68522
|
+
if (!size2) {
|
|
68523
|
+
return {};
|
|
68524
|
+
}
|
|
68525
|
+
const view = this.map.getView();
|
|
68526
|
+
const sourceProjection = view.getProjection().getCode();
|
|
68527
|
+
const targetProjection = refreshConfig.extentProjection || this.getDataProjection();
|
|
68528
|
+
const rawExtent = view.calculateExtent(size2);
|
|
68529
|
+
const extent3 = sourceProjection === targetProjection ? rawExtent : transformExtent(rawExtent, sourceProjection, targetProjection);
|
|
68530
|
+
const extentValue = extent3.join(",");
|
|
68531
|
+
const extentParamName = refreshConfig.extentParamName || "bbox";
|
|
68532
|
+
if (refreshConfig.extentTarget === "body") {
|
|
68533
|
+
return {
|
|
68534
|
+
body: {
|
|
68535
|
+
[extentParamName]: extentValue
|
|
68536
|
+
}
|
|
68537
|
+
};
|
|
68538
|
+
}
|
|
68539
|
+
return {
|
|
68540
|
+
params: {
|
|
68541
|
+
[extentParamName]: extentValue
|
|
68542
|
+
}
|
|
68543
|
+
};
|
|
68544
|
+
}
|
|
68545
|
+
createRequestUrl(url, params, method2) {
|
|
68546
|
+
const requestUrl = new URL(url, window.location.origin);
|
|
68547
|
+
Object.entries(params).forEach(([key2, value]) => {
|
|
68548
|
+
if (value === void 0 || value === null || method2 !== "GET") {
|
|
68549
|
+
return;
|
|
68550
|
+
}
|
|
68551
|
+
if (Array.isArray(value)) {
|
|
68552
|
+
value.forEach(
|
|
68553
|
+
(item) => requestUrl.searchParams.append(key2, String(item))
|
|
68554
|
+
);
|
|
68555
|
+
return;
|
|
68556
|
+
}
|
|
68557
|
+
requestUrl.searchParams.set(key2, String(value));
|
|
68558
|
+
});
|
|
68559
|
+
return requestUrl.toString();
|
|
68560
|
+
}
|
|
68561
|
+
async refresh(overrides) {
|
|
68562
|
+
const geojsonConfig = this.getGeoJSONConfig();
|
|
68563
|
+
const requestConfig = geojsonConfig.request;
|
|
68564
|
+
if (!(requestConfig == null ? void 0 : requestConfig.url)) {
|
|
68565
|
+
if (geojsonConfig.data) {
|
|
68566
|
+
this.applyGeoJSONData(geojsonConfig.data);
|
|
68567
|
+
}
|
|
68568
|
+
return;
|
|
68569
|
+
}
|
|
68570
|
+
if (this.isRefreshing) {
|
|
68571
|
+
return;
|
|
68572
|
+
}
|
|
68573
|
+
this.isRefreshing = true;
|
|
68574
|
+
try {
|
|
68575
|
+
const refreshPayload = this.buildExtentPayload(geojsonConfig.refresh);
|
|
68576
|
+
const context = this.buildRequestContext({
|
|
68577
|
+
params: {
|
|
68578
|
+
...refreshPayload.params || {},
|
|
68579
|
+
...(overrides == null ? void 0 : overrides.params) || {}
|
|
68580
|
+
},
|
|
68581
|
+
body: typeof refreshPayload.body === "object" && !Array.isArray(refreshPayload.body) && typeof ((overrides == null ? void 0 : overrides.body) || requestConfig.body) === "object" && !Array.isArray((overrides == null ? void 0 : overrides.body) || requestConfig.body) ? {
|
|
68582
|
+
...requestConfig.body,
|
|
68583
|
+
...refreshPayload.body,
|
|
68584
|
+
...overrides == null ? void 0 : overrides.body
|
|
68585
|
+
} : (overrides == null ? void 0 : overrides.body) ?? refreshPayload.body ?? requestConfig.body
|
|
68586
|
+
});
|
|
68587
|
+
let request = {
|
|
68588
|
+
url: requestConfig.url,
|
|
68589
|
+
method: requestConfig.method || "GET",
|
|
68590
|
+
headers: { ...requestConfig.headers || {} },
|
|
68591
|
+
params: { ...context.params },
|
|
68592
|
+
body: context.body
|
|
68593
|
+
};
|
|
68594
|
+
if (requestConfig.requestInterceptor) {
|
|
68595
|
+
const intercepted = await requestConfig.requestInterceptor(
|
|
68596
|
+
request,
|
|
68597
|
+
context
|
|
68598
|
+
);
|
|
68599
|
+
request = {
|
|
68600
|
+
...request,
|
|
68601
|
+
...intercepted || {},
|
|
68602
|
+
headers: {
|
|
68603
|
+
...request.headers,
|
|
68604
|
+
...(intercepted == null ? void 0 : intercepted.headers) || {}
|
|
68605
|
+
},
|
|
68606
|
+
params: {
|
|
68607
|
+
...request.params,
|
|
68608
|
+
...(intercepted == null ? void 0 : intercepted.params) || {}
|
|
68609
|
+
}
|
|
68610
|
+
};
|
|
68611
|
+
}
|
|
68612
|
+
const requestUrl = this.createRequestUrl(
|
|
68613
|
+
request.url,
|
|
68614
|
+
request.params,
|
|
68615
|
+
request.method
|
|
68616
|
+
);
|
|
68617
|
+
const response = await fetch(requestUrl, {
|
|
68618
|
+
method: request.method,
|
|
68619
|
+
headers: {
|
|
68620
|
+
"Content-Type": request.method === "GET" ? void 0 : "application/json;charset=UTF-8",
|
|
68621
|
+
...request.headers
|
|
68622
|
+
},
|
|
68623
|
+
body: request.method === "GET" || request.body === void 0 ? void 0 : typeof request.body === "string" ? request.body : JSON.stringify(request.body)
|
|
68348
68624
|
});
|
|
68349
|
-
|
|
68350
|
-
|
|
68351
|
-
|
|
68625
|
+
if (!response.ok) {
|
|
68626
|
+
throw new Error(`GeoJSON 请求失败: ${response.status}`);
|
|
68627
|
+
}
|
|
68628
|
+
let responseData;
|
|
68629
|
+
const contentType = response.headers.get("content-type") || "";
|
|
68630
|
+
if (contentType.includes("application/json")) {
|
|
68631
|
+
responseData = await response.json();
|
|
68632
|
+
} else {
|
|
68633
|
+
responseData = await response.text();
|
|
68634
|
+
}
|
|
68635
|
+
if (requestConfig.responseInterceptor) {
|
|
68636
|
+
responseData = await requestConfig.responseInterceptor(
|
|
68637
|
+
responseData,
|
|
68638
|
+
context
|
|
68639
|
+
);
|
|
68640
|
+
}
|
|
68641
|
+
if (requestConfig.responseParser) {
|
|
68642
|
+
responseData = await requestConfig.responseParser(
|
|
68643
|
+
responseData,
|
|
68644
|
+
context
|
|
68645
|
+
);
|
|
68646
|
+
} else {
|
|
68647
|
+
responseData = this.getNestedValue(
|
|
68648
|
+
responseData,
|
|
68649
|
+
requestConfig.dataPath || geojsonConfig.dataPath
|
|
68650
|
+
);
|
|
68651
|
+
}
|
|
68652
|
+
this.applyGeoJSONData(responseData);
|
|
68653
|
+
} catch (error2) {
|
|
68654
|
+
if (geojsonConfig.clearOnError) {
|
|
68655
|
+
const source = this.getVectorSource();
|
|
68656
|
+
source == null ? void 0 : source.clear();
|
|
68657
|
+
this.originalFeatures = [];
|
|
68658
|
+
}
|
|
68659
|
+
throw error2;
|
|
68660
|
+
} finally {
|
|
68661
|
+
this.isRefreshing = false;
|
|
68662
|
+
}
|
|
68663
|
+
}
|
|
68664
|
+
updateRequestParams(params) {
|
|
68665
|
+
var _a2;
|
|
68666
|
+
const currentGeoJSONConfig = this.getGeoJSONConfig();
|
|
68667
|
+
this.config.geojsonConfig = {
|
|
68668
|
+
...currentGeoJSONConfig,
|
|
68669
|
+
request: {
|
|
68670
|
+
...currentGeoJSONConfig.request || {},
|
|
68671
|
+
params: {
|
|
68672
|
+
...((_a2 = currentGeoJSONConfig.request) == null ? void 0 : _a2.params) || {},
|
|
68673
|
+
...params
|
|
68674
|
+
}
|
|
68675
|
+
}
|
|
68676
|
+
};
|
|
68677
|
+
void this.refresh();
|
|
68678
|
+
}
|
|
68679
|
+
scheduleRefresh() {
|
|
68680
|
+
const refreshConfig = this.getGeoJSONConfig().refresh;
|
|
68681
|
+
const debounce2 = (refreshConfig == null ? void 0 : refreshConfig.debounce) ?? 300;
|
|
68682
|
+
if (this.refreshDebounceTimer) {
|
|
68683
|
+
clearTimeout(this.refreshDebounceTimer);
|
|
68352
68684
|
}
|
|
68685
|
+
this.refreshDebounceTimer = setTimeout(() => {
|
|
68686
|
+
void this.refresh();
|
|
68687
|
+
}, debounce2);
|
|
68688
|
+
}
|
|
68689
|
+
setupRefreshBehavior() {
|
|
68690
|
+
this.clearRefreshBehavior();
|
|
68691
|
+
const refreshConfig = this.getGeoJSONConfig().refresh;
|
|
68692
|
+
if (!refreshConfig) {
|
|
68693
|
+
return;
|
|
68694
|
+
}
|
|
68695
|
+
const enabled = refreshConfig.enabled ?? true;
|
|
68696
|
+
if (!enabled) {
|
|
68697
|
+
return;
|
|
68698
|
+
}
|
|
68699
|
+
if (refreshConfig.interval && refreshConfig.interval > 0) {
|
|
68700
|
+
this.refreshTimer = setInterval(() => {
|
|
68701
|
+
void this.refresh();
|
|
68702
|
+
}, refreshConfig.interval);
|
|
68703
|
+
}
|
|
68704
|
+
if (this.map && (refreshConfig.onMoveEnd || refreshConfig.onZoomEnd)) {
|
|
68705
|
+
this.lastKnownZoom = this.map.getView().getZoom();
|
|
68706
|
+
this.moveEndListener = () => {
|
|
68707
|
+
var _a2;
|
|
68708
|
+
const currentZoom = (_a2 = this.map) == null ? void 0 : _a2.getView().getZoom();
|
|
68709
|
+
const zoomChanged = currentZoom !== this.lastKnownZoom;
|
|
68710
|
+
this.lastKnownZoom = currentZoom;
|
|
68711
|
+
if (zoomChanged && refreshConfig.onZoomEnd) {
|
|
68712
|
+
this.scheduleRefresh();
|
|
68713
|
+
return;
|
|
68714
|
+
}
|
|
68715
|
+
if (!zoomChanged && refreshConfig.onMoveEnd) {
|
|
68716
|
+
this.scheduleRefresh();
|
|
68717
|
+
return;
|
|
68718
|
+
}
|
|
68719
|
+
if (refreshConfig.onMoveEnd && refreshConfig.onZoomEnd) {
|
|
68720
|
+
this.scheduleRefresh();
|
|
68721
|
+
}
|
|
68722
|
+
};
|
|
68723
|
+
this.map.on("moveend", this.moveEndListener);
|
|
68724
|
+
}
|
|
68725
|
+
}
|
|
68726
|
+
clearRefreshBehavior() {
|
|
68727
|
+
if (this.refreshTimer) {
|
|
68728
|
+
clearInterval(this.refreshTimer);
|
|
68729
|
+
this.refreshTimer = null;
|
|
68730
|
+
}
|
|
68731
|
+
if (this.refreshDebounceTimer) {
|
|
68732
|
+
clearTimeout(this.refreshDebounceTimer);
|
|
68733
|
+
this.refreshDebounceTimer = null;
|
|
68734
|
+
}
|
|
68735
|
+
if (this.map && this.moveEndListener) {
|
|
68736
|
+
this.map.un("moveend", this.moveEndListener);
|
|
68737
|
+
}
|
|
68738
|
+
this.moveEndListener = null;
|
|
68353
68739
|
}
|
|
68354
68740
|
/**
|
|
68355
68741
|
* 创建样式函数
|
|
@@ -68753,7 +69139,6 @@ ${this.attributes_.map(
|
|
|
68753
69139
|
* 应用过滤器(实现基类的抽象方法)
|
|
68754
69140
|
*/
|
|
68755
69141
|
applyFilters() {
|
|
68756
|
-
debugger;
|
|
68757
69142
|
const layer2 = this.getLayer();
|
|
68758
69143
|
const source = layer2.getSource();
|
|
68759
69144
|
if (!source)
|
|
@@ -69009,6 +69394,29 @@ ${this.attributes_.map(
|
|
|
69009
69394
|
clearAllFeatureFilters() {
|
|
69010
69395
|
this.clearAllFilters();
|
|
69011
69396
|
}
|
|
69397
|
+
updateConfig(newConfig) {
|
|
69398
|
+
super.updateConfig(newConfig);
|
|
69399
|
+
if (this.layer) {
|
|
69400
|
+
this.layer.setStyle(
|
|
69401
|
+
this.createStyleFunction()
|
|
69402
|
+
);
|
|
69403
|
+
}
|
|
69404
|
+
this.setupRefreshBehavior();
|
|
69405
|
+
if (newConfig.url !== void 0 || newConfig.data !== void 0 || newConfig.method !== void 0 || newConfig.headers !== void 0 || newConfig.params !== void 0 || newConfig.body !== void 0 || newConfig.dataPath !== void 0 || newConfig.geojsonConfig !== void 0 || newConfig.config !== void 0 || newConfig.projection !== void 0) {
|
|
69406
|
+
void this.initializeSource();
|
|
69407
|
+
}
|
|
69408
|
+
}
|
|
69409
|
+
setMap(map2) {
|
|
69410
|
+
super.setMap(map2);
|
|
69411
|
+
if (this.layer) {
|
|
69412
|
+
this.setupRefreshBehavior();
|
|
69413
|
+
}
|
|
69414
|
+
}
|
|
69415
|
+
destroy() {
|
|
69416
|
+
this.clearRefreshBehavior();
|
|
69417
|
+
this.vectorSource = null;
|
|
69418
|
+
super.destroy();
|
|
69419
|
+
}
|
|
69012
69420
|
}
|
|
69013
69421
|
class KMLLayerHandler extends BaseLayer {
|
|
69014
69422
|
constructor(config, map2) {
|
|
@@ -333765,6 +334173,72 @@ ${indentData}`);
|
|
|
333765
334173
|
getLayerHandler(layerId) {
|
|
333766
334174
|
return this.layerHandlers.get(layerId);
|
|
333767
334175
|
}
|
|
334176
|
+
async refreshLayer(layerId, options) {
|
|
334177
|
+
try {
|
|
334178
|
+
const config = this.getLayerConfig(layerId);
|
|
334179
|
+
if (!config) {
|
|
334180
|
+
return false;
|
|
334181
|
+
}
|
|
334182
|
+
if (!this.layerHandlers.has(layerId) && config.visible) {
|
|
334183
|
+
const loaded = await this.loadLayerOnDemand(layerId);
|
|
334184
|
+
if (!loaded) {
|
|
334185
|
+
return false;
|
|
334186
|
+
}
|
|
334187
|
+
}
|
|
334188
|
+
const handler = this.layerHandlers.get(layerId);
|
|
334189
|
+
if (!(handler == null ? void 0 : handler.refresh)) {
|
|
334190
|
+
return false;
|
|
334191
|
+
}
|
|
334192
|
+
await handler.refresh(options);
|
|
334193
|
+
return true;
|
|
334194
|
+
} catch (error2) {
|
|
334195
|
+
console.error("刷新图层失败:", error2);
|
|
334196
|
+
return false;
|
|
334197
|
+
}
|
|
334198
|
+
}
|
|
334199
|
+
updateLayerRequestParams(layerId, params) {
|
|
334200
|
+
var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i2, _j, _k, _l, _m;
|
|
334201
|
+
try {
|
|
334202
|
+
const config = this.getLayerConfig(layerId);
|
|
334203
|
+
if (!config) {
|
|
334204
|
+
return false;
|
|
334205
|
+
}
|
|
334206
|
+
const nextConfig = {
|
|
334207
|
+
...config,
|
|
334208
|
+
params: {
|
|
334209
|
+
...config.params || {},
|
|
334210
|
+
...params
|
|
334211
|
+
},
|
|
334212
|
+
geojsonConfig: {
|
|
334213
|
+
...config.geojsonConfig || ((_b2 = (_a2 = config.config) == null ? void 0 : _a2.vector) == null ? void 0 : _b2.geojson) || ((_c2 = config.config) == null ? void 0 : _c2.geojson) || {},
|
|
334214
|
+
request: {
|
|
334215
|
+
...((_g = config.geojsonConfig || ((_e2 = (_d = config.config) == null ? void 0 : _d.vector) == null ? void 0 : _e2.geojson) || ((_f = config.config) == null ? void 0 : _f.geojson)) == null ? void 0 : _g.request) || {},
|
|
334216
|
+
params: {
|
|
334217
|
+
...((_l = (_k = config.geojsonConfig || ((_i2 = (_h = config.config) == null ? void 0 : _h.vector) == null ? void 0 : _i2.geojson) || ((_j = config.config) == null ? void 0 : _j.geojson)) == null ? void 0 : _k.request) == null ? void 0 : _l.params) || {},
|
|
334218
|
+
...params
|
|
334219
|
+
}
|
|
334220
|
+
}
|
|
334221
|
+
}
|
|
334222
|
+
};
|
|
334223
|
+
if (this.layerConfigs.has(layerId)) {
|
|
334224
|
+
this.layerConfigs.set(layerId, nextConfig);
|
|
334225
|
+
}
|
|
334226
|
+
if (this.pendingLayerConfigs.has(layerId)) {
|
|
334227
|
+
this.pendingLayerConfigs.set(layerId, nextConfig);
|
|
334228
|
+
}
|
|
334229
|
+
const handler = this.layerHandlers.get(layerId);
|
|
334230
|
+
(_m = handler == null ? void 0 : handler.updateRequestParams) == null ? void 0 : _m.call(handler, params);
|
|
334231
|
+
this.saveLayerConfigs();
|
|
334232
|
+
this.eventBus.emit("layer-config-updated", {
|
|
334233
|
+
layerId,
|
|
334234
|
+
config: nextConfig
|
|
334235
|
+
});
|
|
334236
|
+
return true;
|
|
334237
|
+
} catch (error2) {
|
|
334238
|
+
console.error("更新图层请求参数失败:", error2);
|
|
334239
|
+
return false;
|
|
334240
|
+
}
|
|
334241
|
+
}
|
|
333768
334242
|
/**
|
|
333769
334243
|
* 设置底图图层ID列表(用于底图互斥判断)
|
|
333770
334244
|
*/
|
|
@@ -334088,12 +334562,19 @@ ${indentData}`);
|
|
|
334088
334562
|
updateLayerConfig(layerId, newConfig) {
|
|
334089
334563
|
try {
|
|
334090
334564
|
const handler = this.layerHandlers.get(layerId);
|
|
334091
|
-
const config = this.layerConfigs.get(layerId);
|
|
334092
|
-
if (
|
|
334565
|
+
const config = this.layerConfigs.get(layerId) || this.pendingLayerConfigs.get(layerId);
|
|
334566
|
+
if (config) {
|
|
334093
334567
|
const updatedConfig = { ...config, ...newConfig };
|
|
334094
|
-
this.layerConfigs.
|
|
334095
|
-
|
|
334096
|
-
|
|
334568
|
+
if (this.layerConfigs.has(layerId)) {
|
|
334569
|
+
this.layerConfigs.set(layerId, updatedConfig);
|
|
334570
|
+
}
|
|
334571
|
+
if (this.pendingLayerConfigs.has(layerId)) {
|
|
334572
|
+
this.pendingLayerConfigs.set(layerId, updatedConfig);
|
|
334573
|
+
}
|
|
334574
|
+
if (handler) {
|
|
334575
|
+
handler.updateConfig(newConfig);
|
|
334576
|
+
}
|
|
334577
|
+
if (handler && (newConfig.style || newConfig.customCss !== void 0)) {
|
|
334097
334578
|
if ("updateLayerStyles" in handler) {
|
|
334098
334579
|
handler.updateLayerStyles(
|
|
334099
334580
|
updatedConfig.style,
|
|
@@ -337301,6 +337782,10 @@ ${indentData}`);
|
|
|
337301
337782
|
var _a2;
|
|
337302
337783
|
return (_a2 = mapManager.value) == null ? void 0 : _a2.getEventManager();
|
|
337303
337784
|
},
|
|
337785
|
+
clearAll: () => {
|
|
337786
|
+
var _a2;
|
|
337787
|
+
(_a2 = mapManager.value) == null ? void 0 : _a2.clearAll();
|
|
337788
|
+
},
|
|
337304
337789
|
updateMapConfig,
|
|
337305
337790
|
startCoordinatePick,
|
|
337306
337791
|
stopCoordinatePick,
|
|
@@ -366377,6 +366862,22 @@ ${indentData}`);
|
|
|
366377
366862
|
}
|
|
366378
366863
|
return false;
|
|
366379
366864
|
},
|
|
366865
|
+
refreshLayer: (layerId, options) => {
|
|
366866
|
+
var _a2;
|
|
366867
|
+
const layerManager = (_a2 = mapContainerRef.value) == null ? void 0 : _a2.getLayerManager();
|
|
366868
|
+
if (layerManager) {
|
|
366869
|
+
return layerManager.refreshLayer(layerId, options);
|
|
366870
|
+
}
|
|
366871
|
+
return false;
|
|
366872
|
+
},
|
|
366873
|
+
updateLayerRequestParams: (layerId, params) => {
|
|
366874
|
+
var _a2;
|
|
366875
|
+
const layerManager = (_a2 = mapContainerRef.value) == null ? void 0 : _a2.getLayerManager();
|
|
366876
|
+
if (layerManager) {
|
|
366877
|
+
return layerManager.updateLayerRequestParams(layerId, params);
|
|
366878
|
+
}
|
|
366879
|
+
return false;
|
|
366880
|
+
},
|
|
366380
366881
|
getAllLayerConfigs: () => {
|
|
366381
366882
|
var _a2;
|
|
366382
366883
|
const layerManager = (_a2 = mapContainerRef.value) == null ? void 0 : _a2.getLayerManager();
|
|
@@ -366679,8 +367180,8 @@ ${indentData}`);
|
|
|
366679
367180
|
};
|
|
366680
367181
|
}
|
|
366681
367182
|
});
|
|
366682
|
-
const
|
|
366683
|
-
const OlMap = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-
|
|
367183
|
+
const OlMap_vue_vue_type_style_index_0_scoped_888f37cb_lang = "";
|
|
367184
|
+
const OlMap = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-888f37cb"]]);
|
|
366684
367185
|
const ol = "";
|
|
366685
367186
|
const Property$1 = {
|
|
366686
367187
|
ACCURACY: "accuracy",
|