mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 19:50:03 -06:00
Restructure parsers, send label parser information to GUI application
This commit is contained in:
@@ -22,48 +22,52 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
|
||||
#ifndef __SEQUENCEPARSER_H__
|
||||
#define __SEQUENCEPARSER_H__
|
||||
#include <openspace/util/decoder.h>
|
||||
|
||||
#include <openspace/network/networkengine.h>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace openspace {
|
||||
struct Image{
|
||||
double startTime;
|
||||
double stopTime;
|
||||
std::string path;
|
||||
std::vector<std::string> activeInstruments;
|
||||
std::string target;
|
||||
bool projected;
|
||||
};
|
||||
struct TimeRange{
|
||||
TimeRange() : _min(-1), _max(-1){};
|
||||
void setRange(double val){
|
||||
if (_min > val) _min = val;
|
||||
if (_max < val) _max = val;
|
||||
};
|
||||
bool inRange(double min, double max){
|
||||
return (min >= _min && max <= _max);
|
||||
}
|
||||
bool inRange(double val){
|
||||
return (val >= _min && val <= _max);
|
||||
}
|
||||
double _min;
|
||||
double _max;
|
||||
};
|
||||
struct ImageSubset{
|
||||
TimeRange _range;
|
||||
std::vector < Image > _subset;
|
||||
};
|
||||
|
||||
class Decoder;
|
||||
|
||||
struct Image {
|
||||
double startTime;
|
||||
double stopTime;
|
||||
std::string path;
|
||||
std::vector<std::string> activeInstruments;
|
||||
std::string target;
|
||||
bool projected;
|
||||
};
|
||||
|
||||
struct TimeRange {
|
||||
TimeRange() : _min(-1), _max(-1){};
|
||||
void setRange(double val){
|
||||
if (_min > val) _min = val;
|
||||
if (_max < val) _max = val;
|
||||
};
|
||||
bool inRange(double min, double max){
|
||||
return (min >= _min && max <= _max);
|
||||
}
|
||||
bool inRange(double val){
|
||||
return (val >= _min && val <= _max);
|
||||
}
|
||||
double _min;
|
||||
double _max;
|
||||
};
|
||||
|
||||
struct ImageSubset {
|
||||
TimeRange _range;
|
||||
std::vector<Image> _subset;
|
||||
};
|
||||
|
||||
class SequenceParser {
|
||||
public:
|
||||
virtual void create() = 0;
|
||||
virtual void create() = 0;
|
||||
virtual std::map<std::string, ImageSubset> getSubsetMap() final;
|
||||
virtual std::vector<std::pair<std::string, TimeRange>> getIstrumentTimes() final;
|
||||
virtual std::vector<std::pair<double, std::string>> getTargetTimes() final;
|
||||
@@ -71,13 +75,16 @@ public:
|
||||
virtual std::vector<double> getCaptureProgression() final;
|
||||
|
||||
protected:
|
||||
void sendPlaybookInformation();
|
||||
void sendPlaybookInformation(const std::string& name);
|
||||
|
||||
std::map<std::string, ImageSubset> _subsetMap;
|
||||
std::vector<std::pair<std::string, TimeRange>> _instrumentTimes;
|
||||
std::vector<std::pair<double, std::string>> _targetTimes;
|
||||
std::vector<double> _captureProgression;
|
||||
|
||||
NetworkEngine::MessageIdentifier _messageIdentifier;
|
||||
};
|
||||
}
|
||||
#endif //__SEQUENCEPARSER_H__
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif //__SEQUENCEPARSER_H__
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace {
|
||||
const std::string _loggerCat = "HongKangParser";
|
||||
const std::string keyTranslation = "DataInputTranslation";
|
||||
|
||||
const std::string PlaybookIdentifierName = "Playbook";
|
||||
const std::string PlaybookIdentifierName = "HongKang";
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
@@ -251,7 +251,7 @@ void HongKangParser::create(){
|
||||
}
|
||||
}
|
||||
|
||||
sendPlaybookInformation();
|
||||
sendPlaybookInformation(PlaybookIdentifierName);
|
||||
|
||||
//std::ofstream myfile;
|
||||
//myfile.open("HongKangOutput.txt");
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <ghoul/filesystem/directory.h>
|
||||
#include <openspace/util/time.h>
|
||||
#include <ghoul/filesystem/cachemanager.h>
|
||||
#include <openspace/util/decoder.h>
|
||||
|
||||
#include <openspace/util/spicemanager.h>
|
||||
#include <fstream>
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <ghoul/filesystem/directory.h>
|
||||
#include <openspace/util/time.h>
|
||||
#include <openspace/util/spicemanager.h>
|
||||
#include <openspace/util/decoder.h>
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
#include <iomanip>
|
||||
@@ -38,6 +39,8 @@ namespace {
|
||||
const std::string _loggerCat = "LabelParser";
|
||||
const std::string keySpecs = "Read";
|
||||
const std::string keyConvert = "Convert";
|
||||
|
||||
const std::string PlaybookIdentifierName = "LabelParser";
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
@@ -272,6 +275,7 @@ void LabelParser::create(){
|
||||
}
|
||||
//myfile.close();
|
||||
|
||||
sendPlaybookInformation(PlaybookIdentifierName);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#include <openspace/util/sequenceparser.h>
|
||||
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/network/networkengine.h>
|
||||
#include <openspace/util/spicemanager.h>
|
||||
#include <openspace/util/decoder.h>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "SequenceParser";
|
||||
@@ -73,8 +73,9 @@ void writeToBuffer<std::string>(std::vector<char>& buffer, size_t& currentWriteL
|
||||
currentWriteLocation += length;
|
||||
}
|
||||
|
||||
void SequenceParser::sendPlaybookInformation() {
|
||||
static const NetworkEngine::MessageIdentifier PlaybookIdentifier = OsEng.networkEngine()->identifier(PlaybookIdentifierName);
|
||||
void SequenceParser::sendPlaybookInformation(const std::string& name) {
|
||||
std::string fullName = PlaybookIdentifierName + "_" + name;
|
||||
_messageIdentifier = OsEng.networkEngine()->identifier(fullName);
|
||||
|
||||
std::vector<char> buffer(1024);
|
||||
size_t currentWriteLocation = 0;
|
||||
@@ -164,7 +165,7 @@ void SequenceParser::sendPlaybookInformation() {
|
||||
buffer.resize(currentWriteLocation);
|
||||
|
||||
//OsEng.networkEngine()->publishMessage(PlaybookIdentifier, buffer);
|
||||
OsEng.networkEngine()->setInitialConnectionMessage(PlaybookIdentifier, buffer);
|
||||
OsEng.networkEngine()->setInitialConnectionMessage(_messageIdentifier, buffer);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user