Remove unused data struct TileProviderInitData and clean up.

This commit is contained in:
kalbl
2016-10-27 11:31:43 +02:00
parent b1a3814c37
commit 6e68472c66
3 changed files with 21 additions and 34 deletions

View File

@@ -60,8 +60,8 @@ namespace globebrowsing {
layerDict.getValue("Name", layerName);
setName(layerName);
_tileProvider = std::shared_ptr<TileProvider>(TileProvider::createFromDictionary(layerDict));
_tileProvider = std::shared_ptr<TileProvider>(
TileProvider::createFromDictionary(layerDict));
// Something else went wrong and no exception was thrown
if (_tileProvider == nullptr) {
@@ -80,11 +80,13 @@ namespace globebrowsing {
}
ChunkTilePile Layer::getChunkTilePile(const TileIndex& tileIndex, int pileSize) const{
return std::move(TileSelector::getHighestResolutionTilePile(_tileProvider.get(), tileIndex, pileSize));
ChunkTilePile Layer::getChunkTilePile(
const TileIndex& tileIndex,
int pileSize) const {
return std::move(TileSelector::getHighestResolutionTilePile(
_tileProvider.get(), tileIndex, pileSize));
}
//////////////////////////////////////////////////////////////////////////////////////
// Layer Group //
//////////////////////////////////////////////////////////////////////////////////////
@@ -158,19 +160,18 @@ namespace globebrowsing {
setName("Layers");
if (NUM_LAYER_GROUPS != layerGroupsDict.size()) {
throw ghoul::RuntimeError(
"Number of Layer Groups must be equal to " + NUM_LAYER_GROUPS);
}
// Create all the categories of tile providers
for (size_t i = 0; i < layerGroupsDict.size(); i++) {
std::string groupName = LayerManager::LAYER_GROUP_NAMES[i];
ghoul::Dictionary layerGroupDict = layerGroupsDict.value<ghoul::Dictionary>(groupName);
ghoul::Dictionary layerGroupDict =
layerGroupsDict.value<ghoul::Dictionary>(groupName);
TileProviderInitData initData;
initData.minimumPixelSize = 512;
initData.threads = 1;
initData.cacheSize = 5000;
initData.framesUntilRequestQueueFlush = 60;
initData.preprocessTiles = (i == LayerManager::HeightLayers); // Only preprocess height maps.
_layerGroups.push_back(std::make_shared<LayerGroup>(groupName, layerGroupDict));
_layerGroups.push_back(
std::make_shared<LayerGroup>(groupName, layerGroupDict));
}
for(auto layerGroup : _layerGroups){
@@ -182,17 +183,18 @@ namespace globebrowsing {
}
LayerGroup& LayerManager::layerGroup(size_t groupId) {
const LayerGroup& LayerManager::layerGroup(size_t groupId) {
return *_layerGroups[groupId];
}
LayerGroup& LayerManager::layerGroup(LayerGroupId groupId) {
const LayerGroup& LayerManager::layerGroup(LayerGroupId groupId) {
return *_layerGroups[groupId];
}
bool LayerManager::hasAnyBlendingLayersEnabled() const {
for (const auto& layerGroup : _layerGroups){
if (layerGroup->layerBlendingEnabled() && layerGroup->activeLayers().size() > 0){
if (layerGroup->layerBlendingEnabled() &&
layerGroup->activeLayers().size() > 0){
return true;
}
}

View File

@@ -58,7 +58,6 @@ namespace globebrowsing {
*/
class Layer : public properties::PropertyOwner {
public:
Layer(const ghoul::Dictionary& layerDict);
~Layer();
@@ -69,7 +68,6 @@ namespace globebrowsing {
const LayerRenderSettings& renderSettings() const { return _renderSettings; }
private:
properties::BoolProperty _enabled;
std::shared_ptr<TileProvider> _tileProvider;
LayerRenderSettings _renderSettings;
@@ -79,7 +77,6 @@ namespace globebrowsing {
* Convenience class for dealing with multiple <code>Layer</code>s.
*/
struct LayerGroup : public properties::PropertyOwner {
LayerGroup(std::string name);
LayerGroup(std::string name, const ghoul::Dictionary& dict);
@@ -98,7 +95,6 @@ namespace globebrowsing {
bool layerBlendingEnabled() const { return _levelBlendingEnabled.value(); }
private:
std::vector<std::shared_ptr<Layer>> _layers;
std::vector<std::shared_ptr<Layer>> _activeLayers;
@@ -110,7 +106,6 @@ namespace globebrowsing {
*/
class LayerManager : public properties::PropertyOwner {
public:
static const size_t NUM_LAYER_GROUPS = 7;
static const std::string LAYER_GROUP_NAMES[NUM_LAYER_GROUPS];
static enum LayerGroupId{
@@ -126,8 +121,8 @@ namespace globebrowsing {
LayerManager(const ghoul::Dictionary& textureCategoriesDictionary);
~LayerManager();
LayerGroup& layerGroup(size_t groupId);
LayerGroup& layerGroup(LayerGroupId);
const LayerGroup& layerGroup(size_t groupId);
const LayerGroup& layerGroup(LayerGroupId);
bool hasAnyBlendingLayersEnabled() const;
@@ -137,9 +132,7 @@ namespace globebrowsing {
void reset(bool includingDisabled = false);
private:
std::vector<std::shared_ptr<LayerGroup>> _layerGroups;
};
} // namespace globebrowsing

View File

@@ -147,14 +147,6 @@ namespace globebrowsing {
typedef LRUCache<TileHashKey, Tile> TileCache;
struct TileProviderInitData {
int minimumPixelSize;
int threads;
int cacheSize;
int framesUntilRequestQueueFlush;
bool preprocessTiles = false;
};
} // namespace globebrowsing
} // namespace openspace