ol 9.2.5-dev.1718651852752 → 9.2.5-dev.1718925536936
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/DataTile.d.ts +14 -0
- package/DataTile.d.ts.map +1 -1
- package/DataTile.js +24 -1
- package/Map.d.ts +1 -1
- package/Map.d.ts.map +1 -1
- package/Map.js +9 -10
- package/Tile.d.ts +2 -22
- package/Tile.d.ts.map +1 -1
- package/Tile.js +2 -77
- package/TileQueue.d.ts.map +1 -1
- package/TileQueue.js +6 -4
- package/VectorRenderTile.d.ts +8 -13
- package/VectorRenderTile.d.ts.map +1 -1
- package/VectorRenderTile.js +17 -24
- package/VectorTile.d.ts +5 -5
- package/VectorTile.d.ts.map +1 -1
- package/VectorTile.js +3 -3
- package/dist/ol.d.ts +10 -2
- package/dist/ol.d.ts.map +1 -1
- package/dist/ol.js +2 -2
- package/dist/ol.js.map +1 -1
- package/featureloader.d.ts +4 -4
- package/featureloader.d.ts.map +1 -1
- package/featureloader.js +2 -2
- package/format/EsriJSON.d.ts +1 -1
- package/format/Feature.d.ts +8 -8
- package/format/Feature.d.ts.map +1 -1
- package/format/Feature.js +7 -5
- package/format/GeoJSON.d.ts +9 -9
- package/format/GeoJSON.d.ts.map +1 -1
- package/format/GeoJSON.js +10 -14
- package/format/JSONFeature.d.ts +7 -7
- package/format/JSONFeature.d.ts.map +1 -1
- package/format/JSONFeature.js +9 -11
- package/format/MVT.d.ts +12 -12
- package/format/MVT.d.ts.map +1 -1
- package/format/MVT.js +12 -14
- package/format/TextFeature.d.ts +1 -1
- package/format/TopoJSON.d.ts +1 -1
- package/format/WKB.d.ts +1 -1
- package/format/XMLFeature.d.ts +1 -1
- package/interaction/DragAndDrop.d.ts +1 -1
- package/layer/BaseTile.d.ts +23 -6
- package/layer/BaseTile.d.ts.map +1 -1
- package/layer/BaseTile.js +22 -3
- package/layer/Tile.d.ts +1 -1
- package/layer/Tile.d.ts.map +1 -1
- package/layer/Tile.js +3 -1
- package/layer/VectorTile.d.ts +19 -6
- package/layer/VectorTile.d.ts.map +1 -1
- package/layer/VectorTile.js +20 -8
- package/layer/WebGLTile.d.ts +5 -10
- package/layer/WebGLTile.d.ts.map +1 -1
- package/layer/WebGLTile.js +3 -12
- package/package.json +1 -1
- package/renderer/Layer.d.ts +22 -25
- package/renderer/Layer.d.ts.map +1 -1
- package/renderer/Layer.js +36 -36
- package/renderer/canvas/TileLayer.d.ts +100 -38
- package/renderer/canvas/TileLayer.d.ts.map +1 -1
- package/renderer/canvas/TileLayer.js +542 -329
- package/renderer/canvas/VectorTileLayer.d.ts +11 -11
- package/renderer/canvas/VectorTileLayer.d.ts.map +1 -1
- package/renderer/canvas/VectorTileLayer.js +33 -46
- package/renderer/webgl/TileLayerBase.d.ts +0 -6
- package/renderer/webgl/TileLayerBase.d.ts.map +1 -1
- package/renderer/webgl/TileLayerBase.js +61 -78
- package/reproj/DataTile.d.ts.map +1 -1
- package/reproj/DataTile.js +103 -100
- package/source/BingMaps.d.ts +2 -2
- package/source/BingMaps.d.ts.map +1 -1
- package/source/BingMaps.js +1 -2
- package/source/CartoDB.d.ts +2 -2
- package/source/CartoDB.js +1 -1
- package/source/DataTile.d.ts +49 -20
- package/source/DataTile.d.ts.map +1 -1
- package/source/DataTile.js +56 -9
- package/source/GeoTIFF.d.ts +2 -6
- package/source/GeoTIFF.d.ts.map +1 -1
- package/source/GeoTIFF.js +3 -3
- package/source/Google.d.ts.map +1 -1
- package/source/Google.js +0 -2
- package/source/IIIF.d.ts +1 -1
- package/source/IIIF.js +1 -1
- package/source/ImageTile.d.ts +102 -0
- package/source/ImageTile.d.ts.map +1 -0
- package/source/ImageTile.js +208 -0
- package/source/OGCMapTile.d.ts +2 -2
- package/source/OGCMapTile.js +1 -1
- package/source/OGCVectorTile.d.ts +4 -4
- package/source/OGCVectorTile.js +2 -2
- package/source/OSM.d.ts +2 -7
- package/source/OSM.d.ts.map +1 -1
- package/source/OSM.js +1 -3
- package/source/StadiaMaps.d.ts +2 -2
- package/source/StadiaMaps.d.ts.map +1 -1
- package/source/StadiaMaps.js +2 -18
- package/source/Tile.d.ts +7 -36
- package/source/Tile.d.ts.map +1 -1
- package/source/Tile.js +5 -69
- package/source/TileArcGISRest.d.ts +2 -2
- package/source/TileArcGISRest.js +1 -1
- package/source/TileDebug.d.ts.map +1 -1
- package/source/TileDebug.js +0 -1
- package/source/TileImage.d.ts +7 -11
- package/source/TileImage.d.ts.map +1 -1
- package/source/TileImage.js +11 -43
- package/source/TileJSON.d.ts +2 -2
- package/source/TileJSON.js +1 -1
- package/source/TileWMS.d.ts +2 -2
- package/source/TileWMS.d.ts.map +1 -1
- package/source/TileWMS.js +1 -4
- package/source/UTFGrid.d.ts +1 -1
- package/source/UrlTile.d.ts +14 -12
- package/source/UrlTile.d.ts.map +1 -1
- package/source/UrlTile.js +12 -7
- package/source/Vector.d.ts +5 -5
- package/source/Vector.d.ts.map +1 -1
- package/source/Vector.js +3 -3
- package/source/VectorTile.d.ts +4 -17
- package/source/VectorTile.d.ts.map +1 -1
- package/source/VectorTile.js +10 -85
- package/source/WMTS.d.ts +2 -2
- package/source/WMTS.js +3 -3
- package/source/XYZ.d.ts +14 -17
- package/source/XYZ.d.ts.map +1 -1
- package/source/XYZ.js +7 -8
- package/source/Zoomify.d.ts +2 -2
- package/source/Zoomify.d.ts.map +1 -1
- package/source/Zoomify.js +3 -2
- package/source.d.ts +1 -0
- package/source.d.ts.map +1 -1
- package/source.js +1 -0
- package/tilecoord.d.ts +7 -0
- package/tilecoord.d.ts.map +1 -1
- package/tilecoord.js +11 -1
- package/tileurlfunction.d.ts +3 -7
- package/tileurlfunction.d.ts.map +1 -1
- package/tileurlfunction.js +14 -47
- package/uri.d.ts +23 -3
- package/uri.d.ts.map +1 -1
- package/uri.js +75 -0
- package/util.js +1 -1
|
@@ -8,8 +8,9 @@ export default CanvasVectorTileLayerRenderer;
|
|
|
8
8
|
declare class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer<import("../../layer/VectorTile.js").default<import("../../source/VectorTile.js").default<import("../../Feature.js").FeatureLike>, import("../../Feature.js").FeatureLike>> {
|
|
9
9
|
/**
|
|
10
10
|
* @param {import("../../layer/VectorTile.js").default} layer VectorTile layer.
|
|
11
|
+
* @param {import("./TileLayer.js").Options} options Options.
|
|
11
12
|
*/
|
|
12
|
-
constructor(layer: import("../../layer/VectorTile.js").default);
|
|
13
|
+
constructor(layer: import("../../layer/VectorTile.js").default, options: import("./TileLayer.js").Options);
|
|
13
14
|
/** @private */
|
|
14
15
|
private boundHandleStyleImageChange_;
|
|
15
16
|
/**
|
|
@@ -44,16 +45,15 @@ declare class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer<impo
|
|
|
44
45
|
private tileClipContexts_;
|
|
45
46
|
/**
|
|
46
47
|
* @param {import("../../VectorRenderTile.js").default} tile Tile.
|
|
47
|
-
* @param {
|
|
48
|
-
* @param {
|
|
49
|
-
* @
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
* @param {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
isDrawableTile(tile: import("../../VectorRenderTile.js").default): boolean;
|
|
48
|
+
* @param {import("../../Map.js").FrameState} frameState Frame state.
|
|
49
|
+
* @param {number} x Left of the tile.
|
|
50
|
+
* @param {number} y Top of the tile.
|
|
51
|
+
* @param {number} w Width of the tile.
|
|
52
|
+
* @param {number} h Height of the tile.
|
|
53
|
+
* @param {number} gutter Tile gutter.
|
|
54
|
+
* @param {boolean} transition Apply an alpha transition.
|
|
55
|
+
*/
|
|
56
|
+
drawTile(tile: import("../../VectorRenderTile.js").default, frameState: import("../../Map.js").FrameState, x: number, y: number, w: number, h: number, gutter: number, transition: boolean): void;
|
|
57
57
|
/**
|
|
58
58
|
* @inheritDoc
|
|
59
59
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorTileLayer.d.ts","sourceRoot":"","sources":["VectorTileLayer.js"],"names":[],"mappings":";AA4DA;;;;;GAKG;AACH;IACE
|
|
1
|
+
{"version":3,"file":"VectorTileLayer.d.ts","sourceRoot":"","sources":["VectorTileLayer.js"],"names":[],"mappings":";AA4DA;;;;;GAKG;AACH;IACE;;;OAGG;IACH,mBAHW,OAAO,2BAA2B,EAAE,OAAO,WAC3C,OAAO,gBAAgB,EAAE,OAAO,EA2C1C;IAtCC,eAAe;IACf,qCAA2E;IAE3E;;;OAGG;IACH,+BAA2B;IAE3B;;;OAGG;IACH,4CAA+C;IAE/C;;;OAGG;IACH,0BAAsB;IAEtB;;;OAGG;IACH,yBAAyB;IAEzB;;;OAGG;IACH,sBAAsC;IAEtC;;;OAGG;IACH,0BAA6B;IAG/B;;;;;;;;;OASG;IACH,eATW,OAAO,2BAA2B,EAAE,OAAO,cAC3C,OAAO,cAAc,EAAE,UAAU,KACjC,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,UACN,MAAM,cACN,OAAO,QAYjB;IA6BD;;OAEG;IACH,6BAEC;IAgBD;;;;;OAKG;IACH,6BAqHC;IAyND;;;;OAIG;IACH,gCAEC;IAED;;;;OAIG;IACH,4BAHW,OAAO,cAAc,EAAE,UAAU,cACjC,OAAO,sBAAsB,EAAE,KAAK,QAiC9C;IA0DD,6DAgCC;IAkID;;;;;;;;OAQG;IACH,uBARW,OAAO,kBAAkB,EAAE,WAAW,oBACtC,MAAM,UACN,OAAO,sBAAsB,EAAE,OAAO,GAAC,MAAM,OAAO,sBAAsB,EAAE,OAAO,CAAC,gBACpF,OAAO,qCAAqC,EAAE,OAAO,gEAGpD,OAAO,CAyClB;IAED;;;;OAIG;IACH,8BAcC;IAED;;;;OAIG;IACH,yBAwDC;CACF;oCAn5BmC,gBAAgB"}
|
|
@@ -67,9 +67,10 @@ const VECTOR_REPLAYS = {
|
|
|
67
67
|
class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
|
68
68
|
/**
|
|
69
69
|
* @param {import("../../layer/VectorTile.js").default} layer VectorTile layer.
|
|
70
|
+
* @param {import("./TileLayer.js").Options} options Options.
|
|
70
71
|
*/
|
|
71
|
-
constructor(layer) {
|
|
72
|
-
super(layer);
|
|
72
|
+
constructor(layer, options) {
|
|
73
|
+
super(layer, options);
|
|
73
74
|
|
|
74
75
|
/** @private */
|
|
75
76
|
this.boundHandleStyleImageChange_ = this.handleStyleImageChange_.bind(this);
|
|
@@ -113,20 +114,24 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
|
|
113
114
|
|
|
114
115
|
/**
|
|
115
116
|
* @param {import("../../VectorRenderTile.js").default} tile Tile.
|
|
116
|
-
* @param {
|
|
117
|
-
* @param {
|
|
118
|
-
* @
|
|
117
|
+
* @param {import("../../Map.js").FrameState} frameState Frame state.
|
|
118
|
+
* @param {number} x Left of the tile.
|
|
119
|
+
* @param {number} y Top of the tile.
|
|
120
|
+
* @param {number} w Width of the tile.
|
|
121
|
+
* @param {number} h Height of the tile.
|
|
122
|
+
* @param {number} gutter Tile gutter.
|
|
123
|
+
* @param {boolean} transition Apply an alpha transition.
|
|
119
124
|
*/
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
drawTile(tile, frameState, x, y, w, h, gutter, transition) {
|
|
126
|
+
this.updateExecutorGroup_(
|
|
127
|
+
tile,
|
|
128
|
+
frameState.pixelRatio,
|
|
129
|
+
frameState.viewState.projection,
|
|
130
|
+
);
|
|
131
|
+
if (this.tileImageNeedsRender_(tile)) {
|
|
132
|
+
this.renderTileImage_(tile, frameState);
|
|
128
133
|
}
|
|
129
|
-
|
|
134
|
+
super.drawTile(tile, frameState, x, y, w, h, gutter, transition);
|
|
130
135
|
}
|
|
131
136
|
|
|
132
137
|
/**
|
|
@@ -134,15 +139,18 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
|
|
134
139
|
* @param {number} x Tile coordinate x.
|
|
135
140
|
* @param {number} y Tile coordinate y.
|
|
136
141
|
* @param {import("../../Map.js").FrameState} frameState Frame state.
|
|
137
|
-
* @return {
|
|
142
|
+
* @return {import("../../Tile.js").default|null} Tile (or null if outside source extent).
|
|
138
143
|
*/
|
|
139
144
|
getTile(z, x, y, frameState) {
|
|
140
|
-
const
|
|
145
|
+
const tile = /** @type {import("../../VectorRenderTile.js").default} */ (
|
|
146
|
+
this.getOrCreateTile(z, x, y, frameState)
|
|
147
|
+
);
|
|
148
|
+
if (!tile) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
|
|
141
152
|
const viewState = frameState.viewState;
|
|
142
153
|
const resolution = viewState.resolution;
|
|
143
|
-
const projection = viewState.projection;
|
|
144
|
-
const layer = this.getLayer();
|
|
145
|
-
const tile = layer.getSource().getTile(z, x, y, pixelRatio, projection);
|
|
146
154
|
const viewHints = frameState.viewHints;
|
|
147
155
|
const hifi = !(
|
|
148
156
|
viewHints[ViewHint.ANIMATING] || viewHints[ViewHint.INTERACTING]
|
|
@@ -150,29 +158,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
|
|
150
158
|
if (hifi || !tile.wantedResolution) {
|
|
151
159
|
tile.wantedResolution = resolution;
|
|
152
160
|
}
|
|
153
|
-
|
|
154
|
-
if (
|
|
155
|
-
render &&
|
|
156
|
-
(hifi || Date.now() - frameState.time < 8) &&
|
|
157
|
-
layer.getRenderMode() !== 'vector'
|
|
158
|
-
) {
|
|
159
|
-
this.renderTileImage_(tile, frameState);
|
|
160
|
-
}
|
|
161
|
-
return super.getTile(z, x, y, frameState);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* @param {import("../../VectorRenderTile.js").default} tile Tile.
|
|
166
|
-
* @return {boolean} Tile is drawable.
|
|
167
|
-
*/
|
|
168
|
-
isDrawableTile(tile) {
|
|
169
|
-
const layer = this.getLayer();
|
|
170
|
-
return (
|
|
171
|
-
super.isDrawableTile(tile) &&
|
|
172
|
-
(layer.getRenderMode() === 'vector'
|
|
173
|
-
? getUid(layer) in tile.executorGroups
|
|
174
|
-
: tile.hasContext(layer))
|
|
175
|
-
);
|
|
161
|
+
return tile;
|
|
176
162
|
}
|
|
177
163
|
|
|
178
164
|
/**
|
|
@@ -243,7 +229,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
|
|
243
229
|
const builderExtent = buffer(
|
|
244
230
|
sharedExtent,
|
|
245
231
|
layer.getRenderBuffer() * resolution,
|
|
246
|
-
this.
|
|
232
|
+
this.tempExtent,
|
|
247
233
|
);
|
|
248
234
|
const bufferedExtent = equals(sourceTileExtent, sharedExtent)
|
|
249
235
|
? null
|
|
@@ -656,7 +642,8 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
|
|
656
642
|
const tileCoord = tile.tileCoord;
|
|
657
643
|
const tileExtent = tileGrid.getTileCoordExtent(tile.wrappedTileCoord);
|
|
658
644
|
const worldOffset =
|
|
659
|
-
tileGrid.getTileCoordExtent(tileCoord, this.
|
|
645
|
+
tileGrid.getTileCoordExtent(tileCoord, this.tempExtent)[0] -
|
|
646
|
+
tileExtent[0];
|
|
660
647
|
const transform = multiply(
|
|
661
648
|
scale(this.inversePixelTransform.slice(), 1 / pixelRatio, 1 / pixelRatio),
|
|
662
649
|
this.getRenderTransform(
|
|
@@ -896,7 +883,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
|
|
896
883
|
const renderPixelRatio =
|
|
897
884
|
(frameState.pixelRatio / tile.wantedResolution) * tileResolution;
|
|
898
885
|
const resolution = tileGrid.getResolution(z);
|
|
899
|
-
const context = tile.getContext(
|
|
886
|
+
const context = tile.getContext();
|
|
900
887
|
|
|
901
888
|
// Increase tile size when overzooming for low pixel ratio, to avoid blurry tiles
|
|
902
889
|
pixelRatio = Math.round(
|
|
@@ -911,7 +898,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
|
|
911
898
|
scaleTransform(canvasTransform, renderScale, renderScale);
|
|
912
899
|
context.setTransform.apply(context, canvasTransform);
|
|
913
900
|
}
|
|
914
|
-
const tileExtent = tileGrid.getTileCoordExtent(tileCoord, this.
|
|
901
|
+
const tileExtent = tileGrid.getTileCoordExtent(tileCoord, this.tempExtent);
|
|
915
902
|
const pixelScale = renderPixelRatio / resolution;
|
|
916
903
|
const transform = resetTransform(this.tmpTransform_);
|
|
917
904
|
scaleTransform(transform, pixelScale, -pixelScale);
|
|
@@ -129,12 +129,6 @@ declare class WebGLBaseTileLayerRenderer<LayerType extends import("../../layer/B
|
|
|
129
129
|
* @param {Options} options Options.
|
|
130
130
|
*/
|
|
131
131
|
reset(options: Options): void;
|
|
132
|
-
/**
|
|
133
|
-
* @param {TileType} tile Tile.
|
|
134
|
-
* @return {boolean} Tile is drawable.
|
|
135
|
-
* @private
|
|
136
|
-
*/
|
|
137
|
-
private isDrawableTile_;
|
|
138
132
|
/**
|
|
139
133
|
* @abstract
|
|
140
134
|
* @param {import("../../webgl/BaseTileRepresentation.js").TileRepresentationOptions<TileType>} options tile representation options
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileLayerBase.d.ts","sourceRoot":"","sources":["TileLayerBase.js"],"names":[],"mappings":"AAuDA;;GAEG;AACH;;;;GAIG;AAEH;;GAEG;AACH,+CAFY,wBAAwB,CAInC;AA0DD,iEAEC;;;;;;;;;;;;;;yCAzEY,OAAO,uCAAuC,EAAE,OAAO,CAAC,OAAO,eAAe,EAAE,OAAO,CAAC;;;;;aAIvF,IAAI,MAAM,CAAC;;;;;YACJ,MAAM,GAAE,6FAA+B;;;;;;;;;;;;;;;;;;;;;AAsE5D;;;;;;GAMG;AAEH;;GAEG;AAEH;;;;;;;GAOG;AACH;IACE;;;OAGG;IACH,uBAHW,SAAS,WACT,OAAO,EA+DjB;IAvDC;;;OAGG;IACH,gBAFU,OAAO,CAEU;IAE3B;;;;OAIG;IACH,uBAAuC;IAEvC;;;OAGG;IACH,oBAHU,MAAM,MAAM,CAAC,CAGK;IAE5B;;;OAGG;IACH,uBAA+C;IAE/C;;;OAGG;IACH,uBAA8C;IAE9C;;;OAGG;IACH,kBAAuB;IAGvB;;;OAGG;IACH,mCAHU,OAAO,2BAA2B,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAGnB;IAEtD;;;OAGG;IACH,sBAFU,OAAO,cAAc,EAAE,UAAU,GAAC,IAAI,CAE1B;IAEtB;;;OAGG;IACH,oBAA4B;IAG9B;;OAEG;IACH,eAFW,OAAO,QAMjB;
|
|
1
|
+
{"version":3,"file":"TileLayerBase.d.ts","sourceRoot":"","sources":["TileLayerBase.js"],"names":[],"mappings":"AAuDA;;GAEG;AACH;;;;GAIG;AAEH;;GAEG;AACH,+CAFY,wBAAwB,CAInC;AA0DD,iEAEC;;;;;;;;;;;;;;yCAzEY,OAAO,uCAAuC,EAAE,OAAO,CAAC,OAAO,eAAe,EAAE,OAAO,CAAC;;;;;aAIvF,IAAI,MAAM,CAAC;;;;;YACJ,MAAM,GAAE,6FAA+B;;;;;;;;;;;;;;;;;;;;;AAsE5D;;;;;;GAMG;AAEH;;GAEG;AAEH;;;;;;;GAOG;AACH;IACE;;;OAGG;IACH,uBAHW,SAAS,WACT,OAAO,EA+DjB;IAvDC;;;OAGG;IACH,gBAFU,OAAO,CAEU;IAE3B;;;;OAIG;IACH,uBAAuC;IAEvC;;;OAGG;IACH,oBAHU,MAAM,MAAM,CAAC,CAGK;IAE5B;;;OAGG;IACH,uBAA+C;IAE/C;;;OAGG;IACH,uBAA8C;IAE9C;;;OAGG;IACH,kBAAuB;IAGvB;;;OAGG;IACH,mCAHU,OAAO,2BAA2B,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAGnB;IAEtD;;;OAGG;IACH,sBAFU,OAAO,cAAc,EAAE,UAAU,GAAC,IAAI,CAE1B;IAEtB;;;OAGG;IACH,oBAA4B;IAG9B;;OAEG;IACH,eAFW,OAAO,QAMjB;IA2BD;;;;;OAKG;IACH,4CAJW,OAAO,uCAAuC,EAAE,yBAAyB,CAAC,QAAQ,CAAC,GAClF,kBAAkB,CAK7B;IAED;;;;;;OAMG;IACH,yBANW,OAAO,cAAc,EAAE,UAAU,UACjC,OAAO,iBAAiB,EAAE,MAAM,YAChC,MAAM,4BACN,wBAAwB,WACxB,MAAM,QAqHhB;IAED;;;;OAIG;IACH,wCAJW,OAAO,cAAc,EAAE,UAAU,kBACjC,OAAO,QAKjB;IAED;;;;OAIG;IACH,4CAJW,OAAO,cAAc,EAAE,UAAU,GAChC,OAAO,CAKlB;IAED;;;;;;;;;;;;;OAaG;IACH,yCAbW,kBAAkB,iBAClB,OAAO,oBAAoB,EAAE,SAAS,cACtC,OAAO,cAAc,EAAE,UAAU,gBACjC,OAAO,iBAAiB,EAAE,MAAM,kBAChC,MAAM,YACN,OAAO,eAAe,EAAE,IAAI,cAC5B,OAAO,qBAAqB,EAAE,UAAU,cACxC,OAAO,iBAAiB,EAAE,MAAM,SAChC,MAAM,UACN,MAAM,SACN,MAAM,QAeb;IAEJ;;;;;;OAMG;IACH,6CANW,kBAAkB,SAClB,MAAM,UACN,OAAO,iBAAiB,EAAE,MAAM,SAChC,MAAM,QAG0C;IAE3D,iIAuEC;IAED;;;;OAIG;IACH,wBAHW,OAAO,cAAc,EAAE,UAAU,GAChC,WAAW,CAwNtB;IAED;;;;;;;;;;OAUG;IACH,sBAsCC;IAED,mBAMC;CAiBF;+BAlyB8B,YAAY"}
|
|
@@ -226,22 +226,6 @@ class WebGLBaseTileLayerRenderer extends WebGLLayerRenderer {
|
|
|
226
226
|
});
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
/**
|
|
230
|
-
* @param {TileType} tile Tile.
|
|
231
|
-
* @return {boolean} Tile is drawable.
|
|
232
|
-
* @private
|
|
233
|
-
*/
|
|
234
|
-
isDrawableTile_(tile) {
|
|
235
|
-
const tileLayer = this.getLayer();
|
|
236
|
-
const tileState = tile.getState();
|
|
237
|
-
const useInterimTilesOnError = tileLayer.getUseInterimTilesOnError();
|
|
238
|
-
return (
|
|
239
|
-
tileState == TileState.LOADED ||
|
|
240
|
-
tileState == TileState.EMPTY ||
|
|
241
|
-
(tileState == TileState.ERROR && !useInterimTilesOnError)
|
|
242
|
-
);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
229
|
/**
|
|
246
230
|
* Determine whether renderFrame should be called.
|
|
247
231
|
* @param {import("../../Map.js").FrameState} frameState Frame state.
|
|
@@ -356,6 +340,9 @@ class WebGLBaseTileLayerRenderer extends WebGLLayerRenderer {
|
|
|
356
340
|
frameState.pixelRatio,
|
|
357
341
|
viewState.projection,
|
|
358
342
|
);
|
|
343
|
+
if (!tile) {
|
|
344
|
+
continue;
|
|
345
|
+
}
|
|
359
346
|
}
|
|
360
347
|
|
|
361
348
|
if (lookupHasTile(tileRepresentationLookup, tile)) {
|
|
@@ -371,14 +358,7 @@ class WebGLBaseTileLayerRenderer extends WebGLLayerRenderer {
|
|
|
371
358
|
});
|
|
372
359
|
tileRepresentationCache.set(cacheKey, tileRepresentation);
|
|
373
360
|
} else {
|
|
374
|
-
|
|
375
|
-
tileRepresentation.setTile(tile);
|
|
376
|
-
} else {
|
|
377
|
-
const interimTile = /** @type {TileType} */ (
|
|
378
|
-
tile.getInterimTile()
|
|
379
|
-
);
|
|
380
|
-
tileRepresentation.setTile(interimTile);
|
|
381
|
-
}
|
|
361
|
+
tileRepresentation.setTile(tile);
|
|
382
362
|
}
|
|
383
363
|
|
|
384
364
|
addTileRepresentationToLookup(
|
|
@@ -601,60 +581,62 @@ class WebGLBaseTileLayerRenderer extends WebGLLayerRenderer {
|
|
|
601
581
|
const time = frameState.time;
|
|
602
582
|
let blend = false;
|
|
603
583
|
|
|
604
|
-
|
|
605
|
-
for (const tileRepresentation of tileRepresentationLookup
|
|
606
|
-
.representationsByZ[z]) {
|
|
607
|
-
const tile = tileRepresentation.tile;
|
|
608
|
-
if (
|
|
609
|
-
(tile instanceof ReprojTile || tile instanceof ReprojDataTile) &&
|
|
610
|
-
tile.getState() === TileState.EMPTY
|
|
611
|
-
) {
|
|
612
|
-
continue;
|
|
613
|
-
}
|
|
614
|
-
const tileCoord = tile.tileCoord;
|
|
584
|
+
const representationsByZ = tileRepresentationLookup.representationsByZ;
|
|
615
585
|
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
586
|
+
// look for cached tiles to use if a target tile is not ready
|
|
587
|
+
if (z in representationsByZ) {
|
|
588
|
+
for (const tileRepresentation of representationsByZ[z]) {
|
|
589
|
+
const tile = tileRepresentation.tile;
|
|
590
|
+
if (
|
|
591
|
+
(tile instanceof ReprojTile || tile instanceof ReprojDataTile) &&
|
|
592
|
+
tile.getState() === TileState.EMPTY
|
|
593
|
+
) {
|
|
621
594
|
continue;
|
|
622
595
|
}
|
|
623
|
-
|
|
624
|
-
const tileCoordKey = getTileCoordKey(tileCoord);
|
|
625
|
-
alphaLookup[tileCoordKey] = alpha;
|
|
626
|
-
}
|
|
627
|
-
this.renderComplete = false;
|
|
628
|
-
|
|
629
|
-
// first look for child tiles (at z + 1)
|
|
630
|
-
const coveredByChildren = this.findAltTiles_(
|
|
631
|
-
tileGrid,
|
|
632
|
-
tileCoord,
|
|
633
|
-
z + 1,
|
|
634
|
-
tileRepresentationLookup,
|
|
635
|
-
);
|
|
596
|
+
const tileCoord = tile.tileCoord;
|
|
636
597
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
598
|
+
if (tileRepresentation.ready) {
|
|
599
|
+
const alpha = tile.getAlpha(uid, time);
|
|
600
|
+
if (alpha === 1) {
|
|
601
|
+
// no need to look for alt tiles
|
|
602
|
+
tile.endTransition(uid);
|
|
603
|
+
continue;
|
|
604
|
+
}
|
|
605
|
+
blend = true;
|
|
606
|
+
const tileCoordKey = getTileCoordKey(tileCoord);
|
|
607
|
+
alphaLookup[tileCoordKey] = alpha;
|
|
608
|
+
}
|
|
609
|
+
this.renderComplete = false;
|
|
640
610
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
for (let parentZ = z - 1; parentZ >= minZoom; --parentZ) {
|
|
644
|
-
const coveredByParent = this.findAltTiles_(
|
|
611
|
+
// first look for child tiles (at z + 1)
|
|
612
|
+
const coveredByChildren = this.findAltTiles_(
|
|
645
613
|
tileGrid,
|
|
646
614
|
tileCoord,
|
|
647
|
-
|
|
615
|
+
z + 1,
|
|
648
616
|
tileRepresentationLookup,
|
|
649
617
|
);
|
|
650
618
|
|
|
651
|
-
if (
|
|
652
|
-
|
|
619
|
+
if (coveredByChildren) {
|
|
620
|
+
continue;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
// next look for parent tiles
|
|
624
|
+
const minZoom = tileGrid.getMinZoom();
|
|
625
|
+
for (let parentZ = z - 1; parentZ >= minZoom; --parentZ) {
|
|
626
|
+
const coveredByParent = this.findAltTiles_(
|
|
627
|
+
tileGrid,
|
|
628
|
+
tileCoord,
|
|
629
|
+
parentZ,
|
|
630
|
+
tileRepresentationLookup,
|
|
631
|
+
);
|
|
632
|
+
|
|
633
|
+
if (coveredByParent) {
|
|
634
|
+
break;
|
|
635
|
+
}
|
|
653
636
|
}
|
|
654
637
|
}
|
|
655
638
|
}
|
|
656
639
|
|
|
657
|
-
const representationsByZ = tileRepresentationLookup.representationsByZ;
|
|
658
640
|
const zs = Object.keys(representationsByZ).map(Number).sort(descending);
|
|
659
641
|
|
|
660
642
|
const renderTileMask = this.beforeTilesMaskRender(frameState);
|
|
@@ -703,19 +685,21 @@ class WebGLBaseTileLayerRenderer extends WebGLLayerRenderer {
|
|
|
703
685
|
}
|
|
704
686
|
}
|
|
705
687
|
|
|
706
|
-
|
|
707
|
-
const
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
688
|
+
if (z in representationsByZ) {
|
|
689
|
+
for (const tileRepresentation of representationsByZ[z]) {
|
|
690
|
+
const tileCoord = tileRepresentation.tile.tileCoord;
|
|
691
|
+
const tileCoordKey = getTileCoordKey(tileCoord);
|
|
692
|
+
if (tileCoordKey in alphaLookup) {
|
|
693
|
+
this.drawTile_(
|
|
694
|
+
frameState,
|
|
695
|
+
tileRepresentation,
|
|
696
|
+
z,
|
|
697
|
+
gutter,
|
|
698
|
+
extent,
|
|
699
|
+
alphaLookup,
|
|
700
|
+
tileGrid,
|
|
701
|
+
);
|
|
702
|
+
}
|
|
719
703
|
}
|
|
720
704
|
}
|
|
721
705
|
|
|
@@ -741,7 +725,6 @@ class WebGLBaseTileLayerRenderer extends WebGLLayerRenderer {
|
|
|
741
725
|
* @param {import("../../Map.js").FrameState} frameState Frame state.
|
|
742
726
|
*/
|
|
743
727
|
const postRenderFunction = function (map, frameState) {
|
|
744
|
-
tileSource.updateCacheSize(0.1, frameState.viewState.projection);
|
|
745
728
|
tileSource.expireCache(frameState.viewState.projection, empty);
|
|
746
729
|
};
|
|
747
730
|
|
package/reproj/DataTile.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTile.d.ts","sourceRoot":"","sources":["DataTile.js"],"names":[],"mappings":";gCAoBsB,MAAM,QAAE,MAAM,QAAE,MAAM,QAAE,MAAM,KAAI,OAAO,gBAAgB,EAAE,OAAO;;;;;UAK1E,QAAQ;;;;YACR,MAAM;;;;;;gBAKN,OAAO,uBAAuB,EAAE,OAAO;;;;oBACvC,OAAO,yBAAyB,EAAE,OAAO;;;;gBACzC,OAAO,uBAAuB,EAAE,OAAO;;;;oBACvC,OAAO,yBAAyB,EAAE,OAAO;;;;eACzC,OAAO,iBAAiB,EAAE,SAAS;;;;;;;;gBAEnC,MAAM;;;;YACN,MAAM;;;;qBACN,UAAU;;;;;;;;;;;;;;;;AApBxB;;GAEG;AAEH;;;;GAIG;AAEH;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;GAKG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,EAyNjB;IA/MC;;;OAGG;IACH,oBAAqC;IAErC;;;OAGG;IACH,gBAA6B;IAE7B;;;OAGG;IACH,oBAAuB;IAEvB;;;OAGG;IACH,qBAAwB;IAExB;;;OAGG;IACH,oBAA4B;IAE5B;;;OAGG;IACH,wBAA6C;IAE7C;;;OAGG;IACH,wBAA6C;IAE7C;;;OAGG;IACH,0BAAsE;IAEtE;;;OAGG;IACH,qBAAsB;IAEtB;;;OAGG;IACH,6BAAgC;IAEhC;;;OAGG;IACH,iBAAiB;IAMjB;;;OAGG;IACH,oBAIwB;IAmDxB;;;OAGG;IACH,uBAOC;IA6FH;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"DataTile.d.ts","sourceRoot":"","sources":["DataTile.js"],"names":[],"mappings":";gCAoBsB,MAAM,QAAE,MAAM,QAAE,MAAM,QAAE,MAAM,KAAI,OAAO,gBAAgB,EAAE,OAAO;;;;;UAK1E,QAAQ;;;;YACR,MAAM;;;;;;gBAKN,OAAO,uBAAuB,EAAE,OAAO;;;;oBACvC,OAAO,yBAAyB,EAAE,OAAO;;;;gBACzC,OAAO,uBAAuB,EAAE,OAAO;;;;oBACvC,OAAO,yBAAyB,EAAE,OAAO;;;;eACzC,OAAO,iBAAiB,EAAE,SAAS;;;;;;;;gBAEnC,MAAM;;;;YACN,MAAM;;;;qBACN,UAAU;;;;;;;;;;;;;;;;AApBxB;;GAEG;AAEH;;;;GAIG;AAEH;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;GAKG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,EAyNjB;IA/MC;;;OAGG;IACH,oBAAqC;IAErC;;;OAGG;IACH,gBAA6B;IAE7B;;;OAGG;IACH,oBAAuB;IAEvB;;;OAGG;IACH,qBAAwB;IAExB;;;OAGG;IACH,oBAA4B;IAE5B;;;OAGG;IACH,wBAA6C;IAE7C;;;OAGG;IACH,wBAA6C;IAE7C;;;OAGG;IACH,0BAAsE;IAEtE;;;OAGG;IACH,qBAAsB;IAEtB;;;OAGG;IACH,6BAAgC;IAEhC;;;OAGG;IACH,iBAAiB;IAMjB;;;OAGG;IACH,oBAIwB;IAmDxB;;;OAGG;IACH,uBAOC;IA6FH;;OAEG;IACH,mBAoLC;IAyDD;;OAEG;IACH,yBAGC;CACF;qBA5hByD,gBAAgB"}
|
package/reproj/DataTile.js
CHANGED
|
@@ -58,7 +58,7 @@ class ReprojDataTile extends DataTile {
|
|
|
58
58
|
constructor(options) {
|
|
59
59
|
super({
|
|
60
60
|
tileCoord: options.tileCoord,
|
|
61
|
-
loader: () => Promise.resolve(new
|
|
61
|
+
loader: () => Promise.resolve(new Uint8ClampedArray(4)),
|
|
62
62
|
interpolate: options.interpolate,
|
|
63
63
|
transition: options.transition,
|
|
64
64
|
});
|
|
@@ -301,6 +301,7 @@ class ReprojDataTile extends DataTile {
|
|
|
301
301
|
*/
|
|
302
302
|
reproject_() {
|
|
303
303
|
const dataSources = [];
|
|
304
|
+
let imageLike = false;
|
|
304
305
|
this.sourceTiles_.forEach((source) => {
|
|
305
306
|
const tile = source.tile;
|
|
306
307
|
if (!tile || tile.getState() !== TileState.LOADED) {
|
|
@@ -316,12 +317,13 @@ class ReprojDataTile extends DataTile {
|
|
|
316
317
|
if (arrayData) {
|
|
317
318
|
tileData = arrayData;
|
|
318
319
|
} else {
|
|
320
|
+
imageLike = true;
|
|
319
321
|
tileData = toArray(asImageLike(tile.getData()));
|
|
320
322
|
}
|
|
321
323
|
const pixelSize = [size[0] + 2 * gutter, size[1] + 2 * gutter];
|
|
322
324
|
const isFloat = tileData instanceof Float32Array;
|
|
323
325
|
const pixelCount = pixelSize[0] * pixelSize[1];
|
|
324
|
-
const DataType = isFloat ? Float32Array :
|
|
326
|
+
const DataType = isFloat ? Float32Array : Uint8ClampedArray;
|
|
325
327
|
const tileDataR = new DataType(tileData.buffer);
|
|
326
328
|
const bytesPerElement = DataType.BYTES_PER_ELEMENT;
|
|
327
329
|
const bytesPerPixel = (bytesPerElement * tileDataR.length) / pixelCount;
|
|
@@ -354,7 +356,7 @@ class ReprojDataTile extends DataTile {
|
|
|
354
356
|
dataSources.push({
|
|
355
357
|
extent: extent,
|
|
356
358
|
clipExtent: clipExtent,
|
|
357
|
-
data: new
|
|
359
|
+
data: new Uint8ClampedArray(packedData.buffer),
|
|
358
360
|
dataType: DataType,
|
|
359
361
|
bytesPerPixel: bytesPerPixel,
|
|
360
362
|
pixelSize: pixelSize,
|
|
@@ -364,117 +366,118 @@ class ReprojDataTile extends DataTile {
|
|
|
364
366
|
|
|
365
367
|
if (dataSources.length === 0) {
|
|
366
368
|
this.state = TileState.ERROR;
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
const targetWidth = typeof size === 'number' ? size : size[0];
|
|
371
|
-
const targetHeight = typeof size === 'number' ? size : size[1];
|
|
372
|
-
const targetResolution = this.targetTileGrid_.getResolution(z);
|
|
373
|
-
const sourceResolution = this.sourceTileGrid_.getResolution(
|
|
374
|
-
this.sourceZ_,
|
|
375
|
-
);
|
|
376
|
-
|
|
377
|
-
const targetExtent = this.targetTileGrid_.getTileCoordExtent(
|
|
378
|
-
this.wrappedTileCoord_,
|
|
379
|
-
);
|
|
369
|
+
this.changed();
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
380
372
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
const sources = [];
|
|
388
|
-
for (let i = 0, len = dataSources.length; i < len; ++i) {
|
|
389
|
-
const dataSource = dataSources[i];
|
|
390
|
-
const buffer = dataSource.data;
|
|
391
|
-
const pixelSize = dataSource.pixelSize;
|
|
392
|
-
const width = pixelSize[0];
|
|
393
|
-
const height = pixelSize[1];
|
|
394
|
-
const context = createCanvasContext2D(width, height, canvasPool);
|
|
395
|
-
const imageData = context.createImageData(width, height);
|
|
396
|
-
const data = imageData.data;
|
|
397
|
-
let offset = reproj * 3;
|
|
398
|
-
for (let j = 0, len = data.length; j < len; j += 4) {
|
|
399
|
-
data[j] = buffer[offset];
|
|
400
|
-
data[j + 1] = buffer[offset + 1];
|
|
401
|
-
data[j + 2] = buffer[offset + 2];
|
|
402
|
-
data[j + 3] = 255;
|
|
403
|
-
offset += bytesPerPixel;
|
|
404
|
-
}
|
|
405
|
-
context.putImageData(imageData, 0, 0);
|
|
406
|
-
sources.push({
|
|
407
|
-
extent: dataSource.extent,
|
|
408
|
-
clipExtent: dataSource.clipExtent,
|
|
409
|
-
image: context.canvas,
|
|
410
|
-
});
|
|
411
|
-
}
|
|
373
|
+
const z = this.wrappedTileCoord_[0];
|
|
374
|
+
const size = this.targetTileGrid_.getTileSize(z);
|
|
375
|
+
const targetWidth = typeof size === 'number' ? size : size[0];
|
|
376
|
+
const targetHeight = typeof size === 'number' ? size : size[1];
|
|
377
|
+
const targetResolution = this.targetTileGrid_.getResolution(z);
|
|
378
|
+
const sourceResolution = this.sourceTileGrid_.getResolution(this.sourceZ_);
|
|
412
379
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
this.pixelRatio_,
|
|
417
|
-
sourceResolution,
|
|
418
|
-
this.sourceTileGrid_.getExtent(),
|
|
419
|
-
targetResolution,
|
|
420
|
-
targetExtent,
|
|
421
|
-
this.triangulation_,
|
|
422
|
-
sources,
|
|
423
|
-
this.gutter_,
|
|
424
|
-
false,
|
|
425
|
-
false,
|
|
426
|
-
false,
|
|
427
|
-
//true,
|
|
428
|
-
);
|
|
380
|
+
const targetExtent = this.targetTileGrid_.getTileCoordExtent(
|
|
381
|
+
this.wrappedTileCoord_,
|
|
382
|
+
);
|
|
429
383
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
384
|
+
let dataR, dataU;
|
|
385
|
+
|
|
386
|
+
const bytesPerPixel = dataSources[0].bytesPerPixel;
|
|
387
|
+
|
|
388
|
+
const reprojs = Math.ceil(bytesPerPixel / 3);
|
|
389
|
+
for (let reproj = reprojs - 1; reproj >= 0; --reproj) {
|
|
390
|
+
const sources = [];
|
|
391
|
+
for (let i = 0, len = dataSources.length; i < len; ++i) {
|
|
392
|
+
const dataSource = dataSources[i];
|
|
393
|
+
const buffer = dataSource.data;
|
|
394
|
+
const pixelSize = dataSource.pixelSize;
|
|
395
|
+
const width = pixelSize[0];
|
|
396
|
+
const height = pixelSize[1];
|
|
397
|
+
const context = createCanvasContext2D(width, height, canvasPool);
|
|
398
|
+
const imageData = context.createImageData(width, height);
|
|
399
|
+
const data = imageData.data;
|
|
400
|
+
let offset = reproj * 3;
|
|
401
|
+
for (let j = 0, len = data.length; j < len; j += 4) {
|
|
402
|
+
data[j] = buffer[offset];
|
|
403
|
+
data[j + 1] = buffer[offset + 1];
|
|
404
|
+
data[j + 2] = buffer[offset + 2];
|
|
405
|
+
data[j + 3] = 255;
|
|
406
|
+
offset += bytesPerPixel;
|
|
435
407
|
}
|
|
408
|
+
context.putImageData(imageData, 0, 0);
|
|
409
|
+
sources.push({
|
|
410
|
+
extent: dataSource.extent,
|
|
411
|
+
clipExtent: dataSource.clipExtent,
|
|
412
|
+
image: context.canvas,
|
|
413
|
+
});
|
|
414
|
+
}
|
|
436
415
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
416
|
+
const canvas = renderReprojected(
|
|
417
|
+
targetWidth,
|
|
418
|
+
targetHeight,
|
|
419
|
+
this.pixelRatio_,
|
|
420
|
+
sourceResolution,
|
|
421
|
+
this.sourceTileGrid_.getExtent(),
|
|
422
|
+
targetResolution,
|
|
423
|
+
targetExtent,
|
|
424
|
+
this.triangulation_,
|
|
425
|
+
sources,
|
|
426
|
+
this.gutter_,
|
|
427
|
+
false,
|
|
428
|
+
false,
|
|
429
|
+
false,
|
|
430
|
+
);
|
|
444
431
|
|
|
432
|
+
for (let i = 0, len = sources.length; i < len; ++i) {
|
|
433
|
+
const canvas = sources[i].image;
|
|
434
|
+
const context = canvas.getContext('2d');
|
|
445
435
|
releaseCanvas(context);
|
|
446
|
-
canvasPool.push(canvas);
|
|
436
|
+
canvasPool.push(context.canvas);
|
|
437
|
+
}
|
|
447
438
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
bytesPerPixel * imageData.width * imageData.height,
|
|
451
|
-
);
|
|
452
|
-
dataR = new dataSources[0].dataType(dataU.buffer);
|
|
453
|
-
}
|
|
439
|
+
const context = canvas.getContext('2d');
|
|
440
|
+
const imageData = context.getImageData(0, 0, canvas.width, canvas.height);
|
|
454
441
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
442
|
+
releaseCanvas(context);
|
|
443
|
+
canvasPool.push(canvas);
|
|
444
|
+
|
|
445
|
+
if (!dataR) {
|
|
446
|
+
dataU = new Uint8ClampedArray(
|
|
447
|
+
bytesPerPixel * imageData.width * imageData.height,
|
|
448
|
+
);
|
|
449
|
+
dataR = new dataSources[0].dataType(dataU.buffer);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
const data = imageData.data;
|
|
453
|
+
let offset = reproj * 3;
|
|
454
|
+
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
455
|
+
if (data[i + 3] === 255) {
|
|
456
|
+
dataU[offset] = data[i];
|
|
457
|
+
dataU[offset + 1] = data[i + 1];
|
|
458
|
+
dataU[offset + 2] = data[i + 2];
|
|
459
|
+
} else {
|
|
460
|
+
dataU[offset] = 0;
|
|
461
|
+
dataU[offset + 1] = 0;
|
|
462
|
+
dataU[offset + 2] = 0;
|
|
468
463
|
}
|
|
464
|
+
offset += bytesPerPixel;
|
|
469
465
|
}
|
|
466
|
+
}
|
|
470
467
|
|
|
468
|
+
if (imageLike) {
|
|
469
|
+
const context = createCanvasContext2D(targetWidth, targetHeight);
|
|
470
|
+
const imageData = new ImageData(dataR, targetWidth);
|
|
471
|
+
context.putImageData(imageData, 0, 0);
|
|
472
|
+
this.reprojData_ = context.canvas;
|
|
473
|
+
} else {
|
|
471
474
|
this.reprojData_ = dataR;
|
|
472
|
-
this.reprojSize_ = [
|
|
473
|
-
Math.round(targetWidth * this.pixelRatio_),
|
|
474
|
-
Math.round(targetHeight * this.pixelRatio_),
|
|
475
|
-
];
|
|
476
|
-
this.state = TileState.LOADED;
|
|
477
475
|
}
|
|
476
|
+
this.reprojSize_ = [
|
|
477
|
+
Math.round(targetWidth * this.pixelRatio_),
|
|
478
|
+
Math.round(targetHeight * this.pixelRatio_),
|
|
479
|
+
];
|
|
480
|
+
this.state = TileState.LOADED;
|
|
478
481
|
this.changed();
|
|
479
482
|
}
|
|
480
483
|
|