Replace boost/units in favor of units library

This commit is contained in:
Dan Paulat 2023-08-18 10:45:52 -05:00
parent 12833202b7
commit 35b90fa98d
15 changed files with 67 additions and 67 deletions

View file

@ -9,9 +9,8 @@
#include <vector>
#include <boost/gil/typedefs.hpp>
#include <boost/units/quantity.hpp>
#include <boost/units/systems/angle/degrees.hpp>
#include <boost/units/systems/si/length.hpp>
#include <units/angle.h>
#include <units/length.h>
namespace scwx
{
@ -71,22 +70,22 @@ public:
struct DrawItem
{
ItemType itemType_ {ItemType::Unknown};
boost::units::quantity<boost::units::si::length> threshold_ {};
ItemType itemType_ {ItemType::Unknown};
units::length::nautical_miles<double> threshold_ {};
};
struct IconDrawItem : DrawItem
{
IconDrawItem() { itemType_ = ItemType::Icon; }
double latitude_ {};
double longitude_ {};
double x_ {};
double y_ {};
boost::units::quantity<boost::units::degree::plane_angle> angle_ {};
std::size_t fileNumber_ {0u};
std::size_t iconNumber_ {0u};
std::string hoverText_ {};
double latitude_ {};
double longitude_ {};
double x_ {};
double y_ {};
units::degrees<double> angle_ {};
std::size_t fileNumber_ {0u};
std::size_t iconNumber_ {0u};
std::string hoverText_ {};
};
struct TextDrawItem : DrawItem

View file

@ -9,7 +9,8 @@
#include <unordered_map>
#include <boost/algorithm/string.hpp>
#include <boost/units/base_units/metric/nautical_mile.hpp>
using namespace units::literals;
namespace scwx
{
@ -58,11 +59,10 @@ public:
std::chrono::seconds refresh_ {-1};
// Parsing state
boost::units::quantity<boost::units::si::length> threshold_ {
999.0 * boost::units::metric::nautical_mile_base_unit::unit_type()};
boost::gil::rgba8_pixel_t color_ {255, 255, 255, 255};
ColorMode colorMode_ {ColorMode::RGBA};
std::vector<Object> objectStack_ {};
units::length::nautical_miles<double> threshold_ {999.0_nmi};
boost::gil::rgba8_pixel_t color_ {255, 255, 255, 255};
ColorMode colorMode_ {ColorMode::RGBA};
std::vector<Object> objectStack_ {};
DrawingStatement currentStatement_ {DrawingStatement::Standard};
std::shared_ptr<DrawItem> currentDrawItem_ {nullptr};
std::vector<PolygonDrawItem::Element> currentPolygonContour_ {};
@ -245,9 +245,7 @@ void Placefile::Impl::ProcessLine(const std::string& line)
if (tokenList.size() >= 1)
{
threshold_ =
static_cast<boost::units::quantity<boost::units::si::length>>(
std::stod(tokenList[0]) *
boost::units::metric::nautical_mile_base_unit::unit_type());
units::length::nautical_miles<double>(std::stod(tokenList[0]));
}
}
else if (boost::istarts_with(line, timeRangeKey_))
@ -384,10 +382,7 @@ void Placefile::Impl::ProcessLine(const std::string& line)
di->x_,
di->y_);
di->angle_ = static_cast<
boost::units::quantity<boost::units::degree::plane_angle>>(
std::stod(tokenList[2]) *
boost::units::angle::degree_base_unit::unit_type());
di->angle_ = units::angle::degrees<double>(std::stod(tokenList[2]));
di->fileNumber_ = std::stoul(tokenList[3]);
di->iconNumber_ = std::stoul(tokenList[4]);

View file

@ -259,7 +259,8 @@ target_link_libraries(wxdata PUBLIC aws-cpp-sdk-core
aws-cpp-sdk-s3
cpr::cpr
LibXml2::LibXml2
spdlog::spdlog)
spdlog::spdlog
units::units)
target_link_libraries(wxdata INTERFACE Boost::iostreams
BZip2::BZip2
hsluv-c)