ol 10.3.2-dev.1737449234314 → 10.3.2-dev.1737837749372

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.
@@ -31,6 +31,7 @@ export function isType(type: number, expected: number): boolean;
31
31
  * @property {Set<string>} properties Properties referenced with the 'get' operator.
32
32
  * @property {boolean} featureId The style uses the feature id.
33
33
  * @property {boolean} geometryType The style uses the feature geometry type.
34
+ * @property {boolean} mapState The style uses the map state (view state or time elapsed).
34
35
  */
35
36
  /**
36
37
  * @return {ParsingContext} A new parsing context.
@@ -107,6 +108,10 @@ export type ParsingContext = {
107
108
  * The style uses the feature geometry type.
108
109
  */
109
110
  geometryType: boolean;
111
+ /**
112
+ * The style uses the map state (view state or time elapsed).
113
+ */
114
+ mapState: boolean;
110
115
  };
111
116
  export type EncodedExpression = LiteralValue | any[];
112
117
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["expression.js"],"names":[],"mappings":"AAoKA;;;;GAIG;AACH,+BAHW,MAAM,GACL,MAAM,CAgBjB;AAED;;;;GAIG;AACH,oCAJW,MAAM,YACN,MAAM,GACL,OAAO,CAIlB;AAED;;;;GAIG;AACH,sCAJW,MAAM,aACN,MAAM,GACL,OAAO,CAIlB;AAED;;;;GAIG;AACH,6BAJW,MAAM,YACN,MAAM,GACL,OAAO,CAIlB;AAmCD;;GAEG;AAEH;;;;;;GAMG;AAEH;;GAEG;AACH,qCAFY,cAAc,CASzB;AAED;;GAEG;AAEH;;;;;GAKG;AACH,+BALW,iBAAiB,gBACjB,MAAM,WACN,cAAc,GACb,UAAU,CA6FrB;AAuoBD;;;;GAIG;AACH,8CAHW,OAAO,qBAAqB,EAAE,OAAO,GAAC,OAAO,sBAAsB,EAAE,OAAO,GAC3E,OAAO,GAAC,YAAY,GAAC,SAAS,GAAC,EAAE,CA2B5C;AA/4BD,uBAAwB,CAAC,CAAC;AAC1B,iCAA2C;AAC3C,gCAA0C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;;;;;;;;;;;;;;;;;;8BAtdjF,KAAK,CAAC,GAAC,CAAC,GAAC,OAAO,aAAa,EAAE,KAAK,GAAC,MAAM,GAAC,MAAM,GAAC,OAAO;2BAkF1D,OAAO,GAAC,MAAM,GAAC,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC;;;;qBAuNnC,CAAS,IAAK,SAAE,IAAM,EAAN,MAAM,EAAE,IAAc,EAAd,cAAc,KAAE,UAAU"}
@@ -253,6 +253,7 @@ export class CallExpression {
253
253
  * @property {Set<string>} properties Properties referenced with the 'get' operator.
254
254
  * @property {boolean} featureId The style uses the feature id.
255
255
  * @property {boolean} geometryType The style uses the feature geometry type.
256
+ * @property {boolean} mapState The style uses the map state (view state or time elapsed).
256
257
  */
257
258
 
258
259
  /**
@@ -264,6 +265,7 @@ export function newParsingContext() {
264
265
  properties: new Set(),
265
266
  featureId: false,
266
267
  geometryType: false,
268
+ mapState: false,
267
269
  };
268
270
  }
269
271
 
@@ -443,9 +445,9 @@ const parsers = {
443
445
  ),
444
446
  [Ops.GeometryType]: createCallExpressionParser(usesGeometryType, withNoArgs),
445
447
  [Ops.LineMetric]: createCallExpressionParser(withNoArgs),
446
- [Ops.Resolution]: createCallExpressionParser(withNoArgs),
447
- [Ops.Zoom]: createCallExpressionParser(withNoArgs),
448
- [Ops.Time]: createCallExpressionParser(withNoArgs),
448
+ [Ops.Resolution]: createCallExpressionParser(usesMapState, withNoArgs),
449
+ [Ops.Zoom]: createCallExpressionParser(usesMapState, withNoArgs),
450
+ [Ops.Time]: createCallExpressionParser(usesMapState, withNoArgs),
449
451
  [Ops.Any]: createCallExpressionParser(
450
452
  hasArgsCount(2, Infinity),
451
453
  withArgsOfType(BooleanType),
@@ -660,6 +662,13 @@ function usesGeometryType(encoded, returnType, context) {
660
662
  context.geometryType = true;
661
663
  }
662
664
 
665
+ /**
666
+ * @type {ArgValidator}
667
+ */
668
+ function usesMapState(encoded, returnType, context) {
669
+ context.mapState = true;
670
+ }
671
+
663
672
  /**
664
673
  * @type {ArgValidator}
665
674
  */
@@ -13,13 +13,13 @@
13
13
  * The function is responsible for loading the features and adding them to the
14
14
  * source.
15
15
  *
16
- * @template {import("./Feature.js").FeatureLike} [FeatureType=import("./Feature.js").default]
17
- * @typedef {function(this:(import("./source/Vector").default<FeatureType>|import("./VectorTile.js").default),
18
- * import("./extent.js").Extent,
19
- * number,
20
- * import("./proj/Projection.js").default,
21
- * function(Array<FeatureType>): void=,
22
- * function(): void=): void} FeatureLoader
16
+ * @template {import("./Feature.js").FeatureLike} [FeatureType=import("./Feature.js").FeatureLike]
17
+ * @typedef {(
18
+ * extent: import("./extent.js").Extent,
19
+ * resolution: number,
20
+ * projection: import("./proj/Projection.js").default,
21
+ * success?: (features: Array<FeatureType>) => void,
22
+ * failure?: () => void) => void} FeatureLoader
23
23
  * @api
24
24
  */
25
25
  /**
@@ -50,13 +50,14 @@ export function loadFeaturesXhr<FeatureType extends import("./Feature.js").Featu
50
50
  * Create an XHR feature loader for a `url` and `format`. The feature loader
51
51
  * loads features (with XHR), parses the features, and adds them to the
52
52
  * vector source.
53
- * @template {import("./Feature.js").FeatureLike} FeatureType
53
+ *
54
+ * @template {import("./Feature.js").FeatureLike} [FeatureType=import("./Feature.js").default]
54
55
  * @param {string|FeatureUrlFunction} url Feature URL service.
55
56
  * @param {import("./format/Feature.js").default<FeatureType>} format Feature format.
56
57
  * @return {FeatureLoader<FeatureType>} The feature loader.
57
58
  * @api
58
59
  */
59
- export function xhr<FeatureType extends import("./Feature.js").FeatureLike>(url: string | FeatureUrlFunction, format: import("./format/Feature.js").default<FeatureType>): FeatureLoader<FeatureType>;
60
+ export function xhr<FeatureType extends import("./Feature.js").FeatureLike = import("./Feature.js").default<import("./geom.js").Geometry>>(url: string | FeatureUrlFunction, format: import("./format/Feature.js").default<FeatureType>): FeatureLoader<FeatureType>;
60
61
  /**
61
62
  * Setter for the withCredentials configuration for the XHR.
62
63
  *
@@ -80,7 +81,7 @@ export function setWithCredentials(xhrWithCredentials: boolean): void;
80
81
  * The function is responsible for loading the features and adding them to the
81
82
  * source.
82
83
  */
83
- export type FeatureLoader<FeatureType extends import("./Feature.js").FeatureLike = import("./Feature.js").default<import("./geom.js").Geometry>> = (this: (import("./source/Vector").default<FeatureType> | import("./VectorTile.js").default<any>), arg1: import("./extent.js").Extent, arg2: number, arg3: import("./proj/Projection.js").default, arg4: ((arg0: Array<FeatureType>) => void) | undefined, arg5: (() => void) | undefined) => void;
84
+ export type FeatureLoader<FeatureType extends import("./Feature.js").FeatureLike = import("./Feature.js").FeatureLike> = (extent: import("./extent.js").Extent, resolution: number, projection: import("./proj/Projection.js").default, success?: (features: Array<FeatureType>) => void, failure?: () => void) => void;
84
85
  /**
85
86
  * {@link module :ol/source/Vector~VectorSource} sources use a function of this type to
86
87
  * get the url to load features from.
@@ -1 +1 @@
1
- {"version":3,"file":"featureloader.d.ts","sourceRoot":"","sources":["featureloader.js"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;;;;GAWG;AACH,gCAXmD,WAAW,SAAjD,OAAQ,cAAc,EAAE,WAAY,sEACtC,MAAM,GAAC,kBAAkB,UACzB,OAAO,qBAAqB,EAAE,OAAO,CAAC,WAAW,CAAC,UAClD,OAAO,aAAa,EAAE,MAAM,cAC5B,MAAM,cACN,OAAO,sBAAsB,EAAE,OAAO,WACtC,CAAS,IAAkB,EAAlB,KAAK,CAAC,WAAW,CAAC,EAAE,IAAsC,EAAtC,OAAO,sBAAsB,EAAE,OAAO,KAAG,IAAI,WAE1E,MAAY,IAAI,QAkE1B;AAED;;;;;;;;;GASG;AACH,oBANkD,WAAW,SAAhD,OAAQ,cAAc,EAAE,WAAY,OACtC,MAAM,GAAC,kBAAkB,UACzB,OAAO,qBAAqB,EAAE,OAAO,CAAC,WAAW,CAAC,GACjD,aAAa,CAAC,WAAW,CAAC,CAoCrC;AAED;;;;;;GAMG;AACH,uDAJW,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,WAAW,CAAC,GACjD,aAAa,CAAC,WAAW,CAAC,CAmCrC;AAED;;;;;;GAMG;AACH,uDAJW,OAAO,QAMjB;;;;;;;;;;;;;;;;0BAzJkD,WAAW,SAAjD,OAAQ,cAAc,EAAE,WAAY,yCACpC,CACA,MAAM,EAAE,OAAO,aAAa,EAAE,MAAM,EACpC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,OAAO,sBAAsB,EAAE,OAAO,EAClD,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC,KAAK,IAAI,EAChD,OAAO,CAAC,EAAE,MAAM,IAAI,KAAK,IAAI;;;;;;;;;;iCAY7B,CAAS,IAA4B,EAA5B,OAAO,aAAa,EAAE,MAAM,EAAE,IAAM,EAAN,MAAM,EAAE,IAAsC,EAAtC,OAAO,sBAAsB,EAAE,OAAO,KAAG,MAAM"}
package/featureloader.js CHANGED
@@ -25,13 +25,13 @@ let withCredentials = false;
25
25
  * The function is responsible for loading the features and adding them to the
26
26
  * source.
27
27
  *
28
- * @template {import("./Feature.js").FeatureLike} [FeatureType=import("./Feature.js").default]
29
- * @typedef {function(this:(import("./source/Vector").default<FeatureType>|import("./VectorTile.js").default),
30
- * import("./extent.js").Extent,
31
- * number,
32
- * import("./proj/Projection.js").default,
33
- * function(Array<FeatureType>): void=,
34
- * function(): void=): void} FeatureLoader
28
+ * @template {import("./Feature.js").FeatureLike} [FeatureType=import("./Feature.js").FeatureLike]
29
+ * @typedef {(
30
+ * extent: import("./extent.js").Extent,
31
+ * resolution: number,
32
+ * projection: import("./proj/Projection.js").default,
33
+ * success?: (features: Array<FeatureType>) => void,
34
+ * failure?: () => void) => void} FeatureLoader
35
35
  * @api
36
36
  */
37
37
 
@@ -128,7 +128,8 @@ export function loadFeaturesXhr(
128
128
  * Create an XHR feature loader for a `url` and `format`. The feature loader
129
129
  * loads features (with XHR), parses the features, and adds them to the
130
130
  * vector source.
131
- * @template {import("./Feature.js").FeatureLike} FeatureType
131
+ *
132
+ * @template {import("./Feature.js").FeatureLike} [FeatureType=import("./Feature.js").default]
132
133
  * @param {string|FeatureUrlFunction} url Feature URL service.
133
134
  * @param {import("./format/Feature.js").default<FeatureType>} format Feature format.
134
135
  * @return {FeatureLoader<FeatureType>} The feature loader.
@@ -143,10 +144,9 @@ export function xhr(url, format) {
143
144
  * Function called when loading succeeded.
144
145
  * @param {function(): void} [failure] Failure
145
146
  * Function called when loading failed.
147
+ * @this {import("./source/Vector.js").default<FeatureType>}
146
148
  */
147
149
  return function (extent, resolution, projection, success, failure) {
148
- const source =
149
- /** @type {import("./source/Vector").default<FeatureType>} */ (this);
150
150
  loadFeaturesXhr(
151
151
  url,
152
152
  format,
@@ -158,8 +158,8 @@ export function xhr(url, format) {
158
158
  * @param {import("./proj/Projection.js").default} dataProjection Data
159
159
  * projection.
160
160
  */
161
- function (features, dataProjection) {
162
- source.addFeatures(features);
161
+ (features, dataProjection) => {
162
+ this.addFeatures(features);
163
163
  if (success !== undefined) {
164
164
  success(features);
165
165
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ol",
3
- "version": "10.3.2-dev.1737449234314",
3
+ "version": "10.3.2-dev.1737837749372",
4
4
  "description": "OpenLayers mapping library",
5
5
  "keywords": [
6
6
  "map",
@@ -168,7 +168,7 @@ declare class MixedGeometryBatch {
168
168
  private uidToRef_;
169
169
  /**
170
170
  * The precision in WebGL shaders is limited.
171
- * To keep the refs as small as possible we maintain an array of returned references.
171
+ * To keep the refs as small as possible we maintain an array of freed up references.
172
172
  * @type {Array<number>}
173
173
  * @private
174
174
  */
@@ -259,6 +259,14 @@ declare class MixedGeometryBatch {
259
259
  * @return {Feature|RenderFeature} feature
260
260
  */
261
261
  getFeatureFromRef(ref: number): Feature | RenderFeature;
262
+ isEmpty(): boolean;
263
+ /**
264
+ * Will return a new instance of this class that only contains the features
265
+ * for which the provided callback returned true
266
+ * @param {function((Feature|RenderFeature)): boolean} featureFilter Feature filter callback
267
+ * @return {MixedGeometryBatch} Filtered geometry batch
268
+ */
269
+ filter(featureFilter: (arg0: (Feature | RenderFeature)) => boolean): MixedGeometryBatch;
262
270
  }
263
271
  import RenderFeature from '../../render/Feature.js';
264
272
  //# sourceMappingURL=MixedGeometryBatch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MixedGeometryBatch.d.ts","sourceRoot":"","sources":["MixedGeometryBatch.js"],"names":[],"mappings":";sBAQa,OAAO,kBAAkB,EAAE,OAAO;2BAGlC,OAAO,wBAAwB,EAAE,IAAI;;;;;;;;aAKpC,OAAO,GAAC,aAAa;;;;iBACrB,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;;;;;;;;;;;;;;;;;;4BAQrB,kBAAkB,GAAC,uBAAuB,GAAC,oBAAoB;;;;;;;;;;;;;;;qBAO9D,MAAM;;;;mBACN,MAAM;;;;gBACN,MAAM;;;;;;;;;;;;;;;;qBAON,MAAM;;;;mBACN,MAAM;;;;;;;;;;;;;;;;qBAON,MAAM;;AA1CpB;;GAEG;AACH;;GAEG;AAEH;;;;;;;;GAQG;AAEH;;GAEG;AAEH;;;;;;;GAOG;AAEH;;;;;;GAMG;AAEH;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH;IAEI;;OAEG;IACH,uBAAuB;IAEvB;;;;OAIG;IACH,sBAA8B;IAE9B;;;;OAIG;IACH,kBAA0B;IAE1B;;;;;OAKG;IACH,uBAAwB;IAExB;;OAEG;IACH,cAFU,oBAAoB,CAO7B;IAED;;OAEG;IACH,YAFU,kBAAkB,CAK3B;IAED;;OAEG;IACH,iBAFU,uBAAuB,CAMhC;IAGH;;;OAGG;IACH,sBAHW,KAAK,CAAC,OAAO,GAAC,aAAa,CAAC,wBAC5B,OAAO,eAAe,EAAE,iBAAiB,QAMnD;IAED;;;OAGG;IACH,oBAHW,OAAO,GAAC,aAAa,wBACrB,OAAO,eAAe,EAAE,iBAAiB,QAYnD;IAED;;;;OAIG;IACH,uCASC;IAED;;;;OAIG;IACH,4CAUC;IAED;;;;OAIG;IACH,yCAWC;IAED;;;;OAIG;IACH,qBA2GC;IAED;;;;;;;;;OASG;IACH,wBAyJC;IAED;;;;;OAKG;IACH,uBAYC;IAED;;;;;OAKG;IACH,mBAOC;IAED;;OAEG;IACH,uBAFW,OAAO,GAAC,aAAa,QAS/B;IAED;;OAEG;IACH,uBAFW,OAAO,GAAC,aAAa,QAU/B;IAED,cAcC;IAED;;;;OAIG;IACH,uBAHW,MAAM,GACL,OAAO,GAAC,aAAa,CAIhC;CACF;0BApjByB,yBAAyB"}
1
+ {"version":3,"file":"MixedGeometryBatch.d.ts","sourceRoot":"","sources":["MixedGeometryBatch.js"],"names":[],"mappings":";sBAQa,OAAO,kBAAkB,EAAE,OAAO;2BAGlC,OAAO,wBAAwB,EAAE,IAAI;;;;;;;;aAKpC,OAAO,GAAC,aAAa;;;;iBACrB,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;;;;;;;;;;;;;;;;;;4BAQrB,kBAAkB,GAAC,uBAAuB,GAAC,oBAAoB;;;;;;;;;;;;;;;qBAO9D,MAAM;;;;mBACN,MAAM;;;;gBACN,MAAM;;;;;;;;;;;;;;;;qBAON,MAAM;;;;mBACN,MAAM;;;;;;;;;;;;;;;;qBAON,MAAM;;AA1CpB;;GAEG;AACH;;GAEG;AAEH;;;;;;;;GAQG;AAEH;;GAEG;AAEH;;;;;;;GAOG;AAEH;;;;;;GAMG;AAEH;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH;IAEI;;OAEG;IACH,uBAAuB;IAEvB;;;;OAIG;IACH,sBAA8B;IAE9B;;;;OAIG;IACH,kBAA0B;IAE1B;;;;;OAKG;IACH,uBAAwB;IAExB;;OAEG;IACH,cAFU,oBAAoB,CAO7B;IAED;;OAEG;IACH,YAFU,kBAAkB,CAK3B;IAED;;OAEG;IACH,iBAFU,uBAAuB,CAMhC;IAGH;;;OAGG;IACH,sBAHW,KAAK,CAAC,OAAO,GAAC,aAAa,CAAC,wBAC5B,OAAO,eAAe,EAAE,iBAAiB,QAMnD;IAED;;;OAGG;IACH,oBAHW,OAAO,GAAC,aAAa,wBACrB,OAAO,eAAe,EAAE,iBAAiB,QAYnD;IAED;;;;OAIG;IACH,uCASC;IAED;;;;OAIG;IACH,4CAUC;IAED;;;;OAIG;IACH,yCAWC;IAED;;;;OAIG;IACH,qBA2GC;IAED;;;;;;;;;OASG;IACH,wBAyJC;IAED;;;;;OAKG;IACH,uBAYC;IAED;;;;;OAKG;IACH,mBAOC;IAED;;OAEG;IACH,uBAFW,OAAO,GAAC,aAAa,QAS/B;IAED;;OAEG;IACH,uBAFW,OAAO,GAAC,aAAa,QAS/B;IAED,cAcC;IAED;;;;OAIG;IACH,uBAHW,MAAM,GACL,OAAO,GAAC,aAAa,CAIhC;IAED,mBAEC;IAED;;;;;OAKG;IACH,sBAHW,CAAS,IAAuB,EAAvB,CAAC,OAAO,GAAC,aAAa,CAAC,KAAG,OAAO,GACzC,kBAAkB,CAU7B;CACF;0BAvkByB,yBAAyB"}
@@ -92,7 +92,7 @@ class MixedGeometryBatch {
92
92
 
93
93
  /**
94
94
  * The precision in WebGL shaders is limited.
95
- * To keep the refs as small as possible we maintain an array of returned references.
95
+ * To keep the refs as small as possible we maintain an array of freed up references.
96
96
  * @type {Array<number>}
97
97
  * @private
98
98
  */
@@ -533,8 +533,7 @@ class MixedGeometryBatch {
533
533
  * @param {Feature|RenderFeature} feature Feature
534
534
  */
535
535
  removeFeature(feature) {
536
- let entry;
537
- entry = this.clearFeatureEntryInPointBatch_(feature) || entry;
536
+ let entry = this.clearFeatureEntryInPointBatch_(feature);
538
537
  entry = this.clearFeatureEntryInPolygonBatch_(feature) || entry;
539
538
  entry = this.clearFeatureEntryInLineStringBatch_(feature) || entry;
540
539
  if (entry) {
@@ -566,6 +565,26 @@ class MixedGeometryBatch {
566
565
  getFeatureFromRef(ref) {
567
566
  return this.refToFeature_.get(ref);
568
567
  }
568
+
569
+ isEmpty() {
570
+ return this.globalCounter_ === 0;
571
+ }
572
+
573
+ /**
574
+ * Will return a new instance of this class that only contains the features
575
+ * for which the provided callback returned true
576
+ * @param {function((Feature|RenderFeature)): boolean} featureFilter Feature filter callback
577
+ * @return {MixedGeometryBatch} Filtered geometry batch
578
+ */
579
+ filter(featureFilter) {
580
+ const filtered = new MixedGeometryBatch();
581
+ for (const feature of this.refToFeature_.values()) {
582
+ if (featureFilter(feature)) {
583
+ filtered.addFeature(feature);
584
+ }
585
+ }
586
+ return filtered;
587
+ }
569
588
  }
570
589
 
571
590
  /**
@@ -177,8 +177,9 @@ declare class VectorStyleRenderer {
177
177
  * @param {import('../../style/flat.js').StyleVariables} variables Style variables
178
178
  * @param {import('../../webgl/Helper.js').default} helper Helper
179
179
  * @param {boolean} [enableHitDetection] Whether to enable the hit detection (needs compatible shader)
180
+ * @param {import("../../expr/expression.js").ExpressionValue} [filter] Optional filter expression
180
181
  */
181
- constructor(styleOrShaders: VectorStyle, variables: import("../../style/flat.js").StyleVariables, helper: import("../../webgl/Helper.js").default, enableHitDetection?: boolean);
182
+ constructor(styleOrShaders: VectorStyle, variables: import("../../style/flat.js").StyleVariables, helper: import("../../webgl/Helper.js").default, enableHitDetection?: boolean, filter?: import("../../expr/expression.js").ExpressionValue);
182
183
  /**
183
184
  * @private
184
185
  * @type {import('../../webgl/Helper.js').default}
@@ -242,6 +243,11 @@ declare class VectorStyleRenderer {
242
243
  * @private
243
244
  */
244
245
  private symbolFragmentShader_;
246
+ /**
247
+ * @type {function(import('../../Feature.js').FeatureLike): boolean}
248
+ * @private
249
+ */
250
+ private featureFilter_;
245
251
  /**
246
252
  * @private
247
253
  */
@@ -265,12 +271,19 @@ declare class VectorStyleRenderer {
265
271
  * @private
266
272
  */
267
273
  private pointAttributesDesc_;
274
+ /**
275
+ * Will apply the style filter when generating geometry batches (if it can be evaluated outside a map context)
276
+ * @param {import("../../expr/expression.js").ExpressionValue} filter Style filter
277
+ * @return {function(import('../../Feature.js').FeatureLike): boolean} Feature filter
278
+ * @private
279
+ */
280
+ private computeFeatureFilter;
268
281
  /**
269
282
  * @param {import('./MixedGeometryBatch.js').default} geometryBatch Geometry batch
270
283
  * @param {import("../../transform.js").Transform} transform Transform to apply to coordinates
271
- * @return {Promise<WebGLBuffers>} A promise resolving to WebGL buffers
284
+ * @return {Promise<WebGLBuffers|null>} A promise resolving to WebGL buffers; returns null if buffers are empty
272
285
  */
273
- generateBuffers(geometryBatch: import("./MixedGeometryBatch.js").default, transform: import("../../transform.js").Transform): Promise<WebGLBuffers>;
286
+ generateBuffers(geometryBatch: import("./MixedGeometryBatch.js").default, transform: import("../../transform.js").Transform): Promise<WebGLBuffers | null>;
274
287
  /**
275
288
  * @param {import('./MixedGeometryBatch.js').default} geometryBatch Geometry batch
276
289
  * @param {import("../../transform.js").Transform} transform Transform to apply to coordinates
@@ -1 +1 @@
1
- {"version":3,"file":"VectorStyleRenderer.d.ts","sourceRoot":"","sources":["VectorStyleRenderer.js"],"names":[],"mappings":";;;;yBAmCU,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmBF,CAAS,IAAwD,EAAnD,OAAO,yBAAyB,EAAE,iBAAiB,EAAE,IAAmC,EAAnC,OAAO,eAAe,EAAE,WAAW,KAAE,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC;;;;;;;;;;;;oBAW5H,KAAK,CAAC,gBAAgB,CAAC;;;;uBACvB,KAAK,CAAC,gBAAgB,CAAC;;;;kBACvB,KAAK,CAAC,gBAAgB,CAAC;;;;6BACvB,OAAO,oBAAoB,EAAE,SAAS;;;;;;yBAKtC,YAAY,GAAC,IAAI;;;;4BACjB,YAAY,GAAC,IAAI;;;;uBACjB,YAAY,GAAC,IAAI;;;;;;;;;YAKjB,MAAM;;;;cACN,MAAM;;;;;;aAKN,OAAO,8BAA8B,EAAE,aAAa;;;;;;;;;;;;;;;;;;;WAQpD,OAAO,qBAAqB,EAAE,SAAS;;;;;;0B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;IAGtE;;;OAGG;IACH,mBAA6D;IAE3D;;OAEG;IACH,4BAAoE;IACpE;;OAEG;IACH,8BAAwE;IAG1E;;;OAGG;IACH,mBAA6D;IAE3D;;OAEG;IACH,4BAAoE;IACpE;;OAEG;IACH,8BAAwE;IAG1E;;;OAGG;IACH,uBAA0B;IAgB1B;;OAEG;IACH,0BAIC;IACD;;OAEG;IACH,kBAAmC;IASnC;;;OAGG;IACH,+BAOC;IACD;;;OAGG;IACH,kCAqCC;IACD;;;OAGG;IACH,6BAYC;IAKH;;;;;OAKG;IACH,6BAgCC;IAED;;;;OAIG;IACH,+BAJW,OAAO,yBAAyB,EAAE,OAAO,aACzC,OAAO,oBAAoB,EAAE,SAAS,GACrC,OAAO,CAAC,YAAY,GAAC,IAAI,CAAC,CA4CrC;IAED;;;;;OAKG;IACH,oCA+BC;IAED;;;;;;OAMG;IACH,gCAwEC;IAED;;;;;OAKG;IACH,gBAJW,YAAY,cACZ,OAAO,cAAc,EAAE,UAAU,qBACjC,MAAY,IAAI,QA8B1B;IAED;;;;;;;;OAQG;IACH,wBAkBC;IAED;;;OAGG;IACH,kBAHW,OAAO,uBAAuB,EAAE,OAAO,YACvC,YAAY,QAuCtB;CACF;6BAloB4B,uBAAuB"}
@@ -1,6 +1,12 @@
1
1
  /**
2
2
  * @module ol/render/webgl/VectorStyleRenderer
3
3
  */
4
+ import {buildExpression, newEvaluationContext} from '../../expr/cpu.js';
5
+ import {
6
+ BooleanType,
7
+ computeGeometryType,
8
+ newParsingContext,
9
+ } from '../../expr/expression.js';
4
10
  import {
5
11
  create as createTransform,
6
12
  makeInverse as makeInverseTransform,
@@ -120,8 +126,9 @@ class VectorStyleRenderer {
120
126
  * @param {import('../../style/flat.js').StyleVariables} variables Style variables
121
127
  * @param {import('../../webgl/Helper.js').default} helper Helper
122
128
  * @param {boolean} [enableHitDetection] Whether to enable the hit detection (needs compatible shader)
129
+ * @param {import("../../expr/expression.js").ExpressionValue} [filter] Optional filter expression
123
130
  */
124
- constructor(styleOrShaders, variables, helper, enableHitDetection) {
131
+ constructor(styleOrShaders, variables, helper, enableHitDetection, filter) {
125
132
  /**
126
133
  * @private
127
134
  * @type {import('../../webgl/Helper.js').default}
@@ -215,6 +222,15 @@ class VectorStyleRenderer {
215
222
  this.symbolFragmentShader_ = asShaders.builder.getSymbolFragmentShader();
216
223
  }
217
224
 
225
+ /**
226
+ * @type {function(import('../../Feature.js').FeatureLike): boolean}
227
+ * @private
228
+ */
229
+ this.featureFilter_ = null;
230
+ if (filter) {
231
+ this.featureFilter_ = this.computeFeatureFilter(filter);
232
+ }
233
+
218
234
  const hitDetectionAttributes = this.hitDetectionEnabled_
219
235
  ? {
220
236
  hitColor: {
@@ -321,14 +337,61 @@ class VectorStyleRenderer {
321
337
  this.setHelper(helper);
322
338
  }
323
339
 
340
+ /**
341
+ * Will apply the style filter when generating geometry batches (if it can be evaluated outside a map context)
342
+ * @param {import("../../expr/expression.js").ExpressionValue} filter Style filter
343
+ * @return {function(import('../../Feature.js').FeatureLike): boolean} Feature filter
344
+ * @private
345
+ */
346
+ computeFeatureFilter(filter) {
347
+ const parsingContext = newParsingContext();
348
+ /**
349
+ * @type {import('../../expr/cpu.js').ExpressionEvaluator}
350
+ */
351
+ let compiled;
352
+ try {
353
+ compiled = buildExpression(filter, BooleanType, parsingContext);
354
+ } catch {
355
+ // filter expression failed to compile for CPU: ignore it
356
+ return null;
357
+ }
358
+
359
+ // do not apply the filter if it depends on map state (e.g. zoom level) or any variable
360
+ if (parsingContext.mapState || parsingContext.variables.size > 0) {
361
+ return null;
362
+ }
363
+
364
+ const evalContext = newEvaluationContext();
365
+ return (feature) => {
366
+ evalContext.properties = feature.getPropertiesInternal();
367
+ if (parsingContext.featureId) {
368
+ const id = feature.getId();
369
+ if (id !== undefined) {
370
+ evalContext.featureId = id;
371
+ } else {
372
+ evalContext.featureId = null;
373
+ }
374
+ }
375
+ evalContext.geometryType = computeGeometryType(feature.getGeometry());
376
+ return /** @type {boolean} */ (compiled(evalContext));
377
+ };
378
+ }
379
+
324
380
  /**
325
381
  * @param {import('./MixedGeometryBatch.js').default} geometryBatch Geometry batch
326
382
  * @param {import("../../transform.js").Transform} transform Transform to apply to coordinates
327
- * @return {Promise<WebGLBuffers>} A promise resolving to WebGL buffers
383
+ * @return {Promise<WebGLBuffers|null>} A promise resolving to WebGL buffers; returns null if buffers are empty
328
384
  */
329
385
  async generateBuffers(geometryBatch, transform) {
386
+ let filteredBatch = geometryBatch;
387
+ if (this.featureFilter_) {
388
+ filteredBatch = filteredBatch.filter(this.featureFilter_);
389
+ if (filteredBatch.isEmpty()) {
390
+ return null;
391
+ }
392
+ }
330
393
  const renderInstructions = this.generateRenderInstructions_(
331
- geometryBatch,
394
+ filteredBatch,
332
395
  transform,
333
396
  );
334
397
  const [polygonBuffers, lineStringBuffers, pointBuffers] = await Promise.all(
@@ -1 +1 @@
1
- {"version":3,"file":"VectorLayer.d.ts","sourceRoot":"","sources":["VectorLayer.js"],"names":[],"mappings":"AAmCA;;;;;;;;;;;;;EAKE;;6BAGW,OAAO,2CAA2C,EAAE,SAAS;0BAG7D,OAAO,2CAA2C,EAAE,MAAM;;;;;;;;;WAMzD,OAAO,qBAAqB,EAAE,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC,GAAG,cAAc;;;;;;;;;;;;;;;;;AAVlG;;GAEG;AACH;;GAEG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH;IACE;;;OAGG;IACH,mBAHW,OAAO,sBAAsB,EAAE,OAAO,WACtC,OAAO,EA0GjB;IA5FC;;;OAGG;IACH,6BAAwD;IAExD;;;OAGG;IACH,yBAAqB;IAErB;;OAEG;IACH,wBAAyB;IAEzB;;OAEG;IACH,wBAAoC;IAEpC;;;;;;OAMG;IACH,0BAA0C;IAE1C;;OAEG;IACH,mBAAwB;IACxB;;OAEG;IACH,sBAAsC;IACtC;;OAEG;IACH,iBAA4B;IAE5B;;;OAGG;IACH,oCAAoD;I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AAoC;IAEpC;;;;;;OAMG;IACH,0BAA0C;IAE1C;;OAEG;IACH,mBAAwB;IACxB;;OAEG;IACH,sBAAsC;IACtC;;OAEG;IACH,iBAA4B;IAE5B;;;OAGG;IACH,oCAAoD;IAEpD;;;OAGG;IACH,wBAAyB;IAEzB;;;OAGG;IACH,gBAAiB;IAEjB;;;OAGG;IACH,wBAAyB;IAEzB;;;OAGG;IACH,iBAAkB;IAIlB;;OAEG;IACH,eAAsC;IAEtC;;;OAGG;IACH,8BAAkC;IAElC;;;OAGG;IACH,0BAA6B;IAG/B;;;OAGG;IACH,4BAoCC;IAED;;;OAGG;IACH,sBAGC;IAED;;OAEG;IACH,yBAYC;IAED;;OAEG;IACH,mCAMC;IAoBD;;;;OAIG;IACH,kCAGC;IAED;;;OAGG;IACH,oCAGC;IAED;;;OAGG;IACH,mCAGC;IAED;;OAEG;IACH,kCAEC;IAED;;;OAGG;IACH,uBAsBC;IAED;;;;;OAKG;IACH,iCAJW,OAAO,cAAc,EAAE,UAAU,GAChC,WAAW,CA+BtB;IAwED;;;;;;;OAOG;IACH,yBANW,OAAO,cAAc,EAAE,UAAU,mBACjC,OAAO,cACP,MAAM,YACN,MAAM,cACN,MAAM,QAuChB;IA0CD;;;OAGG;IACH,wBAFW,OAAO,2CAA2C,EAAE,YAAY,QAsB1E;CAoBF;+BAziB8B,YAAY"}
@@ -249,6 +249,7 @@ class WebGLVectorLayerRenderer extends WebGLLayerRenderer {
249
249
  this.styleVariables_,
250
250
  this.helper,
251
251
  this.hitDetectionEnabled_,
252
+ 'filter' in style ? style.filter : null,
252
253
  ),
253
254
  );
254
255
  }
@@ -543,20 +544,24 @@ class WebGLVectorLayerRenderer extends WebGLLayerRenderer {
543
544
  * @param {import('../../render/webgl/VectorStyleRenderer.js').WebGLBuffers} buffers Buffers
544
545
  */
545
546
  disposeBuffers(buffers) {
547
+ /**
548
+ * @param {Array<import('../../webgl/Buffer.js').default>} typeBuffers Buffers
549
+ */
550
+ const disposeBuffersOfType = (typeBuffers) => {
551
+ for (const buffer of typeBuffers) {
552
+ if (buffer) {
553
+ this.helper.deleteBuffer(buffer);
554
+ }
555
+ }
556
+ };
546
557
  if (buffers.pointBuffers) {
547
- buffers.pointBuffers
548
- .filter(Boolean)
549
- .forEach((buffer) => this.helper.deleteBuffer(buffer));
558
+ disposeBuffersOfType(buffers.pointBuffers);
550
559
  }
551
560
  if (buffers.lineStringBuffers) {
552
- buffers.lineStringBuffers
553
- .filter(Boolean)
554
- .forEach((buffer) => this.helper.deleteBuffer(buffer));
561
+ disposeBuffersOfType(buffers.lineStringBuffers);
555
562
  }
556
563
  if (buffers.polygonBuffers) {
557
- buffers.polygonBuffers
558
- .filter(Boolean)
559
- .forEach((buffer) => this.helper.deleteBuffer(buffer));
564
+ disposeBuffersOfType(buffers.polygonBuffers);
560
565
  }
561
566
  }
562
567
 
@@ -566,7 +571,9 @@ class WebGLVectorLayerRenderer extends WebGLLayerRenderer {
566
571
  */
567
572
  disposeInternal() {
568
573
  this.buffers_.forEach((buffers) => {
569
- this.disposeBuffers(buffers);
574
+ if (buffers) {
575
+ this.disposeBuffers(buffers);
576
+ }
570
577
  });
571
578
  if (this.sourceListenKeys_) {
572
579
  this.sourceListenKeys_.forEach(function (key) {
@@ -1 +1 @@
1
- {"version":3,"file":"VectorTileLayer.d.ts","sourceRoot":"","sources":["VectorTileLayer.js"],"names":[],"mappings":"AA4BA;;;;;;;;;;;;;EAIE;;;;;6BAOW,OAAO,2CAA2C,EAAE,SAAS;0BAG7D,OAAO,2CAA2C,EAAE,MAAM;;;;;WAKzD,OAAO,qBAAqB,EAAE,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC,GAAG,cAAc;;;;;;;;;;;;;;;;;;;;AATlG;;GAEG;AACH;;GAEG;AAEH;;;;;;;;;GASG;AAEH;;GAEG;AAEH;;;;GAIG;AACH;IACE;;;OAGG;IACH,uBAHW,SAAS,WACT,OAAO,EAuFjB;IA5EC;;;OAGG;IACH,6BAAwD;IAExD;;;OAGG;IACH,gBAAiB;IAEjB;;;OAGG;IACH,wBAA8C;IAE9C;;;OAGG;IACH,wBAAyB;IAEzB;;;;;;OAMG;IACH,oCAAoD;IAEpD;;OAEG;IACH,sBAAsC;IACtC;;OAEG;IACH,iBAA4B;IAE5B;;;OAGG;IACH,wBAA2B;IAE3B;;OAEG;IACH,yBAGC;IAGD;;;OAGG;IACH,4BAMC;IAED;;;OAGG;IACH,yBAAqB;IAKvB;;;OAGG;IACH,wBAHW,OAAO,QAWjB;IAED;;;OAGG;IACH,sBAEC;IAED;;OAEG;IACH,yBAwCC;IAED;;OAEG;IACH,sBAYC;IAUD;;OAEG;IACH,8DAWC;IAED;;OAEG;IACH,uEAMC;IAED;;OAEG;IACH,yDA0BC;IAED;;OAEG;IACH,4FAeC;IAED;;;;;;;OAOG;IACH,uBAoBC;IAED;;OAEG;IACH,sNA4BC;IAED;;;OAGG;IACH,4BAFW,OAAO,cAAc,EAAE,UAAU,QAEd;CAS/B;uCAzXM,oBAAoB;yBALF,6BAA6B"}
1
+ {"version":3,"file":"VectorTileLayer.d.ts","sourceRoot":"","sources":["VectorTileLayer.js"],"names":[],"mappings":"AA4BA;;;;;;;;;;;;;EAIE;;;;;6BAOW,OAAO,2CAA2C,EAAE,SAAS;0BAG7D,OAAO,2CAA2C,EAAE,MAAM;;;;;WAKzD,OAAO,qBAAqB,EAAE,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC,GAAG,cAAc;;;;;;;;;;;;;;;;;;;;AATlG;;GAEG;AACH;;GAEG;AAEH;;;;;;;;;GASG;AAEH;;GAEG;AAEH;;;;GAIG;AACH;IACE;;;OAGG;IACH,uBAHW,SAAS,WACT,OAAO,EAuFjB;IA5EC;;;OAGG;IACH,6BAAwD;IAExD;;;OAGG;IACH,gBAAiB;IAEjB;;;OAGG;IACH,wBAA8C;IAE9C;;;OAGG;IACH,wBAAyB;IAEzB;;;;;;OAMG;IACH,oCAAoD;IAEpD;;OAEG;IACH,sBAAsC;IACtC;;OAEG;IACH,iBAA4B;IAE5B;;;OAGG;IACH,wBAA2B;IAE3B;;OAEG;IACH,yBAGC;IAGD;;;OAGG;IACH,4BAMC;IAED;;;OAGG;IACH,yBAAqB;IAKvB;;;OAGG;IACH,wBAHW,OAAO,QAWjB;IAED;;;OAGG;IACH,sBAEC;IAED;;OAEG;IACH,yBAyCC;IAED;;OAEG;IACH,sBAYC;IAUD;;OAEG;IACH,8DAWC;IAED;;OAEG;IACH,uEAMC;IAED;;OAEG;IACH,yDA0BC;IAED;;OAEG;IACH,4FAeC;IAED;;;;;;;OAOG;IACH,uBAoBC;IAED;;OAEG;IACH,sNA+BC;IAED;;;OAGG;IACH,4BAFW,OAAO,cAAc,EAAE,UAAU,QAEd;CAS/B;uCA7XM,oBAAoB;yBALF,6BAA6B"}
@@ -218,6 +218,7 @@ class WebGLVectorTileLayerRenderer extends WebGLBaseTileLayerRenderer {
218
218
  this.styleVariables_,
219
219
  this.helper,
220
220
  this.hitDetectionEnabled_,
221
+ 'filter' in style ? style.filter : null,
221
222
  );
222
223
  });
223
224
  }
@@ -376,6 +377,9 @@ class WebGLVectorTileLayerRenderer extends WebGLBaseTileLayerRenderer {
376
377
  for (let i = 0, ii = this.styleRenderers_.length; i < ii; i++) {
377
378
  const renderer = this.styleRenderers_[i];
378
379
  const buffers = tileRepresentation.buffers[i];
380
+ if (!buffers) {
381
+ continue;
382
+ }
379
383
  renderer.render(buffers, frameState, () => {
380
384
  this.applyUniforms_(
381
385
  alpha,
@@ -1,5 +1,6 @@
1
1
  export default Cluster;
2
- export type Options<FeatureType extends import("../Feature.js").FeatureLike> = {
2
+ export type GeometryFunction<FeatureType extends import("../Feature.js").FeatureLike = import("../Feature.js").FeatureLike> = (feature: FeatureType) => (Point | null);
3
+ export type Options<FeatureType extends import("../Feature.js").FeatureLike = Feature<import("../geom/Geometry.js").default>> = {
3
4
  /**
4
5
  * Attributions.
5
6
  */
@@ -31,7 +32,7 @@ export type Options<FeatureType extends import("../Feature.js").FeatureLike> = {
31
32
  * See {@link module :ol/geom/Polygon~Polygon#getInteriorPoint} for a way to get a cluster
32
33
  * calculation point for polygons.
33
34
  */
34
- geometryFunction?: ((arg0: FeatureType) => (Point | null)) | undefined;
35
+ geometryFunction?: GeometryFunction<FeatureType> | undefined;
35
36
  /**
36
37
  * Function that takes the cluster's center {@link module :ol/geom/Point~Point} and an array
37
38
  * of {@link module :ol/Feature~Feature} included in this cluster. Must return a
@@ -56,7 +57,11 @@ export type Options<FeatureType extends import("../Feature.js").FeatureLike> = {
56
57
  wrapX?: boolean | undefined;
57
58
  };
58
59
  /**
59
- * @template {import("../Feature.js").FeatureLike} FeatureType
60
+ * @template {import("../Feature.js").FeatureLike} [FeatureType=import("../Feature.js").FeatureLike]
61
+ * @typedef {(feature: FeatureType) => (Point|null)} GeometryFunction
62
+ */
63
+ /**
64
+ * @template {import("../Feature.js").FeatureLike} [FeatureType=import("../Feature.js").default]
60
65
  * @typedef {Object} Options
61
66
  * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
62
67
  * @property {number} [distance=20] Distance in pixels within which features will
@@ -66,7 +71,7 @@ export type Options<FeatureType extends import("../Feature.js").FeatureLike> = {
66
71
  * By default no minimum distance is guaranteed. This config can be used to avoid
67
72
  * overlapping icons. As a tradoff, the cluster feature's position will no longer be
68
73
  * the center of all its features.
69
- * @property {function(FeatureType):(Point|null)} [geometryFunction]
74
+ * @property {GeometryFunction<FeatureType>} [geometryFunction]
70
75
  * Function that takes a {@link module:ol/Feature~Feature} as argument and returns a
71
76
  * {@link module:ol/geom/Point~Point} as cluster calculation point for the feature. When a
72
77
  * feature should not be considered for clustering, the function should return
@@ -104,10 +109,10 @@ export type Options<FeatureType extends import("../Feature.js").FeatureLike> = {
104
109
  * source `setSource(null)` has to be called to remove the listener reference
105
110
  * from the wrapped source.
106
111
  * @api
107
- * @template {import('../Feature.js').FeatureLike} FeatureType
112
+ * @template {import('../Feature.js').FeatureLike} [FeatureType=import('../Feature.js').default]
108
113
  * @extends {VectorSource<Feature<import("../geom/Geometry.js").default>>}
109
114
  */
110
- declare class Cluster<FeatureType extends import("../Feature.js").FeatureLike> extends VectorSource<Feature<import("../geom/Geometry.js").default>> {
115
+ declare class Cluster<FeatureType extends import("../Feature.js").FeatureLike = Feature<import("../geom/Geometry.js").default>> extends VectorSource<Feature<import("../geom/Geometry.js").default>> {
111
116
  /**
112
117
  * @param {Options<FeatureType>} [options] Cluster options.
113
118
  */
@@ -138,11 +143,10 @@ declare class Cluster<FeatureType extends import("../Feature.js").FeatureLike> e
138
143
  */
139
144
  protected features: Array<Feature>;
140
145
  /**
141
- * @param {FeatureType} feature Feature.
142
- * @return {Point} Cluster calculation point.
146
+ * @type {GeometryFunction<import("../Feature.js").FeatureLike>}
143
147
  * @protected
144
148
  */
145
- protected geometryFunction: (arg0: FeatureType) => (Point | null);
149
+ protected geometryFunction: GeometryFunction<import("../Feature.js").FeatureLike>;
146
150
  /**
147
151
  * @type {function(Point, Array<FeatureType>):Feature}
148
152
  * @private
@@ -1 +1 @@
1
- {"version":3,"file":"Cluster.d.ts","sourceRoot":"","sources":["Cluster.js"],"names":[],"mappings":";oBAmBmD,WAAW,SAAjD,OAAQ,eAAe,EAAE,WAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BAU3B,WAAW,KAAE,CAAC,KAAK,GAAC,IAAI,CAAC;;;;;;;;;;;;;;4BAazB,KAAK,QAAE,KAAK,CAAC,WAAW,CAAC,KAAE,OAAO;;;;;;;;;;AAxBzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH;;;;;;;;;;;;GAYG;AACH,sBAHmD,WAAW,SAAjD,OAAQ,eAAe,EAAE,WAAY;IAIhD;;OAEG;IACH,sBAFW,OAAO,CAAC,WAAW,CAAC,EA0E9B;IAjEC;;;OAGG;IACH,sBAHU,MAAM,GAAC,SAAS,CAGC;IAE3B;;;OAGG;IACH,oBAHU,MAAM,CAGsD;IAEtE;;;OAG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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH;;;;;;;;;;;;GAYG;AACH,sBAHoD,WAAW,SAAlD,OAAQ,eAAe,EAAE,WAAY;IAIhD;;OAEG;IACH,sBAFW,OAAO,CAAC,WAAW,CAAC,EAyE9B;IAhEC;;;OAGG;IACH,sBAHU,MAAM,GAAC,SAAS,CAGC;IAE3B;;;OAGG;IACH,oBAHU,MAAM,CAGsD;IAEtE;;;OAGG;IACH,uBAHU,MAAM,CAG2B;IAE3C;;;OAGG;IACH,8BAHU,MAAM,CAGW;IAE3B;;;OAGG;IACH,oBAHU,KAAK,CAAC,OAAO,CAAC,CAGN;IAElB;;;OAGG;IACH,4BAHU,gBAAgB,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC,CAY5D;IAEH;;;OAGG;IACH,6BAAiD;IAEjD;;;OAGG;IACH,kBAHU,YAAY,CAAC,WAAW,CAAC,GAAC,IAAI,CAGtB;IAElB;;OAEG;IACH,sBAA4C;IAiB9C;;;;OAIG;IACH,eAHY,MAAM,CAKjB;IAED;;;;OAIG;IACH,aAHY,YAAY,CAAC,WAAW,CAAC,GAAC,IAAI,CAKzC;IAgBD;;;;OAIG;IACH,sBAHW,MAAM,QAKhB;IAED;;;;;OAKG;IACH,4BAHW,MAAM,QAKhB;IAED;;;;OAIG;IACH,kBAHY,MAAM,CAKjB;IAED;;;;OAIG;IACH,kBAHW,YAAY,CAAC,WAAW,CAAC,GAAC,IAAI,QAYxC;IAYD;;;;OAIG;IACH,yBAHW,MAAM,eACN,MAAM,QAahB;IAED;;OAEG;IACH,0BAkCC;IAED;;;;;OAKG;IACH,kCALW,KAAK,CAAC,WAAW,CAAC,UAClB,OAAO,cAAc,EAAE,MAAM,GAC5B,OAAO,CA2BlB;CACF;kBApUiB,kBAAkB;oBAVhB,eAAe;yBAYV,aAAa"}
package/source/Cluster.js CHANGED
@@ -17,7 +17,12 @@ import {getUid} from '../util.js';
17
17
  import VectorSource from './Vector.js';
18
18
 
19
19
  /**
20
- * @template {import("../Feature.js").FeatureLike} FeatureType
20
+ * @template {import("../Feature.js").FeatureLike} [FeatureType=import("../Feature.js").FeatureLike]
21
+ * @typedef {(feature: FeatureType) => (Point|null)} GeometryFunction
22
+ */
23
+
24
+ /**
25
+ * @template {import("../Feature.js").FeatureLike} [FeatureType=import("../Feature.js").default]
21
26
  * @typedef {Object} Options
22
27
  * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
23
28
  * @property {number} [distance=20] Distance in pixels within which features will
@@ -27,7 +32,7 @@ import VectorSource from './Vector.js';
27
32
  * By default no minimum distance is guaranteed. This config can be used to avoid
28
33
  * overlapping icons. As a tradoff, the cluster feature's position will no longer be
29
34
  * the center of all its features.
30
- * @property {function(FeatureType):(Point|null)} [geometryFunction]
35
+ * @property {GeometryFunction<FeatureType>} [geometryFunction]
31
36
  * Function that takes a {@link module:ol/Feature~Feature} as argument and returns a
32
37
  * {@link module:ol/geom/Point~Point} as cluster calculation point for the feature. When a
33
38
  * feature should not be considered for clustering, the function should return
@@ -66,7 +71,7 @@ import VectorSource from './Vector.js';
66
71
  * source `setSource(null)` has to be called to remove the listener reference
67
72
  * from the wrapped source.
68
73
  * @api
69
- * @template {import('../Feature.js').FeatureLike} FeatureType
74
+ * @template {import('../Feature.js').FeatureLike} [FeatureType=import('../Feature.js').default]
70
75
  * @extends {VectorSource<Feature<import("../geom/Geometry.js").default>>}
71
76
  */
72
77
  class Cluster extends VectorSource {
@@ -111,8 +116,7 @@ class Cluster extends VectorSource {
111
116
  this.features = [];
112
117
 
113
118
  /**
114
- * @param {FeatureType} feature Feature.
115
- * @return {Point} Cluster calculation point.
119
+ * @type {GeometryFunction<import("../Feature.js").FeatureLike>}
116
120
  * @protected
117
121
  */
118
122
  this.geometryFunction =