mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 20:50:06 +00:00
Map distance helper function
This commit is contained in:
parent
2113cb9ba8
commit
5e1b1a5ba6
2 changed files with 12 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#include <scwx/qt/util/maplibre.hpp>
|
||||
|
||||
#include <QMapLibreGL/utils.hpp>
|
||||
#include <mbgl/util/constants.hpp>
|
||||
|
||||
namespace scwx
|
||||
|
|
@ -11,6 +12,13 @@ namespace util
|
|||
namespace maplibre
|
||||
{
|
||||
|
||||
boost::units::quantity<boost::units::si::length>
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <QMapLibreGL/types.hpp>
|
||||
#include <boost/units/quantity.hpp>
|
||||
#include <boost/units/systems/si/length.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
namespace scwx
|
||||
|
|
@ -12,6 +14,8 @@ namespace util
|
|||
namespace maplibre
|
||||
{
|
||||
|
||||
boost::units::quantity<boost::units::si::length>
|
||||
GetMapDistance(const QMapLibreGL::CustomLayerRenderParameters& params);
|
||||
glm::vec2 LatLongToScreenCoordinate(const QMapLibreGL::Coordinate& coordinate);
|
||||
|
||||
} // namespace maplibre
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue