mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-08 04:20:14 -05:00
Merge branch 'master' of github.com:OpenSpace/OpenSpace into feature/data-management
This commit is contained in:
@@ -64,7 +64,7 @@ public:
|
||||
LightTime, ///< One-way light time (<code>LT</code>)
|
||||
LightTimeStellar, ///< One-way light time and stellar (<code>LT+S</code>)
|
||||
ConvergedNewtonian, ///< Converged newtonian light time (<code>CN</code>)
|
||||
ConvergedNewtonianStellar ///< Converged newtonian + stellar (<code>CN+S</code>)
|
||||
ConvergedNewtonianStellar ///< Converged newtonian+stellar (<code>CN+S</code>)
|
||||
};
|
||||
/// The direction of the aberration correct
|
||||
enum class Direction {
|
||||
@@ -896,7 +896,8 @@ private:
|
||||
* position will be retrieved. If the coverage has ended, the last position will be
|
||||
* retrieved. If \p time is in a coverage gap, the position will be interpolated.
|
||||
* \param target The body which is missing SPK data for this time
|
||||
* \param observer The observer. The position will be retrieved in relation to this body
|
||||
* \param observer The observer. The position will be retrieved in relation to this
|
||||
* body
|
||||
* \param referenceFrame The reference frame of the output position vector
|
||||
* \param aberrationCorrection The aberration correction used for the position
|
||||
* calculation
|
||||
|
||||
@@ -52,7 +52,11 @@ public:
|
||||
ghoul_assert(_encodeOffset + size < _n, "");
|
||||
|
||||
int32_t length = static_cast<int32_t>(s.length());
|
||||
memcpy(_dataStream.data() + _encodeOffset, reinterpret_cast<const char*>(&length), sizeof(int32_t));
|
||||
memcpy(
|
||||
_dataStream.data() + _encodeOffset,
|
||||
reinterpret_cast<const char*>(&length),
|
||||
sizeof(int32_t)
|
||||
);
|
||||
_encodeOffset += sizeof(int32_t);
|
||||
memcpy(_dataStream.data() + _encodeOffset, s.c_str(), length);
|
||||
_encodeOffset += length;
|
||||
@@ -69,7 +73,11 @@ public:
|
||||
|
||||
std::string decode() {
|
||||
int32_t length;
|
||||
memcpy(reinterpret_cast<char*>(&length), _dataStream.data() + _decodeOffset, sizeof(int32_t));
|
||||
memcpy(
|
||||
reinterpret_cast<char*>(&length),
|
||||
_dataStream.data() + _decodeOffset,
|
||||
sizeof(int32_t)
|
||||
);
|
||||
char* tmp = new char[length + 1];
|
||||
_decodeOffset += sizeof(int32_t);
|
||||
memcpy(tmp, _dataStream.data() + _decodeOffset, length);
|
||||
|
||||
@@ -33,7 +33,8 @@ namespace openspace {
|
||||
|
||||
class TaskLoader {
|
||||
public:
|
||||
std::vector<std::unique_ptr<Task>> tasksFromDictionary(const ghoul::Dictionary& dictionary);
|
||||
std::vector<std::unique_ptr<Task>> tasksFromDictionary(
|
||||
const ghoul::Dictionary& dictionary);
|
||||
std::vector<std::unique_ptr<Task>> tasksFromFile(const std::string& path);
|
||||
};
|
||||
|
||||
|
||||
@@ -64,7 +64,8 @@ public:
|
||||
void removeKeyframe(size_t id);
|
||||
void removeKeyframesBefore(double timestamp, bool inclusive = false);
|
||||
void removeKeyframesAfter(double timestamp, bool inclusive = false);
|
||||
void removeKeyframesBetween(double begin, double end, bool inclusiveBegin = false, bool inclusiveEnd = false);
|
||||
void removeKeyframesBetween(double begin, double end, bool inclusiveBegin = false,
|
||||
bool inclusiveEnd = false);
|
||||
size_t nKeyframes() const;
|
||||
const Keyframe<T>* firstKeyframeAfter(double timestamp, bool inclusive = false) const;
|
||||
const Keyframe<T>* lastKeyframeBefore(double timestamp, bool inclusive = false) const;
|
||||
|
||||
@@ -35,15 +35,30 @@ Timeline<T>::~Timeline() {}
|
||||
template <typename T>
|
||||
void Timeline<T>::addKeyframe(double timestamp, T data) {
|
||||
Keyframe<T> keyframe(++_nextKeyframeId, timestamp, data);
|
||||
auto iter = std::upper_bound(_keyframes.begin(), _keyframes.end(), keyframe, &compareKeyframeTimes);
|
||||
auto iter = std::upper_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
keyframe,
|
||||
&compareKeyframeTimes
|
||||
);
|
||||
_keyframes.insert(iter, keyframe);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void Timeline<T>::removeKeyframesAfter(double timestamp, bool inclusive) {
|
||||
auto iter = inclusive
|
||||
? std::lower_bound(_keyframes.begin(), _keyframes.end(), timestamp, &compareKeyframeTimeWithTime)
|
||||
: std::upper_bound(_keyframes.begin(), _keyframes.end(), timestamp, &compareTimeWithKeyframeTime);
|
||||
? std::lower_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
timestamp,
|
||||
&compareKeyframeTimeWithTime
|
||||
)
|
||||
: std::upper_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
timestamp,
|
||||
&compareTimeWithKeyframeTime
|
||||
);
|
||||
|
||||
_keyframes.erase(iter, _keyframes.end());
|
||||
}
|
||||
@@ -51,21 +66,53 @@ void Timeline<T>::removeKeyframesAfter(double timestamp, bool inclusive) {
|
||||
template <typename T>
|
||||
void Timeline<T>::removeKeyframesBefore(double timestamp, bool inclusive) {
|
||||
auto iter = inclusive
|
||||
? std::upper_bound(_keyframes.begin(), _keyframes.end(), timestamp, &compareTimeWithKeyframeTime)
|
||||
: std::lower_bound(_keyframes.begin(), _keyframes.end(), timestamp, &compareKeyframeTimeWithTime);
|
||||
? std::upper_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
timestamp,
|
||||
&compareTimeWithKeyframeTime
|
||||
)
|
||||
: std::lower_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
timestamp,
|
||||
&compareKeyframeTimeWithTime)
|
||||
;
|
||||
|
||||
_keyframes.erase(_keyframes.begin(), iter);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void Timeline<T>::removeKeyframesBetween(double begin, double end, bool inclusiveBegin, bool inclusiveEnd) {
|
||||
void Timeline<T>::removeKeyframesBetween(double begin, double end, bool inclusiveBegin,
|
||||
bool inclusiveEnd)
|
||||
{
|
||||
auto beginIter = inclusiveBegin
|
||||
? std::lower_bound(_keyframes.begin(), _keyframes.end(), begin, &compareKeyframeTimeWithTime)
|
||||
: std::upper_bound(_keyframes.begin(), _keyframes.end(), begin, &compareTimeWithKeyframeTime);
|
||||
? std::lower_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
begin,
|
||||
&compareKeyframeTimeWithTime
|
||||
)
|
||||
: std::upper_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
begin,
|
||||
&compareTimeWithKeyframeTime
|
||||
);
|
||||
|
||||
auto endIter = inclusiveEnd
|
||||
? std::upper_bound(beginIter, _keyframes.end(), end, &compareTimeWithKeyframeTime)
|
||||
: std::lower_bound(beginIter, _keyframes.end(), end, &compareKeyframeTimeWithTime);
|
||||
? std::upper_bound(
|
||||
beginIter,
|
||||
_keyframes.end(),
|
||||
end,
|
||||
&compareTimeWithKeyframeTime
|
||||
)
|
||||
: std::lower_bound(
|
||||
beginIter,
|
||||
_keyframes.end(),
|
||||
end,
|
||||
&compareKeyframeTimeWithTime
|
||||
);
|
||||
|
||||
_keyframes.erase(beginIter, endIter);
|
||||
}
|
||||
@@ -77,9 +124,14 @@ void Timeline<T>::clearKeyframes() {
|
||||
|
||||
template <typename T>
|
||||
void Timeline<T>::removeKeyframe(size_t id) {
|
||||
_keyframes.erase(std::remove_if(_keyframes.begin(), _keyframes.end(), [id] (Keyframe<T> keyframe) {
|
||||
return keyframe.id == id;
|
||||
}), _keyframes.end());
|
||||
_keyframes.erase(
|
||||
std::remove_if(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
[id] (Keyframe<T> keyframe) { return keyframe.id == id; }
|
||||
),
|
||||
_keyframes.end()
|
||||
);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@@ -88,10 +140,23 @@ size_t Timeline<T>::nKeyframes() const {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
const Keyframe<T>* Timeline<T>::firstKeyframeAfter(double timestamp, bool inclusive) const {
|
||||
const Keyframe<T>* Timeline<T>::firstKeyframeAfter(double timestamp,
|
||||
bool inclusive) const
|
||||
{
|
||||
auto it = inclusive
|
||||
? std::lower_bound(_keyframes.begin(), _keyframes.end(), timestamp, &compareKeyframeTimeWithTime)
|
||||
: std::upper_bound(_keyframes.begin(), _keyframes.end(), timestamp, &compareTimeWithKeyframeTime);
|
||||
? std::lower_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
timestamp,
|
||||
&compareKeyframeTimeWithTime
|
||||
)
|
||||
: std::upper_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
timestamp,
|
||||
&compareTimeWithKeyframeTime
|
||||
);
|
||||
|
||||
if (it == _keyframes.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -99,10 +164,23 @@ const Keyframe<T>* Timeline<T>::firstKeyframeAfter(double timestamp, bool inclus
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
const Keyframe<T>* Timeline<T>::lastKeyframeBefore(double timestamp, bool inclusive) const {
|
||||
const Keyframe<T>* Timeline<T>::lastKeyframeBefore(double timestamp,
|
||||
bool inclusive) const
|
||||
{
|
||||
auto it = inclusive
|
||||
? std::upper_bound(_keyframes.begin(), _keyframes.end(), timestamp, &compareTimeWithKeyframeTime)
|
||||
: std::lower_bound(_keyframes.begin(), _keyframes.end(), timestamp, &compareKeyframeTimeWithTime);
|
||||
? std::upper_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
timestamp,
|
||||
&compareTimeWithKeyframeTime
|
||||
)
|
||||
: std::lower_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
timestamp,
|
||||
&compareKeyframeTimeWithTime
|
||||
);
|
||||
|
||||
if (it == _keyframes.begin()) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -116,6 +194,4 @@ const std::deque<Keyframe<T>>& Timeline<T>::keyframes() const {
|
||||
return _keyframes;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -49,9 +49,11 @@ struct TimeRange {
|
||||
TimeRange(const ghoul::Dictionary& dict);
|
||||
|
||||
/**
|
||||
* \returns true if timeRange could be initialized from the dictionary, false otherwise.
|
||||
* \returns true if timeRange could be initialized from the dictionary,
|
||||
* false otherwise.
|
||||
*/
|
||||
static bool initializeFromDictionary(const ghoul::Dictionary& dict, TimeRange& timeRange);
|
||||
static bool initializeFromDictionary(const ghoul::Dictionary& dict,
|
||||
TimeRange& timeRange);
|
||||
|
||||
void include(double val);
|
||||
|
||||
|
||||
@@ -59,10 +59,12 @@ public:
|
||||
TransformationManager();
|
||||
~TransformationManager();
|
||||
|
||||
glm::dmat3 frameTransformationMatrix(const std::string& from, const std::string& to, double ephemerisTime) const;
|
||||
glm::dmat3 frameTransformationMatrix(const std::string& from, const std::string& to,
|
||||
double ephemerisTime) const;
|
||||
|
||||
private:
|
||||
glm::dmat3 kameleonTransformationMatrix(const std::string& from, const std::string& to, double ephemerisTime) const;
|
||||
glm::dmat3 kameleonTransformationMatrix(const std::string& from,
|
||||
const std::string& to, double ephemerisTime) const;
|
||||
|
||||
#ifdef OPENSPACE_MODULE_KAMELEON_ENABLED
|
||||
std::shared_ptr<ccmc::Kameleon> _kameleon;
|
||||
|
||||
Reference in New Issue
Block a user