ol 10.7.1-dev.1765787011335 → 10.7.1-dev.1766142301376
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/package.json +1 -1
- package/render/canvas/style.js +29 -17
- package/source/GeoTIFF.d.ts +5 -0
- package/source/GeoTIFF.d.ts.map +1 -1
- package/source/GeoTIFF.js +2 -0
- package/style/Icon.d.ts +10 -0
- package/style/Icon.d.ts.map +1 -1
- package/style/Icon.js +36 -0
- package/util.js +1 -1
package/package.json
CHANGED
package/render/canvas/style.js
CHANGED
|
@@ -756,7 +756,20 @@ function buildIcon(flatStyle, context) {
|
|
|
756
756
|
flatStyle,
|
|
757
757
|
prefix + 'anchor-y-units',
|
|
758
758
|
);
|
|
759
|
-
const
|
|
759
|
+
const colorValue = getExpressionValue(flatStyle, prefix + 'color');
|
|
760
|
+
let color;
|
|
761
|
+
let evaluateColor = null;
|
|
762
|
+
if (colorValue !== undefined) {
|
|
763
|
+
const isColorExpression =
|
|
764
|
+
Array.isArray(colorValue) &&
|
|
765
|
+
colorValue.length > 0 &&
|
|
766
|
+
typeof colorValue[0] === 'string';
|
|
767
|
+
if (isColorExpression) {
|
|
768
|
+
evaluateColor = colorLikeEvaluator(flatStyle, prefix + 'color', context);
|
|
769
|
+
} else {
|
|
770
|
+
color = requireColorLike(colorValue, prefix + 'color');
|
|
771
|
+
}
|
|
772
|
+
}
|
|
760
773
|
const crossOrigin = optionalString(flatStyle, prefix + 'cross-origin');
|
|
761
774
|
const offset = optionalNumberArray(flatStyle, prefix + 'offset');
|
|
762
775
|
const offsetOrigin = optionalIconOrigin(flatStyle, prefix + 'offset-origin');
|
|
@@ -768,12 +781,11 @@ function buildIcon(flatStyle, context) {
|
|
|
768
781
|
prefix + 'declutter-mode',
|
|
769
782
|
);
|
|
770
783
|
|
|
771
|
-
const
|
|
784
|
+
const iconOptions = {
|
|
772
785
|
src,
|
|
773
786
|
anchorOrigin,
|
|
774
787
|
anchorXUnits,
|
|
775
788
|
anchorYUnits,
|
|
776
|
-
color,
|
|
777
789
|
crossOrigin,
|
|
778
790
|
offset,
|
|
779
791
|
offsetOrigin,
|
|
@@ -781,9 +793,22 @@ function buildIcon(flatStyle, context) {
|
|
|
781
793
|
width,
|
|
782
794
|
size,
|
|
783
795
|
declutterMode,
|
|
784
|
-
}
|
|
796
|
+
};
|
|
797
|
+
|
|
798
|
+
let icon = null;
|
|
785
799
|
|
|
786
800
|
return function (context) {
|
|
801
|
+
if (!icon) {
|
|
802
|
+
// lazily create the icon to allow for expression evaluation
|
|
803
|
+
const initialColor = evaluateColor ? evaluateColor(context) : color;
|
|
804
|
+
icon = new Icon(
|
|
805
|
+
initialColor !== undefined
|
|
806
|
+
? Object.assign({}, iconOptions, {color: initialColor})
|
|
807
|
+
: Object.assign({}, iconOptions),
|
|
808
|
+
);
|
|
809
|
+
} else if (evaluateColor) {
|
|
810
|
+
icon.setColor(evaluateColor(context));
|
|
811
|
+
}
|
|
787
812
|
if (evaluateOpacity) {
|
|
788
813
|
icon.setOpacity(evaluateOpacity(context));
|
|
789
814
|
}
|
|
@@ -1311,19 +1336,6 @@ function optionalDeclutterMode(flatStyle, property) {
|
|
|
1311
1336
|
return encoded;
|
|
1312
1337
|
}
|
|
1313
1338
|
|
|
1314
|
-
/**
|
|
1315
|
-
* @param {FlatStyle} flatStyle The flat style.
|
|
1316
|
-
* @param {string} property The symbolizer property.
|
|
1317
|
-
* @return {string|Array<number>|undefined} A string or an array of color values or undefined.
|
|
1318
|
-
*/
|
|
1319
|
-
function optionalColorLike(flatStyle, property) {
|
|
1320
|
-
const encoded = flatStyle[property];
|
|
1321
|
-
if (encoded === undefined) {
|
|
1322
|
-
return undefined;
|
|
1323
|
-
}
|
|
1324
|
-
return requireColorLike(encoded, property);
|
|
1325
|
-
}
|
|
1326
|
-
|
|
1327
1339
|
/**
|
|
1328
1340
|
* @param {any} value The value.
|
|
1329
1341
|
* @param {string} property The property.
|
package/source/GeoTIFF.d.ts
CHANGED
|
@@ -123,6 +123,10 @@ export type GeoTIFFSourceOptions = {
|
|
|
123
123
|
cacheSize?: number | undefined;
|
|
124
124
|
};
|
|
125
125
|
export type Options = {
|
|
126
|
+
/**
|
|
127
|
+
* Attributions.
|
|
128
|
+
*/
|
|
129
|
+
attributions?: import("./Source.js").AttributionLike | undefined;
|
|
126
130
|
/**
|
|
127
131
|
* List of information about GeoTIFF sources.
|
|
128
132
|
* Multiple sources can be combined when their resolution sets are equal after applying a scale.
|
|
@@ -187,6 +191,7 @@ export type Options = {
|
|
|
187
191
|
*/
|
|
188
192
|
/**
|
|
189
193
|
* @typedef {Object} Options
|
|
194
|
+
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
|
|
190
195
|
* @property {Array<SourceInfo>} sources List of information about GeoTIFF sources.
|
|
191
196
|
* Multiple sources can be combined when their resolution sets are equal after applying a scale.
|
|
192
197
|
* The list of sources defines a mapping between input bands as they are read from each GeoTIFF and
|
package/source/GeoTIFF.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeoTIFF.d.ts","sourceRoot":"","sources":["GeoTIFF.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA2Fc,MAAM;;;;wBACN,MAAM;;;;4BACN,MAAM;;;;6BACN,MAAM;;;;6BACN,MAAM;;;;0BACN,MAAM;;;;2BACN,MAAM;;;;2BACN,MAAM;;sBAIP,OAAO,SAAS,EAAE,OAAO;2BAIzB,OAAO,SAAS,EAAE,YAAY;;;;;wBAK7B,MAAM;;;;wBACN,MAAM;;2BASP,OAAO,SAAS,EAAE,YAAY
|
|
1
|
+
{"version":3,"file":"GeoTIFF.d.ts","sourceRoot":"","sources":["GeoTIFF.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA2Fc,MAAM;;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|
@@ -348,6 +348,7 @@ function getMaxForDataType(array) {
|
|
|
348
348
|
|
|
349
349
|
/**
|
|
350
350
|
* @typedef {Object} Options
|
|
351
|
+
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
|
|
351
352
|
* @property {Array<SourceInfo>} sources List of information about GeoTIFF sources.
|
|
352
353
|
* Multiple sources can be combined when their resolution sets are equal after applying a scale.
|
|
353
354
|
* The list of sources defines a mapping between input bands as they are read from each GeoTIFF and
|
|
@@ -388,6 +389,7 @@ class GeoTIFFSource extends DataTile {
|
|
|
388
389
|
*/
|
|
389
390
|
constructor(options) {
|
|
390
391
|
super({
|
|
392
|
+
attributions: options.attributions,
|
|
391
393
|
state: 'loading',
|
|
392
394
|
tileGrid: null,
|
|
393
395
|
projection: options.projection || null,
|
package/style/Icon.d.ts
CHANGED
|
@@ -189,6 +189,16 @@ declare class Icon extends ImageStyle {
|
|
|
189
189
|
* @api
|
|
190
190
|
*/
|
|
191
191
|
getColor(): import("../color.js").Color;
|
|
192
|
+
/**
|
|
193
|
+
* Set the icon color.
|
|
194
|
+
*
|
|
195
|
+
* Warning: Repeatedly setting the color on an icon style
|
|
196
|
+
* causes the icon image to be re-created each time. This can have a
|
|
197
|
+
* severe performance impact.
|
|
198
|
+
*
|
|
199
|
+
* @param {import("../color.js").Color|string|null|undefined} color Color.
|
|
200
|
+
*/
|
|
201
|
+
setColor(color: import("../color.js").Color | string | null | undefined): void;
|
|
192
202
|
/**
|
|
193
203
|
* Get the image icon.
|
|
194
204
|
* @param {number} pixelRatio Pixel ratio.
|
package/style/Icon.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["Icon.js"],"names":[],"mappings":";;;;8BAYa,UAAU,GAAG,QAAQ;;;;yBAKrB,aAAa,GAAG,cAAc,GAAG,UAAU,GAAG,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AA2DtE;;;;GAIG;AACH;IACE;;OAEG;IACH,sBAFW,OAAO,EA0MjB;IAtKC;;;OAGG;IACH,gBAAyE;IAEzE;;;OAGG;IACH,0BAA6B;IAE7B;;;OAGG;IACH,sBACwE;IAExE;;;OAGG;IACH,sBACwE;IAExE;;;OAGG;IACH,sBACwE;IAExE;;;OAGG;IACH,qBACgE;IA0ChE;;;OAGG;IACH,eAAyE;IAEzE;;;OAGG;IACH,mBAMC;IAED;;;OAGG;IACH,gBAAqE;IACrE;;;OAGG;IACH,sBACwE;IAExE;;;OAGG;IACH,gBAAmB;IAEnB;;;OAGG;IACH,cAA6D;IAoBvD,qCAA8B;IA4BtC;;;;;OAKG;IACH,kBAJY,IAAI,CAoCf;IA8DD;;;;;;OAMG;IACH,kBAHW,KAAK,CAAC,MAAM,CAAC,QAMvB;IAED;;;;OAIG;IACH,YAHY,OAAO,aAAa,EAAE,KAAK,CAKtC;IAED;;;;;;;;OAQG;IACH,gBAFW,OAAO,aAAa,EAAE,KAAK,GAAC,MAAM,GAAC,IAAI,GAAC,SAAS,QA2B3D;IAED;;;;;;;OAOG;IACH,8BANW,MAAM,GACL,gBAAgB,GAAC,iBAAiB,GAAC,eAAe,GAAC,WAAW,CAOzE;IA6BD;;;OAGG;IACH,iCAHY,gBAAgB,GAAC,iBAAiB,GAAC,eAAe,GAAC,WAAW,CAKzE;IAsCD;;;;OAIG;IACH,UAHY,MAAM,GAAC,SAAS,CAK3B;IAED;;;;OAIG;IACH,YAHW,MAAM,QAWhB;IAYD;;;;OAIG;IACH,YAHY,MAAM,CAYjB;IAED;;;;OAIG;IACH,aAHY,MAAM,CAYjB;CAgDF;uBAtnBsB,YAAY"}
|
package/style/Icon.js
CHANGED
|
@@ -406,6 +406,42 @@ class Icon extends ImageStyle {
|
|
|
406
406
|
return this.color_;
|
|
407
407
|
}
|
|
408
408
|
|
|
409
|
+
/**
|
|
410
|
+
* Set the icon color.
|
|
411
|
+
*
|
|
412
|
+
* Warning: Repeatedly setting the color on an icon style
|
|
413
|
+
* causes the icon image to be re-created each time. This can have a
|
|
414
|
+
* severe performance impact.
|
|
415
|
+
*
|
|
416
|
+
* @param {import("../color.js").Color|string|null|undefined} color Color.
|
|
417
|
+
*/
|
|
418
|
+
setColor(color) {
|
|
419
|
+
const nextColor = color ? asArray(color) : null;
|
|
420
|
+
if (
|
|
421
|
+
this.color_ === nextColor ||
|
|
422
|
+
(this.color_ &&
|
|
423
|
+
nextColor &&
|
|
424
|
+
this.color_.length === nextColor.length &&
|
|
425
|
+
this.color_.every((value, index) => value === nextColor[index]))
|
|
426
|
+
) {
|
|
427
|
+
// Discard if the color hasn't changed.
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
this.color_ = nextColor;
|
|
432
|
+
const src = this.getSrc();
|
|
433
|
+
const image = src !== undefined ? null : this.getHitDetectionImage();
|
|
434
|
+
const imageState =
|
|
435
|
+
src !== undefined ? ImageState.IDLE : this.iconImage_.getImageState();
|
|
436
|
+
this.iconImage_ = getIconImage(
|
|
437
|
+
image,
|
|
438
|
+
src,
|
|
439
|
+
this.crossOrigin_,
|
|
440
|
+
imageState,
|
|
441
|
+
this.color_,
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
|
|
409
445
|
/**
|
|
410
446
|
* Get the image icon.
|
|
411
447
|
* @param {number} pixelRatio Pixel ratio.
|
package/util.js
CHANGED