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.
Files changed (37) hide show
  1. package/README.md +209 -0
  2. package/lib/{BasemapPanel-a8d7373d.mjs → BasemapPanel-7664fc20.mjs} +1 -1
  3. package/lib/{CoordinateLocationDialog-274aff1a.mjs → CoordinateLocationDialog-f505c006.mjs} +1 -1
  4. package/lib/{MapPrintDialog-97054260.mjs → FilterPanel-4cfbbfeb.mjs} +1 -1
  5. package/lib/{FilterPanel-ccdaaac3.mjs → LayerPanel-354b6ac7.mjs} +1 -1
  6. package/lib/{LayerPanel-c716b7cc.mjs → MapPrintDialog-0cf04cae.mjs} +1 -1
  7. package/lib/{MeasurementDialog-7c08ba58.mjs → MeasurementDialog-4fd11413.mjs} +1 -1
  8. package/lib/{MyMarkersDialog-89bd594e.mjs → MyMarkersDialog-f413337c.mjs} +1 -1
  9. package/lib/{QuadCompareDialog-78dd2cf6.mjs → QuadCompareDialog-176a8178.mjs} +1 -1
  10. package/lib/{RegionNavigationDialog-4b7b4e5f.mjs → RegionNavigationDialog-1edd078f.mjs} +1 -1
  11. package/lib/{SplitCompareDialog-b51b55c1.mjs → SplitCompareDialog-3fe419de.mjs} +1 -1
  12. package/lib/{SwipeCompareDialog-2b89b65e.mjs → SwipeCompareDialog-e2c28122.mjs} +1 -1
  13. package/lib/{ViewBookmarksDialog-7ee33d4e.mjs → ViewBookmarksDialog-9873fb3c.mjs} +1 -1
  14. package/lib/{index-98c677b7.mjs → index-923f7253.mjs} +549 -48
  15. package/lib/{index-3699244d.mjs → index-a30f4100.mjs} +1 -1
  16. package/lib/{index.es-e3be4489.mjs → index.es-b7728855.mjs} +1 -1
  17. package/lib/index.esm.js +1 -1
  18. package/lib/index.umd.js +536 -35
  19. package/lib/style.css +5 -5
  20. package/package.json +1 -1
  21. package/types/components/OlDialogs/LayerPanel.vue.d.ts +204 -0
  22. package/types/components/OlDialogs/LayerPanel.vue.d.ts.map +1 -1
  23. package/types/components/OlMap.vue.d.ts +413 -0
  24. package/types/components/OlMap.vue.d.ts.map +1 -1
  25. package/types/components/OlMapContainer.vue.d.ts +1 -0
  26. package/types/components/OlMapContainer.vue.d.ts.map +1 -1
  27. package/types/core/LayerManager.d.ts +5 -0
  28. package/types/core/LayerManager.d.ts.map +1 -1
  29. package/types/core/layers/GeoJSONLayerHandler.d.ts +31 -2
  30. package/types/core/layers/GeoJSONLayerHandler.d.ts.map +1 -1
  31. package/types/core/layers/interfaces.d.ts +5 -0
  32. package/types/core/layers/interfaces.d.ts.map +1 -1
  33. package/types/core/storage.d.ts.map +1 -1
  34. package/types/lowcode-entry.d.ts +423 -0
  35. package/types/lowcode-entry.d.ts.map +1 -1
  36. package/types/types/map.d.ts +64 -0
  37. package/types/types/map.d.ts.map +1 -1
@@ -53198,10 +53198,33 @@ class MapStorage {
53198
53198
  };
53199
53199
  if (config.url)
53200
53200
  optimizedConfig.url = config.url;
53201
+ if (config.method)
53202
+ optimizedConfig.method = config.method;
53203
+ if (config.params && Object.keys(config.params).length > 0) {
53204
+ optimizedConfig.params = config.params;
53205
+ }
53206
+ if (config.headers && Object.keys(config.headers).length > 0) {
53207
+ optimizedConfig.headers = config.headers;
53208
+ }
53209
+ if (config.body !== void 0)
53210
+ optimizedConfig.body = config.body;
53211
+ if (config.dataPath)
53212
+ optimizedConfig.dataPath = config.dataPath;
53201
53213
  if (config.opacity !== void 0 && config.opacity !== 1)
53202
53214
  optimizedConfig.opacity = config.opacity;
53203
53215
  if (config.zIndex !== void 0 && config.zIndex !== 0)
53204
53216
  optimizedConfig.zIndex = config.zIndex;
53217
+ if (config.geojsonConfig)
53218
+ optimizedConfig.geojsonConfig = config.geojsonConfig;
53219
+ if (config.config)
53220
+ optimizedConfig.config = config.config;
53221
+ if (config.projection)
53222
+ optimizedConfig.projection = config.projection;
53223
+ if (config.projectionDefinition) {
53224
+ optimizedConfig.projectionDefinition = config.projectionDefinition;
53225
+ }
53226
+ if (config.style)
53227
+ optimizedConfig.style = config.style;
53205
53228
  if (config.legend)
53206
53229
  optimizedConfig.legend = config.legend;
53207
53230
  if (config.metadata && Object.keys(config.metadata).length > 0) {
@@ -67657,13 +67680,17 @@ class GeoJSONLayerHandler extends BaseLayer2 {
67657
67680
  constructor(config, map2) {
67658
67681
  super(config);
67659
67682
  __publicField(this, "styleConfig");
67660
- // 新增:缓存启用的过滤器和原始要素集合
67661
- __publicField(this, "currentFilters", []);
67662
67683
  __publicField(this, "originalFeatures", []);
67684
+ __publicField(this, "vectorSource", null);
67685
+ __publicField(this, "refreshTimer", null);
67686
+ __publicField(this, "refreshDebounceTimer", null);
67687
+ __publicField(this, "moveEndListener", null);
67688
+ __publicField(this, "lastKnownZoom");
67689
+ __publicField(this, "isRefreshing", false);
67663
67690
  if (map2)
67664
67691
  this.setMap(map2);
67665
67692
  }
67666
- createLayer() {
67693
+ async createLayer() {
67667
67694
  var _a2, _b2, _c2;
67668
67695
  const vectorSource = this.createVectorSource();
67669
67696
  const declutterOpt = (_c2 = (_b2 = (_a2 = this.config) == null ? void 0 : _a2.config) == null ? void 0 : _b2.vector) == null ? void 0 : _c2.declutter;
@@ -67671,43 +67698,402 @@ class GeoJSONLayerHandler extends BaseLayer2 {
67671
67698
  className: this.config.className,
67672
67699
  source: vectorSource,
67673
67700
  style: this.createStyleFunction(),
67674
- // 默认关闭 declutter;如需避免标签重叠,可在 config.vector.declutter 设为 true
67675
67701
  declutter: declutterOpt !== void 0 ? !!declutterOpt : false
67676
67702
  });
67703
+ this.vectorSource = vectorSource;
67704
+ await this.initializeSource();
67705
+ this.setupRefreshBehavior();
67677
67706
  return vectorLayer;
67678
67707
  }
67679
67708
  /**
67680
67709
  * 创建矢量数据源
67681
67710
  */
67682
67711
  createVectorSource() {
67683
- var _a2;
67684
67712
  this.registerCustomProjection();
67713
+ return new VectorSource$1();
67714
+ }
67715
+ getGeoJSONConfig() {
67716
+ var _a2, _b2, _c2;
67717
+ 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);
67718
+ const requestConfig = {
67719
+ url: this.config.url,
67720
+ method: this.config.method,
67721
+ headers: this.config.headers,
67722
+ params: this.config.params,
67723
+ body: this.config.body,
67724
+ dataPath: this.config.dataPath,
67725
+ ...(nestedConfig == null ? void 0 : nestedConfig.request) || {}
67726
+ };
67727
+ const normalizedRequestConfig = this.normalizeRequestConfig(requestConfig);
67728
+ return {
67729
+ data: (nestedConfig == null ? void 0 : nestedConfig.data) ?? this.config.data,
67730
+ dataPath: (nestedConfig == null ? void 0 : nestedConfig.dataPath) ?? this.config.dataPath,
67731
+ clearOnError: (nestedConfig == null ? void 0 : nestedConfig.clearOnError) ?? false,
67732
+ refresh: nestedConfig == null ? void 0 : nestedConfig.refresh,
67733
+ request: normalizedRequestConfig.url || (nestedConfig == null ? void 0 : nestedConfig.request) ? normalizedRequestConfig : void 0
67734
+ };
67735
+ }
67736
+ normalizeRequestConfig(requestConfig) {
67737
+ var _a2;
67738
+ const normalizedParams = {
67739
+ ...requestConfig.params || {}
67740
+ };
67741
+ const layerConfig = this.config;
67742
+ const landTypeParamName = requestConfig.landTypeParamName || "landType";
67743
+ const landTypeValue = requestConfig.landType ?? layerConfig.geojsonLandType ?? normalizedParams[landTypeParamName] ?? normalizedParams.landType;
67744
+ if (landTypeValue !== void 0 && normalizedParams[landTypeParamName] === void 0) {
67745
+ normalizedParams[landTypeParamName] = landTypeValue;
67746
+ }
67747
+ const managementUnitParamName = requestConfig.managementUnitParamName || "managementUnit";
67748
+ const managementUnitValue = requestConfig.managementUnit ?? layerConfig.managementUnit ?? ((_a2 = this.config.metadata) == null ? void 0 : _a2.managementUnit) ?? normalizedParams[managementUnitParamName] ?? normalizedParams.managementUnit;
67749
+ if (managementUnitValue !== void 0 && normalizedParams[managementUnitParamName] === void 0) {
67750
+ normalizedParams[managementUnitParamName] = managementUnitValue;
67751
+ }
67752
+ return {
67753
+ ...requestConfig,
67754
+ params: normalizedParams
67755
+ };
67756
+ }
67757
+ getDataProjection() {
67758
+ return this.config.projection || "EPSG:4326";
67759
+ }
67760
+ getMapProjection() {
67761
+ var _a2;
67762
+ return ((_a2 = this.map) == null ? void 0 : _a2.getView().getProjection().getCode()) || "EPSG:4326";
67763
+ }
67764
+ async initializeSource() {
67765
+ var _a2;
67766
+ const source = this.getVectorSource();
67767
+ if (!source)
67768
+ return;
67769
+ const geojsonConfig = this.getGeoJSONConfig();
67770
+ if (geojsonConfig.data) {
67771
+ this.applyGeoJSONData(geojsonConfig.data);
67772
+ return;
67773
+ }
67774
+ if (((_a2 = geojsonConfig.request) == null ? void 0 : _a2.url) || this.config.url) {
67775
+ await this.refresh();
67776
+ return;
67777
+ }
67778
+ source.clear();
67779
+ this.originalFeatures = [];
67780
+ }
67781
+ getVectorSource() {
67782
+ if (this.vectorSource) {
67783
+ return this.vectorSource;
67784
+ }
67785
+ if (!this.layer) {
67786
+ return null;
67787
+ }
67788
+ const source = this.layer.getSource();
67789
+ this.vectorSource = source || null;
67790
+ return this.vectorSource;
67791
+ }
67792
+ applyGeoJSONData(data) {
67793
+ const source = this.getVectorSource();
67794
+ if (!source)
67795
+ return;
67796
+ const features2 = this.readFeaturesFromData(data);
67797
+ source.clear();
67798
+ source.addFeatures(features2);
67799
+ this.originalFeatures = [...features2];
67800
+ if (this.getEnabledFilters().length > 0) {
67801
+ this.applyFilters();
67802
+ }
67803
+ }
67804
+ readFeaturesFromData(data) {
67685
67805
  const format2 = new GeoJSON$2();
67686
- const mapProjection = ((_a2 = this.map) == null ? void 0 : _a2.getView().getProjection().getCode()) || "EPSG:4326";
67687
- const dataProjection = this.config.projection || "EPSG:4326";
67688
- if (this.config.data) {
67689
- const features2 = format2.readFeatures(this.config.data, {
67690
- dataProjection,
67691
- featureProjection: mapProjection
67692
- });
67693
- this.originalFeatures = features2;
67694
- return new VectorSource$1({ features: features2 });
67695
- } else if (this.config.url) {
67696
- const source = new VectorSource$1({
67697
- url: this.config.url,
67698
- format: new GeoJSON$2({
67699
- dataProjection,
67700
- featureProjection: mapProjection
67701
- })
67702
- });
67703
- source.on("featuresloadend", () => {
67704
- this.originalFeatures = source.getFeatures();
67806
+ return format2.readFeatures(this.normalizeGeoJSONData(data), {
67807
+ dataProjection: this.getDataProjection(),
67808
+ featureProjection: this.getMapProjection()
67809
+ });
67810
+ }
67811
+ normalizeGeoJSONData(data) {
67812
+ if (typeof data === "string") {
67813
+ const trimmed = data.trim();
67814
+ if (!trimmed) {
67815
+ return { type: "FeatureCollection", features: [] };
67816
+ }
67817
+ try {
67818
+ return this.normalizeGeoJSONData(JSON.parse(trimmed));
67819
+ } catch (error2) {
67820
+ throw new Error("GeoJSON 字符串解析失败");
67821
+ }
67822
+ }
67823
+ if (Array.isArray(data)) {
67824
+ return {
67825
+ type: "FeatureCollection",
67826
+ features: data
67827
+ };
67828
+ }
67829
+ if (!data || typeof data !== "object") {
67830
+ return {
67831
+ type: "FeatureCollection",
67832
+ features: []
67833
+ };
67834
+ }
67835
+ if (data.type === "FeatureCollection") {
67836
+ return data;
67837
+ }
67838
+ if (data.type === "Feature") {
67839
+ return {
67840
+ type: "FeatureCollection",
67841
+ features: [data]
67842
+ };
67843
+ }
67844
+ if (Array.isArray(data.features)) {
67845
+ return {
67846
+ type: "FeatureCollection",
67847
+ features: data.features
67848
+ };
67849
+ }
67850
+ return data;
67851
+ }
67852
+ getNestedValue(target, path2) {
67853
+ if (!path2) {
67854
+ return target;
67855
+ }
67856
+ const keys2 = path2.replace(/\[(\d+)\]/g, ".$1").split(".").filter(Boolean);
67857
+ return keys2.reduce(
67858
+ (current, key) => current !== null && current !== void 0 ? current[key] : void 0,
67859
+ target
67860
+ );
67861
+ }
67862
+ buildRequestContext(overrides) {
67863
+ const requestConfig = this.getGeoJSONConfig().request;
67864
+ return {
67865
+ config: this.config,
67866
+ params: {
67867
+ ...(requestConfig == null ? void 0 : requestConfig.params) || {},
67868
+ ...(overrides == null ? void 0 : overrides.params) || {}
67869
+ },
67870
+ body: (overrides == null ? void 0 : overrides.body) ?? (requestConfig == null ? void 0 : requestConfig.body),
67871
+ map: this.map || void 0
67872
+ };
67873
+ }
67874
+ buildExtentPayload(refreshConfig) {
67875
+ if (!(refreshConfig == null ? void 0 : refreshConfig.useExtent) || !this.map) {
67876
+ return {};
67877
+ }
67878
+ const size2 = this.map.getSize();
67879
+ if (!size2) {
67880
+ return {};
67881
+ }
67882
+ const view = this.map.getView();
67883
+ const sourceProjection = view.getProjection().getCode();
67884
+ const targetProjection = refreshConfig.extentProjection || this.getDataProjection();
67885
+ const rawExtent = view.calculateExtent(size2);
67886
+ const extent3 = sourceProjection === targetProjection ? rawExtent : transformExtent(rawExtent, sourceProjection, targetProjection);
67887
+ const extentValue = extent3.join(",");
67888
+ const extentParamName = refreshConfig.extentParamName || "bbox";
67889
+ if (refreshConfig.extentTarget === "body") {
67890
+ return {
67891
+ body: {
67892
+ [extentParamName]: extentValue
67893
+ }
67894
+ };
67895
+ }
67896
+ return {
67897
+ params: {
67898
+ [extentParamName]: extentValue
67899
+ }
67900
+ };
67901
+ }
67902
+ createRequestUrl(url, params, method) {
67903
+ const requestUrl = new URL(url, window.location.origin);
67904
+ Object.entries(params).forEach(([key, value]) => {
67905
+ if (value === void 0 || value === null || method !== "GET") {
67906
+ return;
67907
+ }
67908
+ if (Array.isArray(value)) {
67909
+ value.forEach(
67910
+ (item) => requestUrl.searchParams.append(key, String(item))
67911
+ );
67912
+ return;
67913
+ }
67914
+ requestUrl.searchParams.set(key, String(value));
67915
+ });
67916
+ return requestUrl.toString();
67917
+ }
67918
+ async refresh(overrides) {
67919
+ const geojsonConfig = this.getGeoJSONConfig();
67920
+ const requestConfig = geojsonConfig.request;
67921
+ if (!(requestConfig == null ? void 0 : requestConfig.url)) {
67922
+ if (geojsonConfig.data) {
67923
+ this.applyGeoJSONData(geojsonConfig.data);
67924
+ }
67925
+ return;
67926
+ }
67927
+ if (this.isRefreshing) {
67928
+ return;
67929
+ }
67930
+ this.isRefreshing = true;
67931
+ try {
67932
+ const refreshPayload = this.buildExtentPayload(geojsonConfig.refresh);
67933
+ const context = this.buildRequestContext({
67934
+ params: {
67935
+ ...refreshPayload.params || {},
67936
+ ...(overrides == null ? void 0 : overrides.params) || {}
67937
+ },
67938
+ 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) ? {
67939
+ ...requestConfig.body,
67940
+ ...refreshPayload.body,
67941
+ ...overrides == null ? void 0 : overrides.body
67942
+ } : (overrides == null ? void 0 : overrides.body) ?? refreshPayload.body ?? requestConfig.body
67943
+ });
67944
+ let request = {
67945
+ url: requestConfig.url,
67946
+ method: requestConfig.method || "GET",
67947
+ headers: { ...requestConfig.headers || {} },
67948
+ params: { ...context.params },
67949
+ body: context.body
67950
+ };
67951
+ if (requestConfig.requestInterceptor) {
67952
+ const intercepted = await requestConfig.requestInterceptor(
67953
+ request,
67954
+ context
67955
+ );
67956
+ request = {
67957
+ ...request,
67958
+ ...intercepted || {},
67959
+ headers: {
67960
+ ...request.headers,
67961
+ ...(intercepted == null ? void 0 : intercepted.headers) || {}
67962
+ },
67963
+ params: {
67964
+ ...request.params,
67965
+ ...(intercepted == null ? void 0 : intercepted.params) || {}
67966
+ }
67967
+ };
67968
+ }
67969
+ const requestUrl = this.createRequestUrl(
67970
+ request.url,
67971
+ request.params,
67972
+ request.method
67973
+ );
67974
+ const response = await fetch(requestUrl, {
67975
+ method: request.method,
67976
+ headers: {
67977
+ "Content-Type": request.method === "GET" ? void 0 : "application/json;charset=UTF-8",
67978
+ ...request.headers
67979
+ },
67980
+ body: request.method === "GET" || request.body === void 0 ? void 0 : typeof request.body === "string" ? request.body : JSON.stringify(request.body)
67705
67981
  });
67706
- return source;
67707
- } else {
67708
- return new VectorSource$1();
67982
+ if (!response.ok) {
67983
+ throw new Error(`GeoJSON 请求失败: ${response.status}`);
67984
+ }
67985
+ let responseData;
67986
+ const contentType = response.headers.get("content-type") || "";
67987
+ if (contentType.includes("application/json")) {
67988
+ responseData = await response.json();
67989
+ } else {
67990
+ responseData = await response.text();
67991
+ }
67992
+ if (requestConfig.responseInterceptor) {
67993
+ responseData = await requestConfig.responseInterceptor(
67994
+ responseData,
67995
+ context
67996
+ );
67997
+ }
67998
+ if (requestConfig.responseParser) {
67999
+ responseData = await requestConfig.responseParser(
68000
+ responseData,
68001
+ context
68002
+ );
68003
+ } else {
68004
+ responseData = this.getNestedValue(
68005
+ responseData,
68006
+ requestConfig.dataPath || geojsonConfig.dataPath
68007
+ );
68008
+ }
68009
+ this.applyGeoJSONData(responseData);
68010
+ } catch (error2) {
68011
+ if (geojsonConfig.clearOnError) {
68012
+ const source = this.getVectorSource();
68013
+ source == null ? void 0 : source.clear();
68014
+ this.originalFeatures = [];
68015
+ }
68016
+ throw error2;
68017
+ } finally {
68018
+ this.isRefreshing = false;
67709
68019
  }
67710
68020
  }
68021
+ updateRequestParams(params) {
68022
+ var _a2;
68023
+ const currentGeoJSONConfig = this.getGeoJSONConfig();
68024
+ this.config.geojsonConfig = {
68025
+ ...currentGeoJSONConfig,
68026
+ request: {
68027
+ ...currentGeoJSONConfig.request || {},
68028
+ params: {
68029
+ ...((_a2 = currentGeoJSONConfig.request) == null ? void 0 : _a2.params) || {},
68030
+ ...params
68031
+ }
68032
+ }
68033
+ };
68034
+ void this.refresh();
68035
+ }
68036
+ scheduleRefresh() {
68037
+ const refreshConfig = this.getGeoJSONConfig().refresh;
68038
+ const debounce2 = (refreshConfig == null ? void 0 : refreshConfig.debounce) ?? 300;
68039
+ if (this.refreshDebounceTimer) {
68040
+ clearTimeout(this.refreshDebounceTimer);
68041
+ }
68042
+ this.refreshDebounceTimer = setTimeout(() => {
68043
+ void this.refresh();
68044
+ }, debounce2);
68045
+ }
68046
+ setupRefreshBehavior() {
68047
+ this.clearRefreshBehavior();
68048
+ const refreshConfig = this.getGeoJSONConfig().refresh;
68049
+ if (!refreshConfig) {
68050
+ return;
68051
+ }
68052
+ const enabled = refreshConfig.enabled ?? true;
68053
+ if (!enabled) {
68054
+ return;
68055
+ }
68056
+ if (refreshConfig.interval && refreshConfig.interval > 0) {
68057
+ this.refreshTimer = setInterval(() => {
68058
+ void this.refresh();
68059
+ }, refreshConfig.interval);
68060
+ }
68061
+ if (this.map && (refreshConfig.onMoveEnd || refreshConfig.onZoomEnd)) {
68062
+ this.lastKnownZoom = this.map.getView().getZoom();
68063
+ this.moveEndListener = () => {
68064
+ var _a2;
68065
+ const currentZoom = (_a2 = this.map) == null ? void 0 : _a2.getView().getZoom();
68066
+ const zoomChanged = currentZoom !== this.lastKnownZoom;
68067
+ this.lastKnownZoom = currentZoom;
68068
+ if (zoomChanged && refreshConfig.onZoomEnd) {
68069
+ this.scheduleRefresh();
68070
+ return;
68071
+ }
68072
+ if (!zoomChanged && refreshConfig.onMoveEnd) {
68073
+ this.scheduleRefresh();
68074
+ return;
68075
+ }
68076
+ if (refreshConfig.onMoveEnd && refreshConfig.onZoomEnd) {
68077
+ this.scheduleRefresh();
68078
+ }
68079
+ };
68080
+ this.map.on("moveend", this.moveEndListener);
68081
+ }
68082
+ }
68083
+ clearRefreshBehavior() {
68084
+ if (this.refreshTimer) {
68085
+ clearInterval(this.refreshTimer);
68086
+ this.refreshTimer = null;
68087
+ }
68088
+ if (this.refreshDebounceTimer) {
68089
+ clearTimeout(this.refreshDebounceTimer);
68090
+ this.refreshDebounceTimer = null;
68091
+ }
68092
+ if (this.map && this.moveEndListener) {
68093
+ this.map.un("moveend", this.moveEndListener);
68094
+ }
68095
+ this.moveEndListener = null;
68096
+ }
67711
68097
  /**
67712
68098
  * 创建样式函数
67713
68099
  */
@@ -68110,7 +68496,6 @@ class GeoJSONLayerHandler extends BaseLayer2 {
68110
68496
  * 应用过滤器(实现基类的抽象方法)
68111
68497
  */
68112
68498
  applyFilters() {
68113
- debugger;
68114
68499
  const layer2 = this.getLayer();
68115
68500
  const source = layer2.getSource();
68116
68501
  if (!source)
@@ -68366,6 +68751,29 @@ class GeoJSONLayerHandler extends BaseLayer2 {
68366
68751
  clearAllFeatureFilters() {
68367
68752
  this.clearAllFilters();
68368
68753
  }
68754
+ updateConfig(newConfig) {
68755
+ super.updateConfig(newConfig);
68756
+ if (this.layer) {
68757
+ this.layer.setStyle(
68758
+ this.createStyleFunction()
68759
+ );
68760
+ }
68761
+ this.setupRefreshBehavior();
68762
+ 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) {
68763
+ void this.initializeSource();
68764
+ }
68765
+ }
68766
+ setMap(map2) {
68767
+ super.setMap(map2);
68768
+ if (this.layer) {
68769
+ this.setupRefreshBehavior();
68770
+ }
68771
+ }
68772
+ destroy() {
68773
+ this.clearRefreshBehavior();
68774
+ this.vectorSource = null;
68775
+ super.destroy();
68776
+ }
68369
68777
  }
68370
68778
  class KMLLayerHandler extends BaseLayer2 {
68371
68779
  constructor(config, map2) {
@@ -333369,6 +333777,72 @@ class LayerManager {
333369
333777
  getLayerHandler(layerId) {
333370
333778
  return this.layerHandlers.get(layerId);
333371
333779
  }
333780
+ async refreshLayer(layerId, options) {
333781
+ try {
333782
+ const config = this.getLayerConfig(layerId);
333783
+ if (!config) {
333784
+ return false;
333785
+ }
333786
+ if (!this.layerHandlers.has(layerId) && config.visible) {
333787
+ const loaded = await this.loadLayerOnDemand(layerId);
333788
+ if (!loaded) {
333789
+ return false;
333790
+ }
333791
+ }
333792
+ const handler = this.layerHandlers.get(layerId);
333793
+ if (!(handler == null ? void 0 : handler.refresh)) {
333794
+ return false;
333795
+ }
333796
+ await handler.refresh(options);
333797
+ return true;
333798
+ } catch (error2) {
333799
+ console.error("刷新图层失败:", error2);
333800
+ return false;
333801
+ }
333802
+ }
333803
+ updateLayerRequestParams(layerId, params) {
333804
+ var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i2, _j, _k, _l, _m;
333805
+ try {
333806
+ const config = this.getLayerConfig(layerId);
333807
+ if (!config) {
333808
+ return false;
333809
+ }
333810
+ const nextConfig = {
333811
+ ...config,
333812
+ params: {
333813
+ ...config.params || {},
333814
+ ...params
333815
+ },
333816
+ geojsonConfig: {
333817
+ ...config.geojsonConfig || ((_b2 = (_a2 = config.config) == null ? void 0 : _a2.vector) == null ? void 0 : _b2.geojson) || ((_c2 = config.config) == null ? void 0 : _c2.geojson) || {},
333818
+ request: {
333819
+ ...((_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) || {},
333820
+ params: {
333821
+ ...((_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) || {},
333822
+ ...params
333823
+ }
333824
+ }
333825
+ }
333826
+ };
333827
+ if (this.layerConfigs.has(layerId)) {
333828
+ this.layerConfigs.set(layerId, nextConfig);
333829
+ }
333830
+ if (this.pendingLayerConfigs.has(layerId)) {
333831
+ this.pendingLayerConfigs.set(layerId, nextConfig);
333832
+ }
333833
+ const handler = this.layerHandlers.get(layerId);
333834
+ (_m = handler == null ? void 0 : handler.updateRequestParams) == null ? void 0 : _m.call(handler, params);
333835
+ this.saveLayerConfigs();
333836
+ this.eventBus.emit("layer-config-updated", {
333837
+ layerId,
333838
+ config: nextConfig
333839
+ });
333840
+ return true;
333841
+ } catch (error2) {
333842
+ console.error("更新图层请求参数失败:", error2);
333843
+ return false;
333844
+ }
333845
+ }
333372
333846
  /**
333373
333847
  * 设置底图图层ID列表(用于底图互斥判断)
333374
333848
  */
@@ -333692,12 +334166,19 @@ class LayerManager {
333692
334166
  updateLayerConfig(layerId, newConfig) {
333693
334167
  try {
333694
334168
  const handler = this.layerHandlers.get(layerId);
333695
- const config = this.layerConfigs.get(layerId);
333696
- if (handler && config) {
334169
+ const config = this.layerConfigs.get(layerId) || this.pendingLayerConfigs.get(layerId);
334170
+ if (config) {
333697
334171
  const updatedConfig = { ...config, ...newConfig };
333698
- this.layerConfigs.set(layerId, updatedConfig);
333699
- handler.updateConfig(newConfig);
333700
- if (newConfig.style || newConfig.customCss !== void 0) {
334172
+ if (this.layerConfigs.has(layerId)) {
334173
+ this.layerConfigs.set(layerId, updatedConfig);
334174
+ }
334175
+ if (this.pendingLayerConfigs.has(layerId)) {
334176
+ this.pendingLayerConfigs.set(layerId, updatedConfig);
334177
+ }
334178
+ if (handler) {
334179
+ handler.updateConfig(newConfig);
334180
+ }
334181
+ if (handler && (newConfig.style || newConfig.customCss !== void 0)) {
333701
334182
  if ("updateLayerStyles" in handler) {
333702
334183
  handler.updateLayerStyles(
333703
334184
  updatedConfig.style,
@@ -336901,6 +337382,10 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
336901
337382
  var _a2;
336902
337383
  return (_a2 = mapManager.value) == null ? void 0 : _a2.getEventManager();
336903
337384
  },
337385
+ clearAll: () => {
337386
+ var _a2;
337387
+ (_a2 = mapManager.value) == null ? void 0 : _a2.clearAll();
337388
+ },
336904
337389
  updateMapConfig,
336905
337390
  startCoordinatePick,
336906
337391
  stopCoordinatePick,
@@ -336930,19 +337415,19 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
336930
337415
  }
336931
337416
  });
336932
337417
  const defaultComponents = {
336933
- measurement: () => import("./MeasurementDialog-7c08ba58.mjs"),
336934
- basemap: () => import("./BasemapPanel-a8d7373d.mjs"),
336935
- print: () => import("./MapPrintDialog-97054260.mjs"),
336936
- "layer-panel": () => import("./LayerPanel-c716b7cc.mjs"),
336937
- coordinate: () => import("./CoordinateLocationDialog-274aff1a.mjs"),
336938
- "region-navigation": () => import("./RegionNavigationDialog-4b7b4e5f.mjs"),
336939
- "my-markers": () => import("./MyMarkersDialog-89bd594e.mjs"),
336940
- "view-bookmarks": () => import("./ViewBookmarksDialog-7ee33d4e.mjs"),
336941
- "map-drawing": () => import("./index-3699244d.mjs"),
336942
- "filter-panel": () => import("./FilterPanel-ccdaaac3.mjs"),
336943
- "swipe-compare": () => import("./SwipeCompareDialog-2b89b65e.mjs"),
336944
- "split-compare": () => import("./SplitCompareDialog-b51b55c1.mjs"),
336945
- "quad-compare": () => import("./QuadCompareDialog-78dd2cf6.mjs")
337418
+ measurement: () => import("./MeasurementDialog-4fd11413.mjs"),
337419
+ basemap: () => import("./BasemapPanel-7664fc20.mjs"),
337420
+ print: () => import("./MapPrintDialog-0cf04cae.mjs"),
337421
+ "layer-panel": () => import("./LayerPanel-354b6ac7.mjs"),
337422
+ coordinate: () => import("./CoordinateLocationDialog-f505c006.mjs"),
337423
+ "region-navigation": () => import("./RegionNavigationDialog-1edd078f.mjs"),
337424
+ "my-markers": () => import("./MyMarkersDialog-f413337c.mjs"),
337425
+ "view-bookmarks": () => import("./ViewBookmarksDialog-9873fb3c.mjs"),
337426
+ "map-drawing": () => import("./index-a30f4100.mjs"),
337427
+ "filter-panel": () => import("./FilterPanel-4cfbbfeb.mjs"),
337428
+ "swipe-compare": () => import("./SwipeCompareDialog-e2c28122.mjs"),
337429
+ "split-compare": () => import("./SplitCompareDialog-3fe419de.mjs"),
337430
+ "quad-compare": () => import("./QuadCompareDialog-176a8178.mjs")
336946
337431
  };
336947
337432
  const _DialogRegistry = class _DialogRegistry {
336948
337433
  constructor() {
@@ -351970,7 +352455,7 @@ function(t3) {
351970
352455
  */
351971
352456
  function(t3) {
351972
352457
  function e8() {
351973
- return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-e3be4489.mjs")).catch(function(t4) {
352458
+ return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-b7728855.mjs")).catch(function(t4) {
351974
352459
  return Promise.reject(new Error("Could not load canvg: " + t4));
351975
352460
  }).then(function(t4) {
351976
352461
  return t4.default ? t4.default : t4;
@@ -366026,6 +366511,22 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
366026
366511
  }
366027
366512
  return false;
366028
366513
  },
366514
+ refreshLayer: (layerId, options) => {
366515
+ var _a2;
366516
+ const layerManager = (_a2 = mapContainerRef.value) == null ? void 0 : _a2.getLayerManager();
366517
+ if (layerManager) {
366518
+ return layerManager.refreshLayer(layerId, options);
366519
+ }
366520
+ return false;
366521
+ },
366522
+ updateLayerRequestParams: (layerId, params) => {
366523
+ var _a2;
366524
+ const layerManager = (_a2 = mapContainerRef.value) == null ? void 0 : _a2.getLayerManager();
366525
+ if (layerManager) {
366526
+ return layerManager.updateLayerRequestParams(layerId, params);
366527
+ }
366528
+ return false;
366529
+ },
366029
366530
  getAllLayerConfigs: () => {
366030
366531
  var _a2;
366031
366532
  const layerManager = (_a2 = mapContainerRef.value) == null ? void 0 : _a2.getLayerManager();
@@ -366328,7 +366829,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
366328
366829
  };
366329
366830
  }
366330
366831
  });
366331
- const OlMap = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-d71e468f"]]);
366832
+ const OlMap = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-888f37cb"]]);
366332
366833
  const Property = {
366333
366834
  ACCURACY: "accuracy",
366334
366835
  ACCURACY_GEOMETRY: "accuracyGeometry",