mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-08 04:20:14 -05:00
don't parse if same index
This commit is contained in:
@@ -57,12 +57,19 @@ namespace openspace {
|
||||
}
|
||||
|
||||
glm::vec3 RadecManager::getPosForTime(double time) const {
|
||||
|
||||
if (!correctFileInterval(time)) {
|
||||
int idx = DataFileHelper::findFileIndexForCurrentTime(time, timeDoubles);
|
||||
updateRadecData(idx);
|
||||
|
||||
int index = DataFileHelper::findFileIndexForCurrentTime(time, minuteTimes);
|
||||
updateActiveMinute(index);
|
||||
|
||||
//If index is same as previous, don't parse the data again
|
||||
if(idx != prevIndex){
|
||||
prevIndex = idx;
|
||||
|
||||
updateRadecData(idx);
|
||||
int index = DataFileHelper::findFileIndexForCurrentTime(time, minuteTimes);
|
||||
updateActiveMinute(index);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (positions.size() && !correctUpdateInterval(time)) {
|
||||
@@ -95,11 +102,14 @@ namespace openspace {
|
||||
position.dec = pos["DecDn"].get<double>();
|
||||
position.range = pos["GeoRngDn"].get<double>();
|
||||
position.lightTravelTime = pos["DLT"].get<double>();
|
||||
position.lightTravelHours = ceil(position.lightTravelTime / 3600);
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
LERROR(fmt::format("{}: Error in json object number {} while reading file '{}'", objectIdentifier, objectCounter, filename));
|
||||
}
|
||||
|
||||
RadecManager::positions.push_back(position);
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -43,12 +43,13 @@ namespace openspace {
|
||||
mutable double dec;
|
||||
mutable double range;
|
||||
mutable double lightTravelTime; //Downlink light time travel time in seconds
|
||||
|
||||
mutable int lightTravelHours;
|
||||
};
|
||||
mutable int prevIndex;
|
||||
|
||||
mutable std::vector<Position> positions;
|
||||
mutable std::vector<double> minuteTimes;
|
||||
mutable Position position;
|
||||
|
||||
mutable double updateFrequency = 1;
|
||||
mutable double activeMinute = -1;
|
||||
/* Identifier for object using the translation, used for logging */
|
||||
|
||||
Reference in New Issue
Block a user