mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 17:40:05 +00:00
Add map copyrights and map provider to map context
This commit is contained in:
parent
6b00c55bac
commit
5c7c7e6a19
5 changed files with 73 additions and 25 deletions
|
|
@ -88,10 +88,11 @@ glm::vec2 LatLongToScreenCoordinate(const QMapLibre::Coordinate& coordinate)
|
|||
return screen;
|
||||
}
|
||||
|
||||
void SetMapStyleUrl(const std::shared_ptr<QMapLibre::Map>& map,
|
||||
map::MapProvider mapProvider,
|
||||
const std::string& url)
|
||||
void SetMapStyleUrl(const std::shared_ptr<map::MapContext>& mapContext,
|
||||
const std::string& url)
|
||||
{
|
||||
const auto mapProvider = mapContext->map_provider();
|
||||
|
||||
QString qUrl = QString::fromStdString(url);
|
||||
|
||||
if (mapProvider == map::MapProvider::MapTiler)
|
||||
|
|
@ -100,7 +101,11 @@ void SetMapStyleUrl(const std::shared_ptr<QMapLibre::Map>& map,
|
|||
qUrl.append(map::GetMapProviderApiKey(mapProvider));
|
||||
}
|
||||
|
||||
map->setStyleUrl(qUrl);
|
||||
auto map = mapContext->map().lock();
|
||||
if (map != nullptr)
|
||||
{
|
||||
map->setStyleUrl(qUrl);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace maplibre
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <scwx/qt/map/map_provider.hpp>
|
||||
#include <scwx/qt/map/map_context.hpp>
|
||||
|
||||
#include <QMapLibre/Map>
|
||||
#include <QMapLibre/Types>
|
||||
|
|
@ -34,9 +34,8 @@ bool IsPointInPolygon(const std::vector<glm::vec2>& vertices,
|
|||
|
||||
glm::vec2 LatLongToScreenCoordinate(const QMapLibre::Coordinate& coordinate);
|
||||
|
||||
void SetMapStyleUrl(const std::shared_ptr<QMapLibre::Map>& map,
|
||||
map::MapProvider mapProvider,
|
||||
const std::string& url);
|
||||
void SetMapStyleUrl(const std::shared_ptr<map::MapContext>& mapContext,
|
||||
const std::string& url);
|
||||
|
||||
} // namespace maplibre
|
||||
} // namespace util
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue