diff options
Diffstat (limited to 'src/iso19111/factory.cpp')
| -rw-r--r-- | src/iso19111/factory.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/iso19111/factory.cpp b/src/iso19111/factory.cpp index 19db111b..088289c5 100644 --- a/src/iso19111/factory.cpp +++ b/src/iso19111/factory.cpp @@ -7465,6 +7465,14 @@ AuthorityFactory::UnitInfo::UnitInfo() deprecated{} {} //! @endcond + +// --------------------------------------------------------------------------- + +//! @cond Doxygen_Suppress +AuthorityFactory::CelestialBodyInfo::CelestialBodyInfo() : authName{}, name{} {} +//! @endcond + + // --------------------------------------------------------------------------- /** \brief Return the list of units. @@ -7517,6 +7525,35 @@ std::list<AuthorityFactory::UnitInfo> AuthorityFactory::getUnitList() const { // --------------------------------------------------------------------------- +/** \brief Return the list of celestial bodies. + * @throw FactoryException + * + * @since 8.1 + */ +std::list<AuthorityFactory::CelestialBodyInfo> +AuthorityFactory::getCelestialBodyList() const { + std::string sql = "SELECT auth_name, name FROM celestial_body"; + ListOfParams params; + if (d->hasAuthorityRestriction()) { + sql += " WHERE auth_name = ?"; + params.emplace_back(d->authority()); + } + sql += " ORDER BY auth_name, name"; + + auto sqlRes = d->run(sql, params); + std::list<AuthorityFactory::CelestialBodyInfo> res; + for (const auto &row : sqlRes) { + AuthorityFactory::CelestialBodyInfo info; + info.authName = row[0]; + info.name = row[1]; + res.emplace_back(info); + } + return res; +} + + +// --------------------------------------------------------------------------- + /** \brief Gets the official name from a possibly alias name. * * @param aliasedName Alias name. |
