ol 9.2.4-dev.1716489066480 → 9.2.4-dev.1716536869196
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 +2 -2
- package/dist/ol.js.map +1 -1
- package/expr/cpu.js +10 -1
- package/expr/expression.d.ts +3 -3
- package/expr/expression.d.ts.map +1 -1
- package/expr/expression.js +26 -50
- package/package.json +1 -1
- package/util.js +1 -1
package/expr/cpu.js
CHANGED
|
@@ -256,7 +256,16 @@ function compileAccessorExpression(expression, context) {
|
|
|
256
256
|
const name = /** @type {string} */ (nameExpression.value);
|
|
257
257
|
switch (expression.operator) {
|
|
258
258
|
case Ops.Get: {
|
|
259
|
-
return (context) =>
|
|
259
|
+
return (context) => {
|
|
260
|
+
const args = expression.args;
|
|
261
|
+
let value = context.properties[name];
|
|
262
|
+
for (let i = 1, ii = args.length; i < ii; ++i) {
|
|
263
|
+
const keyExpression = /** @type {LiteralExpression} */ (args[i]);
|
|
264
|
+
const key = /** @type {string|number} */ (keyExpression.value);
|
|
265
|
+
value = value[key];
|
|
266
|
+
}
|
|
267
|
+
return value;
|
|
268
|
+
};
|
|
260
269
|
}
|
|
261
270
|
case Ops.Var: {
|
|
262
271
|
return (context) => context.variables[name];
|
package/expr/expression.d.ts
CHANGED
|
@@ -135,9 +135,9 @@ export type ArgValidator = (arg0: Array<EncodedExpression>, arg1: ParsingContext
|
|
|
135
135
|
* of bands, depending on the underlying data source and
|
|
136
136
|
* {@link import ("../source/GeoTIFF.js").Options configuration}. `xOffset` and `yOffset` are optional
|
|
137
137
|
* and allow specifying pixel offsets for x and y. This is used for sampling data from neighboring pixels (WebGL only).
|
|
138
|
-
* * `['get',
|
|
139
|
-
*
|
|
140
|
-
*
|
|
138
|
+
* * `['get', attributeName]` fetches a feature property value, similar to `feature.get('attributeName')`.
|
|
139
|
+
* * `['get', attributeName, keyOrArrayIndex, ...]` (Canvas only) Access nested properties and array items of a
|
|
140
|
+
* feature property. The result is `undefined` when there is nothing at the specified key or index.
|
|
141
141
|
* * `['geometry-type']` returns a feature's geometry type as string, either: 'LineString', 'Point' or 'Polygon'
|
|
142
142
|
* `Multi*` values are returned as their singular equivalent
|
|
143
143
|
* `Circle` geometries are returned as 'Polygon'
|
package/expr/expression.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["expression.js"],"names":[],"mappings":"AAsJA;;;;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;AA8BD;;GAEG;AAEH;;;;;;;GAOG;AAEH;;GAEG;AACH,qCAFY,cAAc,CAUzB;
|
|
1
|
+
{"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["expression.js"],"names":[],"mappings":"AAsJA;;;;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;AA8BD;;GAEG;AAEH;;;;;;;GAOG;AAEH;;GAEG;AACH,qCAFY,cAAc,CAUzB;AAED;;GAEG;AAEH;;;;;GAKG;AACH,+BALW,iBAAiB,WACjB,cAAc,kCAEb,UAAU,CAyDrB;AA2yBD;;;;GAIG;AACH,8CAHW,OAAO,qBAAqB,EAAE,OAAO,GAAC,OAAO,sBAAsB,EAAE,OAAO,GAC3E,OAAO,GAAC,YAAY,GAAC,SAAS,GAAC,EAAE,CA2B5C;AApgCD,yBAA0B;AAC1B,iCAA2C;AAC3C,gCAA0C;AAC1C,gCAA0C;AAC1C,+BAAyC;AACzC,qCAA+C;AAC/C,8BAAwC;AACxC,6BAAiD;AA6DjD;;GAEG;AAEH;IACE;;;OAGG;IACH,kBAHW,MAAM,SACN,YAAY,EAKtB;IAFC,aAAgB;IAChB,oBAAkB;CAErB;AAED;IACE;;;;OAIG;IACH,kBAJW,MAAM,YACN,MAAM,WACH,UAAU,IAMvB;IAHC,aAAgB;IAChB,iBAAwB;IACxB,mBAAgB;CAEnB;AA+FD;;GAEG;AACH;QAFiB,MAAM,GAAE,MAAM;EAgD7B;yBA7IW,iBAAiB,GAAC,cAAc;;;;;eAK/B,IAAI,MAAM,CAAC;;;;gBACX,IAAI,MAAM,CAAC;;;;eACX,OAAO;;;;kBACP,OAAO;;;;WACP,OAAO,kBAAkB,EAAE,SAAS,GAAC,OAAO,mBAAmB,EAAE,UAAU;;gCAiB5E,YAAY,QAAM;;;;;;;kCAoXT,MAAM,iBAAiB,CAAC,QAAE,cAAc,QAAE,MAAM,UAAU,CAAC,QAAE,MAAM,YAAG,MAAM,UAAU,CAAC,GAAC,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BApfrG,UAAQ,GAAC,OAAO,aAAa,EAAE,KAAK,GAAC,MAAM,GAAC,MAAM,GAAC,OAAO;2BA0E1D,OAAO,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,MAAM,CAAC;;;;yCA4KnB,cAAc,QAAE,MAAM,KAAE,UAAU"}
|
package/expr/expression.js
CHANGED
|
@@ -25,9 +25,9 @@ import {isStringColor} from '../color.js';
|
|
|
25
25
|
* of bands, depending on the underlying data source and
|
|
26
26
|
* {@link import("../source/GeoTIFF.js").Options configuration}. `xOffset` and `yOffset` are optional
|
|
27
27
|
* and allow specifying pixel offsets for x and y. This is used for sampling data from neighboring pixels (WebGL only).
|
|
28
|
-
* * `['get',
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* * `['get', attributeName]` fetches a feature property value, similar to `feature.get('attributeName')`.
|
|
29
|
+
* * `['get', attributeName, keyOrArrayIndex, ...]` (Canvas only) Access nested properties and array items of a
|
|
30
|
+
* feature property. The result is `undefined` when there is nothing at the specified key or index.
|
|
31
31
|
* * `['geometry-type']` returns a feature's geometry type as string, either: 'LineString', 'Point' or 'Polygon'
|
|
32
32
|
* `Multi*` values are returned as their singular equivalent
|
|
33
33
|
* `Circle` geometries are returned as 'Polygon'
|
|
@@ -250,27 +250,6 @@ export function newParsingContext() {
|
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
-
/**
|
|
254
|
-
* @param {string} typeHint Type hint
|
|
255
|
-
* @return {number} Resulting value type (will be a single type)
|
|
256
|
-
*/
|
|
257
|
-
function getTypeFromHint(typeHint) {
|
|
258
|
-
switch (typeHint) {
|
|
259
|
-
case 'string':
|
|
260
|
-
return StringType;
|
|
261
|
-
case 'color':
|
|
262
|
-
return ColorType;
|
|
263
|
-
case 'number':
|
|
264
|
-
return NumberType;
|
|
265
|
-
case 'boolean':
|
|
266
|
-
return BooleanType;
|
|
267
|
-
case 'number[]':
|
|
268
|
-
return NumberArrayType;
|
|
269
|
-
default:
|
|
270
|
-
throw new Error(`Unrecognized type hint: ${typeHint}`);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
|
|
274
253
|
/**
|
|
275
254
|
* @typedef {LiteralValue|Array} EncodedExpression
|
|
276
255
|
*/
|
|
@@ -398,20 +377,7 @@ export const Ops = {
|
|
|
398
377
|
* @type {Object<string, Parser>}
|
|
399
378
|
*/
|
|
400
379
|
const parsers = {
|
|
401
|
-
[Ops.Get]: createParser(
|
|
402
|
-
([_, typeHint]) => {
|
|
403
|
-
if (typeHint !== undefined) {
|
|
404
|
-
return getTypeFromHint(
|
|
405
|
-
/** @type {string} */ (
|
|
406
|
-
/** @type {LiteralExpression} */ (typeHint).value
|
|
407
|
-
),
|
|
408
|
-
);
|
|
409
|
-
}
|
|
410
|
-
return AnyType;
|
|
411
|
-
},
|
|
412
|
-
withArgsCount(1, 2),
|
|
413
|
-
withGetArgs,
|
|
414
|
-
),
|
|
380
|
+
[Ops.Get]: createParser(AnyType, withArgsCount(1, Infinity), withGetArgs),
|
|
415
381
|
[Ops.Var]: createParser(
|
|
416
382
|
([firstArg]) => firstArg.type,
|
|
417
383
|
withArgsCount(1, 1),
|
|
@@ -668,19 +634,29 @@ const parsers = {
|
|
|
668
634
|
* @type ArgValidator
|
|
669
635
|
*/
|
|
670
636
|
function withGetArgs(encoded, context) {
|
|
671
|
-
const
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
637
|
+
const args = [];
|
|
638
|
+
for (let i = 1, ii = encoded.length; i < ii; ++i) {
|
|
639
|
+
const arg = parse(encoded[i], context);
|
|
640
|
+
args.push(arg);
|
|
641
|
+
if (!(arg instanceof LiteralExpression)) {
|
|
642
|
+
throw new Error('Expected a literal argument for get operation');
|
|
643
|
+
}
|
|
644
|
+
if (i > 1) {
|
|
645
|
+
if (typeof arg.value !== 'string' && typeof arg.value !== 'number') {
|
|
646
|
+
throw new Error(
|
|
647
|
+
'Expected key or array index of a get operation to be a string or number',
|
|
648
|
+
);
|
|
649
|
+
}
|
|
650
|
+
continue;
|
|
651
|
+
}
|
|
652
|
+
if (typeof arg.value !== 'string') {
|
|
653
|
+
throw new Error(
|
|
654
|
+
'Expected the attribute name of a get operation to be a string',
|
|
655
|
+
);
|
|
656
|
+
}
|
|
657
|
+
context.properties.add(String(arg.value));
|
|
682
658
|
}
|
|
683
|
-
return
|
|
659
|
+
return args;
|
|
684
660
|
}
|
|
685
661
|
|
|
686
662
|
/**
|
package/package.json
CHANGED
package/util.js
CHANGED