itowns
Version:
A JS/WebGL framework for 3D geospatial data visualization
43 lines (42 loc) • 1.29 kB
JavaScript
import Layer from "./Layer.js";
import { STRATEGY_MIN_NETWORK_TRAFFIC } from "./LayerUpdateStrategy.js";
import { removeLayeredMaterialNodeTile } from "../Process/LayeredMaterialNodeProcessing.js";
import textureConverter from "../Converter/textureConverter.js";
import { CACHE_POLICIES } from "../Core/Scheduler/Cache.js";
class RasterLayer extends Layer {
constructor(id, config) {
const {
cacheLifeTime = CACHE_POLICIES.TEXTURE,
minFilter,
magFilter,
updateStrategy,
...layerConfig
} = config;
super(id, {
...layerConfig,
cacheLifeTime
});
this.minFilter = minFilter;
this.magFilter = magFilter;
this.updateStrategy = updateStrategy ?? {
type: STRATEGY_MIN_NETWORK_TRAFFIC,
options: {}
};
}
convert(data, extentDestination) {
return textureConverter.convert(data, extentDestination, this);
}
/**
* All layer's textures are removed from scene and disposed from video device.
* @param {boolean} [clearCache=false] Whether to clear the layer cache or not
*/
delete(clearCache) {
if (clearCache) {
this.cache.clear();
}
for (const root of this.parent.level0Nodes) {
root.traverse(removeLayeredMaterialNodeTile(this.id));
}
}
}
export default RasterLayer;