ol 10.7.1-dev.1763485375947 → 10.7.1-dev.1763628189598

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ol",
3
- "version": "10.7.1-dev.1763485375947",
3
+ "version": "10.7.1-dev.1763628189598",
4
4
  "description": "OpenLayers mapping library",
5
5
  "keywords": [
6
6
  "map",
@@ -823,7 +823,18 @@ function buildShape(flatStyle, context) {
823
823
  const pointsName = prefix + 'points';
824
824
  const radiusName = prefix + 'radius';
825
825
  const points = requireNumber(flatStyle[pointsName], pointsName);
826
- const radius = requireNumber(flatStyle[radiusName], radiusName);
826
+ if (!(radiusName in flatStyle)) {
827
+ throw new Error(`Expected a number for ${radiusName}`);
828
+ }
829
+ const evaluateRadius = numberEvaluator(flatStyle, radiusName, context);
830
+ const initialRadius =
831
+ typeof flatStyle[radiusName] === 'number' ? flatStyle[radiusName] : 5;
832
+ const radius2Name = prefix + 'radius2';
833
+ const evaluateRadius2 = numberEvaluator(flatStyle, radius2Name, context);
834
+ const initialRadius2 =
835
+ typeof flatStyle[radius2Name] === 'number'
836
+ ? flatStyle[radius2Name]
837
+ : undefined;
827
838
 
828
839
  // settable properties
829
840
  const evaluateFill = buildFill(flatStyle, prefix, context);
@@ -846,7 +857,6 @@ function buildShape(flatStyle, context) {
846
857
  );
847
858
 
848
859
  // the remaining properties are not currently settable
849
- const radius2 = optionalNumber(flatStyle, prefix + 'radius2');
850
860
  const angle = optionalNumber(flatStyle, prefix + 'angle');
851
861
  const declutterMode = optionalDeclutterMode(
852
862
  flatStyle,
@@ -855,13 +865,19 @@ function buildShape(flatStyle, context) {
855
865
 
856
866
  const shape = new RegularShape({
857
867
  points,
858
- radius,
859
- radius2,
868
+ radius: initialRadius,
869
+ radius2: initialRadius2,
860
870
  angle,
861
871
  declutterMode,
862
872
  });
863
873
 
864
874
  return function (context) {
875
+ if (evaluateRadius) {
876
+ shape.setRadius(evaluateRadius(context));
877
+ }
878
+ if (evaluateRadius2) {
879
+ shape.setRadius2(evaluateRadius2(context));
880
+ }
865
881
  if (evaluateFill) {
866
882
  shape.setFill(evaluateFill(context));
867
883
  }
@@ -952,6 +968,19 @@ function buildCircle(flatStyle, context) {
952
968
  };
953
969
  }
954
970
 
971
+ /**
972
+ * @param {FlatStyle} flatStyle The flat style.
973
+ * @param {string} name The property name.
974
+ * @return {any|undefined} The encoded value, or undefined if not provided.
975
+ */
976
+ function getExpressionValue(flatStyle, name) {
977
+ if (!(name in flatStyle)) {
978
+ return undefined;
979
+ }
980
+ const value = flatStyle[name];
981
+ return value === undefined ? undefined : value;
982
+ }
983
+
955
984
  /**
956
985
  * @param {FlatStyle} flatStyle The flat style.
957
986
  * @param {string} name The property name.
@@ -959,10 +988,11 @@ function buildCircle(flatStyle, context) {
959
988
  * @return {import('../../expr/cpu.js').NumberEvaluator|undefined} The expression evaluator or undefined.
960
989
  */
961
990
  function numberEvaluator(flatStyle, name, context) {
962
- if (!(name in flatStyle)) {
991
+ const encoded = getExpressionValue(flatStyle, name);
992
+ if (encoded === undefined) {
963
993
  return undefined;
964
994
  }
965
- const evaluator = buildExpression(flatStyle[name], NumberType, context);
995
+ const evaluator = buildExpression(encoded, NumberType, context);
966
996
  return function (context) {
967
997
  return requireNumber(evaluator(context), name);
968
998
  };
@@ -975,10 +1005,11 @@ function numberEvaluator(flatStyle, name, context) {
975
1005
  * @return {import('../../expr/cpu.js').StringEvaluator?} The expression evaluator.
976
1006
  */
977
1007
  function stringEvaluator(flatStyle, name, context) {
978
- if (!(name in flatStyle)) {
1008
+ const encoded = getExpressionValue(flatStyle, name);
1009
+ if (encoded === undefined) {
979
1010
  return null;
980
1011
  }
981
- const evaluator = buildExpression(flatStyle[name], StringType, context);
1012
+ const evaluator = buildExpression(encoded, StringType, context);
982
1013
  return function (context) {
983
1014
  return requireString(evaluator(context), name);
984
1015
  };
@@ -1022,10 +1053,11 @@ function patternEvaluator(flatStyle, prefix, context) {
1022
1053
  * @return {import('../../expr/cpu.js').BooleanEvaluator?} The expression evaluator.
1023
1054
  */
1024
1055
  function booleanEvaluator(flatStyle, name, context) {
1025
- if (!(name in flatStyle)) {
1056
+ const encoded = getExpressionValue(flatStyle, name);
1057
+ if (encoded === undefined) {
1026
1058
  return null;
1027
1059
  }
1028
- const evaluator = buildExpression(flatStyle[name], BooleanType, context);
1060
+ const evaluator = buildExpression(encoded, BooleanType, context);
1029
1061
  return function (context) {
1030
1062
  const value = evaluator(context);
1031
1063
  if (typeof value !== 'boolean') {
@@ -1042,10 +1074,11 @@ function booleanEvaluator(flatStyle, name, context) {
1042
1074
  * @return {import('../../expr/cpu.js').ColorLikeEvaluator?} The expression evaluator.
1043
1075
  */
1044
1076
  function colorLikeEvaluator(flatStyle, name, context) {
1045
- if (!(name in flatStyle)) {
1077
+ const encoded = getExpressionValue(flatStyle, name);
1078
+ if (encoded === undefined) {
1046
1079
  return null;
1047
1080
  }
1048
- const evaluator = buildExpression(flatStyle[name], ColorType, context);
1081
+ const evaluator = buildExpression(encoded, ColorType, context);
1049
1082
  return function (context) {
1050
1083
  return requireColorLike(evaluator(context), name);
1051
1084
  };
@@ -1058,10 +1091,33 @@ function colorLikeEvaluator(flatStyle, name, context) {
1058
1091
  * @return {import('../../expr/cpu.js').NumberArrayEvaluator?} The expression evaluator.
1059
1092
  */
1060
1093
  function numberArrayEvaluator(flatStyle, name, context) {
1061
- if (!(name in flatStyle)) {
1094
+ const encoded = getExpressionValue(flatStyle, name);
1095
+ if (encoded === undefined) {
1062
1096
  return null;
1063
1097
  }
1064
- const evaluator = buildExpression(flatStyle[name], NumberArrayType, context);
1098
+ if (
1099
+ Array.isArray(encoded) &&
1100
+ (encoded.length === 0 || typeof encoded[0] !== 'string')
1101
+ ) {
1102
+ /** @type {Array<import('../../expr/cpu.js').NumberEvaluator>} */
1103
+ const evaluators = encoded.map((value, index) => {
1104
+ if (typeof value === 'number') {
1105
+ return () => value;
1106
+ }
1107
+ const evaluator = buildExpression(value, NumberType, context);
1108
+ return function (context) {
1109
+ return requireNumber(evaluator(context), `${name}[${index}]`);
1110
+ };
1111
+ });
1112
+ return function (context) {
1113
+ const array = new Array(evaluators.length);
1114
+ for (let i = 0; i < evaluators.length; ++i) {
1115
+ array[i] = evaluators[i](context);
1116
+ }
1117
+ return array;
1118
+ };
1119
+ }
1120
+ const evaluator = buildExpression(encoded, NumberArrayType, context);
1065
1121
  return function (context) {
1066
1122
  return requireNumberArray(evaluator(context), name);
1067
1123
  };
@@ -1074,10 +1130,11 @@ function numberArrayEvaluator(flatStyle, name, context) {
1074
1130
  * @return {import('../../expr/cpu.js').CoordinateEvaluator?} The expression evaluator.
1075
1131
  */
1076
1132
  function coordinateEvaluator(flatStyle, name, context) {
1077
- if (!(name in flatStyle)) {
1133
+ const encoded = getExpressionValue(flatStyle, name);
1134
+ if (encoded === undefined) {
1078
1135
  return null;
1079
1136
  }
1080
- const evaluator = buildExpression(flatStyle[name], NumberArrayType, context);
1137
+ const evaluator = buildExpression(encoded, NumberArrayType, context);
1081
1138
  return function (context) {
1082
1139
  const array = requireNumberArray(evaluator(context), name);
1083
1140
  if (array.length !== 2) {
@@ -1094,10 +1151,11 @@ function coordinateEvaluator(flatStyle, name, context) {
1094
1151
  * @return {import('../../expr/cpu.js').SizeEvaluator?} The expression evaluator.
1095
1152
  */
1096
1153
  function sizeEvaluator(flatStyle, name, context) {
1097
- if (!(name in flatStyle)) {
1154
+ const encoded = getExpressionValue(flatStyle, name);
1155
+ if (encoded === undefined) {
1098
1156
  return null;
1099
1157
  }
1100
- const evaluator = buildExpression(flatStyle[name], NumberArrayType, context);
1158
+ const evaluator = buildExpression(encoded, NumberArrayType, context);
1101
1159
  return function (context) {
1102
1160
  return requireSize(evaluator(context), name);
1103
1161
  };
@@ -1110,11 +1168,12 @@ function sizeEvaluator(flatStyle, name, context) {
1110
1168
  * @return {import('../../expr/cpu.js').SizeLikeEvaluator?} The expression evaluator.
1111
1169
  */
1112
1170
  function sizeLikeEvaluator(flatStyle, name, context) {
1113
- if (!(name in flatStyle)) {
1171
+ const encoded = getExpressionValue(flatStyle, name);
1172
+ if (encoded === undefined) {
1114
1173
  return null;
1115
1174
  }
1116
1175
  const evaluator = buildExpression(
1117
- flatStyle[name],
1176
+ encoded,
1118
1177
  NumberArrayType | NumberType,
1119
1178
  context,
1120
1179
  );
package/style/Circle.d.ts CHANGED
@@ -60,20 +60,6 @@ declare class CircleStyle extends RegularShape {
60
60
  * @param {Options} [options] Options.
61
61
  */
62
62
  constructor(options?: Options);
63
- /**
64
- * Clones the style.
65
- * @return {CircleStyle} The cloned style.
66
- * @api
67
- * @override
68
- */
69
- override clone(): CircleStyle;
70
- /**
71
- * Set the circle radius.
72
- *
73
- * @param {number} radius Circle radius.
74
- * @api
75
- */
76
- setRadius(radius: number): void;
77
63
  }
78
64
  import RegularShape from './RegularShape.js';
79
65
  //# sourceMappingURL=Circle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Circle.d.ts","sourceRoot":"","sources":["Circle.js"],"names":[],"mappings":";;;;;;;;;YASc,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAHpB;;;;;;;;;;;;;GAaG;AAEH;;;;GAIG;AACH;IACE;;OAEG;IACH,sBAFW,OAAO,EAkBjB;IAED;;;;;OAKG;IACH,kBAJY,WAAW,CAkBtB;IAED;;;;;OAKG;IACH,kBAHW,MAAM,QAMhB;CACF;yBA5EwB,mBAAmB"}
1
+ {"version":3,"file":"Circle.d.ts","sourceRoot":"","sources":["Circle.js"],"names":[],"mappings":";;;;;;;;;YASc,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAHpB;;;;;;;;;;;;;GAaG;AAEH;;;;GAIG;AACH;IACE;;OAEG;IACH,sBAFW,OAAO,EAkBjB;CAuBF;yBAjEwB,mBAAmB"}
package/style/Circle.js CHANGED
@@ -67,17 +67,6 @@ class CircleStyle extends RegularShape {
67
67
  style.setOpacity(this.getOpacity());
68
68
  return style;
69
69
  }
70
-
71
- /**
72
- * Set the circle radius.
73
- *
74
- * @param {number} radius Circle radius.
75
- * @api
76
- */
77
- setRadius(radius) {
78
- this.radius = radius;
79
- this.render();
80
- }
81
70
  }
82
71
 
83
72
  export default CircleStyle;
@@ -230,12 +230,24 @@ declare class RegularShape extends ImageStyle {
230
230
  * @api
231
231
  */
232
232
  getRadius(): number;
233
+ /**
234
+ * Set the (primary) radius for the shape.
235
+ * @param {number} radius Radius.
236
+ * @api
237
+ */
238
+ setRadius(radius: number): void;
233
239
  /**
234
240
  * Get the secondary radius for the shape.
235
241
  * @return {number|undefined} Radius2.
236
242
  * @api
237
243
  */
238
244
  getRadius2(): number | undefined;
245
+ /**
246
+ * Set the secondary radius for the shape.
247
+ * @param {number|undefined} radius2 Radius2.
248
+ * @api
249
+ */
250
+ setRadius2(radius2: number | undefined): void;
239
251
  /**
240
252
  * Get the stroke style for the shape.
241
253
  * @return {import("./Stroke.js").default|null} Stroke style.
@@ -1 +1 @@
1
- {"version":3,"file":"RegularShape.d.ts","sourceRoot":"","sources":["RegularShape.js"],"names":[],"mappings":";;;;;;;;;;;;;YAwBc,MAAM;;;;YAEN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAeN,OAAO,iBAAiB,EAAE,SAAS,GAAC,SAAS;;;;iBAC7C,MAAM;;;;UACN,MAAM;;;;aACN,aAAa;;;;cACb,KAAK,CAAC,MAAM,CAAC,GAAC,IAAI;;;;oBAClB,MAAM;;;;cACN,cAAc;;;;gBACd,MAAM;;AA5BpB;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;GAMG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,EAqFjB;IAvEC;;;OAGG;IACH,4BAA+B;IAE/B;;;OAGG;IACH,cAA6D;IAE7D;;;OAGG;IACH,gBAAqB;IAErB;;;OAGG;IACH,gBAA6B;IAE7B;;;OAGG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AIG;IACH,kBAHW,OAAO,aAAa,EAAE,OAAO,GAAC,IAAI,QAM5C;IAoBD;;;;;;;OAOG;IACH,+BAgFC;IAED;;;OAGG;IACH,iCAHY,aAAa,CAoCxB;IAED;;OAEG;IACH,yBAKC;IAED;;;;;OAKG;IACH,cA2BC;IAED;;;;OAIG;IACH,kCAuBC;IAED;;;OAGG;IACH,oBAmBC;IAED;;;;OAIG;IACH,gCAmBC;CAQF;uBAnoBsB,YAAY"}
@@ -316,6 +316,19 @@ class RegularShape extends ImageStyle {
316
316
  return this.radius;
317
317
  }
318
318
 
319
+ /**
320
+ * Set the (primary) radius for the shape.
321
+ * @param {number} radius Radius.
322
+ * @api
323
+ */
324
+ setRadius(radius) {
325
+ if (this.radius === radius) {
326
+ return;
327
+ }
328
+ this.radius = radius;
329
+ this.render();
330
+ }
331
+
319
332
  /**
320
333
  * Get the secondary radius for the shape.
321
334
  * @return {number|undefined} Radius2.
@@ -325,6 +338,19 @@ class RegularShape extends ImageStyle {
325
338
  return this.radius2_;
326
339
  }
327
340
 
341
+ /**
342
+ * Set the secondary radius for the shape.
343
+ * @param {number|undefined} radius2 Radius2.
344
+ * @api
345
+ */
346
+ setRadius2(radius2) {
347
+ if (this.radius2_ === radius2) {
348
+ return;
349
+ }
350
+ this.radius2_ = radius2;
351
+ this.render();
352
+ }
353
+
328
354
  /**
329
355
  * Get the size of the symbolizer (in pixels).
330
356
  * @return {import("../size.js").Size} Size.
package/util.js CHANGED
@@ -33,4 +33,4 @@ export function getUid(obj) {
33
33
  * OpenLayers version.
34
34
  * @type {string}
35
35
  */
36
- export const VERSION = '10.7.1-dev.1763485375947';
36
+ export const VERSION = '10.7.1-dev.1763628189598';