vue-openlayers-plugin 1.0.53 → 1.0.55

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.
@@ -83210,6 +83210,8 @@ class GeoJSONLayerHandler extends BaseLayer$2 {
83210
83210
  constructor(config, map2) {
83211
83211
  super(config, map2);
83212
83212
  __publicField(this, "styleConfig");
83213
+ __publicField(this, "currentFilters", []);
83214
+ __publicField(this, "originalFeatures", []);
83213
83215
  }
83214
83216
  createLayer() {
83215
83217
  var _a3, _b3, _c2;
@@ -83235,12 +83237,7 @@ class GeoJSONLayerHandler extends BaseLayer$2 {
83235
83237
  const features2 = format2.readFeatures(this.config.data, {
83236
83238
  featureProjection: mapProjection
83237
83239
  });
83238
- if (features2 && features2.length > 0) {
83239
- try {
83240
- console.log("[GeoJSONLayerHandler] 示例要素属性:", features2[0].getProperties());
83241
- } catch (e8) {
83242
- }
83243
- }
83240
+ this.originalFeatures = features2;
83244
83241
  return new VectorSource$2({ features: features2 });
83245
83242
  } else if (this.config.url) {
83246
83243
  const source = new VectorSource$2({
@@ -83262,6 +83259,9 @@ class GeoJSONLayerHandler extends BaseLayer$2 {
83262
83259
  source.on("addfeature", logOnce);
83263
83260
  } catch (e8) {
83264
83261
  }
83262
+ source.on("addfeature", () => {
83263
+ this.originalFeatures = source.getFeatures();
83264
+ });
83265
83265
  return source;
83266
83266
  } else {
83267
83267
  return new VectorSource$2();
@@ -83419,16 +83419,20 @@ class GeoJSONLayerHandler extends BaseLayer$2 {
83419
83419
  var _a3;
83420
83420
  const layer2 = this.getLayer();
83421
83421
  const source = layer2.getSource();
83422
- if (source) {
83423
- const format2 = new GeoJSON$4();
83424
- const mapProjection = ((_a3 = this.map) == null ? void 0 : _a3.getView().getProjection().getCode()) || "EPSG:4326";
83425
- const olFeatures = format2.readFeatures({
83426
- type: "FeatureCollection",
83427
- features: features2
83428
- }, {
83429
- featureProjection: mapProjection
83430
- });
83431
- source.addFeatures(olFeatures);
83422
+ if (!source)
83423
+ return;
83424
+ const format2 = new GeoJSON$4();
83425
+ const mapProjection = ((_a3 = this.map) == null ? void 0 : _a3.getView().getProjection().getCode()) || "EPSG:4326";
83426
+ const olFeatures = format2.readFeatures({
83427
+ type: "FeatureCollection",
83428
+ features: features2
83429
+ }, {
83430
+ featureProjection: mapProjection
83431
+ });
83432
+ source.addFeatures(olFeatures);
83433
+ this.originalFeatures.push(...olFeatures);
83434
+ if (this.getEnabledFilters().length > 0) {
83435
+ this.applyFilters();
83432
83436
  }
83433
83437
  }
83434
83438
  /**
@@ -83437,9 +83441,10 @@ class GeoJSONLayerHandler extends BaseLayer$2 {
83437
83441
  clearFeatures() {
83438
83442
  const layer2 = this.getLayer();
83439
83443
  const source = layer2.getSource();
83440
- if (source) {
83441
- source.clear();
83442
- }
83444
+ if (!source)
83445
+ return;
83446
+ source.clear();
83447
+ this.originalFeatures = [];
83443
83448
  }
83444
83449
  /**
83445
83450
  * 获取要素数量
@@ -83675,20 +83680,22 @@ class GeoJSONLayerHandler extends BaseLayer$2 {
83675
83680
  if (!source)
83676
83681
  return;
83677
83682
  const enabledFilters = this.getEnabledFilters();
83678
- const features2 = source.getFeatures();
83683
+ if (this.originalFeatures.length === 0) {
83684
+ this.originalFeatures = source.getFeatures();
83685
+ }
83679
83686
  if (enabledFilters.length === 0) {
83680
- features2.forEach((feature2) => {
83681
- feature2.setStyle(void 0);
83682
- });
83687
+ source.clear();
83688
+ source.addFeatures(this.originalFeatures);
83683
83689
  return;
83684
83690
  }
83685
83691
  const logic = this.getFilterLogic();
83686
- features2.forEach((feature2) => {
83692
+ const filtered = this.originalFeatures.filter((feature2) => {
83687
83693
  const results = enabledFilters.map((filter2) => this.checkFeatureAgainstFilter(feature2, filter2));
83688
- const visible = this.combineByLogic(results);
83689
- feature2.setStyle(visible ? void 0 : new Style$3({}));
83694
+ return this.combineByLogic(results);
83690
83695
  });
83691
- console.log(`GeoJSON图层应用 ${enabledFilters.length} 个过滤器,组合逻辑为 ${logic}`);
83696
+ source.clear();
83697
+ source.addFeatures(filtered);
83698
+ console.log(`GeoJSON图层应用过滤器(${logic}),显示 ${filtered.length}/${this.originalFeatures.length} 个要素`);
83692
83699
  }
83693
83700
  /**
83694
83701
  * 检查要素是否符合过滤器条件
@@ -490520,7 +490527,7 @@ function(t3) {
490520
490527
  */
490521
490528
  function(t3) {
490522
490529
  function e8() {
490523
- return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-49a6cfdb.mjs")).catch(function(t4) {
490530
+ return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-f8a4f576.mjs")).catch(function(t4) {
490524
490531
  return Promise.reject(new Error("Could not load canvg: " + t4));
490525
490532
  }).then(function(t4) {
490526
490533
  return t4.default ? t4.default : t4;
@@ -1,4 +1,4 @@
1
- import { c as commonjsGlobal, R as RGBColor, r as requestAnimationFrame, _ as _asyncToGenerator, a as _, p as processCanvasRGBA, b as _defineProperty } from "./index-a3727619.mjs";
1
+ import { c as commonjsGlobal, R as RGBColor, r as requestAnimationFrame, _ as _asyncToGenerator, a as _, p as processCanvasRGBA, b as _defineProperty } from "./index-317764c1.mjs";
2
2
  import "vue";
3
3
  import "ol";
4
4
  var check = function(it) {
package/lib/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { z, B, d, C, D, a2, a3, u, y, a7, a6, I, H, Z, $, L, J, K, a4, h, M, a0, a1, X, Y, U, W, Q, S, P, A, F, G, N, O, a8, e, T, E, V, x, j, o, t, f, k, g, w, q, m, n, a5, i, s, l, v } from "./index-a3727619.mjs";
1
+ import { z, B, d, C, D, a2, a3, u, y, a7, a6, I, H, Z, $, L, J, K, a4, h, M, a0, a1, X, Y, U, W, Q, S, P, A, F, G, N, O, a8, e, T, E, V, x, j, o, t, f, k, g, w, q, m, n, a5, i, s, l, v } from "./index-317764c1.mjs";
2
2
  import "vue";
3
3
  import "ol";
4
4
  export {
package/lib/index.umd.js CHANGED
@@ -83719,6 +83719,8 @@ ${this.attributes_.map(
83719
83719
  constructor(config, map2) {
83720
83720
  super(config, map2);
83721
83721
  __publicField(this, "styleConfig");
83722
+ __publicField(this, "currentFilters", []);
83723
+ __publicField(this, "originalFeatures", []);
83722
83724
  }
83723
83725
  createLayer() {
83724
83726
  var _a3, _b3, _c2;
@@ -83744,12 +83746,7 @@ ${this.attributes_.map(
83744
83746
  const features2 = format2.readFeatures(this.config.data, {
83745
83747
  featureProjection: mapProjection
83746
83748
  });
83747
- if (features2 && features2.length > 0) {
83748
- try {
83749
- console.log("[GeoJSONLayerHandler] 示例要素属性:", features2[0].getProperties());
83750
- } catch (e3) {
83751
- }
83752
- }
83749
+ this.originalFeatures = features2;
83753
83750
  return new VectorSource$2({ features: features2 });
83754
83751
  } else if (this.config.url) {
83755
83752
  const source = new VectorSource$2({
@@ -83771,6 +83768,9 @@ ${this.attributes_.map(
83771
83768
  source.on("addfeature", logOnce);
83772
83769
  } catch (e3) {
83773
83770
  }
83771
+ source.on("addfeature", () => {
83772
+ this.originalFeatures = source.getFeatures();
83773
+ });
83774
83774
  return source;
83775
83775
  } else {
83776
83776
  return new VectorSource$2();
@@ -83928,16 +83928,20 @@ ${this.attributes_.map(
83928
83928
  var _a3;
83929
83929
  const layer2 = this.getLayer();
83930
83930
  const source = layer2.getSource();
83931
- if (source) {
83932
- const format2 = new GeoJSON$4();
83933
- const mapProjection = ((_a3 = this.map) == null ? void 0 : _a3.getView().getProjection().getCode()) || "EPSG:4326";
83934
- const olFeatures = format2.readFeatures({
83935
- type: "FeatureCollection",
83936
- features: features2
83937
- }, {
83938
- featureProjection: mapProjection
83939
- });
83940
- source.addFeatures(olFeatures);
83931
+ if (!source)
83932
+ return;
83933
+ const format2 = new GeoJSON$4();
83934
+ const mapProjection = ((_a3 = this.map) == null ? void 0 : _a3.getView().getProjection().getCode()) || "EPSG:4326";
83935
+ const olFeatures = format2.readFeatures({
83936
+ type: "FeatureCollection",
83937
+ features: features2
83938
+ }, {
83939
+ featureProjection: mapProjection
83940
+ });
83941
+ source.addFeatures(olFeatures);
83942
+ this.originalFeatures.push(...olFeatures);
83943
+ if (this.getEnabledFilters().length > 0) {
83944
+ this.applyFilters();
83941
83945
  }
83942
83946
  }
83943
83947
  /**
@@ -83946,9 +83950,10 @@ ${this.attributes_.map(
83946
83950
  clearFeatures() {
83947
83951
  const layer2 = this.getLayer();
83948
83952
  const source = layer2.getSource();
83949
- if (source) {
83950
- source.clear();
83951
- }
83953
+ if (!source)
83954
+ return;
83955
+ source.clear();
83956
+ this.originalFeatures = [];
83952
83957
  }
83953
83958
  /**
83954
83959
  * 获取要素数量
@@ -84184,20 +84189,22 @@ ${this.attributes_.map(
84184
84189
  if (!source)
84185
84190
  return;
84186
84191
  const enabledFilters = this.getEnabledFilters();
84187
- const features2 = source.getFeatures();
84192
+ if (this.originalFeatures.length === 0) {
84193
+ this.originalFeatures = source.getFeatures();
84194
+ }
84188
84195
  if (enabledFilters.length === 0) {
84189
- features2.forEach((feature2) => {
84190
- feature2.setStyle(void 0);
84191
- });
84196
+ source.clear();
84197
+ source.addFeatures(this.originalFeatures);
84192
84198
  return;
84193
84199
  }
84194
84200
  const logic = this.getFilterLogic();
84195
- features2.forEach((feature2) => {
84201
+ const filtered = this.originalFeatures.filter((feature2) => {
84196
84202
  const results = enabledFilters.map((filter2) => this.checkFeatureAgainstFilter(feature2, filter2));
84197
- const visible = this.combineByLogic(results);
84198
- feature2.setStyle(visible ? void 0 : new Style$3({}));
84203
+ return this.combineByLogic(results);
84199
84204
  });
84200
- console.log(`GeoJSON图层应用 ${enabledFilters.length} 个过滤器,组合逻辑为 ${logic}`);
84205
+ source.clear();
84206
+ source.addFeatures(filtered);
84207
+ console.log(`GeoJSON图层应用过滤器(${logic}),显示 ${filtered.length}/${this.originalFeatures.length} 个要素`);
84201
84208
  }
84202
84209
  /**
84203
84210
  * 检查要素是否符合过滤器条件
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-openlayers-plugin",
3
- "version": "1.0.53",
3
+ "version": "1.0.55",
4
4
  "description": "A Vue 3 plugin for OpenLayers with custom components and utilities",
5
5
  "main": "lib/index.umd.js",
6
6
  "module": "lib/index.esm.js",
@@ -10,6 +10,8 @@ import { IStyleConfigMap } from '../styles';
10
10
  */
11
11
  export declare class GeoJSONLayerHandler extends BaseLayer {
12
12
  private styleConfig?;
13
+ private currentFilters;
14
+ private originalFeatures;
13
15
  constructor(config: LayerConfig, map?: OLMap);
14
16
  createLayer(): Layer<VectorSource>;
15
17
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"GeoJSONLayerHandler.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CustomOpenlayer/utils/layers/GeoJSONLayerHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAM5C,OAAO,EAAE,GAAG,IAAI,KAAK,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,KAAK,EAAE,WAAW,EAA0D,MAAM,aAAa,CAAC;AAEvG,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,SAAS;IAChD,OAAO,CAAC,WAAW,CAAC,CAAkB;gBAE1B,MAAM,EAAE,WAAW,EAAE,GAAG,CAAC,EAAE,KAAK;IAI5C,WAAW,IAAI,KAAK,CAAC,YAAY,CAAC;IAclC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAyB1B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAQ3B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA4DxB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAmD1B;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,GAAG,EAAE,GAAG,IAAI;IAiBlC;;OAEG;IACH,aAAa,IAAI,IAAI;IAQrB;;OAEG;IACH,eAAe,IA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