mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-31 00:18:39 -06:00
renamed jsonHelper to dataFileHelper
This commit is contained in:
@@ -29,7 +29,7 @@ set(HEADER_FILES
|
||||
${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
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/managers/datafilehelper.h
|
||||
)
|
||||
source_group("Header Files" FILES ${HEADER_FILES})
|
||||
|
||||
@@ -38,7 +38,7 @@ set(SOURCE_FILES
|
||||
${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
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/managers/datafilehelper.cpp
|
||||
)
|
||||
source_group("Source Files" FILES ${SOURCE_FILES})
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/dsn/managers/jsonhelper.h>
|
||||
#include <modules/dsn/managers/datafilehelper.h>
|
||||
|
||||
namespace openspace {
|
||||
constexpr const char* _loggerCat = "JsonHelper";
|
||||
constexpr const char* _loggerCat = "DataFileHelper";
|
||||
|
||||
// Keys to get values from dictionary
|
||||
constexpr const char* KeyDataFolder = "DataFolder";
|
||||
@@ -43,7 +43,7 @@ namespace openspace {
|
||||
* 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)
|
||||
bool DataFileHelper::checkFileNames(const char* identifier, std::unique_ptr<ghoul::Dictionary> &dictionary, std::vector<std::string> &dataFiles)
|
||||
{
|
||||
DataFileType sourceFileType = DataFileType::Invalid;
|
||||
|
||||
@@ -125,25 +125,25 @@ namespace openspace {
|
||||
}
|
||||
|
||||
/*Get the day, must have format YYYY-DDDT*/
|
||||
std::string JsonHelper::getDayFromFileName(std::string filename) {
|
||||
std::string DataFileHelper::getDayFromFileName(std::string filename) {
|
||||
// number of characters in filename (excluding '.json')
|
||||
constexpr const int FilenameSize = 9;
|
||||
return JsonHelper::getFileNameTime(filename, FilenameSize);
|
||||
return DataFileHelper::getFileNameTime(filename, FilenameSize);
|
||||
}
|
||||
std::vector<double> JsonHelper::getDaysFromFileNames(std::vector<std::string> _dataFiles) {
|
||||
std::vector<double> DataFileHelper::getDaysFromFileNames(std::vector<std::string> _dataFiles) {
|
||||
// number of characters in filename (excluding '.json')
|
||||
constexpr const int FilenameSize = 9;
|
||||
return JsonHelper::extractTriggerTimesFromFileNames(_dataFiles, FilenameSize);
|
||||
return DataFileHelper::extractTriggerTimesFromFileNames(_dataFiles, FilenameSize);
|
||||
}
|
||||
|
||||
/*Get the hour, must have format YYYY-DDDTHH*/
|
||||
std::vector<double> JsonHelper::getHoursFromFileNames(std::vector<std::string> _dataFiles) {
|
||||
std::vector<double> DataFileHelper::getHoursFromFileNames(std::vector<std::string> _dataFiles) {
|
||||
// number of characters in filename (excluding '.json')
|
||||
constexpr const int FilenameSize = 11;
|
||||
return JsonHelper::extractTriggerTimesFromFileNames(_dataFiles, FilenameSize);
|
||||
return DataFileHelper::extractTriggerTimesFromFileNames(_dataFiles, FilenameSize);
|
||||
}
|
||||
|
||||
std::string JsonHelper::getFileNameTime(std::string filename, const int FilenameSize) {
|
||||
std::string DataFileHelper::getFileNameTime(std::string filename, const int FilenameSize) {
|
||||
// size(".json")
|
||||
constexpr const int ExtSize = 5;
|
||||
const size_t strLength = filename.size();
|
||||
@@ -155,7 +155,7 @@ namespace openspace {
|
||||
return startTimeString;
|
||||
}
|
||||
// Extract J2000 time from file names
|
||||
std::vector<double> JsonHelper::extractTriggerTimesFromFileNames(std::vector<std::string> dataFiles, const int FilenameSize) {
|
||||
std::vector<double> DataFileHelper::extractTriggerTimesFromFileNames(std::vector<std::string> dataFiles, const int FilenameSize) {
|
||||
std::vector<double> fileStartTimes;
|
||||
for (const std::string& filePath : dataFiles) {
|
||||
std::string timeString = getFileNameTime(filePath, FilenameSize);
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class JsonHelper {
|
||||
class DataFileHelper {
|
||||
|
||||
public:
|
||||
/* Extracts all the mandatory information we need from our asset files */
|
||||
@@ -32,13 +32,13 @@ namespace openspace {
|
||||
double RadecManager::_range;
|
||||
|
||||
bool RadecManager::extractMandatoryInfoFromDictionary(const char* identifier, std::unique_ptr<ghoul::Dictionary> &dictionary){
|
||||
bool dataFilesSuccess = JsonHelper::checkFileNames(identifier, dictionary, RadecManager::_dataFiles);
|
||||
bool dataFilesSuccess = DataFileHelper::checkFileNames(identifier, dictionary, RadecManager::_dataFiles);
|
||||
radecParser(0);
|
||||
return dataFilesSuccess;
|
||||
}
|
||||
|
||||
glm::vec3 RadecManager::GetPosForTime(double time) {
|
||||
std::vector<double> timeDoubles = JsonHelper::getHoursFromFileNames(_dataFiles);
|
||||
std::vector<double> timeDoubles = DataFileHelper::getHoursFromFileNames(_dataFiles);
|
||||
int idx = RenderableSignals::findFileIndexForCurrentTime(time, timeDoubles);
|
||||
|
||||
if (radecParser(idx)) {
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <modules/dsn/managers/jsonhelper.h>
|
||||
#include <modules/dsn/managers/datafilehelper.h>
|
||||
#include <modules/dsn/rendering/renderablesignals.h>
|
||||
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@ namespace openspace {
|
||||
|
||||
bool SignalManager::extractMandatoryInfoFromDictionary(const char* identifier, std::unique_ptr<ghoul::Dictionary> &dictionary)
|
||||
{
|
||||
bool dataFilesSuccess = JsonHelper::checkFileNames(identifier, dictionary, _dataFiles);
|
||||
_fileStartTimes = JsonHelper::getDaysFromFileNames(_dataFiles);
|
||||
bool dataFilesSuccess = DataFileHelper::checkFileNames(identifier, dictionary, _dataFiles);
|
||||
_fileStartTimes = DataFileHelper::getDaysFromFileNames(_dataFiles);
|
||||
SignalManager::signalParser(0);
|
||||
|
||||
return dataFilesSuccess;
|
||||
@@ -53,7 +53,7 @@ namespace openspace {
|
||||
|
||||
SignalManager::Signal structSignal;
|
||||
|
||||
std::string startTimeString = JsonHelper::getDayFromFileName(filename);
|
||||
std::string startTimeString = DataFileHelper::getDayFromFileName(filename);
|
||||
const double triggerTime = Time::convertTime(startTimeString);
|
||||
|
||||
_signalData.sequenceStartTime = triggerTime;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <modules/dsn/managers/jsonhelper.h>
|
||||
#include <modules/dsn/managers/datafilehelper.h>
|
||||
#include <openspace/json.h>
|
||||
#include <openspace/util/time.h>
|
||||
#include <fstream>
|
||||
|
||||
Reference in New Issue
Block a user