vue-openlayers-plugin 1.1.13 → 1.1.14
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-d022a31a.mjs} +1 -1
- package/lib/{CoordinateLocationDialog-274aff1a.mjs → CoordinateLocationDialog-6cdf239b.mjs} +1 -1
- package/lib/{MapPrintDialog-97054260.mjs → FilterPanel-de00b336.mjs} +1 -1
- package/lib/{FilterPanel-ccdaaac3.mjs → LayerPanel-1a0456a4.mjs} +1 -1
- package/lib/{LayerPanel-c716b7cc.mjs → MapPrintDialog-c65f685b.mjs} +1 -1
- package/lib/{MeasurementDialog-7c08ba58.mjs → MeasurementDialog-44599074.mjs} +1 -1
- package/lib/{MyMarkersDialog-89bd594e.mjs → MyMarkersDialog-dd288574.mjs} +1 -1
- package/lib/{QuadCompareDialog-78dd2cf6.mjs → QuadCompareDialog-2cd17881.mjs} +1 -1
- package/lib/{RegionNavigationDialog-4b7b4e5f.mjs → RegionNavigationDialog-b1cdc5f9.mjs} +1 -1
- package/lib/{SplitCompareDialog-b51b55c1.mjs → SplitCompareDialog-6dd0fb71.mjs} +1 -1
- package/lib/{SwipeCompareDialog-2b89b65e.mjs → SwipeCompareDialog-dfae0afd.mjs} +1 -1
- package/lib/{ViewBookmarksDialog-7ee33d4e.mjs → ViewBookmarksDialog-2a6bc942.mjs} +1 -1
- package/lib/{index-3699244d.mjs → index-199c60c9.mjs} +1 -1
- package/lib/{index-98c677b7.mjs → index-e868c4e2.mjs} +504 -48
- package/lib/{index.es-e3be4489.mjs → index.es-560c236e.mjs} +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.umd.js +491 -35
- package/lib/style.css +5 -5
- package/package.json +1 -1
- package/types/components/OlDialogs/LayerPanel.vue.d.ts +188 -0
- package/types/components/OlDialogs/LayerPanel.vue.d.ts.map +1 -1
- package/types/components/OlMap.vue.d.ts +381 -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 +30 -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/lowcode-entry.d.ts +391 -0
- package/types/lowcode-entry.d.ts.map +1 -1
- package/types/types/map.d.ts +60 -0
- package/types/types/map.d.ts.map +1 -1
package/lib/index.umd.js
CHANGED
|
@@ -68300,13 +68300,17 @@ ${this.attributes_.map(
|
|
|
68300
68300
|
constructor(config, map2) {
|
|
68301
68301
|
super(config);
|
|
68302
68302
|
__publicField(this, "styleConfig");
|
|
68303
|
-
// 新增:缓存启用的过滤器和原始要素集合
|
|
68304
|
-
__publicField(this, "currentFilters", []);
|
|
68305
68303
|
__publicField(this, "originalFeatures", []);
|
|
68304
|
+
__publicField(this, "vectorSource", null);
|
|
68305
|
+
__publicField(this, "refreshTimer", null);
|
|
68306
|
+
__publicField(this, "refreshDebounceTimer", null);
|
|
68307
|
+
__publicField(this, "moveEndListener", null);
|
|
68308
|
+
__publicField(this, "lastKnownZoom");
|
|
68309
|
+
__publicField(this, "isRefreshing", false);
|
|
68306
68310
|
if (map2)
|
|
68307
68311
|
this.setMap(map2);
|
|
68308
68312
|
}
|
|
68309
|
-
createLayer() {
|
|
68313
|
+
async createLayer() {
|
|
68310
68314
|
var _a2, _b2, _c2;
|
|
68311
68315
|
const vectorSource = this.createVectorSource();
|
|
68312
68316
|
const declutterOpt = (_c2 = (_b2 = (_a2 = this.config) == null ? void 0 : _a2.config) == null ? void 0 : _b2.vector) == null ? void 0 : _c2.declutter;
|
|
@@ -68314,42 +68318,379 @@ ${this.attributes_.map(
|
|
|
68314
68318
|
className: this.config.className,
|
|
68315
68319
|
source: vectorSource,
|
|
68316
68320
|
style: this.createStyleFunction(),
|
|
68317
|
-
// 默认关闭 declutter;如需避免标签重叠,可在 config.vector.declutter 设为 true
|
|
68318
68321
|
declutter: declutterOpt !== void 0 ? !!declutterOpt : false
|
|
68319
68322
|
});
|
|
68323
|
+
this.vectorSource = vectorSource;
|
|
68324
|
+
await this.initializeSource();
|
|
68325
|
+
this.setupRefreshBehavior();
|
|
68320
68326
|
return vectorLayer;
|
|
68321
68327
|
}
|
|
68322
68328
|
/**
|
|
68323
68329
|
* 创建矢量数据源
|
|
68324
68330
|
*/
|
|
68325
68331
|
createVectorSource() {
|
|
68326
|
-
var _a2;
|
|
68327
68332
|
this.registerCustomProjection();
|
|
68333
|
+
return new VectorSource$1();
|
|
68334
|
+
}
|
|
68335
|
+
getGeoJSONConfig() {
|
|
68336
|
+
var _a2;
|
|
68337
|
+
const nestedConfig = this.config.geojsonConfig || ((_a2 = this.config.config) == null ? void 0 : _a2.geojson);
|
|
68338
|
+
const requestConfig = {
|
|
68339
|
+
url: this.config.url,
|
|
68340
|
+
method: this.config.method,
|
|
68341
|
+
headers: this.config.headers,
|
|
68342
|
+
params: this.config.params,
|
|
68343
|
+
body: this.config.body,
|
|
68344
|
+
dataPath: this.config.dataPath,
|
|
68345
|
+
...(nestedConfig == null ? void 0 : nestedConfig.request) || {}
|
|
68346
|
+
};
|
|
68347
|
+
return {
|
|
68348
|
+
data: (nestedConfig == null ? void 0 : nestedConfig.data) ?? this.config.data,
|
|
68349
|
+
dataPath: (nestedConfig == null ? void 0 : nestedConfig.dataPath) ?? this.config.dataPath,
|
|
68350
|
+
clearOnError: (nestedConfig == null ? void 0 : nestedConfig.clearOnError) ?? false,
|
|
68351
|
+
refresh: nestedConfig == null ? void 0 : nestedConfig.refresh,
|
|
68352
|
+
request: requestConfig.url || (nestedConfig == null ? void 0 : nestedConfig.request) ? requestConfig : void 0
|
|
68353
|
+
};
|
|
68354
|
+
}
|
|
68355
|
+
getDataProjection() {
|
|
68356
|
+
return this.config.projection || "EPSG:4326";
|
|
68357
|
+
}
|
|
68358
|
+
getMapProjection() {
|
|
68359
|
+
var _a2;
|
|
68360
|
+
return ((_a2 = this.map) == null ? void 0 : _a2.getView().getProjection().getCode()) || "EPSG:4326";
|
|
68361
|
+
}
|
|
68362
|
+
async initializeSource() {
|
|
68363
|
+
var _a2;
|
|
68364
|
+
const source = this.getVectorSource();
|
|
68365
|
+
if (!source)
|
|
68366
|
+
return;
|
|
68367
|
+
const geojsonConfig = this.getGeoJSONConfig();
|
|
68368
|
+
if (geojsonConfig.data) {
|
|
68369
|
+
this.applyGeoJSONData(geojsonConfig.data);
|
|
68370
|
+
return;
|
|
68371
|
+
}
|
|
68372
|
+
if (((_a2 = geojsonConfig.request) == null ? void 0 : _a2.url) || this.config.url) {
|
|
68373
|
+
await this.refresh();
|
|
68374
|
+
return;
|
|
68375
|
+
}
|
|
68376
|
+
source.clear();
|
|
68377
|
+
this.originalFeatures = [];
|
|
68378
|
+
}
|
|
68379
|
+
getVectorSource() {
|
|
68380
|
+
if (this.vectorSource) {
|
|
68381
|
+
return this.vectorSource;
|
|
68382
|
+
}
|
|
68383
|
+
if (!this.layer) {
|
|
68384
|
+
return null;
|
|
68385
|
+
}
|
|
68386
|
+
const source = this.layer.getSource();
|
|
68387
|
+
this.vectorSource = source || null;
|
|
68388
|
+
return this.vectorSource;
|
|
68389
|
+
}
|
|
68390
|
+
applyGeoJSONData(data2) {
|
|
68391
|
+
const source = this.getVectorSource();
|
|
68392
|
+
if (!source)
|
|
68393
|
+
return;
|
|
68394
|
+
const features2 = this.readFeaturesFromData(data2);
|
|
68395
|
+
source.clear();
|
|
68396
|
+
source.addFeatures(features2);
|
|
68397
|
+
this.originalFeatures = [...features2];
|
|
68398
|
+
if (this.getEnabledFilters().length > 0) {
|
|
68399
|
+
this.applyFilters();
|
|
68400
|
+
}
|
|
68401
|
+
}
|
|
68402
|
+
readFeaturesFromData(data2) {
|
|
68328
68403
|
const format2 = new GeoJSON$2();
|
|
68329
|
-
|
|
68330
|
-
|
|
68331
|
-
|
|
68332
|
-
|
|
68333
|
-
|
|
68334
|
-
|
|
68335
|
-
|
|
68336
|
-
|
|
68337
|
-
|
|
68338
|
-
|
|
68339
|
-
|
|
68340
|
-
|
|
68341
|
-
|
|
68342
|
-
|
|
68343
|
-
|
|
68344
|
-
|
|
68345
|
-
|
|
68346
|
-
|
|
68347
|
-
|
|
68404
|
+
return format2.readFeatures(this.normalizeGeoJSONData(data2), {
|
|
68405
|
+
dataProjection: this.getDataProjection(),
|
|
68406
|
+
featureProjection: this.getMapProjection()
|
|
68407
|
+
});
|
|
68408
|
+
}
|
|
68409
|
+
normalizeGeoJSONData(data2) {
|
|
68410
|
+
if (typeof data2 === "string") {
|
|
68411
|
+
const trimmed = data2.trim();
|
|
68412
|
+
if (!trimmed) {
|
|
68413
|
+
return { type: "FeatureCollection", features: [] };
|
|
68414
|
+
}
|
|
68415
|
+
try {
|
|
68416
|
+
return this.normalizeGeoJSONData(JSON.parse(trimmed));
|
|
68417
|
+
} catch (error2) {
|
|
68418
|
+
throw new Error("GeoJSON 字符串解析失败");
|
|
68419
|
+
}
|
|
68420
|
+
}
|
|
68421
|
+
if (Array.isArray(data2)) {
|
|
68422
|
+
return {
|
|
68423
|
+
type: "FeatureCollection",
|
|
68424
|
+
features: data2
|
|
68425
|
+
};
|
|
68426
|
+
}
|
|
68427
|
+
if (!data2 || typeof data2 !== "object") {
|
|
68428
|
+
return {
|
|
68429
|
+
type: "FeatureCollection",
|
|
68430
|
+
features: []
|
|
68431
|
+
};
|
|
68432
|
+
}
|
|
68433
|
+
if (data2.type === "FeatureCollection") {
|
|
68434
|
+
return data2;
|
|
68435
|
+
}
|
|
68436
|
+
if (data2.type === "Feature") {
|
|
68437
|
+
return {
|
|
68438
|
+
type: "FeatureCollection",
|
|
68439
|
+
features: [data2]
|
|
68440
|
+
};
|
|
68441
|
+
}
|
|
68442
|
+
if (Array.isArray(data2.features)) {
|
|
68443
|
+
return {
|
|
68444
|
+
type: "FeatureCollection",
|
|
68445
|
+
features: data2.features
|
|
68446
|
+
};
|
|
68447
|
+
}
|
|
68448
|
+
return data2;
|
|
68449
|
+
}
|
|
68450
|
+
getNestedValue(target, path2) {
|
|
68451
|
+
if (!path2) {
|
|
68452
|
+
return target;
|
|
68453
|
+
}
|
|
68454
|
+
const keys2 = path2.replace(/\[(\d+)\]/g, ".$1").split(".").filter(Boolean);
|
|
68455
|
+
return keys2.reduce(
|
|
68456
|
+
(current, key2) => current !== null && current !== void 0 ? current[key2] : void 0,
|
|
68457
|
+
target
|
|
68458
|
+
);
|
|
68459
|
+
}
|
|
68460
|
+
buildRequestContext(overrides) {
|
|
68461
|
+
const requestConfig = this.getGeoJSONConfig().request;
|
|
68462
|
+
return {
|
|
68463
|
+
config: this.config,
|
|
68464
|
+
params: {
|
|
68465
|
+
...(requestConfig == null ? void 0 : requestConfig.params) || {},
|
|
68466
|
+
...(overrides == null ? void 0 : overrides.params) || {}
|
|
68467
|
+
},
|
|
68468
|
+
body: (overrides == null ? void 0 : overrides.body) ?? (requestConfig == null ? void 0 : requestConfig.body),
|
|
68469
|
+
map: this.map || void 0
|
|
68470
|
+
};
|
|
68471
|
+
}
|
|
68472
|
+
buildExtentPayload(refreshConfig) {
|
|
68473
|
+
if (!(refreshConfig == null ? void 0 : refreshConfig.useExtent) || !this.map) {
|
|
68474
|
+
return {};
|
|
68475
|
+
}
|
|
68476
|
+
const size2 = this.map.getSize();
|
|
68477
|
+
if (!size2) {
|
|
68478
|
+
return {};
|
|
68479
|
+
}
|
|
68480
|
+
const view = this.map.getView();
|
|
68481
|
+
const sourceProjection = view.getProjection().getCode();
|
|
68482
|
+
const targetProjection = refreshConfig.extentProjection || this.getDataProjection();
|
|
68483
|
+
const rawExtent = view.calculateExtent(size2);
|
|
68484
|
+
const extent3 = sourceProjection === targetProjection ? rawExtent : transformExtent(rawExtent, sourceProjection, targetProjection);
|
|
68485
|
+
const extentValue = extent3.join(",");
|
|
68486
|
+
const extentParamName = refreshConfig.extentParamName || "bbox";
|
|
68487
|
+
if (refreshConfig.extentTarget === "body") {
|
|
68488
|
+
return {
|
|
68489
|
+
body: {
|
|
68490
|
+
[extentParamName]: extentValue
|
|
68491
|
+
}
|
|
68492
|
+
};
|
|
68493
|
+
}
|
|
68494
|
+
return {
|
|
68495
|
+
params: {
|
|
68496
|
+
[extentParamName]: extentValue
|
|
68497
|
+
}
|
|
68498
|
+
};
|
|
68499
|
+
}
|
|
68500
|
+
createRequestUrl(url, params, method2) {
|
|
68501
|
+
const requestUrl = new URL(url, window.location.origin);
|
|
68502
|
+
Object.entries(params).forEach(([key2, value]) => {
|
|
68503
|
+
if (value === void 0 || value === null || method2 !== "GET") {
|
|
68504
|
+
return;
|
|
68505
|
+
}
|
|
68506
|
+
if (Array.isArray(value)) {
|
|
68507
|
+
value.forEach(
|
|
68508
|
+
(item) => requestUrl.searchParams.append(key2, String(item))
|
|
68509
|
+
);
|
|
68510
|
+
return;
|
|
68511
|
+
}
|
|
68512
|
+
requestUrl.searchParams.set(key2, String(value));
|
|
68513
|
+
});
|
|
68514
|
+
return requestUrl.toString();
|
|
68515
|
+
}
|
|
68516
|
+
async refresh(overrides) {
|
|
68517
|
+
const geojsonConfig = this.getGeoJSONConfig();
|
|
68518
|
+
const requestConfig = geojsonConfig.request;
|
|
68519
|
+
if (!(requestConfig == null ? void 0 : requestConfig.url)) {
|
|
68520
|
+
if (geojsonConfig.data) {
|
|
68521
|
+
this.applyGeoJSONData(geojsonConfig.data);
|
|
68522
|
+
}
|
|
68523
|
+
return;
|
|
68524
|
+
}
|
|
68525
|
+
if (this.isRefreshing) {
|
|
68526
|
+
return;
|
|
68527
|
+
}
|
|
68528
|
+
this.isRefreshing = true;
|
|
68529
|
+
try {
|
|
68530
|
+
const refreshPayload = this.buildExtentPayload(geojsonConfig.refresh);
|
|
68531
|
+
const context = this.buildRequestContext({
|
|
68532
|
+
params: {
|
|
68533
|
+
...refreshPayload.params || {},
|
|
68534
|
+
...(overrides == null ? void 0 : overrides.params) || {}
|
|
68535
|
+
},
|
|
68536
|
+
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) ? {
|
|
68537
|
+
...requestConfig.body,
|
|
68538
|
+
...refreshPayload.body,
|
|
68539
|
+
...overrides == null ? void 0 : overrides.body
|
|
68540
|
+
} : (overrides == null ? void 0 : overrides.body) ?? refreshPayload.body ?? requestConfig.body
|
|
68541
|
+
});
|
|
68542
|
+
let request = {
|
|
68543
|
+
url: requestConfig.url,
|
|
68544
|
+
method: requestConfig.method || "GET",
|
|
68545
|
+
headers: { ...requestConfig.headers || {} },
|
|
68546
|
+
params: { ...context.params },
|
|
68547
|
+
body: context.body
|
|
68548
|
+
};
|
|
68549
|
+
if (requestConfig.requestInterceptor) {
|
|
68550
|
+
const intercepted = await requestConfig.requestInterceptor(
|
|
68551
|
+
request,
|
|
68552
|
+
context
|
|
68553
|
+
);
|
|
68554
|
+
request = {
|
|
68555
|
+
...request,
|
|
68556
|
+
...intercepted || {},
|
|
68557
|
+
headers: {
|
|
68558
|
+
...request.headers,
|
|
68559
|
+
...(intercepted == null ? void 0 : intercepted.headers) || {}
|
|
68560
|
+
},
|
|
68561
|
+
params: {
|
|
68562
|
+
...request.params,
|
|
68563
|
+
...(intercepted == null ? void 0 : intercepted.params) || {}
|
|
68564
|
+
}
|
|
68565
|
+
};
|
|
68566
|
+
}
|
|
68567
|
+
const requestUrl = this.createRequestUrl(
|
|
68568
|
+
request.url,
|
|
68569
|
+
request.params,
|
|
68570
|
+
request.method
|
|
68571
|
+
);
|
|
68572
|
+
const response = await fetch(requestUrl, {
|
|
68573
|
+
method: request.method,
|
|
68574
|
+
headers: {
|
|
68575
|
+
"Content-Type": request.method === "GET" ? void 0 : "application/json;charset=UTF-8",
|
|
68576
|
+
...request.headers
|
|
68577
|
+
},
|
|
68578
|
+
body: request.method === "GET" || request.body === void 0 ? void 0 : typeof request.body === "string" ? request.body : JSON.stringify(request.body)
|
|
68348
68579
|
});
|
|
68349
|
-
|
|
68350
|
-
|
|
68351
|
-
|
|
68580
|
+
if (!response.ok) {
|
|
68581
|
+
throw new Error(`GeoJSON 请求失败: ${response.status}`);
|
|
68582
|
+
}
|
|
68583
|
+
let responseData;
|
|
68584
|
+
const contentType = response.headers.get("content-type") || "";
|
|
68585
|
+
if (contentType.includes("application/json")) {
|
|
68586
|
+
responseData = await response.json();
|
|
68587
|
+
} else {
|
|
68588
|
+
responseData = await response.text();
|
|
68589
|
+
}
|
|
68590
|
+
if (requestConfig.responseInterceptor) {
|
|
68591
|
+
responseData = await requestConfig.responseInterceptor(
|
|
68592
|
+
responseData,
|
|
68593
|
+
context
|
|
68594
|
+
);
|
|
68595
|
+
}
|
|
68596
|
+
if (requestConfig.responseParser) {
|
|
68597
|
+
responseData = await requestConfig.responseParser(
|
|
68598
|
+
responseData,
|
|
68599
|
+
context
|
|
68600
|
+
);
|
|
68601
|
+
} else {
|
|
68602
|
+
responseData = this.getNestedValue(
|
|
68603
|
+
responseData,
|
|
68604
|
+
requestConfig.dataPath || geojsonConfig.dataPath
|
|
68605
|
+
);
|
|
68606
|
+
}
|
|
68607
|
+
this.applyGeoJSONData(responseData);
|
|
68608
|
+
} catch (error2) {
|
|
68609
|
+
if (geojsonConfig.clearOnError) {
|
|
68610
|
+
const source = this.getVectorSource();
|
|
68611
|
+
source == null ? void 0 : source.clear();
|
|
68612
|
+
this.originalFeatures = [];
|
|
68613
|
+
}
|
|
68614
|
+
throw error2;
|
|
68615
|
+
} finally {
|
|
68616
|
+
this.isRefreshing = false;
|
|
68617
|
+
}
|
|
68618
|
+
}
|
|
68619
|
+
updateRequestParams(params) {
|
|
68620
|
+
var _a2;
|
|
68621
|
+
const currentGeoJSONConfig = this.getGeoJSONConfig();
|
|
68622
|
+
this.config.geojsonConfig = {
|
|
68623
|
+
...currentGeoJSONConfig,
|
|
68624
|
+
request: {
|
|
68625
|
+
...currentGeoJSONConfig.request || {},
|
|
68626
|
+
params: {
|
|
68627
|
+
...((_a2 = currentGeoJSONConfig.request) == null ? void 0 : _a2.params) || {},
|
|
68628
|
+
...params
|
|
68629
|
+
}
|
|
68630
|
+
}
|
|
68631
|
+
};
|
|
68632
|
+
void this.refresh();
|
|
68633
|
+
}
|
|
68634
|
+
scheduleRefresh() {
|
|
68635
|
+
const refreshConfig = this.getGeoJSONConfig().refresh;
|
|
68636
|
+
const debounce2 = (refreshConfig == null ? void 0 : refreshConfig.debounce) ?? 300;
|
|
68637
|
+
if (this.refreshDebounceTimer) {
|
|
68638
|
+
clearTimeout(this.refreshDebounceTimer);
|
|
68639
|
+
}
|
|
68640
|
+
this.refreshDebounceTimer = setTimeout(() => {
|
|
68641
|
+
void this.refresh();
|
|
68642
|
+
}, debounce2);
|
|
68643
|
+
}
|
|
68644
|
+
setupRefreshBehavior() {
|
|
68645
|
+
this.clearRefreshBehavior();
|
|
68646
|
+
const refreshConfig = this.getGeoJSONConfig().refresh;
|
|
68647
|
+
if (!refreshConfig) {
|
|
68648
|
+
return;
|
|
68649
|
+
}
|
|
68650
|
+
const enabled = refreshConfig.enabled ?? true;
|
|
68651
|
+
if (!enabled) {
|
|
68652
|
+
return;
|
|
68352
68653
|
}
|
|
68654
|
+
if (refreshConfig.interval && refreshConfig.interval > 0) {
|
|
68655
|
+
this.refreshTimer = setInterval(() => {
|
|
68656
|
+
void this.refresh();
|
|
68657
|
+
}, refreshConfig.interval);
|
|
68658
|
+
}
|
|
68659
|
+
if (this.map && (refreshConfig.onMoveEnd || refreshConfig.onZoomEnd)) {
|
|
68660
|
+
this.lastKnownZoom = this.map.getView().getZoom();
|
|
68661
|
+
this.moveEndListener = () => {
|
|
68662
|
+
var _a2;
|
|
68663
|
+
const currentZoom = (_a2 = this.map) == null ? void 0 : _a2.getView().getZoom();
|
|
68664
|
+
const zoomChanged = currentZoom !== this.lastKnownZoom;
|
|
68665
|
+
this.lastKnownZoom = currentZoom;
|
|
68666
|
+
if (zoomChanged && refreshConfig.onZoomEnd) {
|
|
68667
|
+
this.scheduleRefresh();
|
|
68668
|
+
return;
|
|
68669
|
+
}
|
|
68670
|
+
if (!zoomChanged && refreshConfig.onMoveEnd) {
|
|
68671
|
+
this.scheduleRefresh();
|
|
68672
|
+
return;
|
|
68673
|
+
}
|
|
68674
|
+
if (refreshConfig.onMoveEnd && refreshConfig.onZoomEnd) {
|
|
68675
|
+
this.scheduleRefresh();
|
|
68676
|
+
}
|
|
68677
|
+
};
|
|
68678
|
+
this.map.on("moveend", this.moveEndListener);
|
|
68679
|
+
}
|
|
68680
|
+
}
|
|
68681
|
+
clearRefreshBehavior() {
|
|
68682
|
+
if (this.refreshTimer) {
|
|
68683
|
+
clearInterval(this.refreshTimer);
|
|
68684
|
+
this.refreshTimer = null;
|
|
68685
|
+
}
|
|
68686
|
+
if (this.refreshDebounceTimer) {
|
|
68687
|
+
clearTimeout(this.refreshDebounceTimer);
|
|
68688
|
+
this.refreshDebounceTimer = null;
|
|
68689
|
+
}
|
|
68690
|
+
if (this.map && this.moveEndListener) {
|
|
68691
|
+
this.map.un("moveend", this.moveEndListener);
|
|
68692
|
+
}
|
|
68693
|
+
this.moveEndListener = null;
|
|
68353
68694
|
}
|
|
68354
68695
|
/**
|
|
68355
68696
|
* 创建样式函数
|
|
@@ -68753,7 +69094,6 @@ ${this.attributes_.map(
|
|
|
68753
69094
|
* 应用过滤器(实现基类的抽象方法)
|
|
68754
69095
|
*/
|
|
68755
69096
|
applyFilters() {
|
|
68756
|
-
debugger;
|
|
68757
69097
|
const layer2 = this.getLayer();
|
|
68758
69098
|
const source = layer2.getSource();
|
|
68759
69099
|
if (!source)
|
|
@@ -69009,6 +69349,29 @@ ${this.attributes_.map(
|
|
|
69009
69349
|
clearAllFeatureFilters() {
|
|
69010
69350
|
this.clearAllFilters();
|
|
69011
69351
|
}
|
|
69352
|
+
updateConfig(newConfig) {
|
|
69353
|
+
super.updateConfig(newConfig);
|
|
69354
|
+
if (this.layer) {
|
|
69355
|
+
this.layer.setStyle(
|
|
69356
|
+
this.createStyleFunction()
|
|
69357
|
+
);
|
|
69358
|
+
}
|
|
69359
|
+
this.setupRefreshBehavior();
|
|
69360
|
+
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) {
|
|
69361
|
+
void this.initializeSource();
|
|
69362
|
+
}
|
|
69363
|
+
}
|
|
69364
|
+
setMap(map2) {
|
|
69365
|
+
super.setMap(map2);
|
|
69366
|
+
if (this.layer) {
|
|
69367
|
+
this.setupRefreshBehavior();
|
|
69368
|
+
}
|
|
69369
|
+
}
|
|
69370
|
+
destroy() {
|
|
69371
|
+
this.clearRefreshBehavior();
|
|
69372
|
+
this.vectorSource = null;
|
|
69373
|
+
super.destroy();
|
|
69374
|
+
}
|
|
69012
69375
|
}
|
|
69013
69376
|
class KMLLayerHandler extends BaseLayer {
|
|
69014
69377
|
constructor(config, map2) {
|
|
@@ -333765,6 +334128,72 @@ ${indentData}`);
|
|
|
333765
334128
|
getLayerHandler(layerId) {
|
|
333766
334129
|
return this.layerHandlers.get(layerId);
|
|
333767
334130
|
}
|
|
334131
|
+
async refreshLayer(layerId, options) {
|
|
334132
|
+
try {
|
|
334133
|
+
const config = this.getLayerConfig(layerId);
|
|
334134
|
+
if (!config) {
|
|
334135
|
+
return false;
|
|
334136
|
+
}
|
|
334137
|
+
if (!this.layerHandlers.has(layerId) && config.visible) {
|
|
334138
|
+
const loaded = await this.loadLayerOnDemand(layerId);
|
|
334139
|
+
if (!loaded) {
|
|
334140
|
+
return false;
|
|
334141
|
+
}
|
|
334142
|
+
}
|
|
334143
|
+
const handler = this.layerHandlers.get(layerId);
|
|
334144
|
+
if (!(handler == null ? void 0 : handler.refresh)) {
|
|
334145
|
+
return false;
|
|
334146
|
+
}
|
|
334147
|
+
await handler.refresh(options);
|
|
334148
|
+
return true;
|
|
334149
|
+
} catch (error2) {
|
|
334150
|
+
console.error("刷新图层失败:", error2);
|
|
334151
|
+
return false;
|
|
334152
|
+
}
|
|
334153
|
+
}
|
|
334154
|
+
updateLayerRequestParams(layerId, params) {
|
|
334155
|
+
var _a2, _b2, _c2, _d, _e2, _f, _g;
|
|
334156
|
+
try {
|
|
334157
|
+
const config = this.getLayerConfig(layerId);
|
|
334158
|
+
if (!config) {
|
|
334159
|
+
return false;
|
|
334160
|
+
}
|
|
334161
|
+
const nextConfig = {
|
|
334162
|
+
...config,
|
|
334163
|
+
params: {
|
|
334164
|
+
...config.params || {},
|
|
334165
|
+
...params
|
|
334166
|
+
},
|
|
334167
|
+
geojsonConfig: {
|
|
334168
|
+
...config.geojsonConfig || ((_a2 = config.config) == null ? void 0 : _a2.geojson) || {},
|
|
334169
|
+
request: {
|
|
334170
|
+
...((_c2 = config.geojsonConfig || ((_b2 = config.config) == null ? void 0 : _b2.geojson)) == null ? void 0 : _c2.request) || {},
|
|
334171
|
+
params: {
|
|
334172
|
+
...((_f = (_e2 = config.geojsonConfig || ((_d = config.config) == null ? void 0 : _d.geojson)) == null ? void 0 : _e2.request) == null ? void 0 : _f.params) || {},
|
|
334173
|
+
...params
|
|
334174
|
+
}
|
|
334175
|
+
}
|
|
334176
|
+
}
|
|
334177
|
+
};
|
|
334178
|
+
if (this.layerConfigs.has(layerId)) {
|
|
334179
|
+
this.layerConfigs.set(layerId, nextConfig);
|
|
334180
|
+
}
|
|
334181
|
+
if (this.pendingLayerConfigs.has(layerId)) {
|
|
334182
|
+
this.pendingLayerConfigs.set(layerId, nextConfig);
|
|
334183
|
+
}
|
|
334184
|
+
const handler = this.layerHandlers.get(layerId);
|
|
334185
|
+
(_g = handler == null ? void 0 : handler.updateRequestParams) == null ? void 0 : _g.call(handler, params);
|
|
334186
|
+
this.saveLayerConfigs();
|
|
334187
|
+
this.eventBus.emit("layer-config-updated", {
|
|
334188
|
+
layerId,
|
|
334189
|
+
config: nextConfig
|
|
334190
|
+
});
|
|
334191
|
+
return true;
|
|
334192
|
+
} catch (error2) {
|
|
334193
|
+
console.error("更新图层请求参数失败:", error2);
|
|
334194
|
+
return false;
|
|
334195
|
+
}
|
|
334196
|
+
}
|
|
333768
334197
|
/**
|
|
333769
334198
|
* 设置底图图层ID列表(用于底图互斥判断)
|
|
333770
334199
|
*/
|
|
@@ -334088,12 +334517,19 @@ ${indentData}`);
|
|
|
334088
334517
|
updateLayerConfig(layerId, newConfig) {
|
|
334089
334518
|
try {
|
|
334090
334519
|
const handler = this.layerHandlers.get(layerId);
|
|
334091
|
-
const config = this.layerConfigs.get(layerId);
|
|
334092
|
-
if (
|
|
334520
|
+
const config = this.layerConfigs.get(layerId) || this.pendingLayerConfigs.get(layerId);
|
|
334521
|
+
if (config) {
|
|
334093
334522
|
const updatedConfig = { ...config, ...newConfig };
|
|
334094
|
-
this.layerConfigs.
|
|
334095
|
-
|
|
334096
|
-
|
|
334523
|
+
if (this.layerConfigs.has(layerId)) {
|
|
334524
|
+
this.layerConfigs.set(layerId, updatedConfig);
|
|
334525
|
+
}
|
|
334526
|
+
if (this.pendingLayerConfigs.has(layerId)) {
|
|
334527
|
+
this.pendingLayerConfigs.set(layerId, updatedConfig);
|
|
334528
|
+
}
|
|
334529
|
+
if (handler) {
|
|
334530
|
+
handler.updateConfig(newConfig);
|
|
334531
|
+
}
|
|
334532
|
+
if (handler && (newConfig.style || newConfig.customCss !== void 0)) {
|
|
334097
334533
|
if ("updateLayerStyles" in handler) {
|
|
334098
334534
|
handler.updateLayerStyles(
|
|
334099
334535
|
updatedConfig.style,
|
|
@@ -337301,6 +337737,10 @@ ${indentData}`);
|
|
|
337301
337737
|
var _a2;
|
|
337302
337738
|
return (_a2 = mapManager.value) == null ? void 0 : _a2.getEventManager();
|
|
337303
337739
|
},
|
|
337740
|
+
clearAll: () => {
|
|
337741
|
+
var _a2;
|
|
337742
|
+
(_a2 = mapManager.value) == null ? void 0 : _a2.clearAll();
|
|
337743
|
+
},
|
|
337304
337744
|
updateMapConfig,
|
|
337305
337745
|
startCoordinatePick,
|
|
337306
337746
|
stopCoordinatePick,
|
|
@@ -366377,6 +366817,22 @@ ${indentData}`);
|
|
|
366377
366817
|
}
|
|
366378
366818
|
return false;
|
|
366379
366819
|
},
|
|
366820
|
+
refreshLayer: (layerId, options) => {
|
|
366821
|
+
var _a2;
|
|
366822
|
+
const layerManager = (_a2 = mapContainerRef.value) == null ? void 0 : _a2.getLayerManager();
|
|
366823
|
+
if (layerManager) {
|
|
366824
|
+
return layerManager.refreshLayer(layerId, options);
|
|
366825
|
+
}
|
|
366826
|
+
return false;
|
|
366827
|
+
},
|
|
366828
|
+
updateLayerRequestParams: (layerId, params) => {
|
|
366829
|
+
var _a2;
|
|
366830
|
+
const layerManager = (_a2 = mapContainerRef.value) == null ? void 0 : _a2.getLayerManager();
|
|
366831
|
+
if (layerManager) {
|
|
366832
|
+
return layerManager.updateLayerRequestParams(layerId, params);
|
|
366833
|
+
}
|
|
366834
|
+
return false;
|
|
366835
|
+
},
|
|
366380
366836
|
getAllLayerConfigs: () => {
|
|
366381
366837
|
var _a2;
|
|
366382
366838
|
const layerManager = (_a2 = mapContainerRef.value) == null ? void 0 : _a2.getLayerManager();
|
|
@@ -366679,8 +367135,8 @@ ${indentData}`);
|
|
|
366679
367135
|
};
|
|
366680
367136
|
}
|
|
366681
367137
|
});
|
|
366682
|
-
const
|
|
366683
|
-
const OlMap = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-
|
|
367138
|
+
const OlMap_vue_vue_type_style_index_0_scoped_888f37cb_lang = "";
|
|
367139
|
+
const OlMap = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-888f37cb"]]);
|
|
366684
367140
|
const ol = "";
|
|
366685
367141
|
const Property$1 = {
|
|
366686
367142
|
ACCURACY: "accuracy",
|
package/lib/style.css
CHANGED
|
@@ -1674,7 +1674,7 @@ label {
|
|
|
1674
1674
|
width: 100% !important;
|
|
1675
1675
|
height: 100% !important;
|
|
1676
1676
|
}
|
|
1677
|
-
.context-menu[data-v-
|
|
1677
|
+
.context-menu[data-v-888f37cb] {
|
|
1678
1678
|
background: var(--el-bg-color-overlay);
|
|
1679
1679
|
border: 1px solid var(--el-border-color-light);
|
|
1680
1680
|
border-radius: var(--el-border-radius-base);
|
|
@@ -1683,7 +1683,7 @@ label {
|
|
|
1683
1683
|
min-width: 140px;
|
|
1684
1684
|
overflow: hidden;
|
|
1685
1685
|
}
|
|
1686
|
-
.context-menu .context-menu-item[data-v-
|
|
1686
|
+
.context-menu .context-menu-item[data-v-888f37cb] {
|
|
1687
1687
|
display: flex;
|
|
1688
1688
|
align-items: center;
|
|
1689
1689
|
padding: 8px 16px;
|
|
@@ -1692,14 +1692,14 @@ label {
|
|
|
1692
1692
|
color: var(--el-text-color-primary);
|
|
1693
1693
|
transition: all 0.2s;
|
|
1694
1694
|
}
|
|
1695
|
-
.context-menu .context-menu-item[data-v-
|
|
1695
|
+
.context-menu .context-menu-item[data-v-888f37cb]:hover {
|
|
1696
1696
|
background-color: var(--el-fill-color-light);
|
|
1697
1697
|
color: var(--el-color-primary);
|
|
1698
1698
|
}
|
|
1699
|
-
.context-menu .context-menu-item:hover .el-icon[data-v-
|
|
1699
|
+
.context-menu .context-menu-item:hover .el-icon[data-v-888f37cb] {
|
|
1700
1700
|
color: var(--el-color-primary);
|
|
1701
1701
|
}
|
|
1702
|
-
.context-menu .context-menu-item .el-icon[data-v-
|
|
1702
|
+
.context-menu .context-menu-item .el-icon[data-v-888f37cb] {
|
|
1703
1703
|
margin-right: 8px;
|
|
1704
1704
|
font-size: 16px;
|
|
1705
1705
|
color: var(--el-text-color-secondary);
|