mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 16:40:05 +00:00
Placefile line hover in-work
This commit is contained in:
parent
37d751774d
commit
8dfb9f1105
14 changed files with 243 additions and 36 deletions
|
|
@ -20,6 +20,29 @@ GetMapDistance(const QMapLibreGL::CustomLayerRenderParameters& params)
|
|||
(params.width + params.height) / 2.0);
|
||||
}
|
||||
|
||||
glm::mat4 GetMapMatrix(const QMapLibreGL::CustomLayerRenderParameters& params)
|
||||
{
|
||||
glm::vec2 scale = GetMapScale(params);
|
||||
|
||||
glm::mat4 mapMatrix(1.0f);
|
||||
mapMatrix = glm::scale(mapMatrix, glm::vec3(scale, 1.0f));
|
||||
mapMatrix = glm::rotate(mapMatrix,
|
||||
glm::radians<float>(params.bearing),
|
||||
glm::vec3(0.0f, 0.0f, 1.0f));
|
||||
|
||||
return mapMatrix;
|
||||
}
|
||||
|
||||
glm::vec2 GetMapScale(const QMapLibreGL::CustomLayerRenderParameters& params)
|
||||
{
|
||||
const float scale = std::pow(2.0, params.zoom) * 2.0f *
|
||||
mbgl::util::tileSize_D / mbgl::util::DEGREES_MAX;
|
||||
const float xScale = scale / params.width;
|
||||
const float yScale = scale / params.height;
|
||||
|
||||
return glm::vec2 {xScale, yScale};
|
||||
}
|
||||
|
||||
glm::vec2 LatLongToScreenCoordinate(const QMapLibreGL::Coordinate& coordinate)
|
||||
{
|
||||
static constexpr double RAD2DEG_D = 180.0 / M_PI;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ 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);
|
||||
glm::vec2 LatLongToScreenCoordinate(const QMapLibreGL::Coordinate& coordinate);
|
||||
|
||||
} // namespace maplibre
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue