layers in LayerGroup are private

This commit is contained in:
Erik Broberg
2016-10-25 19:56:11 +02:00
parent 1b2291484f
commit baba1f02d0
2 changed files with 18 additions and 7 deletions

View File

@@ -49,6 +49,10 @@ namespace globebrowsing {
addProperty(gamma);
addProperty(multiplier);
}
//////////////////////////////////////////////////////////////////////////////////////
// Layer //
//////////////////////////////////////////////////////////////////////////////////////
Layer::Layer(const ghoul::Dictionary& layerDict)
: _enabled(properties::BoolProperty("enabled", "enabled", false))
@@ -81,6 +85,7 @@ namespace globebrowsing {
return std::move(TileSelector::getHighestResolutionTilePile(_tileProvider.get(), tileIndex, pileSize));
}
//////////////////////////////////////////////////////////////////////////////////////
// Layer Group //
//////////////////////////////////////////////////////////////////////////////////////
@@ -100,7 +105,7 @@ namespace globebrowsing {
ghoul::Dictionary layerDict = dict.value<ghoul::Dictionary>(dictKey);
try {
layers.push_back(std::make_shared<Layer>(layerDict));
_layers.push_back(std::make_shared<Layer>(layerDict));
}
catch (const ghoul::RuntimeError& e) {
LERROR(e.what());
@@ -108,7 +113,7 @@ namespace globebrowsing {
}
}
for(auto layer : layers){
for(auto layer : _layers){
addPropertySubOwner(layer.get());
}
}
@@ -116,7 +121,7 @@ namespace globebrowsing {
void LayerGroup::update() {
_activeLayers.clear();
for (auto layer : layers) {
for (auto layer : _layers) {
if (layer->enabled()) {
layer->tileProvider()->update();
_activeLayers.push_back(layer);
@@ -124,6 +129,10 @@ namespace globebrowsing {
}
}
const std::vector<std::shared_ptr<Layer>>& LayerGroup::layers() const {
return _layers;
}
const std::vector<std::shared_ptr<Layer>>& LayerGroup::activeLayers() const {
return _activeLayers;
}
@@ -133,7 +142,7 @@ namespace globebrowsing {
}
//////////////////////////////////////////////////////////////////////////////////////
// Tile Provider Manager //
// LayerManager //
//////////////////////////////////////////////////////////////////////////////////////
LayerManager::LayerManager(const ghoul::Dictionary& textureCategoriesDictionary) {
@@ -201,7 +210,7 @@ namespace globebrowsing {
void LayerManager::reset(bool includeDisabled) {
for (auto& layerGroup : _layerGroups) {
for (auto layer : layerGroup->layers) {
for (auto layer : layerGroup->layers()) {
if (layer->enabled() || includeDisabled) {
layer->tileProvider()->reset();
}

View File

@@ -84,6 +84,9 @@ namespace globebrowsing {
/// Updates all layers tile providers within this group
void update();
/// @returns const vector of all layers
const std::vector<std::shared_ptr<Layer>>& layers() const;
/// @returns const vector of all active layers
const std::vector<std::shared_ptr<Layer>>& activeLayers() const;
@@ -92,10 +95,9 @@ namespace globebrowsing {
bool layerBlendingEnabled() const { return _levelBlendingEnabled.value(); }
std::vector<std::shared_ptr<Layer>> layers;
private:
std::vector<std::shared_ptr<Layer>> _layers;
std::vector<std::shared_ptr<Layer>> _activeLayers;
properties::BoolProperty _levelBlendingEnabled;