Updating radar site display fields to be more human-friendly

- Latitude/longitude in degrees N/S/E/W
- Radar types with hyphens
- Sort by raw decimal values
This commit is contained in:
Dan Paulat 2022-10-07 22:29:30 -05:00
parent 1bc6e714f5
commit 6e7a13494a
11 changed files with 186 additions and 5 deletions

View file

@ -20,6 +20,9 @@ static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
static const std::string defaultRadarSiteFile_ =
":/res/config/radar_sites.json";
static const std::unordered_map<std::string, std::string> typeNameMap_ {
{"wsr88d", "WSR-88D"}, {"tdwr", "TDWR"}, {"?", "?"}};
static std::unordered_map<std::string, std::shared_ptr<RadarSite>>
radarSiteMap_;
static std::unordered_map<std::string, std::string> siteIdMap_;
@ -63,6 +66,19 @@ std::string RadarSite::type() const
return p->type_;
}
std::string RadarSite::type_name() const
{
auto it = typeNameMap_.find(p->type_);
if (it != typeNameMap_.cend())
{
return it->second;
}
else
{
return typeNameMap_.at("?");
}
}
std::string RadarSite::id() const
{
return p->id_;

View file

@ -26,6 +26,7 @@ public:
RadarSite& operator=(RadarSite&&) noexcept;
std::string type() const;
std::string type_name() const;
std::string id() const;
double latitude() const;
double longitude() const;