ol 9.0.0-dev.1702043722356 → 9.0.0-dev.1702291652397
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.d.ts +5 -0
- package/expr/cpu.d.ts.map +1 -1
- package/expr/cpu.js +6 -2
- package/expr/expression.d.ts +11 -0
- package/expr/expression.d.ts.map +1 -1
- package/expr/expression.js +42 -1
- package/expr/gpu.d.ts.map +1 -1
- package/expr/gpu.js +2 -19
- package/package.json +1 -1
- package/render/canvas/style.d.ts.map +1 -1
- package/render/canvas/style.js +6 -0
- package/util.js +1 -1
package/expr/cpu.d.ts
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* @property {Object} variables The values for variables used in 'var' expressions.
|
|
12
12
|
* @property {number} resolution The map resolution.
|
|
13
13
|
* @property {string|number|null} featureId The feature id.
|
|
14
|
+
* @property {string} geometryType Geometry type of the current object.
|
|
14
15
|
*/
|
|
15
16
|
/**
|
|
16
17
|
* @return {EvaluationContext} A new evaluation context.
|
|
@@ -67,6 +68,10 @@ export type EvaluationContext = {
|
|
|
67
68
|
* The feature id.
|
|
68
69
|
*/
|
|
69
70
|
featureId: string | number | null;
|
|
71
|
+
/**
|
|
72
|
+
* Geometry type of the current object.
|
|
73
|
+
*/
|
|
74
|
+
geometryType: string;
|
|
70
75
|
};
|
|
71
76
|
export type ExpressionEvaluator = (arg0: EvaluationContext) => import("./expression.js").LiteralValue;
|
|
72
77
|
export type BooleanEvaluator = (arg0: EvaluationContext) => boolean;
|
package/expr/cpu.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cpu.d.ts","sourceRoot":"","sources":["cpu.js"],"names":[],"mappings":"AAoBA;;;;;;GAMG;AAEH
|
|
1
|
+
{"version":3,"file":"cpu.d.ts","sourceRoot":"","sources":["cpu.js"],"names":[],"mappings":"AAoBA;;;;;;GAMG;AAEH;;;;;;;GAOG;AAEH;;GAEG;AACH,wCAFY,iBAAiB,CAU5B;AAED;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;;;;GAKG;AACH,yCALW,OAAO,iBAAiB,EAAE,iBAAiB,QAC3C,MAAM,WACN,OAAO,iBAAiB,EAAE,cAAc,GACvC,mBAAmB,CAY9B;;;;;;;;;;;;;gBAtEa,MAAM;;;;eACN,MAAM,GAAC,MAAM,GAAC,IAAI;;;;kBAClB,MAAM;;yCAiBE,iBAAiB,KAAE,OAAO,iBAAiB,EAAE,YAAY;sCAIzD,iBAAiB,KAAE,OAAO;qCAI1B,iBAAiB,KAAE,MAAM;qCAIzB,iBAAiB,KAAE,MAAM;wCAIzB,iBAAiB,KAAE,CAAC,MAAM,MAAM,CAAC,GAAC,MAAM,CAAC;0CAIzC,iBAAiB,KAAE,MAAM,MAAM,CAAC;yCAIhC,iBAAiB,KAAE,MAAM,MAAM,CAAC;mCAIhC,iBAAiB,KAAE,CAAC,MAAM,MAAM,CAAC,CAAC;uCAIlC,iBAAiB,KAAE,CAAC,MAAM,MAAM,CAAC,GAAC,MAAM,CAAC"}
|
package/expr/cpu.js
CHANGED
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
* @property {Object} variables The values for variables used in 'var' expressions.
|
|
33
33
|
* @property {number} resolution The map resolution.
|
|
34
34
|
* @property {string|number|null} featureId The feature id.
|
|
35
|
+
* @property {string} geometryType Geometry type of the current object.
|
|
35
36
|
*/
|
|
36
37
|
|
|
37
38
|
/**
|
|
@@ -43,6 +44,7 @@ export function newEvaluationContext() {
|
|
|
43
44
|
properties: {},
|
|
44
45
|
resolution: NaN,
|
|
45
46
|
featureId: null,
|
|
47
|
+
geometryType: '',
|
|
46
48
|
};
|
|
47
49
|
}
|
|
48
50
|
|
|
@@ -129,7 +131,10 @@ function compileExpression(expression, context) {
|
|
|
129
131
|
return compileAccessorExpression(expression, context);
|
|
130
132
|
}
|
|
131
133
|
case Ops.Id: {
|
|
132
|
-
return (
|
|
134
|
+
return (context) => context.featureId;
|
|
135
|
+
}
|
|
136
|
+
case Ops.GeometryType: {
|
|
137
|
+
return (context) => context.geometryType;
|
|
133
138
|
}
|
|
134
139
|
case Ops.Concat: {
|
|
135
140
|
const args = expression.args.map((e) => compileExpression(e, context));
|
|
@@ -182,7 +187,6 @@ function compileExpression(expression, context) {
|
|
|
182
187
|
throw new Error(`Unsupported operator ${operator}`);
|
|
183
188
|
}
|
|
184
189
|
// TODO: unimplemented
|
|
185
|
-
// Ops.GeometryType
|
|
186
190
|
// Ops.Zoom
|
|
187
191
|
// Ops.Time
|
|
188
192
|
// Ops.Between
|
package/expr/expression.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export function isType(type: number, expected: number): boolean;
|
|
|
30
30
|
* @property {Set<string>} variables Variables referenced with the 'var' operator.
|
|
31
31
|
* @property {Set<string>} properties Properties referenced with the 'get' operator.
|
|
32
32
|
* @property {boolean} featureId The style uses the feature id.
|
|
33
|
+
* @property {boolean} geometryType The style uses the feature geometry type.
|
|
33
34
|
* @property {import("../style/flat.js").FlatStyle|import("../style/webgl.js").WebGLStyle} style The style being parsed
|
|
34
35
|
*/
|
|
35
36
|
/**
|
|
@@ -46,6 +47,12 @@ export function newParsingContext(): ParsingContext;
|
|
|
46
47
|
* @return {Expression} The parsed expression result.
|
|
47
48
|
*/
|
|
48
49
|
export function parse(encoded: EncodedExpression, context: ParsingContext, typeHint?: number | undefined): Expression;
|
|
50
|
+
/**
|
|
51
|
+
* Returns a simplified geometry type suited for the `geometry-type` operator
|
|
52
|
+
* @param {import('../geom/Geometry.js').default|import('../render/Feature.js').default} geometry Geometry object
|
|
53
|
+
* @return {'Point'|'LineString'|'Polygon'|''} Simplified geometry type; empty string of no geometry found
|
|
54
|
+
*/
|
|
55
|
+
export function computeGeometryType(geometry: import('../geom/Geometry.js').default | import('../render/Feature.js').default): 'Point' | 'LineString' | 'Polygon' | '';
|
|
49
56
|
export const NoneType: 0;
|
|
50
57
|
export const BooleanType: number;
|
|
51
58
|
export const NumberType: number;
|
|
@@ -96,6 +103,10 @@ export type ParsingContext = {
|
|
|
96
103
|
* The style uses the feature id.
|
|
97
104
|
*/
|
|
98
105
|
featureId: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* The style uses the feature geometry type.
|
|
108
|
+
*/
|
|
109
|
+
geometryType: boolean;
|
|
99
110
|
/**
|
|
100
111
|
* The style being parsed
|
|
101
112
|
*/
|
package/expr/expression.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["expression.js"],"names":[],"mappings":"AAwIA;;;;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
|
|
1
|
+
{"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["expression.js"],"names":[],"mappings":"AAwIA;;;;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;AAuBD;;GAEG;AAEH;;;;;GAKG;AACH,+BALW,iBAAiB,WACjB,cAAc,kCAEb,UAAU,CAoDrB;AAsxBD;;;;GAIG;AACH,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ables referenced with the 'var' operator.
|
|
220
220
|
* @property {Set<string>} properties Properties referenced with the 'get' operator.
|
|
221
221
|
* @property {boolean} featureId The style uses the feature id.
|
|
222
|
+
* @property {boolean} geometryType The style uses the feature geometry type.
|
|
222
223
|
* @property {import("../style/flat.js").FlatStyle|import("../style/webgl.js").WebGLStyle} style The style being parsed
|
|
223
224
|
*/
|
|
224
225
|
|
|
@@ -230,6 +231,7 @@ export function newParsingContext() {
|
|
|
230
231
|
variables: new Set(),
|
|
231
232
|
properties: new Set(),
|
|
232
233
|
featureId: false,
|
|
234
|
+
geometryType: false,
|
|
233
235
|
style: {},
|
|
234
236
|
};
|
|
235
237
|
}
|
|
@@ -400,7 +402,7 @@ const parsers = {
|
|
|
400
402
|
withArgsCount(2, Infinity),
|
|
401
403
|
parseArgsOfType(AnyType)
|
|
402
404
|
),
|
|
403
|
-
[Ops.GeometryType]: createParser(StringType, withNoArgs),
|
|
405
|
+
[Ops.GeometryType]: createParser(StringType, withNoArgs, usesGeometryType),
|
|
404
406
|
[Ops.Resolution]: createParser(NumberType, withNoArgs),
|
|
405
407
|
[Ops.Zoom]: createParser(NumberType, withNoArgs),
|
|
406
408
|
[Ops.Time]: createParser(NumberType, withNoArgs),
|
|
@@ -675,6 +677,13 @@ function usesFeatureId(encoded, context) {
|
|
|
675
677
|
context.featureId = true;
|
|
676
678
|
}
|
|
677
679
|
|
|
680
|
+
/**
|
|
681
|
+
* @type ArgValidator
|
|
682
|
+
*/
|
|
683
|
+
function usesGeometryType(encoded, context) {
|
|
684
|
+
context.geometryType = true;
|
|
685
|
+
}
|
|
686
|
+
|
|
678
687
|
/**
|
|
679
688
|
* @type ArgValidator
|
|
680
689
|
*/
|
|
@@ -1097,3 +1106,35 @@ function parseCallExpression(encoded, context, typeHint) {
|
|
|
1097
1106
|
}
|
|
1098
1107
|
return parser(encoded, context, typeHint);
|
|
1099
1108
|
}
|
|
1109
|
+
|
|
1110
|
+
/**
|
|
1111
|
+
* Returns a simplified geometry type suited for the `geometry-type` operator
|
|
1112
|
+
* @param {import('../geom/Geometry.js').default|import('../render/Feature.js').default} geometry Geometry object
|
|
1113
|
+
* @return {'Point'|'LineString'|'Polygon'|''} Simplified geometry type; empty string of no geometry found
|
|
1114
|
+
*/
|
|
1115
|
+
export function computeGeometryType(geometry) {
|
|
1116
|
+
if (!geometry) {
|
|
1117
|
+
return '';
|
|
1118
|
+
}
|
|
1119
|
+
const type = geometry.getType();
|
|
1120
|
+
switch (type) {
|
|
1121
|
+
case 'Point':
|
|
1122
|
+
case 'LineString':
|
|
1123
|
+
case 'Polygon':
|
|
1124
|
+
return type;
|
|
1125
|
+
case 'MultiPoint':
|
|
1126
|
+
case 'MultiLineString':
|
|
1127
|
+
case 'MultiPolygon':
|
|
1128
|
+
return /** @type {'Point'|'LineString'|'Polygon'} */ (type.substring(5));
|
|
1129
|
+
case 'Circle':
|
|
1130
|
+
return 'Polygon';
|
|
1131
|
+
case 'GeometryCollection':
|
|
1132
|
+
return computeGeometryType(
|
|
1133
|
+
/** @type {import("../geom/GeometryCollection.js").default} */ (
|
|
1134
|
+
geometry
|
|
1135
|
+
).getGeometries()[0]
|
|
1136
|
+
);
|
|
1137
|
+
default:
|
|
1138
|
+
return '';
|
|
1139
|
+
}
|
|
1140
|
+
}
|
package/expr/gpu.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gpu.d.ts","sourceRoot":"","sources":["gpu.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gpu.d.ts","sourceRoot":"","sources":["gpu.js"],"names":[],"mappings":"AA+BA;;;;GAIG;AACH,gCAHW,MAAM,GACL,MAAM,CAKjB;AAED;;;;GAIG;AACH,mCAHW,MAAM,MAAM,CAAC,GACZ,MAAM,CASjB;AAED;;;;;;GAMG;AACH,mCALW,MAAM,GAAC,OAAO,aAAa,EAAE,KAAK,GAGjC,MAAM,CAYjB;AAMD;;;;GAIG;AACH,kDAHW,MAAM,GACL,MAAM,CAOjB;AAED;;;;;;GAMG;AACH,qCAHW,MAAM,GACL,MAAM,CAIjB;AAED;;;;GAIG;AACH,qDAHW,MAAM,GACL,MAAM,CAIjB;AAED;;GAEG;AACH;;;GAGG;AACH;;;GAGG;AAEH;;;;;GAKG;AAEH;;;;;GAKG;AAEH;;;;;;;;;GASG;AAEH;;GAEG;AACH,yCAFY,kBAAkB,CAW7B;AAMD;;GAEG;AAEH;;;GAGG;AAEH;;;;;;GAMG;AACH,yCANW,OAAO,iBAAiB,EAAE,iBAAiB,QAC3C,MAAM,kBACN,OAAO,iBAAiB,EAAE,cAAc,sBACxC,kBAAkB,GACjB,kBAAkB,CAoB7B;AApCD,wDAAyD;6BApD5C,OAAO,iBAAiB,EAAE,cAAc;yBAIxC,OAAO,iBAAiB,EAAE,UAAU;gCAIpC,OAAO,iBAAiB,EAAE,iBAAiB;;;;;UAK1C,MAAM;;;;UACN,MAAM;;;;wBACG,OAAO,eAAe,EAAE,WAAW;;;;;;UAK5C,MAAM;;;;UACN,MAAM;;;;;;;;;;;;;;;YAOC,MAAM,GAAE,0BAA0B;;;;;;YAClC,MAAM,GAAE,0BAA0B;;;;;;YAClC,MAAM,GAAE,MAAM;;;;;;;;;;;;;WAGrB,OAAO,mBAAmB,EAAE,UAAU;;iCAsBvC,MAAM;;;;8BAIG,kBAAkB,QAAE,cAAc,QAAE,MAAM,KAAG,MAAM;2BAvK9C,4BAA4B;+BAehD,iBAAiB"}
|
package/expr/gpu.js
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
NumberType,
|
|
12
12
|
Ops,
|
|
13
13
|
StringType,
|
|
14
|
+
computeGeometryType,
|
|
14
15
|
isType,
|
|
15
16
|
overlapsType,
|
|
16
17
|
parse,
|
|
@@ -232,31 +233,13 @@ const compilers = {
|
|
|
232
233
|
},
|
|
233
234
|
[Ops.GeometryType]: (context, expression, type) => {
|
|
234
235
|
const propName = 'geometryType';
|
|
235
|
-
const computeType = (geometry) => {
|
|
236
|
-
const type = geometry.getType();
|
|
237
|
-
switch (type) {
|
|
238
|
-
case 'Point':
|
|
239
|
-
case 'LineString':
|
|
240
|
-
case 'Polygon':
|
|
241
|
-
return type;
|
|
242
|
-
case 'MultiPoint':
|
|
243
|
-
case 'MultiLineString':
|
|
244
|
-
case 'MultiPolygon':
|
|
245
|
-
return type.substring(5);
|
|
246
|
-
case 'Circle':
|
|
247
|
-
return 'Polygon';
|
|
248
|
-
case 'GeometryCollection':
|
|
249
|
-
return computeType(geometry.getGeometries()[0]);
|
|
250
|
-
default:
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
236
|
const isExisting = propName in context.properties;
|
|
254
237
|
if (!isExisting) {
|
|
255
238
|
context.properties[propName] = {
|
|
256
239
|
name: propName,
|
|
257
240
|
type: StringType,
|
|
258
241
|
evaluator: (feature) => {
|
|
259
|
-
return
|
|
242
|
+
return computeGeometryType(feature.getGeometry());
|
|
260
243
|
},
|
|
261
244
|
};
|
|
262
245
|
}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["style.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["style.js"],"names":[],"mappings":"AAgEA;;;;;;;GAOG;AACH,4CAHW,MAAM,OAAO,qBAAqB,EAAE,IAAI,CAAC,GACxC,OAAO,sBAAsB,EAAE,aAAa,CAwBvD;AAED;;;;;;;GAOG;AACH,sDAHW,MAAM,OAAO,qBAAqB,EAAE,SAAS,CAAC,GAC7C,OAAO,sBAAsB,EAAE,aAAa,CA0CvD;AAED;;GAEG;AAEH;;;;GAIG;AAEH;;;;GAIG;AACH,oCAJW,MAAM,OAAO,qBAAqB,EAAE,IAAI,CAAC,WACzC,cAAc,GACb,gBAAgB,CA6D3B;AAED;;GAEG;AAEH;;;;;GAKG;AACH,sCALW,SAAS,WACT,cAAc,GACb,cAAc,CAgEzB;wBApQY,OAAO,qBAAqB,EAAE,SAAS;gCAIvC,OAAO,0BAA0B,EAAE,iBAAiB;6BAIpD,OAAO,0BAA0B,EAAE,cAAc;6BAIjD,OAAO,0BAA0B,EAAE,cAAc;gCAIjD,OAAO,mBAAmB,EAAE,iBAAiB;kCAI7C,OAAO,mBAAmB,EAAE,mBAAmB;sCA8FtC,iBAAiB,KAAE,MAAM,KAAK,CAAC;;;;;YAKvC,mBAAmB;;;;YACnB,MAAM,cAAc,CAAC;;oCAsEb,iBAAiB,KAAE,KAAK,GAAC,IAAI;mCAyE7B,iBAAiB,KAAE,IAAI,GAAC,IAAI;qCAoC5B,iBAAiB,KAAE,MAAM,GAAC,IAAI;mCA2G9B,iBAAiB,KAAE,IAAI;oCAyNvB,iBAAiB,KAAE,OAAO,sBAAsB,EAAE,OAAO;kBAvoB7D,sBAAsB;iBAJvB,qBAAqB;mBAGnB,uBAAuB;iBAEzB,qBAAqB"}
|
package/render/canvas/style.js
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
NumberArrayType,
|
|
16
16
|
NumberType,
|
|
17
17
|
StringType,
|
|
18
|
+
computeGeometryType,
|
|
18
19
|
newParsingContext,
|
|
19
20
|
} from '../../expr/expression.js';
|
|
20
21
|
import {buildExpression, newEvaluationContext} from '../../expr/cpu.js';
|
|
@@ -84,6 +85,11 @@ export function rulesToStyleFunction(rules) {
|
|
|
84
85
|
evaluationContext.featureId = null;
|
|
85
86
|
}
|
|
86
87
|
}
|
|
88
|
+
if (parsingContext.geometryType) {
|
|
89
|
+
evaluationContext.geometryType = computeGeometryType(
|
|
90
|
+
feature.getGeometry()
|
|
91
|
+
);
|
|
92
|
+
}
|
|
87
93
|
return evaluator(evaluationContext);
|
|
88
94
|
};
|
|
89
95
|
}
|
package/util.js
CHANGED