From 4dba4f4cee107fdfdae49256bce1c60849de514f Mon Sep 17 00:00:00 2001 From: Michal Marcinkowski Date: Thu, 29 Jan 2015 19:57:45 -0500 Subject: [PATCH] minor changes / updates --- include/openspace/util/imagesequencer.h | 2 +- openspace-data | 2 +- .../planets/renderableplanetprojection.cpp | 9 +---- src/util/imagesequencer.cpp | 39 ++++++++++++------- 4 files changed, 28 insertions(+), 24 deletions(-) diff --git a/include/openspace/util/imagesequencer.h b/include/openspace/util/imagesequencer.h index 49214c44e3..d71b8dac19 100644 --- a/include/openspace/util/imagesequencer.h +++ b/include/openspace/util/imagesequencer.h @@ -39,7 +39,7 @@ public: static ImageSequencer& ref(); bool loadSequence(const std::string dir); - bool parsePlaybook(const std::string dir, std::string year = "2015"); + bool parsePlaybook(const std::string& dir, const std::string& type, std::string year = "2015"); void testStartTimeMap(); diff --git a/openspace-data b/openspace-data index a06a05ab18..a398fe8527 160000 --- a/openspace-data +++ b/openspace-data @@ -1 +1 @@ -Subproject commit a06a05ab184aed8a1ffbb3880f3bd11068dca9ef +Subproject commit a398fe852700f2fd75e7a883e54eb0168300a294 diff --git a/src/rendering/planets/renderableplanetprojection.cpp b/src/rendering/planets/renderableplanetprojection.cpp index c11dee9651..da0f59ac88 100644 --- a/src/rendering/planets/renderableplanetprojection.cpp +++ b/src/rendering/planets/renderableplanetprojection.cpp @@ -136,15 +136,8 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary& bool loaded = openspace::ImageSequencer::ref().loadSequence(_sequenceDir); if (!loaded) LDEBUG(name + " did not load sequence " + _sequenceDir + " check mod file path"); */ - openspace::ImageSequencer::ref().parsePlaybook("C:/Users/michal/playbook"); + openspace::ImageSequencer::ref().parsePlaybook("C:/Users/michal/playbook", "txt"); } - - std::string str = "2015 191::22:04:21"; - double ettest; - openspace::SpiceManager::ref().getETfromDate(str, ettest); - openspace::SpiceManager::ref().getDateFromET(ettest, str); - std::cout <<"THIS : " << str << std::endl; - } RenderablePlanetProjection::~RenderablePlanetProjection(){ diff --git a/src/util/imagesequencer.cpp b/src/util/imagesequencer.cpp index dea2179c6c..c4180d101c 100644 --- a/src/util/imagesequencer.cpp +++ b/src/util/imagesequencer.cpp @@ -157,7 +157,7 @@ bool replace(std::string& str, const std::string& from, const std::string& to) { return true; } -bool ImageSequencer::parsePlaybook(const std::string dir, std::string year){ +bool ImageSequencer::parsePlaybook(const std::string& dir, const std::string& type, std::string year){ ghoul::filesystem::Directory playbookDir(dir, true); std::vector dirlist = playbookDir.read(true, false); for (auto path : dirlist){ @@ -165,8 +165,9 @@ bool ImageSequencer::parsePlaybook(const std::string dir, std::string year){ if (position != std::string::npos){ ghoul::filesystem::File currentFile(path); std::string extension = currentFile.fileExtension(); - - if (extension == "csv"){ // comma separated playbook + + if (extension == type && extension == "csv"){ // comma separated playbook + std::cout << "USING COMMA SEPARATED TIMELINE V9F" << std::endl; std::ifstream file(currentFile.path()); if (!file.good()) LERROR("Failed to open csv file '" << currentFile.path() << "'"); @@ -190,14 +191,16 @@ bool ImageSequencer::parsePlaybook(const std::string dir, std::string year){ } while (!file.eof()); } - /* - if (extension == "txt"){// Hong Kang. pre-parsed playbook + if (extension == type && extension == "txt"){// Hong Kang. pre-parsed playbook + std::cout << "USING PREPARSED PLAYBOOK V9H" << std::endl; std::ifstream file(currentFile.path()); - if (!file.good()) LERROR("Failed to open csv file '" << currentFile.path() << "'"); - std::cout << "HERE" << std::endl; + if (!file.good()) LERROR("Failed to open txt file '" << currentFile.path() << "'"); + std::string timestr = ""; double shutter = 0.01; double et; + + double metRef = 299180517; do{ std::getline(file, timestr); auto pos = timestr.find("LORRI Image Started"); @@ -205,22 +208,28 @@ bool ImageSequencer::parsePlaybook(const std::string dir, std::string year){ timestr = timestr.substr(24, 9); std::string::size_type sz; // alias of size_t - double sclk = std::stod(timestr, &sz); - //et = 2453755.256337 + (et / 86399.9998693); - - openspace::SpiceManager::ref().spacecraftClockToET("NEW HORIZONS", sclk, et); + double met = std::stod(timestr, &sz); + double diff; + openspace::SpiceManager::ref().getETfromDate("2015-07-14T11:50:00.00", et); + diff = abs(met - metRef); + if (met > metRef){ + et += diff; + } + else if (met < metRef){ + et -= diff; + } + /* std::string str; openspace::SpiceManager::ref().getDateFromET(et, str); std::cout << str << std::endl; - + */ std::string defaultImagePath = dir + "/placeholder.png"; - std::cout << defaultImagePath << std::endl; createImage(et, et + shutter, defaultImagePath); } } while (!file.eof()); } - */ + } } } @@ -273,6 +282,8 @@ bool ImageSequencer::loadSequence(const std::string dir){ } } } + // NEED TO FIX THIS LATER ON + //_nextCapture = nextCaptureTime(Time::ref().currentTime()); // this is not really working 100% //_intervalLength = _timeStamps[1].startTime; return !sequencePaths.empty();