Add unimplemneted class InstrumentTimesParser

This commit is contained in:
Erik Broberg
2016-08-05 13:25:02 -04:00
parent e664929bf2
commit 22d125c192
4 changed files with 166 additions and 1 deletions

View File

@@ -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

View File

@@ -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 <ghoul/logging/logmanager.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/filesystem/directory.h>
#include <openspace/util/time.h>
#include <openspace/util/spicemanager.h>
#include <modules/newhorizons/util/decoder.h>
#include <fstream>
#include <iterator>
#include <iomanip>
#include <limits>
#include <modules/newhorizons/util/instrumenttimesparser.h>
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<double, std::string> &a,
const std::pair<double, std::string> &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<std::string> sequencePaths = sequenceDir.read(Recursive::Yes, Sort::No);
sendPlaybookInformation(PlaybookIdentifierName);
return true;
}
}

View File

@@ -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 <modules/newhorizons/util/imagesequencer.h>
#include <modules/newhorizons/util/sequenceparser.h>
#include <ghoul/misc/dictionary.h>
#include <map>
#include <string>
#include <vector>
#include <regex>
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<std::string, Decoder*> getTranslation(){ return _fileTranslation; };
private:
std::regex _pattern;
std::string _name;
std::string _fileName;
std::string _spacecraft;
std::map<std::string, Decoder*> _fileTranslation;
std::vector<std::string> _specsOfInterest;
std::string _target;
std::string _instrumentID;
std::string _instrumentHostID;
std::string _detectorType;
std::string _sequenceID;
bool _badDecoding;
};
}
#endif //__INSTRUMENTTIMESPARSER_H__

View File

@@ -26,6 +26,7 @@
#include <modules/newhorizons/util/hongkangparser.h>
#include <modules/newhorizons/util/imagesequencer.h>
#include <modules/newhorizons/util/instrumenttimesparser.h>
#include <modules/newhorizons/util/labelparser.h>
#include <openspace/scene/scenegraphnode.h>
@@ -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;