ol 10.0.1-dev.1722904163785 → 10.0.1-dev.1723216132990
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/dist/ol.js +1 -1
- package/dist/ol.js.map +1 -1
- package/expr/cpu.js +20 -1
- package/expr/expression.d.ts +2 -0
- package/expr/expression.d.ts.map +1 -1
- package/expr/expression.js +4 -0
- package/format/GML2.js +1 -1
- package/format/GML3.js +1 -1
- package/package.json +1 -1
- package/util.js +1 -1
package/expr/cpu.js
CHANGED
|
@@ -115,7 +115,8 @@ function compileExpression(expression, context) {
|
|
|
115
115
|
return compileAssertionExpression(expression, context);
|
|
116
116
|
}
|
|
117
117
|
case Ops.Get:
|
|
118
|
-
case Ops.Var:
|
|
118
|
+
case Ops.Var:
|
|
119
|
+
case Ops.Has: {
|
|
119
120
|
return compileAccessorExpression(expression, context);
|
|
120
121
|
}
|
|
121
122
|
case Ops.Id: {
|
|
@@ -256,6 +257,24 @@ function compileAccessorExpression(expression, context) {
|
|
|
256
257
|
case Ops.Var: {
|
|
257
258
|
return (context) => context.variables[name];
|
|
258
259
|
}
|
|
260
|
+
case Ops.Has: {
|
|
261
|
+
return (context) => {
|
|
262
|
+
const args = expression.args;
|
|
263
|
+
if (!(name in context.properties)) {
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
let value = context.properties[name];
|
|
267
|
+
for (let i = 1, ii = args.length; i < ii; ++i) {
|
|
268
|
+
const keyExpression = /** @type {LiteralExpression} */ (args[i]);
|
|
269
|
+
const key = /** @type {string|number} */ (keyExpression.value);
|
|
270
|
+
if (!value || !Object.hasOwn(value, key)) {
|
|
271
|
+
return false;
|
|
272
|
+
}
|
|
273
|
+
value = value[key];
|
|
274
|
+
}
|
|
275
|
+
return true;
|
|
276
|
+
};
|
|
277
|
+
}
|
|
259
278
|
default: {
|
|
260
279
|
throw new Error(`Unsupported accessor operator ${expression.operator}`);
|
|
261
280
|
}
|
package/expr/expression.d.ts
CHANGED
|
@@ -193,6 +193,8 @@ export type ArgValidator = (arg0: Array<EncodedExpression>, arg1: number, arg2:
|
|
|
193
193
|
* * `['!', value1]` returns `false` if `value1` is `true` or greater than `0`, or `true` otherwise.
|
|
194
194
|
* * `['all', value1, value2, ...]` returns `true` if all the inputs are `true`, `false` otherwise.
|
|
195
195
|
* * `['any', value1, value2, ...]` returns `true` if any of the inputs are `true`, `false` otherwise.
|
|
196
|
+
* * `['has', attributeName, keyOrArrayIndex, ...]` returns `true` if feature properties include the (nested) key `attributeName`,
|
|
197
|
+
* `false` otherwise.
|
|
196
198
|
* * `['between', value1, value2, value3]` returns `true` if `value1` is contained between `value2` and `value3`
|
|
197
199
|
* (inclusively), or `false` otherwise.
|
|
198
200
|
* * `['in', needle, haystack]` returns `true` if `needle` is found in `haystack`, and
|
package/expr/expression.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["expression.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["expression.js"],"names":[],"mappings":"AAiKA;;;;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;AAqoBD;;;;GAIG;AACH,8CAHW,OAAO,qBAAqB,EAAE,OAAO,GAAC,OAAO,sBAAsB,EAAE,OAAO,GAC3E,OAAO,GAAC,YAAY,GAAC,SAAS,GAAC,EAAE,CA2B5C;AA74BD,yBAA0B;AAC1B,iCAA2C;AAC3C,gCAA0C;AAC1C,gCAA0C;AAC1C,+BAAyC;AACzC,qCAA+C;AAC/C,8BAAwC;AACxC,6BAAiD;AAqEjD;;GAEG;AAEH;IACE;;;OAGG;IACH,kBAHW,MAAM,SACN,YAAY,EAUtB;IAFC,aAAgB;IAChB,oBAAkB;CAErB;AAED;IACE;;;;OAIG;IACH,kBAJW,MAAM,YACN,MAAM,WACH,UAAU,EAAA,EAMvB;IAHC,aAAgB;IAChB,iBAAwB;IACxB,mBAAgB;CAEnB;AAiID;;GAEG;AACH,kBAFU;QAAO,MAAM,GAAE,MAAM;CAAC,CAiD9B;yBAhLW,iBAAiB,GAAC,cAAc;;;;;eAK/B,GAAG,CAAC,MAAM,CAAC;;;;gBACX,GAAG,CAAC,MAAM,CAAC;;;;eACX,OAAO;;;;kBACP,OAAO;;gCAgBR,YAAY,QAAM;;;;;2BAuUlB,CAAS,IAAwB,EAAxB,KAAK,CAAC,iBAAiB,CAAC,EAAE,IAAM,EAAN,MAAM,EAAE,IAAc,EAAd,cAAc,KAAE,KAAK,CAAC,UAAU,CAAC,GAAC,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAldjF,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;;;;qBAoNnC,CAAS,IAAK,SAAE,IAAM,EAAN,MAAM,EAAE,IAAc,EAAd,cAAc,KAAE,UAAU"}
|
package/expr/expression.js
CHANGED
|
@@ -91,6 +91,8 @@ import {toSize} from '../size.js';
|
|
|
91
91
|
* * `['!', value1]` returns `false` if `value1` is `true` or greater than `0`, or `true` otherwise.
|
|
92
92
|
* * `['all', value1, value2, ...]` returns `true` if all the inputs are `true`, `false` otherwise.
|
|
93
93
|
* * `['any', value1, value2, ...]` returns `true` if any of the inputs are `true`, `false` otherwise.
|
|
94
|
+
* * `['has', attributeName, keyOrArrayIndex, ...]` returns `true` if feature properties include the (nested) key `attributeName`,
|
|
95
|
+
* `false` otherwise.
|
|
94
96
|
* * `['between', value1, value2, value3]` returns `true` if `value1` is contained between `value2` and `value3`
|
|
95
97
|
* (inclusively), or `false` otherwise.
|
|
96
98
|
* * `['in', needle, haystack]` returns `true` if `needle` is found in `haystack`, and
|
|
@@ -414,6 +416,7 @@ export const Ops = {
|
|
|
414
416
|
Band: 'band',
|
|
415
417
|
Palette: 'palette',
|
|
416
418
|
ToString: 'to-string',
|
|
419
|
+
Has: 'has',
|
|
417
420
|
};
|
|
418
421
|
|
|
419
422
|
/**
|
|
@@ -428,6 +431,7 @@ export const Ops = {
|
|
|
428
431
|
const parsers = {
|
|
429
432
|
[Ops.Get]: createCallExpressionParser(hasArgsCount(1, Infinity), withGetArgs),
|
|
430
433
|
[Ops.Var]: createCallExpressionParser(hasArgsCount(1, 1), withVarArgs),
|
|
434
|
+
[Ops.Has]: createCallExpressionParser(hasArgsCount(1, Infinity), withGetArgs),
|
|
431
435
|
[Ops.Id]: createCallExpressionParser(usesFeatureId, withNoArgs),
|
|
432
436
|
[Ops.Concat]: createCallExpressionParser(
|
|
433
437
|
hasArgsCount(2, Infinity),
|
package/format/GML2.js
CHANGED
|
@@ -218,7 +218,7 @@ class GML2 extends GMLBase {
|
|
|
218
218
|
const properties = feature.getProperties();
|
|
219
219
|
for (const key in properties) {
|
|
220
220
|
const value = properties[key];
|
|
221
|
-
if (value !== null) {
|
|
221
|
+
if (value !== null && value !== undefined) {
|
|
222
222
|
keys.push(key);
|
|
223
223
|
values.push(value);
|
|
224
224
|
if (
|
package/format/GML3.js
CHANGED
|
@@ -849,7 +849,7 @@ class GML3 extends GMLBase {
|
|
|
849
849
|
const properties = feature.getProperties();
|
|
850
850
|
for (const key in properties) {
|
|
851
851
|
const value = properties[key];
|
|
852
|
-
if (value !== null) {
|
|
852
|
+
if (value !== null && value !== undefined) {
|
|
853
853
|
keys.push(key);
|
|
854
854
|
values.push(value);
|
|
855
855
|
if (
|
package/package.json
CHANGED
package/util.js
CHANGED