From c5f7fcbaafdbcc69fa1972926035ac75be12c628 Mon Sep 17 00:00:00 2001 From: Tadej Novak Date: Sat, 15 Apr 2023 15:18:07 +0200 Subject: [PATCH] Preliminary Qt 6.5 support --- .github/workflows/Android-Qt5.yml | 2 +- .github/workflows/Android-Qt6.yml | 94 ++++---- .github/workflows/Linux-Qt6.yml | 86 ++++--- .github/workflows/Windows-Qt5.yml | 80 +++---- .github/workflows/Windows-Qt6.yml | 97 ++++---- .github/workflows/iOS-Qt5.yml | 82 +++---- .github/workflows/iOS-Qt6.yml | 94 ++++---- .github/workflows/macOS-Qt5.yml | 2 +- .github/workflows/macOS-Qt6.yml | 89 ++++---- README.md | 14 +- src/qgeomapmaplibregl.cpp | 44 +--- src/qgeomapmaplibregl.h | 6 +- src/qgeomapmaplibregl_p.h | 10 +- src/qgeoserviceproviderpluginmaplibregl.h | 7 +- src/qmaplibreglstylechange.cpp | 261 ++-------------------- src/qmaplibreglstylechange_p.h | 13 +- src/qsgmaplibreglnode.cpp | 4 +- src/qsgmaplibreglnode.h | 3 +- 18 files changed, 333 insertions(+), 655 deletions(-) diff --git a/.github/workflows/Android-Qt5.yml b/.github/workflows/Android-Qt5.yml index d8f4010..6184614 100644 --- a/.github/workflows/Android-Qt5.yml +++ b/.github/workflows/Android-Qt5.yml @@ -217,7 +217,7 @@ jobs: - name: Create artifacts run: | - pushd install/home/runner/work/qt-geoservices-maplibre-gl + pushd install/home/runner/work/maplibre-native-qt tar cjvf ../../../../../qt-geoservices-maplibre-gl_Android.tar.bz2 Qt popd diff --git a/.github/workflows/Android-Qt6.yml b/.github/workflows/Android-Qt6.yml index 4ce0fad..5b2229e 100644 --- a/.github/workflows/Android-Qt6.yml +++ b/.github/workflows/Android-Qt6.yml @@ -2,45 +2,45 @@ name: Android Qt6 CI on: workflow_dispatch: - push: - branches: - - main - tags: - - '**' - paths-ignore: - - ".gitignore" - - "README.md" - # ignore CI for other platforms - - ".github/FUNDING.yml" - - ".github/actions/**" - - ".github/workflows/Android-Qt5.yml" - - ".github/workflows/iOS-Qt5.yml" - - ".github/workflows/iOS-Qt6.yml" - - ".github/workflows/Linux-Qt5.yml" - - ".github/workflows/Linux-Qt6.yml" - - ".github/workflows/macOS-Qt5.yml" - - ".github/workflows/macOS-Qt6.yml" - - ".github/workflows/Windows-Qt5.yml" - - ".github/workflows/Windows-Qt6.yml" - - pull_request: - branches: - - main - paths-ignore: - - ".gitignore" - - "README.md" - # ignore CI for other platforms - - ".github/FUNDING.yml" - - ".github/actions/**" - - ".github/workflows/Android-Qt5.yml" - - ".github/workflows/iOS-Qt5.yml" - - ".github/workflows/iOS-Qt6.yml" - - ".github/workflows/Linux-Qt5.yml" - - ".github/workflows/Linux-Qt6.yml" - - ".github/workflows/macOS-Qt5.yml" - - ".github/workflows/macOS-Qt6.yml" - - ".github/workflows/Windows-Qt5.yml" - - ".github/workflows/Windows-Qt6.yml" + # push: + # branches: + # - main + # tags: + # - '**' + # paths-ignore: + # - ".gitignore" + # - "README.md" + # # ignore CI for other platforms + # - ".github/FUNDING.yml" + # - ".github/actions/**" + # - ".github/workflows/Android-Qt5.yml" + # - ".github/workflows/iOS-Qt5.yml" + # - ".github/workflows/iOS-Qt6.yml" + # - ".github/workflows/Linux-Qt5.yml" + # - ".github/workflows/Linux-Qt6.yml" + # - ".github/workflows/macOS-Qt5.yml" + # - ".github/workflows/macOS-Qt6.yml" + # - ".github/workflows/Windows-Qt5.yml" + # - ".github/workflows/Windows-Qt6.yml" + + # pull_request: + # branches: + # - main + # paths-ignore: + # - ".gitignore" + # - "README.md" + # # ignore CI for other platforms + # - ".github/FUNDING.yml" + # - ".github/actions/**" + # - ".github/workflows/Android-Qt5.yml" + # - ".github/workflows/iOS-Qt5.yml" + # - ".github/workflows/iOS-Qt6.yml" + # - ".github/workflows/Linux-Qt5.yml" + # - ".github/workflows/Linux-Qt6.yml" + # - ".github/workflows/macOS-Qt5.yml" + # - ".github/workflows/macOS-Qt6.yml" + # - ".github/workflows/Windows-Qt5.yml" + # - ".github/workflows/Windows-Qt6.yml" concurrency: # cancel jobs on PRs only @@ -48,8 +48,7 @@ concurrency: cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} env: - QT_VERSION: 6.4.3 - QT_LOCATION_VERSION: 6.4.3.0 + QT_VERSION: 6.5.0 jobs: build-plugin: @@ -81,7 +80,7 @@ jobs: with: aqtversion: ==3.0.* version: ${{ env.QT_VERSION }} - modules: qtpositioning qtshadertools + modules: qtlocation qtpositioning qtshadertools set-env: false - name: Download Qt (Android) @@ -92,7 +91,7 @@ jobs: version: ${{ env.QT_VERSION }} target: android arch: ${{ matrix.config.arch }} - modules: qtpositioning qtshadertools + modules: qtlocation qtpositioning qtshadertools - name: Fix Qt release if: ${{ matrix.config.abi }} == 'armeabi-v7a' @@ -100,13 +99,6 @@ jobs: chmod +x "$Qt6_DIR/bin/qt-cmake" sed -i "s/C:\/Qt\/Qt-${QT_VERSION}/\/usr\/local\/Qt-${QT_VERSION}/g" "$Qt6_DIR/lib/cmake/Qt6BuildInternals/QtBuildInternalsExtra.cmake" - - name: Download QtLocation - run: | - wget https://github.com/ntadej/qtlocation/releases/download/v${QT_LOCATION_VERSION}/QtLocation_v${QT_LOCATION_VERSION}_Linux.tar.bz2 - tar xvf QtLocation_v${QT_LOCATION_VERSION}_Linux.tar.bz2 -C .. - wget https://github.com/ntadej/qtlocation/releases/download/v${QT_LOCATION_VERSION}/QtLocation_v${QT_LOCATION_VERSION}_Android.tar.bz2 - tar xvf QtLocation_v${QT_LOCATION_VERSION}_Android.tar.bz2 -C .. - - name: Set up OpenJDK 11 uses: actions/setup-java@v3 with: @@ -210,8 +202,6 @@ jobs: env: TAG_NAME: ${{ github.ref_name }} run: | - wget https://github.com/ntadej/qtlocation/releases/download/v${QT_LOCATION_VERSION}/QtLocation_v${QT_LOCATION_VERSION}_Android.tar.bz2 - tar xvf QtLocation_v${QT_LOCATION_VERSION}_Android.tar.bz2 tar xvf qt-geoservices-maplibre-gl_Android.tar.bz2 tar cjvf qt-geoservices-maplibre-gl_${TAG_NAME}_Qt${QT_VERSION}_Android.tar.bz2 Qt diff --git a/.github/workflows/Linux-Qt6.yml b/.github/workflows/Linux-Qt6.yml index d4d85ff..8da0013 100644 --- a/.github/workflows/Linux-Qt6.yml +++ b/.github/workflows/Linux-Qt6.yml @@ -2,43 +2,43 @@ name: Linux Qt6 CI on: workflow_dispatch: - push: - branches: - - main - tags: - - '**' - paths-ignore: - - ".gitignore" - - "README.md" - # ignore CI for other platforms - - ".github/FUNDING.yml" - - ".github/workflows/Android-Qt5.yml" - - ".github/workflows/Android-Qt6.yml" - - ".github/workflows/iOS-Qt5.yml" - - ".github/workflows/iOS-Qt6.yml" - - ".github/workflows/Linux-Qt5.yml" - - ".github/workflows/macOS-Qt5.yml" - - ".github/workflows/macOS-Qt6.yml" - - ".github/workflows/Windows-Qt5.yml" - - ".github/workflows/Windows-Qt6.yml" - - pull_request: - branches: - - main - paths-ignore: - - ".gitignore" - - "README.md" - # ignore CI for other platforms - - ".github/FUNDING.yml" - - ".github/workflows/Android-Qt5.yml" - - ".github/workflows/Android-Qt6.yml" - - ".github/workflows/iOS-Qt5.yml" - - ".github/workflows/iOS-Qt6.yml" - - ".github/workflows/Linux-Qt5.yml" - - ".github/workflows/macOS-Qt5.yml" - - ".github/workflows/macOS-Qt6.yml" - - ".github/workflows/Windows-Qt5.yml" - - ".github/workflows/Windows-Qt6.yml" + # push: + # branches: + # - main + # tags: + # - '**' + # paths-ignore: + # - ".gitignore" + # - "README.md" + # # ignore CI for other platforms + # - ".github/FUNDING.yml" + # - ".github/workflows/Android-Qt5.yml" + # - ".github/workflows/Android-Qt6.yml" + # - ".github/workflows/iOS-Qt5.yml" + # - ".github/workflows/iOS-Qt6.yml" + # - ".github/workflows/Linux-Qt5.yml" + # - ".github/workflows/macOS-Qt5.yml" + # - ".github/workflows/macOS-Qt6.yml" + # - ".github/workflows/Windows-Qt5.yml" + # - ".github/workflows/Windows-Qt6.yml" + + # pull_request: + # branches: + # - main + # paths-ignore: + # - ".gitignore" + # - "README.md" + # # ignore CI for other platforms + # - ".github/FUNDING.yml" + # - ".github/workflows/Android-Qt5.yml" + # - ".github/workflows/Android-Qt6.yml" + # - ".github/workflows/iOS-Qt5.yml" + # - ".github/workflows/iOS-Qt6.yml" + # - ".github/workflows/Linux-Qt5.yml" + # - ".github/workflows/macOS-Qt5.yml" + # - ".github/workflows/macOS-Qt6.yml" + # - ".github/workflows/Windows-Qt5.yml" + # - ".github/workflows/Windows-Qt6.yml" concurrency: # cancel jobs on PRs only @@ -46,8 +46,7 @@ concurrency: cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} env: - QT_VERSION: 6.4.3 - QT_LOCATION_VERSION: 6.4.3.0 + QT_VERSION: 6.5.0 jobs: build-plugin: @@ -69,12 +68,7 @@ jobs: version: ${{ env.QT_VERSION }} dir: ${{ github.workspace }} target: desktop - modules: qtpositioning qtshadertools - - - name: Download QtLocation - run: | - wget https://github.com/ntadej/qtlocation/releases/download/v${QT_LOCATION_VERSION}/QtLocation_v${QT_LOCATION_VERSION}_Linux.tar.bz2 - tar xvf QtLocation_v${QT_LOCATION_VERSION}_Linux.tar.bz2 + modules: qtlocation qtpositioning qtshadertools - name: Set up ccache uses: hendrikmuhs/ccache-action@v1 @@ -115,8 +109,6 @@ jobs: env: TAG_NAME: ${{ github.ref_name }} run: | - wget https://github.com/ntadej/qtlocation/releases/download/v${QT_LOCATION_VERSION}/QtLocation_v${QT_LOCATION_VERSION}_Linux.tar.bz2 - tar xvf QtLocation_v${QT_LOCATION_VERSION}_Linux.tar.bz2 tar xvf qt-geoservices-maplibre-gl_Linux.tar.bz2 tar cjvf qt-geoservices-maplibre-gl_${TAG_NAME}_Qt${QT_VERSION}_Linux.tar.bz2 Qt diff --git a/.github/workflows/Windows-Qt5.yml b/.github/workflows/Windows-Qt5.yml index 96adc52..04e3dc3 100644 --- a/.github/workflows/Windows-Qt5.yml +++ b/.github/workflows/Windows-Qt5.yml @@ -2,45 +2,45 @@ name: Windows Qt5 CI on: workflow_dispatch: - push: - branches: - - main - tags: - - '**' - paths-ignore: - - ".gitignore" - - "README.md" - # ignore CI for other platforms - - ".github/FUNDING.yml" - - ".github/actions/**" - - ".github/workflows/Android-Qt5.yml" - - ".github/workflows/Android-Qt6.yml" - - ".github/workflows/iOS-Qt5.yml" - - ".github/workflows/iOS-Qt6.yml" - - ".github/workflows/Linux-Qt5.yml" - - ".github/workflows/Linux-Qt6.yml" - - ".github/workflows/macOS-Qt5.yml" - - ".github/workflows/macOS-Qt6.yml" - - ".github/workflows/Windows-Qt6.yml" - - pull_request: - branches: - - main - paths-ignore: - - ".gitignore" - - "README.md" - # ignore CI for other platforms - - ".github/FUNDING.yml" - - ".github/actions/**" - - ".github/workflows/Android-Qt5.yml" - - ".github/workflows/Android-Qt6.yml" - - ".github/workflows/iOS-Qt5.yml" - - ".github/workflows/iOS-Qt6.yml" - - ".github/workflows/Linux-Qt5.yml" - - ".github/workflows/Linux-Qt6.yml" - - ".github/workflows/macOS-Qt5.yml" - - ".github/workflows/macOS-Qt6.yml" - - ".github/workflows/Windows-Qt6.yml" + # push: + # branches: + # - main + # tags: + # - '**' + # paths-ignore: + # - ".gitignore" + # - "README.md" + # # ignore CI for other platforms + # - ".github/FUNDING.yml" + # - ".github/actions/**" + # - ".github/workflows/Android-Qt5.yml" + # - ".github/workflows/Android-Qt6.yml" + # - ".github/workflows/iOS-Qt5.yml" + # - ".github/workflows/iOS-Qt6.yml" + # - ".github/workflows/Linux-Qt5.yml" + # - ".github/workflows/Linux-Qt6.yml" + # - ".github/workflows/macOS-Qt5.yml" + # - ".github/workflows/macOS-Qt6.yml" + # - ".github/workflows/Windows-Qt6.yml" + + # pull_request: + # branches: + # - main + # paths-ignore: + # - ".gitignore" + # - "README.md" + # # ignore CI for other platforms + # - ".github/FUNDING.yml" + # - ".github/actions/**" + # - ".github/workflows/Android-Qt5.yml" + # - ".github/workflows/Android-Qt6.yml" + # - ".github/workflows/iOS-Qt5.yml" + # - ".github/workflows/iOS-Qt6.yml" + # - ".github/workflows/Linux-Qt5.yml" + # - ".github/workflows/Linux-Qt6.yml" + # - ".github/workflows/macOS-Qt5.yml" + # - ".github/workflows/macOS-Qt6.yml" + # - ".github/workflows/Windows-Qt6.yml" concurrency: # cancel jobs on PRs only @@ -270,7 +270,7 @@ jobs: env: TAG_ARCH: ${{ matrix.config.qtarch }} run: | - pushd install/a/qt-geoservices-maplibre-gl + pushd install/a/maplibre-native-qt tar cjvf ../../../qt-geoservices-maplibre-gl_Windows_${TAG_ARCH}.tar.bz2 Qt popd diff --git a/.github/workflows/Windows-Qt6.yml b/.github/workflows/Windows-Qt6.yml index d58c6cd..7828faf 100644 --- a/.github/workflows/Windows-Qt6.yml +++ b/.github/workflows/Windows-Qt6.yml @@ -2,45 +2,45 @@ name: Windows Qt6 CI on: workflow_dispatch: - push: - branches: - - main - tags: - - '**' - paths-ignore: - - ".gitignore" - - "README.md" - # ignore CI for other platforms - - ".github/FUNDING.yml" - - ".github/actions/**" - - ".github/workflows/Android-Qt5.yml" - - ".github/workflows/Android-Qt6.yml" - - ".github/workflows/iOS-Qt5.yml" - - ".github/workflows/iOS-Qt6.yml" - - ".github/workflows/Linux-Qt5.yml" - - ".github/workflows/Linux-Qt6.yml" - - ".github/workflows/macOS-Qt5.yml" - - ".github/workflows/macOS-Qt6.yml" - - ".github/workflows/Windows-Qt5.yml" - - pull_request: - branches: - - main - paths-ignore: - - ".gitignore" - - "README.md" - # ignore CI for other platforms - - ".github/FUNDING.yml" - - ".github/actions/**" - - ".github/workflows/Android-Qt5.yml" - - ".github/workflows/Android-Qt6.yml" - - ".github/workflows/iOS-Qt5.yml" - - ".github/workflows/iOS-Qt6.yml" - - ".github/workflows/Linux-Qt5.yml" - - ".github/workflows/Linux-Qt6.yml" - - ".github/workflows/macOS-Qt5.yml" - - ".github/workflows/macOS-Qt6.yml" - - ".github/workflows/Windows-Qt5.yml" + # push: + # branches: + # - main + # tags: + # - '**' + # paths-ignore: + # - ".gitignore" + # - "README.md" + # # ignore CI for other platforms + # - ".github/FUNDING.yml" + # - ".github/actions/**" + # - ".github/workflows/Android-Qt5.yml" + # - ".github/workflows/Android-Qt6.yml" + # - ".github/workflows/iOS-Qt5.yml" + # - ".github/workflows/iOS-Qt6.yml" + # - ".github/workflows/Linux-Qt5.yml" + # - ".github/workflows/Linux-Qt6.yml" + # - ".github/workflows/macOS-Qt5.yml" + # - ".github/workflows/macOS-Qt6.yml" + # - ".github/workflows/Windows-Qt5.yml" + + # pull_request: + # branches: + # - main + # paths-ignore: + # - ".gitignore" + # - "README.md" + # # ignore CI for other platforms + # - ".github/FUNDING.yml" + # - ".github/actions/**" + # - ".github/workflows/Android-Qt5.yml" + # - ".github/workflows/Android-Qt6.yml" + # - ".github/workflows/iOS-Qt5.yml" + # - ".github/workflows/iOS-Qt6.yml" + # - ".github/workflows/Linux-Qt5.yml" + # - ".github/workflows/Linux-Qt6.yml" + # - ".github/workflows/macOS-Qt5.yml" + # - ".github/workflows/macOS-Qt6.yml" + # - ".github/workflows/Windows-Qt5.yml" concurrency: # cancel jobs on PRs only @@ -48,8 +48,7 @@ concurrency: cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} env: - QT_VERSION: 6.4.3 - QT_LOCATION_VERSION: 6.4.3.0 + QT_VERSION: 6.5.0 CCACHE_CONFIGPATH: C:/Users/runneradmin/AppData/Roaming/ccache/ccache.conf jobs: @@ -92,18 +91,9 @@ jobs: version: ${{ env.QT_VERSION }} target: desktop arch: ${{ matrix.config.arch }} - modules: qtpositioning qtshadertools + modules: qtlocation qtpositioning qtshadertools tools: ${{ matrix.config.tools }} - - name: Download QtLocation - shell: bash - env: - QT_PLATFORM: ${{ matrix.config.qtarch }} - run: | - choco upgrade wget - wget.exe https://github.com/ntadej/qtlocation/releases/download/v${QT_LOCATION_VERSION}/QtLocation_v${QT_LOCATION_VERSION}_Windows_${QT_PLATFORM}.tar.bz2 - tar xvf QtLocation_v${QT_LOCATION_VERSION}_Windows_${QT_PLATFORM}.tar.bz2 -C .. - - name: Setup ninja uses: seanmiddleditch/gha-setup-ninja@v3 @@ -147,7 +137,7 @@ jobs: env: TAG_ARCH: ${{ matrix.config.qtarch }} run: | - pushd install/a/qt-geoservices-maplibre-gl + pushd install/a/maplibre-native-qt tar cjvf ../../../qt-geoservices-maplibre-gl_Windows_${TAG_ARCH}.tar.bz2 Qt popd @@ -185,9 +175,6 @@ jobs: QT_ARCH: ${{ matrix.config.qtarch }} TAG_ARCH: ${{ matrix.config.outarch }} run: | - choco upgrade wget - wget.exe https://github.com/ntadej/qtlocation/releases/download/v${QT_LOCATION_VERSION}/QtLocation_v${QT_LOCATION_VERSION}_Windows_${QT_ARCH}.tar.bz2 - tar xvf QtLocation_v${QT_LOCATION_VERSION}_Windows_${QT_ARCH}.tar.bz2 tar xvf qt-geoservices-maplibre-gl_Windows_${QT_ARCH}.tar.bz2 tar cjvf qt-geoservices-maplibre-gl_${TAG_NAME}_Qt${QT_VERSION}_win64_${TAG_ARCH}.tar.bz2 Qt diff --git a/.github/workflows/iOS-Qt5.yml b/.github/workflows/iOS-Qt5.yml index 10d563c..101e3a1 100644 --- a/.github/workflows/iOS-Qt5.yml +++ b/.github/workflows/iOS-Qt5.yml @@ -2,45 +2,45 @@ name: iOS Qt5 CI on: workflow_dispatch: - push: - branches: - - main - tags: - - '**' - paths-ignore: - - ".gitignore" - - "README.md" - # ignore CI for other platforms - - ".github/FUNDING.yml" - - ".github/actions/**" - - ".github/workflows/Android-Qt5.yml" - - ".github/workflows/Android-Qt6.yml" - - ".github/workflows/iOS-Qt6.yml" - - ".github/workflows/Linux-Qt5.yml" - - ".github/workflows/Linux-Qt6.yml" - - ".github/workflows/macOS-Qt5.yml" - - ".github/workflows/macOS-Qt6.yml" - - ".github/workflows/Windows-Qt5.yml" - - ".github/workflows/Windows-Qt6.yml" - - pull_request: - branches: - - main - paths-ignore: - - ".gitignore" - - "README.md" - # ignore CI for other platforms - - ".github/FUNDING.yml" - - ".github/actions/**" - - ".github/workflows/Android-Qt5.yml" - - ".github/workflows/Android-Qt6.yml" - - ".github/workflows/iOS-Qt6.yml" - - ".github/workflows/Linux-Qt5.yml" - - ".github/workflows/Linux-Qt6.yml" - - ".github/workflows/macOS-Qt5.yml" - - ".github/workflows/macOS-Qt6.yml" - - ".github/workflows/Windows-Qt5.yml" - - ".github/workflows/Windows-Qt6.yml" + # push: + # branches: + # - main + # tags: + # - '**' + # paths-ignore: + # - ".gitignore" + # - "README.md" + # # ignore CI for other platforms + # - ".github/FUNDING.yml" + # - ".github/actions/**" + # - ".github/workflows/Android-Qt5.yml" + # - ".github/workflows/Android-Qt6.yml" + # - ".github/workflows/iOS-Qt6.yml" + # - ".github/workflows/Linux-Qt5.yml" + # - ".github/workflows/Linux-Qt6.yml" + # - ".github/workflows/macOS-Qt5.yml" + # - ".github/workflows/macOS-Qt6.yml" + # - ".github/workflows/Windows-Qt5.yml" + # - ".github/workflows/Windows-Qt6.yml" + + # pull_request: + # branches: + # - main + # paths-ignore: + # - ".gitignore" + # - "README.md" + # # ignore CI for other platforms + # - ".github/FUNDING.yml" + # - ".github/actions/**" + # - ".github/workflows/Android-Qt5.yml" + # - ".github/workflows/Android-Qt6.yml" + # - ".github/workflows/iOS-Qt6.yml" + # - ".github/workflows/Linux-Qt5.yml" + # - ".github/workflows/Linux-Qt6.yml" + # - ".github/workflows/macOS-Qt5.yml" + # - ".github/workflows/macOS-Qt6.yml" + # - ".github/workflows/Windows-Qt5.yml" + # - ".github/workflows/Windows-Qt6.yml" concurrency: # cancel jobs on PRs only @@ -119,7 +119,7 @@ jobs: - name: Create artifacts run: | - pushd install/Users/runner/work/qt-geoservices-maplibre-gl + pushd install/Users/runner/work/maplibre-native-qt tar cjvf ../../../../../QMapLibreGL_iOS.tar.bz2 Qt popd @@ -184,7 +184,7 @@ jobs: - name: Create artifacts run: | - pushd install/Users/runner/work/qt-geoservices-maplibre-gl + pushd install/Users/runner/work/maplibre-native-qt tar xvf ../../../../../QMapLibreGL_iOS.tar.bz2 tar cjvf ../../../../../qt-geoservices-maplibre-gl_iOS.tar.bz2 Qt popd diff --git a/.github/workflows/iOS-Qt6.yml b/.github/workflows/iOS-Qt6.yml index 786cd78..7ecff7e 100644 --- a/.github/workflows/iOS-Qt6.yml +++ b/.github/workflows/iOS-Qt6.yml @@ -2,45 +2,45 @@ name: iOS Qt6 CI on: workflow_dispatch: - push: - branches: - - main - tags: - - '**' - paths-ignore: - - ".gitignore" - - "README.md" - # ignore CI for other platforms - - ".github/FUNDING.yml" - - ".github/actions/**" - - ".github/workflows/Android-Qt5.yml" - - ".github/workflows/Android-Qt6.yml" - - ".github/workflows/iOS-Qt5.yml" - - ".github/workflows/Linux-Qt5.yml" - - ".github/workflows/Linux-Qt6.yml" - - ".github/workflows/macOS-Qt5.yml" - - ".github/workflows/macOS-Qt6.yml" - - ".github/workflows/Windows-Qt5.yml" - - ".github/workflows/Windows-Qt6.yml" - - pull_request: - branches: - - main - paths-ignore: - - ".gitignore" - - "README.md" - # ignore CI for other platforms - - ".github/FUNDING.yml" - - ".github/actions/**" - - ".github/workflows/Android-Qt5.yml" - - ".github/workflows/Android-Qt6.yml" - - ".github/workflows/iOS-Qt5.yml" - - ".github/workflows/Linux-Qt5.yml" - - ".github/workflows/Linux-Qt6.yml" - - ".github/workflows/macOS-Qt5.yml" - - ".github/workflows/macOS-Qt6.yml" - - ".github/workflows/Windows-Qt5.yml" - - ".github/workflows/Windows-Qt6.yml" + # push: + # branches: + # - main + # tags: + # - '**' + # paths-ignore: + # - ".gitignore" + # - "README.md" + # # ignore CI for other platforms + # - ".github/FUNDING.yml" + # - ".github/actions/**" + # - ".github/workflows/Android-Qt5.yml" + # - ".github/workflows/Android-Qt6.yml" + # - ".github/workflows/iOS-Qt5.yml" + # - ".github/workflows/Linux-Qt5.yml" + # - ".github/workflows/Linux-Qt6.yml" + # - ".github/workflows/macOS-Qt5.yml" + # - ".github/workflows/macOS-Qt6.yml" + # - ".github/workflows/Windows-Qt5.yml" + # - ".github/workflows/Windows-Qt6.yml" + + # pull_request: + # branches: + # - main + # paths-ignore: + # - ".gitignore" + # - "README.md" + # # ignore CI for other platforms + # - ".github/FUNDING.yml" + # - ".github/actions/**" + # - ".github/workflows/Android-Qt5.yml" + # - ".github/workflows/Android-Qt6.yml" + # - ".github/workflows/iOS-Qt5.yml" + # - ".github/workflows/Linux-Qt5.yml" + # - ".github/workflows/Linux-Qt6.yml" + # - ".github/workflows/macOS-Qt5.yml" + # - ".github/workflows/macOS-Qt6.yml" + # - ".github/workflows/Windows-Qt5.yml" + # - ".github/workflows/Windows-Qt6.yml" concurrency: # cancel jobs on PRs only @@ -48,8 +48,7 @@ concurrency: cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} env: - QT_VERSION: 6.4.3 - QT_LOCATION_VERSION: 6.4.3.0 + QT_VERSION: 6.5.0 jobs: build-plugin: @@ -75,7 +74,7 @@ jobs: aqtversion: ==3.0.* version: ${{ env.QT_VERSION }} target: desktop - modules: qtpositioning qtshadertools + modules: qtlocation qtpositioning qtshadertools set-env: false - name: Download Qt (iOS) @@ -84,12 +83,7 @@ jobs: aqtversion: ==3.0.* version: ${{ env.QT_VERSION }} target: ios - modules: qtpositioning qtshadertools - - - name: Download QtLocation - run: | - wget https://github.com/ntadej/qtlocation/releases/download/v${QT_LOCATION_VERSION}/QtLocation_v${QT_LOCATION_VERSION}_iOS.tar.bz2 - tar xvf QtLocation_v${QT_LOCATION_VERSION}_iOS.tar.bz2 -C .. + modules: qtlocation qtpositioning qtshadertools - name: Setup ninja uses: seanmiddleditch/gha-setup-ninja@v3 @@ -130,7 +124,7 @@ jobs: - name: Create artifacts run: | - pushd install/Users/runner/work/qt-geoservices-maplibre-gl + pushd install/Users/runner/work/maplibre-native-qt tar cjvf ../../../../../qt-geoservices-maplibre-gl_iOS.tar.bz2 Qt popd @@ -158,8 +152,6 @@ jobs: env: TAG_NAME: ${{ github.ref_name }} run: | - wget https://github.com/ntadej/qtlocation/releases/download/v${QT_LOCATION_VERSION}/QtLocation_v${QT_LOCATION_VERSION}_iOS.tar.bz2 - tar xvf QtLocation_v${QT_LOCATION_VERSION}_iOS.tar.bz2 tar xvf qt-geoservices-maplibre-gl_iOS.tar.bz2 tar cjvf qt-geoservices-maplibre-gl_${TAG_NAME}_Qt${QT_VERSION}_iOS.tar.bz2 Qt diff --git a/.github/workflows/macOS-Qt5.yml b/.github/workflows/macOS-Qt5.yml index a901afa..4028178 100644 --- a/.github/workflows/macOS-Qt5.yml +++ b/.github/workflows/macOS-Qt5.yml @@ -155,7 +155,7 @@ jobs: - name: Create artifacts run: | - pushd install/Users/runner/work/qt-geoservices-maplibre-gl + pushd install/Users/runner/work/maplibre-native-qt tar cjvf ../../../../../qt-geoservices-maplibre-gl_macOS.tar.bz2 Qt popd diff --git a/.github/workflows/macOS-Qt6.yml b/.github/workflows/macOS-Qt6.yml index a4b70ce..850472a 100644 --- a/.github/workflows/macOS-Qt6.yml +++ b/.github/workflows/macOS-Qt6.yml @@ -2,45 +2,45 @@ name: macOS Qt6 CI on: workflow_dispatch: - push: - branches: - - main - tags: - - '**' - paths-ignore: - - ".gitignore" - - "README.md" - # ignore CI for other platforms - - ".github/FUNDING.yml" - - ".github/actions/**" - - ".github/workflows/Android-Qt5.yml" - - ".github/workflows/Android-Qt6.yml" - - ".github/workflows/iOS-Qt5.yml" - - ".github/workflows/iOS-Qt6.yml" - - ".github/workflows/Linux-Qt5.yml" - - ".github/workflows/Linux-Qt6.yml" - - ".github/workflows/macOS-Qt5.yml" - - ".github/workflows/Windows-Qt5.yml" - - ".github/workflows/Windows-Qt6.yml" - - pull_request: - branches: - - main - paths-ignore: - - ".gitignore" - - "README.md" - # ignore CI for other platforms - - ".github/FUNDING.yml" - - ".github/actions/**" - - ".github/workflows/Android-Qt5.yml" - - ".github/workflows/Android-Qt6.yml" - - ".github/workflows/iOS-Qt5.yml" - - ".github/workflows/iOS-Qt6.yml" - - ".github/workflows/Linux-Qt5.yml" - - ".github/workflows/Linux-Qt6.yml" - - ".github/workflows/macOS-Qt5.yml" - - ".github/workflows/Windows-Qt5.yml" - - ".github/workflows/Windows-Qt6.yml" + # push: + # branches: + # - main + # tags: + # - '**' + # paths-ignore: + # - ".gitignore" + # - "README.md" + # # ignore CI for other platforms + # - ".github/FUNDING.yml" + # - ".github/actions/**" + # - ".github/workflows/Android-Qt5.yml" + # - ".github/workflows/Android-Qt6.yml" + # - ".github/workflows/iOS-Qt5.yml" + # - ".github/workflows/iOS-Qt6.yml" + # - ".github/workflows/Linux-Qt5.yml" + # - ".github/workflows/Linux-Qt6.yml" + # - ".github/workflows/macOS-Qt5.yml" + # - ".github/workflows/Windows-Qt5.yml" + # - ".github/workflows/Windows-Qt6.yml" + + # pull_request: + # branches: + # - main + # paths-ignore: + # - ".gitignore" + # - "README.md" + # # ignore CI for other platforms + # - ".github/FUNDING.yml" + # - ".github/actions/**" + # - ".github/workflows/Android-Qt5.yml" + # - ".github/workflows/Android-Qt6.yml" + # - ".github/workflows/iOS-Qt5.yml" + # - ".github/workflows/iOS-Qt6.yml" + # - ".github/workflows/Linux-Qt5.yml" + # - ".github/workflows/Linux-Qt6.yml" + # - ".github/workflows/macOS-Qt5.yml" + # - ".github/workflows/Windows-Qt5.yml" + # - ".github/workflows/Windows-Qt6.yml" concurrency: # cancel jobs on PRs only @@ -75,12 +75,7 @@ jobs: aqtversion: ==3.0.* version: ${{ env.QT_VERSION }} target: desktop - modules: qtpositioning qtshadertools - - - name: Download QtLocation - run: | - wget https://github.com/ntadej/qtlocation/releases/download/v${QT_LOCATION_VERSION}/QtLocation_v${QT_LOCATION_VERSION}_macOS.tar.bz2 - tar xvf QtLocation_v${QT_LOCATION_VERSION}_macOS.tar.bz2 -C .. + modules: qtlocation qtpositioning qtshadertools - name: Setup ninja uses: seanmiddleditch/gha-setup-ninja@v3 @@ -107,7 +102,7 @@ jobs: - name: Create artifacts run: | - pushd install/Users/runner/work/qt-geoservices-maplibre-gl + pushd install/Users/runner/work/maplibre-native-qt tar cjvf ../../../../../qt-geoservices-maplibre-gl_macOS.tar.bz2 Qt popd @@ -135,8 +130,6 @@ jobs: env: TAG_NAME: ${{ github.ref_name }} run: | - wget https://github.com/ntadej/qtlocation/releases/download/v${QT_LOCATION_VERSION}/QtLocation_v${QT_LOCATION_VERSION}_macOS.tar.bz2 - tar xvf QtLocation_v${QT_LOCATION_VERSION}_macOS.tar.bz2 tar xvf qt-geoservices-maplibre-gl_macOS.tar.bz2 tar cjvf qt-geoservices-maplibre-gl_${TAG_NAME}_Qt${QT_VERSION}_macOS.tar.bz2 Qt diff --git a/README.md b/README.md index bb61ed1..ba91c63 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,12 @@ ![MapLibre Logo](https://maplibre.org/img/maplibre-logo-big.svg) -# qt-geoservices-maplibre-gl +# maplibre-native-qt -Qt Location MapLibre GL Plugin +MapLibre Native Qt bindings and Qt Location MapLibre Plugin + +**Important notice:** Repository is being reorganised for Qt 6.5 support. +Some features will go away temporarily and API will change also for older +releases in the upcoming version 3.0 of the Qt bindings and Qt Location plugin. ## How to build? @@ -11,7 +15,7 @@ Qt Location MapLibre GL Plugin Both plugin and MapLibre build in one step. Ninja is recommended. ```shell -qt-cmake ../qt-geoservices-maplibre-gl -GNinja +qt-cmake ../maplibre-native-qt -GNinja ninja ninja install ``` @@ -36,14 +40,14 @@ Then the plugin is built separately. To build the plugin run in a separate build directory: ```shell -qmake ../qt-geoservices-maplibre-g QMAPLIBREGL_PATH=../install-qmaplibregl +qmake ../maplibre-native-qt QMAPLIBREGL_PATH=../install-qmaplibregl make make install ``` ## Copyright -Copyright (C) 2022 MapLibre contributors +Copyright (C) 2023 MapLibre contributors This project may be used under the terms of either GNU General Public License version 2.0, GNU General Public License version 3.0 or GNU Lesser General Public License version 3.0. diff --git a/src/qgeomapmaplibregl.cpp b/src/qgeomapmaplibregl.cpp index 5a21838..1c8d3d8 100644 --- a/src/qgeomapmaplibregl.cpp +++ b/src/qgeomapmaplibregl.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2022 MapLibre contributors +// Copyright (C) 2023 MapLibre contributors // Copyright (C) 2017 The Qt Company Ltd. // Copyright (C) 2017 Mapbox, Inc. @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -143,31 +142,6 @@ QSGNode *QGeoMapMapLibreGLPrivate::updateSceneGraph(QSGNode *node, QQuickWindow return node; } -void QGeoMapMapLibreGLPrivate::addParameter(QGeoMapParameter *param) -{ - Q_Q(QGeoMapMapLibreGL); - - QObject::connect(param, &QGeoMapParameter::propertyUpdated, q, - &QGeoMapMapLibreGL::onParameterPropertyUpdated); - - if (m_styleLoaded) { - m_styleChanges << QMapLibreGLStyleChange::addMapParameter(param); - emit q->sgNodeChanged(); - } -} - -void QGeoMapMapLibreGLPrivate::removeParameter(QGeoMapParameter *param) -{ - Q_Q(QGeoMapMapLibreGL); - - q->disconnect(param); - - if (m_styleLoaded) { - m_styleChanges << QMapLibreGLStyleChange::removeMapParameter(param); - emit q->sgNodeChanged(); - } -} - QGeoMap::ItemTypes QGeoMapMapLibreGLPrivate::supportedMapItemTypes() const { return QGeoMap::MapRectangle | QGeoMap::MapCircle | QGeoMap::MapPolygon | QGeoMap::MapPolyline; @@ -274,7 +248,11 @@ void QGeoMapMapLibreGLPrivate::changeCameraData(const QGeoCameraData &) emit q->sgNodeChanged(); } +#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) +void QGeoMapMapLibreGLPrivate::changeActiveMapType(const QGeoMapType &) +#else void QGeoMapMapLibreGLPrivate::changeActiveMapType(const QGeoMapType) +#endif { Q_Q(QGeoMapMapLibreGL); @@ -406,9 +384,6 @@ void QGeoMapMapLibreGL::onMapChanged(QMapLibreGL::Map::MapChange change) for (QDeclarativeGeoMapItemBase *item : d->m_mapItems) d->m_styleChanges << QMapLibreGLStyleChange::addMapItem(item, d->m_mapItemsBefore); - - for (QGeoMapParameter *param : d->m_mapParameters) - d->m_styleChanges << QMapLibreGLStyleChange::addMapParameter(param); } } @@ -449,15 +424,6 @@ void QGeoMapMapLibreGL::onMapItemGeometryChanged() emit sgNodeChanged(); } -void QGeoMapMapLibreGL::onParameterPropertyUpdated(QGeoMapParameter *param, const char *) -{ - Q_D(QGeoMapMapLibreGL); - - d->m_styleChanges.append(QMapLibreGLStyleChange::addMapParameter(param)); - - emit sgNodeChanged(); -} - void QGeoMapMapLibreGL::copyrightsChangedHandler(const QString ©rightsHtml) { Q_D(QGeoMapMapLibreGL); diff --git a/src/qgeomapmaplibregl.h b/src/qgeomapmaplibregl.h index abf8487..f0c532e 100644 --- a/src/qgeomapmaplibregl.h +++ b/src/qgeomapmaplibregl.h @@ -1,4 +1,4 @@ -// Copyright (C) 2022 MapLibre contributors +// Copyright (C) 2023 MapLibre contributors // Copyright (C) 2017 The Qt Company Ltd. // Copyright (C) 2017 Mapbox, Inc. @@ -9,7 +9,6 @@ #include "qgeomappingmanagerenginemaplibregl.h" #include -#include #include @@ -40,9 +39,6 @@ private Q_SLOTS: void onMapItemUnsupportedPropertyChanged(); void onMapItemGeometryChanged(); - // QGeoMapParameter - void onParameterPropertyUpdated(QGeoMapParameter *param, const char *propertyName); - public Q_SLOTS: void copyrightsChangedHandler(const QString ©rightsHtml); diff --git a/src/qgeomapmaplibregl_p.h b/src/qgeomapmaplibregl_p.h index 2e03fad..7bb4a80 100644 --- a/src/qgeomapmaplibregl_p.h +++ b/src/qgeomapmaplibregl_p.h @@ -1,4 +1,4 @@ -// Copyright (C) 2022 MapLibre contributors +// Copyright (C) 2023 MapLibre contributors // Copyright (C) 2017 The Qt Company Ltd. // Copyright (C) 2017 Mapbox, Inc. @@ -14,7 +14,6 @@ #include #include #include -#include namespace QMapLibreGL { class Map; @@ -33,9 +32,6 @@ class QGeoMapMapLibreGLPrivate : public QGeoMapPrivate QSGNode *updateSceneGraph(QSGNode *oldNode, QQuickWindow *window); - void addParameter(QGeoMapParameter *param) override; - void removeParameter(QGeoMapParameter *param) override; - QGeoMap::ItemTypes supportedMapItemTypes() const override; void addMapItem(QDeclarativeGeoMapItemBase *item) override; void removeMapItem(QDeclarativeGeoMapItemBase *item) override; @@ -67,7 +63,11 @@ class QGeoMapMapLibreGLPrivate : public QGeoMapPrivate protected: void changeViewportSize(const QSize &size) override; void changeCameraData(const QGeoCameraData &oldCameraData) override; +#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) + void changeActiveMapType(const QGeoMapType &mapType) override; +#else void changeActiveMapType(const QGeoMapType mapType) override; +#endif void setVisibleArea(const QRectF &visibleArea) override; QRectF visibleArea() const override; diff --git a/src/qgeoserviceproviderpluginmaplibregl.h b/src/qgeoserviceproviderpluginmaplibregl.h index 90a2464..c4ef864 100644 --- a/src/qgeoserviceproviderpluginmaplibregl.h +++ b/src/qgeoserviceproviderpluginmaplibregl.h @@ -1,4 +1,4 @@ -// Copyright (C) 2022 MapLibre contributors +// Copyright (C) 2023 MapLibre contributors // Copyright (C) 2017 The Qt Company Ltd. // Copyright (C) 2017 Mapbox, Inc. @@ -16,8 +16,13 @@ class QGeoServiceProviderFactoryMapLibreGL: public QObject, public QGeoServicePr { Q_OBJECT Q_INTERFACES(QGeoServiceProviderFactory) +#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) + Q_PLUGIN_METADATA(IID "org.qt-project.qt.geoservice.serviceproviderfactory/6.0" + FILE "maplibregl_plugin.json") +#else Q_PLUGIN_METADATA(IID "org.qt-project.qt.geoservice.serviceproviderfactory/5.0" FILE "maplibregl_plugin.json") +#endif public: QGeoServiceProviderFactoryMapLibreGL(); diff --git a/src/qmaplibreglstylechange.cpp b/src/qmaplibreglstylechange.cpp index 82a24ed..7aaf25a 100644 --- a/src/qmaplibreglstylechange.cpp +++ b/src/qmaplibreglstylechange.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2022 MapLibre contributors +// Copyright (C) 2023 MapLibre contributors // Copyright (C) 2017 Mapbox, Inc. // SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only @@ -18,18 +18,6 @@ namespace { -QByteArray formatPropertyName(const QByteArray &name) -{ - QString nameAsString = QString::fromLatin1(name); - static const QRegularExpression camelCaseRegex(QStringLiteral("([a-z0-9])([A-Z])")); - return nameAsString.replace(camelCaseRegex, QStringLiteral("\\1-\\2")).toLower().toLatin1(); -} - -bool isImmutableProperty(const QByteArray &name) -{ - return name == QStringLiteral("type") || name == QStringLiteral("layer"); -} - QString getId(QDeclarativeGeoMapItemBase *mapItem) { return QStringLiteral("QtLocation-") + @@ -63,10 +51,21 @@ QMapLibreGL::Feature featureFromMapCircle(QDeclarativeCircleMapItem *mapItem) { static const int circleSamples = 128; const QGeoProjectionWebMercator &p = static_cast(mapItem->map()->geoProjection()); +#if QT_VERSION < QT_VERSION_CHECK(6, 5, 0) QList path; QGeoCoordinate leftBound; QDeclarativeCircleMapItemPrivate::calculatePeripheralPoints(path, mapItem->center(), mapItem->radius(), circleSamples, leftBound); +#endif QList pathProjected; +#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) + QDeclarativeCircleMapItemPrivate::calculatePeripheralPoints(pathProjected, mapItem->center(), mapItem->radius(), p, circleSamples); + // TODO: Removed for now. Update when the 6.6 API for this is fixed + // if (QDeclarativeCircleMapItemPrivateCPU::crossEarthPole(mapItem->center(), mapItem->radius())) + // QDeclarativeCircleMapItemPrivateCPU::preserveCircleGeometry(pathProjected, mapItem->center(), mapItem->radius(), p); + QList path; + for (const QDoubleVector2D &c : std::as_const(pathProjected)) + path << p.mapProjectionToGeo(c); +#else for (const QGeoCoordinate &c : qAsConst(path)) pathProjected << p.geoToMapProjection(c); if (QDeclarativeCircleMapItemPrivateCPU::crossEarthPole(mapItem->center(), mapItem->radius())) @@ -74,6 +73,7 @@ QMapLibreGL::Feature featureFromMapCircle(QDeclarativeCircleMapItem *mapItem) path.clear(); for (const QDoubleVector2D &c : qAsConst(pathProjected)) path << p.mapProjectionToGeo(c); +#endif QMapLibreGL::Coordinates coordinates; @@ -155,56 +155,10 @@ QMapLibreGL::Feature featureFromMapItem(QDeclarativeGeoMapItemBase *item) } } -QList getAllPropertyNamesList(QObject *object) -{ - const QMetaObject *metaObject = object->metaObject(); - QList propertyNames(object->dynamicPropertyNames()); - for (int i = metaObject->propertyOffset(); i < metaObject->propertyCount(); ++i) { - propertyNames.append(metaObject->property(i).name()); - } - return propertyNames; -} - } // namespace // QMapLibreGLStyleChange - -QList> QMapLibreGLStyleChange::addMapParameter(QGeoMapParameter *param) -{ - static const QStringList acceptedParameterTypes = QStringList() - << QStringLiteral("paint") << QStringLiteral("layout") << QStringLiteral("filter") - << QStringLiteral("layer") << QStringLiteral("source") << QStringLiteral("image"); - - QList> changes; - - switch (acceptedParameterTypes.indexOf(param->type())) { - case -1: - qWarning() << "Invalid value for property 'type': " + param->type(); - break; - case 0: // paint - changes << QMapLibreGLStyleSetPaintProperty::fromMapParameter(param); - break; - case 1: // layout - changes << QMapLibreGLStyleSetLayoutProperty::fromMapParameter(param); - break; - case 2: // filter - changes << QMapLibreGLStyleSetFilter::fromMapParameter(param); - break; - case 3: // layer - changes << QMapLibreGLStyleAddLayer::fromMapParameter(param); - break; - case 4: // source - changes << QMapLibreGLStyleAddSource::fromMapParameter(param); - break; - case 5: // image - changes << QMapLibreGLStyleAddImage::fromMapParameter(param); - break; - } - - return changes; -} - QList> QMapLibreGLStyleChange::addMapItem(QDeclarativeGeoMapItemBase *item, const QString &before) { QList> changes; @@ -230,35 +184,6 @@ QList> QMapLibreGLStyleChange::addMapItem return changes; } -QList> QMapLibreGLStyleChange::removeMapParameter(QGeoMapParameter *param) -{ - static const QStringList acceptedParameterTypes = QStringList() - << QStringLiteral("paint") << QStringLiteral("layout") << QStringLiteral("filter") - << QStringLiteral("layer") << QStringLiteral("source") << QStringLiteral("image"); - - QList> changes; - - switch (acceptedParameterTypes.indexOf(param->type())) { - case -1: - qWarning() << "Invalid value for property 'type': " + param->type(); - break; - case 0: // paint - case 1: // layout - case 2: // filter - break; - case 3: // layer - changes << QSharedPointer(new QMapLibreGLStyleRemoveLayer(param->property("name").toString())); - break; - case 4: // source - changes << QSharedPointer(new QMapLibreGLStyleRemoveSource(param->property("name").toString())); - break; - case 5: // image - break; - } - - return changes; -} - QList> QMapLibreGLStyleChange::removeMapItem(QDeclarativeGeoMapItemBase *item) { QList> changes; @@ -278,33 +203,6 @@ void QMapLibreGLStyleSetLayoutProperty::apply(QMapLibreGL::Map *map) map->setLayoutProperty(m_layer, m_property, m_value); } -QList> QMapLibreGLStyleSetLayoutProperty::fromMapParameter(QGeoMapParameter *param) -{ - Q_ASSERT(param->type() == "layout"); - - QList> changes; - - QList propertyNames = getAllPropertyNamesList(param); - for (const QByteArray &propertyName : propertyNames) { - if (isImmutableProperty(propertyName)) - continue; - - auto layout = new QMapLibreGLStyleSetLayoutProperty(); - - layout->m_value = param->property(propertyName); - if (layout->m_value.canConvert()) { - layout->m_value = layout->m_value.value().toVariant(); - } - - layout->m_layer = param->property("layer").toString(); - layout->m_property = formatPropertyName(propertyName); - - changes << QSharedPointer(layout); - } - - return changes; -} - QList> QMapLibreGLStyleSetLayoutProperty::fromMapItem(QDeclarativeGeoMapItemBase *item) { QList> changes; @@ -355,33 +253,6 @@ void QMapLibreGLStyleSetPaintProperty::apply(QMapLibreGL::Map *map) map->setPaintProperty(m_layer, m_property, m_value); } -QList> QMapLibreGLStyleSetPaintProperty::fromMapParameter(QGeoMapParameter *param) -{ - Q_ASSERT(param->type() == "paint"); - - QList> changes; - - QList propertyNames = getAllPropertyNamesList(param); - for (const QByteArray &propertyName : propertyNames) { - if (isImmutableProperty(propertyName)) - continue; - - auto paint = new QMapLibreGLStyleSetPaintProperty(); - - paint->m_value = param->property(propertyName); - if (paint->m_value.canConvert()) { - paint->m_value = paint->m_value.value().toVariant(); - } - - paint->m_layer = param->property("layer").toString(); - paint->m_property = formatPropertyName(propertyName); - - changes << QSharedPointer(paint); - } - - return changes; -} - QList> QMapLibreGLStyleSetPaintProperty::fromMapItem(QDeclarativeGeoMapItemBase *item) { switch (item->itemType()) { @@ -474,41 +345,6 @@ void QMapLibreGLStyleAddLayer::apply(QMapLibreGL::Map *map) map->addLayer(m_params, m_before); } -QSharedPointer QMapLibreGLStyleAddLayer::fromMapParameter(QGeoMapParameter *param) -{ - Q_ASSERT(param->type() == "layer"); - - auto layer = new QMapLibreGLStyleAddLayer(); - - static const QStringList layerProperties = QStringList() - << QStringLiteral("name") << QStringLiteral("layerType") << QStringLiteral("before"); - - QList propertyNames = getAllPropertyNamesList(param); - for (const QByteArray &propertyName : propertyNames) { - if (isImmutableProperty(propertyName)) - continue; - - const QVariant value = param->property(propertyName); - - switch (layerProperties.indexOf(propertyName)) { - case -1: - layer->m_params[formatPropertyName(propertyName)] = value; - break; - case 0: // name - layer->m_params[QStringLiteral("id")] = value; - break; - case 1: // layerType - layer->m_params[QStringLiteral("type")] = value; - break; - case 2: // before - layer->m_before = value.toString(); - break; - } - } - - return QSharedPointer(layer); -} - QSharedPointer QMapLibreGLStyleAddLayer::fromFeature(const QMapLibreGL::Feature &feature, const QString &before) { auto layer = new QMapLibreGLStyleAddLayer(); @@ -552,55 +388,6 @@ void QMapLibreGLStyleAddSource::apply(QMapLibreGL::Map *map) map->updateSource(m_id, m_params); } -QSharedPointer QMapLibreGLStyleAddSource::fromMapParameter(QGeoMapParameter *param) -{ - Q_ASSERT(param->type() == "source"); - - static const QStringList acceptedSourceTypes = QStringList() - << QStringLiteral("vector") << QStringLiteral("raster") << QStringLiteral("raster-dem") << QStringLiteral("geojson") << QStringLiteral("image"); - - QString sourceType = param->property("sourceType").toString(); - - auto source = new QMapLibreGLStyleAddSource(); - source->m_id = param->property("name").toString(); - source->m_params[QStringLiteral("type")] = sourceType; - - switch (acceptedSourceTypes.indexOf(sourceType)) { - case -1: - qWarning() << "Invalid value for property 'sourceType': " + sourceType; - break; - case 0: // vector - case 1: // raster - case 2: // raster-dem - if (param->hasProperty("url")) { - source->m_params[QStringLiteral("url")] = param->property("url"); - } - if (param->hasProperty("tiles")) { - source->m_params[QStringLiteral("tiles")] = param->property("tiles"); - } - if (param->hasProperty("tileSize")) { - source->m_params[QStringLiteral("tileSize")] = param->property("tileSize"); - } - break; - case 3: { // geojson - auto data = param->property("data").toString(); - if (data.startsWith(':')) { - QFile geojson(data); - geojson.open(QIODevice::ReadOnly); - source->m_params[QStringLiteral("data")] = geojson.readAll(); - } else { - source->m_params[QStringLiteral("data")] = data.toUtf8(); - } - } break; - case 4: { // image - source->m_params[QStringLiteral("url")] = param->property("url"); - source->m_params[QStringLiteral("coordinates")] = param->property("coordinates"); - } break; - } - - return QSharedPointer(source); -} - QSharedPointer QMapLibreGLStyleAddSource::fromFeature(const QMapLibreGL::Feature &feature) { auto source = new QMapLibreGLStyleAddSource(); @@ -637,17 +424,6 @@ void QMapLibreGLStyleSetFilter::apply(QMapLibreGL::Map *map) map->setFilter(m_layer, m_filter); } -QSharedPointer QMapLibreGLStyleSetFilter::fromMapParameter(QGeoMapParameter *param) -{ - Q_ASSERT(param->type() == "filter"); - - auto filter = new QMapLibreGLStyleSetFilter(); - filter->m_layer = param->property("layer").toString(); - filter->m_filter = param->property("filter"); - - return QSharedPointer(filter); -} - // QMapLibreGLStyleAddImage @@ -655,14 +431,3 @@ void QMapLibreGLStyleAddImage::apply(QMapLibreGL::Map *map) { map->addImage(m_name, m_sprite); } - -QSharedPointer QMapLibreGLStyleAddImage::fromMapParameter(QGeoMapParameter *param) -{ - Q_ASSERT(param->type() == "image"); - - auto image = new QMapLibreGLStyleAddImage(); - image->m_name = param->property("name").toString(); - image->m_sprite = QImage(param->property("sprite").toString()); - - return QSharedPointer(image); -} diff --git a/src/qmaplibreglstylechange_p.h b/src/qmaplibreglstylechange_p.h index 4e6bed0..6bd22c4 100644 --- a/src/qmaplibreglstylechange_p.h +++ b/src/qmaplibreglstylechange_p.h @@ -1,4 +1,4 @@ -// Copyright (C) 2022 MapLibre contributors +// Copyright (C) 2023 MapLibre contributors // Copyright (C) 2017 Mapbox, Inc. // SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only @@ -17,7 +17,6 @@ #include #include #include -#include #include @@ -30,9 +29,7 @@ class QMapLibreGLStyleChange public: virtual ~QMapLibreGLStyleChange() = default; - static QList> addMapParameter(QGeoMapParameter *); static QList> addMapItem(QDeclarativeGeoMapItemBase *, const QString &before); - static QList> removeMapParameter(QGeoMapParameter *); static QList> removeMapItem(QDeclarativeGeoMapItemBase *); virtual void apply(QMapLibreGL::Map *map) = 0; @@ -41,7 +38,6 @@ class QMapLibreGLStyleChange class QMapLibreGLStyleSetLayoutProperty : public QMapLibreGLStyleChange { public: - static QList> fromMapParameter(QGeoMapParameter *); static QList> fromMapItem(QDeclarativeGeoMapItemBase *); void apply(QMapLibreGL::Map *map) override; @@ -60,7 +56,6 @@ class QMapLibreGLStyleSetLayoutProperty : public QMapLibreGLStyleChange class QMapLibreGLStyleSetPaintProperty : public QMapLibreGLStyleChange { public: - static QList> fromMapParameter(QGeoMapParameter *); static QList> fromMapItem(QDeclarativeGeoMapItemBase *); void apply(QMapLibreGL::Map *map) override; @@ -82,7 +77,6 @@ class QMapLibreGLStyleSetPaintProperty : public QMapLibreGLStyleChange class QMapLibreGLStyleAddLayer : public QMapLibreGLStyleChange { public: - static QSharedPointer fromMapParameter(QGeoMapParameter *); static QSharedPointer fromFeature(const QMapLibreGL::Feature &feature, const QString &before); void apply(QMapLibreGL::Map *map) override; @@ -110,7 +104,6 @@ class QMapLibreGLStyleRemoveLayer : public QMapLibreGLStyleChange class QMapLibreGLStyleAddSource : public QMapLibreGLStyleChange { public: - static QSharedPointer fromMapParameter(QGeoMapParameter *); static QSharedPointer fromFeature(const QMapLibreGL::Feature &feature); static QSharedPointer fromMapItem(QDeclarativeGeoMapItemBase *); @@ -139,8 +132,6 @@ class QMapLibreGLStyleRemoveSource : public QMapLibreGLStyleChange class QMapLibreGLStyleSetFilter : public QMapLibreGLStyleChange { public: - static QSharedPointer fromMapParameter(QGeoMapParameter *); - void apply(QMapLibreGL::Map *map) override; private: @@ -153,8 +144,6 @@ class QMapLibreGLStyleSetFilter : public QMapLibreGLStyleChange class QMapLibreGLStyleAddImage : public QMapLibreGLStyleChange { public: - static QSharedPointer fromMapParameter(QGeoMapParameter *); - void apply(QMapLibreGL::Map *map) override; private: diff --git a/src/qsgmaplibreglnode.cpp b/src/qsgmaplibreglnode.cpp index 8e280d2..d65d425 100644 --- a/src/qsgmaplibreglnode.cpp +++ b/src/qsgmaplibreglnode.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2022 MapLibre contributors +// Copyright (C) 2023 MapLibre contributors // Copyright (C) 2017 The Qt Company Ltd. // Copyright (C) 2017 Mapbox, Inc. @@ -7,7 +7,7 @@ #include "qsgmaplibreglnode.h" #include "qgeomapmaplibregl.h" -#if QT_HAS_INCLUDE() +#if __has_include() #include #endif diff --git a/src/qsgmaplibreglnode.h b/src/qsgmaplibreglnode.h index 786dd1d..be0dfe5 100644 --- a/src/qsgmaplibreglnode.h +++ b/src/qsgmaplibreglnode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2022 MapLibre contributors +// Copyright (C) 2023 MapLibre contributors // Copyright (C) 2017 The Qt Company Ltd. // Copyright (C) 2017 Mapbox, Inc. @@ -10,7 +10,6 @@ #include #include #include -#include #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #include #else