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 | 671x 671x 671x 1x 14x 243x 32x 211x 211x 1x 12x 1x 5751x 1x 5994x 5994x 5994x 5994x 210x 5994x 5994x 5994x 5994x 5994x 1871x 1871x 384x 384x 384x 384x 384x | import defined from "../Core/defined.js";
/**
* @private
*/
function Cesium3DTileStyleEngine() {
this._style = undefined; // The style provided by the user
this._styleDirty = false; // true when the style is reassigned
this._lastStyleTime = 0; // The "time" when the last style was assigned
}
Object.defineProperties(Cesium3DTileStyleEngine.prototype, {
style: {
get: function () {
return this._style;
},
set: function (value) {
if (value === this._style) {
return;
}
this._style = value;
this._styleDirty = true;
},
},
});
Cesium3DTileStyleEngine.prototype.makeDirty = function () {
this._styleDirty = true;
};
Cesium3DTileStyleEngine.prototype.resetDirty = function () {
this._styleDirty = false;
};
Cesium3DTileStyleEngine.prototype.applyStyle = function (tileset) {
Iif (!defined(tileset.root)) {
return;
}
Iif (defined(this._style) && !this._style._ready) {
return;
}
const styleDirty = this._styleDirty;
if (styleDirty) {
// Increase "time", so the style is applied to all visible tiles
++this._lastStyleTime;
}
const lastStyleTime = this._lastStyleTime;
const statistics = tileset._statistics;
// If a new style was assigned, loop through all the visible tiles; otherwise, loop through
// only the tiles that are newly visible, i.e., they are visible this frame, but were not
// visible last frame. In many cases, the newly selected tiles list will be short or empty.
const tiles = styleDirty
? tileset._selectedTiles
: tileset._selectedTilesToStyle;
// PERFORMANCE_IDEA: does mouse-over picking basically trash this? We need to style on
// pick, for example, because a feature's show may be false.
const length = tiles.length;
for (let i = 0; i < length; ++i) {
const tile = tiles[i];
if (tile.lastStyleTime !== lastStyleTime) {
// Apply the style to this tile if it wasn't already applied because:
// 1) the user assigned a new style to the tileset
// 2) this tile is now visible, but it wasn't visible when the style was first assigned
const content = tile.content;
tile.lastStyleTime = lastStyleTime;
content.applyStyle(this._style);
statistics.numberOfFeaturesStyled += content.featuresLength;
++statistics.numberOfTilesStyled;
}
}
};
export default Cesium3DTileStyleEngine;
|