显示出 maplibre 官方测试地图
This commit is contained in:
+3
-3
@@ -8,14 +8,14 @@ if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_LIST_DIR})
|
||||
include(third_party/build_infra/start.cmake)
|
||||
include(third_party/CPP_Core/main.cmake)
|
||||
|
||||
set(ecap_rely maplibre-native-qt)
|
||||
library_is_installed_with_rely(global ok ${ecap_rely})
|
||||
set(test_maplibre_rely QMapLibre_qt_5_15_2)
|
||||
library_is_installed_with_rely(global ok ${test_maplibre_rely})
|
||||
if (${ok})
|
||||
include(${CMAKE_SOURCE_DIR}/main.cmake)
|
||||
else ()
|
||||
message("test_maplibre 依赖未安装! 请运行 test_maplibre_env 目标安装所需第三方依赖")
|
||||
endif ()
|
||||
rcl_add_dependency_action_targets("test_maplibre_env" ${ecap_rely})
|
||||
rcl_add_dependency_action_targets("test_maplibre_env" ${test_maplibre_rely})
|
||||
include(third_party/build_infra/end.cmake)
|
||||
else ()
|
||||
endif ()
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
set(dir ${CMAKE_CURRENT_LIST_DIR}/src)
|
||||
|
||||
|
||||
|
||||
|
||||
find_package(Qt5 REQUIRED COMPONENTS Widgets)
|
||||
find_package(QMapLibre COMPONENTS Widgets REQUIRED)
|
||||
|
||||
|
||||
file(GLOB_RECURSE srcs ${dir}/*.c ${dir}/*.h ${dir}/*.cpp ${dir}/*.hpp)
|
||||
add_executable(test_maplibre ${srcs})
|
||||
target_link_libraries(test_maplibre PRIVATE Qt5::Widgets QMapLibre::Widgets)
|
||||
|
||||
target_compile_definitions(test_maplibre PRIVATE QT_MAPLIBRE_STATIC)
|
||||
+16
-4
@@ -1,6 +1,18 @@
|
||||
#include <iostream>
|
||||
#include <QApplication>
|
||||
#include <QMapLibre/Map>
|
||||
#include <QMapLibre/Settings>
|
||||
#include <QMapLibreWidgets/GLWidget>
|
||||
|
||||
int main() {
|
||||
std::cout << "Hello World!" << std::endl;
|
||||
return 0;
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
QApplication app(argc, argv);
|
||||
QMapLibre::Settings settings;
|
||||
QMapLibre::GLWidget widget(settings);
|
||||
widget.resize(1200, 800);
|
||||
widget.setWindowTitle("MapLibre Qt Widgets Demo");
|
||||
widget.show();
|
||||
widget.map()->setStyleUrl("https://demotiles.maplibre.org/style.json");
|
||||
widget.map()->setCoordinateZoom(QMapLibre::Coordinate(41.874, -75.789), 5.0);
|
||||
return app.exec();
|
||||
}
|
||||
Reference in New Issue
Block a user