Implement and use factory pattern for TileProvider instantiation

This commit is contained in:
Erik Broberg
2016-06-29 13:47:11 -04:00
parent 5896d7eb71
commit 1d856151ed
10 changed files with 232 additions and 26 deletions
@@ -51,6 +51,44 @@ namespace openspace {
const Tile Tile::TileUnavailable = {nullptr, nullptr, Tile::Status::Unavailable };
SingleImagePrivoder::SingleImagePrivoder(const std::string& imagePath) {
auto texture = ghoul::io::TextureReader::ref().loadTexture(imagePath);
_tile = std::make_shared<Tile>();
_tile->texture = std::move(texture);
_tile->status = _tile->texture != nullptr ? Tile::Status::OK : Tile::Status::IOError;
_tile->preprocessData = nullptr;
}
Tile SingleImagePrivoder::getTile(const ChunkIndex& chunkIndex) {
return *_tile;
}
Tile::Status SingleImagePrivoder::getTileStatus(const ChunkIndex& index) {
return _tile->status;
}
TileDepthTransform SingleImagePrivoder::depthTransform() {
TileDepthTransform transform;
transform.depthOffset = 0.0f;
transform.depthScale = 1.0f;
return transform;
}
void SingleImagePrivoder::update() {
// nothing to be done
}
int SingleImagePrivoder::maxLevel() {
return 1337; // unlimited
}
CachingTileProvider::CachingTileProvider(std::shared_ptr<AsyncTileDataProvider> tileReader,
std::shared_ptr<TileCache> tileCache,
int framesUntilFlushRequestQueue)