From 22d125c1929f5dc8bef5dbf3aa8a3ea872aa1ef6 Mon Sep 17 00:00:00 2001 From: Erik Broberg Date: Fri, 5 Aug 2016 13:25:02 -0400 Subject: [PATCH] Add unimplemneted class InstrumentTimesParser --- modules/newhorizons/CMakeLists.txt | 2 + .../util/instrumenttimesparser.cpp | 87 +++++++++++++++++++ .../newhorizons/util/instrumenttimesparser.h | 69 +++++++++++++++ .../newhorizons/util/projectioncomponent.cpp | 9 +- 4 files changed, 166 insertions(+), 1 deletion(-) create mode 100644 modules/newhorizons/util/instrumenttimesparser.cpp create mode 100644 modules/newhorizons/util/instrumenttimesparser.h diff --git a/modules/newhorizons/CMakeLists.txt b/modules/newhorizons/CMakeLists.txt index 6ed7a3e3e0..be3314becd 100644 --- a/modules/newhorizons/CMakeLists.txt +++ b/modules/newhorizons/CMakeLists.txt @@ -34,6 +34,7 @@ set(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/rendering/writeToTexture.h ${CMAKE_CURRENT_SOURCE_DIR}/util/decoder.h ${CMAKE_CURRENT_SOURCE_DIR}/util/hongkangparser.h + ${CMAKE_CURRENT_SOURCE_DIR}/util/instrumenttimesparser.h ${CMAKE_CURRENT_SOURCE_DIR}/util/imagesequencer.h ${CMAKE_CURRENT_SOURCE_DIR}/util/instrumentdecoder.h ${CMAKE_CURRENT_SOURCE_DIR}/util/labelparser.h @@ -53,6 +54,7 @@ set(SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablemodelprojection.cpp ${CMAKE_CURRENT_SOURCE_DIR}/util/decoder.cpp ${CMAKE_CURRENT_SOURCE_DIR}/util/hongkangparser.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/util/instrumenttimesparser.cpp ${CMAKE_CURRENT_SOURCE_DIR}/util/imagesequencer.cpp ${CMAKE_CURRENT_SOURCE_DIR}/util/instrumentdecoder.cpp ${CMAKE_CURRENT_SOURCE_DIR}/util/labelparser.cpp diff --git a/modules/newhorizons/util/instrumenttimesparser.cpp b/modules/newhorizons/util/instrumenttimesparser.cpp new file mode 100644 index 0000000000..b7bae64493 --- /dev/null +++ b/modules/newhorizons/util/instrumenttimesparser.cpp @@ -0,0 +1,87 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace { + const std::string _loggerCat = "InstrumentTimesParser"; + + const std::string PlaybookIdentifierName = "InstrumentTimesParser"; +} + +namespace openspace { + +InstrumentTimesParser::InstrumentTimesParser( + const std::string& name, + const std::string& sequenceSource, + ghoul::Dictionary& parserDict) + : _name(name) + , _fileName(sequenceSource) + , _pattern("\".+\" \".+\"") +{ + + +} + + +bool InstrumentTimesParser::create() { + auto imageComparer = [](const Image &a, const Image &b)->bool{ + return a.startTime < b.startTime; + }; + auto targetComparer = [](const std::pair &a, + const std::pair &b)->bool{ + return a.first < b.first; + }; + std::string previousTarget; + std::string lblName = ""; + + using RawPath = ghoul::filesystem::Directory::RawPath; + ghoul::filesystem::Directory sequenceDir(_fileName, RawPath::Yes); + if (!FileSys.directoryExists(sequenceDir)) { + LERROR("Could not load Label Directory '" << sequenceDir.path() << "'"); + return false; + } + + using Recursive = ghoul::filesystem::Directory::Recursive; + using Sort = ghoul::filesystem::Directory::Sort; + std::vector sequencePaths = sequenceDir.read(Recursive::Yes, Sort::No); + + + sendPlaybookInformation(PlaybookIdentifierName); + return true; +} + + +} \ No newline at end of file diff --git a/modules/newhorizons/util/instrumenttimesparser.h b/modules/newhorizons/util/instrumenttimesparser.h new file mode 100644 index 0000000000..112f07a94b --- /dev/null +++ b/modules/newhorizons/util/instrumenttimesparser.h @@ -0,0 +1,69 @@ +/***************************************************************************************** +* * +* OpenSpace * +* * +* Copyright (c) 2014-2016 * +* * +* 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 __INSTRUMENTTIMESPARSER_H__ +#define __INSTRUMENTTIMESPARSER_H__ + +#include +#include + +#include + +#include +#include +#include +#include + +namespace openspace { +class InstrumentTimesParser : public SequenceParser{ +public: + InstrumentTimesParser( + const std::string& name, + const std::string& sequenceSource, + ghoul::Dictionary& parserDict); + + bool create() override; + + // temporary need to figure this out + std::map getTranslation(){ return _fileTranslation; }; + +private: + + std::regex _pattern; + + std::string _name; + std::string _fileName; + std::string _spacecraft; + std::map _fileTranslation; + std::vector _specsOfInterest; + + std::string _target; + std::string _instrumentID; + std::string _instrumentHostID; + std::string _detectorType; + std::string _sequenceID; + bool _badDecoding; +}; +} +#endif //__INSTRUMENTTIMESPARSER_H__ \ No newline at end of file diff --git a/modules/newhorizons/util/projectioncomponent.cpp b/modules/newhorizons/util/projectioncomponent.cpp index a37668f78a..e628d2612d 100644 --- a/modules/newhorizons/util/projectioncomponent.cpp +++ b/modules/newhorizons/util/projectioncomponent.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -55,6 +56,7 @@ namespace { const std::string sequenceTypeImage = "image-sequence"; const std::string sequenceTypePlaybook = "playbook"; const std::string sequenceTypeHybrid = "hybrid"; + const std::string sequenceTypeInstrumentTimes = "instrument-times"; const std::string placeholderFile = "${OPENSPACE_DATA}/scene/common/textures/placeholder.png"; @@ -204,8 +206,13 @@ bool ProjectionComponent::initializeParser(const ghoul::Dictionary& dictionary) LWARNING("No eventfile has been provided, please check modfiles"); } } + else if (sequenceType == sequenceTypeInstrumentTimes) { + parsers.push_back(new InstrumentTimesParser( + name, + sequenceSource, + translationDictionary)); + } - for(SequenceParser* parser : parsers){ openspace::ImageSequencer::ref().runSequenceParser(parser); delete parser;