ol 9.2.2-dev.1716040147863 → 9.2.2-dev.1716041028869
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.d.ts +4 -0
- package/dist/ol.d.ts.map +1 -1
- package/dist/ol.js +2 -2
- package/dist/ol.js.map +1 -1
- package/expr/expression.d.ts +1 -0
- package/expr/expression.d.ts.map +1 -1
- package/expr/expression.js +14 -5
- package/expr/gpu.d.ts +6 -0
- package/expr/gpu.d.ts.map +1 -1
- package/expr/gpu.js +18 -0
- package/package.json +1 -1
- package/source/Cluster.d.ts +2 -2
- package/source/Cluster.d.ts.map +1 -1
- package/source/Cluster.js +3 -2
- package/util.js +1 -1
- package/webgl/styleparser.d.ts.map +1 -1
- package/webgl/styleparser.js +6 -13
package/expr/expression.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export const NumberType: number;
|
|
|
59
59
|
export const StringType: number;
|
|
60
60
|
export const ColorType: number;
|
|
61
61
|
export const NumberArrayType: number;
|
|
62
|
+
export const SizeType: number;
|
|
62
63
|
export const AnyType: number;
|
|
63
64
|
/**
|
|
64
65
|
* @typedef {boolean|number|string|Array<number>} LiteralValue
|
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":"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,c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AAM,MAAM,CAAC;;;;yCAiMnB,cAAc,QAAE,MAAM,KAAE,UAAU"}
|
package/expr/expression.js
CHANGED
|
@@ -134,6 +134,7 @@ export const NumberType = 1 << numTypes++;
|
|
|
134
134
|
export const StringType = 1 << numTypes++;
|
|
135
135
|
export const ColorType = 1 << numTypes++;
|
|
136
136
|
export const NumberArrayType = 1 << numTypes++;
|
|
137
|
+
export const SizeType = 1 << numTypes++;
|
|
137
138
|
export const AnyType = Math.pow(2, numTypes) - 1;
|
|
138
139
|
|
|
139
140
|
const typeNames = {
|
|
@@ -142,6 +143,7 @@ const typeNames = {
|
|
|
142
143
|
[StringType]: 'string',
|
|
143
144
|
[ColorType]: 'color',
|
|
144
145
|
[NumberArrayType]: 'number[]',
|
|
146
|
+
[SizeType]: 'size',
|
|
145
147
|
};
|
|
146
148
|
|
|
147
149
|
const namedTypes = Object.keys(typeNames).map(Number).sort(ascending);
|
|
@@ -285,7 +287,10 @@ export function parse(encoded, context, typeHint) {
|
|
|
285
287
|
return new LiteralExpression(BooleanType, encoded);
|
|
286
288
|
}
|
|
287
289
|
case 'number': {
|
|
288
|
-
return new LiteralExpression(
|
|
290
|
+
return new LiteralExpression(
|
|
291
|
+
typeHint === SizeType ? SizeType : NumberType,
|
|
292
|
+
encoded,
|
|
293
|
+
);
|
|
289
294
|
}
|
|
290
295
|
case 'string': {
|
|
291
296
|
let type = StringType;
|
|
@@ -322,7 +327,9 @@ export function parse(encoded, context, typeHint) {
|
|
|
322
327
|
}
|
|
323
328
|
|
|
324
329
|
let type = NumberArrayType;
|
|
325
|
-
if (encoded.length ===
|
|
330
|
+
if (encoded.length === 2) {
|
|
331
|
+
type |= SizeType;
|
|
332
|
+
} else if (encoded.length === 3 || encoded.length === 4) {
|
|
326
333
|
type |= ColorType;
|
|
327
334
|
}
|
|
328
335
|
if (typeHint) {
|
|
@@ -622,9 +629,11 @@ const parsers = {
|
|
|
622
629
|
),
|
|
623
630
|
[Ops.Array]: createParser(
|
|
624
631
|
(parsedArgs) => {
|
|
625
|
-
return parsedArgs.length ===
|
|
626
|
-
? NumberArrayType |
|
|
627
|
-
:
|
|
632
|
+
return parsedArgs.length === 2
|
|
633
|
+
? NumberArrayType | SizeType
|
|
634
|
+
: parsedArgs.length === 3 || parsedArgs.length === 4
|
|
635
|
+
? NumberArrayType | ColorType
|
|
636
|
+
: NumberArrayType;
|
|
628
637
|
},
|
|
629
638
|
withArgsCount(1, Infinity),
|
|
630
639
|
parseArgsOfType(NumberType),
|
package/expr/gpu.d.ts
CHANGED
|
@@ -18,6 +18,12 @@ export function arrayToGlsl(array: Array<number>): string;
|
|
|
18
18
|
* @return {string} The color expressed in the `vec4(1.0, 1.0, 1.0, 1.0)` form.
|
|
19
19
|
*/
|
|
20
20
|
export function colorToGlsl(color: string | import("../color.js").Color): string;
|
|
21
|
+
/**
|
|
22
|
+
* Normalizes and converts a number or array toa `vec2` array compatible with GLSL.
|
|
23
|
+
* @param {number|import('../size.js').Size} size Size.
|
|
24
|
+
* @return {string} The color expressed in the `vec4(1.0, 1.0, 1.0, 1.0)` form.
|
|
25
|
+
*/
|
|
26
|
+
export function sizeToGlsl(size: number | import('../size.js').Size): string;
|
|
21
27
|
/**
|
|
22
28
|
* Returns a stable equivalent number for the string literal.
|
|
23
29
|
* @param {string} string String literal value
|
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":"AAiCA;;;;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;AAED;;;;GAIG;AACH,iCAHW,MAAM,GAAC,OAAO,YAAY,EAAE,IAAI,GAC/B,MAAM,CAKjB;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;2BAnL9C,4BAA4B;+BAgBhD,iBAAiB"}
|
package/expr/gpu.js
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
NumberArrayType,
|
|
11
11
|
NumberType,
|
|
12
12
|
Ops,
|
|
13
|
+
SizeType,
|
|
13
14
|
StringType,
|
|
14
15
|
computeGeometryType,
|
|
15
16
|
isType,
|
|
@@ -19,6 +20,7 @@ import {
|
|
|
19
20
|
} from './expression.js';
|
|
20
21
|
import {Uniforms} from '../renderer/webgl/TileLayer.js';
|
|
21
22
|
import {asArray} from '../color.js';
|
|
23
|
+
import {toSize} from '../size.js';
|
|
22
24
|
|
|
23
25
|
/**
|
|
24
26
|
* @param {string} operator Operator
|
|
@@ -72,6 +74,16 @@ export function colorToGlsl(color) {
|
|
|
72
74
|
]);
|
|
73
75
|
}
|
|
74
76
|
|
|
77
|
+
/**
|
|
78
|
+
* Normalizes and converts a number or array toa `vec2` array compatible with GLSL.
|
|
79
|
+
* @param {number|import('../size.js').Size} size Size.
|
|
80
|
+
* @return {string} The color expressed in the `vec4(1.0, 1.0, 1.0, 1.0)` form.
|
|
81
|
+
*/
|
|
82
|
+
export function sizeToGlsl(size) {
|
|
83
|
+
const array = toSize(size);
|
|
84
|
+
return arrayToGlsl(array);
|
|
85
|
+
}
|
|
86
|
+
|
|
75
87
|
/** @type {Object<string, number>} */
|
|
76
88
|
const stringToFloatMap = {};
|
|
77
89
|
let stringToFloatCounter = 0;
|
|
@@ -485,6 +497,12 @@ function compile(expression, returnType, context) {
|
|
|
485
497
|
return arrayToGlsl(/** @type {Array<number>} */ (expression.value));
|
|
486
498
|
}
|
|
487
499
|
|
|
500
|
+
if ((expression.type & SizeType) > 0) {
|
|
501
|
+
return sizeToGlsl(
|
|
502
|
+
/** @type {number|import('../size.js').Size} */ (expression.value),
|
|
503
|
+
);
|
|
504
|
+
}
|
|
505
|
+
|
|
488
506
|
throw new Error(
|
|
489
507
|
`Unexpected expression ${expression.value} (expected type ${typeName(
|
|
490
508
|
returnType,
|
package/package.json
CHANGED
package/source/Cluster.d.ts
CHANGED
|
@@ -109,9 +109,9 @@ export type Options<FeatureType extends import("../Feature.js").FeatureLike> = {
|
|
|
109
109
|
*/
|
|
110
110
|
declare class Cluster<FeatureType extends import("../Feature.js").FeatureLike> extends VectorSource<Feature<import("../geom/Geometry.js").default>> {
|
|
111
111
|
/**
|
|
112
|
-
* @param {Options<FeatureType>} options Cluster options.
|
|
112
|
+
* @param {Options<FeatureType>} [options] Cluster options.
|
|
113
113
|
*/
|
|
114
|
-
constructor(options
|
|
114
|
+
constructor(options?: Options<FeatureType> | undefined);
|
|
115
115
|
/**
|
|
116
116
|
* @type {number|undefined}
|
|
117
117
|
* @protected
|
package/source/Cluster.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cluster.d.ts","sourceRoot":"","sources":["Cluster.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BA6BuB,WAAW,KAAE,CAAC,KAAK,CAAC;;;;;;;;;;;;;;4BAapB,KAAK,QAAE,MAAM,WAAW,CAAC,KAAE,OAAO;;;;;;;;;;AAxBzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH;;;;;;;;;;;;GAYG;AACH;IACE;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"Cluster.d.ts","sourceRoot":"","sources":["Cluster.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BA6BuB,WAAW,KAAE,CAAC,KAAK,CAAC;;;;;;;;;;;;;;4BAapB,KAAK,QAAE,MAAM,WAAW,CAAC,KAAE,OAAO;;;;;;;;;;AAxBzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH;;;;;;;;;;;;GAYG;AACH;IACE;;OAEG;IACH,wDAwEC;IAjEC;;;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,MAAM,OAAO,CAAC,CAGN;IAElB;;;;OAIG;IACH,mDAxFgC,CAAC,KAAK,CAAC,CAiGpC;IAEH;;;OAGG;IACH,6BAAiD;IAEjD;;;OAGG;IACH,kBAHU,aAAa,WAAW,CAAC,GAAC,IAAI,CAGtB;IAElB;;OAEG;IACH,sBAA4C;IAgB9C;;;;OAIG;IACH,eAHY,MAAM,CAKjB;IAED;;;;OAIG;IACH,aAHY,aAAa,WAAW,CAAC,GAAC,IAAI,CAKzC;IAeD;;;;OAIG;IACH,sBAHW,MAAM,QAKhB;IAED;;;;;OAKG;IACH,4BAHW,MAAM,QAKhB;IAED;;;;OAIG;IACH,kBAHY,MAAM,CAKjB;IAED;;;;OAIG;IACH,kBAHW,aAAa,WAAW,CAAC,GAAC,IAAI,QAYxC;IAWD;;;;OAIG;IACH,yBAHW,MAAM,eACN,MAAM,QAahB;IAED;;OAEG;IACH,0BAkCC;IAED;;;;;OAKG;IACH,kCALW,MAAM,WAAW,CAAC,UAClB,OAAO,cAAc,EAAE,MAAM,GAC5B,OAAO,CA2BlB;CACF;kBArUiB,kBAAkB;oBADhB,eAAe;yBAEV,aAAa"}
|
package/source/Cluster.js
CHANGED
|
@@ -71,9 +71,10 @@ import {getUid} from '../util.js';
|
|
|
71
71
|
*/
|
|
72
72
|
class Cluster extends VectorSource {
|
|
73
73
|
/**
|
|
74
|
-
* @param {Options<FeatureType>} options Cluster options.
|
|
74
|
+
* @param {Options<FeatureType>} [options] Cluster options.
|
|
75
75
|
*/
|
|
76
76
|
constructor(options) {
|
|
77
|
+
options = options || {};
|
|
77
78
|
super({
|
|
78
79
|
attributions: options.attributions,
|
|
79
80
|
wrapX: options.wrapX,
|
|
@@ -180,7 +181,7 @@ class Cluster extends VectorSource {
|
|
|
180
181
|
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
181
182
|
*/
|
|
182
183
|
loadFeatures(extent, resolution, projection) {
|
|
183
|
-
this.source
|
|
184
|
+
this.source?.loadFeatures(extent, resolution, projection);
|
|
184
185
|
if (resolution !== this.resolution) {
|
|
185
186
|
this.resolution = resolution;
|
|
186
187
|
this.refresh();
|
package/util.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styleparser.d.ts","sourceRoot":"","sources":["styleparser.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styleparser.d.ts","sourceRoot":"","sources":["styleparser.js"],"names":[],"mappings":"AAuBA;;;;;;;GAOG;AACH,qDALW,OAAO,gBAAgB,EAAE,kBAAkB,SAC3C,OAAO,uBAAuB,EAAE,iBAAiB,sCAEhD,MAAM,CAWjB;AAED;;;;GAIG;AACH,iCAHW,OAAO,aAAa,EAAE,KAAK,GAAC,MAAM,GACjC,MAAM,MAAM,CAAC,CASxB;AAqCD;;;;GAIG;AACH,mCAHW,MAAO,MAAM,GACZ,MAAM,CAOjB;AAgvBD;;;;;GAKG;AAEH;;;;;;;;;;GAUG;AACH,yCAHW,OAAO,mBAAmB,EAAE,UAAU,GACrC,gBAAgB,CAqJ3B;;;;;aAnKa,aAAa;;;;cACb,OAAO,wCAAwC,EAAE,kBAAkB;;;;gBACnE,OAAO,wCAAwC,EAAE,oBAAoB;;8BA50BvD,oBAAoB"}
|
package/webgl/styleparser.js
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
ColorType,
|
|
8
8
|
NumberArrayType,
|
|
9
9
|
NumberType,
|
|
10
|
+
SizeType,
|
|
10
11
|
StringType,
|
|
11
12
|
newParsingContext,
|
|
12
13
|
} from '../expr/expression.js';
|
|
@@ -67,7 +68,7 @@ const UNPACK_COLOR_FN = `vec4 unpackColor(vec2 packedColor) {
|
|
|
67
68
|
* @return {1|2|3|4} The amount of components for this value
|
|
68
69
|
*/
|
|
69
70
|
function getGlslSizeFromType(type) {
|
|
70
|
-
if (type === ColorType) {
|
|
71
|
+
if (type === ColorType || type === SizeType) {
|
|
71
72
|
return 2;
|
|
72
73
|
}
|
|
73
74
|
if (type === NumberArrayType) {
|
|
@@ -134,7 +135,7 @@ function parseCommonSymbolProperties(style, builder, vertContext, prefix) {
|
|
|
134
135
|
const scale = expressionToGlsl(
|
|
135
136
|
vertContext,
|
|
136
137
|
style[`${prefix}scale`],
|
|
137
|
-
|
|
138
|
+
SizeType,
|
|
138
139
|
);
|
|
139
140
|
builder.setSymbolSizeExpression(
|
|
140
141
|
`${builder.getSymbolSizeExpression()} * ${scale}`,
|
|
@@ -301,7 +302,7 @@ function parseCircleProperties(
|
|
|
301
302
|
const scale = expressionToGlsl(
|
|
302
303
|
fragContext,
|
|
303
304
|
style['circle-scale'],
|
|
304
|
-
|
|
305
|
+
SizeType,
|
|
305
306
|
);
|
|
306
307
|
currentPoint = `coordsPx / ${scale}`;
|
|
307
308
|
}
|
|
@@ -420,11 +421,7 @@ function parseShapeProperties(
|
|
|
420
421
|
// SCALE
|
|
421
422
|
let currentPoint = 'coordsPx';
|
|
422
423
|
if ('shape-scale' in style) {
|
|
423
|
-
const scale = expressionToGlsl(
|
|
424
|
-
fragContext,
|
|
425
|
-
style['shape-scale'],
|
|
426
|
-
NumberType | NumberArrayType,
|
|
427
|
-
);
|
|
424
|
+
const scale = expressionToGlsl(fragContext, style['shape-scale'], SizeType);
|
|
428
425
|
currentPoint = `coordsPx / ${scale}`;
|
|
429
426
|
}
|
|
430
427
|
|
|
@@ -584,11 +581,7 @@ function parseIconProperties(
|
|
|
584
581
|
);
|
|
585
582
|
let scale = `1.0`;
|
|
586
583
|
if (`icon-scale` in style) {
|
|
587
|
-
scale = expressionToGlsl(
|
|
588
|
-
vertContext,
|
|
589
|
-
style[`icon-scale`],
|
|
590
|
-
NumberType | NumberArrayType,
|
|
591
|
-
);
|
|
584
|
+
scale = expressionToGlsl(vertContext, style[`icon-scale`], SizeType);
|
|
592
585
|
}
|
|
593
586
|
let shiftPx;
|
|
594
587
|
if (
|