mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 22:40:05 +00:00
Refactor QMapLibreGL to QMapLibre
This commit is contained in:
parent
db0d26a4ad
commit
1fd52f771c
55 changed files with 305 additions and 313 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue