ol 7.1.1-pr.14101.2 → 7.2.0
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/AssertionError.d.ts.map +1 -1
- package/AssertionError.js +1 -0
- package/DataTile.d.ts +34 -11
- package/DataTile.d.ts.map +1 -1
- package/DataTile.js +84 -7
- package/Feature.d.ts +3 -3
- package/Feature.js +3 -3
- package/Geolocation.d.ts +34 -27
- package/Geolocation.d.ts.map +1 -1
- package/Geolocation.js +30 -12
- package/Map.d.ts +19 -6
- package/Map.d.ts.map +1 -1
- package/Map.js +70 -43
- package/MapBrowserEventHandler.d.ts.map +1 -1
- package/MapBrowserEventHandler.js +9 -13
- package/Overlay.d.ts +1 -1
- package/Overlay.js +1 -1
- package/README.md +9 -1
- package/Tile.d.ts +2 -2
- package/Tile.js +1 -1
- package/TileCache.d.ts.map +1 -1
- package/TileCache.js +6 -8
- package/array.d.ts +2 -2
- package/array.d.ts.map +1 -1
- package/array.js +4 -4
- package/console.d.ts +13 -0
- package/console.d.ts.map +1 -0
- package/console.js +54 -0
- package/control/MousePosition.d.ts +12 -0
- package/control/MousePosition.d.ts.map +1 -1
- package/control/MousePosition.js +14 -0
- package/coordinate.d.ts +11 -11
- package/coordinate.js +11 -11
- package/dist/ol.js +1 -3
- package/dist/ol.js.map +1 -1
- package/featureloader.d.ts.map +1 -1
- package/featureloader.js +0 -1
- package/format/KML.js +3 -1
- package/geom/flat/interiorpoint.js +2 -2
- package/interaction/DragPan.d.ts.map +1 -1
- package/interaction/DragPan.js +3 -2
- package/interaction/Draw.d.ts.map +1 -1
- package/interaction/Draw.js +11 -14
- package/interaction/KeyboardPan.d.ts.map +1 -1
- package/interaction/KeyboardPan.js +0 -1
- package/interaction/KeyboardZoom.d.ts.map +1 -1
- package/interaction/KeyboardZoom.js +0 -1
- package/interaction/Link.d.ts +14 -0
- package/interaction/Link.d.ts.map +1 -1
- package/interaction/Link.js +37 -6
- package/interaction/Modify.d.ts +10 -10
- package/interaction/Modify.d.ts.map +1 -1
- package/interaction/Modify.js +15 -15
- package/interaction/PinchRotate.d.ts.map +1 -1
- package/interaction/PinchRotate.js +3 -5
- package/interaction/PinchZoom.d.ts.map +1 -1
- package/interaction/PinchZoom.js +3 -5
- package/interaction/Pointer.d.ts +5 -2
- package/interaction/Pointer.d.ts.map +1 -1
- package/interaction/Pointer.js +2 -2
- package/interaction/Select.d.ts.map +1 -1
- package/interaction/Select.js +4 -5
- package/interaction/Snap.d.ts +1 -1
- package/interaction/Snap.d.ts.map +1 -1
- package/interaction/Snap.js +17 -23
- package/interaction/Translate.d.ts +12 -11
- package/interaction/Translate.d.ts.map +1 -1
- package/interaction/Translate.js +16 -13
- package/layer/BaseVector.js +1 -1
- package/layer/Graticule.d.ts.map +1 -1
- package/layer/Graticule.js +4 -4
- package/layer/Heatmap.js +10 -10
- package/layer/Layer.d.ts +2 -2
- package/layer/Layer.d.ts.map +1 -1
- package/layer/Layer.js +2 -2
- package/layer/VectorTile.js +1 -1
- package/package.json +2 -2
- package/proj.d.ts +2 -4
- package/proj.d.ts.map +1 -1
- package/proj.js +4 -6
- package/render/canvas/ExecutorGroup.d.ts.map +1 -1
- package/render/canvas/ExecutorGroup.js +6 -4
- package/render/canvas/Immediate.d.ts +5 -0
- package/render/canvas/Immediate.d.ts.map +1 -1
- package/render/canvas/Immediate.js +15 -0
- package/render/canvas/hitdetect.d.ts +4 -3
- package/render/canvas/hitdetect.d.ts.map +1 -1
- package/render/canvas/hitdetect.js +23 -11
- package/render/webgl/BatchRenderer.d.ts.map +1 -1
- package/render/webgl/BatchRenderer.js +2 -3
- package/render/webgl/LineStringBatchRenderer.d.ts.map +1 -1
- package/render/webgl/LineStringBatchRenderer.js +2 -4
- package/render/webgl/PointBatchRenderer.d.ts.map +1 -1
- package/render/webgl/PointBatchRenderer.js +2 -4
- package/render/webgl/PolygonBatchRenderer.d.ts.map +1 -1
- package/render/webgl/PolygonBatchRenderer.js +2 -4
- package/render.d.ts +3 -3
- package/render.d.ts.map +1 -1
- package/render.js +6 -4
- package/renderer/Layer.d.ts +2 -2
- package/renderer/Layer.d.ts.map +1 -1
- package/renderer/Layer.js +3 -4
- package/renderer/canvas/Layer.d.ts.map +1 -1
- package/renderer/canvas/Layer.js +3 -4
- package/renderer/canvas/TileLayer.js +2 -2
- package/renderer/canvas/VectorImageLayer.d.ts +6 -0
- package/renderer/canvas/VectorImageLayer.d.ts.map +1 -1
- package/renderer/canvas/VectorImageLayer.js +22 -25
- package/renderer/canvas/VectorLayer.d.ts +9 -2
- package/renderer/canvas/VectorLayer.d.ts.map +1 -1
- package/renderer/canvas/VectorLayer.js +87 -93
- package/renderer/canvas/VectorTileLayer.js +84 -84
- package/renderer/webgl/PointsLayer.d.ts.map +1 -1
- package/renderer/webgl/PointsLayer.js +10 -13
- package/renderer/webgl/TileLayer.d.ts.map +1 -1
- package/renderer/webgl/TileLayer.js +2 -4
- package/reproj/DataTile.d.ts +75 -17
- package/reproj/DataTile.d.ts.map +1 -1
- package/reproj/DataTile.js +121 -120
- package/reproj/Tile.d.ts +3 -3
- package/reproj/Tile.d.ts.map +1 -1
- package/reproj/Tile.js +37 -41
- package/reproj/Triangulation.d.ts.map +1 -1
- package/reproj/Triangulation.js +42 -44
- package/source/BingMaps.d.ts.map +1 -1
- package/source/BingMaps.js +33 -38
- package/source/DataTile.d.ts +5 -3
- package/source/DataTile.d.ts.map +1 -1
- package/source/DataTile.js +24 -20
- package/source/GeoTIFF.d.ts +10 -7
- package/source/GeoTIFF.d.ts.map +1 -1
- package/source/GeoTIFF.js +49 -20
- package/source/Image.d.ts +8 -0
- package/source/Image.d.ts.map +1 -1
- package/source/Image.js +13 -11
- package/source/OGCMapTile.d.ts +1 -0
- package/source/OGCMapTile.d.ts.map +1 -1
- package/source/OGCMapTile.js +3 -1
- package/source/OGCVectorTile.d.ts +1 -0
- package/source/OGCVectorTile.d.ts.map +1 -1
- package/source/OGCVectorTile.js +3 -1
- package/source/Raster.d.ts +16 -0
- package/source/Raster.d.ts.map +1 -1
- package/source/Raster.js +47 -7
- package/source/Source.d.ts +2 -2
- package/source/Source.d.ts.map +1 -1
- package/source/Source.js +3 -4
- package/source/Stamen.js +2 -2
- package/source/Tile.d.ts.map +1 -1
- package/source/Tile.js +7 -3
- package/source/TileImage.d.ts +2 -2
- package/source/TileImage.d.ts.map +1 -1
- package/source/TileImage.js +3 -4
- package/source/UTFGrid.d.ts.map +1 -1
- package/source/UTFGrid.js +3 -6
- package/source/Vector.d.ts +6 -6
- package/source/Vector.js +13 -13
- package/source/VectorTile.d.ts.map +1 -1
- package/source/VectorTile.js +5 -9
- package/source/Zoomify.d.ts.map +1 -1
- package/source/Zoomify.js +4 -7
- package/style/Icon.d.ts +51 -0
- package/style/Icon.d.ts.map +1 -1
- package/style/Icon.js +119 -0
- package/style/IconImage.d.ts.map +1 -1
- package/style/IconImage.js +3 -1
- package/style/Image.d.ts.map +1 -1
- package/style/Image.js +1 -0
- package/style/Style.d.ts +2 -2
- package/style/Style.js +2 -2
- package/style/expressions.js +5 -10
- package/tilegrid/TileGrid.d.ts.map +1 -1
- package/tilegrid/TileGrid.js +7 -12
- package/util.d.ts.map +1 -1
- package/util.js +1 -1
- package/webgl/Helper.d.ts +4 -0
- package/webgl/Helper.d.ts.map +1 -1
- package/webgl/Helper.js +78 -79
- package/webgl/PostProcessingPass.d.ts +2 -2
- package/webgl/PostProcessingPass.d.ts.map +1 -1
- package/webgl/PostProcessingPass.js +7 -9
- package/webgl/ShaderBuilder.d.ts +1 -1
- package/webgl/ShaderBuilder.js +1 -1
- package/webgl/TileTexture.d.ts +19 -2
- package/webgl/TileTexture.d.ts.map +1 -1
- package/webgl/TileTexture.js +93 -46
- package/worker/webgl.js +1 -1
- package/layer/STAC.d.ts +0 -257
- package/layer/STAC.d.ts.map +0 -1
- package/layer/STAC.js +0 -312
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
} from '../canvas.js';
|
|
27
27
|
import {equals} from '../../array.js';
|
|
28
28
|
import {intersects} from '../../extent.js';
|
|
29
|
+
import {toFixed} from '../../math.js';
|
|
29
30
|
import {transform2D} from '../../geom/flat/transform.js';
|
|
30
31
|
import {transformGeom2D} from '../../geom/SimpleGeometry.js';
|
|
31
32
|
|
|
@@ -83,6 +84,14 @@ class CanvasImmediateRenderer extends VectorContext {
|
|
|
83
84
|
*/
|
|
84
85
|
this.transform_ = transform;
|
|
85
86
|
|
|
87
|
+
/**
|
|
88
|
+
* @private
|
|
89
|
+
* @type {number}
|
|
90
|
+
*/
|
|
91
|
+
this.transformRotation_ = transform
|
|
92
|
+
? toFixed(Math.atan2(transform[1], transform[0]), 10)
|
|
93
|
+
: 0;
|
|
94
|
+
|
|
86
95
|
/**
|
|
87
96
|
* @private
|
|
88
97
|
* @type {number}
|
|
@@ -290,6 +299,9 @@ class CanvasImmediateRenderer extends VectorContext {
|
|
|
290
299
|
context.globalAlpha = alpha * this.imageOpacity_;
|
|
291
300
|
}
|
|
292
301
|
let rotation = this.imageRotation_;
|
|
302
|
+
if (this.transformRotation_ === 0) {
|
|
303
|
+
rotation -= this.viewRotation_;
|
|
304
|
+
}
|
|
293
305
|
if (this.imageRotateWithView_) {
|
|
294
306
|
rotation += this.viewRotation_;
|
|
295
307
|
}
|
|
@@ -375,6 +387,9 @@ class CanvasImmediateRenderer extends VectorContext {
|
|
|
375
387
|
);
|
|
376
388
|
const context = this.context_;
|
|
377
389
|
let rotation = this.textRotation_;
|
|
390
|
+
if (this.transformRotation_ === 0) {
|
|
391
|
+
rotation -= this.viewRotation_;
|
|
392
|
+
}
|
|
378
393
|
if (this.textRotateWithView_) {
|
|
379
394
|
rotation += this.viewRotation_;
|
|
380
395
|
}
|
|
@@ -16,12 +16,13 @@ export function createHitDetectionImageData(size: import("../../size.js").Size,
|
|
|
16
16
|
/**
|
|
17
17
|
* @param {import("../../pixel").Pixel} pixel Pixel coordinate on the hit
|
|
18
18
|
* detection canvas in css pixels.
|
|
19
|
-
* @param {Array<
|
|
19
|
+
* @param {Array<F>} features Features. Has to
|
|
20
20
|
* match the `features` array that was passed to `createHitDetectionImageData()`.
|
|
21
21
|
* @param {ImageData} imageData Hit detection image data generated by
|
|
22
22
|
* `createHitDetectionImageData()`.
|
|
23
|
-
* @return {Array<
|
|
23
|
+
* @return {Array<F>} Features.
|
|
24
|
+
* @template {import("../../Feature.js").FeatureLike} F
|
|
24
25
|
*/
|
|
25
|
-
export function hitDetect(pixel: import("../../pixel").Pixel, features:
|
|
26
|
+
export function hitDetect<F extends import("../../Feature.js").FeatureLike>(pixel: import("../../pixel").Pixel, features: F[], imageData: ImageData): F[];
|
|
26
27
|
export const HIT_DETECT_RESOLUTION: 0.5;
|
|
27
28
|
//# sourceMappingURL=hitdetect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hitdetect.d.ts","sourceRoot":"","sources":["hitdetect.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;GAaG;AACH,kDAbW,OAAO,eAAe,EAAE,IAAI,cAC5B,MAAM,OAAO,oBAAoB,EAAE,SAAS,CAAC,YAG7C,MAAM,OAAO,kBAAkB,EAAE,WAAW,CAAC,iBAE7C,OAAO,sBAAsB,EAAE,aAAa,GAAC,SAAS,UAEtD,OAAO,iBAAiB,EAAE,MAAM,cAChC,MAAM,YACN,MAAM,GACL,SAAS,
|
|
1
|
+
{"version":3,"file":"hitdetect.d.ts","sourceRoot":"","sources":["hitdetect.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;GAaG;AACH,kDAbW,OAAO,eAAe,EAAE,IAAI,cAC5B,MAAM,OAAO,oBAAoB,EAAE,SAAS,CAAC,YAG7C,MAAM,OAAO,kBAAkB,EAAE,WAAW,CAAC,iBAE7C,OAAO,sBAAsB,EAAE,aAAa,GAAC,SAAS,UAEtD,OAAO,iBAAiB,EAAE,MAAM,cAChC,MAAM,YACN,MAAM,GACL,SAAS,CAuIpB;AAED;;;;;;;;;GASG;AACH,mFATW,OAAO,aAAa,EAAE,KAAK,4BAI3B,SAAS,OA4BnB;AAxLD,wCAAyC"}
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import CanvasImmediateRenderer from './Immediate.js';
|
|
6
6
|
import {Icon} from '../../style.js';
|
|
7
|
+
import {ascending} from '../../array.js';
|
|
7
8
|
import {clamp} from '../../math.js';
|
|
8
9
|
import {createCanvasContext2D} from '../../dom.js';
|
|
9
10
|
import {intersects} from '../../extent.js';
|
|
10
|
-
import {numberSafeCompareFunction} from '../../array.js';
|
|
11
11
|
|
|
12
12
|
export const HIT_DETECT_RESOLUTION = 0.5;
|
|
13
13
|
|
|
@@ -64,7 +64,7 @@ export function createHitDetectionImageData(
|
|
|
64
64
|
styles = [styles];
|
|
65
65
|
}
|
|
66
66
|
const index = i * indexFactor;
|
|
67
|
-
const color =
|
|
67
|
+
const color = index.toString(16).padStart(7, '#00000');
|
|
68
68
|
for (let j = 0, jj = styles.length; j < jj; ++j) {
|
|
69
69
|
const originalStyle = styles[j];
|
|
70
70
|
const geometry = originalStyle.getGeometryFunction()(feature);
|
|
@@ -124,16 +124,26 @@ export function createHitDetectionImageData(
|
|
|
124
124
|
byGeometryType['LineString'] = [];
|
|
125
125
|
byGeometryType['Point'] = [];
|
|
126
126
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
const type = geometry.getType();
|
|
128
|
+
if (type === 'GeometryCollection') {
|
|
129
|
+
const geometries =
|
|
130
|
+
/** @type {import("../../geom/GeometryCollection.js").default} */ (
|
|
131
|
+
geometry
|
|
132
|
+
).getGeometriesArrayRecursive();
|
|
133
|
+
for (let i = 0, ii = geometries.length; i < ii; ++i) {
|
|
134
|
+
const geometry = geometries[i];
|
|
135
|
+
byGeometryType[geometry.getType().replace('Multi', '')].push(
|
|
136
|
+
geometry,
|
|
137
|
+
style
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
} else {
|
|
141
|
+
byGeometryType[type.replace('Multi', '')].push(geometry, style);
|
|
142
|
+
}
|
|
131
143
|
}
|
|
132
144
|
}
|
|
133
145
|
|
|
134
|
-
const zIndexKeys = Object.keys(featuresByZIndex)
|
|
135
|
-
.map(Number)
|
|
136
|
-
.sort(numberSafeCompareFunction);
|
|
146
|
+
const zIndexKeys = Object.keys(featuresByZIndex).map(Number).sort(ascending);
|
|
137
147
|
for (let i = 0, ii = zIndexKeys.length; i < ii; ++i) {
|
|
138
148
|
const byGeometryType = featuresByZIndex[zIndexKeys[i]];
|
|
139
149
|
for (const type in byGeometryType) {
|
|
@@ -153,11 +163,12 @@ export function createHitDetectionImageData(
|
|
|
153
163
|
/**
|
|
154
164
|
* @param {import("../../pixel").Pixel} pixel Pixel coordinate on the hit
|
|
155
165
|
* detection canvas in css pixels.
|
|
156
|
-
* @param {Array<
|
|
166
|
+
* @param {Array<F>} features Features. Has to
|
|
157
167
|
* match the `features` array that was passed to `createHitDetectionImageData()`.
|
|
158
168
|
* @param {ImageData} imageData Hit detection image data generated by
|
|
159
169
|
* `createHitDetectionImageData()`.
|
|
160
|
-
* @return {Array<
|
|
170
|
+
* @return {Array<F>} Features.
|
|
171
|
+
* @template {import("../../Feature.js").FeatureLike} F
|
|
161
172
|
*/
|
|
162
173
|
export function hitDetect(pixel, features, imageData) {
|
|
163
174
|
const resultFeatures = [];
|
|
@@ -180,5 +191,6 @@ export function hitDetect(pixel, features, imageData) {
|
|
|
180
191
|
resultFeatures.push(features[i / indexFactor - 1]);
|
|
181
192
|
}
|
|
182
193
|
}
|
|
194
|
+
// @ts-ignore Features are copied from `features` to `resultFeatures` so the type should be the same
|
|
183
195
|
return resultFeatures;
|
|
184
196
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BatchRenderer.d.ts","sourceRoot":"","sources":["BatchRenderer.js"],"names":[],"mappings":";;;;;;;;;UAec,MAAM;;;;;qBACG,OAAO,eAAe,EAAE,OAAO,KAAE,MAAM;;AAM9D;;;;GAIG;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G;IACH,eALW,OAAO,yBAAyB,EAAE,aAAa,cAC/C,OAAO,WAAW,EAAE,UAAU,gBAC9B,OAAO,wBAAwB,EAAE,IAAI,kBACzB,IAAI,QAU1B;IAED;;;;;;;OAOG;IACH,cALW,OAAO,yBAAyB,EAAE,aAAa,oBAC/C,OAAO,oBAAoB,EAAE,SAAS,cACtC,OAAO,cAAc,EAAE,UAAU,WACjC,MAAM,QAgBhB;IAED;;;;;OAKG;IACH,4CAHW,OAAO,yBAAyB,EAAE,aAAa,QAKzD;IAED;;;;;;;OAOG;IACH,yBAoEC;CACF"}
|
|
@@ -160,9 +160,8 @@ class AbstractBatchRenderer {
|
|
|
160
160
|
const handleMessage =
|
|
161
161
|
/**
|
|
162
162
|
* @param {*} event Event.
|
|
163
|
-
* @this {AbstractBatchRenderer}
|
|
164
163
|
*/
|
|
165
|
-
|
|
164
|
+
(event) => {
|
|
166
165
|
const received = event.data;
|
|
167
166
|
|
|
168
167
|
// this is not the response to our request: skip
|
|
@@ -192,7 +191,7 @@ class AbstractBatchRenderer {
|
|
|
192
191
|
);
|
|
193
192
|
|
|
194
193
|
callback();
|
|
195
|
-
}
|
|
194
|
+
};
|
|
196
195
|
|
|
197
196
|
this.worker_.addEventListener('message', handleMessage);
|
|
198
197
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineStringBatchRenderer.d.ts","sourceRoot":"","sources":["LineStringBatchRenderer.js"],"names":[],"mappings":";;;;yBAUU,MAAM;;;;;;;AAQhB;IAYI;;;;QAwBC;IAGH;;;;;OAKG;IACH,2CAHW,OAAO,yBAAyB,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"LineStringBatchRenderer.d.ts","sourceRoot":"","sources":["LineStringBatchRenderer.js"],"names":[],"mappings":";;;;yBAUU,MAAM;;;;;;;AAQhB;IAYI;;;;QAwBC;IAGH;;;;;OAKG;IACH,2CAHW,OAAO,yBAAyB,EAAE,uBAAuB,QAkDnE;CACF"}
|
|
@@ -77,12 +77,10 @@ class LineStringBatchRenderer extends AbstractBatchRenderer {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
// loop on features to fill the render instructions
|
|
80
|
-
let batchEntry;
|
|
81
80
|
const flatCoords = [];
|
|
82
81
|
let renderIndex = 0;
|
|
83
|
-
let value;
|
|
84
82
|
for (const featureUid in batch.entries) {
|
|
85
|
-
batchEntry = batch.entries[featureUid];
|
|
83
|
+
const batchEntry = batch.entries[featureUid];
|
|
86
84
|
for (let i = 0, ii = batchEntry.flatCoordss.length; i < ii; i++) {
|
|
87
85
|
flatCoords.length = batchEntry.flatCoordss[i].length;
|
|
88
86
|
transform2D(
|
|
@@ -96,7 +94,7 @@ class LineStringBatchRenderer extends AbstractBatchRenderer {
|
|
|
96
94
|
|
|
97
95
|
// custom attributes
|
|
98
96
|
for (let k = 0, kk = this.customAttributes.length; k < kk; k++) {
|
|
99
|
-
value = this.customAttributes[k].callback(batchEntry.feature);
|
|
97
|
+
const value = this.customAttributes[k].callback(batchEntry.feature);
|
|
100
98
|
batch.renderInstructions[renderIndex++] = value;
|
|
101
99
|
}
|
|
102
100
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PointBatchRenderer.d.ts","sourceRoot":"","sources":["PointBatchRenderer.js"],"names":[],"mappings":";;;;yBAWU,MAAM;;;;;;AAOhB;IAYI;;;;QAmBC;IAGH;;;;;OAKG;IACH,2CAHW,OAAO,yBAAyB,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"PointBatchRenderer.d.ts","sourceRoot":"","sources":["PointBatchRenderer.js"],"names":[],"mappings":";;;;yBAWU,MAAM;;;;;;AAOhB;IAYI;;;;QAmBC;IAGH;;;;;OAKG;IACH,2CAHW,OAAO,yBAAyB,EAAE,kBAAkB,QAoC9D;CACF"}
|
|
@@ -70,12 +70,10 @@ class PointBatchRenderer extends AbstractBatchRenderer {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
// loop on features to fill the render instructions
|
|
73
|
-
let batchEntry;
|
|
74
73
|
const tmpCoords = [];
|
|
75
74
|
let renderIndex = 0;
|
|
76
|
-
let value;
|
|
77
75
|
for (const featureUid in batch.entries) {
|
|
78
|
-
batchEntry = batch.entries[featureUid];
|
|
76
|
+
const batchEntry = batch.entries[featureUid];
|
|
79
77
|
for (let i = 0, ii = batchEntry.flatCoordss.length; i < ii; i++) {
|
|
80
78
|
tmpCoords[0] = batchEntry.flatCoordss[i][0];
|
|
81
79
|
tmpCoords[1] = batchEntry.flatCoordss[i][1];
|
|
@@ -86,7 +84,7 @@ class PointBatchRenderer extends AbstractBatchRenderer {
|
|
|
86
84
|
|
|
87
85
|
// pushing custom attributes
|
|
88
86
|
for (let j = 0, jj = this.customAttributes.length; j < jj; j++) {
|
|
89
|
-
value = this.customAttributes[j].callback(batchEntry.feature);
|
|
87
|
+
const value = this.customAttributes[j].callback(batchEntry.feature);
|
|
90
88
|
batch.renderInstructions[renderIndex++] = value;
|
|
91
89
|
}
|
|
92
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolygonBatchRenderer.d.ts","sourceRoot":"","sources":["PolygonBatchRenderer.js"],"names":[],"mappings":";;;;yBAUU,MAAM;;;;;AAMhB;IAYI;;;;QAcC;IAGH;;;;;OAKG;IACH,2CAHW,OAAO,yBAAyB,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"PolygonBatchRenderer.d.ts","sourceRoot":"","sources":["PolygonBatchRenderer.js"],"names":[],"mappings":";;;;yBAUU,MAAM;;;;;AAMhB;IAYI;;;;QAcC;IAGH;;;;;OAKG;IACH,2CAHW,OAAO,yBAAyB,EAAE,oBAAoB,QA+DhE;CACF"}
|
|
@@ -67,12 +67,10 @@ class PolygonBatchRenderer extends AbstractBatchRenderer {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
// loop on features to fill the render instructions
|
|
70
|
-
let batchEntry;
|
|
71
70
|
const flatCoords = [];
|
|
72
71
|
let renderIndex = 0;
|
|
73
|
-
let value;
|
|
74
72
|
for (const featureUid in batch.entries) {
|
|
75
|
-
batchEntry = batch.entries[featureUid];
|
|
73
|
+
const batchEntry = batch.entries[featureUid];
|
|
76
74
|
for (let i = 0, ii = batchEntry.flatCoordss.length; i < ii; i++) {
|
|
77
75
|
flatCoords.length = batchEntry.flatCoordss[i].length;
|
|
78
76
|
transform2D(
|
|
@@ -86,7 +84,7 @@ class PolygonBatchRenderer extends AbstractBatchRenderer {
|
|
|
86
84
|
|
|
87
85
|
// custom attributes
|
|
88
86
|
for (let k = 0, kk = this.customAttributes.length; k < kk; k++) {
|
|
89
|
-
value = this.customAttributes[k].callback(batchEntry.feature);
|
|
87
|
+
const value = this.customAttributes[k].callback(batchEntry.feature);
|
|
90
88
|
batch.renderInstructions[renderIndex++] = value;
|
|
91
89
|
}
|
|
92
90
|
|
package/render.d.ts
CHANGED
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
* The units for geometry coordinates are css pixels relative to the top left
|
|
32
32
|
* corner of the canvas element.
|
|
33
33
|
* ```js
|
|
34
|
-
* import {toContext} from 'ol/render';
|
|
35
|
-
* import Fill from 'ol/style/Fill';
|
|
36
|
-
* import Polygon from 'ol/geom/Polygon';
|
|
34
|
+
* import {toContext} from 'ol/render.js';
|
|
35
|
+
* import Fill from 'ol/style/Fill.js';
|
|
36
|
+
* import Polygon from 'ol/geom/Polygon.js';
|
|
37
37
|
*
|
|
38
38
|
* const canvas = document.createElement('canvas');
|
|
39
39
|
* const render = toContext(
|
package/render.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["render.js"],"names":[],"mappings":"AAcA;;;;;;;;;GASG;AAEH;;;;;;GAMG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,mCALW,wBAAwB,2CAEvB,uBAAuB,CAiBlC;AAED;;;;;GAKG;AACH,wCAJW,OAAO,mBAAmB,EAAE,OAAO,GAClC,uBAAuB,
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["render.js"],"names":[],"mappings":"AAcA;;;;;;;;;GASG;AAEH;;;;;;GAMG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,mCALW,wBAAwB,2CAEvB,uBAAuB,CAiBlC;AAED;;;;;GAKG;AACH,wCAJW,OAAO,mBAAmB,EAAE,OAAO,GAClC,uBAAuB,CAuClC;AAED;;;;;;;GAOG;AACH,sCANW,OAAO,mBAAmB,EAAE,OAAO,SACnC,OAAO,YAAY,EAAE,KAAK,GAEzB,OAAO,YAAY,EAAE,KAAK,CAKrC;;;;;aA5Ha,wBAAwB;;;;aACxB,OAAO,cAAc,EAAE,WAAW;;;;cAClC,OAAO,0BAA0B,EAAE,OAAO;;;;gBAC1C,MAAM;;;;;gBACN,MAAM;;;;cAEN,MAAM;;;;;;;mCAQE,OAAO,cAAc,EAAE,WAAW,QAAE,OAAO,cAAc,EAAE,WAAW,KAAE,MAAM"}
|
package/render.js
CHANGED
|
@@ -48,9 +48,9 @@ import {getTransformFromProjections, getUserProjection} from './proj.js';
|
|
|
48
48
|
* The units for geometry coordinates are css pixels relative to the top left
|
|
49
49
|
* corner of the canvas element.
|
|
50
50
|
* ```js
|
|
51
|
-
* import {toContext} from 'ol/render';
|
|
52
|
-
* import Fill from 'ol/style/Fill';
|
|
53
|
-
* import Polygon from 'ol/geom/Polygon';
|
|
51
|
+
* import {toContext} from 'ol/render.js';
|
|
52
|
+
* import Fill from 'ol/style/Fill.js';
|
|
53
|
+
* import Polygon from 'ol/geom/Polygon.js';
|
|
54
54
|
*
|
|
55
55
|
* const canvas = document.createElement('canvas');
|
|
56
56
|
* const render = toContext(
|
|
@@ -96,7 +96,9 @@ export function getVectorContext(event) {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
// canvas may be at a different pixel ratio than frameState.pixelRatio
|
|
99
|
-
const
|
|
99
|
+
const a = event.inversePixelTransform[0];
|
|
100
|
+
const b = event.inversePixelTransform[1];
|
|
101
|
+
const canvasPixelRatio = Math.sqrt(a * a + b * b);
|
|
100
102
|
const frameState = event.frameState;
|
|
101
103
|
const transform = multiplyTransform(
|
|
102
104
|
event.inversePixelTransform.slice(),
|
package/renderer/Layer.d.ts
CHANGED
|
@@ -26,10 +26,10 @@ declare class LayerRenderer<LayerType extends import("../layer/Layer.js").defaul
|
|
|
26
26
|
/**
|
|
27
27
|
* Asynchronous layer level hit detection.
|
|
28
28
|
* @param {import("../pixel.js").Pixel} pixel Pixel.
|
|
29
|
-
* @return {Promise<Array<import("../Feature").
|
|
29
|
+
* @return {Promise<Array<import("../Feature").FeatureLike>>} Promise that resolves with
|
|
30
30
|
* an array of features.
|
|
31
31
|
*/
|
|
32
|
-
getFeatures(pixel: import("../pixel.js").Pixel): Promise<Array<import("../Feature").
|
|
32
|
+
getFeatures(pixel: import("../pixel.js").Pixel): Promise<Array<import("../Feature").FeatureLike>>;
|
|
33
33
|
/**
|
|
34
34
|
* @param {import("../pixel.js").Pixel} pixel Pixel.
|
|
35
35
|
* @return {Uint8ClampedArray|Uint8Array|Float32Array|DataView|null} Pixel data.
|
package/renderer/Layer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layer.d.ts","sourceRoot":"","sources":["Layer.js"],"names":[],"mappings":";AAQA;;GAEG;AACH;IACE;;OAEG;IACH,mBAFW,SAAS,EAwBnB;IAnBC;;;OAGG;IACH,OAFU,OAAO,CAEA;IAEjB,eAAe;IACf,gCAAiE;IAEjE;;;OAGG;IACH,kBAFU,SAAS,CAEA;IAEnB;;OAEG;IACH,wBAFU,OAAO,gCAAgC,EAAE,OAAO,CAExB;IAGpC;;;;;OAKG;IACH,mBAJW,OAAO,aAAa,EAAE,KAAK,GAC1B,QAAQ,MAAM,OAAO,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"Layer.d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MG;IACH,2BAJW,OAAO,iBAAiB,EAAE,OAAO,GAChC,OAAO,CAalB;IAED;;OAEG;IACH,0CAKC;CASF"}
|
package/renderer/Layer.js
CHANGED
|
@@ -40,7 +40,7 @@ class LayerRenderer extends Observable {
|
|
|
40
40
|
/**
|
|
41
41
|
* Asynchronous layer level hit detection.
|
|
42
42
|
* @param {import("../pixel.js").Pixel} pixel Pixel.
|
|
43
|
-
* @return {Promise<Array<import("../Feature").
|
|
43
|
+
* @return {Promise<Array<import("../Feature").FeatureLike>>} Promise that resolves with
|
|
44
44
|
* an array of features.
|
|
45
45
|
*/
|
|
46
46
|
getFeatures(pixel) {
|
|
@@ -105,12 +105,11 @@ class LayerRenderer extends Observable {
|
|
|
105
105
|
* @param {number} zoom Zoom level.
|
|
106
106
|
* @param {import("../TileRange.js").default} tileRange Tile range.
|
|
107
107
|
* @return {boolean} The tile range is fully loaded.
|
|
108
|
-
* @this {LayerRenderer}
|
|
109
108
|
*/
|
|
110
|
-
|
|
109
|
+
(zoom, tileRange) => {
|
|
111
110
|
const callback = this.loadedTileCallback.bind(this, tiles, zoom);
|
|
112
111
|
return source.forEachLoadedTile(projection, zoom, tileRange, callback);
|
|
113
|
-
}
|
|
112
|
+
}
|
|
114
113
|
);
|
|
115
114
|
}
|
|
116
115
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layer.d.ts","sourceRoot":"","sources":["Layer.js"],"names":[],"mappings":"AAqBA;;GAEG;AACH,yBAFU,MAAM,iBAAiB,CAAC,CAEL;;
|
|
1
|
+
{"version":3,"file":"Layer.d.ts","sourceRoot":"","sources":["Layer.js"],"names":[],"mappings":"AAqBA;;GAEG;AACH,yBAFU,MAAM,iBAAiB,CAAC,CAEL;;AAa7B;;;;GAIG;AACH;IAOI;;;OAGG;IACH,qBAFU,WAAW,CAEA;IAErB;;;OAGG;IACH,8BAFU,MAAM,CAEO;IAEvB;;;;;OAKG;IACH,yBAFU,OAAO,oBAAoB,EAAE,SAAS,CAEV;IAEtC;;;;;OAKG;IACH,0BAFU,OAAO,oBAAoB,EAAE,SAAS,CAET;IAEvC;;;;;OAKG;IACH,iCAFU,OAAO,oBAAoB,EAAE,SAAS,CAEF;IAE9C;;OAEG;IACH,SAFU,wBAAwB,CAEf;IAEnB;;OAEG;IACH,iBAFU,OAAO,CAEW;IAE5B;;;OAGG;IACH,sBAAyB;IAEzB;;;OAGG;IACH,sBAFU,OAAO,cAAc,EAAE,UAAU,GAAC,IAAI,CAE1B;IAGxB;;;;;OAKG;IACH,oBALW,iBAAiB,GAAC,gBAAgB,GAAC,gBAAgB,OACnD,MAAM,OACN,MAAM,GACL,iBAAiB,GAAC,IAAI,CAiBjC;IAED;;;OAGG;IACH,0BAHW,OAAO,cAAc,EAAE,UAAU,GAChC,MAAM,CASjB;IAED;;;;;OAKG;IACH,qBAJW,WAAW,aACX,MAAM,8CAyDhB;IAED;;;;;OAKG;IACH,iCALW,wBAAwB,cACxB,OAAO,cAAc,EAAE,UAAU,UACjC,OAAO,iBAAiB,EAAE,MAAM,QA2B1C;IAED;;;;;OAKG;IACH,6BAWC;IAED;;;;OAIG;IACH,6BAJW,wBAAwB,cACxB,OAAO,cAAc,EAAE,UAAU,QAM3C;IAED;;;;OAIG;IACH,8BAJW,wBAAwB,cACxB,OAAO,cAAc,EAAE,UAAU,QAK3C;IAED;;;;;;;;;;;OAWG;IACH,qCAVW,OAAO,qBAAqB,EAAE,UAAU,cACxC,MAAM,YACN,MAAM,cACN,MAAM,SACN,MAAM,UACN,MAAM,WACN,MAAM,GAEJ,OAAO,oBAAoB,EAAE,SAAS,CA2BlD;CASF"}
|
package/renderer/canvas/Layer.js
CHANGED
|
@@ -30,10 +30,9 @@ export const canvasPool = [];
|
|
|
30
30
|
let pixelContext = null;
|
|
31
31
|
|
|
32
32
|
function createPixelContext() {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
pixelContext = canvas.getContext('2d');
|
|
33
|
+
pixelContext = createCanvasContext2D(1, 1, undefined, {
|
|
34
|
+
willReadFrequently: true,
|
|
35
|
+
});
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
/**
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
makeInverse,
|
|
13
13
|
toString as toTransformString,
|
|
14
14
|
} from '../../transform.js';
|
|
15
|
+
import {ascending} from '../../array.js';
|
|
15
16
|
import {
|
|
16
17
|
containsCoordinate,
|
|
17
18
|
createEmpty,
|
|
@@ -25,7 +26,6 @@ import {
|
|
|
25
26
|
} from '../../extent.js';
|
|
26
27
|
import {fromUserExtent} from '../../proj.js';
|
|
27
28
|
import {getUid} from '../../util.js';
|
|
28
|
-
import {numberSafeCompareFunction} from '../../array.js';
|
|
29
29
|
import {toSize} from '../../size.js';
|
|
30
30
|
|
|
31
31
|
/**
|
|
@@ -420,7 +420,7 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
|
|
|
420
420
|
this.renderedTiles.length = 0;
|
|
421
421
|
/** @type {Array<number>} */
|
|
422
422
|
let zs = Object.keys(tilesToDrawByZ).map(Number);
|
|
423
|
-
zs.sort(
|
|
423
|
+
zs.sort(ascending);
|
|
424
424
|
|
|
425
425
|
let clips, clipZs, currentClip;
|
|
426
426
|
if (
|
|
@@ -29,6 +29,12 @@ declare class CanvasVectorImageLayerRenderer extends CanvasImageLayerRenderer {
|
|
|
29
29
|
* @type {import("../../transform.js").Transform}
|
|
30
30
|
*/
|
|
31
31
|
private renderedPixelToCoordinateTransform_;
|
|
32
|
+
/**
|
|
33
|
+
* Asynchronous layer level hit detection.
|
|
34
|
+
* @param {import("../../pixel.js").Pixel} pixel Pixel.
|
|
35
|
+
* @return {Promise<Array<import("../../Feature").default>>} Promise that resolves with an array of features.
|
|
36
|
+
*/
|
|
37
|
+
getFeatures(pixel: import("../../pixel.js").Pixel): Promise<Array<import("../../Feature").default>>;
|
|
32
38
|
/**
|
|
33
39
|
*/
|
|
34
40
|
preRender(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorImageLayer.d.ts","sourceRoot":"","sources":["VectorImageLayer.js"],"names":[],"mappings":";AAaA;;;;GAIG;AACH;IACE;;OAEG;IACH,sEA0BC;IAvBC;;;OAGG;IACH,wBAA2D;IAE3D;;;OAGG;IACH,yBAA6C;IAE7C;;;OAGG;IACH,0CAAiD;IAEjD;;;OAGG;IACH,4CAA+C;
|
|
1
|
+
{"version":3,"file":"VectorImageLayer.d.ts","sourceRoot":"","sources":["VectorImageLayer.js"],"names":[],"mappings":";AAaA;;;;GAIG;AACH;IACE;;OAEG;IACH,sEA0BC;IAvBC;;;OAGG;IACH,wBAA2D;IAE3D;;;OAGG;IACH,yBAA6C;IAE7C;;;OAGG;IACH,0CAAiD;IAEjD;;;OAGG;IACH,4CAA+C;IAWjD;;;;OAIG;IACH,mBAHW,OAAO,gBAAgB,EAAE,KAAK,GAC7B,QAAQ,MAAM,OAAO,eAAe,EAAE,OAAO,CAAC,CAAC,CAW1D;IA0GD;OACG;IACH,kBAAc;IAEd;OACG;IACH,mBAAe;IAEf;OACG;IACH,wBAAoB;CAmCrB"}
|
|
@@ -63,7 +63,7 @@ class CanvasVectorImageLayerRenderer extends CanvasImageLayerRenderer {
|
|
|
63
63
|
*/
|
|
64
64
|
getFeatures(pixel) {
|
|
65
65
|
if (!this.vectorRenderer_) {
|
|
66
|
-
return
|
|
66
|
+
return Promise.resolve([]);
|
|
67
67
|
}
|
|
68
68
|
const vectorPixel = apply(
|
|
69
69
|
this.coordinateToVectorPixelTransform_,
|
|
@@ -144,30 +144,27 @@ class CanvasVectorImageLayerRenderer extends CanvasImageLayerRenderer {
|
|
|
144
144
|
}
|
|
145
145
|
);
|
|
146
146
|
|
|
147
|
-
image.addEventListener(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
this.
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
);
|
|
169
|
-
}.bind(this)
|
|
170
|
-
);
|
|
147
|
+
image.addEventListener(EventType.CHANGE, () => {
|
|
148
|
+
if (image.getState() !== ImageState.LOADED) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
this.image_ = emptyImage ? null : image;
|
|
152
|
+
const imageResolution = image.getResolution();
|
|
153
|
+
const imagePixelRatio = image.getPixelRatio();
|
|
154
|
+
const renderedResolution =
|
|
155
|
+
(imageResolution * pixelRatio) / imagePixelRatio;
|
|
156
|
+
this.renderedResolution = renderedResolution;
|
|
157
|
+
this.coordinateToVectorPixelTransform_ = compose(
|
|
158
|
+
this.coordinateToVectorPixelTransform_,
|
|
159
|
+
width / 2,
|
|
160
|
+
height / 2,
|
|
161
|
+
1 / renderedResolution,
|
|
162
|
+
-1 / renderedResolution,
|
|
163
|
+
0,
|
|
164
|
+
-viewState.center[0],
|
|
165
|
+
-viewState.center[1]
|
|
166
|
+
);
|
|
167
|
+
});
|
|
171
168
|
image.load();
|
|
172
169
|
}
|
|
173
170
|
|
|
@@ -16,9 +16,9 @@ declare class CanvasVectorLayerRenderer extends CanvasLayerRenderer<any> {
|
|
|
16
16
|
*/
|
|
17
17
|
animatingOrInteracting_: boolean;
|
|
18
18
|
/**
|
|
19
|
-
* @type {ImageData}
|
|
19
|
+
* @type {ImageData|null}
|
|
20
20
|
*/
|
|
21
|
-
hitDetectionImageData_: ImageData;
|
|
21
|
+
hitDetectionImageData_: ImageData | null;
|
|
22
22
|
/**
|
|
23
23
|
* @type {Array<import("../../Feature.js").default>}
|
|
24
24
|
*/
|
|
@@ -101,6 +101,13 @@ declare class CanvasVectorLayerRenderer extends CanvasLayerRenderer<any> {
|
|
|
101
101
|
* @param {import("../../Map.js").FrameState} frameState Frame state.
|
|
102
102
|
*/
|
|
103
103
|
renderDeclutter(frameState: import("../../Map.js").FrameState): void;
|
|
104
|
+
/**
|
|
105
|
+
* Asynchronous layer level hit detection.
|
|
106
|
+
* @param {import("../../pixel.js").Pixel} pixel Pixel.
|
|
107
|
+
* @return {Promise<Array<import("../../Feature").default>>} Promise
|
|
108
|
+
* that resolves with an array of features.
|
|
109
|
+
*/
|
|
110
|
+
getFeatures(pixel: import("../../pixel.js").Pixel): Promise<Array<import("../../Feature").default>>;
|
|
104
111
|
/**
|
|
105
112
|
* Handle changes in image style state.
|
|
106
113
|
* @param {import("../../events/Event.js").default} event Image style change event.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorLayer.d.ts","sourceRoot":"","sources":["VectorLayer.js"],"names":[],"mappings":";AA4CA;;;;GAIG;AACH;IACE;;OAEG;IACH,gFAuGC;IApGC,eAAe;IACf,qCAA2E;IAE3E;;OAEG;IACH,yBAFU,OAAO,CAEW;IAE5B;;OAEG;IACH,wBAFU,SAAS,
|
|
1
|
+
{"version":3,"file":"VectorLayer.d.ts","sourceRoot":"","sources":["VectorLayer.js"],"names":[],"mappings":";AA4CA;;;;GAIG;AACH;IACE;;OAEG;IACH,gFAuGC;IApGC,eAAe;IACf,qCAA2E;IAE3E;;OAEG;IACH,yBAFU,OAAO,CAEW;IAE5B;;OAEG;IACH,wBAFU,SAAS,GAAC,IAAI,CAEU;IAElC;;OAEG;IACH,mBAFU,MAAM,OAAO,kBAAkB,EAAE,OAAO,CAAC,CAEtB;IAE7B;;;OAGG;IACH,0BAA2B;IAE3B;;;OAGG;IACH,4BAA8B;IAE9B;;;OAGG;IACH,wBAAoC;IAEpC;;;OAGG;IACH,+BAA2C;IAE3C;;;OAGG;IACH,0BAAsB;IAEtB;;;OAGG;IACH,wBAA2B;IAE3B;;;OAGG;IACH,4BAA+B;IAE/B;;;OAGG;IACH,6BAAgC;IAEhC;;;OAGG;IACH,qBAAwB;IAExB;;;OAGG;IACH,oBAFU,OAAO,CAEa;IAO9B;;;OAG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