ol 7.4.1-dev.1687456757231 → 7.4.1-dev.1687635109947
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 +2 -2
- package/dist/ol.js.map +1 -1
- package/package.json +1 -1
- package/source/Raster.d.ts +1 -0
- package/source/Raster.d.ts.map +1 -1
- package/source/Raster.js +45 -40
- package/util.js +1 -1
package/package.json
CHANGED
package/source/Raster.d.ts
CHANGED
|
@@ -394,6 +394,7 @@ declare class RasterSource extends ImageSource {
|
|
|
394
394
|
getImage(extent: import("../extent.js").Extent, resolution: number, pixelRatio: number, projection: import("../proj/Projection.js").default): import("../ImageCanvas.js").default;
|
|
395
395
|
/**
|
|
396
396
|
* Start processing source data.
|
|
397
|
+
* @return {Promise<void>} Promise resolving when the worker result is available.
|
|
397
398
|
* @private
|
|
398
399
|
*/
|
|
399
400
|
private processSources_;
|
package/source/Raster.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Raster.d.ts","sourceRoot":"","sources":["Raster.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Raster.d.ts","sourceRoot":"","sources":["Raster.js"],"names":[],"mappings":"AA8BA;;;;;GAKG;AACH,mCALW,iBAAiB,SACjB,MAAM,UACN,MAAM,GACL,SAAS,CAapB;AAgJD;;GAEG;AAEH;;;;;GAKG;AAEH;;;;;;;GAOG;AAEH;;;GAGG;AACH;IACE;;OAEG;IACH,oBAFW,gBAAgB,EAmD1B;IA9CC,mBAAkC;IAwBlC,mBAAuB;IAEvB;;;OAGG;IACH,eAAgB;IAEhB,wBAA+C;IAC/C,iBAAiB;IAEjB;;;OAGG;IACH,oBAAqB;IAErB;;;OAGG;IACH,aAAgB;IAGlB;;;;;;;;OAQG;IACH,gBAPW,MAAM,SAAS,CAAC,8BAGP,KAAK,QAAE,SAAS,gBAAW,IAAI,QAWlD;IAED;;;OAGG;IACH,cAFW,GAAG,QAOb;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uC9C;IAED;;;;OAIG;IACH,wBA4BC;IAED;;;;;;;OAOG;IACH,0BAmCC;IAED;;;OAGG;IACH,kFAFY,MAAM,MAAM,CAAC,GAAC,IAAI,CAiB7B;CAQF;wBA34BuB,YAAY"}
|
package/source/Raster.js
CHANGED
|
@@ -16,6 +16,8 @@ import {create as createTransform} from '../transform.js';
|
|
|
16
16
|
import {equals, getCenter, getHeight, getWidth} from '../extent.js';
|
|
17
17
|
import {getUid} from '../util.js';
|
|
18
18
|
|
|
19
|
+
const resolve = Promise.resolve();
|
|
20
|
+
|
|
19
21
|
let hasImageData = true;
|
|
20
22
|
try {
|
|
21
23
|
new ImageData(10, 10);
|
|
@@ -599,9 +601,7 @@ class RasterSource extends ImageSource {
|
|
|
599
601
|
* @private
|
|
600
602
|
* @type {import("../TileQueue.js").default}
|
|
601
603
|
*/
|
|
602
|
-
this.tileQueue_ = new TileQueue(
|
|
603
|
-
return 1;
|
|
604
|
-
}, this.changed.bind(this));
|
|
604
|
+
this.tileQueue_ = new TileQueue(() => 1, changed);
|
|
605
605
|
|
|
606
606
|
/**
|
|
607
607
|
* The most recently requested frame state.
|
|
@@ -680,6 +680,10 @@ class RasterSource extends ImageSource {
|
|
|
680
680
|
}
|
|
681
681
|
}
|
|
682
682
|
|
|
683
|
+
changed() {
|
|
684
|
+
this.processSources_().then(() => super.changed());
|
|
685
|
+
}
|
|
686
|
+
|
|
683
687
|
/**
|
|
684
688
|
* Set the operation.
|
|
685
689
|
* @param {Operation} operation New operation.
|
|
@@ -774,10 +778,12 @@ class RasterSource extends ImageSource {
|
|
|
774
778
|
const frameState = this.updateFrameState_(extent, resolution, projection);
|
|
775
779
|
this.requestedFrameState_ = frameState;
|
|
776
780
|
|
|
781
|
+
const canvas = this.renderedImageCanvas_;
|
|
782
|
+
|
|
777
783
|
// check if we can't reuse the existing ol/ImageCanvas
|
|
778
|
-
if (
|
|
779
|
-
const renderedResolution =
|
|
780
|
-
const renderedExtent =
|
|
784
|
+
if (canvas) {
|
|
785
|
+
const renderedResolution = canvas.getResolution();
|
|
786
|
+
const renderedExtent = canvas.getExtent();
|
|
781
787
|
if (
|
|
782
788
|
resolution !== renderedResolution ||
|
|
783
789
|
!equals(frameState.extent, renderedExtent)
|
|
@@ -790,22 +796,26 @@ class RasterSource extends ImageSource {
|
|
|
790
796
|
!this.renderedImageCanvas_ ||
|
|
791
797
|
this.getRevision() !== this.renderedRevision_
|
|
792
798
|
) {
|
|
793
|
-
this.
|
|
799
|
+
this.changed();
|
|
794
800
|
}
|
|
795
801
|
|
|
796
802
|
if (frameState.animate) {
|
|
797
803
|
requestAnimationFrame(this.changed.bind(this));
|
|
798
804
|
}
|
|
799
805
|
|
|
800
|
-
return
|
|
806
|
+
return canvas;
|
|
801
807
|
}
|
|
802
808
|
|
|
803
809
|
/**
|
|
804
810
|
* Start processing source data.
|
|
811
|
+
* @return {Promise<void>} Promise resolving when the worker result is available.
|
|
805
812
|
* @private
|
|
806
813
|
*/
|
|
807
814
|
processSources_() {
|
|
808
815
|
const frameState = this.requestedFrameState_;
|
|
816
|
+
if (!frameState) {
|
|
817
|
+
return resolve;
|
|
818
|
+
}
|
|
809
819
|
const len = this.layers_.length;
|
|
810
820
|
const imageDatas = new Array(len);
|
|
811
821
|
for (let i = 0; i < len; ++i) {
|
|
@@ -815,7 +825,7 @@ class RasterSource extends ImageSource {
|
|
|
815
825
|
if (imageData) {
|
|
816
826
|
imageDatas[i] = imageData;
|
|
817
827
|
} else {
|
|
818
|
-
return;
|
|
828
|
+
return resolve;
|
|
819
829
|
}
|
|
820
830
|
}
|
|
821
831
|
|
|
@@ -823,10 +833,11 @@ class RasterSource extends ImageSource {
|
|
|
823
833
|
this.dispatchEvent(
|
|
824
834
|
new RasterSourceEvent(RasterEventType.BEFOREOPERATIONS, frameState, data)
|
|
825
835
|
);
|
|
826
|
-
|
|
827
|
-
imageDatas,
|
|
828
|
-
|
|
829
|
-
|
|
836
|
+
return new Promise((resolve) =>
|
|
837
|
+
this.processor_.process(imageDatas, data, (error, output, data) => {
|
|
838
|
+
this.onWorkerComplete_(frameState, error, output, data);
|
|
839
|
+
resolve();
|
|
840
|
+
})
|
|
830
841
|
);
|
|
831
842
|
}
|
|
832
843
|
|
|
@@ -847,38 +858,32 @@ class RasterSource extends ImageSource {
|
|
|
847
858
|
const extent = frameState.extent;
|
|
848
859
|
const resolution = frameState.viewState.resolution;
|
|
849
860
|
if (
|
|
850
|
-
resolution
|
|
851
|
-
|
|
861
|
+
resolution === this.requestedFrameState_.viewState.resolution &&
|
|
862
|
+
equals(extent, this.requestedFrameState_.extent)
|
|
852
863
|
) {
|
|
853
|
-
|
|
854
|
-
|
|
864
|
+
let context;
|
|
865
|
+
if (this.renderedImageCanvas_) {
|
|
866
|
+
context = this.renderedImageCanvas_.getImage().getContext('2d');
|
|
867
|
+
} else {
|
|
868
|
+
const width = Math.round(getWidth(extent) / resolution);
|
|
869
|
+
const height = Math.round(getHeight(extent) / resolution);
|
|
870
|
+
context = createCanvasContext2D(width, height);
|
|
871
|
+
this.renderedImageCanvas_ = new ImageCanvas(
|
|
872
|
+
extent,
|
|
873
|
+
resolution,
|
|
874
|
+
1,
|
|
875
|
+
context.canvas
|
|
876
|
+
);
|
|
877
|
+
}
|
|
878
|
+
context.putImageData(output, 0, 0);
|
|
879
|
+
this.renderedRevision_ = this.getRevision();
|
|
855
880
|
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
context = this.renderedImageCanvas_.getImage().getContext('2d');
|
|
859
|
-
} else {
|
|
860
|
-
const width = Math.round(getWidth(extent) / resolution);
|
|
861
|
-
const height = Math.round(getHeight(extent) / resolution);
|
|
862
|
-
context = createCanvasContext2D(width, height);
|
|
863
|
-
this.renderedImageCanvas_ = new ImageCanvas(
|
|
864
|
-
extent,
|
|
865
|
-
resolution,
|
|
866
|
-
1,
|
|
867
|
-
context.canvas
|
|
881
|
+
this.dispatchEvent(
|
|
882
|
+
new RasterSourceEvent(RasterEventType.AFTEROPERATIONS, frameState, data)
|
|
868
883
|
);
|
|
869
884
|
}
|
|
870
|
-
context.putImageData(output, 0, 0);
|
|
871
|
-
|
|
872
|
-
if (frameState.animate) {
|
|
873
|
-
requestAnimationFrame(this.changed.bind(this));
|
|
874
|
-
} else {
|
|
875
|
-
this.changed();
|
|
876
|
-
}
|
|
877
|
-
this.renderedRevision_ = this.getRevision();
|
|
878
885
|
|
|
879
|
-
this.
|
|
880
|
-
new RasterSourceEvent(RasterEventType.AFTEROPERATIONS, frameState, data)
|
|
881
|
-
);
|
|
886
|
+
this.changed();
|
|
882
887
|
}
|
|
883
888
|
|
|
884
889
|
/**
|
package/util.js
CHANGED