mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 20:50:06 +00:00
Add radar altitude data form config json file into code
This commit is contained in:
parent
62414e5b10
commit
22ed4c36fc
2 changed files with 23 additions and 19 deletions
|
|
@ -51,6 +51,7 @@ public:
|
|||
std::string state_ {};
|
||||
std::string place_ {};
|
||||
std::string tzName_ {};
|
||||
double altitude_ {0.0};
|
||||
|
||||
const scwx::util::time_zone* timeZone_ {nullptr};
|
||||
};
|
||||
|
|
@ -142,6 +143,11 @@ const scwx::util::time_zone* RadarSite::time_zone() const
|
|||
return p->timeZone_;
|
||||
}
|
||||
|
||||
units::length::feet<double> RadarSite::altitude() const
|
||||
{
|
||||
return units::length::feet<double>(p->altitude_);
|
||||
}
|
||||
|
||||
std::shared_ptr<RadarSite> RadarSite::Get(const std::string& id)
|
||||
{
|
||||
std::shared_lock lock(siteMutex_);
|
||||
|
|
@ -268,6 +274,8 @@ size_t RadarSite::ReadConfig(const std::string& path)
|
|||
site->p->state_ = boost::json::value_to<std::string>(o.at("state"));
|
||||
site->p->place_ = boost::json::value_to<std::string>(o.at("place"));
|
||||
site->p->tzName_ = boost::json::value_to<std::string>(o.at("tz"));
|
||||
site->p->altitude_ =
|
||||
boost::json::value_to<double>(o.at("elevation"));
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,12 +6,9 @@
|
|||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <units/length.h>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace config
|
||||
namespace scwx::qt::config
|
||||
{
|
||||
|
||||
class RadarSiteImpl;
|
||||
|
|
@ -28,18 +25,19 @@ public:
|
|||
RadarSite(RadarSite&&) noexcept;
|
||||
RadarSite& operator=(RadarSite&&) noexcept;
|
||||
|
||||
std::string type() const;
|
||||
std::string type_name() const;
|
||||
std::string id() const;
|
||||
double latitude() const;
|
||||
double longitude() const;
|
||||
std::string country() const;
|
||||
std::string state() const;
|
||||
std::string place() const;
|
||||
std::string location_name() const;
|
||||
std::string tz_name() const;
|
||||
[[nodiscard]] std::string type() const;
|
||||
[[nodiscard]] std::string type_name() const;
|
||||
[[nodiscard]] std::string id() const;
|
||||
[[nodiscard]] double latitude() const;
|
||||
[[nodiscard]] double longitude() const;
|
||||
[[nodiscard]] std::string country() const;
|
||||
[[nodiscard]] std::string state() const;
|
||||
[[nodiscard]] std::string place() const;
|
||||
[[nodiscard]] std::string location_name() const;
|
||||
[[nodiscard]] std::string tz_name() const;
|
||||
[[nodiscard]] units::length::feet<double> altitude() const;
|
||||
|
||||
const scwx::util::time_zone* time_zone() const;
|
||||
[[nodiscard]] const scwx::util::time_zone* time_zone() const;
|
||||
|
||||
static std::shared_ptr<RadarSite> Get(const std::string& id);
|
||||
static std::vector<std::shared_ptr<RadarSite>> GetAll();
|
||||
|
|
@ -67,6 +65,4 @@ private:
|
|||
|
||||
std::string GetRadarIdFromSiteId(const std::string& siteId);
|
||||
|
||||
} // namespace config
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::config
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue