completely new imagesequencer class - WIP

This commit is contained in:
Michal Marcinkowski
2015-04-16 11:57:23 -04:00
parent d124209281
commit de6fcf1583
24 changed files with 834 additions and 584 deletions
@@ -33,7 +33,8 @@
#include <openspace/util/sequenceparser.h>
#include <openspace/util/hongkangparser.h>
#include <openspace/util/payload.h>
#include <openspace/util/labelparser.h>
#include <openspace/util/decoder.h>
#include <openspace/properties/stringproperty.h>
@@ -77,7 +78,7 @@ protected:
private:
void imageProjectGPU();
std::map<std::string, Payload*> _fileTranslation;
std::map<std::string, Decoder*> _fileTranslation;
properties::StringProperty _colorTexturePath;
properties::StringProperty _projectionTexturePath;
@@ -134,6 +135,8 @@ private:
GLuint _fboID;
GLuint _quad;
GLuint _vertexPositionBuffer;
bool _once; //fml
};
} // namespace openspace
@@ -124,59 +124,3 @@ public:
};
}
#endif
// Scrap stuff i need to keep for now (michal)
/* // idk how we will compute the aberrated state.
double RenderableFov::computeTargetLocalTime(PowerScaledScalar d){
double c = 299792456.075; // m/s
double dt = ( (d[0]*pow(10, d[1])) / c );
double t_local = _time - dt*86400;
std::string localTime;
std::string currentTime;
openspace::SpiceManager::ref().getDateFromET(t_local, localTime);
openspace::SpiceManager::ref().getDateFromET(_time , currentTime);
std::cout << "time at jupiter : " << localTime << "\time at NH" << currentTime << std::endl;
return t_local;
}*/
/*
psc RenderableFov::sphericalInterpolate(glm::dvec3 p0, glm::dvec3 p1, float t){
double targetEt, lt;
glm::dvec3 ip, iv;
psc targetPos;
SpiceManager::ref().getTargetPosition("JUPITER", _spacecraft, _frame, _aberrationCorrection, _time, targetPos, lt);
openspace::SpiceManager::ref().getSurfaceIntercept(_fovTarget, _spacecraft, _instrumentID,
_frame, _method, _aberrationCorrection, _time, targetEt, p0, ip, iv);
psc psc0 = PowerScaledCoordinate::CreatePowerScaledCoordinate(iv[0], iv[1], iv[2]);
openspace::SpiceManager::ref().getSurfaceIntercept(_fovTarget, _spacecraft, _instrumentID,
_frame, _method, _aberrationCorrection, _time, targetEt, p1, ip, iv);
psc psc1 = PowerScaledCoordinate::CreatePowerScaledCoordinate(iv[0], iv[1], iv[2]);
psc0[3] += 3;
psc1[3] += 3;
psc0 -= targetPos;
psc1 -= targetPos;
double angle = psc0.angle(psc1);
std::cout << angle << std::endl;
double sin_a = sin(angle); // opt
double l[2] = { sin((1.f - t)*angle) / sin_a, sin((t)*angle) / sin_a };
std::cout << l[0] << " " << l[1] << std::endl;
float s = ((t-1)*psc0[3] + (t)*psc1[3]);
float x = (l[0]*psc0[0] + l[1]*psc1[0]);
float y = (l[0]*psc0[1] + l[1]*psc1[1]);
float z = (l[0]*psc0[2] + l[1]*psc1[2]);
psc interpolated = PowerScaledCoordinate::PowerScaledCoordinate(x, y, z, 10);
return interpolated;
}
*/
@@ -22,26 +22,26 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __PAYLOAD_H__
#define __PAYLOAD_H__
#ifndef __DECODER_H__
#define __DECODER_H__
#include <ghoul/misc/dictionary.h>
#include <openspace/util/updatestructures.h>
namespace openspace {
class Payload {
class Decoder {
public:
static Payload* createFromDictionary(const ghoul::Dictionary& dictionary, const std::string type);
static Decoder* createFromDictionary(const ghoul::Dictionary& dictionary, const std::string type);
Payload(const ghoul::Dictionary& dictionary);
virtual ~Payload();
virtual std::string getType() = 0;
virtual std::vector<std::string> getSpiceIDs() = 0;
Decoder(const ghoul::Dictionary& dictionary);
virtual ~Decoder();
virtual std::string getDecoderType() = 0;
virtual std::vector<std::string> getTranslation() = 0;
protected:
Payload();
Decoder();
};
} // namespace openspace
#endif // __PAYLOAD_H__
#endif // __DECODER_H__
+11 -11
View File
@@ -28,27 +28,26 @@
#include <openspace/util/ImageSequencer2.h>
#include <openspace/util/sequenceparser.h>
#include <map>
#include <string>
#include <vector>
namespace openspace {
class HongKangParser : public SequenceParser{
public:
HongKangParser();
HongKangParser(const std::string& fileName,
std::string spacecraft,
std::map<std::string, Payload*> acronymDictionary,
ghoul::Dictionary dictionary,
std::vector<std::string> potentialTargets);
virtual void create();
virtual std::map<std::string, ImageSubset> getSubsetMap();
virtual std::vector<std::pair<double, std::string>> getIstrumentTimes();
virtual std::vector<std::pair<std::string, TimeRange>> getIstrumentTimes();
virtual std::vector<std::pair<double, std::string>> getTargetTimes();
// temporary need to figure this out
std::map<std::string, Payload*> getAcronymDictionary(){ return _fileTranslation; };
virtual std::map<std::string, Decoder*> getTranslation(){ return _fileTranslation; };
virtual std::vector<double> getCaptureProgression();
private:
double getMetFromET(double et);
@@ -67,18 +66,19 @@ namespace openspace {
std::vector<std::string> payload,
std::vector<std::string> potentialTargets);
std::map<std::string, ImageSubset> _subsetMap;
std::vector<std::pair<double, std::string>> _instrumentTimes;
std::vector<std::pair<double, std::string>> _targetTimes;
std::string _defaultCaptureImage;
double _metRef = 299180517;
std::string _fileName;
std::string _spacecraft;
std::map<std::string, Payload*> _fileTranslation;
std::map<std::string, Decoder*> _fileTranslation;
std::vector<std::string> _potentialTargets;
//returnable
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;
};
}
+13 -10
View File
@@ -48,9 +48,10 @@ public:
static void initialize();
static void deinitialize();
bool isReady();
//provides the sequencer with current time
void updateSequencer(double time);
void runSequenceParser(SequenceParser* parser);
//translates playbook ambiguous namesetting to spice calls, augments each observation with targets and
@@ -68,11 +69,12 @@ public:
std::pair<double, std::vector<std::string>> getIncidentTargetList(int range = 2);
double getNextCaptureTime();
double getIntervalLength();
std::vector<std::pair<std::string, bool>> getActiveInstruments();
bool ImageSequencer2::getImagePaths(std::vector<std::pair<double, std::string>>& captures, std::string projectee, std::string instrumentID);
bool ImageSequencer2::getImagePaths(std::vector<std::pair<double, std::string>>& captures, std::string projectee);
//a fov class can check whether or not its active
bool instumentActive(std::string instrumentID);
//get all currently active instruments
std::vector<std::string> getActiveInstruments();
const Image* findLatestImageInSubset( ImageSubset& subset);
private:
@@ -88,18 +90,19 @@ private:
//var
double _currentTime;
double _previousTime;
double _intervalLength;
double _nextCapture;
std::string _defaultCaptureImage;
std::vector<std::string> _currentlyActiveInstruments;
std::vector<std::pair<std::string, bool>> _instrumentOnOff;
std::map<std::string, ImageSubset> _subsetMap;
std::vector<std::pair<double, std::string>> _targetTimes;
std::vector<std::pair<double, std::string>> _instrumentTimes;
//std::vector<std::string, TimeRange> _activeInstruments
std::map<std::string, std::vector<std::string>> _acronymDictionary;
static bool hasData();
std::vector<std::pair<std::string, TimeRange>> _instrumentTimes;
std::vector<double> _captureProgression;
std::map<std::string, Decoder*> _fileTranslation;
bool _hasData;
};
} // namespace openspace
@@ -22,20 +22,20 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __SCANNERINSTRUMENT_H__
#define __SCANNERINSTRUMENT_H__
#ifndef __INSTRUMENTDECODER_H__
#define __INSTRUMENTDECODER_H__
#include <openspace/util/payload.h>
#include <openspace/util/decoder.h>
#include <openspace/util/powerscaledcoordinate.h>
namespace openspace {
class ScannerInstrument : public Payload {
class InstrumentDecoder : public Decoder {
public:
ScannerInstrument(const ghoul::Dictionary& dictionary);
virtual std::string getType();
virtual std::vector<std::string> getSpiceIDs();
InstrumentDecoder(const ghoul::Dictionary& dictionary);
virtual std::string getDecoderType();
virtual std::vector<std::string> getTranslation();
private:
std::string _type;
std::vector<std::string> _spiceIDs;
@@ -43,4 +43,4 @@ private:
} // namespace openspace
#endif // __SCANNERINSTRUMENT_H__
#endif // __INSTRUMENTDECODER_H__
+76
View File
@@ -0,0 +1,76 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* 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 __LABELPARSER_H__
#define __LABELPARSER_H__
#include <openspace/util/ImageSequencer2.h>
#include <openspace/util/sequenceparser.h>
#include <map>
#include <string>
#include <vector>
namespace openspace {
class LabelParser : public SequenceParser{
public:
LabelParser();
LabelParser(const std::string& fileName,
ghoul::Dictionary translationDictionary);
virtual void create();
virtual std::map<std::string, ImageSubset> getSubsetMap();
virtual std::vector<std::pair<std::string, TimeRange>> getIstrumentTimes();
virtual std::vector<std::pair<double, std::string>> getTargetTimes();
// temporary need to figure this out
std::map<std::string, Decoder*> getTranslation(){ return _fileTranslation; };
virtual std::vector<double> getCaptureProgression(){ return _captureProgression; };
private:
void createImage(Image& image,
double startTime,
double stopTime,
std::vector<std::string> instr,
std::string targ,
std::string pot);
bool augmentWithSpice(Image& image,
std::string spacecraft,
std::vector<std::string> payload,
std::vector<std::string> potentialTargets);
std::string _fileName;
std::string _spacecraft;
std::map<std::string, Decoder*> _fileTranslation;
std::vector<std::string> _specsOfInterest;
//returnable
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;
};
}
#endif //__LABELPARSER_H__
@@ -22,19 +22,18 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __CAMERAINSTRUMENT_H__
#define __CAMERAINSTRUMENT_H__
#include <openspace/util/payload.h>
#ifndef __SCANNERDECODER_H__
#define __SCANNERDECODER_H__
#include <openspace/util/decoder.h>
#include <openspace/util/powerscaledcoordinate.h>
namespace openspace {
class CameraInstrument : public Payload {
class ScannerDecoder : public Decoder {
public:
CameraInstrument(const ghoul::Dictionary& dictionary);
virtual std::string getType();
ScannerDecoder(const ghoul::Dictionary& dictionary);
virtual std::string getDecoderType();
virtual std::vector<std::string> getSpiceIDs();
private:
std::string _type;
@@ -43,4 +42,4 @@ private:
} // namespace openspace
#endif // __CAMERAINSTRUMENT_H__
#endif // __SCANNERDECODER_H__
+11 -8
View File
@@ -25,9 +25,8 @@
#ifndef __SEQUENCEPARSER_H__
#define __SEQUENCEPARSER_H__
#include <openspace/util/sequenceparser.h>
#include <openspace/util/hongkangparser.h>
#include <openspace/util/payload.h>
#include <openspace/util/decoder.h>
#include <map>
#include <string>
@@ -45,12 +44,15 @@ namespace openspace {
struct TimeRange{
TimeRange() : _min(-1), _max(-1){};
void setRange(double val){
if (_min > val || _min < 0) _min = val;
if (_max < val || _max < 0) _max = 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;
};
@@ -63,9 +65,10 @@ class SequenceParser{
public:
virtual void create() = 0;
virtual std::map<std::string, ImageSubset> getSubsetMap() = 0;
virtual std::vector<std::pair<double, std::string>> getIstrumentTimes() = 0;
virtual std::vector<std::pair<std::string, TimeRange>> getIstrumentTimes() = 0;
virtual std::vector<std::pair<double, std::string>> getTargetTimes() = 0;
virtual std::map<std::string, Payload*> getAcronymDictionary() = 0;
virtual std::map<std::string, Decoder*> getTranslation() = 0;
virtual std::vector<double> getCaptureProgression() = 0;
};
}
#endif //__SEQUENCEPARSER_H__
#endif //__SEQUENCEPARSER_H__
+46
View File
@@ -0,0 +1,46 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* 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 __TARGETDECODER_H__
#define __TARGETDECODER_H__
#include <openspace/util/decoder.h>
#include <openspace/util/powerscaledcoordinate.h>
namespace openspace {
class TargetDecoder : public Decoder {
public:
TargetDecoder(const ghoul::Dictionary& dictionary);
virtual std::string getDecoderType();
virtual std::vector<std::string> getTranslation();
private:
std::string _type;
std::vector<std::string> _names;
};
} // namespace openspace
#endif // __TARGETDECODER_H__