Remove TileProviderFactory and instantiate TileProviders using FactoryManager instead

This commit is contained in:
Erik Broberg
2016-08-30 23:52:53 -04:00
parent b56eeade88
commit 8d17ad7e34
16 changed files with 182 additions and 242 deletions
@@ -24,6 +24,8 @@
#include <modules/globebrowsing/tile/tileprovider/tileprovider.h>
#include <openspace/util/factorymanager.h>
#include <ghoul/logging/logmanager.h>
@@ -31,9 +33,33 @@
namespace {
const std::string _loggerCat = "TileProvider";
const std::string KeyType = "Type";
}
namespace openspace {
TileProvider* TileProvider::createFromDictionary(const ghoul::Dictionary& dictionary) {
if (!dictionary.hasValue<std::string>(KeyType)) {
LERROR("TileProvider did not have key '" << KeyType << "'");
return nullptr;
}
std::string type;
dictionary.getValue(KeyType, type);
ghoul::TemplateFactory<TileProvider>* factory
= FactoryManager::ref().factory<TileProvider>();
TileProvider* result = factory->create(type, dictionary);
if (result == nullptr) {
LERROR("Failed creating Ephemeris object of type '" << type << "'");
return nullptr;
}
return result;
}
TileProvider::TileProvider(const ghoul::Dictionary& dictionary) { };
} // namespace openspace