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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | 1x 1x 1x 1x 1x 338x 338x 338x 338x 338x 338x 338x 338x 1x 2x 2x 2x 2x 2x 1x 1x 111x 1x 4x 1x 258x 1x 22x 1x 1x 4x | import defined from "./defined.js";
import isBitSet from "./isBitSet.js";
// Bitmask for checking tile properties
const childrenBitmasks = [0x01, 0x02, 0x04, 0x08];
const anyChildBitmask = 0x0f;
const cacheFlagBitmask = 0x10; // True if there is a child subtree
const imageBitmask = 0x40;
const terrainBitmask = 0x80;
/**
* Contains information about each tile from a Google Earth Enterprise server
*
* @param {number} bits Bitmask that contains the type of data and available children for each tile.
* @param {number} cnodeVersion Version of the request for subtree metadata.
* @param {number} imageryVersion Version of the request for imagery tile.
* @param {number} terrainVersion Version of the request for terrain tile.
* @param {number} imageryProvider Id of imagery provider.
* @param {number} terrainProvider Id of terrain provider.
*
* @private
*/
function GoogleEarthEnterpriseTileInformation(
bits,
cnodeVersion,
imageryVersion,
terrainVersion,
imageryProvider,
terrainProvider,
) {
this._bits = bits;
this.cnodeVersion = cnodeVersion;
this.imageryVersion = imageryVersion;
this.terrainVersion = terrainVersion;
this.imageryProvider = imageryProvider;
this.terrainProvider = terrainProvider;
this.ancestorHasTerrain = false; // Set it later once we find its parent
this.terrainState = undefined;
}
/**
* Creates GoogleEarthEnterpriseTileInformation from an object
*
* @param {object} info Object to be cloned
* @param {GoogleEarthEnterpriseTileInformation} [result] The object onto which to store the result.
* @returns {GoogleEarthEnterpriseTileInformation} The modified result parameter or a new GoogleEarthEnterpriseTileInformation instance if none was provided.
*/
GoogleEarthEnterpriseTileInformation.clone = function (info, result) {
if (!defined(result)) {
result = new GoogleEarthEnterpriseTileInformation(
info._bits,
info.cnodeVersion,
info.imageryVersion,
info.terrainVersion,
info.imageryProvider,
info.terrainProvider,
);
} else E{
result._bits = info._bits;
result.cnodeVersion = info.cnodeVersion;
result.imageryVersion = info.imageryVersion;
result.terrainVersion = info.terrainVersion;
result.imageryProvider = info.imageryProvider;
result.terrainProvider = info.terrainProvider;
}
result.ancestorHasTerrain = info.ancestorHasTerrain;
result.terrainState = info.terrainState;
return result;
};
/**
* Sets the parent for the tile
*
* @param {GoogleEarthEnterpriseTileInformation} parent Parent tile
*/
GoogleEarthEnterpriseTileInformation.prototype.setParent = function (parent) {
this.ancestorHasTerrain = parent.ancestorHasTerrain || this.hasTerrain();
};
/**
* Gets whether a subtree is available
*
* @returns {boolean} true if subtree is available, false otherwise.
*/
GoogleEarthEnterpriseTileInformation.prototype.hasSubtree = function () {
return isBitSet(this._bits, cacheFlagBitmask);
};
/**
* Gets whether imagery is available
*
* @returns {boolean} true if imagery is available, false otherwise.
*/
GoogleEarthEnterpriseTileInformation.prototype.hasImagery = function () {
return isBitSet(this._bits, imageBitmask);
};
/**
* Gets whether terrain is available
*
* @returns {boolean} true if terrain is available, false otherwise.
*/
GoogleEarthEnterpriseTileInformation.prototype.hasTerrain = function () {
return isBitSet(this._bits, terrainBitmask);
};
/**
* Gets whether any children are present
*
* @returns {boolean} true if any children are available, false otherwise.
*/
GoogleEarthEnterpriseTileInformation.prototype.hasChildren = function () {
return isBitSet(this._bits, anyChildBitmask);
};
/**
* Gets whether a specified child is available
*
* @param {number} index Index of child tile
*
* @returns {boolean} true if child is available, false otherwise
*/
GoogleEarthEnterpriseTileInformation.prototype.hasChild = function (index) {
return isBitSet(this._bits, childrenBitmasks[index]);
};
/**
* Gets bitmask containing children
*
* @returns {number} Children bitmask
*/
GoogleEarthEnterpriseTileInformation.prototype.getChildBitmask = function () {
return this._bits & anyChildBitmask;
};
export default GoogleEarthEnterpriseTileInformation;
|