Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | 642x 642x 642x 642x 642x 642x 71x 71x 71x 71x 642x 642x 642x 642x 642x 642x 642x 642x 423x 423x 642x 1x 359x 359x 359x 359x 1x 1367x 1x 609x 609x 111x 111x 27x 111x 111x 67x 111x 3x 111x 111x 498x 1x 1573x 121x 121x 1573x 80x 80x 1573x 1573x 80x 80x | import defined from "../Core/defined.js";
import destroyObject from "../Core/destroyObject.js";
import ImageryState from "./ImageryState.js";
/**
* Stores details about a tile of imagery.
*
* @alias Imagery
* @private
*/
function Imagery(imageryLayer, x, y, level, rectangle) {
this.imageryLayer = imageryLayer;
this.x = x;
this.y = y;
this.level = level;
this.request = undefined;
if (level !== 0) {
const parentX = (x / 2) | 0;
const parentY = (y / 2) | 0;
const parentLevel = level - 1;
this.parent = imageryLayer.getImageryFromCache(
parentX,
parentY,
parentLevel,
);
}
this.state = ImageryState.UNLOADED;
this.imageUrl = undefined;
this.image = undefined;
this.texture = undefined;
this.textureWebMercator = undefined;
this.credits = undefined;
this.referenceCount = 0;
if (!defined(rectangle) && imageryLayer.ready) {
const tilingScheme = imageryLayer.imageryProvider.tilingScheme;
rectangle = tilingScheme.tileXYToRectangle(x, y, level);
}
this.rectangle = rectangle;
}
Imagery.createPlaceholder = function (imageryLayer) {
const result = new Imagery(imageryLayer, 0, 0, 0);
result.addReference();
result.state = ImageryState.PLACEHOLDER;
return result;
};
Imagery.prototype.addReference = function () {
++this.referenceCount;
};
Imagery.prototype.releaseReference = function () {
--this.referenceCount;
if (this.referenceCount === 0) {
this.imageryLayer.removeImageryFromCache(this);
if (defined(this.parent)) {
this.parent.releaseReference();
}
Iif (defined(this.image) && defined(this.image.destroy)) {
this.image.destroy();
}
if (defined(this.texture)) {
this.texture.destroy();
}
if (
defined(this.textureWebMercator) &&
this.texture !== this.textureWebMercator
) {
this.textureWebMercator.destroy();
}
destroyObject(this);
return 0;
}
return this.referenceCount;
};
Imagery.prototype.processStateMachine = function (
frameState,
needGeographicProjection,
skipLoading,
) {
if (this.state === ImageryState.UNLOADED && !skipLoading) {
this.state = ImageryState.TRANSITIONING;
this.imageryLayer._requestImagery(this);
}
if (this.state === ImageryState.RECEIVED) {
this.state = ImageryState.TRANSITIONING;
this.imageryLayer._createTexture(frameState.context, this);
}
// If the imagery is already ready, but we need a geographic version and don't have it yet,
// we still need to do the reprojection step. This can happen if the Web Mercator version
// is fine initially, but the geographic one is needed later.
const needsReprojection =
this.state === ImageryState.READY &&
needGeographicProjection &&
!this.texture;
if (this.state === ImageryState.TEXTURE_LOADED || needsReprojection) {
this.state = ImageryState.TRANSITIONING;
this.imageryLayer._reprojectTexture(
frameState,
this,
needGeographicProjection,
);
}
};
export default Imagery;
|