mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 15:00:04 +00:00
Migrating mapbox-gl-native to maplibre-gl-native
This commit is contained in:
parent
d734bc6a0a
commit
7e98227c70
5 changed files with 25 additions and 6 deletions
2
.gitmodules
vendored
2
.gitmodules
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
[submodule "external/mapbox-gl-native"]
|
[submodule "external/mapbox-gl-native"]
|
||||||
path = external/mapbox-gl-native
|
path = external/mapbox-gl-native
|
||||||
url = ../mapbox-gl-native.git
|
url = ../maplibre-gl-native.git
|
||||||
[submodule "external/cmake-conan"]
|
[submodule "external/cmake-conan"]
|
||||||
path = external/cmake-conan
|
path = external/cmake-conan
|
||||||
url = https://github.com/conan-io/cmake-conan.git
|
url = https://github.com/conan-io/cmake-conan.git
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ project(${PROJECT_NAME} CXX)
|
||||||
|
|
||||||
set(CMAKE_POLICY_DEFAULT_CMP0054 NEW)
|
set(CMAKE_POLICY_DEFAULT_CMP0054 NEW)
|
||||||
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
|
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
|
||||||
|
set(CMAKE_POLICY_DEFAULT_CMP0079 NEW)
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
|
|
|
||||||
2
external/mapbox-gl-native
vendored
2
external/mapbox-gl-native
vendored
|
|
@ -1 +1 @@
|
||||||
Subproject commit 40b8010d12e82d0e6505aecedd641de70fe41cf7
|
Subproject commit f424ec413fecaa0f9121b207d7ae8e667db7ce23
|
||||||
3
external/mapbox-gl-native.cmake
vendored
3
external/mapbox-gl-native.cmake
vendored
|
|
@ -5,6 +5,9 @@ set(gtest_disable_pthreads ON)
|
||||||
set(MBGL_WITH_QT ON)
|
set(MBGL_WITH_QT ON)
|
||||||
add_subdirectory(mapbox-gl-native)
|
add_subdirectory(mapbox-gl-native)
|
||||||
|
|
||||||
|
find_package(ZLIB)
|
||||||
|
target_link_libraries(mbgl-core PUBLIC ZLIB::ZLIB)
|
||||||
|
|
||||||
set_target_properties(mbgl-qt PROPERTIES EXCLUDE_FROM_ALL True)
|
set_target_properties(mbgl-qt PROPERTIES EXCLUDE_FROM_ALL True)
|
||||||
set_target_properties(mbgl-test-runner PROPERTIES EXCLUDE_FROM_ALL True)
|
set_target_properties(mbgl-test-runner PROPERTIES EXCLUDE_FROM_ALL True)
|
||||||
set_target_properties(mbgl-vendor-icu PROPERTIES EXCLUDE_FROM_ALL True)
|
set_target_properties(mbgl-vendor-icu PROPERTIES EXCLUDE_FROM_ALL True)
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,20 @@ namespace scwx
|
||||||
namespace qt
|
namespace qt
|
||||||
{
|
{
|
||||||
|
|
||||||
|
typedef std::pair<std::string, std::string> MapStyle;
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
static const MapStyle streets { "mapbox://styles/mapbox/streets-v11", "Streets"};
|
||||||
|
static const MapStyle outdoors { "mapbox://styles/mapbox/outdoors-v11", "Outdoors"};
|
||||||
|
static const MapStyle light { "mapbox://styles/mapbox/light-v10", "Light"};
|
||||||
|
static const MapStyle dark { "mapbox://styles/mapbox/dark-v10", "Dark" };
|
||||||
|
static const MapStyle satellite { "mapbox://styles/mapbox/satellite-v9", "Satellite" };
|
||||||
|
static const MapStyle satelliteStreets { "mapbox://styles/mapbox/satellite-streets-v11", "Satellite Streets" };
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
static const std::array<MapStyle, 6> mapboxStyles_ = {
|
||||||
|
{streets, outdoors, light, dark, satellite, satelliteStreets}};
|
||||||
|
|
||||||
MapWidget::MapWidget(const QMapboxGLSettings& settings) : settings_(settings)
|
MapWidget::MapWidget(const QMapboxGLSettings& settings) : settings_(settings)
|
||||||
{
|
{
|
||||||
setFocusPolicy(Qt::StrongFocus);
|
setFocusPolicy(Qt::StrongFocus);
|
||||||
|
|
@ -35,12 +49,13 @@ qreal MapWidget::pixelRatio()
|
||||||
|
|
||||||
void MapWidget::changeStyle()
|
void MapWidget::changeStyle()
|
||||||
{
|
{
|
||||||
static uint8_t currentStyleIndex;
|
static uint8_t currentStyleIndex = 0;
|
||||||
|
|
||||||
auto& styles = QMapbox::defaultStyles();
|
auto& styles = mapboxStyles_;
|
||||||
|
|
||||||
map_->setStyleUrl(styles[currentStyleIndex].first);
|
map_->setStyleUrl(styles[currentStyleIndex].first.c_str());
|
||||||
setWindowTitle(QString("Mapbox GL: ") + styles[currentStyleIndex].second);
|
setWindowTitle(QString("Mapbox GL: ") +
|
||||||
|
styles[currentStyleIndex].second.c_str());
|
||||||
|
|
||||||
if (++currentStyleIndex == styles.size())
|
if (++currentStyleIndex == styles.size())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue