diff --git a/scwx-qt/source/scwx/qt/util/maplibre.cpp b/scwx-qt/source/scwx/qt/util/maplibre.cpp index c2170425..5b3f331e 100644 --- a/scwx-qt/source/scwx/qt/util/maplibre.cpp +++ b/scwx-qt/source/scwx/qt/util/maplibre.cpp @@ -1,5 +1,6 @@ #include +#include #include namespace scwx @@ -11,6 +12,13 @@ namespace util namespace maplibre { +boost::units::quantity +GetMapDistance(const QMapLibreGL::CustomLayerRenderParameters& params) +{ + return QMapLibreGL::metersPerPixelAtLatitude(params.latitude, params.zoom) * + (params.width + params.height) / 2.0 * boost::units::si::meters; +} + glm::vec2 LatLongToScreenCoordinate(const QMapLibreGL::Coordinate& coordinate) { static constexpr double RAD2DEG_D = 180.0 / M_PI; diff --git a/scwx-qt/source/scwx/qt/util/maplibre.hpp b/scwx-qt/source/scwx/qt/util/maplibre.hpp index 03d548de..65aa4409 100644 --- a/scwx-qt/source/scwx/qt/util/maplibre.hpp +++ b/scwx-qt/source/scwx/qt/util/maplibre.hpp @@ -1,6 +1,8 @@ #pragma once #include +#include +#include #include namespace scwx @@ -12,6 +14,8 @@ namespace util namespace maplibre { +boost::units::quantity +GetMapDistance(const QMapLibreGL::CustomLayerRenderParameters& params); glm::vec2 LatLongToScreenCoordinate(const QMapLibreGL::Coordinate& coordinate); } // namespace maplibre