mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-12 22:39:09 -05:00
Added jsonHelper and EadecManager
This commit is contained in:
@@ -21,7 +21,7 @@ asset.require('scene/solarsystem/dsn/stations')
|
||||
--Communication
|
||||
--assetHelper.requestAll(asset, 'scene/solarsystem/dsn')
|
||||
asset.require('scene/solarsystem/dsn/communicationlines/communicationlines')
|
||||
asset.require('scene/solarsystem/dsn/spacecrafts')
|
||||
asset.require('scene/solarsystem/dsn/testRADEC')
|
||||
|
||||
-- Load default key bindings applicable to most scenes
|
||||
asset.require('util/default_keybindings')
|
||||
|
||||
@@ -8,7 +8,7 @@ local Signals = {
|
||||
Identifier = "Signals",
|
||||
Renderable = {
|
||||
Translation = {
|
||||
Type = "RadecTranslation",
|
||||
Type = "StaticTranslation",
|
||||
Position = {0.0, 0.0, 0.0} --no parent, sun center is 0, 0, 0
|
||||
},
|
||||
Type = "RenderableSignals",
|
||||
|
||||
+9
-6
@@ -1,4 +1,5 @@
|
||||
local assetHelper = asset.require('util/asset_helper')
|
||||
local dataFolder = openspace.absPath("../../../sync/http/dsn_data/1/positioning/VGR")
|
||||
|
||||
local models = asset.syncedResource({
|
||||
Name = "Dsn models",
|
||||
@@ -7,11 +8,13 @@ local models = asset.syncedResource({
|
||||
Version = 1
|
||||
})
|
||||
|
||||
local testSpaceCraft = {
|
||||
Identifier = "testSpaceCraft",
|
||||
local testRADEC = {
|
||||
Identifier = "testRADEC",
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "RadecTranslation"
|
||||
Type = "RadecTranslation",
|
||||
DataFolder = dataFolder,
|
||||
DataFileType = "json"
|
||||
},
|
||||
Scale = {
|
||||
Type = "StaticScale",
|
||||
@@ -28,9 +31,9 @@ local testSpaceCraft = {
|
||||
ColorTexture = models .. "/34m_dish/base_AO.png",
|
||||
},
|
||||
GUI = {
|
||||
Name = "testSpaceCraft",
|
||||
Path = "/Solar System/testSpaceCraft"
|
||||
Name = "testRADEC",
|
||||
Path = "/Solar System/testRADEC"
|
||||
}
|
||||
}
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, {testSpaceCraft})
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, {testRADEC})
|
||||
@@ -28,6 +28,8 @@ set(HEADER_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablesignals.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/translation/radectranslation.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/managers/signalmanager.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/managers/radecmanager.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/managers/jsonhelper.h
|
||||
)
|
||||
source_group("Header Files" FILES ${HEADER_FILES})
|
||||
|
||||
@@ -35,6 +37,8 @@ set(SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablesignals.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/translation/radectranslation.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/managers/signalmanager.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/managers/radecmanager.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/managers/jsonhelper.cpp
|
||||
)
|
||||
source_group("Source Files" FILES ${SOURCE_FILES})
|
||||
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2018 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/dsn/managers/jsonhelper.h>
|
||||
|
||||
namespace openspace {
|
||||
constexpr const char* _loggerCat = "JsonHelper";
|
||||
|
||||
JsonHelper::JsonHelper()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Keys to get values from dictionary
|
||||
constexpr const char* KeyDataFolder = "DataFolder";
|
||||
constexpr const char* KeyDataFileType = "DataFileType";
|
||||
|
||||
//Filetypes
|
||||
const std::string dataFileTypeStringJson = "json";
|
||||
enum class DataFileType : int {
|
||||
Json = 0,
|
||||
Invalid
|
||||
};
|
||||
|
||||
/**
|
||||
* Extracts the general information (from the lua modfile) that is mandatory for the class
|
||||
* to function; such as the file type and the location of the data files.
|
||||
* Returns false if it fails to extract mandatory information!
|
||||
*/
|
||||
bool JsonHelper::checkFileNames(const char* identifier, std::unique_ptr<ghoul::Dictionary> &dictionary, std::vector<std::string> &dataFiles)
|
||||
{
|
||||
DataFileType sourceFileType = DataFileType::Invalid;
|
||||
|
||||
|
||||
// ------------------- EXTRACT MANDATORY VALUES FROM DICTIONARY ------------------- //
|
||||
std::string dataFileTypeString;
|
||||
if (!dictionary->getValue(KeyDataFileType, dataFileTypeString)) {
|
||||
LERROR(fmt::format("{}: The field {} is missing", identifier, KeyDataFileType));
|
||||
}
|
||||
std::transform(
|
||||
dataFileTypeString.begin(),
|
||||
dataFileTypeString.end(),
|
||||
dataFileTypeString.begin(),
|
||||
[](char c) { return static_cast<char>(tolower(c)); }
|
||||
);
|
||||
// Verify that the input type is correct
|
||||
if (dataFileTypeString == dataFileTypeStringJson) {
|
||||
sourceFileType = DataFileType::Json;
|
||||
}
|
||||
else {
|
||||
LERROR(fmt::format(
|
||||
"{}: {} is not a recognized {}",
|
||||
identifier, dataFileTypeString, KeyDataFileType
|
||||
));
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string dataFolderPath;
|
||||
if (!dictionary->getValue(KeyDataFolder, dataFolderPath)) {
|
||||
LERROR(fmt::format("{}: The field {} is missing", identifier, KeyDataFolder));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Ensure that the source folder exists and then extract
|
||||
// the files with the same extension as <inputFileTypeString>
|
||||
ghoul::filesystem::Directory dataFolder(dataFolderPath);
|
||||
if (FileSys.directoryExists(dataFolder)) {
|
||||
// Extract all file paths from the provided folder
|
||||
dataFiles = dataFolder.readFiles(
|
||||
ghoul::filesystem::Directory::Recursive::No,
|
||||
ghoul::filesystem::Directory::Sort::Yes
|
||||
);
|
||||
|
||||
// Remove all files that don't have <dataFileTypeString> as extension
|
||||
dataFiles.erase(
|
||||
std::remove_if(
|
||||
dataFiles.begin(),
|
||||
dataFiles.end(),
|
||||
[dataFileTypeString](const std::string& str) {
|
||||
const size_t extLength = dataFileTypeString.length();
|
||||
std::string sub = str.substr(str.length() - extLength, extLength);
|
||||
std::transform(
|
||||
sub.begin(),
|
||||
sub.end(),
|
||||
sub.begin(),
|
||||
[](char c) { return static_cast<char>(::tolower(c)); }
|
||||
);
|
||||
return sub != dataFileTypeString;
|
||||
}),
|
||||
dataFiles.end()
|
||||
);
|
||||
// Ensure that there are available and valid source files left
|
||||
if (dataFiles.empty()) {
|
||||
LERROR(fmt::format(
|
||||
"{}: {} contains no {} files",
|
||||
identifier, dataFolderPath, dataFileTypeString
|
||||
));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
LERROR(fmt::format(
|
||||
"{}: {} is not a valid directory",
|
||||
identifier,
|
||||
dataFolderPath
|
||||
));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2018 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
#ifndef __OPENSPACE_MODULE_DSN___JSONHELPER___H__
|
||||
#define __OPENSPACE_MODULE_DSN___JSONHELPER___H__
|
||||
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <modules/dsn/managers/signalmanager.h>
|
||||
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class JsonHelper {
|
||||
|
||||
public:
|
||||
JsonHelper();
|
||||
/* Extracts all the mandatory information we need from our asset files */
|
||||
static bool checkFileNames(const char* identifier, std::unique_ptr<ghoul::Dictionary> &dictionary, std::vector<std::string> &dataFiles);
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,49 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2018 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/dsn/managers/radecmanager.h>
|
||||
|
||||
namespace openspace {
|
||||
constexpr const char* _loggerCat = "RadecManager";
|
||||
std::vector<std::string> RadecManager::_dataFiles;
|
||||
|
||||
RadecManager::RadecManager()
|
||||
{
|
||||
}
|
||||
|
||||
bool RadecManager::extractMandatoryInfoFromDictionary(const char* identifier, std::unique_ptr<ghoul::Dictionary> &dictionary){
|
||||
|
||||
JsonHelper::checkFileNames(identifier, dictionary, RadecManager::_dataFiles);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void jsonParser(int index) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2018 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
#ifndef __OPENSPACE_MODULE_DSN___RADECMANAGER___H__
|
||||
#define __OPENSPACE_MODULE_DSN___RADECMANAGER___H__
|
||||
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <modules/dsn/managers/jsonhelper.h>
|
||||
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class RadecManager {
|
||||
|
||||
public:
|
||||
RadecManager();
|
||||
static void jsonParser(int index);
|
||||
static std::vector<std::string> _dataFiles;
|
||||
static bool extractMandatoryInfoFromDictionary(const char* identifier, std::unique_ptr<ghoul::Dictionary> &dictionary);
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -27,23 +27,11 @@
|
||||
|
||||
namespace openspace {
|
||||
constexpr const char* _loggerCat = "SignalManager";
|
||||
|
||||
// Keys to get values from dictionary
|
||||
constexpr const char* KeyDataFolder = "DataFolder";
|
||||
constexpr const char* KeyDataFileType = "DataFileType";
|
||||
|
||||
struct SignalManager::SignalData SignalManager::_signalData;
|
||||
std::vector<double> SignalManager::_fileStartTimes;
|
||||
std::vector<std::string> SignalManager::_dataFiles;
|
||||
|
||||
//Filetypes
|
||||
const std::string dataFileTypeStringJson = "json";
|
||||
|
||||
enum class DataFileType : int {
|
||||
Json = 0,
|
||||
Invalid
|
||||
};
|
||||
|
||||
/**
|
||||
* Extracts the general information (from the lua modfile) that is mandatory for the class
|
||||
* to function; such as the file type and the location of the data files.
|
||||
@@ -51,90 +39,18 @@ namespace openspace {
|
||||
*/
|
||||
bool SignalManager::extractMandatoryInfoFromDictionary(const char* identifier, std::unique_ptr<ghoul::Dictionary> &dictionary)
|
||||
{
|
||||
DataFileType sourceFileType = DataFileType::Invalid;
|
||||
|
||||
// ------------------- EXTRACT MANDATORY VALUES FROM DICTIONARY ------------------- //
|
||||
std::string dataFileTypeString;
|
||||
if (!dictionary->getValue(KeyDataFileType, dataFileTypeString)) {
|
||||
LERROR(fmt::format("{}: The field {} is missing", identifier, KeyDataFileType));
|
||||
}
|
||||
std::transform(
|
||||
dataFileTypeString.begin(),
|
||||
dataFileTypeString.end(),
|
||||
dataFileTypeString.begin(),
|
||||
[](char c) { return static_cast<char>(tolower(c)); }
|
||||
);
|
||||
// Verify that the input type is correct
|
||||
if (dataFileTypeString == dataFileTypeStringJson) {
|
||||
sourceFileType = DataFileType::Json;
|
||||
}
|
||||
else {
|
||||
LERROR(fmt::format(
|
||||
"{}: {} is not a recognized {}",
|
||||
identifier, dataFileTypeString, KeyDataFileType
|
||||
));
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string dataFolderPath;
|
||||
if (!dictionary->getValue(KeyDataFolder, dataFolderPath)) {
|
||||
LERROR(fmt::format("{}: The field {} is missing", identifier, KeyDataFolder));
|
||||
return false;
|
||||
}
|
||||
bool dataFilesSuccess = JsonHelper::checkFileNames(identifier, dictionary, _dataFiles);
|
||||
|
||||
// Ensure that the source folder exists and then extract
|
||||
// the files with the same extension as <inputFileTypeString>
|
||||
ghoul::filesystem::Directory dataFolder(dataFolderPath);
|
||||
if (FileSys.directoryExists(dataFolder)) {
|
||||
// Extract all file paths from the provided folder
|
||||
_dataFiles = dataFolder.readFiles(
|
||||
ghoul::filesystem::Directory::Recursive::No,
|
||||
ghoul::filesystem::Directory::Sort::Yes
|
||||
);
|
||||
|
||||
// Remove all files that don't have <dataFileTypeString> as extension
|
||||
_dataFiles.erase(
|
||||
std::remove_if(
|
||||
_dataFiles.begin(),
|
||||
_dataFiles.end(),
|
||||
[dataFileTypeString](const std::string& str) {
|
||||
const size_t extLength = dataFileTypeString.length();
|
||||
std::string sub = str.substr(str.length() - extLength, extLength);
|
||||
std::transform(
|
||||
sub.begin(),
|
||||
sub.end(),
|
||||
sub.begin(),
|
||||
[](char c) { return static_cast<char>(::tolower(c)); }
|
||||
);
|
||||
return sub != dataFileTypeString;
|
||||
}),
|
||||
_dataFiles.end()
|
||||
);
|
||||
// Ensure that there are available and valid source files left
|
||||
if (_dataFiles.empty()) {
|
||||
LERROR(fmt::format(
|
||||
"{}: {} contains no {} files",
|
||||
identifier, dataFolderPath, dataFileTypeString
|
||||
));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
LERROR(fmt::format(
|
||||
"{}: {} is not a valid directory",
|
||||
identifier,
|
||||
dataFolderPath
|
||||
));
|
||||
return false;
|
||||
}
|
||||
extractTriggerTimesFromFileNames(_dataFiles);
|
||||
SignalManager::jsonParser(0);
|
||||
|
||||
return SignalManager::jsonParser(0);
|
||||
return dataFilesSuccess;
|
||||
}
|
||||
|
||||
// Extract J2000 time from file names
|
||||
// Requires files to be named as such: 'YYYY-DDDT.json'
|
||||
void SignalManager::extractTriggerTimesFromFileNames(std::vector<std::string> _dataFiles) {
|
||||
|
||||
// number of characters in filename (excluding '.json')
|
||||
constexpr const int FilenameSize = 9;
|
||||
// size(".json")
|
||||
|
||||
@@ -28,14 +28,10 @@
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <modules/dsn/managers/jsonhelper.h>
|
||||
|
||||
#include <openspace/json.h>
|
||||
|
||||
//#include <modules/dsn/rendering/renderablesignals.h>
|
||||
//#include <openspace/scene/scenegraphnode.h>
|
||||
//#include <openspace/engine/globals.h>
|
||||
//#include <openspace/rendering/renderengine.h>
|
||||
//#include <openspace/scene/scene.h>
|
||||
#include <openspace/util/time.h>
|
||||
#include <fstream>
|
||||
|
||||
@@ -51,7 +47,7 @@ namespace openspace {
|
||||
std::string direction;
|
||||
std::string startTime;
|
||||
std::string endTime;
|
||||
};
|
||||
};
|
||||
|
||||
static struct SignalData {
|
||||
//filename is on the format of YYYY-DDDT (excluding '.json')
|
||||
|
||||
@@ -36,6 +36,8 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
constexpr const char* _loggerCat = "RadecTranslation";
|
||||
|
||||
documentation::Documentation RadecTranslation::Documentation() {
|
||||
using namespace documentation;
|
||||
return {
|
||||
@@ -74,11 +76,16 @@ RadecTranslation::RadecTranslation()
|
||||
requireUpdate();
|
||||
notifyObservers();
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
RadecTranslation::RadecTranslation(const ghoul::Dictionary& dictionary)
|
||||
: RadecTranslation()
|
||||
{
|
||||
std::unique_ptr<ghoul::Dictionary> dictionaryPtr = std::make_unique<ghoul::Dictionary>(dictionary);
|
||||
extractData(dictionaryPtr);
|
||||
|
||||
documentation::testSpecificationAndThrow(
|
||||
Documentation(),
|
||||
dictionary,
|
||||
@@ -86,7 +93,19 @@ RadecTranslation::RadecTranslation(const ghoul::Dictionary& dictionary)
|
||||
);
|
||||
}
|
||||
|
||||
void RadecTranslation::extractData(std::unique_ptr<ghoul::Dictionary> &dictionary){
|
||||
const char* _identifier = "testRADEC";
|
||||
|
||||
if (!RadecManager::extractMandatoryInfoFromDictionary(_identifier, dictionary)) {
|
||||
LERROR(fmt::format("{}: Did not manage to extract data. (from RadecTranslation and RadecManager)", _identifier));
|
||||
}
|
||||
else {
|
||||
LDEBUG(fmt::format("{}: Successfully read data. (from RadecTranslation and RadecManager)", _identifier));
|
||||
}
|
||||
}
|
||||
|
||||
glm::dvec3 RadecTranslation::convertRaDecRangeToCartesian() const{
|
||||
|
||||
//Todo: stream data from file
|
||||
//Static data for voyager 1
|
||||
double ra = 257.777029167736; //2018-246
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <openspace/properties/vector/dvec3property.h>
|
||||
#include <modules/dsn/rendering/renderablesignals.h>
|
||||
#include <modules/dsn/managers/radecmanager.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
@@ -41,6 +42,7 @@ namespace documentation { struct Documentation; }
|
||||
class RadecTranslation : public Translation {
|
||||
public:
|
||||
RadecTranslation();
|
||||
void extractData(std::unique_ptr<ghoul::Dictionary> &dictionary);
|
||||
RadecTranslation(const ghoul::Dictionary& dictionary);
|
||||
/* Converts the Ra Dec range coordinates into cartesian coordinates*/
|
||||
glm::dvec3 convertRaDecRangeToCartesian() const;
|
||||
|
||||
Reference in New Issue
Block a user