Refactor QMapLibreGL to QMapLibre

This commit is contained in:
Dan Paulat 2024-02-27 23:33:57 -06:00
parent db0d26a4ad
commit 1fd52f771c
55 changed files with 305 additions and 313 deletions

View file

@ -1,6 +1,6 @@
#include <scwx/qt/util/maplibre.hpp>
#include <QMapLibreGL/utils.hpp>
#include <QMapLibre/Utils>
#include <mbgl/util/constants.hpp>
namespace scwx
@ -13,14 +13,14 @@ namespace maplibre
{
units::length::meters<double>
GetMapDistance(const QMapLibreGL::CustomLayerRenderParameters& params)
GetMapDistance(const QMapLibre::CustomLayerRenderParameters& params)
{
return units::length::meters<double>(
QMapLibreGL::metersPerPixelAtLatitude(params.latitude, params.zoom) *
QMapLibre::metersPerPixelAtLatitude(params.latitude, params.zoom) *
(params.width + params.height) / 2.0);
}
glm::mat4 GetMapMatrix(const QMapLibreGL::CustomLayerRenderParameters& params)
glm::mat4 GetMapMatrix(const QMapLibre::CustomLayerRenderParameters& params)
{
glm::vec2 scale = GetMapScale(params);
@ -33,7 +33,7 @@ glm::mat4 GetMapMatrix(const QMapLibreGL::CustomLayerRenderParameters& params)
return mapMatrix;
}
glm::vec2 GetMapScale(const QMapLibreGL::CustomLayerRenderParameters& params)
glm::vec2 GetMapScale(const QMapLibre::CustomLayerRenderParameters& params)
{
const float scale = std::pow(2.0, params.zoom) * 2.0f *
mbgl::util::tileSize_D / mbgl::util::DEGREES_MAX;
@ -73,7 +73,7 @@ bool IsPointInPolygon(const std::vector<glm::vec2>& vertices,
return inPolygon;
}
glm::vec2 LatLongToScreenCoordinate(const QMapLibreGL::Coordinate& coordinate)
glm::vec2 LatLongToScreenCoordinate(const QMapLibre::Coordinate& coordinate)
{
static constexpr double RAD2DEG_D = 180.0 / M_PI;

View file

@ -1,6 +1,6 @@
#pragma once
#include <QMapLibreGL/types.hpp>
#include <QMapLibre/Types>
#include <glm/gtc/type_ptr.hpp>
#include <units/length.h>
@ -14,9 +14,9 @@ namespace maplibre
{
units::length::meters<double>
GetMapDistance(const QMapLibreGL::CustomLayerRenderParameters& params);
glm::mat4 GetMapMatrix(const QMapLibreGL::CustomLayerRenderParameters& params);
glm::vec2 GetMapScale(const QMapLibreGL::CustomLayerRenderParameters& params);
GetMapDistance(const QMapLibre::CustomLayerRenderParameters& params);
glm::mat4 GetMapMatrix(const QMapLibre::CustomLayerRenderParameters& params);
glm::vec2 GetMapScale(const QMapLibre::CustomLayerRenderParameters& params);
/**
* @brief Determine whether a point lies within a polygon
@ -29,7 +29,7 @@ glm::vec2 GetMapScale(const QMapLibreGL::CustomLayerRenderParameters& params);
bool IsPointInPolygon(const std::vector<glm::vec2>& vertices,
const glm::vec2& point);
glm::vec2 LatLongToScreenCoordinate(const QMapLibreGL::Coordinate& coordinate);
glm::vec2 LatLongToScreenCoordinate(const QMapLibre::Coordinate& coordinate);
} // namespace maplibre
} // namespace util