mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-09 14:58:37 -05:00
Merge branch 'feature/timelinegui' into develop
This commit is contained in:
@@ -40,6 +40,7 @@ namespace openspace {
|
||||
|
||||
class ConfigurationManager;
|
||||
class LuaConsole;
|
||||
class NetworkEngine;
|
||||
class GUI;
|
||||
class RenderEngine;
|
||||
class SyncBuffer;
|
||||
@@ -68,6 +69,7 @@ public:
|
||||
interaction::InteractionHandler* interactionHandler();
|
||||
RenderEngine* renderEngine();
|
||||
scripting::ScriptEngine* scriptEngine();
|
||||
NetworkEngine* networkEngine();
|
||||
LuaConsole* console();
|
||||
|
||||
gui::GUI* gui();
|
||||
@@ -111,6 +113,7 @@ private:
|
||||
interaction::InteractionHandler* _interactionHandler;
|
||||
RenderEngine* _renderEngine;
|
||||
scripting::ScriptEngine* _scriptEngine;
|
||||
NetworkEngine* _networkEngine;
|
||||
ghoul::cmdparser::CommandlineParser* _commandlineParser;
|
||||
LuaConsole* _console;
|
||||
gui::GUI* _gui;
|
||||
|
||||
76
include/openspace/network/networkengine.h
Normal file
76
include/openspace/network/networkengine.h
Normal 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 __NETWORKENGINE_H__
|
||||
#define __NETWORKENGINE_H__
|
||||
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class NetworkEngine {
|
||||
public:
|
||||
typedef uint16_t MessageIdentifier;
|
||||
|
||||
NetworkEngine();
|
||||
|
||||
// Receiving messages
|
||||
bool handleMessage(const std::string& message);
|
||||
|
||||
// Sending messages
|
||||
void publishStatusMessage();
|
||||
void publishIdentifierMappingMessage();
|
||||
void publishMessage(MessageIdentifier identifier, std::vector<char> message);
|
||||
void sendMessages();
|
||||
|
||||
// Initial Connection Messages
|
||||
void setInitialConnectionMessage(MessageIdentifier identifier, std::vector<char> message);
|
||||
void sendInitialInformation();
|
||||
|
||||
// Background
|
||||
MessageIdentifier identifier(std::string name);
|
||||
private:
|
||||
std::map<MessageIdentifier, std::string> _identifiers;
|
||||
MessageIdentifier _lastAssignedIdentifier;
|
||||
|
||||
struct Message {
|
||||
MessageIdentifier identifer;
|
||||
std::vector<char> body;
|
||||
};
|
||||
std::vector<Message> _messagesToSend;
|
||||
|
||||
std::vector<Message> _initialConnectionMessages;
|
||||
|
||||
|
||||
|
||||
MessageIdentifier _statusMessageIdentifier;
|
||||
MessageIdentifier _identifierMappingIdentifier;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __NETWORKENGINE_H__
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
virtual void deinitialize();
|
||||
void render();
|
||||
virtual bool loadModel(const std::string& filename) = 0;
|
||||
void changeRenderMode(const GLenum mode);
|
||||
|
||||
protected:
|
||||
RenderableModel* _parent;
|
||||
@@ -59,6 +60,7 @@ protected:
|
||||
GLuint _vaoID;
|
||||
GLuint _vbo;
|
||||
GLuint _ibo;
|
||||
GLenum _mode;
|
||||
|
||||
std::vector<Vertex> _vertices;
|
||||
std::vector<int> _indices;
|
||||
|
||||
@@ -57,6 +57,8 @@ protected:
|
||||
|
||||
private:
|
||||
properties::StringProperty _colorTexturePath;
|
||||
properties::BoolProperty _performFade;
|
||||
properties::FloatProperty _fading;
|
||||
ghoul::opengl::ProgramObject* _programObject;
|
||||
ghoul::opengl::Texture* _texture;
|
||||
|
||||
@@ -69,6 +71,7 @@ private:
|
||||
std::string _destination;
|
||||
std::string _target;
|
||||
|
||||
bool _isGhost;
|
||||
|
||||
psc _sunPosition;
|
||||
|
||||
|
||||
@@ -64,15 +64,17 @@ private:
|
||||
properties::StringProperty _colorTexturePath;
|
||||
ghoul::opengl::ProgramObject* _programObject;
|
||||
ghoul::opengl::Texture* _texture;
|
||||
ghoul::opengl::Texture* _nightTexture;
|
||||
planetgeometry::PlanetGeometry* _geometry;
|
||||
properties::BoolProperty _performShading;
|
||||
properties::IntProperty _rotation;
|
||||
float _alpha;
|
||||
|
||||
glm::dmat3 _stateMatrix;
|
||||
|
||||
std::string _nightTexturePath;
|
||||
std::string _frame;
|
||||
std::string _target;
|
||||
bool _hasNightTexture;
|
||||
double _time;
|
||||
};
|
||||
|
||||
|
||||
@@ -28,7 +28,13 @@
|
||||
|
||||
// open space includes
|
||||
#include <openspace/rendering/renderable.h>
|
||||
#include <openspace/util/imagesequencer.h>
|
||||
#include <openspace/util/imagesequencer2.h>
|
||||
|
||||
#include <openspace/util/sequenceparser.h>
|
||||
#include <openspace/util/hongkangparser.h>
|
||||
#include <openspace/util/labelparser.h>
|
||||
#include <openspace/util/decoder.h>
|
||||
|
||||
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/properties/triggerproperty.h>
|
||||
@@ -71,15 +77,18 @@ protected:
|
||||
private:
|
||||
void imageProjectGPU();
|
||||
|
||||
std::map<std::string, Decoder*> _fileTranslation;
|
||||
|
||||
properties::StringProperty _colorTexturePath;
|
||||
properties::StringProperty _projectionTexturePath;
|
||||
properties::TriggerProperty _imageTrigger;
|
||||
properties::IntProperty _rotation;
|
||||
properties::FloatProperty _fadeProjection;
|
||||
|
||||
ghoul::opengl::ProgramObject* _programObject;
|
||||
ghoul::opengl::ProgramObject* _fboProgramObject;
|
||||
|
||||
ghoul::opengl::Texture* _texture;
|
||||
ghoul::opengl::Texture* _textureOriginal;
|
||||
ghoul::opengl::Texture* _textureProj;
|
||||
planetgeometryprojection::PlanetGeometryProjection* _geometry;
|
||||
|
||||
@@ -88,12 +97,19 @@ private:
|
||||
glm::mat4 _transform;
|
||||
glm::mat4 _projectorMatrix;
|
||||
|
||||
//sequenceloading
|
||||
std::string _sequenceSource;
|
||||
std::string _sequenceType;
|
||||
bool _foundSequence;
|
||||
|
||||
// spice
|
||||
std::string _instrumentID;
|
||||
std::string _projectorID;
|
||||
std::string _projecteeID;
|
||||
std::string _aberration;
|
||||
std::vector<std::string> _potentialTargets; // @TODO copy-n-paste from renderablefov
|
||||
|
||||
|
||||
float _fovy;
|
||||
float _aspectRatio;
|
||||
float _nearPlane;
|
||||
@@ -103,18 +119,27 @@ private:
|
||||
glm::dmat3 _instrumentMatrix;
|
||||
glm::vec3 _boresight;
|
||||
|
||||
double _time[2];
|
||||
double _time;
|
||||
double _previousTime;
|
||||
double _previousCapture;
|
||||
double lightTime;
|
||||
|
||||
std::vector<Image> _imageTimes;
|
||||
int _sequenceID;
|
||||
|
||||
std::string _target;
|
||||
std::string _frame;
|
||||
std::string _defaultProjImage;
|
||||
std::string _next;
|
||||
|
||||
bool _capture;
|
||||
|
||||
// FBO stuff
|
||||
GLuint _fboID;
|
||||
GLuint _quad;
|
||||
GLuint _vertexPositionBuffer;
|
||||
|
||||
bool _once; //fml
|
||||
};
|
||||
} // namespace openspace
|
||||
|
||||
|
||||
@@ -69,8 +69,13 @@ public:
|
||||
virtual void update(const UpdateData& data);
|
||||
|
||||
bool isVisible() const;
|
||||
|
||||
bool hasTimeInterval();
|
||||
bool getInterval(double& start, double& end);
|
||||
|
||||
bool hasBody();
|
||||
bool getBody(std::string& body);
|
||||
void setBody(std::string& body);
|
||||
|
||||
protected:
|
||||
std::string findPath(const std::string& path);
|
||||
@@ -83,6 +88,8 @@ private:
|
||||
std::string _relativePath;
|
||||
std::string _startTime;
|
||||
std::string _endTime;
|
||||
std::string _targetBody;
|
||||
bool _hasBody;
|
||||
bool _hasTimeInterval;
|
||||
};
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ public:
|
||||
|
||||
private:
|
||||
properties::FloatProperty _lineWidth;
|
||||
properties::BoolProperty _drawSolid;
|
||||
ghoul::opengl::ProgramObject* _programObject;
|
||||
ghoul::opengl::Texture* _texture;
|
||||
openspace::SceneGraphNode* _targetNode;
|
||||
@@ -76,9 +77,9 @@ public:
|
||||
int _nrInserted = 0;
|
||||
int _isteps;
|
||||
bool _rebuild = false;
|
||||
bool _interceptTag[5];
|
||||
bool _interceptTag[9];
|
||||
bool _withinFOV;
|
||||
psc _projectionBounds[4];
|
||||
psc _projectionBounds[8];
|
||||
psc _interceptVector;
|
||||
|
||||
// spice
|
||||
@@ -124,59 +125,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;
|
||||
}
|
||||
*/
|
||||
|
||||
98
include/openspace/rendering/renderableplaneprojection.h
Normal file
98
include/openspace/rendering/renderableplaneprojection.h
Normal file
@@ -0,0 +1,98 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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 _RENDERABLEPLANEPROJECTION_H_
|
||||
#define _RENDERABLEPLANEPROJECTION_H_
|
||||
|
||||
#include <openspace/rendering/renderable.h>
|
||||
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/util/imagesequencer2.h>
|
||||
#include <openspace/properties/vectorproperty.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
|
||||
namespace ghoul {
|
||||
namespace filesystem {
|
||||
class File;
|
||||
}
|
||||
namespace opengl {
|
||||
class ProgramObject;
|
||||
class Texture;
|
||||
}
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
struct LinePoint;
|
||||
|
||||
struct target {
|
||||
std::string body;
|
||||
std::string frame;
|
||||
std::string node;
|
||||
};
|
||||
|
||||
class RenderablePlaneProjection : public Renderable {
|
||||
|
||||
|
||||
public:
|
||||
RenderablePlaneProjection(const ghoul::Dictionary& dictionary);
|
||||
~RenderablePlaneProjection();
|
||||
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
|
||||
bool isReady() const override;
|
||||
|
||||
void render(const RenderData& data) override;
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
private:
|
||||
void loadTexture();
|
||||
void updatePlane(const Image* img, double currentTime);
|
||||
std::string findClosestTarget(double currentTime);
|
||||
void setTarget(std::string body);
|
||||
|
||||
std::string _texturePath;
|
||||
|
||||
bool _planeIsDirty;
|
||||
|
||||
glm::dmat3 _stateMatrix;
|
||||
std::string _frame;
|
||||
|
||||
ghoul::opengl::ProgramObject* _shader;
|
||||
bool _programIsDirty;
|
||||
bool _textureIsDirty;
|
||||
ghoul::opengl::Texture* _texture;
|
||||
ghoul::filesystem::File* _textureFile;
|
||||
GLuint _quad;
|
||||
GLuint _vertexPositionBuffer;
|
||||
std::string _spacecraft;
|
||||
std::string _instrument;
|
||||
|
||||
target _target;
|
||||
std::string _name;
|
||||
bool _moving;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
#endif
|
||||
@@ -63,6 +63,7 @@ private:
|
||||
properties::Vec3Property _lineColor;
|
||||
properties::FloatProperty _lineFade;
|
||||
properties::FloatProperty _lineWidth;
|
||||
properties::BoolProperty _showTimestamps;
|
||||
|
||||
ghoul::opengl::ProgramObject* _programObject;
|
||||
bool _programIsDirty;
|
||||
@@ -86,6 +87,8 @@ private:
|
||||
|
||||
float _increment;
|
||||
float _oldTime = 0;
|
||||
float _time;
|
||||
float _distanceFade;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
46
include/openspace/scene/dynamicephemeris.h
Normal file
46
include/openspace/scene/dynamicephemeris.h
Normal 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 __DYNAMICEPHEMERIS_H__
|
||||
#define __DYNAMICEPHEMERIS_H__
|
||||
|
||||
#include "ephemeris.h"
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class DynamicEphemeris: public Ephemeris {
|
||||
public:
|
||||
DynamicEphemeris(const ghoul::Dictionary& dictionary
|
||||
= ghoul::Dictionary());
|
||||
virtual ~DynamicEphemeris();
|
||||
virtual const psc& position() const;
|
||||
virtual void update(const UpdateData& data) override;
|
||||
void setPosition(psc pos);
|
||||
private:
|
||||
psc _position;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __DYNAMICEPHEMERIS_H__
|
||||
@@ -65,10 +65,10 @@ public:
|
||||
void render(const RenderData& data);
|
||||
void updateCamera(Camera* camera) const;
|
||||
|
||||
void addNode(SceneGraphNode* child);
|
||||
//void addNode(SceneGraphNode* child);
|
||||
|
||||
void setParent(SceneGraphNode* parent);
|
||||
bool abandonChild(SceneGraphNode* child);
|
||||
//bool abandonChild(SceneGraphNode* child);
|
||||
|
||||
const psc& position() const;
|
||||
psc worldPosition() const;
|
||||
|
||||
@@ -42,6 +42,8 @@ private:
|
||||
std::string _originName;
|
||||
psc _position;
|
||||
bool _kernelsLoadedSuccessfully;
|
||||
std::string _ghosting;
|
||||
std::string _name;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -89,6 +89,15 @@ namespace renderablemodel {
|
||||
const std::string keyGeometry = "Geometry";
|
||||
} // namespace renderablemodel
|
||||
|
||||
namespace renderableplaneprojection {
|
||||
const std::string keySpacecraft = "Spacecraft";
|
||||
const std::string keyInstrument = "Instrument";
|
||||
const std::string keyMoving = "Moving";
|
||||
const std::string keyTexture = "Texture";
|
||||
const std::string keyName = "Name";
|
||||
const std::string galacticFrame = "GALACTIC";
|
||||
} // namespace renderableplaneprojection
|
||||
|
||||
namespace renderablestars {
|
||||
const std::string keyFile = "File";
|
||||
const std::string keyTexture = "Texture";
|
||||
@@ -122,6 +131,10 @@ namespace staticephemeris {
|
||||
const std::string keyPosition = "Position";
|
||||
} // namespace staticephemeris
|
||||
|
||||
namespace dynamicephemeris {
|
||||
const std::string keyPosition = "Position";
|
||||
} // namespace dynamicephemeris
|
||||
|
||||
namespace spiceephemeris {
|
||||
const std::string keyBody = "Body";
|
||||
const std::string keyOrigin = "Observer";
|
||||
|
||||
47
include/openspace/util/decoder.h
Normal file
47
include/openspace/util/decoder.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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 __DECODER_H__
|
||||
#define __DECODER_H__
|
||||
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class Decoder {
|
||||
public:
|
||||
static Decoder* createFromDictionary(const ghoul::Dictionary& dictionary, const std::string type);
|
||||
|
||||
Decoder(const ghoul::Dictionary& dictionary);
|
||||
virtual ~Decoder();
|
||||
virtual std::string getDecoderType() = 0;
|
||||
virtual std::vector<std::string> getTranslation() = 0;
|
||||
protected:
|
||||
Decoder();
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __DECODER_H__
|
||||
86
include/openspace/util/hongkangparser.h
Normal file
86
include/openspace/util/hongkangparser.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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 __HONGKANGPARSER_H__
|
||||
#define __HONGKANGPARSER_H__
|
||||
#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,
|
||||
ghoul::Dictionary dictionary,
|
||||
std::vector<std::string> potentialTargets);
|
||||
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
|
||||
virtual std::map<std::string, Decoder*> getTranslation(){ return _fileTranslation; };
|
||||
virtual std::vector<double> getCaptureProgression();
|
||||
|
||||
private:
|
||||
double getMetFromET(double et);
|
||||
double getETfromMet(std::string timestr);
|
||||
double getETfromMet(double met);
|
||||
|
||||
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);
|
||||
void sendPlaybookInformation();
|
||||
|
||||
std::string _defaultCaptureImage;
|
||||
double _metRef = 299180517;
|
||||
|
||||
std::string _fileName;
|
||||
std::string _spacecraft;
|
||||
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;
|
||||
};
|
||||
|
||||
}
|
||||
#endif //__HONGKANGPARSER_H__
|
||||
@@ -37,43 +37,102 @@ namespace openspace {
|
||||
class ImageSequencer {
|
||||
public:
|
||||
ImageSequencer();
|
||||
|
||||
/**
|
||||
* Singelton instantiation
|
||||
*/
|
||||
static ImageSequencer& ref();
|
||||
bool loadSequence(const std::string& dir);
|
||||
|
||||
bool parsePlaybook(const std::string& dir, const std::string& type, std::string year = "2015");
|
||||
bool parsePlaybookFile(const std::string& fileName, std::string year = "2015");
|
||||
|
||||
void testStartTimeMap();
|
||||
|
||||
static void initialize();
|
||||
static void deinitialize();
|
||||
bool sequenceReset();
|
||||
|
||||
bool getImagePath(double& _currentTime, std::string& path, bool closedInterval = false);
|
||||
/**
|
||||
* Updates current time and initializes the previous time member
|
||||
*/
|
||||
void update(double initTime);
|
||||
|
||||
/**
|
||||
* When the a projectable class loads its sequence it also has to request an ID
|
||||
* which is set by reference and returned to the projectable. This ID is later
|
||||
* used to access whatever data ImageSequencer loads.
|
||||
*/
|
||||
void setSequenceId(int& id);
|
||||
|
||||
//bool sequenceReset();
|
||||
|
||||
/**
|
||||
* Based on sequenceID and unique projectee name, the ImageSequencer determines which subset of data is to be filled to _imageTimes
|
||||
* which can be used in a projecable class for projections.
|
||||
*/
|
||||
bool getImagePath(std::vector<std::pair<double, std::string>>& _imageTimes, int sequenceID, std::string projectee, bool withinFOV);
|
||||
|
||||
/*
|
||||
* Returns the time until next capture in seconds.
|
||||
*
|
||||
*/
|
||||
double getNextCaptureTime();
|
||||
double getIntervalLength(){ return _intervalLength; };
|
||||
std::string& getActiveInstrument(){ return _activeInstrument; };
|
||||
std::string findActiveInstrument(double time);
|
||||
|
||||
/*
|
||||
* Returns the time until next capture in seconds.
|
||||
*/
|
||||
double getIntervalLength(){ return _intervalLength; };
|
||||
|
||||
/*
|
||||
* Returns next active instrument
|
||||
*/
|
||||
std::string& getActiveInstrument(){ return _activeInstrument; };
|
||||
|
||||
/*
|
||||
* Performs search to find next consective instrument thats active
|
||||
*/
|
||||
std::string findActiveInstrument(double time, int sequenceID);
|
||||
|
||||
/*
|
||||
* Performs search to find next consecutive projection image.
|
||||
*/
|
||||
double nextCaptureTime(double _time, int sequenceID);
|
||||
|
||||
/*
|
||||
* Load (from *.fit converted) jpg image sequence based on corresponding *.lbl header files
|
||||
*/
|
||||
bool loadSequence(const std::string& dir, int& sequenceID);
|
||||
/*
|
||||
* Load sequence file of either *.csv type (excel) or preparsed *.txt type
|
||||
*/
|
||||
bool parsePlaybook(const std::string& dir, const std::string& type, std::string year = "2015");
|
||||
bool parsePlaybookFile(const std::string& fileName, int& sequenceID, std::string year = "2015");
|
||||
/*
|
||||
* These three methods augment the playbook
|
||||
*/
|
||||
void augumentSequenceWithTargets(int sequenceID);
|
||||
void addSequenceObserver(int sequenceID, std::string name, std::vector<std::string> payload);
|
||||
void registerTargets(std::vector<std::string>& potential);
|
||||
|
||||
|
||||
static ImageSequencer* _sequencer;
|
||||
|
||||
protected:
|
||||
|
||||
bool getMultipleImages(std::vector<std::pair<double, std::string>>& _imageTimes, int sequenceID, std::string projectee);
|
||||
bool getSingleImage(std::vector<std::pair<double, std::string>>& _imageTimes, int sequenceID, std::string projectee);
|
||||
|
||||
private:
|
||||
|
||||
double getMissionElapsedTime(std::string timestr);
|
||||
|
||||
double nextCaptureTime(double _time);
|
||||
std::map<std::string, double> _projectableTargets;
|
||||
std::map <int, std::string> _observers;
|
||||
std::map <std::string, std::vector<std::string>> _instruments;
|
||||
|
||||
void createImage(double t1, double t2, std::string instrument, std::string path = "dummypath");
|
||||
|
||||
double _nextCapture;
|
||||
double _intervalLength;
|
||||
double _metRef = 299180517;
|
||||
|
||||
double _currentTime;
|
||||
int _sequenceIDs;
|
||||
|
||||
std::string _defaultCaptureImage;
|
||||
std::string _activeInstrument;
|
||||
|
||||
bool _targetsAdded;
|
||||
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
205
include/openspace/util/imagesequencer2.h
Normal file
205
include/openspace/util/imagesequencer2.h
Normal file
@@ -0,0 +1,205 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* 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 __ImageSequencer2_H__
|
||||
#define __ImageSequencer2_H__
|
||||
|
||||
// open space includes
|
||||
#include <ghoul/opengl/ghoul_gl.h>
|
||||
#include <openspace/util/powerscaledcoordinate.h>
|
||||
#include <openspace/util/powerscaledscalar.h>
|
||||
#include <unordered_map>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include <openspace/util/sequenceparser.h>
|
||||
|
||||
namespace openspace {
|
||||
/**
|
||||
* The ImageSequencer singleton main function is to manage the timekeeping and
|
||||
* distribution of large image data-sets across all openspace renderable instances,
|
||||
* both for past and future unmanned-spacecraft missions. To load the instance with
|
||||
* data the client must provide a parser inherited from the abstract base class
|
||||
* SequenceParser. Hence, there is no restriction imposed on data input, whether its
|
||||
* data in the form of existing images or in the form of a planned observation schedule.
|
||||
* Notably, in order for the sequencer to function the client must provide or write a
|
||||
* parser that fills the ImageSequencers private members.
|
||||
* \see SequenceParser
|
||||
* \see ImageSequencer2::runSequenceParser(SequenceParser* parser)
|
||||
* std::map<std::string, bool>
|
||||
*/
|
||||
class ImageSequencer2 {
|
||||
public:
|
||||
ImageSequencer2();
|
||||
/**
|
||||
* Singelton instantiation
|
||||
*/
|
||||
static ImageSequencer2* _instance;
|
||||
/**
|
||||
* Returns the reference to the singleton ImageSequencer object that must have been
|
||||
* initialized by a call to the initialize method earlier.
|
||||
* \return The ImageSequencer singleton
|
||||
*/
|
||||
static ImageSequencer2& ref();
|
||||
/**
|
||||
* Initializer that initializes the static member.
|
||||
*/
|
||||
static void initialize();
|
||||
/**
|
||||
* Deinitializes that deinitializes the static member.
|
||||
*/
|
||||
static void deinitialize();
|
||||
/**
|
||||
* Returns true if sequencer has been loaded with data.
|
||||
*/
|
||||
bool isReady();
|
||||
|
||||
/**
|
||||
* Updates sequencer with current <code>time</code>. This is used internally for keeping
|
||||
* track of both current simulation time and the time of the previously rendered frame.
|
||||
*/
|
||||
void updateSequencer(double time);
|
||||
/**
|
||||
* Runs parser and recieves the datastructures filled by it.
|
||||
* \see SequenceParser
|
||||
*/
|
||||
void runSequenceParser(SequenceParser* parser);
|
||||
|
||||
/**
|
||||
* Retrieves the next upcoming target in time.
|
||||
*/
|
||||
std::pair<double, std::string> getNextTarget();
|
||||
|
||||
/**
|
||||
* Retrieves the most current target in time.
|
||||
*/
|
||||
std::pair<double, std::string> getCurrentTarget();
|
||||
|
||||
/**
|
||||
* Retrieves current target and (in the list) adjacent targets, the number to retrieve is user set
|
||||
*/
|
||||
std::pair<double, std::vector<std::string>> getIncidentTargetList(int range = 2);
|
||||
|
||||
/**
|
||||
* Retrieves the next upcoming time of image capture.
|
||||
*/
|
||||
double getNextCaptureTime();
|
||||
|
||||
/**
|
||||
* Retrieves the time interval length between the current time and an upcoming capture.
|
||||
*/
|
||||
double getIntervalLength();
|
||||
|
||||
/*
|
||||
* Returns a map with key instrument names whose value indicate whether
|
||||
* an instrument is active or not.
|
||||
*/
|
||||
std::map<std::string, bool> getActiveInstruments();
|
||||
|
||||
/*
|
||||
* Retrieves the relevant data from a specific subset based on the what instance
|
||||
* makes the request. If an instance is not registered in the class then the singleton
|
||||
* returns false and no projections will occur.
|
||||
*/
|
||||
bool ImageSequencer2::getImagePaths(std::vector<Image>& captures,
|
||||
std::string projectee,
|
||||
std::string instrumentID);
|
||||
|
||||
bool ImageSequencer2::getImagePaths(std::vector<Image>& captures,
|
||||
std::string projectee);
|
||||
|
||||
/*
|
||||
* returns true if instrumentID is within a capture range.
|
||||
*/
|
||||
bool instumentActive(std::string instrumentID);
|
||||
/*
|
||||
* returns latest captured image
|
||||
*/
|
||||
const Image* getLatestImageForInstrument(const std::string _instrumentID);
|
||||
private:
|
||||
void sortData();
|
||||
|
||||
/*
|
||||
* _fileTranslation handles any types of ambiguities between the data and
|
||||
* spice/openspace -calls. This map is composed of a key that is a string in
|
||||
* the data to be translated and a Decoder that holds the corresponding
|
||||
* translation provided through a modfile.
|
||||
* \see Decoder
|
||||
* \see (projection mod files)
|
||||
*/
|
||||
std::map<std::string, Decoder*> _fileTranslation;
|
||||
|
||||
/*
|
||||
* This is the main container of image data. The key is the target name,
|
||||
* the value is a subset of images.
|
||||
* \see SequenceParser
|
||||
*/
|
||||
std::map<std::string, ImageSubset> _subsetMap;
|
||||
|
||||
/*
|
||||
* In order for the simulation to know when to turn on/off any instrument within
|
||||
* all instruments in the spacecraft payload, the key is the data-file given
|
||||
* instrument name.
|
||||
*/
|
||||
std::map<std::string, bool> _switchingMap;
|
||||
|
||||
/*
|
||||
* This datastructure holds the specific times when the spacecraft switches from
|
||||
* observing one inertial body to the next. This happens a lot in such missions
|
||||
* and the coupling of target with specific time is usually therefore not 1:1.
|
||||
*/
|
||||
std::vector<std::pair<double, std::string>> _targetTimes;
|
||||
|
||||
/*
|
||||
* Holds the time ranges of each instruments on and off periods. An instrument
|
||||
* rendering class may ask the ImageSequencer whether or not it
|
||||
*/
|
||||
std::vector<std::pair<std::string, TimeRange>> _instrumentTimes;
|
||||
|
||||
/*
|
||||
* Each consecutive images capture time, for easier traversal.
|
||||
*/
|
||||
std::vector<double> _captureProgression;
|
||||
|
||||
// current simulation time
|
||||
double _currentTime;
|
||||
// simulation time of previous frame
|
||||
double _previousTime;
|
||||
// time between current simulation time and an upcoming capture
|
||||
double _intervalLength;
|
||||
// next consecutive capture in time
|
||||
double _nextCapture;
|
||||
// default capture image
|
||||
std::string _defaultCaptureImage;
|
||||
|
||||
Image* _latestImage;
|
||||
// if no data, no run
|
||||
bool _hasData;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
|
||||
#endif // __ImageSequencer2_H__
|
||||
|
||||
48
include/openspace/util/instrumentdecoder.h
Normal file
48
include/openspace/util/instrumentdecoder.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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 __INSTRUMENTDECODER_H__
|
||||
#define __INSTRUMENTDECODER_H__
|
||||
|
||||
#include <openspace/util/decoder.h>
|
||||
|
||||
#include <openspace/util/powerscaledcoordinate.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class InstrumentDecoder : public Decoder {
|
||||
public:
|
||||
InstrumentDecoder(const ghoul::Dictionary& dictionary);
|
||||
virtual std::string getDecoderType();
|
||||
virtual std::vector<std::string> getTranslation();
|
||||
std::string getStopCommand();
|
||||
private:
|
||||
std::string _type;
|
||||
std::string _stopCommand;
|
||||
std::vector<std::string> _spiceIDs;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __INSTRUMENTDECODER_H__
|
||||
87
include/openspace/util/labelparser.h
Normal file
87
include/openspace/util/labelparser.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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 path);
|
||||
|
||||
std::string decode(std::string line);
|
||||
std::string encode(std::string line);
|
||||
|
||||
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;
|
||||
|
||||
|
||||
std::string _target;
|
||||
std::string _instrumentID;
|
||||
std::string _instrumentHostID;
|
||||
std::string _detectorType;
|
||||
std::string _sequenceID;
|
||||
double _startTime;
|
||||
double _stopTime;
|
||||
};
|
||||
}
|
||||
#endif //__LABELPARSER_H__
|
||||
48
include/openspace/util/scannerdecoder.h
Normal file
48
include/openspace/util/scannerdecoder.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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 __SCANNERDECODER_H__
|
||||
#define __SCANNERDECODER_H__
|
||||
|
||||
#include <openspace/util/decoder.h>
|
||||
#include <openspace/util/powerscaledcoordinate.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class ScannerDecoder : public Decoder {
|
||||
public:
|
||||
ScannerDecoder(const ghoul::Dictionary& dictionary);
|
||||
virtual std::string getDecoderType();
|
||||
virtual std::vector<std::string> getSpiceIDs();
|
||||
std::string getStopCommand();
|
||||
void setStopCommand(std::string stopCommand);
|
||||
private:
|
||||
std::string _type;
|
||||
std::string _abort;
|
||||
std::vector<std::string> _spiceIDs;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __SCANNERDECODER_H__
|
||||
74
include/openspace/util/sequenceparser.h
Normal file
74
include/openspace/util/sequenceparser.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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 __SEQUENCEPARSER_H__
|
||||
#define __SEQUENCEPARSER_H__
|
||||
#include <openspace/util/decoder.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 SequenceParser{
|
||||
public:
|
||||
virtual void create() = 0;
|
||||
virtual std::map<std::string, ImageSubset> getSubsetMap() = 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, Decoder*> getTranslation() = 0;
|
||||
virtual std::vector<double> getCaptureProgression() = 0;
|
||||
};
|
||||
}
|
||||
#endif //__SEQUENCEPARSER_H__
|
||||
@@ -630,6 +630,22 @@ public:
|
||||
*/
|
||||
bool getFieldOfView(int instrument, std::string& fovShape, std::string& frameName,
|
||||
glm::dvec3& boresightVector, std::vector<glm::dvec3>& bounds) const;
|
||||
|
||||
/**
|
||||
* This function adds a frame to a body
|
||||
* \param body - the name of the body
|
||||
* \param frame - the name of the frame
|
||||
* \return false if the arguments are empty
|
||||
*/
|
||||
bool addFrame(const std::string body, const std::string frame);
|
||||
|
||||
/**
|
||||
* This function returns the frame of a body if defined, otherwise it returns
|
||||
* IAU_ + body (most frames are known by the International Astronomical Union)
|
||||
* \param body - the name of the body
|
||||
* \return the frame of the body
|
||||
*/
|
||||
std::string frameFromBody(const std::string body) const;
|
||||
|
||||
/**
|
||||
* This method checks if one of the previous SPICE methods has failed. If it has, the
|
||||
@@ -673,6 +689,10 @@ private:
|
||||
std::map<int, std::vector< std::pair<double, double> > > _spkIntervals;
|
||||
std::map<int, std::set<double> > _ckCoverageTimes;
|
||||
std::map<int, std::set<double> > _spkCoverageTimes;
|
||||
// Vector of pairs: Body, Frame
|
||||
std::vector< std::pair<std::string, std::string> > _frameByBody;
|
||||
|
||||
const static bool _showErrors = false;
|
||||
|
||||
/// The last assigned kernel-id, used to determine the next free kernel id
|
||||
KernelIdentifier _lastAssignedKernel;
|
||||
|
||||
46
include/openspace/util/targetdecoder.h
Normal file
46
include/openspace/util/targetdecoder.h
Normal 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__
|
||||
@@ -51,7 +51,7 @@ namespace openspace {
|
||||
* equal to the frame time.
|
||||
*/
|
||||
|
||||
class SyncBuffer;
|
||||
class SyncBuffer;
|
||||
|
||||
class Time {
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user