Move the mapping target->frame from SpiceManager to SpacecraftInstrumentModule (#closes 21)

This commit is contained in:
Alexander Bock
2019-12-28 00:25:17 +01:00
parent 207db3c824
commit e3afd82c47
6 changed files with 49 additions and 101 deletions
@@ -94,4 +94,31 @@ SpacecraftInstrumentsModule::documentations() const
};
}
bool SpacecraftInstrumentsModule::addFrame(std::string body, std::string frame) {
if (body.empty() || frame.empty()) {
return false;
}
else {
_frameByBody.emplace_back(body, frame);
return true;
}
}
std::string SpacecraftInstrumentsModule::frameFromBody(const std::string& body) {
for (const std::pair<std::string, std::string>& pair : _frameByBody) {
if (pair.first == body) {
return pair.second;
}
}
constexpr const char* unionPrefix = "IAU_";
if (body.find(unionPrefix) == std::string::npos) {
return unionPrefix + body;
}
else {
return body;
}
}
} // namespace openspace