diff --git a/modules/dsn/managers/radecmanager.cpp b/modules/dsn/managers/radecmanager.cpp index e0028cb832..ebce19eff4 100644 --- a/modules/dsn/managers/radecmanager.cpp +++ b/modules/dsn/managers/radecmanager.cpp @@ -26,11 +26,16 @@ namespace openspace { constexpr const char* _loggerCat = "RadecManager"; + constexpr const char* KeyIdentifier = "ObjectIdentifier"; RadecManager::RadecManager() = default; - bool RadecManager::extractMandatoryInfoFromDictionary(const char* identifier, std::unique_ptr &dictionary){ - bool dataFilesSuccess = DataFileHelper::checkFileNames(identifier, dictionary, _dataFiles); - return dataFilesSuccess; + bool RadecManager::extractMandatoryInfoFromDictionary(const char* identifier, std::unique_ptr &dictionary){ + if (dictionary->hasKeyAndValue(KeyIdentifier)) { + objectIdentifier = dictionary->value(KeyIdentifier); + } + + bool dataFilesSuccess = DataFileHelper::checkFileNames(identifier, dictionary, _dataFiles); + return dataFilesSuccess; } bool RadecManager::correctHour(double time) const{ diff --git a/modules/dsn/managers/radecmanager.h b/modules/dsn/managers/radecmanager.h index d961f1d3fc..a9c41385d3 100644 --- a/modules/dsn/managers/radecmanager.h +++ b/modules/dsn/managers/radecmanager.h @@ -48,6 +48,8 @@ namespace openspace { mutable Position position; mutable glm::vec3 currentMinute; mutable double activeMinute = 0; + /* Identifier for object using the translation, used for logging */ + std::string objectIdentifier; /*Used to check if the loaded file is still relevant or if we should look for another one. */ mutable double _checkFileTime; diff --git a/modules/dsn/translation/radectranslation.cpp b/modules/dsn/translation/radectranslation.cpp index 04e52b74ad..8d7770a63f 100644 --- a/modules/dsn/translation/radectranslation.cpp +++ b/modules/dsn/translation/radectranslation.cpp @@ -37,7 +37,6 @@ namespace { namespace openspace { constexpr const char* _loggerCat = "RadecTranslation"; -constexpr const char* KeyIdentifier = "ObjectIdentifier"; documentation::Documentation RadecTranslation::Documentation() { using namespace documentation; @@ -67,10 +66,6 @@ RadecTranslation::RadecTranslation(const ghoul::Dictionary& dictionary) { std::unique_ptr dictionaryPtr = std::make_unique(dictionary); - if (dictionary.hasKeyAndValue(KeyIdentifier)) { - _objectIdentifier = dictionary.value(KeyIdentifier); - } - extractData(dictionaryPtr); documentation::testSpecificationAndThrow( @@ -85,10 +80,10 @@ void RadecTranslation::extractData(std::unique_ptr &dictionar constexpr const char* _identifier = "RadecTranslation"; if (!radecManager.extractMandatoryInfoFromDictionary(_identifier, dictionary)) { - LERROR(fmt::format("{}: Did not manage to extract data for {}.", _identifier, _objectIdentifier.c_str())); + LERROR(fmt::format("{}: Did not manage to extract data for {}.", _identifier, radecManager.objectIdentifier.c_str())); } else { - LDEBUG(fmt::format("{}: Successfully read data for {}.", _identifier, _objectIdentifier.c_str())); + LDEBUG(fmt::format("{}: Successfully read data for {}.", _identifier, radecManager.objectIdentifier.c_str())); } } diff --git a/modules/dsn/translation/radectranslation.h b/modules/dsn/translation/radectranslation.h index 302614f110..12375134dd 100644 --- a/modules/dsn/translation/radectranslation.h +++ b/modules/dsn/translation/radectranslation.h @@ -58,8 +58,6 @@ private: RadecManager radecManager; mutable glm::vec3 _position; - /* Identifier for object using the translation, used for logging */ - std::string _objectIdentifier; glm::dmat4 _rotEquatorialSphere = { -0.05487554, 0.4941095, -0.8676661, 0.0, -0.8734371 , -0.4448296, -0.1980764, 0.0,