diff --git a/.ci/run_tests.sh b/.ci/run_tests.sh index cdc8d16c6990..79b0782af9a1 100755 --- a/.ci/run_tests.sh +++ b/.ci/run_tests.sh @@ -12,7 +12,13 @@ test -n "${DOCKER}" || { DOCKER_COMPOSE=$(command -v podman-compose docker-compose | head -1) test -n "${DOCKER_COMPOSE}" || { - DOCKER_COMPOSE="${DOCKER} compose" # TODO: check if supported + DOCKER_COMPOSE="${DOCKER} compose" + # check if supported + ${DOCKER_COMPOSE} > /dev/null || { + echo "Cannot find podman-compose or docker-compose, and '${DOCKER_COMPOSE}' fails" >&2 + echo "HINT: try installing podman-compose" >&2 + exit 1 + } } IMAGE_BUILD_DEPS=docker.io/qgis/qgis3-build-deps:latest diff --git a/.docker/qgis3-qt5-build-deps.dockerfile b/.docker/qgis3-qt5-build-deps.dockerfile index 173e0069a413..de30c642b56a 100644 --- a/.docker/qgis3-qt5-build-deps.dockerfile +++ b/.docker/qgis3-qt5-build-deps.dockerfile @@ -156,13 +156,14 @@ RUN apt-get update \ # HANA: client side # Install hdbsql tool -RUN curl -j -k -L -H "Cookie: eula_3_2_agreed=tools.hana.ondemand.com/developer-license-3_2.txt" https://tools.hana.ondemand.com/additional/hanaclient-latest-linux-x64.tar.gz --output hanaclient-latest-linux-x64.tar.gz \ - && tar -xvf hanaclient-latest-linux-x64.tar.gz \ - && mkdir /usr/sap \ - && ./client/hdbinst -a client --sapmnt=/usr/sap \ - && rm -rf client \ - && rm hanaclient* -ENV PATH="/usr/sap/hdbclient:${PATH}" +# Does not always work +# RUN curl -j -k -L -H "Cookie: eula_3_2_agreed=tools.hana.ondemand.com/developer-license-3_2.txt" https://tools.hana.ondemand.com/additional/hanaclient-latest-linux-x64.tar.gz --output hanaclient-latest-linux-x64.tar.gz \ +# && tar -xvf hanaclient-latest-linux-x64.tar.gz \ +# && mkdir /usr/sap \ +# && ./client/hdbinst -a client --sapmnt=/usr/sap \ +# && rm -rf client \ +# && rm hanaclient* +# ENV PATH="/usr/sap/hdbclient:${PATH}" # MSSQL: client side # RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 65bd04ff28a0..e325f63429f4 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -24,6 +24,7 @@ on: - master - release-** - queued_ltr_backports + - capture-profile-points # paths cannot be filtered on this workflow on pull request as it is a required one in the branch protection # feature request and hacks: https://github.community/t/feature-request-conditional-required-checks/16761 @@ -118,7 +119,7 @@ jobs: echo QT_VERSION: ${QT_VERSION} - name: Login to Docker Hub - if: ${{ github.event_name == 'push' && github.actor == 'qgis' }} + if: ${{ github.event_name == 'push' && github.repository == 'qgis/QGIS' }} uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} @@ -131,7 +132,7 @@ jobs: context: . file: .docker/qgis3-qt${{ matrix.qt-version }}-build-deps.dockerfile tags: qgis/qgis3-build-deps-${{ matrix.distro-version }}-qt${{ matrix.qt-version }}:${{ github.event.pull_request.base.ref || github.ref_name }} - push: ${{ github.event_name == 'push' && github.actor == 'qgis' }} + push: false pull: true build-args: DISTRO_VERSION=${{ matrix.distro-version }} @@ -296,12 +297,12 @@ jobs: run: | echo CTEST_BUILD_NAME: ${CTEST_BUILD_NAME} - - name: Login to Docker Hub - if: ${{ github.event_name == 'push' && github.actor == 'qgis' }} - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + # - name: Login to Docker Hub + # if: ${{ github.event_name == 'push' && github.actor == 'qgis' }} + # uses: docker/login-action@v3 + # with: + # username: ${{ secrets.DOCKER_USERNAME }} + # password: ${{ secrets.DOCKER_PASSWORD }} - name: Build Docker Container with Testing Environment id: docker-build @@ -310,7 +311,7 @@ jobs: context: . file: .docker/qgis3-qt${{ matrix.qt-version }}-build-deps.dockerfile tags: qgis/qgis3-qt${{ matrix.qt-version }}-build-deps-bin-only:${{ github.event.pull_request.base.ref || github.ref_name }} - push: ${{ github.event_name == 'push' && github.actor == 'qgis' }} + push: false pull: true target: ${{ matrix.docker-target }} build-args: @@ -408,7 +409,7 @@ jobs: fetch-depth: 2 - name: Login to Docker Hub - if: ${{ github.event_name == 'push' && github.actor == 'qgis' }} + if: ${{ github.event_name == 'push' && github.repository == 'qgis/QGIS' }} uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} @@ -421,7 +422,7 @@ jobs: context: . file: .docker/qgis3-qt${{ matrix.qt-version }}-build-deps.dockerfile tags: qgis/qgis3-qt${{ matrix.qt-version }}-build-deps-bin-only:${{ github.event.pull_request.base.ref || github.ref_name }} - push: ${{ github.event_name == 'push' && github.actor == 'qgis' }} + push: ${{ github.event_name == 'push' && github.repository == 'qgis/QGIS' }} pull: true target: ${{ matrix.docker-target }} build-args: diff --git a/CMakeLists.txt b/CMakeLists.txt index e283e40d65c1..5898713e3933 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ set(CMAKE_AUTORCC ON) # set path to additional CMake modules set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) # POLICIES -if(NOT "${CMAKE_VERSION}" VERSION_LESS "3.27") +if("${CMAKE_VERSION}" VERSION_GREATER_EQUAL "3.27") # include(Dart) still used, as is the "Experimental" target cmake_policy(SET CMP0145 OLD) endif() @@ -435,6 +435,10 @@ if(WITH_CORE) # required find_package(Proj REQUIRED) message(STATUS "Found Proj: ${PROJ_VERSION} ${PROJ_DIR}") + if(PROJ_VERSION VERSION_LESS "8.1") + message(FATAL_ERROR "Cannot build QGIS using Proj older than 8.1") + endif() + find_package(GEOS REQUIRED) message(STATUS "Found Geos: ${GEOS_VERSION} ${GEOS_DIR}") find_package(GDAL REQUIRED) @@ -691,8 +695,10 @@ if (ENABLE_TESTS) set (PUSH_TO_CDASH FALSE CACHE BOOL "Determines whether test results should be pushed to CDASH site") set(QT_USE_QTTEST TRUE) enable_testing() - # Adds some testing specific build targets e.g. make Experimental - include(Dart) + if (PUSH_TO_CDASH) + # Adds some testing specific build targets e.g. make Experimental + include(Dart) + endif() # Additional test configuration options e.g. max upload size of test report configure_file( "${CMAKE_SOURCE_DIR}/cmake_templates/CTestCustom.cmake.in" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 64e2d6d1364c..dcb7a8b6f7ea 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,10 +14,11 @@ You can help us **by submitting bug reports or fixing bugs** in the [QGIS bug tr If you wish to contribute patches you can: -1. [fork the project](https://help.github.com/forking/) -1. make your changes -1. commit to your repository -1. and then [create a pull request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/). +1. [Fork the project](https://help.github.com/forking/) +2. Install the [pre-commit](https://pre-commit.com/) hook: `pre-commit install --install-hooks` (version 4.1+ required) +3. Make your changes +4. Commit to your repository +5. [Create a pull request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) The development team can then review your contribution and commit it upstream as appropriate. diff --git a/INSTALL.md b/INSTALL.md index 6ab00d7f4a25..08a687695ec8 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -23,6 +23,7 @@ Building QGIS from source - step by step + [3.11.2. Suggested system tweaks](#3112-suggested-system-tweaks) + [3.11.3. Additional tools for QGIS development](#3113-additional-tools-for-qgis-development) + [3.11.4. QT6 experimental builds with Fedora Rawhide](#3114-qt6-experimental-builds-with-fedora-rawhide) + * [3.12. Building on Linux with vcpkg](#312-building-on-linux-with-vcpkg) - [4. Building on Windows](#4-building-on-windows) * [4.1. Building with Microsoft Visual Studio](#41-building-with-microsoft-visual-studio) + [4.1.1. Visual Studio 2022 Community Edition](#411-visual-studio-2022-community-edition) @@ -106,7 +107,7 @@ Required build tools: Required build dependencies: * Qt >= 5.15.2 -* Proj >= 7.2.0 +* Proj >= 8.1.0 * GEOS >= 3.9 * Sqlite3 >= 3.0.0 * SpatiaLite >= 4.2.0 @@ -581,11 +582,45 @@ To build, cmake .. -DBUILD_WITH_QT6=ON -DWITH_QTWEBKIT=OFF -DWITH_QTWEBENGINE=ON ``` +## 3.12. Building on Linux with vcpkg + +With [vcpkg](https://github.com/microsoft/vcpkg/) you can develop QGIS using +Qt6 on a Linux system. + +First, [Install and initialize vcpkg](https://github.com/microsoft/vcpkg-tool/blob/main/README.md#installuseremove). + +Get the QGIS source code: + +```sh +git clone git@github.com:qgis/QGIS.git +``` + +Configure: + +```sh +cmake -S . \ + -B ./build-x64-linux \ + -GNinja \ + -DCMAKE_BUILD_TYPE=Debug \ + -DWITH_VCPKG=ON \ + -DBUILD_WITH_QT6=ON \ + -DWITH_QTWEBKIT=OFF \ + -DWITH_BINDINGS=ON \ + -DVCPKG_TARGET_TRIPLET=x64-linux-dynamic-release \ + -DVCPKG_HOST_TRIPLET=x64-linux-dynamic-release +``` + +Build: + +```sh +cmake --build ./build-x64-linux +``` + # 4. Building on Windows ## 4.1. Building with Microsoft Visual Studio -This section describes how to build QGIS using Visual Studio (MSVC) 2019 on Windows. +This section describes how to build QGIS using Visual Studio (MSVC) 2022 on Windows. The official Windows packages are built using OSGeo4W. This section describes the setup required to allow Visual Studio to be used to @@ -593,7 +628,7 @@ build QGIS. ### 4.1.1. Visual Studio 2022 Community Edition -Download and install the [free (as in free beer) Community installer](https://download.visualstudio.microsoft.com/download/pr/68d6b204-9df0-4fcc-abcc-08ee0eff9cb2/b029547488a9383b0c8d8a9c813e246feb3ec19e0fe55020d4878fde5f0983fe/vs_Community.exe) +Download and install the [free (as in free beer) Community installer](https://c2rsetup.officeapps.live.com/c2r/downloadVS.aspx?sku=community&channel=Release&version=VS2022&source=VSLandingPage&cid=2030:7851336a02d44ba38a548acc719002df) Select "Desktop Development with C++" @@ -601,7 +636,7 @@ Select "Desktop Development with C++" Download and install following packages: -* [CMake](https://cmake.org/files/v3.12/cmake-3.12.3-win64-x64.msi) +* [CMake](https://github.com/Kitware/CMake/releases/download/v3.31.4/cmake-3.31.4-windows-x86_64.msi) * GNU flex, GNU bison and GIT with [cygwin 64bit](https://cygwin.com/setup-x86_64.exe) * [OSGeo4W](https://download.osgeo.org/osgeo4w/v2/osgeo4w-setup.exe) * [ninja](https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-win.zip): Copy the `ninja.exe` to `C:\OSGeo4W\bin\` diff --git a/cmake/FindProj.cmake b/cmake/FindProj.cmake index 3feb785fa6be..d32659f01406 100644 --- a/cmake/FindProj.cmake +++ b/cmake/FindProj.cmake @@ -30,7 +30,6 @@ if(NOT PROJ_FOUND) OR NOT CMAKE_FIND_FRAMEWORK) SET (CMAKE_FIND_FRAMEWORK_save ${CMAKE_FIND_FRAMEWORK} CACHE STRING "" FORCE) SET (CMAKE_FIND_FRAMEWORK "ONLY" CACHE STRING "" FORCE) - #FIND_PATH(PROJ_INCLUDE_DIR PROJ/proj_api.h) FIND_LIBRARY(PROJ_LIBRARY PROJ) IF (PROJ_LIBRARY) # FIND_PATH doesn't add "Headers" for a framework @@ -39,17 +38,11 @@ if(NOT PROJ_FOUND) SET (CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_save} CACHE STRING "" FORCE) ENDIF () ENDIF (APPLE) - - FIND_PATH(PROJ_INCLUDE_DIR proj_api.h + + FIND_PATH(PROJ_INCLUDE_DIR proj.h "$ENV{INCLUDE}" "$ENV{LIB_DIR}/include" - ) - IF (NOT PROJ_INCLUDE_DIR) - FIND_PATH(PROJ_INCLUDE_DIR proj.h - "$ENV{INCLUDE}" - "$ENV{LIB_DIR}/include" - ) - ENDIF (NOT PROJ_INCLUDE_DIR) + ) FIND_LIBRARY(PROJ_LIBRARY NAMES proj_i proj PATHS "$ENV{LIB}" @@ -67,27 +60,12 @@ if(NOT PROJ_FOUND) STRING(REGEX REPLACE "^.*PROJ_VERSION_MINOR +([0-9]+).*$" "\\1" PROJ_VERSION_MINOR "${proj_version}") STRING(REGEX REPLACE "^.*PROJ_VERSION_PATCH +([0-9]+).*$" "\\1" PROJ_VERSION_PATCH "${proj_version}") STRING(CONCAT PROJ_VERSION_STR "(" ${PROJ_VERSION_MAJOR} "." ${PROJ_VERSION_MINOR} "." ${PROJ_VERSION_PATCH} ")") - IF ((PROJ_VERSION_MAJOR EQUAL 7) AND ((PROJ_VERSION_MINOR LESS 2) OR (PROJ_VERSION_MAJOR LESS 7))) - MESSAGE (FATAL_ERROR "Cannot build QGIS using Proj ${PROJ_VERSION_MAJOR}.${PROJ_VERSION_MINOR}.${PROJ_VERSION_PATCH} Use 7.2.0 or higher.") - ENDIF ((PROJ_VERSION_MAJOR EQUAL 7) AND ((PROJ_VERSION_MINOR LESS 2) OR (PROJ_VERSION_MAJOR LESS 7))) - ELSE(EXISTS ${PROJ_INCLUDE_DIR}/proj.h AND EXISTS ${PROJ_INCLUDE_DIR}/proj_experimental.h) - FILE(READ ${PROJ_INCLUDE_DIR}/proj_api.h proj_version) - STRING(REGEX REPLACE "^.*PJ_VERSION ([0-9]+).*$" "\\1" PJ_VERSION "${proj_version}") - - # This will break if 4.10.0 ever will be released (highly unlikely) - STRING(REGEX REPLACE "([0-9])([0-9])([0-9])" "\\1" PROJ_VERSION_MAJOR "${PJ_VERSION}") - STRING(REGEX REPLACE "([0-9])([0-9])([0-9])" "\\2" PROJ_VERSION_MINOR "${PJ_VERSION}") - STRING(REGEX REPLACE "([0-9])([0-9])([0-9])" "\\3" PROJ_VERSION_PATCH "${PJ_VERSION}") - STRING(CONCAT PROJ_VERSION_STR "(" ${PROJ_VERSION_MAJOR} "." ${PROJ_VERSION_MINOR} "." ${PROJ_VERSION_PATCH} ")") - - # Minimum Proj version required is 4.9.3 - IF ((PROJ_VERSION_MAJOR EQUAL 4) AND ((PROJ_VERSION_MINOR LESS 9) OR ((PROJ_VERSION_MINOR EQUAL 9) AND (PROJ_VERSION_PATCH LESS 3)))) - MESSAGE(FATAL_ERROR "Found Proj: ${PROJ_VERSION_MAJOR}.${PROJ_VERSION_MINOR}.${PROJ_VERSION_PATCH}. Cannot build QGIS using Proj older than 4.9.3.") - ENDIF((PROJ_VERSION_MAJOR EQUAL 4) AND ((PROJ_VERSION_MINOR LESS 9) OR ((PROJ_VERSION_MINOR EQUAL 9) AND (PROJ_VERSION_PATCH LESS 3)))) ENDIF(EXISTS ${PROJ_INCLUDE_DIR}/proj.h AND EXISTS ${PROJ_INCLUDE_DIR}/proj_experimental.h) IF (NOT PROJ_FIND_QUIETLY) MESSAGE(STATUS "Found Proj: ${PROJ_LIBRARY} version ${PROJ_VERSION_MAJOR} ${PROJ_VERSION_STR}") ENDIF (NOT PROJ_FIND_QUIETLY) + + SET(PROJ_VERSION ${PROJ_VERSION_MAJOR}.${PROJ_VERSION_MINOR}.${PROJ_VERSION_PATCH}) INCLUDE_DIRECTORIES(BEFORE SYSTEM ${PROJ_INCLUDE_DIR}) diff --git a/cmake/SIPMacros.cmake b/cmake/SIPMacros.cmake index e69e208b6a10..2f44b71c7bef 100644 --- a/cmake/SIPMacros.cmake +++ b/cmake/SIPMacros.cmake @@ -65,11 +65,14 @@ MACRO(GENERATE_SIP_PYTHON_MODULE_CODE MODULE_NAME MODULE_SIP SIP_FILES CPP_FILES CONFIGURE_FILE(${_sip_file} ${_out_sip_file}) # Deprecated annotation supports message only since version 6.9.0 - if(${SIP_VERSION_STR} VERSION_LESS 6.9.0) - file(READ ${_out_sip_file} _content) - string(REGEX REPLACE "([/,])Deprecated=\"[^\"]*\"([/,])" "\\1Deprecated\\2" _content "${_content}") - file(GENERATE OUTPUT ${_out_sip_file} CONTENT "${_content}") - endif() + # if(${SIP_VERSION_STR} VERSION_LESS 6.9.0) + + # For now disabling SIP deprecated because it crashes the application + file(READ ${_out_sip_file} _content) + string(REGEX REPLACE "([/,])Deprecated=\"[^\"]*\"([/,])" "\\1Deprecated\\2" _content "${_content}") + file(GENERATE OUTPUT ${_out_sip_file} CONTENT "${_content}") + + # endif() ENDFOREACH (_sip_file) diff --git a/debian/control b/debian/control index 590317c5ab55..bbfcfe59a384 100644 --- a/debian/control +++ b/debian/control @@ -85,6 +85,7 @@ Standards-Version: 3.9.7 Vcs-Browser: https://github.com/qgis/QGIS/ Vcs-Git: https://github.com/qgis/QGIS.git Homepage: https://qgis.org/ +Rules-Requires-Root: no Package: qgis Architecture: any diff --git a/debian/control.in b/debian/control.in index f23fbe291bfe..3313c439839c 100644 --- a/debian/control.in +++ b/debian/control.in @@ -43,7 +43,7 @@ Build-Depends: opencl-headers, #oracle# oracle-instantclient-basiclite, #oracle# oracle-instantclient-devel, - pkg-config, + pkgconf, pyqt5-dev-tools, pyqt5-dev, pyqt5.qsci-dev, @@ -61,7 +61,8 @@ Build-Depends: python3-pyqt5.qtserialport, python3-pyqt5.qtsql, python3-pyqt5.qtsvg, - python3-pyqtbuild, sip-tools, + python3-pyqtbuild, + sip-tools, python3-termcolor, python3-yaml, qt3d5-dev, @@ -99,6 +100,7 @@ Standards-Version: 3.9.7 Vcs-Browser: https://github.com/qgis/QGIS/ Vcs-Git: https://github.com/qgis/QGIS.git Homepage: https://qgis.org/ +Rules-Requires-Root: no Package: qgis Architecture: any @@ -502,7 +504,7 @@ Description: QGIS server providing various OGC services QGIS is a Geographic Information System (GIS) which manages, analyzes and display databases of geographic information. . - This package contains the wms service. + This package contains the WMS service. Package: qgis-server-wmts Architecture: any @@ -514,7 +516,7 @@ Description: QGIS server providing various OGC services QGIS is a Geographic Information System (GIS) which manages, analyzes and display databases of geographic information. . - This package contains the wmts service. + This package contains the WMTS service. Package: qgis-server-wfs Architecture: any @@ -526,7 +528,7 @@ Description: QGIS server providing various OGC services QGIS is a Geographic Information System (GIS) which manages, analyzes and display databases of geographic information. . - This package contains the wfs service. + This package contains the WFS service. Package: qgis-server-wfs3 Architecture: any @@ -538,7 +540,7 @@ Description: QGIS server providing various OGC services QGIS is a Geographic Information System (GIS) which manages, analyzes and display databases of geographic information. . - This package contains the wfs 3 service. + This package contains the WFS 3 service. Package: qgis-server-wcs Architecture: any @@ -550,7 +552,7 @@ Description: QGIS server providing various OGC services QGIS is a Geographic Information System (GIS) which manages, analyzes and display databases of geographic information. . - This package contains the wcs service. + This package contains the WCS service. Package: qgis-server-landingpage Architecture: any diff --git a/debian/rules b/debian/rules index 90f70ae275c2..2540cfcf1cb1 100755 --- a/debian/rules +++ b/debian/rules @@ -58,7 +58,7 @@ GRASSVER=$(subst .,,$(shell pkg-config --modversion grass|cut -d. -f1)) GRASSABI=$(subst .,,$(shell pkg-config --modversion grass|cut -d. -f1,2,3|sed -e 's/RC/-/')) # Include percentage of started edges -export NINJA_STATUS=[%f/%t %p] +export NINJA_STATUS=[%f/%t %p] ifeq (,$(filter terse,$(DEB_BUILD_OPTIONS))) NINJA_OPTS += -v @@ -123,7 +123,7 @@ $(shell test -f /usr/include/$(DEB_BUILD_MULTIARCH)/qt5/Qt3DExtras/qt3dextrasver ifneq (0,$(.SHELLSTATUS)) # Qt3DExtras intentionally removed from debian (#895386) and in turn ubuntu CMAKE_OPTS += \ - -DQt53DExtras_DIR=$(realpath external/qt3dextra-headers/cmake/Qt53DExtras) \ + -DQt53DExtras_DIR=$(realpath external/qt3dextra-headers/cmake/Qt53DExtras) \ -DQT5_3DEXTRA_INCLUDE_DIR=$(realpath external/qt3dextra-headers) \ -DQT5_3DEXTRA_LIBRARY=/usr/lib/$(DEB_BUILD_MULTIARCH)/libQt53DExtras.so endif @@ -315,8 +315,8 @@ endif $(RM) $(CURDIR)/debian/tmp/usr/share/qgis/doc/LICENSE $(RM) $(CURDIR)/debian/tmp/usr/share/qgis/python/plugins/db_manager/LICENSE $(RM) $(CURDIR)/debian/tmp/usr/share/qgis/python/plugins/MetaSearch/LICENSE.txt - $(RM) $(CURDIR)/debian/tmp/usr/bin/test_provider_wcs $(RM) $(CURDIR)/debian/tmp/usr/bin/qgis_bench + $(RM) $(CURDIR)/debian/tmp/usr/bin/test_provider_wcs $(RM) $(CURDIR)/debian/tmp/usr/share/qgis/resources/wcs-servers.json # remove documentation outside usr/share/doc @@ -333,13 +333,13 @@ endif mv $(CURDIR)/debian/tmp/usr/share/qgis/resources/srs.db $(CURDIR)/debian/tmp/usr/share/qgis/resources/srs-template.db # Mime info - install -o root -g root -d $(CURDIR)/debian/tmp/usr/share/mime/packages - install -o root -g root -m 644 $(CURDIR)/debian/qgis.xml $(CURDIR)/debian/tmp/usr/share/mime/packages + install -d $(CURDIR)/debian/tmp/usr/share/mime/packages + install -m 644 $(CURDIR)/debian/qgis.xml $(CURDIR)/debian/tmp/usr/share/mime/packages # qgis binaries - install -o root -g root -m 755 -d $(CURDIR)/debian/qgis/usr/bin - install -o root -g root -m 755 $(CURDIR)/debian/tmp/usr/bin/qgis $(CURDIR)/debian/qgis/usr/bin/qgis.bin - install -o root -g root -m 755 $(CURDIR)/debian/tmp/usr/bin/qgis_process $(CURDIR)/debian/qgis/usr/bin/qgis_process.bin + install -m 755 -d $(CURDIR)/debian/qgis/usr/bin + install -m 755 $(CURDIR)/debian/tmp/usr/bin/qgis $(CURDIR)/debian/qgis/usr/bin/qgis.bin + install -m 755 $(CURDIR)/debian/tmp/usr/bin/qgis_process $(CURDIR)/debian/qgis/usr/bin/qgis_process.bin $(RM) $(CURDIR)/debian/tmp/usr/bin/qgis $(CURDIR)/debian/tmp/usr/bin/qgis_process @@ -349,8 +349,8 @@ endif -e "s#\{ORACLE_LIBDIR\}#$(ORACLE_LIBDIR)#g" \ $(CURDIR)/debian/qgis.sh.in >$(CURDIR)/debian/qgis.sh - install -o root -g root -m 755 $(CURDIR)/debian/qgis.sh $(CURDIR)/debian/qgis/usr/bin/qgis - install -o root -g root -m 755 $(CURDIR)/debian/qgis.sh $(CURDIR)/debian/qgis/usr/bin/qgis_process + install -m 755 $(CURDIR)/debian/qgis.sh $(CURDIR)/debian/qgis/usr/bin/qgis + install -m 755 $(CURDIR)/debian/qgis.sh $(CURDIR)/debian/qgis/usr/bin/qgis_process mkdir -p $(CURDIR)/debian/libqgis-dev cd $(CURDIR)/debian/tmp && find . -name "*.sip" | tar --remove-files -cf - -T - | tar -C $(CURDIR)/debian/libqgis-dev -xf - --xform 's,\./usr/lib/python./dist-packages/qgis,usr/share/sip/qgis,' diff --git a/images/themes/default/console/iconClassBrowserConsole.svg b/images/themes/default/console/iconClassBrowserConsole.svg index 42bc5711d627..031539ea9426 100644 --- a/images/themes/default/console/iconClassBrowserConsole.svg +++ b/images/themes/default/console/iconClassBrowserConsole.svg @@ -1 +1,10 @@ - \ No newline at end of file + + + + + + + + + + diff --git a/images/themes/default/console/iconCommentEditorConsole.svg b/images/themes/default/console/iconCommentEditorConsole.svg index 6094e84fedfe..44790de3166c 100644 --- a/images/themes/default/console/iconCommentEditorConsole.svg +++ b/images/themes/default/console/iconCommentEditorConsole.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + diff --git a/python/3d/auto_generated/qgscameracontroller.sip.in b/python/3d/auto_generated/qgscameracontroller.sip.in index 65524ad0ace6..a06948f69d27 100644 --- a/python/3d/auto_generated/qgscameracontroller.sip.in +++ b/python/3d/auto_generated/qgscameracontroller.sip.in @@ -173,6 +173,23 @@ Rotates the camera on itself. :param diffYaw: the yaw difference .. versionadded:: 3.30 +%End + + void rotateCameraAroundPivot( float newPitch, float newHeading, const QVector3D &pivotPoint ); +%Docstring +Rotates the camera around the pivot point (in world coordinates) +to the given new pitch and heading angle. + +.. versionadded:: 3.42 +%End + + void zoomCameraAroundPivot( const QVector3D &oldCameraPosition, double zoomFactor, const QVector3D &pivotPoint ); +%Docstring +Zooms camera by given zoom factor (>1 one means zoom in) +while keeping the pivot point (given in world coordinates) at the +same screen coordinates after the zoom. + +.. versionadded:: 3.42 %End bool willHandleKeyEvent( QKeyEvent *event ); @@ -188,6 +205,13 @@ Reacts to the shift of origin of the scene, updating camera pose and any other member variables so that the origin stays at the same position relative to other entities. +.. versionadded:: 3.42 +%End + + void setInputHandlersEnabled( bool enable ); +%Docstring +Sets whether the camera controller responds to mouse and keyboard events + .. versionadded:: 3.42 %End diff --git a/python/3d/auto_generated/qgspointcloudlayer3drenderer.sip.in b/python/3d/auto_generated/qgspointcloudlayer3drenderer.sip.in index 333b4926dcad..c38bad182225 100644 --- a/python/3d/auto_generated/qgspointcloudlayer3drenderer.sip.in +++ b/python/3d/auto_generated/qgspointcloudlayer3drenderer.sip.in @@ -104,6 +104,20 @@ Sets the maximum number of points to be rendered in the scene virtual bool convertFrom2DRenderer( QgsPointCloudRenderer *renderer ); + void setZoomOutBehavior( const Qgis::PointCloudZoomOutRenderBehavior behavior ); +%Docstring +Sets the renderer behavior when zoomed out + +.. versionadded:: 3.42 +%End + + Qgis::PointCloudZoomOutRenderBehavior zoomOutBehavior() const; +%Docstring +Returns the renderer behavior when zoomed out + +.. versionadded:: 3.42 +%End + private: QgsPointCloudLayer3DRenderer( const QgsPointCloudLayer3DRenderer & ); QgsPointCloudLayer3DRenderer &operator=( const QgsPointCloudLayer3DRenderer & ); diff --git a/python/3d/class_map.yaml b/python/3d/class_map.yaml index 2765c634891d..f743afb443cf 100644 --- a/python/3d/class_map.yaml +++ b/python/3d/class_map.yaml @@ -245,40 +245,43 @@ QgsAbstractVectorLayer3DRenderer.setTilingSettings: src/3d/qgsabstractvectorlaye QgsAbstractVectorLayer3DRenderer.tilingSettings: src/3d/qgsabstractvectorlayer3drenderer.h#L89 QgsAbstractVectorLayer3DRenderer.writeXmlBaseProperties: src/3d/qgsabstractvectorlayer3drenderer.h#L97 QgsAbstractVectorLayer3DRenderer: src/3d/qgsabstractvectorlayer3drenderer.h#L76 -QgsCameraController.cameraChanged: src/3d/qgscameracontroller.h#L259 +QgsCameraController.cameraChanged: src/3d/qgscameracontroller.h#L280 QgsCameraController.cameraMovementSpeed: src/3d/qgscameracontroller.h#L89 -QgsCameraController.cameraMovementSpeedChanged: src/3d/qgscameracontroller.h#L267 +QgsCameraController.cameraMovementSpeedChanged: src/3d/qgscameracontroller.h#L288 QgsCameraController.cameraNavigationMode: src/3d/qgscameracontroller.h#L83 QgsCameraController.cameraPose: src/3d/qgscameracontroller.h#L139 -QgsCameraController.cameraRotationCenterChanged: src/3d/qgscameracontroller.h#L285 -QgsCameraController.depthBufferCaptured: src/3d/qgscameracontroller.h#L219 +QgsCameraController.cameraRotationCenterChanged: src/3d/qgscameracontroller.h#L306 +QgsCameraController.depthBufferCaptured: src/3d/qgscameracontroller.h#L240 QgsCameraController.distance: src/3d/qgscameracontroller.h#L146 QgsCameraController.frameTriggered: src/3d/qgscameracontroller.h#L110 QgsCameraController.lookingAtPoint: src/3d/qgscameracontroller.h#L119 QgsCameraController.moveView: src/3d/qgscameracontroller.h#L176 -QgsCameraController.navigationModeChanged: src/3d/qgscameracontroller.h#L262 +QgsCameraController.navigationModeChanged: src/3d/qgscameracontroller.h#L283 QgsCameraController.pitch: src/3d/qgscameracontroller.h#L153 QgsCameraController.readXml: src/3d/qgscameracontroller.h#L165 -QgsCameraController.requestDepthBufferCapture: src/3d/qgscameracontroller.h#L279 +QgsCameraController.requestDepthBufferCapture: src/3d/qgscameracontroller.h#L300 QgsCameraController.resetView: src/3d/qgscameracontroller.h#L113 QgsCameraController.rotateAroundViewCenter: src/3d/qgscameracontroller.h#L172 QgsCameraController.rotateCamera: src/3d/qgscameracontroller.h#L190 +QgsCameraController.rotateCameraAroundPivot: src/3d/qgscameracontroller.h#L197 QgsCameraController.setCameraHeadingAngle: src/3d/qgscameracontroller.h#L174 QgsCameraController.setCameraMovementSpeed: src/3d/qgscameracontroller.h#L95 -QgsCameraController.setCameraNavigationMode: src/3d/qgscameracontroller.h#L213 +QgsCameraController.setCameraNavigationMode: src/3d/qgscameracontroller.h#L234 QgsCameraController.setCameraPose: src/3d/qgscameracontroller.h#L133 -QgsCameraController.setCursorPosition: src/3d/qgscameracontroller.h#L273 +QgsCameraController.setCursorPosition: src/3d/qgscameracontroller.h#L294 +QgsCameraController.setInputHandlersEnabled: src/3d/qgscameracontroller.h#L226 QgsCameraController.setLookingAtPoint: src/3d/qgscameracontroller.h#L127 -QgsCameraController.setOrigin: src/3d/qgscameracontroller.h#L205 +QgsCameraController.setOrigin: src/3d/qgscameracontroller.h#L220 QgsCameraController.setVerticalAxisInversion: src/3d/qgscameracontroller.h#L107 QgsCameraController.setViewFromTop: src/3d/qgscameracontroller.h#L116 QgsCameraController.tiltUpAroundViewCenter: src/3d/qgscameracontroller.h#L170 QgsCameraController.verticalAxisInversion: src/3d/qgscameracontroller.h#L101 QgsCameraController.walkView: src/3d/qgscameracontroller.h#L182 -QgsCameraController.willHandleKeyEvent: src/3d/qgscameracontroller.h#L197 +QgsCameraController.willHandleKeyEvent: src/3d/qgscameracontroller.h#L212 QgsCameraController.writeXml: src/3d/qgscameracontroller.h#L163 QgsCameraController.yaw: src/3d/qgscameracontroller.h#L160 QgsCameraController.zoom: src/3d/qgscameracontroller.h#L168 +QgsCameraController.zoomCameraAroundPivot: src/3d/qgscameracontroller.h#L205 QgsCameraController: src/3d/qgscameracontroller.h#L60 QgsCameraPose.centerPoint: src/3d/qgscamerapose.h#L50 QgsCameraPose.distanceFromCenterPoint: src/3d/qgscamerapose.h#L55 @@ -619,10 +622,12 @@ QgsPointCloudLayer3DRenderer.setMaximumScreenError: src/3d/qgspointcloudlayer3dr QgsPointCloudLayer3DRenderer.setPointRenderingBudget: src/3d/qgspointcloudlayer3drenderer.h#L302 QgsPointCloudLayer3DRenderer.setShowBoundingBoxes: src/3d/qgspointcloudlayer3drenderer.h#L292 QgsPointCloudLayer3DRenderer.setSymbol: src/3d/qgspointcloudlayer3drenderer.h#L254 +QgsPointCloudLayer3DRenderer.setZoomOutBehavior: src/3d/qgspointcloudlayer3drenderer.h#L310 QgsPointCloudLayer3DRenderer.showBoundingBoxes: src/3d/qgspointcloudlayer3drenderer.h#L285 QgsPointCloudLayer3DRenderer.symbol: src/3d/qgspointcloudlayer3drenderer.h#L256 QgsPointCloudLayer3DRenderer.type: src/3d/qgspointcloudlayer3drenderer.h#L245 QgsPointCloudLayer3DRenderer.writeXml: src/3d/qgspointcloudlayer3drenderer.h#L258 +QgsPointCloudLayer3DRenderer.zoomOutBehavior: src/3d/qgspointcloudlayer3drenderer.h#L316 QgsPointCloudLayer3DRenderer: src/3d/qgspointcloudlayer3drenderer.h#L234 QgsPointLightSettings.clone: src/3d/lights/qgspointlightsettings.h#L46 QgsPointLightSettings.color: src/3d/lights/qgspointlightsettings.h#L57 diff --git a/python/PyQt/CMakeLists.txt b/python/PyQt/CMakeLists.txt index a3e3d81a419f..2a8916ee52b6 100644 --- a/python/PyQt/CMakeLists.txt +++ b/python/PyQt/CMakeLists.txt @@ -13,6 +13,7 @@ set(PYQT_COMPAT_FILES QtWebEngineCore.py QtWebEngineQuick.py QtWebEngineWidgets.py + QtMultimedia.py QtNetwork.py QtXml.py QtQuickWidgets.py diff --git a/python/PyQt/PyQt/QtMultimedia.py.in b/python/PyQt/PyQt/QtMultimedia.py.in new file mode 100644 index 000000000000..3e21c5377689 --- /dev/null +++ b/python/PyQt/PyQt/QtMultimedia.py.in @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + QtMultimedia.py + --------------------- + Date : January 2025 + Copyright : (C) 2025 by Julien Cabieces + Email : julien dot cabieces at oslandia dot com +*************************************************************************** +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +*************************************************************************** +""" + +__author__ = 'Julien Cabieces' +__date__ = 'January 2025' +__copyright__ = '(C) 2025, Julien Cabieces' + +from PyQt@QT_VERSION_MAJOR@.QtMultimedia import * diff --git a/python/PyQt6/3d/auto_generated/qgscameracontroller.sip.in b/python/PyQt6/3d/auto_generated/qgscameracontroller.sip.in index 65524ad0ace6..a06948f69d27 100644 --- a/python/PyQt6/3d/auto_generated/qgscameracontroller.sip.in +++ b/python/PyQt6/3d/auto_generated/qgscameracontroller.sip.in @@ -173,6 +173,23 @@ Rotates the camera on itself. :param diffYaw: the yaw difference .. versionadded:: 3.30 +%End + + void rotateCameraAroundPivot( float newPitch, float newHeading, const QVector3D &pivotPoint ); +%Docstring +Rotates the camera around the pivot point (in world coordinates) +to the given new pitch and heading angle. + +.. versionadded:: 3.42 +%End + + void zoomCameraAroundPivot( const QVector3D &oldCameraPosition, double zoomFactor, const QVector3D &pivotPoint ); +%Docstring +Zooms camera by given zoom factor (>1 one means zoom in) +while keeping the pivot point (given in world coordinates) at the +same screen coordinates after the zoom. + +.. versionadded:: 3.42 %End bool willHandleKeyEvent( QKeyEvent *event ); @@ -188,6 +205,13 @@ Reacts to the shift of origin of the scene, updating camera pose and any other member variables so that the origin stays at the same position relative to other entities. +.. versionadded:: 3.42 +%End + + void setInputHandlersEnabled( bool enable ); +%Docstring +Sets whether the camera controller responds to mouse and keyboard events + .. versionadded:: 3.42 %End diff --git a/python/PyQt6/3d/auto_generated/qgspointcloudlayer3drenderer.sip.in b/python/PyQt6/3d/auto_generated/qgspointcloudlayer3drenderer.sip.in index 333b4926dcad..c38bad182225 100644 --- a/python/PyQt6/3d/auto_generated/qgspointcloudlayer3drenderer.sip.in +++ b/python/PyQt6/3d/auto_generated/qgspointcloudlayer3drenderer.sip.in @@ -104,6 +104,20 @@ Sets the maximum number of points to be rendered in the scene virtual bool convertFrom2DRenderer( QgsPointCloudRenderer *renderer ); + void setZoomOutBehavior( const Qgis::PointCloudZoomOutRenderBehavior behavior ); +%Docstring +Sets the renderer behavior when zoomed out + +.. versionadded:: 3.42 +%End + + Qgis::PointCloudZoomOutRenderBehavior zoomOutBehavior() const; +%Docstring +Returns the renderer behavior when zoomed out + +.. versionadded:: 3.42 +%End + private: QgsPointCloudLayer3DRenderer( const QgsPointCloudLayer3DRenderer & ); QgsPointCloudLayer3DRenderer &operator=( const QgsPointCloudLayer3DRenderer & ); diff --git a/python/PyQt6/3d/class_map.yaml b/python/PyQt6/3d/class_map.yaml index 2765c634891d..f743afb443cf 100644 --- a/python/PyQt6/3d/class_map.yaml +++ b/python/PyQt6/3d/class_map.yaml @@ -245,40 +245,43 @@ QgsAbstractVectorLayer3DRenderer.setTilingSettings: src/3d/qgsabstractvectorlaye QgsAbstractVectorLayer3DRenderer.tilingSettings: src/3d/qgsabstractvectorlayer3drenderer.h#L89 QgsAbstractVectorLayer3DRenderer.writeXmlBaseProperties: src/3d/qgsabstractvectorlayer3drenderer.h#L97 QgsAbstractVectorLayer3DRenderer: src/3d/qgsabstractvectorlayer3drenderer.h#L76 -QgsCameraController.cameraChanged: src/3d/qgscameracontroller.h#L259 +QgsCameraController.cameraChanged: src/3d/qgscameracontroller.h#L280 QgsCameraController.cameraMovementSpeed: src/3d/qgscameracontroller.h#L89 -QgsCameraController.cameraMovementSpeedChanged: src/3d/qgscameracontroller.h#L267 +QgsCameraController.cameraMovementSpeedChanged: src/3d/qgscameracontroller.h#L288 QgsCameraController.cameraNavigationMode: src/3d/qgscameracontroller.h#L83 QgsCameraController.cameraPose: src/3d/qgscameracontroller.h#L139 -QgsCameraController.cameraRotationCenterChanged: src/3d/qgscameracontroller.h#L285 -QgsCameraController.depthBufferCaptured: src/3d/qgscameracontroller.h#L219 +QgsCameraController.cameraRotationCenterChanged: src/3d/qgscameracontroller.h#L306 +QgsCameraController.depthBufferCaptured: src/3d/qgscameracontroller.h#L240 QgsCameraController.distance: src/3d/qgscameracontroller.h#L146 QgsCameraController.frameTriggered: src/3d/qgscameracontroller.h#L110 QgsCameraController.lookingAtPoint: src/3d/qgscameracontroller.h#L119 QgsCameraController.moveView: src/3d/qgscameracontroller.h#L176 -QgsCameraController.navigationModeChanged: src/3d/qgscameracontroller.h#L262 +QgsCameraController.navigationModeChanged: src/3d/qgscameracontroller.h#L283 QgsCameraController.pitch: src/3d/qgscameracontroller.h#L153 QgsCameraController.readXml: src/3d/qgscameracontroller.h#L165 -QgsCameraController.requestDepthBufferCapture: src/3d/qgscameracontroller.h#L279 +QgsCameraController.requestDepthBufferCapture: src/3d/qgscameracontroller.h#L300 QgsCameraController.resetView: src/3d/qgscameracontroller.h#L113 QgsCameraController.rotateAroundViewCenter: src/3d/qgscameracontroller.h#L172 QgsCameraController.rotateCamera: src/3d/qgscameracontroller.h#L190 +QgsCameraController.rotateCameraAroundPivot: src/3d/qgscameracontroller.h#L197 QgsCameraController.setCameraHeadingAngle: src/3d/qgscameracontroller.h#L174 QgsCameraController.setCameraMovementSpeed: src/3d/qgscameracontroller.h#L95 -QgsCameraController.setCameraNavigationMode: src/3d/qgscameracontroller.h#L213 +QgsCameraController.setCameraNavigationMode: src/3d/qgscameracontroller.h#L234 QgsCameraController.setCameraPose: src/3d/qgscameracontroller.h#L133 -QgsCameraController.setCursorPosition: src/3d/qgscameracontroller.h#L273 +QgsCameraController.setCursorPosition: src/3d/qgscameracontroller.h#L294 +QgsCameraController.setInputHandlersEnabled: src/3d/qgscameracontroller.h#L226 QgsCameraController.setLookingAtPoint: src/3d/qgscameracontroller.h#L127 -QgsCameraController.setOrigin: src/3d/qgscameracontroller.h#L205 +QgsCameraController.setOrigin: src/3d/qgscameracontroller.h#L220 QgsCameraController.setVerticalAxisInversion: src/3d/qgscameracontroller.h#L107 QgsCameraController.setViewFromTop: src/3d/qgscameracontroller.h#L116 QgsCameraController.tiltUpAroundViewCenter: src/3d/qgscameracontroller.h#L170 QgsCameraController.verticalAxisInversion: src/3d/qgscameracontroller.h#L101 QgsCameraController.walkView: src/3d/qgscameracontroller.h#L182 -QgsCameraController.willHandleKeyEvent: src/3d/qgscameracontroller.h#L197 +QgsCameraController.willHandleKeyEvent: src/3d/qgscameracontroller.h#L212 QgsCameraController.writeXml: src/3d/qgscameracontroller.h#L163 QgsCameraController.yaw: src/3d/qgscameracontroller.h#L160 QgsCameraController.zoom: src/3d/qgscameracontroller.h#L168 +QgsCameraController.zoomCameraAroundPivot: src/3d/qgscameracontroller.h#L205 QgsCameraController: src/3d/qgscameracontroller.h#L60 QgsCameraPose.centerPoint: src/3d/qgscamerapose.h#L50 QgsCameraPose.distanceFromCenterPoint: src/3d/qgscamerapose.h#L55 @@ -619,10 +622,12 @@ QgsPointCloudLayer3DRenderer.setMaximumScreenError: src/3d/qgspointcloudlayer3dr QgsPointCloudLayer3DRenderer.setPointRenderingBudget: src/3d/qgspointcloudlayer3drenderer.h#L302 QgsPointCloudLayer3DRenderer.setShowBoundingBoxes: src/3d/qgspointcloudlayer3drenderer.h#L292 QgsPointCloudLayer3DRenderer.setSymbol: src/3d/qgspointcloudlayer3drenderer.h#L254 +QgsPointCloudLayer3DRenderer.setZoomOutBehavior: src/3d/qgspointcloudlayer3drenderer.h#L310 QgsPointCloudLayer3DRenderer.showBoundingBoxes: src/3d/qgspointcloudlayer3drenderer.h#L285 QgsPointCloudLayer3DRenderer.symbol: src/3d/qgspointcloudlayer3drenderer.h#L256 QgsPointCloudLayer3DRenderer.type: src/3d/qgspointcloudlayer3drenderer.h#L245 QgsPointCloudLayer3DRenderer.writeXml: src/3d/qgspointcloudlayer3drenderer.h#L258 +QgsPointCloudLayer3DRenderer.zoomOutBehavior: src/3d/qgspointcloudlayer3drenderer.h#L316 QgsPointCloudLayer3DRenderer: src/3d/qgspointcloudlayer3drenderer.h#L234 QgsPointLightSettings.clone: src/3d/lights/qgspointlightsettings.h#L46 QgsPointLightSettings.color: src/3d/lights/qgspointlightsettings.h#L57 diff --git a/python/PyQt6/analysis/auto_generated/raster/qgsrastercalculator.sip.in b/python/PyQt6/analysis/auto_generated/raster/qgsrastercalculator.sip.in index da86915358f2..2d8483b60c77 100644 --- a/python/PyQt6/analysis/auto_generated/raster/qgsrastercalculator.sip.in +++ b/python/PyQt6/analysis/auto_generated/raster/qgsrastercalculator.sip.in @@ -63,14 +63,15 @@ Performs raster layer calculations. }; - QgsRasterCalculator( const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, int nOutputColumns, int nOutputRows, const QVector &rasterEntries, const QgsCoordinateTransformContext &transformContext ); + QgsRasterCalculator( const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, const QgsCoordinateReferenceSystem &outputCrs, int nOutputColumns, int nOutputRows, const QVector &rasterEntries, const QgsCoordinateTransformContext &transformContext ); %Docstring QgsRasterCalculator constructor. :param formulaString: formula for raster calculation :param outputFile: output file path :param outputFormat: output file format -:param outputExtent: output extent. CRS for output is taken from first entry in rasterEntries. +:param outputExtent: output extent, CRS is specified by outputCrs parameter +:param outputCrs: destination CRS for output raster :param nOutputColumns: number of columns in output raster :param nOutputRows: number of rows in output raster :param rasterEntries: list of referenced raster layers @@ -79,15 +80,14 @@ QgsRasterCalculator constructor. .. versionadded:: 3.8 %End - QgsRasterCalculator( const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, const QgsCoordinateReferenceSystem &outputCrs, int nOutputColumns, int nOutputRows, const QVector &rasterEntries, const QgsCoordinateTransformContext &transformContext ); + QgsRasterCalculator( const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, int nOutputColumns, int nOutputRows, const QVector &rasterEntries, const QgsCoordinateTransformContext &transformContext ); %Docstring QgsRasterCalculator constructor. :param formulaString: formula for raster calculation :param outputFile: output file path :param outputFormat: output file format -:param outputExtent: output extent, CRS is specified by outputCrs parameter -:param outputCrs: destination CRS for output raster +:param outputExtent: output extent. CRS for output is taken from first entry in rasterEntries. :param nOutputColumns: number of columns in output raster :param nOutputRows: number of rows in output raster :param rasterEntries: list of referenced raster layers @@ -96,15 +96,15 @@ QgsRasterCalculator constructor. .. versionadded:: 3.8 %End - - QgsRasterCalculator( const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, int nOutputColumns, int nOutputRows, const QVector &rasterEntries ) /Deprecated="Since 3.8. Use the version with transformContext instead."/; + QgsRasterCalculator( const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, const QgsCoordinateReferenceSystem &outputCrs, int nOutputColumns, int nOutputRows, const QVector &rasterEntries ) /Deprecated="Since 3.8. Use the version with transformContext instead."/; %Docstring QgsRasterCalculator constructor. :param formulaString: formula for raster calculation :param outputFile: output file path :param outputFormat: output file format -:param outputExtent: output extent. CRS for output is taken from first entry in rasterEntries. +:param outputExtent: output extent, CRS is specified by outputCrs parameter +:param outputCrs: destination CRS for output raster :param nOutputColumns: number of columns in output raster :param nOutputRows: number of rows in output raster :param rasterEntries: list of referenced raster layers @@ -114,15 +114,14 @@ QgsRasterCalculator constructor. Use the version with transformContext instead. %End - QgsRasterCalculator( const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, const QgsCoordinateReferenceSystem &outputCrs, int nOutputColumns, int nOutputRows, const QVector &rasterEntries ) /Deprecated="Since 3.8. Use the version with transformContext instead."/; + QgsRasterCalculator( const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, int nOutputColumns, int nOutputRows, const QVector &rasterEntries ) /Deprecated="Since 3.8. Use the version with transformContext instead."/; %Docstring QgsRasterCalculator constructor. :param formulaString: formula for raster calculation :param outputFile: output file path :param outputFormat: output file format -:param outputExtent: output extent, CRS is specified by outputCrs parameter -:param outputCrs: destination CRS for output raster +:param outputExtent: output extent. CRS for output is taken from first entry in rasterEntries. :param nOutputColumns: number of columns in output raster :param nOutputRows: number of rows in output raster :param rasterEntries: list of referenced raster layers diff --git a/python/PyQt6/analysis/class_map.yaml b/python/PyQt6/analysis/class_map.yaml index a916853fc0ba..0aacf66aafd6 100644 --- a/python/PyQt6/analysis/class_map.yaml +++ b/python/PyQt6/analysis/class_map.yaml @@ -289,8 +289,8 @@ QgsRasterCalcNode.setRight: src/analysis/raster/qgsrastercalcnode.h#L108 QgsRasterCalcNode.toString: src/analysis/raster/qgsrastercalcnode.h#L125 QgsRasterCalcNode.type: src/analysis/raster/qgsrastercalcnode.h#L96 QgsRasterCalcNode: src/analysis/raster/qgsrastercalcnode.h#L38 -QgsRasterCalculator.lastError: src/analysis/raster/qgsrastercalculator.h#L162 -QgsRasterCalculator.processCalculation: src/analysis/raster/qgsrastercalculator.h#L156 +QgsRasterCalculator.lastError: src/analysis/raster/qgsrastercalculator.h#L161 +QgsRasterCalculator.processCalculation: src/analysis/raster/qgsrastercalculator.h#L155 QgsRasterCalculator: src/analysis/raster/qgsrastercalculator.h#L74 QgsRasterCalculatorEntry: src/analysis/raster/qgsrastercalculator.h#L39 QgsRasterMatrix.absoluteValue: src/analysis/raster/qgsrastermatrix.h#L147 diff --git a/python/PyQt6/core/__init__.py.in b/python/PyQt6/core/__init__.py.in index 3f94fa431fad..b57fc3eea27c 100644 --- a/python/PyQt6/core/__init__.py.in +++ b/python/PyQt6/core/__init__.py.in @@ -569,11 +569,15 @@ try: raise ValueError(f"The raster block data type '{str(self.dataType())}' is not compatible with NumPy arrays.") src_array = _numpy.frombuffer(self.data(), dtype=raster_dtype) src_array = src_array.reshape((self.height(), self.width())) - if not self.hasNoDataValue() or not use_masking: - return src_array - else: - no_data_value = self.noDataValue() if isinstance(self.noDataValue(), raster_dtype) else 0 + if use_masking: + if not self.hasNoDataValue(): + # Default to 0 as noDataValue if none is set + no_data_value = 0 + else: + no_data_value = self.noDataValue() return _numpy.ma.masked_equal(src_array, no_data_value) + else: + return src_array QgsRasterBlock.as_numpy = _raster_block_as_numpy @@ -586,7 +590,10 @@ try: src_array = block.as_numpy(use_masking=use_masking) arrays.append(src_array) - return _numpy.array(arrays) # This converts any maskedArrays to numpy.array + if use_masking: + return _numpy.ma.stack(arrays, axis=0) + else: + return _numpy.array(arrays) QgsRasterLayer.as_numpy = _raster_layer_as_numpy @@ -646,7 +653,7 @@ try: QgsGeometry.as_numpy = _qgsgeometry_as_numpy - + except ModuleNotFoundError: def _raster_block_as_numpy(self, use_masking:bool = True): raise QgsNotSupportedException('QgsRasterBlock.as_numpy is not available, numpy is not installed on the system') @@ -657,7 +664,7 @@ except ModuleNotFoundError: raise QgsNotSupportedException('QgsRasterLayer.as_numpy is not available, numpy is not installed on the system') QgsRasterLayer.as_numpy = _raster_layer_as_numpy - + def _geometry_as_numpy(self): raise QgsNotSupportedException('QgsGeometry.as_numpy is not available, numpy is not installed on the system') diff --git a/python/PyQt6/core/auto_additions/qgis.py b/python/PyQt6/core/auto_additions/qgis.py index 6402003184f9..3f0acb5a87d7 100644 --- a/python/PyQt6/core/auto_additions/qgis.py +++ b/python/PyQt6/core/auto_additions/qgis.py @@ -2549,6 +2549,22 @@ # -- Qgis.FileFilterType.baseClass = Qgis # monkey patching scoped based enum +Qgis.UriCleaningFlag.RemoveCredentials.__doc__ = "Completely remove credentials (eg passwords) from the URI. This flag is not compatible with the RedactCredentials flag." +Qgis.UriCleaningFlag.RedactCredentials.__doc__ = "Replace the value of credentials (eg passwords) with 'xxxxxxxx'. This flag is not compatible with the RemoveCredentials flag." +Qgis.UriCleaningFlag.__doc__ = """Flags for cleaning layer URIs. + +.. versionadded:: 3.42 + +* ``RemoveCredentials``: Completely remove credentials (eg passwords) from the URI. This flag is not compatible with the RedactCredentials flag. +* ``RedactCredentials``: Replace the value of credentials (eg passwords) with 'xxxxxxxx'. This flag is not compatible with the RemoveCredentials flag. + +""" +# -- +Qgis.UriCleaningFlag.baseClass = Qgis +Qgis.UriCleaningFlags = lambda flags=0: Qgis.UriCleaningFlag(flags) +Qgis.UriCleaningFlags.baseClass = Qgis +UriCleaningFlags = Qgis # dirty hack since SIP seems to introduce the flags in module +# monkey patching scoped based enum Qgis.SublayerQueryFlag.FastScan.__doc__ = "Indicates that the provider must scan for sublayers using the fastest possible approach -- e.g. by first checking that a uri has an extension which is known to be readable by the provider" Qgis.SublayerQueryFlag.ResolveGeometryType.__doc__ = "Attempt to resolve the geometry type for vector sublayers" Qgis.SublayerQueryFlag.CountFeatures.__doc__ = "Count features in vector sublayers" diff --git a/python/PyQt6/core/auto_additions/qgsabstractcontentcache.py b/python/PyQt6/core/auto_additions/qgsabstractcontentcache.py index bf5b43ab27ff..bcc41b6ff594 100644 --- a/python/PyQt6/core/auto_additions/qgsabstractcontentcache.py +++ b/python/PyQt6/core/auto_additions/qgsabstractcontentcache.py @@ -6,6 +6,7 @@ try: QgsAbstractContentCacheBase.__attribute_docs__ = {'remoteContentFetched': 'Emitted when the cache has finished retrieving content from a remote ``url``.\n'} QgsAbstractContentCacheBase.parseBase64DataUrl = staticmethod(QgsAbstractContentCacheBase.parseBase64DataUrl) + QgsAbstractContentCacheBase.parseEmbeddedStringData = staticmethod(QgsAbstractContentCacheBase.parseEmbeddedStringData) QgsAbstractContentCacheBase.isBase64Data = staticmethod(QgsAbstractContentCacheBase.isBase64Data) QgsAbstractContentCacheBase.__signal_arguments__ = {'remoteContentFetched': ['url: str']} except (NameError, AttributeError): diff --git a/python/PyQt6/core/auto_additions/qgsauthmanager.py b/python/PyQt6/core/auto_additions/qgsauthmanager.py index e13b6ac99a78..65b3e64821ea 100644 --- a/python/PyQt6/core/auto_additions/qgsauthmanager.py +++ b/python/PyQt6/core/auto_additions/qgsauthmanager.py @@ -4,10 +4,11 @@ QgsAuthManager.CRITICAL = QgsAuthManager.MessageLevel.CRITICAL QgsAuthManager.MessageLevel.baseClass = QgsAuthManager try: - QgsAuthManager.__attribute_docs__ = {'AUTH_PASSWORD_HELPER_DISPLAY_NAME': 'The display name of the password helper (platform dependent)', 'AUTH_MAN_TAG': 'The display name of the Authentication Manager', 'passwordHelperFailure': 'Signals emitted on password helper failure,\nmainly used in the tests to exit main application loop\n', 'passwordHelperSuccess': 'Signals emitted on password helper success,\nmainly used in the tests to exit main application loop\n', 'messageOut': 'Custom logging signal to relay to console output and :py:class:`QgsMessageLog`\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. deprecated:: 3.40\n\n Use :py:func:`~QgsAuthManager.messageLog` instead.\n', 'messageLog': 'Custom logging signal to relay to console output and :py:class:`QgsMessageLog`\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. versionadded:: 3.40\n', 'passwordHelperMessageOut': 'Custom logging signal to inform the user about master password <-> password manager interactions\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. deprecated:: 3.40\n\n Use :py:func:`~QgsAuthManager.passwordHelperMessageLog` instead.\n', 'passwordHelperMessageLog': 'Custom logging signal to inform the user about master password <-> password manager interactions\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. versionadded:: 3.40\n', 'masterPasswordVerified': "Emitted when a password has been verify (or not)\n\n:param verified: The state of password's verification\n", 'authDatabaseEraseRequested': 'Emitted when a user has indicated they may want to erase the authentication db.\n', 'authDatabaseChanged': 'Emitted when the authentication db is significantly changed, e.g. large record removal, erased, etc.\n'} + QgsAuthManager.__attribute_docs__ = {'AUTH_PASSWORD_HELPER_DISPLAY_NAME': 'The display name of the password helper (platform dependent).\n\nThis is deprecated, use :py:func:`~QgsAuthManager.passwordHelperDisplayName` instead.', 'AUTH_MAN_TAG': 'The display name of the Authentication Manager', 'passwordHelperFailure': 'Signals emitted on password helper failure,\nmainly used in the tests to exit main application loop\n', 'passwordHelperSuccess': 'Signals emitted on password helper success,\nmainly used in the tests to exit main application loop\n', 'messageOut': 'Custom logging signal to relay to console output and :py:class:`QgsMessageLog`\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. deprecated:: 3.40\n\n Use :py:func:`~QgsAuthManager.messageLog` instead.\n', 'messageLog': 'Custom logging signal to relay to console output and :py:class:`QgsMessageLog`\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. versionadded:: 3.40\n', 'passwordHelperMessageOut': 'Custom logging signal to inform the user about master password <-> password manager interactions\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. deprecated:: 3.40\n\n Use :py:func:`~QgsAuthManager.passwordHelperMessageLog` instead.\n', 'passwordHelperMessageLog': 'Custom logging signal to inform the user about master password <-> password manager interactions\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. versionadded:: 3.40\n', 'masterPasswordVerified': "Emitted when a password has been verify (or not)\n\n:param verified: The state of password's verification\n", 'authDatabaseEraseRequested': 'Emitted when a user has indicated they may want to erase the authentication db.\n', 'authDatabaseChanged': 'Emitted when the authentication db is significantly changed, e.g. large record removal, erased, etc.\n'} QgsAuthManager.isFilesystemBasedDatabase = staticmethod(QgsAuthManager.isFilesystemBasedDatabase) QgsAuthManager.hasConfigId = staticmethod(QgsAuthManager.hasConfigId) QgsAuthManager.passwordHelperEnabled = staticmethod(QgsAuthManager.passwordHelperEnabled) + QgsAuthManager.passwordHelperDisplayName = staticmethod(QgsAuthManager.passwordHelperDisplayName) QgsAuthManager.__signal_arguments__ = {'passwordHelperMessageLog': ['message: str', 'tag: str = QgsAuthManager.AUTH_MAN_TAG', 'level: Qgis.MessageLevel = Qgis.MessageLevel.Info'], 'masterPasswordVerified': ['verified: bool']} QgsAuthManager.__group__ = ['auth'] except (NameError, AttributeError): diff --git a/python/PyQt6/core/auto_additions/qgslayoutexporter.py b/python/PyQt6/core/auto_additions/qgslayoutexporter.py index 810b46db94d5..88c923732f3d 100644 --- a/python/PyQt6/core/auto_additions/qgslayoutexporter.py +++ b/python/PyQt6/core/auto_additions/qgslayoutexporter.py @@ -19,7 +19,7 @@ except (NameError, AttributeError): pass try: - QgsLayoutExporter.PdfExportSettings.__attribute_docs__ = {'dpi': 'Resolution to export layout at. If dpi <= 0 the default layout dpi will be used.', 'rasterizeWholeImage': 'Set to ``True`` to force whole layout to be rasterized while exporting.\n\nThis option is mutually exclusive with forceVectorOutput.', 'forceVectorOutput': 'Set to ``True`` to force vector object exports, even when the resultant appearance will differ\nfrom the layout. If ``False``, some items may be rasterized in order to maintain their\ncorrect appearance in the output.\n\nThis option is mutually exclusive with rasterizeWholeImage.', 'appendGeoreference': 'Indicates whether PDF export should append georeference data\n\n.. versionadded:: 3.10', 'exportMetadata': "Indicates whether PDF export should include metadata generated\nfrom the layout's project's metadata.\n\n.. versionadded:: 3.2", 'flags': 'Layout context flags, which control how the export will be created.', 'textRenderFormat': 'Text rendering format, which controls how text should be rendered in the export (e.g.\nas paths or real text objects).\n\n.. versionadded:: 3.4.3', 'simplifyGeometries': 'Indicates whether vector geometries should be simplified to avoid redundant extraneous detail,\nsuch as vertices which are not visible at the specified dpi of the output.\n\n.. versionadded:: 3.10', 'writeGeoPdf': '``True`` if geospatial PDF files should be created, instead of normal PDF files.\n\nWhilst geospatial PDF files can include some desirable properties like the ability to interactively\nquery map features, they also can result in lower-quality output files, or forced rasterization\nof layers.\n\n.. note::\n\n Requires builds based on GDAL 3.0 or greater.\n\n.. versionadded:: 3.10', 'exportLayersAsSeperateFiles': '``True`` if individual layers from the layout should be rendered to separate PDF files.\n\nThis option allows for separation of logic layout layers to individual PDF files. For instance,\nif this option is ``True``, then a separate PDF file will be created per layer per map item in the\nlayout. Additionally, separate PDF files may be created for other complex layout items, resulting\nin a set of PDF files which contain logical atomic components of the layout.\n\nThis option is designed to allow the PDF files to be composited back together in an external\napplication (e.g. Adobe Illustrator) as a non-QGIS, post-production step.\n\n.. versionadded:: 3.14', 'useIso32000ExtensionFormatGeoreferencing': '``True`` if ISO3200 extension format georeferencing should be used.\n\nThis is a recommended setting which results in Geospatial PDF files compatible\nwith the built-in Acrobat geospatial tools.\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.', 'useOgcBestPracticeFormatGeoreferencing': '``True`` if OGC "best practice" format georeferencing should be used.\n\n.. warning::\n\n This results in geospatial PDF files compatible with a unnamed suite of tools starting with Terra and ending with Go, but\n can break compatibility with the built-in Acrobat geospatial tools (yes, Geospatial PDF\n format is a mess!).\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.', 'includeGeoPdfFeatures': '``True`` if feature vector information (such as attributes) should be exported during Geospatial PDF exports.\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.', 'exportThemes': "Optional list of map themes to export as Geospatial PDF layer groups.\n\nIf set, map item's which are not assigned a specific map theme will iterate through all listed\nthemes and a Geospatial PDF layer group will be created for each.\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.", 'predefinedMapScales': 'A list of predefined scales to use with the layout. This is used\nfor maps which are set to the predefined atlas scaling mode.\n\n.. versionadded:: 3.10'} + QgsLayoutExporter.PdfExportSettings.__attribute_docs__ = {'dpi': 'Resolution to export layout at. If dpi <= 0 the default layout dpi will be used.', 'rasterizeWholeImage': 'Set to ``True`` to force whole layout to be rasterized while exporting.\n\nThis option is mutually exclusive with forceVectorOutput.', 'forceVectorOutput': 'Set to ``True`` to force vector object exports, even when the resultant appearance will differ\nfrom the layout. If ``False``, some items may be rasterized in order to maintain their\ncorrect appearance in the output.\n\nThis option is mutually exclusive with rasterizeWholeImage.', 'appendGeoreference': 'Indicates whether PDF export should append georeference data\n\n.. versionadded:: 3.10', 'exportMetadata': "Indicates whether PDF export should include metadata generated\nfrom the layout's project's metadata.\n\n.. versionadded:: 3.2", 'flags': 'Layout context flags, which control how the export will be created.', 'textRenderFormat': 'Text rendering format, which controls how text should be rendered in the export (e.g.\nas paths or real text objects).\n\n.. versionadded:: 3.4.3', 'simplifyGeometries': 'Indicates whether vector geometries should be simplified to avoid redundant extraneous detail,\nsuch as vertices which are not visible at the specified dpi of the output.\n\n.. versionadded:: 3.10', 'writeGeoPdf': '``True`` if geospatial PDF files should be created, instead of normal PDF files.\n\nWhilst geospatial PDF files can include some desirable properties like the ability to interactively\nquery map features, they also can result in lower-quality output files, or forced rasterization\nof layers.\n\n.. note::\n\n Requires builds based on GDAL 3.0 or greater.\n\n.. versionadded:: 3.10', 'exportLayersAsSeperateFiles': '``True`` if individual layers from the layout should be rendered to separate PDF files.\n\nThis option allows for separation of logic layout layers to individual PDF files. For instance,\nif this option is ``True``, then a separate PDF file will be created per layer per map item in the\nlayout. Additionally, separate PDF files may be created for other complex layout items, resulting\nin a set of PDF files which contain logical atomic components of the layout.\n\nThis option is designed to allow the PDF files to be composited back together in an external\napplication (e.g. Adobe Illustrator) as a non-QGIS, post-production step.\n\n.. versionadded:: 3.14', 'useIso32000ExtensionFormatGeoreferencing': '``True`` if ISO3200 extension format georeferencing should be used.\n\nThis is a recommended setting which results in Geospatial PDF files compatible\nwith the built-in Acrobat geospatial tools.\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.', 'useOgcBestPracticeFormatGeoreferencing': '``True`` if OGC "best practice" format georeferencing should be used.\n\n.. warning::\n\n This results in geospatial PDF files compatible with a unnamed suite of tools starting with Terra and ending with Go, but\n can break compatibility with the built-in Acrobat geospatial tools (yes, Geospatial PDF\n format is a mess!).\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.\n\n.. deprecated:: 3.42\n\n This parameter has no longer any effect. Only ISO 32000 georeferencing is handled.', 'includeGeoPdfFeatures': '``True`` if feature vector information (such as attributes) should be exported during Geospatial PDF exports.\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.', 'exportThemes': "Optional list of map themes to export as Geospatial PDF layer groups.\n\nIf set, map item's which are not assigned a specific map theme will iterate through all listed\nthemes and a Geospatial PDF layer group will be created for each.\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.", 'predefinedMapScales': 'A list of predefined scales to use with the layout. This is used\nfor maps which are set to the predefined atlas scaling mode.\n\n.. versionadded:: 3.10'} QgsLayoutExporter.PdfExportSettings.__doc__ = """Contains settings relating to exporting layouts to PDF""" QgsLayoutExporter.PdfExportSettings.__group__ = ['layout'] except (NameError, AttributeError): diff --git a/python/PyQt6/core/auto_additions/qgsmimedatautils.py b/python/PyQt6/core/auto_additions/qgsmimedatautils.py index 551f882dfd1b..8a8d3661c499 100644 --- a/python/PyQt6/core/auto_additions/qgsmimedatautils.py +++ b/python/PyQt6/core/auto_additions/qgsmimedatautils.py @@ -1,6 +1,6 @@ # The following has been generated automatically from src/core/qgsmimedatautils.h try: - QgsMimeDataUtils.Uri.__attribute_docs__ = {'layerType': 'Type of URI.\n\nRecognized types include\n\n- "vector": vector layers\n- "raster": raster layers\n- "mesh": mesh layers\n- "pointcloud": point cloud layers\n- "vector-tile": vector tile layers\n- "tiled-scene": tiled scene layers\n- "plugin": plugin layers\n- "custom": custom types\n- "project": QGS/QGZ project file\n- "directory": directory path\n\nMime data from plugins may use additional custom layer types.', 'providerKey': 'For "vector" / "raster" type: provider id.\nFor "plugin" type: plugin layer type name.\nFor "custom" type: key of its :py:class:`QgsCustomDropHandler`\nFor "project" and "directory" types: unused', 'name': 'Human readable name to be used e.g. in layer tree', 'uri': 'Identifier of the data source recognized by its providerKey', 'layerId': 'Layer ID, if uri is associated with a layer from a :py:class:`QgsProject`.\n\n.. versionadded:: 3.8', 'pId': 'Unique ID associated with application instance. Can be used to identify\nif mime data was created inside the current application instance or not.\n\n.. versionadded:: 3.8', 'wkbType': 'WKB type, if associated with a vector layer, or :py:class:`QgsWkbTypes`.Unknown if not\nyet known.\n\n.. versionadded:: 3.8', 'filePath': 'Path to file, if uri is associated with a file.\n\n.. versionadded:: 3.22'} + QgsMimeDataUtils.Uri.__attribute_docs__ = {'layerType': 'Type of URI.\n\nRecognized types include\n\n- "vector": vector layers\n- "raster": raster layers\n- "mesh": mesh layers\n- "point-cloud": point cloud layers (spelled with a dash since QGIS 3.42.0. In prior versions, there was no dash)\n- "vector-tile": vector tile layers\n- "tiled-scene": tiled scene layers\n- "annotation": annotation layers\n- "group": group layers\n- "plugin": plugin layers\n- "custom": custom types\n- "project": QGS/QGZ project file\n- "directory": directory path\n\nNote: use :py:func:`QgsMapLayerFactory.typeToString()` to convert from a\n:py:class:`Qgis`.LayerType to a string (except for "custom", "project" and\n"directory")\n\nMime data from plugins may use additional custom layer types.', 'providerKey': 'For "vector" / "raster" type: provider id.\nFor "plugin" type: plugin layer type name.\nFor "custom" type: key of its :py:class:`QgsCustomDropHandler`\nFor "project" and "directory" types: unused', 'name': 'Human readable name to be used e.g. in layer tree', 'uri': 'Identifier of the data source recognized by its providerKey', 'layerId': 'Layer ID, if uri is associated with a layer from a :py:class:`QgsProject`.\n\n.. versionadded:: 3.8', 'pId': 'Unique ID associated with application instance. Can be used to identify\nif mime data was created inside the current application instance or not.\n\n.. versionadded:: 3.8', 'wkbType': 'WKB type, if associated with a vector layer, or :py:class:`QgsWkbTypes`.Unknown if not\nyet known.\n\n.. versionadded:: 3.8', 'filePath': 'Path to file, if uri is associated with a file.\n\n.. versionadded:: 3.22'} except (NameError, AttributeError): pass try: diff --git a/python/PyQt6/core/auto_additions/qgspointcloudlayer.py b/python/PyQt6/core/auto_additions/qgspointcloudlayer.py index b1931c3c06fd..3305db2e09ad 100644 --- a/python/PyQt6/core/auto_additions/qgspointcloudlayer.py +++ b/python/PyQt6/core/auto_additions/qgspointcloudlayer.py @@ -21,8 +21,8 @@ except (NameError, AttributeError): pass try: - QgsPointCloudLayer.__attribute_docs__ = {'subsetStringChanged': "Emitted when the layer's subset string has changed.\n\n.. versionadded:: 3.26\n", 'raiseError': 'Signals an error related to this point cloud layer.\n\n.. versionadded:: 3.26\n', 'statisticsCalculationStateChanged': 'Emitted when statistics calculation state has changed\n\n.. versionadded:: 3.26\n'} - QgsPointCloudLayer.__signal_arguments__ = {'raiseError': ['msg: str'], 'statisticsCalculationStateChanged': ['state: QgsPointCloudLayer.PointCloudStatisticsCalculationState']} + QgsPointCloudLayer.__attribute_docs__ = {'subsetStringChanged': "Emitted when the layer's subset string has changed.\n\n.. versionadded:: 3.26\n", 'raiseError': 'Signals an error related to this point cloud layer.\n\n.. versionadded:: 3.26\n', 'statisticsCalculationStateChanged': 'Emitted when statistics calculation state has changed\n\n.. versionadded:: 3.26\n', 'chunkAttributeValuesChanged': 'Emitted when a node gets some attribute values of some points changed\n\n.. versionadded:: 3.42\n'} + QgsPointCloudLayer.__signal_arguments__ = {'raiseError': ['msg: str'], 'statisticsCalculationStateChanged': ['state: QgsPointCloudLayer.PointCloudStatisticsCalculationState'], 'chunkAttributeValuesChanged': ['n: QgsPointCloudNodeId']} QgsPointCloudLayer.__group__ = ['pointcloud'] except (NameError, AttributeError): pass diff --git a/python/PyQt6/core/auto_additions/qgssymbollayerutils.py b/python/PyQt6/core/auto_additions/qgssymbollayerutils.py index de49d5e3840c..58e412ae6838 100644 --- a/python/PyQt6/core/auto_additions/qgssymbollayerutils.py +++ b/python/PyQt6/core/auto_additions/qgssymbollayerutils.py @@ -161,6 +161,7 @@ QgsSymbolLayerUtils.tileSize = staticmethod(QgsSymbolLayerUtils.tileSize) QgsSymbolLayerUtils.clearSymbolLayerIds = staticmethod(QgsSymbolLayerUtils.clearSymbolLayerIds) QgsSymbolLayerUtils.resetSymbolLayerIds = staticmethod(QgsSymbolLayerUtils.resetSymbolLayerIds) + QgsSymbolLayerUtils.clearSymbolLayerMasks = staticmethod(QgsSymbolLayerUtils.clearSymbolLayerMasks) QgsSymbolLayerUtils.collectSymbolLayerClipGeometries = staticmethod(QgsSymbolLayerUtils.collectSymbolLayerClipGeometries) QgsSymbolLayerUtils.__group__ = ['symbology'] except (NameError, AttributeError): diff --git a/python/PyQt6/core/auto_additions/qgstransaction.py b/python/PyQt6/core/auto_additions/qgstransaction.py index 180403b80ca6..284cc9fa4347 100644 --- a/python/PyQt6/core/auto_additions/qgstransaction.py +++ b/python/PyQt6/core/auto_additions/qgstransaction.py @@ -1,8 +1,8 @@ # The following has been generated automatically from src/core/qgstransaction.h try: - QgsTransaction.__attribute_docs__ = {'afterRollback': 'Emitted after a rollback\n', 'dirtied': 'Emitted if a sql query is executed and the underlying data is modified\n'} + QgsTransaction.__attribute_docs__ = {'afterRollback': 'Emitted after a rollback\n', 'afterRollbackToSavepoint': 'Emitted after a rollback to savepoint\n\n.. versionadded:: 3.42\n', 'dirtied': 'Emitted if a sql query is executed and the underlying data is modified\n'} QgsTransaction.create = staticmethod(QgsTransaction.create) QgsTransaction.supportsTransaction = staticmethod(QgsTransaction.supportsTransaction) - QgsTransaction.__signal_arguments__ = {'dirtied': ['sql: str', 'name: str']} + QgsTransaction.__signal_arguments__ = {'afterRollbackToSavepoint': ['savepointName: str'], 'dirtied': ['sql: str', 'name: str']} except (NameError, AttributeError): pass diff --git a/python/PyQt6/core/auto_generated/auth/qgsauthmanager.sip.in b/python/PyQt6/core/auto_generated/auth/qgsauthmanager.sip.in index 2178f12e176f..d6376e29d36d 100644 --- a/python/PyQt6/core/auto_generated/auth/qgsauthmanager.sip.in +++ b/python/PyQt6/core/auto_generated/auth/qgsauthmanager.sip.in @@ -27,6 +27,7 @@ and to utilize configurations through various authentication method plugins %End public: + enum MessageLevel /BaseType=IntEnum/ { INFO, @@ -161,6 +162,7 @@ Returns the authentication database connection URI with the password stripped. .. versionadded:: 3.40 %End + bool setMasterPassword( bool verify = false ); %Docstring Main call to initially set or continually check master password is set @@ -223,17 +225,18 @@ Check whether supplied password is the same as the one already set bool resetMasterPassword( const QString &newpass, const QString &oldpass, bool keepbackup, QString *backuppath /In,Out/ = 0 ); %Docstring -Reset the master password to a new one, then re-encrypt all previous -configs in a new database file, optionally backup current database +Reset the master password to a new one, then re-encrypts all previous +configs with the new password. :param newpass: New master password to replace existing :param oldpass: Current master password to replace existing -:param keepbackup: Whether to keep the generated backup of current database +:param keepbackup: Whether to keep the generated backup of current database (if using file-based storage) :param backuppath: Where the backup is located, if kept %End + void setScheduledAuthDatabaseEraseRequestEmitted( bool emitted ); %Docstring Re-emit a signal to schedule an optional erase of authentication database. @@ -810,8 +813,20 @@ Store the password manager into the wallet Available in Python bindings since QGIS 3.8.0 %End + + static const QString AUTH_PASSWORD_HELPER_DISPLAY_NAME; + static QString passwordHelperDisplayName( bool titleCase = false ); +%Docstring +Returns a translated display name of the password helper (platform dependent). + +If ``titleCase`` is ``True`` then a title case version of the string will be returned. Otherwise +a mid-sentence case version will be returned. + +.. versionadded:: 3.42 +%End + static const QString AUTH_MAN_TAG; diff --git a/python/PyQt6/core/auto_generated/effects/qgspainteffect.sip.in b/python/PyQt6/core/auto_generated/effects/qgspainteffect.sip.in index 71dbb9100561..39dbc35ea9e3 100644 --- a/python/PyQt6/core/auto_generated/effects/qgspainteffect.sip.in +++ b/python/PyQt6/core/auto_generated/effects/qgspainteffect.sip.in @@ -149,7 +149,7 @@ Restores the effect to the state described by a DOM element. .. seealso:: :py:func:`saveProperties` %End - virtual void render( QPicture &picture, QgsRenderContext &context ); + virtual void render( const QPicture &picture, QgsRenderContext &context ); %Docstring Renders a picture using the effect. @@ -246,7 +246,7 @@ to account for the destination painter's DPI. .. seealso:: :py:func:`sourceAsImage` %End - const QPicture *source() const; + const QPicture &source() const; %Docstring Returns the source QPicture. The :py:func:`~QgsPaintEffect.draw` member can utilize this when drawing the effect. @@ -258,14 +258,14 @@ drawing the effect. .. seealso:: :py:func:`sourceAsImage` %End - QImage *sourceAsImage( QgsRenderContext &context ); + QImage sourceAsImage( QgsRenderContext &context ); %Docstring Returns the source QPicture rendered to a new QImage. The :py:func:`~QgsPaintEffect.draw` member can utilize this when drawing the effect. The image will be padded or cropped from the original source QPicture by the results of the :py:func:`~QgsPaintEffect.boundingRect` method. The result is cached to speed up subsequent calls to sourceAsImage. -:return: source QPicture rendered to an image +:return: source QPicture rendered to an image, or a null image if source could not be rendered .. seealso:: :py:func:`drawSource` diff --git a/python/PyQt6/core/auto_generated/geometry/qgsbox3d.sip.in b/python/PyQt6/core/auto_generated/geometry/qgsbox3d.sip.in index c3205eeb8b43..18edcd44c9c2 100644 --- a/python/PyQt6/core/auto_generated/geometry/qgsbox3d.sip.in +++ b/python/PyQt6/core/auto_generated/geometry/qgsbox3d.sip.in @@ -375,12 +375,24 @@ Expands the bbox so that it covers both the original rectangle and the given poi Converts the box to a 2D rectangle. %End - double distanceTo( const QVector3D &point ) const /HoldGIL/; + double distanceTo( const QVector3D &point ) const /Deprecated="Since 3.42. Use distanceTo() with QgsVector3D instead (QVector3D uses floats)."/; %Docstring Returns the smallest distance between the box and the point ``point`` (returns 0 if the point is inside the box) .. versionadded:: 3.18 + +.. deprecated:: 3.42 + + Use :py:func:`~QgsBox3D.distanceTo` with :py:class:`QgsVector3D` instead (QVector3D uses floats). +%End + + double distanceTo( const QgsVector3D &point ) const /HoldGIL/; +%Docstring +Returns the smallest distance between the box and the point ``point`` +(returns 0 if the point is inside the box) + +.. versionadded:: 3.42 %End bool operator==( const QgsBox3D &other ) const /HoldGIL/; diff --git a/python/PyQt6/core/auto_generated/geometry/qgsmultipoint.sip.in b/python/PyQt6/core/auto_generated/geometry/qgsmultipoint.sip.in index 5fd56c1ab2f0..d6c56daea4f1 100644 --- a/python/PyQt6/core/auto_generated/geometry/qgsmultipoint.sip.in +++ b/python/PyQt6/core/auto_generated/geometry/qgsmultipoint.sip.in @@ -120,7 +120,7 @@ The multipoint Z and M type will be set based on the type of the first point in break; } - std::unique_ptr< QgsPoint > point = std::make_unique< QgsPoint >( x, y ); + auto point = std::make_unique< QgsPoint >( x, y ); if ( elementSize > 2 ) { element = PySequence_GetItem( value, 2 ); diff --git a/python/PyQt6/core/auto_generated/geometry/qgsrectangle.sip.in b/python/PyQt6/core/auto_generated/geometry/qgsrectangle.sip.in index b4b1d09716da..d24acb66d00b 100644 --- a/python/PyQt6/core/auto_generated/geometry/qgsrectangle.sip.in +++ b/python/PyQt6/core/auto_generated/geometry/qgsrectangle.sip.in @@ -11,6 +11,8 @@ + + class QgsRectangle { %Docstring(signature="appended") diff --git a/python/PyQt6/core/auto_generated/labeling/qgsrulebasedlabeling.sip.in b/python/PyQt6/core/auto_generated/labeling/qgsrulebasedlabeling.sip.in index 48a23be1819c..48eac1b038b1 100644 --- a/python/PyQt6/core/auto_generated/labeling/qgsrulebasedlabeling.sip.in +++ b/python/PyQt6/core/auto_generated/labeling/qgsrulebasedlabeling.sip.in @@ -21,7 +21,7 @@ Rule based labeling for a vector layer. %End public: typedef QList RuleList; - typedef QMap RuleToProviderMap; + public: class Rule { @@ -219,9 +219,13 @@ Try to find a rule given its unique key %End - QgsRuleBasedLabeling::Rule *clone() const /Factory/; + QgsRuleBasedLabeling::Rule *clone( bool resetRuleKey = true ) const /Factory/; %Docstring -clone this rule, return new instance +clone this rule + +:param resetRuleKey: ``True`` if this rule and its children rule key need to be reset to new unique ones. + +:return: new instance %End @@ -312,8 +316,6 @@ Set pal settings for a specific provider (takes ownership). protected: - - }; diff --git a/python/PyQt6/core/auto_generated/layertree/qgslayertreeregistrybridge.sip.in b/python/PyQt6/core/auto_generated/layertree/qgslayertreeregistrybridge.sip.in index 47de54bfeeba..b614ba15fe46 100644 --- a/python/PyQt6/core/auto_generated/layertree/qgslayertreeregistrybridge.sip.in +++ b/python/PyQt6/core/auto_generated/layertree/qgslayertreeregistrybridge.sip.in @@ -66,6 +66,13 @@ Set where the new layers should be inserted - can be used to follow current sele By default it is root group with zero index. .. versionadded:: 3.10 +%End + + InsertionPoint layerInsertionPoint() const; +%Docstring +Returns the insertion point used to add layers to the tree + +.. versionadded:: 3.42 %End void setLayerInsertionMethod( Qgis::LayerTreeInsertionMethod method ); @@ -100,6 +107,7 @@ Tell others we have just added layers to the tree (used in QGIS to auto-select f protected: + }; /************************************************************************ diff --git a/python/PyQt6/core/auto_generated/mesh/qgsmeshlayer.sip.in b/python/PyQt6/core/auto_generated/mesh/qgsmeshlayer.sip.in index 6a2cafa579ac..6a5b6bb46558 100644 --- a/python/PyQt6/core/auto_generated/mesh/qgsmeshlayer.sip.in +++ b/python/PyQt6/core/auto_generated/mesh/qgsmeshlayer.sip.in @@ -234,9 +234,13 @@ Gets native mesh and updates (creates if it doesn't exist) the base triangular m %Docstring Returns renderer settings %End - void setRendererSettings( const QgsMeshRendererSettings &settings ); + + void setRendererSettings( const QgsMeshRendererSettings &settings, const bool repaint = true ); %Docstring Sets new renderer settings + +:param settings: +:param repaint: should the update of renderer settings trigger repaint and emit rendererChanged signal %End QgsMeshTimeSettings timeSettings() const; diff --git a/python/PyQt6/core/auto_generated/network/qgshttpheaders.sip.in b/python/PyQt6/core/auto_generated/network/qgshttpheaders.sip.in index 3428ece4f42b..c4e72e65a521 100644 --- a/python/PyQt6/core/auto_generated/network/qgshttpheaders.sip.in +++ b/python/PyQt6/core/auto_generated/network/qgshttpheaders.sip.in @@ -109,15 +109,22 @@ KEY_REFERER value will be available at key "KEY_PREFIX+KEY_REFERER" and key "KEY :return: ``True`` if the update succeed %End - bool updateDomElement( QDomElement &el ) const; + bool updateDomElement( QDomElement &el ) const /Deprecated="Since 3.42. Will be removed in QGIS 4.0."/; %Docstring -Updates a ``map`` by adding all the HTTP headers +Updates a DOM element by adding all the HTTP headers KEY_REFERER value will be available at attribute "KEY_PREFIX+KEY_REFERER" and attribute "KEY_REFERER" (for backward compatibility) +:param el: DOM element + :return: ``True`` if the update succeed + +.. deprecated:: 3.42 + + Will be removed in QGIS 4.0. %End + void setFromSettings( const QgsSettings &settings, const QString &key = QString() ); %Docstring Loads headers from the ``settings`` @@ -185,6 +192,7 @@ Returns key/value pairs as strings separated by space }; + /************************************************************************ * This file has been generated automatically from * * * diff --git a/python/PyQt6/core/auto_generated/pointcloud/qgspointcloudindex.sip.in b/python/PyQt6/core/auto_generated/pointcloud/qgspointcloudindex.sip.in index 18cbe8b42976..cdaf1cfdeda5 100644 --- a/python/PyQt6/core/auto_generated/pointcloud/qgspointcloudindex.sip.in +++ b/python/PyQt6/core/auto_generated/pointcloud/qgspointcloudindex.sip.in @@ -169,6 +169,7 @@ index is memory safe. operator bool() const; + void load( const QString &fileName ); %Docstring Loads the index from the file @@ -355,9 +356,11 @@ in an implementation-specific dynamic structure. .. seealso:: :py:func:`QgsAbstractPointCloudIndex.extraMetadata` %End - bool commitChanges(); + bool commitChanges( QString *errorMessage /Out/ = 0 ); %Docstring Tries to store pending changes to the data provider. +If errorMessage is not a null pointer, it will receive +an error message in case the call failed. :return: ``True`` on success, otherwise ``False`` %End @@ -365,6 +368,11 @@ Tries to store pending changes to the data provider. bool isModified() const; %Docstring Returns ``True`` if there are uncommitted changes, ``False`` otherwise +%End + + QList updatedNodes() const; +%Docstring +Returns a list of node IDs that have been modified %End }; diff --git a/python/PyQt6/core/auto_generated/pointcloud/qgspointcloudlayer.sip.in b/python/PyQt6/core/auto_generated/pointcloud/qgspointcloudlayer.sip.in index 090caa36c2ee..bcb66314bd45 100644 --- a/python/PyQt6/core/auto_generated/pointcloud/qgspointcloudlayer.sip.in +++ b/python/PyQt6/core/auto_generated/pointcloud/qgspointcloudlayer.sip.in @@ -305,6 +305,13 @@ Signals an error related to this point cloud layer. Emitted when statistics calculation state has changed .. versionadded:: 3.26 +%End + + void chunkAttributeValuesChanged( const QgsPointCloudNodeId &n ); +%Docstring +Emitted when a node gets some attribute values of some points changed + +.. versionadded:: 3.42 %End private: diff --git a/python/PyQt6/core/auto_generated/processing/qgsprocessingcontext.sip.in b/python/PyQt6/core/auto_generated/processing/qgsprocessingcontext.sip.in index 99c99c858917..3058f23c53cf 100644 --- a/python/PyQt6/core/auto_generated/processing/qgsprocessingcontext.sip.in +++ b/python/PyQt6/core/auto_generated/processing/qgsprocessingcontext.sip.in @@ -662,6 +662,13 @@ Returns the model results, populated when the context is used to run a model alg %End + void clearModelResult(); +%Docstring +Clears model results previously populated when the context was used to run a model algorithm. + +.. versionadded:: 3.42 +%End + private: QgsProcessingContext( const QgsProcessingContext &other ); }; diff --git a/python/PyQt6/core/auto_generated/processing/qgsprocessingutils.sip.in b/python/PyQt6/core/auto_generated/processing/qgsprocessingutils.sip.in index d84309490db0..d4f215798021 100644 --- a/python/PyQt6/core/auto_generated/processing/qgsprocessingutils.sip.in +++ b/python/PyQt6/core/auto_generated/processing/qgsprocessingutils.sip.in @@ -335,7 +335,7 @@ Normalizes a layer ``source`` string for safe comparison across different operating system environments. %End - static QString layerToStringIdentifier( const QgsMapLayer *layer ) /HoldGIL/; + static QString layerToStringIdentifier( const QgsMapLayer *layer, const QString &layerName = QString() ) /HoldGIL/; %Docstring Returns a string representation of the source for a ``layer``. The returned value is suitable for storage for subsequent executions of an algorithm diff --git a/python/PyQt6/core/auto_generated/proj/qgscoordinatereferencesystem.sip.in b/python/PyQt6/core/auto_generated/proj/qgscoordinatereferencesystem.sip.in index 1ffebdd7f58a..9c5d7453ab1e 100644 --- a/python/PyQt6/core/auto_generated/proj/qgscoordinatereferencesystem.sip.in +++ b/python/PyQt6/core/auto_generated/proj/qgscoordinatereferencesystem.sip.in @@ -850,12 +850,6 @@ be returned. In the case of a compound crs, this method will always return the datum ensemble for the horizontal component. -.. warning:: - - This method requires PROJ 8.0 or later - -:raises QgsNotSupportedException: on QGIS builds based on PROJ 7 or earlier. - .. versionadded:: 3.20 %End @@ -863,12 +857,6 @@ be returned. %Docstring Attempts to retrieve the name of the celestial body associated with the CRS (e.g. "Earth"). -.. warning:: - - This method requires PROJ 8.1 or later - -:raises QgsNotSupportedException: on QGIS builds based on PROJ 8.0 or earlier. - .. versionadded:: 3.20 %End diff --git a/python/PyQt6/core/auto_generated/proj/qgscoordinatereferencesystemregistry.sip.in b/python/PyQt6/core/auto_generated/proj/qgscoordinatereferencesystemregistry.sip.in index 1df531255497..55044defbf28 100644 --- a/python/PyQt6/core/auto_generated/proj/qgscoordinatereferencesystemregistry.sip.in +++ b/python/PyQt6/core/auto_generated/proj/qgscoordinatereferencesystemregistry.sip.in @@ -128,12 +128,6 @@ The map keys correspond to PROJ operation IDs. %Docstring Returns a list of all known celestial bodies. -.. warning:: - - This method requires PROJ 8.1 or later - -:raises QgsNotSupportedException: on QGIS builds based on PROJ 8.0 or earlier. - .. versionadded:: 3.20 %End diff --git a/python/PyQt6/core/auto_generated/proj/qgscoordinatetransform.sip.in b/python/PyQt6/core/auto_generated/proj/qgscoordinatetransform.sip.in index 2e48272838b0..c747ddcd9617 100644 --- a/python/PyQt6/core/auto_generated/proj/qgscoordinatetransform.sip.in +++ b/python/PyQt6/core/auto_generated/proj/qgscoordinatetransform.sip.in @@ -280,6 +280,10 @@ the returned rectangle. :return: rectangle in destination CRS +.. warning:: + + Do not call this method if the transformation involves geocentric CRS -- in this situation transformation of a 2D bounding box is meaningless! Calling this method with a geocentric CRS will result in a :py:class:`QgsCsException` being thrown. + :raises QgsCsException: if the transformation fails %End diff --git a/python/PyQt6/core/auto_generated/providers/qgsabstractdatabaseproviderconnection.sip.in b/python/PyQt6/core/auto_generated/providers/qgsabstractdatabaseproviderconnection.sip.in index 062c8075b354..c4daa90471e5 100644 --- a/python/PyQt6/core/auto_generated/providers/qgsabstractdatabaseproviderconnection.sip.in +++ b/python/PyQt6/core/auto_generated/providers/qgsabstractdatabaseproviderconnection.sip.in @@ -1033,6 +1033,8 @@ Checks if ``capability`` is supported. + + }; QFlags operator|(QgsAbstractDatabaseProviderConnection::Capability f1, QFlags f2); diff --git a/python/PyQt6/core/auto_generated/providers/qgsprovidermetadata.sip.in b/python/PyQt6/core/auto_generated/providers/qgsprovidermetadata.sip.in index 0c70076cad60..8a7724505ce3 100644 --- a/python/PyQt6/core/auto_generated/providers/qgsprovidermetadata.sip.in +++ b/python/PyQt6/core/auto_generated/providers/qgsprovidermetadata.sip.in @@ -573,6 +573,13 @@ If a provider does not work with paths, unmodified URI will be returned. .. seealso:: :py:func:`absoluteToRelativeUri` .. versionadded:: 3.30 +%End + + virtual QString cleanUri( const QString &uri, Qgis::UriCleaningFlags flags = Qgis::UriCleaningFlag::RemoveCredentials ) const; +%Docstring +Cleans a layer ``uri``, e.g. to remove or hide sensitive information from the URI. + +.. versionadded:: 3.42 %End virtual QList< QgsDataItemProvider * > dataItemProviders() const /Factory/; diff --git a/python/PyQt6/core/auto_generated/providers/sensorthings/qgssensorthingsutils.sip.in b/python/PyQt6/core/auto_generated/providers/sensorthings/qgssensorthingsutils.sip.in index 45b049c4c7e4..394e736ba268 100644 --- a/python/PyQt6/core/auto_generated/providers/sensorthings/qgssensorthingsutils.sip.in +++ b/python/PyQt6/core/auto_generated/providers/sensorthings/qgssensorthingsutils.sip.in @@ -56,9 +56,12 @@ Returns the SensorThings properties which correspond to a specified entity ``typ .. versionadded:: 3.38 %End - static QgsFields fieldsForEntityType( Qgis::SensorThingsEntity type ); + static QgsFields fieldsForEntityType( Qgis::SensorThingsEntity type, bool includeRangeFieldProxies = true ); %Docstring Returns the fields which correspond to a specified entity ``type``. + +Since QGIS 3.42 the ``includeRangeFieldProxies`` argument can be used to hide the "start"/"end" fields +which are proxies for the date time range field types which are not natively supported in QGIS. %End static QgsFields fieldsForExpandedEntityType( Qgis::SensorThingsEntity baseType, const QList< Qgis::SensorThingsEntity > &expandedTypes ); diff --git a/python/PyQt6/core/auto_generated/qgis.sip.in b/python/PyQt6/core/auto_generated/qgis.sip.in index 4d30981e6609..2c8ae9e630eb 100644 --- a/python/PyQt6/core/auto_generated/qgis.sip.in +++ b/python/PyQt6/core/auto_generated/qgis.sip.in @@ -783,6 +783,15 @@ The development version TiledScene, }; + enum class UriCleaningFlag /BaseType=IntFlag/ + { + RemoveCredentials, + RedactCredentials, + }; + + typedef QFlags UriCleaningFlags; + + enum class SublayerQueryFlag /BaseType=IntFlag/ { FastScan, @@ -3406,6 +3415,8 @@ QFlags operator|(Qgis::SnappingType f1, QFlags operator|(Qgis::SqlLayerDefinitionCapability f1, QFlags f2); +QFlags operator|(Qgis::UriCleaningFlag f1, QFlags f2); + QFlags operator|(Qgis::SublayerFlag f1, QFlags f2); QFlags operator|(Qgis::SublayerQueryFlag f1, QFlags f2); diff --git a/python/PyQt6/core/auto_generated/qgsabstractcontentcache.sip.in b/python/PyQt6/core/auto_generated/qgsabstractcontentcache.sip.in index d65dc29a2c09..2d5694ae3f06 100644 --- a/python/PyQt6/core/auto_generated/qgsabstractcontentcache.sip.in +++ b/python/PyQt6/core/auto_generated/qgsabstractcontentcache.sip.in @@ -108,6 +108,23 @@ Data URLs are of the form ``data:[;]base64,``. .. versionadded:: 3.40 %End + + static bool parseEmbeddedStringData( const QString &path, QString *mimeType /Out/ = 0, QString *data /Out/ = 0 ); +%Docstring +Parses a ``path`` to determine if it represents a embedded string data, and if so, extracts the components +of the URL. + +Data URLs are of the form ``data:[;]utf8,``. + +:param path: path to test + +:return: - ``True`` if ``path`` is an embedded string data URL + - mimeType: the extracted mime type if the ``path`` is a data URL + - data: the extracted string data if the ``path`` is a data URL + +.. versionadded:: 3.42 +%End + static bool isBase64Data( const QString &path ); %Docstring Returns ``True`` if ``path`` represents base64 encoded data. diff --git a/python/PyQt6/core/auto_generated/qgserror.sip.in b/python/PyQt6/core/auto_generated/qgserror.sip.in index 058fe87d89a4..8978ebf40b68 100644 --- a/python/PyQt6/core/auto_generated/qgserror.sip.in +++ b/python/PyQt6/core/auto_generated/qgserror.sip.in @@ -88,9 +88,9 @@ Append new error message. bool isEmpty() const; %Docstring -Test if any error is set. +Test if no error is set. -:return: ``True`` if contains error +:return: ``False`` if contains error %End QString message( QgsErrorMessage::Format format = QgsErrorMessage::Html ) const; diff --git a/python/PyQt6/core/auto_generated/qgsfeatureiterator.sip.in b/python/PyQt6/core/auto_generated/qgsfeatureiterator.sip.in index f77128560fce..a8a2d2890fcc 100644 --- a/python/PyQt6/core/auto_generated/qgsfeatureiterator.sip.in +++ b/python/PyQt6/core/auto_generated/qgsfeatureiterator.sip.in @@ -222,7 +222,7 @@ Wrapper for iterator of features from vector data provider or vector layer SIP_PYOBJECT __next__() /TypeHint="QgsFeature"/; %MethodCode - std::unique_ptr< QgsFeature > f = std::make_unique< QgsFeature >(); + auto f = std::make_unique< QgsFeature >(); bool result = false; Py_BEGIN_ALLOW_THREADS result = ( sipCpp->nextFeature( *f ) ); diff --git a/python/PyQt6/core/auto_generated/qgsmaplayer.sip.in b/python/PyQt6/core/auto_generated/qgsmaplayer.sip.in index 73545c5cd377..f185105e38a3 100644 --- a/python/PyQt6/core/auto_generated/qgsmaplayer.sip.in +++ b/python/PyQt6/core/auto_generated/qgsmaplayer.sip.in @@ -567,13 +567,14 @@ or other problem. Child classes set this flag when initialized. :return: ``True`` if the layer is valid and can be accessed %End + QString publicSource( bool hidePassword = false ) const; %Docstring Gets a version of the internal layer definition that has sensitive bits removed (for example, the password). This function should be used when displaying the source name for general viewing. -:param hidePassword: False, if the password should be removed or replaced by an arbitrary string, since QGIS 3.34 +:param hidePassword: ``True`` to replace the value of credentials with 'xxxxxxxx', ``False`` to completely remove credentials (key and value). Since QGIS 3.34 .. seealso:: :py:func:`source` %End diff --git a/python/PyQt6/core/auto_generated/qgsmessagelog.sip.in b/python/PyQt6/core/auto_generated/qgsmessagelog.sip.in index 191fedee7791..dae700f6b340 100644 --- a/python/PyQt6/core/auto_generated/qgsmessagelog.sip.in +++ b/python/PyQt6/core/auto_generated/qgsmessagelog.sip.in @@ -32,14 +32,8 @@ window for the user. QgsMessageLog(); - static void logMessage( const QString &message, const QString &tag = QString(), Qgis::MessageLevel level = Qgis::MessageLevel::Warning, bool notifyUser = true ); -%Docstring -Adds a ``message`` to the log instance (and creates it if necessary). - -If ``notifyUser`` is ``True``, then the message should be brought to the user's attention by various UI hints. -If it is ``False``, the message should appear in logs silently. Note that log viewer implementations may -only respect notification hints for certain message levels. -%End + static void logMessage( const QString &message, const QString &tag = QString(), Qgis::MessageLevel level = Qgis::MessageLevel::Warning, bool notifyUser = true, + const char *file = __builtin_FILE(), const char *function = __builtin_FUNCTION(), int line = __builtin_LINE() ); signals: diff --git a/python/PyQt6/core/auto_generated/qgsspatialindex.sip.in b/python/PyQt6/core/auto_generated/qgsspatialindex.sip.in index 9e3ef92e480c..371168fceff4 100644 --- a/python/PyQt6/core/auto_generated/qgsspatialindex.sip.in +++ b/python/PyQt6/core/auto_generated/qgsspatialindex.sip.in @@ -205,7 +205,7 @@ Geometry is only stored if the QgsSpatialIndex was created with the FlagStoreFea .. versionadded:: 3.6 %End %MethodCode - std::unique_ptr< QgsGeometry > g = std::make_unique< QgsGeometry >( sipCpp->geometry( a0 ) ); + auto g = std::make_unique< QgsGeometry >( sipCpp->geometry( a0 ) ); if ( g->isNull() ) { PyErr_SetString( PyExc_KeyError, QStringLiteral( "No geometry with feature id %1 exists in the index." ).arg( a0 ).toUtf8().constData() ); diff --git a/python/PyQt6/core/auto_generated/qgstransaction.sip.in b/python/PyQt6/core/auto_generated/qgstransaction.sip.in index 412929f07859..b5f528812390 100644 --- a/python/PyQt6/core/auto_generated/qgstransaction.sip.in +++ b/python/PyQt6/core/auto_generated/qgstransaction.sip.in @@ -152,6 +152,13 @@ returns the last created savepoint void afterRollback(); %Docstring Emitted after a rollback +%End + + void afterRollbackToSavepoint( const QString &savepointName ); +%Docstring +Emitted after a rollback to savepoint + +.. versionadded:: 3.42 %End void dirtied( const QString &sql, const QString &name ); diff --git a/python/PyQt6/core/auto_generated/scalebar/qgsdoubleboxscalebarrenderer.sip.in b/python/PyQt6/core/auto_generated/scalebar/qgsdoubleboxscalebarrenderer.sip.in index 458d2c810456..a7cedd17f041 100644 --- a/python/PyQt6/core/auto_generated/scalebar/qgsdoubleboxscalebarrenderer.sip.in +++ b/python/PyQt6/core/auto_generated/scalebar/qgsdoubleboxscalebarrenderer.sip.in @@ -36,6 +36,8 @@ Double box with alternating colors. const QgsScaleBarSettings &settings, const QgsScaleBarRenderer::ScaleBarContext &scaleContext ) const; + virtual bool applyDefaultSettings( QgsScaleBarSettings &settings ) const; + }; /************************************************************************ diff --git a/python/PyQt6/core/auto_generated/scalebar/qgshollowscalebarrenderer.sip.in b/python/PyQt6/core/auto_generated/scalebar/qgshollowscalebarrenderer.sip.in index 0a8ad51a02c6..fd669e79b5be 100644 --- a/python/PyQt6/core/auto_generated/scalebar/qgshollowscalebarrenderer.sip.in +++ b/python/PyQt6/core/auto_generated/scalebar/qgshollowscalebarrenderer.sip.in @@ -40,7 +40,6 @@ alternating segments. AKA "South African" style. const QgsScaleBarRenderer::ScaleBarContext &scaleContext ) const; virtual bool applyDefaultSettings( QgsScaleBarSettings &settings ) const; - }; /************************************************************************ diff --git a/python/PyQt6/core/auto_generated/scalebar/qgssingleboxscalebarrenderer.sip.in b/python/PyQt6/core/auto_generated/scalebar/qgssingleboxscalebarrenderer.sip.in index 30e8ed6d403f..4a828b2e55e8 100644 --- a/python/PyQt6/core/auto_generated/scalebar/qgssingleboxscalebarrenderer.sip.in +++ b/python/PyQt6/core/auto_generated/scalebar/qgssingleboxscalebarrenderer.sip.in @@ -37,6 +37,8 @@ color for the segments. const QgsScaleBarSettings &settings, const QgsScaleBarRenderer::ScaleBarContext &scaleContext ) const; + virtual bool applyDefaultSettings( QgsScaleBarSettings &settings ) const; + }; /************************************************************************ diff --git a/python/PyQt6/core/auto_generated/symbology/qgsmasksymbollayer.sip.in b/python/PyQt6/core/auto_generated/symbology/qgsmasksymbollayer.sip.in index 03583d69ad2c..1ee80706775d 100644 --- a/python/PyQt6/core/auto_generated/symbology/qgsmasksymbollayer.sip.in +++ b/python/PyQt6/core/auto_generated/symbology/qgsmasksymbollayer.sip.in @@ -85,6 +85,15 @@ Returns a list of references to symbol layers that are masked by the sub symbol' :return: a list of references to masked symbol layers .. seealso:: :py:func:`setMasks` +%End + + void clearMasks(); +%Docstring +Remove masks defined by this symbol layer. + +.. seealso:: :py:func:`masks` + +.. versionadded:: 3.42 %End void setMasks( const QList &maskedLayers ); @@ -100,8 +109,6 @@ Sets the symbol layers that will be masked by the sub symbol's shape. QgsMaskMarkerSymbolLayer( const QgsMaskMarkerSymbolLayer & ); }; - - /************************************************************************ * This file has been generated automatically from * * * diff --git a/python/PyQt6/core/auto_generated/symbology/qgssymbollayerutils.sip.in b/python/PyQt6/core/auto_generated/symbology/qgssymbollayerutils.sip.in index 4e60a056d2dc..5dfda106322a 100644 --- a/python/PyQt6/core/auto_generated/symbology/qgssymbollayerutils.sip.in +++ b/python/PyQt6/core/auto_generated/symbology/qgssymbollayerutils.sip.in @@ -1020,6 +1020,13 @@ Regenerate recursively unique id from all ``symbol`` symbol layers Regenerate recursively unique id from ``symbolLayer`` and its children .. versionadded:: 3.30 +%End + + static void clearSymbolLayerMasks( QgsSymbol *symbol ); +%Docstring +Remove recursively masks from all ``symbol`` symbol layers + +.. versionadded:: 3.42 %End static QVector< QgsGeometry > collectSymbolLayerClipGeometries( const QgsRenderContext &context, const QString &symbolLayerId, const QRectF &bounds ); diff --git a/python/PyQt6/core/auto_generated/vector/qgsvectorlayereditbuffer.sip.in b/python/PyQt6/core/auto_generated/vector/qgsvectorlayereditbuffer.sip.in index 422d7a2470d4..96f6588d7038 100644 --- a/python/PyQt6/core/auto_generated/vector/qgsvectorlayereditbuffer.sip.in +++ b/python/PyQt6/core/auto_generated/vector/qgsvectorlayereditbuffer.sip.in @@ -321,7 +321,7 @@ Update feature with uncommitted geometry updates Update feature with uncommitted attribute updates %End - void handleAttributeAdded( int index ); + void handleAttributeAdded( int index, const QgsField &field ); %Docstring Update added and changed features after addition of an attribute %End diff --git a/python/PyQt6/core/auto_generated/vector/qgsvectorlayereditutils.sip.in b/python/PyQt6/core/auto_generated/vector/qgsvectorlayereditutils.sip.in index 2a7e6a972eca..63643833dfe2 100644 --- a/python/PyQt6/core/auto_generated/vector/qgsvectorlayereditutils.sip.in +++ b/python/PyQt6/core/auto_generated/vector/qgsvectorlayereditutils.sip.in @@ -332,6 +332,7 @@ Merge features into a single one. .. versionadded:: 3.30 %End + }; /************************************************************************ diff --git a/python/PyQt6/core/class_map.yaml b/python/PyQt6/core/class_map.yaml index f82eb16d4aee..ba37124a4985 100644 --- a/python/PyQt6/core/class_map.yaml +++ b/python/PyQt6/core/class_map.yaml @@ -1,10 +1,10 @@ -Qgis.defaultProjectScales: src/core/qgis.h#L5817 +Qgis.defaultProjectScales: src/core/qgis.h#L5837 Qgis.devVersion: src/core/qgis.h#L89 -Qgis.geosVersion: src/core/qgis.h#L5852 -Qgis.geosVersionInt: src/core/qgis.h#L5824 -Qgis.geosVersionMajor: src/core/qgis.h#L5831 -Qgis.geosVersionMinor: src/core/qgis.h#L5838 -Qgis.geosVersionPatch: src/core/qgis.h#L5845 +Qgis.geosVersion: src/core/qgis.h#L5872 +Qgis.geosVersionInt: src/core/qgis.h#L5844 +Qgis.geosVersionMajor: src/core/qgis.h#L5851 +Qgis.geosVersionMinor: src/core/qgis.h#L5858 +Qgis.geosVersionPatch: src/core/qgis.h#L5865 Qgis.releaseName: src/core/qgis.h#L79 Qgis.version: src/core/qgis.h#L65 Qgis.versionInt: src/core/qgis.h#L72 @@ -108,11 +108,12 @@ QgsAbstractCacheIndex.flushFeature: src/core/qgscacheindex.h#L42 QgsAbstractCacheIndex.getCacheIterator: src/core/qgscacheindex.h#L76 QgsAbstractCacheIndex.requestCompleted: src/core/qgscacheindex.h#L59 QgsAbstractCacheIndex: src/core/qgscacheindex.h#L31 -QgsAbstractContentCacheBase.checkReply: src/core/qgsabstractcontentcache.h#L184 -QgsAbstractContentCacheBase.isBase64Data: src/core/qgsabstractcontentcache.h#L164 -QgsAbstractContentCacheBase.onRemoteContentFetched: src/core/qgsabstractcontentcache.h#L194 +QgsAbstractContentCacheBase.checkReply: src/core/qgsabstractcontentcache.h#L201 +QgsAbstractContentCacheBase.isBase64Data: src/core/qgsabstractcontentcache.h#L181 +QgsAbstractContentCacheBase.onRemoteContentFetched: src/core/qgsabstractcontentcache.h#L211 QgsAbstractContentCacheBase.parseBase64DataUrl: src/core/qgsabstractcontentcache.h#L157 -QgsAbstractContentCacheBase.remoteContentFetched: src/core/qgsabstractcontentcache.h#L171 +QgsAbstractContentCacheBase.parseEmbeddedStringData: src/core/qgsabstractcontentcache.h#L174 +QgsAbstractContentCacheBase.remoteContentFetched: src/core/qgsabstractcontentcache.h#L188 QgsAbstractContentCacheBase: src/core/qgsabstractcontentcache.h#L132 QgsAbstractContentCacheEntry.dataSize: src/core/qgsabstractcontentcache.h#L99 QgsAbstractContentCacheEntry.dump: src/core/qgsabstractcontentcache.h#L104 @@ -1485,108 +1486,109 @@ QgsAuthConfigurationStorageRegistry.storageAdded: src/core/auth/qgsauthconfigura QgsAuthConfigurationStorageRegistry.storageChanged: src/core/auth/qgsauthconfigurationstorageregistry.h#L120 QgsAuthConfigurationStorageRegistry.storageRemoved: src/core/auth/qgsauthconfigurationstorageregistry.h#L126 QgsAuthConfigurationStorageRegistry: src/core/auth/qgsauthconfigurationstorageregistry.h#L41 -QgsAuthManager.authConfigurationStorageRegistry: src/core/auth/qgsauthmanager.h#L123 -QgsAuthManager.authDatabaseChanged: src/core/auth/qgsauthmanager.h#L830 -QgsAuthManager.authDatabaseConfigTable: src/core/auth/qgsauthmanager.h#L136 -QgsAuthManager.authDatabaseConnection: src/core/auth/qgsauthmanager.h#L130 -QgsAuthManager.authDatabaseEraseRequested: src/core/auth/qgsauthmanager.h#L827 -QgsAuthManager.authDatabaseServersTable: src/core/auth/qgsauthmanager.h#L149 -QgsAuthManager.authManTag: src/core/auth/qgsauthmanager.h#L270 -QgsAuthManager.authMethod: src/core/auth/qgsauthmanager.h#L302 -QgsAuthManager.authMethodEditWidget: src/core/auth/qgsauthmanager.h#L326 -QgsAuthManager.authMethodsKeys: src/core/auth/qgsauthmanager.h#L296 -QgsAuthManager.authSetting: src/core/auth/qgsauthmanager.h#L481 -QgsAuthManager.authenticationDatabasePath: src/core/auth/qgsauthmanager.h#L163 -QgsAuthManager.authenticationDatabaseUri: src/core/auth/qgsauthmanager.h#L181 -QgsAuthManager.authenticationDatabaseUriStripped: src/core/auth/qgsauthmanager.h#L187 -QgsAuthManager.availableAuthMethodConfigs: src/core/auth/qgsauthmanager.h#L276 -QgsAuthManager.backupAuthenticationDatabase: src/core/auth/qgsauthmanager.h#L416 -QgsAuthManager.certAuthority: src/core/auth/qgsauthmanager.h#L604 -QgsAuthManager.certIdentity: src/core/auth/qgsauthmanager.h#L503 -QgsAuthManager.certIdentityBundleToPem: src/core/auth/qgsauthmanager.h#L518 -QgsAuthManager.certIdentityIds: src/core/auth/qgsauthmanager.h#L532 -QgsAuthManager.certTrustPolicy: src/core/auth/qgsauthmanager.h#L657 -QgsAuthManager.certificateTrustPolicy: src/core/auth/qgsauthmanager.h#L670 -QgsAuthManager.clearAllCachedConfigs: src/core/auth/qgsauthmanager.h#L834 -QgsAuthManager.clearCachedConfig: src/core/auth/qgsauthmanager.h#L837 -QgsAuthManager.clearMasterPassword: src/core/auth/qgsauthmanager.h#L221 -QgsAuthManager.configAuthMethod: src/core/auth/qgsauthmanager.h#L285 -QgsAuthManager.configAuthMethodKey: src/core/auth/qgsauthmanager.h#L291 -QgsAuthManager.configIdRegex: src/core/auth/qgsauthmanager.h#L352 -QgsAuthManager.configIdUnique: src/core/auth/qgsauthmanager.h#L343 -QgsAuthManager.configIds: src/core/auth/qgsauthmanager.h#L355 -QgsAuthManager.defaultCertTrustPolicy: src/core/auth/qgsauthmanager.h#L676 -QgsAuthManager.disabledMessage: src/core/auth/qgsauthmanager.h#L156 -QgsAuthManager.dumpIgnoredSslErrorsCache_: src/core/auth/qgsauthmanager.h#L579 -QgsAuthManager.ensureInitialized: src/core/auth/qgsauthmanager.h#L115 -QgsAuthManager.eraseAuthenticationDatabase: src/core/auth/qgsauthmanager.h#L424 -QgsAuthManager.existsAuthSetting: src/core/auth/qgsauthmanager.h#L484 -QgsAuthManager.existsCertAuthority: src/core/auth/qgsauthmanager.h#L607 -QgsAuthManager.existsCertIdentity: src/core/auth/qgsauthmanager.h#L535 -QgsAuthManager.existsSslCertCustomConfig: src/core/auth/qgsauthmanager.h#L566 -QgsAuthManager.exportAuthenticationConfigsToXml: src/core/auth/qgsauthmanager.h#L395 -QgsAuthManager.hasConfigId: src/core/auth/qgsauthmanager.h#L349 -QgsAuthManager.importAuthenticationConfigsFromXml: src/core/auth/qgsauthmanager.h#L404 -QgsAuthManager.init: src/core/auth/qgsauthmanager.h#L94 -QgsAuthManager.initSslCaches: src/core/auth/qgsauthmanager.h#L493 -QgsAuthManager.isDisabled: src/core/auth/qgsauthmanager.h#L153 -QgsAuthManager.isFilesystemBasedDatabase: src/core/auth/qgsauthmanager.h#L168 -QgsAuthManager.loadAuthenticationConfig: src/core/auth/qgsauthmanager.h#L379 -QgsAuthManager.masterPasswordHashInDatabase: src/core/auth/qgsauthmanager.h#L215 -QgsAuthManager.masterPasswordIsSet: src/core/auth/qgsauthmanager.h#L212 -QgsAuthManager.masterPasswordSame: src/core/auth/qgsauthmanager.h#L227 -QgsAuthManager.masterPasswordVerified: src/core/auth/qgsauthmanager.h#L824 -QgsAuthManager.messageLog: src/core/auth/qgsauthmanager.h#L798 -QgsAuthManager.messageOut: src/core/auth/qgsauthmanager.h#L788 -QgsAuthManager.methodConfigTableName: src/core/auth/qgsauthmanager.h#L143 -QgsAuthManager.passwordHelperEnabled: src/core/auth/qgsauthmanager.h#L733 -QgsAuthManager.passwordHelperFailure: src/core/auth/qgsauthmanager.h#L772 -QgsAuthManager.passwordHelperMessageLog: src/core/auth/qgsauthmanager.h#L818 -QgsAuthManager.passwordHelperMessageOut: src/core/auth/qgsauthmanager.h#L808 -QgsAuthManager.passwordHelperSuccess: src/core/auth/qgsauthmanager.h#L778 -QgsAuthManager.passwordHelperSync: src/core/auth/qgsauthmanager.h#L757 -QgsAuthManager.rebuildCaCertsCache: src/core/auth/qgsauthmanager.h#L647 -QgsAuthManager.rebuildCertTrustCache: src/core/auth/qgsauthmanager.h#L685 -QgsAuthManager.rebuildIgnoredSslErrorCache: src/core/auth/qgsauthmanager.h#L588 -QgsAuthManager.rebuildTrustedCaCertsCache: src/core/auth/qgsauthmanager.h#L701 -QgsAuthManager.registerCoreAuthMethods: src/core/auth/qgsauthmanager.h#L273 -QgsAuthManager.removeAllAuthenticationConfigs: src/core/auth/qgsauthmanager.h#L410 -QgsAuthManager.removeAuthSetting: src/core/auth/qgsauthmanager.h#L487 -QgsAuthManager.removeAuthenticationConfig: src/core/auth/qgsauthmanager.h#L386 -QgsAuthManager.removeCertAuthority: src/core/auth/qgsauthmanager.h#L610 -QgsAuthManager.removeCertIdentity: src/core/auth/qgsauthmanager.h#L538 -QgsAuthManager.removeCertTrustPolicies: src/core/auth/qgsauthmanager.h#L660 -QgsAuthManager.removeCertTrustPolicy: src/core/auth/qgsauthmanager.h#L663 -QgsAuthManager.removeSslCertCustomConfig: src/core/auth/qgsauthmanager.h#L569 -QgsAuthManager.resetMasterPassword: src/core/auth/qgsauthmanager.h#L237 -QgsAuthManager.setDefaultCertTrustPolicy: src/core/auth/qgsauthmanager.h#L673 -QgsAuthManager.setMasterPassword: src/core/auth/qgsauthmanager.h#L194 -QgsAuthManager.setMasterPassword: src/core/auth/qgsauthmanager.h#L202 -QgsAuthManager.setPasswordHelperEnabled: src/core/auth/qgsauthmanager.h#L739 -QgsAuthManager.setScheduledAuthDatabaseEraseRequestEmitted: src/core/auth/qgsauthmanager.h#L267 -QgsAuthManager.setup: src/core/auth/qgsauthmanager.h#L106 -QgsAuthManager.sslCertCustomConfig: src/core/auth/qgsauthmanager.h#L550 -QgsAuthManager.sslCertCustomConfigByHost: src/core/auth/qgsauthmanager.h#L557 -QgsAuthManager.storeAuthSetting: src/core/auth/qgsauthmanager.h#L472 -QgsAuthManager.storeAuthenticationConfig: src/core/auth/qgsauthmanager.h#L363 -QgsAuthManager.storeCertAuthorities: src/core/auth/qgsauthmanager.h#L592 -QgsAuthManager.storeCertAuthority: src/core/auth/qgsauthmanager.h#L595 -QgsAuthManager.storeCertIdentity: src/core/auth/qgsauthmanager.h#L496 -QgsAuthManager.storeCertTrustPolicy: src/core/auth/qgsauthmanager.h#L650 -QgsAuthManager.storeSslCertCustomConfig: src/core/auth/qgsauthmanager.h#L542 -QgsAuthManager.supportedAuthMethodExpansions: src/core/auth/qgsauthmanager.h#L334 -QgsAuthManager.trustedCaCertsPemText: src/core/auth/qgsauthmanager.h#L713 -QgsAuthManager.uniqueConfigId: src/core/auth/qgsauthmanager.h#L337 -QgsAuthManager.updateAuthenticationConfig: src/core/auth/qgsauthmanager.h#L370 -QgsAuthManager.updateConfigAuthMethods: src/core/auth/qgsauthmanager.h#L279 -QgsAuthManager.updateDataSourceUriItems: src/core/auth/qgsauthmanager.h#L456 -QgsAuthManager.updateIgnoredSslErrorsCache: src/core/auth/qgsauthmanager.h#L585 -QgsAuthManager.updateIgnoredSslErrorsCacheFromConfig: src/core/auth/qgsauthmanager.h#L582 -QgsAuthManager.updateNetworkProxy: src/core/auth/qgsauthmanager.h#L466 -QgsAuthManager.updateNetworkReply: src/core/auth/qgsauthmanager.h#L446 -QgsAuthManager.updateNetworkRequest: src/core/auth/qgsauthmanager.h#L436 -QgsAuthManager.verifyMasterPassword: src/core/auth/qgsauthmanager.h#L209 -QgsAuthManager: src/core/auth/qgsauthmanager.h#L70 +QgsAuthManager.authConfigurationStorageRegistry: src/core/auth/qgsauthmanager.h#L127 +QgsAuthManager.authDatabaseChanged: src/core/auth/qgsauthmanager.h#L889 +QgsAuthManager.authDatabaseConfigTable: src/core/auth/qgsauthmanager.h#L140 +QgsAuthManager.authDatabaseConnection: src/core/auth/qgsauthmanager.h#L134 +QgsAuthManager.authDatabaseEraseRequested: src/core/auth/qgsauthmanager.h#L886 +QgsAuthManager.authDatabaseServersTable: src/core/auth/qgsauthmanager.h#L153 +QgsAuthManager.authManTag: src/core/auth/qgsauthmanager.h#L299 +QgsAuthManager.authMethod: src/core/auth/qgsauthmanager.h#L331 +QgsAuthManager.authMethodEditWidget: src/core/auth/qgsauthmanager.h#L355 +QgsAuthManager.authMethodsKeys: src/core/auth/qgsauthmanager.h#L325 +QgsAuthManager.authSetting: src/core/auth/qgsauthmanager.h#L510 +QgsAuthManager.authenticationDatabasePath: src/core/auth/qgsauthmanager.h#L167 +QgsAuthManager.authenticationDatabaseUri: src/core/auth/qgsauthmanager.h#L185 +QgsAuthManager.authenticationDatabaseUriStripped: src/core/auth/qgsauthmanager.h#L191 +QgsAuthManager.availableAuthMethodConfigs: src/core/auth/qgsauthmanager.h#L305 +QgsAuthManager.backupAuthenticationDatabase: src/core/auth/qgsauthmanager.h#L445 +QgsAuthManager.certAuthority: src/core/auth/qgsauthmanager.h#L633 +QgsAuthManager.certIdentity: src/core/auth/qgsauthmanager.h#L532 +QgsAuthManager.certIdentityBundleToPem: src/core/auth/qgsauthmanager.h#L547 +QgsAuthManager.certIdentityIds: src/core/auth/qgsauthmanager.h#L561 +QgsAuthManager.certTrustPolicy: src/core/auth/qgsauthmanager.h#L686 +QgsAuthManager.certificateTrustPolicy: src/core/auth/qgsauthmanager.h#L699 +QgsAuthManager.clearAllCachedConfigs: src/core/auth/qgsauthmanager.h#L893 +QgsAuthManager.clearCachedConfig: src/core/auth/qgsauthmanager.h#L896 +QgsAuthManager.clearMasterPassword: src/core/auth/qgsauthmanager.h#L234 +QgsAuthManager.configAuthMethod: src/core/auth/qgsauthmanager.h#L314 +QgsAuthManager.configAuthMethodKey: src/core/auth/qgsauthmanager.h#L320 +QgsAuthManager.configIdRegex: src/core/auth/qgsauthmanager.h#L381 +QgsAuthManager.configIdUnique: src/core/auth/qgsauthmanager.h#L372 +QgsAuthManager.configIds: src/core/auth/qgsauthmanager.h#L384 +QgsAuthManager.defaultCertTrustPolicy: src/core/auth/qgsauthmanager.h#L705 +QgsAuthManager.disabledMessage: src/core/auth/qgsauthmanager.h#L160 +QgsAuthManager.dumpIgnoredSslErrorsCache_: src/core/auth/qgsauthmanager.h#L608 +QgsAuthManager.ensureInitialized: src/core/auth/qgsauthmanager.h#L119 +QgsAuthManager.eraseAuthenticationDatabase: src/core/auth/qgsauthmanager.h#L453 +QgsAuthManager.existsAuthSetting: src/core/auth/qgsauthmanager.h#L513 +QgsAuthManager.existsCertAuthority: src/core/auth/qgsauthmanager.h#L636 +QgsAuthManager.existsCertIdentity: src/core/auth/qgsauthmanager.h#L564 +QgsAuthManager.existsSslCertCustomConfig: src/core/auth/qgsauthmanager.h#L595 +QgsAuthManager.exportAuthenticationConfigsToXml: src/core/auth/qgsauthmanager.h#L424 +QgsAuthManager.hasConfigId: src/core/auth/qgsauthmanager.h#L378 +QgsAuthManager.importAuthenticationConfigsFromXml: src/core/auth/qgsauthmanager.h#L433 +QgsAuthManager.init: src/core/auth/qgsauthmanager.h#L98 +QgsAuthManager.initSslCaches: src/core/auth/qgsauthmanager.h#L522 +QgsAuthManager.isDisabled: src/core/auth/qgsauthmanager.h#L157 +QgsAuthManager.isFilesystemBasedDatabase: src/core/auth/qgsauthmanager.h#L172 +QgsAuthManager.loadAuthenticationConfig: src/core/auth/qgsauthmanager.h#L408 +QgsAuthManager.masterPasswordHashInDatabase: src/core/auth/qgsauthmanager.h#L228 +QgsAuthManager.masterPasswordIsSet: src/core/auth/qgsauthmanager.h#L225 +QgsAuthManager.masterPasswordSame: src/core/auth/qgsauthmanager.h#L240 +QgsAuthManager.masterPasswordVerified: src/core/auth/qgsauthmanager.h#L883 +QgsAuthManager.messageLog: src/core/auth/qgsauthmanager.h#L857 +QgsAuthManager.messageOut: src/core/auth/qgsauthmanager.h#L847 +QgsAuthManager.methodConfigTableName: src/core/auth/qgsauthmanager.h#L147 +QgsAuthManager.passwordHelperDisplayName: src/core/auth/qgsauthmanager.h#L813 +QgsAuthManager.passwordHelperEnabled: src/core/auth/qgsauthmanager.h#L762 +QgsAuthManager.passwordHelperFailure: src/core/auth/qgsauthmanager.h#L831 +QgsAuthManager.passwordHelperMessageLog: src/core/auth/qgsauthmanager.h#L877 +QgsAuthManager.passwordHelperMessageOut: src/core/auth/qgsauthmanager.h#L867 +QgsAuthManager.passwordHelperSuccess: src/core/auth/qgsauthmanager.h#L837 +QgsAuthManager.passwordHelperSync: src/core/auth/qgsauthmanager.h#L786 +QgsAuthManager.rebuildCaCertsCache: src/core/auth/qgsauthmanager.h#L676 +QgsAuthManager.rebuildCertTrustCache: src/core/auth/qgsauthmanager.h#L714 +QgsAuthManager.rebuildIgnoredSslErrorCache: src/core/auth/qgsauthmanager.h#L617 +QgsAuthManager.rebuildTrustedCaCertsCache: src/core/auth/qgsauthmanager.h#L730 +QgsAuthManager.registerCoreAuthMethods: src/core/auth/qgsauthmanager.h#L302 +QgsAuthManager.removeAllAuthenticationConfigs: src/core/auth/qgsauthmanager.h#L439 +QgsAuthManager.removeAuthSetting: src/core/auth/qgsauthmanager.h#L516 +QgsAuthManager.removeAuthenticationConfig: src/core/auth/qgsauthmanager.h#L415 +QgsAuthManager.removeCertAuthority: src/core/auth/qgsauthmanager.h#L639 +QgsAuthManager.removeCertIdentity: src/core/auth/qgsauthmanager.h#L567 +QgsAuthManager.removeCertTrustPolicies: src/core/auth/qgsauthmanager.h#L689 +QgsAuthManager.removeCertTrustPolicy: src/core/auth/qgsauthmanager.h#L692 +QgsAuthManager.removeSslCertCustomConfig: src/core/auth/qgsauthmanager.h#L598 +QgsAuthManager.resetMasterPassword: src/core/auth/qgsauthmanager.h#L251 +QgsAuthManager.setDefaultCertTrustPolicy: src/core/auth/qgsauthmanager.h#L702 +QgsAuthManager.setMasterPassword: src/core/auth/qgsauthmanager.h#L207 +QgsAuthManager.setMasterPassword: src/core/auth/qgsauthmanager.h#L215 +QgsAuthManager.setPasswordHelperEnabled: src/core/auth/qgsauthmanager.h#L768 +QgsAuthManager.setScheduledAuthDatabaseEraseRequestEmitted: src/core/auth/qgsauthmanager.h#L296 +QgsAuthManager.setup: src/core/auth/qgsauthmanager.h#L110 +QgsAuthManager.sslCertCustomConfig: src/core/auth/qgsauthmanager.h#L579 +QgsAuthManager.sslCertCustomConfigByHost: src/core/auth/qgsauthmanager.h#L586 +QgsAuthManager.storeAuthSetting: src/core/auth/qgsauthmanager.h#L501 +QgsAuthManager.storeAuthenticationConfig: src/core/auth/qgsauthmanager.h#L392 +QgsAuthManager.storeCertAuthorities: src/core/auth/qgsauthmanager.h#L621 +QgsAuthManager.storeCertAuthority: src/core/auth/qgsauthmanager.h#L624 +QgsAuthManager.storeCertIdentity: src/core/auth/qgsauthmanager.h#L525 +QgsAuthManager.storeCertTrustPolicy: src/core/auth/qgsauthmanager.h#L679 +QgsAuthManager.storeSslCertCustomConfig: src/core/auth/qgsauthmanager.h#L571 +QgsAuthManager.supportedAuthMethodExpansions: src/core/auth/qgsauthmanager.h#L363 +QgsAuthManager.trustedCaCertsPemText: src/core/auth/qgsauthmanager.h#L742 +QgsAuthManager.uniqueConfigId: src/core/auth/qgsauthmanager.h#L366 +QgsAuthManager.updateAuthenticationConfig: src/core/auth/qgsauthmanager.h#L399 +QgsAuthManager.updateConfigAuthMethods: src/core/auth/qgsauthmanager.h#L308 +QgsAuthManager.updateDataSourceUriItems: src/core/auth/qgsauthmanager.h#L485 +QgsAuthManager.updateIgnoredSslErrorsCache: src/core/auth/qgsauthmanager.h#L614 +QgsAuthManager.updateIgnoredSslErrorsCacheFromConfig: src/core/auth/qgsauthmanager.h#L611 +QgsAuthManager.updateNetworkProxy: src/core/auth/qgsauthmanager.h#L495 +QgsAuthManager.updateNetworkReply: src/core/auth/qgsauthmanager.h#L475 +QgsAuthManager.updateNetworkRequest: src/core/auth/qgsauthmanager.h#L465 +QgsAuthManager.verifyMasterPassword: src/core/auth/qgsauthmanager.h#L222 +QgsAuthManager: src/core/auth/qgsauthmanager.h#L71 QgsAuthMethod.QgsAuthMethod: src/core/auth/qgsauthmethod.h#L189 QgsAuthMethod.authMethodTag: src/core/auth/qgsauthmethod.h#L192 QgsAuthMethod.clearCachedConfig: src/core/auth/qgsauthmethod.h#L175 @@ -1844,7 +1846,7 @@ QgsBookmarkManagerModel.rowCount: src/core/qgsbookmarkmodel.h#L87 QgsBookmarkManagerModel.setData: src/core/qgsbookmarkmodel.h#L91 QgsBookmarkManagerModel: src/core/qgsbookmarkmodel.h#L41 QgsBookmarkManagerProxyModel: src/core/qgsbookmarkmodel.h#L119 -QgsBox3D.__repr__: src/core/geometry/qgsbox3d.h#L489 +QgsBox3D.__repr__: src/core/geometry/qgsbox3d.h#L498 QgsBox3D.area: src/core/geometry/qgsbox3d.h#L321 QgsBox3D.center: src/core/geometry/qgsbox3d.h#L314 QgsBox3D.combineWith: src/core/geometry/qgsbox3d.h#L382 @@ -1853,18 +1855,19 @@ QgsBox3D.contains: src/core/geometry/qgsbox3d.h#L356 QgsBox3D.contains: src/core/geometry/qgsbox3d.h#L364 QgsBox3D.contains: src/core/geometry/qgsbox3d.h#L375 QgsBox3D.depth: src/core/geometry/qgsbox3d.h#L307 -QgsBox3D.distanceTo: src/core/geometry/qgsbox3d.h#L402 -QgsBox3D.grow: src/core/geometry/qgsbox3d.h#L426 +QgsBox3D.distanceTo: src/core/geometry/qgsbox3d.h#L403 +QgsBox3D.distanceTo: src/core/geometry/qgsbox3d.h#L411 +QgsBox3D.grow: src/core/geometry/qgsbox3d.h#L435 QgsBox3D.height: src/core/geometry/qgsbox3d.h#L300 QgsBox3D.intersect: src/core/geometry/qgsbox3d.h#L331 QgsBox3D.intersects: src/core/geometry/qgsbox3d.h#L351 QgsBox3D.is2d: src/core/geometry/qgsbox3d.h#L337 QgsBox3D.is3D: src/core/geometry/qgsbox3d.h#L346 -QgsBox3D.isEmpty: src/core/geometry/qgsbox3d.h#L447 -QgsBox3D.isNull: src/core/geometry/qgsbox3d.h#L437 +QgsBox3D.isEmpty: src/core/geometry/qgsbox3d.h#L456 +QgsBox3D.isNull: src/core/geometry/qgsbox3d.h#L446 QgsBox3D.normalize: src/core/geometry/qgsbox3d.h#L286 -QgsBox3D.scale: src/core/geometry/qgsbox3d.h#L413 -QgsBox3D.scale: src/core/geometry/qgsbox3d.h#L420 +QgsBox3D.scale: src/core/geometry/qgsbox3d.h#L422 +QgsBox3D.scale: src/core/geometry/qgsbox3d.h#L429 QgsBox3D.set: src/core/geometry/qgsbox3d.h#L190 QgsBox3D.setNull: src/core/geometry/qgsbox3d.h#L281 QgsBox3D.setXMaximum: src/core/geometry/qgsbox3d.h#L204 @@ -1874,7 +1877,7 @@ QgsBox3D.setYMinimum: src/core/geometry/qgsbox3d.h#L225 QgsBox3D.setZMaximum: src/core/geometry/qgsbox3d.h#L260 QgsBox3D.setZMinimum: src/core/geometry/qgsbox3d.h#L253 QgsBox3D.toRectangle: src/core/geometry/qgsbox3d.h#L394 -QgsBox3D.toString: src/core/geometry/qgsbox3d.h#L456 +QgsBox3D.toString: src/core/geometry/qgsbox3d.h#L465 QgsBox3D.volume: src/core/geometry/qgsbox3d.h#L326 QgsBox3D.width: src/core/geometry/qgsbox3d.h#L293 QgsBox3D.xMaximum: src/core/geometry/qgsbox3d.h#L218 @@ -2619,91 +2622,91 @@ QgsCoordinateFormatter.formatX: src/core/qgscoordinateformatter.h#L75 QgsCoordinateFormatter.formatY: src/core/qgscoordinateformatter.h#L88 QgsCoordinateFormatter.separator: src/core/qgscoordinateformatter.h#L116 QgsCoordinateFormatter: src/core/qgscoordinateformatter.h#L39 -QgsCoordinateReferenceSystem.QVariant: src/core/proj/qgscoordinatereferencesystem.h#L280 -QgsCoordinateReferenceSystem.QgsCoordinateReferenceSystem: src/core/proj/qgscoordinatereferencesystem.h#L256 -QgsCoordinateReferenceSystem.QgsCoordinateReferenceSystem: src/core/proj/qgscoordinatereferencesystem.h#L271 -QgsCoordinateReferenceSystem.__repr__: src/core/proj/qgscoordinatereferencesystem.h#L1079 -QgsCoordinateReferenceSystem.authid: src/core/proj/qgscoordinatereferencesystem.h#L658 -QgsCoordinateReferenceSystem.axisOrdering: src/core/proj/qgscoordinatereferencesystem.h#L886 -QgsCoordinateReferenceSystem.bounds: src/core/proj/qgscoordinatereferencesystem.h#L937 -QgsCoordinateReferenceSystem.celestialBodyName: src/core/proj/qgscoordinatereferencesystem.h#L796 -QgsCoordinateReferenceSystem.clearRecentCoordinateReferenceSystems: src/core/proj/qgscoordinatereferencesystem.h#L1158 -QgsCoordinateReferenceSystem.coordinateEpoch: src/core/proj/qgscoordinatereferencesystem.h#L846 -QgsCoordinateReferenceSystem.createCompoundCrs: src/core/proj/qgscoordinatereferencesystem.h#L376 -QgsCoordinateReferenceSystem.createFromId: src/core/proj/qgscoordinatereferencesystem.h#L387 -QgsCoordinateReferenceSystem.createFromOgcWmsCrs: src/core/proj/qgscoordinatereferencesystem.h#L404 -QgsCoordinateReferenceSystem.createFromProj4: src/core/proj/qgscoordinatereferencesystem.h#L477 -QgsCoordinateReferenceSystem.createFromProj: src/core/proj/qgscoordinatereferencesystem.h#L511 -QgsCoordinateReferenceSystem.createFromSrid: src/core/proj/qgscoordinatereferencesystem.h#L415 -QgsCoordinateReferenceSystem.createFromSrsId: src/core/proj/qgscoordinatereferencesystem.h#L449 -QgsCoordinateReferenceSystem.createFromString: src/core/proj/qgscoordinatereferencesystem.h#L533 -QgsCoordinateReferenceSystem.createFromUserInput: src/core/proj/qgscoordinatereferencesystem.h#L555 -QgsCoordinateReferenceSystem.createFromWkt: src/core/proj/qgscoordinatereferencesystem.h#L432 -QgsCoordinateReferenceSystem.datumEnsemble: src/core/proj/qgscoordinatereferencesystem.h#L785 -QgsCoordinateReferenceSystem.description: src/core/proj/qgscoordinatereferencesystem.h#L667 -QgsCoordinateReferenceSystem.ellipsoidAcronym: src/core/proj/qgscoordinatereferencesystem.h#L698 -QgsCoordinateReferenceSystem.factors: src/core/proj/qgscoordinatereferencesystem.h#L859 -QgsCoordinateReferenceSystem.findMatchingProj: src/core/proj/qgscoordinatereferencesystem.h#L596 -QgsCoordinateReferenceSystem.fromEpsgId: src/core/proj/qgscoordinatereferencesystem.h#L313 -QgsCoordinateReferenceSystem.fromOgcWmsCrs: src/core/proj/qgscoordinatereferencesystem.h#L302 -QgsCoordinateReferenceSystem.fromProj4: src/core/proj/qgscoordinatereferencesystem.h#L325 -QgsCoordinateReferenceSystem.fromProj: src/core/proj/qgscoordinatereferencesystem.h#L334 -QgsCoordinateReferenceSystem.fromSrsId: src/core/proj/qgscoordinatereferencesystem.h#L359 -QgsCoordinateReferenceSystem.fromWkt: src/core/proj/qgscoordinatereferencesystem.h#L346 -QgsCoordinateReferenceSystem.geographicCrsAuthId: src/core/proj/qgscoordinatereferencesystem.h#L1076 -QgsCoordinateReferenceSystem.hasAxisInverted: src/core/proj/qgscoordinatereferencesystem.h#L876 -QgsCoordinateReferenceSystem.hasVerticalAxis: src/core/proj/qgscoordinatereferencesystem.h#L1073 -QgsCoordinateReferenceSystem.horizontalCrs: src/core/proj/qgscoordinatereferencesystem.h#L1051 -QgsCoordinateReferenceSystem.invalidateCache: src/core/proj/qgscoordinatereferencesystem.h#L1180 -QgsCoordinateReferenceSystem.isDeprecated: src/core/proj/qgscoordinatereferencesystem.h#L753 -QgsCoordinateReferenceSystem.isDynamic: src/core/proj/qgscoordinatereferencesystem.h#L769 -QgsCoordinateReferenceSystem.isGeographic: src/core/proj/qgscoordinatereferencesystem.h#L759 -QgsCoordinateReferenceSystem.isValid: src/core/proj/qgscoordinatereferencesystem.h#L570 -QgsCoordinateReferenceSystem.mapUnits: src/core/proj/qgscoordinatereferencesystem.h#L928 -QgsCoordinateReferenceSystem.nativeFormat: src/core/proj/qgscoordinatereferencesystem.h#L1028 -QgsCoordinateReferenceSystem.operation: src/core/proj/qgscoordinatereferencesystem.h#L867 -QgsCoordinateReferenceSystem.postgisSrid: src/core/proj/qgscoordinatereferencesystem.h#L644 -QgsCoordinateReferenceSystem.projectionAcronym: src/core/proj/qgscoordinatereferencesystem.h#L690 -QgsCoordinateReferenceSystem.pushRecentCoordinateReferenceSystem: src/core/proj/qgscoordinatereferencesystem.h#L1144 -QgsCoordinateReferenceSystem.readXml: src/core/proj/qgscoordinatereferencesystem.h#L607 -QgsCoordinateReferenceSystem.recentProjections: src/core/proj/qgscoordinatereferencesystem.h#L1130 -QgsCoordinateReferenceSystem.removeRecentCoordinateReferenceSystem: src/core/proj/qgscoordinatereferencesystem.h#L1151 -QgsCoordinateReferenceSystem.saveAsUserCrs: src/core/proj/qgscoordinatereferencesystem.h#L1006 -QgsCoordinateReferenceSystem.setCoordinateEpoch: src/core/proj/qgscoordinatereferencesystem.h#L821 -QgsCoordinateReferenceSystem.setNativeFormat: src/core/proj/qgscoordinatereferencesystem.h#L1017 -QgsCoordinateReferenceSystem.setValidationHint: src/core/proj/qgscoordinatereferencesystem.h#L978 -QgsCoordinateReferenceSystem.setupESRIWktFix: src/core/proj/qgscoordinatereferencesystem.h#L567 -QgsCoordinateReferenceSystem.srsid: src/core/proj/qgscoordinatereferencesystem.h#L636 -QgsCoordinateReferenceSystem.syncDatabase: src/core/proj/qgscoordinatereferencesystem.h#L991 -QgsCoordinateReferenceSystem.toGeographicCrs: src/core/proj/qgscoordinatereferencesystem.h#L1039 -QgsCoordinateReferenceSystem.toOgcUri: src/core/proj/qgscoordinatereferencesystem.h#L945 -QgsCoordinateReferenceSystem.toOgcUrn: src/core/proj/qgscoordinatereferencesystem.h#L953 -QgsCoordinateReferenceSystem.toProj4: src/core/proj/qgscoordinatereferencesystem.h#L725 -QgsCoordinateReferenceSystem.toProj: src/core/proj/qgscoordinatereferencesystem.h#L739 -QgsCoordinateReferenceSystem.toWkt: src/core/proj/qgscoordinatereferencesystem.h#L711 -QgsCoordinateReferenceSystem.type: src/core/proj/qgscoordinatereferencesystem.h#L746 -QgsCoordinateReferenceSystem.updateDefinition: src/core/proj/qgscoordinatereferencesystem.h#L973 -QgsCoordinateReferenceSystem.userFriendlyIdentifier: src/core/proj/qgscoordinatereferencesystem.h#L682 -QgsCoordinateReferenceSystem.validate: src/core/proj/qgscoordinatereferencesystem.h#L584 -QgsCoordinateReferenceSystem.validationHint: src/core/proj/qgscoordinatereferencesystem.h#L983 -QgsCoordinateReferenceSystem.verticalCrs: src/core/proj/qgscoordinatereferencesystem.h#L1065 -QgsCoordinateReferenceSystem.writeXml: src/core/proj/qgscoordinatereferencesystem.h#L615 -QgsCoordinateReferenceSystem: src/core/proj/qgscoordinatereferencesystem.h#L211 +QgsCoordinateReferenceSystem.QVariant: src/core/proj/qgscoordinatereferencesystem.h#L275 +QgsCoordinateReferenceSystem.QgsCoordinateReferenceSystem: src/core/proj/qgscoordinatereferencesystem.h#L251 +QgsCoordinateReferenceSystem.QgsCoordinateReferenceSystem: src/core/proj/qgscoordinatereferencesystem.h#L266 +QgsCoordinateReferenceSystem.__repr__: src/core/proj/qgscoordinatereferencesystem.h#L1066 +QgsCoordinateReferenceSystem.authid: src/core/proj/qgscoordinatereferencesystem.h#L653 +QgsCoordinateReferenceSystem.axisOrdering: src/core/proj/qgscoordinatereferencesystem.h#L873 +QgsCoordinateReferenceSystem.bounds: src/core/proj/qgscoordinatereferencesystem.h#L924 +QgsCoordinateReferenceSystem.celestialBodyName: src/core/proj/qgscoordinatereferencesystem.h#L783 +QgsCoordinateReferenceSystem.clearRecentCoordinateReferenceSystems: src/core/proj/qgscoordinatereferencesystem.h#L1145 +QgsCoordinateReferenceSystem.coordinateEpoch: src/core/proj/qgscoordinatereferencesystem.h#L833 +QgsCoordinateReferenceSystem.createCompoundCrs: src/core/proj/qgscoordinatereferencesystem.h#L371 +QgsCoordinateReferenceSystem.createFromId: src/core/proj/qgscoordinatereferencesystem.h#L382 +QgsCoordinateReferenceSystem.createFromOgcWmsCrs: src/core/proj/qgscoordinatereferencesystem.h#L399 +QgsCoordinateReferenceSystem.createFromProj4: src/core/proj/qgscoordinatereferencesystem.h#L472 +QgsCoordinateReferenceSystem.createFromProj: src/core/proj/qgscoordinatereferencesystem.h#L506 +QgsCoordinateReferenceSystem.createFromSrid: src/core/proj/qgscoordinatereferencesystem.h#L410 +QgsCoordinateReferenceSystem.createFromSrsId: src/core/proj/qgscoordinatereferencesystem.h#L444 +QgsCoordinateReferenceSystem.createFromString: src/core/proj/qgscoordinatereferencesystem.h#L528 +QgsCoordinateReferenceSystem.createFromUserInput: src/core/proj/qgscoordinatereferencesystem.h#L550 +QgsCoordinateReferenceSystem.createFromWkt: src/core/proj/qgscoordinatereferencesystem.h#L427 +QgsCoordinateReferenceSystem.datumEnsemble: src/core/proj/qgscoordinatereferencesystem.h#L776 +QgsCoordinateReferenceSystem.description: src/core/proj/qgscoordinatereferencesystem.h#L662 +QgsCoordinateReferenceSystem.ellipsoidAcronym: src/core/proj/qgscoordinatereferencesystem.h#L693 +QgsCoordinateReferenceSystem.factors: src/core/proj/qgscoordinatereferencesystem.h#L846 +QgsCoordinateReferenceSystem.findMatchingProj: src/core/proj/qgscoordinatereferencesystem.h#L591 +QgsCoordinateReferenceSystem.fromEpsgId: src/core/proj/qgscoordinatereferencesystem.h#L308 +QgsCoordinateReferenceSystem.fromOgcWmsCrs: src/core/proj/qgscoordinatereferencesystem.h#L297 +QgsCoordinateReferenceSystem.fromProj4: src/core/proj/qgscoordinatereferencesystem.h#L320 +QgsCoordinateReferenceSystem.fromProj: src/core/proj/qgscoordinatereferencesystem.h#L329 +QgsCoordinateReferenceSystem.fromSrsId: src/core/proj/qgscoordinatereferencesystem.h#L354 +QgsCoordinateReferenceSystem.fromWkt: src/core/proj/qgscoordinatereferencesystem.h#L341 +QgsCoordinateReferenceSystem.geographicCrsAuthId: src/core/proj/qgscoordinatereferencesystem.h#L1063 +QgsCoordinateReferenceSystem.hasAxisInverted: src/core/proj/qgscoordinatereferencesystem.h#L863 +QgsCoordinateReferenceSystem.hasVerticalAxis: src/core/proj/qgscoordinatereferencesystem.h#L1060 +QgsCoordinateReferenceSystem.horizontalCrs: src/core/proj/qgscoordinatereferencesystem.h#L1038 +QgsCoordinateReferenceSystem.invalidateCache: src/core/proj/qgscoordinatereferencesystem.h#L1167 +QgsCoordinateReferenceSystem.isDeprecated: src/core/proj/qgscoordinatereferencesystem.h#L748 +QgsCoordinateReferenceSystem.isDynamic: src/core/proj/qgscoordinatereferencesystem.h#L764 +QgsCoordinateReferenceSystem.isGeographic: src/core/proj/qgscoordinatereferencesystem.h#L754 +QgsCoordinateReferenceSystem.isValid: src/core/proj/qgscoordinatereferencesystem.h#L565 +QgsCoordinateReferenceSystem.mapUnits: src/core/proj/qgscoordinatereferencesystem.h#L915 +QgsCoordinateReferenceSystem.nativeFormat: src/core/proj/qgscoordinatereferencesystem.h#L1015 +QgsCoordinateReferenceSystem.operation: src/core/proj/qgscoordinatereferencesystem.h#L854 +QgsCoordinateReferenceSystem.postgisSrid: src/core/proj/qgscoordinatereferencesystem.h#L639 +QgsCoordinateReferenceSystem.projectionAcronym: src/core/proj/qgscoordinatereferencesystem.h#L685 +QgsCoordinateReferenceSystem.pushRecentCoordinateReferenceSystem: src/core/proj/qgscoordinatereferencesystem.h#L1131 +QgsCoordinateReferenceSystem.readXml: src/core/proj/qgscoordinatereferencesystem.h#L602 +QgsCoordinateReferenceSystem.recentProjections: src/core/proj/qgscoordinatereferencesystem.h#L1117 +QgsCoordinateReferenceSystem.removeRecentCoordinateReferenceSystem: src/core/proj/qgscoordinatereferencesystem.h#L1138 +QgsCoordinateReferenceSystem.saveAsUserCrs: src/core/proj/qgscoordinatereferencesystem.h#L993 +QgsCoordinateReferenceSystem.setCoordinateEpoch: src/core/proj/qgscoordinatereferencesystem.h#L808 +QgsCoordinateReferenceSystem.setNativeFormat: src/core/proj/qgscoordinatereferencesystem.h#L1004 +QgsCoordinateReferenceSystem.setValidationHint: src/core/proj/qgscoordinatereferencesystem.h#L965 +QgsCoordinateReferenceSystem.setupESRIWktFix: src/core/proj/qgscoordinatereferencesystem.h#L562 +QgsCoordinateReferenceSystem.srsid: src/core/proj/qgscoordinatereferencesystem.h#L631 +QgsCoordinateReferenceSystem.syncDatabase: src/core/proj/qgscoordinatereferencesystem.h#L978 +QgsCoordinateReferenceSystem.toGeographicCrs: src/core/proj/qgscoordinatereferencesystem.h#L1026 +QgsCoordinateReferenceSystem.toOgcUri: src/core/proj/qgscoordinatereferencesystem.h#L932 +QgsCoordinateReferenceSystem.toOgcUrn: src/core/proj/qgscoordinatereferencesystem.h#L940 +QgsCoordinateReferenceSystem.toProj4: src/core/proj/qgscoordinatereferencesystem.h#L720 +QgsCoordinateReferenceSystem.toProj: src/core/proj/qgscoordinatereferencesystem.h#L734 +QgsCoordinateReferenceSystem.toWkt: src/core/proj/qgscoordinatereferencesystem.h#L706 +QgsCoordinateReferenceSystem.type: src/core/proj/qgscoordinatereferencesystem.h#L741 +QgsCoordinateReferenceSystem.updateDefinition: src/core/proj/qgscoordinatereferencesystem.h#L960 +QgsCoordinateReferenceSystem.userFriendlyIdentifier: src/core/proj/qgscoordinatereferencesystem.h#L677 +QgsCoordinateReferenceSystem.validate: src/core/proj/qgscoordinatereferencesystem.h#L579 +QgsCoordinateReferenceSystem.validationHint: src/core/proj/qgscoordinatereferencesystem.h#L970 +QgsCoordinateReferenceSystem.verticalCrs: src/core/proj/qgscoordinatereferencesystem.h#L1052 +QgsCoordinateReferenceSystem.writeXml: src/core/proj/qgscoordinatereferencesystem.h#L610 +QgsCoordinateReferenceSystem: src/core/proj/qgscoordinatereferencesystem.h#L206 QgsCoordinateReferenceSystemRegistry.QgsCoordinateReferenceSystemRegistry: src/core/proj/qgscoordinatereferencesystemregistry.h#L72 QgsCoordinateReferenceSystemRegistry.UserCrsDetails: src/core/proj/qgscoordinatereferencesystemregistry.h#L81 QgsCoordinateReferenceSystemRegistry.addUserCrs: src/core/proj/qgscoordinatereferencesystemregistry.h#L124 -QgsCoordinateReferenceSystemRegistry.clearRecent: src/core/proj/qgscoordinatereferencesystemregistry.h#L222 -QgsCoordinateReferenceSystemRegistry.crsDefinitionsChanged: src/core/proj/qgscoordinatereferencesystemregistry.h#L262 -QgsCoordinateReferenceSystemRegistry.pushRecent: src/core/proj/qgscoordinatereferencesystemregistry.h#L204 -QgsCoordinateReferenceSystemRegistry.recentCrsCleared: src/core/proj/qgscoordinatereferencesystemregistry.h#L289 -QgsCoordinateReferenceSystemRegistry.recentCrsPushed: src/core/proj/qgscoordinatereferencesystemregistry.h#L271 -QgsCoordinateReferenceSystemRegistry.recentCrsRemoved: src/core/proj/qgscoordinatereferencesystemregistry.h#L280 -QgsCoordinateReferenceSystemRegistry.removeRecent: src/core/proj/qgscoordinatereferencesystemregistry.h#L213 +QgsCoordinateReferenceSystemRegistry.clearRecent: src/core/proj/qgscoordinatereferencesystemregistry.h#L218 +QgsCoordinateReferenceSystemRegistry.crsDefinitionsChanged: src/core/proj/qgscoordinatereferencesystemregistry.h#L258 +QgsCoordinateReferenceSystemRegistry.pushRecent: src/core/proj/qgscoordinatereferencesystemregistry.h#L200 +QgsCoordinateReferenceSystemRegistry.recentCrsCleared: src/core/proj/qgscoordinatereferencesystemregistry.h#L285 +QgsCoordinateReferenceSystemRegistry.recentCrsPushed: src/core/proj/qgscoordinatereferencesystemregistry.h#L267 +QgsCoordinateReferenceSystemRegistry.recentCrsRemoved: src/core/proj/qgscoordinatereferencesystemregistry.h#L276 +QgsCoordinateReferenceSystemRegistry.removeRecent: src/core/proj/qgscoordinatereferencesystemregistry.h#L209 QgsCoordinateReferenceSystemRegistry.removeUserCrs: src/core/proj/qgscoordinatereferencesystemregistry.h#L151 QgsCoordinateReferenceSystemRegistry.updateUserCrs: src/core/proj/qgscoordinatereferencesystemregistry.h#L142 -QgsCoordinateReferenceSystemRegistry.userCrsAdded: src/core/proj/qgscoordinatereferencesystemregistry.h#L248 -QgsCoordinateReferenceSystemRegistry.userCrsChanged: src/core/proj/qgscoordinatereferencesystemregistry.h#L238 -QgsCoordinateReferenceSystemRegistry.userCrsRemoved: src/core/proj/qgscoordinatereferencesystemregistry.h#L256 +QgsCoordinateReferenceSystemRegistry.userCrsAdded: src/core/proj/qgscoordinatereferencesystemregistry.h#L244 +QgsCoordinateReferenceSystemRegistry.userCrsChanged: src/core/proj/qgscoordinatereferencesystemregistry.h#L234 +QgsCoordinateReferenceSystemRegistry.userCrsRemoved: src/core/proj/qgscoordinatereferencesystemregistry.h#L252 QgsCoordinateReferenceSystemRegistry: src/core/proj/qgscoordinatereferencesystemregistry.h#L64 QgsCoordinateReferenceSystemUtils.axisDirectionToAbbreviatedString: src/core/proj/qgscoordinatereferencesystemutils.h#L47 QgsCoordinateReferenceSystemUtils.crsTypeToString: src/core/proj/qgscoordinatereferencesystemutils.h#L53 @@ -2713,41 +2716,41 @@ QgsCoordinateReferenceSystemUtils: src/core/proj/qgscoordinatereferencesystemuti QgsCoordinateTransform.QgsCoordinateTransform: src/core/proj/qgscoordinatetransform.h#L121 QgsCoordinateTransform.QgsCoordinateTransform: src/core/proj/qgscoordinatetransform.h#L133 QgsCoordinateTransform.QgsCoordinateTransform: src/core/proj/qgscoordinatetransform.h#L91 -QgsCoordinateTransform.__repr__: src/core/proj/qgscoordinatetransform.h#L616 -QgsCoordinateTransform.allowFallbackTransforms: src/core/proj/qgscoordinatetransform.h#L460 +QgsCoordinateTransform.__repr__: src/core/proj/qgscoordinatetransform.h#L617 +QgsCoordinateTransform.allowFallbackTransforms: src/core/proj/qgscoordinatetransform.h#L461 QgsCoordinateTransform.context: src/core/proj/qgscoordinatetransform.h#L195 -QgsCoordinateTransform.coordinateOperation: src/core/proj/qgscoordinatetransform.h#L401 +QgsCoordinateTransform.coordinateOperation: src/core/proj/qgscoordinatetransform.h#L402 QgsCoordinateTransform.destinationCrs: src/core/proj/qgscoordinatetransform.h#L211 -QgsCoordinateTransform.destinationDatumTransformId: src/core/proj/qgscoordinatetransform.h#L564 -QgsCoordinateTransform.disableFallbackOperationHandler: src/core/proj/qgscoordinatetransform.h#L509 -QgsCoordinateTransform.fallbackOperationOccurred: src/core/proj/qgscoordinatetransform.h#L519 -QgsCoordinateTransform.hasVerticalComponent: src/core/proj/qgscoordinatetransform.h#L383 -QgsCoordinateTransform.instantiatedCoordinateOperationDetails: src/core/proj/qgscoordinatetransform.h#L416 -QgsCoordinateTransform.invalidateCache: src/core/proj/qgscoordinatetransform.h#L601 -QgsCoordinateTransform.isShortCircuited: src/core/proj/qgscoordinatetransform.h#L375 +QgsCoordinateTransform.destinationDatumTransformId: src/core/proj/qgscoordinatetransform.h#L565 +QgsCoordinateTransform.disableFallbackOperationHandler: src/core/proj/qgscoordinatetransform.h#L510 +QgsCoordinateTransform.fallbackOperationOccurred: src/core/proj/qgscoordinatetransform.h#L520 +QgsCoordinateTransform.hasVerticalComponent: src/core/proj/qgscoordinatetransform.h#L384 +QgsCoordinateTransform.instantiatedCoordinateOperationDetails: src/core/proj/qgscoordinatetransform.h#L417 +QgsCoordinateTransform.invalidateCache: src/core/proj/qgscoordinatetransform.h#L602 +QgsCoordinateTransform.isShortCircuited: src/core/proj/qgscoordinatetransform.h#L376 QgsCoordinateTransform.isTransformationPossible: src/core/proj/qgscoordinatetransform.h#L158 QgsCoordinateTransform.isValid: src/core/proj/qgscoordinatetransform.h#L164 -QgsCoordinateTransform.scaleFactor: src/core/proj/qgscoordinatetransform.h#L613 -QgsCoordinateTransform.setAllowFallbackTransforms: src/core/proj/qgscoordinatetransform.h#L447 -QgsCoordinateTransform.setBallparkTransformsAreAppropriate: src/core/proj/qgscoordinatetransform.h#L493 +QgsCoordinateTransform.scaleFactor: src/core/proj/qgscoordinatetransform.h#L614 +QgsCoordinateTransform.setAllowFallbackTransforms: src/core/proj/qgscoordinatetransform.h#L448 +QgsCoordinateTransform.setBallparkTransformsAreAppropriate: src/core/proj/qgscoordinatetransform.h#L494 QgsCoordinateTransform.setContext: src/core/proj/qgscoordinatetransform.h#L187 -QgsCoordinateTransform.setCoordinateOperation: src/core/proj/qgscoordinatetransform.h#L431 +QgsCoordinateTransform.setCoordinateOperation: src/core/proj/qgscoordinatetransform.h#L432 QgsCoordinateTransform.setDestinationCrs: src/core/proj/qgscoordinatetransform.h#L180 -QgsCoordinateTransform.setDestinationDatumTransformId: src/core/proj/qgscoordinatetransform.h#L579 +QgsCoordinateTransform.setDestinationDatumTransformId: src/core/proj/qgscoordinatetransform.h#L580 QgsCoordinateTransform.setSourceCrs: src/core/proj/qgscoordinatetransform.h#L172 -QgsCoordinateTransform.setSourceDatumTransformId: src/core/proj/qgscoordinatetransform.h#L549 +QgsCoordinateTransform.setSourceDatumTransformId: src/core/proj/qgscoordinatetransform.h#L550 QgsCoordinateTransform.sourceCrs: src/core/proj/qgscoordinatetransform.h#L203 -QgsCoordinateTransform.sourceDatumTransformId: src/core/proj/qgscoordinatetransform.h#L534 +QgsCoordinateTransform.sourceDatumTransformId: src/core/proj/qgscoordinatetransform.h#L535 QgsCoordinateTransform.transform: src/core/proj/qgscoordinatetransform.h#L222 QgsCoordinateTransform.transform: src/core/proj/qgscoordinatetransform.h#L234 QgsCoordinateTransform.transform: src/core/proj/qgscoordinatetransform.h#L246 -QgsCoordinateTransform.transform: src/core/proj/qgscoordinatetransform.h#L357 -QgsCoordinateTransform.transformBoundingBox: src/core/proj/qgscoordinatetransform.h#L262 -QgsCoordinateTransform.transformCoords: src/core/proj/qgscoordinatetransform.h#L370 -QgsCoordinateTransform.transformInPlace: src/core/proj/qgscoordinatetransform.h#L276 -QgsCoordinateTransform.transformInPlace: src/core/proj/qgscoordinatetransform.h#L321 -QgsCoordinateTransform.transformInPlace: src/core/proj/qgscoordinatetransform.h#L337 -QgsCoordinateTransform.transformPolygon: src/core/proj/qgscoordinatetransform.h#L346 +QgsCoordinateTransform.transform: src/core/proj/qgscoordinatetransform.h#L358 +QgsCoordinateTransform.transformBoundingBox: src/core/proj/qgscoordinatetransform.h#L263 +QgsCoordinateTransform.transformCoords: src/core/proj/qgscoordinatetransform.h#L371 +QgsCoordinateTransform.transformInPlace: src/core/proj/qgscoordinatetransform.h#L277 +QgsCoordinateTransform.transformInPlace: src/core/proj/qgscoordinatetransform.h#L322 +QgsCoordinateTransform.transformInPlace: src/core/proj/qgscoordinatetransform.h#L338 +QgsCoordinateTransform.transformPolygon: src/core/proj/qgscoordinatetransform.h#L347 QgsCoordinateTransform: src/core/proj/qgscoordinatetransform.h#L57 QgsCoordinateTransformContext.addCoordinateOperation: src/core/proj/qgscoordinatetransformcontext.h#L159 QgsCoordinateTransformContext.addSourceDestinationDatumTransform: src/core/proj/qgscoordinatetransformcontext.h#L126 @@ -3518,6 +3521,7 @@ QgsDistanceArea.sourceCrs: src/core/qgsdistancearea.h#L80 QgsDistanceArea.splitGeometryAtAntimeridian: src/core/qgsdistancearea.h#L359 QgsDistanceArea.willUseEllipsoid: src/core/qgsdistancearea.h#L67 QgsDistanceArea: src/core/qgsdistancearea.h#L52 +QgsDoubleBoxScaleBarRenderer.applyDefaultSettings: src/core/scalebar/qgsdoubleboxscalebarrenderer.h#L45 QgsDoubleBoxScaleBarRenderer.clone: src/core/scalebar/qgsdoubleboxscalebarrenderer.h#L39 QgsDoubleBoxScaleBarRenderer.draw: src/core/scalebar/qgsdoubleboxscalebarrenderer.h#L41 QgsDoubleBoxScaleBarRenderer.flags: src/core/scalebar/qgsdoubleboxscalebarrenderer.h#L37 @@ -5816,14 +5820,14 @@ QgsHtmlAnnotation: src/core/annotations/qgshtmlannotation.h#L34 QgsHtmlUtils.buildBulletList: src/core/qgshtmlutils.h#L38 QgsHtmlUtils: src/core/qgshtmlutils.h#L30 QgsHttpHeaders.headers: src/core/network/qgshttpheaders.h#L93 -QgsHttpHeaders.insert: src/core/network/qgshttpheaders.h#L190 -QgsHttpHeaders.sanitizeKey: src/core/network/qgshttpheaders.h#L175 -QgsHttpHeaders.setFromDomElement: src/core/network/qgshttpheaders.h#L169 -QgsHttpHeaders.setFromMap: src/core/network/qgshttpheaders.h#L160 -QgsHttpHeaders.setFromSettings: src/core/network/qgshttpheaders.h#L145 -QgsHttpHeaders.setFromUrlQuery: src/core/network/qgshttpheaders.h#L151 -QgsHttpHeaders.toSpacedString: src/core/network/qgshttpheaders.h#L198 -QgsHttpHeaders.updateDomElement: src/core/network/qgshttpheaders.h#L135 +QgsHttpHeaders.insert: src/core/network/qgshttpheaders.h#L203 +QgsHttpHeaders.sanitizeKey: src/core/network/qgshttpheaders.h#L188 +QgsHttpHeaders.setFromDomElement: src/core/network/qgshttpheaders.h#L182 +QgsHttpHeaders.setFromMap: src/core/network/qgshttpheaders.h#L173 +QgsHttpHeaders.setFromSettings: src/core/network/qgshttpheaders.h#L158 +QgsHttpHeaders.setFromUrlQuery: src/core/network/qgshttpheaders.h#L164 +QgsHttpHeaders.toSpacedString: src/core/network/qgshttpheaders.h#L211 +QgsHttpHeaders.updateDomElement: src/core/network/qgshttpheaders.h#L137 QgsHttpHeaders.updateMap: src/core/network/qgshttpheaders.h#L126 QgsHttpHeaders.updateNetworkRequest: src/core/network/qgshttpheaders.h#L111 QgsHttpHeaders.updateSettings: src/core/network/qgshttpheaders.h#L105 @@ -6605,22 +6609,23 @@ QgsLayerTreeNode.willRemoveChildren: src/core/layertree/qgslayertreenode.h#L247 QgsLayerTreeNode.writeCommonXml: src/core/layertree/qgslayertreenode.h#L273 QgsLayerTreeNode.writeXml: src/core/layertree/qgslayertreenode.h#L156 QgsLayerTreeNode: src/core/layertree/qgslayertreenode.h#L76 -QgsLayerTreeRegistryBridge.QgsLayerTreeRegistryBridge: src/core/layertree/qgslayertreeregistrybridge.h#L65 -QgsLayerTreeRegistryBridge.addedLayersToLayerTree: src/core/layertree/qgslayertreeregistrybridge.h#L104 -QgsLayerTreeRegistryBridge.groupRemovedChildren: src/core/layertree/qgslayertreeregistrybridge.h#L111 -QgsLayerTreeRegistryBridge.groupWillRemoveChildren: src/core/layertree/qgslayertreeregistrybridge.h#L110 -QgsLayerTreeRegistryBridge.isEnabled: src/core/layertree/qgslayertreeregistrybridge.h#L68 -QgsLayerTreeRegistryBridge.layerInsertionMethod: src/core/layertree/qgslayertreeregistrybridge.h#L97 -QgsLayerTreeRegistryBridge.layersAdded: src/core/layertree/qgslayertreeregistrybridge.h#L107 -QgsLayerTreeRegistryBridge.layersWillBeRemoved: src/core/layertree/qgslayertreeregistrybridge.h#L108 -QgsLayerTreeRegistryBridge.newLayersVisible: src/core/layertree/qgslayertreeregistrybridge.h#L71 -QgsLayerTreeRegistryBridge.removeLayersFromRegistry: src/core/layertree/qgslayertreeregistrybridge.h#L113 -QgsLayerTreeRegistryBridge.setEnabled: src/core/layertree/qgslayertreeregistrybridge.h#L67 -QgsLayerTreeRegistryBridge.setLayerInsertionMethod: src/core/layertree/qgslayertreeregistrybridge.h#L91 -QgsLayerTreeRegistryBridge.setLayerInsertionPoint: src/core/layertree/qgslayertreeregistrybridge.h#L78 -QgsLayerTreeRegistryBridge.setLayerInsertionPoint: src/core/layertree/qgslayertreeregistrybridge.h#L85 -QgsLayerTreeRegistryBridge.setNewLayersVisible: src/core/layertree/qgslayertreeregistrybridge.h#L70 -QgsLayerTreeRegistryBridge: src/core/layertree/qgslayertreeregistrybridge.h#L44 +QgsLayerTreeRegistryBridge.QgsLayerTreeRegistryBridge: src/core/layertree/qgslayertreeregistrybridge.h#L66 +QgsLayerTreeRegistryBridge.addedLayersToLayerTree: src/core/layertree/qgslayertreeregistrybridge.h#L111 +QgsLayerTreeRegistryBridge.groupRemovedChildren: src/core/layertree/qgslayertreeregistrybridge.h#L118 +QgsLayerTreeRegistryBridge.groupWillRemoveChildren: src/core/layertree/qgslayertreeregistrybridge.h#L117 +QgsLayerTreeRegistryBridge.isEnabled: src/core/layertree/qgslayertreeregistrybridge.h#L69 +QgsLayerTreeRegistryBridge.layerInsertionMethod: src/core/layertree/qgslayertreeregistrybridge.h#L104 +QgsLayerTreeRegistryBridge.layerInsertionPoint: src/core/layertree/qgslayertreeregistrybridge.h#L92 +QgsLayerTreeRegistryBridge.layersAdded: src/core/layertree/qgslayertreeregistrybridge.h#L114 +QgsLayerTreeRegistryBridge.layersWillBeRemoved: src/core/layertree/qgslayertreeregistrybridge.h#L115 +QgsLayerTreeRegistryBridge.newLayersVisible: src/core/layertree/qgslayertreeregistrybridge.h#L72 +QgsLayerTreeRegistryBridge.removeLayersFromRegistry: src/core/layertree/qgslayertreeregistrybridge.h#L120 +QgsLayerTreeRegistryBridge.setEnabled: src/core/layertree/qgslayertreeregistrybridge.h#L68 +QgsLayerTreeRegistryBridge.setLayerInsertionMethod: src/core/layertree/qgslayertreeregistrybridge.h#L98 +QgsLayerTreeRegistryBridge.setLayerInsertionPoint: src/core/layertree/qgslayertreeregistrybridge.h#L79 +QgsLayerTreeRegistryBridge.setLayerInsertionPoint: src/core/layertree/qgslayertreeregistrybridge.h#L86 +QgsLayerTreeRegistryBridge.setNewLayersVisible: src/core/layertree/qgslayertreeregistrybridge.h#L71 +QgsLayerTreeRegistryBridge: src/core/layertree/qgslayertreeregistrybridge.h#L45 QgsLayerTreeUtils.checkStateFromXml: src/core/layertree/qgslayertreeutils.h#L53 QgsLayerTreeUtils.checkStateToXml: src/core/layertree/qgslayertreeutils.h#L51 QgsLayerTreeUtils.countMapLayerInTree: src/core/layertree/qgslayertreeutils.h#L121 @@ -6758,28 +6763,28 @@ QgsLayoutEffect.compositionMode: src/core/layout/qgslayouteffect.h#L60 QgsLayoutEffect.draw: src/core/layout/qgslayouteffect.h#L64 QgsLayoutEffect.setCompositionMode: src/core/layout/qgslayouteffect.h#L51 QgsLayoutEffect: src/core/layout/qgslayouteffect.h#L36 -QgsLayoutExporter.computeWorldFileParameters: src/core/layout/qgslayoutexporter.h#L676 -QgsLayoutExporter.computeWorldFileParameters: src/core/layout/qgslayoutexporter.h#L683 -QgsLayoutExporter.containsAdvancedEffects: src/core/layout/qgslayoutexporter.h#L702 -QgsLayoutExporter.errorFile: src/core/layout/qgslayoutexporter.h#L620 -QgsLayoutExporter.errorMessage: src/core/layout/qgslayoutexporter.h#L627 +QgsLayoutExporter.computeWorldFileParameters: src/core/layout/qgslayoutexporter.h#L678 +QgsLayoutExporter.computeWorldFileParameters: src/core/layout/qgslayoutexporter.h#L685 +QgsLayoutExporter.containsAdvancedEffects: src/core/layout/qgslayoutexporter.h#L704 +QgsLayoutExporter.errorFile: src/core/layout/qgslayoutexporter.h#L622 +QgsLayoutExporter.errorMessage: src/core/layout/qgslayoutexporter.h#L629 QgsLayoutExporter.exportToImage: src/core/layout/qgslayoutexporter.h#L258 QgsLayoutExporter.exportToImage: src/core/layout/qgslayoutexporter.h#L271 -QgsLayoutExporter.exportToPdf: src/core/layout/qgslayoutexporter.h#L418 -QgsLayoutExporter.exportToPdf: src/core/layout/qgslayoutexporter.h#L431 -QgsLayoutExporter.exportToPdfs: src/core/layout/qgslayoutexporter.h#L447 -QgsLayoutExporter.exportToSvg: src/core/layout/qgslayoutexporter.h#L599 -QgsLayoutExporter.exportToSvg: src/core/layout/qgslayoutexporter.h#L611 -QgsLayoutExporter.generateFileName: src/core/layout/qgslayoutexporter.h#L711 -QgsLayoutExporter.georeferenceOutput: src/core/layout/qgslayoutexporter.h#L667 +QgsLayoutExporter.exportToPdf: src/core/layout/qgslayoutexporter.h#L420 +QgsLayoutExporter.exportToPdf: src/core/layout/qgslayoutexporter.h#L433 +QgsLayoutExporter.exportToPdfs: src/core/layout/qgslayoutexporter.h#L449 +QgsLayoutExporter.exportToSvg: src/core/layout/qgslayoutexporter.h#L601 +QgsLayoutExporter.exportToSvg: src/core/layout/qgslayoutexporter.h#L613 +QgsLayoutExporter.generateFileName: src/core/layout/qgslayoutexporter.h#L713 +QgsLayoutExporter.georeferenceOutput: src/core/layout/qgslayoutexporter.h#L669 QgsLayoutExporter.layout: src/core/layout/qgslayoutexporter.h#L94 -QgsLayoutExporter.print: src/core/layout/qgslayoutexporter.h#L492 -QgsLayoutExporter.print: src/core/layout/qgslayoutexporter.h#L501 +QgsLayoutExporter.print: src/core/layout/qgslayoutexporter.h#L494 +QgsLayoutExporter.print: src/core/layout/qgslayoutexporter.h#L503 QgsLayoutExporter.renderPage: src/core/layout/qgslayoutexporter.h#L104 QgsLayoutExporter.renderPageToImage: src/core/layout/qgslayoutexporter.h#L124 QgsLayoutExporter.renderRegion: src/core/layout/qgslayoutexporter.h#L133 QgsLayoutExporter.renderRegionToImage: src/core/layout/qgslayoutexporter.h#L151 -QgsLayoutExporter.requiresRasterization: src/core/layout/qgslayoutexporter.h#L693 +QgsLayoutExporter.requiresRasterization: src/core/layout/qgslayoutexporter.h#L695 QgsLayoutExporter: src/core/layout/qgslayoutexporter.h#L51 QgsLayoutFrame.cleanup: src/core/layout/qgslayoutframe.h#L54 QgsLayoutFrame.create: src/core/layout/qgslayoutframe.h#L46 @@ -8743,15 +8748,15 @@ QgsLocatorProxyModel: src/core/locator/qgslocatormodel.h#L212 QgsLocatorResult.setUserData: src/core/locator/qgslocatorfilter.h#L73 QgsLocatorResult.userData: src/core/locator/qgslocatorfilter.h#L66 QgsLocatorResult: src/core/locator/qgslocatorfilter.h#L37 -QgsLogger.critical: src/core/qgslogger.h#L99 -QgsLogger.debug: src/core/qgslogger.h#L72 -QgsLogger.debug: src/core/qgslogger.h#L75 -QgsLogger.debugLevel: src/core/qgslogger.h#L113 -QgsLogger.fatal: src/core/qgslogger.h#L102 -QgsLogger.logFile: src/core/qgslogger.h#L122 -QgsLogger.logMessageToFile: src/core/qgslogger.h#L116 -QgsLogger.warning: src/core/qgslogger.h#L96 -QgsLogger: src/core/qgslogger.h#L60 +QgsLogger.critical: src/core/qgslogger.h#L103 +QgsLogger.debug: src/core/qgslogger.h#L76 +QgsLogger.debug: src/core/qgslogger.h#L79 +QgsLogger.debugLevel: src/core/qgslogger.h#L117 +QgsLogger.fatal: src/core/qgslogger.h#L106 +QgsLogger.logFile: src/core/qgslogger.h#L126 +QgsLogger.logMessageToFile: src/core/qgslogger.h#L120 +QgsLogger.warning: src/core/qgslogger.h#L100 +QgsLogger: src/core/qgslogger.h#L64 QgsManhattanLineCallout.clone: src/core/callouts/qgscallout.h#L765 QgsManhattanLineCallout.create: src/core/callouts/qgscallout.h#L762 QgsManhattanLineCallout.createCalloutLine: src/core/callouts/qgscallout.h#L768 @@ -8862,218 +8867,218 @@ QgsMapInfoSymbolConverter.convertFillSymbol: src/core/symbology/qgsmapinfosymbol QgsMapInfoSymbolConverter.convertLineSymbol: src/core/symbology/qgsmapinfosymbolconverter.h#L75 QgsMapInfoSymbolConverter.convertMarkerSymbol: src/core/symbology/qgsmapinfosymbolconverter.h#L91 QgsMapInfoSymbolConverter: src/core/symbology/qgsmapinfosymbolconverter.h#L66 -QgsMapLayer.__repr__: src/core/qgsmaplayer.h#L1893 +QgsMapLayer.__repr__: src/core/qgsmaplayer.h#L1896 QgsMapLayer.abstract: src/core/qgsmaplayer.h#L355 -QgsMapLayer.accept: src/core/qgsmaplayer.h#L1720 -QgsMapLayer.appendError: src/core/qgsmaplayer.h#L2257 +QgsMapLayer.accept: src/core/qgsmaplayer.h#L1723 +QgsMapLayer.appendError: src/core/qgsmaplayer.h#L2260 QgsMapLayer.attribution: src/core/qgsmaplayer.h#L411 QgsMapLayer.attributionUrl: src/core/qgsmaplayer.h#L425 -QgsMapLayer.autoRefreshInterval: src/core/qgsmaplayer.h#L1614 -QgsMapLayer.autoRefreshIntervalChanged: src/core/qgsmaplayer.h#L2058 -QgsMapLayer.autoRefreshMode: src/core/qgsmaplayer.h#L1606 -QgsMapLayer.beforeResolveReferences: src/core/qgsmaplayer.h#L1916 +QgsMapLayer.autoRefreshInterval: src/core/qgsmaplayer.h#L1617 +QgsMapLayer.autoRefreshIntervalChanged: src/core/qgsmaplayer.h#L2061 +QgsMapLayer.autoRefreshMode: src/core/qgsmaplayer.h#L1609 +QgsMapLayer.beforeResolveReferences: src/core/qgsmaplayer.h#L1919 QgsMapLayer.blendMode: src/core/qgsmaplayer.h#L515 -QgsMapLayer.blendModeChanged: src/core/qgsmaplayer.h#L1989 +QgsMapLayer.blendModeChanged: src/core/qgsmaplayer.h#L1992 QgsMapLayer.clone: src/core/qgsmaplayer.h#L213 -QgsMapLayer.clone: src/core/qgsmaplayer.h#L2165 -QgsMapLayer.configChanged: src/core/qgsmaplayer.h#L2040 +QgsMapLayer.clone: src/core/qgsmaplayer.h#L2168 +QgsMapLayer.configChanged: src/core/qgsmaplayer.h#L2043 QgsMapLayer.createMapRenderer: src/core/qgsmaplayer.h#L548 -QgsMapLayer.crs3D: src/core/qgsmaplayer.h#L1030 -QgsMapLayer.crs3DChanged: src/core/qgsmaplayer.h#L1955 -QgsMapLayer.crs: src/core/qgsmaplayer.h#L990 -QgsMapLayer.crsChanged: src/core/qgsmaplayer.h#L1944 -QgsMapLayer.customProperty: src/core/qgsmaplayer.h#L717 -QgsMapLayer.customPropertyChanged: src/core/qgsmaplayer.h#L2103 -QgsMapLayer.customPropertyKeys: src/core/qgsmaplayer.h#L704 -QgsMapLayer.dataChanged: src/core/qgsmaplayer.h#L1986 +QgsMapLayer.crs3D: src/core/qgsmaplayer.h#L1033 +QgsMapLayer.crs3DChanged: src/core/qgsmaplayer.h#L1958 +QgsMapLayer.crs: src/core/qgsmaplayer.h#L993 +QgsMapLayer.crsChanged: src/core/qgsmaplayer.h#L1947 +QgsMapLayer.customProperty: src/core/qgsmaplayer.h#L720 +QgsMapLayer.customPropertyChanged: src/core/qgsmaplayer.h#L2106 +QgsMapLayer.customPropertyKeys: src/core/qgsmaplayer.h#L707 +QgsMapLayer.dataChanged: src/core/qgsmaplayer.h#L1989 QgsMapLayer.dataProvider: src/core/qgsmaplayer.h#L301 -QgsMapLayer.dataSourceChanged: src/core/qgsmaplayer.h#L2082 +QgsMapLayer.dataSourceChanged: src/core/qgsmaplayer.h#L2085 QgsMapLayer.dataUrl: src/core/qgsmaplayer.h#L383 QgsMapLayer.dataUrlFormat: src/core/qgsmaplayer.h#L397 -QgsMapLayer.decodedSource: src/core/qgsmaplayer.h#L2216 -QgsMapLayer.deleteStyleFromDatabase: src/core/qgsmaplayer.h#L754 -QgsMapLayer.dependenciesChanged: src/core/qgsmaplayer.h#L2045 -QgsMapLayer.editingStarted: src/core/qgsmaplayer.h#L2109 -QgsMapLayer.editingStopped: src/core/qgsmaplayer.h#L2115 -QgsMapLayer.elevationProperties: src/core/qgsmaplayer.h#L1741 -QgsMapLayer.emitStyleChanged: src/core/qgsmaplayer.h#L1860 -QgsMapLayer.encodedSource: src/core/qgsmaplayer.h#L2202 -QgsMapLayer.error: src/core/qgsmaplayer.h#L977 -QgsMapLayer.exportNamedMetadata: src/core/qgsmaplayer.h#L1092 -QgsMapLayer.exportNamedStyle: src/core/qgsmaplayer.h#L1240 -QgsMapLayer.exportSldStyle: src/core/qgsmaplayer.h#L1251 -QgsMapLayer.exportSldStyleV2: src/core/qgsmaplayer.h#L1261 +QgsMapLayer.decodedSource: src/core/qgsmaplayer.h#L2219 +QgsMapLayer.deleteStyleFromDatabase: src/core/qgsmaplayer.h#L757 +QgsMapLayer.dependenciesChanged: src/core/qgsmaplayer.h#L2048 +QgsMapLayer.editingStarted: src/core/qgsmaplayer.h#L2112 +QgsMapLayer.editingStopped: src/core/qgsmaplayer.h#L2118 +QgsMapLayer.elevationProperties: src/core/qgsmaplayer.h#L1744 +QgsMapLayer.emitStyleChanged: src/core/qgsmaplayer.h#L1863 +QgsMapLayer.encodedSource: src/core/qgsmaplayer.h#L2205 +QgsMapLayer.error: src/core/qgsmaplayer.h#L980 +QgsMapLayer.exportNamedMetadata: src/core/qgsmaplayer.h#L1095 +QgsMapLayer.exportNamedStyle: src/core/qgsmaplayer.h#L1243 +QgsMapLayer.exportSldStyle: src/core/qgsmaplayer.h#L1254 +QgsMapLayer.exportSldStyleV2: src/core/qgsmaplayer.h#L1264 QgsMapLayer.extensionPropertyType: src/core/qgsmaplayer.h#L259 QgsMapLayer.extent3D: src/core/qgsmaplayer.h#L557 QgsMapLayer.extent: src/core/qgsmaplayer.h#L551 QgsMapLayer.flags: src/core/qgsmaplayer.h#L230 -QgsMapLayer.flagsChanged: src/core/qgsmaplayer.h#L2073 -QgsMapLayer.formatLayerName: src/core/qgsmaplayer.h#L1077 -QgsMapLayer.generateId: src/core/qgsmaplayer.h#L1709 -QgsMapLayer.getStyleFromDatabase: src/core/qgsmaplayer.h#L746 -QgsMapLayer.hasAutoRefreshEnabled: src/core/qgsmaplayer.h#L1598 -QgsMapLayer.hasDependencyCycle: src/core/qgsmaplayer.h#L2293 -QgsMapLayer.hasMapTips: src/core/qgsmaplayer.h#L1763 -QgsMapLayer.hasScaleBasedVisibility: src/core/qgsmaplayer.h#L1590 -QgsMapLayer.htmlMetadata: src/core/qgsmaplayer.h#L1661 +QgsMapLayer.flagsChanged: src/core/qgsmaplayer.h#L2076 +QgsMapLayer.formatLayerName: src/core/qgsmaplayer.h#L1080 +QgsMapLayer.generateId: src/core/qgsmaplayer.h#L1712 +QgsMapLayer.getStyleFromDatabase: src/core/qgsmaplayer.h#L749 +QgsMapLayer.hasAutoRefreshEnabled: src/core/qgsmaplayer.h#L1601 +QgsMapLayer.hasDependencyCycle: src/core/qgsmaplayer.h#L2296 +QgsMapLayer.hasMapTips: src/core/qgsmaplayer.h#L1766 +QgsMapLayer.hasScaleBasedVisibility: src/core/qgsmaplayer.h#L1593 +QgsMapLayer.htmlMetadata: src/core/qgsmaplayer.h#L1664 QgsMapLayer.id: src/core/qgsmaplayer.h#L267 -QgsMapLayer.idChanged: src/core/qgsmaplayer.h#L1929 -QgsMapLayer.importNamedMetadata: src/core/qgsmaplayer.h#L1165 -QgsMapLayer.importNamedStyle: src/core/qgsmaplayer.h#L1229 -QgsMapLayer.invalidateWgs84Extent: src/core/qgsmaplayer.h#L2267 -QgsMapLayer.isEditable: src/core/qgsmaplayer.h#L620 -QgsMapLayer.isInScaleRange: src/core/qgsmaplayer.h#L1556 -QgsMapLayer.isModified: src/core/qgsmaplayer.h#L627 -QgsMapLayer.isRefreshOnNotifyEnabled: src/core/qgsmaplayer.h#L1684 -QgsMapLayer.isSpatial: src/core/qgsmaplayer.h#L632 -QgsMapLayer.isTemporary: src/core/qgsmaplayer.h#L643 +QgsMapLayer.idChanged: src/core/qgsmaplayer.h#L1932 +QgsMapLayer.importNamedMetadata: src/core/qgsmaplayer.h#L1168 +QgsMapLayer.importNamedStyle: src/core/qgsmaplayer.h#L1232 +QgsMapLayer.invalidateWgs84Extent: src/core/qgsmaplayer.h#L2270 +QgsMapLayer.isEditable: src/core/qgsmaplayer.h#L623 +QgsMapLayer.isInScaleRange: src/core/qgsmaplayer.h#L1559 +QgsMapLayer.isModified: src/core/qgsmaplayer.h#L630 +QgsMapLayer.isRefreshOnNotifyEnabled: src/core/qgsmaplayer.h#L1687 +QgsMapLayer.isSpatial: src/core/qgsmaplayer.h#L635 +QgsMapLayer.isTemporary: src/core/qgsmaplayer.h#L646 QgsMapLayer.isValid: src/core/qgsmaplayer.h#L574 -QgsMapLayer.isValidChanged: src/core/qgsmaplayer.h#L2096 +QgsMapLayer.isValidChanged: src/core/qgsmaplayer.h#L2099 QgsMapLayer.keywordList: src/core/qgsmaplayer.h#L369 -QgsMapLayer.layerModified: src/core/qgsmaplayer.h#L2121 -QgsMapLayer.legend: src/core/qgsmaplayer.h#L1531 -QgsMapLayer.legendChanged: src/core/qgsmaplayer.h#L2022 -QgsMapLayer.legendPlaceholderImage: src/core/qgsmaplayer.h#L1748 -QgsMapLayer.legendUrl: src/core/qgsmaplayer.h#L1510 -QgsMapLayer.legendUrlFormat: src/core/qgsmaplayer.h#L1520 -QgsMapLayer.listStylesInDatabase: src/core/qgsmaplayer.h#L740 -QgsMapLayer.loadDefaultMetadata: src/core/qgsmaplayer.h#L1148 -QgsMapLayer.loadDefaultStyle: src/core/qgsmaplayer.h#L1189 -QgsMapLayer.loadNamedMetadata: src/core/qgsmaplayer.h#L1135 -QgsMapLayer.loadNamedMetadataFromDatabase: src/core/qgsmaplayer.h#L1157 -QgsMapLayer.loadNamedStyle: src/core/qgsmaplayer.h#L1210 -QgsMapLayer.loadNamedStyle: src/core/qgsmaplayer.h#L791 -QgsMapLayer.loadNamedStyleFromDatabase: src/core/qgsmaplayer.h#L1219 -QgsMapLayer.loadSldStyle: src/core/qgsmaplayer.h#L1337 -QgsMapLayer.mapTipTemplate: src/core/qgsmaplayer.h#L1772 -QgsMapLayer.mapTipTemplateChanged: src/core/qgsmaplayer.h#L2128 -QgsMapLayer.mapTipsEnabled: src/core/qgsmaplayer.h#L1795 -QgsMapLayer.mapTipsEnabledChanged: src/core/qgsmaplayer.h#L2136 -QgsMapLayer.maximumScale: src/core/qgsmaplayer.h#L1580 -QgsMapLayer.metadataChanged: src/core/qgsmaplayer.h#L2065 -QgsMapLayer.metadataUri: src/core/qgsmaplayer.h#L1085 +QgsMapLayer.layerModified: src/core/qgsmaplayer.h#L2124 +QgsMapLayer.legend: src/core/qgsmaplayer.h#L1534 +QgsMapLayer.legendChanged: src/core/qgsmaplayer.h#L2025 +QgsMapLayer.legendPlaceholderImage: src/core/qgsmaplayer.h#L1751 +QgsMapLayer.legendUrl: src/core/qgsmaplayer.h#L1513 +QgsMapLayer.legendUrlFormat: src/core/qgsmaplayer.h#L1523 +QgsMapLayer.listStylesInDatabase: src/core/qgsmaplayer.h#L743 +QgsMapLayer.loadDefaultMetadata: src/core/qgsmaplayer.h#L1151 +QgsMapLayer.loadDefaultStyle: src/core/qgsmaplayer.h#L1192 +QgsMapLayer.loadNamedMetadata: src/core/qgsmaplayer.h#L1138 +QgsMapLayer.loadNamedMetadataFromDatabase: src/core/qgsmaplayer.h#L1160 +QgsMapLayer.loadNamedStyle: src/core/qgsmaplayer.h#L1213 +QgsMapLayer.loadNamedStyle: src/core/qgsmaplayer.h#L794 +QgsMapLayer.loadNamedStyleFromDatabase: src/core/qgsmaplayer.h#L1222 +QgsMapLayer.loadSldStyle: src/core/qgsmaplayer.h#L1340 +QgsMapLayer.mapTipTemplate: src/core/qgsmaplayer.h#L1775 +QgsMapLayer.mapTipTemplateChanged: src/core/qgsmaplayer.h#L2131 +QgsMapLayer.mapTipsEnabled: src/core/qgsmaplayer.h#L1798 +QgsMapLayer.mapTipsEnabledChanged: src/core/qgsmaplayer.h#L2139 +QgsMapLayer.maximumScale: src/core/qgsmaplayer.h#L1583 +QgsMapLayer.metadataChanged: src/core/qgsmaplayer.h#L2068 +QgsMapLayer.metadataUri: src/core/qgsmaplayer.h#L1088 QgsMapLayer.metadataUrl: src/core/qgsmaplayer.h#L460 QgsMapLayer.metadataUrlFormat: src/core/qgsmaplayer.h#L502 QgsMapLayer.metadataUrlType: src/core/qgsmaplayer.h#L481 -QgsMapLayer.minimumScale: src/core/qgsmaplayer.h#L1568 +QgsMapLayer.minimumScale: src/core/qgsmaplayer.h#L1571 QgsMapLayer.name: src/core/qgsmaplayer.h#L296 -QgsMapLayer.nameChanged: src/core/qgsmaplayer.h#L1934 +QgsMapLayer.nameChanged: src/core/qgsmaplayer.h#L1937 QgsMapLayer.opacity: src/core/qgsmaplayer.h#L535 -QgsMapLayer.opacityChanged: src/core/qgsmaplayer.h#L1999 -QgsMapLayer.originalXmlProperties: src/core/qgsmaplayer.h#L1694 -QgsMapLayer.project: src/core/qgsmaplayer.h#L1906 +QgsMapLayer.opacityChanged: src/core/qgsmaplayer.h#L2002 +QgsMapLayer.originalXmlProperties: src/core/qgsmaplayer.h#L1697 +QgsMapLayer.project: src/core/qgsmaplayer.h#L1909 QgsMapLayer.properties: src/core/qgsmaplayer.h#L253 QgsMapLayer.providerMetadata: src/core/qgsmaplayer.h#L313 -QgsMapLayer.providerReadFlags: src/core/qgsmaplayer.h#L1804 -QgsMapLayer.providerType: src/core/qgsmaplayer.h#L1492 -QgsMapLayer.publicSource: src/core/qgsmaplayer.h#L583 -QgsMapLayer.readCommonStyle: src/core/qgsmaplayer.h#L2243 -QgsMapLayer.readCustomProperties: src/core/qgsmaplayer.h#L2223 -QgsMapLayer.readLayerXml: src/core/qgsmaplayer.h#L675 +QgsMapLayer.providerReadFlags: src/core/qgsmaplayer.h#L1807 +QgsMapLayer.providerType: src/core/qgsmaplayer.h#L1495 +QgsMapLayer.publicSource: src/core/qgsmaplayer.h#L586 +QgsMapLayer.readCommonStyle: src/core/qgsmaplayer.h#L2246 +QgsMapLayer.readCustomProperties: src/core/qgsmaplayer.h#L2226 +QgsMapLayer.readLayerXml: src/core/qgsmaplayer.h#L678 QgsMapLayer.readOnly: src/core/qgsmaplayer.h#L538 -QgsMapLayer.readSld: src/core/qgsmaplayer.h#L1340 -QgsMapLayer.readStyle: src/core/qgsmaplayer.h#L1364 -QgsMapLayer.readStyleManager: src/core/qgsmaplayer.h#L2229 -QgsMapLayer.readSymbology: src/core/qgsmaplayer.h#L1352 -QgsMapLayer.readXml: src/core/qgsmaplayer.h#L2183 -QgsMapLayer.recalculateExtents: src/core/qgsmaplayer.h#L1983 -QgsMapLayer.refreshOnNotifyMessage: src/core/qgsmaplayer.h#L1678 +QgsMapLayer.readSld: src/core/qgsmaplayer.h#L1343 +QgsMapLayer.readStyle: src/core/qgsmaplayer.h#L1367 +QgsMapLayer.readStyleManager: src/core/qgsmaplayer.h#L2232 +QgsMapLayer.readSymbology: src/core/qgsmaplayer.h#L1355 +QgsMapLayer.readXml: src/core/qgsmaplayer.h#L2186 +QgsMapLayer.recalculateExtents: src/core/qgsmaplayer.h#L1986 +QgsMapLayer.refreshOnNotifyMessage: src/core/qgsmaplayer.h#L1681 QgsMapLayer.reload: src/core/qgsmaplayer.h#L543 -QgsMapLayer.removeCustomProperty: src/core/qgsmaplayer.h#L970 -QgsMapLayer.renderer3D: src/core/qgsmaplayer.h#L1546 -QgsMapLayer.renderer3DChanged: src/core/qgsmaplayer.h#L2027 -QgsMapLayer.rendererChanged: src/core/qgsmaplayer.h#L2005 -QgsMapLayer.repaintRequested: src/core/qgsmaplayer.h#L1980 -QgsMapLayer.request3DUpdate: src/core/qgsmaplayer.h#L2034 -QgsMapLayer.resolveReferences: src/core/qgsmaplayer.h#L698 -QgsMapLayer.saveDefaultMetadata: src/core/qgsmaplayer.h#L1102 -QgsMapLayer.saveDefaultStyle: src/core/qgsmaplayer.h#L1274 -QgsMapLayer.saveDefaultStyle: src/core/qgsmaplayer.h#L1287 -QgsMapLayer.saveNamedMetadata: src/core/qgsmaplayer.h#L1117 -QgsMapLayer.saveNamedStyle: src/core/qgsmaplayer.h#L1304 -QgsMapLayer.saveSldStyle: src/core/qgsmaplayer.h#L1315 -QgsMapLayer.saveSldStyleV2: src/core/qgsmaplayer.h#L1327 -QgsMapLayer.saveStyleToDatabase: src/core/qgsmaplayer.h#L772 -QgsMapLayer.selectionProperties: src/core/qgsmaplayer.h#L1727 +QgsMapLayer.removeCustomProperty: src/core/qgsmaplayer.h#L973 +QgsMapLayer.renderer3D: src/core/qgsmaplayer.h#L1549 +QgsMapLayer.renderer3DChanged: src/core/qgsmaplayer.h#L2030 +QgsMapLayer.rendererChanged: src/core/qgsmaplayer.h#L2008 +QgsMapLayer.repaintRequested: src/core/qgsmaplayer.h#L1983 +QgsMapLayer.request3DUpdate: src/core/qgsmaplayer.h#L2037 +QgsMapLayer.resolveReferences: src/core/qgsmaplayer.h#L701 +QgsMapLayer.saveDefaultMetadata: src/core/qgsmaplayer.h#L1105 +QgsMapLayer.saveDefaultStyle: src/core/qgsmaplayer.h#L1277 +QgsMapLayer.saveDefaultStyle: src/core/qgsmaplayer.h#L1290 +QgsMapLayer.saveNamedMetadata: src/core/qgsmaplayer.h#L1120 +QgsMapLayer.saveNamedStyle: src/core/qgsmaplayer.h#L1307 +QgsMapLayer.saveSldStyle: src/core/qgsmaplayer.h#L1318 +QgsMapLayer.saveSldStyleV2: src/core/qgsmaplayer.h#L1330 +QgsMapLayer.saveStyleToDatabase: src/core/qgsmaplayer.h#L775 +QgsMapLayer.selectionProperties: src/core/qgsmaplayer.h#L1730 QgsMapLayer.serverProperties: src/core/qgsmaplayer.h#L434 QgsMapLayer.setAbstract: src/core/qgsmaplayer.h#L348 QgsMapLayer.setAttribution: src/core/qgsmaplayer.h#L404 QgsMapLayer.setAttributionUrl: src/core/qgsmaplayer.h#L418 -QgsMapLayer.setAutoRefreshEnabled: src/core/qgsmaplayer.h#L1634 -QgsMapLayer.setAutoRefreshInterval: src/core/qgsmaplayer.h#L1626 -QgsMapLayer.setAutoRefreshMode: src/core/qgsmaplayer.h#L1642 +QgsMapLayer.setAutoRefreshEnabled: src/core/qgsmaplayer.h#L1637 +QgsMapLayer.setAutoRefreshInterval: src/core/qgsmaplayer.h#L1629 +QgsMapLayer.setAutoRefreshMode: src/core/qgsmaplayer.h#L1645 QgsMapLayer.setBlendMode: src/core/qgsmaplayer.h#L509 -QgsMapLayer.setCrs: src/core/qgsmaplayer.h#L1042 -QgsMapLayer.setCustomProperties: src/core/qgsmaplayer.h#L722 -QgsMapLayer.setCustomProperty: src/core/qgsmaplayer.h#L711 -QgsMapLayer.setDataSource: src/core/qgsmaplayer.h#L1425 -QgsMapLayer.setDataSource: src/core/qgsmaplayer.h#L1456 -QgsMapLayer.setDataSource: src/core/qgsmaplayer.h#L1487 +QgsMapLayer.setCrs: src/core/qgsmaplayer.h#L1045 +QgsMapLayer.setCustomProperties: src/core/qgsmaplayer.h#L725 +QgsMapLayer.setCustomProperty: src/core/qgsmaplayer.h#L714 +QgsMapLayer.setDataSource: src/core/qgsmaplayer.h#L1428 +QgsMapLayer.setDataSource: src/core/qgsmaplayer.h#L1459 +QgsMapLayer.setDataSource: src/core/qgsmaplayer.h#L1490 QgsMapLayer.setDataUrl: src/core/qgsmaplayer.h#L376 QgsMapLayer.setDataUrlFormat: src/core/qgsmaplayer.h#L390 -QgsMapLayer.setDependencies: src/core/qgsmaplayer.h#L1869 -QgsMapLayer.setError: src/core/qgsmaplayer.h#L2259 -QgsMapLayer.setExtent3D: src/core/qgsmaplayer.h#L2174 -QgsMapLayer.setExtent: src/core/qgsmaplayer.h#L2168 +QgsMapLayer.setDependencies: src/core/qgsmaplayer.h#L1872 +QgsMapLayer.setError: src/core/qgsmaplayer.h#L2262 +QgsMapLayer.setExtent3D: src/core/qgsmaplayer.h#L2177 +QgsMapLayer.setExtent: src/core/qgsmaplayer.h#L2171 QgsMapLayer.setFlags: src/core/qgsmaplayer.h#L242 QgsMapLayer.setId: src/core/qgsmaplayer.h#L284 QgsMapLayer.setKeywordList: src/core/qgsmaplayer.h#L362 -QgsMapLayer.setLayerOrder: src/core/qgsmaplayer.h#L602 -QgsMapLayer.setLegend: src/core/qgsmaplayer.h#L1526 -QgsMapLayer.setLegendPlaceholderImage: src/core/qgsmaplayer.h#L1755 -QgsMapLayer.setLegendUrl: src/core/qgsmaplayer.h#L1505 -QgsMapLayer.setLegendUrlFormat: src/core/qgsmaplayer.h#L1515 -QgsMapLayer.setMapTipTemplate: src/core/qgsmaplayer.h#L1781 -QgsMapLayer.setMapTipsEnabled: src/core/qgsmaplayer.h#L1789 -QgsMapLayer.setMaximumScale: src/core/qgsmaplayer.h#L1828 -QgsMapLayer.setMetadata: src/core/qgsmaplayer.h#L1656 +QgsMapLayer.setLayerOrder: src/core/qgsmaplayer.h#L605 +QgsMapLayer.setLegend: src/core/qgsmaplayer.h#L1529 +QgsMapLayer.setLegendPlaceholderImage: src/core/qgsmaplayer.h#L1758 +QgsMapLayer.setLegendUrl: src/core/qgsmaplayer.h#L1508 +QgsMapLayer.setLegendUrlFormat: src/core/qgsmaplayer.h#L1518 +QgsMapLayer.setMapTipTemplate: src/core/qgsmaplayer.h#L1784 +QgsMapLayer.setMapTipsEnabled: src/core/qgsmaplayer.h#L1792 +QgsMapLayer.setMaximumScale: src/core/qgsmaplayer.h#L1831 +QgsMapLayer.setMetadata: src/core/qgsmaplayer.h#L1659 QgsMapLayer.setMetadataUrl: src/core/qgsmaplayer.h#L449 QgsMapLayer.setMetadataUrlFormat: src/core/qgsmaplayer.h#L491 QgsMapLayer.setMetadataUrlType: src/core/qgsmaplayer.h#L470 -QgsMapLayer.setMinimumScale: src/core/qgsmaplayer.h#L1817 +QgsMapLayer.setMinimumScale: src/core/qgsmaplayer.h#L1820 QgsMapLayer.setName: src/core/qgsmaplayer.h#L290 QgsMapLayer.setOpacity: src/core/qgsmaplayer.h#L525 -QgsMapLayer.setOriginalXmlProperties: src/core/qgsmaplayer.h#L1703 -QgsMapLayer.setProviderType: src/core/qgsmaplayer.h#L2247 -QgsMapLayer.setRefreshOnNofifyMessage: src/core/qgsmaplayer.h#L1883 -QgsMapLayer.setRefreshOnNotifyEnabled: src/core/qgsmaplayer.h#L1875 -QgsMapLayer.setRenderer3D: src/core/qgsmaplayer.h#L1541 -QgsMapLayer.setScaleBasedVisibility: src/core/qgsmaplayer.h#L1837 +QgsMapLayer.setOriginalXmlProperties: src/core/qgsmaplayer.h#L1706 +QgsMapLayer.setProviderType: src/core/qgsmaplayer.h#L2250 +QgsMapLayer.setRefreshOnNofifyMessage: src/core/qgsmaplayer.h#L1886 +QgsMapLayer.setRefreshOnNotifyEnabled: src/core/qgsmaplayer.h#L1878 +QgsMapLayer.setRenderer3D: src/core/qgsmaplayer.h#L1544 +QgsMapLayer.setScaleBasedVisibility: src/core/qgsmaplayer.h#L1840 QgsMapLayer.setShortName: src/core/qgsmaplayer.h#L320 -QgsMapLayer.setSubLayerVisibility: src/core/qgsmaplayer.h#L609 +QgsMapLayer.setSubLayerVisibility: src/core/qgsmaplayer.h#L612 QgsMapLayer.setTitle: src/core/qgsmaplayer.h#L334 -QgsMapLayer.setTransformContext: src/core/qgsmaplayer.h#L1890 -QgsMapLayer.setValid: src/core/qgsmaplayer.h#L2177 -QgsMapLayer.setVerticalCrs: src/core/qgsmaplayer.h#L1063 +QgsMapLayer.setTransformContext: src/core/qgsmaplayer.h#L1893 +QgsMapLayer.setValid: src/core/qgsmaplayer.h#L2180 +QgsMapLayer.setVerticalCrs: src/core/qgsmaplayer.h#L1066 QgsMapLayer.shortName: src/core/qgsmaplayer.h#L327 -QgsMapLayer.source: src/core/qgsmaplayer.h#L590 -QgsMapLayer.statusChanged: src/core/qgsmaplayer.h#L1919 -QgsMapLayer.styleChanged: src/core/qgsmaplayer.h#L2017 -QgsMapLayer.styleLoaded: src/core/qgsmaplayer.h#L2089 -QgsMapLayer.styleManager: src/core/qgsmaplayer.h#L1536 -QgsMapLayer.styleURI: src/core/qgsmaplayer.h#L1175 -QgsMapLayer.subLayers: src/core/qgsmaplayer.h#L596 -QgsMapLayer.supportsEditing: src/core/qgsmaplayer.h#L617 -QgsMapLayer.temporalProperties: src/core/qgsmaplayer.h#L1734 -QgsMapLayer.timestamp: src/core/qgsmaplayer.h#L1664 +QgsMapLayer.source: src/core/qgsmaplayer.h#L593 +QgsMapLayer.statusChanged: src/core/qgsmaplayer.h#L1922 +QgsMapLayer.styleChanged: src/core/qgsmaplayer.h#L2020 +QgsMapLayer.styleLoaded: src/core/qgsmaplayer.h#L2092 +QgsMapLayer.styleManager: src/core/qgsmaplayer.h#L1539 +QgsMapLayer.styleURI: src/core/qgsmaplayer.h#L1178 +QgsMapLayer.subLayers: src/core/qgsmaplayer.h#L599 +QgsMapLayer.supportsEditing: src/core/qgsmaplayer.h#L620 +QgsMapLayer.temporalProperties: src/core/qgsmaplayer.h#L1737 +QgsMapLayer.timestamp: src/core/qgsmaplayer.h#L1667 QgsMapLayer.title: src/core/qgsmaplayer.h#L341 -QgsMapLayer.transformContext: src/core/qgsmaplayer.h#L1070 -QgsMapLayer.trigger3DUpdate: src/core/qgsmaplayer.h#L1855 -QgsMapLayer.triggerRepaint: src/core/qgsmaplayer.h#L1847 +QgsMapLayer.transformContext: src/core/qgsmaplayer.h#L1073 +QgsMapLayer.trigger3DUpdate: src/core/qgsmaplayer.h#L1858 +QgsMapLayer.triggerRepaint: src/core/qgsmaplayer.h#L1850 QgsMapLayer.type: src/core/qgsmaplayer.h#L218 -QgsMapLayer.undoStack: src/core/qgsmaplayer.h#L1495 -QgsMapLayer.undoStackStyles: src/core/qgsmaplayer.h#L1500 -QgsMapLayer.verticalCrs: src/core/qgsmaplayer.h#L1010 -QgsMapLayer.verticalCrsChanged: src/core/qgsmaplayer.h#L1972 +QgsMapLayer.undoStack: src/core/qgsmaplayer.h#L1498 +QgsMapLayer.undoStackStyles: src/core/qgsmaplayer.h#L1503 +QgsMapLayer.verticalCrs: src/core/qgsmaplayer.h#L1013 +QgsMapLayer.verticalCrsChanged: src/core/qgsmaplayer.h#L1975 QgsMapLayer.wgs84Extent: src/core/qgsmaplayer.h#L567 -QgsMapLayer.willBeDeleted: src/core/qgsmaplayer.h#L2052 -QgsMapLayer.writeCommonStyle: src/core/qgsmaplayer.h#L2236 -QgsMapLayer.writeCustomProperties: src/core/qgsmaplayer.h#L2226 -QgsMapLayer.writeLayerXml: src/core/qgsmaplayer.h#L693 -QgsMapLayer.writeStyle: src/core/qgsmaplayer.h#L1391 -QgsMapLayer.writeStyleManager: src/core/qgsmaplayer.h#L2231 -QgsMapLayer.writeSymbology: src/core/qgsmaplayer.h#L1377 -QgsMapLayer.writeXml: src/core/qgsmaplayer.h#L2189 +QgsMapLayer.willBeDeleted: src/core/qgsmaplayer.h#L2055 +QgsMapLayer.writeCommonStyle: src/core/qgsmaplayer.h#L2239 +QgsMapLayer.writeCustomProperties: src/core/qgsmaplayer.h#L2229 +QgsMapLayer.writeLayerXml: src/core/qgsmaplayer.h#L696 +QgsMapLayer.writeStyle: src/core/qgsmaplayer.h#L1394 +QgsMapLayer.writeStyleManager: src/core/qgsmaplayer.h#L2234 +QgsMapLayer.writeSymbology: src/core/qgsmaplayer.h#L1380 +QgsMapLayer.writeXml: src/core/qgsmaplayer.h#L2192 QgsMapLayer: src/core/qgsmaplayer.h#L75 QgsMapLayerDependency.__hash__: src/core/qgsmaplayerdependency.h#L78 QgsMapLayerDependency.layerId: src/core/qgsmaplayerdependency.h#L67 @@ -9650,6 +9655,7 @@ QgsMaskIdProvider.maskId: src/core/qgsmaskidprovider.h#L56 QgsMaskIdProvider.size: src/core/qgsmaskidprovider.h#L61 QgsMaskIdProvider: src/core/qgsmaskidprovider.h#L39 QgsMaskMarkerSymbolLayer.bounds: src/core/symbology/qgsmasksymbollayer.h#L63 +QgsMaskMarkerSymbolLayer.clearMasks: src/core/symbology/qgsmasksymbollayer.h#L87 QgsMaskMarkerSymbolLayer.clone: src/core/symbology/qgsmasksymbollayer.h#L51 QgsMaskMarkerSymbolLayer.color: src/core/symbology/qgsmasksymbollayer.h#L66 QgsMaskMarkerSymbolLayer.create: src/core/symbology/qgsmasksymbollayer.h#L49 @@ -9659,7 +9665,7 @@ QgsMaskMarkerSymbolLayer.hasDataDefinedProperties: src/core/symbology/qgsmasksym QgsMaskMarkerSymbolLayer.layerType: src/core/symbology/qgsmasksymbollayer.h#L59 QgsMaskMarkerSymbolLayer.properties: src/core/symbology/qgsmasksymbollayer.h#L57 QgsMaskMarkerSymbolLayer.renderPoint: src/core/symbology/qgsmasksymbollayer.h#L62 -QgsMaskMarkerSymbolLayer.setMasks: src/core/symbology/qgsmasksymbollayer.h#L87 +QgsMaskMarkerSymbolLayer.setMasks: src/core/symbology/qgsmasksymbollayer.h#L94 QgsMaskMarkerSymbolLayer.setOutputUnit: src/core/symbology/qgsmasksymbollayer.h#L65 QgsMaskMarkerSymbolLayer.setSubSymbol: src/core/symbology/qgsmasksymbollayer.h#L53 QgsMaskMarkerSymbolLayer.startRender: src/core/symbology/qgsmasksymbollayer.h#L60 @@ -9964,86 +9970,86 @@ QgsMeshElevationAveragingMethod: src/core/mesh/qgsmesh3daveraging.h#L368 QgsMeshLayer.QgsMeshLayer.LayerOptions: src/core/mesh/qgsmeshlayer.h#L117 QgsMeshLayer.QgsMeshLayer: src/core/mesh/qgsmeshlayer.h#L159 QgsMeshLayer.__repr__: src/core/mesh/qgsmeshlayer.h#L168 -QgsMeshLayer.activeScalarDatasetAtTime: src/core/mesh/qgsmeshlayer.h#L626 -QgsMeshLayer.activeScalarDatasetGroupChanged: src/core/mesh/qgsmeshlayer.h#L990 -QgsMeshLayer.activeScalarDatasetIndex: src/core/mesh/qgsmeshlayer.h#L961 -QgsMeshLayer.activeVectorDatasetAtTime: src/core/mesh/qgsmeshlayer.h#L639 -QgsMeshLayer.activeVectorDatasetGroupChanged: src/core/mesh/qgsmeshlayer.h#L997 +QgsMeshLayer.activeScalarDatasetAtTime: src/core/mesh/qgsmeshlayer.h#L632 +QgsMeshLayer.activeScalarDatasetGroupChanged: src/core/mesh/qgsmeshlayer.h#L996 +QgsMeshLayer.activeScalarDatasetIndex: src/core/mesh/qgsmeshlayer.h#L967 +QgsMeshLayer.activeVectorDatasetAtTime: src/core/mesh/qgsmeshlayer.h#L645 +QgsMeshLayer.activeVectorDatasetGroupChanged: src/core/mesh/qgsmeshlayer.h#L1003 QgsMeshLayer.addDatasets: src/core/mesh/qgsmeshlayer.h#L212 QgsMeshLayer.addDatasets: src/core/mesh/qgsmeshlayer.h#L232 -QgsMeshLayer.areFacesActive: src/core/mesh/qgsmeshlayer.h#L497 +QgsMeshLayer.areFacesActive: src/core/mesh/qgsmeshlayer.h#L503 QgsMeshLayer.clone: src/core/mesh/qgsmeshlayer.h#L177 -QgsMeshLayer.commitFrameEditing: src/core/mesh/qgsmeshlayer.h#L822 -QgsMeshLayer.contains: src/core/mesh/qgsmeshlayer.h#L872 +QgsMeshLayer.commitFrameEditing: src/core/mesh/qgsmeshlayer.h#L828 +QgsMeshLayer.contains: src/core/mesh/qgsmeshlayer.h#L878 QgsMeshLayer.createMapRenderer: src/core/mesh/qgsmeshlayer.h#L179 QgsMeshLayer.createProfileGenerator: src/core/mesh/qgsmeshlayer.h#L180 QgsMeshLayer.dataProvider: src/core/mesh/qgsmeshlayer.h#L175 -QgsMeshLayer.dataset1dValue: src/core/mesh/qgsmeshlayer.h#L563 -QgsMeshLayer.dataset3dValue: src/core/mesh/qgsmeshlayer.h#L542 -QgsMeshLayer.dataset3dValues: src/core/mesh/qgsmeshlayer.h#L474 -QgsMeshLayer.datasetCount: src/core/mesh/qgsmeshlayer.h#L405 -QgsMeshLayer.datasetGroupCount: src/core/mesh/qgsmeshlayer.h#L356 -QgsMeshLayer.datasetGroupMetadata: src/core/mesh/qgsmeshlayer.h#L393 -QgsMeshLayer.datasetGroupTreeRootItem: src/core/mesh/qgsmeshlayer.h#L747 -QgsMeshLayer.datasetIndexAtRelativeTime: src/core/mesh/qgsmeshlayer.h#L597 -QgsMeshLayer.datasetIndexAtTime: src/core/mesh/qgsmeshlayer.h#L580 -QgsMeshLayer.datasetMetadata: src/core/mesh/qgsmeshlayer.h#L417 -QgsMeshLayer.datasetRelativeTime: src/core/mesh/qgsmeshlayer.h#L783 -QgsMeshLayer.datasetRelativeTimeInMilliseconds: src/core/mesh/qgsmeshlayer.h#L790 -QgsMeshLayer.datasetValue: src/core/mesh/qgsmeshlayer.h#L436 -QgsMeshLayer.datasetValue: src/core/mesh/qgsmeshlayer.h#L521 -QgsMeshLayer.datasetValues: src/core/mesh/qgsmeshlayer.h#L456 -QgsMeshLayer.datasetsPathUnique: src/core/mesh/qgsmeshlayer.h#L972 +QgsMeshLayer.dataset1dValue: src/core/mesh/qgsmeshlayer.h#L569 +QgsMeshLayer.dataset3dValue: src/core/mesh/qgsmeshlayer.h#L548 +QgsMeshLayer.dataset3dValues: src/core/mesh/qgsmeshlayer.h#L480 +QgsMeshLayer.datasetCount: src/core/mesh/qgsmeshlayer.h#L411 +QgsMeshLayer.datasetGroupCount: src/core/mesh/qgsmeshlayer.h#L362 +QgsMeshLayer.datasetGroupMetadata: src/core/mesh/qgsmeshlayer.h#L399 +QgsMeshLayer.datasetGroupTreeRootItem: src/core/mesh/qgsmeshlayer.h#L753 +QgsMeshLayer.datasetIndexAtRelativeTime: src/core/mesh/qgsmeshlayer.h#L603 +QgsMeshLayer.datasetIndexAtTime: src/core/mesh/qgsmeshlayer.h#L586 +QgsMeshLayer.datasetMetadata: src/core/mesh/qgsmeshlayer.h#L423 +QgsMeshLayer.datasetRelativeTime: src/core/mesh/qgsmeshlayer.h#L789 +QgsMeshLayer.datasetRelativeTimeInMilliseconds: src/core/mesh/qgsmeshlayer.h#L796 +QgsMeshLayer.datasetValue: src/core/mesh/qgsmeshlayer.h#L442 +QgsMeshLayer.datasetValue: src/core/mesh/qgsmeshlayer.h#L527 +QgsMeshLayer.datasetValues: src/core/mesh/qgsmeshlayer.h#L462 +QgsMeshLayer.datasetsPathUnique: src/core/mesh/qgsmeshlayer.h#L978 QgsMeshLayer.decodedSource: src/core/mesh/qgsmeshlayer.h#L188 QgsMeshLayer.elevationProperties: src/core/mesh/qgsmeshlayer.h#L192 QgsMeshLayer.encodedSource: src/core/mesh/qgsmeshlayer.h#L187 QgsMeshLayer.extent: src/core/mesh/qgsmeshlayer.h#L178 -QgsMeshLayer.extraDatasetGroupCount: src/core/mesh/qgsmeshlayer.h#L363 -QgsMeshLayer.firstValidTimeStep: src/core/mesh/qgsmeshlayer.h#L776 -QgsMeshLayer.formatTime: src/core/mesh/qgsmeshlayer.h#L349 +QgsMeshLayer.extraDatasetGroupCount: src/core/mesh/qgsmeshlayer.h#L369 +QgsMeshLayer.firstValidTimeStep: src/core/mesh/qgsmeshlayer.h#L782 +QgsMeshLayer.formatTime: src/core/mesh/qgsmeshlayer.h#L355 QgsMeshLayer.htmlMetadata: src/core/mesh/qgsmeshlayer.h#L195 QgsMeshLayer.isEditable: src/core/mesh/qgsmeshlayer.h#L196 -QgsMeshLayer.isFaceActive: src/core/mesh/qgsmeshlayer.h#L483 -QgsMeshLayer.isModified: src/core/mesh/qgsmeshlayer.h#L866 -QgsMeshLayer.labeling: src/core/mesh/qgsmeshlayer.h#L937 -QgsMeshLayer.labelsEnabled: src/core/mesh/qgsmeshlayer.h#L907 +QgsMeshLayer.isFaceActive: src/core/mesh/qgsmeshlayer.h#L489 +QgsMeshLayer.isModified: src/core/mesh/qgsmeshlayer.h#L872 +QgsMeshLayer.labeling: src/core/mesh/qgsmeshlayer.h#L943 +QgsMeshLayer.labelsEnabled: src/core/mesh/qgsmeshlayer.h#L913 QgsMeshLayer.loadDefaultStyle: src/core/mesh/qgsmeshlayer.h#L198 -QgsMeshLayer.meshEdgeCount: src/core/mesh/qgsmeshlayer.h#L897 -QgsMeshLayer.meshEditor: src/core/mesh/qgsmeshlayer.h#L859 -QgsMeshLayer.meshFaceCount: src/core/mesh/qgsmeshlayer.h#L890 -QgsMeshLayer.meshVertexCount: src/core/mesh/qgsmeshlayer.h#L881 -QgsMeshLayer.minimumMaximumActiveScalarDataset: src/core/mesh/qgsmeshlayer.h#L954 +QgsMeshLayer.meshEdgeCount: src/core/mesh/qgsmeshlayer.h#L903 +QgsMeshLayer.meshEditor: src/core/mesh/qgsmeshlayer.h#L865 +QgsMeshLayer.meshFaceCount: src/core/mesh/qgsmeshlayer.h#L896 +QgsMeshLayer.meshVertexCount: src/core/mesh/qgsmeshlayer.h#L887 +QgsMeshLayer.minimumMaximumActiveScalarDataset: src/core/mesh/qgsmeshlayer.h#L960 QgsMeshLayer.providerType: src/core/mesh/qgsmeshlayer.h#L201 QgsMeshLayer.readStyle: src/core/mesh/qgsmeshlayer.h#L186 QgsMeshLayer.readSymbology: src/core/mesh/qgsmeshlayer.h#L181 QgsMeshLayer.readXml: src/core/mesh/qgsmeshlayer.h#L189 -QgsMeshLayer.reindex: src/core/mesh/qgsmeshlayer.h#L852 +QgsMeshLayer.reindex: src/core/mesh/qgsmeshlayer.h#L858 QgsMeshLayer.reload: src/core/mesh/qgsmeshlayer.h#L193 -QgsMeshLayer.reloaded: src/core/mesh/qgsmeshlayer.h#L1011 +QgsMeshLayer.reloaded: src/core/mesh/qgsmeshlayer.h#L1017 QgsMeshLayer.removeDatasets: src/core/mesh/qgsmeshlayer.h#L222 QgsMeshLayer.rendererSettings: src/core/mesh/qgsmeshlayer.h#L311 -QgsMeshLayer.resetDatasetGroupTreeItem: src/core/mesh/qgsmeshlayer.h#L769 -QgsMeshLayer.rollBackFrameEditing: src/core/mesh/qgsmeshlayer.h#L832 +QgsMeshLayer.resetDatasetGroupTreeItem: src/core/mesh/qgsmeshlayer.h#L775 +QgsMeshLayer.rollBackFrameEditing: src/core/mesh/qgsmeshlayer.h#L838 QgsMeshLayer.saveDataset: src/core/mesh/qgsmeshlayer.h#L244 -QgsMeshLayer.setDatasetGroupTreeRootItem: src/core/mesh/qgsmeshlayer.h#L762 -QgsMeshLayer.setLabeling: src/core/mesh/qgsmeshlayer.h#L943 -QgsMeshLayer.setLabelsEnabled: src/core/mesh/qgsmeshlayer.h#L919 -QgsMeshLayer.setReferenceTime: src/core/mesh/qgsmeshlayer.h#L686 -QgsMeshLayer.setRendererSettings: src/core/mesh/qgsmeshlayer.h#L313 -QgsMeshLayer.setTemporalMatchingMethod: src/core/mesh/qgsmeshlayer.h#L695 -QgsMeshLayer.setTimeSettings: src/core/mesh/qgsmeshlayer.h#L327 -QgsMeshLayer.setTransformContext: src/core/mesh/qgsmeshlayer.h#L981 -QgsMeshLayer.snapOnElement: src/core/mesh/qgsmeshlayer.h#L718 -QgsMeshLayer.startFrameEditing: src/core/mesh/qgsmeshlayer.h#L799 -QgsMeshLayer.startFrameEditing: src/core/mesh/qgsmeshlayer.h#L811 -QgsMeshLayer.staticScalarDatasetIndex: src/core/mesh/qgsmeshlayer.h#L667 -QgsMeshLayer.staticVectorDatasetIndex: src/core/mesh/qgsmeshlayer.h#L677 -QgsMeshLayer.stopFrameEditing: src/core/mesh/qgsmeshlayer.h#L841 +QgsMeshLayer.setDatasetGroupTreeRootItem: src/core/mesh/qgsmeshlayer.h#L768 +QgsMeshLayer.setLabeling: src/core/mesh/qgsmeshlayer.h#L949 +QgsMeshLayer.setLabelsEnabled: src/core/mesh/qgsmeshlayer.h#L925 +QgsMeshLayer.setReferenceTime: src/core/mesh/qgsmeshlayer.h#L692 +QgsMeshLayer.setRendererSettings: src/core/mesh/qgsmeshlayer.h#L319 +QgsMeshLayer.setTemporalMatchingMethod: src/core/mesh/qgsmeshlayer.h#L701 +QgsMeshLayer.setTimeSettings: src/core/mesh/qgsmeshlayer.h#L333 +QgsMeshLayer.setTransformContext: src/core/mesh/qgsmeshlayer.h#L987 +QgsMeshLayer.snapOnElement: src/core/mesh/qgsmeshlayer.h#L724 +QgsMeshLayer.startFrameEditing: src/core/mesh/qgsmeshlayer.h#L805 +QgsMeshLayer.startFrameEditing: src/core/mesh/qgsmeshlayer.h#L817 +QgsMeshLayer.staticScalarDatasetIndex: src/core/mesh/qgsmeshlayer.h#L673 +QgsMeshLayer.staticVectorDatasetIndex: src/core/mesh/qgsmeshlayer.h#L683 +QgsMeshLayer.stopFrameEditing: src/core/mesh/qgsmeshlayer.h#L847 QgsMeshLayer.subLayers: src/core/mesh/qgsmeshlayer.h#L194 QgsMeshLayer.supportsEditing: src/core/mesh/qgsmeshlayer.h#L197 QgsMeshLayer.temporalProperties: src/core/mesh/qgsmeshlayer.h#L191 -QgsMeshLayer.timeSettings: src/core/mesh/qgsmeshlayer.h#L320 -QgsMeshLayer.timeSettingsChanged: src/core/mesh/qgsmeshlayer.h#L1004 +QgsMeshLayer.timeSettings: src/core/mesh/qgsmeshlayer.h#L326 +QgsMeshLayer.timeSettingsChanged: src/core/mesh/qgsmeshlayer.h#L1010 QgsMeshLayer.updateTriangularMesh: src/core/mesh/qgsmeshlayer.h#L301 QgsMeshLayer.writeStyle: src/core/mesh/qgsmeshlayer.h#L185 QgsMeshLayer.writeSymbology: src/core/mesh/qgsmeshlayer.h#L183 @@ -10144,106 +10150,106 @@ QgsMeshRendererScalarSettings.setLimits: src/core/mesh/qgsmeshrenderersettings.h QgsMeshRendererScalarSettings.setOpacity: src/core/mesh/qgsmeshrenderersettings.h#L132 QgsMeshRendererScalarSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L207 QgsMeshRendererScalarSettings: src/core/mesh/qgsmeshrenderersettings.h#L92 -QgsMeshRendererSettings.activeScalarDatasetGroup: src/core/mesh/qgsmeshrenderersettings.h#L817 -QgsMeshRendererSettings.activeVectorDatasetGroup: src/core/mesh/qgsmeshrenderersettings.h#L829 -QgsMeshRendererSettings.averagingMethod: src/core/mesh/qgsmeshrenderersettings.h#L799 -QgsMeshRendererSettings.edgeMeshSettings: src/core/mesh/qgsmeshrenderersettings.h#L751 -QgsMeshRendererSettings.hasScalarSettings: src/core/mesh/qgsmeshrenderersettings.h#L769 -QgsMeshRendererSettings.hasSettings: src/core/mesh/qgsmeshrenderersettings.h#L842 -QgsMeshRendererSettings.hasVectorSettings: src/core/mesh/qgsmeshrenderersettings.h#L786 -QgsMeshRendererSettings.nativeMeshSettings: src/core/mesh/qgsmeshrenderersettings.h#L738 -QgsMeshRendererSettings.readXml: src/core/mesh/qgsmeshrenderersettings.h#L811 -QgsMeshRendererSettings.removeScalarSettings: src/core/mesh/qgsmeshrenderersettings.h#L775 -QgsMeshRendererSettings.removeVectorSettings: src/core/mesh/qgsmeshrenderersettings.h#L792 -QgsMeshRendererSettings.scalarSettings: src/core/mesh/qgsmeshrenderersettings.h#L760 -QgsMeshRendererSettings.setActiveScalarDatasetGroup: src/core/mesh/qgsmeshrenderersettings.h#L823 -QgsMeshRendererSettings.setActiveVectorDatasetGroup: src/core/mesh/qgsmeshrenderersettings.h#L835 -QgsMeshRendererSettings.setAveragingMethod: src/core/mesh/qgsmeshrenderersettings.h#L806 -QgsMeshRendererSettings.setEdgeMeshSettings: src/core/mesh/qgsmeshrenderersettings.h#L757 -QgsMeshRendererSettings.setNativeMeshSettings: src/core/mesh/qgsmeshrenderersettings.h#L740 -QgsMeshRendererSettings.setScalarSettings: src/core/mesh/qgsmeshrenderersettings.h#L763 -QgsMeshRendererSettings.setTriangularMeshSettings: src/core/mesh/qgsmeshrenderersettings.h#L745 -QgsMeshRendererSettings.setVectorSettings: src/core/mesh/qgsmeshrenderersettings.h#L780 -QgsMeshRendererSettings.triangularMeshSettings: src/core/mesh/qgsmeshrenderersettings.h#L743 -QgsMeshRendererSettings.vectorSettings: src/core/mesh/qgsmeshrenderersettings.h#L778 -QgsMeshRendererSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L809 -QgsMeshRendererSettings: src/core/mesh/qgsmeshrenderersettings.h#L727 -QgsMeshRendererVectorArrowSettings.arrowHeadLengthRatio: src/core/mesh/qgsmeshrenderersettings.h#L340 -QgsMeshRendererVectorArrowSettings.arrowHeadWidthRatio: src/core/mesh/qgsmeshrenderersettings.h#L335 -QgsMeshRendererVectorArrowSettings.fixedShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L325 -QgsMeshRendererVectorArrowSettings.maxShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L297 -QgsMeshRendererVectorArrowSettings.minShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L283 -QgsMeshRendererVectorArrowSettings.readXml: src/core/mesh/qgsmeshrenderersettings.h#L347 -QgsMeshRendererVectorArrowSettings.scaleFactor: src/core/mesh/qgsmeshrenderersettings.h#L311 -QgsMeshRendererVectorArrowSettings.setArrowHeadLengthRatio: src/core/mesh/qgsmeshrenderersettings.h#L342 -QgsMeshRendererVectorArrowSettings.setArrowHeadWidthRatio: src/core/mesh/qgsmeshrenderersettings.h#L337 -QgsMeshRendererVectorArrowSettings.setFixedShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L332 -QgsMeshRendererVectorArrowSettings.setMaxShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L304 -QgsMeshRendererVectorArrowSettings.setMinShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L290 -QgsMeshRendererVectorArrowSettings.setScaleFactor: src/core/mesh/qgsmeshrenderersettings.h#L318 -QgsMeshRendererVectorArrowSettings.setShaftLengthMethod: src/core/mesh/qgsmeshrenderersettings.h#L276 -QgsMeshRendererVectorArrowSettings.shaftLengthMethod: src/core/mesh/qgsmeshrenderersettings.h#L274 -QgsMeshRendererVectorArrowSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L345 -QgsMeshRendererVectorArrowSettings: src/core/mesh/qgsmeshrenderersettings.h#L249 -QgsMeshRendererVectorSettings.arrowSettings: src/core/mesh/qgsmeshrenderersettings.h#L649 -QgsMeshRendererVectorSettings.color: src/core/mesh/qgsmeshrenderersettings.h#L558 -QgsMeshRendererVectorSettings.colorRampShader: src/core/mesh/qgsmeshrenderersettings.h#L631 -QgsMeshRendererVectorSettings.coloringMethod: src/core/mesh/qgsmeshrenderersettings.h#L619 -QgsMeshRendererVectorSettings.filterMax: src/core/mesh/qgsmeshrenderersettings.h#L582 -QgsMeshRendererVectorSettings.filterMin: src/core/mesh/qgsmeshrenderersettings.h#L568 -QgsMeshRendererVectorSettings.isOnUserDefinedGrid: src/core/mesh/qgsmeshrenderersettings.h#L591 -QgsMeshRendererVectorSettings.lineWidth: src/core/mesh/qgsmeshrenderersettings.h#L553 -QgsMeshRendererVectorSettings.readXml: src/core/mesh/qgsmeshrenderersettings.h#L696 -QgsMeshRendererVectorSettings.setArrowsSettings: src/core/mesh/qgsmeshrenderersettings.h#L655 -QgsMeshRendererVectorSettings.setColor: src/core/mesh/qgsmeshrenderersettings.h#L560 -QgsMeshRendererVectorSettings.setColorRampShader: src/core/mesh/qgsmeshrenderersettings.h#L637 -QgsMeshRendererVectorSettings.setColoringMethod: src/core/mesh/qgsmeshrenderersettings.h#L625 -QgsMeshRendererVectorSettings.setFilterMax: src/core/mesh/qgsmeshrenderersettings.h#L588 -QgsMeshRendererVectorSettings.setFilterMin: src/core/mesh/qgsmeshrenderersettings.h#L574 -QgsMeshRendererVectorSettings.setLineWidth: src/core/mesh/qgsmeshrenderersettings.h#L555 -QgsMeshRendererVectorSettings.setOnUserDefinedGrid: src/core/mesh/qgsmeshrenderersettings.h#L593 -QgsMeshRendererVectorSettings.setStreamLinesSettings: src/core/mesh/qgsmeshrenderersettings.h#L667 -QgsMeshRendererVectorSettings.setSymbology: src/core/mesh/qgsmeshrenderersettings.h#L613 -QgsMeshRendererVectorSettings.setTracesSettings: src/core/mesh/qgsmeshrenderersettings.h#L679 -QgsMeshRendererVectorSettings.setUserGridCellHeight: src/core/mesh/qgsmeshrenderersettings.h#L601 -QgsMeshRendererVectorSettings.setUserGridCellWidth: src/core/mesh/qgsmeshrenderersettings.h#L597 -QgsMeshRendererVectorSettings.setWindBarbSettings: src/core/mesh/qgsmeshrenderersettings.h#L691 -QgsMeshRendererVectorSettings.streamLinesSettings: src/core/mesh/qgsmeshrenderersettings.h#L661 -QgsMeshRendererVectorSettings.symbology: src/core/mesh/qgsmeshrenderersettings.h#L607 -QgsMeshRendererVectorSettings.tracesSettings: src/core/mesh/qgsmeshrenderersettings.h#L673 -QgsMeshRendererVectorSettings.userGridCellHeight: src/core/mesh/qgsmeshrenderersettings.h#L599 -QgsMeshRendererVectorSettings.userGridCellWidth: src/core/mesh/qgsmeshrenderersettings.h#L595 -QgsMeshRendererVectorSettings.vectorStrokeColoring: src/core/mesh/qgsmeshrenderersettings.h#L643 -QgsMeshRendererVectorSettings.windBarbSettings: src/core/mesh/qgsmeshrenderersettings.h#L685 -QgsMeshRendererVectorSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L694 -QgsMeshRendererVectorSettings: src/core/mesh/qgsmeshrenderersettings.h#L532 -QgsMeshRendererVectorStreamlineSettings.readXml: src/core/mesh/qgsmeshrenderersettings.h#L395 -QgsMeshRendererVectorStreamlineSettings.seedingDensity: src/core/mesh/qgsmeshrenderersettings.h#L391 -QgsMeshRendererVectorStreamlineSettings.seedingMethod: src/core/mesh/qgsmeshrenderersettings.h#L387 -QgsMeshRendererVectorStreamlineSettings.setSeedingDensity: src/core/mesh/qgsmeshrenderersettings.h#L393 -QgsMeshRendererVectorStreamlineSettings.setSeedingMethod: src/core/mesh/qgsmeshrenderersettings.h#L389 -QgsMeshRendererVectorStreamlineSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L397 -QgsMeshRendererVectorStreamlineSettings: src/core/mesh/qgsmeshrenderersettings.h#L368 -QgsMeshRendererVectorTracesSettings.maximumTailLength: src/core/mesh/qgsmeshrenderersettings.h#L419 -QgsMeshRendererVectorTracesSettings.maximumTailLengthUnit: src/core/mesh/qgsmeshrenderersettings.h#L427 -QgsMeshRendererVectorTracesSettings.particlesCount: src/core/mesh/qgsmeshrenderersettings.h#L423 -QgsMeshRendererVectorTracesSettings.readXml: src/core/mesh/qgsmeshrenderersettings.h#L432 -QgsMeshRendererVectorTracesSettings.setMaximumTailLength: src/core/mesh/qgsmeshrenderersettings.h#L421 -QgsMeshRendererVectorTracesSettings.setMaximumTailLengthUnit: src/core/mesh/qgsmeshrenderersettings.h#L429 -QgsMeshRendererVectorTracesSettings.setParticlesCount: src/core/mesh/qgsmeshrenderersettings.h#L425 -QgsMeshRendererVectorTracesSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L434 -QgsMeshRendererVectorTracesSettings: src/core/mesh/qgsmeshrenderersettings.h#L414 -QgsMeshRendererVectorWindBarbSettings.magnitudeMultiplier: src/core/mesh/qgsmeshrenderersettings.h#L470 -QgsMeshRendererVectorWindBarbSettings.magnitudeUnits: src/core/mesh/qgsmeshrenderersettings.h#L504 -QgsMeshRendererVectorWindBarbSettings.readXml: src/core/mesh/qgsmeshrenderersettings.h#L514 -QgsMeshRendererVectorWindBarbSettings.setMagnitudeMultiplier: src/core/mesh/qgsmeshrenderersettings.h#L475 -QgsMeshRendererVectorWindBarbSettings.setMagnitudeUnits: src/core/mesh/qgsmeshrenderersettings.h#L509 -QgsMeshRendererVectorWindBarbSettings.setShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L485 -QgsMeshRendererVectorWindBarbSettings.setShaftLengthUnits: src/core/mesh/qgsmeshrenderersettings.h#L499 -QgsMeshRendererVectorWindBarbSettings.shaftLength: src/core/mesh/qgsmeshrenderersettings.h#L480 -QgsMeshRendererVectorWindBarbSettings.shaftLengthUnits: src/core/mesh/qgsmeshrenderersettings.h#L492 -QgsMeshRendererVectorWindBarbSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L512 -QgsMeshRendererVectorWindBarbSettings: src/core/mesh/qgsmeshrenderersettings.h#L452 +QgsMeshRendererSettings.activeScalarDatasetGroup: src/core/mesh/qgsmeshrenderersettings.h#L804 +QgsMeshRendererSettings.activeVectorDatasetGroup: src/core/mesh/qgsmeshrenderersettings.h#L816 +QgsMeshRendererSettings.averagingMethod: src/core/mesh/qgsmeshrenderersettings.h#L786 +QgsMeshRendererSettings.edgeMeshSettings: src/core/mesh/qgsmeshrenderersettings.h#L738 +QgsMeshRendererSettings.hasScalarSettings: src/core/mesh/qgsmeshrenderersettings.h#L756 +QgsMeshRendererSettings.hasSettings: src/core/mesh/qgsmeshrenderersettings.h#L829 +QgsMeshRendererSettings.hasVectorSettings: src/core/mesh/qgsmeshrenderersettings.h#L773 +QgsMeshRendererSettings.nativeMeshSettings: src/core/mesh/qgsmeshrenderersettings.h#L725 +QgsMeshRendererSettings.readXml: src/core/mesh/qgsmeshrenderersettings.h#L798 +QgsMeshRendererSettings.removeScalarSettings: src/core/mesh/qgsmeshrenderersettings.h#L762 +QgsMeshRendererSettings.removeVectorSettings: src/core/mesh/qgsmeshrenderersettings.h#L779 +QgsMeshRendererSettings.scalarSettings: src/core/mesh/qgsmeshrenderersettings.h#L747 +QgsMeshRendererSettings.setActiveScalarDatasetGroup: src/core/mesh/qgsmeshrenderersettings.h#L810 +QgsMeshRendererSettings.setActiveVectorDatasetGroup: src/core/mesh/qgsmeshrenderersettings.h#L822 +QgsMeshRendererSettings.setAveragingMethod: src/core/mesh/qgsmeshrenderersettings.h#L793 +QgsMeshRendererSettings.setEdgeMeshSettings: src/core/mesh/qgsmeshrenderersettings.h#L744 +QgsMeshRendererSettings.setNativeMeshSettings: src/core/mesh/qgsmeshrenderersettings.h#L727 +QgsMeshRendererSettings.setScalarSettings: src/core/mesh/qgsmeshrenderersettings.h#L750 +QgsMeshRendererSettings.setTriangularMeshSettings: src/core/mesh/qgsmeshrenderersettings.h#L732 +QgsMeshRendererSettings.setVectorSettings: src/core/mesh/qgsmeshrenderersettings.h#L767 +QgsMeshRendererSettings.triangularMeshSettings: src/core/mesh/qgsmeshrenderersettings.h#L730 +QgsMeshRendererSettings.vectorSettings: src/core/mesh/qgsmeshrenderersettings.h#L765 +QgsMeshRendererSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L796 +QgsMeshRendererSettings: src/core/mesh/qgsmeshrenderersettings.h#L714 +QgsMeshRendererVectorArrowSettings.arrowHeadLengthRatio: src/core/mesh/qgsmeshrenderersettings.h#L327 +QgsMeshRendererVectorArrowSettings.arrowHeadWidthRatio: src/core/mesh/qgsmeshrenderersettings.h#L322 +QgsMeshRendererVectorArrowSettings.fixedShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L312 +QgsMeshRendererVectorArrowSettings.maxShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L284 +QgsMeshRendererVectorArrowSettings.minShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L270 +QgsMeshRendererVectorArrowSettings.readXml: src/core/mesh/qgsmeshrenderersettings.h#L334 +QgsMeshRendererVectorArrowSettings.scaleFactor: src/core/mesh/qgsmeshrenderersettings.h#L298 +QgsMeshRendererVectorArrowSettings.setArrowHeadLengthRatio: src/core/mesh/qgsmeshrenderersettings.h#L329 +QgsMeshRendererVectorArrowSettings.setArrowHeadWidthRatio: src/core/mesh/qgsmeshrenderersettings.h#L324 +QgsMeshRendererVectorArrowSettings.setFixedShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L319 +QgsMeshRendererVectorArrowSettings.setMaxShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L291 +QgsMeshRendererVectorArrowSettings.setMinShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L277 +QgsMeshRendererVectorArrowSettings.setScaleFactor: src/core/mesh/qgsmeshrenderersettings.h#L305 +QgsMeshRendererVectorArrowSettings.setShaftLengthMethod: src/core/mesh/qgsmeshrenderersettings.h#L263 +QgsMeshRendererVectorArrowSettings.shaftLengthMethod: src/core/mesh/qgsmeshrenderersettings.h#L261 +QgsMeshRendererVectorArrowSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L332 +QgsMeshRendererVectorArrowSettings: src/core/mesh/qgsmeshrenderersettings.h#L236 +QgsMeshRendererVectorSettings.arrowSettings: src/core/mesh/qgsmeshrenderersettings.h#L636 +QgsMeshRendererVectorSettings.color: src/core/mesh/qgsmeshrenderersettings.h#L545 +QgsMeshRendererVectorSettings.colorRampShader: src/core/mesh/qgsmeshrenderersettings.h#L618 +QgsMeshRendererVectorSettings.coloringMethod: src/core/mesh/qgsmeshrenderersettings.h#L606 +QgsMeshRendererVectorSettings.filterMax: src/core/mesh/qgsmeshrenderersettings.h#L569 +QgsMeshRendererVectorSettings.filterMin: src/core/mesh/qgsmeshrenderersettings.h#L555 +QgsMeshRendererVectorSettings.isOnUserDefinedGrid: src/core/mesh/qgsmeshrenderersettings.h#L578 +QgsMeshRendererVectorSettings.lineWidth: src/core/mesh/qgsmeshrenderersettings.h#L540 +QgsMeshRendererVectorSettings.readXml: src/core/mesh/qgsmeshrenderersettings.h#L683 +QgsMeshRendererVectorSettings.setArrowsSettings: src/core/mesh/qgsmeshrenderersettings.h#L642 +QgsMeshRendererVectorSettings.setColor: src/core/mesh/qgsmeshrenderersettings.h#L547 +QgsMeshRendererVectorSettings.setColorRampShader: src/core/mesh/qgsmeshrenderersettings.h#L624 +QgsMeshRendererVectorSettings.setColoringMethod: src/core/mesh/qgsmeshrenderersettings.h#L612 +QgsMeshRendererVectorSettings.setFilterMax: src/core/mesh/qgsmeshrenderersettings.h#L575 +QgsMeshRendererVectorSettings.setFilterMin: src/core/mesh/qgsmeshrenderersettings.h#L561 +QgsMeshRendererVectorSettings.setLineWidth: src/core/mesh/qgsmeshrenderersettings.h#L542 +QgsMeshRendererVectorSettings.setOnUserDefinedGrid: src/core/mesh/qgsmeshrenderersettings.h#L580 +QgsMeshRendererVectorSettings.setStreamLinesSettings: src/core/mesh/qgsmeshrenderersettings.h#L654 +QgsMeshRendererVectorSettings.setSymbology: src/core/mesh/qgsmeshrenderersettings.h#L600 +QgsMeshRendererVectorSettings.setTracesSettings: src/core/mesh/qgsmeshrenderersettings.h#L666 +QgsMeshRendererVectorSettings.setUserGridCellHeight: src/core/mesh/qgsmeshrenderersettings.h#L588 +QgsMeshRendererVectorSettings.setUserGridCellWidth: src/core/mesh/qgsmeshrenderersettings.h#L584 +QgsMeshRendererVectorSettings.setWindBarbSettings: src/core/mesh/qgsmeshrenderersettings.h#L678 +QgsMeshRendererVectorSettings.streamLinesSettings: src/core/mesh/qgsmeshrenderersettings.h#L648 +QgsMeshRendererVectorSettings.symbology: src/core/mesh/qgsmeshrenderersettings.h#L594 +QgsMeshRendererVectorSettings.tracesSettings: src/core/mesh/qgsmeshrenderersettings.h#L660 +QgsMeshRendererVectorSettings.userGridCellHeight: src/core/mesh/qgsmeshrenderersettings.h#L586 +QgsMeshRendererVectorSettings.userGridCellWidth: src/core/mesh/qgsmeshrenderersettings.h#L582 +QgsMeshRendererVectorSettings.vectorStrokeColoring: src/core/mesh/qgsmeshrenderersettings.h#L630 +QgsMeshRendererVectorSettings.windBarbSettings: src/core/mesh/qgsmeshrenderersettings.h#L672 +QgsMeshRendererVectorSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L681 +QgsMeshRendererVectorSettings: src/core/mesh/qgsmeshrenderersettings.h#L519 +QgsMeshRendererVectorStreamlineSettings.readXml: src/core/mesh/qgsmeshrenderersettings.h#L382 +QgsMeshRendererVectorStreamlineSettings.seedingDensity: src/core/mesh/qgsmeshrenderersettings.h#L378 +QgsMeshRendererVectorStreamlineSettings.seedingMethod: src/core/mesh/qgsmeshrenderersettings.h#L374 +QgsMeshRendererVectorStreamlineSettings.setSeedingDensity: src/core/mesh/qgsmeshrenderersettings.h#L380 +QgsMeshRendererVectorStreamlineSettings.setSeedingMethod: src/core/mesh/qgsmeshrenderersettings.h#L376 +QgsMeshRendererVectorStreamlineSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L384 +QgsMeshRendererVectorStreamlineSettings: src/core/mesh/qgsmeshrenderersettings.h#L355 +QgsMeshRendererVectorTracesSettings.maximumTailLength: src/core/mesh/qgsmeshrenderersettings.h#L406 +QgsMeshRendererVectorTracesSettings.maximumTailLengthUnit: src/core/mesh/qgsmeshrenderersettings.h#L414 +QgsMeshRendererVectorTracesSettings.particlesCount: src/core/mesh/qgsmeshrenderersettings.h#L410 +QgsMeshRendererVectorTracesSettings.readXml: src/core/mesh/qgsmeshrenderersettings.h#L419 +QgsMeshRendererVectorTracesSettings.setMaximumTailLength: src/core/mesh/qgsmeshrenderersettings.h#L408 +QgsMeshRendererVectorTracesSettings.setMaximumTailLengthUnit: src/core/mesh/qgsmeshrenderersettings.h#L416 +QgsMeshRendererVectorTracesSettings.setParticlesCount: src/core/mesh/qgsmeshrenderersettings.h#L412 +QgsMeshRendererVectorTracesSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L421 +QgsMeshRendererVectorTracesSettings: src/core/mesh/qgsmeshrenderersettings.h#L401 +QgsMeshRendererVectorWindBarbSettings.magnitudeMultiplier: src/core/mesh/qgsmeshrenderersettings.h#L457 +QgsMeshRendererVectorWindBarbSettings.magnitudeUnits: src/core/mesh/qgsmeshrenderersettings.h#L491 +QgsMeshRendererVectorWindBarbSettings.readXml: src/core/mesh/qgsmeshrenderersettings.h#L501 +QgsMeshRendererVectorWindBarbSettings.setMagnitudeMultiplier: src/core/mesh/qgsmeshrenderersettings.h#L462 +QgsMeshRendererVectorWindBarbSettings.setMagnitudeUnits: src/core/mesh/qgsmeshrenderersettings.h#L496 +QgsMeshRendererVectorWindBarbSettings.setShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L472 +QgsMeshRendererVectorWindBarbSettings.setShaftLengthUnits: src/core/mesh/qgsmeshrenderersettings.h#L486 +QgsMeshRendererVectorWindBarbSettings.shaftLength: src/core/mesh/qgsmeshrenderersettings.h#L467 +QgsMeshRendererVectorWindBarbSettings.shaftLengthUnits: src/core/mesh/qgsmeshrenderersettings.h#L479 +QgsMeshRendererVectorWindBarbSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L499 +QgsMeshRendererVectorWindBarbSettings: src/core/mesh/qgsmeshrenderersettings.h#L439 QgsMeshSigmaAveragingMethod.clone: src/core/mesh/qgsmesh3daveraging.h#L258 QgsMeshSigmaAveragingMethod.endFraction: src/core/mesh/qgsmesh3daveraging.h#L274 QgsMeshSigmaAveragingMethod.equals: src/core/mesh/qgsmesh3daveraging.h#L257 @@ -10291,14 +10297,14 @@ QgsMeshVectorTraceAnimationGenerator.setParticlesSize: src/core/mesh/qgsmeshtrac QgsMeshVectorTraceAnimationGenerator.setTailFactor: src/core/mesh/qgsmeshtracerenderer.h#L642 QgsMeshVectorTraceAnimationGenerator.setTailPersitence: src/core/mesh/qgsmeshtracerenderer.h#L648 QgsMeshVectorTraceAnimationGenerator: src/core/mesh/qgsmeshtracerenderer.h#L599 -QgsMessageLog.logMessage: src/core/qgsmessagelog.h#L54 -QgsMessageLog.messageReceived: src/core/qgsmessagelog.h#L64 -QgsMessageLog.messageReceived: src/core/qgsmessagelog.h#L76 +QgsMessageLog.logMessage: src/core/qgsmessagelog.h#L62 +QgsMessageLog.messageReceived: src/core/qgsmessagelog.h#L73 +QgsMessageLog.messageReceived: src/core/qgsmessagelog.h#L85 QgsMessageLog: src/core/qgsmessagelog.h#L39 -QgsMessageLogConsole.formatLogMessage: src/core/qgsmessagelog.h#L152 -QgsMessageLogConsole.logMessage: src/core/qgsmessagelog.h#L163 -QgsMessageLogConsole: src/core/qgsmessagelog.h#L131 -QgsMessageLogNotifyBlocker: src/core/qgsmessagelog.h#L101 +QgsMessageLogConsole.formatLogMessage: src/core/qgsmessagelog.h#L161 +QgsMessageLogConsole.logMessage: src/core/qgsmessagelog.h#L172 +QgsMessageLogConsole: src/core/qgsmessagelog.h#L140 +QgsMessageLogNotifyBlocker: src/core/qgsmessagelog.h#L110 QgsMessageOutput.appendMessage: src/core/qgsmessageoutput.h#L56 QgsMessageOutput.createMessageOutput: src/core/qgsmessageoutput.h#L81 QgsMessageOutput.setMessage: src/core/qgsmessageoutput.h#L53 @@ -10316,18 +10322,18 @@ QgsMetadataUtils.convertFromEsri: src/core/metadata/qgsmetadatautils.h#L41 QgsMetadataUtils: src/core/metadata/qgsmetadatautils.h#L34 QgsMimeDataUtils.QgsMimeDataUtils.Uri: src/core/qgsmimedatautils.h#L46 QgsMimeDataUtils.QgsMimeDataUtils.Uri: src/core/qgsmimedatautils.h#L53 -QgsMimeDataUtils.QgsMimeDataUtils.__repr__: src/core/qgsmimedatautils.h#L158 +QgsMimeDataUtils.QgsMimeDataUtils.__repr__: src/core/qgsmimedatautils.h#L164 QgsMimeDataUtils.QgsMimeDataUtils.data: src/core/qgsmimedatautils.h#L61 QgsMimeDataUtils.QgsMimeDataUtils.isValid: src/core/qgsmimedatautils.h#L58 QgsMimeDataUtils.QgsMimeDataUtils.mapLayer: src/core/qgsmimedatautils.h#L93 QgsMimeDataUtils.QgsMimeDataUtils.meshLayer: src/core/qgsmimedatautils.h#L82 QgsMimeDataUtils.QgsMimeDataUtils.rasterLayer: src/core/qgsmimedatautils.h#L75 QgsMimeDataUtils.QgsMimeDataUtils.vectorLayer: src/core/qgsmimedatautils.h#L68 -QgsMimeDataUtils.decodeUriList: src/core/qgsmimedatautils.h#L174 -QgsMimeDataUtils.encodeUriList: src/core/qgsmimedatautils.h#L170 -QgsMimeDataUtils.hasOriginatedFromCurrentAppInstance: src/core/qgsmimedatautils.h#L187 -QgsMimeDataUtils.isUriList: src/core/qgsmimedatautils.h#L172 -QgsMimeDataUtils.layerTreeNodesToUriList: src/core/qgsmimedatautils.h#L179 +QgsMimeDataUtils.decodeUriList: src/core/qgsmimedatautils.h#L180 +QgsMimeDataUtils.encodeUriList: src/core/qgsmimedatautils.h#L176 +QgsMimeDataUtils.hasOriginatedFromCurrentAppInstance: src/core/qgsmimedatautils.h#L193 +QgsMimeDataUtils.isUriList: src/core/qgsmimedatautils.h#L178 +QgsMimeDataUtils.layerTreeNodesToUriList: src/core/qgsmimedatautils.h#L185 QgsMimeDataUtils: src/core/qgsmimedatautils.h#L37 QgsMultiBandColorRenderer.block: src/core/raster/qgsmultibandcolorrenderer.h#L50 QgsMultiBandColorRenderer.blueBand: src/core/raster/qgsmultibandcolorrenderer.h#L56 @@ -10727,27 +10733,26 @@ QgsPageSizeRegistry.add: src/core/layout/qgspagesizeregistry.h#L83 QgsPageSizeRegistry.decodePageSize: src/core/layout/qgspagesizeregistry.h#L110 QgsPageSizeRegistry.find: src/core/layout/qgspagesizeregistry.h#L103 QgsPageSizeRegistry: src/core/layout/qgspagesizeregistry.h#L71 -QgsPaintEffect.begin: src/core/effects/qgspainteffect.h#L178 -QgsPaintEffect.boundingRect: src/core/effects/qgspainteffect.h#L282 -QgsPaintEffect.clone: src/core/effects/qgspainteffect.h#L124 -QgsPaintEffect.draw: src/core/effects/qgspainteffect.h#L231 -QgsPaintEffect.drawMode: src/core/effects/qgspainteffect.h#L208 -QgsPaintEffect.drawSource: src/core/effects/qgspainteffect.h#L240 -QgsPaintEffect.enabled: src/core/effects/qgspainteffect.h#L193 -QgsPaintEffect.end: src/core/effects/qgspainteffect.h#L186 -QgsPaintEffect.fixQPictureDpi: src/core/effects/qgspainteffect.h#L292 -QgsPaintEffect.imageOffset: src/core/effects/qgspainteffect.h#L271 -QgsPaintEffect.properties: src/core/effects/qgspainteffect.h#L133 -QgsPaintEffect.readProperties: src/core/effects/qgspainteffect.h#L141 -QgsPaintEffect.readProperties: src/core/effects/qgspainteffect.h#L160 -QgsPaintEffect.render: src/core/effects/qgspainteffect.h#L168 -QgsPaintEffect.saveProperties: src/core/effects/qgspainteffect.h#L152 -QgsPaintEffect.setDrawMode: src/core/effects/qgspainteffect.h#L216 -QgsPaintEffect.setEnabled: src/core/effects/qgspainteffect.h#L200 -QgsPaintEffect.source: src/core/effects/qgspainteffect.h#L249 -QgsPaintEffect.sourceAsImage: src/core/effects/qgspainteffect.h#L262 -QgsPaintEffect.type: src/core/effects/qgspainteffect.h#L118 -QgsPaintEffect: src/core/effects/qgspainteffect.h#L51 +QgsPaintEffect.begin: src/core/effects/qgspainteffect.h#L179 +QgsPaintEffect.boundingRect: src/core/effects/qgspainteffect.h#L283 +QgsPaintEffect.clone: src/core/effects/qgspainteffect.h#L125 +QgsPaintEffect.draw: src/core/effects/qgspainteffect.h#L232 +QgsPaintEffect.drawMode: src/core/effects/qgspainteffect.h#L209 +QgsPaintEffect.drawSource: src/core/effects/qgspainteffect.h#L241 +QgsPaintEffect.enabled: src/core/effects/qgspainteffect.h#L194 +QgsPaintEffect.end: src/core/effects/qgspainteffect.h#L187 +QgsPaintEffect.fixQPictureDpi: src/core/effects/qgspainteffect.h#L293 +QgsPaintEffect.imageOffset: src/core/effects/qgspainteffect.h#L272 +QgsPaintEffect.properties: src/core/effects/qgspainteffect.h#L134 +QgsPaintEffect.readProperties: src/core/effects/qgspainteffect.h#L142 +QgsPaintEffect.readProperties: src/core/effects/qgspainteffect.h#L161 +QgsPaintEffect.render: src/core/effects/qgspainteffect.h#L169 +QgsPaintEffect.saveProperties: src/core/effects/qgspainteffect.h#L153 +QgsPaintEffect.setDrawMode: src/core/effects/qgspainteffect.h#L217 +QgsPaintEffect.setEnabled: src/core/effects/qgspainteffect.h#L201 +QgsPaintEffect.sourceAsImage: src/core/effects/qgspainteffect.h#L263 +QgsPaintEffect.type: src/core/effects/qgspainteffect.h#L119 +QgsPaintEffect: src/core/effects/qgspainteffect.h#L52 QgsPaintEffectAbstractMetadata.createPaintEffect: src/core/effects/qgspainteffectregistry.h#L71 QgsPaintEffectAbstractMetadata.createWidget: src/core/effects/qgspainteffectregistry.h#L78 QgsPaintEffectAbstractMetadata.name: src/core/effects/qgspainteffectregistry.h#L57 @@ -11136,38 +11141,39 @@ QgsPointCloudExtentRenderer.startRender: src/core/pointcloud/qgspointcloudextent QgsPointCloudExtentRenderer.stopRender: src/core/pointcloud/qgspointcloudextentrenderer.h#L52 QgsPointCloudExtentRenderer.type: src/core/pointcloud/qgspointcloudextentrenderer.h#L46 QgsPointCloudExtentRenderer: src/core/pointcloud/qgspointcloudextentrenderer.h#L33 -QgsPointCloudIndex.accessType: src/core/pointcloud/qgspointcloudindex.h#L454 -QgsPointCloudIndex.attributes: src/core/pointcloud/qgspointcloudindex.h#L518 +QgsPointCloudIndex.accessType: src/core/pointcloud/qgspointcloudindex.h#L457 +QgsPointCloudIndex.attributes: src/core/pointcloud/qgspointcloudindex.h#L521 QgsPointCloudIndex.bool: src/core/pointcloud/qgspointcloudindex.h#L423 -QgsPointCloudIndex.commitChanges: src/core/pointcloud/qgspointcloudindex.h#L648 -QgsPointCloudIndex.crs: src/core/pointcloud/qgspointcloudindex.h#L461 -QgsPointCloudIndex.error: src/core/pointcloud/qgspointcloudindex.h#L444 -QgsPointCloudIndex.extent: src/core/pointcloud/qgspointcloudindex.h#L558 -QgsPointCloudIndex.extraMetadata: src/core/pointcloud/qgspointcloudindex.h#L642 -QgsPointCloudIndex.getNode: src/core/pointcloud/qgspointcloudindex.h#L511 -QgsPointCloudIndex.hasNode: src/core/pointcloud/qgspointcloudindex.h#L504 -QgsPointCloudIndex.isModified: src/core/pointcloud/qgspointcloudindex.h#L651 -QgsPointCloudIndex.isValid: src/core/pointcloud/qgspointcloudindex.h#L437 -QgsPointCloudIndex.load: src/core/pointcloud/qgspointcloudindex.h#L430 -QgsPointCloudIndex.metadataStatistics: src/core/pointcloud/qgspointcloudindex.h#L482 -QgsPointCloudIndex.offset: src/core/pointcloud/qgspointcloudindex.h#L593 -QgsPointCloudIndex.originalMetadata: src/core/pointcloud/qgspointcloudindex.h#L475 -QgsPointCloudIndex.pointCount: src/core/pointcloud/qgspointcloudindex.h#L468 -QgsPointCloudIndex.root: src/core/pointcloud/qgspointcloudindex.h#L497 -QgsPointCloudIndex.rootNodeBounds: src/core/pointcloud/qgspointcloudindex.h#L579 -QgsPointCloudIndex.scale: src/core/pointcloud/qgspointcloudindex.h#L586 -QgsPointCloudIndex.setSubsetString: src/core/pointcloud/qgspointcloudindex.h#L609 -QgsPointCloudIndex.span: src/core/pointcloud/qgspointcloudindex.h#L600 -QgsPointCloudIndex.subsetString: src/core/pointcloud/qgspointcloudindex.h#L618 -QgsPointCloudIndex.updateNodeData: src/core/pointcloud/qgspointcloudindex.h#L551 -QgsPointCloudIndex.writeStatistics: src/core/pointcloud/qgspointcloudindex.h#L490 -QgsPointCloudIndex.zMax: src/core/pointcloud/qgspointcloudindex.h#L572 -QgsPointCloudIndex.zMin: src/core/pointcloud/qgspointcloudindex.h#L565 +QgsPointCloudIndex.commitChanges: src/core/pointcloud/qgspointcloudindex.h#L653 +QgsPointCloudIndex.crs: src/core/pointcloud/qgspointcloudindex.h#L464 +QgsPointCloudIndex.error: src/core/pointcloud/qgspointcloudindex.h#L447 +QgsPointCloudIndex.extent: src/core/pointcloud/qgspointcloudindex.h#L561 +QgsPointCloudIndex.extraMetadata: src/core/pointcloud/qgspointcloudindex.h#L645 +QgsPointCloudIndex.getNode: src/core/pointcloud/qgspointcloudindex.h#L514 +QgsPointCloudIndex.hasNode: src/core/pointcloud/qgspointcloudindex.h#L507 +QgsPointCloudIndex.isModified: src/core/pointcloud/qgspointcloudindex.h#L656 +QgsPointCloudIndex.isValid: src/core/pointcloud/qgspointcloudindex.h#L440 +QgsPointCloudIndex.load: src/core/pointcloud/qgspointcloudindex.h#L433 +QgsPointCloudIndex.metadataStatistics: src/core/pointcloud/qgspointcloudindex.h#L485 +QgsPointCloudIndex.offset: src/core/pointcloud/qgspointcloudindex.h#L596 +QgsPointCloudIndex.originalMetadata: src/core/pointcloud/qgspointcloudindex.h#L478 +QgsPointCloudIndex.pointCount: src/core/pointcloud/qgspointcloudindex.h#L471 +QgsPointCloudIndex.root: src/core/pointcloud/qgspointcloudindex.h#L500 +QgsPointCloudIndex.rootNodeBounds: src/core/pointcloud/qgspointcloudindex.h#L582 +QgsPointCloudIndex.scale: src/core/pointcloud/qgspointcloudindex.h#L589 +QgsPointCloudIndex.setSubsetString: src/core/pointcloud/qgspointcloudindex.h#L612 +QgsPointCloudIndex.span: src/core/pointcloud/qgspointcloudindex.h#L603 +QgsPointCloudIndex.subsetString: src/core/pointcloud/qgspointcloudindex.h#L621 +QgsPointCloudIndex.updateNodeData: src/core/pointcloud/qgspointcloudindex.h#L554 +QgsPointCloudIndex.writeStatistics: src/core/pointcloud/qgspointcloudindex.h#L493 +QgsPointCloudIndex.zMax: src/core/pointcloud/qgspointcloudindex.h#L575 +QgsPointCloudIndex.zMin: src/core/pointcloud/qgspointcloudindex.h#L568 QgsPointCloudIndex: src/core/pointcloud/qgspointcloudindex.h#L416 QgsPointCloudLayer.QgsPointCloudLayer.LayerOptions: src/core/pointcloud/qgspointcloudlayer.h#L61 QgsPointCloudLayer.QgsPointCloudLayer: src/core/pointcloud/qgspointcloudlayer.h#L112 QgsPointCloudLayer.__repr__: src/core/pointcloud/qgspointcloudlayer.h#L123 QgsPointCloudLayer.attributes: src/core/pointcloud/qgspointcloudlayer.h#L165 +QgsPointCloudLayer.chunkAttributeValuesChanged: src/core/pointcloud/qgspointcloudlayer.h#L359 QgsPointCloudLayer.clone: src/core/pointcloud/qgspointcloudlayer.h#L130 QgsPointCloudLayer.commitChanges: src/core/pointcloud/qgspointcloudlayer.h#L286 QgsPointCloudLayer.commitError: src/core/pointcloud/qgspointcloudlayer.h#L294 @@ -11856,6 +11862,7 @@ QgsProcessingContext.LayerDetails: src/core/processing/qgsprocessingcontext.h#L2 QgsProcessingContext.addLayerToLoadOnCompletion: src/core/processing/qgsprocessingcontext.h#L383 QgsProcessingContext.areaUnit: src/core/processing/qgsprocessingcontext.h#L208 QgsProcessingContext.asQgisProcessArguments: src/core/processing/qgsprocessingcontext.h#L731 +QgsProcessingContext.clearModelResult: src/core/processing/qgsprocessingcontext.h#L802 QgsProcessingContext.copyThreadSafeSettings: src/core/processing/qgsprocessingcontext.h#L89 QgsProcessingContext.currentTimeRange: src/core/processing/qgsprocessingcontext.h#L227 QgsProcessingContext.defaultEncoding: src/core/processing/qgsprocessingcontext.h#L492 @@ -11968,8 +11975,8 @@ QgsProcessingFeedback.reportError: src/core/processing/qgsprocessingfeedback.h#L QgsProcessingFeedback.setProgressText: src/core/processing/qgsprocessingfeedback.h#L57 QgsProcessingFeedback.textLog: src/core/processing/qgsprocessingfeedback.h#L165 QgsProcessingFeedback: src/core/processing/qgsprocessingfeedback.h#L37 -QgsProcessingLayerPostProcessorInterface.postProcessLayer: src/core/processing/qgsprocessingcontext.h#L875 -QgsProcessingLayerPostProcessorInterface: src/core/processing/qgsprocessingcontext.h#L855 +QgsProcessingLayerPostProcessorInterface.postProcessLayer: src/core/processing/qgsprocessingcontext.h#L882 +QgsProcessingLayerPostProcessorInterface: src/core/processing/qgsprocessingcontext.h#L862 QgsProcessingModelAlgorithm.VariableDefinition: src/core/processing/models/qgsprocessingmodelalgorithm.h#L466 QgsProcessingModelAlgorithm.activateChildAlgorithm: src/core/processing/models/qgsprocessingmodelalgorithm.h#L158 QgsProcessingModelAlgorithm.addChildAlgorithm: src/core/processing/models/qgsprocessingmodelalgorithm.h#L124 @@ -13762,47 +13769,48 @@ QgsProviderConnectionModel.parent: src/core/qgsproviderconnectionmodel.h#L83 QgsProviderConnectionModel.rowCount: src/core/qgsproviderconnectionmodel.h#L84 QgsProviderConnectionModel.setAllowEmptyConnection: src/core/qgsproviderconnectionmodel.h#L74 QgsProviderConnectionModel: src/core/qgsproviderconnectionmodel.h#L38 -QgsProviderMetadata.__repr__: src/core/providers/qgsprovidermetadata.h#L802 +QgsProviderMetadata.__repr__: src/core/providers/qgsprovidermetadata.h#L809 QgsProviderMetadata.absoluteToRelativeUri: src/core/providers/qgsprovidermetadata.h#L600 QgsProviderMetadata.boolParameter: src/core/providers/qgsprovidermetadata.h#L479 QgsProviderMetadata.capabilities: src/core/providers/qgsprovidermetadata.h#L257 +QgsProviderMetadata.cleanUri: src/core/providers/qgsprovidermetadata.h#L620 QgsProviderMetadata.cleanupProvider: src/core/providers/qgsprovidermetadata.h#L338 -QgsProviderMetadata.connectionChanged: src/core/providers/qgsprovidermetadata.h#L834 -QgsProviderMetadata.connectionCreated: src/core/providers/qgsprovidermetadata.h#L817 -QgsProviderMetadata.connectionDeleted: src/core/providers/qgsprovidermetadata.h#L825 -QgsProviderMetadata.createConnection: src/core/providers/qgsprovidermetadata.h#L774 -QgsProviderMetadata.createConnection: src/core/providers/qgsprovidermetadata.h#L782 +QgsProviderMetadata.connectionChanged: src/core/providers/qgsprovidermetadata.h#L841 +QgsProviderMetadata.connectionCreated: src/core/providers/qgsprovidermetadata.h#L824 +QgsProviderMetadata.connectionDeleted: src/core/providers/qgsprovidermetadata.h#L832 +QgsProviderMetadata.createConnection: src/core/providers/qgsprovidermetadata.h#L781 +QgsProviderMetadata.createConnection: src/core/providers/qgsprovidermetadata.h#L789 QgsProviderMetadata.createDatabase: src/core/providers/qgsprovidermetadata.h#L514 -QgsProviderMetadata.createDb: src/core/providers/qgsprovidermetadata.h#L710 +QgsProviderMetadata.createDb: src/core/providers/qgsprovidermetadata.h#L717 QgsProviderMetadata.createMeshData: src/core/providers/qgsprovidermetadata.h#L536 QgsProviderMetadata.createMeshData: src/core/providers/qgsprovidermetadata.h#L548 QgsProviderMetadata.createProvider: src/core/providers/qgsprovidermetadata.h#L461 QgsProviderMetadata.createRasterDataProvider: src/core/providers/qgsprovidermetadata.h#L520 -QgsProviderMetadata.createTransaction: src/core/providers/qgsprovidermetadata.h#L716 +QgsProviderMetadata.createTransaction: src/core/providers/qgsprovidermetadata.h#L723 QgsProviderMetadata.decodeUri: src/core/providers/qgsprovidermetadata.h#L577 -QgsProviderMetadata.deleteConnection: src/core/providers/qgsprovidermetadata.h#L790 -QgsProviderMetadata.deleteStyleById: src/core/providers/qgsprovidermetadata.h#L657 +QgsProviderMetadata.deleteConnection: src/core/providers/qgsprovidermetadata.h#L797 +QgsProviderMetadata.deleteStyleById: src/core/providers/qgsprovidermetadata.h#L664 QgsProviderMetadata.description: src/core/providers/qgsprovidermetadata.h#L243 QgsProviderMetadata.encodeUri: src/core/providers/qgsprovidermetadata.h#L587 QgsProviderMetadata.filters: src/core/providers/qgsprovidermetadata.h#L347 -QgsProviderMetadata.findConnection: src/core/providers/qgsprovidermetadata.h#L749 -QgsProviderMetadata.getStyleById: src/core/providers/qgsprovidermetadata.h#L651 +QgsProviderMetadata.findConnection: src/core/providers/qgsprovidermetadata.h#L756 +QgsProviderMetadata.getStyleById: src/core/providers/qgsprovidermetadata.h#L658 QgsProviderMetadata.icon: src/core/providers/qgsprovidermetadata.h#L250 QgsProviderMetadata.initProvider: src/core/providers/qgsprovidermetadata.h#L332 QgsProviderMetadata.key: src/core/providers/qgsprovidermetadata.h#L236 QgsProviderMetadata.library: src/core/providers/qgsprovidermetadata.h#L318 -QgsProviderMetadata.listStyles: src/core/providers/qgsprovidermetadata.h#L628 -QgsProviderMetadata.loadStoredStyle: src/core/providers/qgsprovidermetadata.h#L688 -QgsProviderMetadata.loadStyle: src/core/providers/qgsprovidermetadata.h#L678 +QgsProviderMetadata.listStyles: src/core/providers/qgsprovidermetadata.h#L635 +QgsProviderMetadata.loadStoredStyle: src/core/providers/qgsprovidermetadata.h#L695 +QgsProviderMetadata.loadStyle: src/core/providers/qgsprovidermetadata.h#L685 QgsProviderMetadata.priorityForUri: src/core/providers/qgsprovidermetadata.h#L371 QgsProviderMetadata.providerCapabilities: src/core/providers/qgsprovidermetadata.h#L264 QgsProviderMetadata.relativeToAbsoluteUri: src/core/providers/qgsprovidermetadata.h#L613 -QgsProviderMetadata.saveConnection: src/core/providers/qgsprovidermetadata.h#L799 -QgsProviderMetadata.saveLayerMetadata: src/core/providers/qgsprovidermetadata.h#L704 -QgsProviderMetadata.saveStyle: src/core/providers/qgsprovidermetadata.h#L670 +QgsProviderMetadata.saveConnection: src/core/providers/qgsprovidermetadata.h#L806 +QgsProviderMetadata.saveLayerMetadata: src/core/providers/qgsprovidermetadata.h#L711 +QgsProviderMetadata.saveStyle: src/core/providers/qgsprovidermetadata.h#L677 QgsProviderMetadata.setBoolParameter: src/core/providers/qgsprovidermetadata.h#L471 QgsProviderMetadata.sidecarFilesForUri: src/core/providers/qgsprovidermetadata.h#L424 -QgsProviderMetadata.styleExists: src/core/providers/qgsprovidermetadata.h#L642 +QgsProviderMetadata.styleExists: src/core/providers/qgsprovidermetadata.h#L649 QgsProviderMetadata.suggestGroupNameForUri: src/core/providers/qgsprovidermetadata.h#L450 QgsProviderMetadata.supportedLayerTypes: src/core/providers/qgsprovidermetadata.h#L274 QgsProviderMetadata.uriIsBlocklisted: src/core/providers/qgsprovidermetadata.h#L401 @@ -14867,56 +14875,56 @@ QgsRecentColorScheme: src/core/qgscolorscheme.h#L218 QgsRecentStyleHandler.pushRecentSymbol: src/core/qgsrecentstylehandler.h#L75 QgsRecentStyleHandler.recentSymbol: src/core/qgsrecentstylehandler.h#L85 QgsRecentStyleHandler: src/core/qgsrecentstylehandler.h#L38 -QgsRectangle.QVariant: src/core/geometry/qgsrectangle.h#L626 -QgsRectangle.QgsRectangle: src/core/geometry/qgsrectangle.h#L76 -QgsRectangle.__repr__: src/core/geometry/qgsrectangle.h#L637 -QgsRectangle.area: src/core/geometry/qgsrectangle.h#L264 -QgsRectangle.asPolygon: src/core/geometry/qgsrectangle.h#L560 -QgsRectangle.asWktCoordinates: src/core/geometry/qgsrectangle.h#L535 -QgsRectangle.asWktPolygon: src/core/geometry/qgsrectangle.h#L540 -QgsRectangle.buffered: src/core/geometry/qgsrectangle.h#L363 -QgsRectangle.center: src/core/geometry/qgsrectangle.h#L275 -QgsRectangle.combineExtentWith: src/core/geometry/qgsrectangle.h#L442 -QgsRectangle.combineExtentWith: src/core/geometry/qgsrectangle.h#L459 -QgsRectangle.combineExtentWith: src/core/geometry/qgsrectangle.h#L468 -QgsRectangle.contains: src/core/geometry/qgsrectangle.h#L406 -QgsRectangle.contains: src/core/geometry/qgsrectangle.h#L415 -QgsRectangle.contains: src/core/geometry/qgsrectangle.h#L426 -QgsRectangle.distance: src/core/geometry/qgsrectangle.h#L479 -QgsRectangle.fromCenterAndSize: src/core/geometry/qgsrectangle.h#L125 -QgsRectangle.fromWkt: src/core/geometry/qgsrectangle.h#L119 -QgsRectangle.grow: src/core/geometry/qgsrectangle.h#L328 -QgsRectangle.height: src/core/geometry/qgsrectangle.h#L256 -QgsRectangle.include: src/core/geometry/qgsrectangle.h#L351 -QgsRectangle.intersect: src/core/geometry/qgsrectangle.h#L379 -QgsRectangle.intersects: src/core/geometry/qgsrectangle.h#L398 -QgsRectangle.invert: src/core/geometry/qgsrectangle.h#L614 -QgsRectangle.isEmpty: src/core/geometry/qgsrectangle.h#L513 -QgsRectangle.isFinite: src/core/geometry/qgsrectangle.h#L605 -QgsRectangle.isNull: src/core/geometry/qgsrectangle.h#L530 -QgsRectangle.normalize: src/core/geometry/qgsrectangle.h#L242 -QgsRectangle.perimeter: src/core/geometry/qgsrectangle.h#L270 -QgsRectangle.scale: src/core/geometry/qgsrectangle.h#L295 -QgsRectangle.scale: src/core/geometry/qgsrectangle.h#L308 -QgsRectangle.scaled: src/core/geometry/qgsrectangle.h#L314 -QgsRectangle.set: src/core/geometry/qgsrectangle.h#L141 -QgsRectangle.set: src/core/geometry/qgsrectangle.h#L157 -QgsRectangle.setMinimal: src/core/geometry/qgsrectangle.h#L204 -QgsRectangle.setNull: src/core/geometry/qgsrectangle.h#L193 -QgsRectangle.setXMaximum: src/core/geometry/qgsrectangle.h#L167 -QgsRectangle.setXMinimum: src/core/geometry/qgsrectangle.h#L162 -QgsRectangle.setYMaximum: src/core/geometry/qgsrectangle.h#L177 -QgsRectangle.setYMinimum: src/core/geometry/qgsrectangle.h#L172 -QgsRectangle.snappedToGrid: src/core/geometry/qgsrectangle.h#L634 -QgsRectangle.toBox3d: src/core/geometry/qgsrectangle.h#L620 -QgsRectangle.toRectF: src/core/geometry/qgsrectangle.h#L548 -QgsRectangle.toString: src/core/geometry/qgsrectangle.h#L555 -QgsRectangle.width: src/core/geometry/qgsrectangle.h#L249 -QgsRectangle.xMaximum: src/core/geometry/qgsrectangle.h#L209 -QgsRectangle.xMinimum: src/core/geometry/qgsrectangle.h#L214 -QgsRectangle.yMaximum: src/core/geometry/qgsrectangle.h#L219 -QgsRectangle.yMinimum: src/core/geometry/qgsrectangle.h#L224 -QgsRectangle: src/core/geometry/qgsrectangle.h#L41 +QgsRectangle.QVariant: src/core/geometry/qgsrectangle.h#L628 +QgsRectangle.QgsRectangle: src/core/geometry/qgsrectangle.h#L78 +QgsRectangle.__repr__: src/core/geometry/qgsrectangle.h#L639 +QgsRectangle.area: src/core/geometry/qgsrectangle.h#L266 +QgsRectangle.asPolygon: src/core/geometry/qgsrectangle.h#L562 +QgsRectangle.asWktCoordinates: src/core/geometry/qgsrectangle.h#L537 +QgsRectangle.asWktPolygon: src/core/geometry/qgsrectangle.h#L542 +QgsRectangle.buffered: src/core/geometry/qgsrectangle.h#L365 +QgsRectangle.center: src/core/geometry/qgsrectangle.h#L277 +QgsRectangle.combineExtentWith: src/core/geometry/qgsrectangle.h#L444 +QgsRectangle.combineExtentWith: src/core/geometry/qgsrectangle.h#L461 +QgsRectangle.combineExtentWith: src/core/geometry/qgsrectangle.h#L470 +QgsRectangle.contains: src/core/geometry/qgsrectangle.h#L408 +QgsRectangle.contains: src/core/geometry/qgsrectangle.h#L417 +QgsRectangle.contains: src/core/geometry/qgsrectangle.h#L428 +QgsRectangle.distance: src/core/geometry/qgsrectangle.h#L481 +QgsRectangle.fromCenterAndSize: src/core/geometry/qgsrectangle.h#L127 +QgsRectangle.fromWkt: src/core/geometry/qgsrectangle.h#L121 +QgsRectangle.grow: src/core/geometry/qgsrectangle.h#L330 +QgsRectangle.height: src/core/geometry/qgsrectangle.h#L258 +QgsRectangle.include: src/core/geometry/qgsrectangle.h#L353 +QgsRectangle.intersect: src/core/geometry/qgsrectangle.h#L381 +QgsRectangle.intersects: src/core/geometry/qgsrectangle.h#L400 +QgsRectangle.invert: src/core/geometry/qgsrectangle.h#L616 +QgsRectangle.isEmpty: src/core/geometry/qgsrectangle.h#L515 +QgsRectangle.isFinite: src/core/geometry/qgsrectangle.h#L607 +QgsRectangle.isNull: src/core/geometry/qgsrectangle.h#L532 +QgsRectangle.normalize: src/core/geometry/qgsrectangle.h#L244 +QgsRectangle.perimeter: src/core/geometry/qgsrectangle.h#L272 +QgsRectangle.scale: src/core/geometry/qgsrectangle.h#L297 +QgsRectangle.scale: src/core/geometry/qgsrectangle.h#L310 +QgsRectangle.scaled: src/core/geometry/qgsrectangle.h#L316 +QgsRectangle.set: src/core/geometry/qgsrectangle.h#L143 +QgsRectangle.set: src/core/geometry/qgsrectangle.h#L159 +QgsRectangle.setMinimal: src/core/geometry/qgsrectangle.h#L206 +QgsRectangle.setNull: src/core/geometry/qgsrectangle.h#L195 +QgsRectangle.setXMaximum: src/core/geometry/qgsrectangle.h#L169 +QgsRectangle.setXMinimum: src/core/geometry/qgsrectangle.h#L164 +QgsRectangle.setYMaximum: src/core/geometry/qgsrectangle.h#L179 +QgsRectangle.setYMinimum: src/core/geometry/qgsrectangle.h#L174 +QgsRectangle.snappedToGrid: src/core/geometry/qgsrectangle.h#L636 +QgsRectangle.toBox3d: src/core/geometry/qgsrectangle.h#L622 +QgsRectangle.toRectF: src/core/geometry/qgsrectangle.h#L550 +QgsRectangle.toString: src/core/geometry/qgsrectangle.h#L557 +QgsRectangle.width: src/core/geometry/qgsrectangle.h#L251 +QgsRectangle.xMaximum: src/core/geometry/qgsrectangle.h#L211 +QgsRectangle.xMinimum: src/core/geometry/qgsrectangle.h#L216 +QgsRectangle.yMaximum: src/core/geometry/qgsrectangle.h#L221 +QgsRectangle.yMinimum: src/core/geometry/qgsrectangle.h#L226 +QgsRectangle: src/core/geometry/qgsrectangle.h#L43 QgsReferencedGeometry.QVariant: src/core/geometry/qgsreferencedgeometry.h#L164 QgsReferencedGeometry.__repr__: src/core/geometry/qgsreferencedgeometry.h#L181 QgsReferencedGeometry.fromReferencedPointXY: src/core/geometry/qgsreferencedgeometry.h#L172 @@ -15320,48 +15328,48 @@ QgsReportSectionLayout.setBodyEnabled: src/core/layout/qgsreportsectionlayout.h# QgsReportSectionLayout.type: src/core/layout/qgsreportsectionlayout.h#L43 QgsReportSectionLayout.writePropertiesToElement: src/core/layout/qgsreportsectionlayout.h#L87 QgsReportSectionLayout: src/core/layout/qgsreportsectionlayout.h#L33 -QgsRuleBasedLabeling.QgsRuleBasedLabeling: src/core/labeling/qgsrulebasedlabeling.h#L359 -QgsRuleBasedLabeling.Rule.accept: src/core/labeling/qgsrulebasedlabeling.h#L304 -QgsRuleBasedLabeling.Rule.active: src/core/labeling/qgsrulebasedlabeling.h#L119 -QgsRuleBasedLabeling.Rule.appendChild: src/core/labeling/qgsrulebasedlabeling.h#L220 -QgsRuleBasedLabeling.Rule.clone: src/core/labeling/qgsrulebasedlabeling.h#L242 -QgsRuleBasedLabeling.Rule.create: src/core/labeling/qgsrulebasedlabeling.h#L253 -QgsRuleBasedLabeling.Rule.dependsOnScale: src/core/labeling/qgsrulebasedlabeling.h#L81 -QgsRuleBasedLabeling.Rule.descendants: src/core/labeling/qgsrulebasedlabeling.h#L203 -QgsRuleBasedLabeling.Rule.description: src/core/labeling/qgsrulebasedlabeling.h#L112 -QgsRuleBasedLabeling.Rule.filterExpression: src/core/labeling/qgsrulebasedlabeling.h#L105 -QgsRuleBasedLabeling.Rule.findRuleByKey: src/core/labeling/qgsrulebasedlabeling.h#L229 -QgsRuleBasedLabeling.Rule.insertChild: src/core/labeling/qgsrulebasedlabeling.h#L223 -QgsRuleBasedLabeling.Rule.isElse: src/core/labeling/qgsrulebasedlabeling.h#L126 -QgsRuleBasedLabeling.Rule.maximumScale: src/core/labeling/qgsrulebasedlabeling.h#L90 -QgsRuleBasedLabeling.Rule.minimumScale: src/core/labeling/qgsrulebasedlabeling.h#L99 -QgsRuleBasedLabeling.Rule.parent: src/core/labeling/qgsrulebasedlabeling.h#L217 -QgsRuleBasedLabeling.Rule.removeChildAt: src/core/labeling/qgsrulebasedlabeling.h#L226 -QgsRuleBasedLabeling.Rule.requiresAdvancedEffects: src/core/labeling/qgsrulebasedlabeling.h#L293 -QgsRuleBasedLabeling.Rule.ruleKey: src/core/labeling/qgsrulebasedlabeling.h#L129 -QgsRuleBasedLabeling.Rule.save: src/core/labeling/qgsrulebasedlabeling.h#L256 -QgsRuleBasedLabeling.Rule.setActive: src/core/labeling/qgsrulebasedlabeling.h#L170 -QgsRuleBasedLabeling.Rule.setDescription: src/core/labeling/qgsrulebasedlabeling.h#L164 -QgsRuleBasedLabeling.Rule.setFilterExpression: src/core/labeling/qgsrulebasedlabeling.h#L157 -QgsRuleBasedLabeling.Rule.setIsElse: src/core/labeling/qgsrulebasedlabeling.h#L177 -QgsRuleBasedLabeling.Rule.setMaximumScale: src/core/labeling/qgsrulebasedlabeling.h#L150 -QgsRuleBasedLabeling.Rule.setMinimumScale: src/core/labeling/qgsrulebasedlabeling.h#L141 -QgsRuleBasedLabeling.Rule.setRuleKey: src/core/labeling/qgsrulebasedlabeling.h#L180 -QgsRuleBasedLabeling.Rule.setSettings: src/core/labeling/qgsrulebasedlabeling.h#L132 -QgsRuleBasedLabeling.Rule.settings: src/core/labeling/qgsrulebasedlabeling.h#L74 -QgsRuleBasedLabeling.Rule: src/core/labeling/qgsrulebasedlabeling.h#L53 -QgsRuleBasedLabeling.accept: src/core/labeling/qgsrulebasedlabeling.h#L377 -QgsRuleBasedLabeling.clone: src/core/labeling/qgsrulebasedlabeling.h#L371 -QgsRuleBasedLabeling.create: src/core/labeling/qgsrulebasedlabeling.h#L366 -QgsRuleBasedLabeling.multiplyOpacity: src/core/labeling/qgsrulebasedlabeling.h#L389 -QgsRuleBasedLabeling.requiresAdvancedEffects: src/core/labeling/qgsrulebasedlabeling.h#L387 -QgsRuleBasedLabeling.rootRule: src/core/labeling/qgsrulebasedlabeling.h#L362 -QgsRuleBasedLabeling.save: src/core/labeling/qgsrulebasedlabeling.h#L372 -QgsRuleBasedLabeling.setSettings: src/core/labeling/qgsrulebasedlabeling.h#L386 -QgsRuleBasedLabeling.settings: src/core/labeling/qgsrulebasedlabeling.h#L376 -QgsRuleBasedLabeling.subProviders: src/core/labeling/qgsrulebasedlabeling.h#L375 -QgsRuleBasedLabeling.toSld: src/core/labeling/qgsrulebasedlabeling.h#L388 -QgsRuleBasedLabeling.type: src/core/labeling/qgsrulebasedlabeling.h#L370 +QgsRuleBasedLabeling.QgsRuleBasedLabeling: src/core/labeling/qgsrulebasedlabeling.h#L366 +QgsRuleBasedLabeling.Rule.accept: src/core/labeling/qgsrulebasedlabeling.h#L311 +QgsRuleBasedLabeling.Rule.active: src/core/labeling/qgsrulebasedlabeling.h#L122 +QgsRuleBasedLabeling.Rule.appendChild: src/core/labeling/qgsrulebasedlabeling.h#L223 +QgsRuleBasedLabeling.Rule.clone: src/core/labeling/qgsrulebasedlabeling.h#L249 +QgsRuleBasedLabeling.Rule.create: src/core/labeling/qgsrulebasedlabeling.h#L260 +QgsRuleBasedLabeling.Rule.dependsOnScale: src/core/labeling/qgsrulebasedlabeling.h#L84 +QgsRuleBasedLabeling.Rule.descendants: src/core/labeling/qgsrulebasedlabeling.h#L206 +QgsRuleBasedLabeling.Rule.description: src/core/labeling/qgsrulebasedlabeling.h#L115 +QgsRuleBasedLabeling.Rule.filterExpression: src/core/labeling/qgsrulebasedlabeling.h#L108 +QgsRuleBasedLabeling.Rule.findRuleByKey: src/core/labeling/qgsrulebasedlabeling.h#L232 +QgsRuleBasedLabeling.Rule.insertChild: src/core/labeling/qgsrulebasedlabeling.h#L226 +QgsRuleBasedLabeling.Rule.isElse: src/core/labeling/qgsrulebasedlabeling.h#L129 +QgsRuleBasedLabeling.Rule.maximumScale: src/core/labeling/qgsrulebasedlabeling.h#L93 +QgsRuleBasedLabeling.Rule.minimumScale: src/core/labeling/qgsrulebasedlabeling.h#L102 +QgsRuleBasedLabeling.Rule.parent: src/core/labeling/qgsrulebasedlabeling.h#L220 +QgsRuleBasedLabeling.Rule.removeChildAt: src/core/labeling/qgsrulebasedlabeling.h#L229 +QgsRuleBasedLabeling.Rule.requiresAdvancedEffects: src/core/labeling/qgsrulebasedlabeling.h#L300 +QgsRuleBasedLabeling.Rule.ruleKey: src/core/labeling/qgsrulebasedlabeling.h#L132 +QgsRuleBasedLabeling.Rule.save: src/core/labeling/qgsrulebasedlabeling.h#L263 +QgsRuleBasedLabeling.Rule.setActive: src/core/labeling/qgsrulebasedlabeling.h#L173 +QgsRuleBasedLabeling.Rule.setDescription: src/core/labeling/qgsrulebasedlabeling.h#L167 +QgsRuleBasedLabeling.Rule.setFilterExpression: src/core/labeling/qgsrulebasedlabeling.h#L160 +QgsRuleBasedLabeling.Rule.setIsElse: src/core/labeling/qgsrulebasedlabeling.h#L180 +QgsRuleBasedLabeling.Rule.setMaximumScale: src/core/labeling/qgsrulebasedlabeling.h#L153 +QgsRuleBasedLabeling.Rule.setMinimumScale: src/core/labeling/qgsrulebasedlabeling.h#L144 +QgsRuleBasedLabeling.Rule.setRuleKey: src/core/labeling/qgsrulebasedlabeling.h#L183 +QgsRuleBasedLabeling.Rule.setSettings: src/core/labeling/qgsrulebasedlabeling.h#L135 +QgsRuleBasedLabeling.Rule.settings: src/core/labeling/qgsrulebasedlabeling.h#L77 +QgsRuleBasedLabeling.Rule: src/core/labeling/qgsrulebasedlabeling.h#L56 +QgsRuleBasedLabeling.accept: src/core/labeling/qgsrulebasedlabeling.h#L384 +QgsRuleBasedLabeling.clone: src/core/labeling/qgsrulebasedlabeling.h#L378 +QgsRuleBasedLabeling.create: src/core/labeling/qgsrulebasedlabeling.h#L373 +QgsRuleBasedLabeling.multiplyOpacity: src/core/labeling/qgsrulebasedlabeling.h#L396 +QgsRuleBasedLabeling.requiresAdvancedEffects: src/core/labeling/qgsrulebasedlabeling.h#L394 +QgsRuleBasedLabeling.rootRule: src/core/labeling/qgsrulebasedlabeling.h#L369 +QgsRuleBasedLabeling.save: src/core/labeling/qgsrulebasedlabeling.h#L379 +QgsRuleBasedLabeling.setSettings: src/core/labeling/qgsrulebasedlabeling.h#L393 +QgsRuleBasedLabeling.settings: src/core/labeling/qgsrulebasedlabeling.h#L383 +QgsRuleBasedLabeling.subProviders: src/core/labeling/qgsrulebasedlabeling.h#L382 +QgsRuleBasedLabeling.toSld: src/core/labeling/qgsrulebasedlabeling.h#L395 +QgsRuleBasedLabeling.type: src/core/labeling/qgsrulebasedlabeling.h#L377 QgsRuleBasedLabeling: src/core/labeling/qgsrulebasedlabeling.h#L41 QgsRuleBasedRenderer.QgsRuleBasedRenderer.RenderLevel: src/core/symbology/qgsrulebasedrenderer.h#L102 QgsRuleBasedRenderer.Rule.accept: src/core/symbology/qgsrulebasedrenderer.h#L460 @@ -15797,7 +15805,7 @@ QgsScientificNumericFormat.setNumberDecimalPlaces: src/core/numericformats/qgssc QgsScientificNumericFormat.sortKey: src/core/numericformats/qgsscientificnumericformat.h#L39 QgsScientificNumericFormat.visibleName: src/core/numericformats/qgsscientificnumericformat.h#L38 QgsScientificNumericFormat: src/core/numericformats/qgsscientificnumericformat.h#L28 -QgsScopeLogger: src/core/qgslogger.h#L135 +QgsScopeLogger: src/core/qgslogger.h#L139 QgsScopedExpressionFunction.clone: src/core/qgsexpressioncontext.h#L87 QgsScopedExpressionFunction.func: src/core/qgsexpressioncontext.h#L82 QgsScopedExpressionFunction.isStatic: src/core/qgsexpressioncontext.h#L93 @@ -15856,37 +15864,37 @@ QgsSensorRegistry.removeSensorType: src/core/sensor/qgssensorregistry.h#L187 QgsSensorRegistry.sensorAdded: src/core/sensor/qgssensorregistry.h#L205 QgsSensorRegistry.sensorMetadata: src/core/sensor/qgssensorregistry.h#L161 QgsSensorRegistry: src/core/sensor/qgssensorregistry.h#L131 -QgsSensorThingsExpansionDefinition.__repr__: src/core/providers/sensorthings/qgssensorthingsutils.h#L314 -QgsSensorThingsExpansionDefinition.asQueryString: src/core/providers/sensorthings/qgssensorthingsutils.h#L308 -QgsSensorThingsExpansionDefinition.childEntity: src/core/providers/sensorthings/qgssensorthingsutils.h#L214 -QgsSensorThingsExpansionDefinition.defaultDefinitionForEntity: src/core/providers/sensorthings/qgssensorthingsutils.h#L202 -QgsSensorThingsExpansionDefinition.filter: src/core/providers/sensorthings/qgssensorthingsutils.h#L278 -QgsSensorThingsExpansionDefinition.fromString: src/core/providers/sensorthings/qgssensorthingsutils.h#L299 -QgsSensorThingsExpansionDefinition.isValid: src/core/providers/sensorthings/qgssensorthingsutils.h#L207 -QgsSensorThingsExpansionDefinition.limit: src/core/providers/sensorthings/qgssensorthingsutils.h#L262 -QgsSensorThingsExpansionDefinition.orderBy: src/core/providers/sensorthings/qgssensorthingsutils.h#L229 -QgsSensorThingsExpansionDefinition.setChildEntity: src/core/providers/sensorthings/qgssensorthingsutils.h#L221 -QgsSensorThingsExpansionDefinition.setFilter: src/core/providers/sensorthings/qgssensorthingsutils.h#L285 -QgsSensorThingsExpansionDefinition.setLimit: src/core/providers/sensorthings/qgssensorthingsutils.h#L271 -QgsSensorThingsExpansionDefinition.setOrderBy: src/core/providers/sensorthings/qgssensorthingsutils.h#L237 -QgsSensorThingsExpansionDefinition.setSortOrder: src/core/providers/sensorthings/qgssensorthingsutils.h#L253 -QgsSensorThingsExpansionDefinition.sortOrder: src/core/providers/sensorthings/qgssensorthingsutils.h#L245 -QgsSensorThingsExpansionDefinition.toString: src/core/providers/sensorthings/qgssensorthingsutils.h#L292 -QgsSensorThingsExpansionDefinition: src/core/providers/sensorthings/qgssensorthingsutils.h#L185 -QgsSensorThingsUtils.asQueryString: src/core/providers/sensorthings/qgssensorthingsutils.h#L174 -QgsSensorThingsUtils.combineFilters: src/core/providers/sensorthings/qgssensorthingsutils.h#L137 +QgsSensorThingsExpansionDefinition.__repr__: src/core/providers/sensorthings/qgssensorthingsutils.h#L317 +QgsSensorThingsExpansionDefinition.asQueryString: src/core/providers/sensorthings/qgssensorthingsutils.h#L311 +QgsSensorThingsExpansionDefinition.childEntity: src/core/providers/sensorthings/qgssensorthingsutils.h#L217 +QgsSensorThingsExpansionDefinition.defaultDefinitionForEntity: src/core/providers/sensorthings/qgssensorthingsutils.h#L205 +QgsSensorThingsExpansionDefinition.filter: src/core/providers/sensorthings/qgssensorthingsutils.h#L281 +QgsSensorThingsExpansionDefinition.fromString: src/core/providers/sensorthings/qgssensorthingsutils.h#L302 +QgsSensorThingsExpansionDefinition.isValid: src/core/providers/sensorthings/qgssensorthingsutils.h#L210 +QgsSensorThingsExpansionDefinition.limit: src/core/providers/sensorthings/qgssensorthingsutils.h#L265 +QgsSensorThingsExpansionDefinition.orderBy: src/core/providers/sensorthings/qgssensorthingsutils.h#L232 +QgsSensorThingsExpansionDefinition.setChildEntity: src/core/providers/sensorthings/qgssensorthingsutils.h#L224 +QgsSensorThingsExpansionDefinition.setFilter: src/core/providers/sensorthings/qgssensorthingsutils.h#L288 +QgsSensorThingsExpansionDefinition.setLimit: src/core/providers/sensorthings/qgssensorthingsutils.h#L274 +QgsSensorThingsExpansionDefinition.setOrderBy: src/core/providers/sensorthings/qgssensorthingsutils.h#L240 +QgsSensorThingsExpansionDefinition.setSortOrder: src/core/providers/sensorthings/qgssensorthingsutils.h#L256 +QgsSensorThingsExpansionDefinition.sortOrder: src/core/providers/sensorthings/qgssensorthingsutils.h#L248 +QgsSensorThingsExpansionDefinition.toString: src/core/providers/sensorthings/qgssensorthingsutils.h#L295 +QgsSensorThingsExpansionDefinition: src/core/providers/sensorthings/qgssensorthingsutils.h#L188 +QgsSensorThingsUtils.asQueryString: src/core/providers/sensorthings/qgssensorthingsutils.h#L177 +QgsSensorThingsUtils.combineFilters: src/core/providers/sensorthings/qgssensorthingsutils.h#L140 QgsSensorThingsUtils.displayString: src/core/providers/sensorthings/qgssensorthingsutils.h#L59 QgsSensorThingsUtils.entitySetStringToEntity: src/core/providers/sensorthings/qgssensorthingsutils.h#L66 QgsSensorThingsUtils.entityToSetString: src/core/providers/sensorthings/qgssensorthingsutils.h#L73 -QgsSensorThingsUtils.entityTypeHasGeometry: src/core/providers/sensorthings/qgssensorthingsutils.h#L103 -QgsSensorThingsUtils.fieldsForEntityType: src/core/providers/sensorthings/qgssensorthingsutils.h#L85 -QgsSensorThingsUtils.fieldsForExpandedEntityType: src/core/providers/sensorthings/qgssensorthingsutils.h#L93 -QgsSensorThingsUtils.filterForExtent: src/core/providers/sensorthings/qgssensorthingsutils.h#L128 -QgsSensorThingsUtils.filterForWkbType: src/core/providers/sensorthings/qgssensorthingsutils.h#L118 -QgsSensorThingsUtils.geometryFieldForEntityType: src/core/providers/sensorthings/qgssensorthingsutils.h#L98 -QgsSensorThingsUtils.geometryTypeForEntity: src/core/providers/sensorthings/qgssensorthingsutils.h#L112 +QgsSensorThingsUtils.entityTypeHasGeometry: src/core/providers/sensorthings/qgssensorthingsutils.h#L106 +QgsSensorThingsUtils.fieldsForEntityType: src/core/providers/sensorthings/qgssensorthingsutils.h#L88 +QgsSensorThingsUtils.fieldsForExpandedEntityType: src/core/providers/sensorthings/qgssensorthingsutils.h#L96 +QgsSensorThingsUtils.filterForExtent: src/core/providers/sensorthings/qgssensorthingsutils.h#L131 +QgsSensorThingsUtils.filterForWkbType: src/core/providers/sensorthings/qgssensorthingsutils.h#L121 +QgsSensorThingsUtils.geometryFieldForEntityType: src/core/providers/sensorthings/qgssensorthingsutils.h#L101 +QgsSensorThingsUtils.geometryTypeForEntity: src/core/providers/sensorthings/qgssensorthingsutils.h#L115 QgsSensorThingsUtils.propertiesForEntityType: src/core/providers/sensorthings/qgssensorthingsutils.h#L80 -QgsSensorThingsUtils.relationshipCardinality: src/core/providers/sensorthings/qgssensorthingsutils.h#L165 +QgsSensorThingsUtils.relationshipCardinality: src/core/providers/sensorthings/qgssensorthingsutils.h#L168 QgsSensorThingsUtils.stringToEntity: src/core/providers/sensorthings/qgssensorthingsutils.h#L52 QgsSensorThingsUtils: src/core/providers/sensorthings/qgssensorthingsutils.h#L33 QgsSerialPortSensor.QgsSerialPortSensor: src/core/sensor/qgsiodevicesensor.h#L241 @@ -16042,10 +16050,10 @@ QgsSettingsRegistry.removeSubRegistry: src/core/settings/qgssettingsregistry.h#L QgsSettingsRegistry.settingsEntry: src/core/settings/qgssettingsregistry.h#L55 QgsSettingsRegistry: src/core/settings/qgssettingsregistry.h#L38 QgsSettingsRegistryCore: src/core/settings/qgssettingsregistrycore.h#L43 -QgsSettingsTree.createPluginTreeNode: src/core/settings/qgssettingstree.h#L81 -QgsSettingsTree.node: src/core/settings/qgssettingstree.h#L76 +QgsSettingsTree.createPluginTreeNode: src/core/settings/qgssettingstree.h#L82 +QgsSettingsTree.node: src/core/settings/qgssettingstree.h#L77 QgsSettingsTree.treeRoot: src/core/settings/qgssettingstree.h#L38 -QgsSettingsTree.unregisterPluginTreeNode: src/core/settings/qgssettingstree.h#L87 +QgsSettingsTree.unregisterPluginTreeNode: src/core/settings/qgssettingstree.h#L88 QgsSettingsTree: src/core/settings/qgssettingstree.h#L30 QgsSettingsTreeNamedListNode.deleteAllItems: src/core/settings/qgssettingstreenode.h#L240 QgsSettingsTreeNamedListNode.deleteItem: src/core/settings/qgssettingstreenode.h#L232 @@ -16378,6 +16386,7 @@ QgsSingleBandPseudoColorRenderer.shader: src/core/raster/qgssinglebandpseudocolo QgsSingleBandPseudoColorRenderer.toSld: src/core/raster/qgssinglebandpseudocolorrenderer.h#L84 QgsSingleBandPseudoColorRenderer.writeXml: src/core/raster/qgssinglebandpseudocolorrenderer.h#L80 QgsSingleBandPseudoColorRenderer: src/core/raster/qgssinglebandpseudocolorrenderer.h#L34 +QgsSingleBoxScaleBarRenderer.applyDefaultSettings: src/core/scalebar/qgssingleboxscalebarrenderer.h#L46 QgsSingleBoxScaleBarRenderer.clone: src/core/scalebar/qgssingleboxscalebarrenderer.h#L40 QgsSingleBoxScaleBarRenderer.draw: src/core/scalebar/qgssingleboxscalebarrenderer.h#L42 QgsSingleBoxScaleBarRenderer.flags: src/core/scalebar/qgssingleboxscalebarrenderer.h#L39 @@ -17138,6 +17147,7 @@ QgsSymbolLayerUtils.applyScaleDependency: src/core/symbology/qgssymbollayerutils QgsSymbolLayerUtils.blurImageInPlace: src/core/symbology/qgssymbollayerutils.h#L711 QgsSymbolLayerUtils.clearSymbolLayerIds: src/core/symbology/qgssymbollayerutils.h#L932 QgsSymbolLayerUtils.clearSymbolLayerIds: src/core/symbology/qgssymbollayerutils.h#L938 +QgsSymbolLayerUtils.clearSymbolLayerMasks: src/core/symbology/qgssymbollayerutils.h#L956 QgsSymbolLayerUtils.clearSymbolMap: src/core/symbology/qgssymbollayerutils.h#L568 QgsSymbolLayerUtils.colorFromMimeData: src/core/symbology/qgssymbollayerutils.h#L649 QgsSymbolLayerUtils.colorListFromMimeData: src/core/symbology/qgssymbollayerutils.h#L656 @@ -18161,6 +18171,7 @@ QgsTrackedVectorLayerTools.stopEditing: src/core/qgstrackedvectorlayertools.h#L4 QgsTrackedVectorLayerTools: src/core/qgstrackedvectorlayertools.h#L27 QgsTransaction.addLayer: src/core/qgstransaction.h#L90 QgsTransaction.afterRollback: src/core/qgstransaction.h#L174 +QgsTransaction.afterRollbackToSavepoint: src/core/qgstransaction.h#L180 QgsTransaction.begin: src/core/qgstransaction.h#L102 QgsTransaction.commit: src/core/qgstransaction.h#L107 QgsTransaction.connectionString: src/core/qgstransaction.h#L81 @@ -18168,7 +18179,7 @@ QgsTransaction.create: src/core/qgstransaction.h#L66 QgsTransaction.create: src/core/qgstransaction.h#L73 QgsTransaction.createSavepoint: src/core/qgstransaction.h#L136 QgsTransaction.createSavepoint: src/core/qgstransaction.h#L142 -QgsTransaction.dirtied: src/core/qgstransaction.h#L179 +QgsTransaction.dirtied: src/core/qgstransaction.h#L185 QgsTransaction.dirtyLastSavePoint: src/core/qgstransaction.h#L152 QgsTransaction.executeSql: src/core/qgstransaction.h#L124 QgsTransaction.lastSavePointIsDirty: src/core/qgstransaction.h#L162 diff --git a/python/PyQt6/gui/auto_additions/qgsplotrubberband.py b/python/PyQt6/gui/auto_additions/qgsplotrubberband.py index 9a49316800bf..e9bfb798644f 100644 --- a/python/PyQt6/gui/auto_additions/qgsplotrubberband.py +++ b/python/PyQt6/gui/auto_additions/qgsplotrubberband.py @@ -7,3 +7,7 @@ QgsPlotRectangularRubberBand.__group__ = ['plot'] except (NameError, AttributeError): pass +try: + QgsPlotPointRubberBand.__group__ = ['plot'] +except (NameError, AttributeError): + pass diff --git a/python/PyQt6/gui/auto_generated/auth/qgsauthsettingswidget.sip.in b/python/PyQt6/gui/auto_generated/auth/qgsauthsettingswidget.sip.in index 3d604f327b15..c6df7f3d0b2f 100644 --- a/python/PyQt6/gui/auto_generated/auth/qgsauthsettingswidget.sip.in +++ b/python/PyQt6/gui/auto_generated/auth/qgsauthsettingswidget.sip.in @@ -39,6 +39,13 @@ from existing configs, or creating/removing them from auth database :param username: :param password: :param dataprovider: The key of the calling layer provider, if applicable +%End + + void removeBasicSettings(); +%Docstring +Removes the basic authentication tab from the widget. + +.. versionadded:: 3.42 %End void setWarningText( const QString &warningText ); diff --git a/python/PyQt6/gui/auto_generated/elevation/qgselevationprofilecanvas.sip.in b/python/PyQt6/gui/auto_generated/elevation/qgselevationprofilecanvas.sip.in index 7cb9766d6283..d1cbf04ac720 100644 --- a/python/PyQt6/gui/auto_generated/elevation/qgselevationprofilecanvas.sip.in +++ b/python/PyQt6/gui/auto_generated/elevation/qgselevationprofilecanvas.sip.in @@ -249,6 +249,13 @@ The chart text, border and axis color will be automatically updated to ensure readability with the new background color. .. versionadded:: 3.34 +%End + + void setInflectionLinesEnabled( bool enabled ); +%Docstring +Sets whether inflection lines are displayed. + +.. versionadded:: 3.44 %End signals: @@ -280,6 +287,57 @@ Clears the current profile. void setSnappingEnabled( bool enabled ); %Docstring Sets whether snapping of cursor points is enabled. +%End + + void setCrossHairsItemIsDelegate( bool enabled ); +%Docstring +Sets wether the cross hairs item is controlled externally + +.. versionadded:: 3.42 +%End + + bool crossHairsItemIsDelegate(); +%Docstring +Returns wether the cross hairs item is controlled externally + +.. versionadded:: 3.42 +%End + + void setCrossHairsItemPoint( QPoint point ); +%Docstring +Sets the cross hairs item point (if cross hairs items is controlled externally) + +.. seealso:: :py:func:`setCrossHairsItemIsDelegate` + +.. seealso:: :py:func:`crossHairsItemIsDelegate` + +.. versionadded:: 3.42 +%End + + void showCrossHairsItem(); +%Docstring +Show the cross hairs item if cross hairs items is controlled externally) + +.. seealso:: :py:func:`setCrossHairsItemIsDelegate` + +.. seealso:: :py:func:`crossHairsItemIsDelegate` + +.. seealso:: :py:func:`hideCrossHairsItem` + +.. versionadded:: 3.42 +%End + + void hideCrossHairsItem(); +%Docstring +Hide the cross hairs item if cross hairs items is controlled externally) + +.. seealso:: :py:func:`setCrossHairsItemIsDelegate` + +.. seealso:: :py:func:`crossHairsItemIsDelegate` + +.. seealso:: :py:func:`showCrossHairsItem` + +.. versionadded:: 3.42 %End }; diff --git a/python/PyQt6/gui/auto_generated/maptools/qgsmaptoolcapture.sip.in b/python/PyQt6/gui/auto_generated/maptools/qgsmaptoolcapture.sip.in index 70187fc939ef..470255173d7e 100644 --- a/python/PyQt6/gui/auto_generated/maptools/qgsmaptoolcapture.sip.in +++ b/python/PyQt6/gui/auto_generated/maptools/qgsmaptoolcapture.sip.in @@ -222,14 +222,13 @@ Converts a point to map coordinates and layer coordinates int fetchLayerPoint( const QgsPointLocator::Match &match, QgsPoint &layerPoint ); %Docstring -Fetches the original point from the source layer if it has the same -CRS as the current layer. -If topological editing is activated, the points are projected to the -current layer CRS. +Fetches the original point from the source layer. +If topological editing is activated. +The points are projected to the current layer CRS. :return: 0 in case of success - 1 if not applicable (CRS mismatch / invalid layer) + 1 if not applicable (invalid layer) 2 in case of failure %End diff --git a/python/PyQt6/gui/auto_generated/plot/qgsplotrubberband.sip.in b/python/PyQt6/gui/auto_generated/plot/qgsplotrubberband.sip.in index 2e74d7bd951c..570c9402b102 100644 --- a/python/PyQt6/gui/auto_generated/plot/qgsplotrubberband.sip.in +++ b/python/PyQt6/gui/auto_generated/plot/qgsplotrubberband.sip.in @@ -128,6 +128,35 @@ Constructor for QgsPlotRectangularRubberBand. virtual QRectF finish( QPointF position = QPointF(), Qt::KeyboardModifiers modifiers = Qt::KeyboardModifiers() ); +}; + +class QgsPlotPointRubberBand : QgsPlotRubberBand +{ +%Docstring(signature="appended") +:py:class:`QgsPlotPointRubberBand` is a point rubber band for use within :py:class:`QgsPlotCanvas` widgets. + +.. versionadded:: 3.42 +%End + +%TypeHeaderCode +#include "qgsplotrubberband.h" +%End + public: + + QgsPlotPointRubberBand( QgsPlotCanvas *canvas = 0 ); +%Docstring +Constructor for QgsPlotPointRubberBand. +%End + + ~QgsPlotPointRubberBand(); + + virtual void start( QPointF position, Qt::KeyboardModifiers modifiers ); + + virtual void update( QPointF position, Qt::KeyboardModifiers modifiers ); + + virtual QRectF finish( QPointF position = QPointF(), Qt::KeyboardModifiers modifiers = Qt::KeyboardModifiers() ); + + }; /************************************************************************ diff --git a/python/PyQt6/gui/class_map.yaml b/python/PyQt6/gui/class_map.yaml index 36159cfac9fb..ae44d8f23fae 100644 --- a/python/PyQt6/gui/class_map.yaml +++ b/python/PyQt6/gui/class_map.yaml @@ -1022,28 +1022,29 @@ QgsAuthServersEditor.QgsAuthServersEditor: src/gui/auth/qgsauthserverseditor.h#L QgsAuthServersEditor.showEvent: src/gui/auth/qgsauthserverseditor.h#L69 QgsAuthServersEditor: src/gui/auth/qgsauthserverseditor.h#L33 QgsAuthSettingsWidget.QgsAuthSettingsWidget: src/gui/auth/qgsauthsettingswidget.h#L63 -QgsAuthSettingsWidget.btnConvertToEncryptedIsEnabled: src/gui/auth/qgsauthsettingswidget.h#L137 -QgsAuthSettingsWidget.configId: src/gui/auth/qgsauthsettingswidget.h#L106 -QgsAuthSettingsWidget.configIdChanged: src/gui/auth/qgsauthsettingswidget.h#L211 -QgsAuthSettingsWidget.configurationTabIsSelected: src/gui/auth/qgsauthsettingswidget.h#L178 -QgsAuthSettingsWidget.convertToEncrypted: src/gui/auth/qgsauthsettingswidget.h#L188 -QgsAuthSettingsWidget.dataprovider: src/gui/auth/qgsauthsettingswidget.h#L124 -QgsAuthSettingsWidget.formattedWarning: src/gui/auth/qgsauthsettingswidget.h#L131 -QgsAuthSettingsWidget.password: src/gui/auth/qgsauthsettingswidget.h#L94 -QgsAuthSettingsWidget.passwordChanged: src/gui/auth/qgsauthsettingswidget.h#L204 -QgsAuthSettingsWidget.setBasicText: src/gui/auth/qgsauthsettingswidget.h#L76 -QgsAuthSettingsWidget.setConfigId: src/gui/auth/qgsauthsettingswidget.h#L112 -QgsAuthSettingsWidget.setDataprovider: src/gui/auth/qgsauthsettingswidget.h#L118 -QgsAuthSettingsWidget.setPassword: src/gui/auth/qgsauthsettingswidget.h#L100 -QgsAuthSettingsWidget.setStorePasswordChecked: src/gui/auth/qgsauthsettingswidget.h#L160 -QgsAuthSettingsWidget.setStoreUsernameChecked: src/gui/auth/qgsauthsettingswidget.h#L153 -QgsAuthSettingsWidget.setUsername: src/gui/auth/qgsauthsettingswidget.h#L88 -QgsAuthSettingsWidget.setWarningText: src/gui/auth/qgsauthsettingswidget.h#L70 -QgsAuthSettingsWidget.showStoreCheckboxes: src/gui/auth/qgsauthsettingswidget.h#L146 -QgsAuthSettingsWidget.storePasswordIsChecked: src/gui/auth/qgsauthsettingswidget.h#L166 -QgsAuthSettingsWidget.storeUsernameIsChecked: src/gui/auth/qgsauthsettingswidget.h#L172 -QgsAuthSettingsWidget.username: src/gui/auth/qgsauthsettingswidget.h#L82 -QgsAuthSettingsWidget.usernameChanged: src/gui/auth/qgsauthsettingswidget.h#L197 +QgsAuthSettingsWidget.btnConvertToEncryptedIsEnabled: src/gui/auth/qgsauthsettingswidget.h#L144 +QgsAuthSettingsWidget.configId: src/gui/auth/qgsauthsettingswidget.h#L113 +QgsAuthSettingsWidget.configIdChanged: src/gui/auth/qgsauthsettingswidget.h#L218 +QgsAuthSettingsWidget.configurationTabIsSelected: src/gui/auth/qgsauthsettingswidget.h#L185 +QgsAuthSettingsWidget.convertToEncrypted: src/gui/auth/qgsauthsettingswidget.h#L195 +QgsAuthSettingsWidget.dataprovider: src/gui/auth/qgsauthsettingswidget.h#L131 +QgsAuthSettingsWidget.formattedWarning: src/gui/auth/qgsauthsettingswidget.h#L138 +QgsAuthSettingsWidget.password: src/gui/auth/qgsauthsettingswidget.h#L101 +QgsAuthSettingsWidget.passwordChanged: src/gui/auth/qgsauthsettingswidget.h#L211 +QgsAuthSettingsWidget.removeBasicSettings: src/gui/auth/qgsauthsettingswidget.h#L70 +QgsAuthSettingsWidget.setBasicText: src/gui/auth/qgsauthsettingswidget.h#L83 +QgsAuthSettingsWidget.setConfigId: src/gui/auth/qgsauthsettingswidget.h#L119 +QgsAuthSettingsWidget.setDataprovider: src/gui/auth/qgsauthsettingswidget.h#L125 +QgsAuthSettingsWidget.setPassword: src/gui/auth/qgsauthsettingswidget.h#L107 +QgsAuthSettingsWidget.setStorePasswordChecked: src/gui/auth/qgsauthsettingswidget.h#L167 +QgsAuthSettingsWidget.setStoreUsernameChecked: src/gui/auth/qgsauthsettingswidget.h#L160 +QgsAuthSettingsWidget.setUsername: src/gui/auth/qgsauthsettingswidget.h#L95 +QgsAuthSettingsWidget.setWarningText: src/gui/auth/qgsauthsettingswidget.h#L77 +QgsAuthSettingsWidget.showStoreCheckboxes: src/gui/auth/qgsauthsettingswidget.h#L153 +QgsAuthSettingsWidget.storePasswordIsChecked: src/gui/auth/qgsauthsettingswidget.h#L173 +QgsAuthSettingsWidget.storeUsernameIsChecked: src/gui/auth/qgsauthsettingswidget.h#L179 +QgsAuthSettingsWidget.username: src/gui/auth/qgsauthsettingswidget.h#L89 +QgsAuthSettingsWidget.usernameChanged: src/gui/auth/qgsauthsettingswidget.h#L204 QgsAuthSettingsWidget: src/gui/auth/qgsauthsettingswidget.h#L35 QgsAuthSslConfigDialog.QgsAuthSslConfigDialog: src/gui/auth/qgsauthsslconfigwidget.h#L198 QgsAuthSslConfigDialog.accept: src/gui/auth/qgsauthsslconfigwidget.h#L204 @@ -3565,7 +3566,7 @@ QgsLayerMetadataSearchWidget.addButtonClicked: src/gui/qgslayermetadatasearchwid QgsLayerMetadataSearchWidget.refresh: src/gui/qgslayermetadatasearchwidget.h#L52 QgsLayerMetadataSearchWidget.reset: src/gui/qgslayermetadatasearchwidget.h#L54 QgsLayerMetadataSearchWidget.setMapCanvas: src/gui/qgslayermetadatasearchwidget.h#L45 -QgsLayerMetadataSearchWidget.showEvent: src/gui/qgslayermetadatasearchwidget.h#L66 +QgsLayerMetadataSearchWidget.showEvent: src/gui/qgslayermetadatasearchwidget.h#L67 QgsLayerMetadataSearchWidget.updateExtentFilter: src/gui/qgslayermetadatasearchwidget.h#L50 QgsLayerMetadataSearchWidget: src/gui/qgslayermetadatasearchwidget.h#L36 QgsLayerPropertiesDialog.addPropertiesPageFactory: src/gui/qgslayerpropertiesdialog.h#L81 @@ -4555,42 +4556,42 @@ QgsMapToolAdvancedDigitizing.useSnappingIndicator: src/gui/maptools/qgsmaptoolad QgsMapToolAdvancedDigitizing: src/gui/maptools/qgsmaptooladvanceddigitizing.h#L38 QgsMapToolCapture.activate: src/gui/maptools/qgsmaptoolcapture.h#L108 QgsMapToolCapture.addCurve: src/gui/maptools/qgsmaptoolcapture.h#L119 -QgsMapToolCapture.addVertex: src/gui/maptools/qgsmaptoolcapture.h#L259 -QgsMapToolCapture.addVertex: src/gui/maptools/qgsmaptoolcapture.h#L266 +QgsMapToolCapture.addVertex: src/gui/maptools/qgsmaptoolcapture.h#L258 +QgsMapToolCapture.addVertex: src/gui/maptools/qgsmaptoolcapture.h#L265 QgsMapToolCapture.cadCanvasMoveEvent: src/gui/maptools/qgsmaptoolcapture.h#L140 QgsMapToolCapture.cadCanvasReleaseEvent: src/gui/maptools/qgsmaptoolcapture.h#L141 QgsMapToolCapture.capabilities: src/gui/maptools/qgsmaptoolcapture.h#L80 QgsMapToolCapture.captureCurve: src/gui/maptools/qgsmaptoolcapture.h#L132 QgsMapToolCapture.clean: src/gui/maptools/qgsmaptoolcapture.h#L155 QgsMapToolCapture.clearCurve: src/gui/maptools/qgsmaptoolcapture.h#L125 -QgsMapToolCapture.closePolygon: src/gui/maptools/qgsmaptoolcapture.h#L330 +QgsMapToolCapture.closePolygon: src/gui/maptools/qgsmaptoolcapture.h#L329 QgsMapToolCapture.currentCaptureTechnique: src/gui/maptools/qgsmaptoolcapture.h#L99 QgsMapToolCapture.deactivate: src/gui/maptools/qgsmaptoolcapture.h#L109 QgsMapToolCapture.deleteTempRubberBand: src/gui/maptools/qgsmaptoolcapture.h#L152 -QgsMapToolCapture.fetchLayerPoint: src/gui/maptools/qgsmaptoolcapture.h#L253 -QgsMapToolCapture.geometryCaptured: src/gui/maptools/qgsmaptoolcapture.h#L345 -QgsMapToolCapture.isCapturing: src/gui/maptools/qgsmaptoolcapture.h#L286 +QgsMapToolCapture.fetchLayerPoint: src/gui/maptools/qgsmaptoolcapture.h#L252 +QgsMapToolCapture.geometryCaptured: src/gui/maptools/qgsmaptoolcapture.h#L344 +QgsMapToolCapture.isCapturing: src/gui/maptools/qgsmaptoolcapture.h#L285 QgsMapToolCapture.keyPressEvent: src/gui/maptools/qgsmaptoolcapture.h#L147 -QgsMapToolCapture.lineCaptured: src/gui/maptools/qgsmaptoolcapture.h#L359 +QgsMapToolCapture.lineCaptured: src/gui/maptools/qgsmaptoolcapture.h#L358 QgsMapToolCapture.mapPoint: src/gui/maptools/qgsmaptoolcapture.h#L177 QgsMapToolCapture.mapPoint: src/gui/maptools/qgsmaptoolcapture.h#L188 QgsMapToolCapture.mode: src/gui/maptools/qgsmaptoolcapture.h#L116 QgsMapToolCapture.nextPoint: src/gui/maptools/qgsmaptoolcapture.h#L225 QgsMapToolCapture.nextPoint: src/gui/maptools/qgsmaptoolcapture.h#L239 -QgsMapToolCapture.pointCaptured: src/gui/maptools/qgsmaptoolcapture.h#L352 -QgsMapToolCapture.pointsZM: src/gui/maptools/qgsmaptoolcapture.h#L309 -QgsMapToolCapture.polygonCaptured: src/gui/maptools/qgsmaptoolcapture.h#L366 +QgsMapToolCapture.pointCaptured: src/gui/maptools/qgsmaptoolcapture.h#L351 +QgsMapToolCapture.pointsZM: src/gui/maptools/qgsmaptoolcapture.h#L308 +QgsMapToolCapture.polygonCaptured: src/gui/maptools/qgsmaptoolcapture.h#L365 QgsMapToolCapture.setCircularDigitizingEnabled: src/gui/maptools/qgsmaptoolcapture.h#L198 QgsMapToolCapture.setCurrentCaptureTechnique: src/gui/maptools/qgsmaptoolcapture.h#L93 -QgsMapToolCapture.setPoints: src/gui/maptools/qgsmaptoolcapture.h#L317 -QgsMapToolCapture.setPoints: src/gui/maptools/qgsmaptoolcapture.h#L325 +QgsMapToolCapture.setPoints: src/gui/maptools/qgsmaptoolcapture.h#L316 +QgsMapToolCapture.setPoints: src/gui/maptools/qgsmaptoolcapture.h#L324 QgsMapToolCapture.setStreamDigitizingEnabled: src/gui/maptools/qgsmaptoolcapture.h#L205 -QgsMapToolCapture.size: src/gui/maptools/qgsmaptoolcapture.h#L293 -QgsMapToolCapture.startCapturing: src/gui/maptools/qgsmaptoolcapture.h#L279 -QgsMapToolCapture.stopCapturing: src/gui/maptools/qgsmaptoolcapture.h#L337 +QgsMapToolCapture.size: src/gui/maptools/qgsmaptoolcapture.h#L292 +QgsMapToolCapture.startCapturing: src/gui/maptools/qgsmaptoolcapture.h#L278 +QgsMapToolCapture.stopCapturing: src/gui/maptools/qgsmaptoolcapture.h#L336 QgsMapToolCapture.supportsTechnique: src/gui/maptools/qgsmaptoolcapture.h#L87 QgsMapToolCapture.takeRubberBand: src/gui/maptools/qgsmaptoolcapture.h#L165 -QgsMapToolCapture.undo: src/gui/maptools/qgsmaptoolcapture.h#L274 +QgsMapToolCapture.undo: src/gui/maptools/qgsmaptoolcapture.h#L273 QgsMapToolCapture: src/gui/maptools/qgsmaptoolcapture.h#L48 QgsMapToolCaptureLayerGeometry.layerGeometryCaptured: src/gui/maptools/qgsmaptoolcapturelayergeometry.h#L46 QgsMapToolCaptureLayerGeometry.layerLineCaptured: src/gui/maptools/qgsmaptoolcapturelayergeometry.h#L58 diff --git a/python/PyQt6/server/auto_generated/qgsserverparameters.sip.in b/python/PyQt6/server/auto_generated/qgsserverparameters.sip.in index 973004e5bfe8..fc32f831f0a2 100644 --- a/python/PyQt6/server/auto_generated/qgsserverparameters.sip.in +++ b/python/PyQt6/server/auto_generated/qgsserverparameters.sip.in @@ -70,42 +70,46 @@ Converts the parameter into a list of strings :return: A list of strings %End - QList toIntList( bool &ok, char delimiter = ',' ) const; + QList toIntList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const; %Docstring Converts the parameter into a list of integers. :param ok: ``True`` if there's no error during the conversion, ``False`` otherwise :param delimiter: The character used for delimiting +:param skipEmptyParts: for splitting :return: A list of integers %End - QList toDoubleList( bool &ok, char delimiter = ',' ) const; + QList toDoubleList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const; %Docstring Converts the parameter into a list of doubles. :param ok: ``True`` if there's no error during the conversion, ``False`` otherwise :param delimiter: The character used for delimiting +:param skipEmptyParts: for splitting :return: A list of doubles %End - QList toColorList( bool &ok, char delimiter = ',' ) const; + QList toColorList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const; %Docstring Converts the parameter into a list of colors. :param ok: ``True`` if there's no error during the conversion, ``False`` otherwise :param delimiter: The character used for delimiting +:param skipEmptyParts: for splitting :return: A list of colors %End - QList toGeomList( bool &ok, char delimiter = ',' ) const; + QList toGeomList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const; %Docstring Converts the parameter into a list of geometries. :param ok: ``True`` if there's no error during the conversion, ``False`` otherwise :param delimiter: The character used for delimiting +:param skipEmptyParts: for splitting :return: A list of geometries %End diff --git a/python/PyQt6/server/class_map.yaml b/python/PyQt6/server/class_map.yaml index f05c7ccdfd29..60ea87ccb1e5 100644 --- a/python/PyQt6/server/class_map.yaml +++ b/python/PyQt6/server/class_map.yaml @@ -217,39 +217,39 @@ QgsServerOgcApiHandler.templatePath: src/server/qgsserverogcapihandler.h#L332 QgsServerOgcApiHandler.values: src/server/qgsserverogcapihandler.h#L191 QgsServerOgcApiHandler.write: src/server/qgsserverogcapihandler.h#L313 QgsServerOgcApiHandler: src/server/qgsserverogcapihandler.h#L94 -QgsServerParameter.name: src/server/qgsserverparameters.h#L236 -QgsServerParameter.name: src/server/qgsserverparameters.h#L242 -QgsServerParameter.raiseError: src/server/qgsserverparameters.h#L231 -QgsServerParameter: src/server/qgsserverparameters.h#L193 +QgsServerParameter.name: src/server/qgsserverparameters.h#L240 +QgsServerParameter.name: src/server/qgsserverparameters.h#L246 +QgsServerParameter.raiseError: src/server/qgsserverparameters.h#L235 +QgsServerParameter: src/server/qgsserverparameters.h#L197 QgsServerParameterDefinition.isValid: src/server/qgsserverparameters.h#L63 -QgsServerParameterDefinition.loadUrl: src/server/qgsserverparameters.h#L173 -QgsServerParameterDefinition.raiseError: src/server/qgsserverparameters.h#L180 -QgsServerParameterDefinition.toBool: src/server/qgsserverparameters.h#L150 -QgsServerParameterDefinition.toColor: src/server/qgsserverparameters.h#L157 -QgsServerParameterDefinition.toDouble: src/server/qgsserverparameters.h#L144 -QgsServerParameterDefinition.toExpressionList: src/server/qgsserverparameters.h#L123 -QgsServerParameterDefinition.toInt: src/server/qgsserverparameters.h#L137 -QgsServerParameterDefinition.toOgcFilterList: src/server/qgsserverparameters.h#L116 -QgsServerParameterDefinition.toRectangle: src/server/qgsserverparameters.h#L130 +QgsServerParameterDefinition.loadUrl: src/server/qgsserverparameters.h#L177 +QgsServerParameterDefinition.raiseError: src/server/qgsserverparameters.h#L184 +QgsServerParameterDefinition.toBool: src/server/qgsserverparameters.h#L154 +QgsServerParameterDefinition.toColor: src/server/qgsserverparameters.h#L161 +QgsServerParameterDefinition.toDouble: src/server/qgsserverparameters.h#L148 +QgsServerParameterDefinition.toExpressionList: src/server/qgsserverparameters.h#L127 +QgsServerParameterDefinition.toInt: src/server/qgsserverparameters.h#L141 +QgsServerParameterDefinition.toOgcFilterList: src/server/qgsserverparameters.h#L120 +QgsServerParameterDefinition.toRectangle: src/server/qgsserverparameters.h#L134 QgsServerParameterDefinition.toString: src/server/qgsserverparameters.h#L69 QgsServerParameterDefinition.toStringList: src/server/qgsserverparameters.h#L77 -QgsServerParameterDefinition.toUrl: src/server/qgsserverparameters.h#L165 +QgsServerParameterDefinition.toUrl: src/server/qgsserverparameters.h#L169 QgsServerParameterDefinition.typeName: src/server/qgsserverparameters.h#L58 QgsServerParameterDefinition: src/server/qgsserverparameters.h#L34 -QgsServerParameters.add: src/server/qgsserverparameters.h#L286 -QgsServerParameters.clear: src/server/qgsserverparameters.h#L279 -QgsServerParameters.fileName: src/server/qgsserverparameters.h#L343 -QgsServerParameters.load: src/server/qgsserverparameters.h#L274 -QgsServerParameters.loadParameter: src/server/qgsserverparameters.h#L357 -QgsServerParameters.map: src/server/qgsserverparameters.h#L336 -QgsServerParameters.remove: src/server/qgsserverparameters.h#L292 -QgsServerParameters.remove: src/server/qgsserverparameters.h#L299 -QgsServerParameters.request: src/server/qgsserverparameters.h#L329 -QgsServerParameters.service: src/server/qgsserverparameters.h#L322 -QgsServerParameters.urlQuery: src/server/qgsserverparameters.h#L310 -QgsServerParameters.value: src/server/qgsserverparameters.h#L305 -QgsServerParameters.version: src/server/qgsserverparameters.h#L350 -QgsServerParameters: src/server/qgsserverparameters.h#L253 +QgsServerParameters.add: src/server/qgsserverparameters.h#L290 +QgsServerParameters.clear: src/server/qgsserverparameters.h#L283 +QgsServerParameters.fileName: src/server/qgsserverparameters.h#L347 +QgsServerParameters.load: src/server/qgsserverparameters.h#L278 +QgsServerParameters.loadParameter: src/server/qgsserverparameters.h#L361 +QgsServerParameters.map: src/server/qgsserverparameters.h#L340 +QgsServerParameters.remove: src/server/qgsserverparameters.h#L296 +QgsServerParameters.remove: src/server/qgsserverparameters.h#L303 +QgsServerParameters.request: src/server/qgsserverparameters.h#L333 +QgsServerParameters.service: src/server/qgsserverparameters.h#L326 +QgsServerParameters.urlQuery: src/server/qgsserverparameters.h#L314 +QgsServerParameters.value: src/server/qgsserverparameters.h#L309 +QgsServerParameters.version: src/server/qgsserverparameters.h#L354 +QgsServerParameters: src/server/qgsserverparameters.h#L257 QgsServerQueryStringParameter.description: src/server/qgsserverquerystringparameter.h#L120 QgsServerQueryStringParameter.hidden: src/server/qgsserverquerystringparameter.h#L145 QgsServerQueryStringParameter.name: src/server/qgsserverquerystringparameter.h#L130 diff --git a/python/analysis/auto_generated/raster/qgsrastercalculator.sip.in b/python/analysis/auto_generated/raster/qgsrastercalculator.sip.in index 2caddfecc613..95338847590f 100644 --- a/python/analysis/auto_generated/raster/qgsrastercalculator.sip.in +++ b/python/analysis/auto_generated/raster/qgsrastercalculator.sip.in @@ -63,14 +63,15 @@ Performs raster layer calculations. }; - QgsRasterCalculator( const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, int nOutputColumns, int nOutputRows, const QVector &rasterEntries, const QgsCoordinateTransformContext &transformContext ); + QgsRasterCalculator( const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, const QgsCoordinateReferenceSystem &outputCrs, int nOutputColumns, int nOutputRows, const QVector &rasterEntries, const QgsCoordinateTransformContext &transformContext ); %Docstring QgsRasterCalculator constructor. :param formulaString: formula for raster calculation :param outputFile: output file path :param outputFormat: output file format -:param outputExtent: output extent. CRS for output is taken from first entry in rasterEntries. +:param outputExtent: output extent, CRS is specified by outputCrs parameter +:param outputCrs: destination CRS for output raster :param nOutputColumns: number of columns in output raster :param nOutputRows: number of rows in output raster :param rasterEntries: list of referenced raster layers @@ -79,15 +80,14 @@ QgsRasterCalculator constructor. .. versionadded:: 3.8 %End - QgsRasterCalculator( const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, const QgsCoordinateReferenceSystem &outputCrs, int nOutputColumns, int nOutputRows, const QVector &rasterEntries, const QgsCoordinateTransformContext &transformContext ); + QgsRasterCalculator( const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, int nOutputColumns, int nOutputRows, const QVector &rasterEntries, const QgsCoordinateTransformContext &transformContext ); %Docstring QgsRasterCalculator constructor. :param formulaString: formula for raster calculation :param outputFile: output file path :param outputFormat: output file format -:param outputExtent: output extent, CRS is specified by outputCrs parameter -:param outputCrs: destination CRS for output raster +:param outputExtent: output extent. CRS for output is taken from first entry in rasterEntries. :param nOutputColumns: number of columns in output raster :param nOutputRows: number of rows in output raster :param rasterEntries: list of referenced raster layers @@ -96,15 +96,15 @@ QgsRasterCalculator constructor. .. versionadded:: 3.8 %End - - QgsRasterCalculator( const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, int nOutputColumns, int nOutputRows, const QVector &rasterEntries ) /Deprecated="Since 3.8. Use the version with transformContext instead."/; + QgsRasterCalculator( const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, const QgsCoordinateReferenceSystem &outputCrs, int nOutputColumns, int nOutputRows, const QVector &rasterEntries ) /Deprecated="Since 3.8. Use the version with transformContext instead."/; %Docstring QgsRasterCalculator constructor. :param formulaString: formula for raster calculation :param outputFile: output file path :param outputFormat: output file format -:param outputExtent: output extent. CRS for output is taken from first entry in rasterEntries. +:param outputExtent: output extent, CRS is specified by outputCrs parameter +:param outputCrs: destination CRS for output raster :param nOutputColumns: number of columns in output raster :param nOutputRows: number of rows in output raster :param rasterEntries: list of referenced raster layers @@ -114,15 +114,14 @@ QgsRasterCalculator constructor. Use the version with transformContext instead. %End - QgsRasterCalculator( const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, const QgsCoordinateReferenceSystem &outputCrs, int nOutputColumns, int nOutputRows, const QVector &rasterEntries ) /Deprecated="Since 3.8. Use the version with transformContext instead."/; + QgsRasterCalculator( const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, int nOutputColumns, int nOutputRows, const QVector &rasterEntries ) /Deprecated="Since 3.8. Use the version with transformContext instead."/; %Docstring QgsRasterCalculator constructor. :param formulaString: formula for raster calculation :param outputFile: output file path :param outputFormat: output file format -:param outputExtent: output extent, CRS is specified by outputCrs parameter -:param outputCrs: destination CRS for output raster +:param outputExtent: output extent. CRS for output is taken from first entry in rasterEntries. :param nOutputColumns: number of columns in output raster :param nOutputRows: number of rows in output raster :param rasterEntries: list of referenced raster layers diff --git a/python/analysis/class_map.yaml b/python/analysis/class_map.yaml index a916853fc0ba..0aacf66aafd6 100644 --- a/python/analysis/class_map.yaml +++ b/python/analysis/class_map.yaml @@ -289,8 +289,8 @@ QgsRasterCalcNode.setRight: src/analysis/raster/qgsrastercalcnode.h#L108 QgsRasterCalcNode.toString: src/analysis/raster/qgsrastercalcnode.h#L125 QgsRasterCalcNode.type: src/analysis/raster/qgsrastercalcnode.h#L96 QgsRasterCalcNode: src/analysis/raster/qgsrastercalcnode.h#L38 -QgsRasterCalculator.lastError: src/analysis/raster/qgsrastercalculator.h#L162 -QgsRasterCalculator.processCalculation: src/analysis/raster/qgsrastercalculator.h#L156 +QgsRasterCalculator.lastError: src/analysis/raster/qgsrastercalculator.h#L161 +QgsRasterCalculator.processCalculation: src/analysis/raster/qgsrastercalculator.h#L155 QgsRasterCalculator: src/analysis/raster/qgsrastercalculator.h#L74 QgsRasterCalculatorEntry: src/analysis/raster/qgsrastercalculator.h#L39 QgsRasterMatrix.absoluteValue: src/analysis/raster/qgsrastermatrix.h#L147 diff --git a/python/console/console.py b/python/console/console.py index ba15c4460f1a..3e495bc66ce3 100644 --- a/python/console/console.py +++ b/python/console/console.py @@ -46,7 +46,7 @@ QApplication, QShortcut, ) -from qgis.PyQt.QtGui import QDesktopServices, QKeySequence +from qgis.PyQt.QtGui import QDesktopServices, QKeySequence, QColor, QPalette from qgis.PyQt.QtWidgets import QVBoxLayout, QMessageBox from qgis.utils import iface from .console_sci import ShellScintilla @@ -320,7 +320,10 @@ def __init__(self, parent=None): self.toggleCommentEditorButton.setCheckable(False) self.toggleCommentEditorButton.setEnabled(True) self.toggleCommentEditorButton.setIcon( - QgsApplication.getThemeIcon("console/iconCommentEditorConsole.svg") + QgsApplication.getThemeIcon( + "console/iconCommentEditorConsole.svg", + self.palette().color(QPalette.ColorRole.WindowText), + ), ) self.toggleCommentEditorButton.setMenuRole(QAction.MenuRole.PreferencesRole) self.toggleCommentEditorButton.setIconVisibleInMenu(True) diff --git a/python/console/console_editor.py b/python/console/console_editor.py index c7e868372c52..9503f6f92e2c 100644 --- a/python/console/console_editor.py +++ b/python/console/console_editor.py @@ -48,7 +48,7 @@ Qt, QUrl, ) -from qgis.PyQt.QtGui import QKeySequence +from qgis.PyQt.QtGui import QKeySequence, QColor, QPalette from qgis.PyQt.QtNetwork import QNetworkRequest from qgis.PyQt.QtWidgets import ( QAction, @@ -261,7 +261,10 @@ def contextMenuEvent(self, e): menu.addSeparator() toggle_comment_action = QAction( - QgsApplication.getThemeIcon("console/iconCommentEditorConsole.svg"), + QgsApplication.getThemeIcon( + "console/iconCommentEditorConsole.svg", + self.palette().color(QPalette.ColorRole.WindowText), + ), QCoreApplication.translate("PythonConsole", "Toggle Comment"), menu, ) diff --git a/python/core/__init__.py.in b/python/core/__init__.py.in index 3e0c9045d231..3a2be42fff18 100644 --- a/python/core/__init__.py.in +++ b/python/core/__init__.py.in @@ -579,11 +579,15 @@ try: raise ValueError(f"The raster block data type '{str(self.dataType())}' is not compatible with NumPy arrays.") src_array = _numpy.frombuffer(self.data(), dtype=raster_dtype) src_array = src_array.reshape((self.height(), self.width())) - if not self.hasNoDataValue() or not use_masking: - return src_array - else: - no_data_value = self.noDataValue() if isinstance(self.noDataValue(), raster_dtype) else 0 + if use_masking: + if not self.hasNoDataValue(): + # Default to 0 as noDataValue if none is set + no_data_value = 0 + else: + no_data_value = self.noDataValue() return _numpy.ma.masked_equal(src_array, no_data_value) + else: + return src_array QgsRasterBlock.as_numpy = _raster_block_as_numpy @@ -596,7 +600,10 @@ try: src_array = block.as_numpy(use_masking=use_masking) arrays.append(src_array) - return _numpy.array(arrays) # This converts any maskedArrays to numpy.array + if use_masking: + return _numpy.ma.stack(arrays, axis=0) + else: + return _numpy.array(arrays) QgsRasterLayer.as_numpy = _raster_layer_as_numpy diff --git a/python/core/auto_additions/qgis.py b/python/core/auto_additions/qgis.py index 0f9f1168ba09..a45fb29ec11d 100644 --- a/python/core/auto_additions/qgis.py +++ b/python/core/auto_additions/qgis.py @@ -2521,6 +2521,21 @@ # -- Qgis.FileFilterType.baseClass = Qgis # monkey patching scoped based enum +Qgis.UriCleaningFlag.RemoveCredentials.__doc__ = "Completely remove credentials (eg passwords) from the URI. This flag is not compatible with the RedactCredentials flag." +Qgis.UriCleaningFlag.RedactCredentials.__doc__ = "Replace the value of credentials (eg passwords) with 'xxxxxxxx'. This flag is not compatible with the RemoveCredentials flag." +Qgis.UriCleaningFlag.__doc__ = """Flags for cleaning layer URIs. + +.. versionadded:: 3.42 + +* ``RemoveCredentials``: Completely remove credentials (eg passwords) from the URI. This flag is not compatible with the RedactCredentials flag. +* ``RedactCredentials``: Replace the value of credentials (eg passwords) with 'xxxxxxxx'. This flag is not compatible with the RemoveCredentials flag. + +""" +# -- +Qgis.UriCleaningFlag.baseClass = Qgis +Qgis.UriCleaningFlags.baseClass = Qgis +UriCleaningFlags = Qgis # dirty hack since SIP seems to introduce the flags in module +# monkey patching scoped based enum Qgis.SublayerQueryFlag.FastScan.__doc__ = "Indicates that the provider must scan for sublayers using the fastest possible approach -- e.g. by first checking that a uri has an extension which is known to be readable by the provider" Qgis.SublayerQueryFlag.ResolveGeometryType.__doc__ = "Attempt to resolve the geometry type for vector sublayers" Qgis.SublayerQueryFlag.CountFeatures.__doc__ = "Count features in vector sublayers" diff --git a/python/core/auto_additions/qgsabstractcontentcache.py b/python/core/auto_additions/qgsabstractcontentcache.py index bf5b43ab27ff..bcc41b6ff594 100644 --- a/python/core/auto_additions/qgsabstractcontentcache.py +++ b/python/core/auto_additions/qgsabstractcontentcache.py @@ -6,6 +6,7 @@ try: QgsAbstractContentCacheBase.__attribute_docs__ = {'remoteContentFetched': 'Emitted when the cache has finished retrieving content from a remote ``url``.\n'} QgsAbstractContentCacheBase.parseBase64DataUrl = staticmethod(QgsAbstractContentCacheBase.parseBase64DataUrl) + QgsAbstractContentCacheBase.parseEmbeddedStringData = staticmethod(QgsAbstractContentCacheBase.parseEmbeddedStringData) QgsAbstractContentCacheBase.isBase64Data = staticmethod(QgsAbstractContentCacheBase.isBase64Data) QgsAbstractContentCacheBase.__signal_arguments__ = {'remoteContentFetched': ['url: str']} except (NameError, AttributeError): diff --git a/python/core/auto_additions/qgsauthmanager.py b/python/core/auto_additions/qgsauthmanager.py index 431aee78d187..3aa1626756e0 100644 --- a/python/core/auto_additions/qgsauthmanager.py +++ b/python/core/auto_additions/qgsauthmanager.py @@ -1,10 +1,11 @@ # The following has been generated automatically from src/core/auth/qgsauthmanager.h QgsAuthManager.MessageLevel.baseClass = QgsAuthManager try: - QgsAuthManager.__attribute_docs__ = {'AUTH_PASSWORD_HELPER_DISPLAY_NAME': 'The display name of the password helper (platform dependent)', 'AUTH_MAN_TAG': 'The display name of the Authentication Manager', 'passwordHelperFailure': 'Signals emitted on password helper failure,\nmainly used in the tests to exit main application loop\n', 'passwordHelperSuccess': 'Signals emitted on password helper success,\nmainly used in the tests to exit main application loop\n', 'messageOut': 'Custom logging signal to relay to console output and :py:class:`QgsMessageLog`\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. deprecated:: 3.40\n\n Use :py:func:`~QgsAuthManager.messageLog` instead.\n', 'messageLog': 'Custom logging signal to relay to console output and :py:class:`QgsMessageLog`\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. versionadded:: 3.40\n', 'passwordHelperMessageOut': 'Custom logging signal to inform the user about master password <-> password manager interactions\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. deprecated:: 3.40\n\n Use :py:func:`~QgsAuthManager.passwordHelperMessageLog` instead.\n', 'passwordHelperMessageLog': 'Custom logging signal to inform the user about master password <-> password manager interactions\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. versionadded:: 3.40\n', 'masterPasswordVerified': "Emitted when a password has been verify (or not)\n\n:param verified: The state of password's verification\n", 'authDatabaseEraseRequested': 'Emitted when a user has indicated they may want to erase the authentication db.\n', 'authDatabaseChanged': 'Emitted when the authentication db is significantly changed, e.g. large record removal, erased, etc.\n'} + QgsAuthManager.__attribute_docs__ = {'AUTH_PASSWORD_HELPER_DISPLAY_NAME': 'The display name of the password helper (platform dependent).\n\nThis is deprecated, use :py:func:`~QgsAuthManager.passwordHelperDisplayName` instead.', 'AUTH_MAN_TAG': 'The display name of the Authentication Manager', 'passwordHelperFailure': 'Signals emitted on password helper failure,\nmainly used in the tests to exit main application loop\n', 'passwordHelperSuccess': 'Signals emitted on password helper success,\nmainly used in the tests to exit main application loop\n', 'messageOut': 'Custom logging signal to relay to console output and :py:class:`QgsMessageLog`\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. deprecated:: 3.40\n\n Use :py:func:`~QgsAuthManager.messageLog` instead.\n', 'messageLog': 'Custom logging signal to relay to console output and :py:class:`QgsMessageLog`\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. versionadded:: 3.40\n', 'passwordHelperMessageOut': 'Custom logging signal to inform the user about master password <-> password manager interactions\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. deprecated:: 3.40\n\n Use :py:func:`~QgsAuthManager.passwordHelperMessageLog` instead.\n', 'passwordHelperMessageLog': 'Custom logging signal to inform the user about master password <-> password manager interactions\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. versionadded:: 3.40\n', 'masterPasswordVerified': "Emitted when a password has been verify (or not)\n\n:param verified: The state of password's verification\n", 'authDatabaseEraseRequested': 'Emitted when a user has indicated they may want to erase the authentication db.\n', 'authDatabaseChanged': 'Emitted when the authentication db is significantly changed, e.g. large record removal, erased, etc.\n'} QgsAuthManager.isFilesystemBasedDatabase = staticmethod(QgsAuthManager.isFilesystemBasedDatabase) QgsAuthManager.hasConfigId = staticmethod(QgsAuthManager.hasConfigId) QgsAuthManager.passwordHelperEnabled = staticmethod(QgsAuthManager.passwordHelperEnabled) + QgsAuthManager.passwordHelperDisplayName = staticmethod(QgsAuthManager.passwordHelperDisplayName) QgsAuthManager.__signal_arguments__ = {'passwordHelperMessageLog': ['message: str', 'tag: str = QgsAuthManager.AUTH_MAN_TAG', 'level: Qgis.MessageLevel = Qgis.MessageLevel.Info'], 'masterPasswordVerified': ['verified: bool']} QgsAuthManager.__group__ = ['auth'] except (NameError, AttributeError): diff --git a/python/core/auto_additions/qgslayoutexporter.py b/python/core/auto_additions/qgslayoutexporter.py index f8be980a23de..bf639acd546e 100644 --- a/python/core/auto_additions/qgslayoutexporter.py +++ b/python/core/auto_additions/qgslayoutexporter.py @@ -12,7 +12,7 @@ except (NameError, AttributeError): pass try: - QgsLayoutExporter.PdfExportSettings.__attribute_docs__ = {'dpi': 'Resolution to export layout at. If dpi <= 0 the default layout dpi will be used.', 'rasterizeWholeImage': 'Set to ``True`` to force whole layout to be rasterized while exporting.\n\nThis option is mutually exclusive with forceVectorOutput.', 'forceVectorOutput': 'Set to ``True`` to force vector object exports, even when the resultant appearance will differ\nfrom the layout. If ``False``, some items may be rasterized in order to maintain their\ncorrect appearance in the output.\n\nThis option is mutually exclusive with rasterizeWholeImage.', 'appendGeoreference': 'Indicates whether PDF export should append georeference data\n\n.. versionadded:: 3.10', 'exportMetadata': "Indicates whether PDF export should include metadata generated\nfrom the layout's project's metadata.\n\n.. versionadded:: 3.2", 'flags': 'Layout context flags, which control how the export will be created.', 'textRenderFormat': 'Text rendering format, which controls how text should be rendered in the export (e.g.\nas paths or real text objects).\n\n.. versionadded:: 3.4.3', 'simplifyGeometries': 'Indicates whether vector geometries should be simplified to avoid redundant extraneous detail,\nsuch as vertices which are not visible at the specified dpi of the output.\n\n.. versionadded:: 3.10', 'writeGeoPdf': '``True`` if geospatial PDF files should be created, instead of normal PDF files.\n\nWhilst geospatial PDF files can include some desirable properties like the ability to interactively\nquery map features, they also can result in lower-quality output files, or forced rasterization\nof layers.\n\n.. note::\n\n Requires builds based on GDAL 3.0 or greater.\n\n.. versionadded:: 3.10', 'exportLayersAsSeperateFiles': '``True`` if individual layers from the layout should be rendered to separate PDF files.\n\nThis option allows for separation of logic layout layers to individual PDF files. For instance,\nif this option is ``True``, then a separate PDF file will be created per layer per map item in the\nlayout. Additionally, separate PDF files may be created for other complex layout items, resulting\nin a set of PDF files which contain logical atomic components of the layout.\n\nThis option is designed to allow the PDF files to be composited back together in an external\napplication (e.g. Adobe Illustrator) as a non-QGIS, post-production step.\n\n.. versionadded:: 3.14', 'useIso32000ExtensionFormatGeoreferencing': '``True`` if ISO3200 extension format georeferencing should be used.\n\nThis is a recommended setting which results in Geospatial PDF files compatible\nwith the built-in Acrobat geospatial tools.\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.', 'useOgcBestPracticeFormatGeoreferencing': '``True`` if OGC "best practice" format georeferencing should be used.\n\n.. warning::\n\n This results in geospatial PDF files compatible with a unnamed suite of tools starting with Terra and ending with Go, but\n can break compatibility with the built-in Acrobat geospatial tools (yes, Geospatial PDF\n format is a mess!).\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.', 'includeGeoPdfFeatures': '``True`` if feature vector information (such as attributes) should be exported during Geospatial PDF exports.\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.', 'exportThemes': "Optional list of map themes to export as Geospatial PDF layer groups.\n\nIf set, map item's which are not assigned a specific map theme will iterate through all listed\nthemes and a Geospatial PDF layer group will be created for each.\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.", 'predefinedMapScales': 'A list of predefined scales to use with the layout. This is used\nfor maps which are set to the predefined atlas scaling mode.\n\n.. versionadded:: 3.10'} + QgsLayoutExporter.PdfExportSettings.__attribute_docs__ = {'dpi': 'Resolution to export layout at. If dpi <= 0 the default layout dpi will be used.', 'rasterizeWholeImage': 'Set to ``True`` to force whole layout to be rasterized while exporting.\n\nThis option is mutually exclusive with forceVectorOutput.', 'forceVectorOutput': 'Set to ``True`` to force vector object exports, even when the resultant appearance will differ\nfrom the layout. If ``False``, some items may be rasterized in order to maintain their\ncorrect appearance in the output.\n\nThis option is mutually exclusive with rasterizeWholeImage.', 'appendGeoreference': 'Indicates whether PDF export should append georeference data\n\n.. versionadded:: 3.10', 'exportMetadata': "Indicates whether PDF export should include metadata generated\nfrom the layout's project's metadata.\n\n.. versionadded:: 3.2", 'flags': 'Layout context flags, which control how the export will be created.', 'textRenderFormat': 'Text rendering format, which controls how text should be rendered in the export (e.g.\nas paths or real text objects).\n\n.. versionadded:: 3.4.3', 'simplifyGeometries': 'Indicates whether vector geometries should be simplified to avoid redundant extraneous detail,\nsuch as vertices which are not visible at the specified dpi of the output.\n\n.. versionadded:: 3.10', 'writeGeoPdf': '``True`` if geospatial PDF files should be created, instead of normal PDF files.\n\nWhilst geospatial PDF files can include some desirable properties like the ability to interactively\nquery map features, they also can result in lower-quality output files, or forced rasterization\nof layers.\n\n.. note::\n\n Requires builds based on GDAL 3.0 or greater.\n\n.. versionadded:: 3.10', 'exportLayersAsSeperateFiles': '``True`` if individual layers from the layout should be rendered to separate PDF files.\n\nThis option allows for separation of logic layout layers to individual PDF files. For instance,\nif this option is ``True``, then a separate PDF file will be created per layer per map item in the\nlayout. Additionally, separate PDF files may be created for other complex layout items, resulting\nin a set of PDF files which contain logical atomic components of the layout.\n\nThis option is designed to allow the PDF files to be composited back together in an external\napplication (e.g. Adobe Illustrator) as a non-QGIS, post-production step.\n\n.. versionadded:: 3.14', 'useIso32000ExtensionFormatGeoreferencing': '``True`` if ISO3200 extension format georeferencing should be used.\n\nThis is a recommended setting which results in Geospatial PDF files compatible\nwith the built-in Acrobat geospatial tools.\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.', 'useOgcBestPracticeFormatGeoreferencing': '``True`` if OGC "best practice" format georeferencing should be used.\n\n.. warning::\n\n This results in geospatial PDF files compatible with a unnamed suite of tools starting with Terra and ending with Go, but\n can break compatibility with the built-in Acrobat geospatial tools (yes, Geospatial PDF\n format is a mess!).\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.\n\n.. deprecated:: 3.42\n\n This parameter has no longer any effect. Only ISO 32000 georeferencing is handled.', 'includeGeoPdfFeatures': '``True`` if feature vector information (such as attributes) should be exported during Geospatial PDF exports.\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.', 'exportThemes': "Optional list of map themes to export as Geospatial PDF layer groups.\n\nIf set, map item's which are not assigned a specific map theme will iterate through all listed\nthemes and a Geospatial PDF layer group will be created for each.\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.", 'predefinedMapScales': 'A list of predefined scales to use with the layout. This is used\nfor maps which are set to the predefined atlas scaling mode.\n\n.. versionadded:: 3.10'} QgsLayoutExporter.PdfExportSettings.__doc__ = """Contains settings relating to exporting layouts to PDF""" QgsLayoutExporter.PdfExportSettings.__group__ = ['layout'] except (NameError, AttributeError): diff --git a/python/core/auto_additions/qgsmimedatautils.py b/python/core/auto_additions/qgsmimedatautils.py index 551f882dfd1b..8a8d3661c499 100644 --- a/python/core/auto_additions/qgsmimedatautils.py +++ b/python/core/auto_additions/qgsmimedatautils.py @@ -1,6 +1,6 @@ # The following has been generated automatically from src/core/qgsmimedatautils.h try: - QgsMimeDataUtils.Uri.__attribute_docs__ = {'layerType': 'Type of URI.\n\nRecognized types include\n\n- "vector": vector layers\n- "raster": raster layers\n- "mesh": mesh layers\n- "pointcloud": point cloud layers\n- "vector-tile": vector tile layers\n- "tiled-scene": tiled scene layers\n- "plugin": plugin layers\n- "custom": custom types\n- "project": QGS/QGZ project file\n- "directory": directory path\n\nMime data from plugins may use additional custom layer types.', 'providerKey': 'For "vector" / "raster" type: provider id.\nFor "plugin" type: plugin layer type name.\nFor "custom" type: key of its :py:class:`QgsCustomDropHandler`\nFor "project" and "directory" types: unused', 'name': 'Human readable name to be used e.g. in layer tree', 'uri': 'Identifier of the data source recognized by its providerKey', 'layerId': 'Layer ID, if uri is associated with a layer from a :py:class:`QgsProject`.\n\n.. versionadded:: 3.8', 'pId': 'Unique ID associated with application instance. Can be used to identify\nif mime data was created inside the current application instance or not.\n\n.. versionadded:: 3.8', 'wkbType': 'WKB type, if associated with a vector layer, or :py:class:`QgsWkbTypes`.Unknown if not\nyet known.\n\n.. versionadded:: 3.8', 'filePath': 'Path to file, if uri is associated with a file.\n\n.. versionadded:: 3.22'} + QgsMimeDataUtils.Uri.__attribute_docs__ = {'layerType': 'Type of URI.\n\nRecognized types include\n\n- "vector": vector layers\n- "raster": raster layers\n- "mesh": mesh layers\n- "point-cloud": point cloud layers (spelled with a dash since QGIS 3.42.0. In prior versions, there was no dash)\n- "vector-tile": vector tile layers\n- "tiled-scene": tiled scene layers\n- "annotation": annotation layers\n- "group": group layers\n- "plugin": plugin layers\n- "custom": custom types\n- "project": QGS/QGZ project file\n- "directory": directory path\n\nNote: use :py:func:`QgsMapLayerFactory.typeToString()` to convert from a\n:py:class:`Qgis`.LayerType to a string (except for "custom", "project" and\n"directory")\n\nMime data from plugins may use additional custom layer types.', 'providerKey': 'For "vector" / "raster" type: provider id.\nFor "plugin" type: plugin layer type name.\nFor "custom" type: key of its :py:class:`QgsCustomDropHandler`\nFor "project" and "directory" types: unused', 'name': 'Human readable name to be used e.g. in layer tree', 'uri': 'Identifier of the data source recognized by its providerKey', 'layerId': 'Layer ID, if uri is associated with a layer from a :py:class:`QgsProject`.\n\n.. versionadded:: 3.8', 'pId': 'Unique ID associated with application instance. Can be used to identify\nif mime data was created inside the current application instance or not.\n\n.. versionadded:: 3.8', 'wkbType': 'WKB type, if associated with a vector layer, or :py:class:`QgsWkbTypes`.Unknown if not\nyet known.\n\n.. versionadded:: 3.8', 'filePath': 'Path to file, if uri is associated with a file.\n\n.. versionadded:: 3.22'} except (NameError, AttributeError): pass try: diff --git a/python/core/auto_additions/qgspointcloudlayer.py b/python/core/auto_additions/qgspointcloudlayer.py index b1931c3c06fd..3305db2e09ad 100644 --- a/python/core/auto_additions/qgspointcloudlayer.py +++ b/python/core/auto_additions/qgspointcloudlayer.py @@ -21,8 +21,8 @@ except (NameError, AttributeError): pass try: - QgsPointCloudLayer.__attribute_docs__ = {'subsetStringChanged': "Emitted when the layer's subset string has changed.\n\n.. versionadded:: 3.26\n", 'raiseError': 'Signals an error related to this point cloud layer.\n\n.. versionadded:: 3.26\n', 'statisticsCalculationStateChanged': 'Emitted when statistics calculation state has changed\n\n.. versionadded:: 3.26\n'} - QgsPointCloudLayer.__signal_arguments__ = {'raiseError': ['msg: str'], 'statisticsCalculationStateChanged': ['state: QgsPointCloudLayer.PointCloudStatisticsCalculationState']} + QgsPointCloudLayer.__attribute_docs__ = {'subsetStringChanged': "Emitted when the layer's subset string has changed.\n\n.. versionadded:: 3.26\n", 'raiseError': 'Signals an error related to this point cloud layer.\n\n.. versionadded:: 3.26\n', 'statisticsCalculationStateChanged': 'Emitted when statistics calculation state has changed\n\n.. versionadded:: 3.26\n', 'chunkAttributeValuesChanged': 'Emitted when a node gets some attribute values of some points changed\n\n.. versionadded:: 3.42\n'} + QgsPointCloudLayer.__signal_arguments__ = {'raiseError': ['msg: str'], 'statisticsCalculationStateChanged': ['state: QgsPointCloudLayer.PointCloudStatisticsCalculationState'], 'chunkAttributeValuesChanged': ['n: QgsPointCloudNodeId']} QgsPointCloudLayer.__group__ = ['pointcloud'] except (NameError, AttributeError): pass diff --git a/python/core/auto_additions/qgssymbollayerutils.py b/python/core/auto_additions/qgssymbollayerutils.py index de49d5e3840c..58e412ae6838 100644 --- a/python/core/auto_additions/qgssymbollayerutils.py +++ b/python/core/auto_additions/qgssymbollayerutils.py @@ -161,6 +161,7 @@ QgsSymbolLayerUtils.tileSize = staticmethod(QgsSymbolLayerUtils.tileSize) QgsSymbolLayerUtils.clearSymbolLayerIds = staticmethod(QgsSymbolLayerUtils.clearSymbolLayerIds) QgsSymbolLayerUtils.resetSymbolLayerIds = staticmethod(QgsSymbolLayerUtils.resetSymbolLayerIds) + QgsSymbolLayerUtils.clearSymbolLayerMasks = staticmethod(QgsSymbolLayerUtils.clearSymbolLayerMasks) QgsSymbolLayerUtils.collectSymbolLayerClipGeometries = staticmethod(QgsSymbolLayerUtils.collectSymbolLayerClipGeometries) QgsSymbolLayerUtils.__group__ = ['symbology'] except (NameError, AttributeError): diff --git a/python/core/auto_additions/qgstransaction.py b/python/core/auto_additions/qgstransaction.py index 180403b80ca6..284cc9fa4347 100644 --- a/python/core/auto_additions/qgstransaction.py +++ b/python/core/auto_additions/qgstransaction.py @@ -1,8 +1,8 @@ # The following has been generated automatically from src/core/qgstransaction.h try: - QgsTransaction.__attribute_docs__ = {'afterRollback': 'Emitted after a rollback\n', 'dirtied': 'Emitted if a sql query is executed and the underlying data is modified\n'} + QgsTransaction.__attribute_docs__ = {'afterRollback': 'Emitted after a rollback\n', 'afterRollbackToSavepoint': 'Emitted after a rollback to savepoint\n\n.. versionadded:: 3.42\n', 'dirtied': 'Emitted if a sql query is executed and the underlying data is modified\n'} QgsTransaction.create = staticmethod(QgsTransaction.create) QgsTransaction.supportsTransaction = staticmethod(QgsTransaction.supportsTransaction) - QgsTransaction.__signal_arguments__ = {'dirtied': ['sql: str', 'name: str']} + QgsTransaction.__signal_arguments__ = {'afterRollbackToSavepoint': ['savepointName: str'], 'dirtied': ['sql: str', 'name: str']} except (NameError, AttributeError): pass diff --git a/python/core/auto_generated/auth/qgsauthmanager.sip.in b/python/core/auto_generated/auth/qgsauthmanager.sip.in index 35f5281bbcef..fa8ecdab07ca 100644 --- a/python/core/auto_generated/auth/qgsauthmanager.sip.in +++ b/python/core/auto_generated/auth/qgsauthmanager.sip.in @@ -27,6 +27,7 @@ and to utilize configurations through various authentication method plugins %End public: + enum MessageLevel { INFO, @@ -161,6 +162,7 @@ Returns the authentication database connection URI with the password stripped. .. versionadded:: 3.40 %End + bool setMasterPassword( bool verify = false ); %Docstring Main call to initially set or continually check master password is set @@ -223,17 +225,18 @@ Check whether supplied password is the same as the one already set bool resetMasterPassword( const QString &newpass, const QString &oldpass, bool keepbackup, QString *backuppath /In,Out/ = 0 ); %Docstring -Reset the master password to a new one, then re-encrypt all previous -configs in a new database file, optionally backup current database +Reset the master password to a new one, then re-encrypts all previous +configs with the new password. :param newpass: New master password to replace existing :param oldpass: Current master password to replace existing -:param keepbackup: Whether to keep the generated backup of current database +:param keepbackup: Whether to keep the generated backup of current database (if using file-based storage) :param backuppath: Where the backup is located, if kept %End + void setScheduledAuthDatabaseEraseRequestEmitted( bool emitted ); %Docstring Re-emit a signal to schedule an optional erase of authentication database. @@ -810,8 +813,20 @@ Store the password manager into the wallet Available in Python bindings since QGIS 3.8.0 %End + + static const QString AUTH_PASSWORD_HELPER_DISPLAY_NAME; + static QString passwordHelperDisplayName( bool titleCase = false ); +%Docstring +Returns a translated display name of the password helper (platform dependent). + +If ``titleCase`` is ``True`` then a title case version of the string will be returned. Otherwise +a mid-sentence case version will be returned. + +.. versionadded:: 3.42 +%End + static const QString AUTH_MAN_TAG; diff --git a/python/core/auto_generated/effects/qgspainteffect.sip.in b/python/core/auto_generated/effects/qgspainteffect.sip.in index 777e12217c22..0143932f0254 100644 --- a/python/core/auto_generated/effects/qgspainteffect.sip.in +++ b/python/core/auto_generated/effects/qgspainteffect.sip.in @@ -149,7 +149,7 @@ Restores the effect to the state described by a DOM element. .. seealso:: :py:func:`saveProperties` %End - virtual void render( QPicture &picture, QgsRenderContext &context ); + virtual void render( const QPicture &picture, QgsRenderContext &context ); %Docstring Renders a picture using the effect. @@ -246,7 +246,7 @@ to account for the destination painter's DPI. .. seealso:: :py:func:`sourceAsImage` %End - const QPicture *source() const; + const QPicture &source() const; %Docstring Returns the source QPicture. The :py:func:`~QgsPaintEffect.draw` member can utilize this when drawing the effect. @@ -258,14 +258,14 @@ drawing the effect. .. seealso:: :py:func:`sourceAsImage` %End - QImage *sourceAsImage( QgsRenderContext &context ); + QImage sourceAsImage( QgsRenderContext &context ); %Docstring Returns the source QPicture rendered to a new QImage. The :py:func:`~QgsPaintEffect.draw` member can utilize this when drawing the effect. The image will be padded or cropped from the original source QPicture by the results of the :py:func:`~QgsPaintEffect.boundingRect` method. The result is cached to speed up subsequent calls to sourceAsImage. -:return: source QPicture rendered to an image +:return: source QPicture rendered to an image, or a null image if source could not be rendered .. seealso:: :py:func:`drawSource` diff --git a/python/core/auto_generated/geometry/qgsbox3d.sip.in b/python/core/auto_generated/geometry/qgsbox3d.sip.in index c3205eeb8b43..18edcd44c9c2 100644 --- a/python/core/auto_generated/geometry/qgsbox3d.sip.in +++ b/python/core/auto_generated/geometry/qgsbox3d.sip.in @@ -375,12 +375,24 @@ Expands the bbox so that it covers both the original rectangle and the given poi Converts the box to a 2D rectangle. %End - double distanceTo( const QVector3D &point ) const /HoldGIL/; + double distanceTo( const QVector3D &point ) const /Deprecated="Since 3.42. Use distanceTo() with QgsVector3D instead (QVector3D uses floats)."/; %Docstring Returns the smallest distance between the box and the point ``point`` (returns 0 if the point is inside the box) .. versionadded:: 3.18 + +.. deprecated:: 3.42 + + Use :py:func:`~QgsBox3D.distanceTo` with :py:class:`QgsVector3D` instead (QVector3D uses floats). +%End + + double distanceTo( const QgsVector3D &point ) const /HoldGIL/; +%Docstring +Returns the smallest distance between the box and the point ``point`` +(returns 0 if the point is inside the box) + +.. versionadded:: 3.42 %End bool operator==( const QgsBox3D &other ) const /HoldGIL/; diff --git a/python/core/auto_generated/geometry/qgsmultipoint.sip.in b/python/core/auto_generated/geometry/qgsmultipoint.sip.in index 5fd56c1ab2f0..d6c56daea4f1 100644 --- a/python/core/auto_generated/geometry/qgsmultipoint.sip.in +++ b/python/core/auto_generated/geometry/qgsmultipoint.sip.in @@ -120,7 +120,7 @@ The multipoint Z and M type will be set based on the type of the first point in break; } - std::unique_ptr< QgsPoint > point = std::make_unique< QgsPoint >( x, y ); + auto point = std::make_unique< QgsPoint >( x, y ); if ( elementSize > 2 ) { element = PySequence_GetItem( value, 2 ); diff --git a/python/core/auto_generated/geometry/qgsrectangle.sip.in b/python/core/auto_generated/geometry/qgsrectangle.sip.in index b4b1d09716da..d24acb66d00b 100644 --- a/python/core/auto_generated/geometry/qgsrectangle.sip.in +++ b/python/core/auto_generated/geometry/qgsrectangle.sip.in @@ -11,6 +11,8 @@ + + class QgsRectangle { %Docstring(signature="appended") diff --git a/python/core/auto_generated/labeling/qgsrulebasedlabeling.sip.in b/python/core/auto_generated/labeling/qgsrulebasedlabeling.sip.in index 9263739895e0..baa4719b6872 100644 --- a/python/core/auto_generated/labeling/qgsrulebasedlabeling.sip.in +++ b/python/core/auto_generated/labeling/qgsrulebasedlabeling.sip.in @@ -21,7 +21,7 @@ Rule based labeling for a vector layer. %End public: typedef QList RuleList; - typedef QMap RuleToProviderMap; + public: class Rule { @@ -219,9 +219,13 @@ Try to find a rule given its unique key %End - QgsRuleBasedLabeling::Rule *clone() const /Factory/; + QgsRuleBasedLabeling::Rule *clone( bool resetRuleKey = true ) const /Factory/; %Docstring -clone this rule, return new instance +clone this rule + +:param resetRuleKey: ``True`` if this rule and its children rule key need to be reset to new unique ones. + +:return: new instance %End @@ -312,8 +316,6 @@ Set pal settings for a specific provider (takes ownership). protected: - - }; diff --git a/python/core/auto_generated/layertree/qgslayertreeregistrybridge.sip.in b/python/core/auto_generated/layertree/qgslayertreeregistrybridge.sip.in index 47de54bfeeba..b614ba15fe46 100644 --- a/python/core/auto_generated/layertree/qgslayertreeregistrybridge.sip.in +++ b/python/core/auto_generated/layertree/qgslayertreeregistrybridge.sip.in @@ -66,6 +66,13 @@ Set where the new layers should be inserted - can be used to follow current sele By default it is root group with zero index. .. versionadded:: 3.10 +%End + + InsertionPoint layerInsertionPoint() const; +%Docstring +Returns the insertion point used to add layers to the tree + +.. versionadded:: 3.42 %End void setLayerInsertionMethod( Qgis::LayerTreeInsertionMethod method ); @@ -100,6 +107,7 @@ Tell others we have just added layers to the tree (used in QGIS to auto-select f protected: + }; /************************************************************************ diff --git a/python/core/auto_generated/mesh/qgsmeshlayer.sip.in b/python/core/auto_generated/mesh/qgsmeshlayer.sip.in index 6a2cafa579ac..6a5b6bb46558 100644 --- a/python/core/auto_generated/mesh/qgsmeshlayer.sip.in +++ b/python/core/auto_generated/mesh/qgsmeshlayer.sip.in @@ -234,9 +234,13 @@ Gets native mesh and updates (creates if it doesn't exist) the base triangular m %Docstring Returns renderer settings %End - void setRendererSettings( const QgsMeshRendererSettings &settings ); + + void setRendererSettings( const QgsMeshRendererSettings &settings, const bool repaint = true ); %Docstring Sets new renderer settings + +:param settings: +:param repaint: should the update of renderer settings trigger repaint and emit rendererChanged signal %End QgsMeshTimeSettings timeSettings() const; diff --git a/python/core/auto_generated/network/qgshttpheaders.sip.in b/python/core/auto_generated/network/qgshttpheaders.sip.in index 3428ece4f42b..c4e72e65a521 100644 --- a/python/core/auto_generated/network/qgshttpheaders.sip.in +++ b/python/core/auto_generated/network/qgshttpheaders.sip.in @@ -109,15 +109,22 @@ KEY_REFERER value will be available at key "KEY_PREFIX+KEY_REFERER" and key "KEY :return: ``True`` if the update succeed %End - bool updateDomElement( QDomElement &el ) const; + bool updateDomElement( QDomElement &el ) const /Deprecated="Since 3.42. Will be removed in QGIS 4.0."/; %Docstring -Updates a ``map`` by adding all the HTTP headers +Updates a DOM element by adding all the HTTP headers KEY_REFERER value will be available at attribute "KEY_PREFIX+KEY_REFERER" and attribute "KEY_REFERER" (for backward compatibility) +:param el: DOM element + :return: ``True`` if the update succeed + +.. deprecated:: 3.42 + + Will be removed in QGIS 4.0. %End + void setFromSettings( const QgsSettings &settings, const QString &key = QString() ); %Docstring Loads headers from the ``settings`` @@ -185,6 +192,7 @@ Returns key/value pairs as strings separated by space }; + /************************************************************************ * This file has been generated automatically from * * * diff --git a/python/core/auto_generated/pointcloud/qgspointcloudindex.sip.in b/python/core/auto_generated/pointcloud/qgspointcloudindex.sip.in index 18cbe8b42976..cdaf1cfdeda5 100644 --- a/python/core/auto_generated/pointcloud/qgspointcloudindex.sip.in +++ b/python/core/auto_generated/pointcloud/qgspointcloudindex.sip.in @@ -169,6 +169,7 @@ index is memory safe. operator bool() const; + void load( const QString &fileName ); %Docstring Loads the index from the file @@ -355,9 +356,11 @@ in an implementation-specific dynamic structure. .. seealso:: :py:func:`QgsAbstractPointCloudIndex.extraMetadata` %End - bool commitChanges(); + bool commitChanges( QString *errorMessage /Out/ = 0 ); %Docstring Tries to store pending changes to the data provider. +If errorMessage is not a null pointer, it will receive +an error message in case the call failed. :return: ``True`` on success, otherwise ``False`` %End @@ -365,6 +368,11 @@ Tries to store pending changes to the data provider. bool isModified() const; %Docstring Returns ``True`` if there are uncommitted changes, ``False`` otherwise +%End + + QList updatedNodes() const; +%Docstring +Returns a list of node IDs that have been modified %End }; diff --git a/python/core/auto_generated/pointcloud/qgspointcloudlayer.sip.in b/python/core/auto_generated/pointcloud/qgspointcloudlayer.sip.in index d239635dce4a..3a43cbcec56b 100644 --- a/python/core/auto_generated/pointcloud/qgspointcloudlayer.sip.in +++ b/python/core/auto_generated/pointcloud/qgspointcloudlayer.sip.in @@ -305,6 +305,13 @@ Signals an error related to this point cloud layer. Emitted when statistics calculation state has changed .. versionadded:: 3.26 +%End + + void chunkAttributeValuesChanged( const QgsPointCloudNodeId &n ); +%Docstring +Emitted when a node gets some attribute values of some points changed + +.. versionadded:: 3.42 %End private: diff --git a/python/core/auto_generated/processing/qgsprocessingcontext.sip.in b/python/core/auto_generated/processing/qgsprocessingcontext.sip.in index b35acb194587..f049c6216b8e 100644 --- a/python/core/auto_generated/processing/qgsprocessingcontext.sip.in +++ b/python/core/auto_generated/processing/qgsprocessingcontext.sip.in @@ -662,6 +662,13 @@ Returns the model results, populated when the context is used to run a model alg %End + void clearModelResult(); +%Docstring +Clears model results previously populated when the context was used to run a model algorithm. + +.. versionadded:: 3.42 +%End + private: QgsProcessingContext( const QgsProcessingContext &other ); }; diff --git a/python/core/auto_generated/processing/qgsprocessingutils.sip.in b/python/core/auto_generated/processing/qgsprocessingutils.sip.in index 8b122a842abb..82649ee9268e 100644 --- a/python/core/auto_generated/processing/qgsprocessingutils.sip.in +++ b/python/core/auto_generated/processing/qgsprocessingutils.sip.in @@ -335,7 +335,7 @@ Normalizes a layer ``source`` string for safe comparison across different operating system environments. %End - static QString layerToStringIdentifier( const QgsMapLayer *layer ) /HoldGIL/; + static QString layerToStringIdentifier( const QgsMapLayer *layer, const QString &layerName = QString() ) /HoldGIL/; %Docstring Returns a string representation of the source for a ``layer``. The returned value is suitable for storage for subsequent executions of an algorithm diff --git a/python/core/auto_generated/proj/qgscoordinatereferencesystem.sip.in b/python/core/auto_generated/proj/qgscoordinatereferencesystem.sip.in index f83c3850070a..b33cfa95148a 100644 --- a/python/core/auto_generated/proj/qgscoordinatereferencesystem.sip.in +++ b/python/core/auto_generated/proj/qgscoordinatereferencesystem.sip.in @@ -839,7 +839,7 @@ plate-fixed. .. versionadded:: 3.20 %End - QgsDatumEnsemble datumEnsemble() const throw( QgsNotSupportedException ); + QgsDatumEnsemble datumEnsemble() const; %Docstring Attempts to retrieve datum ensemble details from the CRS. @@ -850,25 +850,13 @@ be returned. In the case of a compound crs, this method will always return the datum ensemble for the horizontal component. -.. warning:: - - This method requires PROJ 8.0 or later - -:raises QgsNotSupportedException: on QGIS builds based on PROJ 7 or earlier. - .. versionadded:: 3.20 %End - QString celestialBodyName() const throw( QgsNotSupportedException ); + QString celestialBodyName() const; %Docstring Attempts to retrieve the name of the celestial body associated with the CRS (e.g. "Earth"). -.. warning:: - - This method requires PROJ 8.1 or later - -:raises QgsNotSupportedException: on QGIS builds based on PROJ 8.0 or earlier. - .. versionadded:: 3.20 %End diff --git a/python/core/auto_generated/proj/qgscoordinatereferencesystemregistry.sip.in b/python/core/auto_generated/proj/qgscoordinatereferencesystemregistry.sip.in index 1df531255497..55044defbf28 100644 --- a/python/core/auto_generated/proj/qgscoordinatereferencesystemregistry.sip.in +++ b/python/core/auto_generated/proj/qgscoordinatereferencesystemregistry.sip.in @@ -128,12 +128,6 @@ The map keys correspond to PROJ operation IDs. %Docstring Returns a list of all known celestial bodies. -.. warning:: - - This method requires PROJ 8.1 or later - -:raises QgsNotSupportedException: on QGIS builds based on PROJ 8.0 or earlier. - .. versionadded:: 3.20 %End diff --git a/python/core/auto_generated/proj/qgscoordinatetransform.sip.in b/python/core/auto_generated/proj/qgscoordinatetransform.sip.in index eccd86b8114d..2a5a398938ee 100644 --- a/python/core/auto_generated/proj/qgscoordinatetransform.sip.in +++ b/python/core/auto_generated/proj/qgscoordinatetransform.sip.in @@ -280,6 +280,10 @@ the returned rectangle. :return: rectangle in destination CRS +.. warning:: + + Do not call this method if the transformation involves geocentric CRS -- in this situation transformation of a 2D bounding box is meaningless! Calling this method with a geocentric CRS will result in a :py:class:`QgsCsException` being thrown. + :raises QgsCsException: if the transformation fails %End diff --git a/python/core/auto_generated/providers/qgsabstractdatabaseproviderconnection.sip.in b/python/core/auto_generated/providers/qgsabstractdatabaseproviderconnection.sip.in index 19a8761aecb4..e58d9bcb5187 100644 --- a/python/core/auto_generated/providers/qgsabstractdatabaseproviderconnection.sip.in +++ b/python/core/auto_generated/providers/qgsabstractdatabaseproviderconnection.sip.in @@ -1033,6 +1033,8 @@ Checks if ``capability`` is supported. + + }; QFlags operator|(QgsAbstractDatabaseProviderConnection::Capability f1, QFlags f2); diff --git a/python/core/auto_generated/providers/qgsprovidermetadata.sip.in b/python/core/auto_generated/providers/qgsprovidermetadata.sip.in index 9af4d97a1d3a..19c3052bdea9 100644 --- a/python/core/auto_generated/providers/qgsprovidermetadata.sip.in +++ b/python/core/auto_generated/providers/qgsprovidermetadata.sip.in @@ -573,6 +573,13 @@ If a provider does not work with paths, unmodified URI will be returned. .. seealso:: :py:func:`absoluteToRelativeUri` .. versionadded:: 3.30 +%End + + virtual QString cleanUri( const QString &uri, Qgis::UriCleaningFlags flags = Qgis::UriCleaningFlag::RemoveCredentials ) const; +%Docstring +Cleans a layer ``uri``, e.g. to remove or hide sensitive information from the URI. + +.. versionadded:: 3.42 %End virtual QList< QgsDataItemProvider * > dataItemProviders() const /Factory/; diff --git a/python/core/auto_generated/providers/sensorthings/qgssensorthingsutils.sip.in b/python/core/auto_generated/providers/sensorthings/qgssensorthingsutils.sip.in index 45b049c4c7e4..394e736ba268 100644 --- a/python/core/auto_generated/providers/sensorthings/qgssensorthingsutils.sip.in +++ b/python/core/auto_generated/providers/sensorthings/qgssensorthingsutils.sip.in @@ -56,9 +56,12 @@ Returns the SensorThings properties which correspond to a specified entity ``typ .. versionadded:: 3.38 %End - static QgsFields fieldsForEntityType( Qgis::SensorThingsEntity type ); + static QgsFields fieldsForEntityType( Qgis::SensorThingsEntity type, bool includeRangeFieldProxies = true ); %Docstring Returns the fields which correspond to a specified entity ``type``. + +Since QGIS 3.42 the ``includeRangeFieldProxies`` argument can be used to hide the "start"/"end" fields +which are proxies for the date time range field types which are not natively supported in QGIS. %End static QgsFields fieldsForExpandedEntityType( Qgis::SensorThingsEntity baseType, const QList< Qgis::SensorThingsEntity > &expandedTypes ); diff --git a/python/core/auto_generated/qgis.sip.in b/python/core/auto_generated/qgis.sip.in index a2b885ed6ddb..f6e2c40a25db 100644 --- a/python/core/auto_generated/qgis.sip.in +++ b/python/core/auto_generated/qgis.sip.in @@ -783,6 +783,15 @@ The development version TiledScene, }; + enum class UriCleaningFlag + { + RemoveCredentials, + RedactCredentials, + }; + + typedef QFlags UriCleaningFlags; + + enum class SublayerQueryFlag { FastScan, @@ -3406,6 +3415,8 @@ QFlags operator|(Qgis::SnappingType f1, QFlags operator|(Qgis::SqlLayerDefinitionCapability f1, QFlags f2); +QFlags operator|(Qgis::UriCleaningFlag f1, QFlags f2); + QFlags operator|(Qgis::SublayerFlag f1, QFlags f2); QFlags operator|(Qgis::SublayerQueryFlag f1, QFlags f2); diff --git a/python/core/auto_generated/qgsabstractcontentcache.sip.in b/python/core/auto_generated/qgsabstractcontentcache.sip.in index d65dc29a2c09..2d5694ae3f06 100644 --- a/python/core/auto_generated/qgsabstractcontentcache.sip.in +++ b/python/core/auto_generated/qgsabstractcontentcache.sip.in @@ -108,6 +108,23 @@ Data URLs are of the form ``data:[;]base64,``. .. versionadded:: 3.40 %End + + static bool parseEmbeddedStringData( const QString &path, QString *mimeType /Out/ = 0, QString *data /Out/ = 0 ); +%Docstring +Parses a ``path`` to determine if it represents a embedded string data, and if so, extracts the components +of the URL. + +Data URLs are of the form ``data:[;]utf8,``. + +:param path: path to test + +:return: - ``True`` if ``path`` is an embedded string data URL + - mimeType: the extracted mime type if the ``path`` is a data URL + - data: the extracted string data if the ``path`` is a data URL + +.. versionadded:: 3.42 +%End + static bool isBase64Data( const QString &path ); %Docstring Returns ``True`` if ``path`` represents base64 encoded data. diff --git a/python/core/auto_generated/qgserror.sip.in b/python/core/auto_generated/qgserror.sip.in index a7a02ca84f74..8bd96aedca61 100644 --- a/python/core/auto_generated/qgserror.sip.in +++ b/python/core/auto_generated/qgserror.sip.in @@ -88,9 +88,9 @@ Append new error message. bool isEmpty() const; %Docstring -Test if any error is set. +Test if no error is set. -:return: ``True`` if contains error +:return: ``False`` if contains error %End QString message( QgsErrorMessage::Format format = QgsErrorMessage::Html ) const; diff --git a/python/core/auto_generated/qgsfeatureiterator.sip.in b/python/core/auto_generated/qgsfeatureiterator.sip.in index 2d9ddbea908c..9c958586c3df 100644 --- a/python/core/auto_generated/qgsfeatureiterator.sip.in +++ b/python/core/auto_generated/qgsfeatureiterator.sip.in @@ -222,7 +222,7 @@ Wrapper for iterator of features from vector data provider or vector layer SIP_PYOBJECT __next__() /TypeHint="QgsFeature"/; %MethodCode - std::unique_ptr< QgsFeature > f = std::make_unique< QgsFeature >(); + auto f = std::make_unique< QgsFeature >(); bool result = false; Py_BEGIN_ALLOW_THREADS result = ( sipCpp->nextFeature( *f ) ); diff --git a/python/core/auto_generated/qgsmaplayer.sip.in b/python/core/auto_generated/qgsmaplayer.sip.in index cfa3b903874f..41b536975391 100644 --- a/python/core/auto_generated/qgsmaplayer.sip.in +++ b/python/core/auto_generated/qgsmaplayer.sip.in @@ -567,13 +567,14 @@ or other problem. Child classes set this flag when initialized. :return: ``True`` if the layer is valid and can be accessed %End + QString publicSource( bool hidePassword = false ) const; %Docstring Gets a version of the internal layer definition that has sensitive bits removed (for example, the password). This function should be used when displaying the source name for general viewing. -:param hidePassword: False, if the password should be removed or replaced by an arbitrary string, since QGIS 3.34 +:param hidePassword: ``True`` to replace the value of credentials with 'xxxxxxxx', ``False`` to completely remove credentials (key and value). Since QGIS 3.34 .. seealso:: :py:func:`source` %End diff --git a/python/core/auto_generated/qgsmessagelog.sip.in b/python/core/auto_generated/qgsmessagelog.sip.in index 191fedee7791..dae700f6b340 100644 --- a/python/core/auto_generated/qgsmessagelog.sip.in +++ b/python/core/auto_generated/qgsmessagelog.sip.in @@ -32,14 +32,8 @@ window for the user. QgsMessageLog(); - static void logMessage( const QString &message, const QString &tag = QString(), Qgis::MessageLevel level = Qgis::MessageLevel::Warning, bool notifyUser = true ); -%Docstring -Adds a ``message`` to the log instance (and creates it if necessary). - -If ``notifyUser`` is ``True``, then the message should be brought to the user's attention by various UI hints. -If it is ``False``, the message should appear in logs silently. Note that log viewer implementations may -only respect notification hints for certain message levels. -%End + static void logMessage( const QString &message, const QString &tag = QString(), Qgis::MessageLevel level = Qgis::MessageLevel::Warning, bool notifyUser = true, + const char *file = __builtin_FILE(), const char *function = __builtin_FUNCTION(), int line = __builtin_LINE() ); signals: diff --git a/python/core/auto_generated/qgsspatialindex.sip.in b/python/core/auto_generated/qgsspatialindex.sip.in index 03799f08936e..53e32de3fcc4 100644 --- a/python/core/auto_generated/qgsspatialindex.sip.in +++ b/python/core/auto_generated/qgsspatialindex.sip.in @@ -205,7 +205,7 @@ Geometry is only stored if the QgsSpatialIndex was created with the FlagStoreFea .. versionadded:: 3.6 %End %MethodCode - std::unique_ptr< QgsGeometry > g = std::make_unique< QgsGeometry >( sipCpp->geometry( a0 ) ); + auto g = std::make_unique< QgsGeometry >( sipCpp->geometry( a0 ) ); if ( g->isNull() ) { PyErr_SetString( PyExc_KeyError, QStringLiteral( "No geometry with feature id %1 exists in the index." ).arg( a0 ).toUtf8().constData() ); diff --git a/python/core/auto_generated/qgstransaction.sip.in b/python/core/auto_generated/qgstransaction.sip.in index 412929f07859..b5f528812390 100644 --- a/python/core/auto_generated/qgstransaction.sip.in +++ b/python/core/auto_generated/qgstransaction.sip.in @@ -152,6 +152,13 @@ returns the last created savepoint void afterRollback(); %Docstring Emitted after a rollback +%End + + void afterRollbackToSavepoint( const QString &savepointName ); +%Docstring +Emitted after a rollback to savepoint + +.. versionadded:: 3.42 %End void dirtied( const QString &sql, const QString &name ); diff --git a/python/core/auto_generated/scalebar/qgsdoubleboxscalebarrenderer.sip.in b/python/core/auto_generated/scalebar/qgsdoubleboxscalebarrenderer.sip.in index 458d2c810456..a7cedd17f041 100644 --- a/python/core/auto_generated/scalebar/qgsdoubleboxscalebarrenderer.sip.in +++ b/python/core/auto_generated/scalebar/qgsdoubleboxscalebarrenderer.sip.in @@ -36,6 +36,8 @@ Double box with alternating colors. const QgsScaleBarSettings &settings, const QgsScaleBarRenderer::ScaleBarContext &scaleContext ) const; + virtual bool applyDefaultSettings( QgsScaleBarSettings &settings ) const; + }; /************************************************************************ diff --git a/python/core/auto_generated/scalebar/qgshollowscalebarrenderer.sip.in b/python/core/auto_generated/scalebar/qgshollowscalebarrenderer.sip.in index 0a8ad51a02c6..fd669e79b5be 100644 --- a/python/core/auto_generated/scalebar/qgshollowscalebarrenderer.sip.in +++ b/python/core/auto_generated/scalebar/qgshollowscalebarrenderer.sip.in @@ -40,7 +40,6 @@ alternating segments. AKA "South African" style. const QgsScaleBarRenderer::ScaleBarContext &scaleContext ) const; virtual bool applyDefaultSettings( QgsScaleBarSettings &settings ) const; - }; /************************************************************************ diff --git a/python/core/auto_generated/scalebar/qgssingleboxscalebarrenderer.sip.in b/python/core/auto_generated/scalebar/qgssingleboxscalebarrenderer.sip.in index 30e8ed6d403f..4a828b2e55e8 100644 --- a/python/core/auto_generated/scalebar/qgssingleboxscalebarrenderer.sip.in +++ b/python/core/auto_generated/scalebar/qgssingleboxscalebarrenderer.sip.in @@ -37,6 +37,8 @@ color for the segments. const QgsScaleBarSettings &settings, const QgsScaleBarRenderer::ScaleBarContext &scaleContext ) const; + virtual bool applyDefaultSettings( QgsScaleBarSettings &settings ) const; + }; /************************************************************************ diff --git a/python/core/auto_generated/symbology/qgsmasksymbollayer.sip.in b/python/core/auto_generated/symbology/qgsmasksymbollayer.sip.in index 03583d69ad2c..1ee80706775d 100644 --- a/python/core/auto_generated/symbology/qgsmasksymbollayer.sip.in +++ b/python/core/auto_generated/symbology/qgsmasksymbollayer.sip.in @@ -85,6 +85,15 @@ Returns a list of references to symbol layers that are masked by the sub symbol' :return: a list of references to masked symbol layers .. seealso:: :py:func:`setMasks` +%End + + void clearMasks(); +%Docstring +Remove masks defined by this symbol layer. + +.. seealso:: :py:func:`masks` + +.. versionadded:: 3.42 %End void setMasks( const QList &maskedLayers ); @@ -100,8 +109,6 @@ Sets the symbol layers that will be masked by the sub symbol's shape. QgsMaskMarkerSymbolLayer( const QgsMaskMarkerSymbolLayer & ); }; - - /************************************************************************ * This file has been generated automatically from * * * diff --git a/python/core/auto_generated/symbology/qgssymbollayerutils.sip.in b/python/core/auto_generated/symbology/qgssymbollayerutils.sip.in index 4e60a056d2dc..5dfda106322a 100644 --- a/python/core/auto_generated/symbology/qgssymbollayerutils.sip.in +++ b/python/core/auto_generated/symbology/qgssymbollayerutils.sip.in @@ -1020,6 +1020,13 @@ Regenerate recursively unique id from all ``symbol`` symbol layers Regenerate recursively unique id from ``symbolLayer`` and its children .. versionadded:: 3.30 +%End + + static void clearSymbolLayerMasks( QgsSymbol *symbol ); +%Docstring +Remove recursively masks from all ``symbol`` symbol layers + +.. versionadded:: 3.42 %End static QVector< QgsGeometry > collectSymbolLayerClipGeometries( const QgsRenderContext &context, const QString &symbolLayerId, const QRectF &bounds ); diff --git a/python/core/auto_generated/vector/qgsvectorlayereditbuffer.sip.in b/python/core/auto_generated/vector/qgsvectorlayereditbuffer.sip.in index 422d7a2470d4..96f6588d7038 100644 --- a/python/core/auto_generated/vector/qgsvectorlayereditbuffer.sip.in +++ b/python/core/auto_generated/vector/qgsvectorlayereditbuffer.sip.in @@ -321,7 +321,7 @@ Update feature with uncommitted geometry updates Update feature with uncommitted attribute updates %End - void handleAttributeAdded( int index ); + void handleAttributeAdded( int index, const QgsField &field ); %Docstring Update added and changed features after addition of an attribute %End diff --git a/python/core/auto_generated/vector/qgsvectorlayereditutils.sip.in b/python/core/auto_generated/vector/qgsvectorlayereditutils.sip.in index 2a7e6a972eca..63643833dfe2 100644 --- a/python/core/auto_generated/vector/qgsvectorlayereditutils.sip.in +++ b/python/core/auto_generated/vector/qgsvectorlayereditutils.sip.in @@ -332,6 +332,7 @@ Merge features into a single one. .. versionadded:: 3.30 %End + }; /************************************************************************ diff --git a/python/core/class_map.yaml b/python/core/class_map.yaml index 9ec3cdd7f18a..70c17dffca65 100644 --- a/python/core/class_map.yaml +++ b/python/core/class_map.yaml @@ -1,10 +1,10 @@ -Qgis.defaultProjectScales: src/core/qgis.h#L5817 +Qgis.defaultProjectScales: src/core/qgis.h#L5837 Qgis.devVersion: src/core/qgis.h#L89 -Qgis.geosVersion: src/core/qgis.h#L5852 -Qgis.geosVersionInt: src/core/qgis.h#L5824 -Qgis.geosVersionMajor: src/core/qgis.h#L5831 -Qgis.geosVersionMinor: src/core/qgis.h#L5838 -Qgis.geosVersionPatch: src/core/qgis.h#L5845 +Qgis.geosVersion: src/core/qgis.h#L5872 +Qgis.geosVersionInt: src/core/qgis.h#L5844 +Qgis.geosVersionMajor: src/core/qgis.h#L5851 +Qgis.geosVersionMinor: src/core/qgis.h#L5858 +Qgis.geosVersionPatch: src/core/qgis.h#L5865 Qgis.releaseName: src/core/qgis.h#L79 Qgis.version: src/core/qgis.h#L65 Qgis.versionInt: src/core/qgis.h#L72 @@ -108,11 +108,12 @@ QgsAbstractCacheIndex.flushFeature: src/core/qgscacheindex.h#L42 QgsAbstractCacheIndex.getCacheIterator: src/core/qgscacheindex.h#L76 QgsAbstractCacheIndex.requestCompleted: src/core/qgscacheindex.h#L59 QgsAbstractCacheIndex: src/core/qgscacheindex.h#L31 -QgsAbstractContentCacheBase.checkReply: src/core/qgsabstractcontentcache.h#L184 -QgsAbstractContentCacheBase.isBase64Data: src/core/qgsabstractcontentcache.h#L164 -QgsAbstractContentCacheBase.onRemoteContentFetched: src/core/qgsabstractcontentcache.h#L194 +QgsAbstractContentCacheBase.checkReply: src/core/qgsabstractcontentcache.h#L201 +QgsAbstractContentCacheBase.isBase64Data: src/core/qgsabstractcontentcache.h#L181 +QgsAbstractContentCacheBase.onRemoteContentFetched: src/core/qgsabstractcontentcache.h#L211 QgsAbstractContentCacheBase.parseBase64DataUrl: src/core/qgsabstractcontentcache.h#L157 -QgsAbstractContentCacheBase.remoteContentFetched: src/core/qgsabstractcontentcache.h#L171 +QgsAbstractContentCacheBase.parseEmbeddedStringData: src/core/qgsabstractcontentcache.h#L174 +QgsAbstractContentCacheBase.remoteContentFetched: src/core/qgsabstractcontentcache.h#L188 QgsAbstractContentCacheBase: src/core/qgsabstractcontentcache.h#L132 QgsAbstractContentCacheEntry.dataSize: src/core/qgsabstractcontentcache.h#L99 QgsAbstractContentCacheEntry.dump: src/core/qgsabstractcontentcache.h#L104 @@ -1485,108 +1486,109 @@ QgsAuthConfigurationStorageRegistry.storageAdded: src/core/auth/qgsauthconfigura QgsAuthConfigurationStorageRegistry.storageChanged: src/core/auth/qgsauthconfigurationstorageregistry.h#L120 QgsAuthConfigurationStorageRegistry.storageRemoved: src/core/auth/qgsauthconfigurationstorageregistry.h#L126 QgsAuthConfigurationStorageRegistry: src/core/auth/qgsauthconfigurationstorageregistry.h#L41 -QgsAuthManager.authConfigurationStorageRegistry: src/core/auth/qgsauthmanager.h#L123 -QgsAuthManager.authDatabaseChanged: src/core/auth/qgsauthmanager.h#L830 -QgsAuthManager.authDatabaseConfigTable: src/core/auth/qgsauthmanager.h#L136 -QgsAuthManager.authDatabaseConnection: src/core/auth/qgsauthmanager.h#L130 -QgsAuthManager.authDatabaseEraseRequested: src/core/auth/qgsauthmanager.h#L827 -QgsAuthManager.authDatabaseServersTable: src/core/auth/qgsauthmanager.h#L149 -QgsAuthManager.authManTag: src/core/auth/qgsauthmanager.h#L270 -QgsAuthManager.authMethod: src/core/auth/qgsauthmanager.h#L302 -QgsAuthManager.authMethodEditWidget: src/core/auth/qgsauthmanager.h#L326 -QgsAuthManager.authMethodsKeys: src/core/auth/qgsauthmanager.h#L296 -QgsAuthManager.authSetting: src/core/auth/qgsauthmanager.h#L481 -QgsAuthManager.authenticationDatabasePath: src/core/auth/qgsauthmanager.h#L163 -QgsAuthManager.authenticationDatabaseUri: src/core/auth/qgsauthmanager.h#L181 -QgsAuthManager.authenticationDatabaseUriStripped: src/core/auth/qgsauthmanager.h#L187 -QgsAuthManager.availableAuthMethodConfigs: src/core/auth/qgsauthmanager.h#L276 -QgsAuthManager.backupAuthenticationDatabase: src/core/auth/qgsauthmanager.h#L416 -QgsAuthManager.certAuthority: src/core/auth/qgsauthmanager.h#L604 -QgsAuthManager.certIdentity: src/core/auth/qgsauthmanager.h#L503 -QgsAuthManager.certIdentityBundleToPem: src/core/auth/qgsauthmanager.h#L518 -QgsAuthManager.certIdentityIds: src/core/auth/qgsauthmanager.h#L532 -QgsAuthManager.certTrustPolicy: src/core/auth/qgsauthmanager.h#L657 -QgsAuthManager.certificateTrustPolicy: src/core/auth/qgsauthmanager.h#L670 -QgsAuthManager.clearAllCachedConfigs: src/core/auth/qgsauthmanager.h#L834 -QgsAuthManager.clearCachedConfig: src/core/auth/qgsauthmanager.h#L837 -QgsAuthManager.clearMasterPassword: src/core/auth/qgsauthmanager.h#L221 -QgsAuthManager.configAuthMethod: src/core/auth/qgsauthmanager.h#L285 -QgsAuthManager.configAuthMethodKey: src/core/auth/qgsauthmanager.h#L291 -QgsAuthManager.configIdRegex: src/core/auth/qgsauthmanager.h#L352 -QgsAuthManager.configIdUnique: src/core/auth/qgsauthmanager.h#L343 -QgsAuthManager.configIds: src/core/auth/qgsauthmanager.h#L355 -QgsAuthManager.defaultCertTrustPolicy: src/core/auth/qgsauthmanager.h#L676 -QgsAuthManager.disabledMessage: src/core/auth/qgsauthmanager.h#L156 -QgsAuthManager.dumpIgnoredSslErrorsCache_: src/core/auth/qgsauthmanager.h#L579 -QgsAuthManager.ensureInitialized: src/core/auth/qgsauthmanager.h#L115 -QgsAuthManager.eraseAuthenticationDatabase: src/core/auth/qgsauthmanager.h#L424 -QgsAuthManager.existsAuthSetting: src/core/auth/qgsauthmanager.h#L484 -QgsAuthManager.existsCertAuthority: src/core/auth/qgsauthmanager.h#L607 -QgsAuthManager.existsCertIdentity: src/core/auth/qgsauthmanager.h#L535 -QgsAuthManager.existsSslCertCustomConfig: src/core/auth/qgsauthmanager.h#L566 -QgsAuthManager.exportAuthenticationConfigsToXml: src/core/auth/qgsauthmanager.h#L395 -QgsAuthManager.hasConfigId: src/core/auth/qgsauthmanager.h#L349 -QgsAuthManager.importAuthenticationConfigsFromXml: src/core/auth/qgsauthmanager.h#L404 -QgsAuthManager.init: src/core/auth/qgsauthmanager.h#L94 -QgsAuthManager.initSslCaches: src/core/auth/qgsauthmanager.h#L493 -QgsAuthManager.isDisabled: src/core/auth/qgsauthmanager.h#L153 -QgsAuthManager.isFilesystemBasedDatabase: src/core/auth/qgsauthmanager.h#L168 -QgsAuthManager.loadAuthenticationConfig: src/core/auth/qgsauthmanager.h#L379 -QgsAuthManager.masterPasswordHashInDatabase: src/core/auth/qgsauthmanager.h#L215 -QgsAuthManager.masterPasswordIsSet: src/core/auth/qgsauthmanager.h#L212 -QgsAuthManager.masterPasswordSame: src/core/auth/qgsauthmanager.h#L227 -QgsAuthManager.masterPasswordVerified: src/core/auth/qgsauthmanager.h#L824 -QgsAuthManager.messageLog: src/core/auth/qgsauthmanager.h#L798 -QgsAuthManager.messageOut: src/core/auth/qgsauthmanager.h#L788 -QgsAuthManager.methodConfigTableName: src/core/auth/qgsauthmanager.h#L143 -QgsAuthManager.passwordHelperEnabled: src/core/auth/qgsauthmanager.h#L733 -QgsAuthManager.passwordHelperFailure: src/core/auth/qgsauthmanager.h#L772 -QgsAuthManager.passwordHelperMessageLog: src/core/auth/qgsauthmanager.h#L818 -QgsAuthManager.passwordHelperMessageOut: src/core/auth/qgsauthmanager.h#L808 -QgsAuthManager.passwordHelperSuccess: src/core/auth/qgsauthmanager.h#L778 -QgsAuthManager.passwordHelperSync: src/core/auth/qgsauthmanager.h#L757 -QgsAuthManager.rebuildCaCertsCache: src/core/auth/qgsauthmanager.h#L647 -QgsAuthManager.rebuildCertTrustCache: src/core/auth/qgsauthmanager.h#L685 -QgsAuthManager.rebuildIgnoredSslErrorCache: src/core/auth/qgsauthmanager.h#L588 -QgsAuthManager.rebuildTrustedCaCertsCache: src/core/auth/qgsauthmanager.h#L701 -QgsAuthManager.registerCoreAuthMethods: src/core/auth/qgsauthmanager.h#L273 -QgsAuthManager.removeAllAuthenticationConfigs: src/core/auth/qgsauthmanager.h#L410 -QgsAuthManager.removeAuthSetting: src/core/auth/qgsauthmanager.h#L487 -QgsAuthManager.removeAuthenticationConfig: src/core/auth/qgsauthmanager.h#L386 -QgsAuthManager.removeCertAuthority: src/core/auth/qgsauthmanager.h#L610 -QgsAuthManager.removeCertIdentity: src/core/auth/qgsauthmanager.h#L538 -QgsAuthManager.removeCertTrustPolicies: src/core/auth/qgsauthmanager.h#L660 -QgsAuthManager.removeCertTrustPolicy: src/core/auth/qgsauthmanager.h#L663 -QgsAuthManager.removeSslCertCustomConfig: src/core/auth/qgsauthmanager.h#L569 -QgsAuthManager.resetMasterPassword: src/core/auth/qgsauthmanager.h#L237 -QgsAuthManager.setDefaultCertTrustPolicy: src/core/auth/qgsauthmanager.h#L673 -QgsAuthManager.setMasterPassword: src/core/auth/qgsauthmanager.h#L194 -QgsAuthManager.setMasterPassword: src/core/auth/qgsauthmanager.h#L202 -QgsAuthManager.setPasswordHelperEnabled: src/core/auth/qgsauthmanager.h#L739 -QgsAuthManager.setScheduledAuthDatabaseEraseRequestEmitted: src/core/auth/qgsauthmanager.h#L267 -QgsAuthManager.setup: src/core/auth/qgsauthmanager.h#L106 -QgsAuthManager.sslCertCustomConfig: src/core/auth/qgsauthmanager.h#L550 -QgsAuthManager.sslCertCustomConfigByHost: src/core/auth/qgsauthmanager.h#L557 -QgsAuthManager.storeAuthSetting: src/core/auth/qgsauthmanager.h#L472 -QgsAuthManager.storeAuthenticationConfig: src/core/auth/qgsauthmanager.h#L363 -QgsAuthManager.storeCertAuthorities: src/core/auth/qgsauthmanager.h#L592 -QgsAuthManager.storeCertAuthority: src/core/auth/qgsauthmanager.h#L595 -QgsAuthManager.storeCertIdentity: src/core/auth/qgsauthmanager.h#L496 -QgsAuthManager.storeCertTrustPolicy: src/core/auth/qgsauthmanager.h#L650 -QgsAuthManager.storeSslCertCustomConfig: src/core/auth/qgsauthmanager.h#L542 -QgsAuthManager.supportedAuthMethodExpansions: src/core/auth/qgsauthmanager.h#L334 -QgsAuthManager.trustedCaCertsPemText: src/core/auth/qgsauthmanager.h#L713 -QgsAuthManager.uniqueConfigId: src/core/auth/qgsauthmanager.h#L337 -QgsAuthManager.updateAuthenticationConfig: src/core/auth/qgsauthmanager.h#L370 -QgsAuthManager.updateConfigAuthMethods: src/core/auth/qgsauthmanager.h#L279 -QgsAuthManager.updateDataSourceUriItems: src/core/auth/qgsauthmanager.h#L456 -QgsAuthManager.updateIgnoredSslErrorsCache: src/core/auth/qgsauthmanager.h#L585 -QgsAuthManager.updateIgnoredSslErrorsCacheFromConfig: src/core/auth/qgsauthmanager.h#L582 -QgsAuthManager.updateNetworkProxy: src/core/auth/qgsauthmanager.h#L466 -QgsAuthManager.updateNetworkReply: src/core/auth/qgsauthmanager.h#L446 -QgsAuthManager.updateNetworkRequest: src/core/auth/qgsauthmanager.h#L436 -QgsAuthManager.verifyMasterPassword: src/core/auth/qgsauthmanager.h#L209 -QgsAuthManager: src/core/auth/qgsauthmanager.h#L70 +QgsAuthManager.authConfigurationStorageRegistry: src/core/auth/qgsauthmanager.h#L127 +QgsAuthManager.authDatabaseChanged: src/core/auth/qgsauthmanager.h#L889 +QgsAuthManager.authDatabaseConfigTable: src/core/auth/qgsauthmanager.h#L140 +QgsAuthManager.authDatabaseConnection: src/core/auth/qgsauthmanager.h#L134 +QgsAuthManager.authDatabaseEraseRequested: src/core/auth/qgsauthmanager.h#L886 +QgsAuthManager.authDatabaseServersTable: src/core/auth/qgsauthmanager.h#L153 +QgsAuthManager.authManTag: src/core/auth/qgsauthmanager.h#L299 +QgsAuthManager.authMethod: src/core/auth/qgsauthmanager.h#L331 +QgsAuthManager.authMethodEditWidget: src/core/auth/qgsauthmanager.h#L355 +QgsAuthManager.authMethodsKeys: src/core/auth/qgsauthmanager.h#L325 +QgsAuthManager.authSetting: src/core/auth/qgsauthmanager.h#L510 +QgsAuthManager.authenticationDatabasePath: src/core/auth/qgsauthmanager.h#L167 +QgsAuthManager.authenticationDatabaseUri: src/core/auth/qgsauthmanager.h#L185 +QgsAuthManager.authenticationDatabaseUriStripped: src/core/auth/qgsauthmanager.h#L191 +QgsAuthManager.availableAuthMethodConfigs: src/core/auth/qgsauthmanager.h#L305 +QgsAuthManager.backupAuthenticationDatabase: src/core/auth/qgsauthmanager.h#L445 +QgsAuthManager.certAuthority: src/core/auth/qgsauthmanager.h#L633 +QgsAuthManager.certIdentity: src/core/auth/qgsauthmanager.h#L532 +QgsAuthManager.certIdentityBundleToPem: src/core/auth/qgsauthmanager.h#L547 +QgsAuthManager.certIdentityIds: src/core/auth/qgsauthmanager.h#L561 +QgsAuthManager.certTrustPolicy: src/core/auth/qgsauthmanager.h#L686 +QgsAuthManager.certificateTrustPolicy: src/core/auth/qgsauthmanager.h#L699 +QgsAuthManager.clearAllCachedConfigs: src/core/auth/qgsauthmanager.h#L893 +QgsAuthManager.clearCachedConfig: src/core/auth/qgsauthmanager.h#L896 +QgsAuthManager.clearMasterPassword: src/core/auth/qgsauthmanager.h#L234 +QgsAuthManager.configAuthMethod: src/core/auth/qgsauthmanager.h#L314 +QgsAuthManager.configAuthMethodKey: src/core/auth/qgsauthmanager.h#L320 +QgsAuthManager.configIdRegex: src/core/auth/qgsauthmanager.h#L381 +QgsAuthManager.configIdUnique: src/core/auth/qgsauthmanager.h#L372 +QgsAuthManager.configIds: src/core/auth/qgsauthmanager.h#L384 +QgsAuthManager.defaultCertTrustPolicy: src/core/auth/qgsauthmanager.h#L705 +QgsAuthManager.disabledMessage: src/core/auth/qgsauthmanager.h#L160 +QgsAuthManager.dumpIgnoredSslErrorsCache_: src/core/auth/qgsauthmanager.h#L608 +QgsAuthManager.ensureInitialized: src/core/auth/qgsauthmanager.h#L119 +QgsAuthManager.eraseAuthenticationDatabase: src/core/auth/qgsauthmanager.h#L453 +QgsAuthManager.existsAuthSetting: src/core/auth/qgsauthmanager.h#L513 +QgsAuthManager.existsCertAuthority: src/core/auth/qgsauthmanager.h#L636 +QgsAuthManager.existsCertIdentity: src/core/auth/qgsauthmanager.h#L564 +QgsAuthManager.existsSslCertCustomConfig: src/core/auth/qgsauthmanager.h#L595 +QgsAuthManager.exportAuthenticationConfigsToXml: src/core/auth/qgsauthmanager.h#L424 +QgsAuthManager.hasConfigId: src/core/auth/qgsauthmanager.h#L378 +QgsAuthManager.importAuthenticationConfigsFromXml: src/core/auth/qgsauthmanager.h#L433 +QgsAuthManager.init: src/core/auth/qgsauthmanager.h#L98 +QgsAuthManager.initSslCaches: src/core/auth/qgsauthmanager.h#L522 +QgsAuthManager.isDisabled: src/core/auth/qgsauthmanager.h#L157 +QgsAuthManager.isFilesystemBasedDatabase: src/core/auth/qgsauthmanager.h#L172 +QgsAuthManager.loadAuthenticationConfig: src/core/auth/qgsauthmanager.h#L408 +QgsAuthManager.masterPasswordHashInDatabase: src/core/auth/qgsauthmanager.h#L228 +QgsAuthManager.masterPasswordIsSet: src/core/auth/qgsauthmanager.h#L225 +QgsAuthManager.masterPasswordSame: src/core/auth/qgsauthmanager.h#L240 +QgsAuthManager.masterPasswordVerified: src/core/auth/qgsauthmanager.h#L883 +QgsAuthManager.messageLog: src/core/auth/qgsauthmanager.h#L857 +QgsAuthManager.messageOut: src/core/auth/qgsauthmanager.h#L847 +QgsAuthManager.methodConfigTableName: src/core/auth/qgsauthmanager.h#L147 +QgsAuthManager.passwordHelperDisplayName: src/core/auth/qgsauthmanager.h#L813 +QgsAuthManager.passwordHelperEnabled: src/core/auth/qgsauthmanager.h#L762 +QgsAuthManager.passwordHelperFailure: src/core/auth/qgsauthmanager.h#L831 +QgsAuthManager.passwordHelperMessageLog: src/core/auth/qgsauthmanager.h#L877 +QgsAuthManager.passwordHelperMessageOut: src/core/auth/qgsauthmanager.h#L867 +QgsAuthManager.passwordHelperSuccess: src/core/auth/qgsauthmanager.h#L837 +QgsAuthManager.passwordHelperSync: src/core/auth/qgsauthmanager.h#L786 +QgsAuthManager.rebuildCaCertsCache: src/core/auth/qgsauthmanager.h#L676 +QgsAuthManager.rebuildCertTrustCache: src/core/auth/qgsauthmanager.h#L714 +QgsAuthManager.rebuildIgnoredSslErrorCache: src/core/auth/qgsauthmanager.h#L617 +QgsAuthManager.rebuildTrustedCaCertsCache: src/core/auth/qgsauthmanager.h#L730 +QgsAuthManager.registerCoreAuthMethods: src/core/auth/qgsauthmanager.h#L302 +QgsAuthManager.removeAllAuthenticationConfigs: src/core/auth/qgsauthmanager.h#L439 +QgsAuthManager.removeAuthSetting: src/core/auth/qgsauthmanager.h#L516 +QgsAuthManager.removeAuthenticationConfig: src/core/auth/qgsauthmanager.h#L415 +QgsAuthManager.removeCertAuthority: src/core/auth/qgsauthmanager.h#L639 +QgsAuthManager.removeCertIdentity: src/core/auth/qgsauthmanager.h#L567 +QgsAuthManager.removeCertTrustPolicies: src/core/auth/qgsauthmanager.h#L689 +QgsAuthManager.removeCertTrustPolicy: src/core/auth/qgsauthmanager.h#L692 +QgsAuthManager.removeSslCertCustomConfig: src/core/auth/qgsauthmanager.h#L598 +QgsAuthManager.resetMasterPassword: src/core/auth/qgsauthmanager.h#L251 +QgsAuthManager.setDefaultCertTrustPolicy: src/core/auth/qgsauthmanager.h#L702 +QgsAuthManager.setMasterPassword: src/core/auth/qgsauthmanager.h#L207 +QgsAuthManager.setMasterPassword: src/core/auth/qgsauthmanager.h#L215 +QgsAuthManager.setPasswordHelperEnabled: src/core/auth/qgsauthmanager.h#L768 +QgsAuthManager.setScheduledAuthDatabaseEraseRequestEmitted: src/core/auth/qgsauthmanager.h#L296 +QgsAuthManager.setup: src/core/auth/qgsauthmanager.h#L110 +QgsAuthManager.sslCertCustomConfig: src/core/auth/qgsauthmanager.h#L579 +QgsAuthManager.sslCertCustomConfigByHost: src/core/auth/qgsauthmanager.h#L586 +QgsAuthManager.storeAuthSetting: src/core/auth/qgsauthmanager.h#L501 +QgsAuthManager.storeAuthenticationConfig: src/core/auth/qgsauthmanager.h#L392 +QgsAuthManager.storeCertAuthorities: src/core/auth/qgsauthmanager.h#L621 +QgsAuthManager.storeCertAuthority: src/core/auth/qgsauthmanager.h#L624 +QgsAuthManager.storeCertIdentity: src/core/auth/qgsauthmanager.h#L525 +QgsAuthManager.storeCertTrustPolicy: src/core/auth/qgsauthmanager.h#L679 +QgsAuthManager.storeSslCertCustomConfig: src/core/auth/qgsauthmanager.h#L571 +QgsAuthManager.supportedAuthMethodExpansions: src/core/auth/qgsauthmanager.h#L363 +QgsAuthManager.trustedCaCertsPemText: src/core/auth/qgsauthmanager.h#L742 +QgsAuthManager.uniqueConfigId: src/core/auth/qgsauthmanager.h#L366 +QgsAuthManager.updateAuthenticationConfig: src/core/auth/qgsauthmanager.h#L399 +QgsAuthManager.updateConfigAuthMethods: src/core/auth/qgsauthmanager.h#L308 +QgsAuthManager.updateDataSourceUriItems: src/core/auth/qgsauthmanager.h#L485 +QgsAuthManager.updateIgnoredSslErrorsCache: src/core/auth/qgsauthmanager.h#L614 +QgsAuthManager.updateIgnoredSslErrorsCacheFromConfig: src/core/auth/qgsauthmanager.h#L611 +QgsAuthManager.updateNetworkProxy: src/core/auth/qgsauthmanager.h#L495 +QgsAuthManager.updateNetworkReply: src/core/auth/qgsauthmanager.h#L475 +QgsAuthManager.updateNetworkRequest: src/core/auth/qgsauthmanager.h#L465 +QgsAuthManager.verifyMasterPassword: src/core/auth/qgsauthmanager.h#L222 +QgsAuthManager: src/core/auth/qgsauthmanager.h#L71 QgsAuthMethod.QgsAuthMethod: src/core/auth/qgsauthmethod.h#L189 QgsAuthMethod.authMethodTag: src/core/auth/qgsauthmethod.h#L192 QgsAuthMethod.clearCachedConfig: src/core/auth/qgsauthmethod.h#L175 @@ -1844,7 +1846,7 @@ QgsBookmarkManagerModel.rowCount: src/core/qgsbookmarkmodel.h#L87 QgsBookmarkManagerModel.setData: src/core/qgsbookmarkmodel.h#L91 QgsBookmarkManagerModel: src/core/qgsbookmarkmodel.h#L41 QgsBookmarkManagerProxyModel: src/core/qgsbookmarkmodel.h#L119 -QgsBox3D.__repr__: src/core/geometry/qgsbox3d.h#L489 +QgsBox3D.__repr__: src/core/geometry/qgsbox3d.h#L498 QgsBox3D.area: src/core/geometry/qgsbox3d.h#L321 QgsBox3D.center: src/core/geometry/qgsbox3d.h#L314 QgsBox3D.combineWith: src/core/geometry/qgsbox3d.h#L382 @@ -1853,18 +1855,19 @@ QgsBox3D.contains: src/core/geometry/qgsbox3d.h#L356 QgsBox3D.contains: src/core/geometry/qgsbox3d.h#L364 QgsBox3D.contains: src/core/geometry/qgsbox3d.h#L375 QgsBox3D.depth: src/core/geometry/qgsbox3d.h#L307 -QgsBox3D.distanceTo: src/core/geometry/qgsbox3d.h#L402 -QgsBox3D.grow: src/core/geometry/qgsbox3d.h#L426 +QgsBox3D.distanceTo: src/core/geometry/qgsbox3d.h#L403 +QgsBox3D.distanceTo: src/core/geometry/qgsbox3d.h#L411 +QgsBox3D.grow: src/core/geometry/qgsbox3d.h#L435 QgsBox3D.height: src/core/geometry/qgsbox3d.h#L300 QgsBox3D.intersect: src/core/geometry/qgsbox3d.h#L331 QgsBox3D.intersects: src/core/geometry/qgsbox3d.h#L351 QgsBox3D.is2d: src/core/geometry/qgsbox3d.h#L337 QgsBox3D.is3D: src/core/geometry/qgsbox3d.h#L346 -QgsBox3D.isEmpty: src/core/geometry/qgsbox3d.h#L447 -QgsBox3D.isNull: src/core/geometry/qgsbox3d.h#L437 +QgsBox3D.isEmpty: src/core/geometry/qgsbox3d.h#L456 +QgsBox3D.isNull: src/core/geometry/qgsbox3d.h#L446 QgsBox3D.normalize: src/core/geometry/qgsbox3d.h#L286 -QgsBox3D.scale: src/core/geometry/qgsbox3d.h#L413 -QgsBox3D.scale: src/core/geometry/qgsbox3d.h#L420 +QgsBox3D.scale: src/core/geometry/qgsbox3d.h#L422 +QgsBox3D.scale: src/core/geometry/qgsbox3d.h#L429 QgsBox3D.set: src/core/geometry/qgsbox3d.h#L190 QgsBox3D.setNull: src/core/geometry/qgsbox3d.h#L281 QgsBox3D.setXMaximum: src/core/geometry/qgsbox3d.h#L204 @@ -1874,7 +1877,7 @@ QgsBox3D.setYMinimum: src/core/geometry/qgsbox3d.h#L225 QgsBox3D.setZMaximum: src/core/geometry/qgsbox3d.h#L260 QgsBox3D.setZMinimum: src/core/geometry/qgsbox3d.h#L253 QgsBox3D.toRectangle: src/core/geometry/qgsbox3d.h#L394 -QgsBox3D.toString: src/core/geometry/qgsbox3d.h#L456 +QgsBox3D.toString: src/core/geometry/qgsbox3d.h#L465 QgsBox3D.volume: src/core/geometry/qgsbox3d.h#L326 QgsBox3D.width: src/core/geometry/qgsbox3d.h#L293 QgsBox3D.xMaximum: src/core/geometry/qgsbox3d.h#L218 @@ -2619,91 +2622,91 @@ QgsCoordinateFormatter.formatX: src/core/qgscoordinateformatter.h#L75 QgsCoordinateFormatter.formatY: src/core/qgscoordinateformatter.h#L88 QgsCoordinateFormatter.separator: src/core/qgscoordinateformatter.h#L116 QgsCoordinateFormatter: src/core/qgscoordinateformatter.h#L39 -QgsCoordinateReferenceSystem.QVariant: src/core/proj/qgscoordinatereferencesystem.h#L280 -QgsCoordinateReferenceSystem.QgsCoordinateReferenceSystem: src/core/proj/qgscoordinatereferencesystem.h#L256 -QgsCoordinateReferenceSystem.QgsCoordinateReferenceSystem: src/core/proj/qgscoordinatereferencesystem.h#L271 -QgsCoordinateReferenceSystem.__repr__: src/core/proj/qgscoordinatereferencesystem.h#L1079 -QgsCoordinateReferenceSystem.authid: src/core/proj/qgscoordinatereferencesystem.h#L658 -QgsCoordinateReferenceSystem.axisOrdering: src/core/proj/qgscoordinatereferencesystem.h#L886 -QgsCoordinateReferenceSystem.bounds: src/core/proj/qgscoordinatereferencesystem.h#L937 -QgsCoordinateReferenceSystem.celestialBodyName: src/core/proj/qgscoordinatereferencesystem.h#L796 -QgsCoordinateReferenceSystem.clearRecentCoordinateReferenceSystems: src/core/proj/qgscoordinatereferencesystem.h#L1158 -QgsCoordinateReferenceSystem.coordinateEpoch: src/core/proj/qgscoordinatereferencesystem.h#L846 -QgsCoordinateReferenceSystem.createCompoundCrs: src/core/proj/qgscoordinatereferencesystem.h#L376 -QgsCoordinateReferenceSystem.createFromId: src/core/proj/qgscoordinatereferencesystem.h#L387 -QgsCoordinateReferenceSystem.createFromOgcWmsCrs: src/core/proj/qgscoordinatereferencesystem.h#L404 -QgsCoordinateReferenceSystem.createFromProj4: src/core/proj/qgscoordinatereferencesystem.h#L477 -QgsCoordinateReferenceSystem.createFromProj: src/core/proj/qgscoordinatereferencesystem.h#L511 -QgsCoordinateReferenceSystem.createFromSrid: src/core/proj/qgscoordinatereferencesystem.h#L415 -QgsCoordinateReferenceSystem.createFromSrsId: src/core/proj/qgscoordinatereferencesystem.h#L449 -QgsCoordinateReferenceSystem.createFromString: src/core/proj/qgscoordinatereferencesystem.h#L533 -QgsCoordinateReferenceSystem.createFromUserInput: src/core/proj/qgscoordinatereferencesystem.h#L555 -QgsCoordinateReferenceSystem.createFromWkt: src/core/proj/qgscoordinatereferencesystem.h#L432 -QgsCoordinateReferenceSystem.datumEnsemble: src/core/proj/qgscoordinatereferencesystem.h#L785 -QgsCoordinateReferenceSystem.description: src/core/proj/qgscoordinatereferencesystem.h#L667 -QgsCoordinateReferenceSystem.ellipsoidAcronym: src/core/proj/qgscoordinatereferencesystem.h#L698 -QgsCoordinateReferenceSystem.factors: src/core/proj/qgscoordinatereferencesystem.h#L859 -QgsCoordinateReferenceSystem.findMatchingProj: src/core/proj/qgscoordinatereferencesystem.h#L596 -QgsCoordinateReferenceSystem.fromEpsgId: src/core/proj/qgscoordinatereferencesystem.h#L313 -QgsCoordinateReferenceSystem.fromOgcWmsCrs: src/core/proj/qgscoordinatereferencesystem.h#L302 -QgsCoordinateReferenceSystem.fromProj4: src/core/proj/qgscoordinatereferencesystem.h#L325 -QgsCoordinateReferenceSystem.fromProj: src/core/proj/qgscoordinatereferencesystem.h#L334 -QgsCoordinateReferenceSystem.fromSrsId: src/core/proj/qgscoordinatereferencesystem.h#L359 -QgsCoordinateReferenceSystem.fromWkt: src/core/proj/qgscoordinatereferencesystem.h#L346 -QgsCoordinateReferenceSystem.geographicCrsAuthId: src/core/proj/qgscoordinatereferencesystem.h#L1076 -QgsCoordinateReferenceSystem.hasAxisInverted: src/core/proj/qgscoordinatereferencesystem.h#L876 -QgsCoordinateReferenceSystem.hasVerticalAxis: src/core/proj/qgscoordinatereferencesystem.h#L1073 -QgsCoordinateReferenceSystem.horizontalCrs: src/core/proj/qgscoordinatereferencesystem.h#L1051 -QgsCoordinateReferenceSystem.invalidateCache: src/core/proj/qgscoordinatereferencesystem.h#L1180 -QgsCoordinateReferenceSystem.isDeprecated: src/core/proj/qgscoordinatereferencesystem.h#L753 -QgsCoordinateReferenceSystem.isDynamic: src/core/proj/qgscoordinatereferencesystem.h#L769 -QgsCoordinateReferenceSystem.isGeographic: src/core/proj/qgscoordinatereferencesystem.h#L759 -QgsCoordinateReferenceSystem.isValid: src/core/proj/qgscoordinatereferencesystem.h#L570 -QgsCoordinateReferenceSystem.mapUnits: src/core/proj/qgscoordinatereferencesystem.h#L928 -QgsCoordinateReferenceSystem.nativeFormat: src/core/proj/qgscoordinatereferencesystem.h#L1028 -QgsCoordinateReferenceSystem.operation: src/core/proj/qgscoordinatereferencesystem.h#L867 -QgsCoordinateReferenceSystem.postgisSrid: src/core/proj/qgscoordinatereferencesystem.h#L644 -QgsCoordinateReferenceSystem.projectionAcronym: src/core/proj/qgscoordinatereferencesystem.h#L690 -QgsCoordinateReferenceSystem.pushRecentCoordinateReferenceSystem: src/core/proj/qgscoordinatereferencesystem.h#L1144 -QgsCoordinateReferenceSystem.readXml: src/core/proj/qgscoordinatereferencesystem.h#L607 -QgsCoordinateReferenceSystem.recentProjections: src/core/proj/qgscoordinatereferencesystem.h#L1130 -QgsCoordinateReferenceSystem.removeRecentCoordinateReferenceSystem: src/core/proj/qgscoordinatereferencesystem.h#L1151 -QgsCoordinateReferenceSystem.saveAsUserCrs: src/core/proj/qgscoordinatereferencesystem.h#L1006 -QgsCoordinateReferenceSystem.setCoordinateEpoch: src/core/proj/qgscoordinatereferencesystem.h#L821 -QgsCoordinateReferenceSystem.setNativeFormat: src/core/proj/qgscoordinatereferencesystem.h#L1017 -QgsCoordinateReferenceSystem.setValidationHint: src/core/proj/qgscoordinatereferencesystem.h#L978 -QgsCoordinateReferenceSystem.setupESRIWktFix: src/core/proj/qgscoordinatereferencesystem.h#L567 -QgsCoordinateReferenceSystem.srsid: src/core/proj/qgscoordinatereferencesystem.h#L636 -QgsCoordinateReferenceSystem.syncDatabase: src/core/proj/qgscoordinatereferencesystem.h#L991 -QgsCoordinateReferenceSystem.toGeographicCrs: src/core/proj/qgscoordinatereferencesystem.h#L1039 -QgsCoordinateReferenceSystem.toOgcUri: src/core/proj/qgscoordinatereferencesystem.h#L945 -QgsCoordinateReferenceSystem.toOgcUrn: src/core/proj/qgscoordinatereferencesystem.h#L953 -QgsCoordinateReferenceSystem.toProj4: src/core/proj/qgscoordinatereferencesystem.h#L725 -QgsCoordinateReferenceSystem.toProj: src/core/proj/qgscoordinatereferencesystem.h#L739 -QgsCoordinateReferenceSystem.toWkt: src/core/proj/qgscoordinatereferencesystem.h#L711 -QgsCoordinateReferenceSystem.type: src/core/proj/qgscoordinatereferencesystem.h#L746 -QgsCoordinateReferenceSystem.updateDefinition: src/core/proj/qgscoordinatereferencesystem.h#L973 -QgsCoordinateReferenceSystem.userFriendlyIdentifier: src/core/proj/qgscoordinatereferencesystem.h#L682 -QgsCoordinateReferenceSystem.validate: src/core/proj/qgscoordinatereferencesystem.h#L584 -QgsCoordinateReferenceSystem.validationHint: src/core/proj/qgscoordinatereferencesystem.h#L983 -QgsCoordinateReferenceSystem.verticalCrs: src/core/proj/qgscoordinatereferencesystem.h#L1065 -QgsCoordinateReferenceSystem.writeXml: src/core/proj/qgscoordinatereferencesystem.h#L615 -QgsCoordinateReferenceSystem: src/core/proj/qgscoordinatereferencesystem.h#L211 +QgsCoordinateReferenceSystem.QVariant: src/core/proj/qgscoordinatereferencesystem.h#L275 +QgsCoordinateReferenceSystem.QgsCoordinateReferenceSystem: src/core/proj/qgscoordinatereferencesystem.h#L251 +QgsCoordinateReferenceSystem.QgsCoordinateReferenceSystem: src/core/proj/qgscoordinatereferencesystem.h#L266 +QgsCoordinateReferenceSystem.__repr__: src/core/proj/qgscoordinatereferencesystem.h#L1066 +QgsCoordinateReferenceSystem.authid: src/core/proj/qgscoordinatereferencesystem.h#L653 +QgsCoordinateReferenceSystem.axisOrdering: src/core/proj/qgscoordinatereferencesystem.h#L873 +QgsCoordinateReferenceSystem.bounds: src/core/proj/qgscoordinatereferencesystem.h#L924 +QgsCoordinateReferenceSystem.celestialBodyName: src/core/proj/qgscoordinatereferencesystem.h#L783 +QgsCoordinateReferenceSystem.clearRecentCoordinateReferenceSystems: src/core/proj/qgscoordinatereferencesystem.h#L1145 +QgsCoordinateReferenceSystem.coordinateEpoch: src/core/proj/qgscoordinatereferencesystem.h#L833 +QgsCoordinateReferenceSystem.createCompoundCrs: src/core/proj/qgscoordinatereferencesystem.h#L371 +QgsCoordinateReferenceSystem.createFromId: src/core/proj/qgscoordinatereferencesystem.h#L382 +QgsCoordinateReferenceSystem.createFromOgcWmsCrs: src/core/proj/qgscoordinatereferencesystem.h#L399 +QgsCoordinateReferenceSystem.createFromProj4: src/core/proj/qgscoordinatereferencesystem.h#L472 +QgsCoordinateReferenceSystem.createFromProj: src/core/proj/qgscoordinatereferencesystem.h#L506 +QgsCoordinateReferenceSystem.createFromSrid: src/core/proj/qgscoordinatereferencesystem.h#L410 +QgsCoordinateReferenceSystem.createFromSrsId: src/core/proj/qgscoordinatereferencesystem.h#L444 +QgsCoordinateReferenceSystem.createFromString: src/core/proj/qgscoordinatereferencesystem.h#L528 +QgsCoordinateReferenceSystem.createFromUserInput: src/core/proj/qgscoordinatereferencesystem.h#L550 +QgsCoordinateReferenceSystem.createFromWkt: src/core/proj/qgscoordinatereferencesystem.h#L427 +QgsCoordinateReferenceSystem.datumEnsemble: src/core/proj/qgscoordinatereferencesystem.h#L776 +QgsCoordinateReferenceSystem.description: src/core/proj/qgscoordinatereferencesystem.h#L662 +QgsCoordinateReferenceSystem.ellipsoidAcronym: src/core/proj/qgscoordinatereferencesystem.h#L693 +QgsCoordinateReferenceSystem.factors: src/core/proj/qgscoordinatereferencesystem.h#L846 +QgsCoordinateReferenceSystem.findMatchingProj: src/core/proj/qgscoordinatereferencesystem.h#L591 +QgsCoordinateReferenceSystem.fromEpsgId: src/core/proj/qgscoordinatereferencesystem.h#L308 +QgsCoordinateReferenceSystem.fromOgcWmsCrs: src/core/proj/qgscoordinatereferencesystem.h#L297 +QgsCoordinateReferenceSystem.fromProj4: src/core/proj/qgscoordinatereferencesystem.h#L320 +QgsCoordinateReferenceSystem.fromProj: src/core/proj/qgscoordinatereferencesystem.h#L329 +QgsCoordinateReferenceSystem.fromSrsId: src/core/proj/qgscoordinatereferencesystem.h#L354 +QgsCoordinateReferenceSystem.fromWkt: src/core/proj/qgscoordinatereferencesystem.h#L341 +QgsCoordinateReferenceSystem.geographicCrsAuthId: src/core/proj/qgscoordinatereferencesystem.h#L1063 +QgsCoordinateReferenceSystem.hasAxisInverted: src/core/proj/qgscoordinatereferencesystem.h#L863 +QgsCoordinateReferenceSystem.hasVerticalAxis: src/core/proj/qgscoordinatereferencesystem.h#L1060 +QgsCoordinateReferenceSystem.horizontalCrs: src/core/proj/qgscoordinatereferencesystem.h#L1038 +QgsCoordinateReferenceSystem.invalidateCache: src/core/proj/qgscoordinatereferencesystem.h#L1167 +QgsCoordinateReferenceSystem.isDeprecated: src/core/proj/qgscoordinatereferencesystem.h#L748 +QgsCoordinateReferenceSystem.isDynamic: src/core/proj/qgscoordinatereferencesystem.h#L764 +QgsCoordinateReferenceSystem.isGeographic: src/core/proj/qgscoordinatereferencesystem.h#L754 +QgsCoordinateReferenceSystem.isValid: src/core/proj/qgscoordinatereferencesystem.h#L565 +QgsCoordinateReferenceSystem.mapUnits: src/core/proj/qgscoordinatereferencesystem.h#L915 +QgsCoordinateReferenceSystem.nativeFormat: src/core/proj/qgscoordinatereferencesystem.h#L1015 +QgsCoordinateReferenceSystem.operation: src/core/proj/qgscoordinatereferencesystem.h#L854 +QgsCoordinateReferenceSystem.postgisSrid: src/core/proj/qgscoordinatereferencesystem.h#L639 +QgsCoordinateReferenceSystem.projectionAcronym: src/core/proj/qgscoordinatereferencesystem.h#L685 +QgsCoordinateReferenceSystem.pushRecentCoordinateReferenceSystem: src/core/proj/qgscoordinatereferencesystem.h#L1131 +QgsCoordinateReferenceSystem.readXml: src/core/proj/qgscoordinatereferencesystem.h#L602 +QgsCoordinateReferenceSystem.recentProjections: src/core/proj/qgscoordinatereferencesystem.h#L1117 +QgsCoordinateReferenceSystem.removeRecentCoordinateReferenceSystem: src/core/proj/qgscoordinatereferencesystem.h#L1138 +QgsCoordinateReferenceSystem.saveAsUserCrs: src/core/proj/qgscoordinatereferencesystem.h#L993 +QgsCoordinateReferenceSystem.setCoordinateEpoch: src/core/proj/qgscoordinatereferencesystem.h#L808 +QgsCoordinateReferenceSystem.setNativeFormat: src/core/proj/qgscoordinatereferencesystem.h#L1004 +QgsCoordinateReferenceSystem.setValidationHint: src/core/proj/qgscoordinatereferencesystem.h#L965 +QgsCoordinateReferenceSystem.setupESRIWktFix: src/core/proj/qgscoordinatereferencesystem.h#L562 +QgsCoordinateReferenceSystem.srsid: src/core/proj/qgscoordinatereferencesystem.h#L631 +QgsCoordinateReferenceSystem.syncDatabase: src/core/proj/qgscoordinatereferencesystem.h#L978 +QgsCoordinateReferenceSystem.toGeographicCrs: src/core/proj/qgscoordinatereferencesystem.h#L1026 +QgsCoordinateReferenceSystem.toOgcUri: src/core/proj/qgscoordinatereferencesystem.h#L932 +QgsCoordinateReferenceSystem.toOgcUrn: src/core/proj/qgscoordinatereferencesystem.h#L940 +QgsCoordinateReferenceSystem.toProj4: src/core/proj/qgscoordinatereferencesystem.h#L720 +QgsCoordinateReferenceSystem.toProj: src/core/proj/qgscoordinatereferencesystem.h#L734 +QgsCoordinateReferenceSystem.toWkt: src/core/proj/qgscoordinatereferencesystem.h#L706 +QgsCoordinateReferenceSystem.type: src/core/proj/qgscoordinatereferencesystem.h#L741 +QgsCoordinateReferenceSystem.updateDefinition: src/core/proj/qgscoordinatereferencesystem.h#L960 +QgsCoordinateReferenceSystem.userFriendlyIdentifier: src/core/proj/qgscoordinatereferencesystem.h#L677 +QgsCoordinateReferenceSystem.validate: src/core/proj/qgscoordinatereferencesystem.h#L579 +QgsCoordinateReferenceSystem.validationHint: src/core/proj/qgscoordinatereferencesystem.h#L970 +QgsCoordinateReferenceSystem.verticalCrs: src/core/proj/qgscoordinatereferencesystem.h#L1052 +QgsCoordinateReferenceSystem.writeXml: src/core/proj/qgscoordinatereferencesystem.h#L610 +QgsCoordinateReferenceSystem: src/core/proj/qgscoordinatereferencesystem.h#L206 QgsCoordinateReferenceSystemRegistry.QgsCoordinateReferenceSystemRegistry: src/core/proj/qgscoordinatereferencesystemregistry.h#L72 QgsCoordinateReferenceSystemRegistry.UserCrsDetails: src/core/proj/qgscoordinatereferencesystemregistry.h#L81 QgsCoordinateReferenceSystemRegistry.addUserCrs: src/core/proj/qgscoordinatereferencesystemregistry.h#L124 -QgsCoordinateReferenceSystemRegistry.clearRecent: src/core/proj/qgscoordinatereferencesystemregistry.h#L222 -QgsCoordinateReferenceSystemRegistry.crsDefinitionsChanged: src/core/proj/qgscoordinatereferencesystemregistry.h#L262 -QgsCoordinateReferenceSystemRegistry.pushRecent: src/core/proj/qgscoordinatereferencesystemregistry.h#L204 -QgsCoordinateReferenceSystemRegistry.recentCrsCleared: src/core/proj/qgscoordinatereferencesystemregistry.h#L289 -QgsCoordinateReferenceSystemRegistry.recentCrsPushed: src/core/proj/qgscoordinatereferencesystemregistry.h#L271 -QgsCoordinateReferenceSystemRegistry.recentCrsRemoved: src/core/proj/qgscoordinatereferencesystemregistry.h#L280 -QgsCoordinateReferenceSystemRegistry.removeRecent: src/core/proj/qgscoordinatereferencesystemregistry.h#L213 +QgsCoordinateReferenceSystemRegistry.clearRecent: src/core/proj/qgscoordinatereferencesystemregistry.h#L218 +QgsCoordinateReferenceSystemRegistry.crsDefinitionsChanged: src/core/proj/qgscoordinatereferencesystemregistry.h#L258 +QgsCoordinateReferenceSystemRegistry.pushRecent: src/core/proj/qgscoordinatereferencesystemregistry.h#L200 +QgsCoordinateReferenceSystemRegistry.recentCrsCleared: src/core/proj/qgscoordinatereferencesystemregistry.h#L285 +QgsCoordinateReferenceSystemRegistry.recentCrsPushed: src/core/proj/qgscoordinatereferencesystemregistry.h#L267 +QgsCoordinateReferenceSystemRegistry.recentCrsRemoved: src/core/proj/qgscoordinatereferencesystemregistry.h#L276 +QgsCoordinateReferenceSystemRegistry.removeRecent: src/core/proj/qgscoordinatereferencesystemregistry.h#L209 QgsCoordinateReferenceSystemRegistry.removeUserCrs: src/core/proj/qgscoordinatereferencesystemregistry.h#L151 QgsCoordinateReferenceSystemRegistry.updateUserCrs: src/core/proj/qgscoordinatereferencesystemregistry.h#L142 -QgsCoordinateReferenceSystemRegistry.userCrsAdded: src/core/proj/qgscoordinatereferencesystemregistry.h#L248 -QgsCoordinateReferenceSystemRegistry.userCrsChanged: src/core/proj/qgscoordinatereferencesystemregistry.h#L238 -QgsCoordinateReferenceSystemRegistry.userCrsRemoved: src/core/proj/qgscoordinatereferencesystemregistry.h#L256 +QgsCoordinateReferenceSystemRegistry.userCrsAdded: src/core/proj/qgscoordinatereferencesystemregistry.h#L244 +QgsCoordinateReferenceSystemRegistry.userCrsChanged: src/core/proj/qgscoordinatereferencesystemregistry.h#L234 +QgsCoordinateReferenceSystemRegistry.userCrsRemoved: src/core/proj/qgscoordinatereferencesystemregistry.h#L252 QgsCoordinateReferenceSystemRegistry: src/core/proj/qgscoordinatereferencesystemregistry.h#L64 QgsCoordinateReferenceSystemUtils.axisDirectionToAbbreviatedString: src/core/proj/qgscoordinatereferencesystemutils.h#L47 QgsCoordinateReferenceSystemUtils.crsTypeToString: src/core/proj/qgscoordinatereferencesystemutils.h#L53 @@ -2713,41 +2716,41 @@ QgsCoordinateReferenceSystemUtils: src/core/proj/qgscoordinatereferencesystemuti QgsCoordinateTransform.QgsCoordinateTransform: src/core/proj/qgscoordinatetransform.h#L121 QgsCoordinateTransform.QgsCoordinateTransform: src/core/proj/qgscoordinatetransform.h#L133 QgsCoordinateTransform.QgsCoordinateTransform: src/core/proj/qgscoordinatetransform.h#L91 -QgsCoordinateTransform.__repr__: src/core/proj/qgscoordinatetransform.h#L616 -QgsCoordinateTransform.allowFallbackTransforms: src/core/proj/qgscoordinatetransform.h#L460 +QgsCoordinateTransform.__repr__: src/core/proj/qgscoordinatetransform.h#L617 +QgsCoordinateTransform.allowFallbackTransforms: src/core/proj/qgscoordinatetransform.h#L461 QgsCoordinateTransform.context: src/core/proj/qgscoordinatetransform.h#L195 -QgsCoordinateTransform.coordinateOperation: src/core/proj/qgscoordinatetransform.h#L401 +QgsCoordinateTransform.coordinateOperation: src/core/proj/qgscoordinatetransform.h#L402 QgsCoordinateTransform.destinationCrs: src/core/proj/qgscoordinatetransform.h#L211 -QgsCoordinateTransform.destinationDatumTransformId: src/core/proj/qgscoordinatetransform.h#L564 -QgsCoordinateTransform.disableFallbackOperationHandler: src/core/proj/qgscoordinatetransform.h#L509 -QgsCoordinateTransform.fallbackOperationOccurred: src/core/proj/qgscoordinatetransform.h#L519 -QgsCoordinateTransform.hasVerticalComponent: src/core/proj/qgscoordinatetransform.h#L383 -QgsCoordinateTransform.instantiatedCoordinateOperationDetails: src/core/proj/qgscoordinatetransform.h#L416 -QgsCoordinateTransform.invalidateCache: src/core/proj/qgscoordinatetransform.h#L601 -QgsCoordinateTransform.isShortCircuited: src/core/proj/qgscoordinatetransform.h#L375 +QgsCoordinateTransform.destinationDatumTransformId: src/core/proj/qgscoordinatetransform.h#L565 +QgsCoordinateTransform.disableFallbackOperationHandler: src/core/proj/qgscoordinatetransform.h#L510 +QgsCoordinateTransform.fallbackOperationOccurred: src/core/proj/qgscoordinatetransform.h#L520 +QgsCoordinateTransform.hasVerticalComponent: src/core/proj/qgscoordinatetransform.h#L384 +QgsCoordinateTransform.instantiatedCoordinateOperationDetails: src/core/proj/qgscoordinatetransform.h#L417 +QgsCoordinateTransform.invalidateCache: src/core/proj/qgscoordinatetransform.h#L602 +QgsCoordinateTransform.isShortCircuited: src/core/proj/qgscoordinatetransform.h#L376 QgsCoordinateTransform.isTransformationPossible: src/core/proj/qgscoordinatetransform.h#L158 QgsCoordinateTransform.isValid: src/core/proj/qgscoordinatetransform.h#L164 -QgsCoordinateTransform.scaleFactor: src/core/proj/qgscoordinatetransform.h#L613 -QgsCoordinateTransform.setAllowFallbackTransforms: src/core/proj/qgscoordinatetransform.h#L447 -QgsCoordinateTransform.setBallparkTransformsAreAppropriate: src/core/proj/qgscoordinatetransform.h#L493 +QgsCoordinateTransform.scaleFactor: src/core/proj/qgscoordinatetransform.h#L614 +QgsCoordinateTransform.setAllowFallbackTransforms: src/core/proj/qgscoordinatetransform.h#L448 +QgsCoordinateTransform.setBallparkTransformsAreAppropriate: src/core/proj/qgscoordinatetransform.h#L494 QgsCoordinateTransform.setContext: src/core/proj/qgscoordinatetransform.h#L187 -QgsCoordinateTransform.setCoordinateOperation: src/core/proj/qgscoordinatetransform.h#L431 +QgsCoordinateTransform.setCoordinateOperation: src/core/proj/qgscoordinatetransform.h#L432 QgsCoordinateTransform.setDestinationCrs: src/core/proj/qgscoordinatetransform.h#L180 -QgsCoordinateTransform.setDestinationDatumTransformId: src/core/proj/qgscoordinatetransform.h#L579 +QgsCoordinateTransform.setDestinationDatumTransformId: src/core/proj/qgscoordinatetransform.h#L580 QgsCoordinateTransform.setSourceCrs: src/core/proj/qgscoordinatetransform.h#L172 -QgsCoordinateTransform.setSourceDatumTransformId: src/core/proj/qgscoordinatetransform.h#L549 +QgsCoordinateTransform.setSourceDatumTransformId: src/core/proj/qgscoordinatetransform.h#L550 QgsCoordinateTransform.sourceCrs: src/core/proj/qgscoordinatetransform.h#L203 -QgsCoordinateTransform.sourceDatumTransformId: src/core/proj/qgscoordinatetransform.h#L534 +QgsCoordinateTransform.sourceDatumTransformId: src/core/proj/qgscoordinatetransform.h#L535 QgsCoordinateTransform.transform: src/core/proj/qgscoordinatetransform.h#L222 QgsCoordinateTransform.transform: src/core/proj/qgscoordinatetransform.h#L234 QgsCoordinateTransform.transform: src/core/proj/qgscoordinatetransform.h#L246 -QgsCoordinateTransform.transform: src/core/proj/qgscoordinatetransform.h#L357 -QgsCoordinateTransform.transformBoundingBox: src/core/proj/qgscoordinatetransform.h#L262 -QgsCoordinateTransform.transformCoords: src/core/proj/qgscoordinatetransform.h#L370 -QgsCoordinateTransform.transformInPlace: src/core/proj/qgscoordinatetransform.h#L276 -QgsCoordinateTransform.transformInPlace: src/core/proj/qgscoordinatetransform.h#L321 -QgsCoordinateTransform.transformInPlace: src/core/proj/qgscoordinatetransform.h#L337 -QgsCoordinateTransform.transformPolygon: src/core/proj/qgscoordinatetransform.h#L346 +QgsCoordinateTransform.transform: src/core/proj/qgscoordinatetransform.h#L358 +QgsCoordinateTransform.transformBoundingBox: src/core/proj/qgscoordinatetransform.h#L263 +QgsCoordinateTransform.transformCoords: src/core/proj/qgscoordinatetransform.h#L371 +QgsCoordinateTransform.transformInPlace: src/core/proj/qgscoordinatetransform.h#L277 +QgsCoordinateTransform.transformInPlace: src/core/proj/qgscoordinatetransform.h#L322 +QgsCoordinateTransform.transformInPlace: src/core/proj/qgscoordinatetransform.h#L338 +QgsCoordinateTransform.transformPolygon: src/core/proj/qgscoordinatetransform.h#L347 QgsCoordinateTransform: src/core/proj/qgscoordinatetransform.h#L57 QgsCoordinateTransformContext.addCoordinateOperation: src/core/proj/qgscoordinatetransformcontext.h#L159 QgsCoordinateTransformContext.addSourceDestinationDatumTransform: src/core/proj/qgscoordinatetransformcontext.h#L126 @@ -3518,6 +3521,7 @@ QgsDistanceArea.sourceCrs: src/core/qgsdistancearea.h#L80 QgsDistanceArea.splitGeometryAtAntimeridian: src/core/qgsdistancearea.h#L359 QgsDistanceArea.willUseEllipsoid: src/core/qgsdistancearea.h#L67 QgsDistanceArea: src/core/qgsdistancearea.h#L52 +QgsDoubleBoxScaleBarRenderer.applyDefaultSettings: src/core/scalebar/qgsdoubleboxscalebarrenderer.h#L45 QgsDoubleBoxScaleBarRenderer.clone: src/core/scalebar/qgsdoubleboxscalebarrenderer.h#L39 QgsDoubleBoxScaleBarRenderer.draw: src/core/scalebar/qgsdoubleboxscalebarrenderer.h#L41 QgsDoubleBoxScaleBarRenderer.flags: src/core/scalebar/qgsdoubleboxscalebarrenderer.h#L37 @@ -5816,14 +5820,14 @@ QgsHtmlAnnotation: src/core/annotations/qgshtmlannotation.h#L34 QgsHtmlUtils.buildBulletList: src/core/qgshtmlutils.h#L38 QgsHtmlUtils: src/core/qgshtmlutils.h#L30 QgsHttpHeaders.headers: src/core/network/qgshttpheaders.h#L93 -QgsHttpHeaders.insert: src/core/network/qgshttpheaders.h#L190 -QgsHttpHeaders.sanitizeKey: src/core/network/qgshttpheaders.h#L175 -QgsHttpHeaders.setFromDomElement: src/core/network/qgshttpheaders.h#L169 -QgsHttpHeaders.setFromMap: src/core/network/qgshttpheaders.h#L160 -QgsHttpHeaders.setFromSettings: src/core/network/qgshttpheaders.h#L145 -QgsHttpHeaders.setFromUrlQuery: src/core/network/qgshttpheaders.h#L151 -QgsHttpHeaders.toSpacedString: src/core/network/qgshttpheaders.h#L198 -QgsHttpHeaders.updateDomElement: src/core/network/qgshttpheaders.h#L135 +QgsHttpHeaders.insert: src/core/network/qgshttpheaders.h#L203 +QgsHttpHeaders.sanitizeKey: src/core/network/qgshttpheaders.h#L188 +QgsHttpHeaders.setFromDomElement: src/core/network/qgshttpheaders.h#L182 +QgsHttpHeaders.setFromMap: src/core/network/qgshttpheaders.h#L173 +QgsHttpHeaders.setFromSettings: src/core/network/qgshttpheaders.h#L158 +QgsHttpHeaders.setFromUrlQuery: src/core/network/qgshttpheaders.h#L164 +QgsHttpHeaders.toSpacedString: src/core/network/qgshttpheaders.h#L211 +QgsHttpHeaders.updateDomElement: src/core/network/qgshttpheaders.h#L137 QgsHttpHeaders.updateMap: src/core/network/qgshttpheaders.h#L126 QgsHttpHeaders.updateNetworkRequest: src/core/network/qgshttpheaders.h#L111 QgsHttpHeaders.updateSettings: src/core/network/qgshttpheaders.h#L105 @@ -6605,22 +6609,23 @@ QgsLayerTreeNode.willRemoveChildren: src/core/layertree/qgslayertreenode.h#L247 QgsLayerTreeNode.writeCommonXml: src/core/layertree/qgslayertreenode.h#L273 QgsLayerTreeNode.writeXml: src/core/layertree/qgslayertreenode.h#L156 QgsLayerTreeNode: src/core/layertree/qgslayertreenode.h#L76 -QgsLayerTreeRegistryBridge.QgsLayerTreeRegistryBridge: src/core/layertree/qgslayertreeregistrybridge.h#L65 -QgsLayerTreeRegistryBridge.addedLayersToLayerTree: src/core/layertree/qgslayertreeregistrybridge.h#L104 -QgsLayerTreeRegistryBridge.groupRemovedChildren: src/core/layertree/qgslayertreeregistrybridge.h#L111 -QgsLayerTreeRegistryBridge.groupWillRemoveChildren: src/core/layertree/qgslayertreeregistrybridge.h#L110 -QgsLayerTreeRegistryBridge.isEnabled: src/core/layertree/qgslayertreeregistrybridge.h#L68 -QgsLayerTreeRegistryBridge.layerInsertionMethod: src/core/layertree/qgslayertreeregistrybridge.h#L97 -QgsLayerTreeRegistryBridge.layersAdded: src/core/layertree/qgslayertreeregistrybridge.h#L107 -QgsLayerTreeRegistryBridge.layersWillBeRemoved: src/core/layertree/qgslayertreeregistrybridge.h#L108 -QgsLayerTreeRegistryBridge.newLayersVisible: src/core/layertree/qgslayertreeregistrybridge.h#L71 -QgsLayerTreeRegistryBridge.removeLayersFromRegistry: src/core/layertree/qgslayertreeregistrybridge.h#L113 -QgsLayerTreeRegistryBridge.setEnabled: src/core/layertree/qgslayertreeregistrybridge.h#L67 -QgsLayerTreeRegistryBridge.setLayerInsertionMethod: src/core/layertree/qgslayertreeregistrybridge.h#L91 -QgsLayerTreeRegistryBridge.setLayerInsertionPoint: src/core/layertree/qgslayertreeregistrybridge.h#L78 -QgsLayerTreeRegistryBridge.setLayerInsertionPoint: src/core/layertree/qgslayertreeregistrybridge.h#L85 -QgsLayerTreeRegistryBridge.setNewLayersVisible: src/core/layertree/qgslayertreeregistrybridge.h#L70 -QgsLayerTreeRegistryBridge: src/core/layertree/qgslayertreeregistrybridge.h#L44 +QgsLayerTreeRegistryBridge.QgsLayerTreeRegistryBridge: src/core/layertree/qgslayertreeregistrybridge.h#L66 +QgsLayerTreeRegistryBridge.addedLayersToLayerTree: src/core/layertree/qgslayertreeregistrybridge.h#L111 +QgsLayerTreeRegistryBridge.groupRemovedChildren: src/core/layertree/qgslayertreeregistrybridge.h#L118 +QgsLayerTreeRegistryBridge.groupWillRemoveChildren: src/core/layertree/qgslayertreeregistrybridge.h#L117 +QgsLayerTreeRegistryBridge.isEnabled: src/core/layertree/qgslayertreeregistrybridge.h#L69 +QgsLayerTreeRegistryBridge.layerInsertionMethod: src/core/layertree/qgslayertreeregistrybridge.h#L104 +QgsLayerTreeRegistryBridge.layerInsertionPoint: src/core/layertree/qgslayertreeregistrybridge.h#L92 +QgsLayerTreeRegistryBridge.layersAdded: src/core/layertree/qgslayertreeregistrybridge.h#L114 +QgsLayerTreeRegistryBridge.layersWillBeRemoved: src/core/layertree/qgslayertreeregistrybridge.h#L115 +QgsLayerTreeRegistryBridge.newLayersVisible: src/core/layertree/qgslayertreeregistrybridge.h#L72 +QgsLayerTreeRegistryBridge.removeLayersFromRegistry: src/core/layertree/qgslayertreeregistrybridge.h#L120 +QgsLayerTreeRegistryBridge.setEnabled: src/core/layertree/qgslayertreeregistrybridge.h#L68 +QgsLayerTreeRegistryBridge.setLayerInsertionMethod: src/core/layertree/qgslayertreeregistrybridge.h#L98 +QgsLayerTreeRegistryBridge.setLayerInsertionPoint: src/core/layertree/qgslayertreeregistrybridge.h#L79 +QgsLayerTreeRegistryBridge.setLayerInsertionPoint: src/core/layertree/qgslayertreeregistrybridge.h#L86 +QgsLayerTreeRegistryBridge.setNewLayersVisible: src/core/layertree/qgslayertreeregistrybridge.h#L71 +QgsLayerTreeRegistryBridge: src/core/layertree/qgslayertreeregistrybridge.h#L45 QgsLayerTreeUtils.checkStateFromXml: src/core/layertree/qgslayertreeutils.h#L53 QgsLayerTreeUtils.checkStateToXml: src/core/layertree/qgslayertreeutils.h#L51 QgsLayerTreeUtils.countMapLayerInTree: src/core/layertree/qgslayertreeutils.h#L121 @@ -6758,28 +6763,28 @@ QgsLayoutEffect.compositionMode: src/core/layout/qgslayouteffect.h#L60 QgsLayoutEffect.draw: src/core/layout/qgslayouteffect.h#L64 QgsLayoutEffect.setCompositionMode: src/core/layout/qgslayouteffect.h#L51 QgsLayoutEffect: src/core/layout/qgslayouteffect.h#L36 -QgsLayoutExporter.computeWorldFileParameters: src/core/layout/qgslayoutexporter.h#L676 -QgsLayoutExporter.computeWorldFileParameters: src/core/layout/qgslayoutexporter.h#L683 -QgsLayoutExporter.containsAdvancedEffects: src/core/layout/qgslayoutexporter.h#L702 -QgsLayoutExporter.errorFile: src/core/layout/qgslayoutexporter.h#L620 -QgsLayoutExporter.errorMessage: src/core/layout/qgslayoutexporter.h#L627 +QgsLayoutExporter.computeWorldFileParameters: src/core/layout/qgslayoutexporter.h#L678 +QgsLayoutExporter.computeWorldFileParameters: src/core/layout/qgslayoutexporter.h#L685 +QgsLayoutExporter.containsAdvancedEffects: src/core/layout/qgslayoutexporter.h#L704 +QgsLayoutExporter.errorFile: src/core/layout/qgslayoutexporter.h#L622 +QgsLayoutExporter.errorMessage: src/core/layout/qgslayoutexporter.h#L629 QgsLayoutExporter.exportToImage: src/core/layout/qgslayoutexporter.h#L258 QgsLayoutExporter.exportToImage: src/core/layout/qgslayoutexporter.h#L271 -QgsLayoutExporter.exportToPdf: src/core/layout/qgslayoutexporter.h#L418 -QgsLayoutExporter.exportToPdf: src/core/layout/qgslayoutexporter.h#L431 -QgsLayoutExporter.exportToPdfs: src/core/layout/qgslayoutexporter.h#L447 -QgsLayoutExporter.exportToSvg: src/core/layout/qgslayoutexporter.h#L599 -QgsLayoutExporter.exportToSvg: src/core/layout/qgslayoutexporter.h#L611 -QgsLayoutExporter.generateFileName: src/core/layout/qgslayoutexporter.h#L711 -QgsLayoutExporter.georeferenceOutput: src/core/layout/qgslayoutexporter.h#L667 +QgsLayoutExporter.exportToPdf: src/core/layout/qgslayoutexporter.h#L420 +QgsLayoutExporter.exportToPdf: src/core/layout/qgslayoutexporter.h#L433 +QgsLayoutExporter.exportToPdfs: src/core/layout/qgslayoutexporter.h#L449 +QgsLayoutExporter.exportToSvg: src/core/layout/qgslayoutexporter.h#L601 +QgsLayoutExporter.exportToSvg: src/core/layout/qgslayoutexporter.h#L613 +QgsLayoutExporter.generateFileName: src/core/layout/qgslayoutexporter.h#L713 +QgsLayoutExporter.georeferenceOutput: src/core/layout/qgslayoutexporter.h#L669 QgsLayoutExporter.layout: src/core/layout/qgslayoutexporter.h#L94 -QgsLayoutExporter.print: src/core/layout/qgslayoutexporter.h#L492 -QgsLayoutExporter.print: src/core/layout/qgslayoutexporter.h#L501 +QgsLayoutExporter.print: src/core/layout/qgslayoutexporter.h#L494 +QgsLayoutExporter.print: src/core/layout/qgslayoutexporter.h#L503 QgsLayoutExporter.renderPage: src/core/layout/qgslayoutexporter.h#L104 QgsLayoutExporter.renderPageToImage: src/core/layout/qgslayoutexporter.h#L124 QgsLayoutExporter.renderRegion: src/core/layout/qgslayoutexporter.h#L133 QgsLayoutExporter.renderRegionToImage: src/core/layout/qgslayoutexporter.h#L151 -QgsLayoutExporter.requiresRasterization: src/core/layout/qgslayoutexporter.h#L693 +QgsLayoutExporter.requiresRasterization: src/core/layout/qgslayoutexporter.h#L695 QgsLayoutExporter: src/core/layout/qgslayoutexporter.h#L51 QgsLayoutFrame.cleanup: src/core/layout/qgslayoutframe.h#L54 QgsLayoutFrame.create: src/core/layout/qgslayoutframe.h#L46 @@ -8743,15 +8748,15 @@ QgsLocatorProxyModel: src/core/locator/qgslocatormodel.h#L212 QgsLocatorResult.setUserData: src/core/locator/qgslocatorfilter.h#L73 QgsLocatorResult.userData: src/core/locator/qgslocatorfilter.h#L66 QgsLocatorResult: src/core/locator/qgslocatorfilter.h#L37 -QgsLogger.critical: src/core/qgslogger.h#L99 -QgsLogger.debug: src/core/qgslogger.h#L72 -QgsLogger.debug: src/core/qgslogger.h#L75 -QgsLogger.debugLevel: src/core/qgslogger.h#L113 -QgsLogger.fatal: src/core/qgslogger.h#L102 -QgsLogger.logFile: src/core/qgslogger.h#L122 -QgsLogger.logMessageToFile: src/core/qgslogger.h#L116 -QgsLogger.warning: src/core/qgslogger.h#L96 -QgsLogger: src/core/qgslogger.h#L60 +QgsLogger.critical: src/core/qgslogger.h#L103 +QgsLogger.debug: src/core/qgslogger.h#L76 +QgsLogger.debug: src/core/qgslogger.h#L79 +QgsLogger.debugLevel: src/core/qgslogger.h#L117 +QgsLogger.fatal: src/core/qgslogger.h#L106 +QgsLogger.logFile: src/core/qgslogger.h#L126 +QgsLogger.logMessageToFile: src/core/qgslogger.h#L120 +QgsLogger.warning: src/core/qgslogger.h#L100 +QgsLogger: src/core/qgslogger.h#L64 QgsManhattanLineCallout.clone: src/core/callouts/qgscallout.h#L765 QgsManhattanLineCallout.create: src/core/callouts/qgscallout.h#L762 QgsManhattanLineCallout.createCalloutLine: src/core/callouts/qgscallout.h#L768 @@ -8862,218 +8867,218 @@ QgsMapInfoSymbolConverter.convertFillSymbol: src/core/symbology/qgsmapinfosymbol QgsMapInfoSymbolConverter.convertLineSymbol: src/core/symbology/qgsmapinfosymbolconverter.h#L75 QgsMapInfoSymbolConverter.convertMarkerSymbol: src/core/symbology/qgsmapinfosymbolconverter.h#L91 QgsMapInfoSymbolConverter: src/core/symbology/qgsmapinfosymbolconverter.h#L66 -QgsMapLayer.__repr__: src/core/qgsmaplayer.h#L1893 +QgsMapLayer.__repr__: src/core/qgsmaplayer.h#L1896 QgsMapLayer.abstract: src/core/qgsmaplayer.h#L355 -QgsMapLayer.accept: src/core/qgsmaplayer.h#L1720 -QgsMapLayer.appendError: src/core/qgsmaplayer.h#L2257 +QgsMapLayer.accept: src/core/qgsmaplayer.h#L1723 +QgsMapLayer.appendError: src/core/qgsmaplayer.h#L2260 QgsMapLayer.attribution: src/core/qgsmaplayer.h#L411 QgsMapLayer.attributionUrl: src/core/qgsmaplayer.h#L425 -QgsMapLayer.autoRefreshInterval: src/core/qgsmaplayer.h#L1614 -QgsMapLayer.autoRefreshIntervalChanged: src/core/qgsmaplayer.h#L2058 -QgsMapLayer.autoRefreshMode: src/core/qgsmaplayer.h#L1606 -QgsMapLayer.beforeResolveReferences: src/core/qgsmaplayer.h#L1916 +QgsMapLayer.autoRefreshInterval: src/core/qgsmaplayer.h#L1617 +QgsMapLayer.autoRefreshIntervalChanged: src/core/qgsmaplayer.h#L2061 +QgsMapLayer.autoRefreshMode: src/core/qgsmaplayer.h#L1609 +QgsMapLayer.beforeResolveReferences: src/core/qgsmaplayer.h#L1919 QgsMapLayer.blendMode: src/core/qgsmaplayer.h#L515 -QgsMapLayer.blendModeChanged: src/core/qgsmaplayer.h#L1989 +QgsMapLayer.blendModeChanged: src/core/qgsmaplayer.h#L1992 QgsMapLayer.clone: src/core/qgsmaplayer.h#L213 -QgsMapLayer.clone: src/core/qgsmaplayer.h#L2165 -QgsMapLayer.configChanged: src/core/qgsmaplayer.h#L2040 +QgsMapLayer.clone: src/core/qgsmaplayer.h#L2168 +QgsMapLayer.configChanged: src/core/qgsmaplayer.h#L2043 QgsMapLayer.createMapRenderer: src/core/qgsmaplayer.h#L548 -QgsMapLayer.crs3D: src/core/qgsmaplayer.h#L1030 -QgsMapLayer.crs3DChanged: src/core/qgsmaplayer.h#L1955 -QgsMapLayer.crs: src/core/qgsmaplayer.h#L990 -QgsMapLayer.crsChanged: src/core/qgsmaplayer.h#L1944 -QgsMapLayer.customProperty: src/core/qgsmaplayer.h#L717 -QgsMapLayer.customPropertyChanged: src/core/qgsmaplayer.h#L2103 -QgsMapLayer.customPropertyKeys: src/core/qgsmaplayer.h#L704 -QgsMapLayer.dataChanged: src/core/qgsmaplayer.h#L1986 +QgsMapLayer.crs3D: src/core/qgsmaplayer.h#L1033 +QgsMapLayer.crs3DChanged: src/core/qgsmaplayer.h#L1958 +QgsMapLayer.crs: src/core/qgsmaplayer.h#L993 +QgsMapLayer.crsChanged: src/core/qgsmaplayer.h#L1947 +QgsMapLayer.customProperty: src/core/qgsmaplayer.h#L720 +QgsMapLayer.customPropertyChanged: src/core/qgsmaplayer.h#L2106 +QgsMapLayer.customPropertyKeys: src/core/qgsmaplayer.h#L707 +QgsMapLayer.dataChanged: src/core/qgsmaplayer.h#L1989 QgsMapLayer.dataProvider: src/core/qgsmaplayer.h#L301 -QgsMapLayer.dataSourceChanged: src/core/qgsmaplayer.h#L2082 +QgsMapLayer.dataSourceChanged: src/core/qgsmaplayer.h#L2085 QgsMapLayer.dataUrl: src/core/qgsmaplayer.h#L383 QgsMapLayer.dataUrlFormat: src/core/qgsmaplayer.h#L397 -QgsMapLayer.decodedSource: src/core/qgsmaplayer.h#L2216 -QgsMapLayer.deleteStyleFromDatabase: src/core/qgsmaplayer.h#L754 -QgsMapLayer.dependenciesChanged: src/core/qgsmaplayer.h#L2045 -QgsMapLayer.editingStarted: src/core/qgsmaplayer.h#L2109 -QgsMapLayer.editingStopped: src/core/qgsmaplayer.h#L2115 -QgsMapLayer.elevationProperties: src/core/qgsmaplayer.h#L1741 -QgsMapLayer.emitStyleChanged: src/core/qgsmaplayer.h#L1860 -QgsMapLayer.encodedSource: src/core/qgsmaplayer.h#L2202 -QgsMapLayer.error: src/core/qgsmaplayer.h#L977 -QgsMapLayer.exportNamedMetadata: src/core/qgsmaplayer.h#L1092 -QgsMapLayer.exportNamedStyle: src/core/qgsmaplayer.h#L1240 -QgsMapLayer.exportSldStyle: src/core/qgsmaplayer.h#L1251 -QgsMapLayer.exportSldStyleV2: src/core/qgsmaplayer.h#L1261 +QgsMapLayer.decodedSource: src/core/qgsmaplayer.h#L2219 +QgsMapLayer.deleteStyleFromDatabase: src/core/qgsmaplayer.h#L757 +QgsMapLayer.dependenciesChanged: src/core/qgsmaplayer.h#L2048 +QgsMapLayer.editingStarted: src/core/qgsmaplayer.h#L2112 +QgsMapLayer.editingStopped: src/core/qgsmaplayer.h#L2118 +QgsMapLayer.elevationProperties: src/core/qgsmaplayer.h#L1744 +QgsMapLayer.emitStyleChanged: src/core/qgsmaplayer.h#L1863 +QgsMapLayer.encodedSource: src/core/qgsmaplayer.h#L2205 +QgsMapLayer.error: src/core/qgsmaplayer.h#L980 +QgsMapLayer.exportNamedMetadata: src/core/qgsmaplayer.h#L1095 +QgsMapLayer.exportNamedStyle: src/core/qgsmaplayer.h#L1243 +QgsMapLayer.exportSldStyle: src/core/qgsmaplayer.h#L1254 +QgsMapLayer.exportSldStyleV2: src/core/qgsmaplayer.h#L1264 QgsMapLayer.extensionPropertyType: src/core/qgsmaplayer.h#L259 QgsMapLayer.extent3D: src/core/qgsmaplayer.h#L557 QgsMapLayer.extent: src/core/qgsmaplayer.h#L551 QgsMapLayer.flags: src/core/qgsmaplayer.h#L230 -QgsMapLayer.flagsChanged: src/core/qgsmaplayer.h#L2073 -QgsMapLayer.formatLayerName: src/core/qgsmaplayer.h#L1077 -QgsMapLayer.generateId: src/core/qgsmaplayer.h#L1709 -QgsMapLayer.getStyleFromDatabase: src/core/qgsmaplayer.h#L746 -QgsMapLayer.hasAutoRefreshEnabled: src/core/qgsmaplayer.h#L1598 -QgsMapLayer.hasDependencyCycle: src/core/qgsmaplayer.h#L2293 -QgsMapLayer.hasMapTips: src/core/qgsmaplayer.h#L1763 -QgsMapLayer.hasScaleBasedVisibility: src/core/qgsmaplayer.h#L1590 -QgsMapLayer.htmlMetadata: src/core/qgsmaplayer.h#L1661 +QgsMapLayer.flagsChanged: src/core/qgsmaplayer.h#L2076 +QgsMapLayer.formatLayerName: src/core/qgsmaplayer.h#L1080 +QgsMapLayer.generateId: src/core/qgsmaplayer.h#L1712 +QgsMapLayer.getStyleFromDatabase: src/core/qgsmaplayer.h#L749 +QgsMapLayer.hasAutoRefreshEnabled: src/core/qgsmaplayer.h#L1601 +QgsMapLayer.hasDependencyCycle: src/core/qgsmaplayer.h#L2296 +QgsMapLayer.hasMapTips: src/core/qgsmaplayer.h#L1766 +QgsMapLayer.hasScaleBasedVisibility: src/core/qgsmaplayer.h#L1593 +QgsMapLayer.htmlMetadata: src/core/qgsmaplayer.h#L1664 QgsMapLayer.id: src/core/qgsmaplayer.h#L267 -QgsMapLayer.idChanged: src/core/qgsmaplayer.h#L1929 -QgsMapLayer.importNamedMetadata: src/core/qgsmaplayer.h#L1165 -QgsMapLayer.importNamedStyle: src/core/qgsmaplayer.h#L1229 -QgsMapLayer.invalidateWgs84Extent: src/core/qgsmaplayer.h#L2267 -QgsMapLayer.isEditable: src/core/qgsmaplayer.h#L620 -QgsMapLayer.isInScaleRange: src/core/qgsmaplayer.h#L1556 -QgsMapLayer.isModified: src/core/qgsmaplayer.h#L627 -QgsMapLayer.isRefreshOnNotifyEnabled: src/core/qgsmaplayer.h#L1684 -QgsMapLayer.isSpatial: src/core/qgsmaplayer.h#L632 -QgsMapLayer.isTemporary: src/core/qgsmaplayer.h#L643 +QgsMapLayer.idChanged: src/core/qgsmaplayer.h#L1932 +QgsMapLayer.importNamedMetadata: src/core/qgsmaplayer.h#L1168 +QgsMapLayer.importNamedStyle: src/core/qgsmaplayer.h#L1232 +QgsMapLayer.invalidateWgs84Extent: src/core/qgsmaplayer.h#L2270 +QgsMapLayer.isEditable: src/core/qgsmaplayer.h#L623 +QgsMapLayer.isInScaleRange: src/core/qgsmaplayer.h#L1559 +QgsMapLayer.isModified: src/core/qgsmaplayer.h#L630 +QgsMapLayer.isRefreshOnNotifyEnabled: src/core/qgsmaplayer.h#L1687 +QgsMapLayer.isSpatial: src/core/qgsmaplayer.h#L635 +QgsMapLayer.isTemporary: src/core/qgsmaplayer.h#L646 QgsMapLayer.isValid: src/core/qgsmaplayer.h#L574 -QgsMapLayer.isValidChanged: src/core/qgsmaplayer.h#L2096 +QgsMapLayer.isValidChanged: src/core/qgsmaplayer.h#L2099 QgsMapLayer.keywordList: src/core/qgsmaplayer.h#L369 -QgsMapLayer.layerModified: src/core/qgsmaplayer.h#L2121 -QgsMapLayer.legend: src/core/qgsmaplayer.h#L1531 -QgsMapLayer.legendChanged: src/core/qgsmaplayer.h#L2022 -QgsMapLayer.legendPlaceholderImage: src/core/qgsmaplayer.h#L1748 -QgsMapLayer.legendUrl: src/core/qgsmaplayer.h#L1510 -QgsMapLayer.legendUrlFormat: src/core/qgsmaplayer.h#L1520 -QgsMapLayer.listStylesInDatabase: src/core/qgsmaplayer.h#L740 -QgsMapLayer.loadDefaultMetadata: src/core/qgsmaplayer.h#L1148 -QgsMapLayer.loadDefaultStyle: src/core/qgsmaplayer.h#L1189 -QgsMapLayer.loadNamedMetadata: src/core/qgsmaplayer.h#L1135 -QgsMapLayer.loadNamedMetadataFromDatabase: src/core/qgsmaplayer.h#L1157 -QgsMapLayer.loadNamedStyle: src/core/qgsmaplayer.h#L1210 -QgsMapLayer.loadNamedStyle: src/core/qgsmaplayer.h#L791 -QgsMapLayer.loadNamedStyleFromDatabase: src/core/qgsmaplayer.h#L1219 -QgsMapLayer.loadSldStyle: src/core/qgsmaplayer.h#L1337 -QgsMapLayer.mapTipTemplate: src/core/qgsmaplayer.h#L1772 -QgsMapLayer.mapTipTemplateChanged: src/core/qgsmaplayer.h#L2128 -QgsMapLayer.mapTipsEnabled: src/core/qgsmaplayer.h#L1795 -QgsMapLayer.mapTipsEnabledChanged: src/core/qgsmaplayer.h#L2136 -QgsMapLayer.maximumScale: src/core/qgsmaplayer.h#L1580 -QgsMapLayer.metadataChanged: src/core/qgsmaplayer.h#L2065 -QgsMapLayer.metadataUri: src/core/qgsmaplayer.h#L1085 +QgsMapLayer.layerModified: src/core/qgsmaplayer.h#L2124 +QgsMapLayer.legend: src/core/qgsmaplayer.h#L1534 +QgsMapLayer.legendChanged: src/core/qgsmaplayer.h#L2025 +QgsMapLayer.legendPlaceholderImage: src/core/qgsmaplayer.h#L1751 +QgsMapLayer.legendUrl: src/core/qgsmaplayer.h#L1513 +QgsMapLayer.legendUrlFormat: src/core/qgsmaplayer.h#L1523 +QgsMapLayer.listStylesInDatabase: src/core/qgsmaplayer.h#L743 +QgsMapLayer.loadDefaultMetadata: src/core/qgsmaplayer.h#L1151 +QgsMapLayer.loadDefaultStyle: src/core/qgsmaplayer.h#L1192 +QgsMapLayer.loadNamedMetadata: src/core/qgsmaplayer.h#L1138 +QgsMapLayer.loadNamedMetadataFromDatabase: src/core/qgsmaplayer.h#L1160 +QgsMapLayer.loadNamedStyle: src/core/qgsmaplayer.h#L1213 +QgsMapLayer.loadNamedStyle: src/core/qgsmaplayer.h#L794 +QgsMapLayer.loadNamedStyleFromDatabase: src/core/qgsmaplayer.h#L1222 +QgsMapLayer.loadSldStyle: src/core/qgsmaplayer.h#L1340 +QgsMapLayer.mapTipTemplate: src/core/qgsmaplayer.h#L1775 +QgsMapLayer.mapTipTemplateChanged: src/core/qgsmaplayer.h#L2131 +QgsMapLayer.mapTipsEnabled: src/core/qgsmaplayer.h#L1798 +QgsMapLayer.mapTipsEnabledChanged: src/core/qgsmaplayer.h#L2139 +QgsMapLayer.maximumScale: src/core/qgsmaplayer.h#L1583 +QgsMapLayer.metadataChanged: src/core/qgsmaplayer.h#L2068 +QgsMapLayer.metadataUri: src/core/qgsmaplayer.h#L1088 QgsMapLayer.metadataUrl: src/core/qgsmaplayer.h#L460 QgsMapLayer.metadataUrlFormat: src/core/qgsmaplayer.h#L502 QgsMapLayer.metadataUrlType: src/core/qgsmaplayer.h#L481 -QgsMapLayer.minimumScale: src/core/qgsmaplayer.h#L1568 +QgsMapLayer.minimumScale: src/core/qgsmaplayer.h#L1571 QgsMapLayer.name: src/core/qgsmaplayer.h#L296 -QgsMapLayer.nameChanged: src/core/qgsmaplayer.h#L1934 +QgsMapLayer.nameChanged: src/core/qgsmaplayer.h#L1937 QgsMapLayer.opacity: src/core/qgsmaplayer.h#L535 -QgsMapLayer.opacityChanged: src/core/qgsmaplayer.h#L1999 -QgsMapLayer.originalXmlProperties: src/core/qgsmaplayer.h#L1694 -QgsMapLayer.project: src/core/qgsmaplayer.h#L1906 +QgsMapLayer.opacityChanged: src/core/qgsmaplayer.h#L2002 +QgsMapLayer.originalXmlProperties: src/core/qgsmaplayer.h#L1697 +QgsMapLayer.project: src/core/qgsmaplayer.h#L1909 QgsMapLayer.properties: src/core/qgsmaplayer.h#L253 QgsMapLayer.providerMetadata: src/core/qgsmaplayer.h#L313 -QgsMapLayer.providerReadFlags: src/core/qgsmaplayer.h#L1804 -QgsMapLayer.providerType: src/core/qgsmaplayer.h#L1492 -QgsMapLayer.publicSource: src/core/qgsmaplayer.h#L583 -QgsMapLayer.readCommonStyle: src/core/qgsmaplayer.h#L2243 -QgsMapLayer.readCustomProperties: src/core/qgsmaplayer.h#L2223 -QgsMapLayer.readLayerXml: src/core/qgsmaplayer.h#L675 +QgsMapLayer.providerReadFlags: src/core/qgsmaplayer.h#L1807 +QgsMapLayer.providerType: src/core/qgsmaplayer.h#L1495 +QgsMapLayer.publicSource: src/core/qgsmaplayer.h#L586 +QgsMapLayer.readCommonStyle: src/core/qgsmaplayer.h#L2246 +QgsMapLayer.readCustomProperties: src/core/qgsmaplayer.h#L2226 +QgsMapLayer.readLayerXml: src/core/qgsmaplayer.h#L678 QgsMapLayer.readOnly: src/core/qgsmaplayer.h#L538 -QgsMapLayer.readSld: src/core/qgsmaplayer.h#L1340 -QgsMapLayer.readStyle: src/core/qgsmaplayer.h#L1364 -QgsMapLayer.readStyleManager: src/core/qgsmaplayer.h#L2229 -QgsMapLayer.readSymbology: src/core/qgsmaplayer.h#L1352 -QgsMapLayer.readXml: src/core/qgsmaplayer.h#L2183 -QgsMapLayer.recalculateExtents: src/core/qgsmaplayer.h#L1983 -QgsMapLayer.refreshOnNotifyMessage: src/core/qgsmaplayer.h#L1678 +QgsMapLayer.readSld: src/core/qgsmaplayer.h#L1343 +QgsMapLayer.readStyle: src/core/qgsmaplayer.h#L1367 +QgsMapLayer.readStyleManager: src/core/qgsmaplayer.h#L2232 +QgsMapLayer.readSymbology: src/core/qgsmaplayer.h#L1355 +QgsMapLayer.readXml: src/core/qgsmaplayer.h#L2186 +QgsMapLayer.recalculateExtents: src/core/qgsmaplayer.h#L1986 +QgsMapLayer.refreshOnNotifyMessage: src/core/qgsmaplayer.h#L1681 QgsMapLayer.reload: src/core/qgsmaplayer.h#L543 -QgsMapLayer.removeCustomProperty: src/core/qgsmaplayer.h#L970 -QgsMapLayer.renderer3D: src/core/qgsmaplayer.h#L1546 -QgsMapLayer.renderer3DChanged: src/core/qgsmaplayer.h#L2027 -QgsMapLayer.rendererChanged: src/core/qgsmaplayer.h#L2005 -QgsMapLayer.repaintRequested: src/core/qgsmaplayer.h#L1980 -QgsMapLayer.request3DUpdate: src/core/qgsmaplayer.h#L2034 -QgsMapLayer.resolveReferences: src/core/qgsmaplayer.h#L698 -QgsMapLayer.saveDefaultMetadata: src/core/qgsmaplayer.h#L1102 -QgsMapLayer.saveDefaultStyle: src/core/qgsmaplayer.h#L1274 -QgsMapLayer.saveDefaultStyle: src/core/qgsmaplayer.h#L1287 -QgsMapLayer.saveNamedMetadata: src/core/qgsmaplayer.h#L1117 -QgsMapLayer.saveNamedStyle: src/core/qgsmaplayer.h#L1304 -QgsMapLayer.saveSldStyle: src/core/qgsmaplayer.h#L1315 -QgsMapLayer.saveSldStyleV2: src/core/qgsmaplayer.h#L1327 -QgsMapLayer.saveStyleToDatabase: src/core/qgsmaplayer.h#L772 -QgsMapLayer.selectionProperties: src/core/qgsmaplayer.h#L1727 +QgsMapLayer.removeCustomProperty: src/core/qgsmaplayer.h#L973 +QgsMapLayer.renderer3D: src/core/qgsmaplayer.h#L1549 +QgsMapLayer.renderer3DChanged: src/core/qgsmaplayer.h#L2030 +QgsMapLayer.rendererChanged: src/core/qgsmaplayer.h#L2008 +QgsMapLayer.repaintRequested: src/core/qgsmaplayer.h#L1983 +QgsMapLayer.request3DUpdate: src/core/qgsmaplayer.h#L2037 +QgsMapLayer.resolveReferences: src/core/qgsmaplayer.h#L701 +QgsMapLayer.saveDefaultMetadata: src/core/qgsmaplayer.h#L1105 +QgsMapLayer.saveDefaultStyle: src/core/qgsmaplayer.h#L1277 +QgsMapLayer.saveDefaultStyle: src/core/qgsmaplayer.h#L1290 +QgsMapLayer.saveNamedMetadata: src/core/qgsmaplayer.h#L1120 +QgsMapLayer.saveNamedStyle: src/core/qgsmaplayer.h#L1307 +QgsMapLayer.saveSldStyle: src/core/qgsmaplayer.h#L1318 +QgsMapLayer.saveSldStyleV2: src/core/qgsmaplayer.h#L1330 +QgsMapLayer.saveStyleToDatabase: src/core/qgsmaplayer.h#L775 +QgsMapLayer.selectionProperties: src/core/qgsmaplayer.h#L1730 QgsMapLayer.serverProperties: src/core/qgsmaplayer.h#L434 QgsMapLayer.setAbstract: src/core/qgsmaplayer.h#L348 QgsMapLayer.setAttribution: src/core/qgsmaplayer.h#L404 QgsMapLayer.setAttributionUrl: src/core/qgsmaplayer.h#L418 -QgsMapLayer.setAutoRefreshEnabled: src/core/qgsmaplayer.h#L1634 -QgsMapLayer.setAutoRefreshInterval: src/core/qgsmaplayer.h#L1626 -QgsMapLayer.setAutoRefreshMode: src/core/qgsmaplayer.h#L1642 +QgsMapLayer.setAutoRefreshEnabled: src/core/qgsmaplayer.h#L1637 +QgsMapLayer.setAutoRefreshInterval: src/core/qgsmaplayer.h#L1629 +QgsMapLayer.setAutoRefreshMode: src/core/qgsmaplayer.h#L1645 QgsMapLayer.setBlendMode: src/core/qgsmaplayer.h#L509 -QgsMapLayer.setCrs: src/core/qgsmaplayer.h#L1042 -QgsMapLayer.setCustomProperties: src/core/qgsmaplayer.h#L722 -QgsMapLayer.setCustomProperty: src/core/qgsmaplayer.h#L711 -QgsMapLayer.setDataSource: src/core/qgsmaplayer.h#L1425 -QgsMapLayer.setDataSource: src/core/qgsmaplayer.h#L1456 -QgsMapLayer.setDataSource: src/core/qgsmaplayer.h#L1487 +QgsMapLayer.setCrs: src/core/qgsmaplayer.h#L1045 +QgsMapLayer.setCustomProperties: src/core/qgsmaplayer.h#L725 +QgsMapLayer.setCustomProperty: src/core/qgsmaplayer.h#L714 +QgsMapLayer.setDataSource: src/core/qgsmaplayer.h#L1428 +QgsMapLayer.setDataSource: src/core/qgsmaplayer.h#L1459 +QgsMapLayer.setDataSource: src/core/qgsmaplayer.h#L1490 QgsMapLayer.setDataUrl: src/core/qgsmaplayer.h#L376 QgsMapLayer.setDataUrlFormat: src/core/qgsmaplayer.h#L390 -QgsMapLayer.setDependencies: src/core/qgsmaplayer.h#L1869 -QgsMapLayer.setError: src/core/qgsmaplayer.h#L2259 -QgsMapLayer.setExtent3D: src/core/qgsmaplayer.h#L2174 -QgsMapLayer.setExtent: src/core/qgsmaplayer.h#L2168 +QgsMapLayer.setDependencies: src/core/qgsmaplayer.h#L1872 +QgsMapLayer.setError: src/core/qgsmaplayer.h#L2262 +QgsMapLayer.setExtent3D: src/core/qgsmaplayer.h#L2177 +QgsMapLayer.setExtent: src/core/qgsmaplayer.h#L2171 QgsMapLayer.setFlags: src/core/qgsmaplayer.h#L242 QgsMapLayer.setId: src/core/qgsmaplayer.h#L284 QgsMapLayer.setKeywordList: src/core/qgsmaplayer.h#L362 -QgsMapLayer.setLayerOrder: src/core/qgsmaplayer.h#L602 -QgsMapLayer.setLegend: src/core/qgsmaplayer.h#L1526 -QgsMapLayer.setLegendPlaceholderImage: src/core/qgsmaplayer.h#L1755 -QgsMapLayer.setLegendUrl: src/core/qgsmaplayer.h#L1505 -QgsMapLayer.setLegendUrlFormat: src/core/qgsmaplayer.h#L1515 -QgsMapLayer.setMapTipTemplate: src/core/qgsmaplayer.h#L1781 -QgsMapLayer.setMapTipsEnabled: src/core/qgsmaplayer.h#L1789 -QgsMapLayer.setMaximumScale: src/core/qgsmaplayer.h#L1828 -QgsMapLayer.setMetadata: src/core/qgsmaplayer.h#L1656 +QgsMapLayer.setLayerOrder: src/core/qgsmaplayer.h#L605 +QgsMapLayer.setLegend: src/core/qgsmaplayer.h#L1529 +QgsMapLayer.setLegendPlaceholderImage: src/core/qgsmaplayer.h#L1758 +QgsMapLayer.setLegendUrl: src/core/qgsmaplayer.h#L1508 +QgsMapLayer.setLegendUrlFormat: src/core/qgsmaplayer.h#L1518 +QgsMapLayer.setMapTipTemplate: src/core/qgsmaplayer.h#L1784 +QgsMapLayer.setMapTipsEnabled: src/core/qgsmaplayer.h#L1792 +QgsMapLayer.setMaximumScale: src/core/qgsmaplayer.h#L1831 +QgsMapLayer.setMetadata: src/core/qgsmaplayer.h#L1659 QgsMapLayer.setMetadataUrl: src/core/qgsmaplayer.h#L449 QgsMapLayer.setMetadataUrlFormat: src/core/qgsmaplayer.h#L491 QgsMapLayer.setMetadataUrlType: src/core/qgsmaplayer.h#L470 -QgsMapLayer.setMinimumScale: src/core/qgsmaplayer.h#L1817 +QgsMapLayer.setMinimumScale: src/core/qgsmaplayer.h#L1820 QgsMapLayer.setName: src/core/qgsmaplayer.h#L290 QgsMapLayer.setOpacity: src/core/qgsmaplayer.h#L525 -QgsMapLayer.setOriginalXmlProperties: src/core/qgsmaplayer.h#L1703 -QgsMapLayer.setProviderType: src/core/qgsmaplayer.h#L2247 -QgsMapLayer.setRefreshOnNofifyMessage: src/core/qgsmaplayer.h#L1883 -QgsMapLayer.setRefreshOnNotifyEnabled: src/core/qgsmaplayer.h#L1875 -QgsMapLayer.setRenderer3D: src/core/qgsmaplayer.h#L1541 -QgsMapLayer.setScaleBasedVisibility: src/core/qgsmaplayer.h#L1837 +QgsMapLayer.setOriginalXmlProperties: src/core/qgsmaplayer.h#L1706 +QgsMapLayer.setProviderType: src/core/qgsmaplayer.h#L2250 +QgsMapLayer.setRefreshOnNofifyMessage: src/core/qgsmaplayer.h#L1886 +QgsMapLayer.setRefreshOnNotifyEnabled: src/core/qgsmaplayer.h#L1878 +QgsMapLayer.setRenderer3D: src/core/qgsmaplayer.h#L1544 +QgsMapLayer.setScaleBasedVisibility: src/core/qgsmaplayer.h#L1840 QgsMapLayer.setShortName: src/core/qgsmaplayer.h#L320 -QgsMapLayer.setSubLayerVisibility: src/core/qgsmaplayer.h#L609 +QgsMapLayer.setSubLayerVisibility: src/core/qgsmaplayer.h#L612 QgsMapLayer.setTitle: src/core/qgsmaplayer.h#L334 -QgsMapLayer.setTransformContext: src/core/qgsmaplayer.h#L1890 -QgsMapLayer.setValid: src/core/qgsmaplayer.h#L2177 -QgsMapLayer.setVerticalCrs: src/core/qgsmaplayer.h#L1063 +QgsMapLayer.setTransformContext: src/core/qgsmaplayer.h#L1893 +QgsMapLayer.setValid: src/core/qgsmaplayer.h#L2180 +QgsMapLayer.setVerticalCrs: src/core/qgsmaplayer.h#L1066 QgsMapLayer.shortName: src/core/qgsmaplayer.h#L327 -QgsMapLayer.source: src/core/qgsmaplayer.h#L590 -QgsMapLayer.statusChanged: src/core/qgsmaplayer.h#L1919 -QgsMapLayer.styleChanged: src/core/qgsmaplayer.h#L2017 -QgsMapLayer.styleLoaded: src/core/qgsmaplayer.h#L2089 -QgsMapLayer.styleManager: src/core/qgsmaplayer.h#L1536 -QgsMapLayer.styleURI: src/core/qgsmaplayer.h#L1175 -QgsMapLayer.subLayers: src/core/qgsmaplayer.h#L596 -QgsMapLayer.supportsEditing: src/core/qgsmaplayer.h#L617 -QgsMapLayer.temporalProperties: src/core/qgsmaplayer.h#L1734 -QgsMapLayer.timestamp: src/core/qgsmaplayer.h#L1664 +QgsMapLayer.source: src/core/qgsmaplayer.h#L593 +QgsMapLayer.statusChanged: src/core/qgsmaplayer.h#L1922 +QgsMapLayer.styleChanged: src/core/qgsmaplayer.h#L2020 +QgsMapLayer.styleLoaded: src/core/qgsmaplayer.h#L2092 +QgsMapLayer.styleManager: src/core/qgsmaplayer.h#L1539 +QgsMapLayer.styleURI: src/core/qgsmaplayer.h#L1178 +QgsMapLayer.subLayers: src/core/qgsmaplayer.h#L599 +QgsMapLayer.supportsEditing: src/core/qgsmaplayer.h#L620 +QgsMapLayer.temporalProperties: src/core/qgsmaplayer.h#L1737 +QgsMapLayer.timestamp: src/core/qgsmaplayer.h#L1667 QgsMapLayer.title: src/core/qgsmaplayer.h#L341 -QgsMapLayer.transformContext: src/core/qgsmaplayer.h#L1070 -QgsMapLayer.trigger3DUpdate: src/core/qgsmaplayer.h#L1855 -QgsMapLayer.triggerRepaint: src/core/qgsmaplayer.h#L1847 +QgsMapLayer.transformContext: src/core/qgsmaplayer.h#L1073 +QgsMapLayer.trigger3DUpdate: src/core/qgsmaplayer.h#L1858 +QgsMapLayer.triggerRepaint: src/core/qgsmaplayer.h#L1850 QgsMapLayer.type: src/core/qgsmaplayer.h#L218 -QgsMapLayer.undoStack: src/core/qgsmaplayer.h#L1495 -QgsMapLayer.undoStackStyles: src/core/qgsmaplayer.h#L1500 -QgsMapLayer.verticalCrs: src/core/qgsmaplayer.h#L1010 -QgsMapLayer.verticalCrsChanged: src/core/qgsmaplayer.h#L1972 +QgsMapLayer.undoStack: src/core/qgsmaplayer.h#L1498 +QgsMapLayer.undoStackStyles: src/core/qgsmaplayer.h#L1503 +QgsMapLayer.verticalCrs: src/core/qgsmaplayer.h#L1013 +QgsMapLayer.verticalCrsChanged: src/core/qgsmaplayer.h#L1975 QgsMapLayer.wgs84Extent: src/core/qgsmaplayer.h#L567 -QgsMapLayer.willBeDeleted: src/core/qgsmaplayer.h#L2052 -QgsMapLayer.writeCommonStyle: src/core/qgsmaplayer.h#L2236 -QgsMapLayer.writeCustomProperties: src/core/qgsmaplayer.h#L2226 -QgsMapLayer.writeLayerXml: src/core/qgsmaplayer.h#L693 -QgsMapLayer.writeStyle: src/core/qgsmaplayer.h#L1391 -QgsMapLayer.writeStyleManager: src/core/qgsmaplayer.h#L2231 -QgsMapLayer.writeSymbology: src/core/qgsmaplayer.h#L1377 -QgsMapLayer.writeXml: src/core/qgsmaplayer.h#L2189 +QgsMapLayer.willBeDeleted: src/core/qgsmaplayer.h#L2055 +QgsMapLayer.writeCommonStyle: src/core/qgsmaplayer.h#L2239 +QgsMapLayer.writeCustomProperties: src/core/qgsmaplayer.h#L2229 +QgsMapLayer.writeLayerXml: src/core/qgsmaplayer.h#L696 +QgsMapLayer.writeStyle: src/core/qgsmaplayer.h#L1394 +QgsMapLayer.writeStyleManager: src/core/qgsmaplayer.h#L2234 +QgsMapLayer.writeSymbology: src/core/qgsmaplayer.h#L1380 +QgsMapLayer.writeXml: src/core/qgsmaplayer.h#L2192 QgsMapLayer: src/core/qgsmaplayer.h#L75 QgsMapLayerDependency.__hash__: src/core/qgsmaplayerdependency.h#L78 QgsMapLayerDependency.layerId: src/core/qgsmaplayerdependency.h#L67 @@ -9650,6 +9655,7 @@ QgsMaskIdProvider.maskId: src/core/qgsmaskidprovider.h#L56 QgsMaskIdProvider.size: src/core/qgsmaskidprovider.h#L61 QgsMaskIdProvider: src/core/qgsmaskidprovider.h#L39 QgsMaskMarkerSymbolLayer.bounds: src/core/symbology/qgsmasksymbollayer.h#L63 +QgsMaskMarkerSymbolLayer.clearMasks: src/core/symbology/qgsmasksymbollayer.h#L87 QgsMaskMarkerSymbolLayer.clone: src/core/symbology/qgsmasksymbollayer.h#L51 QgsMaskMarkerSymbolLayer.color: src/core/symbology/qgsmasksymbollayer.h#L66 QgsMaskMarkerSymbolLayer.create: src/core/symbology/qgsmasksymbollayer.h#L49 @@ -9659,7 +9665,7 @@ QgsMaskMarkerSymbolLayer.hasDataDefinedProperties: src/core/symbology/qgsmasksym QgsMaskMarkerSymbolLayer.layerType: src/core/symbology/qgsmasksymbollayer.h#L59 QgsMaskMarkerSymbolLayer.properties: src/core/symbology/qgsmasksymbollayer.h#L57 QgsMaskMarkerSymbolLayer.renderPoint: src/core/symbology/qgsmasksymbollayer.h#L62 -QgsMaskMarkerSymbolLayer.setMasks: src/core/symbology/qgsmasksymbollayer.h#L87 +QgsMaskMarkerSymbolLayer.setMasks: src/core/symbology/qgsmasksymbollayer.h#L94 QgsMaskMarkerSymbolLayer.setOutputUnit: src/core/symbology/qgsmasksymbollayer.h#L65 QgsMaskMarkerSymbolLayer.setSubSymbol: src/core/symbology/qgsmasksymbollayer.h#L53 QgsMaskMarkerSymbolLayer.startRender: src/core/symbology/qgsmasksymbollayer.h#L60 @@ -9964,86 +9970,86 @@ QgsMeshElevationAveragingMethod: src/core/mesh/qgsmesh3daveraging.h#L368 QgsMeshLayer.QgsMeshLayer.LayerOptions: src/core/mesh/qgsmeshlayer.h#L117 QgsMeshLayer.QgsMeshLayer: src/core/mesh/qgsmeshlayer.h#L159 QgsMeshLayer.__repr__: src/core/mesh/qgsmeshlayer.h#L168 -QgsMeshLayer.activeScalarDatasetAtTime: src/core/mesh/qgsmeshlayer.h#L626 -QgsMeshLayer.activeScalarDatasetGroupChanged: src/core/mesh/qgsmeshlayer.h#L990 -QgsMeshLayer.activeScalarDatasetIndex: src/core/mesh/qgsmeshlayer.h#L961 -QgsMeshLayer.activeVectorDatasetAtTime: src/core/mesh/qgsmeshlayer.h#L639 -QgsMeshLayer.activeVectorDatasetGroupChanged: src/core/mesh/qgsmeshlayer.h#L997 +QgsMeshLayer.activeScalarDatasetAtTime: src/core/mesh/qgsmeshlayer.h#L632 +QgsMeshLayer.activeScalarDatasetGroupChanged: src/core/mesh/qgsmeshlayer.h#L996 +QgsMeshLayer.activeScalarDatasetIndex: src/core/mesh/qgsmeshlayer.h#L967 +QgsMeshLayer.activeVectorDatasetAtTime: src/core/mesh/qgsmeshlayer.h#L645 +QgsMeshLayer.activeVectorDatasetGroupChanged: src/core/mesh/qgsmeshlayer.h#L1003 QgsMeshLayer.addDatasets: src/core/mesh/qgsmeshlayer.h#L212 QgsMeshLayer.addDatasets: src/core/mesh/qgsmeshlayer.h#L232 -QgsMeshLayer.areFacesActive: src/core/mesh/qgsmeshlayer.h#L497 +QgsMeshLayer.areFacesActive: src/core/mesh/qgsmeshlayer.h#L503 QgsMeshLayer.clone: src/core/mesh/qgsmeshlayer.h#L177 -QgsMeshLayer.commitFrameEditing: src/core/mesh/qgsmeshlayer.h#L822 -QgsMeshLayer.contains: src/core/mesh/qgsmeshlayer.h#L872 +QgsMeshLayer.commitFrameEditing: src/core/mesh/qgsmeshlayer.h#L828 +QgsMeshLayer.contains: src/core/mesh/qgsmeshlayer.h#L878 QgsMeshLayer.createMapRenderer: src/core/mesh/qgsmeshlayer.h#L179 QgsMeshLayer.createProfileGenerator: src/core/mesh/qgsmeshlayer.h#L180 QgsMeshLayer.dataProvider: src/core/mesh/qgsmeshlayer.h#L175 -QgsMeshLayer.dataset1dValue: src/core/mesh/qgsmeshlayer.h#L563 -QgsMeshLayer.dataset3dValue: src/core/mesh/qgsmeshlayer.h#L542 -QgsMeshLayer.dataset3dValues: src/core/mesh/qgsmeshlayer.h#L474 -QgsMeshLayer.datasetCount: src/core/mesh/qgsmeshlayer.h#L405 -QgsMeshLayer.datasetGroupCount: src/core/mesh/qgsmeshlayer.h#L356 -QgsMeshLayer.datasetGroupMetadata: src/core/mesh/qgsmeshlayer.h#L393 -QgsMeshLayer.datasetGroupTreeRootItem: src/core/mesh/qgsmeshlayer.h#L747 -QgsMeshLayer.datasetIndexAtRelativeTime: src/core/mesh/qgsmeshlayer.h#L597 -QgsMeshLayer.datasetIndexAtTime: src/core/mesh/qgsmeshlayer.h#L580 -QgsMeshLayer.datasetMetadata: src/core/mesh/qgsmeshlayer.h#L417 -QgsMeshLayer.datasetRelativeTime: src/core/mesh/qgsmeshlayer.h#L783 -QgsMeshLayer.datasetRelativeTimeInMilliseconds: src/core/mesh/qgsmeshlayer.h#L790 -QgsMeshLayer.datasetValue: src/core/mesh/qgsmeshlayer.h#L436 -QgsMeshLayer.datasetValue: src/core/mesh/qgsmeshlayer.h#L521 -QgsMeshLayer.datasetValues: src/core/mesh/qgsmeshlayer.h#L456 -QgsMeshLayer.datasetsPathUnique: src/core/mesh/qgsmeshlayer.h#L972 +QgsMeshLayer.dataset1dValue: src/core/mesh/qgsmeshlayer.h#L569 +QgsMeshLayer.dataset3dValue: src/core/mesh/qgsmeshlayer.h#L548 +QgsMeshLayer.dataset3dValues: src/core/mesh/qgsmeshlayer.h#L480 +QgsMeshLayer.datasetCount: src/core/mesh/qgsmeshlayer.h#L411 +QgsMeshLayer.datasetGroupCount: src/core/mesh/qgsmeshlayer.h#L362 +QgsMeshLayer.datasetGroupMetadata: src/core/mesh/qgsmeshlayer.h#L399 +QgsMeshLayer.datasetGroupTreeRootItem: src/core/mesh/qgsmeshlayer.h#L753 +QgsMeshLayer.datasetIndexAtRelativeTime: src/core/mesh/qgsmeshlayer.h#L603 +QgsMeshLayer.datasetIndexAtTime: src/core/mesh/qgsmeshlayer.h#L586 +QgsMeshLayer.datasetMetadata: src/core/mesh/qgsmeshlayer.h#L423 +QgsMeshLayer.datasetRelativeTime: src/core/mesh/qgsmeshlayer.h#L789 +QgsMeshLayer.datasetRelativeTimeInMilliseconds: src/core/mesh/qgsmeshlayer.h#L796 +QgsMeshLayer.datasetValue: src/core/mesh/qgsmeshlayer.h#L442 +QgsMeshLayer.datasetValue: src/core/mesh/qgsmeshlayer.h#L527 +QgsMeshLayer.datasetValues: src/core/mesh/qgsmeshlayer.h#L462 +QgsMeshLayer.datasetsPathUnique: src/core/mesh/qgsmeshlayer.h#L978 QgsMeshLayer.decodedSource: src/core/mesh/qgsmeshlayer.h#L188 QgsMeshLayer.elevationProperties: src/core/mesh/qgsmeshlayer.h#L192 QgsMeshLayer.encodedSource: src/core/mesh/qgsmeshlayer.h#L187 QgsMeshLayer.extent: src/core/mesh/qgsmeshlayer.h#L178 -QgsMeshLayer.extraDatasetGroupCount: src/core/mesh/qgsmeshlayer.h#L363 -QgsMeshLayer.firstValidTimeStep: src/core/mesh/qgsmeshlayer.h#L776 -QgsMeshLayer.formatTime: src/core/mesh/qgsmeshlayer.h#L349 +QgsMeshLayer.extraDatasetGroupCount: src/core/mesh/qgsmeshlayer.h#L369 +QgsMeshLayer.firstValidTimeStep: src/core/mesh/qgsmeshlayer.h#L782 +QgsMeshLayer.formatTime: src/core/mesh/qgsmeshlayer.h#L355 QgsMeshLayer.htmlMetadata: src/core/mesh/qgsmeshlayer.h#L195 QgsMeshLayer.isEditable: src/core/mesh/qgsmeshlayer.h#L196 -QgsMeshLayer.isFaceActive: src/core/mesh/qgsmeshlayer.h#L483 -QgsMeshLayer.isModified: src/core/mesh/qgsmeshlayer.h#L866 -QgsMeshLayer.labeling: src/core/mesh/qgsmeshlayer.h#L937 -QgsMeshLayer.labelsEnabled: src/core/mesh/qgsmeshlayer.h#L907 +QgsMeshLayer.isFaceActive: src/core/mesh/qgsmeshlayer.h#L489 +QgsMeshLayer.isModified: src/core/mesh/qgsmeshlayer.h#L872 +QgsMeshLayer.labeling: src/core/mesh/qgsmeshlayer.h#L943 +QgsMeshLayer.labelsEnabled: src/core/mesh/qgsmeshlayer.h#L913 QgsMeshLayer.loadDefaultStyle: src/core/mesh/qgsmeshlayer.h#L198 -QgsMeshLayer.meshEdgeCount: src/core/mesh/qgsmeshlayer.h#L897 -QgsMeshLayer.meshEditor: src/core/mesh/qgsmeshlayer.h#L859 -QgsMeshLayer.meshFaceCount: src/core/mesh/qgsmeshlayer.h#L890 -QgsMeshLayer.meshVertexCount: src/core/mesh/qgsmeshlayer.h#L881 -QgsMeshLayer.minimumMaximumActiveScalarDataset: src/core/mesh/qgsmeshlayer.h#L954 +QgsMeshLayer.meshEdgeCount: src/core/mesh/qgsmeshlayer.h#L903 +QgsMeshLayer.meshEditor: src/core/mesh/qgsmeshlayer.h#L865 +QgsMeshLayer.meshFaceCount: src/core/mesh/qgsmeshlayer.h#L896 +QgsMeshLayer.meshVertexCount: src/core/mesh/qgsmeshlayer.h#L887 +QgsMeshLayer.minimumMaximumActiveScalarDataset: src/core/mesh/qgsmeshlayer.h#L960 QgsMeshLayer.providerType: src/core/mesh/qgsmeshlayer.h#L201 QgsMeshLayer.readStyle: src/core/mesh/qgsmeshlayer.h#L186 QgsMeshLayer.readSymbology: src/core/mesh/qgsmeshlayer.h#L181 QgsMeshLayer.readXml: src/core/mesh/qgsmeshlayer.h#L189 -QgsMeshLayer.reindex: src/core/mesh/qgsmeshlayer.h#L852 +QgsMeshLayer.reindex: src/core/mesh/qgsmeshlayer.h#L858 QgsMeshLayer.reload: src/core/mesh/qgsmeshlayer.h#L193 -QgsMeshLayer.reloaded: src/core/mesh/qgsmeshlayer.h#L1011 +QgsMeshLayer.reloaded: src/core/mesh/qgsmeshlayer.h#L1017 QgsMeshLayer.removeDatasets: src/core/mesh/qgsmeshlayer.h#L222 QgsMeshLayer.rendererSettings: src/core/mesh/qgsmeshlayer.h#L311 -QgsMeshLayer.resetDatasetGroupTreeItem: src/core/mesh/qgsmeshlayer.h#L769 -QgsMeshLayer.rollBackFrameEditing: src/core/mesh/qgsmeshlayer.h#L832 +QgsMeshLayer.resetDatasetGroupTreeItem: src/core/mesh/qgsmeshlayer.h#L775 +QgsMeshLayer.rollBackFrameEditing: src/core/mesh/qgsmeshlayer.h#L838 QgsMeshLayer.saveDataset: src/core/mesh/qgsmeshlayer.h#L244 -QgsMeshLayer.setDatasetGroupTreeRootItem: src/core/mesh/qgsmeshlayer.h#L762 -QgsMeshLayer.setLabeling: src/core/mesh/qgsmeshlayer.h#L943 -QgsMeshLayer.setLabelsEnabled: src/core/mesh/qgsmeshlayer.h#L919 -QgsMeshLayer.setReferenceTime: src/core/mesh/qgsmeshlayer.h#L686 -QgsMeshLayer.setRendererSettings: src/core/mesh/qgsmeshlayer.h#L313 -QgsMeshLayer.setTemporalMatchingMethod: src/core/mesh/qgsmeshlayer.h#L695 -QgsMeshLayer.setTimeSettings: src/core/mesh/qgsmeshlayer.h#L327 -QgsMeshLayer.setTransformContext: src/core/mesh/qgsmeshlayer.h#L981 -QgsMeshLayer.snapOnElement: src/core/mesh/qgsmeshlayer.h#L718 -QgsMeshLayer.startFrameEditing: src/core/mesh/qgsmeshlayer.h#L799 -QgsMeshLayer.startFrameEditing: src/core/mesh/qgsmeshlayer.h#L811 -QgsMeshLayer.staticScalarDatasetIndex: src/core/mesh/qgsmeshlayer.h#L667 -QgsMeshLayer.staticVectorDatasetIndex: src/core/mesh/qgsmeshlayer.h#L677 -QgsMeshLayer.stopFrameEditing: src/core/mesh/qgsmeshlayer.h#L841 +QgsMeshLayer.setDatasetGroupTreeRootItem: src/core/mesh/qgsmeshlayer.h#L768 +QgsMeshLayer.setLabeling: src/core/mesh/qgsmeshlayer.h#L949 +QgsMeshLayer.setLabelsEnabled: src/core/mesh/qgsmeshlayer.h#L925 +QgsMeshLayer.setReferenceTime: src/core/mesh/qgsmeshlayer.h#L692 +QgsMeshLayer.setRendererSettings: src/core/mesh/qgsmeshlayer.h#L319 +QgsMeshLayer.setTemporalMatchingMethod: src/core/mesh/qgsmeshlayer.h#L701 +QgsMeshLayer.setTimeSettings: src/core/mesh/qgsmeshlayer.h#L333 +QgsMeshLayer.setTransformContext: src/core/mesh/qgsmeshlayer.h#L987 +QgsMeshLayer.snapOnElement: src/core/mesh/qgsmeshlayer.h#L724 +QgsMeshLayer.startFrameEditing: src/core/mesh/qgsmeshlayer.h#L805 +QgsMeshLayer.startFrameEditing: src/core/mesh/qgsmeshlayer.h#L817 +QgsMeshLayer.staticScalarDatasetIndex: src/core/mesh/qgsmeshlayer.h#L673 +QgsMeshLayer.staticVectorDatasetIndex: src/core/mesh/qgsmeshlayer.h#L683 +QgsMeshLayer.stopFrameEditing: src/core/mesh/qgsmeshlayer.h#L847 QgsMeshLayer.subLayers: src/core/mesh/qgsmeshlayer.h#L194 QgsMeshLayer.supportsEditing: src/core/mesh/qgsmeshlayer.h#L197 QgsMeshLayer.temporalProperties: src/core/mesh/qgsmeshlayer.h#L191 -QgsMeshLayer.timeSettings: src/core/mesh/qgsmeshlayer.h#L320 -QgsMeshLayer.timeSettingsChanged: src/core/mesh/qgsmeshlayer.h#L1004 +QgsMeshLayer.timeSettings: src/core/mesh/qgsmeshlayer.h#L326 +QgsMeshLayer.timeSettingsChanged: src/core/mesh/qgsmeshlayer.h#L1010 QgsMeshLayer.updateTriangularMesh: src/core/mesh/qgsmeshlayer.h#L301 QgsMeshLayer.writeStyle: src/core/mesh/qgsmeshlayer.h#L185 QgsMeshLayer.writeSymbology: src/core/mesh/qgsmeshlayer.h#L183 @@ -10144,106 +10150,106 @@ QgsMeshRendererScalarSettings.setLimits: src/core/mesh/qgsmeshrenderersettings.h QgsMeshRendererScalarSettings.setOpacity: src/core/mesh/qgsmeshrenderersettings.h#L132 QgsMeshRendererScalarSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L207 QgsMeshRendererScalarSettings: src/core/mesh/qgsmeshrenderersettings.h#L92 -QgsMeshRendererSettings.activeScalarDatasetGroup: src/core/mesh/qgsmeshrenderersettings.h#L817 -QgsMeshRendererSettings.activeVectorDatasetGroup: src/core/mesh/qgsmeshrenderersettings.h#L829 -QgsMeshRendererSettings.averagingMethod: src/core/mesh/qgsmeshrenderersettings.h#L799 -QgsMeshRendererSettings.edgeMeshSettings: src/core/mesh/qgsmeshrenderersettings.h#L751 -QgsMeshRendererSettings.hasScalarSettings: src/core/mesh/qgsmeshrenderersettings.h#L769 -QgsMeshRendererSettings.hasSettings: src/core/mesh/qgsmeshrenderersettings.h#L842 -QgsMeshRendererSettings.hasVectorSettings: src/core/mesh/qgsmeshrenderersettings.h#L786 -QgsMeshRendererSettings.nativeMeshSettings: src/core/mesh/qgsmeshrenderersettings.h#L738 -QgsMeshRendererSettings.readXml: src/core/mesh/qgsmeshrenderersettings.h#L811 -QgsMeshRendererSettings.removeScalarSettings: src/core/mesh/qgsmeshrenderersettings.h#L775 -QgsMeshRendererSettings.removeVectorSettings: src/core/mesh/qgsmeshrenderersettings.h#L792 -QgsMeshRendererSettings.scalarSettings: src/core/mesh/qgsmeshrenderersettings.h#L760 -QgsMeshRendererSettings.setActiveScalarDatasetGroup: src/core/mesh/qgsmeshrenderersettings.h#L823 -QgsMeshRendererSettings.setActiveVectorDatasetGroup: src/core/mesh/qgsmeshrenderersettings.h#L835 -QgsMeshRendererSettings.setAveragingMethod: src/core/mesh/qgsmeshrenderersettings.h#L806 -QgsMeshRendererSettings.setEdgeMeshSettings: src/core/mesh/qgsmeshrenderersettings.h#L757 -QgsMeshRendererSettings.setNativeMeshSettings: src/core/mesh/qgsmeshrenderersettings.h#L740 -QgsMeshRendererSettings.setScalarSettings: src/core/mesh/qgsmeshrenderersettings.h#L763 -QgsMeshRendererSettings.setTriangularMeshSettings: src/core/mesh/qgsmeshrenderersettings.h#L745 -QgsMeshRendererSettings.setVectorSettings: src/core/mesh/qgsmeshrenderersettings.h#L780 -QgsMeshRendererSettings.triangularMeshSettings: src/core/mesh/qgsmeshrenderersettings.h#L743 -QgsMeshRendererSettings.vectorSettings: src/core/mesh/qgsmeshrenderersettings.h#L778 -QgsMeshRendererSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L809 -QgsMeshRendererSettings: src/core/mesh/qgsmeshrenderersettings.h#L727 -QgsMeshRendererVectorArrowSettings.arrowHeadLengthRatio: src/core/mesh/qgsmeshrenderersettings.h#L340 -QgsMeshRendererVectorArrowSettings.arrowHeadWidthRatio: src/core/mesh/qgsmeshrenderersettings.h#L335 -QgsMeshRendererVectorArrowSettings.fixedShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L325 -QgsMeshRendererVectorArrowSettings.maxShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L297 -QgsMeshRendererVectorArrowSettings.minShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L283 -QgsMeshRendererVectorArrowSettings.readXml: src/core/mesh/qgsmeshrenderersettings.h#L347 -QgsMeshRendererVectorArrowSettings.scaleFactor: src/core/mesh/qgsmeshrenderersettings.h#L311 -QgsMeshRendererVectorArrowSettings.setArrowHeadLengthRatio: src/core/mesh/qgsmeshrenderersettings.h#L342 -QgsMeshRendererVectorArrowSettings.setArrowHeadWidthRatio: src/core/mesh/qgsmeshrenderersettings.h#L337 -QgsMeshRendererVectorArrowSettings.setFixedShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L332 -QgsMeshRendererVectorArrowSettings.setMaxShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L304 -QgsMeshRendererVectorArrowSettings.setMinShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L290 -QgsMeshRendererVectorArrowSettings.setScaleFactor: src/core/mesh/qgsmeshrenderersettings.h#L318 -QgsMeshRendererVectorArrowSettings.setShaftLengthMethod: src/core/mesh/qgsmeshrenderersettings.h#L276 -QgsMeshRendererVectorArrowSettings.shaftLengthMethod: src/core/mesh/qgsmeshrenderersettings.h#L274 -QgsMeshRendererVectorArrowSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L345 -QgsMeshRendererVectorArrowSettings: src/core/mesh/qgsmeshrenderersettings.h#L249 -QgsMeshRendererVectorSettings.arrowSettings: src/core/mesh/qgsmeshrenderersettings.h#L649 -QgsMeshRendererVectorSettings.color: src/core/mesh/qgsmeshrenderersettings.h#L558 -QgsMeshRendererVectorSettings.colorRampShader: src/core/mesh/qgsmeshrenderersettings.h#L631 -QgsMeshRendererVectorSettings.coloringMethod: src/core/mesh/qgsmeshrenderersettings.h#L619 -QgsMeshRendererVectorSettings.filterMax: src/core/mesh/qgsmeshrenderersettings.h#L582 -QgsMeshRendererVectorSettings.filterMin: src/core/mesh/qgsmeshrenderersettings.h#L568 -QgsMeshRendererVectorSettings.isOnUserDefinedGrid: src/core/mesh/qgsmeshrenderersettings.h#L591 -QgsMeshRendererVectorSettings.lineWidth: src/core/mesh/qgsmeshrenderersettings.h#L553 -QgsMeshRendererVectorSettings.readXml: src/core/mesh/qgsmeshrenderersettings.h#L696 -QgsMeshRendererVectorSettings.setArrowsSettings: src/core/mesh/qgsmeshrenderersettings.h#L655 -QgsMeshRendererVectorSettings.setColor: src/core/mesh/qgsmeshrenderersettings.h#L560 -QgsMeshRendererVectorSettings.setColorRampShader: src/core/mesh/qgsmeshrenderersettings.h#L637 -QgsMeshRendererVectorSettings.setColoringMethod: src/core/mesh/qgsmeshrenderersettings.h#L625 -QgsMeshRendererVectorSettings.setFilterMax: src/core/mesh/qgsmeshrenderersettings.h#L588 -QgsMeshRendererVectorSettings.setFilterMin: src/core/mesh/qgsmeshrenderersettings.h#L574 -QgsMeshRendererVectorSettings.setLineWidth: src/core/mesh/qgsmeshrenderersettings.h#L555 -QgsMeshRendererVectorSettings.setOnUserDefinedGrid: src/core/mesh/qgsmeshrenderersettings.h#L593 -QgsMeshRendererVectorSettings.setStreamLinesSettings: src/core/mesh/qgsmeshrenderersettings.h#L667 -QgsMeshRendererVectorSettings.setSymbology: src/core/mesh/qgsmeshrenderersettings.h#L613 -QgsMeshRendererVectorSettings.setTracesSettings: src/core/mesh/qgsmeshrenderersettings.h#L679 -QgsMeshRendererVectorSettings.setUserGridCellHeight: src/core/mesh/qgsmeshrenderersettings.h#L601 -QgsMeshRendererVectorSettings.setUserGridCellWidth: src/core/mesh/qgsmeshrenderersettings.h#L597 -QgsMeshRendererVectorSettings.setWindBarbSettings: src/core/mesh/qgsmeshrenderersettings.h#L691 -QgsMeshRendererVectorSettings.streamLinesSettings: src/core/mesh/qgsmeshrenderersettings.h#L661 -QgsMeshRendererVectorSettings.symbology: src/core/mesh/qgsmeshrenderersettings.h#L607 -QgsMeshRendererVectorSettings.tracesSettings: src/core/mesh/qgsmeshrenderersettings.h#L673 -QgsMeshRendererVectorSettings.userGridCellHeight: src/core/mesh/qgsmeshrenderersettings.h#L599 -QgsMeshRendererVectorSettings.userGridCellWidth: src/core/mesh/qgsmeshrenderersettings.h#L595 -QgsMeshRendererVectorSettings.vectorStrokeColoring: src/core/mesh/qgsmeshrenderersettings.h#L643 -QgsMeshRendererVectorSettings.windBarbSettings: src/core/mesh/qgsmeshrenderersettings.h#L685 -QgsMeshRendererVectorSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L694 -QgsMeshRendererVectorSettings: src/core/mesh/qgsmeshrenderersettings.h#L532 -QgsMeshRendererVectorStreamlineSettings.readXml: src/core/mesh/qgsmeshrenderersettings.h#L395 -QgsMeshRendererVectorStreamlineSettings.seedingDensity: src/core/mesh/qgsmeshrenderersettings.h#L391 -QgsMeshRendererVectorStreamlineSettings.seedingMethod: src/core/mesh/qgsmeshrenderersettings.h#L387 -QgsMeshRendererVectorStreamlineSettings.setSeedingDensity: src/core/mesh/qgsmeshrenderersettings.h#L393 -QgsMeshRendererVectorStreamlineSettings.setSeedingMethod: src/core/mesh/qgsmeshrenderersettings.h#L389 -QgsMeshRendererVectorStreamlineSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L397 -QgsMeshRendererVectorStreamlineSettings: src/core/mesh/qgsmeshrenderersettings.h#L368 -QgsMeshRendererVectorTracesSettings.maximumTailLength: src/core/mesh/qgsmeshrenderersettings.h#L419 -QgsMeshRendererVectorTracesSettings.maximumTailLengthUnit: src/core/mesh/qgsmeshrenderersettings.h#L427 -QgsMeshRendererVectorTracesSettings.particlesCount: src/core/mesh/qgsmeshrenderersettings.h#L423 -QgsMeshRendererVectorTracesSettings.readXml: src/core/mesh/qgsmeshrenderersettings.h#L432 -QgsMeshRendererVectorTracesSettings.setMaximumTailLength: src/core/mesh/qgsmeshrenderersettings.h#L421 -QgsMeshRendererVectorTracesSettings.setMaximumTailLengthUnit: src/core/mesh/qgsmeshrenderersettings.h#L429 -QgsMeshRendererVectorTracesSettings.setParticlesCount: src/core/mesh/qgsmeshrenderersettings.h#L425 -QgsMeshRendererVectorTracesSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L434 -QgsMeshRendererVectorTracesSettings: src/core/mesh/qgsmeshrenderersettings.h#L414 -QgsMeshRendererVectorWindBarbSettings.magnitudeMultiplier: src/core/mesh/qgsmeshrenderersettings.h#L470 -QgsMeshRendererVectorWindBarbSettings.magnitudeUnits: src/core/mesh/qgsmeshrenderersettings.h#L504 -QgsMeshRendererVectorWindBarbSettings.readXml: src/core/mesh/qgsmeshrenderersettings.h#L514 -QgsMeshRendererVectorWindBarbSettings.setMagnitudeMultiplier: src/core/mesh/qgsmeshrenderersettings.h#L475 -QgsMeshRendererVectorWindBarbSettings.setMagnitudeUnits: src/core/mesh/qgsmeshrenderersettings.h#L509 -QgsMeshRendererVectorWindBarbSettings.setShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L485 -QgsMeshRendererVectorWindBarbSettings.setShaftLengthUnits: src/core/mesh/qgsmeshrenderersettings.h#L499 -QgsMeshRendererVectorWindBarbSettings.shaftLength: src/core/mesh/qgsmeshrenderersettings.h#L480 -QgsMeshRendererVectorWindBarbSettings.shaftLengthUnits: src/core/mesh/qgsmeshrenderersettings.h#L492 -QgsMeshRendererVectorWindBarbSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L512 -QgsMeshRendererVectorWindBarbSettings: src/core/mesh/qgsmeshrenderersettings.h#L452 +QgsMeshRendererSettings.activeScalarDatasetGroup: src/core/mesh/qgsmeshrenderersettings.h#L804 +QgsMeshRendererSettings.activeVectorDatasetGroup: src/core/mesh/qgsmeshrenderersettings.h#L816 +QgsMeshRendererSettings.averagingMethod: src/core/mesh/qgsmeshrenderersettings.h#L786 +QgsMeshRendererSettings.edgeMeshSettings: src/core/mesh/qgsmeshrenderersettings.h#L738 +QgsMeshRendererSettings.hasScalarSettings: src/core/mesh/qgsmeshrenderersettings.h#L756 +QgsMeshRendererSettings.hasSettings: src/core/mesh/qgsmeshrenderersettings.h#L829 +QgsMeshRendererSettings.hasVectorSettings: src/core/mesh/qgsmeshrenderersettings.h#L773 +QgsMeshRendererSettings.nativeMeshSettings: src/core/mesh/qgsmeshrenderersettings.h#L725 +QgsMeshRendererSettings.readXml: src/core/mesh/qgsmeshrenderersettings.h#L798 +QgsMeshRendererSettings.removeScalarSettings: src/core/mesh/qgsmeshrenderersettings.h#L762 +QgsMeshRendererSettings.removeVectorSettings: src/core/mesh/qgsmeshrenderersettings.h#L779 +QgsMeshRendererSettings.scalarSettings: src/core/mesh/qgsmeshrenderersettings.h#L747 +QgsMeshRendererSettings.setActiveScalarDatasetGroup: src/core/mesh/qgsmeshrenderersettings.h#L810 +QgsMeshRendererSettings.setActiveVectorDatasetGroup: src/core/mesh/qgsmeshrenderersettings.h#L822 +QgsMeshRendererSettings.setAveragingMethod: src/core/mesh/qgsmeshrenderersettings.h#L793 +QgsMeshRendererSettings.setEdgeMeshSettings: src/core/mesh/qgsmeshrenderersettings.h#L744 +QgsMeshRendererSettings.setNativeMeshSettings: src/core/mesh/qgsmeshrenderersettings.h#L727 +QgsMeshRendererSettings.setScalarSettings: src/core/mesh/qgsmeshrenderersettings.h#L750 +QgsMeshRendererSettings.setTriangularMeshSettings: src/core/mesh/qgsmeshrenderersettings.h#L732 +QgsMeshRendererSettings.setVectorSettings: src/core/mesh/qgsmeshrenderersettings.h#L767 +QgsMeshRendererSettings.triangularMeshSettings: src/core/mesh/qgsmeshrenderersettings.h#L730 +QgsMeshRendererSettings.vectorSettings: src/core/mesh/qgsmeshrenderersettings.h#L765 +QgsMeshRendererSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L796 +QgsMeshRendererSettings: src/core/mesh/qgsmeshrenderersettings.h#L714 +QgsMeshRendererVectorArrowSettings.arrowHeadLengthRatio: src/core/mesh/qgsmeshrenderersettings.h#L327 +QgsMeshRendererVectorArrowSettings.arrowHeadWidthRatio: src/core/mesh/qgsmeshrenderersettings.h#L322 +QgsMeshRendererVectorArrowSettings.fixedShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L312 +QgsMeshRendererVectorArrowSettings.maxShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L284 +QgsMeshRendererVectorArrowSettings.minShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L270 +QgsMeshRendererVectorArrowSettings.readXml: src/core/mesh/qgsmeshrenderersettings.h#L334 +QgsMeshRendererVectorArrowSettings.scaleFactor: src/core/mesh/qgsmeshrenderersettings.h#L298 +QgsMeshRendererVectorArrowSettings.setArrowHeadLengthRatio: src/core/mesh/qgsmeshrenderersettings.h#L329 +QgsMeshRendererVectorArrowSettings.setArrowHeadWidthRatio: src/core/mesh/qgsmeshrenderersettings.h#L324 +QgsMeshRendererVectorArrowSettings.setFixedShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L319 +QgsMeshRendererVectorArrowSettings.setMaxShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L291 +QgsMeshRendererVectorArrowSettings.setMinShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L277 +QgsMeshRendererVectorArrowSettings.setScaleFactor: src/core/mesh/qgsmeshrenderersettings.h#L305 +QgsMeshRendererVectorArrowSettings.setShaftLengthMethod: src/core/mesh/qgsmeshrenderersettings.h#L263 +QgsMeshRendererVectorArrowSettings.shaftLengthMethod: src/core/mesh/qgsmeshrenderersettings.h#L261 +QgsMeshRendererVectorArrowSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L332 +QgsMeshRendererVectorArrowSettings: src/core/mesh/qgsmeshrenderersettings.h#L236 +QgsMeshRendererVectorSettings.arrowSettings: src/core/mesh/qgsmeshrenderersettings.h#L636 +QgsMeshRendererVectorSettings.color: src/core/mesh/qgsmeshrenderersettings.h#L545 +QgsMeshRendererVectorSettings.colorRampShader: src/core/mesh/qgsmeshrenderersettings.h#L618 +QgsMeshRendererVectorSettings.coloringMethod: src/core/mesh/qgsmeshrenderersettings.h#L606 +QgsMeshRendererVectorSettings.filterMax: src/core/mesh/qgsmeshrenderersettings.h#L569 +QgsMeshRendererVectorSettings.filterMin: src/core/mesh/qgsmeshrenderersettings.h#L555 +QgsMeshRendererVectorSettings.isOnUserDefinedGrid: src/core/mesh/qgsmeshrenderersettings.h#L578 +QgsMeshRendererVectorSettings.lineWidth: src/core/mesh/qgsmeshrenderersettings.h#L540 +QgsMeshRendererVectorSettings.readXml: src/core/mesh/qgsmeshrenderersettings.h#L683 +QgsMeshRendererVectorSettings.setArrowsSettings: src/core/mesh/qgsmeshrenderersettings.h#L642 +QgsMeshRendererVectorSettings.setColor: src/core/mesh/qgsmeshrenderersettings.h#L547 +QgsMeshRendererVectorSettings.setColorRampShader: src/core/mesh/qgsmeshrenderersettings.h#L624 +QgsMeshRendererVectorSettings.setColoringMethod: src/core/mesh/qgsmeshrenderersettings.h#L612 +QgsMeshRendererVectorSettings.setFilterMax: src/core/mesh/qgsmeshrenderersettings.h#L575 +QgsMeshRendererVectorSettings.setFilterMin: src/core/mesh/qgsmeshrenderersettings.h#L561 +QgsMeshRendererVectorSettings.setLineWidth: src/core/mesh/qgsmeshrenderersettings.h#L542 +QgsMeshRendererVectorSettings.setOnUserDefinedGrid: src/core/mesh/qgsmeshrenderersettings.h#L580 +QgsMeshRendererVectorSettings.setStreamLinesSettings: src/core/mesh/qgsmeshrenderersettings.h#L654 +QgsMeshRendererVectorSettings.setSymbology: src/core/mesh/qgsmeshrenderersettings.h#L600 +QgsMeshRendererVectorSettings.setTracesSettings: src/core/mesh/qgsmeshrenderersettings.h#L666 +QgsMeshRendererVectorSettings.setUserGridCellHeight: src/core/mesh/qgsmeshrenderersettings.h#L588 +QgsMeshRendererVectorSettings.setUserGridCellWidth: src/core/mesh/qgsmeshrenderersettings.h#L584 +QgsMeshRendererVectorSettings.setWindBarbSettings: src/core/mesh/qgsmeshrenderersettings.h#L678 +QgsMeshRendererVectorSettings.streamLinesSettings: src/core/mesh/qgsmeshrenderersettings.h#L648 +QgsMeshRendererVectorSettings.symbology: src/core/mesh/qgsmeshrenderersettings.h#L594 +QgsMeshRendererVectorSettings.tracesSettings: src/core/mesh/qgsmeshrenderersettings.h#L660 +QgsMeshRendererVectorSettings.userGridCellHeight: src/core/mesh/qgsmeshrenderersettings.h#L586 +QgsMeshRendererVectorSettings.userGridCellWidth: src/core/mesh/qgsmeshrenderersettings.h#L582 +QgsMeshRendererVectorSettings.vectorStrokeColoring: src/core/mesh/qgsmeshrenderersettings.h#L630 +QgsMeshRendererVectorSettings.windBarbSettings: src/core/mesh/qgsmeshrenderersettings.h#L672 +QgsMeshRendererVectorSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L681 +QgsMeshRendererVectorSettings: src/core/mesh/qgsmeshrenderersettings.h#L519 +QgsMeshRendererVectorStreamlineSettings.readXml: src/core/mesh/qgsmeshrenderersettings.h#L382 +QgsMeshRendererVectorStreamlineSettings.seedingDensity: src/core/mesh/qgsmeshrenderersettings.h#L378 +QgsMeshRendererVectorStreamlineSettings.seedingMethod: src/core/mesh/qgsmeshrenderersettings.h#L374 +QgsMeshRendererVectorStreamlineSettings.setSeedingDensity: src/core/mesh/qgsmeshrenderersettings.h#L380 +QgsMeshRendererVectorStreamlineSettings.setSeedingMethod: src/core/mesh/qgsmeshrenderersettings.h#L376 +QgsMeshRendererVectorStreamlineSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L384 +QgsMeshRendererVectorStreamlineSettings: src/core/mesh/qgsmeshrenderersettings.h#L355 +QgsMeshRendererVectorTracesSettings.maximumTailLength: src/core/mesh/qgsmeshrenderersettings.h#L406 +QgsMeshRendererVectorTracesSettings.maximumTailLengthUnit: src/core/mesh/qgsmeshrenderersettings.h#L414 +QgsMeshRendererVectorTracesSettings.particlesCount: src/core/mesh/qgsmeshrenderersettings.h#L410 +QgsMeshRendererVectorTracesSettings.readXml: src/core/mesh/qgsmeshrenderersettings.h#L419 +QgsMeshRendererVectorTracesSettings.setMaximumTailLength: src/core/mesh/qgsmeshrenderersettings.h#L408 +QgsMeshRendererVectorTracesSettings.setMaximumTailLengthUnit: src/core/mesh/qgsmeshrenderersettings.h#L416 +QgsMeshRendererVectorTracesSettings.setParticlesCount: src/core/mesh/qgsmeshrenderersettings.h#L412 +QgsMeshRendererVectorTracesSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L421 +QgsMeshRendererVectorTracesSettings: src/core/mesh/qgsmeshrenderersettings.h#L401 +QgsMeshRendererVectorWindBarbSettings.magnitudeMultiplier: src/core/mesh/qgsmeshrenderersettings.h#L457 +QgsMeshRendererVectorWindBarbSettings.magnitudeUnits: src/core/mesh/qgsmeshrenderersettings.h#L491 +QgsMeshRendererVectorWindBarbSettings.readXml: src/core/mesh/qgsmeshrenderersettings.h#L501 +QgsMeshRendererVectorWindBarbSettings.setMagnitudeMultiplier: src/core/mesh/qgsmeshrenderersettings.h#L462 +QgsMeshRendererVectorWindBarbSettings.setMagnitudeUnits: src/core/mesh/qgsmeshrenderersettings.h#L496 +QgsMeshRendererVectorWindBarbSettings.setShaftLength: src/core/mesh/qgsmeshrenderersettings.h#L472 +QgsMeshRendererVectorWindBarbSettings.setShaftLengthUnits: src/core/mesh/qgsmeshrenderersettings.h#L486 +QgsMeshRendererVectorWindBarbSettings.shaftLength: src/core/mesh/qgsmeshrenderersettings.h#L467 +QgsMeshRendererVectorWindBarbSettings.shaftLengthUnits: src/core/mesh/qgsmeshrenderersettings.h#L479 +QgsMeshRendererVectorWindBarbSettings.writeXml: src/core/mesh/qgsmeshrenderersettings.h#L499 +QgsMeshRendererVectorWindBarbSettings: src/core/mesh/qgsmeshrenderersettings.h#L439 QgsMeshSigmaAveragingMethod.clone: src/core/mesh/qgsmesh3daveraging.h#L258 QgsMeshSigmaAveragingMethod.endFraction: src/core/mesh/qgsmesh3daveraging.h#L274 QgsMeshSigmaAveragingMethod.equals: src/core/mesh/qgsmesh3daveraging.h#L257 @@ -10291,14 +10297,14 @@ QgsMeshVectorTraceAnimationGenerator.setParticlesSize: src/core/mesh/qgsmeshtrac QgsMeshVectorTraceAnimationGenerator.setTailFactor: src/core/mesh/qgsmeshtracerenderer.h#L642 QgsMeshVectorTraceAnimationGenerator.setTailPersitence: src/core/mesh/qgsmeshtracerenderer.h#L648 QgsMeshVectorTraceAnimationGenerator: src/core/mesh/qgsmeshtracerenderer.h#L599 -QgsMessageLog.logMessage: src/core/qgsmessagelog.h#L54 -QgsMessageLog.messageReceived: src/core/qgsmessagelog.h#L64 -QgsMessageLog.messageReceived: src/core/qgsmessagelog.h#L76 +QgsMessageLog.logMessage: src/core/qgsmessagelog.h#L62 +QgsMessageLog.messageReceived: src/core/qgsmessagelog.h#L73 +QgsMessageLog.messageReceived: src/core/qgsmessagelog.h#L85 QgsMessageLog: src/core/qgsmessagelog.h#L39 -QgsMessageLogConsole.formatLogMessage: src/core/qgsmessagelog.h#L152 -QgsMessageLogConsole.logMessage: src/core/qgsmessagelog.h#L163 -QgsMessageLogConsole: src/core/qgsmessagelog.h#L131 -QgsMessageLogNotifyBlocker: src/core/qgsmessagelog.h#L101 +QgsMessageLogConsole.formatLogMessage: src/core/qgsmessagelog.h#L161 +QgsMessageLogConsole.logMessage: src/core/qgsmessagelog.h#L172 +QgsMessageLogConsole: src/core/qgsmessagelog.h#L140 +QgsMessageLogNotifyBlocker: src/core/qgsmessagelog.h#L110 QgsMessageOutput.appendMessage: src/core/qgsmessageoutput.h#L56 QgsMessageOutput.createMessageOutput: src/core/qgsmessageoutput.h#L81 QgsMessageOutput.setMessage: src/core/qgsmessageoutput.h#L53 @@ -10316,18 +10322,18 @@ QgsMetadataUtils.convertFromEsri: src/core/metadata/qgsmetadatautils.h#L41 QgsMetadataUtils: src/core/metadata/qgsmetadatautils.h#L34 QgsMimeDataUtils.QgsMimeDataUtils.Uri: src/core/qgsmimedatautils.h#L46 QgsMimeDataUtils.QgsMimeDataUtils.Uri: src/core/qgsmimedatautils.h#L53 -QgsMimeDataUtils.QgsMimeDataUtils.__repr__: src/core/qgsmimedatautils.h#L158 +QgsMimeDataUtils.QgsMimeDataUtils.__repr__: src/core/qgsmimedatautils.h#L164 QgsMimeDataUtils.QgsMimeDataUtils.data: src/core/qgsmimedatautils.h#L61 QgsMimeDataUtils.QgsMimeDataUtils.isValid: src/core/qgsmimedatautils.h#L58 QgsMimeDataUtils.QgsMimeDataUtils.mapLayer: src/core/qgsmimedatautils.h#L93 QgsMimeDataUtils.QgsMimeDataUtils.meshLayer: src/core/qgsmimedatautils.h#L82 QgsMimeDataUtils.QgsMimeDataUtils.rasterLayer: src/core/qgsmimedatautils.h#L75 QgsMimeDataUtils.QgsMimeDataUtils.vectorLayer: src/core/qgsmimedatautils.h#L68 -QgsMimeDataUtils.decodeUriList: src/core/qgsmimedatautils.h#L174 -QgsMimeDataUtils.encodeUriList: src/core/qgsmimedatautils.h#L170 -QgsMimeDataUtils.hasOriginatedFromCurrentAppInstance: src/core/qgsmimedatautils.h#L187 -QgsMimeDataUtils.isUriList: src/core/qgsmimedatautils.h#L172 -QgsMimeDataUtils.layerTreeNodesToUriList: src/core/qgsmimedatautils.h#L179 +QgsMimeDataUtils.decodeUriList: src/core/qgsmimedatautils.h#L180 +QgsMimeDataUtils.encodeUriList: src/core/qgsmimedatautils.h#L176 +QgsMimeDataUtils.hasOriginatedFromCurrentAppInstance: src/core/qgsmimedatautils.h#L193 +QgsMimeDataUtils.isUriList: src/core/qgsmimedatautils.h#L178 +QgsMimeDataUtils.layerTreeNodesToUriList: src/core/qgsmimedatautils.h#L185 QgsMimeDataUtils: src/core/qgsmimedatautils.h#L37 QgsMultiBandColorRenderer.block: src/core/raster/qgsmultibandcolorrenderer.h#L50 QgsMultiBandColorRenderer.blueBand: src/core/raster/qgsmultibandcolorrenderer.h#L56 @@ -10727,27 +10733,26 @@ QgsPageSizeRegistry.add: src/core/layout/qgspagesizeregistry.h#L83 QgsPageSizeRegistry.decodePageSize: src/core/layout/qgspagesizeregistry.h#L110 QgsPageSizeRegistry.find: src/core/layout/qgspagesizeregistry.h#L103 QgsPageSizeRegistry: src/core/layout/qgspagesizeregistry.h#L71 -QgsPaintEffect.begin: src/core/effects/qgspainteffect.h#L178 -QgsPaintEffect.boundingRect: src/core/effects/qgspainteffect.h#L282 -QgsPaintEffect.clone: src/core/effects/qgspainteffect.h#L124 -QgsPaintEffect.draw: src/core/effects/qgspainteffect.h#L231 -QgsPaintEffect.drawMode: src/core/effects/qgspainteffect.h#L208 -QgsPaintEffect.drawSource: src/core/effects/qgspainteffect.h#L240 -QgsPaintEffect.enabled: src/core/effects/qgspainteffect.h#L193 -QgsPaintEffect.end: src/core/effects/qgspainteffect.h#L186 -QgsPaintEffect.fixQPictureDpi: src/core/effects/qgspainteffect.h#L292 -QgsPaintEffect.imageOffset: src/core/effects/qgspainteffect.h#L271 -QgsPaintEffect.properties: src/core/effects/qgspainteffect.h#L133 -QgsPaintEffect.readProperties: src/core/effects/qgspainteffect.h#L141 -QgsPaintEffect.readProperties: src/core/effects/qgspainteffect.h#L160 -QgsPaintEffect.render: src/core/effects/qgspainteffect.h#L168 -QgsPaintEffect.saveProperties: src/core/effects/qgspainteffect.h#L152 -QgsPaintEffect.setDrawMode: src/core/effects/qgspainteffect.h#L216 -QgsPaintEffect.setEnabled: src/core/effects/qgspainteffect.h#L200 -QgsPaintEffect.source: src/core/effects/qgspainteffect.h#L249 -QgsPaintEffect.sourceAsImage: src/core/effects/qgspainteffect.h#L262 -QgsPaintEffect.type: src/core/effects/qgspainteffect.h#L118 -QgsPaintEffect: src/core/effects/qgspainteffect.h#L51 +QgsPaintEffect.begin: src/core/effects/qgspainteffect.h#L179 +QgsPaintEffect.boundingRect: src/core/effects/qgspainteffect.h#L283 +QgsPaintEffect.clone: src/core/effects/qgspainteffect.h#L125 +QgsPaintEffect.draw: src/core/effects/qgspainteffect.h#L232 +QgsPaintEffect.drawMode: src/core/effects/qgspainteffect.h#L209 +QgsPaintEffect.drawSource: src/core/effects/qgspainteffect.h#L241 +QgsPaintEffect.enabled: src/core/effects/qgspainteffect.h#L194 +QgsPaintEffect.end: src/core/effects/qgspainteffect.h#L187 +QgsPaintEffect.fixQPictureDpi: src/core/effects/qgspainteffect.h#L293 +QgsPaintEffect.imageOffset: src/core/effects/qgspainteffect.h#L272 +QgsPaintEffect.properties: src/core/effects/qgspainteffect.h#L134 +QgsPaintEffect.readProperties: src/core/effects/qgspainteffect.h#L142 +QgsPaintEffect.readProperties: src/core/effects/qgspainteffect.h#L161 +QgsPaintEffect.render: src/core/effects/qgspainteffect.h#L169 +QgsPaintEffect.saveProperties: src/core/effects/qgspainteffect.h#L153 +QgsPaintEffect.setDrawMode: src/core/effects/qgspainteffect.h#L217 +QgsPaintEffect.setEnabled: src/core/effects/qgspainteffect.h#L201 +QgsPaintEffect.sourceAsImage: src/core/effects/qgspainteffect.h#L263 +QgsPaintEffect.type: src/core/effects/qgspainteffect.h#L119 +QgsPaintEffect: src/core/effects/qgspainteffect.h#L52 QgsPaintEffectAbstractMetadata.createPaintEffect: src/core/effects/qgspainteffectregistry.h#L71 QgsPaintEffectAbstractMetadata.createWidget: src/core/effects/qgspainteffectregistry.h#L78 QgsPaintEffectAbstractMetadata.name: src/core/effects/qgspainteffectregistry.h#L57 @@ -11136,38 +11141,39 @@ QgsPointCloudExtentRenderer.startRender: src/core/pointcloud/qgspointcloudextent QgsPointCloudExtentRenderer.stopRender: src/core/pointcloud/qgspointcloudextentrenderer.h#L52 QgsPointCloudExtentRenderer.type: src/core/pointcloud/qgspointcloudextentrenderer.h#L46 QgsPointCloudExtentRenderer: src/core/pointcloud/qgspointcloudextentrenderer.h#L33 -QgsPointCloudIndex.accessType: src/core/pointcloud/qgspointcloudindex.h#L454 -QgsPointCloudIndex.attributes: src/core/pointcloud/qgspointcloudindex.h#L518 +QgsPointCloudIndex.accessType: src/core/pointcloud/qgspointcloudindex.h#L457 +QgsPointCloudIndex.attributes: src/core/pointcloud/qgspointcloudindex.h#L521 QgsPointCloudIndex.bool: src/core/pointcloud/qgspointcloudindex.h#L423 -QgsPointCloudIndex.commitChanges: src/core/pointcloud/qgspointcloudindex.h#L648 -QgsPointCloudIndex.crs: src/core/pointcloud/qgspointcloudindex.h#L461 -QgsPointCloudIndex.error: src/core/pointcloud/qgspointcloudindex.h#L444 -QgsPointCloudIndex.extent: src/core/pointcloud/qgspointcloudindex.h#L558 -QgsPointCloudIndex.extraMetadata: src/core/pointcloud/qgspointcloudindex.h#L642 -QgsPointCloudIndex.getNode: src/core/pointcloud/qgspointcloudindex.h#L511 -QgsPointCloudIndex.hasNode: src/core/pointcloud/qgspointcloudindex.h#L504 -QgsPointCloudIndex.isModified: src/core/pointcloud/qgspointcloudindex.h#L651 -QgsPointCloudIndex.isValid: src/core/pointcloud/qgspointcloudindex.h#L437 -QgsPointCloudIndex.load: src/core/pointcloud/qgspointcloudindex.h#L430 -QgsPointCloudIndex.metadataStatistics: src/core/pointcloud/qgspointcloudindex.h#L482 -QgsPointCloudIndex.offset: src/core/pointcloud/qgspointcloudindex.h#L593 -QgsPointCloudIndex.originalMetadata: src/core/pointcloud/qgspointcloudindex.h#L475 -QgsPointCloudIndex.pointCount: src/core/pointcloud/qgspointcloudindex.h#L468 -QgsPointCloudIndex.root: src/core/pointcloud/qgspointcloudindex.h#L497 -QgsPointCloudIndex.rootNodeBounds: src/core/pointcloud/qgspointcloudindex.h#L579 -QgsPointCloudIndex.scale: src/core/pointcloud/qgspointcloudindex.h#L586 -QgsPointCloudIndex.setSubsetString: src/core/pointcloud/qgspointcloudindex.h#L609 -QgsPointCloudIndex.span: src/core/pointcloud/qgspointcloudindex.h#L600 -QgsPointCloudIndex.subsetString: src/core/pointcloud/qgspointcloudindex.h#L618 -QgsPointCloudIndex.updateNodeData: src/core/pointcloud/qgspointcloudindex.h#L551 -QgsPointCloudIndex.writeStatistics: src/core/pointcloud/qgspointcloudindex.h#L490 -QgsPointCloudIndex.zMax: src/core/pointcloud/qgspointcloudindex.h#L572 -QgsPointCloudIndex.zMin: src/core/pointcloud/qgspointcloudindex.h#L565 +QgsPointCloudIndex.commitChanges: src/core/pointcloud/qgspointcloudindex.h#L653 +QgsPointCloudIndex.crs: src/core/pointcloud/qgspointcloudindex.h#L464 +QgsPointCloudIndex.error: src/core/pointcloud/qgspointcloudindex.h#L447 +QgsPointCloudIndex.extent: src/core/pointcloud/qgspointcloudindex.h#L561 +QgsPointCloudIndex.extraMetadata: src/core/pointcloud/qgspointcloudindex.h#L645 +QgsPointCloudIndex.getNode: src/core/pointcloud/qgspointcloudindex.h#L514 +QgsPointCloudIndex.hasNode: src/core/pointcloud/qgspointcloudindex.h#L507 +QgsPointCloudIndex.isModified: src/core/pointcloud/qgspointcloudindex.h#L656 +QgsPointCloudIndex.isValid: src/core/pointcloud/qgspointcloudindex.h#L440 +QgsPointCloudIndex.load: src/core/pointcloud/qgspointcloudindex.h#L433 +QgsPointCloudIndex.metadataStatistics: src/core/pointcloud/qgspointcloudindex.h#L485 +QgsPointCloudIndex.offset: src/core/pointcloud/qgspointcloudindex.h#L596 +QgsPointCloudIndex.originalMetadata: src/core/pointcloud/qgspointcloudindex.h#L478 +QgsPointCloudIndex.pointCount: src/core/pointcloud/qgspointcloudindex.h#L471 +QgsPointCloudIndex.root: src/core/pointcloud/qgspointcloudindex.h#L500 +QgsPointCloudIndex.rootNodeBounds: src/core/pointcloud/qgspointcloudindex.h#L582 +QgsPointCloudIndex.scale: src/core/pointcloud/qgspointcloudindex.h#L589 +QgsPointCloudIndex.setSubsetString: src/core/pointcloud/qgspointcloudindex.h#L612 +QgsPointCloudIndex.span: src/core/pointcloud/qgspointcloudindex.h#L603 +QgsPointCloudIndex.subsetString: src/core/pointcloud/qgspointcloudindex.h#L621 +QgsPointCloudIndex.updateNodeData: src/core/pointcloud/qgspointcloudindex.h#L554 +QgsPointCloudIndex.writeStatistics: src/core/pointcloud/qgspointcloudindex.h#L493 +QgsPointCloudIndex.zMax: src/core/pointcloud/qgspointcloudindex.h#L575 +QgsPointCloudIndex.zMin: src/core/pointcloud/qgspointcloudindex.h#L568 QgsPointCloudIndex: src/core/pointcloud/qgspointcloudindex.h#L416 QgsPointCloudLayer.QgsPointCloudLayer.LayerOptions: src/core/pointcloud/qgspointcloudlayer.h#L61 QgsPointCloudLayer.QgsPointCloudLayer: src/core/pointcloud/qgspointcloudlayer.h#L112 QgsPointCloudLayer.__repr__: src/core/pointcloud/qgspointcloudlayer.h#L123 QgsPointCloudLayer.attributes: src/core/pointcloud/qgspointcloudlayer.h#L165 +QgsPointCloudLayer.chunkAttributeValuesChanged: src/core/pointcloud/qgspointcloudlayer.h#L359 QgsPointCloudLayer.clone: src/core/pointcloud/qgspointcloudlayer.h#L130 QgsPointCloudLayer.commitChanges: src/core/pointcloud/qgspointcloudlayer.h#L286 QgsPointCloudLayer.commitError: src/core/pointcloud/qgspointcloudlayer.h#L294 @@ -11856,6 +11862,7 @@ QgsProcessingContext.LayerDetails: src/core/processing/qgsprocessingcontext.h#L2 QgsProcessingContext.addLayerToLoadOnCompletion: src/core/processing/qgsprocessingcontext.h#L383 QgsProcessingContext.areaUnit: src/core/processing/qgsprocessingcontext.h#L208 QgsProcessingContext.asQgisProcessArguments: src/core/processing/qgsprocessingcontext.h#L731 +QgsProcessingContext.clearModelResult: src/core/processing/qgsprocessingcontext.h#L802 QgsProcessingContext.copyThreadSafeSettings: src/core/processing/qgsprocessingcontext.h#L89 QgsProcessingContext.currentTimeRange: src/core/processing/qgsprocessingcontext.h#L227 QgsProcessingContext.defaultEncoding: src/core/processing/qgsprocessingcontext.h#L492 @@ -11968,8 +11975,8 @@ QgsProcessingFeedback.reportError: src/core/processing/qgsprocessingfeedback.h#L QgsProcessingFeedback.setProgressText: src/core/processing/qgsprocessingfeedback.h#L57 QgsProcessingFeedback.textLog: src/core/processing/qgsprocessingfeedback.h#L165 QgsProcessingFeedback: src/core/processing/qgsprocessingfeedback.h#L37 -QgsProcessingLayerPostProcessorInterface.postProcessLayer: src/core/processing/qgsprocessingcontext.h#L875 -QgsProcessingLayerPostProcessorInterface: src/core/processing/qgsprocessingcontext.h#L855 +QgsProcessingLayerPostProcessorInterface.postProcessLayer: src/core/processing/qgsprocessingcontext.h#L882 +QgsProcessingLayerPostProcessorInterface: src/core/processing/qgsprocessingcontext.h#L862 QgsProcessingModelAlgorithm.VariableDefinition: src/core/processing/models/qgsprocessingmodelalgorithm.h#L466 QgsProcessingModelAlgorithm.activateChildAlgorithm: src/core/processing/models/qgsprocessingmodelalgorithm.h#L158 QgsProcessingModelAlgorithm.addChildAlgorithm: src/core/processing/models/qgsprocessingmodelalgorithm.h#L124 @@ -13762,47 +13769,48 @@ QgsProviderConnectionModel.parent: src/core/qgsproviderconnectionmodel.h#L83 QgsProviderConnectionModel.rowCount: src/core/qgsproviderconnectionmodel.h#L84 QgsProviderConnectionModel.setAllowEmptyConnection: src/core/qgsproviderconnectionmodel.h#L74 QgsProviderConnectionModel: src/core/qgsproviderconnectionmodel.h#L38 -QgsProviderMetadata.__repr__: src/core/providers/qgsprovidermetadata.h#L802 +QgsProviderMetadata.__repr__: src/core/providers/qgsprovidermetadata.h#L809 QgsProviderMetadata.absoluteToRelativeUri: src/core/providers/qgsprovidermetadata.h#L600 QgsProviderMetadata.boolParameter: src/core/providers/qgsprovidermetadata.h#L479 QgsProviderMetadata.capabilities: src/core/providers/qgsprovidermetadata.h#L257 +QgsProviderMetadata.cleanUri: src/core/providers/qgsprovidermetadata.h#L620 QgsProviderMetadata.cleanupProvider: src/core/providers/qgsprovidermetadata.h#L338 -QgsProviderMetadata.connectionChanged: src/core/providers/qgsprovidermetadata.h#L834 -QgsProviderMetadata.connectionCreated: src/core/providers/qgsprovidermetadata.h#L817 -QgsProviderMetadata.connectionDeleted: src/core/providers/qgsprovidermetadata.h#L825 -QgsProviderMetadata.createConnection: src/core/providers/qgsprovidermetadata.h#L774 -QgsProviderMetadata.createConnection: src/core/providers/qgsprovidermetadata.h#L782 +QgsProviderMetadata.connectionChanged: src/core/providers/qgsprovidermetadata.h#L841 +QgsProviderMetadata.connectionCreated: src/core/providers/qgsprovidermetadata.h#L824 +QgsProviderMetadata.connectionDeleted: src/core/providers/qgsprovidermetadata.h#L832 +QgsProviderMetadata.createConnection: src/core/providers/qgsprovidermetadata.h#L781 +QgsProviderMetadata.createConnection: src/core/providers/qgsprovidermetadata.h#L789 QgsProviderMetadata.createDatabase: src/core/providers/qgsprovidermetadata.h#L514 -QgsProviderMetadata.createDb: src/core/providers/qgsprovidermetadata.h#L710 +QgsProviderMetadata.createDb: src/core/providers/qgsprovidermetadata.h#L717 QgsProviderMetadata.createMeshData: src/core/providers/qgsprovidermetadata.h#L536 QgsProviderMetadata.createMeshData: src/core/providers/qgsprovidermetadata.h#L548 QgsProviderMetadata.createProvider: src/core/providers/qgsprovidermetadata.h#L461 QgsProviderMetadata.createRasterDataProvider: src/core/providers/qgsprovidermetadata.h#L520 -QgsProviderMetadata.createTransaction: src/core/providers/qgsprovidermetadata.h#L716 +QgsProviderMetadata.createTransaction: src/core/providers/qgsprovidermetadata.h#L723 QgsProviderMetadata.decodeUri: src/core/providers/qgsprovidermetadata.h#L577 -QgsProviderMetadata.deleteConnection: src/core/providers/qgsprovidermetadata.h#L790 -QgsProviderMetadata.deleteStyleById: src/core/providers/qgsprovidermetadata.h#L657 +QgsProviderMetadata.deleteConnection: src/core/providers/qgsprovidermetadata.h#L797 +QgsProviderMetadata.deleteStyleById: src/core/providers/qgsprovidermetadata.h#L664 QgsProviderMetadata.description: src/core/providers/qgsprovidermetadata.h#L243 QgsProviderMetadata.encodeUri: src/core/providers/qgsprovidermetadata.h#L587 QgsProviderMetadata.filters: src/core/providers/qgsprovidermetadata.h#L347 -QgsProviderMetadata.findConnection: src/core/providers/qgsprovidermetadata.h#L749 -QgsProviderMetadata.getStyleById: src/core/providers/qgsprovidermetadata.h#L651 +QgsProviderMetadata.findConnection: src/core/providers/qgsprovidermetadata.h#L756 +QgsProviderMetadata.getStyleById: src/core/providers/qgsprovidermetadata.h#L658 QgsProviderMetadata.icon: src/core/providers/qgsprovidermetadata.h#L250 QgsProviderMetadata.initProvider: src/core/providers/qgsprovidermetadata.h#L332 QgsProviderMetadata.key: src/core/providers/qgsprovidermetadata.h#L236 QgsProviderMetadata.library: src/core/providers/qgsprovidermetadata.h#L318 -QgsProviderMetadata.listStyles: src/core/providers/qgsprovidermetadata.h#L628 -QgsProviderMetadata.loadStoredStyle: src/core/providers/qgsprovidermetadata.h#L688 -QgsProviderMetadata.loadStyle: src/core/providers/qgsprovidermetadata.h#L678 +QgsProviderMetadata.listStyles: src/core/providers/qgsprovidermetadata.h#L635 +QgsProviderMetadata.loadStoredStyle: src/core/providers/qgsprovidermetadata.h#L695 +QgsProviderMetadata.loadStyle: src/core/providers/qgsprovidermetadata.h#L685 QgsProviderMetadata.priorityForUri: src/core/providers/qgsprovidermetadata.h#L371 QgsProviderMetadata.providerCapabilities: src/core/providers/qgsprovidermetadata.h#L264 QgsProviderMetadata.relativeToAbsoluteUri: src/core/providers/qgsprovidermetadata.h#L613 -QgsProviderMetadata.saveConnection: src/core/providers/qgsprovidermetadata.h#L799 -QgsProviderMetadata.saveLayerMetadata: src/core/providers/qgsprovidermetadata.h#L704 -QgsProviderMetadata.saveStyle: src/core/providers/qgsprovidermetadata.h#L670 +QgsProviderMetadata.saveConnection: src/core/providers/qgsprovidermetadata.h#L806 +QgsProviderMetadata.saveLayerMetadata: src/core/providers/qgsprovidermetadata.h#L711 +QgsProviderMetadata.saveStyle: src/core/providers/qgsprovidermetadata.h#L677 QgsProviderMetadata.setBoolParameter: src/core/providers/qgsprovidermetadata.h#L471 QgsProviderMetadata.sidecarFilesForUri: src/core/providers/qgsprovidermetadata.h#L424 -QgsProviderMetadata.styleExists: src/core/providers/qgsprovidermetadata.h#L642 +QgsProviderMetadata.styleExists: src/core/providers/qgsprovidermetadata.h#L649 QgsProviderMetadata.suggestGroupNameForUri: src/core/providers/qgsprovidermetadata.h#L450 QgsProviderMetadata.supportedLayerTypes: src/core/providers/qgsprovidermetadata.h#L274 QgsProviderMetadata.uriIsBlocklisted: src/core/providers/qgsprovidermetadata.h#L401 @@ -14867,56 +14875,56 @@ QgsRecentColorScheme: src/core/qgscolorscheme.h#L218 QgsRecentStyleHandler.pushRecentSymbol: src/core/qgsrecentstylehandler.h#L75 QgsRecentStyleHandler.recentSymbol: src/core/qgsrecentstylehandler.h#L85 QgsRecentStyleHandler: src/core/qgsrecentstylehandler.h#L38 -QgsRectangle.QVariant: src/core/geometry/qgsrectangle.h#L626 -QgsRectangle.QgsRectangle: src/core/geometry/qgsrectangle.h#L76 -QgsRectangle.__repr__: src/core/geometry/qgsrectangle.h#L637 -QgsRectangle.area: src/core/geometry/qgsrectangle.h#L264 -QgsRectangle.asPolygon: src/core/geometry/qgsrectangle.h#L560 -QgsRectangle.asWktCoordinates: src/core/geometry/qgsrectangle.h#L535 -QgsRectangle.asWktPolygon: src/core/geometry/qgsrectangle.h#L540 -QgsRectangle.buffered: src/core/geometry/qgsrectangle.h#L363 -QgsRectangle.center: src/core/geometry/qgsrectangle.h#L275 -QgsRectangle.combineExtentWith: src/core/geometry/qgsrectangle.h#L442 -QgsRectangle.combineExtentWith: src/core/geometry/qgsrectangle.h#L459 -QgsRectangle.combineExtentWith: src/core/geometry/qgsrectangle.h#L468 -QgsRectangle.contains: src/core/geometry/qgsrectangle.h#L406 -QgsRectangle.contains: src/core/geometry/qgsrectangle.h#L415 -QgsRectangle.contains: src/core/geometry/qgsrectangle.h#L426 -QgsRectangle.distance: src/core/geometry/qgsrectangle.h#L479 -QgsRectangle.fromCenterAndSize: src/core/geometry/qgsrectangle.h#L125 -QgsRectangle.fromWkt: src/core/geometry/qgsrectangle.h#L119 -QgsRectangle.grow: src/core/geometry/qgsrectangle.h#L328 -QgsRectangle.height: src/core/geometry/qgsrectangle.h#L256 -QgsRectangle.include: src/core/geometry/qgsrectangle.h#L351 -QgsRectangle.intersect: src/core/geometry/qgsrectangle.h#L379 -QgsRectangle.intersects: src/core/geometry/qgsrectangle.h#L398 -QgsRectangle.invert: src/core/geometry/qgsrectangle.h#L614 -QgsRectangle.isEmpty: src/core/geometry/qgsrectangle.h#L513 -QgsRectangle.isFinite: src/core/geometry/qgsrectangle.h#L605 -QgsRectangle.isNull: src/core/geometry/qgsrectangle.h#L530 -QgsRectangle.normalize: src/core/geometry/qgsrectangle.h#L242 -QgsRectangle.perimeter: src/core/geometry/qgsrectangle.h#L270 -QgsRectangle.scale: src/core/geometry/qgsrectangle.h#L295 -QgsRectangle.scale: src/core/geometry/qgsrectangle.h#L308 -QgsRectangle.scaled: src/core/geometry/qgsrectangle.h#L314 -QgsRectangle.set: src/core/geometry/qgsrectangle.h#L141 -QgsRectangle.set: src/core/geometry/qgsrectangle.h#L157 -QgsRectangle.setMinimal: src/core/geometry/qgsrectangle.h#L204 -QgsRectangle.setNull: src/core/geometry/qgsrectangle.h#L193 -QgsRectangle.setXMaximum: src/core/geometry/qgsrectangle.h#L167 -QgsRectangle.setXMinimum: src/core/geometry/qgsrectangle.h#L162 -QgsRectangle.setYMaximum: src/core/geometry/qgsrectangle.h#L177 -QgsRectangle.setYMinimum: src/core/geometry/qgsrectangle.h#L172 -QgsRectangle.snappedToGrid: src/core/geometry/qgsrectangle.h#L634 -QgsRectangle.toBox3d: src/core/geometry/qgsrectangle.h#L620 -QgsRectangle.toRectF: src/core/geometry/qgsrectangle.h#L548 -QgsRectangle.toString: src/core/geometry/qgsrectangle.h#L555 -QgsRectangle.width: src/core/geometry/qgsrectangle.h#L249 -QgsRectangle.xMaximum: src/core/geometry/qgsrectangle.h#L209 -QgsRectangle.xMinimum: src/core/geometry/qgsrectangle.h#L214 -QgsRectangle.yMaximum: src/core/geometry/qgsrectangle.h#L219 -QgsRectangle.yMinimum: src/core/geometry/qgsrectangle.h#L224 -QgsRectangle: src/core/geometry/qgsrectangle.h#L41 +QgsRectangle.QVariant: src/core/geometry/qgsrectangle.h#L628 +QgsRectangle.QgsRectangle: src/core/geometry/qgsrectangle.h#L78 +QgsRectangle.__repr__: src/core/geometry/qgsrectangle.h#L639 +QgsRectangle.area: src/core/geometry/qgsrectangle.h#L266 +QgsRectangle.asPolygon: src/core/geometry/qgsrectangle.h#L562 +QgsRectangle.asWktCoordinates: src/core/geometry/qgsrectangle.h#L537 +QgsRectangle.asWktPolygon: src/core/geometry/qgsrectangle.h#L542 +QgsRectangle.buffered: src/core/geometry/qgsrectangle.h#L365 +QgsRectangle.center: src/core/geometry/qgsrectangle.h#L277 +QgsRectangle.combineExtentWith: src/core/geometry/qgsrectangle.h#L444 +QgsRectangle.combineExtentWith: src/core/geometry/qgsrectangle.h#L461 +QgsRectangle.combineExtentWith: src/core/geometry/qgsrectangle.h#L470 +QgsRectangle.contains: src/core/geometry/qgsrectangle.h#L408 +QgsRectangle.contains: src/core/geometry/qgsrectangle.h#L417 +QgsRectangle.contains: src/core/geometry/qgsrectangle.h#L428 +QgsRectangle.distance: src/core/geometry/qgsrectangle.h#L481 +QgsRectangle.fromCenterAndSize: src/core/geometry/qgsrectangle.h#L127 +QgsRectangle.fromWkt: src/core/geometry/qgsrectangle.h#L121 +QgsRectangle.grow: src/core/geometry/qgsrectangle.h#L330 +QgsRectangle.height: src/core/geometry/qgsrectangle.h#L258 +QgsRectangle.include: src/core/geometry/qgsrectangle.h#L353 +QgsRectangle.intersect: src/core/geometry/qgsrectangle.h#L381 +QgsRectangle.intersects: src/core/geometry/qgsrectangle.h#L400 +QgsRectangle.invert: src/core/geometry/qgsrectangle.h#L616 +QgsRectangle.isEmpty: src/core/geometry/qgsrectangle.h#L515 +QgsRectangle.isFinite: src/core/geometry/qgsrectangle.h#L607 +QgsRectangle.isNull: src/core/geometry/qgsrectangle.h#L532 +QgsRectangle.normalize: src/core/geometry/qgsrectangle.h#L244 +QgsRectangle.perimeter: src/core/geometry/qgsrectangle.h#L272 +QgsRectangle.scale: src/core/geometry/qgsrectangle.h#L297 +QgsRectangle.scale: src/core/geometry/qgsrectangle.h#L310 +QgsRectangle.scaled: src/core/geometry/qgsrectangle.h#L316 +QgsRectangle.set: src/core/geometry/qgsrectangle.h#L143 +QgsRectangle.set: src/core/geometry/qgsrectangle.h#L159 +QgsRectangle.setMinimal: src/core/geometry/qgsrectangle.h#L206 +QgsRectangle.setNull: src/core/geometry/qgsrectangle.h#L195 +QgsRectangle.setXMaximum: src/core/geometry/qgsrectangle.h#L169 +QgsRectangle.setXMinimum: src/core/geometry/qgsrectangle.h#L164 +QgsRectangle.setYMaximum: src/core/geometry/qgsrectangle.h#L179 +QgsRectangle.setYMinimum: src/core/geometry/qgsrectangle.h#L174 +QgsRectangle.snappedToGrid: src/core/geometry/qgsrectangle.h#L636 +QgsRectangle.toBox3d: src/core/geometry/qgsrectangle.h#L622 +QgsRectangle.toRectF: src/core/geometry/qgsrectangle.h#L550 +QgsRectangle.toString: src/core/geometry/qgsrectangle.h#L557 +QgsRectangle.width: src/core/geometry/qgsrectangle.h#L251 +QgsRectangle.xMaximum: src/core/geometry/qgsrectangle.h#L211 +QgsRectangle.xMinimum: src/core/geometry/qgsrectangle.h#L216 +QgsRectangle.yMaximum: src/core/geometry/qgsrectangle.h#L221 +QgsRectangle.yMinimum: src/core/geometry/qgsrectangle.h#L226 +QgsRectangle: src/core/geometry/qgsrectangle.h#L43 QgsReferencedGeometry.QVariant: src/core/geometry/qgsreferencedgeometry.h#L164 QgsReferencedGeometry.__repr__: src/core/geometry/qgsreferencedgeometry.h#L181 QgsReferencedGeometry.fromReferencedPointXY: src/core/geometry/qgsreferencedgeometry.h#L172 @@ -15320,48 +15328,48 @@ QgsReportSectionLayout.setBodyEnabled: src/core/layout/qgsreportsectionlayout.h# QgsReportSectionLayout.type: src/core/layout/qgsreportsectionlayout.h#L43 QgsReportSectionLayout.writePropertiesToElement: src/core/layout/qgsreportsectionlayout.h#L87 QgsReportSectionLayout: src/core/layout/qgsreportsectionlayout.h#L33 -QgsRuleBasedLabeling.QgsRuleBasedLabeling: src/core/labeling/qgsrulebasedlabeling.h#L359 -QgsRuleBasedLabeling.Rule.accept: src/core/labeling/qgsrulebasedlabeling.h#L304 -QgsRuleBasedLabeling.Rule.active: src/core/labeling/qgsrulebasedlabeling.h#L119 -QgsRuleBasedLabeling.Rule.appendChild: src/core/labeling/qgsrulebasedlabeling.h#L220 -QgsRuleBasedLabeling.Rule.clone: src/core/labeling/qgsrulebasedlabeling.h#L242 -QgsRuleBasedLabeling.Rule.create: src/core/labeling/qgsrulebasedlabeling.h#L253 -QgsRuleBasedLabeling.Rule.dependsOnScale: src/core/labeling/qgsrulebasedlabeling.h#L81 -QgsRuleBasedLabeling.Rule.descendants: src/core/labeling/qgsrulebasedlabeling.h#L203 -QgsRuleBasedLabeling.Rule.description: src/core/labeling/qgsrulebasedlabeling.h#L112 -QgsRuleBasedLabeling.Rule.filterExpression: src/core/labeling/qgsrulebasedlabeling.h#L105 -QgsRuleBasedLabeling.Rule.findRuleByKey: src/core/labeling/qgsrulebasedlabeling.h#L229 -QgsRuleBasedLabeling.Rule.insertChild: src/core/labeling/qgsrulebasedlabeling.h#L223 -QgsRuleBasedLabeling.Rule.isElse: src/core/labeling/qgsrulebasedlabeling.h#L126 -QgsRuleBasedLabeling.Rule.maximumScale: src/core/labeling/qgsrulebasedlabeling.h#L90 -QgsRuleBasedLabeling.Rule.minimumScale: src/core/labeling/qgsrulebasedlabeling.h#L99 -QgsRuleBasedLabeling.Rule.parent: src/core/labeling/qgsrulebasedlabeling.h#L217 -QgsRuleBasedLabeling.Rule.removeChildAt: src/core/labeling/qgsrulebasedlabeling.h#L226 -QgsRuleBasedLabeling.Rule.requiresAdvancedEffects: src/core/labeling/qgsrulebasedlabeling.h#L293 -QgsRuleBasedLabeling.Rule.ruleKey: src/core/labeling/qgsrulebasedlabeling.h#L129 -QgsRuleBasedLabeling.Rule.save: src/core/labeling/qgsrulebasedlabeling.h#L256 -QgsRuleBasedLabeling.Rule.setActive: src/core/labeling/qgsrulebasedlabeling.h#L170 -QgsRuleBasedLabeling.Rule.setDescription: src/core/labeling/qgsrulebasedlabeling.h#L164 -QgsRuleBasedLabeling.Rule.setFilterExpression: src/core/labeling/qgsrulebasedlabeling.h#L157 -QgsRuleBasedLabeling.Rule.setIsElse: src/core/labeling/qgsrulebasedlabeling.h#L177 -QgsRuleBasedLabeling.Rule.setMaximumScale: src/core/labeling/qgsrulebasedlabeling.h#L150 -QgsRuleBasedLabeling.Rule.setMinimumScale: src/core/labeling/qgsrulebasedlabeling.h#L141 -QgsRuleBasedLabeling.Rule.setRuleKey: src/core/labeling/qgsrulebasedlabeling.h#L180 -QgsRuleBasedLabeling.Rule.setSettings: src/core/labeling/qgsrulebasedlabeling.h#L132 -QgsRuleBasedLabeling.Rule.settings: src/core/labeling/qgsrulebasedlabeling.h#L74 -QgsRuleBasedLabeling.Rule: src/core/labeling/qgsrulebasedlabeling.h#L53 -QgsRuleBasedLabeling.accept: src/core/labeling/qgsrulebasedlabeling.h#L377 -QgsRuleBasedLabeling.clone: src/core/labeling/qgsrulebasedlabeling.h#L371 -QgsRuleBasedLabeling.create: src/core/labeling/qgsrulebasedlabeling.h#L366 -QgsRuleBasedLabeling.multiplyOpacity: src/core/labeling/qgsrulebasedlabeling.h#L389 -QgsRuleBasedLabeling.requiresAdvancedEffects: src/core/labeling/qgsrulebasedlabeling.h#L387 -QgsRuleBasedLabeling.rootRule: src/core/labeling/qgsrulebasedlabeling.h#L362 -QgsRuleBasedLabeling.save: src/core/labeling/qgsrulebasedlabeling.h#L372 -QgsRuleBasedLabeling.setSettings: src/core/labeling/qgsrulebasedlabeling.h#L386 -QgsRuleBasedLabeling.settings: src/core/labeling/qgsrulebasedlabeling.h#L376 -QgsRuleBasedLabeling.subProviders: src/core/labeling/qgsrulebasedlabeling.h#L375 -QgsRuleBasedLabeling.toSld: src/core/labeling/qgsrulebasedlabeling.h#L388 -QgsRuleBasedLabeling.type: src/core/labeling/qgsrulebasedlabeling.h#L370 +QgsRuleBasedLabeling.QgsRuleBasedLabeling: src/core/labeling/qgsrulebasedlabeling.h#L366 +QgsRuleBasedLabeling.Rule.accept: src/core/labeling/qgsrulebasedlabeling.h#L311 +QgsRuleBasedLabeling.Rule.active: src/core/labeling/qgsrulebasedlabeling.h#L122 +QgsRuleBasedLabeling.Rule.appendChild: src/core/labeling/qgsrulebasedlabeling.h#L223 +QgsRuleBasedLabeling.Rule.clone: src/core/labeling/qgsrulebasedlabeling.h#L249 +QgsRuleBasedLabeling.Rule.create: src/core/labeling/qgsrulebasedlabeling.h#L260 +QgsRuleBasedLabeling.Rule.dependsOnScale: src/core/labeling/qgsrulebasedlabeling.h#L84 +QgsRuleBasedLabeling.Rule.descendants: src/core/labeling/qgsrulebasedlabeling.h#L206 +QgsRuleBasedLabeling.Rule.description: src/core/labeling/qgsrulebasedlabeling.h#L115 +QgsRuleBasedLabeling.Rule.filterExpression: src/core/labeling/qgsrulebasedlabeling.h#L108 +QgsRuleBasedLabeling.Rule.findRuleByKey: src/core/labeling/qgsrulebasedlabeling.h#L232 +QgsRuleBasedLabeling.Rule.insertChild: src/core/labeling/qgsrulebasedlabeling.h#L226 +QgsRuleBasedLabeling.Rule.isElse: src/core/labeling/qgsrulebasedlabeling.h#L129 +QgsRuleBasedLabeling.Rule.maximumScale: src/core/labeling/qgsrulebasedlabeling.h#L93 +QgsRuleBasedLabeling.Rule.minimumScale: src/core/labeling/qgsrulebasedlabeling.h#L102 +QgsRuleBasedLabeling.Rule.parent: src/core/labeling/qgsrulebasedlabeling.h#L220 +QgsRuleBasedLabeling.Rule.removeChildAt: src/core/labeling/qgsrulebasedlabeling.h#L229 +QgsRuleBasedLabeling.Rule.requiresAdvancedEffects: src/core/labeling/qgsrulebasedlabeling.h#L300 +QgsRuleBasedLabeling.Rule.ruleKey: src/core/labeling/qgsrulebasedlabeling.h#L132 +QgsRuleBasedLabeling.Rule.save: src/core/labeling/qgsrulebasedlabeling.h#L263 +QgsRuleBasedLabeling.Rule.setActive: src/core/labeling/qgsrulebasedlabeling.h#L173 +QgsRuleBasedLabeling.Rule.setDescription: src/core/labeling/qgsrulebasedlabeling.h#L167 +QgsRuleBasedLabeling.Rule.setFilterExpression: src/core/labeling/qgsrulebasedlabeling.h#L160 +QgsRuleBasedLabeling.Rule.setIsElse: src/core/labeling/qgsrulebasedlabeling.h#L180 +QgsRuleBasedLabeling.Rule.setMaximumScale: src/core/labeling/qgsrulebasedlabeling.h#L153 +QgsRuleBasedLabeling.Rule.setMinimumScale: src/core/labeling/qgsrulebasedlabeling.h#L144 +QgsRuleBasedLabeling.Rule.setRuleKey: src/core/labeling/qgsrulebasedlabeling.h#L183 +QgsRuleBasedLabeling.Rule.setSettings: src/core/labeling/qgsrulebasedlabeling.h#L135 +QgsRuleBasedLabeling.Rule.settings: src/core/labeling/qgsrulebasedlabeling.h#L77 +QgsRuleBasedLabeling.Rule: src/core/labeling/qgsrulebasedlabeling.h#L56 +QgsRuleBasedLabeling.accept: src/core/labeling/qgsrulebasedlabeling.h#L384 +QgsRuleBasedLabeling.clone: src/core/labeling/qgsrulebasedlabeling.h#L378 +QgsRuleBasedLabeling.create: src/core/labeling/qgsrulebasedlabeling.h#L373 +QgsRuleBasedLabeling.multiplyOpacity: src/core/labeling/qgsrulebasedlabeling.h#L396 +QgsRuleBasedLabeling.requiresAdvancedEffects: src/core/labeling/qgsrulebasedlabeling.h#L394 +QgsRuleBasedLabeling.rootRule: src/core/labeling/qgsrulebasedlabeling.h#L369 +QgsRuleBasedLabeling.save: src/core/labeling/qgsrulebasedlabeling.h#L379 +QgsRuleBasedLabeling.setSettings: src/core/labeling/qgsrulebasedlabeling.h#L393 +QgsRuleBasedLabeling.settings: src/core/labeling/qgsrulebasedlabeling.h#L383 +QgsRuleBasedLabeling.subProviders: src/core/labeling/qgsrulebasedlabeling.h#L382 +QgsRuleBasedLabeling.toSld: src/core/labeling/qgsrulebasedlabeling.h#L395 +QgsRuleBasedLabeling.type: src/core/labeling/qgsrulebasedlabeling.h#L377 QgsRuleBasedLabeling: src/core/labeling/qgsrulebasedlabeling.h#L41 QgsRuleBasedRenderer.QgsRuleBasedRenderer.RenderLevel: src/core/symbology/qgsrulebasedrenderer.h#L102 QgsRuleBasedRenderer.Rule.accept: src/core/symbology/qgsrulebasedrenderer.h#L460 @@ -15797,7 +15805,7 @@ QgsScientificNumericFormat.setNumberDecimalPlaces: src/core/numericformats/qgssc QgsScientificNumericFormat.sortKey: src/core/numericformats/qgsscientificnumericformat.h#L39 QgsScientificNumericFormat.visibleName: src/core/numericformats/qgsscientificnumericformat.h#L38 QgsScientificNumericFormat: src/core/numericformats/qgsscientificnumericformat.h#L28 -QgsScopeLogger: src/core/qgslogger.h#L135 +QgsScopeLogger: src/core/qgslogger.h#L139 QgsScopedExpressionFunction.clone: src/core/qgsexpressioncontext.h#L87 QgsScopedExpressionFunction.func: src/core/qgsexpressioncontext.h#L82 QgsScopedExpressionFunction.isStatic: src/core/qgsexpressioncontext.h#L93 @@ -15856,37 +15864,37 @@ QgsSensorRegistry.removeSensorType: src/core/sensor/qgssensorregistry.h#L187 QgsSensorRegistry.sensorAdded: src/core/sensor/qgssensorregistry.h#L205 QgsSensorRegistry.sensorMetadata: src/core/sensor/qgssensorregistry.h#L161 QgsSensorRegistry: src/core/sensor/qgssensorregistry.h#L131 -QgsSensorThingsExpansionDefinition.__repr__: src/core/providers/sensorthings/qgssensorthingsutils.h#L314 -QgsSensorThingsExpansionDefinition.asQueryString: src/core/providers/sensorthings/qgssensorthingsutils.h#L308 -QgsSensorThingsExpansionDefinition.childEntity: src/core/providers/sensorthings/qgssensorthingsutils.h#L214 -QgsSensorThingsExpansionDefinition.defaultDefinitionForEntity: src/core/providers/sensorthings/qgssensorthingsutils.h#L202 -QgsSensorThingsExpansionDefinition.filter: src/core/providers/sensorthings/qgssensorthingsutils.h#L278 -QgsSensorThingsExpansionDefinition.fromString: src/core/providers/sensorthings/qgssensorthingsutils.h#L299 -QgsSensorThingsExpansionDefinition.isValid: src/core/providers/sensorthings/qgssensorthingsutils.h#L207 -QgsSensorThingsExpansionDefinition.limit: src/core/providers/sensorthings/qgssensorthingsutils.h#L262 -QgsSensorThingsExpansionDefinition.orderBy: src/core/providers/sensorthings/qgssensorthingsutils.h#L229 -QgsSensorThingsExpansionDefinition.setChildEntity: src/core/providers/sensorthings/qgssensorthingsutils.h#L221 -QgsSensorThingsExpansionDefinition.setFilter: src/core/providers/sensorthings/qgssensorthingsutils.h#L285 -QgsSensorThingsExpansionDefinition.setLimit: src/core/providers/sensorthings/qgssensorthingsutils.h#L271 -QgsSensorThingsExpansionDefinition.setOrderBy: src/core/providers/sensorthings/qgssensorthingsutils.h#L237 -QgsSensorThingsExpansionDefinition.setSortOrder: src/core/providers/sensorthings/qgssensorthingsutils.h#L253 -QgsSensorThingsExpansionDefinition.sortOrder: src/core/providers/sensorthings/qgssensorthingsutils.h#L245 -QgsSensorThingsExpansionDefinition.toString: src/core/providers/sensorthings/qgssensorthingsutils.h#L292 -QgsSensorThingsExpansionDefinition: src/core/providers/sensorthings/qgssensorthingsutils.h#L185 -QgsSensorThingsUtils.asQueryString: src/core/providers/sensorthings/qgssensorthingsutils.h#L174 -QgsSensorThingsUtils.combineFilters: src/core/providers/sensorthings/qgssensorthingsutils.h#L137 +QgsSensorThingsExpansionDefinition.__repr__: src/core/providers/sensorthings/qgssensorthingsutils.h#L317 +QgsSensorThingsExpansionDefinition.asQueryString: src/core/providers/sensorthings/qgssensorthingsutils.h#L311 +QgsSensorThingsExpansionDefinition.childEntity: src/core/providers/sensorthings/qgssensorthingsutils.h#L217 +QgsSensorThingsExpansionDefinition.defaultDefinitionForEntity: src/core/providers/sensorthings/qgssensorthingsutils.h#L205 +QgsSensorThingsExpansionDefinition.filter: src/core/providers/sensorthings/qgssensorthingsutils.h#L281 +QgsSensorThingsExpansionDefinition.fromString: src/core/providers/sensorthings/qgssensorthingsutils.h#L302 +QgsSensorThingsExpansionDefinition.isValid: src/core/providers/sensorthings/qgssensorthingsutils.h#L210 +QgsSensorThingsExpansionDefinition.limit: src/core/providers/sensorthings/qgssensorthingsutils.h#L265 +QgsSensorThingsExpansionDefinition.orderBy: src/core/providers/sensorthings/qgssensorthingsutils.h#L232 +QgsSensorThingsExpansionDefinition.setChildEntity: src/core/providers/sensorthings/qgssensorthingsutils.h#L224 +QgsSensorThingsExpansionDefinition.setFilter: src/core/providers/sensorthings/qgssensorthingsutils.h#L288 +QgsSensorThingsExpansionDefinition.setLimit: src/core/providers/sensorthings/qgssensorthingsutils.h#L274 +QgsSensorThingsExpansionDefinition.setOrderBy: src/core/providers/sensorthings/qgssensorthingsutils.h#L240 +QgsSensorThingsExpansionDefinition.setSortOrder: src/core/providers/sensorthings/qgssensorthingsutils.h#L256 +QgsSensorThingsExpansionDefinition.sortOrder: src/core/providers/sensorthings/qgssensorthingsutils.h#L248 +QgsSensorThingsExpansionDefinition.toString: src/core/providers/sensorthings/qgssensorthingsutils.h#L295 +QgsSensorThingsExpansionDefinition: src/core/providers/sensorthings/qgssensorthingsutils.h#L188 +QgsSensorThingsUtils.asQueryString: src/core/providers/sensorthings/qgssensorthingsutils.h#L177 +QgsSensorThingsUtils.combineFilters: src/core/providers/sensorthings/qgssensorthingsutils.h#L140 QgsSensorThingsUtils.displayString: src/core/providers/sensorthings/qgssensorthingsutils.h#L59 QgsSensorThingsUtils.entitySetStringToEntity: src/core/providers/sensorthings/qgssensorthingsutils.h#L66 QgsSensorThingsUtils.entityToSetString: src/core/providers/sensorthings/qgssensorthingsutils.h#L73 -QgsSensorThingsUtils.entityTypeHasGeometry: src/core/providers/sensorthings/qgssensorthingsutils.h#L103 -QgsSensorThingsUtils.fieldsForEntityType: src/core/providers/sensorthings/qgssensorthingsutils.h#L85 -QgsSensorThingsUtils.fieldsForExpandedEntityType: src/core/providers/sensorthings/qgssensorthingsutils.h#L93 -QgsSensorThingsUtils.filterForExtent: src/core/providers/sensorthings/qgssensorthingsutils.h#L128 -QgsSensorThingsUtils.filterForWkbType: src/core/providers/sensorthings/qgssensorthingsutils.h#L118 -QgsSensorThingsUtils.geometryFieldForEntityType: src/core/providers/sensorthings/qgssensorthingsutils.h#L98 -QgsSensorThingsUtils.geometryTypeForEntity: src/core/providers/sensorthings/qgssensorthingsutils.h#L112 +QgsSensorThingsUtils.entityTypeHasGeometry: src/core/providers/sensorthings/qgssensorthingsutils.h#L106 +QgsSensorThingsUtils.fieldsForEntityType: src/core/providers/sensorthings/qgssensorthingsutils.h#L88 +QgsSensorThingsUtils.fieldsForExpandedEntityType: src/core/providers/sensorthings/qgssensorthingsutils.h#L96 +QgsSensorThingsUtils.filterForExtent: src/core/providers/sensorthings/qgssensorthingsutils.h#L131 +QgsSensorThingsUtils.filterForWkbType: src/core/providers/sensorthings/qgssensorthingsutils.h#L121 +QgsSensorThingsUtils.geometryFieldForEntityType: src/core/providers/sensorthings/qgssensorthingsutils.h#L101 +QgsSensorThingsUtils.geometryTypeForEntity: src/core/providers/sensorthings/qgssensorthingsutils.h#L115 QgsSensorThingsUtils.propertiesForEntityType: src/core/providers/sensorthings/qgssensorthingsutils.h#L80 -QgsSensorThingsUtils.relationshipCardinality: src/core/providers/sensorthings/qgssensorthingsutils.h#L165 +QgsSensorThingsUtils.relationshipCardinality: src/core/providers/sensorthings/qgssensorthingsutils.h#L168 QgsSensorThingsUtils.stringToEntity: src/core/providers/sensorthings/qgssensorthingsutils.h#L52 QgsSensorThingsUtils: src/core/providers/sensorthings/qgssensorthingsutils.h#L33 QgsSerialPortSensor.QgsSerialPortSensor: src/core/sensor/qgsiodevicesensor.h#L241 @@ -16042,10 +16050,10 @@ QgsSettingsRegistry.removeSubRegistry: src/core/settings/qgssettingsregistry.h#L QgsSettingsRegistry.settingsEntry: src/core/settings/qgssettingsregistry.h#L55 QgsSettingsRegistry: src/core/settings/qgssettingsregistry.h#L38 QgsSettingsRegistryCore: src/core/settings/qgssettingsregistrycore.h#L43 -QgsSettingsTree.createPluginTreeNode: src/core/settings/qgssettingstree.h#L81 -QgsSettingsTree.node: src/core/settings/qgssettingstree.h#L76 +QgsSettingsTree.createPluginTreeNode: src/core/settings/qgssettingstree.h#L82 +QgsSettingsTree.node: src/core/settings/qgssettingstree.h#L77 QgsSettingsTree.treeRoot: src/core/settings/qgssettingstree.h#L38 -QgsSettingsTree.unregisterPluginTreeNode: src/core/settings/qgssettingstree.h#L87 +QgsSettingsTree.unregisterPluginTreeNode: src/core/settings/qgssettingstree.h#L88 QgsSettingsTree: src/core/settings/qgssettingstree.h#L30 QgsSettingsTreeNamedListNode.deleteAllItems: src/core/settings/qgssettingstreenode.h#L240 QgsSettingsTreeNamedListNode.deleteItem: src/core/settings/qgssettingstreenode.h#L232 @@ -16378,6 +16386,7 @@ QgsSingleBandPseudoColorRenderer.shader: src/core/raster/qgssinglebandpseudocolo QgsSingleBandPseudoColorRenderer.toSld: src/core/raster/qgssinglebandpseudocolorrenderer.h#L84 QgsSingleBandPseudoColorRenderer.writeXml: src/core/raster/qgssinglebandpseudocolorrenderer.h#L80 QgsSingleBandPseudoColorRenderer: src/core/raster/qgssinglebandpseudocolorrenderer.h#L34 +QgsSingleBoxScaleBarRenderer.applyDefaultSettings: src/core/scalebar/qgssingleboxscalebarrenderer.h#L46 QgsSingleBoxScaleBarRenderer.clone: src/core/scalebar/qgssingleboxscalebarrenderer.h#L40 QgsSingleBoxScaleBarRenderer.draw: src/core/scalebar/qgssingleboxscalebarrenderer.h#L42 QgsSingleBoxScaleBarRenderer.flags: src/core/scalebar/qgssingleboxscalebarrenderer.h#L39 @@ -17138,6 +17147,7 @@ QgsSymbolLayerUtils.applyScaleDependency: src/core/symbology/qgssymbollayerutils QgsSymbolLayerUtils.blurImageInPlace: src/core/symbology/qgssymbollayerutils.h#L711 QgsSymbolLayerUtils.clearSymbolLayerIds: src/core/symbology/qgssymbollayerutils.h#L932 QgsSymbolLayerUtils.clearSymbolLayerIds: src/core/symbology/qgssymbollayerutils.h#L938 +QgsSymbolLayerUtils.clearSymbolLayerMasks: src/core/symbology/qgssymbollayerutils.h#L956 QgsSymbolLayerUtils.clearSymbolMap: src/core/symbology/qgssymbollayerutils.h#L568 QgsSymbolLayerUtils.colorFromMimeData: src/core/symbology/qgssymbollayerutils.h#L649 QgsSymbolLayerUtils.colorListFromMimeData: src/core/symbology/qgssymbollayerutils.h#L656 @@ -18161,6 +18171,7 @@ QgsTrackedVectorLayerTools.stopEditing: src/core/qgstrackedvectorlayertools.h#L4 QgsTrackedVectorLayerTools: src/core/qgstrackedvectorlayertools.h#L27 QgsTransaction.addLayer: src/core/qgstransaction.h#L90 QgsTransaction.afterRollback: src/core/qgstransaction.h#L174 +QgsTransaction.afterRollbackToSavepoint: src/core/qgstransaction.h#L180 QgsTransaction.begin: src/core/qgstransaction.h#L102 QgsTransaction.commit: src/core/qgstransaction.h#L107 QgsTransaction.connectionString: src/core/qgstransaction.h#L81 @@ -18168,7 +18179,7 @@ QgsTransaction.create: src/core/qgstransaction.h#L66 QgsTransaction.create: src/core/qgstransaction.h#L73 QgsTransaction.createSavepoint: src/core/qgstransaction.h#L136 QgsTransaction.createSavepoint: src/core/qgstransaction.h#L142 -QgsTransaction.dirtied: src/core/qgstransaction.h#L179 +QgsTransaction.dirtied: src/core/qgstransaction.h#L185 QgsTransaction.dirtyLastSavePoint: src/core/qgstransaction.h#L152 QgsTransaction.executeSql: src/core/qgstransaction.h#L124 QgsTransaction.lastSavePointIsDirty: src/core/qgstransaction.h#L162 diff --git a/python/gui/auto_additions/qgsplotrubberband.py b/python/gui/auto_additions/qgsplotrubberband.py index 9a49316800bf..e9bfb798644f 100644 --- a/python/gui/auto_additions/qgsplotrubberband.py +++ b/python/gui/auto_additions/qgsplotrubberband.py @@ -7,3 +7,7 @@ QgsPlotRectangularRubberBand.__group__ = ['plot'] except (NameError, AttributeError): pass +try: + QgsPlotPointRubberBand.__group__ = ['plot'] +except (NameError, AttributeError): + pass diff --git a/python/gui/auto_generated/auth/qgsauthsettingswidget.sip.in b/python/gui/auto_generated/auth/qgsauthsettingswidget.sip.in index a7a969fa8c8a..aebdcc09c56b 100644 --- a/python/gui/auto_generated/auth/qgsauthsettingswidget.sip.in +++ b/python/gui/auto_generated/auth/qgsauthsettingswidget.sip.in @@ -39,6 +39,13 @@ from existing configs, or creating/removing them from auth database :param username: :param password: :param dataprovider: The key of the calling layer provider, if applicable +%End + + void removeBasicSettings(); +%Docstring +Removes the basic authentication tab from the widget. + +.. versionadded:: 3.42 %End void setWarningText( const QString &warningText ); diff --git a/python/gui/auto_generated/elevation/qgselevationprofilecanvas.sip.in b/python/gui/auto_generated/elevation/qgselevationprofilecanvas.sip.in index 7cb9766d6283..d1cbf04ac720 100644 --- a/python/gui/auto_generated/elevation/qgselevationprofilecanvas.sip.in +++ b/python/gui/auto_generated/elevation/qgselevationprofilecanvas.sip.in @@ -249,6 +249,13 @@ The chart text, border and axis color will be automatically updated to ensure readability with the new background color. .. versionadded:: 3.34 +%End + + void setInflectionLinesEnabled( bool enabled ); +%Docstring +Sets whether inflection lines are displayed. + +.. versionadded:: 3.44 %End signals: @@ -280,6 +287,57 @@ Clears the current profile. void setSnappingEnabled( bool enabled ); %Docstring Sets whether snapping of cursor points is enabled. +%End + + void setCrossHairsItemIsDelegate( bool enabled ); +%Docstring +Sets wether the cross hairs item is controlled externally + +.. versionadded:: 3.42 +%End + + bool crossHairsItemIsDelegate(); +%Docstring +Returns wether the cross hairs item is controlled externally + +.. versionadded:: 3.42 +%End + + void setCrossHairsItemPoint( QPoint point ); +%Docstring +Sets the cross hairs item point (if cross hairs items is controlled externally) + +.. seealso:: :py:func:`setCrossHairsItemIsDelegate` + +.. seealso:: :py:func:`crossHairsItemIsDelegate` + +.. versionadded:: 3.42 +%End + + void showCrossHairsItem(); +%Docstring +Show the cross hairs item if cross hairs items is controlled externally) + +.. seealso:: :py:func:`setCrossHairsItemIsDelegate` + +.. seealso:: :py:func:`crossHairsItemIsDelegate` + +.. seealso:: :py:func:`hideCrossHairsItem` + +.. versionadded:: 3.42 +%End + + void hideCrossHairsItem(); +%Docstring +Hide the cross hairs item if cross hairs items is controlled externally) + +.. seealso:: :py:func:`setCrossHairsItemIsDelegate` + +.. seealso:: :py:func:`crossHairsItemIsDelegate` + +.. seealso:: :py:func:`showCrossHairsItem` + +.. versionadded:: 3.42 %End }; diff --git a/python/gui/auto_generated/maptools/qgsmaptoolcapture.sip.in b/python/gui/auto_generated/maptools/qgsmaptoolcapture.sip.in index b9741b4434ea..ae44e18c268b 100644 --- a/python/gui/auto_generated/maptools/qgsmaptoolcapture.sip.in +++ b/python/gui/auto_generated/maptools/qgsmaptoolcapture.sip.in @@ -222,14 +222,13 @@ Converts a point to map coordinates and layer coordinates int fetchLayerPoint( const QgsPointLocator::Match &match, QgsPoint &layerPoint ); %Docstring -Fetches the original point from the source layer if it has the same -CRS as the current layer. -If topological editing is activated, the points are projected to the -current layer CRS. +Fetches the original point from the source layer. +If topological editing is activated. +The points are projected to the current layer CRS. :return: 0 in case of success - 1 if not applicable (CRS mismatch / invalid layer) + 1 if not applicable (invalid layer) 2 in case of failure %End diff --git a/python/gui/auto_generated/plot/qgsplotrubberband.sip.in b/python/gui/auto_generated/plot/qgsplotrubberband.sip.in index 2e74d7bd951c..570c9402b102 100644 --- a/python/gui/auto_generated/plot/qgsplotrubberband.sip.in +++ b/python/gui/auto_generated/plot/qgsplotrubberband.sip.in @@ -128,6 +128,35 @@ Constructor for QgsPlotRectangularRubberBand. virtual QRectF finish( QPointF position = QPointF(), Qt::KeyboardModifiers modifiers = Qt::KeyboardModifiers() ); +}; + +class QgsPlotPointRubberBand : QgsPlotRubberBand +{ +%Docstring(signature="appended") +:py:class:`QgsPlotPointRubberBand` is a point rubber band for use within :py:class:`QgsPlotCanvas` widgets. + +.. versionadded:: 3.42 +%End + +%TypeHeaderCode +#include "qgsplotrubberband.h" +%End + public: + + QgsPlotPointRubberBand( QgsPlotCanvas *canvas = 0 ); +%Docstring +Constructor for QgsPlotPointRubberBand. +%End + + ~QgsPlotPointRubberBand(); + + virtual void start( QPointF position, Qt::KeyboardModifiers modifiers ); + + virtual void update( QPointF position, Qt::KeyboardModifiers modifiers ); + + virtual QRectF finish( QPointF position = QPointF(), Qt::KeyboardModifiers modifiers = Qt::KeyboardModifiers() ); + + }; /************************************************************************ diff --git a/python/gui/class_map.yaml b/python/gui/class_map.yaml index 36159cfac9fb..ae44d8f23fae 100644 --- a/python/gui/class_map.yaml +++ b/python/gui/class_map.yaml @@ -1022,28 +1022,29 @@ QgsAuthServersEditor.QgsAuthServersEditor: src/gui/auth/qgsauthserverseditor.h#L QgsAuthServersEditor.showEvent: src/gui/auth/qgsauthserverseditor.h#L69 QgsAuthServersEditor: src/gui/auth/qgsauthserverseditor.h#L33 QgsAuthSettingsWidget.QgsAuthSettingsWidget: src/gui/auth/qgsauthsettingswidget.h#L63 -QgsAuthSettingsWidget.btnConvertToEncryptedIsEnabled: src/gui/auth/qgsauthsettingswidget.h#L137 -QgsAuthSettingsWidget.configId: src/gui/auth/qgsauthsettingswidget.h#L106 -QgsAuthSettingsWidget.configIdChanged: src/gui/auth/qgsauthsettingswidget.h#L211 -QgsAuthSettingsWidget.configurationTabIsSelected: src/gui/auth/qgsauthsettingswidget.h#L178 -QgsAuthSettingsWidget.convertToEncrypted: src/gui/auth/qgsauthsettingswidget.h#L188 -QgsAuthSettingsWidget.dataprovider: src/gui/auth/qgsauthsettingswidget.h#L124 -QgsAuthSettingsWidget.formattedWarning: src/gui/auth/qgsauthsettingswidget.h#L131 -QgsAuthSettingsWidget.password: src/gui/auth/qgsauthsettingswidget.h#L94 -QgsAuthSettingsWidget.passwordChanged: src/gui/auth/qgsauthsettingswidget.h#L204 -QgsAuthSettingsWidget.setBasicText: src/gui/auth/qgsauthsettingswidget.h#L76 -QgsAuthSettingsWidget.setConfigId: src/gui/auth/qgsauthsettingswidget.h#L112 -QgsAuthSettingsWidget.setDataprovider: src/gui/auth/qgsauthsettingswidget.h#L118 -QgsAuthSettingsWidget.setPassword: src/gui/auth/qgsauthsettingswidget.h#L100 -QgsAuthSettingsWidget.setStorePasswordChecked: src/gui/auth/qgsauthsettingswidget.h#L160 -QgsAuthSettingsWidget.setStoreUsernameChecked: src/gui/auth/qgsauthsettingswidget.h#L153 -QgsAuthSettingsWidget.setUsername: src/gui/auth/qgsauthsettingswidget.h#L88 -QgsAuthSettingsWidget.setWarningText: src/gui/auth/qgsauthsettingswidget.h#L70 -QgsAuthSettingsWidget.showStoreCheckboxes: src/gui/auth/qgsauthsettingswidget.h#L146 -QgsAuthSettingsWidget.storePasswordIsChecked: src/gui/auth/qgsauthsettingswidget.h#L166 -QgsAuthSettingsWidget.storeUsernameIsChecked: src/gui/auth/qgsauthsettingswidget.h#L172 -QgsAuthSettingsWidget.username: src/gui/auth/qgsauthsettingswidget.h#L82 -QgsAuthSettingsWidget.usernameChanged: src/gui/auth/qgsauthsettingswidget.h#L197 +QgsAuthSettingsWidget.btnConvertToEncryptedIsEnabled: src/gui/auth/qgsauthsettingswidget.h#L144 +QgsAuthSettingsWidget.configId: src/gui/auth/qgsauthsettingswidget.h#L113 +QgsAuthSettingsWidget.configIdChanged: src/gui/auth/qgsauthsettingswidget.h#L218 +QgsAuthSettingsWidget.configurationTabIsSelected: src/gui/auth/qgsauthsettingswidget.h#L185 +QgsAuthSettingsWidget.convertToEncrypted: src/gui/auth/qgsauthsettingswidget.h#L195 +QgsAuthSettingsWidget.dataprovider: src/gui/auth/qgsauthsettingswidget.h#L131 +QgsAuthSettingsWidget.formattedWarning: src/gui/auth/qgsauthsettingswidget.h#L138 +QgsAuthSettingsWidget.password: src/gui/auth/qgsauthsettingswidget.h#L101 +QgsAuthSettingsWidget.passwordChanged: src/gui/auth/qgsauthsettingswidget.h#L211 +QgsAuthSettingsWidget.removeBasicSettings: src/gui/auth/qgsauthsettingswidget.h#L70 +QgsAuthSettingsWidget.setBasicText: src/gui/auth/qgsauthsettingswidget.h#L83 +QgsAuthSettingsWidget.setConfigId: src/gui/auth/qgsauthsettingswidget.h#L119 +QgsAuthSettingsWidget.setDataprovider: src/gui/auth/qgsauthsettingswidget.h#L125 +QgsAuthSettingsWidget.setPassword: src/gui/auth/qgsauthsettingswidget.h#L107 +QgsAuthSettingsWidget.setStorePasswordChecked: src/gui/auth/qgsauthsettingswidget.h#L167 +QgsAuthSettingsWidget.setStoreUsernameChecked: src/gui/auth/qgsauthsettingswidget.h#L160 +QgsAuthSettingsWidget.setUsername: src/gui/auth/qgsauthsettingswidget.h#L95 +QgsAuthSettingsWidget.setWarningText: src/gui/auth/qgsauthsettingswidget.h#L77 +QgsAuthSettingsWidget.showStoreCheckboxes: src/gui/auth/qgsauthsettingswidget.h#L153 +QgsAuthSettingsWidget.storePasswordIsChecked: src/gui/auth/qgsauthsettingswidget.h#L173 +QgsAuthSettingsWidget.storeUsernameIsChecked: src/gui/auth/qgsauthsettingswidget.h#L179 +QgsAuthSettingsWidget.username: src/gui/auth/qgsauthsettingswidget.h#L89 +QgsAuthSettingsWidget.usernameChanged: src/gui/auth/qgsauthsettingswidget.h#L204 QgsAuthSettingsWidget: src/gui/auth/qgsauthsettingswidget.h#L35 QgsAuthSslConfigDialog.QgsAuthSslConfigDialog: src/gui/auth/qgsauthsslconfigwidget.h#L198 QgsAuthSslConfigDialog.accept: src/gui/auth/qgsauthsslconfigwidget.h#L204 @@ -3565,7 +3566,7 @@ QgsLayerMetadataSearchWidget.addButtonClicked: src/gui/qgslayermetadatasearchwid QgsLayerMetadataSearchWidget.refresh: src/gui/qgslayermetadatasearchwidget.h#L52 QgsLayerMetadataSearchWidget.reset: src/gui/qgslayermetadatasearchwidget.h#L54 QgsLayerMetadataSearchWidget.setMapCanvas: src/gui/qgslayermetadatasearchwidget.h#L45 -QgsLayerMetadataSearchWidget.showEvent: src/gui/qgslayermetadatasearchwidget.h#L66 +QgsLayerMetadataSearchWidget.showEvent: src/gui/qgslayermetadatasearchwidget.h#L67 QgsLayerMetadataSearchWidget.updateExtentFilter: src/gui/qgslayermetadatasearchwidget.h#L50 QgsLayerMetadataSearchWidget: src/gui/qgslayermetadatasearchwidget.h#L36 QgsLayerPropertiesDialog.addPropertiesPageFactory: src/gui/qgslayerpropertiesdialog.h#L81 @@ -4555,42 +4556,42 @@ QgsMapToolAdvancedDigitizing.useSnappingIndicator: src/gui/maptools/qgsmaptoolad QgsMapToolAdvancedDigitizing: src/gui/maptools/qgsmaptooladvanceddigitizing.h#L38 QgsMapToolCapture.activate: src/gui/maptools/qgsmaptoolcapture.h#L108 QgsMapToolCapture.addCurve: src/gui/maptools/qgsmaptoolcapture.h#L119 -QgsMapToolCapture.addVertex: src/gui/maptools/qgsmaptoolcapture.h#L259 -QgsMapToolCapture.addVertex: src/gui/maptools/qgsmaptoolcapture.h#L266 +QgsMapToolCapture.addVertex: src/gui/maptools/qgsmaptoolcapture.h#L258 +QgsMapToolCapture.addVertex: src/gui/maptools/qgsmaptoolcapture.h#L265 QgsMapToolCapture.cadCanvasMoveEvent: src/gui/maptools/qgsmaptoolcapture.h#L140 QgsMapToolCapture.cadCanvasReleaseEvent: src/gui/maptools/qgsmaptoolcapture.h#L141 QgsMapToolCapture.capabilities: src/gui/maptools/qgsmaptoolcapture.h#L80 QgsMapToolCapture.captureCurve: src/gui/maptools/qgsmaptoolcapture.h#L132 QgsMapToolCapture.clean: src/gui/maptools/qgsmaptoolcapture.h#L155 QgsMapToolCapture.clearCurve: src/gui/maptools/qgsmaptoolcapture.h#L125 -QgsMapToolCapture.closePolygon: src/gui/maptools/qgsmaptoolcapture.h#L330 +QgsMapToolCapture.closePolygon: src/gui/maptools/qgsmaptoolcapture.h#L329 QgsMapToolCapture.currentCaptureTechnique: src/gui/maptools/qgsmaptoolcapture.h#L99 QgsMapToolCapture.deactivate: src/gui/maptools/qgsmaptoolcapture.h#L109 QgsMapToolCapture.deleteTempRubberBand: src/gui/maptools/qgsmaptoolcapture.h#L152 -QgsMapToolCapture.fetchLayerPoint: src/gui/maptools/qgsmaptoolcapture.h#L253 -QgsMapToolCapture.geometryCaptured: src/gui/maptools/qgsmaptoolcapture.h#L345 -QgsMapToolCapture.isCapturing: src/gui/maptools/qgsmaptoolcapture.h#L286 +QgsMapToolCapture.fetchLayerPoint: src/gui/maptools/qgsmaptoolcapture.h#L252 +QgsMapToolCapture.geometryCaptured: src/gui/maptools/qgsmaptoolcapture.h#L344 +QgsMapToolCapture.isCapturing: src/gui/maptools/qgsmaptoolcapture.h#L285 QgsMapToolCapture.keyPressEvent: src/gui/maptools/qgsmaptoolcapture.h#L147 -QgsMapToolCapture.lineCaptured: src/gui/maptools/qgsmaptoolcapture.h#L359 +QgsMapToolCapture.lineCaptured: src/gui/maptools/qgsmaptoolcapture.h#L358 QgsMapToolCapture.mapPoint: src/gui/maptools/qgsmaptoolcapture.h#L177 QgsMapToolCapture.mapPoint: src/gui/maptools/qgsmaptoolcapture.h#L188 QgsMapToolCapture.mode: src/gui/maptools/qgsmaptoolcapture.h#L116 QgsMapToolCapture.nextPoint: src/gui/maptools/qgsmaptoolcapture.h#L225 QgsMapToolCapture.nextPoint: src/gui/maptools/qgsmaptoolcapture.h#L239 -QgsMapToolCapture.pointCaptured: src/gui/maptools/qgsmaptoolcapture.h#L352 -QgsMapToolCapture.pointsZM: src/gui/maptools/qgsmaptoolcapture.h#L309 -QgsMapToolCapture.polygonCaptured: src/gui/maptools/qgsmaptoolcapture.h#L366 +QgsMapToolCapture.pointCaptured: src/gui/maptools/qgsmaptoolcapture.h#L351 +QgsMapToolCapture.pointsZM: src/gui/maptools/qgsmaptoolcapture.h#L308 +QgsMapToolCapture.polygonCaptured: src/gui/maptools/qgsmaptoolcapture.h#L365 QgsMapToolCapture.setCircularDigitizingEnabled: src/gui/maptools/qgsmaptoolcapture.h#L198 QgsMapToolCapture.setCurrentCaptureTechnique: src/gui/maptools/qgsmaptoolcapture.h#L93 -QgsMapToolCapture.setPoints: src/gui/maptools/qgsmaptoolcapture.h#L317 -QgsMapToolCapture.setPoints: src/gui/maptools/qgsmaptoolcapture.h#L325 +QgsMapToolCapture.setPoints: src/gui/maptools/qgsmaptoolcapture.h#L316 +QgsMapToolCapture.setPoints: src/gui/maptools/qgsmaptoolcapture.h#L324 QgsMapToolCapture.setStreamDigitizingEnabled: src/gui/maptools/qgsmaptoolcapture.h#L205 -QgsMapToolCapture.size: src/gui/maptools/qgsmaptoolcapture.h#L293 -QgsMapToolCapture.startCapturing: src/gui/maptools/qgsmaptoolcapture.h#L279 -QgsMapToolCapture.stopCapturing: src/gui/maptools/qgsmaptoolcapture.h#L337 +QgsMapToolCapture.size: src/gui/maptools/qgsmaptoolcapture.h#L292 +QgsMapToolCapture.startCapturing: src/gui/maptools/qgsmaptoolcapture.h#L278 +QgsMapToolCapture.stopCapturing: src/gui/maptools/qgsmaptoolcapture.h#L336 QgsMapToolCapture.supportsTechnique: src/gui/maptools/qgsmaptoolcapture.h#L87 QgsMapToolCapture.takeRubberBand: src/gui/maptools/qgsmaptoolcapture.h#L165 -QgsMapToolCapture.undo: src/gui/maptools/qgsmaptoolcapture.h#L274 +QgsMapToolCapture.undo: src/gui/maptools/qgsmaptoolcapture.h#L273 QgsMapToolCapture: src/gui/maptools/qgsmaptoolcapture.h#L48 QgsMapToolCaptureLayerGeometry.layerGeometryCaptured: src/gui/maptools/qgsmaptoolcapturelayergeometry.h#L46 QgsMapToolCaptureLayerGeometry.layerLineCaptured: src/gui/maptools/qgsmaptoolcapturelayergeometry.h#L58 diff --git a/python/plugins/db_manager/sqledit.py b/python/plugins/db_manager/sqledit.py index deb78274ff77..b4d92975125d 100644 --- a/python/plugins/db_manager/sqledit.py +++ b/python/plugins/db_manager/sqledit.py @@ -131,7 +131,7 @@ def initShortcuts(self): # Use Ctrl+Space for autocompletion self.shortcutAutocomplete = QShortcut( - QKeySequence(Qt.Modifier.CTRL + Qt.Key.Key_Space), self + QKeySequence(Qt.Modifier.CTRL | Qt.Key.Key_Space), self ) self.shortcutAutocomplete.setContext(Qt.ShortcutContext.WidgetShortcut) self.shortcutAutocomplete.activated.connect(self.autoComplete) diff --git a/python/plugins/processing/algs/qgis/ui/InterpolationWidgets.py b/python/plugins/processing/algs/qgis/ui/InterpolationWidgets.py index 84b1a73b9e71..5b7d37e8b7d6 100644 --- a/python/plugins/processing/algs/qgis/ui/InterpolationWidgets.py +++ b/python/plugins/processing/algs/qgis/ui/InterpolationWidgets.py @@ -105,7 +105,8 @@ def __init__(self): self.cmbLayers.layerChanged.connect(self.layerChanged) self.cmbLayers.setFilters(Qgis.LayerFilter.VectorLayer) self.cmbFields.setFilters(QgsFieldProxyModel.Filter.Numeric) - self.cmbFields.setLayer(self.cmbLayers.currentLayer()) + + self.layerChanged(self.cmbLayers.currentLayer()) def addLayer(self): layer = self.cmbLayers.currentLayer() diff --git a/python/plugins/processing/gui/AlgorithmExecutor.py b/python/plugins/processing/gui/AlgorithmExecutor.py index c1ef9432d449..8c7fadc022d3 100644 --- a/python/plugins/processing/gui/AlgorithmExecutor.py +++ b/python/plugins/processing/gui/AlgorithmExecutor.py @@ -465,6 +465,9 @@ def executeIterating(alg, parameters, paramToIter, context, feedback): if feedback.isCanceled(): return False + # clear any model result stored in the last iteration + context.clearModelResult() + parameters[paramToIter] = f for out in alg.destinationParameterDefinitions(): if out.name() not in outputs: diff --git a/python/plugins/processing/gui/Postprocessing.py b/python/plugins/processing/gui/Postprocessing.py index d36ce1f34b53..f495c2af0091 100644 --- a/python/plugins/processing/gui/Postprocessing.py +++ b/python/plugins/processing/gui/Postprocessing.py @@ -35,6 +35,7 @@ QgsLayerTreeLayer, QgsLayerTreeGroup, QgsLayerTreeNode, + QgsLayerTreeRegistryBridge, ) from qgis.utils import iface @@ -237,8 +238,6 @@ def handleAlgorithmResults( # output layer already exists in the destination project owned_map_layer = context.temporaryLayerStore().takeMapLayer(layer) if owned_map_layer: - details.project.addMapLayer(owned_map_layer, False) - # we don't add the layer to the tree yet -- that's done # later, after we've sorted all added layers layer_tree_layer = create_layer_tree_layer(owned_map_layer, details) @@ -277,10 +276,15 @@ def handleAlgorithmResults( current_selected_node = iface.layerTreeView().currentNode() iface.layerTreeView().setUpdatesEnabled(False) + # store the current intersection point to restore it later + previous_insertion_point = ( + details.project.layerTreeRegistryBridge().layerInsertionPoint() + ) for group, layer_node in sorted_layer_tree_layers: layer_node.removeCustomProperty(SORT_ORDER_CUSTOM_PROPERTY) + insertion_point: Optional[QgsLayerTreeRegistryBridge.InsertionPoint] = None if group is not None: - group.insertChildNode(0, layer_node) + insertion_point = QgsLayerTreeRegistryBridge.InsertionPoint(group, 0) else: # no destination group for this layer, so should be placed # above the current layer @@ -289,16 +293,32 @@ def handleAlgorithmResults( current_node_index = current_node_group.children().index( current_selected_node ) - current_node_group.insertChildNode(current_node_index, layer_node) + insertion_point = QgsLayerTreeRegistryBridge.InsertionPoint( + current_node_group, current_node_index + ) elif isinstance(current_selected_node, QgsLayerTreeGroup): - current_selected_node.insertChildNode(0, layer_node) + insertion_point = QgsLayerTreeRegistryBridge.InsertionPoint( + current_selected_node, 0 + ) elif context.project(): - context.project().layerTreeRoot().insertChildNode(0, layer_node) + insertion_point = QgsLayerTreeRegistryBridge.InsertionPoint() + + if insertion_point: + details.project.layerTreeRegistryBridge().setLayerInsertionPoint( + insertion_point + ) + + details.project.addMapLayer(layer_node.layer()) if not have_set_active_layer and iface is not None: iface.setActiveLayer(layer_node.layer()) have_set_active_layer = True + # reset to the previous insertion point + details.project.layerTreeRegistryBridge().setLayerInsertionPoint( + previous_insertion_point + ) + # all layers have been added to the layer tree, so safe to call # postProcessors now for layer, details in layers_to_post_process: diff --git a/python/plugins/processing/script/ScriptEdit.py b/python/plugins/processing/script/ScriptEdit.py index 09f9e44fa0c0..7952004ff0aa 100644 --- a/python/plugins/processing/script/ScriptEdit.py +++ b/python/plugins/processing/script/ScriptEdit.py @@ -49,7 +49,7 @@ def initShortcuts(self): # Use Ctrl+Space for autocompletion self.shortcutAutocomplete = QShortcut( - QKeySequence(Qt.Modifier.CTRL + Qt.Key.Key_Space), self + QKeySequence(Qt.Modifier.CTRL | Qt.Key.Key_Space), self ) self.shortcutAutocomplete.setContext(Qt.ShortcutContext.WidgetShortcut) self.shortcutAutocomplete.activated.connect(self.autoComplete) diff --git a/python/plugins/processing/script/ScriptEditorDialog.py b/python/plugins/processing/script/ScriptEditorDialog.py index 373eb2c964cc..70ea3e8e747b 100644 --- a/python/plugins/processing/script/ScriptEditorDialog.py +++ b/python/plugins/processing/script/ScriptEditorDialog.py @@ -27,6 +27,7 @@ from qgis.PyQt import uic, sip from qgis.PyQt.QtCore import Qt +from qgis.PyQt.QtGui import QPalette from qgis.PyQt.QtWidgets import QMessageBox, QFileDialog, QVBoxLayout from qgis.gui import QgsGui, QgsErrorDialog, QgsCodeEditorWidget @@ -116,7 +117,10 @@ def clean_up_store(): QgsApplication.getThemeIcon("/mActionDecreaseFont.svg") ) self.actionToggleComment.setIcon( - QgsApplication.getThemeIcon("console/iconCommentEditorConsole.svg") + QgsApplication.getThemeIcon( + "console/iconCommentEditorConsole.svg", + self.palette().color(QPalette.ColorRole.WindowText), + ) ) # Connect signals and slots diff --git a/python/plugins/processing/tests/GdalAlgorithmsRasterTest.py b/python/plugins/processing/tests/GdalAlgorithmsRasterTest.py index 390c37e845b3..240a2c028fa7 100644 --- a/python/plugins/processing/tests/GdalAlgorithmsRasterTest.py +++ b/python/plugins/processing/tests/GdalAlgorithmsRasterTest.py @@ -3498,7 +3498,7 @@ def testRasterize(self): ), [ "gdal_rasterize", - "-l polys2 -a id -ts 0.0 0.0 -te -1.000000001857055 -2.9999999963940835 10.000000000604244 5.99999999960471 -ot Float32 -of JPEG " + "-l polys2 -a id -ts 0.0 0.0 -te -1.000000001857055 -2.9999999963940835 10.000000000604246 5.999999999604708 -ot Float32 -of JPEG " + source + " " + outdir diff --git a/python/plugins/processing/tests/testdata/qgis_algorithm_tests2.yaml b/python/plugins/processing/tests/testdata/qgis_algorithm_tests2.yaml index 7a4d24eed45b..dd65231793fe 100644 --- a/python/plugins/processing/tests/testdata/qgis_algorithm_tests2.yaml +++ b/python/plugins/processing/tests/testdata/qgis_algorithm_tests2.yaml @@ -14,9 +14,7 @@ tests: results: OUTPUT: hash: - - bfb3616a73065c0cb41eb1c5c1e9e8812fe1c63019a6177adb1dfe3e - - 19bbd79d15b0ba7dbde05665d559e9806fdb1cd579df9222f9cc4d92 - - 3dfa1e041f33a72abf72d2d706c03e11fa5274f152dec1db1661b8e0 + - e277a6774c489ee965421fe102780275163229b9407d5e33d3e268e5 type: rasterhash - algorithm: qgis:tininterpolation @@ -31,9 +29,7 @@ tests: results: OUTPUT: hash: - - bfb3616a73065c0cb41eb1c5c1e9e8812fe1c63019a6177adb1dfe3e - - 19bbd79d15b0ba7dbde05665d559e9806fdb1cd579df9222f9cc4d92 - - 3dfa1e041f33a72abf72d2d706c03e11fa5274f152dec1db1661b8e0 + - e277a6774c489ee965421fe102780275163229b9407d5e33d3e268e5 type: rasterhash - algorithm: qgis:tininterpolation @@ -48,9 +44,7 @@ tests: results: OUTPUT: hash: - - b8e49813c507b73cb39a5ad904b2d302ccb25c591a2e577b6405f982 - - 19bbd79d15b0ba7dbde05665d559e9806fdb1cd579df9222f9cc4d92 - - 3dfa1e041f33a72abf72d2d706c03e11fa5274f152dec1db1661b8e0 + - e277a6774c489ee965421fe102780275163229b9407d5e33d3e268e5 type: rasterhash - algorithm: qgis:tininterpolation @@ -66,9 +60,7 @@ tests: results: OUTPUT: hash: - - bfb3616a73065c0cb41eb1c5c1e9e8812fe1c63019a6177adb1dfe3e - - 19bbd79d15b0ba7dbde05665d559e9806fdb1cd579df9222f9cc4d92 - - 3dfa1e041f33a72abf72d2d706c03e11fa5274f152dec1db1661b8e0 + - e277a6774c489ee965421fe102780275163229b9407d5e33d3e268e5 type: rasterhash - algorithm: qgis:tininterpolation @@ -84,9 +76,7 @@ tests: results: OUTPUT: hash: - - bfb3616a73065c0cb41eb1c5c1e9e8812fe1c63019a6177adb1dfe3e - - 19bbd79d15b0ba7dbde05665d559e9806fdb1cd579df9222f9cc4d92 - - 3dfa1e041f33a72abf72d2d706c03e11fa5274f152dec1db1661b8e0 + - e277a6774c489ee965421fe102780275163229b9407d5e33d3e268e5 type: rasterhash - algorithm: qgis:tininterpolation @@ -102,9 +92,7 @@ tests: results: OUTPUT: hash: - - b8e49813c507b73cb39a5ad904b2d302ccb25c591a2e577b6405f982 - - 19bbd79d15b0ba7dbde05665d559e9806fdb1cd579df9222f9cc4d92 - - 3dfa1e041f33a72abf72d2d706c03e11fa5274f152dec1db1661b8e0 + - e277a6774c489ee965421fe102780275163229b9407d5e33d3e268e5 type: rasterhash - algorithm: qgis:idwinterpolation @@ -119,8 +107,7 @@ tests: results: OUTPUT: hash: - - 55dfd0e0e5ea300d2314785ab6aa1f4d941a4506e63d0d9e2b84e959 - - b5fc06549f1b0ce3261f9fb8868bb6d082edcbfe409c89a82e2b7e7a + - 7836f01a89afbfdd865aaae9b57c602c96d629184adf1b6ea66ca127 type: rasterhash - algorithm: qgis:idwinterpolation @@ -135,8 +122,7 @@ tests: results: OUTPUT: hash: - - 55dfd0e0e5ea300d2314785ab6aa1f4d941a4506e63d0d9e2b84e959 - - b5fc06549f1b0ce3261f9fb8868bb6d082edcbfe409c89a82e2b7e7a + - 7836f01a89afbfdd865aaae9b57c602c96d629184adf1b6ea66ca127 type: rasterhash - algorithm: qgis:idwinterpolation @@ -151,8 +137,7 @@ tests: results: OUTPUT: hash: - - d53cd7327d53bd4b8fb2de8b206e5aa0a1366963f2b63f58c2b7926e - - b5fc06549f1b0ce3261f9fb8868bb6d082edcbfe409c89a82e2b7e7a + - 7836f01a89afbfdd865aaae9b57c602c96d629184adf1b6ea66ca127 type: rasterhash - algorithm: qgis:idwinterpolation @@ -168,8 +153,7 @@ tests: results: OUTPUT: hash: - - 55dfd0e0e5ea300d2314785ab6aa1f4d941a4506e63d0d9e2b84e959 - - b5fc06549f1b0ce3261f9fb8868bb6d082edcbfe409c89a82e2b7e7a + - 7836f01a89afbfdd865aaae9b57c602c96d629184adf1b6ea66ca127 type: rasterhash - algorithm: qgis:idwinterpolation @@ -185,8 +169,7 @@ tests: results: OUTPUT: hash: - - 55dfd0e0e5ea300d2314785ab6aa1f4d941a4506e63d0d9e2b84e959 - - b5fc06549f1b0ce3261f9fb8868bb6d082edcbfe409c89a82e2b7e7a + - 7836f01a89afbfdd865aaae9b57c602c96d629184adf1b6ea66ca127 type: rasterhash - algorithm: qgis:idwinterpolation @@ -202,8 +185,7 @@ tests: results: OUTPUT: hash: - - d53cd7327d53bd4b8fb2de8b206e5aa0a1366963f2b63f58c2b7926e - - b5fc06549f1b0ce3261f9fb8868bb6d082edcbfe409c89a82e2b7e7a + - 7836f01a89afbfdd865aaae9b57c602c96d629184adf1b6ea66ca127 type: rasterhash - algorithm: native:removenullgeometries diff --git a/python/pyplugin_installer/version_compare.py b/python/pyplugin_installer/version_compare.py index 2871062e2bc1..cb2ee9e13d8e 100644 --- a/python/pyplugin_installer/version_compare.py +++ b/python/pyplugin_installer/version_compare.py @@ -126,9 +126,9 @@ def compareElements(s1, s2): return 2 # if the strings aren't numeric or start from 0, compare them as a strings: # but first, set ALPHA < BETA < PREVIEW < RC < TRUNK < [NOTHING] < [ANYTHING_ELSE] - if s1 not in ["ALPHA", "BETA", "PREVIEW", "RC", "TRUNK"]: + if s1 not in ["A", "ALPHA", "B", "BETA", "PREVIEW", "RC", "TRUNK"]: s1 = "Z" + s1 - if s2 not in ["ALPHA", "BETA", "PREVIEW", "RC", "TRUNK"]: + if s2 not in ["A", "ALPHA", "B", "BETA", "PREVIEW", "RC", "TRUNK"]: s2 = "Z" + s2 # the final test: if s1 > s2: diff --git a/python/server/auto_generated/qgsserverparameters.sip.in b/python/server/auto_generated/qgsserverparameters.sip.in index 236bde6c7fc0..495bd8f08bd2 100644 --- a/python/server/auto_generated/qgsserverparameters.sip.in +++ b/python/server/auto_generated/qgsserverparameters.sip.in @@ -70,42 +70,46 @@ Converts the parameter into a list of strings :return: A list of strings %End - QList toIntList( bool &ok, char delimiter = ',' ) const; + QList toIntList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const; %Docstring Converts the parameter into a list of integers. :param ok: ``True`` if there's no error during the conversion, ``False`` otherwise :param delimiter: The character used for delimiting +:param skipEmptyParts: for splitting :return: A list of integers %End - QList toDoubleList( bool &ok, char delimiter = ',' ) const; + QList toDoubleList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const; %Docstring Converts the parameter into a list of doubles. :param ok: ``True`` if there's no error during the conversion, ``False`` otherwise :param delimiter: The character used for delimiting +:param skipEmptyParts: for splitting :return: A list of doubles %End - QList toColorList( bool &ok, char delimiter = ',' ) const; + QList toColorList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const; %Docstring Converts the parameter into a list of colors. :param ok: ``True`` if there's no error during the conversion, ``False`` otherwise :param delimiter: The character used for delimiting +:param skipEmptyParts: for splitting :return: A list of colors %End - QList toGeomList( bool &ok, char delimiter = ',' ) const; + QList toGeomList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const; %Docstring Converts the parameter into a list of geometries. :param ok: ``True`` if there's no error during the conversion, ``False`` otherwise :param delimiter: The character used for delimiting +:param skipEmptyParts: for splitting :return: A list of geometries %End diff --git a/python/server/class_map.yaml b/python/server/class_map.yaml index f05c7ccdfd29..60ea87ccb1e5 100644 --- a/python/server/class_map.yaml +++ b/python/server/class_map.yaml @@ -217,39 +217,39 @@ QgsServerOgcApiHandler.templatePath: src/server/qgsserverogcapihandler.h#L332 QgsServerOgcApiHandler.values: src/server/qgsserverogcapihandler.h#L191 QgsServerOgcApiHandler.write: src/server/qgsserverogcapihandler.h#L313 QgsServerOgcApiHandler: src/server/qgsserverogcapihandler.h#L94 -QgsServerParameter.name: src/server/qgsserverparameters.h#L236 -QgsServerParameter.name: src/server/qgsserverparameters.h#L242 -QgsServerParameter.raiseError: src/server/qgsserverparameters.h#L231 -QgsServerParameter: src/server/qgsserverparameters.h#L193 +QgsServerParameter.name: src/server/qgsserverparameters.h#L240 +QgsServerParameter.name: src/server/qgsserverparameters.h#L246 +QgsServerParameter.raiseError: src/server/qgsserverparameters.h#L235 +QgsServerParameter: src/server/qgsserverparameters.h#L197 QgsServerParameterDefinition.isValid: src/server/qgsserverparameters.h#L63 -QgsServerParameterDefinition.loadUrl: src/server/qgsserverparameters.h#L173 -QgsServerParameterDefinition.raiseError: src/server/qgsserverparameters.h#L180 -QgsServerParameterDefinition.toBool: src/server/qgsserverparameters.h#L150 -QgsServerParameterDefinition.toColor: src/server/qgsserverparameters.h#L157 -QgsServerParameterDefinition.toDouble: src/server/qgsserverparameters.h#L144 -QgsServerParameterDefinition.toExpressionList: src/server/qgsserverparameters.h#L123 -QgsServerParameterDefinition.toInt: src/server/qgsserverparameters.h#L137 -QgsServerParameterDefinition.toOgcFilterList: src/server/qgsserverparameters.h#L116 -QgsServerParameterDefinition.toRectangle: src/server/qgsserverparameters.h#L130 +QgsServerParameterDefinition.loadUrl: src/server/qgsserverparameters.h#L177 +QgsServerParameterDefinition.raiseError: src/server/qgsserverparameters.h#L184 +QgsServerParameterDefinition.toBool: src/server/qgsserverparameters.h#L154 +QgsServerParameterDefinition.toColor: src/server/qgsserverparameters.h#L161 +QgsServerParameterDefinition.toDouble: src/server/qgsserverparameters.h#L148 +QgsServerParameterDefinition.toExpressionList: src/server/qgsserverparameters.h#L127 +QgsServerParameterDefinition.toInt: src/server/qgsserverparameters.h#L141 +QgsServerParameterDefinition.toOgcFilterList: src/server/qgsserverparameters.h#L120 +QgsServerParameterDefinition.toRectangle: src/server/qgsserverparameters.h#L134 QgsServerParameterDefinition.toString: src/server/qgsserverparameters.h#L69 QgsServerParameterDefinition.toStringList: src/server/qgsserverparameters.h#L77 -QgsServerParameterDefinition.toUrl: src/server/qgsserverparameters.h#L165 +QgsServerParameterDefinition.toUrl: src/server/qgsserverparameters.h#L169 QgsServerParameterDefinition.typeName: src/server/qgsserverparameters.h#L58 QgsServerParameterDefinition: src/server/qgsserverparameters.h#L34 -QgsServerParameters.add: src/server/qgsserverparameters.h#L286 -QgsServerParameters.clear: src/server/qgsserverparameters.h#L279 -QgsServerParameters.fileName: src/server/qgsserverparameters.h#L343 -QgsServerParameters.load: src/server/qgsserverparameters.h#L274 -QgsServerParameters.loadParameter: src/server/qgsserverparameters.h#L357 -QgsServerParameters.map: src/server/qgsserverparameters.h#L336 -QgsServerParameters.remove: src/server/qgsserverparameters.h#L292 -QgsServerParameters.remove: src/server/qgsserverparameters.h#L299 -QgsServerParameters.request: src/server/qgsserverparameters.h#L329 -QgsServerParameters.service: src/server/qgsserverparameters.h#L322 -QgsServerParameters.urlQuery: src/server/qgsserverparameters.h#L310 -QgsServerParameters.value: src/server/qgsserverparameters.h#L305 -QgsServerParameters.version: src/server/qgsserverparameters.h#L350 -QgsServerParameters: src/server/qgsserverparameters.h#L253 +QgsServerParameters.add: src/server/qgsserverparameters.h#L290 +QgsServerParameters.clear: src/server/qgsserverparameters.h#L283 +QgsServerParameters.fileName: src/server/qgsserverparameters.h#L347 +QgsServerParameters.load: src/server/qgsserverparameters.h#L278 +QgsServerParameters.loadParameter: src/server/qgsserverparameters.h#L361 +QgsServerParameters.map: src/server/qgsserverparameters.h#L340 +QgsServerParameters.remove: src/server/qgsserverparameters.h#L296 +QgsServerParameters.remove: src/server/qgsserverparameters.h#L303 +QgsServerParameters.request: src/server/qgsserverparameters.h#L333 +QgsServerParameters.service: src/server/qgsserverparameters.h#L326 +QgsServerParameters.urlQuery: src/server/qgsserverparameters.h#L314 +QgsServerParameters.value: src/server/qgsserverparameters.h#L309 +QgsServerParameters.version: src/server/qgsserverparameters.h#L354 +QgsServerParameters: src/server/qgsserverparameters.h#L257 QgsServerQueryStringParameter.description: src/server/qgsserverquerystringparameter.h#L120 QgsServerQueryStringParameter.hidden: src/server/qgsserverquerystringparameter.h#L145 QgsServerQueryStringParameter.name: src/server/qgsserverquerystringparameter.h#L130 diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index fdac9c286247..af25a73af2a1 100644 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -90,7 +90,6 @@ endif() ADD_QGIS_RESOURCES("${CMAKE_CURRENT_SOURCE_DIR}" resources DEST_RESOURCE_FILES "${RESOURCES_FILES}") -message(STATUS "Using PROJ >= 6 srs database.") set(SRSDB srs6.db) add_custom_command( diff --git a/resources/function_help/json/to_string b/resources/function_help/json/to_string index 5a79aa75bf25..19b9ca6032ab 100644 --- a/resources/function_help/json/to_string +++ b/resources/function_help/json/to_string @@ -2,14 +2,14 @@ "name": "to_string", "type": "function", "groups": ["Conversions", "String"], - "description": "Converts a number to string.", + "description": "Converts a number to string. The conversion is not locale-aware, see 'format_number' for a locale-aware alternative.", "arguments": [{ "arg": "number", "description": "Integer or real value. The number to convert to string." }], "examples": [{ - "expression": "to_string(123)", - "returns": "'123'" + "expression": "to_string(1.23)", + "returns": "'1.23'" }], "tags": ["converts", "number"] } diff --git a/scripts/qstringfixup.py b/scripts/code_fixup.py similarity index 86% rename from scripts/qstringfixup.py rename to scripts/code_fixup.py index fff0d0446adc..cb9219625a9c 100644 --- a/scripts/qstringfixup.py +++ b/scripts/code_fixup.py @@ -1,6 +1,6 @@ #!/usr/bin/env python ########################################################################### -# qstringfixup.py +# code_fixup.py # --------------- # Date : October 2020 # Copyright : (C) 2020 by Even Rouault @@ -26,14 +26,15 @@ # DEALINGS IN THE SOFTWARE. ########################################################################### -# This script fixes several suboptimal uses of QStringLiteral where QLatin1String would be better +# This script fixes several suboptimal uses of QStringLiteral where QLatin1String would be better, +# and other auto code-cleaning operations (such as use of auto with std::make_unique) # It is not automatically run yet. # Run it on whole code base with: -# ../scripts/qstringfixup.sh --all +# ../scripts/code_fixup.sh --all # or on modified files only with: -# ../scripts/qstringfixup.sh +# ../scripts/code_fixup.sh import re import sys @@ -93,6 +94,16 @@ r"""(.*)(.startsWith\(|.endsWith\(|.indexOf\(|.lastIndexOf\(|\+=) QLatin1String\( ("[^"]") \)(.*)""" ) +make_unique_shared = re.compile( + r"""^(\s*)std::(?:unique|shared)_ptr<\s*(.*?)\s*>(\s*.*?\s*=\s*std::make_(?:unique|shared)<\s*(.*?)\s*>.*)$""" +) +make_unique_shared2 = re.compile( + r"""^(\s*)std::(?:unique|shared)_ptr<\s*(.*?)\s*>(?:\s*(.*?)\s*\()\s*(std::make_(?:unique|shared)<\s*(.*?)\s*>.*?)\s*\)\s*;$""" +) +make_unique3 = re.compile( + r"""^(\s*)std::unique_ptr<\s*(.*?)\s*>(?:\s*(.*?)\s*\()\s*new\s*(.*?)\s*(\(.*\s*\))\s*\)\s*;""" +) + def qlatin1char_or_string(x): """x is a double quoted string""" @@ -225,5 +236,26 @@ def qlatin1char_or_string(x): else: break + m = make_unique_shared.match(line) + if m and m.group(2) == m.group(4): + line = m.group(1) + "auto" + m.group(3) + + m = make_unique_shared2.match(line) + if m and m.group(2) == m.group(5): + line = m.group(1) + "auto " + m.group(3) + " = " + m.group(4) + ";" + + m = make_unique3.match(line) + if m and m.group(2) == m.group(4): + line = ( + m.group(1) + + "auto " + + m.group(3) + + " = std::make_unique<" + + m.group(4) + + ">" + + m.group(5) + + ";" + ) + print(line) i += 1 diff --git a/scripts/qstringfixup.sh b/scripts/code_fixup.sh similarity index 95% rename from scripts/qstringfixup.sh rename to scripts/code_fixup.sh index 032d41576012..a53f3893ba43 100755 --- a/scripts/qstringfixup.sh +++ b/scripts/code_fixup.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash ########################################################################### -# qstringfixup.sh +# code_fixup.sh # --------------- # Date : October 2020 # Copyright : (C) 2020 by Even Rouault @@ -59,8 +59,8 @@ for f in $MODIFIED; do ;; esac - m=$f.qstringfixup - python "${TOPLEVEL}/scripts/qstringfixup.py" "$f" > "$m" + m=$f.code_fixup + python "${TOPLEVEL}/scripts/code_fixup.py" "$f" > "$m" if diff -u "$m" "$f" >/dev/null; then # no difference found rm "$m" diff --git a/scripts/cppcheck.sh b/scripts/cppcheck.sh index 6ee87f5d63bb..43ffbae15698 100755 --- a/scripts/cppcheck.sh +++ b/scripts/cppcheck.sh @@ -14,10 +14,12 @@ case $SCRIPT_DIR in ;; esac +SRC_DIR=${1:-${SCRIPT_DIR}/../src} + LOG_FILE=/tmp/cppcheck_qgis.txt rm -f ${LOG_FILE} -echo "Checking ${SCRIPT_DIR}/../src ..." +echo "Checking ${SRC_DIR} ..." # qgsgcptransformer.cpp causes an effective hang on newer cppcheck! @@ -51,7 +53,7 @@ cppcheck --library=qt.cfg --inline-suppr \ -DBUILTIN_UNREACHABLE="__builtin_unreachable();" \ -i src/analysis/georeferencing/qgsgcptransformer.cpp \ -j $(nproc) \ - ${SCRIPT_DIR}/../src \ + ${SRC_DIR} \ >>${LOG_FILE} 2>&1 & PID=$! diff --git a/scripts/jenkins_run.sh b/scripts/jenkins_run.sh deleted file mode 100755 index c9237e8497d8..000000000000 --- a/scripts/jenkins_run.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -if [ -d build ] -then - rm -rf build -fi - -mkdir build -cd build || exit -cmake .. -#xvfb-run --auto-servernum --server-num=1 --server-args="-screen 0 1024x768x24" make Experimental || true -make Experimental || true -#TRES=0 -#ctest -T test --no-compress-output || true -if [ -f Testing/TAG ] ; then - xsltproc ../tests/ctest2junix.xsl Testing/$(head -n 1 < Testing/TAG)/Test.xml > CTestResults.xml -fi diff --git a/scripts/listpulls.pl b/scripts/listpulls.pl deleted file mode 100644 index 39f4b78d3c10..000000000000 --- a/scripts/listpulls.pl +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env perl - -use strict; -use warnings; - -use JSON; -use LWP::UserAgent; - -my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 }); -my $res = $ua->get( "https://api.github.com/repos/qgis/qgis/pulls" ); - -die "pull request retrieval failed: " . $res->status_line unless $res->is_success; - -my %assigned; - -printf "%5s %-16s %s\n", "#", "Assignee", "Title"; -foreach my $pull ( sort { $a->{number} <=> $b->{number} } @{ JSON::from_json( $res->decoded_content ) } ) { - my $assignee = $pull->{assignee}->{login}; - $assignee = "" unless defined $assignee; - - push @{ $assigned{$assignee} }, $pull->{number}; - - printf "%5d %-16s %s\n", $pull->{number}, $assignee || "", $pull->{title}; -} - -print "\nASSIGNMENTS:\n"; - -foreach my $assignee ( sort keys %assigned ) { - printf "%-22s %s\n", $assignee || "unassigned", join( ", ", sort { $a <=> $b } @{ $assigned{$assignee} } ); -} diff --git a/scripts/pyqt5_to_pyqt6/pyqt5_to_pyqt6.py b/scripts/pyqt5_to_pyqt6/pyqt5_to_pyqt6.py index e238b550a4b6..db222da8ac28 100755 --- a/scripts/pyqt5_to_pyqt6/pyqt5_to_pyqt6.py +++ b/scripts/pyqt5_to_pyqt6/pyqt5_to_pyqt6.py @@ -63,6 +63,7 @@ QtGui, QtNetwork, QtPrintSupport, + QtQuickWidgets, QtSql, QtSvg, QtTest, @@ -74,6 +75,7 @@ from PyQt6.QtGui import * # noqa: F403 from PyQt6.QtNetwork import * # noqa: F403 from PyQt6.QtPrintSupport import * # noqa: F403 +from PyQt6.QtQuickWidgets import * # noqa: F403 from PyQt6.QtSql import * # noqa: F403 from PyQt6.QtTest import * # noqa: F403 from PyQt6.QtWidgets import * # noqa: F403 @@ -109,6 +111,7 @@ QtXml, QtNetwork, QtPrintSupport, + QtQuickWidgets, Qsci, ] if qgis_core is not None: diff --git a/scripts/remove_non_svn_files.sh b/scripts/remove_non_svn_files.sh deleted file mode 100644 index 792cfec9351b..000000000000 --- a/scripts/remove_non_svn_files.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash -########################################################################### -# remove_non_svn_files.sh -# --------------------- -# Date : August 2008 -# Copyright : (C) 2008 by Tim Sutton -# Email : tim at kartoza dot com -########################################################################### -# # -# This program is free software; you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation; either version 2 of the License, or # -# (at your option) any later version. # -# # -########################################################################### - - -# -# A simple script to get rid of files that are not -# managed by svn. It will request confirmation before -# deleting each file. -# - -for FILE in $(svn status |grep "^?" | awk '{print $2}');do rm -i -r $FILE; done diff --git a/scripts/sipdiff b/scripts/sipdiff deleted file mode 100755 index 9994a0d903aa..000000000000 --- a/scripts/sipdiff +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env bash - -DIR=$(git rev-parse --show-toplevel) - -# ARGUMENTS -SIPIFY=NO -while getopts ":s" opt; do - case $opt in - s) - # sipify header - SIPIFY=YES - ;; - \?) - echo "Invalid option: -$OPTARG" >&2 - exit 1 - ;; - esac -done -shift $(($OPTIND - 1)) - - - -for file in $*; do - d=${file#*/} - d=${d%/*} - f=${file##*/} - f=${f%.*} - header="src/$d/$f.h" - - if ! grep -Fxq "$d/$f.sip" python/auto_sip.blocklist; then - echo -e "\033[0;31m$d/$f.sip is an automatically generated SIP file\033[0m" - echo -e " g) \x1B[4mg\x1B[0menerate the SIP file \033[0;32m./scripts/sipify.pl $header > python/$d/$f.sip\033[0m" - echo -e " s) \x1B[4ms\x1B[0mhow the diff" - SHOW=NO - while read -n 1 n; do - echo "" - case $n in - g) - echo "Generating the SIP file ..." - pushd ${DIR} - ./scripts/sipify.pl $header > python/$d/$f.sip - popd - break - ;; - s) - SHOW=YES - break - ;; - *) - invalid option - ;; - esac - done - if [[ $SHOW =~ NO ]]; then - continue - fi - fi - - if [[ $SIPIFY =~ YES ]]; then - tempfile=$(mktemp ${DIR}/${f}XXXX --suffix=.h) - ${DIR}/scripts/sipify.pl ${DIR}/$header > $tempfile - else - tempfile=$header - fi - vimdiff $tempfile python/$d/$f.sip - -done diff --git a/scripts/widgets_tree.py b/scripts/widgets_tree.py deleted file mode 100644 index 10a2b4efe024..000000000000 --- a/scripts/widgets_tree.py +++ /dev/null @@ -1,204 +0,0 @@ -#!/usr/bin/env python3 - -""" -*************************************************************************** - widgets_tree.py - --------------------- - Date : May 2011 - Copyright : (C) 2011 by Martin Dobias - Email : wonder dot sk at gmail dot com -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" - -__author__ = "Martin Dobias" -__date__ = "May 2011" -__copyright__ = "(C) 2011, Martin Dobias" - -""" -Reads .ui files from ../src/ui/ directory and write to stdout an XML describing -widgets tree. - -Python bindings must be compiled and in PYTHONPATH - -QGIS libraries must be in LD_LIBRARY_PATH - -Output should go to ../resources/customization.xml - -""" - -import glob -import os -import sys - -# qwt_plot is missing somehow but it may depend on installed packages -from qgis.PyQt import Qwt5 as qwt_plot -from qgis.PyQt.QtWidgets import ( - QCheckBox, - QComboBox, - QDateEdit, - QDateTimeEdit, - QDial, - QDialog, - QDialogButtonBox, - QGroupBox, - QLabel, - QLCDNumber, - QLineEdit, - QListView, - QProgressBar, - QPushButton, - QRadioButton, - QScrollArea, - QScrollBar, - QSlider, - QSpinBox, - QStackedWidget, - QTableView, - QTabWidget, - QTextBrowser, - QTextEdit, - QTimeEdit, - QWidget, -) -from qgis.PyQt.QtXml import QDomDocument -from qgis.PyQt.uic import loadUi - -sys.modules["qwt_plot"] = qwt_plot - -# loadUi is looking for custom widget in module which is lowercase version of -# the class, which do not exist (AFAIK) -> preload them, problems anyway: -# missing in gui: QgsColorRampComboBox, QgsRendererRulesTreeWidget, -# QgsRendererRulesTreeWidget -# and QgsProjectionSelector cannot open db file -from qgis import gui - -for m in [ - "qgscolorbutton", - "qgscolorrampcombobox", - "qgsprojectionselector", - "qgslabelpreview", - "qgsrulebasedrendererwidget", - "qgscollapsiblegroupbox", - "qgsblendmodecombobox", - "qgsexpressionbuilderwidget", - "qgsrasterformatsaveoptionswidget", - "qgsrasterpyramidsoptionswidget", - "qgsscalecombobox", - "qgsfilterlineedit", - "qgsdualview", -]: - sys.modules[m] = gui - - -class UiInspector: - - def __init__(self): - self.ui_dir = os.path.abspath( - os.path.join(os.path.dirname(__file__), "../src/ui/*.ui") - ) - self.printMsg("Loading UI files " + self.ui_dir) - # list of widget classes we want to follow - self.follow = [ - QWidget, - QDialog, - QCheckBox, - QComboBox, - QDial, - QPushButton, - QLabel, - QLCDNumber, - QLineEdit, - QRadioButton, - QScrollBar, - QSlider, - QSpinBox, - QTextEdit, - QDateEdit, - QTimeEdit, - QDateTimeEdit, - QListView, - QProgressBar, - QTableView, - QTabWidget, - QTextBrowser, - QDialogButtonBox, - QScrollArea, - QGroupBox, - QStackedWidget, - ] - - def printMsg(self, msg): - sys.stderr.write(msg + "\n") - - def widgetXml(self, element, widget, level=0, label=None): - # print tostring ( element ) - # self.printMsg ( "class: " + str( type ( widget ) ) ) - # self.printMsg ( "objectName: " + widget.objectName() ) - # self.printMsg ( "windowTitle: " + widget.windowTitle() ) - - if not widget.objectName(): - return - - lab = label - if hasattr(widget, "text"): - lab = widget.text() - if widget.windowTitle(): - label = widget.windowTitle() - if not lab: - lab = "" - - subElement = self.doc.createElement("widget") - subElement.setAttribute("class", widget.__class__.__name__) - subElement.setAttribute("objectName", widget.objectName()) - subElement.setAttribute("label", lab) - element.appendChild(subElement) - - # print str ( widget.children () ) - # tab widget label is stored in QTabWidget->QTabBarPrivate->tabList->QTab .. - if type(widget) in [QTabWidget]: - children = list( - {"widget": widget.widget(i), "label": widget.tabText(i)} - for i in range(0, widget.count()) - ) - else: - children = list({"widget": c, "label": None} for c in widget.children()) - for child in children: - w = child["widget"] - if w.isWidgetType() and (type(w) in self.follow): - self.widgetXml(subElement, w, level + 1, child["label"]) - - def xml(self): - self.doc = QDomDocument() - element = self.doc.createElement("qgiswidgets") - self.doc.appendChild(element) - for p in glob.glob(self.ui_dir): - self.printMsg("Loading " + p) - # qgsrasterlayerpropertiesbase.ui is giving: No module named qwt_plot - try: - widget = loadUi(p) - # print dir ( ui ) - self.widgetXml(element, widget) - except Exception as e: - self.printMsg(str(e)) - - return self.doc.toString(2) - - -if __name__ == "__main__": - from qgis.PyQt.QtCore import QApplication - - app = QApplication(sys.argv) # required by loadUi - inspector = UiInspector() - xml = inspector.xml() - sys.stdout.write(xml) - sys.stdout.flush() - - del app - sys.exit(0) diff --git a/src/3d/chunks/qgschunkboundsentity_p.cpp b/src/3d/chunks/qgschunkboundsentity_p.cpp index b9a2ed9b1154..a73782c2ab6a 100644 --- a/src/3d/chunks/qgschunkboundsentity_p.cpp +++ b/src/3d/chunks/qgschunkboundsentity_p.cpp @@ -20,12 +20,15 @@ #include "qgsaabb.h" #include "qgs3dwiredmesh_p.h" +#include "qgsbox3d.h" +#include "qgsgeotransform.h" ///@cond PRIVATE -QgsChunkBoundsEntity::QgsChunkBoundsEntity( Qt3DCore::QNode *parent ) +QgsChunkBoundsEntity::QgsChunkBoundsEntity( const QgsVector3D &vertexDataOrigin, Qt3DCore::QNode *parent ) : Qt3DCore::QEntity( parent ) + , mVertexDataOrigin( vertexDataOrigin ) { mAabbMesh = new Qgs3DWiredMesh; addComponent( mAabbMesh ); @@ -33,11 +36,20 @@ QgsChunkBoundsEntity::QgsChunkBoundsEntity( Qt3DCore::QNode *parent ) Qt3DExtras::QPhongMaterial *bboxesMaterial = new Qt3DExtras::QPhongMaterial; bboxesMaterial->setAmbient( Qt::red ); addComponent( bboxesMaterial ); + + QgsGeoTransform *transform = new QgsGeoTransform; + transform->setGeoTranslation( mVertexDataOrigin ); + addComponent( transform ); } -void QgsChunkBoundsEntity::setBoxes( const QList &bboxes ) +void QgsChunkBoundsEntity::setBoxes( const QList &bboxes ) { - mAabbMesh->setVertices( bboxes ); + QList aabbBoxes; + for ( const QgsBox3D &box : bboxes ) + { + aabbBoxes << QgsAABB::fromBox3D( box, mVertexDataOrigin ); + } + mAabbMesh->setVertices( aabbBoxes ); } /// @endcond diff --git a/src/3d/chunks/qgschunkboundsentity_p.h b/src/3d/chunks/qgschunkboundsentity_p.h index 5e3ff8c4ecf3..c7450a6cf15d 100644 --- a/src/3d/chunks/qgschunkboundsentity_p.h +++ b/src/3d/chunks/qgschunkboundsentity_p.h @@ -29,7 +29,9 @@ #include -class QgsAABB; +#include "qgsvector3d.h" + +class QgsBox3D; class Qgs3DWiredMesh; #define SIP_NO_FILE @@ -46,12 +48,16 @@ class QgsChunkBoundsEntity : public Qt3DCore::QEntity public: //! Constructs the entity - QgsChunkBoundsEntity( Qt3DCore::QNode *parent = nullptr ); + QgsChunkBoundsEntity( const QgsVector3D &vertexDataOrigin, Qt3DCore::QNode *parent = nullptr ); //! Sets a list of bounding boxes to be rendered by the entity - void setBoxes( const QList &bboxes ); + void setBoxes( const QList &bboxes ); + + //! Returns origin of vertex data used in this entity + QgsVector3D vertexDataOrigin() const { return mVertexDataOrigin; } private: + QgsVector3D mVertexDataOrigin; Qgs3DWiredMesh *mAabbMesh = nullptr; }; diff --git a/src/3d/chunks/qgschunkedentity.cpp b/src/3d/chunks/qgschunkedentity.cpp index 51008b28a6ae..b189b93cb630 100644 --- a/src/3d/chunks/qgschunkedentity.cpp +++ b/src/3d/chunks/qgschunkedentity.cpp @@ -201,9 +201,9 @@ void QgsChunkedEntity::handleSceneUpdate( const SceneContext &sceneContext ) if ( mBboxesEntity ) { - QList bboxes; + QList bboxes; for ( QgsChunkNode *n : std::as_const( mActiveNodes ) ) - bboxes << Qgs3DUtils::mapToWorldExtent( n->box3D(), mMapSettings->origin() ); + bboxes << n->box3D(); mBboxesEntity->setBoxes( bboxes ); } @@ -301,7 +301,7 @@ void QgsChunkedEntity::setShowBoundingBoxes( bool enabled ) if ( enabled ) { - mBboxesEntity = new QgsChunkBoundsEntity( this ); + mBboxesEntity = new QgsChunkBoundsEntity( mRootNode->box3D().center(), this ); } else { @@ -612,9 +612,10 @@ void QgsChunkedEntity::onActiveJobFinished() QgsChunkNode *node = job->chunk(); - if ( QgsChunkLoader *loader = qobject_cast( job ) ) + if ( node->state() == QgsChunkNode::Loading ) { - Q_ASSERT( node->state() == QgsChunkNode::Loading ); + QgsChunkLoader *loader = qobject_cast( job ); + Q_ASSERT( loader ); Q_ASSERT( node->loader() == loader ); QgsEventTracing::addEvent( QgsEventTracing::AsyncEnd, QStringLiteral( "3D" ), QStringLiteral( "Load " ) + node->tileId().text(), node->tileId().text() ); @@ -653,6 +654,18 @@ void QgsChunkedEntity::onActiveJobFinished() else { Q_ASSERT( node->state() == QgsChunkNode::Updating ); + + // This is a special case when we're replacing the node's entity + // with QgsChunkUpdaterFactory passed to updatedNodes(). The returned + // updater is actually a chunk loader that will give us a completely + // new QEntity, so we just delete the old one and use the new one + if ( QgsChunkLoader *nodeUpdater = qobject_cast( node->updater() ) ) + { + Qt3DCore::QEntity *newEntity = nodeUpdater->createEntity( this ); + node->replaceEntity( newEntity ); + emit newEntityCreated( newEntity ); + } + QgsEventTracing::addEvent( QgsEventTracing::AsyncEnd, QStringLiteral( "3D" ), QStringLiteral( "Update" ), node->tileId().text() ); node->setUpdated(); } diff --git a/src/3d/chunks/qgschunkloader.h b/src/3d/chunks/qgschunkloader.h index 1d19f5386eac..21b858decc6d 100644 --- a/src/3d/chunks/qgschunkloader.h +++ b/src/3d/chunks/qgschunkloader.h @@ -144,6 +144,31 @@ class _3D_EXPORT QgsQuadtreeChunkLoaderFactory : public QgsChunkLoaderFactory int mMaxLevel = 0; }; +/** + * \ingroup 3d + * Factory that uses a chunk loader factory for in-place updates + * of loaded nodes. Use it with QgsChunkedEntity::updateNodes() + * to rebuild entity of an existing node. + * + * \since QGIS 3.42 + */ +class QgsChunkUpdaterFactory : public QgsChunkQueueJobFactory +{ + public: + QgsChunkUpdaterFactory( QgsChunkLoaderFactory *loaderFactory ) + : mChunkLoaderFactory( loaderFactory ) + { + } + + QgsChunkQueueJob *createJob( QgsChunkNode *chunk ) override + { + return mChunkLoaderFactory->createChunkLoader( chunk ); + } + + private: + QgsChunkLoaderFactory *mChunkLoaderFactory; +}; + /// @endcond #endif // QGSCHUNKLOADER_H diff --git a/src/3d/chunks/qgschunknode.cpp b/src/3d/chunks/qgschunknode.cpp index a6e833980425..8639ec4ec667 100644 --- a/src/3d/chunks/qgschunknode.cpp +++ b/src/3d/chunks/qgschunknode.cpp @@ -238,6 +238,17 @@ void QgsChunkNode::setUpdated() mState = QgsChunkNode::Loaded; } +void QgsChunkNode::replaceEntity( Qt3DCore::QEntity *newEntity ) +{ + Q_ASSERT( mState == QgsChunkNode::Updating ); + Q_ASSERT( mUpdater ); + Q_ASSERT( mEntity ); + Q_ASSERT( newEntity ); + + mEntity->deleteLater(); + mEntity = newEntity; +} + void QgsChunkNode::setExactBox3D( const QgsBox3D &box3D ) { mBox3D = box3D; diff --git a/src/3d/chunks/qgschunknode.h b/src/3d/chunks/qgschunknode.h index 38ed56daaa60..c6d1d7f87186 100644 --- a/src/3d/chunks/qgschunknode.h +++ b/src/3d/chunks/qgschunknode.h @@ -239,6 +239,9 @@ class QgsChunkNode //! mark node that it finished updating - back to loaded node void setUpdated(); + //! replaces an existing entity with a newly created one (only allowed when updating the node) + void replaceEntity( Qt3DCore::QEntity *newEntity ); + //! called when the true bounding box is known so that we can use tighter bounding box void setExactBox3D( const QgsBox3D &box3D ); diff --git a/src/3d/mesh/qgsmesh3dmaterial_p.cpp b/src/3d/mesh/qgsmesh3dmaterial_p.cpp index e7880304fc32..67140bef778e 100644 --- a/src/3d/mesh/qgsmesh3dmaterial_p.cpp +++ b/src/3d/mesh/qgsmesh3dmaterial_p.cpp @@ -208,7 +208,7 @@ void QgsMesh3DMaterial::configureArrows( QgsMeshLayer *layer, const QgsDateTimeR QVector vectors( 1 ); QSize gridSize( 1, 1 ); QgsPointXY minCorner; - std::unique_ptr arrowsEnabledParameter = std::make_unique( "arrowsEnabled", nullptr ); + auto arrowsEnabledParameter = std::make_unique( "arrowsEnabled", nullptr ); if ( !layer || mMagnitudeType != MagnitudeType::ScalarDataSet || !mSymbol->arrowsEnabled() || meta.isScalar() || !datasetIndex.isValid() ) arrowsEnabledParameter->setValue( false ); else diff --git a/src/3d/qgs3dmapscene.cpp b/src/3d/qgs3dmapscene.cpp index 9f36f7bc9f0f..1845df0759c2 100644 --- a/src/3d/qgs3dmapscene.cpp +++ b/src/3d/qgs3dmapscene.cpp @@ -748,6 +748,7 @@ void Qgs3DMapScene::removeLayerEntity( QgsMapLayer *layer ) QgsPointCloudLayer *pclayer = qobject_cast( layer ); disconnect( pclayer, &QgsPointCloudLayer::renderer3DChanged, this, &Qgs3DMapScene::onLayerRenderer3DChanged ); disconnect( pclayer, &QgsPointCloudLayer::subsetStringChanged, this, &Qgs3DMapScene::onLayerRenderer3DChanged ); + disconnect( pclayer, &QgsPointCloudLayer::layerModified, this, &Qgs3DMapScene::onLayerRenderer3DChanged ); } } diff --git a/src/3d/qgs3dmapsettings.cpp b/src/3d/qgs3dmapsettings.cpp index be5af2bd27da..43193c663933 100644 --- a/src/3d/qgs3dmapsettings.cpp +++ b/src/3d/qgs3dmapsettings.cpp @@ -200,7 +200,7 @@ void Qgs3DMapSettings::readXml( const QDomElement &elem, const QgsReadWriteConte QDomElement elemPointLight = elemPointLights.firstChildElement( QStringLiteral( "point-light" ) ); while ( !elemPointLight.isNull() ) { - std::unique_ptr pointLight = std::make_unique(); + auto pointLight = std::make_unique(); pointLight->readXml( elemPointLight, context ); mLightSources << pointLight.release(); elemPointLight = elemPointLight.nextSiblingElement( QStringLiteral( "point-light" ) ); @@ -209,7 +209,7 @@ void Qgs3DMapSettings::readXml( const QDomElement &elem, const QgsReadWriteConte else { // QGIS <= 3.4 did not have light configuration - std::unique_ptr defaultLight = std::make_unique(); + auto defaultLight = std::make_unique(); defaultLight->setPosition( QgsVector3D( 0, 1000, 0 ) ); mLightSources << defaultLight.release(); } @@ -220,7 +220,7 @@ void Qgs3DMapSettings::readXml( const QDomElement &elem, const QgsReadWriteConte QDomElement elemDirectionalLight = elemDirectionalLights.firstChildElement( QStringLiteral( "directional-light" ) ); while ( !elemDirectionalLight.isNull() ) { - std::unique_ptr directionalLight = std::make_unique(); + auto directionalLight = std::make_unique(); directionalLight->readXml( elemDirectionalLight, context ); mLightSources << directionalLight.release(); elemDirectionalLight = elemDirectionalLight.nextSiblingElement( QStringLiteral( "directional-light" ) ); diff --git a/src/3d/qgs3dsceneexporter.cpp b/src/3d/qgs3dsceneexporter.cpp index 8ed99418e37f..608c5fc1dd9b 100644 --- a/src/3d/qgs3dsceneexporter.cpp +++ b/src/3d/qgs3dsceneexporter.cpp @@ -469,7 +469,7 @@ void Qgs3DSceneExporter::parseMeshTile( QgsTerrainTileEntity *tileEntity, const { QString objectNamePrefix = layerName; if ( objectNamePrefix != QString() ) - objectNamePrefix += QStringLiteral( "_" ); + objectNamePrefix += QLatin1Char( '_' ); const QList renderers = tileEntity->findChildren(); for ( Qt3DRender::QGeometryRenderer *renderer : renderers ) diff --git a/src/3d/qgs3dutils.cpp b/src/3d/qgs3dutils.cpp index 3218b327f3c8..053c94586110 100644 --- a/src/3d/qgs3dutils.cpp +++ b/src/3d/qgs3dutils.cpp @@ -813,7 +813,7 @@ std::unique_ptr Qgs3DUtils::convert2DPointCloudRen if ( symbol3D ) { - std::unique_ptr renderer3D = std::make_unique(); + auto renderer3D = std::make_unique(); renderer3D->setSymbol( symbol3D.release() ); return renderer3D; } @@ -976,10 +976,17 @@ int Qgs3DUtils::openGlMaxClipPlanes( QSurface *surface ) context.setFormat( QSurfaceFormat::defaultFormat() ); if ( context.create() ) { - context.makeCurrent( surface ); - QOpenGLFunctions *funcs = context.functions(); - funcs->glGetIntegerv( GL_MAX_CLIP_PLANES, &numPlanes ); + if ( context.makeCurrent( surface ) ) + { + QOpenGLFunctions *funcs = context.functions(); + funcs->glGetIntegerv( GL_MAX_CLIP_PLANES, &numPlanes ); + } } return numPlanes; } + +QQuaternion Qgs3DUtils::rotationFromPitchHeadingAngles( float pitchAngle, float headingAngle ) +{ + return QQuaternion::fromAxisAndAngle( QVector3D( 0, 0, 1 ), headingAngle ) * QQuaternion::fromAxisAndAngle( QVector3D( 1, 0, 0 ), pitchAngle ); +} diff --git a/src/3d/qgs3dutils.h b/src/3d/qgs3dutils.h index f95058c0a8c7..e2689ecb01ab 100644 --- a/src/3d/qgs3dutils.h +++ b/src/3d/qgs3dutils.h @@ -340,6 +340,14 @@ class _3D_EXPORT Qgs3DUtils * \since QGIS 3.42 */ static int openGlMaxClipPlanes( QSurface *surface ); + + /** + * Returns rotation quaternion that performs rotation around X axis by pitchAngle, + * followed by rotation around Z axis by headingAngle (both angles in degrees). + * + * \since QGIS 3.42 + */ + static QQuaternion rotationFromPitchHeadingAngles( float pitchAngle, float headingAngle ); }; #endif // QGS3DUTILS_H diff --git a/src/3d/qgsaabb.h b/src/3d/qgsaabb.h index f63e2f3d6eb7..d7bf72b4cd43 100644 --- a/src/3d/qgsaabb.h +++ b/src/3d/qgsaabb.h @@ -22,6 +22,8 @@ #include #include +#include "qgsbox3d.h" + #define SIP_NO_FILE /** @@ -38,6 +40,16 @@ class _3D_EXPORT QgsAABB //! Constructs bounding box QgsAABB( float xMin, float yMin, float zMin, float xMax, float yMax, float zMax ); + /** + * Constructs bounding box from QgsBox3D by subtracting origin 3D vector. + * Note: this is potentially lossy operation as the coordinates are converted + * from double values to floats! + */ + static QgsAABB fromBox3D( const QgsBox3D &box3D, const QgsVector3D &origin ) + { + return QgsAABB( static_cast( box3D.xMinimum() - origin.x() ), static_cast( box3D.yMinimum() - origin.y() ), static_cast( box3D.zMinimum() - origin.z() ), static_cast( box3D.xMaximum() - origin.x() ), static_cast( box3D.yMaximum() - origin.y() ), static_cast( box3D.zMaximum() - origin.z() ) ); + } + //! Returns box width in X axis float xExtent() const { return xMax - xMin; } //! Returns box width in Y axis diff --git a/src/3d/qgscameracontroller.cpp b/src/3d/qgscameracontroller.cpp index b06d61fc6721..b889a069a4e3 100644 --- a/src/3d/qgscameracontroller.cpp +++ b/src/3d/qgscameracontroller.cpp @@ -93,25 +93,20 @@ void QgsCameraController::setVerticalAxisInversion( Qgis::VerticalAxisInversion mVerticalAxisInversion = inversion; } -void QgsCameraController::rotateCamera( float diffPitch, float diffYaw ) +void QgsCameraController::rotateCamera( float diffPitch, float diffHeading ) { - const float pitch = mCameraPose.pitchAngle(); - const float yaw = mCameraPose.headingAngle(); + const float oldPitch = mCameraPose.pitchAngle(); + const float oldHeading = mCameraPose.headingAngle(); + float newPitch = oldPitch + diffPitch; + float newHeading = oldHeading + diffHeading; - if ( pitch + diffPitch > 180 ) - diffPitch = 180 - pitch; // prevent going over the head - if ( pitch + diffPitch < 0 ) - diffPitch = 0 - pitch; // prevent going over the head + newPitch = std::clamp( newPitch, 0.f, 180.f ); // prevent going over the head - // Is it always going to be love/hate relationship with quaternions??? - // This quaternion combines two rotations: - // - first it undoes the previously applied rotation so we have do not have any rotation compared to world coords - // - then it applies new rotation + // First undo the previously applied rotation, then apply the new rotation // (We can't just apply our euler angles difference because the camera may be already rotated) - // BONUS: we use two separate fromEulerAngles() calls because one would not do rotations in order we need - const QQuaternion q1 = QQuaternion::fromEulerAngles( 0, 0, yaw + diffYaw ) * QQuaternion::fromEulerAngles( pitch + diffPitch, 0, 0 ); - const QQuaternion q2 = QQuaternion::fromEulerAngles( 0, 0, yaw ) * QQuaternion::fromEulerAngles( pitch, 0, 0 ); - const QQuaternion q = q1 * q2.conjugated(); + const QQuaternion qNew = Qgs3DUtils::rotationFromPitchHeadingAngles( newPitch, newHeading ); + const QQuaternion qOld = Qgs3DUtils::rotationFromPitchHeadingAngles( oldPitch, oldHeading ); + const QQuaternion q = qNew * qOld.conjugated(); // get camera's view vector, rotate it to get new view center const QVector3D position = mCamera->position(); @@ -121,11 +116,47 @@ void QgsCameraController::rotateCamera( float diffPitch, float diffYaw ) viewCenter = position + cameraToCenter; mCameraPose.setCenterPoint( viewCenter ); - mCameraPose.setPitchAngle( pitch + diffPitch ); - mCameraPose.setHeadingAngle( yaw + diffYaw ); + mCameraPose.setPitchAngle( newPitch ); + mCameraPose.setHeadingAngle( newHeading ); updateCameraFromPose(); } +void QgsCameraController::rotateCameraAroundPivot( float newPitch, float newHeading, const QVector3D &pivotPoint ) +{ + const float oldPitch = mCameraPose.pitchAngle(); + const float oldHeading = mCameraPose.headingAngle(); + + newPitch = std::clamp( newPitch, 0.f, 180.f ); // prevent going over the head + + // First undo the previously applied rotation, then apply the new rotation + // (We can't just apply our euler angles difference because the camera may be already rotated) + const QQuaternion qNew = Qgs3DUtils::rotationFromPitchHeadingAngles( newPitch, newHeading ); + const QQuaternion qOld = Qgs3DUtils::rotationFromPitchHeadingAngles( oldPitch, oldHeading ); + const QQuaternion q = qNew * qOld.conjugated(); + + const QVector3D newViewCenter = q * ( mCamera->viewCenter() - pivotPoint ) + pivotPoint; + + mCameraPose.setCenterPoint( newViewCenter ); + mCameraPose.setPitchAngle( newPitch ); + mCameraPose.setHeadingAngle( newHeading ); + updateCameraFromPose(); +} + +void QgsCameraController::zoomCameraAroundPivot( const QVector3D &oldCameraPosition, double zoomFactor, const QVector3D &pivotPoint ) +{ + // step 1: move camera along the line connecting reference camera position and our pivot point + QVector3D newCamPosition = pivotPoint + ( oldCameraPosition - pivotPoint ) * zoomFactor; + double newDistance = mCameraPose.distanceFromCenterPoint() * zoomFactor; + + // step 2: using the new camera position and distance from center, calculate new view center + QQuaternion q = Qgs3DUtils::rotationFromPitchHeadingAngles( mCameraPose.pitchAngle(), mCameraPose.headingAngle() ); + QVector3D cameraToCenter = q * QVector3D( 0, 0, -newDistance ); + QVector3D newViewCenter = newCamPosition + cameraToCenter; + + mCameraPose.setDistanceFromCenterPoint( newDistance ); + mCameraPose.setCenterPoint( newViewCenter ); + updateCameraFromPose(); +} void QgsCameraController::frameTriggered( float dt ) { @@ -262,6 +293,9 @@ void QgsCameraController::moveCameraPositionBy( const QVector3D &posDiff ) void QgsCameraController::onPositionChanged( Qt3DInput::QMouseEvent *mouse ) { + if ( !mInputHandlersEnabled ) + return; + switch ( mCameraNavigationMode ) { case Qgis::NavigationMode::TerrainBased: @@ -340,36 +374,7 @@ void QgsCameraController::onPositionChangedTerrainNavigation( Qt3DInput::QMouseE } } - // First transformation : Shift camera position and view center and rotate the camera - { - QVector3D shiftVector = mRotationCenter - mCamera->viewCenter(); - - QVector3D newViewCenterWorld = camera()->viewCenter() + shiftVector; - QVector3D newCameraPosition = camera()->position() + shiftVector; - - mCameraPose.setDistanceFromCenterPoint( ( newViewCenterWorld - newCameraPosition ).length() ); - mCameraPose.setCenterPoint( newViewCenterWorld ); - mCameraPose.setPitchAngle( mRotationPitch + pitchDiff ); - mCameraPose.setHeadingAngle( mRotationYaw + yawDiff ); - updateCameraFromPose(); - } - - - // Second transformation : Shift camera position back - { - QgsRay3D ray = Qgs3DUtils::rayFromScreenPoint( mClickPoint, mScene->engine()->size(), mCamera ); - - QVector3D clickedPositionWorld = ray.origin() + mRotationDistanceFromCenter * ray.direction(); - - QVector3D shiftVector = clickedPositionWorld - mCamera->viewCenter(); - - QVector3D newViewCenterWorld = camera()->viewCenter() - shiftVector; - QVector3D newCameraPosition = camera()->position() - shiftVector; - - mCameraPose.setDistanceFromCenterPoint( ( newViewCenterWorld - newCameraPosition ).length() ); - mCameraPose.setCenterPoint( newViewCenterWorld ); - updateCameraFromPose(); - } + rotateCameraAroundPivot( mRotationPitch + pitchDiff, mRotationYaw + yawDiff, mRotationCenter ); } else if ( hasLeftButton && hasCtrl && !hasShift ) { @@ -455,7 +460,8 @@ void QgsCameraController::onPositionChangedTerrainNavigation( Qt3DInput::QMouseE } } - float dist = ( mCameraBefore->position() - mDragPoint ).length(); + float oldDist = ( mCameraBefore->position() - mDragPoint ).length(); + float newDist = oldDist; int yOffset = 0; int screenHeight = mScene->engine()->size().height(); @@ -472,41 +478,18 @@ void QgsCameraController::onPositionChangedTerrainNavigation( Qt3DInput::QMouseE double f = ( double ) ( mMousePos.y() - mClickPoint.y() ) / ( double ) ( screenHeight - mClickPoint.y() - yOffset ); f = std::max( 0.0, std::min( 1.0, f ) ); f = 1 - ( std::expm1( -2 * f ) ) / ( std::expm1( -2 ) ); - dist = dist * f; + newDist = newDist * f; } else // zoom out { double f = 1 - ( double ) ( mMousePos.y() + yOffset ) / ( double ) ( mClickPoint.y() + yOffset ); f = std::max( 0.0, std::min( 1.0, f ) ); f = ( std::expm1( 2 * f ) ) / ( std::expm1( 2 ) ); - dist = dist + 2 * dist * f; - } - - // First transformation : Shift camera position and view center and rotate the camera - { - QVector3D shiftVector = mDragPoint - mCamera->viewCenter(); - - QVector3D newViewCenterWorld = camera()->viewCenter() + shiftVector; - - mCameraPose.setDistanceFromCenterPoint( dist ); - mCameraPose.setCenterPoint( newViewCenterWorld ); - updateCameraFromPose(); + newDist = newDist + 2 * newDist * f; } - // Second transformation : Shift camera position back - { - QgsRay3D ray = Qgs3DUtils::rayFromScreenPoint( mClickPoint, mScene->engine()->size(), mCamera ); - QVector3D clickedPositionWorld = ray.origin() + dist * ray.direction(); - - QVector3D shiftVector = clickedPositionWorld - mCamera->viewCenter(); - - QVector3D newViewCenterWorld = camera()->viewCenter() - shiftVector; - QVector3D newCameraPosition = camera()->position() - shiftVector; - - mCameraPose.setDistanceFromCenterPoint( ( newViewCenterWorld - newCameraPosition ).length() ); - mCameraPose.setCenterPoint( newViewCenterWorld ); - updateCameraFromPose(); - } + double zoomFactor = newDist / oldDist; + zoomCameraAroundPivot( mCameraBefore->position(), zoomFactor, mDragPoint ); } mMousePos = QPoint( mouse->x(), mouse->y() ); @@ -539,40 +522,21 @@ void QgsCameraController::handleTerrainNavigationWheelZoom() float f = mCumulatedWheelY / ( 120.0 * 24.0 ); - double dist = ( mZoomPoint - mCameraBefore->position() ).length(); - dist -= dist * f; - - // First transformation : Shift camera position and view center and rotate the camera - { - QVector3D shiftVector = mZoomPoint - mCamera->viewCenter(); - - QVector3D newViewCenterWorld = camera()->viewCenter() + shiftVector; - - mCameraPose.setDistanceFromCenterPoint( dist ); - mCameraPose.setCenterPoint( newViewCenterWorld ); - updateCameraFromPose(); - } - - // Second transformation : Shift camera position back - { - QgsRay3D ray = Qgs3DUtils::rayFromScreenPoint( QPoint( mMousePos.x(), mMousePos.y() ), mScene->engine()->size(), mCamera ); - QVector3D clickedPositionWorld = ray.origin() + dist * ray.direction(); - - QVector3D shiftVector = clickedPositionWorld - mCamera->viewCenter(); + double oldDist = ( mZoomPoint - mCameraBefore->position() ).length(); + double newDist = ( 1 - f ) * oldDist; + double zoomFactor = newDist / oldDist; - QVector3D newViewCenterWorld = camera()->viewCenter() - shiftVector; - QVector3D newCameraPosition = camera()->position() - shiftVector; + zoomCameraAroundPivot( mCameraBefore->position(), zoomFactor, mZoomPoint ); - mCameraPose.setDistanceFromCenterPoint( ( newViewCenterWorld - newCameraPosition ).length() ); - mCameraPose.setCenterPoint( newViewCenterWorld ); - updateCameraFromPose(); - } mCumulatedWheelY = 0; setMouseParameters( MouseOperation::None ); } void QgsCameraController::onWheel( Qt3DInput::QWheelEvent *wheel ) { + if ( !mInputHandlersEnabled ) + return; + switch ( mCameraNavigationMode ) { case Qgis::NavigationMode::Walk: @@ -605,6 +569,9 @@ void QgsCameraController::onWheel( Qt3DInput::QWheelEvent *wheel ) void QgsCameraController::onMousePressed( Qt3DInput::QMouseEvent *mouse ) { + if ( !mInputHandlersEnabled ) + return; + mKeyboardHandler->setFocus( true ); if ( mouse->button() == Qt3DInput::QMouseEvent::MiddleButton || ( ( mouse->modifiers() & Qt::ShiftModifier ) != 0 && mouse->button() == Qt3DInput::QMouseEvent::LeftButton ) || ( ( mouse->modifiers() & Qt::ControlModifier ) != 0 && mouse->button() == Qt3DInput::QMouseEvent::LeftButton ) ) @@ -635,12 +602,18 @@ void QgsCameraController::onMousePressed( Qt3DInput::QMouseEvent *mouse ) void QgsCameraController::onMouseReleased( Qt3DInput::QMouseEvent *mouse ) { Q_UNUSED( mouse ) + if ( !mInputHandlersEnabled ) + return; + setMouseParameters( MouseOperation::None ); } void QgsCameraController::onKeyPressed( Qt3DInput::QKeyEvent *event ) { + if ( !mInputHandlersEnabled ) + return; + if ( event->modifiers() & Qt::ControlModifier && event->key() == Qt::Key_QuoteLeft ) { // switch navigation mode @@ -933,6 +906,9 @@ void QgsCameraController::onPositionChangedFlyNavigation( Qt3DInput::QMouseEvent void QgsCameraController::onKeyReleased( Qt3DInput::QKeyEvent *event ) { + if ( !mInputHandlersEnabled ) + return; + if ( event->isAutoRepeat() ) return; diff --git a/src/3d/qgscameracontroller.h b/src/3d/qgscameracontroller.h index 6c38373483c8..6bb158e7831f 100644 --- a/src/3d/qgscameracontroller.h +++ b/src/3d/qgscameracontroller.h @@ -189,6 +189,21 @@ class _3D_EXPORT QgsCameraController : public QObject */ void rotateCamera( float diffPitch, float diffYaw ); + /** + * Rotates the camera around the pivot point (in world coordinates) + * to the given new pitch and heading angle. + * \since QGIS 3.42 + */ + void rotateCameraAroundPivot( float newPitch, float newHeading, const QVector3D &pivotPoint ); + + /** + * Zooms camera by given zoom factor (>1 one means zoom in) + * while keeping the pivot point (given in world coordinates) at the + * same screen coordinates after the zoom. + * \since QGIS 3.42 + */ + void zoomCameraAroundPivot( const QVector3D &oldCameraPosition, double zoomFactor, const QVector3D &pivotPoint ); + /** * Returns TRUE if the camera controller will handle the specified key \a event, * preventing it from being instead handled by parents of the 3D window before @@ -204,6 +219,12 @@ class _3D_EXPORT QgsCameraController : public QObject */ void setOrigin( const QgsVector3D &origin ); + /** + * Sets whether the camera controller responds to mouse and keyboard events + * \since QGIS 3.42 + */ + void setInputHandlersEnabled( bool enable ) { mInputHandlersEnabled = enable; } + public slots: /** @@ -347,6 +368,7 @@ class _3D_EXPORT QgsCameraController : public QObject Qt3DInput::QMouseHandler *mMouseHandler = nullptr; Qt3DInput::QKeyboardHandler *mKeyboardHandler = nullptr; + bool mInputHandlersEnabled = true; Qgis::NavigationMode mCameraNavigationMode = Qgis::NavigationMode::TerrainBased; Qgis::VerticalAxisInversion mVerticalAxisInversion = Qgis::VerticalAxisInversion::WhenDragging; double mCameraMovementSpeed = 5.0; diff --git a/src/3d/qgscamerapose.cpp b/src/3d/qgscamerapose.cpp index f868db7b2135..e573bdb79b4f 100644 --- a/src/3d/qgscamerapose.cpp +++ b/src/3d/qgscamerapose.cpp @@ -15,6 +15,8 @@ #include "qgscamerapose.h" +#include "qgs3dutils.h" + #include #include @@ -60,22 +62,13 @@ void QgsCameraPose::setDistanceFromCenterPoint( float distance ) void QgsCameraPose::setPitchAngle( float pitch ) { // prevent going over the head - // prevent bug in QgsCameraPose::updateCamera when updating camera rotation. - // With a mPitchAngle < 0.2 or > 179.8, QQuaternion::fromEulerAngles( mPitchAngle, mHeadingAngle, 0 ) - // will return bad rotation angle in Qt5. - // See https://bugreports.qt.io/browse/QTBUG-72103 -#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) - mPitchAngle = std::clamp( pitch, 0.2f, 179.8f ); -#else mPitchAngle = std::clamp( pitch, 0.0f, 180.0f ); -#endif } void QgsCameraPose::updateCamera( Qt3DRender::QCamera *camera ) { // first rotate by pitch angle around X axis, then by heading angle around Z axis - // (we use two separate fromEulerAngles() calls because one would not do rotations in order we need) - QQuaternion q = QQuaternion::fromEulerAngles( 0, 0, mHeadingAngle ) * QQuaternion::fromEulerAngles( mPitchAngle, 0, 0 ); + QQuaternion q = Qgs3DUtils::rotationFromPitchHeadingAngles( mPitchAngle, mHeadingAngle ); QVector3D cameraToCenter = q * QVector3D( 0, 0, -mDistanceFromCenterPoint ); camera->setUpVector( q * QVector3D( 0, 1, 0 ) ); camera->setPosition( mCenterPoint.toVector3D() - cameraToCenter ); diff --git a/src/3d/qgspointcloudlayer3drenderer.cpp b/src/3d/qgspointcloudlayer3drenderer.cpp index 68a6a73cc291..87b1ddd32fac 100644 --- a/src/3d/qgspointcloudlayer3drenderer.cpp +++ b/src/3d/qgspointcloudlayer3drenderer.cpp @@ -145,6 +145,7 @@ QgsPointCloudLayer3DRenderer *QgsPointCloudLayer3DRenderer::clone() const } r->setMaximumScreenError( mMaximumScreenError ); r->setShowBoundingBoxes( mShowBoundingBoxes ); + r->setZoomOutBehavior( mZoomOutBehavior ); return r; } @@ -161,7 +162,7 @@ Qt3DCore::QEntity *QgsPointCloudLayer3DRenderer::createEntity( Qgs3DMapSettings Qt3DCore::QEntity *entity = nullptr; if ( pcl->index() ) { - entity = new QgsPointCloudLayerChunkedEntity( map, pcl->index(), coordinateTransform, dynamic_cast( mSymbol->clone() ), static_cast( maximumScreenError() ), showBoundingBoxes(), static_cast( pcl->elevationProperties() )->zScale(), static_cast( pcl->elevationProperties() )->zOffset(), mPointBudget ); + entity = new QgsPointCloudLayerChunkedEntity( map, pcl, pcl->index(), coordinateTransform, dynamic_cast( mSymbol->clone() ), static_cast( maximumScreenError() ), showBoundingBoxes(), static_cast( pcl->elevationProperties() )->zScale(), static_cast( pcl->elevationProperties() )->zOffset(), mPointBudget ); } else if ( !pcl->dataProvider()->subIndexes().isEmpty() ) { @@ -185,6 +186,7 @@ void QgsPointCloudLayer3DRenderer::writeXml( QDomElement &elem, const QgsReadWri elem.setAttribute( QStringLiteral( "max-screen-error" ), maximumScreenError() ); elem.setAttribute( QStringLiteral( "show-bounding-boxes" ), showBoundingBoxes() ? QStringLiteral( "1" ) : QStringLiteral( "0" ) ); elem.setAttribute( QStringLiteral( "point-budget" ), mPointBudget ); + elem.setAttribute( QStringLiteral( "zoom-out-behavior" ), qgsEnumValueToKey( mZoomOutBehavior ) ); QDomElement elemSymbol = doc.createElement( QStringLiteral( "symbol" ) ); if ( mSymbol ) @@ -205,6 +207,7 @@ void QgsPointCloudLayer3DRenderer::readXml( const QDomElement &elem, const QgsRe mShowBoundingBoxes = elem.attribute( QStringLiteral( "show-bounding-boxes" ), QStringLiteral( "0" ) ).toInt(); mMaximumScreenError = elem.attribute( QStringLiteral( "max-screen-error" ), QStringLiteral( "3.0" ) ).toDouble(); mPointBudget = elem.attribute( QStringLiteral( "point-budget" ), QStringLiteral( "5000000" ) ).toInt(); + mZoomOutBehavior = qgsEnumKeyToValue( elem.attribute( QStringLiteral( "zoom-out-behavior" ) ), Qgis::PointCloudZoomOutRenderBehavior::RenderExtents ); if ( symbolType == QLatin1String( "single-color" ) ) mSymbol.reset( new QgsSingleColorPointCloud3DSymbol ); diff --git a/src/3d/qgspointcloudlayer3drenderer.h b/src/3d/qgspointcloudlayer3drenderer.h index ec6482e8de0b..7b37d30667a3 100644 --- a/src/3d/qgspointcloudlayer3drenderer.h +++ b/src/3d/qgspointcloudlayer3drenderer.h @@ -303,12 +303,25 @@ class _3D_EXPORT QgsPointCloudLayer3DRenderer : public QgsAbstractPointCloud3DRe bool convertFrom2DRenderer( QgsPointCloudRenderer *renderer ) override; + /** + * Sets the renderer behavior when zoomed out + * \since QGIS 3.42 + */ + void setZoomOutBehavior( const Qgis::PointCloudZoomOutRenderBehavior behavior ) { mZoomOutBehavior = behavior; } + + /** + * Returns the renderer behavior when zoomed out + * \since QGIS 3.42 + */ + Qgis::PointCloudZoomOutRenderBehavior zoomOutBehavior() const { return mZoomOutBehavior; } + private: QgsMapLayerRef mLayerRef; //!< Layer used to extract mesh data from std::unique_ptr mSymbol; double mMaximumScreenError = 3.0; bool mShowBoundingBoxes = false; int mPointBudget = 5000000; + Qgis::PointCloudZoomOutRenderBehavior mZoomOutBehavior = Qgis::PointCloudZoomOutRenderBehavior::RenderExtents; private: #ifdef SIP_RUN diff --git a/src/3d/qgspointcloudlayerchunkloader_p.cpp b/src/3d/qgspointcloudlayerchunkloader_p.cpp index fc6166270dd0..51ebde4dda52 100644 --- a/src/3d/qgspointcloudlayerchunkloader_p.cpp +++ b/src/3d/qgspointcloudlayerchunkloader_p.cpp @@ -238,10 +238,60 @@ QVector QgsPointCloudLayerChunkLoaderFactory::createChildren( Qg /////////////// -QgsPointCloudLayerChunkedEntity::QgsPointCloudLayerChunkedEntity( Qgs3DMapSettings *map, QgsPointCloudIndex pc, const QgsCoordinateTransform &coordinateTransform, QgsPointCloud3DSymbol *symbol, float maximumScreenSpaceError, bool showBoundingBoxes, double zValueScale, double zValueOffset, int pointBudget ) - : QgsChunkedEntity( map, maximumScreenSpaceError, new QgsPointCloudLayerChunkLoaderFactory( Qgs3DRenderContext::fromMapSettings( map ), coordinateTransform, pc, symbol, zValueScale, zValueOffset, pointBudget ), true, pointBudget ) +static QgsChunkNode *findChunkNodeFromNodeId( QgsChunkNode *rootNode, QgsPointCloudNodeId nodeId ) +{ + // find path from the node to the root + QVector parentIds; + while ( nodeId.d() > 0 ) + { + parentIds << nodeId; + nodeId = nodeId.parentNode(); + } + + // now descend from the root to the node in the QgsChunkNode hierarchy + QgsChunkNode *chunk = rootNode; + while ( !parentIds.empty() ) + { + QgsPointCloudNodeId p = parentIds.takeLast(); + QgsChunkNodeId childNodeId( p.d(), p.x(), p.y(), p.z() ); + + QgsChunkNode *chunkChild = nullptr; + QgsChunkNode *const *children = chunk->children(); + for ( int i = 0; i < chunk->childCount(); ++i ) + { + if ( children[i]->tileId() == childNodeId ) + { + chunkChild = children[i]; + break; + } + } + Q_ASSERT( chunkChild ); + chunk = chunkChild; + } + return chunk; +} + + +QgsPointCloudLayerChunkedEntity::QgsPointCloudLayerChunkedEntity( Qgs3DMapSettings *map, QgsPointCloudLayer *pcl, QgsPointCloudIndex index, const QgsCoordinateTransform &coordinateTransform, QgsPointCloud3DSymbol *symbol, float maximumScreenSpaceError, bool showBoundingBoxes, double zValueScale, double zValueOffset, int pointBudget ) + : QgsChunkedEntity( map, maximumScreenSpaceError, new QgsPointCloudLayerChunkLoaderFactory( Qgs3DRenderContext::fromMapSettings( map ), coordinateTransform, index, symbol, zValueScale, zValueOffset, pointBudget ), true, pointBudget ) + , mLayer( pcl ) { setShowBoundingBoxes( showBoundingBoxes ); + + if ( pcl->supportsEditing() ) + { + // when editing starts or stops, we need to update our index to use the editing index (or not) + connect( pcl, &QgsPointCloudLayer::editingStarted, this, &QgsPointCloudLayerChunkedEntity::updateIndex ); + connect( pcl, &QgsPointCloudLayer::editingStopped, this, &QgsPointCloudLayerChunkedEntity::updateIndex ); + + mChunkUpdaterFactory.reset( new QgsChunkUpdaterFactory( mChunkLoaderFactory ) ); + + connect( pcl, &QgsPointCloudLayer::chunkAttributeValuesChanged, this, [this]( const QgsPointCloudNodeId &n ) { + QList nodes; + nodes << findChunkNodeFromNodeId( mRootNode, n ); + updateNodes( nodes, mChunkUpdaterFactory.get() ); + } ); + } } QgsPointCloudLayerChunkedEntity::~QgsPointCloudLayerChunkedEntity() @@ -250,6 +300,11 @@ QgsPointCloudLayerChunkedEntity::~QgsPointCloudLayerChunkedEntity() cancelActiveJobs(); } +void QgsPointCloudLayerChunkedEntity::updateIndex() +{ + static_cast( mChunkLoaderFactory )->mPointCloudIndex = mLayer->index(); +} + QVector QgsPointCloudLayerChunkedEntity::rayIntersection( const QgsRayCastingUtils::Ray3D &ray, const QgsRayCastingUtils::RayCastContext &context ) const { QVector result; diff --git a/src/3d/qgspointcloudlayerchunkloader_p.h b/src/3d/qgspointcloudlayerchunkloader_p.h index c575a2fc41c2..cca72a515936 100644 --- a/src/3d/qgspointcloudlayerchunkloader_p.h +++ b/src/3d/qgspointcloudlayerchunkloader_p.h @@ -127,11 +127,18 @@ class QgsPointCloudLayerChunkedEntity : public QgsChunkedEntity { Q_OBJECT public: - explicit QgsPointCloudLayerChunkedEntity( Qgs3DMapSettings *map, QgsPointCloudIndex pc, const QgsCoordinateTransform &coordinateTransform, QgsPointCloud3DSymbol *symbol, float maxScreenError, bool showBoundingBoxes, double zValueScale, double zValueOffset, int pointBudget ); + explicit QgsPointCloudLayerChunkedEntity( Qgs3DMapSettings *map, QgsPointCloudLayer *pcl, QgsPointCloudIndex index, const QgsCoordinateTransform &coordinateTransform, QgsPointCloud3DSymbol *symbol, float maxScreenError, bool showBoundingBoxes, double zValueScale, double zValueOffset, int pointBudget ); QVector rayIntersection( const QgsRayCastingUtils::Ray3D &ray, const QgsRayCastingUtils::RayCastContext &context ) const override; ~QgsPointCloudLayerChunkedEntity(); + + private slots: + void updateIndex(); + + private: + QgsPointCloudLayer *mLayer = nullptr; + std::unique_ptr mChunkUpdaterFactory; }; /// @endcond diff --git a/src/3d/qgsrubberband3d.cpp b/src/3d/qgsrubberband3d.cpp index 9aaa4ccf42aa..d326e7c12c15 100644 --- a/src/3d/qgsrubberband3d.cpp +++ b/src/3d/qgsrubberband3d.cpp @@ -50,7 +50,7 @@ QgsRubberBand3D::QgsRubberBand3D( Qgs3DMapSettings &map, QgsWindow3DEngine *engi , mEngine( engine ) , mGeometryType( geometryType ) { - if ( mGeometryType == Qgis::GeometryType::Line ) + if ( mGeometryType == Qgis::GeometryType::Line || mGeometryType == Qgis::GeometryType::Polygon ) { // Rubberband line mLineEntity = new Qt3DCore::QEntity( parentEntity ); @@ -110,7 +110,7 @@ void QgsRubberBand3D::setWidth( float width ) { mWidth = width; - if ( mGeometryType == Qgis::GeometryType::Line ) + if ( mGeometryType == Qgis::GeometryType::Line || mGeometryType == Qgis::GeometryType::Polygon ) { // when highlighting lines, the vertex markers should be wider mLineMaterial->setLineWidth( width ); @@ -130,7 +130,7 @@ void QgsRubberBand3D::setColor( QColor color ) { mColor = color; - if ( mGeometryType == Qgis::GeometryType::Line ) + if ( mGeometryType == Qgis::GeometryType::Line || mGeometryType == Qgis::GeometryType::Polygon ) { mLineMaterial->setLineColor( color ); mMarkerSymbol->setColor( color.lighter( 130 ) ); @@ -151,12 +151,14 @@ void QgsRubberBand3D::setMarkerType( MarkerType marker ) { mMarkerType = marker; + const bool lineOrPolygon = mGeometryType == Qgis::GeometryType::Line || mGeometryType == Qgis::GeometryType::Polygon; + const QVariantMap props { - { QStringLiteral( "color" ), mGeometryType == Qgis::GeometryType::Line ? mColor.lighter( 130 ).name() : mColor.name() }, + { QStringLiteral( "color" ), lineOrPolygon ? mColor.lighter( 130 ).name() : mColor.name() }, { QStringLiteral( "size_unit" ), QStringLiteral( "pixel" ) }, - { QStringLiteral( "size" ), QString::number( mGeometryType == Qgis::GeometryType::Line ? mWidth * 3.f : mWidth ) }, + { QStringLiteral( "size" ), QString::number( lineOrPolygon ? mWidth * 3.f : mWidth ) }, { QStringLiteral( "outline_color" ), mColor.name() }, - { QStringLiteral( "outline_width" ), QString::number( mGeometryType == Qgis::GeometryType::Line ? 0.5 : 1 ) }, + { QStringLiteral( "outline_width" ), QString::number( lineOrPolygon ? 0.5 : 1 ) }, { QStringLiteral( "name" ), mMarkerType == Square ? QStringLiteral( "square" ) : QStringLiteral( "circle" ) } }; @@ -181,6 +183,12 @@ void QgsRubberBand3D::addPoint( const QgsPoint &pt ) updateGeometry(); } +void QgsRubberBand3D::setPoints( const QgsLineString &points ) +{ + mLineString = points; + updateGeometry(); +} + void QgsRubberBand3D::removeLastPoint() { const int lastVertexIndex = mLineString.numPoints() - 1; @@ -200,9 +208,10 @@ void QgsRubberBand3D::updateGeometry() QgsLineVertexData lineData; lineData.withAdjacency = true; lineData.init( Qgis::AltitudeClamping::Absolute, Qgis::AltitudeBinding::Vertex, 0, Qgs3DRenderContext::fromMapSettings( mMapSettings ), mMapSettings->origin() ); - lineData.addLineString( mLineString ); + const bool closed = mGeometryType == Qgis::GeometryType::Polygon; + lineData.addLineString( mLineString, 0, closed ); - if ( mGeometryType == Qgis::GeometryType::Line ) + if ( mGeometryType == Qgis::GeometryType::Line || mGeometryType == Qgis::GeometryType::Polygon ) { mPositionAttribute->buffer()->setData( lineData.createVertexBuffer() ); mIndexAttribute->buffer()->setData( lineData.createIndexBuffer() ); diff --git a/src/3d/qgsrubberband3d.h b/src/3d/qgsrubberband3d.h index 609e6117ac1e..0331d4fc52ec 100644 --- a/src/3d/qgsrubberband3d.h +++ b/src/3d/qgsrubberband3d.h @@ -120,6 +120,8 @@ class _3D_EXPORT QgsRubberBand3D void addPoint( const QgsPoint &pt ); + void setPoints( const QgsLineString &points ); + void removeLastPoint(); void moveLastPoint( const QgsPoint &pt ); @@ -127,6 +129,8 @@ class _3D_EXPORT QgsRubberBand3D //! Sets whether the marker on the last vertex is displayed. We typically do not want it displayed while it is still tracked by the mouse. void setHideLastMarker( bool hide ) { mHideLastMarker = hide; } + bool isEmpty() const { return mLineString.isEmpty(); } + private: void updateGeometry(); void updateMarkerMaterial(); diff --git a/src/3d/qgsvirtualpointcloudentity_p.cpp b/src/3d/qgsvirtualpointcloudentity_p.cpp index 22f01ff1e9bb..78bf4f8ad3b6 100644 --- a/src/3d/qgsvirtualpointcloudentity_p.cpp +++ b/src/3d/qgsvirtualpointcloudentity_p.cpp @@ -44,7 +44,6 @@ QgsVirtualPointCloudEntity::QgsVirtualPointCloudEntity( , mShowBoundingBoxes( showBoundingBoxes ) { mSymbol.reset( symbol ); - mBboxesEntity = new QgsChunkBoundsEntity( this ); const QgsRectangle mapExtent = Qgs3DUtils::tryReprojectExtent2D( map->extent(), map->crs(), layer->crs(), map->transformContext() ); const QVector subIndexes = provider()->subIndexes(); for ( int i = 0; i < subIndexes.size(); ++i ) @@ -52,11 +51,34 @@ QgsVirtualPointCloudEntity::QgsVirtualPointCloudEntity( const QgsPointCloudSubIndex &si = subIndexes.at( i ); const QgsRectangle intersection = si.extent().intersect( mapExtent ); - mBboxes << Qgs3DUtils::mapToWorldExtent( intersection, si.zRange().lower(), si.zRange().upper(), map->origin() ); + mBboxes << QgsBox3D( intersection, si.zRange().lower(), si.zRange().upper() ); createChunkedEntityForSubIndex( i ); } + if ( provider()->overview() ) + { + mOverviewEntity = new QgsPointCloudLayerChunkedEntity( + mapSettings(), + mLayer, + provider()->overview(), + mCoordinateTransform, + dynamic_cast( mSymbol->clone() ), + mMaximumScreenSpaceError, + false, + mZValueScale, + mZValueOffset, + mPointBudget + ); + mOverviewEntity->setParent( this ); + connect( mOverviewEntity, &QgsChunkedEntity::pendingJobsCountChanged, this, &Qgs3DMapSceneEntity::pendingJobsCountChanged ); + emit newEntityCreated( mOverviewEntity ); + } + + // this is a rather arbitrary point, it could be somewhere else, ideally near the actual data + QgsVector3D boundsEntityOrigin( mapExtent.center().x(), mapExtent.center().y(), 0 ); + + mBboxesEntity = new QgsChunkBoundsEntity( boundsEntityOrigin, this ); updateBboxEntity(); connect( this, &QgsVirtualPointCloudEntity::subIndexNeedsLoading, provider(), &QgsVirtualPointCloudProvider::loadSubIndex, Qt::QueuedConnection ); connect( provider(), &QgsVirtualPointCloudProvider::subIndexLoaded, this, &QgsVirtualPointCloudEntity::createChunkedEntityForSubIndex ); @@ -72,22 +94,18 @@ QgsVirtualPointCloudProvider *QgsVirtualPointCloudEntity::provider() const return qobject_cast( mLayer->dataProvider() ); } -QgsAABB QgsVirtualPointCloudEntity::boundingBox( int i ) const -{ - return mBboxes.at( i ); -} - void QgsVirtualPointCloudEntity::createChunkedEntityForSubIndex( int i ) { const QVector subIndexes = provider()->subIndexes(); const QgsPointCloudSubIndex &si = subIndexes.at( i ); - // Skip if Index is not yet loaded or is outside the map extents - if ( !si.index() || mBboxes.at( i ).isEmpty() ) + // Skip if Index is not yet loaded or is outside the map extents, or it's not valid (e.g. file is missing) + if ( !si.index() || mBboxes.at( i ).isEmpty() || !si.index().isValid() ) return; QgsPointCloudLayerChunkedEntity *newChunkedEntity = new QgsPointCloudLayerChunkedEntity( mapSettings(), + mLayer, si.index(), mCoordinateTransform, static_cast( mSymbol->clone() ), @@ -106,18 +124,19 @@ void QgsVirtualPointCloudEntity::createChunkedEntityForSubIndex( int i ) void QgsVirtualPointCloudEntity::handleSceneUpdate( const SceneContext &sceneContext ) { + QgsVector3D cameraPosMapCoords = QgsVector3D( sceneContext.cameraPos ) + mapSettings()->origin(); const QVector subIndexes = provider()->subIndexes(); for ( int i = 0; i < subIndexes.size(); ++i ) { - const QgsAABB &bbox = mBboxes.at( i ); + const QgsBox3D &box3D = mBboxes.at( i ); - if ( bbox.isEmpty() ) + if ( box3D.isEmpty() ) continue; // magic number 256 is the common span value for a COPC root node constexpr int SPAN = 256; - const float epsilon = std::min( bbox.xExtent(), bbox.yExtent() ) / SPAN; - const float distance = bbox.distanceFromPoint( sceneContext.cameraPos ); + const float epsilon = static_cast( std::min( box3D.width(), box3D.height() ) ) / SPAN; + const float distance = static_cast( box3D.distanceTo( cameraPosMapCoords ) ); const float sse = Qgs3DUtils::screenSpaceError( epsilon, distance, sceneContext.screenSizePx, sceneContext.cameraFov ); constexpr float THRESHOLD = .2; @@ -132,6 +151,12 @@ void QgsVirtualPointCloudEntity::handleSceneUpdate( const SceneContext &sceneCon mChunkedEntitiesMap[i]->handleSceneUpdate( sceneContext ); } updateBboxEntity(); + + const QgsPointCloudLayer3DRenderer *rendererBehavior = dynamic_cast( mLayer->renderer3D() ); + if ( provider()->overview() && rendererBehavior && ( rendererBehavior->zoomOutBehavior() == Qgis::PointCloudZoomOutRenderBehavior::RenderOverview || rendererBehavior->zoomOutBehavior() == Qgis::PointCloudZoomOutRenderBehavior::RenderOverviewAndExtents ) ) + { + mOverviewEntity->handleSceneUpdate( sceneContext ); + } } QgsRange QgsVirtualPointCloudEntity::getNearFarPlaneRange( const QMatrix4x4 &viewMatrix ) const @@ -152,11 +177,12 @@ QgsRange QgsVirtualPointCloudEntity::getNearFarPlaneRange( const QMatrix4 // if there were no chunked entities available, we will iterate the bboxes as a fallback instead if ( fnear == 1e9 && ffar == 0 ) { - for ( const QgsAABB &bbox : mBboxes ) + for ( const QgsBox3D &box : mBboxes ) { + QgsAABB aabb = QgsAABB::fromBox3D( box, mBboxesEntity->vertexDataOrigin() ); float bboxfnear; float bboxffar; - Qgs3DUtils::computeBoundingBoxNearFarPlanes( bbox, viewMatrix, bboxfnear, bboxffar ); + Qgs3DUtils::computeBoundingBoxNearFarPlanes( aabb, viewMatrix, bboxfnear, bboxffar ); fnear = std::min( fnear, bboxfnear ); ffar = std::max( ffar, bboxffar ); } @@ -188,17 +214,22 @@ bool QgsVirtualPointCloudEntity::needsUpdate() const void QgsVirtualPointCloudEntity::updateBboxEntity() { - QList bboxes; - const QVector subIndexes = provider()->subIndexes(); - for ( int i = 0; i < subIndexes.size(); ++i ) + QList bboxes; + // we want to render bounding boxes only when zoomOutBehavior is RenderExtents or RenderOverviewAndExtents + const QgsPointCloudLayer3DRenderer *renderer = dynamic_cast( mLayer->renderer3D() ); + if ( renderer && renderer->zoomOutBehavior() != Qgis::PointCloudZoomOutRenderBehavior::RenderOverview ) { - if ( mChunkedEntitiesMap.contains( i ) && mChunkedEntitiesMap[i]->isEnabled() ) - continue; + const QVector subIndexes = provider()->subIndexes(); + for ( int i = 0; i < subIndexes.size(); ++i ) + { + if ( mChunkedEntitiesMap.contains( i ) && mChunkedEntitiesMap[i]->isEnabled() ) + continue; - if ( mBboxes.at( i ).isEmpty() ) - continue; + if ( mBboxes.at( i ).isEmpty() ) + continue; - bboxes << mBboxes.at( i ); + bboxes << mBboxes.at( i ); + } } mBboxesEntity->setBoxes( bboxes ); diff --git a/src/3d/qgsvirtualpointcloudentity_p.h b/src/3d/qgsvirtualpointcloudentity_p.h index 6416f8ba2f75..4b03cb32007b 100644 --- a/src/3d/qgsvirtualpointcloudentity_p.h +++ b/src/3d/qgsvirtualpointcloudentity_p.h @@ -32,6 +32,7 @@ #include "qgschunkedentity.h" #include "qgs3dmapsceneentity.h" #include "qgs3drendercontext.h" +#include "qgspointcloudlayerchunkloader_p.h" class QgsAABB; class QgsChunkBoundsEntity; @@ -87,13 +88,11 @@ class QgsVirtualPointCloudEntity : public Qgs3DMapSceneEntity //! Returns a pointer to the associated layer's provider QgsVirtualPointCloudProvider *provider() const; - //! Returns the bounding box for sub index i - QgsAABB boundingBox( int i ) const; - QgsPointCloudLayer *mLayer = nullptr; QMap mChunkedEntitiesMap; QgsChunkBoundsEntity *mBboxesEntity = nullptr; - QList mBboxes; + QgsPointCloudLayerChunkedEntity *mOverviewEntity = nullptr; + QList mBboxes; QgsCoordinateTransform mCoordinateTransform; std::unique_ptr mSymbol; double mZValueScale = 1.0; diff --git a/src/3d/qgswindow3dengine.cpp b/src/3d/qgswindow3dengine.cpp index ba9664e2b47c..3a56dfd4262c 100644 --- a/src/3d/qgswindow3dengine.cpp +++ b/src/3d/qgswindow3dengine.cpp @@ -99,7 +99,7 @@ void QgsWindow3DEngine::setSize( QSize s ) mMapCanvas3D->setWidth( mSize.width() ); mMapCanvas3D->setHeight( mSize.height() ); - mFrameGraph->setSize( mSize ); + mFrameGraph->setSize( mSize * mMapCanvas3D->devicePixelRatio() ); camera()->setAspectRatio( float( mSize.width() ) / float( mSize.height() ) ); emit sizeChanged(); } diff --git a/src/3d/symbols/qgsline3dsymbol.cpp b/src/3d/symbols/qgsline3dsymbol.cpp index 93107c4475e9..57dd1a92fd04 100644 --- a/src/3d/symbols/qgsline3dsymbol.cpp +++ b/src/3d/symbols/qgsline3dsymbol.cpp @@ -31,7 +31,7 @@ QgsLine3DSymbol::~QgsLine3DSymbol() = default; QgsAbstract3DSymbol *QgsLine3DSymbol::clone() const { - std::unique_ptr result = std::make_unique(); + auto result = std::make_unique(); result->mAltClamping = mAltClamping; result->mAltBinding = mAltBinding; result->mWidth = mWidth; diff --git a/src/3d/symbols/qgsline3dsymbol.h b/src/3d/symbols/qgsline3dsymbol.h index 12dc7920c8d5..ae644df21064 100644 --- a/src/3d/symbols/qgsline3dsymbol.h +++ b/src/3d/symbols/qgsline3dsymbol.h @@ -123,7 +123,7 @@ class _3D_EXPORT QgsLine3DSymbol : public QgsAbstract3DSymbol SIP_NODEFAULTCTORS private: //! how to handle altitude of vector features - Qgis::AltitudeClamping mAltClamping = Qgis::AltitudeClamping::Relative; + Qgis::AltitudeClamping mAltClamping = Qgis::AltitudeClamping::Absolute; //! how to handle clamping of vertices of individual features Qgis::AltitudeBinding mAltBinding = Qgis::AltitudeBinding::Centroid; diff --git a/src/3d/symbols/qgslinevertexdata_p.cpp b/src/3d/symbols/qgslinevertexdata_p.cpp index 5636fff7ec9c..d453815417c5 100644 --- a/src/3d/symbols/qgslinevertexdata_p.cpp +++ b/src/3d/symbols/qgslinevertexdata_p.cpp @@ -117,7 +117,7 @@ Qt3DQGeometry *QgsLineVertexData::createGeometry( Qt3DCore::QNode *parent ) return geom; } -void QgsLineVertexData::addLineString( const QgsLineString &lineString, float extraHeightOffset ) +void QgsLineVertexData::addLineString( const QgsLineString &lineString, float extraHeightOffset, bool closePolygon ) { if ( withAdjacency ) indexes << vertices.count(); // add the following vertex (for adjacency) @@ -132,6 +132,8 @@ void QgsLineVertexData::addLineString( const QgsLineString &lineString, float ex break; } + const int firstIndex = vertices.count(); + for ( int i = 0; i < lineString.vertexCount(); ++i ) { QgsPoint p = lineString.pointN( i ); @@ -141,6 +143,9 @@ void QgsLineVertexData::addLineString( const QgsLineString &lineString, float ex indexes << vertices.count() - 1; } + if ( closePolygon ) + indexes << firstIndex; // repeat the first vertex + if ( withAdjacency ) indexes << vertices.count() - 1; // add the last vertex (for adjacency) diff --git a/src/3d/symbols/qgslinevertexdata_p.h b/src/3d/symbols/qgslinevertexdata_p.h index 186f51c0db18..76f4305e8d5e 100644 --- a/src/3d/symbols/qgslinevertexdata_p.h +++ b/src/3d/symbols/qgslinevertexdata_p.h @@ -77,7 +77,7 @@ struct QgsLineVertexData bool withAdjacency = false; //!< Whether line strip with adjacency primitive will be used // extra info to calculate elevation - Qgis::AltitudeClamping altClamping = Qgis::AltitudeClamping::Relative; + Qgis::AltitudeClamping altClamping = Qgis::AltitudeClamping::Absolute; Qgis::AltitudeBinding altBinding = Qgis::AltitudeBinding::Vertex; float baseHeight = 0; Qgs3DRenderContext renderContext; // used for altitude clamping @@ -95,7 +95,7 @@ struct QgsLineVertexData Qt3DCore::QGeometry *createGeometry( Qt3DCore::QNode *parent ); #endif - void addLineString( const QgsLineString &lineString, float extraHeightOffset = 0 ); + void addLineString( const QgsLineString &lineString, float extraHeightOffset = 0, bool closePolygon = false ); void addVerticalLines( const QgsLineString &lineString, float verticalLength, float extraHeightOffset = 0 ); }; diff --git a/src/3d/symbols/qgsmesh3dsymbol.cpp b/src/3d/symbols/qgsmesh3dsymbol.cpp index eaaee4cc8523..f9e57ddece17 100644 --- a/src/3d/symbols/qgsmesh3dsymbol.cpp +++ b/src/3d/symbols/qgsmesh3dsymbol.cpp @@ -28,7 +28,7 @@ QgsMesh3DSymbol::~QgsMesh3DSymbol() = default; QgsMesh3DSymbol *QgsMesh3DSymbol::clone() const { - std::unique_ptr result = std::make_unique(); + auto result = std::make_unique(); result->mAltClamping = mAltClamping; result->mHeight = mHeight; diff --git a/src/3d/symbols/qgsmesh3dsymbol.h b/src/3d/symbols/qgsmesh3dsymbol.h index 486b038f6aba..7f89164a67ef 100644 --- a/src/3d/symbols/qgsmesh3dsymbol.h +++ b/src/3d/symbols/qgsmesh3dsymbol.h @@ -354,7 +354,7 @@ class _3D_EXPORT QgsMesh3DSymbol : public QgsAbstract3DSymbol #endif //! how to handle altitude of vector features - Qgis::AltitudeClamping mAltClamping = Qgis::AltitudeClamping::Relative; + Qgis::AltitudeClamping mAltClamping = Qgis::AltitudeClamping::Absolute; float mHeight = 0.0f; //!< Base height of triangles std::unique_ptr mMaterialSettings; //!< Defines appearance of objects bool mAddBackFaces = false; diff --git a/src/3d/symbols/qgspoint3dsymbol.cpp b/src/3d/symbols/qgspoint3dsymbol.cpp index 35844aa470fc..355dc5c4c53c 100644 --- a/src/3d/symbols/qgspoint3dsymbol.cpp +++ b/src/3d/symbols/qgspoint3dsymbol.cpp @@ -136,7 +136,7 @@ void QgsPoint3DSymbol::setDefaultPropertiesFromLayer( const QgsVectorLayer *laye Qgis::Point3DShape QgsPoint3DSymbol::shapeFromString( const QString &shape ) { - if ( shape == QStringLiteral( "sphere" ) ) + if ( shape == QLatin1String( "sphere" ) ) return Qgis::Point3DShape::Sphere; else if ( shape == QLatin1String( "cone" ) ) return Qgis::Point3DShape::Cone; diff --git a/src/3d/symbols/qgspoint3dsymbol.h b/src/3d/symbols/qgspoint3dsymbol.h index 45bef877e3fc..6d14fff38673 100644 --- a/src/3d/symbols/qgspoint3dsymbol.h +++ b/src/3d/symbols/qgspoint3dsymbol.h @@ -175,7 +175,7 @@ class _3D_EXPORT QgsPoint3DSymbol : public QgsAbstract3DSymbol SIP_NODEFAULTCTOR private: //! how to handle altitude of vector features - Qgis::AltitudeClamping mAltClamping = Qgis::AltitudeClamping::Relative; + Qgis::AltitudeClamping mAltClamping = Qgis::AltitudeClamping::Absolute; std::unique_ptr mMaterialSettings; //!< Defines appearance of objects Qgis::Point3DShape mShape = Qgis::Point3DShape::Cylinder; //!< What kind of shape to use diff --git a/src/3d/symbols/qgspolygon3dsymbol.cpp b/src/3d/symbols/qgspolygon3dsymbol.cpp index 3629b7f2796f..7b25d53af076 100644 --- a/src/3d/symbols/qgspolygon3dsymbol.cpp +++ b/src/3d/symbols/qgspolygon3dsymbol.cpp @@ -35,7 +35,7 @@ QgsPolygon3DSymbol::~QgsPolygon3DSymbol() = default; QgsAbstract3DSymbol *QgsPolygon3DSymbol::clone() const { - std::unique_ptr result = std::make_unique(); + auto result = std::make_unique(); result->mAltClamping = mAltClamping; result->mAltBinding = mAltBinding; result->mOffset = mOffset; diff --git a/src/3d/symbols/qgspolygon3dsymbol.h b/src/3d/symbols/qgspolygon3dsymbol.h index 712a12d554f3..047d912f878c 100644 --- a/src/3d/symbols/qgspolygon3dsymbol.h +++ b/src/3d/symbols/qgspolygon3dsymbol.h @@ -186,7 +186,7 @@ class _3D_EXPORT QgsPolygon3DSymbol : public QgsAbstract3DSymbol SIP_NODEFAULTCT private: //! how to handle altitude of vector features - Qgis::AltitudeClamping mAltClamping = Qgis::AltitudeClamping::Relative; + Qgis::AltitudeClamping mAltClamping = Qgis::AltitudeClamping::Absolute; //! how to handle clamping of vertices of individual features Qgis::AltitudeBinding mAltBinding = Qgis::AltitudeBinding::Centroid; diff --git a/src/3d/terrain/qgs3dterrainregistry.cpp b/src/3d/terrain/qgs3dterrainregistry.cpp index cf5e5e9bcb37..e75e4bb29bd4 100644 --- a/src/3d/terrain/qgs3dterrainregistry.cpp +++ b/src/3d/terrain/qgs3dterrainregistry.cpp @@ -76,7 +76,7 @@ QgsAbstractTerrainSettings *Qgs3DTerrainRegistry::configureTerrainFromProject( Q { if ( properties->terrainProvider()->type() == QLatin1String( "flat" ) ) { - std::unique_ptr flatTerrain = std::make_unique(); + auto flatTerrain = std::make_unique(); flatTerrain->setElevationOffset( properties->terrainProvider()->offset() ); return flatTerrain.release(); } @@ -84,7 +84,7 @@ QgsAbstractTerrainSettings *Qgs3DTerrainRegistry::configureTerrainFromProject( Q { QgsRasterDemTerrainProvider *rasterProvider = qgis::down_cast( properties->terrainProvider() ); - std::unique_ptr demTerrain = std::make_unique(); + auto demTerrain = std::make_unique(); demTerrain->setLayer( rasterProvider->layer() ); demTerrain->setElevationOffset( properties->terrainProvider()->offset() ); demTerrain->setVerticalScale( properties->terrainProvider()->scale() ); @@ -94,7 +94,7 @@ QgsAbstractTerrainSettings *Qgs3DTerrainRegistry::configureTerrainFromProject( Q { QgsMeshTerrainProvider *meshProvider = qgis::down_cast( properties->terrainProvider() ); - std::unique_ptr meshTerrain = std::make_unique(); + auto meshTerrain = std::make_unique(); meshTerrain->setLayer( meshProvider->layer() ); meshTerrain->setElevationOffset( properties->terrainProvider()->offset() ); meshTerrain->setVerticalScale( properties->terrainProvider()->scale() ); @@ -102,7 +102,7 @@ QgsAbstractTerrainSettings *Qgs3DTerrainRegistry::configureTerrainFromProject( Q } else { - std::unique_ptr flatTerrain = std::make_unique(); + auto flatTerrain = std::make_unique(); return flatTerrain.release(); } } diff --git a/src/3d/terrain/qgsdemterrainsettings.cpp b/src/3d/terrain/qgsdemterrainsettings.cpp index 980b37f1897a..1ba2072c3c3a 100644 --- a/src/3d/terrain/qgsdemterrainsettings.cpp +++ b/src/3d/terrain/qgsdemterrainsettings.cpp @@ -82,7 +82,7 @@ bool QgsDemTerrainSettings::equals( const QgsAbstractTerrainSettings *other ) co std::unique_ptr QgsDemTerrainSettings::createTerrainGenerator( const Qgs3DRenderContext &context ) const { - std::unique_ptr generator = std::make_unique(); + auto generator = std::make_unique(); generator->setCrs( context.crs(), context.transformContext() ); generator->setExtent( context.extent() ); generator->setLayer( layer() ); diff --git a/src/3d/terrain/qgsflatterrainsettings.cpp b/src/3d/terrain/qgsflatterrainsettings.cpp index c509b2862da6..130181c7c7d0 100644 --- a/src/3d/terrain/qgsflatterrainsettings.cpp +++ b/src/3d/terrain/qgsflatterrainsettings.cpp @@ -54,7 +54,7 @@ bool QgsFlatTerrainSettings::equals( const QgsAbstractTerrainSettings *other ) c std::unique_ptr QgsFlatTerrainSettings::createTerrainGenerator( const Qgs3DRenderContext &context ) const { - std::unique_ptr generator = std::make_unique(); + auto generator = std::make_unique(); generator->setCrs( context.crs(), context.transformContext() ); generator->setExtent( context.extent() ); return generator; diff --git a/src/3d/terrain/qgsmeshterrainsettings.cpp b/src/3d/terrain/qgsmeshterrainsettings.cpp index cdd048b2c2d4..b6ed0171bf4b 100644 --- a/src/3d/terrain/qgsmeshterrainsettings.cpp +++ b/src/3d/terrain/qgsmeshterrainsettings.cpp @@ -32,7 +32,7 @@ QgsMeshTerrainSettings::~QgsMeshTerrainSettings() = default; QgsMeshTerrainSettings *QgsMeshTerrainSettings::clone() const { - std::unique_ptr cloned = std::make_unique(); + auto cloned = std::make_unique(); cloned->mSymbol.reset( mSymbol->clone() ); cloned->mLayer = mLayer; cloned->copyCommonProperties( this ); @@ -97,7 +97,7 @@ bool QgsMeshTerrainSettings::equals( const QgsAbstractTerrainSettings *other ) c std::unique_ptr QgsMeshTerrainSettings::createTerrainGenerator( const Qgs3DRenderContext &context ) const { - std::unique_ptr generator = std::make_unique(); + auto generator = std::make_unique(); generator->setLayer( layer() ); std::unique_ptr symbol( mSymbol->clone() ); symbol->setVerticalScale( verticalScale() ); diff --git a/src/3d/terrain/qgsonlinedemterrainsettings.cpp b/src/3d/terrain/qgsonlinedemterrainsettings.cpp index 0b879707197c..3abaf85e02f0 100644 --- a/src/3d/terrain/qgsonlinedemterrainsettings.cpp +++ b/src/3d/terrain/qgsonlinedemterrainsettings.cpp @@ -76,7 +76,7 @@ bool QgsOnlineDemTerrainSettings::equals( const QgsAbstractTerrainSettings *othe std::unique_ptr QgsOnlineDemTerrainSettings::createTerrainGenerator( const Qgs3DRenderContext &context ) const { - std::unique_ptr generator = std::make_unique(); + auto generator = std::make_unique(); generator->setResolution( mResolution ); generator->setSkirtHeight( static_cast( mSkirtHeight ) ); generator->setCrs( context.crs(), context.transformContext() ); diff --git a/src/3d/terrain/qgsquantizedmeshterrainsettings.cpp b/src/3d/terrain/qgsquantizedmeshterrainsettings.cpp index 3cf46c6bb087..a4b157701a86 100644 --- a/src/3d/terrain/qgsquantizedmeshterrainsettings.cpp +++ b/src/3d/terrain/qgsquantizedmeshterrainsettings.cpp @@ -74,7 +74,7 @@ bool QgsQuantizedMeshTerrainSettings::equals( const QgsAbstractTerrainSettings * std::unique_ptr QgsQuantizedMeshTerrainSettings::createTerrainGenerator( const Qgs3DRenderContext &context ) const { - std::unique_ptr generator = std::make_unique(); + auto generator = std::make_unique(); generator->setLayer( layer() ); generator->setCrs( context.crs(), context.transformContext() ); generator->setExtent( context.extent() ); diff --git a/src/analysis/georeferencing/qgsgcptransformer.cpp b/src/analysis/georeferencing/qgsgcptransformer.cpp index 132d7afae1b3..ad6bd7b8f5b0 100644 --- a/src/analysis/georeferencing/qgsgcptransformer.cpp +++ b/src/analysis/georeferencing/qgsgcptransformer.cpp @@ -118,7 +118,7 @@ bool QgsLinearGeorefTransform::getOriginScale( QgsPointXY &origin, double &scale QgsGcpTransformerInterface *QgsLinearGeorefTransform::clone() const { - std::unique_ptr res = std::make_unique(); + auto res = std::make_unique(); res->mParameters = mParameters; return res.release(); } @@ -234,7 +234,7 @@ bool QgsHelmertGeorefTransform::getOriginScaleRotation( QgsPointXY &origin, doub QgsGcpTransformerInterface *QgsHelmertGeorefTransform::clone() const { - std::unique_ptr res = std::make_unique(); + auto res = std::make_unique(); res->mHelmertParameters = mHelmertParameters; return res.release(); } @@ -329,7 +329,7 @@ QgsGDALGeorefTransform::~QgsGDALGeorefTransform() QgsGcpTransformerInterface *QgsGDALGeorefTransform::clone() const { - std::unique_ptr res = std::make_unique( mIsTPSTransform, mPolynomialOrder ); + auto res = std::make_unique( mIsTPSTransform, mPolynomialOrder ); res->updateParametersFromGcps( mSourceCoords, mDestCoordinates, mInvertYAxis ); return res.release(); } @@ -436,7 +436,7 @@ QgsProjectiveGeorefTransform::QgsProjectiveGeorefTransform() QgsGcpTransformerInterface *QgsProjectiveGeorefTransform::clone() const { - std::unique_ptr res = std::make_unique(); + auto res = std::make_unique(); res->mParameters = mParameters; return res.release(); } diff --git a/src/analysis/interpolation/qgsgridfilewriter.cpp b/src/analysis/interpolation/qgsgridfilewriter.cpp index 838505c80c86..2b17a766c5fd 100644 --- a/src/analysis/interpolation/qgsgridfilewriter.cpp +++ b/src/analysis/interpolation/qgsgridfilewriter.cpp @@ -19,7 +19,9 @@ #include "qgsinterpolator.h" #include "qgsvectorlayer.h" #include "qgsfeedback.h" -#include +#include "qgsrasterfilewriter.h" +#include "qgsrasterdataprovider.h" +#include "qgsrasterblock.h" #include QgsGridFileWriter::QgsGridFileWriter( QgsInterpolator *i, const QString &outputPath, const QgsRectangle &extent, int nCols, int nRows ) @@ -34,95 +36,66 @@ QgsGridFileWriter::QgsGridFileWriter( QgsInterpolator *i, const QString &outputP int QgsGridFileWriter::writeFile( QgsFeedback *feedback ) { - QFile outputFile( mOutputFilePath ); + const QFileInfo fi( mOutputFilePath ); + const QString outputFormat = QgsRasterFileWriter::driverForExtension( fi.suffix() ); + + QgsInterpolator::LayerData ld = mInterpolator->layerData().at( 0 ); + const QgsCoordinateReferenceSystem crs = ld.source->sourceCrs(); - if ( !outputFile.open( QFile::WriteOnly | QIODevice::Truncate ) ) + auto writer = std::make_unique( mOutputFilePath ); + writer->setOutputProviderKey( QStringLiteral( "gdal" ) ); + writer->setOutputFormat( outputFormat ); + + std::unique_ptr provider( writer->createOneBandRaster( Qgis::DataType::Float32, mNumColumns, mNumRows, mInterpolationExtent, crs ) ); + if ( !provider ) { + QgsDebugMsgLevel( QStringLiteral( "Could not create raster output: %1" ).arg( mOutputFilePath ), 2 ); return 1; } - - if ( !mInterpolator ) + if ( !provider->isValid() ) { - outputFile.remove(); + QgsDebugMsgLevel( QStringLiteral( "Could not create raster output: %1: %2" ).arg( mOutputFilePath, provider->error().message( QgsErrorMessage::Text ) ), 2 ); return 2; } - QTextStream outStream( &outputFile ); -#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) - outStream.setCodec( "UTF-8" ); -#endif - outStream.setRealNumberPrecision( 8 ); - writeHeader( outStream ); + provider->setNoDataValue( 1, -9999 ); double currentYValue = mInterpolationExtent.yMaximum() - mCellSizeY / 2.0; //calculate value in the center of the cell double currentXValue; double interpolatedValue; - for ( int i = 0; i < mNumRows; ++i ) + std::vector float32Row( mNumColumns ); + const double step = mNumRows > 0 ? 100.0 / mNumRows : 1; + for ( int row = 0; row < mNumRows; row++ ) { + if ( feedback && feedback->isCanceled() ) + { + break; + } + currentXValue = mInterpolationExtent.xMinimum() + mCellSizeX / 2.0; //calculate value in the center of the cell - for ( int j = 0; j < mNumColumns; ++j ) + QgsRasterBlock block( Qgis::DataType::Float32, mNumColumns, 1 ); + + for ( int col = 0; col < mNumColumns; col++ ) { if ( mInterpolator->interpolatePoint( currentXValue, currentYValue, interpolatedValue, feedback ) == 0 ) { - outStream << interpolatedValue << ' '; + float32Row[col] = interpolatedValue; } else { - outStream << "-9999 "; + float32Row[col] = -9999; } currentXValue += mCellSizeX; } - - outStream << Qt::endl; + block.setData( QByteArray( reinterpret_cast( float32Row.data() ), QgsRasterBlock::typeSize( Qgis::DataType::Float32 ) * mNumColumns ) ); + provider->writeBlock( &block, 1, 0, row ); currentYValue -= mCellSizeY; - if ( feedback ) { - if ( feedback->isCanceled() ) - { - outputFile.remove(); - return 3; - } - feedback->setProgress( 100.0 * i / static_cast( mNumRows ) ); + feedback->setProgress( row * step ); } } - // create prj file - QgsInterpolator::LayerData ld; - ld = mInterpolator->layerData().at( 0 ); - QgsFeatureSource *source = ld.source; - const QString crs = source->sourceCrs().toWkt(); - const QFileInfo fi( mOutputFilePath ); - const QString fileName = fi.absolutePath() + '/' + fi.completeBaseName() + ".prj"; - QFile prjFile( fileName ); - if ( !prjFile.open( QFile::WriteOnly | QIODevice::Truncate ) ) - { - return 1; - } - QTextStream prjStream( &prjFile ); - prjStream << crs; - prjStream << Qt::endl; - prjFile.close(); - - return 0; -} - -int QgsGridFileWriter::writeHeader( QTextStream &outStream ) -{ - outStream << "NCOLS " << mNumColumns << Qt::endl; - outStream << "NROWS " << mNumRows << Qt::endl; - outStream << "XLLCORNER " << mInterpolationExtent.xMinimum() << Qt::endl; - outStream << "YLLCORNER " << mInterpolationExtent.yMinimum() << Qt::endl; - if ( mCellSizeX == mCellSizeY ) //standard way - { - outStream << "CELLSIZE " << mCellSizeX << Qt::endl; - } - else //this is supported by GDAL but probably not by other products - { - outStream << "DX " << mCellSizeX << Qt::endl; - outStream << "DY " << mCellSizeY << Qt::endl; - } - outStream << "NODATA_VALUE -9999" << Qt::endl; return 0; } diff --git a/src/analysis/interpolation/qgsgridfilewriter.h b/src/analysis/interpolation/qgsgridfilewriter.h index 8f408c0a7c23..58c41e8e552c 100644 --- a/src/analysis/interpolation/qgsgridfilewriter.h +++ b/src/analysis/interpolation/qgsgridfilewriter.h @@ -56,8 +56,6 @@ class ANALYSIS_EXPORT QgsGridFileWriter private: QgsGridFileWriter() = delete; - int writeHeader( QTextStream &outStream ); - QgsInterpolator *mInterpolator = nullptr; QString mOutputFilePath; QgsRectangle mInterpolationExtent; diff --git a/src/analysis/mesh/qgsmeshcontours.cpp b/src/analysis/mesh/qgsmeshcontours.cpp index 8ecc7febad2e..e07d9d939472 100644 --- a/src/analysis/mesh/qgsmeshcontours.cpp +++ b/src/analysis/mesh/qgsmeshcontours.cpp @@ -137,8 +137,8 @@ QgsGeometry QgsMeshContours::exportPolygons( double min_value, double max_value, { QVector ring = coords; ring.push_back( coords[0] ); - std::unique_ptr ext = std::make_unique( coords ); - std::unique_ptr poly = std::make_unique(); + auto ext = std::make_unique( coords ); + auto poly = std::make_unique(); poly->setExteriorRing( ext.release() ); multiPolygon.push_back( QgsGeometry( std::move( poly ) ) ); continue; @@ -236,8 +236,8 @@ QgsGeometry QgsMeshContours::exportPolygons( double min_value, double max_value, // add if the polygon is not degraded if ( ring.size() > 2 ) { - std::unique_ptr ext = std::make_unique( ring ); - std::unique_ptr poly = std::make_unique(); + auto ext = std::make_unique( ring ); + auto poly = std::make_unique(); poly->setExteriorRing( ext.release() ); multiPolygon.push_back( QgsGeometry( std::move( poly ) ) ); } @@ -268,7 +268,7 @@ QgsGeometry QgsMeshContours::exportLines( const QgsMeshDatasetIndex &index, doub QgsGeometry QgsMeshContours::exportLines( double value, QgsFeedback *feedback ) { - std::unique_ptr multiLineString( new QgsMultiLineString() ); + auto multiLineString = std::make_unique(); QSet> exactEdges; // STEP 1: Get Data @@ -337,7 +337,7 @@ QgsGeometry QgsMeshContours::exportLines( double value, QgsFeedback *feedback ) else { exactEdges.insert( { indices[i], indices[j] } ); - std::unique_ptr line( new QgsLineString( coords[i], coords[j] ) ); + auto line = std::make_unique( coords[i], coords[j] ); multiLineString->addGeometry( line.release() ); break; } @@ -361,7 +361,7 @@ QgsGeometry QgsMeshContours::exportLines( double value, QgsFeedback *feedback ) else { // we have found the end point of the contour line, we are done - std::unique_ptr line( new QgsLineString( tmp, xy ) ); + auto line = std::make_unique( tmp, xy ); multiLineString->addGeometry( line.release() ); break; } diff --git a/src/analysis/processing/pdal/qgsalgorithmpdaldensity.cpp b/src/analysis/processing/pdal/qgsalgorithmpdaldensity.cpp index 498a989104ab..da767cdf1b20 100644 --- a/src/analysis/processing/pdal/qgsalgorithmpdaldensity.cpp +++ b/src/analysis/processing/pdal/qgsalgorithmpdaldensity.cpp @@ -65,10 +65,10 @@ void QgsPdalDensityAlgorithm::initAlgorithm( const QVariantMap & ) createCommonParameters(); - std::unique_ptr paramOriginX = std::make_unique( QStringLiteral( "ORIGIN_X" ), QObject::tr( "X origin of a tile for parallel runs" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 ); + auto paramOriginX = std::make_unique( QStringLiteral( "ORIGIN_X" ), QObject::tr( "X origin of a tile for parallel runs" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 ); paramOriginX->setFlags( paramOriginX->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( paramOriginX.release() ); - std::unique_ptr paramOriginY = std::make_unique( QStringLiteral( "ORIGIN_Y" ), QObject::tr( "Y origin of a tile for parallel runs" ), Qgis::ProcessingNumberParameterType::Integer, QVariant(), true, 0 ); + auto paramOriginY = std::make_unique( QStringLiteral( "ORIGIN_Y" ), QObject::tr( "Y origin of a tile for parallel runs" ), Qgis::ProcessingNumberParameterType::Integer, QVariant(), true, 0 ); paramOriginY->setFlags( paramOriginY->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( paramOriginY.release() ); diff --git a/src/analysis/processing/pdal/qgsalgorithmpdalexportraster.cpp b/src/analysis/processing/pdal/qgsalgorithmpdalexportraster.cpp index 1ea89c316434..fe6a6b419a89 100644 --- a/src/analysis/processing/pdal/qgsalgorithmpdalexportraster.cpp +++ b/src/analysis/processing/pdal/qgsalgorithmpdalexportraster.cpp @@ -66,10 +66,10 @@ void QgsPdalExportRasterAlgorithm::initAlgorithm( const QVariantMap & ) createCommonParameters(); - std::unique_ptr paramOriginX = std::make_unique( QStringLiteral( "ORIGIN_X" ), QObject::tr( "X origin of a tile for parallel runs" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 ); + auto paramOriginX = std::make_unique( QStringLiteral( "ORIGIN_X" ), QObject::tr( "X origin of a tile for parallel runs" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 ); paramOriginX->setFlags( paramOriginX->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( paramOriginX.release() ); - std::unique_ptr paramOriginY = std::make_unique( QStringLiteral( "ORIGIN_Y" ), QObject::tr( "Y origin of a tile for parallel runs" ), Qgis::ProcessingNumberParameterType::Integer, QVariant(), true, 0 ); + auto paramOriginY = std::make_unique( QStringLiteral( "ORIGIN_Y" ), QObject::tr( "Y origin of a tile for parallel runs" ), Qgis::ProcessingNumberParameterType::Integer, QVariant(), true, 0 ); paramOriginY->setFlags( paramOriginY->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( paramOriginY.release() ); diff --git a/src/analysis/processing/pdal/qgsalgorithmpdalexportrastertin.cpp b/src/analysis/processing/pdal/qgsalgorithmpdalexportrastertin.cpp index fe614283142d..73d3be04f007 100644 --- a/src/analysis/processing/pdal/qgsalgorithmpdalexportrastertin.cpp +++ b/src/analysis/processing/pdal/qgsalgorithmpdalexportrastertin.cpp @@ -65,10 +65,10 @@ void QgsPdalExportRasterTinAlgorithm::initAlgorithm( const QVariantMap & ) createCommonParameters(); - std::unique_ptr paramOriginX = std::make_unique( QStringLiteral( "ORIGIN_X" ), QObject::tr( "X origin of a tile for parallel runs" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 ); + auto paramOriginX = std::make_unique( QStringLiteral( "ORIGIN_X" ), QObject::tr( "X origin of a tile for parallel runs" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 ); paramOriginX->setFlags( paramOriginX->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( paramOriginX.release() ); - std::unique_ptr paramOriginY = std::make_unique( QStringLiteral( "ORIGIN_Y" ), QObject::tr( "Y origin of a tile for parallel runs" ), Qgis::ProcessingNumberParameterType::Integer, QVariant(), true, 0 ); + auto paramOriginY = std::make_unique( QStringLiteral( "ORIGIN_Y" ), QObject::tr( "Y origin of a tile for parallel runs" ), Qgis::ProcessingNumberParameterType::Integer, QVariant(), true, 0 ); paramOriginY->setFlags( paramOriginY->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( paramOriginY.release() ); diff --git a/src/analysis/processing/pdal/qgsalgorithmpdalreproject.cpp b/src/analysis/processing/pdal/qgsalgorithmpdalreproject.cpp index 5989793147ae..726b2167de7c 100644 --- a/src/analysis/processing/pdal/qgsalgorithmpdalreproject.cpp +++ b/src/analysis/processing/pdal/qgsalgorithmpdalreproject.cpp @@ -62,7 +62,7 @@ void QgsPdalReprojectAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterPointCloudLayer( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ) ) ); addParameter( new QgsProcessingParameterCrs( QStringLiteral( "CRS" ), QObject::tr( "Target CRS" ), QStringLiteral( "EPSG:4326" ) ) ); - std::unique_ptr crsOpParam = std::make_unique( QStringLiteral( "OPERATION" ), QObject::tr( "Coordinate operation" ), QVariant(), QStringLiteral( "INPUT" ), QStringLiteral( "CRS" ), QVariant(), QVariant(), true ); + auto crsOpParam = std::make_unique( QStringLiteral( "OPERATION" ), QObject::tr( "Coordinate operation" ), QVariant(), QStringLiteral( "INPUT" ), QStringLiteral( "CRS" ), QVariant(), QVariant(), true ); crsOpParam->setFlags( crsOpParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( crsOpParam.release() ); diff --git a/src/analysis/processing/pdal/qgsalgorithmpdaltile.cpp b/src/analysis/processing/pdal/qgsalgorithmpdaltile.cpp index e44d6d1193e8..ff7dc7d44be8 100644 --- a/src/analysis/processing/pdal/qgsalgorithmpdaltile.cpp +++ b/src/analysis/processing/pdal/qgsalgorithmpdaltile.cpp @@ -63,7 +63,7 @@ void QgsPdalTileAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterMultipleLayers( QStringLiteral( "LAYERS" ), QObject::tr( "Input layers" ), Qgis::ProcessingSourceType::PointCloud ) ); addParameter( new QgsProcessingParameterNumber( QStringLiteral( "LENGTH" ), QObject::tr( "Tile length" ), Qgis::ProcessingNumberParameterType::Double, 1000.0, false, 1 ) ); - std::unique_ptr paramCrs = std::make_unique( QStringLiteral( "CRS" ), QObject::tr( "Assign CRS" ), QVariant(), true ); + auto paramCrs = std::make_unique( QStringLiteral( "CRS" ), QObject::tr( "Assign CRS" ), QVariant(), true ); paramCrs->setFlags( paramCrs->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( paramCrs.release() ); diff --git a/src/analysis/processing/pdal/qgspdalalgorithmbase.cpp b/src/analysis/processing/pdal/qgspdalalgorithmbase.cpp index dcb51ffb3418..061d5204ac8a 100644 --- a/src/analysis/processing/pdal/qgspdalalgorithmbase.cpp +++ b/src/analysis/processing/pdal/qgspdalalgorithmbase.cpp @@ -57,11 +57,11 @@ QString QgsPdalAlgorithmBase::wrenchExecutableBinary() const void QgsPdalAlgorithmBase::createCommonParameters() { - std::unique_ptr filterParam = std::make_unique( QStringLiteral( "FILTER_EXPRESSION" ), QObject::tr( "Filter expression" ), QVariant(), QStringLiteral( "INPUT" ), true, Qgis::ExpressionType::PointCloud ); + auto filterParam = std::make_unique( QStringLiteral( "FILTER_EXPRESSION" ), QObject::tr( "Filter expression" ), QVariant(), QStringLiteral( "INPUT" ), true, Qgis::ExpressionType::PointCloud ); filterParam->setFlags( filterParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( filterParam.release() ); - std::unique_ptr extentParam = std::make_unique( QStringLiteral( "FILTER_EXTENT" ), QObject::tr( "Cropping extent" ), QVariant(), true ); + auto extentParam = std::make_unique( QStringLiteral( "FILTER_EXTENT" ), QObject::tr( "Cropping extent" ), QVariant(), true ); extentParam->setFlags( extentParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( extentParam.release() ); } diff --git a/src/analysis/processing/qgsalgorithmaddincrementalfield.cpp b/src/analysis/processing/qgsalgorithmaddincrementalfield.cpp index f1b75b5dfd42..c59b33a2dc5f 100644 --- a/src/analysis/processing/qgsalgorithmaddincrementalfield.cpp +++ b/src/analysis/processing/qgsalgorithmaddincrementalfield.cpp @@ -86,13 +86,13 @@ void QgsAddIncrementalFieldAlgorithm::initParameters( const QVariantMap & ) addParameter( new QgsProcessingParameterField( QStringLiteral( "GROUP_FIELDS" ), QObject::tr( "Group values by" ), QVariant(), QStringLiteral( "INPUT" ), Qgis::ProcessingFieldParameterDataType::Any, true, true ) ); // sort params - std::unique_ptr sortExp = std::make_unique( QStringLiteral( "SORT_EXPRESSION" ), QObject::tr( "Sort expression" ), QVariant(), QStringLiteral( "INPUT" ), true ); + auto sortExp = std::make_unique( QStringLiteral( "SORT_EXPRESSION" ), QObject::tr( "Sort expression" ), QVariant(), QStringLiteral( "INPUT" ), true ); sortExp->setFlags( sortExp->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( sortExp.release() ); - std::unique_ptr sortAscending = std::make_unique( QStringLiteral( "SORT_ASCENDING" ), QObject::tr( "Sort ascending" ), true ); + auto sortAscending = std::make_unique( QStringLiteral( "SORT_ASCENDING" ), QObject::tr( "Sort ascending" ), true ); sortAscending->setFlags( sortAscending->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( sortAscending.release() ); - std::unique_ptr sortNullsFirst = std::make_unique( QStringLiteral( "SORT_NULLS_FIRST" ), QObject::tr( "Sort nulls first" ), false ); + auto sortNullsFirst = std::make_unique( QStringLiteral( "SORT_NULLS_FIRST" ), QObject::tr( "Sort nulls first" ), false ); sortNullsFirst->setFlags( sortNullsFirst->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( sortNullsFirst.release() ); } diff --git a/src/analysis/processing/qgsalgorithmaddtablefield.cpp b/src/analysis/processing/qgsalgorithmaddtablefield.cpp index c176e13c2323..5564423842bc 100644 --- a/src/analysis/processing/qgsalgorithmaddtablefield.cpp +++ b/src/analysis/processing/qgsalgorithmaddtablefield.cpp @@ -99,7 +99,7 @@ void QgsAddTableFieldAlgorithm::initParameters( const QVariantMap & ) icons << QgsFields::iconForFieldType( type.first, type.second ); } - std::unique_ptr fieldTypes = std::make_unique( QStringLiteral( "FIELD_TYPE" ), QObject::tr( "Field type" ), typeStrings, false, 0 ); + auto fieldTypes = std::make_unique( QStringLiteral( "FIELD_TYPE" ), QObject::tr( "Field type" ), typeStrings, false, 0 ); fieldTypes->setMetadata( { QVariantMap( { { QStringLiteral( "widget_wrapper" ), QVariantMap( { { QStringLiteral( "icons" ), icons } } ) } } ) } diff --git a/src/analysis/processing/qgsalgorithmaffinetransform.cpp b/src/analysis/processing/qgsalgorithmaffinetransform.cpp index adc8d6b05a58..e90b70f45e93 100644 --- a/src/analysis/processing/qgsalgorithmaffinetransform.cpp +++ b/src/analysis/processing/qgsalgorithmaffinetransform.cpp @@ -70,55 +70,55 @@ QgsAffineTransformationAlgorithm *QgsAffineTransformationAlgorithm::createInstan void QgsAffineTransformationAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr xOffset = std::make_unique( QStringLiteral( "DELTA_X" ), QObject::tr( "Translation (x-axis)" ), 0.0, QStringLiteral( "INPUT" ) ); + auto xOffset = std::make_unique( QStringLiteral( "DELTA_X" ), QObject::tr( "Translation (x-axis)" ), 0.0, QStringLiteral( "INPUT" ) ); xOffset->setIsDynamic( true ); xOffset->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "DELTA_X" ), QObject::tr( "Offset distance (x-axis)" ), QgsPropertyDefinition::Double ) ); xOffset->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( xOffset.release() ); - std::unique_ptr yOffset = std::make_unique( QStringLiteral( "DELTA_Y" ), QObject::tr( "Translation (y-axis)" ), 0.0, QStringLiteral( "INPUT" ) ); + auto yOffset = std::make_unique( QStringLiteral( "DELTA_Y" ), QObject::tr( "Translation (y-axis)" ), 0.0, QStringLiteral( "INPUT" ) ); yOffset->setIsDynamic( true ); yOffset->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "DELTA_Y" ), QObject::tr( "Offset distance (y-axis)" ), QgsPropertyDefinition::Double ) ); yOffset->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( yOffset.release() ); - std::unique_ptr zOffset = std::make_unique( QStringLiteral( "DELTA_Z" ), QObject::tr( "Translation (z-axis)" ), Qgis::ProcessingNumberParameterType::Double, 0.0 ); + auto zOffset = std::make_unique( QStringLiteral( "DELTA_Z" ), QObject::tr( "Translation (z-axis)" ), Qgis::ProcessingNumberParameterType::Double, 0.0 ); zOffset->setIsDynamic( true ); zOffset->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "DELTA_Z" ), QObject::tr( "Offset distance (z-axis)" ), QgsPropertyDefinition::Double ) ); zOffset->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( zOffset.release() ); - std::unique_ptr mOffset = std::make_unique( QStringLiteral( "DELTA_M" ), QObject::tr( "Translation (m values)" ), Qgis::ProcessingNumberParameterType::Double, 0.0 ); + auto mOffset = std::make_unique( QStringLiteral( "DELTA_M" ), QObject::tr( "Translation (m values)" ), Qgis::ProcessingNumberParameterType::Double, 0.0 ); mOffset->setIsDynamic( true ); mOffset->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "DELTA_M" ), QObject::tr( "Offset distance (m values)" ), QgsPropertyDefinition::Double ) ); mOffset->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( mOffset.release() ); - std::unique_ptr xScale = std::make_unique( QStringLiteral( "SCALE_X" ), QObject::tr( "Scale factor (x-axis)" ), Qgis::ProcessingNumberParameterType::Double, 1.0 ); + auto xScale = std::make_unique( QStringLiteral( "SCALE_X" ), QObject::tr( "Scale factor (x-axis)" ), Qgis::ProcessingNumberParameterType::Double, 1.0 ); xScale->setIsDynamic( true ); xScale->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "SCALE_X" ), QObject::tr( "Scale factor (x-axis)" ), QgsPropertyDefinition::Double ) ); xScale->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( xScale.release() ); - std::unique_ptr yScale = std::make_unique( QStringLiteral( "SCALE_Y" ), QObject::tr( "Scale factor (y-axis)" ), Qgis::ProcessingNumberParameterType::Double, 1.0 ); + auto yScale = std::make_unique( QStringLiteral( "SCALE_Y" ), QObject::tr( "Scale factor (y-axis)" ), Qgis::ProcessingNumberParameterType::Double, 1.0 ); yScale->setIsDynamic( true ); yScale->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "SCALE_Y" ), QObject::tr( "Scale factor (y-axis)" ), QgsPropertyDefinition::Double ) ); yScale->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( yScale.release() ); - std::unique_ptr zScale = std::make_unique( QStringLiteral( "SCALE_Z" ), QObject::tr( "Scale factor (z-axis)" ), Qgis::ProcessingNumberParameterType::Double, 1.0 ); + auto zScale = std::make_unique( QStringLiteral( "SCALE_Z" ), QObject::tr( "Scale factor (z-axis)" ), Qgis::ProcessingNumberParameterType::Double, 1.0 ); zScale->setIsDynamic( true ); zScale->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "SCALE_Z" ), QObject::tr( "Scale factor (z-axis)" ), QgsPropertyDefinition::Double ) ); zScale->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( zScale.release() ); - std::unique_ptr mScale = std::make_unique( QStringLiteral( "SCALE_M" ), QObject::tr( "Scale factor (m values)" ), Qgis::ProcessingNumberParameterType::Double, 1.0 ); + auto mScale = std::make_unique( QStringLiteral( "SCALE_M" ), QObject::tr( "Scale factor (m values)" ), Qgis::ProcessingNumberParameterType::Double, 1.0 ); mScale->setIsDynamic( true ); mScale->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "SCALE_M" ), QObject::tr( "Scale factor (m values)" ), QgsPropertyDefinition::Double ) ); mScale->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( mScale.release() ); - std::unique_ptr rotation = std::make_unique( QStringLiteral( "ROTATION_Z" ), QObject::tr( "Rotation around z-axis (degrees counter-clockwise)" ), Qgis::ProcessingNumberParameterType::Double, 0.0 ); + auto rotation = std::make_unique( QStringLiteral( "ROTATION_Z" ), QObject::tr( "Rotation around z-axis (degrees counter-clockwise)" ), Qgis::ProcessingNumberParameterType::Double, 0.0 ); rotation->setIsDynamic( true ); rotation->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "ROTATION_Z" ), QObject::tr( "Rotation around z-axis (degrees counter-clockwise)" ), QgsPropertyDefinition::Double ) ); rotation->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmarrayoffsetlines.cpp b/src/analysis/processing/qgsalgorithmarrayoffsetlines.cpp index 90c6cec1e444..3df70932319c 100644 --- a/src/analysis/processing/qgsalgorithmarrayoffsetlines.cpp +++ b/src/analysis/processing/qgsalgorithmarrayoffsetlines.cpp @@ -72,13 +72,13 @@ QgsCreateArrayOffsetLinesAlgorithm *QgsCreateArrayOffsetLinesAlgorithm::createIn void QgsCreateArrayOffsetLinesAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr count = std::make_unique( QStringLiteral( "COUNT" ), QObject::tr( "Number of features to create" ), Qgis::ProcessingNumberParameterType::Integer, 10, false, 1 ); + auto count = std::make_unique( QStringLiteral( "COUNT" ), QObject::tr( "Number of features to create" ), Qgis::ProcessingNumberParameterType::Integer, 10, false, 1 ); count->setIsDynamic( true ); count->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "COUNT" ), QObject::tr( "Number of features to create" ), QgsPropertyDefinition::IntegerPositiveGreaterZero ) ); count->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( count.release() ); - std::unique_ptr offset = std::make_unique( QStringLiteral( "OFFSET" ), QObject::tr( "Offset step distance" ), 1.0, QStringLiteral( "INPUT" ) ); + auto offset = std::make_unique( QStringLiteral( "OFFSET" ), QObject::tr( "Offset step distance" ), 1.0, QStringLiteral( "INPUT" ) ); offset->setIsDynamic( true ); offset->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "OFFSET" ), QObject::tr( "Step distance" ), QgsPropertyDefinition::Double ) ); offset->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmarraytranslatedfeatures.cpp b/src/analysis/processing/qgsalgorithmarraytranslatedfeatures.cpp index a8b183c0b9b0..35e1222bc3a9 100644 --- a/src/analysis/processing/qgsalgorithmarraytranslatedfeatures.cpp +++ b/src/analysis/processing/qgsalgorithmarraytranslatedfeatures.cpp @@ -72,31 +72,31 @@ QgsArrayTranslatedFeaturesAlgorithm *QgsArrayTranslatedFeaturesAlgorithm::create void QgsArrayTranslatedFeaturesAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr count = std::make_unique( QStringLiteral( "COUNT" ), QObject::tr( "Number of features to create" ), Qgis::ProcessingNumberParameterType::Integer, 10, false, 1 ); + auto count = std::make_unique( QStringLiteral( "COUNT" ), QObject::tr( "Number of features to create" ), Qgis::ProcessingNumberParameterType::Integer, 10, false, 1 ); count->setIsDynamic( true ); count->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "COUNT" ), QObject::tr( "Number of features to create" ), QgsPropertyDefinition::IntegerPositiveGreaterZero ) ); count->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( count.release() ); - std::unique_ptr xOffset = std::make_unique( QStringLiteral( "DELTA_X" ), QObject::tr( "Step distance (x-axis)" ), 0.0, QStringLiteral( "INPUT" ) ); + auto xOffset = std::make_unique( QStringLiteral( "DELTA_X" ), QObject::tr( "Step distance (x-axis)" ), 0.0, QStringLiteral( "INPUT" ) ); xOffset->setIsDynamic( true ); xOffset->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "DELTA_X" ), QObject::tr( "Offset distance (x-axis)" ), QgsPropertyDefinition::Double ) ); xOffset->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( xOffset.release() ); - std::unique_ptr yOffset = std::make_unique( QStringLiteral( "DELTA_Y" ), QObject::tr( "Step distance (y-axis)" ), 0.0, QStringLiteral( "INPUT" ) ); + auto yOffset = std::make_unique( QStringLiteral( "DELTA_Y" ), QObject::tr( "Step distance (y-axis)" ), 0.0, QStringLiteral( "INPUT" ) ); yOffset->setIsDynamic( true ); yOffset->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "DELTA_Y" ), QObject::tr( "Offset distance (y-axis)" ), QgsPropertyDefinition::Double ) ); yOffset->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( yOffset.release() ); - std::unique_ptr zOffset = std::make_unique( QStringLiteral( "DELTA_Z" ), QObject::tr( "Step distance (z-axis)" ), Qgis::ProcessingNumberParameterType::Double, 0.0 ); + auto zOffset = std::make_unique( QStringLiteral( "DELTA_Z" ), QObject::tr( "Step distance (z-axis)" ), Qgis::ProcessingNumberParameterType::Double, 0.0 ); zOffset->setIsDynamic( true ); zOffset->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "DELTA_Z" ), QObject::tr( "Offset distance (z-axis)" ), QgsPropertyDefinition::Double ) ); zOffset->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( zOffset.release() ); - std::unique_ptr mOffset = std::make_unique( QStringLiteral( "DELTA_M" ), QObject::tr( "Step distance (m values)" ), Qgis::ProcessingNumberParameterType::Double, 0.0 ); + auto mOffset = std::make_unique( QStringLiteral( "DELTA_M" ), QObject::tr( "Step distance (m values)" ), Qgis::ProcessingNumberParameterType::Double, 0.0 ); mOffset->setIsDynamic( true ); mOffset->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "DELTA_M" ), QObject::tr( "Offset distance (m values)" ), QgsPropertyDefinition::Double ) ); mOffset->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmcalculateexpression.cpp b/src/analysis/processing/qgsalgorithmcalculateexpression.cpp index 955e67fb9f90..eb4ddd1c36ce 100644 --- a/src/analysis/processing/qgsalgorithmcalculateexpression.cpp +++ b/src/analysis/processing/qgsalgorithmcalculateexpression.cpp @@ -63,7 +63,7 @@ void QgsCalculateExpressionAlgorithm::initAlgorithm( const QVariantMap & ) { // possibly this should be a new dedicated parameter type for "QgsProcessingParameterVariant", as the values specified for the parameter will // be whatever the model calculates as the result of the expression. But this works for now... - std::unique_ptr inputParameter = std::make_unique( QStringLiteral( "INPUT" ), QObject::tr( "Input" ), QVariant(), false, false ); + auto inputParameter = std::make_unique( QStringLiteral( "INPUT" ), QObject::tr( "Input" ), QVariant(), false, false ); // we limit the available sources for this parameter to just precalculated expressions -- otherwise it's confusing if we allow users // to enter a literal value for this parameter, as they could enter an expression in there and expect it to be evaluated. inputParameter->setMetadata( diff --git a/src/analysis/processing/qgsalgorithmcalculateoverlaps.cpp b/src/analysis/processing/qgsalgorithmcalculateoverlaps.cpp index 3295e808c24a..2275c1960492 100644 --- a/src/analysis/processing/qgsalgorithmcalculateoverlaps.cpp +++ b/src/analysis/processing/qgsalgorithmcalculateoverlaps.cpp @@ -54,7 +54,7 @@ void QgsCalculateVectorOverlapsAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterMultipleLayers( QStringLiteral( "LAYERS" ), QObject::tr( "Overlay layers" ), Qgis::ProcessingSourceType::VectorPolygon ) ); addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Overlap" ) ) ); - std::unique_ptr gridSize = std::make_unique( QStringLiteral( "GRID_SIZE" ), QObject::tr( "Grid size" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 ); + auto gridSize = std::make_unique( QStringLiteral( "GRID_SIZE" ), QObject::tr( "Grid size" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 ); gridSize->setFlags( gridSize->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( gridSize.release() ); } diff --git a/src/analysis/processing/qgsalgorithmcategorizeusingstyle.cpp b/src/analysis/processing/qgsalgorithmcategorizeusingstyle.cpp index d90aa6d54c5f..402a0c2c6119 100644 --- a/src/analysis/processing/qgsalgorithmcategorizeusingstyle.cpp +++ b/src/analysis/processing/qgsalgorithmcategorizeusingstyle.cpp @@ -38,12 +38,12 @@ void QgsCategorizeUsingStyleAlgorithm::initAlgorithm( const QVariantMap & ) addOutput( new QgsProcessingOutputVectorLayer( QStringLiteral( "OUTPUT" ), QObject::tr( "Categorized layer" ) ) ); - std::unique_ptr failCategories = std::make_unique( QStringLiteral( "NON_MATCHING_CATEGORIES" ), QObject::tr( "Non-matching categories" ), Qgis::ProcessingSourceType::Vector, QVariant(), true, false ); + auto failCategories = std::make_unique( QStringLiteral( "NON_MATCHING_CATEGORIES" ), QObject::tr( "Non-matching categories" ), Qgis::ProcessingSourceType::Vector, QVariant(), true, false ); // not supported for outputs yet! //failCategories->setFlags( failCategories->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( failCategories.release() ); - std::unique_ptr failSymbols = std::make_unique( QStringLiteral( "NON_MATCHING_SYMBOLS" ), QObject::tr( "Non-matching symbol names" ), Qgis::ProcessingSourceType::Vector, QVariant(), true, false ); + auto failSymbols = std::make_unique( QStringLiteral( "NON_MATCHING_SYMBOLS" ), QObject::tr( "Non-matching symbol names" ), Qgis::ProcessingSourceType::Vector, QVariant(), true, false ); //failSymbols->setFlags( failSymbols->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( failSymbols.release() ); } diff --git a/src/analysis/processing/qgsalgorithmcellstatistics.cpp b/src/analysis/processing/qgsalgorithmcellstatistics.cpp index 34233ae2cae0..a07b2b688c05 100644 --- a/src/analysis/processing/qgsalgorithmcellstatistics.cpp +++ b/src/analysis/processing/qgsalgorithmcellstatistics.cpp @@ -43,11 +43,11 @@ void QgsCellStatisticsAlgorithmBase::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterRasterLayer( QStringLiteral( "REFERENCE_LAYER" ), QObject::tr( "Reference layer" ) ) ); - std::unique_ptr output_nodata_parameter = std::make_unique( QStringLiteral( "OUTPUT_NODATA_VALUE" ), QObject::tr( "Output NoData value" ), Qgis::ProcessingNumberParameterType::Double, -9999, false ); + auto output_nodata_parameter = std::make_unique( QStringLiteral( "OUTPUT_NODATA_VALUE" ), QObject::tr( "Output NoData value" ), Qgis::ProcessingNumberParameterType::Double, -9999, false ); output_nodata_parameter->setFlags( output_nodata_parameter->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( output_nodata_parameter.release() ); - std::unique_ptr createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); + auto createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); createOptsParam->setMetadata( QVariantMap( { { QStringLiteral( "widget_wrapper" ), QVariantMap( { { QStringLiteral( "widget_type" ), QStringLiteral( "rasteroptions" ) } } ) } } ) ); createOptsParam->setFlags( createOptsParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( createOptsParam.release() ); @@ -130,7 +130,7 @@ QVariantMap QgsCellStatisticsAlgorithmBase::processAlgorithm( const QVariantMap QFileInfo fi( outputFile ); const QString outputFormat = QgsRasterFileWriter::driverForExtension( fi.suffix() ); - std::unique_ptr writer = std::make_unique( outputFile ); + auto writer = std::make_unique( outputFile ); writer->setOutputProviderKey( QStringLiteral( "gdal" ) ); if ( !createOptions.isEmpty() ) { diff --git a/src/analysis/processing/qgsalgorithmcentroid.cpp b/src/analysis/processing/qgsalgorithmcentroid.cpp index 3022245c9ba5..68cc13e8d8bc 100644 --- a/src/analysis/processing/qgsalgorithmcentroid.cpp +++ b/src/analysis/processing/qgsalgorithmcentroid.cpp @@ -76,7 +76,7 @@ QgsCentroidAlgorithm *QgsCentroidAlgorithm::createInstance() const void QgsCentroidAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr allParts = std::make_unique( + auto allParts = std::make_unique( QStringLiteral( "ALL_PARTS" ), QObject::tr( "Create centroid for each part" ), false diff --git a/src/analysis/processing/qgsalgorithmcheckgeometryangle.cpp b/src/analysis/processing/qgsalgorithmcheckgeometryangle.cpp index 506a0adb5164..0a5e1fccbf63 100644 --- a/src/analysis/processing/qgsalgorithmcheckgeometryangle.cpp +++ b/src/analysis/processing/qgsalgorithmcheckgeometryangle.cpp @@ -52,7 +52,7 @@ auto QgsGeometryCheckAngleAlgorithm::groupId() const -> QString auto QgsGeometryCheckAngleAlgorithm::shortHelpString() const -> QString { - return QObject::tr( "This algorithm check the angle of geometry (in line or polygon)." ); + return QObject::tr( "This algorithm checks the angles of line or polygon geometries." ); } auto QgsGeometryCheckAngleAlgorithm::flags() const -> Qgis::ProcessingAlgorithmFlags @@ -80,10 +80,10 @@ void QgsGeometryCheckAngleAlgorithm::initAlgorithm( const QVariantMap &configura addParameter( new QgsProcessingParameterNumber( QStringLiteral( "MIN_ANGLE" ), QObject::tr( "min angle" ), Qgis::ProcessingNumberParameterType::Double, 0, false, 0.0, 180.0 ) ); // outputs - addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "ERRORS" ), QObject::tr( "Errors layer" ), Qgis::ProcessingSourceType::VectorPoint ) ); + addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "ERRORS" ), QObject::tr( "Error layer" ), Qgis::ProcessingSourceType::VectorPoint ) ); addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Output layer" ), Qgis::ProcessingSourceType::VectorAnyGeometry ) ); - std::unique_ptr tolerance = std::make_unique( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 ); + auto tolerance = std::make_unique( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 ); tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( tolerance.release() ); } diff --git a/src/analysis/processing/qgsalgorithmcheckgeometryarea.cpp b/src/analysis/processing/qgsalgorithmcheckgeometryarea.cpp index 7358a18e7adc..3f305fd49dce 100644 --- a/src/analysis/processing/qgsalgorithmcheckgeometryarea.cpp +++ b/src/analysis/processing/qgsalgorithmcheckgeometryarea.cpp @@ -52,7 +52,7 @@ auto QgsGeometryCheckAreaAlgorithm::groupId() const -> QString auto QgsGeometryCheckAreaAlgorithm::shortHelpString() const -> QString { - return QObject::tr( "This algorithm check the area of geometry (polygon)." ); + return QObject::tr( "This algorithm checks the areas of polygon geometries." ); } auto QgsGeometryCheckAreaAlgorithm::flags() const -> Qgis::ProcessingAlgorithmFlags @@ -80,10 +80,10 @@ void QgsGeometryCheckAreaAlgorithm::initAlgorithm( const QVariantMap &configurat addParameter( new QgsProcessingParameterNumber( QStringLiteral( "AREATHRESHOLD" ), QObject::tr( "area threshold" ), Qgis::ProcessingNumberParameterType::Double, 0, false, 0.0 ) ); // outputs - addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "ERRORS" ), QObject::tr( "Errors layer" ), Qgis::ProcessingSourceType::VectorPoint ) ); + addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "ERRORS" ), QObject::tr( "Error layer" ), Qgis::ProcessingSourceType::VectorPoint ) ); addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Output layer" ), Qgis::ProcessingSourceType::VectorPolygon ) ); - std::unique_ptr tolerance = std::make_unique( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 ); + auto tolerance = std::make_unique( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 ); tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( tolerance.release() ); } diff --git a/src/analysis/processing/qgsalgorithmcheckgeometryhole.cpp b/src/analysis/processing/qgsalgorithmcheckgeometryhole.cpp index 6be2e9f8addb..abba86a27ff4 100644 --- a/src/analysis/processing/qgsalgorithmcheckgeometryhole.cpp +++ b/src/analysis/processing/qgsalgorithmcheckgeometryhole.cpp @@ -52,7 +52,7 @@ auto QgsGeometryCheckHoleAlgorithm::groupId() const -> QString auto QgsGeometryCheckHoleAlgorithm::shortHelpString() const -> QString { - return QObject::tr( "This algorithm check the holes of polygonal geometry." ); + return QObject::tr( "This algorithm checks the holes of polygon geometries." ); } auto QgsGeometryCheckHoleAlgorithm::flags() const -> Qgis::ProcessingAlgorithmFlags @@ -79,10 +79,10 @@ void QgsGeometryCheckHoleAlgorithm::initAlgorithm( const QVariantMap &configurat addParameter( new QgsProcessingParameterField( QStringLiteral( "UNIQUE_ID" ), QObject::tr( "Unique feature identifier" ), QString(), QStringLiteral( "INPUT" ) ) ); // outputs - addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "ERRORS" ), QObject::tr( "Errors layer" ), Qgis::ProcessingSourceType::VectorPoint ) ); + addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "ERRORS" ), QObject::tr( "Error layer" ), Qgis::ProcessingSourceType::VectorPoint ) ); addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Output layer" ), Qgis::ProcessingSourceType::VectorPolygon ) ); - std::unique_ptr tolerance = std::make_unique( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 ); + auto tolerance = std::make_unique( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 ); tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( tolerance.release() ); } diff --git a/src/analysis/processing/qgsalgorithmcheckgeometrymissingvertex.cpp b/src/analysis/processing/qgsalgorithmcheckgeometrymissingvertex.cpp index 2f4e0d59dd1c..0cdae4f2ae6a 100644 --- a/src/analysis/processing/qgsalgorithmcheckgeometrymissingvertex.cpp +++ b/src/analysis/processing/qgsalgorithmcheckgeometrymissingvertex.cpp @@ -52,7 +52,7 @@ auto QgsGeometryCheckMissingVertexAlgorithm::groupId() const -> QString auto QgsGeometryCheckMissingVertexAlgorithm::shortHelpString() const -> QString { - return QObject::tr( "This algorithm checks the missing vertices along polygons junctions." ); + return QObject::tr( "This algorithm checks for missing vertices along polygon junctions." ); } auto QgsGeometryCheckMissingVertexAlgorithm::flags() const -> Qgis::ProcessingAlgorithmFlags @@ -79,10 +79,10 @@ void QgsGeometryCheckMissingVertexAlgorithm::initAlgorithm( const QVariantMap &c addParameter( new QgsProcessingParameterField( QStringLiteral( "UNIQUE_ID" ), QObject::tr( "Unique feature identifier" ), QString(), QStringLiteral( "INPUT" ) ) ); // outputs - addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "ERRORS" ), QObject::tr( "Errors layer" ), Qgis::ProcessingSourceType::VectorPoint ) ); + addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "ERRORS" ), QObject::tr( "Error layer" ), Qgis::ProcessingSourceType::VectorPoint ) ); addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Output layer" ), Qgis::ProcessingSourceType::VectorPolygon ) ); - std::unique_ptr tolerance = std::make_unique( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 ); + auto tolerance = std::make_unique( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 ); tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( tolerance.release() ); } diff --git a/src/analysis/processing/qgsalgorithmconcavehull.cpp b/src/analysis/processing/qgsalgorithmconcavehull.cpp index d8fa2a718ee0..9089f3e8b315 100644 --- a/src/analysis/processing/qgsalgorithmconcavehull.cpp +++ b/src/analysis/processing/qgsalgorithmconcavehull.cpp @@ -193,8 +193,9 @@ void QgsConcaveHullAlgorithm::concaveHullQgis( std::unique_ptr & const QgsProcessingAlgorithm *delaunayAlg = QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "native:delaunaytriangulation" ) ); if ( !delaunayAlg ) { - feedback->reportError( QObject::tr( "Failed to compute concave hull: Delaunay triangulation algorithm not found!" ), true ); + throw QgsProcessingException( QObject::tr( "Failed to compute concave hull: Delaunay triangulation algorithm not found!" ) ); } + std::unique_ptr algorithm; algorithm.reset( delaunayAlg->create() ); QVariantMap results = algorithm->run( params, context, &multiStepFeedback ); diff --git a/src/analysis/processing/qgsalgorithmconstantraster.cpp b/src/analysis/processing/qgsalgorithmconstantraster.cpp index af5e308fa1ee..8446f2cc4b8b 100644 --- a/src/analysis/processing/qgsalgorithmconstantraster.cpp +++ b/src/analysis/processing/qgsalgorithmconstantraster.cpp @@ -82,7 +82,7 @@ void QgsConstantRasterAlgorithm::initAlgorithm( const QVariantMap & ) rasterTypeParameter->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( rasterTypeParameter.release() ); - std::unique_ptr createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); + auto createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); createOptsParam->setMetadata( QVariantMap( { { QStringLiteral( "widget_wrapper" ), QVariantMap( { { QStringLiteral( "widget_type" ), QStringLiteral( "rasteroptions" ) } } ) } } ) ); createOptsParam->setFlags( createOptsParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( createOptsParam.release() ); @@ -168,7 +168,7 @@ QVariantMap QgsConstantRasterAlgorithm::processAlgorithm( const QVariantMap &par //this prevents output cellsize being calculated too small const QgsRectangle rasterExtent = QgsRectangle( extent.xMinimum(), extent.yMaximum() - ( rows * pixelSize ), extent.xMinimum() + ( cols * pixelSize ), extent.yMaximum() ); - std::unique_ptr writer = std::make_unique( outputFile ); + auto writer = std::make_unique( outputFile ); writer->setOutputProviderKey( QStringLiteral( "gdal" ) ); if ( !createOptions.isEmpty() ) { diff --git a/src/analysis/processing/qgsalgorithmconverttocurves.cpp b/src/analysis/processing/qgsalgorithmconverttocurves.cpp index c2df04d45283..b3f174b4c5bd 100644 --- a/src/analysis/processing/qgsalgorithmconverttocurves.cpp +++ b/src/analysis/processing/qgsalgorithmconverttocurves.cpp @@ -67,13 +67,13 @@ QList QgsConvertToCurvesAlgorithm::inputLayerTypes() const void QgsConvertToCurvesAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr tolerance = std::make_unique( QStringLiteral( "DISTANCE" ), QObject::tr( "Maximum distance tolerance" ), Qgis::ProcessingNumberParameterType::Double, 0.000001, false, 0, 10000000.0 ); + auto tolerance = std::make_unique( QStringLiteral( "DISTANCE" ), QObject::tr( "Maximum distance tolerance" ), Qgis::ProcessingNumberParameterType::Double, 0.000001, false, 0, 10000000.0 ); tolerance->setIsDynamic( true ); tolerance->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "DISTANCE" ), QObject::tr( "Maximum distance tolerance" ), QgsPropertyDefinition::DoublePositive ) ); tolerance->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( tolerance.release() ); - std::unique_ptr angleTolerance = std::make_unique( QStringLiteral( "ANGLE" ), QObject::tr( "Maximum angle tolerance" ), Qgis::ProcessingNumberParameterType::Double, 0.000001, false, 0, 45.0 ); + auto angleTolerance = std::make_unique( QStringLiteral( "ANGLE" ), QObject::tr( "Maximum angle tolerance" ), Qgis::ProcessingNumberParameterType::Double, 0.000001, false, 0, 45.0 ); angleTolerance->setIsDynamic( true ); angleTolerance->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "ANGLE" ), QObject::tr( "Maximum angle tolerance" ), QgsPropertyDefinition::DoublePositive ) ); angleTolerance->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmcoveragesimplify.cpp b/src/analysis/processing/qgsalgorithmcoveragesimplify.cpp index 5b549d4f0122..5440107538e1 100644 --- a/src/analysis/processing/qgsalgorithmcoveragesimplify.cpp +++ b/src/analysis/processing/qgsalgorithmcoveragesimplify.cpp @@ -52,7 +52,7 @@ void QgsCoverageSimplifyAlgorithm::initAlgorithm( const QVariantMap & ) { addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorPolygon ) ) ); addParameter( new QgsProcessingParameterDistance( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), 1.0, QStringLiteral( "INPUT" ), false, 0, 10000000.0 ) ); - std::unique_ptr boundaryParameter = std::make_unique( QStringLiteral( "PRESERVE_BOUNDARY" ), QObject::tr( "Preserve boundary" ), false ); + auto boundaryParameter = std::make_unique( QStringLiteral( "PRESERVE_BOUNDARY" ), QObject::tr( "Preserve boundary" ), false ); boundaryParameter->setHelp( QObject::tr( "When enabled the outside edges of the coverage will be preserved without simplification." ) ); addParameter( boundaryParameter.release() ); diff --git a/src/analysis/processing/qgsalgorithmcoveragevalidate.cpp b/src/analysis/processing/qgsalgorithmcoveragevalidate.cpp index 0861df33c7ed..a59776042154 100644 --- a/src/analysis/processing/qgsalgorithmcoveragevalidate.cpp +++ b/src/analysis/processing/qgsalgorithmcoveragevalidate.cpp @@ -52,7 +52,7 @@ QString QgsCoverageValidateAlgorithm::groupId() const void QgsCoverageValidateAlgorithm::initAlgorithm( const QVariantMap & ) { addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorPolygon ) ) ); - std::unique_ptr gapWidthParam = std::make_unique( QStringLiteral( "GAP_WIDTH" ), QObject::tr( "Gap width" ), 0.0, QStringLiteral( "INPUT" ), false, 0, 10000000.0 ); + auto gapWidthParam = std::make_unique( QStringLiteral( "GAP_WIDTH" ), QObject::tr( "Gap width" ), 0.0, QStringLiteral( "INPUT" ), false, 0, 10000000.0 ); gapWidthParam->setHelp( QObject::tr( "The maximum width of gaps to detect" ) ); addParameter( gapWidthParam.release() ); diff --git a/src/analysis/processing/qgsalgorithmdelaunaytriangulation.cpp b/src/analysis/processing/qgsalgorithmdelaunaytriangulation.cpp index 1779e50950bb..d949289aacb7 100644 --- a/src/analysis/processing/qgsalgorithmdelaunaytriangulation.cpp +++ b/src/analysis/processing/qgsalgorithmdelaunaytriangulation.cpp @@ -60,7 +60,7 @@ QgsDelaunayTriangulationAlgorithm *QgsDelaunayTriangulationAlgorithm::createInst void QgsDelaunayTriangulationAlgorithm::initAlgorithm( const QVariantMap & ) { addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorPoint ) ) ); - std::unique_ptr toleranceParam = std::make_unique( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Double, 0, true, 0 ); + auto toleranceParam = std::make_unique( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Double, 0, true, 0 ); toleranceParam->setHelp( QObject::tr( "Specifies an optional snapping tolerance which can be used to improve the robustness of the triangulation" ) ); addParameter( toleranceParam.release() ); addParameter( new QgsProcessingParameterBoolean( QStringLiteral( "ADD_ATTRIBUTES" ), QObject::tr( "Add point IDs to output" ), true ) ); diff --git a/src/analysis/processing/qgsalgorithmdensifygeometriesbycount.cpp b/src/analysis/processing/qgsalgorithmdensifygeometriesbycount.cpp index 61eecaaaa121..258c00000689 100644 --- a/src/analysis/processing/qgsalgorithmdensifygeometriesbycount.cpp +++ b/src/analysis/processing/qgsalgorithmdensifygeometriesbycount.cpp @@ -75,7 +75,7 @@ QList QgsDensifyGeometriesByCountAlgorithm::inputLayerTypes() const void QgsDensifyGeometriesByCountAlgorithm::initParameters( const QVariantMap &configuration ) { Q_UNUSED( configuration ) - std::unique_ptr verticesCnt = std::make_unique( QStringLiteral( "VERTICES" ), QObject::tr( "Number of vertices to add" ), Qgis::ProcessingNumberParameterType::Integer, 1, false, 1, 10000000 ); + auto verticesCnt = std::make_unique( QStringLiteral( "VERTICES" ), QObject::tr( "Number of vertices to add" ), Qgis::ProcessingNumberParameterType::Integer, 1, false, 1, 10000000 ); verticesCnt->setIsDynamic( true ); verticesCnt->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "VerticesCount" ), QObject::tr( "Vertices count" ), QgsPropertyDefinition::IntegerPositive ) ); verticesCnt->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmdensifygeometriesbyinterval.cpp b/src/analysis/processing/qgsalgorithmdensifygeometriesbyinterval.cpp index 2061c6ac0a71..2a96265f2d1a 100644 --- a/src/analysis/processing/qgsalgorithmdensifygeometriesbyinterval.cpp +++ b/src/analysis/processing/qgsalgorithmdensifygeometriesbyinterval.cpp @@ -70,7 +70,7 @@ QList QgsDensifyGeometriesByIntervalAlgorithm::inputLayerTypes() const void QgsDensifyGeometriesByIntervalAlgorithm::initParameters( const QVariantMap &configuration ) { Q_UNUSED( configuration ) - std::unique_ptr interval = std::make_unique( QStringLiteral( "INTERVAL" ), QObject::tr( "Interval between vertices to add" ), 1, QStringLiteral( "INPUT" ), false, 0, 10000000 ); + auto interval = std::make_unique( QStringLiteral( "INTERVAL" ), QObject::tr( "Interval between vertices to add" ), 1, QStringLiteral( "INPUT" ), false, 0, 10000000 ); interval->setIsDynamic( true ); interval->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "Interval" ), QObject::tr( "Interval" ), QgsPropertyDefinition::DoublePositive ) ); interval->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmdetectdatasetchanges.cpp b/src/analysis/processing/qgsalgorithmdetectdatasetchanges.cpp index 99baab2818ca..21eb7746a3bb 100644 --- a/src/analysis/processing/qgsalgorithmdetectdatasetchanges.cpp +++ b/src/analysis/processing/qgsalgorithmdetectdatasetchanges.cpp @@ -51,7 +51,7 @@ void QgsDetectVectorChangesAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "ORIGINAL" ), QObject::tr( "Original layer" ) ) ); addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "REVISED" ), QObject::tr( "Revised layer" ) ) ); - std::unique_ptr compareAttributesParam = std::make_unique( QStringLiteral( "COMPARE_ATTRIBUTES" ), QObject::tr( "Attributes to consider for match (or none to compare geometry only)" ), QVariant(), QStringLiteral( "ORIGINAL" ), Qgis::ProcessingFieldParameterDataType::Any, true, true ); + auto compareAttributesParam = std::make_unique( QStringLiteral( "COMPARE_ATTRIBUTES" ), QObject::tr( "Attributes to consider for match (or none to compare geometry only)" ), QVariant(), QStringLiteral( "ORIGINAL" ), Qgis::ProcessingFieldParameterDataType::Any, true, true ); compareAttributesParam->setDefaultToAllFields( true ); addParameter( compareAttributesParam.release() ); diff --git a/src/analysis/processing/qgsalgorithmdifference.cpp b/src/analysis/processing/qgsalgorithmdifference.cpp index 4a4d7d0aeabe..17591bddeb77 100644 --- a/src/analysis/processing/qgsalgorithmdifference.cpp +++ b/src/analysis/processing/qgsalgorithmdifference.cpp @@ -84,7 +84,7 @@ void QgsDifferenceAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "OVERLAY" ), QObject::tr( "Overlay layer" ) ) ); addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Difference" ) ) ); - std::unique_ptr gridSize = std::make_unique( QStringLiteral( "GRID_SIZE" ), QObject::tr( "Grid size" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 ); + auto gridSize = std::make_unique( QStringLiteral( "GRID_SIZE" ), QObject::tr( "Grid size" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 ); gridSize->setFlags( gridSize->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( gridSize.release() ); } diff --git a/src/analysis/processing/qgsalgorithmdissolve.cpp b/src/analysis/processing/qgsalgorithmdissolve.cpp index c3f405deb960..c2c7552a1609 100644 --- a/src/analysis/processing/qgsalgorithmdissolve.cpp +++ b/src/analysis/processing/qgsalgorithmdissolve.cpp @@ -242,7 +242,7 @@ void QgsDissolveAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ) ) ); addParameter( new QgsProcessingParameterField( QStringLiteral( "FIELD" ), QObject::tr( "Dissolve field(s)" ), QVariant(), QStringLiteral( "INPUT" ), Qgis::ProcessingFieldParameterDataType::Any, true, true ) ); - std::unique_ptr disjointParam = std::make_unique( QStringLiteral( "SEPARATE_DISJOINT" ), QObject::tr( "Keep disjoint features separate" ), false ); + auto disjointParam = std::make_unique( QStringLiteral( "SEPARATE_DISJOINT" ), QObject::tr( "Keep disjoint features separate" ), false ); disjointParam->setFlags( disjointParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( disjointParam.release() ); diff --git a/src/analysis/processing/qgsalgorithmdistancewithin.cpp b/src/analysis/processing/qgsalgorithmdistancewithin.cpp index 31fb6046f8bd..6e3945f05178 100644 --- a/src/analysis/processing/qgsalgorithmdistancewithin.cpp +++ b/src/analysis/processing/qgsalgorithmdistancewithin.cpp @@ -23,7 +23,7 @@ void QgsDistanceWithinAlgorithm::addDistanceParameter() { - std::unique_ptr distanceParam( new QgsProcessingParameterDistance( QStringLiteral( "DISTANCE" ), QObject::tr( "Where the features are within" ), 100, QStringLiteral( "INPUT" ), false, 0 ) ); + auto distanceParam = std::make_unique( QStringLiteral( "DISTANCE" ), QObject::tr( "Where the features are within" ), 100, QStringLiteral( "INPUT" ), false, 0 ); distanceParam->setIsDynamic( true ); distanceParam->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "Distance" ), QObject::tr( "Distance within" ), QgsPropertyDefinition::DoublePositive ) ); distanceParam->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmdownloadvectortiles.cpp b/src/analysis/processing/qgsalgorithmdownloadvectortiles.cpp index bdfc7eb5b9ea..321cf3debe0d 100644 --- a/src/analysis/processing/qgsalgorithmdownloadvectortiles.cpp +++ b/src/analysis/processing/qgsalgorithmdownloadvectortiles.cpp @@ -141,7 +141,7 @@ QVariantMap QgsDownloadVectorTilesAlgorithm::processAlgorithm( const QVariantMap throw QgsProcessingException( QObject::tr( "Requested number of tiles %1 exceeds limit of %2 tiles. Please, select a smaller extent, reduce maximum zoom level or increase tile limit." ).arg( tileCount ).arg( mTileLimit ) ); } - std::unique_ptr writer = std::make_unique( outputFile ); + auto writer = std::make_unique( outputFile ); if ( !writer->create() ) { throw QgsProcessingException( QObject::tr( "Failed to create MBTiles file %1" ).arg( outputFile ) ); diff --git a/src/analysis/processing/qgsalgorithmdrape.cpp b/src/analysis/processing/qgsalgorithmdrape.cpp index d1a1c8fcf5df..59ce2caab79f 100644 --- a/src/analysis/processing/qgsalgorithmdrape.cpp +++ b/src/analysis/processing/qgsalgorithmdrape.cpp @@ -42,7 +42,7 @@ void QgsDrapeAlgorithmBase::initParameters( const QVariantMap & ) addParameter( new QgsProcessingParameterBand( QStringLiteral( "BAND" ), QObject::tr( "Band number" ), 1, QStringLiteral( "RASTER" ) ) ); // nodata value - std::unique_ptr nodata = std::make_unique( QStringLiteral( "NODATA" ), QObject::tr( "Value for NoData or non-intersecting vertices" ), Qgis::ProcessingNumberParameterType::Double, 0.0 ); + auto nodata = std::make_unique( QStringLiteral( "NODATA" ), QObject::tr( "Value for NoData or non-intersecting vertices" ), Qgis::ProcessingNumberParameterType::Double, 0.0 ); nodata->setIsDynamic( true ); nodata->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "NODATA" ), QObject::tr( "Value for NoData or non-intersecting vertices" ), QgsPropertyDefinition::Double ) ); nodata->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmdxfexport.cpp b/src/analysis/processing/qgsalgorithmdxfexport.cpp index 369ddb6bcd6d..ddfdd0088e08 100644 --- a/src/analysis/processing/qgsalgorithmdxfexport.cpp +++ b/src/analysis/processing/qgsalgorithmdxfexport.cpp @@ -61,17 +61,17 @@ void QgsDxfExportAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterDxfLayers( QStringLiteral( "LAYERS" ), QObject::tr( "Input layers" ) ) ); addParameter( new QgsProcessingParameterEnum( QStringLiteral( "SYMBOLOGY_MODE" ), QObject::tr( "Symbology mode" ), QStringList() << QObject::tr( "No Symbology" ) << QObject::tr( "Feature Symbology" ) << QObject::tr( "Symbol Layer Symbology" ), false, 0 ) ); addParameter( new QgsProcessingParameterScale( QStringLiteral( "SYMBOLOGY_SCALE" ), QObject::tr( "Symbology scale" ), 1000000 ) ); - std::unique_ptr mapThemeParam = std::make_unique( QStringLiteral( "MAP_THEME" ), QObject::tr( "Map theme" ), QVariant(), true ); + auto mapThemeParam = std::make_unique( QStringLiteral( "MAP_THEME" ), QObject::tr( "Map theme" ), QVariant(), true ); mapThemeParam->setHelp( QObject::tr( "Match layer styling to the provided map theme" ) ); addParameter( mapThemeParam.release() ); const QStringList encodings = QgsDxfExport::encodings(); addParameter( new QgsProcessingParameterEnum( QStringLiteral( "ENCODING" ), QObject::tr( "Encoding" ), encodings, false, encodings.at( 0 ), false, true ) ); addParameter( new QgsProcessingParameterCrs( QStringLiteral( "CRS" ), QObject::tr( "CRS" ), QStringLiteral( "EPSG:4326" ) ) ); - std::unique_ptr extentParam = std::make_unique( QStringLiteral( "EXTENT" ), QObject::tr( "Extent" ), QVariant(), true ); + auto extentParam = std::make_unique( QStringLiteral( "EXTENT" ), QObject::tr( "Extent" ), QVariant(), true ); extentParam->setHelp( QObject::tr( "Limit exported features to those with geometries intersecting the provided extent" ) ); addParameter( extentParam.release() ); addParameter( new QgsProcessingParameterBoolean( QStringLiteral( "SELECTED_FEATURES_ONLY" ), QObject::tr( "Use only selected features" ), false ) ); - std::unique_ptr useTitleParam = std::make_unique( QStringLiteral( "USE_LAYER_TITLE" ), QObject::tr( "Use layer title as name" ), false ); + auto useTitleParam = std::make_unique( QStringLiteral( "USE_LAYER_TITLE" ), QObject::tr( "Use layer title as name" ), false ); useTitleParam->setHelp( QObject::tr( "If no attribute is chosen and layer name is not being overridden, prefer layer title (set in layer properties) to layer name" ) ); addParameter( useTitleParam.release() ); addParameter( new QgsProcessingParameterBoolean( QStringLiteral( "FORCE_2D" ), QObject::tr( "Force 2D output" ), false ) ); diff --git a/src/analysis/processing/qgsalgorithmexecutespatialitequery.cpp b/src/analysis/processing/qgsalgorithmexecutespatialitequery.cpp index 3611de8fb809..18fba8c3f92c 100644 --- a/src/analysis/processing/qgsalgorithmexecutespatialitequery.cpp +++ b/src/analysis/processing/qgsalgorithmexecutespatialitequery.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - qgsalgorithmexecutepostgisquery.cpp + qgsalgorithmexecutespatialitequery.cpp --------------------- begin : May 2020 copyright : (C) 2020 by Alexander Bruy @@ -50,7 +50,7 @@ QString QgsExecuteSpatialiteQueryAlgorithm::groupId() const QString QgsExecuteSpatialiteQueryAlgorithm::shortHelpString() const { - return QObject::tr( "Executes a SQL command on a SpatiaLite database." ); + return QObject::tr( "Executes a SQL command on a SpatiaLite database. The database is determined by an input layer or file." ); } QgsExecuteSpatialiteQueryAlgorithm *QgsExecuteSpatialiteQueryAlgorithm::createInstance() const @@ -60,13 +60,13 @@ QgsExecuteSpatialiteQueryAlgorithm *QgsExecuteSpatialiteQueryAlgorithm::createIn void QgsExecuteSpatialiteQueryAlgorithm::initAlgorithm( const QVariantMap & ) { - addParameter( new QgsProcessingParameterVectorLayer( QStringLiteral( "DATABASE" ), QObject::tr( "Database (connection name)" ), QList() << static_cast( Qgis::ProcessingSourceType::Vector ) ) ); + addParameter( new QgsProcessingParameterVectorLayer( QStringLiteral( "DATABASE" ), QObject::tr( "Database layer (or file)" ), QList() << static_cast( Qgis::ProcessingSourceType::Vector ) ) ); addParameter( new QgsProcessingParameterString( QStringLiteral( "SQL" ), QObject::tr( "SQL query" ), QVariant(), true ) ); } QVariantMap QgsExecuteSpatialiteQueryAlgorithm::processAlgorithm( const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) { - //Q_UNUSED( feedback ); + Q_UNUSED( feedback ); QgsVectorLayer *layer = parameterAsVectorLayer( parameters, QStringLiteral( "DATABASE" ), context ); QString databaseUri = layer->dataProvider()->dataSourceUri(); QgsDataSourceUri uri( databaseUri ); @@ -80,7 +80,6 @@ QVariantMap QgsExecuteSpatialiteQueryAlgorithm::processAlgorithm( const QVariant uri = QgsDataSourceUri( QStringLiteral( "dbname='%1'" ).arg( databaseUri ) ); } - feedback->pushInfo( databaseUri ); std::unique_ptr conn; try { diff --git a/src/analysis/processing/qgsalgorithmexecutespatialitequeryregistered.cpp b/src/analysis/processing/qgsalgorithmexecutespatialitequeryregistered.cpp index 56312cf53f5e..b4b3f0fe520a 100644 --- a/src/analysis/processing/qgsalgorithmexecutespatialitequeryregistered.cpp +++ b/src/analysis/processing/qgsalgorithmexecutespatialitequeryregistered.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - qgsalgorithmexecutepostgisqueryregistered.cpp + qgsalgorithmexecutespatialitequeryregistered.cpp --------------------- begin : May 2020 copyright : (C) 2020 by Alexander Bruy diff --git a/src/analysis/processing/qgsalgorithmexplode.cpp b/src/analysis/processing/qgsalgorithmexplode.cpp index 9ef10fc95e39..21b57a19d052 100644 --- a/src/analysis/processing/qgsalgorithmexplode.cpp +++ b/src/analysis/processing/qgsalgorithmexplode.cpp @@ -154,14 +154,14 @@ std::vector QgsExplodeAlgorithm::curveAsSingleSegments( const QgsCu { const QgsPoint ptA = line->pointN( i ); const QgsPoint ptB = line->pointN( i + 1 ); - std::unique_ptr ls = std::make_unique( QVector() << ptA << ptB ); + auto ls = std::make_unique( QVector() << ptA << ptB ); if ( !useCompoundCurves ) { parts.emplace_back( QgsGeometry( std::move( ls ) ) ); } else { - std::unique_ptr cc = std::make_unique(); + auto cc = std::make_unique(); cc->addCurve( ls.release() ); parts.emplace_back( QgsGeometry( std::move( cc ) ) ); } @@ -177,7 +177,7 @@ std::vector QgsExplodeAlgorithm::curveAsSingleSegments( const QgsCu const QgsPoint ptA = string->pointN( i ); const QgsPoint ptB = string->pointN( i + 1 ); const QgsPoint ptC = string->pointN( i + 2 ); - std::unique_ptr cs = std::make_unique(); + auto cs = std::make_unique(); cs->setPoints( QgsPointSequence() << ptA << ptB << ptC ); if ( !useCompoundCurves ) { @@ -185,7 +185,7 @@ std::vector QgsExplodeAlgorithm::curveAsSingleSegments( const QgsCu } else { - std::unique_ptr cc = std::make_unique(); + auto cc = std::make_unique(); cc->addCurve( cs.release() ); parts.emplace_back( QgsGeometry( std::move( cc ) ) ); } diff --git a/src/analysis/processing/qgsalgorithmexportmesh.cpp b/src/analysis/processing/qgsalgorithmexportmesh.cpp index 9d815e97e111..3730b7ecee77 100644 --- a/src/analysis/processing/qgsalgorithmexportmesh.cpp +++ b/src/analysis/processing/qgsalgorithmexportmesh.cpp @@ -427,7 +427,7 @@ QgsGeometry QgsExportMeshFacesAlgorithm::meshElement( int index ) const QVector vertices( face.size() ); for ( int i = 0; i < face.size(); ++i ) vertices[i] = mNativeMesh.vertex( face.at( i ) ); - std::unique_ptr polygon = std::make_unique(); + auto polygon = std::make_unique(); polygon->setExteriorRing( new QgsLineString( vertices ) ); return QgsGeometry( polygon.release() ); } @@ -626,7 +626,12 @@ QVariantMap QgsExportMeshOnGridAlgorithm::processAlgorithm( const QVariantMap &p } // grid definition - double gridSpacing = parameterAsDouble( parameters, QStringLiteral( "GRID_SPACING" ), context ); + const double gridSpacing = parameterAsDouble( parameters, QStringLiteral( "GRID_SPACING" ), context ); + if ( qgsDoubleNear( gridSpacing, 0 ) ) + { + throw QgsProcessingException( QObject::tr( "Grid spacing cannot be 0" ) ); + } + QgsRectangle extent = parameterAsExtent( parameters, QStringLiteral( "EXTENT" ), context ); if ( extent.isEmpty() ) extent = mTriangularMesh.extent(); @@ -769,7 +774,7 @@ void QgsMeshRasterizeAlgorithm::initAlgorithm( const QVariantMap &configuration addParameter( new QgsProcessingParameterDistance( QStringLiteral( "PIXEL_SIZE" ), QObject::tr( "Pixel size" ), 1, QStringLiteral( "INPUT" ), false ) ); addParameter( new QgsProcessingParameterCrs( QStringLiteral( "CRS_OUTPUT" ), QObject::tr( "Output coordinate system" ), QVariant(), true ) ); - std::unique_ptr createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); + auto createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); createOptsParam->setMetadata( QVariantMap( { { QStringLiteral( "widget_wrapper" ), QVariantMap( { { QStringLiteral( "widget_type" ), QStringLiteral( "rasteroptions" ) } } ) } } ) ); createOptsParam->setFlags( createOptsParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( createOptsParam.release() ); @@ -830,7 +835,12 @@ QVariantMap QgsMeshRasterizeAlgorithm::processAlgorithm( const QVariantMap ¶ } // create raster - double pixelSize = parameterAsDouble( parameters, QStringLiteral( "PIXEL_SIZE" ), context ); + const double pixelSize = parameterAsDouble( parameters, QStringLiteral( "PIXEL_SIZE" ), context ); + if ( qgsDoubleNear( pixelSize, 0 ) ) + { + throw QgsProcessingException( QObject::tr( "Pixel size cannot be 0" ) ); + } + QgsRectangle extent = parameterAsExtent( parameters, QStringLiteral( "EXTENT" ), context ); if ( extent.isEmpty() ) extent = mTriangularMesh.extent(); @@ -975,7 +985,7 @@ void QgsMeshContoursAlgorithm::initAlgorithm( const QVariantMap &configuration ) QStringLiteral( "MAXIMUM" ), QObject::tr( "Maximum contour level" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true ) ); - std::unique_ptr contourLevelList = std::make_unique( + auto contourLevelList = std::make_unique( QStringLiteral( "CONTOUR_LEVEL_LIST" ), QObject::tr( "List of contours level" ), QVariant(), false, true ); contourLevelList->setHelp( QObject::tr( "Comma separated list of values to export. If filled, the increment, minimum and maximum settings are ignored." ) ); diff --git a/src/analysis/processing/qgsalgorithmexporttopostgresql.cpp b/src/analysis/processing/qgsalgorithmexporttopostgresql.cpp index c76af2495aa9..3542de34553e 100644 --- a/src/analysis/processing/qgsalgorithmexporttopostgresql.cpp +++ b/src/analysis/processing/qgsalgorithmexporttopostgresql.cpp @@ -150,7 +150,7 @@ QVariantMap QgsExportToPostgresqlAlgorithm::processAlgorithm( const QVariantMap uri.setKeyColumn( mPrimaryKeyField ); uri.setGeometryColumn( mGeomColumn ); - std::unique_ptr exporter = std::make_unique( uri.uri(), mProviderName, mSource->fields(), mSource->wkbType(), mSource->sourceCrs(), mOverwrite, mOptions ); + auto exporter = std::make_unique( uri.uri(), mProviderName, mSource->fields(), mSource->wkbType(), mSource->sourceCrs(), mOverwrite, mOptions ); if ( exporter->errorCode() != Qgis::VectorExportResult::Success ) throw QgsProcessingException( QObject::tr( "Error exporting to PostGIS\n%1" ).arg( exporter->errorMessage() ) ); diff --git a/src/analysis/processing/qgsalgorithmextendlines.cpp b/src/analysis/processing/qgsalgorithmextendlines.cpp index dcbbf327f932..c070c86ed631 100644 --- a/src/analysis/processing/qgsalgorithmextendlines.cpp +++ b/src/analysis/processing/qgsalgorithmextendlines.cpp @@ -78,13 +78,13 @@ QgsExtendLinesAlgorithm *QgsExtendLinesAlgorithm::createInstance() const void QgsExtendLinesAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr startDistance = std::make_unique( QStringLiteral( "START_DISTANCE" ), QObject::tr( "Start distance" ), 0.0, QStringLiteral( "INPUT" ), false, 0 ); + auto startDistance = std::make_unique( QStringLiteral( "START_DISTANCE" ), QObject::tr( "Start distance" ), 0.0, QStringLiteral( "INPUT" ), false, 0 ); startDistance->setIsDynamic( true ); startDistance->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "Start Distance" ), QObject::tr( "Start distance" ), QgsPropertyDefinition::DoublePositive ) ); startDistance->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( startDistance.release() ); - std::unique_ptr endDistance = std::make_unique( QStringLiteral( "END_DISTANCE" ), QObject::tr( "End distance" ), 0.0, QStringLiteral( "INPUT" ), false, 0 ); + auto endDistance = std::make_unique( QStringLiteral( "END_DISTANCE" ), QObject::tr( "End distance" ), 0.0, QStringLiteral( "INPUT" ), false, 0 ); endDistance->setIsDynamic( true ); endDistance->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "End Distance" ), QObject::tr( "End distance" ), QgsPropertyDefinition::DoublePositive ) ); endDistance->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmextractbylocation.cpp b/src/analysis/processing/qgsalgorithmextractbylocation.cpp index a9fda047875b..339a901a37e3 100644 --- a/src/analysis/processing/qgsalgorithmextractbylocation.cpp +++ b/src/analysis/processing/qgsalgorithmextractbylocation.cpp @@ -24,7 +24,7 @@ void QgsLocationBasedAlgorithm::addPredicateParameter() { - std::unique_ptr predicateParam( new QgsProcessingParameterEnum( QStringLiteral( "PREDICATE" ), QObject::tr( "Where the features (geometric predicate)" ), predicateOptionsList(), true, QVariant::fromValue( QList() << 0 ) ) ); + auto predicateParam = std::make_unique( QStringLiteral( "PREDICATE" ), QObject::tr( "Where the features (geometric predicate)" ), predicateOptionsList(), true, QVariant::fromValue( QList() << 0 ) ); QVariantMap predicateMetadata; QVariantMap widgetMetadata; @@ -423,7 +423,7 @@ QVariantMap QgsSelectByLocationAlgorithm::processAlgorithm( const QVariantMap &p case Qgis::SelectBehavior::RemoveFromSelection: { // When subsetting or removing we only need to check already selected features - std::unique_ptr selectLayerSelected( new QgsVectorLayerSelectedFeatureSource( selectLayer ) ); + auto selectLayerSelected = std::make_unique( selectLayer ); mTargetCrs = selectLayerSelected->sourceCrs(); mTargetFeatureCount = selectLayerSelected->featureCount(); process( context, selectLayerSelected.get(), intersectSource.get(), selectedPredicates, addToSelection, true, feedback ); diff --git a/src/analysis/processing/qgsalgorithmextractlabels.cpp b/src/analysis/processing/qgsalgorithmextractlabels.cpp index 33f31d124853..44c50abde28d 100644 --- a/src/analysis/processing/qgsalgorithmextractlabels.cpp +++ b/src/analysis/processing/qgsalgorithmextractlabels.cpp @@ -78,7 +78,7 @@ void QgsExtractLabelsAlgorithm::initAlgorithm( const QVariantMap & ) QObject::tr( "Map scale" ) ) ); - std::unique_ptr mapThemeParameter = std::make_unique( + auto mapThemeParameter = std::make_unique( QStringLiteral( "MAP_THEME" ), QObject::tr( "Map theme" ), QVariant(), true @@ -92,7 +92,7 @@ void QgsExtractLabelsAlgorithm::initAlgorithm( const QVariantMap & ) QVariant( true ) ) ); - std::unique_ptr dpiParameter = std::make_unique( + auto dpiParameter = std::make_unique( QStringLiteral( "DPI" ), QObject::tr( "Map resolution (in DPI)" ), Qgis::ProcessingNumberParameterType::Double, diff --git a/src/analysis/processing/qgsalgorithmfieldcalculator.cpp b/src/analysis/processing/qgsalgorithmfieldcalculator.cpp index 6405f71875f4..22f7cbeac88c 100644 --- a/src/analysis/processing/qgsalgorithmfieldcalculator.cpp +++ b/src/analysis/processing/qgsalgorithmfieldcalculator.cpp @@ -89,16 +89,16 @@ void QgsFieldCalculatorAlgorithm::initParameters( const QVariantMap &configurati icons << QgsFields::iconForFieldType( type.first, type.second ); } - std::unique_ptr fieldName = std::make_unique( QStringLiteral( "FIELD_NAME" ), QObject::tr( "Field name" ), QVariant(), false ); - std::unique_ptr fieldType = std::make_unique( QStringLiteral( "FIELD_TYPE" ), QObject::tr( "Result field type" ), fieldTypes, false, 0 ); + auto fieldName = std::make_unique( QStringLiteral( "FIELD_NAME" ), QObject::tr( "Field name" ), QVariant(), false ); + auto fieldType = std::make_unique( QStringLiteral( "FIELD_TYPE" ), QObject::tr( "Result field type" ), fieldTypes, false, 0 ); fieldType->setMetadata( { QVariantMap( { { QStringLiteral( "widget_wrapper" ), QVariantMap( { { QStringLiteral( "icons" ), icons } } ) } } ) } ); - std::unique_ptr fieldLength = std::make_unique( QStringLiteral( "FIELD_LENGTH" ), QObject::tr( "Result field length" ), Qgis::ProcessingNumberParameterType::Integer, QVariant( 0 ), false, 0 ); - std::unique_ptr fieldPrecision = std::make_unique( QStringLiteral( "FIELD_PRECISION" ), QObject::tr( "Result field precision" ), Qgis::ProcessingNumberParameterType::Integer, QVariant( 0 ), false, 0 ); - std::unique_ptr expression = std::make_unique( QStringLiteral( "FORMULA" ), QObject::tr( "Formula" ), QVariant(), QStringLiteral( "INPUT" ), false ); + auto fieldLength = std::make_unique( QStringLiteral( "FIELD_LENGTH" ), QObject::tr( "Result field length" ), Qgis::ProcessingNumberParameterType::Integer, QVariant( 0 ), false, 0 ); + auto fieldPrecision = std::make_unique( QStringLiteral( "FIELD_PRECISION" ), QObject::tr( "Result field precision" ), Qgis::ProcessingNumberParameterType::Integer, QVariant( 0 ), false, 0 ); + auto expression = std::make_unique( QStringLiteral( "FORMULA" ), QObject::tr( "Formula" ), QVariant(), QStringLiteral( "INPUT" ), false ); expression->setMetadata( QVariantMap( { { "inlineEditor", true } } ) ); diff --git a/src/analysis/processing/qgsalgorithmfiledownloader.cpp b/src/analysis/processing/qgsalgorithmfiledownloader.cpp index e21536fb89de..45432eb92b75 100644 --- a/src/analysis/processing/qgsalgorithmfiledownloader.cpp +++ b/src/analysis/processing/qgsalgorithmfiledownloader.cpp @@ -73,7 +73,7 @@ void QgsFileDownloaderAlgorithm::initAlgorithm( const QVariantMap & ) { addParameter( new QgsProcessingParameterString( QStringLiteral( "URL" ), tr( "URL" ), QVariant(), false, false ) ); - std::unique_ptr methodParam = std::make_unique( + auto methodParam = std::make_unique( QStringLiteral( "METHOD" ), QObject::tr( "Method" ), QStringList() @@ -86,7 +86,7 @@ void QgsFileDownloaderAlgorithm::initAlgorithm( const QVariantMap & ) methodParam->setFlags( methodParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( methodParam.release() ); - std::unique_ptr dataParam = std::make_unique( + auto dataParam = std::make_unique( QStringLiteral( "DATA" ), tr( "Data" ), QVariant(), false, true ); dataParam->setHelp( QObject::tr( "The data to add in the body if the request is a POST" ) ); diff --git a/src/analysis/processing/qgsalgorithmfillnodata.cpp b/src/analysis/processing/qgsalgorithmfillnodata.cpp index a3767832dc14..df4eba501dad 100644 --- a/src/analysis/processing/qgsalgorithmfillnodata.cpp +++ b/src/analysis/processing/qgsalgorithmfillnodata.cpp @@ -51,7 +51,7 @@ void QgsFillNoDataAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterBand( QStringLiteral( "BAND" ), QObject::tr( "Band Number" ), 1, QStringLiteral( "INPUT" ) ) ); addParameter( new QgsProcessingParameterNumber( QStringLiteral( "FILL_VALUE" ), QObject::tr( "Fill value" ), Qgis::ProcessingNumberParameterType::Double, 1, false ) ); - std::unique_ptr createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); + auto createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); createOptsParam->setMetadata( QVariantMap( { { QStringLiteral( "widget_wrapper" ), QVariantMap( { { QStringLiteral( "widget_type" ), QStringLiteral( "rasteroptions" ) } } ) } } ) ); createOptsParam->setFlags( createOptsParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( createOptsParam.release() ); @@ -108,7 +108,7 @@ QVariantMap QgsFillNoDataAlgorithm::processAlgorithm( const QVariantMap ¶met const QString outputFile = parameterAsOutputLayer( parameters, QStringLiteral( "OUTPUT" ), context ); const QFileInfo fi( outputFile ); const QString outputFormat = QgsRasterFileWriter::driverForExtension( fi.suffix() ); - std::unique_ptr writer = std::make_unique( outputFile ); + auto writer = std::make_unique( outputFile ); writer->setOutputProviderKey( QStringLiteral( "gdal" ) ); if ( !createOptions.isEmpty() ) { diff --git a/src/analysis/processing/qgsalgorithmfixgeometries.cpp b/src/analysis/processing/qgsalgorithmfixgeometries.cpp index f883e86d8812..14951a4597bd 100644 --- a/src/analysis/processing/qgsalgorithmfixgeometries.cpp +++ b/src/analysis/processing/qgsalgorithmfixgeometries.cpp @@ -89,7 +89,7 @@ bool QgsFixGeometriesAlgorithm::supportInPlaceEdit( const QgsMapLayer *l ) const void QgsFixGeometriesAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr methodParameter = std::make_unique( + auto methodParameter = std::make_unique( QStringLiteral( "METHOD" ), QObject::tr( "Repair method" ), QStringList { QObject::tr( "Linework" ), QObject::tr( "Structure" ) }, diff --git a/src/analysis/processing/qgsalgorithmfixgeometryangle.cpp b/src/analysis/processing/qgsalgorithmfixgeometryangle.cpp index f49dbee60304..864e59c239c1 100644 --- a/src/analysis/processing/qgsalgorithmfixgeometryangle.cpp +++ b/src/analysis/processing/qgsalgorithmfixgeometryangle.cpp @@ -70,7 +70,7 @@ void QgsFixGeometryAngleAlgorithm::initAlgorithm( const QVariantMap &configurati // Inputs addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorPolygon ) << static_cast( Qgis::ProcessingSourceType::VectorLine ) ) ); - addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "ERRORS" ), QObject::tr( "Errors layer" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorPoint ) ) + addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "ERRORS" ), QObject::tr( "Error layer" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorPoint ) ) ); addParameter( new QgsProcessingParameterField( QStringLiteral( "UNIQUE_ID" ), QObject::tr( "Field of original feature unique identifier" ), @@ -100,7 +100,7 @@ void QgsFixGeometryAngleAlgorithm::initAlgorithm( const QVariantMap &configurati addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Output layer" ), Qgis::ProcessingSourceType::VectorAnyGeometry ) ); addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "REPORT" ), QObject::tr( "Report layer" ), Qgis::ProcessingSourceType::VectorPoint ) ); - std::unique_ptr tolerance = std::make_unique( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 ); + auto tolerance = std::make_unique( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 ); tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( tolerance.release() ); } @@ -124,20 +124,20 @@ auto QgsFixGeometryAngleAlgorithm::processAlgorithm( const QVariantMap ¶mete // Verify that input fields exists if ( errors->fields().indexFromName( featIdFieldName ) == -1 ) - throw QgsProcessingException( QObject::tr( "Field %1 does not exist in errors layer." ).arg( featIdFieldName ) ); + throw QgsProcessingException( QObject::tr( "Field %1 does not exist in the error layer." ).arg( featIdFieldName ) ); if ( errors->fields().indexFromName( partIdxFieldName ) == -1 ) - throw QgsProcessingException( QObject::tr( "Field %1 does not exist in errors layer." ).arg( partIdxFieldName ) ); + throw QgsProcessingException( QObject::tr( "Field %1 does not exist in the error layer." ).arg( partIdxFieldName ) ); if ( errors->fields().indexFromName( ringIdxFieldName ) == -1 ) - throw QgsProcessingException( QObject::tr( "Field %1 does not exist in errors layer." ).arg( ringIdxFieldName ) ); + throw QgsProcessingException( QObject::tr( "Field %1 does not exist in the error layer." ).arg( ringIdxFieldName ) ); if ( errors->fields().indexFromName( vertexIdxFieldName ) == -1 ) - throw QgsProcessingException( QObject::tr( "Field %1 does not exist in errors layer." ).arg( vertexIdxFieldName ) ); + throw QgsProcessingException( QObject::tr( "Field %1 does not exist in the error layer." ).arg( vertexIdxFieldName ) ); int inputIdFieldIndex = input->fields().indexFromName( featIdFieldName ); if ( inputIdFieldIndex == -1 ) throw QgsProcessingException( QObject::tr( "Field %1 does not exist in input layer." ).arg( featIdFieldName ) ); QgsField inputFeatIdField = input->fields().at( inputIdFieldIndex ); if ( inputFeatIdField.type() != errors->fields().at( errors->fields().indexFromName( featIdFieldName ) ).type() ) - throw QgsProcessingException( QObject::tr( "Field %1 does not have the same type than in errors layer." ).arg( featIdFieldName ) ); + throw QgsProcessingException( QObject::tr( "Field %1 does not have the same type as in the error layer." ).arg( featIdFieldName ) ); QString dest_output; const std::unique_ptr sink_output( parameterAsSink( parameters, QStringLiteral( "OUTPUT" ), context, dest_output, input->fields(), input->wkbType(), input->sourceCrs() ) ); @@ -153,7 +153,7 @@ auto QgsFixGeometryAngleAlgorithm::processAlgorithm( const QVariantMap ¶mete throw QgsProcessingException( invalidSinkError( parameters, QStringLiteral( "REPORT" ) ) ); const QgsProject *project = QgsProject::instance(); - std::unique_ptr checkContext = std::make_unique( mTolerance, input->sourceCrs(), project->transformContext(), project ); + auto checkContext = std::make_unique( mTolerance, input->sourceCrs(), project->transformContext(), project ); QStringList messages; QVariantMap configurationCheck; diff --git a/src/analysis/processing/qgsalgorithmfixgeometryarea.cpp b/src/analysis/processing/qgsalgorithmfixgeometryarea.cpp index e45406796d2e..662e653cee88 100644 --- a/src/analysis/processing/qgsalgorithmfixgeometryarea.cpp +++ b/src/analysis/processing/qgsalgorithmfixgeometryarea.cpp @@ -66,7 +66,7 @@ void QgsFixGeometryAreaAlgorithm::initAlgorithm( const QVariantMap &configuratio // Inputs addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorPolygon ) ) ); - addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "ERRORS" ), QObject::tr( "Errors layer" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorPoint ) ) + addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "ERRORS" ), QObject::tr( "Error layer" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorPoint ) ) ); // Specific inputs for this check @@ -79,7 +79,7 @@ void QgsFixGeometryAreaAlgorithm::initAlgorithm( const QVariantMap &configuratio } addParameter( new QgsProcessingParameterEnum( QStringLiteral( "METHOD" ), QObject::tr( "Method" ), methods ) ); addParameter( new QgsProcessingParameterField( - QStringLiteral( "MERGE_ATTRIBUTE" ), QObject::tr( "Field to consider when merging polygons with the identical attribue method" ), + QStringLiteral( "MERGE_ATTRIBUTE" ), QObject::tr( "Field to consider when merging polygons with the identical attribute method" ), QString(), QStringLiteral( "INPUT" ), Qgis::ProcessingFieldParameterDataType::Any, false, true ) @@ -113,7 +113,7 @@ void QgsFixGeometryAreaAlgorithm::initAlgorithm( const QVariantMap &configuratio addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Output layer" ), Qgis::ProcessingSourceType::VectorPolygon ) ); addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "REPORT" ), QObject::tr( "Report layer" ), Qgis::ProcessingSourceType::VectorPoint ) ); - std::unique_ptr tolerance = std::make_unique( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 ); + auto tolerance = std::make_unique( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 ); tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( tolerance.release() ); } @@ -141,20 +141,20 @@ auto QgsFixGeometryAreaAlgorithm::processAlgorithm( const QVariantMap ¶meter // Verify that input fields exists if ( errors->fields().indexFromName( featIdFieldName ) == -1 ) - throw QgsProcessingException( QObject::tr( "Field %1 does not exist in errors layer." ).arg( featIdFieldName ) ); + throw QgsProcessingException( QObject::tr( "Field %1 does not exist in the error layer." ).arg( featIdFieldName ) ); if ( errors->fields().indexFromName( partIdxFieldName ) == -1 ) - throw QgsProcessingException( QObject::tr( "Field %1 does not exist in errors layer." ).arg( partIdxFieldName ) ); + throw QgsProcessingException( QObject::tr( "Field %1 does not exist in the error layer." ).arg( partIdxFieldName ) ); if ( errors->fields().indexFromName( ringIdxFieldName ) == -1 ) - throw QgsProcessingException( QObject::tr( "Field %1 does not exist in errors layer." ).arg( ringIdxFieldName ) ); + throw QgsProcessingException( QObject::tr( "Field %1 does not exist in the error layer." ).arg( ringIdxFieldName ) ); if ( errors->fields().indexFromName( vertexIdxFieldName ) == -1 ) - throw QgsProcessingException( QObject::tr( "Field %1 does not exist in errors layer." ).arg( vertexIdxFieldName ) ); + throw QgsProcessingException( QObject::tr( "Field %1 does not exist in the error layer." ).arg( vertexIdxFieldName ) ); int inputIdFieldIndex = input->fields().indexFromName( featIdFieldName ); if ( inputIdFieldIndex == -1 ) throw QgsProcessingException( QObject::tr( "Field %1 does not exist in input layer." ).arg( featIdFieldName ) ); QgsField inputFeatIdField = input->fields().at( inputIdFieldIndex ); if ( inputFeatIdField.type() != errors->fields().at( errors->fields().indexFromName( featIdFieldName ) ).type() ) - throw QgsProcessingException( QObject::tr( "Field %1 does not have the same type than in errors layer." ).arg( featIdFieldName ) ); + throw QgsProcessingException( QObject::tr( "Field %1 does not have the same type as in the error layer." ).arg( featIdFieldName ) ); QString dest_output; const std::unique_ptr sink_output( parameterAsSink( parameters, QStringLiteral( "OUTPUT" ), context, dest_output, input->fields(), input->wkbType(), input->sourceCrs() ) ); @@ -170,7 +170,7 @@ auto QgsFixGeometryAreaAlgorithm::processAlgorithm( const QVariantMap ¶meter throw QgsProcessingException( invalidSinkError( parameters, QStringLiteral( "REPORT" ) ) ); const QgsProject *project = QgsProject::instance(); - std::unique_ptr checkContext = std::make_unique( mTolerance, input->sourceCrs(), project->transformContext(), project ); + auto checkContext = std::make_unique( mTolerance, input->sourceCrs(), project->transformContext(), project ); QStringList messages; QVariantMap configurationCheck; diff --git a/src/analysis/processing/qgsalgorithmfixgeometryhole.cpp b/src/analysis/processing/qgsalgorithmfixgeometryhole.cpp index be7345c1e83d..0c4162de5fbd 100644 --- a/src/analysis/processing/qgsalgorithmfixgeometryhole.cpp +++ b/src/analysis/processing/qgsalgorithmfixgeometryhole.cpp @@ -68,7 +68,7 @@ void QgsFixGeometryHoleAlgorithm::initAlgorithm( const QVariantMap &configuratio // Inputs addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorPolygon ) << static_cast( Qgis::ProcessingSourceType::VectorLine ) ) ); - addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "ERRORS" ), QObject::tr( "Errors layer" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorPoint ) ) + addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "ERRORS" ), QObject::tr( "Error layer" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorPoint ) ) ); addParameter( new QgsProcessingParameterField( QStringLiteral( "UNIQUE_ID" ), QObject::tr( "Field of original feature unique identifier" ), @@ -98,7 +98,7 @@ void QgsFixGeometryHoleAlgorithm::initAlgorithm( const QVariantMap &configuratio addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Output layer" ), Qgis::ProcessingSourceType::VectorAnyGeometry ) ); addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "REPORT" ), QObject::tr( "Report layer" ), Qgis::ProcessingSourceType::VectorPoint ) ); - std::unique_ptr tolerance = std::make_unique( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 ); + auto tolerance = std::make_unique( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 ); tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( tolerance.release() ); } @@ -122,20 +122,20 @@ auto QgsFixGeometryHoleAlgorithm::processAlgorithm( const QVariantMap ¶meter // Verify that input fields exists if ( errors->fields().indexFromName( featIdFieldName ) == -1 ) - throw QgsProcessingException( QObject::tr( "Field %1 does not exist in errors layer." ).arg( featIdFieldName ) ); + throw QgsProcessingException( QObject::tr( "Field %1 does not exist in the error layer." ).arg( featIdFieldName ) ); if ( errors->fields().indexFromName( partIdxFieldName ) == -1 ) - throw QgsProcessingException( QObject::tr( "Field %1 does not exist in errors layer." ).arg( partIdxFieldName ) ); + throw QgsProcessingException( QObject::tr( "Field %1 does not exist in the error layer." ).arg( partIdxFieldName ) ); if ( errors->fields().indexFromName( ringIdxFieldName ) == -1 ) - throw QgsProcessingException( QObject::tr( "Field %1 does not exist in errors layer." ).arg( ringIdxFieldName ) ); + throw QgsProcessingException( QObject::tr( "Field %1 does not exist in the error layer." ).arg( ringIdxFieldName ) ); if ( errors->fields().indexFromName( vertexIdxFieldName ) == -1 ) - throw QgsProcessingException( QObject::tr( "Field %1 does not exist in errors layer." ).arg( vertexIdxFieldName ) ); + throw QgsProcessingException( QObject::tr( "Field %1 does not exist in the error layer." ).arg( vertexIdxFieldName ) ); int inputIdFieldIndex = input->fields().indexFromName( featIdFieldName ); if ( inputIdFieldIndex == -1 ) throw QgsProcessingException( QObject::tr( "Field %1 does not exist in input layer." ).arg( featIdFieldName ) ); QgsField inputFeatIdField = input->fields().at( inputIdFieldIndex ); if ( inputFeatIdField.type() != errors->fields().at( errors->fields().indexFromName( featIdFieldName ) ).type() ) - throw QgsProcessingException( QObject::tr( "Field %1 does not have the same type than in errors layer." ).arg( featIdFieldName ) ); + throw QgsProcessingException( QObject::tr( "Field %1 does not have the same type as in the error layer." ).arg( featIdFieldName ) ); QString dest_output; const std::unique_ptr sink_output( parameterAsSink( parameters, QStringLiteral( "OUTPUT" ), context, dest_output, input->fields(), input->wkbType(), input->sourceCrs() ) ); @@ -151,7 +151,7 @@ auto QgsFixGeometryHoleAlgorithm::processAlgorithm( const QVariantMap ¶meter throw QgsProcessingException( invalidSinkError( parameters, QStringLiteral( "REPORT" ) ) ); const QgsProject *project = QgsProject::instance(); - std::unique_ptr checkContext = std::make_unique( mTolerance, input->sourceCrs(), project->transformContext(), project ); + auto checkContext = std::make_unique( mTolerance, input->sourceCrs(), project->transformContext(), project ); QStringList messages; const QgsGeometryHoleCheck check( checkContext.get(), QVariantMap() ); diff --git a/src/analysis/processing/qgsalgorithmfixgeometrymissingvertex.cpp b/src/analysis/processing/qgsalgorithmfixgeometrymissingvertex.cpp index a07df8c369ce..1f408da60047 100644 --- a/src/analysis/processing/qgsalgorithmfixgeometrymissingvertex.cpp +++ b/src/analysis/processing/qgsalgorithmfixgeometrymissingvertex.cpp @@ -66,7 +66,7 @@ void QgsFixGeometryMissingVertexAlgorithm::initAlgorithm( const QVariantMap &con // Inputs addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorPolygon ) ) ); - addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "ERRORS" ), QObject::tr( "Errors layer" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorPoint ) ) + addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "ERRORS" ), QObject::tr( "Error layer" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorPoint ) ) ); addParameter( new QgsProcessingParameterField( @@ -97,7 +97,7 @@ void QgsFixGeometryMissingVertexAlgorithm::initAlgorithm( const QVariantMap &con addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Output layer" ), Qgis::ProcessingSourceType::VectorPolygon ) ); addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "REPORT" ), QObject::tr( "Report layer" ), Qgis::ProcessingSourceType::VectorPoint ) ); - std::unique_ptr tolerance = std::make_unique( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 ); + auto tolerance = std::make_unique( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 ); tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( tolerance.release() ); } @@ -121,20 +121,20 @@ auto QgsFixGeometryMissingVertexAlgorithm::processAlgorithm( const QVariantMap & // Verify that input fields exists if ( errors->fields().indexFromName( featIdFieldName ) == -1 ) - throw QgsProcessingException( QObject::tr( "Field %1 does not exist in errors layer." ).arg( featIdFieldName ) ); + throw QgsProcessingException( QObject::tr( "Field %1 does not exist in the error layer." ).arg( featIdFieldName ) ); if ( errors->fields().indexFromName( partIdxFieldName ) == -1 ) - throw QgsProcessingException( QObject::tr( "Field %1 does not exist in errors layer." ).arg( partIdxFieldName ) ); + throw QgsProcessingException( QObject::tr( "Field %1 does not exist in the error layer." ).arg( partIdxFieldName ) ); if ( errors->fields().indexFromName( ringIdxFieldName ) == -1 ) - throw QgsProcessingException( QObject::tr( "Field %1 does not exist in errors layer." ).arg( ringIdxFieldName ) ); + throw QgsProcessingException( QObject::tr( "Field %1 does not exist in the error layer." ).arg( ringIdxFieldName ) ); if ( errors->fields().indexFromName( vertexIdxFieldName ) == -1 ) - throw QgsProcessingException( QObject::tr( "Field %1 does not exist in errors layer." ).arg( vertexIdxFieldName ) ); + throw QgsProcessingException( QObject::tr( "Field %1 does not exist in the error layer." ).arg( vertexIdxFieldName ) ); int inputIdFieldIndex = input->fields().indexFromName( featIdFieldName ); if ( inputIdFieldIndex == -1 ) throw QgsProcessingException( QObject::tr( "Field %1 does not exist in input layer." ).arg( featIdFieldName ) ); QgsField inputFeatIdField = input->fields().at( inputIdFieldIndex ); if ( inputFeatIdField.type() != errors->fields().at( errors->fields().indexFromName( featIdFieldName ) ).type() ) - throw QgsProcessingException( QObject::tr( "Field %1 does not have the same type than in errors layer." ).arg( featIdFieldName ) ); + throw QgsProcessingException( QObject::tr( "Field %1 does not have the same type as in the error layer." ).arg( featIdFieldName ) ); QString dest_output; const std::unique_ptr sink_output( parameterAsSink( parameters, QStringLiteral( "OUTPUT" ), context, dest_output, input->fields(), input->wkbType(), input->sourceCrs() ) ); @@ -150,7 +150,7 @@ auto QgsFixGeometryMissingVertexAlgorithm::processAlgorithm( const QVariantMap & throw QgsProcessingException( invalidSinkError( parameters, QStringLiteral( "REPORT" ) ) ); const QgsProject *project = QgsProject::instance(); - std::unique_ptr checkContext = std::make_unique( mTolerance, input->sourceCrs(), project->transformContext(), project ); + auto checkContext = std::make_unique( mTolerance, input->sourceCrs(), project->transformContext(), project ); QStringList messages; const QgsGeometryMissingVertexCheck check( checkContext.get(), QVariantMap() ); diff --git a/src/analysis/processing/qgsalgorithmfuzzifyraster.cpp b/src/analysis/processing/qgsalgorithmfuzzifyraster.cpp index a5b0c9126796..fa2071f02d27 100644 --- a/src/analysis/processing/qgsalgorithmfuzzifyraster.cpp +++ b/src/analysis/processing/qgsalgorithmfuzzifyraster.cpp @@ -49,7 +49,7 @@ void QgsFuzzifyRasterAlgorithmBase::initAlgorithm( const QVariantMap & ) addOutput( new QgsProcessingOutputNumber( QStringLiteral( "HEIGHT_IN_PIXELS" ), QObject::tr( "Height in pixels" ) ) ); addOutput( new QgsProcessingOutputNumber( QStringLiteral( "TOTAL_PIXEL_COUNT" ), QObject::tr( "Total pixel count" ) ) ); - std::unique_ptr createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); + auto createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); createOptsParam->setMetadata( QVariantMap( { { QStringLiteral( "widget_wrapper" ), QVariantMap( { { QStringLiteral( "widget_type" ), QStringLiteral( "rasteroptions" ) } } ) } } ) ); createOptsParam->setFlags( createOptsParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( createOptsParam.release() ); @@ -89,7 +89,7 @@ QVariantMap QgsFuzzifyRasterAlgorithmBase::processAlgorithm( const QVariantMap & const QFileInfo fi( outputFile ); const QString outputFormat = QgsRasterFileWriter::driverForExtension( fi.suffix() ); - std::unique_ptr writer = std::make_unique( outputFile ); + auto writer = std::make_unique( outputFile ); writer->setOutputProviderKey( QStringLiteral( "gdal" ) ); if ( !createOptions.isEmpty() ) { @@ -195,7 +195,7 @@ void QgsFuzzifyRasterLinearMembershipAlgorithm::fuzzify( QgsRasterDataProvider * { if ( feedback ) feedback->setProgress( 100 * ( ( iterTop / maxHeight * nbBlocksWidth ) + iterLeft / maxWidth ) / nbBlocks ); - std::unique_ptr fuzzifiedBlock = std::make_unique( destinationProvider->dataType( 1 ), iterCols, iterRows ); + auto fuzzifiedBlock = std::make_unique( destinationProvider->dataType( 1 ), iterCols, iterRows ); for ( int row = 0; row < iterRows; row++ ) { @@ -321,7 +321,7 @@ void QgsFuzzifyRasterPowerMembershipAlgorithm::fuzzify( QgsRasterDataProvider *d { if ( feedback ) feedback->setProgress( 100 * ( ( iterTop / maxHeight * nbBlocksWidth ) + iterLeft / maxWidth ) / nbBlocks ); - std::unique_ptr fuzzifiedBlock = std::make_unique( destinationProvider->dataType( 1 ), iterCols, iterRows ); + auto fuzzifiedBlock = std::make_unique( destinationProvider->dataType( 1 ), iterCols, iterRows ); for ( int row = 0; row < iterRows; row++ ) { @@ -442,7 +442,7 @@ void QgsFuzzifyRasterLargeMembershipAlgorithm::fuzzify( QgsRasterDataProvider *d { if ( feedback ) feedback->setProgress( 100 * ( ( iterTop / maxHeight * nbBlocksWidth ) + iterLeft / maxWidth ) / nbBlocks ); - std::unique_ptr fuzzifiedBlock = std::make_unique( destinationProvider->dataType( 1 ), iterCols, iterRows ); + auto fuzzifiedBlock = std::make_unique( destinationProvider->dataType( 1 ), iterCols, iterRows ); for ( int row = 0; row < iterRows; row++ ) { @@ -546,7 +546,7 @@ void QgsFuzzifyRasterSmallMembershipAlgorithm::fuzzify( QgsRasterDataProvider *d { if ( feedback ) feedback->setProgress( 100 * ( ( iterTop / maxHeight * nbBlocksWidth ) + iterLeft / maxWidth ) / nbBlocks ); - std::unique_ptr fuzzifiedBlock = std::make_unique( destinationProvider->dataType( 1 ), iterCols, iterRows ); + auto fuzzifiedBlock = std::make_unique( destinationProvider->dataType( 1 ), iterCols, iterRows ); for ( int row = 0; row < iterRows; row++ ) { @@ -650,7 +650,7 @@ void QgsFuzzifyRasterGaussianMembershipAlgorithm::fuzzify( QgsRasterDataProvider { if ( feedback ) feedback->setProgress( 100 * ( ( iterTop / maxHeight * nbBlocksWidth ) + iterLeft / maxWidth ) / nbBlocks ); - std::unique_ptr fuzzifiedBlock = std::make_unique( destinationProvider->dataType( 1 ), iterCols, iterRows ); + auto fuzzifiedBlock = std::make_unique( destinationProvider->dataType( 1 ), iterCols, iterRows ); for ( int row = 0; row < iterRows; row++ ) { @@ -755,7 +755,7 @@ void QgsFuzzifyRasterNearMembershipAlgorithm::fuzzify( QgsRasterDataProvider *de { if ( feedback ) feedback->setProgress( 100 * ( ( iterTop / maxHeight * nbBlocksWidth ) + iterLeft / maxWidth ) / nbBlocks ); - std::unique_ptr fuzzifiedBlock = std::make_unique( destinationProvider->dataType( 1 ), iterCols, iterRows ); + auto fuzzifiedBlock = std::make_unique( destinationProvider->dataType( 1 ), iterCols, iterRows ); for ( int row = 0; row < iterRows; row++ ) { diff --git a/src/analysis/processing/qgsalgorithmgenerateelevationprofile.cpp b/src/analysis/processing/qgsalgorithmgenerateelevationprofile.cpp index 56f9ce9c1077..333c0b9b0b35 100644 --- a/src/analysis/processing/qgsalgorithmgenerateelevationprofile.cpp +++ b/src/analysis/processing/qgsalgorithmgenerateelevationprofile.cpp @@ -66,10 +66,10 @@ class QgsAlgorithmElevationProfilePlotItem : public Qgs2DPlot void renderContent( QgsRenderContext &rc, const QRectF &plotArea ) override { mPlotArea = plotArea; - if ( !mRenderer ) return; + rc.setShowSelection(false); // don't render selected features with the selection rendering rc.painter()->translate( mPlotArea.left(), mPlotArea.top() ); const QStringList sourceIds = mRenderer->sourceIds(); for ( const QString &source : sourceIds ) @@ -189,13 +189,13 @@ bool QgsGenerateElevationProfileAlgorithm::prepareAlgorithm( const QVariantMap & { if ( QgsRasterLayer *rasterLayer = dynamic_cast( terrainLayer ) ) { - std::unique_ptr terrainProvider = std::make_unique(); + auto terrainProvider = std::make_unique(); terrainProvider->setLayer( rasterLayer ); request.setTerrainProvider( terrainProvider.release() ); } else if ( QgsMeshLayer *meshLayer = dynamic_cast( terrainLayer ) ) { - std::unique_ptr terrainProvider = std::make_unique(); + auto terrainProvider = std::make_unique(); terrainProvider->setLayer( meshLayer ); request.setTerrainProvider( terrainProvider.release() ); } @@ -244,7 +244,7 @@ QVariantMap QgsGenerateElevationProfileAlgorithm::processAlgorithm( const QVaria if ( borderColor.isValid() ) { - std::unique_ptr lineSymbolLayer = std::make_unique( borderColor, 0.1 ); + auto lineSymbolLayer = std::make_unique( borderColor, 0.1 ); lineSymbolLayer->setPenCapStyle( Qt::FlatCap ); plotItem.xAxis().setGridMinorSymbol( new QgsLineSymbol( QgsSymbolLayerList( { lineSymbolLayer->clone() } ) ) ); plotItem.yAxis().setGridMinorSymbol( new QgsLineSymbol( QgsSymbolLayerList( { lineSymbolLayer->clone() } ) ) ); @@ -255,7 +255,7 @@ QVariantMap QgsGenerateElevationProfileAlgorithm::processAlgorithm( const QVaria if ( backgroundColor.isValid() ) { - std::unique_ptr fillSymbolLayer = std::make_unique( backgroundColor, Qt::SolidPattern, backgroundColor ); + auto fillSymbolLayer = std::make_unique( backgroundColor, Qt::SolidPattern, backgroundColor ); plotItem.setChartBackgroundSymbol( new QgsFillSymbol( QgsSymbolLayerList( { fillSymbolLayer.release() } ) ) ); } diff --git a/src/analysis/processing/qgsalgorithmgltftovector.cpp b/src/analysis/processing/qgsalgorithmgltftovector.cpp index 85c6e8e84f1c..6fb09ddc838f 100644 --- a/src/analysis/processing/qgsalgorithmgltftovector.cpp +++ b/src/analysis/processing/qgsalgorithmgltftovector.cpp @@ -105,7 +105,7 @@ std::unique_ptr extractTriangles( x, y, z ); - std::unique_ptr mp = std::make_unique(); + auto mp = std::make_unique(); if ( primitive.indices == -1 ) { @@ -206,7 +206,7 @@ std::unique_ptr extractLines( x, y, z ); - std::unique_ptr ml = std::make_unique(); + auto ml = std::make_unique(); if ( primitive.indices == -1 ) { diff --git a/src/analysis/processing/qgsalgorithmgpsbabeltools.cpp b/src/analysis/processing/qgsalgorithmgpsbabeltools.cpp index bf750582cb4b..6f0c6f52d1a7 100644 --- a/src/analysis/processing/qgsalgorithmgpsbabeltools.cpp +++ b/src/analysis/processing/qgsalgorithmgpsbabeltools.cpp @@ -247,7 +247,7 @@ void QgsConvertGpsDataAlgorithm::initAlgorithm( const QVariantMap & ) { addParameter( new QgsProcessingParameterFile( QStringLiteral( "INPUT" ), QObject::tr( "Input file" ), Qgis::ProcessingFileParameterBehavior::File, QString(), QVariant(), false, QgsApplication::gpsBabelFormatRegistry()->importFileFilter() + QStringLiteral( ";;%1" ).arg( QObject::tr( "All files (*.*)" ) ) ) ); - std::unique_ptr formatParam = std::make_unique( QStringLiteral( "FORMAT" ), QObject::tr( "Format" ) ); + auto formatParam = std::make_unique( QStringLiteral( "FORMAT" ), QObject::tr( "Format" ) ); QStringList formats; const QStringList formatNames = QgsApplication::gpsBabelFormatRegistry()->importFormatNames(); @@ -439,7 +439,7 @@ QString QgsDownloadGpsDataAlgorithm::groupId() const void QgsDownloadGpsDataAlgorithm::initAlgorithm( const QVariantMap & ) { - std::unique_ptr deviceParam = std::make_unique( QStringLiteral( "DEVICE" ), QObject::tr( "Device" ) ); + auto deviceParam = std::make_unique( QStringLiteral( "DEVICE" ), QObject::tr( "Device" ) ); QStringList deviceNames = QgsApplication::gpsBabelFormatRegistry()->deviceNames(); std::sort( deviceNames.begin(), deviceNames.end(), []( const QString &a, const QString &b ) { @@ -452,7 +452,7 @@ void QgsDownloadGpsDataAlgorithm::initAlgorithm( const QVariantMap & ) const QList> devices = QgsGpsDetector::availablePorts() << QPair( QStringLiteral( "usb:" ), QStringLiteral( "usb:" ) ); - std::unique_ptr portParam = std::make_unique( QStringLiteral( "PORT" ), QObject::tr( "Port" ) ); + auto portParam = std::make_unique( QStringLiteral( "PORT" ), QObject::tr( "Port" ) ); QStringList ports; for ( auto it = devices.constBegin(); it != devices.constEnd(); ++it ) @@ -658,7 +658,7 @@ void QgsUploadGpsDataAlgorithm::initAlgorithm( const QVariantMap & ) { addParameter( new QgsProcessingParameterFile( QStringLiteral( "INPUT" ), QObject::tr( "Input file" ), Qgis::ProcessingFileParameterBehavior::File, QString(), QVariant(), false, QObject::tr( "GPX files" ) + QStringLiteral( " (*.gpx *.GPX)" ) ) ); - std::unique_ptr deviceParam = std::make_unique( QStringLiteral( "DEVICE" ), QObject::tr( "Device" ) ); + auto deviceParam = std::make_unique( QStringLiteral( "DEVICE" ), QObject::tr( "Device" ) ); QStringList deviceNames = QgsApplication::gpsBabelFormatRegistry()->deviceNames(); std::sort( deviceNames.begin(), deviceNames.end(), []( const QString &a, const QString &b ) { @@ -670,7 +670,7 @@ void QgsUploadGpsDataAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( deviceParam.release() ); const QList> devices = QgsGpsDetector::availablePorts() << QPair( QStringLiteral( "usb:" ), QStringLiteral( "usb:" ) ); - std::unique_ptr portParam = std::make_unique( QStringLiteral( "PORT" ), QObject::tr( "Port" ) ); + auto portParam = std::make_unique( QStringLiteral( "PORT" ), QObject::tr( "Port" ) ); QStringList ports; for ( auto it = devices.constBegin(); it != devices.constEnd(); ++it ) diff --git a/src/analysis/processing/qgsalgorithmgrid.cpp b/src/analysis/processing/qgsalgorithmgrid.cpp index 31b92f1afcd1..a95085d751c4 100644 --- a/src/analysis/processing/qgsalgorithmgrid.cpp +++ b/src/analysis/processing/qgsalgorithmgrid.cpp @@ -355,7 +355,7 @@ void QgsGridAlgorithm::createRectangleGrid( std::unique_ptr &sin ringX = { x1, x2, x2, x1, x1 }; ringY = { y1, y1, y2, y2, y1 }; - std::unique_ptr poly = std::make_unique(); + auto poly = std::make_unique(); poly->setExteriorRing( new QgsLineString( ringX, ringY ) ); f.setGeometry( std::move( poly ) ); f.setAttributes( QgsAttributes() << id << x1 << y1 << x2 << y2 << row << col ); @@ -433,7 +433,7 @@ void QgsGridAlgorithm::createDiamondGrid( std::unique_ptr &sink, ringX = { x1, x2, x3, x2, x1 }; ringY = { y2, y1, y2, y3, y2 }; - std::unique_ptr poly = std::make_unique(); + auto poly = std::make_unique(); poly->setExteriorRing( new QgsLineString( ringX, ringY ) ); f.setGeometry( std::move( poly ) ); f.setAttributes( QgsAttributes() << id << x1 << y1 << x3 << y3 ); @@ -522,7 +522,7 @@ void QgsGridAlgorithm::createHexagonGrid( std::unique_ptr &sink, ringX = { x1, x2, x3, x4, x3, x2, x1 }; ringY = { y2, y1, y1, y2, y3, y3, y2 }; - std::unique_ptr poly = std::make_unique(); + auto poly = std::make_unique(); poly->setExteriorRing( new QgsLineString( ringX, ringY ) ); f.setGeometry( std::move( poly ) ); f.setAttributes( QgsAttributes() << id << x1 << y1 << x4 << y3 << row << col ); diff --git a/src/analysis/processing/qgsalgorithmhttprequest.cpp b/src/analysis/processing/qgsalgorithmhttprequest.cpp index 27e7fa98fa24..c0004c8b21fc 100644 --- a/src/analysis/processing/qgsalgorithmhttprequest.cpp +++ b/src/analysis/processing/qgsalgorithmhttprequest.cpp @@ -76,7 +76,7 @@ void QgsHttpRequestAlgorithm::initAlgorithm( const QVariantMap & ) { addParameter( new QgsProcessingParameterString( QStringLiteral( "URL" ), tr( "URL" ), QVariant(), false, false ) ); - std::unique_ptr methodParam = std::make_unique( + auto methodParam = std::make_unique( QStringLiteral( "METHOD" ), QObject::tr( "Method" ), QStringList() @@ -88,25 +88,25 @@ void QgsHttpRequestAlgorithm::initAlgorithm( const QVariantMap & ) methodParam->setHelp( QObject::tr( "The HTTP method to use for the request" ) ); addParameter( methodParam.release() ); - std::unique_ptr dataParam = std::make_unique( + auto dataParam = std::make_unique( QStringLiteral( "DATA" ), tr( "POST data" ), QVariant(), false, true ); dataParam->setHelp( QObject::tr( "The data to add in the body if the request is a POST" ) ); addParameter( dataParam.release() ); - std::unique_ptr outputFileParam = std::make_unique( + auto outputFileParam = std::make_unique( QStringLiteral( "OUTPUT" ), tr( "File destination" ), QObject::tr( "All files (*.*)" ), QVariant(), true, false ); outputFileParam->setHelp( tr( "The result can be written to a file instead of being returned as a string" ) ); addParameter( outputFileParam.release() ); - std::unique_ptr authConfigParam = std::make_unique( + auto authConfigParam = std::make_unique( QStringLiteral( "AUTH_CONFIG" ), tr( "Authentication" ), QVariant(), true ); authConfigParam->setHelp( tr( "An authentication configuration to pass" ) ); addParameter( authConfigParam.release() ); - std::unique_ptr failureParam = std::make_unique( + auto failureParam = std::make_unique( QStringLiteral( "FAIL_ON_ERROR" ), tr( "Consider HTTP errors as failures" ), false ); failureParam->setHelp( tr( "If set, the algorithm will fail on encountering a HTTP error" ) ); diff --git a/src/analysis/processing/qgsalgorithmimportphotos.cpp b/src/analysis/processing/qgsalgorithmimportphotos.cpp index c09789366f87..57f4e8bea475 100644 --- a/src/analysis/processing/qgsalgorithmimportphotos.cpp +++ b/src/analysis/processing/qgsalgorithmimportphotos.cpp @@ -54,11 +54,11 @@ void QgsImportPhotosAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterFile( QStringLiteral( "FOLDER" ), QObject::tr( "Input folder" ), Qgis::ProcessingFileParameterBehavior::Folder ) ); addParameter( new QgsProcessingParameterBoolean( QStringLiteral( "RECURSIVE" ), QObject::tr( "Scan recursively" ), false ) ); - std::unique_ptr output = std::make_unique( QStringLiteral( "OUTPUT" ), QObject::tr( "Photos" ), Qgis::ProcessingSourceType::VectorPoint, QVariant(), true ); + auto output = std::make_unique( QStringLiteral( "OUTPUT" ), QObject::tr( "Photos" ), Qgis::ProcessingSourceType::VectorPoint, QVariant(), true ); output->setCreateByDefault( true ); addParameter( output.release() ); - std::unique_ptr invalid = std::make_unique( QStringLiteral( "INVALID" ), QObject::tr( "Invalid photos table" ), Qgis::ProcessingSourceType::Vector, QVariant(), true ); + auto invalid = std::make_unique( QStringLiteral( "INVALID" ), QObject::tr( "Invalid photos table" ), Qgis::ProcessingSourceType::Vector, QVariant(), true ); invalid->setCreateByDefault( false ); addParameter( invalid.release() ); } diff --git a/src/analysis/processing/qgsalgorithminterpolatepoint.cpp b/src/analysis/processing/qgsalgorithminterpolatepoint.cpp index 3e8f216e96f2..7e192478b20f 100644 --- a/src/analysis/processing/qgsalgorithminterpolatepoint.cpp +++ b/src/analysis/processing/qgsalgorithminterpolatepoint.cpp @@ -92,7 +92,7 @@ QgsInterpolatePointAlgorithm *QgsInterpolatePointAlgorithm::createInstance() con void QgsInterpolatePointAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr distance = std::make_unique( QStringLiteral( "DISTANCE" ), QObject::tr( "Distance" ), 0.0, QStringLiteral( "INPUT" ), false, 0 ); + auto distance = std::make_unique( QStringLiteral( "DISTANCE" ), QObject::tr( "Distance" ), 0.0, QStringLiteral( "INPUT" ), false, 0 ); distance->setIsDynamic( true ); distance->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "DISTANCE" ), QObject::tr( "Distance" ), QgsPropertyDefinition::DoublePositive ) ); distance->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmintersection.cpp b/src/analysis/processing/qgsalgorithmintersection.cpp index deeab5573f02..1ea7dc665cb4 100644 --- a/src/analysis/processing/qgsalgorithmintersection.cpp +++ b/src/analysis/processing/qgsalgorithmintersection.cpp @@ -75,13 +75,13 @@ void QgsIntersectionAlgorithm::initAlgorithm( const QVariantMap & ) QStringLiteral( "OVERLAY" ), Qgis::ProcessingFieldParameterDataType::Any, true, true ) ); - std::unique_ptr prefix = std::make_unique( QStringLiteral( "OVERLAY_FIELDS_PREFIX" ), QObject::tr( "Overlay fields prefix" ), QString(), false, true ); + auto prefix = std::make_unique( QStringLiteral( "OVERLAY_FIELDS_PREFIX" ), QObject::tr( "Overlay fields prefix" ), QString(), false, true ); prefix->setFlags( prefix->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( prefix.release() ); addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Intersection" ) ) ); - std::unique_ptr gridSize = std::make_unique( QStringLiteral( "GRID_SIZE" ), QObject::tr( "Grid size" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 ); + auto gridSize = std::make_unique( QStringLiteral( "GRID_SIZE" ), QObject::tr( "Grid size" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 ); gridSize->setFlags( gridSize->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( gridSize.release() ); } diff --git a/src/analysis/processing/qgsalgorithmjoinbyattribute.cpp b/src/analysis/processing/qgsalgorithmjoinbyattribute.cpp index f599dd7d9137..4382b22e4adb 100644 --- a/src/analysis/processing/qgsalgorithmjoinbyattribute.cpp +++ b/src/analysis/processing/qgsalgorithmjoinbyattribute.cpp @@ -66,7 +66,7 @@ void QgsJoinByAttributeAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Joined layer" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, true ) ); - std::unique_ptr nonMatchingSink = std::make_unique( + auto nonMatchingSink = std::make_unique( QStringLiteral( "NON_MATCHING" ), QObject::tr( "Unjoinable features from first layer" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false ); // TODO GUI doesn't support advanced outputs yet diff --git a/src/analysis/processing/qgsalgorithmjoinbylocation.cpp b/src/analysis/processing/qgsalgorithmjoinbylocation.cpp index aaeefade03ed..d4f819315f77 100644 --- a/src/analysis/processing/qgsalgorithmjoinbylocation.cpp +++ b/src/analysis/processing/qgsalgorithmjoinbylocation.cpp @@ -30,7 +30,7 @@ void QgsJoinByLocationAlgorithm::initAlgorithm( const QVariantMap & ) { addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Join to features in" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorAnyGeometry ) ) ); - std::unique_ptr predicateParam = std::make_unique( QStringLiteral( "PREDICATE" ), QObject::tr( "Features they (geometric predicate)" ), translatedPredicates(), true, 0 ); + auto predicateParam = std::make_unique( QStringLiteral( "PREDICATE" ), QObject::tr( "Features they (geometric predicate)" ), translatedPredicates(), true, 0 ); QVariantMap predicateMetadata; QVariantMap widgetMetadata; widgetMetadata.insert( QStringLiteral( "useCheckBoxes" ), true ); diff --git a/src/analysis/processing/qgsalgorithmjoinbylocationsummary.cpp b/src/analysis/processing/qgsalgorithmjoinbylocationsummary.cpp index 7ac1b525d4fc..b4b24f607c05 100644 --- a/src/analysis/processing/qgsalgorithmjoinbylocationsummary.cpp +++ b/src/analysis/processing/qgsalgorithmjoinbylocationsummary.cpp @@ -33,7 +33,7 @@ void QgsJoinByLocationSummaryAlgorithm::initAlgorithm( const QVariantMap & ) { addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Join to features in" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorAnyGeometry ) ) ); - std::unique_ptr predicateParam = std::make_unique( QStringLiteral( "PREDICATE" ), QObject::tr( "Where the features" ), QgsJoinByLocationAlgorithm::translatedPredicates(), true, 0 ); + auto predicateParam = std::make_unique( QStringLiteral( "PREDICATE" ), QObject::tr( "Where the features" ), QgsJoinByLocationAlgorithm::translatedPredicates(), true, 0 ); QVariantMap predicateMetadata; QVariantMap widgetMetadata; widgetMetadata.insert( QStringLiteral( "useCheckBoxes" ), true ); @@ -66,7 +66,7 @@ void QgsJoinByLocationSummaryAlgorithm::initAlgorithm( const QVariantMap & ) << QObject::tr( "max_length" ) << QObject::tr( "mean_length" ); - std::unique_ptr summaryParam = std::make_unique( QStringLiteral( "SUMMARIES" ), QObject::tr( "Summaries to calculate (leave empty to use all available)" ), mAllSummaries, true, QVariant(), true ); + auto summaryParam = std::make_unique( QStringLiteral( "SUMMARIES" ), QObject::tr( "Summaries to calculate (leave empty to use all available)" ), mAllSummaries, true, QVariant(), true ); addParameter( summaryParam.release() ); addParameter( new QgsProcessingParameterBoolean( QStringLiteral( "DISCARD_NONMATCHING" ), QObject::tr( "Discard records which could not be joined" ), false ) ); diff --git a/src/analysis/processing/qgsalgorithmjoinbynearest.cpp b/src/analysis/processing/qgsalgorithmjoinbynearest.cpp index e5356331cb9f..e4ccc17a0aaf 100644 --- a/src/analysis/processing/qgsalgorithmjoinbynearest.cpp +++ b/src/analysis/processing/qgsalgorithmjoinbynearest.cpp @@ -65,7 +65,7 @@ void QgsJoinByNearestAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Joined layer" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, true ) ); - std::unique_ptr nonMatchingSink = std::make_unique( + auto nonMatchingSink = std::make_unique( QStringLiteral( "NON_MATCHING" ), QObject::tr( "Unjoinable features from first layer" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false ); // TODO GUI doesn't support advanced outputs yet diff --git a/src/analysis/processing/qgsalgorithmjoinwithlines.cpp b/src/analysis/processing/qgsalgorithmjoinwithlines.cpp index de5db0a2470e..d9b474d551ec 100644 --- a/src/analysis/processing/qgsalgorithmjoinwithlines.cpp +++ b/src/analysis/processing/qgsalgorithmjoinwithlines.cpp @@ -292,8 +292,8 @@ QVariantMap QgsJoinWithLinesAlgorithm::processAlgorithm( const QVariantMap ¶ distance = geodesicDistanceProperty.valueAsDouble( expressionContext, distance ); } - std::unique_ptr ml = std::make_unique(); - std::unique_ptr l = std::make_unique( QVector() << hubPoint ); + auto ml = std::make_unique(); + auto l = std::make_unique( QVector() << hubPoint ); const QVector> points = da.geodesicLine( QgsPointXY( hubPoint ), QgsPointXY( spokePoint ), distance, splitAntimeridian ); QVector points1 = points.at( 0 ); points1.pop_front(); diff --git a/src/analysis/processing/qgsalgorithmkeepnbiggestparts.cpp b/src/analysis/processing/qgsalgorithmkeepnbiggestparts.cpp index b642c58f1074..0c5082546c37 100644 --- a/src/analysis/processing/qgsalgorithmkeepnbiggestparts.cpp +++ b/src/analysis/processing/qgsalgorithmkeepnbiggestparts.cpp @@ -82,7 +82,7 @@ Qgis::ProcessingFeatureSourceFlags QgsKeepNBiggestPartsAlgorithm::sourceFlags() void QgsKeepNBiggestPartsAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr partsToKeep = std::make_unique( QStringLiteral( "PARTS" ), QObject::tr( "Parts to keep" ), Qgis::ProcessingNumberParameterType::Integer, 1.0, false, 1.0 ); + auto partsToKeep = std::make_unique( QStringLiteral( "PARTS" ), QObject::tr( "Parts to keep" ), Qgis::ProcessingNumberParameterType::Integer, 1.0, false, 1.0 ); partsToKeep->setIsDynamic( true ); partsToKeep->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "PARTS" ), QObject::tr( "Parts to keep" ), QgsPropertyDefinition::IntegerPositive ) ); partsToKeep->setDynamicLayerParameterName( QStringLiteral( "POLYGONS" ) ); diff --git a/src/analysis/processing/qgsalgorithmlayoutatlastoimage.cpp b/src/analysis/processing/qgsalgorithmlayoutatlastoimage.cpp index eaa824f5a8e8..c58c7f7ada1a 100644 --- a/src/analysis/processing/qgsalgorithmlayoutatlastoimage.cpp +++ b/src/analysis/processing/qgsalgorithmlayoutatlastoimage.cpp @@ -79,7 +79,7 @@ void QgsLayoutAtlasToImageAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterFile( QStringLiteral( "FOLDER" ), QObject::tr( "Output folder" ), Qgis::ProcessingFileParameterBehavior::Folder ) ); - std::unique_ptr layersParam = std::make_unique( QStringLiteral( "LAYERS" ), QObject::tr( "Map layers to assign to unlocked map item(s)" ), Qgis::ProcessingSourceType::MapLayer, QVariant(), true ); + auto layersParam = std::make_unique( QStringLiteral( "LAYERS" ), QObject::tr( "Map layers to assign to unlocked map item(s)" ), Qgis::ProcessingSourceType::MapLayer, QVariant(), true ); layersParam->setFlags( layersParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( layersParam.release() ); @@ -91,23 +91,23 @@ void QgsLayoutAtlasToImageAlgorithm::initAlgorithm( const QVariantMap & ) continue; imageFormats << QString( format ); } - std::unique_ptr extensionParam = std::make_unique( QStringLiteral( "EXTENSION" ), QObject::tr( "Image format" ), imageFormats, false, imageFormats.indexOf( QLatin1String( "png" ) ) ); + auto extensionParam = std::make_unique( QStringLiteral( "EXTENSION" ), QObject::tr( "Image format" ), imageFormats, false, imageFormats.indexOf( QLatin1String( "png" ) ) ); extensionParam->setFlags( extensionParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( extensionParam.release() ); - std::unique_ptr dpiParam = std::make_unique( QStringLiteral( "DPI" ), QObject::tr( "DPI (leave blank for default layout DPI)" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 ); + auto dpiParam = std::make_unique( QStringLiteral( "DPI" ), QObject::tr( "DPI (leave blank for default layout DPI)" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 ); dpiParam->setFlags( dpiParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( dpiParam.release() ); - std::unique_ptr appendGeorefParam = std::make_unique( QStringLiteral( "GEOREFERENCE" ), QObject::tr( "Generate world file" ), true ); + auto appendGeorefParam = std::make_unique( QStringLiteral( "GEOREFERENCE" ), QObject::tr( "Generate world file" ), true ); appendGeorefParam->setFlags( appendGeorefParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( appendGeorefParam.release() ); - std::unique_ptr exportRDFParam = std::make_unique( QStringLiteral( "INCLUDE_METADATA" ), QObject::tr( "Export RDF metadata (title, author, etc.)" ), true ); + auto exportRDFParam = std::make_unique( QStringLiteral( "INCLUDE_METADATA" ), QObject::tr( "Export RDF metadata (title, author, etc.)" ), true ); exportRDFParam->setFlags( exportRDFParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( exportRDFParam.release() ); - std::unique_ptr antialias = std::make_unique( QStringLiteral( "ANTIALIAS" ), QObject::tr( "Enable antialiasing" ), true ); + auto antialias = std::make_unique( QStringLiteral( "ANTIALIAS" ), QObject::tr( "Enable antialiasing" ), true ); antialias->setFlags( antialias->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( antialias.release() ); } diff --git a/src/analysis/processing/qgsalgorithmlayoutatlastopdf.cpp b/src/analysis/processing/qgsalgorithmlayoutatlastopdf.cpp index a8b3fbd90584..f678c6c2bec1 100644 --- a/src/analysis/processing/qgsalgorithmlayoutatlastopdf.cpp +++ b/src/analysis/processing/qgsalgorithmlayoutatlastopdf.cpp @@ -57,35 +57,35 @@ void QgsLayoutAtlasToPdfAlgorithmBase::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterExpression( QStringLiteral( "SORTBY_EXPRESSION" ), QObject::tr( "Sort expression" ), QString(), QStringLiteral( "COVERAGE_LAYER" ), true ) ); addParameter( new QgsProcessingParameterBoolean( QStringLiteral( "SORTBY_REVERSE" ), QObject::tr( "Reverse sort order (used when a sort expression is provided)" ), false ) ); - std::unique_ptr layersParam = std::make_unique( QStringLiteral( "LAYERS" ), QObject::tr( "Map layers to assign to unlocked map item(s)" ), Qgis::ProcessingSourceType::MapLayer, QVariant(), true ); + auto layersParam = std::make_unique( QStringLiteral( "LAYERS" ), QObject::tr( "Map layers to assign to unlocked map item(s)" ), Qgis::ProcessingSourceType::MapLayer, QVariant(), true ); layersParam->setFlags( layersParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( layersParam.release() ); - std::unique_ptr dpiParam = std::make_unique( QStringLiteral( "DPI" ), QObject::tr( "DPI (leave blank for default layout DPI)" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 ); + auto dpiParam = std::make_unique( QStringLiteral( "DPI" ), QObject::tr( "DPI (leave blank for default layout DPI)" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 ); dpiParam->setFlags( dpiParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( dpiParam.release() ); - std::unique_ptr forceVectorParam = std::make_unique( QStringLiteral( "FORCE_VECTOR" ), QObject::tr( "Always export as vectors" ), false ); + auto forceVectorParam = std::make_unique( QStringLiteral( "FORCE_VECTOR" ), QObject::tr( "Always export as vectors" ), false ); forceVectorParam->setFlags( forceVectorParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( forceVectorParam.release() ); - std::unique_ptr forceRasterParam = std::make_unique( QStringLiteral( "FORCE_RASTER" ), QObject::tr( "Always export as raster" ), false ); + auto forceRasterParam = std::make_unique( QStringLiteral( "FORCE_RASTER" ), QObject::tr( "Always export as raster" ), false ); forceRasterParam->setFlags( forceRasterParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( forceRasterParam.release() ); - std::unique_ptr appendGeorefParam = std::make_unique( QStringLiteral( "GEOREFERENCE" ), QObject::tr( "Append georeference information" ), true ); + auto appendGeorefParam = std::make_unique( QStringLiteral( "GEOREFERENCE" ), QObject::tr( "Append georeference information" ), true ); appendGeorefParam->setFlags( appendGeorefParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( appendGeorefParam.release() ); - std::unique_ptr exportRDFParam = std::make_unique( QStringLiteral( "INCLUDE_METADATA" ), QObject::tr( "Export RDF metadata (title, author, etc.)" ), true ); + auto exportRDFParam = std::make_unique( QStringLiteral( "INCLUDE_METADATA" ), QObject::tr( "Export RDF metadata (title, author, etc.)" ), true ); exportRDFParam->setFlags( exportRDFParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( exportRDFParam.release() ); - std::unique_ptr disableTiled = std::make_unique( QStringLiteral( "DISABLE_TILED" ), QObject::tr( "Disable tiled raster layer exports" ), false ); + auto disableTiled = std::make_unique( QStringLiteral( "DISABLE_TILED" ), QObject::tr( "Disable tiled raster layer exports" ), false ); disableTiled->setFlags( disableTiled->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( disableTiled.release() ); - std::unique_ptr simplify = std::make_unique( QStringLiteral( "SIMPLIFY" ), QObject::tr( "Simplify geometries to reduce output file size" ), true ); + auto simplify = std::make_unique( QStringLiteral( "SIMPLIFY" ), QObject::tr( "Simplify geometries to reduce output file size" ), true ); simplify->setFlags( simplify->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( simplify.release() ); @@ -95,7 +95,7 @@ void QgsLayoutAtlasToPdfAlgorithmBase::initAlgorithm( const QVariantMap & ) QObject::tr( "Prefer Exporting Text as Text Objects" ), }; - std::unique_ptr textFormat = std::make_unique( QStringLiteral( "TEXT_FORMAT" ), QObject::tr( "Text export" ), textExportOptions, false, 0 ); + auto textFormat = std::make_unique( QStringLiteral( "TEXT_FORMAT" ), QObject::tr( "Text export" ), textExportOptions, false, 0 ); textFormat->setFlags( textFormat->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( textFormat.release() ); @@ -104,7 +104,7 @@ void QgsLayoutAtlasToPdfAlgorithmBase::initAlgorithm( const QVariantMap & ) QObject::tr( "Lossless" ) }; - std::unique_ptr imageCompression = std::make_unique( QStringLiteral( "IMAGE_COMPRESSION" ), QObject::tr( "Image compression" ), imageCompressionOptions, false, 0 ); + auto imageCompression = std::make_unique( QStringLiteral( "IMAGE_COMPRESSION" ), QObject::tr( "Image compression" ), imageCompressionOptions, false, 0 ); imageCompression->setFlags( imageCompression->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( imageCompression.release() ); } diff --git a/src/analysis/processing/qgsalgorithmlayouttoimage.cpp b/src/analysis/processing/qgsalgorithmlayouttoimage.cpp index c493f0c151ac..9aa2e40d7448 100644 --- a/src/analysis/processing/qgsalgorithmlayouttoimage.cpp +++ b/src/analysis/processing/qgsalgorithmlayouttoimage.cpp @@ -64,23 +64,23 @@ void QgsLayoutToImageAlgorithm::initAlgorithm( const QVariantMap & ) { addParameter( new QgsProcessingParameterLayout( QStringLiteral( "LAYOUT" ), QObject::tr( "Print layout" ) ) ); - std::unique_ptr layersParam = std::make_unique( QStringLiteral( "LAYERS" ), QObject::tr( "Map layers to assign to unlocked map item(s)" ), Qgis::ProcessingSourceType::MapLayer, QVariant(), true ); + auto layersParam = std::make_unique( QStringLiteral( "LAYERS" ), QObject::tr( "Map layers to assign to unlocked map item(s)" ), Qgis::ProcessingSourceType::MapLayer, QVariant(), true ); layersParam->setFlags( layersParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( layersParam.release() ); - std::unique_ptr dpiParam = std::make_unique( QStringLiteral( "DPI" ), QObject::tr( "DPI (leave blank for default layout DPI)" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 ); + auto dpiParam = std::make_unique( QStringLiteral( "DPI" ), QObject::tr( "DPI (leave blank for default layout DPI)" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 ); dpiParam->setFlags( dpiParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( dpiParam.release() ); - std::unique_ptr appendGeorefParam = std::make_unique( QStringLiteral( "GEOREFERENCE" ), QObject::tr( "Generate world file" ), true ); + auto appendGeorefParam = std::make_unique( QStringLiteral( "GEOREFERENCE" ), QObject::tr( "Generate world file" ), true ); appendGeorefParam->setFlags( appendGeorefParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( appendGeorefParam.release() ); - std::unique_ptr exportRDFParam = std::make_unique( QStringLiteral( "INCLUDE_METADATA" ), QObject::tr( "Export RDF metadata (title, author, etc.)" ), true ); + auto exportRDFParam = std::make_unique( QStringLiteral( "INCLUDE_METADATA" ), QObject::tr( "Export RDF metadata (title, author, etc.)" ), true ); exportRDFParam->setFlags( exportRDFParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( exportRDFParam.release() ); - std::unique_ptr antialias = std::make_unique( QStringLiteral( "ANTIALIAS" ), QObject::tr( "Enable antialiasing" ), true ); + auto antialias = std::make_unique( QStringLiteral( "ANTIALIAS" ), QObject::tr( "Enable antialiasing" ), true ); antialias->setFlags( antialias->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( antialias.release() ); diff --git a/src/analysis/processing/qgsalgorithmlayouttopdf.cpp b/src/analysis/processing/qgsalgorithmlayouttopdf.cpp index 855c5b28987a..506c156ffebc 100644 --- a/src/analysis/processing/qgsalgorithmlayouttopdf.cpp +++ b/src/analysis/processing/qgsalgorithmlayouttopdf.cpp @@ -63,35 +63,35 @@ void QgsLayoutToPdfAlgorithm::initAlgorithm( const QVariantMap & ) { addParameter( new QgsProcessingParameterLayout( QStringLiteral( "LAYOUT" ), QObject::tr( "Print layout" ) ) ); - std::unique_ptr layersParam = std::make_unique( QStringLiteral( "LAYERS" ), QObject::tr( "Map layers to assign to unlocked map item(s)" ), Qgis::ProcessingSourceType::MapLayer, QVariant(), true ); + auto layersParam = std::make_unique( QStringLiteral( "LAYERS" ), QObject::tr( "Map layers to assign to unlocked map item(s)" ), Qgis::ProcessingSourceType::MapLayer, QVariant(), true ); layersParam->setFlags( layersParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( layersParam.release() ); - std::unique_ptr dpiParam = std::make_unique( QStringLiteral( "DPI" ), QObject::tr( "DPI (leave blank for default layout DPI)" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 ); + auto dpiParam = std::make_unique( QStringLiteral( "DPI" ), QObject::tr( "DPI (leave blank for default layout DPI)" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 ); dpiParam->setFlags( dpiParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( dpiParam.release() ); - std::unique_ptr forceVectorParam = std::make_unique( QStringLiteral( "FORCE_VECTOR" ), QObject::tr( "Always export as vectors" ), false ); + auto forceVectorParam = std::make_unique( QStringLiteral( "FORCE_VECTOR" ), QObject::tr( "Always export as vectors" ), false ); forceVectorParam->setFlags( forceVectorParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( forceVectorParam.release() ); - std::unique_ptr forceRasterParam = std::make_unique( QStringLiteral( "FORCE_RASTER" ), QObject::tr( "Always export as raster" ), false ); + auto forceRasterParam = std::make_unique( QStringLiteral( "FORCE_RASTER" ), QObject::tr( "Always export as raster" ), false ); forceRasterParam->setFlags( forceRasterParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( forceRasterParam.release() ); - std::unique_ptr appendGeorefParam = std::make_unique( QStringLiteral( "GEOREFERENCE" ), QObject::tr( "Append georeference information" ), true ); + auto appendGeorefParam = std::make_unique( QStringLiteral( "GEOREFERENCE" ), QObject::tr( "Append georeference information" ), true ); appendGeorefParam->setFlags( appendGeorefParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( appendGeorefParam.release() ); - std::unique_ptr exportRDFParam = std::make_unique( QStringLiteral( "INCLUDE_METADATA" ), QObject::tr( "Export RDF metadata (title, author, etc.)" ), true ); + auto exportRDFParam = std::make_unique( QStringLiteral( "INCLUDE_METADATA" ), QObject::tr( "Export RDF metadata (title, author, etc.)" ), true ); exportRDFParam->setFlags( exportRDFParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( exportRDFParam.release() ); - std::unique_ptr disableTiled = std::make_unique( QStringLiteral( "DISABLE_TILED" ), QObject::tr( "Disable tiled raster layer exports" ), false ); + auto disableTiled = std::make_unique( QStringLiteral( "DISABLE_TILED" ), QObject::tr( "Disable tiled raster layer exports" ), false ); disableTiled->setFlags( disableTiled->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( disableTiled.release() ); - std::unique_ptr simplify = std::make_unique( QStringLiteral( "SIMPLIFY" ), QObject::tr( "Simplify geometries to reduce output file size" ), true ); + auto simplify = std::make_unique( QStringLiteral( "SIMPLIFY" ), QObject::tr( "Simplify geometries to reduce output file size" ), true ); simplify->setFlags( simplify->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( simplify.release() ); @@ -101,7 +101,7 @@ void QgsLayoutToPdfAlgorithm::initAlgorithm( const QVariantMap & ) QObject::tr( "Prefer Exporting Text as Text Objects" ) }; - std::unique_ptr textFormat = std::make_unique( QStringLiteral( "TEXT_FORMAT" ), QObject::tr( "Text export" ), textExportOptions, false, 0 ); + auto textFormat = std::make_unique( QStringLiteral( "TEXT_FORMAT" ), QObject::tr( "Text export" ), textExportOptions, false, 0 ); textFormat->setFlags( textFormat->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( textFormat.release() ); @@ -110,11 +110,11 @@ void QgsLayoutToPdfAlgorithm::initAlgorithm( const QVariantMap & ) QObject::tr( "Lossless" ) }; - std::unique_ptr imageCompression = std::make_unique( QStringLiteral( "IMAGE_COMPRESSION" ), QObject::tr( "Image compression" ), imageCompressionOptions, false, 0 ); + auto imageCompression = std::make_unique( QStringLiteral( "IMAGE_COMPRESSION" ), QObject::tr( "Image compression" ), imageCompressionOptions, false, 0 ); imageCompression->setFlags( imageCompression->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( imageCompression.release() ); - std::unique_ptr layeredExport = std::make_unique( QStringLiteral( "SEPARATE_LAYERS" ), QObject::tr( "Export layers as separate PDF files" ), false ); + auto layeredExport = std::make_unique( QStringLiteral( "SEPARATE_LAYERS" ), QObject::tr( "Export layers as separate PDF files" ), false ); layeredExport->setFlags( layeredExport->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( layeredExport.release() ); diff --git a/src/analysis/processing/qgsalgorithmlinedensity.cpp b/src/analysis/processing/qgsalgorithmlinedensity.cpp index 16430aa9c507..5b80afa9a43d 100644 --- a/src/analysis/processing/qgsalgorithmlinedensity.cpp +++ b/src/analysis/processing/qgsalgorithmlinedensity.cpp @@ -54,7 +54,7 @@ void QgsLineDensityAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterDistance( QStringLiteral( "RADIUS" ), QObject::tr( "Search radius" ), 10, QStringLiteral( "INPUT" ), false, 0 ) ); addParameter( new QgsProcessingParameterDistance( QStringLiteral( "PIXEL_SIZE" ), QObject::tr( "Pixel size" ), 10, QStringLiteral( "INPUT" ), false ) ); - std::unique_ptr createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); + auto createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); createOptsParam->setMetadata( QVariantMap( { { QStringLiteral( "widget_wrapper" ), QVariantMap( { { QStringLiteral( "widget_type" ), QStringLiteral( "rasteroptions" ) } } ) } } ) ); createOptsParam->setFlags( createOptsParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( createOptsParam.release() ); @@ -162,7 +162,7 @@ QVariantMap QgsLineDensityAlgorithm::processAlgorithm( const QVariantMap ¶me const qgssize totalCellcnt = static_cast( rows ) * cols; int cellcnt = 0; - std::unique_ptr rasterDataLine = std::make_unique( Qgis::DataType::Float32, cols, 1 ); + auto rasterDataLine = std::make_unique( Qgis::DataType::Float32, cols, 1 ); for ( int row = 0; row < rows; row++ ) { diff --git a/src/analysis/processing/qgsalgorithmlineintersection.cpp b/src/analysis/processing/qgsalgorithmlineintersection.cpp index 4c15e9351ece..52e56ffefbdb 100644 --- a/src/analysis/processing/qgsalgorithmlineintersection.cpp +++ b/src/analysis/processing/qgsalgorithmlineintersection.cpp @@ -64,7 +64,7 @@ void QgsLineIntersectionAlgorithm::initAlgorithm( const QVariantMap & ) true, true ) ); - std::unique_ptr prefix = std::make_unique( QStringLiteral( "INTERSECT_FIELDS_PREFIX" ), QObject::tr( "Intersect fields prefix" ), QString(), false, true ); + auto prefix = std::make_unique( QStringLiteral( "INTERSECT_FIELDS_PREFIX" ), QObject::tr( "Intersect fields prefix" ), QString(), false, true ); prefix->setFlags( prefix->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( prefix.release() ); diff --git a/src/analysis/processing/qgsalgorithmlinesubstring.cpp b/src/analysis/processing/qgsalgorithmlinesubstring.cpp index bb81966bd5ad..cede413e8d96 100644 --- a/src/analysis/processing/qgsalgorithmlinesubstring.cpp +++ b/src/analysis/processing/qgsalgorithmlinesubstring.cpp @@ -83,13 +83,13 @@ QgsLineSubstringAlgorithm *QgsLineSubstringAlgorithm::createInstance() const void QgsLineSubstringAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr startDistance = std::make_unique( QStringLiteral( "START_DISTANCE" ), QObject::tr( "Start distance" ), 0.0, QStringLiteral( "INPUT" ), false, 0 ); + auto startDistance = std::make_unique( QStringLiteral( "START_DISTANCE" ), QObject::tr( "Start distance" ), 0.0, QStringLiteral( "INPUT" ), false, 0 ); startDistance->setIsDynamic( true ); startDistance->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "Start Distance" ), QObject::tr( "Start distance" ), QgsPropertyDefinition::DoublePositive ) ); startDistance->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( startDistance.release() ); - std::unique_ptr endDistance = std::make_unique( QStringLiteral( "END_DISTANCE" ), QObject::tr( "End distance" ), 1.0, QStringLiteral( "INPUT" ), false, 0 ); + auto endDistance = std::make_unique( QStringLiteral( "END_DISTANCE" ), QObject::tr( "End distance" ), 1.0, QStringLiteral( "INPUT" ), false, 0 ); endDistance->setIsDynamic( true ); endDistance->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "End Distance" ), QObject::tr( "End distance" ), QgsPropertyDefinition::DoublePositive ) ); endDistance->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmmeshsurfacetopolygon.cpp b/src/analysis/processing/qgsalgorithmmeshsurfacetopolygon.cpp index 7f1d0a1b8589..88e00407dbbb 100644 --- a/src/analysis/processing/qgsalgorithmmeshsurfacetopolygon.cpp +++ b/src/analysis/processing/qgsalgorithmmeshsurfacetopolygon.cpp @@ -173,7 +173,7 @@ QVariantMap QgsMeshSurfaceToPolygonAlgorithm::processAlgorithm( const QVariantMa feedback->setProgressText( QObject::tr( "Parsing mesh edges." ) ); } - std::unique_ptr multiLineString( new QgsMultiLineString() ); + auto multiLineString = std::make_unique(); int i = 0; for ( auto it = edges.begin(); it != edges.end(); it++ ) @@ -187,7 +187,7 @@ QVariantMap QgsMeshSurfaceToPolygonAlgorithm::processAlgorithm( const QVariantMa // only consider edges with count 1 which are on the edge of mesh surface if ( it.value() == 1 ) { - std::unique_ptr line( new QgsLineString( mNativeMesh.vertex( it.key().first ), mNativeMesh.vertex( it.key().second ) ) ); + auto line = std::make_unique( mNativeMesh.vertex( it.key().first ), mNativeMesh.vertex( it.key().second ) ); multiLineString->addGeometry( line.release() ); } @@ -268,7 +268,7 @@ QVariantMap QgsMeshSurfaceToPolygonAlgorithm::processAlgorithm( const QVariantMa } // create resulting multipolygon - std::unique_ptr multiPolygon = std::make_unique(); + auto multiPolygon = std::make_unique(); multiPolygon->addGeometries( polygons ); if ( feedback ) diff --git a/src/analysis/processing/qgsalgorithmmultiintersection.cpp b/src/analysis/processing/qgsalgorithmmultiintersection.cpp index 7170e0c9ed29..2aa1ce177ec4 100644 --- a/src/analysis/processing/qgsalgorithmmultiintersection.cpp +++ b/src/analysis/processing/qgsalgorithmmultiintersection.cpp @@ -70,7 +70,7 @@ void QgsMultiIntersectionAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ) ) ); addParameter( new QgsProcessingParameterMultipleLayers( QStringLiteral( "OVERLAYS" ), QObject::tr( "Overlay layers" ), Qgis::ProcessingSourceType::VectorAnyGeometry ) ); - std::unique_ptr prefix = std::make_unique( QStringLiteral( "OVERLAY_FIELDS_PREFIX" ), QObject::tr( "Overlay fields prefix" ), QString(), false, true ); + auto prefix = std::make_unique( QStringLiteral( "OVERLAY_FIELDS_PREFIX" ), QObject::tr( "Overlay fields prefix" ), QString(), false, true ); prefix->setFlags( prefix->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( prefix.release() ); diff --git a/src/analysis/processing/qgsalgorithmmultiringconstantbuffer.cpp b/src/analysis/processing/qgsalgorithmmultiringconstantbuffer.cpp index 9c3982503a8b..3a86a939e7d0 100644 --- a/src/analysis/processing/qgsalgorithmmultiringconstantbuffer.cpp +++ b/src/analysis/processing/qgsalgorithmmultiringconstantbuffer.cpp @@ -67,13 +67,13 @@ QgsMultiRingConstantBufferAlgorithm *QgsMultiRingConstantBufferAlgorithm::create void QgsMultiRingConstantBufferAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr rings = std::make_unique( QStringLiteral( "RINGS" ), QObject::tr( "Number of rings" ), Qgis::ProcessingNumberParameterType::Integer, 1, false, 0 ); + auto rings = std::make_unique( QStringLiteral( "RINGS" ), QObject::tr( "Number of rings" ), Qgis::ProcessingNumberParameterType::Integer, 1, false, 0 ); rings->setIsDynamic( true ); rings->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "RINGS" ), QObject::tr( "Number of rings" ), QgsPropertyDefinition::IntegerPositive ) ); rings->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( rings.release() ); - std::unique_ptr distance = std::make_unique( QStringLiteral( "DISTANCE" ), QObject::tr( "Distance between rings" ), 1, QStringLiteral( "INPUT" ), false ); + auto distance = std::make_unique( QStringLiteral( "DISTANCE" ), QObject::tr( "Distance between rings" ), 1, QStringLiteral( "INPUT" ), false ); distance->setIsDynamic( true ); distance->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "DISTANCE" ), QObject::tr( "Distance between rings" ), QgsPropertyDefinition::DoublePositive ) ); distance->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmmultiunion.cpp b/src/analysis/processing/qgsalgorithmmultiunion.cpp index 880df9406b22..63bb82b73e66 100644 --- a/src/analysis/processing/qgsalgorithmmultiunion.cpp +++ b/src/analysis/processing/qgsalgorithmmultiunion.cpp @@ -75,7 +75,7 @@ void QgsMultiUnionAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ) ) ); addParameter( new QgsProcessingParameterMultipleLayers( QStringLiteral( "OVERLAYS" ), QObject::tr( "Overlay layers" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true ) ); - std::unique_ptr prefix = std::make_unique( QStringLiteral( "OVERLAY_FIELDS_PREFIX" ), QObject::tr( "Overlay fields prefix" ), QString(), false, true ); + auto prefix = std::make_unique( QStringLiteral( "OVERLAY_FIELDS_PREFIX" ), QObject::tr( "Overlay fields prefix" ), QString(), false, true ); prefix->setFlags( prefix->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( prefix.release() ); diff --git a/src/analysis/processing/qgsalgorithmnetworkanalysisbase.cpp b/src/analysis/processing/qgsalgorithmnetworkanalysisbase.cpp index fd43274e4eae..b1e21a44c0c8 100644 --- a/src/analysis/processing/qgsalgorithmnetworkanalysisbase.cpp +++ b/src/analysis/processing/qgsalgorithmnetworkanalysisbase.cpp @@ -49,31 +49,31 @@ void QgsNetworkAnalysisAlgorithmBase::addCommonParams() addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Vector layer representing network" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorLine ) ) ); addParameter( new QgsProcessingParameterEnum( QStringLiteral( "STRATEGY" ), QObject::tr( "Path type to calculate" ), QStringList() << QObject::tr( "Shortest" ) << QObject::tr( "Fastest" ), false, 0 ) ); - std::unique_ptr directionField = std::make_unique( QStringLiteral( "DIRECTION_FIELD" ), QObject::tr( "Direction field" ), QVariant(), QStringLiteral( "INPUT" ), Qgis::ProcessingFieldParameterDataType::Any, false, true ); + auto directionField = std::make_unique( QStringLiteral( "DIRECTION_FIELD" ), QObject::tr( "Direction field" ), QVariant(), QStringLiteral( "INPUT" ), Qgis::ProcessingFieldParameterDataType::Any, false, true ); directionField->setFlags( directionField->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( directionField.release() ); - std::unique_ptr forwardValue = std::make_unique( QStringLiteral( "VALUE_FORWARD" ), QObject::tr( "Value for forward direction" ), QVariant(), false, true ); + auto forwardValue = std::make_unique( QStringLiteral( "VALUE_FORWARD" ), QObject::tr( "Value for forward direction" ), QVariant(), false, true ); forwardValue->setFlags( forwardValue->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( forwardValue.release() ); - std::unique_ptr backwardValue = std::make_unique( QStringLiteral( "VALUE_BACKWARD" ), QObject::tr( "Value for backward direction" ), QVariant(), false, true ); + auto backwardValue = std::make_unique( QStringLiteral( "VALUE_BACKWARD" ), QObject::tr( "Value for backward direction" ), QVariant(), false, true ); backwardValue->setFlags( backwardValue->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( backwardValue.release() ); - std::unique_ptr bothValue = std::make_unique( QStringLiteral( "VALUE_BOTH" ), QObject::tr( "Value for both directions" ), QVariant(), false, true ); + auto bothValue = std::make_unique( QStringLiteral( "VALUE_BOTH" ), QObject::tr( "Value for both directions" ), QVariant(), false, true ); bothValue->setFlags( bothValue->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( bothValue.release() ); - std::unique_ptr directionValue = std::make_unique( QStringLiteral( "DEFAULT_DIRECTION" ), QObject::tr( "Default direction" ), QStringList() << QObject::tr( "Forward direction" ) << QObject::tr( "Backward direction" ) << QObject::tr( "Both directions" ), false, 2 ); + auto directionValue = std::make_unique( QStringLiteral( "DEFAULT_DIRECTION" ), QObject::tr( "Default direction" ), QStringList() << QObject::tr( "Forward direction" ) << QObject::tr( "Backward direction" ) << QObject::tr( "Both directions" ), false, 2 ); directionValue->setFlags( directionValue->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( directionValue.release() ); - std::unique_ptr speedField = std::make_unique( QStringLiteral( "SPEED_FIELD" ), QObject::tr( "Speed field" ), QVariant(), QStringLiteral( "INPUT" ), Qgis::ProcessingFieldParameterDataType::Numeric, false, true ); + auto speedField = std::make_unique( QStringLiteral( "SPEED_FIELD" ), QObject::tr( "Speed field" ), QVariant(), QStringLiteral( "INPUT" ), Qgis::ProcessingFieldParameterDataType::Numeric, false, true ); speedField->setFlags( speedField->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( speedField.release() ); - std::unique_ptr speed = std::make_unique( QStringLiteral( "DEFAULT_SPEED" ), QObject::tr( "Default speed (km/h)" ), Qgis::ProcessingNumberParameterType::Double, 50, false, 0 ); + auto speed = std::make_unique( QStringLiteral( "DEFAULT_SPEED" ), QObject::tr( "Default speed (km/h)" ), Qgis::ProcessingNumberParameterType::Double, 50, false, 0 ); speed->setFlags( speed->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( speed.release() ); diff --git a/src/analysis/processing/qgsalgorithmoffsetlines.cpp b/src/analysis/processing/qgsalgorithmoffsetlines.cpp index 34b9f0c37293..31146ca06621 100644 --- a/src/analysis/processing/qgsalgorithmoffsetlines.cpp +++ b/src/analysis/processing/qgsalgorithmoffsetlines.cpp @@ -82,7 +82,7 @@ QgsOffsetLinesAlgorithm *QgsOffsetLinesAlgorithm::createInstance() const void QgsOffsetLinesAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr offset = std::make_unique( QStringLiteral( "DISTANCE" ), QObject::tr( "Distance" ), 10.0, QStringLiteral( "INPUT" ) ); + auto offset = std::make_unique( QStringLiteral( "DISTANCE" ), QObject::tr( "Distance" ), 10.0, QStringLiteral( "INPUT" ) ); offset->setIsDynamic( true ); offset->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "DISTANCE" ), QObject::tr( "Distance" ), QgsPropertyDefinition::Double ) ); offset->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmorderbyexpression.cpp b/src/analysis/processing/qgsalgorithmorderbyexpression.cpp index e81533ef13b1..445fa402ae17 100644 --- a/src/analysis/processing/qgsalgorithmorderbyexpression.cpp +++ b/src/analysis/processing/qgsalgorithmorderbyexpression.cpp @@ -65,6 +65,11 @@ QString QgsOrderByExpressionAlgorithm::shortHelpString() const "which is available in the expression builder." ); } +Qgis::ProcessingAlgorithmDocumentationFlags QgsOrderByExpressionAlgorithm::documentationFlags() const +{ + return Qgis::ProcessingAlgorithmDocumentationFlag::RegeneratesPrimaryKey; +} + QgsOrderByExpressionAlgorithm *QgsOrderByExpressionAlgorithm::createInstance() const { return new QgsOrderByExpressionAlgorithm(); @@ -82,7 +87,7 @@ QVariantMap QgsOrderByExpressionAlgorithm::processAlgorithm( const QVariantMap & const bool nullsFirst = parameterAsBoolean( parameters, QStringLiteral( "NULLS_FIRST" ), context ); QString sinkId; - std::unique_ptr sink( parameterAsSink( parameters, QStringLiteral( "OUTPUT" ), context, sinkId, source->fields(), source->wkbType(), source->sourceCrs() ) ); + std::unique_ptr sink( parameterAsSink( parameters, QStringLiteral( "OUTPUT" ), context, sinkId, source->fields(), source->wkbType(), source->sourceCrs(), QgsFeatureSink::RegeneratePrimaryKey ) ); if ( !sink ) throw QgsProcessingException( invalidSinkError( parameters, QStringLiteral( "OUTPUT" ) ) ); diff --git a/src/analysis/processing/qgsalgorithmorderbyexpression.h b/src/analysis/processing/qgsalgorithmorderbyexpression.h index a13c511e0a60..08763fa664df 100644 --- a/src/analysis/processing/qgsalgorithmorderbyexpression.h +++ b/src/analysis/processing/qgsalgorithmorderbyexpression.h @@ -40,6 +40,7 @@ class QgsOrderByExpressionAlgorithm : public QgsProcessingAlgorithm QString group() const override; QString groupId() const override; QString shortHelpString() const override; + Qgis::ProcessingAlgorithmDocumentationFlags documentationFlags() const override; QgsOrderByExpressionAlgorithm *createInstance() const override SIP_FACTORY; protected: diff --git a/src/analysis/processing/qgsalgorithmorthogonalize.cpp b/src/analysis/processing/qgsalgorithmorthogonalize.cpp index 0ddc60602a43..8e1be3dfbf57 100644 --- a/src/analysis/processing/qgsalgorithmorthogonalize.cpp +++ b/src/analysis/processing/qgsalgorithmorthogonalize.cpp @@ -85,7 +85,7 @@ void QgsOrthogonalizeAlgorithm::initParameters( const QVariantMap & ) angleToleranceParam->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( angleToleranceParam.release() ); - std::unique_ptr maxIterations = std::make_unique( + auto maxIterations = std::make_unique( QStringLiteral( "MAX_ITERATIONS" ), QObject::tr( "Maximum algorithm iterations" ), Qgis::ProcessingNumberParameterType::Integer, diff --git a/src/analysis/processing/qgsalgorithmpackage.cpp b/src/analysis/processing/qgsalgorithmpackage.cpp index 1260fdfff64c..673072987999 100644 --- a/src/analysis/processing/qgsalgorithmpackage.cpp +++ b/src/analysis/processing/qgsalgorithmpackage.cpp @@ -457,7 +457,7 @@ bool QgsPackageAlgorithm::packageVectorLayer( QgsVectorLayer *layer, const QStri { if ( saveStyles ) { - std::unique_ptr res = std::make_unique( QStringLiteral( "%1|layername=%2" ).arg( newFilename, newLayer ) ); + auto res = std::make_unique( QStringLiteral( "%1|layername=%2" ).arg( newFilename, newLayer ) ); if ( res ) { QString errorMsg; diff --git a/src/analysis/processing/qgsalgorithmpixelcentroidsfrompolygons.cpp b/src/analysis/processing/qgsalgorithmpixelcentroidsfrompolygons.cpp index 33a61358c60e..db9957db8905 100644 --- a/src/analysis/processing/qgsalgorithmpixelcentroidsfrompolygons.cpp +++ b/src/analysis/processing/qgsalgorithmpixelcentroidsfrompolygons.cpp @@ -130,7 +130,7 @@ QVariantMap QgsPixelCentroidsFromPolygonsAlgorithm::processAlgorithm( const QVar QgsRasterAnalysisUtils::mapToPixel( xMin, yMax, extent, xPixel, yPixel, startRow, startColumn ); QgsRasterAnalysisUtils::mapToPixel( xMax, yMin, extent, xPixel, yPixel, endRow, endColumn ); - std::unique_ptr engine = std::make_unique( f.geometry().constGet() ); + auto engine = std::make_unique( f.geometry().constGet() ); engine->prepareGeometry(); for ( int row = startRow; row <= endRow; row++ ) diff --git a/src/analysis/processing/qgsalgorithmpointonsurface.cpp b/src/analysis/processing/qgsalgorithmpointonsurface.cpp index 6fc6eceb1ef1..9f771350d602 100644 --- a/src/analysis/processing/qgsalgorithmpointonsurface.cpp +++ b/src/analysis/processing/qgsalgorithmpointonsurface.cpp @@ -75,7 +75,7 @@ QgsPointOnSurfaceAlgorithm *QgsPointOnSurfaceAlgorithm::createInstance() const void QgsPointOnSurfaceAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr allParts = std::make_unique( + auto allParts = std::make_unique( QStringLiteral( "ALL_PARTS" ), QObject::tr( "Create point on surface for each part" ), false diff --git a/src/analysis/processing/qgsalgorithmpointsalonggeometry.cpp b/src/analysis/processing/qgsalgorithmpointsalonggeometry.cpp index 938e2071b08f..7c4d8f372b23 100644 --- a/src/analysis/processing/qgsalgorithmpointsalonggeometry.cpp +++ b/src/analysis/processing/qgsalgorithmpointsalonggeometry.cpp @@ -106,19 +106,19 @@ QgsPointsAlongGeometryAlgorithm *QgsPointsAlongGeometryAlgorithm::createInstance void QgsPointsAlongGeometryAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr distance = std::make_unique( QStringLiteral( "DISTANCE" ), QObject::tr( "Distance" ), 1.0, QStringLiteral( "INPUT" ), false, 0 ); + auto distance = std::make_unique( QStringLiteral( "DISTANCE" ), QObject::tr( "Distance" ), 1.0, QStringLiteral( "INPUT" ), false, 0 ); distance->setIsDynamic( true ); distance->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "DISTANCE" ), QObject::tr( "Distance" ), QgsPropertyDefinition::DoublePositive ) ); distance->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( distance.release() ); - std::unique_ptr startOffset = std::make_unique( QStringLiteral( "START_OFFSET" ), QObject::tr( "Start offset" ), 0.0, QStringLiteral( "INPUT" ), false, 0 ); + auto startOffset = std::make_unique( QStringLiteral( "START_OFFSET" ), QObject::tr( "Start offset" ), 0.0, QStringLiteral( "INPUT" ), false, 0 ); startOffset->setIsDynamic( true ); startOffset->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "START_OFFSET" ), QObject::tr( "Start offset" ), QgsPropertyDefinition::DoublePositive ) ); startOffset->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( startOffset.release() ); - std::unique_ptr endOffset = std::make_unique( QStringLiteral( "END_OFFSET" ), QObject::tr( "End offset" ), 0.0, QStringLiteral( "INPUT" ), false, 0 ); + auto endOffset = std::make_unique( QStringLiteral( "END_OFFSET" ), QObject::tr( "End offset" ), 0.0, QStringLiteral( "INPUT" ), false, 0 ); endOffset->setIsDynamic( true ); endOffset->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "END_OFFSET" ), QObject::tr( "End offset" ), QgsPropertyDefinition::DoublePositive ) ); endOffset->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmprojectpointcartesian.cpp b/src/analysis/processing/qgsalgorithmprojectpointcartesian.cpp index e0cf842d702e..63f2234c8791 100644 --- a/src/analysis/processing/qgsalgorithmprojectpointcartesian.cpp +++ b/src/analysis/processing/qgsalgorithmprojectpointcartesian.cpp @@ -73,13 +73,13 @@ QgsProjectPointCartesianAlgorithm *QgsProjectPointCartesianAlgorithm::createInst void QgsProjectPointCartesianAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr bearing = std::make_unique( QStringLiteral( "BEARING" ), QObject::tr( "Bearing (degrees from North)" ), Qgis::ProcessingNumberParameterType::Double, 0, false ); + auto bearing = std::make_unique( QStringLiteral( "BEARING" ), QObject::tr( "Bearing (degrees from North)" ), Qgis::ProcessingNumberParameterType::Double, 0, false ); bearing->setIsDynamic( true ); bearing->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "Bearing" ), QObject::tr( "Bearing (degrees from North)" ), QgsPropertyDefinition::Double ) ); bearing->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( bearing.release() ); - std::unique_ptr distance = std::make_unique( QStringLiteral( "DISTANCE" ), QObject::tr( "Distance" ), 1, QStringLiteral( "INPUT" ), false ); + auto distance = std::make_unique( QStringLiteral( "DISTANCE" ), QObject::tr( "Distance" ), 1, QStringLiteral( "INPUT" ), false ); distance->setIsDynamic( true ); distance->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "Distance" ), QObject::tr( "Projection distance" ), QgsPropertyDefinition::Double ) ); distance->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); @@ -122,7 +122,7 @@ QgsFeatureList QgsProjectPointCartesianAlgorithm::processFeature( const QgsFeatu if ( QgsWkbTypes::isMultiType( g.wkbType() ) ) { const QgsMultiPoint *mp = static_cast( g.constGet() ); - std::unique_ptr result = std::make_unique(); + auto result = std::make_unique(); result->reserve( mp->numGeometries() ); for ( int i = 0; i < mp->numGeometries(); ++i ) { diff --git a/src/analysis/processing/qgsalgorithmrandompointsextent.cpp b/src/analysis/processing/qgsalgorithmrandompointsextent.cpp index d6ea62de360d..733713c52470 100644 --- a/src/analysis/processing/qgsalgorithmrandompointsextent.cpp +++ b/src/analysis/processing/qgsalgorithmrandompointsextent.cpp @@ -56,7 +56,7 @@ void QgsRandomPointsExtentAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterDistance( QStringLiteral( "MIN_DISTANCE" ), QObject::tr( "Minimum distance between points" ), 0, QStringLiteral( "TARGET_CRS" ), true, 0 ) ); addParameter( new QgsProcessingParameterCrs( QStringLiteral( "TARGET_CRS" ), QObject::tr( "Target CRS" ), QStringLiteral( "ProjectCrs" ), false ) ); - std::unique_ptr maxAttempts_param = std::make_unique( QStringLiteral( "MAX_ATTEMPTS" ), QObject::tr( "Maximum number of search attempts given the minimum distance" ), Qgis::ProcessingNumberParameterType::Integer, 200, true, 1 ); + auto maxAttempts_param = std::make_unique( QStringLiteral( "MAX_ATTEMPTS" ), QObject::tr( "Maximum number of search attempts given the minimum distance" ), Qgis::ProcessingNumberParameterType::Integer, 200, true, 1 ); maxAttempts_param->setFlags( maxAttempts_param->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( maxAttempts_param.release() ); diff --git a/src/analysis/processing/qgsalgorithmrandompointsinpolygons.cpp b/src/analysis/processing/qgsalgorithmrandompointsinpolygons.cpp index 130fcd3c8edf..24da31a07e0d 100644 --- a/src/analysis/processing/qgsalgorithmrandompointsinpolygons.cpp +++ b/src/analysis/processing/qgsalgorithmrandompointsinpolygons.cpp @@ -51,34 +51,34 @@ QString QgsRandomPointsInPolygonsAlgorithm::groupId() const void QgsRandomPointsInPolygonsAlgorithm::initAlgorithm( const QVariantMap & ) { addParameter( new QgsProcessingParameterFeatureSource( INPUT, QObject::tr( "Input polygon layer" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorPolygon ) ) ); - std::unique_ptr numberPointsParam = std::make_unique( POINTS_NUMBER, QObject::tr( "Number of points for each feature" ), Qgis::ProcessingNumberParameterType::Integer, 1, false, 1 ); + auto numberPointsParam = std::make_unique( POINTS_NUMBER, QObject::tr( "Number of points for each feature" ), Qgis::ProcessingNumberParameterType::Integer, 1, false, 1 ); numberPointsParam->setIsDynamic( true ); numberPointsParam->setDynamicPropertyDefinition( QgsPropertyDefinition( POINTS_NUMBER, QObject::tr( "Number of points for each feature" ), QgsPropertyDefinition::IntegerPositive ) ); numberPointsParam->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( numberPointsParam.release() ); - std::unique_ptr minDistParam = std::make_unique( MIN_DISTANCE, QObject::tr( "Minimum distance between points" ), 0, INPUT, true, 0 ); + auto minDistParam = std::make_unique( MIN_DISTANCE, QObject::tr( "Minimum distance between points" ), 0, INPUT, true, 0 ); minDistParam->setIsDynamic( true ); minDistParam->setDynamicPropertyDefinition( QgsPropertyDefinition( MIN_DISTANCE, QObject::tr( "Minimum distance between points" ), QgsPropertyDefinition::DoublePositive ) ); minDistParam->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( minDistParam.release() ); - std::unique_ptr minDistGlobalParam = std::make_unique( MIN_DISTANCE_GLOBAL, QObject::tr( "Global minimum distance between points" ), 0, INPUT, true, 0 ); + auto minDistGlobalParam = std::make_unique( MIN_DISTANCE_GLOBAL, QObject::tr( "Global minimum distance between points" ), 0, INPUT, true, 0 ); minDistGlobalParam->setFlags( minDistGlobalParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( minDistGlobalParam.release() ); - std::unique_ptr maxAttemptsParam = std::make_unique( MAX_TRIES_PER_POINT, QObject::tr( "Maximum number of search attempts (for Min. dist. > 0)" ), Qgis::ProcessingNumberParameterType::Integer, 10, true, 1 ); + auto maxAttemptsParam = std::make_unique( MAX_TRIES_PER_POINT, QObject::tr( "Maximum number of search attempts (for Min. dist. > 0)" ), Qgis::ProcessingNumberParameterType::Integer, 10, true, 1 ); maxAttemptsParam->setFlags( maxAttemptsParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); maxAttemptsParam->setIsDynamic( true ); maxAttemptsParam->setDynamicPropertyDefinition( QgsPropertyDefinition( MAX_TRIES_PER_POINT, QObject::tr( "Maximum number of attempts per point (for Min. dist. > 0)" ), QgsPropertyDefinition::IntegerPositiveGreaterZero ) ); maxAttemptsParam->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( maxAttemptsParam.release() ); - std::unique_ptr randomSeedParam = std::make_unique( SEED, QObject::tr( "Random seed" ), Qgis::ProcessingNumberParameterType::Integer, QVariant(), true, 1 ); + auto randomSeedParam = std::make_unique( SEED, QObject::tr( "Random seed" ), Qgis::ProcessingNumberParameterType::Integer, QVariant(), true, 1 ); randomSeedParam->setFlags( randomSeedParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( randomSeedParam.release() ); - std::unique_ptr includePolygonAttrParam = std::make_unique( INCLUDE_POLYGON_ATTRIBUTES, QObject::tr( "Include polygon attributes" ), true ); + auto includePolygonAttrParam = std::make_unique( INCLUDE_POLYGON_ATTRIBUTES, QObject::tr( "Include polygon attributes" ), true ); includePolygonAttrParam->setFlags( includePolygonAttrParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( includePolygonAttrParam.release() ); diff --git a/src/analysis/processing/qgsalgorithmrandompointsonlines.cpp b/src/analysis/processing/qgsalgorithmrandompointsonlines.cpp index fa7fdac9a525..475c3da536a6 100644 --- a/src/analysis/processing/qgsalgorithmrandompointsonlines.cpp +++ b/src/analysis/processing/qgsalgorithmrandompointsonlines.cpp @@ -51,34 +51,34 @@ QString QgsRandomPointsOnLinesAlgorithm::groupId() const void QgsRandomPointsOnLinesAlgorithm::initAlgorithm( const QVariantMap & ) { addParameter( new QgsProcessingParameterFeatureSource( INPUT, QObject::tr( "Input line layer" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorLine ) ) ); - std::unique_ptr numberPointsParam = std::make_unique( POINTS_NUMBER, QObject::tr( "Number of points for each feature" ), Qgis::ProcessingNumberParameterType::Integer, 1, false, 1 ); + auto numberPointsParam = std::make_unique( POINTS_NUMBER, QObject::tr( "Number of points for each feature" ), Qgis::ProcessingNumberParameterType::Integer, 1, false, 1 ); numberPointsParam->setIsDynamic( true ); numberPointsParam->setDynamicPropertyDefinition( QgsPropertyDefinition( POINTS_NUMBER, QObject::tr( "Number of points for each feature" ), QgsPropertyDefinition::IntegerPositive ) ); numberPointsParam->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( numberPointsParam.release() ); - std::unique_ptr minDistParam = std::make_unique( MIN_DISTANCE, QObject::tr( "Minimum distance between points" ), 0, INPUT, true, 0 ); + auto minDistParam = std::make_unique( MIN_DISTANCE, QObject::tr( "Minimum distance between points" ), 0, INPUT, true, 0 ); minDistParam->setIsDynamic( true ); minDistParam->setDynamicPropertyDefinition( QgsPropertyDefinition( MIN_DISTANCE, QObject::tr( "Minimum distance between points (per feature)" ), QgsPropertyDefinition::DoublePositive ) ); minDistParam->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( minDistParam.release() ); - std::unique_ptr minDistGlobalParam = std::make_unique( MIN_DISTANCE_GLOBAL, QObject::tr( "Global minimum distance between points" ), 0, INPUT, true, 0 ); + auto minDistGlobalParam = std::make_unique( MIN_DISTANCE_GLOBAL, QObject::tr( "Global minimum distance between points" ), 0, INPUT, true, 0 ); minDistGlobalParam->setFlags( minDistGlobalParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( minDistGlobalParam.release() ); - std::unique_ptr maxAttemptsParam = std::make_unique( MAX_TRIES_PER_POINT, QObject::tr( "Maximum number of search attempts (for Min. dist. > 0)" ), Qgis::ProcessingNumberParameterType::Integer, 10, true, 1 ); + auto maxAttemptsParam = std::make_unique( MAX_TRIES_PER_POINT, QObject::tr( "Maximum number of search attempts (for Min. dist. > 0)" ), Qgis::ProcessingNumberParameterType::Integer, 10, true, 1 ); maxAttemptsParam->setFlags( maxAttemptsParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); maxAttemptsParam->setIsDynamic( true ); maxAttemptsParam->setDynamicPropertyDefinition( QgsPropertyDefinition( MAX_TRIES_PER_POINT, QObject::tr( "Maximum number of search attempts (for Min. dist. > 0)" ), QgsPropertyDefinition::IntegerPositiveGreaterZero ) ); maxAttemptsParam->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( maxAttemptsParam.release() ); - std::unique_ptr randomSeedParam = std::make_unique( SEED, QObject::tr( "Random seed" ), Qgis::ProcessingNumberParameterType::Integer, QVariant(), true, 1 ); + auto randomSeedParam = std::make_unique( SEED, QObject::tr( "Random seed" ), Qgis::ProcessingNumberParameterType::Integer, QVariant(), true, 1 ); randomSeedParam->setFlags( randomSeedParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( randomSeedParam.release() ); - std::unique_ptr includeLineAttrParam = std::make_unique( INCLUDE_LINE_ATTRIBUTES, QObject::tr( "Include line attributes" ), true ); + auto includeLineAttrParam = std::make_unique( INCLUDE_LINE_ATTRIBUTES, QObject::tr( "Include line attributes" ), true ); includeLineAttrParam->setFlags( includeLineAttrParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( includeLineAttrParam.release() ); diff --git a/src/analysis/processing/qgsalgorithmrandomraster.cpp b/src/analysis/processing/qgsalgorithmrandomraster.cpp index a5b501e783ce..01769b54a0a2 100644 --- a/src/analysis/processing/qgsalgorithmrandomraster.cpp +++ b/src/analysis/processing/qgsalgorithmrandomraster.cpp @@ -45,7 +45,7 @@ void QgsRandomRasterAlgorithmBase::initAlgorithm( const QVariantMap & ) //add specific parameters addAlgorithmParams(); - std::unique_ptr createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); + auto createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); createOptsParam->setMetadata( QVariantMap( { { QStringLiteral( "widget_wrapper" ), QVariantMap( { { QStringLiteral( "widget_type" ), QStringLiteral( "rasteroptions" ) } } ) } } ) ); createOptsParam->setFlags( createOptsParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( createOptsParam.release() ); @@ -90,7 +90,7 @@ QVariantMap QgsRandomRasterAlgorithmBase::processAlgorithm( const QVariantMap &p //this prevents output cellsize being calculated too small const QgsRectangle rasterExtent = QgsRectangle( mExtent.xMinimum(), mExtent.yMaximum() - ( rows * mPixelSize ), mExtent.xMinimum() + ( cols * mPixelSize ), mExtent.yMaximum() ); - std::unique_ptr writer = std::make_unique( outputFile ); + auto writer = std::make_unique( outputFile ); writer->setOutputProviderKey( QStringLiteral( "gdal" ) ); if ( !createOptions.isEmpty() ) { @@ -260,11 +260,11 @@ void QgsRandomUniformRasterAlgorithm::addAlgorithmParams() rasterTypeParameter->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( rasterTypeParameter.release() ); - std::unique_ptr lowerBoundParameter = std::make_unique( QStringLiteral( "LOWER_BOUND" ), QStringLiteral( "Lower bound for random number range" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true ); + auto lowerBoundParameter = std::make_unique( QStringLiteral( "LOWER_BOUND" ), QStringLiteral( "Lower bound for random number range" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true ); lowerBoundParameter->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( lowerBoundParameter.release() ); - std::unique_ptr upperBoundParameter = std::make_unique( QStringLiteral( "UPPER_BOUND" ), QStringLiteral( "Upper bound for random number range" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true ); + auto upperBoundParameter = std::make_unique( QStringLiteral( "UPPER_BOUND" ), QStringLiteral( "Upper bound for random number range" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true ); upperBoundParameter->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( upperBoundParameter.release() ); } @@ -451,11 +451,11 @@ void QgsRandomBinomialRasterAlgorithm::addAlgorithmParams() rasterTypeParameter->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( rasterTypeParameter.release() ); - std::unique_ptr nParameter = std::make_unique( QStringLiteral( "N" ), QStringLiteral( "N" ), Qgis::ProcessingNumberParameterType::Integer, 10, true, 0 ); + auto nParameter = std::make_unique( QStringLiteral( "N" ), QStringLiteral( "N" ), Qgis::ProcessingNumberParameterType::Integer, 10, true, 0 ); nParameter->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( nParameter.release() ); - std::unique_ptr probabilityParameter = std::make_unique( QStringLiteral( "PROBABILITY" ), QStringLiteral( "Probability" ), Qgis::ProcessingNumberParameterType::Double, 0.5, true, 0 ); + auto probabilityParameter = std::make_unique( QStringLiteral( "PROBABILITY" ), QStringLiteral( "Probability" ), Qgis::ProcessingNumberParameterType::Double, 0.5, true, 0 ); probabilityParameter->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( probabilityParameter.release() ); } @@ -543,7 +543,7 @@ void QgsRandomExponentialRasterAlgorithm::addAlgorithmParams() rasterTypeParameter->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( rasterTypeParameter.release() ); - std::unique_ptr lambdaParameter = std::make_unique( QStringLiteral( "LAMBDA" ), QStringLiteral( "Lambda" ), Qgis::ProcessingNumberParameterType::Double, 1.0, true, 0.000001 ); + auto lambdaParameter = std::make_unique( QStringLiteral( "LAMBDA" ), QStringLiteral( "Lambda" ), Qgis::ProcessingNumberParameterType::Double, 1.0, true, 0.000001 ); lambdaParameter->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( lambdaParameter.release() ); } @@ -622,11 +622,11 @@ void QgsRandomGammaRasterAlgorithm::addAlgorithmParams() rasterTypeParameter->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( rasterTypeParameter.release() ); - std::unique_ptr alphaParameter = std::make_unique( QStringLiteral( "ALPHA" ), QStringLiteral( "Alpha" ), Qgis::ProcessingNumberParameterType::Double, 1.0, true, 0.000001 ); + auto alphaParameter = std::make_unique( QStringLiteral( "ALPHA" ), QStringLiteral( "Alpha" ), Qgis::ProcessingNumberParameterType::Double, 1.0, true, 0.000001 ); alphaParameter->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( alphaParameter.release() ); - std::unique_ptr betaParameter = std::make_unique( QStringLiteral( "BETA" ), QStringLiteral( "Beta" ), Qgis::ProcessingNumberParameterType::Double, 1.0, true, 0.000001 ); + auto betaParameter = std::make_unique( QStringLiteral( "BETA" ), QStringLiteral( "Beta" ), Qgis::ProcessingNumberParameterType::Double, 1.0, true, 0.000001 ); betaParameter->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( betaParameter.release() ); } @@ -712,7 +712,7 @@ void QgsRandomGeometricRasterAlgorithm::addAlgorithmParams() rasterTypeParameter->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( rasterTypeParameter.release() ); - std::unique_ptr probabilityParameter = std::make_unique( QStringLiteral( "PROBABILITY" ), QStringLiteral( "Probability" ), Qgis::ProcessingNumberParameterType::Double, 0.5, true, 0.00001 ); + auto probabilityParameter = std::make_unique( QStringLiteral( "PROBABILITY" ), QStringLiteral( "Probability" ), Qgis::ProcessingNumberParameterType::Double, 0.5, true, 0.00001 ); probabilityParameter->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( probabilityParameter.release() ); } @@ -806,11 +806,11 @@ void QgsRandomNegativeBinomialRasterAlgorithm::addAlgorithmParams() rasterTypeParameter->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( rasterTypeParameter.release() ); - std::unique_ptr kParameter = std::make_unique( QStringLiteral( "K_PARAMETER" ), QStringLiteral( "Distribution parameter k" ), Qgis::ProcessingNumberParameterType::Integer, 10, true, 0.00001 ); + auto kParameter = std::make_unique( QStringLiteral( "K_PARAMETER" ), QStringLiteral( "Distribution parameter k" ), Qgis::ProcessingNumberParameterType::Integer, 10, true, 0.00001 ); kParameter->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( kParameter.release() ); - std::unique_ptr probabilityParameter = std::make_unique( QStringLiteral( "PROBABILITY" ), QStringLiteral( "Probability" ), Qgis::ProcessingNumberParameterType::Double, 0.5, true, 0.00001 ); + auto probabilityParameter = std::make_unique( QStringLiteral( "PROBABILITY" ), QStringLiteral( "Probability" ), Qgis::ProcessingNumberParameterType::Double, 0.5, true, 0.00001 ); probabilityParameter->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( probabilityParameter.release() ); } @@ -898,11 +898,11 @@ void QgsRandomNormalRasterAlgorithm::addAlgorithmParams() rasterTypeParameter->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( rasterTypeParameter.release() ); - std::unique_ptr meanParameter = std::make_unique( QStringLiteral( "MEAN" ), QStringLiteral( "Mean of normal distribution" ), Qgis::ProcessingNumberParameterType::Double, 0, true ); + auto meanParameter = std::make_unique( QStringLiteral( "MEAN" ), QStringLiteral( "Mean of normal distribution" ), Qgis::ProcessingNumberParameterType::Double, 0, true ); meanParameter->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( meanParameter.release() ); - std::unique_ptr stdevParameter = std::make_unique( QStringLiteral( "STDDEV" ), QStringLiteral( "Standard deviation of normal distribution" ), Qgis::ProcessingNumberParameterType::Double, 1, true, 0 ); + auto stdevParameter = std::make_unique( QStringLiteral( "STDDEV" ), QStringLiteral( "Standard deviation of normal distribution" ), Qgis::ProcessingNumberParameterType::Double, 1, true, 0 ); stdevParameter->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( stdevParameter.release() ); } @@ -987,7 +987,7 @@ void QgsRandomPoissonRasterAlgorithm::addAlgorithmParams() rasterTypeParameter->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( rasterTypeParameter.release() ); - std::unique_ptr upperBoundParameter = std::make_unique( QStringLiteral( "MEAN" ), QStringLiteral( "Mean" ), Qgis::ProcessingNumberParameterType::Double, 1.0, true, 0 ); + auto upperBoundParameter = std::make_unique( QStringLiteral( "MEAN" ), QStringLiteral( "Mean" ), Qgis::ProcessingNumberParameterType::Double, 1.0, true, 0 ); upperBoundParameter->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( upperBoundParameter.release() ); } diff --git a/src/analysis/processing/qgsalgorithmrastercalculator.cpp b/src/analysis/processing/qgsalgorithmrastercalculator.cpp index f51acd1501e3..f52bd796fbd4 100644 --- a/src/analysis/processing/qgsalgorithmrastercalculator.cpp +++ b/src/analysis/processing/qgsalgorithmrastercalculator.cpp @@ -65,13 +65,13 @@ void QgsRasterCalculatorAlgorithm::initAlgorithm( const QVariantMap & ) { addParameter( new QgsProcessingParameterMultipleLayers( QStringLiteral( "LAYERS" ), QObject::tr( "Input layers" ), Qgis::ProcessingSourceType::Raster ) ); addParameter( new QgsProcessingParameterExpression( QStringLiteral( "EXPRESSION" ), QObject::tr( "Expression" ), QVariant(), QStringLiteral( "LAYERS" ), false, Qgis::ExpressionType::RasterCalculator ) ); - std::unique_ptr extentParam = std::make_unique( QStringLiteral( "EXTENT" ), QObject::tr( "Output extent" ), QVariant(), true ); + auto extentParam = std::make_unique( QStringLiteral( "EXTENT" ), QObject::tr( "Output extent" ), QVariant(), true ); extentParam->setHelp( QObject::tr( "Extent of the output layer. If not specified, the extent will be the overall extent of all input layers" ) ); addParameter( extentParam.release() ); - std::unique_ptr cellSizeParam = std::make_unique( QStringLiteral( "CELL_SIZE" ), QObject::tr( "Output cell size (leave empty to set automatically)" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0.0 ); + auto cellSizeParam = std::make_unique( QStringLiteral( "CELL_SIZE" ), QObject::tr( "Output cell size (leave empty to set automatically)" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0.0 ); cellSizeParam->setHelp( QObject::tr( "Cell size of the output layer. If not specified, the smallest cell size from the input layers will be used" ) ); addParameter( cellSizeParam.release() ); - std::unique_ptr crsParam = std::make_unique( QStringLiteral( "CRS" ), QObject::tr( "Output CRS" ), QVariant(), true ); + auto crsParam = std::make_unique( QStringLiteral( "CRS" ), QObject::tr( "Output CRS" ), QVariant(), true ); crsParam->setHelp( QObject::tr( "CRS of the output layer. If not specified, the CRS of the first input layer will be used" ) ); addParameter( crsParam.release() ); addParameter( new QgsProcessingParameterRasterDestination( QStringLiteral( "OUTPUT" ), QObject::tr( "Calculated" ) ) ); diff --git a/src/analysis/processing/qgsalgorithmrasterdtmslopebasedfilter.cpp b/src/analysis/processing/qgsalgorithmrasterdtmslopebasedfilter.cpp index de979302fd53..1dc998736003 100644 --- a/src/analysis/processing/qgsalgorithmrasterdtmslopebasedfilter.cpp +++ b/src/analysis/processing/qgsalgorithmrasterdtmslopebasedfilter.cpp @@ -69,32 +69,32 @@ void QgsRasterDtmSlopeBasedFilterAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterBand( QStringLiteral( "BAND" ), QObject::tr( "Band number" ), 1, QStringLiteral( "INPUT" ) ) ); - std::unique_ptr radiusParam = std::make_unique( QStringLiteral( "RADIUS" ), QObject::tr( "Kernel radius (pixels)" ), Qgis::ProcessingNumberParameterType::Integer, 5, false, 1, 1000 ); + auto radiusParam = std::make_unique( QStringLiteral( "RADIUS" ), QObject::tr( "Kernel radius (pixels)" ), Qgis::ProcessingNumberParameterType::Integer, 5, false, 1, 1000 ); radiusParam->setHelp( QObject::tr( "The radius of the filter kernel (in pixels). Must be large enough to reach ground cells next to non-ground objects." ) ); addParameter( radiusParam.release() ); - std::unique_ptr terrainSlopeParam = std::make_unique( QStringLiteral( "TERRAIN_SLOPE" ), QObject::tr( "Terrain slope (%, pixel size/vertical units)" ), Qgis::ProcessingNumberParameterType::Double, 30, false, 0, 1000 ); + auto terrainSlopeParam = std::make_unique( QStringLiteral( "TERRAIN_SLOPE" ), QObject::tr( "Terrain slope (%, pixel size/vertical units)" ), Qgis::ProcessingNumberParameterType::Double, 30, false, 0, 1000 ); terrainSlopeParam->setHelp( QObject::tr( "The approximate terrain slope in %. The terrain slope must be adjusted to account for the ratio of height units vs raster pixel dimensions. Used to relax the filter criterium in steeper terrain." ) ); addParameter( terrainSlopeParam.release() ); - std::unique_ptr filterModificationParam = std::make_unique( QStringLiteral( "FILTER_MODIFICATION" ), QObject::tr( "Filter modification" ), QStringList { QObject::tr( "None" ), QObject::tr( "Relax filter" ), QObject::tr( "Amplify" ) }, false, 0 ); + auto filterModificationParam = std::make_unique( QStringLiteral( "FILTER_MODIFICATION" ), QObject::tr( "Filter modification" ), QStringList { QObject::tr( "None" ), QObject::tr( "Relax filter" ), QObject::tr( "Amplify" ) }, false, 0 ); filterModificationParam->setHelp( QObject::tr( "Choose whether to apply the filter kernel without modification or to use a confidence interval to relax or amplify the height criterium." ) ); addParameter( filterModificationParam.release() ); - std::unique_ptr stDevParam = std::make_unique( QStringLiteral( "STANDARD_DEVIATION" ), QObject::tr( "Standard deviation" ), Qgis::ProcessingNumberParameterType::Double, 0.1, false, 0, 1000 ); + auto stDevParam = std::make_unique( QStringLiteral( "STANDARD_DEVIATION" ), QObject::tr( "Standard deviation" ), Qgis::ProcessingNumberParameterType::Double, 0.1, false, 0, 1000 ); stDevParam->setHelp( QObject::tr( "The standard deviation used to calculate a 5% confidence interval applied to the height threshold." ) ); addParameter( stDevParam.release() ); - std::unique_ptr createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); + auto createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); createOptsParam->setMetadata( QVariantMap( { { QStringLiteral( "widget_wrapper" ), QVariantMap( { { QStringLiteral( "widget_type" ), QStringLiteral( "rasteroptions" ) } } ) } } ) ); createOptsParam->setFlags( createOptsParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( createOptsParam.release() ); - std::unique_ptr outputLayerGroundParam = std::make_unique( QStringLiteral( "OUTPUT_GROUND" ), QObject::tr( "Output layer (ground)" ), QVariant(), true, true ); + auto outputLayerGroundParam = std::make_unique( QStringLiteral( "OUTPUT_GROUND" ), QObject::tr( "Output layer (ground)" ), QVariant(), true, true ); outputLayerGroundParam->setHelp( QObject::tr( "The filtered DEM containing only cells classified as ground." ) ); addParameter( outputLayerGroundParam.release() ); - std::unique_ptr outputLayerNonGroundParam = std::make_unique( QStringLiteral( "OUTPUT_NONGROUND" ), QObject::tr( "Output layer (non-ground objects)" ), QVariant(), true, false ); + auto outputLayerNonGroundParam = std::make_unique( QStringLiteral( "OUTPUT_NONGROUND" ), QObject::tr( "Output layer (non-ground objects)" ), QVariant(), true, false ); outputLayerNonGroundParam->setHelp( QObject::tr( "The non-ground objects removed by the filter." ) ); addParameter( outputLayerNonGroundParam.release() ); } diff --git a/src/analysis/processing/qgsalgorithmrasterfrequencybycomparisonoperator.cpp b/src/analysis/processing/qgsalgorithmrasterfrequencybycomparisonoperator.cpp index 03b361917100..efe66d73fd40 100644 --- a/src/analysis/processing/qgsalgorithmrasterfrequencybycomparisonoperator.cpp +++ b/src/analysis/processing/qgsalgorithmrasterfrequencybycomparisonoperator.cpp @@ -43,11 +43,11 @@ void QgsRasterFrequencyByComparisonOperatorBase::initAlgorithm( const QVariantMa addParameter( new QgsProcessingParameterMultipleLayers( QStringLiteral( "INPUT_RASTERS" ), QObject::tr( "Input raster layers" ), Qgis::ProcessingSourceType::Raster ) ); addParameter( new QgsProcessingParameterBoolean( QStringLiteral( "IGNORE_NODATA" ), QObject::tr( "Ignore NoData values" ), false ) ); - std::unique_ptr output_nodata_parameter = std::make_unique( QStringLiteral( "OUTPUT_NODATA_VALUE" ), QObject::tr( "Output NoData value" ), Qgis::ProcessingNumberParameterType::Double, -9999, true ); + auto output_nodata_parameter = std::make_unique( QStringLiteral( "OUTPUT_NODATA_VALUE" ), QObject::tr( "Output NoData value" ), Qgis::ProcessingNumberParameterType::Double, -9999, true ); output_nodata_parameter->setFlags( output_nodata_parameter->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( output_nodata_parameter.release() ); - std::unique_ptr createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); + auto createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); createOptsParam->setMetadata( QVariantMap( { { QStringLiteral( "widget_wrapper" ), QVariantMap( { { QStringLiteral( "widget_type" ), QStringLiteral( "rasteroptions" ) } } ) } } ) ); createOptsParam->setFlags( createOptsParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( createOptsParam.release() ); @@ -119,7 +119,7 @@ QVariantMap QgsRasterFrequencyByComparisonOperatorBase::processAlgorithm( const const QFileInfo fi( outputFile ); const QString outputFormat = QgsRasterFileWriter::driverForExtension( fi.suffix() ); - std::unique_ptr writer = std::make_unique( outputFile ); + auto writer = std::make_unique( outputFile ); writer->setOutputProviderKey( QStringLiteral( "gdal" ) ); if ( !createOptions.isEmpty() ) { @@ -169,7 +169,7 @@ QVariantMap QgsRasterFrequencyByComparisonOperatorBase::processAlgorithm( const } } - std::unique_ptr outputBlock = std::make_unique( Qgis::DataType::Int32, iterCols, iterRows ); + auto outputBlock = std::make_unique( Qgis::DataType::Int32, iterCols, iterRows ); feedback->setProgress( 100 * ( ( iterTop / maxHeight * nbBlocksWidth ) + iterLeft / maxWidth ) / nbBlocks ); for ( int row = 0; row < iterRows; row++ ) { diff --git a/src/analysis/processing/qgsalgorithmrasterlogicalop.cpp b/src/analysis/processing/qgsalgorithmrasterlogicalop.cpp index 982324e8a6c5..5cb1f848b98a 100644 --- a/src/analysis/processing/qgsalgorithmrasterlogicalop.cpp +++ b/src/analysis/processing/qgsalgorithmrasterlogicalop.cpp @@ -47,7 +47,7 @@ void QgsRasterBooleanLogicAlgorithmBase::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterRasterLayer( QStringLiteral( "REF_LAYER" ), QObject::tr( "Reference layer" ) ) ); addParameter( new QgsProcessingParameterBoolean( QStringLiteral( "NODATA_AS_FALSE" ), QObject::tr( "Treat NoData values as false" ), false ) ); - std::unique_ptr noDataValueParam = std::make_unique( QStringLiteral( "NO_DATA" ), QObject::tr( "Output NoData value" ), Qgis::ProcessingNumberParameterType::Double, -9999 ); + auto noDataValueParam = std::make_unique( QStringLiteral( "NO_DATA" ), QObject::tr( "Output NoData value" ), Qgis::ProcessingNumberParameterType::Double, -9999 ); noDataValueParam->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( noDataValueParam.release() ); @@ -55,7 +55,7 @@ void QgsRasterBooleanLogicAlgorithmBase::initAlgorithm( const QVariantMap & ) typeChoice->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( typeChoice.release() ); - std::unique_ptr createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); + auto createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); createOptsParam->setMetadata( QVariantMap( { { QStringLiteral( "widget_wrapper" ), QVariantMap( { { QStringLiteral( "widget_type" ), QStringLiteral( "rasteroptions" ) } } ) } } ) ); createOptsParam->setFlags( createOptsParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( createOptsParam.release() ); @@ -125,7 +125,7 @@ QVariantMap QgsRasterBooleanLogicAlgorithmBase::processAlgorithm( const QVariant const QFileInfo fi( outputFile ); const QString outputFormat = QgsRasterFileWriter::driverForExtension( fi.suffix() ); - std::unique_ptr writer = std::make_unique( outputFile ); + auto writer = std::make_unique( outputFile ); writer->setOutputProviderKey( QStringLiteral( "gdal" ) ); if ( !createOptions.isEmpty() ) { diff --git a/src/analysis/processing/qgsalgorithmrasterstackposition.cpp b/src/analysis/processing/qgsalgorithmrasterstackposition.cpp index 9739e43de1bf..7285a1cecd8c 100644 --- a/src/analysis/processing/qgsalgorithmrasterstackposition.cpp +++ b/src/analysis/processing/qgsalgorithmrasterstackposition.cpp @@ -44,11 +44,11 @@ void QgsRasterStackPositionAlgorithmBase::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterBoolean( QStringLiteral( "IGNORE_NODATA" ), QObject::tr( "Ignore NoData values" ), false ) ); - std::unique_ptr output_nodata_parameter = std::make_unique( QStringLiteral( "OUTPUT_NODATA_VALUE" ), QObject::tr( "Output NoData value" ), Qgis::ProcessingNumberParameterType::Double, -9999, true ); + auto output_nodata_parameter = std::make_unique( QStringLiteral( "OUTPUT_NODATA_VALUE" ), QObject::tr( "Output NoData value" ), Qgis::ProcessingNumberParameterType::Double, -9999, true ); output_nodata_parameter->setFlags( output_nodata_parameter->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( output_nodata_parameter.release() ); - std::unique_ptr createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); + auto createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); createOptsParam->setMetadata( QVariantMap( { { QStringLiteral( "widget_wrapper" ), QVariantMap( { { QStringLiteral( "widget_type" ), QStringLiteral( "rasteroptions" ) } } ) } } ) ); createOptsParam->setFlags( createOptsParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( createOptsParam.release() ); @@ -115,7 +115,7 @@ QVariantMap QgsRasterStackPositionAlgorithmBase::processAlgorithm( const QVarian const QFileInfo fi( outputFile ); const QString outputFormat = QgsRasterFileWriter::driverForExtension( fi.suffix() ); - std::unique_ptr writer = std::make_unique( outputFile ); + auto writer = std::make_unique( outputFile ); writer->setOutputProviderKey( QStringLiteral( "gdal" ) ); if ( !createOptions.isEmpty() ) { diff --git a/src/analysis/processing/qgsalgorithmrasterzonalstats.cpp b/src/analysis/processing/qgsalgorithmrasterzonalstats.cpp index 7652ab13827f..dd653cf8f7b1 100644 --- a/src/analysis/processing/qgsalgorithmrasterzonalstats.cpp +++ b/src/analysis/processing/qgsalgorithmrasterzonalstats.cpp @@ -55,7 +55,7 @@ void QgsRasterLayerZonalStatsAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterRasterLayer( QStringLiteral( "ZONES" ), QObject::tr( "Zones layer" ) ) ); addParameter( new QgsProcessingParameterBand( QStringLiteral( "ZONES_BAND" ), QObject::tr( "Zones band number" ), 1, QStringLiteral( "ZONES" ) ) ); - std::unique_ptr refParam = std::make_unique( QStringLiteral( "REF_LAYER" ), QObject::tr( "Reference layer" ), QStringList() << QObject::tr( "Input layer" ) << QObject::tr( "Zones layer" ), false, 0 ); + auto refParam = std::make_unique( QStringLiteral( "REF_LAYER" ), QObject::tr( "Reference layer" ), QStringList() << QObject::tr( "Input layer" ) << QObject::tr( "Zones layer" ), false, 0 ); refParam->setFlags( refParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( refParam.release() ); diff --git a/src/analysis/processing/qgsalgorithmreclassifybylayer.cpp b/src/analysis/processing/qgsalgorithmreclassifybylayer.cpp index ecfa8f5b740b..b7377669beba 100644 --- a/src/analysis/processing/qgsalgorithmreclassifybylayer.cpp +++ b/src/analysis/processing/qgsalgorithmreclassifybylayer.cpp @@ -47,15 +47,15 @@ void QgsReclassifyAlgorithmBase::initAlgorithm( const QVariantMap & ) addAlgorithmParams(); - std::unique_ptr noDataValueParam = std::make_unique( QStringLiteral( "NO_DATA" ), QObject::tr( "Output NoData value" ), Qgis::ProcessingNumberParameterType::Double, -9999 ); + auto noDataValueParam = std::make_unique( QStringLiteral( "NO_DATA" ), QObject::tr( "Output NoData value" ), Qgis::ProcessingNumberParameterType::Double, -9999 ); noDataValueParam->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( noDataValueParam.release() ); - std::unique_ptr boundsHandling = std::make_unique( QStringLiteral( "RANGE_BOUNDARIES" ), QObject::tr( "Range boundaries" ), QStringList() << QObject::tr( "min < value <= max" ) << QObject::tr( "min <= value < max" ) << QObject::tr( "min <= value <= max" ) << QObject::tr( "min < value < max" ), false, 0 ); + auto boundsHandling = std::make_unique( QStringLiteral( "RANGE_BOUNDARIES" ), QObject::tr( "Range boundaries" ), QStringList() << QObject::tr( "min < value <= max" ) << QObject::tr( "min <= value < max" ) << QObject::tr( "min <= value <= max" ) << QObject::tr( "min < value < max" ), false, 0 ); boundsHandling->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( boundsHandling.release() ); - std::unique_ptr missingValuesParam = std::make_unique( QStringLiteral( "NODATA_FOR_MISSING" ), QObject::tr( "Use NoData when no range matches value" ), false, false ); + auto missingValuesParam = std::make_unique( QStringLiteral( "NODATA_FOR_MISSING" ), QObject::tr( "Use NoData when no range matches value" ), false, false ); missingValuesParam->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( missingValuesParam.release() ); @@ -63,7 +63,7 @@ void QgsReclassifyAlgorithmBase::initAlgorithm( const QVariantMap & ) typeChoice->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( typeChoice.release() ); - std::unique_ptr createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); + auto createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); createOptsParam->setMetadata( QVariantMap( { { QStringLiteral( "widget_wrapper" ), QVariantMap( { { QStringLiteral( "widget_type" ), QStringLiteral( "rasteroptions" ) } } ) } } ) ); createOptsParam->setFlags( createOptsParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( createOptsParam.release() ); @@ -132,7 +132,7 @@ QVariantMap QgsReclassifyAlgorithmBase::processAlgorithm( const QVariantMap &par const QFileInfo fi( outputFile ); const QString outputFormat = QgsRasterFileWriter::driverForExtension( fi.suffix() ); - std::unique_ptr writer = std::make_unique( outputFile ); + auto writer = std::make_unique( outputFile ); writer->setOutputProviderKey( QStringLiteral( "gdal" ) ); if ( !createOptions.isEmpty() ) { diff --git a/src/analysis/processing/qgsalgorithmrectanglesovalsdiamonds.cpp b/src/analysis/processing/qgsalgorithmrectanglesovalsdiamonds.cpp index 662c466ce39d..e3d98cd3c1c1 100644 --- a/src/analysis/processing/qgsalgorithmrectanglesovalsdiamonds.cpp +++ b/src/analysis/processing/qgsalgorithmrectanglesovalsdiamonds.cpp @@ -224,7 +224,7 @@ QgsFeatureList QgsRectanglesOvalsDiamondsAlgorithm::processFeature( const QgsFea } } - std::unique_ptr poly = std::make_unique(); + auto poly = std::make_unique(); poly->setExteriorRing( new QgsLineString( ringX, ringY ) ); if ( geometry.constGet()->is3D() ) diff --git a/src/analysis/processing/qgsalgorithmrefactorfields.cpp b/src/analysis/processing/qgsalgorithmrefactorfields.cpp index 7f3765b3e713..7df54190eb89 100644 --- a/src/analysis/processing/qgsalgorithmrefactorfields.cpp +++ b/src/analysis/processing/qgsalgorithmrefactorfields.cpp @@ -78,7 +78,7 @@ QgsRefactorFieldsAlgorithm *QgsRefactorFieldsAlgorithm::createInstance() const void QgsRefactorFieldsAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr param = std::make_unique( QStringLiteral( "FIELDS_MAPPING" ), QObject::tr( "Fields mapping" ), QStringLiteral( "INPUT" ) ); + auto param = std::make_unique( QStringLiteral( "FIELDS_MAPPING" ), QObject::tr( "Fields mapping" ), QStringLiteral( "INPUT" ) ); addParameter( param.release() ); } diff --git a/src/analysis/processing/qgsalgorithmremoveduplicatevertices.cpp b/src/analysis/processing/qgsalgorithmremoveduplicatevertices.cpp index c8655a1a0fa8..8bf8e7529430 100644 --- a/src/analysis/processing/qgsalgorithmremoveduplicatevertices.cpp +++ b/src/analysis/processing/qgsalgorithmremoveduplicatevertices.cpp @@ -70,13 +70,13 @@ QgsAlgorithmRemoveDuplicateVertices *QgsAlgorithmRemoveDuplicateVertices::create void QgsAlgorithmRemoveDuplicateVertices::initParameters( const QVariantMap & ) { - std::unique_ptr tolerance = std::make_unique( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), 0.000001, QStringLiteral( "INPUT" ), false, 0, 10000000.0 ); + auto tolerance = std::make_unique( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), 0.000001, QStringLiteral( "INPUT" ), false, 0, 10000000.0 ); tolerance->setIsDynamic( true ); tolerance->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "Tolerance" ), QObject::tr( "Tolerance distance" ), QgsPropertyDefinition::DoublePositive ) ); tolerance->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( tolerance.release() ); - std::unique_ptr useZ = std::make_unique( QStringLiteral( "USE_Z_VALUE" ), QObject::tr( "Use Z Value" ), false ); + auto useZ = std::make_unique( QStringLiteral( "USE_Z_VALUE" ), QObject::tr( "Use Z Value" ), false ); useZ->setIsDynamic( true ); useZ->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "UseZ" ), QObject::tr( "Use Z Value" ), QgsPropertyDefinition::Boolean ) ); useZ->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmremoveholes.cpp b/src/analysis/processing/qgsalgorithmremoveholes.cpp index 97f64e0db5a9..1c83fab295b3 100644 --- a/src/analysis/processing/qgsalgorithmremoveholes.cpp +++ b/src/analysis/processing/qgsalgorithmremoveholes.cpp @@ -81,7 +81,7 @@ Qgis::ProcessingFeatureSourceFlags QgsRemoveHolesAlgorithm::sourceFlags() const void QgsRemoveHolesAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr minArea = std::make_unique( QStringLiteral( "MIN_AREA" ), QObject::tr( "Remove holes with area less than" ), 0.0, QStringLiteral( "INPUT" ), false, 0 ); + auto minArea = std::make_unique( QStringLiteral( "MIN_AREA" ), QObject::tr( "Remove holes with area less than" ), 0.0, QStringLiteral( "INPUT" ), false, 0 ); minArea->setIsDynamic( true ); minArea->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "MIN_AREA" ), QObject::tr( "Remove holes with area less than" ), QgsPropertyDefinition::DoublePositive ) ); minArea->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmrepairshapefile.cpp b/src/analysis/processing/qgsalgorithmrepairshapefile.cpp index 02aa1f1cd823..0cb0341ebd89 100644 --- a/src/analysis/processing/qgsalgorithmrepairshapefile.cpp +++ b/src/analysis/processing/qgsalgorithmrepairshapefile.cpp @@ -78,7 +78,7 @@ QVariantMap QgsRepairShapefileAlgorithm::processAlgorithm( const QVariantMap &pa CPLSetConfigOption( "SHAPE_RESTORE_SHX", "YES" ); - std::unique_ptr layer = std::make_unique( path ); + auto layer = std::make_unique( path ); if ( !layer->isValid() ) { CPLSetConfigOption( "SHAPE_RESTORE_SHX", nullptr ); diff --git a/src/analysis/processing/qgsalgorithmrescaleraster.cpp b/src/analysis/processing/qgsalgorithmrescaleraster.cpp index 0a762cb550ee..c28c51a26e38 100644 --- a/src/analysis/processing/qgsalgorithmrescaleraster.cpp +++ b/src/analysis/processing/qgsalgorithmrescaleraster.cpp @@ -70,7 +70,7 @@ void QgsRescaleRasterAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterNumber( QStringLiteral( "MAXIMUM" ), QObject::tr( "New maximum value" ), Qgis::ProcessingNumberParameterType::Double, 255 ) ); addParameter( new QgsProcessingParameterNumber( QStringLiteral( "NODATA" ), QObject::tr( "New NoData value" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true ) ); - std::unique_ptr createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); + auto createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); createOptsParam->setMetadata( QVariantMap( { { QStringLiteral( "widget_wrapper" ), QVariantMap( { { QStringLiteral( "widget_type" ), QStringLiteral( "rasteroptions" ) } } ) } } ) ); createOptsParam->setFlags( createOptsParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( createOptsParam.release() ); @@ -135,7 +135,7 @@ QVariantMap QgsRescaleRasterAlgorithm::processAlgorithm( const QVariantMap ¶ const QString outputFile = parameterAsOutputLayer( parameters, QStringLiteral( "OUTPUT" ), context ); const QFileInfo fi( outputFile ); const QString outputFormat = QgsRasterFileWriter::driverForExtension( fi.suffix() ); - std::unique_ptr writer = std::make_unique( outputFile ); + auto writer = std::make_unique( outputFile ); writer->setOutputProviderKey( QStringLiteral( "gdal" ) ); if ( !createOptions.isEmpty() ) { @@ -168,7 +168,7 @@ QVariantMap QgsRescaleRasterAlgorithm::processAlgorithm( const QVariantMap ¶ std::unique_ptr inputBlock; while ( iter.readNextRasterPart( mBand, iterCols, iterRows, inputBlock, iterLeft, iterTop ) ) { - std::unique_ptr outputBlock( new QgsRasterBlock( destProvider->dataType( 1 ), iterCols, iterRows ) ); + auto outputBlock = std::make_unique( destProvider->dataType( 1 ), iterCols, iterRows ); feedback->setProgress( 100 * ( ( iterTop / blockHeight * numBlocksX ) + iterLeft / blockWidth ) / numBlocks ); for ( int row = 0; row < iterRows; row++ ) diff --git a/src/analysis/processing/qgsalgorithmrotate.cpp b/src/analysis/processing/qgsalgorithmrotate.cpp index 8f106dc2bcff..fb8fbd0e1946 100644 --- a/src/analysis/processing/qgsalgorithmrotate.cpp +++ b/src/analysis/processing/qgsalgorithmrotate.cpp @@ -63,13 +63,13 @@ QgsRotateFeaturesAlgorithm *QgsRotateFeaturesAlgorithm::createInstance() const void QgsRotateFeaturesAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr rotation = std::make_unique( QStringLiteral( "ANGLE" ), QObject::tr( "Rotation (degrees clockwise)" ), Qgis::ProcessingNumberParameterType::Double, 0.0 ); + auto rotation = std::make_unique( QStringLiteral( "ANGLE" ), QObject::tr( "Rotation (degrees clockwise)" ), Qgis::ProcessingNumberParameterType::Double, 0.0 ); rotation->setIsDynamic( true ); rotation->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "ANGLE" ), QObject::tr( "Rotation (degrees clockwise)" ), QgsPropertyDefinition::Rotation ) ); rotation->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( rotation.release() ); - std::unique_ptr anchor = std::make_unique( QStringLiteral( "ANCHOR" ), QObject::tr( "Rotation anchor point" ), QVariant(), true ); + auto anchor = std::make_unique( QStringLiteral( "ANCHOR" ), QObject::tr( "Rotation anchor point" ), QVariant(), true ); addParameter( anchor.release() ); } diff --git a/src/analysis/processing/qgsalgorithmroundrastervalues.cpp b/src/analysis/processing/qgsalgorithmroundrastervalues.cpp index 91e375f93550..76455d1616ba 100644 --- a/src/analysis/processing/qgsalgorithmroundrastervalues.cpp +++ b/src/analysis/processing/qgsalgorithmroundrastervalues.cpp @@ -54,7 +54,7 @@ void QgsRoundRasterValuesAlgorithm::initAlgorithm( const QVariantMap & ) std::unique_ptr baseParameter = std::make_unique( QStringLiteral( "BASE_N" ), QObject::tr( "Base n for rounding to multiples of n" ), Qgis::ProcessingNumberParameterType::Integer, 10, true, 1 ); baseParameter->setFlags( Qgis::ProcessingParameterFlag::Advanced ); addParameter( baseParameter.release() ); - std::unique_ptr createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); + auto createOptsParam = std::make_unique( QStringLiteral( "CREATE_OPTIONS" ), QObject::tr( "Creation options" ), QVariant(), false, true ); createOptsParam->setMetadata( QVariantMap( { { QStringLiteral( "widget_wrapper" ), QVariantMap( { { QStringLiteral( "widget_type" ), QStringLiteral( "rasteroptions" ) } } ) } } ) ); createOptsParam->setFlags( createOptsParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( createOptsParam.release() ); @@ -133,7 +133,7 @@ QVariantMap QgsRoundRasterValuesAlgorithm::processAlgorithm( const QVariantMap & const QString outputFile = parameterAsOutputLayer( parameters, QStringLiteral( "OUTPUT" ), context ); const QFileInfo fi( outputFile ); const QString outputFormat = QgsRasterFileWriter::driverForExtension( fi.suffix() ); - std::unique_ptr writer = std::make_unique( outputFile ); + auto writer = std::make_unique( outputFile ); writer->setOutputProviderKey( QStringLiteral( "gdal" ) ); if ( !createOptions.isEmpty() ) { diff --git a/src/analysis/processing/qgsalgorithmsavefeatures.cpp b/src/analysis/processing/qgsalgorithmsavefeatures.cpp index b11547e386b1..64c5a62bcdfb 100644 --- a/src/analysis/processing/qgsalgorithmsavefeatures.cpp +++ b/src/analysis/processing/qgsalgorithmsavefeatures.cpp @@ -64,7 +64,7 @@ void QgsSaveFeaturesAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Vector features" ), QList() << static_cast( Qgis::ProcessingSourceType::Vector ) ) ); addParameter( new QgsProcessingParameterFileDestination( QStringLiteral( "OUTPUT" ), QObject::tr( "Saved features" ), QgsVectorFileWriter::fileFilterString(), QVariant(), false ) ); - std::unique_ptr param = std::make_unique( QStringLiteral( "LAYER_NAME" ), QObject::tr( "Layer name" ), QVariant(), false, true ); + auto param = std::make_unique( QStringLiteral( "LAYER_NAME" ), QObject::tr( "Layer name" ), QVariant(), false, true ); param->setFlags( param->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( param.release() ); param = std::make_unique( QStringLiteral( "DATASOURCE_OPTIONS" ), QObject::tr( "GDAL dataset options (separate individual options with semicolons)" ), QVariant(), false, true ); @@ -74,7 +74,7 @@ void QgsSaveFeaturesAlgorithm::initAlgorithm( const QVariantMap & ) param->setFlags( param->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( param.release() ); - std::unique_ptr paramEnum = std::make_unique( QStringLiteral( "ACTION_ON_EXISTING_FILE" ), QObject::tr( "Action to take on pre-existing file" ), QStringList() << QObject::tr( "Create or overwrite file" ) << QObject::tr( "Create or overwrite layer" ) << QObject::tr( "Append features to existing layer, but do not create new fields" ) << QObject::tr( "Append features to existing layer, and create new fields if needed" ), false, 0 ); + auto paramEnum = std::make_unique( QStringLiteral( "ACTION_ON_EXISTING_FILE" ), QObject::tr( "Action to take on pre-existing file" ), QStringList() << QObject::tr( "Create or overwrite file" ) << QObject::tr( "Create or overwrite layer" ) << QObject::tr( "Append features to existing layer, but do not create new fields" ) << QObject::tr( "Append features to existing layer, and create new fields if needed" ), false, 0 ); paramEnum->setFlags( paramEnum->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( paramEnum.release() ); diff --git a/src/analysis/processing/qgsalgorithmsegmentize.cpp b/src/analysis/processing/qgsalgorithmsegmentize.cpp index 1d6c6d407233..e930b2e3bc93 100644 --- a/src/analysis/processing/qgsalgorithmsegmentize.cpp +++ b/src/analysis/processing/qgsalgorithmsegmentize.cpp @@ -69,7 +69,7 @@ QList QgsSegmentizeByMaximumDistanceAlgorithm::inputLayerTypes() const void QgsSegmentizeByMaximumDistanceAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr tolerance = std::make_unique( QStringLiteral( "DISTANCE" ), QObject::tr( "Maximum offset distance" ), 1.0, QStringLiteral( "INPUT" ), false, 0, 10000000.0 ); + auto tolerance = std::make_unique( QStringLiteral( "DISTANCE" ), QObject::tr( "Maximum offset distance" ), 1.0, QStringLiteral( "INPUT" ), false, 0, 10000000.0 ); tolerance->setIsDynamic( true ); tolerance->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "DISTANCE" ), QObject::tr( "Maximum offset distance" ), QgsPropertyDefinition::DoublePositive ) ); tolerance->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); @@ -159,7 +159,7 @@ QList QgsSegmentizeByMaximumAngleAlgorithm::inputLayerTypes() const void QgsSegmentizeByMaximumAngleAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr tolerance = std::make_unique( QStringLiteral( "ANGLE" ), QObject::tr( "Maximum angle between vertices (degrees)" ), Qgis::ProcessingNumberParameterType::Double, 5.0, false, 0, 360.0 ); + auto tolerance = std::make_unique( QStringLiteral( "ANGLE" ), QObject::tr( "Maximum angle between vertices (degrees)" ), Qgis::ProcessingNumberParameterType::Double, 5.0, false, 0, 360.0 ); tolerance->setIsDynamic( true ); tolerance->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "ANGLE" ), QObject::tr( "Maximum angle between vertices (degrees)" ), QgsPropertyDefinition::DoublePositive ) ); tolerance->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmserviceareafromlayer.cpp b/src/analysis/processing/qgsalgorithmserviceareafromlayer.cpp index 212820354f33..48a80b077761 100644 --- a/src/analysis/processing/qgsalgorithmserviceareafromlayer.cpp +++ b/src/analysis/processing/qgsalgorithmserviceareafromlayer.cpp @@ -56,13 +56,13 @@ void QgsServiceAreaFromLayerAlgorithm::initAlgorithm( const QVariantMap & ) addCommonParams(); addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "START_POINTS" ), QObject::tr( "Vector layer with start points" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorPoint ) ) ); - std::unique_ptr travelCost = std::make_unique( QStringLiteral( "TRAVEL_COST" ), QObject::tr( "Travel cost (distance for 'Shortest', time for 'Fastest')" ), Qgis::ProcessingNumberParameterType::Double, 0, true, 0 ); + auto travelCost = std::make_unique( QStringLiteral( "TRAVEL_COST" ), QObject::tr( "Travel cost (distance for 'Shortest', time for 'Fastest')" ), Qgis::ProcessingNumberParameterType::Double, 0, true, 0 ); travelCost->setFlags( travelCost->flags() | Qgis::ProcessingParameterFlag::Hidden ); addParameter( travelCost.release() ); addParameter( new QgsProcessingParameterNumber( QStringLiteral( "TRAVEL_COST2" ), QObject::tr( "Travel cost (distance for 'Shortest', time for 'Fastest')" ), Qgis::ProcessingNumberParameterType::Double, 0, false, 0 ) ); - std::unique_ptr includeBounds = std::make_unique( QStringLiteral( "INCLUDE_BOUNDS" ), QObject::tr( "Include upper/lower bound points" ), false, true ); + auto includeBounds = std::make_unique( QStringLiteral( "INCLUDE_BOUNDS" ), QObject::tr( "Include upper/lower bound points" ), false, true ); includeBounds->setFlags( includeBounds->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( includeBounds.release() ); @@ -71,15 +71,15 @@ void QgsServiceAreaFromLayerAlgorithm::initAlgorithm( const QVariantMap & ) maxPointDistanceFromNetwork->setHelp( QObject::tr( "Specifies an optional limit on the distance from the points to the network layer. If a point is further from the network than this distance it will be treated as non-routable." ) ); addParameter( maxPointDistanceFromNetwork.release() ); - std::unique_ptr outputLines = std::make_unique( QStringLiteral( "OUTPUT_LINES" ), QObject::tr( "Service area (lines)" ), Qgis::ProcessingSourceType::VectorLine, QVariant(), true ); + auto outputLines = std::make_unique( QStringLiteral( "OUTPUT_LINES" ), QObject::tr( "Service area (lines)" ), Qgis::ProcessingSourceType::VectorLine, QVariant(), true ); outputLines->setCreateByDefault( true ); addParameter( outputLines.release() ); - std::unique_ptr outputPoints = std::make_unique( QStringLiteral( "OUTPUT" ), QObject::tr( "Service area (boundary nodes)" ), Qgis::ProcessingSourceType::VectorPoint, QVariant(), true ); + auto outputPoints = std::make_unique( QStringLiteral( "OUTPUT" ), QObject::tr( "Service area (boundary nodes)" ), Qgis::ProcessingSourceType::VectorPoint, QVariant(), true ); outputPoints->setCreateByDefault( false ); addParameter( outputPoints.release() ); - std::unique_ptr outputNonRoutable = std::make_unique( QStringLiteral( "OUTPUT_NON_ROUTABLE" ), QObject::tr( "Non-routable features" ), Qgis::ProcessingSourceType::VectorPoint, QVariant(), true ); + auto outputNonRoutable = std::make_unique( QStringLiteral( "OUTPUT_NON_ROUTABLE" ), QObject::tr( "Non-routable features" ), Qgis::ProcessingSourceType::VectorPoint, QVariant(), true ); outputNonRoutable->setHelp( QObject::tr( "An optional output which will be used to store any input features which could not be routed (e.g. those which are too far from the network layer)." ) ); outputNonRoutable->setCreateByDefault( false ); addParameter( outputNonRoutable.release() ); diff --git a/src/analysis/processing/qgsalgorithmserviceareafrompoint.cpp b/src/analysis/processing/qgsalgorithmserviceareafrompoint.cpp index 3ae655a7b88e..2835709d858a 100644 --- a/src/analysis/processing/qgsalgorithmserviceareafrompoint.cpp +++ b/src/analysis/processing/qgsalgorithmserviceareafrompoint.cpp @@ -56,7 +56,7 @@ void QgsServiceAreaFromPointAlgorithm::initAlgorithm( const QVariantMap & ) addCommonParams(); addParameter( new QgsProcessingParameterPoint( QStringLiteral( "START_POINT" ), QObject::tr( "Start point" ) ) ); - std::unique_ptr travelCost = std::make_unique( QStringLiteral( "TRAVEL_COST" ), QObject::tr( "Travel cost (distance for 'Shortest', time for 'Fastest')" ), Qgis::ProcessingNumberParameterType::Double, 0, true, 0 ); + auto travelCost = std::make_unique( QStringLiteral( "TRAVEL_COST" ), QObject::tr( "Travel cost (distance for 'Shortest', time for 'Fastest')" ), Qgis::ProcessingNumberParameterType::Double, 0, true, 0 ); travelCost->setFlags( travelCost->flags() | Qgis::ProcessingParameterFlag::Hidden ); addParameter( travelCost.release() ); @@ -67,15 +67,15 @@ void QgsServiceAreaFromPointAlgorithm::initAlgorithm( const QVariantMap & ) maxPointDistanceFromNetwork->setHelp( QObject::tr( "Specifies an optional limit on the distance from the point to the network layer. If the point is further from the network than this distance an error will be raised." ) ); addParameter( maxPointDistanceFromNetwork.release() ); - std::unique_ptr includeBounds = std::make_unique( QStringLiteral( "INCLUDE_BOUNDS" ), QObject::tr( "Include upper/lower bound points" ), false, true ); + auto includeBounds = std::make_unique( QStringLiteral( "INCLUDE_BOUNDS" ), QObject::tr( "Include upper/lower bound points" ), false, true ); includeBounds->setFlags( includeBounds->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( includeBounds.release() ); - std::unique_ptr outputLines = std::make_unique( QStringLiteral( "OUTPUT_LINES" ), QObject::tr( "Service area (lines)" ), Qgis::ProcessingSourceType::VectorLine, QVariant(), true ); + auto outputLines = std::make_unique( QStringLiteral( "OUTPUT_LINES" ), QObject::tr( "Service area (lines)" ), Qgis::ProcessingSourceType::VectorLine, QVariant(), true ); outputLines->setCreateByDefault( true ); addParameter( outputLines.release() ); - std::unique_ptr outputPoints = std::make_unique( QStringLiteral( "OUTPUT" ), QObject::tr( "Service area (boundary nodes)" ), Qgis::ProcessingSourceType::VectorPoint, QVariant(), true ); + auto outputPoints = std::make_unique( QStringLiteral( "OUTPUT" ), QObject::tr( "Service area (boundary nodes)" ), Qgis::ProcessingSourceType::VectorPoint, QVariant(), true ); outputPoints->setCreateByDefault( false ); addParameter( outputPoints.release() ); } diff --git a/src/analysis/processing/qgsalgorithmshortestpathlayertopoint.cpp b/src/analysis/processing/qgsalgorithmshortestpathlayertopoint.cpp index 41b661c321e2..068170543190 100644 --- a/src/analysis/processing/qgsalgorithmshortestpathlayertopoint.cpp +++ b/src/analysis/processing/qgsalgorithmshortestpathlayertopoint.cpp @@ -61,7 +61,7 @@ void QgsShortestPathLayerToPointAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Shortest path" ), Qgis::ProcessingSourceType::VectorLine ) ); - std::unique_ptr outputNonRoutable = std::make_unique( QStringLiteral( "OUTPUT_NON_ROUTABLE" ), QObject::tr( "Non-routable features" ), Qgis::ProcessingSourceType::VectorPoint, QVariant(), true ); + auto outputNonRoutable = std::make_unique( QStringLiteral( "OUTPUT_NON_ROUTABLE" ), QObject::tr( "Non-routable features" ), Qgis::ProcessingSourceType::VectorPoint, QVariant(), true ); outputNonRoutable->setHelp( QObject::tr( "An optional output which will be used to store any input features which could not be routed (e.g. those which are too far from the network layer)." ) ); outputNonRoutable->setCreateByDefault( false ); addParameter( outputNonRoutable.release() ); diff --git a/src/analysis/processing/qgsalgorithmshortestpathpointtolayer.cpp b/src/analysis/processing/qgsalgorithmshortestpathpointtolayer.cpp index c9b870d22db4..68c124979318 100644 --- a/src/analysis/processing/qgsalgorithmshortestpathpointtolayer.cpp +++ b/src/analysis/processing/qgsalgorithmshortestpathpointtolayer.cpp @@ -66,7 +66,7 @@ void QgsShortestPathPointToLayerAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Shortest path" ), Qgis::ProcessingSourceType::VectorLine ) ); - std::unique_ptr outputNonRoutable = std::make_unique( QStringLiteral( "OUTPUT_NON_ROUTABLE" ), QObject::tr( "Non-routable features" ), Qgis::ProcessingSourceType::VectorPoint, QVariant(), true ); + auto outputNonRoutable = std::make_unique( QStringLiteral( "OUTPUT_NON_ROUTABLE" ), QObject::tr( "Non-routable features" ), Qgis::ProcessingSourceType::VectorPoint, QVariant(), true ); outputNonRoutable->setHelp( QObject::tr( "An optional output which will be used to store any input features which could not be routed (e.g. those which are too far from the network layer)." ) ); outputNonRoutable->setCreateByDefault( false ); addParameter( outputNonRoutable.release() ); diff --git a/src/analysis/processing/qgsalgorithmsimplify.cpp b/src/analysis/processing/qgsalgorithmsimplify.cpp index 3c7cfdbc24b6..9ebe9c9b65df 100644 --- a/src/analysis/processing/qgsalgorithmsimplify.cpp +++ b/src/analysis/processing/qgsalgorithmsimplify.cpp @@ -82,7 +82,7 @@ void QgsSimplifyAlgorithm::initParameters( const QVariantMap & ) QObject::tr( "Simplification method" ), methods, false, 0 ) ); - std::unique_ptr tolerance = std::make_unique( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), 1.0, QStringLiteral( "INPUT" ), false, 0, 10000000.0 ); + auto tolerance = std::make_unique( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), 1.0, QStringLiteral( "INPUT" ), false, 0, 10000000.0 ); tolerance->setIsDynamic( true ); tolerance->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "Tolerance" ), QObject::tr( "Tolerance distance" ), QgsPropertyDefinition::DoublePositive ) ); tolerance->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmsmooth.cpp b/src/analysis/processing/qgsalgorithmsmooth.cpp index 487c2a543a06..b589acd50966 100644 --- a/src/analysis/processing/qgsalgorithmsmooth.cpp +++ b/src/analysis/processing/qgsalgorithmsmooth.cpp @@ -79,19 +79,19 @@ QList QgsSmoothAlgorithm::inputLayerTypes() const void QgsSmoothAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr iterations = std::make_unique( QStringLiteral( "ITERATIONS" ), QObject::tr( "Iterations" ), Qgis::ProcessingNumberParameterType::Integer, 1, false, 1, 10 ); + auto iterations = std::make_unique( QStringLiteral( "ITERATIONS" ), QObject::tr( "Iterations" ), Qgis::ProcessingNumberParameterType::Integer, 1, false, 1, 10 ); iterations->setIsDynamic( true ); iterations->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "ITERATIONS" ), QObject::tr( "Iterations" ), QgsPropertyDefinition::IntegerPositiveGreaterZero ) ); iterations->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( iterations.release() ); - std::unique_ptr offset = std::make_unique( QStringLiteral( "OFFSET" ), QObject::tr( "Offset" ), Qgis::ProcessingNumberParameterType::Double, 0.25, false, 0.0, 0.5 ); + auto offset = std::make_unique( QStringLiteral( "OFFSET" ), QObject::tr( "Offset" ), Qgis::ProcessingNumberParameterType::Double, 0.25, false, 0.0, 0.5 ); offset->setIsDynamic( true ); offset->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "OFFSET" ), QObject::tr( "Offset" ), QgsPropertyDefinition::Double0To1 ) ); offset->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( offset.release() ); - std::unique_ptr maxAngle = std::make_unique( QStringLiteral( "MAX_ANGLE" ), QObject::tr( "Maximum node angle to smooth" ), Qgis::ProcessingNumberParameterType::Double, 180.0, false, 0.0, 180.0 ); + auto maxAngle = std::make_unique( QStringLiteral( "MAX_ANGLE" ), QObject::tr( "Maximum node angle to smooth" ), Qgis::ProcessingNumberParameterType::Double, 180.0, false, 0.0, 180.0 ); maxAngle->setIsDynamic( true ); maxAngle->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "MAX_ANGLE" ), QObject::tr( "Maximum node angle to smooth" ), QgsPropertyDefinition::Rotation ) ); maxAngle->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmsnapgeometries.cpp b/src/analysis/processing/qgsalgorithmsnapgeometries.cpp index cb7f842cbbbc..5bc13626a5de 100644 --- a/src/analysis/processing/qgsalgorithmsnapgeometries.cpp +++ b/src/analysis/processing/qgsalgorithmsnapgeometries.cpp @@ -84,7 +84,7 @@ void QgsSnapGeometriesAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorPoint ) << static_cast( Qgis::ProcessingSourceType::VectorLine ) << static_cast( Qgis::ProcessingSourceType::VectorPolygon ) ) ); addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "REFERENCE_LAYER" ), QObject::tr( "Reference layer" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorPoint ) << static_cast( Qgis::ProcessingSourceType::VectorLine ) << static_cast( Qgis::ProcessingSourceType::VectorPolygon ) ) ); - std::unique_ptr tolParam = std::make_unique( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), 10.0, QStringLiteral( "INPUT" ), false, 0.00000001 ); + auto tolParam = std::make_unique( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), 10.0, QStringLiteral( "INPUT" ), false, 0.00000001 ); tolParam->setMetadata( { QVariantMap( { { QStringLiteral( "widget_wrapper" ), QVariantMap( { { QStringLiteral( "decimals" ), 8 } } ) } } ) } diff --git a/src/analysis/processing/qgsalgorithmsnaptogrid.cpp b/src/analysis/processing/qgsalgorithmsnaptogrid.cpp index c74514a42217..af009b42740d 100644 --- a/src/analysis/processing/qgsalgorithmsnaptogrid.cpp +++ b/src/analysis/processing/qgsalgorithmsnaptogrid.cpp @@ -67,25 +67,25 @@ QgsSnapToGridAlgorithm *QgsSnapToGridAlgorithm::createInstance() const void QgsSnapToGridAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr hSpacing = std::make_unique( QStringLiteral( "HSPACING" ), QObject::tr( "X Grid Spacing" ), 1, QStringLiteral( "INPUT" ), false, 0 ); + auto hSpacing = std::make_unique( QStringLiteral( "HSPACING" ), QObject::tr( "X Grid Spacing" ), 1, QStringLiteral( "INPUT" ), false, 0 ); hSpacing->setIsDynamic( true ); hSpacing->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "HSPACING" ), QObject::tr( "X Grid Spacing" ), QgsPropertyDefinition::DoublePositive ) ); hSpacing->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( hSpacing.release() ); - std::unique_ptr vSpacing = std::make_unique( QStringLiteral( "VSPACING" ), QObject::tr( "Y Grid Spacing" ), 1, QStringLiteral( "INPUT" ), false, 0 ); + auto vSpacing = std::make_unique( QStringLiteral( "VSPACING" ), QObject::tr( "Y Grid Spacing" ), 1, QStringLiteral( "INPUT" ), false, 0 ); vSpacing->setIsDynamic( true ); vSpacing->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "VSPACING" ), QObject::tr( "Y Grid Spacing" ), QgsPropertyDefinition::DoublePositive ) ); vSpacing->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( vSpacing.release() ); - std::unique_ptr zSpacing = std::make_unique( QStringLiteral( "ZSPACING" ), QObject::tr( "Z Grid Spacing" ), Qgis::ProcessingNumberParameterType::Double, 0, false, 0 ); + auto zSpacing = std::make_unique( QStringLiteral( "ZSPACING" ), QObject::tr( "Z Grid Spacing" ), Qgis::ProcessingNumberParameterType::Double, 0, false, 0 ); zSpacing->setIsDynamic( true ); zSpacing->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "ZSPACING" ), QObject::tr( "Z Grid Spacing" ), QgsPropertyDefinition::DoublePositive ) ); zSpacing->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( zSpacing.release() ); - std::unique_ptr mSpacing = std::make_unique( QStringLiteral( "MSPACING" ), QObject::tr( "M Grid Spacing" ), Qgis::ProcessingNumberParameterType::Double, 0, false, 0 ); + auto mSpacing = std::make_unique( QStringLiteral( "MSPACING" ), QObject::tr( "M Grid Spacing" ), Qgis::ProcessingNumberParameterType::Double, 0, false, 0 ); mSpacing->setIsDynamic( true ); mSpacing->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "MSPACING" ), QObject::tr( "M Grid Spacing" ), QgsPropertyDefinition::DoublePositive ) ); mSpacing->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmsplitlinesbylength.cpp b/src/analysis/processing/qgsalgorithmsplitlinesbylength.cpp index f38683af5edd..839e45f36b25 100644 --- a/src/analysis/processing/qgsalgorithmsplitlinesbylength.cpp +++ b/src/analysis/processing/qgsalgorithmsplitlinesbylength.cpp @@ -83,7 +83,7 @@ QgsSplitLinesByLengthAlgorithm *QgsSplitLinesByLengthAlgorithm::createInstance() void QgsSplitLinesByLengthAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr length = std::make_unique( QStringLiteral( "LENGTH" ), QObject::tr( "Maximum line length" ), 10, QStringLiteral( "INPUT" ), false, 0 ); + auto length = std::make_unique( QStringLiteral( "LENGTH" ), QObject::tr( "Maximum line length" ), 10, QStringLiteral( "INPUT" ), false, 0 ); length->setIsDynamic( true ); length->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "LENGTH" ), QObject::tr( "Maximum length" ), QgsPropertyDefinition::DoublePositive ) ); length->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmsplitvectorlayer.cpp b/src/analysis/processing/qgsalgorithmsplitvectorlayer.cpp index 2aed08418dd9..61050019b150 100644 --- a/src/analysis/processing/qgsalgorithmsplitvectorlayer.cpp +++ b/src/analysis/processing/qgsalgorithmsplitvectorlayer.cpp @@ -66,7 +66,7 @@ void QgsSplitVectorLayerAlgorithm::initAlgorithm( const QVariantMap & ) { addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ), QList() << static_cast( Qgis::ProcessingSourceType::Vector ) ) ); addParameter( new QgsProcessingParameterField( QStringLiteral( "FIELD" ), QObject::tr( "Unique ID field" ), QVariant(), QStringLiteral( "INPUT" ) ) ); - std::unique_ptr prefixFieldParam = std::make_unique( QStringLiteral( "PREFIX_FIELD" ), QObject::tr( "Add field prefix to file names" ), true ); + auto prefixFieldParam = std::make_unique( QStringLiteral( "PREFIX_FIELD" ), QObject::tr( "Add field prefix to file names" ), true ); addParameter( prefixFieldParam.release() ); const QStringList options = QgsVectorFileWriter::supportedFormatExtensions(); diff --git a/src/analysis/processing/qgsalgorithmsubdivide.cpp b/src/analysis/processing/qgsalgorithmsubdivide.cpp index 93e0addb347a..b496b606ccdc 100644 --- a/src/analysis/processing/qgsalgorithmsubdivide.cpp +++ b/src/analysis/processing/qgsalgorithmsubdivide.cpp @@ -21,7 +21,7 @@ void QgsSubdivideAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr nodes = std::make_unique( QStringLiteral( "MAX_NODES" ), QObject::tr( "Maximum nodes in parts" ), Qgis::ProcessingNumberParameterType::Integer, 256, false, 8, 100000 ); + auto nodes = std::make_unique( QStringLiteral( "MAX_NODES" ), QObject::tr( "Maximum nodes in parts" ), Qgis::ProcessingNumberParameterType::Integer, 256, false, 8, 100000 ); nodes->setIsDynamic( true ); nodes->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "MAX_NODES" ), QObject::tr( "Maximum nodes in parts" ), QgsPropertyDefinition::Integer ) ); nodes->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmsymmetricaldifference.cpp b/src/analysis/processing/qgsalgorithmsymmetricaldifference.cpp index 8bc88f59fc27..138b9c749756 100644 --- a/src/analysis/processing/qgsalgorithmsymmetricaldifference.cpp +++ b/src/analysis/processing/qgsalgorithmsymmetricaldifference.cpp @@ -66,13 +66,13 @@ void QgsSymmetricalDifferenceAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ) ) ); addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "OVERLAY" ), QObject::tr( "Overlay layer" ) ) ); - std::unique_ptr prefix = std::make_unique( QStringLiteral( "OVERLAY_FIELDS_PREFIX" ), QObject::tr( "Overlay fields prefix" ), QString(), false, true ); + auto prefix = std::make_unique( QStringLiteral( "OVERLAY_FIELDS_PREFIX" ), QObject::tr( "Overlay fields prefix" ), QString(), false, true ); prefix->setFlags( prefix->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( prefix.release() ); addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Symmetrical difference" ) ) ); - std::unique_ptr gridSize = std::make_unique( QStringLiteral( "GRID_SIZE" ), QObject::tr( "Grid size" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 ); + auto gridSize = std::make_unique( QStringLiteral( "GRID_SIZE" ), QObject::tr( "Grid size" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 ); gridSize->setFlags( gridSize->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( gridSize.release() ); } diff --git a/src/analysis/processing/qgsalgorithmtaperedbuffer.cpp b/src/analysis/processing/qgsalgorithmtaperedbuffer.cpp index 772b29d24904..6173827d8c8b 100644 --- a/src/analysis/processing/qgsalgorithmtaperedbuffer.cpp +++ b/src/analysis/processing/qgsalgorithmtaperedbuffer.cpp @@ -97,19 +97,19 @@ QgsTaperedBufferAlgorithm *QgsTaperedBufferAlgorithm::createInstance() const void QgsTaperedBufferAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr startWidth = std::make_unique( QStringLiteral( "START_WIDTH" ), QObject::tr( "Start width" ), Qgis::ProcessingNumberParameterType::Double, 0.0, false, 0.0 ); + auto startWidth = std::make_unique( QStringLiteral( "START_WIDTH" ), QObject::tr( "Start width" ), Qgis::ProcessingNumberParameterType::Double, 0.0, false, 0.0 ); startWidth->setIsDynamic( true ); startWidth->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "START_WIDTH" ), QObject::tr( "Start width" ), QgsPropertyDefinition::DoublePositive ) ); startWidth->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( startWidth.release() ); - std::unique_ptr endWidth = std::make_unique( QStringLiteral( "END_WIDTH" ), QObject::tr( "End width" ), Qgis::ProcessingNumberParameterType::Double, 1, false, 0.0 ); + auto endWidth = std::make_unique( QStringLiteral( "END_WIDTH" ), QObject::tr( "End width" ), Qgis::ProcessingNumberParameterType::Double, 1, false, 0.0 ); endWidth->setIsDynamic( true ); endWidth->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "END_WIDTH" ), QObject::tr( "End width" ), QgsPropertyDefinition::DoublePositive ) ); endWidth->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( endWidth.release() ); - std::unique_ptr segments = std::make_unique( QStringLiteral( "SEGMENTS" ), QObject::tr( "Segments" ), Qgis::ProcessingNumberParameterType::Integer, 16, false, 1 ); + auto segments = std::make_unique( QStringLiteral( "SEGMENTS" ), QObject::tr( "Segments" ), Qgis::ProcessingNumberParameterType::Integer, 16, false, 1 ); segments->setIsDynamic( true ); segments->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "SEGMENTS" ), QObject::tr( "Segments" ), QgsPropertyDefinition::IntegerPositiveGreaterZero ) ); segments->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); @@ -213,7 +213,7 @@ QgsVariableWidthBufferByMAlgorithm *QgsVariableWidthBufferByMAlgorithm::createIn void QgsVariableWidthBufferByMAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr segments = std::make_unique( QStringLiteral( "SEGMENTS" ), QObject::tr( "Segments" ), Qgis::ProcessingNumberParameterType::Integer, 16, false, 1 ); + auto segments = std::make_unique( QStringLiteral( "SEGMENTS" ), QObject::tr( "Segments" ), Qgis::ProcessingNumberParameterType::Integer, 16, false, 1 ); segments->setIsDynamic( true ); segments->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "SEGMENTS" ), QObject::tr( "Segments" ), QgsPropertyDefinition::IntegerPositiveGreaterZero ) ); segments->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmtinmeshcreation.cpp b/src/analysis/processing/qgsalgorithmtinmeshcreation.cpp index d7397d5a0a04..5d3e10e6ea0c 100644 --- a/src/analysis/processing/qgsalgorithmtinmeshcreation.cpp +++ b/src/analysis/processing/qgsalgorithmtinmeshcreation.cpp @@ -199,7 +199,7 @@ QVariantMap QgsTinMeshCreationAlgorithm::processAlgorithm( const QVariantMap &pa void QgsTinMeshCreationAlgorithm::addZValueDataset( const QString &fileName, const QgsMesh &mesh, const QString &driver ) { - std::unique_ptr tempLayer = std::make_unique( fileName, "temp", "mdal" ); + auto tempLayer = std::make_unique( fileName, "temp", "mdal" ); QgsMeshZValueDatasetGroup *zValueDatasetGroup = new QgsMeshZValueDatasetGroup( QObject::tr( "Terrain Elevation" ), mesh ); tempLayer->addDatasets( zValueDatasetGroup ); const int datasetGroupIndex = tempLayer->datasetGroupCount() - 1; diff --git a/src/analysis/processing/qgsalgorithmtransect.cpp b/src/analysis/processing/qgsalgorithmtransect.cpp index c05eed279045..f89e27784efb 100644 --- a/src/analysis/processing/qgsalgorithmtransect.cpp +++ b/src/analysis/processing/qgsalgorithmtransect.cpp @@ -49,13 +49,13 @@ QString QgsTransectAlgorithm::groupId() const void QgsTransectAlgorithm::initAlgorithm( const QVariantMap & ) { addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorLine ) ) ); - std::unique_ptr length = std::make_unique( QStringLiteral( "LENGTH" ), QObject::tr( "Length of the transect" ), 5.0, QStringLiteral( "INPUT" ), false, 0 ); + auto length = std::make_unique( QStringLiteral( "LENGTH" ), QObject::tr( "Length of the transect" ), 5.0, QStringLiteral( "INPUT" ), false, 0 ); length->setIsDynamic( true ); length->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "LENGTH" ), QObject::tr( "Length of the transect" ), QgsPropertyDefinition::DoublePositive ) ); length->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( length.release() ); - std::unique_ptr angle = std::make_unique( QStringLiteral( "ANGLE" ), QObject::tr( "Angle in degrees from the original line at the vertices" ), Qgis::ProcessingNumberParameterType::Double, 90.0, false, 0, 360 ); + auto angle = std::make_unique( QStringLiteral( "ANGLE" ), QObject::tr( "Angle in degrees from the original line at the vertices" ), Qgis::ProcessingNumberParameterType::Double, 90.0, false, 0, 360 ); angle->setIsDynamic( true ); angle->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "ANGLE" ), QObject::tr( "Angle in degrees" ), QgsPropertyDefinition::Double ) ); angle->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmtranslate.cpp b/src/analysis/processing/qgsalgorithmtranslate.cpp index 3d1967aa774e..6293aee35d73 100644 --- a/src/analysis/processing/qgsalgorithmtranslate.cpp +++ b/src/analysis/processing/qgsalgorithmtranslate.cpp @@ -64,25 +64,25 @@ QgsTranslateAlgorithm *QgsTranslateAlgorithm::createInstance() const void QgsTranslateAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr xOffset = std::make_unique( QStringLiteral( "DELTA_X" ), QObject::tr( "Offset distance (x-axis)" ), 0.0, QStringLiteral( "INPUT" ) ); + auto xOffset = std::make_unique( QStringLiteral( "DELTA_X" ), QObject::tr( "Offset distance (x-axis)" ), 0.0, QStringLiteral( "INPUT" ) ); xOffset->setIsDynamic( true ); xOffset->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "DELTA_X" ), QObject::tr( "Offset distance (x-axis)" ), QgsPropertyDefinition::Double ) ); xOffset->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( xOffset.release() ); - std::unique_ptr yOffset = std::make_unique( QStringLiteral( "DELTA_Y" ), QObject::tr( "Offset distance (y-axis)" ), 0.0, QStringLiteral( "INPUT" ) ); + auto yOffset = std::make_unique( QStringLiteral( "DELTA_Y" ), QObject::tr( "Offset distance (y-axis)" ), 0.0, QStringLiteral( "INPUT" ) ); yOffset->setIsDynamic( true ); yOffset->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "DELTA_Y" ), QObject::tr( "Offset distance (y-axis)" ), QgsPropertyDefinition::Double ) ); yOffset->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( yOffset.release() ); - std::unique_ptr zOffset = std::make_unique( QStringLiteral( "DELTA_Z" ), QObject::tr( "Offset distance (z-axis)" ), Qgis::ProcessingNumberParameterType::Double, 0.0 ); + auto zOffset = std::make_unique( QStringLiteral( "DELTA_Z" ), QObject::tr( "Offset distance (z-axis)" ), Qgis::ProcessingNumberParameterType::Double, 0.0 ); zOffset->setIsDynamic( true ); zOffset->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "DELTA_Z" ), QObject::tr( "Offset distance (z-axis)" ), QgsPropertyDefinition::Double ) ); zOffset->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( zOffset.release() ); - std::unique_ptr mOffset = std::make_unique( QStringLiteral( "DELTA_M" ), QObject::tr( "Offset distance (m values)" ), Qgis::ProcessingNumberParameterType::Double, 0.0 ); + auto mOffset = std::make_unique( QStringLiteral( "DELTA_M" ), QObject::tr( "Offset distance (m values)" ), Qgis::ProcessingNumberParameterType::Double, 0.0 ); mOffset->setIsDynamic( true ); mOffset->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "DELTA_M" ), QObject::tr( "Offset distance (m values)" ), QgsPropertyDefinition::Double ) ); mOffset->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); diff --git a/src/analysis/processing/qgsalgorithmunion.cpp b/src/analysis/processing/qgsalgorithmunion.cpp index 28314303e175..e6967508b643 100644 --- a/src/analysis/processing/qgsalgorithmunion.cpp +++ b/src/analysis/processing/qgsalgorithmunion.cpp @@ -67,13 +67,13 @@ void QgsUnionAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ) ) ); addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "OVERLAY" ), QObject::tr( "Overlay layer" ), QList(), QVariant(), true ) ); - std::unique_ptr prefix = std::make_unique( QStringLiteral( "OVERLAY_FIELDS_PREFIX" ), QObject::tr( "Overlay fields prefix" ), QString(), false, true ); + auto prefix = std::make_unique( QStringLiteral( "OVERLAY_FIELDS_PREFIX" ), QObject::tr( "Overlay fields prefix" ), QString(), false, true ); prefix->setFlags( prefix->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( prefix.release() ); addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Union" ) ) ); - std::unique_ptr gridSize = std::make_unique( QStringLiteral( "GRID_SIZE" ), QObject::tr( "Grid size" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 ); + auto gridSize = std::make_unique( QStringLiteral( "GRID_SIZE" ), QObject::tr( "Grid size" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 ); gridSize->setFlags( gridSize->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( gridSize.release() ); } diff --git a/src/analysis/processing/qgsalgorithmuniquevalueindex.cpp b/src/analysis/processing/qgsalgorithmuniquevalueindex.cpp index fd3d340ab585..ab18a593f81b 100644 --- a/src/analysis/processing/qgsalgorithmuniquevalueindex.cpp +++ b/src/analysis/processing/qgsalgorithmuniquevalueindex.cpp @@ -50,11 +50,11 @@ void QgsAddUniqueValueIndexAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterField( QStringLiteral( "FIELD" ), QObject::tr( "Class field" ), QVariant(), QStringLiteral( "INPUT" ), Qgis::ProcessingFieldParameterDataType::Any ) ); addParameter( new QgsProcessingParameterString( QStringLiteral( "FIELD_NAME" ), QObject::tr( "Output field name" ), QStringLiteral( "NUM_FIELD" ) ) ); - std::unique_ptr classedOutput = std::make_unique( QStringLiteral( "OUTPUT" ), QObject::tr( "Layer with index field" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true ); + auto classedOutput = std::make_unique( QStringLiteral( "OUTPUT" ), QObject::tr( "Layer with index field" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true ); classedOutput->setCreateByDefault( true ); addParameter( classedOutput.release() ); - std::unique_ptr summaryOutput = std::make_unique( QStringLiteral( "SUMMARY_OUTPUT" ), QObject::tr( "Class summary" ), Qgis::ProcessingSourceType::Vector, QVariant(), true ); + auto summaryOutput = std::make_unique( QStringLiteral( "SUMMARY_OUTPUT" ), QObject::tr( "Class summary" ), Qgis::ProcessingSourceType::Vector, QVariant(), true ); summaryOutput->setCreateByDefault( false ); addParameter( summaryOutput.release() ); } diff --git a/src/analysis/processing/qgsalgorithmvirtualrastercalculator.cpp b/src/analysis/processing/qgsalgorithmvirtualrastercalculator.cpp index 4492f1a020e5..829aea541dc2 100644 --- a/src/analysis/processing/qgsalgorithmvirtualrastercalculator.cpp +++ b/src/analysis/processing/qgsalgorithmvirtualrastercalculator.cpp @@ -64,13 +64,13 @@ void QgsVirtualRasterCalculatorAlgorithm::initAlgorithm( const QVariantMap & ) { addParameter( new QgsProcessingParameterMultipleLayers( QStringLiteral( "LAYERS" ), QObject::tr( "Input layers" ), Qgis::ProcessingSourceType::Raster ) ); addParameter( new QgsProcessingParameterExpression( QStringLiteral( "EXPRESSION" ), QObject::tr( "Expression" ), QVariant(), QStringLiteral( "LAYERS" ), false, Qgis::ExpressionType::RasterCalculator ) ); - std::unique_ptr extentParam = std::make_unique( QStringLiteral( "EXTENT" ), QObject::tr( "Output extent" ), QVariant(), true ); + auto extentParam = std::make_unique( QStringLiteral( "EXTENT" ), QObject::tr( "Output extent" ), QVariant(), true ); extentParam->setHelp( QObject::tr( "Extent of the output layer. If not specified, the extent will be the overall extent of all input layers" ) ); addParameter( extentParam.release() ); - std::unique_ptr cellSizeParam = std::make_unique( QStringLiteral( "CELL_SIZE" ), QObject::tr( "Output cell size (leave empty to set automatically)" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0.0 ); + auto cellSizeParam = std::make_unique( QStringLiteral( "CELL_SIZE" ), QObject::tr( "Output cell size (leave empty to set automatically)" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0.0 ); cellSizeParam->setHelp( QObject::tr( "Cell size of the output layer. If not specified, the smallest cell size from the input layers will be used" ) ); addParameter( cellSizeParam.release() ); - std::unique_ptr crsParam = std::make_unique( QStringLiteral( "CRS" ), QObject::tr( "Output CRS" ), QVariant(), true ); + auto crsParam = std::make_unique( QStringLiteral( "CRS" ), QObject::tr( "Output CRS" ), QVariant(), true ); crsParam->setHelp( QObject::tr( "CRS of the output layer. If not specified, the CRS of the first input layer will be used" ) ); addParameter( crsParam.release() ); addParameter( new QgsProcessingParameterString( QStringLiteral( "LAYER_NAME" ), QObject::tr( "Output layer name" ), QVariant(), false, true ) ); diff --git a/src/analysis/processing/qgsalgorithmvoronoipolygons.cpp b/src/analysis/processing/qgsalgorithmvoronoipolygons.cpp index 2c4db392e3cf..3a946f833abe 100644 --- a/src/analysis/processing/qgsalgorithmvoronoipolygons.cpp +++ b/src/analysis/processing/qgsalgorithmvoronoipolygons.cpp @@ -204,7 +204,7 @@ QString QgsVoronoiPolygonsAlgorithm::voronoiWithoutAttributes( const QVariantMap if ( !sink ) throw QgsProcessingException( invalidSinkError( parameters, QStringLiteral( "OUTPUT" ) ) ); - std::unique_ptr points = std::make_unique(); + auto points = std::make_unique(); long long i = 0; const double step = mSource->featureCount() > 0 ? 50.0 / mSource->featureCount() : 1; diff --git a/src/analysis/processing/qgsalgorithmwedgebuffers.cpp b/src/analysis/processing/qgsalgorithmwedgebuffers.cpp index e487bb38bca9..2e0ce1624b82 100644 --- a/src/analysis/processing/qgsalgorithmwedgebuffers.cpp +++ b/src/analysis/processing/qgsalgorithmwedgebuffers.cpp @@ -92,25 +92,25 @@ QgsWedgeBuffersAlgorithm *QgsWedgeBuffersAlgorithm::createInstance() const void QgsWedgeBuffersAlgorithm::initParameters( const QVariantMap & ) { - std::unique_ptr azimuth = std::make_unique( QStringLiteral( "AZIMUTH" ), QObject::tr( "Azimuth (degrees from North)" ), Qgis::ProcessingNumberParameterType::Double, 0, false ); + auto azimuth = std::make_unique( QStringLiteral( "AZIMUTH" ), QObject::tr( "Azimuth (degrees from North)" ), Qgis::ProcessingNumberParameterType::Double, 0, false ); azimuth->setIsDynamic( true ); azimuth->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "Azimuth" ), QObject::tr( "Azimuth (degrees from North)" ), QgsPropertyDefinition::Double ) ); azimuth->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( azimuth.release() ); - std::unique_ptr width = std::make_unique( QStringLiteral( "WIDTH" ), QObject::tr( "Wedge width (in degrees)" ), Qgis::ProcessingNumberParameterType::Double, 45, false, 0, 360.0 ); + auto width = std::make_unique( QStringLiteral( "WIDTH" ), QObject::tr( "Wedge width (in degrees)" ), Qgis::ProcessingNumberParameterType::Double, 45, false, 0, 360.0 ); width->setIsDynamic( true ); width->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "Width" ), QObject::tr( "Wedge width (in degrees)" ), QgsPropertyDefinition::DoublePositive ) ); width->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( width.release() ); - std::unique_ptr outerRadius = std::make_unique( QStringLiteral( "OUTER_RADIUS" ), QObject::tr( "Outer radius" ), Qgis::ProcessingNumberParameterType::Double, 1, false, 0 ); + auto outerRadius = std::make_unique( QStringLiteral( "OUTER_RADIUS" ), QObject::tr( "Outer radius" ), Qgis::ProcessingNumberParameterType::Double, 1, false, 0 ); outerRadius->setIsDynamic( true ); outerRadius->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "Outer radius" ), QObject::tr( "Outer radius" ), QgsPropertyDefinition::DoublePositive ) ); outerRadius->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); addParameter( outerRadius.release() ); - std::unique_ptr innerRadius = std::make_unique( QStringLiteral( "INNER_RADIUS" ), QObject::tr( "Inner radius" ), Qgis::ProcessingNumberParameterType::Double, 0, true, 0 ); + auto innerRadius = std::make_unique( QStringLiteral( "INNER_RADIUS" ), QObject::tr( "Inner radius" ), Qgis::ProcessingNumberParameterType::Double, 0, true, 0 ); innerRadius->setIsDynamic( true ); innerRadius->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "Inner radius" ), QObject::tr( "Inner radius" ), QgsPropertyDefinition::DoublePositive ) ); innerRadius->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) ); @@ -172,7 +172,7 @@ QgsFeatureList QgsWedgeBuffersAlgorithm::processFeature( const QgsFeature &featu if ( QgsWkbTypes::isMultiType( g.wkbType() ) ) { const QgsMultiPoint *mp = static_cast( g.constGet() ); - std::unique_ptr result = std::make_unique(); + auto result = std::make_unique(); result->reserve( mp->numGeometries() ); for ( int i = 0; i < mp->numGeometries(); ++i ) { diff --git a/src/analysis/processing/qgsalgorithmwritevectortiles.cpp b/src/analysis/processing/qgsalgorithmwritevectortiles.cpp index 522f5a10f475..0491b622c63e 100644 --- a/src/analysis/processing/qgsalgorithmwritevectortiles.cpp +++ b/src/analysis/processing/qgsalgorithmwritevectortiles.cpp @@ -157,7 +157,7 @@ void QgsWriteVectorTilesMbtilesAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterString( QStringLiteral( "META_DESCRIPTION" ), QObject::tr( "Metadata: Description" ), QVariant(), false, true ) ); addParameter( new QgsProcessingParameterString( QStringLiteral( "META_ATTRIBUTION" ), QObject::tr( "Metadata: Attribution" ), QVariant(), false, true ) ); addParameter( new QgsProcessingParameterString( QStringLiteral( "META_VERSION" ), QObject::tr( "Metadata: Version" ), QVariant(), false, true ) ); - std::unique_ptr metaTypeParam = std::make_unique( QStringLiteral( "META_TYPE" ), QObject::tr( "Metadata: Type" ), QVariant(), false, true ); + auto metaTypeParam = std::make_unique( QStringLiteral( "META_TYPE" ), QObject::tr( "Metadata: Type" ), QVariant(), false, true ); metaTypeParam->setMetadata( { { QStringLiteral( "widget_wrapper" ), QVariantMap( { { QStringLiteral( "value_hints" ), QStringList() << QStringLiteral( "overlay" ) << QStringLiteral( "baselayer" ) } } ) } } ); addParameter( metaTypeParam.release() ); diff --git a/src/analysis/processing/qgsalgorithmxyztiles.cpp b/src/analysis/processing/qgsalgorithmxyztiles.cpp index 3f73218fdccf..77dbb6370f53 100644 --- a/src/analysis/processing/qgsalgorithmxyztiles.cpp +++ b/src/analysis/processing/qgsalgorithmxyztiles.cpp @@ -149,7 +149,15 @@ bool QgsXyzTilesBaseAlgorithm::prepareAlgorithm( const QVariantMap ¶meters, QgsRectangle extent = parameterAsExtent( parameters, QStringLiteral( "EXTENT" ), context ); QgsCoordinateReferenceSystem extentCrs = parameterAsExtentCrs( parameters, QStringLiteral( "EXTENT" ), context ); QgsCoordinateTransform ct( extentCrs, project->crs(), context.transformContext() ); - mExtent = ct.transformBoundingBox( extent ); + try + { + mExtent = ct.transformBoundingBox( extent ); + } + catch ( QgsCsException & ) + { + feedback->reportError( QObject::tr( "Could not transform the extent into the project CRS" ), true ); + return false; + } mMinZoom = parameterAsInt( parameters, QStringLiteral( "ZOOM_MIN" ), context ); mMaxZoom = parameterAsInt( parameters, QStringLiteral( "ZOOM_MAX" ), context ); @@ -167,8 +175,15 @@ bool QgsXyzTilesBaseAlgorithm::prepareAlgorithm( const QVariantMap ¶meters, mMercatorCrs = QgsCoordinateReferenceSystem( "EPSG:3857" ); mSrc2Wgs = QgsCoordinateTransform( project->crs(), mWgs84Crs, context.transformContext() ); mWgs2Mercator = QgsCoordinateTransform( mWgs84Crs, mMercatorCrs, context.transformContext() ); - - mWgs84Extent = mSrc2Wgs.transformBoundingBox( mExtent ); + try + { + mWgs84Extent = mSrc2Wgs.transformBoundingBox( mExtent ); + } + catch ( QgsCsException & ) + { + feedback->reportError( QObject::tr( "Could not transform the extent into WGS84" ), true ); + return false; + } if ( parameters.contains( QStringLiteral( "TILE_WIDTH" ) ) ) { @@ -212,7 +227,14 @@ void QgsXyzTilesBaseAlgorithm::startJobs() MetaTile metaTile = mMetaTiles.takeFirst(); QgsMapSettings settings; - settings.setExtent( mWgs2Mercator.transformBoundingBox( metaTile.extent() ) ); + try + { + settings.setExtent( mWgs2Mercator.transformBoundingBox( metaTile.extent() ) ); + } + catch ( QgsCsException & ) + { + continue; + } settings.setOutputImageFormat( QImage::Format_ARGB32_Premultiplied ); settings.setTransformContext( mTransformContext ); settings.setDestinationCrs( mMercatorCrs ); @@ -275,13 +297,13 @@ void QgsXyzTilesDirectoryAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterNumber( QStringLiteral( "TILE_HEIGHT" ), QObject::tr( "Tile height" ), Qgis::ProcessingNumberParameterType::Integer, 256, false, 1, 4096 ) ); addParameter( new QgsProcessingParameterBoolean( QStringLiteral( "TMS_CONVENTION" ), QObject::tr( "Use inverted tile Y axis (TMS convention)" ), false ) ); - std::unique_ptr titleParam = std::make_unique( QStringLiteral( "HTML_TITLE" ), QObject::tr( "Leaflet HTML output title" ), QVariant(), false, true ); + auto titleParam = std::make_unique( QStringLiteral( "HTML_TITLE" ), QObject::tr( "Leaflet HTML output title" ), QVariant(), false, true ); titleParam->setFlags( titleParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( titleParam.release() ); - std::unique_ptr attributionParam = std::make_unique( QStringLiteral( "HTML_ATTRIBUTION" ), QObject::tr( "Leaflet HTML output attribution" ), QVariant(), false, true ); + auto attributionParam = std::make_unique( QStringLiteral( "HTML_ATTRIBUTION" ), QObject::tr( "Leaflet HTML output attribution" ), QVariant(), false, true ); attributionParam->setFlags( attributionParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( attributionParam.release() ); - std::unique_ptr osmParam = std::make_unique( QStringLiteral( "HTML_OSM" ), QObject::tr( "Include OpenStreetMap basemap in Leaflet HTML output" ), false ); + auto osmParam = std::make_unique( QStringLiteral( "HTML_OSM" ), QObject::tr( "Include OpenStreetMap basemap in Leaflet HTML output" ), false ); osmParam->setFlags( osmParam->flags() | Qgis::ProcessingParameterFlag::Advanced ); addParameter( osmParam.release() ); diff --git a/src/analysis/processing/qgsalgorithmzonalhistogram.cpp b/src/analysis/processing/qgsalgorithmzonalhistogram.cpp index 26203597ddf8..7d3ddcc04a76 100644 --- a/src/analysis/processing/qgsalgorithmzonalhistogram.cpp +++ b/src/analysis/processing/qgsalgorithmzonalhistogram.cpp @@ -68,7 +68,7 @@ QgsZonalHistogramAlgorithm *QgsZonalHistogramAlgorithm::createInstance() const return new QgsZonalHistogramAlgorithm(); } -bool QgsZonalHistogramAlgorithm::prepareAlgorithm( const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingFeedback * ) +bool QgsZonalHistogramAlgorithm::prepareAlgorithm( const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) { QgsRasterLayer *layer = parameterAsRasterLayer( parameters, QStringLiteral( "INPUT_RASTER" ), context ); if ( !layer ) @@ -84,6 +84,21 @@ bool QgsZonalHistogramAlgorithm::prepareAlgorithm( const QVariantMap ¶meters mCellSizeY = std::abs( layer->rasterUnitsPerPixelX() ); mNbCellsXProvider = mRasterInterface->xSize(); mNbCellsYProvider = mRasterInterface->ySize(); + Qgis::DataType dataType = mRasterInterface->dataType( mRasterBand ); + + switch ( dataType ) + { + case Qgis::DataType::Byte: + case Qgis::DataType::Int16: + case Qgis::DataType::UInt16: + case Qgis::DataType::Int32: + case Qgis::DataType::UInt32: + break; + default: + feedback->pushWarning( QObject::tr( "The input raster is a floating-point raster. Such rasters are not suitable for use with zonal histogram algorithm.\n" + "Please use Round raster or Reclassify by table tools to reduce number of decimal places or define histogram bins." ) ); + break; + } return true; } diff --git a/src/analysis/processing/qgsbookmarkalgorithms.cpp b/src/analysis/processing/qgsbookmarkalgorithms.cpp index 8fd4330d6f5b..f2d8bbee74c2 100644 --- a/src/analysis/processing/qgsbookmarkalgorithms.cpp +++ b/src/analysis/processing/qgsbookmarkalgorithms.cpp @@ -26,7 +26,7 @@ void QgsBookmarksToLayerAlgorithm::initAlgorithm( const QVariantMap & ) { - std::unique_ptr sourceParam = std::make_unique( QStringLiteral( "SOURCE" ), QObject::tr( "Bookmark source" ), QStringList() << QObject::tr( "Project bookmarks" ) << QObject::tr( "User bookmarks" ), true, QVariantList() << 0 << 1 ); + auto sourceParam = std::make_unique( QStringLiteral( "SOURCE" ), QObject::tr( "Bookmark source" ), QStringList() << QObject::tr( "Project bookmarks" ) << QObject::tr( "User bookmarks" ), true, QVariantList() << 0 << 1 ); QVariantMap wrapperMetadata; wrapperMetadata.insert( QStringLiteral( "useCheckBoxes" ), true ); QVariantMap metadata; @@ -169,7 +169,7 @@ void QgsLayerToBookmarksAlgorithm::initAlgorithm( const QVariantMap & ) { addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorLine ) << static_cast( Qgis::ProcessingSourceType::VectorPolygon ) ) ); - std::unique_ptr sourceParam = std::make_unique( QStringLiteral( "DESTINATION" ), QObject::tr( "Bookmark destination" ), QStringList() << QObject::tr( "Project bookmarks" ) << QObject::tr( "User bookmarks" ), false, 0 ); + auto sourceParam = std::make_unique( QStringLiteral( "DESTINATION" ), QObject::tr( "Bookmark destination" ), QStringList() << QObject::tr( "Project bookmarks" ) << QObject::tr( "User bookmarks" ), false, 0 ); addParameter( sourceParam.release() ); addParameter( new QgsProcessingParameterExpression( QStringLiteral( "NAME_EXPRESSION" ), QObject::tr( "Name field" ), QVariant(), QStringLiteral( "INPUT" ) ) ); diff --git a/src/analysis/processing/qgsmetadataalgorithms.cpp b/src/analysis/processing/qgsmetadataalgorithms.cpp index 3ef7d07b8f88..4214800bb06f 100644 --- a/src/analysis/processing/qgsmetadataalgorithms.cpp +++ b/src/analysis/processing/qgsmetadataalgorithms.cpp @@ -440,7 +440,7 @@ void QgsSetMetadataFieldsAlgorithm::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterString( QStringLiteral( "LANGUAGE" ), QObject::tr( "Language" ), QVariant(), false, true ) ); addParameter( new QgsProcessingParameterString( QStringLiteral( "ENCODING" ), QObject::tr( "Encoding" ), QVariant(), false, true ) ); addParameter( new QgsProcessingParameterString( QStringLiteral( "ABSTRACT" ), QObject::tr( "Abstract" ), QVariant(), true, true ) ); - addParameter( new QgsProcessingParameterCrs( QStringLiteral( "CRS" ), QObject::tr( "Coordinatem reference system" ), QVariant(), true ) ); + addParameter( new QgsProcessingParameterCrs( QStringLiteral( "CRS" ), QObject::tr( "Coordinate reference system" ), QVariant(), true ) ); addParameter( new QgsProcessingParameterString( QStringLiteral( "FEES" ), QObject::tr( "Fees" ), QVariant(), false, true ) ); addParameter( new QgsProcessingParameterBoolean( QStringLiteral( "IGNORE_EMPTY" ), QObject::tr( "Ignore empty fields" ), false ) ); addOutput( new QgsProcessingOutputMapLayer( QStringLiteral( "OUTPUT" ), QObject::tr( "Updated" ) ) ); diff --git a/src/analysis/processing/qgsrasteranalysisutils.cpp b/src/analysis/processing/qgsrasteranalysisutils.cpp index 4ffbf69f9b3d..e9a8d47baa38 100644 --- a/src/analysis/processing/qgsrasteranalysisutils.cpp +++ b/src/analysis/processing/qgsrasteranalysisutils.cpp @@ -57,7 +57,7 @@ void QgsRasterAnalysisUtils::cellInfoForBBox( const QgsRectangle &rasterBBox, co void QgsRasterAnalysisUtils::statisticsFromMiddlePointTest( QgsRasterInterface *rasterInterface, int rasterBand, const QgsGeometry &poly, int nCellsX, int nCellsY, double cellSizeX, double cellSizeY, const QgsRectangle &rasterBBox, const std::function &addValue, bool skipNodata ) { - std::unique_ptr polyEngine = std::make_unique( poly.constGet() ); + auto polyEngine = std::make_unique( poly.constGet() ); if ( !polyEngine ) { return; diff --git a/src/analysis/processing/qgsreclassifyutils.cpp b/src/analysis/processing/qgsreclassifyutils.cpp index 39c5080a1072..dd38eacacad1 100644 --- a/src/analysis/processing/qgsreclassifyutils.cpp +++ b/src/analysis/processing/qgsreclassifyutils.cpp @@ -80,7 +80,7 @@ void QgsReclassifyUtils::reclassify( const QVectorsetProgress( 100 * ( ( iterTop / maxHeight * nbBlocksWidth ) + iterLeft / maxWidth ) / nbBlocks ); if ( feedback && feedback->isCanceled() ) break; - std::unique_ptr reclassifiedBlock = std::make_unique( destinationRaster->dataType( 1 ), iterCols, iterRows ); + auto reclassifiedBlock = std::make_unique( destinationRaster->dataType( 1 ), iterCols, iterRows ); for ( int row = 0; row < iterRows; row++ ) { diff --git a/src/analysis/raster/qgsrastercalcnode.cpp b/src/analysis/raster/qgsrastercalcnode.cpp index c976fa5ae06b..680f9d4150ab 100644 --- a/src/analysis/raster/qgsrastercalcnode.cpp +++ b/src/analysis/raster/qgsrastercalcnode.cpp @@ -224,7 +224,7 @@ bool QgsRasterCalcNode::calculate( QMap &rasterData, std::vector> matrixContainer; for ( int i = 0; i < mFunctionArgs.size(); ++i ) { - std::unique_ptr singleMatrix = std::make_unique( result.nColumns(), result.nRows(), nullptr, result.nodataValue() ); + auto singleMatrix = std::make_unique( result.nColumns(), result.nRows(), nullptr, result.nodataValue() ); if ( !mFunctionArgs.at( i ) || !mFunctionArgs.at( i )->calculate( rasterData, *singleMatrix, row ) ) { return false; @@ -472,7 +472,7 @@ QgsRasterMatrix QgsRasterCalcNode::evaluateFunction( const std::vectornColumns(); int nRows = matrixVector.at( 0 )->nRows(); int nEntries = nCols * nRows; - std::unique_ptr dataResult = std::make_unique( nEntries ); + auto dataResult = std::make_unique( nEntries ); double *dataResultRawPtr = dataResult.get(); double *condition = matrixVector.at( 0 )->data(); diff --git a/src/analysis/raster/qgsrastercalculator.cpp b/src/analysis/raster/qgsrastercalculator.cpp index 0769c82e7695..dbd91e0d2b7c 100644 --- a/src/analysis/raster/qgsrastercalculator.cpp +++ b/src/analysis/raster/qgsrastercalculator.cpp @@ -79,6 +79,11 @@ QgsRasterCalculator::QgsRasterCalculator( const QString &formulaString, const QS , mRasterEntries( rasterEntries ) , mTransformContext( transformContext ) { + //default to first layer's crs + if ( !mRasterEntries.isEmpty() ) + { + mOutputCrs = mRasterEntries.at( 0 ).raster->crs(); + } } QgsRasterCalculator::QgsRasterCalculator( const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, const QgsCoordinateReferenceSystem &outputCrs, int nOutputColumns, int nOutputRows, const QVector &rasterEntries, const QgsCoordinateTransformContext &transformContext ) @@ -105,7 +110,10 @@ QgsRasterCalculator::QgsRasterCalculator( const QString &formulaString, const QS , mRasterEntries( rasterEntries ) { //default to first layer's crs - mOutputCrs = mRasterEntries.at( 0 ).raster->crs(); + if ( !mRasterEntries.isEmpty() ) + { + mOutputCrs = mRasterEntries.at( 0 ).raster->crs(); + } mTransformContext = QgsProject::instance()->transformContext(); } @@ -438,10 +446,10 @@ QgsRasterCalculator::Result QgsRasterCalculator::processCalculationGPU( std::uni entry.typeName = QStringLiteral( "unsigned char" ); break; case Qgis::DataType::Int8: - entry.typeName = QStringLiteral( "signed char" ); + entry.typeName = QStringLiteral( "char" ); break; case Qgis::DataType::UInt16: - entry.typeName = QStringLiteral( "unsigned int" ); + entry.typeName = QStringLiteral( "unsigned short" ); break; case Qgis::DataType::Int16: entry.typeName = QStringLiteral( "short" ); @@ -536,7 +544,7 @@ QgsRasterCalculator::Result QgsRasterCalculator::processCalculationGPU( std::uni programTemplate = programTemplate.replace( QLatin1String( "##EXPRESSION##" ), cExpression ); programTemplate = programTemplate.replace( QLatin1String( "##EXPRESSION_ORIGINAL##" ), calcNode->toString() ); - //qDebug() << programTemplate; + // qDebug() << programTemplate; // Create a program from the kernel source cl::Program program( QgsOpenClUtils::buildProgram( programTemplate, QgsOpenClUtils::ExceptionBehavior::Throw ) ); diff --git a/src/analysis/raster/qgsrastercalculator.h b/src/analysis/raster/qgsrastercalculator.h index 79a246956253..ab8530e291a3 100644 --- a/src/analysis/raster/qgsrastercalculator.h +++ b/src/analysis/raster/qgsrastercalculator.h @@ -88,6 +88,21 @@ class ANALYSIS_EXPORT QgsRasterCalculator }; + /** + * QgsRasterCalculator constructor. + * \param formulaString formula for raster calculation + * \param outputFile output file path + * \param outputFormat output file format + * \param outputExtent output extent, CRS is specified by outputCrs parameter + * \param outputCrs destination CRS for output raster + * \param nOutputColumns number of columns in output raster + * \param nOutputRows number of rows in output raster + * \param rasterEntries list of referenced raster layers + * \param transformContext coordinate transformation context + * \since QGIS 3.8 + */ + QgsRasterCalculator( const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, const QgsCoordinateReferenceSystem &outputCrs, int nOutputColumns, int nOutputRows, const QVector &rasterEntries, const QgsCoordinateTransformContext &transformContext ); + /** * QgsRasterCalculator constructor. * \param formulaString formula for raster calculation @@ -112,11 +127,9 @@ class ANALYSIS_EXPORT QgsRasterCalculator * \param nOutputColumns number of columns in output raster * \param nOutputRows number of rows in output raster * \param rasterEntries list of referenced raster layers - * \param transformContext coordinate transformation context - * \since QGIS 3.8 + * \deprecated QGIS 3.8. Use the version with transformContext instead. */ - QgsRasterCalculator( const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, const QgsCoordinateReferenceSystem &outputCrs, int nOutputColumns, int nOutputRows, const QVector &rasterEntries, const QgsCoordinateTransformContext &transformContext ); - + Q_DECL_DEPRECATED QgsRasterCalculator( const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, const QgsCoordinateReferenceSystem &outputCrs, int nOutputColumns, int nOutputRows, const QVector &rasterEntries ) SIP_DEPRECATED; /** * QgsRasterCalculator constructor. @@ -131,20 +144,6 @@ class ANALYSIS_EXPORT QgsRasterCalculator */ Q_DECL_DEPRECATED QgsRasterCalculator( const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, int nOutputColumns, int nOutputRows, const QVector &rasterEntries ) SIP_DEPRECATED; - /** - * QgsRasterCalculator constructor. - * \param formulaString formula for raster calculation - * \param outputFile output file path - * \param outputFormat output file format - * \param outputExtent output extent, CRS is specified by outputCrs parameter - * \param outputCrs destination CRS for output raster - * \param nOutputColumns number of columns in output raster - * \param nOutputRows number of rows in output raster - * \param rasterEntries list of referenced raster layers - * \deprecated QGIS 3.8. Use the version with transformContext instead. - */ - Q_DECL_DEPRECATED QgsRasterCalculator( const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, const QgsCoordinateReferenceSystem &outputCrs, int nOutputColumns, int nOutputRows, const QVector &rasterEntries ) SIP_DEPRECATED; - /** * Starts the calculation and writes a new raster. * diff --git a/src/analysis/vector/geometry_checker/qgsgeometrygapcheck.cpp b/src/analysis/vector/geometry_checker/qgsgeometrygapcheck.cpp index 06d78b9ad210..eab0c93572cd 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometrygapcheck.cpp +++ b/src/analysis/vector/geometry_checker/qgsgeometrygapcheck.cpp @@ -398,7 +398,7 @@ bool QgsGeometryGapCheck::mergeWithNeighbor( const QMap snappedErrGeom = std::make_unique(); + auto snappedErrGeom = std::make_unique(); snappedErrGeom->setExteriorRing( new QgsLineString( snappedRing ) ); // Merge geometries diff --git a/src/analysis/vector/geometry_checker/qgsgeometrymissingvertexcheck.cpp b/src/analysis/vector/geometry_checker/qgsgeometrymissingvertexcheck.cpp index 8672d9021f9b..47e00606a868 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometrymissingvertexcheck.cpp +++ b/src/analysis/vector/geometry_checker/qgsgeometrymissingvertexcheck.cpp @@ -129,7 +129,7 @@ QString QgsGeometryMissingVertexCheck::description() const void QgsGeometryMissingVertexCheck::processPolygon( const QgsCurvePolygon *polygon, QgsFeaturePool *featurePool, QList &errors, const QgsGeometryCheckerUtils::LayerFeature &layerFeature, QgsFeedback *feedback ) const { const QgsFeature ¤tFeature = layerFeature.feature(); - std::unique_ptr boundaries = std::make_unique(); + auto boundaries = std::make_unique(); std::unique_ptr geomEngine( QgsGeometry::createGeometryEngine( polygon->exteriorRing()->clone(), mContext->tolerance ) ); boundaries->addGeometry( geomEngine->buffer( mContext->tolerance, 5 ) ); @@ -181,7 +181,7 @@ void QgsGeometryMissingVertexCheck::processPolygon( const QgsCurvePolygon *polyg } if ( !alreadyReported ) { - std::unique_ptr error = std::make_unique( this, layerFeature, QgsPointXY( pt ) ); + auto error = std::make_unique( this, layerFeature, QgsPointXY( pt ) ); error->setAffectedAreaBBox( contextBoundingBox( polygon, vertexId, pt ) ); QMap involvedFeatures; involvedFeatures[layerFeature.layerId()].insert( layerFeature.feature().id() ); diff --git a/src/analysis/vector/geometry_checker/qgsgeometryselfintersectioncheck.cpp b/src/analysis/vector/geometry_checker/qgsgeometryselfintersectioncheck.cpp index f0663152e5ef..14fe7994cdbe 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometryselfintersectioncheck.cpp +++ b/src/analysis/vector/geometry_checker/qgsgeometryselfintersectioncheck.cpp @@ -155,9 +155,9 @@ void QgsGeometrySelfIntersectionCheck::fixError( const QMapsetFixFailed( tr( "Resulting geometry is degenerate" ) ); return; } - std::unique_ptr ringGeom1 = std::make_unique(); + auto ringGeom1 = std::make_unique(); ringGeom1->setPoints( ring1 ); - std::unique_ptr ringGeom2 = std::make_unique(); + auto ringGeom2 = std::make_unique(); ringGeom2->setPoints( ring2 ); QgsAbstractGeometry *part = QgsGeometryCheckerUtils::getGeomPart( geom, vidx.part ); @@ -216,7 +216,7 @@ void QgsGeometrySelfIntersectionCheck::fixError( const QMap multiPoly = std::make_unique(); + auto multiPoly = std::make_unique(); multiPoly->addGeometry( poly->clone() ); multiPoly->addGeometry( poly2.release() ); feature.setGeometry( QgsGeometry( std::move( multiPoly ) ) ); diff --git a/src/analysis/vector/qgsgeometrysnapper.cpp b/src/analysis/vector/qgsgeometrysnapper.cpp index d263bb2e7a7e..8b2908fa56b5 100644 --- a/src/analysis/vector/qgsgeometrysnapper.cpp +++ b/src/analysis/vector/qgsgeometrysnapper.cpp @@ -474,11 +474,11 @@ QgsGeometry QgsGeometrySnapper::snapGeometry( const QgsGeometry &geometry, doubl return result; } - std::unique_ptr subjSnapIndex( new QgsSnapIndex() ); + auto subjSnapIndex = std::make_unique(); subjSnapIndex->addGeometry( subjGeom ); std::unique_ptr origSubjGeom( subjGeom->clone() ); - std::unique_ptr origSubjSnapIndex( new QgsSnapIndex() ); + auto origSubjSnapIndex = std::make_unique(); origSubjSnapIndex->addGeometry( origSubjGeom.get() ); // Pass 2: add missing vertices to subject geometry diff --git a/src/app/3d/qgs3danimationwidget.cpp b/src/app/3d/qgs3danimationwidget.cpp index 76fc396c5edf..2e1e531f1769 100644 --- a/src/app/3d/qgs3danimationwidget.cpp +++ b/src/app/3d/qgs3danimationwidget.cpp @@ -191,7 +191,7 @@ void Qgs3DAnimationWidget::onExportAnimation() if ( dialog.exec() == QDialog::Accepted ) { QgsFeedback progressFeedback; - std::unique_ptr progressTask = std::make_unique( tr( "Exporting animation" ) ); + auto progressTask = std::make_unique( tr( "Exporting animation" ) ); QProgressDialog progressDialog( tr( "Exporting frames..." ), tr( "Abort" ), 0, 100, this ); progressDialog.setWindowModality( Qt::WindowModal ); diff --git a/src/app/3d/qgs3dmapcanvaswidget.cpp b/src/app/3d/qgs3dmapcanvaswidget.cpp index f21c393fac73..de90a987da83 100644 --- a/src/app/3d/qgs3dmapcanvaswidget.cpp +++ b/src/app/3d/qgs3dmapcanvaswidget.cpp @@ -47,6 +47,7 @@ #include "qgs3dmapsettings.h" #include "qgs3dmaptoolidentify.h" #include "qgs3dmaptoolmeasureline.h" +#include "qgs3dmaptoolpointcloudchangeattribute.h" #include "qgs3dnavigationwidget.h" #include "qgs3ddebugwidget.h" #include "qgs3dutils.h" @@ -57,6 +58,7 @@ #include "qgsdockablewidgethelper.h" #include "qgsrubberband.h" +#include "qgspointcloudlayer.h" #include #include @@ -67,6 +69,9 @@ Qgs3DMapCanvasWidget::Qgs3DMapCanvasWidget( const QString &name, bool isDocked ) { const QgsSettings setting; + mToolbarMenu = new QMenu( tr( "Toolbars" ), this ); + mToolbarMenu->setObjectName( QStringLiteral( "mToolbarMenu" ) ); + QToolBar *toolBar = new QToolBar( this ); toolBar->setIconSize( QgisApp::instance()->iconSize( isDocked ) ); @@ -75,6 +80,23 @@ Qgs3DMapCanvasWidget::Qgs3DMapCanvasWidget( const QString &name, bool isDocked ) toolBar->addAction( QgsApplication::getThemeIcon( QStringLiteral( "mActionZoomFullExtent.svg" ) ), tr( "Zoom Full" ), this, &Qgs3DMapCanvasWidget::resetView ); + // Editing toolbar + mEditingToolBar = new QToolBar( this ); + mEditingToolBar->setWindowTitle( tr( "Editing Toolbar" ) ); + mEditingToolBar->setVisible( false ); + + QAction *actionPointCloudChangeAttributeTool = mEditingToolBar->addAction( QIcon( QgsApplication::iconPath( "mActionSelectPolygon.svg" ) ), tr( "Change Point Cloud Attribute" ), this, &Qgs3DMapCanvasWidget::changePointCloudAttribute ); + actionPointCloudChangeAttributeTool->setCheckable( true ); + + mEditingToolBar->addWidget( new QLabel( tr( "Attribute" ) ) ); + mCboChangeAttribute = new QComboBox(); + mEditingToolBar->addWidget( mCboChangeAttribute ); + mSpinChangeAttributeValue = new QgsDoubleSpinBox(); + mEditingToolBar->addWidget( new QLabel( tr( "Value" ) ) ); + mEditingToolBar->addWidget( mSpinChangeAttributeValue ); + connect( mCboChangeAttribute, qOverload( &QComboBox::currentIndexChanged ), this, [this]( int ) { onPointCloudChangeAttributeSettingsChanged(); } ); + connect( mSpinChangeAttributeValue, qOverload( &QgsDoubleSpinBox::valueChanged ), this, [this]( double ) { onPointCloudChangeAttributeSettingsChanged(); } ); + QAction *toggleOnScreenNavigation = toolBar->addAction( QgsApplication::getThemeIcon( QStringLiteral( "mAction3DNavigation.svg" ) ), tr( "Toggle On-Screen Navigation" ) @@ -99,8 +121,8 @@ Qgs3DMapCanvasWidget::Qgs3DMapCanvasWidget( const QString &name, bool isDocked ) actionGroup->addAction( actionCameraControl ); actionGroup->addAction( actionIdentify ); actionGroup->addAction( actionMeasurementTool ); + actionGroup->addAction( actionPointCloudChangeAttributeTool ); actionGroup->setExclusive( true ); - actionCameraControl->setChecked( true ); mActionAnim = toolBar->addAction( QIcon( QgsApplication::iconPath( "mTaskRunning.svg" ) ), tr( "Animations" ), this, &Qgs3DMapCanvasWidget::toggleAnimations ); mActionAnim->setCheckable( true ); @@ -237,6 +259,8 @@ Qgs3DMapCanvasWidget::Qgs3DMapCanvasWidget( const QString &name, bool isDocked ) mMapToolMeasureLine = new Qgs3DMapToolMeasureLine( mCanvas ); + mMapToolPointCloudChangeAttribute = new Qgs3DMapToolPointCloudChangeAttribute( mCanvas ); + mLabelPendingJobs = new QLabel( this ); mProgressPendingJobs = new QProgressBar( this ); mProgressPendingJobs->setRange( 0, 0 ); @@ -271,6 +295,7 @@ Qgs3DMapCanvasWidget::Qgs3DMapCanvasWidget( const QString &name, bool isDocked ) layout->setContentsMargins( 0, 0, 0, 0 ); layout->setSpacing( 0 ); layout->addLayout( topLayout ); + layout->addWidget( mEditingToolBar ); layout->addWidget( mMessageBar ); // mContainer takes ownership of Qgs3DMapCanvas @@ -317,6 +342,26 @@ Qgs3DMapCanvasWidget::Qgs3DMapCanvasWidget( const QString &name, bool isDocked ) connect( dockAction, &QAction::toggled, this, [=]( const bool isSmallSize ) { toolBar->setIconSize( QgisApp::instance()->iconSize( isSmallSize ) ); } ); + + updateLayerRelatedActions( QgisApp::instance()->activeLayer() ); + + QList toolbarMenuActions; + // Set action names so that they can be used in customization + for ( QToolBar *toolBar : { mEditingToolBar } ) + { + toolBar->toggleViewAction()->setObjectName( "mActionToggle" + toolBar->objectName().mid( 1 ) ); + toolbarMenuActions << toolBar->toggleViewAction(); + } + + // sort actions in toolbar menu + std::sort( toolbarMenuActions.begin(), toolbarMenuActions.end(), []( QAction *a, QAction *b ) { + return QString::localeAwareCompare( a->text(), b->text() ) < 0; + } ); + + mToolbarMenu->addActions( toolbarMenuActions ); + + toolBar->installEventFilter( this ); + mEditingToolBar->installEventFilter( this ); } Qgs3DMapCanvasWidget::~Qgs3DMapCanvasWidget() @@ -377,12 +422,78 @@ void Qgs3DMapCanvasWidget::measureLine() mCanvas->setMapTool( action->isChecked() ? mMapToolMeasureLine : nullptr ); } +void Qgs3DMapCanvasWidget::changePointCloudAttribute() +{ + QAction *action = qobject_cast( sender() ); + if ( !action ) + return; + + mCanvas->setMapTool( action->isChecked() ? mMapToolPointCloudChangeAttribute : nullptr ); +} + void Qgs3DMapCanvasWidget::setCanvasName( const QString &name ) { mCanvasName = name; mDockableWidgetHelper->setWindowTitle( name ); } +void Qgs3DMapCanvasWidget::enableEditingTools( bool enable ) +{ + mEditingToolBar->setEnabled( enable ); +} + +void Qgs3DMapCanvasWidget::updateLayerRelatedActions( QgsMapLayer *layer ) +{ + if ( !layer || layer->type() != Qgis::LayerType::PointCloud ) + { + enableEditingTools( false ); + + if ( mCanvas->mapTool() == mMapToolPointCloudChangeAttribute ) + mCanvas->setMapTool( nullptr ); + + return; + } + + QgsPointCloudLayer *pcLayer = qobject_cast( layer ); + const QVector attributes = pcLayer->attributes().attributes(); + const QString previousAttribute = mCboChangeAttribute->currentText(); + whileBlocking( mCboChangeAttribute )->clear(); + for ( const QgsPointCloudAttribute &attribute : attributes ) + { + if ( attribute.name() == QLatin1String( "X" ) || attribute.name() == QLatin1String( "Y" ) || attribute.name() == QLatin1String( "Z" ) ) + continue; + + whileBlocking( mCboChangeAttribute )->addItem( attribute.name() ); + } + + int index = mCboChangeAttribute->findText( previousAttribute ); + if ( index < 0 ) + index = mCboChangeAttribute->findText( QStringLiteral( "Classification" ) ); + mCboChangeAttribute->setCurrentIndex( std::max( index, 0 ) ); + + enableEditingTools( pcLayer->isEditable() ); +} + +bool Qgs3DMapCanvasWidget::eventFilter( QObject *watched, QEvent *event ) +{ + if ( qobject_cast< QToolBar * >( watched ) ) + { + if ( event->type() != QEvent::MouseButtonPress ) + return QObject::eventFilter( watched, event ); + + QMouseEvent *mouseEvent = dynamic_cast( event ); + if ( !mouseEvent ) + return QObject::eventFilter( watched, event ); + + if ( mouseEvent->button() != Qt::RightButton ) + return QObject::eventFilter( watched, event ); + + mToolbarMenu->exec( mouseEvent->globalPos() ); + return false; + } + return QObject::eventFilter( watched, event ); +} + void Qgs3DMapCanvasWidget::toggleNavigationWidget( bool visibility ) { mNavigationWidget->setVisible( visibility ); @@ -734,6 +845,129 @@ void Qgs3DMapCanvasWidget::onGpuMemoryLimitReached() mGpuMemoryLimitReachedReported = true; } +void Qgs3DMapCanvasWidget::onPointCloudChangeAttributeSettingsChanged() +{ + const QString attributeName = mCboChangeAttribute->currentText(); + + if ( attributeName == QLatin1String( "Intensity" ) ) + { + mSpinChangeAttributeValue->setMinimum( 0 ); + mSpinChangeAttributeValue->setMaximum( 65535 ); + mSpinChangeAttributeValue->setDecimals( 0 ); + } + else if ( attributeName == QLatin1String( "ReturnNumber" ) ) + { + mSpinChangeAttributeValue->setMinimum( 0 ); + mSpinChangeAttributeValue->setMaximum( 15 ); + mSpinChangeAttributeValue->setDecimals( 0 ); + } + else if ( attributeName == QLatin1String( "NumberOfReturns" ) ) + { + mSpinChangeAttributeValue->setMinimum( 0 ); + mSpinChangeAttributeValue->setMaximum( 15 ); + mSpinChangeAttributeValue->setDecimals( 0 ); + } + else if ( attributeName == QLatin1String( "Synthetic" ) ) + { + mSpinChangeAttributeValue->setMinimum( 0 ); + mSpinChangeAttributeValue->setMaximum( 1 ); + mSpinChangeAttributeValue->setDecimals( 0 ); + } + else if ( attributeName == QLatin1String( "KeyPoint" ) ) + { + mSpinChangeAttributeValue->setMinimum( 0 ); + mSpinChangeAttributeValue->setMaximum( 1 ); + mSpinChangeAttributeValue->setDecimals( 0 ); + } + else if ( attributeName == QLatin1String( "Withheld" ) ) + { + mSpinChangeAttributeValue->setMinimum( 0 ); + mSpinChangeAttributeValue->setMaximum( 1 ); + mSpinChangeAttributeValue->setDecimals( 0 ); + } + else if ( attributeName == QLatin1String( "Overlap" ) ) + { + mSpinChangeAttributeValue->setMinimum( 0 ); + mSpinChangeAttributeValue->setMaximum( 1 ); + mSpinChangeAttributeValue->setDecimals( 0 ); + } + else if ( attributeName == QLatin1String( "ScannerChannel" ) ) + { + mSpinChangeAttributeValue->setMinimum( 0 ); + mSpinChangeAttributeValue->setMaximum( 3 ); + mSpinChangeAttributeValue->setDecimals( 0 ); + } + else if ( attributeName == QLatin1String( "ScanDirectionFlag" ) ) + { + mSpinChangeAttributeValue->setMinimum( 0 ); + mSpinChangeAttributeValue->setMaximum( 1 ); + mSpinChangeAttributeValue->setDecimals( 0 ); + } + else if ( attributeName == QLatin1String( "EdgeOfFlightLine" ) ) + { + mSpinChangeAttributeValue->setMinimum( 0 ); + mSpinChangeAttributeValue->setMaximum( 1 ); + mSpinChangeAttributeValue->setDecimals( 0 ); + } + else if ( attributeName == QLatin1String( "Classification" ) ) + { + mSpinChangeAttributeValue->setMinimum( 0 ); + mSpinChangeAttributeValue->setMaximum( 255 ); + mSpinChangeAttributeValue->setDecimals( 0 ); + } + else if ( attributeName == QLatin1String( "UserData" ) ) + { + mSpinChangeAttributeValue->setMinimum( 0 ); + mSpinChangeAttributeValue->setMaximum( 255 ); + mSpinChangeAttributeValue->setDecimals( 0 ); + } + else if ( attributeName == QLatin1String( "ScanAngleRank" ) ) + { + mSpinChangeAttributeValue->setMinimum( -30'000 ); + mSpinChangeAttributeValue->setMaximum( 30'000 ); + mSpinChangeAttributeValue->setDecimals( 0 ); + } + else if ( attributeName == QLatin1String( "PointSourceId" ) ) + { + mSpinChangeAttributeValue->setMinimum( 0 ); + mSpinChangeAttributeValue->setMaximum( 65535 ); + mSpinChangeAttributeValue->setDecimals( 0 ); + } + else if ( attributeName == QLatin1String( "GpsTime" ) ) + { + mSpinChangeAttributeValue->setMinimum( 0 ); + mSpinChangeAttributeValue->setMaximum( std::numeric_limits::max() ); + mSpinChangeAttributeValue->setDecimals( 42 ); + } + else if ( attributeName == QLatin1String( "Red" ) ) + { + mSpinChangeAttributeValue->setMinimum( 0 ); + mSpinChangeAttributeValue->setMaximum( 65535 ); + mSpinChangeAttributeValue->setDecimals( 0 ); + } + else if ( attributeName == QLatin1String( "Green" ) ) + { + mSpinChangeAttributeValue->setMinimum( 0 ); + mSpinChangeAttributeValue->setMaximum( 65535 ); + mSpinChangeAttributeValue->setDecimals( 0 ); + } + else if ( attributeName == QLatin1String( "Blue" ) ) + { + mSpinChangeAttributeValue->setMinimum( 0 ); + mSpinChangeAttributeValue->setMaximum( 65535 ); + mSpinChangeAttributeValue->setDecimals( 0 ); + } + else if ( attributeName == QLatin1String( "Infrared" ) ) + { + mSpinChangeAttributeValue->setMinimum( 0 ); + mSpinChangeAttributeValue->setMaximum( 65535 ); + mSpinChangeAttributeValue->setDecimals( 0 ); + } + + mMapToolPointCloudChangeAttribute->setAttribute( attributeName ); + mMapToolPointCloudChangeAttribute->setNewValue( mSpinChangeAttributeValue->value() ); +} + void Qgs3DMapCanvasWidget::setSceneExtentOn2DCanvas() { if ( !qobject_cast( mMainCanvas->mapTool() ) ) diff --git a/src/app/3d/qgs3dmapcanvaswidget.h b/src/app/3d/qgs3dmapcanvaswidget.h index 0a941879998d..f60659d50db7 100644 --- a/src/app/3d/qgs3dmapcanvaswidget.h +++ b/src/app/3d/qgs3dmapcanvaswidget.h @@ -16,14 +16,16 @@ #ifndef QGS3DMAPCANVASWIDGET_H #define QGS3DMAPCANVASWIDGET_H -#include "qmenu.h" #include "qgsdockwidget.h" #include "qgis_app.h" #include "qobjectuniqueptr.h" -#include "qtoolbutton.h" #include "qgsrectangle.h" +#include +#include #include +#include +#include #define SIP_NO_FILE @@ -35,14 +37,17 @@ class Qgs3DMapCanvas; class Qgs3DMapSettings; class Qgs3DMapToolIdentify; class Qgs3DMapToolMeasureLine; +class Qgs3DMapToolPointCloudChangeAttribute; class Qgs3DNavigationWidget; class Qgs3DDebugWidget; +class QgsMapLayer; class QgsMapTool; class QgsMapToolExtent; class QgsMapCanvas; class QgsDockableWidgetHelper; class QgsMessageBar; class QgsRubberBand; +class QgsDoubleSpinBox; class APP_EXPORT Qgs3DMapCanvasWidget : public QWidget { @@ -69,6 +74,13 @@ class APP_EXPORT Qgs3DMapCanvasWidget : public QWidget void showAnimationWidget() { mActionAnim->trigger(); } + void enableEditingTools( bool enable ); + + void updateLayerRelatedActions( QgsMapLayer *layer ); + + bool eventFilter( QObject *watched, QEvent *event ) override; + + private slots: void resetView(); void configure(); @@ -77,6 +89,7 @@ class APP_EXPORT Qgs3DMapCanvasWidget : public QWidget void cameraControl(); void identify(); void measureLine(); + void changePointCloudAttribute(); void exportScene(); void toggleNavigationWidget( bool visibility ); void toggleFpsCounter( bool visibility ); @@ -100,6 +113,8 @@ class APP_EXPORT Qgs3DMapCanvasWidget : public QWidget void onExtentChanged(); void onGpuMemoryLimitReached(); + void onPointCloudChangeAttributeSettingsChanged(); + private: QString mCanvasName; Qgs3DMapCanvas *mCanvas = nullptr; @@ -112,6 +127,7 @@ class APP_EXPORT Qgs3DMapCanvasWidget : public QWidget QTimer *mLabelNavSpeedHideTimeout = nullptr; Qgs3DMapToolIdentify *mMapToolIdentify = nullptr; Qgs3DMapToolMeasureLine *mMapToolMeasureLine = nullptr; + Qgs3DMapToolPointCloudChangeAttribute *mMapToolPointCloudChangeAttribute = nullptr; std::unique_ptr mMapToolExtent; QgsMapTool *mMapToolPrevious = nullptr; QMenu *mExportMenu = nullptr; @@ -144,6 +160,12 @@ class APP_EXPORT Qgs3DMapCanvasWidget : public QWidget Qgs3DNavigationWidget *mNavigationWidget = nullptr; //! On-screen Debug widget Qgs3DDebugWidget *mDebugWidget = nullptr; + + QToolBar *mEditingToolBar = nullptr; + QComboBox *mCboChangeAttribute = nullptr; + QgsDoubleSpinBox *mSpinChangeAttributeValue = nullptr; + + QMenu *mToolbarMenu = nullptr; }; #endif // QGS3DMAPCANVASWIDGET_H diff --git a/src/app/3d/qgs3dmapconfigwidget.cpp b/src/app/3d/qgs3dmapconfigwidget.cpp index fa63fb3a9e7b..00db7b052045 100644 --- a/src/app/3d/qgs3dmapconfigwidget.cpp +++ b/src/app/3d/qgs3dmapconfigwidget.cpp @@ -275,7 +275,7 @@ void Qgs3DMapConfigWidget::apply() case QgsTerrainGenerator::Dem: { - std::unique_ptr demTerrainSettings = std::make_unique(); + auto demTerrainSettings = std::make_unique(); demTerrainSettings->setLayer( qobject_cast( cboTerrainLayer->currentLayer() ) ); demTerrainSettings->setResolution( spinTerrainResolution->value() ); demTerrainSettings->setSkirtHeight( spinTerrainSkirtHeight->value() ); @@ -285,7 +285,7 @@ void Qgs3DMapConfigWidget::apply() case QgsTerrainGenerator::Online: { - std::unique_ptr onlineTerrainSettings = std::make_unique(); + auto onlineTerrainSettings = std::make_unique(); onlineTerrainSettings->setResolution( spinTerrainResolution->value() ); onlineTerrainSettings->setSkirtHeight( spinTerrainSkirtHeight->value() ); terrainSettings = std::move( onlineTerrainSettings ); @@ -294,7 +294,7 @@ void Qgs3DMapConfigWidget::apply() case QgsTerrainGenerator::Mesh: { - std::unique_ptr meshTerrainSettings = std::make_unique(); + auto meshTerrainSettings = std::make_unique(); meshTerrainSettings->setLayer( qobject_cast( cboTerrainLayer->currentLayer() ) ); std::unique_ptr symbol = mMeshSymbolWidget->symbol(); @@ -307,7 +307,7 @@ void Qgs3DMapConfigWidget::apply() case QgsTerrainGenerator::QuantizedMesh: { - std::unique_ptr meshTerrainSettings = std::make_unique(); + auto meshTerrainSettings = std::make_unique(); meshTerrainSettings->setLayer( qobject_cast( cboTerrainLayer->currentLayer() ) ); terrainSettings = std::move( meshTerrainSettings ); diff --git a/src/app/3d/qgs3dmaptoolpointcloudchangeattribute.cpp b/src/app/3d/qgs3dmaptoolpointcloudchangeattribute.cpp new file mode 100644 index 000000000000..1d861ab3a536 --- /dev/null +++ b/src/app/3d/qgs3dmaptoolpointcloudchangeattribute.cpp @@ -0,0 +1,342 @@ +/*************************************************************************** + qgs3dmaptoolpointcloudchangeattribute.cpp + --------------------- + begin : January 2025 + copyright : (C) 2025 by Stefanos Natsis + email : uclaros at gmail dot com + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "qgs3dmaptoolpointcloudchangeattribute.h" +#include "moc_qgs3dmaptoolpointcloudchangeattribute.cpp" +#include "qgs3dmapcanvaswidget.h" +#include "qgs3dmapcanvas.h" +#include "qgs3dmapscene.h" +#include "qgsrubberband3d.h" +#include "qgswindow3dengine.h" +#include "qgsframegraph.h" +#include "qgs3dutils.h" +#include "qgscameracontroller.h" +#include "qgspolygon.h" +#include "qgspointcloudlayer.h" +#include "qgspointcloudlayer3drenderer.h" +#include "qgspointcloudlayerelevationproperties.h" +#include "qgsmultipoint.h" +#include "qgsguiutils.h" +#include "qgisapp.h" +#include "qgschunknode.h" +#include "qgsgeos.h" + +#include + +Qgs3DMapToolPointCloudChangeAttribute::Qgs3DMapToolPointCloudChangeAttribute( Qgs3DMapCanvas *canvas ) + : Qgs3DMapTool( canvas ) +{ +} + +Qgs3DMapToolPointCloudChangeAttribute::~Qgs3DMapToolPointCloudChangeAttribute() = default; + +void Qgs3DMapToolPointCloudChangeAttribute::mousePressEvent( QMouseEvent *event ) +{ + mClickPoint = event->pos(); +} + +void Qgs3DMapToolPointCloudChangeAttribute::mouseMoveEvent( QMouseEvent *event ) +{ + const QgsPoint movedPoint = screenPointToMap( event->pos() ); + mPolygonRubberBand->moveLastPoint( movedPoint ); +} + +void Qgs3DMapToolPointCloudChangeAttribute::keyPressEvent( QKeyEvent *event ) +{ + if ( event->key() == Qt::Key_Backspace || event->key() == Qt::Key_Delete ) + { + if ( mScreenPoints.isEmpty() ) + { + return; + } + else if ( mScreenPoints.size() == 1 ) + { + //removing first point, so restart everything + restart(); + } + else + { + mScreenPoints.removeLast(); + mPolygonRubberBand->removeLastPoint(); + } + } + else if ( event->key() == Qt::Key_Escape ) + { + restart(); + } +} + +void Qgs3DMapToolPointCloudChangeAttribute::mouseReleaseEvent( QMouseEvent *event ) +{ + if ( ( event->pos() - mClickPoint ).manhattanLength() > QApplication::startDragDistance() ) + return; + + const QgsPoint newPoint = screenPointToMap( event->pos() ); + + if ( event->button() == Qt::LeftButton ) + { + if ( mPolygonRubberBand->isEmpty() ) + { + mPolygonRubberBand->addPoint( newPoint ); + mCanvas->cameraController()->setInputHandlersEnabled( false ); + } + mPolygonRubberBand->addPoint( newPoint ); + mScreenPoints.append( QgsPointXY( event->x(), event->y() ) ); + } + else if ( event->button() == Qt::RightButton ) + { + run(); + restart(); + } +} + +void Qgs3DMapToolPointCloudChangeAttribute::activate() +{ + // cannot move this to the costructor as there are no mapSettings available yet when the tool is created + if ( !mPolygonRubberBand ) + { + mPolygonRubberBand = new QgsRubberBand3D( *mCanvas->mapSettings(), mCanvas->engine(), mCanvas->engine()->frameGraph()->rubberBandsRootEntity(), Qgis::GeometryType::Polygon ); + mPolygonRubberBand->setHideLastMarker( true ); + } +} + +void Qgs3DMapToolPointCloudChangeAttribute::deactivate() +{ + restart(); +} + +void Qgs3DMapToolPointCloudChangeAttribute::setAttribute( const QString &attribute ) +{ + mAttributeName = attribute; +} + +void Qgs3DMapToolPointCloudChangeAttribute::setNewValue( double value ) +{ + mNewValue = value; +} + +void Qgs3DMapToolPointCloudChangeAttribute::run() +{ + if ( mScreenPoints.size() < 3 ) + return; + + QgsTemporaryCursorOverride busyCursor( Qt::WaitCursor ); + + const QgsGeometry searchPolygon = QgsGeometry( new QgsPolygon( new QgsLineString( mScreenPoints ) ) ); + QgsGeos preparedPolygon = QgsGeos( searchPolygon.constGet() ); + preparedPolygon.prepareGeometry(); + + QgsMapLayer *mapLayer = QgisApp::instance()->activeLayer(); + Q_ASSERT( mapLayer->type() == Qgis::LayerType::PointCloud ); + QgsPointCloudLayer *pcLayer = qobject_cast( mapLayer ); + const SelectedPoints sel = searchPoints( pcLayer, preparedPolygon ); + + int offset; + const QgsPointCloudAttribute *attribute = pcLayer->attributes().find( mAttributeName, offset ); + + pcLayer->undoStack()->beginMacro( tr( "Change attribute values" ) ); + for ( auto it = sel.begin(); it != sel.end(); ++it ) + { + pcLayer->changeAttributeValue( it.key(), it.value(), *attribute, mNewValue ); + } + pcLayer->undoStack()->endMacro(); +} + +void Qgs3DMapToolPointCloudChangeAttribute::restart() +{ + mCanvas->cameraController()->setInputHandlersEnabled( true ); + mScreenPoints.clear(); + mPolygonRubberBand->reset(); +} + + +QgsPoint Qgs3DMapToolPointCloudChangeAttribute::screenPointToMap( const QPoint &pos ) const +{ + const QgsRay3D ray = Qgs3DUtils::rayFromScreenPoint( pos, mCanvas->size(), mCanvas->cameraController()->camera() ); + + // pick an arbitrary point mid-way between near and far plane + const float pointDistance = ( mCanvas->cameraController()->camera()->farPlane() + mCanvas->cameraController()->camera()->nearPlane() ) / 2; + const QVector3D pointWorld = ray.origin() + pointDistance * ray.direction().normalized(); + + const QgsVector3D origin = mCanvas->mapSettings()->origin(); + const QgsPoint pointMap( pointWorld.x() + origin.x(), pointWorld.y() + origin.y(), pointWorld.z() + origin.z() ); + return pointMap; +} + + +QgsGeometry Qgs3DMapToolPointCloudChangeAttribute::box3DToPolygonInScreenSpace( const QgsBox3D &box, const MapToPixel3D &mapToPixel3D ) +{ + QVector pts; + for ( const QgsVector3D &c : box.corners() ) + { + const QPointF pt = mapToPixel3D.transform( c.x(), c.y(), c.z() ); + pts.append( QgsPointXY( pt.x(), pt.y() ) ); + } + + // TODO: maybe we should only do rectangle check rather than (more precise) convex hull? + + // combine into QgsMultiPoint + apply convex hull + const QgsGeometry g( new QgsMultiPoint( pts ) ); + return g.convexHull(); +} + + +SelectedPoints Qgs3DMapToolPointCloudChangeAttribute::searchPoints( QgsPointCloudLayer *layer, const QgsGeos &searchPolygon ) const +{ + SelectedPoints result; + + MapToPixel3D mapToPixel3D; + mapToPixel3D.VP = mCanvas->camera()->projectionMatrix() * mCanvas->camera()->viewMatrix(); + mapToPixel3D.origin = mCanvas->mapSettings()->origin(); + mapToPixel3D.canvasSize = mCanvas->size(); + + const QVector chunks = mCanvas->scene()->getLayerActiveChunkNodes( layer ); + for ( const QgsChunkNode *chunk : chunks ) + { + // check whether the hull intersects the search polygon + const QgsGeometry hull = box3DToPolygonInScreenSpace( chunk->box3D(), mapToPixel3D ); + if ( !searchPolygon.intersects( hull.constGet() ) ) + continue; + + const QgsPointCloudNodeId n( chunk->tileId().d, chunk->tileId().x, chunk->tileId().y, chunk->tileId().z ); + const QVector pts = selectedPointsInNode( searchPolygon, n, mapToPixel3D, layer ); + if ( !pts.isEmpty() ) + { + result.insert( n, pts ); + } + } + return result; +} + + +QVector Qgs3DMapToolPointCloudChangeAttribute::selectedPointsInNode( const QgsGeos &searchPolygon, const QgsPointCloudNodeId &n, const MapToPixel3D &mapToPixel3D, QgsPointCloudLayer *layer ) const +{ + QVector selected; + + // Get the map's clipping extent in layer crs and skip if empty. We only need points within this extent. + const Qgs3DMapSettings *map = mCanvas->mapSettings(); + const QgsRectangle mapExtent = Qgs3DUtils::tryReprojectExtent2D( map->extent(), map->crs(), layer->crs(), map->transformContext() ); + if ( mapExtent.isEmpty() ) + return selected; + + QgsPointCloudIndex pcIndex = layer->index(); + QgsPointCloudAttributeCollection attributes; + attributes.push_back( QgsPointCloudAttribute( QStringLiteral( "X" ), QgsPointCloudAttribute::Int32 ) ); + attributes.push_back( QgsPointCloudAttribute( QStringLiteral( "Y" ), QgsPointCloudAttribute::Int32 ) ); + attributes.push_back( QgsPointCloudAttribute( QStringLiteral( "Z" ), QgsPointCloudAttribute::Int32 ) ); + + QString categoryAttributeName; + QSet categoryValues; + if ( QgsPointCloudLayer3DRenderer *renderer = dynamic_cast( layer->renderer3D() ) ) + { + if ( const QgsClassificationPointCloud3DSymbol *symbol = dynamic_cast( renderer->symbol() ) ) + { + const QgsPointCloudCategoryList categories = symbol->categoriesList(); + for ( const auto &category : categories ) + { + if ( category.renderState() ) + categoryValues.insert( category.value() ); + } + + const QgsPointCloudAttributeCollection allAttributes = pcIndex.attributes(); + categoryAttributeName = symbol->attribute(); + attributes.extend( allAttributes, { categoryAttributeName } ); + } + } + + // we also need the filter expression so we can exclude filtered out points + QgsPointCloudExpression filterExpression = pcIndex.subsetString(); + attributes.extend( pcIndex.attributes(), filterExpression.referencedAttributes() ); + + QgsPointCloudRequest request; + request.setAttributes( attributes ); + // we want to iterate all points so we have the correct point indexes within the node + request.setIgnoreIndexFilterEnabled( true ); + + // TODO: reuse cached block(s) if possible + + std::unique_ptr block( pcIndex.nodeData( n, request ) ); + + if ( !block ) + return selected; + + const bool filterIsValid = filterExpression.isValid(); + if ( !filterExpression.prepare( block.get() ) && filterIsValid ) + return selected; + + const QgsVector3D blockScale = block->scale(); + const QgsVector3D blockOffset = block->offset(); + + const char *ptr = block->data(); + const QgsPointCloudAttributeCollection blockAttributes = block->attributes(); + const std::size_t recordSize = blockAttributes.pointRecordSize(); + int xOffset = 0, yOffset = 0, zOffset = 0, categoryAttributeOffset = 0; + const QgsPointCloudAttribute::DataType xType = blockAttributes.find( QStringLiteral( "X" ), xOffset )->type(); + const QgsPointCloudAttribute::DataType yType = blockAttributes.find( QStringLiteral( "Y" ), yOffset )->type(); + const QgsPointCloudAttribute::DataType zType = blockAttributes.find( QStringLiteral( "Z" ), zOffset )->type(); + const QgsPointCloudAttribute *categoryAttribute = const_cast( blockAttributes.find( categoryAttributeName, categoryAttributeOffset ) ); + + // we should adjust the Z based on the layer's elevation properties scale and offset + const double layerZScale = static_cast( layer->elevationProperties() )->zScale(); + const double layerZOffset = static_cast( layer->elevationProperties() )->zOffset(); + + QgsPoint pt; + + for ( int i = 0; i < block->pointCount(); ++i ) + { + // ignore filtered out points + if ( filterIsValid ) + { + double eval = filterExpression.evaluate( i ); + if ( eval == 0.0 || std::isnan( eval ) ) + { + continue; + } + } + + // if using categorized renderer, point might not be in a visible category + if ( categoryAttribute ) + { + const double categoryAttributeValue = categoryAttribute->convertValueToDouble( ptr + i * recordSize + categoryAttributeOffset ); + if ( !categoryValues.contains( categoryAttributeValue ) ) + continue; + } + + // get map coordinates + double x, y, z; + QgsPointCloudAttribute::getPointXYZ( ptr, i, recordSize, xOffset, xType, yOffset, yType, zOffset, zType, blockScale, blockOffset, x, y, z ); + z = z * layerZScale + layerZOffset; + + // check if inside map extent + if ( !mapExtent.contains( x, y ) ) + continue; + + // project to screen (map coords -> world coords -> clip coords -> NDC -> screen coords) + bool isInFrustum; + const QPointF ptScreen = mapToPixel3D.transform( x, y, z, &isInFrustum ); + + if ( !isInFrustum ) + continue; + + pt.setX( ptScreen.x() ); + pt.setY( ptScreen.y() ); + + if ( searchPolygon.intersects( &pt ) ) + { + selected.append( i ); + } + } + return selected; +} diff --git a/src/app/3d/qgs3dmaptoolpointcloudchangeattribute.h b/src/app/3d/qgs3dmaptoolpointcloudchangeattribute.h new file mode 100644 index 000000000000..85013d986f3e --- /dev/null +++ b/src/app/3d/qgs3dmaptoolpointcloudchangeattribute.h @@ -0,0 +1,97 @@ +/*************************************************************************** + qgs3dmaptoolpointcloudchangeattribute.h + --------------------- + begin : January 2025 + copyright : (C) 2025 by Stefanos Natsis + email : uclaros at gmail dot com + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef QGS3DMAPTOOLPOINTCLOUDCHANGEATTRIBUTE_H +#define QGS3DMAPTOOLPOINTCLOUDCHANGEATTRIBUTE_H + +#include "qgs3dmaptool.h" +#include "qgspointxy.h" +#include "qgsgeometry.h" +#include "qgspointcloudindex.h" + +#include +#include + +class QgsRubberBand3D; +class QgsPointCloudLayer; +class QgsGeos; + + +struct MapToPixel3D +{ + QMatrix4x4 VP; // combined view-projection matrix + QgsVector3D origin; // shift of world coordinates + QSize canvasSize; + + QPointF transform( double x, double y, double z, bool *isInView = nullptr ) const + { + QVector4D cClip = VP * QVector4D( static_cast( x - origin.x() ), static_cast( y - origin.y() ), static_cast( z - origin.z() ), 1 ); + // normalized device coordinates (-1 to +1) + // z == -1 is near plane, z == +1 is far plane + const float xNdc = cClip.x() / cClip.w(); + const float yNdc = cClip.y() / cClip.w(); + const float zNdc = cClip.z() / cClip.w(); + if ( isInView ) + *isInView = !( zNdc < -1 || zNdc > 1 || yNdc < -1 || yNdc > 1 || zNdc < -1 || xNdc > 1 ); + + // window / sceen space coordinates + const float xScreen = ( xNdc + 1 ) * 0.5f * static_cast( canvasSize.width() ); + const float yScreen = ( -yNdc + 1 ) * 0.5f * static_cast( canvasSize.height() ); + + return QPointF( xScreen, yScreen ); + } +}; + + +typedef QHash > SelectedPoints; + + +class Qgs3DMapToolPointCloudChangeAttribute : public Qgs3DMapTool +{ + Q_OBJECT + + public: + Qgs3DMapToolPointCloudChangeAttribute( Qgs3DMapCanvas *canvas ); + ~Qgs3DMapToolPointCloudChangeAttribute() override; + + void mousePressEvent( QMouseEvent *event ) override; + void mouseReleaseEvent( QMouseEvent *event ) override; + void mouseMoveEvent( QMouseEvent *event ) override; + void keyPressEvent( QKeyEvent *event ) override; + + void activate() override; + void deactivate() override; + + bool allowsCameraControls() const override { return false; } + + void setAttribute( const QString &attribute ); + void setNewValue( double value ); + + private: + void run(); + void restart(); + QgsPoint screenPointToMap( const QPoint &pos ) const; + SelectedPoints searchPoints( QgsPointCloudLayer *layer, const QgsGeos &searchPolygon ) const; + QVector selectedPointsInNode( const QgsGeos &searchPolygon, const QgsPointCloudNodeId &n, const MapToPixel3D &mapToPixel3D, QgsPointCloudLayer *layer ) const; + static QgsGeometry box3DToPolygonInScreenSpace( const QgsBox3D &box, const MapToPixel3D &mapToPixel3D ); + + QVector mScreenPoints; + QgsRubberBand3D *mPolygonRubberBand = nullptr; + QString mAttributeName; + double mNewValue = 0; + QPoint mClickPoint; +}; + +#endif // QGS3DMAPTOOLPOINTCLOUDCHANGEATTRIBUTE_H diff --git a/src/app/3d/qgsgoochmaterialwidget.cpp b/src/app/3d/qgsgoochmaterialwidget.cpp index 3e62f8b27778..49c947745ace 100644 --- a/src/app/3d/qgsgoochmaterialwidget.cpp +++ b/src/app/3d/qgsgoochmaterialwidget.cpp @@ -101,7 +101,7 @@ void QgsGoochMaterialWidget::setTechnique( QgsMaterialSettingsRenderingTechnique QgsAbstractMaterialSettings *QgsGoochMaterialWidget::settings() { - std::unique_ptr m = std::make_unique(); + auto m = std::make_unique(); m->setDiffuse( btnDiffuse->color() ); m->setWarm( btnWarm->color() ); m->setCool( btnCool->color() ); diff --git a/src/app/3d/qgsline3dsymbolwidget.cpp b/src/app/3d/qgsline3dsymbolwidget.cpp index 0accc707ac1c..38938c085c2d 100644 --- a/src/app/3d/qgsline3dsymbolwidget.cpp +++ b/src/app/3d/qgsline3dsymbolwidget.cpp @@ -73,7 +73,7 @@ void QgsLine3DSymbolWidget::setSymbol( const QgsAbstract3DSymbol *symbol, QgsVec QgsAbstract3DSymbol *QgsLine3DSymbolWidget::symbol() { - std::unique_ptr sym = std::make_unique(); + auto sym = std::make_unique(); sym->setWidth( spinWidth->value() ); sym->setOffset( static_cast( spinOffset->value() ) ); sym->setExtrusionHeight( spinExtrusion->value() ); diff --git a/src/app/3d/qgsmetalroughmaterialwidget.cpp b/src/app/3d/qgsmetalroughmaterialwidget.cpp index 2c3ffc08e20c..63c4be8ba889 100644 --- a/src/app/3d/qgsmetalroughmaterialwidget.cpp +++ b/src/app/3d/qgsmetalroughmaterialwidget.cpp @@ -65,7 +65,7 @@ void QgsMetalRoughMaterialWidget::setSettings( const QgsAbstractMaterialSettings QgsAbstractMaterialSettings *QgsMetalRoughMaterialWidget::settings() { - std::unique_ptr m = std::make_unique(); + auto m = std::make_unique(); m->setBaseColor( mButtonBaseColor->color() ); m->setMetalness( static_cast( mSpinMetalness->value() ) ); m->setRoughness( static_cast( mSpinRoughness->value() ) ); diff --git a/src/app/3d/qgsphongmaterialwidget.cpp b/src/app/3d/qgsphongmaterialwidget.cpp index 25522edd5156..e881bdd51f7a 100644 --- a/src/app/3d/qgsphongmaterialwidget.cpp +++ b/src/app/3d/qgsphongmaterialwidget.cpp @@ -135,7 +135,7 @@ void QgsPhongMaterialWidget::setSettings( const QgsAbstractMaterialSettings *set QgsAbstractMaterialSettings *QgsPhongMaterialWidget::settings() { - std::unique_ptr m = std::make_unique(); + auto m = std::make_unique(); m->setDiffuse( btnDiffuse->color() ); m->setAmbient( btnAmbient->color() ); m->setSpecular( btnSpecular->color() ); diff --git a/src/app/3d/qgsphongtexturedmaterialwidget.cpp b/src/app/3d/qgsphongtexturedmaterialwidget.cpp index a555210a7c2d..ca43260f9fab 100644 --- a/src/app/3d/qgsphongtexturedmaterialwidget.cpp +++ b/src/app/3d/qgsphongtexturedmaterialwidget.cpp @@ -68,7 +68,7 @@ void QgsPhongTexturedMaterialWidget::setSettings( const QgsAbstractMaterialSetti QgsAbstractMaterialSettings *QgsPhongTexturedMaterialWidget::settings() { - std::unique_ptr m = std::make_unique(); + auto m = std::make_unique(); m->setAmbient( btnAmbient->color() ); m->setSpecular( btnSpecular->color() ); m->setShininess( spinShininess->value() ); diff --git a/src/app/3d/qgspoint3dsymbolwidget.cpp b/src/app/3d/qgspoint3dsymbolwidget.cpp index d2616c68e3dd..4c6df6ea9345 100644 --- a/src/app/3d/qgspoint3dsymbolwidget.cpp +++ b/src/app/3d/qgspoint3dsymbolwidget.cpp @@ -171,7 +171,7 @@ void QgsPoint3DSymbolWidget::setSymbol( const QgsAbstract3DSymbol *symbol, QgsVe QgsAbstract3DSymbol *QgsPoint3DSymbolWidget::symbol() { QVariantMap vm; - std::unique_ptr sym = std::make_unique(); + auto sym = std::make_unique(); sym->setBillboardSymbol( static_cast( QgsSymbol::defaultSymbol( Qgis::GeometryType::Point ) ) ); switch ( cboShape->currentData().value() ) { diff --git a/src/app/3d/qgspointcloud3dsymbolwidget.cpp b/src/app/3d/qgspointcloud3dsymbolwidget.cpp index d401b5431186..bbd34cc9c9b3 100644 --- a/src/app/3d/qgspointcloud3dsymbolwidget.cpp +++ b/src/app/3d/qgspointcloud3dsymbolwidget.cpp @@ -28,6 +28,7 @@ #include "qgspointcloudclassifiedrendererwidget.h" #include "qgspointcloudlayerelevationproperties.h" #include "qgsstackedwidget.h" +#include "qgsvirtualpointcloudprovider.h" QgsPointCloud3DSymbolWidget::QgsPointCloud3DSymbolWidget( QgsPointCloudLayer *layer, QgsPointCloud3DSymbol *symbol, QWidget *parent ) : QWidget( parent ) @@ -140,6 +141,29 @@ QgsPointCloud3DSymbolWidget::QgsPointCloud3DSymbolWidget( QgsPointCloudLayer *la mPointSizeSpinBox->setToolTip( tr( "The size of each point in pixels" ) ); mMaxScreenErrorSpinBox->setToolTip( tr( "The distance in pixels between the points of the smallest chunk to be rendered.\nRaising this value will result in a less detailed scene which can improve performance" ) ); mPointBudgetSpinBox->setToolTip( tr( "The maximum number of points that will be rendered simultaneously.\nRaising this value may allow missing chunks to be rendered while lowering it may improve performance" ) ); + + if ( !mLayer->dataProvider()->subIndexes().isEmpty() ) + { + mZoomOutOptions->addItem( tr( "Show Extents Only" ), QVariant::fromValue( Qgis::PointCloudZoomOutRenderBehavior::RenderExtents ) ); + if ( const QgsVirtualPointCloudProvider *vpcProvider = dynamic_cast( mLayer->dataProvider() ) ) + { + if ( vpcProvider->overview() ) + { + mZoomOutOptions->addItem( tr( "Show Overview Only" ), QVariant::fromValue( Qgis::PointCloudZoomOutRenderBehavior::RenderOverview ) ); + mZoomOutOptions->addItem( tr( "Show Extents Over Overview" ), QVariant::fromValue( Qgis::PointCloudZoomOutRenderBehavior::RenderOverviewAndExtents ) ); + } + } + else + { + mZoomOutOptions->setEnabled( false ); + } + + connect( mZoomOutOptions, qOverload( &QComboBox::currentIndexChanged ), this, &QgsPointCloud3DSymbolWidget::emitChangedSignal ); + } + else + { + mVpcGroupBox->setVisible( false ); + } } void QgsPointCloud3DSymbolWidget::setSymbol( QgsPointCloud3DSymbol *symbol ) @@ -665,6 +689,16 @@ bool QgsPointCloud3DSymbolWidget::showBoundingBoxes() const return mShowBoundingBoxesCheckBox->isChecked(); } +void QgsPointCloud3DSymbolWidget::setZoomOutBehavior( const Qgis::PointCloudZoomOutRenderBehavior zoomOutBehavior ) +{ + whileBlocking( mZoomOutOptions )->setCurrentIndex( mZoomOutOptions->findData( QVariant::fromValue( zoomOutBehavior ) ) ); +} + +Qgis::PointCloudZoomOutRenderBehavior QgsPointCloud3DSymbolWidget::zoomOutBehavior() const +{ + return mZoomOutOptions->currentData().value(); +} + void QgsPointCloud3DSymbolWidget::connectChildPanels( QgsPanelWidget *parent ) { parent->connectChildPanel( mClassifiedRendererWidget ); diff --git a/src/app/3d/qgspointcloud3dsymbolwidget.h b/src/app/3d/qgspointcloud3dsymbolwidget.h index 387ac2f8cd40..2fef1b011db2 100644 --- a/src/app/3d/qgspointcloud3dsymbolwidget.h +++ b/src/app/3d/qgspointcloud3dsymbolwidget.h @@ -45,6 +45,9 @@ class QgsPointCloud3DSymbolWidget : public QWidget, private Ui::QgsPointCloud3DS void setPointBudget( double budget ); double pointBudget() const; + void setZoomOutBehavior( Qgis::PointCloudZoomOutRenderBehavior zoomOutBehavior ); + Qgis::PointCloudZoomOutRenderBehavior zoomOutBehavior() const; + void connectChildPanels( QgsPanelWidget *parent ); private slots: diff --git a/src/app/3d/qgspointcloudlayer3drendererwidget.cpp b/src/app/3d/qgspointcloudlayer3drendererwidget.cpp index 4e1908f61d0c..0b450a51a1cf 100644 --- a/src/app/3d/qgspointcloudlayer3drendererwidget.cpp +++ b/src/app/3d/qgspointcloudlayer3drendererwidget.cpp @@ -51,6 +51,7 @@ void QgsPointCloudLayer3DRendererWidget::setRenderer( const QgsPointCloudLayer3D mWidgetPointCloudSymbol->setPointBudget( renderer->pointRenderingBudget() ); mWidgetPointCloudSymbol->setMaximumScreenError( renderer->maximumScreenError() ); mWidgetPointCloudSymbol->setShowBoundingBoxes( renderer->showBoundingBoxes() ); + mWidgetPointCloudSymbol->setZoomOutBehavior( renderer->zoomOutBehavior() ); } } @@ -63,6 +64,7 @@ QgsPointCloudLayer3DRenderer *QgsPointCloudLayer3DRendererWidget::renderer() renderer->setPointRenderingBudget( mWidgetPointCloudSymbol->pointBudget() ); renderer->setMaximumScreenError( mWidgetPointCloudSymbol->maximumScreenError() ); renderer->setShowBoundingBoxes( mWidgetPointCloudSymbol->showBoundingBoxes() ); + renderer->setZoomOutBehavior( mWidgetPointCloudSymbol->zoomOutBehavior() ); return renderer; } diff --git a/src/app/3d/qgspolygon3dsymbolwidget.cpp b/src/app/3d/qgspolygon3dsymbolwidget.cpp index 95cff4f26081..be6c140d6805 100644 --- a/src/app/3d/qgspolygon3dsymbolwidget.cpp +++ b/src/app/3d/qgspolygon3dsymbolwidget.cpp @@ -91,7 +91,7 @@ void QgsPolygon3DSymbolWidget::setSymbol( const QgsAbstract3DSymbol *symbol, Qgs QgsAbstract3DSymbol *QgsPolygon3DSymbolWidget::symbol() { - std::unique_ptr sym = std::make_unique(); + auto sym = std::make_unique(); sym->setOffset( static_cast( spinOffset->value() ) ); sym->setExtrusionHeight( spinExtrusion->value() ); sym->setAltitudeClamping( static_cast( cboAltClamping->currentIndex() ) ); diff --git a/src/app/3d/qgssimplelinematerialwidget.cpp b/src/app/3d/qgssimplelinematerialwidget.cpp index 7ffefe85736c..4c44f7abfe63 100644 --- a/src/app/3d/qgssimplelinematerialwidget.cpp +++ b/src/app/3d/qgssimplelinematerialwidget.cpp @@ -50,7 +50,7 @@ void QgsSimpleLineMaterialWidget::setSettings( const QgsAbstractMaterialSettings QgsAbstractMaterialSettings *QgsSimpleLineMaterialWidget::settings() { - std::unique_ptr m = std::make_unique(); + auto m = std::make_unique(); m->setAmbient( btnAmbient->color() ); mPropertyCollection.setProperty( QgsAbstractMaterialSettings::Property::Ambient, mAmbientDataDefinedButton->toProperty() ); diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 9f642ca0dfb1..d279942772c1 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -188,6 +188,9 @@ set(QGIS_APP_SRCS elevation/qgselevationprofilepdfexportdialog.cpp elevation/qgselevationprofiletoolidentify.cpp elevation/qgselevationprofiletoolmeasure.cpp + elevation/qgselevationprofiletooladdpoint.cpp + elevation/qgselevationprofiletoolmovepoint.cpp + elevation/qgselevationprofiletoolselectfeatures.cpp elevation/qgselevationprofilewidget.cpp elevation/qgsmaptoolprofilecurve.cpp elevation/qgsmaptoolprofilecurvefromfeature.cpp @@ -348,6 +351,7 @@ if (WITH_3D) 3d/qgs3dmapconfigwidget.cpp 3d/qgs3dmaptoolidentify.cpp 3d/qgs3dmaptoolmeasureline.cpp + 3d/qgs3dmaptoolpointcloudchangeattribute.cpp 3d/qgs3dmeasuredialog.cpp 3d/qgs3dmodelsourcelineedit.cpp 3d/qgs3dnavigationwidget.cpp diff --git a/src/app/annotations/qgsannotationitempropertieswidget.cpp b/src/app/annotations/qgsannotationitempropertieswidget.cpp index 37770225a04a..9b5d652f6015 100644 --- a/src/app/annotations/qgsannotationitempropertieswidget.cpp +++ b/src/app/annotations/qgsannotationitempropertieswidget.cpp @@ -200,6 +200,10 @@ void QgsAnnotationItemPropertiesWidget::setItemId( const QString &itemId ) mItemWidget->setItemId( itemId ); } } + else + { + mItemWidget->setItemId( itemId ); + } } if ( !setItem ) diff --git a/src/app/browser/qgsinbuiltdataitemproviders.cpp b/src/app/browser/qgsinbuiltdataitemproviders.cpp index 058b3d98dc66..121d0bce532d 100644 --- a/src/app/browser/qgsinbuiltdataitemproviders.cpp +++ b/src/app/browser/qgsinbuiltdataitemproviders.cpp @@ -1021,7 +1021,7 @@ void QgsLayerItemGuiProvider::populateContextMenu( QgsDataItem *item, QMenu *men case Qgis::LayerType::Vector: { const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() }; - std::unique_ptr layer( new QgsVectorLayer( layerItem->uri(), layerItem->name(), layerItem->providerKey(), options ) ); + auto layer = std::make_unique( layerItem->uri(), layerItem->name(), layerItem->providerKey(), options ); if ( layer && layer->isValid() ) { QgisApp::instance()->saveAsFile( layer.get(), false, false ); @@ -1031,7 +1031,7 @@ void QgsLayerItemGuiProvider::populateContextMenu( QgsDataItem *item, QMenu *men case Qgis::LayerType::Raster: { - std::unique_ptr layer( new QgsRasterLayer( layerItem->uri(), layerItem->name(), layerItem->providerKey() ) ); + auto layer = std::make_unique( layerItem->uri(), layerItem->name(), layerItem->providerKey() ); if ( layer && layer->isValid() ) { QgisApp::instance()->saveAsFile( layer.get(), false, false ); @@ -1900,7 +1900,7 @@ bool QgsDatabaseItemGuiProvider::handleDrop( QgsDataItem *item, QgsDataItemGuiCo bool hasError = false; // Main task - std::unique_ptr mainTask( new QgsTaskWithSerialSubTasks( tr( "Layer import" ) ) ); + auto mainTask = std::make_unique( tr( "Layer import" ) ); bool hasSubTasks = false; const QgsMimeDataUtils::UriList lst = QgsMimeDataUtils::decodeUriList( data ); diff --git a/src/app/decorations/qgsdecorationscalebar.cpp b/src/app/decorations/qgsdecorationscalebar.cpp index e8a831b910bc..543e8a146f8b 100644 --- a/src/app/decorations/qgsdecorationscalebar.cpp +++ b/src/app/decorations/qgsdecorationscalebar.cpp @@ -151,11 +151,11 @@ void QgsDecorationScaleBar::setupScaleBar() case 0: case 1: { - std::unique_ptr tickStyle = std::make_unique(); + auto tickStyle = std::make_unique(); tickStyle->setTickPosition( mStyleIndex == 0 ? QgsTicksScaleBarRenderer::TicksDown : QgsTicksScaleBarRenderer::TicksUp ); mStyle = std::move( tickStyle ); - std::unique_ptr fillSymbol = std::make_unique(); + auto fillSymbol = std::make_unique(); fillSymbol->setColor( mColor ); // Compatibility with pre 3.2 configuration if ( QgsSimpleFillSymbolLayer *fill = dynamic_cast( fillSymbol->symbolLayer( 0 ) ) ) { @@ -163,7 +163,7 @@ void QgsDecorationScaleBar::setupScaleBar() } mSettings.setFillSymbol( fillSymbol.release() ); - std::unique_ptr lineSymbol = std::make_unique(); + auto lineSymbol = std::make_unique(); lineSymbol->setColor( mColor ); // Compatibility with pre 3.2 configuration lineSymbol->setWidth( 0.3 ); lineSymbol->setOutputUnit( Qgis::RenderUnit::Millimeters ); @@ -178,7 +178,7 @@ void QgsDecorationScaleBar::setupScaleBar() mStyle = std::make_unique(); - std::unique_ptr fillSymbol = std::make_unique(); + auto fillSymbol = std::make_unique(); fillSymbol->setColor( mColor ); if ( QgsSimpleFillSymbolLayer *fill = dynamic_cast( fillSymbol->symbolLayer( 0 ) ) ) { @@ -186,7 +186,7 @@ void QgsDecorationScaleBar::setupScaleBar() } mSettings.setFillSymbol( fillSymbol.release() ); - std::unique_ptr fillSymbol2 = std::make_unique(); + auto fillSymbol2 = std::make_unique(); fillSymbol2->setColor( QColor( 255, 255, 255, 0 ) ); if ( QgsSimpleFillSymbolLayer *fill = dynamic_cast( fillSymbol2->symbolLayer( 0 ) ) ) { @@ -195,7 +195,7 @@ void QgsDecorationScaleBar::setupScaleBar() mSettings.setAlternateFillSymbol( fillSymbol2.release() ); mSettings.setHeight( mStyleIndex == 2 ? 1 : 3 ); - std::unique_ptr lineSymbol = std::make_unique(); + auto lineSymbol = std::make_unique(); lineSymbol->setColor( mOutlineColor ); // Compatibility with pre 3.2 configuration lineSymbol->setWidth( mStyleIndex == 2 ? 0.2 : 0.3 ); lineSymbol->setOutputUnit( Qgis::RenderUnit::Millimeters ); diff --git a/src/app/devtools/networklogger/qgsnetworklogger.cpp b/src/app/devtools/networklogger/qgsnetworklogger.cpp index 4d7dc56b88b2..7d0775584dfe 100644 --- a/src/app/devtools/networklogger/qgsnetworklogger.cpp +++ b/src/app/devtools/networklogger/qgsnetworklogger.cpp @@ -79,7 +79,7 @@ void QgsNetworkLogger::requestAboutToBeCreated( QgsNetworkRequestParameters para beginInsertRows( QModelIndex(), childCount, childCount ); - std::unique_ptr group = std::make_unique( parameters ); + auto group = std::make_unique( parameters ); mRequestGroups.insert( parameters.requestId(), group.get() ); mRootNode->addChild( std::move( group ) ); endInsertRows(); diff --git a/src/app/devtools/networklogger/qgsnetworkloggernode.cpp b/src/app/devtools/networklogger/qgsnetworkloggernode.cpp index 317ff3534199..f0b6a45c9069 100644 --- a/src/app/devtools/networklogger/qgsnetworkloggernode.cpp +++ b/src/app/devtools/networklogger/qgsnetworkloggernode.cpp @@ -72,7 +72,7 @@ QgsNetworkLoggerRequestGroup::QgsNetworkLoggerRequestGroup( const QgsNetworkRequ mHeaders.append( qMakePair( QString( header ), QString( request.request().rawHeader( header ) ) ) ); } - std::unique_ptr detailsGroup = std::make_unique( request ); + auto detailsGroup = std::make_unique( request ); mDetailsGroup = static_cast( addChild( std::move( detailsGroup ) ) ); mTimer.start(); @@ -273,7 +273,7 @@ void QgsNetworkLoggerRequestGroup::setReply( const QgsNetworkReplyContent &reply mContentType = reply.rawHeader( "Content - Type" ); mReplyFromCache = reply.attribute( QNetworkRequest::SourceIsFromCacheAttribute ).toBool(); - std::unique_ptr replyGroup = std::make_unique( reply ); + auto replyGroup = std::make_unique( reply ); mReplyGroup = static_cast( addChild( std::move( replyGroup ) ) ); } @@ -294,7 +294,7 @@ void QgsNetworkLoggerRequestGroup::setSslErrors( const QList &errors mHasSslErrors = !errors.empty(); if ( mHasSslErrors ) { - std::unique_ptr errorGroup = std::make_unique( errors ); + auto errorGroup = std::make_unique( errors ); mSslErrorsGroup = static_cast( addChild( std::move( errorGroup ) ) ); } } @@ -373,11 +373,11 @@ QgsNetworkLoggerRequestDetailsGroup::QgsNetworkLoggerRequestDetailsGroup( const if ( !QUrlQuery( request.request().url() ).queryItems().isEmpty() ) { - std::unique_ptr queryGroup = std::make_unique( request.request().url() ); + auto queryGroup = std::make_unique( request.request().url() ); mQueryGroup = static_cast( addChild( std::move( queryGroup ) ) ); } - std::unique_ptr requestHeadersGroup = std::make_unique( request ); + auto requestHeadersGroup = std::make_unique( request ); mRequestHeaders = static_cast( addChild( std::move( requestHeadersGroup ) ) ); switch ( request.operation() ) @@ -389,7 +389,7 @@ QgsNetworkLoggerRequestDetailsGroup::QgsNetworkLoggerRequestDetailsGroup( const case QNetworkAccessManager::PostOperation: case QNetworkAccessManager::PutOperation: { - std::unique_ptr postContentGroup = std::make_unique( request ); + auto postContentGroup = std::make_unique( request ); mPostContent = static_cast( addChild( std::move( postContentGroup ) ) ); break; } @@ -400,7 +400,7 @@ QgsNetworkLoggerRequestDetailsGroup::QgsNetworkLoggerRequestDetailsGroup( const { if ( !request.content().isEmpty() ) { - std::unique_ptr postContentGroup = std::make_unique( request ); + auto postContentGroup = std::make_unique( request ); mPostContent = static_cast( addChild( std::move( postContentGroup ) ) ); } break; @@ -477,7 +477,7 @@ QgsNetworkLoggerReplyGroup::QgsNetworkLoggerReplyGroup( const QgsNetworkReplyCon } addKeyValueNode( QObject::tr( "Cache (result)" ), reply.attribute( QNetworkRequest::SourceIsFromCacheAttribute ).toBool() ? QObject::tr( "Used entry from cache" ) : QObject::tr( "Read from network" ) ); - std::unique_ptr headersGroup = std::make_unique( reply ); + auto headersGroup = std::make_unique( reply ); mReplyHeaders = static_cast( addChild( std::move( headersGroup ) ) ); } diff --git a/src/app/devtools/querylogger/qgsappquerylogger.cpp b/src/app/devtools/querylogger/qgsappquerylogger.cpp index a112ab640f47..a8dad382b013 100644 --- a/src/app/devtools/querylogger/qgsappquerylogger.cpp +++ b/src/app/devtools/querylogger/qgsappquerylogger.cpp @@ -53,7 +53,7 @@ void QgsAppQueryLogger::queryLogged( const QgsDatabaseQueryLogEntry &query ) beginInsertRows( QModelIndex(), childCount, childCount ); - std::unique_ptr group = std::make_unique( query ); + auto group = std::make_unique( query ); mQueryGroups.insert( query.queryId, group.get() ); mRootNode->addChild( std::move( group ) ); endInsertRows(); diff --git a/src/app/devtools/querylogger/qgsdatabasequeryloggernode.cpp b/src/app/devtools/querylogger/qgsdatabasequeryloggernode.cpp index 15eb4eb76bca..2dc20c1c38d9 100644 --- a/src/app/devtools/querylogger/qgsdatabasequeryloggernode.cpp +++ b/src/app/devtools/querylogger/qgsdatabasequeryloggernode.cpp @@ -65,7 +65,7 @@ QgsDatabaseQueryLoggerQueryGroup::QgsDatabaseQueryLoggerQueryGroup( const QgsDat , mQueryId( query.queryId ) { #if 0 - std::unique_ptr< QgsNetworkLoggerRequestDetailsGroup > detailsGroup = std::make_unique< QgsNetworkLoggerRequestDetailsGroup >( request ); + auto detailsGroup = std::make_unique< QgsNetworkLoggerRequestDetailsGroup >( request ); mDetailsGroup = detailsGroup.get(); addChild( std::move( detailsGroup ) ); #endif diff --git a/src/app/dwg/qgsdwgimportdialog.cpp b/src/app/dwg/qgsdwgimportdialog.cpp index 8d4cbc1ccae4..06eca8c4a812 100644 --- a/src/app/dwg/qgsdwgimportdialog.cpp +++ b/src/app/dwg/qgsdwgimportdialog.cpp @@ -186,7 +186,7 @@ void QgsDwgImportDialog::pbLoadDatabase_clicked() QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() }; options.loadDefaultStyle = false; - std::unique_ptr d( new QgsVectorLayer( QStringLiteral( "%1|layername=drawing" ).arg( mDatabaseFileWidget->filePath() ), QStringLiteral( "layers" ), QStringLiteral( "ogr" ), options ) ); + auto d = std::make_unique( QStringLiteral( "%1|layername=drawing" ).arg( mDatabaseFileWidget->filePath() ), QStringLiteral( "layers" ), QStringLiteral( "ogr" ), options ); if ( d && d->isValid() ) { const int idxPath = d->fields().lookupField( QStringLiteral( "path" ) ); @@ -227,7 +227,7 @@ void QgsDwgImportDialog::pbLoadDatabase_clicked() lblMessage->setVisible( lblVisible ); - std::unique_ptr l( new QgsVectorLayer( QStringLiteral( "%1|layername=layers" ).arg( mDatabaseFileWidget->filePath() ), QStringLiteral( "layers" ), QStringLiteral( "ogr" ), options ) ); + auto l = std::make_unique( QStringLiteral( "%1|layername=layers" ).arg( mDatabaseFileWidget->filePath() ), QStringLiteral( "layers" ), QStringLiteral( "ogr" ), options ); if ( l && l->isValid() ) { const int idxName = l->fields().lookupField( QStringLiteral( "name" ) ); diff --git a/src/app/dwg/qgsdwgimporter.cpp b/src/app/dwg/qgsdwgimporter.cpp index 5d68c1b54097..d0126edc2a89 100644 --- a/src/app/dwg/qgsdwgimporter.cpp +++ b/src/app/dwg/qgsdwgimporter.cpp @@ -631,7 +631,7 @@ bool QgsDwgImporter::import( const QString &drawing, QString &error, bool doExpa if ( fi.suffix().compare( QLatin1String( "dxf" ), Qt::CaseInsensitive ) == 0 ) { //loads dxf - std::unique_ptr dxf( new dxfRW( drawing.toLocal8Bit() ) ); + auto dxf = std::make_unique( drawing.toLocal8Bit() ); if ( !dxf->read( this, true ) ) { result = DRW::BAD_UNKNOWN; @@ -640,7 +640,7 @@ bool QgsDwgImporter::import( const QString &drawing, QString &error, bool doExpa else if ( fi.suffix().compare( QLatin1String( "dwg" ), Qt::CaseInsensitive ) == 0 ) { //loads dwg - std::unique_ptr dwg( new dwgR( drawing.toLocal8Bit() ) ); + auto dwg = std::make_unique( drawing.toLocal8Bit() ); if ( !dwg->read( this, true ) ) { result = dwg->getError(); diff --git a/src/app/elevation/qgselevationprofiletooladdpoint.cpp b/src/app/elevation/qgselevationprofiletooladdpoint.cpp new file mode 100644 index 000000000000..290a7ee841b7 --- /dev/null +++ b/src/app/elevation/qgselevationprofiletooladdpoint.cpp @@ -0,0 +1,156 @@ +/*************************************************************************** + qgselevationprofiletooladdpoint.cpp + --------------- + begin : September 2024 + copyright : (C) 2024 by Simon Lopez + email : simon dot lopez at free dot fr +***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "qgselevationprofiletooladdpoint.h" +#include "moc_qgselevationprofiletooladdpoint.cpp" +#include "qgsmessagebar.h" +#include "qgsplotmouseevent.h" +#include "qgsapplication.h" +#include "qgselevationprofilecanvas.h" +#include "qgisapp.h" +#include "qgsvectorlayer.h" +#include "qgsfeatureaction.h" +#include "qgssettingsregistrycore.h" + +QgsElevationProfileToolAddPoint::QgsElevationProfileToolAddPoint( QgsElevationProfileCanvas *canvas ) + : QgsPlotTool( canvas, tr( "Add Point Feature" ) ) +{ + setCursor( QgsApplication::getThemeCursor( QgsApplication::Cursor::CapturePoint ) ); +} + +QgsElevationProfileToolAddPoint::~QgsElevationProfileToolAddPoint() = default; + +void QgsElevationProfileToolAddPoint::plotReleaseEvent( QgsPlotMouseEvent *event ) +{ + event->ignore(); + if ( event->button() != Qt::LeftButton ) + { + return; + } + + if ( !mLayer ) + { + return; + } + + if ( !mLayer->isEditable() ) + { + QgisApp::instance()->messageBar()->pushWarning( tr( "Add point" ), tr( "Could not add point: layer is not editable" ) ); + return; + } + + const Qgis::WkbType layerWKBType = mLayer->wkbType(); + + const QgsPoint mapPoint = toMapCoordinates( event->snappedPoint() ); + const QgsGeometry geometry( std::make_unique( mapPoint ) ); + if ( geometry.isNull() || geometry.isEmpty() ) + { + QgisApp::instance()->messageBar()->pushWarning( tr( "Add point" ), tr( "Could not add point: no profile curve" ) ); + QgsDebugError( QStringLiteral( "Could not add point with no geometry" ) ); + return; + } + + QgsGeometry layerGeometry; + double defaultZ = QgsSettingsRegistryCore::settingsDigitizingDefaultZValue->value(); + double defaultM = QgsSettingsRegistryCore::settingsDigitizingDefaultMValue->value(); + QVector layerGeometries = geometry.coerceToType( layerWKBType, defaultZ, defaultM ); + if ( layerGeometries.count() > 0 ) + { + layerGeometry = layerGeometries.at( 0 ); + } + + if ( layerGeometry.wkbType() != layerWKBType && layerGeometry.wkbType() != QgsWkbTypes::linearType( layerWKBType ) ) + { + QgsDebugError( QStringLiteral( "The digitized geometry type (%1) does not correspond to the layer geometry type (%2)." ).arg( QgsWkbTypes::displayString( layerGeometry.wkbType() ), QgsWkbTypes::displayString( layerWKBType ) ) ); + return; + } + + QgsCoordinateTransform transform( mCanvas->crs(), mLayer->crs3D(), QgsProject::instance()->transformContext() ); + transform.setBallparkTransformsAreAppropriate( true ); + try + { + layerGeometry.transform( transform, Qgis::TransformDirection::Forward, true ); + } + catch ( QgsCsException &cse ) + { + Q_UNUSED( cse ) + QgsDebugError( QStringLiteral( "Caught CRS exception %1" ).arg( cse.what() ) ); + return; + } + + QgsFeature feature( mLayer->fields(), 0 ); + feature.setGeometry( layerGeometry ); + feature.setValid( true ); + + QgsFeatureAction *action = new QgsFeatureAction( tr( "add feature" ), feature, mLayer, QUuid(), -1, this ); + const QgsFeatureAction::AddFeatureResult res = action->addFeature( QgsAttributeMap(), true, nullptr, false, nullptr ); + if ( res != QgsFeatureAction::AddFeatureResult::Success ) + { + QgsDebugError( QStringLiteral( "Unable to create new feature" ) ); + } + delete action; +} + +void QgsElevationProfileToolAddPoint::setLayer( QgsVectorLayer *layer ) +{ + if ( layer == mLayer ) + { + return; + } + + if ( mLayer ) + { + disconnect( mLayer, &QgsVectorLayer::editingStarted, this, &QgsElevationProfileToolAddPoint::toggleAction ); + disconnect( mLayer, &QgsVectorLayer::editingStopped, this, &QgsElevationProfileToolAddPoint::toggleAction ); + } + + mLayer = layer; + + if ( mLayer ) + { + connect( mLayer, &QgsVectorLayer::editingStarted, this, &QgsElevationProfileToolAddPoint::toggleAction ); + connect( mLayer, &QgsVectorLayer::editingStopped, this, &QgsElevationProfileToolAddPoint::toggleAction ); + } + + toggleAction(); +} + +void QgsElevationProfileToolAddPoint::toggleAction() +{ + QAction *addPointAction = action(); + if ( !addPointAction ) + return; + + if ( mLayer ) + { + const bool isPoint = mLayer->geometryType() == Qgis::GeometryType::Point; + const bool canAddFeatures = mLayer->dataProvider()->capabilities() & Qgis::VectorProviderCapability::AddFeatures; + addPointAction->setEnabled( isPoint && canAddFeatures && mLayer->isEditable() ); + } + else + { + addPointAction->setEnabled( false ); + } +} + +void QgsElevationProfileToolAddPoint::onLayerDestroyed( QObject *layer ) +{ + if ( layer == mLayer ) + { + mLayer = nullptr; + } +} diff --git a/src/app/elevation/qgselevationprofiletooladdpoint.h b/src/app/elevation/qgselevationprofiletooladdpoint.h new file mode 100644 index 000000000000..5e4b52978200 --- /dev/null +++ b/src/app/elevation/qgselevationprofiletooladdpoint.h @@ -0,0 +1,52 @@ +/*************************************************************************** + qgselevationprofiletooladdpoint.cpp + --------------- + begin : September 2024 + copyright : (C) 2024 by Simon Lopez + email : simon dot lopez at free dot fr +***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef QGSELEVATIONPROFILETOOLADDPOINT_H +#define QGSELEVATIONPROFILETOOLADDPOINT_H + +#include "qgsplottool.h" + +class QgsPlotRectangularRubberBand; +class QgsElevationProfileCanvas; +class QgsVectorLayer; + +class QgsElevationProfileToolAddPoint : public QgsPlotTool +{ + + Q_OBJECT + + public: + + QgsElevationProfileToolAddPoint( QgsElevationProfileCanvas *canvas ); + ~QgsElevationProfileToolAddPoint() override; + + void plotReleaseEvent( QgsPlotMouseEvent *event ) override; + + void setLayer( QgsVectorLayer *layer ); + + private slots: + + void toggleAction(); + void onLayerDestroyed( QObject *layer ); + + private: + + QgsVectorLayer *mLayer = nullptr; + +}; + +#endif // QGSELEVATIONPROFILETOOLADDPOINT_H diff --git a/src/app/elevation/qgselevationprofiletoolmovepoint.cpp b/src/app/elevation/qgselevationprofiletoolmovepoint.cpp new file mode 100644 index 000000000000..866b71bee580 --- /dev/null +++ b/src/app/elevation/qgselevationprofiletoolmovepoint.cpp @@ -0,0 +1,223 @@ +/*************************************************************************** + qgselevationprofiletoolmovepoint.cpp + --------------- + begin : December 2024 + copyright : (C) 2024 by Jacky Volpes + email : jacky dot volpes at oslandia dot com +***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "qgselevationprofiletoolmovepoint.h" +#include "moc_qgselevationprofiletoolmovepoint.cpp" +#include "qgsabstractprofilegenerator.h" +#include "qgselevationprofilecanvas.h" +#include "qgsmessagebar.h" +#include "qgsplotmouseevent.h" +#include "qgsplotrubberband.h" +#include "qgisapp.h" +#include "qgspointxy.h" +#include "qgsproject.h" +#include +#include + + +QgsElevationProfileToolMovePoint::QgsElevationProfileToolMovePoint( QgsElevationProfileCanvas *canvas ) + : QgsPlotTool( canvas, tr( "Move Point Feature" ) ) +{ + setCursor( Qt::CrossCursor ); + + mRubberBand.reset( new QgsPlotPointRubberBand( canvas ) ); + mRubberBand->setBrush( QBrush( QColor( 254, 178, 76, 63 ) ) ); + mRubberBand->setPen( QPen( QBrush( QColor( 254, 58, 29, 100 ) ), 0 ) ); +} + +QgsElevationProfileToolMovePoint::~QgsElevationProfileToolMovePoint() = default; + +void QgsElevationProfileToolMovePoint::keyPressEvent( QKeyEvent *e ) +{ + if ( !e->isAutoRepeat() ) + { + switch ( e->key() ) + { + case Qt::Key_Control: + mAbscissaLocked = true; + QgisApp::instance()->statusBar()->showMessage( tr( "Abscissa locked" ) ); + break; + default: + break; + } + } +} + +void QgsElevationProfileToolMovePoint::keyReleaseEvent( QKeyEvent * /* e */ ) +{ + QgisApp::instance()->statusBar()->showMessage( tr( "Hold Ctrl key to lock the abscissa" ) ); + qgis::down_cast( mCanvas )->setCrossHairsItemIsDelegate( false ); + mAbscissaLocked = false; +} + +void QgsElevationProfileToolMovePoint::plotReleaseEvent( QgsPlotMouseEvent *event ) +{ + event->ignore(); + if ( event->button() != Qt::LeftButton || !mLayer ) + return; + + QgsPointXY snappedPoint = event->snappedPoint(); + + if ( mDragging ) + { + QgsPointXY snappedPoint; + if ( mAbscissaLocked ) + { + QgsPointXY point = event->pos(); + point.setX( mStartX ); + snappedPoint = mCanvas->snapToPlot( point.toQPointF().toPoint() ); + if ( snappedPoint.isEmpty() ) + snappedPoint = point; + } + else + snappedPoint = event->snappedPoint(); + + QgsGeometry geometry( std::make_unique( toMapCoordinates( snappedPoint ) ) ); + + if ( geometry.isNull() || geometry.isEmpty() ) + { + QgisApp::instance()->messageBar()->pushWarning( tr( "Add point" ), tr( "Could not add point: no profile curve" ) ); + QgsDebugError( QStringLiteral( "Could not add point with no geometry" ) ); + return; + } + QgsCoordinateTransform transform( mCanvas->crs(), mLayer->crs3D(), QgsProject::instance()->transformContext() ); + transform.setBallparkTransformsAreAppropriate( true ); + try + { + geometry.transform( transform, Qgis::TransformDirection::Forward, true ); + } + catch ( QgsCsException &cse ) + { + Q_UNUSED( cse ) + QgsDebugError( QStringLiteral( "Caught CRS exception %1" ).arg( cse.what() ) ); + return; + } + + mLayer->changeGeometry( mFeatureId, geometry ); + mRubberBand->finish( QPointF(), Qt::KeyboardModifiers() ); + } + else + { + if ( !findFeature( snappedPoint.toQPointF() ) ) + return; + + mStartX = snappedPoint.toQPointF().x(); + mRubberBand->start( snappedPoint.toQPointF(), Qt::KeyboardModifiers() ); + } + mDragging = !mDragging; +} + +void QgsElevationProfileToolMovePoint::plotMoveEvent( QgsPlotMouseEvent *event ) +{ + event->ignore(); + if ( !mDragging || !mRubberBand ) + return; + + QgsElevationProfileCanvas *profileCanvas = qgis::down_cast( mCanvas ); + profileCanvas->setCrossHairsItemIsDelegate( mAbscissaLocked ); + + QgsPointXY snappedPoint; + if ( mAbscissaLocked ) + { + QgsPointXY point = event->pos(); + point.setX( mStartX ); + snappedPoint = mCanvas->snapToPlot( point.toQPointF().toPoint() ); + if ( snappedPoint.isEmpty() ) + snappedPoint = point; + + profileCanvas->showCrossHairsItem(); + profileCanvas->setCrossHairsItemPoint( snappedPoint.toQPointF().toPoint() ); + } + else + snappedPoint = event->snappedPoint(); + + mRubberBand->update( snappedPoint.toQPointF(), Qt::KeyboardModifiers() ); +} + +bool QgsElevationProfileToolMovePoint::findFeature( QPointF pos ) +{ + QVector results = qgis::down_cast( mCanvas )->identify( pos ); + for ( const auto &result : results ) + { + if ( result.layer() != mLayer ) + continue; + + for ( const auto &featureParam : result.results() ) + { + if ( featureParam.contains( "id" ) ) + { + mFeatureId = featureParam.value( "id" ).toLongLong(); + return true; // return as soon as a feature is found + } + } + } + return false; +} + +void QgsElevationProfileToolMovePoint::setLayer( QgsVectorLayer *layer ) +{ + if ( layer == mLayer ) + { + return; + } + + if ( mLayer ) + { + disconnect( mLayer, &QgsVectorLayer::editingStarted, this, &QgsElevationProfileToolMovePoint::toggleAction ); + disconnect( mLayer, &QgsVectorLayer::editingStopped, this, &QgsElevationProfileToolMovePoint::toggleAction ); + } + + mLayer = layer; + + if ( mLayer ) + { + connect( mLayer, &QgsVectorLayer::editingStarted, this, &QgsElevationProfileToolMovePoint::toggleAction ); + connect( mLayer, &QgsVectorLayer::editingStopped, this, &QgsElevationProfileToolMovePoint::toggleAction ); + } + + toggleAction(); +} + +void QgsElevationProfileToolMovePoint::deactivate() +{ + QgisApp::instance()->statusBar()->clearMessage(); + QgsPlotTool::deactivate(); +} + +void QgsElevationProfileToolMovePoint::activate() +{ + QgisApp::instance()->statusBar()->showMessage( tr( "Hold Ctrl key to lock the abscissa" ) ); + QgsPlotTool::activate(); +} + +void QgsElevationProfileToolMovePoint::toggleAction() +{ + QAction *movePointAction = action(); + if ( !movePointAction ) + return; + + if ( mLayer ) + { + const bool isPoint = mLayer->geometryType() == Qgis::GeometryType::Point; + const bool canMoveFeatures = mLayer->dataProvider()->capabilities() & Qgis::VectorProviderCapability::ChangeGeometries; + movePointAction->setEnabled( isPoint && canMoveFeatures && mLayer->isEditable() ); + } + else + { + movePointAction->setEnabled( false ); + } +} diff --git a/src/app/elevation/qgselevationprofiletoolmovepoint.h b/src/app/elevation/qgselevationprofiletoolmovepoint.h new file mode 100644 index 000000000000..887dbbf36cda --- /dev/null +++ b/src/app/elevation/qgselevationprofiletoolmovepoint.h @@ -0,0 +1,62 @@ +/*************************************************************************** + qgselevationprofiletoolmovepoint.h + --------------- + begin : December 2024 + copyright : (C) 2024 by Jacky Volpes + email : jacky dot volpes at oslandia dot com +***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#ifndef QGSELEVATIONPROFILETOOLMOVEPOINT_H +#define QGSELEVATIONPROFILETOOLMOVEPOINT_H + +#include "qgsfeatureid.h" +#include "qgsplottool.h" + +class QgsVectorLayer; +class QgsElevationProfileCanvas; +class QgsPlotPointRubberBand; + +class QgsElevationProfileToolMovePoint : public QgsPlotTool +{ + Q_OBJECT + + public: + QgsElevationProfileToolMovePoint( QgsElevationProfileCanvas *canvas ); + + ~QgsElevationProfileToolMovePoint() override; + + void plotMoveEvent( QgsPlotMouseEvent *event ) override; + void plotReleaseEvent( QgsPlotMouseEvent *event ) override; + void keyPressEvent( QKeyEvent *event ) override; + void keyReleaseEvent( QKeyEvent *e ) override; + void activate() override; + void deactivate() override; + + void setLayer( QgsVectorLayer *layer ); + + private slots: + void toggleAction(); + + private: + void updateRubberBand(); + bool findFeature( QPointF pos ); + + QgsElevationProfileCanvas *mElevationCanvas = nullptr; + QgsVectorLayer *mLayer = nullptr; + QgsFeatureId mFeatureId; + + std::unique_ptr< QgsPlotPointRubberBand > mRubberBand; + bool mDragging = false; + bool mAbscissaLocked = false; + double mStartX; +}; + +#endif // QGSELEVATIONPROFILETOOLMOVEPOINT_H diff --git a/src/app/elevation/qgselevationprofiletoolselectfeatures.cpp b/src/app/elevation/qgselevationprofiletoolselectfeatures.cpp new file mode 100644 index 000000000000..54f09eb0c2ca --- /dev/null +++ b/src/app/elevation/qgselevationprofiletoolselectfeatures.cpp @@ -0,0 +1,175 @@ +/*************************************************************************** + qgselevationprofiletoolselectfeatures.cpp + --------------- + begin : January 2025 + copyright : (C) 2025 by Jacky Volpes + email : jacky dot volpes at oslandia dot com +***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "qgselevationprofiletoolselectfeatures.h" +#include "moc_qgselevationprofiletoolselectfeatures.cpp" +#include "qgsabstractprofilegenerator.h" +#include "qgselevationprofilecanvas.h" +#include "qgsmessagebar.h" +#include "qgsplotmouseevent.h" +#include "qgsplotrubberband.h" +#include "qgisapp.h" +#include "qgspointxy.h" +#include "qgsproject.h" +#include "qgsapplication.h" +#include +#include + + +QgsElevationProfileToolSelectFeatures::QgsElevationProfileToolSelectFeatures( QgsElevationProfileCanvas *canvas ) + : QgsPlotTool( canvas, tr( "Select Features" ) ) +{ + setCursor( QgsApplication::getThemeCursor( QgsApplication::Cursor::Select ) ); + + mRubberBand.reset( new QgsPlotRectangularRubberBand( canvas ) ); + mRubberBand->setBrush( QBrush( QColor( 254, 178, 76, 63 ) ) ); + mRubberBand->setPen( QPen( QBrush( QColor( 254, 58, 29, 100 ) ), 0 ) ); +} + +QgsElevationProfileToolSelectFeatures::~QgsElevationProfileToolSelectFeatures() = default; + +void QgsElevationProfileToolSelectFeatures::plotPressEvent( QgsPlotMouseEvent *event ) +{ + event->ignore(); + if ( event->button() != Qt::LeftButton || !mLayer ) + return; + + mMousePressStartPos = event->pos(); + mRubberBand->start( mMousePressStartPos, Qt::KeyboardModifiers() ); +} + +void QgsElevationProfileToolSelectFeatures::keyPressEvent( QKeyEvent *e ) +{ + if ( !e->isAutoRepeat() ) + { + switch ( e->key() ) + { + case Qt::Key_Shift: + QgisApp::instance()->statusBar()->showMessage( tr( "Add to the current selection" ) ); + mCurrentModifier = AddToSelection; + break; + case Qt::Key_Control: + QgisApp::instance()->statusBar()->showMessage( tr( "Subtract from the current selection" ) ); + mCurrentModifier = RemoveFromSelection; + break; + + default: + break; + } + } +} + +void QgsElevationProfileToolSelectFeatures::keyReleaseEvent( QKeyEvent * /* e */ ) +{ + mCurrentModifier = NoModifier; + QgisApp::instance()->statusBar()->clearMessage(); +} + +void QgsElevationProfileToolSelectFeatures::plotReleaseEvent( QgsPlotMouseEvent *event ) +{ + event->ignore(); + if ( event->button() != Qt::LeftButton || !mLayer ) + return; + + const bool clickOnly = !isClickAndDrag( mMousePressStartPos.toPoint(), event->pos() ); + mRubberBand->finish( event->pos() ); + QVector results; + if ( !clickOnly ) + { + // don't allow the band to be dragged outside of the plot area + const QRectF plotArea = qgis::down_cast( mCanvas )->plotArea(); + QPointF end; + if ( !plotArea.contains( event->pos() ) ) + { + end = constrainPointToRect( event->pos(), plotArea ); + } + else + { + end = event->snappedPoint().toQPointF(); + } + + results = qgis::down_cast( mCanvas )->identify( QRectF( mMousePressStartPos, end ) ); + } + else + { + results = qgis::down_cast( mCanvas )->identify( mMousePressStartPos ); + } + + if ( mCurrentModifier == NoModifier && results.empty() ) + { + mLayer->removeSelection(); + return; + } + + QgsFeatureIds featureIds; + for ( const auto &result : results ) + { + if ( result.layer() != mLayer ) + continue; + + for ( const auto &featureParam : result.results() ) + if ( featureParam.contains( "id" ) ) + featureIds << featureParam.value( "id" ).toLongLong(); + } + + switch ( mCurrentModifier ) + { + case NoModifier: + mLayer->selectByIds( featureIds ); + break; + case AddToSelection: + mLayer->modifySelection( featureIds, QgsFeatureIds() ); + break; + case RemoveFromSelection: + mLayer->modifySelection(QgsFeatureIds(), featureIds ); + break; + } +} + +void QgsElevationProfileToolSelectFeatures::plotMoveEvent( QgsPlotMouseEvent *event ) +{ + event->ignore(); + + // don't allow the band to be dragged outside of the plot area + const QRectF plotArea = qgis::down_cast( mCanvas )->plotArea(); + QPointF movePoint; + if ( !plotArea.contains( event->pos() ) ) + { + movePoint = constrainPointToRect( event->pos(), plotArea ); + } + else + { + movePoint = event->snappedPoint().toQPointF(); + } + + mRubberBand->update( movePoint, Qt::KeyboardModifiers() ); +} + +void QgsElevationProfileToolSelectFeatures::setLayer( QgsVectorLayer *layer ) +{ + mLayer = layer; + toggleAction(); +} + +void QgsElevationProfileToolSelectFeatures::toggleAction() +{ + QAction *selectFeaturesAction = action(); + if ( !selectFeaturesAction ) + return; + + selectFeaturesAction->setEnabled( mLayer != nullptr ); +} diff --git a/src/app/elevation/qgselevationprofiletoolselectfeatures.h b/src/app/elevation/qgselevationprofiletoolselectfeatures.h new file mode 100644 index 000000000000..ac0774081221 --- /dev/null +++ b/src/app/elevation/qgselevationprofiletoolselectfeatures.h @@ -0,0 +1,69 @@ +/*************************************************************************** + qgselevationprofiletoolselectfeatures.h + --------------- + begin : January 2025 + copyright : (C) 2025 by Jacky Volpes + email : jacky dot volpes at oslandia dot com +***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef QGSELEVATIONPROFILETOOLSELECTFEATURES_H +#define QGSELEVATIONPROFILETOOLSELECTFEATURES_H + +#include "qgsplottool.h" + +class QgsVectorLayer; +class QgsElevationProfileCanvas; +class QgsPlotRectangularRubberBand; + +class QgsElevationProfileToolSelectFeatures : public QgsPlotTool +{ + Q_OBJECT + + public: + QgsElevationProfileToolSelectFeatures( QgsElevationProfileCanvas *canvas ); + + ~QgsElevationProfileToolSelectFeatures() override; + + void plotMoveEvent( QgsPlotMouseEvent *event ) override; + void plotReleaseEvent( QgsPlotMouseEvent *event ) override; + void plotPressEvent( QgsPlotMouseEvent *event ) override; + void keyPressEvent( QKeyEvent *event ) override; + void keyReleaseEvent( QKeyEvent *e ) override; + + void setLayer( QgsVectorLayer *layer ); + + private slots: + void toggleAction(); + + private: + void updateRubberBand(); + bool findFeature( QPointF pos ); + bool findFeatures( QRectF rect ); + + QgsElevationProfileCanvas *mElevationCanvas = nullptr; + QgsVectorLayer *mLayer = nullptr; + + std::unique_ptr mRubberBand; + bool mDragging = false; + QPointF mMousePressStartPos; + + enum ModifierMode + { + NoModifier, + AddToSelection, + RemoveFromSelection + }; + + ModifierMode mCurrentModifier = NoModifier; +}; + +#endif // QGSELEVATIONPROFILETOOLSELECTFEATURES_H diff --git a/src/app/elevation/qgselevationprofilewidget.cpp b/src/app/elevation/qgselevationprofilewidget.cpp index d30c409046b7..6c2557b9fecf 100644 --- a/src/app/elevation/qgselevationprofilewidget.cpp +++ b/src/app/elevation/qgselevationprofilewidget.cpp @@ -21,6 +21,7 @@ #include "qgselevationprofilecanvas.h" #include "qgsdockablewidgethelper.h" #include "qgsmapcanvas.h" +#include "qgsmaplayer.h" #include "qgsmaplayerelevationproperties.h" #include "qgsmaplayermodel.h" #include "qgsmaptoolprofilecurve.h" @@ -50,6 +51,9 @@ #include "qgsshortcutsmanager.h" #include "qgselevationprofiletoolidentify.h" #include "qgselevationprofiletoolmeasure.h" +#include "qgselevationprofiletooladdpoint.h" +#include "qgselevationprofiletoolmovepoint.h" +#include "qgselevationprofiletoolselectfeatures.h" #include "qgssettingsentryimpl.h" #include "qgssettingstree.h" #include "qgsmaplayerproxymodel.h" @@ -180,9 +184,14 @@ QgsElevationProfileWidget::QgsElevationProfileWidget( const QString &name ) } } ); + connect( mLayerTreeView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &QgsElevationProfileWidget::onLayerSelectionChanged ); + mZoomTool = new QgsPlotToolZoom( mCanvas ); mXAxisZoomTool = new QgsPlotToolXAxisZoom( mCanvas ); mIdentifyTool = new QgsElevationProfileToolIdentify( mCanvas ); + mAddPointTool = new QgsElevationProfileToolAddPoint( mCanvas ); + mMovePointTool = new QgsElevationProfileToolMovePoint( mCanvas ); + mSelectFeaturesTool = new QgsElevationProfileToolSelectFeatures( mCanvas ); mCanvas->setTool( mIdentifyTool ); @@ -251,13 +260,13 @@ QgsElevationProfileWidget::QgsElevationProfileWidget( const QString &name ) toolBar->addSeparator(); - QAction *identifyToolAction = new QAction( tr( "Identify Features" ), this ); - identifyToolAction->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionIdentify.svg" ) ) ); - identifyToolAction->setCheckable( true ); - identifyToolAction->setChecked( true ); - mIdentifyTool->setAction( identifyToolAction ); - connect( identifyToolAction, &QAction::triggered, mPanTool, [=] { mCanvas->setTool( mIdentifyTool ); } ); - toolBar->addAction( identifyToolAction ); + QAction *identifyAction = new QAction( tr( "Identify Features" ), this ); + identifyAction->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionIdentify.svg" ) ) ); + identifyAction->setCheckable( true ); + identifyAction->setChecked( true ); + mIdentifyTool->setAction( identifyAction ); + connect( identifyAction, &QAction::triggered, mIdentifyTool, [=] { mCanvas->setTool( mIdentifyTool ); } ); + toolBar->addAction( identifyAction ); QAction *panToolAction = new QAction( tr( "Pan" ), this ); panToolAction->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionPan.svg" ) ) ); @@ -304,6 +313,58 @@ QgsElevationProfileWidget::QgsElevationProfileWidget( const QString &name ) } ); toolBar->addAction( measureToolAction ); + toolBar->addSeparator(); + + // Select features action + QAction *selectFeaturesAction = new QAction( tr( "Select Features" ), this ); + selectFeaturesAction->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionSelectRectangle.svg" ) ) ); + selectFeaturesAction->setCheckable( true ); + selectFeaturesAction->setChecked( false ); + selectFeaturesAction->setEnabled( false ); + mSelectFeaturesTool->setAction( selectFeaturesAction ); + connect( selectFeaturesAction, &QAction::triggered, this, [=] { mCanvas->setTool( mSelectFeaturesTool ); } ); + toolBar->addAction( selectFeaturesAction ); + + // Save and Edit layer actions + mToggleEditLayerAction = new QgsElevationProfileWidgetToggleEditingLayerAction( tr( "Toggle Editing" ), this ); + toolBar->addAction( mToggleEditLayerAction ); + mSaveLayerAction = new QgsElevationProfileWidgetSaveLayerAction( tr( "Save Editing" ), this ); + toolBar->addAction( mSaveLayerAction ); + + // Delete features action + mDeleteFeaturesAction = new QgsElevationProfileWidgetDeleteFeaturesAction( tr( "Delete Features" ), this ); + toolBar->addAction( mDeleteFeaturesAction ); + + // Add Feature Action + QAction *addPointAction = new QAction( tr( "Add Point Features" ), this ); + addPointAction->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionCapturePoint.svg" ) ) ); + addPointAction->setCheckable( true ); + addPointAction->setChecked( false ); + addPointAction->setEnabled( false ); + mAddPointTool->setAction( addPointAction ); + connect( addPointAction, &QAction::triggered, this, [=] { mCanvas->setTool( mAddPointTool ); } ); + toolBar->addAction( addPointAction ); + + // Move Feature Action + QAction *movePointAction = new QAction( tr( "Move Point Features" ), this ); + movePointAction->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionMoveFeaturePoint.svg" ) ) ); + movePointAction->setCheckable( true ); + movePointAction->setChecked( false ); + movePointAction->setEnabled( false ); + mMovePointTool->setAction( movePointAction ); + connect( movePointAction, &QAction::triggered, this, [=] { mCanvas->setTool( mMovePointTool ); } ); + toolBar->addAction( movePointAction ); + + // show Inflection Lines Action + mShowInflectionLinesAction = new QAction( tr( "Show Inflection Lines" ), this ); + mShowInflectionLinesAction->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mIconLineLayer.svg" ) ) ); + mShowInflectionLinesAction->setCheckable( true ); + mShowInflectionLinesAction->setChecked( false ); + mShowInflectionLinesAction->setEnabled( false ); + connect( mShowInflectionLinesAction, &QAction::triggered, this, [=] { mCanvas->setInflectionLinesEnabled( mShowInflectionLinesAction->isChecked() ); } ); + toolBar->addAction( mShowInflectionLinesAction ); + + toolBar->addSeparator(); QAction *exportAsPdfAction = new QAction( tr( "Export as PDF" ), this ); @@ -655,6 +716,7 @@ void QgsElevationProfileWidget::setProfileCurve( const QgsGeometry &curve, bool { mNudgeLeftAction->setEnabled( !curve.isEmpty() ); mNudgeRightAction->setEnabled( !curve.isEmpty() ); + mShowInflectionLinesAction->setEnabled( !curve.isEmpty() ); mProfileCurve = curve; createOrUpdateRubberBands(); @@ -720,6 +782,7 @@ void QgsElevationProfileWidget::clear() mCanvas->clear(); mNudgeLeftAction->setEnabled( false ); mNudgeRightAction->setEnabled( false ); + mShowInflectionLinesAction->setEnabled( false ); mProfileCurve = QgsGeometry(); } @@ -971,18 +1034,18 @@ void QgsElevationProfileWidget::createOrUpdateRubberBands() QgsSymbolLayerList layers; - std::unique_ptr bottomLayer = std::make_unique(); + auto bottomLayer = std::make_unique(); bottomLayer->setWidth( 0.8 ); bottomLayer->setWidthUnit( Qgis::RenderUnit::Millimeters ); bottomLayer->setColor( QColor( 40, 40, 40, 100 ) ); bottomLayer->setPenCapStyle( Qt::PenCapStyle::FlatCap ); layers.append( bottomLayer.release() ); - std::unique_ptr arrowLayer = std::make_unique(); + auto arrowLayer = std::make_unique(); arrowLayer->setPlacements( Qgis::MarkerLinePlacement::CentralPoint ); QgsSymbolLayerList markerLayers; - std::unique_ptr arrowSymbolLayer = std::make_unique( Qgis::MarkerShape::EquilateralTriangle ); + auto arrowSymbolLayer = std::make_unique( Qgis::MarkerShape::EquilateralTriangle ); arrowSymbolLayer->setSize( 4 ); arrowSymbolLayer->setAngle( 90 ); arrowSymbolLayer->setSizeUnit( Qgis::RenderUnit::Millimeters ); @@ -991,12 +1054,12 @@ void QgsElevationProfileWidget::createOrUpdateRubberBands() arrowSymbolLayer->setStrokeWidth( 0.2 ); markerLayers.append( arrowSymbolLayer.release() ); - std::unique_ptr markerSymbol = std::make_unique( markerLayers ); + auto markerSymbol = std::make_unique( markerLayers ); arrowLayer->setSubSymbol( markerSymbol.release() ); layers.append( arrowLayer.release() ); - std::unique_ptr topLayer = std::make_unique(); + auto topLayer = std::make_unique(); topLayer->setWidth( 0.4 ); topLayer->setWidthUnit( Qgis::RenderUnit::Millimeters ); topLayer->setColor( QColor( 255, 255, 255, 255 ) ); @@ -1004,7 +1067,7 @@ void QgsElevationProfileWidget::createOrUpdateRubberBands() topLayer->setPenCapStyle( Qt::PenCapStyle::FlatCap ); layers.append( topLayer.release() ); - std::unique_ptr symbol = std::make_unique( layers ); + auto symbol = std::make_unique( layers ); mRubberBand->setSymbol( symbol.release() ); mRubberBand->updatePosition(); @@ -1023,12 +1086,12 @@ void QgsElevationProfileWidget::createOrUpdateRubberBands() QgsSymbolLayerList layers; - std::unique_ptr bottomLayer = std::make_unique(); + auto bottomLayer = std::make_unique(); bottomLayer->setColor( QColor( 40, 40, 40, 50 ) ); bottomLayer->setStrokeColor( QColor( 255, 255, 255, 150 ) ); layers.append( bottomLayer.release() ); - std::unique_ptr symbol = std::make_unique( layers ); + auto symbol = std::make_unique( layers ); mToleranceRubberBand->setSymbol( symbol.release() ); } @@ -1108,6 +1171,27 @@ void QgsAppElevationProfileLayerTreeView::contextMenuEvent( QContextMenuEvent *e { QMenu *menu = new QMenu(); + if ( QgsVectorLayer *vectorLayer = qobject_cast( layer ); + vectorLayer && vectorLayer->geometryType() == Qgis::GeometryType::Point ) + { + const Qgis::VectorProviderCapabilities capabilities = vectorLayer->dataProvider()->capabilities(); + const bool canAddFeatures = capabilities & Qgis::VectorProviderCapability::AddFeatures; + const bool canChangeGeometries = capabilities & Qgis::VectorProviderCapability::ChangeGeometries; + if ( capabilities & canAddFeatures || capabilities & canChangeGeometries ) + { + QAction *toggleEditingAction = new QAction( tr( "Toggle Editing" ), menu ); + toggleEditingAction->setIcon( QgsApplication::getThemePixmap( QStringLiteral( "/mActionToggleEditing.svg" ) ) ); + toggleEditingAction->setCheckable( true ); + toggleEditingAction->setChecked( vectorLayer->isEditable() ); + connect( toggleEditingAction, &QAction::triggered, this, [layer, toggleEditingAction] { + if ( QgisApp::instance()->toggleEditing( layer ) ) + toggleEditingAction->setChecked( layer->isEditable() ); + } ); + menu->addAction( toggleEditingAction ); + menu->addSeparator(); + } + } + QAction *propertiesAction = new QAction( tr( "Properties…" ), menu ); connect( propertiesAction, &QAction::triggered, this, [layer] { QgisApp::instance()->showLayerProperties( layer, QStringLiteral( "mOptsPage_Elevation" ) ); @@ -1118,3 +1202,166 @@ void QgsAppElevationProfileLayerTreeView::contextMenuEvent( QContextMenuEvent *e delete menu; } } + +void QgsElevationProfileWidget::onLayerSelectionChanged( const QItemSelection &, const QItemSelection & ) +{ + QItemSelectionModel *selectModel = mLayerTreeView->selectionModel(); + if ( !selectModel ) + return; + + const QModelIndexList selected = selectModel->selectedIndexes(); + QModelIndex idx = selected.at( 0 ); + if ( selected.size() == 1 && idx.isValid() ) + { + QgsMapLayer *layer = mLayerTreeView->indexToLayer( idx ); + if ( QgsVectorLayer *vectorLayer = qobject_cast( layer ) ) + { + mSelectFeaturesTool->setLayer( vectorLayer ); + if ( vectorLayer->geometryType() == Qgis::GeometryType::Point ) + { + mAddPointTool->setLayer( vectorLayer ); + mMovePointTool->setLayer( vectorLayer ); + mToggleEditLayerAction->setLayer( vectorLayer ); + mSaveLayerAction->setLayer( vectorLayer ); + mDeleteFeaturesAction->setLayer( vectorLayer ); + return; + } + } + } + + mCanvas->setTool( mIdentifyTool ); + mAddPointTool->setLayer( nullptr ); + mMovePointTool->setLayer( nullptr ); + mSelectFeaturesTool->setLayer( nullptr ); + mToggleEditLayerAction->setLayer( nullptr ); + mSaveLayerAction->setLayer( nullptr ); + mDeleteFeaturesAction->setLayer( nullptr ); +} + +QgsElevationProfileWidgetToggleEditingLayerAction::QgsElevationProfileWidgetToggleEditingLayerAction( const QString &text, QWidget *parent ) + : QAction( text, parent ) +{ + setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionToggleEditing.svg" ) ) ); + connect( this, &QgsElevationProfileWidgetToggleEditingLayerAction::triggered, this, [this]() { QgisApp::instance()->toggleEditing( mLayer ); } ); + setCheckable( true ); + handleCheckEnableStates(); +} + +void QgsElevationProfileWidgetToggleEditingLayerAction::setLayer( QgsVectorLayer *layer ) +{ + if ( layer == mLayer ) + { + return; + } + + if ( mLayer ) + { + disconnect( mLayer, &QgsVectorLayer::editingStarted, this, &QgsElevationProfileWidgetToggleEditingLayerAction::handleCheckEnableStates ); + disconnect( mLayer, &QgsVectorLayer::editingStopped, this, &QgsElevationProfileWidgetToggleEditingLayerAction::handleCheckEnableStates ); + } + + mLayer = layer; + + if ( mLayer ) + { + connect( mLayer, &QgsVectorLayer::editingStarted, this, &QgsElevationProfileWidgetToggleEditingLayerAction::handleCheckEnableStates ); + connect( mLayer, &QgsVectorLayer::editingStopped, this, &QgsElevationProfileWidgetToggleEditingLayerAction::handleCheckEnableStates ); + } + + handleCheckEnableStates(); +} + +void QgsElevationProfileWidgetToggleEditingLayerAction::handleCheckEnableStates() +{ + const Qgis::VectorProviderCapabilities capabilities = mLayer ? mLayer->dataProvider()->capabilities() : Qgis::VectorProviderCapabilities(); + const bool canAddFeatures = capabilities & Qgis::VectorProviderCapability::AddFeatures; + const bool canChangeGeometries = capabilities & Qgis::VectorProviderCapability::ChangeGeometries; + if ( mLayer && mLayer->geometryType() == Qgis::GeometryType::Point && ( canAddFeatures || canChangeGeometries ) ) + { + setEnabled( true ); + setChecked( mLayer->isEditable() ); + } + else + { + setEnabled( false ); + setChecked( false ); + } +} + +QgsElevationProfileWidgetSaveLayerAction::QgsElevationProfileWidgetSaveLayerAction( const QString &text, QWidget *parent ) + : QAction( text, parent ) +{ + setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionSaveEdits.svg" ) ) ); + connect( this, &QgsElevationProfileWidgetToggleEditingLayerAction::triggered, this, [this]() { + QgisApp::instance()->saveEdits( mLayer ); + handleEnableState(); + } ); + handleEnableState(); +} + +void QgsElevationProfileWidgetSaveLayerAction::setLayer( QgsVectorLayer *layer ) +{ + if ( layer == mLayer ) + return; + + if ( mLayer ) + disconnect( mLayer, &QgsVectorLayer::layerModified, this, &QgsElevationProfileWidgetSaveLayerAction::handleEnableState ); + + mLayer = layer; + + if ( mLayer ) + connect( mLayer, &QgsVectorLayer::layerModified, this, &QgsElevationProfileWidgetSaveLayerAction::handleEnableState ); + + handleEnableState(); +} + +void QgsElevationProfileWidgetSaveLayerAction::handleEnableState() +{ + if ( mLayer && mLayer->geometryType() == Qgis::GeometryType::Point ) + setEnabled( mLayer->isModified() ); + else + setEnabled( false ); +} + +QgsElevationProfileWidgetDeleteFeaturesAction::QgsElevationProfileWidgetDeleteFeaturesAction( const QString &text, QWidget *parent ) + : QAction( text, parent ) +{ + setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionDeleteSelectedFeatures.svg" ) ) ); + connect( this, &QgsElevationProfileWidgetToggleEditingLayerAction::triggered, this, [this]() { + QgisApp::instance()->saveEdits( mLayer ); + handleEnableState(); + } ); + handleEnableState(); +} + +void QgsElevationProfileWidgetDeleteFeaturesAction::setLayer( QgsVectorLayer *layer ) +{ + if ( layer == mLayer ) + return; + + if ( mLayer ) + { + disconnect( mLayer, &QgsVectorLayer::editingStarted, this, &QgsElevationProfileWidgetDeleteFeaturesAction::handleEnableState ); + disconnect( mLayer, &QgsVectorLayer::editingStopped, this, &QgsElevationProfileWidgetDeleteFeaturesAction::handleEnableState ); + disconnect( mLayer, &QgsVectorLayer::selectionChanged, this, &QgsElevationProfileWidgetDeleteFeaturesAction::handleEnableState ); + } + + mLayer = layer; + + if ( mLayer ) + { + connect( mLayer, &QgsVectorLayer::editingStarted, this, &QgsElevationProfileWidgetDeleteFeaturesAction::handleEnableState ); + connect( mLayer, &QgsVectorLayer::editingStopped, this, &QgsElevationProfileWidgetDeleteFeaturesAction::handleEnableState ); + connect( mLayer, &QgsVectorLayer::selectionChanged, this, &QgsElevationProfileWidgetDeleteFeaturesAction::handleEnableState ); + } + + handleEnableState(); +} + +void QgsElevationProfileWidgetDeleteFeaturesAction::handleEnableState() +{ + if ( mLayer && mLayer->geometryType() == Qgis::GeometryType::Point ) + setEnabled( mLayer->isEditable() && mLayer->selectedFeatureCount() > 0 ); + else + setEnabled( false ); +} diff --git a/src/app/elevation/qgselevationprofilewidget.h b/src/app/elevation/qgselevationprofilewidget.h index 02995afee0cc..51276ae18902 100644 --- a/src/app/elevation/qgselevationprofilewidget.h +++ b/src/app/elevation/qgselevationprofilewidget.h @@ -17,9 +17,8 @@ #ifndef QGSELEVATIONPROFILEWIDGET_H #define QGSELEVATIONPROFILEWIDGET_H +#include "qgselevationprofiletoolselectfeatures.h" #include "qmenu.h" -#include "qgsdockwidget.h" -#include "qgis_app.h" #include "qgsgeometry.h" #include "qobjectuniqueptr.h" #include "qgselevationprofilelayertreeview.h" @@ -47,6 +46,8 @@ class QgsLayerTree; class QgsLayerTreeRegistryBridge; class QgsElevationProfileToolIdentify; class QgsElevationProfileToolMeasure; +class QgsElevationProfileToolAddPoint; +class QgsElevationProfileToolMovePoint; class QLabel; class QgsProfilePoint; class QgsSettingsEntryDouble; @@ -54,6 +55,9 @@ class QgsSettingsEntryBool; class QgsSettingsEntryString; class QgsSettingsEntryColor; class QgsMapLayerProxyModel; +class QgsElevationProfileWidgetToggleEditingLayerAction; +class QgsElevationProfileWidgetSaveLayerAction; +class QgsElevationProfileWidgetDeleteFeaturesAction; class QgsAppElevationProfileLayerTreeView : public QgsElevationProfileLayerTreeView { @@ -133,6 +137,7 @@ class QgsElevationProfileWidget : public QWidget void axisScaleLockToggled( bool active ); void renameProfileTriggered(); void onProjectElevationPropertiesChanged(); + void onLayerSelectionChanged( const QItemSelection &selected, const QItemSelection &deselected ); private: QgsElevationProfileCanvas *mCanvas = nullptr; @@ -154,6 +159,10 @@ class QgsElevationProfileWidget : public QWidget QAction *mNudgeRightAction = nullptr; QAction *mRenameProfileAction = nullptr; QAction *mLockRatioAction = nullptr; + QAction *mShowInflectionLinesAction = nullptr; + QgsElevationProfileWidgetToggleEditingLayerAction *mToggleEditLayerAction = nullptr; + QgsElevationProfileWidgetSaveLayerAction *mSaveLayerAction = nullptr; + QgsElevationProfileWidgetDeleteFeaturesAction *mDeleteFeaturesAction = nullptr; QMenu *mDistanceUnitMenu = nullptr; QgsDockableWidgetHelper *mDockableWidgetHelper = nullptr; @@ -174,6 +183,9 @@ class QgsElevationProfileWidget : public QWidget QgsPlotToolXAxisZoom *mXAxisZoomTool = nullptr; QgsPlotToolZoom *mZoomTool = nullptr; QgsElevationProfileToolIdentify *mIdentifyTool = nullptr; + QgsElevationProfileToolAddPoint *mAddPointTool = nullptr; + QgsElevationProfileToolMovePoint *mMovePointTool = nullptr; + QgsElevationProfileToolSelectFeatures *mSelectFeaturesTool = nullptr; QgsElevationProfileWidgetSettingsAction *mSettingsAction = nullptr; @@ -196,4 +208,43 @@ class QgsElevationProfileWidgetSettingsAction : public QWidgetAction QgsDoubleSpinBox *mToleranceWidget = nullptr; }; +class QgsElevationProfileWidgetSaveLayerAction : public QAction +{ + Q_OBJECT + + public: + QgsElevationProfileWidgetSaveLayerAction( const QString &text, QWidget *parent = nullptr ); + void setLayer( QgsVectorLayer *layer ); + + private: + QgsVectorLayer *mLayer = nullptr; + void handleEnableState(); +}; + +class QgsElevationProfileWidgetToggleEditingLayerAction : public QAction +{ + Q_OBJECT + + public: + QgsElevationProfileWidgetToggleEditingLayerAction( const QString &text, QWidget *parent = nullptr ); + void setLayer( QgsVectorLayer *layer ); + + private: + QgsVectorLayer *mLayer = nullptr; + void handleCheckEnableStates(); +}; + +class QgsElevationProfileWidgetDeleteFeaturesAction : public QAction +{ + Q_OBJECT + + public: + QgsElevationProfileWidgetDeleteFeaturesAction( const QString &text, QWidget *parent = nullptr ); + void setLayer( QgsVectorLayer *layer ); + + private: + QgsVectorLayer *mLayer = nullptr; + void handleEnableState(); +}; + #endif // QGSELEVATIONPROFILEWIDGET_H diff --git a/src/app/georeferencer/qgsgeorefmainwindow.cpp b/src/app/georeferencer/qgsgeorefmainwindow.cpp index d53cfd947044..8f1ac05f0fee 100644 --- a/src/app/georeferencer/qgsgeorefmainwindow.cpp +++ b/src/app/georeferencer/qgsgeorefmainwindow.cpp @@ -30,10 +30,14 @@ #include #include +#include "qgsadvanceddigitizingdockwidget.h" +#include "qgsmapcanvassnappingutils.h" +#include "qgsmaptooladvanceddigitizing.h" #include "qgssettings.h" #include "qgsapplication.h" #include "qgsgui.h" #include "qgisapp.h" +#include "qgssettingsregistrycore.h" #include "qgslayoutitemlabel.h" #include "qgslayoutitemmap.h" @@ -46,6 +50,7 @@ #include "qgsmaptoolzoom.h" #include "qgsmaptoolpan.h" #include "qgsdatasourceselectdialog.h" +#include "qgssnappingwidget.h" #include "qgsproject.h" #include "qgsrasterlayer.h" @@ -71,23 +76,28 @@ #include "qgssettingsentryenumflag.h" #include "qgslayoutexporter.h" -const QgsSettingsEntryEnumFlag *QgsGeoreferencerMainWindow::settingResamplingMethod = new QgsSettingsEntryEnumFlag( QStringLiteral( "resampling-method" ), sTreeGeoreferencer, QgsImageWarper::ResamplingMethod::NearestNeighbour, QObject::tr( "Last used georeferencer resampling method" ) ); +const QgsSettingsEntryEnumFlag *QgsGeoreferencerMainWindow::settingResamplingMethod = new QgsSettingsEntryEnumFlag( QStringLiteral( "resampling-method" ), sTreeGeoreferencer, QgsImageWarper::ResamplingMethod::NearestNeighbour, QStringLiteral( "Last used georeferencer resampling method" ) ); -const QgsSettingsEntryString *QgsGeoreferencerMainWindow::settingCompressionMethod = new QgsSettingsEntryString( QStringLiteral( "compression-method" ), sTreeGeoreferencer, QStringLiteral( "NONE" ), QObject::tr( "Last used georeferencer compression method" ) ); +const QgsSettingsEntryStringList *QgsGeoreferencerMainWindow::settingCreationOptions = new QgsSettingsEntryStringList( QStringLiteral( "creation-options" ), sTreeGeoreferencer, QStringList(), QStringLiteral( "Last used georeferencer raster creation options" ) ); -const QgsSettingsEntryBool *QgsGeoreferencerMainWindow::settingUseZeroForTransparent = new QgsSettingsEntryBool( QStringLiteral( "use-zero-for-transparent" ), sTreeGeoreferencer, false, QObject::tr( "Last used georeferencer use-zero-as-transparent option" ) ); +const QgsSettingsEntryBool *QgsGeoreferencerMainWindow::settingUseZeroForTransparent = new QgsSettingsEntryBool( QStringLiteral( "use-zero-for-transparent" ), sTreeGeoreferencer, false, QStringLiteral( "Last used georeferencer use-zero-as-transparent option" ) ); -const QgsSettingsEntryEnumFlag *QgsGeoreferencerMainWindow::settingTransformMethod = new QgsSettingsEntryEnumFlag( QStringLiteral( "transform-method" ), sTreeGeoreferencer, QgsGcpTransformerInterface::TransformMethod::Linear, QObject::tr( "Last used georeferencer transform method" ) ); +const QgsSettingsEntryEnumFlag *QgsGeoreferencerMainWindow::settingTransformMethod = new QgsSettingsEntryEnumFlag( QStringLiteral( "transform-method" ), sTreeGeoreferencer, QgsGcpTransformerInterface::TransformMethod::Linear, QStringLiteral( "Last used georeferencer transform method" ) ); -const QgsSettingsEntryBool *QgsGeoreferencerMainWindow::settingSaveGcps = new QgsSettingsEntryBool( QStringLiteral( "save-gcp-points" ), sTreeGeoreferencer, false, QObject::tr( "Whether georeferencer should automatically save .points files" ) ); +const QgsSettingsEntryBool *QgsGeoreferencerMainWindow::settingSaveGcps = new QgsSettingsEntryBool( QStringLiteral( "save-gcp-points" ), sTreeGeoreferencer, false, QStringLiteral( "Whether georeferencer should automatically save .points files" ) ); -const QgsSettingsEntryBool *QgsGeoreferencerMainWindow::settingLoadInProject = new QgsSettingsEntryBool( QStringLiteral( "load-result-in-project" ), sTreeGeoreferencer, true, QObject::tr( "Whether georeferencer should automatically load results into the current project" ) ); +const QgsSettingsEntryBool *QgsGeoreferencerMainWindow::settingLoadInProject = new QgsSettingsEntryBool( QStringLiteral( "load-result-in-project" ), sTreeGeoreferencer, true, QStringLiteral( "Whether georeferencer should automatically load results into the current project" ) ); -const QgsSettingsEntryString *QgsGeoreferencerMainWindow::settingLastSourceFolder = new QgsSettingsEntryString( QStringLiteral( "last-source-folder" ), sTreeGeoreferencer, QString(), QObject::tr( "Last used folder for georeferencer source files" ) ); +const QgsSettingsEntryString *QgsGeoreferencerMainWindow::settingLastSourceFolder = new QgsSettingsEntryString( QStringLiteral( "last-source-folder" ), sTreeGeoreferencer, QString(), QStringLiteral( "Last used folder for georeferencer source files" ) ); -const QgsSettingsEntryString *QgsGeoreferencerMainWindow::settingLastRasterFileFilter = new QgsSettingsEntryString( QStringLiteral( "last-raster-file-filter" ), sTreeGeoreferencer, QString(), QObject::tr( "Last used raster file filter for georeferencer source files" ) ); +const QgsSettingsEntryString *QgsGeoreferencerMainWindow::settingLastRasterFileFilter = new QgsSettingsEntryString( QStringLiteral( "last-raster-file-filter" ), sTreeGeoreferencer, QString(), QStringLiteral( "Last used raster file filter for georeferencer source files" ) ); + +const QgsSettingsEntryString *QgsGeoreferencerMainWindow::settingLastTargetCrs = new QgsSettingsEntryString( QStringLiteral( "last-target-crs" ), sTreeGeoreferencer, QString(), QStringLiteral( "Last used georeferencer target CRS" ) ); + +const QgsSettingsEntryBool *QgsGeoreferencerMainWindow::settingSnappingEnabled = new QgsSettingsEntryBool( QStringLiteral( "snapping-enabled" ), sTreeGeoreferencer, false, QStringLiteral( "Snapping enabled." ) ); + +const QgsSettingsEntryEnumFlag *QgsGeoreferencerMainWindow::settingSnappingTypes = new QgsSettingsEntryEnumFlag( QStringLiteral( "snapping-types" ), sTreeGeoreferencer, Qgis::SnappingType::Vertex, QStringLiteral( "Snapping types." ) ); -const QgsSettingsEntryString *QgsGeoreferencerMainWindow::settingLastTargetCrs = new QgsSettingsEntryString( QStringLiteral( "last-target-crs" ), sTreeGeoreferencer, QString(), QObject::tr( "Last used georeferencer target CRS" ) ); QgsGeorefDockWidget::QgsGeorefDockWidget( const QString &title, QWidget *parent, Qt::WindowFlags flags ) : QgsDockWidget( title, parent, flags ) @@ -138,6 +148,19 @@ QgsGeoreferencerMainWindow::QgsGeoreferencerMainWindow( QWidget *parent, Qt::Win } } +void QgsGeoreferencerMainWindow::showGeoreferencer() +{ + if ( mDock ) + { + mDock->setUserVisible( true ); + } + else + { + show(); + setFocus(); + } +} + void QgsGeoreferencerMainWindow::dockThisWindow( bool dock ) { if ( mDock ) @@ -444,7 +467,7 @@ bool QgsGeoreferencerMainWindow::showTransformSettingsDialog() d.setCreateWorldFileOnly( mCreateWorldFileOnly ); d.setTransformMethod( mTransformMethod ); d.setResamplingMethod( mResamplingMethod ); - d.setCompressionMethod( mCompressionMethod ); + d.setCreationOptions( mCreationOptions.join( ' ' ) ); d.setPdfMapFilename( mPdfOutputMapFile ); d.setPdfReportFilename( mPdfOutputFile ); d.setSaveGcpPoints( mSaveGcp ); @@ -462,7 +485,7 @@ bool QgsGeoreferencerMainWindow::showTransformSettingsDialog() mTargetCrs = d.targetCrs(); mTransformMethod = d.transformMethod(); mResamplingMethod = d.resamplingMethod(); - mCompressionMethod = d.compressionMethod(); + mCreationOptions = d.creationOptions(); mModifiedFileName = d.destinationFilename(); mPdfOutputMapFile = d.pdfMapFilename(); mPdfOutputFile = d.pdfReportFilename(); @@ -524,7 +547,7 @@ void QgsGeoreferencerMainWindow::generateGDALScript() int order = polynomialOrder( mTransformMethod ); if ( order != 0 ) { - gdalwarpCommand = generateGDALwarpCommand( resamplingStr, mCompressionMethod, mUseZeroForTrans, order, mUserResX, mUserResY ); + gdalwarpCommand = generateGDALwarpCommand( resamplingStr, mCreationOptions, mUseZeroForTrans, order, mUserResX, mUserResY ); showGDALScript( QStringList() << translateCommand << gdalwarpCommand ); } else @@ -1098,6 +1121,66 @@ void QgsGeoreferencerMainWindow::createMapCanvas() mCentralLayout->addWidget( mCanvas, 0, 0, 2, 1 ); + // snapping + cad + mAdvancedDigitizingDockWidget = new QgsAdvancedDigitizingDockWidget( mCanvas ); + addDockWidget( Qt::LeftDockWidgetArea, mAdvancedDigitizingDockWidget ); + mAdvancedDigitizingDockWidget->hide(); + connect( mActionAdvancedDigitizingDock, &QAction::triggered, mAdvancedDigitizingDockWidget, [=]( bool checked ) { mAdvancedDigitizingDockWidget->setVisible( checked ); } ); + + QgsSnappingConfig snappingConfig; + snappingConfig.setMode( Qgis::SnappingMode::AllLayers ); + snappingConfig.setTypeFlag( settingSnappingTypes->value() ); + snappingConfig.setTolerance( QgsSettingsRegistryCore::settingsDigitizingDefaultSnappingTolerance->value() ); + snappingConfig.setUnits( QgsSettingsRegistryCore::settingsDigitizingDefaultSnappingToleranceUnit->value() ); + snappingConfig.setEnabled( settingSnappingEnabled->value() ); + + mSnappingUtils = new QgsMapCanvasSnappingUtils( mCanvas, this ); + mSnappingUtils->setConfig( snappingConfig ); + mCanvas->setSnappingUtils( mSnappingUtils ); + + // type button + mSnappingTypeButton = new QToolButton( this ); + mSnappingTypeButton->setCheckable( true ); + mSnappingTypeButton->setChecked( snappingConfig.enabled() ); + mSnappingTypeButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mIconSnapping.svg" ) ) ); + mSnappingTypeButton->setToolTip( tr( "Snapping Type" ) ); + mSnappingTypeButton->setPopupMode( QToolButton::MenuButtonPopup ); + SnapTypeMenu *typeMenu = new SnapTypeMenu( tr( "Set Snapping Mode" ), this ); + + for ( Qgis::SnappingType type : qgsEnumList() ) + { + if ( type == Qgis::SnappingType::NoSnap ) + continue; + QAction *action = new QAction( QgsSnappingConfig::snappingTypeToIcon( type ), QgsSnappingConfig::snappingTypeToString( type ), typeMenu ); + action->setData( QVariant::fromValue( type ) ); + action->setCheckable( true ); + action->setChecked( snappingConfig.typeFlag().testFlag( type ) ); + typeMenu->addAction( action ); + mSnappingTypeActions << action; + } + + mSnappingTypeButton->setMenu( typeMenu ); + mSnappingTypeButton->setObjectName( QStringLiteral( "SnappingTypeButton" ) ); + connect( mSnappingTypeButton, &QToolButton::triggered, this, [=]( QAction *action ) { + QgsSnappingConfig snappingConfig = mSnappingUtils->config(); + unsigned int type = static_cast( snappingConfig.typeFlag() ); + const Qgis::SnappingTypes actionFlag = static_cast( action->data().toInt() ); + type ^= actionFlag; + snappingConfig.setTypeFlag( static_cast( type ) ); + mSnappingUtils->setConfig( snappingConfig ); + } ); + + connect( mSnappingTypeButton, &QToolButton::clicked, this, [=]( bool checked ) { + QgsSnappingConfig snappingConfig = mSnappingUtils->config(); + snappingConfig.setEnabled( checked ); + mSnappingUtils->setConfig( snappingConfig ); + for ( QAction *action : std::as_const( mSnappingTypeActions ) ) + action->setEnabled( checked ); + } ); + + toolBarEdit->insertWidget( mActionAdvancedDigitizingDock, mSnappingTypeButton ); + + // set up map tools mToolZoomIn = new QgsMapToolZoom( mCanvas, false /* zoomOut */ ); mToolZoomIn->setAction( mActionZoomIn ); @@ -1108,7 +1191,7 @@ void QgsGeoreferencerMainWindow::createMapCanvas() mToolPan = new QgsMapToolPan( mCanvas ); mToolPan->setAction( mActionPan ); - mToolAddPoint = new QgsGeorefToolAddPoint( mCanvas ); + mToolAddPoint = new QgsGeorefToolAddPoint( mCanvas, mAdvancedDigitizingDockWidget ); mToolAddPoint->setAction( mActionAddPoint ); connect( mToolAddPoint, &QgsGeorefToolAddPoint::showCoordDialog, this, &QgsGeoreferencerMainWindow::showCoordDialog ); @@ -1370,7 +1453,7 @@ void QgsGeoreferencerMainWindow::readSettings() // warp options mResamplingMethod = settingResamplingMethod->value(); - mCompressionMethod = settingCompressionMethod->value(); + mCreationOptions = settingCreationOptions->value(); mUseZeroForTrans = settingUseZeroForTransparent->value(); mTransformMethod = settingTransformMethod->value(); mSaveGcp = settingSaveGcps->value(); @@ -1385,7 +1468,7 @@ void QgsGeoreferencerMainWindow::writeSettings() settingTransformMethod->setValue( mTransformMethod ); settingResamplingMethod->setValue( mResamplingMethod ); - settingCompressionMethod->setValue( mCompressionMethod ); + settingCreationOptions->setValue( mCreationOptions ); settingUseZeroForTransparent->setValue( mUseZeroForTrans ); settingSaveGcps->setValue( mSaveGcp ); settingLoadInProject->setValue( mLoadInQgis ); @@ -1527,13 +1610,13 @@ bool QgsGeoreferencerMainWindow::georeferenceRaster() mGeorefTransform, mResamplingMethod, mUseZeroForTrans, - mCompressionMethod, + mCreationOptions, mTargetCrs, mUserResX, mUserResY ); - std::unique_ptr progressDialog = std::make_unique( tr( "Georeferencing layer…" ), tr( "Abort" ), 0, 100, this ); + auto progressDialog = std::make_unique( tr( "Georeferencing layer…" ), tr( "Abort" ), 0, 100, this ); progressDialog->setWindowTitle( tr( "Georeferencer" ) ); connect( task, &QgsTask::progressChanged, progressDialog.get(), [&]( double progress ) { progressDialog->setValue( static_cast( progress ) ); @@ -1593,7 +1676,7 @@ bool QgsGeoreferencerMainWindow::georeferenceVector() { QgsVectorWarperTask *task = new QgsVectorWarperTask( mTransformMethod, mPoints.asPoints(), mTargetCrs, qobject_cast( mLayer.get() ), mModifiedFileName ); - std::unique_ptr progressDialog = std::make_unique( tr( "Georeferencing layer…" ), tr( "Abort" ), 0, 100, this ); + auto progressDialog = std::make_unique( tr( "Georeferencing layer…" ), tr( "Abort" ), 0, 100, this ); progressDialog->setWindowTitle( tr( "Georeferencer" ) ); connect( task, &QgsTask::progressChanged, progressDialog.get(), [&]( double progress ) { progressDialog->setValue( static_cast( progress ) ); @@ -1769,7 +1852,7 @@ bool QgsGeoreferencerMainWindow::writePDFMapFile( const QString &fileName, const //create layout QgsLayout layout( QgsProject::instance() ); - std::unique_ptr page = std::make_unique( &layout ); + auto page = std::make_unique( &layout ); double leftMargin = 8; double topMargin = 8; @@ -1836,10 +1919,10 @@ bool QgsGeoreferencerMainWindow::writePDFReportFile( const QString &fileName, co //create layout A4 with 300 dpi QgsLayout layout( QgsProject::instance() ); - std::unique_ptr page = std::make_unique( &layout ); + auto page = std::make_unique( &layout ); page->setPageSize( QgsLayoutSize( 210, 297 ) ); //A4 layout.pageCollection()->addPage( page.release() ); - std::unique_ptr page2 = std::make_unique( &layout ); + auto page2 = std::make_unique( &layout ); page2->setPageSize( QgsLayoutSize( 210, 297 ) ); //A4 layout.pageCollection()->addPage( page2.release() ); @@ -2197,7 +2280,7 @@ QString QgsGeoreferencerMainWindow::generateGDALogr2ogrCommand() const return gdalCommand.join( QLatin1Char( ' ' ) ); } -QString QgsGeoreferencerMainWindow::generateGDALwarpCommand( const QString &resampling, const QString &compress, bool useZeroForTrans, int order, double targetResX, double targetResY ) +QString QgsGeoreferencerMainWindow::generateGDALwarpCommand( const QString &resampling, const QStringList &options, bool useZeroForTrans, int order, double targetResX, double targetResY ) { QStringList gdalCommand; gdalCommand << QStringLiteral( "gdalwarp" ) << QStringLiteral( "-r" ) << resampling; @@ -2212,7 +2295,12 @@ QString QgsGeoreferencerMainWindow::generateGDALwarpCommand( const QString &resa // Otherwise, use thin plate spline interpolation gdalCommand << QStringLiteral( "-tps" ); } - gdalCommand << "-co COMPRESS=" + compress << ( useZeroForTrans ? "-dstalpha" : "" ); + + for ( const QString &option : options ) + { + gdalCommand << QStringLiteral( "-co %1" ).arg( option ); + } + gdalCommand << ( useZeroForTrans ? "-dstalpha" : "" ); if ( targetResX != 0.0 && targetResY != 0.0 ) { diff --git a/src/app/georeferencer/qgsgeorefmainwindow.h b/src/app/georeferencer/qgsgeorefmainwindow.h index e179727479e1..4d0dc9b8a4dd 100644 --- a/src/app/georeferencer/qgsgeorefmainwindow.h +++ b/src/app/georeferencer/qgsgeorefmainwindow.h @@ -31,11 +31,13 @@ class QPlainTextEdit; class QLabel; class QgisInterface; +class QgsAdvancedDigitizingDockWidget; class QgsDoubleSpinBox; class QgsGeorefDataPoint; class QgsGCPListWidget; class QgsMapTool; class QgsMapCanvas; +class QgsMapCanvasSnappingUtils; class QgsMapCoordsDialog; class QgsPointXY; class QgsRasterLayer; @@ -50,6 +52,7 @@ class QgsMapLayer; class QgsScreenHelper; class QgsSettingsEntryBool; class QgsSettingsEntryString; +class QgsSettingsEntryStringList; template class QgsSettingsEntryEnumFlag; @@ -68,7 +71,7 @@ class APP_EXPORT QgsGeoreferencerMainWindow : public QMainWindow, private Ui::Qg static inline QgsSettingsTreeNode *sTreeGeoreferencer = QgsSettingsTree::sTreeApp->createChildNode( QStringLiteral( "georeferencer" ) ); static const QgsSettingsEntryEnumFlag *settingResamplingMethod; - static const QgsSettingsEntryString *settingCompressionMethod; + static const QgsSettingsEntryStringList *settingCreationOptions; static const QgsSettingsEntryBool *settingUseZeroForTransparent; static const QgsSettingsEntryEnumFlag *settingTransformMethod; static const QgsSettingsEntryBool *settingSaveGcps; @@ -76,10 +79,14 @@ class APP_EXPORT QgsGeoreferencerMainWindow : public QMainWindow, private Ui::Qg static const QgsSettingsEntryString *settingLastSourceFolder; static const QgsSettingsEntryString *settingLastRasterFileFilter; static const QgsSettingsEntryString *settingLastTargetCrs; + static const QgsSettingsEntryBool *settingSnappingEnabled; + static const QgsSettingsEntryEnumFlag *settingSnappingTypes; QgsGeoreferencerMainWindow( QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() ); ~QgsGeoreferencerMainWindow() override; + void showGeoreferencer(); + protected: void closeEvent( QCloseEvent * ) override; void dropEvent( QDropEvent *event ) override; @@ -204,7 +211,7 @@ class APP_EXPORT QgsGeoreferencerMainWindow : public QMainWindow, private Ui::Qg * For values in the range 1 to 3, the parameter "order" prescribes the degree of the interpolating polynomials to use, * a value of -1 indicates that thin plate spline interpolation should be used for warping. */ - QString generateGDALwarpCommand( const QString &resampling, const QString &compress, bool useZeroForTrans, int order, double targetResX, double targetResY ); + QString generateGDALwarpCommand( const QString &resampling, const QStringList &options, bool useZeroForTrans, int order, double targetResX, double targetResY ); // utils bool validate(); @@ -264,13 +271,17 @@ class APP_EXPORT QgsGeoreferencerMainWindow : public QMainWindow, private Ui::Qg QgsGcpTransformerInterface::TransformMethod mTransformMethod = QgsGcpTransformerInterface::TransformMethod::InvalidTransform; QgsImageWarper::ResamplingMethod mResamplingMethod; QgsGeorefTransform mGeorefTransform; - QString mCompressionMethod = QStringLiteral( "NONE" ); + QStringList mCreationOptions; bool mCreateWorldFileOnly = false; QgsGCPList mPoints; QList mSavedPoints; QgsMapCanvas *mCanvas = nullptr; + QgsMapCanvasSnappingUtils *mSnappingUtils = nullptr; + QgsAdvancedDigitizingDockWidget *mAdvancedDigitizingDockWidget = nullptr; + QToolButton *mSnappingTypeButton = nullptr; + QList mSnappingTypeActions; std::unique_ptr mLayer; QgsMapTool *mToolZoomIn = nullptr; diff --git a/src/app/georeferencer/qgsgeoreftooladdpoint.cpp b/src/app/georeferencer/qgsgeoreftooladdpoint.cpp index a70bf3b65d73..2e3df552db5f 100644 --- a/src/app/georeferencer/qgsgeoreftooladdpoint.cpp +++ b/src/app/georeferencer/qgsgeoreftooladdpoint.cpp @@ -18,17 +18,12 @@ #include "moc_qgsgeoreftooladdpoint.cpp" #include "qgsmapmouseevent.h" -QgsGeorefToolAddPoint::QgsGeorefToolAddPoint( QgsMapCanvas *canvas ) - : QgsMapToolEmitPoint( canvas ) +QgsGeorefToolAddPoint::QgsGeorefToolAddPoint( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *advancedDigitizingDockWidget ) + : QgsMapToolCapture( canvas, advancedDigitizingDockWidget, QgsMapToolCapture::CaptureMode::CapturePoint ) { } -// Mouse press event for overriding -void QgsGeorefToolAddPoint::canvasPressEvent( QgsMapMouseEvent *e ) +void QgsGeorefToolAddPoint::pointCaptured( const QgsPoint &point ) { - // Only add point on Qt:LeftButton - if ( Qt::LeftButton == e->button() ) - { - emit showCoordDialog( toMapCoordinates( e->pos() ) ); - } + emit showCoordDialog( point ); } diff --git a/src/app/georeferencer/qgsgeoreftooladdpoint.h b/src/app/georeferencer/qgsgeoreftooladdpoint.h index 1be56cbeb717..6c936491fc02 100644 --- a/src/app/georeferencer/qgsgeoreftooladdpoint.h +++ b/src/app/georeferencer/qgsgeoreftooladdpoint.h @@ -17,20 +17,20 @@ #define QGSGEOREFTOOLADDPOINT_H -#include "qgsmaptoolemitpoint.h" +#include "qgsmaptoolcapture.h" class QgsPointXY; class QgsMapCanvas; +class QgsAdvancedDigitizingDockWidget; -class QgsGeorefToolAddPoint : public QgsMapToolEmitPoint +class QgsGeorefToolAddPoint : public QgsMapToolCapture { Q_OBJECT public: - explicit QgsGeorefToolAddPoint( QgsMapCanvas *canvas ); + explicit QgsGeorefToolAddPoint( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *advancedDigitizingDockWidget ); - // Mouse events for overriding - void canvasPressEvent( QgsMapMouseEvent *e ) override; + void pointCaptured( const QgsPoint &point ); signals: void showCoordDialog( const QgsPointXY &sourceCoordinates ); diff --git a/src/app/georeferencer/qgsgeoreftransform.cpp b/src/app/georeferencer/qgsgeoreftransform.cpp index 4ffdcb201157..01838b9b8b07 100644 --- a/src/app/georeferencer/qgsgeoreftransform.cpp +++ b/src/app/georeferencer/qgsgeoreftransform.cpp @@ -76,7 +76,7 @@ bool QgsGeorefTransform::parametersInitialized() const QgsGcpTransformerInterface *QgsGeorefTransform::clone() const { - std::unique_ptr res( new QgsGeorefTransform( *this ) ); + auto res = std::make_unique( *this ); res->updateParametersFromGcps( mSourceCoordinates, mDestinationCoordinates, mInvertYAxis ); return res.release(); } diff --git a/src/app/georeferencer/qgsgeoreftransform.h b/src/app/georeferencer/qgsgeoreftransform.h index 587ec1a5e28c..2a46e583b715 100644 --- a/src/app/georeferencer/qgsgeoreftransform.h +++ b/src/app/georeferencer/qgsgeoreftransform.h @@ -40,6 +40,9 @@ class APP_EXPORT QgsGeorefTransform : public QgsGcpTransformerInterface QgsGeorefTransform(); ~QgsGeorefTransform() override; + //! shallow copy constructor + QgsGeorefTransform( const QgsGeorefTransform &other ); + /** * Switches the used transform type to the given parametrisation. */ @@ -116,8 +119,6 @@ class APP_EXPORT QgsGeorefTransform : public QgsGcpTransformerInterface bool getOriginScaleRotation( QgsPointXY &origin, double &scaleX, double &scaleY, double &rotation ) const; private: - // shallow copy constructor - QgsGeorefTransform( const QgsGeorefTransform &other ); QgsGeorefTransform &operator=( const QgsGeorefTransform & ) = delete; bool transformPrivate( const QgsPointXY &src, QgsPointXY &dst, bool inverseTransform ) const; diff --git a/src/app/georeferencer/qgsimagewarper.cpp b/src/app/georeferencer/qgsimagewarper.cpp index a88c9dc51768..b700d12aebdd 100644 --- a/src/app/georeferencer/qgsimagewarper.cpp +++ b/src/app/georeferencer/qgsimagewarper.cpp @@ -61,7 +61,7 @@ bool QgsImageWarper::openSrcDSAndGetWarpOpt( const QString &input, ResamplingMet return true; } -bool QgsImageWarper::createDestinationDataset( const QString &outputName, GDALDatasetH hSrcDS, gdal::dataset_unique_ptr &hDstDS, uint resX, uint resY, double *adfGeoTransform, bool useZeroAsTrans, const QString &compression, const QgsCoordinateReferenceSystem &crs ) +bool QgsImageWarper::createDestinationDataset( const QString &outputName, GDALDatasetH hSrcDS, gdal::dataset_unique_ptr &hDstDS, uint resX, uint resY, double *adfGeoTransform, bool useZeroAsTrans, const QStringList &options, const QgsCoordinateReferenceSystem &crs ) { // create the output file GDALDriverH driver = GDALGetDriverByName( "GTiff" ); @@ -70,7 +70,11 @@ bool QgsImageWarper::createDestinationDataset( const QString &outputName, GDALDa return false; } char **papszOptions = nullptr; - papszOptions = CSLSetNameValue( papszOptions, "COMPRESS", compression.toLatin1() ); + for ( const QString &option : options ) + { + QStringList tokens = option.split( '=', Qt::SkipEmptyParts ); + papszOptions = CSLSetNameValue( papszOptions, tokens.at( 0 ).toUtf8().constData(), tokens.at( 1 ).toUtf8().constData() ); + } hDstDS.reset( GDALCreate( driver, outputName.toUtf8().constData(), resX, resY, GDALGetRasterCount( hSrcDS ), GDALGetRasterDataType( GDALGetRasterBand( hSrcDS, 1 ) ), papszOptions ) ); if ( !hDstDS ) { @@ -123,7 +127,7 @@ bool QgsImageWarper::createDestinationDataset( const QString &outputName, GDALDa return true; } -QgsImageWarper::Result QgsImageWarper::warpFile( const QString &input, const QString &output, const QgsGeorefTransform &georefTransform, ResamplingMethod resampling, bool useZeroAsTrans, const QString &compression, const QgsCoordinateReferenceSystem &crs, QgsFeedback *feedback, double destResX, double destResY ) +QgsImageWarper::Result QgsImageWarper::warpFile( const QString &input, const QString &output, const QgsGeorefTransform &georefTransform, ResamplingMethod resampling, bool useZeroAsTrans, const QStringList &options, const QgsCoordinateReferenceSystem &crs, QgsFeedback *feedback, double destResX, double destResY ) { if ( !georefTransform.parametersInitialized() ) return QgsImageWarper::Result::InvalidParameters; @@ -181,7 +185,7 @@ QgsImageWarper::Result QgsImageWarper::warpFile( const QString &input, const QSt adfGeoTransform[5] = destResY; } - if ( !createDestinationDataset( output, hSrcDS.get(), hDstDS, destPixels, destLines, adfGeoTransform, useZeroAsTrans, compression, crs ) ) + if ( !createDestinationDataset( output, hSrcDS.get(), hDstDS, destPixels, destLines, adfGeoTransform, useZeroAsTrans, options, crs ) ) { return QgsImageWarper::Result::DestinationCreationError; } @@ -204,6 +208,8 @@ QgsImageWarper::Result QgsImageWarper::warpFile( const QString &input, const QSt eErr = oOperation.ChunkAndWarpImage( 0, 0, destPixels, destLines ); destroyGeoToPixelTransform( psWarpOptions->pTransformerArg ); + psWarpOptions.reset(); + return feedback->isCanceled() ? QgsImageWarper::Result::Canceled : eErr == CE_None ? QgsImageWarper::Result::Success : QgsImageWarper::Result::WarpFailure; } @@ -311,14 +317,14 @@ GDALResampleAlg QgsImageWarper::toGDALResampleAlg( const QgsImageWarper::Resampl // QgsImageWarperTask // -QgsImageWarperTask::QgsImageWarperTask( const QString &input, const QString &output, const QgsGeorefTransform &georefTransform, QgsImageWarper::ResamplingMethod resampling, bool useZeroAsTrans, const QString &compression, const QgsCoordinateReferenceSystem &crs, double destResX, double destResY ) +QgsImageWarperTask::QgsImageWarperTask( const QString &input, const QString &output, const QgsGeorefTransform &georefTransform, QgsImageWarper::ResamplingMethod resampling, bool useZeroAsTrans, const QStringList &options, const QgsCoordinateReferenceSystem &crs, double destResX, double destResY ) : QgsTask( tr( "Warping %1" ).arg( input ), QgsTask::CanCancel ) , mInput( input ) , mOutput( output ) , mTransform( qgis::down_cast( georefTransform.clone() ) ) , mResamplingMethod( resampling ) , mUseZeroAsTrans( useZeroAsTrans ) - , mCompression( compression ) + , mCreationOptions( options ) , mDestinationCrs( crs ) , mDestinationResX( destResX ) , mDestinationResY( destResY ) @@ -345,7 +351,7 @@ bool QgsImageWarperTask::run() *mTransform.get(), mResamplingMethod, mUseZeroAsTrans, - mCompression, + mCreationOptions, mDestinationCrs, mFeedback.get(), mDestinationResX, diff --git a/src/app/georeferencer/qgsimagewarper.h b/src/app/georeferencer/qgsimagewarper.h index 398a7cbbd520..9ba60ec2a234 100644 --- a/src/app/georeferencer/qgsimagewarper.h +++ b/src/app/georeferencer/qgsimagewarper.h @@ -68,13 +68,13 @@ class APP_EXPORT QgsImageWarper * \param georefTransform specifies the warp transformation which should be applied to \a input. * \param resampling specifies image resampling algorithm to use. * \param useZeroAsTrans specifies whether to mark transparent areas with a value of "zero". - * \param compression image compression method + * \param options raster creation options * \param crs output file CRS * \param feedback optional feedback object * \param destResX The desired horizontal resolution of the output file, in target georeferenced units. A value of zero means automatic selection. * \param destResY The desired vertical resolution of the output file, in target georeferenced units. A value of zero means automatic selection. */ - Result warpFile( const QString &input, const QString &output, const QgsGeorefTransform &georefTransform, ResamplingMethod resampling, bool useZeroAsTrans, const QString &compression, const QgsCoordinateReferenceSystem &crs, QgsFeedback *feedback, double destResX = 0.0, double destResY = 0.0 ); + Result warpFile( const QString &input, const QString &output, const QgsGeorefTransform &georefTransform, ResamplingMethod resampling, bool useZeroAsTrans, const QStringList &options, const QgsCoordinateReferenceSystem &crs, QgsFeedback *feedback, double destResX = 0.0, double destResY = 0.0 ); private: struct TransformChain @@ -101,7 +101,7 @@ class APP_EXPORT QgsImageWarper bool openSrcDSAndGetWarpOpt( const QString &input, ResamplingMethod resampling, const GDALTransformerFunc &pfnTransform, gdal::dataset_unique_ptr &hSrcDS, gdal::warp_options_unique_ptr &psWarpOptions ) const; - bool createDestinationDataset( const QString &outputName, GDALDatasetH hSrcDS, gdal::dataset_unique_ptr &hDstDS, uint resX, uint resY, double *adfGeoTransform, bool useZeroAsTrans, const QString &compression, const QgsCoordinateReferenceSystem &crs ); + bool createDestinationDataset( const QString &outputName, GDALDatasetH hSrcDS, gdal::dataset_unique_ptr &hDstDS, uint resX, uint resY, double *adfGeoTransform, bool useZeroAsTrans, const QStringList &options, const QgsCoordinateReferenceSystem &crs ); //! \brief GDAL progress callback, used to display warping progress via a QProgressDialog static int CPL_STDCALL updateWarpProgress( double dfComplete, const char *pszMessage, void *pProgressArg ); @@ -123,12 +123,12 @@ class QgsImageWarperTask : public QgsTask * \param georefTransform specifies the warp transformation which should be applied to \a input. * \param resampling specifies image resampling algorithm to use. * \param useZeroAsTrans specifies whether to mark transparent areas with a value of "zero". - * \param compression image compression method + * \param options raster creation options * \param crs output file CRS * \param destResX The desired horizontal resolution of the output file, in target georeferenced units. A value of zero means automatic selection. * \param destResY The desired vertical resolution of the output file, in target georeferenced units. A value of zero means automatic selection. */ - QgsImageWarperTask( const QString &input, const QString &output, const QgsGeorefTransform &georefTransform, QgsImageWarper::ResamplingMethod resampling, bool useZeroAsTrans, const QString &compression, const QgsCoordinateReferenceSystem &crs, double destResX = 0.0, double destResY = 0.0 ); + QgsImageWarperTask( const QString &input, const QString &output, const QgsGeorefTransform &georefTransform, QgsImageWarper::ResamplingMethod resampling, bool useZeroAsTrans, const QStringList &options, const QgsCoordinateReferenceSystem &crs, double destResX = 0.0, double destResY = 0.0 ); void cancel() override; @@ -146,7 +146,7 @@ class QgsImageWarperTask : public QgsTask std::unique_ptr mTransform; QgsImageWarper::ResamplingMethod mResamplingMethod = QgsImageWarper::ResamplingMethod::Bilinear; bool mUseZeroAsTrans = false; - QString mCompression; + QStringList mCreationOptions; QgsCoordinateReferenceSystem mDestinationCrs; double mDestinationResX = 0; double mDestinationResY = 0; diff --git a/src/app/georeferencer/qgstransformsettingsdialog.cpp b/src/app/georeferencer/qgstransformsettingsdialog.cpp index 56fad3d9f114..3b1620f5ab3b 100644 --- a/src/app/georeferencer/qgstransformsettingsdialog.cpp +++ b/src/app/georeferencer/qgstransformsettingsdialog.cpp @@ -108,11 +108,7 @@ QgsTransformSettingsDialog::QgsTransformSettingsDialog( Qgis::LayerType type, co cmbTransformType->addItem( tr( "Thin Plate Spline" ), static_cast( QgsGcpTransformerInterface::TransformMethod::ThinPlateSpline ) ); cmbTransformType->addItem( tr( "Projective" ), static_cast( QgsGcpTransformerInterface::TransformMethod::Projective ) ); - // Populate CompressionComboBox - cmbCompressionComboBox->addItem( tr( "None" ), QStringLiteral( "None" ) ); - cmbCompressionComboBox->addItem( tr( "LZW" ), QStringLiteral( "LZW" ) ); - cmbCompressionComboBox->addItem( tr( "PACKBITS" ), QStringLiteral( "PACKBITS" ) ); - cmbCompressionComboBox->addItem( tr( "DEFLATE" ), QStringLiteral( "DEFLATE" ) ); + mCreationOptionsWidget->setFormat( "GTiff" ); cmbResampling->addItem( tr( "Nearest Neighbour" ), static_cast( QgsImageWarper::ResamplingMethod::NearestNeighbour ) ); cmbResampling->addItem( tr( "Bilinear (2x2 Kernel)" ), static_cast( QgsImageWarper::ResamplingMethod::Bilinear ) ); @@ -170,14 +166,14 @@ void QgsTransformSettingsDialog::setResamplingMethod( QgsImageWarper::Resampling cmbResampling->setCurrentIndex( cmbResampling->findData( static_cast( method ) ) ); } -QString QgsTransformSettingsDialog::compressionMethod() const +QStringList QgsTransformSettingsDialog::creationOptions() const { - return cmbCompressionComboBox->currentData().toString(); + return mCreationOptionsGroupBox->isChecked() ? mCreationOptionsWidget->options() : QStringList(); } -void QgsTransformSettingsDialog::setCompressionMethod( const QString &method ) +void QgsTransformSettingsDialog::setCreationOptions( const QString &options ) { - cmbCompressionComboBox->setCurrentIndex( cmbCompressionComboBox->findData( method ) ); + mCreationOptionsWidget->setOptions( options ); } QString QgsTransformSettingsDialog::destinationFilename() const @@ -280,6 +276,13 @@ void QgsTransformSettingsDialog::accept() outputFile->setFilePath( outputFileInfo.absoluteFilePath() ); } + const QString message = mCreationOptionsWidget->validateOptions( false ); + if ( !message.isNull() ) + { + QMessageBox::warning( this, tr( "Creation Options" ), tr( "Invalid creation options:\n%1" ).arg( message ) ); + return; + } + QDialog::accept(); } diff --git a/src/app/georeferencer/qgstransformsettingsdialog.h b/src/app/georeferencer/qgstransformsettingsdialog.h index bfa183e5c924..08c80b817f34 100644 --- a/src/app/georeferencer/qgstransformsettingsdialog.h +++ b/src/app/georeferencer/qgstransformsettingsdialog.h @@ -73,14 +73,14 @@ class QgsTransformSettingsDialog : public QDialog, private Ui::QgsTransformSetti void setResamplingMethod( QgsImageWarper::ResamplingMethod method ); /** - * Returns the selected compression method. + * Returns raster creation options. */ - QString compressionMethod() const; + QStringList creationOptions() const; /** - * Sets the selected compression \a method. + * Sets raster creation options. */ - void setCompressionMethod( const QString &method ); + void setCreationOptions( const QString &options ); /** * Returns the destination filename. diff --git a/src/app/gps/qgsappgpslogging.cpp b/src/app/gps/qgsappgpslogging.cpp index e969a3f31f09..4116477cf0a1 100644 --- a/src/app/gps/qgsappgpslogging.cpp +++ b/src/app/gps/qgsappgpslogging.cpp @@ -312,7 +312,7 @@ bool QgsAppGpsLogging::createOrUpdateLogDatabase() bool createPointLayer = true; if ( !newFile ) { - std::unique_ptr testLayer = std::make_unique( ogrMetadata->encodeUri( { { QStringLiteral( "path" ), mGpkgLogFile }, { QStringLiteral( "layerName" ), QStringLiteral( "gps_points" ) } } ), QString(), QStringLiteral( "ogr" ) ); + auto testLayer = std::make_unique( ogrMetadata->encodeUri( { { QStringLiteral( "path" ), mGpkgLogFile }, { QStringLiteral( "layerName" ), QStringLiteral( "gps_points" ) } } ), QString(), QStringLiteral( "ogr" ) ); if ( testLayer->isValid() ) { createPointLayer = false; @@ -353,7 +353,7 @@ bool QgsAppGpsLogging::createOrUpdateLogDatabase() bool createTracksLayer = true; if ( !newFile ) { - std::unique_ptr testLayer = std::make_unique( ogrMetadata->encodeUri( { { QStringLiteral( "path" ), mGpkgLogFile }, { QStringLiteral( "layerName" ), QStringLiteral( "gps_tracks" ) } } ), QString(), QStringLiteral( "ogr" ) ); + auto testLayer = std::make_unique( ogrMetadata->encodeUri( { { QStringLiteral( "path" ), mGpkgLogFile }, { QStringLiteral( "layerName" ), QStringLiteral( "gps_tracks" ) } } ), QString(), QStringLiteral( "ogr" ) ); if ( testLayer->isValid() ) { createTracksLayer = false; diff --git a/src/app/layers/qgsapplayerhandling.cpp b/src/app/layers/qgsapplayerhandling.cpp index 331d977bdcb1..72aff1afa31f 100644 --- a/src/app/layers/qgsapplayerhandling.cpp +++ b/src/app/layers/qgsapplayerhandling.cpp @@ -64,6 +64,7 @@ #include "qgsgdalutils.h" #include "qgstiledscenelayer.h" #include "qgsogrproviderutils.h" +#include "qgsvirtualpointcloudprovider.h" #include #include @@ -94,7 +95,7 @@ void QgsAppLayerHandling::postProcessAddedLayer( QgsMapLayer *layer ) { if ( rasterLayer->elevationProperties()->hasElevation() ) { - std::unique_ptr terrain = std::make_unique(); + auto terrain = std::make_unique(); terrain->setLayer( rasterLayer ); QgsProject::instance()->elevationProperties()->setTerrainProvider( terrain.release() @@ -169,7 +170,7 @@ void QgsAppLayerHandling::postProcessAddedLayer( QgsMapLayer *layer ) #ifdef HAVE_3D if ( !layer->renderer3D() ) { - std::unique_ptr renderer3D = std::make_unique(); + auto renderer3D = std::make_unique(); layer->setRenderer3D( renderer3D.release() ); } #endif @@ -194,8 +195,13 @@ void QgsAppLayerHandling::postProcessAddedLayer( QgsMapLayer *layer ) // If the layer has no 3D renderer and syncing 3D to 2D renderer is enabled, we create a renderer and set it up with the 2D renderer if ( pcLayer->sync3DRendererTo2DRenderer() ) { - std::unique_ptr renderer3D = std::make_unique(); + auto renderer3D = std::make_unique(); renderer3D->convertFrom2DRenderer( pcLayer->renderer() ); + // if overview of the virtual point cloud exists set the zoom out behavior to show it + if ( const QgsVirtualPointCloudProvider *vpcProvider = dynamic_cast( pcLayer->dataProvider() ) ) + { + renderer3D->setZoomOutBehavior( vpcProvider->overview() ? Qgis::PointCloudZoomOutRenderBehavior::RenderOverview : Qgis::PointCloudZoomOutRenderBehavior::RenderExtents ); + } layer->setRenderer3D( renderer3D.release() ); } } @@ -713,42 +719,48 @@ QList QgsAppLayerHandling::addSublayers( const QListlayerTreeRegistryBridge()->layerInsertionMethod() == Qgis::LayerTreeInsertionMethod::TopOfTree ) + switch ( QgsProject::instance()->layerTreeRegistryBridge()->layerInsertionMethod() ) { - group = QgsProject::instance()->layerTreeRoot()->insertGroup( 0, groupName ); - } - else - { - QgsLayerTreeNode *currentNode { QgisApp::instance()->layerTreeView()->currentNode() }; - if ( currentNode && currentNode->parent() ) + case Qgis::LayerTreeInsertionMethod::TopOfTree: { - if ( QgsLayerTree::isGroup( currentNode ) ) - { - group = qobject_cast( currentNode )->insertGroup( 0, groupName ); - } - else if ( QgsLayerTree::isLayer( currentNode ) ) + group = QgsProject::instance()->layerTreeRoot()->insertGroup( 0, groupName ); + break; + } + case Qgis::LayerTreeInsertionMethod::AboveInsertionPoint: + case Qgis::LayerTreeInsertionMethod::OptimalInInsertionGroup: + { + QgsLayerTreeNode *currentNode { QgisApp::instance()->layerTreeView()->currentNode() }; + if ( currentNode && currentNode->parent() ) { - const QList currentNodeSiblings { currentNode->parent()->children() }; - int nodeIdx { 0 }; - for ( const QgsLayerTreeNode *child : std::as_const( currentNodeSiblings ) ) + if ( QgsLayerTree::isGroup( currentNode ) ) + { + group = qobject_cast( currentNode )->insertGroup( 0, groupName ); + } + else if ( QgsLayerTree::isLayer( currentNode ) ) { - nodeIdx++; - if ( child == currentNode ) + const QList currentNodeSiblings { currentNode->parent()->children() }; + int nodeIdx { 0 }; + for ( const QgsLayerTreeNode *child : std::as_const( currentNodeSiblings ) ) { - index = nodeIdx; - break; + nodeIdx++; + if ( child == currentNode ) + { + index = nodeIdx; + break; + } } + group = qobject_cast( currentNode->parent() )->insertGroup( index, groupName ); + } + else + { + group = QgsProject::instance()->layerTreeRoot()->insertGroup( 0, groupName ); } - group = qobject_cast( currentNode->parent() )->insertGroup( index, groupName ); } else { group = QgsProject::instance()->layerTreeRoot()->insertGroup( 0, groupName ); } - } - else - { - group = QgsProject::instance()->layerTreeRoot()->insertGroup( 0, groupName ); + break; } } } @@ -1128,8 +1140,6 @@ QList QgsAppLayerHandling::addGdalRasterLayers( const QStringList if ( QgsRasterLayer::isValidRasterFileName( uri, errMsg ) ) { - QFileInfo myFileInfo( uri ); - // set the layer name to the file base name unless provided explicitly QString layerName; const QVariantMap uriDetails = QgsProviderRegistry::instance()->decodeUri( QStringLiteral( "gdal" ), uri ); @@ -1139,7 +1149,7 @@ QList QgsAppLayerHandling::addGdalRasterLayers( const QStringList } else { - layerName = QgsProviderUtils::suggestLayerNameFromFilePath( uri ); + layerName = QgsProviderUtils::suggestLayerNameFromFilePath( uriDetails[QStringLiteral( "path" )].toString() ); } // try to create the layer @@ -1157,7 +1167,7 @@ QList QgsAppLayerHandling::addGdalRasterLayers( const QStringList //only allow one copy of a ai grid file to be loaded at a //time to prevent the user selecting all adfs in 1 dir which //actually represent 1 coverage, - + const QFileInfo myFileInfo( uriDetails[QStringLiteral( "path" )].toString() ); if ( myFileInfo.fileName().endsWith( QLatin1String( ".adf" ), Qt::CaseInsensitive ) ) { break; @@ -1642,7 +1652,7 @@ void QgsAppLayerHandling::resolveVectorLayerDependencies( QgsVectorLayer *vl, Qg } } // Load it! - std::unique_ptr newVl = std::make_unique( layerUri, !dependency.name.isEmpty() ? dependency.name : tableName, providerName ); + auto newVl = std::make_unique( layerUri, !dependency.name.isEmpty() ? dependency.name : tableName, providerName ); if ( newVl->isValid() ) { return qobject_cast( QgsProject::instance()->addMapLayer( newVl.release() ) ); diff --git a/src/app/layout/qgslayoutdesignerdialog.cpp b/src/app/layout/qgslayoutdesignerdialog.cpp index cbac5d665216..3596563a9f13 100644 --- a/src/app/layout/qgslayoutdesignerdialog.cpp +++ b/src/app/layout/qgslayoutdesignerdialog.cpp @@ -108,6 +108,8 @@ #include #endif +#include + #ifdef ENABLE_MODELTEST #include "modeltest.h" #endif @@ -2718,8 +2720,8 @@ void QgsLayoutDesignerDialog::printAtlas() printSettings.predefinedMapScales = QgsLayoutUtils::predefinedScales( mLayout ); QString error; - std::unique_ptr feedback = std::make_unique(); - std::unique_ptr progressDialog = std::make_unique( tr( "Printing maps…" ), tr( "Abort" ), 0, 100, this ); + auto feedback = std::make_unique(); + auto progressDialog = std::make_unique( tr( "Printing maps…" ), tr( "Abort" ), 0, 100, this ); progressDialog->setWindowTitle( tr( "Printing Atlas" ) ); QgsProxyProgressTask *proxyTask = new QgsProxyProgressTask( tr( "Printing “%1”" ).arg( mMasterLayout->name() ) ); @@ -2908,8 +2910,8 @@ void QgsLayoutDesignerDialog::exportAtlasToRaster() QgsAtlasExportGuard exportingAtlas( this ); QString error; - std::unique_ptr feedback = std::make_unique(); - std::unique_ptr progressDialog = std::make_unique( tr( "Rendering maps…" ), tr( "Abort" ), 0, 100, this ); + auto feedback = std::make_unique(); + auto progressDialog = std::make_unique( tr( "Rendering maps…" ), tr( "Abort" ), 0, 100, this ); progressDialog->setWindowTitle( tr( "Exporting Atlas" ) ); QgsProxyProgressTask *proxyTask = new QgsProxyProgressTask( tr( "Exporting “%1”" ).arg( mMasterLayout->name() ) ); @@ -3054,8 +3056,8 @@ void QgsLayoutDesignerDialog::exportAtlasToSvg() QgsAtlasExportGuard exportingAtlas( this ); QString error; - std::unique_ptr feedback = std::make_unique(); - std::unique_ptr progressDialog = std::make_unique( tr( "Rendering maps…" ), tr( "Abort" ), 0, 100, this ); + auto feedback = std::make_unique(); + auto progressDialog = std::make_unique( tr( "Rendering maps…" ), tr( "Abort" ), 0, 100, this ); progressDialog->setWindowTitle( tr( "Exporting Atlas" ) ); QgsProxyProgressTask *proxyTask = new QgsProxyProgressTask( tr( "Exporting “%1”" ).arg( mMasterLayout->name() ) ); @@ -3260,8 +3262,8 @@ void QgsLayoutDesignerDialog::exportAtlasToPdf() pdfSettings.rasterizeWholeImage = mLayout->customProperty( QStringLiteral( "rasterize" ), false ).toBool(); QString error; - std::unique_ptr feedback = std::make_unique(); - std::unique_ptr progressDialog = std::make_unique( tr( "Rendering maps…" ), tr( "Abort" ), 0, 100, this ); + auto feedback = std::make_unique(); + auto progressDialog = std::make_unique( tr( "Rendering maps…" ), tr( "Abort" ), 0, 100, this ); QgsProxyProgressTask *proxyTask = new QgsProxyProgressTask( tr( "Exporting “%1”" ).arg( mMasterLayout->name() ) ); @@ -3381,8 +3383,8 @@ void QgsLayoutDesignerDialog::exportReportToRaster() QgsAtlasExportGuard exportingAtlas( this ); QString error; - std::unique_ptr feedback = std::make_unique(); - std::unique_ptr progressDialog = std::make_unique( tr( "Rendering report…" ), tr( "Abort" ), 0, 0, this ); + auto feedback = std::make_unique(); + auto progressDialog = std::make_unique( tr( "Rendering report…" ), tr( "Abort" ), 0, 0, this ); progressDialog->setWindowTitle( tr( "Exporting Report" ) ); QgsProxyProgressTask *proxyTask = new QgsProxyProgressTask( tr( "Exporting “%1”" ).arg( mMasterLayout->name() ) ); @@ -3490,8 +3492,8 @@ void QgsLayoutDesignerDialog::exportReportToSvg() QgsAtlasExportGuard exportingAtlas( this ); QString error; - std::unique_ptr feedback = std::make_unique(); - std::unique_ptr progressDialog = std::make_unique( tr( "Rendering maps…" ), tr( "Abort" ), 0, 0, this ); + auto feedback = std::make_unique(); + auto progressDialog = std::make_unique( tr( "Rendering maps…" ), tr( "Abort" ), 0, 0, this ); progressDialog->setWindowTitle( tr( "Exporting Report" ) ); QgsProxyProgressTask *proxyTask = new QgsProxyProgressTask( tr( "Exporting “%1”" ).arg( mMasterLayout->name() ) ); @@ -3611,8 +3613,8 @@ void QgsLayoutDesignerDialog::exportReportToPdf() pdfSettings.rasterizeWholeImage = rasterize; QString error; - std::unique_ptr feedback = std::make_unique(); - std::unique_ptr progressDialog = std::make_unique( tr( "Rendering maps…" ), tr( "Abort" ), 0, 0, this ); + auto feedback = std::make_unique(); + auto progressDialog = std::make_unique( tr( "Rendering maps…" ), tr( "Abort" ), 0, 0, this ); progressDialog->setWindowTitle( tr( "Exporting Report" ) ); QgsProxyProgressTask *proxyTask = new QgsProxyProgressTask( tr( "Exporting “%1”" ).arg( mMasterLayout->name() ) ); @@ -3704,8 +3706,8 @@ void QgsLayoutDesignerDialog::printReport() printSettings.predefinedMapScales = QgsLayoutUtils::predefinedScales( mLayout ); QString error; - std::unique_ptr feedback = std::make_unique(); - std::unique_ptr progressDialog = std::make_unique( tr( "Printing maps…" ), tr( "Abort" ), 0, 0, this ); + auto feedback = std::make_unique(); + auto progressDialog = std::make_unique( tr( "Printing maps…" ), tr( "Abort" ), 0, 0, this ); progressDialog->setWindowTitle( tr( "Printing Report" ) ); QgsProxyProgressTask *proxyTask = new QgsProxyProgressTask( tr( "Printing “%1”" ).arg( mMasterLayout->name() ) ); @@ -3996,7 +3998,7 @@ void QgsLayoutDesignerDialog::initializeRegistry() { sInitializedRegistry = true; auto createPageWidget = ( []( QgsLayoutItem *item ) -> QgsLayoutItemBaseWidget * { - std::unique_ptr newWidget = std::make_unique( nullptr, item ); + auto newWidget = std::make_unique( nullptr, item ); return newWidget.release(); } ); @@ -4328,7 +4330,6 @@ bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExport bool disableRasterTiles = false; bool simplify = true; bool geospatialPdf = false; - bool useOgcBestPracticeFormat = false; bool losslessImages = false; QStringList exportThemes; QStringList geospatialPdfLayerOrder; @@ -4342,7 +4343,6 @@ bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExport disableRasterTiles = mLayout->customProperty( QStringLiteral( "pdfDisableRasterTiles" ), 0 ).toBool(); simplify = mLayout->customProperty( QStringLiteral( "pdfSimplify" ), 1 ).toBool(); geospatialPdf = mLayout->customProperty( QStringLiteral( "pdfCreateGeoPdf" ), 0 ).toBool(); - useOgcBestPracticeFormat = mLayout->customProperty( QStringLiteral( "pdfOgcBestPracticeFormat" ), 0 ).toBool(); const QString themes = mLayout->customProperty( QStringLiteral( "pdfExportThemes" ) ).toString(); if ( !themes.isEmpty() ) exportThemes = themes.split( QStringLiteral( "~~~" ) ); @@ -4373,12 +4373,15 @@ bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExport break; } +#if GDAL_VERSION_NUM < GDAL_COMPUTE_VERSION( 3, 11, 0 ) + // GDAL 3.11.0 has removed that limitation that wasn't necessary if ( map->mapRotation() != 0 || map->itemRotation() != 0 || map->dataDefinedProperties().isActive( QgsLayoutObject::DataDefinedProperty::MapRotation ) ) { allowGeospatialPdfExport = false; dialogGeospatialPdfReason = tr( "One or more map items are rotated. This is not supported for geospatial PDF export." ); break; } +#endif } QgsLayoutPdfExportOptionsDialog dialog( this, allowGeospatialPdfExport, dialogGeospatialPdfReason, geospatialPdfLayerOrder ); @@ -4391,7 +4394,6 @@ bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExport dialog.setRasterTilingDisabled( disableRasterTiles ); dialog.setGeometriesSimplified( simplify ); dialog.setExportGeospatialPdf( geospatialPdf ); - dialog.setUseOgcBestPracticeFormat( useOgcBestPracticeFormat ); dialog.setExportThemes( exportThemes ); dialog.setLosslessImageExport( losslessImages ); dialog.setOpenAfterExporting( QgsLayoutExporter::settingOpenAfterExportingPdf->value() ); @@ -4406,7 +4408,6 @@ bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExport simplify = dialog.geometriesSimplified(); Qgis::TextRenderFormat textRenderFormat = dialog.textRenderFormat(); geospatialPdf = dialog.exportGeospatialPdf(); - useOgcBestPracticeFormat = dialog.useOgcBestPracticeFormat(); exportThemes = dialog.exportThemes(); geospatialPdfLayerOrder = dialog.geospatialPdfLayerOrder(); losslessImages = dialog.losslessImageExport(); @@ -4422,7 +4423,6 @@ bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExport mLayout->setCustomProperty( QStringLiteral( "pdfTextFormat" ), static_cast( textRenderFormat ) ); mLayout->setCustomProperty( QStringLiteral( "pdfSimplify" ), simplify ? 1 : 0 ); mLayout->setCustomProperty( QStringLiteral( "pdfCreateGeoPdf" ), geospatialPdf ? 1 : 0 ); - mLayout->setCustomProperty( QStringLiteral( "pdfOgcBestPracticeFormat" ), useOgcBestPracticeFormat ? 1 : 0 ); mLayout->setCustomProperty( QStringLiteral( "pdfExportThemes" ), exportThemes.join( QLatin1String( "~~~" ) ) ); mLayout->setCustomProperty( QStringLiteral( "pdfLayerOrder" ), geospatialPdfLayerOrder.join( QLatin1String( "~~~" ) ) ); mLayout->setCustomProperty( QStringLiteral( "pdfGroupOrder" ), dialog.geospatialPdfGroupOrder() ); @@ -4435,8 +4435,7 @@ bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExport settings.textRenderFormat = textRenderFormat; settings.simplifyGeometries = simplify; settings.writeGeoPdf = geospatialPdf; - settings.useOgcBestPracticeFormatGeoreferencing = useOgcBestPracticeFormat; - settings.useIso32000ExtensionFormatGeoreferencing = !useOgcBestPracticeFormat; + settings.useIso32000ExtensionFormatGeoreferencing = true; settings.exportThemes = exportThemes; settings.predefinedMapScales = QgsLayoutUtils::predefinedScales( mLayout ); diff --git a/src/app/layout/qgslayoutimagedrophandler.cpp b/src/app/layout/qgslayoutimagedrophandler.cpp index 070982919dd9..5d41f1c2b193 100644 --- a/src/app/layout/qgslayoutimagedrophandler.cpp +++ b/src/app/layout/qgslayoutimagedrophandler.cpp @@ -58,7 +58,7 @@ bool QgsLayoutImageDropHandler::handleFileDrop( QgsLayoutDesignerInterface *ifac if ( !iface->layout() ) return false; - std::unique_ptr item = std::make_unique( iface->layout() ); + auto item = std::make_unique( iface->layout() ); const QgsLayoutPoint layoutPoint = iface->layout()->convertFromLayoutUnits( point, iface->layout()->units() ); @@ -92,7 +92,7 @@ bool QgsLayoutImageDropHandler::handlePaste( QgsLayoutDesignerInterface *iface, return false; const QgsLayoutPoint layoutPoint = iface->layout()->convertFromLayoutUnits( pastePoint, iface->layout()->units() ); - std::unique_ptr item = std::make_unique( iface->layout() ); + auto item = std::make_unique( iface->layout() ); const QByteArray imageData = data->data( QStringLiteral( "application/x-qt-image" ) ); if ( imageData.isEmpty() ) diff --git a/src/app/layout/qgslayoutmanagerdialog.cpp b/src/app/layout/qgslayoutmanagerdialog.cpp index b2213ebee391..40b237eed363 100644 --- a/src/app/layout/qgslayoutmanagerdialog.cpp +++ b/src/app/layout/qgslayoutmanagerdialog.cpp @@ -258,7 +258,7 @@ void QgsLayoutManagerDialog::mAddButton_clicked() title = QgsProject::instance()->layoutManager()->generateUniqueTitle( QgsMasterLayoutInterface::PrintLayout ); } - std::unique_ptr layout = std::make_unique( QgsProject::instance() ); + auto layout = std::make_unique( QgsProject::instance() ); if ( loadingTemplate ) { bool loadedOK = false; @@ -319,10 +319,10 @@ void QgsLayoutManagerDialog::createReport() title = QgsProject::instance()->layoutManager()->generateUniqueTitle( QgsMasterLayoutInterface::Report ); } - std::unique_ptr report = std::make_unique( QgsProject::instance() ); + auto report = std::make_unique( QgsProject::instance() ); report->setName( title ); - std::unique_ptr header = std::make_unique( QgsProject::instance() ); + auto header = std::make_unique( QgsProject::instance() ); header->initializeDefaults(); report->setHeader( header.release() ); report->setHeaderEnabled( true ); diff --git a/src/app/layout/qgsreportfieldgroupsectionwidget.cpp b/src/app/layout/qgsreportfieldgroupsectionwidget.cpp index 4b36886f867a..2438c341607b 100644 --- a/src/app/layout/qgsreportfieldgroupsectionwidget.cpp +++ b/src/app/layout/qgsreportfieldgroupsectionwidget.cpp @@ -91,7 +91,7 @@ void QgsReportSectionFieldGroupWidget::editHeader() { if ( !mSection->header() ) { - std::unique_ptr header = std::make_unique( mSection->project() ); + auto header = std::make_unique( mSection->project() ); header->initializeDefaults(); mSection->setHeader( header.release() ); } @@ -109,7 +109,7 @@ void QgsReportSectionFieldGroupWidget::editFooter() { if ( !mSection->footer() ) { - std::unique_ptr footer = std::make_unique( mSection->project() ); + auto footer = std::make_unique( mSection->project() ); footer->initializeDefaults(); mSection->setFooter( footer.release() ); } @@ -132,7 +132,7 @@ void QgsReportSectionFieldGroupWidget::editBody() { if ( !mSection->body() ) { - std::unique_ptr body = std::make_unique( mSection->project() ); + auto body = std::make_unique( mSection->project() ); body->initializeDefaults(); mSection->setBody( body.release() ); } diff --git a/src/app/layout/qgsreportlayoutsectionwidget.cpp b/src/app/layout/qgsreportlayoutsectionwidget.cpp index 08dbaa92fc61..36aebb555e08 100644 --- a/src/app/layout/qgsreportlayoutsectionwidget.cpp +++ b/src/app/layout/qgsreportlayoutsectionwidget.cpp @@ -48,7 +48,7 @@ void QgsReportLayoutSectionWidget::editBody() { if ( !mSection->body() ) { - std::unique_ptr body = std::make_unique( mSection->project() ); + auto body = std::make_unique( mSection->project() ); body->initializeDefaults(); mSection->setBody( body.release() ); } diff --git a/src/app/layout/qgsreportorganizerwidget.cpp b/src/app/layout/qgsreportorganizerwidget.cpp index a6c4af624620..e6f94c166e93 100644 --- a/src/app/layout/qgsreportorganizerwidget.cpp +++ b/src/app/layout/qgsreportorganizerwidget.cpp @@ -89,7 +89,7 @@ void QgsReportOrganizerWidget::setEditedSection( QgsAbstractReportSection *secti void QgsReportOrganizerWidget::addLayoutSection() { - std::unique_ptr section = std::make_unique(); + auto section = std::make_unique(); QgsAbstractReportSection *newSection = section.get(); mSectionModel->addSection( mViewSections->currentIndex(), std::move( section ) ); const QModelIndex newIndex = mSectionModel->indexForSection( newSection ); @@ -98,7 +98,7 @@ void QgsReportOrganizerWidget::addLayoutSection() void QgsReportOrganizerWidget::addFieldGroupSection() { - std::unique_ptr section = std::make_unique(); + auto section = std::make_unique(); QgsAbstractReportSection *newSection = section.get(); mSectionModel->addSection( mViewSections->currentIndex(), std::move( section ) ); const QModelIndex newIndex = mSectionModel->indexForSection( newSection ); diff --git a/src/app/layout/qgsreportsectionwidget.cpp b/src/app/layout/qgsreportsectionwidget.cpp index fd91cea652e4..81c4e7df44f0 100644 --- a/src/app/layout/qgsreportsectionwidget.cpp +++ b/src/app/layout/qgsreportsectionwidget.cpp @@ -58,7 +58,7 @@ void QgsReportSectionWidget::editHeader() { if ( !mSection->header() ) { - std::unique_ptr header = std::make_unique( mSection->project() ); + auto header = std::make_unique( mSection->project() ); header->initializeDefaults(); mSection->setHeader( header.release() ); } @@ -75,7 +75,7 @@ void QgsReportSectionWidget::editFooter() { if ( !mSection->footer() ) { - std::unique_ptr footer = std::make_unique( mSection->project() ); + auto footer = std::make_unique( mSection->project() ); footer->initializeDefaults(); mSection->setFooter( footer.release() ); } diff --git a/src/app/locator/qgsactivelayerfeatureslocatorfilter.cpp b/src/app/locator/qgsactivelayerfeatureslocatorfilter.cpp index b3a074af8983..b63b0a54a556 100644 --- a/src/app/locator/qgsactivelayerfeatureslocatorfilter.cpp +++ b/src/app/locator/qgsactivelayerfeatureslocatorfilter.cpp @@ -327,7 +327,7 @@ void QgsActiveLayerFeaturesLocatorFilter::openConfigWidget( QWidget *parent ) { QString key = "locator_filters/active_layer_features"; QgsSettings settings; - std::unique_ptr dlg( new QDialog( parent ) ); + auto dlg = std::make_unique( parent ); dlg->restoreGeometry( settings.value( QStringLiteral( "Windows/%1/geometry" ).arg( key ) ).toByteArray() ); dlg->setWindowTitle( "All layers features locator filter" ); QFormLayout *formLayout = new QFormLayout; diff --git a/src/app/locator/qgsalllayersfeatureslocatorfilter.cpp b/src/app/locator/qgsalllayersfeatureslocatorfilter.cpp index 5426fad2b4c8..ddcd95a58156 100644 --- a/src/app/locator/qgsalllayersfeatureslocatorfilter.cpp +++ b/src/app/locator/qgsalllayersfeatureslocatorfilter.cpp @@ -217,7 +217,7 @@ void QgsAllLayersFeaturesLocatorFilter::openConfigWidget( QWidget *parent ) { QString key = "locator_filters/all_layers_features"; QgsSettings settings; - std::unique_ptr dlg( new QDialog( parent ) ); + auto dlg = std::make_unique( parent ); dlg->restoreGeometry( settings.value( QStringLiteral( "Windows/%1/geometry" ).arg( key ) ).toByteArray() ); dlg->setWindowTitle( "All layers features locator filter" ); QFormLayout *formLayout = new QFormLayout; diff --git a/src/app/main.cpp b/src/app/main.cpp index d64a6aeef29b..afaaa23eedf8 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -148,7 +148,7 @@ void usage( const QString &appName ) << QStringLiteral( "\t[-g, --globalsettingsfile path]\tuse the given ini file as Global Settings (defaults)\n" ) << QStringLiteral( "\t[-a, --authdbdirectory path] use the given directory for authentication database\n" ) << QStringLiteral( "\t[-f, --code path]\trun the given python file on load\n" ) - << QStringLiteral( "\t[-F, --py-args arguments]\targuments for python. This arguments will be available for each python execution via 'sys.argv' included the file specified by '--code'. All arguments till '--' are passed to python and ignored by QGIS\n" ) + << QStringLiteral( "\t[-F, --py-args arguments]\targuments for python. These arguments will be available for each python execution via 'sys.argv' including the file specified by '--code'. All arguments till '--' are passed to python and ignored by QGIS\n" ) << QStringLiteral( "\t[-d, --defaultui]\tstart by resetting user ui settings to default\n" ) << QStringLiteral( "\t[--hide-browser]\thide the browser widget\n" ) << QStringLiteral( "\t[--dxf-export filename.dxf]\temit dxf output of loaded datasets to given file\n" ) diff --git a/src/app/maptools/qgsmaptoolshapecircle2tangentspoint.cpp b/src/app/maptools/qgsmaptoolshapecircle2tangentspoint.cpp index 263824fbf78d..9d946753bbf3 100644 --- a/src/app/maptools/qgsmaptoolshapecircle2tangentspoint.cpp +++ b/src/app/maptools/qgsmaptoolshapecircle2tangentspoint.cpp @@ -129,7 +129,7 @@ void QgsMapToolShapeCircle2TangentsPoint::cadCanvasMoveEvent( QgsMapMouseEvent * { QgsPointXY p1, p2; match.edgePoints( p1, p2 ); - std::unique_ptr line( new QgsLineString() ); + auto line = std::make_unique(); line->addVertex( QgsPoint( p1 ) ); line->addVertex( QgsPoint( p2 ) ); @@ -161,11 +161,11 @@ void QgsMapToolShapeCircle2TangentsPoint::getPossibleCenter() if ( mPoints.size() == 4 ) { - std::unique_ptr l1( new QgsLineString() ); + auto l1 = std::make_unique(); l1->addVertex( mPoints.at( 0 ) ); l1->addVertex( mPoints.at( 1 ) ); - std::unique_ptr l2( new QgsLineString() ); + auto l2 = std::make_unique(); l2->addVertex( mPoints.at( 2 ) ); l2->addVertex( mPoints.at( 3 ) ); @@ -227,7 +227,7 @@ void QgsMapToolShapeCircle2TangentsPoint::radiusSpinBoxChanged( double radius ) for ( int i = 0; i < mCenters.size(); ++i ) { std::unique_ptr tempRB( mParentTool->createGeometryRubberBand( Qgis::GeometryType::Point, true ) ); - std::unique_ptr tempCenter( new QgsPoint( mCenters.at( i ) ) ); + auto tempCenter = std::make_unique( mCenters.at( i ) ); tempRB->setGeometry( tempCenter.release() ); tempRB->show(); mRubberBands.append( tempRB.release() ); diff --git a/src/app/maptools/qgsmaptoolshapecircle3points.cpp b/src/app/maptools/qgsmaptoolshapecircle3points.cpp index 1b37cdd23c64..bfc21a431ea2 100644 --- a/src/app/maptools/qgsmaptoolshapecircle3points.cpp +++ b/src/app/maptools/qgsmaptoolshapecircle3points.cpp @@ -84,7 +84,7 @@ void QgsMapToolShapeCircle3Points::cadCanvasMoveEvent( QgsMapMouseEvent *e, QgsM { case 1: { - std::unique_ptr line( new QgsLineString() ); + auto line = std::make_unique(); line->addVertex( mPoints.at( 0 ) ); line->addVertex( mParentTool->mapPoint( *e ) ); mTempRubberBand->setGeometry( line.release() ); diff --git a/src/app/maptools/qgsmaptoolshapecircle3tangents.cpp b/src/app/maptools/qgsmaptoolshapecircle3tangents.cpp index a79b770edb0f..d107b055bf9c 100644 --- a/src/app/maptools/qgsmaptoolshapecircle3tangents.cpp +++ b/src/app/maptools/qgsmaptoolshapecircle3tangents.cpp @@ -145,7 +145,7 @@ void QgsMapToolShapeCircle3Tangents::cadCanvasMoveEvent( QgsMapMouseEvent *e, Qg } else { - std::unique_ptr line( new QgsLineString() ); + auto line = std::make_unique(); line->addVertex( mParentTool->mapPoint( p1 ) ); line->addVertex( mParentTool->mapPoint( p2 ) ); diff --git a/src/app/maptools/qgsmaptoolshapecircularstringabstract.cpp b/src/app/maptools/qgsmaptoolshapecircularstringabstract.cpp index 2ac02acae489..7fcb70f88e72 100644 --- a/src/app/maptools/qgsmaptoolshapecircularstringabstract.cpp +++ b/src/app/maptools/qgsmaptoolshapecircularstringabstract.cpp @@ -61,8 +61,8 @@ void QgsMapToolShapeCircularStringAbstract::undo() if ( mPoints.size() > 1 ) { mPoints.removeLast(); - std::unique_ptr geomRubberBand( new QgsCircularString() ); - std::unique_ptr geomTempRubberBand( new QgsLineString() ); + auto geomRubberBand = std::make_unique(); + auto geomTempRubberBand = std::make_unique(); const int lastPositionCompleteCircularString = mPoints.size() - 1 - ( mPoints.size() + 1 ) % 2; geomTempRubberBand->setPoints( mPoints.mid( lastPositionCompleteCircularString ) ); diff --git a/src/app/maptools/qgsmaptoolshapeellipsecenter2points.cpp b/src/app/maptools/qgsmaptoolshapeellipsecenter2points.cpp index 4f77c324f28d..1346918bd5b1 100644 --- a/src/app/maptools/qgsmaptoolshapeellipsecenter2points.cpp +++ b/src/app/maptools/qgsmaptoolshapeellipsecenter2points.cpp @@ -87,7 +87,7 @@ void QgsMapToolShapeEllipseCenter2Points::cadCanvasMoveEvent( QgsMapMouseEvent * { case 1: { - std::unique_ptr line( new QgsLineString() ); + auto line = std::make_unique(); line->addVertex( mPoints.at( 0 ) ); line->addVertex( point ); mTempRubberBand->setGeometry( line.release() ); diff --git a/src/app/maptools/qgsmaptoolshapeellipsefoci.cpp b/src/app/maptools/qgsmaptoolshapeellipsefoci.cpp index 988d54f23621..48d507d566c1 100644 --- a/src/app/maptools/qgsmaptoolshapeellipsefoci.cpp +++ b/src/app/maptools/qgsmaptoolshapeellipsefoci.cpp @@ -93,7 +93,7 @@ void QgsMapToolShapeEllipseFoci::cadCanvasMoveEvent( QgsMapMouseEvent *e, QgsMap { case 1: { - std::unique_ptr line( new QgsLineString() ); + auto line = std::make_unique(); line->addVertex( mPoints.at( 0 ) ); line->addVertex( point ); mTempRubberBand->setGeometry( line.release() ); diff --git a/src/app/maptools/qgsmaptoolshaperectangle3points.cpp b/src/app/maptools/qgsmaptoolshaperectangle3points.cpp index a7fd5b6380a4..eeca53b718bc 100644 --- a/src/app/maptools/qgsmaptoolshaperectangle3points.cpp +++ b/src/app/maptools/qgsmaptoolshaperectangle3points.cpp @@ -134,7 +134,7 @@ void QgsMapToolShapeRectangle3Points::cadCanvasMoveEvent( QgsMapMouseEvent *e, Q { case 1: { - std::unique_ptr line( new QgsLineString() ); + auto line = std::make_unique(); line->addVertex( mPoints.at( 0 ) ); line->addVertex( point ); mTempRubberBand->setGeometry( line.release() ); diff --git a/src/app/mesh/qgsmaptooleditmeshframe.cpp b/src/app/mesh/qgsmaptooleditmeshframe.cpp index b17180c90a3a..1d58fe0b7d8b 100644 --- a/src/app/mesh/qgsmaptooleditmeshframe.cpp +++ b/src/app/mesh/qgsmaptooleditmeshframe.cpp @@ -2064,7 +2064,7 @@ void QgsMapToolEditMeshFrame::selectTouchedByGeometry( const QgsGeometry &geomet for ( const int faceIndex : nativeFaceIndexes ) { const QgsMeshFace &face = nativeFace( faceIndex ); - std::unique_ptr faceGeom( new QgsPolygon( new QgsLineString( nativeFaceGeometry( faceIndex ) ) ) ); + auto faceGeom = std::make_unique( new QgsLineString( nativeFaceGeometry( faceIndex ) ) ); if ( engine->intersects( faceGeom.get() ) ) { QSet faceToAdd = qgis::listToSet( face.toList() ); @@ -2429,7 +2429,7 @@ void QgsMapToolEditMeshFrame::forceByLineReleaseEvent( QgsMapMouseEvent *e ) { points.append( QgsPoint( rubbergandLines.at( i ).x(), rubbergandLines.at( i ).y(), mForcingLineZValue.isEmpty() ? defaultValue : mForcingLineZValue.at( i ) ) ); } - std::unique_ptr forcingLine = std::make_unique( points ); + auto forcingLine = std::make_unique( points ); forceByLine( QgsGeometry( forcingLine.release() ) ); mForceByLineRubberBand->reset( Qgis::GeometryType::Line ); mForcingLineZValue.clear(); diff --git a/src/app/mesh/qgsnewmeshlayerdialog.cpp b/src/app/mesh/qgsnewmeshlayerdialog.cpp index 5a4c9c4f48d8..942ea8560838 100644 --- a/src/app/mesh/qgsnewmeshlayerdialog.cpp +++ b/src/app/mesh/qgsnewmeshlayerdialog.cpp @@ -255,7 +255,7 @@ bool QgsNewMeshLayerDialog::apply() QFileInfo fileInfo( fileName ); layerName = fileInfo.completeBaseName(); } - std::unique_ptr newMeshLayer = std::make_unique( fileName, layerName, QStringLiteral( "mdal" ) ); + auto newMeshLayer = std::make_unique( fileName, layerName, QStringLiteral( "mdal" ) ); if ( newMeshLayer->crs() != crs ) newMeshLayer->setCrs( crs ); diff --git a/src/app/pluginmanager/qgspluginmanager.cpp b/src/app/pluginmanager/qgspluginmanager.cpp index 5c4807c4c895..88d0fe8ba178 100644 --- a/src/app/pluginmanager/qgspluginmanager.cpp +++ b/src/app/pluginmanager/qgspluginmanager.cpp @@ -405,7 +405,7 @@ void QgsPluginManager::getCppPluginsMetadata() QgsDebugMsgLevel( "Examining: " + lib, 2 ); try { - std::unique_ptr myLib = std::make_unique( lib ); + auto myLib = std::make_unique( lib ); const bool loaded = myLib->load(); if ( !loaded ) { diff --git a/src/app/pointcloud/qgspointcloudlayerproperties.cpp b/src/app/pointcloud/qgspointcloudlayerproperties.cpp index 1807979b7ee0..d0604cd37881 100644 --- a/src/app/pointcloud/qgspointcloudlayerproperties.cpp +++ b/src/app/pointcloud/qgspointcloudlayerproperties.cpp @@ -185,7 +185,7 @@ void QgsPointCloudLayerProperties::syncToLayer() txtSubsetSQL->setReadOnly( true ); txtSubsetSQL->setCaretWidth( 0 ); txtSubsetSQL->setCaretLineVisible( false ); - pbnQueryBuilder->setEnabled( mLayer->dataProvider() && mLayer->dataProvider()->supportsSubsetString() ); + pbnQueryBuilder->setEnabled( mLayer->dataProvider() && mLayer->dataProvider()->supportsSubsetString() && !mLayer->isEditable() ); for ( QgsMapLayerConfigWidget *w : std::as_const( mConfigWidgets ) ) w->syncToLayer( mLayer ); diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index 0d2bfecfc44a..03cb1fe9107d 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -95,6 +95,7 @@ #include "qgsauxiliarystorage.h" #include "qgsvectortileutils.h" #include "qgsscaleutils.h" +#include "qgsmaplayerfactory.h" #include "qgsbrowserwidget.h" #include "annotations/qgsannotationitempropertieswidget.h" @@ -781,9 +782,10 @@ void QgisApp::toggleEventTracing() void QgisApp::showGeoreferencer() { if ( !mGeoreferencer ) + { mGeoreferencer = new QgsGeoreferencerMainWindow( this ); - mGeoreferencer->show(); - mGeoreferencer->setFocus(); + } + mGeoreferencer->showGeoreferencer(); } #endif @@ -2447,6 +2449,8 @@ QList QgisApp::handleDropUriList( const QgsMimeDataUtils::UriList const QgsMimeDataUtils::Uri &u = lst.at( i ); QString uri = crsAndFormatAdjustedLayerUri( u.uri, u.supportedCrs, u.supportedFormats ); + bool ok = false; + Qgis::LayerType layerType = QgsMapLayerFactory::typeFromString( u.layerType, ok ); if ( u.layerType == QLatin1String( "collection" ) ) { @@ -2455,7 +2459,7 @@ QList QgisApp::handleDropUriList( const QgsMimeDataUtils::UriList if ( ok ) addedLayers.append( collectionLayers ); } - else if ( u.layerType == QLatin1String( "vector" ) ) + else if ( ok && layerType == Qgis::LayerType::Vector ) { const QList layerList { QgsAppLayerHandling::addVectorLayer( uri, u.name, u.providerKey, addToLegend ) }; for ( QgsVectorLayer *layer : std::as_const( layerList ) ) @@ -2463,7 +2467,7 @@ QList QgisApp::handleDropUriList( const QgsMimeDataUtils::UriList addedLayers << layer; } } - else if ( u.layerType == QLatin1String( "raster" ) ) + else if ( ok && layerType == Qgis::LayerType::Raster ) { const QList layerList { QgsAppLayerHandling::addRasterLayer( uri, u.name, u.providerKey, addToLegend ) }; for ( QgsRasterLayer *layer : std::as_const( layerList ) ) @@ -2471,7 +2475,7 @@ QList QgisApp::handleDropUriList( const QgsMimeDataUtils::UriList addedLayers << layer; } } - else if ( u.layerType == QLatin1String( "mesh" ) ) + else if ( ok && layerType == Qgis::LayerType::Mesh ) { const QList layerList { QgsAppLayerHandling::addMeshLayer( uri, u.name, u.providerKey, addToLegend ) }; for ( QgsMeshLayer *layer : std::as_const( layerList ) ) @@ -2479,17 +2483,17 @@ QList QgisApp::handleDropUriList( const QgsMimeDataUtils::UriList addedLayers << layer; } } - else if ( u.layerType == QLatin1String( "pointcloud" ) ) + else if ( ok && layerType == Qgis::LayerType::PointCloud ) { if ( QgsMapLayer *layer = QgsAppLayerHandling::addLayer( uri, u.name, u.providerKey, addToLegend ) ) addedLayers << layer; } - else if ( u.layerType == QLatin1String( "tiled-scene" ) ) + else if ( ok && layerType == Qgis::LayerType::TiledScene ) { if ( QgsMapLayer *layer = QgsAppLayerHandling::addLayer( uri, u.name, u.providerKey, addToLegend ) ) addedLayers << layer; } - else if ( u.layerType == QLatin1String( "vector-tile" ) ) + else if ( ok && layerType == Qgis::LayerType::VectorTile ) { QgsTemporaryCursorOverride busyCursor( Qt::WaitCursor ); @@ -2587,7 +2591,7 @@ QList QgisApp::handleDropUriList( const QgsMimeDataUtils::UriList addedLayers << layer; } } - else if ( u.layerType == QLatin1String( "plugin" ) ) + else if ( ok && layerType == Qgis::LayerType::Plugin ) { QgsMapLayer *layer = QgsAppLayerHandling::addLayer( uri, u.name, u.providerKey, addToLegend, false ); if ( layer ) @@ -4792,6 +4796,17 @@ void QgisApp::closeAdditional3DMapCanvases() #endif } +void QgisApp::update3DMapViewsLayerRelatedActions() +{ +#ifdef HAVE_3D + QgsMapLayer *currentLayer = activeLayer(); + for ( Qgs3DMapCanvasWidget *w : mOpen3DMapViews ) + { + w->updateLayerRelatedActions( currentLayer ); + } +#endif +} + void QgisApp::freezeCanvases( bool frozen ) { const auto canvases = mapCanvases(); @@ -5428,8 +5443,8 @@ void QgisApp::about() if ( !sAbt ) { sAbt = new QgsAbout( this ); - sAbt->setVersion( QgisApp::getVersionString() ); } + sAbt->setVersion( QgisApp::getVersionString() ); sAbt->show(); sAbt->raise(); sAbt->activateWindow(); @@ -6326,7 +6341,7 @@ bool QgisApp::addProject( const QString &projectFile ) QWidgetUpdateBlocker layerTreeViewUpdateBlocker( mLayerTreeView ); bool returnCode = false; - std::unique_ptr dirtyBlocker = std::make_unique( QgsProject::instance() ); + auto dirtyBlocker = std::make_unique( QgsProject::instance() ); QObject connectionScope; // manually control scope of layersChanged lambda connection - we need the connection automatically destroyed when this function finishes bool badLayersHandled = false; @@ -6792,7 +6807,7 @@ void QgisApp::openTemplate( const QString &fileName ) } //create new layout object - std::unique_ptr layout = std::make_unique( QgsProject::instance() ); + auto layout = std::make_unique( QgsProject::instance() ); bool loadedOk = false; layout->loadFromTemplate( templateDoc, QgsReadWriteContext(), true, &loadedOk ); if ( loadedOk ) @@ -8142,7 +8157,7 @@ void QgisApp::makeMemoryLayerPermanent( QgsVectorLayer *layer ) } }; - auto onFailure = []( int error, const QString &errorMessage ) { + auto onFailure = []( int error, const QString &errorMessage, const QString & ) { if ( error != QgsVectorFileWriter::Canceled ) { QgsMessageViewer *m = new QgsMessageViewer( nullptr ); @@ -8317,12 +8332,12 @@ QString QgisApp::saveAsVectorFileGeneral( QgsVectorLayer *vlayer, bool symbology this->visibleMessageBar()->pushMessage( tr( "Layer Exported" ), tr( "Successfully saved vector layer to %2" ).arg( QUrl::fromLocalFile( newFilename ).toString(), QDir::toNativeSeparators( newFilename ) ), Qgis::MessageLevel::Success, 0 ); }; - auto onFailure = []( int error, const QString &errorMessage ) { + auto onFailure = []( int error, const QString &errorMessage, const QString &fileName ) { if ( error != QgsVectorFileWriter::Canceled ) { QgsMessageViewer *m = new QgsMessageViewer( nullptr ); m->setWindowTitle( tr( "Save Error" ) ); - m->setMessageAsPlainText( tr( "Export to vector file failed.\nError: %1" ).arg( errorMessage ) ); + m->setMessageAsPlainText( tr( "Export to vector file %1 failed.\nError: %2" ).arg( fileName, errorMessage ) ); m->exec(); } }; @@ -8330,7 +8345,7 @@ QString QgisApp::saveAsVectorFileGeneral( QgsVectorLayer *vlayer, bool symbology return saveAsVectorFileGeneral( vlayer, symbologyOption, onlySelected, defaultToAddToMap, onSuccess, onFailure ); } -QString QgisApp::saveAsVectorFileGeneral( QgsVectorLayer *vlayer, bool symbologyOption, bool onlySelected, bool defaultToAddToMap, const std::function &onSuccess, const std::function &onFailure, QgsVectorLayerSaveAsDialog::Options options, const QString &dialogTitle ) +QString QgisApp::saveAsVectorFileGeneral( QgsVectorLayer *vlayer, bool symbologyOption, bool onlySelected, bool defaultToAddToMap, const std::function &onSuccess, const std::function &onFailure, QgsVectorLayerSaveAsDialog::Options options, const QString &dialogTitle ) { QgsCoordinateReferenceSystem destCRS; @@ -8426,8 +8441,8 @@ QString QgisApp::saveAsVectorFileGeneral( QgsVectorLayer *vlayer, bool symbology } ); // when an error occurs: - connect( writerTask, &QgsVectorFileWriterTask::errorOccurred, this, [onFailure]( int error, const QString &errorMessage ) { - onFailure( error, errorMessage ); + connect( writerTask, &QgsVectorFileWriterTask::errorOccurred, this, [onFailure, vectorFilename]( int error, const QString &errorMessage ) { + onFailure( error, errorMessage, vectorFilename ); } ); QgsApplication::taskManager()->addTask( writerTask ); @@ -8870,7 +8885,7 @@ QgsLayoutDesignerDialog *QgisApp::createNewReport( QString title ) title = QgsProject::instance()->layoutManager()->generateUniqueTitle( QgsMasterLayoutInterface::Report ); } //create new report - std::unique_ptr report = std::make_unique( QgsProject::instance() ); + auto report = std::make_unique( QgsProject::instance() ); report->setName( title ); QgsMasterLayoutInterface *layout = report.get(); QgsProject::instance()->layoutManager()->addLayout( report.release() ); @@ -10375,10 +10390,10 @@ std::unique_ptr QgisApp::pasteToNewMemoryVector() for ( int idx = 0; idx < layer->fields().count() && idx < it->attributeCount(); ++idx ) { QVariant attr = it->attribute( idx ); - if ( layer->fields().at( idx ).convertCompatible( attr ) ) - { - it->setAttribute( idx, attr ); - } + //if convertCompatible fails, it will replace attr with an appropriate null QVariant + //so we're calling setAttribute regardless, covering cases like 'Autogenerate' or 'nextVal()' on int fields. + layer->fields().at( idx ).convertCompatible( attr ); + it->setAttribute( idx, attr ); } } @@ -10609,11 +10624,12 @@ bool QgisApp::toggleEditing( QgsMapLayer *layer, bool allowCancel ) return toggleEditingVectorLayer( qobject_cast( layer ), allowCancel ); case Qgis::LayerType::Mesh: return toggleEditingMeshLayer( qobject_cast( layer ), allowCancel ); + case Qgis::LayerType::PointCloud: + return toggleEditingPointCloudLayer( qobject_cast( layer ), allowCancel ); case Qgis::LayerType::Raster: case Qgis::LayerType::Plugin: case Qgis::LayerType::VectorTile: case Qgis::LayerType::Annotation: - case Qgis::LayerType::PointCloud: case Qgis::LayerType::Group: case Qgis::LayerType::TiledScene: break; @@ -10912,6 +10928,89 @@ bool QgisApp::toggleEditingMeshLayer( QgsMeshLayer *mlayer, bool allowCancel ) return res; } +bool QgisApp::toggleEditingPointCloudLayer( QgsPointCloudLayer *pclayer, bool allowCancel ) +{ + if ( !pclayer ) + return false; + + if ( !pclayer->supportsEditing() ) + return false; + + bool res = false; + + if ( !pclayer->isEditable() ) + { + res = pclayer->startEditing(); + + if ( !res ) + { + visibleMessageBar()->pushWarning( + tr( "Start editing failed" ), + tr( "Provider cannot be opened for editing" ) + ); + } + + mActionToggleEditing->setChecked( res ); + } + else if ( pclayer->isModified() ) + { + QMessageBox::StandardButtons buttons = QMessageBox::Save | QMessageBox::Discard; + if ( allowCancel ) + buttons = buttons | QMessageBox::Cancel; + switch ( QMessageBox::question( nullptr, tr( "Stop Editing" ), tr( "Do you want to save the changes to layer %1?" ).arg( pclayer->name() ), buttons ) ) + { + case QMessageBox::Cancel: + res = false; + break; + + case QMessageBox::Save: + { + QgsTemporaryCursorOverride waitCursor( Qt::WaitCursor ); + QgsCanvasRefreshBlocker refreshBlocker; + if ( !pclayer->commitChanges( true ) ) + { + visibleMessageBar()->pushWarning( + tr( "Stop editing" ), + tr( "Unable to save editing for layer \"%1\"" ).arg( pclayer->name() ) + ); + res = false; + } + } + break; + case QMessageBox::Discard: + { + QgsTemporaryCursorOverride waitCursor( Qt::WaitCursor ); + QgsCanvasRefreshBlocker refreshBlocker; + if ( !pclayer->rollBack() ) + { + visibleMessageBar()->pushMessage( tr( "Error" ), tr( "Problems during roll back" ), Qgis::MessageLevel::Critical ); + res = false; + } + break; + } + + default: + break; + } + } + else //layer not modified + { + QgsTemporaryCursorOverride waitCursor( Qt::WaitCursor ); + QgsCanvasRefreshBlocker refreshBlocker; + pclayer->rollBack(); + } + + if ( !res && pclayer == activeLayer() ) + { + // while also called when layer sends editingStarted/editingStopped signals, + // this ensures correct restoring of gui state if toggling was canceled + // or layer commit/rollback functions failed + activateDeactivateLayerRelatedActions( pclayer ); + } + + return res; +} + void QgisApp::saveActiveLayerEdits() { saveEdits( activeLayer(), true, true ); @@ -10928,11 +11027,12 @@ void QgisApp::saveEdits( QgsMapLayer *layer, bool leaveEditable, bool triggerRep return saveVectorLayerEdits( layer, leaveEditable, triggerRepaint ); case Qgis::LayerType::Mesh: return saveMeshLayerEdits( layer, leaveEditable, triggerRepaint ); + case Qgis::LayerType::PointCloud: + return savePointCloudLayerEdits( layer, leaveEditable, triggerRepaint ); case Qgis::LayerType::Raster: case Qgis::LayerType::Plugin: case Qgis::LayerType::VectorTile: case Qgis::LayerType::Annotation: - case Qgis::LayerType::PointCloud: case Qgis::LayerType::Group: case Qgis::LayerType::TiledScene: break; @@ -10986,6 +11086,29 @@ void QgisApp::saveMeshLayerEdits( QgsMapLayer *layer, bool leaveEditable, bool t } } +void QgisApp::savePointCloudLayerEdits( QgsMapLayer *layer, bool leaveEditable, bool triggerRepaint ) +{ + QgsPointCloudLayer *pclayer = qobject_cast( layer ); + if ( !pclayer || !pclayer->isEditable() || !pclayer->isModified() ) + return; + + if ( pclayer == activeLayer() ) + mSaveRollbackInProgress = true; + + QgsCanvasRefreshBlocker refreshBlocker; + + if ( !pclayer->commitChanges( !leaveEditable ) ) + visibleMessageBar()->pushWarning( + tr( "Save edits" ), + tr( "Unable to save editing for layer \"%1\"" ).arg( pclayer->name() ) + ); + + if ( triggerRepaint ) + { + pclayer->triggerRepaint(); + } +} + void QgisApp::cancelEdits( QgsMapLayer *layer, bool leaveEditable, bool triggerRepaint ) { if ( !layer ) @@ -10997,11 +11120,12 @@ void QgisApp::cancelEdits( QgsMapLayer *layer, bool leaveEditable, bool triggerR return cancelVectorLayerEdits( layer, leaveEditable, triggerRepaint ); case Qgis::LayerType::Mesh: return cancelMeshLayerEdits( layer, leaveEditable, triggerRepaint ); + case Qgis::LayerType::PointCloud: + return cancelPointCloudLayerEdits( layer, leaveEditable, triggerRepaint ); case Qgis::LayerType::Raster: case Qgis::LayerType::Plugin: case Qgis::LayerType::VectorTile: case Qgis::LayerType::Annotation: - case Qgis::LayerType::PointCloud: case Qgis::LayerType::Group: case Qgis::LayerType::TiledScene: break; @@ -11058,6 +11182,32 @@ void QgisApp::cancelMeshLayerEdits( QgsMapLayer *layer, bool leaveEditable, bool } } +void QgisApp::cancelPointCloudLayerEdits( QgsMapLayer *layer, bool leaveEditable, bool triggerRepaint ) +{ + QgsPointCloudLayer *pclayer = qobject_cast( layer ); + if ( !pclayer || !pclayer->isEditable() ) + return; + + if ( pclayer == activeLayer() && leaveEditable ) + mSaveRollbackInProgress = true; + + QgsCanvasRefreshBlocker refreshBlocker; + + if ( !pclayer->rollBack() ) + { + mSaveRollbackInProgress = false; + QMessageBox::warning( nullptr, tr( "Error" ), tr( "Could not %1 changes to layer %2" ).arg( leaveEditable ? tr( "rollback" ) : tr( "cancel" ), pclayer->name() ) ); + } + + if ( leaveEditable ) + { + pclayer->startEditing(); + } + if ( triggerRepaint ) + { + pclayer->triggerRepaint(); + } +} void QgisApp::enableMeshEditingTools( bool enable ) { if ( !mMapTools ) @@ -11196,16 +11346,15 @@ void QgisApp::updateLayerModifiedActions() } break; case Qgis::LayerType::Mesh: + case Qgis::LayerType::PointCloud: { - QgsMeshLayer *mlayer = qobject_cast( currentLayer ); - enableSaveLayerEdits = ( mlayer->isEditable() && mlayer->isModified() ); + enableSaveLayerEdits = currentLayer->isEditable() && currentLayer->isModified(); } break; case Qgis::LayerType::Raster: case Qgis::LayerType::Plugin: case Qgis::LayerType::VectorTile: case Qgis::LayerType::Annotation: - case Qgis::LayerType::PointCloud: case Qgis::LayerType::Group: case Qgis::LayerType::TiledScene: break; @@ -12161,6 +12310,20 @@ void QgisApp::loadPythonSupport() { QgsCrashHandler::sPythonCrashLogFile = QStandardPaths::standardLocations( QStandardPaths::TempLocation ).at( 0 ) + "/qgis-python-crash-info-" + QString::number( QCoreApplication::applicationPid() ); mPythonUtils->initPython( mQgisInterface, true, QgsCrashHandler::sPythonCrashLogFile ); + + // do not permit calls to initQgis, exitQgis from Python when running within the QGIS application -- this will crash! + mPythonUtils->runString( QStringLiteral( "from qgis.core import QgsApplication as _QgsApplication\n" + "\n" + "def _qgis_app_init_qgis():\n" + " raise RuntimeError('QgsApplication.initQgis() must never be called from within the QGIS application. This method is exclusively for standalone scripts.')\n" + "\n" + "_QgsApplication.initQgis = _qgis_app_init_qgis\n" + "\n" + "def _qgis_app_exit_qgis():\n" + " raise RuntimeError('QgsApplication.exitQgis() must never be called from within the QGIS application. This method is exclusively for standalone scripts.')\n" + "\n" + "_QgsApplication.exitQgis = _qgis_app_exit_qgis\n" ), + QString(), false ); } if ( mPythonUtils && mPythonUtils->isEnabled() ) @@ -12996,7 +13159,7 @@ void QgisApp::initLayouts() auto createRubberBand = ( []( QgsLayoutView *view ) -> QgsLayoutViewRubberBand * { return new QgsLayoutViewRectangularRubberBand( view ); } ); - std::unique_ptr map3dMetadata = std::make_unique( + auto map3dMetadata = std::make_unique( QgsLayoutItemRegistry::Layout3DMap, tr( "3D Map" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionAdd3DMap.svg" ) ), [=]( QgsLayoutItem *item ) -> QgsLayoutItemBaseWidget * { return new QgsLayout3DMapWidget( qobject_cast( item ) ); @@ -14740,6 +14903,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer *layer ) mActionPasteAsNewMemoryVector->setEnabled( clipboard() && !clipboard()->isEmpty() ); updateLayerModifiedActions(); + update3DMapViewsLayerRelatedActions(); QgsAbstractMapToolHandler::Context context; for ( QgsAbstractMapToolHandler *handler : std::as_const( mMapToolHandlers ) ) @@ -15371,7 +15535,12 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer *layer ) case Qgis::LayerType::PointCloud: { + QgsPointCloudLayer *pcLayer = qobject_cast( layer ); const QgsDataProvider *dprovider = layer->dataProvider(); + + const bool isEditable = pcLayer->isEditable(); + const bool canSupportEditing = pcLayer->supportsEditing(); + mActionLocalHistogramStretch->setEnabled( false ); mActionFullHistogramStretch->setEnabled( false ); mActionLocalCumulativeCutStretch->setEnabled( false ); @@ -15382,7 +15551,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer *layer ) mActionDecreaseContrast->setEnabled( false ); mActionIncreaseGamma->setEnabled( false ); mActionDecreaseGamma->setEnabled( false ); - mActionLayerSubsetString->setEnabled( dprovider && dprovider->supportsSubsetString() ); + mActionLayerSubsetString->setEnabled( !isEditable && dprovider && dprovider->supportsSubsetString() ); mActionFeatureAction->setEnabled( false ); mActionSelectFeatures->setEnabled( false ); mActionSelectPolygon->setEnabled( false ); @@ -15401,12 +15570,12 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer *layer ) mActionSelectByExpression->setEnabled( false ); mActionSelectByForm->setEnabled( false ); mActionOpenFieldCalc->setEnabled( false ); - mActionToggleEditing->setEnabled( false ); - mActionToggleEditing->setChecked( false ); - mActionSaveLayerEdits->setEnabled( false ); - mUndoDock->widget()->setEnabled( false ); - mActionUndo->setEnabled( false ); - mActionRedo->setEnabled( false ); + mActionToggleEditing->setEnabled( canSupportEditing ); + mActionToggleEditing->setChecked( canSupportEditing && isEditable ); + mActionSaveLayerEdits->setEnabled( canSupportEditing && isEditable && pcLayer->isModified() ); + mUndoDock->widget()->setEnabled( canSupportEditing && isEditable ); + mActionUndo->setEnabled( canSupportEditing && isEditable ); + mActionRedo->setEnabled( canSupportEditing && isEditable ); mActionSaveLayerDefinition->setEnabled( true ); mActionLayerSaveAs->setEnabled( false ); mActionAddFeature->setEnabled( false ); @@ -15437,6 +15606,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer *layer ) mActionIdentify->setEnabled( true ); mDigitizingTechniqueManager->enableDigitizingTechniqueActions( false ); enableMeshEditingTools( false ); + updateUndoActions(); break; } case Qgis::LayerType::Plugin: @@ -16519,6 +16689,13 @@ void QgisApp::masterPasswordSetup() connect( QgsApplication::authManager(), &QgsAuthManager::messageLog, this, &QgisApp::authMessageLog ); connect( QgsApplication::authManager(), &QgsAuthManager::passwordHelperMessageLog, this, &QgisApp::authMessageLog ); connect( QgsApplication::authManager(), &QgsAuthManager::authDatabaseEraseRequested, this, &QgisApp::eraseAuthenticationDatabase ); + + if ( QgsAuthManager::settingsGenerateRandomPasswordForPasswordHelper->value() + && !QgsApplication::authManager()->masterPasswordHashInDatabase() && QgsApplication::authManager()->passwordHelperEnabled() ) + { + // if no master password set by user yet, just generate a new one and store it in the system keychain + QgsApplication::authManager()->createAndStoreRandomMasterPasswordInKeyChain(); + } } void QgisApp::eraseAuthenticationDatabase() @@ -17186,13 +17363,12 @@ void QgisApp::handleRenderedLayerStatistics() const { QgsMeshRendererSettings rendererSettings = meshLayer->rendererSettings(); QgsMeshRendererScalarSettings scalarRendererSettings = rendererSettings.scalarSettings( rendererSettings.activeScalarDatasetGroup() ); + scalarRendererSettings.setClassificationMinimumMaximum( layerStatistics->minimum( 0 ), layerStatistics->maximum( 0 ) ); rendererSettings.setScalarSettings( rendererSettings.activeScalarDatasetGroup(), scalarRendererSettings ); - meshLayer->setRendererSettings( rendererSettings ); + meshLayer->setRendererSettings( rendererSettings, false ); meshLayer->emitStyleChanged(); - emit meshLayer->rendererChanged(); - emit meshLayer->legendChanged(); } } } diff --git a/src/app/qgisapp.h b/src/app/qgisapp.h index c5bd9ecb5ce0..39dc52ce8942 100644 --- a/src/app/qgisapp.h +++ b/src/app/qgisapp.h @@ -2249,7 +2249,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow QString saveAsVectorFileGeneral( QgsVectorLayer *vlayer = nullptr, bool symbologyOption = true, bool onlySelected = false, bool defaultToAddToMap = true ); - QString saveAsVectorFileGeneral( QgsVectorLayer *vlayer, bool symbologyOption, bool onlySelected, bool defaultToAddToMap, const std::function &onSuccess, const std::function &onFailure, QgsVectorLayerSaveAsDialog::Options dialogOptions = QgsVectorLayerSaveAsDialog::Option::AllOptions, const QString &dialogTitle = QString() ); + QString saveAsVectorFileGeneral( QgsVectorLayer *vlayer, bool symbologyOption, bool onlySelected, bool defaultToAddToMap, const std::function &onSuccess, const std::function &onFailure, QgsVectorLayerSaveAsDialog::Options dialogOptions = QgsVectorLayerSaveAsDialog::Option::AllOptions, const QString &dialogTitle = QString() ); QString saveAsPointCloudLayer( QgsPointCloudLayer *pclayer ); @@ -2298,6 +2298,9 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow //! Closes any existing 3D map docks void closeAdditional3DMapCanvases(); + //! Updates current layer related actions on all open 3d views + void update3DMapViewsLayerRelatedActions(); + QgsElevationProfileWidget *createNewElevationProfile(); /** @@ -2378,6 +2381,11 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow */ bool toggleEditingMeshLayer( QgsMeshLayer *vlayer, bool allowCancel = true ); + /** + * Starts/stops for a point cloud layer \a pclayer + */ + bool toggleEditingPointCloudLayer( QgsPointCloudLayer *pclayer, bool allowCancel = true ); + /** * Saves edits of a vector layer * \param leaveEditable leave the layer in editing mode when done @@ -2392,6 +2400,13 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow */ void saveMeshLayerEdits( QgsMapLayer *layer, bool leaveEditable = true, bool triggerRepaint = true ); + /** + * Saves edits of a point cloud layer + * \param leaveEditable leave the layer in editing mode when done + * \param triggerRepaint send layer signal to repaint canvas when done + */ + void savePointCloudLayerEdits( QgsMapLayer *layer, bool leaveEditable = true, bool triggerRepaint = true ); + /** * Cancels edits of a vector layer * \param leaveEditable leave the layer in editing mode when done @@ -2406,6 +2421,13 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow */ void cancelMeshLayerEdits( QgsMapLayer *layer, bool leaveEditable = true, bool triggerRepaint = true ); + /** + * Cancels edits of a point cloud layer + * \param leaveEditable leave the layer in editing mode when done + * \param triggerRepaint send layer signal to repaint canvas when done + */ + void cancelPointCloudLayerEdits( QgsMapLayer *layer, bool leaveEditable = true, bool triggerRepaint = true ); + /** * Enables/Disables mesh frame editing tools */ diff --git a/src/app/qgsapplayertreeviewmenuprovider.cpp b/src/app/qgsapplayertreeviewmenuprovider.cpp index c7b964b229fc..aa8495d5614f 100644 --- a/src/app/qgsapplayertreeviewmenuprovider.cpp +++ b/src/app/qgsapplayertreeviewmenuprovider.cpp @@ -55,10 +55,10 @@ #include "qgsmapcanvasutils.h" #include "qgsmaplayeraction.h" #include "qgsvectortilelayer.h" -#include "qgsvectortiledataprovider.h" #include "qgsproviderregistry.h" #include "qgsprovidermetadata.h" #include "qgsrasterlabeling.h" +#include "qgssymbollayerutils.h" QgsAppLayerTreeViewMenuProvider::QgsAppLayerTreeViewMenuProvider( QgsLayerTreeView *view, QgsMapCanvas *canvas ) : mView( view ) @@ -377,7 +377,7 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu() menu->addSeparator(); - if ( vlayer || meshLayer ) + if ( vlayer || meshLayer || pcLayer ) { QAction *toggleEditingAction = QgisApp::instance()->actionToggleEditing(); QAction *saveLayerEditsAction = QgisApp::instance()->actionSaveActiveLayerEdits(); @@ -410,17 +410,12 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu() if ( allEditsAction->isEnabled() ) menu->addAction( allEditsAction ); - - if ( vlayer && vlayer->dataProvider() && vlayer->dataProvider()->supportsSubsetString() ) - { - QAction *action = menu->addAction( tr( "&Filter…" ), QgisApp::instance(), qOverload<>( &QgisApp::layerSubsetString ) ); - action->setEnabled( !vlayer->isEditable() ); - } } - if ( ( rlayer && rlayer->dataProvider() && rlayer->dataProvider()->supportsSubsetString() ) || ( pcLayer && pcLayer->dataProvider() && pcLayer->dataProvider()->supportsSubsetString() ) ) + if ( layer && layer->dataProvider() && layer->dataProvider()->supportsSubsetString() ) { - menu->addAction( tr( "&Filter…" ), QgisApp::instance(), qOverload<>( &QgisApp::layerSubsetString ) ); + QAction *action = menu->addAction( tr( "&Filter…" ), QgisApp::instance(), qOverload<>( &QgisApp::layerSubsetString ) ); + action->setEnabled( !layer->isEditable() ); } // change data source is only supported for vectors, rasters, point clouds, mesh, some vector tile layers @@ -1190,6 +1185,7 @@ void QgsAppLayerTreeViewMenuProvider::pasteVectorSymbol( const QString &layerId originalSymbol = embeddedRenderer->symbol(); } std::unique_ptr tempSymbol( QgsSymbolLayerUtils::symbolFromMimeData( QApplication::clipboard()->mimeData() ) ); + QgsSymbolLayerUtils::resetSymbolLayerIds( tempSymbol.get() ); if ( !tempSymbol ) return; @@ -1317,6 +1313,7 @@ void QgsAppLayerTreeViewMenuProvider::pasteSymbolLegendNodeSymbol( const QString QgsVectorLayer *vlayer = qobject_cast( node->layerNode()->layer() ); std::unique_ptr tempSymbol( QgsSymbolLayerUtils::symbolFromMimeData( QApplication::clipboard()->mimeData() ) ); + QgsSymbolLayerUtils::resetSymbolLayerIds( tempSymbol.get() ); if ( tempSymbol && tempSymbol->type() == originalSymbol->type() ) { node->setSymbol( tempSymbol.release() ); diff --git a/src/app/qgsattributetabledialog.cpp b/src/app/qgsattributetabledialog.cpp index 789f3ef83ba0..baf6312395fb 100644 --- a/src/app/qgsattributetabledialog.cpp +++ b/src/app/qgsattributetabledialog.cpp @@ -561,7 +561,7 @@ void QgsAttributeTableDialog::runFieldCalculation( QgsVectorLayer *layer, const //go through all the features and change the new attributes QgsFeatureIterator fit = layer->getFeatures( request ); - std::unique_ptr task = std::make_unique( tr( "Calculating field" ) ); + auto task = std::make_unique( tr( "Calculating field" ) ); long long count = !filteredIds.isEmpty() ? filteredIds.size() : layer->featureCount(); long long i = 0; diff --git a/src/app/qgsgeometryvalidationservice.cpp b/src/app/qgsgeometryvalidationservice.cpp index 72a14b723807..d900ea6551f8 100644 --- a/src/app/qgsgeometryvalidationservice.cpp +++ b/src/app/qgsgeometryvalidationservice.cpp @@ -133,12 +133,17 @@ void QgsGeometryValidationService::onGeometryChanged( QgsVectorLayer *layer, Qgs void QgsGeometryValidationService::onFeatureDeleted( QgsVectorLayer *layer, QgsFeatureId fid ) { - if ( !mLayerChecks[layer].topologyChecks.empty() ) + VectorLayerCheckInformation &checkInformation = mLayerChecks[layer]; + checkInformation.singleFeatureCheckErrors.remove( fid ); + + if ( !checkInformation.topologyChecks.empty() ) { invalidateTopologyChecks( layer ); } - - mLayerChecks[layer].singleFeatureCheckErrors.remove( fid ); + else + { + layer->setAllowCommit( checkInformation.singleFeatureCheckErrors.empty() ); + } // There should be no geometry errors on a non-existent feature, right? emit geometryCheckCompleted( layer, fid, QList>() ); @@ -461,9 +466,13 @@ void QgsGeometryValidationService::triggerTopologyChecks( QgsVectorLayer *layer, if ( !allErrors.empty() || !mLayerChecks[layer].singleFeatureCheckErrors.empty() ) { if ( mLayerChecks[layer].commitPending ) + { showMessage( tr( "Geometry errors have been found. Please fix the errors before saving the layer." ) ); + } else + { showMessage( tr( "Geometry errors have been found." ) ); + } } if ( allErrors.empty() && mLayerChecks[layer].singleFeatureCheckErrors.empty() && mLayerChecks[layer].commitPending ) { diff --git a/src/app/qgslayertreeviewembeddedindicator.cpp b/src/app/qgslayertreeviewembeddedindicator.cpp index 359d977d6ea5..06ab2cdcf4c7 100644 --- a/src/app/qgslayertreeviewembeddedindicator.cpp +++ b/src/app/qgslayertreeviewembeddedindicator.cpp @@ -57,7 +57,7 @@ void QgsLayerTreeViewEmbeddedIndicatorProvider::onAddedChildren( QgsLayerTreeNod std::unique_ptr QgsLayerTreeViewEmbeddedIndicatorProvider::newIndicator( const QString &project ) { - std::unique_ptr indicator = std::make_unique( this ); + auto indicator = std::make_unique( this ); indicator->setIcon( mIcon ); indicator->setToolTip( tr( "Embedded from %1" ).arg( project ) ); mIndicators.insert( indicator.get() ); diff --git a/src/app/qgslayertreeviewfilterindicator.cpp b/src/app/qgslayertreeviewfilterindicator.cpp index ac23c0986e82..34a599a232e6 100644 --- a/src/app/qgslayertreeviewfilterindicator.cpp +++ b/src/app/qgslayertreeviewfilterindicator.cpp @@ -37,8 +37,7 @@ void QgsLayerTreeViewFilterIndicatorProvider::onIndicatorClicked( const QModelIn return; QgsMapLayer *layer = QgsLayerTree::toLayer( node )->layer(); - QgsVectorLayer *vl = qobject_cast( layer ); - if ( vl && vl->isEditable() ) + if ( layer && layer->isEditable() ) { QgisApp::instance()->messageBar()->pushWarning( tr( "Edit filter" ), tr( "Cannot edit filter when layer is in edit mode" ) ); return; diff --git a/src/app/qgslayertreeviewindicatorprovider.cpp b/src/app/qgslayertreeviewindicatorprovider.cpp index b65a744228ef..f21e7401e451 100644 --- a/src/app/qgslayertreeviewindicatorprovider.cpp +++ b/src/app/qgslayertreeviewindicatorprovider.cpp @@ -161,7 +161,7 @@ void QgsLayerTreeViewIndicatorProvider::updateLayerIndicator( QgsMapLayer *layer std::unique_ptr QgsLayerTreeViewIndicatorProvider::newIndicator( QgsMapLayer *layer ) { - std::unique_ptr indicator = std::make_unique( this ); + auto indicator = std::make_unique( this ); indicator->setIcon( QgsApplication::getThemeIcon( iconName( layer ) ) ); indicator->setToolTip( tooltipText( layer ) ); connect( indicator.get(), &QgsLayerTreeViewIndicator::clicked, this, &QgsLayerTreeViewIndicatorProvider::onIndicatorClicked ); diff --git a/src/app/qgsmapsavedialog.cpp b/src/app/qgsmapsavedialog.cpp index 7c4a30f288c2..24968da98466 100644 --- a/src/app/qgsmapsavedialog.cpp +++ b/src/app/qgsmapsavedialog.cpp @@ -129,8 +129,6 @@ QgsMapSaveDialog::QgsMapSaveDialog( QWidget *parent, QgsMapCanvas *mapCanvas, co else { mGeospatialPDFOptionsStackedWidget->setCurrentIndex( 1 ); - mGeospatialPdfFormatComboBox->addItem( tr( "ISO 32000 Extension (recommended)" ) ); - mGeospatialPdfFormatComboBox->addItem( tr( "OGC Best Practice" ) ); } connect( mGeospatialPDFGroupBox, &QGroupBox::toggled, this, &QgsMapSaveDialog::updatePdfExportWarning ); @@ -544,16 +542,7 @@ void QgsMapSaveDialog::onAccepted() if ( mGeospatialPDFGroupBox->isChecked() ) { - if ( mGeospatialPdfFormatComboBox->currentIndex() == 0 ) - { - geospatialPdfExportDetails.useIso32000ExtensionFormatGeoreferencing = true; - geospatialPdfExportDetails.useOgcBestPracticeFormatGeoreferencing = false; - } - else - { - geospatialPdfExportDetails.useIso32000ExtensionFormatGeoreferencing = false; - geospatialPdfExportDetails.useOgcBestPracticeFormatGeoreferencing = true; - } + geospatialPdfExportDetails.useIso32000ExtensionFormatGeoreferencing = true; geospatialPdfExportDetails.includeFeatures = mExportGeospatialPdfFeaturesCheckBox->isChecked(); } diff --git a/src/app/qgsmaptooladdfeature.cpp b/src/app/qgsmaptooladdfeature.cpp index ed5e3e42bc9f..7abf35769208 100644 --- a/src/app/qgsmaptooladdfeature.cpp +++ b/src/app/qgsmaptooladdfeature.cpp @@ -28,6 +28,7 @@ #include "qgisapp.h" #include "qgsexpressioncontextutils.h" #include "qgsrubberband.h" +#include "qgsvectorlayereditutils.h" #include @@ -48,7 +49,7 @@ QgsMapToolAddFeature::QgsMapToolAddFeature( QgsMapCanvas *canvas, CaptureMode mo std::unique_ptr QgsMapToolAddFeature::createHighlight( QgsVectorLayer *layer, const QgsFeature &f ) { - std::unique_ptr highlight = std::make_unique( mCanvas, f.geometry(), layer ); + auto highlight = std::make_unique( mCanvas, f.geometry(), layer ); highlight->applyDefaultStyle(); switch ( f.geometry().type() ) @@ -143,11 +144,16 @@ void QgsMapToolAddFeature::featureDigitized( const QgsFeature &feature ) } if ( topologicalEditing ) { + QgsFeatureRequest request = QgsFeatureRequest().setNoAttributes().setFlags( Qgis::FeatureRequestFlag::NoGeometry ).setLimit( 1 ); + const QgsRectangle bbox = feature.geometry().boundingBox(); const QList layers = canvas()->layers( true ); for ( QgsMapLayer *layer : layers ) { QgsVectorLayer *vectorLayer = qobject_cast( layer ); + QgsRectangle searchRect; + QgsFeature f; + QgsCoordinateTransform transform; if ( !vectorLayer || !vectorLayer->isEditable() ) continue; @@ -155,6 +161,23 @@ void QgsMapToolAddFeature::featureDigitized( const QgsFeature &feature ) if ( !( vectorLayer->geometryType() == Qgis::GeometryType::Polygon || vectorLayer->geometryType() == Qgis::GeometryType::Line ) ) continue; + if ( vectorLayer->crs() == vlayer->crs() ) + { + searchRect = QgsRectangle( bbox ); + } + else + { + transform = QgsCoordinateTransform( vlayer->crs(), vectorLayer->crs(), vectorLayer->transformContext() ); + searchRect = transform.transformBoundingBox( bbox ); + } + + searchRect.grow( QgsVectorLayerEditUtils::getTopologicalSearchRadius( vectorLayer ) ); + request.setFilterRect( searchRect ); + + // We check that there is actually at least one feature intersecting our geometry in the layer to avoid creating an empty edit command and calling costly addTopologicalPoint + if ( !vectorLayer->getFeatures( request ).nextFeature( f ) ) + continue; + vectorLayer->beginEditCommand( tr( "Topological points added by 'Add Feature'" ) ); int res = 2; @@ -164,7 +187,7 @@ void QgsMapToolAddFeature::featureDigitized( const QgsFeature &feature ) try { // transform digitized geometry from vlayer crs to vectorLayer crs and add topological points - transformedGeom.transform( QgsCoordinateTransform( vlayer->crs(), vectorLayer->crs(), vectorLayer->transformContext() ) ); + transformedGeom.transform( transform ); res = vectorLayer->addTopologicalPoints( transformedGeom ); } catch ( QgsCsException &cse ) diff --git a/src/app/qgsmergeattributesdialog.cpp b/src/app/qgsmergeattributesdialog.cpp index 12396c0be474..c6faed8be5b6 100644 --- a/src/app/qgsmergeattributesdialog.cpp +++ b/src/app/qgsmergeattributesdialog.cpp @@ -267,6 +267,11 @@ void QgsMergeAttributesDialog::createTableWidgetContents() currentComboBox->setCurrentIndex( currentComboBox->findData( QStringLiteral( "manual" ) ) ); currentComboBox->blockSignals( false ); } + + const QgsEditorWidgetSetup setup = mFields.at( idx ).editorWidgetSetup(); + + if ( !setup.isNull() && !setup.type().isEmpty() ) + updateManualWidget( j, true ); } } diff --git a/src/app/qgssnappingwidget.h b/src/app/qgssnappingwidget.h index 46c3291c68ea..d976f2721f4c 100644 --- a/src/app/qgssnappingwidget.h +++ b/src/app/qgssnappingwidget.h @@ -37,8 +37,10 @@ class QgsScaleWidget; #include "qgssnappingconfig.h" +#include #include #include + #include "qgis_app.h" /** diff --git a/src/app/qgsstatisticalsummarydockwidget.cpp b/src/app/qgsstatisticalsummarydockwidget.cpp index f7a20dbc1657..784695316baf 100644 --- a/src/app/qgsstatisticalsummarydockwidget.cpp +++ b/src/app/qgsstatisticalsummarydockwidget.cpp @@ -263,7 +263,7 @@ void QgsStatisticalSummaryDockWidget::refreshStatistics() } const long featureCount = selectedOnly ? mLayer->selectedFeatureCount() : mLayer->featureCount(); - std::unique_ptr gatherer = std::make_unique( mLayer, fit, featureCount, sourceFieldExp, mFieldType, statsToCalc, stringStatsToCalc, dateTimeStatsToCalc ); + auto gatherer = std::make_unique( mLayer, fit, featureCount, sourceFieldExp, mFieldType, statsToCalc, stringStatsToCalc, dateTimeStatsToCalc ); switch ( mFieldType ) { case DataType::Numeric: diff --git a/src/app/qgstemplateprojectsmodel.cpp b/src/app/qgstemplateprojectsmodel.cpp index 4e8f5ae48ad7..698c553183e1 100644 --- a/src/app/qgstemplateprojectsmodel.cpp +++ b/src/app/qgstemplateprojectsmodel.cpp @@ -102,7 +102,7 @@ void QgsTemplateProjectsModel::scanDirectory( const QString &path ) // Refill with templates from this directory for ( const QFileInfo &file : files ) { - std::unique_ptr item = std::make_unique( file.fileName() ); + auto item = std::make_unique( file.fileName() ); const QString fileId = QCryptographicHash::hash( file.filePath().toUtf8(), QCryptographicHash::Sha224 ).toHex(); diff --git a/src/app/vertextool/qgsvertextool.cpp b/src/app/vertextool/qgsvertextool.cpp index 1bd26cf3d381..3c49ecd57b85 100644 --- a/src/app/vertextool/qgsvertextool.cpp +++ b/src/app/vertextool/qgsvertextool.cpp @@ -43,6 +43,7 @@ #include "qgsexpressioncontextutils.h" #include "qgsmessagebar.h" #include "qgssettingsentryimpl.h" +#include "qgsvectorlayereditutils.h" #include @@ -2204,6 +2205,10 @@ void QgsVertexTool::moveVertex( const QgsPointXY &mapPoint, const QgsPointLocato { // topo editing: add vertex to existing segments when moving/adding a vertex to such segment. + QgsFeatureRequest request = QgsFeatureRequest().setNoAttributes().setFlags( Qgis::FeatureRequestFlag::NoGeometry ).setLimit( 1 ); + const QgsRectangle bbox = layerPoint.boundingBox(); + + const QList targetLayers = canvas()->layers( true ); for ( auto itLayerEdits = edits.begin(); itLayerEdits != edits.end(); ++itLayerEdits ) @@ -2211,6 +2216,8 @@ void QgsVertexTool::moveVertex( const QgsPointXY &mapPoint, const QgsPointLocato for ( QgsMapLayer *targetLayer : targetLayers ) { QgsVectorLayer *vectorLayer = qobject_cast( targetLayer ); + QgsRectangle searchRect; + QgsFeature f; if ( !vectorLayer || !vectorLayer->isEditable() ) continue; @@ -2222,6 +2229,14 @@ void QgsVertexTool::moveVertex( const QgsPointXY &mapPoint, const QgsPointLocato if ( vectorLayer->crs() != itLayerEdits.key()->crs() ) continue; + searchRect = QgsRectangle( bbox ); + searchRect.grow( QgsVectorLayerEditUtils::getTopologicalSearchRadius( vectorLayer ) ); + request.setFilterRect( searchRect ); + + // We check that there is actually at least one feature intersecting our geometry in the layer to avoid creating an empty edit command and calling costly addTopologicalPoint + if ( !vectorLayer->getFeatures( request ).nextFeature( f ) ) + continue; + vectorLayer->beginEditCommand( tr( "Topological points added by 'Vertex Tool'" ) ); bool topoPointsAdded = false; diff --git a/src/auth/oauth2/core/qgsauthoauth2method.cpp b/src/auth/oauth2/core/qgsauthoauth2method.cpp index ac9858de8dcb..8e9f1326e089 100644 --- a/src/auth/oauth2/core/qgsauthoauth2method.cpp +++ b/src/auth/oauth2/core/qgsauthoauth2method.cpp @@ -603,7 +603,7 @@ QgsO2 *QgsAuthOAuth2Method::getOAuth2Bundle( const QString &authcfg, bool fullco // do loading of method config into oauth2 config - std::unique_ptr config( new QgsAuthOAuth2Config() ); + auto config = std::make_unique(); if ( configmap.contains( QStringLiteral( "oauth2config" ) ) ) { const QByteArray configtxt = configmap.value( QStringLiteral( "oauth2config" ) ).toUtf8(); diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index c9d7fa662a2d..86201bc0e0bd 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -875,6 +875,7 @@ set(QGIS_CORE_SRCS pointcloud/qgspointcloudrendererregistry.cpp pointcloud/qgspointcloudrgbrenderer.cpp pointcloud/qgspointcloudlayerexporter.cpp + pointcloud/qgspointcloudlayerundocommand.cpp pointcloud/expression/qgspointcloudexpression.cpp pointcloud/expression/qgspointcloudexpressionnode.cpp @@ -1742,6 +1743,7 @@ set(QGIS_CORE_HDRS pointcloud/qgspointcloudrendererregistry.h pointcloud/qgspointcloudrgbrenderer.h pointcloud/qgspointcloudlayerexporter.h + pointcloud/qgspointcloudlayerundocommand.h pointcloud/expression/qgspointcloudexpression.h pointcloud/expression/qgspointcloudexpressionnode.h @@ -2280,6 +2282,7 @@ if (WITH_EPT OR WITH_COPC) ${CMAKE_SOURCE_DIR}/external/lazperf/header.cpp ${CMAKE_SOURCE_DIR}/external/lazperf/lazperf.cpp ${CMAKE_SOURCE_DIR}/external/lazperf/readers.cpp + ${CMAKE_SOURCE_DIR}/external/lazperf/writers.cpp ${CMAKE_SOURCE_DIR}/external/lazperf/vlr.cpp ${CMAKE_SOURCE_DIR}/external/lazperf/detail/field_byte10.cpp ${CMAKE_SOURCE_DIR}/external/lazperf/detail/field_byte14.cpp @@ -2296,11 +2299,13 @@ if (WITH_EPT OR WITH_COPC) pointcloud/qgseptdecoder.cpp pointcloud/qgslazdecoder.cpp pointcloud/qgslazinfo.cpp + pointcloud/qgscopcupdate.cpp ) set(QGIS_CORE_HDRS ${QGIS_CORE_HDRS} pointcloud/qgseptdecoder.h pointcloud/qgslazdecoder.h pointcloud/qgslazinfo.h + pointcloud/qgscopcupdate.h ) endif() diff --git a/src/core/annotations/qgsannotationlayer.cpp b/src/core/annotations/qgsannotationlayer.cpp index 863f21b32e70..4066a0d4b9c4 100644 --- a/src/core/annotations/qgsannotationlayer.cpp +++ b/src/core/annotations/qgsannotationlayer.cpp @@ -320,7 +320,7 @@ QgsAnnotationLayer *QgsAnnotationLayer::clone() const QGIS_PROTECT_QOBJECT_THREAD_ACCESS const QgsAnnotationLayer::LayerOptions options( mTransformContext ); - std::unique_ptr< QgsAnnotationLayer > layer = std::make_unique< QgsAnnotationLayer >( name(), options ); + auto layer = std::make_unique< QgsAnnotationLayer >( name(), options ); QgsMapLayer::clone( layer.get() ); for ( auto it = mItems.constBegin(); it != mItems.constEnd(); ++it ) diff --git a/src/core/annotations/qgsannotationlayerrenderer.cpp b/src/core/annotations/qgsannotationlayerrenderer.cpp index 52052c4e0b1e..4797854cdb74 100644 --- a/src/core/annotations/qgsannotationlayerrenderer.cpp +++ b/src/core/annotations/qgsannotationlayerrenderer.cpp @@ -108,7 +108,7 @@ bool QgsAnnotationLayerRenderer::render() if ( bounds.intersects( context.extent() ) ) { item.second->render( context, mFeedback.get() ); - std::unique_ptr< QgsRenderedAnnotationItemDetails > details = std::make_unique< QgsRenderedAnnotationItemDetails >( mLayerID, item.first ); + auto details = std::make_unique< QgsRenderedAnnotationItemDetails >( mLayerID, item.first ); details->setBoundingBox( bounds ); appendRenderedItemDetails( details.release() ); } diff --git a/src/core/annotations/qgsannotationlineitem.cpp b/src/core/annotations/qgsannotationlineitem.cpp index c0bf248217c8..9d8e37e8a1b0 100644 --- a/src/core/annotations/qgsannotationlineitem.cpp +++ b/src/core/annotations/qgsannotationlineitem.cpp @@ -202,7 +202,7 @@ QgsRectangle QgsAnnotationLineItem::boundingBox() const QgsAnnotationLineItem *QgsAnnotationLineItem::clone() const { - std::unique_ptr< QgsAnnotationLineItem > item = std::make_unique< QgsAnnotationLineItem >( mCurve->clone() ); + auto item = std::make_unique< QgsAnnotationLineItem >( mCurve->clone() ); item->setSymbol( mSymbol->clone() ); item->copyCommonProperties( this ); return item.release(); diff --git a/src/core/annotations/qgsannotationlinetextitem.cpp b/src/core/annotations/qgsannotationlinetextitem.cpp index 7e19981aa795..68ec16801ff5 100644 --- a/src/core/annotations/qgsannotationlinetextitem.cpp +++ b/src/core/annotations/qgsannotationlinetextitem.cpp @@ -249,7 +249,7 @@ QgsRectangle QgsAnnotationLineTextItem::boundingBox( QgsRenderContext &context ) QgsAnnotationLineTextItem *QgsAnnotationLineTextItem::clone() const { - std::unique_ptr< QgsAnnotationLineTextItem > item = std::make_unique< QgsAnnotationLineTextItem >( mText, mCurve->clone() ); + auto item = std::make_unique< QgsAnnotationLineTextItem >( mText, mCurve->clone() ); item->setFormat( mTextFormat ); item->setOffsetFromLine( mOffsetFromLineDistance ); item->setOffsetFromLineUnit( mOffsetFromLineUnit ); diff --git a/src/core/annotations/qgsannotationmanager.cpp b/src/core/annotations/qgsannotationmanager.cpp index 68ce5196c163..fbd73f266d8b 100644 --- a/src/core/annotations/qgsannotationmanager.cpp +++ b/src/core/annotations/qgsannotationmanager.cpp @@ -192,7 +192,7 @@ std::unique_ptr QgsAnnotationManager::convertToAnnotationItem destination->setCalloutAnchor( QgsGeometry::fromPointXY( mapPosition ) ); - std::unique_ptr< QgsBalloonCallout > callout = std::make_unique< QgsBalloonCallout >(); + auto callout = std::make_unique< QgsBalloonCallout >(); if ( QgsFillSymbol *fill = source->fillSymbol() ) callout->setFillSymbol( fill->clone() ); @@ -222,8 +222,8 @@ std::unique_ptr QgsAnnotationManager::convertToAnnotationItem QgsDebugError( QStringLiteral( "Error transforming annotation position" ) ); } - std::unique_ptr< QgsAnnotationPictureItem > item = std::make_unique< QgsAnnotationPictureItem >( Qgis::PictureFormat::SVG, - svg->filePath(), QgsRectangle::fromCenterAndSize( mapPosition, 1, 1 ) ); + auto item = std::make_unique< QgsAnnotationPictureItem >( Qgis::PictureFormat::SVG, + svg->filePath(), QgsRectangle::fromCenterAndSize( mapPosition, 1, 1 ) ); if ( !setCommonProperties( annotation, item.get() ) ) return nullptr; @@ -267,7 +267,7 @@ std::unique_ptr QgsAnnotationManager::convertToAnnotationItem QgsDebugError( QStringLiteral( "Error transforming annotation position" ) ); } - std::unique_ptr< QgsAnnotationRectangleTextItem > item = std::make_unique< QgsAnnotationRectangleTextItem >( text->document()->toHtml(), QgsRectangle::fromCenterAndSize( mapPosition, 1, 1 ) ); + auto item = std::make_unique< QgsAnnotationRectangleTextItem >( text->document()->toHtml(), QgsRectangle::fromCenterAndSize( mapPosition, 1, 1 ) ); if ( !setCommonProperties( annotation, item.get() ) ) return nullptr; diff --git a/src/core/annotations/qgsannotationmarkeritem.cpp b/src/core/annotations/qgsannotationmarkeritem.cpp index e39ff003ac9a..36cab2ca81a9 100644 --- a/src/core/annotations/qgsannotationmarkeritem.cpp +++ b/src/core/annotations/qgsannotationmarkeritem.cpp @@ -156,7 +156,7 @@ bool QgsAnnotationMarkerItem::readXml( const QDomElement &element, const QgsRead QgsAnnotationMarkerItem *QgsAnnotationMarkerItem::clone() const { - std::unique_ptr< QgsAnnotationMarkerItem > item = std::make_unique< QgsAnnotationMarkerItem >( mPoint ); + auto item = std::make_unique< QgsAnnotationMarkerItem >( mPoint ); item->setSymbol( mSymbol->clone() ); item->copyCommonProperties( this ); return item.release(); diff --git a/src/core/annotations/qgsannotationpictureitem.cpp b/src/core/annotations/qgsannotationpictureitem.cpp index 71c0450c9e54..e1761501253e 100644 --- a/src/core/annotations/qgsannotationpictureitem.cpp +++ b/src/core/annotations/qgsannotationpictureitem.cpp @@ -132,7 +132,7 @@ bool QgsAnnotationPictureItem::readXml( const QDomElement &element, const QgsRea QgsAnnotationPictureItem *QgsAnnotationPictureItem::clone() const { - std::unique_ptr< QgsAnnotationPictureItem > item = std::make_unique< QgsAnnotationPictureItem >( mFormat, mPath, bounds() ); + auto item = std::make_unique< QgsAnnotationPictureItem >( mFormat, mPath, bounds() ); item->setLockAspectRatio( mLockAspectRatio ); item->copyCommonProperties( this ); diff --git a/src/core/annotations/qgsannotationpointtextitem.cpp b/src/core/annotations/qgsannotationpointtextitem.cpp index 5311d840edc5..c5a135c41058 100644 --- a/src/core/annotations/qgsannotationpointtextitem.cpp +++ b/src/core/annotations/qgsannotationpointtextitem.cpp @@ -136,7 +136,7 @@ bool QgsAnnotationPointTextItem::readXml( const QDomElement &element, const QgsR QgsAnnotationPointTextItem *QgsAnnotationPointTextItem::clone() const { - std::unique_ptr< QgsAnnotationPointTextItem > item = std::make_unique< QgsAnnotationPointTextItem >( mText, mPoint ); + auto item = std::make_unique< QgsAnnotationPointTextItem >( mText, mPoint ); item->setFormat( mTextFormat ); item->setAngle( mAngle ); item->setAlignment( mAlignment ); diff --git a/src/core/annotations/qgsannotationpolygonitem.cpp b/src/core/annotations/qgsannotationpolygonitem.cpp index b401dbb5c286..061a56e77760 100644 --- a/src/core/annotations/qgsannotationpolygonitem.cpp +++ b/src/core/annotations/qgsannotationpolygonitem.cpp @@ -226,7 +226,7 @@ bool QgsAnnotationPolygonItem::readXml( const QDomElement &element, const QgsRea QgsAnnotationPolygonItem *QgsAnnotationPolygonItem::clone() const { - std::unique_ptr< QgsAnnotationPolygonItem > item = std::make_unique< QgsAnnotationPolygonItem >( mPolygon->clone() ); + auto item = std::make_unique< QgsAnnotationPolygonItem >( mPolygon->clone() ); item->setSymbol( mSymbol->clone() ); item->copyCommonProperties( this );; return item.release(); diff --git a/src/core/annotations/qgsannotationrectangletextitem.cpp b/src/core/annotations/qgsannotationrectangletextitem.cpp index c4faed5ca7c7..85aaedb4138d 100644 --- a/src/core/annotations/qgsannotationrectangletextitem.cpp +++ b/src/core/annotations/qgsannotationrectangletextitem.cpp @@ -108,7 +108,7 @@ bool QgsAnnotationRectangleTextItem::readXml( const QDomElement &element, const QgsAnnotationRectangleTextItem *QgsAnnotationRectangleTextItem::clone() const { - std::unique_ptr< QgsAnnotationRectangleTextItem > item = std::make_unique< QgsAnnotationRectangleTextItem >( mText, bounds() ); + auto item = std::make_unique< QgsAnnotationRectangleTextItem >( mText, bounds() ); item->setFormat( mTextFormat ); item->setAlignment( mAlignment ); diff --git a/src/core/annotations/qgshtmlannotation.cpp b/src/core/annotations/qgshtmlannotation.cpp index 1168826bad7c..764503a67ce9 100644 --- a/src/core/annotations/qgshtmlannotation.cpp +++ b/src/core/annotations/qgshtmlannotation.cpp @@ -57,7 +57,7 @@ QgsHtmlAnnotation::QgsHtmlAnnotation( QObject *parent ) QgsHtmlAnnotation *QgsHtmlAnnotation::clone() const { - std::unique_ptr< QgsHtmlAnnotation > c( new QgsHtmlAnnotation() ); + auto c = std::make_unique(); copyCommonProperties( c.get() ); c->setSourceFile( mHtmlFile ); return c.release(); diff --git a/src/core/annotations/qgssvgannotation.cpp b/src/core/annotations/qgssvgannotation.cpp index 33d97d60d148..44a867f56ca7 100644 --- a/src/core/annotations/qgssvgannotation.cpp +++ b/src/core/annotations/qgssvgannotation.cpp @@ -34,7 +34,7 @@ QgsSvgAnnotation::QgsSvgAnnotation( QObject *parent ) QgsSvgAnnotation *QgsSvgAnnotation::clone() const { - std::unique_ptr< QgsSvgAnnotation > c( new QgsSvgAnnotation() ); + auto c = std::make_unique(); copyCommonProperties( c.get() ); c->setFilePath( mFilePath ); return c.release(); diff --git a/src/core/annotations/qgstextannotation.cpp b/src/core/annotations/qgstextannotation.cpp index 0496ec90c9de..77bf0f42d3c7 100644 --- a/src/core/annotations/qgstextannotation.cpp +++ b/src/core/annotations/qgstextannotation.cpp @@ -30,7 +30,7 @@ QgsTextAnnotation::QgsTextAnnotation( QObject *parent ) QgsTextAnnotation *QgsTextAnnotation::clone() const { - std::unique_ptr< QgsTextAnnotation > c( new QgsTextAnnotation() ); + auto c = std::make_unique(); copyCommonProperties( c.get() ); c->setDocument( mDocument.get() ); return c.release(); diff --git a/src/core/auth/qgsauthcrypto.cpp b/src/core/auth/qgsauthcrypto.cpp index 779e26d0eb82..13f9fe69fbf5 100644 --- a/src/core/auth/qgsauthcrypto.cpp +++ b/src/core/auth/qgsauthcrypto.cpp @@ -76,15 +76,15 @@ void QgsAuthCrypto::passwordKeyHash( const QString &pass, QString *salt, QString if ( !key.isEmpty() ) { *salt = QCA::arrayToHex( saltiv.toByteArray() ); - qDebug( "salt hex: %s", qPrintable( *salt ) ); + //qDebug( "salt hex: %s", qPrintable( *salt ) ); *hash = QCA::arrayToHex( key.toByteArray() ); - qDebug( "hash hex: %s", qPrintable( *hash ) ); + //qDebug( "hash hex: %s", qPrintable( *hash ) ); if ( cipheriv ) { *cipheriv = QCA::arrayToHex( QCA::InitializationVector( CIPHER_IV_LENGTH ).toByteArray() ); - qDebug( "cipheriv hex: %s", qPrintable( *cipheriv ) ); + //qDebug( "cipheriv hex: %s", qPrintable( *cipheriv ) ); } } } diff --git a/src/core/auth/qgsauthmanager.cpp b/src/core/auth/qgsauthmanager.cpp index b6d1f3e627ff..a69fb7329c04 100644 --- a/src/core/auth/qgsauthmanager.cpp +++ b/src/core/auth/qgsauthmanager.cpp @@ -57,6 +57,8 @@ #include "qgsvariantutils.h" #include "qgssettings.h" #include "qgsruntimeprofiler.h" +#include "qgssettingsentryimpl.h" +#include "qgssettingstree.h" QgsAuthManager *QgsAuthManager::sInstance = nullptr; @@ -69,8 +71,10 @@ const QString QgsAuthManager::AUTH_CFG_REGEX = QStringLiteral( "authcfg=([a-z]|[ const QLatin1String QgsAuthManager::AUTH_PASSWORD_HELPER_KEY_NAME_BASE( "QGIS-Master-Password" ); const QLatin1String QgsAuthManager::AUTH_PASSWORD_HELPER_FOLDER_NAME( "QGIS" ); +const QgsSettingsEntryBool *QgsAuthManager::settingsGenerateRandomPasswordForPasswordHelper = new QgsSettingsEntryBool( QStringLiteral( "generate-random-password-for-keychain" ), QgsSettingsTree::sTreeAuthentication, true, QStringLiteral( "Whether a random password should be automatically generated for the authentication database and stored in the system keychain." ) ); +const QgsSettingsEntryBool *QgsAuthManager::settingsUsingGeneratedRandomPassword = new QgsSettingsEntryBool( QStringLiteral( "using-generated-random-password" ), QgsSettingsTree::sTreeAuthentication, false, QStringLiteral( "True if the user is using an autogenerated random password stored in the system keychain." ) ); - +Q_NOWARN_DEPRECATED_PUSH #if defined(Q_OS_MAC) const QString QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME( "Keychain" ); #elif defined(Q_OS_WIN) @@ -80,6 +84,7 @@ const QString QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME( QStringLiteral( #else const QString QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME( "Password Manager" ); #endif +Q_NOWARN_DEPRECATED_POP QgsAuthManager *QgsAuthManager::instance() { @@ -380,6 +385,19 @@ void QgsAuthManager::setup( const QString &pluginPath, const QString &authDataba } } +QString QgsAuthManager::generatePassword() +{ + QRandomGenerator generator = QRandomGenerator::securelySeeded(); + QString pw; + pw.resize( 32 ); + static const QString sPwChars = QStringLiteral( "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-{}[]" ); + for ( int i = 0; i < pw.size(); ++i ) + { + pw[i] = sPwChars.at( generator.bounded( 0, sPwChars.length() ) ); + } + return pw; +} + bool QgsAuthManager::isDisabled() const { ensureInitialized(); @@ -398,8 +416,48 @@ const QString QgsAuthManager::disabledMessage() const return tr( "Authentication system is DISABLED:\n%1" ).arg( mAuthDisabledMessage ); } +bool QgsAuthManager::createAndStoreRandomMasterPasswordInKeyChain() +{ + QMutexLocker locker( mMasterPasswordMutex.get() ); + if ( isDisabled() ) + return false; + + if ( mScheduledDbErase ) + return false; + + if ( !passwordHelperEnabled() ) + return false; + + if ( !mMasterPass.isEmpty() ) + { + QgsDebugError( QStringLiteral( "Master password is already set!" ) ); + return false; + } + + const QString newPassword = generatePassword(); + if ( passwordHelperWrite( newPassword ) ) + { + mMasterPass = newPassword; + } + else + { + emit passwordHelperMessageLog( tr( "Master password could not be written to the %1" ).arg( passwordHelperDisplayName() ), authManTag(), Qgis::MessageLevel::Warning ); + return false; + } + + if ( !verifyMasterPassword() ) + { + emit passwordHelperMessageLog( tr( "Master password was written to the %1 but could not be verified" ).arg( passwordHelperDisplayName() ), authManTag(), Qgis::MessageLevel::Warning ); + return false; + } + + QgsDebugMsgLevel( QStringLiteral( "Master password is set and verified" ), 2 ); + settingsUsingGeneratedRandomPassword->setValue( true ); + return true; +} + -const QString QgsAuthManager::sqliteDatabasePath() const +QString QgsAuthManager::sqliteDatabasePath() const { if ( !QgsAuthManager::isFilesystemBasedDatabase( mAuthDatabaseConnectionUri ) ) { @@ -698,6 +756,14 @@ bool QgsAuthManager::resetMasterPassword( const QString &newpass, const QString emit messageLog( tr( err ), authManTag(), Qgis::MessageLevel::Warning ); } + if ( qgetenv( "QGIS_CONTINUOUS_INTEGRATION_RUN" ) != QStringLiteral( "true" ) && passwordHelperEnabled() && !passwordHelperSync() ) + { + ok = false; + const QString err = tr( "Master password reset FAILED: could not sync password helper: %1" ).arg( passwordHelperErrorMessage() ); + QgsDebugError( err ); + emit messageLog( err, authManTag(), Qgis::MessageLevel::Warning ); + } + // something went wrong, reinstate previous password and database if ( !ok ) { @@ -718,7 +784,6 @@ bool QgsAuthManager::resetMasterPassword( const QString &newpass, const QString return false; } - if ( !keepbackup && !QFile::remove( dbbackup ) ) { const char *err = QT_TR_NOOP( "Master password reset: could not remove old database backup" ); @@ -734,11 +799,32 @@ bool QgsAuthManager::resetMasterPassword( const QString &newpass, const QString *backuppath = dbbackup; } + settingsUsingGeneratedRandomPassword->setValue( false ); + QgsDebugMsgLevel( QStringLiteral( "Master password reset: SUCCESS" ), 2 ); emit authDatabaseChanged(); return true; } +bool QgsAuthManager::resetMasterPasswordUsingStoredPasswordHelper( const QString &newPassword, bool keepBackup, QString *backupPath ) +{ + if ( !verifyStoredPasswordHelperPassword() ) + { + emit passwordHelperMessageLog( tr( "Master password stored in your %1 is not valid" ).arg( passwordHelperDisplayName() ), authManTag(), Qgis::MessageLevel::Warning ); + return false; + } + + bool readOk = false; + const QString existingPassword = passwordHelperRead( readOk ); + if ( !readOk ) + { + emit passwordHelperMessageLog( tr( "Master password could not be read from the %1" ).arg( passwordHelperDisplayName() ), authManTag(), Qgis::MessageLevel::Warning ); + return false; + } + + return resetMasterPassword( newPassword, existingPassword, keepBackup, backupPath ); +} + void QgsAuthManager::setScheduledAuthDatabaseErase( bool scheduleErase ) { ensureInitialized(); @@ -1455,7 +1541,7 @@ bool QgsAuthManager::backupAuthenticationDatabase( QString *backuppath ) if ( sqliteDatabasePath().isEmpty() ) { - const char *err = QT_TR_NOOP( "The authentication database is not filesystem-based" ); + const char *err = QT_TR_NOOP( "The authentication storage is not filesystem-based" ); QgsDebugError( err ); emit messageLog( tr( err ), authManTag(), Qgis::MessageLevel::Warning ); return false; @@ -1463,7 +1549,7 @@ bool QgsAuthManager::backupAuthenticationDatabase( QString *backuppath ) if ( !QFile::exists( sqliteDatabasePath() ) ) { - const char *err = QT_TR_NOOP( "No authentication database found" ); + const char *err = QT_TR_NOOP( "No authentication database file found" ); QgsDebugError( err ); emit messageLog( tr( err ), authManTag(), Qgis::MessageLevel::Warning ); return false; @@ -3074,6 +3160,46 @@ bool QgsAuthManager::passwordHelperSync() return false; } +bool QgsAuthManager::verifyStoredPasswordHelperPassword() +{ + if ( !passwordHelperEnabled() ) + return false; + + bool readOk = false; + const QString currentPass = passwordHelperRead( readOk ); + if ( !readOk ) + return false; + + if ( !currentPass.isEmpty() && ( mPasswordHelperErrorCode == QKeychain::NoError ) ) + { + return verifyMasterPassword( currentPass ); + } + return false; +} + +QString QgsAuthManager::passwordHelperDisplayName( bool titleCase ) +{ +#if defined(Q_OS_MAC) + return titleCase ? QObject::tr( "Keychain" ) : QObject::tr( "keychain" ); +#elif defined(Q_OS_WIN) + return titleCase ? QObject::tr( "Password Manager" ) : QObject::tr( "password manager" ); +#elif defined(Q_OS_LINUX) + + const QString desktopSession = qgetenv( "DESKTOP_SESSION" ); + const QString currentDesktop = qgetenv( "XDG_CURRENT_DESKTOP" ); + const QString gdmSession = qgetenv( "GDMSESSION" ); + // lets use a more precise string if we're running on KDE! + if ( desktopSession.contains( QLatin1String( "kde" ), Qt::CaseInsensitive ) || currentDesktop.contains( QLatin1String( "kde" ), Qt::CaseInsensitive ) || gdmSession.contains( QLatin1String( "kde" ), Qt::CaseInsensitive ) ) + { + return titleCase ? QObject::tr( "Wallet" ) : QObject::tr( "wallet" ); + } + + return titleCase ? QObject::tr( "Wallet/Key Ring" ) : QObject::tr( "wallet/key ring" ); +#else + return titleCase ? QObject::tr( "Password Manager" ) : QObject::tr( "password manager" ); +#endif +} + ////////////////// Certificate calls - end /////////////////////// @@ -3234,7 +3360,7 @@ bool QgsAuthManager::passwordHelperDelete() { ensureInitialized(); - passwordHelperLog( tr( "Opening %1 for DELETE…" ).arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME ) ); + passwordHelperLog( tr( "Opening %1 for DELETE…" ).arg( passwordHelperDisplayName() ) ); bool result; QKeychain::DeletePasswordJob job( AUTH_PASSWORD_HELPER_FOLDER_NAME ); QgsSettings settings; @@ -3263,13 +3389,14 @@ bool QgsAuthManager::passwordHelperDelete() return result; } -QString QgsAuthManager::passwordHelperRead() +QString QgsAuthManager::passwordHelperRead( bool &ok ) { + ok = false; ensureInitialized(); // Retrieve it! QString password; - passwordHelperLog( tr( "Opening %1 for READ…" ).arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME ) ); + passwordHelperLog( tr( "Opening %1 for READ…" ).arg( passwordHelperDisplayName() ) ); QKeychain::ReadPasswordJob job( AUTH_PASSWORD_HELPER_FOLDER_NAME ); QgsSettings settings; job.setInsecureFallback( settings.value( QStringLiteral( "password_helper_insecure_fallback" ), false, QgsSettings::Section::Auth ).toBool() ); @@ -3282,7 +3409,7 @@ QString QgsAuthManager::passwordHelperRead() if ( job.error() ) { mPasswordHelperErrorCode = job.error(); - mPasswordHelperErrorMessage = tr( "Retrieving password from your %1 failed: %2." ).arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME, job.errorString() ); + mPasswordHelperErrorMessage = tr( "Retrieving password from the %1 failed: %2." ).arg( passwordHelperDisplayName(), job.errorString() ); // Signals used in the tests to exit main application loop emit passwordHelperFailure(); } @@ -3293,12 +3420,13 @@ QString QgsAuthManager::passwordHelperRead() if ( password.isEmpty() ) { mPasswordHelperErrorCode = QKeychain::EntryNotFound; - mPasswordHelperErrorMessage = tr( "Empty password retrieved from your %1." ).arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME ); + mPasswordHelperErrorMessage = tr( "Empty password retrieved from the %1." ).arg( passwordHelperDisplayName( true ) ); // Signals used in the tests to exit main application loop emit passwordHelperFailure(); } else { + ok = true; // Signals used in the tests to exit main application loop emit passwordHelperSuccess(); } @@ -3313,7 +3441,7 @@ bool QgsAuthManager::passwordHelperWrite( const QString &password ) Q_ASSERT( !password.isEmpty() ); bool result; - passwordHelperLog( tr( "Opening %1 for WRITE…" ).arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME ) ); + passwordHelperLog( tr( "Opening %1 for WRITE…" ).arg( passwordHelperDisplayName() ) ); QKeychain::WritePasswordJob job( AUTH_PASSWORD_HELPER_FOLDER_NAME ); QgsSettings settings; job.setInsecureFallback( settings.value( QStringLiteral( "password_helper_insecure_fallback" ), false, QgsSettings::Section::Auth ).toBool() ); @@ -3327,7 +3455,7 @@ bool QgsAuthManager::passwordHelperWrite( const QString &password ) if ( job.error() ) { mPasswordHelperErrorCode = job.error(); - mPasswordHelperErrorMessage = tr( "Storing password in your %1 failed: %2." ).arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME, job.errorString() ); + mPasswordHelperErrorMessage = tr( "Storing password in the %1 failed: %2." ).arg( passwordHelperDisplayName(), job.errorString() ); // Signals used in the tests to exit main application loop emit passwordHelperFailure(); result = false; @@ -3355,9 +3483,9 @@ void QgsAuthManager::setPasswordHelperEnabled( const bool enabled ) QgsSettings settings; settings.setValue( QStringLiteral( "use_password_helper" ), enabled, QgsSettings::Section::Auth ); emit messageLog( enabled ? tr( "Your %1 will be used from now on to store and retrieve the master password." ) - .arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME ) : + .arg( passwordHelperDisplayName() ) : tr( "Your %1 will not be used anymore to store and retrieve the master password." ) - .arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME ) ); + .arg( passwordHelperDisplayName() ) ); } bool QgsAuthManager::passwordHelperLoggingEnabled() @@ -3392,15 +3520,15 @@ void QgsAuthManager::passwordHelperProcessError() // we also want to disable the wallet system to prevent annoying // notification on each subsequent access. setPasswordHelperEnabled( false ); - mPasswordHelperErrorMessage = tr( "There was an error and integration with your %1 system has been disabled. " + mPasswordHelperErrorMessage = tr( "There was an error and integration with your %1 has been disabled. " "You can re-enable it at any time through the \"Utilities\" menu " "in the Authentication pane of the options dialog. %2" ) - .arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME, mPasswordHelperErrorMessage ); + .arg( passwordHelperDisplayName(), mPasswordHelperErrorMessage ); } if ( mPasswordHelperErrorCode != QKeychain::NoError ) { // We've got an error from the wallet - passwordHelperLog( tr( "Error in %1: %2" ).arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME, mPasswordHelperErrorMessage ) ); + passwordHelperLog( tr( "Error in %1: %2" ).arg( passwordHelperDisplayName(), mPasswordHelperErrorMessage ) ); emit passwordHelperMessageLog( mPasswordHelperErrorMessage, authManTag(), Qgis::MessageLevel::Critical ); } passwordHelperClearErrors(); @@ -3421,19 +3549,19 @@ bool QgsAuthManager::masterPasswordInput() // Read the password from the wallet if ( passwordHelperEnabled() ) { - pass = passwordHelperRead(); - if ( ! pass.isEmpty() && ( mPasswordHelperErrorCode == QKeychain::NoError ) ) + bool readOk = false; + pass = passwordHelperRead( readOk ); + if ( readOk && ! pass.isEmpty() && ( mPasswordHelperErrorCode == QKeychain::NoError ) ) { // Let's check the password! if ( verifyMasterPassword( pass ) ) { ok = true; storedPasswordIsValid = true; - emit passwordHelperMessageLog( tr( "Master password has been successfully read from your %1" ).arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME ), authManTag(), Qgis::MessageLevel::Info ); } else { - emit passwordHelperMessageLog( tr( "Master password stored in your %1 is not valid" ).arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME ), authManTag(), Qgis::MessageLevel::Warning ); + emit passwordHelperMessageLog( tr( "Master password stored in the %1 is not valid" ).arg( passwordHelperDisplayName() ), authManTag(), Qgis::MessageLevel::Warning ); } } } @@ -3449,13 +3577,9 @@ bool QgsAuthManager::masterPasswordInput() mMasterPass = pass; if ( passwordHelperEnabled() && ! storedPasswordIsValid ) { - if ( passwordHelperWrite( pass ) ) - { - emit passwordHelperMessageLog( tr( "Master password has been successfully written to your %1" ).arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME ), authManTag(), Qgis::MessageLevel::Info ); - } - else + if ( !passwordHelperWrite( pass ) ) { - emit passwordHelperMessageLog( tr( "Master password could not be written to your %1" ).arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME ), authManTag(), Qgis::MessageLevel::Warning ); + emit passwordHelperMessageLog( tr( "Master password could not be written to the %1" ).arg( passwordHelperDisplayName() ), authManTag(), Qgis::MessageLevel::Warning ); } } return true; diff --git a/src/core/auth/qgsauthmanager.h b/src/core/auth/qgsauthmanager.h index 908ab353d825..3e826c399789 100644 --- a/src/core/auth/qgsauthmanager.h +++ b/src/core/auth/qgsauthmanager.h @@ -54,6 +54,7 @@ class QgsAuthMethod; class QgsAuthMethodEdit; class QgsAuthProvider; class QgsAuthMethodMetadata; +class QgsSettingsEntryBool; class QTimer; class QgsAuthConfigurationStorage; class QgsAuthConfigurationStorageDb; @@ -73,6 +74,9 @@ class CORE_EXPORT QgsAuthManager : public QObject public: + static const QgsSettingsEntryBool *settingsGenerateRandomPasswordForPasswordHelper SIP_SKIP; + static const QgsSettingsEntryBool *settingsUsingGeneratedRandomPassword SIP_SKIP; + //! Message log level (mirrors that of QgsMessageLog, so it can also output there) enum MessageLevel { @@ -186,6 +190,15 @@ class CORE_EXPORT QgsAuthManager : public QObject */ const QString authenticationDatabaseUriStripped() const; + /** + * Creates a new securely seeded random password and stores it in the + * system keychain as the new master password. + * + * \note Not available in Python bindings + * \since QGIS 3.42 + */ + bool createAndStoreRandomMasterPasswordInKeyChain() SIP_SKIP; + /** * Main call to initially set or continually check master password is set * \note If it is not set, the user is asked for its input @@ -227,15 +240,31 @@ class CORE_EXPORT QgsAuthManager : public QObject bool masterPasswordSame( const QString &password ) const; /** - * Reset the master password to a new one, then re-encrypt all previous - * configs in a new database file, optionally backup current database + * Reset the master password to a new one, then re-encrypts all previous + * configs with the new password. + * * \param newpass New master password to replace existing * \param oldpass Current master password to replace existing - * \param keepbackup Whether to keep the generated backup of current database + * \param keepbackup Whether to keep the generated backup of current database (if using file-based storage) * \param backuppath Where the backup is located, if kept */ bool resetMasterPassword( const QString &newpass, const QString &oldpass, bool keepbackup, QString *backuppath SIP_INOUT = nullptr ); + /** + * Reset the master password to a new one, hen re-encrypts all previous + * configs with the new password. + * + * The old password will automatically be retrieved from the password helper. + * + * \param newPassword New master password to replace existing + * \param keepBackup Whether to keep the generated backup of current database (if using file-based storage) + * \param backupPath Where the backup is located, if kept + * + * \note Not available in Python bindings + * \since QGIS 3.42 + */ + bool resetMasterPasswordUsingStoredPasswordHelper( const QString &newPassword, bool keepBackup, QString *backupPath = nullptr ) SIP_SKIP; + /** * Whether there is a scheduled opitonal erase of authentication database. * \note not available in Python bindings @@ -756,12 +785,42 @@ class CORE_EXPORT QgsAuthManager : public QObject */ bool passwordHelperSync(); - //! The display name of the password helper (platform dependent) + /** + * Verify the password stored in the password helper. + * + * \note Not available in Python bindings + * \since QGIS 3.42 + */ + bool verifyStoredPasswordHelperPassword() SIP_SKIP; + + // TODO QGIS 4.0 -- remove + + /** + * The display name of the password helper (platform dependent). + * + * This is deprecated, use passwordHelperDisplayName() instead. + */ static const QString AUTH_PASSWORD_HELPER_DISPLAY_NAME; + /** + * Returns a translated display name of the password helper (platform dependent). + * + * If \a titleCase is TRUE then a title case version of the string will be returned. Otherwise + * a mid-sentence case version will be returned. + * + * \since QGIS 3.42 + */ + static QString passwordHelperDisplayName( bool titleCase = false ); + //! The display name of the Authentication Manager static const QString AUTH_MAN_TAG; + /** + * Returns the path to the authentication database file or an empty string if the database is not SQLite. + * + * \note Not available in Python bindings + */ + QString sqliteDatabasePath() const SIP_SKIP; signals: @@ -869,6 +928,11 @@ class CORE_EXPORT QgsAuthManager : public QObject private: + /** + * Generates a random, securely seeded password. + */ + static QString generatePassword(); + bool initPrivate( const QString &pluginPath ); ////////////////////////////////////////////////////////////////////////////// @@ -881,7 +945,7 @@ class CORE_EXPORT QgsAuthManager : public QObject void passwordHelperLog( const QString &msg ) const; //! Read Master password from the wallet - QString passwordHelperRead(); + QString passwordHelperRead( bool &ok ); //! Store Master password in the wallet bool passwordHelperWrite( const QString &password ); @@ -933,11 +997,6 @@ class CORE_EXPORT QgsAuthManager : public QObject */ QgsAuthConfigurationStorage *firstStorageWithCapability( Qgis::AuthConfigurationStorageCapability capability ) const; - /** - * Returns the path to the authentication database file or an empty string if the database is not SQLite. - */ - const QString sqliteDatabasePath() const; - static QgsAuthManager *sInstance; static const QString AUTH_CONFIG_TABLE; static const QString AUTH_SERVERS_TABLE; diff --git a/src/core/browser/qgsfilebaseddataitemprovider.cpp b/src/core/browser/qgsfilebaseddataitemprovider.cpp index 844ac78e1d8a..57fdfaa054cc 100644 --- a/src/core/browser/qgsfilebaseddataitemprovider.cpp +++ b/src/core/browser/qgsfilebaseddataitemprovider.cpp @@ -85,7 +85,7 @@ QVector QgsProviderSublayerItem::createChildren() if ( !relations.empty() || !relationError.isEmpty() ) { - std::unique_ptr< QgsRelationshipsItem > relationsItem = std::make_unique< QgsRelationshipsItem >( this, mPath + "/relations", conn->uri(), QStringLiteral( "ogr" ), QString(), mDetails.name() ); + auto relationsItem = std::make_unique< QgsRelationshipsItem >( this, mPath + "/relations", conn->uri(), QStringLiteral( "ogr" ), QString(), mDetails.name() ); // force this item to appear last by setting a maximum string value for the sort key relationsItem->setSortKey( QString( QChar( 0x11FFFF ) ) ); children.append( relationsItem.release() ); @@ -346,7 +346,7 @@ QVector QgsFileDataCollectionItem::createChildren() if ( !fieldDomains.empty() || !domainError.isEmpty() ) { - std::unique_ptr< QgsFieldDomainsItem > domainsItem = std::make_unique< QgsFieldDomainsItem >( this, mPath + "/domains", conn->uri(), QStringLiteral( "ogr" ) ); + auto domainsItem = std::make_unique< QgsFieldDomainsItem >( this, mPath + "/domains", conn->uri(), QStringLiteral( "ogr" ) ); // force this item to appear last by setting a maximum string value for the sort key domainsItem->setSortKey( QString( QChar( 0x10FFFF ) ) ); children.append( domainsItem.release() ); @@ -367,7 +367,7 @@ QVector QgsFileDataCollectionItem::createChildren() if ( !relations.empty() || !relationError.isEmpty() ) { - std::unique_ptr< QgsRelationshipsItem > relationsItem = std::make_unique< QgsRelationshipsItem >( this, mPath + "/relations", conn->uri(), QStringLiteral( "ogr" ) ); + auto relationsItem = std::make_unique< QgsRelationshipsItem >( this, mPath + "/relations", conn->uri(), QStringLiteral( "ogr" ) ); // force this item to appear last by setting a maximum string value for the sort key relationsItem->setSortKey( QString( QChar( 0x11FFFF ) ) ); children.append( relationsItem.release() ); diff --git a/src/core/browser/qgslayeritem.cpp b/src/core/browser/qgslayeritem.cpp index 7ba9fff15bb7..94a4fc9b4d6d 100644 --- a/src/core/browser/qgslayeritem.cpp +++ b/src/core/browser/qgslayeritem.cpp @@ -18,6 +18,7 @@ #include "qgslayeritem.h" #include "moc_qgslayeritem.cpp" #include "qgsmaplayer.h" +#include "qgsmaplayerfactory.h" #include "qgsvectorlayer.h" #include "qgsiconutils.h" @@ -243,11 +244,11 @@ bool QgsLayerItem::equal( const QgsDataItem *other ) QgsMimeDataUtils::UriList QgsLayerItem::mimeUris() const { QgsMimeDataUtils::Uri u; + u.layerType = QgsMapLayerFactory::typeToString( mapLayerType() ); switch ( mapLayerType() ) { case Qgis::LayerType::Vector: - u.layerType = QStringLiteral( "vector" ); switch ( mLayerType ) { case Qgis::BrowserLayerType::Point: @@ -277,28 +278,13 @@ QgsMimeDataUtils::UriList QgsLayerItem::mimeUris() const } break; case Qgis::LayerType::Raster: - u.layerType = QStringLiteral( "raster" ); - break; case Qgis::LayerType::Mesh: - u.layerType = QStringLiteral( "mesh" ); - break; case Qgis::LayerType::VectorTile: - u.layerType = QStringLiteral( "vector-tile" ); - break; case Qgis::LayerType::PointCloud: - u.layerType = QStringLiteral( "pointcloud" ); - break; case Qgis::LayerType::TiledScene: - u.layerType = QStringLiteral( "tiled-scene" ); - break; case Qgis::LayerType::Plugin: - u.layerType = QStringLiteral( "plugin" ); - break; case Qgis::LayerType::Group: - u.layerType = QStringLiteral( "group" ); - break; case Qgis::LayerType::Annotation: - u.layerType = QStringLiteral( "annotation" ); break; } diff --git a/src/core/browser/qgszipitem.cpp b/src/core/browser/qgszipitem.cpp index 1d77dbc2d814..f3d75e0eca59 100644 --- a/src/core/browser/qgszipitem.cpp +++ b/src/core/browser/qgszipitem.cpp @@ -179,7 +179,7 @@ QgsDataItem *QgsZipItem::itemFromPath( QgsDataItem *parent, const QString &fileP if ( !QgsGdalUtils::isVsiArchivePrefix( vsiPrefix ) ) return nullptr; - std::unique_ptr< QgsZipItem > zipItem = std::make_unique< QgsZipItem >( parent, name, filePath, path ); + auto zipItem = std::make_unique< QgsZipItem >( parent, name, filePath, path ); // force populate zipItem if it has less than 10 items and is not a .tgz or .tar.gz file (slow loading) // for other items populating will be delayed until item is opened // this might be polluting the tree with empty items but is necessary for performance reasons diff --git a/src/core/callouts/qgscallout.cpp b/src/core/callouts/qgscallout.cpp index d77536145d50..7e674cfbdfd5 100644 --- a/src/core/callouts/qgscallout.cpp +++ b/src/core/callouts/qgscallout.cpp @@ -555,7 +555,7 @@ QgsSimpleLineCallout::QgsSimpleLineCallout( const QgsSimpleLineCallout &other ) QgsCallout *QgsSimpleLineCallout::create( const QVariantMap &properties, const QgsReadWriteContext &context ) { - std::unique_ptr< QgsSimpleLineCallout > callout = std::make_unique< QgsSimpleLineCallout >(); + auto callout = std::make_unique< QgsSimpleLineCallout >(); callout->readProperties( properties, context ); return callout.release(); } @@ -764,7 +764,7 @@ QgsManhattanLineCallout::QgsManhattanLineCallout( const QgsManhattanLineCallout QgsCallout *QgsManhattanLineCallout::create( const QVariantMap &properties, const QgsReadWriteContext &context ) // cppcheck-suppress duplInheritedMember { - std::unique_ptr< QgsManhattanLineCallout > callout = std::make_unique< QgsManhattanLineCallout >(); + auto callout = std::make_unique< QgsManhattanLineCallout >(); callout->readProperties( properties, context ); return callout.release(); } @@ -804,7 +804,7 @@ QgsCurvedLineCallout::QgsCurvedLineCallout( const QgsCurvedLineCallout &other ) QgsCallout *QgsCurvedLineCallout::create( const QVariantMap &properties, const QgsReadWriteContext &context ) // cppcheck-suppress duplInheritedMember { - std::unique_ptr< QgsCurvedLineCallout > callout = std::make_unique< QgsCurvedLineCallout >(); + auto callout = std::make_unique< QgsCurvedLineCallout >(); callout->readProperties( properties, context ); callout->setCurvature( properties.value( QStringLiteral( "curvature" ), 0.1 ).toDouble() ); @@ -1061,7 +1061,7 @@ QgsBalloonCallout::QgsBalloonCallout( const QgsBalloonCallout &other ) QgsCallout *QgsBalloonCallout::create( const QVariantMap &properties, const QgsReadWriteContext &context ) { - std::unique_ptr< QgsBalloonCallout > callout = std::make_unique< QgsBalloonCallout >(); + auto callout = std::make_unique< QgsBalloonCallout >(); callout->readProperties( properties, context ); return callout.release(); } diff --git a/src/core/classification/qgsclassificationcustom.cpp b/src/core/classification/qgsclassificationcustom.cpp index b28a8fdc4468..a5c79b7b1145 100644 --- a/src/core/classification/qgsclassificationcustom.cpp +++ b/src/core/classification/qgsclassificationcustom.cpp @@ -27,7 +27,7 @@ QgsClassificationCustom::QgsClassificationCustom() std::unique_ptr QgsClassificationCustom::clone() const { - std::unique_ptr< QgsClassificationCustom > c = std::make_unique< QgsClassificationCustom >(); + auto c = std::make_unique< QgsClassificationCustom >(); copyBase( c.get() ); return c; } diff --git a/src/core/classification/qgsclassificationequalinterval.cpp b/src/core/classification/qgsclassificationequalinterval.cpp index a452fea5e24e..d33263d8c5ed 100644 --- a/src/core/classification/qgsclassificationequalinterval.cpp +++ b/src/core/classification/qgsclassificationequalinterval.cpp @@ -93,7 +93,7 @@ QList QgsClassificationEqualInterval::calculateBreaks( double &minimum, std::unique_ptr< QgsClassificationMethod > QgsClassificationEqualInterval::clone() const { - std::unique_ptr< QgsClassificationEqualInterval > c = std::make_unique< QgsClassificationEqualInterval >(); + auto c = std::make_unique< QgsClassificationEqualInterval >(); copyBase( c.get() ); return c; } diff --git a/src/core/classification/qgsclassificationfixedinterval.cpp b/src/core/classification/qgsclassificationfixedinterval.cpp index c71fe5f9fcd4..f036e1f75451 100644 --- a/src/core/classification/qgsclassificationfixedinterval.cpp +++ b/src/core/classification/qgsclassificationfixedinterval.cpp @@ -23,13 +23,13 @@ QgsClassificationFixedInterval::QgsClassificationFixedInterval() : QgsClassificationMethod( IgnoresClassCount, 0 ) { - std::unique_ptr< QgsProcessingParameterNumber > param = std::make_unique< QgsProcessingParameterNumber >( QStringLiteral( "INTERVAL" ), QObject::tr( "Interval size" ), Qgis::ProcessingNumberParameterType::Double, 1, false, 0.000000000001 ); + auto param = std::make_unique< QgsProcessingParameterNumber >( QStringLiteral( "INTERVAL" ), QObject::tr( "Interval size" ), Qgis::ProcessingNumberParameterType::Double, 1, false, 0.000000000001 ); addParameter( param.release() ); } std::unique_ptr QgsClassificationFixedInterval::clone() const { - std::unique_ptr c = std::make_unique< QgsClassificationFixedInterval >(); + auto c = std::make_unique< QgsClassificationFixedInterval >(); copyBase( c.get() ); return c; } diff --git a/src/core/classification/qgsclassificationjenks.cpp b/src/core/classification/qgsclassificationjenks.cpp index 53a7816d66a7..3f199fe69981 100644 --- a/src/core/classification/qgsclassificationjenks.cpp +++ b/src/core/classification/qgsclassificationjenks.cpp @@ -37,7 +37,7 @@ QString QgsClassificationJenks::id() const std::unique_ptr QgsClassificationJenks::clone() const { - std::unique_ptr< QgsClassificationJenks > c = std::make_unique< QgsClassificationJenks >(); + auto c = std::make_unique< QgsClassificationJenks >(); copyBase( c.get() ); return c; } diff --git a/src/core/classification/qgsclassificationlogarithmic.cpp b/src/core/classification/qgsclassificationlogarithmic.cpp index 11efce98a214..70ae72d3cf9f 100644 --- a/src/core/classification/qgsclassificationlogarithmic.cpp +++ b/src/core/classification/qgsclassificationlogarithmic.cpp @@ -31,7 +31,7 @@ QgsClassificationLogarithmic::QgsClassificationLogarithmic() std::unique_ptr QgsClassificationLogarithmic::clone() const { - std::unique_ptr c = std::make_unique< QgsClassificationLogarithmic >(); + auto c = std::make_unique< QgsClassificationLogarithmic >(); copyBase( c.get() ); return c; } diff --git a/src/core/classification/qgsclassificationprettybreaks.cpp b/src/core/classification/qgsclassificationprettybreaks.cpp index 4a3657a898fe..7eda81f1a66c 100644 --- a/src/core/classification/qgsclassificationprettybreaks.cpp +++ b/src/core/classification/qgsclassificationprettybreaks.cpp @@ -50,7 +50,7 @@ QList QgsClassificationPrettyBreaks::calculateBreaks( double &minimum, d std::unique_ptr QgsClassificationPrettyBreaks::clone() const { - std::unique_ptr< QgsClassificationPrettyBreaks > c = std::make_unique< QgsClassificationPrettyBreaks >(); + auto c = std::make_unique< QgsClassificationPrettyBreaks >(); copyBase( c.get() ); return c; } diff --git a/src/core/classification/qgsclassificationquantile.cpp b/src/core/classification/qgsclassificationquantile.cpp index 73a2d014d646..867213636392 100644 --- a/src/core/classification/qgsclassificationquantile.cpp +++ b/src/core/classification/qgsclassificationquantile.cpp @@ -34,7 +34,7 @@ QString QgsClassificationQuantile::id() const std::unique_ptr QgsClassificationQuantile::clone() const { - std::unique_ptr c = std::make_unique< QgsClassificationQuantile >(); + auto c = std::make_unique< QgsClassificationQuantile >(); copyBase( c.get() ); return c; } diff --git a/src/core/classification/qgsclassificationstandarddeviation.cpp b/src/core/classification/qgsclassificationstandarddeviation.cpp index 42db4eed3cd4..d4d85903db7f 100644 --- a/src/core/classification/qgsclassificationstandarddeviation.cpp +++ b/src/core/classification/qgsclassificationstandarddeviation.cpp @@ -40,7 +40,7 @@ QString QgsClassificationStandardDeviation::id() const std::unique_ptr< QgsClassificationMethod > QgsClassificationStandardDeviation::clone() const { - std::unique_ptr c = std::make_unique< QgsClassificationStandardDeviation >(); + auto c = std::make_unique< QgsClassificationStandardDeviation >(); copyBase( c.get() ); c->mStdDev = mStdDev; return c; diff --git a/src/core/effects/qgsblureffect.cpp b/src/core/effects/qgsblureffect.cpp index 77a094e6088a..eb244aacf5f0 100644 --- a/src/core/effects/qgsblureffect.cpp +++ b/src/core/effects/qgsblureffect.cpp @@ -30,7 +30,7 @@ QgsPaintEffect *QgsBlurEffect::create( const QVariantMap &map ) void QgsBlurEffect::draw( QgsRenderContext &context ) { - if ( !source() || !enabled() || !context.painter() ) + if ( !enabled() || !context.painter() || source().isNull() ) return; switch ( mBlurMethod ) @@ -48,7 +48,7 @@ void QgsBlurEffect::drawStackBlur( QgsRenderContext &context ) { const int blurLevel = std::round( context.convertToPainterUnits( mBlurLevel, mBlurUnit, mBlurMapUnitScale, Qgis::RenderSubcomponentProperty::BlurSize ) ); - QImage im = sourceAsImage( context )->copy(); + QImage im = sourceAsImage( context ).copy(); QgsImageOperation::stackBlur( im, blurLevel, false, context.feedback() ); drawBlurredImage( context, im ); } @@ -57,7 +57,8 @@ void QgsBlurEffect::drawGaussianBlur( QgsRenderContext &context ) { const int blurLevel = std::round( context.convertToPainterUnits( mBlurLevel, mBlurUnit, mBlurMapUnitScale, Qgis::RenderSubcomponentProperty::BlurSize ) ); - QImage *im = QgsImageOperation::gaussianBlur( *sourceAsImage( context ), blurLevel, context.feedback() ); + QImage source = sourceAsImage( context ).copy(); + QImage *im = QgsImageOperation::gaussianBlur( source, blurLevel, context.feedback() ); if ( !im->isNull() ) drawBlurredImage( context, *im ); delete im; diff --git a/src/core/effects/qgscoloreffect.cpp b/src/core/effects/qgscoloreffect.cpp index ab9e420b4f10..d01bc0e93306 100644 --- a/src/core/effects/qgscoloreffect.cpp +++ b/src/core/effects/qgscoloreffect.cpp @@ -37,13 +37,13 @@ QgsColorEffect::QgsColorEffect() void QgsColorEffect::draw( QgsRenderContext &context ) { - if ( !source() || !enabled() || !context.painter() ) + if ( !enabled() || !context.painter() || source().isNull() ) return; QPainter *painter = context.painter(); //rasterize source and apply modifications - QImage image = sourceAsImage( context )->copy(); + QImage image = sourceAsImage( context ).copy(); QgsImageOperation::adjustBrightnessContrast( image, mBrightness, mContrast / 100.0 + 1, context.feedback() ); diff --git a/src/core/effects/qgseffectstack.cpp b/src/core/effects/qgseffectstack.cpp index 00f82353e830..95df808d5050 100644 --- a/src/core/effects/qgseffectstack.cpp +++ b/src/core/effects/qgseffectstack.cpp @@ -84,9 +84,10 @@ void QgsEffectStack::draw( QgsRenderContext &context ) //first, we build up a list of rendered effects //we do this moving backwards through the stack, so that each effect's results //becomes the source of the previous effect - QPicture *sourcePic = new QPicture( *source() ); - QPicture *currentPic = sourcePic; - QList< QPicture * > results; + const QPicture sourcePic = source(); + const QPicture *currentPic = &sourcePic; + std::vector< QPicture > results; + results.reserve( mEffectList.count() ); for ( int i = mEffectList.count() - 1; i >= 0; --i ) { QgsPaintEffect *effect = mEffectList.at( i ); @@ -95,19 +96,19 @@ void QgsEffectStack::draw( QgsRenderContext &context ) continue; } - QPicture *pic = nullptr; + const QPicture *pic = nullptr; if ( effect->type() == QLatin1String( "drawSource" ) ) { //draw source is always the original source, regardless of previous effect results - pic = sourcePic; + pic = &sourcePic; } else { pic = currentPic; } - QPicture *resultPic = new QPicture(); - QPainter p( resultPic ); + QPicture resultPic; + QPainter p( &resultPic ); context.setPainter( &p ); //effect stack has it's own handling of the QPicture DPI issue, so //we disable QgsPaintEffect's internal workaround @@ -116,14 +117,12 @@ void QgsEffectStack::draw( QgsRenderContext &context ) effect->requiresQPainterDpiFix = true; p.end(); - results << resultPic; + results.emplace_back( std::move( resultPic ) ); if ( mEffectList.at( i )->drawMode() != QgsPaintEffect::Render ) { - currentPic = resultPic; + currentPic = &results.back(); } } - delete sourcePic; - sourcePic = nullptr; context.setPainter( destPainter ); //then, we render all the results in the opposite order @@ -134,12 +133,11 @@ void QgsEffectStack::draw( QgsRenderContext &context ) continue; } - QPicture *pic = results.takeLast(); if ( mEffectList.at( i )->drawMode() != QgsPaintEffect::Modifier ) { - QgsPainting::drawPicture( context.painter(), QPointF( 0, 0 ), *pic ); + QgsPainting::drawPicture( context.painter(), QPointF( 0, 0 ), results.back() ); } - delete pic; + results.pop_back(); } } diff --git a/src/core/effects/qgsgloweffect.cpp b/src/core/effects/qgsgloweffect.cpp index bb5d2ce055cc..43b93c319d2e 100644 --- a/src/core/effects/qgsgloweffect.cpp +++ b/src/core/effects/qgsgloweffect.cpp @@ -41,10 +41,10 @@ QgsGlowEffect::~QgsGlowEffect() void QgsGlowEffect::draw( QgsRenderContext &context ) { - if ( !source() || !enabled() || !context.painter() ) + if ( !enabled() || !context.painter() || source().isNull() ) return; - QImage im = sourceAsImage( context )->copy(); + QImage im = sourceAsImage( context ).copy(); QgsColorRamp *ramp = nullptr; std::unique_ptr< QgsGradientColorRamp > tempRamp; @@ -98,7 +98,7 @@ void QgsGlowEffect::draw( QgsRenderContext &context ) QPainter p( &im ); p.setRenderHint( QPainter::Antialiasing ); p.setCompositionMode( QPainter::CompositionMode_DestinationIn ); - p.drawImage( 0, 0, *sourceAsImage( context ) ); + p.drawImage( 0, 0, sourceAsImage( context ) ); p.end(); } diff --git a/src/core/effects/qgsimageoperation.cpp b/src/core/effects/qgsimageoperation.cpp index fae3537331b8..5b3d515e2eab 100644 --- a/src/core/effects/qgsimageoperation.cpp +++ b/src/core/effects/qgsimageoperation.cpp @@ -693,7 +693,7 @@ QImage *QgsImageOperation::gaussianBlur( QImage &image, const int radius, QgsFee return new QImage(); //blur along columns - std::unique_ptr< QImage > yBlurImage = std::make_unique< QImage >( width, height, QImage::Format_ARGB32_Premultiplied ); + auto yBlurImage = std::make_unique< QImage >( width, height, QImage::Format_ARGB32_Premultiplied ); GaussianBlurOperation colBlur( radius, QgsImageOperation::ByColumn, yBlurImage.get(), kernel.get(), feedback ); runRectOperation( xBlurImage, colBlur ); diff --git a/src/core/effects/qgspainteffect.cpp b/src/core/effects/qgspainteffect.cpp index a4d2f38a148c..e3e896f5bf89 100644 --- a/src/core/effects/qgspainteffect.cpp +++ b/src/core/effects/qgspainteffect.cpp @@ -17,7 +17,6 @@ #include "qgspainteffect.h" #include "qgsimageoperation.h" -#include "qgslogger.h" #include "qgsrendercontext.h" #include "qgssymbollayerutils.h" #include "qgspainting.h" @@ -33,12 +32,8 @@ QgsPaintEffect::QgsPaintEffect( const QgsPaintEffect &other ) QgsPaintEffect::~QgsPaintEffect() { - if ( mOwnsImage ) - { - delete mSourceImage; - } - delete mEffectPainter; - delete mTempPicture; + // ensure painter is destroyed before picture it may be drawing on, just in case + mEffectPainter.reset(); } void QgsPaintEffect::setEnabled( const bool enabled ) @@ -76,12 +71,11 @@ bool QgsPaintEffect::readProperties( const QDomElement &element ) return true; } -void QgsPaintEffect::render( QPicture &picture, QgsRenderContext &context ) +void QgsPaintEffect::render( const QPicture &picture, QgsRenderContext &context ) { //set source picture - mPicture = &picture; - delete mSourceImage; - mSourceImage = nullptr; + mPicture = picture; + mSourceImage = QImage(); draw( context ); } @@ -91,14 +85,13 @@ void QgsPaintEffect::begin( QgsRenderContext &context ) //temporarily replace painter and direct paint operations for context to a QPicture mPrevPainter = context.painter(); - delete mTempPicture; - mTempPicture = new QPicture(); + mTempPicture = std::make_unique< QPicture >(); - delete mEffectPainter; - mEffectPainter = new QPainter(); - mEffectPainter->begin( mTempPicture ); + mEffectPainter = std::make_unique< QPainter >(); + mEffectPainter->begin( mTempPicture.get() ); - context.setPainter( mEffectPainter ); + context.setPainterFlagsUsingContext( mEffectPainter.get() ); + context.setPainter( mEffectPainter.get() ); } void QgsPaintEffect::end( QgsRenderContext &context ) @@ -107,8 +100,7 @@ void QgsPaintEffect::end( QgsRenderContext &context ) return; mEffectPainter->end(); - delete mEffectPainter; - mEffectPainter = nullptr; + mEffectPainter.reset(); //restore previous painter for context context.setPainter( mPrevPainter ); @@ -123,44 +115,43 @@ void QgsPaintEffect::end( QgsRenderContext &context ) render( *mTempPicture, context ); //clean up - delete mTempPicture; - mTempPicture = nullptr; + mTempPicture.reset(); } void QgsPaintEffect::drawSource( QPainter &painter ) { if ( requiresQPainterDpiFix ) { - QgsPainting::drawPicture( &painter, QPointF( 0, 0 ), *mPicture ); + QgsPainting::drawPicture( &painter, QPointF( 0, 0 ), mPicture ); } else { - painter.drawPicture( 0, 0, *mPicture ); + painter.drawPicture( 0, 0, mPicture ); } } -QImage *QgsPaintEffect::sourceAsImage( QgsRenderContext &context ) +QImage QgsPaintEffect::sourceAsImage( QgsRenderContext &context ) { //have we already created a source image? if so, return it - if ( mSourceImage ) + if ( !mSourceImage.isNull() ) { return mSourceImage; } - if ( !mPicture ) - return nullptr; + if ( mPicture.isNull() ) + return QImage(); //else create it //TODO - test with premultiplied image for speed const QRectF bounds = imageBoundingRect( context ); - mSourceImage = new QImage( bounds.width(), bounds.height(), QImage::Format_ARGB32 ); - mSourceImage->fill( Qt::transparent ); - QPainter imagePainter( mSourceImage ); + mSourceImage = QImage( static_cast< int >( std::ceil( bounds.width() ) ), + static_cast< int >( std::ceil( bounds.height() ) ), QImage::Format_ARGB32 ); + mSourceImage.fill( Qt::transparent ); + QPainter imagePainter( &mSourceImage ); imagePainter.setRenderHint( QPainter::Antialiasing ); imagePainter.translate( -bounds.left(), -bounds.top() ); - imagePainter.drawPicture( 0, 0, *mPicture ); + imagePainter.drawPicture( 0, 0, mPicture ); imagePainter.end(); - mOwnsImage = true; return mSourceImage; } @@ -182,7 +173,7 @@ void QgsPaintEffect::fixQPictureDpi( QPainter *painter ) const QRectF QgsPaintEffect::imageBoundingRect( const QgsRenderContext &context ) const { - return boundingRect( mPicture->boundingRect(), context ); + return boundingRect( mPicture.boundingRect(), context ); } @@ -212,7 +203,7 @@ void QgsDrawSourceEffect::draw( QgsRenderContext &context ) else { //rasterize source and apply modifications - QImage image = sourceAsImage( context )->copy(); + QImage image = sourceAsImage( context ).copy(); QgsImageOperation::multiplyOpacity( image, mOpacity, context.feedback() ); const QgsScopedQPainterState painterState( painter ); painter->setCompositionMode( mBlendMode ); diff --git a/src/core/effects/qgspainteffect.h b/src/core/effects/qgspainteffect.h index 257bbaf6e6eb..3252b1ca55a2 100644 --- a/src/core/effects/qgspainteffect.h +++ b/src/core/effects/qgspainteffect.h @@ -22,6 +22,7 @@ #include #include #include +#include class QgsRenderContext; @@ -165,7 +166,7 @@ class CORE_EXPORT QgsPaintEffect SIP_NODEFAULTCTORS * \param context destination render context * \see begin */ - virtual void render( QPicture &picture, QgsRenderContext &context ); + virtual void render( const QPicture &picture, QgsRenderContext &context ); /** * Begins intercepting paint operations to a render context. When the corresponding @@ -246,20 +247,20 @@ class CORE_EXPORT QgsPaintEffect SIP_NODEFAULTCTORS * \see drawSource * \see sourceAsImage */ - const QPicture *source() const { return mPicture; } + const QPicture &source() const { return mPicture; } /** * Returns the source QPicture rendered to a new QImage. The draw() member can * utilize this when drawing the effect. The image will be padded or cropped from the original * source QPicture by the results of the boundingRect() method. * The result is cached to speed up subsequent calls to sourceAsImage. - * \returns source QPicture rendered to an image + * \returns source QPicture rendered to an image, or a null image if source could not be rendered * \see drawSource * \see source * \see imageOffset * \see boundingRect */ - QImage *sourceAsImage( QgsRenderContext &context ); + QImage sourceAsImage( QgsRenderContext &context ); /** * Returns the offset which should be used when drawing the source image on to a destination @@ -293,13 +294,12 @@ class CORE_EXPORT QgsPaintEffect SIP_NODEFAULTCTORS private: - const QPicture *mPicture = nullptr; - QImage *mSourceImage = nullptr; - bool mOwnsImage = false; + QPicture mPicture; + QImage mSourceImage; QPainter *mPrevPainter = nullptr; - QPainter *mEffectPainter = nullptr; - QPicture *mTempPicture = nullptr; + std::unique_ptr< QPainter > mEffectPainter; + std::unique_ptr< QPicture > mTempPicture; QRectF imageBoundingRect( const QgsRenderContext &context ) const; diff --git a/src/core/effects/qgsshadoweffect.cpp b/src/core/effects/qgsshadoweffect.cpp index ed88f36f4aef..bf25dd3797d9 100644 --- a/src/core/effects/qgsshadoweffect.cpp +++ b/src/core/effects/qgsshadoweffect.cpp @@ -29,13 +29,13 @@ QgsShadowEffect::QgsShadowEffect() void QgsShadowEffect::draw( QgsRenderContext &context ) { - if ( !source() || !enabled() || !context.painter() ) + if ( !enabled() || !context.painter() || source().isNull() ) return; if ( context.feedback() && context.feedback()->isCanceled() ) return; - QImage colorisedIm = sourceAsImage( context )->copy(); + QImage colorisedIm = sourceAsImage( context ).copy(); if ( context.feedback() && context.feedback()->isCanceled() ) return; @@ -87,7 +87,7 @@ void QgsShadowEffect::draw( QgsRenderContext &context ) //restrict shadow so it's only drawn on top of original image imPainter.setCompositionMode( QPainter::CompositionMode_DestinationIn ); - imPainter.drawImage( 0, 0, *sourceAsImage( context ) ); + imPainter.drawImage( 0, 0, sourceAsImage( context ) ); imPainter.end(); painter->drawImage( imageOffset( context ), innerShadowIm ); diff --git a/src/core/effects/qgstransformeffect.cpp b/src/core/effects/qgstransformeffect.cpp index 9f715222e58f..6739ff3a744f 100644 --- a/src/core/effects/qgstransformeffect.cpp +++ b/src/core/effects/qgstransformeffect.cpp @@ -30,7 +30,7 @@ QgsPaintEffect *QgsTransformEffect::create( const QVariantMap &map ) void QgsTransformEffect::draw( QgsRenderContext &context ) { - if ( !source() || !enabled() || !context.painter() ) + if ( !enabled() || !context.painter() || source().isNull() ) return; QPainter *painter = context.painter(); @@ -95,13 +95,14 @@ QTransform QgsTransformEffect::createTransform( const QgsRenderContext &context { QTransform t; - if ( !source() ) + const QPicture &pic = source(); + if ( pic.isNull() ) return t; - const int width = source()->boundingRect().width(); - const int height = source()->boundingRect().height(); - const int top = source()->boundingRect().top(); - const int left = source()->boundingRect().left(); + const int width = pic.boundingRect().width(); + const int height = pic.boundingRect().height(); + const int top = pic.boundingRect().top(); + const int left = pic.boundingRect().left(); //remember that the below operations are effectively performed in the opposite order //so, first the reflection applies, then scale, shear, rotate and lastly translation diff --git a/src/core/elevation/qgsprofilerenderer.cpp b/src/core/elevation/qgsprofilerenderer.cpp index 540999f47c27..29f6dc4ad3ba 100644 --- a/src/core/elevation/qgsprofilerenderer.cpp +++ b/src/core/elevation/qgsprofilerenderer.cpp @@ -75,7 +75,7 @@ void QgsProfilePlotRenderer::startGeneration() mJobs.reserve( mGenerators.size() ); for ( const auto &it : mGenerators ) { - std::unique_ptr< ProfileJob > job = std::make_unique< ProfileJob >(); + auto job = std::make_unique< ProfileJob >(); job->generator = it.get(); job->context = mContext; mJobs.emplace_back( std::move( job ) ); @@ -99,7 +99,7 @@ void QgsProfilePlotRenderer::generateSynchronously() for ( const auto &it : mGenerators ) { - std::unique_ptr< ProfileJob > job = std::make_unique< ProfileJob >(); + auto job = std::make_unique< ProfileJob >(); job->generator = it.get(); job->context = mContext; it.get()->generateProfile( job->context ); @@ -314,6 +314,7 @@ QImage QgsProfilePlotRenderer::renderToImage( int width, int height, double dist context.setDevicePixelRatio( devicePixelRatio ); const double mapUnitsPerPixel = ( distanceMax - distanceMin ) / width; context.setMapToPixel( QgsMapToPixel( mapUnitsPerPixel ) ); + context.setShowSelection( false ); // don't show selected features rendring on image export render( context, width, height, distanceMin, distanceMax, zMin, zMax, sourceId ); p.end(); diff --git a/src/core/expression/qgsexpressioncontextutils.cpp b/src/core/expression/qgsexpressioncontextutils.cpp index a8c162cd7365..2411d5752722 100644 --- a/src/core/expression/qgsexpressioncontextutils.cpp +++ b/src/core/expression/qgsexpressioncontextutils.cpp @@ -604,7 +604,7 @@ QgsExpressionContextScope *QgsExpressionContextUtils::updateSymbolScope( const Q QgsExpressionContextScope *QgsExpressionContextUtils::layoutScope( const QgsLayout *layout ) { - std::unique_ptr< QgsExpressionContextScope > scope( new QgsExpressionContextScope( QObject::tr( "Layout" ) ) ); + auto scope = std::make_unique( QObject::tr( "Layout" ) ); if ( !layout ) return scope.release(); @@ -901,7 +901,7 @@ QgsExpressionContextScope *QgsExpressionContextUtils::processingAlgorithmScope( // set aside for future use Q_UNUSED( context ) - std::unique_ptr< QgsExpressionContextScope > scope( new QgsExpressionContextScope( QObject::tr( "Algorithm" ) ) ); + auto scope = std::make_unique( QObject::tr( "Algorithm" ) ); scope->addFunction( QStringLiteral( "parameter" ), new GetProcessingParameterValue( parameters ) ); if ( !algorithm ) @@ -915,7 +915,7 @@ QgsExpressionContextScope *QgsExpressionContextUtils::processingAlgorithmScope( QgsExpressionContextScope *QgsExpressionContextUtils::processingModelAlgorithmScope( const QgsProcessingModelAlgorithm *model, const QVariantMap &, QgsProcessingContext &context ) { - std::unique_ptr< QgsExpressionContextScope > modelScope( new QgsExpressionContextScope( QObject::tr( "Model" ) ) ); + auto modelScope = std::make_unique( QObject::tr( "Model" ) ); QString modelPath; if ( !model->sourceFilePath().isEmpty() ) { @@ -946,7 +946,7 @@ QgsExpressionContextScope *QgsExpressionContextUtils::processingModelAlgorithmSc QgsExpressionContextScope *QgsExpressionContextUtils::notificationScope( const QString &message ) { - std::unique_ptr< QgsExpressionContextScope > scope( new QgsExpressionContextScope() ); + auto scope = std::make_unique(); scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "notification_message" ), message, true ) ); return scope.release(); } @@ -1293,7 +1293,7 @@ class CurrentFaceIndexExpressionFunction: public QgsScopedExpressionFunction QgsExpressionContextScope *QgsExpressionContextUtils::meshExpressionScope( QgsMesh::ElementType elementType ) { - std::unique_ptr scope = std::make_unique(); + auto scope = std::make_unique(); switch ( elementType ) { diff --git a/src/core/expression/qgsexpressionfunction.cpp b/src/core/expression/qgsexpressionfunction.cpp index 9f276181e49c..6e6aeaf4a924 100644 --- a/src/core/expression/qgsexpressionfunction.cpp +++ b/src/core/expression/qgsexpressionfunction.cpp @@ -3819,7 +3819,7 @@ static QVariant fcnMakePolygon( const QVariantList &values, const QgsExpressionC if ( outerRing.type() != Qgis::GeometryType::Line || outerRing.isNull() ) return QVariant(); - std::unique_ptr< QgsPolygon > polygon = std::make_unique< QgsPolygon >(); + auto polygon = std::make_unique< QgsPolygon >(); const QgsCurve *exteriorRing = qgsgeometry_cast< QgsCurve * >( outerRing.constGet() ); if ( !exteriorRing && outerRing.isMultipart() ) @@ -3871,8 +3871,8 @@ static QVariant fcnMakePolygon( const QVariantList &values, const QgsExpressionC static QVariant fcnMakeTriangle( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent, const QgsExpressionNodeFunction * ) { - std::unique_ptr tr( new QgsTriangle() ); - std::unique_ptr lineString( new QgsLineString() ); + auto tr = std::make_unique(); + auto lineString = std::make_unique(); lineString->clear(); for ( const QVariant &value : values ) diff --git a/src/core/expression/qgsexpressionnodeimpl.cpp b/src/core/expression/qgsexpressionnodeimpl.cpp index 44428a39464e..ef2e8b8e3824 100644 --- a/src/core/expression/qgsexpressionnodeimpl.cpp +++ b/src/core/expression/qgsexpressionnodeimpl.cpp @@ -795,7 +795,7 @@ bool QgsExpressionNodeBinaryOperator::prepareNode( QgsExpression *parent, const auto orValuesIt = orValuesMap.find( fieldName ); if ( orValuesIt.value().count() == 1 ) { - std::unique_ptr eqNode = std::make_unique( boEQ, new QgsExpressionNodeColumnRef( fieldName ), orValuesIt.value().at( 0 )->clone() ); + auto eqNode = std::make_unique( boEQ, new QgsExpressionNodeColumnRef( fieldName ), orValuesIt.value().at( 0 )->clone() ); if ( currentNode ) { currentNode = std::make_unique( boOr, currentNode.release(), eqNode.release() ); @@ -807,7 +807,7 @@ bool QgsExpressionNodeBinaryOperator::prepareNode( QgsExpression *parent, const } else { - std::unique_ptr inNode = std::make_unique( new QgsExpressionNodeColumnRef( fieldName ), orValuesIt.value().clone() ); + auto inNode = std::make_unique( new QgsExpressionNodeColumnRef( fieldName ), orValuesIt.value().clone() ); if ( currentNode ) { currentNode = std::make_unique( boOr, currentNode.release(), inNode.release() ); diff --git a/src/core/expression/qgsexpressionutils.h b/src/core/expression/qgsexpressionutils.h index 67fea59714ab..0c3512b1f554 100644 --- a/src/core/expression/qgsexpressionutils.h +++ b/src/core/expression/qgsexpressionutils.h @@ -201,7 +201,7 @@ class CORE_EXPORT QgsExpressionUtils return v.userType() == QMetaType::Type::QVariantList || v.userType() == QMetaType::Type::QStringList; } -// implicit conversion to string + // implicit conversion to string static QString getStringValue( const QVariant &value, QgsExpression * ) { return value.toString(); diff --git a/src/core/externalstorage/qgshttpexternalstorage.cpp b/src/core/externalstorage/qgshttpexternalstorage.cpp index b13dfe4610da..f714f1332ec2 100644 --- a/src/core/externalstorage/qgshttpexternalstorage.cpp +++ b/src/core/externalstorage/qgshttpexternalstorage.cpp @@ -235,7 +235,7 @@ QString QgsAwsS3ExternalStorage::displayName() const QgsExternalStorageStoredContent *QgsAwsS3ExternalStorage::doStore( const QString &filePath, const QString &url, const QString &authcfg ) const { - std::unique_ptr storedContent = std::make_unique( filePath, url, authcfg ); + auto storedContent = std::make_unique( filePath, url, authcfg ); storedContent->setPrepareRequestHandler( []( QNetworkRequest & request, QFile * f ) { QCryptographicHash payloadCrypto( QCryptographicHash::Sha256 ); diff --git a/src/core/geometry/qgsbox3d.cpp b/src/core/geometry/qgsbox3d.cpp index dc6b7d4c3dcb..802491b02b5f 100644 --- a/src/core/geometry/qgsbox3d.cpp +++ b/src/core/geometry/qgsbox3d.cpp @@ -245,7 +245,7 @@ void QgsBox3D::combineWith( double x, double y, double z ) } } -double QgsBox3D::distanceTo( const QVector3D &point ) const +double QgsBox3D::distanceTo( const QgsVector3D &point ) const { const double dx = std::max( mBounds2d.xMinimum() - point.x(), std::max( 0., point.x() - mBounds2d.xMaximum() ) ); const double dy = std::max( mBounds2d.yMinimum() - point.y(), std::max( 0., point.y() - mBounds2d.yMaximum() ) ); diff --git a/src/core/geometry/qgsbox3d.h b/src/core/geometry/qgsbox3d.h index 72dd81ae0052..d4d1d7777bc1 100644 --- a/src/core/geometry/qgsbox3d.h +++ b/src/core/geometry/qgsbox3d.h @@ -398,8 +398,17 @@ class CORE_EXPORT QgsBox3D * (returns 0 if the point is inside the box) * * \since QGIS 3.18 + * \deprecated QGIS 3.42. Use distanceTo() with QgsVector3D instead (QVector3D uses floats). */ - double distanceTo( const QVector3D &point ) const SIP_HOLDGIL; + Q_DECL_DEPRECATED double distanceTo( const QVector3D &point ) const SIP_DEPRECATED { return distanceTo( QgsVector3D( point ) ); } + + /** + * Returns the smallest distance between the box and the point \a point + * (returns 0 if the point is inside the box) + * + * \since QGIS 3.42 + */ + double distanceTo( const QgsVector3D &point ) const SIP_HOLDGIL; bool operator==( const QgsBox3D &other ) const SIP_HOLDGIL; diff --git a/src/core/geometry/qgscircle.cpp b/src/core/geometry/qgscircle.cpp index 0dfcd7f2c578..b18d1c0442cc 100644 --- a/src/core/geometry/qgscircle.cpp +++ b/src/core/geometry/qgscircle.cpp @@ -429,7 +429,7 @@ QVector QgsCircle::northQuadrant() const QgsCircularString *QgsCircle::toCircularString( bool oriented ) const { - std::unique_ptr circString( new QgsCircularString() ); + auto circString = std::make_unique(); QgsPointSequence points; QVector quad; if ( oriented ) diff --git a/src/core/geometry/qgscircularstring.cpp b/src/core/geometry/qgscircularstring.cpp index 9027c0e9ac43..cf5bc8d1c16f 100644 --- a/src/core/geometry/qgscircularstring.cpp +++ b/src/core/geometry/qgscircularstring.cpp @@ -1804,7 +1804,7 @@ QgsCircularString *QgsCircularString::curveSubstring( double startDistance, doub << QgsPoint( pointType, prevX, prevY, prevZ, prevM ); } - std::unique_ptr< QgsCircularString > result = std::make_unique< QgsCircularString >(); + auto result = std::make_unique< QgsCircularString >(); result->setPoints( substringPoints ); return result.release(); } diff --git a/src/core/geometry/qgscompoundcurve.cpp b/src/core/geometry/qgscompoundcurve.cpp index 217e77c4be10..0d081179f567 100644 --- a/src/core/geometry/qgscompoundcurve.cpp +++ b/src/core/geometry/qgscompoundcurve.cpp @@ -802,20 +802,20 @@ bool QgsCompoundCurve::deleteVertex( QgsVertexId position ) if ( subVertexId.vertex < points.length() - 2 ) { - std::unique_ptr curveC = std::make_unique(); + auto curveC = std::make_unique(); curveC->setPoints( points.mid( subVertexId.vertex + 1 ) ); mCurves.insert( curveId, curveC.release() ); } const QgsPointSequence partB = QgsPointSequence() << points[subVertexId.vertex - 1] << points[subVertexId.vertex + 1]; - std::unique_ptr curveB = std::make_unique(); + auto curveB = std::make_unique(); curveB->setPoints( partB ); mCurves.insert( curveId, curveB.release() ); curve = mCurves.at( curveId ); if ( subVertexId.vertex > 1 ) { - std::unique_ptr curveA = std::make_unique(); + auto curveA = std::make_unique(); curveA->setPoints( points.mid( 0, subVertexId.vertex ) ); mCurves.insert( curveId, curveA.release() ); } @@ -1004,11 +1004,11 @@ bool QgsCompoundCurve::toggleCircularAtVertex( QgsVertexId position ) const QgsPointSequence partB = QgsPointSequence() << points[subVertexId.vertex - 1] << points[subVertexId.vertex] << points[subVertexId.vertex + 1]; const QgsPointSequence partC = points.mid( subVertexId.vertex + 1 ); - std::unique_ptr curveA = std::make_unique(); + auto curveA = std::make_unique(); curveA->setPoints( partA ); - std::unique_ptr curveB = std::make_unique(); + auto curveB = std::make_unique(); curveB->setPoints( partB ); - std::unique_ptr curveC = std::make_unique(); + auto curveC = std::make_unique(); curveC->setPoints( partC ); removeCurve( curveId ); @@ -1029,11 +1029,11 @@ bool QgsCompoundCurve::toggleCircularAtVertex( QgsVertexId position ) const QgsPointSequence partB = QgsPointSequence() << points[subVertexId.vertex - 1] << points[subVertexId.vertex] << points[subVertexId.vertex + 1]; const QgsPointSequence partC = points.mid( subVertexId.vertex + 1 ); - std::unique_ptr curveA = std::make_unique(); + auto curveA = std::make_unique(); curveA->setPoints( partA ); - std::unique_ptr curveB = std::make_unique(); + auto curveB = std::make_unique(); curveB->setPoints( partB ); - std::unique_ptr curveC = std::make_unique(); + auto curveC = std::make_unique(); curveC->setPoints( partC ); removeCurve( curveId ); @@ -1178,7 +1178,7 @@ std::tuple, std::unique_ptr > QgsCompoundCur int curveStart = 0; - std::unique_ptr< QgsCompoundCurve > curve1 = std::make_unique< QgsCompoundCurve >(); + auto curve1 = std::make_unique< QgsCompoundCurve >(); std::unique_ptr< QgsCompoundCurve > curve2; for ( const QgsCurve *curve : mCurves ) @@ -1323,7 +1323,7 @@ QgsCompoundCurve *QgsCompoundCurve::curveSubstring( double startDistance, double return createEmptyWithSameType(); endDistance = std::max( startDistance, endDistance ); - std::unique_ptr< QgsCompoundCurve > substring = std::make_unique< QgsCompoundCurve >(); + auto substring = std::make_unique< QgsCompoundCurve >(); double distanceTraversed = 0; for ( const QgsCurve *curve : mCurves ) diff --git a/src/core/geometry/qgscurvepolygon.cpp b/src/core/geometry/qgscurvepolygon.cpp index 9ddc13df46be..737ef8f1e41e 100644 --- a/src/core/geometry/qgscurvepolygon.cpp +++ b/src/core/geometry/qgscurvepolygon.cpp @@ -515,7 +515,7 @@ double QgsCurvePolygon::roundness() const QgsPolygon *QgsCurvePolygon::surfaceToPolygon() const { - std::unique_ptr< QgsPolygon > polygon( new QgsPolygon() ); + auto polygon = std::make_unique(); if ( !mExteriorRing ) return polygon.release(); @@ -598,7 +598,7 @@ QgsCurvePolygon *QgsCurvePolygon::simplifyByDistance( double tolerance ) const if ( !qgsgeometry_cast< QgsLineString * >( exterior.get() ) ) return nullptr; - std::unique_ptr< QgsPolygon > polygon = std::make_unique< QgsPolygon >( qgis::down_cast< QgsLineString * >( exterior.release() ) ); + auto polygon = std::make_unique< QgsPolygon >( qgis::down_cast< QgsLineString * >( exterior.release() ) ); //interior rings for ( const QgsCurve *interior : mInteriorRings ) @@ -685,7 +685,7 @@ bool QgsCurvePolygon::boundingBoxIntersects( const QgsBox3D &box3d ) const QgsPolygon *QgsCurvePolygon::toPolygon( double tolerance, SegmentationToleranceType toleranceType ) const { - std::unique_ptr< QgsPolygon > poly( new QgsPolygon() ); + auto poly = std::make_unique(); if ( !mExteriorRing ) { return poly.release(); diff --git a/src/core/geometry/qgsellipse.cpp b/src/core/geometry/qgsellipse.cpp index 43775447bf94..4dafc0ef9b1e 100644 --- a/src/core/geometry/qgsellipse.cpp +++ b/src/core/geometry/qgsellipse.cpp @@ -259,7 +259,7 @@ void QgsEllipse::pointsInternal( unsigned int segments, QVector &x, QVec QgsPolygon *QgsEllipse::toPolygon( unsigned int segments ) const { - std::unique_ptr polygon( new QgsPolygon() ); + auto polygon = std::make_unique(); if ( segments < 3 ) { return polygon.release(); @@ -337,7 +337,7 @@ QString QgsEllipse::toString( int pointPrecision, int axisPrecision, int azimuth QgsPolygon *QgsEllipse::orientedBoundingBox() const { - std::unique_ptr ombb( new QgsPolygon() ); + auto ombb = std::make_unique(); if ( isEmpty() ) { return ombb.release(); diff --git a/src/core/geometry/qgsgeometry.cpp b/src/core/geometry/qgsgeometry.cpp index c4ad60b38ea1..0486eae29d76 100644 --- a/src/core/geometry/qgsgeometry.cpp +++ b/src/core/geometry/qgsgeometry.cpp @@ -240,18 +240,18 @@ QgsGeometry QgsGeometry::fromRect( const QgsRectangle &rect ) if ( rect.isNull() ) return QgsGeometry(); - std::unique_ptr< QgsLineString > ext = std::make_unique< QgsLineString >( - QVector< double >() << rect.xMinimum() - << rect.xMaximum() - << rect.xMaximum() - << rect.xMinimum() - << rect.xMinimum(), - QVector< double >() << rect.yMinimum() - << rect.yMinimum() - << rect.yMaximum() - << rect.yMaximum() - << rect.yMinimum() ); - std::unique_ptr< QgsPolygon > polygon = std::make_unique< QgsPolygon >(); + auto ext = std::make_unique< QgsLineString >( + QVector< double >() << rect.xMinimum() + << rect.xMaximum() + << rect.xMaximum() + << rect.xMinimum() + << rect.xMinimum(), + QVector< double >() << rect.yMinimum() + << rect.yMinimum() + << rect.yMaximum() + << rect.yMaximum() + << rect.yMinimum() ); + auto polygon = std::make_unique< QgsPolygon >(); polygon->setExteriorRing( ext.release() ); return QgsGeometry( std::move( polygon ) ); } @@ -263,120 +263,120 @@ QgsGeometry QgsGeometry::fromBox3D( const QgsBox3D &box ) return fromRect( box.toRectangle() ); } - std::unique_ptr< QgsPolyhedralSurface > polyhedralSurface = std::make_unique< QgsPolyhedralSurface >(); - - std::unique_ptr< QgsLineString > ext1 = std::make_unique< QgsLineString >( - QVector< double >() << box.xMinimum() - << box.xMinimum() - << box.xMaximum() - << box.xMaximum() - << box.xMinimum(), - QVector< double >() << box.yMinimum() - << box.yMaximum() - << box.yMaximum() - << box.yMinimum() - << box.yMinimum(), - QVector< double >() << box.zMinimum() - << box.zMinimum() - << box.zMinimum() - << box.zMinimum() - << box.zMinimum() ); - std::unique_ptr< QgsPolygon > polygon1 = std::make_unique< QgsPolygon >( ext1.release() ); + auto polyhedralSurface = std::make_unique< QgsPolyhedralSurface >(); + + auto ext1 = std::make_unique< QgsLineString >( + QVector< double >() << box.xMinimum() + << box.xMinimum() + << box.xMaximum() + << box.xMaximum() + << box.xMinimum(), + QVector< double >() << box.yMinimum() + << box.yMaximum() + << box.yMaximum() + << box.yMinimum() + << box.yMinimum(), + QVector< double >() << box.zMinimum() + << box.zMinimum() + << box.zMinimum() + << box.zMinimum() + << box.zMinimum() ); + auto polygon1 = std::make_unique< QgsPolygon >( ext1.release() ); polyhedralSurface->addPatch( polygon1.release() ); - std::unique_ptr< QgsLineString > ext2 = std::make_unique< QgsLineString >( - QVector< double >() << box.xMinimum() - << box.xMinimum() - << box.xMinimum() - << box.xMinimum() - << box.xMinimum(), - QVector< double >() << box.yMinimum() - << box.yMaximum() - << box.yMaximum() - << box.yMinimum() - << box.yMinimum(), - QVector< double >() << box.zMinimum() - << box.zMinimum() - << box.zMaximum() - << box.zMaximum() - << box.zMinimum() ); - std::unique_ptr< QgsPolygon > polygon2 = std::make_unique< QgsPolygon >( ext2.release() ); + auto ext2 = std::make_unique< QgsLineString >( + QVector< double >() << box.xMinimum() + << box.xMinimum() + << box.xMinimum() + << box.xMinimum() + << box.xMinimum(), + QVector< double >() << box.yMinimum() + << box.yMaximum() + << box.yMaximum() + << box.yMinimum() + << box.yMinimum(), + QVector< double >() << box.zMinimum() + << box.zMinimum() + << box.zMaximum() + << box.zMaximum() + << box.zMinimum() ); + auto polygon2 = std::make_unique< QgsPolygon >( ext2.release() ); polyhedralSurface->addPatch( polygon2.release() ); - std::unique_ptr< QgsLineString > ext3 = std::make_unique< QgsLineString >( - QVector< double >() << box.xMinimum() - << box.xMaximum() - << box.xMaximum() - << box.xMinimum() - << box.xMinimum(), - QVector< double >() << box.yMinimum() - << box.yMinimum() - << box.yMinimum() - << box.yMinimum() - << box.yMinimum(), - QVector< double >() << box.zMinimum() - << box.zMinimum() - << box.zMaximum() - << box.zMaximum() - << box.zMinimum() ); - std::unique_ptr< QgsPolygon > polygon3 = std::make_unique< QgsPolygon >( ext3.release() ); + auto ext3 = std::make_unique< QgsLineString >( + QVector< double >() << box.xMinimum() + << box.xMaximum() + << box.xMaximum() + << box.xMinimum() + << box.xMinimum(), + QVector< double >() << box.yMinimum() + << box.yMinimum() + << box.yMinimum() + << box.yMinimum() + << box.yMinimum(), + QVector< double >() << box.zMinimum() + << box.zMinimum() + << box.zMaximum() + << box.zMaximum() + << box.zMinimum() ); + auto polygon3 = std::make_unique< QgsPolygon >( ext3.release() ); polyhedralSurface->addPatch( polygon3.release() ); - std::unique_ptr< QgsLineString > ext4 = std::make_unique< QgsLineString >( - QVector< double >() << box.xMaximum() - << box.xMaximum() - << box.xMinimum() - << box.xMinimum() - << box.xMaximum(), - QVector< double >() << box.yMaximum() - << box.yMinimum() - << box.yMinimum() - << box.yMaximum() - << box.yMaximum(), - QVector< double >() << box.zMaximum() - << box.zMaximum() - << box.zMaximum() - << box.zMaximum() - << box.zMaximum() ); - std::unique_ptr< QgsPolygon > polygon4 = std::make_unique< QgsPolygon >( ext4.release() ); + auto ext4 = std::make_unique< QgsLineString >( + QVector< double >() << box.xMaximum() + << box.xMaximum() + << box.xMinimum() + << box.xMinimum() + << box.xMaximum(), + QVector< double >() << box.yMaximum() + << box.yMinimum() + << box.yMinimum() + << box.yMaximum() + << box.yMaximum(), + QVector< double >() << box.zMaximum() + << box.zMaximum() + << box.zMaximum() + << box.zMaximum() + << box.zMaximum() ); + auto polygon4 = std::make_unique< QgsPolygon >( ext4.release() ); polyhedralSurface->addPatch( polygon4.release() ); - std::unique_ptr< QgsLineString > ext5 = std::make_unique< QgsLineString >( - QVector< double >() << box.xMaximum() - << box.xMaximum() - << box.xMaximum() - << box.xMaximum() - << box.xMaximum(), - QVector< double >() << box.yMaximum() - << box.yMinimum() - << box.yMinimum() - << box.yMaximum() - << box.yMaximum(), - QVector< double >() << box.zMaximum() - << box.zMaximum() - << box.zMinimum() - << box.zMinimum() - << box.zMaximum() ); - std::unique_ptr< QgsPolygon > polygon5 = std::make_unique< QgsPolygon >( ext5.release() ); + auto ext5 = std::make_unique< QgsLineString >( + QVector< double >() << box.xMaximum() + << box.xMaximum() + << box.xMaximum() + << box.xMaximum() + << box.xMaximum(), + QVector< double >() << box.yMaximum() + << box.yMinimum() + << box.yMinimum() + << box.yMaximum() + << box.yMaximum(), + QVector< double >() << box.zMaximum() + << box.zMaximum() + << box.zMinimum() + << box.zMinimum() + << box.zMaximum() ); + auto polygon5 = std::make_unique< QgsPolygon >( ext5.release() ); polyhedralSurface->addPatch( polygon5.release() ); - std::unique_ptr< QgsLineString > ext6 = std::make_unique< QgsLineString >( - QVector< double >() << box.xMaximum() - << box.xMaximum() - << box.xMinimum() - << box.xMinimum() - << box.xMaximum(), - QVector< double >() << box.yMaximum() - << box.yMaximum() - << box.yMaximum() - << box.yMaximum() - << box.yMaximum(), - QVector< double >() << box.zMaximum() - << box.zMinimum() - << box.zMinimum() - << box.zMaximum() - << box.zMaximum() ); - std::unique_ptr< QgsPolygon > polygon6 = std::make_unique< QgsPolygon >( ext6.release() ); + auto ext6 = std::make_unique< QgsLineString >( + QVector< double >() << box.xMaximum() + << box.xMaximum() + << box.xMinimum() + << box.xMinimum() + << box.xMaximum(), + QVector< double >() << box.yMaximum() + << box.yMaximum() + << box.yMaximum() + << box.yMaximum() + << box.yMaximum(), + QVector< double >() << box.zMaximum() + << box.zMinimum() + << box.zMinimum() + << box.zMaximum() + << box.zMaximum() ); + auto polygon6 = std::make_unique< QgsPolygon >( ext6.release() ); polyhedralSurface->addPatch( polygon6.release() ); return QgsGeometry( std::move( polyhedralSurface ) ); @@ -421,7 +421,7 @@ QgsGeometry QgsGeometry::createWedgeBuffer( const QgsPoint ¢er, const double QgsGeometry QgsGeometry::createWedgeBufferFromAngles( const QgsPoint ¢er, double startAngle, double endAngle, double outerRadius, double innerRadius ) { - std::unique_ptr< QgsCompoundCurve > wedge = std::make_unique< QgsCompoundCurve >(); + auto wedge = std::make_unique< QgsCompoundCurve >(); const double DEG_TO_RAD = M_PI / 180.0; const double RAD_TO_DEG = 180.0 / M_PI; @@ -431,17 +431,17 @@ QgsGeometry QgsGeometry::createWedgeBufferFromAngles( const QgsPoint ¢er, do if ( std::abs( angularWidth ) >= 360.0 ) { - std::unique_ptr< QgsCompoundCurve > outerCc = std::make_unique< QgsCompoundCurve >(); + auto outerCc = std::make_unique< QgsCompoundCurve >(); QgsCircle outerCircle = QgsCircle( center, outerRadius ); outerCc->addCurve( outerCircle.toCircularString() ); - std::unique_ptr< QgsCurvePolygon > cp = std::make_unique< QgsCurvePolygon >(); + auto cp = std::make_unique< QgsCurvePolygon >(); cp->setExteriorRing( outerCc.release() ); if ( !qgsDoubleNear( innerRadius, 0.0 ) && innerRadius > 0 ) { - std::unique_ptr< QgsCompoundCurve > innerCc = std::make_unique< QgsCompoundCurve >(); + auto innerCc = std::make_unique< QgsCompoundCurve >(); QgsCircle innerCircle = QgsCircle( center, innerRadius ); innerCc->addCurve( innerCircle.toCircularString() ); @@ -471,7 +471,7 @@ QgsGeometry QgsGeometry::createWedgeBufferFromAngles( const QgsPoint ¢er, do wedge->addCurve( new QgsLineString( center, outerP1 ) ); } - std::unique_ptr< QgsCurvePolygon > cp = std::make_unique< QgsCurvePolygon >(); + auto cp = std::make_unique< QgsCurvePolygon >(); cp->setExteriorRing( wedge.release() ); return QgsGeometry( std::move( cp ) ); } @@ -724,7 +724,7 @@ bool QgsGeometry::toggleCircularAtVertex( int atVertex ) { // TODO : move this block before the above, so we call toggleCircularAtVertex only in one place // If the geom is a linestring or cirularstring, we create a compound curve - std::unique_ptr cpdCurve = std::make_unique(); + auto cpdCurve = std::make_unique(); cpdCurve->addCurve( curve->clone() ); success = cpdCurve->toggleCircularAtVertex( QgsVertexId( -1, -1, id.vertex ) ); @@ -938,7 +938,7 @@ double QgsGeometry::closestSegmentWithContext( const QgsPointXY &point, Qgis::GeometryOperationResult QgsGeometry::addRing( const QVector &ring ) { - std::unique_ptr< QgsLineString > ringLine = std::make_unique< QgsLineString >( ring ); + auto ringLine = std::make_unique< QgsLineString >( ring ); return addRing( ringLine.release() ); } @@ -980,7 +980,7 @@ Qgis::GeometryOperationResult QgsGeometry::addPart( const QgsPointSequence &poin } else if ( points.size() > 1 ) { - std::unique_ptr< QgsLineString > ringLine = std::make_unique< QgsLineString >(); + auto ringLine = std::make_unique< QgsLineString >(); ringLine->setPoints( points ); partGeom = std::move( ringLine ); } @@ -998,7 +998,7 @@ Qgis::GeometryOperationResult QgsGeometry::addPartV2( const QgsPointSequence &po } else if ( points.size() > 1 ) { - std::unique_ptr< QgsLineString > ringLine = std::make_unique< QgsLineString >(); + auto ringLine = std::make_unique< QgsLineString >(); ringLine->setPoints( points ); partGeom = std::move( ringLine ); } @@ -1740,14 +1740,14 @@ QVector QgsGeometry::coerceToType( const Qgis::WkbType type, double { if ( QgsWkbTypes::isCurvedType( type ) ) { - std::unique_ptr< QgsCurvePolygon > cp = std::make_unique< QgsCurvePolygon >(); + auto cp = std::make_unique< QgsCurvePolygon >(); cp->setExteriorRing( curve ); ( void )exterior.release(); gc->addGeometry( cp.release() ); } else { - std::unique_ptr< QgsPolygon > p = std::make_unique< QgsPolygon >(); + auto p = std::make_unique< QgsPolygon >(); p->setExteriorRing( qgsgeometry_cast< QgsLineString * >( curve ) ); ( void )exterior.release(); gc->addGeometry( p.release() ); @@ -1763,7 +1763,7 @@ QVector QgsGeometry::coerceToType( const Qgis::WkbType type, double newGeom.type() == Qgis::GeometryType::Polygon ) ) { // lines/polygons to a point layer, extract all vertices - std::unique_ptr< QgsMultiPoint > mp = std::make_unique< QgsMultiPoint >(); + auto mp = std::make_unique< QgsMultiPoint >(); const QgsGeometry source = newGeom; QSet< QgsPoint > added; for ( auto vertex = source.vertices_begin(); vertex != source.vertices_end(); ++vertex ) @@ -1780,7 +1780,7 @@ QVector QgsGeometry::coerceToType( const Qgis::WkbType type, double if ( QgsWkbTypes::flatType( type ) == Qgis::WkbType::PolyhedralSurface && QgsWkbTypes::flatType( QgsWkbTypes::singleType( newGeom.wkbType() ) ) == Qgis::WkbType::Polygon ) { - std::unique_ptr< QgsPolyhedralSurface > polySurface = std::make_unique< QgsPolyhedralSurface >(); + auto polySurface = std::make_unique< QgsPolyhedralSurface >(); const QgsGeometry source = newGeom; for ( auto part = source.const_parts_begin(); part != source.const_parts_end(); ++part ) { @@ -1796,7 +1796,7 @@ QVector QgsGeometry::coerceToType( const Qgis::WkbType type, double if ( QgsWkbTypes::flatType( type ) == Qgis::WkbType::Triangle && QgsWkbTypes::flatType( newGeom.wkbType() ) == Qgis::WkbType::Polygon ) { - std::unique_ptr< QgsTriangle > triangle = std::make_unique< QgsTriangle >(); + auto triangle = std::make_unique< QgsTriangle >(); const QgsGeometry source = newGeom; if ( QgsPolygon *polygon = qgsgeometry_cast< QgsPolygon * >( newGeom.constGet() ) ) { @@ -3910,7 +3910,7 @@ QgsGeometry QgsGeometry::fromQPolygonF( const QPolygonF &polygon ) if ( polygon.isClosed() ) { - std::unique_ptr< QgsPolygon > poly = std::make_unique< QgsPolygon >(); + auto poly = std::make_unique< QgsPolygon >(); poly->setExteriorRing( ring.release() ); return QgsGeometry( std::move( poly ) ); } @@ -4006,7 +4006,7 @@ QgsGeometry QgsGeometry::smooth( const unsigned int iterations, const double off { const QgsMultiLineString *multiLine = qgsgeometry_cast< const QgsMultiLineString * >( geom.constGet() ); - std::unique_ptr< QgsMultiLineString > resultMultiline = std::make_unique< QgsMultiLineString> (); + auto resultMultiline = std::make_unique< QgsMultiLineString> (); resultMultiline->reserve( multiLine->numGeometries() ); for ( int i = 0; i < multiLine->numGeometries(); ++i ) { @@ -4025,7 +4025,7 @@ QgsGeometry QgsGeometry::smooth( const unsigned int iterations, const double off { const QgsMultiPolygon *multiPoly = qgsgeometry_cast< const QgsMultiPolygon * >( geom.constGet() ); - std::unique_ptr< QgsMultiPolygon > resultMultiPoly = std::make_unique< QgsMultiPolygon >(); + auto resultMultiPoly = std::make_unique< QgsMultiPolygon >(); resultMultiPoly->reserve( multiPoly->numGeometries() ); for ( int i = 0; i < multiPoly->numGeometries(); ++i ) { @@ -4044,7 +4044,7 @@ std::unique_ptr< QgsLineString > smoothCurve( const QgsLineString &line, const u const double offset, double squareDistThreshold, double maxAngleRads, bool isRing ) { - std::unique_ptr< QgsLineString > result = std::make_unique< QgsLineString >( line ); + auto result = std::make_unique< QgsLineString >( line ); QgsPointSequence outputLine; for ( unsigned int iteration = 0; iteration < iterations; ++iteration ) { @@ -4137,7 +4137,7 @@ std::unique_ptr QgsGeometry::smoothPolygon( const QgsPolygon &polygo { double maxAngleRads = maxAngle * M_PI / 180.0; double squareDistThreshold = minimumDistance > 0 ? minimumDistance * minimumDistance : -1; - std::unique_ptr< QgsPolygon > resultPoly = std::make_unique< QgsPolygon >(); + auto resultPoly = std::make_unique< QgsPolygon >(); resultPoly->setExteriorRing( smoothCurve( *( static_cast< const QgsLineString *>( polygon.exteriorRing() ) ), iterations, offset, squareDistThreshold, maxAngleRads, true ).release() ); diff --git a/src/core/geometry/qgsgeometrycollection.cpp b/src/core/geometry/qgsgeometrycollection.cpp index 40ab10de3c39..49c7d20760b6 100644 --- a/src/core/geometry/qgsgeometrycollection.cpp +++ b/src/core/geometry/qgsgeometrycollection.cpp @@ -1057,7 +1057,7 @@ void QgsGeometryCollection::swapXy() QgsGeometryCollection *QgsGeometryCollection::toCurveType() const { - std::unique_ptr< QgsGeometryCollection > newCollection( new QgsGeometryCollection() ); + auto newCollection = std::make_unique(); newCollection->reserve( mGeometries.size() ); for ( QgsAbstractGeometry *geom : mGeometries ) { @@ -1076,7 +1076,7 @@ const QgsAbstractGeometry *QgsGeometryCollection::simplifiedTypeRef() const QgsGeometryCollection *QgsGeometryCollection::simplifyByDistance( double tolerance ) const { - std::unique_ptr< QgsGeometryCollection > res = std::make_unique< QgsGeometryCollection >(); + auto res = std::make_unique< QgsGeometryCollection >(); res->reserve( mGeometries.size() ); for ( int i = 0; i < mGeometries.size(); ++i ) { diff --git a/src/core/geometry/qgsgeometryfactory.cpp b/src/core/geometry/qgsgeometryfactory.cpp index 27d362656351..f730239e3772 100644 --- a/src/core/geometry/qgsgeometryfactory.cpp +++ b/src/core/geometry/qgsgeometryfactory.cpp @@ -153,7 +153,7 @@ std::unique_ptr< QgsAbstractGeometry > QgsGeometryFactory::fromPointXY( const Qg std::unique_ptr QgsGeometryFactory::fromMultiPointXY( const QgsMultiPointXY &multipoint ) { - std::unique_ptr< QgsMultiPoint > mp = std::make_unique< QgsMultiPoint >(); + auto mp = std::make_unique< QgsMultiPoint >(); QgsMultiPointXY::const_iterator ptIt = multipoint.constBegin(); mp->reserve( multipoint.size() ); for ( ; ptIt != multipoint.constEnd(); ++ptIt ) @@ -171,7 +171,7 @@ std::unique_ptr QgsGeometryFactory::fromPolylineXY( const Q std::unique_ptr QgsGeometryFactory::fromMultiPolylineXY( const QgsMultiPolylineXY &multiline ) { - std::unique_ptr< QgsMultiLineString > mLine = std::make_unique< QgsMultiLineString >(); + auto mLine = std::make_unique< QgsMultiLineString >(); mLine->reserve( multiline.size() ); for ( int i = 0; i < multiline.size(); ++i ) { @@ -182,7 +182,7 @@ std::unique_ptr QgsGeometryFactory::fromMultiPolylineXY( con std::unique_ptr QgsGeometryFactory::fromPolygonXY( const QgsPolygonXY &polygon ) { - std::unique_ptr< QgsPolygon > poly = std::make_unique< QgsPolygon >(); + auto poly = std::make_unique< QgsPolygon >(); QVector holes; holes.reserve( polygon.size() ); @@ -206,7 +206,7 @@ std::unique_ptr QgsGeometryFactory::fromPolygonXY( const QgsPolygonX std::unique_ptr< QgsMultiPolygon > QgsGeometryFactory::fromMultiPolygonXY( const QgsMultiPolygonXY &multipoly ) { - std::unique_ptr< QgsMultiPolygon > mp = std::make_unique< QgsMultiPolygon >(); + auto mp = std::make_unique< QgsMultiPolygon >(); mp->reserve( multipoly.size() ); for ( int i = 0; i < multipoly.size(); ++i ) { @@ -231,7 +231,7 @@ std::unique_ptr QgsGeometryFactory::linestringFromPolyline( const *destY++ = src->y(); src++; } - std::unique_ptr< QgsLineString > line = std::make_unique< QgsLineString >( x, y ); + auto line = std::make_unique< QgsLineString >( x, y ); return line; } diff --git a/src/core/geometry/qgsgeos.cpp b/src/core/geometry/qgsgeos.cpp index 7bd2edcda5d3..e1f4a43f6d7b 100644 --- a/src/core/geometry/qgsgeos.cpp +++ b/src/core/geometry/qgsgeos.cpp @@ -1600,7 +1600,7 @@ std::unique_ptr QgsGeos::fromGeos( const GEOSGeometry *geos } case GEOS_MULTIPOINT: { - std::unique_ptr< QgsMultiPoint > multiPoint( new QgsMultiPoint() ); + auto multiPoint = std::make_unique(); int nParts = GEOSGetNumGeometries_r( context, geos ); multiPoint->reserve( nParts ); for ( int i = 0; i < nParts; ++i ) @@ -1618,7 +1618,7 @@ std::unique_ptr QgsGeos::fromGeos( const GEOSGeometry *geos } case GEOS_MULTILINESTRING: { - std::unique_ptr< QgsMultiLineString > multiLineString( new QgsMultiLineString() ); + auto multiLineString = std::make_unique(); int nParts = GEOSGetNumGeometries_r( context, geos ); multiLineString->reserve( nParts ); for ( int i = 0; i < nParts; ++i ) @@ -1633,7 +1633,7 @@ std::unique_ptr QgsGeos::fromGeos( const GEOSGeometry *geos } case GEOS_MULTIPOLYGON: { - std::unique_ptr< QgsMultiPolygon > multiPolygon( new QgsMultiPolygon() ); + auto multiPolygon = std::make_unique(); int nParts = GEOSGetNumGeometries_r( context, geos ); multiPolygon->reserve( nParts ); @@ -1649,7 +1649,7 @@ std::unique_ptr QgsGeos::fromGeos( const GEOSGeometry *geos } case GEOS_GEOMETRYCOLLECTION: { - std::unique_ptr< QgsGeometryCollection > geomCollection( new QgsGeometryCollection() ); + auto geomCollection = std::make_unique(); int nParts = GEOSGetNumGeometries_r( context, geos ); geomCollection->reserve( nParts ); for ( int i = 0; i < nParts; ++i ) @@ -1679,7 +1679,7 @@ std::unique_ptr QgsGeos::fromGeosPolygon( const GEOSGeometry *geos ) bool hasZ = ( nCoordDims == 3 ); bool hasM = ( ( nDims - nCoordDims ) == 1 ); - std::unique_ptr< QgsPolygon > polygon( new QgsPolygon() ); + auto polygon = std::make_unique(); const GEOSGeometry *ring = GEOSGetExteriorRing_r( context, geos ); if ( ring ) @@ -1740,7 +1740,7 @@ std::unique_ptr QgsGeos::sequenceToLinestring( const GEOSGeometry } } #endif - std::unique_ptr< QgsLineString > line( new QgsLineString( xOut, yOut, zOut, mOut ) ); + auto line = std::make_unique( xOut, yOut, zOut, mOut ); return line; } @@ -3144,7 +3144,7 @@ std::unique_ptr< QgsAbstractGeometry > QgsGeos::shortestLine( const QgsAbstractG return nullptr; } - std::unique_ptr< QgsLineString > line = std::make_unique< QgsLineString >(); + auto line = std::make_unique< QgsLineString >(); line->addVertex( QgsPoint( nx1, ny1 ) ); line->addVertex( QgsPoint( nx2, ny2 ) ); return line; @@ -3392,6 +3392,15 @@ static geos::unique_ptr _mergeLinestrings( const GEOSGeometry *line1, const GEOS GEOSGeometry *geoms[2] = { g1.release(), g2.release() }; geos::unique_ptr multiGeom( GEOSGeom_createCollection_r( context, GEOS_MULTILINESTRING, geoms, 2 ) ); geos::unique_ptr res( GEOSLineMerge_r( context, multiGeom.get() ) ); + + //keep the original orientation if the result has a start or end point in common with the original line + //and this point is not the start or the end point for both lines + double x1res, y1res, x2res, y2res; + if ( !_linestringEndpoints( res.get(), x1res, y1res, x2res, y2res ) ) + return nullptr; + if ( ( x1res == x2 && y1res == y2 ) || ( x2res == x1 && y2res == y1 ) ) + res.reset( GEOSReverse_r( context, res.get() ) ); + return res; } else @@ -3625,6 +3634,33 @@ geos::unique_ptr QgsGeos::reshapeLine( const GEOSGeometry *line, const GEOSGeome return nullptr; } + //keep the original orientation + bool reverseLine = false; + if ( isRing ) + { + //for closed linestring check clockwise/counter-clockwise + char isResultCCW = 0, isOriginCCW = 0; + if ( GEOSCoordSeq_isCCW_r( context, GEOSGeom_getCoordSeq_r( context, result.get() ), &isResultCCW ) && + GEOSCoordSeq_isCCW_r( context, GEOSGeom_getCoordSeq_r( context, line ), &isOriginCCW ) + ) + { + //reverse line if orientations are different + reverseLine = ( isOriginCCW == 1 && isResultCCW == 0 ) || ( isOriginCCW == 0 && isResultCCW == 1 ); + } + } + else + { + //for linestring, check if the result has a start or end point in common with the original line + double x1res, y1res, x2res, y2res; + if ( !_linestringEndpoints( result.get(), x1res, y1res, x2res, y2res ) ) + return nullptr; + geos::unique_ptr beginResultLineVertex = createGeosPointXY( x1res, y1res, false, 0, false, 0, 2, precision ); + geos::unique_ptr endResultLineVertex = createGeosPointXY( x2res, y2res, false, 0, false, 0, 2, precision ); + reverseLine = GEOSEquals_r( context, beginLineVertex.get(), endResultLineVertex.get() ) == 1 || GEOSEquals_r( context, endLineVertex.get(), beginResultLineVertex.get() ) == 1; + } + if ( reverseLine ) + result.reset( GEOSReverse_r( context, result.get() ) ); + return result; } diff --git a/src/core/geometry/qgsinternalgeometryengine.cpp b/src/core/geometry/qgsinternalgeometryengine.cpp index 8f0947189636..599554decd22 100644 --- a/src/core/geometry/qgsinternalgeometryengine.cpp +++ b/src/core/geometry/qgsinternalgeometryengine.cpp @@ -841,9 +841,9 @@ QgsGeometry QgsInternalGeometryEngine::densifyByDistance( double distance ) cons return QgsGeometry(); } - if ( QgsWkbTypes::geometryType( mGeometry->wkbType() ) == Qgis::GeometryType::Point ) + if ( QgsWkbTypes::geometryType( mGeometry->wkbType() ) == Qgis::GeometryType::Point || qgsDoubleNear( distance, 0 ) ) { - return QgsGeometry( mGeometry->clone() ); // point geometry, nothing to do + return QgsGeometry( mGeometry->clone() ); // point geometry (or distance ~= 0), nothing to do } if ( const QgsGeometryCollection *gc = qgsgeometry_cast< const QgsGeometryCollection *>( mGeometry ) ) @@ -1154,7 +1154,7 @@ QgsGeometry QgsInternalGeometryEngine::variableWidthBuffer( int segments, const // close ring points.append( points.at( 0 ) ); - std::unique_ptr< QgsPolygon > poly = std::make_unique< QgsPolygon >(); + auto poly = std::make_unique< QgsPolygon >(); poly->setExteriorRing( new QgsLineString( points ) ); if ( poly->area() > 0 ) parts << QgsGeometry( std::move( poly ) ); @@ -1518,7 +1518,7 @@ std::unique_ptr< QgsCurve > lineToCurve( const QgsCurve *curve, double distanceT } else if ( flatType == Qgis::WkbType::CompoundCurve ) { - std::unique_ptr< QgsCompoundCurve > out = std::make_unique< QgsCompoundCurve >(); + auto out = std::make_unique< QgsCompoundCurve >(); const QgsCompoundCurve *in = qgsgeometry_cast< const QgsCompoundCurve * >( curve ); for ( int i = 0; i < in->nCurves(); i ++ ) { @@ -1544,7 +1544,7 @@ std::unique_ptr< QgsCurve > lineToCurve( const QgsCurve *curve, double distanceT { const QgsLineString *lineString = qgsgeometry_cast< QgsLineString * >( curve ); - std::unique_ptr< QgsCompoundCurve > out = std::make_unique< QgsCompoundCurve >(); + auto out = std::make_unique< QgsCompoundCurve >(); /* Minimum number of edges, per quadrant, required to define an arc */ const unsigned int minQuadEdges = 2; @@ -1702,7 +1702,7 @@ std::unique_ptr< QgsCurve > lineToCurve( const QgsCurve *curve, double distanceT points.append( lineString->pointN( start ) ); points.append( lineString->pointN( ( start + end + 1 ) / 2 ) ); points.append( lineString->pointN( end + 1 ) ); - std::unique_ptr< QgsCircularString > curvedSegment = std::make_unique< QgsCircularString >(); + auto curvedSegment = std::make_unique< QgsCircularString >(); curvedSegment->setPoints( points ); out->addCurve( curvedSegment.release() ); } @@ -1747,7 +1747,7 @@ std::unique_ptr< QgsAbstractGeometry > convertGeometryToCurves( const QgsAbstrac { // polygon const QgsCurvePolygon *polygon = qgsgeometry_cast< const QgsCurvePolygon * >( geom ); - std::unique_ptr< QgsCurvePolygon > result = std::make_unique< QgsCurvePolygon>(); + auto result = std::make_unique< QgsCurvePolygon>(); result->setExteriorRing( lineToCurve( polygon->exteriorRing(), distanceTolerance, angleTolerance ).release() ); @@ -2017,7 +2017,7 @@ std::unique_ptr< QgsAbstractGeometry > triangularWavesPrivate( const QgsAbstract { // polygon const QgsPolygon *polygon = static_cast< const QgsPolygon * >( geom ); - std::unique_ptr< QgsPolygon > result = std::make_unique< QgsPolygon >(); + auto result = std::make_unique< QgsPolygon >(); result->setExteriorRing( triangularWavesAlongLine( static_cast< const QgsLineString * >( polygon->exteriorRing() ), wavelength, amplitude, strictWavelength ).release() ); @@ -2048,7 +2048,7 @@ std::unique_ptr< QgsAbstractGeometry > triangularWavesRandomizedPrivate( const Q { // polygon const QgsPolygon *polygon = static_cast< const QgsPolygon * >( geom ); - std::unique_ptr< QgsPolygon > result = std::make_unique< QgsPolygon >(); + auto result = std::make_unique< QgsPolygon >(); result->setExteriorRing( triangularWavesRandomizedAlongLine( static_cast< const QgsLineString * >( polygon->exteriorRing() ), minimumWavelength, maximumWavelength, minimumAmplitude, maximumAmplitude, uniformDist, mt ).release() ); @@ -2313,7 +2313,7 @@ std::unique_ptr< QgsAbstractGeometry > squareWavesPrivate( const QgsAbstractGeom { // polygon const QgsPolygon *polygon = static_cast< const QgsPolygon * >( geom ); - std::unique_ptr< QgsPolygon > result = std::make_unique< QgsPolygon >(); + auto result = std::make_unique< QgsPolygon >(); result->setExteriorRing( squareWavesAlongLine( static_cast< const QgsLineString * >( polygon->exteriorRing() ), wavelength, amplitude, strictWavelength ).release() ); @@ -2344,7 +2344,7 @@ std::unique_ptr< QgsAbstractGeometry > squareWavesRandomizedPrivate( const QgsAb { // polygon const QgsPolygon *polygon = static_cast< const QgsPolygon * >( geom ); - std::unique_ptr< QgsPolygon > result = std::make_unique< QgsPolygon >(); + auto result = std::make_unique< QgsPolygon >(); result->setExteriorRing( squareWavesRandomizedAlongLine( static_cast< const QgsLineString * >( polygon->exteriorRing() ), minimumWavelength, maximumWavelength, minimumAmplitude, maximumAmplitude, uniformDist, mt ).release() ); @@ -2468,7 +2468,7 @@ std::unique_ptr< QgsLineString > roundWavesAlongLine( const QgsLineString *line, double distanceToNextPointFromStartOfSegment = wavelength / 8; int bufferIndex = 1; - std::unique_ptr< QgsLineString > out = std::make_unique< QgsLineString >(); + auto out = std::make_unique< QgsLineString >(); double segmentAngleRadians = 0; double remainingDistance = totalLength; @@ -2596,7 +2596,7 @@ std::unique_ptr< QgsLineString > roundWavesRandomizedAlongLine( const QgsLineStr double distanceToNextPointFromStartOfSegment = wavelength / 8; int bufferIndex = 1; - std::unique_ptr< QgsLineString > out = std::make_unique< QgsLineString >(); + auto out = std::make_unique< QgsLineString >(); double segmentAngleRadians = 0; @@ -2729,7 +2729,7 @@ std::unique_ptr< QgsAbstractGeometry > roundWavesPrivate( const QgsAbstractGeome { // polygon const QgsPolygon *polygon = static_cast< const QgsPolygon * >( geom ); - std::unique_ptr< QgsPolygon > result = std::make_unique< QgsPolygon >(); + auto result = std::make_unique< QgsPolygon >(); result->setExteriorRing( roundWavesAlongLine( static_cast< const QgsLineString * >( polygon->exteriorRing() ), wavelength, amplitude, strictWavelength ).release() ); @@ -2760,7 +2760,7 @@ std::unique_ptr< QgsAbstractGeometry > roundWavesRandomizedPrivate( const QgsAbs { // polygon const QgsPolygon *polygon = static_cast< const QgsPolygon * >( geom ); - std::unique_ptr< QgsPolygon > result = std::make_unique< QgsPolygon >(); + auto result = std::make_unique< QgsPolygon >(); result->setExteriorRing( roundWavesRandomizedAlongLine( static_cast< const QgsLineString * >( polygon->exteriorRing() ), minimumWavelength, maximumWavelength, minimumAmplitude, maximumAmplitude, uniformDist, mt ).release() ); @@ -2875,7 +2875,7 @@ std::unique_ptr< QgsMultiLineString > dashPatternAlongLine( const QgsLineString double prevX = *x++; double prevY = *y++; - std::unique_ptr< QgsMultiLineString > result = std::make_unique< QgsMultiLineString >(); + auto result = std::make_unique< QgsMultiLineString >(); QVector< double > outX; QVector< double > outY; @@ -3112,7 +3112,7 @@ std::unique_ptr< QgsAbstractGeometry > applyDashPatternPrivate( const QgsAbstrac { // polygon const QgsPolygon *polygon = static_cast< const QgsPolygon * >( geom ); - std::unique_ptr< QgsMultiLineString > result = std::make_unique< QgsMultiLineString >(); + auto result = std::make_unique< QgsMultiLineString >(); std::unique_ptr< QgsMultiLineString > exteriorParts = dashPatternAlongLine( static_cast< const QgsLineString * >( polygon->exteriorRing() ), pattern, startRule, endRule, adjustment, patternOffset ); for ( int i = 0; i < exteriorParts->numGeometries(); ++i ) diff --git a/src/core/geometry/qgsmulticurve.cpp b/src/core/geometry/qgsmulticurve.cpp index e69886fdb7f9..bd48691a9946 100644 --- a/src/core/geometry/qgsmulticurve.cpp +++ b/src/core/geometry/qgsmulticurve.cpp @@ -211,7 +211,7 @@ bool QgsMultiCurve::insertGeometry( QgsAbstractGeometry *g, int index ) QgsMultiCurve *QgsMultiCurve::simplifyByDistance( double tolerance ) const { - std::unique_ptr< QgsMultiCurve > res = std::make_unique< QgsMultiCurve >(); + auto res = std::make_unique< QgsMultiCurve >(); res->reserve( mGeometries.size() ); for ( int i = 0; i < mGeometries.size(); ++i ) { @@ -236,7 +236,7 @@ QgsMultiCurve *QgsMultiCurve::reversed() const QgsAbstractGeometry *QgsMultiCurve::boundary() const { - std::unique_ptr< QgsMultiPoint > multiPoint( new QgsMultiPoint() ); + auto multiPoint = std::make_unique(); multiPoint->reserve( mGeometries.size() * 2 ); for ( int i = 0; i < mGeometries.size(); ++i ) { diff --git a/src/core/geometry/qgsmultilinestring.cpp b/src/core/geometry/qgsmultilinestring.cpp index 847476922fa1..4cad6ef7adc6 100644 --- a/src/core/geometry/qgsmultilinestring.cpp +++ b/src/core/geometry/qgsmultilinestring.cpp @@ -226,7 +226,7 @@ bool QgsMultiLineString::insertGeometry( QgsAbstractGeometry *g, int index ) QgsMultiLineString *QgsMultiLineString::simplifyByDistance( double tolerance ) const { - std::unique_ptr< QgsMultiLineString > result = std::make_unique< QgsMultiLineString >(); + auto result = std::make_unique< QgsMultiLineString >(); result->reserve( mGeometries.size() ); for ( int i = 0; i < mGeometries.size(); ++i ) { @@ -253,7 +253,7 @@ bool QgsMultiLineString::wktOmitChildType() const QgsMultiLineString *QgsMultiLineString::measuredLine( double start, double end ) const { - std::unique_ptr< QgsMultiLineString > result = std::make_unique< QgsMultiLineString >(); + auto result = std::make_unique< QgsMultiLineString >(); if ( isEmpty() ) { result->convertTo( QgsWkbTypes::addM( mWkbType ) ); diff --git a/src/core/geometry/qgsmultipoint.h b/src/core/geometry/qgsmultipoint.h index c3c7461e27ae..39e6da4610f1 100644 --- a/src/core/geometry/qgsmultipoint.h +++ b/src/core/geometry/qgsmultipoint.h @@ -160,7 +160,7 @@ class CORE_EXPORT QgsMultiPoint: public QgsGeometryCollection break; } - std::unique_ptr< QgsPoint > point = std::make_unique< QgsPoint >( x, y ); + auto point = std::make_unique< QgsPoint >( x, y ); if ( elementSize > 2 ) { element = PySequence_GetItem( value, 2 ); diff --git a/src/core/geometry/qgsmultipolygon.cpp b/src/core/geometry/qgsmultipolygon.cpp index bfe1138fec9c..8387bbad0417 100644 --- a/src/core/geometry/qgsmultipolygon.cpp +++ b/src/core/geometry/qgsmultipolygon.cpp @@ -238,7 +238,7 @@ bool QgsMultiPolygon::insertGeometry( QgsAbstractGeometry *g, int index ) QgsMultiPolygon *QgsMultiPolygon::simplifyByDistance( double tolerance ) const { - std::unique_ptr< QgsMultiPolygon > res = std::make_unique< QgsMultiPolygon >(); + auto res = std::make_unique< QgsMultiPolygon >(); res->reserve( mGeometries.size() ); for ( int i = 0; i < mGeometries.size(); ++i ) { @@ -260,7 +260,7 @@ QgsMultiSurface *QgsMultiPolygon::toCurveType() const QgsAbstractGeometry *QgsMultiPolygon::boundary() const { - std::unique_ptr< QgsMultiLineString > multiLine( new QgsMultiLineString() ); + auto multiLine = std::make_unique(); multiLine->reserve( mGeometries.size() ); for ( int i = 0; i < mGeometries.size(); ++i ) { diff --git a/src/core/geometry/qgsmultisurface.cpp b/src/core/geometry/qgsmultisurface.cpp index 2a20b6424dbf..35d0031d9fe3 100644 --- a/src/core/geometry/qgsmultisurface.cpp +++ b/src/core/geometry/qgsmultisurface.cpp @@ -221,7 +221,7 @@ bool QgsMultiSurface::insertGeometry( QgsAbstractGeometry *g, int index ) QgsAbstractGeometry *QgsMultiSurface::boundary() const { - std::unique_ptr< QgsMultiCurve > multiCurve( new QgsMultiCurve() ); + auto multiCurve = std::make_unique(); multiCurve->reserve( mGeometries.size() ); for ( int i = 0; i < mGeometries.size(); ++i ) { @@ -239,7 +239,7 @@ QgsAbstractGeometry *QgsMultiSurface::boundary() const QgsMultiSurface *QgsMultiSurface::simplifyByDistance( double tolerance ) const { - std::unique_ptr< QgsMultiSurface > res = std::make_unique< QgsMultiSurface >(); + auto res = std::make_unique< QgsMultiSurface >(); res->reserve( mGeometries.size() ); for ( int i = 0; i < mGeometries.size(); ++i ) { diff --git a/src/core/geometry/qgspolygon.cpp b/src/core/geometry/qgspolygon.cpp index 64a1a0d71ef3..15f32f7eceb5 100644 --- a/src/core/geometry/qgspolygon.cpp +++ b/src/core/geometry/qgspolygon.cpp @@ -101,7 +101,7 @@ bool QgsPolygon::fromWkb( QgsConstWkbPtr &wkbPtr ) wkbPtr >> nRings; for ( int i = 0; i < nRings; ++i ) { - std::unique_ptr< QgsLineString > line( new QgsLineString() ); + auto line = std::make_unique(); line->fromWkbPoints( ringType, wkbPtr ); /*if ( !line->isRing() ) { diff --git a/src/core/geometry/qgspolyhedralsurface.cpp b/src/core/geometry/qgspolyhedralsurface.cpp index ce418562e4a0..2d2eb74b1318 100644 --- a/src/core/geometry/qgspolyhedralsurface.cpp +++ b/src/core/geometry/qgspolyhedralsurface.cpp @@ -375,7 +375,7 @@ double QgsPolyhedralSurface::perimeter() const QgsAbstractGeometry *QgsPolyhedralSurface::boundary() const { - std::unique_ptr< QgsMultiLineString > multiLine( new QgsMultiLineString() ); + auto multiLine = std::make_unique(); multiLine->reserve( mPatches.size() ); for ( QgsPolygon *polygon : mPatches ) { @@ -413,7 +413,7 @@ QgsPolyhedralSurface *QgsPolyhedralSurface::snappedToGrid( double hSpacing, doub return nullptr; } - std::unique_ptr gridifiedPatch = std::make_unique(); + auto gridifiedPatch = std::make_unique(); gridifiedPatch->setExteriorRing( exteriorRing.release() ); //interior rings @@ -439,7 +439,7 @@ QgsPolyhedralSurface *QgsPolyhedralSurface::simplifyByDistance( double tolerance if ( isEmpty() ) return nullptr; - std::unique_ptr< QgsPolyhedralSurface > simplifiedGeom = std::make_unique< QgsPolyhedralSurface >(); + auto simplifiedGeom = std::make_unique< QgsPolyhedralSurface >(); for ( QgsPolygon *polygon : mPatches ) { std::unique_ptr polygonSimplified( polygon->simplifyByDistance( tolerance ) ); @@ -896,7 +896,7 @@ void QgsPolyhedralSurface::swapXy() QgsMultiSurface *QgsPolyhedralSurface::toCurveType() const { - std::unique_ptr multiSurface = std::make_unique< QgsMultiSurface >(); + auto multiSurface = std::make_unique< QgsMultiSurface >(); multiSurface->reserve( mPatches.size() ); for ( const QgsPolygon *polygon : std::as_const( mPatches ) ) { @@ -928,7 +928,7 @@ bool QgsPolyhedralSurface::transform( QgsAbstractGeometryTransformer *transforme QgsMultiPolygon *QgsPolyhedralSurface::toMultiPolygon() const { - std::unique_ptr multiPolygon = std::make_unique< QgsMultiPolygon >(); + auto multiPolygon = std::make_unique< QgsMultiPolygon >(); multiPolygon->reserve( mPatches.size() ); for ( const QgsPolygon *polygon : std::as_const( mPatches ) ) { diff --git a/src/core/geometry/qgsquadrilateral.cpp b/src/core/geometry/qgsquadrilateral.cpp index b00440ccd31a..47f3810ee312 100644 --- a/src/core/geometry/qgsquadrilateral.cpp +++ b/src/core/geometry/qgsquadrilateral.cpp @@ -385,7 +385,7 @@ QgsPointSequence QgsQuadrilateral::points() const QgsPolygon *QgsQuadrilateral::toPolygon( bool force2D ) const { - std::unique_ptr polygon = std::make_unique< QgsPolygon >(); + auto polygon = std::make_unique< QgsPolygon >(); if ( !isValid() ) { return polygon.release(); @@ -398,7 +398,7 @@ QgsPolygon *QgsQuadrilateral::toPolygon( bool force2D ) const QgsLineString *QgsQuadrilateral::toLineString( bool force2D ) const { - std::unique_ptr ext = std::make_unique< QgsLineString>(); + auto ext = std::make_unique< QgsLineString>(); if ( !isValid() ) { return ext.release(); diff --git a/src/core/geometry/qgsrectangle.h b/src/core/geometry/qgsrectangle.h index ec335968a2f9..8ad0a0383dd8 100644 --- a/src/core/geometry/qgsrectangle.h +++ b/src/core/geometry/qgsrectangle.h @@ -18,16 +18,18 @@ #ifndef QGSRECTANGLE_H #define QGSRECTANGLE_H -#include "qgis_core.h" -#include "qgis.h" #include #include #include +#include "qgis_core.h" +#include "qgis.h" +#include "qgspointxy.h" + + class QString; class QRectF; class QgsBox3D; -#include "qgspointxy.h" /** diff --git a/src/core/geometry/qgsregularpolygon.cpp b/src/core/geometry/qgsregularpolygon.cpp index 28f2883ad20f..1cb494081464 100644 --- a/src/core/geometry/qgsregularpolygon.cpp +++ b/src/core/geometry/qgsregularpolygon.cpp @@ -182,7 +182,7 @@ QgsPointSequence QgsRegularPolygon::points() const QgsPolygon *QgsRegularPolygon::toPolygon() const { - std::unique_ptr polygon( new QgsPolygon() ); + auto polygon = std::make_unique(); if ( isEmpty() ) { return polygon.release(); @@ -195,7 +195,7 @@ QgsPolygon *QgsRegularPolygon::toPolygon() const QgsLineString *QgsRegularPolygon::toLineString() const { - std::unique_ptr ext( new QgsLineString() ); + auto ext = std::make_unique(); if ( isEmpty() ) { return ext.release(); diff --git a/src/core/geometry/qgstriangle.cpp b/src/core/geometry/qgstriangle.cpp index 2b758c521d1d..d134f133e2b8 100644 --- a/src/core/geometry/qgstriangle.cpp +++ b/src/core/geometry/qgstriangle.cpp @@ -251,7 +251,7 @@ QgsPolygon *QgsTriangle::surfaceToPolygon() const QgsCurvePolygon *QgsTriangle::toCurveType() const { - std::unique_ptr curvePolygon( new QgsCurvePolygon() ); + auto curvePolygon = std::make_unique(); curvePolygon->setExteriorRing( mExteriorRing->clone() ); return curvePolygon.release(); diff --git a/src/core/geometry/qgstriangulatedsurface.cpp b/src/core/geometry/qgstriangulatedsurface.cpp index 38f2a8a8e024..3eb7b1871df4 100644 --- a/src/core/geometry/qgstriangulatedsurface.cpp +++ b/src/core/geometry/qgstriangulatedsurface.cpp @@ -227,7 +227,7 @@ QgsTriangulatedSurface *QgsTriangulatedSurface::snappedToGrid( double hSpacing, return nullptr; } - std::unique_ptr gridifiedTriangle = std::make_unique(); + auto gridifiedTriangle = std::make_unique(); gridifiedTriangle->setExteriorRing( exteriorRing.release() ); surface->addPatch( gridifiedTriangle.release() ); } diff --git a/src/core/gps/qgsgpsdetector.cpp b/src/core/gps/qgsgpsdetector.cpp index 829ca3ed9221..561b1f7304c7 100644 --- a/src/core/gps/qgsgpsdetector.cpp +++ b/src/core/gps/qgsgpsdetector.cpp @@ -175,7 +175,7 @@ void QgsGpsDetector::advance() else { #if defined( HAVE_QTSERIALPORT ) - std::unique_ptr< QSerialPort > serial = std::make_unique< QSerialPort >( mPortList.at( mPortIndex ).first ); + auto serial = std::make_unique< QSerialPort >( mPortList.at( mPortIndex ).first ); serial->setBaudRate( mBaudList[ mBaudIndex ] ); diff --git a/src/core/gps/qgsgpslogger.cpp b/src/core/gps/qgsgpslogger.cpp index 641406900927..5d2598c5dc30 100644 --- a/src/core/gps/qgsgpslogger.cpp +++ b/src/core/gps/qgsgpslogger.cpp @@ -153,7 +153,7 @@ QgsGeometry QgsGpsLogger::currentGeometry( Qgis::WkbType type, QString &error ) { QgsGeometry g; - std::unique_ptr ringWgs84( new QgsLineString( captureListWgs84 ) ); + auto ringWgs84 = std::make_unique( captureListWgs84 ); if ( !is3D ) ringWgs84->dropZValue(); if ( !isMeasure ) @@ -168,7 +168,7 @@ QgsGeometry QgsGpsLogger::currentGeometry( Qgis::WkbType type, QString &error ) else if ( geometryType == Qgis::GeometryType::Polygon ) { ringWgs84->close(); - std::unique_ptr polygon( new QgsPolygon() ); + auto polygon = std::make_unique(); polygon->setExteriorRing( ringWgs84.release() ); g = QgsGeometry( polygon.release() ); diff --git a/src/core/labeling/qgslabelingengine.cpp b/src/core/labeling/qgslabelingengine.cpp index 714462d56198..c4dd1c6d348c 100644 --- a/src/core/labeling/qgslabelingengine.cpp +++ b/src/core/labeling/qgslabelingengine.cpp @@ -488,7 +488,7 @@ void QgsLabelingEngine::drawLabels( QgsRenderContext &context, const QString &la } QgsExpressionContextScope *symbolScope = new QgsExpressionContextScope(); - std::unique_ptr< QgsExpressionContextScopePopper > symbolScopePopper = std::make_unique< QgsExpressionContextScopePopper >( context.expressionContext(), symbolScope ); + auto symbolScopePopper = std::make_unique< QgsExpressionContextScopePopper >( context.expressionContext(), symbolScope ); // draw label backgrounds for ( pal::LabelPosition *label : std::as_const( mLabels ) ) diff --git a/src/core/labeling/qgslabelsearchtree.cpp b/src/core/labeling/qgslabelsearchtree.cpp index 10015c0635ff..530f56fdafb4 100644 --- a/src/core/labeling/qgslabelsearchtree.cpp +++ b/src/core/labeling/qgslabelsearchtree.cpp @@ -106,8 +106,8 @@ bool QgsLabelSearchTree::insertLabel( pal::LabelPosition *labelPos, QgsFeatureId const QgsRectangle bounds( xMin, yMin, xMax, yMax ); const QgsGeometry labelGeometry( QgsGeometry::fromPolygonXY( QVector() << cornerPoints ) ); - std::unique_ptr< QgsLabelPosition > newEntry = std::make_unique< QgsLabelPosition >( featureId, -labelPos->getAlpha() * 180 / M_PI + mMapSettings.rotation(), cornerPoints, bounds, - labelPos->getWidth(), labelPos->getHeight(), layerName, labeltext, labelfont, labelPos->getUpsideDown(), diagram, pinned, providerId, labelGeometry, isUnplaced ); + auto newEntry = std::make_unique< QgsLabelPosition >( featureId, -labelPos->getAlpha() * 180 / M_PI + mMapSettings.rotation(), cornerPoints, bounds, + labelPos->getWidth(), labelPos->getHeight(), layerName, labeltext, labelfont, labelPos->getUpsideDown(), diagram, pinned, providerId, labelGeometry, isUnplaced ); newEntry->groupedLabelId = uniqueLinkedId; mSpatialIndex.insert( newEntry.get(), bounds ); @@ -130,7 +130,7 @@ bool QgsLabelSearchTree::insertCallout( const QgsCalloutPosition &position ) const QPointF origin = position.origin(); const QPointF destination = position.destination(); - std::unique_ptr< QgsCalloutPosition > newEntry = std::make_unique< QgsCalloutPosition >( position ); + auto newEntry = std::make_unique< QgsCalloutPosition >( position ); mCalloutIndex.insert( newEntry.get(), QgsRectangle( origin.x(), origin.y(), origin.x(), origin.y() ) ); mCalloutIndex.insert( newEntry.get(), QgsRectangle( destination.x(), destination.y(), destination.x(), destination.y() ) ); diff --git a/src/core/labeling/qgspallabeling.cpp b/src/core/labeling/qgspallabeling.cpp index fed2f7af2d9a..6487d0236293 100644 --- a/src/core/labeling/qgspallabeling.cpp +++ b/src/core/labeling/qgspallabeling.cpp @@ -2104,6 +2104,34 @@ std::unique_ptr QgsPalLayerSettings::registerFeatureWithDetails parseDropShadow( context ); } + if ( dataDefinedValues.contains( QgsPalLayerSettings::Property::TabStopDistance ) ) + { + QList tabPositions; + if ( dataDefinedValues.value( QgsPalLayerSettings::Property::TabStopDistance ).userType() == QMetaType::Type::QVariantList ) + { + const QVariantList parts = dataDefinedValues.value( QgsPalLayerSettings::Property::TabStopDistance ).toList(); + for ( const QVariant &part : parts ) + { + tabPositions.append( QgsTextFormat::Tab( part.toDouble() ) ); + } + evaluatedFormat.setTabPositions( tabPositions ); + } + else if ( dataDefinedValues.value( QgsPalLayerSettings::Property::TabStopDistance ).userType() == QMetaType::Type::QStringList ) + { + const QStringList parts = dataDefinedValues.value( QgsPalLayerSettings::Property::TabStopDistance ).toStringList(); + for ( const QString &part : parts ) + { + tabPositions.append( QgsTextFormat::Tab( part.toDouble() ) ); + } + evaluatedFormat.setTabPositions( tabPositions ); + } + else + { + evaluatedFormat.setTabPositions( tabPositions ); + evaluatedFormat.setTabStopDistance( dataDefinedValues.value( QgsPalLayerSettings::Property::TabStopDistance ).toDouble() ); + } + } + evaluatedFormat.setFont( labelFont ); // undo scaling by symbology reference scale, as this would have been applied in the previous call to QgsTextRenderer::sizeToPixel and we risk // double-applying it if we don't re-adjust, since all the text format metric calculations assume an unscaled format font size is present @@ -2150,6 +2178,7 @@ std::unique_ptr QgsPalLayerSettings::registerFeatureWithDetails { capitalization = static_cast< Qgis::Capitalization >( mFormat.font().capitalization() ); } + // data defined font capitalization? if ( mDataDefinedProperties.isActive( QgsPalLayerSettings::Property::FontCase ) ) { @@ -2897,7 +2926,7 @@ std::unique_ptr QgsPalLayerSettings::registerFeatureWithDetails } // feature to the layer - std::unique_ptr< QgsTextLabelFeature > labelFeature = std::make_unique< QgsTextLabelFeature>( feature.id(), std::move( geos_geom_clone ), labelSize ); + auto labelFeature = std::make_unique< QgsTextLabelFeature>( feature.id(), std::move( geos_geom_clone ), labelSize ); labelFeature->setAnchorPosition( anchorPosition ); labelFeature->setFeature( feature ); labelFeature->setSymbol( symbol ); @@ -3182,7 +3211,7 @@ std::unique_ptr QgsPalLayerSettings::registerObstacleFeature( c return nullptr; // invalid geometry // feature to the layer - std::unique_ptr< QgsLabelFeature > obstacleFeature = std::make_unique< QgsLabelFeature >( f.id(), std::move( geos_geom_clone ), QSizeF( 0, 0 ) ); + auto obstacleFeature = std::make_unique< QgsLabelFeature >( f.id(), std::move( geos_geom_clone ), QSizeF( 0, 0 ) ); obstacleFeature->setFeature( f ); QgsLabelObstacleSettings os = mObstacleSettings; @@ -3684,6 +3713,15 @@ void QgsPalLayerSettings::parseTextFormatting( QgsRenderContext &context ) evalAutoWrapLength = exprVal.toInt(); } + if ( mDataDefinedProperties.isActive( QgsPalLayerSettings::Property::TabStopDistance ) ) + { + exprVal = mDataDefinedProperties.value( QgsPalLayerSettings::Property::TabStopDistance, context.expressionContext() ); + if ( !QgsVariantUtils::isNull( exprVal ) ) + { + dataDefinedValues.insert( QgsPalLayerSettings::Property::TabStopDistance, exprVal ); + } + } + // data defined multiline height? dataDefinedValEval( DDDouble, QgsPalLayerSettings::Property::MultiLineHeight, exprVal, context.expressionContext() ); @@ -4411,6 +4449,36 @@ void QgsPalLabeling::dataDefinedTextFormatting( QgsPalLayerSettings &tmpLyr, tmpLyr.setFormat( format ); } + if ( ddValues.contains( QgsPalLayerSettings::Property::TabStopDistance ) ) + { + QgsTextFormat format = tmpLyr.format(); + QList tabPositions; + if ( ddValues.value( QgsPalLayerSettings::Property::TabStopDistance ).userType() == QMetaType::Type::QVariantList ) + { + const QVariantList parts = ddValues.value( QgsPalLayerSettings::Property::TabStopDistance ).toList(); + for ( const QVariant &part : parts ) + { + tabPositions.append( QgsTextFormat::Tab( part.toDouble() ) ); + } + format.setTabPositions( tabPositions ); + } + else if ( ddValues.value( QgsPalLayerSettings::Property::TabStopDistance ).userType() == QMetaType::Type::QStringList ) + { + const QStringList parts = ddValues.value( QgsPalLayerSettings::Property::TabStopDistance ).toStringList(); + for ( const QString &part : parts ) + { + tabPositions.append( QgsTextFormat::Tab( part.toDouble() ) ); + } + format.setTabPositions( tabPositions ); + } + else + { + format.setTabPositions( tabPositions ); + format.setTabStopDistance( ddValues.value( QgsPalLayerSettings::Property::TabStopDistance ).toDouble() ); + } + tmpLyr.setFormat( format ); + } + if ( ddValues.contains( QgsPalLayerSettings::Property::MultiLineAlignment ) ) { tmpLyr.multilineAlign = static_cast< Qgis::LabelMultiLineAlignment >( ddValues.value( QgsPalLayerSettings::Property::MultiLineAlignment ).toInt() ); @@ -4449,7 +4517,6 @@ void QgsPalLabeling::dataDefinedTextFormatting( QgsPalLayerSettings &tmpLyr, { tmpLyr.lineSettings().setReverseDirectionSymbol( ddValues.value( QgsPalLayerSettings::Property::DirSymbReverse ).toBool() ); } - } } diff --git a/src/core/labeling/qgsrulebasedlabeling.cpp b/src/core/labeling/qgsrulebasedlabeling.cpp index 4c0e3885494a..55a7cf8cf9f2 100644 --- a/src/core/labeling/qgsrulebasedlabeling.cpp +++ b/src/core/labeling/qgsrulebasedlabeling.cpp @@ -31,8 +31,10 @@ QgsVectorLayerLabelProvider *QgsRuleBasedLabelProvider::createProvider( QgsVecto bool QgsRuleBasedLabelProvider::prepare( QgsRenderContext &context, QSet &attributeNames ) { - for ( QgsVectorLayerLabelProvider *provider : std::as_const( mSubProviders ) ) - provider->setEngine( mEngine ); + for ( const auto &subprovider : std::as_const( mSubProviders ) ) + { + subprovider.second->setEngine( mEngine ); + } // populate sub-providers mRules->rootRule()->prepare( context, attributeNames, mSubProviders ); @@ -48,8 +50,10 @@ QList QgsRuleBasedLabelProvider::registerFeature( const QgsFe QList QgsRuleBasedLabelProvider::subProviders() { QList lst; - for ( QgsVectorLayerLabelProvider *subprovider : std::as_const( mSubProviders ) ) - lst << subprovider; + for ( const auto &subprovider : std::as_const( mSubProviders ) ) + { + lst << subprovider.second; + } return lst; } @@ -229,14 +233,18 @@ QgsRuleBasedLabeling::Rule *QgsRuleBasedLabeling::Rule::findRuleByKey( const QSt return nullptr; } -QgsRuleBasedLabeling::Rule *QgsRuleBasedLabeling::Rule::clone() const +QgsRuleBasedLabeling::Rule *QgsRuleBasedLabeling::Rule::clone( bool resetRuleKey ) const { QgsPalLayerSettings *s = mSettings.get() ? new QgsPalLayerSettings( *mSettings ) : nullptr; Rule *newrule = new Rule( s, mMaximumScale, mMinimumScale, mFilterExp, mDescription ); newrule->setActive( mIsActive ); + if ( !resetRuleKey ) + newrule->setRuleKey( ruleKey() ); + // clone children for ( Rule *rule : mChildren ) - newrule->appendChild( rule->clone() ); + newrule->appendChild( rule->clone( resetRuleKey ) ); + return newrule; } @@ -312,14 +320,25 @@ QDomElement QgsRuleBasedLabeling::Rule::save( QDomDocument &doc, const QgsReadWr return ruleElem; } -void QgsRuleBasedLabeling::Rule::createSubProviders( QgsVectorLayer *layer, QgsRuleBasedLabeling::RuleToProviderMap &subProviders, QgsRuleBasedLabelProvider *provider ) +void QgsRuleBasedLabeling::Rule::createSubProviders( QgsVectorLayer *layer, QgsRuleBasedLabeling::RuleToProviderVec &subProviders, QgsRuleBasedLabelProvider *provider ) { if ( mSettings ) { // add provider! QgsVectorLayerLabelProvider *p = provider->createProvider( layer, mRuleKey, false, mSettings.get() ); - delete subProviders.value( this, nullptr ); - subProviders[this] = p; + auto it = std::find_if( subProviders.begin(), subProviders.end(), + [this]( const std::pair &item ) + { + return item.first == this; + } ); + + if ( it != subProviders.end() ) + { + delete it->second; + subProviders.erase( it ); + } + + subProviders.push_back( {this, p} ); } // call recursively @@ -329,15 +348,24 @@ void QgsRuleBasedLabeling::Rule::createSubProviders( QgsVectorLayer *layer, QgsR } } -void QgsRuleBasedLabeling::Rule::prepare( QgsRenderContext &context, QSet &attributeNames, QgsRuleBasedLabeling::RuleToProviderMap &subProviders ) +void QgsRuleBasedLabeling::Rule::prepare( QgsRenderContext &context, QSet &attributeNames, QgsRuleBasedLabeling::RuleToProviderVec &subProviders ) { if ( mSettings ) { - QgsVectorLayerLabelProvider *p = subProviders[this]; - if ( !p->prepare( context, attributeNames ) ) + auto it = std::find_if( subProviders.begin(), subProviders.end(), + [this]( const std::pair &item ) { - subProviders.remove( this ); - delete p; + return item.first == this; + } ); + + if ( it != subProviders.end() ) + { + QgsVectorLayerLabelProvider *p = it->second; + if ( !p->prepare( context, attributeNames ) ) + { + subProviders.erase( it ); + delete p; + } } } @@ -354,7 +382,7 @@ void QgsRuleBasedLabeling::Rule::prepare( QgsRenderContext &context, QSet > QgsRuleBasedLabeling::Rule::registerFeature( const QgsFeature &feature, QgsRenderContext &context, QgsRuleBasedLabeling::RuleToProviderMap &subProviders, const QgsGeometry &obstacleGeometry, const QgsSymbol *symbol ) +std::tuple< QgsRuleBasedLabeling::Rule::RegisterResult, QList< QgsLabelFeature * > > QgsRuleBasedLabeling::Rule::registerFeature( const QgsFeature &feature, QgsRenderContext &context, QgsRuleBasedLabeling::RuleToProviderVec &subProviders, const QgsGeometry &obstacleGeometry, const QgsSymbol *symbol ) { QList< QgsLabelFeature * > labels; if ( !isFilterOK( feature, context ) @@ -366,9 +394,15 @@ std::tuple< QgsRuleBasedLabeling::Rule::RegisterResult, QList< QgsLabelFeature * bool registered = false; // do we have active subprovider for the rule? - if ( subProviders.contains( this ) && mIsActive ) + auto it = std::find_if( subProviders.begin(), subProviders.end(), + [this]( const std::pair &item ) + { + return item.first == this; + } ); + + if ( it != subProviders.end() && mIsActive ) { - labels.append( subProviders[this]->registerFeature( feature, context, obstacleGeometry, symbol ) ); + labels.append( it->second->registerFeature( feature, context, obstacleGeometry, symbol ) ); registered = true; } @@ -609,4 +643,3 @@ void QgsRuleBasedLabeling::multiplyOpacity( double opacityFactor ) } } - diff --git a/src/core/labeling/qgsrulebasedlabeling.h b/src/core/labeling/qgsrulebasedlabeling.h index f7e9b9355660..c5808e378287 100644 --- a/src/core/labeling/qgsrulebasedlabeling.h +++ b/src/core/labeling/qgsrulebasedlabeling.h @@ -43,7 +43,10 @@ class CORE_EXPORT QgsRuleBasedLabeling : public QgsAbstractVectorLayerLabeling public: class Rule; typedef QList RuleList; - typedef QMap RuleToProviderMap; + private: + typedef std::vector> RuleToProviderVec; + + public: /** * \ingroup core @@ -238,8 +241,12 @@ class CORE_EXPORT QgsRuleBasedLabeling : public QgsAbstractVectorLayerLabeling */ QgsRuleBasedLabeling::Rule *findRuleByKey( const QString &key ) SIP_SKIP; - //! clone this rule, return new instance - QgsRuleBasedLabeling::Rule *clone() const SIP_FACTORY; + /** + * clone this rule + * \param resetRuleKey TRUE if this rule and its children rule key need to be reset to new unique ones. + * \returns new instance + */ + QgsRuleBasedLabeling::Rule *clone( bool resetRuleKey = true ) const SIP_FACTORY; // load / save @@ -261,7 +268,7 @@ class CORE_EXPORT QgsRuleBasedLabeling : public QgsAbstractVectorLayerLabeling * add providers * \note not available in Python bindings */ - void createSubProviders( QgsVectorLayer *layer, RuleToProviderMap &subProviders, QgsRuleBasedLabelProvider *provider ) SIP_SKIP; + void createSubProviders( QgsVectorLayer *layer, RuleToProviderVec &subProviders, QgsRuleBasedLabelProvider *provider ) SIP_SKIP; /** * append rule keys of descendants that contain valid settings (i.e. they will be sub-providers) @@ -273,7 +280,7 @@ class CORE_EXPORT QgsRuleBasedLabeling : public QgsAbstractVectorLayerLabeling * call prepare() on sub-providers and populate attributeNames * \note not available in Python bindings */ - void prepare( QgsRenderContext &context, QSet &attributeNames, RuleToProviderMap &subProviders ) SIP_SKIP; + void prepare( QgsRenderContext &context, QSet &attributeNames, RuleToProviderVec &subProviders ) SIP_SKIP; /** * Register individual features @@ -284,7 +291,7 @@ class CORE_EXPORT QgsRuleBasedLabeling : public QgsAbstractVectorLayerLabeling * * \note not available in Python bindings */ - std::tuple< RegisterResult, QList< QgsLabelFeature * > > registerFeature( const QgsFeature &feature, QgsRenderContext &context, RuleToProviderMap &subProviders, const QgsGeometry &obstacleGeometry = QgsGeometry(), const QgsSymbol *symbol = nullptr ) SIP_SKIP; + std::tuple< RegisterResult, QList< QgsLabelFeature * > > registerFeature( const QgsFeature &feature, QgsRenderContext &context, RuleToProviderVec &subProviders, const QgsGeometry &obstacleGeometry = QgsGeometry(), const QgsSymbol *symbol = nullptr ) SIP_SKIP; /** * Returns TRUE if this rule or any of its children requires advanced composition effects @@ -391,8 +398,6 @@ class CORE_EXPORT QgsRuleBasedLabeling : public QgsAbstractVectorLayerLabeling protected: std::unique_ptr mRootRule; - - }; #ifndef SIP_RUN @@ -425,7 +430,7 @@ class CORE_EXPORT QgsRuleBasedLabelProvider : public QgsVectorLayerLabelProvider //! owned copy std::unique_ptr mRules; //! label providers are owned by labeling engine - QgsRuleBasedLabeling::RuleToProviderMap mSubProviders; + std::vector> mSubProviders; }; #endif diff --git a/src/core/labeling/qgsvectorlayerlabelprovider.cpp b/src/core/labeling/qgsvectorlayerlabelprovider.cpp index 393b7a7b0603..01b291737d33 100644 --- a/src/core/labeling/qgsvectorlayerlabelprovider.cpp +++ b/src/core/labeling/qgsvectorlayerlabelprovider.cpp @@ -257,7 +257,7 @@ QgsGeometry QgsVectorLayerLabelProvider::getPointObstacleGeometry( QgsFeature &f bX << bounds.left() << bounds.right() << bounds.right() << bounds.left(); QVector< double > bY; bY << bounds.top() << bounds.top() << bounds.bottom() << bounds.bottom(); - std::unique_ptr< QgsLineString > boundLineString = std::make_unique< QgsLineString >( bX, bY ); + auto boundLineString = std::make_unique< QgsLineString >( bX, bY ); //then transform back to map units //TODO - remove when labeling is refactored to use screen units @@ -292,7 +292,7 @@ QgsGeometry QgsVectorLayerLabelProvider::getPointObstacleGeometry( QgsFeature &f return QgsGeometry(); } - std::unique_ptr< QgsPolygon > obstaclePolygon = std::make_unique< QgsPolygon >(); + auto obstaclePolygon = std::make_unique< QgsPolygon >(); obstaclePolygon->setExteriorRing( boundLineString.release() ); if ( isMultiPoint ) diff --git a/src/core/labeling/rules/qgslabelingenginerule_impl.cpp b/src/core/labeling/rules/qgslabelingenginerule_impl.cpp index f2c9193c3973..cf97f92679a4 100644 --- a/src/core/labeling/rules/qgslabelingenginerule_impl.cpp +++ b/src/core/labeling/rules/qgslabelingenginerule_impl.cpp @@ -244,7 +244,7 @@ QgsLabelingEngineRuleMinimumDistanceLabelToFeature::~QgsLabelingEngineRuleMinimu QgsLabelingEngineRuleMinimumDistanceLabelToFeature *QgsLabelingEngineRuleMinimumDistanceLabelToFeature::clone() const { - std::unique_ptr< QgsLabelingEngineRuleMinimumDistanceLabelToFeature> res = std::make_unique< QgsLabelingEngineRuleMinimumDistanceLabelToFeature >(); + auto res = std::make_unique< QgsLabelingEngineRuleMinimumDistanceLabelToFeature >(); copyCommonProperties( res.get() ); return res.release(); } @@ -288,7 +288,7 @@ QgsLabelingEngineRuleMaximumDistanceLabelToFeature::~QgsLabelingEngineRuleMaximu QgsLabelingEngineRuleMaximumDistanceLabelToFeature *QgsLabelingEngineRuleMaximumDistanceLabelToFeature::clone() const { - std::unique_ptr< QgsLabelingEngineRuleMaximumDistanceLabelToFeature > res = std::make_unique< QgsLabelingEngineRuleMaximumDistanceLabelToFeature >(); + auto res = std::make_unique< QgsLabelingEngineRuleMaximumDistanceLabelToFeature >(); copyCommonProperties( res.get() ); return res.release(); } @@ -328,7 +328,7 @@ QgsLabelingEngineRuleMinimumDistanceLabelToLabel::~QgsLabelingEngineRuleMinimumD QgsLabelingEngineRuleMinimumDistanceLabelToLabel *QgsLabelingEngineRuleMinimumDistanceLabelToLabel::clone() const { - std::unique_ptr< QgsLabelingEngineRuleMinimumDistanceLabelToLabel> res = std::make_unique< QgsLabelingEngineRuleMinimumDistanceLabelToLabel >(); + auto res = std::make_unique< QgsLabelingEngineRuleMinimumDistanceLabelToLabel >(); copyCommonProperties( res.get() ); res->mLabeledLayer = mLabeledLayer; res->mTargetLayer = mTargetLayer; @@ -496,7 +496,7 @@ QgsLabelingEngineRuleAvoidLabelOverlapWithFeature::~QgsLabelingEngineRuleAvoidLa QgsLabelingEngineRuleAvoidLabelOverlapWithFeature *QgsLabelingEngineRuleAvoidLabelOverlapWithFeature::clone() const { - std::unique_ptr< QgsLabelingEngineRuleAvoidLabelOverlapWithFeature> res = std::make_unique< QgsLabelingEngineRuleAvoidLabelOverlapWithFeature >(); + auto res = std::make_unique< QgsLabelingEngineRuleAvoidLabelOverlapWithFeature >(); copyCommonProperties( res.get() ); res->mLabeledLayer = mLabeledLayer; res->mTargetLayer = mTargetLayer; diff --git a/src/core/layertree/qgslayertreegroup.cpp b/src/core/layertree/qgslayertreegroup.cpp index a67f0e501885..1e80288f36b0 100644 --- a/src/core/layertree/qgslayertreegroup.cpp +++ b/src/core/layertree/qgslayertreegroup.cpp @@ -503,7 +503,7 @@ QgsGroupLayer *QgsLayerTreeGroup::convertToGroupLayer( const QgsGroupLayer::Laye if ( !mGroupLayer.layerId.isEmpty() ) return nullptr; - std::unique_ptr< QgsGroupLayer > res = std::make_unique< QgsGroupLayer >( name(), options ); + auto res = std::make_unique< QgsGroupLayer >( name(), options ); mGroupLayer.setLayer( res.get() ); updateGroupLayers(); diff --git a/src/core/layertree/qgslayertreemodel.cpp b/src/core/layertree/qgslayertreemodel.cpp index 139e31365c00..b5bfd3688381 100644 --- a/src/core/layertree/qgslayertreemodel.cpp +++ b/src/core/layertree/qgslayertreemodel.cpp @@ -617,7 +617,7 @@ void QgsLayerTreeModel::setLegendFilter( const QgsMapSettings *settings, bool us { if ( settings && settings->hasValidSettings() ) { - std::unique_ptr< QgsLayerTreeFilterSettings > filterSettings = std::make_unique< QgsLayerTreeFilterSettings >( *settings ); + auto filterSettings = std::make_unique< QgsLayerTreeFilterSettings >( *settings ); if ( !useExtent ) // only expressions { diff --git a/src/core/layertree/qgslayertreemodellegendnode.cpp b/src/core/layertree/qgslayertreemodellegendnode.cpp index ac6709580df3..483d101cd9d5 100644 --- a/src/core/layertree/qgslayertreemodellegendnode.cpp +++ b/src/core/layertree/qgslayertreemodellegendnode.cpp @@ -490,7 +490,7 @@ QgsRenderContext *QgsLayerTreeModelLegendNode::createTemporaryRenderContext() co return nullptr; // setup temporary render context - std::unique_ptr context = std::make_unique( ); + auto context = std::make_unique( ); context->setScaleFactor( dpi / 25.4 ); context->setRendererScale( scale ); context->setMapToPixel( QgsMapToPixel( mupp ) ); diff --git a/src/core/layertree/qgslayertreeregistrybridge.cpp b/src/core/layertree/qgslayertreeregistrybridge.cpp index 0d568cfa14e9..8b07cc0be17e 100644 --- a/src/core/layertree/qgslayertreeregistrybridge.cpp +++ b/src/core/layertree/qgslayertreeregistrybridge.cpp @@ -28,7 +28,7 @@ QgsLayerTreeRegistryBridge::QgsLayerTreeRegistryBridge( QgsLayerTreeGroup *root, , mRegistryRemovingLayers( false ) , mEnabled( true ) , mNewLayersVisible( true ) - , mInsertionPoint( root, 0 ) + , mInsertionPointGroup( root ) { connect( mProject, &QgsProject::legendLayersAdded, this, &QgsLayerTreeRegistryBridge::layersAdded ); connect( mProject, qOverload( &QgsProject::layersWillBeRemoved ), this, &QgsLayerTreeRegistryBridge::layersWillBeRemoved ); @@ -39,13 +39,20 @@ QgsLayerTreeRegistryBridge::QgsLayerTreeRegistryBridge( QgsLayerTreeGroup *root, void QgsLayerTreeRegistryBridge::setLayerInsertionPoint( QgsLayerTreeGroup *parentGroup, int index ) { - mInsertionPoint.group = parentGroup; - mInsertionPoint.position = index; + mInsertionPointGroup = parentGroup; + mInsertionPointPosition = index; } void QgsLayerTreeRegistryBridge::setLayerInsertionPoint( const InsertionPoint &insertionPoint ) { - mInsertionPoint = insertionPoint; + mInsertionPointGroup = insertionPoint.group; + mInsertionPointPosition = insertionPoint.position; +} + +QgsLayerTreeRegistryBridge::InsertionPoint QgsLayerTreeRegistryBridge::layerInsertionPoint() const +{ + QgsLayerTreeGroup *group = mInsertionPointGroup.isNull() ? mRoot : mInsertionPointGroup.data(); + return InsertionPoint( group, mInsertionPointPosition ); } void QgsLayerTreeRegistryBridge::layersAdded( const QList &layers ) @@ -57,13 +64,24 @@ void QgsLayerTreeRegistryBridge::layersAdded( const QList &layers for ( QgsMapLayer *layer : layers ) { QgsLayerTreeLayer *nodeLayer; - if ( mInsertionMethod == Qgis::LayerTreeInsertionMethod::OptimalInInsertionGroup ) + switch ( mInsertionMethod ) { - nodeLayer = QgsLayerTreeUtils::insertLayerAtOptimalPlacement( mInsertionPoint.group, layer ); - } - else - { - nodeLayer = new QgsLayerTreeLayer( layer ); + case Qgis::LayerTreeInsertionMethod::OptimalInInsertionGroup: + { + QgsLayerTreeGroup *targetGroup = mInsertionPointGroup; + if ( !targetGroup ) + targetGroup = mRoot; + + nodeLayer = QgsLayerTreeUtils::insertLayerAtOptimalPlacement( targetGroup, layer ); + break; + } + + case Qgis::LayerTreeInsertionMethod::AboveInsertionPoint: + case Qgis::LayerTreeInsertionMethod::TopOfTree: + { + nodeLayer = new QgsLayerTreeLayer( layer ); + break; + } } nodeLayer->setItemVisibilityChecked( mNewLayersVisible ); @@ -82,8 +100,13 @@ void QgsLayerTreeRegistryBridge::layersAdded( const QList &layers switch ( mInsertionMethod ) { case Qgis::LayerTreeInsertionMethod::AboveInsertionPoint: - mInsertionPoint.group->insertChildNodes( mInsertionPoint.position, nodes ); - break; + if ( QgsLayerTreeGroup *group = mInsertionPointGroup ) + { + group->insertChildNodes( mInsertionPointPosition, nodes ); + break; + } + // if no group for the insertion point, then insert into root instead + [[fallthrough]]; case Qgis::LayerTreeInsertionMethod::TopOfTree: mRoot->insertChildNodes( 0, nodes ); break; diff --git a/src/core/layertree/qgslayertreeregistrybridge.h b/src/core/layertree/qgslayertreeregistrybridge.h index 1644634e24d7..3281a9a4331b 100644 --- a/src/core/layertree/qgslayertreeregistrybridge.h +++ b/src/core/layertree/qgslayertreeregistrybridge.h @@ -18,12 +18,13 @@ #include #include +#include #include "qgis_core.h" #include "qgis_sip.h" #include "qgis.h" +#include "qgslayertreegroup.h" -class QgsLayerTreeGroup; class QgsLayerTreeNode; class QgsMapLayer; class QgsProject; @@ -57,7 +58,7 @@ class CORE_EXPORT QgsLayerTreeRegistryBridge : public QObject InsertionPoint( QgsLayerTreeGroup *group, int position ) : group( group ), position( position ) {} - QgsLayerTreeGroup *group = nullptr; + QgsLayerTreeGroup *group; int position = 0; }; @@ -84,6 +85,12 @@ class CORE_EXPORT QgsLayerTreeRegistryBridge : public QObject */ void setLayerInsertionPoint( const InsertionPoint &insertionPoint ); + /** + * Returns the insertion point used to add layers to the tree + * \since QGIS 3.42 + */ + InsertionPoint layerInsertionPoint() const; + /** * Sets the insertion \a method used to add layers to the tree * \since QGIS 3.30 @@ -120,7 +127,9 @@ class CORE_EXPORT QgsLayerTreeRegistryBridge : public QObject bool mEnabled; bool mNewLayersVisible; - InsertionPoint mInsertionPoint; + QPointer< QgsLayerTreeGroup > mInsertionPointGroup; + int mInsertionPointPosition = 0; + Qgis::LayerTreeInsertionMethod mInsertionMethod = Qgis::LayerTreeInsertionMethod::AboveInsertionPoint; }; diff --git a/src/core/layout/qgsabstractreportsection.cpp b/src/core/layout/qgsabstractreportsection.cpp index 52967e688226..923caed5770c 100644 --- a/src/core/layout/qgsabstractreportsection.cpp +++ b/src/core/layout/qgsabstractreportsection.cpp @@ -118,7 +118,7 @@ bool QgsAbstractReportSection::readXml( const QDomElement &element, const QDomDo if ( !headerElement.isNull() ) { const QDomElement headerLayoutElem = headerElement.firstChild().toElement(); - std::unique_ptr< QgsLayout > header = std::make_unique< QgsLayout >( project() ); + auto header = std::make_unique< QgsLayout >( project() ); header->readXml( headerLayoutElem, doc, context ); mHeader = std::move( header ); } @@ -126,7 +126,7 @@ bool QgsAbstractReportSection::readXml( const QDomElement &element, const QDomDo if ( !footerElement.isNull() ) { const QDomElement footerLayoutElem = footerElement.firstChild().toElement(); - std::unique_ptr< QgsLayout > footer = std::make_unique< QgsLayout >( project() ); + auto footer = std::make_unique< QgsLayout >( project() ); footer->readXml( footerLayoutElem, doc, context ); mFooter = std::move( footer ); } diff --git a/src/core/layout/qgscompositionconverter.cpp b/src/core/layout/qgscompositionconverter.cpp index c5e3c41d836f..710fed0228e1 100644 --- a/src/core/layout/qgscompositionconverter.cpp +++ b/src/core/layout/qgscompositionconverter.cpp @@ -129,7 +129,7 @@ std::unique_ptr< QgsPrintLayout > QgsCompositionConverter::createLayoutFromCompo const QDomElement parentElement = composerElement.parentNode().toElement(); - std::unique_ptr< QgsPrintLayout > layout = std::make_unique< QgsPrintLayout >( project ); + auto layout = std::make_unique< QgsPrintLayout >( project ); layout->undoStack()->blockCommands( true ); layout->mCustomProperties.readXml( composerElement ); @@ -170,7 +170,7 @@ std::unique_ptr< QgsPrintLayout > QgsCompositionConverter::createLayoutFromCompo // Not necessary: double y2 = snapLineElem.attribute( QStringLiteral( "y2" ) ).toDouble(); const Qt::Orientation orientation( x1 == x2 ? Qt::Orientation::Vertical : Qt::Orientation::Horizontal ); const QgsLayoutMeasurement position( x1 == x2 ? x1 : y1 ); - std::unique_ptr< QgsLayoutGuide > guide = std::make_unique< QgsLayoutGuide >( orientation, position, page ); + auto guide = std::make_unique< QgsLayoutGuide >( orientation, position, page ); layout->guides().addGuide( guide.release() ); } } @@ -936,7 +936,7 @@ bool QgsCompositionConverter::readMapXml( QgsLayoutItemMap *layoutItem, const QD for ( int i = 0; i < mapOverviewNodeList.size(); ++i ) { const QDomElement mapOverviewElem = mapOverviewNodeList.at( i ).toElement(); - std::unique_ptr mapOverview( new QgsLayoutItemMapOverview( mapOverviewElem.attribute( QStringLiteral( "name" ) ), layoutItem ) ); + auto mapOverview = std::make_unique( mapOverviewElem.attribute( QStringLiteral( "name" ) ), layoutItem ); mapOverview->readXml( mapOverviewElem, doc, context ); const QString frameMapId = mapOverviewElem.attribute( QStringLiteral( "frameMap" ), QStringLiteral( "-1" ) ); if ( frameMapId != QLatin1String( "-1" ) && mapId2Uuid.contains( frameMapId ) ) @@ -1128,8 +1128,8 @@ bool QgsCompositionConverter::readScaleBarXml( QgsLayoutItemScaleBar *layoutItem layoutItem->alternateFillSymbol()->setColor( QColor( itemElem.attribute( QStringLiteral( "brush2Color" ), QStringLiteral( "#ffffff" ) ) ) ); } - std::unique_ptr< QgsLineSymbol > lineSymbol = std::make_unique< QgsLineSymbol >(); - std::unique_ptr< QgsSimpleLineSymbolLayer > lineSymbolLayer = std::make_unique< QgsSimpleLineSymbolLayer >(); + auto lineSymbol = std::make_unique< QgsLineSymbol >(); + auto lineSymbolLayer = std::make_unique< QgsSimpleLineSymbolLayer >(); lineSymbolLayer->setWidth( itemElem.attribute( QStringLiteral( "outlineWidth" ), QStringLiteral( "0.3" ) ).toDouble() ); lineSymbolLayer->setWidthUnit( Qgis::RenderUnit::Millimeters ); lineSymbolLayer->setPenJoinStyle( QgsSymbolLayerUtils::decodePenJoinStyle( itemElem.attribute( QStringLiteral( "lineJoinStyle" ), QStringLiteral( "miter" ) ) ) ); diff --git a/src/core/layout/qgslayout.cpp b/src/core/layout/qgslayout.cpp index d9100873f0ce..ba305b947d37 100644 --- a/src/core/layout/qgslayout.cpp +++ b/src/core/layout/qgslayout.cpp @@ -98,7 +98,7 @@ QgsLayout *QgsLayout::clone() const QDomElement elem = writeXml( currentDoc, context ); currentDoc.appendChild( elem ); - std::unique_ptr< QgsLayout > newLayout = std::make_unique< QgsLayout >( mProject ); + auto newLayout = std::make_unique< QgsLayout >( mProject ); bool ok = false; newLayout->loadFromTemplate( currentDoc, context, true, &ok ); if ( !ok ) @@ -768,7 +768,7 @@ QgsLayoutItemGroup *QgsLayout::groupItems( const QList &items ) } mUndoStack->beginMacro( tr( "Group Items" ) ); - std::unique_ptr< QgsLayoutItemGroup > itemGroup( new QgsLayoutItemGroup( this ) ); + auto itemGroup = std::make_unique( this ); for ( QgsLayoutItem *item : items ) { itemGroup->addItem( item ); @@ -776,7 +776,7 @@ QgsLayoutItemGroup *QgsLayout::groupItems( const QList &items ) QgsLayoutItemGroup *returnGroup = itemGroup.get(); addLayoutItem( itemGroup.release() ); - std::unique_ptr< QgsLayoutItemGroupUndoCommand > c( new QgsLayoutItemGroupUndoCommand( QgsLayoutItemGroupUndoCommand::Grouped, returnGroup, this, tr( "Group Items" ) ) ); + auto c = std::make_unique( QgsLayoutItemGroupUndoCommand::Grouped, returnGroup, this, tr( "Group Items" ) ); mUndoStack->push( c.release() ); mProject->setDirty( true ); @@ -797,7 +797,7 @@ QList QgsLayout::ungroupItems( QgsLayoutItemGroup *group ) mUndoStack->beginMacro( tr( "Ungroup Items" ) ); // Call this before removing group items so it can keep note // of contents - std::unique_ptr< QgsLayoutItemGroupUndoCommand > c( new QgsLayoutItemGroupUndoCommand( QgsLayoutItemGroupUndoCommand::Ungrouped, group, this, tr( "Ungroup Items" ) ) ); + auto c = std::make_unique( QgsLayoutItemGroupUndoCommand::Ungrouped, group, this, tr( "Ungroup Items" ) ); mUndoStack->push( c.release() ); mProject->setDirty( true ); diff --git a/src/core/layout/qgslayoutexporter.cpp b/src/core/layout/qgslayoutexporter.cpp index f364465510ac..c1f17fde1263 100644 --- a/src/core/layout/qgslayoutexporter.cpp +++ b/src/core/layout/qgslayoutexporter.cpp @@ -716,7 +716,6 @@ QgsLayoutExporter::ExportResult QgsLayoutExporter::exportToPdf( const QString &f details.layerOrder = geospatialPdfExporter->layerOrder(); details.layerTreeGroupOrder = geospatialPdfExporter->layerTreeGroupOrder(); details.includeFeatures = settings.includeGeoPdfFeatures; - details.useOgcBestPracticeFormatGeoreferencing = settings.useOgcBestPracticeFormatGeoreferencing; details.useIso32000ExtensionFormatGeoreferencing = settings.useIso32000ExtensionFormatGeoreferencing; if ( !geospatialPdfExporter->finalize( pdfComponents, filePath, details ) ) diff --git a/src/core/layout/qgslayoutexporter.h b/src/core/layout/qgslayoutexporter.h index 2557c990ba43..ec128e5e9ea2 100644 --- a/src/core/layout/qgslayoutexporter.h +++ b/src/core/layout/qgslayoutexporter.h @@ -381,6 +381,8 @@ class CORE_EXPORT QgsLayoutExporter * format is a mess!). * * If PdfExportSettings::writeGeoPdf is FALSE than this option has no effect. + * + * \deprecated QGIS 3.42. This parameter has no longer any effect. Only ISO 32000 georeferencing is handled. */ bool useOgcBestPracticeFormatGeoreferencing = false; diff --git a/src/core/layout/qgslayoutguidecollection.cpp b/src/core/layout/qgslayoutguidecollection.cpp index 736f3f939508..8a9cd00d90a1 100644 --- a/src/core/layout/qgslayoutguidecollection.cpp +++ b/src/core/layout/qgslayoutguidecollection.cpp @@ -457,7 +457,7 @@ void QgsLayoutGuideCollection::applyGuidesToAllOtherPages( int sourcePage ) if ( p == sourcePage ) continue; - std::unique_ptr< QgsLayoutGuide> newGuide( new QgsLayoutGuide( guide->orientation(), guide->position(), mPageCollection->page( p ) ) ); + auto newGuide = std::make_unique( guide->orientation(), guide->position(), mPageCollection->page( p ) ); newGuide->setLayout( mLayout ); if ( newGuide->item()->isVisible() ) { @@ -579,7 +579,7 @@ bool QgsLayoutGuideCollection::readXml( const QDomElement &e, const QDomDocument double pos = element.attribute( QStringLiteral( "position" ), QStringLiteral( "0" ) ).toDouble(); Qgis::LayoutUnit unit = QgsUnitTypes::decodeLayoutUnit( element.attribute( QStringLiteral( "units" ) ) ); int page = element.attribute( QStringLiteral( "page" ), QStringLiteral( "0" ) ).toInt(); - std::unique_ptr< QgsLayoutGuide > guide( new QgsLayoutGuide( orientation, QgsLayoutMeasurement( pos, unit ), mPageCollection->page( page ) ) ); + auto guide = std::make_unique( orientation, QgsLayoutMeasurement( pos, unit ), mPageCollection->page( page ) ); guide->update(); addGuide( guide.release() ); } diff --git a/src/core/layout/qgslayoutitemattributetable.cpp b/src/core/layout/qgslayoutitemattributetable.cpp index 8d1c6905aac6..5c6d685cd2d7 100644 --- a/src/core/layout/qgslayoutitemattributetable.cpp +++ b/src/core/layout/qgslayoutitemattributetable.cpp @@ -614,7 +614,7 @@ bool QgsLayoutItemAttributeTable::getTableContents( QgsLayoutTableContents &cont else { // Lets assume it's an expression - std::unique_ptr< QgsExpression > expression = std::make_unique< QgsExpression >( column.attribute() ); + auto expression = std::make_unique< QgsExpression >( column.attribute() ); context.lastScope()->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "row_number" ), counter + 1, true ) ); expression->prepare( &context ); QVariant value = expression->evaluate( &context ); diff --git a/src/core/layout/qgslayoutitemelevationprofile.cpp b/src/core/layout/qgslayoutitemelevationprofile.cpp index b35728bc9c72..338c7ae83eb4 100644 --- a/src/core/layout/qgslayoutitemelevationprofile.cpp +++ b/src/core/layout/qgslayoutitemelevationprofile.cpp @@ -56,6 +56,7 @@ class QgsLayoutItemElevationProfilePlot : public Qgs2DPlot { if ( mRenderer ) { + rc.setShowSelection( false ); // don't render selected features with selected rendering rc.painter()->translate( plotArea.left(), plotArea.top() ); mRenderer->render( rc, plotArea.width(), plotArea.height(), xMinimum() * xScale, xMaximum() * xScale, yMinimum(), yMaximum() ); rc.painter()->translate( -plotArea.left(), -plotArea.top() ); diff --git a/src/core/layout/qgslayoutitemmap.cpp b/src/core/layout/qgslayoutitemmap.cpp index 23a19ba76599..25fdccf89111 100644 --- a/src/core/layout/qgslayoutitemmap.cpp +++ b/src/core/layout/qgslayoutitemmap.cpp @@ -189,7 +189,7 @@ void QgsLayoutItemMap::setScale( double scaleDenominator, bool forceUpdate ) { double currentScaleDenominator = scale(); - if ( qgsDoubleNear( scaleDenominator, currentScaleDenominator ) || qgsDoubleNear( scaleDenominator, 0.0 ) ) + if ( qgsDoubleNear( scaleDenominator, currentScaleDenominator ) || qgsDoubleNear( scaleDenominator, 0.0 ) || qgsDoubleNear( currentScaleDenominator, 0 ) ) { return; } @@ -205,8 +205,12 @@ void QgsLayoutItemMap::setScale( double scaleDenominator, bool forceUpdate ) QgsScaleCalculator calculator; calculator.setMapUnits( crs().mapUnits() ); calculator.setDpi( 25.4 ); //QGraphicsView units are mm - scaleRatio = scaleDenominator / calculator.calculate( mExtent, rect().width() ); - mExtent.scale( scaleRatio ); + const double newScale = calculator.calculate( mExtent, rect().width() ); + if ( !qgsDoubleNear( newScale, 0 ) ) + { + scaleRatio = scaleDenominator / newScale; + mExtent.scale( scaleRatio ); + } } invalidateCache(); @@ -476,8 +480,12 @@ void QgsLayoutItemMap::zoomContent( double factor, QPointF point ) QgsScaleCalculator calculator; calculator.setMapUnits( crs().mapUnits() ); calculator.setDpi( 25.4 ); //QGraphicsView units are mm - double scaleRatio = scale() / calculator.calculate( mExtent, rect().width() ); - mExtent.scale( scaleRatio ); + const double newScale = calculator.calculate( mExtent, rect().width() ); + if ( !qgsDoubleNear( newScale, 0 ) ) + { + const double scaleRatio = scale() / newScale ; + mExtent.scale( scaleRatio ); + } } //recalculate data defined scale and extents, since that may override zoom @@ -1891,8 +1899,8 @@ QgsExpressionContext QgsLayoutItemMap::createExpressionContext() const const double mapScale = scale(); scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "map_scale" ), mapScale, true ) ); - scope->setVariable( QStringLiteral( "zoom_level" ), QgsVectorTileUtils::scaleToZoomLevel( mapScale, 0, 99999 ), true ); - scope->setVariable( QStringLiteral( "vector_tile_zoom" ), QgsVectorTileUtils::scaleToZoom( mapScale ), true ); + scope->setVariable( QStringLiteral( "zoom_level" ), !qgsDoubleNear( mapScale, 0 ) ? QgsVectorTileUtils::scaleToZoomLevel( mapScale, 0, 99999 ) : 0, true ); + scope->setVariable( QStringLiteral( "vector_tile_zoom" ), !qgsDoubleNear( mapScale, 0 ) ? QgsVectorTileUtils::scaleToZoom( mapScale ) : 0, true ); QgsRectangle currentExtent( extent() ); scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "map_extent" ), QVariant::fromValue( QgsGeometry::fromRect( currentExtent ) ), true ) ); @@ -2942,7 +2950,7 @@ void QgsLayoutItemMap::updateAtlasFeature() double newScale = calc.calculate( newExtent, rect().width() ); newExtent.scale( originalScale / newScale ); } - else if ( mAtlasScalingMode == Predefined ) + else if ( mAtlasScalingMode == Predefined && !qgsDoubleNear( originalScale, 0 ) ) { // choose one of the predefined scales double newWidth = originalExtent.width(); @@ -2963,7 +2971,10 @@ void QgsLayoutItemMap::updateAtlasFeature() //scale newExtent to match desired map scale //this is required for geographic coordinate systems, where the scale varies by extent - double newScale = calc.calculate( newExtent, rect().width() ); + const double newScale = calc.calculate( newExtent, rect().width() ); + if ( qgsDoubleNear( newScale, 0 ) ) + continue; + newExtent.scale( scales[i] / newScale ); if ( ( newExtent.width() >= bounds.width() ) && ( newExtent.height() >= bounds.height() ) ) diff --git a/src/core/layout/qgslayoutitemscalebar.cpp b/src/core/layout/qgslayoutitemscalebar.cpp index 2937e1299a95..214af305c5e0 100644 --- a/src/core/layout/qgslayoutitemscalebar.cpp +++ b/src/core/layout/qgslayoutitemscalebar.cpp @@ -1253,8 +1253,8 @@ bool QgsLayoutItemScaleBar::readPropertiesFromElement( const QDomElement &itemEl if ( !foundLineSymbol ) { // old project compatibility - std::unique_ptr< QgsLineSymbol > lineSymbol = std::make_unique< QgsLineSymbol >(); - std::unique_ptr< QgsSimpleLineSymbolLayer > lineSymbolLayer = std::make_unique< QgsSimpleLineSymbolLayer >(); + auto lineSymbol = std::make_unique< QgsLineSymbol >(); + auto lineSymbolLayer = std::make_unique< QgsSimpleLineSymbolLayer >(); lineSymbolLayer->setWidth( itemElem.attribute( QStringLiteral( "outlineWidth" ), QStringLiteral( "0.3" ) ).toDouble() ); lineSymbolLayer->setWidthUnit( Qgis::RenderUnit::Millimeters ); lineSymbolLayer->setPenJoinStyle( QgsSymbolLayerUtils::decodePenJoinStyle( itemElem.attribute( QStringLiteral( "lineJoinStyle" ), QStringLiteral( "miter" ) ) ) ); @@ -1346,8 +1346,8 @@ bool QgsLayoutItemScaleBar::readPropertiesFromElement( const QDomElement &itemEl if ( !foundFillSymbol1 ) { // old project compatibility - std::unique_ptr< QgsFillSymbol > fillSymbol = std::make_unique< QgsFillSymbol >(); - std::unique_ptr< QgsSimpleFillSymbolLayer > fillSymbolLayer = std::make_unique< QgsSimpleFillSymbolLayer >(); + auto fillSymbol = std::make_unique< QgsFillSymbol >(); + auto fillSymbolLayer = std::make_unique< QgsSimpleFillSymbolLayer >(); fillSymbolLayer->setStrokeStyle( Qt::NoPen ); //fill color @@ -1397,8 +1397,8 @@ bool QgsLayoutItemScaleBar::readPropertiesFromElement( const QDomElement &itemEl if ( !foundFillSymbol2 ) { // old project compatibility - std::unique_ptr< QgsFillSymbol > fillSymbol = std::make_unique< QgsFillSymbol >(); - std::unique_ptr< QgsSimpleFillSymbolLayer > fillSymbolLayer = std::make_unique< QgsSimpleFillSymbolLayer >(); + auto fillSymbol = std::make_unique< QgsFillSymbol >(); + auto fillSymbolLayer = std::make_unique< QgsSimpleFillSymbolLayer >(); fillSymbolLayer->setStrokeStyle( Qt::NoPen ); //fill color 2 diff --git a/src/core/layout/qgslayoutmanager.cpp b/src/core/layout/qgslayoutmanager.cpp index d4330287f486..1b66a2252f3b 100644 --- a/src/core/layout/qgslayoutmanager.cpp +++ b/src/core/layout/qgslayoutmanager.cpp @@ -210,7 +210,7 @@ bool QgsLayoutManager::readXml( const QDomElement &element, const QDomDocument & const QString layoutName = layoutNodes.at( i ).toElement().attribute( QStringLiteral( "name" ) ); QgsScopedRuntimeProfile profile( layoutName, QStringLiteral( "projectload" ) ); - std::unique_ptr< QgsPrintLayout > l = std::make_unique< QgsPrintLayout >( mProject ); + auto l = std::make_unique< QgsPrintLayout >( mProject ); l->undoStack()->blockCommands( true ); if ( !l->readLayoutXml( layoutNodes.at( i ).toElement(), doc, context ) ) { @@ -231,7 +231,7 @@ bool QgsLayoutManager::readXml( const QDomElement &element, const QDomDocument & const QString layoutName = reportNodes.at( i ).toElement().attribute( QStringLiteral( "name" ) ); QgsScopedRuntimeProfile profile( layoutName, QStringLiteral( "projectload" ) ); - std::unique_ptr< QgsReport > r = std::make_unique< QgsReport >( mProject ); + auto r = std::make_unique< QgsReport >( mProject ); if ( !r->readLayoutXml( reportNodes.at( i ).toElement(), doc, context ) ) { result = false; diff --git a/src/core/layout/qgslayoutmultiframe.cpp b/src/core/layout/qgslayoutmultiframe.cpp index 310916bcd803..13c11ab81a65 100644 --- a/src/core/layout/qgslayoutmultiframe.cpp +++ b/src/core/layout/qgslayoutmultiframe.cpp @@ -403,7 +403,7 @@ void QgsLayoutMultiFrame::handlePageChange() for ( int i = lastItemPage + 1; i < mLayout->pageCollection()->pageCount(); ++i ) { //copy last frame to current page - std::unique_ptr< QgsLayoutFrame > newFrame = std::make_unique< QgsLayoutFrame >( mLayout, this ); + auto newFrame = std::make_unique< QgsLayoutFrame >( mLayout, this ); newFrame->attemptSetSceneRect( QRectF( lastFrame->pos().x(), mLayout->pageCollection()->page( i )->pos().y() + lastFrame->pagePos().y(), @@ -557,7 +557,7 @@ bool QgsLayoutMultiFrame::readXml( const QDomElement &element, const QDomDocumen if ( !frameNodes.isEmpty() ) { QDomElement frameItemElement = frameNodes.at( 0 ).toElement(); - std::unique_ptr< QgsLayoutFrame > newFrame = std::make_unique< QgsLayoutFrame >( mLayout, this ); + auto newFrame = std::make_unique< QgsLayoutFrame >( mLayout, this ); newFrame->readXml( frameItemElement, doc, context ); addFrame( newFrame.release(), false ); } diff --git a/src/core/layout/qgslayoutpagecollection.cpp b/src/core/layout/qgslayoutpagecollection.cpp index 6ed30610b901..0626427f131b 100644 --- a/src/core/layout/qgslayoutpagecollection.cpp +++ b/src/core/layout/qgslayoutpagecollection.cpp @@ -309,7 +309,7 @@ void QgsLayoutPageCollection::resizeToContents( const QgsMargins &margins, Qgis: if ( mPages.empty() ) { - std::unique_ptr< QgsLayoutItemPage > page = std::make_unique< QgsLayoutItemPage >( mLayout ); + auto page = std::make_unique< QgsLayoutItemPage >( mLayout ); addPage( page.release() ); } @@ -418,7 +418,7 @@ bool QgsLayoutPageCollection::readXml( const QDomElement &e, const QDomDocument for ( int i = 0; i < pageList.size(); ++i ) { QDomElement pageElement = pageList.at( i ).toElement(); - std::unique_ptr< QgsLayoutItemPage > page( new QgsLayoutItemPage( mLayout ) ); + auto page = std::make_unique( mLayout ); if ( mPageStyleSymbol ) page->setPageStyleSymbol( mPageStyleSymbol->clone() ); page->readXml( pageElement, document, context ); @@ -614,7 +614,7 @@ QgsLayoutItemPage *QgsLayoutPageCollection::extendByNewPage() return nullptr; QgsLayoutItemPage *lastPage = mPages.at( mPages.count() - 1 ); - std::unique_ptr< QgsLayoutItemPage > newPage = std::make_unique< QgsLayoutItemPage >( mLayout ); + auto newPage = std::make_unique< QgsLayoutItemPage >( mLayout ); newPage->attemptResize( lastPage->sizeWithUnits() ); addPage( newPage.release() ); return mPages.at( mPages.count() - 1 ); diff --git a/src/core/layout/qgslayouttable.cpp b/src/core/layout/qgslayouttable.cpp index 93aa1b3e60e7..ada214113ecc 100644 --- a/src/core/layout/qgslayouttable.cpp +++ b/src/core/layout/qgslayouttable.cpp @@ -430,7 +430,7 @@ void QgsLayoutTable::render( QgsLayoutItemRenderContext &context, const QRectF & int col = 0; for ( const QgsLayoutTableColumn &column : std::as_const( mColumns ) ) { - std::unique_ptr< QgsExpressionContextScope > headerCellScope = std::make_unique< QgsExpressionContextScope >(); + auto headerCellScope = std::make_unique< QgsExpressionContextScope >(); headerCellScope->setVariable( QStringLiteral( "column_number" ), col + 1, true ); QgsExpressionContextScopePopper popper( context.renderContext().expressionContext(), headerCellScope.release() ); @@ -1022,7 +1022,7 @@ QMap QgsLayoutTable::headerLabels() const QgsExpressionContextScope *QgsLayoutTable::scopeForCell( int row, int column ) const { - std::unique_ptr< QgsExpressionContextScope > cellScope = std::make_unique< QgsExpressionContextScope >(); + auto cellScope = std::make_unique< QgsExpressionContextScope >(); cellScope->setVariable( QStringLiteral( "row_number" ), row + 1, true ); cellScope->setVariable( QStringLiteral( "column_number" ), column + 1, true ); return cellScope.release(); @@ -1134,7 +1134,7 @@ bool QgsLayoutTable::calculateMaxColumnWidths() } else if ( mHeaderMode != QgsLayoutTable::NoHeaders ) { - std::unique_ptr< QgsExpressionContextScope > headerCellScope = std::make_unique< QgsExpressionContextScope >(); + auto headerCellScope = std::make_unique< QgsExpressionContextScope >(); headerCellScope->setVariable( QStringLiteral( "column_number" ), i + 1, true ); QgsExpressionContextScopePopper popper( context.expressionContext(), headerCellScope.release() ); @@ -1211,7 +1211,7 @@ bool QgsLayoutTable::calculateMaxRowHeights() int i = 0; for ( const QgsLayoutTableColumn &col : std::as_const( mColumns ) ) { - std::unique_ptr< QgsExpressionContextScope > headerCellScope = std::make_unique< QgsExpressionContextScope >(); + auto headerCellScope = std::make_unique< QgsExpressionContextScope >(); headerCellScope->setVariable( QStringLiteral( "column_number" ), i + 1, true ); QgsExpressionContextScopePopper popper( context.expressionContext(), headerCellScope.release() ); diff --git a/src/core/layout/qgsprintlayout.cpp b/src/core/layout/qgsprintlayout.cpp index e97fe7fff4b7..0a0c392be93d 100644 --- a/src/core/layout/qgsprintlayout.cpp +++ b/src/core/layout/qgsprintlayout.cpp @@ -35,7 +35,7 @@ QgsPrintLayout *QgsPrintLayout::clone() const const QDomElement elem = writeXml( currentDoc, context ); currentDoc.appendChild( elem ); - std::unique_ptr< QgsPrintLayout > newLayout = std::make_unique< QgsPrintLayout >( project() ); + auto newLayout = std::make_unique< QgsPrintLayout >( project() ); bool ok = false; newLayout->loadFromTemplate( currentDoc, context, true, &ok ); if ( !ok ) diff --git a/src/core/layout/qgsreport.cpp b/src/core/layout/qgsreport.cpp index dd495799385f..a6c416ff0448 100644 --- a/src/core/layout/qgsreport.cpp +++ b/src/core/layout/qgsreport.cpp @@ -32,7 +32,7 @@ QIcon QgsReport::icon() const QgsReport *QgsReport::clone() const { - std::unique_ptr< QgsReport > copy = std::make_unique< QgsReport >( mProject ); + auto copy = std::make_unique< QgsReport >( mProject ); copyCommonProperties( copy.get() ); return copy.release(); } diff --git a/src/core/layout/qgsreportsectionfieldgroup.cpp b/src/core/layout/qgsreportsectionfieldgroup.cpp index f39f7c34d610..e1f475880f54 100644 --- a/src/core/layout/qgsreportsectionfieldgroup.cpp +++ b/src/core/layout/qgsreportsectionfieldgroup.cpp @@ -40,7 +40,7 @@ QIcon QgsReportSectionFieldGroup::icon() const QgsReportSectionFieldGroup *QgsReportSectionFieldGroup::clone() const { - std::unique_ptr< QgsReportSectionFieldGroup > copy = std::make_unique< QgsReportSectionFieldGroup >( nullptr ); + auto copy = std::make_unique< QgsReportSectionFieldGroup >( nullptr ); copyCommonProperties( copy.get() ); if ( mBody ) @@ -219,7 +219,7 @@ bool QgsReportSectionFieldGroup::readPropertiesFromElement( const QDomElement &e if ( !bodyElement.isNull() ) { const QDomElement bodyLayoutElem = bodyElement.firstChild().toElement(); - std::unique_ptr< QgsLayout > body = std::make_unique< QgsLayout >( project() ); + auto body = std::make_unique< QgsLayout >( project() ); body->readXml( bodyLayoutElem, doc, context ); mBody = std::move( body ); } diff --git a/src/core/layout/qgsreportsectionlayout.cpp b/src/core/layout/qgsreportsectionlayout.cpp index 6f8f58d03f77..cc52beb7fef4 100644 --- a/src/core/layout/qgsreportsectionlayout.cpp +++ b/src/core/layout/qgsreportsectionlayout.cpp @@ -30,7 +30,7 @@ QIcon QgsReportSectionLayout::icon() const QgsReportSectionLayout *QgsReportSectionLayout::clone() const { - std::unique_ptr< QgsReportSectionLayout > copy = std::make_unique< QgsReportSectionLayout >( nullptr ); + auto copy = std::make_unique< QgsReportSectionLayout >( nullptr ); copyCommonProperties( copy.get() ); if ( mBody ) @@ -91,7 +91,7 @@ bool QgsReportSectionLayout::readPropertiesFromElement( const QDomElement &eleme if ( !bodyElement.isNull() ) { const QDomElement bodyLayoutElem = bodyElement.firstChild().toElement(); - std::unique_ptr< QgsLayout > body = std::make_unique< QgsLayout >( project() ); + auto body = std::make_unique< QgsLayout >( project() ); body->readXml( bodyLayoutElem, doc, context ); mBody = std::move( body ); } diff --git a/src/core/maprenderer/qgsmaprendererjob.cpp b/src/core/maprenderer/qgsmaprendererjob.cpp index 7dcde5a53e50..2746f07a857f 100644 --- a/src/core/maprenderer/qgsmaprendererjob.cpp +++ b/src/core/maprenderer/qgsmaprendererjob.cpp @@ -419,9 +419,9 @@ bool QgsMapRendererJob::reprojectToLayerExtent( const QgsMapLayer *ml, const Qgs extent = approxTransform.transformBoundingBox( extent, Qgis::TransformDirection::Reverse ); } } - catch ( QgsCsException & ) + catch ( QgsCsException &e ) { - QgsDebugError( QStringLiteral( "Transform error caught" ) ); + QgsDebugError( QStringLiteral( "Transform error caught: %1" ).arg( e.what() ) ); extent = QgsRectangle( std::numeric_limits::lowest(), std::numeric_limits::lowest(), std::numeric_limits::max(), std::numeric_limits::max() ); r2 = QgsRectangle( std::numeric_limits::lowest(), std::numeric_limits::lowest(), std::numeric_limits::max(), std::numeric_limits::max() ); res = false; @@ -448,7 +448,7 @@ QImage *QgsMapRendererJob::allocateImage( QString layerId ) QgsElevationMap *QgsMapRendererJob::allocateElevationMap( QString layerId ) { - std::unique_ptr elevationMap = std::make_unique( mSettings.deviceOutputSize(), mSettings.devicePixelRatio() ); + auto elevationMap = std::make_unique( mSettings.deviceOutputSize(), mSettings.devicePixelRatio() ); if ( !elevationMap->isValid() ) { mErrors.append( Error( layerId, tr( "Insufficient memory for elevation map %1x%2" ).arg( mSettings.outputSize().width() ).arg( mSettings.outputSize().height() ) ) ); @@ -471,7 +471,7 @@ QPainter *QgsMapRendererJob::allocateImageAndPainter( QString layerId, QImage *& QgsMapRendererJob::PictureAndPainter QgsMapRendererJob::allocatePictureAndPainter( const QgsRenderContext *context ) { - std::unique_ptr picture = std::make_unique(); + auto picture = std::make_unique(); QPainter *painter = new QPainter( picture.get() ); context->setPainterFlagsUsingContext( painter ); return { std::move( picture ), painter }; @@ -830,7 +830,7 @@ std::vector< LayerRenderJob > QgsMapRendererJob::prepareSecondPassJobs( std::vec if ( forceVector && !labelHasEffects[ maskId ] ) { // set a painter to get all masking instruction in order to later clip masked symbol layer - std::unique_ptr< QgsGeometryPaintDevice > geomPaintDevice = std::make_unique< QgsGeometryPaintDevice >( true ); + auto geomPaintDevice = std::make_unique< QgsGeometryPaintDevice >( true ); geomPaintDevice->setStrokedPathSegments( 4 ); geomPaintDevice->setSimplificationTolerance( labelJob.context.maskSettings().simplifyTolerance() ); maskPaintDevice = geomPaintDevice.release(); @@ -914,7 +914,7 @@ std::vector< LayerRenderJob > QgsMapRendererJob::prepareSecondPassJobs( std::vec if ( forceVector && !maskLayerHasEffects[ job.layerId ] ) { // set a painter to get all masking instruction in order to later clip masked symbol layer - std::unique_ptr< QgsGeometryPaintDevice > geomPaintDevice = std::make_unique< QgsGeometryPaintDevice >( ); + auto geomPaintDevice = std::make_unique< QgsGeometryPaintDevice >( ); geomPaintDevice->setStrokedPathSegments( 4 ); geomPaintDevice->setSimplificationTolerance( job.context()->maskSettings().simplifyTolerance() ); maskPaintDevice = geomPaintDevice.release(); diff --git a/src/core/mesh/qgsmeshadvancedediting.cpp b/src/core/mesh/qgsmeshadvancedediting.cpp index 9acadd881aeb..3ee47b15fa42 100644 --- a/src/core/mesh/qgsmeshadvancedediting.cpp +++ b/src/core/mesh/qgsmeshadvancedediting.cpp @@ -433,7 +433,7 @@ bool QgsMeshEditRefineFaces::createNewBorderFaces( QgsMeshEditor *meshEditor, try { - std::unique_ptr cdt( new p2t::CDT( points ) ); + auto cdt = std::make_unique( points ); cdt->Triangulate(); std::vector triangles = cdt->GetTriangles(); QVector faces( triangles.size() ); diff --git a/src/core/mesh/qgsmeshcalculator.cpp b/src/core/mesh/qgsmeshcalculator.cpp index 9aab85cda058..440125734a0c 100644 --- a/src/core/mesh/qgsmeshcalculator.cpp +++ b/src/core/mesh/qgsmeshcalculator.cpp @@ -226,7 +226,7 @@ QgsMeshCalculator::Result QgsMeshCalculator::processCalculation( QgsFeedback *fe return InvalidDatasets; } - std::unique_ptr outputGroup = std::make_unique ( mOutputGroupName, dsu.outputType() ); + auto outputGroup = std::make_unique ( mOutputGroupName, dsu.outputType() ); // calculate const bool ok = calcNode->calculate( dsu, *outputGroup ); diff --git a/src/core/mesh/qgsmeshcalcutils.cpp b/src/core/mesh/qgsmeshcalcutils.cpp index 9a9221cc1392..60abdc762261 100644 --- a/src/core/mesh/qgsmeshcalcutils.cpp +++ b/src/core/mesh/qgsmeshcalcutils.cpp @@ -183,7 +183,7 @@ std::shared_ptr QgsMeshCalcUtils::createMemoryDataset( con { Q_ASSERT( type != QgsMeshDatasetGroupMetadata::DataOnVolumes ); - std::shared_ptr ds = std::make_shared(); + auto ds = std::make_shared(); if ( type == QgsMeshDatasetGroupMetadata::DataOnVertices ) { ds->values.resize( mMeshLayer->dataProvider()->vertexCount() ); @@ -562,7 +562,7 @@ std::shared_ptr QgsMeshCalcUtils::copy( Q_ASSERT( isValid() ); Q_ASSERT( dataset0 ); - std::shared_ptr output = std::make_shared(); + auto output = std::make_shared(); output->values = dataset0->values; //deep copy output->active = dataset0->active; //deep copy output->time = dataset0->time; diff --git a/src/core/mesh/qgsmesheditor.cpp b/src/core/mesh/qgsmesheditor.cpp index 79d520d27519..c790275e7a32 100644 --- a/src/core/mesh/qgsmesheditor.cpp +++ b/src/core/mesh/qgsmesheditor.cpp @@ -170,7 +170,7 @@ bool QgsMeshEditor::isFaceGeometricallyCompatible( const QList &vertexIndex const QgsPoint &vertex = vertices[i]; ring.append( vertex ); } - std::unique_ptr< QgsPolygon > polygon = std::make_unique< QgsPolygon >(); + auto polygon = std::make_unique< QgsPolygon >(); polygon->setExteriorRing( new QgsLineString( ring ) ); const QgsGeometry newFaceGeom( polygon.release() ); std::unique_ptr geomEngine( QgsGeometry::createGeometryEngine( newFaceGeom.constGet() ) ); diff --git a/src/core/mesh/qgsmeshforcebypolylines.cpp b/src/core/mesh/qgsmeshforcebypolylines.cpp index 46edfb588a4f..c9593d4ea645 100644 --- a/src/core/mesh/qgsmeshforcebypolylines.cpp +++ b/src/core/mesh/qgsmeshforcebypolylines.cpp @@ -906,7 +906,7 @@ bool QgsMeshEditForceByLine::triangulateHoles( mapPoly2TriPointToVertex.insert( holeToFill[i + hole.count()], vertexLocalIndex + mesh->vertexCount() ); } - std::unique_ptr cdt( new p2t::CDT( holeToFill ) ); + auto cdt = std::make_unique( holeToFill ); cdt->Triangulate(); std::vector triangles = cdt->GetTriangles(); QVector newFaces( triangles.size() ); diff --git a/src/core/mesh/qgsmeshlayer.cpp b/src/core/mesh/qgsmeshlayer.cpp index 56ffea5a6e52..c7bbcc789196 100644 --- a/src/core/mesh/qgsmeshlayer.cpp +++ b/src/core/mesh/qgsmeshlayer.cpp @@ -418,7 +418,7 @@ QgsMeshRendererSettings QgsMeshLayer::rendererSettings() const return mRendererSettings; } -void QgsMeshLayer::setRendererSettings( const QgsMeshRendererSettings &settings ) +void QgsMeshLayer::setRendererSettings( const QgsMeshRendererSettings &settings, const bool repaint ) { QGIS_PROTECT_QOBJECT_THREAD_ACCESS @@ -433,7 +433,11 @@ void QgsMeshLayer::setRendererSettings( const QgsMeshRendererSettings &settings emit activeVectorDatasetGroupChanged( mRendererSettings.activeVectorDatasetGroup() ); emit rendererChanged(); - triggerRepaint(); + + if ( repaint ) + { + triggerRepaint(); + } } QgsMeshTimeSettings QgsMeshLayer::timeSettings() const @@ -1704,6 +1708,11 @@ bool QgsMeshLayer::minimumMaximumActiveScalarDataset( const QgsRectangle &extent QgsTriangularMesh *tMesh = triangularMesh(); + if ( ! tMesh ) + { + return false; + } + QVector scalarDatasetValues; const QgsMeshDatasetGroupMetadata metadata = datasetGroupMetadata( datasetIndex.group() ); diff --git a/src/core/mesh/qgsmeshlayer.h b/src/core/mesh/qgsmeshlayer.h index 311694ee75c5..49c22a1e6ac1 100644 --- a/src/core/mesh/qgsmeshlayer.h +++ b/src/core/mesh/qgsmeshlayer.h @@ -309,8 +309,14 @@ class CORE_EXPORT QgsMeshLayer : public QgsMapLayer, public QgsAbstractProfileSo //! Returns renderer settings QgsMeshRendererSettings rendererSettings() const; - //! Sets new renderer settings - void setRendererSettings( const QgsMeshRendererSettings &settings ); + + /** + * Sets new renderer settings + * + * \param settings + * \param repaint should the update of renderer settings trigger repaint and emit rendererChanged signal + */ + void setRendererSettings( const QgsMeshRendererSettings &settings, const bool repaint = true ); /** * Returns time format settings diff --git a/src/core/mesh/qgsmeshlayerelevationproperties.cpp b/src/core/mesh/qgsmeshlayerelevationproperties.cpp index 3663900d8ace..95ffe400b833 100644 --- a/src/core/mesh/qgsmeshlayerelevationproperties.cpp +++ b/src/core/mesh/qgsmeshlayerelevationproperties.cpp @@ -182,7 +182,7 @@ QString QgsMeshLayerElevationProperties::htmlSummary() const QgsMeshLayerElevationProperties *QgsMeshLayerElevationProperties::clone() const { - std::unique_ptr< QgsMeshLayerElevationProperties > res = std::make_unique< QgsMeshLayerElevationProperties >( nullptr ); + auto res = std::make_unique< QgsMeshLayerElevationProperties >( nullptr ); res->setMode( mMode ); res->setProfileLineSymbol( mProfileLineSymbol->clone() ); res->setProfileFillSymbol( mProfileFillSymbol->clone() ); @@ -411,13 +411,13 @@ void QgsMeshLayerElevationProperties::setElevationLimit( double limit ) void QgsMeshLayerElevationProperties::setDefaultProfileLineSymbol( const QColor &color ) { - std::unique_ptr< QgsSimpleLineSymbolLayer > profileLineLayer = std::make_unique< QgsSimpleLineSymbolLayer >( color, 0.6 ); + auto profileLineLayer = std::make_unique< QgsSimpleLineSymbolLayer >( color, 0.6 ); mProfileLineSymbol = std::make_unique< QgsLineSymbol>( QgsSymbolLayerList( { profileLineLayer.release() } ) ); } void QgsMeshLayerElevationProperties::setDefaultProfileFillSymbol( const QColor &color ) { - std::unique_ptr< QgsSimpleFillSymbolLayer > profileFillLayer = std::make_unique< QgsSimpleFillSymbolLayer >( color ); + auto profileFillLayer = std::make_unique< QgsSimpleFillSymbolLayer >( color ); profileFillLayer->setStrokeStyle( Qt::NoPen ); mProfileFillSymbol = std::make_unique< QgsFillSymbol>( QgsSymbolLayerList( { profileFillLayer.release() } ) ); } diff --git a/src/core/mesh/qgsmeshlayerinterpolator.cpp b/src/core/mesh/qgsmeshlayerinterpolator.cpp index f4f7b1dffc78..ce6c6595f2bd 100644 --- a/src/core/mesh/qgsmeshlayerinterpolator.cpp +++ b/src/core/mesh/qgsmeshlayerinterpolator.cpp @@ -72,7 +72,7 @@ int QgsMeshLayerInterpolator::bandCount() const QgsRasterBlock *QgsMeshLayerInterpolator::block( int, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback ) { - std::unique_ptr outputBlock( new QgsRasterBlock( Qgis::DataType::Float64, width, height ) ); + auto outputBlock = std::make_unique( Qgis::DataType::Float64, width, height ); const double noDataValue = std::numeric_limits::quiet_NaN(); outputBlock->setNoDataValue( noDataValue ); outputBlock->setIsNoData(); // assume initially that all values are unset @@ -242,9 +242,9 @@ QgsRasterBlock *QgsMeshUtils::exportRasterBlock( renderContext.setMapToPixel( mapToPixel ); renderContext.setExtent( extent ); - std::unique_ptr nativeMesh = std::make_unique(); + auto nativeMesh = std::make_unique(); layer.dataProvider()->populateMesh( nativeMesh.get() ); - std::unique_ptr triangularMesh = std::make_unique(); + auto triangularMesh = std::make_unique(); triangularMesh->update( nativeMesh.get(), transform ); const QgsMeshDatasetGroupMetadata metadata = layer.datasetGroupMetadata( datasetIndex ); diff --git a/src/core/mesh/qgsmeshlayerrenderer.cpp b/src/core/mesh/qgsmeshlayerrenderer.cpp index 479340761377..7ad75073fb99 100644 --- a/src/core/mesh/qgsmeshlayerrenderer.cpp +++ b/src/core/mesh/qgsmeshlayerrenderer.cpp @@ -161,41 +161,42 @@ QgsMeshLayerRenderer::QgsMeshLayerRenderer( mClippingRegions = QgsMapClippingUtils::collectClippingRegionsForLayer( *renderContext(), layer ); - if ( !context.testFlag( Qgis::RenderContextFlag::RenderPreviewJob ) ) + if ( !context.testFlag( Qgis::RenderContextFlag::RenderPreviewJob ) + && !( context.flags() & Qgis::RenderContextFlag::Render3DMap ) ) { - QgsMeshDatasetIndex activeDatasetIndex = layer->activeScalarDatasetIndex( context ); + const QgsMeshDatasetIndex activeDatasetIndex = layer->activeScalarDatasetIndex( context ); if ( activeDatasetIndex.isValid() ) { QgsMeshRendererScalarSettings scalarRendererSettings = mRendererSettings.scalarSettings( activeDatasetIndex.group() ); - double previousMin = scalarRendererSettings.classificationMinimum(); - double previousMax = scalarRendererSettings.classificationMaximum(); - - QgsRenderedLayerStatistics *layerStatistics = new QgsRenderedLayerStatistics( layer->id(), previousMin, previousMax ); - layerStatistics->setBoundingBox( layer->extent() ); + const double previousMin = scalarRendererSettings.classificationMinimum(); + const double previousMax = scalarRendererSettings.classificationMaximum(); if ( scalarRendererSettings.extent() == Qgis::MeshRangeExtent::UpdatedCanvas && scalarRendererSettings.limits() == Qgis::MeshRangeLimit::MinimumMaximum ) { double min, max; - bool found = layer->minimumMaximumActiveScalarDataset( context.extent(), activeDatasetIndex, min, max ); + const bool found = layer->minimumMaximumActiveScalarDataset( context.extent(), activeDatasetIndex, min, max ); if ( found ) { if ( previousMin != min || previousMax != max ) { + + scalarRendererSettings.setClassificationMinimumMaximum( min, max ); + mRendererSettings.setScalarSettings( activeDatasetIndex.group(), scalarRendererSettings ); + + QgsRenderedLayerStatistics *layerStatistics = new QgsRenderedLayerStatistics( layer->id(), previousMin, previousMax ); + layerStatistics->setBoundingBox( context.extent() ); layerStatistics->setMaximum( 0, max ); layerStatistics->setMinimum( 0, min ); - scalarRendererSettings.setClassificationMinimumMaximum( min, max ); - mRendererSettings.setScalarSettings( activeDatasetIndex.group(), scalarRendererSettings ); + appendRenderedItemDetails( layerStatistics ); } } } - - appendRenderedItemDetails( layerStatistics ); } } diff --git a/src/core/mesh/qgsmeshrenderersettings.cpp b/src/core/mesh/qgsmeshrenderersettings.cpp index 19bbc864aa5e..cd2956944b68 100644 --- a/src/core/mesh/qgsmeshrenderersettings.cpp +++ b/src/core/mesh/qgsmeshrenderersettings.cpp @@ -133,8 +133,10 @@ QDomElement QgsMeshRendererScalarSettings::writeXml( QDomDocument &doc, const Qg } elem.setAttribute( QStringLiteral( "interpolation-method" ), methodTxt ); - elem.setAttribute( QStringLiteral( "range-extent" ), QgsMeshRendererScalarSettings::extentString( mRangeExtent ) ); - elem.setAttribute( QStringLiteral( "range-limit" ), QgsMeshRendererScalarSettings::limitsString( mRangeLimit ) ); + if ( mRangeExtent != Qgis::MeshRangeExtent::WholeMesh ) + elem.setAttribute( QStringLiteral( "range-extent" ), qgsEnumValueToKey( mRangeExtent ) ); + if ( mRangeLimit != Qgis::MeshRangeLimit::NotSet ) + elem.setAttribute( QStringLiteral( "range-limit" ), qgsEnumValueToKey( mRangeLimit ) ); const QDomElement elemShader = mColorRampShader.writeXml( doc, context ); elem.appendChild( elemShader ); @@ -163,8 +165,8 @@ void QgsMeshRendererScalarSettings::readXml( const QDomElement &elem, const QgsR mDataResamplingMethod = DataResamplingMethod::NoResampling; } - mRangeExtent = QgsMeshRendererScalarSettings::extentFromString( elem.attribute( "range-extent" ) ); - mRangeLimit = QgsMeshRendererScalarSettings::limitsFromString( elem.attribute( "range-limit" ) ); + mRangeExtent = qgsEnumKeyToValue( elem.attribute( "range-extent" ), Qgis::MeshRangeExtent::WholeMesh ); + mRangeLimit = qgsEnumKeyToValue( elem.attribute( "range-limit" ), Qgis::MeshRangeLimit::NotSet ); const QDomElement elemShader = elem.firstChildElement( QStringLiteral( "colorrampshader" ) ); mColorRampShader.readXml( elemShader, context ); @@ -206,58 +208,6 @@ void QgsMeshRendererScalarSettings::updateShader() mColorRampShader.classifyColorRamp( mColorRampShader.sourceColorRamp()->count(), 1, QgsRectangle(), nullptr ); } -QString QgsMeshRendererScalarSettings::extentString( Qgis::MeshRangeExtent extent ) -{ - switch ( extent ) - { - case Qgis::MeshRangeExtent::WholeMesh: - return QStringLiteral( "WholeMesh" ); - case Qgis::MeshRangeExtent::FixedCanvas: - return QStringLiteral( "CurrentCanvas" ); - case Qgis::MeshRangeExtent::UpdatedCanvas: - return QStringLiteral( "UpdatedCanvas" ); - } - return QStringLiteral( "WholeMesh" ); -} - -Qgis::MeshRangeExtent QgsMeshRendererScalarSettings::extentFromString( const QString &extent ) -{ - if ( extent == QLatin1String( "WholeMesh" ) ) - { - return Qgis::MeshRangeExtent::WholeMesh; - } - else if ( extent == QLatin1String( "CurrentCanvas" ) ) - { - return Qgis::MeshRangeExtent::FixedCanvas; - } - else if ( extent == QLatin1String( "UpdatedCanvas" ) ) - { - return Qgis::MeshRangeExtent::UpdatedCanvas; - } - - return Qgis::MeshRangeExtent::WholeMesh; -} - -QString QgsMeshRendererScalarSettings::limitsString( Qgis::MeshRangeLimit limits ) -{ - switch ( limits ) - { - case Qgis::MeshRangeLimit::MinimumMaximum: - return QStringLiteral( "MinMax" ); - default: - break; - } - return QStringLiteral( "None" ); -} - -Qgis::MeshRangeLimit QgsMeshRendererScalarSettings::limitsFromString( const QString &limits ) -{ - if ( limits == QLatin1String( "MinMax" ) ) - { - return Qgis::MeshRangeLimit::MinimumMaximum; - } - return Qgis::MeshRangeLimit::NotSet; -} // --------------------------------------------------------------------- diff --git a/src/core/mesh/qgsmeshrenderersettings.h b/src/core/mesh/qgsmeshrenderersettings.h index b59664628204..3c4ae1045e9c 100644 --- a/src/core/mesh/qgsmeshrenderersettings.h +++ b/src/core/mesh/qgsmeshrenderersettings.h @@ -211,19 +211,6 @@ class CORE_EXPORT QgsMeshRendererScalarSettings private: void updateShader(); - //! Returns a string to serialize Limits - static QString limitsString( Qgis::MeshRangeLimit limits ); - - //! \brief Deserialize Limits - static Qgis::MeshRangeLimit limitsFromString( const QString &limits ); - - //! Returns a string to serialize Extent - static QString extentString( Qgis::MeshRangeExtent extent ); - - //! \brief Deserialize Extent - static Qgis::MeshRangeExtent extentFromString( const QString &extent ); - - QgsColorRampShader mColorRampShader; DataResamplingMethod mDataResamplingMethod = DataResamplingMethod::NoResampling; double mClassificationMinimum = 0; diff --git a/src/core/mesh/qgsmeshvirtualdatasetgroup.cpp b/src/core/mesh/qgsmeshvirtualdatasetgroup.cpp index 755929bc3e14..46d261f2ae39 100644 --- a/src/core/mesh/qgsmeshvirtualdatasetgroup.cpp +++ b/src/core/mesh/qgsmeshvirtualdatasetgroup.cpp @@ -164,7 +164,7 @@ bool QgsMeshVirtualDatasetGroup::calculateDataset() const return false; //open output dataset - std::unique_ptr outputGroup = std::make_unique ( QString(), dsu.outputType() ); + auto outputGroup = std::make_unique ( QString(), dsu.outputType() ); mCalcNode->calculate( dsu, *outputGroup ); if ( outputGroup->memoryDatasets.isEmpty() ) diff --git a/src/core/mesh/qgstopologicalmesh.cpp b/src/core/mesh/qgstopologicalmesh.cpp index c5fa7f5ff3c5..b65069e29bbc 100644 --- a/src/core/mesh/qgstopologicalmesh.cpp +++ b/src/core/mesh/qgstopologicalmesh.cpp @@ -1361,7 +1361,7 @@ QgsTopologicalMesh::Changes QgsTopologicalMesh::removeVertexFillHole( int vertex mapPoly2TriPointToVertex.insert( holeToFill[i], holeVertices.at( i ) ); } - std::unique_ptr cdt( new p2t::CDT( holeToFill ) ); + auto cdt = std::make_unique( holeToFill ); cdt->Triangulate(); std::vector triangles = cdt->GetTriangles(); @@ -2398,7 +2398,7 @@ QgsTopologicalMesh::Changes QgsTopologicalMesh::insertVertexInFacesEdge( int fac mapPoly2TriPointToVertex.insert( faceToFill[i], newBoundary.at( i ) ); } - std::unique_ptr cdt( new p2t::CDT( faceToFill ) ); + auto cdt = std::make_unique( faceToFill ); cdt->Triangulate(); std::vector triangles = cdt->GetTriangles(); QVector newFaces( triangles.size() ); diff --git a/src/core/mesh/qgstriangularmesh.cpp b/src/core/mesh/qgstriangularmesh.cpp index d16b083185f0..f3e23c5c05b6 100644 --- a/src/core/mesh/qgstriangularmesh.cpp +++ b/src/core/mesh/qgstriangularmesh.cpp @@ -635,7 +635,7 @@ std::unique_ptr< QgsPolygon > QgsMeshUtils::toPolygon( const QgsMeshFace &face, const QgsPoint &vertex = vertices[vertexId]; ring.append( vertex ); } - std::unique_ptr< QgsPolygon > polygon = std::make_unique< QgsPolygon >(); + auto polygon = std::make_unique< QgsPolygon >(); polygon->setExteriorRing( new QgsLineString( ring ) ); return polygon; } diff --git a/src/core/network/qgsblockingnetworkrequest.cpp b/src/core/network/qgsblockingnetworkrequest.cpp index c80e28630e9a..cee9476c69e4 100644 --- a/src/core/network/qgsblockingnetworkrequest.cpp +++ b/src/core/network/qgsblockingnetworkrequest.cpp @@ -152,6 +152,7 @@ QgsBlockingNetworkRequest::ErrorCode QgsBlockingNetworkRequest::doRequest( QgsBl QgsDebugMsgLevel( QStringLiteral( "Calling: %1" ).arg( request.url().toString() ), 2 ); + request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy ); request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, forceRefresh ? QNetworkRequest::AlwaysNetwork : QNetworkRequest::PreferCache ); request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, true ); @@ -213,13 +214,19 @@ QgsBlockingNetworkRequest::ErrorCode QgsBlockingNetworkRequest::doRequest( QgsBl // note that we don't need to handle waking this thread back up - that's done automatically by QgsNetworkAccessManager }; + QMetaObject::Connection authRequestConnection; + QMetaObject::Connection proxyAuthenticationConnection; +#ifndef QT_NO_SSL + QMetaObject::Connection sslErrorsConnection; +#endif + if ( requestMadeFromMainThread ) { - connect( QgsNetworkAccessManager::instance(), &QgsNetworkAccessManager::authRequestOccurred, this, resumeMainThread, Qt::DirectConnection ); - connect( QgsNetworkAccessManager::instance(), &QgsNetworkAccessManager::proxyAuthenticationRequired, this, resumeMainThread, Qt::DirectConnection ); + authRequestConnection = connect( QgsNetworkAccessManager::instance(), &QgsNetworkAccessManager::authRequestOccurred, this, resumeMainThread, Qt::DirectConnection ); + proxyAuthenticationConnection = connect( QgsNetworkAccessManager::instance(), &QgsNetworkAccessManager::proxyAuthenticationRequired, this, resumeMainThread, Qt::DirectConnection ); #ifndef QT_NO_SSL - connect( QgsNetworkAccessManager::instance(), &QgsNetworkAccessManager::sslErrorsOccurred, this, resumeMainThread, Qt::DirectConnection ); + sslErrorsConnection = connect( QgsNetworkAccessManager::instance(), &QgsNetworkAccessManager::sslErrorsOccurred, this, resumeMainThread, Qt::DirectConnection ); #endif } QEventLoop loop; @@ -229,6 +236,16 @@ QgsBlockingNetworkRequest::ErrorCode QgsBlockingNetworkRequest::doRequest( QgsBl connect( qApp, &QCoreApplication::aboutToQuit, &loop, &QEventLoop::quit, Qt::DirectConnection ); connect( this, &QgsBlockingNetworkRequest::finished, &loop, &QEventLoop::quit, Qt::DirectConnection ); loop.exec(); + + if ( requestMadeFromMainThread ) + { + // event loop exited - need to disconnect as to not leave functor hanging to receive signals in future + disconnect( authRequestConnection ); + disconnect( proxyAuthenticationConnection ); +#ifndef QT_NO_SSL + disconnect( sslErrorsConnection ); +#endif + } } if ( requestMadeFromMainThread ) @@ -242,7 +259,7 @@ QgsBlockingNetworkRequest::ErrorCode QgsBlockingNetworkRequest::doRequest( QgsBl if ( requestMadeFromMainThread ) { - std::unique_ptr downloaderThread = std::make_unique( downloaderFunction ); + auto downloaderThread = std::make_unique( downloaderFunction ); downloaderThread->start(); while ( true ) @@ -356,6 +373,7 @@ void QgsBlockingNetworkRequest::replyFinished() return; } + request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy ); request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, mForceRefresh ? QNetworkRequest::AlwaysNetwork : QNetworkRequest::PreferCache ); request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, true ); diff --git a/src/core/network/qgshttpheaders.cpp b/src/core/network/qgshttpheaders.cpp index de9caeceeeeb..01436e579943 100644 --- a/src/core/network/qgshttpheaders.cpp +++ b/src/core/network/qgshttpheaders.cpp @@ -123,8 +123,18 @@ bool QgsHttpHeaders::updateMap( QVariantMap &map ) const bool QgsHttpHeaders::updateDomElement( QDomElement &el ) const { + QMap namespaceDeclarations; + return updateDomElement( el, namespaceDeclarations ); +} + +bool QgsHttpHeaders::updateDomElement( QDomElement &el, QMap &namespaceDeclarations ) const +{ + QString httpHeaderURIPrefix( QgsHttpHeaders::PARAM_PREFIX ); + httpHeaderURIPrefix.chop( 1 ); + for ( auto ite = mHeaders.constBegin(); ite != mHeaders.constEnd(); ++ite ) { + namespaceDeclarations.insert( httpHeaderURIPrefix, QStringLiteral( "https://qgis.org/" ) + httpHeaderURIPrefix ); el.setAttribute( QgsHttpHeaders::PARAM_PREFIX + ite.key().toUtf8(), ite.value().toString() ); } diff --git a/src/core/network/qgshttpheaders.h b/src/core/network/qgshttpheaders.h index 30e69ac70555..359e301bc40c 100644 --- a/src/core/network/qgshttpheaders.h +++ b/src/core/network/qgshttpheaders.h @@ -126,13 +126,26 @@ class CORE_EXPORT QgsHttpHeaders bool updateMap( QVariantMap &map ) const; /** - * \brief Updates a \a map by adding all the HTTP headers + * \brief Updates a DOM element by adding all the HTTP headers * * KEY_REFERER value will be available at attribute "KEY_PREFIX+KEY_REFERER" and attribute "KEY_REFERER" (for backward compatibility) * + * \param el DOM element * \return TRUE if the update succeed + * \deprecated QGIS 3.42. Will be removed in QGIS 4.0. */ - bool updateDomElement( QDomElement &el ) const; + Q_DECL_DEPRECATED bool updateDomElement( QDomElement &el ) const SIP_DEPRECATED; + + /** + * \brief Updates a DOM element by adding all the HTTP headers + * + * KEY_REFERER value will be available at attribute "KEY_PREFIX+KEY_REFERER" and attribute "KEY_REFERER" (for backward compatibility) + * + * \param el DOM element + * \param[out] namespaceDeclarations Map of (prefix, URI) tuples for namespaces used by el. + * \return TRUE if the update succeed + */ + bool updateDomElement( QDomElement &el, QMap &namespaceDeclarations ) const SIP_SKIP; /** * \brief Loads headers from the \a settings @@ -211,3 +224,4 @@ class CORE_EXPORT QgsHttpHeaders }; #endif // QGSHTTPHEADERS_H + diff --git a/src/core/network/qgsnetworkaccessmanager.cpp b/src/core/network/qgsnetworkaccessmanager.cpp index a93758192063..94e997320bc0 100644 --- a/src/core/network/qgsnetworkaccessmanager.cpp +++ b/src/core/network/qgsnetworkaccessmanager.cpp @@ -216,6 +216,7 @@ QgsNetworkAccessManager::QgsNetworkAccessManager( QObject *parent ) , mSslErrorHandlerSemaphore( 1 ) , mAuthRequestHandlerSemaphore( 1 ) { + setRedirectPolicy( QNetworkRequest::NoLessSafeRedirectPolicy ); setProxyFactory( new QgsNetworkProxyFactory() ); setCookieJar( new QgsNetworkCookieJar( this ) ); enableStrictTransportSecurityStore( true ); diff --git a/src/core/network/qgsnetworkcontentfetcher.cpp b/src/core/network/qgsnetworkcontentfetcher.cpp index 0b8e16efc2cf..ea52df6a7285 100644 --- a/src/core/network/qgsnetworkcontentfetcher.cpp +++ b/src/core/network/qgsnetworkcontentfetcher.cpp @@ -48,6 +48,7 @@ void QgsNetworkContentFetcher::fetchContent( const QUrl &url, const QString &aut void QgsNetworkContentFetcher::fetchContent( const QNetworkRequest &r, const QString &authcfg ) { QNetworkRequest request( r ); + request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy ); mAuthCfg = authcfg; if ( !mAuthCfg.isEmpty() ) diff --git a/src/core/numericformats/qgsbasicnumericformat.cpp b/src/core/numericformats/qgsbasicnumericformat.cpp index ae76e2bbda98..38cf065c220d 100644 --- a/src/core/numericformats/qgsbasicnumericformat.cpp +++ b/src/core/numericformats/qgsbasicnumericformat.cpp @@ -145,7 +145,7 @@ QgsNumericFormat *QgsBasicNumericFormat::clone() const QgsNumericFormat *QgsBasicNumericFormat::create( const QVariantMap &configuration, const QgsReadWriteContext &context ) const { - std::unique_ptr< QgsBasicNumericFormat > res = std::make_unique< QgsBasicNumericFormat >(); + auto res = std::make_unique< QgsBasicNumericFormat >(); res->setConfiguration( configuration, context ); return res.release(); } diff --git a/src/core/numericformats/qgsbearingnumericformat.cpp b/src/core/numericformats/qgsbearingnumericformat.cpp index fcae60b651ad..4cf7625c0524 100644 --- a/src/core/numericformats/qgsbearingnumericformat.cpp +++ b/src/core/numericformats/qgsbearingnumericformat.cpp @@ -91,7 +91,7 @@ QgsBearingNumericFormat *QgsBearingNumericFormat::clone() const QgsNumericFormat *QgsBearingNumericFormat::create( const QVariantMap &configuration, const QgsReadWriteContext &context ) const { - std::unique_ptr< QgsBearingNumericFormat > res = std::make_unique< QgsBearingNumericFormat >(); + auto res = std::make_unique< QgsBearingNumericFormat >(); res->setConfiguration( configuration, context ); res->mDirectionFormat = static_cast< FormatDirectionOption >( configuration.value( QStringLiteral( "direction_format" ), 0 ).toInt() ); return res.release(); diff --git a/src/core/numericformats/qgscoordinatenumericformat.cpp b/src/core/numericformats/qgscoordinatenumericformat.cpp index 389d19e88cb7..896260da1a46 100644 --- a/src/core/numericformats/qgscoordinatenumericformat.cpp +++ b/src/core/numericformats/qgscoordinatenumericformat.cpp @@ -95,7 +95,7 @@ QgsGeographicCoordinateNumericFormat *QgsGeographicCoordinateNumericFormat::clon QgsNumericFormat *QgsGeographicCoordinateNumericFormat::create( const QVariantMap &configuration, const QgsReadWriteContext &context ) const { - std::unique_ptr< QgsGeographicCoordinateNumericFormat > res = std::make_unique< QgsGeographicCoordinateNumericFormat >(); + auto res = std::make_unique< QgsGeographicCoordinateNumericFormat >(); res->setConfiguration( configuration, context ); res->mAngleFormat = qgsEnumKeyToValue( configuration.value( QStringLiteral( "angle_format" ) ).toString(), AngleFormat::DecimalDegrees ); res->mShowLeadingZeros = configuration.value( QStringLiteral( "show_leading_zeros" ), false ).toBool(); diff --git a/src/core/numericformats/qgscurrencynumericformat.cpp b/src/core/numericformats/qgscurrencynumericformat.cpp index 2c59bb0abe58..70216d6b412e 100644 --- a/src/core/numericformats/qgscurrencynumericformat.cpp +++ b/src/core/numericformats/qgscurrencynumericformat.cpp @@ -61,7 +61,7 @@ QgsNumericFormat *QgsCurrencyNumericFormat::clone() const QgsNumericFormat *QgsCurrencyNumericFormat::create( const QVariantMap &configuration, const QgsReadWriteContext &context ) const { - std::unique_ptr< QgsCurrencyNumericFormat > res = std::make_unique< QgsCurrencyNumericFormat >(); + auto res = std::make_unique< QgsCurrencyNumericFormat >(); res->setConfiguration( configuration, context ); res->mPrefix = configuration.value( QStringLiteral( "prefix" ), QStringLiteral( "$" ) ).toString(); res->mSuffix = configuration.value( QStringLiteral( "suffix" ), QString() ).toString(); diff --git a/src/core/numericformats/qgsexpressionbasednumericformat.cpp b/src/core/numericformats/qgsexpressionbasednumericformat.cpp index 41f7c9546494..5a4922bdb052 100644 --- a/src/core/numericformats/qgsexpressionbasednumericformat.cpp +++ b/src/core/numericformats/qgsexpressionbasednumericformat.cpp @@ -51,7 +51,7 @@ QgsNumericFormat *QgsExpressionBasedNumericFormat::clone() const QgsNumericFormat *QgsExpressionBasedNumericFormat::create( const QVariantMap &configuration, const QgsReadWriteContext & ) const { - std::unique_ptr< QgsExpressionBasedNumericFormat > res = std::make_unique< QgsExpressionBasedNumericFormat >(); + auto res = std::make_unique< QgsExpressionBasedNumericFormat >(); res->mExpression = QgsExpression( configuration.value( QStringLiteral( "expression" ), QStringLiteral( "@value" ) ).toString() ); return res.release(); } diff --git a/src/core/numericformats/qgsfractionnumericformat.cpp b/src/core/numericformats/qgsfractionnumericformat.cpp index 03c18182b654..b45057ecd5c7 100644 --- a/src/core/numericformats/qgsfractionnumericformat.cpp +++ b/src/core/numericformats/qgsfractionnumericformat.cpp @@ -155,7 +155,7 @@ QgsNumericFormat *QgsFractionNumericFormat::clone() const QgsNumericFormat *QgsFractionNumericFormat::create( const QVariantMap &configuration, const QgsReadWriteContext &context ) const { - std::unique_ptr< QgsFractionNumericFormat > res = std::make_unique< QgsFractionNumericFormat >(); + auto res = std::make_unique< QgsFractionNumericFormat >(); res->setConfiguration( configuration, context ); return res.release(); } diff --git a/src/core/numericformats/qgspercentagenumericformat.cpp b/src/core/numericformats/qgspercentagenumericformat.cpp index 43ce1df5f87a..a277fd0402c3 100644 --- a/src/core/numericformats/qgspercentagenumericformat.cpp +++ b/src/core/numericformats/qgspercentagenumericformat.cpp @@ -72,7 +72,7 @@ QgsNumericFormat *QgsPercentageNumericFormat::clone() const QgsNumericFormat *QgsPercentageNumericFormat::create( const QVariantMap &configuration, const QgsReadWriteContext &context ) const { - std::unique_ptr< QgsPercentageNumericFormat > res = std::make_unique< QgsPercentageNumericFormat >(); + auto res = std::make_unique< QgsPercentageNumericFormat >(); res->setConfiguration( configuration, context ); res->mInputValues = static_cast< InputValues >( configuration.value( QStringLiteral( "input_values" ), static_cast< int >( ValuesArePercentage ) ).toInt() ); res->setRoundingType( QgsBasicNumericFormat::DecimalPlaces ); diff --git a/src/core/numericformats/qgsscientificnumericformat.cpp b/src/core/numericformats/qgsscientificnumericformat.cpp index 9e1435398a2d..3949afa9aad0 100644 --- a/src/core/numericformats/qgsscientificnumericformat.cpp +++ b/src/core/numericformats/qgsscientificnumericformat.cpp @@ -50,7 +50,7 @@ QgsNumericFormat *QgsScientificNumericFormat::clone() const QgsNumericFormat *QgsScientificNumericFormat::create( const QVariantMap &configuration, const QgsReadWriteContext &context ) const { - std::unique_ptr< QgsScientificNumericFormat > res = std::make_unique< QgsScientificNumericFormat >(); + auto res = std::make_unique< QgsScientificNumericFormat >(); res->setConfiguration( configuration, context ); res->setRoundingType( QgsBasicNumericFormat::DecimalPlaces ); return res.release(); diff --git a/src/core/painting/qgsgeometrypaintdevice.cpp b/src/core/painting/qgsgeometrypaintdevice.cpp index db95d0e000af..4422bc21c199 100644 --- a/src/core/painting/qgsgeometrypaintdevice.cpp +++ b/src/core/painting/qgsgeometrypaintdevice.cpp @@ -460,7 +460,7 @@ void QgsGeometryPaintEngine::addSubpathGeometries( const QPainterPath &path, con { if ( currentX.size() > 1 ) { - std::unique_ptr< QgsLineString > line = std::make_unique< QgsLineString >( currentX, currentY ); + auto line = std::make_unique< QgsLineString >( currentX, currentY ); if ( mUsePathStroker ) { addStrokedLine( line.get(), penWidth, endCapStyle, joinStyle, miterLimit, transformIsIdentity ? nullptr : &matrix ); @@ -547,7 +547,7 @@ void QgsGeometryPaintEngine::addSubpathGeometries( const QPainterPath &path, con if ( currentX.size() > 1 ) { - std::unique_ptr< QgsLineString > line = std::make_unique< QgsLineString >( currentX, currentY ); + auto line = std::make_unique< QgsLineString >( currentX, currentY ); if ( mUsePathStroker ) { addStrokedLine( line.get(), penWidth, endCapStyle, joinStyle, miterLimit, transformIsIdentity ? nullptr : &matrix ); diff --git a/src/core/painting/qgsmaskpaintdevice.h b/src/core/painting/qgsmaskpaintdevice.h index 9f071426f6d8..52eaeda7bf62 100644 --- a/src/core/painting/qgsmaskpaintdevice.h +++ b/src/core/painting/qgsmaskpaintdevice.h @@ -31,7 +31,7 @@ class QgsMaskPaintEngine: public QPaintEngine public: - Q_DECL_DEPRECATED QgsMaskPaintEngine( bool usePathStroker = false ); + QgsMaskPaintEngine( bool usePathStroker = false ); bool begin( QPaintDevice * ) override { return true; }; bool end() override { return true; }; diff --git a/src/core/pal/feature.cpp b/src/core/pal/feature.cpp index 81d40c6868c2..ceeb53e36de9 100644 --- a/src/core/pal/feature.cpp +++ b/src/core/pal/feature.cpp @@ -1435,14 +1435,14 @@ std::unique_ptr< LabelPosition > FeaturePart::curvedPlacementAtOffset( PointSet return nullptr; auto it = placement->graphemePlacement.constBegin(); - std::unique_ptr< LabelPosition > firstPosition = std::make_unique< LabelPosition >( 0, it->x, it->y, it->width, it->height, it->angle, 0.0001, this, LabelPosition::LabelDirectionToLine::SameDirection, Qgis::LabelQuadrantPosition::Over ); + auto firstPosition = std::make_unique< LabelPosition >( 0, it->x, it->y, it->width, it->height, it->angle, 0.0001, this, LabelPosition::LabelDirectionToLine::SameDirection, Qgis::LabelQuadrantPosition::Over ); firstPosition->setUpsideDownCharCount( placement->upsideDownCharCount ); firstPosition->setPartId( it->graphemeIndex ); LabelPosition *previousPosition = firstPosition.get(); it++; while ( it != placement->graphemePlacement.constEnd() ) { - std::unique_ptr< LabelPosition > position = std::make_unique< LabelPosition >( 0, it->x, it->y, it->width, it->height, it->angle, 0.0001, this, LabelPosition::LabelDirectionToLine::SameDirection, Qgis::LabelQuadrantPosition::Over ); + auto position = std::make_unique< LabelPosition >( 0, it->x, it->y, it->width, it->height, it->angle, 0.0001, this, LabelPosition::LabelDirectionToLine::SameDirection, Qgis::LabelQuadrantPosition::Over ); position->setPartId( it->graphemeIndex ); LabelPosition *nextPosition = position.get(); @@ -1739,7 +1739,7 @@ std::size_t FeaturePart::createCurvedCandidatesAlongLine( std::vector< std::uniq labelPosition->setCost( cost ); - std::unique_ptr< LabelPosition > p = std::make_unique< LabelPosition >( *labelPosition ); + auto p = std::make_unique< LabelPosition >( *labelPosition ); if ( p && mLF->permissibleZonePrepared() ) { bool within = true; @@ -1997,7 +1997,7 @@ std::size_t FeaturePart::createCandidatesForPolygon( std::vector< std::unique_pt // but the bugs noted in CostCalculator currently prevent this if ( mapShape->containsPoint( rx, ry ) ) { - std::unique_ptr< LabelPosition > potentialCandidate = std::make_unique< LabelPosition >( id++, rx - dlx, ry - dly, labelWidth, labelHeight, alpha, 0.0001, this, LabelPosition::LabelDirectionToLine::SameDirection, Qgis::LabelQuadrantPosition::Over ); + auto potentialCandidate = std::make_unique< LabelPosition >( id++, rx - dlx, ry - dly, labelWidth, labelHeight, alpha, 0.0001, this, LabelPosition::LabelDirectionToLine::SameDirection, Qgis::LabelQuadrantPosition::Over ); // cost is set to minimal value, evaluated later lPos.emplace_back( std::move( potentialCandidate ) ); numberCandidatesGenerated++; @@ -2131,7 +2131,7 @@ std::size_t FeaturePart::createCandidatesOutsidePolygon( std::vector candidate = std::make_unique< LabelPosition >( i, labelX, labelY, labelWidth, labelHeight, labelAngle, 0, this, LabelPosition::LabelDirectionToLine::SameDirection, quadrant ); + auto candidate = std::make_unique< LabelPosition >( i, labelX, labelY, labelWidth, labelHeight, labelAngle, 0, this, LabelPosition::LabelDirectionToLine::SameDirection, quadrant ); if ( candidate->intersects( preparedBuffer.get() ) ) { // satisfy R3. Name should not cross the boundary of its area feature. diff --git a/src/core/pal/layer.cpp b/src/core/pal/layer.cpp index 7a275564396d..5b3fda155cad 100644 --- a/src/core/pal/layer.cpp +++ b/src/core/pal/layer.cpp @@ -128,7 +128,7 @@ bool Layer::registerFeature( QgsLabelFeature *lf ) throw InternalException::UnknownGeometry(); } - std::unique_ptr fpart = std::make_unique( lf, geom ); + auto fpart = std::make_unique( lf, geom ); // ignore invalid geometries if ( ( type == GEOS_LINESTRING && fpart->nbPoints < 2 ) || @@ -218,7 +218,7 @@ bool Layer::registerFeature( QgsLabelFeature *lf ) throw InternalException::UnknownGeometry(); } - std::unique_ptr fpart = std::make_unique( lf, geom.get() ); + auto fpart = std::make_unique( lf, geom.get() ); // ignore invalid geometries if ( ( type == GEOS_LINESTRING && fpart->nbPoints < 2 ) || @@ -458,7 +458,7 @@ void Layer::chopFeaturesAtRepeatDistance() GEOSCoordSeq_setXY_r( geosctxt, cooSeq, i, part[i].x, part[i].y ); } GEOSGeometry *newgeom = GEOSGeom_createLineString_r( geosctxt, cooSeq ); - std::unique_ptr< FeaturePart > newfpart = std::make_unique< FeaturePart >( fpart->feature(), newgeom ); + auto newfpart = std::make_unique< FeaturePart >( fpart->feature(), newgeom ); repeatParts.push_back( newfpart.get() ); newFeatureParts.emplace_back( std::move( newfpart ) ); break; @@ -475,7 +475,7 @@ void Layer::chopFeaturesAtRepeatDistance() } GEOSGeometry *newgeom = GEOSGeom_createLineString_r( geosctxt, cooSeq ); - std::unique_ptr< FeaturePart > newfpart = std::make_unique< FeaturePart >( fpart->feature(), newgeom ); + auto newfpart = std::make_unique< FeaturePart >( fpart->feature(), newgeom ); repeatParts.push_back( newfpart.get() ); newFeatureParts.emplace_back( std::move( newfpart ) ); part.clear(); diff --git a/src/core/pal/pal.cpp b/src/core/pal/pal.cpp index dda39bd116bf..8e8f6a1cafd3 100644 --- a/src/core/pal/pal.cpp +++ b/src/core/pal/pal.cpp @@ -88,11 +88,16 @@ Layer *Pal::addLayer( QgsAbstractLabelProvider *provider, const QString &layerNa { mMutex.lock(); - Q_ASSERT( mLayers.find( provider ) == mLayers.end() ); +#ifdef QGISDEBUG + for ( const auto &it : mLayers ) + { + Q_ASSERT( it.first != provider ); + } +#endif - std::unique_ptr< Layer > layer = std::make_unique< Layer >( provider, layerName, arrangement, defaultPriority, active, toLabel, this ); + auto layer = std::make_unique< Layer >( provider, layerName, arrangement, defaultPriority, active, toLabel, this ); Layer *res = layer.get(); - mLayers.insert( std::pair>( provider, std::move( layer ) ) ); + mLayers.emplace_back( std::make_pair( provider, std::move( layer ) ) ); mMutex.unlock(); // cppcheck-suppress returnDanglingLifetime @@ -121,7 +126,7 @@ std::unique_ptr Pal::extractProblem( const QgsRectangle &extent, const PalRtree< FeaturePart > obstacles( maxCoordinateExtentForSpatialIndices ); PalRtree< LabelPosition > allCandidatesFirstRound( maxCoordinateExtentForSpatialIndices ); std::vector< FeaturePart * > allObstacleParts; - std::unique_ptr< Problem > prob = std::make_unique< Problem >( maxCoordinateExtentForSpatialIndices ); + auto prob = std::make_unique< Problem >( maxCoordinateExtentForSpatialIndices ); double bbx[4]; double bby[4]; @@ -158,13 +163,13 @@ std::unique_ptr Pal::extractProblem( const QgsRectangle &extent, const candidateProfile = std::make_unique< QgsScopedRuntimeProfile >( QObject::tr( "Generating label candidates" ), QStringLiteral( "rendering" ) ); } - for ( const auto &it : mLayers ) + for ( auto it = mLayers.rbegin(); it != mLayers.rend(); ++it ) { index++; if ( feedback ) feedback->setProgress( index * step ); - Layer *layer = it.second.get(); + Layer *layer = it->second.get(); if ( !layer ) { // invalid layer name @@ -176,12 +181,12 @@ std::unique_ptr Pal::extractProblem( const QgsRectangle &extent, const continue; if ( feedback ) - feedback->emit candidateCreationAboutToBegin( it.first ); + feedback->emit candidateCreationAboutToBegin( it->first ); std::unique_ptr< QgsScopedRuntimeProfile > layerProfile; if ( context.flags() & Qgis::RenderContextFlag::RecordProfile ) { - layerProfile = std::make_unique< QgsScopedRuntimeProfile >( it.first->providerId(), QStringLiteral( "rendering" ) ); + layerProfile = std::make_unique< QgsScopedRuntimeProfile >( it->first->providerId(), QStringLiteral( "rendering" ) ); } // check for connected features with the same label text and join them @@ -269,7 +274,7 @@ std::unique_ptr Pal::extractProblem( const QgsRectangle &extent, const std::sort( candidates.begin(), candidates.end(), CostCalculator::candidateSortGrow ); // valid features are added to fFeats - std::unique_ptr< Feats > ft = std::make_unique< Feats >(); + auto ft = std::make_unique< Feats >(); ft->feature = featurePart.get(); ft->shape = nullptr; ft->candidates = std::move( candidates ); @@ -291,7 +296,7 @@ std::unique_ptr Pal::extractProblem( const QgsRectangle &extent, const candidates.emplace_back( std::move( unplacedPosition ) ); // valid features are added to fFeats - std::unique_ptr< Feats > ft = std::make_unique< Feats >(); + auto ft = std::make_unique< Feats >(); ft->feature = featurePart.get(); ft->shape = nullptr; ft->candidates = std::move( candidates ); @@ -333,7 +338,7 @@ std::unique_ptr Pal::extractProblem( const QgsRectangle &extent, const previousObstacleCount = obstacleCount; if ( feedback ) - feedback->emit candidateCreationFinished( it.first ); + feedback->emit candidateCreationFinished( it->first ); } candidateProfile.reset(); diff --git a/src/core/pal/pal.h b/src/core/pal/pal.h index 0f8a2192b351..dc9c5991a5c7 100644 --- a/src/core/pal/pal.h +++ b/src/core/pal/pal.h @@ -279,7 +279,7 @@ namespace pal private: - std::unordered_map< QgsAbstractLabelProvider *, std::unique_ptr< Layer > > mLayers; + std::vector< std::pair< QgsAbstractLabelProvider *, std::unique_ptr< Layer > > > mLayers; QList< QgsAbstractLabelingEngineRule * > mRules; diff --git a/src/core/pal/pointset.cpp b/src/core/pal/pointset.cpp index 64fa7aa85e69..91f98bd73634 100644 --- a/src/core/pal/pointset.cpp +++ b/src/core/pal/pointset.cpp @@ -240,7 +240,7 @@ std::unique_ptr PointSet::extractShape( int nbPtSh, int imin, int imax { int i, j; - std::unique_ptr newShape = std::make_unique< PointSet >(); + auto newShape = std::make_unique< PointSet >(); newShape->type = GEOS_POLYGON; newShape->nbPoints = nbPtSh; newShape->x.resize( newShape->nbPoints ); diff --git a/src/core/plot/qgsplot.cpp b/src/core/plot/qgsplot.cpp index 31582f95fa70..d7315b84a5ae 100644 --- a/src/core/plot/qgsplot.cpp +++ b/src/core/plot/qgsplot.cpp @@ -784,26 +784,26 @@ QgsNumericFormat *QgsPlotDefaultSettings::axisLabelNumericFormat() QgsLineSymbol *QgsPlotDefaultSettings::axisGridMajorSymbol() { - std::unique_ptr< QgsSimpleLineSymbolLayer > gridMajor = std::make_unique< QgsSimpleLineSymbolLayer >( QColor( 20, 20, 20, 150 ), 0.1 ); + auto gridMajor = std::make_unique< QgsSimpleLineSymbolLayer >( QColor( 20, 20, 20, 150 ), 0.1 ); gridMajor->setPenCapStyle( Qt::FlatCap ); return new QgsLineSymbol( QgsSymbolLayerList( { gridMajor.release() } ) ); } QgsLineSymbol *QgsPlotDefaultSettings::axisGridMinorSymbol() { - std::unique_ptr< QgsSimpleLineSymbolLayer > gridMinor = std::make_unique< QgsSimpleLineSymbolLayer >( QColor( 20, 20, 20, 50 ), 0.1 ); + auto gridMinor = std::make_unique< QgsSimpleLineSymbolLayer >( QColor( 20, 20, 20, 50 ), 0.1 ); gridMinor->setPenCapStyle( Qt::FlatCap ); return new QgsLineSymbol( QgsSymbolLayerList( { gridMinor.release() } ) ); } QgsFillSymbol *QgsPlotDefaultSettings::chartBackgroundSymbol() { - std::unique_ptr< QgsSimpleFillSymbolLayer > chartFill = std::make_unique< QgsSimpleFillSymbolLayer >( QColor( 255, 255, 255 ) ); + auto chartFill = std::make_unique< QgsSimpleFillSymbolLayer >( QColor( 255, 255, 255 ) ); return new QgsFillSymbol( QgsSymbolLayerList( { chartFill.release() } ) ); } QgsFillSymbol *QgsPlotDefaultSettings::chartBorderSymbol() { - std::unique_ptr< QgsSimpleLineSymbolLayer > chartBorder = std::make_unique< QgsSimpleLineSymbolLayer >( QColor( 20, 20, 20 ), 0.1 ); + auto chartBorder = std::make_unique< QgsSimpleLineSymbolLayer >( QColor( 20, 20, 20 ), 0.1 ); return new QgsFillSymbol( QgsSymbolLayerList( { chartBorder.release() } ) ); } diff --git a/src/core/pointcloud/qgscopcpointcloudindex.cpp b/src/core/pointcloud/qgscopcpointcloudindex.cpp index 3cd5f3dfe8fe..54ee395d9a15 100644 --- a/src/core/pointcloud/qgscopcpointcloudindex.cpp +++ b/src/core/pointcloud/qgscopcpointcloudindex.cpp @@ -134,7 +134,7 @@ bool QgsCopcPointCloudIndex::loadSchema( QgsLazInfo &lazInfo ) // TODO: Rounding? mSpan = mRootBounds.width() / mCopcInfoVlr.spacing; -#ifdef QGIS_DEBUG +#ifdef QGISDEBUG double dx = xmax - xmin, dy = ymax - ymin, dz = zmax - zmin; QgsDebugMsgLevel( QStringLiteral( "lvl0 node size in CRS units: %1 %2 %3" ).arg( dx ).arg( dy ).arg( dz ), 2 ); // all dims should be the same QgsDebugMsgLevel( QStringLiteral( "res at lvl0 %1" ).arg( dx / mSpan ), 2 ); @@ -166,7 +166,7 @@ std::unique_ptr QgsCopcPointCloudIndex::nodeData( const QgsP // we need to create a copy of the expression to pass to the decoder // as the same QgsPointCloudExpression object mighgt be concurrently // used on another thread, for example in a 3d view - QgsPointCloudExpression filterExpression = mFilterExpression; + QgsPointCloudExpression filterExpression = request.ignoreIndexFilterEnabled() ? QgsPointCloudExpression() : mFilterExpression; QgsPointCloudAttributeCollection requestAttributes = request.attributes(); requestAttributes.extend( attributes(), filterExpression.referencedAttributes() ); @@ -221,7 +221,7 @@ QgsPointCloudBlockRequest *QgsCopcPointCloudIndex::asyncNodeData( const QgsPoint // we need to create a copy of the expression to pass to the decoder // as the same QgsPointCloudExpression object might be concurrently // used on another thread, for example in a 3d view - QgsPointCloudExpression filterExpression = mFilterExpression; + QgsPointCloudExpression filterExpression = request.ignoreIndexFilterEnabled() ? QgsPointCloudExpression() : mFilterExpression; QgsPointCloudAttributeCollection requestAttributes = request.attributes(); requestAttributes.extend( attributes(), filterExpression.referencedAttributes() ); auto [ blockOffset, blockSize ] = mHierarchyNodePos.value( n ); @@ -512,6 +512,30 @@ QByteArray QgsCopcPointCloudIndex::fetchCopcStatisticsEvlrData() const return statisticsEvlrData; } +void QgsCopcPointCloudIndex::reset() +{ + // QgsAbstractPointCloudIndex + mExtent = QgsRectangle(); + mZMin = 0; + mZMax = 0; + mHierarchy.clear(); + mScale = QgsVector3D(); + mOffset = QgsVector3D(); + mRootBounds = QgsBox3D(); + mAttributes = QgsPointCloudAttributeCollection(); + mSpan = 0; + mError.clear(); + + // QgsCopcPointCloudIndex + mIsValid = false; + mAccessType = Qgis::PointCloudAccessType::Local; + mCopcFile.close(); + mOriginalMetadata.clear(); + mStatistics.reset(); + mLazInfo.reset(); + mHierarchyNodePos.clear(); +} + QVariantMap QgsCopcPointCloudIndex::extraMetadata() const { return diff --git a/src/core/pointcloud/qgscopcpointcloudindex.h b/src/core/pointcloud/qgscopcpointcloudindex.h index 8d02b0f1622e..7b8b0459a999 100644 --- a/src/core/pointcloud/qgscopcpointcloudindex.h +++ b/src/core/pointcloud/qgscopcpointcloudindex.h @@ -109,6 +109,8 @@ class CORE_EXPORT QgsCopcPointCloudIndex: public QgsAbstractPointCloudIndex QByteArray fetchCopcStatisticsEvlrData() const; + void reset(); + bool mIsValid = false; Qgis::PointCloudAccessType mAccessType = Qgis::PointCloudAccessType::Local; mutable std::ifstream mCopcFile; @@ -119,6 +121,10 @@ class CORE_EXPORT QgsCopcPointCloudIndex: public QgsAbstractPointCloudIndex mutable std::optional mStatistics; std::unique_ptr mLazInfo = nullptr; + + friend class QgsPointCloudLayerEditUtils; + friend class QgsPointCloudEditingIndex; + friend class QgsPointCloudLayerUndoCommandChangeAttribute; }; ///@endcond diff --git a/src/core/pointcloud/qgscopcupdate.cpp b/src/core/pointcloud/qgscopcupdate.cpp new file mode 100644 index 000000000000..047880aaef75 --- /dev/null +++ b/src/core/pointcloud/qgscopcupdate.cpp @@ -0,0 +1,395 @@ +/*************************************************************************** + qgscopcupdate.cpp + --------------------- + begin : January 2025 + copyright : (C) 2025 by Martin Dobias + email : wonder dot sk at gmail dot com + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "qgscopcupdate.h" + +#include "qgslazdecoder.h" + +#include +#include + +#include +#include +#include +#include +#include +#include + + +//! Keeps one entry of COPC hierarchy +struct HierarchyEntry +{ + //! Key of the data to which this entry corresponds + QgsPointCloudNodeId key; + + /** + * Absolute offset to the data chunk if the pointCount > 0. + * Absolute offset to a child hierarchy page if the pointCount is -1. + * 0 if the pointCount is 0. + */ + uint64_t offset; + + /** + * Size of the data chunk in bytes (compressed size) if the pointCount > 0. + * Size of the hierarchy page if the pointCount is -1. + * 0 if the pointCount is 0. + */ + int32_t byteSize; + + /** + * If > 0, represents the number of points in the data chunk. + * If -1, indicates the information for this octree node is found in another hierarchy page. + * If 0, no point data exists for this key, though may exist for child entries. + */ + int32_t pointCount; +}; + +typedef QVector HierarchyEntries; + + +HierarchyEntries getHierarchyPage( std::ifstream &file, uint64_t offset, uint64_t size ) +{ + HierarchyEntries page; + std::vector buf( 32 ); + int numEntries = static_cast( size / 32 ); + file.seekg( static_cast( offset ) ); + while ( numEntries-- ) + { + file.read( buf.data(), static_cast( buf.size() ) ); + lazperf::LeExtractor s( buf.data(), buf.size() ); + + HierarchyEntry e; + int d, x, y, z; + s >> d >> x >> y >> z; + s >> e.offset >> e.byteSize >> e.pointCount; + e.key = QgsPointCloudNodeId( d, x, y, z ); + + page.push_back( e ); + } + return page; +} + + +bool QgsCopcUpdate::write( const QString &outputFilename, const QHash &updatedChunks ) +{ + std::ofstream m_f; + m_f.open( QgsLazDecoder::toNativePath( outputFilename ), std::ios::out | std::ios::binary ); + + // write header and all VLRs all the way to point offset + // (then we patch what we need) + mFile.seekg( 0 ); + std::vector allHeaderData; + allHeaderData.resize( mHeader.point_offset ); + mFile.read( allHeaderData.data(), static_cast( allHeaderData.size() ) ); + m_f.write( allHeaderData.data(), static_cast( allHeaderData.size() ) ); + + m_f.write( "XXXXXXXX", 8 ); // placeholder for chunk table offset + + uint64_t currentChunkOffset = mHeader.point_offset + 8; + mFile.seekg( static_cast( currentChunkOffset ) ); // this is where first chunk starts + + // now, let's write chunks: + // - iterate through original chunk table, write out chunks + // - if chunk is updated, use that instead + // - keep updating hierarchy as we go + // - keep updating chunk table as we go + + QHash voxelToNewOffset; + + int chIndex = 0; + for ( lazperf::chunk ch : mChunks ) + { + Q_ASSERT( mOffsetToVoxel.contains( currentChunkOffset ) ); + QgsPointCloudNodeId n = mOffsetToVoxel[currentChunkOffset]; + + uint64_t newOffset = m_f.tellp(); + voxelToNewOffset[n] = newOffset; + + // check whether the chunk is modified + if ( updatedChunks.contains( n ) ) + { + const UpdatedChunk &updatedChunk = updatedChunks[n]; + + // use updated one and skip in the original file + mFile.seekg( static_cast( mFile.tellg() ) + static_cast( ch.offset ) ); + + m_f.write( updatedChunk.chunkData.constData(), updatedChunk.chunkData.size() ); + + // update sizes + mChunks[chIndex].offset = updatedChunk.chunkData.size(); + } + else + { + // use as is + std::vector originalChunkData; + originalChunkData.resize( ch.offset ); + mFile.read( originalChunkData.data(), static_cast( originalChunkData.size() ) ); + m_f.write( originalChunkData.data(), static_cast( originalChunkData.size() ) ); + } + + currentChunkOffset += ch.offset; + ++chIndex; + } + + // write chunk table: size in bytes + point count of each chunk + + const uint64_t newChunkTableOffset = m_f.tellp(); + + m_f.write( "\0\0\0\0", 4 ); // chunk table version + m_f.write( reinterpret_cast( &mChunkCount ), sizeof( mChunkCount ) ); + + lazperf::OutFileStream outStream( m_f ); + lazperf::compress_chunk_table( outStream.cb(), mChunks, true ); + + // update hierarchy + + // NOTE: one big assumption we're doing here is that existing hierarchy pages + // are packed one after another, with no gaps. if that's not the case, things + // will break apart + + const long hierPositionShift = static_cast( m_f.tellp() ) + 60 - static_cast( mHierarchyOffset ); + + HierarchyEntry *oldCopcHierarchyBlobEntries = reinterpret_cast( mHierarchyBlob.data() ); + const int nEntries = static_cast( mHierarchyBlob.size() / 32 ); + for ( int i = 0; i < nEntries; ++i ) + { + HierarchyEntry &e = oldCopcHierarchyBlobEntries[i]; + if ( e.pointCount > 0 ) + { + // update entry to new offset + Q_ASSERT( voxelToNewOffset.contains( e.key ) ); + e.offset = voxelToNewOffset[e.key]; + + if ( updatedChunks.contains( e.key ) ) + { + uint64_t newByteSize = updatedChunks[e.key].chunkData.size(); + e.byteSize = static_cast( newByteSize ); + } + } + else if ( e.pointCount < 0 ) + { + // move hierarchy pages to new offset + e.offset += hierPositionShift; + } + else // pointCount == 0 + { + // nothing to do - byte size and offset should be zero + } + + } + + // write hierarchy eVLR + + const uint64_t newEvlrOffset = m_f.tellp(); + + lazperf::evlr_header outCopcHierEvlr; + outCopcHierEvlr.reserved = 0; + outCopcHierEvlr.user_id = "copc"; + outCopcHierEvlr.record_id = 1000; + outCopcHierEvlr.data_length = mHierarchyBlob.size(); + outCopcHierEvlr.description = "EPT Hierarchy"; + + outCopcHierEvlr.write( m_f ); + m_f.write( mHierarchyBlob.data(), static_cast( mHierarchyBlob.size() ) ); + + // write other eVLRs + + for ( size_t i = 0; i < mEvlrHeaders.size(); ++i ) + { + lazperf::evlr_header evlrHeader = mEvlrHeaders[i]; + std::vector evlrBody = mEvlrData[i]; + + evlrHeader.write( m_f ); + m_f.write( evlrBody.data(), static_cast( evlrBody.size() ) ); + } + + // patch header + + m_f.seekp( 235 ); + m_f.write( reinterpret_cast( &newEvlrOffset ), 8 ); + + const uint64_t newRootHierOffset = mCopcVlr.root_hier_offset + hierPositionShift; + m_f.seekp( 469 ); + m_f.write( reinterpret_cast( &newRootHierOffset ), 8 ); + + m_f.seekp( mHeader.point_offset ); + m_f.write( reinterpret_cast( &newChunkTableOffset ), 8 ); + + return true; +} + + + +bool QgsCopcUpdate::read( const QString &inputFilename ) +{ + mInputFilename = inputFilename; + + mFile.open( QgsLazDecoder::toNativePath( inputFilename ), std::ios::binary | std::ios::in ); + if ( mFile.fail() ) + { + mErrorMessage = QStringLiteral( "Could not open file for reading: %1" ).arg( inputFilename ); + return false; + } + + if ( !readHeader() ) + return false; + + readChunkTable(); + readHierarchy(); + + return true; +} + + +bool QgsCopcUpdate::readHeader() +{ + // read header and COPC VLR + mHeader = lazperf::header14::create( mFile ); + if ( !mFile ) + { + mErrorMessage = QStringLiteral( "Error reading COPC header" ); + return false; + } + + lazperf::vlr_header vh = lazperf::vlr_header::create( mFile ); + mCopcVlr = lazperf::copc_info_vlr::create( mFile ); + + int baseCount = lazperf::baseCount( mHeader.point_format_id ); + if ( baseCount == 0 ) + { + mErrorMessage = QStringLiteral( "Bad point record format: %1" ).arg( mHeader.point_format_id ); + return false; + } + + return true; +} + + +void QgsCopcUpdate::readChunkTable() +{ + uint64_t chunkTableOffset; + + mFile.seekg( mHeader.point_offset ); + mFile.read( reinterpret_cast( &chunkTableOffset ), sizeof( chunkTableOffset ) ); + mFile.seekg( static_cast( chunkTableOffset ) + 4 ); // The first 4 bytes are the version, then the chunk count. + mFile.read( reinterpret_cast( &mChunkCount ), sizeof( mChunkCount ) ); + + // + // read chunk table + // + + bool variable = true; + + // TODO: not sure why, but after decompress_chunk_table() the input stream seems to be dead, so we create a temporary one + std::ifstream copcFileTmp; + copcFileTmp.open( QgsLazDecoder::toNativePath( mInputFilename ), std::ios::binary | std::ios::in ); + copcFileTmp.seekg( mFile.tellg() ); + lazperf::InFileStream copcInFileStream( copcFileTmp ); + + mChunks = lazperf::decompress_chunk_table( copcInFileStream.cb(), mChunkCount, variable ); + std::vector chunksWithAbsoluteOffsets; + uint64_t nextChunkOffset = mHeader.point_offset + 8; + for ( lazperf::chunk ch : mChunks ) + { + chunksWithAbsoluteOffsets.push_back( {nextChunkOffset, ch.count} ); + nextChunkOffset += ch.offset; + } +} + + +void QgsCopcUpdate::readHierarchy() +{ + // get all hierarchy pages + + HierarchyEntries childEntriesToProcess; + childEntriesToProcess.push_back( HierarchyEntry + { + QgsPointCloudNodeId( 0, 0, 0, 0 ), + mCopcVlr.root_hier_offset, + static_cast( mCopcVlr.root_hier_size ), + -1 } ); + + while ( !childEntriesToProcess.empty() ) + { + HierarchyEntry childEntry = childEntriesToProcess.back(); + childEntriesToProcess.pop_back(); + + HierarchyEntries page = getHierarchyPage( mFile, childEntry.offset, childEntry.byteSize ); + + for ( const HierarchyEntry &e : page ) + { + if ( e.pointCount > 0 ) // it's a non-empty node + { + Q_ASSERT( !mOffsetToVoxel.contains( e.offset ) ); + mOffsetToVoxel[e.offset] = e.key; + } + else if ( e.pointCount < 0 ) // referring to a child page + { + childEntriesToProcess.push_back( e ); + } + } + } + + lazperf::evlr_header evlr1; + mFile.seekg( static_cast( mHeader.evlr_offset ) ); + + mHierarchyOffset = 0; // where the hierarchy eVLR payload starts + + for ( uint32_t i = 0; i < mHeader.evlr_count; ++i ) + { + evlr1.read( mFile ); + if ( evlr1.user_id == "copc" && evlr1.record_id == 1000 ) + { + mHierarchyBlob.resize( evlr1.data_length ); + mHierarchyOffset = mFile.tellg(); + mFile.read( mHierarchyBlob.data(), static_cast( evlr1.data_length ) ); + } + else + { + // keep for later + mEvlrHeaders.push_back( evlr1 ); + std::vector evlrBlob; + evlrBlob.resize( evlr1.data_length ); + mFile.read( evlrBlob.data(), static_cast( evlrBlob.size() ) ); + mEvlrData.push_back( evlrBlob ); + } + } + + Q_ASSERT( !mHierarchyBlob.empty() ); +} + + +bool QgsCopcUpdate::writeUpdatedFile( const QString &inputFilename, + const QString &outputFilename, + const QHash &updatedChunks, + QString *errorMessage ) +{ + QgsCopcUpdate copcUpdate; + if ( !copcUpdate.read( inputFilename ) ) + { + if ( errorMessage ) + *errorMessage = copcUpdate.errorMessage(); + return false; + } + + if ( !copcUpdate.write( outputFilename, updatedChunks ) ) + { + if ( errorMessage ) + *errorMessage = copcUpdate.errorMessage(); + return false; + } + + return true; +} diff --git a/src/core/pointcloud/qgscopcupdate.h b/src/core/pointcloud/qgscopcupdate.h new file mode 100644 index 000000000000..e0a853022953 --- /dev/null +++ b/src/core/pointcloud/qgscopcupdate.h @@ -0,0 +1,93 @@ +/*************************************************************************** + qgscopcupdate.h + --------------------- + begin : January 2025 + copyright : (C) 2025 by Martin Dobias + email : wonder dot sk at gmail dot com + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef QGSCOPCUPDATE_H +#define QGSCOPCUPDATE_H + +#include "qgis_core.h" +#include "qgspointcloudindex.h" + +#include +#include + +#define SIP_NO_FILE + + +/** + * \ingroup core + * + * This class takes an existing COPC file and a list of chunks that should be modified, + * and outputs an updated COPC file where the modified chunks replace the original chunks. + * + * \note The API is considered EXPERIMENTAL and can be changed without a notice + * + * \since QGIS 3.42 + */ +class CORE_EXPORT QgsCopcUpdate +{ + public: + + //! Keeps information how points of a single chunk has been modified + struct UpdatedChunk + { + //! Number of points in the updated chunk + int32_t pointCount; + //! Data of the chunk (compressed already with LAZ compressor) + QByteArray chunkData; + }; + + //! Reads input COPC file and initializes all the members + bool read( const QString &inputFilename ); + + //! Writes a COPC file with updated chunks + bool write( const QString &outputFilename, const QHash &updatedChunks ); + + //! Returns error message + QString errorMessage() const { return mErrorMessage; } + + /** + * Convenience function to do the whole process in one go: + * load a COPC file, then write a new COPC file with updated + * chunks. Returns TRUE on success. If errorMessage is not + * a null pointer, it will be set to an error message in case + * of failure (i.e. FALSE is returned). + */ + static bool writeUpdatedFile( const QString &inputFilename, + const QString &outputFilename, + const QHash &updatedChunks, + QString *errorMessage = nullptr ); + + private: + bool readHeader(); + void readChunkTable(); + void readHierarchy(); + + private: + QString mInputFilename; + std::ifstream mFile; + lazperf::header14 mHeader; + lazperf::copc_info_vlr mCopcVlr; + std::vector mChunks; + uint32_t mChunkCount = 0; + uint64_t mHierarchyOffset = 0; + std::vector mHierarchyBlob; + std::vector mEvlrHeaders; + std::vector> mEvlrData; + QHash mOffsetToVoxel; + + QString mErrorMessage; +}; + +#endif // QGSCOPCUPDATE_H diff --git a/src/core/pointcloud/qgseptdecoder.cpp b/src/core/pointcloud/qgseptdecoder.cpp index 407d71e17d70..eb6b83121da9 100644 --- a/src/core/pointcloud/qgseptdecoder.cpp +++ b/src/core/pointcloud/qgseptdecoder.cpp @@ -75,11 +75,11 @@ std::unique_ptr decompressBinary_( const QByteArray &dataUnc } int skippedPoints = 0; - std::unique_ptr< QgsPointCloudBlock > block = std::make_unique< QgsPointCloudBlock >( - count, - requestedAttributes, - data, scale, offset - ); + auto block = std::make_unique< QgsPointCloudBlock >( + count, + requestedAttributes, + data, scale, offset + ); const bool filterIsValid = filterExpression.isValid(); if ( !filterExpression.prepare( block.get() ) && filterIsValid ) diff --git a/src/core/pointcloud/qgseptpointcloudindex.cpp b/src/core/pointcloud/qgseptpointcloudindex.cpp index fb2c8f22fd92..7f23e4e9f0ac 100644 --- a/src/core/pointcloud/qgseptpointcloudindex.cpp +++ b/src/core/pointcloud/qgseptpointcloudindex.cpp @@ -358,7 +358,7 @@ bool QgsEptPointCloudIndex::loadSchema( const QByteArray &dataJson ) mRootBounds = QgsBox3D( xmin, ymin, zmin, xmax, ymax, zmax ); -#ifdef QGIS_DEBUG +#ifdef QGISDEBUG double dx = xmax - xmin, dy = ymax - ymin, dz = zmax - zmin; QgsDebugMsgLevel( QStringLiteral( "lvl0 node size in CRS units: %1 %2 %3" ).arg( dx ).arg( dy ).arg( dz ), 2 ); // all dims should be the same QgsDebugMsgLevel( QStringLiteral( "res at lvl0 %1" ).arg( dx / mSpan ), 2 ); @@ -398,7 +398,7 @@ std::unique_ptr QgsEptPointCloudIndex::nodeData( const QgsPo // we need to create a copy of the expression to pass to the decoder // as the same QgsPointCloudExpression object mighgt be concurrently // used on another thread, for example in a 3d view - QgsPointCloudExpression filterExpression = mFilterExpression; + QgsPointCloudExpression filterExpression = request.ignoreIndexFilterEnabled() ? QgsPointCloudExpression() : mFilterExpression; QgsPointCloudAttributeCollection requestAttributes = request.attributes(); requestAttributes.extend( attributes(), filterExpression.referencedAttributes() ); QgsRectangle filterRect = request.filterRect(); @@ -459,7 +459,7 @@ QgsPointCloudBlockRequest *QgsEptPointCloudIndex::asyncNodeData( const QgsPointC // we need to create a copy of the expression to pass to the decoder // as the same QgsPointCloudExpression object might be concurrently // used on another thread, for example in a 3d view - QgsPointCloudExpression filterExpression = mFilterExpression; + QgsPointCloudExpression filterExpression = request.ignoreIndexFilterEnabled() ? QgsPointCloudExpression() : mFilterExpression; QgsPointCloudAttributeCollection requestAttributes = request.attributes(); requestAttributes.extend( attributes(), filterExpression.referencedAttributes() ); return new QgsEptPointCloudBlockRequest( n, fileUrl, mDataType, attributes(), requestAttributes, scale(), offset(), filterExpression, request.filterRect() ); diff --git a/src/core/pointcloud/qgslazdecoder.cpp b/src/core/pointcloud/qgslazdecoder.cpp index ecda055d01dc..4109c0c1f5e1 100644 --- a/src/core/pointcloud/qgslazdecoder.cpp +++ b/src/core/pointcloud/qgslazdecoder.cpp @@ -186,11 +186,6 @@ bool lazSerialize_( char *data, size_t outputPosition, QgsPointCloudAttribute::D return true; } -bool lazStoreDoubleToStream( char *s, size_t position, QgsPointCloudAttribute::DataType type, double value ) -{ - return lazStoreToStream_( s, position, type, value ); -} - // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// std::vector< QgsLazDecoder::RequestedAttributeDetails > prepareRequestedAttributeDetails_( const QgsPointCloudAttributeCollection &requestedAttributes, QVector &extrabytesAttr ) @@ -562,11 +557,11 @@ std::unique_ptr decompressLaz_( FileType &file, const QgsPoi std::size_t outputOffset = 0; - std::unique_ptr< QgsPointCloudBlock > block = std::make_unique< QgsPointCloudBlock >( - count, - requestedAttributes, - data, scale, offset - ); + auto block = std::make_unique< QgsPointCloudBlock >( + count, + requestedAttributes, + data, scale, offset + ); int skippedPoints = 0; const bool filterIsValid = filterExpression.isValid(); @@ -677,10 +672,10 @@ std::unique_ptr QgsLazDecoder::decompressCopc( const QByteAr QVector extrabyteAttributesDetails = lazInfo.extrabytes(); std::vector< RequestedAttributeDetails > requestedAttributeDetails = prepareRequestedAttributeDetails_( requestedAttributes, extrabyteAttributesDetails ); - std::unique_ptr< QgsPointCloudBlock > block = std::make_unique< QgsPointCloudBlock >( - pointCount, requestedAttributes, - blockData, lazInfo.scale(), lazInfo.offset() - ); + auto block = std::make_unique< QgsPointCloudBlock >( + pointCount, requestedAttributes, + blockData, lazInfo.scale(), lazInfo.offset() + ); int skippedPoints = 0; const bool filterIsValid = filterExpression.isValid(); diff --git a/src/core/pointcloud/qgslazdecoder.h b/src/core/pointcloud/qgslazdecoder.h index 03361c949e6e..bb49e7703cf1 100644 --- a/src/core/pointcloud/qgslazdecoder.h +++ b/src/core/pointcloud/qgslazdecoder.h @@ -37,7 +37,6 @@ template bool lazStoreToStream_( char *s, size_t position, QgsPointCloudAttribute::DataType type, T value ); bool lazSerialize_( char *data, size_t outputPosition, QgsPointCloudAttribute::DataType outputType, const char *input, QgsPointCloudAttribute::DataType inputType, int inputSize, size_t inputPosition ); -bool lazStoreDoubleToStream( char *s, size_t position, QgsPointCloudAttribute::DataType type, double value ); class QgsLazDecoder { diff --git a/src/core/pointcloud/qgspointcloudattributebyramprenderer.cpp b/src/core/pointcloud/qgspointcloudattributebyramprenderer.cpp index ad07f19315a4..a9ecfb31b675 100644 --- a/src/core/pointcloud/qgspointcloudattributebyramprenderer.cpp +++ b/src/core/pointcloud/qgspointcloudattributebyramprenderer.cpp @@ -36,7 +36,7 @@ QString QgsPointCloudAttributeByRampRenderer::type() const QgsPointCloudRenderer *QgsPointCloudAttributeByRampRenderer::clone() const { - std::unique_ptr< QgsPointCloudAttributeByRampRenderer > res = std::make_unique< QgsPointCloudAttributeByRampRenderer >(); + auto res = std::make_unique< QgsPointCloudAttributeByRampRenderer >(); res->mAttribute = mAttribute; res->mColorRampShader = mColorRampShader; res->mMin = mMin; @@ -151,7 +151,7 @@ void QgsPointCloudAttributeByRampRenderer::renderBlock( const QgsPointCloudBlock QgsPointCloudRenderer *QgsPointCloudAttributeByRampRenderer::create( QDomElement &element, const QgsReadWriteContext &context ) { - std::unique_ptr< QgsPointCloudAttributeByRampRenderer > r = std::make_unique< QgsPointCloudAttributeByRampRenderer >(); + auto r = std::make_unique< QgsPointCloudAttributeByRampRenderer >(); r->setAttribute( element.attribute( QStringLiteral( "attribute" ), QStringLiteral( "Intensity" ) ) ); @@ -269,7 +269,7 @@ void QgsPointCloudAttributeByRampRenderer::setMaximum( double value ) std::unique_ptr QgsPointCloudAttributeByRampRenderer::prepare() { - std::unique_ptr< QgsPointCloudAttributeByRampRendererPreparedData> data = std::make_unique< QgsPointCloudAttributeByRampRendererPreparedData >(); + auto data = std::make_unique< QgsPointCloudAttributeByRampRendererPreparedData >(); data->attributeName = mAttribute; data->colorRampShader = mColorRampShader; diff --git a/src/core/pointcloud/qgspointcloudclassifiedrenderer.cpp b/src/core/pointcloud/qgspointcloudclassifiedrenderer.cpp index d64a076e0a49..46703a82960d 100644 --- a/src/core/pointcloud/qgspointcloudclassifiedrenderer.cpp +++ b/src/core/pointcloud/qgspointcloudclassifiedrenderer.cpp @@ -58,7 +58,7 @@ QString QgsPointCloudClassifiedRenderer::type() const QgsPointCloudRenderer *QgsPointCloudClassifiedRenderer::clone() const { - std::unique_ptr< QgsPointCloudClassifiedRenderer > res = std::make_unique< QgsPointCloudClassifiedRenderer >(); + auto res = std::make_unique< QgsPointCloudClassifiedRenderer >(); res->mAttribute = mAttribute; res->mCategories = mCategories; @@ -186,7 +186,7 @@ bool QgsPointCloudClassifiedRenderer::willRenderPoint( const QVariantMap &pointA QgsPointCloudRenderer *QgsPointCloudClassifiedRenderer::create( QDomElement &element, const QgsReadWriteContext &context ) { - std::unique_ptr< QgsPointCloudClassifiedRenderer > r = std::make_unique< QgsPointCloudClassifiedRenderer >(); + auto r = std::make_unique< QgsPointCloudClassifiedRenderer >(); r->setAttribute( element.attribute( QStringLiteral( "attribute" ), QStringLiteral( "Classification" ) ) ); @@ -353,7 +353,7 @@ void QgsPointCloudClassifiedRenderer::addCategory( const QgsPointCloudCategory & std::unique_ptr QgsPointCloudClassifiedRenderer::prepare() { - std::unique_ptr< QgsPointCloudClassifiedRendererPreparedData > data = std::make_unique< QgsPointCloudClassifiedRendererPreparedData >(); + auto data = std::make_unique< QgsPointCloudClassifiedRendererPreparedData >(); data->attributeName = mAttribute; for ( const QgsPointCloudCategory &category : std::as_const( mCategories ) ) diff --git a/src/core/pointcloud/qgspointclouddataprovider.cpp b/src/core/pointcloud/qgspointclouddataprovider.cpp index 05c1db4be8a9..ddcba70b738a 100644 --- a/src/core/pointcloud/qgspointclouddataprovider.cpp +++ b/src/core/pointcloud/qgspointclouddataprovider.cpp @@ -236,7 +236,7 @@ struct MapIndexedPointCloudNode const QgsPointCloudAttribute::DataType xType = blockAttributes.find( QStringLiteral( "X" ), xOffset )->type(); const QgsPointCloudAttribute::DataType yType = blockAttributes.find( QStringLiteral( "Y" ), yOffset )->type(); const QgsPointCloudAttribute::DataType zType = blockAttributes.find( QStringLiteral( "Z" ), zOffset )->type(); - std::unique_ptr< QgsGeos > extentEngine = std::make_unique< QgsGeos >( mExtentGeometry.constGet() ); + auto extentEngine = std::make_unique< QgsGeos >( mExtentGeometry.constGet() ); extentEngine->prepareGeometry(); std::optional copcTimeFlag = std::nullopt; diff --git a/src/core/pointcloud/qgspointcloudeditingindex.cpp b/src/core/pointcloud/qgspointcloudeditingindex.cpp index b1fe6fd29051..913a83de5a36 100644 --- a/src/core/pointcloud/qgspointcloudeditingindex.cpp +++ b/src/core/pointcloud/qgspointcloudeditingindex.cpp @@ -17,6 +17,12 @@ #include "qgspointcloudlayer.h" #include "qgspointcloudlayereditutils.h" #include "qgscoordinatereferencesystem.h" +#include "qgscopcpointcloudindex.h" +#include "qgscopcupdate.h" +#include "qgslazdecoder.h" + +#include +#include QgsPointCloudEditingIndex::QgsPointCloudEditingIndex( QgsPointCloudLayer *layer ) @@ -27,6 +33,7 @@ QgsPointCloudEditingIndex::QgsPointCloudEditingIndex( QgsPointCloudLayer *layer !( layer->dataProvider()->capabilities() & QgsPointCloudDataProvider::Capability::ChangeAttributeValues ) ) return; + mUri = layer->source(); mIndex = layer->dataProvider()->index(); mAttributes = mIndex.attributes(); @@ -85,22 +92,36 @@ QgsPointCloudNode QgsPointCloudEditingIndex::getNode( const QgsPointCloudNodeId return mIndex.getNode( id ); } +bool QgsPointCloudEditingIndex::setSubsetString( const QString &subset ) +{ + return mIndex.setSubsetString( subset ); +} + +QString QgsPointCloudEditingIndex::subsetString() const +{ + return mIndex.subsetString(); +} + std::unique_ptr< QgsPointCloudBlock > QgsPointCloudEditingIndex::nodeData( const QgsPointCloudNodeId &n, const QgsPointCloudRequest &request ) { if ( mEditedNodeData.contains( n ) ) { - const QByteArray data = mEditedNodeData.value( n ); - int nPoints = data.size() / mIndex.attributes().pointRecordSize(); - - const QByteArray requestedData = QgsPointCloudLayerEditUtils::dataForAttributes( mIndex.attributes(), data, request ); - - std::unique_ptr block = std::make_unique< QgsPointCloudBlock >( - nPoints, - request.attributes(), - requestedData, - mIndex.scale(), - mIndex.offset() ); - return block; + // we need to create a copy of the expression to pass to the decoder + // as the same QgsPointCloudExpression object mighgt be concurrently + // used on another thread, for example in a 3d view + QgsPointCloudExpression filterExpression = QgsPointCloudExpression( request.ignoreIndexFilterEnabled() ? QString() : subsetString() ); + QgsPointCloudAttributeCollection requestAttributes = request.attributes(); + requestAttributes.extend( attributes(), filterExpression.referencedAttributes() ); + + QgsRectangle filterRect = request.filterRect(); + + QByteArray rawBlockData = mEditedNodeData[n]; + + QgsCopcPointCloudIndex *copcIndex = static_cast( mIndex.get() ); + + int pointCount = copcIndex->mHierarchy.value( n ); + + return QgsLazDecoder::decompressCopc( rawBlockData, *copcIndex->mLazInfo.get(), pointCount, requestAttributes, filterExpression, filterRect ); } else { @@ -114,15 +135,63 @@ QgsPointCloudBlockRequest *QgsPointCloudEditingIndex::asyncNodeData( const QgsPo return nullptr; } -bool QgsPointCloudEditingIndex::commitChanges() +bool QgsPointCloudEditingIndex::commitChanges( QString *errorMessage ) { if ( !isModified() ) return true; - if ( !mIndex.updateNodeData( mEditedNodeData ) ) + QHash updatedChunks; + for ( auto it = mEditedNodeData.constBegin(); it != mEditedNodeData.constEnd(); ++it ) + { + QgsPointCloudNodeId n = it.key(); + // right now we're assuming there's no change of point count + qint32 nodePointCount = static_cast( getNode( n ).pointCount() ); + updatedChunks[n] = QgsCopcUpdate::UpdatedChunk{ nodePointCount, it.value() }; + } + + QFileInfo fileInfo( mUri ); + const QString outputFilename = fileInfo.dir().filePath( fileInfo.baseName() + QStringLiteral( "-update.copc.laz" ) ); + + if ( !QgsCopcUpdate::writeUpdatedFile( mUri, outputFilename, updatedChunks, errorMessage ) ) + { return false; + } + + // reset the underlying index - we will reload it at the end + QgsCopcPointCloudIndex *copcIndex = static_cast( mIndex.get() ); + copcIndex->reset(); + + const QString originalFilename = fileInfo.dir().filePath( fileInfo.baseName() + QStringLiteral( "-original.copc.laz" ) ); + if ( !QFile::rename( mUri, originalFilename ) ) + { + if ( errorMessage ) + *errorMessage = QStringLiteral( "Rename of the old COPC failed!" ); + QFile::remove( outputFilename ); + return false; + } + + if ( !QFile::rename( outputFilename, mUri ) ) + { + if ( errorMessage ) + *errorMessage = QStringLiteral( "Rename of the new COPC failed!" ); + QFile::rename( originalFilename, mUri ); + QFile::remove( outputFilename ); + return false; + } + + if ( !QFile::remove( originalFilename ) ) + { + if ( errorMessage ) + *errorMessage = QStringLiteral( "Removal of the old COPC failed!" ); + // TODO: cleanup here as well? + return false; + } mEditedNodeData.clear(); + + // now let's reload + copcIndex->load( mUri ); + return true; } @@ -131,6 +200,11 @@ bool QgsPointCloudEditingIndex::isModified() const return !mEditedNodeData.isEmpty(); } +QList QgsPointCloudEditingIndex::updatedNodes() const +{ + return mEditedNodeData.keys(); +} + bool QgsPointCloudEditingIndex::updateNodeData( const QHash &data ) { for ( auto it = data.constBegin(); it != data.constEnd(); ++it ) @@ -138,5 +212,16 @@ bool QgsPointCloudEditingIndex::updateNodeData( const QHash cacheKeys = sBlockCache.keys(); + for ( const QgsPointCloudCacheKey &cacheKey : cacheKeys ) + { + if ( cacheKey.uri() == mUri && data.contains( cacheKey.node() ) ) + sBlockCache.remove( cacheKey ); + } + } + return true; } diff --git a/src/core/pointcloud/qgspointcloudeditingindex.h b/src/core/pointcloud/qgspointcloudeditingindex.h index 70a892de201b..b7087d742078 100644 --- a/src/core/pointcloud/qgspointcloudeditingindex.h +++ b/src/core/pointcloud/qgspointcloudeditingindex.h @@ -50,6 +50,9 @@ class CORE_EXPORT QgsPointCloudEditingIndex : public QgsAbstractPointCloudIndex bool hasNode( const QgsPointCloudNodeId &n ) const override; QgsPointCloudNode getNode( const QgsPointCloudNodeId &id ) const override; + bool setSubsetString( const QString &subset ) override; + QString subsetString() const override; + std::unique_ptr< QgsPointCloudBlock > nodeData( const QgsPointCloudNodeId &n, const QgsPointCloudRequest &request ) override; QgsPointCloudBlockRequest *asyncNodeData( const QgsPointCloudNodeId &n, const QgsPointCloudRequest &request ) override; @@ -57,18 +60,26 @@ class CORE_EXPORT QgsPointCloudEditingIndex : public QgsAbstractPointCloudIndex /** * Tries to store pending changes to the data provider. + * If errorMessage is not a null pointer, it will receive + * an error message in case the call failed. * \return TRUE on success, otherwise FALSE */ - bool commitChanges(); + bool commitChanges( QString *errorMessage = nullptr ); //! Returns TRUE if there are uncommitted changes, FALSE otherwise bool isModified() const; + //! Returns a list of node IDs that have been modified + QList updatedNodes() const; + private: QgsPointCloudIndex mIndex; bool mIsValid = false; QHash mEditedNodeData; + + friend class QgsPointCloudLayerEditUtils; + friend class QgsPointCloudLayerUndoCommandChangeAttribute; }; #endif // QGSPOINTCLOUDEDITINGINDEX_H diff --git a/src/core/pointcloud/qgspointcloudextentrenderer.cpp b/src/core/pointcloud/qgspointcloudextentrenderer.cpp index baec5441c7f7..09f9f2822e33 100644 --- a/src/core/pointcloud/qgspointcloudextentrenderer.cpp +++ b/src/core/pointcloud/qgspointcloudextentrenderer.cpp @@ -44,7 +44,7 @@ QString QgsPointCloudExtentRenderer::type() const QgsPointCloudRenderer *QgsPointCloudExtentRenderer::clone() const { - std::unique_ptr< QgsPointCloudExtentRenderer > res = std::make_unique< QgsPointCloudExtentRenderer >( mFillSymbol ? mFillSymbol->clone() : nullptr ); + auto res = std::make_unique< QgsPointCloudExtentRenderer >( mFillSymbol ? mFillSymbol->clone() : nullptr ); copyCommonProperties( res.get() ); return res.release(); } @@ -56,7 +56,7 @@ void QgsPointCloudExtentRenderer::renderBlock( const QgsPointCloudBlock *, QgsPo QgsPointCloudRenderer *QgsPointCloudExtentRenderer::create( QDomElement &element, const QgsReadWriteContext &context ) { - std::unique_ptr< QgsPointCloudExtentRenderer > r = std::make_unique< QgsPointCloudExtentRenderer >(); + auto r = std::make_unique< QgsPointCloudExtentRenderer >(); const QDomElement symbolElem = element.firstChildElement( QStringLiteral( "symbol" ) ); if ( !symbolElem.isNull() ) @@ -121,7 +121,7 @@ void QgsPointCloudExtentRenderer::renderExtent( const QgsGeometry &extent, QgsPo QgsFillSymbol *QgsPointCloudExtentRenderer::defaultFillSymbol() { - std::unique_ptr< QgsSimpleLineSymbolLayer > layer = std::make_unique< QgsSimpleLineSymbolLayer >(); + auto layer = std::make_unique< QgsSimpleLineSymbolLayer >(); layer->setColor( QColor( 228, 26, 28 ) ); layer->setWidth( 0.960000 ); layer->setPenStyle( Qt::DotLine ); diff --git a/src/core/pointcloud/qgspointcloudindex.cpp b/src/core/pointcloud/qgspointcloudindex.cpp index af5aa064b656..f71914baba87 100644 --- a/src/core/pointcloud/qgspointcloudindex.cpp +++ b/src/core/pointcloud/qgspointcloudindex.cpp @@ -97,11 +97,11 @@ uint qHash( QgsPointCloudNodeId id ) // QgsPointCloudCacheKey // -QgsPointCloudCacheKey::QgsPointCloudCacheKey( const QgsPointCloudNodeId &n, const QgsPointCloudRequest &request, const QgsPointCloudExpression &expression, const QString &uri ) +QgsPointCloudCacheKey::QgsPointCloudCacheKey( const QgsPointCloudNodeId &n, const QgsPointCloudRequest &request, const QString &subset, const QString &uri ) : mNode( n ) , mUri( uri ) , mRequest( request ) - , mFilterExpression( expression ) + , mSubsetString( subset ) { } @@ -110,12 +110,12 @@ bool QgsPointCloudCacheKey::operator==( const QgsPointCloudCacheKey &other ) con return mNode == other.mNode && mUri == other.mUri && mRequest == other.mRequest && - mFilterExpression == other.mFilterExpression; + mSubsetString == other.mSubsetString; } uint qHash( const QgsPointCloudCacheKey &key ) { - return qHash( key.node() ) ^ qHash( key.request() ) ^ qHash( key.uri() ) ^ qHash( key.filterExpression() ); + return qHash( key.node() ) ^ qHash( key.request() ) ^ qHash( key.uri() ) ^ qHash( key.subsetString() ); } // @@ -504,11 +504,11 @@ QVariantMap QgsPointCloudIndex::extraMetadata() const return mIndex->extraMetadata(); } -bool QgsPointCloudIndex::commitChanges() +bool QgsPointCloudIndex::commitChanges( QString *errorMessage ) { Q_ASSERT( mIndex ); if ( QgsPointCloudEditingIndex *index = dynamic_cast( mIndex.get() ) ) - return index->commitChanges(); + return index->commitChanges( errorMessage ); return false; } @@ -521,3 +521,10 @@ bool QgsPointCloudIndex::isModified() const return false; } +QList QgsPointCloudIndex::updatedNodes() const +{ + if ( QgsPointCloudEditingIndex *index = dynamic_cast( mIndex.get() ) ) + return index->updatedNodes(); + + return QList(); +} diff --git a/src/core/pointcloud/qgspointcloudindex.h b/src/core/pointcloud/qgspointcloudindex.h index 430cff42d678..708adbbdd73f 100644 --- a/src/core/pointcloud/qgspointcloudindex.h +++ b/src/core/pointcloud/qgspointcloudindex.h @@ -119,7 +119,7 @@ class CORE_EXPORT QgsPointCloudCacheKey { public: //! Ctor - QgsPointCloudCacheKey( const QgsPointCloudNodeId &n, const QgsPointCloudRequest &request, const QgsPointCloudExpression &expression, const QString &uri ); + QgsPointCloudCacheKey( const QgsPointCloudNodeId &n, const QgsPointCloudRequest &request, const QString &subset, const QString &uri ); bool operator==( const QgsPointCloudCacheKey &other ) const; @@ -132,14 +132,14 @@ class CORE_EXPORT QgsPointCloudCacheKey //! Returns the key's QgsPointCloudRequest QgsPointCloudRequest request() const { return mRequest; } - //! Returns the key's QgsPointCloudExpression - QgsPointCloudExpression filterExpression() const { return mFilterExpression; } + //! Returns the key's subset string. This is used in the point cloud index as a filter expression + QString subsetString() const { return mSubsetString; } private: QgsPointCloudNodeId mNode; QString mUri; QgsPointCloudRequest mRequest; - QgsPointCloudExpression mFilterExpression; + QString mSubsetString; }; //! Hash function for QgsPointCloudCacheKey @@ -336,7 +336,7 @@ class CORE_EXPORT QgsAbstractPointCloudIndex * \returns true if the expression is parsed with no errors, false otherwise * \since QGIS 3.26 */ - bool setSubsetString( const QString &subset ); + virtual bool setSubsetString( const QString &subset ); /** * Returns the string used to define a subset of the point cloud. @@ -344,7 +344,7 @@ class CORE_EXPORT QgsAbstractPointCloudIndex * * \since QGIS 3.26 */ - QString subsetString() const; + virtual QString subsetString() const; /** * Copies common properties to the \a destination index @@ -422,6 +422,9 @@ class CORE_EXPORT QgsPointCloudIndex SIP_NODEFAULTCTORS //! Checks if index is non-null operator bool() const; + //! Returns pointer to the implementation class + QgsAbstractPointCloudIndex *get() SIP_SKIP { return mIndex.get(); } + /** * Loads the index from the file * @@ -643,13 +646,18 @@ class CORE_EXPORT QgsPointCloudIndex SIP_NODEFAULTCTORS /** * Tries to store pending changes to the data provider. + * If errorMessage is not a null pointer, it will receive + * an error message in case the call failed. * \return TRUE on success, otherwise FALSE */ - bool commitChanges(); + bool commitChanges( QString *errorMessage SIP_OUT = nullptr ); //! Returns TRUE if there are uncommitted changes, FALSE otherwise bool isModified() const; + //! Returns a list of node IDs that have been modified + QList updatedNodes() const; + private: std::shared_ptr mIndex; diff --git a/src/core/pointcloud/qgspointcloudlayer.cpp b/src/core/pointcloud/qgspointcloudlayer.cpp index 74da1df3688a..97315f105851 100644 --- a/src/core/pointcloud/qgspointcloudlayer.cpp +++ b/src/core/pointcloud/qgspointcloudlayer.cpp @@ -43,6 +43,7 @@ #include "qgstaskmanager.h" #include "qgsthreadingutils.h" #include "qgspointcloudlayerprofilegenerator.h" +#include "qgspointcloudlayerundocommand.h" #ifdef HAVE_COPC #include "qgscopcpointcloudindex.h" #endif @@ -73,6 +74,8 @@ QgsPointCloudLayer::QgsPointCloudLayer( const QString &uri, setLegend( QgsMapLayerLegend::defaultPointCloudLegend( this ) ); connect( this, &QgsPointCloudLayer::subsetStringChanged, this, &QgsMapLayer::configChanged ); + connect( undoStack(), &QUndoStack::indexChanged, this, &QgsMapLayer::layerModified ); + connect( this, &QgsMapLayer::layerModified, this, [this] { triggerRepaint(); } ); } QgsPointCloudLayer::~QgsPointCloudLayer() @@ -133,8 +136,7 @@ QgsAbstractProfileGenerator *QgsPointCloudLayer::createProfileGenerator( const Q QgsPointCloudDataProvider *QgsPointCloudLayer::dataProvider() { - // BAD! 2D rendering of point clouds is NOT thread safe - QGIS_PROTECT_QOBJECT_THREAD_ACCESS_NON_FATAL + QGIS_PROTECT_QOBJECT_THREAD_ACCESS return mDataProvider.get(); } @@ -1001,10 +1003,20 @@ bool QgsPointCloudLayer::startEditing() bool QgsPointCloudLayer::commitChanges( bool stopEditing ) { QGIS_PROTECT_QOBJECT_THREAD_ACCESS - if ( !mEditIndex || - !mEditIndex.commitChanges() ) + if ( !mEditIndex ) return false; + if ( mEditIndex.isModified() ) + { + if ( !mEditIndex.commitChanges( &mCommitError ) ) + return false; + + // emitting layerModified() is not required as that's done automatically + // when undo stack index changes + } + + undoStack()->clear(); + if ( stopEditing ) { mEditIndex = QgsPointCloudIndex(); @@ -1026,15 +1038,22 @@ bool QgsPointCloudLayer::rollBack() if ( !mEditIndex ) return false; - if ( isModified() ) - { - emit layerModified(); - triggerRepaint(); - } + const QList updatedNodes = mEditIndex.updatedNodes(); + + undoStack()->clear(); mEditIndex = QgsPointCloudIndex(); emit editingStopped(); + if ( !updatedNodes.isEmpty() ) + { + for ( const QgsPointCloudNodeId &n : updatedNodes ) + emit chunkAttributeValuesChanged( n ); + + // emitting layerModified() is not required as that's done automatically + // when undo stack index changes + } + return true; } @@ -1062,26 +1081,57 @@ bool QgsPointCloudLayer::isModified() const return mEditIndex.isModified(); } -bool QgsPointCloudLayer::changeAttributeValue( const QgsPointCloudNodeId &n, const QVector &pts, const QgsPointCloudAttribute &attribute, double value ) +bool QgsPointCloudLayer::changeAttributeValue( const QgsPointCloudNodeId &n, const QVector &points, const QgsPointCloudAttribute &attribute, double value ) { QGIS_PROTECT_QOBJECT_THREAD_ACCESS if ( !mEditIndex ) return false; - QgsPointCloudLayerEditUtils utils( this ); + // Cannot allow x,y,z editing as points may get moved outside the node extents + if ( attribute.name().compare( QLatin1String( "X" ), Qt::CaseInsensitive ) == 0 || + attribute.name().compare( QLatin1String( "Y" ), Qt::CaseInsensitive ) == 0 || + attribute.name().compare( QLatin1String( "Z" ), Qt::CaseInsensitive ) == 0 ) + return false; - const bool success = utils.changeAttributeValue( n, pts, attribute, value ); - if ( success ) + if ( !n.isValid() || !mEditIndex.hasNode( n ) ) // todo: should not have to check if n.isValid + return false; + + if ( points.isEmpty() ) + return false; + + const QgsPointCloudAttributeCollection attributeCollection = mEditIndex.attributes(); + + int attributeOffset; + const QgsPointCloudAttribute *at = attributeCollection.find( attribute.name(), attributeOffset ); + + if ( !at || + at->size() != attribute.size() || + at->type() != attribute.type() ) + { + return false; + } + + if ( !QgsPointCloudLayerEditUtils::isAttributeValueValid( attribute, value ) ) { - emit layerModified(); + return false; } - return success; + QVector sortedPoints( points.constBegin(), points.constEnd() ); + std::sort( sortedPoints.begin(), sortedPoints.end() ); + sortedPoints.erase( std::unique( sortedPoints.begin(), sortedPoints.end() ), sortedPoints.end() ); + + if ( sortedPoints.constFirst() < 0 || + sortedPoints.constLast() >= mEditIndex.getNode( n ).pointCount() ) + return false; + + undoStack()->push( new QgsPointCloudLayerUndoCommandChangeAttribute( this, n, sortedPoints, attribute, value ) ); + + return true; } QgsPointCloudIndex QgsPointCloudLayer::index() const { - QGIS_PROTECT_QOBJECT_THREAD_ACCESS_NON_FATAL + QGIS_PROTECT_QOBJECT_THREAD_ACCESS if ( mEditIndex ) return mEditIndex; diff --git a/src/core/pointcloud/qgspointcloudlayer.h b/src/core/pointcloud/qgspointcloudlayer.h index bfa4f6aa9b91..befa734dd14d 100644 --- a/src/core/pointcloud/qgspointcloudlayer.h +++ b/src/core/pointcloud/qgspointcloudlayer.h @@ -351,6 +351,13 @@ class CORE_EXPORT QgsPointCloudLayer : public QgsMapLayer, public QgsAbstractPro */ void statisticsCalculationStateChanged( QgsPointCloudLayer::PointCloudStatisticsCalculationState state ); + /** + * Emitted when a node gets some attribute values of some points changed + * + * \since QGIS 3.42 + */ + void chunkAttributeValuesChanged( const QgsPointCloudNodeId &n ); + private slots: void onPointCloudIndexGenerationStateChanged( QgsPointCloudDataProvider::PointCloudIndexGenerationState state ); void setDataSourcePrivate( const QString &dataSource, const QString &baseName, const QString &provider, const QgsDataProvider::ProviderOptions &options, Qgis::DataProviderReadFlags flags ) override; diff --git a/src/core/pointcloud/qgspointcloudlayereditutils.cpp b/src/core/pointcloud/qgspointcloudlayereditutils.cpp index 28085388aa7a..e6c04aa6f552 100644 --- a/src/core/pointcloud/qgspointcloudlayereditutils.cpp +++ b/src/core/pointcloud/qgspointcloudlayereditutils.cpp @@ -14,95 +14,151 @@ ***************************************************************************/ #include "qgspointcloudlayereditutils.h" -#include "qgspointcloudlayer.h" #include "qgslazdecoder.h" +#include "qgscopcpointcloudindex.h" +#include +#include -QgsPointCloudLayerEditUtils::QgsPointCloudLayerEditUtils( QgsPointCloudLayer *layer ) - : mIndex( layer->index() ) -{ -} -bool QgsPointCloudLayerEditUtils::changeAttributeValue( const QgsPointCloudNodeId &n, const QVector &pts, const QgsPointCloudAttribute &attribute, double value ) +static void updatePoint( char *pointBuffer, int pointFormat, const QString &attributeName, double newValue ) { - // Cannot allow x,y,z editing as points may get moved outside the node extents - if ( attribute.name().compare( QLatin1String( "X" ), Qt::CaseInsensitive ) == 0 || - attribute.name().compare( QLatin1String( "Y" ), Qt::CaseInsensitive ) == 0 || - attribute.name().compare( QLatin1String( "Z" ), Qt::CaseInsensitive ) == 0 ) - return false; - - if ( !n.isValid() || !mIndex.hasNode( n ) ) // todo: should not have to check if n.isValid - return false; - - const QgsPointCloudAttributeCollection attributeCollection = mIndex.attributes(); - - int attributeOffset; - const QgsPointCloudAttribute *at = attributeCollection.find( attribute.name(), attributeOffset ); - - if ( !at || - at->size() != attribute.size() || - at->type() != attribute.type() ) + if ( attributeName == QLatin1String( "Intensity" ) ) // unsigned short { - return false; + quint16 newValueShort = static_cast( newValue ); + memcpy( pointBuffer + 12, &newValueShort, sizeof( qint16 ) ); } - - if ( !isAttributeValueValid( attribute, value ) ) + else if ( attributeName == QLatin1String( "ReturnNumber" ) ) // bits 0-3 { - return false; + uchar newByteValue = static_cast( newValue ) & 0xf; + pointBuffer[14] = static_cast( ( pointBuffer[14] & 0xf0 ) | newByteValue ); } + else if ( attributeName == QLatin1String( "NumberOfReturns" ) ) // bits 4-7 + { + uchar newByteValue = ( static_cast( newValue ) & 0xf ) << 4; + pointBuffer[14] = static_cast( ( pointBuffer[14] & 0xf ) | newByteValue ); + } + else if ( attributeName == QLatin1String( "Synthetic" ) ) // bit 0 + { + uchar newByteValue = ( static_cast( newValue ) & 0x1 ); + pointBuffer[15] = static_cast( ( pointBuffer[15] & 0xfe ) | newByteValue ); + } + else if ( attributeName == QLatin1String( "KeyPoint" ) ) // bit 1 + { + uchar newByteValue = ( static_cast( newValue ) & 0x1 ) << 1; + pointBuffer[15] = static_cast( ( pointBuffer[15] & 0xfd ) | newByteValue ); + } + else if ( attributeName == QLatin1String( "Withheld" ) ) // bit 2 + { + uchar newByteValue = ( static_cast( newValue ) & 0x1 ) << 2; + pointBuffer[15] = static_cast( ( pointBuffer[15] & 0xfb ) | newByteValue ); + } + else if ( attributeName == QLatin1String( "Overlap" ) ) // bit 3 + { + uchar newByteValue = ( static_cast( newValue ) & 0x1 ) << 3; + pointBuffer[15] = static_cast( ( pointBuffer[15] & 0xf7 ) | newByteValue ); + } + else if ( attributeName == QLatin1String( "ScannerChannel" ) ) // bits 4-5 + { + uchar newByteValue = ( static_cast( newValue ) & 0x3 ) << 4; + pointBuffer[15] = static_cast( ( pointBuffer[15] & 0xcf ) | newByteValue ); + } + else if ( attributeName == QLatin1String( "ScanDirectionFlag" ) ) // bit 6 + { + uchar newByteValue = ( static_cast( newValue ) & 0x1 ) << 6; + pointBuffer[15] = static_cast( ( pointBuffer[15] & 0xbf ) | newByteValue ); + } + else if ( attributeName == QLatin1String( "EdgeOfFlightLine" ) ) // bit 7 + { + uchar newByteValue = ( static_cast( newValue ) & 0x1 ) << 7; + pointBuffer[15] = static_cast( ( pointBuffer[15] & 0x7f ) | newByteValue ); + } + else if ( attributeName == QLatin1String( "Classification" ) ) // unsigned char + { + pointBuffer[16] = static_cast( static_cast( newValue ) ); + } + else if ( attributeName == QLatin1String( "UserData" ) ) // unsigned char + { + pointBuffer[17] = static_cast( static_cast( newValue ) ); + } + else if ( attributeName == QLatin1String( "ScanAngleRank" ) ) // short + { + qint16 newValueShort = static_cast( newValue ); + memcpy( pointBuffer + 18, &newValueShort, sizeof( qint16 ) ); + } + else if ( attributeName == QLatin1String( "PointSourceId" ) ) // unsigned short + { + quint16 newValueShort = static_cast( newValue ); + memcpy( pointBuffer + 20, &newValueShort, sizeof( quint16 ) ); + } + else if ( attributeName == QLatin1String( "GpsTime" ) ) // double + { + memcpy( pointBuffer + 22, &newValue, sizeof( double ) ); + } + else if ( pointFormat == 7 || pointFormat == 8 ) + { + if ( attributeName == QLatin1String( "Red" ) ) // unsigned short + { + quint16 newValueShort = static_cast( newValue ); + memcpy( pointBuffer + 30, &newValueShort, sizeof( quint16 ) ); + } + else if ( attributeName == QLatin1String( "Green" ) ) // unsigned short + { + quint16 newValueShort = static_cast( newValue ); + memcpy( pointBuffer + 32, &newValueShort, sizeof( quint16 ) ); + } + else if ( attributeName == QLatin1String( "Blue" ) ) // unsigned short + { + quint16 newValueShort = static_cast( newValue ); + memcpy( pointBuffer + 34, &newValueShort, sizeof( quint16 ) ); + } + else if ( pointFormat == 8 ) + { + if ( attributeName == QLatin1String( "Infrared" ) ) // unsigned short + { + quint16 newValueShort = static_cast( newValue ); + memcpy( pointBuffer + 36, &newValueShort, sizeof( quint16 ) ); + } + } + } +} - const QSet uniquePoints( pts.constBegin(), pts.constEnd() ); - QVector sortedPoints( uniquePoints.constBegin(), uniquePoints.constEnd() ); - std::sort( sortedPoints.begin(), sortedPoints.end() ); - - if ( sortedPoints.constFirst() < 0 || - sortedPoints.constLast() > mIndex.getNode( n ).pointCount() ) - return false; - QgsPointCloudRequest req; - req.setAttributes( attributeCollection ); +QByteArray QgsPointCloudLayerEditUtils::updateChunkValues( QgsCopcPointCloudIndex *copcIndex, const QByteArray &chunkData, const QgsPointCloudAttribute &attribute, const QgsPointCloudNodeId &n, const QHash &pointValues, std::optional newValue ) +{ + Q_ASSERT( copcIndex->mHierarchy.contains( n ) ); + Q_ASSERT( copcIndex->mHierarchyNodePos.contains( n ) ); - std::unique_ptr block = mIndex.nodeData( n, req ); - const int count = block->pointCount(); - const int recordSize = attributeCollection.pointRecordSize(); + int pointCount = copcIndex->mHierarchy[n]; - // copy data - QByteArray data( block->data(), count * recordSize ); + lazperf::header14 header = copcIndex->mLazInfo->header(); - char *ptr = data.data(); + lazperf::reader::chunk_decompressor decompressor( header.pointFormat(), header.ebCount(), chunkData.constData() ); + lazperf::writer::chunk_compressor compressor( header.pointFormat(), header.ebCount() ); - for ( int i : sortedPoints ) - { - // replace attribute for selected point - lazStoreDoubleToStream( ptr, i * recordSize + attributeOffset, attribute.type(), value ); - } + std::unique_ptr decodedData( new char[ header.point_record_length ] ); - return mIndex.updateNodeData( {{n, data}} );; -} + // only PDRF 6/7/8 is allowed by COPC + Q_ASSERT( header.pointFormat() == 6 || header.pointFormat() == 7 || header.pointFormat() == 8 ); -QByteArray QgsPointCloudLayerEditUtils::dataForAttributes( const QgsPointCloudAttributeCollection &allAttributes, const QByteArray &data, const QgsPointCloudRequest &request ) -{ - const QVector attributes = allAttributes.attributes(); - const int nPoints = data.size() / allAttributes.pointRecordSize(); - const char *ptr = data.data(); + QString attributeName = attribute.name(); - QByteArray outData; - for ( int i = 0; i < nPoints; ++i ) + for ( int i = 0 ; i < pointCount; ++i ) { - for ( const QgsPointCloudAttribute &attr : attributes ) + decompressor.decompress( decodedData.get() ); + char *buf = decodedData.get(); + + if ( pointValues.contains( i ) ) { - if ( request.attributes().indexOf( attr.name() ) >= 0 ) - { - outData.append( ptr, attr.size() ); - } - ptr += attr.size(); + // TODO: support for extrabytes attributes + updatePoint( buf, header.point_format_id, attributeName, newValue ? *newValue : pointValues[i] ); } - } - // - Q_ASSERT( nPoints == outData.size() / request.attributes().pointRecordSize() ); + compressor.compress( decodedData.get() ); + } - return outData; + std::vector data = compressor.done(); + return QByteArray( ( const char * ) data.data(), ( int ) data.size() ); // QByteArray makes a deep copy } bool QgsPointCloudLayerEditUtils::isAttributeValueValid( const QgsPointCloudAttribute &attribute, double value ) @@ -115,7 +171,7 @@ bool QgsPointCloudLayerEditUtils::isAttributeValueValid( const QgsPointCloudAttr return value >= 0 && value <= 15; if ( name == QLatin1String( "NUMBEROFRETURNS" ) ) return value >= 0 && value <= 15; - if ( name == QLatin1String( "SCANCHANNEL" ) ) + if ( name == QLatin1String( "SCANNERCHANNEL" ) ) return value >= 0 && value <= 3; if ( name == QLatin1String( "SCANDIRECTIONFLAG" ) ) return value >= 0 && value <= 1; @@ -125,7 +181,7 @@ bool QgsPointCloudLayerEditUtils::isAttributeValueValid( const QgsPointCloudAttr return value >= 0 && value <= 255; if ( name == QLatin1String( "USERDATA" ) ) return value >= 0 && value <= 255; - if ( name == QLatin1String( "SCANANGLE" ) ) + if ( name == QLatin1String( "SCANANGLERANK" ) ) return value >= -30'000 && value <= 30'000; if ( name == QLatin1String( "POINTSOURCEID" ) ) return value >= 0 && value <= 65535; @@ -145,6 +201,8 @@ bool QgsPointCloudLayerEditUtils::isAttributeValueValid( const QgsPointCloudAttr return value >= 0 && value <= 65535; if ( name == QLatin1String( "BLUE" ) ) return value >= 0 && value <= 65535; + if ( name == QLatin1String( "INFRARED" ) ) + return value >= 0 && value <= 65535; return true; } diff --git a/src/core/pointcloud/qgspointcloudlayereditutils.h b/src/core/pointcloud/qgspointcloudlayereditutils.h index 4aabb116f727..d4da6884978e 100644 --- a/src/core/pointcloud/qgspointcloudlayereditutils.h +++ b/src/core/pointcloud/qgspointcloudlayereditutils.h @@ -19,6 +19,8 @@ #include "qgis_core.h" #include "qgspointcloudindex.h" +#include + #include #include @@ -30,6 +32,8 @@ class QgsPointCloudAttribute; class QgsPointCloudAttributeCollection; class QgsPointCloudRequest; +class QgsCopcPointCloudIndex; + /** * \ingroup core * @@ -43,27 +47,14 @@ class CORE_EXPORT QgsPointCloudLayerEditUtils { public: //! Ctor - QgsPointCloudLayerEditUtils( QgsPointCloudLayer *layer ); - - /** - * Attempts to modify attribute values for specific points in the editing buffer. - * - * \param n The point cloud node containing the points - * \param points The point ids of the points to be modified - * \param attribute The attribute whose value will be updated - * \param value The new value to set to the attribute - * \return TRUE if the editing buffer was updated successfully, FALSE otherwise - */ - bool changeAttributeValue( const QgsPointCloudNodeId &n, const QVector &points, const QgsPointCloudAttribute &attribute, double value ); - - //! Takes \a data comprising of \a allAttributes and returns a QByteArray with data only for the attributes included in the \a request - static QByteArray dataForAttributes( const QgsPointCloudAttributeCollection &allAttributes, const QByteArray &data, const QgsPointCloudRequest &request ); + QgsPointCloudLayerEditUtils() = delete; //! Check if \a value is within proper range for the \a attribute static bool isAttributeValueValid( const QgsPointCloudAttribute &attribute, double value ); - private: - QgsPointCloudIndex mIndex; + //! Sets new classification value for the given points in voxel and return updated chunk data + static QByteArray updateChunkValues( QgsCopcPointCloudIndex *copcIndex, const QByteArray &chunkData, const QgsPointCloudAttribute &attribute, const QgsPointCloudNodeId &n, const QHash &pointValues, std::optional newValue = std::nullopt ); + }; #endif // QGSPOINTCLOUDLAYEREDITUTILS_H diff --git a/src/core/pointcloud/qgspointcloudlayerelevationproperties.cpp b/src/core/pointcloud/qgspointcloudlayerelevationproperties.cpp index 1a1dbafa9869..124c89b0c25a 100644 --- a/src/core/pointcloud/qgspointcloudlayerelevationproperties.cpp +++ b/src/core/pointcloud/qgspointcloudlayerelevationproperties.cpp @@ -92,7 +92,7 @@ bool QgsPointCloudLayerElevationProperties::readXml( const QDomElement &element, QgsPointCloudLayerElevationProperties *QgsPointCloudLayerElevationProperties::clone() const { - std::unique_ptr< QgsPointCloudLayerElevationProperties > res = std::make_unique< QgsPointCloudLayerElevationProperties >( nullptr ); + auto res = std::make_unique< QgsPointCloudLayerElevationProperties >( nullptr ); res->copyCommonProperties( this ); res->mMaximumScreenError = mMaximumScreenError; diff --git a/src/core/pointcloud/qgspointcloudlayerprofilegenerator.cpp b/src/core/pointcloud/qgspointcloudlayerprofilegenerator.cpp index 7c9bee1362dc..9db7d06101b4 100644 --- a/src/core/pointcloud/qgspointcloudlayerprofilegenerator.cpp +++ b/src/core/pointcloud/qgspointcloudlayerprofilegenerator.cpp @@ -341,6 +341,8 @@ void QgsPointCloudLayerProfileResults::copyPropertiesFromGenerator( const QgsAbs QgsPointCloudLayerProfileGenerator::QgsPointCloudLayerProfileGenerator( QgsPointCloudLayer *layer, const QgsProfileRequest &request ) : mLayer( layer ) + , mIndex( layer->index() ) + , mSubIndexes( layer->dataProvider()->subIndexes() ) , mLayerAttributes( layer->attributes() ) , mRenderer( qgis::down_cast< QgsPointCloudLayerElevationProperties* >( layer->elevationProperties() )->respectLayerColors() && mLayer->renderer() ? mLayer->renderer()->clone() : nullptr ) , mMaximumScreenError( qgis::down_cast< QgsPointCloudLayerElevationProperties* >( layer->elevationProperties() )->maximumScreenError() ) @@ -361,10 +363,10 @@ QgsPointCloudLayerProfileGenerator::QgsPointCloudLayerProfileGenerator( QgsPoint , mZScale( layer->elevationProperties()->zScale() ) , mStepDistance( request.stepDistance() ) { - if ( mLayer->index() ) + if ( mIndex ) { - mScale = mLayer->index().scale(); - mOffset = mLayer->index().offset(); + mScale = mIndex.scale(); + mOffset = mIndex.offset(); } } @@ -386,17 +388,13 @@ bool QgsPointCloudLayerProfileGenerator::generateProfile( const QgsProfileGenera if ( !mLayer || !mProfileCurve || mFeedback->isCanceled() ) return false; - // this is not AT ALL thread safe, but it's what QgsPointCloudLayerRenderer does ! - // TODO: fix when QgsPointCloudLayerRenderer is made thread safe to use same approach - QVector indexes; - QgsPointCloudIndex mainIndex = mLayer->index(); - if ( mainIndex && mainIndex.isValid() ) - indexes.append( mainIndex ); + if ( mIndex && mIndex.isValid() ) + indexes.append( mIndex ); // Gather all relevant sub-indexes const QgsRectangle profileCurveBbox = mProfileCurve->boundingBox(); - for ( const QgsPointCloudSubIndex &subidx : mLayer->dataProvider()->subIndexes() ) + for ( const QgsPointCloudSubIndex &subidx : mSubIndexes ) { QgsPointCloudIndex index = subidx.index(); if ( index && index.isValid() && subidx.polygonBounds().intersects( profileCurveBbox ) ) diff --git a/src/core/pointcloud/qgspointcloudlayerprofilegenerator.h b/src/core/pointcloud/qgspointcloudlayerprofilegenerator.h index 53d3e40206c9..92702793ea28 100644 --- a/src/core/pointcloud/qgspointcloudlayerprofilegenerator.h +++ b/src/core/pointcloud/qgspointcloudlayerprofilegenerator.h @@ -25,6 +25,8 @@ #include "qgscoordinatetransform.h" #include "qgspointcloudattribute.h" #include "qgslinesymbol.h" +#include "qgspointcloudindex.h" +#include "qgspointcloudsubindex.h" #include "qgsvector3d.h" #include "qgsgeos.h" @@ -150,6 +152,8 @@ class CORE_EXPORT QgsPointCloudLayerProfileGenerator : public QgsAbstractProfile void visitBlock( const QgsPointCloudBlock *block, const QgsDoubleRange &zRange ); QPointer< QgsPointCloudLayer > mLayer; + QgsPointCloudIndex mIndex; + const QVector< QgsPointCloudSubIndex > mSubIndexes; QgsPointCloudAttributeCollection mLayerAttributes; std::unique_ptr< QgsPointCloudRenderer > mRenderer; double mMaximumScreenError = 0.3; diff --git a/src/core/pointcloud/qgspointcloudlayerrenderer.cpp b/src/core/pointcloud/qgspointcloudlayerrenderer.cpp index 809cc7fb548c..054f59179c57 100644 --- a/src/core/pointcloud/qgspointcloudlayerrenderer.cpp +++ b/src/core/pointcloud/qgspointcloudlayerrenderer.cpp @@ -43,22 +43,21 @@ QgsPointCloudLayerRenderer::QgsPointCloudLayerRenderer( QgsPointCloudLayer *layer, QgsRenderContext &context ) : QgsMapLayerRenderer( layer->id(), &context ) - , mLayer( layer ) , mLayerName( layer->name() ) , mLayerAttributes( layer->attributes() ) - , mSubIndexes( layer && layer->dataProvider() ? layer->dataProvider()->subIndexes() : QVector() ) + , mSubIndexes( layer->dataProvider() ? layer->dataProvider()->subIndexes() : QVector() ) , mFeedback( new QgsFeedback ) , mEnableProfile( context.flags() & Qgis::RenderContextFlag::RecordProfile ) { - // TODO: we must not keep pointer to mLayer (it's dangerous) - we must copy anything we need for rendering - // or use some locking to prevent read/write from multiple threads - if ( !mLayer || !mLayer->dataProvider() || !mLayer->renderer() ) + if ( !layer->dataProvider() || !layer->renderer() ) return; + mIndex = layer->index(); + QElapsedTimer timer; timer.start(); - mRenderer.reset( mLayer->renderer()->clone() ); + mRenderer.reset( layer->renderer()->clone() ); if ( !mSubIndexes.isEmpty() ) { mSubIndexExtentRenderer.reset( new QgsPointCloudExtentRenderer() ); @@ -66,19 +65,26 @@ QgsPointCloudLayerRenderer::QgsPointCloudLayerRenderer( QgsPointCloudLayer *laye mSubIndexExtentRenderer->setLabelTextFormat( mRenderer->labelTextFormat() ); } - if ( mLayer->index() ) + if ( mIndex ) { - mScale = mLayer->index().scale(); - mOffset = mLayer->index().offset(); + mScale = mIndex.scale(); + mOffset = mIndex.offset(); } - if ( const QgsPointCloudLayerElevationProperties *elevationProps = qobject_cast< const QgsPointCloudLayerElevationProperties * >( mLayer->elevationProperties() ) ) + if ( const QgsPointCloudLayerElevationProperties *elevationProps = qobject_cast< const QgsPointCloudLayerElevationProperties * >( layer->elevationProperties() ) ) { mZOffset = elevationProps->zOffset(); mZScale = elevationProps->zScale(); } - mCloudExtent = mLayer->dataProvider()->polygonBounds(); + if ( const QgsVirtualPointCloudProvider *vpcProvider = dynamic_cast( layer->dataProvider() ) ) + { + mAverageSubIndexWidth = vpcProvider->averageSubIndexWidth(); + mAverageSubIndexHeight = vpcProvider->averageSubIndexHeight(); + mOverviewIndex = vpcProvider->overview(); + } + + mCloudExtent = layer->dataProvider()->polygonBounds(); mClippingRegions = QgsMapClippingUtils::collectClippingRegionsForLayer( *renderContext(), layer ); @@ -129,9 +135,7 @@ bool QgsPointCloudLayerRenderer::render() return true; } - // TODO cache!? - QgsPointCloudIndex pc = mLayer->index(); - if ( mSubIndexes.isEmpty() && ( !pc || !pc.isValid() ) ) + if ( mSubIndexes.isEmpty() && ( !mIndex || !mIndex.isValid() ) ) { mReadyToCompose = true; return false; @@ -195,9 +199,9 @@ bool QgsPointCloudLayerRenderer::render() bool canceled = false; if ( mSubIndexes.isEmpty() ) { - canceled = !renderIndex( pc ); + canceled = !renderIndex( mIndex ); } - else if ( const QgsVirtualPointCloudProvider *vpcProvider = dynamic_cast( mLayer->dataProvider() ) ) + else if ( mOverviewIndex ) { QVector< QgsPointCloudSubIndex > visibleIndexes; for ( const QgsPointCloudSubIndex &si : mSubIndexes ) @@ -207,23 +211,22 @@ bool QgsPointCloudLayerRenderer::render() visibleIndexes.append( si ); } } - const bool zoomedOut = renderExtent.width() > vpcProvider->averageSubIndexWidth() || - renderExtent.height() > vpcProvider->averageSubIndexHeight(); - QgsPointCloudIndex overviewIndex = vpcProvider->overview(); + const bool zoomedOut = renderExtent.width() > mAverageSubIndexWidth || + renderExtent.height() > mAverageSubIndexHeight; // if the overview of virtual point cloud exists, and we are zoomed out, we render just overview - if ( vpcProvider->overview() && zoomedOut && + if ( mOverviewIndex && zoomedOut && mRenderer->zoomOutBehavior() == Qgis::PointCloudZoomOutRenderBehavior::RenderOverview ) { - renderIndex( overviewIndex ); + renderIndex( *mOverviewIndex ); } else { // if the overview of virtual point cloud exists, and we are zoomed out, but we want both overview and extents, // we render overview - if ( vpcProvider->overview() && zoomedOut && + if ( mOverviewIndex && zoomedOut && mRenderer->zoomOutBehavior() == Qgis::PointCloudZoomOutRenderBehavior::RenderOverviewAndExtents ) { - renderIndex( overviewIndex ); + renderIndex( *mOverviewIndex ); } mSubIndexExtentRenderer->startRender( context ); for ( const QgsPointCloudSubIndex &si : visibleIndexes ) diff --git a/src/core/pointcloud/qgspointcloudlayerrenderer.h b/src/core/pointcloud/qgspointcloudlayerrenderer.h index 8f94afc753ff..f480f749e593 100644 --- a/src/core/pointcloud/qgspointcloudlayerrenderer.h +++ b/src/core/pointcloud/qgspointcloudlayerrenderer.h @@ -37,6 +37,7 @@ #include #include #include +#include class QgsRenderContext; class QgsPointCloudLayer; @@ -79,7 +80,7 @@ class CORE_EXPORT QgsPointCloudLayerRenderer: public QgsMapLayerRenderer void renderTriangulatedSurface( QgsPointCloudRenderContext &context ); bool renderIndex( QgsPointCloudIndex &pc ); - QgsPointCloudLayer *mLayer = nullptr; + QgsPointCloudIndex mIndex; QString mLayerName; std::unique_ptr< QgsPointCloudRenderer > mRenderer; @@ -94,7 +95,11 @@ class CORE_EXPORT QgsPointCloudLayerRenderer: public QgsMapLayerRenderer QgsPointCloudAttributeCollection mAttributes; QgsGeometry mCloudExtent; QList< QgsMapClippingRegion > mClippingRegions; + const QVector< QgsPointCloudSubIndex > mSubIndexes; + std::optional mOverviewIndex; + double mAverageSubIndexWidth = 0; + double mAverageSubIndexHeight = 0; int mRenderTimeHint = 0; bool mBlockRenderUpdates = false; diff --git a/src/core/pointcloud/qgspointcloudlayerundocommand.cpp b/src/core/pointcloud/qgspointcloudlayerundocommand.cpp new file mode 100644 index 000000000000..75e442123ace --- /dev/null +++ b/src/core/pointcloud/qgspointcloudlayerundocommand.cpp @@ -0,0 +1,90 @@ +/*************************************************************************** + qgspointcloudlayerundocommand.cpp + --------------------- + begin : January 2025 + copyright : (C) 2025 by Stefanos Natsis + email : uclaros at gmail dot com + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "qgspointcloudlayerundocommand.h" +#include "qgspointcloudeditingindex.h" +#include "qgscopcpointcloudindex.h" +#include "qgspointcloudlayer.h" +#include "qgspointcloudlayereditutils.h" + + +QgsPointCloudLayerUndoCommand::QgsPointCloudLayerUndoCommand( QgsPointCloudLayer *layer ) + : mLayer( layer ) +{} + +QgsPointCloudLayerUndoCommandChangeAttribute::QgsPointCloudLayerUndoCommandChangeAttribute( QgsPointCloudLayer *layer, const QgsPointCloudNodeId &n, const QVector &points, const QgsPointCloudAttribute &attribute, double value ) + : QgsPointCloudLayerUndoCommand( layer ) + , mNode( n ) + , mAttribute( attribute ) + , mNewValue( value ) +{ + QgsPointCloudIndex index = mLayer->index(); + const QgsPointCloudAttributeCollection allAttributes = index.attributes(); + QgsPointCloudRequest req; + req.setAttributes( allAttributes ); + // we want to iterate all points so we have the correct point indexes within the node + req.setIgnoreIndexFilterEnabled( true ); + std::unique_ptr block = index.nodeData( n, req ); + const char *ptr = block->data(); + block->attributes().find( attribute.name(), mAttributeOffset ); + const int size = block->pointRecordSize(); + for ( const int point : points ) + { + const int offset = point * size + mAttributeOffset; + const double oldValue = attribute.convertValueToDouble( ptr + offset ); + mPointValues[point] = oldValue; + } +} + +void QgsPointCloudLayerUndoCommandChangeAttribute::undo() +{ + undoRedoPrivate( true ); +} + +void QgsPointCloudLayerUndoCommandChangeAttribute::redo() +{ + undoRedoPrivate( false ); +} + +void QgsPointCloudLayerUndoCommandChangeAttribute::undoRedoPrivate( bool isUndo ) +{ + QgsPointCloudEditingIndex *editIndex = static_cast( mLayer->index().get() ); + QgsCopcPointCloudIndex *copcIndex = static_cast( editIndex->mIndex.get() ); + + QByteArray chunkData; + if ( editIndex->mEditedNodeData.contains( mNode ) ) + { + chunkData = editIndex->mEditedNodeData[mNode]; + } + else + { + QPair offsetSizePair = copcIndex->mHierarchyNodePos[mNode]; + chunkData = copcIndex->readRange( offsetSizePair.first, offsetSizePair.second ); + } + + QByteArray data; + if ( isUndo ) + { + data = QgsPointCloudLayerEditUtils::updateChunkValues( copcIndex, chunkData, mAttribute, mNode, mPointValues ); + } + else + { + data = QgsPointCloudLayerEditUtils::updateChunkValues( copcIndex, chunkData, mAttribute, mNode, mPointValues, mNewValue ); + } + + mLayer->index().updateNodeData( {{mNode, data}} ); + + emit mLayer->chunkAttributeValuesChanged( mNode ); +} diff --git a/src/core/pointcloud/qgspointcloudlayerundocommand.h b/src/core/pointcloud/qgspointcloudlayerundocommand.h new file mode 100644 index 000000000000..6611437af84c --- /dev/null +++ b/src/core/pointcloud/qgspointcloudlayerundocommand.h @@ -0,0 +1,77 @@ +/*************************************************************************** + qgspointcloudlayerundocommand.h + --------------------- + begin : January 2025 + copyright : (C) 2025 by Stefanos Natsis + email : uclaros at gmail dot com + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef QGSPOINTCLOUDLAYERUNDOCOMMAND_H +#define QGSPOINTCLOUDLAYERUNDOCOMMAND_H + +#define SIP_NO_FILE + +#include "qgis_core.h" +#include "qgspointcloudindex.h" +#include "qgspointcloudattribute.h" + +#include + +class QgsPointCloudLayer; + +/** + * \ingroup core + * + * \brief Base class for undo/redo command for point cloud editing + * + * \since QGIS 3.42 + */ +class CORE_EXPORT QgsPointCloudLayerUndoCommand : public QUndoCommand +{ + protected: + //! Ctor + QgsPointCloudLayerUndoCommand( QgsPointCloudLayer *layer ); + QgsPointCloudLayer *mLayer; +}; + +/** + * \ingroup core + * + * \brief An undo command subclass for changing point attribute values in a point cloud index + * + * \since QGIS 3.42 + */ +class CORE_EXPORT QgsPointCloudLayerUndoCommandChangeAttribute : public QgsPointCloudLayerUndoCommand +{ + public: + + /** + * Constructor for QgsPointCloudLayerUndoCommandChangeAttribute + * \param layer associated point cloud layer + * \param n the node id whose points will be modified + * \param points the list of points to be modified + * \param attribute the attribute whose value will be modified + * \param value the new value for the modified attribure + */ + QgsPointCloudLayerUndoCommandChangeAttribute( QgsPointCloudLayer *layer, const QgsPointCloudNodeId &n, const QVector &points, const QgsPointCloudAttribute &attribute, double value ); + + void undo() override; + void redo() override; + + private: + void undoRedoPrivate( bool isUndo ); + + QgsPointCloudNodeId mNode; + QHash< int, double > mPointValues; // contains pairs of (point number, old value) + QgsPointCloudAttribute mAttribute; + int mAttributeOffset; + double mNewValue; +}; +#endif // QGSPOINTCLOUDLAYERUNDOCOMMAND_H diff --git a/src/core/pointcloud/qgspointcloudrenderer.cpp b/src/core/pointcloud/qgspointcloudrenderer.cpp index 1ef20cf09d00..ff9ad0720d49 100644 --- a/src/core/pointcloud/qgspointcloudrenderer.cpp +++ b/src/core/pointcloud/qgspointcloudrenderer.cpp @@ -230,8 +230,8 @@ void QgsPointCloudRenderer::restoreCommonProperties( const QDomElement &element, mMaximumScreenError = element.attribute( QStringLiteral( "maximumScreenError" ), QStringLiteral( "0.3" ) ).toDouble(); mMaximumScreenErrorUnit = QgsUnitTypes::decodeRenderUnit( element.attribute( QStringLiteral( "maximumScreenErrorUnit" ), QStringLiteral( "MM" ) ) ); - mPointSymbol = qgsEnumKeyToValue( element.attribute( QStringLiteral( "pointSymbol" ) ), Qgis::PointCloudSymbol::Square ); - mDrawOrder2d = qgsEnumKeyToValue( element.attribute( QStringLiteral( "drawOrder2d" ) ), Qgis::PointCloudDrawOrder::Default ); + mPointSymbol = static_cast< Qgis::PointCloudSymbol >( element.attribute( QStringLiteral( "pointSymbol" ), QStringLiteral( "0" ) ).toInt() ); + mDrawOrder2d = static_cast< Qgis::PointCloudDrawOrder >( element.attribute( QStringLiteral( "drawOrder2d" ), QStringLiteral( "0" ) ).toInt() ); mRenderAsTriangles = element.attribute( QStringLiteral( "renderAsTriangles" ), QStringLiteral( "0" ) ).toInt(); mHorizontalTriangleFilter = element.attribute( QStringLiteral( "horizontalTriangleFilter" ), QStringLiteral( "0" ) ).toInt(); @@ -255,8 +255,8 @@ void QgsPointCloudRenderer::saveCommonProperties( QDomElement &element, const Qg element.setAttribute( QStringLiteral( "maximumScreenError" ), qgsDoubleToString( mMaximumScreenError ) ); element.setAttribute( QStringLiteral( "maximumScreenErrorUnit" ), QgsUnitTypes::encodeUnit( mMaximumScreenErrorUnit ) ); - element.setAttribute( QStringLiteral( "pointSymbol" ), qgsEnumValueToKey( mPointSymbol ) ); - element.setAttribute( QStringLiteral( "drawOrder2d" ), qgsEnumValueToKey( mDrawOrder2d ) ); + element.setAttribute( QStringLiteral( "pointSymbol" ), QString::number( static_cast< int >( mPointSymbol ) ) ); + element.setAttribute( QStringLiteral( "drawOrder2d" ), QString::number( static_cast< int >( mDrawOrder2d ) ) ); element.setAttribute( QStringLiteral( "renderAsTriangles" ), QString::number( static_cast< int >( mRenderAsTriangles ) ) ); element.setAttribute( QStringLiteral( "horizontalTriangleFilter" ), QString::number( static_cast< int >( mHorizontalTriangleFilter ) ) ); @@ -270,7 +270,8 @@ void QgsPointCloudRenderer::saveCommonProperties( QDomElement &element, const Qg QDomDocument doc = element.ownerDocument(); element.appendChild( mLabelTextFormat.writeXml( doc, context ) ); } - element.setAttribute( QStringLiteral( "zoomOutBehavior" ), qgsEnumValueToKey( mZoomOutBehavior ) ); + if ( mZoomOutBehavior != Qgis::PointCloudZoomOutRenderBehavior::RenderExtents ) + element.setAttribute( QStringLiteral( "zoomOutBehavior" ), qgsEnumValueToKey( mZoomOutBehavior ) ); } Qgis::PointCloudSymbol QgsPointCloudRenderer::pointSymbol() const diff --git a/src/core/pointcloud/qgspointcloudrendererregistry.cpp b/src/core/pointcloud/qgspointcloudrendererregistry.cpp index 10f012d1d08d..011de8c5fd66 100644 --- a/src/core/pointcloud/qgspointcloudrendererregistry.cpp +++ b/src/core/pointcloud/qgspointcloudrendererregistry.cpp @@ -109,7 +109,7 @@ QgsPointCloudRenderer *QgsPointCloudRendererRegistry::defaultRenderer( const Qgs //if red/green/blue attributes are present, then default to a RGB renderer if ( attributes.indexOf( QLatin1String( "Red" ) ) >= 0 && attributes.indexOf( QLatin1String( "Green" ) ) >= 0 && attributes.indexOf( QLatin1String( "Blue" ) ) >= 0 ) { - std::unique_ptr< QgsPointCloudRgbRenderer > renderer = std::make_unique< QgsPointCloudRgbRenderer >(); + auto renderer = std::make_unique< QgsPointCloudRgbRenderer >(); // set initial guess for rgb ranges const double redMax = stats.maximum( QStringLiteral( "Red" ) ); @@ -170,13 +170,13 @@ QgsPointCloudRenderer *QgsPointCloudRendererRegistry::defaultRenderer( const Qgs if ( !classes.empty() ) { const QgsPointCloudCategoryList categories = classificationAttributeCategories( layer ); - std::unique_ptr< QgsPointCloudClassifiedRenderer > renderer = std::make_unique< QgsPointCloudClassifiedRenderer >( QLatin1String( "Classification" ), categories ); + auto renderer = std::make_unique< QgsPointCloudClassifiedRenderer >( QLatin1String( "Classification" ), categories ); return renderer.release(); } } // fallback to shading by Z - std::unique_ptr< QgsPointCloudAttributeByRampRenderer > renderer = std::make_unique< QgsPointCloudAttributeByRampRenderer >(); + auto renderer = std::make_unique< QgsPointCloudAttributeByRampRenderer >(); renderer->setAttribute( QStringLiteral( "Z" ) ); // set initial range for z values if possible diff --git a/src/core/pointcloud/qgspointcloudrequest.cpp b/src/core/pointcloud/qgspointcloudrequest.cpp index eaaf69a025cd..4ff25e8ade19 100644 --- a/src/core/pointcloud/qgspointcloudrequest.cpp +++ b/src/core/pointcloud/qgspointcloudrequest.cpp @@ -23,7 +23,8 @@ QgsPointCloudRequest::QgsPointCloudRequest() = default; bool QgsPointCloudRequest::operator==( const QgsPointCloudRequest &other ) const { - return mFilterRect == other.filterRect() && + return mIgnoreIndexFilter == other.ignoreIndexFilterEnabled() && + mFilterRect == other.filterRect() && mAttributes.toFields() == other.attributes().toFields(); } @@ -39,5 +40,5 @@ void QgsPointCloudRequest::setAttributes( const QgsPointCloudAttributeCollection uint qHash( const QgsPointCloudRequest &request ) { - return qHash( request.filterRect() ) ^ qHash( QVariant( request.attributes().toFields() ) ); + return qHash( request.filterRect() ) ^ qHash( request.attributes().pointRecordSize() ) ^ request.ignoreIndexFilterEnabled(); } diff --git a/src/core/pointcloud/qgspointcloudrequest.h b/src/core/pointcloud/qgspointcloudrequest.h index 4e2c0be3c27e..5e7db16f1d2f 100644 --- a/src/core/pointcloud/qgspointcloudrequest.h +++ b/src/core/pointcloud/qgspointcloudrequest.h @@ -63,9 +63,30 @@ class CORE_EXPORT QgsPointCloudRequest * \since QGIS 3.30 */ void setFilterRect( QgsRectangle extent ) { mFilterRect = extent; } + + /** + * When \a enable is TRUE, the request will ignore the point cloud index's filter expression and use an empty subsetString + * practically returning all the points. Defaults to FALSE, which means the returned points will be filtered + * using the point cloud index's filter expression. + * This is used in point cloud editing where we want to iterate all points so we have the correct point indexes within each node. + * + * \see ignoreIndexFilterEnabled + * \since QGIS 3.42 + */ + void setIgnoreIndexFilterEnabled( bool enable ) { mIgnoreIndexFilter = enable; } + + /** + * Returns whether the request will ignore the point cloud index's filter expression, practically returning all the points. + * + * \see setIgnoreIndexFilterEnabled + * \since QGIS 3.42 + */ + bool ignoreIndexFilterEnabled() const { return mIgnoreIndexFilter; } + private: QgsPointCloudAttributeCollection mAttributes; QgsRectangle mFilterRect; + bool mIgnoreIndexFilter = false; }; //! Hash function for QgsPointCloudRequest diff --git a/src/core/pointcloud/qgspointcloudrgbrenderer.cpp b/src/core/pointcloud/qgspointcloudrgbrenderer.cpp index 0196e091d0ea..211faac5df95 100644 --- a/src/core/pointcloud/qgspointcloudrgbrenderer.cpp +++ b/src/core/pointcloud/qgspointcloudrgbrenderer.cpp @@ -31,7 +31,7 @@ QString QgsPointCloudRgbRenderer::type() const QgsPointCloudRenderer *QgsPointCloudRgbRenderer::clone() const { - std::unique_ptr< QgsPointCloudRgbRenderer > res = std::make_unique< QgsPointCloudRgbRenderer >(); + auto res = std::make_unique< QgsPointCloudRgbRenderer >(); res->mRedAttribute = mRedAttribute; res->mGreenAttribute = mGreenAttribute; res->mBlueAttribute = mBlueAttribute; @@ -186,7 +186,7 @@ void QgsPointCloudRgbRenderer::renderBlock( const QgsPointCloudBlock *block, Qgs QgsPointCloudRenderer *QgsPointCloudRgbRenderer::create( QDomElement &element, const QgsReadWriteContext &context ) { - std::unique_ptr< QgsPointCloudRgbRenderer > r = std::make_unique< QgsPointCloudRgbRenderer >(); + auto r = std::make_unique< QgsPointCloudRgbRenderer >(); r->setRedAttribute( element.attribute( QStringLiteral( "red" ), QStringLiteral( "Red" ) ) ); r->setGreenAttribute( element.attribute( QStringLiteral( "green" ), QStringLiteral( "Green" ) ) ); @@ -269,7 +269,7 @@ QSet QgsPointCloudRgbRenderer::usedAttributes( const QgsPointCloudRende std::unique_ptr QgsPointCloudRgbRenderer::prepare() { - std::unique_ptr< QgsPointCloudRgbRendererPreparedData > data = std::make_unique< QgsPointCloudRgbRendererPreparedData >(); + auto data = std::make_unique< QgsPointCloudRgbRendererPreparedData >(); data->redAttribute = mRedAttribute; if ( mRedContrastEnhancement ) data->redContrastEnhancement.reset( new QgsContrastEnhancement( *mRedContrastEnhancement ) ); diff --git a/src/core/processing/models/qgsprocessingmodelalgorithm.cpp b/src/core/processing/models/qgsprocessingmodelalgorithm.cpp index 17825726dc88..8cf16f42a656 100644 --- a/src/core/processing/models/qgsprocessingmodelalgorithm.cpp +++ b/src/core/processing/models/qgsprocessingmodelalgorithm.cpp @@ -373,7 +373,9 @@ QVariantMap QgsProcessingModelAlgorithm::processAlgorithm( const QVariantMap &pa break; if ( executed.contains( childId ) ) + { continue; + } bool canExecute = true; const QSet< QString > dependencies = dependsOnChildAlgorithms( childId ); @@ -387,7 +389,9 @@ QVariantMap QgsProcessingModelAlgorithm::processAlgorithm( const QVariantMap &pa } if ( !canExecute ) + { continue; + } executedAlg = true; @@ -1308,7 +1312,7 @@ QMap QgsProcessingMode QgsExpressionContextScope *QgsProcessingModelAlgorithm::createExpressionContextScopeForChildAlgorithm( const QString &childId, QgsProcessingContext &context, const QVariantMap &modelParameters, const QVariantMap &results ) const { - std::unique_ptr< QgsExpressionContextScope > scope( new QgsExpressionContextScope( QStringLiteral( "algorithm_inputs" ) ) ); + auto scope = std::make_unique( QStringLiteral( "algorithm_inputs" ) ); QMap< QString, QgsProcessingModelAlgorithm::VariableDefinition> variables = variablesForChildAlgorithm( childId, &context, modelParameters, results ); QMap< QString, QgsProcessingModelAlgorithm::VariableDefinition>::const_iterator varIt = variables.constBegin(); for ( ; varIt != variables.constEnd(); ++varIt ) diff --git a/src/core/processing/qgsprocessingcontext.cpp b/src/core/processing/qgsprocessingcontext.cpp index 3feb9876fced..f22bde0030a1 100644 --- a/src/core/processing/qgsprocessingcontext.cpp +++ b/src/core/processing/qgsprocessingcontext.cpp @@ -325,3 +325,8 @@ std::unique_ptr< QgsProcessingModelInitialRunConfig > QgsProcessingContext::take { return std::move( mModelConfig ); } + +void QgsProcessingContext::clearModelResult() +{ + mModelResult.clear(); +} diff --git a/src/core/processing/qgsprocessingcontext.h b/src/core/processing/qgsprocessingcontext.h index 33beda889663..2cc3c7cd3554 100644 --- a/src/core/processing/qgsprocessingcontext.h +++ b/src/core/processing/qgsprocessingcontext.h @@ -794,6 +794,13 @@ class CORE_EXPORT QgsProcessingContext */ QgsProcessingModelResult &modelResult() SIP_SKIP { return mModelResult; } + /** + * Clears model results previously populated when the context was used to run a model algorithm. + * + * \since QGIS 3.42 + */ + void clearModelResult(); + private: QgsProcessingContext::Flags mFlags = QgsProcessingContext::Flags(); diff --git a/src/core/processing/qgsprocessingparameters.cpp b/src/core/processing/qgsprocessingparameters.cpp index 5b4a74c8a7f4..22004d2354c5 100644 --- a/src/core/processing/qgsprocessingparameters.cpp +++ b/src/core/processing/qgsprocessingparameters.cpp @@ -2704,7 +2704,7 @@ QVariant QgsProcessingParameterDefinition::valueAsJsonObjectPrivate( const QVari p.insert( name(), value ); if ( QgsMapLayer *layer = QgsProcessingParameters::parameterAsLayer( this, p, context ) ) { - return QgsProcessingUtils::layerToStringIdentifier( layer ); + return QgsProcessingUtils::layerToStringIdentifier( layer, value.toString() ); } } @@ -2882,7 +2882,7 @@ QString QgsProcessingParameterDefinition::valueAsStringPrivate( const QVariant & p.insert( name(), value ); if ( QgsMapLayer *layer = QgsProcessingParameters::parameterAsLayer( this, p, context ) ) { - return QgsProcessingUtils::layerToStringIdentifier( layer ); + return QgsProcessingUtils::layerToStringIdentifier( layer, value.toString() ); } } @@ -3294,6 +3294,10 @@ QString QgsProcessingParameterMapLayer::asScriptCode() const { switch ( static_cast< Qgis::ProcessingSourceType >( type ) ) { + case Qgis::ProcessingSourceType::Vector: + code += QLatin1String( "table " ); + break; + case Qgis::ProcessingSourceType::VectorAnyGeometry: code += QLatin1String( "hasgeometry " ); break; @@ -3345,6 +3349,12 @@ QgsProcessingParameterMapLayer *QgsProcessingParameterMapLayer::fromScriptCode( QString def = definition; while ( true ) { + if ( def.startsWith( QLatin1String( "table" ), Qt::CaseInsensitive ) ) + { + types << static_cast< int >( Qgis::ProcessingSourceType::Vector ); + def = def.mid( 6 ); + continue; + } if ( def.startsWith( QLatin1String( "hasgeometry" ), Qt::CaseInsensitive ) ) { types << static_cast< int >( Qgis::ProcessingSourceType::VectorAnyGeometry ); diff --git a/src/core/processing/qgsprocessingutils.cpp b/src/core/processing/qgsprocessingutils.cpp index 9d53b69bf93d..091f13e6a0aa 100644 --- a/src/core/processing/qgsprocessingutils.cpp +++ b/src/core/processing/qgsprocessingutils.cpp @@ -516,7 +516,7 @@ QgsMapLayer *QgsProcessingUtils::mapLayerFromString( const QString &string, QgsP return nullptr; // prefer project layers - if ( context.project() && typeHint == LayerHint::Annotation && string.compare( QLatin1String( "main" ), Qt::CaseInsensitive ) == 0 ) + if ( context.project() && ( typeHint == LayerHint::Annotation ) && string.compare( QLatin1String( "main" ), Qt::CaseInsensitive ) == 0 ) return context.project()->mainAnnotationLayer(); QgsMapLayer *layer = nullptr; @@ -531,6 +531,11 @@ QgsMapLayer *QgsProcessingUtils::mapLayerFromString( const QString &string, QgsP if ( layer ) return layer; + // check main annotation layer + if ( context.project() && ( typeHint == LayerHint::UnknownType ) && string.compare( QLatin1String( "main" ), Qt::CaseInsensitive ) == 0 ) + return context.project()->mainAnnotationLayer(); + + if ( !allowLoadingNewLayers ) return nullptr; @@ -574,7 +579,7 @@ QgsProcessingFeatureSource *QgsProcessingUtils::variantToSource( const QVariant if ( QgsVectorLayer *layer = qobject_cast< QgsVectorLayer * >( qvariant_cast( val ) ) ) { - std::unique_ptr< QgsProcessingFeatureSource> source = std::make_unique< QgsProcessingFeatureSource >( layer, context, false, featureLimit, filterExpression ); + auto source = std::make_unique< QgsProcessingFeatureSource >( layer, context, false, featureLimit, filterExpression ); if ( overrideGeometryCheck ) source->setInvalidGeometryCheck( geometryCheck ); return source.release(); @@ -590,7 +595,7 @@ QgsProcessingFeatureSource *QgsProcessingUtils::variantToSource( const QVariant // fall back to default if ( QgsVectorLayer *layer = qobject_cast< QgsVectorLayer * >( qvariant_cast( fallbackValue ) ) ) { - std::unique_ptr< QgsProcessingFeatureSource> source = std::make_unique< QgsProcessingFeatureSource >( layer, context, false, featureLimit, filterExpression ); + auto source = std::make_unique< QgsProcessingFeatureSource >( layer, context, false, featureLimit, filterExpression ); if ( overrideGeometryCheck ) source->setInvalidGeometryCheck( geometryCheck ); return source.release(); @@ -743,7 +748,7 @@ QString QgsProcessingUtils::normalizeLayerSource( const QString &source ) return normalized.trimmed(); } -QString QgsProcessingUtils::layerToStringIdentifier( const QgsMapLayer *layer ) +QString QgsProcessingUtils::layerToStringIdentifier( const QgsMapLayer *layer, const QString &layerName ) { if ( !layer ) return QString(); @@ -761,6 +766,12 @@ QString QgsProcessingUtils::layerToStringIdentifier( const QgsMapLayer *layer ) return QStringLiteral( "%1://%2" ).arg( provider, source ); } + + if ( layer->type() == Qgis::LayerType::Annotation && layerName.compare( QLatin1String( "main" ), Qt::CaseInsensitive ) == 0 ) + { + return layerName; + } + return layer->id(); } @@ -1000,7 +1011,7 @@ QgsFeatureSink *QgsProcessingUtils::createFeatureSink( QString &destination, Qgs destination = layer->id(); // this is a factory, so we need to return a proxy - std::unique_ptr< QgsProcessingFeatureSink > sink( new QgsProcessingFeatureSink( layer->dataProvider(), destination, context ) ); + auto sink = std::make_unique( layer->dataProvider(), destination, context ); context.temporaryLayerStore()->addMapLayer( layer.release() ); return sink.release(); @@ -1033,7 +1044,7 @@ QgsFeatureSink *QgsProcessingUtils::createFeatureSink( QString &destination, Qgs { saveOptions.actionOnExistingFile = QgsVectorFileWriter::AppendToLayerNoNewFields; // sniff destination file to get correct wkb type and crs - std::unique_ptr< QgsVectorLayer > vl = std::make_unique< QgsVectorLayer >( destination ); + auto vl = std::make_unique< QgsVectorLayer >( destination ); if ( vl->isValid() ) { remappingDefinition->setDestinationWkbType( vl->wkbType() ); @@ -1070,7 +1081,7 @@ QgsFeatureSink *QgsProcessingUtils::createFeatureSink( QString &destination, Qgs if ( remappingDefinition ) { - std::unique_ptr< QgsRemappingProxyFeatureSink > remapSink = std::make_unique< QgsRemappingProxyFeatureSink >( *remappingDefinition, writer.release(), true ); + auto remapSink = std::make_unique< QgsRemappingProxyFeatureSink >( *remappingDefinition, writer.release(), true ); remapSink->setExpressionContext( context.expressionContext() ); remapSink->setTransformContext( context.transformContext() ); return new QgsProcessingFeatureSink( remapSink.release(), destination, context, true ); @@ -1093,7 +1104,7 @@ QgsFeatureSink *QgsProcessingUtils::createFeatureSink( QString &destination, Qgs uri = QgsProviderRegistry::instance()->encodeUri( providerKey, parts ); } - std::unique_ptr< QgsVectorLayer > layer = std::make_unique( uri, destination, providerKey, layerOptions ); + auto layer = std::make_unique( uri, destination, providerKey, layerOptions ); // update destination to layer ID destination = layer->id(); if ( layer->isValid() ) @@ -1115,7 +1126,7 @@ QgsFeatureSink *QgsProcessingUtils::createFeatureSink( QString &destination, Qgs } } - std::unique_ptr< QgsRemappingProxyFeatureSink > remapSink = std::make_unique< QgsRemappingProxyFeatureSink >( *remappingDefinition, layer->dataProvider(), false ); + auto remapSink = std::make_unique< QgsRemappingProxyFeatureSink >( *remappingDefinition, layer->dataProvider(), false ); context.temporaryLayerStore()->addMapLayer( layer.release() ); remapSink->setExpressionContext( context.expressionContext() ); remapSink->setTransformContext( context.transformContext() ); @@ -1125,7 +1136,7 @@ QgsFeatureSink *QgsProcessingUtils::createFeatureSink( QString &destination, Qgs else { //create empty layer - std::unique_ptr< QgsVectorLayerExporter > exporter = std::make_unique( uri, providerKey, newFields, geometryType, crs, true, options, sinkFlags ); + auto exporter = std::make_unique( uri, providerKey, newFields, geometryType, crs, true, options, sinkFlags ); if ( exporter->errorCode() != Qgis::VectorExportResult::Success ) { throw QgsProcessingException( QObject::tr( "Could not create layer %1: %2" ).arg( destination, exporter->errorMessage() ) ); @@ -1264,7 +1275,7 @@ QString QgsProcessingUtils::tempFolder( const QgsProcessingContext *context ) if ( sTempFolders.empty() ) { const QString templatePath = QStringLiteral( "%1/processing_XXXXXX" ).arg( QDir::tempPath() ); - std::unique_ptr< QTemporaryDir > tempFolder = std::make_unique< QTemporaryDir >( templatePath ); + auto tempFolder = std::make_unique< QTemporaryDir >( templatePath ); sFolder = tempFolder->path(); sTempFolders.emplace_back( std::move( tempFolder ) ); } @@ -1275,7 +1286,7 @@ QString QgsProcessingUtils::tempFolder( const QgsProcessingContext *context ) QDir().mkpath( basePath ); const QString templatePath = QStringLiteral( "%1/processing_XXXXXX" ).arg( basePath ); - std::unique_ptr< QTemporaryDir > tempFolder = std::make_unique< QTemporaryDir >( templatePath ); + auto tempFolder = std::make_unique< QTemporaryDir >( templatePath ); sFolder = tempFolder->path(); sTempFolders.emplace_back( std::move( tempFolder ) ); } diff --git a/src/core/processing/qgsprocessingutils.h b/src/core/processing/qgsprocessingutils.h index 4bf47a96eefb..fd82eded11c5 100644 --- a/src/core/processing/qgsprocessingutils.h +++ b/src/core/processing/qgsprocessingutils.h @@ -315,7 +315,7 @@ class CORE_EXPORT QgsProcessingUtils * * \since QGIS 3.34 */ - static QString layerToStringIdentifier( const QgsMapLayer *layer ) SIP_HOLDGIL; + static QString layerToStringIdentifier( const QgsMapLayer *layer, const QString &layerName = QString() ) SIP_HOLDGIL; /** * Converts a variant to a Python literal. diff --git a/src/core/proj/qgscoordinatereferencesystem.cpp b/src/core/proj/qgscoordinatereferencesystem.cpp index 5b4d2ff63dfc..ec02aa463449 100644 --- a/src/core/proj/qgscoordinatereferencesystem.cpp +++ b/src/core/proj/qgscoordinatereferencesystem.cpp @@ -1431,13 +1431,9 @@ QString QgsCoordinateReferenceSystem::celestialBodyName() const if ( !pj ) return QString(); -#if PROJ_VERSION_MAJOR>8 || (PROJ_VERSION_MAJOR==8 && PROJ_VERSION_MINOR>=1) PJ_CONTEXT *context = QgsProjContext::get(); return QString( proj_get_celestial_body_name( context, pj ) ); -#else - throw QgsNotSupportedException( QObject::tr( "Retrieving celestial body requires a QGIS build based on PROJ 8.1 or later" ) ); -#endif } void QgsCoordinateReferenceSystem::setCoordinateEpoch( double epoch ) @@ -1466,7 +1462,6 @@ QgsDatumEnsemble QgsCoordinateReferenceSystem::datumEnsemble() const if ( !pj ) return res; -#if PROJ_VERSION_MAJOR>=8 PJ_CONTEXT *context = QgsProjContext::get(); QgsProjUtils::proj_pj_unique_ptr ensemble = QgsProjUtils::crsToDatumEnsemble( pj ); @@ -1498,9 +1493,6 @@ QgsDatumEnsemble QgsCoordinateReferenceSystem::datumEnsemble() const res.mMembers << details; } return res; -#else - throw QgsNotSupportedException( QObject::tr( "Calculating datum ensembles requires a QGIS build based on PROJ 8.0 or later" ) ); -#endif } QgsProjectionFactors QgsCoordinateReferenceSystem::factors( const QgsPoint &point ) const @@ -1688,11 +1680,7 @@ void QgsCoordinateReferenceSystem::setProjString( const QString &proj4String ) { #ifdef QGISDEBUG const int errNo = proj_context_errno( ctx ); -#if PROJ_VERSION_MAJOR>=8 QgsDebugError( QStringLiteral( "proj string rejected: %1" ).arg( proj_context_errno_string( ctx, errNo ) ) ); -#else - QgsDebugError( QStringLiteral( "proj string rejected: %1" ).arg( proj_errno_string( errNo ) ) ); -#endif #endif d->mIsValid = false; } diff --git a/src/core/proj/qgscoordinatereferencesystem.h b/src/core/proj/qgscoordinatereferencesystem.h index acf51f56c74f..79d2e139cae3 100644 --- a/src/core/proj/qgscoordinatereferencesystem.h +++ b/src/core/proj/qgscoordinatereferencesystem.h @@ -48,13 +48,8 @@ class QgsProjOperation; struct PJconsts; typedef struct PJconsts PJ; -#if PROJ_VERSION_MAJOR>=8 struct pj_ctx; typedef struct pj_ctx PJ_CONTEXT; -#else -struct projCtx_t; -typedef struct projCtx_t PJ_CONTEXT; -#endif #endif // forward declaration for sqlite3 @@ -776,24 +771,16 @@ class CORE_EXPORT QgsCoordinateReferenceSystem * * \note In the case of a compound crs, this method will always return the datum ensemble for the horizontal component. * - * \warning This method requires PROJ 8.0 or later - * - * \throws QgsNotSupportedException on QGIS builds based on PROJ 7 or earlier. - * * \since QGIS 3.20 */ - QgsDatumEnsemble datumEnsemble() const SIP_THROW( QgsNotSupportedException ); + QgsDatumEnsemble datumEnsemble() const; /** * Attempts to retrieve the name of the celestial body associated with the CRS (e.g. "Earth"). * - * \warning This method requires PROJ 8.1 or later - * - * \throws QgsNotSupportedException on QGIS builds based on PROJ 8.0 or earlier. - * * \since QGIS 3.20 */ - QString celestialBodyName() const SIP_THROW( QgsNotSupportedException ); + QString celestialBodyName() const; /** * Sets the coordinate \a epoch, as a decimal year. diff --git a/src/core/proj/qgscoordinatereferencesystemregistry.cpp b/src/core/proj/qgscoordinatereferencesystemregistry.cpp index c2fa19782141..061ff1c25676 100644 --- a/src/core/proj/qgscoordinatereferencesystemregistry.cpp +++ b/src/core/proj/qgscoordinatereferencesystemregistry.cpp @@ -380,7 +380,6 @@ QMap QgsCoordinateReferenceSystemRegistry::projOperat QList< QgsCelestialBody> QgsCoordinateReferenceSystemRegistry::celestialBodies() const { -#if PROJ_VERSION_MAJOR>8 || (PROJ_VERSION_MAJOR==8 && PROJ_VERSION_MINOR>=1) static QList< QgsCelestialBody > sCelestialBodies; static std::once_flag initialized; std::call_once( initialized, [] @@ -409,9 +408,6 @@ QList< QgsCelestialBody> QgsCoordinateReferenceSystemRegistry::celestialBodies() } ); return sCelestialBodies; -#else - throw QgsNotSupportedException( QObject::tr( "Retrieving celestial bodies requires a QGIS build based on PROJ 8.1 or later" ) ); -#endif } QSet QgsCoordinateReferenceSystemRegistry::authorities() const diff --git a/src/core/proj/qgscoordinatereferencesystemregistry.h b/src/core/proj/qgscoordinatereferencesystemregistry.h index 89b1e83d4ae7..cc82e5933b4f 100644 --- a/src/core/proj/qgscoordinatereferencesystemregistry.h +++ b/src/core/proj/qgscoordinatereferencesystemregistry.h @@ -162,10 +162,6 @@ class CORE_EXPORT QgsCoordinateReferenceSystemRegistry : public QObject /** * Returns a list of all known celestial bodies. * - * \warning This method requires PROJ 8.1 or later - * - * \throws QgsNotSupportedException on QGIS builds based on PROJ 8.0 or earlier. - * * \since QGIS 3.20 */ QList< QgsCelestialBody > celestialBodies() const; diff --git a/src/core/proj/qgscoordinatetransform.cpp b/src/core/proj/qgscoordinatetransform.cpp index cf7963adda94..2304181cc5c4 100644 --- a/src/core/proj/qgscoordinatetransform.cpp +++ b/src/core/proj/qgscoordinatetransform.cpp @@ -193,10 +193,8 @@ bool QgsCoordinateTransform::isTransformationPossible( const QgsCoordinateRefere if ( !source.isValid() || !destination.isValid() ) return false; -#if PROJ_VERSION_MAJOR>8 || (PROJ_VERSION_MAJOR==8 && PROJ_VERSION_MINOR>=1) if ( source.celestialBodyName() != destination.celestialBodyName() ) return false; -#endif return true; } @@ -594,6 +592,26 @@ QgsRectangle QgsCoordinateTransform::transformBoundingBox( const QgsRectangle &r return QgsRectangle( p, p ); } +#ifdef QGISDEBUG + if ( !mHasContext ) + { + QgsDebugMsgLevel( QStringLiteral( "No QgsCoordinateTransformContext context set for transform" ), 4 ); + } +#endif + + // we can't calculate if transform involves a geocentric CRS. This is silly anyway, + // as transformation of a 2d bounding box makes no sense when a geocentric CRS is involved! + if ( d->mSourceCRS.type() == Qgis::CrsType::Geocentric ) + { + throw QgsCsException( QObject::tr( "Could not transform bounding box for geocentric CRS %1" ).arg( d->mSourceCRS.authid() ) ); + } + if ( d->mDestCRS.type() == Qgis::CrsType::Geocentric ) + { + throw QgsCsException( QObject::tr( "Could not transform bounding box for geocentric CRS %1" ).arg( d->mDestCRS.authid() ) ); + } + + const double xMin = rect.xMinimum(); + const double xMax = rect.xMaximum(); double yMin = rect.yMinimum(); double yMax = rect.yMaximum(); if ( d->mGeographicToWebMercator && @@ -620,6 +638,109 @@ QgsRectangle QgsCoordinateTransform::transformBoundingBox( const QgsRectangle &r } } + // delegate logic to proj if version >= 8.2 available +#if PROJ_VERSION_MAJOR>8 || (PROJ_VERSION_MAJOR==8 && PROJ_VERSION_MINOR>=2) + + QgsScopedProjSilentLogger errorLogger; + + QgsDebugMsgLevel( QStringLiteral( "Entering transformBoundingBox..." ), 4 ); + + ProjData projData = d->threadLocalProjData(); + PJ_CONTEXT *projContext = QgsProjContext::get(); + +#if PROJ_VERSION_MAJOR< 9 || (PROJ_VERSION_MAJOR==9 && PROJ_VERSION_MINOR<6) + // if source or destination crs include vertical components, we need to demote them to + // 2d crs first, otherwise proj_trans_bounds fails on proj < 9.6 (see https://github.com/OSGeo/PROJ/pull/4333) + + QgsProjUtils::proj_pj_unique_ptr srcCrs( proj_get_source_crs( projContext, projData ) ); + QgsProjUtils::proj_pj_unique_ptr destCrs( proj_get_target_crs( projContext, projData ) ); + + QgsProjUtils::proj_pj_unique_ptr srcCrsHorizontal; + QgsProjUtils::proj_pj_unique_ptr destCrsHorizontal; + QgsProjUtils::proj_pj_unique_ptr transform2D; + if ( QgsProjUtils::hasVerticalAxis( srcCrs.get() ) || + QgsProjUtils::hasVerticalAxis( destCrs.get() ) ) + { + srcCrsHorizontal = QgsProjUtils::crsToHorizontalCrs( srcCrs.get() ); + destCrsHorizontal = QgsProjUtils::crsToHorizontalCrs( destCrs.get() ); + transform2D.reset( proj_create_crs_to_crs_from_pj( projContext, srcCrsHorizontal.get(), destCrsHorizontal.get(), nullptr, nullptr ) ); + projData = transform2D.get(); + } +#endif + + double transXMin = 0; + double transYMin = 0; + double transXMax = 0; + double transYMax = 0; + + proj_errno_reset( projData ); + // proj documentation recommends 21 points for densification + constexpr int DENSIFY_POINTS = 21; + const int projResult = proj_trans_bounds( projContext, projData, ( direction == Qgis::TransformDirection::Forward && !d->mIsReversed ) || ( direction == Qgis::TransformDirection::Reverse && d->mIsReversed ) ? PJ_FWD : PJ_INV, + xMin, yMin, xMax, yMax, + &transXMin, &transYMin, &transXMax, &transYMax, DENSIFY_POINTS ); + if ( projResult != 1 + || !std::isfinite( transXMin ) + || !std::isfinite( transXMax ) + || !std::isfinite( transYMin ) + || !std::isfinite( transYMax ) ) + { + const QString projErr = QString::fromUtf8( proj_context_errno_string( projContext, proj_errno( projData ) ) ); + const QString dir = ( direction == Qgis::TransformDirection::Forward ) ? QObject::tr( "Forward transform" ) : QObject::tr( "Inverse transform" ); + const QString msg = QObject::tr( "%1 (%2 to %3) of bounding box failed: %4" ) + .arg( dir, + ( direction == Qgis::TransformDirection::Forward ) ? d->mSourceCRS.authid() : d->mDestCRS.authid(), + ( direction == Qgis::TransformDirection::Forward ) ? d->mDestCRS.authid() : d->mSourceCRS.authid(), + projErr ); + QgsDebugError( msg ); + + throw QgsCsException( msg ); + } + + // check if result bbox is geographic and is crossing 180/-180 line: ie. min X is before the 180° and max X is after the -180° + bool doHandle180Crossover = false; + + if ( handle180Crossover + && ( ( direction == Qgis::TransformDirection::Forward && d->mDestCRS.isGeographic() ) || + ( direction == Qgis::TransformDirection::Reverse && d->mSourceCRS.isGeographic() ) ) + && ( transXMax < transXMin ) ) + { + //if crossing the date line, temporarily add 360 degrees to -ve longitudes + std::swap( transXMax, transXMin ); + if ( transXMin < 0 ) + transXMin += 360; + if ( transXMax < 0 ) + transXMax += 360; + doHandle180Crossover = true; + } + + QgsRectangle boundingBoxRect{ transXMin, transYMin, transXMax, transYMax }; + if ( boundingBoxRect.isNull() ) + { + // something bad happened when reprojecting the filter rect... no finite points were left! + throw QgsCsException( QObject::tr( "Could not transform bounding box to target CRS" ) ); + } + + if ( doHandle180Crossover ) + { + //subtract temporary addition of 360 degrees from longitudes + if ( boundingBoxRect.xMinimum() > 180.0 ) + boundingBoxRect.setXMinimum( boundingBoxRect.xMinimum() - 360.0 ); + if ( boundingBoxRect.xMaximum() > 180.0 ) + boundingBoxRect.setXMaximum( boundingBoxRect.xMaximum() - 360.0 ); + } + + QgsDebugMsgLevel( "Projected extent: " + boundingBoxRect.toString(), 4 ); + + if ( boundingBoxRect.isEmpty() ) + { + QgsDebugMsgLevel( "Original extent: " + rect.toString(), 4 ); + } + + return boundingBoxRect; +#else + // this logic is buggy! See https://github.com/qgis/QGIS/issues/59821 + // 64 points (<=2.12) is not enough, see #13665, for EPSG:4326 -> EPSG:3574 (say that it is a hard one), // are decent result from about 500 points and more. This method is called quite often, but // even with 1000 points it takes < 1ms. @@ -649,7 +770,7 @@ QgsRectangle QgsCoordinateTransform::transformBoundingBox( const QgsRectangle &r { // Start at right edge - double pointX = rect.xMinimum(); + double pointX = xMin; for ( int j = 0; j < nXPoints; j++ ) { @@ -733,6 +854,7 @@ QgsRectangle QgsCoordinateTransform::transformBoundingBox( const QgsRectangle &r } return bb_rect; +#endif } void QgsCoordinateTransform::transformCoords( int numPoints, double *x, double *y, double *z, Qgis::TransformDirection direction ) const @@ -788,9 +910,6 @@ void QgsCoordinateTransform::transformCoords( int numPoints, double *x, double * #endif // use proj4 to do the transform - - // if the source/destination projection is lat/long, convert the points to radians - // prior to transforming ProjData projData = d->threadLocalProjData(); int projResult = 0; @@ -902,12 +1021,8 @@ void QgsCoordinateTransform::transformCoords( int numPoints, double *x, double * const QString dir = ( direction == Qgis::TransformDirection::Forward ) ? QObject::tr( "Forward transform" ) : QObject::tr( "Inverse transform" ); -#if PROJ_VERSION_MAJOR>=8 PJ_CONTEXT *projContext = QgsProjContext::get(); const QString projError = !errorOccurredDuringFallbackOperation ? QString::fromUtf8( proj_context_errno_string( projContext, projResult ) ) : QObject::tr( "Fallback transform failed" ); -#else - const QString projError = !errorOccurredDuringFallbackOperation ? QString::fromUtf8( proj_errno_string( projResult ) ) : QObject::tr( "Fallback transform failed" ); -#endif const QString msg = QObject::tr( "%1 (%2 to %3) of%4%5Error: %6" ) .arg( dir, diff --git a/src/core/proj/qgscoordinatetransform.h b/src/core/proj/qgscoordinatetransform.h index 649174003988..45564a2f0ef3 100644 --- a/src/core/proj/qgscoordinatetransform.h +++ b/src/core/proj/qgscoordinatetransform.h @@ -257,6 +257,7 @@ class CORE_EXPORT QgsCoordinateTransform * \param handle180Crossover set to TRUE if destination CRS is geographic and handling of extents * crossing the 180 degree longitude line is required * \returns rectangle in destination CRS + * \warning Do not call this method if the transformation involves geocentric CRS -- in this situation transformation of a 2D bounding box is meaningless! Calling this method with a geocentric CRS will result in a QgsCsException being thrown. * \throws QgsCsException if the transformation fails */ QgsRectangle transformBoundingBox( const QgsRectangle &rectangle, Qgis::TransformDirection direction = Qgis::TransformDirection::Forward, bool handle180Crossover = false ) const SIP_THROW( QgsCsException ); diff --git a/src/core/proj/qgscoordinatetransform_p.cpp b/src/core/proj/qgscoordinatetransform_p.cpp index ad0b9a5413ef..dc972831cdd1 100644 --- a/src/core/proj/qgscoordinatetransform_p.cpp +++ b/src/core/proj/qgscoordinatetransform_p.cpp @@ -334,11 +334,7 @@ ProjData QgsCoordinateTransformPrivate::threadLocalProjData() const int errNo = proj_context_errno( context ); if ( errNo ) { -#if PROJ_VERSION_MAJOR>=8 nonAvailableError = QString( proj_context_errno_string( context, errNo ) ); -#else - nonAvailableError = QString( proj_errno_string( errNo ) ); -#endif } else { @@ -473,11 +469,7 @@ ProjData QgsCoordinateTransformPrivate::threadLocalProjData() const QStringList projErrors = errorLogger.errors(); if ( errNo ) { -#if PROJ_VERSION_MAJOR>=8 nonAvailableError = QString( proj_context_errno_string( context, errNo ) ); -#else - nonAvailableError = QString( proj_errno_string( errNo ) ); -#endif } else if ( !projErrors.empty() ) { diff --git a/src/core/proj/qgsellipsoidutils.cpp b/src/core/proj/qgsellipsoidutils.cpp index 87b240cab1f8..4f1270131438 100644 --- a/src/core/proj/qgsellipsoidutils.cpp +++ b/src/core/proj/qgsellipsoidutils.cpp @@ -271,9 +271,7 @@ QList QgsEllipsoidUtils::definitions() name.replace( '_', ' ' ); def.description = QStringLiteral( "%1 (%2:%3)" ).arg( name, authority, code ); -#if PROJ_VERSION_MAJOR>8 || (PROJ_VERSION_MAJOR==8 && PROJ_VERSION_MINOR>=1) def.celestialBodyName = proj_get_celestial_body_name( context, ellipsoid.get() ); -#endif double semiMajor, semiMinor, invFlattening; int semiMinorComputed = 0; diff --git a/src/core/proj/qgsprojutils.cpp b/src/core/proj/qgsprojutils.cpp index 453086b50622..dc15e1bf7ebb 100644 --- a/src/core/proj/qgsprojutils.cpp +++ b/src/core/proj/qgsprojutils.cpp @@ -279,6 +279,11 @@ bool QgsProjUtils::hasVerticalAxis( const PJ *crs ) return false; } + case PJ_TYPE_BOUND_CRS: + { + return hasVerticalAxis( proj_get_source_crs( context, crs ) ); + } + // maybe other types to handle like this?? default: @@ -340,7 +345,6 @@ QgsProjUtils::proj_pj_unique_ptr QgsProjUtils::crsToDatumEnsemble( const PJ *crs if ( !crs ) return nullptr; -#if PROJ_VERSION_MAJOR>=8 PJ_CONTEXT *context = QgsProjContext::get(); QgsProjUtils::proj_pj_unique_ptr candidate = crsToHorizontalCrs( crs ); if ( !candidate ) // purely vertical CRS @@ -350,9 +354,6 @@ QgsProjUtils::proj_pj_unique_ptr QgsProjUtils::crsToDatumEnsemble( const PJ *crs return nullptr; return QgsProjUtils::proj_pj_unique_ptr( proj_crs_get_datum_ensemble( context, candidate.get() ) ); -#else - throw QgsNotSupportedException( QObject::tr( "Calculating datum ensembles requires a QGIS build based on PROJ 8.0 or later" ) ); -#endif } void QgsProjUtils::proj_collecting_logger( void *user_data, int /*level*/, const char *message ) @@ -363,6 +364,10 @@ void QgsProjUtils::proj_collecting_logger( void *user_data, int /*level*/, const dest->append( messageString ); } +void QgsProjUtils::proj_silent_logger( void * /*user_data*/, int /*level*/, const char * /*message*/ ) +{ +} + void QgsProjUtils::proj_logger( void *, int level, const char *message ) { #ifdef QGISDEBUG @@ -623,3 +628,18 @@ QgsScopedProjCollectingLogger::~QgsScopedProjCollectingLogger() // reset logger back to terminal output proj_log_func( QgsProjContext::get(), nullptr, QgsProjUtils::proj_logger ); } + +// +// QgsScopedProjSilentLogger +// + +QgsScopedProjSilentLogger::QgsScopedProjSilentLogger() +{ + proj_log_func( QgsProjContext::get(), nullptr, QgsProjUtils::proj_silent_logger ); +} + +QgsScopedProjSilentLogger::~QgsScopedProjSilentLogger() +{ + // reset logger back to terminal output + proj_log_func( QgsProjContext::get(), nullptr, QgsProjUtils::proj_logger ); +} diff --git a/src/core/proj/qgsprojutils.h b/src/core/proj/qgsprojutils.h index 862e52a76b87..fa5299283cf1 100644 --- a/src/core/proj/qgsprojutils.h +++ b/src/core/proj/qgsprojutils.h @@ -206,10 +206,6 @@ class CORE_EXPORT QgsProjUtils * * \note In the case of a compound \a crs, this method will always return the datum ensemble for the horizontal component. * - * \warning This method requires PROJ 8.0 or later - * - * \throws QgsNotSupportedException on QGIS builds based on PROJ 7 or earlier. - * * \since QGIS 3.20 */ static proj_pj_unique_ptr crsToDatumEnsemble( const PJ *crs ); @@ -257,6 +253,11 @@ class CORE_EXPORT QgsProjUtils */ static void proj_collecting_logger( void *user_data, int level, const char *message ); + /** + * QGIS proj log function which ignores errors. + */ + static void proj_silent_logger( void *user_data, int level, const char *message ); + #if 0 // not possible in current Proj 6 API /** @@ -270,13 +271,8 @@ class CORE_EXPORT QgsProjUtils #ifndef SIP_RUN -#if PROJ_VERSION_MAJOR>=8 struct pj_ctx; typedef struct pj_ctx PJ_CONTEXT; -#else -struct projCtx_t; -typedef struct projCtx_t PJ_CONTEXT; -#endif /** * \class QgsProjContext @@ -311,6 +307,38 @@ class CORE_EXPORT QgsProjContext #endif }; +/** + * \ingroup core + * + * \brief Scoped object for temporary suppression of PROJ logging output. + * + * Temporarily sets the PROJ log function to one which suppresses errors for the lifetime of the object, + * before returning it to the default QGIS proj logging function on destruction. + * + * \note The collecting logger ONLY applies to the current thread. + * + * \note Not available in Python bindings + * \since QGIS 3.42 + */ +class CORE_EXPORT QgsScopedProjSilentLogger +{ + public: + + /** + * Constructor for QgsScopedProjSilentLogger. + * + * PROJ errors will be ignored. + */ + QgsScopedProjSilentLogger(); + + /** + * Returns the PROJ logger back to the default QGIS PROJ logger. + */ + ~QgsScopedProjSilentLogger(); + +}; + + /** * \ingroup core diff --git a/src/core/project/qgsproject.cpp b/src/core/project/qgsproject.cpp index 6741df458ac8..6965cefe2419 100644 --- a/src/core/project/qgsproject.cpp +++ b/src/core/project/qgsproject.cpp @@ -1991,7 +1991,7 @@ bool QgsProject::read( Qgis::ProjectReadFlags flags ) const QString attachmentsZip = finfo.absoluteDir().absoluteFilePath( QStringLiteral( "%1_attachments.zip" ).arg( finfo.completeBaseName() ) ); if ( QFile( attachmentsZip ).exists() ) { - std::unique_ptr archive( new QgsArchive() ); + auto archive = std::make_unique(); if ( archive->unzip( attachmentsZip ) ) { releaseHandlesToProjectArchive(); @@ -2040,7 +2040,7 @@ bool QgsProject::readProjectFile( const QString &filename, Qgis::ProjectReadFlag } profile.switchTask( tr( "Reading project file" ) ); - std::unique_ptr doc( new QDomDocument( QStringLiteral( "qgis" ) ) ); + auto doc = std::make_unique( QStringLiteral( "qgis" ) ); if ( !projectFile.open( QIODevice::ReadOnly | QIODevice::Text ) ) { @@ -2855,7 +2855,7 @@ QgsExpressionContextScope *QgsProject::createExpressionContextScope() const // MUCH cheaper to clone than build if ( mProjectScope ) { - std::unique_ptr< QgsExpressionContextScope > projectScope = std::make_unique< QgsExpressionContextScope >( *mProjectScope ); + auto projectScope = std::make_unique< QgsExpressionContextScope >( *mProjectScope ); // we can't cache these variables projectScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "project_distance_units" ), QgsUnitTypes::toString( distanceUnits() ), true, true ) ); @@ -3248,7 +3248,7 @@ bool QgsProject::writeProjectFile( const QString &filename ) const QDomDocumentType documentType = QDomImplementation().createDocumentType( QStringLiteral( "qgis" ), QStringLiteral( "http://mrcc.com/qgis.dtd" ), QStringLiteral( "SYSTEM" ) ); - std::unique_ptr doc( new QDomDocument( documentType ) ); + auto doc = std::make_unique( documentType ); QDomElement qgisNode = doc->createElement( QStringLiteral( "qgis" ) ); qgisNode.setAttribute( QStringLiteral( "projectname" ), title() ); @@ -4596,7 +4596,7 @@ bool QgsProject::unzip( const QString &filename, Qgis::ProjectReadFlags flags ) QGIS_PROTECT_QOBJECT_THREAD_ACCESS clearError(); - std::unique_ptr archive( new QgsProjectArchive() ); + auto archive = std::make_unique(); // unzip the archive if ( !archive->unzip( filename ) ) @@ -4648,7 +4648,7 @@ bool QgsProject::zip( const QString &filename ) clearError(); // save the current project in a temporary .qgs file - std::unique_ptr archive( new QgsProjectArchive() ); + auto archive = std::make_unique(); const QString baseName = QFileInfo( filename ).baseName(); const QString qgsFileName = QStringLiteral( "%1.qgs" ).arg( baseName ); QFile qgsFile( QDir( archive->dir() ).filePath( qgsFileName ) ); diff --git a/src/core/providers/arcgis/qgsarcgisrestquery.cpp b/src/core/providers/arcgis/qgsarcgisrestquery.cpp index 65f84cf07d19..9a52262c303c 100644 --- a/src/core/providers/arcgis/qgsarcgisrestquery.cpp +++ b/src/core/providers/arcgis/qgsarcgisrestquery.cpp @@ -535,11 +535,13 @@ void QgsArcGisAsyncQuery::start( const QUrl &url, const QString &authCfg, QByteA } QgsSetRequestInitiatorClass( request, QStringLiteral( "QgsArcGisAsyncQuery" ) ); + request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy ); if ( allowCache ) { request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache ); request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, true ); } + mReply = QgsNetworkAccessManager::instance()->get( request ); connect( mReply, &QNetworkReply::finished, this, &QgsArcGisAsyncQuery::handleReply ); } @@ -560,6 +562,7 @@ void QgsArcGisAsyncQuery::handleReply() if ( !QgsVariantUtils::isNull( redirect ) ) { QNetworkRequest request = mReply->request(); + request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy ); QgsSetRequestInitiatorClass( request, QStringLiteral( "QgsArcGisAsyncQuery" ) ); QgsDebugMsgLevel( "redirecting to " + redirect.toUrl().toString(), 2 ); request.setUrl( redirect.toUrl() ); @@ -633,6 +636,7 @@ void QgsArcGisAsyncParallelQuery::handleReply() { // Handle HTTP redirects QNetworkRequest request = reply->request(); + request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy ); QgsSetRequestInitiatorClass( request, QStringLiteral( "QgsArcGisAsyncParallelQuery" ) ); QgsDebugMsgLevel( "redirecting to " + redirect.toUrl().toString(), 2 ); request.setUrl( redirect.toUrl() ); diff --git a/src/core/providers/arcgis/qgsarcgisrestutils.cpp b/src/core/providers/arcgis/qgsarcgisrestutils.cpp index e529dbb09848..c6c297953e05 100644 --- a/src/core/providers/arcgis/qgsarcgisrestutils.cpp +++ b/src/core/providers/arcgis/qgsarcgisrestutils.cpp @@ -164,7 +164,7 @@ std::unique_ptr< QgsCircularString > QgsArcGisRestUtils::convertCircularString( points << *interiorPoint; points << *endPoint; } - std::unique_ptr< QgsCircularString > curve = std::make_unique< QgsCircularString> (); + auto curve = std::make_unique< QgsCircularString> (); curve->setPoints( points ); return curve; } @@ -172,7 +172,7 @@ std::unique_ptr< QgsCircularString > QgsArcGisRestUtils::convertCircularString( std::unique_ptr< QgsCompoundCurve > QgsArcGisRestUtils::convertCompoundCurve( const QVariantList &curvesList, Qgis::WkbType pointType ) { // [[6,3],[5,3],{"b":[[3,2],[6,1],[2,4]]},[1,2],{"c": [[3,3],[1,4]]}] - std::unique_ptr< QgsCompoundCurve > compoundCurve = std::make_unique< QgsCompoundCurve >(); + auto compoundCurve = std::make_unique< QgsCompoundCurve >(); QVector< double > lineX; QVector< double > lineY; @@ -330,7 +330,7 @@ std::unique_ptr< QgsMultiPoint > QgsArcGisRestUtils::convertMultiPoint( const QV // {"points" : [[ , , , ] , [ , , , ], ... ]} const QVariantList coordsList = geometryData[QStringLiteral( "points" )].toList(); - std::unique_ptr< QgsMultiPoint > multiPoint = std::make_unique< QgsMultiPoint >(); + auto multiPoint = std::make_unique< QgsMultiPoint >(); multiPoint->reserve( coordsList.size() ); for ( const QVariant &coordData : coordsList ) { @@ -367,7 +367,7 @@ std::unique_ptr< QgsMultiCurve > QgsArcGisRestUtils::convertGeometryPolyline( co pathsList = geometryData[QStringLiteral( "curvePaths" )].toList(); if ( pathsList.isEmpty() ) return nullptr; - std::unique_ptr< QgsMultiCurve > multiCurve = std::make_unique< QgsMultiCurve >(); + auto multiCurve = std::make_unique< QgsMultiCurve >(); multiCurve->reserve( pathsList.size() ); for ( const QVariant &pathData : std::as_const( pathsList ) ) { @@ -405,11 +405,11 @@ std::unique_ptr< QgsMultiSurface > QgsArcGisRestUtils::convertGeometryPolygon( c if ( curves.count() == 0 ) return nullptr; - std::unique_ptr< QgsMultiSurface > result = std::make_unique< QgsMultiSurface >(); + auto result = std::make_unique< QgsMultiSurface >(); if ( curves.count() == 1 ) { // shortcut for exterior ring only - std::unique_ptr< QgsCurvePolygon > newPolygon = std::make_unique< QgsCurvePolygon >(); + auto newPolygon = std::make_unique< QgsCurvePolygon >(); newPolygon->setExteriorRing( curves.takeAt( 0 ) ); result->addGeometry( newPolygon.release() ); return result; @@ -460,13 +460,13 @@ std::unique_ptr< QgsPolygon > QgsArcGisRestUtils::convertEnvelope( const QVarian double ymax = geometryData[QStringLiteral( "ymax" )].toDouble( &ymaxOk ); if ( !xminOk || !yminOk || !xmaxOk || !ymaxOk ) return nullptr; - std::unique_ptr< QgsLineString > ext = std::make_unique< QgsLineString> (); + auto ext = std::make_unique< QgsLineString> (); ext->addVertex( QgsPoint( xmin, ymin ) ); ext->addVertex( QgsPoint( xmax, ymin ) ); ext->addVertex( QgsPoint( xmax, ymax ) ); ext->addVertex( QgsPoint( xmin, ymax ) ); ext->addVertex( QgsPoint( xmin, ymin ) ); - std::unique_ptr< QgsPolygon > poly = std::make_unique< QgsPolygon >(); + auto poly = std::make_unique< QgsPolygon >(); poly->setExteriorRing( ext.release() ); return poly; } @@ -591,11 +591,11 @@ std::unique_ptr QgsArcGisRestUtils::parseEsriLineSymbolJson( cons QgsSymbolLayerList layers; Qt::PenStyle penStyle = convertLineStyle( symbolData.value( QStringLiteral( "style" ) ).toString() ); - std::unique_ptr< QgsSimpleLineSymbolLayer > lineLayer = std::make_unique< QgsSimpleLineSymbolLayer >( lineColor, widthInPoints, penStyle ); + auto lineLayer = std::make_unique< QgsSimpleLineSymbolLayer >( lineColor, widthInPoints, penStyle ); lineLayer->setWidthUnit( Qgis::RenderUnit::Points ); layers.append( lineLayer.release() ); - std::unique_ptr< QgsLineSymbol > symbol = std::make_unique< QgsLineSymbol >( layers ); + auto symbol = std::make_unique< QgsLineSymbol >( layers ); return symbol; } @@ -611,11 +611,11 @@ std::unique_ptr QgsArcGisRestUtils::parseEsriFillSymbolJson( cons double penWidthInPoints = outlineData.value( QStringLiteral( "width" ) ).toDouble( &ok ); QgsSymbolLayerList layers; - std::unique_ptr< QgsSimpleFillSymbolLayer > fillLayer = std::make_unique< QgsSimpleFillSymbolLayer >( fillColor, brushStyle, lineColor, penStyle, penWidthInPoints ); + auto fillLayer = std::make_unique< QgsSimpleFillSymbolLayer >( fillColor, brushStyle, lineColor, penStyle, penWidthInPoints ); fillLayer->setStrokeWidthUnit( Qgis::RenderUnit::Points ); layers.append( fillLayer.release() ); - std::unique_ptr< QgsFillSymbol > symbol = std::make_unique< QgsFillSymbol >( layers ); + auto symbol = std::make_unique< QgsFillSymbol >( layers ); return symbol; } @@ -643,7 +643,7 @@ std::unique_ptr QgsArcGisRestUtils::parseEsriPictureFillSymbolJso symbolPath.prepend( QLatin1String( "base64:" ) ); QgsSymbolLayerList layers; - std::unique_ptr< QgsRasterFillSymbolLayer > fillLayer = std::make_unique< QgsRasterFillSymbolLayer >( symbolPath ); + auto fillLayer = std::make_unique< QgsRasterFillSymbolLayer >( symbolPath ); fillLayer->setWidth( widthInPixels ); fillLayer->setAngle( angleCW ); fillLayer->setSizeUnit( Qgis::RenderUnit::Points ); @@ -656,11 +656,11 @@ std::unique_ptr QgsArcGisRestUtils::parseEsriPictureFillSymbolJso Qt::PenStyle penStyle = convertLineStyle( outlineData.value( QStringLiteral( "style" ) ).toString() ); double penWidthInPoints = outlineData.value( QStringLiteral( "width" ) ).toDouble( &ok ); - std::unique_ptr< QgsSimpleLineSymbolLayer > lineLayer = std::make_unique< QgsSimpleLineSymbolLayer >( lineColor, penWidthInPoints, penStyle ); + auto lineLayer = std::make_unique< QgsSimpleLineSymbolLayer >( lineColor, penWidthInPoints, penStyle ); lineLayer->setWidthUnit( Qgis::RenderUnit::Points ); layers.append( lineLayer.release() ); - std::unique_ptr< QgsFillSymbol > symbol = std::make_unique< QgsFillSymbol >( layers ); + auto symbol = std::make_unique< QgsFillSymbol >( layers ); return symbol; } @@ -705,7 +705,7 @@ std::unique_ptr QgsArcGisRestUtils::parseEsriMarkerSymbolJson( double penWidthInPoints = outlineData.value( QStringLiteral( "width" ) ).toDouble( &ok ); QgsSymbolLayerList layers; - std::unique_ptr< QgsSimpleMarkerSymbolLayer > markerLayer = std::make_unique< QgsSimpleMarkerSymbolLayer >( shape, sizeInPoints, angleCW, Qgis::ScaleMethod::ScaleArea, fillColor, lineColor ); + auto markerLayer = std::make_unique< QgsSimpleMarkerSymbolLayer >( shape, sizeInPoints, angleCW, Qgis::ScaleMethod::ScaleArea, fillColor, lineColor ); markerLayer->setSizeUnit( Qgis::RenderUnit::Points ); markerLayer->setStrokeWidthUnit( Qgis::RenderUnit::Points ); markerLayer->setStrokeStyle( penStyle ); @@ -714,7 +714,7 @@ std::unique_ptr QgsArcGisRestUtils::parseEsriMarkerSymbolJson( markerLayer->setOffsetUnit( Qgis::RenderUnit::Points ); layers.append( markerLayer.release() ); - std::unique_ptr< QgsMarkerSymbol > symbol = std::make_unique< QgsMarkerSymbol >( layers ); + auto symbol = std::make_unique< QgsMarkerSymbol >( layers ); return symbol; } @@ -742,7 +742,7 @@ std::unique_ptr QgsArcGisRestUtils::parseEsriPictureMarkerSymbo symbolPath.prepend( QLatin1String( "base64:" ) ); QgsSymbolLayerList layers; - std::unique_ptr< QgsRasterMarkerSymbolLayer > markerLayer = std::make_unique< QgsRasterMarkerSymbolLayer >( symbolPath, widthInPixels, angleCW, Qgis::ScaleMethod::ScaleArea ); + auto markerLayer = std::make_unique< QgsRasterMarkerSymbolLayer >( symbolPath, widthInPixels, angleCW, Qgis::ScaleMethod::ScaleArea ); markerLayer->setSizeUnit( Qgis::RenderUnit::Points ); // only change the default aspect ratio if the server height setting requires this @@ -753,7 +753,7 @@ std::unique_ptr QgsArcGisRestUtils::parseEsriPictureMarkerSymbo markerLayer->setOffsetUnit( Qgis::RenderUnit::Points ); layers.append( markerLayer.release() ); - std::unique_ptr< QgsMarkerSymbol > symbol = std::make_unique< QgsMarkerSymbol >( layers ); + auto symbol = std::make_unique< QgsMarkerSymbol >( layers ); return symbol; } @@ -773,7 +773,7 @@ std::unique_ptr QgsArcGisRestUtils::parseEsriTextMarkerSymbolJs const double angle = 90.0 - esriAngle; - std::unique_ptr< QgsFontMarkerSymbolLayer > markerLayer = std::make_unique< QgsFontMarkerSymbolLayer >( fontFamily, chr, pointSize, color, angle ); + auto markerLayer = std::make_unique< QgsFontMarkerSymbolLayer >( fontFamily, chr, pointSize, color, angle ); QColor strokeColor = convertColor( symbolData.value( QStringLiteral( "borderLineColor" ) ) ); markerLayer->setStrokeColor( strokeColor ); @@ -830,7 +830,7 @@ std::unique_ptr QgsArcGisRestUtils::parseEsriTextMarkerSymbolJs layers.append( markerLayer.release() ); - std::unique_ptr< QgsMarkerSymbol > symbol = std::make_unique< QgsMarkerSymbol >( layers ); + auto symbol = std::make_unique< QgsMarkerSymbol >( layers ); return symbol; } @@ -1094,9 +1094,9 @@ QgsFeatureRenderer *QgsArcGisRestUtils::convertRenderer( const QVariantMap &rend gradientStops.append( QgsGradientStop( scaledBreakpoint, fillColor ) ); } - std::unique_ptr< QgsGradientColorRamp > colorRamp = std::make_unique< QgsGradientColorRamp >( - minColor, maxColor, false, gradientStops - ); + auto colorRamp = std::make_unique< QgsGradientColorRamp >( + minColor, maxColor, false, gradientStops + ); QgsProperty colorProperty = QgsProperty::fromField( attrName ); colorProperty.setTransformer( @@ -1107,7 +1107,7 @@ QgsFeatureRenderer *QgsArcGisRestUtils::convertRenderer( const QVariantMap &rend symbol->symbolLayer( layer )->setDataDefinedProperty( QgsSymbolLayer::Property::FillColor, colorProperty ); } - std::unique_ptr< QgsSingleSymbolRenderer > singleSymbolRenderer = std::make_unique< QgsSingleSymbolRenderer >( symbol.release() ); + auto singleSymbolRenderer = std::make_unique< QgsSingleSymbolRenderer >( symbol.release() ); return singleSymbolRenderer.release(); } @@ -1119,7 +1119,7 @@ QgsFeatureRenderer *QgsArcGisRestUtils::convertRenderer( const QVariantMap &rend double lastValue = rendererData.value( QStringLiteral( "minValue" ) ).toDouble(); - std::unique_ptr< QgsGraduatedSymbolRenderer > graduatedRenderer = std::make_unique< QgsGraduatedSymbolRenderer >( attrName ); + auto graduatedRenderer = std::make_unique< QgsGraduatedSymbolRenderer >( attrName ); graduatedRenderer->setSourceSymbol( symbol.release() ); diff --git a/src/core/providers/gdal/qgsgdalprovider.cpp b/src/core/providers/gdal/qgsgdalprovider.cpp index e9a399fbaac9..4eb7e1d25558 100644 --- a/src/core/providers/gdal/qgsgdalprovider.cpp +++ b/src/core/providers/gdal/qgsgdalprovider.cpp @@ -665,7 +665,7 @@ QString QgsGdalProvider::bandDescription( int bandNumber ) QgsRasterBlock *QgsGdalProvider::block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback ) { - std::unique_ptr< QgsRasterBlock > block = std::make_unique< QgsRasterBlock >( dataType( bandNo ), width, height ); + auto block = std::make_unique< QgsRasterBlock >( dataType( bandNo ), width, height ); if ( !initIfNeeded() ) return block.release(); if ( sourceHasNoDataValue( bandNo ) && useSourceNoDataValue( bandNo ) ) @@ -2720,6 +2720,29 @@ QString QgsGdalProviderMetadata::relativeToAbsoluteUri( const QString &uri, cons return context.pathResolver().readPath( src ); } +QString QgsGdalProviderMetadata::cleanUri( const QString &uri, Qgis::UriCleaningFlags flags ) const +{ + QVariantMap components = decodeUri( uri ); + QVariantMap credentialOptions = components.value( QStringLiteral( "credentialOptions" ) ).toMap(); + if ( !credentialOptions.empty() ) + { + if ( flags.testFlag( Qgis::UriCleaningFlag::RedactCredentials ) ) + { + for ( auto it = credentialOptions.begin(); it != credentialOptions.end(); ++it ) + { + it.value() = QStringLiteral( "XXXXXXXX" ); + } + components.insert( QStringLiteral( "credentialOptions" ), credentialOptions ); + } + else if ( flags.testFlag( Qgis::UriCleaningFlag::RemoveCredentials ) ) + { + components.remove( QStringLiteral( "credentialOptions" ) ); + } + } + + return encodeUri( components ); +} + bool QgsGdalProviderMetadata::uriIsBlocklisted( const QString &uri ) const { const QVariantMap parts = decodeUri( uri ); @@ -3404,7 +3427,7 @@ bool QgsGdalProvider::readNativeAttributeTable( QString *errorMessage ) usages.append( usage ); } - std::unique_ptr rat = std::make_unique(); + auto rat = std::make_unique(); for ( const auto &field : std::as_const( ratFields ) ) { @@ -3444,7 +3467,7 @@ bool QgsGdalProvider::readNativeAttributeTable( QString *errorMessage ) // Try to cope with invalid rats due to generic fields if ( ! rat->isValid( ) ) { - std::unique_ptr ratCopy = std::make_unique( *rat ); + auto ratCopy = std::make_unique( *rat ); bool changed { false }; for ( int fieldIdx = 0; fieldIdx < ratCopy->fields().count( ); ++fieldIdx ) { diff --git a/src/core/providers/gdal/qgsgdalprovider.h b/src/core/providers/gdal/qgsgdalprovider.h index 3f21fc288804..0fc0aedfc383 100644 --- a/src/core/providers/gdal/qgsgdalprovider.h +++ b/src/core/providers/gdal/qgsgdalprovider.h @@ -390,6 +390,7 @@ class QgsGdalProviderMetadata final: public QgsProviderMetadata QString encodeUri( const QVariantMap &parts ) const override; QString absoluteToRelativeUri( const QString &uri, const QgsReadWriteContext &context ) const override; QString relativeToAbsoluteUri( const QString &uri, const QgsReadWriteContext &context ) const override; + QString cleanUri( const QString &uri, Qgis::UriCleaningFlags flags = Qgis::UriCleaningFlag::RemoveCredentials ) const override; bool uriIsBlocklisted( const QString &uri ) const override; QgsGdalProvider *createProvider( const QString &uri, const QgsDataProvider::ProviderOptions &options, Qgis::DataProviderReadFlags flags = Qgis::DataProviderReadFlags() ) override; QgsGdalProvider *createRasterDataProvider( diff --git a/src/core/providers/memory/qgsmemoryprovider.cpp b/src/core/providers/memory/qgsmemoryprovider.cpp index 341517f74ea0..d9cff37c84b1 100644 --- a/src/core/providers/memory/qgsmemoryprovider.cpp +++ b/src/core/providers/memory/qgsmemoryprovider.cpp @@ -804,9 +804,14 @@ Qgis::SpatialIndexPresence QgsMemoryProvider::hasSpatialIndex() const Qgis::VectorProviderCapabilities QgsMemoryProvider::capabilities() const { - return Qgis::VectorProviderCapability::AddFeatures | Qgis::VectorProviderCapability::DeleteFeatures | Qgis::VectorProviderCapability::ChangeGeometries | - Qgis::VectorProviderCapability::ChangeAttributeValues | Qgis::VectorProviderCapability::AddAttributes | Qgis::VectorProviderCapability::DeleteAttributes | Qgis::VectorProviderCapability::RenameAttributes | Qgis::VectorProviderCapability::CreateSpatialIndex | - Qgis::VectorProviderCapability::SelectAtId | Qgis::VectorProviderCapability::CircularGeometries | Qgis::VectorProviderCapability::FastTruncate; + Qgis::VectorProviderCapabilities caps { Qgis::VectorProviderCapability::AddFeatures | Qgis::VectorProviderCapability::DeleteFeatures | + Qgis::VectorProviderCapability::ChangeAttributeValues | Qgis::VectorProviderCapability::AddAttributes | Qgis::VectorProviderCapability::DeleteAttributes | Qgis::VectorProviderCapability::RenameAttributes | + Qgis::VectorProviderCapability::SelectAtId | Qgis::VectorProviderCapability::FastTruncate }; + if ( mWkbType != Qgis::WkbType::NoGeometry ) + { + caps |= Qgis::VectorProviderCapability::CreateSpatialIndex | Qgis::VectorProviderCapability::CircularGeometries | Qgis::VectorProviderCapability::ChangeGeometries ; + } + return caps; } bool QgsMemoryProvider::truncate() diff --git a/src/core/providers/meshmemory/qgsmeshmemorydataprovider.cpp b/src/core/providers/meshmemory/qgsmeshmemorydataprovider.cpp index 76b656a13d50..569e41cdeb84 100644 --- a/src/core/providers/meshmemory/qgsmeshmemorydataprovider.cpp +++ b/src/core/providers/meshmemory/qgsmeshmemorydataprovider.cpp @@ -182,7 +182,7 @@ bool QgsMeshMemoryDataProvider::splitDatasetSections( const QString &uri, QgsMes { if ( !success ) break; - std::shared_ptr dataset = std::make_shared(); + auto dataset = std::make_shared(); success = addDatasetValues( sections[i], dataset, datasetGroup.isScalar() ); if ( success ) success = checkDatasetValidity( dataset, datasetGroup.dataType() ); diff --git a/src/core/providers/ogr/qgsgeopackagedataitems.cpp b/src/core/providers/ogr/qgsgeopackagedataitems.cpp index 8069d2a910b3..ae97519d04b0 100644 --- a/src/core/providers/ogr/qgsgeopackagedataitems.cpp +++ b/src/core/providers/ogr/qgsgeopackagedataitems.cpp @@ -186,7 +186,7 @@ QVector QgsGeoPackageCollectionItem::createChildren() if ( !fieldDomains.empty() || !domainError.isEmpty() ) { - std::unique_ptr< QgsFieldDomainsItem > domainsItem = std::make_unique< QgsFieldDomainsItem >( this, mPath + "/domains", path, QStringLiteral( "ogr" ) ); + auto domainsItem = std::make_unique< QgsFieldDomainsItem >( this, mPath + "/domains", path, QStringLiteral( "ogr" ) ); // force this item to appear last by setting a maximum string value for the sort key domainsItem->setSortKey( QString( QChar( 0x10FFFF ) ) ); children.append( domainsItem.release() ); @@ -207,7 +207,7 @@ QVector QgsGeoPackageCollectionItem::createChildren() if ( !relations.empty() || !relationError.isEmpty() ) { - std::unique_ptr< QgsRelationshipsItem > relationsItem = std::make_unique< QgsRelationshipsItem >( this, mPath + "/relations", conn->uri(), QStringLiteral( "ogr" ) ); + auto relationsItem = std::make_unique< QgsRelationshipsItem >( this, mPath + "/relations", conn->uri(), QStringLiteral( "ogr" ) ); // force this item to appear last by setting a maximum string value for the sort key relationsItem->setSortKey( QString( QChar( 0x11FFFF ) ) ); children.append( relationsItem.release() ); diff --git a/src/core/providers/ogr/qgsogrprovider.cpp b/src/core/providers/ogr/qgsogrprovider.cpp index 0c72d6337609..5cbbfe351fed 100644 --- a/src/core/providers/ogr/qgsogrprovider.cpp +++ b/src/core/providers/ogr/qgsogrprovider.cpp @@ -544,6 +544,11 @@ void QgsOgrProvider::setTransaction( QgsTransaction *transaction ) QgsDebugMsgLevel( QStringLiteral( "set transaction %1" ).arg( transaction != nullptr ), 2 ); // static_cast since layers cannot be added to a transaction of a non-matching provider mTransaction = static_cast( transaction ); + if ( transaction ) + { + connect( mTransaction, &QgsTransaction::afterRollback, this, &QgsOgrProvider::afterRollback ); + connect( mTransaction, &QgsTransaction::afterRollbackToSavepoint, this, &QgsOgrProvider::afterRollbackToSavepoint ); + } } QgsAbstractFeatureSource *QgsOgrProvider::featureSource() const @@ -726,6 +731,17 @@ QList QgsOgrProvider::_subLayers( Qgis::SublayerQuer return mSubLayerList; } +void QgsOgrProvider::afterRollbackToSavepoint( const QString &savepointName ) +{ + Q_UNUSED( savepointName ); + mFieldsRequireReload = true; +} + +void QgsOgrProvider::afterRollback() +{ + mFieldsRequireReload = true; +} + void QgsOgrProvider::setEncoding( const QString &e ) { QgsCPLHTTPFetchOverrider oCPLHTTPFetcher( mAuthCfg ); @@ -1073,6 +1089,7 @@ void QgsOgrProvider::loadFields() mAttributeFields.append( newField ); createdFields++; } + mFieldsRequireReload = false; } void QgsOgrProvider::loadMetadata() @@ -1205,7 +1222,7 @@ void QgsOgrProvider::setRelevantFields( bool fetchGeometry, const QgsAttributeLi QRecursiveMutex *mutex = nullptr; OGRLayerH ogrLayer = mOgrLayer->getHandleAndMutex( mutex ); QMutexLocker locker( mutex ); - QgsOgrProviderUtils::setRelevantFields( ogrLayer, mAttributeFields.count(), fetchGeometry, fetchAttributes, mFirstFieldIsFid, QgsOgrProviderUtils::cleanSubsetString( mSubsetString ) ); + QgsOgrProviderUtils::setRelevantFields( ogrLayer, fields().count(), fetchGeometry, fetchAttributes, mFirstFieldIsFid, QgsOgrProviderUtils::cleanSubsetString( mSubsetString ) ); } QgsFeatureIterator QgsOgrProvider::getFeatures( const QgsFeatureRequest &request ) const @@ -1452,7 +1469,7 @@ QVariant QgsOgrProvider::defaultValue( int fieldId ) const QgsCPLHTTPFetchOverrider oCPLHTTPFetcher( mAuthCfg ); QgsSetCPLHTTPFetchOverriderInitiatorClass( oCPLHTTPFetcher, QStringLiteral( "QgsOgrProvider" ) ); - if ( fieldId < 0 || fieldId >= mAttributeFields.count() ) + if ( fieldId < 0 || fieldId >= fields().count() ) return QVariant(); QString defaultVal = mDefaultValues.value( fieldId, QString() ); @@ -1516,7 +1533,7 @@ QVariant QgsOgrProvider::defaultValue( int fieldId ) const } } - const bool compatible = mAttributeFields.at( fieldId ).convertCompatible( resultVar ); + const bool compatible = fields().at( fieldId ).convertCompatible( resultVar ); return compatible && !QgsVariantUtils::isNull( resultVar ) ? resultVar : QVariant(); } @@ -1604,6 +1621,10 @@ long long QgsOgrProvider::featureCount() const QgsFields QgsOgrProvider::fields() const { + if ( mFieldsRequireReload ) + { + const_cast( this )->loadFields(); + } return mAttributeFields; } @@ -1803,6 +1824,8 @@ bool QgsOgrProvider::addFeaturePrivate( QgsFeature &f, Flags flags, QgsFeatureId { bool errorEmitted = false; bool ok = false; + // Get an updated copy + const QgsFields fieldsCopy { f.fields() }; switch ( type ) { case OFTInteger: @@ -1815,7 +1838,7 @@ bool QgsOgrProvider::addFeaturePrivate( QgsFeature &f, Flags flags, QgsFeatureId if ( !ok ) { pushError( tr( "wrong value for attribute %1 of feature %2: %3" ) - .arg( mAttributeFields.at( qgisAttributeId ).name() ) + .arg( fieldsCopy.at( qgisAttributeId ).name() ) .arg( f.id() ) .arg( strVal ) ); errorEmitted = true; @@ -2033,9 +2056,9 @@ bool QgsOgrProvider::addFeaturePrivate( QgsFeature &f, Flags flags, QgsFeatureId if ( !errorEmitted ) { pushError( tr( "wrong data type for attribute %1 of feature %2: Got %3, expected %4" ) - .arg( mAttributeFields.at( qgisAttributeId ).name() ) + .arg( fieldsCopy.at( qgisAttributeId ).name() ) .arg( f.id() ) - .arg( attrVal.typeName(), QVariant::typeToName( mAttributeFields.at( qgisAttributeId ).type() ) ) ); + .arg( attrVal.typeName(), QVariant::typeToName( fieldsCopy.at( qgisAttributeId ).type() ) ) ); } returnValue = false; } @@ -2304,8 +2327,9 @@ bool QgsOgrProvider::addAttributes( const QList &attributes ) } // Backup existing fields. We need them to 'restore' field type, length, precision - QgsFields oldFields = mAttributeFields; + QgsFields oldFields = fields(); + // Updates mAttributeFields loadFields(); // The check in QgsVectorLayerEditBuffer::commitChanges() is questionable with @@ -2413,13 +2437,13 @@ bool QgsOgrProvider::renameAttributes( const QgsFieldNameMap &renamedAttributes for ( ; renameIt != renamedAttributes.constEnd(); ++renameIt ) { int fieldIndex = renameIt.key(); - if ( fieldIndex < 0 || fieldIndex >= mAttributeFields.count() ) + if ( fieldIndex < 0 || fieldIndex >= fields().count() ) { pushError( tr( "Invalid attribute index" ) ); result = false; continue; } - if ( mAttributeFields.indexFromName( renameIt.value() ) >= 0 ) + if ( fields().indexFromName( renameIt.value() ) >= 0 ) { //field name already in use pushError( tr( "Error renaming field %1: name '%2' already exists" ).arg( fieldIndex ).arg( renameIt.value() ) ); @@ -3360,7 +3384,7 @@ bool QgsOgrProvider::createAttributeIndex( int field ) QgsCPLHTTPFetchOverrider oCPLHTTPFetcher( mAuthCfg ); QgsSetCPLHTTPFetchOverriderInitiatorClass( oCPLHTTPFetcher, QStringLiteral( "QgsOgrProvider" ) ); - if ( field < 0 || field >= mAttributeFields.count() ) + if ( field < 0 || field >= fields().count() ) return false; if ( !doInitialActionsForEdition() ) @@ -3751,10 +3775,10 @@ QSet QgsOgrProvider::uniqueValues( int index, int limit ) const { QSet uniqueValues; - if ( !mValid || index < 0 || index >= mAttributeFields.count() ) + if ( !mValid || index < 0 || index >= fields().count() ) return uniqueValues; - const QgsField fld = mAttributeFields.at( index ); + const QgsField fld = fields().at( index ); if ( fld.name().isNull() ) { return uniqueValues; //not a provider field @@ -3816,10 +3840,10 @@ QStringList QgsOgrProvider::uniqueStringsMatching( int index, const QString &sub { QStringList results; - if ( !mValid || index < 0 || index >= mAttributeFields.count() ) + if ( !mValid || index < 0 || index >= fields().count() ) return results; - QgsField fld = mAttributeFields.at( index ); + QgsField fld = fields().at( index ); if ( fld.name().isNull() ) { return results; //not a provider field @@ -4097,7 +4121,7 @@ QList QgsOgrProvider::discoverRelations( const QgsVectorLayer *targ QVariant QgsOgrProvider::minimumValue( int index ) const { - if ( !mValid || index < 0 || index >= mAttributeFields.count() ) + if ( !mValid || index < 0 || index >= fields().count() ) { return QVariant(); } @@ -4105,7 +4129,7 @@ QVariant QgsOgrProvider::minimumValue( int index ) const QgsCPLHTTPFetchOverrider oCPLHTTPFetcher( mAuthCfg ); QgsSetCPLHTTPFetchOverriderInitiatorClass( oCPLHTTPFetcher, QStringLiteral( "QgsOgrProvider" ) ); - const QgsField originalField = mAttributeFields.at( index ); + const QgsField originalField = fields().at( index ); QgsField fld = originalField; // can't use native date/datetime types -- OGR converts these to string in the MAX return value @@ -4157,7 +4181,7 @@ QVariant QgsOgrProvider::minimumValue( int index ) const QVariant QgsOgrProvider::maximumValue( int index ) const { - if ( !mValid || index < 0 || index >= mAttributeFields.count() ) + if ( !mValid || index < 0 || index >= fields().count() ) { return QVariant(); } @@ -4165,7 +4189,7 @@ QVariant QgsOgrProvider::maximumValue( int index ) const QgsCPLHTTPFetchOverrider oCPLHTTPFetcher( mAuthCfg ); QgsSetCPLHTTPFetchOverriderInitiatorClass( oCPLHTTPFetcher, QStringLiteral( "QgsOgrProvider" ) ); - const QgsField originalField = mAttributeFields.at( index ); + const QgsField originalField = fields().at( index ); QgsField fld = originalField; // can't use native date/datetime types -- OGR converts these to string in the MAX return value @@ -4708,7 +4732,10 @@ bool QgsOgrProvider::leaveUpdateMode() // Backup fields since if we created new fields, but didn't populate it // with any feature yet, it will disappear. const QgsFields oldFields = mAttributeFields; + + // This will also update mAttributeFields reloadData(); + if ( mValid ) { // Make sure that new fields we added, but didn't populate yet, are diff --git a/src/core/providers/ogr/qgsogrprovider.h b/src/core/providers/ogr/qgsogrprovider.h index e8d7a45854fe..30fd17baf71e 100644 --- a/src/core/providers/ogr/qgsogrprovider.h +++ b/src/core/providers/ogr/qgsogrprovider.h @@ -222,6 +222,13 @@ class QgsOgrProvider final: public QgsVectorDataProvider mutable std::unique_ptr< OGREnvelope3D > mExtent3D; bool mForceRecomputeExtent = false; + //! Flag set after a rollback to indicate that fields require reloading + bool mFieldsRequireReload = false; + + //! Called after a transaction rollback + void afterRollback(); + void afterRollbackToSavepoint( const QString &savePointName ); + QList mPrimaryKeyAttrs; /** diff --git a/src/core/providers/ogr/qgsogrproviderconnection.cpp b/src/core/providers/ogr/qgsogrproviderconnection.cpp index afea46564676..7cc2ff4b1c1d 100644 --- a/src/core/providers/ogr/qgsogrproviderconnection.cpp +++ b/src/core/providers/ogr/qgsogrproviderconnection.cpp @@ -285,7 +285,7 @@ QgsVectorLayer *QgsOgrProviderConnection::createSqlVectorLayer( const QgsAbstrac QgsProviderMetadata *providerMetadata { QgsProviderRegistry::instance()->providerMetadata( QStringLiteral( "ogr" ) ) }; Q_ASSERT( providerMetadata ); QMap decoded = providerMetadata->decodeUri( uri() ); - decoded[ QStringLiteral( "subset" ) ] = options.sql; + decoded[ QStringLiteral( "subset" ) ] = sanitizeSqlForQueryLayer( options.sql ) ; return new QgsVectorLayer( providerMetadata->encodeUri( decoded ), options.layerName.isEmpty() ? QStringLiteral( "QueryLayer" ) : options.layerName, providerKey() ); } diff --git a/src/core/providers/ogr/qgsogrproviderutils.cpp b/src/core/providers/ogr/qgsogrproviderutils.cpp index 9c1b80eb3457..f3bde6308934 100644 --- a/src/core/providers/ogr/qgsogrproviderutils.cpp +++ b/src/core/providers/ogr/qgsogrproviderutils.cpp @@ -344,8 +344,13 @@ QString createFilters( const QString &type ) } else if ( driverName.startsWith( QLatin1String( "GPKG" ) ) ) { +#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(3,7,0) + sFileFilters += createFileFilter_( QObject::tr( "GeoPackage" ), QStringLiteral( "*.gpkg *.gpkg.zip" ) ); + sExtensions << QStringLiteral( "gpkg" ) << QStringLiteral( "gpkg.zip" ); +#else sFileFilters += createFileFilter_( QObject::tr( "GeoPackage" ), QStringLiteral( "*.gpkg" ) ); sExtensions << QStringLiteral( "gpkg" ); +#endif } else if ( driverName.startsWith( QLatin1String( "GRASS" ) ) ) { @@ -917,6 +922,11 @@ bool QgsOgrProviderUtils::createEmptyDataSource( const QString &uri, { field = OGR_Fld_Create( codec->fromUnicode( it->first ).constData(), OFTDateTime ); } + else if ( fields[0] == QLatin1String( "bool" ) ) + { + field = OGR_Fld_Create( codec->fromUnicode( it->first ).constData(), OFTInteger ); + OGR_Fld_SetSubType( field, OFSTBoolean ); + } else { QgsMessageLog::logMessage( QObject::tr( "field %1 with unsupported type %2 skipped" ).arg( it->first, fields[0] ), QObject::tr( "OGR" ) ); @@ -2653,7 +2663,7 @@ QList< QgsProviderSublayerDetails > QgsOgrProviderUtils::querySubLayerList( int QgsDebugMsgLevel( QStringLiteral( "Unknown geometry type, count features for each geometry type" ), 2 ); // Add virtual sublayers for supported geometry types if layer type is unknown // Count features for geometry types - QMap fCount; + QMap fCount; QSet fHasZ; // TODO: avoid reading attributes, setRelevantFields cannot be called here because it is not constant @@ -2697,7 +2707,7 @@ QList< QgsProviderSublayerDetails > QgsOgrProviderUtils::querySubLayerList( int if ( gType == wkbTINZ ) gType = wkbMultiPolygon25D; bool hasZ = wkbHasZ( gType ); - gType = QgsOgrProviderUtils::ogrWkbSingleFlatten( gType ); + gType = wkbFlatten( gType ); fCount[gType] = fCount.value( gType ) + pasCounter[i].nCount; if ( hasZ ) fHasZ.insert( gType ); @@ -2718,7 +2728,7 @@ QList< QgsProviderSublayerDetails > QgsOgrProviderUtils::querySubLayerList( int if ( gType != wkbNone ) { bool hasZ = wkbHasZ( gType ); - gType = QgsOgrProviderUtils::ogrWkbSingleFlatten( gType ); + gType = wkbFlatten( gType ); fCount[gType] = fCount.value( gType ) + 1; if ( hasZ ) fHasZ.insert( gType ); @@ -2744,40 +2754,120 @@ QList< QgsProviderSublayerDetails > QgsOgrProviderUtils::querySubLayerList( int } } - // List TIN and PolyhedralSurface as Polygon - if ( fCount.contains( wkbTIN ) ) + QMap baseTypeCount; + baseTypeCount[Qgis::GeometryType::Point] = 0; + baseTypeCount[Qgis::GeometryType::Line] = 0; + baseTypeCount[Qgis::GeometryType::Polygon] = 0; + + OGRwkbGeometryType polyBaseType { wkbPolygon }; + OGRwkbGeometryType lineBaseType { wkbLineString }; + OGRwkbGeometryType pointBaseType { wkbPoint }; + + // Last type in the list is the winner + const static QList pointHierarchy { wkbPoint, wkbMultiPoint }; + const static QList lineHierarchy { wkbLineString, wkbCircularString, wkbMultiLineString, wkbCompoundCurve, wkbMultiCurve }; + const static QList polyHierarchy { wkbPolyhedralSurface, wkbTIN, wkbPolygon, wkbCurvePolygon, wkbMultiPolygon, wkbMultiSurface }; + + for ( const auto t : std::as_const( pointHierarchy ) ) { - fCount[wkbPolygon] = fCount.value( wkbPolygon ) + fCount[wkbTIN]; - fCount.remove( wkbTIN ); + if ( fCount.contains( t ) ) + { + baseTypeCount[Qgis::GeometryType::Point] += fCount.value( t ); + pointBaseType = t; + fCount.remove( t ); + } } - if ( fCount.contains( wkbPolyhedralSurface ) ) + + // For lines use a three-step approach + // 1. First collapse linestring and circularstring into compoundcurve + if ( fCount.contains( wkbLineString ) && fCount.contains( wkbCircularString ) ) { - fCount[wkbPolygon] = fCount.value( wkbPolygon ) + fCount[wkbPolyhedralSurface]; - fCount.remove( wkbPolyhedralSurface ); + baseTypeCount[Qgis::GeometryType::Line] += fCount.value( wkbLineString ); + baseTypeCount[Qgis::GeometryType::Line] += fCount.value( wkbCircularString ); + lineBaseType = wkbCompoundCurve; + if ( ! fCount.contains( wkbCompoundCurve ) ) + { + fCount[wkbCompoundCurve] = baseTypeCount[Qgis::GeometryType::Line]; + baseTypeCount[Qgis::GeometryType::Line] = 0; + } + fCount.remove( wkbLineString ); + fCount.remove( wkbCircularString ); } - // When there are CurvePolygons, promote Polygons - if ( fCount.contains( wkbPolygon ) && fCount.contains( wkbCurvePolygon ) ) + + // 2. Then collapse multilinestring and compoundcurve into multicurve + if ( fCount.contains( wkbMultiLineString ) && fCount.contains( wkbCompoundCurve ) ) { - fCount[wkbCurvePolygon] += fCount.value( wkbPolygon ); - fCount.remove( wkbPolygon ); + baseTypeCount[Qgis::GeometryType::Line] += fCount.value( wkbMultiLineString ); + baseTypeCount[Qgis::GeometryType::Line] += fCount.value( wkbCompoundCurve ); + lineBaseType = wkbMultiCurve; + if ( ! fCount.contains( wkbMultiCurve ) ) + { + fCount[wkbMultiCurve] = baseTypeCount[Qgis::GeometryType::Line]; + baseTypeCount[Qgis::GeometryType::Line] = 0; + } + fCount.remove( wkbMultiLineString ); + fCount.remove( wkbCompoundCurve ); } - // When there are CompoundCurves, promote LineStrings and CircularStrings - if ( fCount.contains( wkbLineString ) && fCount.contains( wkbCompoundCurve ) ) + + // 3. Then follow the hierarchy + for ( const auto t : std::as_const( lineHierarchy ) ) { - fCount[wkbCompoundCurve] += fCount.value( wkbLineString ); - fCount.remove( wkbLineString ); + if ( fCount.contains( t ) ) + { + baseTypeCount[Qgis::GeometryType::Line] += fCount.value( t ); + lineBaseType = t; + fCount.remove( t ); + } } - if ( fCount.contains( wkbCircularString ) && fCount.contains( wkbCompoundCurve ) ) + + + // For polygons use a two-step approach: + // 1. First collapse multipolygon and curvepolygon into multisurface + if ( fCount.contains( wkbMultiPolygon ) && fCount.contains( wkbCurvePolygon ) ) { - fCount[wkbCompoundCurve] += fCount.value( wkbCircularString ); - fCount.remove( wkbCircularString ); + baseTypeCount[Qgis::GeometryType::Polygon] += fCount.value( wkbMultiPolygon ); + baseTypeCount[Qgis::GeometryType::Polygon] += fCount.value( wkbMultiSurface ); + polyBaseType = wkbMultiSurface; + if ( ! fCount.contains( wkbMultiSurface ) ) + { + fCount[wkbMultiSurface] = baseTypeCount[Qgis::GeometryType::Polygon]; + baseTypeCount[Qgis::GeometryType::Polygon] = 0; + } + fCount.remove( wkbMultiPolygon ); + fCount.remove( wkbCurvePolygon ); + } + + // 2. Then collapse following the hierarchy + for ( const auto t : std::as_const( polyHierarchy ) ) + { + if ( fCount.contains( t ) ) + { + baseTypeCount[Qgis::GeometryType::Polygon] += fCount.value( t ); + polyBaseType = t; + fCount.remove( t ); + } + } + + if ( baseTypeCount[Qgis::GeometryType::Point] > 0 ) + { + fCount[pointBaseType] = baseTypeCount[Qgis::GeometryType::Point]; + } + + if ( baseTypeCount[Qgis::GeometryType::Line] > 0 ) + { + fCount[lineBaseType] = baseTypeCount[Qgis::GeometryType::Line]; + } + + if ( baseTypeCount[Qgis::GeometryType::Polygon] > 0 ) + { + fCount[polyBaseType] = baseTypeCount[Qgis::GeometryType::Polygon]; } QList< QgsProviderSublayerDetails > res; res.reserve( fCount.size() ); bool bIs25D = wkbHasZ( layerGeomType ); - QMap::const_iterator countIt = fCount.constBegin(); + QMap::const_iterator countIt = fCount.constBegin(); for ( ; countIt != fCount.constEnd(); ++countIt ) { if ( feedback && feedback->isCanceled() ) diff --git a/src/core/providers/qgsabstractdatabaseproviderconnection.cpp b/src/core/providers/qgsabstractdatabaseproviderconnection.cpp index 5882377f20d7..8207a9132364 100644 --- a/src/core/providers/qgsabstractdatabaseproviderconnection.cpp +++ b/src/core/providers/qgsabstractdatabaseproviderconnection.cpp @@ -84,6 +84,16 @@ void QgsAbstractDatabaseProviderConnection::checkCapability( Qgis::DatabaseProvi } } +QString QgsAbstractDatabaseProviderConnection::sanitizeSqlForQueryLayer( const QString &sql ) const +{ + QString sanitizedSql { sql.trimmed() }; + while ( sanitizedSql.endsWith( ';' ) ) + { + sanitizedSql.chop( 1 ); + } + return sanitizedSql; +} + ///@endcond QString QgsAbstractDatabaseProviderConnection::providerKey() const @@ -1220,7 +1230,7 @@ void QgsAbstractDatabaseProviderConnection::addField( const QgsField &field, con QgsVectorLayer::LayerOptions options { false, false }; options.skipCrsValidation = true; - std::unique_ptr vl( std::make_unique( tableUri( schema, tableName ), QStringLiteral( "temp_layer" ), mProviderKey, options ) ); + auto vl = std::make_unique( tableUri( schema, tableName ), QStringLiteral( "temp_layer" ), mProviderKey, options ) ; if ( ! vl->isValid() ) { throw QgsProviderConnectionException( QObject::tr( "Could not create a vector layer for table '%1' in schema '%2'" ) @@ -1245,7 +1255,7 @@ void QgsAbstractDatabaseProviderConnection::renameField( const QString &schema, QgsVectorLayer::LayerOptions options { false, false }; options.skipCrsValidation = true; - std::unique_ptr vl( std::make_unique( tableUri( schema, tableName ), QStringLiteral( "temp_layer" ), mProviderKey, options ) ); + auto vl = std::make_unique( tableUri( schema, tableName ), QStringLiteral( "temp_layer" ), mProviderKey, options ) ; if ( ! vl->isValid() ) { throw QgsProviderConnectionException( QObject::tr( "Could not create a vector layer for table '%1' in schema '%2'" ) diff --git a/src/core/providers/qgsabstractdatabaseproviderconnection.h b/src/core/providers/qgsabstractdatabaseproviderconnection.h index c78bae5054e5..cab8c7c5ff15 100644 --- a/src/core/providers/qgsabstractdatabaseproviderconnection.h +++ b/src/core/providers/qgsabstractdatabaseproviderconnection.h @@ -1143,6 +1143,10 @@ class CORE_EXPORT QgsAbstractDatabaseProviderConnection : public QgsAbstractProv * \throws QgsProviderConnectionException if the capability is not supported */ void checkCapability( Qgis::DatabaseProviderConnectionCapability2 capability ) const; + + //! Trim and remove any trailing semicolon + QString sanitizeSqlForQueryLayer( const QString &sql ) const SIP_SKIP; + ///@endcond Capabilities mCapabilities = Capabilities() SIP_SKIP; diff --git a/src/core/providers/qgsprovidermetadata.cpp b/src/core/providers/qgsprovidermetadata.cpp index 8e71af778198..4c58f8dfe20c 100644 --- a/src/core/providers/qgsprovidermetadata.cpp +++ b/src/core/providers/qgsprovidermetadata.cpp @@ -198,6 +198,15 @@ QString QgsProviderMetadata::relativeToAbsoluteUri( const QString &uri, const Qg return context.pathResolver().readPath( uri ); } +QString QgsProviderMetadata::cleanUri( const QString &uri, Qgis::UriCleaningFlags flags ) const +{ + if ( flags.testFlag( Qgis::UriCleaningFlag::RemoveCredentials ) ) + return QgsDataSourceUri::removePassword( uri ); + else if ( flags.testFlag( Qgis::UriCleaningFlag::RedactCredentials ) ) + return QgsDataSourceUri::removePassword( uri, true ); + return uri; +} + Qgis::VectorExportResult QgsProviderMetadata::createEmptyLayer( const QString &, const QgsFields &, Qgis::WkbType, const QgsCoordinateReferenceSystem &, bool, QMap &, diff --git a/src/core/providers/qgsprovidermetadata.h b/src/core/providers/qgsprovidermetadata.h index ea8d3b82e3f1..e149a3eaf03f 100644 --- a/src/core/providers/qgsprovidermetadata.h +++ b/src/core/providers/qgsprovidermetadata.h @@ -612,6 +612,13 @@ class CORE_EXPORT QgsProviderMetadata : public QObject */ virtual QString relativeToAbsoluteUri( const QString &uri, const QgsReadWriteContext &context ) const; + /** + * Cleans a layer \a uri, e.g. to remove or hide sensitive information from the URI. + * + * \since QGIS 3.42 + */ + virtual QString cleanUri( const QString &uri, Qgis::UriCleaningFlags flags = Qgis::UriCleaningFlag::RemoveCredentials ) const; + /** * Returns data item providers. Caller is responsible for ownership of the item providers * \see QgsProviderGuiMetadata::dataItemGuiProviders() diff --git a/src/core/providers/qgsproviderregistry.cpp b/src/core/providers/qgsproviderregistry.cpp index 2f026da2d62d..d5b9412aa1b0 100644 --- a/src/core/providers/qgsproviderregistry.cpp +++ b/src/core/providers/qgsproviderregistry.cpp @@ -913,7 +913,7 @@ QLibrary *QgsProviderRegistry::createProviderLibrary( QString const &providerKey if ( lib.isEmpty() ) return nullptr; - std::unique_ptr< QLibrary > myLib( new QLibrary( lib ) ); + auto myLib = std::make_unique( lib ); QgsDebugMsgLevel( "Library name is " + myLib->fileName(), 2 ); diff --git a/src/core/providers/qgsprovidersublayerdetails.cpp b/src/core/providers/qgsprovidersublayerdetails.cpp index 02c621ddc54c..fabab7a1aca8 100644 --- a/src/core/providers/qgsprovidersublayerdetails.cpp +++ b/src/core/providers/qgsprovidersublayerdetails.cpp @@ -30,35 +30,20 @@ QgsMapLayer *QgsProviderSublayerDetails::toLayer( const LayerOptions &options ) QgsMimeDataUtils::Uri QgsProviderSublayerDetails::toMimeUri() const { QgsMimeDataUtils::Uri u; + u.layerType = QgsMapLayerFactory::typeToString( mType ); switch ( mType ) { case Qgis::LayerType::Vector: - u.layerType = QStringLiteral( "vector" ); u.wkbType = mWkbType; break; case Qgis::LayerType::Raster: - u.layerType = QStringLiteral( "raster" ); - break; case Qgis::LayerType::Mesh: - u.layerType = QStringLiteral( "mesh" ); - break; case Qgis::LayerType::VectorTile: - u.layerType = QStringLiteral( "vector-tile" ); - break; case Qgis::LayerType::PointCloud: - u.layerType = QStringLiteral( "pointcloud" ); - break; case Qgis::LayerType::Plugin: - u.layerType = QStringLiteral( "plugin" ); - break; case Qgis::LayerType::Group: - u.layerType = QStringLiteral( "group" ); - break; case Qgis::LayerType::Annotation: - u.layerType = QStringLiteral( "annotation" ); - break; case Qgis::LayerType::TiledScene: - u.layerType = QStringLiteral( "tiled-scene" ); break; } diff --git a/src/core/providers/qgsprovidersublayermodel.cpp b/src/core/providers/qgsprovidersublayermodel.cpp index d0f52921faf3..e4d8f21ec906 100644 --- a/src/core/providers/qgsprovidersublayermodel.cpp +++ b/src/core/providers/qgsprovidersublayermodel.cpp @@ -46,7 +46,7 @@ void QgsProviderSublayerModelGroup::populateFromSublayers( const QListfindGroup( currentPath.constLast() ); if ( !nextChild ) { - std::unique_ptr< QgsProviderSublayerModelGroup > newNode = std::make_unique< QgsProviderSublayerModelGroup >( currentPath.constLast() ); + auto newNode = std::make_unique< QgsProviderSublayerModelGroup >( currentPath.constLast() ); groupNode = qgis::down_cast< QgsProviderSublayerModelGroup * >( groupNode->addChild( std::move( newNode ) ) ); } else diff --git a/src/core/providers/sensorthings/qgssensorthingsdataitems.cpp b/src/core/providers/sensorthings/qgssensorthingsdataitems.cpp index 7217a9d1c90a..108870fdefd1 100644 --- a/src/core/providers/sensorthings/qgssensorthingsdataitems.cpp +++ b/src/core/providers/sensorthings/qgssensorthingsdataitems.cpp @@ -155,10 +155,10 @@ QVector QgsSensorThingsEntityContainerItem::createChildren() compatibleTypes << Qgis::WkbType::MultiPolygon << Qgis::WkbType::NoGeometry; break; case Qgis::GeometryType::Unknown: - compatibleTypes << Qgis::WkbType::Point << Qgis::WkbType::MultiPoint << Qgis::WkbType::MultiLineString << Qgis::WkbType::MultiPolygon; + compatibleTypes << Qgis::WkbType::Point << Qgis::WkbType::MultiPoint << Qgis::WkbType::MultiLineString << Qgis::WkbType::MultiPolygon << Qgis::WkbType::NoGeometry; break; case Qgis::GeometryType::Null: - compatibleTypes << Qgis::WkbType::NoGeometry;; + compatibleTypes << Qgis::WkbType::NoGeometry; } for ( const Qgis::WkbType wkbType : std::as_const( compatibleTypes ) ) diff --git a/src/core/providers/sensorthings/qgssensorthingsshareddata.cpp b/src/core/providers/sensorthings/qgssensorthingsshareddata.cpp index fce865056aaa..b9a1a7491d6f 100644 --- a/src/core/providers/sensorthings/qgssensorthingsshareddata.cpp +++ b/src/core/providers/sensorthings/qgssensorthingsshareddata.cpp @@ -96,8 +96,7 @@ QgsSensorThingsSharedData::QgsSensorThingsSharedData( const QString &uri ) mGeometryType = Qgis::WkbType::NoGeometry; } - QgsDataSourceUri dsUri; - dsUri.setEncodedUri( uri ); + const QgsDataSourceUri dsUri( uri ); mAuthCfg = dsUri.authConfigId(); mHeaders = dsUri.httpHeaders(); diff --git a/src/core/providers/sensorthings/qgssensorthingsutils.cpp b/src/core/providers/sensorthings/qgssensorthingsutils.cpp index fa92c1a2041d..bee70ef86956 100644 --- a/src/core/providers/sensorthings/qgssensorthingsutils.cpp +++ b/src/core/providers/sensorthings/qgssensorthingsutils.cpp @@ -478,7 +478,7 @@ QStringList QgsSensorThingsUtils::propertiesForEntityType( Qgis::SensorThingsEnt return {}; } -QgsFields QgsSensorThingsUtils::fieldsForEntityType( Qgis::SensorThingsEntity type ) +QgsFields QgsSensorThingsUtils::fieldsForEntityType( Qgis::SensorThingsEntity type, bool includeRangeFieldProxies ) { QgsFields fields; @@ -517,10 +517,13 @@ QgsFields QgsSensorThingsUtils::fieldsForEntityType( Qgis::SensorThingsEntity ty fields.append( QgsField( QStringLiteral( "unitOfMeasurement" ), QMetaType::Type::QVariantMap, QStringLiteral( "json" ), 0, 0, QString(), QMetaType::Type::QString ) ); fields.append( QgsField( QStringLiteral( "observationType" ), QMetaType::Type::QString ) ); fields.append( QgsField( QStringLiteral( "properties" ), QMetaType::Type::QVariantMap, QStringLiteral( "json" ), 0, 0, QString(), QMetaType::Type::QString ) ); - fields.append( QgsField( QStringLiteral( "phenomenonTimeStart" ), QMetaType::Type::QDateTime ) ); - fields.append( QgsField( QStringLiteral( "phenomenonTimeEnd" ), QMetaType::Type::QDateTime ) ); - fields.append( QgsField( QStringLiteral( "resultTimeStart" ), QMetaType::Type::QDateTime ) ); - fields.append( QgsField( QStringLiteral( "resultTimeEnd" ), QMetaType::Type::QDateTime ) ); + if ( includeRangeFieldProxies ) + { + fields.append( QgsField( QStringLiteral( "phenomenonTimeStart" ), QMetaType::Type::QDateTime ) ); + fields.append( QgsField( QStringLiteral( "phenomenonTimeEnd" ), QMetaType::Type::QDateTime ) ); + fields.append( QgsField( QStringLiteral( "resultTimeStart" ), QMetaType::Type::QDateTime ) ); + fields.append( QgsField( QStringLiteral( "resultTimeEnd" ), QMetaType::Type::QDateTime ) ); + } break; case Qgis::SensorThingsEntity::Sensor: @@ -541,16 +544,22 @@ QgsFields QgsSensorThingsUtils::fieldsForEntityType( Qgis::SensorThingsEntity ty case Qgis::SensorThingsEntity::Observation: // https://docs.ogc.org/is/18-088/18-088.html#observation - fields.append( QgsField( QStringLiteral( "phenomenonTimeStart" ), QMetaType::Type::QDateTime ) ); - fields.append( QgsField( QStringLiteral( "phenomenonTimeEnd" ), QMetaType::Type::QDateTime ) ); + if ( includeRangeFieldProxies ) + { + fields.append( QgsField( QStringLiteral( "phenomenonTimeStart" ), QMetaType::Type::QDateTime ) ); + fields.append( QgsField( QStringLiteral( "phenomenonTimeEnd" ), QMetaType::Type::QDateTime ) ); + } // TODO -- handle type correctly fields.append( QgsField( QStringLiteral( "result" ), QMetaType::Type::QString ) ); fields.append( QgsField( QStringLiteral( "resultTime" ), QMetaType::Type::QDateTime ) ); fields.append( QgsField( QStringLiteral( "resultQuality" ), QMetaType::Type::QStringList, QString(), 0, 0, QString(), QMetaType::Type::QString ) ); - fields.append( QgsField( QStringLiteral( "validTimeStart" ), QMetaType::Type::QDateTime ) ); - fields.append( QgsField( QStringLiteral( "validTimeEnd" ), QMetaType::Type::QDateTime ) ); + if ( includeRangeFieldProxies ) + { + fields.append( QgsField( QStringLiteral( "validTimeStart" ), QMetaType::Type::QDateTime ) ); + fields.append( QgsField( QStringLiteral( "validTimeEnd" ), QMetaType::Type::QDateTime ) ); + } fields.append( QgsField( QStringLiteral( "parameters" ), QMetaType::Type::QVariantMap, QStringLiteral( "json" ), 0, 0, QString(), QMetaType::Type::QString ) ); break; @@ -569,10 +578,13 @@ QgsFields QgsSensorThingsUtils::fieldsForEntityType( Qgis::SensorThingsEntity ty fields.append( QgsField( QStringLiteral( "observationType" ), QMetaType::Type::QString ) ); fields.append( QgsField( QStringLiteral( "multiObservationDataTypes" ), QMetaType::Type::QStringList, QString(), 0, 0, QString(), QMetaType::Type::QString ) ); fields.append( QgsField( QStringLiteral( "properties" ), QMetaType::Type::QVariantMap, QStringLiteral( "json" ), 0, 0, QString(), QMetaType::Type::QString ) ); - fields.append( QgsField( QStringLiteral( "phenomenonTimeStart" ), QMetaType::Type::QDateTime ) ); - fields.append( QgsField( QStringLiteral( "phenomenonTimeEnd" ), QMetaType::Type::QDateTime ) ); - fields.append( QgsField( QStringLiteral( "resultTimeStart" ), QMetaType::Type::QDateTime ) ); - fields.append( QgsField( QStringLiteral( "resultTimeEnd" ), QMetaType::Type::QDateTime ) ); + if ( includeRangeFieldProxies ) + { + fields.append( QgsField( QStringLiteral( "phenomenonTimeStart" ), QMetaType::Type::QDateTime ) ); + fields.append( QgsField( QStringLiteral( "phenomenonTimeEnd" ), QMetaType::Type::QDateTime ) ); + fields.append( QgsField( QStringLiteral( "resultTimeStart" ), QMetaType::Type::QDateTime ) ); + fields.append( QgsField( QStringLiteral( "resultTimeEnd" ), QMetaType::Type::QDateTime ) ); + } break; } @@ -607,7 +619,6 @@ QString QgsSensorThingsUtils::geometryFieldForEntityType( Qgis::SensorThingsEnti case Qgis::SensorThingsEntity::Invalid: case Qgis::SensorThingsEntity::Thing: case Qgis::SensorThingsEntity::HistoricalLocation: - case Qgis::SensorThingsEntity::Datastream: case Qgis::SensorThingsEntity::Sensor: case Qgis::SensorThingsEntity::Observation: case Qgis::SensorThingsEntity::ObservedProperty: @@ -619,6 +630,7 @@ QString QgsSensorThingsUtils::geometryFieldForEntityType( Qgis::SensorThingsEnti case Qgis::SensorThingsEntity::FeatureOfInterest: return QStringLiteral( "feature" ); + case Qgis::SensorThingsEntity::Datastream: case Qgis::SensorThingsEntity::MultiDatastream: return QStringLiteral( "observedArea" ); } @@ -632,12 +644,12 @@ bool QgsSensorThingsUtils::entityTypeHasGeometry( Qgis::SensorThingsEntity type case Qgis::SensorThingsEntity::Invalid: case Qgis::SensorThingsEntity::Thing: case Qgis::SensorThingsEntity::HistoricalLocation: - case Qgis::SensorThingsEntity::Datastream: case Qgis::SensorThingsEntity::Sensor: case Qgis::SensorThingsEntity::Observation: case Qgis::SensorThingsEntity::ObservedProperty: return false; + case Qgis::SensorThingsEntity::Datastream: case Qgis::SensorThingsEntity::Location: case Qgis::SensorThingsEntity::FeatureOfInterest: case Qgis::SensorThingsEntity::MultiDatastream: @@ -653,18 +665,16 @@ Qgis::GeometryType QgsSensorThingsUtils::geometryTypeForEntity( Qgis::SensorThin case Qgis::SensorThingsEntity::Invalid: case Qgis::SensorThingsEntity::Thing: case Qgis::SensorThingsEntity::HistoricalLocation: - case Qgis::SensorThingsEntity::Datastream: case Qgis::SensorThingsEntity::Sensor: case Qgis::SensorThingsEntity::Observation: case Qgis::SensorThingsEntity::ObservedProperty: return Qgis::GeometryType::Null; + case Qgis::SensorThingsEntity::Datastream: case Qgis::SensorThingsEntity::Location: case Qgis::SensorThingsEntity::FeatureOfInterest: - return Qgis::GeometryType::Unknown; - case Qgis::SensorThingsEntity::MultiDatastream: - return Qgis::GeometryType::Polygon; + return Qgis::GeometryType::Unknown; } BUILTIN_UNREACHABLE } @@ -863,7 +873,8 @@ QList QgsSensorThingsUtils::expandableTargets( Qgis::S return { Qgis::SensorThingsEntity::HistoricalLocation, - Qgis::SensorThingsEntity::Datastream + Qgis::SensorThingsEntity::Datastream, + Qgis::SensorThingsEntity::MultiDatastream, }; case Qgis::SensorThingsEntity::Location: @@ -891,19 +902,22 @@ QList QgsSensorThingsUtils::expandableTargets( Qgis::S case Qgis::SensorThingsEntity::Sensor: return { - Qgis::SensorThingsEntity::Datastream + Qgis::SensorThingsEntity::Datastream, + Qgis::SensorThingsEntity::MultiDatastream, }; case Qgis::SensorThingsEntity::ObservedProperty: return { - Qgis::SensorThingsEntity::Datastream + Qgis::SensorThingsEntity::Datastream, + Qgis::SensorThingsEntity::MultiDatastream }; case Qgis::SensorThingsEntity::Observation: return { - Qgis::SensorThingsEntity::Datastream + Qgis::SensorThingsEntity::Datastream, + Qgis::SensorThingsEntity::MultiDatastream }; case Qgis::SensorThingsEntity::FeatureOfInterest: diff --git a/src/core/providers/sensorthings/qgssensorthingsutils.h b/src/core/providers/sensorthings/qgssensorthingsutils.h index 00bcb60bda8b..3dccad464e7e 100644 --- a/src/core/providers/sensorthings/qgssensorthingsutils.h +++ b/src/core/providers/sensorthings/qgssensorthingsutils.h @@ -81,8 +81,11 @@ class CORE_EXPORT QgsSensorThingsUtils /** * Returns the fields which correspond to a specified entity \a type. + * + * Since QGIS 3.42 the \a includeRangeFieldProxies argument can be used to hide the "start"/"end" fields + * which are proxies for the date time range field types which are not natively supported in QGIS. */ - static QgsFields fieldsForEntityType( Qgis::SensorThingsEntity type ); + static QgsFields fieldsForEntityType( Qgis::SensorThingsEntity type, bool includeRangeFieldProxies = true ); /** * Returns the fields which correspond to a specified entity \a baseType, expanded diff --git a/src/core/providers/vpc/qgsvirtualpointcloudprovider.cpp b/src/core/providers/vpc/qgsvirtualpointcloudprovider.cpp index 5d9d2cc19c9f..862ce3bcac11 100644 --- a/src/core/providers/vpc/qgsvirtualpointcloudprovider.cpp +++ b/src/core/providers/vpc/qgsvirtualpointcloudprovider.cpp @@ -359,7 +359,7 @@ void QgsVirtualPointCloudProvider::parseFile() if ( uri.startsWith( QLatin1String( "./" ) ) ) { // resolve relative path - uri = fInfo.absoluteDir().absoluteFilePath( uri ); + uri = QDir::cleanPath( fInfo.absoluteDir().absoluteFilePath( uri ) ); } if ( f["properties"].contains( "pc:schemas" ) ) @@ -418,7 +418,9 @@ void QgsVirtualPointCloudProvider::loadSubIndex( int i ) else if ( sl.uri().endsWith( QStringLiteral( "ept.json" ), Qt::CaseSensitivity::CaseInsensitive ) ) sl.setIndex( QgsPointCloudIndex( new QgsEptPointCloudIndex() ) ); - if ( !sl.index() ) + // check if the index is created and also check if the file actually exists too + const QFile file( sl.uri() ); + if ( !sl.index() || !file.exists() ) return; sl.index().load( sl.uri() ); diff --git a/src/core/qgis.h b/src/core/qgis.h index c7c19ce9436b..701dfaa6d32f 100644 --- a/src/core/qgis.h +++ b/src/core/qgis.h @@ -1293,6 +1293,26 @@ class CORE_EXPORT Qgis }; Q_ENUM( FileFilterType ) + /** + * Flags for cleaning layer URIs. + * + * \since QGIS 3.42 + */ + enum class UriCleaningFlag : int SIP_ENUM_BASETYPE( IntFlag ) + { + RemoveCredentials = 1 << 0, //!< Completely remove credentials (eg passwords) from the URI. This flag is not compatible with the RedactCredentials flag. + RedactCredentials = 1 << 1, //!< Replace the value of credentials (eg passwords) with 'xxxxxxxx'. This flag is not compatible with the RemoveCredentials flag. + }; + Q_ENUM( UriCleaningFlag ) + + /** + * Flags for cleaning layer URIs. + * + * \since QGIS 3.42 + */ + Q_DECLARE_FLAGS( UriCleaningFlags, UriCleaningFlag ) + Q_FLAG( UriCleaningFlags ) + /** * Flags which control how data providers will scan for sublayers in a dataset. * @@ -5894,6 +5914,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::SelectionFlags ) Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::SettingsTreeNodeOptions ) Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::SnappingTypes ) Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::SqlLayerDefinitionCapabilities ) +Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::UriCleaningFlags ) Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::SublayerFlags ) Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::SublayerQueryFlags ) Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::FeatureRendererFlags ) diff --git a/src/core/qgsabstractcontentcache.cpp b/src/core/qgsabstractcontentcache.cpp index 3f3ecad6bf77..3be9976957e9 100644 --- a/src/core/qgsabstractcontentcache.cpp +++ b/src/core/qgsabstractcontentcache.cpp @@ -71,6 +71,22 @@ bool QgsAbstractContentCacheBase::parseBase64DataUrl( const QString &path, QStri return true; } +bool QgsAbstractContentCacheBase::parseEmbeddedStringData( const QString &path, QString *mimeType, QString *data ) +{ + const thread_local QRegularExpression sRx( QStringLiteral( "^data:([a-zA-Z0-9+\\-]*\\/[a-zA-Z0-9+\\-]*?)\\;utf8,(.*)$" ), QRegularExpression::DotMatchesEverythingOption ); + const QRegularExpressionMatch stringMatch = sRx.match( path ); + + if ( !stringMatch.hasMatch() ) + return false; + + if ( mimeType ) + *mimeType = stringMatch.captured( 1 ); + if ( data ) + *data = stringMatch.captured( 2 ); + + return true; +} + bool QgsAbstractContentCacheBase::isBase64Data( const QString &path ) { return path.startsWith( QLatin1String( "base64:" ) ) diff --git a/src/core/qgsabstractcontentcache.h b/src/core/qgsabstractcontentcache.h index 76a0f8ee8559..0a728ce6dfae 100644 --- a/src/core/qgsabstractcontentcache.h +++ b/src/core/qgsabstractcontentcache.h @@ -156,6 +156,23 @@ class CORE_EXPORT QgsAbstractContentCacheBase: public QObject */ static bool parseBase64DataUrl( const QString &path, QString *mimeType SIP_OUT = nullptr, QString *data SIP_OUT = nullptr ); + + /** + * Parses a \a path to determine if it represents a embedded string data, and if so, extracts the components + * of the URL. + * + * Data URLs are of the form ``data:[;]utf8,``. + * + * \param path path to test + * \param mimeType will be set to the extracted mime type if the \a path is a data URL + * \param data will be set to the extracted string data if the \a path is a data URL + * + * \returns TRUE if \a path is an embedded string data URL + * + * \since QGIS 3.42 + */ + static bool parseEmbeddedStringData( const QString &path, QString *mimeType SIP_OUT = nullptr, QString *data SIP_OUT = nullptr ); + /** * Returns TRUE if \a path represents base64 encoded data. * diff --git a/src/core/qgsabstractcontentcache_p.h b/src/core/qgsabstractcontentcache_p.h index b0d38f7b040f..78dff4d56357 100644 --- a/src/core/qgsabstractcontentcache_p.h +++ b/src/core/qgsabstractcontentcache_p.h @@ -53,6 +53,12 @@ QByteArray QgsAbstractContentCache::getContent( const QString &path, const QB { return QByteArray::fromBase64( base64String.toLocal8Bit(), QByteArray::OmitTrailingEquals ); } + // maybe embedded string data + QString embeddedString; + if ( parseEmbeddedStringData( path, nullptr, &embeddedString ) ) + { + return embeddedString.toUtf8(); + } } // maybe it's a url... diff --git a/src/core/qgsabstractgeopdfexporter.cpp b/src/core/qgsabstractgeopdfexporter.cpp index 03178ed7660f..e3df354380a9 100644 --- a/src/core/qgsabstractgeopdfexporter.cpp +++ b/src/core/qgsabstractgeopdfexporter.cpp @@ -408,7 +408,7 @@ QString QgsAbstractGeospatialPdfExporter::createCompositionXml( const QList std::unique_ptr< TreeNode > { - std::unique_ptr< TreeNode > group = std::make_unique< TreeNode >(); + auto group = std::make_unique< TreeNode >(); const QString id = QUuid::createUuid().toString(); group->id = id; groupNameToTreeNode[ groupName ] = group.get(); @@ -426,7 +426,7 @@ QString QgsAbstractGeospatialPdfExporter::createCompositionXml( const QList layer = std::make_unique< TreeNode >(); + auto layer = std::make_unique< TreeNode >(); layer->id = destinationGroup.isEmpty() ? component.mapLayerId : QStringLiteral( "%1_%2" ).arg( destinationGroup, component.mapLayerId ); layer->name = details.layerIdToPdfLayerTreeNameMap.contains( component.mapLayerId ) ? details.layerIdToPdfLayerTreeNameMap.value( component.mapLayerId ) : component.name; layer->initiallyVisible = details.initialLayerVisibility.value( component.mapLayerId, true ); @@ -530,7 +530,6 @@ QString QgsAbstractGeospatialPdfExporter::createCompositionXml( const QList we want to write to its target instead + const QFileInfo targetFileInfo( target ); + target = targetFileInfo.canonicalFilePath(); + // If target still exists, remove (might not exist if was a dangling symlink) + if ( QFile::exists( target ) ) + QFile::remove( target ); + } #ifdef Q_OS_WIN // Clear temporary flag (see GH #32118) @@ -94,9 +103,9 @@ bool QgsArchive::zip( const QString &filename ) #endif // Q_OS_WIN // save zip archive - if ( ! tmpFile.rename( filename ) ) + if ( ! tmpFile.rename( target ) ) { - const QString err = QObject::tr( "Unable to save zip file '%1'" ).arg( filename ); + const QString err = QObject::tr( "Unable to save zip file '%1'" ).arg( target ); QgsMessageLog::logMessage( err, QStringLiteral( "QgsArchive" ) ); return false; } diff --git a/src/core/qgsdatadefinedsizelegend.cpp b/src/core/qgsdatadefinedsizelegend.cpp index c8b2119a6d8e..38e0731356bf 100644 --- a/src/core/qgsdatadefinedsizelegend.cpp +++ b/src/core/qgsdatadefinedsizelegend.cpp @@ -30,7 +30,7 @@ QgsDataDefinedSizeLegend::QgsDataDefinedSizeLegend() { - std::unique_ptr< QgsSimpleLineSymbolLayer > lineSymbolLayer = std::make_unique< QgsSimpleLineSymbolLayer >( QColor( 0, 0, 0 ), 0.2 ); + auto lineSymbolLayer = std::make_unique< QgsSimpleLineSymbolLayer >( QColor( 0, 0, 0 ), 0.2 ); mLineSymbol = std::make_unique< QgsLineSymbol >( QgsSymbolLayerList() << lineSymbolLayer.release() ); } diff --git a/src/core/qgsdiagramrenderer.cpp b/src/core/qgsdiagramrenderer.cpp index 962fe477df4a..0b7db64f6fcf 100644 --- a/src/core/qgsdiagramrenderer.cpp +++ b/src/core/qgsdiagramrenderer.cpp @@ -1124,19 +1124,19 @@ void QgsStackedDiagramRenderer::_readXmlSubRenderers( const QDomElement &elem, c if ( subRendererElem.nodeName() == QLatin1String( "SingleCategoryDiagramRenderer" ) ) { - std::unique_ptr< QgsSingleCategoryDiagramRenderer > singleCatDiagramRenderer = std::make_unique< QgsSingleCategoryDiagramRenderer >(); + auto singleCatDiagramRenderer = std::make_unique< QgsSingleCategoryDiagramRenderer >(); singleCatDiagramRenderer->readXml( subRendererElem, context ); addRenderer( singleCatDiagramRenderer.release() ); } else if ( subRendererElem.nodeName() == QLatin1String( "LinearlyInterpolatedDiagramRenderer" ) ) { - std::unique_ptr< QgsLinearlyInterpolatedDiagramRenderer > linearDiagramRenderer = std::make_unique< QgsLinearlyInterpolatedDiagramRenderer >(); + auto linearDiagramRenderer = std::make_unique< QgsLinearlyInterpolatedDiagramRenderer >(); linearDiagramRenderer->readXml( subRendererElem, context ); addRenderer( linearDiagramRenderer.release() ); } else if ( subRendererElem.nodeName() == QLatin1String( "StackedDiagramRenderer" ) ) { - std::unique_ptr< QgsStackedDiagramRenderer > stackedDiagramRenderer = std::make_unique< QgsStackedDiagramRenderer >(); + auto stackedDiagramRenderer = std::make_unique< QgsStackedDiagramRenderer >(); stackedDiagramRenderer->readXml( subRendererElem, context ); addRenderer( stackedDiagramRenderer.release() ); } diff --git a/src/core/qgsdistancearea.cpp b/src/core/qgsdistancearea.cpp index fbcb6bc4b734..18a9816e27b5 100644 --- a/src/core/qgsdistancearea.cpp +++ b/src/core/qgsdistancearea.cpp @@ -542,7 +542,7 @@ QgsGeometry QgsDistanceArea::splitGeometryAtAntimeridian( const QgsGeometry &geo if ( QgsWkbTypes::isCurvedType( g.wkbType() ) ) g.convertToStraightSegment(); - std::unique_ptr< QgsMultiLineString > res = std::make_unique< QgsMultiLineString >(); + auto res = std::make_unique< QgsMultiLineString >(); for ( auto part = g.const_parts_begin(); part != g.const_parts_end(); ++part ) { const QgsLineString *line = qgsgeometry_cast< const QgsLineString * >( *part ); diff --git a/src/core/qgselevationmap.cpp b/src/core/qgselevationmap.cpp index 762b2f9f5006..c24bd1aa0ae7 100644 --- a/src/core/qgselevationmap.cpp +++ b/src/core/qgselevationmap.cpp @@ -58,7 +58,7 @@ float QgsElevationMap::decodeElevation( QRgb colorRaw ) std::unique_ptr QgsElevationMap::fromRasterBlock( QgsRasterBlock *block ) { - std::unique_ptr elevMap( new QgsElevationMap( QSize( block->width(), block->height() ) ) ); + auto elevMap = std::make_unique( QSize( block->width(), block->height() ) ); QRgb *dataPtr = reinterpret_cast( elevMap->mElevationImage.bits() ); for ( int row = 0; row < block->height(); ++row ) { diff --git a/src/core/qgserror.h b/src/core/qgserror.h index a719e969c4ad..74f0d53becc3 100644 --- a/src/core/qgserror.h +++ b/src/core/qgserror.h @@ -104,8 +104,8 @@ class CORE_EXPORT QgsError void append( const QgsErrorMessage &message ); /** - * Test if any error is set. - * \returns TRUE if contains error + * Test if no error is set. + * \returns FALSE if contains error */ bool isEmpty() const { return mMessageList.isEmpty(); } diff --git a/src/core/qgsexpressionparser.yy b/src/core/qgsexpressionparser.yy index 80a89b841397..749730e5acb4 100644 --- a/src/core/qgsexpressionparser.yy +++ b/src/core/qgsexpressionparser.yy @@ -229,16 +229,18 @@ expression_non_logical: | '(' expression ')' { $$ = $2; } | NAME '(' exp_list ')' { - int fnIndex = QgsExpression::functionIndex(*$1); + const QString expressionFunctionName = *$1; delete $1; + const int fnIndex = QgsExpression::functionIndex(expressionFunctionName); if (fnIndex == -1) { QgsExpression::ParserError::ParserErrorType errorType = QgsExpression::ParserError::FunctionUnknown; parser_ctx->currentErrorType = errorType; - exp_error(&yyloc, parser_ctx, QObject::tr( "Function is not known" ).toUtf8().constData() ); + exp_error(&yyloc, parser_ctx, QObject::tr( "Function %1 is not known" ).arg( expressionFunctionName ).toUtf8().constData() ); delete $3; YYERROR; } + QgsExpressionFunction* func = QgsExpression::Functions()[fnIndex]; QString paramError; if ( !QgsExpressionNodeFunction::validateParams( fnIndex, $3, paramError ) ) { @@ -248,7 +250,6 @@ expression_non_logical: delete $3; YYERROR; } - QgsExpressionFunction* func = QgsExpression::Functions()[fnIndex]; if ( func->params() != -1 && !( func->params() >= $3->count() && func->minParams() <= $3->count() ) ) @@ -264,7 +265,7 @@ expression_non_logical: { expectedMessage = QObject::tr( "Expected between %1 and %2 parameters but %3 were provided." ).arg( QString::number( func->minParams() ), QString::number( func->params() ), QString::number( $3->count() ) ); } - exp_error(&yyloc, parser_ctx, QObject::tr( "%1 function is called with wrong number of arguments. %2" ).arg( QgsExpression::Functions()[fnIndex]->name(), expectedMessage ).toUtf8().constData() ); + exp_error(&yyloc, parser_ctx, QObject::tr( "%1 function is called with wrong number of arguments. %2" ).arg( func->name(), expectedMessage ).toUtf8().constData() ); delete $3; YYERROR; } @@ -275,23 +276,24 @@ expression_non_logical: | NAME '(' ')' { - int fnIndex = QgsExpression::functionIndex(*$1); + const QString expressionFunctionName = *$1; + const int fnIndex = QgsExpression::functionIndex(expressionFunctionName); delete $1; if (fnIndex == -1) { QgsExpression::ParserError::ParserErrorType errorType = QgsExpression::ParserError::FunctionUnknown; parser_ctx->currentErrorType = errorType; - exp_error(&yyloc, parser_ctx, QObject::tr( "Function is not known" ).toUtf8().constData() ); + exp_error(&yyloc, parser_ctx, QObject::tr( "Function %1 is not known" ).arg( expressionFunctionName ).toUtf8().constData() ); YYERROR; } + QgsExpressionFunction* func = QgsExpression::Functions()[fnIndex]; // 0 parameters is expected, -1 parameters means leave it to the // implementation - if ( QgsExpression::Functions()[fnIndex]->minParams() > 0 ) + if ( func->minParams() > 0 ) { - QgsExpression::ParserError::ParserErrorType errorType = QgsExpression::ParserError::FunctionWrongArgs; parser_ctx->currentErrorType = errorType; - exp_error(&yyloc, parser_ctx, QObject::tr( "%1 function is called with wrong number of arguments" ).arg( QgsExpression::Functions()[fnIndex]->name() ).toLocal8Bit().constData() ); + exp_error(&yyloc, parser_ctx, QObject::tr( "%1 function is called with wrong number of arguments" ).arg( func->name() ).toLocal8Bit().constData() ); YYERROR; } $$ = new QgsExpressionNodeFunction(fnIndex, new QgsExpressionNode::NodeList()); @@ -313,7 +315,9 @@ expression_non_logical: // special columns (actually functions with no arguments) | SPECIAL_COL { - int fnIndex = QgsExpression::functionIndex(*$1); + const QString expressionFunctionName = *$1; + const int fnIndex = QgsExpression::functionIndex(*$1); + delete $1; if (fnIndex >= 0) { $$ = new QgsExpressionNodeFunction( fnIndex, nullptr ); @@ -322,10 +326,9 @@ expression_non_logical: { QgsExpression::ParserError::ParserErrorType errorType = QgsExpression::ParserError::FunctionUnknown; parser_ctx->currentErrorType = errorType; - exp_error(&yyloc, parser_ctx, QObject::tr( "%1 function is not known" ).arg( *$1 ).toLocal8Bit().constData()); + exp_error(&yyloc, parser_ctx, QObject::tr( "%1 function is not known" ).arg( expressionFunctionName ).toLocal8Bit().constData()); YYERROR; } - delete $1; } // variables diff --git a/src/core/qgsfeatureiterator.h b/src/core/qgsfeatureiterator.h index b1f0a2c9b443..9a74049f6878 100644 --- a/src/core/qgsfeatureiterator.h +++ b/src/core/qgsfeatureiterator.h @@ -298,7 +298,7 @@ class CORE_EXPORT QgsFeatureIterator SIP_PYOBJECT __next__() SIP_TYPEHINT( QgsFeature ); % MethodCode - std::unique_ptr< QgsFeature > f = std::make_unique< QgsFeature >(); + auto f = std::make_unique< QgsFeature >(); bool result = false; Py_BEGIN_ALLOW_THREADS result = ( sipCpp->nextFeature( *f ) ); diff --git a/src/core/qgsgrouplayer.cpp b/src/core/qgsgrouplayer.cpp index b4deb13e49c0..63fa36496c43 100644 --- a/src/core/qgsgrouplayer.cpp +++ b/src/core/qgsgrouplayer.cpp @@ -54,7 +54,7 @@ QgsGroupLayer *QgsGroupLayer::clone() const QGIS_PROTECT_QOBJECT_THREAD_ACCESS const QgsGroupLayer::LayerOptions options( mTransformContext ); - std::unique_ptr< QgsGroupLayer > layer = std::make_unique< QgsGroupLayer >( name(), options ); + auto layer = std::make_unique< QgsGroupLayer >( name(), options ); QgsMapLayer::clone( layer.get() ); layer->setChildLayers( _qgis_listRefToRaw( mChildren ) ); layer->setPaintEffect( mPaintEffect ? mPaintEffect->clone() : nullptr ); diff --git a/src/core/qgsjsonutils.cpp b/src/core/qgsjsonutils.cpp index d906148189e1..2377dc9a0f4d 100644 --- a/src/core/qgsjsonutils.cpp +++ b/src/core/qgsjsonutils.cpp @@ -503,7 +503,7 @@ std::unique_ptr< QgsPolygon > parsePolygonFromGeoJson( const json &coords ) return nullptr; } - std::unique_ptr< QgsPolygon > polygon = std::make_unique< QgsPolygon >( exterior.release() ); + auto polygon = std::make_unique< QgsPolygon >( exterior.release() ); for ( std::size_t i = 1; i < coordsSize; ++i ) { std::unique_ptr< QgsLineString > ring = parseLineStringFromGeoJson( coords[i] ); @@ -558,7 +558,7 @@ std::unique_ptr< QgsAbstractGeometry > parseGeometryFromGeoJson( const json &geo return nullptr; } - std::unique_ptr< QgsMultiPoint > multiPoint = std::make_unique< QgsMultiPoint >(); + auto multiPoint = std::make_unique< QgsMultiPoint >(); multiPoint->reserve( static_cast< int >( coords.size() ) ); for ( const auto &pointCoords : coords ) { @@ -599,7 +599,7 @@ std::unique_ptr< QgsAbstractGeometry > parseGeometryFromGeoJson( const json &geo return nullptr; } - std::unique_ptr< QgsMultiLineString > multiLineString = std::make_unique< QgsMultiLineString >(); + auto multiLineString = std::make_unique< QgsMultiLineString >(); multiLineString->reserve( static_cast< int >( coords.size() ) ); for ( const auto &lineCoords : coords ) { @@ -646,7 +646,7 @@ std::unique_ptr< QgsAbstractGeometry > parseGeometryFromGeoJson( const json &geo return nullptr; } - std::unique_ptr< QgsMultiPolygon > multiPolygon = std::make_unique< QgsMultiPolygon >(); + auto multiPolygon = std::make_unique< QgsMultiPolygon >(); multiPolygon->reserve( static_cast< int >( coords.size() ) ); for ( const auto &polygonCoords : coords ) { @@ -676,7 +676,7 @@ std::unique_ptr< QgsAbstractGeometry > parseGeometryFromGeoJson( const json &geo return nullptr; } - std::unique_ptr< QgsGeometryCollection > collection = std::make_unique< QgsGeometryCollection >(); + auto collection = std::make_unique< QgsGeometryCollection >(); collection->reserve( static_cast< int >( geometries.size() ) ); for ( const auto &geometry : geometries ) { diff --git a/src/core/qgslocaldefaultsettings.cpp b/src/core/qgslocaldefaultsettings.cpp index 70244780d882..044904909b2c 100644 --- a/src/core/qgslocaldefaultsettings.cpp +++ b/src/core/qgslocaldefaultsettings.cpp @@ -48,7 +48,7 @@ QgsBearingNumericFormat *QgsLocalDefaultSettings::bearingFormat() } s.endGroup(); - std::unique_ptr< QgsBearingNumericFormat > res = std::make_unique< QgsBearingNumericFormat >(); + auto res = std::make_unique< QgsBearingNumericFormat >(); res->setConfiguration( config, QgsReadWriteContext() ); return res.release(); } @@ -79,7 +79,7 @@ QgsGeographicCoordinateNumericFormat *QgsLocalDefaultSettings::geographicCoordin } s.endGroup(); - std::unique_ptr< QgsGeographicCoordinateNumericFormat > res = std::make_unique< QgsGeographicCoordinateNumericFormat >(); + auto res = std::make_unique< QgsGeographicCoordinateNumericFormat >(); res->setConfiguration( config, QgsReadWriteContext() ); return res.release(); } diff --git a/src/core/qgslogger.h b/src/core/qgslogger.h index fa4144929ff7..6e86dbe87b36 100644 --- a/src/core/qgslogger.h +++ b/src/core/qgslogger.h @@ -32,11 +32,15 @@ class QFile; #ifdef QGISDEBUG #define QgsDebugError(str) QgsLogger::debug(QString(str), 0, __FILE__, __FUNCTION__, __LINE__) #define QgsDebugMsgLevel(str, level) if ( level <= QgsLogger::debugLevel() ) { QgsLogger::debug(QString(str), (level), __FILE__, __FUNCTION__, __LINE__); }(void)(0) +#define QgsDebugErrorLoc(str, file, func, line) QgsLogger::debug(QString(str), 0, file, func, line) +#define QgsDebugMsgLevelLoc(str, level, file, func, line) if ( level <= QgsLogger::debugLevel() ) { QgsLogger::debug(QString(str), (level), file, func, line); }(void)(0) #define QgsDebugCall QgsScopeLogger _qgsScopeLogger(__FILE__, __FUNCTION__, __LINE__) #else #define QgsDebugCall do {} while(false) #define QgsDebugError(str) do {} while(false) #define QgsDebugMsgLevel(str, level) do {} while(false) +#define QgsDebugErrorLoc(str, file, func, line) do {} while(false) +#define QgsDebugMsgLevelLoc(str, level, file, func, line) do {} while(false) #endif /** diff --git a/src/core/qgsmaphittest.cpp b/src/core/qgsmaphittest.cpp index c6a9ccc53c08..d14ca02ac164 100644 --- a/src/core/qgsmaphittest.cpp +++ b/src/core/qgsmaphittest.cpp @@ -89,7 +89,7 @@ void QgsMapHitTest::run() if ( mapSettings.layerStyleOverrides().contains( vl->id() ) ) styleOverride.setOverrideStyle( mapSettings.layerStyleOverrides().value( vl->id() ) ); - std::unique_ptr< QgsVectorLayerFeatureSource > source = std::make_unique< QgsVectorLayerFeatureSource >( vl ); + auto source = std::make_unique< QgsVectorLayerFeatureSource >( vl ); runHitTestFeatureSource( source.get(), vl->id(), vl->fields(), vl->renderer(), usedSymbols, usedSymbolsRuleKey, context, @@ -367,7 +367,7 @@ bool QgsMapHitTestTask::run() mFeedback = std::make_unique< QgsFeedback >(); connect( mFeedback.get(), &QgsFeedback::progressChanged, this, &QgsTask::progressChanged ); - std::unique_ptr< QgsMapHitTest > hitTest = std::make_unique< QgsMapHitTest >( mSettings ); + auto hitTest = std::make_unique< QgsMapHitTest >( mSettings ); // TODO: do we need this temp image? const QgsMapSettings &mapSettings = mSettings.mapSettings(); diff --git a/src/core/qgsmaplayer.cpp b/src/core/qgsmaplayer.cpp index e1cfb6040556..5c830752dc57 100644 --- a/src/core/qgsmaplayer.cpp +++ b/src/core/qgsmaplayer.cpp @@ -473,14 +473,20 @@ QString QgsMapLayer::metadataUrlFormat() const } } -QString QgsMapLayer::publicSource( bool hidePassword ) const +QString QgsMapLayer::publicSource( bool redactCredentials ) const { QGIS_PROTECT_QOBJECT_THREAD_ACCESS // Redo this every time we're asked for it, as we don't know if // dataSource has changed. - QString safeName = QgsDataSourceUri::removePassword( mDataSource, hidePassword ); - return safeName; + if ( const QgsProviderMetadata *metadata = QgsProviderRegistry::instance()->providerMetadata( providerType() ) ) + { + return metadata->cleanUri( mDataSource, redactCredentials ? Qgis::UriCleaningFlag::RedactCredentials : Qgis::UriCleaningFlag::RemoveCredentials ); + } + else + { + return QgsDataSourceUri::removePassword( mDataSource, redactCredentials ); + } } QString QgsMapLayer::source() const @@ -565,17 +571,16 @@ bool QgsMapLayer::readLayerXml( const QDomElement &layerElement, QgsReadWriteCon mnl = layerElement.namedItem( QStringLiteral( "datasource" ) ); mne = mnl.toElement(); const QString dataSourceRaw = mne.text(); - mDataSource = provider.isEmpty() ? dataSourceRaw : QgsProviderRegistry::instance()->relativeToAbsoluteUri( provider, dataSourceRaw, context ); // if the layer needs authentication, ensure the master password is set const thread_local QRegularExpression rx( "authcfg=([a-z]|[A-Z]|[0-9]){7}" ); - if ( rx.match( mDataSource ).hasMatch() + if ( rx.match( dataSourceRaw ).hasMatch() && !QgsApplication::authManager()->setMasterPassword( true ) ) { return false; } - mDataSource = decodedSource( mDataSource, provider, context ); + mDataSource = decodedSource( dataSourceRaw, provider, context ); // Set the CRS from project file, asking the user if necessary. // Make it the saved CRS to have WMS layer projected correctly. @@ -777,10 +782,7 @@ bool QgsMapLayer::writeLayerXml( QDomElement &layerElement, QDomDocument &docume // data source QDomElement dataSource = document.createElement( QStringLiteral( "datasource" ) ); - const QgsDataProvider *provider = dataProvider(); - const QString providerKey = provider ? provider->name() : QString(); - const QString srcRaw = encodedSource( source(), context ); - const QString src = providerKey.isEmpty() ? srcRaw : QgsProviderRegistry::instance()->absoluteToRelativeUri( providerKey, srcRaw, context ); + const QString src = encodedSource( source(), context ); const QDomText dataSourceText = document.createTextNode( src ); dataSource.appendChild( dataSourceText ); layerElement.appendChild( dataSource ); @@ -3232,12 +3234,14 @@ QString QgsMapLayer::generalHtmlMetadata() const // name metadata += QStringLiteral( "" ) + tr( "Name" ) + QStringLiteral( "" ) + name() + QStringLiteral( "\n" ); + const QString lPublicSource = publicSource(); + QString path; bool isLocalPath = false; if ( dataProvider() ) { // local path - QVariantMap uriComponents = QgsProviderRegistry::instance()->decodeUri( dataProvider()->name(), publicSource() ); + QVariantMap uriComponents = QgsProviderRegistry::instance()->decodeUri( dataProvider()->name(), lPublicSource ); if ( uriComponents.contains( QStringLiteral( "path" ) ) ) { path = uriComponents[QStringLiteral( "path" )].toString(); @@ -3283,8 +3287,8 @@ QString QgsMapLayer::generalHtmlMetadata() const } // data source - if ( publicSource() != path || !isLocalPath ) - metadata += QStringLiteral( "" ) + tr( "Source" ) + QStringLiteral( "%1" ).arg( publicSource() != path ? publicSource() : path ) + QStringLiteral( "\n" ); + if ( lPublicSource != path || !isLocalPath ) + metadata += QStringLiteral( "" ) + tr( "Source" ) + QStringLiteral( "%1" ).arg( lPublicSource != path ? lPublicSource : path ) + QStringLiteral( "\n" ); // provider if ( dataProvider() ) diff --git a/src/core/qgsmaplayer.h b/src/core/qgsmaplayer.h index 19303cb6e212..861b2ffc5c0b 100644 --- a/src/core/qgsmaplayer.h +++ b/src/core/qgsmaplayer.h @@ -573,12 +573,15 @@ class CORE_EXPORT QgsMapLayer : public QObject */ bool isValid() const; + // TODO QGIS 4.0: consider changing bool hidePassword to an enumeration: HIDE_CREDENTIALS / REDACT_CREDENTIALS + // to avoid the ambiguity of the double negation (hide = false) + /** * Gets a version of the internal layer definition that has sensitive - * bits removed (for example, the password). This function should - * be used when displaying the source name for general viewing. - * \param hidePassword False, if the password should be removed or replaced by an arbitrary string, since QGIS 3.34 - * \see source() + * bits removed (for example, the password). This function should + * be used when displaying the source name for general viewing. + * \param hidePassword TRUE to replace the value of credentials with 'xxxxxxxx', FALSE to completely remove credentials (key and value). Since QGIS 3.34 + * \see source() */ QString publicSource( bool hidePassword = false ) const; diff --git a/src/core/qgsmaplayerfactory.cpp b/src/core/qgsmaplayerfactory.cpp index ddf42af3aeb9..b5a260226857 100644 --- a/src/core/qgsmaplayerfactory.cpp +++ b/src/core/qgsmaplayerfactory.cpp @@ -36,7 +36,11 @@ Qgis::LayerType QgsMapLayerFactory::typeFromString( const QString &string, bool return Qgis::LayerType::Mesh; else if ( string.compare( QLatin1String( "vector-tile" ), Qt::CaseInsensitive ) == 0 ) return Qgis::LayerType::VectorTile; - else if ( string.compare( QLatin1String( "point-cloud" ), Qt::CaseInsensitive ) == 0 ) + else if ( string.compare( QLatin1String( "point-cloud" ), Qt::CaseInsensitive ) == 0 || + // We accept "pointcloud" for backward compatibility with the + // MIME related code, which spelled it that way before 3.42.0 where + // we have delegated to QgsMapLayerFactory::typeToString() + string.compare( QLatin1String( "pointcloud" ), Qt::CaseInsensitive ) == 0 ) return Qgis::LayerType::PointCloud; else if ( string.compare( QLatin1String( "plugin" ), Qt::CaseInsensitive ) == 0 ) return Qgis::LayerType::Plugin; diff --git a/src/core/qgsmaplayermodel.cpp b/src/core/qgsmaplayermodel.cpp index 28b1a0e68c43..5c3c82b6a76b 100644 --- a/src/core/qgsmaplayermodel.cpp +++ b/src/core/qgsmaplayermodel.cpp @@ -42,6 +42,8 @@ QgsMapLayerModel::QgsMapLayerModel( QObject *parent, QgsProject *project ) void QgsMapLayerModel::setProject( QgsProject *project ) { + if ( mProject == ( project ? project : QgsProject::instance() ) ) // skip-keyword-check + return; // remove layers from previous project if ( mProject ) @@ -513,7 +515,7 @@ bool QgsMapLayerModel::canDropMimeData( const QMimeData *data, Qt::DropAction ac QMimeData *QgsMapLayerModel::mimeData( const QModelIndexList &indexes ) const { - std::unique_ptr< QMimeData > mimeData = std::make_unique< QMimeData >(); + auto mimeData = std::make_unique< QMimeData >(); QByteArray encodedData; QDataStream stream( &encodedData, QIODevice::WriteOnly ); diff --git a/src/core/qgsmaptopixelgeometrysimplifier.cpp b/src/core/qgsmaptopixelgeometrysimplifier.cpp index 1502ea4f4001..4e743f679607 100644 --- a/src/core/qgsmaptopixelgeometrysimplifier.cpp +++ b/src/core/qgsmaptopixelgeometrysimplifier.cpp @@ -94,22 +94,22 @@ static std::unique_ptr< QgsAbstractGeometry > generalizeWkbGeometryByBoundingBox } else { - std::unique_ptr< QgsLineString > ext = std::make_unique< QgsLineString >( - QVector< double >() << x1 - << x2 - << x2 - << x1 - << x1, - QVector< double >() << y1 - << y1 - << y2 - << y2 - << y1 ); + auto ext = std::make_unique< QgsLineString >( + QVector< double >() << x1 + << x2 + << x2 + << x1 + << x1, + QVector< double >() << y1 + << y1 + << y2 + << y2 + << y1 ); if ( geometryType == Qgis::WkbType::LineString ) return std::move( ext ); else { - std::unique_ptr< QgsPolygon > polygon = std::make_unique< QgsPolygon >(); + auto polygon = std::make_unique< QgsPolygon >(); polygon->setExteriorRing( ext.release() ); return std::move( polygon ); } @@ -376,7 +376,7 @@ std::unique_ptr< QgsAbstractGeometry > QgsMapToPixelSimplifier::simplifyGeometry else if ( flatType == Qgis::WkbType::Polygon ) { const QgsPolygon &srcPolygon = dynamic_cast( geometry ); - std::unique_ptr polygon( new QgsPolygon() ); + auto polygon = std::make_unique(); std::unique_ptr extRing = simplifyGeometry( simplifyFlags, simplifyAlgorithm, *srcPolygon.exteriorRing(), map2pixelTol, true ); polygon->setExteriorRing( qgsgeometry_cast( extRing.release() ) ); for ( int i = 0; i < srcPolygon.numInteriorRings(); ++i ) diff --git a/src/core/qgsmessagelog.cpp b/src/core/qgsmessagelog.cpp index 15f68e1d1cb9..c9a9d3e8c3e8 100644 --- a/src/core/qgsmessagelog.cpp +++ b/src/core/qgsmessagelog.cpp @@ -25,19 +25,27 @@ class QgsMessageLogConsole; -void QgsMessageLog::logMessage( const QString &message, const QString &tag, Qgis::MessageLevel level, bool notifyUser ) +void QgsMessageLog::logMessage( const QString &message, const QString &tag, Qgis::MessageLevel level, bool notifyUser, + const char *file, const char *function, int line ) { +#ifndef QGISDEBUG + Q_UNUSED( file ) + Q_UNUSED( function ) + Q_UNUSED( line ) +#endif switch ( level ) { case Qgis::MessageLevel::Info: case Qgis::MessageLevel::Success: case Qgis::MessageLevel::NoLevel: - QgsDebugMsgLevel( QStringLiteral( "%1 %2[%3] %4" ).arg( QDateTime::currentDateTime().toString( Qt::ISODate ), tag ).arg( static_cast< int >( level ) ).arg( message ), 1 ); + QgsDebugMsgLevelLoc( QStringLiteral( "%1 %2[%3] %4" ).arg( QDateTime::currentDateTime().toString( Qt::ISODate ), tag ).arg( static_cast< int >( level ) ).arg( message ), + 1, file, function, line ); break; case Qgis::MessageLevel::Warning: case Qgis::MessageLevel::Critical: - QgsDebugError( QStringLiteral( "%1 %2[%3] %4" ).arg( QDateTime::currentDateTime().toString( Qt::ISODate ), tag ).arg( static_cast< int >( level ) ).arg( message ) ); + QgsDebugErrorLoc( QStringLiteral( "%1 %2[%3] %4" ).arg( QDateTime::currentDateTime().toString( Qt::ISODate ), tag ).arg( static_cast< int >( level ) ).arg( message ), + file, function, line ); break; } diff --git a/src/core/qgsmessagelog.h b/src/core/qgsmessagelog.h index a7fcff11f0bf..f6d6057ef76d 100644 --- a/src/core/qgsmessagelog.h +++ b/src/core/qgsmessagelog.h @@ -51,7 +51,16 @@ class CORE_EXPORT QgsMessageLog : public QObject * If it is FALSE, the message should appear in logs silently. Note that log viewer implementations may * only respect notification hints for certain message levels. */ - static void logMessage( const QString &message, const QString &tag = QString(), Qgis::MessageLevel level = Qgis::MessageLevel::Warning, bool notifyUser = true ); + // TODO: Update this code to use std::source_location from C++20 when transitioning to a fully C++20-compliant codebase. + // Currently, we rely on __builtin_XXX functions (e.g., __builtin_FILE(), __builtin_LINE()), + // which have been successfully tested across multiple systems (Windows, macOS, Linux, FreeBSD) + // and compilers (LLVM, GCC, MSVC). + // Note: We tested with LLVM on FreeBSD and macOS, and std::experimental::source_location is not available. + // It works fine with GNU. It also seems unavailable with MSVC. + // For now, we stick with __builtin_XXX because it is "portable" and functional across all tested environments. + // We'll switch to std::source_location once the transition to C++20 is complete. + static void logMessage( const QString &message, const QString &tag = QString(), Qgis::MessageLevel level = Qgis::MessageLevel::Warning, bool notifyUser = true, + const char *file = __builtin_FILE(), const char *function = __builtin_FUNCTION(), int line = __builtin_LINE() ); signals: diff --git a/src/core/qgsmimedatautils.cpp b/src/core/qgsmimedatautils.cpp index 6ad3b7458184..528fe7c210fe 100644 --- a/src/core/qgsmimedatautils.cpp +++ b/src/core/qgsmimedatautils.cpp @@ -20,6 +20,7 @@ #include "qgslogger.h" #include "qgsrasterlayer.h" #include "qgsvectorlayer.h" +#include "qgsmaplayerfactory.h" #include "qgsmeshlayer.h" #include @@ -71,38 +72,20 @@ QgsMimeDataUtils::Uri::Uri( QgsMapLayer *layer ) , layerId( layer->id() ) , pId( QString::number( QCoreApplication::applicationPid() ) ) { + layerType = QgsMapLayerFactory::typeToString( layer->type() ); switch ( layer->type() ) { case Qgis::LayerType::Vector: { - layerType = QStringLiteral( "vector" ); wkbType = qobject_cast< QgsVectorLayer *>( layer )->wkbType(); break; } case Qgis::LayerType::Raster: - { - layerType = QStringLiteral( "raster" ); - break; - } - case Qgis::LayerType::Mesh: - { - layerType = QStringLiteral( "mesh" ); - break; - } case Qgis::LayerType::PointCloud: - { - layerType = QStringLiteral( "pointcloud" ); - break; - } case Qgis::LayerType::VectorTile: - { - layerType = QStringLiteral( "vector-tile" ); - break; - } case Qgis::LayerType::TiledScene: { - layerType = QStringLiteral( "tiled-scene" ); break; } diff --git a/src/core/qgsmimedatautils.h b/src/core/qgsmimedatautils.h index 2289a7a8cd62..e14fba531392 100644 --- a/src/core/qgsmimedatautils.h +++ b/src/core/qgsmimedatautils.h @@ -100,14 +100,20 @@ class CORE_EXPORT QgsMimeDataUtils * - "vector": vector layers * - "raster": raster layers * - "mesh": mesh layers - * - "pointcloud": point cloud layers + * - "point-cloud": point cloud layers (spelled with a dash since QGIS 3.42.0. In prior versions, there was no dash) * - "vector-tile": vector tile layers * - "tiled-scene": tiled scene layers + * - "annotation": annotation layers + * - "group": group layers * - "plugin": plugin layers * - "custom": custom types * - "project": QGS/QGZ project file * - "directory": directory path * + * Note: use QgsMapLayerFactory::typeToString() to convert from a + * Qgis::LayerType to a string (except for "custom", "project" and + * "directory") + * * Mime data from plugins may use additional custom layer types. */ QString layerType; diff --git a/src/core/qgsofflineediting.cpp b/src/core/qgsofflineediting.cpp index 5f9bd0182f14..769ebaaf9f82 100644 --- a/src/core/qgsofflineediting.cpp +++ b/src/core/qgsofflineediting.cpp @@ -180,7 +180,7 @@ void QgsOfflineEditing::synchronize( bool useTransaction ) remoteName.chop( remoteNameSuffix.size() ); const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() }; // skip-keyword-check - std::shared_ptr remoteLayer = std::make_shared( remoteSource, remoteName, remoteProvider, options ); + auto remoteLayer = std::make_shared( remoteSource, remoteName, remoteProvider, options ); if ( ! remoteLayer->isValid() ) { diff --git a/src/core/qgsogcutils.cpp b/src/core/qgsogcutils.cpp index 16a3d25f3e1f..d9bf029f1193 100644 --- a/src/core/qgsogcutils.cpp +++ b/src/core/qgsogcutils.cpp @@ -3526,7 +3526,7 @@ QgsExpressionNodeFunction *QgsOgcUtilsExpressionFromFilter::nodeSpatialOperatorF // we are exploiting the fact that our function names are the same as the XML tag names const int opIdx = QgsExpression::functionIndex( element.tagName().toLower() ); - std::unique_ptr gml2Args( new QgsExpressionNode::NodeList() ); + auto gml2Args = std::make_unique(); QDomElement childElem = element.firstChildElement(); QString gml2Str; while ( !childElem.isNull() && gml2Str.isEmpty() ) @@ -3548,7 +3548,7 @@ QgsExpressionNodeFunction *QgsOgcUtilsExpressionFromFilter::nodeSpatialOperatorF return nullptr; } - std::unique_ptr opArgs( new QgsExpressionNode::NodeList() ); + auto opArgs = std::make_unique(); opArgs->append( new QgsExpressionNodeFunction( QgsExpression::functionIndex( QStringLiteral( "$geometry" ) ), new QgsExpressionNode::NodeList() ) ); opArgs->append( new QgsExpressionNodeFunction( QgsExpression::functionIndex( QStringLiteral( "geomFromGML" ) ), gml2Args.release() ) ); @@ -3706,7 +3706,7 @@ QgsExpressionNodeFunction *QgsOgcUtilsExpressionFromFilter::nodeFunctionFromOgcF if ( element.attribute( QStringLiteral( "name" ) ) != funcDef->name() ) continue; - std::unique_ptr args( new QgsExpressionNode::NodeList() ); + auto args = std::make_unique(); QDomElement operandElem = element.firstChildElement(); while ( !operandElem.isNull() ) diff --git a/src/core/qgsogrutils.cpp b/src/core/qgsogrutils.cpp index cbe55dd209f7..e376b8a2432d 100644 --- a/src/core/qgsogrutils.cpp +++ b/src/core/qgsogrutils.cpp @@ -235,7 +235,7 @@ int QgsOgrUtils::OGRTZFlagFromQt( const QDateTime &datetime ) std::unique_ptr< OGRField > QgsOgrUtils::variantToOGRField( const QVariant &value, OGRFieldType type ) { - std::unique_ptr< OGRField > res = std::make_unique< OGRField >(); + auto res = std::make_unique< OGRField >(); switch ( value.userType() ) { @@ -788,7 +788,7 @@ std::unique_ptr< QgsPoint > ogrGeometryToQgsPoint( OGRGeometryH geom ) std::unique_ptr< QgsMultiPoint > ogrGeometryToQgsMultiPoint( OGRGeometryH geom ) { - std::unique_ptr< QgsMultiPoint > mp = std::make_unique< QgsMultiPoint >(); + auto mp = std::make_unique< QgsMultiPoint >(); const int count = OGR_G_GetGeometryCount( geom ); mp->reserve( count ); @@ -828,7 +828,7 @@ std::unique_ptr< QgsLineString > ogrGeometryToQgsLineString( OGRGeometryH geom ) std::unique_ptr< QgsMultiLineString > ogrGeometryToQgsMultiLineString( OGRGeometryH geom ) { - std::unique_ptr< QgsMultiLineString > mp = std::make_unique< QgsMultiLineString >(); + auto mp = std::make_unique< QgsMultiLineString >(); const int count = OGR_G_GetGeometryCount( geom ); mp->reserve( count ); @@ -842,7 +842,7 @@ std::unique_ptr< QgsMultiLineString > ogrGeometryToQgsMultiLineString( OGRGeomet std::unique_ptr< QgsPolygon > ogrGeometryToQgsPolygon( OGRGeometryH geom ) { - std::unique_ptr< QgsPolygon > polygon = std::make_unique< QgsPolygon >(); + auto polygon = std::make_unique< QgsPolygon >(); const int count = OGR_G_GetGeometryCount( geom ); if ( count >= 1 ) @@ -860,7 +860,7 @@ std::unique_ptr< QgsPolygon > ogrGeometryToQgsPolygon( OGRGeometryH geom ) std::unique_ptr< QgsMultiPolygon > ogrGeometryToQgsMultiPolygon( OGRGeometryH geom ) { - std::unique_ptr< QgsMultiPolygon > polygon = std::make_unique< QgsMultiPolygon >(); + auto polygon = std::make_unique< QgsMultiPolygon >(); const int count = OGR_G_GetGeometryCount( geom ); polygon->reserve( count ); @@ -1398,7 +1398,7 @@ std::unique_ptr QgsOgrUtils::symbolFromStyleString( const QString &st return res; } - std::unique_ptr< QgsSimpleLineSymbolLayer > simpleLine = std::make_unique< QgsSimpleLineSymbolLayer >( color, lineWidth ); + auto simpleLine = std::make_unique< QgsSimpleLineSymbolLayer >( color, lineWidth ); simpleLine->setWidthUnit( lineWidthUnit ); // pattern @@ -1543,13 +1543,13 @@ std::unique_ptr QgsOgrUtils::symbolFromStyleString( const QString &st QgsSymbolLayerList layers; if ( backColor.isValid() && style != Qt::SolidPattern && style != Qt::NoBrush ) { - std::unique_ptr< QgsSimpleFillSymbolLayer > backgroundFill = std::make_unique< QgsSimpleFillSymbolLayer >( backColor ); + auto backgroundFill = std::make_unique< QgsSimpleFillSymbolLayer >( backColor ); backgroundFill->setLocked( true ); backgroundFill->setStrokeStyle( Qt::NoPen ); layers << backgroundFill.release(); } - std::unique_ptr< QgsSimpleFillSymbolLayer > foregroundFill = std::make_unique< QgsSimpleFillSymbolLayer >( foreColor ); + auto foregroundFill = std::make_unique< QgsSimpleFillSymbolLayer >( foreColor ); foregroundFill->setBrushStyle( style ); foregroundFill->setStrokeStyle( Qt::NoPen ); @@ -1617,7 +1617,7 @@ std::unique_ptr QgsOgrUtils::symbolFromStyleString( const QString &st if ( familyFound ) { - std::unique_ptr< QgsFontMarkerSymbolLayer > fontMarker = std::make_unique< QgsFontMarkerSymbolLayer >( fontFamily, QChar( symId ), symbolSize ); + auto fontMarker = std::make_unique< QgsFontMarkerSymbolLayer >( fontFamily, QChar( symId ), symbolSize ); fontMarker->setSizeUnit( symbolSizeUnit ); fontMarker->setAngle( -angle ); @@ -1716,7 +1716,7 @@ std::unique_ptr QgsOgrUtils::symbolFromStyleString( const QString &st shape = Qgis::MarkerShape::Square; // to initialize the variable } - std::unique_ptr< QgsSimpleMarkerSymbolLayer > simpleMarker = std::make_unique< QgsSimpleMarkerSymbolLayer >( shape, symbolSize, -angle ); + auto simpleMarker = std::make_unique< QgsSimpleMarkerSymbolLayer >( shape, symbolSize, -angle ); simpleMarker->setSizeUnit( symbolSizeUnit ); simpleMarker->setStrokeWidth( 1.0 ); simpleMarker->setStrokeWidthUnit( Qgis::RenderUnit::Points ); @@ -1780,7 +1780,7 @@ std::unique_ptr QgsOgrUtils::symbolFromStyleString( const QString &st } else { - std::unique_ptr< QgsSimpleFillSymbolLayer > emptyFill = std::make_unique< QgsSimpleFillSymbolLayer >(); + auto emptyFill = std::make_unique< QgsSimpleFillSymbolLayer >(); emptyFill->setBrushStyle( Qt::NoBrush ); fillSymbol = std::make_unique< QgsFillSymbol >( QgsSymbolLayerList() << emptyFill.release() ); } diff --git a/src/core/qgspathresolver.cpp b/src/core/qgspathresolver.cpp index 1781d1b78eae..80836038dec4 100644 --- a/src/core/qgspathresolver.cpp +++ b/src/core/qgspathresolver.cpp @@ -130,7 +130,7 @@ QString QgsPathResolver::readPath( const QString &f ) const } else { - return vsiPrefix + fi.canonicalFilePath(); + return vsiPrefix + QDir::cleanPath( fi.absoluteFilePath() ); } } @@ -266,7 +266,8 @@ QString QgsPathResolver::writePath( const QString &s ) const // Get projPath even if project has not been created yet const QFileInfo pfi( QFileInfo( mBaseFileName ).path() ); - QString projPath = pfi.canonicalFilePath(); + // readPath does not resolve symlink, so writePath should not either + QString projPath = pfi.absoluteFilePath(); // If project directory doesn't exit, fallback to absoluteFilePath : symbolic // links won't be handled correctly, but that's OK as the path is "virtual". @@ -290,8 +291,15 @@ QString QgsPathResolver::writePath( const QString &s ) const } const QFileInfo srcFileInfo( srcPath ); + // Guard against relative paths: If srcPath is already relative, QFileInfo will match + // files in the working directory, instead of project directory. Avoid by returning early. + if ( !srcFileInfo.isAbsolute() ) + { + return srcPath; + } if ( srcFileInfo.exists() ) - srcPath = srcFileInfo.canonicalFilePath(); + // Do NOT resolve symlinks, but do remove '..' and '.' + srcPath = QDir::cleanPath( srcFileInfo.absoluteFilePath() ); // if this is a VSIFILE, remove the VSI prefix and append to final result const QString vsiPrefix = QgsGdalUtils::vsiPrefixForPath( src ); diff --git a/src/core/qgsrunprocess.cpp b/src/core/qgsrunprocess.cpp index c75e1b56aee1..0f2d6b11cbb7 100644 --- a/src/core/qgsrunprocess.cpp +++ b/src/core/qgsrunprocess.cpp @@ -280,7 +280,7 @@ int QgsBlockingProcess::run( QgsFeedback *feedback ) if ( requestMadeFromMainThread ) { - std::unique_ptr processThread = std::make_unique( runFunction ); + auto processThread = std::make_unique( runFunction ); processThread->start(); // wait for thread to gracefully exit processThread->wait(); diff --git a/src/core/qgsruntimeprofiler.cpp b/src/core/qgsruntimeprofiler.cpp index 7ad523b8993d..b7a2198b7ab7 100644 --- a/src/core/qgsruntimeprofiler.cpp +++ b/src/core/qgsruntimeprofiler.cpp @@ -215,7 +215,7 @@ QStringList QgsRuntimeProfiler::childGroups( const QString &parent, const QStrin void QgsRuntimeProfiler::start( const QString &name, const QString &group, const QString &id ) { - std::unique_ptr< QgsRuntimeProfilerNode > node = std::make_unique< QgsRuntimeProfilerNode >( group, name, id ); + auto node = std::make_unique< QgsRuntimeProfilerNode >( group, name, id ); node->start(); QgsRuntimeProfilerNode *child = node.get(); @@ -273,7 +273,7 @@ void QgsRuntimeProfiler::end( const QString &group ) void QgsRuntimeProfiler::record( const QString &name, double time, const QString &group, const QString &id ) { - std::unique_ptr< QgsRuntimeProfilerNode > node = std::make_unique< QgsRuntimeProfilerNode >( group, name, id ); + auto node = std::make_unique< QgsRuntimeProfilerNode >( group, name, id ); QgsRuntimeProfilerNode *child = node.get(); if ( !mCurrentStack[ group ].empty() ) @@ -465,7 +465,7 @@ void QgsRuntimeProfiler::otherProfilerStarted( const QString &group, const QStri if ( !child ) { - std::unique_ptr< QgsRuntimeProfilerNode > newChild = std::make_unique< QgsRuntimeProfilerNode >( group, part ); + auto newChild = std::make_unique< QgsRuntimeProfilerNode >( group, part ); const QModelIndex parentIndex = node2index( parentNode ); beginInsertRows( parentIndex, parentNode->childCount(), parentNode->childCount() ); @@ -507,7 +507,7 @@ void QgsRuntimeProfiler::otherProfilerEnded( const QString &group, const QString if ( !child ) { - std::unique_ptr< QgsRuntimeProfilerNode > newChild = std::make_unique< QgsRuntimeProfilerNode >( group, part ); + auto newChild = std::make_unique< QgsRuntimeProfilerNode >( group, part ); const QModelIndex parentIndex = node2index( parentNode ); beginInsertRows( parentIndex, parentNode->childCount(), parentNode->childCount() ); @@ -525,7 +525,7 @@ void QgsRuntimeProfiler::otherProfilerEnded( const QString &group, const QString QgsRuntimeProfilerNode *destNode = parentNode->child( group, name, id ); if ( !destNode ) { - std::unique_ptr< QgsRuntimeProfilerNode > node = std::make_unique< QgsRuntimeProfilerNode >( group, name, id ); + auto node = std::make_unique< QgsRuntimeProfilerNode >( group, name, id ); destNode = node.get(); const QModelIndex parentIndex = node2index( parentNode ); beginInsertRows( parentIndex, parentNode->childCount(), parentNode->childCount() ); diff --git a/src/core/qgsspatialindex.h b/src/core/qgsspatialindex.h index 29f09ab3b6ff..9a2aa80b8148 100644 --- a/src/core/qgsspatialindex.h +++ b/src/core/qgsspatialindex.h @@ -254,7 +254,7 @@ class CORE_EXPORT QgsSpatialIndex : public QgsFeatureSink */ SIP_PYOBJECT geometry( QgsFeatureId id ) const SIP_TYPEHINT( QgsGeometry ); % MethodCode - std::unique_ptr< QgsGeometry > g = std::make_unique< QgsGeometry >( sipCpp->geometry( a0 ) ); + auto g = std::make_unique< QgsGeometry >( sipCpp->geometry( a0 ) ); if ( g->isNull() ) { PyErr_SetString( PyExc_KeyError, QStringLiteral( "No geometry with feature id %1 exists in the index." ).arg( a0 ).toUtf8().constData() ); diff --git a/src/core/qgstemporalnavigationobject.cpp b/src/core/qgstemporalnavigationobject.cpp index 8e6b86827eb1..2fe641bcfdcb 100644 --- a/src/core/qgstemporalnavigationobject.cpp +++ b/src/core/qgstemporalnavigationobject.cpp @@ -90,7 +90,7 @@ void QgsTemporalNavigationObject::setLooping( bool loopAnimation ) QgsExpressionContextScope *QgsTemporalNavigationObject::createExpressionContextScope() const { - std::unique_ptr< QgsExpressionContextScope > scope = std::make_unique< QgsExpressionContextScope >( QStringLiteral( "temporal" ) ); + auto scope = std::make_unique< QgsExpressionContextScope >( QStringLiteral( "temporal" ) ); scope->setVariable( QStringLiteral( "frame_rate" ), mFramesPerSecond, true ); scope->setVariable( QStringLiteral( "frame_number" ), mCurrentFrameNumber, true ); scope->setVariable( QStringLiteral( "frame_duration" ), mFrameDuration, true ); diff --git a/src/core/qgstessellator.cpp b/src/core/qgstessellator.cpp index 03e4225fe7a8..67f14843901d 100644 --- a/src/core/qgstessellator.cpp +++ b/src/core/qgstessellator.cpp @@ -680,7 +680,7 @@ void QgsTessellator::addPolygon( const QgsPolygon &polygon, float extrusionHeigh _ringToPoly2tri( qgsgeometry_cast< const QgsLineString * >( polygonNew->exteriorRing() ), polyline, mNoZ ? nullptr : &z ); polylinesToDelete << polyline; - std::unique_ptr cdt( new p2t::CDT( polyline ) ); + auto cdt = std::make_unique( polyline ); // polygon holes for ( int i = 0; i < polygonNew->numInteriorRings(); ++i ) @@ -817,7 +817,7 @@ int QgsTessellator::dataVerticesCount() const std::unique_ptr QgsTessellator::asMultiPolygon() const { - std::unique_ptr< QgsMultiPolygon > mp = std::make_unique< QgsMultiPolygon >(); + auto mp = std::make_unique< QgsMultiPolygon >(); const auto nVals = mData.size(); mp->reserve( nVals / 9 ); for ( auto i = decltype( nVals ) {0}; i + 8 < nVals; i += 9 ) diff --git a/src/core/qgstiledownloadmanager.cpp b/src/core/qgstiledownloadmanager.cpp index d3dd553f5b13..cc3f2ecdcc3b 100644 --- a/src/core/qgstiledownloadmanager.cpp +++ b/src/core/qgstiledownloadmanager.cpp @@ -95,7 +95,9 @@ void QgsTileDownloadManagerWorker::queueUpdated() QgsDebugMsgLevel( QStringLiteral( "Tile download manager: starting request: " ) + it->request.url().toString(), 2 ); // start entries which are not in progress - it->networkReply = QgsNetworkAccessManager::instance()->get( it->request ); + QNetworkRequest request( it->request ); + request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy ); + it->networkReply = QgsNetworkAccessManager::instance()->get( request ); connect( it->networkReply, &QNetworkReply::finished, it->objWorker, &QgsTileDownloadManagerReplyWorkerObject::replyFinished ); ++mManager->mStats.networkRequestsStarted; diff --git a/src/core/qgstransaction.cpp b/src/core/qgstransaction.cpp index 714bf24d0c43..5b2d4de9ddbf 100644 --- a/src/core/qgstransaction.cpp +++ b/src/core/qgstransaction.cpp @@ -271,7 +271,12 @@ bool QgsTransaction::rollbackToSavepoint( const QString &name, QString &error SI // the status of the DB has changed between the previous savepoint and the // one we are rolling back to. mLastSavePointIsDirty = true; - return executeSql( QStringLiteral( "ROLLBACK TO SAVEPOINT %1" ).arg( QgsExpression::quotedColumnRef( name ) ), error ); + if ( ! executeSql( QStringLiteral( "ROLLBACK TO SAVEPOINT %1" ).arg( QgsExpression::quotedColumnRef( name ) ), error ) ) + { + return false; + } + emit afterRollbackToSavepoint( name ); + return true; } void QgsTransaction::dirtyLastSavePoint() diff --git a/src/core/qgstransaction.h b/src/core/qgstransaction.h index e14ee719392b..1ed5ed08369b 100644 --- a/src/core/qgstransaction.h +++ b/src/core/qgstransaction.h @@ -173,6 +173,12 @@ class CORE_EXPORT QgsTransaction : public QObject SIP_ABSTRACT */ void afterRollback(); + /** + * Emitted after a rollback to savepoint + * \since QGIS 3.42 + */ + void afterRollbackToSavepoint( const QString &savepointName ); + /** * Emitted if a sql query is executed and the underlying data is modified */ diff --git a/src/core/qgsvectorfilewriter.cpp b/src/core/qgsvectorfilewriter.cpp index 91e12afce66b..78c9b8f24075 100644 --- a/src/core/qgsvectorfilewriter.cpp +++ b/src/core/qgsvectorfilewriter.cpp @@ -1574,7 +1574,11 @@ class QgsVectorFileWriterMetadataContainer QgsVectorFileWriter::MetaData( QStringLiteral( "GeoPackage" ), QObject::tr( "GeoPackage" ), +#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(3,7,0) + QStringLiteral( "*.gpkg *.gpkg.zip" ), +#else QStringLiteral( "*.gpkg" ), +#endif QStringLiteral( "gpkg" ), datasetOptions, layerOptions, @@ -2251,6 +2255,7 @@ class QgsVectorFileWriterMetadataContainer ) ); +#if GDAL_VERSION_NUM < GDAL_COMPUTE_VERSION(3,11,0) // ESRI FileGDB (using ESRI FileGDB API SDK) datasetOptions.clear(); layerOptions.clear(); @@ -2282,6 +2287,7 @@ class QgsVectorFileWriterMetadataContainer QStringLiteral( "UTF-8" ) ) ); +#endif // XLSX datasetOptions.clear(); @@ -3842,7 +3848,7 @@ QStringList multiLayerFormats() const QSet< QString > splitExtensions = qgis::listToSet( driverExtensions.split( ' ', Qt::SkipEmptyParts ) ); if ( splitExtensions.intersects( multiLayerExtensions ) ) { - driverNames << OGR_Dr_GetName( driver ); + driverNames << GDALGetDescription( driver ); } } return driverNames; @@ -3872,7 +3878,7 @@ QList< QgsVectorFileWriter::FilterFormatDetails > QgsVectorFileWriter::supported OGRSFDriverH drv = OGRGetDriver( i ); if ( drv ) { - const QString drvName = OGR_Dr_GetName( drv ); + const QString drvName = GDALGetDescription( drv ); if ( options & SupportsMultipleLayers ) { @@ -3995,7 +4001,7 @@ QList< QgsVectorFileWriter::DriverDetails > QgsVectorFileWriter::ogrDriverList( OGRSFDriverH drv = OGRGetDriver( i ); if ( drv ) { - const QString drvName = OGR_Dr_GetName( drv ); + const QString drvName = GDALGetDescription( drv ); if ( options & SupportsMultipleLayers ) { @@ -4492,7 +4498,7 @@ QgsVectorFileWriter::EditionCapabilities QgsVectorFileWriter::editionCapabilitie gdal::ogr_datasource_unique_ptr hDS( OGROpen( datasetName.toUtf8().constData(), TRUE, &hDriver ) ); if ( !hDS ) return QgsVectorFileWriter::EditionCapabilities(); - QString drvName = OGR_Dr_GetName( hDriver ); + const QString drvName = GDALGetDescription( hDriver ); QgsVectorFileWriter::EditionCapabilities caps = QgsVectorFileWriter::EditionCapabilities(); if ( OGR_DS_TestCapability( hDS.get(), ODsCCreateLayer ) ) { diff --git a/src/core/qgsziputils.cpp b/src/core/qgsziputils.cpp index fc80324813db..df89e4a26a19 100644 --- a/src/core/qgsziputils.cpp +++ b/src/core/qgsziputils.cpp @@ -216,7 +216,10 @@ bool QgsZipUtils::decodeGzip( const char *bytesIn, std::size_t size, QByteArray int ret = inflateInit2( &strm, MAX_WBITS + DEC_MAGIC_NUM_FOR_GZIP ); if ( ret != Z_OK ) + { + inflateEnd( &strm ); return false; + } while ( ret != Z_STREAM_END ) // done when inflate() says it's done { diff --git a/src/core/raster/qgsbrightnesscontrastfilter.cpp b/src/core/raster/qgsbrightnesscontrastfilter.cpp index 469d9d98c1bf..9d6dbc2a2020 100644 --- a/src/core/raster/qgsbrightnesscontrastfilter.cpp +++ b/src/core/raster/qgsbrightnesscontrastfilter.cpp @@ -108,7 +108,7 @@ QgsRasterBlock *QgsBrightnessContrastFilter::block( int bandNo, QgsRectangle co Q_UNUSED( bandNo ) QgsDebugMsgLevel( QStringLiteral( "width = %1 height = %2 extent = %3" ).arg( width ).arg( height ).arg( extent.toString() ), 4 ); - std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock() ); + auto outputBlock = std::make_unique(); if ( !mInput ) { return outputBlock.release(); diff --git a/src/core/raster/qgscolorrampshader.cpp b/src/core/raster/qgscolorrampshader.cpp index b6a747c0ce58..c96c3eb1fac0 100644 --- a/src/core/raster/qgscolorrampshader.cpp +++ b/src/core/raster/qgscolorrampshader.cpp @@ -136,7 +136,7 @@ QgsColorRamp *QgsColorRampShader::sourceColorRamp() const QgsColorRamp *QgsColorRampShader::createColorRamp() const { - std::unique_ptr ramp = std::make_unique< QgsGradientColorRamp >(); + auto ramp = std::make_unique< QgsGradientColorRamp >(); const int count = mColorRampItemList.size(); if ( count == 0 ) { diff --git a/src/core/raster/qgshillshaderenderer.cpp b/src/core/raster/qgshillshaderenderer.cpp index 6c61a29e1054..00349b08f63a 100644 --- a/src/core/raster/qgshillshaderenderer.cpp +++ b/src/core/raster/qgshillshaderenderer.cpp @@ -99,7 +99,7 @@ void QgsHillshadeRenderer::writeXml( QDomDocument &doc, QDomElement &parentElem QgsRasterBlock *QgsHillshadeRenderer::block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback ) { Q_UNUSED( bandNo ) - std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock() ); + auto outputBlock = std::make_unique(); if ( !mInput ) { QgsDebugError( QStringLiteral( "No input raster!" ) ); @@ -238,7 +238,7 @@ QgsRasterBlock *QgsHillshadeRenderer::block( int bandNo, const QgsRectangle &ext // Buffer scanlines, 1px height, 2px wider // Data type for input is Float32 (4 bytes) // keep only three scanlines in memory at a time, make room for initial and final nodata - std::unique_ptr scanLine = std::make_unique( inputBlock->dataType(), scanLineWidth, 1 ); + auto scanLine = std::make_unique( inputBlock->dataType(), scanLineWidth, 1 ); // Note: output block is not 2px wider and it is an image // Prepare context and queue cl::Context ctx = QgsOpenClUtils::context(); diff --git a/src/core/raster/qgshuesaturationfilter.cpp b/src/core/raster/qgshuesaturationfilter.cpp index 465f3e2672dc..676eba155aff 100644 --- a/src/core/raster/qgshuesaturationfilter.cpp +++ b/src/core/raster/qgshuesaturationfilter.cpp @@ -113,7 +113,7 @@ QgsRasterBlock *QgsHueSaturationFilter::block( int bandNo, QgsRectangle const & Q_UNUSED( bandNo ) QgsDebugMsgLevel( QStringLiteral( "width = %1 height = %2 extent = %3" ).arg( width ).arg( height ).arg( extent.toString() ), 4 ); - std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock() ); + auto outputBlock = std::make_unique(); if ( !mInput ) { return outputBlock.release(); diff --git a/src/core/raster/qgsmultibandcolorrenderer.cpp b/src/core/raster/qgsmultibandcolorrenderer.cpp index 584c61f54db7..f75957c74d2a 100644 --- a/src/core/raster/qgsmultibandcolorrenderer.cpp +++ b/src/core/raster/qgsmultibandcolorrenderer.cpp @@ -139,7 +139,7 @@ QgsRasterRenderer *QgsMultiBandColorRenderer::create( const QDomElement &elem, Q QgsRasterBlock *QgsMultiBandColorRenderer::block( int bandNo, QgsRectangle const &extent, int width, int height, QgsRasterBlockFeedback *feedback ) { Q_UNUSED( bandNo ) - std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock() ); + auto outputBlock = std::make_unique(); if ( !mInput ) { return outputBlock.release(); diff --git a/src/core/raster/qgspalettedrasterrenderer.cpp b/src/core/raster/qgspalettedrasterrenderer.cpp index fc29a0236ea2..4050b5c3e0ca 100644 --- a/src/core/raster/qgspalettedrasterrenderer.cpp +++ b/src/core/raster/qgspalettedrasterrenderer.cpp @@ -82,7 +82,7 @@ QgsPalettedRasterRenderer::QgsPalettedRasterRenderer( QgsRasterInterface *input, QgsPalettedRasterRenderer *QgsPalettedRasterRenderer::clone() const { - std::unique_ptr< QgsPalettedRasterRenderer > renderer = std::make_unique< QgsPalettedRasterRenderer >( nullptr, mBand, mMultiValueClassData ); + auto renderer = std::make_unique< QgsPalettedRasterRenderer >( nullptr, mBand, mMultiValueClassData ); if ( mSourceColorRamp ) renderer->setSourceColorRamp( mSourceColorRamp->clone() ); @@ -208,7 +208,7 @@ bool QgsPalettedRasterRenderer::setInputBand( int band ) QgsRasterBlock *QgsPalettedRasterRenderer::block( int, QgsRectangle const &extent, int width, int height, QgsRasterBlockFeedback *feedback ) { - std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock() ); + auto outputBlock = std::make_unique(); if ( !mInput || mMultiValueClassData.isEmpty() ) { return outputBlock.release(); diff --git a/src/core/raster/qgsrasterattributetable.cpp b/src/core/raster/qgsrasterattributetable.cpp index 2dbf92cbbcd7..eb6f63ccac52 100644 --- a/src/core/raster/qgsrasterattributetable.cpp +++ b/src/core/raster/qgsrasterattributetable.cpp @@ -1527,7 +1527,7 @@ QgsRasterRenderer *QgsRasterAttributeTable::createRenderer( QgsRasterDataProvide } else { - std::unique_ptr pseudoColorRenderer = std::make_unique( provider, bandNumber ); + auto pseudoColorRenderer = std::make_unique( provider, bandNumber ); QStringList labels; // Athematic classification is not supported, but the classificationColumn will be used for labels. // if it's not specified, try to guess it here. diff --git a/src/core/raster/qgsrastercontourrenderer.cpp b/src/core/raster/qgsrastercontourrenderer.cpp index bbea2067fc14..786a8a542116 100644 --- a/src/core/raster/qgsrastercontourrenderer.cpp +++ b/src/core/raster/qgsrastercontourrenderer.cpp @@ -145,7 +145,7 @@ QgsRasterBlock *QgsRasterContourRenderer::block( int bandNo, const QgsRectangle { Q_UNUSED( bandNo ) - std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock() ); + auto outputBlock = std::make_unique(); if ( !mInput || !mContourSymbol ) { return outputBlock.release(); diff --git a/src/core/raster/qgsrasterdataprovider.cpp b/src/core/raster/qgsrasterdataprovider.cpp index 4cdc3d136c5e..9cb0fa7616ad 100644 --- a/src/core/raster/qgsrasterdataprovider.cpp +++ b/src/core/raster/qgsrasterdataprovider.cpp @@ -55,7 +55,7 @@ QgsRasterBlock *QgsRasterDataProvider::block( int bandNo, QgsRectangle const &b QgsDebugMsgLevel( QStringLiteral( "bandNo = %1 width = %2 height = %3" ).arg( bandNo ).arg( width ).arg( height ), 4 ); QgsDebugMsgLevel( QStringLiteral( "boundingBox = %1" ).arg( boundingBox.toString() ), 4 ); - std::unique_ptr< QgsRasterBlock > block = std::make_unique< QgsRasterBlock >( dataType( bandNo ), width, height ); + auto block = std::make_unique< QgsRasterBlock >( dataType( bandNo ), width, height ); if ( sourceHasNoDataValue( bandNo ) && useSourceNoDataValue( bandNo ) ) { block->setNoDataValue( sourceNoDataValue( bandNo ) ); @@ -154,7 +154,7 @@ QgsRasterBlock *QgsRasterDataProvider::block( int bandNo, QgsRectangle const &b QgsDebugMsgLevel( QStringLiteral( "Reading smaller block tmpWidth = %1 height = %2" ).arg( tmpWidth ).arg( tmpHeight ), 4 ); QgsDebugMsgLevel( QStringLiteral( "tmpExtent = %1" ).arg( tmpExtent.toString() ), 4 ); - std::unique_ptr< QgsRasterBlock > tmpBlock = std::make_unique< QgsRasterBlock >( dataType( bandNo ), tmpWidth, tmpHeight ); + auto tmpBlock = std::make_unique< QgsRasterBlock >( dataType( bandNo ), tmpWidth, tmpHeight ); if ( sourceHasNoDataValue( bandNo ) && useSourceNoDataValue( bandNo ) ) { tmpBlock->setNoDataValue( sourceNoDataValue( bandNo ) ); @@ -774,7 +774,7 @@ bool QgsRasterDataProvider::readFileBasedAttributeTable( int bandNumber, const Q { QGIS_PROTECT_QOBJECT_THREAD_ACCESS - std::unique_ptr rat = std::make_unique(); + auto rat = std::make_unique(); if ( rat->readFromFile( path, errorMessage ) ) { setAttributeTable( bandNumber, rat.release() ); diff --git a/src/core/raster/qgsrasterlabeling.cpp b/src/core/raster/qgsrasterlabeling.cpp index f00887b111d8..527e48a150b6 100644 --- a/src/core/raster/qgsrasterlabeling.cpp +++ b/src/core/raster/qgsrasterlabeling.cpp @@ -65,10 +65,10 @@ void QgsRasterLayerLabelProvider::addLabel( const QgsPoint &mapPoint, const QStr } const double uPP = m2p.mapUnitsPerPixel(); - std::unique_ptr< QgsTextLabelFeature > feature = std::make_unique< QgsTextLabelFeature >( mLabels.size(), - QgsGeos::asGeos( &geom ), - QSizeF( size.width() * uPP, - size.height() * uPP ) ); + auto feature = std::make_unique< QgsTextLabelFeature >( mLabels.size(), + QgsGeos::asGeos( &geom ), + QSizeF( size.width() * uPP, + size.height() * uPP ) ); feature->setDocument( doc, documentMetrics ); feature->setFixedAngle( 0 ); @@ -368,7 +368,7 @@ QString QgsRasterLayerSimpleLabeling::type() const QgsRasterLayerSimpleLabeling *QgsRasterLayerSimpleLabeling::clone() const { - std::unique_ptr< QgsRasterLayerSimpleLabeling > res = std::make_unique< QgsRasterLayerSimpleLabeling >(); + auto res = std::make_unique< QgsRasterLayerSimpleLabeling >(); res->setTextFormat( mTextFormat ); if ( mNumericFormat ) @@ -390,7 +390,7 @@ QgsRasterLayerSimpleLabeling *QgsRasterLayerSimpleLabeling::clone() const std::unique_ptr< QgsRasterLayerLabelProvider > QgsRasterLayerSimpleLabeling::provider( QgsRasterLayer *layer ) const { - std::unique_ptr< QgsRasterLayerLabelProvider > res = std::make_unique< QgsRasterLayerLabelProvider >( layer ); + auto res = std::make_unique< QgsRasterLayerLabelProvider >( layer ); res->setTextFormat( mTextFormat ); res->setBand( mBandNumber ); res->setPriority( mPriority ); @@ -474,7 +474,7 @@ bool QgsRasterLayerSimpleLabeling::requiresAdvancedEffects() const QgsRasterLayerSimpleLabeling *QgsRasterLayerSimpleLabeling::create( const QDomElement &element, const QgsReadWriteContext &context ) { - std::unique_ptr< QgsRasterLayerSimpleLabeling > res = std::make_unique< QgsRasterLayerSimpleLabeling >(); + auto res = std::make_unique< QgsRasterLayerSimpleLabeling >(); res->setBand( element.attribute( QStringLiteral( "band" ), QStringLiteral( "1" ) ).toInt() ); res->setPriority( element.attribute( QStringLiteral( "priority" ), QStringLiteral( "0.5" ) ).toDouble() ); res->setZIndex( element.attribute( QStringLiteral( "zIndex" ), QStringLiteral( "0" ) ).toDouble() ); @@ -612,7 +612,7 @@ void QgsRasterLayerSimpleLabeling::multiplyOpacity( double opacityFactor ) QgsAbstractRasterLayerLabeling *QgsAbstractRasterLayerLabeling::defaultLabelingForLayer( QgsRasterLayer *layer ) { - std::unique_ptr< QgsRasterLayerSimpleLabeling > res = std::make_unique< QgsRasterLayerSimpleLabeling >(); + auto res = std::make_unique< QgsRasterLayerSimpleLabeling >(); res->setTextFormat( QgsStyle::defaultTextFormatForProject( layer->project() ) ); res->setBand( 1 ); return res.release(); diff --git a/src/core/raster/qgsrasterlayer.cpp b/src/core/raster/qgsrasterlayer.cpp index ed2f42383cb7..05d62ab54e98 100644 --- a/src/core/raster/qgsrasterlayer.cpp +++ b/src/core/raster/qgsrasterlayer.cpp @@ -172,7 +172,7 @@ QgsRasterLayer *QgsRasterLayer::clone() const { options.transformContext = mDataProvider->transformContext(); } - std::unique_ptr< QgsRasterLayer > layer = std::make_unique< QgsRasterLayer >( source(), name(), mProviderKey, options ); + auto layer = std::make_unique< QgsRasterLayer >( source(), name(), mProviderKey, options ); QgsMapLayer::clone( layer.get() ); layer->mElevationProperties = mElevationProperties->clone(); layer->mElevationProperties->setParent( layer.get() ); @@ -858,7 +858,7 @@ void QgsRasterLayer::setDataProvider( QString const &provider, const QgsDataProv QgsDebugMsgLevel( "Native Raster Raster Attribute Table read failed " + errorMessage, 2 ); if ( QFile::exists( mDataProvider->dataSourceUri( ) + ".vat.dbf" ) ) { - std::unique_ptr rat = std::make_unique(); + auto rat = std::make_unique(); hasRat = rat->readFromFile( mDataProvider->dataSourceUri( ) + ".vat.dbf", &errorMessage ); if ( hasRat ) { @@ -1192,7 +1192,7 @@ void QgsRasterLayer::readRasterAttributeTableExternalPaths( const QDomNode &laye continue; } - std::unique_ptr rat = std::make_unique(); + auto rat = std::make_unique(); QString errorMessage; if ( ! rat->readFromFile( path, &errorMessage ) ) { @@ -1419,7 +1419,7 @@ void QgsRasterLayer::setContrastEnhancement( QgsContrastEnhancement::ContrastEnh if ( myBand != -1 ) { const Qgis::DataType myType = static_cast< Qgis::DataType >( mDataProvider->dataType( myBand ) ); - std::unique_ptr myEnhancement( new QgsContrastEnhancement( static_cast< Qgis::DataType >( myType ) ) ); + auto myEnhancement = std::make_unique( static_cast< Qgis::DataType >( myType ) ); myEnhancement->setContrastEnhancementAlgorithm( algorithm, generateLookupTableFlag ); double min; diff --git a/src/core/raster/qgsrasterlayerelevationproperties.cpp b/src/core/raster/qgsrasterlayerelevationproperties.cpp index f1053a1f1c9a..acb406f9dd55 100644 --- a/src/core/raster/qgsrasterlayerelevationproperties.cpp +++ b/src/core/raster/qgsrasterlayerelevationproperties.cpp @@ -167,7 +167,7 @@ bool QgsRasterLayerElevationProperties::readXml( const QDomElement &element, con QgsRasterLayerElevationProperties *QgsRasterLayerElevationProperties::clone() const { - std::unique_ptr< QgsRasterLayerElevationProperties > res = std::make_unique< QgsRasterLayerElevationProperties >( nullptr ); + auto res = std::make_unique< QgsRasterLayerElevationProperties >( nullptr ); res->setEnabled( mEnabled ); res->setMode( mMode ); res->setProfileLineSymbol( mProfileLineSymbol->clone() ); @@ -754,13 +754,13 @@ bool QgsRasterLayerElevationProperties::layerLooksLikeDem( QgsRasterLayer *layer void QgsRasterLayerElevationProperties::setDefaultProfileLineSymbol( const QColor &color ) { - std::unique_ptr< QgsSimpleLineSymbolLayer > profileLineLayer = std::make_unique< QgsSimpleLineSymbolLayer >( color, 0.6 ); + auto profileLineLayer = std::make_unique< QgsSimpleLineSymbolLayer >( color, 0.6 ); mProfileLineSymbol = std::make_unique< QgsLineSymbol>( QgsSymbolLayerList( { profileLineLayer.release() } ) ); } void QgsRasterLayerElevationProperties::setDefaultProfileFillSymbol( const QColor &color ) { - std::unique_ptr< QgsSimpleFillSymbolLayer > profileFillLayer = std::make_unique< QgsSimpleFillSymbolLayer >( color ); + auto profileFillLayer = std::make_unique< QgsSimpleFillSymbolLayer >( color ); profileFillLayer->setStrokeStyle( Qt::NoPen ); mProfileFillSymbol = std::make_unique< QgsFillSymbol>( QgsSymbolLayerList( { profileFillLayer.release() } ) ); } diff --git a/src/core/raster/qgsrasternuller.cpp b/src/core/raster/qgsrasternuller.cpp index 65580ddb8f67..ac61c261c093 100644 --- a/src/core/raster/qgsrasternuller.cpp +++ b/src/core/raster/qgsrasternuller.cpp @@ -85,7 +85,7 @@ QgsRasterBlock *QgsRasterNuller::block( int bandNo, QgsRectangle const &extent, return inputBlock.release(); } - std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock( inputBlock->dataType(), width, height ) ); + auto outputBlock = std::make_unique( inputBlock->dataType(), width, height ); if ( mHasOutputNoData.value( bandNo - 1 ) || inputBlock->hasNoDataValue() ) { double noDataValue; diff --git a/src/core/raster/qgsrasterprojector.cpp b/src/core/raster/qgsrasterprojector.cpp index 75c48aefd4a3..d0426f3f9e6b 100644 --- a/src/core/raster/qgsrasterprojector.cpp +++ b/src/core/raster/qgsrasterprojector.cpp @@ -855,7 +855,7 @@ QgsRasterBlock *QgsRasterProjector::block( int bandNo, QgsRectangle const &exte const qgssize pixelSize = static_cast( QgsRasterBlock::typeSize( mInput->dataType( bandNo ) ) ); - std::unique_ptr< QgsRasterBlock > outputBlock = std::make_unique< QgsRasterBlock >( input->dataType(), width, height ); + auto outputBlock = std::make_unique< QgsRasterBlock >( input->dataType(), width, height ); QgsRasterBlock *output = outputBlock.get(); if ( input->hasNoDataValue() ) diff --git a/src/core/raster/qgsrasterrendererregistry.cpp b/src/core/raster/qgsrasterrendererregistry.cpp index b905caccf6ea..e410a3b33100 100644 --- a/src/core/raster/qgsrasterrendererregistry.cpp +++ b/src/core/raster/qgsrasterrendererregistry.cpp @@ -250,7 +250,7 @@ QgsRasterRenderer *QgsRasterRendererRegistry::defaultRendererForDrawingStyle( Qg return nullptr; } - std::unique_ptr< QgsRasterTransparency > tr = std::make_unique< QgsRasterTransparency >(); + auto tr = std::make_unique< QgsRasterTransparency >(); const int bandCount = renderer->usesBands().size(); if ( bandCount == 1 ) { diff --git a/src/core/raster/qgsrasterresamplefilter.cpp b/src/core/raster/qgsrasterresamplefilter.cpp index 72a10578d63c..7991d8cce122 100644 --- a/src/core/raster/qgsrasterresamplefilter.cpp +++ b/src/core/raster/qgsrasterresamplefilter.cpp @@ -123,7 +123,7 @@ QgsRasterBlock *QgsRasterResampleFilter::block( int bandNo, QgsRectangle const const int bandNumber = 1; QgsDebugMsgLevel( QStringLiteral( "width = %1 height = %2 extent = %3" ).arg( width ).arg( height ).arg( extent.toString() ), 4 ); - std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock() ); + auto outputBlock = std::make_unique(); if ( !mInput ) return outputBlock.release(); diff --git a/src/core/raster/qgsrastersinglecolorrenderer.cpp b/src/core/raster/qgsrastersinglecolorrenderer.cpp index bf2f6414c3cb..433d1478393d 100644 --- a/src/core/raster/qgsrastersinglecolorrenderer.cpp +++ b/src/core/raster/qgsrastersinglecolorrenderer.cpp @@ -60,7 +60,7 @@ QgsRasterBlock *QgsRasterSingleColorRenderer::block( int, const QgsRectangle &ex { QgsDebugMsgLevel( QStringLiteral( "width = %1 height = %2" ).arg( width ).arg( height ), 4 ); - std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock() ); + auto outputBlock = std::make_unique(); if ( !mInput || mInputBand == -1 ) { return outputBlock.release(); diff --git a/src/core/raster/qgssinglebandcolordatarenderer.cpp b/src/core/raster/qgssinglebandcolordatarenderer.cpp index e9ed71cfa46a..a23e9936b74a 100644 --- a/src/core/raster/qgssinglebandcolordatarenderer.cpp +++ b/src/core/raster/qgssinglebandcolordatarenderer.cpp @@ -59,7 +59,7 @@ QgsRasterBlock *QgsSingleBandColorDataRenderer::block( int bandNo, QgsRectangle { Q_UNUSED( bandNo ) - std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock() ); + auto outputBlock = std::make_unique(); if ( !mInput ) { return outputBlock.release(); diff --git a/src/core/raster/qgssinglebandgrayrenderer.cpp b/src/core/raster/qgssinglebandgrayrenderer.cpp index 3e1a78b787ae..54b17d14d66c 100644 --- a/src/core/raster/qgssinglebandgrayrenderer.cpp +++ b/src/core/raster/qgssinglebandgrayrenderer.cpp @@ -82,7 +82,7 @@ QgsRasterRenderer *QgsSingleBandGrayRenderer::create( const QDomElement &elem, Q r->setContrastEnhancement( ce ); } - std::unique_ptr< QgsColorRampLegendNodeSettings > legendSettings = std::make_unique< QgsColorRampLegendNodeSettings >(); + auto legendSettings = std::make_unique< QgsColorRampLegendNodeSettings >(); legendSettings->readXml( elem, QgsReadWriteContext() ); r->setLegendSettings( legendSettings.release() ); @@ -99,7 +99,7 @@ QgsRasterBlock *QgsSingleBandGrayRenderer::block( int bandNo, const QgsRectangle Q_UNUSED( bandNo ) QgsDebugMsgLevel( QStringLiteral( "width = %1 height = %2" ).arg( width ).arg( height ), 4 ); - std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock() ); + auto outputBlock = std::make_unique(); if ( !mInput ) { return outputBlock.release(); diff --git a/src/core/raster/qgssinglebandpseudocolorrenderer.cpp b/src/core/raster/qgssinglebandpseudocolorrenderer.cpp index e203fd2aa034..13ce0da1f5f7 100644 --- a/src/core/raster/qgssinglebandpseudocolorrenderer.cpp +++ b/src/core/raster/qgssinglebandpseudocolorrenderer.cpp @@ -210,7 +210,7 @@ QgsRasterBlock *QgsSingleBandPseudoColorRenderer::block( int bandNo, QgsRectangl { Q_UNUSED( bandNo ) - std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock() ); + auto outputBlock = std::make_unique(); if ( !mInput || !mShader || !mShader->rasterShaderFunction() ) { return outputBlock.release(); diff --git a/src/core/scalebar/qgsdoubleboxscalebarrenderer.cpp b/src/core/scalebar/qgsdoubleboxscalebarrenderer.cpp index 2cb16231e9f4..9ef6484f527f 100644 --- a/src/core/scalebar/qgsdoubleboxscalebarrenderer.cpp +++ b/src/core/scalebar/qgsdoubleboxscalebarrenderer.cpp @@ -20,6 +20,7 @@ #include "qgstextrenderer.h" #include "qgslinesymbol.h" #include "qgsfillsymbol.h" +#include "qgsfillsymbollayer.h" #include #include @@ -190,3 +191,29 @@ void QgsDoubleBoxScaleBarRenderer::draw( QgsRenderContext &context, const QgsSca //draw labels using the default method drawDefaultLabels( context, settings, scaleContext ); } + +bool QgsDoubleBoxScaleBarRenderer::applyDefaultSettings( QgsScaleBarSettings &settings ) const +{ + QgsSimpleFillSymbolLayer *fill = dynamic_cast< QgsSimpleFillSymbolLayer * >( settings.fillSymbol()->symbolLayers().at( 0 ) ); + + // restore the fill symbols by default + if ( fill && fill->brushStyle() == Qt::NoBrush ) + { + auto fillSymbol = std::make_unique< QgsFillSymbol >(); + auto fillSymbolLayer = std::make_unique< QgsSimpleFillSymbolLayer >(); + fillSymbolLayer->setColor( QColor( 0, 0, 0 ) ); + fillSymbolLayer->setBrushStyle( Qt::SolidPattern ); + fillSymbolLayer->setStrokeStyle( Qt::SolidLine ); + fillSymbol->changeSymbolLayer( 0, fillSymbolLayer.release() ); + settings.setFillSymbol( fillSymbol.release() ); + + fillSymbol = std::make_unique< QgsFillSymbol >(); + fillSymbolLayer = std::make_unique< QgsSimpleFillSymbolLayer >(); + fillSymbolLayer->setColor( QColor( 255, 255, 255 ) ); + fillSymbolLayer->setStrokeStyle( Qt::NoPen ); + fillSymbol->changeSymbolLayer( 0, fillSymbolLayer.release() ); + settings.setAlternateFillSymbol( fillSymbol.release() ); + } + + return true; +} diff --git a/src/core/scalebar/qgsdoubleboxscalebarrenderer.h b/src/core/scalebar/qgsdoubleboxscalebarrenderer.h index 08c96101d91e..a3b9b8b844d9 100644 --- a/src/core/scalebar/qgsdoubleboxscalebarrenderer.h +++ b/src/core/scalebar/qgsdoubleboxscalebarrenderer.h @@ -42,6 +42,7 @@ class CORE_EXPORT QgsDoubleBoxScaleBarRenderer: public QgsScaleBarRenderer const QgsScaleBarSettings &settings, const QgsScaleBarRenderer::ScaleBarContext &scaleContext ) const override; + bool applyDefaultSettings( QgsScaleBarSettings &settings ) const override; }; #endif // QGSDOUBLEBOXSCALEBARRENDERER_H diff --git a/src/core/scalebar/qgshollowscalebarrenderer.cpp b/src/core/scalebar/qgshollowscalebarrenderer.cpp index 7302b5adeced..31459f155934 100644 --- a/src/core/scalebar/qgshollowscalebarrenderer.cpp +++ b/src/core/scalebar/qgshollowscalebarrenderer.cpp @@ -178,8 +178,8 @@ void QgsHollowScaleBarRenderer::draw( QgsRenderContext &context, const QgsScaleB bool QgsHollowScaleBarRenderer::applyDefaultSettings( QgsScaleBarSettings &settings ) const { // null the fill symbols by default - std::unique_ptr< QgsFillSymbol > fillSymbol = std::make_unique< QgsFillSymbol >(); - std::unique_ptr< QgsSimpleFillSymbolLayer > fillSymbolLayer = std::make_unique< QgsSimpleFillSymbolLayer >(); + auto fillSymbol = std::make_unique< QgsFillSymbol >(); + auto fillSymbolLayer = std::make_unique< QgsSimpleFillSymbolLayer >(); fillSymbolLayer->setColor( QColor( 0, 0, 0 ) ); fillSymbolLayer->setBrushStyle( Qt::NoBrush ); fillSymbolLayer->setStrokeStyle( Qt::NoPen ); @@ -193,6 +193,3 @@ bool QgsHollowScaleBarRenderer::applyDefaultSettings( QgsScaleBarSettings &setti return true; } - - - diff --git a/src/core/scalebar/qgshollowscalebarrenderer.h b/src/core/scalebar/qgshollowscalebarrenderer.h index aa00455120ca..aa30e3601f5d 100644 --- a/src/core/scalebar/qgshollowscalebarrenderer.h +++ b/src/core/scalebar/qgshollowscalebarrenderer.h @@ -44,7 +44,6 @@ class CORE_EXPORT QgsHollowScaleBarRenderer: public QgsScaleBarRenderer const QgsScaleBarSettings &settings, const QgsScaleBarRenderer::ScaleBarContext &scaleContext ) const override; bool applyDefaultSettings( QgsScaleBarSettings &settings ) const override; - }; #endif // QGSHOLLOWSCALEBARRENDERER_H diff --git a/src/core/scalebar/qgssingleboxscalebarrenderer.cpp b/src/core/scalebar/qgssingleboxscalebarrenderer.cpp index 63175bd4ed16..a9145920fae7 100644 --- a/src/core/scalebar/qgssingleboxscalebarrenderer.cpp +++ b/src/core/scalebar/qgssingleboxscalebarrenderer.cpp @@ -20,6 +20,7 @@ #include "qgstextrenderer.h" #include "qgslinesymbol.h" #include "qgsfillsymbol.h" +#include "qgsfillsymbollayer.h" #include #include @@ -157,5 +158,28 @@ void QgsSingleBoxScaleBarRenderer::draw( QgsRenderContext &context, const QgsSca drawDefaultLabels( context, settings, scaleContext ); } +bool QgsSingleBoxScaleBarRenderer::applyDefaultSettings( QgsScaleBarSettings &settings ) const +{ + QgsSimpleFillSymbolLayer *fill = dynamic_cast< QgsSimpleFillSymbolLayer * >( settings.fillSymbol()->symbolLayers().at( 0 ) ); + // restore the fill symbols by default + if ( fill && fill->brushStyle() == Qt::NoBrush ) + { + auto fillSymbol = std::make_unique< QgsFillSymbol >(); + auto fillSymbolLayer = std::make_unique< QgsSimpleFillSymbolLayer >(); + fillSymbolLayer->setColor( QColor( 0, 0, 0 ) ); + fillSymbolLayer->setBrushStyle( Qt::SolidPattern ); + fillSymbolLayer->setStrokeStyle( Qt::SolidLine ); + fillSymbol->changeSymbolLayer( 0, fillSymbolLayer.release() ); + settings.setFillSymbol( fillSymbol.release() ); + + fillSymbol = std::make_unique< QgsFillSymbol >(); + fillSymbolLayer = std::make_unique< QgsSimpleFillSymbolLayer >(); + fillSymbolLayer->setColor( QColor( 255, 255, 255 ) ); + fillSymbolLayer->setStrokeStyle( Qt::NoPen ); + fillSymbol->changeSymbolLayer( 0, fillSymbolLayer.release() ); + settings.setAlternateFillSymbol( fillSymbol.release() ); + } + return true; +} diff --git a/src/core/scalebar/qgssingleboxscalebarrenderer.h b/src/core/scalebar/qgssingleboxscalebarrenderer.h index 5404cd142496..ca99eb18e173 100644 --- a/src/core/scalebar/qgssingleboxscalebarrenderer.h +++ b/src/core/scalebar/qgssingleboxscalebarrenderer.h @@ -43,6 +43,7 @@ class CORE_EXPORT QgsSingleBoxScaleBarRenderer: public QgsScaleBarRenderer const QgsScaleBarSettings &settings, const QgsScaleBarRenderer::ScaleBarContext &scaleContext ) const override; + bool applyDefaultSettings( QgsScaleBarSettings &settings ) const override; }; #endif // QGSSINGLEBOXSCALEBARRENDERER_H diff --git a/src/core/settings/qgssettingstree.h b/src/core/settings/qgssettingstree.h index b7b52788c4cd..97165d88eead 100644 --- a/src/core/settings/qgssettingstree.h +++ b/src/core/settings/qgssettingstree.h @@ -66,6 +66,7 @@ class CORE_EXPORT QgsSettingsTree static inline QgsSettingsTreeNode *sTreeNetworkCache = treeRoot()->createChildNode( QStringLiteral( "cache" ) ); static inline QgsSettingsTreeNode *sTreeAttributeTable = treeRoot()->createChildNode( QStringLiteral( "attribute-table" ) ); static inline QgsSettingsTreeNode *sTreeWindowState = sTreeGui->createChildNode( QStringLiteral( "window-state" ) ); + static inline QgsSettingsTreeNode *sTreeAuthentication = treeRoot()->createChildNode( QStringLiteral( "authentication" ) ); #endif diff --git a/src/core/stac/qgsstaccontroller.cpp b/src/core/stac/qgsstaccontroller.cpp index ef5bbd5a6c9a..df8d9ce72559 100644 --- a/src/core/stac/qgsstaccontroller.cpp +++ b/src/core/stac/qgsstaccontroller.cpp @@ -109,7 +109,10 @@ void QgsStacController::handleStacObjectReply() if ( reply->error() != QNetworkReply::NoError ) { - emit finishedStacObjectRequest( requestId, reply->errorString() ); + const QString contentType = reply->header( QNetworkRequest::ContentTypeHeader ).toString(); + const QString errorMessage = contentType.startsWith( QLatin1String( "text/plain" ) ) ? reply->readAll() : reply->errorString(); + + emit finishedStacObjectRequest( requestId, errorMessage ); reply->deleteLater(); mReplies.removeOne( reply ); return; @@ -155,7 +158,10 @@ void QgsStacController::handleItemCollectionReply() if ( reply->error() != QNetworkReply::NoError ) { - emit finishedItemCollectionRequest( requestId, reply->errorString() ); + const QString contentType = reply->header( QNetworkRequest::ContentTypeHeader ).toString(); + const QString errorMessage = contentType.startsWith( QLatin1String( "text/plain" ) ) ? reply->readAll() : reply->errorString(); + + emit finishedItemCollectionRequest( requestId, errorMessage ); reply->deleteLater(); mReplies.removeOne( reply ); return; @@ -184,7 +190,10 @@ void QgsStacController::handleCollectionsReply() if ( reply->error() != QNetworkReply::NoError ) { - emit finishedCollectionsRequest( requestId, reply->errorString() ); + const QString contentType = reply->header( QNetworkRequest::ContentTypeHeader ).toString(); + const QString errorMessage = contentType.startsWith( QLatin1String( "text/plain" ) ) ? reply->readAll() : reply->errorString(); + + emit finishedCollectionsRequest( requestId, errorMessage ); reply->deleteLater(); mReplies.removeOne( reply ); return; diff --git a/src/core/stac/qgsstacparser.cpp b/src/core/stac/qgsstacparser.cpp index f44510cdb68c..2e7ad657e5db 100644 --- a/src/core/stac/qgsstacparser.cpp +++ b/src/core/stac/qgsstacparser.cpp @@ -104,10 +104,10 @@ QgsStacCatalog *QgsStacParser::parseCatalog( const nlohmann::json &data ) QVector< QgsStacLink > links = parseLinks( data.at( "links" ) ); - std::unique_ptr< QgsStacCatalog > catalog = std::make_unique< QgsStacCatalog >( id, - ver, - description, - links ); + auto catalog = std::make_unique< QgsStacCatalog >( id, + ver, + description, + links ); if ( data.contains( "title" ) ) catalog->setTitle( getString( data["title"] ) ); @@ -218,12 +218,12 @@ QgsStacCollection *QgsStacParser::parseCollection( const nlohmann::json &data ) QVector< QgsStacLink > links = parseLinks( data.at( "links" ) ); - std::unique_ptr< QgsStacCollection > collection = std::make_unique< QgsStacCollection >( id, - ver, - description, - links, - license, - stacExtent ); + auto collection = std::make_unique< QgsStacCollection >( id, + ver, + description, + links, + license, + stacExtent ); if ( data.contains( "title" ) ) collection->setTitle( getString( data["title"] ) ); @@ -371,13 +371,13 @@ QgsStacItem *QgsStacParser::parseItem( const nlohmann::json &data ) QMap< QString, QgsStacAsset > assets = parseAssets( data.at( "assets" ) ); - std::unique_ptr< QgsStacItem > item = std::make_unique< QgsStacItem >( id, - ver, - geom, - properties, - links, - assets, - bbox ); + auto item = std::make_unique< QgsStacItem >( id, + ver, + geom, + properties, + links, + assets, + bbox ); if ( data.contains( "stac_extensions" ) ) { diff --git a/src/core/symbology/qgs25drenderer.cpp b/src/core/symbology/qgs25drenderer.cpp index 0f51d1ece18f..ceb594c2abaf 100644 --- a/src/core/symbology/qgs25drenderer.cpp +++ b/src/core/symbology/qgs25drenderer.cpp @@ -287,7 +287,7 @@ Qgs25DRenderer *Qgs25DRenderer::convertFromRenderer( QgsFeatureRenderer *rendere } else { - std::unique_ptr< Qgs25DRenderer > res = std::make_unique< Qgs25DRenderer >(); + auto res = std::make_unique< Qgs25DRenderer >(); renderer->copyRendererData( res.get() ); return res.release(); } diff --git a/src/core/symbology/qgscategorizedsymbolrenderer.cpp b/src/core/symbology/qgscategorizedsymbolrenderer.cpp index daa303306ad2..65e66f66548d 100644 --- a/src/core/symbology/qgscategorizedsymbolrenderer.cpp +++ b/src/core/symbology/qgscategorizedsymbolrenderer.cpp @@ -1445,7 +1445,10 @@ QgsCategorizedSymbolRenderer *QgsCategorizedSymbolRenderer::convertFromRenderer( QgsSymbolList symbols = const_cast( renderer )->symbols( context ); if ( !symbols.isEmpty() ) { - r->setSourceSymbol( symbols.at( 0 )->clone() ); + QgsSymbol *newSymbol = symbols.at( 0 )->clone(); + QgsSymbolLayerUtils::resetSymbolLayerIds( newSymbol ); + QgsSymbolLayerUtils::clearSymbolLayerMasks( newSymbol ); + r->setSourceSymbol( newSymbol ); } } @@ -1539,6 +1542,7 @@ QgsCategoryList QgsCategorizedSymbolRenderer::createCategories( const QListclone(); + QgsSymbolLayerUtils::resetSymbolLayerIds( newSymbol ); if ( !QgsVariantUtils::isNull( value ) ) { const int fieldIdx = fields.lookupField( attributeName ); @@ -1557,6 +1561,7 @@ QgsCategoryList QgsCategorizedSymbolRenderer::createCategories( const QListclone(); + QgsSymbolLayerUtils::resetSymbolLayerIds( newSymbol ); cats.append( QgsRendererCategory( QVariant(), newSymbol, QString(), true ) ); return cats; diff --git a/src/core/symbology/qgsembeddedsymbolrenderer.cpp b/src/core/symbology/qgsembeddedsymbolrenderer.cpp index 035362dfb936..f430ce66ee40 100644 --- a/src/core/symbology/qgsembeddedsymbolrenderer.cpp +++ b/src/core/symbology/qgsembeddedsymbolrenderer.cpp @@ -124,7 +124,7 @@ QgsEmbeddedSymbolRenderer *QgsEmbeddedSymbolRenderer::convertFromRenderer( const } else if ( renderer->type() == QLatin1String( "singleSymbol" ) ) { - std::unique_ptr< QgsEmbeddedSymbolRenderer > symbolRenderer = std::make_unique< QgsEmbeddedSymbolRenderer >( static_cast< const QgsSingleSymbolRenderer * >( renderer )->symbol()->clone() ); + auto symbolRenderer = std::make_unique< QgsEmbeddedSymbolRenderer >( static_cast< const QgsSingleSymbolRenderer * >( renderer )->symbol()->clone() ); renderer->copyRendererData( symbolRenderer.get() ); return symbolRenderer.release(); } diff --git a/src/core/symbology/qgsfillsymbollayer.cpp b/src/core/symbology/qgsfillsymbollayer.cpp index 1ed02d5385e8..5c8cd805e669 100644 --- a/src/core/symbology/qgsfillsymbollayer.cpp +++ b/src/core/symbology/qgsfillsymbollayer.cpp @@ -225,7 +225,7 @@ QgsSymbolLayer *QgsSimpleFillSymbolLayer::create( const QVariantMap &props ) if ( props.contains( QStringLiteral( "joinstyle" ) ) ) penJoinStyle = QgsSymbolLayerUtils::decodePenJoinStyle( props[QStringLiteral( "joinstyle" )].toString() ); - std::unique_ptr< QgsSimpleFillSymbolLayer > sl = std::make_unique< QgsSimpleFillSymbolLayer >( color, style, strokeColor, strokeStyle, strokeWidth, penJoinStyle ); + auto sl = std::make_unique< QgsSimpleFillSymbolLayer >( color, style, strokeColor, strokeStyle, strokeWidth, penJoinStyle ); sl->setOffset( offset ); if ( props.contains( QStringLiteral( "border_width_unit" ) ) ) { @@ -376,7 +376,7 @@ QVariantMap QgsSimpleFillSymbolLayer::properties() const QgsSimpleFillSymbolLayer *QgsSimpleFillSymbolLayer::clone() const { - std::unique_ptr< QgsSimpleFillSymbolLayer > sl = std::make_unique< QgsSimpleFillSymbolLayer >( mColor, mBrushStyle, mStrokeColor, mStrokeStyle, mStrokeWidth, mPenJoinStyle ); + auto sl = std::make_unique< QgsSimpleFillSymbolLayer >( mColor, mBrushStyle, mStrokeColor, mStrokeStyle, mStrokeWidth, mPenJoinStyle ); sl->setOffset( mOffset ); sl->setOffsetUnit( mOffsetUnit ); sl->setOffsetMapUnitScale( mOffsetMapUnitScale ); @@ -504,7 +504,7 @@ QgsSymbolLayer *QgsSimpleFillSymbolLayer::createFromSld( QDomElement &element ) offset.setY( offset.y() * scaleFactor ); strokeWidth = strokeWidth * scaleFactor; - std::unique_ptr< QgsSimpleFillSymbolLayer > sl = std::make_unique< QgsSimpleFillSymbolLayer >( color, fillStyle, strokeColor, strokeStyle, strokeWidth ); + auto sl = std::make_unique< QgsSimpleFillSymbolLayer >( color, fillStyle, strokeColor, strokeStyle, strokeWidth ); sl->setOutputUnit( sldUnitSize ); sl->setOffset( offset ); return sl.release(); @@ -677,7 +677,7 @@ QgsSymbolLayer *QgsGradientFillSymbolLayer::create( const QVariantMap &props ) } //create a new gradient fill layer with desired properties - std::unique_ptr< QgsGradientFillSymbolLayer > sl = std::make_unique< QgsGradientFillSymbolLayer >( color, color2, colorType, type, coordinateMode, gradientSpread ); + auto sl = std::make_unique< QgsGradientFillSymbolLayer >( color, color2, colorType, type, coordinateMode, gradientSpread ); sl->setOffset( offset ); if ( props.contains( QStringLiteral( "offset_unit" ) ) ) sl->setOffsetUnit( QgsUnitTypes::decodeRenderUnit( props[QStringLiteral( "offset_unit" )].toString() ) ); @@ -1051,7 +1051,7 @@ QVariantMap QgsGradientFillSymbolLayer::properties() const QgsGradientFillSymbolLayer *QgsGradientFillSymbolLayer::clone() const { - std::unique_ptr< QgsGradientFillSymbolLayer > sl = std::make_unique< QgsGradientFillSymbolLayer >( mColor, mColor2, mGradientColorType, mGradientType, mCoordinateMode, mGradientSpread ); + auto sl = std::make_unique< QgsGradientFillSymbolLayer >( mColor, mColor2, mGradientColorType, mGradientType, mCoordinateMode, mGradientSpread ); if ( mGradientRamp ) sl->setColorRamp( mGradientRamp->clone() ); sl->setReferencePoint1( mReferencePoint1 ); @@ -1181,7 +1181,7 @@ QgsSymbolLayer *QgsShapeburstFillSymbolLayer::create( const QVariantMap &props ) } //create a new shapeburst fill layer with desired properties - std::unique_ptr< QgsShapeburstFillSymbolLayer > sl = std::make_unique< QgsShapeburstFillSymbolLayer >( color, color2, colorType, blurRadius, useWholeShape, maxDistance ); + auto sl = std::make_unique< QgsShapeburstFillSymbolLayer >( color, color2, colorType, blurRadius, useWholeShape, maxDistance ); sl->setOffset( offset ); if ( props.contains( QStringLiteral( "offset_unit" ) ) ) { @@ -1375,8 +1375,8 @@ void QgsShapeburstFillSymbolLayer::renderPolygon( const QPolygonF &points, const if ( context.renderContext().feedback() && context.renderContext().feedback()->isCanceled() ) return; - std::unique_ptr< QImage > fillImage = std::make_unique< QImage >( imWidth, - imHeight, QImage::Format_ARGB32_Premultiplied ); + auto fillImage = std::make_unique< QImage >( imWidth, + imHeight, QImage::Format_ARGB32_Premultiplied ); if ( fillImage->isNull() ) { QgsMessageLog::logMessage( QObject::tr( "Could not allocate sufficient memory for shapeburst fill" ) ); @@ -1387,7 +1387,7 @@ void QgsShapeburstFillSymbolLayer::renderPolygon( const QPolygonF &points, const return; //also create an image to store the alpha channel - std::unique_ptr< QImage > alphaImage = std::make_unique< QImage >( fillImage->width(), fillImage->height(), QImage::Format_ARGB32_Premultiplied ); + auto alphaImage = std::make_unique< QImage >( fillImage->width(), fillImage->height(), QImage::Format_ARGB32_Premultiplied ); if ( alphaImage->isNull() ) { QgsMessageLog::logMessage( QObject::tr( "Could not allocate sufficient memory for shapeburst fill" ) ); @@ -1711,7 +1711,7 @@ QVariantMap QgsShapeburstFillSymbolLayer::properties() const QgsShapeburstFillSymbolLayer *QgsShapeburstFillSymbolLayer::clone() const { - std::unique_ptr< QgsShapeburstFillSymbolLayer > sl = std::make_unique< QgsShapeburstFillSymbolLayer >( mColor, mColor2, mColorType, mBlurRadius, mUseWholeShape, mMaxDistance ); + auto sl = std::make_unique< QgsShapeburstFillSymbolLayer >( mColor, mColor2, mColorType, mBlurRadius, mUseWholeShape, mMaxDistance ); if ( mGradientRamp ) { sl->setColorRamp( mGradientRamp->clone() ); @@ -2431,7 +2431,7 @@ QgsSymbolLayer *QgsSVGFillSymbolLayer::createFromSld( QDomElement &element ) angle = d; } - std::unique_ptr< QgsSVGFillSymbolLayer > sl = std::make_unique< QgsSVGFillSymbolLayer >( path, size, angle ); + auto sl = std::make_unique< QgsSVGFillSymbolLayer >( path, size, angle ); sl->setOutputUnit( sldUnitSize ); sl->setSvgFillColor( fillColor ); sl->setSvgStrokeColor( strokeColor ); @@ -2763,7 +2763,7 @@ QgsMapUnitScale QgsLinePatternFillSymbolLayer::mapUnitScale() const QgsSymbolLayer *QgsLinePatternFillSymbolLayer::create( const QVariantMap &properties ) { - std::unique_ptr< QgsLinePatternFillSymbolLayer > patternLayer = std::make_unique< QgsLinePatternFillSymbolLayer >(); + auto patternLayer = std::make_unique< QgsLinePatternFillSymbolLayer >(); //default values double lineAngle = 45; @@ -3589,7 +3589,7 @@ QgsSymbolLayer *QgsLinePatternFillSymbolLayer::createFromSld( QDomElement &eleme size = size * scaleFactor; lineWidth = lineWidth * scaleFactor; - std::unique_ptr< QgsLinePatternFillSymbolLayer > sl = std::make_unique< QgsLinePatternFillSymbolLayer >(); + auto sl = std::make_unique< QgsLinePatternFillSymbolLayer >(); sl->setOutputUnit( sldUnitSize ); sl->setColor( lineColor ); sl->setLineWidth( lineWidth ); @@ -3710,7 +3710,7 @@ QgsMapUnitScale QgsPointPatternFillSymbolLayer::mapUnitScale() const QgsSymbolLayer *QgsPointPatternFillSymbolLayer::create( const QVariantMap &properties ) { - std::unique_ptr< QgsPointPatternFillSymbolLayer > layer = std::make_unique< QgsPointPatternFillSymbolLayer >(); + auto layer = std::make_unique< QgsPointPatternFillSymbolLayer >(); if ( properties.contains( QStringLiteral( "distance_x" ) ) ) { layer->setDistanceX( properties[QStringLiteral( "distance_x" )].toDouble() ); @@ -4544,12 +4544,12 @@ QgsSymbolLayer *QgsPointPatternFillSymbolLayer::createFromSld( QDomElement &elem QgsSymbolLayerList layers; layers.append( simpleMarkerSl ); - std::unique_ptr< QgsMarkerSymbol > marker = std::make_unique< QgsMarkerSymbol >( layers ); + auto marker = std::make_unique< QgsMarkerSymbol >( layers ); // Converts from GeoServer "graphic-margin": symbol size must be added and margin doubled const double markerSize { marker->size() }; - std::unique_ptr< QgsPointPatternFillSymbolLayer > pointPatternFillSl = std::make_unique< QgsPointPatternFillSymbolLayer >(); + auto pointPatternFillSl = std::make_unique< QgsPointPatternFillSymbolLayer >(); pointPatternFillSl->setSubSymbol( marker.release() ); // This may not be correct in all cases, TODO: check "uom" pointPatternFillSl->setDistanceXUnit( Qgis::RenderUnit::Pixels ); @@ -4784,7 +4784,7 @@ QgsCentroidFillSymbolLayer::~QgsCentroidFillSymbolLayer() = default; QgsSymbolLayer *QgsCentroidFillSymbolLayer::create( const QVariantMap &properties ) { - std::unique_ptr< QgsCentroidFillSymbolLayer > sl = std::make_unique< QgsCentroidFillSymbolLayer >(); + auto sl = std::make_unique< QgsCentroidFillSymbolLayer >(); if ( properties.contains( QStringLiteral( "point_on_surface" ) ) ) sl->setPointOnSurface( properties[QStringLiteral( "point_on_surface" )].toInt() != 0 ); @@ -4977,7 +4977,7 @@ QVariantMap QgsCentroidFillSymbolLayer::properties() const QgsCentroidFillSymbolLayer *QgsCentroidFillSymbolLayer::clone() const { - std::unique_ptr< QgsCentroidFillSymbolLayer > x = std::make_unique< QgsCentroidFillSymbolLayer >(); + auto x = std::make_unique< QgsCentroidFillSymbolLayer >(); x->mAngle = mAngle; x->mColor = mColor; x->setSubSymbol( mMarker->clone() ); @@ -5006,9 +5006,9 @@ QgsSymbolLayer *QgsCentroidFillSymbolLayer::createFromSld( QDomElement &element QgsSymbolLayerList layers; layers.append( l ); - std::unique_ptr< QgsMarkerSymbol > marker( new QgsMarkerSymbol( layers ) ); + auto marker = std::make_unique( layers ); - std::unique_ptr< QgsCentroidFillSymbolLayer > sl = std::make_unique< QgsCentroidFillSymbolLayer >(); + auto sl = std::make_unique< QgsCentroidFillSymbolLayer >(); sl->setSubSymbol( marker.release() ); sl->setPointOnAllParts( false ); return sl.release(); @@ -5146,7 +5146,7 @@ QgsSymbolLayer *QgsRasterFillSymbolLayer::create( const QVariantMap &properties { width = properties[QStringLiteral( "width" )].toDouble(); } - std::unique_ptr< QgsRasterFillSymbolLayer > symbolLayer = std::make_unique< QgsRasterFillSymbolLayer >( imagePath ); + auto symbolLayer = std::make_unique< QgsRasterFillSymbolLayer >( imagePath ); symbolLayer->setCoordinateMode( mode ); symbolLayer->setOpacity( alpha ); symbolLayer->setOffset( offset ); @@ -5206,7 +5206,7 @@ QgsSymbolLayer *QgsRasterFillSymbolLayer::createFromSld( QDomElement &element ) path = QgsProject::instance()->pathResolver().readPath( path ); // skip-keyword-check } - std::unique_ptr< QgsRasterFillSymbolLayer> sl = std::make_unique< QgsRasterFillSymbolLayer>( path ); + auto sl = std::make_unique< QgsRasterFillSymbolLayer>( path ); return sl.release(); } @@ -5308,7 +5308,7 @@ QVariantMap QgsRasterFillSymbolLayer::properties() const QgsRasterFillSymbolLayer *QgsRasterFillSymbolLayer::clone() const { - std::unique_ptr< QgsRasterFillSymbolLayer > sl = std::make_unique< QgsRasterFillSymbolLayer >( mImageFilePath ); + auto sl = std::make_unique< QgsRasterFillSymbolLayer >( mImageFilePath ); sl->setCoordinateMode( mCoordinateMode ); sl->setOpacity( mOpacity ); sl->setOffset( mOffset ); @@ -5542,7 +5542,7 @@ QgsSymbolLayer *QgsRandomMarkerFillSymbolLayer::create( const QVariantMap &prope seed = uniformDist( mt ); } - std::unique_ptr< QgsRandomMarkerFillSymbolLayer > sl = std::make_unique< QgsRandomMarkerFillSymbolLayer >( pointCount, countMethod, densityArea, seed ); + auto sl = std::make_unique< QgsRandomMarkerFillSymbolLayer >( pointCount, countMethod, densityArea, seed ); if ( properties.contains( QStringLiteral( "density_area_unit" ) ) ) sl->setDensityAreaUnit( QgsUnitTypes::decodeRenderUnit( properties[QStringLiteral( "density_area_unit" )].toString() ) ); @@ -5739,7 +5739,7 @@ QVariantMap QgsRandomMarkerFillSymbolLayer::properties() const QgsRandomMarkerFillSymbolLayer *QgsRandomMarkerFillSymbolLayer::clone() const { - std::unique_ptr< QgsRandomMarkerFillSymbolLayer > res = std::make_unique< QgsRandomMarkerFillSymbolLayer >( mPointCount, mCountMethod, mDensityArea, mSeed ); + auto res = std::make_unique< QgsRandomMarkerFillSymbolLayer >( mPointCount, mCountMethod, mDensityArea, mSeed ); res->mAngle = mAngle; res->mColor = mColor; res->setDensityAreaUnit( mDensityAreaUnit ); diff --git a/src/core/symbology/qgsgeometrygeneratorsymbollayer.cpp b/src/core/symbology/qgsgeometrygeneratorsymbollayer.cpp index 6f93c0fac265..a5728ee2bf60 100644 --- a/src/core/symbology/qgsgeometrygeneratorsymbollayer.cpp +++ b/src/core/symbology/qgsgeometrygeneratorsymbollayer.cpp @@ -416,7 +416,7 @@ void QgsGeometryGeneratorSymbolLayer::render( QgsSymbolRenderContext &context, Q case Qgis::GeometryType::Polygon: { std::unique_ptr < QgsLineString > exterior( QgsLineString::fromQPolygonF( *points ) ); - std::unique_ptr< QgsPolygon > polygon = std::make_unique< QgsPolygon >(); + auto polygon = std::make_unique< QgsPolygon >(); polygon->setExteriorRing( exterior.release() ); if ( rings ) { diff --git a/src/core/symbology/qgsgraduatedsymbolrenderer.cpp b/src/core/symbology/qgsgraduatedsymbolrenderer.cpp index 45af09db707a..ae54d81ddfe5 100644 --- a/src/core/symbology/qgsgraduatedsymbolrenderer.cpp +++ b/src/core/symbology/qgsgraduatedsymbolrenderer.cpp @@ -412,7 +412,7 @@ QgsGraduatedSymbolRenderer *QgsGraduatedSymbolRenderer::createRenderer( Q_UNUSED( listForCboPrettyBreaks ) QgsRangeList ranges; - std::unique_ptr< QgsGraduatedSymbolRenderer > r = std::make_unique< QgsGraduatedSymbolRenderer >( attrName, ranges ); + auto r = std::make_unique< QgsGraduatedSymbolRenderer >( attrName, ranges ); r->setSourceSymbol( symbol->clone() ); r->setSourceColorRamp( ramp->clone() ); @@ -513,7 +513,7 @@ QgsFeatureRenderer *QgsGraduatedSymbolRenderer::create( QDomElement &element, co QString attrName = element.attribute( QStringLiteral( "attr" ) ); - std::unique_ptr< QgsGraduatedSymbolRenderer > r = std::make_unique< QgsGraduatedSymbolRenderer >( attrName, ranges ); + auto r = std::make_unique< QgsGraduatedSymbolRenderer >( attrName, ranges ); QString attrMethod = element.attribute( QStringLiteral( "graduatedMethod" ) ); if ( !attrMethod.isEmpty() ) diff --git a/src/core/symbology/qgsheatmaprenderer.cpp b/src/core/symbology/qgsheatmaprenderer.cpp index 98dfa74453c6..66dc63a767bc 100644 --- a/src/core/symbology/qgsheatmaprenderer.cpp +++ b/src/core/symbology/qgsheatmaprenderer.cpp @@ -396,7 +396,7 @@ QgsHeatmapRenderer *QgsHeatmapRenderer::convertFromRenderer( const QgsFeatureRen } else { - std::unique_ptr< QgsHeatmapRenderer > res = std::make_unique< QgsHeatmapRenderer >(); + auto res = std::make_unique< QgsHeatmapRenderer >(); renderer->copyRendererData( res.get() ); return res.release(); } diff --git a/src/core/symbology/qgsinvertedpolygonrenderer.cpp b/src/core/symbology/qgsinvertedpolygonrenderer.cpp index ab0a76372b8e..6ff8853ff2fd 100644 --- a/src/core/symbology/qgsinvertedpolygonrenderer.cpp +++ b/src/core/symbology/qgsinvertedpolygonrenderer.cpp @@ -109,13 +109,13 @@ QgsInvertedPolygonRenderer *QgsInvertedPolygonRenderer::convertFromRenderer( con renderer->type() == QLatin1String( "graduatedSymbol" ) || renderer->type() == QLatin1String( "RuleRenderer" ) ) { - std::unique_ptr< QgsInvertedPolygonRenderer > res = std::make_unique< QgsInvertedPolygonRenderer >( renderer->clone() ); + auto res = std::make_unique< QgsInvertedPolygonRenderer >( renderer->clone() ); renderer->copyRendererData( res.get() ); return res.release(); } else if ( renderer->type() == QLatin1String( "mergedFeatureRenderer" ) ) { - std::unique_ptr< QgsInvertedPolygonRenderer > res = std::make_unique< QgsInvertedPolygonRenderer >( renderer->embeddedRenderer() ? renderer->embeddedRenderer()->clone() : nullptr ); + auto res = std::make_unique< QgsInvertedPolygonRenderer >( renderer->embeddedRenderer() ? renderer->embeddedRenderer()->clone() : nullptr ); renderer->copyRendererData( res.get() ); return res.release(); } diff --git a/src/core/symbology/qgslinearreferencingsymbollayer.cpp b/src/core/symbology/qgslinearreferencingsymbollayer.cpp index f06f42e79aae..55f9afe0c369 100644 --- a/src/core/symbology/qgslinearreferencingsymbollayer.cpp +++ b/src/core/symbology/qgslinearreferencingsymbollayer.cpp @@ -74,8 +74,8 @@ class QgsLinearReferencingSymbolLayerLabelProvider final : public QgsAbstractLab const QSizeF size = documentMetrics.documentSize( Qgis::TextLayoutMode::Point, Qgis::TextOrientation::Horizontal ); double uPP = context.mapToPixel().mapUnitsPerPixel(); - std::unique_ptr< QgsTextLabelFeatureWithFormat > feature = std::make_unique< QgsTextLabelFeatureWithFormat >( mLabels.size(), - QgsGeos::asGeos( &mapPoint ), QSizeF( size.width() * uPP, size.height() * uPP ), format ); + auto feature = std::make_unique< QgsTextLabelFeatureWithFormat >( mLabels.size(), + QgsGeos::asGeos( &mapPoint ), QSizeF( size.width() * uPP, size.height() * uPP ), format ); feature->setDocument( doc, documentMetrics ); feature->setFixedAngle( angleRadians ); @@ -121,7 +121,7 @@ QgsLinearReferencingSymbolLayer::~QgsLinearReferencingSymbolLayer() = default; QgsSymbolLayer *QgsLinearReferencingSymbolLayer::create( const QVariantMap &properties ) { - std::unique_ptr< QgsLinearReferencingSymbolLayer > res = std::make_unique< QgsLinearReferencingSymbolLayer >(); + auto res = std::make_unique< QgsLinearReferencingSymbolLayer >(); res->setPlacement( qgsEnumKeyToValue( properties.value( QStringLiteral( "placement" ) ).toString(), Qgis::LinearReferencingPlacement::IntervalCartesian2D ) ); res->setLabelSource( qgsEnumKeyToValue( properties.value( QStringLiteral( "source" ) ).toString(), Qgis::LinearReferencingLabelSource::CartesianDistance2D ) ); bool ok = false; @@ -190,7 +190,7 @@ QgsSymbolLayer *QgsLinearReferencingSymbolLayer::create( const QVariantMap &prop QgsLinearReferencingSymbolLayer *QgsLinearReferencingSymbolLayer::clone() const { - std::unique_ptr< QgsLinearReferencingSymbolLayer > res = std::make_unique< QgsLinearReferencingSymbolLayer >(); + auto res = std::make_unique< QgsLinearReferencingSymbolLayer >(); res->setPlacement( mPlacement ); res->setLabelSource( mLabelSource ); res->setInterval( mInterval ); diff --git a/src/core/symbology/qgslinesymbollayer.cpp b/src/core/symbology/qgslinesymbollayer.cpp index cf48a1f5616c..33d058b3f892 100644 --- a/src/core/symbology/qgslinesymbollayer.cpp +++ b/src/core/symbology/qgslinesymbollayer.cpp @@ -2451,7 +2451,7 @@ QgsSymbolLayer *QgsMarkerLineSymbolLayer::create( const QVariantMap &props ) if ( props.contains( QStringLiteral( "rotate" ) ) ) rotate = ( props[QStringLiteral( "rotate" )].toString() == QLatin1String( "1" ) ); - std::unique_ptr< QgsMarkerLineSymbolLayer > x = std::make_unique< QgsMarkerLineSymbolLayer >( rotate, interval ); + auto x = std::make_unique< QgsMarkerLineSymbolLayer >( rotate, interval ); setCommonProperties( x.get(), props ); return x.release(); } @@ -2491,7 +2491,7 @@ void QgsMarkerLineSymbolLayer::stopRender( QgsSymbolRenderContext &context ) QgsMarkerLineSymbolLayer *QgsMarkerLineSymbolLayer::clone() const { - std::unique_ptr< QgsMarkerLineSymbolLayer > x = std::make_unique< QgsMarkerLineSymbolLayer >( rotateSymbols(), interval() ); + auto x = std::make_unique< QgsMarkerLineSymbolLayer >( rotateSymbols(), interval() ); copyTemplateSymbolProperties( x.get() ); return x.release(); } @@ -2774,7 +2774,7 @@ QgsSymbolLayer *QgsHashedLineSymbolLayer::create( const QVariantMap &props ) if ( props.contains( QStringLiteral( "rotate" ) ) ) rotate = ( props[QStringLiteral( "rotate" )] == QLatin1String( "1" ) ); - std::unique_ptr< QgsHashedLineSymbolLayer > x = std::make_unique< QgsHashedLineSymbolLayer >( rotate, interval ); + auto x = std::make_unique< QgsHashedLineSymbolLayer >( rotate, interval ); setCommonProperties( x.get(), props ); if ( props.contains( QStringLiteral( "hash_angle" ) ) ) { @@ -2828,7 +2828,7 @@ QVariantMap QgsHashedLineSymbolLayer::properties() const QgsHashedLineSymbolLayer *QgsHashedLineSymbolLayer::clone() const { - std::unique_ptr< QgsHashedLineSymbolLayer > x = std::make_unique< QgsHashedLineSymbolLayer >( rotateSymbols(), interval() ); + auto x = std::make_unique< QgsHashedLineSymbolLayer >( rotateSymbols(), interval() ); copyTemplateSymbolProperties( x.get() ); x->setHashAngle( mHashAngle ); x->setHashLength( mHashLength ); @@ -3338,7 +3338,7 @@ QgsRasterLineSymbolLayer::~QgsRasterLineSymbolLayer() = default; QgsSymbolLayer *QgsRasterLineSymbolLayer::create( const QVariantMap &properties ) { - std::unique_ptr< QgsRasterLineSymbolLayer > res = std::make_unique(); + auto res = std::make_unique(); if ( properties.contains( QStringLiteral( "line_width" ) ) ) { @@ -3406,7 +3406,7 @@ QVariantMap QgsRasterLineSymbolLayer::properties() const QgsRasterLineSymbolLayer *QgsRasterLineSymbolLayer::clone() const { - std::unique_ptr< QgsRasterLineSymbolLayer > res = std::make_unique< QgsRasterLineSymbolLayer >( mPath ); + auto res = std::make_unique< QgsRasterLineSymbolLayer >( mPath ); res->setWidth( mWidth ); res->setWidthUnit( mWidthUnit ); res->setWidthMapUnitScale( mWidthMapUnitScale ); @@ -3583,7 +3583,7 @@ QgsLineburstSymbolLayer::~QgsLineburstSymbolLayer() = default; QgsSymbolLayer *QgsLineburstSymbolLayer::create( const QVariantMap &properties ) { - std::unique_ptr< QgsLineburstSymbolLayer > res = std::make_unique(); + auto res = std::make_unique(); if ( properties.contains( QStringLiteral( "line_width" ) ) ) { @@ -3669,7 +3669,7 @@ QVariantMap QgsLineburstSymbolLayer::properties() const QgsLineburstSymbolLayer *QgsLineburstSymbolLayer::clone() const { - std::unique_ptr< QgsLineburstSymbolLayer > res = std::make_unique< QgsLineburstSymbolLayer >(); + auto res = std::make_unique< QgsLineburstSymbolLayer >(); res->setWidth( mWidth ); res->setWidthUnit( mWidthUnit ); res->setWidthMapUnitScale( mWidthMapUnitScale ); @@ -3849,7 +3849,7 @@ QgsSymbolLayer *QgsFilledLineSymbolLayer::create( const QVariantMap &props ) width = props[QStringLiteral( "width" )].toDouble(); } - std::unique_ptr l = std::make_unique< QgsFilledLineSymbolLayer >( width, QgsFillSymbol::createSimple( props ) ); + auto l = std::make_unique< QgsFilledLineSymbolLayer >( width, QgsFillSymbol::createSimple( props ) ); if ( props.contains( QStringLiteral( "line_width_unit" ) ) ) { diff --git a/src/core/symbology/qgsmapinfosymbolconverter.cpp b/src/core/symbology/qgsmapinfosymbolconverter.cpp index 26eb958719f7..2a37cc919ccd 100644 --- a/src/core/symbology/qgsmapinfosymbolconverter.cpp +++ b/src/core/symbology/qgsmapinfosymbolconverter.cpp @@ -35,7 +35,7 @@ void QgsMapInfoSymbolConversionContext::pushWarning( const QString &warning ) QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, QgsMapInfoSymbolConversionContext &context, const QColor &foreColor, double size, Qgis::RenderUnit sizeUnit, bool interleaved ) { - std::unique_ptr< QgsSimpleLineSymbolLayer > simpleLine = std::make_unique< QgsSimpleLineSymbolLayer >( foreColor, size ); + auto simpleLine = std::make_unique< QgsSimpleLineSymbolLayer >( foreColor, size ); simpleLine->setWidthUnit( sizeUnit ); simpleLine->setPenCapStyle( Qt::RoundCap ); simpleLine->setPenJoinStyle( Qt::RoundJoin ); @@ -311,11 +311,11 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs simpleLine->setDashPatternOffsetUnit( sizeUnit ); } - std::unique_ptr< QgsLineSymbol > symbol = std::make_unique< QgsLineSymbol >( QgsSymbolLayerList() << simpleLine.release() ); + auto symbol = std::make_unique< QgsLineSymbol >( QgsSymbolLayerList() << simpleLine.release() ); if ( ( identifier >= 26 && identifier < 29 ) || ( identifier >= 31 && identifier < 34 ) || ( identifier >= 36 && identifier < 38 ) || ( identifier >= 47 && identifier <= 53 ) || identifier == 118 ) { - std::unique_ptr< QgsHashedLineSymbolLayer > hash = std::make_unique< QgsHashedLineSymbolLayer >(); + auto hash = std::make_unique< QgsHashedLineSymbolLayer >(); double spacing = 1; double offset = 1; @@ -432,12 +432,12 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs hash->setHashLength( length * size ); hash->setHashLengthUnit( sizeUnit ); - std::unique_ptr< QgsSimpleLineSymbolLayer > subSimpleLine = std::make_unique< QgsSimpleLineSymbolLayer >( foreColor, size ); + auto subSimpleLine = std::make_unique< QgsSimpleLineSymbolLayer >( foreColor, size ); subSimpleLine->setWidthUnit( sizeUnit ); subSimpleLine->setPenCapStyle( Qt::RoundCap ); subSimpleLine->setPenJoinStyle( Qt::RoundJoin ); - std::unique_ptr< QgsLineSymbol > subSymbol = std::make_unique< QgsLineSymbol >( QgsSymbolLayerList() << subSimpleLine.release() ); + auto subSymbol = std::make_unique< QgsLineSymbol >( QgsSymbolLayerList() << subSimpleLine.release() ); hash->setSubSymbol( subSymbol.release() ); if ( identifier == 31 || identifier == 33 ) @@ -499,7 +499,7 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs break; } - std::unique_ptr< QgsHashedLineSymbolLayer > hash = std::make_unique< QgsHashedLineSymbolLayer >(); + auto hash = std::make_unique< QgsHashedLineSymbolLayer >(); hash->setInterval( spacing * size * 2 ); hash->setIntervalUnit( sizeUnit ); @@ -509,12 +509,12 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs hash->setHashLength( 3.5 * size * 0.5 ); hash->setHashLengthUnit( sizeUnit ); - std::unique_ptr< QgsSimpleLineSymbolLayer > subSimpleLine = std::make_unique< QgsSimpleLineSymbolLayer >( foreColor, size ); + auto subSimpleLine = std::make_unique< QgsSimpleLineSymbolLayer >( foreColor, size ); subSimpleLine->setWidthUnit( sizeUnit ); subSimpleLine->setPenCapStyle( Qt::RoundCap ); subSimpleLine->setPenJoinStyle( Qt::RoundJoin ); - std::unique_ptr< QgsLineSymbol > subSymbol = std::make_unique< QgsLineSymbol >( QgsSymbolLayerList() << subSimpleLine.release() ); + auto subSymbol = std::make_unique< QgsLineSymbol >( QgsSymbolLayerList() << subSimpleLine.release() ); hash->setSubSymbol( subSymbol.release() ); std::unique_ptr< QgsHashedLineSymbolLayer > hash2( hash->clone() ); @@ -553,7 +553,7 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs } else if ( ( identifier >= 38 && identifier < 41 ) || ( identifier >= 54 && identifier <= 61 ) || ( identifier >= 78 && identifier <= 109 ) || ( identifier >= 114 && identifier <= 117 ) ) { - std::unique_ptr< QgsMarkerLineSymbolLayer > marker = std::make_unique< QgsMarkerLineSymbolLayer >(); + auto marker = std::make_unique< QgsMarkerLineSymbolLayer >(); double spacing = 1; double offset = 1; @@ -837,7 +837,7 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs marker->setOffset( lineOffset * size ); marker->setOffsetUnit( sizeUnit ); - std::unique_ptr< QgsSimpleMarkerSymbolLayer > subSimpleMarker = std::make_unique< QgsSimpleMarkerSymbolLayer >( shape, markerSize * size ); + auto subSimpleMarker = std::make_unique< QgsSimpleMarkerSymbolLayer >( shape, markerSize * size ); subSimpleMarker->setColor( foreColor ); subSimpleMarker->setSizeUnit( sizeUnit ); subSimpleMarker->setStrokeWidth( size ); @@ -856,7 +856,7 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs subSimpleMarker->setStrokeStyle( Qt::NoPen ); } - std::unique_ptr< QgsMarkerSymbol > subSymbol = std::make_unique< QgsMarkerSymbol >( QgsSymbolLayerList() << subSimpleMarker.release() ); + auto subSymbol = std::make_unique< QgsMarkerSymbol >( QgsSymbolLayerList() << subSimpleMarker.release() ); marker->setSubSymbol( subSymbol.release() ); if ( identifier == 56 ) @@ -909,7 +909,7 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs symbol->appendSymbolLayer( dashLine.release() ); } - std::unique_ptr< QgsSimpleLineSymbolLayer > simpleLine2 = std::make_unique< QgsSimpleLineSymbolLayer >( foreColor, 1.6 * size ); + auto simpleLine2 = std::make_unique< QgsSimpleLineSymbolLayer >( foreColor, 1.6 * size ); simpleLine2->setWidthUnit( sizeUnit ); simpleLine2->setPenCapStyle( Qt::RoundCap ); simpleLine2->setPenJoinStyle( Qt::RoundJoin ); @@ -922,7 +922,7 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs } else if ( identifier == 45 ) { - std::unique_ptr< QgsSimpleLineSymbolLayer > simpleLine2 = std::make_unique< QgsSimpleLineSymbolLayer >( foreColor, 1.6 * size ); + auto simpleLine2 = std::make_unique< QgsSimpleLineSymbolLayer >( foreColor, 1.6 * size ); simpleLine2->setWidthUnit( sizeUnit ); simpleLine2->setPenCapStyle( Qt::RoundCap ); simpleLine2->setPenJoinStyle( Qt::RoundJoin ); @@ -935,7 +935,7 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs } else if ( identifier == 46 ) { - std::unique_ptr< QgsHashedLineSymbolLayer > hashLine = std::make_unique< QgsHashedLineSymbolLayer >(); + auto hashLine = std::make_unique< QgsHashedLineSymbolLayer >(); hashLine->setInterval( 4 * size ); hashLine->setIntervalUnit( sizeUnit ); @@ -950,12 +950,12 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs } else if ( identifier == 62 ) { - std::unique_ptr< QgsMarkerLineSymbolLayer > markerLine = std::make_unique< QgsMarkerLineSymbolLayer >(); + auto markerLine = std::make_unique< QgsMarkerLineSymbolLayer >(); markerLine->setPlacements( Qgis::MarkerLinePlacement::FirstVertex ); markerLine->setOffsetAlongLine( 2 * size ); markerLine->setOffsetAlongLineUnit( sizeUnit ); - std::unique_ptr< QgsSimpleMarkerSymbolLayer > subSimpleMarker = std::make_unique< QgsSimpleMarkerSymbolLayer >( Qgis::MarkerShape::Line, size * 4 ); + auto subSimpleMarker = std::make_unique< QgsSimpleMarkerSymbolLayer >( Qgis::MarkerShape::Line, size * 4 ); subSimpleMarker->setColor( foreColor ); subSimpleMarker->setSizeUnit( sizeUnit ); subSimpleMarker->setStrokeWidth( 1.25 * size ); @@ -965,7 +965,7 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs subSimpleMarker->setPenJoinStyle( Qt::RoundJoin ); subSimpleMarker->setPenCapStyle( Qt::RoundCap ); - std::unique_ptr< QgsMarkerSymbol > subSymbol = std::make_unique< QgsMarkerSymbol >( QgsSymbolLayerList() << subSimpleMarker.release() ); + auto subSymbol = std::make_unique< QgsMarkerSymbol >( QgsSymbolLayerList() << subSimpleMarker.release() ); markerLine->setSubSymbol( subSymbol.release() ); symbol->appendSymbolLayer( markerLine.release() ); @@ -1011,7 +1011,7 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs if ( identifier == 75 || identifier == 76 ) { - std::unique_ptr< QgsSimpleLineSymbolLayer > middleLine = std::make_unique< QgsSimpleLineSymbolLayer >( QColor( 255, 255, 255 ), upperLine->width() ); + auto middleLine = std::make_unique< QgsSimpleLineSymbolLayer >( QColor( 255, 255, 255 ), upperLine->width() ); middleLine->setWidthUnit( sizeUnit ); middleLine->setLocked( true ); middleLine->setPenCapStyle( Qt::RoundCap ); @@ -1029,7 +1029,7 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs if ( identifier == 64 || identifier == 66 ) { - std::unique_ptr< QgsSimpleLineSymbolLayer > middleLine = std::make_unique< QgsSimpleLineSymbolLayer >( identifier == 64 ? foreColor : QColor( 0, 0, 0 ), 0 ); + auto middleLine = std::make_unique< QgsSimpleLineSymbolLayer >( identifier == 64 ? foreColor : QColor( 0, 0, 0 ), 0 ); if ( identifier == 66 ) middleLine->setLocked( true ); @@ -1042,9 +1042,9 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs else if ( identifier == 69 ) { - std::unique_ptr< QgsHashedLineSymbolLayer > hashedLine = std::make_unique< QgsHashedLineSymbolLayer >(); + auto hashedLine = std::make_unique< QgsHashedLineSymbolLayer >(); - std::unique_ptr< QgsSimpleLineSymbolLayer > middleLine = std::make_unique< QgsSimpleLineSymbolLayer >( foreColor, 0 ); + auto middleLine = std::make_unique< QgsSimpleLineSymbolLayer >( foreColor, 0 ); hashedLine->setSubSymbol( new QgsLineSymbol( { middleLine.release() } ) ); hashedLine->setInterval( 18 * size ); hashedLine->setIntervalUnit( sizeUnit ); @@ -1061,7 +1061,7 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs } else if ( identifier == 77 ) { - std::unique_ptr< QgsSimpleLineSymbolLayer > middleLine = std::make_unique< QgsSimpleLineSymbolLayer >( QColor( 255, 255, 255 ), qgis::down_cast< QgsSimpleLineSymbolLayer * >( symbol->symbolLayer( 1 ) )->width() ); + auto middleLine = std::make_unique< QgsSimpleLineSymbolLayer >( QColor( 255, 255, 255 ), qgis::down_cast< QgsSimpleLineSymbolLayer * >( symbol->symbolLayer( 1 ) )->width() ); middleLine->setWidthUnit( sizeUnit ); middleLine->setLocked( true ); middleLine->setPenCapStyle( Qt::RoundCap ); @@ -1081,7 +1081,7 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs qgis::down_cast< QgsSimpleLineSymbolLayer * >( symbol->symbolLayer( 0 ) )->setColor( QColor( 0, 0, 0 ) ); qgis::down_cast< QgsSimpleLineSymbolLayer * >( symbol->symbolLayer( 0 ) )->setLocked( true ); - std::unique_ptr< QgsSimpleLineSymbolLayer > simpleLine2 = std::make_unique< QgsSimpleLineSymbolLayer >( foreColor, size ); + auto simpleLine2 = std::make_unique< QgsSimpleLineSymbolLayer >( foreColor, size ); simpleLine2->setWidthUnit( sizeUnit ); simpleLine2->setPenCapStyle( Qt::RoundCap ); simpleLine2->setPenJoinStyle( Qt::RoundJoin ); @@ -1354,7 +1354,7 @@ QgsFillSymbol *QgsMapInfoSymbolConverter::convertFillSymbol( int identifier, Qgs QgsSymbolLayerList layers; if ( backColor.isValid() && style != Qt::SolidPattern && ( useLineFill || style != Qt::NoBrush ) ) { - std::unique_ptr< QgsSimpleFillSymbolLayer > backgroundFill = std::make_unique< QgsSimpleFillSymbolLayer >( backColor ); + auto backgroundFill = std::make_unique< QgsSimpleFillSymbolLayer >( backColor ); backgroundFill->setLocked( true ); backgroundFill->setStrokeStyle( Qt::NoPen ); layers << backgroundFill.release(); @@ -1362,16 +1362,16 @@ QgsFillSymbol *QgsMapInfoSymbolConverter::convertFillSymbol( int identifier, Qgs if ( !useLineFill ) { - std::unique_ptr< QgsSimpleFillSymbolLayer > foregroundFill = std::make_unique< QgsSimpleFillSymbolLayer >( foreColor ); + auto foregroundFill = std::make_unique< QgsSimpleFillSymbolLayer >( foreColor ); foregroundFill->setBrushStyle( style ); foregroundFill->setStrokeStyle( Qt::NoPen ); layers << foregroundFill.release(); } else { - std::unique_ptr< QgsLinePatternFillSymbolLayer > lineFill = std::make_unique< QgsLinePatternFillSymbolLayer >(); + auto lineFill = std::make_unique< QgsLinePatternFillSymbolLayer >(); - std::unique_ptr< QgsSimpleLineSymbolLayer > simpleLine = std::make_unique< QgsSimpleLineSymbolLayer >( foreColor, lineWidth ); + auto simpleLine = std::make_unique< QgsSimpleLineSymbolLayer >( foreColor, lineWidth ); simpleLine->setWidthUnit( Qgis::RenderUnit::Points ); lineFill->setSubSymbol( new QgsLineSymbol( QgsSymbolLayerList() << simpleLine.release() ) ); @@ -1513,7 +1513,7 @@ QgsMarkerSymbol *QgsMapInfoSymbolConverter::convertMarkerSymbol( int identifier, return nullptr; } - std::unique_ptr< QgsSimpleMarkerSymbolLayer > simpleMarker = std::make_unique< QgsSimpleMarkerSymbolLayer >( shape, size ); + auto simpleMarker = std::make_unique< QgsSimpleMarkerSymbolLayer >( shape, size ); simpleMarker->setSizeUnit( sizeUnit ); simpleMarker->setAngle( angle ); simpleMarker->setVerticalAnchorPoint( vertAlign ); diff --git a/src/core/symbology/qgsmarkersymbollayer.cpp b/src/core/symbology/qgsmarkersymbollayer.cpp index 86eb93fa6a82..a93ab3a254fa 100644 --- a/src/core/symbology/qgsmarkersymbollayer.cpp +++ b/src/core/symbology/qgsmarkersymbollayer.cpp @@ -3043,7 +3043,7 @@ QgsSymbolLayer *QgsRasterMarkerSymbolLayer::create( const QVariantMap &props ) if ( props.contains( QStringLiteral( "scale_method" ) ) ) scaleMethod = QgsSymbolLayerUtils::decodeScaleMethod( props[QStringLiteral( "scale_method" )].toString() ); - std::unique_ptr< QgsRasterMarkerSymbolLayer > m = std::make_unique< QgsRasterMarkerSymbolLayer >( path, size, angle, scaleMethod ); + auto m = std::make_unique< QgsRasterMarkerSymbolLayer >( path, size, angle, scaleMethod ); m->setCommonProperties( props ); return m.release(); } @@ -3365,7 +3365,7 @@ QVariantMap QgsRasterMarkerSymbolLayer::properties() const QgsRasterMarkerSymbolLayer *QgsRasterMarkerSymbolLayer::clone() const { - std::unique_ptr< QgsRasterMarkerSymbolLayer > m = std::make_unique< QgsRasterMarkerSymbolLayer >( mPath, mSize, mAngle ); + auto m = std::make_unique< QgsRasterMarkerSymbolLayer >( mPath, mSize, mAngle ); copyCommonProperties( m.get() ); return m.release(); } @@ -4051,7 +4051,7 @@ QgsSymbolLayer *QgsAnimatedMarkerSymbolLayer::create( const QVariantMap &propert if ( properties.contains( QStringLiteral( "angle" ) ) ) angle = properties[QStringLiteral( "angle" )].toDouble(); - std::unique_ptr< QgsAnimatedMarkerSymbolLayer > m = std::make_unique< QgsAnimatedMarkerSymbolLayer >( path, size, angle ); + auto m = std::make_unique< QgsAnimatedMarkerSymbolLayer >( path, size, angle ); m->setFrameRate( properties.value( QStringLiteral( "frameRate" ), QStringLiteral( "10" ) ).toDouble() ); m->setCommonProperties( properties ); @@ -4072,7 +4072,7 @@ QVariantMap QgsAnimatedMarkerSymbolLayer::properties() const QgsAnimatedMarkerSymbolLayer *QgsAnimatedMarkerSymbolLayer::clone() const { - std::unique_ptr< QgsAnimatedMarkerSymbolLayer > m = std::make_unique< QgsAnimatedMarkerSymbolLayer >( mPath, mSize, mAngle ); + auto m = std::make_unique< QgsAnimatedMarkerSymbolLayer >( mPath, mSize, mAngle ); m->setFrameRate( mFrameRateFps ); copyCommonProperties( m.get() ); return m.release(); diff --git a/src/core/symbology/qgsmasksymbollayer.cpp b/src/core/symbology/qgsmasksymbollayer.cpp index 416a74d13974..8b2227824918 100644 --- a/src/core/symbology/qgsmasksymbollayer.cpp +++ b/src/core/symbology/qgsmasksymbollayer.cpp @@ -136,6 +136,11 @@ void QgsMaskMarkerSymbolLayer::setMasks( const QList &m mMaskedSymbolLayers = maskedLayers; } +void QgsMaskMarkerSymbolLayer::clearMasks() +{ + mMaskedSymbolLayers.clear(); +} + QRectF QgsMaskMarkerSymbolLayer::bounds( QPointF point, QgsSymbolRenderContext &context ) { return mSymbol->bounds( point, context.renderContext() ); diff --git a/src/core/symbology/qgsmasksymbollayer.h b/src/core/symbology/qgsmasksymbollayer.h index c3868fe59e4b..1c52d14a92e8 100644 --- a/src/core/symbology/qgsmasksymbollayer.h +++ b/src/core/symbology/qgsmasksymbollayer.h @@ -79,6 +79,13 @@ class CORE_EXPORT QgsMaskMarkerSymbolLayer : public QgsMarkerSymbolLayer */ QList masks() const override; + /** + * Remove masks defined by this symbol layer. + * \see masks() + * \since QGIS 3.42 + */ + void clearMasks(); + /** * Sets the symbol layers that will be masked by the sub symbol's shape. * \param maskedLayers list of references to symbol layers @@ -101,5 +108,3 @@ class CORE_EXPORT QgsMaskMarkerSymbolLayer : public QgsMarkerSymbolLayer }; #endif - - diff --git a/src/core/symbology/qgsmergedfeaturerenderer.cpp b/src/core/symbology/qgsmergedfeaturerenderer.cpp index dd7f388bcf9c..2c354bada5a4 100644 --- a/src/core/symbology/qgsmergedfeaturerenderer.cpp +++ b/src/core/symbology/qgsmergedfeaturerenderer.cpp @@ -592,13 +592,13 @@ QgsMergedFeatureRenderer *QgsMergedFeatureRenderer::convertFromRenderer( const Q renderer->type() == QLatin1String( "graduatedSymbol" ) || renderer->type() == QLatin1String( "RuleRenderer" ) ) { - std::unique_ptr< QgsMergedFeatureRenderer > res = std::make_unique< QgsMergedFeatureRenderer >( renderer->clone() ); + auto res = std::make_unique< QgsMergedFeatureRenderer >( renderer->clone() ); renderer->copyRendererData( res.get() ); return res.release(); } else if ( renderer->type() == QLatin1String( "invertedPolygonRenderer" ) ) { - std::unique_ptr< QgsMergedFeatureRenderer > res = std::make_unique< QgsMergedFeatureRenderer >( renderer->embeddedRenderer() ? renderer->embeddedRenderer()->clone() : nullptr ); + auto res = std::make_unique< QgsMergedFeatureRenderer >( renderer->embeddedRenderer() ? renderer->embeddedRenderer()->clone() : nullptr ); renderer->copyRendererData( res.get() ); return res.release(); } diff --git a/src/core/symbology/qgsnullsymbolrenderer.cpp b/src/core/symbology/qgsnullsymbolrenderer.cpp index e2c05832d65d..b86caf6c40de 100644 --- a/src/core/symbology/qgsnullsymbolrenderer.cpp +++ b/src/core/symbology/qgsnullsymbolrenderer.cpp @@ -121,7 +121,7 @@ QDomElement QgsNullSymbolRenderer::save( QDomDocument &doc, const QgsReadWriteCo QgsNullSymbolRenderer *QgsNullSymbolRenderer::convertFromRenderer( const QgsFeatureRenderer *renderer ) { - std::unique_ptr< QgsNullSymbolRenderer > res = std::make_unique< QgsNullSymbolRenderer >(); + auto res = std::make_unique< QgsNullSymbolRenderer >(); renderer->copyRendererData( res.get() ); return res.release(); } diff --git a/src/core/symbology/qgsrulebasedrenderer.cpp b/src/core/symbology/qgsrulebasedrenderer.cpp index 0fdf48dc11dd..5b2ec2f20b8b 100644 --- a/src/core/symbology/qgsrulebasedrenderer.cpp +++ b/src/core/symbology/qgsrulebasedrenderer.cpp @@ -1496,14 +1496,14 @@ QgsRuleBasedRenderer *QgsRuleBasedRenderer::convertFromRenderer( const QgsFeatur attr = QgsExpression::quotedColumnRef( attr ); } - std::unique_ptr< QgsRuleBasedRenderer::Rule > rootrule = std::make_unique< QgsRuleBasedRenderer::Rule >( nullptr ); + auto rootrule = std::make_unique< QgsRuleBasedRenderer::Rule >( nullptr ); QString expression; QString value; QgsRendererCategory category; for ( const QgsRendererCategory &category : categorizedRenderer->categories() ) { - std::unique_ptr< QgsRuleBasedRenderer::Rule > rule = std::make_unique< QgsRuleBasedRenderer::Rule >( nullptr ); + auto rule = std::make_unique< QgsRuleBasedRenderer::Rule >( nullptr ); rule->setLabel( category.label() ); @@ -1600,14 +1600,14 @@ QgsRuleBasedRenderer *QgsRuleBasedRenderer::convertFromRenderer( const QgsFeatur attr = QStringLiteral( "(%1)" ).arg( attr ); } - std::unique_ptr< QgsRuleBasedRenderer::Rule > rootrule = std::make_unique< QgsRuleBasedRenderer::Rule >( nullptr ); + auto rootrule = std::make_unique< QgsRuleBasedRenderer::Rule >( nullptr ); QString expression; QgsRendererRange range; for ( int i = 0; i < graduatedRenderer->ranges().size(); ++i ) { range = graduatedRenderer->ranges().value( i ); - std::unique_ptr< QgsRuleBasedRenderer::Rule > rule = std::make_unique< QgsRuleBasedRenderer::Rule >( nullptr ); + auto rule = std::make_unique< QgsRuleBasedRenderer::Rule >( nullptr ); rule->setLabel( range.label() ); if ( i == 0 )//The lower boundary of the first range is included, while it is excluded for the others { @@ -1652,7 +1652,7 @@ QgsRuleBasedRenderer *QgsRuleBasedRenderer::convertFromRenderer( const QgsFeatur { const QgsEmbeddedSymbolRenderer *embeddedRenderer = dynamic_cast( renderer ); - std::unique_ptr< QgsRuleBasedRenderer::Rule > rootrule = std::make_unique< QgsRuleBasedRenderer::Rule >( nullptr ); + auto rootrule = std::make_unique< QgsRuleBasedRenderer::Rule >( nullptr ); QgsFeatureRequest req; req.setFlags( Qgis::FeatureRequestFlag::EmbeddedSymbols | Qgis::FeatureRequestFlag::NoGeometry ); @@ -1663,7 +1663,7 @@ QgsRuleBasedRenderer *QgsRuleBasedRenderer::convertFromRenderer( const QgsFeatur { if ( feature.embeddedSymbol() ) { - std::unique_ptr< QgsRuleBasedRenderer::Rule > rule = std::make_unique< QgsRuleBasedRenderer::Rule >( nullptr ); + auto rule = std::make_unique< QgsRuleBasedRenderer::Rule >( nullptr ); rule->setFilterExpression( QStringLiteral( "$id=%1" ).arg( feature.id() ) ); rule->setLabel( QString::number( feature.id() ) ); rule->setSymbol( feature.embeddedSymbol()->clone() ); @@ -1671,7 +1671,7 @@ QgsRuleBasedRenderer *QgsRuleBasedRenderer::convertFromRenderer( const QgsFeatur } } - std::unique_ptr< QgsRuleBasedRenderer::Rule > rule = std::make_unique< QgsRuleBasedRenderer::Rule >( nullptr ); + auto rule = std::make_unique< QgsRuleBasedRenderer::Rule >( nullptr ); rule->setFilterExpression( QStringLiteral( "ELSE" ) ); rule->setLabel( QObject::tr( "All other features" ) ); rule->setSymbol( embeddedRenderer->defaultSymbol()->clone() ); diff --git a/src/core/symbology/qgsstyle.cpp b/src/core/symbology/qgsstyle.cpp index e8f0dada2b9b..3eb2de9d5149 100644 --- a/src/core/symbology/qgsstyle.cpp +++ b/src/core/symbology/qgsstyle.cpp @@ -80,16 +80,16 @@ QgsStyle *QgsStyle::sDefaultStyle = nullptr; QgsStyle::QgsStyle( QObject *parent ) : QObject( parent ) { - std::unique_ptr< QgsSimpleMarkerSymbolLayer > simpleMarker = std::make_unique< QgsSimpleMarkerSymbolLayer >( Qgis::MarkerShape::Circle, - 1.6, 0, Qgis::ScaleMethod::ScaleArea, QColor( 84, 176, 74 ), QColor( 61, 128, 53 ) ); + auto simpleMarker = std::make_unique< QgsSimpleMarkerSymbolLayer >( Qgis::MarkerShape::Circle, + 1.6, 0, Qgis::ScaleMethod::ScaleArea, QColor( 84, 176, 74 ), QColor( 61, 128, 53 ) ); simpleMarker->setStrokeWidth( 0.4 ); mPatchMarkerSymbol = std::make_unique< QgsMarkerSymbol >( QgsSymbolLayerList() << simpleMarker.release() ); - std::unique_ptr< QgsSimpleLineSymbolLayer > simpleLine = std::make_unique< QgsSimpleLineSymbolLayer >( QColor( 84, 176, 74 ), 0.6 ); + auto simpleLine = std::make_unique< QgsSimpleLineSymbolLayer >( QColor( 84, 176, 74 ), 0.6 ); mPatchLineSymbol = std::make_unique< QgsLineSymbol >( QgsSymbolLayerList() << simpleLine.release() ); - std::unique_ptr< QgsGradientFillSymbolLayer > gradientFill = std::make_unique< QgsGradientFillSymbolLayer >( QColor( 66, 150, 63 ), QColor( 84, 176, 74 ) ); - std::unique_ptr< QgsSimpleLineSymbolLayer > simpleOutline = std::make_unique< QgsSimpleLineSymbolLayer >( QColor( 56, 128, 54 ), 0.26 ); + auto gradientFill = std::make_unique< QgsGradientFillSymbolLayer >( QColor( 66, 150, 63 ), QColor( 84, 176, 74 ) ); + auto simpleOutline = std::make_unique< QgsSimpleLineSymbolLayer >( QColor( 56, 128, 54 ), 0.26 ); mPatchFillSymbol = std::make_unique< QgsFillSymbol >( QgsSymbolLayerList() << gradientFill.release() << simpleOutline.release() ); } diff --git a/src/core/symbology/qgssvgcache.cpp b/src/core/symbology/qgssvgcache.cpp index f157a5239db5..dd3ea7c34700 100644 --- a/src/core/symbology/qgssvgcache.cpp +++ b/src/core/symbology/qgssvgcache.cpp @@ -433,7 +433,7 @@ void QgsSvgCache::cacheImage( QgsSvgCacheEntry *entry ) const QSize imageSize = sizeForImage( *entry, viewBoxSize, scaledSize ); // cast double image sizes to int for QImage - std::unique_ptr< QImage > image = std::make_unique< QImage >( imageSize, QImage::Format_ARGB32_Premultiplied ); + auto image = std::make_unique< QImage >( imageSize, QImage::Format_ARGB32_Premultiplied ); image->fill( 0 ); // transparent background const bool isFixedAR = entry->fixedAspectRatio > 0; @@ -469,7 +469,7 @@ void QgsSvgCache::cachePicture( QgsSvgCacheEntry *entry, bool forceVectorOutput const bool isFixedAR = entry->fixedAspectRatio > 0; //correct QPictures dpi correction - std::unique_ptr< QPicture > picture = std::make_unique< QPicture >(); + auto picture = std::make_unique< QPicture >(); QRectF rect; QSvgRenderer r( entry->svgContent ); double hwRatio = 1.0; diff --git a/src/core/symbology/qgssymbollayerutils.cpp b/src/core/symbology/qgssymbollayerutils.cpp index c2b5ed72e94c..ba66abd62f0f 100644 --- a/src/core/symbology/qgssymbollayerutils.cpp +++ b/src/core/symbology/qgssymbollayerutils.cpp @@ -44,6 +44,7 @@ #include "qgssymbollayerreference.h" #include "qgsmarkersymbollayer.h" #include "qgscurvepolygon.h" +#include "qgsmasksymbollayer.h" #include "qmath.h" #include @@ -1348,7 +1349,7 @@ QgsSymbol *QgsSymbolLayerUtils::loadSymbol( const QDomElement &element, const Qg if ( !element.firstChildElement( QStringLiteral( "buffer" ) ).isNull() ) { - std::unique_ptr< QgsSymbolBufferSettings > bufferSettings = std::make_unique< QgsSymbolBufferSettings >(); + auto bufferSettings = std::make_unique< QgsSymbolBufferSettings >(); bufferSettings->readXml( element, context ); symbol->setBufferSettings( bufferSettings.release() ); } @@ -5605,6 +5606,26 @@ void QgsSymbolLayerUtils::resetSymbolLayerIds( QgsSymbolLayer *symbolLayer ) changeSymbolLayerIds( symbolLayer, []() { return QUuid::createUuid().toString(); } ); } +void QgsSymbolLayerUtils::clearSymbolLayerMasks( QgsSymbol *symbol ) +{ + if ( !symbol ) + return; + + for ( int idx = 0; idx < symbol->symbolLayerCount(); idx++ ) + { + if ( QgsMaskMarkerSymbolLayer *maskSl = dynamic_cast( symbol->symbolLayer( idx ) ) ) + { + maskSl->clearMasks(); + + // recurse over sub symbols + if ( QgsSymbol *subSymbol = maskSl->subSymbol() ) + { + clearSymbolLayerMasks( subSymbol ); + } + } + } +} + QVector QgsSymbolLayerUtils::collectSymbolLayerClipGeometries( const QgsRenderContext &context, const QString &symbolLayerId, const QRectF &bounds ) { QVector clipGeometries = context.symbolLayerClipGeometries( symbolLayerId ); diff --git a/src/core/symbology/qgssymbollayerutils.h b/src/core/symbology/qgssymbollayerutils.h index 233f56ed7993..c1a3221209ba 100644 --- a/src/core/symbology/qgssymbollayerutils.h +++ b/src/core/symbology/qgssymbollayerutils.h @@ -949,6 +949,12 @@ class CORE_EXPORT QgsSymbolLayerUtils */ static void resetSymbolLayerIds( QgsSymbolLayer *symbolLayer ); + /** + * Remove recursively masks from all \a symbol symbol layers + * \since QGIS 3.42 + */ + static void clearSymbolLayerMasks( QgsSymbol *symbol ); + /** * Returns a list of the symbol layer clip geometries to be used for the symbol layer with the specified * ID. diff --git a/src/core/textrenderer/qgstextdocument.cpp b/src/core/textrenderer/qgstextdocument.cpp index 69329a4a7676..c12bb93537c6 100644 --- a/src/core/textrenderer/qgstextdocument.cpp +++ b/src/core/textrenderer/qgstextdocument.cpp @@ -53,6 +53,10 @@ QgsTextDocument QgsTextDocument::fromPlainText( const QStringList &lines ) // a html or css tag doesn't mess things up. Instead, Qt will just silently // ignore html attributes it doesn't know about, like this replacement string #define TAB_REPLACEMENT_MARKER " ignore_me_i_am_a_tab " +// when splitting by the tab replacement marker we need to be tolerant to the +// spaces surrounding REPLACEMENT_MARKER being swallowed when multiple consecutive +// tab characters exist +#define TAB_REPLACEMENT_MARKER_RX " ?ignore_me_i_am_a_tab ?" QgsTextDocument QgsTextDocument::fromHtml( const QStringList &lines ) { @@ -73,6 +77,7 @@ QgsTextDocument QgsTextDocument::fromHtml( const QStringList &lines ) // by first replacing it with a string which QTextDocument won't mess with, and then // handle these markers as tab characters in the parsed HTML document. line.replace( QString( '\t' ), QStringLiteral( TAB_REPLACEMENT_MARKER ) ); + const thread_local QRegularExpression sTabReplacementMarkerRx( QStringLiteral( TAB_REPLACEMENT_MARKER_RX ) ); // cheat a little. Qt css requires some properties to have the "px" suffix. But we don't treat these properties // as pixels, because that doesn't scale well with different dpi render targets! So let's instead use just instead treat the suffix as @@ -162,7 +167,7 @@ QgsTextDocument QgsTextDocument::fromHtml( const QStringList &lines ) } splitFragment.setCharacterFormat( newFormat ); - const QStringList tabSplit = splitLine.split( QStringLiteral( TAB_REPLACEMENT_MARKER ) ); + const QStringList tabSplit = splitLine.split( sTabReplacementMarkerRx ); int index = 0; for ( const QString &part : tabSplit ) { @@ -210,7 +215,7 @@ QgsTextDocument QgsTextDocument::fromHtml( const QStringList &lines ) newFormat.overrideWith( blockFormat ); tmpFragment.setCharacterFormat( newFormat ); - const QStringList tabSplit = fragmentText.split( QStringLiteral( TAB_REPLACEMENT_MARKER ) ); + const QStringList tabSplit = fragmentText.split( sTabReplacementMarkerRx ); int index = 0; for ( const QString &part : tabSplit ) { diff --git a/src/core/textrenderer/qgstextdocumentmetrics.cpp b/src/core/textrenderer/qgstextdocumentmetrics.cpp index 81f97f10a65c..58d755e92dc3 100644 --- a/src/core/textrenderer/qgstextdocumentmetrics.cpp +++ b/src/core/textrenderer/qgstextdocumentmetrics.cpp @@ -582,8 +582,6 @@ void QgsTextDocumentMetrics::processFragment( QgsTextDocumentMetrics &res, const thisBlockMetrics.isFirstBlock = false; remainingWidthInCurrentLine = documentContext.maximumWidth(); } - - thisBlockMetrics.isFirstBlock = false; } } else diff --git a/src/core/textrenderer/qgstextrendererutils.cpp b/src/core/textrenderer/qgstextrendererutils.cpp index ee01be6240fc..0868d1269de4 100644 --- a/src/core/textrenderer/qgstextrendererutils.cpp +++ b/src/core/textrenderer/qgstextrendererutils.cpp @@ -193,7 +193,7 @@ std::unique_ptr< QgsTextRendererUtils::CurvePlacementProperties > QgsTextRendere std::unique_ptr< QgsTextRendererUtils::CurvePlacementProperties > QgsTextRendererUtils::generateCurvedTextPlacementPrivate( const QgsPrecalculatedTextMetrics &metrics, const double *x, const double *y, int numPoints, const std::vector &pathDistances, double offsetAlongLine, LabelLineDirection direction, CurvedTextFlags flags, double maxConcaveAngle, double maxConvexAngle, bool isSecondAttempt ) { - std::unique_ptr< CurvePlacementProperties > output = std::make_unique< CurvePlacementProperties >(); + auto output = std::make_unique< CurvePlacementProperties >(); output->graphemePlacement.reserve( metrics.count() ); double offsetAlongSegment = offsetAlongLine; diff --git a/src/core/tiledscene/qgscesiumtilesdataprovider.cpp b/src/core/tiledscene/qgscesiumtilesdataprovider.cpp index b52e2d8f4e0a..d9824e98c452 100644 --- a/src/core/tiledscene/qgscesiumtilesdataprovider.cpp +++ b/src/core/tiledscene/qgscesiumtilesdataprovider.cpp @@ -195,7 +195,7 @@ QgsCesiumTiledSceneIndex::QgsCesiumTiledSceneIndex( const json &tileset, const Q std::unique_ptr< QgsTiledSceneTile > QgsCesiumTiledSceneIndex::tileFromJson( const json &json, const QUrl &baseUrl, const QgsTiledSceneTile *parent, Qgis::Axis gltfUpAxis ) { - std::unique_ptr< QgsTiledSceneTile > tile = std::make_unique< QgsTiledSceneTile >( mNextTileId++ ); + auto tile = std::make_unique< QgsTiledSceneTile >( mNextTileId++ ); tile->setBaseUrl( baseUrl ); tile->setMetadata( @@ -348,7 +348,7 @@ std::unique_ptr< QgsTiledSceneTile > QgsCesiumTiledSceneIndex::tileFromJson( con QgsTiledSceneNode *QgsCesiumTiledSceneIndex::nodeFromJson( const json &json, const QUrl &baseUrl, QgsTiledSceneNode *parent, Qgis::Axis gltfUpAxis ) { std::unique_ptr< QgsTiledSceneTile > tile = tileFromJson( json, baseUrl, parent ? parent->tile() : nullptr, gltfUpAxis ); - std::unique_ptr< QgsTiledSceneNode > newNode = std::make_unique< QgsTiledSceneNode >( tile.release() ); + auto newNode = std::make_unique< QgsTiledSceneNode >( tile.release() ); mNodeMap.insert( newNode->tile()->id(), newNode.get() ); if ( parent ) diff --git a/src/core/tiledscene/qgstiledsceneboundingvolume.cpp b/src/core/tiledscene/qgstiledsceneboundingvolume.cpp index 082ca82f7346..95d0c2e72efc 100644 --- a/src/core/tiledscene/qgstiledsceneboundingvolume.cpp +++ b/src/core/tiledscene/qgstiledsceneboundingvolume.cpp @@ -66,7 +66,7 @@ QgsBox3D QgsTiledSceneBoundingVolume::bounds( const QgsCoordinateTransform &tran QgsAbstractGeometry *QgsTiledSceneBoundingVolume::as2DGeometry( const QgsCoordinateTransform &transform, Qgis::TransformDirection direction ) const { - std::unique_ptr< QgsPolygon > polygon = std::make_unique< QgsPolygon >(); + auto polygon = std::make_unique< QgsPolygon >(); const QVector< QgsVector3D > corners = mBox.corners(); QVector< double > x; @@ -88,7 +88,7 @@ QgsAbstractGeometry *QgsTiledSceneBoundingVolume::as2DGeometry( const QgsCoordin transform.transformInPlace( x, y, z, direction ); } - std::unique_ptr< QgsMultiPoint > mp = std::make_unique< QgsMultiPoint >( x, y ); + auto mp = std::make_unique< QgsMultiPoint >( x, y ); QgsGeos geosMp( mp.get() ); return geosMp.convexHull(); } diff --git a/src/core/tiledscene/qgstiledscenelayerelevationproperties.cpp b/src/core/tiledscene/qgstiledscenelayerelevationproperties.cpp index 2659af5105b6..233ae977cc2f 100644 --- a/src/core/tiledscene/qgstiledscenelayerelevationproperties.cpp +++ b/src/core/tiledscene/qgstiledscenelayerelevationproperties.cpp @@ -48,7 +48,7 @@ bool QgsTiledSceneLayerElevationProperties::readXml( const QDomElement &element, QgsTiledSceneLayerElevationProperties *QgsTiledSceneLayerElevationProperties::clone() const { - std::unique_ptr< QgsTiledSceneLayerElevationProperties > res = std::make_unique< QgsTiledSceneLayerElevationProperties >( nullptr ); + auto res = std::make_unique< QgsTiledSceneLayerElevationProperties >( nullptr ); res->copyCommonProperties( this ); return res.release(); diff --git a/src/core/tiledscene/qgstiledscenetexturerenderer.cpp b/src/core/tiledscene/qgstiledscenetexturerenderer.cpp index 6a477f5f1f47..43b3799e387c 100644 --- a/src/core/tiledscene/qgstiledscenetexturerenderer.cpp +++ b/src/core/tiledscene/qgstiledscenetexturerenderer.cpp @@ -34,7 +34,7 @@ QString QgsTiledSceneTextureRenderer::type() const QgsTiledSceneRenderer *QgsTiledSceneTextureRenderer::clone() const { - std::unique_ptr< QgsTiledSceneTextureRenderer > res = std::make_unique< QgsTiledSceneTextureRenderer >(); + auto res = std::make_unique< QgsTiledSceneTextureRenderer >(); res->setFillSymbol( mFillSymbol->clone() ); copyCommonProperties( res.get() ); @@ -44,7 +44,7 @@ QgsTiledSceneRenderer *QgsTiledSceneTextureRenderer::clone() const QgsTiledSceneRenderer *QgsTiledSceneTextureRenderer::create( QDomElement &element, const QgsReadWriteContext &context ) { - std::unique_ptr< QgsTiledSceneTextureRenderer > r = std::make_unique< QgsTiledSceneTextureRenderer >(); + auto r = std::make_unique< QgsTiledSceneTextureRenderer >(); { const QDomElement fillSymbolElem = element.firstChildElement( QStringLiteral( "fillSymbol" ) ); if ( !fillSymbolElem.isNull() ) diff --git a/src/core/tiledscene/qgstiledscenewireframerenderer.cpp b/src/core/tiledscene/qgstiledscenewireframerenderer.cpp index 1b1a0a534a6d..fb9614d20d4f 100644 --- a/src/core/tiledscene/qgstiledscenewireframerenderer.cpp +++ b/src/core/tiledscene/qgstiledscenewireframerenderer.cpp @@ -35,7 +35,7 @@ QString QgsTiledSceneWireframeRenderer::type() const QgsTiledSceneRenderer *QgsTiledSceneWireframeRenderer::clone() const { - std::unique_ptr< QgsTiledSceneWireframeRenderer > res = std::make_unique< QgsTiledSceneWireframeRenderer >(); + auto res = std::make_unique< QgsTiledSceneWireframeRenderer >(); res->setFillSymbol( mFillSymbol->clone() ); res->setLineSymbol( mLineSymbol->clone() ); @@ -48,7 +48,7 @@ QgsTiledSceneRenderer *QgsTiledSceneWireframeRenderer::clone() const QgsTiledSceneRenderer *QgsTiledSceneWireframeRenderer::create( QDomElement &element, const QgsReadWriteContext &context ) { - std::unique_ptr< QgsTiledSceneWireframeRenderer > r = std::make_unique< QgsTiledSceneWireframeRenderer >(); + auto r = std::make_unique< QgsTiledSceneWireframeRenderer >(); { const QDomElement fillSymbolElem = element.firstChildElement( QStringLiteral( "fillSymbol" ) ); if ( !fillSymbolElem.isNull() ) diff --git a/src/core/vector/qgsfielddomain.cpp b/src/core/vector/qgsfielddomain.cpp index 058d6ba9a77a..d73d96454aa3 100644 --- a/src/core/vector/qgsfielddomain.cpp +++ b/src/core/vector/qgsfielddomain.cpp @@ -85,7 +85,7 @@ QString QgsCodedFieldDomain::typeName() const QgsCodedFieldDomain *QgsCodedFieldDomain::clone() const { - std::unique_ptr< QgsCodedFieldDomain > res = std::make_unique< QgsCodedFieldDomain >( mName, mDescription, mFieldType, mValues ); + auto res = std::make_unique< QgsCodedFieldDomain >( mName, mDescription, mFieldType, mValues ); res->mSplitPolicy = mSplitPolicy; res->mMergePolicy = mMergePolicy; return res.release(); @@ -122,7 +122,7 @@ QString QgsRangeFieldDomain::typeName() const QgsRangeFieldDomain *QgsRangeFieldDomain::clone() const { - std::unique_ptr< QgsRangeFieldDomain > res = std::make_unique< QgsRangeFieldDomain >( mName, mDescription, mFieldType, mMin, mMinIsInclusive, mMax, mMaxIsInclusive ); + auto res = std::make_unique< QgsRangeFieldDomain >( mName, mDescription, mFieldType, mMin, mMinIsInclusive, mMax, mMaxIsInclusive ); res->mSplitPolicy = mSplitPolicy; res->mMergePolicy = mMergePolicy; return res.release(); @@ -157,7 +157,7 @@ QString QgsGlobFieldDomain::typeName() const QgsGlobFieldDomain *QgsGlobFieldDomain::clone() const { - std::unique_ptr< QgsGlobFieldDomain > res = std::make_unique< QgsGlobFieldDomain >( mName, mDescription, mFieldType, mGlob ); + auto res = std::make_unique< QgsGlobFieldDomain >( mName, mDescription, mFieldType, mGlob ); res->mSplitPolicy = mSplitPolicy; res->mMergePolicy = mMergePolicy; return res.release(); diff --git a/src/core/vector/qgsvectorlayer.cpp b/src/core/vector/qgsvectorlayer.cpp index 690ae1fdd73c..a08758adeaa2 100644 --- a/src/core/vector/qgsvectorlayer.cpp +++ b/src/core/vector/qgsvectorlayer.cpp @@ -1366,12 +1366,9 @@ bool QgsVectorLayer::addFeature( QgsFeature &feature, Flags ) bool success = mEditBuffer->addFeature( feature ); - if ( success ) + if ( success && mJoinBuffer->containsJoins() ) { - updateExtents(); - - if ( mJoinBuffer->containsJoins() ) - success = mJoinBuffer->addFeature( feature ); + success = mJoinBuffer->addFeature( feature ); } return success; @@ -3820,14 +3817,7 @@ bool QgsVectorLayer::deleteFeature( QgsFeatureId fid, QgsVectorLayer::DeleteCont if ( !mEditBuffer ) return false; - bool res = deleteFeatureCascade( fid, context ); - - if ( res ) - { - updateExtents(); - } - - return res; + return deleteFeatureCascade( fid, context ); } bool QgsVectorLayer::deleteFeatures( const QgsFeatureIds &fids, QgsVectorLayer::DeleteContext *context ) @@ -4407,7 +4397,7 @@ void QgsVectorLayer::destroyEditCommand() // and delete, so we add a dummy obsolete command to force this to occur. // Pushing the new command deletes the destroyed one, and since the new // command is obsolete it's automatically deleted by the undo stack. - std::unique_ptr< QUndoCommand > command = std::make_unique< QUndoCommand >(); + auto command = std::make_unique< QUndoCommand >(); command->setObsolete( true ); undoStack()->push( command.release() ); @@ -5080,7 +5070,7 @@ void QgsVectorLayer::createEditBuffer() connect( mEditBuffer, &QgsVectorLayerEditBuffer::layerModified, this, &QgsVectorLayer::invalidateSymbolCountedFlag ); connect( mEditBuffer, &QgsVectorLayerEditBuffer::layerModified, this, &QgsVectorLayer::layerModified ); // TODO[MD]: necessary? //connect( mEditBuffer, SIGNAL( layerModified() ), this, SLOT( triggerRepaint() ) ); // TODO[MD]: works well? - connect( mEditBuffer, &QgsVectorLayerEditBuffer::featureAdded, this, &QgsVectorLayer::featureAdded ); + connect( mEditBuffer, &QgsVectorLayerEditBuffer::featureAdded, this, &QgsVectorLayer::onFeatureAdded ); connect( mEditBuffer, &QgsVectorLayerEditBuffer::featureDeleted, this, &QgsVectorLayer::onFeatureDeleted ); connect( mEditBuffer, &QgsVectorLayerEditBuffer::geometryChanged, this, &QgsVectorLayer::geometryChanged ); connect( mEditBuffer, &QgsVectorLayerEditBuffer::attributeValueChanged, this, &QgsVectorLayer::attributeValueChanged ); @@ -5841,7 +5831,10 @@ QString QgsVectorLayer::htmlMetadata() const } // Extent - myMetadata += QStringLiteral( "" ) + tr( "Extent" ) + QStringLiteral( "" ) + extent().toString() + QStringLiteral( "\n" ); + // Try to display extent 3D by default. If empty (probably because the data is 2D), fallback to the 2D version + const QgsBox3D extentBox3D = extent3D(); + const QString extentAsStr = !extentBox3D.isEmpty() ? extentBox3D.toString() : extent().toString(); + myMetadata += QStringLiteral( "" ) + tr( "Extent" ) + QStringLiteral( "" ) + extentAsStr + QStringLiteral( "\n" ); } // feature count @@ -5963,10 +5956,21 @@ void QgsVectorLayer::onJoinedFieldsChanged() updateFields(); } +void QgsVectorLayer::onFeatureAdded( QgsFeatureId fid ) +{ + QGIS_PROTECT_QOBJECT_THREAD_ACCESS + + updateExtents(); + + emit featureAdded( fid ); +} + void QgsVectorLayer::onFeatureDeleted( QgsFeatureId fid ) { QGIS_PROTECT_QOBJECT_THREAD_ACCESS + updateExtents(); + if ( mEditCommandActive || mCommitChangesActive ) { mDeletedFids << fid; diff --git a/src/core/vector/qgsvectorlayer.h b/src/core/vector/qgsvectorlayer.h index 725e53fc6e19..9d92063ceaa5 100644 --- a/src/core/vector/qgsvectorlayer.h +++ b/src/core/vector/qgsvectorlayer.h @@ -2797,6 +2797,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte void onFeatureCounterCompleted(); void onFeatureCounterTerminated(); void onJoinedFieldsChanged(); + void onFeatureAdded( QgsFeatureId fid ); void onFeatureDeleted( QgsFeatureId fid ); void onRelationsLoaded(); void onSymbolsCounted(); diff --git a/src/core/vector/qgsvectorlayereditbuffer.cpp b/src/core/vector/qgsvectorlayereditbuffer.cpp index 517b7cd52002..7a83a3e02556 100644 --- a/src/core/vector/qgsvectorlayereditbuffer.cpp +++ b/src/core/vector/qgsvectorlayereditbuffer.cpp @@ -294,7 +294,9 @@ bool QgsVectorLayerEditBuffer::changeAttributeValue( QgsFeatureId fid, int field if ( field < 0 || field >= L->fields().count() || L->fields().fieldOrigin( field ) == Qgis::FieldOrigin::Join || L->fields().fieldOrigin( field ) == Qgis::FieldOrigin::Expression ) + { return false; + } L->undoStack()->push( new QgsVectorLayerUndoCommandChangeAttribute( this, fid, field, newValue, oldValue ) ); return true; @@ -503,7 +505,7 @@ QString QgsVectorLayerEditBuffer::dumpEditBuffer() } #endif -void QgsVectorLayerEditBuffer::handleAttributeAdded( int index ) +void QgsVectorLayerEditBuffer::handleAttributeAdded( int index, const QgsField &field ) { // go through the changed attributes map and adapt indices QgsChangedAttributesMap::iterator it = mChangedAttributeValues.begin(); @@ -519,6 +521,21 @@ void QgsVectorLayerEditBuffer::handleAttributeAdded( int index ) QgsAttributes attrs = featureIt->attributes(); attrs.insert( index, QVariant() ); featureIt->setAttributes( attrs ); + QgsFields fields; + const QgsFields oldFields = featureIt->fields(); + for ( int i = 0; i < oldFields.size(); i++ ) + { + if ( i == index ) + { + fields.append( field, L->fields().fieldOrigin( L->fields().indexFromName( field.name() ) ) ); + } + fields.append( oldFields.at( i ), oldFields.fieldOrigin( i ) ); + } + if ( index == oldFields.size() ) + { + fields.append( field, L->fields().fieldOrigin( L->fields().indexFromName( field.name() ) ) ); + } + featureIt->setFields( fields, false ); } // go through renamed attributes and adapt @@ -559,6 +576,9 @@ void QgsVectorLayerEditBuffer::handleAttributeDeleted( int index ) QgsAttributes attrs = featureIt->attributes(); attrs.remove( index ); featureIt->setAttributes( attrs ); + QgsFields fields = featureIt->fields(); + fields.remove( index ); + featureIt->setFields( fields, false ); } // go through rename attributes and adapt @@ -919,6 +939,7 @@ bool QgsVectorLayerEditBuffer::commitChangesAddFeatures( bool &featuresAdded, QS // not be sent to the data provider. Refs #18784 for ( int i = 0; i < featuresToAdd.count(); ++i ) { + // Empty the feature's fields so the up-to-date fields from the data provider is used to match attributes QgsVectorLayerUtils::matchAttributesToFields( featuresToAdd[i], L->dataProvider()->fields() ); } diff --git a/src/core/vector/qgsvectorlayereditbuffer.h b/src/core/vector/qgsvectorlayereditbuffer.h index c5e3acd4baa5..88b566a32534 100644 --- a/src/core/vector/qgsvectorlayereditbuffer.h +++ b/src/core/vector/qgsvectorlayereditbuffer.h @@ -297,7 +297,7 @@ class CORE_EXPORT QgsVectorLayerEditBuffer : public QObject void updateChangedAttributes( QgsFeature &f ); //! Update added and changed features after addition of an attribute - void handleAttributeAdded( int index ); + void handleAttributeAdded( int index, const QgsField &field ); //! Update added and changed features after removal of an attribute void handleAttributeDeleted( int index ); diff --git a/src/core/vector/qgsvectorlayereditutils.cpp b/src/core/vector/qgsvectorlayereditutils.cpp index 17df3e729fb3..0ab5a0260061 100644 --- a/src/core/vector/qgsvectorlayereditutils.cpp +++ b/src/core/vector/qgsvectorlayereditutils.cpp @@ -211,6 +211,28 @@ Qgis::GeometryOperationResult staticAddRing( QgsVectorLayer *layer, std::unique_ return success ? Qgis::GeometryOperationResult::Success : addRingReturnCode; } +///@cond PRIVATE +double QgsVectorLayerEditUtils::getTopologicalSearchRadius( const QgsVectorLayer *layer ) +{ + double threshold = layer->geometryOptions()->geometryPrecision(); + + if ( qgsDoubleNear( threshold, 0.0 ) ) + { + threshold = 1e-8; + + if ( layer->crs().mapUnits() == Qgis::DistanceUnit::Meters ) + { + threshold = 0.001; + } + else if ( layer->crs().mapUnits() == Qgis::DistanceUnit::Feet ) + { + threshold = 0.0001; + } + } + return threshold; +} +///@endcond + Qgis::GeometryOperationResult QgsVectorLayerEditUtils::addRing( const QVector &ring, const QgsFeatureIds &targetFeatureIds, QgsFeatureId *modifiedFeatureId ) { QgsPointSequence l; @@ -801,21 +823,7 @@ int QgsVectorLayerEditUtils::addTopologicalPoints( const QgsPoint &p ) double segmentSearchEpsilon = mLayer->crs().isGeographic() ? 1e-12 : 1e-8; //work with a tolerance because coordinate projection may introduce some rounding - double threshold = mLayer->geometryOptions()->geometryPrecision(); - - if ( qgsDoubleNear( threshold, 0.0 ) ) - { - threshold = 1e-8; - - if ( mLayer->crs().mapUnits() == Qgis::DistanceUnit::Meters ) - { - threshold = 0.001; - } - else if ( mLayer->crs().mapUnits() == Qgis::DistanceUnit::Feet ) - { - threshold = 0.0001; - } - } + double threshold = getTopologicalSearchRadius( mLayer ); QgsRectangle searchRect( p, p, false ); searchRect.grow( threshold ); diff --git a/src/core/vector/qgsvectorlayereditutils.h b/src/core/vector/qgsvectorlayereditutils.h index c2443c4d241e..7571042fae32 100644 --- a/src/core/vector/qgsvectorlayereditutils.h +++ b/src/core/vector/qgsvectorlayereditutils.h @@ -282,6 +282,10 @@ class CORE_EXPORT QgsVectorLayerEditUtils */ bool mergeFeatures( const QgsFeatureId &targetFeatureId, const QgsFeatureIds &mergeFeatureIds, const QgsAttributes &mergeAttributes, const QgsGeometry &unionGeometry, QString &errorMessage SIP_OUT ); + ///@cond PRIVATE + static double getTopologicalSearchRadius( const QgsVectorLayer *layer ) SIP_SKIP; + ///@endcond + private: /** diff --git a/src/core/vector/qgsvectorlayerelevationproperties.cpp b/src/core/vector/qgsvectorlayerelevationproperties.cpp index dfeb624367a4..4c8b2cb0e284 100644 --- a/src/core/vector/qgsvectorlayerelevationproperties.cpp +++ b/src/core/vector/qgsvectorlayerelevationproperties.cpp @@ -55,7 +55,8 @@ QDomElement QgsVectorLayerElevationProperties::writeXml( QDomElement &parentElem element.setAttribute( QStringLiteral( "extrusionEnabled" ), mEnableExtrusion ? QStringLiteral( "1" ) : QStringLiteral( "0" ) ); element.setAttribute( QStringLiteral( "extrusion" ), qgsDoubleToString( mExtrusionHeight ) ); element.setAttribute( QStringLiteral( "customToleranceEnabled" ), mEnableCustomTolerance ? QStringLiteral( "1" ) : QStringLiteral( "0" ) ); - element.setAttribute( QStringLiteral( "customTolerance" ), qgsDoubleToString( mCustomTolerance ) ); + if ( mCustomTolerance != 0 ) + element.setAttribute( QStringLiteral( "customTolerance" ), qgsDoubleToString( mCustomTolerance ) ); element.setAttribute( QStringLiteral( "clamping" ), qgsEnumValueToKey( mClamping ) ); element.setAttribute( QStringLiteral( "binding" ), qgsEnumValueToKey( mBinding ) ); element.setAttribute( QStringLiteral( "type" ), qgsEnumValueToKey( mType ) ); @@ -151,7 +152,7 @@ void QgsVectorLayerElevationProperties::setDefaultsFromLayer( QgsMapLayer *layer if ( QgsWkbTypes::hasZ( vlayer->wkbType() ) ) { - mClamping = Qgis::AltitudeClamping::Relative; + mClamping = Qgis::AltitudeClamping::Absolute; } else { @@ -161,7 +162,7 @@ void QgsVectorLayerElevationProperties::setDefaultsFromLayer( QgsMapLayer *layer QgsVectorLayerElevationProperties *QgsVectorLayerElevationProperties::clone() const { - std::unique_ptr< QgsVectorLayerElevationProperties > res = std::make_unique< QgsVectorLayerElevationProperties >( nullptr ); + auto res = std::make_unique< QgsVectorLayerElevationProperties >( nullptr ); res->setClamping( mClamping ); res->setBinding( mBinding ); res->setType( mType ); @@ -425,13 +426,13 @@ void QgsVectorLayerElevationProperties::setShowMarkerSymbolInSurfacePlots( bool void QgsVectorLayerElevationProperties::setDefaultProfileLineSymbol( const QColor &color ) { - std::unique_ptr< QgsSimpleLineSymbolLayer > profileLineLayer = std::make_unique< QgsSimpleLineSymbolLayer >( color, 0.6 ); + auto profileLineLayer = std::make_unique< QgsSimpleLineSymbolLayer >( color, 0.6 ); mProfileLineSymbol = std::make_unique< QgsLineSymbol>( QgsSymbolLayerList( { profileLineLayer.release() } ) ); } void QgsVectorLayerElevationProperties::setDefaultProfileMarkerSymbol( const QColor &color ) { - std::unique_ptr< QgsSimpleMarkerSymbolLayer > profileMarkerLayer = std::make_unique< QgsSimpleMarkerSymbolLayer >( Qgis::MarkerShape::Diamond, 3 ); + auto profileMarkerLayer = std::make_unique< QgsSimpleMarkerSymbolLayer >( Qgis::MarkerShape::Diamond, 3 ); profileMarkerLayer->setColor( color ); profileMarkerLayer->setStrokeWidth( 0.2 ); profileMarkerLayer->setStrokeColor( color.darker( 140 ) ); @@ -440,7 +441,7 @@ void QgsVectorLayerElevationProperties::setDefaultProfileMarkerSymbol( const QCo void QgsVectorLayerElevationProperties::setDefaultProfileFillSymbol( const QColor &color ) { - std::unique_ptr< QgsSimpleFillSymbolLayer > profileFillLayer = std::make_unique< QgsSimpleFillSymbolLayer >( color ); + auto profileFillLayer = std::make_unique< QgsSimpleFillSymbolLayer >( color ); profileFillLayer->setStrokeWidth( 0.2 ); profileFillLayer->setStrokeColor( color.darker( 140 ) ); mProfileFillSymbol = std::make_unique< QgsFillSymbol>( QgsSymbolLayerList( { profileFillLayer.release() } ) ); diff --git a/src/core/vector/qgsvectorlayerexporter.cpp b/src/core/vector/qgsvectorlayerexporter.cpp index 1c8feb6488ea..4a6ee452508e 100644 --- a/src/core/vector/qgsvectorlayerexporter.cpp +++ b/src/core/vector/qgsvectorlayerexporter.cpp @@ -537,7 +537,7 @@ QgsVectorLayerExporterTask::QgsVectorLayerExporterTask( QgsVectorLayer *layer, c QgsVectorLayerExporterTask *QgsVectorLayerExporterTask::withLayerOwnership( QgsVectorLayer *layer, const QString &uri, const QString &providerKey, const QgsCoordinateReferenceSystem &destinationCrs, const QMap &options ) { - std::unique_ptr< QgsVectorLayerExporterTask > newTask( new QgsVectorLayerExporterTask( layer, uri, providerKey, destinationCrs, options ) ); + auto newTask = std::make_unique( layer, uri, providerKey, destinationCrs, options ); newTask->mOwnsLayer = true; return newTask.release(); } diff --git a/src/core/vector/qgsvectorlayerfeatureiterator.cpp b/src/core/vector/qgsvectorlayerfeatureiterator.cpp index 18569d3e8ca0..611d990e487e 100644 --- a/src/core/vector/qgsvectorlayerfeatureiterator.cpp +++ b/src/core/vector/qgsvectorlayerfeatureiterator.cpp @@ -852,7 +852,7 @@ void QgsVectorLayerFeatureIterator::prepareExpression( int fieldIdx ) const QList &exps = mSource->mExpressionFieldBuffer->expressions(); const int oi = mSource->mFields.fieldOriginIndex( fieldIdx ); - std::unique_ptr exp = std::make_unique( exps[oi].cachedExpression ); + auto exp = std::make_unique( exps[oi].cachedExpression ); QgsDistanceArea da; da.setSourceCrs( mSource->mCrs, QgsProject::instance()->transformContext() ); // skip-keyword-check diff --git a/src/core/vector/qgsvectorlayerprofilegenerator.cpp b/src/core/vector/qgsvectorlayerprofilegenerator.cpp index dfdb408af247..e357406a0eb0 100644 --- a/src/core/vector/qgsvectorlayerprofilegenerator.cpp +++ b/src/core/vector/qgsvectorlayerprofilegenerator.cpp @@ -37,6 +37,7 @@ #include "qgsprofilepoint.h" #include "qgsprofilesnapping.h" #include "qgsexpressioncontextutils.h" +#include "qgsvectorlayerselectionproperties.h" #include // @@ -408,6 +409,11 @@ void QgsVectorLayerProfileResults::renderResultsAsIndividualFeatures( QgsProfile if ( !painter ) return; + // Override project selection color if a layer selection color is defined + QColor selectionColor = qobject_cast( mLayer->selectionProperties() )->selectionColor(); + if ( selectionColor.isValid() ) + context.renderContext().setSelectionColor( selectionColor ); + const QgsScopedQPainterState painterState( painter ); painter->setBrush( Qt::NoBrush ); @@ -425,7 +431,7 @@ void QgsVectorLayerProfileResults::renderResultsAsIndividualFeatures( QgsProfile const QgsRectangle clipPathRect( clipPath.boundingRect() ); - auto renderResult = [&context, &clipPathRect]( const Feature & profileFeature, QgsMarkerSymbol * markerSymbol, QgsLineSymbol * lineSymbol, QgsFillSymbol * fillSymbol ) + auto renderResult = [&context, &clipPathRect]( const Feature & profileFeature, QgsMarkerSymbol * markerSymbol, QgsLineSymbol * lineSymbol, QgsFillSymbol * fillSymbol, bool selected ) { if ( profileFeature.crossSectionGeometry.isEmpty() ) return; @@ -443,14 +449,14 @@ void QgsVectorLayerProfileResults::renderResultsAsIndividualFeatures( QgsProfile { if ( const QgsPoint *point = qgsgeometry_cast< const QgsPoint * >( transformed.constGet() ) ) { - markerSymbol->renderPoint( QPointF( point->x(), point->y() ), nullptr, context.renderContext() ); + markerSymbol->renderPoint( QPointF( point->x(), point->y() ), nullptr, context.renderContext(), -1, selected ); } else if ( const QgsMultiPoint *multipoint = qgsgeometry_cast< const QgsMultiPoint * >( transformed.constGet() ) ) { const int numGeometries = multipoint->numGeometries(); for ( int i = 0; i < numGeometries; ++i ) { - markerSymbol->renderPoint( QPointF( multipoint->pointN( i )->x(), multipoint->pointN( i )->y() ), nullptr, context.renderContext() ); + markerSymbol->renderPoint( QPointF( multipoint->pointN( i )->x(), multipoint->pointN( i )->y() ), nullptr, context.renderContext(), -1, selected ); } } break; @@ -460,14 +466,14 @@ void QgsVectorLayerProfileResults::renderResultsAsIndividualFeatures( QgsProfile { if ( const QgsLineString *line = qgsgeometry_cast< const QgsLineString * >( transformed.constGet() ) ) { - lineSymbol->renderPolyline( line->asQPolygonF(), nullptr, context.renderContext() ); + lineSymbol->renderPolyline( line->asQPolygonF(), nullptr, context.renderContext(), -1, selected ); } else if ( const QgsMultiLineString *multiLinestring = qgsgeometry_cast< const QgsMultiLineString * >( transformed.constGet() ) ) { const int numGeometries = multiLinestring->numGeometries(); for ( int i = 0; i < numGeometries; ++i ) { - lineSymbol->renderPolyline( multiLinestring->lineStringN( i )->asQPolygonF(), nullptr, context.renderContext() ); + lineSymbol->renderPolyline( multiLinestring->lineStringN( i )->asQPolygonF(), nullptr, context.renderContext(), -1, selected ); } } break; @@ -478,14 +484,14 @@ void QgsVectorLayerProfileResults::renderResultsAsIndividualFeatures( QgsProfile if ( const QgsPolygon *polygon = qgsgeometry_cast< const QgsPolygon * >( transformed.constGet() ) ) { if ( const QgsCurve *exterior = polygon->exteriorRing() ) - fillSymbol->renderPolygon( exterior->asQPolygonF(), nullptr, nullptr, context.renderContext() ); + fillSymbol->renderPolygon( exterior->asQPolygonF(), nullptr, nullptr, context.renderContext(), -1, selected ); } else if ( const QgsMultiPolygon *multiPolygon = qgsgeometry_cast< const QgsMultiPolygon * >( transformed.constGet() ) ) { const int numGeometries = multiPolygon->numGeometries(); for ( int i = 0; i < numGeometries; ++i ) { - fillSymbol->renderPolygon( multiPolygon->polygonN( i )->exteriorRing()->asQPolygonF(), nullptr, nullptr, context.renderContext() ); + fillSymbol->renderPolygon( multiPolygon->polygonN( i )->exteriorRing()->asQPolygonF(), nullptr, nullptr, context.renderContext(), -1, selected ); } } break; @@ -539,12 +545,16 @@ void QgsVectorLayerProfileResults::renderResultsAsIndividualFeatures( QgsProfile fill->startRender( context.renderContext() ); const QVector< Feature > profileFeatures = features.value( feature.id() ); + const QgsFeatureIds &selectedFeatureIds = mLayer->selectedFeatureIds(); for ( const Feature &profileFeature : profileFeatures ) { - renderResult( profileFeature, - rendererSymbol->type() == Qgis::SymbolType::Marker ? qgis::down_cast< QgsMarkerSymbol * >( rendererSymbol ) : marker.get(), - rendererSymbol->type() == Qgis::SymbolType::Line ? qgis::down_cast< QgsLineSymbol * >( rendererSymbol ) : line.get(), - rendererSymbol->type() == Qgis::SymbolType::Fill ? qgis::down_cast< QgsFillSymbol * >( rendererSymbol ) : fill.get() ); + renderResult( + profileFeature, + rendererSymbol->type() == Qgis::SymbolType::Marker ? qgis::down_cast( rendererSymbol ) : marker.get(), + rendererSymbol->type() == Qgis::SymbolType::Line ? qgis::down_cast( rendererSymbol ) : line.get(), + rendererSymbol->type() == Qgis::SymbolType::Fill ? qgis::down_cast( rendererSymbol ) : fill.get(), + selectedFeatureIds.contains( profileFeature.featureId ) + ); } marker->stopRender( context.renderContext() ); @@ -568,13 +578,14 @@ void QgsVectorLayerProfileResults::renderResultsAsIndividualFeatures( QgsProfile QgsFeature feature; QgsFeatureIterator it = mLayer->getFeatures( req ); + const QgsFeatureIds &selectedFeatureIds = mLayer->selectedFeatureIds(); while ( it.nextFeature( feature ) ) { context.renderContext().expressionContext().setFeature( feature ); const QVector< Feature > profileFeatures = features.value( feature.id() ); for ( const Feature &profileFeature : profileFeatures ) { - renderResult( profileFeature, mMarkerSymbol.get(), mLineSymbol.get(), mFillSymbol.get() ); + renderResult( profileFeature, mMarkerSymbol.get(), mLineSymbol.get(), mFillSymbol.get(), selectedFeatureIds.contains( profileFeature.featureId ) ); } } mMarkerSymbol->stopRender( context.renderContext() ); @@ -1012,15 +1023,15 @@ void QgsVectorLayerProfileGenerator::processIntersectionCurve( const QgsLineStri // create geometries from vector data if ( mExtrusionEnabled ) { - std::unique_ptr< QgsLineString > ring = std::make_unique< QgsLineString >( newX, newY, newZ ); - std::unique_ptr< QgsLineString > extrudedRing = std::make_unique< QgsLineString >( newX, newY, extrudedZ ); + auto ring = std::make_unique< QgsLineString >( newX, newY, newZ ); + auto extrudedRing = std::make_unique< QgsLineString >( newX, newY, extrudedZ ); std::unique_ptr< QgsLineString > reversedExtrusion( extrudedRing->reversed() ); ring->append( reversedExtrusion.get() ); ring->close(); resultFeature.geometry = QgsGeometry( new QgsPolygon( ring.release() ) ); - std::unique_ptr< QgsLineString > distanceVHeightRing = std::make_unique< QgsLineString >( newDistance, newZ ); - std::unique_ptr< QgsLineString > extrudedDistanceVHeightRing = std::make_unique< QgsLineString >( newDistance, extrudedZ ); + auto distanceVHeightRing = std::make_unique< QgsLineString >( newDistance, newZ ); + auto extrudedDistanceVHeightRing = std::make_unique< QgsLineString >( newDistance, extrudedZ ); std::unique_ptr< QgsLineString > reversedDistanceVHeightExtrusion( extrudedDistanceVHeightRing->reversed() ); distanceVHeightRing->append( reversedDistanceVHeightExtrusion.get() ); distanceVHeightRing->close(); @@ -1227,15 +1238,15 @@ void QgsVectorLayerProfileGenerator::processTriangleIntersectForLine( const QgsP if ( mExtrusionEnabled ) { - std::unique_ptr< QgsLineString > ring = std::make_unique< QgsLineString >( newX, newY, newZ ); - std::unique_ptr< QgsLineString > extrudedRing = std::make_unique< QgsLineString >( newX, newY, extrudedZ ); + auto ring = std::make_unique< QgsLineString >( newX, newY, newZ ); + auto extrudedRing = std::make_unique< QgsLineString >( newX, newY, extrudedZ ); std::unique_ptr< QgsLineString > reversedExtrusion( extrudedRing->reversed() ); ring->append( reversedExtrusion.get() ); ring->close(); transformedParts.append( QgsGeometry( new QgsPolygon( ring.release() ) ) ); - std::unique_ptr< QgsLineString > distanceVHeightRing = std::make_unique< QgsLineString >( newDistance, newZ ); - std::unique_ptr< QgsLineString > extrudedDistanceVHeightRing = std::make_unique< QgsLineString >( newDistance, extrudedZ ); + auto distanceVHeightRing = std::make_unique< QgsLineString >( newDistance, newZ ); + auto extrudedDistanceVHeightRing = std::make_unique< QgsLineString >( newDistance, extrudedZ ); std::unique_ptr< QgsLineString > reversedDistanceVHeightExtrusion( extrudedDistanceVHeightRing->reversed() ); distanceVHeightRing->append( reversedDistanceVHeightExtrusion.get() ); distanceVHeightRing->close(); @@ -1461,7 +1472,7 @@ bool QgsVectorLayerProfileGenerator::generateProfileForPolygons() if ( clampedPolygon->numInteriorRings() == 0 && clampedPolygon->exteriorRing() && clampedPolygon->exteriorRing()->numPoints() == 4 && clampedPolygon->exteriorRing()->isClosed() ) { // special case -- polygon is already a triangle, so no need to tessellate - std::unique_ptr< QgsMultiPolygon > multiPolygon = std::make_unique< QgsMultiPolygon >(); + auto multiPolygon = std::make_unique< QgsMultiPolygon >(); multiPolygon->addGeometry( clampedPolygon.release() ); tessellation = QgsGeometry( std::move( multiPolygon ) ); } diff --git a/src/core/vector/qgsvectorlayerrenderer.cpp b/src/core/vector/qgsvectorlayerrenderer.cpp index 2e682ead38b1..23f3ba641136 100644 --- a/src/core/vector/qgsvectorlayerrenderer.cpp +++ b/src/core/vector/qgsvectorlayerrenderer.cpp @@ -171,8 +171,6 @@ QgsVectorLayerRenderer::QgsVectorLayerRenderer( QgsVectorLayer *layer, QgsRender // set editing vertex markers style (main renderer only) mRenderer->setVertexMarkerAppearance( mVertexMarkerStyle, mVertexMarkerSize ); } - if ( !mNoSetLayerExpressionContext ) - renderContext()->expressionContext() << QgsExpressionContextUtils::layerScope( layer ); for ( const std::unique_ptr< QgsFeatureRenderer > &renderer : mRenderers ) { @@ -692,7 +690,7 @@ void QgsVectorLayerRenderer::drawRendererLevels( QgsFeatureRenderer *renderer, Q } QgsExpressionContextScope *symbolScope = QgsExpressionContextUtils::updateSymbolScope( nullptr, new QgsExpressionContextScope() ); - std::unique_ptr< QgsExpressionContextScopePopper > scopePopper = std::make_unique< QgsExpressionContextScopePopper >( context.expressionContext(), symbolScope ); + auto scopePopper = std::make_unique< QgsExpressionContextScopePopper >( context.expressionContext(), symbolScope ); std::unique_ptr< QgsGeometryEngine > clipEngine; diff --git a/src/core/vector/qgsvectorlayerselectionproperties.cpp b/src/core/vector/qgsvectorlayerselectionproperties.cpp index fe01e2fb3499..d4c6774e4c07 100644 --- a/src/core/vector/qgsvectorlayerselectionproperties.cpp +++ b/src/core/vector/qgsvectorlayerselectionproperties.cpp @@ -65,7 +65,7 @@ bool QgsVectorLayerSelectionProperties::readXml( const QDomElement &element, con QgsVectorLayerSelectionProperties *QgsVectorLayerSelectionProperties::clone() const { - std::unique_ptr< QgsVectorLayerSelectionProperties > res = std::make_unique< QgsVectorLayerSelectionProperties >( nullptr ); + auto res = std::make_unique< QgsVectorLayerSelectionProperties >( nullptr ); res->mSelectionRenderingMode = mSelectionRenderingMode; res->mSelectionColor = mSelectionColor; res->mSelectionSymbol.reset( mSelectionSymbol ? mSelectionSymbol->clone() : nullptr ); diff --git a/src/core/vector/qgsvectorlayerundocommand.cpp b/src/core/vector/qgsvectorlayerundocommand.cpp index eb2287593fa7..1743b9ddcebb 100644 --- a/src/core/vector/qgsvectorlayerundocommand.cpp +++ b/src/core/vector/qgsvectorlayerundocommand.cpp @@ -334,7 +334,7 @@ void QgsVectorLayerUndoCommandAddAttribute::undo() void QgsVectorLayerUndoCommandAddAttribute::redo() { mBuffer->mAddedAttributes.append( mField ); - mBuffer->handleAttributeAdded( mFieldIndex ); + mBuffer->handleAttributeAdded( mFieldIndex, mField ); mBuffer->updateLayerFields(); emit mBuffer->attributeAdded( mFieldIndex ); @@ -391,7 +391,7 @@ void QgsVectorLayerUndoCommandDeleteAttribute::undo() } mBuffer->updateLayerFields(); - mBuffer->handleAttributeAdded( mFieldIndex ); // update changed attributes + new features + mBuffer->handleAttributeAdded( mFieldIndex, mOldField ); // update changed attributes + new features if ( !mOldName.isEmpty() ) { diff --git a/src/core/vector/qgsvectorlayerundopassthroughcommand.cpp b/src/core/vector/qgsvectorlayerundopassthroughcommand.cpp index 3b824bf0a5e9..36d984a4da3f 100644 --- a/src/core/vector/qgsvectorlayerundopassthroughcommand.cpp +++ b/src/core/vector/qgsvectorlayerundopassthroughcommand.cpp @@ -393,7 +393,13 @@ void QgsVectorLayerUndoPassthroughCommandAddAttribute::undo() const int attr = mBuffer->L->dataProvider()->fieldNameIndex( mField.name() ); if ( rollBackToSavePoint() ) { - mBuffer->L->dataProvider()->deleteAttributes( QgsAttributeIds() << attr ); + // GDAL SQLite-based drivers (since version 3.11) keep the fields in sync with + // the backend after a rollback, to stay on the safe side check if the field + // isn't already gone + if ( mBuffer->L->dataProvider()->fieldNameIndex( mField.name() ) != -1 ) + { + mBuffer->L->dataProvider()->deleteAttributes( QgsAttributeIds() << attr ); + } mBuffer->mAddedAttributes.removeAll( mField ); mBuffer->updateLayerFields(); emit mBuffer->attributeDeleted( attr ); @@ -432,11 +438,26 @@ void QgsVectorLayerUndoPassthroughCommandDeleteAttribute::undo() // note that the addAttributes here is only necessary to inform the provider that // an attribute is added back after the rollBackToSavePoint mBuffer->L->dataProvider()->clearErrors(); - if ( mBuffer->L->dataProvider()->addAttributes( QList() << mField ) && rollBackToSavePoint() && ! mBuffer->L->dataProvider()->hasErrors() ) + if ( rollBackToSavePoint() ) { - mBuffer->mDeletedAttributeIds.removeOne( mOriginalFieldIndex ); - mBuffer->updateLayerFields(); - emit mBuffer->attributeAdded( mOriginalFieldIndex ); + // GDA SQLite-based drivers (since version 3.11) keep the fields in sync with + // the backend after a rollback, to stay on the safe side check if the field + // isn't already there + bool ok = true; + if ( mBuffer->L->dataProvider()->fields().indexFromName( mField.name() ) == -1 ) + { + ok = mBuffer->L->dataProvider()->addAttributes( QList() << mField ); + } + if ( ok && ! mBuffer->L->dataProvider()->hasErrors() ) + { + mBuffer->mDeletedAttributeIds.removeOne( mOriginalFieldIndex ); + mBuffer->updateLayerFields(); + emit mBuffer->attributeAdded( mOriginalFieldIndex ); + } + else + { + setError(); + } } else { @@ -474,10 +495,25 @@ void QgsVectorLayerUndoPassthroughCommandRenameAttribute::undo() QgsFieldNameMap map; map[ mAttr ] = mOldName; mBuffer->L->dataProvider()->clearErrors(); - if ( mBuffer->L->dataProvider()->renameAttributes( map ) && rollBackToSavePoint() && ! mBuffer->L->dataProvider()->hasErrors() ) + if ( rollBackToSavePoint() ) { - mBuffer->updateLayerFields(); - emit mBuffer->attributeRenamed( mAttr, mOldName ); + // GDAL SQLite-based drivers (since version 3.11) keep the fields in sync with + // the backend after a rollback, to stay on the safe side check if the field + // isn't already renamed + bool ok = true; + if ( mBuffer->L->dataProvider()->fields().indexFromName( mOldName ) == -1 ) + { + ok = mBuffer->L->dataProvider()->renameAttributes( map ); + } + if ( ok && ! mBuffer->L->dataProvider()->hasErrors() ) + { + mBuffer->updateLayerFields(); + emit mBuffer->attributeRenamed( mAttr, mOldName ); + } + else + { + setError(); + } } else { diff --git a/src/core/vectortile/qgsmapboxglstyleconverter.cpp b/src/core/vectortile/qgsmapboxglstyleconverter.cpp index c01281771b3f..bd3a9ac4f916 100644 --- a/src/core/vectortile/qgsmapboxglstyleconverter.cpp +++ b/src/core/vectortile/qgsmapboxglstyleconverter.cpp @@ -1716,7 +1716,7 @@ void QgsMapBoxGlStyleConverter::parseSymbolLayer( const QVariantMap &jsonLayer, case QMetaType::Type::QVariantMap: { QVariantMap rotateMap = jsonTextRotate.toMap(); - if ( rotateMap.contains( QStringLiteral( "property" ) ) && rotateMap[QStringLiteral( "type" )].toString() == QStringLiteral( "identity" ) ) + if ( rotateMap.contains( QStringLiteral( "property" ) ) && rotateMap[QStringLiteral( "type" )].toString() == QLatin1String( "identity" ) ) { const QgsProperty property = QgsProperty::fromExpression( rotateMap[QStringLiteral( "property" )].toString() ); ddLabelProperties.setProperty( QgsPalLayerSettings::Property::LabelRotation, property ); @@ -4045,7 +4045,7 @@ void QgsMapBoxGlStyleConverter::parseRasterSource( const QVariantMap &source, co context = tmpContext.get(); } - std::unique_ptr< QgsMapBoxGlStyleRasterSource > raster = std::make_unique< QgsMapBoxGlStyleRasterSource >( name ); + auto raster = std::make_unique< QgsMapBoxGlStyleRasterSource >( name ); if ( raster->setFromJson( source, context ) ) mSources.append( raster.release() ); } @@ -4194,7 +4194,7 @@ QgsRasterLayer *QgsMapBoxGlStyleRasterSource::toRasterLayer() const parts.insert( QStringLiteral( "zmax" ), QString::number( mMaxZoom ) ); parts.insert( QStringLiteral( "zmin" ), QString::number( mMinZoom ) ); - std::unique_ptr< QgsRasterLayer > rl = std::make_unique< QgsRasterLayer >( QgsProviderRegistry::instance()->encodeUri( QStringLiteral( "wms" ), parts ), name(), QStringLiteral( "wms" ) ); + auto rl = std::make_unique< QgsRasterLayer >( QgsProviderRegistry::instance()->encodeUri( QStringLiteral( "wms" ), parts ), name(), QStringLiteral( "wms" ) ); return rl.release(); } diff --git a/src/core/vectortile/qgsmbtilesvectortiledataprovider.cpp b/src/core/vectortile/qgsmbtilesvectortiledataprovider.cpp index 0dff182ce931..f037da8876db 100644 --- a/src/core/vectortile/qgsmbtilesvectortiledataprovider.cpp +++ b/src/core/vectortile/qgsmbtilesvectortiledataprovider.cpp @@ -59,15 +59,26 @@ QgsMbTilesVectorTileDataProvider::QgsMbTilesVectorTileDataProvider( const QStrin QgsDebugMsgLevel( QStringLiteral( "name: " ) + reader.metadataValue( QStringLiteral( "name" ) ), 2 ); - mMatrixSet = QgsVectorTileMatrixSet::fromWebMercator(); - bool minZoomOk, maxZoomOk; const int minZoom = reader.metadataValue( QStringLiteral( "minzoom" ) ).toInt( &minZoomOk ); const int maxZoom = reader.metadataValue( QStringLiteral( "maxzoom" ) ).toInt( &maxZoomOk ); - if ( minZoomOk ) - mMatrixSet.dropMatricesOutsideZoomRange( minZoom, 99 ); - if ( maxZoomOk ) - mMatrixSet.dropMatricesOutsideZoomRange( 0, maxZoom ); + if ( minZoomOk && maxZoomOk ) + { + mMatrixSet = QgsVectorTileMatrixSet::fromWebMercator( minZoom, maxZoom ); + } + else if ( minZoomOk ) + { + mMatrixSet = QgsVectorTileMatrixSet::fromWebMercator( minZoom, 99 ); + } + else if ( maxZoomOk ) + { + mMatrixSet = QgsVectorTileMatrixSet::fromWebMercator( 0, maxZoom ); + } + else + { + mMatrixSet = QgsVectorTileMatrixSet::fromWebMercator(); + } + QgsDebugMsgLevel( QStringLiteral( "zoom range: %1 - %2" ).arg( mMatrixSet.minimumZoom() ).arg( mMatrixSet.maximumZoom() ), 2 ); QgsRectangle r = reader.extent(); diff --git a/src/core/vectortile/qgsvectortilelayerrenderer.cpp b/src/core/vectortile/qgsvectortilelayerrenderer.cpp index 3e854dd931e5..797e960615b4 100644 --- a/src/core/vectortile/qgsvectortilelayerrenderer.cpp +++ b/src/core/vectortile/qgsvectortilelayerrenderer.cpp @@ -224,6 +224,15 @@ bool QgsVectorTileLayerRenderer::render() mErrors.append( asyncLoader->error() ); } + // Register labels features when all tiles are fetched to ensure consistent labeling + if ( mLabelProvider ) + { + for ( const auto &tile : mTileDataMap ) + { + mLabelProvider->registerTileFeatures( tile, ctx ); + } + } + if ( ctx.flags() & Qgis::RenderContextFlag::DrawSelection ) mRenderer->renderSelectedFeatures( mSelectedFeatures, ctx ); @@ -309,8 +318,9 @@ void QgsVectorTileLayerRenderer::decodeAndDrawTile( const QgsVectorTileRawData & mTotalDrawTime += tDraw.elapsed(); } + // Store tile for later use if ( mLabelProvider ) - mLabelProvider->registerTileFeatures( tile, ctx ); + mTileDataMap.insert( tile.id().toString(), tile ); if ( mDrawTileBoundaries ) { diff --git a/src/core/vectortile/qgsvectortilelayerrenderer.h b/src/core/vectortile/qgsvectortilelayerrenderer.h index 127f55d860a7..e024d636b418 100644 --- a/src/core/vectortile/qgsvectortilelayerrenderer.h +++ b/src/core/vectortile/qgsvectortilelayerrenderer.h @@ -71,6 +71,9 @@ class QgsVectorTileLayerRenderer : public QgsMapLayerRenderer */ QgsVectorTileLabelProvider *mLabelProvider = nullptr; + // Decoded tile data + QMap mTileDataMap; + //! Whether to draw boundaries of tiles (useful for debugging) bool mDrawTileBoundaries = false; diff --git a/src/core/vectortile/qgsvectortilemvtdecoder.cpp b/src/core/vectortile/qgsvectortilemvtdecoder.cpp index 7148bdcade67..a3fb0dbe0691 100644 --- a/src/core/vectortile/qgsvectortilemvtdecoder.cpp +++ b/src/core/vectortile/qgsvectortilemvtdecoder.cpp @@ -309,7 +309,7 @@ QgsVectorTileFeatures QgsVectorTileMVTDecoder::layerFeatures( const QMap ring( new QgsLineString( tmpPoints ) ); + auto ring = std::make_unique( tmpPoints ); tmpPoints.clear(); if ( QgsVectorTileMVTUtils::isExteriorRing( ring.get() ) ) diff --git a/src/gui/annotations/qgsannotationitemwidget_impl.cpp b/src/gui/annotations/qgsannotationitemwidget_impl.cpp index e05dd7f90657..13bd068e379c 100644 --- a/src/gui/annotations/qgsannotationitemwidget_impl.cpp +++ b/src/gui/annotations/qgsannotationitemwidget_impl.cpp @@ -314,14 +314,9 @@ QgsAnnotationPointTextItemWidget::QgsAnnotationPointTextItemWidget( QWidget *par { setupUi( this ); - mTextFormatWidget = new QgsTextFormatWidget(); - QVBoxLayout *vLayout = new QVBoxLayout(); - vLayout->setContentsMargins( 0, 0, 0, 0 ); - vLayout->addWidget( mTextFormatWidget ); - mTextFormatWidgetContainer->setLayout( vLayout ); - mTextEdit->setMode( QgsRichTextEditor::Mode::QgsTextRenderer ); - mTextEdit->setMaximumHeight( mTextEdit->fontMetrics().height() * 10 ); + + mTextFormatButton->setMode( QgsFontButton::ModeTextRenderer ); mSpinTextAngle->setClearValue( 0 ); @@ -330,10 +325,9 @@ QgsAnnotationPointTextItemWidget::QgsAnnotationPointTextItemWidget( QWidget *par mAlignmentComboBox->setAvailableAlignments( Qt::AlignLeft | Qt::AlignHCenter | Qt::AlignRight ); - mTextFormatWidget->setDockMode( dockMode() ); - connect( mTextFormatWidget, &QgsTextFormatWidget::widgetChanged, this, [=] { + connect( mTextFormatButton, &QgsFontButton::changed, this, [=] { mTextEdit->setMode( - mTextFormatWidget->format().allowHtmlFormatting() ? QgsRichTextEditor::Mode::QgsTextRenderer : QgsRichTextEditor::Mode::PlainText + mTextFormatButton->textFormat().allowHtmlFormatting() ? QgsRichTextEditor::Mode::QgsTextRenderer : QgsRichTextEditor::Mode::PlainText ); if ( !mBlockChangedSignal ) @@ -377,8 +371,8 @@ void QgsAnnotationPointTextItemWidget::updateItem( QgsAnnotationItem *item ) if ( QgsAnnotationPointTextItem *pointTextItem = dynamic_cast( item ) ) { mBlockChangedSignal = true; - pointTextItem->setFormat( mTextFormatWidget->format() ); - pointTextItem->setText( mTextFormatWidget->format().allowHtmlFormatting() ? mTextEdit->toHtml() : mTextEdit->toPlainText() ); + pointTextItem->setFormat( mTextFormatButton->textFormat() ); + pointTextItem->setText( mTextFormatButton->textFormat().allowHtmlFormatting() ? mTextEdit->toHtml() : mTextEdit->toPlainText() ); pointTextItem->setAngle( mSpinTextAngle->value() ); pointTextItem->setRotationMode( mRotationModeCombo->currentData().value() ); pointTextItem->setAlignment( mAlignmentComboBox->currentAlignment() ); @@ -387,18 +381,14 @@ void QgsAnnotationPointTextItemWidget::updateItem( QgsAnnotationItem *item ) } } -void QgsAnnotationPointTextItemWidget::setDockMode( bool dockMode ) -{ - QgsAnnotationItemBaseWidget::setDockMode( dockMode ); - if ( mTextFormatWidget ) - mTextFormatWidget->setDockMode( dockMode ); -} - void QgsAnnotationPointTextItemWidget::setContext( const QgsSymbolWidgetContext &context ) { QgsAnnotationItemBaseWidget::setContext( context ); - if ( mTextFormatWidget ) - mTextFormatWidget->setContext( context ); + if ( mTextFormatButton ) + { + mTextFormatButton->setMapCanvas( context.mapCanvas() ); + mTextFormatButton->setMessageBar( context.messageBar() ); + } mPropertiesWidget->setContext( context ); } @@ -419,7 +409,7 @@ bool QgsAnnotationPointTextItemWidget::setNewItem( QgsAnnotationItem *item ) mItem.reset( textItem->clone() ); mBlockChangedSignal = true; - mTextFormatWidget->setFormat( mItem->format() ); + mTextFormatButton->setTextFormat( mItem->format() ); mTextEdit->setMode( mItem->format().allowHtmlFormatting() ? QgsRichTextEditor::Mode::QgsTextRenderer : QgsRichTextEditor::Mode::PlainText ); mTextEdit->setText( mItem->text() ); mSpinTextAngle->setValue( mItem->angle() ); @@ -464,19 +454,13 @@ QgsAnnotationLineTextItemWidget::QgsAnnotationLineTextItemWidget( QWidget *paren { setupUi( this ); - mTextFormatWidget = new QgsTextFormatWidget(); - QVBoxLayout *vLayout = new QVBoxLayout(); - vLayout->setContentsMargins( 0, 0, 0, 0 ); - vLayout->addWidget( mTextFormatWidget ); - mTextFormatWidgetContainer->setLayout( vLayout ); + mTextFormatButton->setMode( QgsFontButton::ModeTextRenderer ); mTextEdit->setMode( QgsRichTextEditor::Mode::QgsTextRenderer ); - mTextEdit->setMaximumHeight( mTextEdit->fontMetrics().height() * 10 ); - mTextFormatWidget->setDockMode( dockMode() ); - connect( mTextFormatWidget, &QgsTextFormatWidget::widgetChanged, this, [=] { + connect( mTextFormatButton, &QgsFontButton::changed, this, [=] { mTextEdit->setMode( - mTextFormatWidget->format().allowHtmlFormatting() ? QgsRichTextEditor::Mode::QgsTextRenderer : QgsRichTextEditor::Mode::PlainText + mTextFormatButton->textFormat().allowHtmlFormatting() ? QgsRichTextEditor::Mode::QgsTextRenderer : QgsRichTextEditor::Mode::PlainText ); if ( !mBlockChangedSignal ) @@ -519,8 +503,8 @@ void QgsAnnotationLineTextItemWidget::updateItem( QgsAnnotationItem *item ) if ( QgsAnnotationLineTextItem *lineTextItem = dynamic_cast( item ) ) { mBlockChangedSignal = true; - lineTextItem->setFormat( mTextFormatWidget->format() ); - lineTextItem->setText( mTextFormatWidget->format().allowHtmlFormatting() ? mTextEdit->toHtml() : mTextEdit->toPlainText() ); + lineTextItem->setFormat( mTextFormatButton->textFormat() ); + lineTextItem->setText( mTextFormatButton->textFormat().allowHtmlFormatting() ? mTextEdit->toHtml() : mTextEdit->toPlainText() ); lineTextItem->setOffsetFromLine( mSpinOffset->value() ); lineTextItem->setOffsetFromLineUnit( mOffsetUnitWidget->unit() ); @@ -531,18 +515,14 @@ void QgsAnnotationLineTextItemWidget::updateItem( QgsAnnotationItem *item ) } } -void QgsAnnotationLineTextItemWidget::setDockMode( bool dockMode ) -{ - QgsAnnotationItemBaseWidget::setDockMode( dockMode ); - if ( mTextFormatWidget ) - mTextFormatWidget->setDockMode( dockMode ); -} - void QgsAnnotationLineTextItemWidget::setContext( const QgsSymbolWidgetContext &context ) { QgsAnnotationItemBaseWidget::setContext( context ); - if ( mTextFormatWidget ) - mTextFormatWidget->setContext( context ); + if ( mTextFormatButton ) + { + mTextFormatButton->setMapCanvas( context.mapCanvas() ); + mTextFormatButton->setMessageBar( context.messageBar() ); + } mPropertiesWidget->setContext( context ); } @@ -561,7 +541,7 @@ bool QgsAnnotationLineTextItemWidget::setNewItem( QgsAnnotationItem *item ) mItem.reset( textItem->clone() ); mBlockChangedSignal = true; - mTextFormatWidget->setFormat( mItem->format() ); + mTextFormatButton->setTextFormat( mItem->format() ); mTextEdit->setMode( mItem->format().allowHtmlFormatting() ? QgsRichTextEditor::Mode::QgsTextRenderer : QgsRichTextEditor::Mode::PlainText ); mTextEdit->setText( mItem->text() ); mPropertiesWidget->setItem( mItem.get() ); @@ -614,7 +594,6 @@ QgsAnnotationRectangleTextItemWidget::QgsAnnotationRectangleTextItemWidget( QWid mSizeUnitWidget->setUnits( QgsUnitTypes::RenderUnitList() << Qgis::RenderUnit::Pixels << Qgis::RenderUnit::Millimeters << Qgis::RenderUnit::Points << Qgis::RenderUnit::Inches << Qgis::RenderUnit::Percentage ); - mBackgroundSymbolButton->setSymbolType( Qgis::SymbolType::Fill ); mBackgroundSymbolButton->setDialogTitle( tr( "Background" ) ); mBackgroundSymbolButton->registerExpressionContextGenerator( this ); @@ -628,22 +607,16 @@ QgsAnnotationRectangleTextItemWidget::QgsAnnotationRectangleTextItemWidget( QWid mSpinLeftMargin->setClearValue( 0 ); mMarginUnitWidget->setUnits( QgsUnitTypes::RenderUnitList() << Qgis::RenderUnit::Millimeters << Qgis::RenderUnit::MetersInMapUnits << Qgis::RenderUnit::MapUnits << Qgis::RenderUnit::Pixels << Qgis::RenderUnit::Points << Qgis::RenderUnit::Inches ); - mTextFormatWidget = new QgsTextFormatWidget(); - QVBoxLayout *vLayout = new QVBoxLayout(); - vLayout->setContentsMargins( 0, 0, 0, 0 ); - vLayout->addWidget( mTextFormatWidget ); - mTextFormatWidgetContainer->setLayout( vLayout ); + mTextFormatButton->setMode( QgsFontButton::ModeTextRenderer ); mTextEdit->setMode( QgsRichTextEditor::Mode::QgsTextRenderer ); - mTextEdit->setMaximumHeight( mTextEdit->fontMetrics().height() * 10 ); mAlignmentComboBox->setAvailableAlignments( Qt::AlignLeft | Qt::AlignHCenter | Qt::AlignRight | Qt::AlignJustify ); mVerticalAlignmentComboBox->setAvailableAlignments( Qt::AlignTop | Qt::AlignVCenter | Qt::AlignBottom ); - mTextFormatWidget->setDockMode( dockMode() ); - connect( mTextFormatWidget, &QgsTextFormatWidget::widgetChanged, this, [this] { + connect( mTextFormatButton, &QgsFontButton::changed, this, [this] { mTextEdit->setMode( - mTextFormatWidget->format().allowHtmlFormatting() ? QgsRichTextEditor::Mode::QgsTextRenderer : QgsRichTextEditor::Mode::PlainText + mTextFormatButton->textFormat().allowHtmlFormatting() ? QgsRichTextEditor::Mode::QgsTextRenderer : QgsRichTextEditor::Mode::PlainText ); onWidgetChanged(); @@ -685,8 +658,8 @@ void QgsAnnotationRectangleTextItemWidget::updateItem( QgsAnnotationItem *item ) if ( QgsAnnotationRectangleTextItem *rectTextItem = dynamic_cast( item ) ) { mBlockChangedSignal = true; - rectTextItem->setFormat( mTextFormatWidget->format() ); - rectTextItem->setText( mTextFormatWidget->format().allowHtmlFormatting() ? mTextEdit->toHtml() : mTextEdit->toPlainText() ); + rectTextItem->setFormat( mTextFormatButton->textFormat() ); + rectTextItem->setText( mTextFormatButton->textFormat().allowHtmlFormatting() ? mTextEdit->toHtml() : mTextEdit->toPlainText() ); rectTextItem->setAlignment( mAlignmentComboBox->currentAlignment() | mVerticalAlignmentComboBox->currentAlignment() ); rectTextItem->setPlacementMode( mSizeModeCombo->currentData().value() ); @@ -714,18 +687,14 @@ void QgsAnnotationRectangleTextItemWidget::updateItem( QgsAnnotationItem *item ) } } -void QgsAnnotationRectangleTextItemWidget::setDockMode( bool dockMode ) -{ - QgsAnnotationItemBaseWidget::setDockMode( dockMode ); - if ( mTextFormatWidget ) - mTextFormatWidget->setDockMode( dockMode ); -} - void QgsAnnotationRectangleTextItemWidget::setContext( const QgsSymbolWidgetContext &context ) { QgsAnnotationItemBaseWidget::setContext( context ); - if ( mTextFormatWidget ) - mTextFormatWidget->setContext( context ); + if ( mTextFormatButton ) + { + mTextFormatButton->setMapCanvas( context.mapCanvas() ); + mTextFormatButton->setMessageBar( context.messageBar() ); + } mBackgroundSymbolButton->setMapCanvas( context.mapCanvas() ); mBackgroundSymbolButton->setMessageBar( context.messageBar() ); mFrameSymbolButton->setMapCanvas( context.mapCanvas() ); @@ -760,7 +729,7 @@ bool QgsAnnotationRectangleTextItemWidget::setNewItem( QgsAnnotationItem *item ) mItem.reset( textItem->clone() ); mBlockChangedSignal = true; - mTextFormatWidget->setFormat( mItem->format() ); + mTextFormatButton->setTextFormat( mItem->format() ); mTextEdit->setMode( mItem->format().allowHtmlFormatting() ? QgsRichTextEditor::Mode::QgsTextRenderer : QgsRichTextEditor::Mode::PlainText ); mTextEdit->setText( mItem->text() ); mAlignmentComboBox->setCurrentAlignment( mItem->alignment() & Qt::AlignHorizontal_Mask ); @@ -783,6 +752,7 @@ bool QgsAnnotationRectangleTextItemWidget::setNewItem( QgsAnnotationItem *item ) mWidthSpinBox->setValue( textItem->fixedSize().width() ); mHeightSpinBox->setValue( textItem->fixedSize().height() ); + mSizeUnitWidget->setUnit( textItem->fixedSizeUnit() ); mSizeModeCombo->setCurrentIndex( mSizeModeCombo->findData( QVariant::fromValue( textItem->placementMode() ) ) ); mBlockChangedSignal = false; @@ -806,6 +776,30 @@ void QgsAnnotationRectangleTextItemWidget::sizeModeChanged() break; case Qgis::AnnotationPlacementMode::FixedSize: + if ( const QgsRenderedAnnotationItemDetails *details = renderedItemDetails() ) + { + const QgsRectangle itemBoundsMapUnits = details->boundingBox(); + if ( QgsMapCanvas *canvas = context().mapCanvas() ) + { + const QgsPointXY topLeftPixels = canvas->mapSettings().mapToPixel().transform( itemBoundsMapUnits.xMinimum(), itemBoundsMapUnits.yMinimum() ); + const QgsPointXY bottomRightPixels = canvas->mapSettings().mapToPixel().transform( itemBoundsMapUnits.xMaximum(), itemBoundsMapUnits.yMaximum() ); + const double widthPixels = std::abs( bottomRightPixels.x() - topLeftPixels.x() ); + const double heightPixels = std::abs( bottomRightPixels.y() - topLeftPixels.y() ); + + // convert width/height in pixels to mm + const double pixelsPerMm = canvas->mapSettings().outputDpi() / 25.4; + mItem->setFixedSizeUnit( Qgis::RenderUnit::Millimeters ); + mItem->setFixedSize( QSizeF( widthPixels / pixelsPerMm, heightPixels / pixelsPerMm ) ); + + // and update widget UI accordingly + whileBlocking( mWidthSpinBox )->setValue( mItem->fixedSize().width() ); + whileBlocking( mHeightSpinBox )->setValue( mItem->fixedSize().height() ); + whileBlocking( mSizeUnitWidget )->setUnit( mItem->fixedSizeUnit() ); + + mUpdateItemPosition = true; + } + } + mWidgetFixedSize->show(); break; diff --git a/src/gui/annotations/qgsannotationitemwidget_impl.h b/src/gui/annotations/qgsannotationitemwidget_impl.h index 4fa3a6bdfe6b..175602f73105 100644 --- a/src/gui/annotations/qgsannotationitemwidget_impl.h +++ b/src/gui/annotations/qgsannotationitemwidget_impl.h @@ -121,7 +121,6 @@ class QgsAnnotationPointTextItemWidget : public QgsAnnotationItemBaseWidget, pri ~QgsAnnotationPointTextItemWidget() override; QgsAnnotationItem *createItem() override; void updateItem( QgsAnnotationItem *item ) override; - void setDockMode( bool dockMode ) override; void setContext( const QgsSymbolWidgetContext &context ) override; public slots: @@ -134,7 +133,6 @@ class QgsAnnotationPointTextItemWidget : public QgsAnnotationItemBaseWidget, pri private: void mInsertExpressionButton_clicked(); - QgsTextFormatWidget *mTextFormatWidget = nullptr; bool mBlockChangedSignal = false; std::unique_ptr mItem; }; @@ -149,7 +147,6 @@ class QgsAnnotationRectangleTextItemWidget : public QgsAnnotationItemBaseWidget, ~QgsAnnotationRectangleTextItemWidget() override; QgsAnnotationItem *createItem() override; void updateItem( QgsAnnotationItem *item ) override; - void setDockMode( bool dockMode ) override; void setContext( const QgsSymbolWidgetContext &context ) override; QgsExpressionContext createExpressionContext() const override; @@ -170,7 +167,6 @@ class QgsAnnotationRectangleTextItemWidget : public QgsAnnotationItemBaseWidget, private: void mInsertExpressionButton_clicked(); - QgsTextFormatWidget *mTextFormatWidget = nullptr; bool mBlockChangedSignal = false; bool mUpdateItemPosition = false; @@ -186,7 +182,6 @@ class QgsAnnotationLineTextItemWidget : public QgsAnnotationItemBaseWidget, priv ~QgsAnnotationLineTextItemWidget() override; QgsAnnotationItem *createItem() override; void updateItem( QgsAnnotationItem *item ) override; - void setDockMode( bool dockMode ) override; void setContext( const QgsSymbolWidgetContext &context ) override; public slots: @@ -199,7 +194,6 @@ class QgsAnnotationLineTextItemWidget : public QgsAnnotationItemBaseWidget, priv private: void mInsertExpressionButton_clicked(); - QgsTextFormatWidget *mTextFormatWidget = nullptr; bool mBlockChangedSignal = false; std::unique_ptr mItem; }; diff --git a/src/gui/annotations/qgscreateannotationitemmaptool_impl.cpp b/src/gui/annotations/qgscreateannotationitemmaptool_impl.cpp index 3f0f7de1f2b0..9ea5f7e78bc5 100644 --- a/src/gui/annotations/qgscreateannotationitemmaptool_impl.cpp +++ b/src/gui/annotations/qgscreateannotationitemmaptool_impl.cpp @@ -109,7 +109,7 @@ void QgsCreatePointTextItemMapTool::cadCanvasPressEvent( QgsMapMouseEvent *event const QgsPointXY layerPoint = toLayerCoordinates( mHandler->targetLayer(), event->mapPoint() ); - std::unique_ptr createdItem = std::make_unique( tr( "Text" ), layerPoint ); + auto createdItem = std::make_unique( tr( "Text" ), layerPoint ); createdItem->setAlignment( Qt::AlignLeft ); QgsTextFormat format = QgsStyle::defaultTextFormatForProject( QgsProject::instance(), QgsStyle::TextFormatContext::Labeling ); // default to HTML formatting @@ -148,7 +148,7 @@ void QgsCreateMarkerItemMapTool::cadCanvasReleaseEvent( QgsMapMouseEvent *event return; const QgsPointXY layerPoint = toLayerCoordinates( mHandler->targetLayer(), event->mapPoint() ); - std::unique_ptr createdItem = std::make_unique( QgsPoint( layerPoint ) ); + auto createdItem = std::make_unique( QgsPoint( layerPoint ) ); std::unique_ptr markerSymbol = QgsApplication::recentStyleHandler()->recentSymbol( QStringLiteral( "marker_annotation_item" ) ); if ( !markerSymbol ) @@ -184,7 +184,7 @@ void QgsCreateLineItemMapTool::lineCaptured( const QgsCurve *line ) std::unique_ptr geometry( line->simplifiedTypeRef()->clone() ); if ( qgsgeometry_cast( geometry.get() ) ) { - std::unique_ptr createdItem = std::make_unique( qgsgeometry_cast( geometry.release() ) ); + auto createdItem = std::make_unique( qgsgeometry_cast( geometry.release() ) ); std::unique_ptr lineSymbol = QgsApplication::recentStyleHandler()->recentSymbol( QStringLiteral( "line_annotation_item" ) ); if ( !lineSymbol ) @@ -216,9 +216,9 @@ void QgsCreatePolygonItemMapTool::polygonCaptured( const QgsCurvePolygon *polygo std::unique_ptr geometry( polygon->exteriorRing()->simplifiedTypeRef()->clone() ); if ( qgsgeometry_cast( geometry.get() ) ) { - std::unique_ptr newPolygon = std::make_unique(); + auto newPolygon = std::make_unique(); newPolygon->setExteriorRing( qgsgeometry_cast( geometry.release() ) ); - std::unique_ptr createdItem = std::make_unique( newPolygon.release() ); + auto createdItem = std::make_unique( newPolygon.release() ); std::unique_ptr fillSymbol = QgsApplication::recentStyleHandler()->recentSymbol( QStringLiteral( "polygon_annotation_item" ) ); if ( !fillSymbol ) @@ -322,7 +322,7 @@ void QgsCreatePictureItemMapTool::cadCanvasPressEvent( QgsMapMouseEvent *event ) cadDockWidget()->clearPoints(); - std::unique_ptr createdItem = std::make_unique( format, imagePath, QgsRectangle( point1, point2 ) ); + auto createdItem = std::make_unique( format, imagePath, QgsRectangle( point1, point2 ) ); if ( size.isValid() ) { const double pixelsToMm = mCanvas->mapSettings().outputDpi() / 25.4; @@ -429,7 +429,7 @@ void QgsCreateRectangleTextItemMapTool::cadCanvasPressEvent( QgsMapMouseEvent *e cadDockWidget()->clearPoints(); - std::unique_ptr createdItem = std::make_unique( tr( "Text" ), QgsRectangle( point1, point2 ) ); + auto createdItem = std::make_unique( tr( "Text" ), QgsRectangle( point1, point2 ) ); QgsTextFormat format = QgsStyle::defaultTextFormatForProject( QgsProject::instance(), QgsStyle::TextFormatContext::Labeling ); // default to HTML formatting @@ -501,7 +501,7 @@ void QgsCreateLineTextItemMapTool::lineCaptured( const QgsCurve *line ) std::unique_ptr geometry( line->simplifiedTypeRef()->clone() ); if ( qgsgeometry_cast( geometry.get() ) ) { - std::unique_ptr createdItem = std::make_unique( tr( "Text" ), qgsgeometry_cast( geometry.release() ) ); + auto createdItem = std::make_unique( tr( "Text" ), qgsgeometry_cast( geometry.release() ) ); std::unique_ptr lineSymbol = QgsApplication::recentStyleHandler()->recentSymbol( QStringLiteral( "line_annotation_item" ) ); if ( !lineSymbol ) diff --git a/src/gui/auth/qgsauthauthoritieseditor.cpp b/src/gui/auth/qgsauthauthoritieseditor.cpp index 003d258c2e1c..11e324d2e881 100644 --- a/src/gui/auth/qgsauthauthoritieseditor.cpp +++ b/src/gui/auth/qgsauthauthoritieseditor.cpp @@ -430,7 +430,7 @@ void QgsAuthAuthoritiesEditor::btnAddCa_clicked() const QList &certs( dlg->certificatesToImport() ); if ( !QgsApplication::authManager()->storeCertAuthorities( certs ) ) { - messageBar()->pushMessage( tr( "ERROR storing CA(s) in authentication database" ), Qgis::MessageLevel::Critical ); + messageBar()->pushMessage( tr( "ERROR storing CA(s) in authentication storage" ), Qgis::MessageLevel::Critical ); } QgsApplication::authManager()->rebuildCaCertsCache(); @@ -501,19 +501,19 @@ void QgsAuthAuthoritiesEditor::btnRemoveCa_clicked() if ( cert.isNull() ) { - messageBar()->pushMessage( tr( "Certificate could not be found in database for id %1:" ).arg( digest ), Qgis::MessageLevel::Warning ); + messageBar()->pushMessage( tr( "Certificate could not be found in the authentication storage for id %1:" ).arg( digest ), Qgis::MessageLevel::Warning ); return; } if ( !QgsApplication::authManager()->removeCertAuthority( cert ) ) { - messageBar()->pushMessage( tr( "ERROR removing CA from authentication database for id %1:" ).arg( digest ), Qgis::MessageLevel::Critical ); + messageBar()->pushMessage( tr( "ERROR removing CA from the authentication storage for id %1:" ).arg( digest ), Qgis::MessageLevel::Critical ); return; } if ( !QgsApplication::authManager()->removeCertTrustPolicy( cert ) ) { - messageBar()->pushMessage( tr( "ERROR removing cert trust policy from authentication database for id %1:" ).arg( digest ), Qgis::MessageLevel::Critical ); + messageBar()->pushMessage( tr( "ERROR removing cert trust policy from the authentication storage for id %1:" ).arg( digest ), Qgis::MessageLevel::Critical ); return; } @@ -646,11 +646,11 @@ void QgsAuthAuthoritiesEditor::btnCaFile_clicked() if ( !QgsApplication::authManager()->storeAuthSetting( QStringLiteral( "cafile" ), QVariant( fn ) ) ) { - logMessage( QObject::tr( "Could not store 'CA file path' in authentication database." ), QObject::tr( "Authorities Manager" ), Qgis::MessageLevel::Warning ); + logMessage( QObject::tr( "Could not store 'CA file path' in authentication storage." ), QObject::tr( "Authorities Manager" ), Qgis::MessageLevel::Warning ); } if ( !QgsApplication::authManager()->storeAuthSetting( QStringLiteral( "cafileallowinvalid" ), QVariant( dlg->allowInvalidCerts() ) ) ) { - logMessage( QObject::tr( "Could not store 'CA file allow invalids' setting in authentication database." ), QObject::tr( "Authorities Manager" ), Qgis::MessageLevel::Warning ); + logMessage( QObject::tr( "Could not store 'CA file allow invalids' setting in authentication storage." ), QObject::tr( "Authorities Manager" ), Qgis::MessageLevel::Warning ); } QgsApplication::authManager()->rebuildCaCertsCache(); @@ -682,12 +682,12 @@ void QgsAuthAuthoritiesEditor::btnCaFileClear_clicked() { if ( !QgsApplication::authManager()->removeAuthSetting( QStringLiteral( "cafile" ) ) ) { - logMessage( QObject::tr( "Could not remove 'CA file path' from authentication database." ), QObject::tr( "Authorities Manager" ), Qgis::MessageLevel::Warning ); + logMessage( QObject::tr( "Could not remove 'CA file path' from authentication storage." ), QObject::tr( "Authorities Manager" ), Qgis::MessageLevel::Warning ); return; } if ( !QgsApplication::authManager()->removeAuthSetting( QStringLiteral( "cafileallowinvalid" ) ) ) { - logMessage( QObject::tr( "Could not remove 'CA file allow invalids' setting from authentication database." ), QObject::tr( "Authorities Manager" ), Qgis::MessageLevel::Warning ); + logMessage( QObject::tr( "Could not remove 'CA file allow invalids' setting from authentication storage." ), QObject::tr( "Authorities Manager" ), Qgis::MessageLevel::Warning ); return; } @@ -702,7 +702,7 @@ void QgsAuthAuthoritiesEditor::btnCaFileClear_clicked() { if ( !QgsApplication::authManager()->removeCertTrustPolicies( certs ) ) { - messageBar()->pushMessage( tr( "ERROR removing cert(s) trust policy from authentication database." ), Qgis::MessageLevel::Critical ); + messageBar()->pushMessage( tr( "ERROR removing cert(s) trust policy from authentication storage." ), Qgis::MessageLevel::Critical ); return; } QgsApplication::authManager()->rebuildCertTrustCache(); diff --git a/src/gui/auth/qgsautheditorwidgets.cpp b/src/gui/auth/qgsautheditorwidgets.cpp index c8f7373c4873..bce20c13641a 100644 --- a/src/gui/auth/qgsautheditorwidgets.cpp +++ b/src/gui/auth/qgsautheditorwidgets.cpp @@ -164,9 +164,8 @@ void QgsAuthEditorWidgets::setupUtilitiesMenu() mActionAutoClearAccessCache->setCheckable( true ); mActionAutoClearAccessCache->setChecked( QgsSettings().value( QStringLiteral( "clear_auth_cache_on_errors" ), true, QgsSettings::Section::Auth ).toBool() ); - mActionPasswordHelperSync = new QAction( tr( "Store/update the Master Password in your %1" ).arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME ), this ); - mActionPasswordHelperDelete = new QAction( tr( "Clear the Master Password from your %1…" ).arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME ), this ); - mActionPasswordHelperEnable = new QAction( tr( "Integrate Master Password with your %1" ).arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME ), this ); + mActionPasswordHelperDelete = new QAction( tr( "Clear the Master Password from the %1…" ).arg( QgsAuthManager::passwordHelperDisplayName( true ) ), this ); + mActionPasswordHelperEnable = new QAction( tr( "Integrate Master Password with the %1" ).arg( QgsAuthManager::passwordHelperDisplayName( true ) ), this ); mActionPasswordHelperLoggingEnable = new QAction( tr( "Enable Password Helper Debug Log" ), this ); mActionPasswordHelperEnable->setCheckable( true ); @@ -195,7 +194,6 @@ void QgsAuthEditorWidgets::setupUtilitiesMenu() connect( mActionClearCachedMasterPassword, &QAction::triggered, this, &QgsAuthEditorWidgets::clearCachedMasterPassword ); connect( mActionClearCachedAuthConfigs, &QAction::triggered, this, &QgsAuthEditorWidgets::clearCachedAuthenticationConfigs ); - connect( mActionPasswordHelperSync, &QAction::triggered, this, &QgsAuthEditorWidgets::passwordHelperSync ); connect( mActionPasswordHelperDelete, &QAction::triggered, this, &QgsAuthEditorWidgets::passwordHelperDelete ); connect( mActionPasswordHelperEnable, &QAction::triggered, this, &QgsAuthEditorWidgets::passwordHelperEnableTriggered ); connect( mActionPasswordHelperLoggingEnable, &QAction::triggered, this, &QgsAuthEditorWidgets::passwordHelperLoggingEnableTriggered ); @@ -218,7 +216,6 @@ void QgsAuthEditorWidgets::setupUtilitiesMenu() mAuthUtilitiesMenu->addAction( mActionAutoClearAccessCache ); mAuthUtilitiesMenu->addSeparator(); mAuthUtilitiesMenu->addAction( mActionPasswordHelperEnable ); - mAuthUtilitiesMenu->addAction( mActionPasswordHelperSync ); mAuthUtilitiesMenu->addAction( mActionPasswordHelperDelete ); mAuthUtilitiesMenu->addAction( mActionPasswordHelperLoggingEnable ); mAuthUtilitiesMenu->addSeparator(); @@ -287,11 +284,6 @@ void QgsAuthEditorWidgets::passwordHelperDelete() QgsAuthGuiUtils::passwordHelperDelete( messageBar(), this ); } -void QgsAuthEditorWidgets::passwordHelperSync() -{ - QgsAuthGuiUtils::passwordHelperSync( messageBar() ); -} - void QgsAuthEditorWidgets::passwordHelperEnableTriggered() { // Only fire on real changes diff --git a/src/gui/auth/qgsautheditorwidgets.h b/src/gui/auth/qgsautheditorwidgets.h index 97f8653b5a04..2901918d94a7 100644 --- a/src/gui/auth/qgsautheditorwidgets.h +++ b/src/gui/auth/qgsautheditorwidgets.h @@ -98,9 +98,6 @@ class GUI_EXPORT QgsAuthEditorWidgets : public QWidget, private Ui::QgsAuthEdito //! Remove master password from wallet void passwordHelperDelete(); - //! Store master password into the wallet - void passwordHelperSync(); - //! Toggle password helper (enable/disable) void passwordHelperEnableTriggered(); @@ -122,7 +119,6 @@ class GUI_EXPORT QgsAuthEditorWidgets : public QWidget, private Ui::QgsAuthEdito QAction *mActionRemoveAuthConfigs = nullptr; QAction *mActionEraseAuthDatabase = nullptr; QAction *mActionPasswordHelperDelete = nullptr; - QAction *mActionPasswordHelperSync = nullptr; QAction *mActionPasswordHelperEnable = nullptr; QAction *mActionPasswordHelperLoggingEnable = nullptr; QAction *mActionClearAccessCacheNow = nullptr; diff --git a/src/gui/auth/qgsauthguiutils.cpp b/src/gui/auth/qgsauthguiutils.cpp index f8cd1d1dd75c..833f4a2603b2 100644 --- a/src/gui/auth/qgsauthguiutils.cpp +++ b/src/gui/auth/qgsauthguiutils.cpp @@ -197,20 +197,43 @@ void QgsAuthGuiUtils::resetMasterPassword( QgsMessageBar *msgbar, QWidget *paren // get new password via dialog; do current password verification in-dialog QString newpass; QString oldpass; + bool keepbackup = false; QgsMasterPasswordResetDialog dlg( parent ); - if ( !dlg.requestMasterPasswordReset( &newpass, &oldpass, &keepbackup ) ) + QString backuppath; + // if password helper enabled and user is using the default random generated password, then + // just fill this in automatically (the user will have NO idea what this is!) + if ( QgsApplication::authManager()->verifyStoredPasswordHelperPassword() + && ( QgsApplication::authManager()->masterPasswordIsSet() || QgsApplication::authManager()->setMasterPassword( true ) ) + && QgsAuthManager::settingsUsingGeneratedRandomPassword->value() ) { - QgsDebugMsgLevel( QStringLiteral( "Master password reset: input canceled by user" ), 2 ); - return; + dlg.oldPasswordLineEdit()->setText( QStringLiteral( "***************" ) ); + dlg.oldPasswordLineEdit()->setEnabled( false ); + dlg.oldPasswordLineEdit()->setToolTip( QObject::tr( "Existing password has been automatically read from the %1" ).arg( QgsAuthManager::passwordHelperDisplayName() ) ); + if ( !dlg.requestMasterPasswordReset( &newpass, &oldpass, &keepbackup ) ) + { + QgsDebugMsgLevel( QStringLiteral( "Master password reset: input canceled by user" ), 2 ); + return; + } + if ( !QgsApplication::authManager()->resetMasterPasswordUsingStoredPasswordHelper( newpass, keepbackup, &backuppath ) ) + { + msg = QObject::tr( "Master password FAILED to be reset" ); + level = Qgis::MessageLevel::Warning; + } } - - QString backuppath; - if ( !QgsApplication::authManager()->resetMasterPassword( newpass, oldpass, keepbackup, &backuppath ) ) + else { - msg = QObject::tr( "Master password FAILED to be reset" ); - level = Qgis::MessageLevel::Warning; + if ( !dlg.requestMasterPasswordReset( &newpass, &oldpass, &keepbackup ) ) + { + QgsDebugMsgLevel( QStringLiteral( "Master password reset: input canceled by user" ), 2 ); + return; + } + if ( !QgsApplication::authManager()->resetMasterPassword( newpass, oldpass, keepbackup, &backuppath ) ) + { + msg = QObject::tr( "Master password FAILED to be reset" ); + level = Qgis::MessageLevel::Warning; + } } if ( !backuppath.isEmpty() ) @@ -331,7 +354,7 @@ QString QgsAuthGuiUtils::getOpenFileName( QWidget *parent, const QString &title, void QgsAuthGuiUtils::passwordHelperDelete( QgsMessageBar *msgbar, QWidget *parent ) { - if ( QMessageBox::warning( parent, QObject::tr( "Delete Password" ), QObject::tr( "Do you really want to delete the master password from your %1?" ).arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME ), QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel ) == QMessageBox::Cancel ) + if ( QMessageBox::warning( parent, QObject::tr( "Delete Password" ), QObject::tr( "Do you really want to delete the master password from the %1?" ).arg( QgsAuthManager::passwordHelperDisplayName() ), QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel ) == QMessageBox::Cancel ) { return; } @@ -344,8 +367,8 @@ void QgsAuthGuiUtils::passwordHelperDelete( QgsMessageBar *msgbar, QWidget *pare } else { - msg = QObject::tr( "Master password was successfully deleted from your %1" ) - .arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME ); + msg = QObject::tr( "Master password was successfully deleted from the %1" ) + .arg( QgsAuthManager::passwordHelperDisplayName() ); level = Qgis::MessageLevel::Info; } @@ -353,39 +376,13 @@ void QgsAuthGuiUtils::passwordHelperDelete( QgsMessageBar *msgbar, QWidget *pare msgbar->pushMessage( QObject::tr( "Password helper delete" ), msg, level ); } -void QgsAuthGuiUtils::passwordHelperSync( QgsMessageBar *msgbar ) -{ - QString msg; - Qgis::MessageLevel level; - if ( !QgsApplication::authManager()->masterPasswordIsSet() ) - { - msg = QObject::tr( "Master password is not set and cannot be stored in your %1." ) - .arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME ); - level = Qgis::MessageLevel::Warning; - } - else if ( !QgsApplication::authManager()->passwordHelperSync() ) - { - msg = QgsApplication::authManager()->passwordHelperErrorMessage(); - level = Qgis::MessageLevel::Warning; - } - else - { - msg = QObject::tr( "Master password has been successfully stored in your %1." ) - .arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME ); - - level = Qgis::MessageLevel::Info; - } - msgbar->clearWidgets(); - msgbar->pushMessage( QObject::tr( "Password helper write" ), msg, level ); -} - void QgsAuthGuiUtils::passwordHelperEnable( bool enabled, QgsMessageBar *msgbar ) { QgsApplication::authManager()->setPasswordHelperEnabled( enabled ); const QString msg = enabled ? QObject::tr( "Your %1 will be used from now on to store and retrieve the master password." ) - .arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME ) + .arg( QgsAuthManager::passwordHelperDisplayName() ) : QObject::tr( "Your %1 will not be used anymore to store and retrieve the master password." ) - .arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME ); + .arg( QgsAuthManager::passwordHelperDisplayName() ); msgbar->clearWidgets(); msgbar->pushMessage( QObject::tr( "Password helper write" ), msg, Qgis::MessageLevel::Info ); } diff --git a/src/gui/auth/qgsauthguiutils.h b/src/gui/auth/qgsauthguiutils.h index cd49c7d597a6..ff4d483febfc 100644 --- a/src/gui/auth/qgsauthguiutils.h +++ b/src/gui/auth/qgsauthguiutils.h @@ -99,9 +99,6 @@ class GUI_EXPORT QgsAuthGuiUtils //! Remove master password from wallet static void passwordHelperDelete( QgsMessageBar *msgbar, QWidget *parent = nullptr ); - //! Store master password into the wallet - static void passwordHelperSync( QgsMessageBar *msgbar ); - //! Sets password helper enabled (enable/disable) static void passwordHelperEnable( bool enabled, QgsMessageBar *msgbar ); diff --git a/src/gui/auth/qgsauthidentitieseditor.cpp b/src/gui/auth/qgsauthidentitieseditor.cpp index b2c032608a71..96e469707758 100644 --- a/src/gui/auth/qgsauthidentitieseditor.cpp +++ b/src/gui/auth/qgsauthidentitieseditor.cpp @@ -278,7 +278,7 @@ void QgsAuthIdentitiesEditor::btnAddIdentity_clicked() const QPair &bundle( dlg->certBundleToImport() ); if ( !QgsApplication::authManager()->storeCertIdentity( bundle.first, bundle.second ) ) { - messageBar()->pushMessage( tr( "ERROR storing identity bundle in authentication database." ), Qgis::MessageLevel::Critical ); + messageBar()->pushMessage( tr( "ERROR storing identity bundle in authentication storage." ), Qgis::MessageLevel::Critical ); } populateIdentitiesView(); mRootCertIdentItem->setExpanded( true ); @@ -326,7 +326,7 @@ void QgsAuthIdentitiesEditor::btnRemoveIdentity_clicked() if ( !QgsApplication::authManager()->removeCertIdentity( digest ) ) { - messageBar()->pushMessage( tr( "ERROR removing cert identity from authentication database for id %1:" ).arg( digest ), Qgis::MessageLevel::Critical ); + messageBar()->pushMessage( tr( "ERROR removing cert identity from authentication storage for id %1:" ).arg( digest ), Qgis::MessageLevel::Critical ); return; } diff --git a/src/gui/auth/qgsauthmasterpassresetdialog.cpp b/src/gui/auth/qgsauthmasterpassresetdialog.cpp index a002dd96caf7..acb0856578ab 100644 --- a/src/gui/auth/qgsauthmasterpassresetdialog.cpp +++ b/src/gui/auth/qgsauthmasterpassresetdialog.cpp @@ -22,7 +22,6 @@ #include "qgsauthguiutils.h" #include "qgsauthmanager.h" -#include "qgslogger.h" #include "qgsapplication.h" @@ -39,9 +38,28 @@ QgsMasterPasswordResetDialog::QgsMasterPasswordResetDialog( QWidget *parent ) else { setupUi( this ); - connect( leMasterPassCurrent, &QgsPasswordLineEdit::textChanged, this, &QgsMasterPasswordResetDialog::leMasterPassCurrent_textChanged ); - connect( leMasterPassNew, &QgsPasswordLineEdit::textChanged, this, &QgsMasterPasswordResetDialog::leMasterPassNew_textChanged ); + connect( leMasterPassCurrent, &QgsPasswordLineEdit::textChanged, this, &QgsMasterPasswordResetDialog::validatePasswords ); + connect( leMasterPassNew, &QgsPasswordLineEdit::textChanged, this, &QgsMasterPasswordResetDialog::validatePasswords ); + connect( leMasterPassNew2, &QgsPasswordLineEdit::textChanged, this, &QgsMasterPasswordResetDialog::validatePasswords ); + + if ( QgsApplication::authManager()->sqliteDatabasePath().isEmpty() ) + { + chkKeepBackup->hide(); + } } + + QString warning = tr( "The authentication store will be re-encrypted using the new password." ); + if ( QgsApplication::authManager()->passwordHelperEnabled() ) + { + warning += QStringLiteral( "

%1

" ).arg( tr( "The new password will automatically be stored in the system %1." ).arg( QgsAuthManager::passwordHelperDisplayName() ) ); + } + + lblWarning->setText( warning ); +} + +QgsPasswordLineEdit *QgsMasterPasswordResetDialog::oldPasswordLineEdit() +{ + return leMasterPassCurrent; } bool QgsMasterPasswordResetDialog::requestMasterPasswordReset( QString *newpass, QString *oldpass, bool *keepbackup ) @@ -58,35 +76,34 @@ bool QgsMasterPasswordResetDialog::requestMasterPasswordReset( QString *newpass, { *newpass = leMasterPassNew->text(); *oldpass = leMasterPassCurrent->text(); - *keepbackup = chkKeepBackup->isChecked(); + *keepbackup = !chkKeepBackup->isHidden() && chkKeepBackup->isChecked(); return true; } } return false; } -void QgsMasterPasswordResetDialog::leMasterPassCurrent_textChanged( const QString &pass ) +void QgsMasterPasswordResetDialog::validatePasswords() { - // since this is called on every keystroke, block signals emitted during verification of password - QgsApplication::authManager()->blockSignals( true ); - mPassCurOk = !pass.isEmpty(); - QgsApplication::authManager()->blockSignals( false ); - validatePasswords(); -} + const QString currentPassword = leMasterPassCurrent->text(); + const QString newPassword = leMasterPassNew->text(); + const QString confirmPassword = leMasterPassNew2->text(); -void QgsMasterPasswordResetDialog::leMasterPassNew_textChanged( const QString &pass ) -{ - mPassNewOk = !pass.isEmpty(); - validatePasswords(); -} + const bool currentPasswordOk = !currentPassword.isEmpty(); + const bool newPasswordOk = !newPassword.isEmpty(); + const bool confirmPasswordOk = !confirmPassword.isEmpty() && confirmPassword == newPassword; -void QgsMasterPasswordResetDialog::validatePasswords() -{ - const QString ss1 = mPassCurOk ? QgsAuthGuiUtils::greenTextStyleSheet( QStringLiteral( "QLineEdit" ) ) - : QgsAuthGuiUtils::redTextStyleSheet( QStringLiteral( "QLineEdit" ) ); - leMasterPassCurrent->setStyleSheet( ss1 ); - const QString ss2 = mPassNewOk ? QgsAuthGuiUtils::greenTextStyleSheet( QStringLiteral( "QLineEdit" ) ) - : QgsAuthGuiUtils::redTextStyleSheet( QStringLiteral( "QLineEdit" ) ); + if ( leMasterPassCurrent->isEnabled() ) + { + const QString ss1 = currentPasswordOk ? QgsAuthGuiUtils::greenTextStyleSheet( QStringLiteral( "QLineEdit" ) ) + : QgsAuthGuiUtils::redTextStyleSheet( QStringLiteral( "QLineEdit" ) ); + leMasterPassCurrent->setStyleSheet( ss1 ); + } + const QString ss2 = newPasswordOk ? QgsAuthGuiUtils::greenTextStyleSheet( QStringLiteral( "QLineEdit" ) ) + : QgsAuthGuiUtils::redTextStyleSheet( QStringLiteral( "QLineEdit" ) ); leMasterPassNew->setStyleSheet( ss2 ); - buttonBox->button( QDialogButtonBox::Ok )->setEnabled( mPassCurOk && mPassNewOk ); + const QString ss3 = confirmPasswordOk ? QgsAuthGuiUtils::greenTextStyleSheet( QStringLiteral( "QLineEdit" ) ) + : QgsAuthGuiUtils::redTextStyleSheet( QStringLiteral( "QLineEdit" ) ); + leMasterPassNew2->setStyleSheet( ss3 ); + buttonBox->button( QDialogButtonBox::Ok )->setEnabled( currentPasswordOk && newPasswordOk && confirmPasswordOk ); } diff --git a/src/gui/auth/qgsauthmasterpassresetdialog.h b/src/gui/auth/qgsauthmasterpassresetdialog.h index 72bb547b3f47..ad298bc53ecb 100644 --- a/src/gui/auth/qgsauthmasterpassresetdialog.h +++ b/src/gui/auth/qgsauthmasterpassresetdialog.h @@ -42,17 +42,17 @@ class GUI_EXPORT QgsMasterPasswordResetDialog : public QDialog, private Ui::QgsM public: explicit QgsMasterPasswordResetDialog( QWidget *parent = nullptr ); + /** + * Returns the old password line edit widget. + */ + QgsPasswordLineEdit *oldPasswordLineEdit(); + bool requestMasterPasswordReset( QString *newpass, QString *oldpass, bool *keepbackup ); private slots: - void leMasterPassCurrent_textChanged( const QString &pass ); - void leMasterPassNew_textChanged( const QString &pass ); - - private: void validatePasswords(); - bool mPassCurOk = false; - bool mPassNewOk = false; + private: QVBoxLayout *mAuthNotifyLayout = nullptr; QLabel *mAuthNotify = nullptr; }; diff --git a/src/gui/auth/qgsauthserverseditor.cpp b/src/gui/auth/qgsauthserverseditor.cpp index 4f7c42ed42d1..195d5feabe95 100644 --- a/src/gui/auth/qgsauthserverseditor.cpp +++ b/src/gui/auth/qgsauthserverseditor.cpp @@ -303,7 +303,7 @@ void QgsAuthServersEditor::btnRemoveServer_clicked() if ( !QgsApplication::authManager()->removeSslCertCustomConfig( digest, hostport ) ) { - messageBar()->pushMessage( tr( "ERROR removing SSL custom config from authentication database for host:port, id %1:" ).arg( hostport, digest ), Qgis::MessageLevel::Critical ); + messageBar()->pushMessage( tr( "ERROR removing SSL custom config from authentication storage for host:port, id %1:" ).arg( hostport, digest ), Qgis::MessageLevel::Critical ); return; } diff --git a/src/gui/auth/qgsauthsettingswidget.cpp b/src/gui/auth/qgsauthsettingswidget.cpp index c49f11cd2c31..02bfe356e6cd 100644 --- a/src/gui/auth/qgsauthsettingswidget.cpp +++ b/src/gui/auth/qgsauthsettingswidget.cpp @@ -50,6 +50,12 @@ QgsAuthSettingsWidget::QgsAuthSettingsWidget( QWidget *parent, const QString &co updateConvertBtnState(); } +void QgsAuthSettingsWidget::removeBasicSettings() +{ + tabAuth->removeTab( tabAuth->indexOf( tabBasic ) ); + tabAuth->setCurrentIndex( tabAuth->indexOf( tabConfigurations ) ); +} + void QgsAuthSettingsWidget::setWarningText( const QString &warningText ) { lblWarning->setText( warningText ); diff --git a/src/gui/auth/qgsauthsettingswidget.h b/src/gui/auth/qgsauthsettingswidget.h index e3a422b3fc15..eadfdeccba9e 100644 --- a/src/gui/auth/qgsauthsettingswidget.h +++ b/src/gui/auth/qgsauthsettingswidget.h @@ -62,6 +62,13 @@ class GUI_EXPORT QgsAuthSettingsWidget : public QWidget, private Ui::QgsAuthSett */ explicit QgsAuthSettingsWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr, const QString &configId = QString(), const QString &username = QString(), const QString &password = QString(), const QString &dataprovider = QString() ); + /** + * Removes the basic authentication tab from the widget. + * + * \since QGIS 3.42 + */ + void removeBasicSettings(); + /** * \brief setWarningText set the text of the warning label * \param warningText the text of the warning label diff --git a/src/gui/auth/qgsauthsslconfigwidget.cpp b/src/gui/auth/qgsauthsslconfigwidget.cpp index 9755311b4d01..2a15e143c9ee 100644 --- a/src/gui/auth/qgsauthsslconfigwidget.cpp +++ b/src/gui/auth/qgsauthsslconfigwidget.cpp @@ -294,7 +294,7 @@ void QgsAuthSslConfigWidget::saveSslCertConfig() } if ( !QgsApplication::authManager()->storeSslCertCustomConfig( sslCustomConfig() ) ) { - QgsDebugError( QStringLiteral( "SSL custom config FAILED to store in authentication database" ) ); + QgsDebugError( QStringLiteral( "SSL custom config FAILED to store in authentication storage" ) ); } } diff --git a/src/gui/codeeditors/qgscodeeditor.cpp b/src/gui/codeeditors/qgscodeeditor.cpp index 62128b6dd7be..7a1df16d5450 100644 --- a/src/gui/codeeditors/qgscodeeditor.cpp +++ b/src/gui/codeeditors/qgscodeeditor.cpp @@ -318,7 +318,7 @@ void QgsCodeEditor::contextMenuEvent( QContextMenuEvent *event ) { QAction *toggleCommentAction = new QAction( tr( "Toggle Comment" ), menu ); toggleCommentAction->setShortcut( QStringLiteral( "Ctrl+:" ) ); - toggleCommentAction->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "console/iconCommentEditorConsole.svg" ) ) ); + toggleCommentAction->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "console/iconCommentEditorConsole.svg" ), palette().color( QPalette::ColorRole::WindowText ) ) ); toggleCommentAction->setEnabled( !isReadOnly() ); connect( toggleCommentAction, &QAction::triggered, this, &QgsCodeEditor::toggleComment ); menu->addAction( toggleCommentAction ); diff --git a/src/gui/codeeditors/qgscodeeditorpython.cpp b/src/gui/codeeditors/qgscodeeditorpython.cpp index 359945653f1e..0d05c99fd38e 100644 --- a/src/gui/codeeditors/qgscodeeditorpython.cpp +++ b/src/gui/codeeditors/qgscodeeditorpython.cpp @@ -136,7 +136,7 @@ void QgsCodeEditorPython::initializeLexer() pyLexer->setColor( lexerColor( QgsCodeEditorColorScheme::ColorRole::TripleSingleQuote ), QsciLexerPython::TripleSingleQuotedString ); pyLexer->setColor( lexerColor( QgsCodeEditorColorScheme::ColorRole::TripleDoubleQuote ), QsciLexerPython::TripleDoubleQuotedString ); - std::unique_ptr apis = std::make_unique( pyLexer ); + auto apis = std::make_unique( pyLexer ); QgsSettings settings; if ( mAPISFilesList.isEmpty() ) diff --git a/src/gui/editorwidgets/qgsvaluemapconfigdlg.cpp b/src/gui/editorwidgets/qgsvaluemapconfigdlg.cpp index 9ac2dc9cb5d5..8d6c1ae5b4b5 100644 --- a/src/gui/editorwidgets/qgsvaluemapconfigdlg.cpp +++ b/src/gui/editorwidgets/qgsvaluemapconfigdlg.cpp @@ -333,7 +333,7 @@ void QgsValueMapConfigDlg::copySelectionToClipboard() QString clipboardText; QModelIndex previous = indexes.first(); - std::unique_ptr mimeData = std::make_unique(); + auto mimeData = std::make_unique(); for ( const QModelIndex ¤t : indexes ) { const QString text = model->data( current ).toString(); diff --git a/src/gui/elevation/qgselevationprofilecanvas.cpp b/src/gui/elevation/qgselevationprofilecanvas.cpp index 190f8157c2cc..c8f71eeb3d21 100644 --- a/src/gui/elevation/qgselevationprofilecanvas.cpp +++ b/src/gui/elevation/qgselevationprofilecanvas.cpp @@ -235,6 +235,54 @@ class QgsElevationProfilePlotItem : public Qgs2DPlot, public QgsPlotCanvasItem } } + void renderInflectionLines( QgsRenderContext &context ) + { + if ( !mInflexionLinesEnabled ) + { + return; + } + + if ( QgsElevationProfileCanvas *canvas = dynamic_cast( mCanvas ) ) + { + QgsCurve *profileCurve = canvas->profileCurve(); + if ( !profileCurve || profileCurve->length() < 3 ) + return; + + const QRectF area = plotArea(); + + // this transforms the coordinates from the plot reference to the plot one + QTransform transform; + transform.translate( 0, area.height() ); + transform.scale( area.width() / ( xMaximum() * mXScaleFactor - xMinimum() * mXScaleFactor ), -area.height() / ( yMaximum() - yMinimum() ) ); + transform.translate( -xMinimum() * mXScaleFactor, -yMinimum() ); + + QgsPointSequence points; + profileCurve->points( points ); + QgsPoint firstPoint = points.takeFirst(); + points.removeLast(); + + std::unique_ptr lineSymbol( QgsLineSymbol::createSimple( + { { QStringLiteral( "line_color" ), QStringLiteral( "#ff0000" ) }, + { QStringLiteral( "line_width" ), QStringLiteral( "0.5" ) }, + { QStringLiteral( "capstyle" ), QStringLiteral( "flat" ) } + } + ) ); + lineSymbol->startRender( context ); + context.painter()->translate( area.left(), 0 ); + double accumulatedDistance = 0.; + for ( const QgsPoint &point : points ) + { + accumulatedDistance += point.distance( firstPoint ); + QPointF output = transform.map( QPointF( accumulatedDistance, 0. ) ); + QPolygonF polyLine( QVector { QPointF( output.x(), area.top() ), QPointF( output.x(), area.bottom() ) } ); + lineSymbol->renderPolyline( polyLine, nullptr, context ); + firstPoint = point; + } + context.painter()->translate( -area.left(), -area.top() ); + lineSymbol->stopRender( context ); + } + } + void paint( QPainter *painter ) override { // cache rendering to an image, so we don't need to redraw the plot @@ -262,12 +310,27 @@ class QgsElevationProfilePlotItem : public Qgs2DPlot, public QgsPlotCanvasItem calculateOptimisedIntervals( rc ); render( rc ); + renderInflectionLines( rc ); imagePainter.end(); painter->drawImage( QPointF( 0, 0 ), mImage ); } } + void setInflexionLinesEnabled( bool enabled ) + { + if ( enabled == mInflexionLinesEnabled ) + { + return; + } + + mInflexionLinesEnabled = enabled; + // only invalidate the background + // the results have not changed + mImage = QImage(); + update(); + } + QgsProject *mProject = nullptr; double mXScaleFactor = 1.0; @@ -281,6 +344,8 @@ class QgsElevationProfilePlotItem : public Qgs2DPlot, public QgsPlotCanvasItem QRectF mRect; QRectF mPlotArea; QgsProfilePlotRenderer *mRenderer = nullptr; + + bool mInflexionLinesEnabled = false; }; class QgsElevationProfileCrossHairsItem : public QgsPlotCanvasItem @@ -407,6 +472,8 @@ class QgsElevationProfileCrossHairsItem : public QgsPlotCanvasItem QgsProfilePoint mPoint; QgsElevationProfilePlotItem *mPlotItem = nullptr; }; + + ///@endcond PRIVATE @@ -570,6 +637,7 @@ void QgsElevationProfileCanvas::setupLayerConnections( QgsMapLayer *layer, bool disconnect( vl, &QgsVectorLayer::featureDeleted, this, &QgsElevationProfileCanvas::regenerateResultsForLayer ); disconnect( vl, &QgsVectorLayer::geometryChanged, this, &QgsElevationProfileCanvas::regenerateResultsForLayer ); disconnect( vl, &QgsVectorLayer::attributeValueChanged, this, &QgsElevationProfileCanvas::regenerateResultsForLayer ); + disconnect( vl, &QgsVectorLayer::selectionChanged, this, &QgsElevationProfileCanvas::regenerateResultsForLayer ); } else { @@ -577,6 +645,7 @@ void QgsElevationProfileCanvas::setupLayerConnections( QgsMapLayer *layer, bool connect( vl, &QgsVectorLayer::featureDeleted, this, &QgsElevationProfileCanvas::regenerateResultsForLayer ); connect( vl, &QgsVectorLayer::geometryChanged, this, &QgsElevationProfileCanvas::regenerateResultsForLayer ); connect( vl, &QgsVectorLayer::attributeValueChanged, this, &QgsElevationProfileCanvas::regenerateResultsForLayer ); + connect( vl, &QgsVectorLayer::selectionChanged, this, &QgsElevationProfileCanvas::regenerateResultsForLayer ); } break; } @@ -836,16 +905,48 @@ void QgsElevationProfileCanvas::mouseMoveEvent( QMouseEvent *e ) plotPoint = snapResult.snappedPoint; } - if ( plotPoint.isEmpty() ) + if ( !mCrossHairsItemIsDelegate ) { - mCrossHairsItem->hide(); + if ( plotPoint.isEmpty() ) + { + mCrossHairsItem->hide(); + } + else + { + mCrossHairsItem->setPoint( plotPoint ); + mCrossHairsItem->show(); + } + emit canvasPointHovered( e->pos(), plotPoint ); } - else - { - mCrossHairsItem->setPoint( plotPoint ); +} + +void QgsElevationProfileCanvas::setCrossHairsItemPoint( QPoint point ) +{ + QgsProfilePoint plotPoint = canvasPointToPlotPoint( point ); + mCrossHairsItem->setPoint( plotPoint ); + emit canvasPointHovered( QgsPointXY(), plotPoint ); +} + +void QgsElevationProfileCanvas::hideCrossHairsItem() +{ + if ( mCrossHairsItemIsDelegate ) + mCrossHairsItem->hide(); +} + +void QgsElevationProfileCanvas::showCrossHairsItem() +{ + if ( mCrossHairsItemIsDelegate ) mCrossHairsItem->show(); - } - emit canvasPointHovered( e->pos(), plotPoint ); +} + +bool QgsElevationProfileCanvas::crossHairsItemIsDelegate() +{ + return mCrossHairsItemIsDelegate; +} + +void QgsElevationProfileCanvas::setCrossHairsItemIsDelegate( bool enabled ) +{ + mCrossHairsItemIsDelegate = enabled; } QRectF QgsElevationProfileCanvas::plotArea() const @@ -1368,6 +1469,7 @@ void QgsElevationProfileCanvas::render( QgsRenderContext &context, double width, context.expressionContext().appendScope( QgsExpressionContextUtils::globalScope() ); context.expressionContext().appendScope( QgsExpressionContextUtils::projectScope( mProject ) ); + context.setSelectionColor( mProject->selectionColor() ); QgsElevationProfilePlot profilePlot( mCurrentJob ); @@ -1428,3 +1530,8 @@ void QgsElevationProfileCanvas::setSnappingEnabled( bool enabled ) { mSnappingEnabled = enabled; } + +void QgsElevationProfileCanvas::setInflectionLinesEnabled( bool enabled ) +{ + mPlotItem->setInflexionLinesEnabled( enabled ); +} diff --git a/src/gui/elevation/qgselevationprofilecanvas.h b/src/gui/elevation/qgselevationprofilecanvas.h index 486d83fbe97e..5f1e083aaa39 100644 --- a/src/gui/elevation/qgselevationprofilecanvas.h +++ b/src/gui/elevation/qgselevationprofilecanvas.h @@ -264,6 +264,13 @@ class GUI_EXPORT QgsElevationProfileCanvas : public QgsPlotCanvas */ void setBackgroundColor( const QColor &color ); + /** + * Sets whether inflection lines are displayed. + * + * \since QGIS 3.44 + */ + void setInflectionLinesEnabled( bool enabled ); + signals: /** @@ -295,6 +302,49 @@ class GUI_EXPORT QgsElevationProfileCanvas : public QgsPlotCanvas */ void setSnappingEnabled( bool enabled ); + /** + * Sets wether the cross hairs item is controlled externally + * + * \since QGIS 3.42 + */ + void setCrossHairsItemIsDelegate( bool enabled ); + + /** + * Returns wether the cross hairs item is controlled externally + * + * \since QGIS 3.42 + */ + bool crossHairsItemIsDelegate(); + + /** + * Sets the cross hairs item point (if cross hairs items is controlled externally) + * + * \see setCrossHairsItemIsDelegate() + * \see crossHairsItemIsDelegate() + * \since QGIS 3.42 + */ + void setCrossHairsItemPoint( QPoint point ); + + /** + * Show the cross hairs item if cross hairs items is controlled externally) + * + * \see setCrossHairsItemIsDelegate() + * \see crossHairsItemIsDelegate() + * \see hideCrossHairsItem() + * \since QGIS 3.42 + */ + void showCrossHairsItem(); + + /** + * Hide the cross hairs item if cross hairs items is controlled externally) + * + * \see setCrossHairsItemIsDelegate() + * \see crossHairsItemIsDelegate() + * \see showCrossHairsItem() + * \since QGIS 3.42 + */ + void hideCrossHairsItem(); + private slots: void generationFinished(); @@ -346,6 +396,9 @@ class GUI_EXPORT QgsElevationProfileCanvas : public QgsPlotCanvas bool mForceRegenerationAfterCurrentJobCompletes = false; + // set to true if mCrossHairsItem is controlled externally + bool mCrossHairsItemIsDelegate = false; + static constexpr double MAX_ERROR_PIXELS = 2; }; diff --git a/src/gui/elevation/qgselevationprofilelayertreeview.cpp b/src/gui/elevation/qgselevationprofilelayertreeview.cpp index d6d048ef1798..7fb79866af33 100644 --- a/src/gui/elevation/qgselevationprofilelayertreeview.cpp +++ b/src/gui/elevation/qgselevationprofilelayertreeview.cpp @@ -29,10 +29,9 @@ #include "qgsmarkersymbol.h" #include "qgsfillsymbol.h" #include "qgsmaplayerutils.h" +#include "qgsapplication.h" #include -#include -#include #include @@ -52,6 +51,7 @@ QVariant QgsElevationProfileLayerTreeModel::data( const QModelIndex &index, int case Qt::DecorationRole: { QgsLayerTreeNode *node = index2node( index ); + bool addEditSymbol = false; if ( node && node->nodeType() == QgsLayerTreeNode::NodeLayer ) { @@ -68,6 +68,9 @@ QVariant QgsElevationProfileLayerTreeModel::data( const QModelIndex &index, int QgsVectorLayerElevationProperties *elevationProperties = qgis::down_cast( layer->elevationProperties() ); QgsVectorLayer *vLayer = qobject_cast( layer ); + if ( vLayer->geometryType() == Qgis::GeometryType::Point && vLayer->isEditable() ) + addEditSymbol = true; + switch ( elevationProperties->type() ) { case Qgis::VectorProfileType::IndividualFeatures: @@ -197,7 +200,13 @@ QVariant QgsElevationProfileLayerTreeModel::data( const QModelIndex &index, int if ( !symbol ) break; - const QPixmap pix = QgsSymbolLayerUtils::symbolPreviewPixmap( symbol.get(), QSize( iconSize, iconSize ), 0, context.get() ); + QPixmap pix = QgsSymbolLayerUtils::symbolPreviewPixmap( symbol.get(), QSize( iconSize, iconSize ), 0, context.get() ); + if ( addEditSymbol ) + { + QPainter painter( &pix ); + painter.drawPixmap( 0, 0, iconSize, iconSize, QgsApplication::getThemePixmap( layer->isModified() ? QStringLiteral( "/mIconEditableEdits.svg" ) : QStringLiteral( "/mActionToggleEditing.svg" ) ) ); + painter.end(); + } return QIcon( pix ); } } diff --git a/src/gui/labeling/qgslabelingenginerulewidget.cpp b/src/gui/labeling/qgslabelingenginerulewidget.cpp index c90ddd4b2393..5cbfe1a470de 100644 --- a/src/gui/labeling/qgslabelingenginerulewidget.cpp +++ b/src/gui/labeling/qgslabelingenginerulewidget.cpp @@ -97,7 +97,7 @@ void QgsLabelingEngineRuleAvoidLabelOverlapWithFeatureWidget::setRule( const Qgs QgsAbstractLabelingEngineRule *QgsLabelingEngineRuleAvoidLabelOverlapWithFeatureWidget::rule() { - std::unique_ptr res = std::make_unique(); + auto res = std::make_unique(); res->setName( mEditName->text() ); res->setLabeledLayer( mComboLabeledLayer->currentLayer() ); res->setTargetLayer( qobject_cast( mComboTargetLayer->currentLayer() ) ); @@ -158,7 +158,7 @@ void QgsLabelingEngineRuleMinimumDistanceLabelToFeatureWidget::setRule( const Qg QgsAbstractLabelingEngineRule *QgsLabelingEngineRuleMinimumDistanceLabelToFeatureWidget::rule() { - std::unique_ptr res = std::make_unique(); + auto res = std::make_unique(); res->setName( mEditName->text() ); res->setLabeledLayer( mComboLabeledLayer->currentLayer() ); res->setTargetLayer( qobject_cast( mComboTargetLayer->currentLayer() ) ); @@ -226,7 +226,7 @@ void QgsLabelingEngineRuleMaximumDistanceLabelToFeatureWidget::setRule( const Qg QgsAbstractLabelingEngineRule *QgsLabelingEngineRuleMaximumDistanceLabelToFeatureWidget::rule() { - std::unique_ptr res = std::make_unique(); + auto res = std::make_unique(); res->setName( mEditName->text() ); res->setLabeledLayer( mComboLabeledLayer->currentLayer() ); res->setTargetLayer( qobject_cast( mComboTargetLayer->currentLayer() ) ); @@ -292,7 +292,7 @@ void QgsLabelingEngineRuleMinimumDistanceLabelToLabelWidget::setRule( const QgsA QgsAbstractLabelingEngineRule *QgsLabelingEngineRuleMinimumDistanceLabelToLabelWidget::rule() { - std::unique_ptr res = std::make_unique(); + auto res = std::make_unique(); res->setName( mEditName->text() ); res->setLabeledLayer( mComboLabeledLayer->currentLayer() ); res->setTargetLayer( mComboTargetLayer->currentLayer() ); diff --git a/src/gui/labeling/qgslabelingwidget.cpp b/src/gui/labeling/qgslabelingwidget.cpp index 805e822a0209..0b5c93884261 100644 --- a/src/gui/labeling/qgslabelingwidget.cpp +++ b/src/gui/labeling/qgslabelingwidget.cpp @@ -133,8 +133,7 @@ void QgsLabelingWidget::writeSettingsToLayer() case ModeRuleBased: { const QgsRuleBasedLabeling::Rule *rootRule = qobject_cast( mWidget )->rootRule(); - - mLayer->setLabeling( new QgsRuleBasedLabeling( rootRule->clone() ) ); + mLayer->setLabeling( new QgsRuleBasedLabeling( rootRule->clone( false ) ) ); mLayer->setLabelsEnabled( true ); break; } diff --git a/src/gui/labeling/qgsrulebasedlabelingwidget.cpp b/src/gui/labeling/qgsrulebasedlabelingwidget.cpp index f9c37695cdee..3a5ae0fef047 100644 --- a/src/gui/labeling/qgsrulebasedlabelingwidget.cpp +++ b/src/gui/labeling/qgsrulebasedlabelingwidget.cpp @@ -88,13 +88,13 @@ QgsRuleBasedLabelingWidget::QgsRuleBasedLabelingWidget( QgsVectorLayer *layer, Q if ( mLayer->labeling() && mLayer->labeling()->type() == QLatin1String( "rule-based" ) ) { const QgsRuleBasedLabeling *rl = static_cast( mLayer->labeling() ); - mRootRule = rl->rootRule()->clone(); + mRootRule = rl->rootRule()->clone( false ); } else if ( mLayer->labeling() && mLayer->labeling()->type() == QLatin1String( "simple" ) ) { // copy simple label settings to first rule mRootRule = new QgsRuleBasedLabeling::Rule( nullptr ); - std::unique_ptr newSettings = std::make_unique( mLayer->labeling()->settings() ); + auto newSettings = std::make_unique( mLayer->labeling()->settings() ); newSettings->drawLabels = true; // otherwise we may be trying to copy a "blocking" setting to a rule - which is confusing for users! mRootRule->appendChild( new QgsRuleBasedLabeling::Rule( newSettings.release() ) ); } diff --git a/src/gui/layertree/qgslayertreemapcanvasbridge.cpp b/src/gui/layertree/qgslayertreemapcanvasbridge.cpp index 4daf5814f43a..2608c7e45e05 100644 --- a/src/gui/layertree/qgslayertreemapcanvasbridge.cpp +++ b/src/gui/layertree/qgslayertreemapcanvasbridge.cpp @@ -203,6 +203,7 @@ void QgsLayerTreeMapCanvasBridge::layersAdded( const QList &layer // if we are moving from zero valid layers to non-zero VALID layers, let's zoom to those data mCanvas->zoomToProjectExtent(); } + deferredSetCanvasLayers(); } ); } } diff --git a/src/gui/layout/qgslayoutattributetablewidget.cpp b/src/gui/layout/qgslayoutattributetablewidget.cpp index cd68e3bffacf..544f4546f0b0 100644 --- a/src/gui/layout/qgslayoutattributetablewidget.cpp +++ b/src/gui/layout/qgslayoutattributetablewidget.cpp @@ -182,7 +182,7 @@ QgsExpressionContext QgsLayoutAttributeTableWidget::createExpressionContext() co else if ( mTable ) context = mTable->createExpressionContext(); - std::unique_ptr cellScope = std::make_unique(); + auto cellScope = std::make_unique(); cellScope->setVariable( QStringLiteral( "row_number" ), 1, true ); cellScope->setVariable( QStringLiteral( "column_number" ), 1, true ); context.appendScope( cellScope.release() ); diff --git a/src/gui/layout/qgslayoutguidewidget.cpp b/src/gui/layout/qgslayoutguidewidget.cpp index 3cffb772ae30..97683fc52a73 100644 --- a/src/gui/layout/qgslayoutguidewidget.cpp +++ b/src/gui/layout/qgslayoutguidewidget.cpp @@ -68,13 +68,13 @@ QgsLayoutGuideWidget::QgsLayoutGuideWidget( QWidget *parent, QgsLayout *layout, void QgsLayoutGuideWidget::addHorizontalGuide() { - std::unique_ptr newGuide( new QgsLayoutGuide( Qt::Horizontal, QgsLayoutMeasurement( 0 ), mLayout->pageCollection()->page( mPage ) ) ); + auto newGuide = std::make_unique( Qt::Horizontal, QgsLayoutMeasurement( 0 ), mLayout->pageCollection()->page( mPage ) ); mLayout->guides().addGuide( newGuide.release() ); } void QgsLayoutGuideWidget::addVerticalGuide() { - std::unique_ptr newGuide( new QgsLayoutGuide( Qt::Vertical, QgsLayoutMeasurement( 0 ), mLayout->pageCollection()->page( mPage ) ) ); + auto newGuide = std::make_unique( Qt::Vertical, QgsLayoutMeasurement( 0 ), mLayout->pageCollection()->page( mPage ) ); mLayout->guides().addGuide( newGuide.release() ); } diff --git a/src/gui/layout/qgslayoutguiutils.cpp b/src/gui/layout/qgslayoutguiutils.cpp index 252abf03a689..eb0bcd2cfa58 100644 --- a/src/gui/layout/qgslayoutguiutils.cpp +++ b/src/gui/layout/qgslayoutguiutils.cpp @@ -306,7 +306,7 @@ void QgsLayoutGuiUtils::registerGuiForKnownItemTypes( QgsMapCanvas *mapCanvas ) // north arrow - std::unique_ptr northArrowMetadata = std::make_unique( + auto northArrowMetadata = std::make_unique( QgsLayoutItemRegistry::LayoutPicture, QObject::tr( "North Arrow" ), QgsApplication::getThemeIcon( QStringLiteral( "/north_arrow.svg" ) ), [=]( QgsLayoutItem *item ) -> QgsLayoutItemBaseWidget * { return new QgsLayoutPictureWidget( qobject_cast( item ) ); @@ -329,7 +329,7 @@ void QgsLayoutGuiUtils::registerGuiForKnownItemTypes( QgsMapCanvas *mapCanvas ) northArrowCount++; } - std::unique_ptr picture = std::make_unique( layout ); + auto picture = std::make_unique( layout ); picture->setNorthMode( QgsLayoutItemPicture::GridNorth ); picture->setPicturePath( defaultPath ); // set an id by default, so that north arrows are discernible in layout item lists @@ -356,17 +356,17 @@ void QgsLayoutGuiUtils::registerGuiForKnownItemTypes( QgsMapCanvas *mapCanvas ) }; registry->addLayoutItemGuiMetadata( new QgsLayoutItemGuiMetadata( QgsLayoutItemRegistry::LayoutShape, QObject::tr( "Rectangle" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddBasicRectangle.svg" ) ), createShapeWidget, createRubberBand, QStringLiteral( "shapes" ), false, QgsLayoutItemAbstractGuiMetadata::Flags(), []( QgsLayout *layout ) -> QgsLayoutItem * { - std::unique_ptr shape = std::make_unique( layout ); + auto shape = std::make_unique( layout ); shape->setShapeType( QgsLayoutItemShape::Rectangle ); return shape.release(); } ) ); registry->addLayoutItemGuiMetadata( new QgsLayoutItemGuiMetadata( QgsLayoutItemRegistry::LayoutShape, QObject::tr( "Ellipse" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddBasicCircle.svg" ) ), createShapeWidget, createEllipseBand, QStringLiteral( "shapes" ), false, QgsLayoutItemAbstractGuiMetadata::Flags(), []( QgsLayout *layout ) -> QgsLayoutItem * { - std::unique_ptr shape = std::make_unique( layout ); + auto shape = std::make_unique( layout ); shape->setShapeType( QgsLayoutItemShape::Ellipse ); return shape.release(); } ) ); registry->addLayoutItemGuiMetadata( new QgsLayoutItemGuiMetadata( QgsLayoutItemRegistry::LayoutShape, QObject::tr( "Triangle" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddBasicTriangle.svg" ) ), createShapeWidget, createTriangleBand, QStringLiteral( "shapes" ), false, QgsLayoutItemAbstractGuiMetadata::Flags(), []( QgsLayout *layout ) -> QgsLayoutItem * { - std::unique_ptr shape = std::make_unique( layout ); + auto shape = std::make_unique( layout ); shape->setShapeType( QgsLayoutItemShape::Triangle ); return shape.release(); } ) ); @@ -375,7 +375,7 @@ void QgsLayoutGuiUtils::registerGuiForKnownItemTypes( QgsMapCanvas *mapCanvas ) registry->addLayoutItemGuiMetadata( new QgsLayoutItemGuiMetadata( QgsLayoutItemRegistry::LayoutMarker, QObject::tr( "Marker" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddMarker.svg" ) ), [=]( QgsLayoutItem *item ) -> QgsLayoutItemBaseWidget * { return new QgsLayoutMarkerWidget( qobject_cast( item ) ); }, nullptr ) ); // arrow - std::unique_ptr arrowMetadata = std::make_unique( + auto arrowMetadata = std::make_unique( QgsLayoutItemRegistry::LayoutPolyline, QObject::tr( "Arrow" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddArrow.svg" ) ), [=]( QgsLayoutItem *item ) -> QgsLayoutItemBaseWidget * { return new QgsLayoutPolylineWidget( qobject_cast( item ) ); @@ -383,12 +383,12 @@ void QgsLayoutGuiUtils::registerGuiForKnownItemTypes( QgsMapCanvas *mapCanvas ) createRubberBand, QString(), true ); arrowMetadata->setItemCreationFunction( []( QgsLayout *layout ) -> QgsLayoutItem * { - std::unique_ptr arrow = std::make_unique( layout ); + auto arrow = std::make_unique( layout ); arrow->setEndMarker( QgsLayoutItemPolyline::ArrowHead ); return arrow.release(); } ); arrowMetadata->setNodeRubberBandCreationFunction( []( QgsLayoutView * ) -> QGraphicsItemGroup * { - std::unique_ptr band = std::make_unique(); + auto band = std::make_unique(); QGraphicsPathItem *poly = new QGraphicsPathItem( band.get() ); poly->setPen( QPen( QBrush( QColor( 227, 22, 22, 200 ) ), 0 ) ); @@ -402,7 +402,7 @@ void QgsLayoutGuiUtils::registerGuiForKnownItemTypes( QgsMapCanvas *mapCanvas ) // node items - std::unique_ptr polygonMetadata = std::make_unique( + auto polygonMetadata = std::make_unique( QgsLayoutItemRegistry::LayoutPolygon, QObject::tr( "Polygon" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddPolygon.svg" ) ), [=]( QgsLayoutItem *item ) -> QgsLayoutItemBaseWidget * { return new QgsLayoutPolygonWidget( qobject_cast( item ) ); @@ -410,7 +410,7 @@ void QgsLayoutGuiUtils::registerGuiForKnownItemTypes( QgsMapCanvas *mapCanvas ) createRubberBand, QStringLiteral( "nodes" ), true ); polygonMetadata->setNodeRubberBandCreationFunction( []( QgsLayoutView * ) -> QGraphicsItemGroup * { - std::unique_ptr band = std::make_unique(); + auto band = std::make_unique(); QGraphicsPolygonItem *poly = new QGraphicsPolygonItem( band.get() ); poly->setBrush( QBrush( QColor( 227, 22, 22, 20 ) ) ); poly->setPen( QPen( QBrush( QColor( 227, 22, 22, 200 ) ), 0 ) ); @@ -424,7 +424,7 @@ void QgsLayoutGuiUtils::registerGuiForKnownItemTypes( QgsMapCanvas *mapCanvas ) } ); registry->addLayoutItemGuiMetadata( polygonMetadata.release() ); - std::unique_ptr polylineMetadata = std::make_unique( + auto polylineMetadata = std::make_unique( QgsLayoutItemRegistry::LayoutPolyline, QObject::tr( "Polyline" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddPolyline.svg" ) ), [=]( QgsLayoutItem *item ) -> QgsLayoutItemBaseWidget * { return new QgsLayoutPolylineWidget( qobject_cast( item ) ); @@ -432,7 +432,7 @@ void QgsLayoutGuiUtils::registerGuiForKnownItemTypes( QgsMapCanvas *mapCanvas ) createRubberBand, QStringLiteral( "nodes" ), true ); polylineMetadata->setNodeRubberBandCreationFunction( []( QgsLayoutView * ) -> QGraphicsItemGroup * { - std::unique_ptr band = std::make_unique(); + auto band = std::make_unique(); QGraphicsPathItem *poly = new QGraphicsPathItem( band.get() ); poly->setPen( QPen( QBrush( QColor( 227, 22, 22, 200 ) ), 0 ) ); @@ -449,10 +449,10 @@ void QgsLayoutGuiUtils::registerGuiForKnownItemTypes( QgsMapCanvas *mapCanvas ) auto htmlItemMetadata = std::make_unique( QgsLayoutItemRegistry::LayoutHtml, QObject::tr( "HTML" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddHtml.svg" ) ), [=]( QgsLayoutItem *item ) -> QgsLayoutItemBaseWidget * { return new QgsLayoutHtmlWidget( qobject_cast( item ) ); }, createRubberBand ); htmlItemMetadata->setItemCreationFunction( [=]( QgsLayout *layout ) -> QgsLayoutItem * { - std::unique_ptr htmlMultiFrame = std::make_unique( layout ); + auto htmlMultiFrame = std::make_unique( layout ); QgsLayoutItemHtml *html = htmlMultiFrame.get(); layout->addMultiFrame( htmlMultiFrame.release() ); - std::unique_ptr frame = std::make_unique( layout, html ); + auto frame = std::make_unique( layout, html ); QgsLayoutFrame *f = frame.get(); html->addFrame( frame.release() ); // cppcheck-suppress returnDanglingLifetime @@ -464,7 +464,7 @@ void QgsLayoutGuiUtils::registerGuiForKnownItemTypes( QgsMapCanvas *mapCanvas ) auto attributeTableItemMetadata = std::make_unique( QgsLayoutItemRegistry::LayoutAttributeTable, QObject::tr( "Attribute Table" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddTable.svg" ) ), [=]( QgsLayoutItem *item ) -> QgsLayoutItemBaseWidget * { return new QgsLayoutAttributeTableWidget( qobject_cast( item ) ); }, createRubberBand ); attributeTableItemMetadata->setItemCreationFunction( [=]( QgsLayout *layout ) -> QgsLayoutItem * { - std::unique_ptr tableMultiFrame = std::make_unique( layout ); + auto tableMultiFrame = std::make_unique( layout ); QgsLayoutItemAttributeTable *table = tableMultiFrame.get(); //set first vector layer from layer registry as table source @@ -494,7 +494,7 @@ void QgsLayoutGuiUtils::registerGuiForKnownItemTypes( QgsMapCanvas *mapCanvas ) } layout->addMultiFrame( tableMultiFrame.release() ); - std::unique_ptr frame = std::make_unique( layout, table ); + auto frame = std::make_unique( layout, table ); QgsLayoutFrame *f = frame.get(); table->addFrame( frame.release() ); // cppcheck-suppress returnDanglingLifetime @@ -506,7 +506,7 @@ void QgsLayoutGuiUtils::registerGuiForKnownItemTypes( QgsMapCanvas *mapCanvas ) auto manualTableItemMetadata = std::make_unique( QgsLayoutItemRegistry::LayoutManualTable, QObject::tr( "Fixed Table" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddManualTable.svg" ) ), [=]( QgsLayoutItem *item ) -> QgsLayoutItemBaseWidget * { return new QgsLayoutManualTableWidget( qobject_cast( item ) ); }, createRubberBand ); manualTableItemMetadata->setItemCreationFunction( [=]( QgsLayout *layout ) -> QgsLayoutItem * { - std::unique_ptr tableMultiFrame = std::make_unique( layout ); + auto tableMultiFrame = std::make_unique( layout ); QgsLayoutItemManualTable *table = tableMultiFrame.get(); // initially start with a 2x2 empty table @@ -532,7 +532,7 @@ void QgsLayoutGuiUtils::registerGuiForKnownItemTypes( QgsMapCanvas *mapCanvas ) layout->addMultiFrame( tableMultiFrame.release() ); - std::unique_ptr frame = std::make_unique( layout, table ); + auto frame = std::make_unique( layout, table ); QgsLayoutFrame *f = frame.get(); table->addFrame( frame.release() ); // cppcheck-suppress returnDanglingLifetime @@ -548,7 +548,7 @@ void QgsLayoutGuiUtils::registerGuiForKnownItemTypes( QgsMapCanvas *mapCanvas ) auto elevationProfileItemMetadata = std::make_unique( QgsLayoutItemRegistry::LayoutElevationProfile, QObject::tr( "Elevation Profile" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionElevationProfile.svg" ) ), [=]( QgsLayoutItem *item ) -> QgsLayoutItemBaseWidget * { return new QgsLayoutElevationProfileWidget( qobject_cast( item ) ); }, createRubberBand ); elevationProfileItemMetadata->setItemCreationFunction( [=]( QgsLayout *layout ) -> QgsLayoutItem * { - std::unique_ptr profileItem = std::make_unique( layout ); + auto profileItem = std::make_unique( layout ); //set default fonts from settings QgsSettings settings; diff --git a/src/gui/layout/qgslayoutmanualtablewidget.cpp b/src/gui/layout/qgslayoutmanualtablewidget.cpp index b5b0db23e95b..d1fba7481c46 100644 --- a/src/gui/layout/qgslayoutmanualtablewidget.cpp +++ b/src/gui/layout/qgslayoutmanualtablewidget.cpp @@ -126,7 +126,7 @@ QgsExpressionContext QgsLayoutManualTableWidget::createExpressionContext() const else if ( mTable ) context = mTable->createExpressionContext(); - std::unique_ptr cellScope = std::make_unique(); + auto cellScope = std::make_unique(); cellScope->setVariable( QStringLiteral( "row_number" ), 1, true ); cellScope->setVariable( QStringLiteral( "column_number" ), 1, true ); context.appendScope( cellScope.release() ); diff --git a/src/gui/layout/qgslayoutpdfexportoptionsdialog.cpp b/src/gui/layout/qgslayoutpdfexportoptionsdialog.cpp index 9be08f9b9523..484d34453f34 100644 --- a/src/gui/layout/qgslayoutpdfexportoptionsdialog.cpp +++ b/src/gui/layout/qgslayoutpdfexportoptionsdialog.cpp @@ -57,8 +57,6 @@ QgsLayoutPdfExportOptionsDialog::QgsLayoutPdfExportOptionsDialog( QWidget *paren else { mGeospatialPDFOptionsStackedWidget->setCurrentIndex( 1 ); - mGeospatialPdfFormatComboBox->addItem( tr( "ISO 32000 Extension (recommended)" ) ); - mGeospatialPdfFormatComboBox->addItem( tr( "OGC Best Practice" ) ); } mComboImageCompression->addItem( tr( "Lossy (JPEG)" ), false ); @@ -200,26 +198,6 @@ bool QgsLayoutPdfExportOptionsDialog::exportGeospatialPdf() const return mGeospatialPDFGroupBox->isChecked(); } -void QgsLayoutPdfExportOptionsDialog::setUseOgcBestPracticeFormat( bool enabled ) -{ - if ( !mGeospatialPdfAvailable ) - return; - - if ( enabled ) - mGeospatialPdfFormatComboBox->setCurrentIndex( 1 ); - else - mGeospatialPdfFormatComboBox->setCurrentIndex( 0 ); -} - -bool QgsLayoutPdfExportOptionsDialog::useOgcBestPracticeFormat() const -{ - if ( !mGeospatialPdfAvailable ) - return false; - - return mGeospatialPdfFormatComboBox->currentIndex() == 1; -} - - void QgsLayoutPdfExportOptionsDialog::setExportThemes( const QStringList &themes ) { if ( !mGeospatialPdfAvailable ) diff --git a/src/gui/layout/qgslayoutpdfexportoptionsdialog.h b/src/gui/layout/qgslayoutpdfexportoptionsdialog.h index 98ce7ff84000..2b4cde542dcb 100644 --- a/src/gui/layout/qgslayoutpdfexportoptionsdialog.h +++ b/src/gui/layout/qgslayoutpdfexportoptionsdialog.h @@ -89,11 +89,6 @@ class GUI_EXPORT QgsLayoutPdfExportOptionsDialog : public QDialog, private Ui::Q //! Returns whether Geospatial PDF export is enabled bool exportGeospatialPdf() const; - //! Sets whether to use OGC best-practice format - void setUseOgcBestPracticeFormat( bool enabled ); - //! Returns whether use of OGC best-practice format is enabled - bool useOgcBestPracticeFormat() const; - //! Sets the list of export themes void setExportThemes( const QStringList &themes ); //! Returns the list of export themes diff --git a/src/gui/layout/qgslayoutview.cpp b/src/gui/layout/qgslayoutview.cpp index 9b5326f17ac3..729bb75982fe 100644 --- a/src/gui/layout/qgslayoutview.cpp +++ b/src/gui/layout/qgslayoutview.cpp @@ -930,7 +930,7 @@ void QgsLayoutView::mousePressEvent( QMouseEvent *event ) if ( mTool ) { - std::unique_ptr me( new QgsLayoutViewMouseEvent( this, event, mTool->flags() & QgsLayoutViewTool::FlagSnaps ) ); + auto me = std::make_unique( this, event, mTool->flags() & QgsLayoutViewTool::FlagSnaps ); mTool->layoutPressEvent( me.get() ); event->setAccepted( me->isAccepted() ); } @@ -966,7 +966,7 @@ void QgsLayoutView::mouseReleaseEvent( QMouseEvent *event ) if ( mTool ) { - std::unique_ptr me( new QgsLayoutViewMouseEvent( this, event, mTool->flags() & QgsLayoutViewTool::FlagSnaps ) ); + auto me = std::make_unique( this, event, mTool->flags() & QgsLayoutViewTool::FlagSnaps ); mTool->layoutReleaseEvent( me.get() ); event->setAccepted( me->isAccepted() ); } @@ -985,7 +985,7 @@ void QgsLayoutView::mouseMoveEvent( QMouseEvent *event ) QPointF cursorPos = mapToScene( mMouseCurrentXY ); if ( mTool ) { - std::unique_ptr me( new QgsLayoutViewMouseEvent( this, event, false ) ); + auto me = std::make_unique( this, event, false ); if ( mTool->flags() & QgsLayoutViewTool::FlagSnaps ) { me->snapPoint( mHorizontalSnapLine, mVerticalSnapLine, mTool->ignoredSnapItems() ); @@ -1025,7 +1025,7 @@ void QgsLayoutView::mouseDoubleClickEvent( QMouseEvent *event ) if ( mTool ) { - std::unique_ptr me( new QgsLayoutViewMouseEvent( this, event, mTool->flags() & QgsLayoutViewTool::FlagSnaps ) ); + auto me = std::make_unique( this, event, mTool->flags() & QgsLayoutViewTool::FlagSnaps ); mTool->layoutDoubleClickEvent( me.get() ); event->setAccepted( me->isAccepted() ); } @@ -1244,7 +1244,7 @@ void QgsLayoutView::wheelZoom( QWheelEvent *event ) QGraphicsLineItem *QgsLayoutView::createSnapLine() const { - std::unique_ptr item( new QGraphicsLineItem( nullptr ) ); + auto item = std::make_unique( nullptr ); QPen pen = QPen( QColor( Qt::blue ) ); pen.setStyle( Qt::DotLine ); pen.setWidthF( 0.0 ); diff --git a/src/gui/maptools/qgsmaptoolcapture.cpp b/src/gui/maptools/qgsmaptoolcapture.cpp index caba2d301578..7d1ff5265abf 100644 --- a/src/gui/maptools/qgsmaptoolcapture.cpp +++ b/src/gui/maptools/qgsmaptoolcapture.cpp @@ -492,11 +492,15 @@ void QgsMapToolCapture::setCurrentShapeMapTool( const QgsMapToolShapeMetadata *s void QgsMapToolCapture::cadCanvasMoveEvent( QgsMapMouseEvent *e ) { + // If we are adding a record to a non-spatial layer, just return + if ( mCaptureModeFromLayer && ( !canvas()->currentLayer() || !canvas()->currentLayer()->isSpatial() ) ) + return; + QgsMapToolAdvancedDigitizing::cadCanvasMoveEvent( e ); const QgsPointXY point = e->mapPoint(); - if ( canvas()->currentLayer() && canvas()->currentLayer()->isSpatial() ) - mSnapIndicator->setMatch( e->mapPointMatch() ); + + mSnapIndicator->setMatch( e->mapPointMatch() ); if ( mCurrentCaptureTechnique == Qgis::CaptureTechnique::Shape ) { @@ -638,10 +642,6 @@ int QgsMapToolCapture::fetchLayerPoint( const QgsPointLocator::Match &match, Qgs { if ( ( match.hasVertex() || match.hasLineEndpoint() ) ) { - if ( sourceLayer->crs() != vlayer->crs() ) - { - return 1; - } QgsFeature f; QgsFeatureRequest request; request.setFilterFid( match.featureId() ); @@ -653,6 +653,7 @@ int QgsMapToolCapture::fetchLayerPoint( const QgsPointLocator::Match &match, Qgs { return 2; } + layerPoint = f.geometry().constGet()->vertexAt( vId ); if ( QgsWkbTypes::hasZ( vlayer->wkbType() ) && !layerPoint.is3D() ) layerPoint.addZValue( defaultZValue() ); @@ -670,6 +671,10 @@ int QgsMapToolCapture::fetchLayerPoint( const QgsPointLocator::Match &match, Qgs layerPoint.dropMValue(); } + if ( sourceLayer->crs() != vlayer->crs() ) + { + layerPoint = toLayerCoordinates( vlayer, layerPoint ); + } return 0; } return 2; diff --git a/src/gui/maptools/qgsmaptoolcapture.h b/src/gui/maptools/qgsmaptoolcapture.h index 57222ac541c4..283987060950 100644 --- a/src/gui/maptools/qgsmaptoolcapture.h +++ b/src/gui/maptools/qgsmaptoolcapture.h @@ -241,13 +241,12 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing // TODO QGIS 4.0 returns an enum instead of a magic constant /** - * Fetches the original point from the source layer if it has the same - * CRS as the current layer. - * If topological editing is activated, the points are projected to the - * current layer CRS. + * Fetches the original point from the source layer. + * If topological editing is activated. + * The points are projected to the current layer CRS. * \returns * 0 in case of success - * 1 if not applicable (CRS mismatch / invalid layer) + * 1 if not applicable (invalid layer) * 2 in case of failure */ int fetchLayerPoint( const QgsPointLocator::Match &match, QgsPoint &layerPoint ); diff --git a/src/gui/mesh/qgsmeshrendererscalarsettingswidget.cpp b/src/gui/mesh/qgsmeshrendererscalarsettingswidget.cpp index ebcf1e598973..fc1ee2ac43d2 100644 --- a/src/gui/mesh/qgsmeshrendererscalarsettingswidget.cpp +++ b/src/gui/mesh/qgsmeshrendererscalarsettingswidget.cpp @@ -147,7 +147,7 @@ void QgsMeshRendererScalarSettingsWidget::syncToLayer() whileBlocking( mScalarMinSpinBox )->setValue( min ); whileBlocking( mScalarMaxSpinBox )->setValue( max ); - mMinMaxValueTypeComboBox->setCurrentIndex( mMinMaxValueTypeComboBox->findData( QVariant::fromValue( settings.extent() ) ) ); + whileBlocking( mMinMaxValueTypeComboBox )->setCurrentIndex( mMinMaxValueTypeComboBox->findData( QVariant::fromValue( settings.extent() ) ) ); if ( settings.limits() == Qgis::MeshRangeLimit::MinimumMaximum ) { diff --git a/src/gui/plot/qgsplotcanvas.cpp b/src/gui/plot/qgsplotcanvas.cpp index d9a4f46f590e..68087e65eee6 100644 --- a/src/gui/plot/qgsplotcanvas.cpp +++ b/src/gui/plot/qgsplotcanvas.cpp @@ -140,7 +140,7 @@ void QgsPlotCanvas::mouseDoubleClickEvent( QMouseEvent *event ) { if ( mTool ) { - std::unique_ptr me( new QgsPlotMouseEvent( this, event ) ); + auto me = std::make_unique( this, event ); mTool->plotDoubleClickEvent( me.get() ); event->setAccepted( me->isAccepted() ); } @@ -153,7 +153,7 @@ void QgsPlotCanvas::mousePressEvent( QMouseEvent *event ) { if ( mTool ) { - std::unique_ptr me( new QgsPlotMouseEvent( this, event ) ); + auto me = std::make_unique( this, event ); mTool->plotPressEvent( me.get() ); event->setAccepted( me->isAccepted() ); } @@ -168,7 +168,7 @@ void QgsPlotCanvas::mousePressEvent( QMouseEvent *event ) } else if ( event->button() == Qt::RightButton && mTool->flags() & Qgis::PlotToolFlag::ShowContextMenu ) { - std::unique_ptr me( new QgsPlotMouseEvent( this, event ) ); + auto me = std::make_unique( this, event ); showContextMenu( me.get() ); event->accept(); return; @@ -184,7 +184,7 @@ void QgsPlotCanvas::mouseReleaseEvent( QMouseEvent *event ) { if ( mTool ) { - std::unique_ptr me( new QgsPlotMouseEvent( this, event ) ); + auto me = std::make_unique( this, event ); mTool->plotReleaseEvent( me.get() ); event->setAccepted( me->isAccepted() ); } @@ -216,7 +216,7 @@ void QgsPlotCanvas::mouseMoveEvent( QMouseEvent *event ) { if ( mTool ) { - std::unique_ptr me( new QgsPlotMouseEvent( this, event ) ); + auto me = std::make_unique( this, event ); mTool->plotMoveEvent( me.get() ); event->setAccepted( me->isAccepted() ); } diff --git a/src/gui/plot/qgsplotrubberband.cpp b/src/gui/plot/qgsplotrubberband.cpp index 80926577c066..edfc10a90aa0 100644 --- a/src/gui/plot/qgsplotrubberband.cpp +++ b/src/gui/plot/qgsplotrubberband.cpp @@ -17,10 +17,12 @@ #include "qgsplotrubberband.h" #include "moc_qgsplotrubberband.cpp" +#include "qgsguiutils.h" #include "qgsplotcanvas.h" #include #include +#include #include QgsPlotRubberBand::QgsPlotRubberBand( QgsPlotCanvas *canvas ) @@ -175,3 +177,41 @@ QRectF QgsPlotRectangularRubberBand::finish( QPointF position, Qt::KeyboardModif } return updateRect( mRubberBandStartPos, position, constrainSquare, fromCenter ); } + +QgsPlotPointRubberBand::QgsPlotPointRubberBand( QgsPlotCanvas *canvas ) + : QgsPlotRubberBand( canvas ) +{ +} + +void QgsPlotPointRubberBand::start( QPointF position, Qt::KeyboardModifiers ) +{ + qreal s = QgsGuiUtils::scaleIconSize( 8 ); + mRubberBandItem = new QGraphicsEllipseItem( position.x() - s / 2, position.y() - s / 2, s, s ); + mRubberBandItem->setBrush( brush() ); + mRubberBandItem->setPen( pen() ); + canvas()->scene()->addItem( mRubberBandItem ); + canvas()->scene()->update(); +} + +void QgsPlotPointRubberBand::update( QPointF position, Qt::KeyboardModifiers modifiers ) +{ + Q_UNUSED( modifiers ); + if ( !mRubberBandItem ) + return; + + qreal s = QgsGuiUtils::scaleIconSize( 8 ); + mRubberBandItem->setRect( position.x() - s / 2, position.y() - s / 2, s, s ); +} + +QRectF QgsPlotPointRubberBand::finish( QPointF position, Qt::KeyboardModifiers modifiers ) +{ + Q_UNUSED( modifiers ); + Q_UNUSED( position ); + if ( mRubberBandItem ) + { + canvas()->scene()->removeItem( mRubberBandItem ); + delete mRubberBandItem; + mRubberBandItem = nullptr; + } + return QRectF(); +} diff --git a/src/gui/plot/qgsplotrubberband.h b/src/gui/plot/qgsplotrubberband.h index 6424694eca94..6d62d748675a 100644 --- a/src/gui/plot/qgsplotrubberband.h +++ b/src/gui/plot/qgsplotrubberband.h @@ -19,7 +19,6 @@ #define QGSPLOTRUBBERBAND_H #include "qgis_gui.h" -#include "qgis_sip.h" #include #include @@ -28,6 +27,7 @@ class QgsPlotCanvas; class QGraphicsRectItem; +class QGraphicsEllipseItem; /** * \ingroup gui @@ -144,4 +144,33 @@ class GUI_EXPORT QgsPlotRectangularRubberBand : public QgsPlotRubberBand QPointF mRubberBandStartPos; }; +/** + * \ingroup gui + * \brief QgsPlotPointRubberBand is a point rubber band for use within QgsPlotCanvas widgets. + * \since QGIS 3.42 + */ +class GUI_EXPORT QgsPlotPointRubberBand : public QgsPlotRubberBand +{ + Q_OBJECT + + public: + + /** + * Constructor for QgsPlotPointRubberBand. + */ + QgsPlotPointRubberBand( QgsPlotCanvas *canvas = nullptr ); + + ~QgsPlotPointRubberBand() override = default; + + void start( QPointF position, Qt::KeyboardModifiers modifiers ) override; + void update( QPointF position, Qt::KeyboardModifiers modifiers ) override; + QRectF finish( QPointF position = QPointF(), Qt::KeyboardModifiers modifiers = Qt::KeyboardModifiers() ) override; + + private: + + //! Rubber band item + QGraphicsEllipseItem *mRubberBandItem = nullptr; + +}; + #endif // QGSPLOTRUBBERBAND_H diff --git a/src/gui/pointcloud/qgspointcloudattributebyramprendererwidget.cpp b/src/gui/pointcloud/qgspointcloudattributebyramprendererwidget.cpp index f527d9854fe8..935db259da0f 100644 --- a/src/gui/pointcloud/qgspointcloudattributebyramprendererwidget.cpp +++ b/src/gui/pointcloud/qgspointcloudattributebyramprendererwidget.cpp @@ -64,7 +64,7 @@ QgsPointCloudRenderer *QgsPointCloudAttributeByRampRendererWidget::renderer() return nullptr; } - std::unique_ptr renderer = std::make_unique(); + auto renderer = std::make_unique(); renderer->setAttribute( mAttributeComboBox->currentAttribute() ); renderer->setMinimum( mMinSpin->value() ); diff --git a/src/gui/pointcloud/qgspointcloudclassifiedrendererwidget.cpp b/src/gui/pointcloud/qgspointcloudclassifiedrendererwidget.cpp index 3872092a1922..e03d76a97dc9 100644 --- a/src/gui/pointcloud/qgspointcloudclassifiedrendererwidget.cpp +++ b/src/gui/pointcloud/qgspointcloudclassifiedrendererwidget.cpp @@ -454,7 +454,7 @@ QgsPointCloudRenderer *QgsPointCloudClassifiedRendererWidget::renderer() return nullptr; } - std::unique_ptr renderer = std::make_unique(); + auto renderer = std::make_unique(); renderer->setAttribute( mAttributeComboBox->currentAttribute() ); renderer->setCategories( mModel->categories() ); diff --git a/src/gui/pointcloud/qgspointcloudextentrendererwidget.cpp b/src/gui/pointcloud/qgspointcloudextentrendererwidget.cpp index 9efa4ab7e123..d8a810408bea 100644 --- a/src/gui/pointcloud/qgspointcloudextentrendererwidget.cpp +++ b/src/gui/pointcloud/qgspointcloudextentrendererwidget.cpp @@ -56,7 +56,7 @@ QgsPointCloudRenderer *QgsPointCloudExtentRendererWidget::renderer() return nullptr; } - std::unique_ptr renderer = std::make_unique(); + auto renderer = std::make_unique(); renderer->setFillSymbol( mSymbolButton->clonedSymbol() ); return renderer.release(); } diff --git a/src/gui/pointcloud/qgspointcloudrgbrendererwidget.cpp b/src/gui/pointcloud/qgspointcloudrgbrendererwidget.cpp index 94ff6c243e7d..ae0f53a7a63f 100644 --- a/src/gui/pointcloud/qgspointcloudrgbrendererwidget.cpp +++ b/src/gui/pointcloud/qgspointcloudrgbrendererwidget.cpp @@ -84,7 +84,7 @@ QgsPointCloudRenderer *QgsPointCloudRgbRendererWidget::renderer() return nullptr; } - std::unique_ptr renderer = std::make_unique(); + auto renderer = std::make_unique(); renderer->setRedAttribute( mRedAttributeComboBox->currentAttribute() ); renderer->setGreenAttribute( mGreenAttributeComboBox->currentAttribute() ); renderer->setBlueAttribute( mBlueAttributeComboBox->currentAttribute() ); diff --git a/src/gui/processing/models/qgsmodeldesignerdialog.cpp b/src/gui/processing/models/qgsmodeldesignerdialog.cpp index f13c2b26d2d4..c8d3af7c223f 100644 --- a/src/gui/processing/models/qgsmodeldesignerdialog.cpp +++ b/src/gui/processing/models/qgsmodeldesignerdialog.cpp @@ -453,7 +453,7 @@ void QgsModelDesignerDialog::setModel( QgsProcessingModelAlgorithm *model ) void QgsModelDesignerDialog::loadModel( const QString &path ) { - std::unique_ptr alg = std::make_unique(); + auto alg = std::make_unique(); if ( alg->fromFile( path ) ) { alg->setProvider( QgsApplication::processingRegistry()->providerById( QStringLiteral( "model" ) ) ); @@ -515,7 +515,7 @@ void QgsModelDesignerDialog::updateVariablesGui() { mBlockUndoCommands++; - std::unique_ptr variablesScope = std::make_unique( tr( "Model Variables" ) ); + auto variablesScope = std::make_unique( tr( "Model Variables" ) ); const QVariantMap modelVars = mModel->variables(); for ( auto it = modelVars.constBegin(); it != modelVars.constEnd(); ++it ) { @@ -628,7 +628,7 @@ void QgsModelDesignerDialog::newModel() if ( !checkForUnsavedChanges() ) return; - std::unique_ptr alg = std::make_unique(); + auto alg = std::make_unique(); alg->setProvider( QgsApplication::processingRegistry()->providerById( QStringLiteral( "model" ) ) ); setModel( alg.release() ); } @@ -1048,7 +1048,7 @@ void QgsModelDesignerDialog::run( const QSet &childAlgorithmSubset ) if ( !childAlgorithmSubset.empty() ) { // start from previous state - std::unique_ptr modelConfig = std::make_unique(); + auto modelConfig = std::make_unique(); modelConfig->setChildAlgorithmSubset( childAlgorithmSubset ); modelConfig->setPreviouslyExecutedChildAlgorithms( mLastResult.executedChildIds() ); modelConfig->setInitialChildInputs( mLastResult.rawChildInputs() ); @@ -1057,7 +1057,7 @@ void QgsModelDesignerDialog::run( const QSet &childAlgorithmSubset ) // add copies of layers from previous runs to context's layer store, so that they can be used // when running the subset const QMap previousOutputLayers = mLayerStore.temporaryLayerStore()->mapLayers(); - std::unique_ptr previousResultStore = std::make_unique(); + auto previousResultStore = std::make_unique(); for ( auto it = previousOutputLayers.constBegin(); it != previousOutputLayers.constEnd(); ++it ) { std::unique_ptr clone( it.value()->clone() ); @@ -1247,7 +1247,7 @@ bool QgsModelDesignerDialog::isDirty() const void QgsModelDesignerDialog::fillInputsTree() { const QIcon icon = QgsApplication::getThemeIcon( QStringLiteral( "mIconModelInput.svg" ) ); - std::unique_ptr parametersItem = std::make_unique(); + auto parametersItem = std::make_unique(); parametersItem->setText( 0, tr( "Parameters" ) ); QList available = QgsApplication::processingRegistry()->parameterTypes(); std::sort( available.begin(), available.end(), []( const QgsProcessingParameterType *a, const QgsProcessingParameterType *b ) -> bool { @@ -1258,7 +1258,7 @@ void QgsModelDesignerDialog::fillInputsTree() { if ( param->flags() & Qgis::ProcessingParameterTypeFlag::ExposeToModeler ) { - std::unique_ptr paramItem = std::make_unique(); + auto paramItem = std::make_unique(); paramItem->setText( 0, param->name() ); paramItem->setData( 0, Qt::UserRole, param->id() ); paramItem->setIcon( 0, icon ); diff --git a/src/gui/processing/models/qgsmodeldesignerinputstreewidget.cpp b/src/gui/processing/models/qgsmodeldesignerinputstreewidget.cpp index cd02a4e44f7a..b9569750f941 100644 --- a/src/gui/processing/models/qgsmodeldesignerinputstreewidget.cpp +++ b/src/gui/processing/models/qgsmodeldesignerinputstreewidget.cpp @@ -34,7 +34,7 @@ QMimeData *QgsModelDesignerInputsTreeWidget::mimeData( const QList res = std::make_unique(); + auto res = std::make_unique(); const QString text = items.value( 0 )->data( 0, Qt::UserRole ).toString(); res->setText( text ); return res.release(); diff --git a/src/gui/processing/models/qgsmodelgraphicsscene.cpp b/src/gui/processing/models/qgsmodelgraphicsscene.cpp index fad189d60ab6..a2c458b9ce05 100644 --- a/src/gui/processing/models/qgsmodelgraphicsscene.cpp +++ b/src/gui/processing/models/qgsmodelgraphicsscene.cpp @@ -125,7 +125,7 @@ void QgsModelGraphicsScene::createItems( QgsProcessingModelAlgorithm *model, Qgs { if ( mParameterItems.contains( it.key() ) && mParameterItems.contains( otherName ) ) { - std::unique_ptr arrow = std::make_unique( mParameterItems.value( otherName ), QgsModelArrowItem::Marker::Circle, mParameterItems.value( it.key() ), QgsModelArrowItem::Marker::ArrowHead ); + auto arrow = std::make_unique( mParameterItems.value( otherName ), QgsModelArrowItem::Marker::Circle, mParameterItems.value( it.key() ), QgsModelArrowItem::Marker::ArrowHead ); arrow->setPenStyle( Qt::DotLine ); addItem( arrow.release() ); } @@ -477,7 +477,7 @@ void QgsModelGraphicsScene::addCommentItemForComponent( QgsProcessingModelAlgori connect( commentItem, &QgsModelComponentGraphicItem::changed, this, &QgsModelGraphicsScene::componentChanged ); connect( commentItem, &QgsModelComponentGraphicItem::aboutToChange, this, &QgsModelGraphicsScene::componentAboutToChange ); - std::unique_ptr arrow = std::make_unique( parentItem, QgsModelArrowItem::Circle, commentItem, QgsModelArrowItem::Circle ); + auto arrow = std::make_unique( parentItem, QgsModelArrowItem::Circle, commentItem, QgsModelArrowItem::Circle ); arrow->setPenStyle( Qt::DotLine ); addItem( arrow.release() ); } diff --git a/src/gui/processing/models/qgsmodelgraphicsview.cpp b/src/gui/processing/models/qgsmodelgraphicsview.cpp index 84c697d6bfcf..f9dd4f7c1dc3 100644 --- a/src/gui/processing/models/qgsmodelgraphicsview.cpp +++ b/src/gui/processing/models/qgsmodelgraphicsview.cpp @@ -222,7 +222,7 @@ void QgsModelGraphicsView::mousePressEvent( QMouseEvent *event ) if ( mTool ) { - std::unique_ptr me( new QgsModelViewMouseEvent( this, event, mTool->flags() & QgsModelViewTool::FlagSnaps ) ); + auto me = std::make_unique( this, event, mTool->flags() & QgsModelViewTool::FlagSnaps ); mTool->modelPressEvent( me.get() ); event->setAccepted( me->isAccepted() ); } @@ -249,7 +249,7 @@ void QgsModelGraphicsView::mouseReleaseEvent( QMouseEvent *event ) if ( mTool ) { - std::unique_ptr me( new QgsModelViewMouseEvent( this, event, mTool->flags() & QgsModelViewTool::FlagSnaps ) ); + auto me = std::make_unique( this, event, mTool->flags() & QgsModelViewTool::FlagSnaps ); mTool->modelReleaseEvent( me.get() ); event->setAccepted( me->isAccepted() ); } @@ -268,7 +268,7 @@ void QgsModelGraphicsView::mouseMoveEvent( QMouseEvent *event ) QPointF cursorPos = mapToScene( mMouseCurrentXY ); if ( mTool ) { - std::unique_ptr me( new QgsModelViewMouseEvent( this, event, false ) ); + auto me = std::make_unique( this, event, false ); if ( mTool->flags() & QgsModelViewTool::FlagSnaps ) { me->snapPoint(); @@ -305,7 +305,7 @@ void QgsModelGraphicsView::mouseDoubleClickEvent( QMouseEvent *event ) if ( mTool ) { - std::unique_ptr me( new QgsModelViewMouseEvent( this, event, mTool->flags() & QgsModelViewTool::FlagSnaps ) ); + auto me = std::make_unique( this, event, mTool->flags() & QgsModelViewTool::FlagSnaps ); mTool->modelDoubleClickEvent( me.get() ); event->setAccepted( me->isAccepted() ); } diff --git a/src/gui/processing/qgsprocessingmaplayercombobox.cpp b/src/gui/processing/qgsprocessingmaplayercombobox.cpp index d571cdad8903..bd9f6be1ae4a 100644 --- a/src/gui/processing/qgsprocessingmaplayercombobox.cpp +++ b/src/gui/processing/qgsprocessingmaplayercombobox.cpp @@ -161,6 +161,8 @@ QgsProcessingMapLayerComboBox::QgsProcessingMapLayerComboBox( const QgsProcessin QList dataTypes; dataTypes = static_cast( mParameter.get() )->dataTypes(); + if ( dataTypes.contains( static_cast( Qgis::ProcessingSourceType::Vector ) ) ) + filters |= Qgis::LayerFilter::VectorLayer; if ( dataTypes.contains( static_cast( Qgis::ProcessingSourceType::VectorAnyGeometry ) ) ) filters |= Qgis::LayerFilter::HasGeometry; if ( dataTypes.contains( static_cast( Qgis::ProcessingSourceType::VectorPoint ) ) ) @@ -221,7 +223,9 @@ QgsProcessingMapLayerComboBox::~QgsProcessingMapLayerComboBox() = default; void QgsProcessingMapLayerComboBox::setLayer( QgsMapLayer *layer ) { if ( layer || mParameter->flags() & Qgis::ProcessingParameterFlag::Optional ) + { mCombo->setLayer( layer ); + } } QgsMapLayer *QgsProcessingMapLayerComboBox::currentLayer() diff --git a/src/gui/processing/qgsprocessingmeshdatasetwidget.cpp b/src/gui/processing/qgsprocessingmeshdatasetwidget.cpp index 22171f12f46c..5c6c68a479d4 100644 --- a/src/gui/processing/qgsprocessingmeshdatasetwidget.cpp +++ b/src/gui/processing/qgsprocessingmeshdatasetwidget.cpp @@ -792,7 +792,7 @@ QgsProcessingParameterDefinition *QgsProcessingMeshDatasetGroupsParameterDefinit supportedDataType.insert( QgsMeshDatasetGroupMetadata::DataOnVertices ); supportedDataType.insert( QgsMeshDatasetGroupMetadata::DataOnFaces ); supportedDataType.insert( QgsMeshDatasetGroupMetadata::DataOnVolumes ); - std::unique_ptr param = std::make_unique( name, description, mParentLayerComboBox->currentData().toString(), supportedDataType ); + auto param = std::make_unique( name, description, mParentLayerComboBox->currentData().toString(), supportedDataType ); param->setFlags( flags ); return param.release(); } @@ -864,7 +864,7 @@ QgsProcessingMeshDatasetTimeParameterDefinitionWidget::QgsProcessingMeshDatasetT QgsProcessingParameterDefinition *QgsProcessingMeshDatasetTimeParameterDefinitionWidget::createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const { - std::unique_ptr param = std::make_unique( + auto param = std::make_unique( name, description, mMeshLayerParameterName, mParentDatasetComboBox->currentData().toString() ); diff --git a/src/gui/processing/qgsprocessingmultipleselectiondialog.cpp b/src/gui/processing/qgsprocessingmultipleselectiondialog.cpp index f37b255cf0e2..128992518da3 100644 --- a/src/gui/processing/qgsprocessingmultipleselectiondialog.cpp +++ b/src/gui/processing/qgsprocessingmultipleselectiondialog.cpp @@ -19,6 +19,7 @@ #include "qgssettings.h" #include "qgsfileutils.h" #include "qgsvectorlayer.h" +#include "qgsmaplayerfactory.h" #include "qgsmeshlayer.h" #include "qgsrasterlayer.h" #include "qgspluginlayer.h" @@ -268,7 +269,7 @@ void QgsProcessingMultipleSelectionPanelWidget::addOption( const QVariant &value } } - std::unique_ptr item = std::make_unique( title ); + auto item = std::make_unique( title ); item->setData( value, Qt::UserRole ); item->setCheckState( selected ? Qt::Checked : Qt::Unchecked ); item->setCheckable( true ); @@ -460,7 +461,7 @@ QStringList QgsProcessingMultipleInputPanelWidget::compatibleUrisFromMimeData( c || parameter->layerType() == Qgis::ProcessingSourceType::VectorLine || parameter->layerType() == Qgis::ProcessingSourceType::VectorPoint || parameter->layerType() == Qgis::ProcessingSourceType::VectorPolygon ) - && u.layerType == QLatin1String( "vector" ) ) + && u.layerType == QgsMapLayerFactory::typeToString( Qgis::LayerType::Vector ) ) { bool acceptable = false; switch ( QgsWkbTypes::geometryType( u.wkbType ) ) @@ -493,16 +494,16 @@ QStringList QgsProcessingMultipleInputPanelWidget::compatibleUrisFromMimeData( c res.append( u.providerKey != QLatin1String( "ogr" ) ? QgsProcessingUtils::encodeProviderKeyAndUri( u.providerKey, u.uri ) : u.uri ); } else if ( ( parameter->layerType() == Qgis::ProcessingSourceType::MapLayer || parameter->layerType() == Qgis::ProcessingSourceType::Raster ) - && u.layerType == QLatin1String( "raster" ) && u.providerKey == QLatin1String( "gdal" ) ) + && u.layerType == QgsMapLayerFactory::typeToString( Qgis::LayerType::Raster ) && u.providerKey == QLatin1String( "gdal" ) ) res.append( u.uri ); else if ( ( parameter->layerType() == Qgis::ProcessingSourceType::MapLayer || parameter->layerType() == Qgis::ProcessingSourceType::Mesh ) - && u.layerType == QLatin1String( "mesh" ) && u.providerKey == QLatin1String( "mdal" ) ) + && u.layerType == QgsMapLayerFactory::typeToString( Qgis::LayerType::Mesh ) && u.providerKey == QLatin1String( "mdal" ) ) res.append( u.uri ); else if ( ( parameter->layerType() == Qgis::ProcessingSourceType::MapLayer || parameter->layerType() == Qgis::ProcessingSourceType::PointCloud ) - && u.layerType == QLatin1String( "pointcloud" ) ) + && u.layerType == QgsMapLayerFactory::typeToString( Qgis::LayerType::PointCloud ) ) res.append( u.uri ); else if ( ( parameter->layerType() == Qgis::ProcessingSourceType::MapLayer || parameter->layerType() == Qgis::ProcessingSourceType::VectorTile ) - && u.layerType == QLatin1String( "vector-tile" ) ) + && u.layerType == QgsMapLayerFactory::typeToString( Qgis::LayerType::VectorTile ) ) res.append( u.uri ); // NOLINTEND(bugprone-branch-clone) } diff --git a/src/gui/processing/qgsprocessingoutputdestinationwidget.cpp b/src/gui/processing/qgsprocessingoutputdestinationwidget.cpp index 8c72eaa40f1a..420aff686f5a 100644 --- a/src/gui/processing/qgsprocessingoutputdestinationwidget.cpp +++ b/src/gui/processing/qgsprocessingoutputdestinationwidget.cpp @@ -548,7 +548,7 @@ void QgsProcessingLayerOutputDestinationWidget::appendToLayer() else { // get fields for destination - std::unique_ptr dest = std::make_unique( widget->uri().uri, QString(), widget->uri().providerKey ); + auto dest = std::make_unique( widget->uri().uri, QString(), widget->uri().providerKey ); if ( widget->uri().providerKey == QLatin1String( "ogr" ) ) setAppendDestination( widget->uri().uri, dest->fields() ); else diff --git a/src/gui/processing/qgsprocessingtoolboxmodel.cpp b/src/gui/processing/qgsprocessingtoolboxmodel.cpp index f71e347c8e68..d1ea6e45ea5e 100644 --- a/src/gui/processing/qgsprocessingtoolboxmodel.cpp +++ b/src/gui/processing/qgsprocessingtoolboxmodel.cpp @@ -146,7 +146,7 @@ void QgsProcessingToolboxModel::rebuild() if ( mRecentLog ) { - std::unique_ptr recentNode = std::make_unique(); + auto recentNode = std::make_unique(); // cppcheck-suppress danglingLifetime mRecentNode = recentNode.get(); mRootNode->addChildNode( recentNode.release() ); @@ -155,7 +155,7 @@ void QgsProcessingToolboxModel::rebuild() if ( mFavoriteManager ) { - std::unique_ptr favoriteNode = std::make_unique(); + auto favoriteNode = std::make_unique(); // cppcheck-suppress danglingLifetime mFavoriteNode = favoriteNode.get(); mRootNode->addChildNode( favoriteNode.release() ); @@ -218,7 +218,7 @@ void QgsProcessingToolboxModel::repopulateRecentAlgorithms( bool resetting ) for ( const QgsProcessingAlgorithm *algorithm : std::as_const( recentAlgorithms ) ) { - std::unique_ptr algorithmNode = std::make_unique( algorithm ); + auto algorithmNode = std::make_unique( algorithm ); mRecentNode->addChildNode( algorithmNode.release() ); } @@ -278,7 +278,7 @@ void QgsProcessingToolboxModel::repopulateFavoriteAlgorithms( bool resetting ) for ( const QgsProcessingAlgorithm *algorithm : std::as_const( favoriteAlgorithms ) ) { - std::unique_ptr algorithmNode = std::make_unique( algorithm ); + auto algorithmNode = std::make_unique( algorithm ); mFavoriteNode->addChildNode( algorithmNode.release() ); } @@ -353,7 +353,7 @@ void QgsProcessingToolboxModel::addProvider( QgsProcessingProvider *provider ) QgsProcessingToolboxModelNode *parentNode = nullptr; if ( !isTopLevelProvider( provider->id() ) ) { - std::unique_ptr node = std::make_unique( provider ); + auto node = std::make_unique( provider ); parentNode = node.get(); mRootNode->addChildNode( node.release() ); } @@ -365,7 +365,7 @@ void QgsProcessingToolboxModel::addProvider( QgsProcessingProvider *provider ) const QList algorithms = provider->algorithms(); for ( const QgsProcessingAlgorithm *algorithm : algorithms ) { - std::unique_ptr algorithmNode = std::make_unique( algorithm ); + auto algorithmNode = std::make_unique( algorithm ); const QString groupId = algorithm->groupId(); if ( !groupId.isEmpty() ) @@ -666,7 +666,7 @@ QMimeData *QgsProcessingToolboxModel::mimeData( const QModelIndexList &indexes ) QByteArray encodedData; QDataStream stream( &encodedData, QIODevice::WriteOnly | QIODevice::Truncate ); - std::unique_ptr mimeData = std::make_unique(); + auto mimeData = std::make_unique(); const QgsProcessingAlgorithm *algorithm = algorithmForIndex( indexes.at( 0 ) ); if ( algorithm ) { diff --git a/src/gui/processing/qgsprocessingwidgetwrapper.cpp b/src/gui/processing/qgsprocessingwidgetwrapper.cpp index 9839db771196..8de38ec5627c 100644 --- a/src/gui/processing/qgsprocessingwidgetwrapper.cpp +++ b/src/gui/processing/qgsprocessingwidgetwrapper.cpp @@ -234,7 +234,7 @@ QLabel *QgsAbstractProcessingParameterWidgetWrapper::createLabel() QString description = mParameterDefinition->description(); if ( parameterDefinition()->flags() & Qgis::ProcessingParameterFlag::Optional ) description = QObject::tr( "%1 [optional]" ).arg( description ); - std::unique_ptr label = std::make_unique( description ); + auto label = std::make_unique( description ); label->setToolTip( mParameterDefinition->toolTip() ); label->setWordWrap( true ); return label.release(); @@ -287,7 +287,7 @@ QgsExpressionContext QgsAbstractProcessingParameterWidgetWrapper::createExpressi QgsExpressionContext context = QgsProcessingGuiUtils::createExpressionContext( mProcessingContextGenerator, mWidgetContext, mParameterDefinition ? mParameterDefinition->algorithm() : nullptr, linkedVectorLayer() ); if ( mParameterDefinition && !mParameterDefinition->additionalExpressionContextVariables().isEmpty() ) { - std::unique_ptr paramScope = std::make_unique(); + auto paramScope = std::make_unique(); const QStringList additional = mParameterDefinition->additionalExpressionContextVariables(); for ( const QString &var : additional ) { @@ -365,7 +365,7 @@ void QgsAbstractProcessingParameterWidgetWrapper::setDynamicParentLayerParameter QgsProcessingModelerParameterWidget *QgsProcessingParameterWidgetFactoryInterface::createModelerWidgetWrapper( QgsProcessingModelAlgorithm *model, const QString &childId, const QgsProcessingParameterDefinition *parameter, QgsProcessingContext &context ) { - std::unique_ptr widget = std::make_unique( model, childId, parameter, context ); + auto widget = std::make_unique( model, childId, parameter, context ); widget->populateSources( compatibleParameterTypes(), compatibleOutputTypes(), compatibleDataTypes( parameter ) ); widget->setExpressionHelpText( modelerExpressionFormatString() ); diff --git a/src/gui/processing/qgsprocessingwidgetwrapperimpl.cpp b/src/gui/processing/qgsprocessingwidgetwrapperimpl.cpp index 9648d502f000..5d3cd9e7b606 100644 --- a/src/gui/processing/qgsprocessingwidgetwrapperimpl.cpp +++ b/src/gui/processing/qgsprocessingwidgetwrapperimpl.cpp @@ -6698,6 +6698,7 @@ QgsProcessingMapLayerParameterDefinitionWidget::QgsProcessingMapLayerParameterDe mLayerTypeComboBox->addItem( tr( "Vector (Line)" ), static_cast( Qgis::ProcessingSourceType::VectorLine ) ); mLayerTypeComboBox->addItem( tr( "Vector (Polygon)" ), static_cast( Qgis::ProcessingSourceType::VectorPolygon ) ); mLayerTypeComboBox->addItem( tr( "Vector (Any Geometry Type)" ), static_cast( Qgis::ProcessingSourceType::VectorAnyGeometry ) ); + mLayerTypeComboBox->addItem( tr( "Vector (No Geometry Required)" ), static_cast( Qgis::ProcessingSourceType::Vector ) ); mLayerTypeComboBox->addItem( tr( "Raster" ), static_cast( Qgis::ProcessingSourceType::Raster ) ); mLayerTypeComboBox->addItem( tr( "Mesh" ), static_cast( Qgis::ProcessingSourceType::Mesh ) ); mLayerTypeComboBox->addItem( tr( "Plugin" ), static_cast( Qgis::ProcessingSourceType::Plugin ) ); @@ -7980,7 +7981,7 @@ QStringList QgsProcessingPointCloudLayerWidgetWrapper::compatibleOutputTypes() c { return QStringList() << QgsProcessingOutputString::typeName() - // TODO << QgsProcessingOutputPointCloudLayer::typeName() + << QgsProcessingOutputPointCloudLayer::typeName() << QgsProcessingOutputMapLayer::typeName() << QgsProcessingOutputFile::typeName() << QgsProcessingOutputFolder::typeName(); diff --git a/src/gui/proj/qgscoordinateoperationwidget.cpp b/src/gui/proj/qgscoordinateoperationwidget.cpp index f8afa0564ea3..dddeec268212 100644 --- a/src/gui/proj/qgscoordinateoperationwidget.cpp +++ b/src/gui/proj/qgscoordinateoperationwidget.cpp @@ -134,7 +134,7 @@ void QgsCoordinateOperationWidget::loadAvailableOperations() for ( const QgsDatumTransform::TransformDetails &transform : std::as_const( mDatumTransforms ) ) { - std::unique_ptr item = std::make_unique(); + auto item = std::make_unique(); item->setData( ProjRole, transform.proj ); item->setData( AvailableRole, transform.isAvailable ); item->setFlags( item->flags() & ~Qt::ItemIsEditable ); diff --git a/src/gui/proj/qgscoordinatereferencesystemmodel.cpp b/src/gui/proj/qgscoordinatereferencesystemmodel.cpp index daf8fba5b3b1..bfb876ecd5a0 100644 --- a/src/gui/proj/qgscoordinatereferencesystemmodel.cpp +++ b/src/gui/proj/qgscoordinatereferencesystemmodel.cpp @@ -286,7 +286,7 @@ void QgsCoordinateReferenceSystemModel::userCrsAdded( const QString &id ) QgsCoordinateReferenceSystemModelGroupNode *group = mRootNode->getChildGroupNode( QStringLiteral( "USER" ) ); if ( !group ) { - std::unique_ptr newGroup = std::make_unique( + auto newGroup = std::make_unique( tr( "User-defined" ), QgsApplication::getThemeIcon( QStringLiteral( "/user.svg" ) ), QStringLiteral( "USER" ) ); @@ -358,7 +358,7 @@ void QgsCoordinateReferenceSystemModel::userCrsChanged( const QString &id ) QgsCoordinateReferenceSystemModelCrsNode *QgsCoordinateReferenceSystemModel::addRecord( const QgsCrsDbRecord &record ) { QgsCoordinateReferenceSystemModelGroupNode *parentNode = mRootNode.get(); - std::unique_ptr crsNode = std::make_unique( record ); + auto crsNode = std::make_unique( record ); QString groupName; QString groupId; @@ -438,7 +438,7 @@ QgsCoordinateReferenceSystemModelCrsNode *QgsCoordinateReferenceSystemModel::add } else { - std::unique_ptr newGroup = std::make_unique( groupName, groupIcon, groupId ); + auto newGroup = std::make_unique( groupName, groupIcon, groupId ); parentNode->addChildNode( newGroup.get() ); parentNode = newGroup.release(); } @@ -457,7 +457,7 @@ QgsCoordinateReferenceSystemModelCrsNode *QgsCoordinateReferenceSystemModel::add } else { - std::unique_ptr newGroup = std::make_unique( projectionName, QIcon(), record.projectionAcronym ); + auto newGroup = std::make_unique( projectionName, QIcon(), record.projectionAcronym ); parentNode->addChildNode( newGroup.get() ); parentNode = newGroup.release(); } @@ -477,7 +477,7 @@ QModelIndex QgsCoordinateReferenceSystemModel::addCustomCrs( const QgsCoordinate QgsCoordinateReferenceSystemModelGroupNode *group = mRootNode->getChildGroupNode( QStringLiteral( "CUSTOM" ) ); if ( !group ) { - std::unique_ptr newGroup = std::make_unique( + auto newGroup = std::make_unique( tr( "Custom" ), QgsApplication::getThemeIcon( QStringLiteral( "/user.svg" ) ), QStringLiteral( "CUSTOM" ) ); diff --git a/src/gui/proj/qgscrsdefinitionwidget.cpp b/src/gui/proj/qgscrsdefinitionwidget.cpp index b4ec7c850419..79c45401f809 100644 --- a/src/gui/proj/qgscrsdefinitionwidget.cpp +++ b/src/gui/proj/qgscrsdefinitionwidget.cpp @@ -101,7 +101,7 @@ void QgsCrsDefinitionWidget::setDefinitionString( const QString &definition ) void QgsCrsDefinitionWidget::pbnCopyCRS_clicked() { - std::unique_ptr selector = std::make_unique( this ); + auto selector = std::make_unique( this ); if ( selector->exec() ) { const QgsCoordinateReferenceSystem srs = selector->crs(); diff --git a/src/gui/providers/ogr/qgsgeopackageitemguiprovider.cpp b/src/gui/providers/ogr/qgsgeopackageitemguiprovider.cpp index 3a3874100a4d..5f7ee27fbf81 100644 --- a/src/gui/providers/ogr/qgsgeopackageitemguiprovider.cpp +++ b/src/gui/providers/ogr/qgsgeopackageitemguiprovider.cpp @@ -435,7 +435,7 @@ bool QgsGeoPackageItemGuiProvider::handleDropGeopackage( QgsGeoPackageCollection bool hasError = false; // Main task - std::unique_ptr mainTask( new QgsTaskWithSerialSubTasks( tr( "GeoPackage import" ) ) ); + auto mainTask = std::make_unique( tr( "GeoPackage import" ) ); bool hasSubTasks = false; const auto lst = QgsMimeDataUtils::decodeUriList( data ); diff --git a/src/gui/providers/ogr/qgsogrdbsourceselect.cpp b/src/gui/providers/ogr/qgsogrdbsourceselect.cpp index d68a57bc7788..c6681f88008b 100644 --- a/src/gui/providers/ogr/qgsogrdbsourceselect.cpp +++ b/src/gui/providers/ogr/qgsogrdbsourceselect.cpp @@ -313,7 +313,7 @@ void QgsOgrDbSourceSelect::setSql( const QModelIndex &index ) QString tableName = mTableModel->itemFromIndex( index.sibling( index.row(), 0 ) )->text(); QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() }; - std::unique_ptr vlayer = std::make_unique( layerURI( index ), tableName, QStringLiteral( "ogr" ), options ); + auto vlayer = std::make_unique( layerURI( index ), tableName, QStringLiteral( "ogr" ), options ); if ( !vlayer->isValid() ) { @@ -321,7 +321,7 @@ void QgsOgrDbSourceSelect::setSql( const QModelIndex &index ) } // create a query builder object - std::unique_ptr gb( new QgsQueryBuilder( vlayer.get(), this ) ); + auto gb = std::make_unique( vlayer.get(), this ); if ( gb->exec() ) { diff --git a/src/gui/providers/sensorthings/qgssensorthingsconnectionwidget.cpp b/src/gui/providers/sensorthings/qgssensorthingsconnectionwidget.cpp index e16b5409e2c9..c15dcf2d3a85 100644 --- a/src/gui/providers/sensorthings/qgssensorthingsconnectionwidget.cpp +++ b/src/gui/providers/sensorthings/qgssensorthingsconnectionwidget.cpp @@ -29,6 +29,9 @@ QgsSensorThingsConnectionWidget::QgsSensorThingsConnectionWidget( QWidget *paren connect( mEditUrl, &QLineEdit::textChanged, this, &QgsSensorThingsConnectionWidget::validate ); connect( mEditUrl, &QLineEdit::textChanged, this, &QgsSensorThingsConnectionWidget::changed ); + // only auth config supported, not basic auth + mAuthSettings->removeBasicSettings(); + connect( mAuthSettings, &QgsAuthSettingsWidget::configIdChanged, this, &QgsSensorThingsConnectionWidget::changed ); connect( mAuthSettings, &QgsAuthSettingsWidget::usernameChanged, this, &QgsSensorThingsConnectionWidget::changed ); connect( mAuthSettings, &QgsAuthSettingsWidget::passwordChanged, this, &QgsSensorThingsConnectionWidget::changed ); diff --git a/src/gui/providers/sensorthings/qgssensorthingssourceselect.cpp b/src/gui/providers/sensorthings/qgssensorthingssourceselect.cpp index 5285d34d555f..bc24d2220a27 100644 --- a/src/gui/providers/sensorthings/qgssensorthingssourceselect.cpp +++ b/src/gui/providers/sensorthings/qgssensorthingssourceselect.cpp @@ -282,7 +282,7 @@ void QgsSensorThingsSourceSelect::cmbConnections_currentTextChanged( const QStri void QgsSensorThingsSourceSelect::buildFilter() { - const QgsFields fields = QgsSensorThingsUtils::fieldsForEntityType( mSourceWidget->currentEntityType() ); + const QgsFields fields = QgsSensorThingsUtils::fieldsForEntityType( mSourceWidget->currentEntityType(), false ); QgsSensorThingsSubsetEditor subsetEditor( nullptr, fields ); subsetEditor.setSubsetString( txtSubsetSQL->text() ); if ( subsetEditor.exec() ) diff --git a/src/gui/providers/sensorthings/qgssensorthingssourcewidget.cpp b/src/gui/providers/sensorthings/qgssensorthingssourcewidget.cpp index 0438dde67ebf..2ca19d3a035c 100644 --- a/src/gui/providers/sensorthings/qgssensorthingssourcewidget.cpp +++ b/src/gui/providers/sensorthings/qgssensorthingssourcewidget.cpp @@ -71,7 +71,11 @@ QgsSensorThingsSourceWidget::QgsSensorThingsSourceWidget( QWidget *parent ) connect( mExpansionsTable, &QTableView::clicked, this, [this]( const QModelIndex &index ) { if ( index.column() == QgsSensorThingsExpansionsModel::Column::Actions ) { - mExpansionsModel->removeRows( index.row(), 1 ); + // only the bottom expansion (or empty rows) can be removed - otherwise we end up with inconsistent expansions! + if ( mExpansionsModel->canRemoveRow( index.row() ) ) + { + mExpansionsModel->removeRows( index.row(), 1 ); + } } } ); @@ -380,6 +384,7 @@ void QgsSensorThingsSourceWidget::setCurrentEntityType( Qgis::SensorThingsEntity mComboGeometryType->addItem( QgsIconUtils::iconForWkbType( Qgis::WkbType::MultiPoint ), tr( "Multipoint" ), QVariant::fromValue( Qgis::WkbType::MultiPoint ) ); mComboGeometryType->addItem( QgsIconUtils::iconForWkbType( Qgis::WkbType::MultiLineString ), tr( "Line" ), QVariant::fromValue( Qgis::WkbType::MultiLineString ) ); mComboGeometryType->addItem( QgsIconUtils::iconForWkbType( Qgis::WkbType::MultiPolygon ), tr( "Polygon" ), QVariant::fromValue( Qgis::WkbType::MultiPolygon ) ); + mComboGeometryType->addItem( QgsIconUtils::iconForWkbType( Qgis::WkbType::NoGeometry ), tr( "No Geometry" ), QVariant::fromValue( Qgis::WkbType::NoGeometry ) ); setCurrentGeometryTypeFromString( mSourceParts.value( QStringLiteral( "geometryType" ) ).toString() ); } else if ( geometryTypeForEntity == Qgis::GeometryType::Null && mComboGeometryType->findData( QVariant::fromValue( Qgis::WkbType::NoGeometry ) ) < 0 ) @@ -722,6 +727,25 @@ bool QgsSensorThingsExpansionsModel::insertRows( int position, int rows, const Q return true; } +bool QgsSensorThingsExpansionsModel::canRemoveRow( int row ) const +{ + if ( row >= mExpansions.size() ) + return true; + + for ( int i = mExpansions.size() - 1; i >= 0; --i ) + { + if ( row == i && mExpansions.at( i ).isValid() ) + return true; + + // when we hit the first valid expansion from the end of the list, then + // any earlier rows CANNOT be removed + if ( mExpansions.at( i ).isValid() ) + return false; + } + + return false; +} + bool QgsSensorThingsExpansionsModel::removeRows( int position, int rows, const QModelIndex &parent ) { Q_UNUSED( parent ) @@ -774,6 +798,7 @@ QWidget *QgsSensorThingsExpansionsDelegate::createEditor( QWidget *parent, const : index.model()->data( index.model()->index( index.row() - 1, 0 ), Qt::EditRole ).value(); QList compatibleEntities = QgsSensorThingsUtils::expandableTargets( entityType ); + compatibleEntities.removeAll( mBaseEntityType ); // remove all entities which are already part of the expansion in previous rows -- we don't support "circular" expansion for ( int row = index.row() - 1; row >= 0; row-- ) { @@ -956,19 +981,25 @@ void QgsSensorThingsRemoveExpansionDelegate::paint( QPainter *painter, const QSt { QStyledItemDelegate::paint( painter, option, index ); - if ( index == mHoveredIndex ) + if ( const QgsSensorThingsExpansionsModel *model = qobject_cast< const QgsSensorThingsExpansionsModel * >( index.model() ) ) { - QStyleOptionButton buttonOption; - buttonOption.initFrom( option.widget ); - buttonOption.rect = option.rect; + if ( model->canRemoveRow( index.row() ) ) + { + if ( index == mHoveredIndex ) + { + QStyleOptionButton buttonOption; + buttonOption.initFrom( option.widget ); + buttonOption.rect = option.rect; - option.widget->style()->drawControl( QStyle::CE_PushButton, &buttonOption, painter ); - } + option.widget->style()->drawControl( QStyle::CE_PushButton, &buttonOption, painter ); + } - const QIcon icon = QgsApplication::getThemeIcon( "/mIconClearItem.svg" ); - const QRect iconRect( option.rect.left() + ( option.rect.width() - 16 ) / 2, option.rect.top() + ( option.rect.height() - 16 ) / 2, 16, 16 ); + const QIcon icon = QgsApplication::getThemeIcon( "/mIconClearItem.svg" ); + const QRect iconRect( option.rect.left() + ( option.rect.width() - 16 ) / 2, option.rect.top() + ( option.rect.height() - 16 ) / 2, 16, 16 ); - icon.paint( painter, iconRect ); + icon.paint( painter, iconRect ); + } + } } void QgsSensorThingsRemoveExpansionDelegate::setHoveredIndex( const QModelIndex &index ) @@ -1007,7 +1038,7 @@ QString QgsSensorThingsFilterWidget::filter() const void QgsSensorThingsFilterWidget::setQuery() { - const QgsFields fields = QgsSensorThingsUtils::fieldsForEntityType( mEntity ); + const QgsFields fields = QgsSensorThingsUtils::fieldsForEntityType( mEntity, false ); QgsSensorThingsSubsetEditor editor( nullptr, fields, this ); editor.setSubsetString( mFilter ); if ( editor.exec() ) diff --git a/src/gui/providers/sensorthings/qgssensorthingssourcewidget.h b/src/gui/providers/sensorthings/qgssensorthingssourcewidget.h index 9ff8febac80f..9386b2a4e118 100644 --- a/src/gui/providers/sensorthings/qgssensorthingssourcewidget.h +++ b/src/gui/providers/sensorthings/qgssensorthingssourcewidget.h @@ -59,6 +59,7 @@ class QgsSensorThingsExpansionsModel : public QAbstractItemModel QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override; bool setData( const QModelIndex &index, const QVariant &value, int role ) override; bool insertRows( int position, int rows, const QModelIndex &parent = QModelIndex() ) override; + bool canRemoveRow( int row ) const; bool removeRows( int position, int rows, const QModelIndex &parent = QModelIndex() ) override; void setExpansions( const QList &expansions ); diff --git a/src/gui/qgsattributeform.cpp b/src/gui/qgsattributeform.cpp index a005c176871b..2f9a45afd2e9 100644 --- a/src/gui/qgsattributeform.cpp +++ b/src/gui/qgsattributeform.cpp @@ -460,7 +460,7 @@ bool QgsAttributeForm::saveEdits( QString *error ) n++; } - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsExpressionContext expressionContext = createExpressionContext( updatedFeature ); context->setExpressionContext( &expressionContext ); success = mLayer->changeAttributeValues( mFeature.id(), newValues, oldValues, false, context.get() ); diff --git a/src/gui/qgscredentialdialog.cpp b/src/gui/qgscredentialdialog.cpp index 8e8cd87e2da3..ffde7bd60adf 100644 --- a/src/gui/qgscredentialdialog.cpp +++ b/src/gui/qgscredentialdialog.cpp @@ -106,7 +106,7 @@ QgsCredentialDialog::QgsCredentialDialog( QWidget *parent, Qt::WindowFlags fl ) leMasterPass->setPlaceholderText( tr( "Required" ) ); chkbxPasswordHelperEnable->setText( tr( "Store/update the master password in your %1" ) - .arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME ) ); + .arg( QgsAuthManager::passwordHelperDisplayName() ) ); leUsername->setFocus(); } diff --git a/src/gui/qgsfieldmappingmodel.cpp b/src/gui/qgsfieldmappingmodel.cpp index ba5aa76ab9be..4c094ac47679 100644 --- a/src/gui/qgsfieldmappingmodel.cpp +++ b/src/gui/qgsfieldmappingmodel.cpp @@ -563,7 +563,7 @@ QgsExpressionContext QgsFieldMappingModel::ExpressionContextGenerator::createExp if ( mBaseGenerator ) { QgsExpressionContext ctx = mBaseGenerator->createExpressionContext(); - std::unique_ptr fieldMappingScope = std::make_unique( tr( "Field Mapping" ) ); + auto fieldMappingScope = std::make_unique( tr( "Field Mapping" ) ); fieldMappingScope->setFields( mSourceFields ); ctx.appendScope( fieldMappingScope.release() ); return ctx; diff --git a/src/gui/qgsformannotation.cpp b/src/gui/qgsformannotation.cpp index e5a8a1680ffd..fa67b970e3e6 100644 --- a/src/gui/qgsformannotation.cpp +++ b/src/gui/qgsformannotation.cpp @@ -46,7 +46,7 @@ QgsFormAnnotation::QgsFormAnnotation( QObject *parent ) QgsFormAnnotation *QgsFormAnnotation::clone() const { - std::unique_ptr c( new QgsFormAnnotation() ); + auto c = std::make_unique(); copyCommonProperties( c.get() ); c->setDesignerForm( mDesignerForm ); return c.release(); diff --git a/src/gui/qgsguiutils.cpp b/src/gui/qgsguiutils.cpp index 28a921a0ad3c..cc9c89ba3873 100644 --- a/src/gui/qgsguiutils.cpp +++ b/src/gui/qgsguiutils.cpp @@ -147,7 +147,7 @@ namespace QgsGuiUtils outputFileName = QFileDialog::getSaveFileName( parent, message, initialPath, formatByExtension + QStringLiteral( ";;" ) + qgsMapJoinKeys( filterMap, QStringLiteral( ";;" ) ), &selectedFilter ); #else //create a file dialog using the filter list generated above - std::unique_ptr fileDialog( new QFileDialog( parent, message, initialPath, formatByExtension + QStringLiteral( ";;" ) + qgsMapJoinKeys( filterMap, QStringLiteral( ";;" ) ) ) ); + auto fileDialog = std::make_unique( parent, message, initialPath, formatByExtension + QStringLiteral( ";;" ) + qgsMapJoinKeys( filterMap, QStringLiteral( ";;" ) ) ); // allow for selection of more than one file fileDialog->setFileMode( QFileDialog::AnyFile ); diff --git a/src/gui/qgslayermetadataresultsmodel.cpp b/src/gui/qgslayermetadataresultsmodel.cpp index e32368e561da..3a550a6c4a9d 100644 --- a/src/gui/qgslayermetadataresultsmodel.cpp +++ b/src/gui/qgslayermetadataresultsmodel.cpp @@ -169,8 +169,8 @@ void QgsLayerMetadataResultsModel::reloadAsync() const QList providers { QgsApplication::instance()->layerMetadataProviderRegistry()->layerMetadataProviders() }; for ( QgsAbstractLayerMetadataProvider *mdProvider : std::as_const( providers ) ) { - std::unique_ptr fetcher = std::make_unique( mdProvider, mSearchContext, mFeedback.get() ); - std::unique_ptr thread = std::make_unique(); + auto fetcher = std::make_unique( mdProvider, mSearchContext, mFeedback.get() ); + auto thread = std::make_unique(); fetcher->moveToThread( thread.get() ); // Forward signals to the model connect( fetcher.get(), &QgsMetadataResultsFetcher::resultsReady, this, [=]( const QgsLayerMetadataSearchResults &results ) { diff --git a/src/gui/qgslayermetadatasearchwidget.cpp b/src/gui/qgslayermetadatasearchwidget.cpp index 8fc172c4068e..f3f30d5149de 100644 --- a/src/gui/qgslayermetadatasearchwidget.cpp +++ b/src/gui/qgslayermetadatasearchwidget.cpp @@ -145,10 +145,6 @@ QgsLayerMetadataSearchWidget::QgsLayerMetadataSearchWidget( QWidget *parent, Qt: } ); connect( mButtonBox, &QDialogButtonBox::helpRequested, this, &QgsLayerMetadataSearchWidget::showHelp ); - - // Start loading metadata in the model - mSourceModel->reloadAsync(); - mIsLoading = true; } void QgsLayerMetadataSearchWidget::setMapCanvas( QgsMapCanvas *newMapCanvas ) @@ -185,6 +181,7 @@ void QgsLayerMetadataSearchWidget::updateExtentFilter( int index ) void QgsLayerMetadataSearchWidget::refresh() { + mIsLoading = true; mSourceModel->reloadAsync(); } @@ -261,6 +258,12 @@ void QgsLayerMetadataSearchWidget::showEvent( QShowEvent *event ) { QgsAbstractDataSourceWidget::showEvent( event ); mSearchFilterLineEdit->setText( mProxyModel->filterString() ); + // The first show event triggers the metadata loading + if ( !mIsInitialized ) + { + refresh(); + mIsInitialized = true; + } } void QgsLayerMetadataSearchWidget::showHelp() diff --git a/src/gui/qgslayermetadatasearchwidget.h b/src/gui/qgslayermetadatasearchwidget.h index 406c8e98a081..2dcb35845ded 100644 --- a/src/gui/qgslayermetadatasearchwidget.h +++ b/src/gui/qgslayermetadatasearchwidget.h @@ -59,6 +59,7 @@ class GUI_EXPORT QgsLayerMetadataSearchWidget : public QgsAbstractDataSourceWidg private: QgsLayerMetadataResultsProxyModel *mProxyModel = nullptr; bool mIsLoading = false; + bool mIsInitialized = false; QgsLayerMetadataResultsModel *mSourceModel = nullptr; // QWidget interface diff --git a/src/gui/qgsmanageconnectionsdialog.cpp b/src/gui/qgsmanageconnectionsdialog.cpp index dd0460ae0001..59bed6444fd7 100644 --- a/src/gui/qgsmanageconnectionsdialog.cpp +++ b/src/gui/qgsmanageconnectionsdialog.cpp @@ -461,6 +461,14 @@ bool QgsManageConnectionsDialog::populateConnections() return true; } +static void addNamespaceDeclarations( QDomElement &root, const QMap &namespaceDeclarations ) +{ + for ( auto it = namespaceDeclarations.begin(); it != namespaceDeclarations.end(); ++it ) + { + root.setAttribute( QStringLiteral( "xmlns:" ) + it.key(), it.value() ); + } +} + QDomDocument QgsManageConnectionsDialog::saveOWSConnections( const QStringList &connections, const QString &service ) { QDomDocument doc( QStringLiteral( "connections" ) ); @@ -468,6 +476,7 @@ QDomDocument QgsManageConnectionsDialog::saveOWSConnections( const QStringList & root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) ); doc.appendChild( root ); + QMap namespaceDeclarations; for ( int i = 0; i < connections.count(); ++i ) { QDomElement el = doc.createElement( service.toLower() ); @@ -484,7 +493,7 @@ QDomDocument QgsManageConnectionsDialog::saveOWSConnections( const QStringList & el.setAttribute( QStringLiteral( "dpiMode" ), static_cast( QgsOwsConnection::settingsDpiMode->value( { service.toLower(), connections[i] } ) ) ); QgsHttpHeaders httpHeader( QgsOwsConnection::settingsHeaders->value( { service.toLower(), connections[i] } ) ); - httpHeader.updateDomElement( el ); + httpHeader.updateDomElement( el, namespaceDeclarations ); } el.setAttribute( QStringLiteral( "username" ), QgsOwsConnection::settingsUsername->value( { service.toLower(), connections[i] } ) ); @@ -492,6 +501,8 @@ QDomDocument QgsManageConnectionsDialog::saveOWSConnections( const QStringList & root.appendChild( el ); } + addNamespaceDeclarations( root, namespaceDeclarations ); + return doc; } @@ -710,6 +721,7 @@ QDomDocument QgsManageConnectionsDialog::saveXyzTilesConnections( const QStringL root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) ); doc.appendChild( root ); + QMap namespaceDeclarations; for ( int i = 0; i < connections.count(); ++i ) { QDomElement el = doc.createElement( QStringLiteral( "xyztiles" ) ); @@ -724,11 +736,13 @@ QDomDocument QgsManageConnectionsDialog::saveXyzTilesConnections( const QStringL el.setAttribute( QStringLiteral( "tilePixelRatio" ), QgsXyzConnectionSettings::settingsTilePixelRatio->value( connections[i] ) ); QgsHttpHeaders httpHeader( QgsXyzConnectionSettings::settingsHeaders->value( connections[i] ) ); - httpHeader.updateDomElement( el ); + httpHeader.updateDomElement( el, namespaceDeclarations ); root.appendChild( el ); } + addNamespaceDeclarations( root, namespaceDeclarations ); + return doc; } @@ -739,6 +753,7 @@ QDomDocument QgsManageConnectionsDialog::saveArcgisConnections( const QStringLis root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) ); doc.appendChild( root ); + QMap namespaceDeclarations; for ( const QString &connection : connections ) { QDomElement el = doc.createElement( QStringLiteral( "arcgisfeatureserver" ) ); @@ -746,7 +761,7 @@ QDomDocument QgsManageConnectionsDialog::saveArcgisConnections( const QStringLis el.setAttribute( QStringLiteral( "url" ), QgsArcGisConnectionSettings::settingsUrl->value( connection ) ); QgsHttpHeaders httpHeader( QgsArcGisConnectionSettings::settingsHeaders->value( connection ) ); - httpHeader.updateDomElement( el ); + httpHeader.updateDomElement( el, namespaceDeclarations ); el.setAttribute( QStringLiteral( "username" ), QgsArcGisConnectionSettings::settingsUsername->value( connection ) ); el.setAttribute( QStringLiteral( "password" ), QgsArcGisConnectionSettings::settingsPassword->value( connection ) ); @@ -755,6 +770,8 @@ QDomDocument QgsManageConnectionsDialog::saveArcgisConnections( const QStringLis root.appendChild( el ); } + addNamespaceDeclarations( root, namespaceDeclarations ); + return doc; } @@ -765,6 +782,7 @@ QDomDocument QgsManageConnectionsDialog::saveVectorTileConnections( const QStrin root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) ); doc.appendChild( root ); + QMap namespaceDeclarations; for ( int i = 0; i < connections.count(); ++i ) { QDomElement el = doc.createElement( QStringLiteral( "vectortile" ) ); @@ -780,11 +798,13 @@ QDomDocument QgsManageConnectionsDialog::saveVectorTileConnections( const QStrin el.setAttribute( QStringLiteral( "styleUrl" ), QgsVectorTileProviderConnection::settingsStyleUrl->value( connections[i] ) ); QgsHttpHeaders httpHeader( QgsVectorTileProviderConnection::settingsHeaders->value( connections[i] ) ); - httpHeader.updateDomElement( el ); + httpHeader.updateDomElement( el, namespaceDeclarations ); root.appendChild( el ); } + addNamespaceDeclarations( root, namespaceDeclarations ); + return doc; } @@ -795,6 +815,7 @@ QDomDocument QgsManageConnectionsDialog::saveTiledSceneConnections( const QStrin root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) ); doc.appendChild( root ); + QMap namespaceDeclarations; for ( int i = 0; i < connections.count(); ++i ) { QDomElement el = doc.createElement( QStringLiteral( "tiledscene" ) ); @@ -807,11 +828,13 @@ QDomDocument QgsManageConnectionsDialog::saveTiledSceneConnections( const QStrin el.setAttribute( QStringLiteral( "password" ), QgsTiledSceneProviderConnection::settingsPassword->value( connections[i] ) ); QgsHttpHeaders httpHeader( QgsTiledSceneProviderConnection::settingsHeaders->value( connections[i] ) ); - httpHeader.updateDomElement( el ); + httpHeader.updateDomElement( el, namespaceDeclarations ); root.appendChild( el ); } + addNamespaceDeclarations( root, namespaceDeclarations ); + return doc; } @@ -822,6 +845,7 @@ QDomDocument QgsManageConnectionsDialog::saveSensorThingsConnections( const QStr root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) ); doc.appendChild( root ); + QMap namespaceDeclarations; for ( int i = 0; i < connections.count(); ++i ) { QDomElement el = doc.createElement( QStringLiteral( "sensorthings" ) ); @@ -833,11 +857,13 @@ QDomDocument QgsManageConnectionsDialog::saveSensorThingsConnections( const QStr el.setAttribute( QStringLiteral( "password" ), QgsSensorThingsProviderConnection::settingsPassword->value( connections[i] ) ); QgsHttpHeaders httpHeader( QgsTiledSceneProviderConnection::settingsHeaders->value( connections[i] ) ); - httpHeader.updateDomElement( el ); + httpHeader.updateDomElement( el, namespaceDeclarations ); root.appendChild( el ); } + addNamespaceDeclarations( root, namespaceDeclarations ); + return doc; } @@ -882,6 +908,7 @@ QDomDocument QgsManageConnectionsDialog::saveStacConnections( const QStringList root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) ); doc.appendChild( root ); + QMap namespaceDeclarations; for ( int i = 0; i < connections.count(); ++i ) { QDomElement el = doc.createElement( QStringLiteral( "stac" ) ); @@ -893,11 +920,13 @@ QDomDocument QgsManageConnectionsDialog::saveStacConnections( const QStringList el.setAttribute( QStringLiteral( "password" ), QgsStacConnection::settingsPassword->value( connections[i] ) ); QgsHttpHeaders httpHeader( QgsStacConnection::settingsHeaders->value( connections[i] ) ); - httpHeader.updateDomElement( el ); + httpHeader.updateDomElement( el, namespaceDeclarations ); root.appendChild( el ); } + addNamespaceDeclarations( root, namespaceDeclarations ); + return doc; } diff --git a/src/gui/qgsmapcanvas.cpp b/src/gui/qgsmapcanvas.cpp index c0ceac34e9c6..f08c20df9f9d 100644 --- a/src/gui/qgsmapcanvas.cpp +++ b/src/gui/qgsmapcanvas.cpp @@ -2419,7 +2419,7 @@ void QgsMapCanvas::mouseDoubleClickEvent( QMouseEvent *e ) // call handler of current map tool if ( mMapTool ) { - std::unique_ptr me( new QgsMapMouseEvent( this, e ) ); + auto me = std::make_unique( this, e ); mMapTool->canvasDoubleClickEvent( me.get() ); } } // mouseDoubleClickEvent @@ -2528,13 +2528,13 @@ void QgsMapCanvas::mousePressEvent( QMouseEvent *e ) } else if ( mMapTool->flags() & QgsMapTool::ShowContextMenu && e->button() == Qt::RightButton ) { - std::unique_ptr me( new QgsMapMouseEvent( this, e ) ); + auto me = std::make_unique( this, e ); showContextMenu( me.get() ); return; } else { - std::unique_ptr me( new QgsMapMouseEvent( this, e ) ); + auto me = std::make_unique( this, e ); mMapTool->canvasPressEvent( me.get() ); } } @@ -2583,7 +2583,7 @@ void QgsMapCanvas::mouseReleaseEvent( QMouseEvent *e ) // call handler of current map tool if ( mMapTool ) { - std::unique_ptr me( new QgsMapMouseEvent( this, e ) ); + auto me = std::make_unique( this, e ); mMapTool->canvasReleaseEvent( me.get() ); } } @@ -2762,7 +2762,7 @@ void QgsMapCanvas::mouseMoveEvent( QMouseEvent *e ) // call handler of current map tool if ( mMapTool ) { - std::unique_ptr me( new QgsMapMouseEvent( this, e ) ); + auto me = std::make_unique( this, e ); mMapTool->canvasMoveEvent( me.get() ); } } diff --git a/src/gui/qgsmaskingwidget.cpp b/src/gui/qgsmaskingwidget.cpp index 86e353d20401..aa42c2dc4715 100644 --- a/src/gui/qgsmaskingwidget.cpp +++ b/src/gui/qgsmaskingwidget.cpp @@ -264,17 +264,13 @@ bool SymbolLayerVisitor::visitEnter( const QgsStyleEntityVisitorInterface::Node if ( node.type != QgsStyleEntityVisitorInterface::NodeType::SymbolRule ) return false; - mSymbolKey = node.identifier; return true; } -void SymbolLayerVisitor::visitSymbol( const QgsSymbol *symbol, const QString &leafIdentifier, QVector rootPath ) +void SymbolLayerVisitor::visitSymbol( const QgsSymbol *symbol, const QString &leafIdentifier ) { for ( int idx = 0; idx < symbol->symbolLayerCount(); idx++ ) { - QVector indexPath = rootPath; - indexPath.push_back( idx ); - const QgsSymbolLayer *sl = symbol->symbolLayer( idx ); mCallback( sl, sl->id() ); @@ -282,7 +278,7 @@ void SymbolLayerVisitor::visitSymbol( const QgsSymbol *symbol, const QString &le // recurse over sub symbols const QgsSymbol *subSymbol = const_cast( sl )->subSymbol(); if ( subSymbol ) - visitSymbol( subSymbol, leafIdentifier, indexPath ); + visitSymbol( subSymbol, leafIdentifier ); } } @@ -292,7 +288,7 @@ bool SymbolLayerVisitor::visit( const QgsStyleEntityVisitorInterface::StyleLeaf { auto symbolEntity = static_cast( leaf.entity ); if ( symbolEntity->symbol() ) - visitSymbol( symbolEntity->symbol(), leaf.identifier, {} ); + visitSymbol( symbolEntity->symbol(), leaf.identifier ); } return true; } diff --git a/src/gui/qgsmaskingwidget.h b/src/gui/qgsmaskingwidget.h index 019ed9b167cf..245f311fbb7c 100644 --- a/src/gui/qgsmaskingwidget.h +++ b/src/gui/qgsmaskingwidget.h @@ -86,13 +86,11 @@ class SymbolLayerVisitor : public QgsStyleEntityVisitorInterface bool visitEnter( const QgsStyleEntityVisitorInterface::Node &node ) override; //! Process a symbol - void visitSymbol( const QgsSymbol *symbol, const QString &leafIdentifier, QVector rootPath ); + void visitSymbol( const QgsSymbol *symbol, const QString &leafIdentifier ); bool visit( const QgsStyleEntityVisitorInterface::StyleLeaf &leaf ) override; private: - QString mSymbolKey; - QList>> mMasks; SymbolLayerCallback mCallback; }; diff --git a/src/gui/qgsmasksourceselectionwidget.cpp b/src/gui/qgsmasksourceselectionwidget.cpp index 03113ea741cd..6efd7af9ff49 100644 --- a/src/gui/qgsmasksourceselectionwidget.cpp +++ b/src/gui/qgsmasksourceselectionwidget.cpp @@ -229,7 +229,7 @@ void QgsMaskSourceSelectionWidget::update() if ( !vl->renderer() ) continue; - std::unique_ptr layerItem = std::make_unique( mTree, QStringList() << layer->name() ); + auto layerItem = std::make_unique( mTree, QStringList() << layer->name() ); layerItem->setData( 0, Qt::UserRole, QVariant::fromValue( vl ) ); if ( vl->labeling() ) diff --git a/src/gui/qgsnewgeopackagelayerdialog.cpp b/src/gui/qgsnewgeopackagelayerdialog.cpp index 4cf264bdf456..6b0f85c43667 100644 --- a/src/gui/qgsnewgeopackagelayerdialog.cpp +++ b/src/gui/qgsnewgeopackagelayerdialog.cpp @@ -566,7 +566,7 @@ bool QgsNewGeoPackageLayerDialog::apply() const QString uri( QStringLiteral( "%1|layername=%2" ).arg( fileName, tableName ) ); const QString userVisiblelayerName( layerIdentifier.isEmpty() ? tableName : layerIdentifier ); const QgsVectorLayer::LayerOptions layerOptions { QgsProject::instance()->transformContext() }; - std::unique_ptr layer = std::make_unique( uri, userVisiblelayerName, QStringLiteral( "ogr" ), layerOptions ); + auto layer = std::make_unique( uri, userVisiblelayerName, QStringLiteral( "ogr" ), layerOptions ); if ( layer->isValid() ) { if ( mAddToProject ) diff --git a/src/gui/qgsnewhttpconnection.cpp b/src/gui/qgsnewhttpconnection.cpp index a444bc43d930..3327a5f4c6d7 100644 --- a/src/gui/qgsnewhttpconnection.cpp +++ b/src/gui/qgsnewhttpconnection.cpp @@ -187,10 +187,10 @@ QgsNewHttpConnection::QgsNewHttpConnection( QWidget *parent, ConnectionTypes typ void QgsNewHttpConnection::wfsVersionCurrentIndexChanged( int index ) { // For now 2019-06-06, leave paging checkable for some WFS version 1.1 servers with support - cmbFeaturePaging->setEnabled( index == WFS_VERSION_MAX || index >= WFS_VERSION_2_0 ); - const bool pagingNotDisabled = cmbFeaturePaging->currentIndex() != static_cast( QgsNewHttpConnection::WfsFeaturePagingIndex::DISABLED ); - lblPageSize->setEnabled( pagingNotDisabled && ( index == WFS_VERSION_MAX || index >= WFS_VERSION_1_1 ) ); - txtPageSize->setEnabled( pagingNotDisabled && ( index == WFS_VERSION_MAX || index >= WFS_VERSION_1_1 ) ); + const bool pagingOptionsEnabled = ( index == WFS_VERSION_MAX || index >= WFS_VERSION_1_1 ); + cmbFeaturePaging->setEnabled( pagingOptionsEnabled ); + lblPageSize->setEnabled( pagingOptionsEnabled ); + txtPageSize->setEnabled( pagingOptionsEnabled ); cbxWfsIgnoreAxisOrientation->setEnabled( index != WFS_VERSION_1_0 && index != WFS_VERSION_API_FEATURES_1_0 ); cbxWfsInvertAxisOrientation->setEnabled( index != WFS_VERSION_API_FEATURES_1_0 ); wfsUseGml2EncodingForTransactions()->setEnabled( index == WFS_VERSION_1_1 ); diff --git a/src/gui/qgsnewvectorlayerdialog.cpp b/src/gui/qgsnewvectorlayerdialog.cpp index 181e5a9059ed..fb5ffd03f8f1 100644 --- a/src/gui/qgsnewvectorlayerdialog.cpp +++ b/src/gui/qgsnewvectorlayerdialog.cpp @@ -31,6 +31,8 @@ #include "qgsvariantutils.h" #include "qgsogrproviderutils.h" +#include + #include #include #include @@ -57,6 +59,9 @@ QgsNewVectorLayerDialog::QgsNewVectorLayerDialog( QWidget *parent, Qt::WindowFla mTypeBox->addItem( QgsFields::iconForFieldType( QMetaType::Type::Int ), QgsVariantUtils::typeToDisplayString( QMetaType::Type::Int ), "Integer" ); mTypeBox->addItem( QgsFields::iconForFieldType( QMetaType::Type::Double ), QgsVariantUtils::typeToDisplayString( QMetaType::Type::Double ), "Real" ); mTypeBox->addItem( QgsFields::iconForFieldType( QMetaType::Type::QDate ), QgsVariantUtils::typeToDisplayString( QMetaType::Type::QDate ), "Date" ); +#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION( 3, 9, 0 ) + mTypeBox->addItem( QgsFields::iconForFieldType( QMetaType::Type::Bool ), QgsVariantUtils::typeToDisplayString( QMetaType::Type::Bool ), "bool" ); +#endif mWidth->setValidator( new QIntValidator( 1, 255, this ) ); mPrecision->setValidator( new QIntValidator( 0, 15, this ) ); @@ -154,6 +159,7 @@ void QgsNewVectorLayerDialog::mTypeBox_currentIndexChanged( int index ) if ( mWidth->text().toInt() < 1 || mWidth->text().toInt() > 255 ) mWidth->setText( QStringLiteral( "80" ) ); mPrecision->setEnabled( false ); + mWidth->setEnabled( true ); mWidth->setValidator( new QIntValidator( 1, 255, this ) ); break; @@ -161,6 +167,7 @@ void QgsNewVectorLayerDialog::mTypeBox_currentIndexChanged( int index ) if ( mWidth->text().toInt() < 1 || mWidth->text().toInt() > 10 ) mWidth->setText( QStringLiteral( "10" ) ); mPrecision->setEnabled( false ); + mWidth->setEnabled( true ); mWidth->setValidator( new QIntValidator( 1, 10, this ) ); break; @@ -171,11 +178,15 @@ void QgsNewVectorLayerDialog::mTypeBox_currentIndexChanged( int index ) mPrecision->setText( QStringLiteral( "6" ) ); mPrecision->setEnabled( true ); + mWidth->setEnabled( true ); mWidth->setValidator( new QIntValidator( 1, 20, this ) ); break; default: - QgsDebugError( QStringLiteral( "unexpected index" ) ); + mPrecision->setEnabled( false ); + mWidth->setEnabled( false ); + mWidth->clear(); + mPrecision->clear(); break; } } diff --git a/src/gui/qgsrichtexteditor.cpp b/src/gui/qgsrichtexteditor.cpp index d8775783886f..6bb022e97676 100644 --- a/src/gui/qgsrichtexteditor.cpp +++ b/src/gui/qgsrichtexteditor.cpp @@ -318,12 +318,12 @@ QString QgsRichTextEditor::toHtml() const void QgsRichTextEditor::editSource( bool enabled ) { - if ( enabled ) + if ( enabled && mStackedWidget->currentIndex() == 0 ) { mSourceEdit->setText( mTextEdit->toHtml() ); mStackedWidget->setCurrentIndex( 1 ); } - else + else if ( !enabled && mStackedWidget->currentIndex() == 1 ) { mTextEdit->setHtml( mSourceEdit->text() ); mStackedWidget->setCurrentIndex( 0 ); @@ -752,16 +752,21 @@ void QgsRichTextEditor::setText( const QString &text ) { if ( text.isEmpty() ) { - setPlainText( text ); + mTextEdit->setPlainText( text ); + mSourceEdit->clear(); return; } - if ( text[0] == '<' ) + + const thread_local QRegularExpression sIsHtmlRx( QStringLiteral( "^\\s*<" ) ); + if ( sIsHtmlRx.match( text ).hasMatch() ) { - setHtml( text ); + mTextEdit->setHtml( text ); + mSourceEdit->setText( text ); } else { - setPlainText( text ); + mTextEdit->setPlainText( text ); + mSourceEdit->setText( text ); } } diff --git a/src/gui/qgsrichtexteditor.h b/src/gui/qgsrichtexteditor.h index c83551ddeda1..37968593d737 100644 --- a/src/gui/qgsrichtexteditor.h +++ b/src/gui/qgsrichtexteditor.h @@ -162,8 +162,6 @@ class GUI_EXPORT QgsRichTextEditor : public QWidget, protected Ui::QgsRichTextEd void focusInEvent( QFocusEvent *event ) override; private slots: - void setPlainText( const QString &text ) { mTextEdit->setPlainText( text ); } - void setHtml( const QString &text ) { mTextEdit->setHtml( text ); } void textRemoveFormat(); void textRemoveAllFormat(); void textBold(); diff --git a/src/gui/qgsvaliditycheckresultswidget.cpp b/src/gui/qgsvaliditycheckresultswidget.cpp index 0e09651591b9..1defa57c0484 100644 --- a/src/gui/qgsvaliditycheckresultswidget.cpp +++ b/src/gui/qgsvaliditycheckresultswidget.cpp @@ -128,8 +128,8 @@ void QgsValidityCheckResultsWidget::setDescription( const QString &description ) bool QgsValidityCheckResultsWidget::runChecks( int type, const QgsValidityCheckContext *context, const QString &title, const QString &description, QWidget *parent ) { - std::unique_ptr feedback = std::make_unique(); - std::unique_ptr progressDialog = std::make_unique( tr( "Running Checks…" ), tr( "Abort" ), 0, 100, parent ); + auto feedback = std::make_unique(); + auto progressDialog = std::make_unique( tr( "Running Checks…" ), tr( "Abort" ), 0, 100, parent ); progressDialog->setWindowTitle( title ); QgsProxyProgressTask *proxyTask = new QgsProxyProgressTask( tr( "Running Checks" ) ); diff --git a/src/gui/raster/qgsloadrasterattributetabledialog.cpp b/src/gui/raster/qgsloadrasterattributetabledialog.cpp index 46d0eabba475..758379428adf 100644 --- a/src/gui/raster/qgsloadrasterattributetabledialog.cpp +++ b/src/gui/raster/qgsloadrasterattributetabledialog.cpp @@ -82,7 +82,7 @@ void QgsLoadRasterAttributeTableDialog::accept() } else { - std::unique_ptr rat = std::make_unique(); + auto rat = std::make_unique(); QString errorMessage; success = rat->readFromFile( filePath(), &errorMessage ); diff --git a/src/gui/raster/qgsrasterlabelingwidget.cpp b/src/gui/raster/qgsrasterlabelingwidget.cpp index ac94f9aea1ba..a87645c15fd3 100644 --- a/src/gui/raster/qgsrasterlabelingwidget.cpp +++ b/src/gui/raster/qgsrasterlabelingwidget.cpp @@ -104,7 +104,7 @@ void QgsRasterLabelingWidget::writeSettingsToLayer() const QString mode = mLabelModeComboBox->currentData().toString(); if ( mode == QLatin1String( "simple" ) ) { - std::unique_ptr labeling = std::make_unique(); + auto labeling = std::make_unique(); if ( QgsRasterLabelSettingsWidget *settingsWidget = qobject_cast( mWidget ) ) { settingsWidget->updateLabeling( labeling.get() ); @@ -154,7 +154,7 @@ void QgsRasterLabelingWidget::labelModeChanged( int index ) mWidget = settingsWidget; if ( !dynamic_cast( mLayer->labeling() ) ) { - std::unique_ptr labeling = std::make_unique(); + auto labeling = std::make_unique(); settingsWidget->setLabeling( labeling.get() ); mLayer->setLabeling( labeling.release() ); } diff --git a/src/gui/raster/qgsrasterlayerproperties.cpp b/src/gui/raster/qgsrasterlayerproperties.cpp index a8db645d107b..5179b6336716 100644 --- a/src/gui/raster/qgsrasterlayerproperties.cpp +++ b/src/gui/raster/qgsrasterlayerproperties.cpp @@ -816,6 +816,9 @@ void QgsRasterLayerProperties::sync() mInvertColorsCheck->setChecked( hueSaturationFilter->invertColors() ); } + // Resampling + mResamplingUtils.refreshWidgetsFromLayer(); + mRefreshSettingsWidget->syncToLayer(); QgsDebugMsgLevel( QStringLiteral( "populate general tab" ), 3 ); @@ -1091,7 +1094,7 @@ void QgsRasterLayerProperties::buttonBuildPyramids_clicked() { QgsRasterDataProvider *provider = mRasterLayer->dataProvider(); - std::unique_ptr feedback( new QgsRasterBlockFeedback() ); + auto feedback = std::make_unique(); connect( feedback.get(), &QgsRasterBlockFeedback::progressChanged, mPyramidProgress, &QProgressBar::setValue ); // diff --git a/src/gui/raster/qgsrasterlayertemporalpropertieswidget.cpp b/src/gui/raster/qgsrasterlayertemporalpropertieswidget.cpp index d0b250206d76..1d4d9dc9780d 100644 --- a/src/gui/raster/qgsrasterlayertemporalpropertieswidget.cpp +++ b/src/gui/raster/qgsrasterlayertemporalpropertieswidget.cpp @@ -236,6 +236,7 @@ void QgsRasterLayerTemporalPropertiesWidget::calculateRangeByExpression( bool is bandScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "band_description" ), mLayer->dataProvider()->bandDescription( 1 ), true, false, tr( "Band description" ) ) ); expressionContext.appendScope( bandScope ); + expressionContext.appendScopes( QgsExpressionContextUtils::globalProjectLayerScopes( mLayer ) ); expressionContext.setHighlightedVariables( { QStringLiteral( "band" ), QStringLiteral( "band_name" ), QStringLiteral( "band_description" ) } ); QgsExpressionBuilderDialog dlg = QgsExpressionBuilderDialog( nullptr, isUpper ? mFixedRangeUpperExpression : mFixedRangeLowerExpression, this, QStringLiteral( "generic" ), expressionContext ); diff --git a/src/gui/stac/qgsstacsourceselectprovider.cpp b/src/gui/stac/qgsstacsourceselectprovider.cpp index c2862c3feedc..3baa44f75a5f 100644 --- a/src/gui/stac/qgsstacsourceselectprovider.cpp +++ b/src/gui/stac/qgsstacsourceselectprovider.cpp @@ -49,5 +49,5 @@ QgsAbstractDataSourceWidget *QgsStacSourceSelectProvider::createDataSourceWidget int QgsStacSourceSelectProvider::ordering() const { - return OrderSearchProvider; + return OrderRemoteProvider + 201; } diff --git a/src/gui/symbology/qgscategorizedsymbolrendererwidget.cpp b/src/gui/symbology/qgscategorizedsymbolrendererwidget.cpp index 71e887fbcd6a..df461a52d892 100644 --- a/src/gui/symbology/qgscategorizedsymbolrendererwidget.cpp +++ b/src/gui/symbology/qgscategorizedsymbolrendererwidget.cpp @@ -1031,7 +1031,7 @@ void QgsCategorizedSymbolRendererWidget::addCategories() */ // recreate renderer - std::unique_ptr r = std::make_unique( attrName, cats ); + auto r = std::make_unique( attrName, cats ); r->setSourceSymbol( mCategorizedSymbol->clone() ); std::unique_ptr ramp( btnColorRamp->colorRamp() ); if ( ramp ) diff --git a/src/gui/symbology/qgslayerpropertieswidget.cpp b/src/gui/symbology/qgslayerpropertieswidget.cpp index 952c7c695d7a..1fbcd11d85c8 100644 --- a/src/gui/symbology/qgslayerpropertieswidget.cpp +++ b/src/gui/symbology/qgslayerpropertieswidget.cpp @@ -350,21 +350,21 @@ void QgsLayerPropertiesWidget::layerTypeChanged() { case Qgis::SymbolType::Marker: { - std::unique_ptr markerSymbol = std::make_unique( QgsSymbolLayerList( { layer->clone() } ) ); + auto markerSymbol = std::make_unique( QgsSymbolLayerList( { layer->clone() } ) ); generator->setSymbolType( Qgis::SymbolType::Marker ); generator->setSubSymbol( markerSymbol.release() ); break; } case Qgis::SymbolType::Line: { - std::unique_ptr lineSymbol = std::make_unique( QgsSymbolLayerList( { layer->clone() } ) ); + auto lineSymbol = std::make_unique( QgsSymbolLayerList( { layer->clone() } ) ); generator->setSymbolType( Qgis::SymbolType::Line ); generator->setSubSymbol( lineSymbol.release() ); break; } case Qgis::SymbolType::Fill: { - std::unique_ptr fillSymbol = std::make_unique( QgsSymbolLayerList( { layer->clone() } ) ); + auto fillSymbol = std::make_unique( QgsSymbolLayerList( { layer->clone() } ) ); generator->setSymbolType( Qgis::SymbolType::Fill ); generator->setSubSymbol( fillSymbol.release() ); break; diff --git a/src/gui/symbology/qgspointclusterrendererwidget.cpp b/src/gui/symbology/qgspointclusterrendererwidget.cpp index eec2d94340b7..a8ffb60bdc52 100644 --- a/src/gui/symbology/qgspointclusterrendererwidget.cpp +++ b/src/gui/symbology/qgspointclusterrendererwidget.cpp @@ -212,6 +212,7 @@ QgsExpressionContext QgsPointClusterRendererWidget::createExpressionContext() co { context << new QgsExpressionContextScope( s ); } + context.setHighlightedVariables( QStringList() << QgsExpressionContext::EXPR_CLUSTER_COLOR << QgsExpressionContext::EXPR_CLUSTER_SIZE ); return context; } diff --git a/src/gui/symbology/qgssymbolselectordialog.cpp b/src/gui/symbology/qgssymbolselectordialog.cpp index 3e42b8ccc9da..982dac7050b7 100644 --- a/src/gui/symbology/qgssymbolselectordialog.cpp +++ b/src/gui/symbology/qgssymbolselectordialog.cpp @@ -417,9 +417,13 @@ void QgsSymbolSelectorWidget::setContext( const QgsSymbolWidgetContext &context QWidget *widget = stackedWidget->currentWidget(); if ( QgsLayerPropertiesWidget *layerProp = qobject_cast( widget ) ) + { layerProp->setContext( context ); + } else if ( QgsSymbolsListWidget *listWidget = qobject_cast( widget ) ) + { listWidget->setContext( context ); + } layerChanged(); updatePreview(); @@ -872,12 +876,12 @@ QMenu *QgsSymbolSelectorDialog::advancedMenu() void QgsSymbolSelectorDialog::setContext( const QgsSymbolWidgetContext &context ) { - mContext = context; + mSelectorWidget->setContext( context ); } QgsSymbolWidgetContext QgsSymbolSelectorDialog::context() const { - return mContext; + return mSelectorWidget->context(); } QgsSymbol *QgsSymbolSelectorDialog::symbol() diff --git a/src/gui/symbology/qgssymbolselectordialog.h b/src/gui/symbology/qgssymbolselectordialog.h index b7e1be826bb3..8b1df281a776 100644 --- a/src/gui/symbology/qgssymbolselectordialog.h +++ b/src/gui/symbology/qgssymbolselectordialog.h @@ -398,7 +398,6 @@ class GUI_EXPORT QgsSymbolSelectorDialog : public QDialog QgsSymbolSelectorWidget *mSelectorWidget = nullptr; QDialogButtonBox *mButtonBox = nullptr; - QgsSymbolWidgetContext mContext; }; #endif diff --git a/src/gui/tiledscene/qgstiledsceneconnectiondialog.cpp b/src/gui/tiledscene/qgstiledsceneconnectiondialog.cpp index 6eb9750758c6..4b54c5bfc8fb 100644 --- a/src/gui/tiledscene/qgstiledsceneconnectiondialog.cpp +++ b/src/gui/tiledscene/qgstiledsceneconnectiondialog.cpp @@ -17,6 +17,8 @@ #include "moc_qgstiledsceneconnectiondialog.cpp" #include "qgstiledsceneconnection.h" #include "qgsgui.h" +#include "qgssettings.h" + #include #include @@ -37,6 +39,7 @@ QgsTiledSceneConnectionDialog::QgsTiledSceneConnectionDialog( QWidget *parent ) void QgsTiledSceneConnectionDialog::setConnection( const QString &name, const QString &uri ) { mEditName->setText( name ); + mOriginalConnectionName = name; const QgsTiledSceneProviderConnection::Data conn = QgsTiledSceneProviderConnection::decodedUri( uri ); mEditUrl->setText( conn.url ); @@ -73,6 +76,16 @@ void QgsTiledSceneConnectionDialog::updateOkButtonState() void QgsTiledSceneConnectionDialog::accept() { + const QString newConnectionName = mEditName->text(); + + // on rename delete original entry first + if ( !mOriginalConnectionName.isNull() && mOriginalConnectionName != newConnectionName ) + { + QgsSettings settings; + QgsTiledSceneProviderConnection( QString() ).remove( mOriginalConnectionName ); + settings.sync(); + } + QDialog::accept(); } diff --git a/src/gui/tiledscene/qgstiledsceneconnectiondialog.h b/src/gui/tiledscene/qgstiledsceneconnectiondialog.h index 8c22b91c422d..038a08c2c1b9 100644 --- a/src/gui/tiledscene/qgstiledsceneconnectiondialog.h +++ b/src/gui/tiledscene/qgstiledsceneconnectiondialog.h @@ -39,6 +39,9 @@ class QgsTiledSceneConnectionDialog : public QDialog, public Ui::QgsTiledSceneCo private slots: void updateOkButtonState(); + + private: + QString mOriginalConnectionName; //store initial name to delete entry in case of rename }; ///@endcond diff --git a/src/gui/tiledscene/qgstiledscenetexturerendererwidget.cpp b/src/gui/tiledscene/qgstiledscenetexturerendererwidget.cpp index cb46a7b1a8ab..834c0a5308d1 100644 --- a/src/gui/tiledscene/qgstiledscenetexturerendererwidget.cpp +++ b/src/gui/tiledscene/qgstiledscenetexturerendererwidget.cpp @@ -46,7 +46,7 @@ QgsTiledSceneRendererWidget *QgsTiledSceneTextureRendererWidget::create( QgsTile QgsTiledSceneRenderer *QgsTiledSceneTextureRendererWidget::renderer() { - std::unique_ptr renderer = std::make_unique(); + auto renderer = std::make_unique(); renderer->setFillSymbol( mFillSymbolButton->clonedSymbol() ); return renderer.release(); diff --git a/src/gui/tiledscene/qgstiledscenewireframerendererwidget.cpp b/src/gui/tiledscene/qgstiledscenewireframerendererwidget.cpp index 7032cf0a1b32..079070272c25 100644 --- a/src/gui/tiledscene/qgstiledscenewireframerendererwidget.cpp +++ b/src/gui/tiledscene/qgstiledscenewireframerendererwidget.cpp @@ -51,7 +51,7 @@ QgsTiledSceneRendererWidget *QgsTiledSceneWireframeRendererWidget::create( QgsTi QgsTiledSceneRenderer *QgsTiledSceneWireframeRendererWidget::renderer() { - std::unique_ptr renderer = std::make_unique(); + auto renderer = std::make_unique(); renderer->setFillSymbol( mFillSymbolButton->clonedSymbol() ); renderer->setLineSymbol( mLineSymbolButton->clonedSymbol() ); renderer->setUseTextureColors( mCheckUseTextureColors->isChecked() ); diff --git a/src/gui/vector/qgsattributesformproperties.cpp b/src/gui/vector/qgsattributesformproperties.cpp index f9957cc4ff33..99c9af2449e6 100644 --- a/src/gui/vector/qgsattributesformproperties.cpp +++ b/src/gui/vector/qgsattributesformproperties.cpp @@ -327,7 +327,7 @@ void QgsAttributesFormProperties::loadAttributeTypeDialog() mAttributeTypeFrame->layout()->addWidget( mAttributeTypeDialog ); } -void QgsAttributesFormProperties::loadAttributeTypeDialogFromConfiguration( const FieldConfig config ) +void QgsAttributesFormProperties::loadAttributeTypeDialogFromConfiguration( const FieldConfig &config ) { const QgsFieldConstraints constraints = config.mFieldConstraints; @@ -643,7 +643,13 @@ void QgsAttributesFormProperties::loadAttributeSpecificEditor( QgsAttributesDnDT const Qgis::AttributeFormLayout layout = mEditorLayoutComboBox->currentData().value(); if ( layout == Qgis::AttributeFormLayout::DragAndDrop ) + { storeAttributeWidgetEdit(); + } + if ( mAttributeTypeDialog ) + { + storeAttributeTypeDialog(); + } clearAttributeTypeFrame(); @@ -673,7 +679,9 @@ void QgsAttributesFormProperties::loadAttributeSpecificEditor( QgsAttributesDnDT { receiver->selectFirstMatchingItem( itemData ); if ( layout == Qgis::AttributeFormLayout::DragAndDrop ) + { loadAttributeWidgetEdit(); + } loadAttributeTypeDialog(); break; } diff --git a/src/gui/vector/qgsattributesformproperties.h b/src/gui/vector/qgsattributesformproperties.h index 9a610d55a878..5500fb619bf3 100644 --- a/src/gui/vector/qgsattributesformproperties.h +++ b/src/gui/vector/qgsattributesformproperties.h @@ -448,7 +448,7 @@ class GUI_EXPORT QgsAttributesFormProperties : public QWidget, public QgsExpress void storeAttributeWidgetEdit(); void loadAttributeTypeDialog(); - void loadAttributeTypeDialogFromConfiguration( const FieldConfig cfg ); + void loadAttributeTypeDialogFromConfiguration( const FieldConfig &cfg ); void storeAttributeTypeDialog(); void storeAttributeContainerEdit(); @@ -473,6 +473,8 @@ class GUI_EXPORT QgsAttributesFormProperties : public QWidget, public QgsExpress QMenu *mAvailableWidgetsTreeContextMenu = nullptr; QAction *mActionCopyWidgetConfiguration = nullptr; QAction *mActionPasteWidgetConfiguration = nullptr; + + friend class TestQgsAttributesFormProperties; }; diff --git a/src/gui/vector/qgsdiagramproperties.cpp b/src/gui/vector/qgsdiagramproperties.cpp index 0c17a96f0ac1..0a56895b4f12 100644 --- a/src/gui/vector/qgsdiagramproperties.cpp +++ b/src/gui/vector/qgsdiagramproperties.cpp @@ -874,7 +874,7 @@ std::unique_ptr QgsDiagramProperties::createDiagramObject() std::unique_ptr QgsDiagramProperties::createDiagramSettings() { - std::unique_ptr ds = std::make_unique(); + auto ds = std::make_unique(); ds->enabled = isDiagramEnabled(); ds->font = mDiagramFontButton->currentFont(); ds->opacity = mOpacityWidget->opacity(); @@ -950,13 +950,13 @@ std::unique_ptr QgsDiagramProperties::createRenderer() std::unique_ptr renderer; if ( mFixedSizeRadio->isChecked() ) { - std::unique_ptr dr = std::make_unique(); + auto dr = std::make_unique(); dr->setDiagramSettings( *ds ); renderer = std::move( dr ); } else { - std::unique_ptr dr = std::make_unique(); + auto dr = std::make_unique(); dr->setLowerValue( 0.0 ); dr->setLowerSize( QSizeF( 0.0, 0.0 ) ); dr->setUpperValue( mMaxValueSpinBox->value() ); diff --git a/src/gui/vector/qgsfieldcalculator.cpp b/src/gui/vector/qgsfieldcalculator.cpp index e2ce21935bc8..7875e101bc87 100644 --- a/src/gui/vector/qgsfieldcalculator.cpp +++ b/src/gui/vector/qgsfieldcalculator.cpp @@ -308,7 +308,7 @@ void QgsFieldCalculator::calculate() } QgsFeatureIterator fit = mVectorLayer->getFeatures( req ); - std::unique_ptr task = std::make_unique( tr( "Calculating field" ) ); + auto task = std::make_unique( tr( "Calculating field" ) ); const long long count = mOnlyUpdateSelectedCheckBox->isChecked() ? mVectorLayer->selectedFeatureCount() : mVectorLayer->featureCount(); long long i = 0; while ( fit.nextFeature( feature ) ) diff --git a/src/gui/vector/qgsstackeddiagramproperties.cpp b/src/gui/vector/qgsstackeddiagramproperties.cpp index 149a1ff001be..fbd1cc3e2ba4 100644 --- a/src/gui/vector/qgsstackeddiagramproperties.cpp +++ b/src/gui/vector/qgsstackeddiagramproperties.cpp @@ -73,7 +73,7 @@ void QgsStackedDiagramProperties::addSubDiagramRenderer() { // Create a single category renderer by default std::unique_ptr renderer; - std::unique_ptr dr = std::make_unique(); + auto dr = std::make_unique(); renderer = std::move( dr ); QItemSelectionModel *sel = mSubDiagramsView->selectionModel(); @@ -201,7 +201,7 @@ void QgsStackedDiagramProperties::syncToLayer() void QgsStackedDiagramProperties::apply() { - std::unique_ptr ds = std::make_unique(); + auto ds = std::make_unique(); ds->stackedDiagramMode = static_cast( mStackedDiagramModeComboBox->currentData().toInt() ); ds->setStackedDiagramSpacingUnit( mStackedDiagramSpacingUnitComboBox->unit() ); ds->setStackedDiagramSpacing( mStackedDiagramSpacingSpinBox->value() ); diff --git a/src/gui/vector/qgsvectorlayerproperties.cpp b/src/gui/vector/qgsvectorlayerproperties.cpp index 7c90256e2898..87deb7059336 100644 --- a/src/gui/vector/qgsvectorlayerproperties.cpp +++ b/src/gui/vector/qgsvectorlayerproperties.cpp @@ -1305,8 +1305,16 @@ void QgsVectorLayerProperties::mJoinTreeWidget_itemDoubleClicked( QTreeWidgetIte return; } + // if current item is a child item, we should use its parent to be able to edit join + QTreeWidgetItem *currentJoinItem = item; + if ( item->parent() ) + { + currentJoinItem = item->parent(); + } + + QList joinedLayers; - QString joinLayerId = item->data( 0, Qt::UserRole ).toString(); + QString joinLayerId = currentJoinItem->data( 0, Qt::UserRole ).toString(); const QList &joins = mLayer->vectorJoins(); int j = -1; for ( int i = 0; i < joins.size(); ++i ) @@ -1478,6 +1486,12 @@ void QgsVectorLayerProperties::openPanel( QgsPanelWidget *panel ) void QgsVectorLayerProperties::mButtonRemoveJoin_clicked() { QTreeWidgetItem *currentJoinItem = mJoinTreeWidget->currentItem(); + // if current item is a child item, we should use its parent to be able to remove join + if ( currentJoinItem && currentJoinItem->parent() ) + { + currentJoinItem = currentJoinItem->parent(); + } + if ( !mLayer || !currentJoinItem ) { return; diff --git a/src/providers/arcgisrest/qgsafsshareddata.cpp b/src/providers/arcgisrest/qgsafsshareddata.cpp index 96765ec53ed7..cd7e5682dd54 100644 --- a/src/providers/arcgisrest/qgsafsshareddata.cpp +++ b/src/providers/arcgisrest/qgsafsshareddata.cpp @@ -59,7 +59,7 @@ QgsAfsSharedData::QgsAfsSharedData( const QgsDataSourceUri &uri ) std::shared_ptr QgsAfsSharedData::clone() const { QgsReadWriteLocker locker( mReadWriteLock, QgsReadWriteLocker::Read ); - std::shared_ptr copy = std::make_shared( mDataSource ); + auto copy = std::make_shared( mDataSource ); copy->mLimitBBox = mLimitBBox; copy->mExtent = mExtent; copy->mGeometryType = mGeometryType; diff --git a/src/providers/arcgisrest/qgsamsprovider.cpp b/src/providers/arcgisrest/qgsamsprovider.cpp index 6d835c4f0152..8e5a9b293815 100644 --- a/src/providers/arcgisrest/qgsamsprovider.cpp +++ b/src/providers/arcgisrest/qgsamsprovider.cpp @@ -978,6 +978,7 @@ QgsAmsTiledImageDownloadHandler::QgsAmsTiledImageDownloadHandler( const QString QgsMessageLog::logMessage( error, tr( "Network" ) ); continue; } + request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy ); request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache ); request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, true ); request.setAttribute( static_cast( TileReqNo ), mTileReqNo ); @@ -1054,6 +1055,7 @@ void QgsAmsTiledImageDownloadHandler::tileReplyFinished() // mErrors.append( error ); QgsMessageLog::logMessage( error, tr( "Network" ) ); } + request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy ); request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache ); request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, true ); request.setAttribute( static_cast( TileReqNo ), tileReqNo ); diff --git a/src/providers/arcgisrest/qgsarcgisrestdataitemguiprovider.cpp b/src/providers/arcgisrest/qgsarcgisrestdataitemguiprovider.cpp index 16b991da4fb4..fef574b5b541 100644 --- a/src/providers/arcgisrest/qgsarcgisrestdataitemguiprovider.cpp +++ b/src/providers/arcgisrest/qgsarcgisrestdataitemguiprovider.cpp @@ -240,7 +240,7 @@ void QgsArcGisRestDataItemGuiProvider::addFilteredLayer( const QgsMimeDataUtils: const QString sql = w->expressionText(); ds.setSql( sql ); - std::unique_ptr layer = std::make_unique( ds.uri( false ), uri.name, QStringLiteral( "arcgisfeatureserver" ) ); + auto layer = std::make_unique( ds.uri( false ), uri.name, QStringLiteral( "arcgisfeatureserver" ) ); QgsProject::instance()->addMapLayer( layer.release() ); } } diff --git a/src/providers/arcgisrest/qgsarcgisrestdataitems.cpp b/src/providers/arcgisrest/qgsarcgisrestdataitems.cpp index b96cd587d92b..8840e2013400 100644 --- a/src/providers/arcgisrest/qgsarcgisrestdataitems.cpp +++ b/src/providers/arcgisrest/qgsarcgisrestdataitems.cpp @@ -76,7 +76,7 @@ void QgsArcGisRestRootItem::onConnectionsChanged() void addFolderItems( QVector &items, const QVariantMap &serviceData, const QString &baseUrl, const QString &authcfg, const QgsHttpHeaders &headers, const QString &urlPrefix, QgsDataItem *parent, const QString &supportedFormats ) { QgsArcGisRestQueryUtils::visitFolderItems( [parent, &baseUrl, &items, headers, urlPrefix, authcfg, supportedFormats]( const QString &name, const QString &url ) { - std::unique_ptr folderItem = std::make_unique( parent, name, url, baseUrl, authcfg, headers, urlPrefix ); + auto folderItem = std::make_unique( parent, name, url, baseUrl, authcfg, headers, urlPrefix ); folderItem->setSupportedFormats( supportedFormats ); items.append( folderItem.release() ); }, @@ -92,14 +92,14 @@ void addServiceItems( QVector &items, const QVariantMap &serviceD case Qgis::ArcGisRestServiceType::MapServer: case Qgis::ArcGisRestServiceType::ImageServer: { - std::unique_ptr serviceItem = std::make_unique( parent, name, url, url, authcfg, headers, urlPrefix, serviceType ); + auto serviceItem = std::make_unique( parent, name, url, url, authcfg, headers, urlPrefix, serviceType ); items.append( serviceItem.release() ); break; } case Qgis::ArcGisRestServiceType::FeatureServer: { - std::unique_ptr serviceItem = std::make_unique( parent, name, url, url, authcfg, headers, urlPrefix ); + auto serviceItem = std::make_unique( parent, name, url, url, authcfg, headers, urlPrefix ); serviceItem->setSupportedFormats( supportedFormats ); items.append( serviceItem.release() ); break; @@ -131,7 +131,7 @@ void addLayerItems( QVector &items, const QVariantMap &serviceDat { if ( !layerItems.value( id ) ) { - std::unique_ptr layerItem = std::make_unique( parent, name, url, authcfg, headers, urlPrefix ); + auto layerItem = std::make_unique( parent, name, url, authcfg, headers, urlPrefix ); layerItems.insert( id, layerItem.release() ); } } @@ -212,7 +212,7 @@ QVector QgsArcGisRestConnectionItem::createChildren() { if ( !errorMessage.isEmpty() ) { - std::unique_ptr error = std::make_unique( this, tr( "Connection failed: %1" ).arg( errorTitle ), mPath + "/error" ); + auto error = std::make_unique( this, tr( "Connection failed: %1" ).arg( errorTitle ), mPath + "/error" ); error->setToolTip( errorMessage ); items.append( error.release() ); QgsDebugError( "Connection failed - " + errorMessage ); @@ -269,7 +269,7 @@ QVector QgsArcGisPortalGroupsItem::createChildren() { if ( !errorMessage.isEmpty() ) { - std::unique_ptr error = std::make_unique( this, tr( "Connection failed: %1" ).arg( errorTitle ), mPath + "/error" ); + auto error = std::make_unique( this, tr( "Connection failed: %1" ).arg( errorTitle ), mPath + "/error" ); error->setToolTip( errorMessage ); items.append( error.release() ); QgsDebugError( "Connection failed - " + errorMessage ); @@ -322,7 +322,7 @@ QVector QgsArcGisPortalGroupItem::createChildren() { if ( !errorMessage.isEmpty() ) { - std::unique_ptr error = std::make_unique( this, tr( "Connection failed: %1" ).arg( errorTitle ), mPath + "/error" ); + auto error = std::make_unique( this, tr( "Connection failed: %1" ).arg( errorTitle ), mPath + "/error" ); error->setToolTip( errorMessage ); items.append( error.release() ); QgsDebugError( "Connection failed - " + errorMessage ); @@ -378,7 +378,7 @@ QVector QgsArcGisRestServicesItem::createChildren() { if ( !errorMessage.isEmpty() ) { - std::unique_ptr error = std::make_unique( this, tr( "Connection failed: %1" ).arg( errorTitle ), mPath + "/error" ); + auto error = std::make_unique( this, tr( "Connection failed: %1" ).arg( errorTitle ), mPath + "/error" ); error->setToolTip( errorMessage ); items.append( error.release() ); QgsDebugError( "Connection failed - " + errorMessage ); @@ -431,7 +431,7 @@ QVector QgsArcGisRestFolderItem::createChildren() { if ( !errorMessage.isEmpty() ) { - std::unique_ptr error = std::make_unique( this, tr( "Connection failed: %1" ).arg( errorTitle ), mPath + "/error" ); + auto error = std::make_unique( this, tr( "Connection failed: %1" ).arg( errorTitle ), mPath + "/error" ); error->setToolTip( errorMessage ); items.append( error.release() ); QgsDebugError( "Connection failed - " + errorMessage ); @@ -482,7 +482,7 @@ QVector QgsArcGisFeatureServiceItem::createChildren() { if ( !errorMessage.isEmpty() ) { - std::unique_ptr error = std::make_unique( this, tr( "Connection failed: %1" ).arg( errorTitle ), mPath + "/error" ); + auto error = std::make_unique( this, tr( "Connection failed: %1" ).arg( errorTitle ), mPath + "/error" ); error->setToolTip( errorMessage ); items.append( error.release() ); QgsDebugError( "Connection failed - " + errorMessage ); @@ -531,7 +531,7 @@ QVector QgsArcGisMapServiceItem::createChildren() { if ( !errorMessage.isEmpty() ) { - std::unique_ptr error = std::make_unique( this, tr( "Connection failed: %1" ).arg( errorTitle ), mPath + "/error" ); + auto error = std::make_unique( this, tr( "Connection failed: %1" ).arg( errorTitle ), mPath + "/error" ); error->setToolTip( errorMessage ); items.append( error.release() ); QgsDebugError( "Connection failed - " + errorMessage ); diff --git a/src/providers/delimitedtext/qgsdelimitedtextsourceselect.cpp b/src/providers/delimitedtext/qgsdelimitedtextsourceselect.cpp index 144ae0edfaf5..ad4254b285c6 100644 --- a/src/providers/delimitedtext/qgsdelimitedtextsourceselect.cpp +++ b/src/providers/delimitedtext/qgsdelimitedtextsourceselect.cpp @@ -67,7 +67,6 @@ QgsDelimitedTextSourceSelect::QgsDelimitedTextSourceSelect( QWidget *parent, Qt: mBooleanFalse->setEnabled( !mBooleanTrue->text().isEmpty() ); updateFieldsAndEnable(); - connect( txtLayerName, &QLineEdit::textChanged, this, &QgsDelimitedTextSourceSelect::enableAccept ); connect( cmbEncoding, static_cast( &QComboBox::currentIndexChanged ), this, &QgsDelimitedTextSourceSelect::updateFieldsAndEnable ); connect( delimiterCSV, &QAbstractButton::toggled, this, &QgsDelimitedTextSourceSelect::updateFieldsAndEnable ); @@ -119,12 +118,6 @@ QgsDelimitedTextSourceSelect::QgsDelimitedTextSourceSelect( QWidget *parent, Qt: void QgsDelimitedTextSourceSelect::addButtonClicked() { // The following conditions should not be hit! OK will not be enabled... - if ( txtLayerName->text().isEmpty() ) - { - QMessageBox::warning( this, tr( "No layer name" ), tr( "Please enter a layer name before adding the layer to the map" ) ); - txtLayerName->setFocus(); - return; - } if ( delimiterChars->isChecked() ) { if ( selectedChars().isEmpty() ) @@ -159,17 +152,17 @@ void QgsDelimitedTextSourceSelect::addButtonClicked() saveSettings(); saveSettingsForFile( mFileWidget->filePath() ); + const QString layerName = QFileInfo( mFileWidget->filePath() ).completeBaseName(); // add the layer to the map Q_NOWARN_DEPRECATED_PUSH - emit addVectorLayer( datasourceUrl, txtLayerName->text() ); + emit addVectorLayer( datasourceUrl, layerName ); Q_NOWARN_DEPRECATED_POP - emit addLayer( Qgis::LayerType::Vector, datasourceUrl, txtLayerName->text(), QStringLiteral( "delimitedtext" ) ); + emit addLayer( Qgis::LayerType::Vector, datasourceUrl, layerName, QStringLiteral( "delimitedtext" ) ); // clear the file and layer name show something has happened, ready for another file mFileWidget->setFilePath( QString() ); - txtLayerName->setText( QString() ); if ( widgetMode() == QgsProviderRegistry::WidgetMode::Standalone ) { @@ -722,7 +715,6 @@ void QgsDelimitedTextSourceSelect::updateFileName() settings.setValue( mSettingsKey + "/text_path", finfo.path() ); } - txtLayerName->setText( finfo.completeBaseName() ); loadSettingsForFile( filename ); updateFieldsAndEnable(); } @@ -748,10 +740,6 @@ bool QgsDelimitedTextSourceSelect::validate() { message = tr( "File %1 does not exist" ).arg( mFileWidget->filePath() ); } - else if ( txtLayerName->text().isEmpty() ) - { - message = tr( "Please enter a layer name" ); - } else if ( delimiterChars->isChecked() && selectedChars().isEmpty() ) { message = tr( "At least one delimiter character must be specified" ); diff --git a/src/providers/grass/CMakeLists.txt b/src/providers/grass/CMakeLists.txt index 53da1efe2837..370c66af70bf 100644 --- a/src/providers/grass/CMakeLists.txt +++ b/src/providers/grass/CMakeLists.txt @@ -132,7 +132,10 @@ macro(ADD_GRASSLIB GRASS_BUILD_VERSION) ) endif() - target_link_libraries(qgisgrass${GRASS_BUILD_VERSION} ${GRASS_TARGET_LINK_LIBRARIES${GRASS_BUILD_VERSION}} PostgreSQL::PostgreSQL) + target_link_libraries(qgisgrass${GRASS_BUILD_VERSION} ${GRASS_TARGET_LINK_LIBRARIES${GRASS_BUILD_VERSION}}) + if(WITH_POSTGRESQL) + target_link_libraries(qgisgrass${GRASS_BUILD_VERSION} PostgreSQL::PostgreSQL) + endif() if (WITH_GUI) target_link_libraries(qgisgrass${GRASS_BUILD_VERSION} diff --git a/src/providers/hana/qgshanaproviderconnection.cpp b/src/providers/hana/qgshanaproviderconnection.cpp index 336eba090816..e341a125b671 100644 --- a/src/providers/hana/qgshanaproviderconnection.cpp +++ b/src/providers/hana/qgshanaproviderconnection.cpp @@ -496,7 +496,7 @@ QgsVectorLayer *QgsHanaProviderConnection::createSqlVectorLayer( const SqlVector if ( !options.primaryKeyColumns.isEmpty() ) { tUri.setKeyColumn( QgsHanaPrimaryKeyUtils::buildUriKey( options.primaryKeyColumns ) ); - tUri.setTable( QStringLiteral( "(%1)" ).arg( options.sql ) ); + tUri.setTable( QStringLiteral( "(%1)" ).arg( sanitizeSqlForQueryLayer( options.sql ) ) ); } else { diff --git a/src/providers/mssql/qgsmssqlfeatureiterator.cpp b/src/providers/mssql/qgsmssqlfeatureiterator.cpp index 4b5cb9890264..9e11e5f2bb43 100644 --- a/src/providers/mssql/qgsmssqlfeatureiterator.cpp +++ b/src/providers/mssql/qgsmssqlfeatureiterator.cpp @@ -605,7 +605,7 @@ bool QgsMssqlFeatureIterator::rewind() mQuery->setForwardOnly( true ); QString sql { mOrderByClause.isEmpty() ? mStatement : mStatement + mOrderByClause }; - std::unique_ptr logWrapper = std::make_unique( sql, mSource->connInfo(), QStringLiteral( "mssql" ), QStringLiteral( "QgsMssqlFeatureIterator" ), QGS_QUERY_LOG_ORIGIN ); + auto logWrapper = std::make_unique( sql, mSource->connInfo(), QStringLiteral( "mssql" ), QStringLiteral( "QgsMssqlFeatureIterator" ), QGS_QUERY_LOG_ORIGIN ); bool result = mQuery->exec( sql ); if ( !result ) diff --git a/src/providers/mssql/qgsmssqlgeometryparser.cpp b/src/providers/mssql/qgsmssqlgeometryparser.cpp index 1c5ea670fbcc..0ee38ac48e9d 100644 --- a/src/providers/mssql/qgsmssqlgeometryparser.cpp +++ b/src/providers/mssql/qgsmssqlgeometryparser.cpp @@ -352,7 +352,7 @@ std::unique_ptr QgsMssqlGeometryParser::readPoint( int iFigure ) std::unique_ptr QgsMssqlGeometryParser::readMultiPoint( int iShape ) { - std::unique_ptr poMultiPoint = std::make_unique(); + auto poMultiPoint = std::make_unique(); poMultiPoint->reserve( mNumShapes ); for ( int i = iShape + 1; i < mNumShapes; i++ ) { @@ -393,7 +393,7 @@ std::unique_ptr QgsMssqlGeometryParser::readLineString( int iFigu std::unique_ptr QgsMssqlGeometryParser::readCircularString( int iPoint, int iNextPoint ) { - std::unique_ptr poCircularString = std::make_unique(); + auto poCircularString = std::make_unique(); poCircularString->setPoints( readPointSequence( iPoint, iNextPoint ) ); return poCircularString; } @@ -405,7 +405,7 @@ std::unique_ptr QgsMssqlGeometryParser::readCircularString( i std::unique_ptr QgsMssqlGeometryParser::readMultiLineString( int iShape ) { - std::unique_ptr poMultiLineString = std::make_unique(); + auto poMultiLineString = std::make_unique(); poMultiLineString->reserve( mNumShapes ); for ( int i = iShape + 1; i < mNumShapes; i++ ) { @@ -425,7 +425,7 @@ std::unique_ptr QgsMssqlGeometryParser::readPolygon( int iShape ) int iRingCount = 0; const int iNextFigure = NextFigureOffset( iShape ); - std::unique_ptr poPoly = std::make_unique(); + auto poPoly = std::make_unique(); for ( iFigure = FigureOffset( iShape ); iFigure < iNextFigure; iFigure++ ) { if ( iRingCount == 0 ) @@ -440,7 +440,7 @@ std::unique_ptr QgsMssqlGeometryParser::readPolygon( int iShape ) std::unique_ptr QgsMssqlGeometryParser::readMultiPolygon( int iShape ) { - std::unique_ptr poMultiPolygon = std::make_unique(); + auto poMultiPolygon = std::make_unique(); poMultiPolygon->reserve( mNumShapes ); for ( int i = iShape + 1; i < mNumShapes; i++ ) { @@ -457,7 +457,7 @@ std::unique_ptr QgsMssqlGeometryParser::readMultiPolygon( int i std::unique_ptr QgsMssqlGeometryParser::readCompoundCurve( int iFigure ) { int iPoint, iNextPoint, nPointsPrepared; - std::unique_ptr poCompoundCurve = std::make_unique(); + auto poCompoundCurve = std::make_unique(); iPoint = PointOffset( iFigure ); iNextPoint = NextPointOffset( iFigure ) - 1; @@ -523,7 +523,7 @@ std::unique_ptr QgsMssqlGeometryParser::readCurvePolygon( int i int iRingCount = 0; const int iNextFigure = NextFigureOffset( iShape ); - std::unique_ptr poPoly = std::make_unique(); + auto poPoly = std::make_unique(); for ( iFigure = FigureOffset( iShape ); iFigure < iNextFigure; iFigure++ ) { switch ( FigureAttribute( iFigure ) ) @@ -554,7 +554,7 @@ std::unique_ptr QgsMssqlGeometryParser::readCurvePolygon( int i std::unique_ptr QgsMssqlGeometryParser::readGeometryCollection( int iShape ) { - std::unique_ptr poGeomColl = std::make_unique(); + auto poGeomColl = std::make_unique(); poGeomColl->reserve( mNumShapes ); for ( int i = iShape + 1; i < mNumShapes; i++ ) { diff --git a/src/providers/mssql/qgsmssqlprovider.cpp b/src/providers/mssql/qgsmssqlprovider.cpp index 8ef32e680dd2..5396c7bec5a2 100644 --- a/src/providers/mssql/qgsmssqlprovider.cpp +++ b/src/providers/mssql/qgsmssqlprovider.cpp @@ -2257,7 +2257,7 @@ Qgis::VectorExportResult QgsMssqlProvider::createEmptyLayer( const QString &uri, "CREATE TABLE spatial_ref_sys (srid integer not null " "PRIMARY KEY, auth_name varchar(256), auth_srid integer, srtext varchar(2048), proj4text varchar(2048))" ); - std::unique_ptr logWrapper = std::make_unique( sql, uri, QStringLiteral( "mssql" ), QStringLiteral( "QgsMssqlProvider" ), QGS_QUERY_LOG_ORIGIN ); + auto logWrapper = std::make_unique( sql, uri, QStringLiteral( "mssql" ), QStringLiteral( "QgsMssqlProvider" ), QGS_QUERY_LOG_ORIGIN ); if ( !q.exec( sql ) ) { diff --git a/src/providers/mssql/qgsmssqlproviderconnection.cpp b/src/providers/mssql/qgsmssqlproviderconnection.cpp index ebf164fd4469..5f2594ccfebb 100644 --- a/src/providers/mssql/qgsmssqlproviderconnection.cpp +++ b/src/providers/mssql/qgsmssqlproviderconnection.cpp @@ -246,7 +246,7 @@ QgsAbstractDatabaseProviderConnection::QueryResult QgsMssqlProviderConnection::e //qDebug() << "MSSQL QUERY:" << sql; - std::unique_ptr q = std::make_unique( db ); + auto q = std::make_unique( db ); q->setForwardOnly( true ); QgsDatabaseQueryLogWrapper logWrapper { sql, uri(), providerKey(), QStringLiteral( "QgsMssqlProviderConnection" ), QGS_QUERY_LOG_ORIGIN }; diff --git a/src/providers/mssql/qgsmssqlsourceselect.cpp b/src/providers/mssql/qgsmssqlsourceselect.cpp index fbc7cb584f4d..c1a977d32a9b 100644 --- a/src/providers/mssql/qgsmssqlsourceselect.cpp +++ b/src/providers/mssql/qgsmssqlsourceselect.cpp @@ -547,7 +547,7 @@ void QgsMssqlSourceSelect::setSql( const QModelIndex &index ) const QString tableName = mTableModel->itemFromIndex( index.sibling( index.row(), QgsMssqlTableModel::DbtmTable ) )->text(); const bool disableInvalidGeometryHandling = QgsMssqlConnection::isInvalidGeometryHandlingDisabled( cmbConnections->currentText() ); const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() }; - std::unique_ptr vlayer = std::make_unique( mTableModel->layerURI( index, mConnInfo, mUseEstimatedMetadata, disableInvalidGeometryHandling ), tableName, QStringLiteral( "mssql" ), options ); + auto vlayer = std::make_unique( mTableModel->layerURI( index, mConnInfo, mUseEstimatedMetadata, disableInvalidGeometryHandling ), tableName, QStringLiteral( "mssql" ), options ); if ( !vlayer->isValid() ) { diff --git a/src/providers/oracle/qgsoracleprovider.cpp b/src/providers/oracle/qgsoracleprovider.cpp index 80091bc70167..3e070a29c93a 100644 --- a/src/providers/oracle/qgsoracleprovider.cpp +++ b/src/providers/oracle/qgsoracleprovider.cpp @@ -3255,7 +3255,7 @@ Qgis::VectorExportResult QgsOracleProvider::createEmptyLayer( const QString &uri dsUri.setWkbType( wkbType ); QgsDataProvider::ProviderOptions providerOptions; - std::unique_ptr provider( new QgsOracleProvider( dsUri.uri( false ), providerOptions ) ); + auto provider = std::make_unique( dsUri.uri( false ), providerOptions ); if ( !provider->isValid() ) { errorMessage = QObject::tr( "Loading of the layer %1 failed" ).arg( ownerTableName ); diff --git a/src/providers/oracle/qgsoracleproviderconnection.cpp b/src/providers/oracle/qgsoracleproviderconnection.cpp index 60166e1d05f8..7a6a6a873986 100644 --- a/src/providers/oracle/qgsoracleproviderconnection.cpp +++ b/src/providers/oracle/qgsoracleproviderconnection.cpp @@ -165,6 +165,8 @@ QgsVectorLayer *QgsOracleProviderConnection::createSqlVectorLayer( const QgsAbst throw QgsProviderConnectionException( QObject::tr( "Could not create a SQL vector layer: SQL expression is empty." ) ); } + const QString optionsSql { sanitizeSqlForQueryLayer( options.sql ) }; + QgsDataSourceUri tUri( uri() ); tUri.setSql( options.filter ); @@ -173,25 +175,25 @@ QgsVectorLayer *QgsOracleProviderConnection::createSqlVectorLayer( const QgsAbst if ( !options.primaryKeyColumns.isEmpty() ) { tUri.setKeyColumn( options.primaryKeyColumns.join( ',' ) ); - tUri.setTable( QStringLiteral( "(%1)" ).arg( options.sql ) ); + tUri.setTable( QStringLiteral( "(%1)" ).arg( optionsSql ) ); } else { // Disable when there is no pk tUri.setUseEstimatedMetadata( false ); int pkId { 0 }; - while ( options.sql.contains( QStringLiteral( "qgis_generated_uid_%1_" ).arg( pkId ), Qt::CaseSensitivity::CaseInsensitive ) ) + while ( optionsSql.contains( QStringLiteral( "qgis_generated_uid_%1_" ).arg( pkId ), Qt::CaseSensitivity::CaseInsensitive ) ) { pkId++; } tUri.setKeyColumn( QStringLiteral( "qgis_generated_uid_%1_" ).arg( pkId ) ); int sqlId { 0 }; - while ( options.sql.contains( QStringLiteral( "qgis_generated_subq_%1_" ).arg( sqlId ), Qt::CaseSensitivity::CaseInsensitive ) ) + while ( optionsSql.contains( QStringLiteral( "qgis_generated_subq_%1_" ).arg( sqlId ), Qt::CaseSensitivity::CaseInsensitive ) ) { sqlId++; } - tUri.setTable( QStringLiteral( "(SELECT row_number() over (ORDER BY NULL) AS qgis_generated_uid_%1_, qgis_generated_subq_%3_.* FROM (%2\n) qgis_generated_subq_%3_\n)" ).arg( QString::number( pkId ), options.sql, QString::number( sqlId ) ) ); + tUri.setTable( QStringLiteral( "(SELECT row_number() over (ORDER BY NULL) AS qgis_generated_uid_%1_, qgis_generated_subq_%3_.* FROM (%2\n) qgis_generated_subq_%3_\n)" ).arg( QString::number( pkId ), optionsSql, QString::number( sqlId ) ) ); } if ( !options.geometryColumn.isEmpty() ) @@ -199,7 +201,7 @@ QgsVectorLayer *QgsOracleProviderConnection::createSqlVectorLayer( const QgsAbst tUri.setGeometryColumn( options.geometryColumn ); } - std::unique_ptr vl = std::make_unique( tUri.uri( false ), options.layerName.isEmpty() ? QStringLiteral( "QueryLayer" ) : options.layerName, providerKey() ); + auto vl = std::make_unique( tUri.uri( false ), options.layerName.isEmpty() ? QStringLiteral( "QueryLayer" ) : options.layerName, providerKey() ); // Try to guess the geometry and srid if ( !vl->isValid() ) @@ -212,7 +214,7 @@ QgsVectorLayer *QgsOracleProviderConnection::createSqlVectorLayer( const QgsAbst WHERE a.%1 IS NOT NULL %3 ORDER BY a.%1.SDO_GTYPE )" ) - .arg( options.geometryColumn, options.sql, limit ) }; + .arg( options.geometryColumn, optionsSql, limit ) }; const QList> candidates { executeSql( sql ) }; for ( const QList &row : std::as_const( candidates ) ) { @@ -1349,7 +1351,7 @@ QgsAbstractDatabaseProviderConnection::QueryResult QgsOracleProviderConnection:: if ( feedback && feedback->isCanceled() ) return QgsAbstractDatabaseProviderConnection::QueryResult(); - std::shared_ptr pconn = std::make_shared( QgsDataSourceUri { uri() }.connectionInfo( false ) ); + auto pconn = std::make_shared( QgsDataSourceUri { uri() }.connectionInfo( false ) ); if ( !pconn->get() ) { throw QgsProviderConnectionException( QObject::tr( "Connection failed: %1" ).arg( uri() ) ); @@ -1358,7 +1360,7 @@ QgsAbstractDatabaseProviderConnection::QueryResult QgsOracleProviderConnection:: if ( feedback && feedback->isCanceled() ) return QgsAbstractDatabaseProviderConnection::QueryResult(); - std::unique_ptr qry = std::make_unique( pconn ); + auto qry = std::make_unique( pconn ); std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); QgsDatabaseQueryLogWrapper logWrapper { sql, uri(), providerKey(), QStringLiteral( "QgsAbstractDatabaseProviderConnection" ), QGS_QUERY_LOG_ORIGIN }; diff --git a/src/providers/pdal/qgspdalindexingtask.cpp b/src/providers/pdal/qgspdalindexingtask.cpp index d1d5e9b5ad9b..7dc18a14141e 100644 --- a/src/providers/pdal/qgspdalindexingtask.cpp +++ b/src/providers/pdal/qgspdalindexingtask.cpp @@ -88,7 +88,7 @@ bool QgsPdalIndexingTask::runUntwine() const std::vector files = { mFile.toStdString() }; untwineProcess.start( files, mOutputPath.toStdString(), options ); - const int lastPercent = 0; + int lastPercent = 0; while ( true ) { QThread::msleep( 100 ); @@ -103,6 +103,7 @@ bool QgsPdalIndexingTask::runUntwine() } #endif setProgress( percent ); + lastPercent = percent; } if ( isCanceled() ) diff --git a/src/providers/postgres/CMakeLists.txt b/src/providers/postgres/CMakeLists.txt index a61fb7c2dd68..3173bddcbd72 100644 --- a/src/providers/postgres/CMakeLists.txt +++ b/src/providers/postgres/CMakeLists.txt @@ -2,6 +2,7 @@ # Files set(PG_SRCS + qgspostgresutils.cpp qgspostgresprovider.cpp qgspostgresconn.cpp qgspostgresconnpool.cpp @@ -26,6 +27,7 @@ if (WITH_GUI) qgspgnewconnection.cpp qgspostgresprojectstoragedialog.cpp raster/qgspostgresrastertemporalsettingswidget.cpp + qgspostgresutils.cpp ) set(PG_UIS ${CMAKE_SOURCE_DIR}/src/ui/qgspostgresrastertemporalsettingswidgetbase.ui) @@ -83,6 +85,7 @@ endif() # Postgres Raster set(PGRASTER_SRCS + qgspostgresutils.cpp raster/qgspostgresrasterprovider.cpp raster/qgspostgresrastershareddata.cpp raster/qgspostgresrasterutils.cpp diff --git a/src/providers/postgres/qgspgnewconnection.cpp b/src/providers/postgres/qgspgnewconnection.cpp index cded70f6b943..68880aec94e0 100644 --- a/src/providers/postgres/qgspgnewconnection.cpp +++ b/src/providers/postgres/qgspgnewconnection.cpp @@ -82,6 +82,7 @@ QgsPgNewConnection::QgsPgNewConnection( QWidget *parent, const QString &connName cb_geometryColumnsOnly->setChecked( settings.value( key + "/geometryColumnsOnly", true ).toBool() ); cb_dontResolveType->setChecked( settings.value( key + "/dontResolveType", false ).toBool() ); cb_allowGeometrylessTables->setChecked( settings.value( key + "/allowGeometrylessTables", false ).toBool() ); + cb_allowRasterOverviewTables->setChecked( settings.value( key + "/allowRasterOverviewTables", false ).toBool() ); // Ensure that cb_publicSchemaOnly is set correctly cb_geometryColumnsOnly_clicked(); @@ -177,6 +178,7 @@ void QgsPgNewConnection::accept() configuration.insert( "projectsInDatabase", cb_projectsInDatabase->isChecked() ); configuration.insert( "metadataInDatabase", cb_metadataInDatabase->isChecked() ); configuration.insert( "session_role", txtSessionRole->text() ); + configuration.insert( "allowRasterOverviewTables", cb_allowRasterOverviewTables->isChecked() ); QgsProviderMetadata *providerMetadata = QgsProviderRegistry::instance()->providerMetadata( QStringLiteral( "postgres" ) ); std::unique_ptr providerConnection( qgis::down_cast( providerMetadata->createConnection( txtName->text() ) ) ); diff --git a/src/providers/postgres/qgspostgresconn.cpp b/src/providers/postgres/qgspostgresconn.cpp index 6ae7845272a8..f0fe9ed7d5f8 100644 --- a/src/providers/postgres/qgspostgresconn.cpp +++ b/src/providers/postgres/qgspostgresconn.cpp @@ -344,7 +344,7 @@ QgsPostgresConn::QgsPostgresConn( const QString &conninfo, bool readOnly, bool s }; addDefaultTimeoutAndClientEncoding( expandedConnectionInfo ); - std::unique_ptr logWrapper = std::make_unique( QStringLiteral( "libpq::PQconnectdb()" ), expandedConnectionInfo.toUtf8(), QStringLiteral( "postgres" ), QStringLiteral( "QgsPostgresConn" ), QGS_QUERY_LOG_ORIGIN_PG_CON ); + auto logWrapper = std::make_unique( QStringLiteral( "libpq::PQconnectdb()" ), expandedConnectionInfo.toUtf8(), QStringLiteral( "postgres" ), QStringLiteral( "QgsPostgresConn" ), QGS_QUERY_LOG_ORIGIN_PG_CON ); mConn = PQconnectdb( expandedConnectionInfo.toUtf8() ); // remove temporary cert/key/CA if they exist @@ -594,7 +594,7 @@ void QgsPostgresConn::addColumnInfo( QgsPostgresLayerProperty &layerProperty, co } } -bool QgsPostgresConn::getTableInfo( bool searchGeometryColumnsOnly, bool searchPublicOnly, bool allowGeometrylessTables, const QString &schema, const QString &name ) +bool QgsPostgresConn::getTableInfo( bool searchGeometryColumnsOnly, bool searchPublicOnly, bool allowGeometrylessTables, bool allowRasterOverviewTables, const QString &schema, const QString &name ) { QMutexLocker locker( &mLock ); int nColumns = 0; @@ -1054,6 +1054,63 @@ bool QgsPostgresConn::getTableInfo( bool searchGeometryColumnsOnly, bool searchP } } + // remove raster overivews if allowRasterOverviewTables is FALSE + if ( !allowRasterOverviewTables ) + { + QString sqlRasterOverviewExist = QStringLiteral( "SELECT table_schema, table_name" + " FROM information_schema.views" + " WHERE table_schema = 'public' AND table_name = 'raster_overviews'" ); + + QgsPostgresResult resultRasterOverviewsExist; + resultRasterOverviewsExist = LoggedPQexec( "QgsPostgresConn", sqlRasterOverviewExist ); + + if ( resultRasterOverviewsExist.result() && resultRasterOverviewsExist.PQntuples() > 0 ) + { + const QString sqlRasterOverviews = QStringLiteral( "SELECT o_table_schema, o_table_name FROM public.raster_overviews" ); + + QgsPostgresResult resultRasterOverviews; + resultRasterOverviews = LoggedPQexec( "QgsPostgresConn", sqlRasterOverviews ); + + if ( resultRasterOverviews.result() && resultRasterOverviews.PQntuples() > 0 ) + { + QVector overviews; + for ( int idx = 0; idx < resultRasterOverviews.PQntuples(); idx++ ) + { + QgsPostgresRasterOverviewLayerProperty rasterOverviewProperty; + rasterOverviewProperty.schemaName = resultRasterOverviews.PQgetvalue( idx, 0 ); + rasterOverviewProperty.tableName = resultRasterOverviews.PQgetvalue( idx, 1 ); + overviews.append( rasterOverviewProperty ); + } + + QVector layersToKeep; + for ( int i = 0; i < mLayersSupported.count(); i++ ) + { + QgsPostgresLayerProperty property = mLayersSupported.at( i ); + + if ( !property.isRaster ) + { + layersToKeep.append( property ); + } + else + { + bool keepRasterTable = true; + for ( const QgsPostgresRasterOverviewLayerProperty &overview : std::as_const( overviews ) ) + { + if ( property.schemaName == overview.schemaName && property.tableName == overview.tableName ) + { + keepRasterTable = false; + } + } + + if ( keepRasterTable ) + layersToKeep.append( property ); + } + } + mLayersSupported = layersToKeep; + } + } + } + if ( nColumns == 0 && schema.isEmpty() ) { QgsMessageLog::logMessage( tr( "Database connection was successful, but the accessible tables could not be determined." ), tr( "PostGIS" ) ); @@ -1062,14 +1119,14 @@ bool QgsPostgresConn::getTableInfo( bool searchGeometryColumnsOnly, bool searchP return true; } -bool QgsPostgresConn::supportedLayersPrivate( QVector &layers, bool searchGeometryColumnsOnly, bool searchPublicOnly, bool allowGeometrylessTables, const QString &schema, const QString &table ) +bool QgsPostgresConn::supportedLayersPrivate( QVector &layers, bool searchGeometryColumnsOnly, bool searchPublicOnly, bool allowGeometrylessTables, bool allowRasterOverviewTables, const QString &schema, const QString &table ) { QMutexLocker locker( &mLock ); mLayersSupported.clear(); // Get the list of supported tables - if ( !getTableInfo( searchGeometryColumnsOnly, searchPublicOnly, allowGeometrylessTables, schema, table ) ) + if ( !getTableInfo( searchGeometryColumnsOnly, searchPublicOnly, allowGeometrylessTables, allowRasterOverviewTables, schema, table ) ) { QgsMessageLog::logMessage( tr( "Unable to get list of spatially enabled tables from the database" ), tr( "PostGIS" ) ); return false; @@ -1458,15 +1515,15 @@ Qgis::PostgresRelKind QgsPostgresConn::relKindFromValue( const QString &value ) return Qgis::PostgresRelKind::Unknown; } -bool QgsPostgresConn::supportedLayers( QVector &layers, bool searchGeometryColumnsOnly, bool searchPublicOnly, bool allowGeometrylessTables, const QString &schema ) +bool QgsPostgresConn::supportedLayers( QVector &layers, bool searchGeometryColumnsOnly, bool searchPublicOnly, bool allowGeometrylessTables, bool allowRasterOverviewTables, const QString &schema ) { - return supportedLayersPrivate( layers, searchGeometryColumnsOnly, searchPublicOnly, allowGeometrylessTables, schema ); + return supportedLayersPrivate( layers, searchGeometryColumnsOnly, searchPublicOnly, allowGeometrylessTables, allowRasterOverviewTables, schema ); } bool QgsPostgresConn::supportedLayer( QgsPostgresLayerProperty &layerProperty, const QString &schema, const QString &table ) { QVector layers; - if ( !supportedLayersPrivate( layers, false, false, true /* allowGeometrylessTables */, schema, table ) || layers.empty() ) + if ( !supportedLayersPrivate( layers, false, false, true /* allowGeometrylessTables */, false, schema, table ) || layers.empty() ) { return false; } @@ -1484,7 +1541,7 @@ PGresult *QgsPostgresConn::PQexec( const QString &query, bool logError, bool ret QgsDebugMsgLevel( QStringLiteral( "Executing SQL: %1" ).arg( query ), 3 ); - std::unique_ptr logWrapper = std::make_unique( query, mConnInfo, QStringLiteral( "postgres" ), originatorClass, queryOrigin ); + auto logWrapper = std::make_unique( query, mConnInfo, QStringLiteral( "postgres" ), originatorClass, queryOrigin ); PGresult *res = ::PQexec( mConn, query.toUtf8() ); @@ -1677,7 +1734,7 @@ PGresult *QgsPostgresConn::PQprepare( const QString &stmtName, const QString &qu { QMutexLocker locker( &mLock ); - std::unique_ptr logWrapper = std::make_unique( QStringLiteral( "PQprepare(%1): %2 " ).arg( stmtName, query ), mConnInfo, QStringLiteral( "postgres" ), originatorClass, queryOrigin ); + auto logWrapper = std::make_unique( QStringLiteral( "PQprepare(%1): %2 " ).arg( stmtName, query ), mConnInfo, QStringLiteral( "postgres" ), originatorClass, queryOrigin ); PGresult *res { ::PQprepare( mConn, stmtName.toUtf8(), query.toUtf8(), nParams, paramTypes ) }; @@ -1709,7 +1766,7 @@ PGresult *QgsPostgresConn::PQexecPrepared( const QString &stmtName, const QStrin param[i] = qparam[i]; } - std::unique_ptr logWrapper = std::make_unique( QStringLiteral( "PQexecPrepared(%1)" ).arg( stmtName ), mConnInfo, QStringLiteral( "postgres" ), originatorClass, queryOrigin ); + auto logWrapper = std::make_unique( QStringLiteral( "PQexecPrepared(%1)" ).arg( stmtName ), mConnInfo, QStringLiteral( "postgres" ), originatorClass, queryOrigin ); PGresult *res { ::PQexecPrepared( mConn, stmtName.toUtf8(), params.size(), param, nullptr, nullptr, 0 ) }; @@ -2737,6 +2794,12 @@ bool QgsPostgresConn::allowProjectsInDatabase( const QString &connName ) return settings.value( "/PostgreSQL/connections/" + connName + "/projectsInDatabase", false ).toBool(); } +bool QgsPostgresConn::allowRasterOverviewTables( const QString &connName ) +{ + QgsSettings settings; + return settings.value( "/PostgreSQL/connections/" + connName + "/allowRasterOverviewTables", true ).toBool(); +} + void QgsPostgresConn::deleteConnection( const QString &connName ) { QgsSettings settings; @@ -2761,6 +2824,7 @@ void QgsPostgresConn::deleteConnection( const QString &connName ) settings.remove( key + "/metadataInDatabase" ); settings.remove( key + "/dontResolveType" ); settings.remove( key + "/session_role" ); + settings.remove( key + "/allowRasterOverviewTables" ); settings.remove( key ); } @@ -2788,6 +2852,7 @@ void QgsPostgresConn::duplicateConnection( const QString &src, const QString &ds settings.setValue( newKey + QStringLiteral( "/saveUsername" ), settings.value( key + QStringLiteral( "/saveUsername" ) ).toString() ); settings.setValue( newKey + QStringLiteral( "/savePassword" ), settings.value( key + QStringLiteral( "/savePassword" ) ).toString() ); settings.setValue( newKey + QStringLiteral( "/authcfg" ), settings.value( key + QStringLiteral( "/authcfg" ) ).toString() ); + settings.setValue( newKey + QStringLiteral( "/allowRasterOverviewTables" ), settings.value( key + QStringLiteral( "/allowRasterOverviewTables" ) ).toString() ); settings.sync(); } diff --git a/src/providers/postgres/qgspostgresconn.h b/src/providers/postgres/qgspostgresconn.h index ea38d2806626..b813a0eb1af9 100644 --- a/src/providers/postgres/qgspostgresconn.h +++ b/src/providers/postgres/qgspostgresconn.h @@ -68,6 +68,12 @@ struct QgsPostgresSchemaProperty QString owner; }; +//! Raster overview table properties structure +struct QgsPostgresRasterOverviewLayerProperty +{ + QString schemaName; + QString tableName; +}; //! Layer Property structure // TODO: Fill to Postgres/PostGIS specifications @@ -382,10 +388,11 @@ class QgsPostgresConn : public QObject * contained in the geometry_columns metatable * \param searchPublicOnly * \param allowGeometrylessTables + * \param allowRasterOverviewTables list raster layer overviews * \param schema restrict layers to layers within specified schema * \returns true if layers were fetched successfully */ - bool supportedLayers( QVector &layers, bool searchGeometryColumnsOnly = true, bool searchPublicOnly = true, bool allowGeometrylessTables = false, const QString &schema = QString() ); + bool supportedLayers( QVector &layers, bool searchGeometryColumnsOnly = true, bool searchPublicOnly = true, bool allowGeometrylessTables = false, bool allowRasterOverviewTables = false, const QString &schema = QString() ); /** * Get the information about a supported layer @@ -418,11 +425,12 @@ class QgsPostgresConn : public QObject * contained in the geometry_columns metatable * \param searchPublicOnly * \param allowGeometrylessTables + * \param allowRasterOverviewTables list raster layer overviews * \param schema restrict tables to those within specified schema * \param name restrict tables to those with specified name * \returns true if tables were successfully queried */ - bool getTableInfo( bool searchGeometryColumnsOnly, bool searchPublicOnly, bool allowGeometrylessTables, const QString &schema = QString(), const QString &name = QString() ); + bool getTableInfo( bool searchGeometryColumnsOnly, bool searchPublicOnly, bool allowGeometrylessTables, bool allowRasterOverviewTables = false, const QString &schema = QString(), const QString &name = QString() ); qint64 getBinaryInt( QgsPostgresResult &queryResult, int row, int col ); @@ -471,6 +479,7 @@ class QgsPostgresConn : public QObject static bool allowProjectsInDatabase( const QString &connName ); static void deleteConnection( const QString &connName ); static bool allowMetadataInDatabase( const QString &connName ); + static bool allowRasterOverviewTables( const QString &connName ); /** * Duplicates \a src connection settings to a new \a dst connection. @@ -543,11 +552,12 @@ class QgsPostgresConn : public QObject * contained in the geometry_columns metatable * \param searchPublicOnly * \param allowGeometrylessTables + * \param allowRasterOverviewTables list raster layer overviews * \param schema restrict layers to layers within specified schema * \param table restrict tables to those with specified table * \returns true if layers were fetched successfully */ - bool supportedLayersPrivate( QVector &layers, bool searchGeometryColumnsOnly = true, bool searchPublicOnly = true, bool allowGeometrylessTables = false, const QString &schema = QString(), const QString &table = QString() ); + bool supportedLayersPrivate( QVector &layers, bool searchGeometryColumnsOnly = true, bool searchPublicOnly = true, bool allowGeometrylessTables = false, bool allowRasterOverviewTables = false, const QString &schema = QString(), const QString &table = QString() ); //! List of the supported layers QVector mLayersSupported; diff --git a/src/providers/postgres/qgspostgresdataitemguiprovider.cpp b/src/providers/postgres/qgspostgresdataitemguiprovider.cpp index e6366984703d..e4578bb8f9d1 100644 --- a/src/providers/postgres/qgspostgresdataitemguiprovider.cpp +++ b/src/providers/postgres/qgspostgresdataitemguiprovider.cpp @@ -25,6 +25,7 @@ #include "qgsdataitemguiproviderutils.h" #include "qgssettings.h" #include "qgspostgresconn.h" +#include "qgspostgresutils.h" #include #include diff --git a/src/providers/postgres/qgspostgresdataitems.cpp b/src/providers/postgres/qgspostgresdataitems.cpp index 46ec9265c0b6..c02eb4706e9b 100644 --- a/src/providers/postgres/qgspostgresdataitems.cpp +++ b/src/providers/postgres/qgspostgresdataitems.cpp @@ -33,149 +33,7 @@ #include #include #include - -bool QgsPostgresUtils::deleteLayer( const QString &uri, QString &errCause ) -{ - QgsDebugMsgLevel( "deleting layer " + uri, 2 ); - - QgsDataSourceUri dsUri( uri ); - QString schemaName = dsUri.schema(); - QString tableName = dsUri.table(); - QString geometryCol = dsUri.geometryColumn(); - - QString schemaTableName; - if ( !schemaName.isEmpty() ) - { - schemaTableName = QgsPostgresConn::quotedIdentifier( schemaName ) + '.'; - } - schemaTableName += QgsPostgresConn::quotedIdentifier( tableName ); - - QgsPostgresConn *conn = QgsPostgresConn::connectDb( dsUri, false ); - if ( !conn ) - { - errCause = QObject::tr( "Connection to database failed" ); - return false; - } - - // handle deletion of views - QString sqlViewCheck = QStringLiteral( "SELECT relkind FROM pg_class WHERE oid=regclass(%1)::oid" ) - .arg( QgsPostgresConn::quotedValue( schemaTableName ) ); - QgsPostgresResult resViewCheck( conn->LoggedPQexec( "QgsPostgresUtils", sqlViewCheck ) ); - const QString type = resViewCheck.PQgetvalue( 0, 0 ); - const Qgis::PostgresRelKind relKind = QgsPostgresConn::relKindFromValue( type ); - - switch ( relKind ) - { - case Qgis::PostgresRelKind::View: - case Qgis::PostgresRelKind::MaterializedView: - { - QString sql = QStringLiteral( "DROP %1VIEW %2" ).arg( type == QLatin1String( "m" ) ? QStringLiteral( "MATERIALIZED " ) : QString(), schemaTableName ); - QgsPostgresResult result( conn->LoggedPQexec( "QgsPostgresUtils", sql ) ); - if ( result.PQresultStatus() != PGRES_COMMAND_OK ) - { - errCause = QObject::tr( "Unable to delete view %1: \n%2" ) - .arg( schemaTableName, result.PQresultErrorMessage() ); - conn->unref(); - return false; - } - conn->unref(); - return true; - } - - case Qgis::PostgresRelKind::NotSet: - case Qgis::PostgresRelKind::Unknown: - case Qgis::PostgresRelKind::OrdinaryTable: - case Qgis::PostgresRelKind::Index: - case Qgis::PostgresRelKind::Sequence: - case Qgis::PostgresRelKind::CompositeType: - case Qgis::PostgresRelKind::ToastTable: - case Qgis::PostgresRelKind::ForeignTable: - case Qgis::PostgresRelKind::PartitionedTable: - { - // TODO -- this logic is being applied to a whole bunch - // of potentially non-table items, eg indexes and sequences. - // These should have special handling! - - // check the geometry column count - QString sql = QString( "SELECT count(*) " - "FROM geometry_columns, pg_class, pg_namespace " - "WHERE f_table_name=relname AND f_table_schema=nspname " - "AND pg_class.relnamespace=pg_namespace.oid " - "AND f_table_schema=%1 AND f_table_name=%2" ) - .arg( QgsPostgresConn::quotedValue( schemaName ), QgsPostgresConn::quotedValue( tableName ) ); - QgsPostgresResult result( conn->LoggedPQexec( "QgsPostgresUtils", sql ) ); - if ( result.PQresultStatus() != PGRES_TUPLES_OK ) - { - errCause = QObject::tr( "Unable to delete layer %1: \n%2" ) - .arg( schemaTableName, result.PQresultErrorMessage() ); - conn->unref(); - return false; - } - - int count = result.PQgetvalue( 0, 0 ).toInt(); - - if ( !geometryCol.isEmpty() && count > 1 ) - { - // the table has more geometry columns, drop just the geometry column - sql = QStringLiteral( "SELECT DropGeometryColumn(%1,%2,%3)" ) - .arg( QgsPostgresConn::quotedValue( schemaName ), QgsPostgresConn::quotedValue( tableName ), QgsPostgresConn::quotedValue( geometryCol ) ); - } - else - { - // drop the table - sql = QStringLiteral( "SELECT DropGeometryTable(%1,%2)" ) - .arg( QgsPostgresConn::quotedValue( schemaName ), QgsPostgresConn::quotedValue( tableName ) ); - } - - result = conn->LoggedPQexec( "QgsPostgresUtils", sql ); - if ( result.PQresultStatus() != PGRES_TUPLES_OK ) - { - errCause = QObject::tr( "Unable to delete layer %1: \n%2" ) - .arg( schemaTableName, result.PQresultErrorMessage() ); - conn->unref(); - return false; - } - - conn->unref(); - return true; - } - } - BUILTIN_UNREACHABLE -} - -bool QgsPostgresUtils::deleteSchema( const QString &schema, const QgsDataSourceUri &uri, QString &errCause, bool cascade ) -{ - QgsDebugMsgLevel( "deleting schema " + schema, 2 ); - - if ( schema.isEmpty() ) - return false; - - QString schemaName = QgsPostgresConn::quotedIdentifier( schema ); - - QgsPostgresConn *conn = QgsPostgresConn::connectDb( uri, false ); - if ( !conn ) - { - errCause = QObject::tr( "Connection to database failed" ); - return false; - } - - // drop the schema - QString sql = QStringLiteral( "DROP SCHEMA %1 %2" ) - .arg( schemaName, cascade ? QStringLiteral( "CASCADE" ) : QString() ); - - QgsPostgresResult result( conn->LoggedPQexec( "QgsPostgresUtils", sql ) ); - if ( result.PQresultStatus() != PGRES_COMMAND_OK ) - { - errCause = QObject::tr( "Unable to delete schema %1: \n%2" ) - .arg( schemaName, result.PQresultErrorMessage() ); - conn->unref(); - return false; - } - - conn->unref(); - return true; -} - +#include "qgspostgresutils.h" // --------------------------------------------------------------------------- QgsPGConnectionItem::QgsPGConnectionItem( QgsDataItem *parent, const QString &name, const QString &path ) @@ -291,7 +149,7 @@ bool QgsPGConnectionItem::handleDrop( const QMimeData *data, const QString &toSc uri.setSchema( toSchema ); } - std::unique_ptr exportTask( new QgsVectorLayerExporterTask( srcLayer, uri.uri( false ), QStringLiteral( "postgres" ), srcLayer->crs(), QVariantMap(), owner ) ); + auto exportTask = std::make_unique( srcLayer, uri.uri( false ), QStringLiteral( "postgres" ), srcLayer->crs(), QVariantMap(), owner ); // when export is successful: connect( exportTask.get(), &QgsVectorLayerExporterTask::exportComplete, this, [=]() { @@ -413,7 +271,7 @@ QVector QgsPGSchemaItem::createChildren() } QVector layerProperties; - const bool ok = conn->supportedLayers( layerProperties, QgsPostgresConn::geometryColumnsOnly( mConnectionName ), QgsPostgresConn::publicSchemaOnly( mConnectionName ), QgsPostgresConn::allowGeometrylessTables( mConnectionName ), mName ); + const bool ok = conn->supportedLayers( layerProperties, QgsPostgresConn::geometryColumnsOnly( mConnectionName ), QgsPostgresConn::publicSchemaOnly( mConnectionName ), QgsPostgresConn::allowGeometrylessTables( mConnectionName ), QgsPostgresConn::allowRasterOverviewTables( mConnectionName ), mName ); if ( !ok ) { diff --git a/src/providers/postgres/qgspostgresfeatureiterator.cpp b/src/providers/postgres/qgspostgresfeatureiterator.cpp index cb32b7de0b25..d11334c06e8f 100644 --- a/src/providers/postgres/qgspostgresfeatureiterator.cpp +++ b/src/providers/postgres/qgspostgresfeatureiterator.cpp @@ -24,6 +24,7 @@ #include "qgsmessagelog.h" #include "qgsexception.h" #include "qgsgeometryengine.h" +#include "qgspostgresutils.h" #include #include diff --git a/src/providers/postgres/qgspostgreslistener.cpp b/src/providers/postgres/qgspostgreslistener.cpp index c56644def416..c4a371bec710 100644 --- a/src/providers/postgres/qgspostgreslistener.cpp +++ b/src/providers/postgres/qgspostgreslistener.cpp @@ -35,7 +35,7 @@ extern "C" std::unique_ptr QgsPostgresListener::create( const QString &connString ) { - std::unique_ptr res( new QgsPostgresListener( connString ) ); + auto res = std::make_unique( connString ); QgsDebugMsgLevel( QStringLiteral( "starting notification listener" ), 2 ); res->start(); diff --git a/src/providers/postgres/qgspostgreslistener.h b/src/providers/postgres/qgspostgreslistener.h index 13084156c772..74a734e3f638 100644 --- a/src/providers/postgres/qgspostgreslistener.h +++ b/src/providers/postgres/qgspostgreslistener.h @@ -44,6 +44,7 @@ class QgsPostgresListener : public QThread */ static std::unique_ptr create( const QString &connString ); + QgsPostgresListener( const QString &connString ); ~QgsPostgresListener() override; void run() override; @@ -56,8 +57,6 @@ class QgsPostgresListener : public QThread QgsPostgresConn *mConn = nullptr; - QgsPostgresListener( const QString &connString ); - Q_DISABLE_COPY( QgsPostgresListener ) }; diff --git a/src/providers/postgres/qgspostgresprovider.cpp b/src/providers/postgres/qgspostgresprovider.cpp index 1ad7f21dba48..9971e91cba45 100644 --- a/src/providers/postgres/qgspostgresprovider.cpp +++ b/src/providers/postgres/qgspostgresprovider.cpp @@ -49,6 +49,7 @@ #include "qgsprovidermetadata.h" #include "qgspostgresproviderconnection.h" #include "qgspostgresprovidermetadatautils.h" +#include "qgspostgresutils.h" #include const QString QgsPostgresProvider::POSTGRES_KEY = QStringLiteral( "postgres" ); @@ -66,18 +67,6 @@ inline qint32 FID2PKINT( qint64 x ) return QgsPostgresUtils::fid_to_int32pk( x ); } -static bool tableExists( QgsPostgresConn &conn, const QString &name ) -{ - QgsPostgresResult res( conn.LoggedPQexec( QStringLiteral( "tableExists" ), "SELECT EXISTS ( SELECT oid FROM pg_catalog.pg_class WHERE relname=" + QgsPostgresConn::quotedValue( name ) + ")" ) ); - return res.PQgetvalue( 0, 0 ).startsWith( 't' ); -} - -static bool columnExists( QgsPostgresConn &conn, const QString &table, const QString &column ) -{ - QgsPostgresResult res( conn.LoggedPQexec( QStringLiteral( "columnExists" ), "SELECT COUNT(*) FROM information_schema.columns WHERE table_name=" + QgsPostgresConn::quotedValue( table ) + " and column_name=" + QgsPostgresConn::quotedValue( column ) ) ); - return res.PQgetvalue( 0, 0 ).toInt() > 0; -} - QgsPostgresPrimaryKeyType QgsPostgresProvider::pkType( const QgsField &f ) const { @@ -639,193 +628,6 @@ QString QgsPostgresProvider::whereClause( QgsFeatureIds featureIds ) const return QgsPostgresUtils::whereClause( featureIds, mAttributeFields, connectionRO(), mPrimaryKeyType, mPrimaryKeyAttrs, mShared ); } - -QString QgsPostgresUtils::whereClause( QgsFeatureId featureId, const QgsFields &fields, QgsPostgresConn *conn, QgsPostgresPrimaryKeyType pkType, const QList &pkAttrs, const std::shared_ptr &sharedData ) -{ - QString whereClause; - - switch ( pkType ) - { - case PktTid: - whereClause = QStringLiteral( "ctid='(%1,%2)'" ) - .arg( FID_TO_NUMBER( featureId ) >> 16 ) - .arg( FID_TO_NUMBER( featureId ) & 0xffff ); - break; - - case PktOid: - whereClause = QStringLiteral( "oid=%1" ).arg( featureId ); - break; - - case PktInt: - Q_ASSERT( pkAttrs.size() == 1 ); - whereClause = QStringLiteral( "%1=%2" ).arg( QgsPostgresConn::quotedIdentifier( fields.at( pkAttrs[0] ).name() ) ).arg( FID2PKINT( featureId ) ); - break; - - case PktInt64: - case PktUint64: - { - Q_ASSERT( pkAttrs.size() == 1 ); - QVariantList pkVals = sharedData->lookupKey( featureId ); - if ( !pkVals.isEmpty() ) - { - QgsField fld = fields.at( pkAttrs[0] ); - whereClause = conn->fieldExpression( fld ); - if ( !QgsVariantUtils::isNull( pkVals[0] ) ) - whereClause += '=' + pkVals[0].toString(); - else - whereClause += QLatin1String( " IS NULL" ); - } - } - break; - - case PktFidMap: - { - QVariantList pkVals = sharedData->lookupKey( featureId ); - if ( !pkVals.isEmpty() ) - { - Q_ASSERT( pkVals.size() == pkAttrs.size() ); - - QString delim; - for ( int i = 0; i < pkAttrs.size(); i++ ) - { - int idx = pkAttrs[i]; - QgsField fld = fields.at( idx ); - - whereClause += delim + conn->fieldExpressionForWhereClause( fld, static_cast( pkVals[i].userType() ) ); - if ( QgsVariantUtils::isNull( pkVals[i] ) ) - whereClause += QLatin1String( " IS NULL" ); - else - whereClause += '=' + QgsPostgresConn::quotedValue( pkVals[i] ); // remove toString as it must be handled by quotedValue function - - delim = QStringLiteral( " AND " ); - } - } - else - { - QgsDebugError( QStringLiteral( "FAILURE: Key values for feature %1 not found." ).arg( featureId ) ); - whereClause = QStringLiteral( "NULL" ); - } - } - break; - - case PktUnknown: - Q_ASSERT( !"FAILURE: Primary key unknown" ); - whereClause = QStringLiteral( "NULL" ); - break; - } - - return whereClause; -} - -QString QgsPostgresUtils::whereClause( const QgsFeatureIds &featureIds, const QgsFields &fields, QgsPostgresConn *conn, QgsPostgresPrimaryKeyType pkType, const QList &pkAttrs, const std::shared_ptr &sharedData ) -{ - auto lookupKeyWhereClause = [=] { - if ( featureIds.isEmpty() ) - return QString(); - - //simple primary key, so prefer to use an "IN (...)" query. These are much faster then multiple chained ...OR... clauses - QString delim; - QString expr = QStringLiteral( "%1 IN (" ).arg( QgsPostgresConn::quotedIdentifier( fields.at( pkAttrs[0] ).name() ) ); - - for ( const QgsFeatureId featureId : std::as_const( featureIds ) ) - { - const QVariantList pkVals = sharedData->lookupKey( featureId ); - if ( !pkVals.isEmpty() ) - { - expr += delim + QgsPostgresConn::quotedValue( pkVals.at( 0 ) ); - delim = ','; - } - } - expr += ')'; - - return expr; - }; - - switch ( pkType ) - { - case PktOid: - case PktInt: - { - QString expr; - - //simple primary key, so prefer to use an "IN (...)" query. These are much faster then multiple chained ...OR... clauses - if ( !featureIds.isEmpty() ) - { - QString delim; - expr = QStringLiteral( "%1 IN (" ).arg( ( pkType == PktOid ? QStringLiteral( "oid" ) : QgsPostgresConn::quotedIdentifier( fields.at( pkAttrs[0] ).name() ) ) ); - - for ( const QgsFeatureId featureId : std::as_const( featureIds ) ) - { - expr += delim + FID_TO_STRING( ( pkType == PktOid ? featureId : FID2PKINT( featureId ) ) ); - delim = ','; - } - expr += ')'; - } - - return expr; - } - case PktInt64: - case PktUint64: - return lookupKeyWhereClause(); - - case PktFidMap: - case PktTid: - case PktUnknown: - { - // on simple string primary key we can use IN - if ( pkType == PktFidMap && pkAttrs.count() == 1 && fields.at( pkAttrs[0] ).type() == QMetaType::Type::QString ) - return lookupKeyWhereClause(); - - //complex primary key, need to build up where string - QStringList whereClauses; - for ( const QgsFeatureId featureId : std::as_const( featureIds ) ) - { - whereClauses << whereClause( featureId, fields, conn, pkType, pkAttrs, sharedData ); - } - return whereClauses.isEmpty() ? QString() : whereClauses.join( QLatin1String( " OR " ) ).prepend( '(' ).append( ')' ); - } - } - return QString(); //avoid warning -} - -QString QgsPostgresUtils::andWhereClauses( const QString &c1, const QString &c2 ) -{ - if ( c1.isEmpty() ) - return c2; - if ( c2.isEmpty() ) - return c1; - - return QStringLiteral( "(%1) AND (%2)" ).arg( c1, c2 ); -} - -void QgsPostgresUtils::replaceInvalidXmlChars( QString &xml ) -{ - static const QRegularExpression replaceRe { QStringLiteral( "([\\x00-\\x08\\x0B-\\x1F\\x7F])" ) }; - QRegularExpressionMatchIterator it { replaceRe.globalMatch( xml ) }; - while ( it.hasNext() ) - { - const QRegularExpressionMatch match { it.next() }; - const QChar c { match.captured( 1 ).at( 0 ) }; - xml.replace( c, QStringLiteral( "UTF-8[%1]" ).arg( c.unicode() ) ); - } -} - -void QgsPostgresUtils::restoreInvalidXmlChars( QString &xml ) -{ - static const QRegularExpression replaceRe { QStringLiteral( R"raw(UTF-8\[(\d+)\])raw" ) }; - QRegularExpressionMatchIterator it { replaceRe.globalMatch( xml ) }; - while ( it.hasNext() ) - { - const QRegularExpressionMatch match { it.next() }; - bool ok; - const ushort code { match.captured( 1 ).toUShort( &ok ) }; - if ( ok ) - { - xml.replace( QStringLiteral( "UTF-8[%1]" ).arg( code ), QChar( code ) ); - } - } -} - QString QgsPostgresProvider::filterWhereClause() const { QString where; @@ -1400,7 +1202,7 @@ bool QgsPostgresProvider::loadFields() void QgsPostgresProvider::setEditorWidgets() { - if ( !tableExists( *connectionRO(), EDITOR_WIDGET_STYLES_TABLE ) ) + if ( !QgsPostgresUtils::tableExists( connectionRO(), EDITOR_WIDGET_STYLES_TABLE ) ) { return; } @@ -4793,7 +4595,7 @@ Qgis::VectorExportResult QgsPostgresProvider::createEmptyLayer( const QString &u QgsDataProvider::ProviderOptions providerOptions; Qgis::DataProviderReadFlags flags; - std::unique_ptr provider = std::make_unique( dsUri.uri( false ), providerOptions, flags ); + auto provider = std::make_unique( dsUri.uri( false ), providerOptions, flags ); if ( !provider->isValid() ) { if ( errorMessage ) @@ -5345,11 +5147,11 @@ bool QgsPostgresProviderMetadata::styleExists( const QString &uri, const QString return false; } - if ( !tableExists( *conn, QStringLiteral( "layer_styles" ) ) ) + if ( !QgsPostgresUtils::tableExists( conn, QStringLiteral( "layer_styles" ) ) ) { return false; } - else if ( !columnExists( *conn, QStringLiteral( "layer_styles" ), QStringLiteral( "type" ) ) ) + else if ( !QgsPostgresUtils::columnExists( conn, QStringLiteral( "layer_styles" ), QStringLiteral( "type" ) ) ) { return false; } @@ -5405,25 +5207,9 @@ bool QgsPostgresProviderMetadata::saveStyle( const QString &uri, const QString & return false; } - if ( !tableExists( *conn, QStringLiteral( "layer_styles" ) ) ) - { - QgsPostgresResult res( conn->LoggedPQexec( QStringLiteral( "QgsPostgresProviderMetadata" ), "CREATE TABLE layer_styles(" - "id SERIAL PRIMARY KEY" - ",f_table_catalog varchar" - ",f_table_schema varchar" - ",f_table_name varchar" - ",f_geometry_column varchar" - ",styleName text" - ",styleQML xml" - ",styleSLD xml" - ",useAsDefault boolean" - ",description text" - ",owner varchar(63) DEFAULT CURRENT_USER" - ",ui xml" - ",update_time timestamp DEFAULT CURRENT_TIMESTAMP" - ",type varchar" - ")" ) ); - if ( res.PQresultStatus() != PGRES_COMMAND_OK ) + if ( !QgsPostgresUtils::tableExists( conn, QStringLiteral( "layer_styles" ) ) ) + { + if ( !QgsPostgresUtils::createStylesTable( conn, QStringLiteral( "QgsPostgresProviderMetadata" ) ) ) { errCause = QObject::tr( "Unable to save layer style. It's not possible to create the destination table on the database. Maybe this is due to table permissions (user=%1). Please contact your database admin" ).arg( dsUri.username() ); conn->unref(); @@ -5432,7 +5218,7 @@ bool QgsPostgresProviderMetadata::saveStyle( const QString &uri, const QString & } else { - if ( !columnExists( *conn, QStringLiteral( "layer_styles" ), QStringLiteral( "type" ) ) ) + if ( !QgsPostgresUtils::columnExists( conn, QStringLiteral( "layer_styles" ), QStringLiteral( "type" ) ) ) { QgsPostgresResult res( conn->LoggedPQexec( QStringLiteral( "QgsPostgresProviderMetadata" ), "ALTER TABLE layer_styles ADD COLUMN type varchar NULL" ) ); if ( res.PQresultStatus() != PGRES_COMMAND_OK ) @@ -5580,7 +5366,7 @@ QString QgsPostgresProviderMetadata::loadStoredStyle( const QString &uri, QStrin dsUri.setDatabase( conn->currentDatabase() ); } - if ( !tableExists( *conn, QStringLiteral( "layer_styles" ) ) ) + if ( !QgsPostgresUtils::tableExists( conn, QStringLiteral( "layer_styles" ) ) ) { conn->unref(); return QString(); @@ -5599,7 +5385,7 @@ QString QgsPostgresProviderMetadata::loadStoredStyle( const QString &uri, QStrin QString wkbTypeString = QgsPostgresConn::quotedValue( QgsWkbTypes::geometryDisplayString( QgsWkbTypes::geometryType( dsUri.wkbType() ) ) ); // support layer_styles without type column < 3.14 - if ( !columnExists( *conn, QStringLiteral( "layer_styles" ), QStringLiteral( "type" ) ) ) + if ( !QgsPostgresUtils::columnExists( conn, QStringLiteral( "layer_styles" ), QStringLiteral( "type" ) ) ) { selectQmlQuery = QString( "SELECT styleName, styleQML" " FROM layer_styles" @@ -5655,7 +5441,7 @@ int QgsPostgresProviderMetadata::listStyles( const QString &uri, QStringList &id return -1; } - if ( !tableExists( *conn, QStringLiteral( "layer_styles" ) ) ) + if ( !QgsPostgresUtils::tableExists( conn, QStringLiteral( "layer_styles" ) ) ) { return -1; } @@ -5854,124 +5640,6 @@ void QgsPostgresProviderMetadata::cleanupProvider() } -// ---------- - -void QgsPostgresSharedData::addFeaturesCounted( long long diff ) -{ - QMutexLocker locker( &mMutex ); - - if ( mFeaturesCounted >= 0 ) - mFeaturesCounted += diff; -} - -void QgsPostgresSharedData::ensureFeaturesCountedAtLeast( long long fetched ) -{ - QMutexLocker locker( &mMutex ); - - /* only updates the feature count if it was already once. - * Otherwise, this would lead to false feature count if - * an existing project is open at a restrictive extent. - */ - if ( mFeaturesCounted > 0 && mFeaturesCounted < fetched ) - { - QgsDebugMsgLevel( QStringLiteral( "feature count adjusted from %1 to %2" ).arg( mFeaturesCounted ).arg( fetched ), 2 ); - mFeaturesCounted = fetched; - } -} - -long long QgsPostgresSharedData::featuresCounted() -{ - QMutexLocker locker( &mMutex ); - return mFeaturesCounted; -} - -void QgsPostgresSharedData::setFeaturesCounted( long long count ) -{ - QMutexLocker locker( &mMutex ); - mFeaturesCounted = count; -} - - -QgsFeatureId QgsPostgresSharedData::lookupFid( const QVariantList &v ) -{ - QMutexLocker locker( &mMutex ); - - QMap::const_iterator it = mKeyToFid.constFind( v ); - - if ( it != mKeyToFid.constEnd() ) - { - return it.value(); - } - - mFidToKey.insert( ++mFidCounter, v ); - mKeyToFid.insert( v, mFidCounter ); - - return mFidCounter; -} - - -QVariantList QgsPostgresSharedData::removeFid( QgsFeatureId fid ) -{ - QMutexLocker locker( &mMutex ); - - QVariantList v = mFidToKey[fid]; - mFidToKey.remove( fid ); - mKeyToFid.remove( v ); - return v; -} - -void QgsPostgresSharedData::insertFid( QgsFeatureId fid, const QVariantList &k ) -{ - QMutexLocker locker( &mMutex ); - - mFidToKey.insert( fid, k ); - mKeyToFid.insert( k, fid ); -} - -QVariantList QgsPostgresSharedData::lookupKey( QgsFeatureId featureId ) -{ - QMutexLocker locker( &mMutex ); - - QMap::const_iterator it = mFidToKey.constFind( featureId ); - if ( it != mFidToKey.constEnd() ) - return it.value(); - return QVariantList(); -} - -void QgsPostgresSharedData::clear() -{ - QMutexLocker locker( &mMutex ); - mFidToKey.clear(); - mKeyToFid.clear(); - mFeaturesCounted = -1; - mFidCounter = 0; -} - -void QgsPostgresSharedData::clearSupportsEnumValuesCache() -{ - QMutexLocker locker( &mMutex ); - mFieldSupportsEnumValues.clear(); -} - -bool QgsPostgresSharedData::fieldSupportsEnumValuesIsSet( int index ) -{ - QMutexLocker locker( &mMutex ); - return mFieldSupportsEnumValues.contains( index ); -} - -bool QgsPostgresSharedData::fieldSupportsEnumValues( int index ) -{ - QMutexLocker locker( &mMutex ); - return mFieldSupportsEnumValues.contains( index ) && mFieldSupportsEnumValues[index]; -} - -void QgsPostgresSharedData::setFieldSupportsEnumValues( int index, bool isSupported ) -{ - QMutexLocker locker( &mMutex ); - mFieldSupportsEnumValues[index] = isSupported; -} - - QgsPostgresProviderMetadata::QgsPostgresProviderMetadata() : QgsProviderMetadata( QgsPostgresProvider::POSTGRES_KEY, QgsPostgresProvider::POSTGRES_DESCRIPTION ) { @@ -6038,7 +5706,6 @@ QVariantMap QgsPostgresProviderMetadata::decodeUri( const QString &uri ) const return uriParts; } - QString QgsPostgresProviderMetadata::encodeUri( const QVariantMap &parts ) const { QgsDataSourceUri dsUri; diff --git a/src/providers/postgres/qgspostgresprovider.h b/src/providers/postgres/qgspostgresprovider.h index 01b54cc9b64b..abbf727cda8b 100644 --- a/src/providers/postgres/qgspostgresprovider.h +++ b/src/providers/postgres/qgspostgresprovider.h @@ -26,6 +26,7 @@ #include "qgsreferencedgeometry.h" #include #include +#include "qgspostgresutils.h" class QgsFeature; class QgsField; @@ -496,80 +497,6 @@ class QgsPostgresProvider final : public QgsVectorDataProvider bool computeExtent3D() const; }; - -//! Assorted Postgres utility functions -class QgsPostgresUtils -{ - public: - static bool deleteLayer( const QString &uri, QString &errCause ); - static bool deleteSchema( const QString &schema, const QgsDataSourceUri &uri, QString &errCause, bool cascade = false ); - - static QString whereClause( QgsFeatureId featureId, const QgsFields &fields, QgsPostgresConn *conn, QgsPostgresPrimaryKeyType pkType, const QList &pkAttrs, const std::shared_ptr &sharedData ); - - static QString whereClause( const QgsFeatureIds &featureIds, const QgsFields &fields, QgsPostgresConn *conn, QgsPostgresPrimaryKeyType pkType, const QList &pkAttrs, const std::shared_ptr &sharedData ); - - static QString andWhereClauses( const QString &c1, const QString &c2 ); - - static const qint64 INT32PK_OFFSET = 4294967296; // 2^32 - - // We shift negative 32bit integers to above the max 32bit - // positive integer to support the whole range of int32 values - // See https://github.com/qgis/QGIS/issues/22258 - static qint64 int32pk_to_fid( qint32 x ) - { - return x >= 0 ? x : x + INT32PK_OFFSET; - } - - static qint32 fid_to_int32pk( qint64 x ) - { - return x <= ( ( INT32PK_OFFSET ) / 2.0 ) ? x : -( INT32PK_OFFSET - x ); - } - - //! Replaces invalid XML chars with UTF-8[] - static void replaceInvalidXmlChars( QString &xml ); - - //! Replaces UTF-8[] with the actual unicode char - static void restoreInvalidXmlChars( QString &xml ); -}; - -/** - * Data shared between provider class and its feature sources. Ideally there should - * be as few members as possible because there could be simultaneous reads/writes - * from different threads and therefore locking has to be involved. -*/ -class QgsPostgresSharedData -{ - public: - QgsPostgresSharedData() = default; - - long long featuresCounted(); - void setFeaturesCounted( long long count ); - void addFeaturesCounted( long long diff ); - void ensureFeaturesCountedAtLeast( long long fetched ); - - // FID lookups - QgsFeatureId lookupFid( const QVariantList &v ); // lookup existing mapping or add a new one - QVariantList removeFid( QgsFeatureId fid ); - void insertFid( QgsFeatureId fid, const QVariantList &k ); - QVariantList lookupKey( QgsFeatureId featureId ); - void clear(); - - void clearSupportsEnumValuesCache(); - bool fieldSupportsEnumValuesIsSet( int index ); - bool fieldSupportsEnumValues( int index ); - void setFieldSupportsEnumValues( int index, bool isSupported ); - - protected: - QMutex mMutex; //!< Access to all data members is guarded by the mutex - - long long mFeaturesCounted = -1; //!< Number of features in the layer - - QgsFeatureId mFidCounter = 0; // next feature id if map is used - QMap mKeyToFid; // map key values to feature id - QMap mFidToKey; // map feature id back to key values - QMap mFieldSupportsEnumValues; // map field index to bool flag supports enum values -}; - class QgsPostgresProviderMetadata final : public QgsProviderMetadata { Q_OBJECT diff --git a/src/providers/postgres/qgspostgresproviderconnection.cpp b/src/providers/postgres/qgspostgresproviderconnection.cpp index e73969ab09cb..c90674d7914d 100644 --- a/src/providers/postgres/qgspostgresproviderconnection.cpp +++ b/src/providers/postgres/qgspostgresproviderconnection.cpp @@ -45,6 +45,7 @@ const QStringList QgsPostgresProviderConnection::CONFIGURATION_PARAMETERS = { QStringLiteral( "projectsInDatabase" ), QStringLiteral( "metadataInDatabase" ), QStringLiteral( "session_role" ), + QStringLiteral( "allowRasterOverviewTables" ), }; const QString QgsPostgresProviderConnection::SETTINGS_BASE_KEY = QStringLiteral( "/PostgreSQL/connections/" ); @@ -239,7 +240,7 @@ QList QgsPostgresProviderC } else { - ok = conn->supportedLayers( properties, false, schema == QStringLiteral( "public" ), aspatial, schema ); + ok = conn->supportedLayers( properties, false, schema == QStringLiteral( "public" ), aspatial, false, schema ); } if ( !ok ) @@ -440,7 +441,7 @@ QgsAbstractDatabaseProviderConnection::QueryResult QgsPostgresProviderConnection } std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); - std::unique_ptr res = std::make_unique( conn->LoggedPQexec( "QgsPostgresProviderConnection", sql ) ); + auto res = std::make_unique( conn->LoggedPQexec( "QgsPostgresProviderConnection", sql ) ); std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); results.setQueryExecutionTime( std::chrono::duration_cast( end - begin ).count() ); @@ -875,7 +876,7 @@ QgsVectorLayer *QgsPostgresProviderConnection::createSqlVectorLayer( const SqlVe if ( !options.primaryKeyColumns.isEmpty() ) { tUri.setKeyColumn( options.primaryKeyColumns.join( ',' ) ); - tUri.setTable( QStringLiteral( "(%1)" ).arg( options.sql ) ); + tUri.setTable( QStringLiteral( "(%1)" ).arg( sanitizeSqlForQueryLayer( options.sql ) ) ); } else { @@ -891,7 +892,7 @@ QgsVectorLayer *QgsPostgresProviderConnection::createSqlVectorLayer( const SqlVe { sqlId++; } - tUri.setTable( QStringLiteral( "(SELECT row_number() over () AS _uid%1_, * FROM (%2\n) AS _subq_%3_\n)" ).arg( QString::number( pkId ), options.sql, QString::number( sqlId ) ) ); + tUri.setTable( QStringLiteral( "(SELECT row_number() over () AS _uid%1_, * FROM (%2\n) AS _subq_%3_\n)" ).arg( QString::number( pkId ), sanitizeSqlForQueryLayer( options.sql ), QString::number( sqlId ) ) ); } if ( !options.geometryColumn.isEmpty() ) diff --git a/src/providers/postgres/qgspostgresutils.cpp b/src/providers/postgres/qgspostgresutils.cpp new file mode 100644 index 000000000000..5a9c6d8e4122 --- /dev/null +++ b/src/providers/postgres/qgspostgresutils.cpp @@ -0,0 +1,501 @@ +/*************************************************************************** + qgspostgresutils.cpp - Utils for PostgreSQL/PostGIS + ------------------- + begin : Jan 2, 2004 + copyright : (C) 2003 by Gary E.Sherman + email : sherman at mrcc.com + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "qgslogger.h" +#include "qgspostgresutils.h" + +// ---------- + +void QgsPostgresSharedData::addFeaturesCounted( long long diff ) +{ + QMutexLocker locker( &mMutex ); + + if ( mFeaturesCounted >= 0 ) + mFeaturesCounted += diff; +} + +void QgsPostgresSharedData::ensureFeaturesCountedAtLeast( long long fetched ) +{ + QMutexLocker locker( &mMutex ); + + /* only updates the feature count if it was already once. + * Otherwise, this would lead to false feature count if + * an existing project is open at a restrictive extent. + */ + if ( mFeaturesCounted > 0 && mFeaturesCounted < fetched ) + { + QgsDebugMsgLevel( QStringLiteral( "feature count adjusted from %1 to %2" ).arg( mFeaturesCounted ).arg( fetched ), 2 ); + mFeaturesCounted = fetched; + } +} + +long long QgsPostgresSharedData::featuresCounted() +{ + QMutexLocker locker( &mMutex ); + return mFeaturesCounted; +} + +void QgsPostgresSharedData::setFeaturesCounted( long long count ) +{ + QMutexLocker locker( &mMutex ); + mFeaturesCounted = count; +} + + +QgsFeatureId QgsPostgresSharedData::lookupFid( const QVariantList &v ) +{ + QMutexLocker locker( &mMutex ); + + QMap::const_iterator it = mKeyToFid.constFind( v ); + + if ( it != mKeyToFid.constEnd() ) + { + return it.value(); + } + + mFidToKey.insert( ++mFidCounter, v ); + mKeyToFid.insert( v, mFidCounter ); + + return mFidCounter; +} + + +QVariantList QgsPostgresSharedData::removeFid( QgsFeatureId fid ) +{ + QMutexLocker locker( &mMutex ); + + QVariantList v = mFidToKey[fid]; + mFidToKey.remove( fid ); + mKeyToFid.remove( v ); + return v; +} + +void QgsPostgresSharedData::insertFid( QgsFeatureId fid, const QVariantList &k ) +{ + QMutexLocker locker( &mMutex ); + + mFidToKey.insert( fid, k ); + mKeyToFid.insert( k, fid ); +} + +QVariantList QgsPostgresSharedData::lookupKey( QgsFeatureId featureId ) +{ + QMutexLocker locker( &mMutex ); + + QMap::const_iterator it = mFidToKey.constFind( featureId ); + if ( it != mFidToKey.constEnd() ) + return it.value(); + return QVariantList(); +} + +void QgsPostgresSharedData::clear() +{ + QMutexLocker locker( &mMutex ); + mFidToKey.clear(); + mKeyToFid.clear(); + mFeaturesCounted = -1; + mFidCounter = 0; +} + +void QgsPostgresSharedData::clearSupportsEnumValuesCache() +{ + QMutexLocker locker( &mMutex ); + mFieldSupportsEnumValues.clear(); +} + +bool QgsPostgresSharedData::fieldSupportsEnumValuesIsSet( int index ) +{ + QMutexLocker locker( &mMutex ); + return mFieldSupportsEnumValues.contains( index ); +} + +bool QgsPostgresSharedData::fieldSupportsEnumValues( int index ) +{ + QMutexLocker locker( &mMutex ); + return mFieldSupportsEnumValues.contains( index ) && mFieldSupportsEnumValues[index]; +} + +void QgsPostgresSharedData::setFieldSupportsEnumValues( int index, bool isSupported ) +{ + QMutexLocker locker( &mMutex ); + mFieldSupportsEnumValues[index] = isSupported; +} + +// ---------- + +QString QgsPostgresUtils::whereClause( QgsFeatureId featureId, const QgsFields &fields, QgsPostgresConn *conn, QgsPostgresPrimaryKeyType pkType, const QList &pkAttrs, const std::shared_ptr &sharedData ) +{ + QString whereClause; + + switch ( pkType ) + { + case PktTid: + whereClause = QStringLiteral( "ctid='(%1,%2)'" ) + .arg( FID_TO_NUMBER( featureId ) >> 16 ) + .arg( FID_TO_NUMBER( featureId ) & 0xffff ); + break; + + case PktOid: + whereClause = QStringLiteral( "oid=%1" ).arg( featureId ); + break; + + case PktInt: + Q_ASSERT( pkAttrs.size() == 1 ); + whereClause = QStringLiteral( "%1=%2" ).arg( QgsPostgresConn::quotedIdentifier( fields.at( pkAttrs[0] ).name() ) ).arg( QgsPostgresUtils::fid_to_int32pk( featureId ) ); + break; + + case PktInt64: + case PktUint64: + { + Q_ASSERT( pkAttrs.size() == 1 ); + QVariantList pkVals = sharedData->lookupKey( featureId ); + if ( !pkVals.isEmpty() ) + { + QgsField fld = fields.at( pkAttrs[0] ); + whereClause = conn->fieldExpression( fld ); + if ( !QgsVariantUtils::isNull( pkVals[0] ) ) + whereClause += '=' + pkVals[0].toString(); + else + whereClause += QLatin1String( " IS NULL" ); + } + } + break; + + case PktFidMap: + { + QVariantList pkVals = sharedData->lookupKey( featureId ); + if ( !pkVals.isEmpty() ) + { + Q_ASSERT( pkVals.size() == pkAttrs.size() ); + + QString delim; + for ( int i = 0; i < pkAttrs.size(); i++ ) + { + int idx = pkAttrs[i]; + QgsField fld = fields.at( idx ); + + whereClause += delim + conn->fieldExpressionForWhereClause( fld, static_cast( pkVals[i].userType() ) ); + if ( QgsVariantUtils::isNull( pkVals[i] ) ) + whereClause += QLatin1String( " IS NULL" ); + else + whereClause += '=' + QgsPostgresConn::quotedValue( pkVals[i] ); // remove toString as it must be handled by quotedValue function + + delim = QStringLiteral( " AND " ); + } + } + else + { + QgsDebugError( QStringLiteral( "FAILURE: Key values for feature %1 not found." ).arg( featureId ) ); + whereClause = QStringLiteral( "NULL" ); + } + } + break; + + case PktUnknown: + Q_ASSERT( !"FAILURE: Primary key unknown" ); + whereClause = QStringLiteral( "NULL" ); + break; + } + + return whereClause; +} + +QString QgsPostgresUtils::whereClause( const QgsFeatureIds &featureIds, const QgsFields &fields, QgsPostgresConn *conn, QgsPostgresPrimaryKeyType pkType, const QList &pkAttrs, const std::shared_ptr &sharedData ) +{ + auto lookupKeyWhereClause = [=] { + if ( featureIds.isEmpty() ) + return QString(); + + //simple primary key, so prefer to use an "IN (...)" query. These are much faster then multiple chained ...OR... clauses + QString delim; + QString expr = QStringLiteral( "%1 IN (" ).arg( QgsPostgresConn::quotedIdentifier( fields.at( pkAttrs[0] ).name() ) ); + + for ( const QgsFeatureId featureId : std::as_const( featureIds ) ) + { + const QVariantList pkVals = sharedData->lookupKey( featureId ); + if ( !pkVals.isEmpty() ) + { + expr += delim + QgsPostgresConn::quotedValue( pkVals.at( 0 ) ); + delim = ','; + } + } + expr += ')'; + + return expr; + }; + + switch ( pkType ) + { + case PktOid: + case PktInt: + { + QString expr; + + //simple primary key, so prefer to use an "IN (...)" query. These are much faster then multiple chained ...OR... clauses + if ( !featureIds.isEmpty() ) + { + QString delim; + expr = QStringLiteral( "%1 IN (" ).arg( ( pkType == PktOid ? QStringLiteral( "oid" ) : QgsPostgresConn::quotedIdentifier( fields.at( pkAttrs[0] ).name() ) ) ); + + for ( const QgsFeatureId featureId : std::as_const( featureIds ) ) + { + expr += delim + FID_TO_STRING( ( pkType == PktOid ? featureId : QgsPostgresUtils::fid_to_int32pk( featureId ) ) ); + delim = ','; + } + expr += ')'; + } + + return expr; + } + case PktInt64: + case PktUint64: + return lookupKeyWhereClause(); + + case PktFidMap: + case PktTid: + case PktUnknown: + { + // on simple string primary key we can use IN + if ( pkType == PktFidMap && pkAttrs.count() == 1 && fields.at( pkAttrs[0] ).type() == QMetaType::Type::QString ) + return lookupKeyWhereClause(); + + //complex primary key, need to build up where string + QStringList whereClauses; + for ( const QgsFeatureId featureId : std::as_const( featureIds ) ) + { + whereClauses << whereClause( featureId, fields, conn, pkType, pkAttrs, sharedData ); + } + return whereClauses.isEmpty() ? QString() : whereClauses.join( QLatin1String( " OR " ) ).prepend( '(' ).append( ')' ); + } + } + return QString(); //avoid warning +} + +QString QgsPostgresUtils::andWhereClauses( const QString &c1, const QString &c2 ) +{ + if ( c1.isEmpty() ) + return c2; + if ( c2.isEmpty() ) + return c1; + + return QStringLiteral( "(%1) AND (%2)" ).arg( c1, c2 ); +} + +void QgsPostgresUtils::replaceInvalidXmlChars( QString &xml ) +{ + static const QRegularExpression replaceRe { QStringLiteral( "([\\x00-\\x08\\x0B-\\x1F\\x7F])" ) }; + QRegularExpressionMatchIterator it { replaceRe.globalMatch( xml ) }; + while ( it.hasNext() ) + { + const QRegularExpressionMatch match { it.next() }; + const QChar c { match.captured( 1 ).at( 0 ) }; + xml.replace( c, QStringLiteral( "UTF-8[%1]" ).arg( c.unicode() ) ); + } +} + +void QgsPostgresUtils::restoreInvalidXmlChars( QString &xml ) +{ + static const QRegularExpression replaceRe { QStringLiteral( R"raw(UTF-8\[(\d+)\])raw" ) }; + QRegularExpressionMatchIterator it { replaceRe.globalMatch( xml ) }; + while ( it.hasNext() ) + { + const QRegularExpressionMatch match { it.next() }; + bool ok; + const ushort code { match.captured( 1 ).toUShort( &ok ) }; + if ( ok ) + { + xml.replace( QStringLiteral( "UTF-8[%1]" ).arg( code ), QChar( code ) ); + } + } +} + +bool QgsPostgresUtils::deleteLayer( const QString &uri, QString &errCause ) +{ + QgsDebugMsgLevel( "deleting layer " + uri, 2 ); + + QgsDataSourceUri dsUri( uri ); + QString schemaName = dsUri.schema(); + QString tableName = dsUri.table(); + QString geometryCol = dsUri.geometryColumn(); + + QString schemaTableName; + if ( !schemaName.isEmpty() ) + { + schemaTableName = QgsPostgresConn::quotedIdentifier( schemaName ) + '.'; + } + schemaTableName += QgsPostgresConn::quotedIdentifier( tableName ); + + QgsPostgresConn *conn = QgsPostgresConn::connectDb( dsUri, false ); + if ( !conn ) + { + errCause = QObject::tr( "Connection to database failed" ); + return false; + } + + // handle deletion of views + QString sqlViewCheck = QStringLiteral( "SELECT relkind FROM pg_class WHERE oid=regclass(%1)::oid" ) + .arg( QgsPostgresConn::quotedValue( schemaTableName ) ); + QgsPostgresResult resViewCheck( conn->LoggedPQexec( "QgsPostgresUtils", sqlViewCheck ) ); + const QString type = resViewCheck.PQgetvalue( 0, 0 ); + const Qgis::PostgresRelKind relKind = QgsPostgresConn::relKindFromValue( type ); + + switch ( relKind ) + { + case Qgis::PostgresRelKind::View: + case Qgis::PostgresRelKind::MaterializedView: + { + QString sql = QStringLiteral( "DROP %1VIEW %2" ).arg( type == QLatin1String( "m" ) ? QStringLiteral( "MATERIALIZED " ) : QString(), schemaTableName ); + QgsPostgresResult result( conn->LoggedPQexec( "QgsPostgresUtils", sql ) ); + if ( result.PQresultStatus() != PGRES_COMMAND_OK ) + { + errCause = QObject::tr( "Unable to delete view %1: \n%2" ) + .arg( schemaTableName, result.PQresultErrorMessage() ); + conn->unref(); + return false; + } + conn->unref(); + return true; + } + + case Qgis::PostgresRelKind::NotSet: + case Qgis::PostgresRelKind::Unknown: + case Qgis::PostgresRelKind::OrdinaryTable: + case Qgis::PostgresRelKind::Index: + case Qgis::PostgresRelKind::Sequence: + case Qgis::PostgresRelKind::CompositeType: + case Qgis::PostgresRelKind::ToastTable: + case Qgis::PostgresRelKind::ForeignTable: + case Qgis::PostgresRelKind::PartitionedTable: + { + // TODO -- this logic is being applied to a whole bunch + // of potentially non-table items, eg indexes and sequences. + // These should have special handling! + + // check the geometry column count + QString sql = QString( "SELECT count(*) " + "FROM geometry_columns, pg_class, pg_namespace " + "WHERE f_table_name=relname AND f_table_schema=nspname " + "AND pg_class.relnamespace=pg_namespace.oid " + "AND f_table_schema=%1 AND f_table_name=%2" ) + .arg( QgsPostgresConn::quotedValue( schemaName ), QgsPostgresConn::quotedValue( tableName ) ); + QgsPostgresResult result( conn->LoggedPQexec( "QgsPostgresUtils", sql ) ); + if ( result.PQresultStatus() != PGRES_TUPLES_OK ) + { + errCause = QObject::tr( "Unable to delete layer %1: \n%2" ) + .arg( schemaTableName, result.PQresultErrorMessage() ); + conn->unref(); + return false; + } + + int count = result.PQgetvalue( 0, 0 ).toInt(); + + if ( !geometryCol.isEmpty() && count > 1 ) + { + // the table has more geometry columns, drop just the geometry column + sql = QStringLiteral( "SELECT DropGeometryColumn(%1,%2,%3)" ) + .arg( QgsPostgresConn::quotedValue( schemaName ), QgsPostgresConn::quotedValue( tableName ), QgsPostgresConn::quotedValue( geometryCol ) ); + } + else + { + // drop the table + sql = QStringLiteral( "SELECT DropGeometryTable(%1,%2)" ) + .arg( QgsPostgresConn::quotedValue( schemaName ), QgsPostgresConn::quotedValue( tableName ) ); + } + + result = conn->LoggedPQexec( "QgsPostgresUtils", sql ); + if ( result.PQresultStatus() != PGRES_TUPLES_OK ) + { + errCause = QObject::tr( "Unable to delete layer %1: \n%2" ) + .arg( schemaTableName, result.PQresultErrorMessage() ); + conn->unref(); + return false; + } + + conn->unref(); + return true; + } + } + BUILTIN_UNREACHABLE +} + +bool QgsPostgresUtils::deleteSchema( const QString &schema, const QgsDataSourceUri &uri, QString &errCause, bool cascade ) +{ + QgsDebugMsgLevel( "deleting schema " + schema, 2 ); + + if ( schema.isEmpty() ) + return false; + + QString schemaName = QgsPostgresConn::quotedIdentifier( schema ); + + QgsPostgresConn *conn = QgsPostgresConn::connectDb( uri, false ); + if ( !conn ) + { + errCause = QObject::tr( "Connection to database failed" ); + return false; + } + + // drop the schema + QString sql = QStringLiteral( "DROP SCHEMA %1 %2" ) + .arg( schemaName, cascade ? QStringLiteral( "CASCADE" ) : QString() ); + + QgsPostgresResult result( conn->LoggedPQexec( "QgsPostgresUtils", sql ) ); + if ( result.PQresultStatus() != PGRES_COMMAND_OK ) + { + errCause = QObject::tr( "Unable to delete schema %1: \n%2" ) + .arg( schemaName, result.PQresultErrorMessage() ); + conn->unref(); + return false; + } + + conn->unref(); + return true; +} + +bool QgsPostgresUtils::tableExists( QgsPostgresConn *conn, const QString &name ) +{ + QgsPostgresResult res( conn->LoggedPQexec( QStringLiteral( "tableExists" ), "SELECT EXISTS ( SELECT oid FROM pg_catalog.pg_class WHERE relname=" + QgsPostgresConn::quotedValue( name ) + ")" ) ); + return res.PQgetvalue( 0, 0 ).startsWith( 't' ); +} + +bool QgsPostgresUtils::columnExists( QgsPostgresConn *conn, const QString &table, const QString &column ) +{ + QgsPostgresResult res( conn->LoggedPQexec( QStringLiteral( "columnExists" ), "SELECT COUNT(*) FROM information_schema.columns WHERE table_name=" + QgsPostgresConn::quotedValue( table ) + " and column_name=" + QgsPostgresConn::quotedValue( column ) ) ); + return res.PQgetvalue( 0, 0 ).toInt() > 0; +} + +bool QgsPostgresUtils::createStylesTable( QgsPostgresConn *conn, QString loggedClass ) +{ + QgsPostgresResult res( conn->LoggedPQexec( loggedClass, "CREATE TABLE layer_styles(" + "id SERIAL PRIMARY KEY" + ",f_table_catalog varchar" + ",f_table_schema varchar" + ",f_table_name varchar" + ",f_geometry_column varchar" + ",styleName text" + ",styleQML xml" + ",styleSLD xml" + ",useAsDefault boolean" + ",description text" + ",owner varchar(63) DEFAULT CURRENT_USER" + ",ui xml" + ",update_time timestamp DEFAULT CURRENT_TIMESTAMP" + ",type varchar" + ",r_raster_column varchar" + ")" ) ); + + return res.PQresultStatus() == PGRES_COMMAND_OK; +} diff --git a/src/providers/postgres/qgspostgresutils.h b/src/providers/postgres/qgspostgresutils.h new file mode 100644 index 000000000000..465a0229aeb8 --- /dev/null +++ b/src/providers/postgres/qgspostgresutils.h @@ -0,0 +1,102 @@ +/*************************************************************************** + qgspostgresutils.h - Utils for PostgreSQL/PostGIS + ------------------- + begin : Jan 2, 2004 + copyright : (C) 2003 by Gary E.Sherman + email : sherman at mrcc.com + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef QGSPOSTGRESUTILS_H +#define QGSPOSTGRESUTILS_H + +#include "qgspostgresconn.h" + +/** + * Data shared between provider class and its feature sources. Ideally there should + * be as few members as possible because there could be simultaneous reads/writes + * from different threads and therefore locking has to be involved. +*/ +class QgsPostgresSharedData +{ + public: + QgsPostgresSharedData() = default; + + long long featuresCounted(); + void setFeaturesCounted( long long count ); + void addFeaturesCounted( long long diff ); + void ensureFeaturesCountedAtLeast( long long fetched ); + + // FID lookups + QgsFeatureId lookupFid( const QVariantList &v ); // lookup existing mapping or add a new one + QVariantList removeFid( QgsFeatureId fid ); + void insertFid( QgsFeatureId fid, const QVariantList &k ); + QVariantList lookupKey( QgsFeatureId featureId ); + void clear(); + + void clearSupportsEnumValuesCache(); + bool fieldSupportsEnumValuesIsSet( int index ); + bool fieldSupportsEnumValues( int index ); + void setFieldSupportsEnumValues( int index, bool isSupported ); + + protected: + QMutex mMutex; //!< Access to all data members is guarded by the mutex + + long long mFeaturesCounted = -1; //!< Number of features in the layer + + QgsFeatureId mFidCounter = 0; // next feature id if map is used + QMap mKeyToFid; // map key values to feature id + QMap mFidToKey; // map feature id back to key values + QMap mFieldSupportsEnumValues; // map field index to bool flag supports enum values +}; + +//! Assorted Postgres utility functions +class QgsPostgresUtils +{ + public: + static bool deleteLayer( const QString &uri, QString &errCause ); + static bool deleteSchema( const QString &schema, const QgsDataSourceUri &uri, QString &errCause, bool cascade = false ); + + static QString whereClause( QgsFeatureId featureId, const QgsFields &fields, QgsPostgresConn *conn, QgsPostgresPrimaryKeyType pkType, const QList &pkAttrs, const std::shared_ptr &sharedData ); + + static QString whereClause( const QgsFeatureIds &featureIds, const QgsFields &fields, QgsPostgresConn *conn, QgsPostgresPrimaryKeyType pkType, const QList &pkAttrs, const std::shared_ptr &sharedData ); + + static QString andWhereClauses( const QString &c1, const QString &c2 ); + + static const qint64 INT32PK_OFFSET = 4294967296; // 2^32 + + // We shift negative 32bit integers to above the max 32bit + // positive integer to support the whole range of int32 values + // See https://github.com/qgis/QGIS/issues/22258 + static qint64 int32pk_to_fid( qint32 x ) + { + return x >= 0 ? x : x + INT32PK_OFFSET; + } + + static qint32 fid_to_int32pk( qint64 x ) + { + return x <= ( ( INT32PK_OFFSET ) / 2.0 ) ? x : -( INT32PK_OFFSET - x ); + } + + //! Replaces invalid XML chars with UTF-8[] + static void replaceInvalidXmlChars( QString &xml ); + + //! Replaces UTF-8[] with the actual unicode char + static void restoreInvalidXmlChars( QString &xml ); + + static bool createStylesTable( QgsPostgresConn *conn, QString loggedClass ); + + static bool columnExists( QgsPostgresConn *conn, const QString &table, const QString &column ); + + static bool tableExists( QgsPostgresConn *conn, const QString &name ); +}; + +#endif diff --git a/src/providers/postgres/raster/qgspostgresrasterprovider.cpp b/src/providers/postgres/raster/qgspostgresrasterprovider.cpp index 071cd6b3a3b6..952abfa9b77d 100644 --- a/src/providers/postgres/raster/qgspostgresrasterprovider.cpp +++ b/src/providers/postgres/raster/qgspostgresrasterprovider.cpp @@ -25,13 +25,13 @@ #include "qgsstringutils.h" #include "qgsapplication.h" #include "qgsraster.h" +#include "qgspostgresutils.h" #include const QString QgsPostgresRasterProvider::PG_RASTER_PROVIDER_KEY = QStringLiteral( "postgresraster" ); const QString QgsPostgresRasterProvider::PG_RASTER_PROVIDER_DESCRIPTION = QStringLiteral( "Postgres raster provider" ); - QgsPostgresRasterProvider::QgsPostgresRasterProvider( const QString &uri, const QgsDataProvider::ProviderOptions &providerOptions, Qgis::DataProviderReadFlags flags ) : QgsRasterDataProvider( uri, providerOptions, flags ) , mShared( new QgsPostgresRasterSharedData ) @@ -2447,3 +2447,473 @@ QgsLayerMetadata QgsPostgresRasterProvider::layerMetadata() const { return mLayerMetadata; } + +Qgis::ProviderStyleStorageCapabilities QgsPostgresRasterProvider::styleStorageCapabilities() const +{ + Qgis::ProviderStyleStorageCapabilities storageCapabilities; + if ( isValid() ) + { + storageCapabilities |= Qgis::ProviderStyleStorageCapability::SaveToDatabase; + storageCapabilities |= Qgis::ProviderStyleStorageCapability::LoadFromDatabase; + storageCapabilities |= Qgis::ProviderStyleStorageCapability::DeleteFromDatabase; + } + return storageCapabilities; +} + + +bool QgsPostgresRasterProviderMetadata::styleExists( const QString &uri, const QString &styleId, QString &errorCause ) +{ + errorCause.clear(); + + QgsDataSourceUri dsUri( uri ); + QgsPostgresConn *conn = QgsPostgresConn::connectDb( dsUri, true ); + if ( !conn ) + { + errorCause = QObject::tr( "Connection to database failed" ); + return false; + } + + if ( !QgsPostgresUtils::tableExists( conn, QStringLiteral( "layer_styles" ) ) || !QgsPostgresUtils::columnExists( conn, QStringLiteral( "layer_styles" ), QStringLiteral( "type" ) ) || !QgsPostgresUtils::columnExists( conn, QStringLiteral( "layer_styles" ), QStringLiteral( "r_raster_column" ) ) ) + { + return false; + } + + if ( dsUri.database().isEmpty() ) // typically when a service file is used + { + dsUri.setDatabase( conn->currentDatabase() ); + } + + const QString checkQuery = QString( "SELECT styleName" + " FROM layer_styles" + " WHERE f_table_catalog=%1" + " AND f_table_schema=%2" + " AND f_table_name=%3" + " AND f_geometry_column IS NULL" + " AND (type=%4 OR type IS NULL)" + " AND styleName=%5" + " AND r_raster_column %6" ) + .arg( QgsPostgresConn::quotedValue( dsUri.database() ) ) + .arg( QgsPostgresConn::quotedValue( dsUri.schema() ) ) + .arg( QgsPostgresConn::quotedValue( dsUri.table() ) ) + .arg( QgsPostgresConn::quotedValue( mType ) ) + .arg( QgsPostgresConn::quotedValue( styleId.isEmpty() ? dsUri.table() : styleId ) ) + .arg( dsUri.geometryColumn().isEmpty() ? QStringLiteral( "IS NULL" ) : QStringLiteral( "= %1" ).arg( QgsPostgresConn::quotedValue( dsUri.geometryColumn() ) ) ); + + QgsPostgresResult res( conn->LoggedPQexec( QStringLiteral( "QgsPostgresRasterProviderMetadata" ), checkQuery ) ); + if ( res.PQresultStatus() == PGRES_TUPLES_OK ) + { + return res.PQntuples() > 0; + } + else + { + errorCause = res.PQresultErrorMessage(); + return false; + } +} + +bool QgsPostgresRasterProviderMetadata::saveStyle( const QString &uri, const QString &qmlStyleIn, const QString &sldStyleIn, const QString &styleName, const QString &styleDescription, const QString &uiFileContent, bool useAsDefault, QString &errCause ) +{ + QgsDataSourceUri dsUri( uri ); + + // Replace invalid XML characters + QString qmlStyle { qmlStyleIn }; + QgsPostgresUtils::replaceInvalidXmlChars( qmlStyle ); + QString sldStyle { sldStyleIn }; + QgsPostgresUtils::replaceInvalidXmlChars( sldStyle ); + + QgsPostgresConn *conn = QgsPostgresConn::connectDb( dsUri, false ); + if ( !conn ) + { + errCause = QObject::tr( "Connection to database failed" ); + return false; + } + + if ( !QgsPostgresUtils::tableExists( conn, QStringLiteral( "layer_styles" ) ) ) + { + if ( !QgsPostgresUtils::createStylesTable( conn, QStringLiteral( "QgsPostgresRasterProviderMetadata" ) ) ) + { + errCause = QObject::tr( "Unable to save layer style. It's not possible to create the destination table on the database. Maybe this is due to table permissions (user=%1). Please contact your database admin" ).arg( dsUri.username() ); + conn->unref(); + return false; + } + } + else + { + if ( !QgsPostgresUtils::columnExists( conn, QStringLiteral( "layer_styles" ), QStringLiteral( "type" ) ) ) + { + QgsPostgresResult res( conn->LoggedPQexec( QStringLiteral( "QgsPostgresRasterProviderMetadata" ), "ALTER TABLE layer_styles ADD COLUMN type varchar NULL" ) ); + if ( res.PQresultStatus() != PGRES_COMMAND_OK ) + { + errCause = QObject::tr( "Unable to add column type to layer_styles table. Maybe this is due to table permissions (user=%1). Please contact your database admin" ).arg( dsUri.username() ); + conn->unref(); + return false; + } + } + } + + if ( !QgsPostgresUtils::columnExists( conn, QStringLiteral( "layer_styles" ), QStringLiteral( "r_raster_column" ) ) ) + { + QgsPostgresResult res( conn->LoggedPQexec( QStringLiteral( "QgsPostgresRasterProviderMetadata" ), "ALTER TABLE layer_styles ADD COLUMN r_raster_column varchar NULL" ) ); + if ( res.PQresultStatus() != PGRES_COMMAND_OK ) + { + errCause = QObject::tr( "Unable to add column r_raster_column to layer_styles table. Maybe this is due to table permissions (user=%1). Please contact your database admin" ).arg( dsUri.username() ); + conn->unref(); + return false; + } + } + + if ( dsUri.database().isEmpty() ) // typically when a service file is used + { + dsUri.setDatabase( conn->currentDatabase() ); + } + + QString uiFileColumn; + QString uiFileValue; + if ( !uiFileContent.isEmpty() ) + { + uiFileColumn = QStringLiteral( ",ui" ); + uiFileValue = QStringLiteral( ",XMLPARSE(DOCUMENT %1)" ).arg( QgsPostgresConn::quotedValue( uiFileContent ) ); + } + + // Note: in the construction of the INSERT and UPDATE strings the qmlStyle and sldStyle values + // can contain user entered strings, which may themselves include %## values that would be + // replaced by the QString.arg function. To ensure that the final SQL string is not corrupt these + // two values are both replaced in the final .arg call of the string construction. + + QString sql = QString( "INSERT INTO layer_styles(" + "f_table_catalog,f_table_schema,f_table_name,f_geometry_column,styleName,styleQML,styleSLD,useAsDefault,description,owner,type%12,r_raster_column" + ") VALUES (" + "%1,%2,%3,%4,%5,XMLPARSE(DOCUMENT %16),XMLPARSE(DOCUMENT %17),%8,%9,%10,%11%13,%14" + ")" ) + .arg( QgsPostgresConn::quotedValue( dsUri.database() ) ) + .arg( QgsPostgresConn::quotedValue( dsUri.schema() ) ) + .arg( QgsPostgresConn::quotedValue( dsUri.table() ) ) + .arg( QLatin1String( "NULL" ) ) + .arg( QgsPostgresConn::quotedValue( styleName.isEmpty() ? dsUri.table() : styleName ) ) + .arg( useAsDefault ? "true" : "false" ) + .arg( QgsPostgresConn::quotedValue( styleDescription.isEmpty() ? QDateTime::currentDateTime().toString() : styleDescription ) ) + .arg( "CURRENT_USER" ) + .arg( uiFileColumn ) + .arg( uiFileValue ) + .arg( QgsPostgresConn::quotedValue( mType ) ) + .arg( QgsPostgresConn::quotedValue( dsUri.geometryColumn() ) ) + // Must be the final .arg replacement - see above + .arg( QgsPostgresConn::quotedValue( qmlStyle ), QgsPostgresConn::quotedValue( sldStyle ) ); + + + QString checkQuery = QString( "SELECT styleName" + " FROM layer_styles" + " WHERE f_table_catalog=%1" + " AND f_table_schema=%2" + " AND f_table_name=%3" + " AND f_geometry_column IS NULL" + " AND (type=%4 OR type IS NULL)" + " AND styleName=%5" + " AND r_raster_column %6" ) + .arg( QgsPostgresConn::quotedValue( dsUri.database() ) ) + .arg( QgsPostgresConn::quotedValue( dsUri.schema() ) ) + .arg( QgsPostgresConn::quotedValue( dsUri.table() ) ) + .arg( QgsPostgresConn::quotedValue( mType ) ) + .arg( QgsPostgresConn::quotedValue( styleName.isEmpty() ? dsUri.table() : styleName ) ) + .arg( dsUri.geometryColumn().isEmpty() ? QStringLiteral( "IS NULL" ) : QStringLiteral( "= %1" ).arg( QgsPostgresConn::quotedValue( dsUri.geometryColumn() ) ) ); + + QgsPostgresResult res( conn->LoggedPQexec( "QgsPostgresRasterProviderMetadata", checkQuery ) ); + if ( res.PQntuples() > 0 ) + { + sql = QString( "UPDATE layer_styles" + " SET useAsDefault=%1" + ",styleQML=XMLPARSE(DOCUMENT %12)" + ",styleSLD=XMLPARSE(DOCUMENT %13)" + ",description=%4" + ",owner=%5" + ",type=%2" + " WHERE f_table_catalog=%6" + " AND f_table_schema=%7" + " AND f_table_name=%8" + " AND f_geometry_column IS NULL" + " AND styleName=%9" + " AND (type=%2 OR type IS NULL)" + " AND r_raster_column %14" ) + .arg( useAsDefault ? "true" : "false" ) + .arg( QgsPostgresConn::quotedValue( mType ) ) + .arg( QgsPostgresConn::quotedValue( styleDescription.isEmpty() ? QDateTime::currentDateTime().toString() : styleDescription ) ) + .arg( "CURRENT_USER" ) + .arg( QgsPostgresConn::quotedValue( dsUri.database() ) ) + .arg( QgsPostgresConn::quotedValue( dsUri.schema() ) ) + .arg( QgsPostgresConn::quotedValue( dsUri.table() ) ) + .arg( QgsPostgresConn::quotedValue( styleName.isEmpty() ? dsUri.table() : styleName ) ) + // Must be the final .arg replacement - see above + .arg( QgsPostgresConn::quotedValue( qmlStyle ), QgsPostgresConn::quotedValue( sldStyle ) ) + .arg( dsUri.geometryColumn().isEmpty() ? QStringLiteral( "IS NULL" ) : QStringLiteral( "= %1" ).arg( QgsPostgresConn::quotedValue( dsUri.geometryColumn() ) ) ); + } + + if ( useAsDefault ) + { + QString removeDefaultSql = QString( "UPDATE layer_styles" + " SET useAsDefault=false" + " WHERE f_table_catalog=%1" + " AND f_table_schema=%2" + " AND f_table_name=%3" + " AND f_geometry_column IS NULL" + " AND (type=%4 OR type IS NULL)" + " AND r_raster_column %5" ) + .arg( QgsPostgresConn::quotedValue( dsUri.database() ) ) + .arg( QgsPostgresConn::quotedValue( dsUri.schema() ) ) + .arg( QgsPostgresConn::quotedValue( dsUri.table() ) ) + .arg( QgsPostgresConn::quotedValue( mType ) ) + .arg( dsUri.geometryColumn().isEmpty() ? QStringLiteral( "IS NULL" ) : QStringLiteral( "= %1" ).arg( QgsPostgresConn::quotedValue( dsUri.geometryColumn() ) ) ); + + sql = QStringLiteral( "BEGIN; %1; %2; COMMIT;" ).arg( removeDefaultSql, sql ); + } + + res = conn->LoggedPQexec( "QgsPostgresRasterProviderMetadata", sql ); + + bool saved = res.PQresultStatus() == PGRES_COMMAND_OK; + if ( !saved ) + errCause = QObject::tr( "Unable to save layer style. It's not possible to insert a new record into the style table. Maybe this is due to table permissions (user=%1). Please contact your database administrator." ).arg( dsUri.username() ); + + conn->unref(); + + return saved; +} + + +QString QgsPostgresRasterProviderMetadata::loadStyle( const QString &uri, QString &errCause ) +{ + QString styleName; + return loadStoredStyle( uri, styleName, errCause ); +} + +QString QgsPostgresRasterProviderMetadata::loadStoredStyle( const QString &uri, QString &styleName, QString &errCause ) +{ + QgsDataSourceUri dsUri( uri ); + QString selectQmlQuery; + + QgsPostgresConn *conn = QgsPostgresConn::connectDb( dsUri, true ); + if ( !conn ) + { + errCause = QObject::tr( "Connection to database failed" ); + return QString(); + } + + if ( dsUri.database().isEmpty() ) // typically when a service file is used + { + dsUri.setDatabase( conn->currentDatabase() ); + } + + if ( !QgsPostgresUtils::tableExists( conn, QStringLiteral( "layer_styles" ) ) ) + { + conn->unref(); + return QString(); + } + else if ( !QgsPostgresUtils::columnExists( conn, QStringLiteral( "layer_styles" ), QStringLiteral( "r_raster_column" ) ) ) + { + return QString(); + } + + // support layer_styles without type column < 3.14 + if ( !QgsPostgresUtils::columnExists( conn, QStringLiteral( "layer_styles" ), QStringLiteral( "type" ) ) ) + { + selectQmlQuery = QString( "SELECT styleName, styleQML" + " FROM layer_styles" + " WHERE f_table_catalog=%1" + " AND f_table_schema=%2" + " AND f_table_name=%3" + " AND f_geometry_column IS NULL" + " AND r_raster_column %4" + " ORDER BY CASE WHEN useAsDefault THEN 1 ELSE 2 END" + ",update_time DESC LIMIT 1" ) + .arg( QgsPostgresConn::quotedValue( dsUri.database() ) ) + .arg( QgsPostgresConn::quotedValue( dsUri.schema() ) ) + .arg( QgsPostgresConn::quotedValue( dsUri.table() ) ) + .arg( dsUri.geometryColumn().isEmpty() ? QStringLiteral( "IS NULL" ) : QStringLiteral( "= %1" ).arg( QgsPostgresConn::quotedValue( dsUri.geometryColumn() ) ) ); + } + else + { + selectQmlQuery = QString( "SELECT styleName, styleQML" + " FROM layer_styles" + " WHERE f_table_catalog=%1" + " AND f_table_schema=%2" + " AND f_table_name=%3" + " AND f_geometry_column IS NULL" + " AND (type=%4 OR type IS NULL)" + " AND r_raster_column %5" + " ORDER BY CASE WHEN useAsDefault THEN 1 ELSE 2 END" + ",update_time DESC LIMIT 1" ) + .arg( QgsPostgresConn::quotedValue( dsUri.database() ) ) + .arg( QgsPostgresConn::quotedValue( dsUri.schema() ) ) + .arg( QgsPostgresConn::quotedValue( dsUri.table() ) ) + .arg( QgsPostgresConn::quotedValue( mType ) ) + .arg( dsUri.geometryColumn().isEmpty() ? QStringLiteral( "IS NULL" ) : QStringLiteral( "= %1" ).arg( QgsPostgresConn::quotedValue( dsUri.geometryColumn() ) ) ); + } + + QgsPostgresResult result( conn->LoggedPQexec( QStringLiteral( "QgsPostgresRasterProviderMetadata" ), selectQmlQuery ) ); + + styleName = result.PQntuples() == 1 ? result.PQgetvalue( 0, 0 ) : QString(); + QString style = result.PQntuples() == 1 ? result.PQgetvalue( 0, 1 ) : QString(); + conn->unref(); + + QgsPostgresUtils::restoreInvalidXmlChars( style ); + + return style; +} + +int QgsPostgresRasterProviderMetadata::listStyles( const QString &uri, QStringList &ids, QStringList &names, QStringList &descriptions, QString &errCause ) +{ + errCause.clear(); + QgsDataSourceUri dsUri( uri ); + + QgsPostgresConn *conn = QgsPostgresConn::connectDb( dsUri, true ); + if ( !conn ) + { + errCause = QObject::tr( "Connection to database failed using username: %1" ).arg( dsUri.username() ); + return -1; + } + + if ( !QgsPostgresUtils::tableExists( conn, QStringLiteral( "layer_styles" ) ) ) + { + return -1; + } + + if ( !QgsPostgresUtils::columnExists( conn, QStringLiteral( "layer_styles" ), QStringLiteral( "r_raster_column" ) ) ) + { + return false; + } + + if ( dsUri.database().isEmpty() ) // typically when a service file is used + { + dsUri.setDatabase( conn->currentDatabase() ); + } + + QString selectRelatedQuery = QString( "SELECT id,styleName,description" + " FROM layer_styles" + " WHERE f_table_catalog=%1" + " AND f_table_schema=%2" + " AND f_table_name=%3" + " AND f_geometry_column is NULL" + " AND (type=%4 OR type IS NULL)" + " AND r_raster_column %5" + " ORDER BY useasdefault DESC, update_time DESC" ) + .arg( QgsPostgresConn::quotedValue( dsUri.database() ) ) + .arg( QgsPostgresConn::quotedValue( dsUri.schema() ) ) + .arg( QgsPostgresConn::quotedValue( dsUri.table() ) ) + .arg( QgsPostgresConn::quotedValue( mType ) ) + .arg( dsUri.geometryColumn().isEmpty() ? QStringLiteral( "IS NULL" ) : QStringLiteral( "= %1" ).arg( QgsPostgresConn::quotedValue( dsUri.geometryColumn() ) ) ); + + QgsPostgresResult result( conn->LoggedPQexec( QStringLiteral( "QgsPostgresRasterProviderMetadata" ), selectRelatedQuery ) ); + if ( result.PQresultStatus() != PGRES_TUPLES_OK ) + { + QgsMessageLog::logMessage( QObject::tr( "Error executing query: %1" ).arg( selectRelatedQuery ) ); + errCause = QObject::tr( "Error executing the select query for related styles. The query was logged" ); + conn->unref(); + return -1; + } + + int numberOfRelatedStyles = result.PQntuples(); + for ( int i = 0; i < numberOfRelatedStyles; i++ ) + { + ids.append( result.PQgetvalue( i, 0 ) ); + names.append( result.PQgetvalue( i, 1 ) ); + descriptions.append( result.PQgetvalue( i, 2 ) ); + } + + QString selectOthersQuery = QString( "SELECT id,styleName,description" + " FROM layer_styles" + " WHERE NOT (f_table_catalog=%1 AND f_table_schema=%2 AND f_table_name=%3 AND f_geometry_column IS NULL AND type=%4 AND r_raster_column=%5)" + " ORDER BY update_time DESC" ) + .arg( QgsPostgresConn::quotedValue( dsUri.database() ) ) + .arg( QgsPostgresConn::quotedValue( dsUri.schema() ) ) + .arg( QgsPostgresConn::quotedValue( dsUri.table() ) ) + .arg( QgsPostgresConn::quotedValue( mType ) ) + .arg( QgsPostgresConn::quotedValue( dsUri.geometryColumn() ) ); + + result = conn->LoggedPQexec( QStringLiteral( "QgsPostgresRasterProviderMetadata" ), selectOthersQuery ); + if ( result.PQresultStatus() != PGRES_TUPLES_OK ) + { + QgsMessageLog::logMessage( QObject::tr( "Error executing query: %1" ).arg( selectOthersQuery ) ); + errCause = QObject::tr( "Error executing the select query for unrelated styles. The query was logged" ); + conn->unref(); + return -1; + } + + for ( int i = 0; i < result.PQntuples(); i++ ) + { + ids.append( result.PQgetvalue( i, 0 ) ); + names.append( result.PQgetvalue( i, 1 ) ); + descriptions.append( result.PQgetvalue( i, 2 ) ); + } + + conn->unref(); + + return numberOfRelatedStyles; +} + +bool QgsPostgresRasterProviderMetadata::deleteStyleById( const QString &uri, const QString &styleId, QString &errCause ) +{ + QgsDataSourceUri dsUri( uri ); + bool deleted; + + QgsPostgresConn *conn = QgsPostgresConn::connectDb( dsUri, false ); + if ( !conn ) + { + errCause = QObject::tr( "Connection to database failed using username: %1" ).arg( dsUri.username() ); + deleted = false; + } + else + { + QString deleteStyleQuery = QStringLiteral( "DELETE FROM layer_styles WHERE id=%1" ).arg( QgsPostgresConn::quotedValue( styleId ) ); + QgsPostgresResult result( conn->LoggedPQexec( QStringLiteral( "QgsPostgresRasterProviderMetadata" ), deleteStyleQuery ) ); + if ( result.PQresultStatus() != PGRES_COMMAND_OK ) + { + QgsDebugError( + QString( "PQexec of this query returning != PGRES_COMMAND_OK (%1 != expected %2): %3" ) + .arg( result.PQresultStatus() ) + .arg( PGRES_COMMAND_OK ) + .arg( deleteStyleQuery ) + ); + QgsMessageLog::logMessage( QObject::tr( "Error executing query: %1" ).arg( deleteStyleQuery ) ); + errCause = QObject::tr( "Error executing the delete query. The query was logged" ); + deleted = false; + } + else + { + deleted = true; + } + conn->unref(); + } + return deleted; +} + +QString QgsPostgresRasterProviderMetadata::getStyleById( const QString &uri, const QString &styleId, QString &errCause ) +{ + QgsDataSourceUri dsUri( uri ); + + QgsPostgresConn *conn = QgsPostgresConn::connectDb( dsUri, true ); + if ( !conn ) + { + errCause = QObject::tr( "Connection to database failed using username: %1" ).arg( dsUri.username() ); + return QString(); + } + + QString style; + QString selectQmlQuery = QStringLiteral( "SELECT styleQml FROM layer_styles WHERE id=%1" ).arg( QgsPostgresConn::quotedValue( styleId ) ); + QgsPostgresResult result( conn->LoggedPQexec( QStringLiteral( "QgsPostgresRasterProviderMetadata" ), selectQmlQuery ) ); + if ( result.PQresultStatus() == PGRES_TUPLES_OK ) + { + if ( result.PQntuples() == 1 ) + style = result.PQgetvalue( 0, 0 ); + else + errCause = QObject::tr( "Consistency error in table '%1'. Style id should be unique" ).arg( QLatin1String( "layer_styles" ) ); + } + else + { + QgsMessageLog::logMessage( QObject::tr( "Error executing query: %1" ).arg( selectQmlQuery ) ); + errCause = QObject::tr( "Error executing the select query. The query was logged" ); + } + + conn->unref(); + + QgsPostgresUtils::restoreInvalidXmlChars( style ); + + return style; +} diff --git a/src/providers/postgres/raster/qgspostgresrasterprovider.h b/src/providers/postgres/raster/qgspostgresrasterprovider.h index 17673de36f5e..63de717e8d53 100644 --- a/src/providers/postgres/raster/qgspostgresrasterprovider.h +++ b/src/providers/postgres/raster/qgspostgresrasterprovider.h @@ -47,6 +47,7 @@ class QgsPostgresRasterProvider : public QgsRasterDataProvider virtual QString description() const override; bool readBlock( int bandNo, QgsRectangle const &viewExtent, int width, int height, void *data, QgsRasterBlockFeedback *feedback = nullptr ) override; + Qgis::ProviderStyleStorageCapabilities styleStorageCapabilities() const override; // QgsRasterInterface interface virtual Qgis::DataType dataType( int bandNo ) const override; @@ -263,6 +264,17 @@ class QgsPostgresRasterProviderMetadata : public QgsProviderMetadata QList supportedLayerTypes() const override; bool saveLayerMetadata( const QString &uri, const QgsLayerMetadata &metadata, QString &errorMessage ) override; QgsProviderMetadata::ProviderCapabilities providerCapabilities() const override; + + // These functions are very similar to functions in QgsPostgresProviderMetadata with some minor adjustments + bool styleExists( const QString &uri, const QString &styleId, QString &errorCause ) override; + bool saveStyle( const QString &uri, const QString &qmlStyle, const QString &sldStyle, const QString &styleName, const QString &styleDescription, const QString &uiFileContent, bool useAsDefault, QString &errCause ) override; + QString loadStyle( const QString &uri, QString &errCause ) override; + virtual QString loadStoredStyle( const QString &uri, QString &styleName, QString &errCause ) override; + int listStyles( const QString &uri, QStringList &ids, QStringList &names, QStringList &descriptions, QString &errCause ) override; + bool deleteStyleById( const QString &uri, const QString &styleId, QString &errCause ) override; + QString getStyleById( const QString &uri, const QString &styleId, QString &errCause ) override; + + const QString mType = "Raster"; }; diff --git a/src/providers/postgres/raster/qgspostgresrastershareddata.cpp b/src/providers/postgres/raster/qgspostgresrastershareddata.cpp index 4822a8fb9be1..bb4bddaabc79 100644 --- a/src/providers/postgres/raster/qgspostgresrastershareddata.cpp +++ b/src/providers/postgres/raster/qgspostgresrastershareddata.cpp @@ -253,7 +253,7 @@ bool QgsPostgresRasterSharedData::fetchTilesIndex( const QgsGeometry &requestPol overallExtent.combineExtentWith( extent ); - std::unique_ptr tile = std::make_unique( + auto tile = std::make_unique( tileId, srid, extent, @@ -332,7 +332,7 @@ QgsPostgresRasterSharedData::TilesResponse QgsPostgresRasterSharedData::fetchTil } const QgsRectangle extent( upperleftx, minY, upperleftx + tileWidth * scalex, maxY ); - std::unique_ptr tile = std::make_unique( + auto tile = std::make_unique( tileId, srid, extent, diff --git a/src/providers/spatialite/qgsspatialitedataitemguiprovider.cpp b/src/providers/spatialite/qgsspatialitedataitemguiprovider.cpp index 7251ab7648b9..1031e8e2724e 100644 --- a/src/providers/spatialite/qgsspatialitedataitemguiprovider.cpp +++ b/src/providers/spatialite/qgsspatialitedataitemguiprovider.cpp @@ -173,7 +173,7 @@ bool QgsSpatiaLiteDataItemGuiProvider::handleDropConnectionItem( QgsSLConnection destUri.setDataSource( QString(), u.name, srcLayer->geometryType() != Qgis::GeometryType::Null ? QStringLiteral( "geom" ) : QString() ); QgsDebugMsgLevel( "URI " + destUri.uri(), 2 ); - std::unique_ptr exportTask( new QgsVectorLayerExporterTask( srcLayer, destUri.uri(), QStringLiteral( "spatialite" ), srcLayer->crs(), QVariantMap(), owner ) ); + auto exportTask = std::make_unique( srcLayer, destUri.uri(), QStringLiteral( "spatialite" ), srcLayer->crs(), QVariantMap(), owner ); // when export is successful: connect( exportTask.get(), &QgsVectorLayerExporterTask::exportComplete, connItem, [=]() { diff --git a/src/providers/spatialite/qgsspatialiteproviderconnection.cpp b/src/providers/spatialite/qgsspatialiteproviderconnection.cpp index 075e285802e9..09a5aa9ebc45 100644 --- a/src/providers/spatialite/qgsspatialiteproviderconnection.cpp +++ b/src/providers/spatialite/qgsspatialiteproviderconnection.cpp @@ -134,7 +134,7 @@ QgsVectorLayer *QgsSpatiaLiteProviderConnection::createSqlVectorLayer( const Qgs QgsDataSourceUri tUri( uri() ); tUri.setSql( options.filter ); - tUri.setTable( '(' + options.sql + ')' ); + tUri.setTable( '(' + sanitizeSqlForQueryLayer( options.sql ) + ')' ); if ( !options.geometryColumn.isEmpty() ) { @@ -354,7 +354,7 @@ QList QgsSpatiaLiteProviderConne property.setTableName( tableName ); // Create a layer and get information from it // Use OGR because it's way faster - std::unique_ptr vl = std::make_unique( dsUri.database() + "|layername=" + dsUri.table(), QString(), QLatin1String( "ogr" ), QgsVectorLayer::LayerOptions( false, true ) ); + auto vl = std::make_unique( dsUri.database() + "|layername=" + dsUri.table(), QString(), QLatin1String( "ogr" ), QgsVectorLayer::LayerOptions( false, true ) ); if ( vl->isValid() ) { if ( vl->isSpatial() ) diff --git a/src/providers/virtual/qgsvirtuallayersourceselect.cpp b/src/providers/virtual/qgsvirtuallayersourceselect.cpp index de176916a157..bd0385debd13 100644 --- a/src/providers/virtual/qgsvirtuallayersourceselect.cpp +++ b/src/providers/virtual/qgsvirtuallayersourceselect.cpp @@ -257,7 +257,7 @@ bool QgsVirtualLayerSourceSelect::preFlight() if ( !def.toString().isEmpty() ) { const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() }; - std::unique_ptr vl( new QgsVectorLayer( def.toString(), QStringLiteral( "test" ), QStringLiteral( "virtual" ), options ) ); + auto vl = std::make_unique( def.toString(), QStringLiteral( "test" ), QStringLiteral( "virtual" ), options ); if ( vl->isValid() ) { const QStringList fieldNames = vl->fields().names(); diff --git a/src/providers/virtualraster/qgsvirtualrasterprovider.cpp b/src/providers/virtualraster/qgsvirtualrasterprovider.cpp index 61989668b6ed..425096171a12 100644 --- a/src/providers/virtualraster/qgsvirtualrasterprovider.cpp +++ b/src/providers/virtualraster/qgsvirtualrasterprovider.cpp @@ -147,7 +147,7 @@ QgsVirtualRasterProvider::~QgsVirtualRasterProvider() QgsRasterBlock *QgsVirtualRasterProvider::block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback ) { Q_UNUSED( bandNo ); - std::unique_ptr tblock = std::make_unique( Qgis::DataType::Float64, width, height ); + auto tblock = std::make_unique( Qgis::DataType::Float64, width, height ); double *outputData = ( double * ) ( tblock->bits() ); @@ -165,7 +165,7 @@ QgsRasterBlock *QgsVirtualRasterProvider::block( int bandNo, const QgsRectangle proj.setInput( it->raster->dataProvider() ); proj.setPrecision( QgsRasterProjector::Exact ); - std::unique_ptr rasterBlockFeedback( new QgsRasterBlockFeedback() ); + auto rasterBlockFeedback = std::make_unique(); QObject::connect( feedback, &QgsFeedback::canceled, rasterBlockFeedback.get(), &QgsRasterBlockFeedback::cancel ); block.reset( proj.block( it->bandNumber, extent, width, height, rasterBlockFeedback.get() ) ); if ( rasterBlockFeedback->isCanceled() ) diff --git a/src/providers/wcs/qgswcscapabilities.cpp b/src/providers/wcs/qgswcscapabilities.cpp index 828d3d378491..adb9a7d2fae7 100644 --- a/src/providers/wcs/qgswcscapabilities.cpp +++ b/src/providers/wcs/qgswcscapabilities.cpp @@ -162,6 +162,7 @@ bool QgsWcsCapabilities::sendRequest( QString const &url ) QgsMessageLog::logMessage( mError, tr( "WCS" ) ); return false; } + request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy ); request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, true ); request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, mCacheLoadControl ); QgsDebugMsgLevel( QStringLiteral( "mCacheLoadControl = %1" ).arg( mCacheLoadControl ), 2 ); @@ -382,6 +383,7 @@ void QgsWcsCapabilities::capabilitiesReplyFinished() QgsMessageLog::logMessage( mError, tr( "WCS" ) ); return; } + request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy ); request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferNetwork ); request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, true ); diff --git a/src/providers/wcs/qgswcsprovider.cpp b/src/providers/wcs/qgswcsprovider.cpp index 078b26895abb..945476c26ece 100644 --- a/src/providers/wcs/qgswcsprovider.cpp +++ b/src/providers/wcs/qgswcsprovider.cpp @@ -1675,6 +1675,7 @@ QgsWcsDownloadHandler::QgsWcsDownloadHandler( const QUrl &url, QgsAuthorizationS QgsMessageLog::logMessage( tr( "Network request update failed for authentication config" ), tr( "WCS" ) ); return; } + request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy ); request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, true ); request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, cacheLoadControl ); @@ -1718,6 +1719,7 @@ void QgsWcsDownloadHandler::cacheReplyFinished() QgsDebugMsgLevel( QStringLiteral( "redirected getmap: %1" ).arg( redirect.toString() ), 2 ); QNetworkRequest request( redirect.toUrl() ); + request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy ); QgsSetRequestInitiatorClass( request, QStringLiteral( "QgsWcsDownloadHandler" ) ); if ( !mAuth.setAuthorization( request ) ) { diff --git a/src/providers/wfs/oapif/qgsoapifprovider.cpp b/src/providers/wfs/oapif/qgsoapifprovider.cpp index d4296159054d..7fe240564687 100644 --- a/src/providers/wfs/oapif/qgsoapifprovider.cpp +++ b/src/providers/wfs/oapif/qgsoapifprovider.cpp @@ -151,7 +151,7 @@ bool QgsOapifProvider::init() } mShared->mCollectionUrl = landingPageRequest.collectionsUrl() + QStringLiteral( "/" ) + mShared->mURI.typeName(); - std::unique_ptr collectionRequest = std::make_unique( mShared->mURI.uri(), mShared->appendExtraQueryParameters( mShared->mCollectionUrl ) ); + auto collectionRequest = std::make_unique( mShared->mURI.uri(), mShared->appendExtraQueryParameters( mShared->mCollectionUrl ) ); if ( !collectionRequest->request( synchronous, forceRefresh ) || collectionRequest->errorCode() != QgsBaseNetworkRequest::NoError ) { // Retry with a trailing slash. Works around a bug with diff --git a/src/providers/wfs/qgsbasenetworkrequest.cpp b/src/providers/wfs/qgsbasenetworkrequest.cpp index 31a5aa0c3c21..446b6a998ffd 100644 --- a/src/providers/wfs/qgsbasenetworkrequest.cpp +++ b/src/providers/wfs/qgsbasenetworkrequest.cpp @@ -261,6 +261,8 @@ bool QgsBaseNetworkRequest::issueRequest( QNetworkRequest &request, const QByteA bool threadFinished = false; bool success = false; + request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy ); + const std::function downloaderFunction = [this, request, synchronous, data, &verb, &waitConditionMutex, &waitCondition, &threadFinished, &success]() { if ( QThread::currentThread() != QApplication::instance()->thread() ) QgsNetworkAccessManager::instance( Qt::DirectConnection ); @@ -306,15 +308,22 @@ bool QgsBaseNetworkRequest::issueRequest( QNetworkRequest &request, const QByteA // note that we don't need to handle waking this thread back up - that's done automatically by QgsNetworkAccessManager }; - connect( QgsNetworkAccessManager::instance(), &QgsNetworkAccessManager::authRequestOccurred, this, resumeMainThread, Qt::DirectConnection ); - connect( QgsNetworkAccessManager::instance(), &QgsNetworkAccessManager::proxyAuthenticationRequired, this, resumeMainThread, Qt::DirectConnection ); - + QMetaObject::Connection authRequestConnection = connect( QgsNetworkAccessManager::instance(), &QgsNetworkAccessManager::authRequestOccurred, this, resumeMainThread, Qt::DirectConnection ); + QMetaObject::Connection proxyAuthenticationConnection = connect( QgsNetworkAccessManager::instance(), &QgsNetworkAccessManager::proxyAuthenticationRequired, this, resumeMainThread, Qt::DirectConnection ); #ifndef QT_NO_SSL - connect( QgsNetworkAccessManager::instance(), &QgsNetworkAccessManager::sslErrorsOccurred, this, resumeMainThread, Qt::DirectConnection ); + QMetaObject::Connection sslErrorConnection = connect( QgsNetworkAccessManager::instance(), &QgsNetworkAccessManager::sslErrorsOccurred, this, resumeMainThread, Qt::DirectConnection ); #endif + QEventLoop loop; connect( this, &QgsBaseNetworkRequest::downloadFinished, &loop, &QEventLoop::quit, Qt::DirectConnection ); loop.exec(); + + // event loop exited - need to disconnect as to not leave functor hanging to receive signals in future + disconnect( authRequestConnection ); + disconnect( proxyAuthenticationConnection ); +#ifndef QT_NO_SSL + disconnect( sslErrorConnection ); +#endif } } waitConditionMutex.lock(); @@ -325,7 +334,7 @@ bool QgsBaseNetworkRequest::issueRequest( QNetworkRequest &request, const QByteA if ( synchronous && QThread::currentThread() == QApplication::instance()->thread() ) { - std::unique_ptr<_DownloaderThread> downloaderThread = std::make_unique<_DownloaderThread>( downloaderFunction ); + auto downloaderThread = std::make_unique<_DownloaderThread>( downloaderFunction ); downloaderThread->start(); while ( true ) @@ -634,6 +643,7 @@ void QgsBaseNetworkRequest::replyFinished() emit downloadFinished(); return; } + request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy ); request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, mForceRefresh ? QNetworkRequest::AlwaysNetwork : QNetworkRequest::PreferCache ); request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, true ); diff --git a/src/providers/wfs/qgswfsdataitems.cpp b/src/providers/wfs/qgswfsdataitems.cpp index 1df9bd665433..71c30e5105a6 100644 --- a/src/providers/wfs/qgswfsdataitems.cpp +++ b/src/providers/wfs/qgswfsdataitems.cpp @@ -30,6 +30,7 @@ #include "qgswfsdatasourceuri.h" #include "qgswfsprovider.h" #include "qgssettings.h" +#include "qgsproject.h" #ifdef HAVE_GUI #include "qgswfssourceselect.h" @@ -123,13 +124,31 @@ QVector QgsWfsConnectionItem::createChildren() QVector layers; if ( capabilities.errorCode() == QgsWfsCapabilities::NoError ) { + const QString projectCrs = QgsProject::instance()->crs().authid(); const auto featureTypes = capabilities.capabilities().featureTypes; for ( const QgsWfsCapabilities::FeatureType &featureType : featureTypes ) { + // if project CRS is supported then use it, otherwise use first available CRS (which is the default CRS) + QString crs; + if ( !featureType.crslist.isEmpty() ) + { + for ( const QString &c : std::as_const( featureType.crslist ) ) + { + if ( c.compare( projectCrs, Qt::CaseInsensitive ) == 0 ) + { + crs = projectCrs; + break; + } + } + + if ( crs.isEmpty() ) + { + crs = featureType.crslist.first(); + } + } QgsWfsLayerItem *layer = new QgsWfsLayerItem( this, mName, uri, featureType.name, featureType.title, - !featureType.crslist.isEmpty() ? featureType.crslist.first() : QString(), - QgsWFSProvider::WFS_PROVIDER_KEY + crs, QgsWFSProvider::WFS_PROVIDER_KEY ); layers.append( layer ); } diff --git a/src/providers/wfs/qgswfsprovider.cpp b/src/providers/wfs/qgswfsprovider.cpp index 7b6a9658a468..1e7401348886 100644 --- a/src/providers/wfs/qgswfsprovider.cpp +++ b/src/providers/wfs/qgswfsprovider.cpp @@ -1036,7 +1036,7 @@ QgsFields QgsWFSProvider::fields() const return mShared->mFields; } -QString QgsWFSProvider::geometryAttribute() const +QString QgsWFSProvider::geometryColumnName() const { return mShared->mGeometryAttribute; } @@ -1732,7 +1732,7 @@ bool QgsWFSProvider::readAttributesFromSchemaWithGMLAS( const QByteArray &respon CSLDestroy( papszOpenOptions ); }; - std::unique_ptr<_DownloaderThread> downloaderThread = std::make_unique<_DownloaderThread>( downloaderLambda ); + auto downloaderThread = std::make_unique<_DownloaderThread>( downloaderLambda ); downloaderThread->start(); QTimer timerForHits; diff --git a/src/providers/wfs/qgswfsprovider.h b/src/providers/wfs/qgswfsprovider.h index 5040d099e9e3..890a9ea931c3 100644 --- a/src/providers/wfs/qgswfsprovider.h +++ b/src/providers/wfs/qgswfsprovider.h @@ -79,6 +79,7 @@ class QgsWFSProvider final : public QgsVectorDataProvider Qgis::WkbType wkbType() const override; long long featureCount() const override; + QString geometryColumnName() const override; QgsFields fields() const override; QgsCoordinateReferenceSystem crs() const override; @@ -104,8 +105,6 @@ class QgsWFSProvider final : public QgsVectorDataProvider /* new functions */ - QString geometryAttribute() const; - const QString processSQLErrorMsg() const { return mProcessSQLErrorMsg; } const QString processSQLWarningMsg() const { return mProcessSQLWarningMsg; } diff --git a/src/providers/wfs/qgswfsprovidermetadata.cpp b/src/providers/wfs/qgswfsprovidermetadata.cpp index 3a9ffab19c7c..4b22b9dde05f 100644 --- a/src/providers/wfs/qgswfsprovidermetadata.cpp +++ b/src/providers/wfs/qgswfsprovidermetadata.cpp @@ -297,11 +297,11 @@ QList QgsWfsProviderMetadata::querySublayers( const const QString &function = filterNames[i]; if ( function == QLatin1String( "IsNull" ) ) { - filter = QgsWFSProvider::buildIsNullGeometryFilter( caps, provider.geometryAttribute() ); + filter = QgsWFSProvider::buildIsNullGeometryFilter( caps, provider.geometryColumnName() ); } else if ( !function.isEmpty() ) { - filter = QgsWFSProvider::buildFilterByGeometryType( caps, provider.geometryAttribute(), function ); + filter = QgsWFSProvider::buildFilterByGeometryType( caps, provider.geometryColumnName(), function ); } if ( !provider.sharedData()->WFSFilter().isEmpty() ) @@ -345,7 +345,7 @@ QList QgsWfsProviderMetadata::querySublayers( const } }; - std::unique_ptr<_DownloaderThread> downloaderThread = std::make_unique<_DownloaderThread>( downloaderLambda ); + auto downloaderThread = std::make_unique<_DownloaderThread>( downloaderLambda ); downloaderThread->start(); downloaderThread->wait(); diff --git a/src/providers/wfs/qgswfssourceselect.cpp b/src/providers/wfs/qgswfssourceselect.cpp index d5b899c4a4e6..06a3706f87a3 100644 --- a/src/providers/wfs/qgswfssourceselect.cpp +++ b/src/providers/wfs/qgswfssourceselect.cpp @@ -95,7 +95,6 @@ QgsWFSSourceSelect::QgsWFSSourceSelect( QWidget *parent, Qt::WindowFlags fl, Qgs QgsSettings settings; QgsDebugMsgLevel( QStringLiteral( "restoring settings" ), 3 ); - cbxUseTitleLayerName->setChecked( settings.value( QStringLiteral( "Windows/WFSSourceSelect/UseTitleLayerName" ), false ).toBool() ); cbxFeatureCurrentViewExtent->setChecked( settings.value( QStringLiteral( "Windows/WFSSourceSelect/FeatureCurrentViewExtent" ), true ).toBool() ); mHoldDialogOpen->setChecked( settings.value( QStringLiteral( "Windows/WFSSourceSelect/HoldDialogOpen" ), false ).toBool() ); @@ -122,7 +121,6 @@ QgsWFSSourceSelect::~QgsWFSSourceSelect() QgsSettings settings; QgsDebugMsgLevel( QStringLiteral( "saving settings" ), 3 ); - settings.setValue( QStringLiteral( "Windows/WFSSourceSelect/UseTitleLayerName" ), cbxUseTitleLayerName->isChecked() ); settings.setValue( QStringLiteral( "Windows/WFSSourceSelect/FeatureCurrentViewExtent" ), cbxFeatureCurrentViewExtent->isChecked() ); settings.setValue( QStringLiteral( "Windows/WFSSourceSelect/HoldDialogOpen" ), mHoldDialogOpen->isChecked() ); @@ -529,14 +527,9 @@ void QgsWFSSourceSelect::addButtonClicked() continue; } int row = idx.row(); - QString typeName = mModel->item( row, MODEL_IDX_NAME )->text(); //WFS repository's name for layer - QString titleName = mModel->item( row, MODEL_IDX_TITLE )->text(); //WFS type name title for layer name (if option is set) - QString sql = mModel->item( row, MODEL_IDX_SQL )->text(); //optional SqL specified by user + QString typeName = mModel->item( row, MODEL_IDX_NAME )->text(); //WFS repository's name for layer + QString sql = mModel->item( row, MODEL_IDX_SQL )->text(); //optional SqL specified by user QString layerName = typeName; - if ( cbxUseTitleLayerName->isChecked() && !titleName.isEmpty() ) - { - layerName = titleName; - } QgsDebugMsgLevel( "Layer " + typeName + " SQL is " + sql, 3 ); mUri = QgsWFSDataSourceURI::build( connection.uri().uri( false ), typeName, pCrsString, isOapif() ? QString() : sql, isOapif() ? sql : QString(), cbxFeatureCurrentViewExtent->isChecked() ); diff --git a/src/providers/wfs/qgswfssubsetstringeditor.cpp b/src/providers/wfs/qgswfssubsetstringeditor.cpp index 8816ac862f4d..9732530aad34 100644 --- a/src/providers/wfs/qgswfssubsetstringeditor.cpp +++ b/src/providers/wfs/qgswfssubsetstringeditor.cpp @@ -116,9 +116,9 @@ QgsSubsetStringEditorInterface *QgsWfsSubsetStringEditor::create( QgsVectorLayer QString fieldName( fieldNamePrefix + QgsSQLStatement::quotedIdentifierIfNeeded( field.name() ) ); fieldList << QgsSQLComposerDialog::PairNameType( fieldName, field.typeName() ); } - if ( !provider->geometryAttribute().isEmpty() ) + if ( !provider->geometryColumnName().isEmpty() ) { - QString fieldName( fieldNamePrefix + QgsSQLStatement::quotedIdentifierIfNeeded( provider->geometryAttribute() ) ); + QString fieldName( fieldNamePrefix + QgsSQLStatement::quotedIdentifierIfNeeded( provider->geometryColumnName() ) ); fieldList << QgsSQLComposerDialog::PairNameType( fieldName, QStringLiteral( "geometry" ) ); } fieldList << QgsSQLComposerDialog::PairNameType( fieldNamePrefix + "*", QString() ); @@ -189,9 +189,9 @@ void QgsWFSTableSelectedCallback::tableSelected( const QString &name ) QString fieldName( fieldNamePrefix + QgsSQLStatement::quotedIdentifierIfNeeded( field.name() ) ); fieldList << QgsSQLComposerDialog::PairNameType( fieldName, field.typeName() ); } - if ( !p.geometryAttribute().isEmpty() ) + if ( !p.geometryColumnName().isEmpty() ) { - QString fieldName( fieldNamePrefix + QgsSQLStatement::quotedIdentifierIfNeeded( p.geometryAttribute() ) ); + QString fieldName( fieldNamePrefix + QgsSQLStatement::quotedIdentifierIfNeeded( p.geometryColumnName() ) ); fieldList << QgsSQLComposerDialog::PairNameType( fieldName, QStringLiteral( "geometry" ) ); } fieldList << QgsSQLComposerDialog::PairNameType( fieldNamePrefix + "*", QString() ); diff --git a/src/providers/wms/qgswmscapabilities.cpp b/src/providers/wms/qgswmscapabilities.cpp index 20a9ceab977b..3b09bfc9a473 100644 --- a/src/providers/wms/qgswmscapabilities.cpp +++ b/src/providers/wms/qgswmscapabilities.cpp @@ -407,7 +407,12 @@ QDateTime QgsWmsSettings::parseWmstDateTimes( const QString &item ) // Check if it does not have time part if ( !item.contains( 'T' ) ) - return QDateTime::fromString( item, QStringLiteral( "yyyy-MM-dd" ) ); + { + if ( item.size() == 4 ) + return QDateTime::fromString( item, QStringLiteral( "yyyy" ) ); + else + return QDateTime::fromString( item, QStringLiteral( "yyyy-MM-dd" ) ); + } else if ( item.contains( '.' ) ) return QDateTime::fromString( item, Qt::ISODateWithMs ); else @@ -2491,6 +2496,7 @@ bool QgsWmsCapabilitiesDownload::downloadCapabilities() QgsMessageLog::logMessage( mError, tr( "WMS" ) ); return false; } + request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy ); request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, mForceRefresh ? QNetworkRequest::AlwaysNetwork : QNetworkRequest::PreferCache ); request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, true ); @@ -2562,6 +2568,7 @@ void QgsWmsCapabilitiesDownload::capabilitiesReplyFinished() emit downloadFinished(); return; } + request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy ); request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, mForceRefresh ? QNetworkRequest::AlwaysNetwork : QNetworkRequest::PreferCache ); request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, true ); diff --git a/src/providers/wms/qgswmsdataitems.cpp b/src/providers/wms/qgswmsdataitems.cpp index 63e88ef856a6..346fe894c461 100644 --- a/src/providers/wms/qgswmsdataitems.cpp +++ b/src/providers/wms/qgswmsdataitems.cpp @@ -19,9 +19,11 @@ #include "qgslogger.h" #include "qgsdatasourceuri.h" +#include "qgssettings.h" #include "qgswmscapabilities.h" #include "qgswmsconnection.h" #include "qgsxyzconnection.h" +#include "qgsproject.h" // --------------------------------------------------------------------------- @@ -428,35 +430,54 @@ QString QgsWMSItemBase::createUri( bool withStyle ) } QString format; - // get first supported by qt and server - QVector formats( QgsWmsProvider::supportedFormats() ); - const auto constFormats = formats; - for ( const QgsWmsSupportedFormat &f : constFormats ) + bool first = true; + const QString defaultEncoding = QgsSettings().value( QStringLiteral( "qgis/lastWmsImageEncoding" ), "image/png" ).toString(); + const QVector formats( QgsWmsProvider::supportedFormats() ); + QStringList supportedFormats; + supportedFormats.reserve( formats.size() ); + for ( const QgsWmsSupportedFormat &f : formats ) { - if ( mCapabilitiesProperty.capability.request.getMap.format.indexOf( f.format ) >= 0 ) + supportedFormats.append( f.format ); + } + + for ( const QString &f : mCapabilitiesProperty.capability.request.getMap.format ) + { + if ( !supportedFormats.contains( f ) ) + { + QgsDebugError( QStringLiteral( "encoding %1 not supported." ).arg( f ) ); + continue; + } + + if ( first || f == defaultEncoding ) { - format = f.format; - break; + format = f; + first = false; } } mDataSourceUri.setParam( QStringLiteral( "format" ), format ); + const QString projectCrs = QgsProject::instance()->crs().authid(); QString crs; - // get first known if possible - QgsCoordinateReferenceSystem testCrs; - for ( const QString &c : std::as_const( mLayerProperty.crs ) ) + // if project CRS is supported then use it, otherwise use first available CRS + if ( !mLayerProperty.crs.isEmpty() ) { - testCrs = QgsCoordinateReferenceSystem::fromOgcWmsCrs( c ); - if ( testCrs.isValid() ) + QgsCoordinateReferenceSystem testCrs; + for ( const QString &c : std::as_const( mLayerProperty.crs ) ) { - crs = c; - break; + testCrs = QgsCoordinateReferenceSystem::fromOgcWmsCrs( c ); + if ( testCrs.authid().compare( projectCrs, Qt::CaseInsensitive ) == 0 ) + { + crs = projectCrs; + break; + } + } + + if ( crs.isEmpty() ) + { + crs = mLayerProperty.crs[0]; } } - if ( crs.isEmpty() && !mLayerProperty.crs.isEmpty() ) - { - crs = mLayerProperty.crs[0]; - } + mDataSourceUri.setParam( QStringLiteral( "crs" ), crs ); // Set default featureCount to 10, old connections might miss this diff --git a/src/providers/wms/qgswmsprovider.cpp b/src/providers/wms/qgswmsprovider.cpp index bff0e2cb9319..da39384cb8f1 100644 --- a/src/providers/wms/qgswmsprovider.cpp +++ b/src/providers/wms/qgswmsprovider.cpp @@ -3289,6 +3289,7 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPointXY &point, Qgis: QgsDebugMsgLevel( QStringLiteral( "getfeatureinfo: %1" ).arg( requestUrl.toString() ), 2 ); QNetworkRequest request( requestUrl ); + request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy ); QgsSetRequestInitiatorClass( request, QStringLiteral( "QgsWmsProvider" ) ); QgsSetRequestInitiatorId( request, QStringLiteral( "identify %1,%2" ).arg( point.x() ).arg( point.y() ) ); mSettings.authorization().setAuthorization( request ); @@ -3711,7 +3712,9 @@ void QgsWmsProvider::identifyReplyFinished() mIdentifyReply->deleteLater(); QgsDebugMsgLevel( QStringLiteral( "redirected getfeatureinfo: %1" ).arg( redirect.toString() ), 2 ); - mIdentifyReply = QgsNetworkAccessManager::instance()->get( QNetworkRequest( redirect.toUrl() ) ); + QNetworkRequest request( redirect.toUrl() ); + request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy ); + mIdentifyReply = QgsNetworkAccessManager::instance()->get( request ); mSettings.authorization().setAuthorizationReply( mIdentifyReply ); mIdentifyReply->setProperty( "eventLoop", QVariant::fromValue( qobject_cast( loop ) ) ); connect( mIdentifyReply, &QNetworkReply::finished, this, &QgsWmsProvider::identifyReplyFinished ); @@ -3850,6 +3853,10 @@ QSize QgsWmsProvider::maximumTileSize() const { return QSize( capsMaxWidth, capsMaxHeight ); } + else if ( mSettings.mStepWidth > 0 && mSettings.mStepHeight > 0 ) //The chosen step size can be higher than the default max size + { + return QSize( mSettings.mStepWidth, mSettings.mStepHeight ); + } else // default fallback { return QgsRasterDataProvider::maximumTileSize(); @@ -4255,6 +4262,7 @@ QgsWmsImageDownloadHandler::QgsWmsImageDownloadHandler( const QString &providerU } QNetworkRequest request( url ); + request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy ); QgsSetRequestInitiatorClass( request, QStringLiteral( "QgsWmsImageDownloadHandler" ) ); auth.setAuthorization( request ); request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, true ); @@ -4290,7 +4298,9 @@ void QgsWmsImageDownloadHandler::cacheReplyFinished() mCacheReply->deleteLater(); QgsDebugMsgLevel( QStringLiteral( "redirected getmap: %1" ).arg( redirect.toString() ), 2 ); - mCacheReply = QgsNetworkAccessManager::instance()->get( QNetworkRequest( redirect.toUrl() ) ); + QNetworkRequest request( redirect.toUrl() ); + request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy ); + mCacheReply = QgsNetworkAccessManager::instance()->get( request ); connect( mCacheReply, &QNetworkReply::finished, this, &QgsWmsImageDownloadHandler::cacheReplyFinished ); return; } @@ -4423,6 +4433,7 @@ QgsWmsTiledImageDownloadHandler::QgsWmsTiledImageDownloadHandler( const QString QgsSetRequestInitiatorClass( request, QStringLiteral( "QgsWmsTiledImageDownloadHandler" ) ); auth.setAuthorization( request ); request.setRawHeader( "Accept", "*/*" ); + request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy ); request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache ); request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, true ); request.setAttribute( static_cast( TileReqNo ), mTileReqNo ); @@ -4515,6 +4526,7 @@ void QgsWmsTiledImageDownloadHandler::tileReplyFinished() QgsSetRequestInitiatorClass( request, QStringLiteral( "QgsWmsTiledImageDownloadHandler" ) ); mAuth.setAuthorization( request ); request.setRawHeader( "Accept", "*/*" ); + request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy ); request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache ); request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, true ); request.setAttribute( static_cast( TileReqNo ), tileReqNo ); @@ -4824,6 +4836,7 @@ void QgsWmsLegendDownloadHandler::startUrl( const QUrl &url ) QNetworkRequest request( url ); QgsSetRequestInitiatorClass( request, QStringLiteral( "QgsWmsLegendDownloadHandler" ) ); mSettings.authorization().setAuthorization( request ); + request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy ); request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache ); request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, true ); diff --git a/src/providers/wms/qgswmssourceselect.cpp b/src/providers/wms/qgswmssourceselect.cpp index ef43ed890e54..ecf12e42a493 100644 --- a/src/providers/wms/qgswmssourceselect.cpp +++ b/src/providers/wms/qgswmssourceselect.cpp @@ -78,9 +78,6 @@ QgsWMSSourceSelect::QgsWMSSourceSelect( QWidget *parent, Qt::WindowFlags fl, Qgs connect( mLayersFilterLineEdit, &QgsFilterLineEdit::textChanged, this, &QgsWMSSourceSelect::filterLayers ); connect( mTilesetsFilterLineEdit, &QgsFilterLineEdit::textChanged, this, &QgsWMSSourceSelect::filterTiles ); - connect( mLoadLayersIndividuallyCheckBox, &QCheckBox::toggled, leLayerName, &QLineEdit::setDisabled ); - - leLayerName->setDisabled( mLoadLayersIndividuallyCheckBox->isChecked() ); // Creates and connects standard ok/apply buttons setupButtons( buttonBox ); @@ -299,9 +296,10 @@ bool QgsWMSSourceSelect::populateLayerList( const QgsWmsCapabilities &capabiliti const QVector layers = capabilities.supportedLayers(); mLayerProperties = layers; - QString defaultEncoding = QgsSettings().value( "qgis/WMSDefaultFormat", "" ).toString(); + QString defaultEncoding = QgsSettings().value( QStringLiteral( "qgis/lastWmsImageEncoding" ), "image/png" ).toString(); bool first = true; + bool found = false; QSet alreadyAddedLabels; const auto supportedImageEncodings = capabilities.supportedImageEncodings(); for ( const QString &encoding : supportedImageEncodings ) @@ -323,7 +321,11 @@ bool QgsWMSSourceSelect::populateLayerList( const QgsWmsCapabilities &capabiliti mImageFormatGroup->button( id )->setVisible( true ); if ( first || encoding == defaultEncoding ) { - mImageFormatGroup->button( id )->setChecked( true ); + if ( !found ) + { + mImageFormatGroup->button( id )->setChecked( true ); + found = true; + } first = false; } } @@ -611,6 +613,8 @@ void QgsWMSSourceSelect::addButtonClicked() uri.setParam( QStringLiteral( "crs" ), crs ); QgsDebugMsgLevel( QStringLiteral( "crs=%2 " ).arg( crs ), 2 ); + QgsSettings().setValue( QStringLiteral( "/qgis/lastWmsImageEncoding" ), format ); + // Remove in case the default value from the connection settings // is being overridden here uri.removeParam( QStringLiteral( "featureCount" ) ); @@ -644,9 +648,9 @@ void QgsWMSSourceSelect::addButtonClicked() uri.setParam( QStringLiteral( "styles" ), styles ); Q_NOWARN_DEPRECATED_PUSH - emit addRasterLayer( uri.encodedUri(), leLayerName->text().isEmpty() ? titles.join( QLatin1Char( '/' ) ) : leLayerName->text(), QStringLiteral( "wms" ) ); + emit addRasterLayer( uri.encodedUri(), titles.join( QLatin1Char( '/' ) ), QStringLiteral( "wms" ) ); Q_NOWARN_DEPRECATED_POP - emit addLayer( Qgis::LayerType::Raster, uri.encodedUri(), leLayerName->text().isEmpty() ? titles.join( QLatin1Char( '/' ) ) : leLayerName->text(), QStringLiteral( "wms" ) ); + emit addLayer( Qgis::LayerType::Raster, uri.encodedUri(), titles.join( QLatin1Char( '/' ) ), QStringLiteral( "wms" ) ); } } @@ -1036,19 +1040,13 @@ void QgsWMSSourceSelect::updateButtons() QString tileLayerName = item->data( Qt::UserRole + 5 ).toString(); if ( tileLayerName.isEmpty() ) tileLayerName = item->data( Qt::UserRole + 0 ).toString(); - leLayerName->setText( tileLayerName ); } else { QStringList layers, styles, titles; collectSelectedLayers( layers, styles, titles ); - leLayerName->setText( titles.join( QLatin1Char( '/' ) ) ); } } - else - { - leLayerName->setText( "" ); - } } diff --git a/src/server/qgsconfigcache.cpp b/src/server/qgsconfigcache.cpp index 3bf9412f3392..1947c06600b8 100644 --- a/src/server/qgsconfigcache.cpp +++ b/src/server/qgsconfigcache.cpp @@ -103,7 +103,7 @@ const QgsProject *QgsConfigCache::project( const QString &path, const QgsServerS if ( !mProjectCache[path] ) { // disable the project style database -- this incurs unwanted cost and is not required - std::unique_ptr prj( new QgsProject( nullptr, Qgis::ProjectCapabilities() ) ); + auto prj = std::make_unique( nullptr, Qgis::ProjectCapabilities() ); // This is required by virtual layers that call QgsProject::instance() inside the constructor :( QgsProject::setInstance( prj.get() ); diff --git a/src/server/qgsserverapiutils.cpp b/src/server/qgsserverapiutils.cpp index 9648e44a5234..68eb2d3e54d1 100644 --- a/src/server/qgsserverapiutils.cpp +++ b/src/server/qgsserverapiutils.cpp @@ -67,7 +67,7 @@ QList QgsServerApiUtils::temporal // Filter only date and time dimensions.erase( std::remove_if( dimensions.begin(), dimensions.end(), []( QgsMapLayerServerProperties::WmsDimensionInfo &dim ) { return dim.name.toLower() != QStringLiteral( "time" ) - && dim.name.toLower() != QStringLiteral( "date" ); + && dim.name.toLower() != QLatin1String( "date" ); } ), dimensions.end() ); diff --git a/src/server/qgsserverparameters.cpp b/src/server/qgsserverparameters.cpp index b60aefcdccc4..76d970c25ded 100644 --- a/src/server/qgsserverparameters.cpp +++ b/src/server/qgsserverparameters.cpp @@ -95,12 +95,12 @@ QStringList QgsServerParameterDefinition::toStringList( const char delimiter, co } } -QList QgsServerParameterDefinition::toGeomList( bool &ok, const char delimiter ) const +QList QgsServerParameterDefinition::toGeomList( bool &ok, const char delimiter, const bool skipEmptyParts ) const { ok = true; QList geoms; - const auto constStringList( toStringList( delimiter ) ); + const auto constStringList( toStringList( delimiter, skipEmptyParts ) ); for ( const auto &wkt : constStringList ) { const QgsGeometry g( QgsGeometry::fromWkt( wkt ) ); @@ -202,12 +202,12 @@ QStringList QgsServerParameterDefinition::toExpressionList() const return filters; } -QList QgsServerParameterDefinition::toColorList( bool &ok, const char delimiter ) const +QList QgsServerParameterDefinition::toColorList( bool &ok, const char delimiter, bool skipEmptyParts ) const { ok = true; QList colors; - const auto constStringList( toStringList( delimiter ) ); + const auto constStringList( toStringList( delimiter, skipEmptyParts ) ); for ( const auto &part : constStringList ) { QString cStr( part ); @@ -234,12 +234,12 @@ QList QgsServerParameterDefinition::toColorList( bool &ok, const char de return colors; } -QList QgsServerParameterDefinition::toIntList( bool &ok, const char delimiter ) const +QList QgsServerParameterDefinition::toIntList( bool &ok, const char delimiter, bool skipEmptyParts ) const { ok = true; QList ints; - const auto constStringList( toStringList( delimiter ) ); + const auto constStringList( toStringList( delimiter, skipEmptyParts ) ); for ( const auto &part : constStringList ) { const int val = part.toInt( &ok ); @@ -255,12 +255,12 @@ QList QgsServerParameterDefinition::toIntList( bool &ok, const char delimit return ints; } -QList QgsServerParameterDefinition::toDoubleList( bool &ok, const char delimiter ) const +QList QgsServerParameterDefinition::toDoubleList( bool &ok, const char delimiter, bool skipEmptyParts ) const { ok = true; QList vals; - const auto constStringList( toStringList( delimiter ) ); + const auto constStringList( toStringList( delimiter, skipEmptyParts ) ); for ( const auto &part : constStringList ) { const double val = part.toDouble( &ok ); diff --git a/src/server/qgsserverparameters.h b/src/server/qgsserverparameters.h index 5b86c18703aa..c46985dac84f 100644 --- a/src/server/qgsserverparameters.h +++ b/src/server/qgsserverparameters.h @@ -80,33 +80,37 @@ class SERVER_EXPORT QgsServerParameterDefinition * Converts the parameter into a list of integers. * \param ok TRUE if there's no error during the conversion, FALSE otherwise * \param delimiter The character used for delimiting + * \param skipEmptyParts for splitting * \returns A list of integers */ - QList toIntList( bool &ok, char delimiter = ',' ) const; + QList toIntList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const; /** * Converts the parameter into a list of doubles. * \param ok TRUE if there's no error during the conversion, FALSE otherwise * \param delimiter The character used for delimiting + * \param skipEmptyParts for splitting * \returns A list of doubles */ - QList toDoubleList( bool &ok, char delimiter = ',' ) const; + QList toDoubleList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const; /** * Converts the parameter into a list of colors. * \param ok TRUE if there's no error during the conversion, FALSE otherwise * \param delimiter The character used for delimiting + * \param skipEmptyParts for splitting * \returns A list of colors */ - QList toColorList( bool &ok, char delimiter = ',' ) const; + QList toColorList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const; /** * Converts the parameter into a list of geometries. * \param ok TRUE if there's no error during the conversion, FALSE otherwise * \param delimiter The character used for delimiting + * \param skipEmptyParts for splitting * \returns A list of geometries */ - QList toGeomList( bool &ok, char delimiter = ',' ) const; + QList toGeomList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const; /** * Converts the parameter into a list of OGC filters. diff --git a/src/server/services/wfs/qgswfsdescribefeaturetype.cpp b/src/server/services/wfs/qgswfsdescribefeaturetype.cpp index 1d79c2723116..848b09d8d671 100644 --- a/src/server/services/wfs/qgswfsdescribefeaturetype.cpp +++ b/src/server/services/wfs/qgswfsdescribefeaturetype.cpp @@ -151,7 +151,7 @@ namespace QgsWfs } const QgsEditorWidgetSetup setup = field.editorWidgetSetup(); - if ( setup.type() == QStringLiteral( "DateTime" ) ) + if ( setup.type() == QLatin1String( "DateTime" ) ) { // Get editor widget setup config const QVariantMap config = setup.config(); @@ -171,7 +171,7 @@ namespace QgsWfs else if ( fieldFormat == QgsDateTimeFieldFormatter::QT_ISO_FORMAT ) fieldType = QStringLiteral( "dateTime" ); } - else if ( setup.type() == QStringLiteral( "Range" ) ) + else if ( setup.type() == QLatin1String( "Range" ) ) { const QVariantMap config = setup.config(); if ( config.contains( QStringLiteral( "Precision" ) ) ) diff --git a/src/server/services/wfs/qgswfsgetcapabilities.cpp b/src/server/services/wfs/qgswfsgetcapabilities.cpp index acfbf19dbf76..fb54a6986052 100644 --- a/src/server/services/wfs/qgswfsgetcapabilities.cpp +++ b/src/server/services/wfs/qgswfsgetcapabilities.cpp @@ -530,7 +530,7 @@ namespace QgsWfs operationsElement.appendChild( operationElement ); } - if ( ( provider->capabilities() & Qgis::VectorProviderCapability::ChangeAttributeValues ) && ( provider->capabilities() & Qgis::VectorProviderCapability::ChangeGeometries ) && wfstUpdateLayersId.contains( layer->id() ) ) + if ( ( provider->capabilities() & Qgis::VectorProviderCapability::ChangeAttributeValues ) && ( !layer->isSpatial() || provider->capabilities() & Qgis::VectorProviderCapability::ChangeGeometries ) && wfstUpdateLayersId.contains( layer->id() ) ) { //wfs:Update element QDomElement operationElement = doc.createElement( QStringLiteral( "Operation" ) ); diff --git a/src/server/services/wfs/qgswfsgetfeature.cpp b/src/server/services/wfs/qgswfsgetfeature.cpp index 70263793542c..3ca638178e15 100644 --- a/src/server/services/wfs/qgswfsgetfeature.cpp +++ b/src/server/services/wfs/qgswfsgetfeature.cpp @@ -196,7 +196,7 @@ namespace QgsWfs QgsAccessControl *accessControl = serverIface->accessControls(); //scoped pointer to restore all original layer filters (subsetStrings) when pointer goes out of scope //there's LOTS of potential exit paths here, so we avoid having to restore the filters manually - std::unique_ptr filterRestorer( new QgsOWSServerFilterRestorer() ); + auto filterRestorer = std::make_unique(); #else ( void ) serverIface; #endif @@ -1629,7 +1629,7 @@ namespace QgsWfs if ( QgsVariantUtils::isNull( value ) ) return QString(); - if ( setup.type() == QStringLiteral( "DateTime" ) ) + if ( setup.type() == QLatin1String( "DateTime" ) ) { // For time fields use const TIME_FORMAT if ( value.userType() == QMetaType::Type::QTime ) @@ -1658,7 +1658,7 @@ namespace QgsWfs // else provide the value as string return value.toString(); } - else if ( setup.type() == QStringLiteral( "Range" ) ) + else if ( setup.type() == QLatin1String( "Range" ) ) { const QVariantMap config = setup.config(); if ( config.contains( QStringLiteral( "Precision" ) ) ) diff --git a/src/server/services/wfs/qgswfsparameters.cpp b/src/server/services/wfs/qgswfsparameters.cpp index f1ea2e25411a..511fc40f1f38 100644 --- a/src/server/services/wfs/qgswfsparameters.cpp +++ b/src/server/services/wfs/qgswfsparameters.cpp @@ -364,8 +364,8 @@ namespace QgsWfs return version; } - void QgsWfsParameters::log( const QString &msg ) const + void QgsWfsParameters::log( const QString &msg, const char *file, const char *function, int line ) const { - QgsMessageLog::logMessage( msg, "Server", Qgis::MessageLevel::Info ); + QgsMessageLog::logMessage( msg, "Server", Qgis::MessageLevel::Info, true, file, function, line ); } } // namespace QgsWfs diff --git a/src/server/services/wfs/qgswfsparameters.h b/src/server/services/wfs/qgswfsparameters.h index 50509a58712e..2bfa5e0da54e 100644 --- a/src/server/services/wfs/qgswfsparameters.h +++ b/src/server/services/wfs/qgswfsparameters.h @@ -283,7 +283,7 @@ namespace QgsWfs bool loadParameter( const QString &key, const QString &value ) override; void save( const QgsWfsParameter ¶meter ); - void log( const QString &msg ) const; + void log( const QString &msg, const char *file = __builtin_FILE(), const char *function = __builtin_FUNCTION(), int line = __builtin_LINE() ) const; QList mVersions; QMap mWfsParameters; diff --git a/src/server/services/wfs/qgswfstransaction.cpp b/src/server/services/wfs/qgswfstransaction.cpp index d90448129e88..92ef2769274a 100644 --- a/src/server/services/wfs/qgswfstransaction.cpp +++ b/src/server/services/wfs/qgswfstransaction.cpp @@ -249,7 +249,7 @@ namespace QgsWfs //scoped pointer to restore all original layer filters (subsetStrings) when pointer goes out of scope //there's LOTS of potential exit paths here, so we avoid having to restore the filters manually - std::unique_ptr filterRestorer( new QgsOWSServerFilterRestorer() ); + auto filterRestorer = std::make_unique(); // get layers QStringList wfsLayerIds = QgsServerProjectUtils::wfsLayerIds( *project ); @@ -292,8 +292,10 @@ namespace QgsWfs // get provider capabilities Qgis::VectorProviderCapabilities cap = provider->capabilities(); - if ( !( cap & Qgis::VectorProviderCapability::ChangeAttributeValues ) && !( cap & Qgis::VectorProviderCapability::ChangeGeometries ) - && !( cap & Qgis::VectorProviderCapability::DeleteFeatures ) && !( cap & Qgis::VectorProviderCapability::AddFeatures ) ) + + const bool canUpdateAnything { cap.testFlag( Qgis::VectorProviderCapability::ChangeAttributeValues ) || ( vlayer->isSpatial() && cap.testFlag( Qgis::VectorProviderCapability::ChangeGeometries ) ) }; + + if ( !canUpdateAnything && !( cap & Qgis::VectorProviderCapability::DeleteFeatures ) && !( cap & Qgis::VectorProviderCapability::AddFeatures ) ) { throw QgsRequestNotWellFormedException( QStringLiteral( "No capabilities to do WFS changes on layer '%1'" ).arg( name ) ); } @@ -357,7 +359,7 @@ namespace QgsWfs // verifying specific capabilities Qgis::VectorProviderCapabilities cap = provider->capabilities(); - if ( !( cap & Qgis::VectorProviderCapability::ChangeAttributeValues ) || !( cap & Qgis::VectorProviderCapability::ChangeGeometries ) ) + if ( !( cap.testFlag( Qgis::VectorProviderCapability::ChangeAttributeValues ) || ( vlayer->isSpatial() && cap.testFlag( Qgis::VectorProviderCapability::ChangeGeometries ) ) ) ) { action.error = true; action.errorMsg = QStringLiteral( "No capabilities to do WFS updates on layer '%1'" ).arg( typeName ); diff --git a/src/server/services/wfs/qgswfstransaction_1_0_0.cpp b/src/server/services/wfs/qgswfstransaction_1_0_0.cpp index e753d117db3c..411adcaefcde 100644 --- a/src/server/services/wfs/qgswfstransaction_1_0_0.cpp +++ b/src/server/services/wfs/qgswfstransaction_1_0_0.cpp @@ -233,7 +233,7 @@ namespace QgsWfs //scoped pointer to restore all original layer filters (subsetStrings) when pointer goes out of scope //there's LOTS of potential exit paths here, so we avoid having to restore the filters manually - std::unique_ptr filterRestorer( new QgsOWSServerFilterRestorer() ); + auto filterRestorer = std::make_unique(); // get layers QStringList wfsLayerIds = QgsServerProjectUtils::wfsLayerIds( *project ); diff --git a/src/server/services/wfs3/qgswfs3handlers.cpp b/src/server/services/wfs3/qgswfs3handlers.cpp index 99ae8749e456..d7b4ee6290ea 100644 --- a/src/server/services/wfs3/qgswfs3handlers.cpp +++ b/src/server/services/wfs3/qgswfs3handlers.cpp @@ -1241,7 +1241,7 @@ void QgsWfs3CollectionsItemsHandler::handleRequest( const QgsServerApiContext &c //scoped pointer to restore all original layer filters (subsetStrings) when pointer goes out of scope //there's LOTS of potential exit paths here, so we avoid having to restore the filters manually - std::unique_ptr filterRestorer( new QgsOWSServerFilterRestorer() ); + auto filterRestorer = std::make_unique(); if ( accessControl ) { QgsOWSServerFilterRestorer::applyAccessControlLayerFilters( accessControl, mapLayer, filterRestorer->originalFilters() ); @@ -1434,7 +1434,7 @@ void QgsWfs3CollectionsFeatureHandler::handleRequest( const QgsServerApiContext QgsAccessControl *accessControl = context.serverInterface()->accessControls(); //scoped pointer to restore all original layer filters (subsetStrings) when pointer goes out of scope //there's LOTS of potential exit paths here, so we avoid having to restore the filters manually - std::unique_ptr filterRestorer( new QgsOWSServerFilterRestorer() ); + auto filterRestorer = std::make_unique(); if ( accessControl ) { QgsOWSServerFilterRestorer::applyAccessControlLayerFilters( accessControl, mapLayer, filterRestorer->originalFilters() ); @@ -1498,7 +1498,7 @@ void QgsWfs3CollectionsFeatureHandler::handleRequest( const QgsServerApiContext //scoped pointer to restore all original layer filters (subsetStrings) when pointer goes out of scope //there's LOTS of potential exit paths here, so we avoid having to restore the filters manually - std::unique_ptr filterRestorer( new QgsOWSServerFilterRestorer() ); + auto filterRestorer = std::make_unique(); if ( accessControl ) { QgsOWSServerFilterRestorer::applyAccessControlLayerFilters( accessControl, mapLayer, filterRestorer->originalFilters() ); @@ -1629,7 +1629,7 @@ void QgsWfs3CollectionsFeatureHandler::handleRequest( const QgsServerApiContext //scoped pointer to restore all original layer filters (subsetStrings) when pointer goes out of scope //there's LOTS of potential exit paths here, so we avoid having to restore the filters manually - std::unique_ptr filterRestorer( new QgsOWSServerFilterRestorer() ); + auto filterRestorer = std::make_unique(); if ( accessControl ) { QgsOWSServerFilterRestorer::applyAccessControlLayerFilters( accessControl, mapLayer, filterRestorer->originalFilters() ); @@ -1748,7 +1748,7 @@ void QgsWfs3CollectionsFeatureHandler::handleRequest( const QgsServerApiContext //scoped pointer to restore all original layer filters (subsetStrings) when pointer goes out of scope //there's LOTS of potential exit paths here, so we avoid having to restore the filters manually - std::unique_ptr filterRestorer( new QgsOWSServerFilterRestorer() ); + auto filterRestorer = std::make_unique(); if ( accessControl ) { QgsOWSServerFilterRestorer::applyAccessControlLayerFilters( accessControl, mapLayer, filterRestorer->originalFilters() ); diff --git a/src/server/services/wms/qgsdxfwriter.cpp b/src/server/services/wms/qgsdxfwriter.cpp index ed42e1ffef88..ce40cf2b4a11 100644 --- a/src/server/services/wms/qgsdxfwriter.cpp +++ b/src/server/services/wms/qgsdxfwriter.cpp @@ -37,7 +37,7 @@ namespace QgsWms QgsRenderer renderer( context ); //Layer settings need to be kept until QgsDxfExport::writeToFile has finished - std::unique_ptr restorer = std::make_unique( context ); + auto restorer = std::make_unique( context ); restorer.reset( new QgsWmsRestorer( context ) ); std::unique_ptr dxf = renderer.getDxf(); diff --git a/src/server/services/wms/qgswmsgetlegendgraphics.cpp b/src/server/services/wms/qgswmsgetlegendgraphics.cpp index 1cf98c8939a0..48e3bb552bef 100644 --- a/src/server/services/wms/qgswmsgetlegendgraphics.cpp +++ b/src/server/services/wms/qgswmsgetlegendgraphics.cpp @@ -243,7 +243,7 @@ namespace QgsWms QgsLayerTreeModel *legendModel( const QgsWmsRenderContext &context, QgsLayerTree &tree ) { const QgsWmsParameters parameters = context.parameters(); - std::unique_ptr model( new QgsLayerTreeModel( &tree ) ); + auto model = std::make_unique( &tree ); std::unique_ptr mapSettings; if ( context.scaleDenominator() > 0 ) @@ -320,7 +320,7 @@ namespace QgsWms QgsLayerTree *layerTree( const QgsWmsRenderContext &context ) { - std::unique_ptr tree( new QgsLayerTree() ); + auto tree = std::make_unique(); QList counters; for ( QgsMapLayer *ml : context.layersToRender() ) @@ -363,7 +363,7 @@ namespace QgsWms return 0; } - std::unique_ptr tree( new QgsLayerTree() ); + auto tree = std::make_unique(); QgsWmsParameters wmsParams = context.parameters(); QStringList layerNicknames = wmsParams.allLayersNickname(); diff --git a/src/server/services/wms/qgswmsparameters.cpp b/src/server/services/wms/qgswmsparameters.cpp index 51938793114d..1a3c17764717 100644 --- a/src/server/services/wms/qgswmsparameters.cpp +++ b/src/server/services/wms/qgswmsparameters.cpp @@ -49,15 +49,15 @@ namespace QgsWms QgsServerParameterDefinition::raiseError( msg ); } - QStringList QgsWmsParameter::toStyleList( const char delimiter ) const + QStringList QgsWmsParameter::toStyleList( const char delimiter, bool skipEmptyParts ) const { - return QgsServerParameterDefinition::toStringList( delimiter, false ); + return QgsServerParameterDefinition::toStringList( delimiter, skipEmptyParts ); } - QList QgsWmsParameter::toGeomList( const char delimiter ) const + QList QgsWmsParameter::toGeomList( const char delimiter, bool skipEmptyParts ) const { bool ok = true; - const QList geoms = QgsServerParameterDefinition::toGeomList( ok, delimiter ); + const QList geoms = QgsServerParameterDefinition::toGeomList( ok, delimiter, skipEmptyParts ); if ( !ok ) { @@ -138,10 +138,10 @@ namespace QgsWms return col; } - QList QgsWmsParameter::toColorList( const char delimiter ) const + QList QgsWmsParameter::toColorList( const char delimiter, bool skipEmptyParts ) const { bool ok = false; - const QList vals = QgsServerParameterDefinition::toColorList( ok, delimiter ); + const QList vals = QgsServerParameterDefinition::toColorList( ok, delimiter, skipEmptyParts ); if ( !ok ) { @@ -152,10 +152,10 @@ namespace QgsWms return vals; } - QList QgsWmsParameter::toIntList( const char delimiter ) const + QList QgsWmsParameter::toIntList( const char delimiter, bool skipEmptyParts ) const { bool ok = false; - const QList vals = QgsServerParameterDefinition::toIntList( ok, delimiter ); + const QList vals = QgsServerParameterDefinition::toIntList( ok, delimiter, skipEmptyParts ); if ( !ok ) { @@ -166,10 +166,10 @@ namespace QgsWms return vals; } - QList QgsWmsParameter::toDoubleList( const char delimiter ) const + QList QgsWmsParameter::toDoubleList( const char delimiter, bool skipEmptyParts ) const { bool ok = false; - const QList vals = QgsServerParameterDefinition::toDoubleList( ok, delimiter ); + const QList vals = QgsServerParameterDefinition::toDoubleList( ok, delimiter, skipEmptyParts ); if ( !ok ) { @@ -1271,77 +1271,77 @@ namespace QgsWms QStringList QgsWmsParameters::highlightLabelSize() const { - return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELSIZE ).toStringList( ';' ); + return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELSIZE ).toStringList( ';', false ); } QList QgsWmsParameters::highlightLabelSizeAsInt() const { - return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELSIZE ).toIntList( ';' ); + return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELSIZE ).toIntList( ';', false ); } QStringList QgsWmsParameters::highlightLabelColor() const { - return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELCOLOR ).toStringList( ';' ); + return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELCOLOR ).toStringList( ';', false ); } QList QgsWmsParameters::highlightLabelColorAsColor() const { - return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELCOLOR ).toColorList( ';' ); + return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELCOLOR ).toColorList( ';', false ); } QStringList QgsWmsParameters::highlightLabelWeight() const { - return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELWEIGHT ).toStringList( ';' ); + return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELWEIGHT ).toStringList( ';', false ); } QList QgsWmsParameters::highlightLabelWeightAsInt() const { - return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELWEIGHT ).toIntList( ';' ); + return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELWEIGHT ).toIntList( ';', false ); } QStringList QgsWmsParameters::highlightLabelFont() const { - return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELFONT ).toStringList( ';' ); + return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELFONT ).toStringList( ';', false ); } QStringList QgsWmsParameters::highlightLabelBufferColor() const { - return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELBUFFERCOLOR ).toStringList( ';' ); + return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELBUFFERCOLOR ).toStringList( ';', false ); } QList QgsWmsParameters::highlightLabelBufferColorAsColor() const { - return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELBUFFERCOLOR ).toColorList( ';' ); + return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELBUFFERCOLOR ).toColorList( ';', false ); } QStringList QgsWmsParameters::highlightLabelBufferSize() const { - return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELBUFFERSIZE ).toStringList( ';' ); + return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELBUFFERSIZE ).toStringList( ';', false ); } QList QgsWmsParameters::highlightLabelBufferSizeAsFloat() const { - return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELBUFFERSIZE ).toDoubleList( ';' ); + return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELBUFFERSIZE ).toDoubleList( ';', false ); } QList QgsWmsParameters::highlightLabelRotation() const { - return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABEL_ROTATION ).toDoubleList( ';' ); + return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABEL_ROTATION ).toDoubleList( ';', false ); } QList QgsWmsParameters::highlightLabelDistance() const { - return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABEL_DISTANCE ).toDoubleList( ';' ); + return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABEL_DISTANCE ).toDoubleList( ';', false ); } QStringList QgsWmsParameters::highlightLabelHorizontalAlignment() const { - return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABEL_HORIZONTAL_ALIGNMENT ).toStringList( ';' ); + return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABEL_HORIZONTAL_ALIGNMENT ).toStringList( ';', false ); } QStringList QgsWmsParameters::highlightLabelVerticalAlignment() const { - return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABEL_VERTICAL_ALIGNMENT ).toStringList( ';' ); + return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABEL_VERTICAL_ALIGNMENT ).toStringList( ';', false ); } QString QgsWmsParameters::wmsPrecision() const @@ -1806,91 +1806,91 @@ namespace QgsWms wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_GEOM, mapId ); if ( wmsParam.isValid() ) { - geoms = wmsParam.toGeomList( ';' ); + geoms = wmsParam.toGeomList( ';', false ); } QStringList slds; wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_SYMBOL, mapId ); if ( wmsParam.isValid() ) { - slds = wmsParam.toStringList( ';' ); + slds = wmsParam.toStringList( ';', false ); } QStringList labels; wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELSTRING, mapId ); if ( wmsParam.isValid() ) { - labels = wmsParam.toStringList( ';' ); + labels = wmsParam.toStringList( ';', false ); } QStringList fonts; wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELFONT, mapId ); if ( wmsParam.isValid() ) { - fonts = wmsParam.toStringList( ';' ); + fonts = wmsParam.toStringList( ';', false ); } QList colors; wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELCOLOR, mapId ); if ( wmsParam.isValid() ) { - colors = wmsParam.toColorList( ';' ); + colors = wmsParam.toColorList( ';', false ); } QList sizes; wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELSIZE, mapId ); if ( wmsParam.isValid() ) { - sizes = wmsParam.toIntList( ';' ); + sizes = wmsParam.toIntList( ';', false ); } QList weights; wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELWEIGHT, mapId ); if ( wmsParam.isValid() ) { - weights = wmsParam.toIntList( ';' ); + weights = wmsParam.toIntList( ';', false ); } QList bufferColors; wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELBUFFERCOLOR, mapId ); if ( wmsParam.isValid() ) { - bufferColors = wmsParam.toColorList( ';' ); + bufferColors = wmsParam.toColorList( ';', false ); } QList bufferSizes; wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELBUFFERSIZE, mapId ); if ( wmsParam.isValid() ) { - bufferSizes = wmsParam.toDoubleList( ';' ); + bufferSizes = wmsParam.toDoubleList( ';', false ); } QList rotations; wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABEL_ROTATION, mapId ); if ( wmsParam.isValid() ) { - rotations = wmsParam.toDoubleList( ';' ); + rotations = wmsParam.toDoubleList( ';', false ); } QList distances; wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABEL_DISTANCE, mapId ); if ( wmsParam.isValid() ) { - distances = wmsParam.toDoubleList( ';' ); + distances = wmsParam.toDoubleList( ';', false ); } QStringList halis; wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABEL_HORIZONTAL_ALIGNMENT, mapId ); if ( wmsParam.isValid() ) { - halis = wmsParam.toStringList(); + halis = wmsParam.toStringList( ';', false ); } QStringList valis; wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABEL_VERTICAL_ALIGNMENT, mapId ); if ( wmsParam.isValid() ) { - valis = wmsParam.toStringList(); + valis = wmsParam.toStringList( ';', false ); } int nHLayers = std::min( geoms.size(), slds.size() ); @@ -2056,9 +2056,9 @@ namespace QgsWms return mWmsParameters.value( QgsWmsParameter::WMTVER ).toString(); } - void QgsWmsParameters::log( const QString &msg ) const + void QgsWmsParameters::log( const QString &msg, const char *file, const char *function, int line ) const { - QgsMessageLog::logMessage( msg, QStringLiteral( "Server" ), Qgis::MessageLevel::Info ); + QgsMessageLog::logMessage( msg, QStringLiteral( "Server" ), Qgis::MessageLevel::Info, true, file, function, line ); } void QgsWmsParameters::raiseError( const QString &msg ) const @@ -2280,13 +2280,7 @@ namespace QgsWms bool QgsWmsParameters::pdfUseOgcBestPracticeFormatGeoreferencing() const { - bool useOgcGeoreferencing = false; - const QMap options = formatOptions(); - if ( options.contains( PdfFormatOption::USE_OGC_BEST_PRACTICE_FORMAT_GEOREFERENCING ) ) - { - useOgcGeoreferencing = QVariant( options[PdfFormatOption::USE_OGC_BEST_PRACTICE_FORMAT_GEOREFERENCING] ).toBool(); - } - return useOgcGeoreferencing; + return false; } QStringList QgsWmsParameters::pdfExportMapThemes() const diff --git a/src/server/services/wms/qgswmsparameters.h b/src/server/services/wms/qgswmsparameters.h index 117b9e9362b9..f5e1578f986a 100644 --- a/src/server/services/wms/qgswmsparameters.h +++ b/src/server/services/wms/qgswmsparameters.h @@ -214,42 +214,47 @@ namespace QgsWms * Converts the parameter into a list of strings and keeps empty parts * Default style value is an empty string * \param delimiter The character used for delimiting + * \param skipEmptyParts for splitting * \returns A list of strings * \since QGIS 3.8 */ - QStringList toStyleList( const char delimiter = ',' ) const; + QStringList toStyleList( const char delimiter = ',', bool skipEmptyParts = false ) const; /** * Converts the parameter into a list of geometries. * \param delimiter The character delimiting string geometries + * \param skipEmptyParts for splitting * \returns A list of geometries * \throws QgsBadRequestException Invalid parameter exception */ - QList toGeomList( const char delimiter = ',' ) const; + QList toGeomList( const char delimiter = ',', bool skipEmptyParts = true ) const; /** * Converts the parameter into a list of integers. * \param delimiter The character delimiting string integers + * \param skipEmptyParts for splitting * \returns A list of integers * \throws QgsBadRequestException Invalid parameter exception */ - QList toIntList( const char delimiter = ',' ) const; + QList toIntList( const char delimiter = ',', bool skipEmptyParts = true ) const; /** * Converts the parameter into a list of doubles. * \param delimiter The character delimiting string doubles + * \param skipEmptyParts for splitting * \returns A list of doubles * \throws QgsBadRequestException Invalid parameter exception */ - QList toDoubleList( const char delimiter = ',' ) const; + QList toDoubleList( const char delimiter = ',', bool skipEmptyParts = true ) const; /** * Converts the parameter into a list of colors. * \param delimiter The character delimiting string colors + * \param skipEmptyParts for splitting * \returns A list of colors * \throws QgsBadRequestException Invalid parameter exception */ - QList toColorList( const char delimiter = ',' ) const; + QList toColorList( const char delimiter = ',', bool skipEmptyParts = true ) const; /** * Converts the parameter into a rectangle. @@ -1471,6 +1476,7 @@ namespace QgsWms /** * Returns true if OGC best practice georeferencing shall be used * \since QGIS 3.32 + * \deprecated QGIS 3.42. Will always return false starting with 3.42. Only ISO 32000 georeferencing is handled. */ bool pdfUseOgcBestPracticeFormatGeoreferencing() const; @@ -1530,7 +1536,7 @@ namespace QgsWms QgsWmsParameter idParameter( QgsWmsParameter::Name name, int id ) const; void raiseError( const QString &msg ) const; - void log( const QString &msg ) const; + void log( const QString &msg, const char *file = __builtin_FILE(), const char *function = __builtin_FUNCTION(), int line = __builtin_LINE() ) const; QgsWmsParametersExternalLayer externalLayerParameter( const QString &name ) const; diff --git a/src/server/services/wms/qgswmsrenderer.cpp b/src/server/services/wms/qgswmsrenderer.cpp index a7ddcc61a955..51e637df80d0 100644 --- a/src/server/services/wms/qgswmsrenderer.cpp +++ b/src/server/services/wms/qgswmsrenderer.cpp @@ -69,6 +69,7 @@ #include "qgsattributeeditorcontainer.h" #include "qgsattributeeditorelement.h" #include "qgsattributeeditorfield.h" +#include "qgsattributeeditorrelation.h" #include "qgsdimensionfilter.h" #include @@ -527,7 +528,7 @@ namespace QgsWms configureLayers( layers, &mapSettings ); // configure map settings (background, DPI, ...) - std::unique_ptr image( new QImage() ); + auto image = std::make_unique(); configureMapSettings( image.get(), mapSettings ); // add layers to map settings @@ -710,7 +711,6 @@ namespace QgsWms exportSettings.appendGeoreference = mWmsParameters.pdfAppendGeoreference(); exportSettings.simplifyGeometries = mWmsParameters.pdfSimplifyGeometries(); exportSettings.useIso32000ExtensionFormatGeoreferencing = mWmsParameters.pdfUseIso32000ExtensionFormatGeoreferencing(); - exportSettings.useOgcBestPracticeFormatGeoreferencing = mWmsParameters.pdfUseOgcBestPracticeFormatGeoreferencing(); if ( mWmsParameters.pdfLosslessImageCompression() ) { exportSettings.flags |= QgsLayoutRenderContext::FlagLosslessImageRendering; @@ -1171,7 +1171,7 @@ namespace QgsWms // add layers to dxf - std::unique_ptr dxf = std::make_unique(); + auto dxf = std::make_unique(); dxf->setExtent( mapExtent ); dxf->setDestinationCrs( outputCRS ); dxf->addLayers( dxfLayers ); @@ -1218,9 +1218,8 @@ namespace QgsWms pdfExportDetails.keywords = QgsProject::instance()->metadata().keywords(); } pdfExportDetails.useIso32000ExtensionFormatGeoreferencing = mWmsParameters.pdfUseIso32000ExtensionFormatGeoreferencing(); - pdfExportDetails.useOgcBestPracticeFormatGeoreferencing = mWmsParameters.pdfUseOgcBestPracticeFormatGeoreferencing(); const bool geospatialPdf = mWmsParameters.pdfAppendGeoreference(); - std::unique_ptr pdf = std::make_unique( ms, tmpFileName, QStringLiteral( "PDF" ), false, QgsTask::Hidden, geospatialPdf, pdfExportDetails ); + auto pdf = std::make_unique( ms, tmpFileName, QStringLiteral( "PDF" ), false, QgsTask::Hidden, geospatialPdf, pdfExportDetails ); if ( mWmsParameters.pdfAppendGeoreference() ) { pdf->setSaveWorldFile( true ); @@ -1424,6 +1423,8 @@ namespace QgsWms //then set destinationCrs mapSettings.setDestinationCrs( outputCRS ); + mapSettings.setTransformContext( mProject->transformContext() ); + // Change x- and y- of BBOX for WMS 1.3.0 if axis inverted if ( mWmsParameters.versionAsNumber() >= QgsProjectVersion( 1, 3, 0 ) && outputCRS.hasAxisInverted() ) { @@ -2809,6 +2810,7 @@ namespace QgsWms { "features", json::array() }, }; const bool withGeometry = ( QgsServerProjectUtils::wmsFeatureInfoAddWktGeometry( *mProject ) && mWmsParameters.withGeometry() ); + const bool withDisplayName = mWmsParameters.withDisplayName(); const QDomNodeList layerList = doc.elementsByTagName( QStringLiteral( "Layer" ) ); for ( int i = 0; i < layerList.size(); ++i ) @@ -2840,6 +2842,7 @@ namespace QgsWms continue; QMap fidMap; + QMap fidDisplayNameMap; for ( int j = 0; j < featuresNode.size(); ++j ) { @@ -2880,6 +2883,24 @@ namespace QgsWms feature.setGeometry( QgsGeometry::fromWkt( wkt ) ); } } + + // Note: this is the feature expression display name, not the field alias + if ( withDisplayName ) + { + QString displayName; + const QDomNodeList attrs = featureNode.elementsByTagName( "Attribute" ); + for ( int k = 0; k < attrs.count(); k++ ) + { + const QDomElement elm = attrs.at( k ).toElement(); + if ( elm.attribute( QStringLiteral( "name" ) ).compare( "displayName" ) == 0 ) + { + displayName = elm.attribute( "value" ); + break; + } + } + fidDisplayNameMap.insert( feature.id(), displayName ); + } + features << feature; // search attributes to export (one time only) @@ -2891,7 +2912,6 @@ namespace QgsWms { const QDomElement attributeElement = attributesNode.at( k ).toElement(); const QString fieldName = attributeElement.attribute( QStringLiteral( "name" ) ); - attributes << feature.fieldNameIndex( fieldName ); } } @@ -2908,7 +2928,12 @@ namespace QgsWms for ( const auto &feature : std::as_const( features ) ) { const QString id = QStringLiteral( "%1.%2" ).arg( layerName ).arg( fidMap.value( feature.id() ) ); - json["features"].push_back( exporter.exportFeatureToJsonObject( feature, QVariantMap(), id ) ); + QVariantMap extraProperties; + if ( withDisplayName ) + { + extraProperties.insert( QStringLiteral( "display_name" ), fidDisplayNameMap.value( feature.id() ) ); + } + json["features"].push_back( exporter.exportFeatureToJsonObject( feature, extraProperties, id ) ); } } else // raster layer @@ -2982,6 +3007,9 @@ namespace QgsWms expressionContext << QgsExpressionContextUtils::layerScope( layer ); expressionContext.setFeature( *feat ); + QgsEditFormConfig editConfig { layer ? layer->editFormConfig() : QgsEditFormConfig() }; + const bool honorFormConfig { layer && QgsServerProjectUtils::wmsFeatureInfoUseAttributeFormSettings( *mProject ) && editConfig.layout() == Qgis::AttributeFormLayout::DragAndDrop }; + // always add bounding box info if feature contains geometry and has been // explicitly configured in the project if ( QgsServerProjectUtils::wmsFeatureInfoAddWktGeometry( *mProject ) && !geom.isNull() && geom.type() != Qgis::GeometryType::Unknown && geom.type() != Qgis::GeometryType::Null ) @@ -3018,6 +3046,74 @@ namespace QgsWms typeNameElement.appendChild( bbElem ); } + // find if an attribute is in any form tab + std::function findAttributeInTree; + findAttributeInTree = [&findAttributeInTree, &layer]( const QString &attributeName, const QgsAttributeEditorElement *group ) -> bool { + const QgsAttributeEditorContainer *container = dynamic_cast( group ); + if ( container ) + { + const QList children = container->children(); + for ( const QgsAttributeEditorElement *child : children ) + { + switch ( child->type() ) + { + case Qgis::AttributeEditorType::Container: + { + if ( findAttributeInTree( attributeName, child ) ) + { + return true; + } + break; + } + case Qgis::AttributeEditorType::Field: + { + if ( child->name() == attributeName ) + { + return true; + } + break; + } + case Qgis::AttributeEditorType::Relation: + { + const QgsAttributeEditorRelation *relationEditor = static_cast( child ); + if ( relationEditor ) + { + const QgsRelation &relation { relationEditor->relation() }; + if ( relation.referencedLayer() == layer ) + { + const QgsAttributeList &referencedFields { relation.referencedFields() }; + for ( const auto &idx : std::as_const( referencedFields ) ) + { + const QgsField f { layer->fields().at( idx ) }; + if ( f.name() == attributeName ) + { + return true; + } + } + } + else if ( relation.referencingLayer() == layer ) + { + const QgsAttributeList &referencingFields { relation.referencingFields() }; + for ( const auto &idx : std::as_const( referencingFields ) ) + { + const QgsField f { layer->fields().at( idx ) }; + if ( f.name() == attributeName ) + { + return true; + } + } + } + } + break; + } + default: + break; + } + } + } + return false; + }; + if ( withGeom && !geom.isNull() ) { //add geometry column (as gml) @@ -3066,6 +3162,15 @@ namespace QgsWms continue; } + if ( honorFormConfig ) + { + const QgsAttributeEditorContainer *editorContainer = editConfig.invisibleRootContainer(); + if ( !editorContainer || !findAttributeInTree( attributeName, editorContainer ) ) + { + continue; + } + } + QDomElement fieldElem = doc.createElement( "qgs:" + attributeName.replace( ' ', '_' ) ); QString fieldTextString = featureAttributes.at( i ).toString(); if ( layer ) @@ -3153,6 +3258,9 @@ namespace QgsWms } } + // Make sure the map unit tolerance is at least 1 pixel + mapUnitTolerance = std::max( mapUnitTolerance, 1.0 * rct.mapToPixel().mapUnitsPerPixel() ); + QgsRectangle mapRectangle( infoPoint.x() - mapUnitTolerance, infoPoint.y() - mapUnitTolerance, infoPoint.x() + mapUnitTolerance, infoPoint.y() + mapUnitTolerance ); return ( mapSettings.mapToLayerCoordinates( ml, mapRectangle ) ); } @@ -3196,7 +3304,7 @@ namespace QgsWms // create vector layer const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() }; - std::unique_ptr layer = std::make_unique( url, param.mName, QLatin1String( "memory" ), options ); + auto layer = std::make_unique( url, param.mName, QLatin1String( "memory" ), options ); if ( !layer->isValid() ) { continue; @@ -3498,7 +3606,7 @@ namespace QgsWms } if ( !exp.isEmpty() ) { - std::unique_ptr expression( new QgsExpression( exp ) ); + auto expression = std::make_unique( exp ); if ( expression ) { mFeatureFilter.setFilter( filteredLayer, *expression ); diff --git a/src/server/services/wmts/qgswmtsparameters.cpp b/src/server/services/wmts/qgswmtsparameters.cpp index e8a320cbf3f1..080a3e7df8a7 100644 --- a/src/server/services/wmts/qgswmtsparameters.cpp +++ b/src/server/services/wmts/qgswmtsparameters.cpp @@ -292,8 +292,8 @@ namespace QgsWmts return version; } - void QgsWmtsParameters::log( const QString &msg ) const + void QgsWmtsParameters::log( const QString &msg, const char *file, const char *function, int line ) const { - QgsMessageLog::logMessage( msg, "Server", Qgis::MessageLevel::Info ); + QgsMessageLog::logMessage( msg, "Server", Qgis::MessageLevel::Info, true, file, function, line ); } } // namespace QgsWmts diff --git a/src/server/services/wmts/qgswmtsparameters.h b/src/server/services/wmts/qgswmtsparameters.h index d128d8469641..06c605229e84 100644 --- a/src/server/services/wmts/qgswmtsparameters.h +++ b/src/server/services/wmts/qgswmtsparameters.h @@ -314,7 +314,7 @@ namespace QgsWmts bool loadParameter( const QString &key, const QString &value ) override; void save( const QgsWmtsParameter ¶meter ); - void log( const QString &msg ) const; + void log( const QString &msg, const char *file = __builtin_FILE(), const char *function = __builtin_FUNCTION(), int line = __builtin_LINE() ) const; QList mVersions; QMap mWmtsParameters; diff --git a/src/ui/3d/qgspointcloud3dsymbolwidget.ui b/src/ui/3d/qgspointcloud3dsymbolwidget.ui index a1bcc3dbce7a..fe8b069dcf70 100644 --- a/src/ui/3d/qgspointcloud3dsymbolwidget.ui +++ b/src/ui/3d/qgspointcloud3dsymbolwidget.ui @@ -7,7 +7,7 @@ 0 0 581 - 553 + 728 @@ -34,14 +34,8 @@ false - - - 0 - - - 3 - - + + @@ -120,14 +114,7 @@ - - - - Show bounding boxes - - - - + Render as a Surface (Triangulate) @@ -188,13 +175,45 @@ + + + + Show bounding boxes + + + + + + + Virtual Point Cloud Options + + + false + + + false + + + + + + + + + When zoomed out + + + + + + - 0 + 5 diff --git a/src/ui/annotations/qgsannotationlinetextwidgetbase.ui b/src/ui/annotations/qgsannotationlinetextwidgetbase.ui index 49bc5e5b3914..7b085b40774d 100644 --- a/src/ui/annotations/qgsannotationlinetextwidgetbase.ui +++ b/src/ui/annotations/qgsannotationlinetextwidgetbase.ui @@ -13,7 +13,7 @@ Point Text Annotation - + 0 @@ -26,7 +26,27 @@ 0 - + + + + Text format + + + + + + + + 0 + 0 + + + + Text format + + + + @@ -38,17 +58,17 @@ Insert/Edit Expression… - QToolButton::ToolButtonPopupMode::MenuButtonPopup + QToolButton::MenuButtonPopup - Qt::ToolButtonStyle::ToolButtonTextOnly + Qt::ToolButtonTextOnly - Qt::ArrowType::DownArrow + Qt::DownArrow - + @@ -58,7 +78,7 @@ - + Properties @@ -100,7 +120,7 @@ - Qt::FocusPolicy::StrongFocus + Qt::StrongFocus @@ -116,26 +136,28 @@ - + - - - + + QgsDoubleSpinBox + QDoubleSpinBox +
qgsdoublespinbox.h
+
+ + QgsFontButton + QToolButton +
qgsfontbutton.h
+
QgsAnnotationItemCommonPropertiesWidget QWidget
qgsannotationitemcommonpropertieswidget.h
1
- - QgsDoubleSpinBox - QDoubleSpinBox -
qgsdoublespinbox.h
-
QgsRichTextEditor QWidget diff --git a/src/ui/annotations/qgsannotationpointtextwidgetbase.ui b/src/ui/annotations/qgsannotationpointtextwidgetbase.ui index 2bd54142f364..b3285951679a 100644 --- a/src/ui/annotations/qgsannotationpointtextwidgetbase.ui +++ b/src/ui/annotations/qgsannotationpointtextwidgetbase.ui @@ -13,7 +13,7 @@ Point Text Annotation - + 0 @@ -26,11 +26,14 @@ 0 - - - + + + 0 + 0 + + Rotation @@ -70,16 +73,13 @@ - - - - - - - - 0 - 150 - + + + + + 0 + 0 + @@ -95,45 +95,80 @@ Insert/Edit Expression… - QToolButton::ToolButtonPopupMode::MenuButtonPopup + QToolButton::MenuButtonPopup - Qt::ToolButtonStyle::ToolButtonTextOnly + Qt::ToolButtonTextOnly - Qt::ArrowType::DownArrow + Qt::DownArrow - + + + + Alignment + + + + + + + + + 0 + 0 + + + + Text format + + + + + + + + 0 + 2 + + + + - + - Alignment + Text format - - QgsAnnotationItemCommonPropertiesWidget - QWidget -
qgsannotationitemcommonpropertieswidget.h
- 1 -
QgsDoubleSpinBox QDoubleSpinBox
qgsdoublespinbox.h
+ + QgsFontButton + QToolButton +
qgsfontbutton.h
+
QgsAlignmentComboBox QComboBox
qgsalignmentcombobox.h
+ + QgsAnnotationItemCommonPropertiesWidget + QWidget +
qgsannotationitemcommonpropertieswidget.h
+ 1 +
QgsRichTextEditor QWidget diff --git a/src/ui/annotations/qgsannotationrectangulartextwidgetbase.ui b/src/ui/annotations/qgsannotationrectangulartextwidgetbase.ui index aafa452027e2..338856556832 100644 --- a/src/ui/annotations/qgsannotationrectangulartextwidgetbase.ui +++ b/src/ui/annotations/qgsannotationrectangulartextwidgetbase.ui @@ -7,7 +7,7 @@ 0 0 321 - 716 + 779 @@ -23,13 +23,67 @@ 0 - - - - - 0 - 150 - + + + + Frame + + + true + + + + + + Symbol + + + + + + + + 0 + 0 + + + + Change… + + + + + + + + + + + + + Vertical alignment + + + + + + + + 0 + 0 + + + + Insert/Edit Expression… + + + QToolButton::MenuButtonPopup + + + Qt::ToolButtonTextOnly + + + Qt::DownArrow @@ -65,19 +119,119 @@ - - + + + + + + + + + + Horizontal alignment + + + + + + + + + + Width + + + + + + + + 0 + 0 + + + + 6 + + + 100000.000000000000000 + + + 0.200000000000000 + + + 1.000000000000000 + + + false + + + + + + + Height + + + + + + + + 0 + 0 + + + + 6 + + + 100000.000000000000000 + + + 0.200000000000000 + + + 1.000000000000000 + + + false + + + + + + + Unit + + + + + + + + 0 + 0 + + + + Qt::StrongFocus + + + + + + + + 0 - 0 + 150 - - - @@ -247,209 +401,77 @@ - - - - Vertical alignment - - - - + - Horizontal alignment + Text format - - - - - - - - - - Frame - - - true - - - - - - Symbol - - - - - - - - 0 - 0 - - - - Change… - - - - - - - - - - - - - Width - - - - - - - - 0 - 0 - - - - 6 - - - 100000.000000000000000 - - - 0.200000000000000 - - - 1.000000000000000 - - - false - - - - - - - Height - - - - - - - - 0 - 0 - - - - 6 - - - 100000.000000000000000 - - - 0.200000000000000 - - - 1.000000000000000 - - - false - - - - - - - Unit - - - - - - - - 0 - 0 - - - - Qt::StrongFocus - - - - - - - - - - + - + 0 0 - Insert/Edit Expression… - - - QToolButton::MenuButtonPopup - - - Qt::ToolButtonTextOnly + Text format - - Qt::DownArrow + + + + + + + 0 + 0 + - - QgsAnnotationItemCommonPropertiesWidget - QWidget -
qgsannotationitemcommonpropertieswidget.h
- 1 -
- - QgsSymbolButton - QToolButton -
qgssymbolbutton.h
-
QgsDoubleSpinBox QDoubleSpinBox
qgsdoublespinbox.h
- QgsUnitSelectionWidget - QWidget -
qgsunitselectionwidget.h
- 1 + QgsFontButton + QToolButton +
qgsfontbutton.h
QgsAlignmentComboBox QComboBox
qgsalignmentcombobox.h
+ + QgsAnnotationItemCommonPropertiesWidget + QWidget +
qgsannotationitemcommonpropertieswidget.h
+ 1 +
QgsRichTextEditor QWidget
qgsrichtexteditor.h
1
+ + QgsSymbolButton + QToolButton +
qgssymbolbutton.h
+
+ + QgsUnitSelectionWidget + QWidget +
qgsunitselectionwidget.h
+ 1 +
QgsCollapsibleGroupBox QGroupBox diff --git a/src/ui/auth/qgsauthauthoritieseditor.ui b/src/ui/auth/qgsauthauthoritieseditor.ui index d85912c6bf33..0ea828b34b07 100644 --- a/src/ui/auth/qgsauthauthoritieseditor.ui +++ b/src/ui/auth/qgsauthauthoritieseditor.ui @@ -107,7 +107,7 @@ - Import certificate(s) to authentication database + Import certificate(s) to authentication storage @@ -121,7 +121,7 @@ - Remove certificate from authentication database + Remove certificate from authentication storage diff --git a/src/ui/auth/qgsauthcertificatemanager.ui b/src/ui/auth/qgsauthcertificatemanager.ui index f8def8142efa..a9f18352a910 100644 --- a/src/ui/auth/qgsauthcertificatemanager.ui +++ b/src/ui/auth/qgsauthcertificatemanager.ui @@ -92,7 +92,7 @@ color: rgb(128, 128, 128); - Note: Editing writes directly to authentication database + Note: Editing writes directly to authentication storage Qt::AlignCenter diff --git a/src/ui/auth/qgsauthconfigedit.ui b/src/ui/auth/qgsauthconfigedit.ui index 0aa5294bf056..7b2f22ebfd3c 100644 --- a/src/ui/auth/qgsauthconfigedit.ui +++ b/src/ui/auth/qgsauthconfigedit.ui @@ -59,7 +59,7 @@ color: rgb(128, 128, 128); - Note: Saving writes directly to authentication database + Note: Saving writes directly to authentication storage Qt::AlignCenter diff --git a/src/ui/auth/qgsauthconfiguriedit.ui b/src/ui/auth/qgsauthconfiguriedit.ui index 035c93e3858d..83e8b7a579a4 100644 --- a/src/ui/auth/qgsauthconfiguriedit.ui +++ b/src/ui/auth/qgsauthconfiguriedit.ui @@ -62,7 +62,7 @@ color: rgb(128, 128, 128); - Note: Button actions above affect authentication database + Note: Button actions above affect authentication storage Qt::AlignCenter diff --git a/src/ui/auth/qgsautheditorwidgets.ui b/src/ui/auth/qgsautheditorwidgets.ui index 8358f7fffce8..3da9d184fb3a 100644 --- a/src/ui/auth/qgsautheditorwidgets.ui +++ b/src/ui/auth/qgsautheditorwidgets.ui @@ -145,7 +145,7 @@ QLabel {color: rgb(128, 128, 128);} - Note: Editing writes directly to authentication database + Note: Editing writes directly to authentication storage Qt::AlignCenter diff --git a/src/ui/auth/qgsauthidentitieseditor.ui b/src/ui/auth/qgsauthidentitieseditor.ui index 3c8ef986ade2..ea4fbe8f770c 100644 --- a/src/ui/auth/qgsauthidentitieseditor.ui +++ b/src/ui/auth/qgsauthidentitieseditor.ui @@ -55,7 +55,7 @@ - Import identity bundle to authentication database + Import identity bundle to authentication storage @@ -69,7 +69,7 @@ - Remove identity bundle from authentication database + Remove identity bundle from authentication storage diff --git a/src/ui/auth/qgsauthmasterpassresetdialog.ui b/src/ui/auth/qgsauthmasterpassresetdialog.ui index 547a0c4fbda3..c0bb9c05f931 100644 --- a/src/ui/auth/qgsauthmasterpassresetdialog.ui +++ b/src/ui/auth/qgsauthmasterpassresetdialog.ui @@ -18,7 +18,6 @@ - 75 false true @@ -42,7 +41,6 @@ - 75 false true @@ -63,42 +61,39 @@ - - - - - Qt::Horizontal - - - - 12 - 20 - - - - - - - - Keep backup of current database - - - - - - - + - true + false + true - - QLabel { color: rgb(128, 128, 128); } + + Re-enter NEW password + + + + + + + QLineEdit::Password + + + Required + + + + + + Keep backup of current database + + + + + - Your authentication database will be duplicated -and re-encrypted using new password + true @@ -140,6 +135,7 @@ and re-encrypted using new password leMasterPassCurrent leMasterPassNew + leMasterPassNew2 chkKeepBackup diff --git a/src/ui/auth/qgsauthsettingswidget.ui b/src/ui/auth/qgsauthsettingswidget.ui index aaf624d849f9..e2862a735b65 100644 --- a/src/ui/auth/qgsauthsettingswidget.ui +++ b/src/ui/auth/qgsauthsettingswidget.ui @@ -101,7 +101,7 @@ - Configurations store encrypted credentials in the QGIS authentication database. + Configurations store encrypted credentials in the QGIS authentication storage. Qt::PlainText diff --git a/src/ui/georeferencer/qgsgeorefpluginguibase.ui b/src/ui/georeferencer/qgsgeorefpluginguibase.ui index 7033591943bb..e5827192b361 100644 --- a/src/ui/georeferencer/qgsgeorefpluginguibase.ui +++ b/src/ui/georeferencer/qgsgeorefpluginguibase.ui @@ -121,6 +121,7 @@ + @@ -150,7 +151,7 @@ - Qt::AllDockWidgetAreas + Qt::DockWidgetArea::AllDockWidgetAreas GCP table @@ -396,6 +397,24 @@ Open Vector… + + + true + + + + :/images/themes/default/cadtools/cad.svg:/images/themes/default/cadtools/cad.svg + + + Advanced Digitizing Dock + + + Show Advanced Digitizing Dock + + + QAction::MenuRole::NoRole + + @@ -407,7 +426,6 @@ - diff --git a/src/ui/georeferencer/qgstransformsettingsdialogbase.ui b/src/ui/georeferencer/qgstransformsettingsdialogbase.ui index 73021c397dc5..941522fc74b2 100644 --- a/src/ui/georeferencer/qgstransformsettingsdialogbase.ui +++ b/src/ui/georeferencer/qgstransformsettingsdialogbase.ui @@ -7,7 +7,7 @@ 0 0 438 - 702 + 646 @@ -17,10 +17,10 @@ - Qt::Horizontal + Qt::Orientation::Horizontal - QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok + QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Help|QDialogButtonBox::StandardButton::Ok @@ -49,8 +49,8 @@ 0 - - + + 0 @@ -58,35 +58,19 @@ - Compression - - - cmbCompressionComboBox + Output file - - + + - Use 0 for transparency when needed - - - false - - - - - - - - 0 - 0 - + Create world file only (linear transforms) - - + + 0 @@ -94,17 +78,10 @@ - Output file + Resampling method - - - - - - - - - Create world file only (linear transforms) + + cmbResampling @@ -175,20 +152,32 @@ - - - - - 0 - 0 - - + + - Resampling method + Use 0 for transparency when needed - - cmbResampling + + false + + + + + + + + + + Raster creation options + + + true + + + + + @@ -250,12 +239,6 @@ Reports - - - - - - @@ -270,6 +253,12 @@ + + + + + + @@ -318,7 +307,7 @@ - Qt::StrongFocus + Qt::FocusPolicy::StrongFocus @@ -328,7 +317,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -365,12 +354,23 @@ QDoubleSpinBox
georeferencer/qgsvalidateddoublespinbox.h
+ + QgsRasterFormatSaveOptionsWidget + QWidget +
qgsrasterformatsaveoptionswidget.h
+ 1 +
+ + QgsCollapsibleGroupBox + QGroupBox +
qgscollapsiblegroupbox.h
+ 1 +
cmbTransformType mCrsSelector cmbResampling - cmbCompressionComboBox mWorldFileCheckBox cbxZeroAsTrans cbxUserResolution diff --git a/src/ui/layout/qgspdfexportoptions.ui b/src/ui/layout/qgspdfexportoptions.ui index f7c2da5e9e2f..a88d53cec120 100644 --- a/src/ui/layout/qgspdfexportoptions.ui +++ b/src/ui/layout/qgspdfexportoptions.ui @@ -175,7 +175,7 @@ 0 - + Include multiple map themes @@ -193,17 +193,7 @@ - - - - Format - - - - - - - + Layer Structure @@ -359,7 +349,6 @@ mTextRenderFormatComboBox mComboImageCompression mGeospatialPDFGroupBox - mGeospatialPdfFormatComboBox mIncludeMapThemesCheck mThemesList mGeospatialPdfStructureTree diff --git a/src/ui/mesh/qgsmeshdatasetgrouptreewidgetbase.ui b/src/ui/mesh/qgsmeshdatasetgrouptreewidgetbase.ui index af99612eb5fe..f61e4ec2205d 100644 --- a/src/ui/mesh/qgsmeshdatasetgrouptreewidgetbase.ui +++ b/src/ui/mesh/qgsmeshdatasetgrouptreewidgetbase.ui @@ -68,6 +68,9 @@ + + Remove Extra Dataset from Mesh + false diff --git a/src/ui/qgsdelimitedtextsourceselectbase.ui b/src/ui/qgsdelimitedtextsourceselectbase.ui index 5e134aeb5e0a..44c43ace6415 100644 --- a/src/ui/qgsdelimitedtextsourceselectbase.ui +++ b/src/ui/qgsdelimitedtextsourceselectbase.ui @@ -79,32 +79,6 @@ 0 - - - - - 0 - 0 - - - - Layer name - - - - - - - - 0 - 0 - - - - Name to display in the map legend - - - @@ -121,7 +95,7 @@ Select the file encoding - QComboBox::InsertAtTop + QComboBox::InsertPolicy::InsertAtTop @@ -145,7 +119,7 @@
- QFrame::NoFrame + QFrame::Shape::NoFrame true @@ -155,8 +129,8 @@ 0 0 - 703 - 647 + 698 + 655 @@ -179,14 +153,14 @@ 0 - + 0 0 - + File Format @@ -297,10 +271,10 @@ - QFrame::StyledPanel + QFrame::Shape::StyledPanel - QFrame::Raised + QFrame::Shadow::Raised @@ -332,7 +306,7 @@ Escape - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter txtEscapeChars @@ -348,10 +322,10 @@ - Quote + &Quote - Qt::AlignJustify|Qt::AlignVCenter + Qt::AlignmentFlag::AlignJustify|Qt::AlignmentFlag::AlignVCenter txtQuoteChars @@ -497,7 +471,7 @@ Others - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter txtDelimiterOther @@ -544,10 +518,10 @@ - QFrame::StyledPanel + QFrame::Shape::StyledPanel - QFrame::Raised + QFrame::Shadow::Raised @@ -603,14 +577,14 @@ - + 0 0 - + Record and Fields Options @@ -791,14 +765,14 @@ - + 0 0 - + Geometry Definition @@ -942,7 +916,7 @@ X field - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter cmbXField @@ -1246,7 +1220,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -1262,14 +1236,14 @@ - + 0 0 - + Layer Settings @@ -1370,7 +1344,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -1411,7 +1385,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -1441,10 +1415,10 @@ - Qt::Horizontal + Qt::Orientation::Horizontal - QDialogButtonBox::Help + QDialogButtonBox::StandardButton::Help @@ -1452,9 +1426,21 @@ + + QgsScrollArea + QScrollArea +
qgsscrollarea.h
+ 1 +
+ + QgsProjectionSelectionWidget + QWidget +
qgsprojectionselectionwidget.h
+ 1 +
QgsCollapsibleGroupBox - QGroupBox + QWidget
qgscollapsiblegroupbox.h
1
@@ -1468,20 +1454,8 @@ QWidget
qgsfilewidget.h
- - QgsProjectionSelectionWidget - QWidget -
qgsprojectionselectionwidget.h
-
- - QgsScrollArea - QScrollArea -
qgsscrollarea.h
- 1 -
- txtLayerName cmbEncoding scrollArea delimiterCSV diff --git a/src/ui/qgsmapsavedialog.ui b/src/ui/qgsmapsavedialog.ui index e666b8ec47fa..1a35f185e67e 100644 --- a/src/ui/qgsmapsavedialog.ui +++ b/src/ui/qgsmapsavedialog.ui @@ -120,17 +120,7 @@ 0 - - - - - - - Format - - - - + Include vector feature information @@ -429,7 +419,6 @@ Rasterizing the map is recommended when such effects are used. mSaveWorldFile mExportMetadataCheckBox mGeospatialPDFGroupBox - mGeospatialPdfFormatComboBox mExportGeospatialPdfFeaturesCheckBox mSaveAsRaster mSimplifyGeometriesCheckbox diff --git a/src/ui/qgspgnewconnectionbase.ui b/src/ui/qgspgnewconnectionbase.ui index 943cbf587194..30641ca15325 100644 --- a/src/ui/qgspgnewconnectionbase.ui +++ b/src/ui/qgspgnewconnectionbase.ui @@ -7,7 +7,7 @@ 0 0 448 - 510 + 573 @@ -236,6 +236,13 @@ + + + + Also list raster overview tables + + + diff --git a/src/ui/qgsrichtexteditorbase.ui b/src/ui/qgsrichtexteditorbase.ui index 06573732ad7c..b0e9f7dc58a1 100644 --- a/src/ui/qgsrichtexteditorbase.ui +++ b/src/ui/qgsrichtexteditorbase.ui @@ -7,7 +7,7 @@ 0 0 846 - 312 + 705 @@ -51,7 +51,7 @@ - QTextEdit::AutoFormattingFlag::AutoNone + QTextEdit::AutoNone true diff --git a/src/ui/qgswfssourceselectbase.ui b/src/ui/qgswfssourceselectbase.ui index 6f16d2cc2b42..c64e31601015 100644 --- a/src/ui/qgswfssourceselectbase.ui +++ b/src/ui/qgswfssourceselectbase.ui @@ -14,105 +14,50 @@ Add WFS Layer from a Server - - - - Coordinate Reference System + + + + Keep dialog open - - - 6 - - - 9 - - - 9 - - - 9 - - - 9 - - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 441 - 23 - - - - - - - - false - - - Change… - - - - - - - - - - Use title for layer name - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Keep dialog open - - - - + + + + true + + + + + - - - - Qt::Horizontal + + + + QAbstractItemView::EditTrigger::NoEditTriggers - - QDialogButtonBox::Help + + true + + + QAbstractItemView::SelectionMode::ExtendedSelection + + + true + + + true + + + + + + + Only request features overlapping the view extent - + Server Connections @@ -175,10 +120,10 @@ - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Expanding + QSizePolicy::Policy::Expanding @@ -213,45 +158,76 @@ - - - - QAbstractItemView::NoEditTriggers - - - true - - - QAbstractItemView::ExtendedSelection - - - true - - - true - - - - - - - Only request features overlapping the view extent - - - - - - - true + + + + Qt::Orientation::Horizontal - - + + QDialogButtonBox::StandardButton::Help + + + + Coordinate Reference System + + + + 6 + + + 9 + + + 9 + + + 9 + + + 9 + + + + + + + + + + + + Qt::Orientation::Horizontal + + + QSizePolicy::Policy::Expanding + + + + 441 + 23 + + + + + + + + false + + + Change… + + + + + + @@ -270,8 +246,6 @@ btnLoad btnSave treeView - cbxUseTitleLayerName - mHoldDialogOpen cbxFeatureCurrentViewExtent btnChangeSpatialRefSys diff --git a/src/ui/qgswmssourceselectbase.ui b/src/ui/qgswmssourceselectbase.ui index 4591e4ebe542..f1c4a180c01c 100644 --- a/src/ui/qgswmssourceselectbase.ui +++ b/src/ui/qgswmssourceselectbase.ui @@ -39,14 +39,14 @@ - QDialogButtonBox::Help + QDialogButtonBox::StandardButton::Help - QFrame::NoFrame + QFrame::Shape::NoFrame true @@ -57,7 +57,7 @@ 0 0 744 - 639 + 647 @@ -142,7 +142,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -256,7 +256,7 @@ - Request step size + Re&quest step size mTileWidth @@ -280,7 +280,7 @@ - Qt::StrongFocus + Qt::FocusPolicy::StrongFocus @@ -303,7 +303,7 @@ - QAbstractItemView::ExtendedSelection + QAbstractItemView::SelectionMode::ExtendedSelection true @@ -380,7 +380,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -462,10 +462,10 @@ true - QAbstractItemView::SingleSelection + QAbstractItemView::SelectionMode::SingleSelection - QAbstractItemView::SelectRows + QAbstractItemView::SelectionBehavior::SelectRows false @@ -514,7 +514,7 @@ - Layer name + QGIS layer name leLayerName diff --git a/tests/src/3d/sandbox/qgis_3d_sandbox.cpp b/tests/src/3d/sandbox/qgis_3d_sandbox.cpp index c591bc297ab8..175c01ac9165 100644 --- a/tests/src/3d/sandbox/qgis_3d_sandbox.cpp +++ b/tests/src/3d/sandbox/qgis_3d_sandbox.cpp @@ -31,15 +31,11 @@ #include "qgslayertree.h" #include "qgsmapcanvas.h" #include "qgsmapsettings.h" -#include "qgspointcloudlayer.h" -#include "qgspointcloudlayer3drenderer.h" #include "qgspointlightsettings.h" #include "qgsproject.h" #include "qgsprojectelevationproperties.h" #include "qgsprojectviewsettings.h" #include "qgsterrainprovider.h" -#include "qgstiledscenelayer.h" -#include "qgstiledscenelayer3drenderer.h" #include #include @@ -192,26 +188,6 @@ int main( int argc, char *argv[] ) return 1; } - // a hack to assign 3D renderer - for ( QgsMapLayer *layer : QgsProject::instance()->layerTreeRoot()->checkedLayers() ) - { - if ( QgsPointCloudLayer *pcLayer = qobject_cast( layer ) ) - { - QgsPointCloudLayer3DRenderer *r = new QgsPointCloudLayer3DRenderer(); - r->setLayer( pcLayer ); - r->resolveReferences( *QgsProject::instance() ); - pcLayer->setRenderer3D( r ); - } - - if ( QgsTiledSceneLayer *tsLayer = qobject_cast( layer ) ) - { - QgsTiledSceneLayer3DRenderer *r = new QgsTiledSceneLayer3DRenderer(); - r->setLayer( tsLayer ); - r->resolveReferences( *QgsProject::instance() ); - tsLayer->setRenderer3D( r ); - } - } - Qgs3DMapCanvas *canvas = new Qgs3DMapCanvas; initCanvas3D( canvas ); diff --git a/tests/src/3d/testqgs3dcameracontroller.cpp b/tests/src/3d/testqgs3dcameracontroller.cpp index 7f2bb10b2a24..0b61369c09e7 100644 --- a/tests/src/3d/testqgs3dcameracontroller.cpp +++ b/tests/src/3d/testqgs3dcameracontroller.cpp @@ -219,7 +219,7 @@ void TestQgs3DCameraController::testZoom() QCOMPARE( scene->cameraController()->mCurrentOperation, QgsCameraController::MouseOperation::Zoom ); QVector3D diffViewCenter = scene->cameraController()->camera()->viewCenter() - initialCamViewCenter; - QGSCOMPARENEARVECTOR3D( diffViewCenter, QVector3D( 0.0, 0.0, 10.3 ), 1.5 ); + QGSCOMPARENEARVECTOR3D( diffViewCenter, QVector3D( 0.0, 0.0, 3.4 ), 1.5 ); QVector3D diffPosition = scene->cameraController()->camera()->position() - initialCamPosition; QGSCOMPARENEARVECTOR3D( diffPosition, QVector3D( 0.0, 1.5, -850.4 ), 1.5 ); QCOMPARE( scene->cameraController()->pitch(), initialPitch ); @@ -272,8 +272,8 @@ void TestQgs3DCameraController::testZoomWheel() scene->cameraController()->depthBufferCaptured( depthImage ); QGSCOMPARENEARVECTOR3D( scene->cameraController()->mZoomPoint, QVector3D( -1381.3, 1036.7, 1.0 ), 5.0 ); - QGSCOMPARENEARVECTOR3D( scene->cameraController()->cameraPose().centerPoint(), QVector3D( -480.0, 360.6, -351.7 ), 5.0 ); - QGSCOMPARENEAR( scene->cameraController()->cameraPose().distanceFromCenterPoint(), 1982.3, 5.0 ); + QGSCOMPARENEARVECTOR3D( scene->cameraController()->cameraPose().centerPoint(), QVector3D( -479.2, 359.4, 1.6 ), 5.0 ); + QGSCOMPARENEAR( scene->cameraController()->cameraPose().distanceFromCenterPoint(), 1631.9, 5.0 ); QCOMPARE( scene->cameraController()->mCumulatedWheelY, 0 ); QCOMPARE( scene->cameraController()->mClickPoint, QPoint() ); QCOMPARE( scene->cameraController()->mCurrentOperation, QgsCameraController::MouseOperation::None ); @@ -523,8 +523,8 @@ void TestQgs3DCameraController::testRotationCenterZoomWheelRotationCenter() scene->cameraController()->depthBufferCaptured( depthImage ); QGSCOMPARENEARVECTOR3D( scene->cameraController()->mZoomPoint, QVector3D( 283.2, -923.1, -27.0 ), 1.5 ); - QGSCOMPARENEARVECTOR3D( scene->cameraController()->cameraPose().centerPoint(), QVector3D( 120.3, -308.9, -116.8 ), 2.0 ); - QGSCOMPARENEAR( scene->cameraController()->cameraPose().distanceFromCenterPoint(), 1742.9, 2.0 ); + QGSCOMPARENEARVECTOR3D( scene->cameraController()->cameraPose().centerPoint(), QVector3D( 99.4, -319.9, -8.8 ), 2.0 ); + QGSCOMPARENEAR( scene->cameraController()->cameraPose().distanceFromCenterPoint(), 1631.9, 2.0 ); QCOMPARE( scene->cameraController()->pitch(), initialPitch ); QCOMPARE( scene->cameraController()->yaw(), initialYaw ); QCOMPARE( scene->cameraController()->mCumulatedWheelY, 0 ); @@ -558,7 +558,7 @@ void TestQgs3DCameraController::testRotationCenterZoomWheelRotationCenter() QCOMPARE( scene->cameraController()->mCurrentOperation, QgsCameraController::MouseOperation::RotationCenter ); diffViewCenter = scene->cameraController()->camera()->viewCenter() - initialCamViewCenter; - QGSCOMPARENEARVECTOR3D( diffViewCenter, QVector3D( 30.6, 8.2, 6.4 ), 1.0 ); + QGSCOMPARENEARVECTOR3D( diffViewCenter, QVector3D( 25.9, 7.1, 5.2 ), 1.0 ); diffPosition = scene->cameraController()->camera()->position() - initialCamPosition; QGSCOMPARENEARVECTOR3D( diffPosition, QVector3D( -44.3, -9.1, -11.7 ), 1.0 ); diffPitch = scene->cameraController()->pitch() - initialPitch; @@ -816,8 +816,8 @@ void TestQgs3DCameraController::testTranslateZoomWheelTranslate() scene->cameraController()->depthBufferCaptured( depthImage ); QGSCOMPARENEARVECTOR3D( scene->cameraController()->mZoomPoint, QVector3D( 4.8, -4.4, 9.9 ), 1.0 ); - QGSCOMPARENEARVECTOR3D( scene->cameraController()->cameraPose().centerPoint(), QVector3D( -615.0, 116.6, -108.0 ), 4.0 ); - QGSCOMPARENEAR( scene->cameraController()->cameraPose().distanceFromCenterPoint(), 1743.4, 2.0 ); + QGSCOMPARENEARVECTOR3D( scene->cameraController()->cameraPose().centerPoint(), QVector3D( -615.5, 116.2, 3.4 ), 4.0 ); + QGSCOMPARENEAR( scene->cameraController()->cameraPose().distanceFromCenterPoint(), 1631.9, 2.0 ); QCOMPARE( scene->cameraController()->mCumulatedWheelY, 0 ); QCOMPARE( scene->cameraController()->mClickPoint, QPoint() ); QCOMPARE( scene->cameraController()->mCurrentOperation, QgsCameraController::MouseOperation::None ); diff --git a/tests/src/3d/testqgs3drendering.cpp b/tests/src/3d/testqgs3drendering.cpp index 4c3c18e4a7c8..02f28cb7a76e 100644 --- a/tests/src/3d/testqgs3drendering.cpp +++ b/tests/src/3d/testqgs3drendering.cpp @@ -207,9 +207,9 @@ void TestQgs3DRendering::initTestCase() QColor cMin = Qt::red, cMax = Qt::yellow; // change renderer for the new style - std::unique_ptr colorRampShader( new QgsColorRampShader( vMin, vMax ) ); + auto colorRampShader = std::make_unique( vMin, vMax ); colorRampShader->setColorRampItemList( QList() << QgsColorRampShader::ColorRampItem( vMin, cMin ) << QgsColorRampShader::ColorRampItem( vMax, cMax ) ); - std::unique_ptr shader( new QgsRasterShader( vMin, vMax ) ); + auto shader = std::make_unique( vMin, vMax ); shader->setRasterShaderFunction( colorRampShader.release() ); QgsSingleBandPseudoColorRenderer *r = new QgsSingleBandPseudoColorRenderer( mLayerDtm->renderer()->input(), 1, shader.release() ); mLayerDtm->setRenderer( r ); @@ -260,7 +260,7 @@ void TestQgs3DRendering::testLights() map.setLightSources( { dsLight } ); QCOMPARE( lightSourceChangedSpy.size(), 2 ); // different light type - std::unique_ptr pointLight = std::make_unique(); + auto pointLight = std::make_unique(); pointLight->setColor( QColor( 255, 0, 0 ) ); map.setLightSources( { pointLight->clone() } ); QCOMPARE( lightSourceChangedSpy.size(), 3 ); @@ -492,7 +492,7 @@ void TestQgs3DRendering::testPhongShading() { const QgsRectangle fullExtent = mLayerDtm->extent(); - std::unique_ptr buildings = std::make_unique( testDataPath( "/3d/buildings.shp" ), "buildings", "ogr" ); + auto buildings = std::make_unique( testDataPath( "/3d/buildings.shp" ), "buildings", "ogr" ); QVERIFY( buildings->isValid() ); QgsPhongMaterialSettings materialSettings; @@ -875,7 +875,7 @@ void TestQgs3DRendering::testExtrudedPolygonsMetalRoughShading() { const QgsRectangle fullExtent = mLayerDtm->extent(); - std::unique_ptr buildings = std::make_unique( testDataPath( "/3d/buildings.shp" ), "buildings", "ogr" ); + auto buildings = std::make_unique( testDataPath( "/3d/buildings.shp" ), "buildings", "ogr" ); QVERIFY( buildings->isValid() ); QgsMetalRoughMaterialSettings materialSettings; @@ -937,8 +937,8 @@ void TestQgs3DRendering::testPolygonsEdges() std::unique_ptr layer( mLayerBuildings->clone() ); - std::unique_ptr simpleFill = std::make_unique( QColor( 0, 0, 0 ), Qt::SolidPattern, QColor( 0, 0, 0 ), Qt::NoPen ); - std::unique_ptr fillSymbol = std::make_unique( QgsSymbolLayerList() << simpleFill.release() ); + auto simpleFill = std::make_unique( QColor( 0, 0, 0 ), Qt::SolidPattern, QColor( 0, 0, 0 ), Qt::NoPen ); + auto fillSymbol = std::make_unique( QgsSymbolLayerList() << simpleFill.release() ); layer->setRenderer( new QgsSingleSymbolRenderer( fillSymbol.release() ) ); QgsVectorLayer3DRenderer *renderer3d = new QgsVectorLayer3DRenderer( symbol3d ); @@ -1099,7 +1099,7 @@ void TestQgs3DRendering::testLineRenderingCurved() QVector pts; pts << QgsPoint( 0, 0, 10 ) << QgsPoint( 0, 1000, 10 ) << QgsPoint( 1000, 1000, 10 ) << QgsPoint( 1000, 0, 10 ); - std::unique_ptr curve = std::make_unique(); + auto curve = std::make_unique(); curve->addCurve( new QgsLineString( pts ) ); pts.clear(); pts << QgsPoint( 1000, 0, 10 ) << QgsPoint( 1000, 0, 500 ) << QgsPoint( 1000, 1000, 500 ) << QgsPoint( 0, 1000, 500 ) << QgsPoint( 0, 0, 500 ); @@ -1545,7 +1545,7 @@ void TestQgs3DRendering::testInstancedRendering() { const QgsRectangle fullExtent( 1000, 1000, 2000, 2000 ); - std::unique_ptr layerPointsZ( new QgsVectorLayer( "PointZ?crs=EPSG:27700", "points Z", "memory" ) ); + auto layerPointsZ = std::make_unique( "PointZ?crs=EPSG:27700", "points Z", "memory" ); QgsPoint *p1 = new QgsPoint( 1000, 1000, 50 ); QgsPoint *p2 = new QgsPoint( 1000, 2000, 100 ); @@ -1620,7 +1620,7 @@ void TestQgs3DRendering::testInstancedRenderingClipping() { const QgsRectangle fullExtent( 1000, 1000, 2000, 2000 ); - std::unique_ptr layerPointsZ( new QgsVectorLayer( "PointZ?crs=EPSG:27700", "points Z", "memory" ) ); + auto layerPointsZ = std::make_unique( "PointZ?crs=EPSG:27700", "points Z", "memory" ); QgsPoint *p1 = new QgsPoint( 1000, 1000, 50 ); QgsPoint *p2 = new QgsPoint( 1000, 2000, 100 ); @@ -1720,7 +1720,7 @@ void TestQgs3DRendering::testBillboardRendering() { const QgsRectangle fullExtent( 1000, 1000, 2000, 2000 ); - std::unique_ptr layerPointsZ( new QgsVectorLayer( "PointZ?crs=EPSG:27700", "points Z", "memory" ) ); + auto layerPointsZ = std::make_unique( "PointZ?crs=EPSG:27700", "points Z", "memory" ); QgsPoint *p1 = new QgsPoint( 1000, 1000, 50 ); QgsPoint *p2 = new QgsPoint( 1000, 2000, 100 ); @@ -2003,6 +2003,15 @@ void TestQgs3DRendering::testAmbientOcclusion() mapSettings.setLightSources( { defaultPointLight.clone() } ); mapSettings.setOutputDpi( 92 ); + QgsPhongMaterialSettings materialSettings; + materialSettings.setAmbient( Qt::lightGray ); + QgsPolygon3DSymbol *symbol3d = new QgsPolygon3DSymbol; + symbol3d->setMaterialSettings( materialSettings.clone() ); + symbol3d->setExtrusionHeight( 10.f ); + symbol3d->setAltitudeClamping( Qgis::AltitudeClamping::Relative ); + QgsVectorLayer3DRenderer *renderer3d = new QgsVectorLayer3DRenderer( symbol3d ); + mLayerBuildings->setRenderer3D( renderer3d ); + // =========== creating Qgs3DMapScene QPoint winSize = QPoint( 640, 480 ); // default window size @@ -2107,8 +2116,8 @@ void TestQgs3DRendering::testDepthBuffer() scene->cameraController()->depthBufferCaptured( depthImage ); QGSCOMPARENEARVECTOR3D( scene->cameraController()->mZoomPoint, QVector3D( -32.7, -185.5, 224.6 ), 1.0 ); - QGSCOMPARENEARVECTOR3D( scene->cameraController()->cameraPose().centerPoint(), QVector3D( -32.7, -185.5, 224.6 ), 1.0 ); - QGSCOMPARENEAR( scene->cameraController()->cameraPose().distanceFromCenterPoint(), 955.4, 1.0 ); + QGSCOMPARENEARVECTOR3D( scene->cameraController()->cameraPose().centerPoint(), QVector3D( -6.8, -38.6, 46.7 ), 1.0 ); + QGSCOMPARENEAR( scene->cameraController()->cameraPose().distanceFromCenterPoint(), 1187.5, 1.0 ); QCOMPARE( scene->cameraController()->mCumulatedWheelY, 0 ); // Checking second wheel action @@ -2124,8 +2133,8 @@ void TestQgs3DRendering::testDepthBuffer() scene->cameraController()->depthBufferCaptured( depthImage ); QGSCOMPARENEARVECTOR3D( scene->cameraController()->mZoomPoint, QVector3D( -32.5, -184.7, 223.5 ), 1.0 ); - QGSCOMPARENEARVECTOR3D( scene->cameraController()->cameraPose().centerPoint(), QVector3D( -32.5, -184.7, 223.5 ), 1.0 ); - QGSCOMPARENEAR( scene->cameraController()->cameraPose().distanceFromCenterPoint(), 757.4, 1.0 ); + QGSCOMPARENEARVECTOR3D( scene->cameraController()->cameraPose().centerPoint(), QVector3D( -12.1, -69.0, 83.5 ), 1.0 ); + QGSCOMPARENEAR( scene->cameraController()->cameraPose().distanceFromCenterPoint(), 940.1, 1.0 ); QCOMPARE( scene->cameraController()->mCumulatedWheelY, 0 ); // Checking third wheel action @@ -2141,8 +2150,8 @@ void TestQgs3DRendering::testDepthBuffer() scene->cameraController()->depthBufferCaptured( depthImage ); QGSCOMPARENEARVECTOR3D( scene->cameraController()->mZoomPoint, QVector3D( -32.4, -184.1, 222.8 ), 1.0 ); - QGSCOMPARENEARVECTOR3D( scene->cameraController()->cameraPose().centerPoint(), QVector3D( -32.4, -184.1, 222.8 ), 1.0 ); - QGSCOMPARENEAR( scene->cameraController()->cameraPose().distanceFromCenterPoint(), 126.4, 0.1 ); + QGSCOMPARENEARVECTOR3D( scene->cameraController()->cameraPose().centerPoint(), QVector3D( -29.0, -164.9, 199.6 ), 1.0 ); + QGSCOMPARENEAR( scene->cameraController()->cameraPose().distanceFromCenterPoint(), 156.6, 0.1 ); QCOMPARE( scene->cameraController()->mCumulatedWheelY, 0 ); // Checking fourth wheel action @@ -2158,8 +2167,8 @@ void TestQgs3DRendering::testDepthBuffer() scene->cameraController()->depthBufferCaptured( depthImage ); QGSCOMPARENEARVECTOR3D( scene->cameraController()->mZoomPoint, QVector3D( -32.3, -183.2, 221.7 ), 1.0 ); - QGSCOMPARENEARVECTOR3D( scene->cameraController()->cameraPose().centerPoint(), QVector3D( -32.3, -183.2, 221.7 ), 1.0 ); - QGSCOMPARENEAR( scene->cameraController()->cameraPose().distanceFromCenterPoint(), 101.1, 0.1 ); + QGSCOMPARENEARVECTOR3D( scene->cameraController()->cameraPose().centerPoint(), QVector3D( -29.7, -168.7, 204.2 ), 1.0 ); + QGSCOMPARENEAR( scene->cameraController()->cameraPose().distanceFromCenterPoint(), 124.0, 0.1 ); QCOMPARE( scene->cameraController()->mCumulatedWheelY, 0 ); // Checking camera position diff --git a/tests/src/3d/testqgs3dutils.cpp b/tests/src/3d/testqgs3dutils.cpp index 6cc4f3e2401c..30e1afe4f96e 100644 --- a/tests/src/3d/testqgs3dutils.cpp +++ b/tests/src/3d/testqgs3dutils.cpp @@ -175,13 +175,13 @@ void TestQgs3DUtils::testQgsBox3DDistanceTo() { { const QgsBox3D box( -1, -1, -1, 1, 1, 1 ); - QCOMPARE( box.distanceTo( QVector3D( 0, 0, 0 ) ), 0.0 ); - QCOMPARE( box.distanceTo( QVector3D( 2, 2, 2 ) ), qSqrt( 3.0 ) ); + QCOMPARE( box.distanceTo( QgsVector3D( 0, 0, 0 ) ), 0.0 ); + QCOMPARE( box.distanceTo( QgsVector3D( 2, 2, 2 ) ), qSqrt( 3.0 ) ); } { const QgsBox3D box( 1, 2, 1, 4, 3, 3 ); - QCOMPARE( box.distanceTo( QVector3D( 1, 2, 1 ) ), 0.0 ); - QCOMPARE( box.distanceTo( QVector3D( 0, 0, 0 ) ), qSqrt( 6.0 ) ); + QCOMPARE( box.distanceTo( QgsVector3D( 1, 2, 1 ) ), 0.0 ); + QCOMPARE( box.distanceTo( QgsVector3D( 0, 0, 0 ) ), qSqrt( 6.0 ) ); } } diff --git a/tests/src/3d/testqgspointcloud3drendering.cpp b/tests/src/3d/testqgspointcloud3drendering.cpp index df49e68c17ae..a57b190f879a 100644 --- a/tests/src/3d/testqgspointcloud3drendering.cpp +++ b/tests/src/3d/testqgspointcloud3drendering.cpp @@ -33,9 +33,6 @@ #include "qgs3dmapsettings.h" #include "qgs3dmapscene.h" -#include -#include - class TestQgsPointCloud3DRendering : public QgsTest { Q_OBJECT @@ -58,10 +55,14 @@ class TestQgsPointCloud3DRendering : public QgsTest void testPointCloudFilteredClassification(); void testPointCloudFilteredSceneExtent(); + void testPointCloud3DExtents(); + void testPointCloud3DOverview(); + private: std::unique_ptr mProject; QgsPointCloudLayer *mLayer; + QgsPointCloudLayer *mVpcLayer; }; //runs before all tests @@ -79,6 +80,9 @@ void TestQgsPointCloud3DRendering::initTestCase() mLayer = new QgsPointCloudLayer( dataDir + "/point_clouds/ept/sunshine-coast-laz/ept.json", "test", "ept" ); QVERIFY( mLayer->isValid() ); mProject->addMapLayer( mLayer ); + mVpcLayer = new QgsPointCloudLayer( dataDir + "/point_clouds/virtual/sunshine-coast/combined-with-overview.vpc", "test", "vpc" ); + QVERIFY( mVpcLayer->isValid() ); + mProject->addMapLayer( mVpcLayer ); mProject->setCrs( mLayer->crs() ); // set a default 3D renderer @@ -522,5 +526,82 @@ void TestQgsPointCloud3DRendering::testPointCloudFilteredSceneExtent() QGSVERIFYIMAGECHECK( "pointcloud_3d_filtered_scene_extent", "pointcloud_3d_filtered_scene_extent", img, QString(), 80, QSize( 0, 0 ), 15 ); } +void TestQgsPointCloud3DRendering::testPointCloud3DExtents() +{ + mProject->setCrs( mVpcLayer->crs() ); + + Qgs3DMapSettings *map = new Qgs3DMapSettings; + map->setCrs( mProject->crs() ); + map->setExtent( mVpcLayer->extent() ); + map->setLayers( QList() << mVpcLayer ); + QgsPointLightSettings defaultLight; + defaultLight.setIntensity( 0.5 ); + defaultLight.setPosition( QgsVector3D( 0, 1000, 0 ) ); + map->setLightSources( { defaultLight.clone() } ); + + QgsOffscreen3DEngine engine; + Qgs3DMapScene *scene = new Qgs3DMapScene( *map, &engine ); + engine.setRootEntity( scene ); + + QgsClassificationPointCloud3DSymbol *symbol = new QgsClassificationPointCloud3DSymbol(); + symbol->setAttribute( QStringLiteral( "Classification" ) ); + symbol->setCategoriesList( QgsPointCloudClassifiedRenderer::defaultCategories() ); + symbol->setPointSize( 10 ); + + QgsPointCloudLayer3DRenderer *renderer = new QgsPointCloudLayer3DRenderer(); + renderer->setSymbol( symbol ); + mVpcLayer->setRenderer3D( renderer ); + + scene->cameraController()->resetView( 90 ); + Qgs3DUtils::captureSceneImage( engine, scene ); + // When running the test on Travis, it would initially return empty rendered image. + // Capturing the initial image and throwing it away fixes that. Hopefully we will + // find a better fix in the future. + const QImage img = Qgs3DUtils::captureSceneImage( engine, scene ); + + QGSVERIFYIMAGECHECK( "virtual_pointcloud_3d_extents", "virtual_pointcloud_3d_extents", img, QString(), 40, QSize( 0, 0 ), 55 ); +} + +void TestQgsPointCloud3DRendering::testPointCloud3DOverview() +{ + Qgs3DMapSettings *map = new Qgs3DMapSettings; + map->setCrs( mProject->crs() ); + map->setExtent( mVpcLayer->extent() ); + map->setLayers( QList() << mVpcLayer ); + QgsPointLightSettings defaultLight; + defaultLight.setIntensity( 0.5 ); + defaultLight.setPosition( QgsVector3D( 0, 1000, 0 ) ); + map->setLightSources( { defaultLight.clone() } ); + + QgsOffscreen3DEngine engine; + Qgs3DMapScene *scene = new Qgs3DMapScene( *map, &engine ); + engine.setRootEntity( scene ); + + //Classification symbol + QgsClassificationPointCloud3DSymbol *symbol = new QgsClassificationPointCloud3DSymbol(); + symbol->setAttribute( QStringLiteral( "Classification" ) ); + symbol->setCategoriesList( QgsPointCloudClassifiedRenderer::defaultCategories() ); + symbol->setPointSize( 3 ); + + mVpcLayer->setRenderer3D( nullptr ); + QgsPointCloudLayer3DRenderer *renderer = new QgsPointCloudLayer3DRenderer(); + renderer->setSymbol( symbol ); + renderer->setZoomOutBehavior( Qgis::PointCloudZoomOutRenderBehavior::RenderOverview ); + mVpcLayer->setRenderer3D( renderer ); + + scene->cameraController()->resetView( 120 ); + Qgs3DUtils::captureSceneImage( engine, scene ); + // There is a bug in overview rendering, which doesn't render overview right away, it needs to get out of camera view + // and back in. Then it renders correctly + scene->cameraController()->moveView( mVpcLayer->extent().width(), mVpcLayer->extent().height() ); + scene->cameraController()->resetView( 120 ); + // When running the test on Travis, it would initially return empty rendered image. + // Capturing the initial image and throwing it away fixes that. Hopefully we will + // find a better fix in the future. + const QImage img = Qgs3DUtils::captureSceneImage( engine, scene ); + + QGSVERIFYIMAGECHECK( "virtual_pointcloud_3d_overview", "virtual_pointcloud_3d_overview", img, QString(), 20, QSize( 0, 0 ), 15 ); +} + QGSTEST_MAIN( TestQgsPointCloud3DRendering ) #include "testqgspointcloud3drendering.moc" diff --git a/tests/src/analysis/testqgsgeometrysnapper.cpp b/tests/src/analysis/testqgsgeometrysnapper.cpp index a83b9e435b83..2e7e54c74f07 100644 --- a/tests/src/analysis/testqgsgeometrysnapper.cpp +++ b/tests/src/analysis/testqgsgeometrysnapper.cpp @@ -80,7 +80,7 @@ void TestQgsGeometrySnapper::cleanup() void TestQgsGeometrySnapper::snapPolygonToPolygon() { - std::unique_ptr rl = std::make_unique( QStringLiteral( "Polygon" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); + auto rl = std::make_unique( QStringLiteral( "Polygon" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); QgsFeature ff( 0 ); const QgsGeometry refGeom = QgsGeometry::fromWkt( QStringLiteral( "Polygon((0 0, 10 0, 10 10, 0 10, 0 0))" ) ); ff.setGeometry( refGeom ); @@ -110,7 +110,7 @@ void TestQgsGeometrySnapper::snapPolygonToPolygon() void TestQgsGeometrySnapper::snapLineToLine() { - std::unique_ptr rl = std::make_unique( QStringLiteral( "Linestring" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); + auto rl = std::make_unique( QStringLiteral( "Linestring" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); QgsFeature ff( 0 ); // closed linestrings @@ -162,7 +162,7 @@ void TestQgsGeometrySnapper::snapLineToLine() void TestQgsGeometrySnapper::snapLineToPolygon() { - std::unique_ptr rl = std::make_unique( QStringLiteral( "Polygon" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); + auto rl = std::make_unique( QStringLiteral( "Polygon" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); QgsFeature ff( 0 ); // closed linestrings @@ -214,7 +214,7 @@ void TestQgsGeometrySnapper::snapLineToPolygon() void TestQgsGeometrySnapper::snapLineToPoint() { - std::unique_ptr rl = std::make_unique( QStringLiteral( "Point" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); + auto rl = std::make_unique( QStringLiteral( "Point" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); const QgsGeometry refGeom = QgsGeometry::fromWkt( QStringLiteral( "Point(0 0)" ) ); QgsFeature ff( 0 ); @@ -243,7 +243,7 @@ void TestQgsGeometrySnapper::snapLineToPoint() void TestQgsGeometrySnapper::snapPolygonToLine() { - std::unique_ptr rl = std::make_unique( QStringLiteral( "Linestring" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); + auto rl = std::make_unique( QStringLiteral( "Linestring" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); // closed linestring const QgsGeometry refGeom = QgsGeometry::fromWkt( QStringLiteral( "LineString(0 0, 10 0, 10 10, 0 10, 0 0)" ) ); @@ -301,7 +301,7 @@ void TestQgsGeometrySnapper::snapPolygonToLine() void TestQgsGeometrySnapper::snapPolygonToPoint() { - std::unique_ptr rl = std::make_unique( QStringLiteral( "Point" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); + auto rl = std::make_unique( QStringLiteral( "Point" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); const QgsGeometry refGeom = QgsGeometry::fromWkt( QStringLiteral( "Point(0 0)" ) ); QgsFeature ff( 0 ); @@ -330,7 +330,7 @@ void TestQgsGeometrySnapper::snapPolygonToPoint() void TestQgsGeometrySnapper::snapPointToPoint() { - std::unique_ptr rl = std::make_unique( QStringLiteral( "Point" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); + auto rl = std::make_unique( QStringLiteral( "Point" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); const QgsGeometry refGeom = QgsGeometry::fromWkt( QStringLiteral( "Point(0 0)" ) ); QgsFeature ff( 0 ); @@ -354,7 +354,7 @@ void TestQgsGeometrySnapper::snapPointToPoint() void TestQgsGeometrySnapper::snapPointToLine() { - std::unique_ptr rl = std::make_unique( QStringLiteral( "Linestring" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); + auto rl = std::make_unique( QStringLiteral( "Linestring" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); // closed linestring const QgsGeometry refGeom = QgsGeometry::fromWkt( QStringLiteral( "LineString(0 0, 10 0, 10 10, 0 10, 0 0)" ) ); @@ -384,7 +384,7 @@ void TestQgsGeometrySnapper::snapPointToLine() void TestQgsGeometrySnapper::snapPointToLinePreferNearest() { - std::unique_ptr rl = std::make_unique( QStringLiteral( "Linestring" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); + auto rl = std::make_unique( QStringLiteral( "Linestring" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); // closed linestring const QgsGeometry refGeom = QgsGeometry::fromWkt( QStringLiteral( "LineString(0 0, 10 0, 10 10, 0 10, 0 0)" ) ); @@ -402,7 +402,7 @@ void TestQgsGeometrySnapper::snapPointToLinePreferNearest() void TestQgsGeometrySnapper::snapPointToPolygon() { - std::unique_ptr rl = std::make_unique( QStringLiteral( "Polygon" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); + auto rl = std::make_unique( QStringLiteral( "Polygon" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); // closed linestring const QgsGeometry refGeom = QgsGeometry::fromWkt( QStringLiteral( "Polygon((0 0, 10 0, 10 10, 0 10, 0 0))" ) ); @@ -424,7 +424,7 @@ void TestQgsGeometrySnapper::snapPointToPolygon() void TestQgsGeometrySnapper::endPointSnap() { - std::unique_ptr rl = std::make_unique( QStringLiteral( "Linestring" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); + auto rl = std::make_unique( QStringLiteral( "Linestring" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); QgsFeature ff( 0 ); const QgsGeometry refGeom = QgsGeometry::fromWkt( QStringLiteral( "LineString(0 0, 100 0, 100 100, 0 100)" ) ); @@ -449,7 +449,7 @@ void TestQgsGeometrySnapper::endPointSnap() void TestQgsGeometrySnapper::endPointToEndPoint() { - std::unique_ptr rl = std::make_unique( QStringLiteral( "Linestring" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); + auto rl = std::make_unique( QStringLiteral( "Linestring" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); QgsFeature ff( 0 ); // closed linestrings @@ -620,7 +620,7 @@ void TestQgsGeometrySnapper::duplicateNodes() void TestQgsGeometrySnapper::snapMultiPolygonToPolygon() { - std::unique_ptr rl = std::make_unique( QStringLiteral( "Polygon" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); + auto rl = std::make_unique( QStringLiteral( "Polygon" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); QgsFeature ff( 0 ); const QgsGeometry refGeom = QgsGeometry::fromWkt( QStringLiteral( "Polygon((0 0, 10 0, 10 10, 0 10, 0 0))" ) ); ff.setGeometry( refGeom ); diff --git a/tests/src/analysis/testqgsinterpolator.cpp b/tests/src/analysis/testqgsinterpolator.cpp index 861fbad1d4b5..b165c817d76b 100644 --- a/tests/src/analysis/testqgsinterpolator.cpp +++ b/tests/src/analysis/testqgsinterpolator.cpp @@ -291,7 +291,7 @@ void TestQgsInterpolator::dualEdge() void TestQgsInterpolator::TIN_IDW_Interpolator_with_Z() { - std::unique_ptr mLayerPoint = std::make_unique( QStringLiteral( "PointZ" ), QStringLiteral( "point" ), QStringLiteral( "memory" ) ); + auto mLayerPoint = std::make_unique( QStringLiteral( "PointZ" ), QStringLiteral( "point" ), QStringLiteral( "memory" ) ); const QString wkt1 = "PointZ (0.0 0.0 1.0)"; const QString wkt2 = "PointZ (2.0 0.0 2.0)"; @@ -360,7 +360,7 @@ void TestQgsInterpolator::TIN_IDW_Interpolator_with_Z() void TestQgsInterpolator::TIN_IDW_Interpolator_with_attribute() { - std::unique_ptr mLayerPoint = std::make_unique( QStringLiteral( "Point?field=ZValue:real" ), QStringLiteral( "point" ), QStringLiteral( "memory" ) ); + auto mLayerPoint = std::make_unique( QStringLiteral( "Point?field=ZValue:real" ), QStringLiteral( "point" ), QStringLiteral( "memory" ) ); QVERIFY( mLayerPoint->fields().field( "ZValue" ).type() == QMetaType::Type::Double ); diff --git a/tests/src/analysis/testqgsnetworkanalysis.cpp b/tests/src/analysis/testqgsnetworkanalysis.cpp index 01f6dfb92baf..b3115b3015f4 100644 --- a/tests/src/analysis/testqgsnetworkanalysis.cpp +++ b/tests/src/analysis/testqgsnetworkanalysis.cpp @@ -131,7 +131,7 @@ void TestQgsNetworkAnalysis::testGraph() std::unique_ptr TestQgsNetworkAnalysis::buildNetwork() { - std::unique_ptr l = std::make_unique( QStringLiteral( "LineString?crs=epsg:4326&field=cost:int" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); + auto l = std::make_unique( QStringLiteral( "LineString?crs=epsg:4326&field=cost:int" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); QgsFeature ff( 0 ); const QgsGeometry refGeom = QgsGeometry::fromWkt( QStringLiteral( "LineString(0 0, 10 0, 10 10)" ) ); @@ -148,10 +148,10 @@ std::unique_ptr TestQgsNetworkAnalysis::buildNetwork() void TestQgsNetworkAnalysis::testBuild() { std::unique_ptr network = buildNetwork(); - std::unique_ptr director = std::make_unique( network.get(), -1, QString(), QString(), QString(), QgsVectorLayerDirector::DirectionBoth ); - std::unique_ptr strategy = std::make_unique(); + auto director = std::make_unique( network.get(), -1, QString(), QString(), QString(), QgsVectorLayerDirector::DirectionBoth ); + auto strategy = std::make_unique(); director->addStrategy( strategy.release() ); - std::unique_ptr builder = std::make_unique( network->sourceCrs(), true, 0 ); + auto builder = std::make_unique( network->sourceCrs(), true, 0 ); QVector snapped; director->makeGraph( builder.get(), QVector() << QgsPointXY( 0, 0 ) << QgsPointXY( 10, 10 ), snapped ); @@ -206,10 +206,10 @@ void TestQgsNetworkAnalysis::testBuildTolerance() flist << ff; network->dataProvider()->addFeatures( flist ); - std::unique_ptr director = std::make_unique( network.get(), -1, QString(), QString(), QString(), QgsVectorLayerDirector::DirectionBoth ); - std::unique_ptr strategy = std::make_unique(); + auto director = std::make_unique( network.get(), -1, QString(), QString(), QString(), QgsVectorLayerDirector::DirectionBoth ); + auto strategy = std::make_unique(); director->addStrategy( strategy.release() ); - std::unique_ptr builder = std::make_unique( network->sourceCrs(), true, 0 ); + auto builder = std::make_unique( network->sourceCrs(), true, 0 ); QVector snapped; director->makeGraph( builder.get(), QVector(), snapped ); @@ -319,10 +319,10 @@ void TestQgsNetworkAnalysis::dijkkjkjkskkjsktra() */ // build graph - std::unique_ptr director = std::make_unique( network.get(), -1, QString(), QString(), QString(), QgsVectorLayerDirector::DirectionBoth ); + auto director = std::make_unique( network.get(), -1, QString(), QString(), QString(), QgsVectorLayerDirector::DirectionBoth ); std::unique_ptr strategy = std::make_unique(); director->addStrategy( strategy.release() ); - std::unique_ptr builder = std::make_unique( network->sourceCrs(), true, 0 ); + auto builder = std::make_unique( network->sourceCrs(), true, 0 ); QVector snapped; director->makeGraph( builder.get(), QVector(), snapped ); @@ -458,7 +458,7 @@ void TestQgsNetworkAnalysis::dijkkjkjkskkjsktra() void TestQgsNetworkAnalysis::testRouteFail() { - std::unique_ptr network = std::make_unique( QStringLiteral( "LineString?crs=epsg:28355&field=cost:int" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); + auto network = std::make_unique( QStringLiteral( "LineString?crs=epsg:28355&field=cost:int" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); const QStringList lines = QStringList() << QStringLiteral( "LineString (302081.71116495534079149 5753475.15082756895571947, 302140.54234686412382871 5753417.70564490929245949, 302143.24717211339157075 5753412.57312887348234653, 302143.17789465241366997 5753406.77192200440913439, 302140.35127420048229396 5753401.70546196680516005, 302078.46200818457873538 5753338.31098813004791737, 302038.17299743194598705 5753309.50200006738305092)" ) << QStringLiteral( "LineString (302081.70763194985920563 5753475.1403581602498889, 301978.24500802176771685 5753368.03299263771623373)" ) @@ -475,10 +475,10 @@ void TestQgsNetworkAnalysis::testRouteFail() network->dataProvider()->addFeatures( flist ); // build graph - std::unique_ptr director = std::make_unique( network.get(), -1, QString(), QString(), QString(), QgsVectorLayerDirector::DirectionBoth ); + auto director = std::make_unique( network.get(), -1, QString(), QString(), QString(), QgsVectorLayerDirector::DirectionBoth ); std::unique_ptr strategy = std::make_unique(); director->addStrategy( strategy.release() ); - std::unique_ptr builder = std::make_unique( network->sourceCrs(), true, 1 ); + auto builder = std::make_unique( network->sourceCrs(), true, 1 ); const QgsPointXY start( 302131.1053754404, 5753392.757948928 ); const QgsPointXY end( 302148.1636281528, 5753541.408436851 ); @@ -511,7 +511,7 @@ void TestQgsNetworkAnalysis::testRouteFail() void TestQgsNetworkAnalysis::testRouteFail2() { - std::unique_ptr network = std::make_unique( QStringLiteral( "LineString?crs=epsg:4326&field=cost:double" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); + auto network = std::make_unique( QStringLiteral( "LineString?crs=epsg:4326&field=cost:double" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); const QStringList lines = QStringList() << QStringLiteral( "LineString (11.25044997999680874 48.42605439713970128, 11.25044693759680925 48.42603339773970106, 11.25044760759680962 48.42591690773969759, 11.25052289759680946 48.42589190773969676)" ) << QStringLiteral( "LineString (11.25052289759680946 48.42589190773969676, 11.25050350759680917 48.42586202773969717, 11.25047190759680937 48.42581754773969749, 11.2504146475968092 48.42573849773970096, 11.25038716759680923 48.42569834773969717, 11.2502920175968093 48.42557470773969897, 11.25019984759680902 48.42560406773969817, 11.25020393759680992 48.42571203773970012, 11.2502482875968095 48.42577478773969801, 11.25021922759680848 48.42578442773969982)" ) @@ -531,10 +531,10 @@ void TestQgsNetworkAnalysis::testRouteFail2() network->dataProvider()->addFeatures( flist ); // build graph - std::unique_ptr director = std::make_unique( network.get(), -1, QString(), QString(), QString(), QgsVectorLayerDirector::DirectionBoth ); + auto director = std::make_unique( network.get(), -1, QString(), QString(), QString(), QgsVectorLayerDirector::DirectionBoth ); std::unique_ptr strategy = std::make_unique(); director->addStrategy( strategy.release() ); - std::unique_ptr builder = std::make_unique( network->sourceCrs(), true, 0 ); + auto builder = std::make_unique( network->sourceCrs(), true, 0 ); const QgsPointXY start( 11.250443581846053, 48.42605665308498 ); const QgsPointXY end( 11.250525546822013, 48.42561343506683 ); diff --git a/tests/src/analysis/testqgsprocessing.cpp b/tests/src/analysis/testqgsprocessing.cpp index 4d72b1f2d96f..8e5655132b7f 100644 --- a/tests/src/analysis/testqgsprocessing.cpp +++ b/tests/src/analysis/testqgsprocessing.cpp @@ -1412,6 +1412,21 @@ void TestQgsProcessing::context() QCOMPARE( context3.modelResult().childResults().value( QStringLiteral( "CHILD1" ) ).outputs().value( QStringLiteral( "RESULT1" ) ).toInt(), 1 ); QCOMPARE( context3.modelResult().childResults().value( QStringLiteral( "CHILD2" ) ).outputs().value( QStringLiteral( "RESULT2" ) ).toInt(), 2 ); + QgsProcessingContext context4; + context4.takeResultsFrom( context ); + context4.modelResult().rawChildInputs().insert( QStringLiteral( "test_input" ), 1 ); + context4.modelResult().rawChildOutputs().insert( QStringLiteral( "test_output" ), 1 ); + context4.modelResult().executedChildIds() << "alg:test"; + QCOMPARE( context4.modelResult().childResults().count(), 2 ); + QCOMPARE( context4.modelResult().rawChildInputs().count(), 1 ); + QCOMPARE( context4.modelResult().rawChildOutputs().count(), 1 ); + QCOMPARE( context4.modelResult().executedChildIds().count(), 1 ); + context4.clearModelResult(); + QCOMPARE( context4.modelResult().childResults().count(), 0 ); + QCOMPARE( context4.modelResult().rawChildInputs().count(), 0 ); + QCOMPARE( context4.modelResult().rawChildOutputs().count(), 0 ); + QCOMPARE( context4.modelResult().executedChildIds().count(), 0 ); + // make sure postprocessor is correctly deleted ppDeleted = false; pp = new TestPostProcessor( &ppDeleted ); @@ -2126,7 +2141,7 @@ void TestQgsProcessing::generateTemporaryDestination() context.setProject( &p ); // destination vector with "." in it's name - std::unique_ptr def( new QgsProcessingParameterVectorDestination( "with.inside", QString(), Qgis::ProcessingSourceType::VectorAnyGeometry, QString(), false ) ); + auto def = std::make_unique( "with.inside", QString(), Qgis::ProcessingSourceType::VectorAnyGeometry, QString(), false ); // check that temporary destination does not have dot at the end when there is no extension QVERIFY( !def->generateTemporaryDestination().endsWith( QLatin1Char( '.' ) ) ); @@ -2137,7 +2152,7 @@ void TestQgsProcessing::generateTemporaryDestination() QCOMPARE( f.completeSuffix(), QString( "gpkg" ) ); // destination raster with "." in it's name - std::unique_ptr def2( new QgsProcessingParameterRasterDestination( "with.inside", QString(), QString(), false ) ); + auto def2 = std::make_unique( "with.inside", QString(), QString(), false ); // check that temporary destination does not have dot at the end when there is no extension QVERIFY( !def2->generateTemporaryDestination().endsWith( QLatin1Char( '.' ) ) ); @@ -2148,7 +2163,7 @@ void TestQgsProcessing::generateTemporaryDestination() QCOMPARE( f.completeSuffix(), QString( "tif" ) ); // destination vector without "." in it's name - std::unique_ptr def3( new QgsProcessingParameterVectorDestination( "without_inside", QString(), Qgis::ProcessingSourceType::VectorAnyGeometry, QString(), false ) ); + auto def3 = std::make_unique( "without_inside", QString(), Qgis::ProcessingSourceType::VectorAnyGeometry, QString(), false ); // check that temporary destination does not have dot at the end when there is no extension QVERIFY( !def3->generateTemporaryDestination().endsWith( QLatin1Char( '.' ) ) ); @@ -2161,9 +2176,9 @@ void TestQgsProcessing::generateTemporaryDestination() void TestQgsProcessing::removePointerValuesFromMap() { - std::unique_ptr vl = std::make_unique( "Point?crs=epsg:3111", "v1", "memory" ); + auto vl = std::make_unique( "Point?crs=epsg:3111", "v1", "memory" ); const QString raster1 = QStringLiteral( TEST_DATA_DIR ) + '/' + "landsat_4326.tif"; - std::unique_ptr rl = std::make_unique( raster1, "R1" ); + auto rl = std::make_unique( raster1, "R1" ); QPointer rl1Pointer( rl.get() ); const QVariantMap source { { QStringLiteral( "k1" ), 5 }, { QStringLiteral( "k2" ), QStringLiteral( "aa" ) }, { QStringLiteral( "k3" ), QVariantList() << QStringLiteral( "aa" ) << 3 << QVariant::fromValue( vl.get() ) }, { QStringLiteral( "k4" ), QVariantMap { { QStringLiteral( "kk1" ), 5 }, { QStringLiteral( "kk2" ), QVariant::fromValue( rl1Pointer ) } } } }; @@ -2800,13 +2815,13 @@ void TestQgsProcessing::parameters() // setting layer name to match... context2.layersToLoadOnCompletion().values().at( 0 ).setOutputLayerName( nullptr ); - std::unique_ptr vl = std::make_unique( QStringLiteral( "Point" ), QString(), QStringLiteral( "memory" ) ); + auto vl = std::make_unique( QStringLiteral( "Point" ), QString(), QStringLiteral( "memory" ) ); QVERIFY( vl->isValid() ); context2.layersToLoadOnCompletion().values().at( 0 ).setOutputLayerName( vl.get() ); // temporary layer, must use output name as layer name QCOMPARE( vl->name(), QStringLiteral( "my_dest" ) ); // otherwise expect to use path - std::unique_ptr rl = std::make_unique( QStringLiteral( TEST_DATA_DIR ) + "/landsat.tif", QString() ); + auto rl = std::make_unique( QStringLiteral( TEST_DATA_DIR ) + "/landsat.tif", QString() ); context2.layersToLoadOnCompletion().values().at( 0 ).setOutputLayerName( rl.get() ); QCOMPARE( rl->name(), QStringLiteral( "landsat" ) ); // unless setting prohibits it... @@ -3171,7 +3186,7 @@ void TestQgsProcessing::parameterCrs() context.setProject( &p ); // not optional, with default value - std::unique_ptr def( new QgsProcessingParameterCrs( "non_optional", QString(), QString( "EPSG:3113" ), false ) ); + auto def = std::make_unique( "non_optional", QString(), QString( "EPSG:3113" ), false ); QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) ); @@ -3361,7 +3376,7 @@ void TestQgsProcessing::parameterMapLayer() context.setProject( &p ); // not optional, no default value - std::unique_ptr def( new QgsProcessingParameterMapLayer( "non_optional", QString(), QVariant(), false ) ); + auto def = std::make_unique( "non_optional", QString(), QVariant(), false ); QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) ); @@ -3576,7 +3591,7 @@ void TestQgsProcessing::parameterExtent() context.setProject( &p ); // not optional, with default value - std::unique_ptr def( new QgsProcessingParameterExtent( "non_optional", QString(), QString( "1,2,3,4" ), false ) ); + auto def = std::make_unique( "non_optional", QString(), QString( "1,2,3,4" ), false ); QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) ); @@ -3947,7 +3962,7 @@ void TestQgsProcessing::parameterPoint() QgsProcessingContext context; // not optional, with default value - std::unique_ptr def( new QgsProcessingParameterPoint( "non_optional", QString(), QString( "1,2" ), false ) ); + auto def = std::make_unique( "non_optional", QString(), QString( "1,2" ), false ); QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) ); @@ -4184,7 +4199,7 @@ void TestQgsProcessing::parameterGeometry() QgsProcessingContext context; // not optional, default value - std::unique_ptr def( new QgsProcessingParameterGeometry( "non_optional", QString(), QString( "Point(1 2)" ), false ) ); + auto def = std::make_unique( "non_optional", QString(), QString( "Point(1 2)" ), false ); QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) ); @@ -4432,7 +4447,7 @@ void TestQgsProcessing::parameterFile() QgsProcessingContext context; // not optional, with default value - std::unique_ptr def( new QgsProcessingParameterFile( "non_optional", QString(), Qgis::ProcessingFileParameterBehavior::File, QString(), QString( "abc.bmp" ), false ) ); + auto def = std::make_unique( "non_optional", QString(), Qgis::ProcessingFileParameterBehavior::File, QString(), QString( "abc.bmp" ), false ); QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) ); @@ -4658,7 +4673,7 @@ void TestQgsProcessing::parameterMatrix() QgsProcessingContext context; // not optional, no default value - std::unique_ptr def( new QgsProcessingParameterMatrix( "non_optional", QString(), 3, false, QStringList(), QVariant(), false ) ); + auto def = std::make_unique( "non_optional", QString(), 3, false, QStringList(), QVariant(), false ); QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( def->checkValueIsAcceptable( 5 ) ); @@ -4822,7 +4837,7 @@ void TestQgsProcessing::parameterLayerList() context.setProject( &p ); // not optional, no default value - std::unique_ptr def( new QgsProcessingParameterMultipleLayers( "non_optional", QString(), Qgis::ProcessingSourceType::MapLayer, QVariant(), false ) ); + auto def = std::make_unique( "non_optional", QString(), Qgis::ProcessingSourceType::MapLayer, QVariant(), false ); QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) ); @@ -5175,7 +5190,7 @@ void TestQgsProcessing::parameterDistance() QgsProcessingContext context; // not optional! - std::unique_ptr def( new QgsProcessingParameterDistance( "non_optional", QString(), 5, QStringLiteral( "parent" ), false ) ); + auto def = std::make_unique( "non_optional", QString(), 5, QStringLiteral( "parent" ), false ); QCOMPARE( def->parentParameterName(), QStringLiteral( "parent" ) ); def->setParentParameterName( QStringLiteral( "parent2" ) ); QCOMPARE( def->defaultUnit(), Qgis::DistanceUnit::Unknown ); @@ -5291,7 +5306,7 @@ void TestQgsProcessing::parameterArea() QgsProcessingContext context; // not optional! - std::unique_ptr def( new QgsProcessingParameterArea( "non_optional", QString(), 5, QStringLiteral( "parent" ), false ) ); + auto def = std::make_unique( "non_optional", QString(), 5, QStringLiteral( "parent" ), false ); QCOMPARE( def->parentParameterName(), QStringLiteral( "parent" ) ); def->setParentParameterName( QStringLiteral( "parent2" ) ); QCOMPARE( def->defaultUnit(), Qgis::AreaUnit::Unknown ); @@ -5407,7 +5422,7 @@ void TestQgsProcessing::parameterVolume() QgsProcessingContext context; // not optional! - std::unique_ptr def( new QgsProcessingParameterVolume( "non_optional", QString(), 5, QStringLiteral( "parent" ), false ) ); + auto def = std::make_unique( "non_optional", QString(), 5, QStringLiteral( "parent" ), false ); QCOMPARE( def->parentParameterName(), QStringLiteral( "parent" ) ); def->setParentParameterName( QStringLiteral( "parent2" ) ); QCOMPARE( def->defaultUnit(), Qgis::VolumeUnit::Unknown ); @@ -5523,7 +5538,7 @@ void TestQgsProcessing::parameterDuration() QgsProcessingContext context; // not optional! - std::unique_ptr def( new QgsProcessingParameterDuration( "non_optional", QString(), 5, false ) ); + auto def = std::make_unique( "non_optional", QString(), 5, false ); QCOMPARE( def->defaultUnit(), Qgis::TemporalUnit::Milliseconds ); def->setDefaultUnit( Qgis::TemporalUnit::Days ); QCOMPARE( def->defaultUnit(), Qgis::TemporalUnit::Days ); @@ -5631,7 +5646,7 @@ void TestQgsProcessing::parameterScale() QgsProcessingContext context; // not optional! - std::unique_ptr def( new QgsProcessingParameterScale( "non_optional", QString(), 5, false ) ); + auto def = std::make_unique( "non_optional", QString(), 5, false ); QVERIFY( def->checkValueIsAcceptable( 5 ) ); QVERIFY( def->checkValueIsAcceptable( "1.1" ) ); @@ -5742,7 +5757,7 @@ void TestQgsProcessing::parameterNumber() QgsProcessingContext context; // not optional! - std::unique_ptr def( new QgsProcessingParameterNumber( "non_optional", QString(), Qgis::ProcessingNumberParameterType::Double, 5, false ) ); + auto def = std::make_unique( "non_optional", QString(), Qgis::ProcessingNumberParameterType::Double, 5, false ); QVERIFY( def->checkValueIsAcceptable( 5 ) ); QVERIFY( def->checkValueIsAcceptable( "1.1" ) ); QVERIFY( !def->checkValueIsAcceptable( "1.1,2" ) ); @@ -5888,7 +5903,7 @@ void TestQgsProcessing::parameterRange() QgsProcessingContext context; // not optional, with default value - std::unique_ptr def( new QgsProcessingParameterRange( "non_optional", QString(), Qgis::ProcessingNumberParameterType::Double, QString( "5,6" ), false ) ); + auto def = std::make_unique( "non_optional", QString(), Qgis::ProcessingNumberParameterType::Double, QString( "5,6" ), false ); QVERIFY( !def->checkValueIsAcceptable( 5 ) ); QVERIFY( !def->checkValueIsAcceptable( "1.1" ) ); QVERIFY( def->checkValueIsAcceptable( "1.1,2" ) ); @@ -6074,7 +6089,7 @@ void TestQgsProcessing::parameterRasterLayer() context.setProject( &p ); // not optional, no default value - std::unique_ptr def( new QgsProcessingParameterRasterLayer( "non_optional", QString(), QVariant(), false ) ); + auto def = std::make_unique( "non_optional", QString(), QVariant(), false ); QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) ); @@ -6227,7 +6242,7 @@ void TestQgsProcessing::parameterEnum() QgsProcessingContext context; // not optional! - std::unique_ptr def( new QgsProcessingParameterEnum( "non_optional", QString(), QStringList() << "A" << "B" << "C", false, 2, false ) ); + auto def = std::make_unique( "non_optional", QString(), QStringList() << "A" << "B" << "C", false, 2, false ); QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( def->checkValueIsAcceptable( 1 ) ); @@ -6602,7 +6617,7 @@ void TestQgsProcessing::parameterString() QgsProcessingContext context; // not optional! - std::unique_ptr def( new QgsProcessingParameterString( "non_optional", QString(), QString(), false, false ) ); + auto def = std::make_unique( "non_optional", QString(), QString(), false, false ); QVERIFY( def->checkValueIsAcceptable( 1 ) ); QVERIFY( def->checkValueIsAcceptable( "test" ) ); QVERIFY( !def->checkValueIsAcceptable( "" ) ); @@ -6782,7 +6797,7 @@ void TestQgsProcessing::parameterAuthConfig() QgsProcessingContext context; // not optional! - std::unique_ptr def( new QgsProcessingParameterAuthConfig( "non_optional", QString(), QString(), false ) ); + auto def = std::make_unique( "non_optional", QString(), QString(), false ); QVERIFY( def->checkValueIsAcceptable( 1 ) ); QVERIFY( def->checkValueIsAcceptable( "test" ) ); QVERIFY( !def->checkValueIsAcceptable( "" ) ); @@ -6919,7 +6934,7 @@ void TestQgsProcessing::parameterExpression() QgsProcessingContext context; // not optional! - std::unique_ptr def( new QgsProcessingParameterExpression( "non_optional", QString(), QString( "1+1" ), QString(), false ) ); + auto def = std::make_unique( "non_optional", QString(), QString( "1+1" ), QString(), false ); QVERIFY( def->checkValueIsAcceptable( 1 ) ); QVERIFY( def->checkValueIsAcceptable( "test" ) ); QVERIFY( !def->checkValueIsAcceptable( "" ) ); @@ -7029,7 +7044,7 @@ void TestQgsProcessing::parameterField() QgsProcessingContext context; // not optional, no default value - std::unique_ptr def( new QgsProcessingParameterField( "non_optional", QString(), QVariant(), QString(), Qgis::ProcessingFieldParameterDataType::Any, false, false ) ); + auto def = std::make_unique( "non_optional", QString(), QVariant(), QString(), Qgis::ProcessingFieldParameterDataType::Any, false, false ); QVERIFY( def->checkValueIsAcceptable( 1 ) ); QVERIFY( def->checkValueIsAcceptable( "test" ) ); QVERIFY( !def->checkValueIsAcceptable( QStringList() << "a" << "b" ) ); @@ -7337,7 +7352,7 @@ void TestQgsProcessing::parameterVectorLayer() context.setProject( &p ); // not optional, with default value - std::unique_ptr def( new QgsProcessingParameterVectorLayer( "non_optional", QString(), QList(), QString( "somelayer" ), false ) ); + auto def = std::make_unique( "non_optional", QString(), QList(), QString( "somelayer" ), false ); QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) ); @@ -7499,7 +7514,7 @@ void TestQgsProcessing::parameterMeshLayer() context.setProject( &p ); // not optional, with default value - std::unique_ptr def( new QgsProcessingParameterMeshLayer( "non_optional", QString(), QString( "somelayer" ), false ) ); + auto def = std::make_unique( "non_optional", QString(), QString( "somelayer" ), false ); QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) ); @@ -7659,7 +7674,7 @@ void TestQgsProcessing::parameterFeatureSource() context.setProject( &p ); // not optional! - std::unique_ptr def( new QgsProcessingParameterFeatureSource( "non_optional", QString(), QList() << static_cast( Qgis::ProcessingSourceType::VectorAnyGeometry ), QVariant(), false ) ); + auto def = std::make_unique( "non_optional", QString(), QList() << static_cast( Qgis::ProcessingSourceType::VectorAnyGeometry ), QVariant(), false ); QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) ); @@ -7914,7 +7929,7 @@ void TestQgsProcessing::parameterFeatureSink() context.setProject( &p ); // not optional, no default value - std::unique_ptr def( new QgsProcessingParameterFeatureSink( "non_optional", QString(), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), false ) ); + auto def = std::make_unique( "non_optional", QString(), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), false ); QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) ); @@ -8120,7 +8135,7 @@ void TestQgsProcessing::parameterVectorOut() context.setProject( &p ); // not optional, no default - std::unique_ptr def( new QgsProcessingParameterVectorDestination( "non_optional", QString(), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), false ) ); + auto def = std::make_unique( "non_optional", QString(), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), false ); QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) ); @@ -8358,7 +8373,7 @@ void TestQgsProcessing::parameterRasterOut() context.setProject( &p ); // not optional, no default - std::unique_ptr def( new QgsProcessingParameterRasterDestination( "non_optional", QString(), QVariant(), false ) ); + auto def = std::make_unique( "non_optional", QString(), QVariant(), false ); QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) ); @@ -8525,7 +8540,7 @@ void TestQgsProcessing::parameterPointCloudOut() context.setProject( &p ); // not optional, no default - std::unique_ptr def( new QgsProcessingParameterPointCloudDestination( "non_optional", QString(), QVariant(), false ) ); + auto def = std::make_unique( "non_optional", QString(), QVariant(), false ); QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) ); @@ -8694,7 +8709,7 @@ void TestQgsProcessing::parameterFileOut() context.setProject( &p ); // not optional! - std::unique_ptr def( new QgsProcessingParameterFileDestination( "non_optional", QString(), QStringLiteral( "BMP files (*.bmp)" ), QVariant(), false ) ); + auto def = std::make_unique( "non_optional", QString(), QStringLiteral( "BMP files (*.bmp)" ), QVariant(), false ); QCOMPARE( def->fileFilter(), QStringLiteral( "BMP files (*.bmp)" ) ); QCOMPARE( def->defaultFileExtension(), QStringLiteral( "bmp" ) ); QVERIFY( def->generateTemporaryDestination().endsWith( QLatin1String( ".bmp" ) ) ); @@ -8859,7 +8874,7 @@ void TestQgsProcessing::parameterFolderOut() context.setProject( &p ); // not optional! - std::unique_ptr def( new QgsProcessingParameterFolderDestination( "non_optional", QString(), QVariant(), false ) ); + auto def = std::make_unique( "non_optional", QString(), QVariant(), false ); QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( true ) ); @@ -8975,7 +8990,7 @@ void TestQgsProcessing::parameterVectorTileOut() context.setProject( &p ); // not optional, no default - std::unique_ptr def( new QgsProcessingParameterVectorTileDestination( "non_optional", QString(), QVariant(), false ) ); + auto def = std::make_unique( "non_optional", QString(), QVariant(), false ); QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) ); @@ -9140,7 +9155,7 @@ void TestQgsProcessing::parameterBand() QgsProcessingContext context; // not optional! - std::unique_ptr def( new QgsProcessingParameterBand( "non_optional", QString(), QVariant(), QString(), false ) ); + auto def = std::make_unique( "non_optional", QString(), QVariant(), QString(), false ); QVERIFY( def->checkValueIsAcceptable( 1 ) ); QVERIFY( def->checkValueIsAcceptable( "1" ) ); QVERIFY( !def->checkValueIsAcceptable( "" ) ); @@ -9300,7 +9315,7 @@ void TestQgsProcessing::parameterLayout() p.layoutManager()->addLayout( l2 ); // not optional! - std::unique_ptr def( new QgsProcessingParameterLayout( "non_optional", QString(), QString(), false ) ); + auto def = std::make_unique( "non_optional", QString(), QString(), false ); QVERIFY( def->checkValueIsAcceptable( 1 ) ); QVERIFY( def->checkValueIsAcceptable( "test" ) ); QVERIFY( !def->checkValueIsAcceptable( "" ) ); @@ -9459,7 +9474,7 @@ void TestQgsProcessing::parameterLayoutItem() QgsPrintLayout *l2 = new QgsPrintLayout( &p ); // not optional! - std::unique_ptr def( new QgsProcessingParameterLayoutItem( "non_optional", QString(), QVariant(), QString(), -1, false ) ); + auto def = std::make_unique( "non_optional", QString(), QVariant(), QString(), -1, false ); QVERIFY( def->checkValueIsAcceptable( 1 ) ); QVERIFY( def->checkValueIsAcceptable( "test" ) ); QVERIFY( !def->checkValueIsAcceptable( "" ) ); @@ -9606,7 +9621,7 @@ void TestQgsProcessing::parameterColor() QgsProcessingContext context; // not optional! - std::unique_ptr def( new QgsProcessingParameterColor( "non_optional", QString(), QVariant(), true, false ) ); + auto def = std::make_unique( "non_optional", QString(), QVariant(), true, false ); QVERIFY( def->opacityEnabled() ); def->setOpacityEnabled( false ); QVERIFY( !def->opacityEnabled() ); @@ -9783,7 +9798,7 @@ void TestQgsProcessing::parameterCoordinateOperation() QgsProcessingContext context; // not optional! - std::unique_ptr def( new QgsProcessingParameterCoordinateOperation( "non_optional", QString(), QString(), QString(), QString(), QVariant(), QVariant(), false ) ); + auto def = std::make_unique( "non_optional", QString(), QString(), QString(), QString(), QVariant(), QVariant(), false ); QVERIFY( def->checkValueIsAcceptable( 1 ) ); QVERIFY( def->checkValueIsAcceptable( "test" ) ); QVERIFY( !def->checkValueIsAcceptable( "" ) ); @@ -9934,7 +9949,7 @@ void TestQgsProcessing::parameterMapTheme() QgsProcessingContext context; // not optional! - std::unique_ptr def( new QgsProcessingParameterMapTheme( "non_optional", QString(), QVariant(), false ) ); + auto def = std::make_unique( "non_optional", QString(), QVariant(), false ); QVERIFY( def->checkValueIsAcceptable( 1 ) ); QVERIFY( def->checkValueIsAcceptable( "test" ) ); QVERIFY( !def->checkValueIsAcceptable( "" ) ); @@ -10078,7 +10093,7 @@ void TestQgsProcessing::parameterProviderConnection() QgsProcessingContext context; // not optional, no default - std::unique_ptr def( new QgsProcessingParameterProviderConnection( "non_optional", QString(), QStringLiteral( "ogr" ), QVariant(), false ) ); + auto def = std::make_unique( "non_optional", QString(), QStringLiteral( "ogr" ), QVariant(), false ); QCOMPARE( def->providerId(), QStringLiteral( "ogr" ) ); def->setProviderId( QStringLiteral( "postgres" ) ); QCOMPARE( def->providerId(), QStringLiteral( "postgres" ) ); @@ -10236,7 +10251,7 @@ void TestQgsProcessing::parameterDatabaseSchema() QgsProcessingContext context; // not optional, no default - std::unique_ptr def( new QgsProcessingParameterDatabaseSchema( "non_optional", QString(), QString(), QVariant(), false ) ); + auto def = std::make_unique( "non_optional", QString(), QString(), QVariant(), false ); QVERIFY( def->checkValueIsAcceptable( 1 ) ); QVERIFY( def->checkValueIsAcceptable( "test" ) ); QVERIFY( !def->checkValueIsAcceptable( "" ) ); @@ -10334,7 +10349,7 @@ void TestQgsProcessing::parameterDatabaseTable() QgsProcessingContext context; // not optional, no default - std::unique_ptr def( new QgsProcessingParameterDatabaseTable( "non_optional", QString(), QString(), QString(), QVariant(), false ) ); + auto def = std::make_unique( "non_optional", QString(), QString(), QString(), QVariant(), false ); QVERIFY( def->checkValueIsAcceptable( 1 ) ); QVERIFY( def->checkValueIsAcceptable( "test" ) ); QVERIFY( !def->checkValueIsAcceptable( "" ) ); @@ -10448,7 +10463,7 @@ void TestQgsProcessing::parameterFieldMapping() QgsProcessingContext context; // not optional! - std::unique_ptr def( new QgsProcessingParameterFieldMapping( "non_optional", QString(), QStringLiteral( "parent" ), false ) ); + auto def = std::make_unique( "non_optional", QString(), QStringLiteral( "parent" ), false ); QVERIFY( !def->checkValueIsAcceptable( 1 ) ); QVERIFY( !def->checkValueIsAcceptable( "test" ) ); QVERIFY( !def->checkValueIsAcceptable( "" ) ); @@ -10515,7 +10530,7 @@ void TestQgsProcessing::parameterAggregate() QgsProcessingContext context; // not optional! - std::unique_ptr def( new QgsProcessingParameterAggregate( "non_optional", QString(), QStringLiteral( "parent" ), false ) ); + auto def = std::make_unique( "non_optional", QString(), QStringLiteral( "parent" ), false ); QVERIFY( !def->checkValueIsAcceptable( 1 ) ); QVERIFY( !def->checkValueIsAcceptable( "test" ) ); QVERIFY( !def->checkValueIsAcceptable( "" ) ); @@ -10609,7 +10624,7 @@ void TestQgsProcessing::parameterTinInputLayers() QgsVectorLayer *vectorLayer = new QgsVectorLayer( QStringLiteral( "Point" ), QStringLiteral( "PointLayerForTin" ), QStringLiteral( "memory" ) ); project.addMapLayer( vectorLayer ); - std::unique_ptr def( new QgsProcessingParameterTinInputLayers( "tin input layer" ) ); + auto def = std::make_unique( "tin input layer" ); QVERIFY( !def->checkValueIsAcceptable( 1 ) ); QVERIFY( !def->checkValueIsAcceptable( "test" ) ); QVERIFY( !def->checkValueIsAcceptable( "" ) ); @@ -10763,7 +10778,7 @@ void TestQgsProcessing::parameterMeshDatasetTime() QgsProject project; context.setProject( &project ); - std::unique_ptr def( new QgsProcessingParameterMeshDatasetTime( QStringLiteral( "dataset groups" ), QStringLiteral( "groups" ) ) ); + auto def = std::make_unique( QStringLiteral( "dataset groups" ), QStringLiteral( "groups" ) ); QVERIFY( def->type() == QLatin1String( "meshdatasettime" ) ); QVERIFY( def->checkValueIsAcceptable( QDateTime( QDate( 2020, 01, 01 ), QTime( 10, 0, 0 ) ) ) ); QVERIFY( def->checkValueIsAcceptable( QVariant::fromValue( QDateTime( QDate( 2020, 01, 01 ), QTime( 10, 0, 0 ) ) ).toString() ) ); @@ -10875,7 +10890,7 @@ void TestQgsProcessing::parameterDateTime() QgsProcessingContext context; // not optional, with default - std::unique_ptr def( new QgsProcessingParameterDateTime( "non_optional", QString(), Qgis::ProcessingDateTimeParameterDataType::DateTime, QDateTime( QDate( 2010, 4, 3 ), QTime( 12, 11, 10 ) ), false ) ); + auto def = std::make_unique( "non_optional", QString(), Qgis::ProcessingDateTimeParameterDataType::DateTime, QDateTime( QDate( 2010, 4, 3 ), QTime( 12, 11, 10 ) ), false ); QVERIFY( !def->checkValueIsAcceptable( 5 ) ); QVERIFY( !def->checkValueIsAcceptable( "1.1" ) ); QVERIFY( def->checkValueIsAcceptable( QDateTime( QDate( 2020, 2, 2 ), QTime( 0, 0, 0 ) ) ) ); @@ -11265,7 +11280,7 @@ void TestQgsProcessing::parameterDxfLayers() QgsVectorLayer *vectorLayer = new QgsVectorLayer( QStringLiteral( "Point" ), QStringLiteral( "PointLayer" ), QStringLiteral( "memory" ) ); project.addMapLayer( vectorLayer ); - std::unique_ptr def( new QgsProcessingParameterDxfLayers( "dxf input layer" ) ); + auto def = std::make_unique( "dxf input layer" ); QVERIFY( !def->checkValueIsAcceptable( 1 ) ); QVERIFY( def->checkValueIsAcceptable( "test" ) ); QVERIFY( !def->checkValueIsAcceptable( "" ) ); @@ -11403,7 +11418,7 @@ void TestQgsProcessing::parameterAnnotationLayer() context.setProject( &p ); // not optional, no default - std::unique_ptr def( new QgsProcessingParameterAnnotationLayer( "non_optional", QString(), QVariant(), false ) ); + auto def = std::make_unique( "non_optional", QString(), QVariant(), false ); QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) ); @@ -11583,7 +11598,7 @@ void TestQgsProcessing::parameterPointCloudLayer() context.setProject( &p ); // not optional, with default - std::unique_ptr def( new QgsProcessingParameterPointCloudLayer( "non_optional", QString(), QString( "somelayer" ), false ) ); + auto def = std::make_unique( "non_optional", QString(), QString( "somelayer" ), false ); QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) ); @@ -11733,7 +11748,7 @@ void TestQgsProcessing::parameterPointCloudAttribute() QgsProcessingContext context; // not optional, no default - std::unique_ptr def( new QgsProcessingParameterPointCloudAttribute( "non_optional", QString(), QVariant(), QString(), false, false ) ); + auto def = std::make_unique( "non_optional", QString(), QVariant(), QString(), false, false ); QVERIFY( def->checkValueIsAcceptable( 1 ) ); QVERIFY( def->checkValueIsAcceptable( "test" ) ); QVERIFY( !def->checkValueIsAcceptable( QStringList() << "a" << "b" ) ); @@ -11967,7 +11982,7 @@ void TestQgsProcessing::parameterAlignRasterLayers() QgsRasterLayer *rasterLayer = new QgsRasterLayer( fi.filePath(), "R1" ); project.addMapLayer( rasterLayer ); - std::unique_ptr def( new QgsProcessingParameterAlignRasterLayers( "align raster layer" ) ); + auto def = std::make_unique( "align raster layer" ); QVERIFY( !def->checkValueIsAcceptable( 1 ) ); QVERIFY( def->checkValueIsAcceptable( "test" ) ); QVERIFY( !def->checkValueIsAcceptable( "" ) ); @@ -12036,7 +12051,7 @@ void TestQgsProcessing::checkParamValues() void TestQgsProcessing::runAlgorithm() { - std::unique_ptr a = std::make_unique( "asd" ); + auto a = std::make_unique( "asd" ); a->mRaiseProcessException = false; a->mPrepared = false; a->mProcessed = false; @@ -12242,7 +12257,7 @@ void TestQgsProcessing::processingFeatureSink() context.setProject( &p ); // first using static string definition - std::unique_ptr def( new QgsProcessingParameterFeatureSink( QStringLiteral( "layer" ) ) ); + auto def = std::make_unique( QStringLiteral( "layer" ) ); QVariantMap params; params.insert( QStringLiteral( "layer" ), QgsProcessingOutputLayerDefinition( "memory:test", nullptr ) ); QString dest; @@ -12441,7 +12456,7 @@ void TestQgsProcessing::tempUtils() QVERIFY( tempFile3.startsWith( tempFolder ) ); // change temp folder in the settings - std::unique_ptr dir = std::make_unique(); + auto dir = std::make_unique(); const QString tempDirPath = dir->path(); dir.reset(); @@ -12512,7 +12527,7 @@ void TestQgsProcessing::convertCompatible() QVERIFY( out.startsWith( QgsProcessingUtils::tempFolder() ) ); // make sure all features are copied - std::unique_ptr t = std::make_unique( out, "vl2" ); + auto t = std::make_unique( out, "vl2" ); QCOMPARE( layer->featureCount(), t->featureCount() ); QCOMPARE( layer->crs().authid(), QStringLiteral( "EPSG:4326" ) ); @@ -12603,7 +12618,7 @@ void TestQgsProcessing::convertCompatible() QCOMPARE( layerName, QString() ); // non-OGR source -- must be translated, regardless of extension. (e.g. delimited text provider handles CSV very different to OGR!) - std::unique_ptr memLayer = std::make_unique( "Point", "v1", "memory" ); + auto memLayer = std::make_unique( "Point", "v1", "memory" ); for ( int i = 1; i < 6; ++i ) { QgsFeature f( i ); @@ -12627,7 +12642,7 @@ void TestQgsProcessing::convertCompatible() //delimited text -- must be translated, regardless of extension. (delimited text provider handles CSV very different to OGR!) const QString csvPath = "file://" + testDataDir + "delimitedtext/testpt.csv?type=csv&useHeader=No&detectTypes=yes&xyDms=yes&geomType=none&subsetIndex=no&watchFile=no"; - std::unique_ptr csvLayer = std::make_unique( csvPath, "vl", "delimitedtext" ); + auto csvLayer = std::make_unique( csvPath, "vl", "delimitedtext" ); QVERIFY( csvLayer->isValid() ); out = QgsProcessingUtils::convertToCompatibleFormat( csvLayer.get(), false, QStringLiteral( "test" ), QStringList() << "csv", QString( "csv" ), context, &feedback ); QVERIFY( out != csvLayer->source() ); @@ -12646,7 +12661,7 @@ void TestQgsProcessing::convertCompatible() // geopackage with layer QString gpkgPath = testDataDir + "points_gpkg.gpkg|layername=points_gpkg"; - std::unique_ptr gpkgLayer = std::make_unique( gpkgPath, "vl" ); + auto gpkgLayer = std::make_unique( gpkgPath, "vl" ); QVERIFY( gpkgLayer->isValid() ); out = QgsProcessingUtils::convertToCompatibleFormat( gpkgLayer.get(), false, QStringLiteral( "test" ), QStringList() << "gpkg" << "shp", QString( "shp" ), context, &feedback ); // layer must be translated -- we do not know if external tool can handle picking the correct layer automatically diff --git a/tests/src/analysis/testqgsprocessingalgspt1.cpp b/tests/src/analysis/testqgsprocessingalgspt1.cpp index b66380f3cbc8..1d12d38aa3d7 100644 --- a/tests/src/analysis/testqgsprocessingalgspt1.cpp +++ b/tests/src/analysis/testqgsprocessingalgspt1.cpp @@ -184,14 +184,14 @@ std::unique_ptr TestQgsProcessingAlgsPt1::fe QgsFeature TestQgsProcessingAlgsPt1::runForFeature( const std::unique_ptr &alg, QgsFeature feature, const QString &layerType, QVariantMap parameters ) { Q_ASSERT( alg.get() ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsProject p; context->setProject( &p ); QgsProcessingFeedback feedback; context->setFeedback( &feedback ); - std::unique_ptr inputLayer( std::make_unique( layerType, QStringLiteral( "layer" ), QStringLiteral( "memory" ) ) ); + auto inputLayer = std::make_unique( layerType, QStringLiteral( "layer" ), QStringLiteral( "memory" ) ); inputLayer->dataProvider()->addFeature( feature ); parameters.insert( QStringLiteral( "INPUT" ), QVariant::fromValue( inputLayer.get() ) ); @@ -286,7 +286,7 @@ QVariantMap pkgAlg( const QStringList &layers, const QString &outputGpkg, bool o { const QgsProcessingAlgorithm *package( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "native:package" ) ) ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); QgsProcessingFeedback feedback; @@ -317,7 +317,7 @@ void TestQgsProcessingAlgsPt1::saveFeaturesAlg() parameters.insert( QStringLiteral( "OUTPUT" ), outputGeoJson ); const QgsProcessingAlgorithm *saveFeatures( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "native:savefeatures" ) ) ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); QgsProcessingFeedback feedback; @@ -328,7 +328,7 @@ void TestQgsProcessingAlgsPt1::saveFeaturesAlg() QCOMPARE( outputs.value( QStringLiteral( "FILE_PATH" ) ).toString(), outputGeoJson ); QCOMPARE( outputs.value( QStringLiteral( "LAYER_NAME" ) ).toString(), layerName ); - std::unique_ptr savedLayer = std::make_unique( outputs.value( QStringLiteral( "OUTPUT" ) ).toString(), "points", "ogr" ); + auto savedLayer = std::make_unique( outputs.value( QStringLiteral( "OUTPUT" ) ).toString(), "points", "ogr" ); QVERIFY( savedLayer->isValid() ); QCOMPARE( savedLayer->getFeature( 1 ).geometry().asPoint().x(), -83.3 ); } @@ -386,18 +386,18 @@ void TestQgsProcessingAlgsPt1::packageAlg() QVERIFY( ok ); QVERIFY( !results.value( QStringLiteral( "OUTPUT" ) ).toString().isEmpty() ); - std::unique_ptr pointLayer = std::make_unique( outputGpkg + "|layername=points", "points", "ogr" ); + auto pointLayer = std::make_unique( outputGpkg + "|layername=points", "points", "ogr" ); QVERIFY( pointLayer->isValid() ); QCOMPARE( pointLayer->wkbType(), mPointsLayer->wkbType() ); QCOMPARE( pointLayer->featureCount(), mPointsLayer->featureCount() ); pointLayer.reset(); - std::unique_ptr polygonLayer = std::make_unique( outputGpkg + "|layername=polygons", "polygons", "ogr" ); + auto polygonLayer = std::make_unique( outputGpkg + "|layername=polygons", "polygons", "ogr" ); QVERIFY( polygonLayer->isValid() ); QCOMPARE( polygonLayer->wkbType(), mPolygonLayer->wkbType() ); QCOMPARE( polygonLayer->featureCount(), mPolygonLayer->featureCount() ); polygonLayer.reset(); - std::unique_ptr rectangles = std::make_unique( QStringLiteral( TEST_DATA_DIR ) + "/rectangles.shp", QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); + auto rectangles = std::make_unique( QStringLiteral( TEST_DATA_DIR ) + "/rectangles.shp", QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); QgsProject::instance()->addMapLayers( QList() << rectangles.get() ); QgsLayerMetadata metadata; metadata.setFees( QStringLiteral( "lots of dogecoin" ) ); @@ -408,7 +408,7 @@ void TestQgsProcessingAlgsPt1::packageAlg() QVERIFY( ok ); QVERIFY( !results2.value( QStringLiteral( "OUTPUT" ) ).toString().isEmpty() ); - std::unique_ptr rectanglesPackagedLayer = std::make_unique( outputGpkg + "|layername=rectangles", "points", "ogr" ); + auto rectanglesPackagedLayer = std::make_unique( outputGpkg + "|layername=rectangles", "points", "ogr" ); QVERIFY( rectanglesPackagedLayer->isValid() ); QCOMPARE( rectanglesPackagedLayer->wkbType(), rectanglesPackagedLayer->wkbType() ); QCOMPARE( rectanglesPackagedLayer->featureCount(), rectangles->featureCount() ); @@ -449,7 +449,7 @@ void TestQgsProcessingAlgsPt1::packageAlg() QVERIFY( ok ); QVERIFY( !results4.value( QStringLiteral( "OUTPUT" ) ).toString().isEmpty() ); - std::unique_ptr selectedPolygonsPackagedLayer = std::make_unique( outputGpkg + "|layername=polygons", "polygons", "ogr" ); + auto selectedPolygonsPackagedLayer = std::make_unique( outputGpkg + "|layername=polygons", "polygons", "ogr" ); QVERIFY( selectedPolygonsPackagedLayer->isValid() ); QCOMPARE( selectedPolygonsPackagedLayer->wkbType(), mPolygonLayer->wkbType() ); QCOMPARE( selectedPolygonsPackagedLayer->featureCount(), 3 ); @@ -472,7 +472,7 @@ void TestQgsProcessingAlgsPt1::rasterLayerProperties() const QString myDataPath( TEST_DATA_DIR ); //defined in CMakeLists.txt - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QVariantMap parameters; @@ -550,7 +550,7 @@ void TestQgsProcessingAlgsPt1::exportToSpreadsheetOptions() const QgsProcessingAlgorithm *alg( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "native:exporttospreadsheet" ) ) ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); QgsProcessingFeedback feedback; @@ -563,7 +563,7 @@ void TestQgsProcessingAlgsPt1::exportToSpreadsheetOptions() QVERIFY( ok ); QVERIFY( !results.value( QStringLiteral( "OUTPUT" ) ).toString().isEmpty() ); - std::unique_ptr pointLayer = std::make_unique( outputPath + "|layername=points", "points", "ogr" ); + auto pointLayer = std::make_unique( outputPath + "|layername=points", "points", "ogr" ); QCOMPARE( pointLayer->fields().at( 0 ).name(), QStringLiteral( "Class" ) ); QCOMPARE( pointLayer->fields().at( 1 ).name(), QStringLiteral( "Heading" ) ); QCOMPARE( pointLayer->fields().at( 2 ).name(), QStringLiteral( "Importance" ) ); @@ -631,7 +631,7 @@ void TestQgsProcessingAlgsPt1::exportToSpreadsheet( const QString &outputPath ) const QgsProcessingAlgorithm *alg( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "native:exporttospreadsheet" ) ) ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); QgsProcessingFeedback feedback; @@ -643,16 +643,16 @@ void TestQgsProcessingAlgsPt1::exportToSpreadsheet( const QString &outputPath ) QVERIFY( ok ); QVERIFY( !results.value( QStringLiteral( "OUTPUT" ) ).toString().isEmpty() ); - std::unique_ptr pointLayer = std::make_unique( outputPath + "|layername=points", "points", "ogr" ); + auto pointLayer = std::make_unique( outputPath + "|layername=points", "points", "ogr" ); QVERIFY( pointLayer->isValid() ); QCOMPARE( pointLayer->featureCount(), mPointsLayer->featureCount() ); pointLayer.reset(); - std::unique_ptr polygonLayer = std::make_unique( outputPath + "|layername=polygons", "polygons", "ogr" ); + auto polygonLayer = std::make_unique( outputPath + "|layername=polygons", "polygons", "ogr" ); QVERIFY( polygonLayer->isValid() ); QCOMPARE( polygonLayer->featureCount(), mPolygonLayer->featureCount() ); polygonLayer.reset(); - std::unique_ptr rectangles = std::make_unique( QStringLiteral( TEST_DATA_DIR ) + "/rectangles.shp", QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); + auto rectangles = std::make_unique( QStringLiteral( TEST_DATA_DIR ) + "/rectangles.shp", QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); QgsProject::instance()->addMapLayers( QList() << rectangles.get() ); // Test adding an additional layer (overwrite disabled) @@ -661,7 +661,7 @@ void TestQgsProcessingAlgsPt1::exportToSpreadsheet( const QString &outputPath ) QVERIFY( ok ); QVERIFY( !results2.value( QStringLiteral( "OUTPUT" ) ).toString().isEmpty() ); - std::unique_ptr rectanglesPackagedLayer = std::make_unique( outputPath + "|layername=rectangles", "points", "ogr" ); + auto rectanglesPackagedLayer = std::make_unique( outputPath + "|layername=rectangles", "points", "ogr" ); QVERIFY( rectanglesPackagedLayer->isValid() ); QCOMPARE( rectanglesPackagedLayer->featureCount(), rectangles->featureCount() ); rectanglesPackagedLayer.reset(); @@ -690,7 +690,7 @@ void TestQgsProcessingAlgsPt1::renameLayerAlg() const QgsProcessingAlgorithm *package( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "native:renamelayer" ) ) ); QVERIFY( package ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); QgsVectorLayer *layer = new QgsVectorLayer( QStringLiteral( "Point?field=col1:real" ), QStringLiteral( "layer" ), QStringLiteral( "memory" ) ); @@ -742,7 +742,7 @@ void TestQgsProcessingAlgsPt1::loadLayerAlg() const QgsProcessingAlgorithm *package( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "native:loadlayer" ) ) ); QVERIFY( package ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsProject p; context->setProject( &p ); @@ -975,7 +975,7 @@ void TestQgsProcessingAlgsPt1::transformAlg() std::unique_ptr alg( QgsApplication::processingRegistry()->createAlgorithmById( QStringLiteral( "native:reprojectlayer" ) ) ); QVERIFY( alg != nullptr ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsProject p; context->setProject( &p ); @@ -1062,7 +1062,7 @@ void TestQgsProcessingAlgsPt1::categorizeByStyle() std::unique_ptr alg( QgsApplication::processingRegistry()->createAlgorithmById( QStringLiteral( "native:categorizeusingstyle" ) ) ); QVERIFY( alg != nullptr ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsProject p; context->setProject( &p ); @@ -1190,7 +1190,7 @@ void TestQgsProcessingAlgsPt1::extractBinary() std::unique_ptr alg( QgsApplication::processingRegistry()->createAlgorithmById( QStringLiteral( "native:extractbinary" ) ) ); QVERIFY( alg != nullptr ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsProject p; context->setProject( &p ); @@ -1240,7 +1240,7 @@ void TestQgsProcessingAlgsPt1::createDirectory() parameters.insert( QStringLiteral( "PATH" ), outputPath ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsProcessingFeedback feedback; QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); @@ -1272,7 +1272,7 @@ void TestQgsProcessingAlgsPt1::flattenRelations() std::unique_ptr alg( QgsApplication::processingRegistry()->createAlgorithmById( QStringLiteral( "native:flattenrelationships" ) ) ); QVERIFY( alg != nullptr ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsProject p; context->setProject( &p ); @@ -1820,7 +1820,7 @@ void TestQgsProcessingAlgsPt1::createConstantRaster() p.setCrs( QgsCoordinateReferenceSystem( crs ), true ); //set project after layer has been added so that transform context/ellipsoid from crs is also set - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &p ); QVariantMap parameters; @@ -1845,7 +1845,7 @@ void TestQgsProcessingAlgsPt1::createConstantRaster() else { //prepare expectedRaster - std::unique_ptr expectedRasterLayer = std::make_unique( myDataPath + "/control_images/expected_constantRaster" + expectedRaster, "expectedDataset", "gdal" ); + auto expectedRasterLayer = std::make_unique( myDataPath + "/control_images/expected_constantRaster" + expectedRaster, "expectedDataset", "gdal" ); std::unique_ptr expectedInterface( expectedRasterLayer->dataProvider()->clone() ); QgsRasterIterator expectedIter( expectedInterface.get() ); expectedIter.startRasterRead( 1, expectedRasterLayer->width(), expectedRasterLayer->height(), expectedInterface->extent() ); @@ -1855,7 +1855,7 @@ void TestQgsProcessingAlgsPt1::createConstantRaster() QVERIFY( ok ); //...and check results with expected datasets - std::unique_ptr outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); + auto outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); std::unique_ptr outputInterface( outputRaster->dataProvider()->clone() ); QCOMPARE( outputRaster->width(), expectedRasterLayer->width() ); @@ -2037,13 +2037,13 @@ void TestQgsProcessingAlgsPt1::fillNoData() const QString myDataPath( TEST_DATA_DIR ); //defined in CmakeLists.txt - std::unique_ptr inputRasterLayer = std::make_unique( myDataPath + inputRaster, "inputDataset", "gdal" ); + auto inputRasterLayer = std::make_unique( myDataPath + inputRaster, "inputDataset", "gdal" ); //set project crs and ellipsoid from input layer p.setCrs( inputRasterLayer->crs(), true ); //set project after layer has been added so that transform context/ellipsoid from crs is also set - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &p ); QVariantMap parameters; @@ -2054,7 +2054,7 @@ void TestQgsProcessingAlgsPt1::fillNoData() parameters.insert( QStringLiteral( "OUTPUT" ), QgsProcessing::TEMPORARY_OUTPUT ); //prepare expectedRaster - std::unique_ptr expectedRasterLayer = std::make_unique( myDataPath + "/control_images/fillNoData/" + expectedRaster, "expectedDataset", "gdal" ); + auto expectedRasterLayer = std::make_unique( myDataPath + "/control_images/fillNoData/" + expectedRaster, "expectedDataset", "gdal" ); std::unique_ptr expectedInterface( expectedRasterLayer->dataProvider()->clone() ); QgsRasterIterator expectedIter( expectedInterface.get() ); expectedIter.startRasterRead( 1, expectedRasterLayer->width(), expectedRasterLayer->height(), expectedInterface->extent() ); @@ -2069,7 +2069,7 @@ void TestQgsProcessingAlgsPt1::fillNoData() QVERIFY( ok ); //...and check results with expected datasets - std::unique_ptr outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); + auto outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); std::unique_ptr outputInterface( outputRaster->dataProvider()->clone() ); QCOMPARE( outputRaster->width(), expectedRasterLayer->width() ); @@ -2162,7 +2162,7 @@ void TestQgsProcessingAlgsPt1::lineDensity() p.setCrs( layer->crs(), true ); //set project after layer has been added so that transform context/ellipsoid from crs is also set - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &p ); QVariantMap parameters; @@ -2174,7 +2174,7 @@ void TestQgsProcessingAlgsPt1::lineDensity() parameters.insert( QStringLiteral( "OUTPUT" ), QgsProcessing::TEMPORARY_OUTPUT ); //prepare expectedRaster - std::unique_ptr expectedRaster = std::make_unique( myDataPath + "/control_images/expected_raster_linedensity" + expectedDataset, "expectedDataset", "gdal" ); + auto expectedRaster = std::make_unique( myDataPath + "/control_images/expected_raster_linedensity" + expectedDataset, "expectedDataset", "gdal" ); std::unique_ptr expectedInterface( expectedRaster->dataProvider()->clone() ); QgsRasterIterator expectedIter( expectedInterface.get() ); expectedIter.startRasterRead( 1, expectedRaster->width(), expectedRaster->height(), expectedInterface->extent() ); @@ -2189,7 +2189,7 @@ void TestQgsProcessingAlgsPt1::lineDensity() QVERIFY( ok ); //...and check results with expected datasets - std::unique_ptr outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); + auto outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); std::unique_ptr outputInterface( outputRaster->dataProvider()->clone() ); QCOMPARE( outputRaster->width(), expectedRaster->width() ); @@ -2377,7 +2377,7 @@ void TestQgsProcessingAlgsPt1::rasterLogicOp() // create a GeoTIFF - this will create data provider in editable mode const QString filename = tmpFile.fileName(); - std::unique_ptr writer = std::make_unique( filename ); + auto writer = std::make_unique( filename ); writer->setOutputProviderKey( QStringLiteral( "gdal" ) ); writer->setOutputFormat( QStringLiteral( "GTiff" ) ); std::unique_ptr dp( writer->createOneBandRaster( Qgis::DataType::Float32, nCols, nRows, input[ii].empty() ? badExtent : extent, crs ) ); @@ -2730,13 +2730,13 @@ void TestQgsProcessingAlgsPt1::cellStatistics() inputDatasetPaths << myDataPath + raster; } - std::unique_ptr inputRasterLayer1 = std::make_unique( myDataPath + inputRasters[0], "inputDataset", "gdal" ); + auto inputRasterLayer1 = std::make_unique( myDataPath + inputRasters[0], "inputDataset", "gdal" ); //set project crs and ellipsoid from input layer p.setCrs( inputRasterLayer1->crs(), true ); //set project after layer has been added so that transform context/ellipsoid from crs is also set - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &p ); QVariantMap parameters; @@ -2748,7 +2748,7 @@ void TestQgsProcessingAlgsPt1::cellStatistics() parameters.insert( QStringLiteral( "OUTPUT" ), QgsProcessing::TEMPORARY_OUTPUT ); //prepare expectedRaster - std::unique_ptr expectedRasterLayer = std::make_unique( myDataPath + "/control_images/expected_cellStatistics/" + expectedRaster, "expectedDataset", "gdal" ); + auto expectedRasterLayer = std::make_unique( myDataPath + "/control_images/expected_cellStatistics/" + expectedRaster, "expectedDataset", "gdal" ); std::unique_ptr expectedInterface( expectedRasterLayer->dataProvider()->clone() ); QgsRasterIterator expectedIter( expectedInterface.get() ); expectedIter.startRasterRead( 1, expectedRasterLayer->width(), expectedRasterLayer->height(), expectedInterface->extent() ); @@ -2763,7 +2763,7 @@ void TestQgsProcessingAlgsPt1::cellStatistics() QVERIFY( ok ); //...and check results with expected datasets - std::unique_ptr outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); + auto outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); std::unique_ptr outputInterface( outputRaster->dataProvider()->clone() ); QCOMPARE( outputInterface->dataType( 1 ), expectedDataType ); @@ -2984,13 +2984,13 @@ void TestQgsProcessingAlgsPt1::percentileRaster() inputDatasetPaths << myDataPath + raster; } - std::unique_ptr inputRasterLayer1 = std::make_unique( myDataPath + inputRasters[0], "inputDataset", "gdal" ); + auto inputRasterLayer1 = std::make_unique( myDataPath + inputRasters[0], "inputDataset", "gdal" ); //set project crs and ellipsoid from input layer p.setCrs( inputRasterLayer1->crs(), true ); //set project after layer has been added so that transform context/ellipsoid from crs is also set - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &p ); QVariantMap parameters; @@ -3003,7 +3003,7 @@ void TestQgsProcessingAlgsPt1::percentileRaster() parameters.insert( QStringLiteral( "OUTPUT" ), QgsProcessing::TEMPORARY_OUTPUT ); //prepare expectedRaster - std::unique_ptr expectedRasterLayer = std::make_unique( myDataPath + "/control_images/expected_cellStackPercentile/" + expectedRaster, "expectedDataset", "gdal" ); + auto expectedRasterLayer = std::make_unique( myDataPath + "/control_images/expected_cellStackPercentile/" + expectedRaster, "expectedDataset", "gdal" ); std::unique_ptr expectedInterface( expectedRasterLayer->dataProvider()->clone() ); QgsRasterIterator expectedIter( expectedInterface.get() ); expectedIter.startRasterRead( 1, expectedRasterLayer->width(), expectedRasterLayer->height(), expectedInterface->extent() ); @@ -3017,7 +3017,7 @@ void TestQgsProcessingAlgsPt1::percentileRaster() QVERIFY( ok ); //...and check results with expected datasets - std::unique_ptr outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); + auto outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); std::unique_ptr outputInterface( outputRaster->dataProvider()->clone() ); QCOMPARE( outputInterface->dataType( 1 ), expectedDataType ); @@ -3223,13 +3223,13 @@ void TestQgsProcessingAlgsPt1::percentrankByRaster() inputDatasetPaths << myDataPath + raster; } - std::unique_ptr inputRasterLayer1 = std::make_unique( myDataPath + inputRasters[0], "inputDataset", "gdal" ); + auto inputRasterLayer1 = std::make_unique( myDataPath + inputRasters[0], "inputDataset", "gdal" ); //set project crs and ellipsoid from input layer p.setCrs( inputRasterLayer1->crs(), true ); //set project after layer has been added so that transform context/ellipsoid from crs is also set - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &p ); QVariantMap parameters; @@ -3244,7 +3244,7 @@ void TestQgsProcessingAlgsPt1::percentrankByRaster() parameters.insert( QStringLiteral( "OUTPUT" ), QgsProcessing::TEMPORARY_OUTPUT ); //prepare expectedRaster - std::unique_ptr expectedRasterLayer = std::make_unique( myDataPath + "/control_images/expected_cellStackPercentrankFromRaster/" + expectedRaster, "expectedDataset", "gdal" ); + auto expectedRasterLayer = std::make_unique( myDataPath + "/control_images/expected_cellStackPercentrankFromRaster/" + expectedRaster, "expectedDataset", "gdal" ); std::unique_ptr expectedInterface( expectedRasterLayer->dataProvider()->clone() ); QgsRasterIterator expectedIter( expectedInterface.get() ); expectedIter.startRasterRead( 1, expectedRasterLayer->width(), expectedRasterLayer->height(), expectedInterface->extent() ); @@ -3258,7 +3258,7 @@ void TestQgsProcessingAlgsPt1::percentrankByRaster() QVERIFY( ok ); //...and check results with expected datasets - std::unique_ptr outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); + auto outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); std::unique_ptr outputInterface( outputRaster->dataProvider()->clone() ); QCOMPARE( outputInterface->dataType( 1 ), expectedDataType ); @@ -3396,13 +3396,13 @@ void TestQgsProcessingAlgsPt1::percentrankByValue() inputDatasetPaths << myDataPath + raster; } - std::unique_ptr inputRasterLayer1 = std::make_unique( myDataPath + inputRasters[0], "inputDataset", "gdal" ); + auto inputRasterLayer1 = std::make_unique( myDataPath + inputRasters[0], "inputDataset", "gdal" ); //set project crs and ellipsoid from input layer p.setCrs( inputRasterLayer1->crs(), true ); //set project after layer has been added so that transform context/ellipsoid from crs is also set - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &p ); QVariantMap parameters; @@ -3416,7 +3416,7 @@ void TestQgsProcessingAlgsPt1::percentrankByValue() parameters.insert( QStringLiteral( "OUTPUT" ), QgsProcessing::TEMPORARY_OUTPUT ); //prepare expectedRaster - std::unique_ptr expectedRasterLayer = std::make_unique( myDataPath + "/control_images/expected_cellStackPercentrankFromValue/" + expectedRaster, "expectedDataset", "gdal" ); + auto expectedRasterLayer = std::make_unique( myDataPath + "/control_images/expected_cellStackPercentrankFromValue/" + expectedRaster, "expectedDataset", "gdal" ); std::unique_ptr expectedInterface( expectedRasterLayer->dataProvider()->clone() ); QgsRasterIterator expectedIter( expectedInterface.get() ); expectedIter.startRasterRead( 1, expectedRasterLayer->width(), expectedRasterLayer->height(), expectedInterface->extent() ); @@ -3430,7 +3430,7 @@ void TestQgsProcessingAlgsPt1::percentrankByValue() QVERIFY( ok ); //...and check results with expected datasets - std::unique_ptr outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); + auto outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); std::unique_ptr outputInterface( outputRaster->dataProvider()->clone() ); QCOMPARE( outputInterface->dataType( 1 ), expectedDataType ); @@ -3640,13 +3640,13 @@ void TestQgsProcessingAlgsPt1::rasterFrequencyByComparisonOperator() inputDatasetPaths << myDataPath + raster; } - std::unique_ptr inputRasterLayer1 = std::make_unique( myDataPath + inputRasters[0], "inputDataset", "gdal" ); + auto inputRasterLayer1 = std::make_unique( myDataPath + inputRasters[0], "inputDataset", "gdal" ); //set project crs and ellipsoid from input layer p.setCrs( inputRasterLayer1->crs(), true ); //set project after layer has been added so that transform context/ellipsoid from crs is also set - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &p ); QVariantMap parameters; @@ -3658,7 +3658,7 @@ void TestQgsProcessingAlgsPt1::rasterFrequencyByComparisonOperator() parameters.insert( QStringLiteral( "OUTPUT" ), QgsProcessing::TEMPORARY_OUTPUT ); //prepare expectedRaster - std::unique_ptr expectedRasterLayer = std::make_unique( myDataPath + "/control_images" + expectedRaster, "expectedDataset", "gdal" ); + auto expectedRasterLayer = std::make_unique( myDataPath + "/control_images" + expectedRaster, "expectedDataset", "gdal" ); std::unique_ptr expectedInterface( expectedRasterLayer->dataProvider()->clone() ); QgsRasterIterator expectedIter( expectedInterface.get() ); expectedIter.startRasterRead( 1, expectedRasterLayer->width(), expectedRasterLayer->height(), expectedInterface->extent() ); @@ -3673,7 +3673,7 @@ void TestQgsProcessingAlgsPt1::rasterFrequencyByComparisonOperator() QVERIFY( ok ); //...and check results with expected datasets - std::unique_ptr outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); + auto outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); std::unique_ptr outputInterface( outputRaster->dataProvider()->clone() ); QCOMPARE( outputInterface->dataType( 1 ), expectedDataType ); @@ -3784,13 +3784,13 @@ void TestQgsProcessingAlgsPt1::rasterLocalPosition() inputDatasetPaths << myDataPath + raster; } - std::unique_ptr inputRasterLayer1 = std::make_unique( myDataPath + inputRasters[0], "inputDataset", "gdal" ); + auto inputRasterLayer1 = std::make_unique( myDataPath + inputRasters[0], "inputDataset", "gdal" ); //set project crs and ellipsoid from input layer p.setCrs( inputRasterLayer1->crs(), true ); //set project after layer has been added so that transform context/ellipsoid from crs is also set - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &p ); QVariantMap parameters; @@ -3801,7 +3801,7 @@ void TestQgsProcessingAlgsPt1::rasterLocalPosition() parameters.insert( QStringLiteral( "OUTPUT" ), QgsProcessing::TEMPORARY_OUTPUT ); //prepare expectedRaster - std::unique_ptr expectedRasterLayer = std::make_unique( myDataPath + "/control_images" + expectedRaster, "expectedDataset", "gdal" ); + auto expectedRasterLayer = std::make_unique( myDataPath + "/control_images" + expectedRaster, "expectedDataset", "gdal" ); std::unique_ptr expectedInterface( expectedRasterLayer->dataProvider()->clone() ); QgsRasterIterator expectedIter( expectedInterface.get() ); expectedIter.startRasterRead( 1, expectedRasterLayer->width(), expectedRasterLayer->height(), expectedInterface->extent() ); @@ -3815,7 +3815,7 @@ void TestQgsProcessingAlgsPt1::rasterLocalPosition() QVERIFY( ok ); //...and check results with expected datasets - std::unique_ptr outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); + auto outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); std::unique_ptr outputInterface( outputRaster->dataProvider()->clone() ); QCOMPARE( outputRaster->width(), expectedRasterLayer->width() ); @@ -4004,13 +4004,13 @@ void TestQgsProcessingAlgsPt1::roundRasterValues() std::unique_ptr alg( QgsApplication::processingRegistry()->createAlgorithmById( QStringLiteral( "native:roundrastervalues" ) ) ); const QString rasterSource = copyTestData( inputRaster ); - std::unique_ptr inputRasterLayer = std::make_unique( rasterSource, "inputDataset", "gdal" ); + auto inputRasterLayer = std::make_unique( rasterSource, "inputDataset", "gdal" ); //set project crs and ellipsoid from input layer p.setCrs( inputRasterLayer->crs(), true ); //set project after layer has been added so that transform context/ellipsoid from crs is also set - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &p ); QVariantMap parameters; @@ -4023,7 +4023,7 @@ void TestQgsProcessingAlgsPt1::roundRasterValues() parameters.insert( QStringLiteral( "OUTPUT" ), QgsProcessing::TEMPORARY_OUTPUT ); //prepare expectedRaster - std::unique_ptr expectedRasterLayer = std::make_unique( testDataPath( "/control_images/roundRasterValues/" + expectedRaster ), "expectedDataset", "gdal" ); + auto expectedRasterLayer = std::make_unique( testDataPath( "/control_images/roundRasterValues/" + expectedRaster ), "expectedDataset", "gdal" ); std::unique_ptr expectedInterface( expectedRasterLayer->dataProvider()->clone() ); QgsRasterIterator expectedIter( expectedInterface.get() ); expectedIter.startRasterRead( 1, expectedRasterLayer->width(), expectedRasterLayer->height(), expectedInterface->extent() ); @@ -4038,7 +4038,7 @@ void TestQgsProcessingAlgsPt1::roundRasterValues() QVERIFY( ok ); //...and check results with expected datasets - std::unique_ptr outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); + auto outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); std::unique_ptr outputInterface( outputRaster->dataProvider()->clone() ); QCOMPARE( outputRaster->width(), expectedRasterLayer->width() ); @@ -4077,7 +4077,7 @@ void TestQgsProcessingAlgsPt1::layoutMapExtent() std::unique_ptr alg( QgsApplication::processingRegistry()->createAlgorithmById( QStringLiteral( "native:printlayoutmapextenttolayer" ) ) ); QVERIFY( alg != nullptr ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsProject p; context->setProject( &p ); @@ -4263,7 +4263,7 @@ void TestQgsProcessingAlgsPt1::styleFromProject() std::unique_ptr alg( QgsApplication::processingRegistry()->createAlgorithmById( QStringLiteral( "native:stylefromproject" ) ) ); QVERIFY( alg != nullptr ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &p ); QVariantMap parameters; @@ -4353,7 +4353,7 @@ void TestQgsProcessingAlgsPt1::combineStyles() std::unique_ptr alg( QgsApplication::processingRegistry()->createAlgorithmById( QStringLiteral( "native:combinestyles" ) ) ); QVERIFY( alg != nullptr ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QVariantMap parameters; parameters.insert( QStringLiteral( "INPUT" ), QStringList() << tmpFile.fileName() << tmpFile2.fileName() ); @@ -4412,7 +4412,7 @@ void TestQgsProcessingAlgsPt1::bookmarksToLayer() std::unique_ptr alg( QgsApplication::processingRegistry()->createAlgorithmById( QStringLiteral( "native:bookmarkstolayer" ) ) ); QVERIFY( alg != nullptr ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &p ); QVariantMap parameters; @@ -4479,7 +4479,7 @@ void TestQgsProcessingAlgsPt1::bookmarksToLayer() void TestQgsProcessingAlgsPt1::layerToBookmarks() { - std::unique_ptr inputLayer( std::make_unique( QStringLiteral( "Polygon?crs=epsg:4326&field=province:string&field=municipality:string" ), QStringLiteral( "layer" ), QStringLiteral( "memory" ) ) ); + auto inputLayer = std::make_unique( QStringLiteral( "Polygon?crs=epsg:4326&field=province:string&field=municipality:string" ), QStringLiteral( "layer" ), QStringLiteral( "memory" ) ); QVERIFY( inputLayer->isValid() ); QgsFeature f; @@ -4497,7 +4497,7 @@ void TestQgsProcessingAlgsPt1::layerToBookmarks() QVERIFY( alg != nullptr ); QgsProject p; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &p ); QVariantMap parameters; @@ -4555,7 +4555,7 @@ void TestQgsProcessingAlgsPt1::repairShapefile() QFile::copy( dataDir + "/points.shp", tmpPath.filePath( QStringLiteral( "points.dbf" ) ) ); // no shx!! - std::unique_ptr layer = std::make_unique( tmpPath.filePath( QStringLiteral( "points.shp" ) ) ); + auto layer = std::make_unique( tmpPath.filePath( QStringLiteral( "points.shp" ) ) ); QVERIFY( !layer->isValid() ); std::unique_ptr alg( QgsApplication::processingRegistry()->createAlgorithmById( QStringLiteral( "native:repairshapefile" ) ) ); @@ -4566,7 +4566,7 @@ void TestQgsProcessingAlgsPt1::repairShapefile() bool ok = false; QgsProcessingFeedback feedback; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); @@ -4599,7 +4599,7 @@ void TestQgsProcessingAlgsPt1::renameField() bool ok = false; QgsProcessingFeedback feedback; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); @@ -4648,7 +4648,7 @@ void TestQgsProcessingAlgsPt1::compareDatasets() bool ok = false; QgsProcessingFeedback feedback; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); @@ -4819,7 +4819,7 @@ void TestQgsProcessingAlgsPt1::shapefileEncoding() bool ok = false; QgsProcessingFeedback feedback; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); @@ -4863,7 +4863,7 @@ void TestQgsProcessingAlgsPt1::setLayerEncoding() bool ok = false; QgsProcessingFeedback feedback; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &p ); QVariantMap results; @@ -4910,7 +4910,7 @@ void TestQgsProcessingAlgsPt1::raiseException() parameters.insert( QStringLiteral( "MESSAGE" ), QStringLiteral( "you done screwed up boy" ) ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); @@ -4944,7 +4944,7 @@ void TestQgsProcessingAlgsPt1::raiseWarning() parameters.insert( QStringLiteral( "MESSAGE" ), QStringLiteral( "you mighta screwed up boy, but i aint so sure" ) ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); @@ -4978,7 +4978,7 @@ void TestQgsProcessingAlgsPt1::raiseMessage() parameters.insert( QStringLiteral( "MESSAGE" ), QStringLiteral( "nothing screwed up boy, congrats" ) ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); @@ -5055,7 +5055,7 @@ void TestQgsProcessingAlgsPt1::randomFloatingPointDistributionRaster() std::unique_ptr alg( QgsApplication::processingRegistry()->createAlgorithmById( algname ) ); //set project after layer has been added so that transform context/ellipsoid from crs is also set - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &p ); QVariantMap parameters; @@ -5083,7 +5083,7 @@ void TestQgsProcessingAlgsPt1::randomFloatingPointDistributionRaster() QVERIFY( ok ); //...and check results with expected datasets - std::unique_ptr outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); + auto outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); std::unique_ptr outputInterface( outputRaster->dataProvider()->clone() ); QCOMPARE( outputInterface->dataType( 1 ), expectedDataType ); @@ -5180,7 +5180,7 @@ void TestQgsProcessingAlgsPt1::randomIntegerDistributionRaster() std::unique_ptr alg( QgsApplication::processingRegistry()->createAlgorithmById( algname ) ); //set project after layer has been added so that transform context/ellipsoid from crs is also set - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &p ); QVariantMap parameters; @@ -5208,7 +5208,7 @@ void TestQgsProcessingAlgsPt1::randomIntegerDistributionRaster() QVERIFY( ok ); //...and check results with expected datasets - std::unique_ptr outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); + auto outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); std::unique_ptr outputInterface( outputRaster->dataProvider()->clone() ); QCOMPARE( outputInterface->dataType( 1 ), expectedDataType ); @@ -5464,7 +5464,7 @@ void TestQgsProcessingAlgsPt1::randomRaster() p.setCrs( QgsCoordinateReferenceSystem( crs ), true ); //set project after layer has been added so that transform context/ellipsoid from crs is also set - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &p ); QVariantMap parameters; @@ -5494,7 +5494,7 @@ void TestQgsProcessingAlgsPt1::randomRaster() QVERIFY( ok ); //...and check results with expected datasets - std::unique_ptr outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); + auto outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); std::unique_ptr outputInterface( outputRaster->dataProvider()->clone() ); QCOMPARE( outputInterface->dataType( 1 ), expectedDataType ); @@ -5543,7 +5543,7 @@ void TestQgsProcessingAlgsPt1::filterByLayerType() parameters.insert( QStringLiteral( "INPUT" ), QStringLiteral( "vl" ) ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &p ); QgsProcessingFeedback feedback; QVariantMap results; @@ -5587,7 +5587,7 @@ void TestQgsProcessingAlgsPt1::conditionalBranch() parameters.insert( QStringLiteral( "INPUT" ), QStringLiteral( "vl" ) ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsProcessingFeedback feedback; QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok, config ); @@ -5605,7 +5605,7 @@ void TestQgsProcessingAlgsPt1::saveLog() parameters.insert( QStringLiteral( "OUTPUT" ), QgsProcessing::TEMPORARY_OUTPUT ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsProcessingFeedback feedback; feedback.reportError( QStringLiteral( "test" ) ); QVariantMap results; @@ -5636,7 +5636,7 @@ void TestQgsProcessingAlgsPt1::setProjectVariable() parameters.insert( QStringLiteral( "VALUE" ), 11 ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsProject p; context->setProject( &p ); QgsProcessingFeedback feedback; diff --git a/tests/src/analysis/testqgsprocessingalgspt2.cpp b/tests/src/analysis/testqgsprocessingalgspt2.cpp index 26514b47392c..b09d6a12df02 100644 --- a/tests/src/analysis/testqgsprocessingalgspt2.cpp +++ b/tests/src/analysis/testqgsprocessingalgspt2.cpp @@ -125,14 +125,14 @@ std::unique_ptr TestQgsProcessingAlgsPt2::fe QgsFeature TestQgsProcessingAlgsPt2::runForFeature( const std::unique_ptr &alg, QgsFeature feature, const QString &layerType, QVariantMap parameters ) { Q_ASSERT( alg.get() ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsProject p; context->setProject( &p ); QgsProcessingFeedback feedback; context->setFeedback( &feedback ); - std::unique_ptr inputLayer( std::make_unique( layerType, QStringLiteral( "layer" ), QStringLiteral( "memory" ) ) ); + auto inputLayer = std::make_unique( layerType, QStringLiteral( "layer" ), QStringLiteral( "memory" ) ); inputLayer->dataProvider()->addFeature( feature ); parameters.insert( QStringLiteral( "INPUT" ), QVariant::fromValue( inputLayer.get() ) ); @@ -219,7 +219,7 @@ QVariantMap pkgAlg( const QStringList &layers, const QString &outputGpkg, bool o { const QgsProcessingAlgorithm *package( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "native:package" ) ) ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); QgsProcessingFeedback feedback; @@ -253,7 +253,7 @@ void TestQgsProcessingAlgsPt2::exportLayoutPdf() parameters.insert( QStringLiteral( "OUTPUT" ), outputPdf ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &p ); QgsProcessingFeedback feedback; QVariantMap results; @@ -297,7 +297,7 @@ void TestQgsProcessingAlgsPt2::exportLayoutPng() parameters.insert( QStringLiteral( "OUTPUT" ), outputPng ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &p ); QgsProcessingFeedback feedback; QVariantMap results; @@ -357,7 +357,7 @@ void TestQgsProcessingAlgsPt2::exportAtlasLayoutPdf() parameters.insert( QStringLiteral( "DPI" ), 96 ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &p ); QgsProcessingFeedback feedback; QVariantMap results; @@ -402,7 +402,7 @@ void TestQgsProcessingAlgsPt2::exportAtlasLayoutPdfMultiple() parameters.insert( QStringLiteral( "DPI" ), 96 ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &p ); QgsProcessingFeedback feedback; QVariantMap results; @@ -453,7 +453,7 @@ void TestQgsProcessingAlgsPt2::exportAtlasLayoutPng() parameters.insert( QStringLiteral( "DPI" ), 96 ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &p ); QgsProcessingFeedback feedback; QVariantMap results; @@ -503,7 +503,7 @@ void TestQgsProcessingAlgsPt2::tinMeshCreation() parameters.insert( QStringLiteral( "OUTPUT_MESH" ), QString( QDir::tempPath() + "/meshLayer.2dm" ) ); parameters.insert( QStringLiteral( "MESH_FORMAT" ), 0 ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); QgsProcessingFeedback feedback; QVariantMap results; @@ -545,7 +545,7 @@ void TestQgsProcessingAlgsPt2::exportMeshVertices() parameters.insert( QStringLiteral( "OUTPUT" ), QgsProcessing::TEMPORARY_OUTPUT ); parameters.insert( QStringLiteral( "VECTOR_OPTION" ), 2 ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); QgsProcessingFeedback feedback; QVariantMap results; @@ -627,7 +627,7 @@ void TestQgsProcessingAlgsPt2::exportMeshFaces() parameters.insert( QStringLiteral( "OUTPUT" ), QgsProcessing::TEMPORARY_OUTPUT ); parameters.insert( QStringLiteral( "VECTOR_OPTION" ), 2 ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); QgsProcessingFeedback feedback; QVariantMap results; @@ -688,7 +688,7 @@ void TestQgsProcessingAlgsPt2::exportMeshEdges() parameters.insert( QStringLiteral( "OUTPUT" ), QgsProcessing::TEMPORARY_OUTPUT ); parameters.insert( QStringLiteral( "VECTOR_OPTION" ), 2 ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); QgsProcessingFeedback feedback; QVariantMap results; @@ -763,7 +763,7 @@ void TestQgsProcessingAlgsPt2::exportMeshOnGrid() parameters.insert( QStringLiteral( "OUTPUT" ), QgsProcessing::TEMPORARY_OUTPUT ); parameters.insert( QStringLiteral( "VECTOR_OPTION" ), 2 ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); QgsProcessingFeedback feedback; QVariantMap results; @@ -823,7 +823,7 @@ void TestQgsProcessingAlgsPt2::rasterizeMesh() parameters.insert( QStringLiteral( "OUTPUT" ), QgsProcessing::TEMPORARY_OUTPUT ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); QgsProcessingFeedback feedback; QVariantMap results; @@ -831,7 +831,7 @@ void TestQgsProcessingAlgsPt2::rasterizeMesh() results = alg->run( parameters, *context, &feedback, &ok ); QVERIFY( ok ); - std::unique_ptr outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); + auto outputRaster = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "output", "gdal" ); QVERIFY( outputRaster ); QVERIFY( outputRaster->isValid() ); QgsRasterDataProvider *outputProvider = outputRaster->dataProvider(); @@ -846,7 +846,7 @@ void TestQgsProcessingAlgsPt2::rasterizeMesh() // load expected result const QString dataDir = QString( TEST_DATA_DIR ); //defined in CmakeLists.txt - std::unique_ptr expectedRaster = std::make_unique( dataDir + "/mesh/rasterized_mesh.tif", "expected", "gdal" ); + auto expectedRaster = std::make_unique( dataDir + "/mesh/rasterized_mesh.tif", "expected", "gdal" ); QVERIFY( expectedRaster ); QVERIFY( expectedRaster->isValid() ); QgsRasterDataProvider *expectedProvider = outputRaster->dataProvider(); @@ -890,7 +890,7 @@ void TestQgsProcessingAlgsPt2::exportMeshContours() parameters.insert( QStringLiteral( "OUTPUT_LINES" ), QgsProcessing::TEMPORARY_OUTPUT ); parameters.insert( QStringLiteral( "OUTPUT_POLYGONS" ), QgsProcessing::TEMPORARY_OUTPUT ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); QgsProcessingFeedback feedback; QVariantMap results; @@ -1049,7 +1049,7 @@ void TestQgsProcessingAlgsPt2::exportMeshCrossSection() QgsVectorLayer *layerLine = new QgsVectorLayer( QStringLiteral( "LineString" ), QStringLiteral( "lines_for_xs" ), QStringLiteral( "memory" ) ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); QgsProcessingFeedback feedback; QVariantMap results; @@ -1135,7 +1135,7 @@ void TestQgsProcessingAlgsPt2::fileDownloader() parameters.insert( QStringLiteral( "URL" ), QStringLiteral( "https://version.qgis.org/version.txt" ) ); parameters.insert( QStringLiteral( "OUTPUT" ), QgsProcessing::TEMPORARY_OUTPUT ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsProcessingFeedback feedback; QVariantMap results; bool ok = false; @@ -1175,7 +1175,7 @@ void TestQgsProcessingAlgsPt2::rasterize() QVERIFY( nodePolygons ); nodePolygons->setItemVisibilityChecked( false ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &project ); QgsProcessingFeedback feedback; QVariantMap results; @@ -1255,7 +1255,7 @@ void TestQgsProcessingAlgsPt2::convertGpsData() parameters.insert( QStringLiteral( "OUTPUT" ), QgsProcessing::TEMPORARY_OUTPUT ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); @@ -1319,7 +1319,7 @@ void TestQgsProcessingAlgsPt2::downloadGpsData() parameters.insert( QStringLiteral( "OUTPUT" ), QgsProcessing::TEMPORARY_OUTPUT ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); @@ -1353,7 +1353,7 @@ void TestQgsProcessingAlgsPt2::uploadGpsData() parameters.insert( QStringLiteral( "INPUT" ), QStringLiteral( "%1/layers.gpx" ).arg( TEST_DATA_DIR ) ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); @@ -1381,7 +1381,7 @@ void TestQgsProcessingAlgsPt2::transferMainAnnotationLayer() QgsProject p; p.mainAnnotationLayer()->addItem( new QgsAnnotationMarkerItem( QgsPoint( 1, 2 ) ) ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &p ); QgsProcessingFeedback feedback; QVariantMap results; @@ -1429,7 +1429,7 @@ void TestQgsProcessingAlgsPt2::exportMeshTimeSeries() QgsVectorLayer *layerPoints = new QgsVectorLayer( QStringLiteral( "Point" ), QStringLiteral( "points_for_ts" ), QStringLiteral( "memory" ) ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); QgsProcessingFeedback feedback; QVariantMap results; @@ -1554,7 +1554,7 @@ void TestQgsProcessingAlgsPt2::extractLabels() parameters.insert( QStringLiteral( "OUTPUT" ), QgsProcessing::TEMPORARY_OUTPUT ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &project ); QgsProcessingFeedback feedback; @@ -1601,7 +1601,7 @@ void TestQgsProcessingAlgsPt2::dxfExport() parameters.insert( QStringLiteral( "OUTPUT" ), QgsProcessing::TEMPORARY_OUTPUT ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( &project ); TestProcessingFeedback feedback; @@ -1609,7 +1609,7 @@ void TestQgsProcessingAlgsPt2::dxfExport() results = alg->run( parameters, *context, &feedback, &ok ); QVERIFY( ok ); - std::unique_ptr resultLayer = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "dxf" ); + auto resultLayer = std::make_unique( results.value( QStringLiteral( "OUTPUT" ) ).toString(), "dxf" ); QVERIFY( resultLayer->isValid() ); QCOMPARE( resultLayer->featureCount(), 1L ); QCOMPARE( resultLayer->wkbType(), Qgis::WkbType::LineString ); @@ -1617,7 +1617,7 @@ void TestQgsProcessingAlgsPt2::dxfExport() void TestQgsProcessingAlgsPt2::splitVectorLayer() { - std::unique_ptr layer = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=pk:int&field=col1:string" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); + auto layer = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=pk:int&field=col1:string" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( layer->isValid() ); QgsFeature f; @@ -1645,7 +1645,7 @@ void TestQgsProcessingAlgsPt2::splitVectorLayer() parameters.insert( QStringLiteral( "OUTPUT" ), outputDir.absolutePath() ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsProcessingFeedback feedback; QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); @@ -1659,7 +1659,7 @@ void TestQgsProcessingAlgsPt2::splitVectorLayer() void TestQgsProcessingAlgsPt2::buffer() { - std::unique_ptr layer = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=pk:int&field=col1:string" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); + auto layer = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=pk:int&field=col1:string" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( layer->isValid() ); std::unique_ptr alg( QgsApplication::processingRegistry()->createAlgorithmById( QStringLiteral( "native:buffer" ) ) ); @@ -1677,7 +1677,7 @@ void TestQgsProcessingAlgsPt2::buffer() parameters.insert( QStringLiteral( "OUTPUT" ), QStringLiteral( "memory:" ) ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsProcessingFeedback feedback; QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); @@ -1706,25 +1706,25 @@ void TestQgsProcessingAlgsPt2::buffer() void TestQgsProcessingAlgsPt2::splitWithLines() { QgsFeature l1_1, l1_2, l2_1, l2_2, p1_1, p1_2, p2_1, p2_2; - std::unique_ptr lineLayer1 = std::make_unique( QStringLiteral( "MultiLineString?crs=epsg:4326" ), QStringLiteral( "l1" ), QStringLiteral( "memory" ) ); + auto lineLayer1 = std::make_unique( QStringLiteral( "MultiLineString?crs=epsg:4326" ), QStringLiteral( "l1" ), QStringLiteral( "memory" ) ); QVERIFY( lineLayer1->isValid() ); l1_1.setGeometry( QgsGeometry::fromWkt( "MultiLineString ((19 40, 26 40),(20 39, 25 39))" ) ); l1_2.setGeometry( QgsGeometry::fromWkt( "MultiLineString ((19 35, 26 35))" ) ); lineLayer1->dataProvider()->addFeature( l1_1 ); lineLayer1->dataProvider()->addFeature( l1_2 ); - std::unique_ptr lineLayer2 = std::make_unique( QStringLiteral( "MultiLineString?crs=epsg:4326" ), QStringLiteral( "l2" ), QStringLiteral( "memory" ) ); + auto lineLayer2 = std::make_unique( QStringLiteral( "MultiLineString?crs=epsg:4326" ), QStringLiteral( "l2" ), QStringLiteral( "memory" ) ); QVERIFY( lineLayer2->isValid() ); l2_1.setGeometry( QgsGeometry::fromWkt( "MultiLineString ((20 42, 20 34, 23 42))" ) ); l2_2.setGeometry( QgsGeometry::fromWkt( "MultiLineString ((21 42, 21 34),(23 42, 23 34, 25 42))" ) ); lineLayer2->dataProvider()->addFeature( l2_1 ); lineLayer2->dataProvider()->addFeature( l2_2 ); - std::unique_ptr polygonLayer1 = std::make_unique( QStringLiteral( "MultiPolygon?crs=epsg:4326" ), QStringLiteral( "p1" ), QStringLiteral( "memory" ) ); + auto polygonLayer1 = std::make_unique( QStringLiteral( "MultiPolygon?crs=epsg:4326" ), QStringLiteral( "p1" ), QStringLiteral( "memory" ) ); QVERIFY( polygonLayer1->isValid() ); p1_1.setGeometry( QgsGeometry::fromWkt( "MultiPolygon (((25 41, 25 38, 18 38, 18 41, 25 41),(19 39, 24 39, 24 40, 19 40, 19 39)))" ) ); p1_2.setGeometry( QgsGeometry::fromWkt( "MultiPolygon (((18 37, 21 37, 21 35, 18 35, 18 37),(19.5 36.5, 19.5 35.5, 20.5 35.5, 20.5 36.5, 19.5 36.5)),((22 37, 25 37, 25 35, 22 35, 22 37),(24 36, 24 35.5, 24.5 35.5, 24.5 36, 24 36),(23.5 35.5, 23.5 36.5, 22.5 36.5, 22.5 35.5, 23.5 35.5)))" ) ); polygonLayer1->dataProvider()->addFeature( p1_1 ); polygonLayer1->dataProvider()->addFeature( p1_2 ); - std::unique_ptr polygonLayer2 = std::make_unique( QStringLiteral( "MultiPolygon?crs=epsg:4326" ), QStringLiteral( "p2" ), QStringLiteral( "memory" ) ); + auto polygonLayer2 = std::make_unique( QStringLiteral( "MultiPolygon?crs=epsg:4326" ), QStringLiteral( "p2" ), QStringLiteral( "memory" ) ); QVERIFY( polygonLayer2->isValid() ); p2_1.setGeometry( QgsGeometry::fromWkt( "MultiPolygon (((23 42, 20 34, 20 42, 23 42),(20.5 38.5, 21 38.5, 21.5 40.5, 20.5 40.5, 20.5 38.5)))" ) ); p2_2.setGeometry( QgsGeometry::fromWkt( "MultiPolygon (((23 34, 23 42, 25 42, 23 34),(24 40.5, 23.5 40.5, 23.5 39.5, 24 40.5)),((19.5 34.5, 17.5 34.5, 17.5 42, 18.5 42, 19.5 34.5),(18.5 37.5, 18 37.5, 18.5 36.5, 18.5 37.5)))" ) ); @@ -1741,7 +1741,7 @@ void TestQgsProcessingAlgsPt2::splitWithLines() parameters.insert( QStringLiteral( "OUTPUT" ), QStringLiteral( "memory:" ) ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsProcessingFeedback feedback; QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); @@ -1831,7 +1831,7 @@ void TestQgsProcessingAlgsPt2::randomPointsInPolygonsFromField() QVERIFY( alg != nullptr ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsProcessingFeedback feedback; QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); @@ -1845,7 +1845,7 @@ void TestQgsProcessingAlgsPt2::randomPointsInPolygonsFromField() void TestQgsProcessingAlgsPt2::generateElevationProfileImage() { - std::unique_ptr lineLayer = std::make_unique( QStringLiteral( "LineStringZ?crs=epsg:3857" ), QStringLiteral( "lines" ), QStringLiteral( "memory" ) ); + auto lineLayer = std::make_unique( QStringLiteral( "LineStringZ?crs=epsg:3857" ), QStringLiteral( "lines" ), QStringLiteral( "memory" ) ); QVERIFY( lineLayer->isValid() ); QgsFeature feature; feature.setGeometry( QgsGeometry::fromWkt( "LineStringZ (0 0 0, 10 10 10)" ) ); @@ -1874,7 +1874,7 @@ void TestQgsProcessingAlgsPt2::generateElevationProfileImage() parameters.insert( QStringLiteral( "OUTPUT" ), outputImage ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsProcessingFeedback feedback; QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); @@ -1885,10 +1885,10 @@ void TestQgsProcessingAlgsPt2::generateElevationProfileImage() void TestQgsProcessingAlgsPt2::copyMetadata() { - std::unique_ptr sourceLayer = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=pk:int&field=col1:string" ), QStringLiteral( "input" ), QStringLiteral( "memory" ) ); + auto sourceLayer = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=pk:int&field=col1:string" ), QStringLiteral( "input" ), QStringLiteral( "memory" ) ); QVERIFY( sourceLayer->isValid() ); - std::unique_ptr targetLayer = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=pk:int&field=col1:string" ), QStringLiteral( "target" ), QStringLiteral( "memory" ) ); + auto targetLayer = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=pk:int&field=col1:string" ), QStringLiteral( "target" ), QStringLiteral( "memory" ) ); QVERIFY( targetLayer->isValid() ); QgsLayerMetadata md; @@ -1904,7 +1904,7 @@ void TestQgsProcessingAlgsPt2::copyMetadata() parameters.insert( QStringLiteral( "TARGET" ), QVariant::fromValue( targetLayer.get() ) ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsProcessingFeedback feedback; QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); @@ -1919,7 +1919,7 @@ void TestQgsProcessingAlgsPt2::copyMetadata() void TestQgsProcessingAlgsPt2::applyMetadata() { - std::unique_ptr layer = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=pk:int&field=col1:string" ), QStringLiteral( "input" ), QStringLiteral( "memory" ) ); + auto layer = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=pk:int&field=col1:string" ), QStringLiteral( "input" ), QStringLiteral( "memory" ) ); QVERIFY( layer->isValid() ); std::unique_ptr alg( QgsApplication::processingRegistry()->createAlgorithmById( QStringLiteral( "native:setlayermetadata" ) ) ); @@ -1933,7 +1933,7 @@ void TestQgsProcessingAlgsPt2::applyMetadata() parameters.insert( QStringLiteral( "METADATA" ), metadataFileName ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsProcessingFeedback feedback; QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); @@ -1948,7 +1948,7 @@ void TestQgsProcessingAlgsPt2::applyMetadata() void TestQgsProcessingAlgsPt2::exportMetadata() { - std::unique_ptr layer = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=pk:int&field=col1:string" ), QStringLiteral( "input" ), QStringLiteral( "memory" ) ); + auto layer = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=pk:int&field=col1:string" ), QStringLiteral( "input" ), QStringLiteral( "memory" ) ); QVERIFY( layer->isValid() ); QgsLayerMetadata md; @@ -1964,7 +1964,7 @@ void TestQgsProcessingAlgsPt2::exportMetadata() parameters.insert( QStringLiteral( "OUTPUT" ), QgsProcessing::TEMPORARY_OUTPUT ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsProcessingFeedback feedback; QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); @@ -1993,7 +1993,7 @@ void TestQgsProcessingAlgsPt2::exportMetadata() void TestQgsProcessingAlgsPt2::addHistoryMetadata() { - std::unique_ptr layer = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=pk:int&field=col1:string" ), QStringLiteral( "input" ), QStringLiteral( "memory" ) ); + auto layer = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=pk:int&field=col1:string" ), QStringLiteral( "input" ), QStringLiteral( "memory" ) ); QVERIFY( layer->isValid() ); QgsLayerMetadata md; @@ -2009,7 +2009,7 @@ void TestQgsProcessingAlgsPt2::addHistoryMetadata() parameters.insert( QStringLiteral( "HISTORY" ), QStringLiteral( "do something" ) ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsProcessingFeedback feedback; QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); @@ -2037,10 +2037,10 @@ void TestQgsProcessingAlgsPt2::addHistoryMetadata() void TestQgsProcessingAlgsPt2::updateMetadata() { - std::unique_ptr sourceLayer = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=pk:int&field=col1:string" ), QStringLiteral( "input" ), QStringLiteral( "memory" ) ); + auto sourceLayer = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=pk:int&field=col1:string" ), QStringLiteral( "input" ), QStringLiteral( "memory" ) ); QVERIFY( sourceLayer->isValid() ); - std::unique_ptr targetLayer = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=pk:int&field=col1:string" ), QStringLiteral( "target" ), QStringLiteral( "memory" ) ); + auto targetLayer = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=pk:int&field=col1:string" ), QStringLiteral( "target" ), QStringLiteral( "memory" ) ); QVERIFY( targetLayer->isValid() ); QgsLayerMetadata mdInput; @@ -2063,7 +2063,7 @@ void TestQgsProcessingAlgsPt2::updateMetadata() parameters.insert( QStringLiteral( "TARGET" ), QVariant::fromValue( targetLayer.get() ) ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsProcessingFeedback feedback; QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); @@ -2080,7 +2080,7 @@ void TestQgsProcessingAlgsPt2::updateMetadata() void TestQgsProcessingAlgsPt2::setMetadataFields() { - std::unique_ptr layer = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=pk:int&field=col1:string" ), QStringLiteral( "input" ), QStringLiteral( "memory" ) ); + auto layer = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=pk:int&field=col1:string" ), QStringLiteral( "input" ), QStringLiteral( "memory" ) ); QVERIFY( layer->isValid() ); std::unique_ptr alg( QgsApplication::processingRegistry()->createAlgorithmById( QStringLiteral( "native:setmetadatafields" ) ) ); @@ -2091,7 +2091,7 @@ void TestQgsProcessingAlgsPt2::setMetadataFields() parameters.insert( QStringLiteral( "TITLE" ), QStringLiteral( "Title" ) ); bool ok = false; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QgsProcessingFeedback feedback; QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); diff --git a/tests/src/analysis/testqgsprocessingfixgeometry.cpp b/tests/src/analysis/testqgsprocessingfixgeometry.cpp index 08df893cc12f..934136af4ffe 100644 --- a/tests/src/analysis/testqgsprocessingfixgeometry.cpp +++ b/tests/src/analysis/testqgsprocessingfixgeometry.cpp @@ -140,7 +140,7 @@ void TestQgsProcessingFixGeometry::fixAngleAlg() bool ok = false; QgsProcessingFeedback feedback; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); @@ -248,7 +248,7 @@ void TestQgsProcessingFixGeometry::fixAreaAlg() bool ok = false; QgsProcessingFeedback feedback; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); @@ -293,7 +293,7 @@ void TestQgsProcessingFixGeometry::fixHoleAlg() bool ok = false; QgsProcessingFeedback feedback; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); @@ -343,7 +343,7 @@ void TestQgsProcessingFixGeometry::fixMissingVertexAlg() bool ok = false; QgsProcessingFeedback feedback; - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); diff --git a/tests/src/analysis/testqgsprocessingmodelalgorithm.cpp b/tests/src/analysis/testqgsprocessingmodelalgorithm.cpp index 133ef2c70c2f..cacb5f58d5b1 100644 --- a/tests/src/analysis/testqgsprocessingmodelalgorithm.cpp +++ b/tests/src/analysis/testqgsprocessingmodelalgorithm.cpp @@ -2458,7 +2458,7 @@ void TestQgsProcessingModelAlgorithm::modelExecuteWithPreviousState() context.modelResult().clear(); // start with an initial state - std::unique_ptr modelConfig = std::make_unique(); + auto modelConfig = std::make_unique(); modelConfig->setPreviouslyExecutedChildAlgorithms( { QStringLiteral( "calculate" ) } ); modelConfig->setInitialChildInputs( QVariantMap { { QStringLiteral( "calculate" ), QVariantMap { { QStringLiteral( "INPUT" ), QStringLiteral( "a different string" ) } } } } ); modelConfig->setInitialChildOutputs( QVariantMap { { QStringLiteral( "calculate" ), QVariantMap { { QStringLiteral( "OUTPUT" ), QStringLiteral( "a different string" ) } } } } ); @@ -2502,7 +2502,7 @@ void TestQgsProcessingModelAlgorithm::modelExecuteWithPreviousState() // test handling of temporary layers generated during earlier runs modelConfig = std::make_unique(); - std::unique_ptr previousStore = std::make_unique(); + auto previousStore = std::make_unique(); QgsVectorLayer *layer = new QgsVectorLayer( "Point?crs=epsg:3111", "v1", "memory" ); previousStore->addMapLayer( layer ); previousStore->moveToThread( nullptr ); diff --git a/tests/src/analysis/testqgsprocessingpdalalgs.cpp b/tests/src/analysis/testqgsprocessingpdalalgs.cpp index ddbdb4567da6..a6565c9ba5a3 100644 --- a/tests/src/analysis/testqgsprocessingpdalalgs.cpp +++ b/tests/src/analysis/testqgsprocessingpdalalgs.cpp @@ -114,7 +114,7 @@ void TestQgsProcessingPdalAlgs::info() { QgsPdalAlgorithmBase *alg = const_cast( static_cast( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "pdal:info" ) ) ) ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); QgsProcessingFeedback feedback; @@ -133,7 +133,7 @@ void TestQgsProcessingPdalAlgs::convertFormat() { QgsPdalAlgorithmBase *alg = const_cast( static_cast( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "pdal:convertformat" ) ) ) ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); context->setMaximumThreads( 0 ); @@ -158,7 +158,7 @@ void TestQgsProcessingPdalAlgs::reproject() { QgsPdalAlgorithmBase *alg = const_cast( static_cast( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "pdal:reproject" ) ) ) ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); context->setMaximumThreads( 0 ); @@ -184,7 +184,7 @@ void TestQgsProcessingPdalAlgs::assignProjection() { QgsPdalAlgorithmBase *alg = const_cast( static_cast( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "pdal:assignprojection" ) ) ) ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); context->setMaximumThreads( 0 ); @@ -210,7 +210,7 @@ void TestQgsProcessingPdalAlgs::thinByDecimate() { QgsPdalAlgorithmBase *alg = const_cast( static_cast( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "pdal:thinbydecimate" ) ) ) ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); context->setMaximumThreads( 0 ); @@ -250,7 +250,7 @@ void TestQgsProcessingPdalAlgs::thinByRadius() { QgsPdalAlgorithmBase *alg = const_cast( static_cast( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "pdal:thinbyradius" ) ) ) ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); context->setMaximumThreads( 0 ); @@ -290,7 +290,7 @@ void TestQgsProcessingPdalAlgs::boundary() { QgsPdalAlgorithmBase *alg = const_cast( static_cast( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "pdal:boundary" ) ) ) ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); context->setMaximumThreads( 0 ); @@ -334,7 +334,7 @@ void TestQgsProcessingPdalAlgs::density() { QgsPdalAlgorithmBase *alg = const_cast( static_cast( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "pdal:density" ) ) ) ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); context->setMaximumThreads( 0 ); @@ -395,7 +395,7 @@ void TestQgsProcessingPdalAlgs::exportRasterTin() { QgsPdalAlgorithmBase *alg = const_cast( static_cast( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "pdal:exportrastertin" ) ) ) ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); context->setMaximumThreads( 0 ); @@ -456,7 +456,7 @@ void TestQgsProcessingPdalAlgs::tile() { QgsPdalAlgorithmBase *alg = const_cast( static_cast( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "pdal:tile" ) ) ) ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); context->setMaximumThreads( 0 ); @@ -504,7 +504,7 @@ void TestQgsProcessingPdalAlgs::exportRaster() { QgsPdalAlgorithmBase *alg = const_cast( static_cast( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "pdal:exportraster" ) ) ) ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); context->setMaximumThreads( 0 ); @@ -570,7 +570,7 @@ void TestQgsProcessingPdalAlgs::exportVector() { QgsPdalAlgorithmBase *alg = const_cast( static_cast( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "pdal:exportvector" ) ) ) ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); context->setMaximumThreads( 0 ); @@ -611,7 +611,7 @@ void TestQgsProcessingPdalAlgs::merge() { QgsPdalAlgorithmBase *alg = const_cast( static_cast( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "pdal:merge" ) ) ) ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); context->setMaximumThreads( 0 ); @@ -651,7 +651,7 @@ void TestQgsProcessingPdalAlgs::buildVpc() { QgsPdalAlgorithmBase *alg = const_cast( static_cast( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "pdal:virtualpointcloud" ) ) ) ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); context->setMaximumThreads( 0 ); @@ -697,7 +697,7 @@ void TestQgsProcessingPdalAlgs::clip() { QgsPdalAlgorithmBase *alg = const_cast( static_cast( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "pdal:clip" ) ) ) ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); context->setMaximumThreads( 0 ); @@ -734,7 +734,7 @@ void TestQgsProcessingPdalAlgs::filter() { QgsPdalAlgorithmBase *alg = const_cast( static_cast( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "pdal:filter" ) ) ) ); - std::unique_ptr context = std::make_unique(); + auto context = std::make_unique(); context->setProject( QgsProject::instance() ); context->setMaximumThreads( 0 ); diff --git a/tests/src/analysis/testqgsrastercalculator.cpp b/tests/src/analysis/testqgsrastercalculator.cpp index 6cfc959da153..e6961e5f57ae 100644 --- a/tests/src/analysis/testqgsrastercalculator.cpp +++ b/tests/src/analysis/testqgsrastercalculator.cpp @@ -25,6 +25,7 @@ Email : nyall dot dawson at gmail dot com #include "qgsrastermatrix.h" #include "qgsapplication.h" #include "qgsproject.h" +#include "qgsgdalutils.h" #include @@ -61,12 +62,15 @@ class TestQgsRasterCalculator : public QgsTest void calcWithLayers(); void calcWithReprojectedLayers(); + void calcWithDataType(); + void calcWithDataType_data(); void errors(); void toString(); void findNodes(); void testRasterEntries(); + void testOutputCrsFromRasterEntries(); void calcFormulasWithReprojectedLayers(); void testStatistics(); @@ -536,6 +540,148 @@ void TestQgsRasterCalculator::calcWithReprojectedLayers() delete block; } + +void TestQgsRasterCalculator::calcWithDataType_data() +{ + QTest::addColumn( "dataType" ); + QTest::addColumn( "useOpenCL" ); + + QTest::newRow( "UInt16 without OpenCL" ) << static_cast( GDT_UInt16 ) << false; + QTest::newRow( "Byte without OpenCL" ) << static_cast( GDT_Byte ) << false; +#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION( 3, 7, 0 ) + QTest::newRow( "Int8 without OpenCL" ) << static_cast( GDT_Int8 ) << false; +#endif + QTest::newRow( "Int16 without OpenCL" ) << static_cast( GDT_Int16 ) << false; + QTest::newRow( "Int32 without OpenCL" ) << static_cast( GDT_Int32 ) << false; + QTest::newRow( "UInt32 without OpenCL" ) << static_cast( GDT_UInt32 ) << false; + QTest::newRow( "Float32 without OpenCL" ) << static_cast( GDT_Float32 ) << false; + QTest::newRow( "Float64 without OpenCL" ) << static_cast( GDT_Float64 ) << false; + +#ifdef HAVE_OPENCL + QTest::newRow( "UInt16 with OpenCL" ) << static_cast( GDT_UInt16 ) << true; + QTest::newRow( "Byte with OpenCL" ) << static_cast( GDT_Byte ) << true; +#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION( 3, 7, 0 ) + QTest::newRow( "Int8 with OpenCL" ) << static_cast( GDT_Int8 ) << true; +#endif + QTest::newRow( "Int16 with OpenCL" ) << static_cast( GDT_Int16 ) << true; + QTest::newRow( "Int32 with OpenCL" ) << static_cast( GDT_Int32 ) << true; + QTest::newRow( "UInt32 with OpenCL" ) << static_cast( GDT_UInt32 ) << true; + QTest::newRow( "Float32 with OpenCL" ) << static_cast( GDT_Float32 ) << true; + QTest::newRow( "Float64 with OpenCL" ) << static_cast( GDT_Float64 ) << true; +#endif +} +void TestQgsRasterCalculator::calcWithDataType() +{ + QFETCH( int, dataType ); + +#ifdef HAVE_OPENCL + QFETCH( bool, useOpenCL ); + if ( QgsOpenClUtils::available() && useOpenCL ) + QgsOpenClUtils::setEnabled( useOpenCL ); + else + QgsOpenClUtils::setEnabled( false ); + +#endif + + QTemporaryDir tempDir; + const QString dirPath = tempDir.path(); + const QString tempInputFilePath = dirPath + "/temp_input.tif"; + const QString tempResultFilePath = dirPath + "/result.tif"; + + QgsRectangle extent = QgsRectangle::fromCenterAndSize( { 0, 0 }, 2, 2 ); + + QgsCoordinateReferenceSystem crs( QStringLiteral( "EPSG:32633" ) ); + + const GDALDataType gdalDataType { static_cast( dataType ) }; + + { + const gdal::dataset_unique_ptr hSrcDS( QgsGdalUtils::createSingleBandTiffDataset( tempInputFilePath, gdalDataType, extent, 2, 2, crs ) ); + // Get first band + auto hBand = GDALGetRasterBand( hSrcDS.get(), 1 ); + switch ( gdalDataType ) + { + case GDT_Byte: + { + unsigned char data[4] = { 1, 2, 3, 4 }; + QCOMPARE( GDALRasterIO( hBand, GF_Write, 0, 0, 2, 2, data, 2, 2, gdalDataType, 0, 0 ), CE_None ); + break; + } +#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION( 3, 7, 0 ) + case GDT_Int8: + { + char data8[4] = { 1, 2, 3, 4 }; + QCOMPARE( GDALRasterIO( hBand, GF_Write, 0, 0, 2, 2, data8, 2, 2, gdalDataType, 0, 0 ), CE_None ); + break; + } +#endif + case GDT_UInt16: + { + unsigned short data16[4] = { 1, 2, 3, 4 }; + QCOMPARE( GDALRasterIO( hBand, GF_Write, 0, 0, 2, 2, data16, 2, 2, gdalDataType, 0, 0 ), CE_None ); + break; + } + case GDT_Int16: + { + short data16s[4] = { 1, 2, 3, 4 }; + QCOMPARE( GDALRasterIO( hBand, GF_Write, 0, 0, 2, 2, data16s, 2, 2, gdalDataType, 0, 0 ), CE_None ); + break; + } + case GDT_Int32: + { + int data32[4] = { 1, 2, 3, 4 }; + QCOMPARE( GDALRasterIO( hBand, GF_Write, 0, 0, 2, 2, data32, 2, 2, gdalDataType, 0, 0 ), CE_None ); + break; + } + case GDT_UInt32: + { + unsigned int data32u[4] = { 1, 2, 3, 4 }; + QCOMPARE( GDALRasterIO( hBand, GF_Write, 0, 0, 2, 2, data32u, 2, 2, gdalDataType, 0, 0 ), CE_None ); + break; + } + case GDT_Float32: + { + float data32f[4] = { 1, 2, 3, 4 }; + QCOMPARE( GDALRasterIO( hBand, GF_Write, 0, 0, 2, 2, data32f, 2, 2, gdalDataType, 0, 0 ), CE_None ); + break; + } + case GDT_Float64: + { + double data64[4] = { 1, 2, 3, 4 }; + QCOMPARE( GDALRasterIO( hBand, GF_Write, 0, 0, 2, 2, data64, 2, 2, gdalDataType, 0, 0 ), CE_None ); + break; + } + default: + QVERIFY( false ); + break; + } + GDALFlushCache( hSrcDS.get() ); + } + + // Load 16 bit usigned raster + auto demRasterLayer = std::make_unique( tempInputFilePath, QStringLiteral( "dem" ) ); + + QgsRasterCalculatorEntry entry1; + entry1.bandNumber = 1; + entry1.raster = demRasterLayer.get(); + entry1.ref = QStringLiteral( "dem@1" ); + QVector entries; + entries << entry1; + + QgsRasterCalculator rc( QStringLiteral( "\"dem@1\" * 2" ), tempResultFilePath, QStringLiteral( "GTiff" ), extent, crs, 2, 2, entries, QgsProject::instance()->transformContext() ); + QCOMPARE( static_cast( rc.processCalculation() ), 0 ); + + auto result = std::make_unique( tempResultFilePath, QStringLiteral( "result" ) ); + QCOMPARE( result->width(), 2 ); + QCOMPARE( result->height(), 2 ); + std::unique_ptr block; + block.reset( result->dataProvider()->block( 1, extent, 2, 2 ) ); + QCOMPARE( block->value( 0, 0 ), 2 ); + QCOMPARE( block->value( 0, 1 ), 4 ); + QCOMPARE( block->value( 1, 0 ), 6 ); + QCOMPARE( block->value( 1, 1 ), 8 ); +} + + void TestQgsRasterCalculator::findNodes() { std::unique_ptr calcNode; @@ -717,6 +863,30 @@ void TestQgsRasterCalculator::toString() QVERIFY( calcNode == nullptr ); } +void TestQgsRasterCalculator::testOutputCrsFromRasterEntries() +{ + QgsRasterCalculatorEntry entry1; + entry1.bandNumber = 1; + entry1.raster = mpLandsatRasterLayer; + entry1.ref = QStringLiteral( "landsat@0" ); + + QVector entries; + entries << entry1; + + QgsRectangle extent( 783235, 3348110, 783350, 3347960 ); + + QTemporaryFile tmpFile; + tmpFile.open(); // fileName is not available until open + QString tmpName = tmpFile.fileName(); + tmpFile.close(); + + QgsRasterCalculator rc( QStringLiteral( "\"landsat@0\"" ), tmpName, QStringLiteral( "GTiff" ), extent, 2, 3, entries, QgsProject::instance()->transformContext() ); + QCOMPARE( static_cast( rc.processCalculation() ), 0 ); + //open output file and check results + QgsRasterLayer *result = new QgsRasterLayer( tmpName, QStringLiteral( "result" ) ); + QCOMPARE( result->crs(), mpLandsatRasterLayer->crs() ); +} + void TestQgsRasterCalculator::calcFormulasWithReprojectedLayers() { QgsRasterCalculatorEntry entry1; @@ -881,7 +1051,7 @@ void TestQgsRasterCalculator::testFunctionTypeWithLayer() QCOMPARE( static_cast( rc.processCalculation() ), 0 ); //open output file and check results - std::unique_ptr result = std::make_unique( tmpName, QStringLiteral( "result" ) ); + auto result = std::make_unique( tmpName, QStringLiteral( "result" ) ); QCOMPARE( result->width(), 2 ); QCOMPARE( result->height(), 3 ); std::unique_ptr block( result->dataProvider()->block( 1, extent, 2, 3 ) ); diff --git a/tests/src/analysis/testqgsreclassifyutils.cpp b/tests/src/analysis/testqgsreclassifyutils.cpp index 5967bc0286f2..c4d127a7627d 100644 --- a/tests/src/analysis/testqgsreclassifyutils.cpp +++ b/tests/src/analysis/testqgsreclassifyutils.cpp @@ -199,7 +199,7 @@ void TestQgsReclassifyUtils::testReclassify() // create a GeoTIFF - this will create data provider in editable mode QString filename = dirPath + QStringLiteral( "/test.tif" ); - std::unique_ptr writer = std::make_unique( filename ); + auto writer = std::make_unique( filename ); writer->setOutputProviderKey( QStringLiteral( "gdal" ) ); writer->setOutputFormat( QStringLiteral( "GTiff" ) ); std::unique_ptr dp( writer->createOneBandRaster( Qgis::DataType::Float32, nCols, nRows, extent, crs ) ); diff --git a/tests/src/analysis/testqgstriangulation.cpp b/tests/src/analysis/testqgstriangulation.cpp index 24b712f02e52..8d28a6f179c0 100644 --- a/tests/src/analysis/testqgstriangulation.cpp +++ b/tests/src/analysis/testqgstriangulation.cpp @@ -188,7 +188,7 @@ void TestQgsTriangulation::meshTriangulation() meshTri.setCrs( QgsCoordinateReferenceSystem( "EPSG:32620" ) ); - std::unique_ptr mLayerPointZ = std::make_unique( QStringLiteral( "PointZ?crs=EPSG:32620" ), QStringLiteral( "point Z" ), QStringLiteral( "memory" ) ); + auto mLayerPointZ = std::make_unique( QStringLiteral( "PointZ?crs=EPSG:32620" ), QStringLiteral( "point Z" ), QStringLiteral( "memory" ) ); const QString wkt1 = "PointZ (684486.0 1761297.0 1)"; const QString wkt2 = "PointZ (684276.0 1761309.0 2)"; @@ -228,7 +228,7 @@ void TestQgsTriangulation::meshTriangulation() const QString wkt5 = "LineStringZ (684098.0 1761401.0 3,684210.24 1761347.92 7,684343.8 1761373.4 8,684486.0 1761297.0 1)"; - std::unique_ptr mLayerBreakLine = std::make_unique( QStringLiteral( "LineStringZ?crs=EPSG:32620" ), QStringLiteral( "line" ), QStringLiteral( "memory" ) ); + auto mLayerBreakLine = std::make_unique( QStringLiteral( "LineStringZ?crs=EPSG:32620" ), QStringLiteral( "line" ), QStringLiteral( "memory" ) ); QgsFeature f5; f5.setGeometry( QgsGeometry::fromWkt( wkt5 ) ); @@ -255,7 +255,7 @@ void TestQgsTriangulation::meshTriangulationWithOnlyBreakLine() { QgsMeshTriangulation meshTri; - std::unique_ptr mLayerLineZ = std::make_unique( QStringLiteral( "LineStringZ" ), QStringLiteral( "break line Z" ), QStringLiteral( "memory" ) ); + auto mLayerLineZ = std::make_unique( QStringLiteral( "LineStringZ" ), QStringLiteral( "break line Z" ), QStringLiteral( "memory" ) ); QStringList wktLines; @@ -303,7 +303,7 @@ void TestQgsTriangulation::meshTriangulationPointAndBreakLineBreakLine() { QgsMeshTriangulation meshTri; - std::unique_ptr mLayerPointsZ = std::make_unique( QStringLiteral( "PointZ" ), QStringLiteral( "points Z" ), QStringLiteral( "memory" ) ); + auto mLayerPointsZ = std::make_unique( QStringLiteral( "PointZ" ), QStringLiteral( "points Z" ), QStringLiteral( "memory" ) ); for ( int i = 0; i < 4; ++i ) { @@ -326,7 +326,7 @@ void TestQgsTriangulation::meshTriangulationPointAndBreakLineBreakLine() QCOMPARE( mesh.vertexCount(), 40 ); QCOMPARE( mesh.faceCount(), 54 ); - std::unique_ptr mLayerLineZ = std::make_unique( QStringLiteral( "LineStringZ" ), QStringLiteral( "break line Z" ), QStringLiteral( "memory" ) ); + auto mLayerLineZ = std::make_unique( QStringLiteral( "LineStringZ" ), QStringLiteral( "break line Z" ), QStringLiteral( "memory" ) ); QgsFeature feat; diff --git a/tests/src/analysis/testqgszonalstatistics.cpp b/tests/src/analysis/testqgszonalstatistics.cpp index d372f9b47546..15b0ad05e2ec 100644 --- a/tests/src/analysis/testqgszonalstatistics.cpp +++ b/tests/src/analysis/testqgszonalstatistics.cpp @@ -201,7 +201,7 @@ void TestQgsZonalStatistics::testReprojection() const QString myTestDataPath = myDataPath + "/zonalstatistics/"; // create a reprojected version of the layer - std::unique_ptr vectorLayer( new QgsVectorLayer( myTestDataPath + "polys.shp", QStringLiteral( "poly" ), QStringLiteral( "ogr" ) ) ); + auto vectorLayer = std::make_unique( myTestDataPath + "polys.shp", QStringLiteral( "poly" ), QStringLiteral( "ogr" ) ); std::unique_ptr reprojected( vectorLayer->materialize( QgsFeatureRequest().setDestinationCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:3785" ) ), QgsProject::instance()->transformContext() ) ) ); QCOMPARE( reprojected->featureCount(), vectorLayer->featureCount() ); @@ -263,8 +263,8 @@ void TestQgsZonalStatistics::testNoData() const QString myTestDataPath = myDataPath + "/zonalstatistics/"; // test that zonal stats respects no data and user set no data values - std::unique_ptr rasterLayer = std::make_unique( myTestDataPath + "raster.tif", QStringLiteral( "raster" ), QStringLiteral( "gdal" ) ); - std::unique_ptr vectorLayer = std::make_unique( mTempPath + "polys2.shp", QStringLiteral( "poly" ), QStringLiteral( "ogr" ) ); + auto rasterLayer = std::make_unique( myTestDataPath + "raster.tif", QStringLiteral( "raster" ), QStringLiteral( "gdal" ) ); + auto vectorLayer = std::make_unique( mTempPath + "polys2.shp", QStringLiteral( "poly" ), QStringLiteral( "ogr" ) ); QgsZonalStatistics zs( vectorLayer.get(), rasterLayer.get(), QStringLiteral( "n" ), 1, Qgis::ZonalStatistic::All ); zs.calculateStatistics( nullptr ); @@ -317,7 +317,7 @@ void TestQgsZonalStatistics::testSmallPolygons() // test that zonal stats works ok with polygons much smaller than pixel size const std::unique_ptr rasterLayer = std::make_unique( myTestDataPath + "raster.tif", QStringLiteral( "raster" ), QStringLiteral( "gdal" ) ); - std::unique_ptr vectorLayer = std::make_unique( mTempPath + "small_polys.shp", QStringLiteral( "poly" ), QStringLiteral( "ogr" ) ); + auto vectorLayer = std::make_unique( mTempPath + "small_polys.shp", QStringLiteral( "poly" ), QStringLiteral( "ogr" ) ); QgsZonalStatistics zs( vectorLayer.get(), rasterLayer.get(), QStringLiteral( "n" ), 1, Qgis::ZonalStatistic::All ); zs.calculateStatistics( nullptr ); diff --git a/tests/src/app/CMakeLists.txt b/tests/src/app/CMakeLists.txt index 8c20fdddc9ed..43eb43b5c544 100644 --- a/tests/src/app/CMakeLists.txt +++ b/tests/src/app/CMakeLists.txt @@ -3,6 +3,7 @@ # the UI file won't be wrapped! include_directories( ${CMAKE_SOURCE_DIR}/src/test + ${CMAKE_SOURCE_DIR}/tests/src/gui ${CMAKE_CURRENT_BINARY_DIR} ) diff --git a/tests/src/app/maptooladdfeatureline/CMakeLists.txt b/tests/src/app/maptooladdfeatureline/CMakeLists.txt index 219b408610d2..9f87a4575521 100644 --- a/tests/src/app/maptooladdfeatureline/CMakeLists.txt +++ b/tests/src/app/maptooladdfeatureline/CMakeLists.txt @@ -18,6 +18,7 @@ set(TESTS testqgsmaptooladdfeaturelinez.cpp testqgsmaptooladdfeaturelinem.cpp testqgsmaptooladdfeaturelinezm.cpp + testqgsmaptooladdfeaturelinezm_crs.cpp ) foreach(TESTSRC ${TESTS}) diff --git a/tests/src/app/maptooladdfeatureline/testqgsmaptooladdfeaturelinezm_crs.cpp b/tests/src/app/maptooladdfeatureline/testqgsmaptooladdfeaturelinezm_crs.cpp new file mode 100644 index 000000000000..d3e7bc1f6ffd --- /dev/null +++ b/tests/src/app/maptooladdfeatureline/testqgsmaptooladdfeaturelinezm_crs.cpp @@ -0,0 +1,170 @@ +/*************************************************************************** + testqgsmaptooladdfeaturelinezm.cpp + ---------------------- + Date : February 2025 + Copyright : (C) 2025 by Loïc Bartoletti + Email : loic dot bartoletti at oslandia dot com + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "qgstest.h" +#include "qgisapp.h" +#include "qgsadvanceddigitizingdockwidget.h" +#include "qgsgeometry.h" +#include "qgsmapcanvas.h" +#include "qgsmapcanvassnappingutils.h" +#include "qgssnappingconfig.h" +#include "qgsmaptooladdfeature.h" +#include "qgsproject.h" +#include "qgssettings.h" +#include "qgssettingsregistrycore.h" +#include "qgsvectorlayer.h" +#include "qgswkbtypes.h" +#include "qgsmapmouseevent.h" +#include +#include + +// Comparison operator for QgsGeometry. +bool operator==( const QgsGeometry &g1, const QgsGeometry &g2 ) +{ + if ( g1.isNull() && g2.isNull() ) + return true; + else + return g1.equals( g2 ); +} + +namespace QTest +{ + // Pretty-printing for QgsGeometry. + template<> char *toString( const QgsGeometry &geom ) + { + QByteArray ba = geom.asWkt().toLatin1(); + return qstrdup( ba.data() ); + } +} // namespace QTest + +class TestQgsMapToolAddFeatureLineZMCRS : public QObject +{ + Q_OBJECT + public: + TestQgsMapToolAddFeatureLineZMCRS() = default; + + private slots: + void initTestCase(); + void cleanupTestCase(); + void testZMCRS(); + + private: + QgisApp *mQgisApp = nullptr; + QgsMapCanvas *mCanvas = nullptr; + QgsMapToolAddFeature *mCaptureTool = nullptr; + QgsVectorLayer *mCaptureLayer = nullptr; + QgsVectorLayer *mSnappingLayer = nullptr; +}; + +void TestQgsMapToolAddFeatureLineZMCRS::initTestCase() +{ + QgsApplication::init(); + QgsApplication::initQgis(); + mQgisApp = new QgisApp(); + + + mCanvas = new QgsMapCanvas(); + mCanvas->setDestinationCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:3857" ) ) ); + mCanvas->setFrameStyle( QFrame::NoFrame ); + mCanvas->resize( 512, 512 ); + mCanvas->setExtent( QgsRectangle( 0, 0, 10, 10 ) ); + mCanvas->show(); + + + mCaptureLayer = new QgsVectorLayer( QStringLiteral( "LineStringZM?crs=EPSG:3857" ), QStringLiteral( "Line Capture Layer" ), QStringLiteral( "memory" ) ); + QVERIFY( mCaptureLayer->isValid() ); + QgsProject::instance()->addMapLayers( { mCaptureLayer } ); + + + mSnappingLayer = new QgsVectorLayer( QStringLiteral( "PointZM?crs=EPSG:4326" ), QStringLiteral( "Snapping Points" ), QStringLiteral( "memory" ) ); + QVERIFY( mSnappingLayer->isValid() ); + + QgsFeature snapFeature( mSnappingLayer->fields() ); + QgsPoint snapPoint( 7, 4, 999, 888 ); + snapFeature.setGeometry( QgsGeometry::fromPoint( snapPoint ) ); + mSnappingLayer->startEditing(); + mSnappingLayer->addFeature( snapFeature ); + mSnappingLayer->commitChanges(); + QCOMPARE( mSnappingLayer->featureCount(), ( long ) 1 ); + + + QgsProject::instance()->addMapLayers( { mSnappingLayer, mCaptureLayer } ); + mCanvas->setLayers( { mCaptureLayer, mSnappingLayer } ); + mCanvas->setSnappingUtils( new QgsMapCanvasSnappingUtils( mCanvas, this ) ); +} + +void TestQgsMapToolAddFeatureLineZMCRS::cleanupTestCase() +{ + delete mCaptureTool; + delete mCanvas; + QgsApplication::exitQgis(); +} + +void TestQgsMapToolAddFeatureLineZMCRS::testZMCRS() +{ + QgsSettingsRegistryCore::settingsDigitizingDefaultMValue->setValue( 222 ); + QgsSettingsRegistryCore::settingsDigitizingDefaultZValue->setValue( 456 ); + + mCanvas->setCurrentLayer( mCaptureLayer ); + mCaptureLayer->startEditing(); + + QgsSnappingConfig snapConfig = mCanvas->snappingUtils()->config(); + snapConfig.setEnabled( true ); + snapConfig.setTolerance( 2 ); + snapConfig.setUnits( Qgis::MapToolUnit::Layer ); + snapConfig.setMode( Qgis::SnappingMode::AllLayers ); + snapConfig.setTypeFlag( Qgis::SnappingType::Vertex ); + mCanvas->snappingUtils()->setConfig( snapConfig ); + mCanvas->snappingUtils()->locatorForLayer( mSnappingLayer )->init(); + mCanvas->snappingUtils()->locatorForLayer( mCaptureLayer )->init(); + mCaptureTool = new QgsMapToolAddFeature( mCanvas, QgisApp::instance()->cadDockWidget(), QgsMapToolCapture::CaptureLine ); + mCanvas->setMapTool( mCaptureTool ); + + QSet oldFids; + QgsFeatureIterator it = mCaptureLayer->getFeatures(); + QgsFeature f; + while ( it.nextFeature( f ) ) + oldFids.insert( f.id() ); + + QgsPointXY p2XY = mCanvas->mapSettings().layerToMapCoordinates( mSnappingLayer, QgsPointXY( 7, 4 ) ); + QPoint p1( int( ( 0.0 / 10 ) * 512 ), int( ( ( 10 - 1.0 ) / 10 ) * 512 ) ); // (0,1) + QPoint p2( int( ( p2XY.x() / 10 ) * 512 ), int( ( ( 10 - p2XY.y() ) / 10 ) * 512 ) ); // (7,4) – should snap + QPoint p3( int( ( 2.0 / 10 ) * 512 ), int( ( ( 10 - 2.0 ) / 10 ) * 512 ) ); // (2,2) – should remain unsnapped + + QTest::mouseClick( mCanvas->viewport(), Qt::LeftButton, Qt::NoModifier, p1 ); + QTest::mouseMove( mCanvas->viewport(), p2 ); + QTest::mouseClick( mCanvas->viewport(), Qt::LeftButton, Qt::NoModifier, p2 ); + QTest::mouseClick( mCanvas->viewport(), Qt::LeftButton, Qt::NoModifier, p3 ); + QTest::mouseClick( mCanvas->viewport(), Qt::RightButton, Qt::NoModifier, p3 ); + + QgsFeature newFeature; + QgsFeatureIterator itNew = mCaptureLayer->getFeatures(); + while ( itNew.nextFeature( f ) ) + { + if ( !oldFids.contains( f.id() ) ) + { + newFeature = f; + break; + } + } + QVERIFY( newFeature.isValid() ); + + QString expectedWkt = QStringLiteral( "LineString ZM (0 1 456 222, 7 4 999 888, 2 2 456 222)" ); + qDebug() << "Captured geometry:" << newFeature.geometry().asWkt(); + QCOMPARE( newFeature.geometry().asWkt( 0 ), expectedWkt ); +} + +QGSTEST_MAIN( TestQgsMapToolAddFeatureLineZMCRS ) +#include "testqgsmaptooladdfeaturelinezm_crs.moc" diff --git a/tests/src/app/testqgisappclipboard.cpp b/tests/src/app/testqgisappclipboard.cpp index 0385e5c5f148..9f63f09d7f80 100644 --- a/tests/src/app/testqgisappclipboard.cpp +++ b/tests/src/app/testqgisappclipboard.cpp @@ -558,7 +558,7 @@ void TestQgisAppClipboard::testVectorTileLayer() ds.setParam( "type", "xyz" ); ds.setParam( "url", QString( "file://%1/{z}-{x}-{y}.pbf" ).arg( dataDir ) ); ds.setParam( "zmax", "1" ); - std::unique_ptr layer = std::make_unique( ds.encodedUri(), "Vector Tiles Test" ); + auto layer = std::make_unique( ds.encodedUri(), "Vector Tiles Test" ); QVERIFY( layer->isValid() ); QgsGeometry selectionGeometry = QgsGeometry::fromWkt( QStringLiteral( "Polygon ((13934091.75684908032417297 -1102962.40819426625967026, 11360512.80439674854278564 -2500048.12523981928825378, 12316413.55816475301980972 -5661873.69539554417133331, 16948855.67257896065711975 -6617774.44916355609893799, 18125348.90798573195934296 -2058863.16196227818727493, 15257646.64668171107769012 -735308.27212964743375778, 13934091.75684908032417297 -1102962.40819426625967026))" ) ); diff --git a/tests/src/app/testqgsadvanceddigitizing.cpp b/tests/src/app/testqgsadvanceddigitizing.cpp index 5df779a679d8..2b851e0941ff 100644 --- a/tests/src/app/testqgsadvanceddigitizing.cpp +++ b/tests/src/app/testqgsadvanceddigitizing.cpp @@ -13,6 +13,7 @@ * * ***************************************************************************/ +#include "qgisapp.h" #include "qgstest.h" #include "qgsadvanceddigitizingdockwidget.h" diff --git a/tests/src/app/testqgsattributetable.cpp b/tests/src/app/testqgsattributetable.cpp index 236896c53d0d..02afb55c5f96 100644 --- a/tests/src/app/testqgsattributetable.cpp +++ b/tests/src/app/testqgsattributetable.cpp @@ -113,7 +113,7 @@ void TestQgsAttributeTable::testFieldCalculation() //test field calculation //create a temporary layer - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); QgsFeature f1( tempLayer->dataProvider()->fields(), 1 ); f1.setAttribute( QStringLiteral( "pk" ), 1 ); @@ -131,7 +131,7 @@ void TestQgsAttributeTable::testFieldCalculation() QgsProject::instance()->setDistanceUnits( Qgis::DistanceUnit::Meters ); // run length calculation - std::unique_ptr dlg( new QgsAttributeTableDialog( tempLayer.get() ) ); + auto dlg = std::make_unique( tempLayer.get() ); tempLayer->startEditing(); dlg->runFieldCalculation( tempLayer.get(), QStringLiteral( "col1" ), QStringLiteral( "$length" ) ); tempLayer->commitChanges(); @@ -144,7 +144,7 @@ void TestQgsAttributeTable::testFieldCalculation() // change project length unit, check calculation respects unit QgsProject::instance()->setDistanceUnits( Qgis::DistanceUnit::Feet ); - std::unique_ptr dlg2( new QgsAttributeTableDialog( tempLayer.get() ) ); + auto dlg2 = std::make_unique( tempLayer.get() ); tempLayer->startEditing(); dlg2->runFieldCalculation( tempLayer.get(), QStringLiteral( "col1" ), QStringLiteral( "$length" ) ); tempLayer->commitChanges(); @@ -160,7 +160,7 @@ void TestQgsAttributeTable::testFieldCalculationArea() //test $area field calculation //create a temporary layer - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "Polygon?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "Polygon?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); QgsFeature f1( tempLayer->dataProvider()->fields(), 1 ); f1.setAttribute( QStringLiteral( "pk" ), 1 ); @@ -181,7 +181,7 @@ void TestQgsAttributeTable::testFieldCalculationArea() QgsProject::instance()->setAreaUnits( Qgis::AreaUnit::SquareMeters ); // run area calculation - std::unique_ptr dlg( new QgsAttributeTableDialog( tempLayer.get() ) ); + auto dlg = std::make_unique( tempLayer.get() ); tempLayer->startEditing(); dlg->runFieldCalculation( tempLayer.get(), QStringLiteral( "col1" ), QStringLiteral( "$area" ) ); tempLayer->commitChanges(); @@ -194,7 +194,7 @@ void TestQgsAttributeTable::testFieldCalculationArea() // change project area unit, check calculation respects unit QgsProject::instance()->setAreaUnits( Qgis::AreaUnit::SquareMiles ); - std::unique_ptr dlg2( new QgsAttributeTableDialog( tempLayer.get() ) ); + auto dlg2 = std::make_unique( tempLayer.get() ); tempLayer->startEditing(); dlg2->runFieldCalculation( tempLayer.get(), QStringLiteral( "col1" ), QStringLiteral( "$area" ) ); tempLayer->commitChanges(); @@ -210,10 +210,10 @@ void TestQgsAttributeTable::testNoGeom() const QgsSettings s; //test that by default the attribute table DOESN'T fetch geometries (because performance) - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); - std::unique_ptr dlg( new QgsAttributeTableDialog( tempLayer.get(), QgsAttributeTableFilterModel::ShowAll ) ); + auto dlg = std::make_unique( tempLayer.get(), QgsAttributeTableFilterModel::ShowAll ); QVERIFY( !dlg->mMainView->masterModel()->layerCache()->cacheGeometry() ); QVERIFY( dlg->mMainView->masterModel()->request().flags() & Qgis::FeatureRequestFlag::NoGeometry ); @@ -238,7 +238,7 @@ void TestQgsAttributeTable::testNoGeom() void TestQgsAttributeTable::testVisibleTemporal() { // test attribute table opening in show feature visible mode - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:4326&field=pk:int&field=col1:date" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "LineString?crs=epsg:4326&field=pk:int&field=col1:date" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); QgsPolylineXY line; @@ -269,7 +269,7 @@ void TestQgsAttributeTable::testVisibleTemporal() mQgisApp->mapCanvas()->setExtent( QgsRectangle( -1, -1, 1, 1 ) ); mQgisApp->mapCanvas()->setTemporalRange( QgsDateTimeRange( QDateTime( QDate( 2020, 1, 1 ), QTime( 0, 0, 0 ) ), QDateTime( QDate( 2020, 2, 1 ), QTime( 0, 0, 0 ) ) ) ); - std::unique_ptr dlg( new QgsAttributeTableDialog( tempLayer.get(), QgsAttributeTableFilterModel::ShowVisible ) ); + auto dlg = std::make_unique( tempLayer.get(), QgsAttributeTableFilterModel::ShowVisible ); // feature id 2 is filtered out due to being out of temporal range // feature id 3 is filtered out due to being out of visible extent @@ -279,7 +279,7 @@ void TestQgsAttributeTable::testVisibleTemporal() void TestQgsAttributeTable::testSelected() { // test attribute table opening in show selected mode - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); const QgsFeature f1( tempLayer->dataProvider()->fields(), 1 ); @@ -287,7 +287,7 @@ void TestQgsAttributeTable::testSelected() const QgsFeature f3( tempLayer->dataProvider()->fields(), 3 ); QVERIFY( tempLayer->dataProvider()->addFeatures( QgsFeatureList() << f1 << f2 << f3 ) ); - std::unique_ptr dlg( new QgsAttributeTableDialog( tempLayer.get(), QgsAttributeTableFilterModel::ShowSelected ) ); + auto dlg = std::make_unique( tempLayer.get(), QgsAttributeTableFilterModel::ShowSelected ); QVERIFY( !dlg->mMainView->masterModel()->layerCache()->cacheGeometry() ); //should be nothing - because no selection! @@ -313,7 +313,7 @@ void TestQgsAttributeTable::testSelected() void TestQgsAttributeTable::testEdited() { // test attribute table opening in edited features mode - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); const QgsFeature f1( tempLayer->dataProvider()->fields(), 1 ); @@ -321,7 +321,7 @@ void TestQgsAttributeTable::testEdited() const QgsFeature f3( tempLayer->dataProvider()->fields(), 3 ); QVERIFY( tempLayer->dataProvider()->addFeatures( QgsFeatureList() << f1 << f2 << f3 ) ); - std::unique_ptr dlg( new QgsAttributeTableDialog( tempLayer.get(), QgsAttributeTableFilterModel::ShowEdited ) ); + auto dlg = std::make_unique( tempLayer.get(), QgsAttributeTableFilterModel::ShowEdited ); QVERIFY( !dlg->mMainView->masterModel()->layerCache()->cacheGeometry() ); //should be nothing - because no edited features! @@ -351,7 +351,7 @@ void TestQgsAttributeTable::testEdited() void TestQgsAttributeTable::testSelectedOnTop() { - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); QgsFeature f1( tempLayer->dataProvider()->fields(), 1 ); @@ -365,7 +365,7 @@ void TestQgsAttributeTable::testSelectedOnTop() f3.setAttribute( 1, 5.0 ); QVERIFY( tempLayer->dataProvider()->addFeatures( QgsFeatureList() << f1 << f2 << f3 ) ); - std::unique_ptr dlg( new QgsAttributeTableDialog( tempLayer.get() ) ); + auto dlg = std::make_unique( tempLayer.get() ); dlg->mMainView->setSortExpression( "pk" ); QCOMPARE( dlg->mMainView->mFilterModel->index( 0, 0 ).data( static_cast( QgsAttributeTableModel::CustomRole::FeatureId ) ), QVariant( 1 ) ); @@ -414,7 +414,7 @@ void TestQgsAttributeTable::testSelectedOnTop() void TestQgsAttributeTable::testSortByDisplayExpression() { - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); QgsFeature f1( tempLayer->dataProvider()->fields(), 1 ); @@ -428,7 +428,7 @@ void TestQgsAttributeTable::testSortByDisplayExpression() f3.setAttribute( 1, 5.0 ); QVERIFY( tempLayer->dataProvider()->addFeatures( QgsFeatureList() << f1 << f2 << f3 ) ); - std::unique_ptr dlg( new QgsAttributeTableDialog( tempLayer.get() ) ); + auto dlg = std::make_unique( tempLayer.get() ); dlg->mMainView->mFeatureListView->setDisplayExpression( "pk" ); QgsFeatureListModel *listModel = dlg->mMainView->mFeatureListModel; @@ -448,7 +448,7 @@ void TestQgsAttributeTable::testSortNumbers() { QLocale::setDefault( QLocale::Italian ); - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); QgsFeature f1( tempLayer->dataProvider()->fields(), 1 ); @@ -462,7 +462,7 @@ void TestQgsAttributeTable::testSortNumbers() f3.setAttribute( 1, 10.0001 ); QVERIFY( tempLayer->dataProvider()->addFeatures( QgsFeatureList() << f1 << f2 << f3 ) ); - std::unique_ptr dlg( new QgsAttributeTableDialog( tempLayer.get() ) ); + auto dlg = std::make_unique( tempLayer.get() ); QgsAttributeTableConfig cfg; cfg.setSortExpression( QStringLiteral( R"("col1")" ) ); @@ -492,7 +492,7 @@ void TestQgsAttributeTable::testSortNumbers() void TestQgsAttributeTable::testStartMultiEditNoChanges() { - std::unique_ptr layer = std::make_unique( QStringLiteral( "Point?field=col0:integer&field=col1:integer" ), QStringLiteral( "test" ), QStringLiteral( "memory" ) ); + auto layer = std::make_unique( QStringLiteral( "Point?field=col0:integer&field=col1:integer" ), QStringLiteral( "test" ), QStringLiteral( "memory" ) ); QVERIFY( layer->isValid() ); QgsFeature ft1( layer->dataProvider()->fields() ); @@ -504,7 +504,7 @@ void TestQgsAttributeTable::testStartMultiEditNoChanges() layer->selectAll(); - std::unique_ptr dlg( new QgsAttributeTableDialog( layer.get() ) ); + auto dlg = std::make_unique( layer.get() ); for ( int i = 0; i < 10; ++i ) { @@ -539,7 +539,7 @@ void TestQgsAttributeTable::testStartMultiEditNoChanges() void TestQgsAttributeTable::testMultiEditMakeUncommittedChanges() { - std::unique_ptr layer = std::make_unique( QStringLiteral( "Point?field=col0:integer&field=col1:integer" ), QStringLiteral( "test" ), QStringLiteral( "memory" ) ); + auto layer = std::make_unique( QStringLiteral( "Point?field=col0:integer&field=col1:integer" ), QStringLiteral( "test" ), QStringLiteral( "memory" ) ); QVERIFY( layer->isValid() ); QgsFeature ft1( layer->dataProvider()->fields() ); @@ -551,7 +551,7 @@ void TestQgsAttributeTable::testMultiEditMakeUncommittedChanges() layer->selectAll(); - std::unique_ptr dlg( new QgsAttributeTableDialog( layer.get() ) ); + auto dlg = std::make_unique( layer.get() ); dlg->mMainView->setCurrentEditSelection( { ft2.id() } ); layer->startEditing(); @@ -574,13 +574,13 @@ void TestQgsAttributeTable::testRegression15974() { // Test duplicated rows in attribute table + two crashes. const QString path = QDir::tempPath() + "/testshp15974.shp"; - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "polygon?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "polygon?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); QgsVectorFileWriter::SaveVectorOptions saveOptions; saveOptions.fileEncoding = QStringLiteral( "system" ); saveOptions.driverName = QStringLiteral( "ESRI Shapefile" ); QgsVectorFileWriter::writeAsVectorFormatV3( tempLayer.get(), path, tempLayer->transformContext(), saveOptions ); - std::unique_ptr shpLayer( new QgsVectorLayer( path, QStringLiteral( "test" ), QStringLiteral( "ogr" ) ) ); + auto shpLayer = std::make_unique( path, QStringLiteral( "test" ), QStringLiteral( "ogr" ) ); QgsFeature f1( shpLayer->dataProvider()->fields(), 1 ); QgsGeometry geom; geom = QgsGeometry::fromWkt( QStringLiteral( "polygon((0 0, 0 1, 1 1, 1 0, 0 0))" ) ); @@ -592,7 +592,7 @@ void TestQgsAttributeTable::testRegression15974() f3.setGeometry( geom ); QVERIFY( shpLayer->startEditing() ); QVERIFY( shpLayer->addFeatures( QgsFeatureList() << f1 << f2 << f3 ) ); - std::unique_ptr dlg( new QgsAttributeTableDialog( shpLayer.get() ) ); + auto dlg = std::make_unique( shpLayer.get() ); QCOMPARE( shpLayer->featureCount(), 3L ); mQgisApp->saveEdits( shpLayer.get() ); QCOMPARE( shpLayer->featureCount(), 3L ); @@ -608,7 +608,7 @@ void TestQgsAttributeTable::testRegression15974() void TestQgsAttributeTable::testOrderColumn() { - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=col1:int&field=col2:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=col1:int&field=col2:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); QgsFeature f1( tempLayer->dataProvider()->fields(), 1 ); @@ -617,7 +617,7 @@ void TestQgsAttributeTable::testOrderColumn() f1.setAttribute( 2, 7 ); QVERIFY( tempLayer->dataProvider()->addFeatures( QgsFeatureList() << f1 ) ); - std::unique_ptr dlg( new QgsAttributeTableDialog( tempLayer.get() ) ); + auto dlg = std::make_unique( tempLayer.get() ); // Issue https://github.com/qgis/QGIS/issues/28493 // When we reorder column (last column becomes first column), and we select an entire row @@ -661,7 +661,7 @@ void TestQgsAttributeTable::testOrderColumn() void TestQgsAttributeTable::testFilteredFeatures() { - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=col1:int&field=col2:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=col1:int&field=col2:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); QgsFeature f1( tempLayer->dataProvider()->fields(), 1 ); @@ -679,7 +679,7 @@ void TestQgsAttributeTable::testFilteredFeatures() QVERIFY( tempLayer->dataProvider()->addFeatures( QgsFeatureList() << f1 << f2 << f3 ) ); - std::unique_ptr dlg( new QgsAttributeTableDialog( tempLayer.get(), QgsAttributeTableFilterModel::ShowAll ) ); + auto dlg = std::make_unique( tempLayer.get(), QgsAttributeTableFilterModel::ShowAll ); QEventLoop loop; connect( qobject_cast( dlg->mMainView->mFilterModel ), &QgsAttributeTableFilterModel::featuresFiltered, &loop, &QEventLoop::quit ); @@ -744,7 +744,7 @@ void TestQgsAttributeTable::testFilteredFeatures() void TestQgsAttributeTable::testCopySelectedRows() { - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=col1:int&field=col2:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=col1:int&field=col2:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); QgsFeature f1( tempLayer->dataProvider()->fields(), 1 ); @@ -757,7 +757,7 @@ void TestQgsAttributeTable::testCopySelectedRows() QVERIFY( tempLayer->dataProvider()->addFeatures( QgsFeatureList() << f1 << f2 ) ); - std::unique_ptr dlg( new QgsAttributeTableDialog( tempLayer.get(), QgsAttributeTableFilterModel::ShowAll ) ); + auto dlg = std::make_unique( tempLayer.get(), QgsAttributeTableFilterModel::ShowAll ); tempLayer->selectByIds( QgsFeatureIds() << 1 << 2 ); @@ -787,7 +787,7 @@ void TestQgsAttributeTable::testCopySelectedRows() void TestQgsAttributeTable::testOpenWithFilterExpression() { // test attribute table opening in show feature visible mode - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:4326&field=pk:int&field=col1:date" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "LineString?crs=epsg:4326&field=pk:int&field=col1:date" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); QgsPolylineXY line; @@ -808,7 +808,7 @@ void TestQgsAttributeTable::testOpenWithFilterExpression() QVERIFY( tempLayer->dataProvider()->addFeatures( QgsFeatureList() << f1 << f2 << f3 ) ); const QString filterExpression = QStringLiteral( "col1 < to_date('2020-02-03')" ); - std::unique_ptr dlg( new QgsAttributeTableDialog( tempLayer.get(), QgsAttributeTableFilterModel::ShowFilteredList, nullptr, Qt::Window, nullptr, filterExpression ) ); + auto dlg = std::make_unique( tempLayer.get(), QgsAttributeTableFilterModel::ShowFilteredList, nullptr, Qt::Window, nullptr, filterExpression ); // feature id 2 is filtered out due not matching the provided filter expression QCOMPARE( dlg->mMainView->filteredFeatures(), QgsFeatureIds() << 1 << 3 ); @@ -816,7 +816,7 @@ void TestQgsAttributeTable::testOpenWithFilterExpression() void TestQgsAttributeTable::testInvalidView() { - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:4326&field=pk:int&field=col1:date" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "LineString?crs=epsg:4326&field=pk:int&field=col1:date" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); QgsPolylineXY line; @@ -840,7 +840,7 @@ void TestQgsAttributeTable::testInvalidView() tempLayer->setConstraintExpression( 1, QStringLiteral( "col1 >= to_date('2020-02-03')" ) ); tempLayer->setFieldConstraint( 1, QgsFieldConstraints::ConstraintExpression, QgsFieldConstraints::ConstraintStrengthHard ); - std::unique_ptr dlg( new QgsAttributeTableDialog( tempLayer.get(), QgsAttributeTableFilterModel::ShowAll, nullptr, Qt::Window, nullptr, filterExpression ) ); + auto dlg = std::make_unique( tempLayer.get(), QgsAttributeTableFilterModel::ShowAll, nullptr, Qt::Window, nullptr, filterExpression ); dlg->mFeatureFilterWidget->filterInvalid(); // feature id 2 is filtered out due not matching the provided filter expression @@ -849,7 +849,7 @@ void TestQgsAttributeTable::testInvalidView() void TestQgsAttributeTable::testEnsureEditSelection() { - std::unique_ptr layer = std::make_unique( QStringLiteral( "Point?field=col0:integer&field=col1:integer" ), QStringLiteral( "test" ), QStringLiteral( "memory" ) ); + auto layer = std::make_unique( QStringLiteral( "Point?field=col0:integer&field=col1:integer" ), QStringLiteral( "test" ), QStringLiteral( "memory" ) ); QVERIFY( layer->isValid() ); QgsFeature ft1( layer->dataProvider()->fields(), 1 ); @@ -867,7 +867,7 @@ void TestQgsAttributeTable::testEnsureEditSelection() layer->removeSelection(); - std::unique_ptr dlg( new QgsAttributeTableDialog( layer.get() ) ); + auto dlg = std::make_unique( layer.get() ); //since the update is done by timer, we have to wait (at least one millisecond) or until the current edit selection changed qRegisterMetaType( "QgsFeature&" ); @@ -912,14 +912,14 @@ void TestQgsAttributeTable::testEnsureEditSelection() void TestQgsAttributeTable::testFetchAllAttributes() { QString pointFileName = TEST_DATA_DIR + QStringLiteral( "/points.shp" ); - std::unique_ptr layer = std::make_unique( pointFileName ); + auto layer = std::make_unique( pointFileName ); QVERIFY( layer->isValid() ); QgsAttributeTableConfig config { layer->attributeTableConfig() }; config.setColumnHidden( 1, true ); layer->setAttributeTableConfig( config ); - std::unique_ptr dlg( new QgsAttributeTableDialog( layer.get() ) ); + auto dlg = std::make_unique( layer.get() ); QCOMPARE( dlg->mMainView->masterModel()->data( dlg->mMainView->masterModel()->index( 0, 0 ), Qt::DisplayRole ).toString(), "Jet" ); QCOMPARE( dlg->mMainView->masterModel()->data( dlg->mMainView->masterModel()->index( 0, 1 ), Qt::DisplayRole ).toString(), "90" ); diff --git a/tests/src/app/testqgsfieldcalculator.cpp b/tests/src/app/testqgsfieldcalculator.cpp index f121d1d6b17f..229a0536f72b 100644 --- a/tests/src/app/testqgsfieldcalculator.cpp +++ b/tests/src/app/testqgsfieldcalculator.cpp @@ -68,7 +68,7 @@ void TestQgsFieldCalculator::testLengthCalculations() //test length calculation respects ellipsoid and project distance units //create a temporary layer - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); QgsFeature f1( tempLayer->dataProvider()->fields(), 1 ); f1.setAttribute( QStringLiteral( "pk" ), 1 ); @@ -87,7 +87,7 @@ void TestQgsFieldCalculator::testLengthCalculations() // run length calculation tempLayer->startEditing(); - std::unique_ptr calc( new QgsFieldCalculator( tempLayer.get() ) ); + auto calc = std::make_unique( tempLayer.get() ); // this next part is fragile, and may need to be modified if the dialog changes: calc->mUpdateExistingGroupBox->setChecked( true ); @@ -107,7 +107,7 @@ void TestQgsFieldCalculator::testLengthCalculations() // change project length unit, check calculation respects unit QgsProject::instance()->setDistanceUnits( Qgis::DistanceUnit::Feet ); tempLayer->startEditing(); - std::unique_ptr calc2( new QgsFieldCalculator( tempLayer.get() ) ); + auto calc2 = std::make_unique( tempLayer.get() ); calc2->mUpdateExistingGroupBox->setChecked( true ); calc2->mExistingFieldComboBox->setCurrentIndex( 1 ); calc2->builder->setExpressionText( QStringLiteral( "$length" ) ); @@ -125,7 +125,7 @@ void TestQgsFieldCalculator::testAreaCalculations() //test area calculation respects ellipsoid and project area units //create a temporary layer - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "Polygon?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "Polygon?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); QgsFeature f1( tempLayer->dataProvider()->fields(), 1 ); f1.setAttribute( QStringLiteral( "pk" ), 1 ); @@ -147,7 +147,7 @@ void TestQgsFieldCalculator::testAreaCalculations() // run area calculation tempLayer->startEditing(); - std::unique_ptr calc( new QgsFieldCalculator( tempLayer.get() ) ); + auto calc = std::make_unique( tempLayer.get() ); // this next part is fragile, and may need to be modified if the dialog changes: calc->mUpdateExistingGroupBox->setChecked( true ); @@ -167,7 +167,7 @@ void TestQgsFieldCalculator::testAreaCalculations() // change project area unit, check calculation respects unit QgsProject::instance()->setAreaUnits( Qgis::AreaUnit::SquareMiles ); tempLayer->startEditing(); - std::unique_ptr calc2( new QgsFieldCalculator( tempLayer.get() ) ); + auto calc2 = std::make_unique( tempLayer.get() ); calc2->mUpdateExistingGroupBox->setChecked( true ); calc2->mExistingFieldComboBox->setCurrentIndex( 1 ); calc2->builder->setExpressionText( QStringLiteral( "$area" ) ); diff --git a/tests/src/app/testqgsidentify.cpp b/tests/src/app/testqgsidentify.cpp index 3133da33b080..9a339eea081a 100644 --- a/tests/src/app/testqgsidentify.cpp +++ b/tests/src/app/testqgsidentify.cpp @@ -186,7 +186,7 @@ void TestQgsIdentify::doAction() void TestQgsIdentify::clickxy() { // create temp layer - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:3111" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "Point?crs=epsg:3111" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); // add feature @@ -233,7 +233,7 @@ void TestQgsIdentify::closestPoint() s.setValue( QStringLiteral( "/qgis/measure/keepbaseunit" ), true ); //create a temporary layer - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "LineStringZM?crs=epsg:3111&field=pk:int&field=col1:double&field=url:string" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "LineStringZM?crs=epsg:3111&field=pk:int&field=col1:double&field=url:string" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); QgsFeature f1( tempLayer->dataProvider()->fields(), 1 ); f1.setAttribute( QStringLiteral( "pk" ), 1 ); @@ -255,7 +255,7 @@ void TestQgsIdentify::closestPoint() QgsPointXY mapPoint = canvas->getCoordinateTransform()->transform( 2484587, 2399800 ); - std::unique_ptr action( new QgsMapToolIdentifyAction( canvas ) ); + auto action = std::make_unique( canvas ); QgsIdentifyResultsDialog *dlg = action->resultsDialog(); //check that closest point attributes are present @@ -306,7 +306,7 @@ void TestQgsIdentify::closestPoint() // polygons //create a temporary layer - std::unique_ptr tempLayer2( new QgsVectorLayer( QStringLiteral( "PolygonZM?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer2 = std::make_unique( QStringLiteral( "PolygonZM?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer2->isValid() ); f1 = QgsFeature( tempLayer2->dataProvider()->fields(), 1 ); f1.setAttribute( QStringLiteral( "pk" ), 1 ); @@ -337,7 +337,7 @@ void TestQgsIdentify::lengthCalculation() s.setValue( QStringLiteral( "/qgis/measure/keepbaseunit" ), true ); //create a temporary layer - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); QgsFeature f1( tempLayer->dataProvider()->fields(), 1 ); f1.setAttribute( QStringLiteral( "pk" ), 1 ); @@ -361,7 +361,7 @@ void TestQgsIdentify::lengthCalculation() const QgsPointXY mapPoint = canvas->getCoordinateTransform()->transform( 2484588, 2425722 ); - std::unique_ptr action( new QgsMapToolIdentifyAction( canvas ) ); + auto action = std::make_unique( canvas ); QList result = action->identify( mapPoint.x(), mapPoint.y(), QList() << tempLayer.get() ); QCOMPARE( result.length(), 1 ); QString derivedLength = result.at( 0 ).mDerivedAttributes[tr( "Length (Ellipsoidal — WGS84)" )]; @@ -460,7 +460,7 @@ void TestQgsIdentify::perimeterCalculation() s.setValue( QStringLiteral( "/qgis/measure/keepbaseunit" ), true ); //create a temporary layer - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "Polygon?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "Polygon?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); QgsFeature f1( tempLayer->dataProvider()->fields(), 1 ); f1.setAttribute( QStringLiteral( "pk" ), 1 ); @@ -486,7 +486,7 @@ void TestQgsIdentify::perimeterCalculation() const QgsPointXY mapPoint = canvas->getCoordinateTransform()->transform( 2484588, 2425722 ); - std::unique_ptr action( new QgsMapToolIdentifyAction( canvas ) ); + auto action = std::make_unique( canvas ); QList result = action->identify( mapPoint.x(), mapPoint.y(), QList() << tempLayer.get() ); QCOMPARE( result.length(), 1 ); QString derivedPerimeter = result.at( 0 ).mDerivedAttributes[tr( "Perimeter (Ellipsoidal — WGS84)" )]; @@ -537,7 +537,7 @@ void TestQgsIdentify::areaCalculation() s.setValue( QStringLiteral( "/qgis/measure/keepbaseunit" ), true ); //create a temporary layer - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "Polygon?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "Polygon?crs=epsg:3111&field=pk:int&field=col1:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); QgsFeature f1( tempLayer->dataProvider()->fields(), 1 ); f1.setAttribute( QStringLiteral( "pk" ), 1 ); @@ -564,7 +564,7 @@ void TestQgsIdentify::areaCalculation() const QgsPointXY mapPoint = canvas->getCoordinateTransform()->transform( 2484588, 2425722 ); - std::unique_ptr action( new QgsMapToolIdentifyAction( canvas ) ); + auto action = std::make_unique( canvas ); QList result = action->identify( mapPoint.x(), mapPoint.y(), QList() << tempLayer.get() ); QCOMPARE( result.length(), 1 ); QString derivedArea = result.at( 0 ).mDerivedAttributes[tr( "Area (Ellipsoidal — WGS84)" )]; @@ -613,7 +613,7 @@ void TestQgsIdentify::areaCalculation() // private QList TestQgsIdentify::testIdentifyRaster( QgsRasterLayer *layer, double xGeoref, double yGeoref, bool roundToCanvasPixels ) { - std::unique_ptr action( new QgsMapToolIdentifyAction( canvas ) ); + auto action = std::make_unique( canvas ); const QgsPointXY mapPoint = canvas->getCoordinateTransform()->transform( xGeoref, yGeoref ); QgsIdentifyContext identifyContext; @@ -629,7 +629,7 @@ QList TestQgsIdentify::testIdentifyRaster( Q // private QList TestQgsIdentify::testIdentifyMesh( QgsMeshLayer *layer, double xGeoref, double yGeoref ) { - std::unique_ptr action( new QgsMapToolIdentifyAction( canvas ) ); + auto action = std::make_unique( canvas ); const QgsPointXY mapPoint = canvas->getCoordinateTransform()->transform( xGeoref, yGeoref ); //check that closest point attributes are present QgsIdentifyContext identifyContext; @@ -643,7 +643,7 @@ QList TestQgsIdentify::testIdentifyMesh( Qgs QList TestQgsIdentify::testIdentifyVector( QgsVectorLayer *layer, double xGeoref, double yGeoref ) { - std::unique_ptr action( new QgsMapToolIdentifyAction( canvas ) ); + auto action = std::make_unique( canvas ); const QgsPointXY mapPoint = canvas->getCoordinateTransform()->transform( xGeoref, yGeoref ); QgsIdentifyContext identifyContext; if ( canvas->mapSettings().isTemporal() ) @@ -656,7 +656,7 @@ QList QList TestQgsIdentify::testIdentifyVectorTile( QgsVectorTileLayer *layer, double xGeoref, double yGeoref ) { - std::unique_ptr action( new QgsMapToolIdentifyAction( canvas ) ); + auto action = std::make_unique( canvas ); const QgsPointXY mapPoint = canvas->getCoordinateTransform()->transform( xGeoref, yGeoref ); QgsIdentifyContext identifyContext; if ( canvas->mapSettings().isTemporal() ) @@ -669,7 +669,7 @@ void TestQgsIdentify::identifyRasterTemporal() { //create a temporary layer const QString raster = QStringLiteral( TEST_DATA_DIR ) + "/raster/test.asc"; - std::unique_ptr tempLayer = std::make_unique( raster ); + auto tempLayer = std::make_unique( raster ); QVERIFY( tempLayer->isValid() ); // activate temporal properties @@ -696,7 +696,7 @@ void TestQgsIdentify::identifyRasterFloat32() // By default the QgsRasterLayer forces AAIGRID_DATATYPE=Float64 CPLSetConfigOption( "AAIGRID_DATATYPE", "Float32" ); - std::unique_ptr tempLayer( new QgsRasterLayer( raster ) ); + auto tempLayer = std::make_unique( raster ); CPLSetConfigOption( "AAIGRID_DATATYPE", nullptr ); QVERIFY( tempLayer->isValid() ); @@ -728,7 +728,7 @@ void TestQgsIdentify::identifyRasterFloat64() { //create a temporary layer const QString raster = QStringLiteral( TEST_DATA_DIR ) + "/raster/test.asc"; - std::unique_ptr tempLayer( new QgsRasterLayer( raster ) ); + auto tempLayer = std::make_unique( raster ); QVERIFY( tempLayer->isValid() ); canvas->setExtent( QgsRectangle( 0, 0, 7, 1 ) ); @@ -751,7 +751,7 @@ void TestQgsIdentify::identifyRasterFloat64() void TestQgsIdentify::identifyRasterDerivedAttributes() { const QString raster = QStringLiteral( TEST_DATA_DIR ) + "/raster/dem.tif"; - std::unique_ptr tempLayer( new QgsRasterLayer( raster ) ); + auto tempLayer = std::make_unique( raster ); QVERIFY( tempLayer->isValid() ); const QgsRectangle layerExtent = tempLayer->extent(); @@ -958,7 +958,7 @@ void TestQgsIdentify::identifyVectorTile() void TestQgsIdentify::identifyInvalidPolygons() { //create a temporary layer - std::unique_ptr memoryLayer( new QgsVectorLayer( QStringLiteral( "Polygon?field=pk:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto memoryLayer = std::make_unique( QStringLiteral( "Polygon?field=pk:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( memoryLayer->isValid() ); QgsFeature f1( memoryLayer->dataProvider()->fields(), 1 ); f1.setAttribute( QStringLiteral( "pk" ), 1 ); @@ -1059,7 +1059,7 @@ void TestQgsIdentify::testRelations() relationManager->addRelation( relation ); } - std::unique_ptr dialog = std::make_unique( canvas ); + auto dialog = std::make_unique( canvas ); dialog->addFeature( layerA, featureA, QMap() ); QCOMPARE( dialog->lstResults->topLevelItemCount(), 1 ); @@ -1170,7 +1170,7 @@ void TestQgsIdentify::testRelations() void TestQgsIdentify::testPointZ() { - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "PointZ?crs=epsg:4979" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "PointZ?crs=epsg:4979" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); QCOMPARE( tempLayer->crs3D().horizontalCrs().authid(), QStringLiteral( "EPSG:4979" ) ); @@ -1189,7 +1189,7 @@ void TestQgsIdentify::testPointZ() const QgsPointXY mapPoint = canvas->getCoordinateTransform()->transform( 134.445567853, -23.445567853 ); - std::unique_ptr action( new QgsMapToolIdentifyAction( canvas ) ); + auto action = std::make_unique( canvas ); QList result = action->identify( static_cast( mapPoint.x() ), static_cast( mapPoint.y() ), QList() << tempLayer.get() ); QCOMPARE( result.length(), 1 ); double z4979 = result.at( 0 ).mDerivedAttributes[QStringLiteral( "Z (EPSG:4979 - WGS 84)" )].toDouble(); @@ -1200,7 +1200,7 @@ void TestQgsIdentify::testPointZ() void TestQgsIdentify::testLineStringZ() { - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "LineStringZ?crs=epsg:4979" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "LineStringZ?crs=epsg:4979" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); QCOMPARE( tempLayer->crs3D().horizontalCrs().authid(), QStringLiteral( "EPSG:4979" ) ); @@ -1220,7 +1220,7 @@ void TestQgsIdentify::testLineStringZ() const QgsPointXY mapPoint = canvas->getCoordinateTransform()->transform( 136.46, -23.445567853 ); - std::unique_ptr action( new QgsMapToolIdentifyAction( canvas ) ); + auto action = std::make_unique( canvas ); QList result = action->identify( static_cast( mapPoint.x() ), static_cast( mapPoint.y() ), QList() << tempLayer.get() ); QCOMPARE( result.length(), 1 ); double interpolatedZ4979 = result.at( 0 ).mDerivedAttributes[QStringLiteral( "Interpolated Z (EPSG:4979 - WGS 84)" )].toDouble(); @@ -1235,7 +1235,7 @@ void TestQgsIdentify::testLineStringZ() void TestQgsIdentify::testPolygonZ() { - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "PolygonZ?crs=epsg:4979" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "PolygonZ?crs=epsg:4979" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); QCOMPARE( tempLayer->crs3D().horizontalCrs().authid(), QStringLiteral( "EPSG:4979" ) ); @@ -1255,7 +1255,7 @@ void TestQgsIdentify::testPolygonZ() const QgsPointXY mapPoint = canvas->getCoordinateTransform()->transform( 136.46, -23.445567853 ); - std::unique_ptr action( new QgsMapToolIdentifyAction( canvas ) ); + auto action = std::make_unique( canvas ); QList result = action->identify( static_cast( mapPoint.x() ), static_cast( mapPoint.y() ), QList() << tempLayer.get() ); QCOMPARE( result.length(), 1 ); double interpolatedZ4979 = result.at( 0 ).mDerivedAttributes[QStringLiteral( "Interpolated Z (EPSG:4979 - WGS 84)" )].toDouble(); @@ -1271,7 +1271,7 @@ void TestQgsIdentify::testPolygonZ() void TestQgsIdentify::identifyPointCloud() { #ifdef HAVE_EPT - std::unique_ptr pointCloud = std::make_unique( QStringLiteral( TEST_DATA_DIR ) + "/point_clouds/ept/rgb16/ept.json", QStringLiteral( "pointcloud" ), QStringLiteral( "ept" ) ); + auto pointCloud = std::make_unique( QStringLiteral( TEST_DATA_DIR ) + "/point_clouds/ept/rgb16/ept.json", QStringLiteral( "pointcloud" ), QStringLiteral( "ept" ) ); QVERIFY( pointCloud->isValid() ); pointCloud->setCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:4979" ) ) ); QCOMPARE( pointCloud->crs3D().horizontalCrs().authid(), QStringLiteral( "EPSG:4979" ) ); @@ -1288,7 +1288,7 @@ void TestQgsIdentify::identifyPointCloud() const QgsPointXY mapPoint = canvas->getCoordinateTransform()->transform( 7.42006, 2.74911 ); - std::unique_ptr action( new QgsMapToolIdentifyAction( canvas ) ); + auto action = std::make_unique( canvas ); QList result = action->identify( static_cast( mapPoint.x() ), static_cast( mapPoint.y() ), QList() << pointCloud.get() ); QCOMPARE( result.length(), 1 ); double z4979 = result.at( 0 ).mDerivedAttributes[QStringLiteral( "Z (EPSG:4979 - WGS 84)" )].toDouble(); @@ -1301,7 +1301,7 @@ void TestQgsIdentify::identifyPointCloud() void TestQgsIdentify::identifyVirtualPointCloud() { #ifdef HAVE_COPC - std::unique_ptr pointCloud = std::make_unique( QStringLiteral( TEST_DATA_DIR ) + "/point_clouds/virtual/sunshine-coast/combined-with-overview.vpc", QStringLiteral( "pointcloud" ), QStringLiteral( "vpc" ) ); + auto pointCloud = std::make_unique( QStringLiteral( TEST_DATA_DIR ) + "/point_clouds/virtual/sunshine-coast/combined-with-overview.vpc", QStringLiteral( "pointcloud" ), QStringLiteral( "vpc" ) ); QVERIFY( pointCloud->isValid() ); pointCloud->setCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:28356" ) ) ); QCOMPARE( pointCloud->crs3D().horizontalCrs().authid(), QStringLiteral( "EPSG:28356" ) ); @@ -1318,7 +1318,7 @@ void TestQgsIdentify::identifyVirtualPointCloud() const QgsPointXY mapPoint = canvas->getCoordinateTransform()->transform( 498065.23, 7050992.90 ); - std::unique_ptr action( new QgsMapToolIdentifyAction( canvas ) ); + auto action = std::make_unique( canvas ); QList result = action->identify( static_cast( mapPoint.x() ), static_cast( mapPoint.y() ), QList() << pointCloud.get() ); QCOMPARE( result.length(), 1 ); double z = result.at( 0 ).mDerivedAttributes[QStringLiteral( "Z" )].toDouble(); diff --git a/tests/src/app/testqgslayerpropertiesdialogs.cpp b/tests/src/app/testqgslayerpropertiesdialogs.cpp index 37bdd60e65ab..9797b95278ff 100644 --- a/tests/src/app/testqgslayerpropertiesdialogs.cpp +++ b/tests/src/app/testqgslayerpropertiesdialogs.cpp @@ -93,7 +93,7 @@ class TestQgsLayerPropertiesDialogs : public QgsTest // valid vector layer const QString pointFileName = mTestDataDir + "points.shp"; const QFileInfo pointFileInfo( pointFileName ); - std::unique_ptr vl = std::make_unique( pointFileInfo.filePath(), pointFileInfo.completeBaseName(), QStringLiteral( "ogr" ) ); + auto vl = std::make_unique( pointFileInfo.filePath(), pointFileInfo.completeBaseName(), QStringLiteral( "ogr" ) ); QVERIFY( vl->isValid() ); QgsMapCanvas canvas; @@ -108,7 +108,7 @@ class TestQgsLayerPropertiesDialogs : public QgsTest // invalid vector layer const QString pointFileName = mTestDataDir + "xxpoints.shp"; const QFileInfo pointFileInfo( pointFileName ); - std::unique_ptr vl = std::make_unique( pointFileInfo.filePath(), pointFileInfo.completeBaseName(), QStringLiteral( "xxogr" ) ); + auto vl = std::make_unique( pointFileInfo.filePath(), pointFileInfo.completeBaseName(), QStringLiteral( "xxogr" ) ); QVERIFY( !vl->isValid() ); QgsMapCanvas canvas; @@ -123,7 +123,7 @@ class TestQgsLayerPropertiesDialogs : public QgsTest // start with a point layer const QString pointFileName = mTestDataDir + "points.shp"; const QFileInfo pointFileInfo( pointFileName ); - std::unique_ptr vl = std::make_unique( pointFileInfo.filePath(), pointFileInfo.completeBaseName(), QStringLiteral( "ogr" ) ); + auto vl = std::make_unique( pointFileInfo.filePath(), pointFileInfo.completeBaseName(), QStringLiteral( "ogr" ) ); QVERIFY( vl->isValid() ); vl->setSubsetString( QStringLiteral( "\"class\"='Biplane'" ) ); QCOMPARE( vl->subsetString(), QStringLiteral( "\"class\"='Biplane'" ) ); @@ -180,7 +180,7 @@ class TestQgsLayerPropertiesDialogs : public QgsTest // start with a point layer const QString pointFileName = mTestDataDir + "points.shp"; const QFileInfo pointFileInfo( pointFileName ); - std::unique_ptr vl = std::make_unique( pointFileInfo.filePath(), pointFileInfo.completeBaseName(), QStringLiteral( "ogr" ) ); + auto vl = std::make_unique( pointFileInfo.filePath(), pointFileInfo.completeBaseName(), QStringLiteral( "ogr" ) ); QVERIFY( vl->isValid() ); // point layer should have a marker symbol vl->setRenderer( new QgsSingleSymbolRenderer( new QgsMarkerSymbol() ) ); @@ -222,7 +222,7 @@ class TestQgsLayerPropertiesDialogs : public QgsTest QTemporaryDir tmpDir; QFile::copy( mTestDataDir + "landsat_4326.tif", tmpDir.filePath( QStringLiteral( "landsat_4326.tif" ) ) ); const QString rasterFileName = tmpDir.filePath( QStringLiteral( "landsat_4326.tif" ) ); - std::unique_ptr rl = std::make_unique( rasterFileName, QStringLiteral( "test" ), QStringLiteral( "gdal" ) ); + auto rl = std::make_unique( rasterFileName, QStringLiteral( "test" ), QStringLiteral( "gdal" ) ); QVERIFY( rl->isValid() ); QgsMapCanvas canvas; @@ -236,7 +236,7 @@ class TestQgsLayerPropertiesDialogs : public QgsTest { // invalid raster layer const QString rasterFileName = mTestDataDir + "xxlandsat_4326.tif"; - std::unique_ptr rl = std::make_unique( rasterFileName, QStringLiteral( "test" ), QStringLiteral( "xxgdal" ) ); + auto rl = std::make_unique( rasterFileName, QStringLiteral( "test" ), QStringLiteral( "xxgdal" ) ); QVERIFY( !rl->isValid() ); QgsMapCanvas canvas; @@ -250,7 +250,7 @@ class TestQgsLayerPropertiesDialogs : public QgsTest { // valid mesh layer QString uri( mTestDataDir + "/mesh/quad_and_triangle.2dm" ); - std::unique_ptr ml = std::make_unique( uri, QStringLiteral( "test" ), QStringLiteral( "mdal" ) ); + auto ml = std::make_unique( uri, QStringLiteral( "test" ), QStringLiteral( "mdal" ) ); QVERIFY( ml->isValid() ); QgsMapCanvas canvas; @@ -264,7 +264,7 @@ class TestQgsLayerPropertiesDialogs : public QgsTest { // invalid mesh layer QString uri( mTestDataDir + "/mesh/xxquad_and_triangle.2dm" ); - std::unique_ptr ml = std::make_unique( uri, QStringLiteral( "test" ), QStringLiteral( "xmdal" ) ); + auto ml = std::make_unique( uri, QStringLiteral( "test" ), QStringLiteral( "xmdal" ) ); QVERIFY( !ml->isValid() ); QgsMapCanvas canvas; @@ -277,7 +277,7 @@ class TestQgsLayerPropertiesDialogs : public QgsTest void testValidPointCloudProperties() { // valid point cloud layer - std::unique_ptr layer = std::make_unique( mTestDataDir + QStringLiteral( "point_clouds/ept/sunshine-coast/ept.json" ), QStringLiteral( "layer" ), QStringLiteral( "ept" ) ); + auto layer = std::make_unique( mTestDataDir + QStringLiteral( "point_clouds/ept/sunshine-coast/ept.json" ), QStringLiteral( "layer" ), QStringLiteral( "ept" ) ); QVERIFY( layer->isValid() ); QgsMapCanvas canvas; @@ -290,7 +290,7 @@ class TestQgsLayerPropertiesDialogs : public QgsTest void testInvalidPointCloudProperties() { // invalid point cloud layer - std::unique_ptr layer = std::make_unique( mTestDataDir + QStringLiteral( "xxpoint_clouds/ept/sunshine-coast/ept.json" ), QStringLiteral( "layer" ), QStringLiteral( "xxept" ) ); + auto layer = std::make_unique( mTestDataDir + QStringLiteral( "xxpoint_clouds/ept/sunshine-coast/ept.json" ), QStringLiteral( "layer" ), QStringLiteral( "xxept" ) ); QVERIFY( !layer->isValid() ); QgsMapCanvas canvas; @@ -304,7 +304,7 @@ class TestQgsLayerPropertiesDialogs : public QgsTest { // valid vector tile layer const QString srcMbtiles = QStringLiteral( "type=mbtiles&url=%1/vector_tile/mbtiles_vt.mbtiles" ).arg( TEST_DATA_DIR ); - std::unique_ptr layer = std::make_unique( srcMbtiles ); + auto layer = std::make_unique( srcMbtiles ); QVERIFY( layer->isValid() ); QgsMapCanvas canvas; @@ -318,7 +318,7 @@ class TestQgsLayerPropertiesDialogs : public QgsTest { // invalid vector tile layer const QString srcMbtiles = QStringLiteral( "type=mbtiles&url=%1/vector_tile/xxmbtiles_vt.mbtiles" ).arg( TEST_DATA_DIR ); - std::unique_ptr layer = std::make_unique( srcMbtiles ); + auto layer = std::make_unique( srcMbtiles ); QVERIFY( !layer->isValid() ); QgsMapCanvas canvas; @@ -331,7 +331,7 @@ class TestQgsLayerPropertiesDialogs : public QgsTest void testInvalidTileSceneProperties() { // invalid tiled scene layer - std::unique_ptr layer = std::make_unique( QStringLiteral( "xxx" ), QStringLiteral( "test" ), QStringLiteral( "xxx" ) ); + auto layer = std::make_unique( QStringLiteral( "xxx" ), QStringLiteral( "test" ), QStringLiteral( "xxx" ) ); QVERIFY( !layer->isValid() ); QgsMapCanvas canvas; @@ -344,7 +344,7 @@ class TestQgsLayerPropertiesDialogs : public QgsTest void testValidAnnotationLayerProperties() { // valid annotation layer - std::unique_ptr layer = std::make_unique( QStringLiteral( "xxx" ), QgsAnnotationLayer::LayerOptions( QgsCoordinateTransformContext() ) ); + auto layer = std::make_unique( QStringLiteral( "xxx" ), QgsAnnotationLayer::LayerOptions( QgsCoordinateTransformContext() ) ); QVERIFY( layer->isValid() ); QgsMapCanvas canvas; diff --git a/tests/src/app/testqgsmaptooleditmesh.cpp b/tests/src/app/testqgsmaptooleditmesh.cpp index 7f1455c774e7..0aed72d40379 100644 --- a/tests/src/app/testqgsmaptooleditmesh.cpp +++ b/tests/src/app/testqgsmaptooleditmesh.cpp @@ -409,16 +409,16 @@ void TestQgsMapToolEditMesh::testAssignVertexZValueFromTerrainOnCreation() crs3857.createFromString( "EPSG:3857" ); QString uri = QString( mDataDir + "/quad_and_triangle_with_free_vertices.2dm" ); - std::unique_ptr layer = std::make_unique( uri, "quad and triangle", "mdal" ); + auto layer = std::make_unique( uri, "quad and triangle", "mdal" ); layer->setCrs( crs3857 ); QVERIFY( layer->isValid() ); QString rasterUri = QString( mDataDir + "/terrain_under_mesh.tif" ); - std::unique_ptr terrainLayer = std::make_unique( rasterUri, "terrain", "gdal" ); + auto terrainLayer = std::make_unique( rasterUri, "terrain", "gdal" ); terrainLayer->setCrs( crs3857 ); QVERIFY( terrainLayer->isValid() ); - std::unique_ptr terrain = std::make_unique(); + auto terrain = std::make_unique(); terrain->setLayer( terrainLayer.get() ); QgsProject::instance()->elevationProperties()->setTerrainProvider( terrain.release() ); @@ -628,16 +628,16 @@ void TestQgsMapToolEditMesh::testAssignVertexZValueFromTerrainOnButtonClick() crs3857.createFromString( "EPSG:3857" ); QString uri = QString( mDataDir + "/quad_and_triangle_with_free_vertices.2dm" ); - std::unique_ptr layer = std::make_unique( uri, "quad and triangle", "mdal" ); + auto layer = std::make_unique( uri, "quad and triangle", "mdal" ); layer->setCrs( crs3857 ); QVERIFY( layer->isValid() ); QString rasterUri = QString( mDataDir + "/terrain_under_mesh.tif" ); - std::unique_ptr terrainLayer = std::make_unique( rasterUri, "terrain", "gdal" ); + auto terrainLayer = std::make_unique( rasterUri, "terrain", "gdal" ); terrainLayer->setCrs( crs3857 ); QVERIFY( terrainLayer->isValid() ); - std::unique_ptr terrain = std::make_unique(); + auto terrain = std::make_unique(); terrain->setLayer( terrainLayer.get() ); QgsProject::instance()->elevationProperties()->setTerrainProvider( terrain.release() ); @@ -692,7 +692,7 @@ void TestQgsMapToolEditMesh::testAssignVertexZValueFromTerrainOnButtonClick() void TestQgsMapToolEditMesh::selectElements() { QString uri = QString( mDataDir + "/quad_and_triangle_with_free_vertices.2dm" ); - std::unique_ptr layer = std::make_unique( uri, "quad and triangle", "mdal" ); + auto layer = std::make_unique( uri, "quad and triangle", "mdal" ); QVERIFY( layer->isValid() ); const QgsCoordinateTransform transform; @@ -753,7 +753,7 @@ void TestQgsMapToolEditMesh::testDelaunayRefinement() const QString copyDataPath1 = copyTestData( originalDataPath ); // copy of data to be edited - std::unique_ptr layer = std::make_unique( copyDataPath1, "not delaunay", "mdal" ); + auto layer = std::make_unique( copyDataPath1, "not delaunay", "mdal" ); layer->setCrs( crs3857 ); QVERIFY( layer->isValid() ); diff --git a/tests/src/app/testqgsmaptoollabel.cpp b/tests/src/app/testqgsmaptoollabel.cpp index 676a1e9a0594..67f11348f8bc 100644 --- a/tests/src/app/testqgsmaptoollabel.cpp +++ b/tests/src/app/testqgsmaptoollabel.cpp @@ -53,7 +53,7 @@ class TestQgsMapToolLabel : public QObject void testSelectLabel() { - std::unique_ptr vl1 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=text:string" ), QStringLiteral( "vl1" ), QStringLiteral( "memory" ) ); + auto vl1 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=text:string" ), QStringLiteral( "vl1" ), QStringLiteral( "memory" ) ); QVERIFY( vl1->isValid() ); QgsFeature f1; f1.setAttributes( QgsAttributes() << QStringLiteral( "label" ) ); @@ -63,7 +63,7 @@ class TestQgsMapToolLabel : public QObject f1.setAttributes( QgsAttributes() << QStringLiteral( "l" ) ); QVERIFY( vl1->dataProvider()->addFeature( f1 ) ); - std::unique_ptr vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=text:string" ), QStringLiteral( "vl1" ), QStringLiteral( "memory" ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=text:string" ), QStringLiteral( "vl1" ), QStringLiteral( "memory" ) ); QVERIFY( vl2->isValid() ); f1.setGeometry( QgsGeometry::fromPointXY( QgsPointXY( 1, 1 ) ) ); f1.setAttributes( QgsAttributes() << QStringLiteral( "label" ) ); @@ -75,7 +75,7 @@ class TestQgsMapToolLabel : public QObject f1.setAttributes( QgsAttributes() << QStringLiteral( "label3" ) ); QVERIFY( vl2->dataProvider()->addFeature( f1 ) ); - std::unique_ptr canvas = std::make_unique(); + auto canvas = std::make_unique(); canvas->setDestinationCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:3946" ) ) ); canvas->setLayers( QList() << vl1.get() << vl2.get() ); const std::unique_ptr advancedDigitizingDockWidget = std::make_unique( canvas.get() ); @@ -95,7 +95,7 @@ class TestQgsMapToolLabel : public QObject QCOMPARE( canvas->mapSettings().outputSize(), QSize( 500, 500 ) ); QCOMPARE( canvas->mapSettings().visibleExtent(), QgsRectangle( -1, -1, 4, 4 ) ); - std::unique_ptr tool( new QgsMapToolLabel( canvas.get(), advancedDigitizingDockWidget.get() ) ); + auto tool = std::make_unique( canvas.get(), advancedDigitizingDockWidget.get() ); // no labels yet QgsPointXY pt; @@ -241,7 +241,7 @@ class TestQgsMapToolLabel : public QObject f1.setAttributes( QgsAttributes() << QStringLiteral( "center" ) << QStringLiteral( "base" ) ); QVERIFY( vl1->dataProvider()->addFeature( f1 ) ); - std::unique_ptr canvas = std::make_unique(); + auto canvas = std::make_unique(); canvas->setDestinationCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:3946" ) ) ); canvas->setLayers( QList() << vl1 ); const std::unique_ptr advancedDigitizingDockWidget = std::make_unique( canvas.get() ); @@ -261,7 +261,7 @@ class TestQgsMapToolLabel : public QObject QCOMPARE( canvas->mapSettings().outputSize(), QSize( 500, 500 ) ); QCOMPARE( canvas->mapSettings().visibleExtent(), QgsRectangle( -1, -1, 4, 4 ) ); - std::unique_ptr tool( new QgsMapToolLabel( canvas.get(), advancedDigitizingDockWidget.get() ) ); + auto tool = std::make_unique( canvas.get(), advancedDigitizingDockWidget.get() ); // add some labels QgsPalLayerSettings pls1; @@ -385,7 +385,7 @@ class TestQgsMapToolLabel : public QObject f1.setAttributes( QgsAttributes() << QStringLiteral( "center" ) << QStringLiteral( "base" ) ); QVERIFY( vl1->dataProvider()->addFeature( f1 ) ); - std::unique_ptr canvas = std::make_unique(); + auto canvas = std::make_unique(); canvas->setDestinationCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:3946" ) ) ); canvas->setLayers( QList() << vl1 ); const std::unique_ptr advancedDigitizingDockWidget = std::make_unique( canvas.get() ); @@ -405,7 +405,7 @@ class TestQgsMapToolLabel : public QObject QCOMPARE( canvas->mapSettings().outputSize(), QSize( 500, 500 ) ); QCOMPARE( canvas->mapSettings().visibleExtent(), QgsRectangle( -1, -1, 4, 4 ) ); - std::unique_ptr tool( new QgsMapToolLabel( canvas.get(), advancedDigitizingDockWidget.get() ) ); + auto tool = std::make_unique( canvas.get(), advancedDigitizingDockWidget.get() ); // add some labels QgsPalLayerSettings pls1; @@ -480,12 +480,12 @@ class TestQgsMapToolLabel : public QObject QVERIFY( vl1->isValid() ); QgsProject::instance()->addMapLayer( vl1 ); - std::unique_ptr canvas = std::make_unique(); + auto canvas = std::make_unique(); canvas->setDestinationCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:3946" ) ) ); canvas->setLayers( QList() << vl1 ); const std::unique_ptr advancedDigitizingDockWidget = std::make_unique( canvas.get() ); - std::unique_ptr tool( new QgsMapToolLabel( canvas.get(), advancedDigitizingDockWidget.get() ) ); + auto tool = std::make_unique( canvas.get(), advancedDigitizingDockWidget.get() ); QgsExpressionContextUtils::setProjectVariable( QgsProject::instance(), QStringLiteral( "var_1" ), QStringLiteral( "1" ) ); diff --git a/tests/src/app/testqgsmaptoolreshape.cpp b/tests/src/app/testqgsmaptoolreshape.cpp index 4a9cbbcf7153..ae6823880226 100644 --- a/tests/src/app/testqgsmaptoolreshape.cpp +++ b/tests/src/app/testqgsmaptoolreshape.cpp @@ -47,6 +47,7 @@ class TestQgsMapToolReshape : public QObject void testAvoidIntersectionAndTopoEdit(); void reshapeWithBindingLine(); void testWithTracing(); + void testKeepDirection(); private: QgisApp *mQgisApp = nullptr; @@ -57,6 +58,7 @@ class TestQgsMapToolReshape : public QObject QgsVectorLayer *mLayerPolygonZ = nullptr; QgsVectorLayer *mLayerTopo = nullptr; QgsVectorLayer *mLayerTopo2 = nullptr; + QgsVectorLayer *mLayerLine = nullptr; }; TestQgsMapToolReshape::TestQgsMapToolReshape() = default; @@ -106,6 +108,10 @@ void TestQgsMapToolReshape::initTestCase() mLayerTopo2 = new QgsVectorLayer( QStringLiteral( "Polygon?crs=EPSG:3946" ), QStringLiteral( "topo2" ), QStringLiteral( "memory" ) ); QVERIFY( mLayerTopo2->isValid() ); + mLayerLine = new QgsVectorLayer( QStringLiteral( "LineString?crs=EPSG:3946" ), QStringLiteral( "layer line" ), QStringLiteral( "memory" ) ); + QVERIFY( mLayerLine->isValid() ); + QgsProject::instance()->addMapLayers( QList() << mLayerLine ); + mLayerLineZ->startEditing(); const QString wkt1 = "LineString Z (0 0 0, 1 1 0, 1 2 0)"; const QString wkt2 = "LineString Z (2 1 5, 3 3 5)"; @@ -167,6 +173,20 @@ void TestQgsMapToolReshape::initTestCase() QCOMPARE( mLayerTopo2->featureCount(), 1 ); QCOMPARE( mLayerTopo2->getFeature( 1 ).geometry().asWkt(), QStringLiteral( "Polygon ((0 5, 4 5, 4 7, 0 7))" ) ); + mLayerLine->startEditing(); + const QString wkt9 = QStringLiteral( "LineString (0 0, 10 10)" ); + const QString wkt10 = QStringLiteral( "LineString (2 8, 0 6)" ); + const QString wkt11 = QStringLiteral( "LineString (13 0, 13 8, 19 11, 25 8, 25 0, 13 0)" ); // cw oriented linestring ring + QgsFeature f9, f10, f11; + f9.setGeometry( QgsGeometry::fromWkt( wkt9 ) ); + f10.setGeometry( QgsGeometry::fromWkt( wkt10 ) ); + f11.setGeometry( QgsGeometry::fromWkt( wkt11 ) ); + mLayerLine->dataProvider()->addFeatures( QgsFeatureList() << f9 << f10 << f11 ); + QCOMPARE( mLayerLine->featureCount(), ( long ) 3 ); + QCOMPARE( mLayerLine->getFeature( 1 ).geometry().asWkt(), wkt9 ); + QCOMPARE( mLayerLine->getFeature( 2 ).geometry().asWkt(), wkt10 ); + QCOMPARE( mLayerLine->getFeature( 3 ).geometry().asWkt(), wkt11 ); + QgsSnappingConfig cfg = mCanvas->snappingUtils()->config(); cfg.setMode( Qgis::SnappingMode::AllLayers ); cfg.setTolerance( 100 ); @@ -381,7 +401,7 @@ void TestQgsMapToolReshape::testWithTracing() QgsProject::instance()->addMapLayers( QList() << mLayerTopo ); mCanvas->setLayers( QList() << mLayerTopo ); - std::unique_ptr tracer( new QgsMapCanvasTracer( mCanvas, nullptr ) ); + auto tracer = std::make_unique( mCanvas, nullptr ); const bool topologicalEditing = QgsProject::instance()->topologicalEditing(); QgsProject::instance()->setTopologicalEditing( true ); @@ -408,6 +428,57 @@ void TestQgsMapToolReshape::testWithTracing() QgsProject::instance()->setTopologicalEditing( topologicalEditing ); } +void TestQgsMapToolReshape::testKeepDirection() +{ + TestQgsMapToolAdvancedDigitizingUtils utils( mCaptureTool ); + mCanvas->setCurrentLayer( mLayerLine ); + + // no snapping for this test + QgsSnappingConfig cfg = mCanvas->snappingUtils()->config(); + cfg.setEnabled( false ); + mCanvas->snappingUtils()->setConfig( cfg ); + + // intersect linestring 4 times, and go backwards compared to its direction + utils.mouseClick( 9, 8, Qt::LeftButton ); + utils.mouseClick( 9, 10, Qt::LeftButton ); + utils.mouseClick( 8, 9, Qt::LeftButton ); + utils.mouseClick( 8, 7, Qt::LeftButton ); + utils.mouseClick( 7, 6, Qt::LeftButton ); + utils.mouseClick( 7, 8, Qt::LeftButton ); + utils.mouseClick( 6, 7, Qt::LeftButton ); + utils.mouseClick( 6, 5, Qt::LeftButton ); + utils.mouseClick( 6, 5, Qt::RightButton ); + + QString wkt1 = QStringLiteral( "LineString (0 0, 6 6, 6 7, 7 8, 7 7, 7 6, 8 7, 8 8, 8 9, 9 10, 9 9, 10 10)" ); + QCOMPARE( mLayerLine->getFeature( 1 ).geometry().asWkt(), wkt1 ); + + // extend linestring from its start point + utils.mouseClick( 2, 8, Qt::LeftButton ); + utils.mouseClick( 3, 9, Qt::LeftButton ); + utils.mouseClick( 3, 9, Qt::RightButton ); + + QString wkt2 = QStringLiteral( "LineString (3 9, 2 8, 0 6)" ); + QCOMPARE( mLayerLine->getFeature( 2 ).geometry().asWkt(), wkt2 ); + + // intersect linestring ring 4 times, and go backwards compared to its direction + utils.mouseClick( 14, 7, Qt::LeftButton ); + utils.mouseClick( 12, 7, Qt::LeftButton ); + utils.mouseClick( 12, 5, Qt::LeftButton ); + utils.mouseClick( 14, 5, Qt::LeftButton ); + utils.mouseClick( 14, 3, Qt::LeftButton ); + utils.mouseClick( 12, 3, Qt::LeftButton ); + utils.mouseClick( 12, 1, Qt::LeftButton ); + utils.mouseClick( 14, 1, Qt::LeftButton ); + utils.mouseClick( 14, 1, Qt::RightButton ); + + QString wkt3 = QStringLiteral( "LineString (13 1, 12 1, 12 3, 13 3, 14 3, 14 5, 13 5, 12 5, 12 7, 13 7, 13 8, 19 11, 25 8, 25 0, 13 0, 13 1)" ); + QCOMPARE( mLayerLine->getFeature( 3 ).geometry().asWkt(), wkt3 ); + + // activate back snapping + cfg.setEnabled( true ); + mCanvas->snappingUtils()->setConfig( cfg ); +} + QGSTEST_MAIN( TestQgsMapToolReshape ) #include "testqgsmaptoolreshape.moc" diff --git a/tests/src/app/testqgsmaptoolreverseline.cpp b/tests/src/app/testqgsmaptoolreverseline.cpp index 413dba1c66ec..69bb3c0b3e7c 100644 --- a/tests/src/app/testqgsmaptoolreverseline.cpp +++ b/tests/src/app/testqgsmaptoolreverseline.cpp @@ -70,7 +70,7 @@ void TestQgsMapToolReverseLine::cleanupTestCase() void TestQgsMapToolReverseLine::testReverseCurve() { //create a temporary layer - std::unique_ptr memoryLayer( new QgsVectorLayer( QStringLiteral( "LineString?crs=EPSG:3946&field=pk:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto memoryLayer = std::make_unique( QStringLiteral( "LineString?crs=EPSG:3946&field=pk:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( memoryLayer->isValid() ); QgsFeature curve( memoryLayer->dataProvider()->fields(), 1 ); @@ -84,7 +84,7 @@ void TestQgsMapToolReverseLine::testReverseCurve() mCanvas->setLayers( QList() << memoryLayer.get() ); mCanvas->setCurrentLayer( memoryLayer.get() ); - std::unique_ptr tool( new QgsMapToolReverseLine( mCanvas ) ); + auto tool = std::make_unique( mCanvas ); memoryLayer->startEditing(); const QgsPointXY mapPoint = mCanvas->getCoordinateTransform()->transform( 5, 5 ); @@ -106,7 +106,7 @@ void TestQgsMapToolReverseLine::testReverseCurve() void TestQgsMapToolReverseLine::testReverseLineString() { //create a temporary layer - std::unique_ptr memoryLayer( new QgsVectorLayer( QStringLiteral( "LineStringZ?crs=EPSG:3946&field=pk:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto memoryLayer = std::make_unique( QStringLiteral( "LineStringZ?crs=EPSG:3946&field=pk:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( memoryLayer->isValid() ); QgsFeature line( memoryLayer->dataProvider()->fields(), 1 ); @@ -120,7 +120,7 @@ void TestQgsMapToolReverseLine::testReverseLineString() mCanvas->setCurrentLayer( memoryLayer.get() ); - std::unique_ptr tool( new QgsMapToolReverseLine( mCanvas ) ); + auto tool = std::make_unique( mCanvas ); memoryLayer->startEditing(); const QgsPointXY mapPoint = mCanvas->getCoordinateTransform()->transform( 6, 6 ); const std::unique_ptr event( new QgsMapMouseEvent( @@ -143,7 +143,7 @@ void TestQgsMapToolReverseLine::testReverseLineString() void TestQgsMapToolReverseLine::testReverseMultiLineString() { //create a temporary layer - std::unique_ptr memoryLayer( new QgsVectorLayer( QStringLiteral( "MultiLineStringZ?crs=EPSG:3946&field=pk:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto memoryLayer = std::make_unique( QStringLiteral( "MultiLineStringZ?crs=EPSG:3946&field=pk:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( memoryLayer->isValid() ); QgsFeature multi( memoryLayer->dataProvider()->fields(), 1 ); @@ -156,7 +156,7 @@ void TestQgsMapToolReverseLine::testReverseMultiLineString() mCanvas->setLayers( QList() << memoryLayer.get() ); mCanvas->setCurrentLayer( memoryLayer.get() ); - std::unique_ptr tool( new QgsMapToolReverseLine( mCanvas ) ); + auto tool = std::make_unique( mCanvas ); memoryLayer->startEditing(); QgsPointXY mapPoint = mCanvas->getCoordinateTransform()->transform( 6, 6 ); diff --git a/tests/src/app/testqgsmaptoolselect.cpp b/tests/src/app/testqgsmaptoolselect.cpp index 6c3ffd26ef77..7eae43e577a1 100644 --- a/tests/src/app/testqgsmaptoolselect.cpp +++ b/tests/src/app/testqgsmaptoolselect.cpp @@ -106,7 +106,7 @@ void TestQgsMapToolSelect::cleanup() QgsFeatureList TestQgsMapToolSelect::testSelectVector( QgsVectorLayer *layer, double xGeoref, double yGeoref ) { - std::unique_ptr tool( new QgsMapToolSelect( canvas ) ); + auto tool = std::make_unique( canvas ); const QgsPointXY mapPoint = canvas->getCoordinateTransform()->transform( xGeoref, yGeoref ); // make given vector layer current @@ -128,7 +128,7 @@ QgsFeatureList void TestQgsMapToolSelect::selectInvalidPolygons() { //create a temporary layer - std::unique_ptr memoryLayer( new QgsVectorLayer( QStringLiteral( "Polygon?field=pk:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto memoryLayer = std::make_unique( QStringLiteral( "Polygon?field=pk:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( memoryLayer->isValid() ); QgsFeature f1( memoryLayer->dataProvider()->fields(), 1 ); f1.setAttribute( QStringLiteral( "pk" ), 1 ); diff --git a/tests/src/app/testqgsmaptoolsplitfeatures.cpp b/tests/src/app/testqgsmaptoolsplitfeatures.cpp index e3119ec22a56..394eda766dcd 100644 --- a/tests/src/app/testqgsmaptoolsplitfeatures.cpp +++ b/tests/src/app/testqgsmaptoolsplitfeatures.cpp @@ -13,15 +13,14 @@ * * ***************************************************************************/ +#include "qgssnappingutils.h" #include "qgstest.h" #include "qgisapp.h" #include "qgsgeometry.h" #include "qgsmapcanvas.h" -#include "qgssettings.h" #include "qgsvectorlayer.h" #include "qgsmaptoolsplitfeatures.h" -#include "qgsgeometryutils.h" #include "testqgsmaptoolutils.h" diff --git a/tests/src/app/testqgsmaptooltrimextendfeature.cpp b/tests/src/app/testqgsmaptooltrimextendfeature.cpp index 3716e2446619..57e0583dc7e7 100644 --- a/tests/src/app/testqgsmaptooltrimextendfeature.cpp +++ b/tests/src/app/testqgsmaptooltrimextendfeature.cpp @@ -234,7 +234,7 @@ class TestQgsMapToolTrimExtendFeature : public QObject // | + (2,1) | // (0,0) +-------------------+ (3,0) mCanvas->setCurrentLayer( vlPolygon.get() ); - std::unique_ptr tool( new QgsMapToolTrimExtendFeature( mCanvas ) ); + auto tool = std::make_unique( mCanvas ); vlPolygon->startEditing(); // Limit @@ -298,7 +298,7 @@ class TestQgsMapToolTrimExtendFeature : public QObject * | */ mCanvas->setCurrentLayer( vlMultiLine.get() ); - std::unique_ptr tool( new QgsMapToolTrimExtendFeature( mCanvas ) ); + auto tool = std::make_unique( mCanvas ); vlMultiLine->startEditing(); // Limit @@ -450,7 +450,7 @@ class TestQgsMapToolTrimExtendFeature : public QObject (0 5 100) (3 5 5) */ mCanvas->setCurrentLayer( vlLineZ.get() ); - std::unique_ptr tool( new QgsMapToolTrimExtendFeature( mCanvas ) ); + auto tool = std::make_unique( mCanvas ); vlLineZ->startEditing(); // Limit @@ -507,7 +507,7 @@ class TestQgsMapToolTrimExtendFeature : public QObject QgsProject::instance()->setTopologicalEditing( true ); mCanvas->setCurrentLayer( vlTopoEdit.get() ); - std::unique_ptr tool( new QgsMapToolTrimExtendFeature( mCanvas ) ); + auto tool = std::make_unique( mCanvas ); vlTopoLimit->startEditing(); vlTopoEdit->startEditing(); @@ -572,7 +572,7 @@ class TestQgsMapToolTrimExtendFeature : public QObject * + (5, 0) */ mCanvas->setCurrentLayer( vlMultiExtend.get() ); - std::unique_ptr tool( new QgsMapToolTrimExtendFeature( mCanvas ) ); + auto tool = std::make_unique( mCanvas ); vlMultiExtend->startEditing(); // Limit diff --git a/tests/src/app/testqgsmeasuretool.cpp b/tests/src/app/testqgsmeasuretool.cpp index ebbd622b3c6c..a45b4d40021d 100644 --- a/tests/src/app/testqgsmeasuretool.cpp +++ b/tests/src/app/testqgsmeasuretool.cpp @@ -93,8 +93,8 @@ void TestQgsMeasureTool::testLengthCalculationCartesian() QgsProject::instance()->setDistanceUnits( Qgis::DistanceUnit::Meters ); // run length calculation - std::unique_ptr tool( new QgsMeasureTool( mCanvas, false ) ); - std::unique_ptr dlg( new QgsMeasureDialog( tool.get() ) ); + auto tool = std::make_unique( mCanvas, false ); + auto dlg = std::make_unique( tool.get() ); dlg->mCartesian->setChecked( true ); @@ -112,8 +112,8 @@ void TestQgsMeasureTool::testLengthCalculationCartesian() // change project length unit, check calculation respects unit QgsProject::instance()->setDistanceUnits( Qgis::DistanceUnit::Feet ); - std::unique_ptr tool2( new QgsMeasureTool( mCanvas, false ) ); - std::unique_ptr dlg2( new QgsMeasureDialog( tool2.get() ) ); + auto tool2 = std::make_unique( mCanvas, false ); + auto dlg2 = std::make_unique( tool2.get() ); dlg2->mCartesian->setChecked( true ); tool2->restart(); @@ -160,8 +160,8 @@ void TestQgsMeasureTool::testLengthCalculationProjected() QgsProject::instance()->setDistanceUnits( Qgis::DistanceUnit::Meters ); // run length calculation - std::unique_ptr tool( new QgsMeasureTool( mCanvas, false ) ); - std::unique_ptr dlg( new QgsMeasureDialog( tool.get() ) ); + auto tool = std::make_unique( mCanvas, false ); + auto dlg = std::make_unique( tool.get() ); dlg->mEllipsoidal->setChecked( true ); tool->restart(); @@ -178,8 +178,8 @@ void TestQgsMeasureTool::testLengthCalculationProjected() // change project length unit, check calculation respects unit QgsProject::instance()->setDistanceUnits( Qgis::DistanceUnit::Feet ); - std::unique_ptr tool2( new QgsMeasureTool( mCanvas, false ) ); - std::unique_ptr dlg2( new QgsMeasureDialog( tool2.get() ) ); + auto tool2 = std::make_unique( mCanvas, false ); + auto dlg2 = std::make_unique( tool2.get() ); dlg2->mEllipsoidal->setChecked( true ); tool2->restart(); @@ -225,8 +225,8 @@ void TestQgsMeasureTool::testLengthCalculationNoCrs() QgsProject::instance()->setCrs( QgsCoordinateReferenceSystem() ); // run length calculation - std::unique_ptr tool( new QgsMeasureTool( mCanvas, false ) ); - std::unique_ptr dlg( new QgsMeasureDialog( tool.get() ) ); + auto tool = std::make_unique( mCanvas, false ); + auto dlg = std::make_unique( tool.get() ); tool->restart(); tool->addPoint( QgsPointXY( 2484588, 2425722 ) ); @@ -255,8 +255,8 @@ void TestQgsMeasureTool::testAreaCalculationCartesian() QgsProject::instance()->setAreaUnits( Qgis::AreaUnit::SquareMeters ); // run length calculation - std::unique_ptr tool( new QgsMeasureTool( mCanvas, true ) ); - std::unique_ptr dlg( new QgsMeasureDialog( tool.get() ) ); + auto tool = std::make_unique( mCanvas, true ); + auto dlg = std::make_unique( tool.get() ); dlg->mCartesian->setChecked( true ); @@ -276,8 +276,8 @@ void TestQgsMeasureTool::testAreaCalculationCartesian() // change project area unit, check calculation respects unit QgsProject::instance()->setAreaUnits( Qgis::AreaUnit::SquareMiles ); - std::unique_ptr tool2( new QgsMeasureTool( mCanvas, true ) ); - std::unique_ptr dlg2( new QgsMeasureDialog( tool2.get() ) ); + auto tool2 = std::make_unique( mCanvas, true ); + auto dlg2 = std::make_unique( tool2.get() ); dlg2->mCartesian->setChecked( true ); tool2->restart(); @@ -309,8 +309,8 @@ void TestQgsMeasureTool::testAreaCalculationProjected() QgsProject::instance()->setAreaUnits( Qgis::AreaUnit::SquareMeters ); // run length calculation - std::unique_ptr tool( new QgsMeasureTool( mCanvas, true ) ); - std::unique_ptr dlg( new QgsMeasureDialog( tool.get() ) ); + auto tool = std::make_unique( mCanvas, true ); + auto dlg = std::make_unique( tool.get() ); dlg->mEllipsoidal->setChecked( true ); @@ -330,8 +330,8 @@ void TestQgsMeasureTool::testAreaCalculationProjected() // change project area unit, check calculation respects unit QgsProject::instance()->setAreaUnits( Qgis::AreaUnit::SquareMiles ); - std::unique_ptr tool2( new QgsMeasureTool( mCanvas, true ) ); - std::unique_ptr dlg2( new QgsMeasureDialog( tool2.get() ) ); + auto tool2 = std::make_unique( mCanvas, true ); + auto dlg2 = std::make_unique( tool2.get() ); dlg2->mEllipsoidal->setChecked( true ); @@ -358,7 +358,7 @@ void TestQgsMeasureTool::degreeDecimalPlaces() s.setValue( QStringLiteral( "qgis/measure/decimalplaces" ), 3 ); const std::unique_ptr tool( new QgsMeasureTool( mCanvas, true ) ); - std::unique_ptr dlg( new QgsMeasureDialog( tool.get() ) ); + auto dlg = std::make_unique( tool.get() ); QCOMPARE( dlg->formatDistance( 11, false ), QString( "11.000 deg" ) ); QCOMPARE( dlg->formatDistance( 0.005, false ), QString( "0.005 deg" ) ); @@ -378,8 +378,8 @@ void TestQgsMeasureTool::testToolDesactivationNoExtraPoint() QgsProject::instance()->setAreaUnits( Qgis::AreaUnit::SquareMeters ); // run length calculation - std::unique_ptr tool( new QgsMeasureTool( mCanvas, true ) ); - std::unique_ptr dlg( new QgsMeasureDialog( tool.get() ) ); + auto tool = std::make_unique( mCanvas, true ); + auto dlg = std::make_unique( tool.get() ); dlg->mEllipsoidal->setChecked( true ); diff --git a/tests/src/app/testqgsmeshcalculatordialog.cpp b/tests/src/app/testqgsmeshcalculatordialog.cpp index f8aa9035761b..0a746336434a 100644 --- a/tests/src/app/testqgsmeshcalculatordialog.cpp +++ b/tests/src/app/testqgsmeshcalculatordialog.cpp @@ -85,7 +85,7 @@ void TestQgsMeshCalculatorDialog::testCalc() if ( !QgsTest::runFlakyTests() ) QSKIP( "This test is disabled on Travis CI environment" ); - std::unique_ptr dialog( new QgsMeshCalculatorDialog( mpMeshLayer ) ); + auto dialog = std::make_unique( mpMeshLayer ); const int groupCount = mpMeshLayer->dataProvider()->datasetGroupCount(); diff --git a/tests/src/app/testqgsprojectproperties.cpp b/tests/src/app/testqgsprojectproperties.cpp index 1ffefe0ae99a..f2fd4f4791ad 100644 --- a/tests/src/app/testqgsprojectproperties.cpp +++ b/tests/src/app/testqgsprojectproperties.cpp @@ -76,7 +76,7 @@ void TestQgsProjectProperties::cleanupTestCase() void TestQgsProjectProperties::testProjectPropertiesDirty() { // create a temporary layer - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "none?field=code:int&field=regular:string" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "none?field=code:int&field=regular:string" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); // add layer to project, to insure presence of layer-related project settings @@ -100,7 +100,7 @@ void TestQgsProjectProperties::testEllipsoidChange() QgsProject::instance()->setCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:4326" ) ) ); QCOMPARE( QgsProject::instance()->ellipsoid(), QStringLiteral( "NONE" ) ); - std::unique_ptr pp = std::make_unique( mQgisApp->mapCanvas() ); + auto pp = std::make_unique( mQgisApp->mapCanvas() ); pp->apply(); pp.reset(); QCOMPARE( QgsProject::instance()->ellipsoid(), QStringLiteral( "NONE" ) ); @@ -146,7 +146,7 @@ void TestQgsProjectProperties::testEllipsoidCrsSync() QgsProject::instance()->setCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:4326" ) ) ); QCOMPARE( QgsProject::instance()->ellipsoid(), QStringLiteral( "NONE" ) ); - std::unique_ptr pp = std::make_unique( mQgisApp->mapCanvas() ); + auto pp = std::make_unique( mQgisApp->mapCanvas() ); pp->setSelectedCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:3111" ) ) ); pp->apply(); pp.reset(); @@ -203,11 +203,11 @@ void TestQgsProjectProperties::testEllipsoidCrsSync() void TestQgsProjectProperties::testBearingFormat() { QgsProject::instance()->clear(); - std::unique_ptr format = std::make_unique(); + auto format = std::make_unique(); format->setNumberDecimalPlaces( 9 ); QgsProject::instance()->displaySettings()->setBearingFormat( format.release() ); - std::unique_ptr pp = std::make_unique( mQgisApp->mapCanvas() ); + auto pp = std::make_unique( mQgisApp->mapCanvas() ); pp->apply(); QCOMPARE( QgsProject::instance()->displaySettings()->bearingFormat()->numberDecimalPlaces(), 9 ); } @@ -220,7 +220,7 @@ void TestQgsProjectProperties::testTimeSettings() QgsProject::instance()->timeSettings()->setTemporalRange( range ); const QgsDateTimeRange projectRange = QgsProject::instance()->timeSettings()->temporalRange(); - std::unique_ptr projectProperties = std::make_unique( mQgisApp->mapCanvas() ); + auto projectProperties = std::make_unique( mQgisApp->mapCanvas() ); QCOMPARE( projectRange, range ); @@ -258,7 +258,7 @@ void TestQgsProjectProperties::testColorSettings() QCOMPARE( QgsProject::instance()->styleSettings()->colorModel(), Qgis::ColorModel::Rgb ); QVERIFY( !QgsProject::instance()->styleSettings()->colorSpace().isValid() ); - std::unique_ptr pp = std::make_unique( mQgisApp->mapCanvas() ); + auto pp = std::make_unique( mQgisApp->mapCanvas() ); QCOMPARE( static_cast( pp->mColorModel->currentData().toInt() ), Qgis::ColorModel::Rgb ); QVERIFY( !pp->mColorSpace.isValid() ); #if QT_VERSION >= QT_VERSION_CHECK( 6, 8, 0 ) diff --git a/tests/src/app/testqgsvectorlayersaveasdialog.cpp b/tests/src/app/testqgsvectorlayersaveasdialog.cpp index 9a6883af0807..0b31c4fb9689 100644 --- a/tests/src/app/testqgsvectorlayersaveasdialog.cpp +++ b/tests/src/app/testqgsvectorlayersaveasdialog.cpp @@ -69,7 +69,7 @@ void TestQgsVectorLayerSaveAsDialog::cleanupTestCase() void TestQgsVectorLayerSaveAsDialog::testAttributesAsDisplayedValues() { //create a temporary layer - std::unique_ptr tempLayer( new QgsVectorLayer( QStringLiteral( "none?field=code:int&field=regular:string" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto tempLayer = std::make_unique( QStringLiteral( "none?field=code:int&field=regular:string" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( tempLayer->isValid() ); // Assign a custom CRS to the layer diff --git a/tests/src/app/testqgsvertextool.cpp b/tests/src/app/testqgsvertextool.cpp index 66cafc89bb11..02b20b43948b 100644 --- a/tests/src/app/testqgsvertextool.cpp +++ b/tests/src/app/testqgsvertextool.cpp @@ -14,10 +14,10 @@ ***************************************************************************/ #include "qgstest.h" +#include "qgisapp.h" #include "qgsadvanceddigitizingdockwidget.h" #include "qgsgeometry.h" -#include "qgsgeometryoptions.h" #include "qgsgeos.h" #include "qgsmapcanvas.h" #include "qgsmapcanvassnappingutils.h" @@ -25,8 +25,6 @@ #include "qgsvectorlayer.h" #include "qgsmapmouseevent.h" #include "vertextool/qgsvertextool.h" -#include "qgslinestring.h" -#include "qgscircularstring.h" #include "qgssnappingconfig.h" #include "qgssettingsregistrycore.h" #include "testqgsmaptoolutils.h" diff --git a/tests/src/core/geometry/testqgscircle.cpp b/tests/src/core/geometry/testqgscircle.cpp index e76dc8b3f1da..63d6770cc822 100644 --- a/tests/src/core/geometry/testqgscircle.cpp +++ b/tests/src/core/geometry/testqgscircle.cpp @@ -393,7 +393,7 @@ void TestQgsCircle::innerTangents() void TestQgsCircle::toPolygon() { QgsPointSequence pts; - std::unique_ptr pol( new QgsPolygon() ); + auto pol = std::make_unique(); pol.reset( QgsCircle( QgsPoint( 0, 0 ), 5 ).toPolygon( 4 ) ); @@ -413,7 +413,7 @@ void TestQgsCircle::toPolygon() void TestQgsCircle::toPolygonoOriented() { QgsPointSequence pts; - std::unique_ptr pol( new QgsPolygon() ); + auto pol = std::make_unique(); double val = 5 * std::sin( M_PI / 4 ); diff --git a/tests/src/core/geometry/testqgscircularstring.cpp b/tests/src/core/geometry/testqgscircularstring.cpp index e5a5733f185b..ff9b768a6832 100644 --- a/tests/src/core/geometry/testqgscircularstring.cpp +++ b/tests/src/core/geometry/testqgscircularstring.cpp @@ -2370,7 +2370,7 @@ void TestQgsCircularString::append() QVERIFY( cs.isEmpty() ); QCOMPARE( cs.numPoints(), 0 ); - std::unique_ptr toAppend( new QgsCircularString() ); + auto toAppend = std::make_unique(); cs.append( toAppend.get() ); QVERIFY( cs.isEmpty() ); @@ -2428,7 +2428,7 @@ void TestQgsCircularString::appendZM() { //check dimensionality is inherited from append line if initially empty QgsCircularString cs; - std::unique_ptr toAppend( new QgsCircularString() ); + auto toAppend = std::make_unique(); toAppend->setPoints( QgsPointSequence() << QgsPoint( Qgis::WkbType::PointZM, 31, 32, 33, 34 ) << QgsPoint( Qgis::WkbType::PointZM, 41, 42, 43, 44 ) << QgsPoint( Qgis::WkbType::PointZM, 51, 52, 53, 54 ) ); cs.append( toAppend.get() ); diff --git a/tests/src/core/geometry/testqgscurvepolygon.cpp b/tests/src/core/geometry/testqgscurvepolygon.cpp index a0714d5b6bc2..15e094fc36f6 100644 --- a/tests/src/core/geometry/testqgscurvepolygon.cpp +++ b/tests/src/core/geometry/testqgscurvepolygon.cpp @@ -1189,7 +1189,7 @@ void TestQgsCurvePolygon::testBoundingBoxIntersects() QgsCurvePolygon poly1; QVERIFY( !poly1.boundingBoxIntersects( QgsRectangle( 1, 3, 6, 9 ) ) ); - std::unique_ptr ext1( new QgsCircularString() ); + auto ext1 = std::make_unique(); ext1->setPoints( QgsPointSequence() << QgsPoint( 0, 0, 1 ) << QgsPoint( 1, 10, 2 ) << QgsPoint( 0, 18, 3 ) << QgsPoint( -1, 4, 4 ) << QgsPoint( 0, 0, 1 ) ); poly1.setExteriorRing( ext1.release() ); @@ -1200,7 +1200,7 @@ void TestQgsCurvePolygon::testBoundingBoxIntersects() QgsCurvePolygon poly2; QVERIFY( !poly2.boundingBoxIntersects( QgsBox3D( 1, 3, 1, 6, 9, 2 ) ) ); - std::unique_ptr ext2( new QgsCircularString() ); + auto ext2 = std::make_unique(); ext2->setPoints( QgsPointSequence() << QgsPoint( 0, 0, 1 ) << QgsPoint( 1, 10, 2 ) << QgsPoint( 0, 18, 3 ) << QgsPoint( -1, 4, 4 ) << QgsPoint( 0, 0, 1 ) ); poly2.setExteriorRing( ext2.release() ); diff --git a/tests/src/core/geometry/testqgsellipse.cpp b/tests/src/core/geometry/testqgsellipse.cpp index db58860b284e..8c46e69ab4a4 100644 --- a/tests/src/core/geometry/testqgsellipse.cpp +++ b/tests/src/core/geometry/testqgsellipse.cpp @@ -362,7 +362,7 @@ void TestQgsEllipse::toString() void TestQgsEllipse::toLineString() { - std::unique_ptr ls( new QgsLineString() ); + auto ls = std::make_unique(); ls.reset( QgsEllipse( QgsPoint( 0, 0 ), 5, 2, 0 ).toLineString( 2 ) ); QVERIFY( ls->isEmpty() ); // segments too low @@ -379,7 +379,7 @@ void TestQgsEllipse::toLineString() void TestQgsEllipse::toPolygon() { - std::unique_ptr poly( new QgsPolygon() ); + auto poly = std::make_unique(); poly.reset( QgsEllipse( QgsPoint( 0, 0 ), 5, 2, 0 ).toPolygon( 2 ) ); QVERIFY( poly->isEmpty() ); // segments too low diff --git a/tests/src/core/geometry/testqgslinestring.cpp b/tests/src/core/geometry/testqgslinestring.cpp index ade85da7e638..06642f532e13 100644 --- a/tests/src/core/geometry/testqgslinestring.cpp +++ b/tests/src/core/geometry/testqgslinestring.cpp @@ -755,7 +755,7 @@ void TestQgsLineString::gettersSetters() void TestQgsLineString::appendWithZM() { QgsLineString ls; - std::unique_ptr toAppend( new QgsLineString() ); + auto toAppend = std::make_unique(); //check dimensionality is inherited from append line if initially empty toAppend.reset( new QgsLineString() ); @@ -840,7 +840,7 @@ void TestQgsLineString::append() QVERIFY( ls.isEmpty() ); QCOMPARE( ls.numPoints(), 0 ); - std::unique_ptr toAppend( new QgsLineString() ); + auto toAppend = std::make_unique(); toAppend->setPoints( QgsPointSequence() << QgsPoint( 1, 2 ) << QgsPoint( 11, 12 ) << QgsPoint( 21, 22 ) ); ls.append( toAppend.get() ); @@ -2151,7 +2151,7 @@ void TestQgsLineString::boundingBox() QCOMPARE( ls.boundingBox(), QgsRectangle( -6, -15, -4, -9 ) ); //append - std::unique_ptr toAppend( new QgsLineString() ); + auto toAppend = std::make_unique(); toAppend->setPoints( QgsPointSequence() << QgsPoint( 1, 2 ) << QgsPoint( 4, 0 ) ); ls.append( toAppend.get() ); diff --git a/tests/src/core/geometry/testqgspolyhedralsurface.cpp b/tests/src/core/geometry/testqgspolyhedralsurface.cpp index 6a1e96c7bc2d..401cdf8ec6fe 100644 --- a/tests/src/core/geometry/testqgspolyhedralsurface.cpp +++ b/tests/src/core/geometry/testqgspolyhedralsurface.cpp @@ -85,7 +85,7 @@ void TestQgsPolyhedralSurface::testConstructor() QVERIFY( !polySurfaceEmpty.patchN( 0 ) ); - std::unique_ptr multiPolygon = std::make_unique(); + auto multiPolygon = std::make_unique(); QgsPolygon part; QgsLineString ring; ring.setPoints( QgsPointSequence() << QgsPoint( Qgis::WkbType::PointZM, 5, 50, 1, 4 ) << QgsPoint( Qgis::WkbType::PointZM, 6, 61, 3, 5 ) << QgsPoint( Qgis::WkbType::PointZM, 9, 71, 4, 15 ) << QgsPoint( Qgis::WkbType::PointZM, 5, 71, 4, 6 ) ); diff --git a/tests/src/core/geometry/testqgsregularpolygon.cpp b/tests/src/core/geometry/testqgsregularpolygon.cpp index 662cc27097d1..b68ebd47668d 100644 --- a/tests/src/core/geometry/testqgsregularpolygon.cpp +++ b/tests/src/core/geometry/testqgsregularpolygon.cpp @@ -239,7 +239,7 @@ void TestQgsRegularPolygon::conversions() QVERIFY( toP->isEmpty() ); QgsPointSequence ptsPol; - std::unique_ptr pol( new QgsPolygon() ); + auto pol = std::make_unique(); pol.reset( rp.toPolygon() ); QCOMPARE( pol->numInteriorRings(), 0 ); diff --git a/tests/src/core/geometry/testqgstriangle.cpp b/tests/src/core/geometry/testqgstriangle.cpp index 34d950a11d2b..03660b0d66a8 100644 --- a/tests/src/core/geometry/testqgstriangle.cpp +++ b/tests/src/core/geometry/testqgstriangle.cpp @@ -220,7 +220,7 @@ void TestQgsTriangle::exteriorRing() QVERIFY( !tr.interiorRing( 0 ) ); QCOMPARE( tr.wkbType(), Qgis::WkbType::Triangle ); - std::unique_ptr ext( new QgsLineString() ); + auto ext = std::make_unique(); ext->setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 10 ) << QgsPoint( 10, 10 ) << QgsPoint( 0, 0 ) ); QVERIFY( ext->isClosed() ); @@ -340,7 +340,7 @@ void TestQgsTriangle::invalidExteriorRing() QgsTriangle tr; // invalid exterior ring - std::unique_ptr ext( new QgsLineString() ); + auto ext = std::make_unique(); ext->setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 10 ) << QgsPoint( 10, 10 ) << QgsPoint( 5, 10 ) ); tr.setExteriorRing( ext.release() ); @@ -374,7 +374,7 @@ void TestQgsTriangle::invalidNumberOfPoints() { QgsTriangle tr; - std::unique_ptr ext( new QgsLineString() ); + auto ext = std::make_unique(); ext->setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 10 ) ); tr.setExteriorRing( ext.release() ); @@ -393,7 +393,7 @@ void TestQgsTriangle::nonClosedRing() QgsTriangle tr; // a non closed exterior ring will be automatically closed - std::unique_ptr ext( new QgsLineString() ); + auto ext = std::make_unique(); ext->setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 10 ) << QgsPoint( 10, 10 ) ); QVERIFY( !ext->isClosed() ); @@ -418,7 +418,7 @@ void TestQgsTriangle::conversion() { QgsTriangle tr; - std::unique_ptr ext( new QgsLineString() ); + auto ext = std::make_unique(); ext->setPoints( QgsPointSequence() << QgsPoint( Qgis::WkbType::PointZM, 0, 0, 1, 5 ) << QgsPoint( Qgis::WkbType::PointZM, 0, 10, 2, 6 ) << QgsPoint( Qgis::WkbType::PointZM, 10, 10, 3, 7 ) ); tr.setExteriorRing( ext.release() ); @@ -463,7 +463,7 @@ void TestQgsTriangle::toFromWkt() { QgsTriangle tr; - std::unique_ptr ext( new QgsLineString() ); + auto ext = std::make_unique(); ext->setPoints( QgsPointSequence() << QgsPoint( Qgis::WkbType::PointZM, 0, 0, 1, 5 ) << QgsPoint( Qgis::WkbType::PointZM, 0, 10, 2, 6 ) << QgsPoint( Qgis::WkbType::PointZM, 10, 10, 3, 7 ) ); tr.setExteriorRing( ext.release() ); @@ -541,7 +541,7 @@ void TestQgsTriangle::toFromWkb() // WKB M // tWKB=QgsTriangle (QgsPoint(0,0, 5), QgsPoint(0, 10, 6), QgsPoint(10, 10, 7)); will produce a TriangleZ - std::unique_ptr ext( new QgsLineString() ); + auto ext = std::make_unique(); ext->setPoints( QgsPointSequence() << QgsPoint( Qgis::WkbType::PointM, 0, 0, 0, 5 ) << QgsPoint( Qgis::WkbType::PointM, 0, 10, 0, 6 ) << QgsPoint( Qgis::WkbType::PointM, 10, 10, 0, 7 ) ); tWKB.setExteriorRing( ext.release() ); @@ -736,7 +736,7 @@ void TestQgsTriangle::deleteVertex() { QgsTriangle tr( QgsPoint( 0, 0 ), QgsPoint( 100, 100 ), QgsPoint( 0, 200 ) ); - std::unique_ptr ring( new QgsLineString() ); + auto ring = std::make_unique(); ring->setPoints( QgsPointSequence() << QgsPoint( 5, 5 ) << QgsPoint( 50, 50 ) << QgsPoint( 0, 25 ) << QgsPoint( 5, 5 ) ); tr.addInteriorRing( ring.release() ); diff --git a/tests/src/core/testqgis.cpp b/tests/src/core/testqgis.cpp index cc08d4439744..3ec96f59f2bb 100644 --- a/tests/src/core/testqgis.cpp +++ b/tests/src/core/testqgis.cpp @@ -191,7 +191,7 @@ void TestQgis::doubleToString() void TestQgis::signalBlocker() { - std::unique_ptr checkbox( new QCheckBox() ); + auto checkbox = std::make_unique(); QSignalSpy spy( checkbox.get(), &QCheckBox::toggled ); diff --git a/tests/src/core/testqgscallout.cpp b/tests/src/core/testqgscallout.cpp index fe0fcafdbd5f..c12eed1dfb5d 100644 --- a/tests/src/core/testqgscallout.cpp +++ b/tests/src/core/testqgscallout.cpp @@ -441,7 +441,7 @@ void TestQgsCallout::calloutsInLayout() { //test rendering callouts inside a layout (tests DPI scaling of callouts) QgsLayout l( QgsProject::instance() ); - std::unique_ptr page = std::make_unique( &l ); + auto page = std::make_unique( &l ); page->setPageSize( QgsLayoutSize( 50, 50 ) ); l.pageCollection()->addPage( page.release() ); @@ -1785,7 +1785,7 @@ void TestQgsCallout::calloutBehindIndividualLabels() void TestQgsCallout::calloutNoDrawToAllParts() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "MultiPoint?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "MultiPoint?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QgsMarkerSymbol *marker = static_cast( QgsSymbol::defaultSymbol( Qgis::GeometryType::Point ) ); marker->setColor( QColor( 255, 0, 0 ) ); marker->setSize( 3 ); @@ -1853,7 +1853,7 @@ void TestQgsCallout::calloutNoDrawToAllParts() void TestQgsCallout::calloutDrawToAllParts() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "MultiPoint?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "MultiPoint?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QgsMarkerSymbol *marker = static_cast( QgsSymbol::defaultSymbol( Qgis::GeometryType::Point ) ); marker->setColor( QColor( 255, 0, 0 ) ); marker->setSize( 3 ); @@ -1922,7 +1922,7 @@ void TestQgsCallout::calloutDrawToAllParts() void TestQgsCallout::calloutDataDefinedDrawToAllParts() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "MultiPoint?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "MultiPoint?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QgsMarkerSymbol *marker = static_cast( QgsSymbol::defaultSymbol( Qgis::GeometryType::Point ) ); marker->setColor( QColor( 255, 0, 0 ) ); marker->setSize( 3 ); @@ -1991,7 +1991,7 @@ void TestQgsCallout::calloutDataDefinedDrawToAllParts() void TestQgsCallout::calloutPointOnExterior() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Polygon?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Polygon?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QgsFillSymbol *fill = static_cast( QgsSymbol::defaultSymbol( Qgis::GeometryType::Polygon ) ); fill->setColor( QColor( 255, 0, 0 ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( fill ) ); @@ -2054,7 +2054,7 @@ void TestQgsCallout::calloutPointOnExterior() void TestQgsCallout::calloutDataDefinedAnchorPoint() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Polygon?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Polygon?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QgsFillSymbol *fill = static_cast( QgsSymbol::defaultSymbol( Qgis::GeometryType::Polygon ) ); fill->setColor( QColor( 255, 0, 0 ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( fill ) ); @@ -2117,7 +2117,7 @@ void TestQgsCallout::calloutDataDefinedAnchorPoint() void TestQgsCallout::calloutDataDefinedDestination() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Polygon?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Polygon?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QgsFillSymbol *fill = static_cast( QgsSymbol::defaultSymbol( Qgis::GeometryType::Polygon ) ); fill->setColor( QColor( 255, 0, 0 ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( fill ) ); @@ -2182,7 +2182,7 @@ void TestQgsCallout::calloutDataDefinedDestination() void TestQgsCallout::calloutDataDefinedOrigin() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Polygon?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Polygon?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QgsFillSymbol *fill = static_cast( QgsSymbol::defaultSymbol( Qgis::GeometryType::Polygon ) ); fill->setColor( QColor( 255, 0, 0 ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( fill ) ); @@ -2352,7 +2352,7 @@ void TestQgsCallout::manhattanRotated() void TestQgsCallout::manhattanNoDrawToAllParts() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "MultiPoint?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "MultiPoint?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QgsMarkerSymbol *marker = static_cast( QgsSymbol::defaultSymbol( Qgis::GeometryType::Point ) ); marker->setColor( QColor( 255, 0, 0 ) ); marker->setSize( 3 ); @@ -2420,7 +2420,7 @@ void TestQgsCallout::manhattanNoDrawToAllParts() void TestQgsCallout::manhattanDrawToAllParts() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "MultiPoint?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "MultiPoint?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QgsMarkerSymbol *marker = static_cast( QgsSymbol::defaultSymbol( Qgis::GeometryType::Point ) ); marker->setColor( QColor( 255, 0, 0 ) ); marker->setSize( 3 ); @@ -2489,7 +2489,7 @@ void TestQgsCallout::manhattanDrawToAllParts() void TestQgsCallout::manhattanDataDefinedDrawToAllParts() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "MultiPoint?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "MultiPoint?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QgsMarkerSymbol *marker = static_cast( QgsSymbol::defaultSymbol( Qgis::GeometryType::Point ) ); marker->setColor( QColor( 255, 0, 0 ) ); marker->setSize( 3 ); @@ -2558,7 +2558,7 @@ void TestQgsCallout::manhattanDataDefinedDrawToAllParts() void TestQgsCallout::manhattanDataDefinedDestination() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Polygon?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Polygon?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QgsFillSymbol *fill = static_cast( QgsSymbol::defaultSymbol( Qgis::GeometryType::Polygon ) ); fill->setColor( QColor( 255, 0, 0 ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( fill ) ); @@ -2623,7 +2623,7 @@ void TestQgsCallout::manhattanDataDefinedDestination() void TestQgsCallout::manhattanDataDefinedOrigin() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Polygon?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Polygon?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QgsFillSymbol *fill = static_cast( QgsSymbol::defaultSymbol( Qgis::GeometryType::Polygon ) ); fill->setColor( QColor( 255, 0, 0 ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( fill ) ); @@ -2688,7 +2688,7 @@ void TestQgsCallout::manhattanDataDefinedOrigin() void TestQgsCallout::curvedAutoLeavingLabelsAtBottomLeft() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -2788,7 +2788,7 @@ void TestQgsCallout::curvedAutoLeavingLabelsAtBottomLeft() void TestQgsCallout::curvedAutoLeavingLabelsAtBottomRight() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -2888,7 +2888,7 @@ void TestQgsCallout::curvedAutoLeavingLabelsAtBottomRight() void TestQgsCallout::curvedAutoLeavingLabelsAtTopLeft() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -2988,7 +2988,7 @@ void TestQgsCallout::curvedAutoLeavingLabelsAtTopLeft() void TestQgsCallout::curvedAutoLeavingLabelsAtTopRight() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -3088,7 +3088,7 @@ void TestQgsCallout::curvedAutoLeavingLabelsAtTopRight() void TestQgsCallout::curvedAutoLeavingLabelsAtTop() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -3188,7 +3188,7 @@ void TestQgsCallout::curvedAutoLeavingLabelsAtTop() void TestQgsCallout::curvedAutoLeavingLabelsAtBottom() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -3288,7 +3288,7 @@ void TestQgsCallout::curvedAutoLeavingLabelsAtBottom() void TestQgsCallout::curvedAutoLeavingLabelsAtLeft() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -3388,7 +3388,7 @@ void TestQgsCallout::curvedAutoLeavingLabelsAtLeft() void TestQgsCallout::curvedAutoLeavingLabelsAtRight() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -3488,7 +3488,7 @@ void TestQgsCallout::curvedAutoLeavingLabelsAtRight() void TestQgsCallout::curvedAutoHorizontalLines() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -3557,7 +3557,7 @@ void TestQgsCallout::curvedAutoHorizontalLines() void TestQgsCallout::curvedAutoVerticalLines() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -3626,7 +3626,7 @@ void TestQgsCallout::curvedAutoVerticalLines() void TestQgsCallout::curvedClockwise() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -3726,7 +3726,7 @@ void TestQgsCallout::curvedClockwise() void TestQgsCallout::curvedCounterClockwise() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -3826,7 +3826,7 @@ void TestQgsCallout::curvedCounterClockwise() void TestQgsCallout::curvedCurvature() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=id:integer&field=labelx:integer&field=labely:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -4200,7 +4200,7 @@ void TestQgsCallout::balloonCalloutMarkerSymbol() void TestQgsCallout::blendMode() { - std::unique_ptr callout = std::make_unique(); + auto callout = std::make_unique(); QCOMPARE( callout->containsAdvancedEffects(), false ); callout->setBlendMode( QPainter::CompositionMode_Multiply ); diff --git a/tests/src/core/testqgsclipper.cpp b/tests/src/core/testqgsclipper.cpp index d09931bc92d3..48eaf9769fee 100644 --- a/tests/src/core/testqgsclipper.cpp +++ b/tests/src/core/testqgsclipper.cpp @@ -191,7 +191,7 @@ bool TestQgsClipper::checkBoundingBox( const QPolygonF &polygon, const QgsRectan void TestQgsClipper::epsg4978LineRendering() { - std::unique_ptr layerLines = std::make_unique( QString( TEST_DATA_DIR ) + "/3d/earth_size_sphere_4978.gpkg", "lines", "ogr" ); + auto layerLines = std::make_unique( QString( TEST_DATA_DIR ) + "/3d/earth_size_sphere_4978.gpkg", "lines", "ogr" ); QgsLineSymbol *fillSymbol = new QgsLineSymbol(); fillSymbol->setWidth( 0.5 ); diff --git a/tests/src/core/testqgscolorschemeregistry.cpp b/tests/src/core/testqgscolorschemeregistry.cpp index cb254599f172..90b3631c15c4 100644 --- a/tests/src/core/testqgscolorschemeregistry.cpp +++ b/tests/src/core/testqgscolorschemeregistry.cpp @@ -204,7 +204,7 @@ void TestQgsColorSchemeRegistry::matchingSchemes() void TestQgsColorSchemeRegistry::fetchRandomStyleColor() { - std::unique_ptr registry = std::make_unique(); + auto registry = std::make_unique(); // no randomStyleColorScheme set - test lots of colors to make sure their valid for ( int i = 0; i < 10000; ++i ) diff --git a/tests/src/core/testqgscompositionconverter.cpp b/tests/src/core/testqgscompositionconverter.cpp index 056b0f5e3255..4eb4d5c9521f 100644 --- a/tests/src/core/testqgscompositionconverter.cpp +++ b/tests/src/core/testqgscompositionconverter.cpp @@ -584,7 +584,7 @@ void TestQgsCompositionConverter::convertCompositionTemplate() //qDebug() << layoutDoc; QCOMPARE( layoutDoc.elementsByTagName( QStringLiteral( "Layout" ) ).count(), 1 ); - std::unique_ptr layout = std::make_unique( &project ); + auto layout = std::make_unique( &project ); QgsReadWriteContext context; context.setPathResolver( project.pathResolver() ); layout->readXml( layoutDoc.elementsByTagName( QStringLiteral( "Layout" ) ).at( 0 ).toElement(), layoutDoc, context ); diff --git a/tests/src/core/testqgscoordinatereferencesystem.cpp b/tests/src/core/testqgscoordinatereferencesystem.cpp index 912577d5eeb5..2c5370d2ee90 100644 --- a/tests/src/core/testqgscoordinatereferencesystem.cpp +++ b/tests/src/core/testqgscoordinatereferencesystem.cpp @@ -1672,7 +1672,6 @@ void TestQgsCoordinateReferenceSystem::isDynamic() void TestQgsCoordinateReferenceSystem::celestialBody() { -#if ( PROJ_VERSION_MAJOR > 8 || ( PROJ_VERSION_MAJOR == 8 && PROJ_VERSION_MINOR >= 1 ) ) QgsCoordinateReferenceSystem crs; QCOMPARE( crs.celestialBodyName(), QString() ); @@ -1681,7 +1680,6 @@ void TestQgsCoordinateReferenceSystem::celestialBody() crs = QgsCoordinateReferenceSystem( QStringLiteral( "ESRI:104903" ) ); QCOMPARE( crs.celestialBodyName(), QStringLiteral( "Moon" ) ); -#endif } void TestQgsCoordinateReferenceSystem::operation() diff --git a/tests/src/core/testqgscoordinatetransform.cpp b/tests/src/core/testqgscoordinatetransform.cpp index d73357d96fce..76964a81881c 100644 --- a/tests/src/core/testqgscoordinatetransform.cpp +++ b/tests/src/core/testqgscoordinatetransform.cpp @@ -312,13 +312,11 @@ void TestQgsCoordinateTransform::constructorFlags() QVERIFY( !tr4.isShortCircuited() ); QVERIFY( tr4.mIgnoreImpossible ); -#if ( PROJ_VERSION_MAJOR > 8 || ( PROJ_VERSION_MAJOR == 8 && PROJ_VERSION_MINOR >= 1 ) ) QgsCoordinateTransform tr5( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:4326" ) ), QgsCoordinateReferenceSystem( QStringLiteral( "ESRI:104903" ) ), QgsProject::instance(), Qgis::CoordinateTransformationFlag::IgnoreImpossibleTransformations ); QVERIFY( !tr5.mBallparkTransformsAreAppropriate ); // crses are from two different celestial bodies, the transform is impossible and should be short-circuited QVERIFY( tr5.isShortCircuited() ); QVERIFY( tr5.mIgnoreImpossible ); -#endif } void TestQgsCoordinateTransform::scaleFactor_data() @@ -611,21 +609,11 @@ void TestQgsCoordinateTransform::transformBoundingBox() QgsCoordinateTransform tr( sourceSrs, destSrs, QgsProject::instance() ); const QgsRectangle crossingRect( 6374985, -3626584, 7021195, -3272435 ); QgsRectangle resultRect = tr.transformBoundingBox( crossingRect, Qgis::TransformDirection::Forward, true ); - QgsRectangle expectedRect; - expectedRect.setXMinimum( 175.771 ); - expectedRect.setYMinimum( -39.7222 ); - expectedRect.setXMaximum( -176.549 ); - expectedRect.setYMaximum( -36.3951 ); - - qDebug( "BBox transform x min: %.17f", resultRect.xMinimum() ); - qDebug( "BBox transform x max: %.17f", resultRect.xMaximum() ); - qDebug( "BBox transform y min: %.17f", resultRect.yMinimum() ); - qDebug( "BBox transform y max: %.17f", resultRect.yMaximum() ); - - QGSCOMPARENEAR( resultRect.xMinimum(), expectedRect.xMinimum(), 0.001 ); - QGSCOMPARENEAR( resultRect.yMinimum(), expectedRect.yMinimum(), 0.001 ); - QGSCOMPARENEAR( resultRect.xMaximum(), expectedRect.xMaximum(), 0.001 ); - QGSCOMPARENEAR( resultRect.yMaximum(), expectedRect.yMaximum(), 0.001 ); + + QGSCOMPARENEAR( resultRect.xMinimum(), 175.771, 0.001 ); + QGSCOMPARENEAR( resultRect.yMinimum(), -39.7222, 0.001 ); + QGSCOMPARENEAR( resultRect.xMaximum(), -176.549, 0.001 ); + QGSCOMPARENEAR( resultRect.yMaximum(), -36.3951, 0.001 ); // test transforming a bounding box, resulting in an invalid transform - exception must be thrown tr = QgsCoordinateTransform( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:4326" ) ), QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:28356" ) ), QgsProject::instance() ); @@ -848,10 +836,8 @@ void TestQgsCoordinateTransform::testTransformationIsPossible() QVERIFY( !QgsCoordinateTransform::isTransformationPossible( QgsCoordinateReferenceSystem(), QgsCoordinateReferenceSystem() ) ); QVERIFY( QgsCoordinateTransform::isTransformationPossible( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:3857" ) ), QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:4326" ) ) ) ); -#if ( PROJ_VERSION_MAJOR > 8 || ( PROJ_VERSION_MAJOR == 8 && PROJ_VERSION_MINOR >= 1 ) ) // crses from two different celestial bodies => transformation is not possible QVERIFY( !QgsCoordinateTransform::isTransformationPossible( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:4326" ) ), QgsCoordinateReferenceSystem( QStringLiteral( "ESRI:104903" ) ) ) ); -#endif } diff --git a/tests/src/core/testqgsdataitem.cpp b/tests/src/core/testqgsdataitem.cpp index 696b6090e077..9baede4c7b79 100644 --- a/tests/src/core/testqgsdataitem.cpp +++ b/tests/src/core/testqgsdataitem.cpp @@ -119,7 +119,7 @@ void TestQgsDataItem::testValid() void TestQgsDataItem::testDirItem() { - std::unique_ptr dirItem = std::make_unique( nullptr, QStringLiteral( "Test" ), TEST_DATA_DIR ); + auto dirItem = std::make_unique( nullptr, QStringLiteral( "Test" ), TEST_DATA_DIR ); QCOMPARE( dirItem->dirPath(), QStringLiteral( TEST_DATA_DIR ) ); QCOMPARE( dirItem->name(), QStringLiteral( "Test" ) ); @@ -215,7 +215,7 @@ void TestQgsDataItem::testDirItemMonitoring() QVERIFY( QDir().mkpath( child1 ) ); QVERIFY( QDir().mkpath( child2 ) ); - std::unique_ptr dirItem = std::make_unique( nullptr, QStringLiteral( "parent name" ), parentDir, parentDir + '/' ); + auto dirItem = std::make_unique( nullptr, QStringLiteral( "parent name" ), parentDir, parentDir + '/' ); QCOMPARE( dirItem->path(), parentDir + '/' ); QCOMPARE( dirItem->dirPath(), parentDir ); @@ -383,7 +383,7 @@ void TestQgsDataItem::testDirItemMonitoringSlowDrive() QVERIFY( !QgsDirectoryItem::pathShouldByMonitoredByDefault( child2 ) ); QVERIFY( !QgsDirectoryItem::pathShouldByMonitoredByDefault( child2child ) ); - std::unique_ptr dirItem = std::make_unique( nullptr, QStringLiteral( "parent name" ), parentDir, QStringLiteral( "/" ) + parentDir ); + auto dirItem = std::make_unique( nullptr, QStringLiteral( "parent name" ), parentDir, QStringLiteral( "/" ) + parentDir ); // user has not explicitly set the path to be monitored or not, so Default should be returned here: QCOMPARE( dirItem->monitoring(), Qgis::BrowserDirectoryMonitoring::Default ); // but directory should NOT be monitored diff --git a/tests/src/core/testqgsdiagram.cpp b/tests/src/core/testqgsdiagram.cpp index 57a5bbf78437..4b94e2f4a3d3 100644 --- a/tests/src/core/testqgsdiagram.cpp +++ b/tests/src/core/testqgsdiagram.cpp @@ -1120,7 +1120,7 @@ class TestQgsDiagram : public QgsTest void testClipping() { const QString filename = QStringLiteral( TEST_DATA_DIR ) + "/lines.shp"; - std::unique_ptr vl2( new QgsVectorLayer( filename, QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ) ); + auto vl2 = std::make_unique( filename, QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ); QVariantMap props; props.insert( QStringLiteral( "outline_color" ), QStringLiteral( "#487bb6" ) ); diff --git a/tests/src/core/testqgsdxfexport.cpp b/tests/src/core/testqgsdxfexport.cpp index eab2d4bf8819..fe8e80c1a5e7 100644 --- a/tests/src/core/testqgsdxfexport.cpp +++ b/tests/src/core/testqgsdxfexport.cpp @@ -224,7 +224,7 @@ void TestQgsDxfExport::testPoints() QVERIFY( !fileContainsText( file, QStringLiteral( "nan.0" ) ) ); // reload and compare - std::unique_ptr result = std::make_unique( file, "dxf" ); + auto result = std::make_unique( file, "dxf" ); QVERIFY( result->isValid() ); QCOMPARE( result->featureCount(), mPointLayer->featureCount() ); QCOMPARE( result->wkbType(), Qgis::WkbType::Point ); @@ -311,7 +311,7 @@ void TestQgsDxfExport::testPointsOverriddenName() QVERIFY( !fileContainsText( file, mPointLayer->name() ) ); // "points" // reload and compare - std::unique_ptr result = std::make_unique( file, "dxf" ); + auto result = std::make_unique( file, "dxf" ); QVERIFY( result->isValid() ); QCOMPARE( result->featureCount(), mPointLayer->featureCount() ); QCOMPARE( result->wkbType(), Qgis::WkbType::Point ); @@ -342,7 +342,7 @@ void TestQgsDxfExport::testLines() dxfFile.close(); // reload and compare - std::unique_ptr result = std::make_unique( file, "dxf" ); + auto result = std::make_unique( file, "dxf" ); QVERIFY( result->isValid() ); QCOMPARE( result->featureCount(), mLineLayer->featureCount() ); QCOMPARE( result->wkbType(), Qgis::WkbType::LineString ); @@ -370,7 +370,7 @@ void TestQgsDxfExport::testPolygons() dxfFile.close(); // reload and compare - std::unique_ptr result = std::make_unique( file, "dxf" ); + auto result = std::make_unique( file, "dxf" ); QVERIFY( result->isValid() ); QCOMPARE( result->featureCount(), 12L ); QCOMPARE( result->wkbType(), Qgis::WkbType::LineString ); @@ -379,7 +379,7 @@ void TestQgsDxfExport::testPolygons() void TestQgsDxfExport::testMultiSurface() { QgsDxfExport d; - std::unique_ptr vl = std::make_unique( QStringLiteral( "MultiSurface" ), QString(), QStringLiteral( "memory" ) ); + auto vl = std::make_unique( QStringLiteral( "MultiSurface" ), QString(), QStringLiteral( "memory" ) ); const QgsGeometry g = QgsGeometry::fromWkt( "MultiSurface (Polygon ((0 0, 0 1, 1 1, 0 0)))" ); QgsFeature f; f.setGeometry( g ); @@ -403,7 +403,7 @@ void TestQgsDxfExport::testMultiSurface() dxfFile.close(); // reload and compare - std::unique_ptr result = std::make_unique( file, "dxf" ); + auto result = std::make_unique( file, "dxf" ); QVERIFY( result->isValid() ); QCOMPARE( result->featureCount(), 1L ); QCOMPARE( result->wkbType(), Qgis::WkbType::LineString ); @@ -414,13 +414,13 @@ void TestQgsDxfExport::testMultiSurface() void TestQgsDxfExport::testMapTheme() { - std::unique_ptr vl = std::make_unique( QStringLiteral( "LineString?crs=epsg:2056" ), QString(), QStringLiteral( "memory" ) ); + auto vl = std::make_unique( QStringLiteral( "LineString?crs=epsg:2056" ), QString(), QStringLiteral( "memory" ) ); const QgsGeometry g = QgsGeometry::fromWkt( "LineString(2600000 1280000, 2680000 1280000, 2680000 1285000, 2600000 1285000, 2600000 1280000)" ); QgsFeature f; f.setGeometry( g ); vl->dataProvider()->addFeatures( QgsFeatureList() << f ); - std::unique_ptr symbolLayer = std::make_unique( QColor( 0, 255, 0 ) ); + auto symbolLayer = std::make_unique( QColor( 0, 255, 0 ) ); symbolLayer->setWidth( 0.11 ); QgsLineSymbol *symbol = new QgsLineSymbol(); symbol->changeSymbolLayer( 0, symbolLayer.release() ); @@ -709,7 +709,7 @@ void TestQgsDxfExport::testText() void TestQgsDxfExport::testTextAngle() { - std::unique_ptr vl = std::make_unique( QStringLiteral( "Point?crs=epsg:2056&field=ori:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); + auto vl = std::make_unique( QStringLiteral( "Point?crs=epsg:2056&field=ori:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); const QgsGeometry g = QgsGeometry::fromWkt( "Point(2684679.392 1292182.527)" ); const QgsGeometry g2 = QgsGeometry::fromWkt( "Point(2684692.322 1292192.534)" ); QgsFeature f( vl->fields() ); @@ -820,7 +820,7 @@ void TestQgsDxfExport::testTextAlign() format.setColor( QColor( 200, 0, 200 ) ); settings.setFormat( format ); - std::unique_ptr vl = std::make_unique( QStringLiteral( "Point?crs=epsg:2056&field=text:string" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); + auto vl = std::make_unique( QStringLiteral( "Point?crs=epsg:2056&field=text:string" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); const QgsGeometry g = QgsGeometry::fromWkt( "Point(2684679.392 1292182.527)" ); QgsFeature f( vl->fields() ); f.setGeometry( g ); @@ -964,7 +964,7 @@ void TestQgsDxfExport::testTextQuadrant() format.setColor( QColor( 200, 0, 200 ) ); settings.setFormat( format ); - std::unique_ptr vl = std::make_unique( QStringLiteral( "Point?crs=epsg:2056&field=text:string" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); + auto vl = std::make_unique( QStringLiteral( "Point?crs=epsg:2056&field=text:string" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); const QgsGeometry g = QgsGeometry::fromWkt( "Point(2685025.687 1292145.297)" ); QgsFeature f( vl->fields() ); f.setGeometry( g ); @@ -1134,7 +1134,7 @@ void TestQgsDxfExport::testCurveExport() QFETCH( QString, dxfText ); QgsDxfExport d; - std::unique_ptr vl = std::make_unique( wktType, QString(), QStringLiteral( "memory" ) ); + auto vl = std::make_unique( wktType, QString(), QStringLiteral( "memory" ) ); const QgsGeometry g = QgsGeometry::fromWkt( wkt ); QgsFeature f; f.setGeometry( g ); @@ -1262,7 +1262,7 @@ void TestQgsDxfExport::testCurveExport_data() void TestQgsDxfExport::testDashedLine() { - std::unique_ptr symbolLayer = std::make_unique( QColor( 0, 0, 0 ) ); + auto symbolLayer = std::make_unique( QColor( 0, 0, 0 ) ); symbolLayer->setWidth( 0.11 ); symbolLayer->setCustomDashVector( { 0.5, 0.35 } ); symbolLayer->setCustomDashPatternUnit( Qgis::RenderUnit::MapUnits ); @@ -1271,7 +1271,7 @@ void TestQgsDxfExport::testDashedLine() QgsLineSymbol *symbol = new QgsLineSymbol(); symbol->changeSymbolLayer( 0, symbolLayer.release() ); - std::unique_ptr vl = std::make_unique( QStringLiteral( "CompoundCurve?crs=epsg:2056" ), QString(), QStringLiteral( "memory" ) ); + auto vl = std::make_unique( QStringLiteral( "CompoundCurve?crs=epsg:2056" ), QString(), QStringLiteral( "memory" ) ); const QgsGeometry g = QgsGeometry::fromWkt( "CompoundCurve ((2689563.84200000017881393 1283531.23699999996460974, 2689563.42499999981373549 1283537.55499999993480742, 2689563.19900000002235174 1283540.52399999997578561, 2689562.99800000013783574 1283543.42999999993480742, 2689562.66900000022724271 1283548.56000000005587935, 2689562.43399999989196658 1283555.287999999942258))" ); QgsFeature f; f.setGeometry( g ); @@ -1384,7 +1384,7 @@ void TestQgsDxfExport::testDashedLine() void TestQgsDxfExport::testTransform() { - std::unique_ptr symbolLayer = std::make_unique( QColor( 0, 0, 0 ) ); + auto symbolLayer = std::make_unique( QColor( 0, 0, 0 ) ); symbolLayer->setWidth( 0.11 ); symbolLayer->setCustomDashVector( { 0.5, 0.35 } ); symbolLayer->setCustomDashPatternUnit( Qgis::RenderUnit::MapUnits ); @@ -1393,7 +1393,7 @@ void TestQgsDxfExport::testTransform() QgsLineSymbol *symbol = new QgsLineSymbol(); symbol->changeSymbolLayer( 0, symbolLayer.release() ); - std::unique_ptr vl = std::make_unique( QStringLiteral( "Linestring?crs=epsg:2056" ), QString(), QStringLiteral( "memory" ) ); + auto vl = std::make_unique( QStringLiteral( "Linestring?crs=epsg:2056" ), QString(), QStringLiteral( "memory" ) ); QgsGeometry g = QgsGeometry::fromWkt( QStringLiteral( "LineString (2689564.82757076947018504 1283554.68540272791869938, 2689565.52996697928756475 1283531.49185784510336816)" ) ); QgsFeature f; f.setGeometry( g ); @@ -1424,7 +1424,7 @@ void TestQgsDxfExport::testTransform() QCOMPARE( d.writeToFile( &dxfFile, QStringLiteral( "CP1252" ) ), QgsDxfExport::ExportResult::Success ); dxfFile.close(); - std::unique_ptr result = std::make_unique( file, QStringLiteral( "res" ) ); + auto result = std::make_unique( file, QStringLiteral( "res" ) ); QVERIFY( result->isValid() ); QCOMPARE( result->featureCount(), 2L ); QgsFeature f2; @@ -1451,7 +1451,7 @@ void TestQgsDxfExport::testTransform() void TestQgsDxfExport::testDataDefinedPoints() { - std::unique_ptr symbolLayer = std::make_unique( Qgis::MarkerShape::Circle, 2.0 ); + auto symbolLayer = std::make_unique( Qgis::MarkerShape::Circle, 2.0 ); QgsPropertyCollection properties; properties.setProperty( QgsSymbolLayer::Property::Size, QgsProperty::fromExpression( "200" ) ); symbolLayer->setDataDefinedProperties( properties ); @@ -1459,7 +1459,7 @@ void TestQgsDxfExport::testDataDefinedPoints() QgsMarkerSymbol *symbol = new QgsMarkerSymbol(); symbol->changeSymbolLayer( 0, symbolLayer.release() ); - std::unique_ptr vl = std::make_unique( QStringLiteral( "Point?crs=epsg:2056" ), QString(), QStringLiteral( "memory" ) ); + auto vl = std::make_unique( QStringLiteral( "Point?crs=epsg:2056" ), QString(), QStringLiteral( "memory" ) ); const QgsGeometry g1 = QgsGeometry::fromWkt( "POINT (2000000 1000000)" ); QgsFeature f1; f1.setGeometry( g1 ); @@ -1543,7 +1543,7 @@ void TestQgsDxfExport::testExtent() dxfFile1.close(); // reload and compare - std::unique_ptr result = std::make_unique( file1, "dxf" ); + auto result = std::make_unique( file1, "dxf" ); QVERIFY( result->isValid() ); QCOMPARE( result->featureCount(), 1L ); QCOMPARE( result->wkbType(), Qgis::WkbType::LineString ); @@ -1586,7 +1586,7 @@ void TestQgsDxfExport::testSelectedPoints() QVERIFY( !fileContainsText( file, QStringLiteral( "nan.0" ) ) ); // reload and compare - std::unique_ptr result = std::make_unique( file, "dxf" ); + auto result = std::make_unique( file, "dxf" ); QVERIFY( result->isValid() ); QCOMPARE( result->featureCount(), mPointLayer->selectedFeatureCount() ); QCOMPARE( result->wkbType(), Qgis::WkbType::Point ); @@ -1637,7 +1637,7 @@ void TestQgsDxfExport::testSelectedLines() dxfFile.close(); // reload and compare - std::unique_ptr result = std::make_unique( file, "dxf" ); + auto result = std::make_unique( file, "dxf" ); QVERIFY( result->isValid() ); QCOMPARE( result->featureCount(), mLineLayer->selectedFeatureCount() ); QCOMPARE( result->wkbType(), Qgis::WkbType::LineString ); @@ -1686,7 +1686,7 @@ void TestQgsDxfExport::testSelectedPolygons() dxfFile.close(); // reload and compare - std::unique_ptr result = std::make_unique( file, "dxf" ); + auto result = std::make_unique( file, "dxf" ); QVERIFY( result->isValid() ); QCOMPARE( result->featureCount(), 8L ); QCOMPARE( result->wkbType(), Qgis::WkbType::LineString ); @@ -1743,7 +1743,7 @@ void TestQgsDxfExport::testMultipleLayersWithSelection() QVERIFY( !fileContainsText( file, QStringLiteral( "nan.0" ) ) ); // reload and compare - std::unique_ptr result = std::make_unique( file, "dxf" ); + auto result = std::make_unique( file, "dxf" ); QVERIFY( result->isValid() ); QStringList subLayers = result->dataProvider()->subLayers(); QCOMPARE( subLayers.count(), 2 ); @@ -1803,7 +1803,7 @@ void TestQgsDxfExport::testExtentWithSelection() dxfFile.close(); // reload and compare - std::unique_ptr result = std::make_unique( file, "dxf" ); + auto result = std::make_unique( file, "dxf" ); QVERIFY( result->isValid() ); QCOMPARE( result->featureCount(), 3L ); // 4 in extent, 8 selected, 17 in total QCOMPARE( result->wkbType(), Qgis::WkbType::Point ); @@ -1851,7 +1851,7 @@ void TestQgsDxfExport::testOutputLayerNamePrecedence() QVERIFY( !fileContainsText( file, mPointLayer->name() ) ); // reload and compare - std::unique_ptr result = std::make_unique( file, "dxf" ); + auto result = std::make_unique( file, "dxf" ); QVERIFY( result->isValid() ); QCOMPARE( result->featureCount(), mPointLayer->featureCount() ); QCOMPARE( result->wkbType(), Qgis::WkbType::Point ); diff --git a/tests/src/core/testqgsexpression.cpp b/tests/src/core/testqgsexpression.cpp index 4b912f9e2747..5e54ee90ec10 100644 --- a/tests/src/core/testqgsexpression.cpp +++ b/tests/src/core/testqgsexpression.cpp @@ -5634,7 +5634,7 @@ class TestQgsExpression : public QObject // prepare the expression using static variables QgsExpressionContext context; - std::unique_ptr scope = std::make_unique(); + auto scope = std::make_unique(); scope->setVariable( QStringLiteral( "field_name_part_var" ), QStringLiteral( "field" ), true ); // this feature gets added as a static variable, to emulate eg the @atlas_feature variable diff --git a/tests/src/core/testqgsexpressioncontext.cpp b/tests/src/core/testqgsexpressioncontext.cpp index 6709fa22db3b..18422243f051 100644 --- a/tests/src/core/testqgsexpressioncontext.cpp +++ b/tests/src/core/testqgsexpressioncontext.cpp @@ -841,7 +841,7 @@ void TestQgsExpressionContext::layerScope() layerScope = nullptr; //create a map layer - std::unique_ptr vectorLayer( new QgsVectorLayer( QStringLiteral( "Point?field=col1:integer&field=col2:integer&field=col3:integer" ), QStringLiteral( "test layer" ), QStringLiteral( "memory" ) ) ); + auto vectorLayer = std::make_unique( QStringLiteral( "Point?field=col1:integer&field=col2:integer&field=col3:integer" ), QStringLiteral( "test layer" ), QStringLiteral( "memory" ) ); QgsExpressionContext context; context << QgsExpressionContextUtils::layerScope( vectorLayer.get() ); @@ -1010,7 +1010,7 @@ void TestQgsExpressionContext::layerStores() QVERIFY( scope1->layerStores().isEmpty() ); QgsMapLayerStore store1; - std::unique_ptr store2 = std::make_unique(); + auto store2 = std::make_unique(); scope1->addLayerStore( &store1 ); scope1->addLayerStore( store2.get() ); QCOMPARE( scope1->layerStores(), QList( { &store1, store2.get() } ) ); diff --git a/tests/src/core/testqgsfield.cpp b/tests/src/core/testqgsfield.cpp index 8e5e8f7c9c16..b88ac69bb074 100644 --- a/tests/src/core/testqgsfield.cpp +++ b/tests/src/core/testqgsfield.cpp @@ -81,7 +81,7 @@ void TestQgsField::cleanup() void TestQgsField::create() { - std::unique_ptr field( new QgsField( QStringLiteral( "name" ), QMetaType::Type::Double, QStringLiteral( "double" ), 5, 2, QStringLiteral( "comment" ) ) ); + auto field = std::make_unique( QStringLiteral( "name" ), QMetaType::Type::Double, QStringLiteral( "double" ), 5, 2, QStringLiteral( "comment" ) ); QCOMPARE( field->name(), QString( "name" ) ); QCOMPARE( field->type(), QMetaType::Type::Double ); QCOMPARE( field->typeName(), QString( "double" ) ); diff --git a/tests/src/core/testqgsgdalprovider.cpp b/tests/src/core/testqgsgdalprovider.cpp index 140246e6645d..8c6321a0a764 100644 --- a/tests/src/core/testqgsgdalprovider.cpp +++ b/tests/src/core/testqgsgdalprovider.cpp @@ -962,7 +962,7 @@ void TestQgsGdalProvider::testVsiCredentialOptions() // if actual aws dataset proves flaky, use this instead: // std::unique_ptr< QgsRasterLayer > rl = std::make_unique< QgsRasterLayer >( QStringLiteral( "/vsis3/testbucket/test|credential:AWS_NO_SIGN_REQUEST=YES|credential:AWS_REGION=eu-central-1|credential:AWS_S3_ENDPOINT=localhost" ), QStringLiteral( "test" ), QStringLiteral( "gdal" ) ); - std::unique_ptr rl = std::make_unique( QStringLiteral( "/vsis3/cdn.proj.org/us_nga_egm96_15.tif|credential:AWS_NO_SIGN_REQUEST=YES" ), QStringLiteral( "test" ), QStringLiteral( "gdal" ) ); + auto rl = std::make_unique( QStringLiteral( "/vsis3/cdn.proj.org/us_nga_egm96_15.tif|credential:AWS_NO_SIGN_REQUEST=YES" ), QStringLiteral( "test" ), QStringLiteral( "gdal" ) ); // confirm that GDAL VSI configuration options are set QString noSign( VSIGetPathSpecificOption( "/vsis3/cdn.proj.org", "AWS_NO_SIGN_REQUEST", nullptr ) ); @@ -979,7 +979,7 @@ void TestQgsGdalProvider::testVsiCredentialOptions() QCOMPARE( region, QString() ); // credentials should be bucket specific - std::unique_ptr rl2 = std::make_unique( QStringLiteral( "/vsis3/another/subfolder/subfolder2/test|credential:AWS_NO_SIGN_REQUEST=NO|credential:AWS_REGION=eu-central-2|credential:AWS_S3_ENDPOINT=localhost" ), QStringLiteral( "test" ), QStringLiteral( "gdal" ) ); + auto rl2 = std::make_unique( QStringLiteral( "/vsis3/another/subfolder/subfolder2/test|credential:AWS_NO_SIGN_REQUEST=NO|credential:AWS_REGION=eu-central-2|credential:AWS_S3_ENDPOINT=localhost" ), QStringLiteral( "test" ), QStringLiteral( "gdal" ) ); noSign = QString( VSIGetPathSpecificOption( "/vsis3/cdn.proj.org", "AWS_NO_SIGN_REQUEST", nullptr ) ); QCOMPARE( noSign, QStringLiteral( "YES" ) ); region = QString( VSIGetPathSpecificOption( "/vsis3/cdn.proj.org", "AWS_REGION", nullptr ) ); diff --git a/tests/src/core/testqgsgdalutils.cpp b/tests/src/core/testqgsgdalutils.cpp index 45a6779ac627..b008214855ec 100644 --- a/tests/src/core/testqgsgdalutils.cpp +++ b/tests/src/core/testqgsgdalutils.cpp @@ -154,7 +154,7 @@ void TestQgsGdalUtils::testCreateSingleBandTiffDataset() QVERIFY( QFile::exists( filename ) ); - std::unique_ptr layer( new QgsRasterLayer( filename, "test", "gdal" ) ); + auto layer = std::make_unique( filename, "test", "gdal" ); QVERIFY( layer->isValid() ); QCOMPARE( layer->extent(), QgsRectangle( 1, 1, 21, 11 ) ); QCOMPARE( layer->width(), 40 ); @@ -178,7 +178,7 @@ void TestQgsGdalUtils::testResampleSingleBandRaster() QgsGdalUtils::resampleSingleBandRaster( srcDS.get(), dstDS.get(), GRA_NearestNeighbour, nullptr ); dstDS.reset(); - std::unique_ptr layer( new QgsRasterLayer( outputFilename, "test", "gdal" ) ); + auto layer = std::make_unique( outputFilename, "test", "gdal" ); QVERIFY( layer ); std::unique_ptr block( layer->dataProvider()->block( 1, outputExtent, 2, 2 ) ); QVERIFY( block ); diff --git a/tests/src/core/testqgsgeopdfexport.cpp b/tests/src/core/testqgsgeopdfexport.cpp index e81dc03b9f3b..0b3be6bda25b 100644 --- a/tests/src/core/testqgsgeopdfexport.cpp +++ b/tests/src/core/testqgsgeopdfexport.cpp @@ -114,7 +114,7 @@ void TestQgsGeospatialPdfExport::testCollectingFeatures() QCOMPARE( component.mapLayerId, QStringLiteral( "layer1" ) ); QCOMPARE( component.name, QStringLiteral( "name layer1" ) ); // check that temporary layers were correctly written - std::unique_ptr layer = std::make_unique( QStringLiteral( "%1|layerName=%2" ).arg( component.sourceVectorPath, component.sourceVectorLayer ), QStringLiteral( "layer" ), QStringLiteral( "ogr" ) ); + auto layer = std::make_unique( QStringLiteral( "%1|layerName=%2" ).arg( component.sourceVectorPath, component.sourceVectorLayer ), QStringLiteral( "layer" ), QStringLiteral( "ogr" ) ); QVERIFY( layer->isValid() ); QCOMPARE( layer->featureCount(), 2L ); QCOMPARE( layer->wkbType(), Qgis::WkbType::Polygon ); diff --git a/tests/src/core/testqgshttpheaders.cpp b/tests/src/core/testqgshttpheaders.cpp index 9c2df3cc20ec..a47fc9654e85 100644 --- a/tests/src/core/testqgshttpheaders.cpp +++ b/tests/src/core/testqgshttpheaders.cpp @@ -272,7 +272,8 @@ void TestQgsHttpheaders::updateSetDomElement() QDomElement element = doc.createElement( "qgs" ); // === update QgsHttpHeaders h( QVariantMap( { { QStringLiteral( "key1" ), "value1" }, { QgsHttpHeaders::KEY_REFERER, "my_ref" } } ) ); - h.updateDomElement( element ); + QMap namespaceDeclarations; + h.updateDomElement( element, namespaceDeclarations ); QVERIFY( element.hasAttribute( QgsHttpHeaders::PARAM_PREFIX + "key1" ) ); QCOMPARE( element.attribute( QgsHttpHeaders::PARAM_PREFIX + "key1" ), "value1" ); @@ -284,6 +285,8 @@ void TestQgsHttpheaders::updateSetDomElement() QVERIFY( element.hasAttribute( QgsHttpHeaders::KEY_REFERER ) ); QCOMPARE( element.attribute( QgsHttpHeaders::KEY_REFERER ), "my_ref" ); + QCOMPARE( namespaceDeclarations["http-header"], "https://qgis.org/http-header" ); + // === setFrom QgsHttpHeaders h2; element.setAttribute( QgsHttpHeaders::KEY_REFERER, "my_ref_root" ); // overwrite root ref to ckeck backward compatibility diff --git a/tests/src/core/testqgsinvertedpolygonrenderer.cpp b/tests/src/core/testqgsinvertedpolygonrenderer.cpp index f20bb5aaa25b..9e7d3dafba34 100644 --- a/tests/src/core/testqgsinvertedpolygonrenderer.cpp +++ b/tests/src/core/testqgsinvertedpolygonrenderer.cpp @@ -141,7 +141,7 @@ void TestQgsInvertedPolygon::projectionTest() void TestQgsInvertedPolygon::projectionWithSimplificationTest() { - std::unique_ptr polyLayer = std::make_unique( testDataPath( "polys.shp" ), QStringLiteral( "polys" ) ); + auto polyLayer = std::make_unique( testDataPath( "polys.shp" ), QStringLiteral( "polys" ) ); QVERIFY( polyLayer->isValid() ); QgsMapSettings mapSettings; mapSettings.setDestinationCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:4326" ) ) ); diff --git a/tests/src/core/testqgslabelingengine.cpp b/tests/src/core/testqgslabelingengine.cpp index e6a224a2c5aa..e9341ebb9a19 100644 --- a/tests/src/core/testqgslabelingengine.cpp +++ b/tests/src/core/testqgslabelingengine.cpp @@ -123,6 +123,7 @@ class TestQgsLabelingEngine : public QgsTest void parallelOverrun(); void testDataDefinedLabelAllParts(); void testDataDefinedPlacementPositionPoint(); + void testDataDefinedLabelTabs(); void testVerticalOrientation(); void testVerticalOrientationLetterLineSpacing(); void testRotationBasedOrientationPoint(); @@ -913,7 +914,7 @@ void TestQgsLabelingEngine::testRegisterFeatureUnprojectible() settings.isExpression = true; settings.fitInPolygonOnly = true; - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "polygon?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "polygon?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QgsVectorLayerLabelProvider *provider = new QgsVectorLayerLabelProvider( vl2.get(), QStringLiteral( "test" ), true, &settings ); QgsFeature f( vl2->fields(), 1 ); @@ -956,7 +957,7 @@ void TestQgsLabelingEngine::testRotateHidePartial() settings.isExpression = true; settings.placement = Qgis::LabelPlacement::OverPoint; - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "polygon?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "polygon?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsVectorLayerLabelProvider *provider = new QgsVectorLayerLabelProvider( vl2.get(), QStringLiteral( "test" ), true, &settings ); @@ -1032,7 +1033,7 @@ void TestQgsLabelingEngine::testParallelLabelSmallFeature() settings.isExpression = true; settings.placement = Qgis::LabelPlacement::Line; - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "linestring?crs=epsg:3148&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "linestring?crs=epsg:3148&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsVectorLayerLabelProvider *provider = new QgsVectorLayerLabelProvider( vl2.get(), QStringLiteral( "test" ), true, &settings ); @@ -1101,7 +1102,7 @@ void TestQgsLabelingEngine::testAllowDegradedPlacements() // start without degraded placement -- no label should be shown settings.placementSettings().setAllowDegradedPlacement( false ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "linestring?crs=epsg:3148&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "linestring?crs=epsg:3148&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsVectorLayerLabelProvider *provider = new QgsVectorLayerLabelProvider( vl2.get(), QStringLiteral( "test" ), true, &settings ); @@ -1179,7 +1180,7 @@ void TestQgsLabelingEngine::testOverlapHandling() settings.placement = Qgis::LabelPlacement::OrderedPositionsAroundPoint; settings.priority = 5; - std::unique_ptr vl1( new QgsVectorLayer( QStringLiteral( "point?crs=epsg:3148&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl1 = std::make_unique( QStringLiteral( "point?crs=epsg:3148&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl1->setRenderer( new QgsSingleSymbolRenderer( QgsMarkerSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0 }, { QStringLiteral( "outline_style" ), QStringLiteral( "no" ) } } ) ) ); QgsVectorLayerLabelProvider *provider = new QgsVectorLayerLabelProvider( vl1.get(), QStringLiteral( "test" ), true, &settings ); @@ -1196,7 +1197,7 @@ void TestQgsLabelingEngine::testOverlapHandling() settings.pointSettings().setQuadrant( Qgis::LabelQuadrantPosition::AboveLeft ); settings.priority = 10; - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "point?crs=epsg:3148&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "point?crs=epsg:3148&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsMarkerSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#ff0000" ) }, { QStringLiteral( "outline_width" ), 0 }, { QStringLiteral( "outline_style" ), QStringLiteral( "no" ) } } ) ) ); QgsVectorLayerLabelProvider *provider2 = new QgsVectorLayerLabelProvider( vl2.get(), QStringLiteral( "test" ), true, &settings ); @@ -1342,7 +1343,7 @@ void TestQgsLabelingEngine::testAllowOverlapsIgnoresObstacles() settings.pointSettings().setQuadrant( Qgis::LabelQuadrantPosition::AboveRight ); settings.priority = 2; - std::unique_ptr vl1( new QgsVectorLayer( QStringLiteral( "point?crs=epsg:3148&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl1 = std::make_unique( QStringLiteral( "point?crs=epsg:3148&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl1->setRenderer( new QgsSingleSymbolRenderer( QgsMarkerSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0 }, { QStringLiteral( "outline_style" ), QStringLiteral( "no" ) } } ) ) ); QgsVectorLayerLabelProvider *provider = new QgsVectorLayerLabelProvider( vl1.get(), QStringLiteral( "test" ), true, &settings ); @@ -1359,7 +1360,7 @@ void TestQgsLabelingEngine::testAllowOverlapsIgnoresObstacles() settings.obstacleSettings().setIsObstacle( true ); settings.obstacleSettings().setFactor( 10 ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "point?crs=epsg:3148&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "point?crs=epsg:3148&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsMarkerSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#ff0000" ) }, { QStringLiteral( "outline_width" ), 0 }, { QStringLiteral( "outline_style" ), QStringLiteral( "no" ) } } ) ) ); QgsVectorLayerLabelProvider *provider2 = new QgsVectorLayerLabelProvider( vl2.get(), QStringLiteral( "test" ), true, &settings ); @@ -1446,7 +1447,7 @@ void TestQgsLabelingEngine::testAdjacentParts() settings.placement = Qgis::LabelPlacement::OverPoint; settings.labelPerPart = true; - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Polygon?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Polygon?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -1501,7 +1502,7 @@ void TestQgsLabelingEngine::testTouchingParts() // if treated individually, none of these parts are long enough for the label to fit -- but the label should be rendered if the mergeLines setting is true, // because the parts should be merged into a single linestring - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "MultiLineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "MultiLineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -1557,7 +1558,7 @@ void TestQgsLabelingEngine::testMergingLinesWithForks() settings.lineSettings().setMergeLines( true ); // if treated individually, none of these parts are long enough for the label to fit -- but the label should be rendered if the mergeLines setting is true - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -1624,7 +1625,7 @@ void TestQgsLabelingEngine::testMergingLinesWithMinimumSize() settings.thinningSettings().setMinimumFeatureSize( 90.0 ); // if treated individually, none of these parts exceed the minimum feature size set above -- but the label should be rendered if the mergeLines setting is true - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -1687,7 +1688,7 @@ void TestQgsLabelingEngine::testPointLabelTabs() settings.placement = Qgis::LabelPlacement::OverPoint; settings.labelPerPart = false; - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -1741,7 +1742,7 @@ void TestQgsLabelingEngine::testPointLabelTabsHtml() settings.placement = Qgis::LabelPlacement::OverPoint; settings.labelPerPart = false; - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -1794,7 +1795,7 @@ void TestQgsLabelingEngine::testPointLabelHtmlFormatting() settings.placement = Qgis::LabelPlacement::OverPoint; settings.labelPerPart = false; - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -1848,7 +1849,7 @@ void TestQgsLabelingEngine::testPointLabelHtmlFormattingDataDefinedSize() settings.placement = Qgis::LabelPlacement::OverPoint; settings.labelPerPart = false; - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -1901,7 +1902,7 @@ void TestQgsLabelingEngine::testPointLabelHtmlImages() settings.placement = Qgis::LabelPlacement::OverPoint; settings.labelPerPart = false; - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -1958,7 +1959,7 @@ void TestQgsLabelingEngine::testCurvedLabelsHtmlSuperSubscript() settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::AboveLine | Qgis::LabelLinePlacementFlag::MapOrientation ); settings.lineSettings().setAnchorTextPoint( QgsLabelLineSettings::AnchorTextPoint::CenterOfText ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -2014,7 +2015,7 @@ void TestQgsLabelingEngine::testCurvedLabelsHtmlWordSpacing() settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::AboveLine | Qgis::LabelLinePlacementFlag::MapOrientation ); settings.lineSettings().setAnchorTextPoint( QgsLabelLineSettings::AnchorTextPoint::CenterOfText ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -2071,7 +2072,7 @@ void TestQgsLabelingEngine::testCurvedLabelsTabs() settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::AboveLine | Qgis::LabelLinePlacementFlag::MapOrientation ); settings.lineSettings().setAnchorTextPoint( QgsLabelLineSettings::AnchorTextPoint::CenterOfText ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -2128,7 +2129,7 @@ void TestQgsLabelingEngine::testCurvedLabelsTabPositions() settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::AboveLine | Qgis::LabelLinePlacementFlag::MapOrientation ); settings.lineSettings().setAnchorTextPoint( QgsLabelLineSettings::AnchorTextPoint::CenterOfText ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -2184,7 +2185,7 @@ void TestQgsLabelingEngine::testCurvedLabelsHtmlFormatting() settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::AboveLine | Qgis::LabelLinePlacementFlag::MapOrientation ); settings.lineSettings().setAnchorTextPoint( QgsLabelLineSettings::AnchorTextPoint::CenterOfText ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -2239,7 +2240,7 @@ void TestQgsLabelingEngine::testCurvedPerimeterLabelsHtmlFormatting() settings.maxCurvedCharAngleOut = 45; settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::BelowLine ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Polygon?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Polygon?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -2289,7 +2290,7 @@ void TestQgsLabelingEngine::testCurvedLabelsWithTinySegments() settings.isExpression = true; settings.placement = Qgis::LabelPlacement::Curved; - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -2348,7 +2349,7 @@ void TestQgsLabelingEngine::testCurvedLabelCorrectLinePlacement() settings.maxCurvedCharAngleIn = 99; settings.maxCurvedCharAngleOut = 99; - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -2414,7 +2415,7 @@ void TestQgsLabelingEngine::testCurvedLabelNegativeDistance() settings.labelPerPart = false; settings.dist = -5; - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -2467,7 +2468,7 @@ void TestQgsLabelingEngine::testCurvedLabelOnSmallLineNearCenter() settings.placement = Qgis::LabelPlacement::Curved; settings.labelPerPart = false; - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -2519,7 +2520,7 @@ void TestQgsLabelingEngine::testCurvedLabelLineOrientationAbove() settings.labelPerPart = false; settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::AboveLine ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -2584,7 +2585,7 @@ void TestQgsLabelingEngine::testCurvedLabelLineOrientationBelow() settings.labelPerPart = false; settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::BelowLine ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -2653,7 +2654,7 @@ void TestQgsLabelingEngine::testCurvedLabelAllowUpsideDownAbove() settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::Strict ); settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::AboveLine | Qgis::LabelLinePlacementFlag::MapOrientation ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -2721,7 +2722,7 @@ void TestQgsLabelingEngine::testCurvedLabelAllowUpsideDownBelow() settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::BelowLine | Qgis::LabelLinePlacementFlag::MapOrientation ); settings.lineSettings().setAnchorTextPoint( QgsLabelLineSettings::AnchorTextPoint::CenterOfText ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -2790,7 +2791,7 @@ void TestQgsLabelingEngine::testCurvedLabelAllowUpsideDownAbovePositiveOffset() settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::Strict ); settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::AboveLine | Qgis::LabelLinePlacementFlag::MapOrientation ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -2858,7 +2859,7 @@ void TestQgsLabelingEngine::testCurvedLabelAllowUpsideDownAboveNegativeOffset() settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::Strict ); settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::AboveLine | Qgis::LabelLinePlacementFlag::MapOrientation ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -2925,7 +2926,7 @@ void TestQgsLabelingEngine::testCurvedLabelAllowUpsideDownLeftPositiveOffset() settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::Strict ); settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::AboveLine ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -2993,7 +2994,7 @@ void TestQgsLabelingEngine::testCurvedLabelAllowUpsideDownLeftNegativeOffset() settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::Strict ); settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::AboveLine ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -3060,7 +3061,7 @@ void TestQgsLabelingEngine::testCurvedLabelAllowUpsideDownRightPositiveOffset() settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::Strict ); settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::BelowLine ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -3128,7 +3129,7 @@ void TestQgsLabelingEngine::testCurvedLabelAllowUpsideDownRightNegativeOffset() settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::Strict ); settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::BelowLine ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -3194,7 +3195,7 @@ void TestQgsLabelingEngine::testCurvedLabelAllowUpsideDownHintAbove() settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::HintOnly ); settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::AboveLine | Qgis::LabelLinePlacementFlag::MapOrientation ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -3260,7 +3261,7 @@ void TestQgsLabelingEngine::testCurvedLabelAllowUpsideDownHintBelow() settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::BelowLine | Qgis::LabelLinePlacementFlag::MapOrientation ); settings.lineSettings().setAnchorTextPoint( QgsLabelLineSettings::AnchorTextPoint::CenterOfText ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -3327,7 +3328,7 @@ void TestQgsLabelingEngine::testCurvedLabelAllowUpsideDownHintAbovePositiveOffse settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::HintOnly ); settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::AboveLine | Qgis::LabelLinePlacementFlag::MapOrientation ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -3395,7 +3396,7 @@ void TestQgsLabelingEngine::testCurvedLabelAllowUpsideDownHintAboveNegativeOffse settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::HintOnly ); settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::AboveLine | Qgis::LabelLinePlacementFlag::MapOrientation ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -3462,7 +3463,7 @@ void TestQgsLabelingEngine::testCurvedLabelAllowUpsideDownHintLeftPositiveOffset settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::HintOnly ); settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::AboveLine ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -3530,7 +3531,7 @@ void TestQgsLabelingEngine::testCurvedLabelAllowUpsideDownHintLeftNegativeOffset settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::HintOnly ); settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::AboveLine ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -3597,7 +3598,7 @@ void TestQgsLabelingEngine::testCurvedLabelAllowUpsideDownHintRightPositiveOffse settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::HintOnly ); settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::BelowLine ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -3665,7 +3666,7 @@ void TestQgsLabelingEngine::testCurvedLabelAllowUpsideDownHintRightNegativeOffse settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::HintOnly ); settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::BelowLine ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -3729,7 +3730,7 @@ void TestQgsLabelingEngine::testRepeatDistanceWithSmallLine() settings.labelPerPart = false; settings.repeatDistance = 55; - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -3783,7 +3784,7 @@ void TestQgsLabelingEngine::testParallelPlacementPreferAbove() settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::AboveLine | Qgis::LabelLinePlacementFlag::BelowLine | Qgis::LabelLinePlacementFlag::MapOrientation ); settings.labelPerPart = false; - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -3834,7 +3835,7 @@ void TestQgsLabelingEngine::testLabelBoundary() settings.isExpression = true; settings.placement = Qgis::LabelPlacement::OverPoint; - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f( vl2->fields(), 1 ); @@ -3903,7 +3904,7 @@ void TestQgsLabelingEngine::testLabelBlockingRegion() settings.isExpression = true; settings.placement = Qgis::LabelPlacement::OverPoint; - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f( vl2->fields(), 1 ); @@ -3987,7 +3988,7 @@ void TestQgsLabelingEngine::testLabelRotationWithReprojection() settings.isExpression = true; settings.placement = Qgis::LabelPlacement::OverPoint; - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -4093,7 +4094,7 @@ void TestQgsLabelingEngine::drawUnplaced() settings.priority = 3; settings.obstacleSettings().setFactor( 0 ); - std::unique_ptr vl1( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl1 = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl1->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -4113,7 +4114,7 @@ void TestQgsLabelingEngine::drawUnplaced() format.setSize( 90 ); settings.setFormat( format ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QVERIFY( vl2->dataProvider()->addFeature( f ) ); @@ -4121,7 +4122,7 @@ void TestQgsLabelingEngine::drawUnplaced() vl2->setLabelsEnabled( true ); // test a label with 0 candidates (line is too short for label) - std::unique_ptr vl3( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl3 = std::make_unique( QStringLiteral( "LineString?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl3->setRenderer( new QgsNullSymbolRenderer() ); f.setGeometry( QgsGeometry::fromWkt( QStringLiteral( "LineString(-6.250851540391068 60.6, -6.250851640391068 60.6 )" ) ) ); QVERIFY( vl3->dataProvider()->addFeature( f ) ); @@ -4174,7 +4175,7 @@ void TestQgsLabelingEngine::labelingResults() settings.priority = 10; settings.angleOffset = 3; - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -4381,7 +4382,7 @@ void TestQgsLabelingEngine::labelingResultsCurved() settings.placement = Qgis::LabelPlacement::Curved; settings.priority = 10; - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -4495,7 +4496,7 @@ void TestQgsLabelingEngine::labelingResultsWithCallouts() settings.callout()->setDataDefinedProperties( calloutProps ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:4326&field=id:integer&field=labelx:double&field=labely:double&field=calloutoriginx:double&field=calloutoriginy:double&field=calloutdestx:double&field=calloutdesty:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=id:integer&field=labelx:double&field=labely:double&field=calloutoriginx:double&field=calloutoriginy:double&field=calloutdestx:double&field=calloutdesty:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QgsFeature f; f.setAttributes( QgsAttributes() << 1 << -20.173 << 58.624 << -11.160 << 58.001 << -3.814 << 56.046 ); @@ -4511,7 +4512,7 @@ void TestQgsLabelingEngine::labelingResultsWithCallouts() vl2->setLabelsEnabled( true ); // another layer - std::unique_ptr vl3( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:3857&field=id:integer&field=labelx:double&field=labely:double&field=calloutoriginx:double&field=calloutoriginy:double&field=calloutdestx:double&field=calloutdesty:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl3 = std::make_unique( QStringLiteral( "Point?crs=epsg:3857&field=id:integer&field=labelx:double&field=labely:double&field=calloutoriginx:double&field=calloutoriginy:double&field=calloutdestx:double&field=calloutdesty:double" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); f.setAttributes( QgsAttributes() << 2 << -3424024 << 7849709 << -2713442 << 7628322 << -2567040 << 6974872 ); f.setGeometry( QgsGeometry::fromPointXY( QgsPointXY( -2995532, 7242679 ) ) ); @@ -4952,7 +4953,7 @@ void TestQgsLabelingEngine::curvedOverrun() settings.labelPerPart = false; settings.lineSettings().setOverrunDistance( 0 ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -5027,7 +5028,7 @@ void TestQgsLabelingEngine::parallelOverrun() settings.labelPerPart = false; settings.lineSettings().setOverrunDistance( 0 ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -5100,7 +5101,7 @@ void TestQgsLabelingEngine::testDataDefinedLabelAllParts() settings.placement = Qgis::LabelPlacement::OverPoint; settings.labelPerPart = false; - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "MultiPolygon?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "MultiPolygon?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -5185,6 +5186,64 @@ void TestQgsLabelingEngine::testDataDefinedPlacementPositionPoint() vl->setLabeling( nullptr ); } +void TestQgsLabelingEngine::testDataDefinedLabelTabs() +{ + // test curved label rendering with tab characters + QgsPalLayerSettings settings; + setDefaultLabelParams( settings ); + + QgsTextFormat format = settings.format(); + format.setSize( 30 ); + format.setColor( QColor( 0, 0, 0 ) ); + format.setTabStopDistance( 28 ); + format.setTabStopDistanceUnit( Qgis::RenderUnit::Millimeters ); + settings.setFormat( format ); + settings.dataDefinedProperties().setProperty( QgsPalLayerSettings::Property::TabStopDistance, QgsProperty::fromExpression( QStringLiteral( "48" ) ) ); + + settings.fieldName = QStringLiteral( "'test of\ttab\ttext'" ); + settings.isExpression = true; + settings.placement = Qgis::LabelPlacement::Horizontal; + settings.labelPerPart = false; + settings.lineSettings().setLineAnchorPercent( 0.5 ); + settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::Strict ); + settings.lineSettings().setPlacementFlags( Qgis::LabelLinePlacementFlag::AboveLine | Qgis::LabelLinePlacementFlag::MapOrientation ); + settings.lineSettings().setAnchorTextPoint( QgsLabelLineSettings::AnchorTextPoint::CenterOfText ); + + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); + vl2->setRenderer( new QgsNullSymbolRenderer() ); + + QgsFeature f; + f.setAttributes( QgsAttributes() << 1 ); + f.setGeometry( QgsGeometry::fromWkt( QStringLiteral( "LineString (190000 5000010, 190100 5000000, 190200 5000000)" ) ) ); + QVERIFY( vl2->dataProvider()->addFeature( f ) ); + + vl2->setLabeling( new QgsVectorLayerSimpleLabeling( settings ) ); // TODO: this should not be necessary! + vl2->setLabelsEnabled( true ); + + // make a fake render context + const QSize size( 640, 480 ); + QgsMapSettings mapSettings; + mapSettings.setLabelingEngineSettings( createLabelEngineSettings() ); + mapSettings.setDestinationCrs( vl2->crs() ); + + mapSettings.setOutputSize( size ); + mapSettings.setExtent( f.geometry().boundingBox() ); + mapSettings.setLayers( QList() << vl2.get() ); + mapSettings.setOutputDpi( 96 ); + + QgsLabelingEngineSettings engineSettings = mapSettings.labelingEngineSettings(); + engineSettings.setFlag( Qgis::LabelingFlag::UsePartialCandidates, false ); + engineSettings.setFlag( Qgis::LabelingFlag::DrawCandidates, true ); + mapSettings.setLabelingEngineSettings( engineSettings ); + + QgsMapRendererSequentialJob job( mapSettings ); + job.start(); + job.waitForFinished(); + + QImage img = job.renderedImage(); + QGSVERIFYIMAGECHECK( "data_defined_tabs", "data_defined_tabs", img, QString(), 20, QSize( 0, 0 ), 2 ); +} + void TestQgsLabelingEngine::testVerticalOrientation() { const QSize size( 640, 480 ); @@ -5447,7 +5506,7 @@ void TestQgsLabelingEngine::testMapUnitLetterSpacing() format.setFont( font ); settings.setFormat( format ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -5501,7 +5560,7 @@ void TestQgsLabelingEngine::testMapUnitWordSpacing() format.setFont( font ); settings.setFormat( format ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -5554,7 +5613,7 @@ void TestQgsLabelingEngine::testLineHeightAbsolute() settings.placement = Qgis::LabelPlacement::Horizontal; settings.setFormat( format ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); QgsFeature f; @@ -5621,7 +5680,7 @@ void TestQgsLabelingEngine::testClipping() settings.placement = Qgis::LabelPlacement::Line; const QString filename = QStringLiteral( TEST_DATA_DIR ) + "/lines.shp"; - std::unique_ptr vl2( new QgsVectorLayer( filename, QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ) ); + auto vl2 = std::make_unique( filename, QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ); QVariantMap props; props.insert( QStringLiteral( "outline_color" ), QStringLiteral( "#487bb6" ) ); @@ -5691,7 +5750,7 @@ void TestQgsLabelingEngine::testLineAnchorParallel() settings.labelPerPart = false; settings.lineSettings().setLineAnchorPercent( 0.0 ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -5755,7 +5814,7 @@ void TestQgsLabelingEngine::testLineAnchorParallelConstraints() settings.lineSettings().setLineAnchorPercent( 0.0 ); settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::HintOnly ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -5953,7 +6012,7 @@ void TestQgsLabelingEngine::testLineAnchorDataDefinedType() settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::HintOnly ); settings.dataDefinedProperties().setProperty( QgsPalLayerSettings::Property::LineAnchorType, QgsProperty::fromExpression( QStringLiteral( "'strict'" ) ) ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -6020,7 +6079,7 @@ void TestQgsLabelingEngine::testLineAnchorCurved() settings.lineSettings().setLineAnchorPercent( 0.0 ); settings.lineSettings().setAnchorTextPoint( QgsLabelLineSettings::AnchorTextPoint::CenterOfText ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -6104,7 +6163,7 @@ void TestQgsLabelingEngine::testLineAnchorCurvedConstraints() settings.lineSettings().setLineAnchorPercent( 0.0 ); settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::HintOnly ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -6305,7 +6364,7 @@ void TestQgsLabelingEngine::testLineAnchorCurvedOverrun() settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::Strict ); settings.lineSettings().setAnchorTextPoint( QgsLabelLineSettings::AnchorTextPoint::EndOfText ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -6375,7 +6434,7 @@ void TestQgsLabelingEngine::testLineAnchorCurvedStrictAllUpsideDown() settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::Strict ); settings.lineSettings().setAnchorTextPoint( QgsLabelLineSettings::AnchorTextPoint::StartOfText ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -6430,7 +6489,7 @@ void TestQgsLabelingEngine::testLineAnchorHorizontal() settings.lineSettings().setLineAnchorPercent( 0.0 ); settings.lineSettings().setAnchorTextPoint( QgsLabelLineSettings::AnchorTextPoint::CenterOfText ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -6495,7 +6554,7 @@ void TestQgsLabelingEngine::testLineAnchorHorizontalConstraints() settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::HintOnly ); settings.lineSettings().setAnchorTextPoint( QgsLabelLineSettings::AnchorTextPoint::CenterOfText ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=l:string" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=l:string" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -6587,7 +6646,7 @@ void TestQgsLabelingEngine::testLineAnchorClipping() settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::Strict ); settings.lineSettings().setAnchorClipping( QgsLabelLineSettings::AnchorClipping::UseEntireLine ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=l:string" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=l:string" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#ff0000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -6643,7 +6702,7 @@ void TestQgsLabelingEngine::testShowAllLabelsWhenALabelHasNoCandidates() settings.obstacleSettings().setFactor( 10 ); settings.lineSettings().setOverrunDistance( 50 ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:23700&field=l:string" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:23700&field=l:string" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -6687,7 +6746,7 @@ void TestQgsLabelingEngine::testShowAllLabelsWhenALabelHasNoCandidates() void TestQgsLabelingEngine::testSymbologyScalingFactor() { // test rendering labels with a layer with a reference scale set (with callout) - std::unique_ptr vl = std::make_unique( QStringLiteral( TEST_DATA_DIR ) + "/points.shp", QStringLiteral( "points" ), QStringLiteral( "ogr" ) ); + auto vl = std::make_unique( QStringLiteral( TEST_DATA_DIR ) + "/points.shp", QStringLiteral( "points" ), QStringLiteral( "ogr" ) ); QVERIFY( vl->isValid() ); QgsMarkerSymbol *marker = static_cast( QgsSymbol::defaultSymbol( Qgis::GeometryType::Point ) ); marker->setColor( QColor( 255, 0, 0 ) ); @@ -6750,7 +6809,7 @@ void TestQgsLabelingEngine::testSymbologyScalingFactor() void TestQgsLabelingEngine::testSymbologyScalingFactor2() { // test rendering labels with a layer with a reference scale set (with label background) - std::unique_ptr vl = std::make_unique( QStringLiteral( TEST_DATA_DIR ) + "/points.shp", QStringLiteral( "points" ), QStringLiteral( "ogr" ) ); + auto vl = std::make_unique( QStringLiteral( TEST_DATA_DIR ) + "/points.shp", QStringLiteral( "points" ), QStringLiteral( "ogr" ) ); QVERIFY( vl->isValid() ); QgsMarkerSymbol *marker = static_cast( QgsSymbol::defaultSymbol( Qgis::GeometryType::Point ) ); marker->setColor( QColor( 255, 0, 0 ) ); @@ -6826,7 +6885,7 @@ void TestQgsLabelingEngine::testLineDirectionSymbolRight() settings.lineSettings().setAddDirectionSymbol( true ); settings.lineSettings().setDirectionSymbolPlacement( QgsLabelLineSettings::DirectionSymbolPlacement::SymbolLeftRight ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -6880,7 +6939,7 @@ void TestQgsLabelingEngine::testLineDirectionSymbolLeft() settings.lineSettings().setAddDirectionSymbol( true ); settings.lineSettings().setDirectionSymbolPlacement( QgsLabelLineSettings::DirectionSymbolPlacement::SymbolLeftRight ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -6934,7 +6993,7 @@ void TestQgsLabelingEngine::testLineDirectionSymbolAbove() settings.lineSettings().setAddDirectionSymbol( true ); settings.lineSettings().setDirectionSymbolPlacement( QgsLabelLineSettings::DirectionSymbolPlacement::SymbolAbove ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; @@ -6988,7 +7047,7 @@ void TestQgsLabelingEngine::testLineDirectionSymbolBelow() settings.lineSettings().setAddDirectionSymbol( true ); settings.lineSettings().setDirectionSymbolPlacement( QgsLabelLineSettings::DirectionSymbolPlacement::SymbolBelow ); - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { { QStringLiteral( "color" ), QStringLiteral( "#000000" ) }, { QStringLiteral( "outline_width" ), 0.6 } } ) ) ); QgsFeature f; diff --git a/tests/src/core/testqgslayertree.cpp b/tests/src/core/testqgslayertree.cpp index 48c4591f2389..a06606824232 100644 --- a/tests/src/core/testqgslayertree.cpp +++ b/tests/src/core/testqgslayertree.cpp @@ -963,7 +963,7 @@ void TestQgsLayerTree::testRasterSymbolNode() QgsLayerTreeNode *secondGroup = mRoot->children()[1]; QCOMPARE( secondGroup->depth(), 1 ); - std::unique_ptr rl = std::make_unique( QStringLiteral( TEST_DATA_DIR ) + "/tenbytenraster.asc", QStringLiteral( "rl" ), QStringLiteral( "gdal" ) ); + auto rl = std::make_unique( QStringLiteral( TEST_DATA_DIR ) + "/tenbytenraster.asc", QStringLiteral( "rl" ), QStringLiteral( "gdal" ) ); QVERIFY( rl->isValid() ); const std::unique_ptr n = std::make_unique( rl.get() ); diff --git a/tests/src/core/testqgslayoutatlas.cpp b/tests/src/core/testqgslayoutatlas.cpp index 9a5a87eeaa1a..a9f866725358 100644 --- a/tests/src/core/testqgslayoutatlas.cpp +++ b/tests/src/core/testqgslayoutatlas.cpp @@ -403,7 +403,7 @@ void TestQgsLayoutAtlas::test_remove_layer() void TestQgsLayoutAtlas::context() { - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:4326&field=id:integer&field=labelx:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=id:integer&field=labelx:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QgsFeature f; QVERIFY( vl2->dataProvider()->addFeature( f ) ); QgsFeature f2; diff --git a/tests/src/core/testqgslayoutgeopdfexport.cpp b/tests/src/core/testqgslayoutgeopdfexport.cpp index 92fdbdc695fe..4403ed1d5ec8 100644 --- a/tests/src/core/testqgslayoutgeopdfexport.cpp +++ b/tests/src/core/testqgslayoutgeopdfexport.cpp @@ -211,7 +211,7 @@ void TestQgsLayoutGeospatialPdfExport::testCollectingFeatures() } // read in as vector - std::unique_ptr layer1 = std::make_unique( QStringLiteral( "%1|layername=%2" ).arg( vectorDetail.sourceVectorPath, vectorDetail.sourceVectorLayer ), QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ); + auto layer1 = std::make_unique( QStringLiteral( "%1|layername=%2" ).arg( vectorDetail.sourceVectorPath, vectorDetail.sourceVectorLayer ), QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ); QVERIFY( layer1->isValid() ); QCOMPARE( layer1->featureCount(), 6L ); for ( const auto &it : geospatialPdfExporter.mVectorComponents ) @@ -219,7 +219,7 @@ void TestQgsLayoutGeospatialPdfExport::testCollectingFeatures() if ( it.mapLayerId == pointsLayer->id() ) vectorDetail = it; } - std::unique_ptr layer2 = std::make_unique( QStringLiteral( "%1|layername=%2" ).arg( vectorDetail.sourceVectorPath, vectorDetail.sourceVectorLayer ), QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ); + auto layer2 = std::make_unique( QStringLiteral( "%1|layername=%2" ).arg( vectorDetail.sourceVectorPath, vectorDetail.sourceVectorLayer ), QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ); QVERIFY( layer2->isValid() ); QCOMPARE( layer2->featureCount(), 32L ); for ( const auto &it : geospatialPdfExporter.mVectorComponents ) @@ -227,7 +227,7 @@ void TestQgsLayoutGeospatialPdfExport::testCollectingFeatures() if ( it.mapLayerId == polygonLayer->id() ) vectorDetail = it; } - std::unique_ptr layer3 = std::make_unique( QStringLiteral( "%1|layername=%2" ).arg( vectorDetail.sourceVectorPath, vectorDetail.sourceVectorLayer ), QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ); + auto layer3 = std::make_unique( QStringLiteral( "%1|layername=%2" ).arg( vectorDetail.sourceVectorPath, vectorDetail.sourceVectorLayer ), QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ); QVERIFY( layer3->isValid() ); QCOMPARE( layer3->featureCount(), 10L ); diff --git a/tests/src/core/testqgslayoutitem.cpp b/tests/src/core/testqgslayoutitem.cpp index 44f9961d52ca..4a9e7d78d348 100644 --- a/tests/src/core/testqgslayoutitem.cpp +++ b/tests/src/core/testqgslayoutitem.cpp @@ -358,7 +358,7 @@ void TestQgsLayoutItem::positionWithUnits() QgsProject p; QgsLayout l( &p ); - std::unique_ptr item( new TestItem( &l ) ); + auto item = std::make_unique( &l ); item->attemptMove( QgsLayoutPoint( 60.0, 15.0, Qgis::LayoutUnit::Millimeters ) ); QCOMPARE( item->positionWithUnits().x(), 60.0 ); QCOMPARE( item->positionWithUnits().y(), 15.0 ); @@ -690,7 +690,7 @@ void TestQgsLayoutItem::resize() //resize test item (no restrictions), same units as layout l.setUnits( Qgis::LayoutUnit::Millimeters ); - std::unique_ptr item( new TestItem( &l ) ); + auto item = std::make_unique( &l ); const QSignalSpy spySizeChanged( item.get(), &QgsLayoutItem::sizePositionChanged ); item->setRect( 0, 0, 55, 45 ); @@ -760,7 +760,7 @@ void TestQgsLayoutItem::referencePoint() QgsLayout l( &p ); //test setting/getting reference point - std::unique_ptr item( new TestItem( &l ) ); + auto item = std::make_unique( &l ); item->setReferencePoint( QgsLayoutItem::LowerMiddle ); QCOMPARE( item->referencePoint(), QgsLayoutItem::LowerMiddle ); @@ -940,7 +940,7 @@ void TestQgsLayoutItem::adjustPointForReference() QgsProject p; QgsLayout l( &p ); - std::unique_ptr item( new TestItem( &l ) ); + auto item = std::make_unique( &l ); QPointF result = item->adjustPointForReferencePosition( QPointF( 5, 7 ), QSizeF( 2, 4 ), QgsLayoutItem::UpperLeft ); QCOMPARE( result.x(), 5.0 ); QCOMPARE( result.y(), 7.0 ); @@ -1045,7 +1045,7 @@ void TestQgsLayoutItem::fixedSize() QgsLayout l( &p ); l.setUnits( Qgis::LayoutUnit::Millimeters ); - std::unique_ptr item( new FixedSizedItem( &l ) ); + auto item = std::make_unique( &l ); QCOMPARE( item->fixedSize().width(), 2.0 ); QCOMPARE( item->fixedSize().height(), 4.0 ); QCOMPARE( item->fixedSize().units(), Qgis::LayoutUnit::Inches ); @@ -1073,7 +1073,7 @@ void TestQgsLayoutItem::minSize() QgsLayout l( &p ); l.setUnits( Qgis::LayoutUnit::Millimeters ); - std::unique_ptr item( new MinSizedItem( &l ) ); + auto item = std::make_unique( &l ); QCOMPARE( item->minimumSize().width(), 5.0 ); QCOMPARE( item->minimumSize().height(), 10.0 ); QCOMPARE( item->minimumSize().units(), Qgis::LayoutUnit::Centimeters ); @@ -1096,7 +1096,7 @@ void TestQgsLayoutItem::minSize() QGSCOMPARENEAR( item->rect().height(), 250.0, 4 * std::numeric_limits::epsilon() ); //also need check that fixed size trumps min size - std::unique_ptr fixedMinItem( new FixedMinSizedItem( &l ) ); + auto fixedMinItem = std::make_unique( &l ); QCOMPARE( fixedMinItem->minimumSize().width(), 5.0 ); QCOMPARE( fixedMinItem->minimumSize().height(), 9.0 ); QCOMPARE( fixedMinItem->minimumSize().units(), Qgis::LayoutUnit::Centimeters ); @@ -1117,7 +1117,7 @@ void TestQgsLayoutItem::move() //move test item, same units as layout l.setUnits( Qgis::LayoutUnit::Millimeters ); - std::unique_ptr item( new TestItem( &l ) ); + auto item = std::make_unique( &l ); item->setRect( 0, 0, 55, 45 ); item->setPos( 27, 29 ); item->attemptMove( QgsLayoutPoint( 60.0, 15.0, Qgis::LayoutUnit::Millimeters ) ); @@ -1218,7 +1218,7 @@ void TestQgsLayoutItem::setSceneRect() //resize test item (no restrictions), same units as layout l.setUnits( Qgis::LayoutUnit::Millimeters ); - std::unique_ptr item( new TestItem( &l ) ); + auto item = std::make_unique( &l ); const QSignalSpy spySizeChanged( item.get(), &QgsLayoutItem::sizePositionChanged ); item->attemptSetSceneRect( QRectF( 27.0, 29.0, 100, 200 ) ); @@ -1274,7 +1274,7 @@ void TestQgsLayoutItem::page() QCOMPARE( item->pagePositionWithUnits(), QgsLayoutPoint( 5, 5 ) ); // add pages - std::unique_ptr page( new QgsLayoutItemPage( &l ) ); + auto page = std::make_unique( &l ); page->setPageSize( QgsLayoutSize( 500, 100, Qgis::LayoutUnit::Millimeters ) ); l.pageCollection()->addPage( page.release() ); QCOMPARE( item->page(), 0 ); @@ -1395,8 +1395,8 @@ void TestQgsLayoutItem::itemVariablesFunction() r = e4.evaluate( &c ); QCOMPARE( r.toString(), QString( "degrees" ) ); - std::unique_ptr layer = std::make_unique( QStringLiteral( "Point?field=id_a:integer" ), QStringLiteral( "A" ), QStringLiteral( "memory" ) ); - std::unique_ptr layer2 = std::make_unique( QStringLiteral( "Point?field=id_a:integer" ), QStringLiteral( "B" ), QStringLiteral( "memory" ) ); + auto layer = std::make_unique( QStringLiteral( "Point?field=id_a:integer" ), QStringLiteral( "A" ), QStringLiteral( "memory" ) ); + auto layer2 = std::make_unique( QStringLiteral( "Point?field=id_a:integer" ), QStringLiteral( "B" ), QStringLiteral( "memory" ) ); map->setLayers( QList() << layer.get() << layer2.get() ); QgsExpression e5( QStringLiteral( "map_get( item_variables( 'Map_id' ), 'map_layer_ids' )" ) ); r = e5.evaluate( &c ); @@ -1410,7 +1410,7 @@ void TestQgsLayoutItem::variables() { QgsLayout l( QgsProject::instance() ); - std::unique_ptr map = std::make_unique( &l ); + auto map = std::make_unique( &l ); std::unique_ptr scope( QgsExpressionContextUtils::layoutItemScope( map.get() ) ); const int before = scope->variableCount(); @@ -1459,14 +1459,14 @@ void TestQgsLayoutItem::mapCreditsFunction() QCOMPARE( r.toString(), QString() ); // with layers - std::unique_ptr layer = std::make_unique( QStringLiteral( "Point?field=id_a:integer" ), QStringLiteral( "A" ), QStringLiteral( "memory" ) ); + auto layer = std::make_unique( QStringLiteral( "Point?field=id_a:integer" ), QStringLiteral( "A" ), QStringLiteral( "memory" ) ); QgsLayerMetadata metadata; metadata.setRights( QStringList() << QStringLiteral( "CC BY SA" ) ); layer->setMetadata( metadata ); - std::unique_ptr layer2 = std::make_unique( QStringLiteral( "Point?field=id_a:integer" ), QStringLiteral( "B" ), QStringLiteral( "memory" ) ); + auto layer2 = std::make_unique( QStringLiteral( "Point?field=id_a:integer" ), QStringLiteral( "B" ), QStringLiteral( "memory" ) ); metadata.setRights( QStringList() << QStringLiteral( "CC NC" ) ); layer2->setMetadata( metadata ); - std::unique_ptr layer3 = std::make_unique( QStringLiteral( "Point?field=id_a:integer" ), QStringLiteral( "C" ), QStringLiteral( "memory" ) ); + auto layer3 = std::make_unique( QStringLiteral( "Point?field=id_a:integer" ), QStringLiteral( "C" ), QStringLiteral( "memory" ) ); metadata.setRights( QStringList() << QStringLiteral( "CC BY SA" ) ); layer3->setMetadata( metadata ); const std::unique_ptr layer4 = std::make_unique( QStringLiteral( "Point?field=id_a:integer" ), QStringLiteral( "C" ), QStringLiteral( "memory" ) ); @@ -1570,7 +1570,7 @@ void TestQgsLayoutItem::rotation() QCOMPARE( item->sceneBoundingRect().bottom(), 18.0 ); // set rotation, using top left - std::unique_ptr item2( new TestItem( &l ) ); + auto item2 = std::make_unique( &l ); item2->attemptMove( QgsLayoutPoint( 5.0, 8.0 ) ); item2->attemptResize( QgsLayoutSize( 10.0, 6.0 ) ); item2->setItemRotation( 90, false ); @@ -2061,12 +2061,12 @@ void TestQgsLayoutItem::excludeFromExports() QgsProject proj; QgsLayout l( &proj ); - std::unique_ptr page( new QgsLayoutItemPage( &l ) ); + auto page = std::make_unique( &l ); page->setPageSize( QgsLayoutSize( 297, 210, Qgis::LayoutUnit::Millimeters ) ); l.pageCollection()->addPage( page.release() ); QgsSimpleFillSymbolLayer *simpleFill = new QgsSimpleFillSymbolLayer(); - std::unique_ptr fillSymbol( new QgsFillSymbol() ); + auto fillSymbol = std::make_unique(); fillSymbol->changeSymbolLayer( 0, simpleFill ); simpleFill->setColor( Qt::transparent ); simpleFill->setStrokeColor( Qt::transparent ); @@ -2106,7 +2106,7 @@ std::unique_ptr TestQgsLayoutItem::createCopyViaXml( QgsLayout *l original->writeXml( rootNode, doc, QgsReadWriteContext() ); //create new item and restore settings from xml - std::unique_ptr copy = std::make_unique( layout ); + auto copy = std::make_unique( layout ); copy->readXml( rootNode.firstChildElement(), doc, QgsReadWriteContext() ); return std::move( copy ); diff --git a/tests/src/core/testqgslayoutmanualtable.cpp b/tests/src/core/testqgslayoutmanualtable.cpp index 221286603342..2fd25720b97f 100644 --- a/tests/src/core/testqgslayoutmanualtable.cpp +++ b/tests/src/core/testqgslayoutmanualtable.cpp @@ -355,7 +355,7 @@ void TestQgsLayoutManualTable::cellFormat() QgsTableCell c3; c3.setContent( 87 ); - std::unique_ptr format = std::make_unique(); + auto format = std::make_unique(); format->setNumberDecimalPlaces( 2 ); format->setPrefix( QStringLiteral( "$" ) ); c3.setNumericFormat( format.release() ); diff --git a/tests/src/core/testqgslayoutmap.cpp b/tests/src/core/testqgslayoutmap.cpp index 6f9f3414a258..9314b4145327 100644 --- a/tests/src/core/testqgslayoutmap.cpp +++ b/tests/src/core/testqgslayoutmap.cpp @@ -1927,7 +1927,7 @@ void TestQgsLayoutMap::testLayeredExportLabelsByLayer() void TestQgsLayoutMap::testTemporal() { QgsLayout l( QgsProject::instance() ); - std::unique_ptr map = std::make_unique( &l ); + auto map = std::make_unique( &l ); const QDateTime begin( QDate( 2020, 01, 01 ), QTime( 10, 0, 0 ), Qt::UTC ); const QDateTime end = begin.addSecs( 3600 ); @@ -2049,7 +2049,7 @@ void TestQgsLayoutMap::testLabelResults() void TestQgsLayoutMap::testZRange() { QgsLayout l( QgsProject::instance() ); - std::unique_ptr map = std::make_unique( &l ); + auto map = std::make_unique( &l ); QgsMapSettings settings = map->mapSettings( map->extent(), QSize( 512, 512 ), 72, false ); QVERIFY( settings.zRange().isInfinite() ); diff --git a/tests/src/core/testqgslayoutpage.cpp b/tests/src/core/testqgslayoutpage.cpp index 2dcc19489be1..a09835be975e 100644 --- a/tests/src/core/testqgslayoutpage.cpp +++ b/tests/src/core/testqgslayoutpage.cpp @@ -63,7 +63,7 @@ void TestQgsLayoutPage::itemType() { QgsProject p; QgsLayout l( &p ); - std::unique_ptr page( new QgsLayoutItemPage( &l ) ); + auto page = std::make_unique( &l ); QCOMPARE( page->type(), static_cast( QgsLayoutItemRegistry::LayoutPage ) ); } @@ -71,7 +71,7 @@ void TestQgsLayoutPage::pageSize() { QgsProject p; QgsLayout l( &p ); - std::unique_ptr page( new QgsLayoutItemPage( &l ) ); + auto page = std::make_unique( &l ); page->setPageSize( QgsLayoutSize( 270, 297, Qgis::LayoutUnit::Meters ) ); QCOMPARE( page->pageSize().width(), 270.0 ); QCOMPARE( page->pageSize().height(), 297.0 ); @@ -120,7 +120,7 @@ void TestQgsLayoutPage::grid() // test that grid follows page around QgsProject p; QgsLayout l( &p ); - std::unique_ptr page( new QgsLayoutItemPage( &l ) ); + auto page = std::make_unique( &l ); // should have a grid QVERIFY( page->mGrid.get() ); @@ -151,7 +151,7 @@ void TestQgsLayoutPage::defaultPaper() { QgsProject p; QgsLayout l( &p ); - std::unique_ptr page( new QgsLayoutItemPage( &l ) ); + auto page = std::make_unique( &l ); page->setPageSize( QgsLayoutSize( 297, 210, Qgis::LayoutUnit::Millimeters ) ); l.pageCollection()->addPage( page.release() ); @@ -162,12 +162,12 @@ void TestQgsLayoutPage::transparentPaper() { QgsProject p; QgsLayout l( &p ); - std::unique_ptr page( new QgsLayoutItemPage( &l ) ); + auto page = std::make_unique( &l ); page->setPageSize( QgsLayoutSize( 297, 210, Qgis::LayoutUnit::Millimeters ) ); l.pageCollection()->addPage( page.release() ); QgsSimpleFillSymbolLayer *simpleFill = new QgsSimpleFillSymbolLayer(); - std::unique_ptr fillSymbol( new QgsFillSymbol() ); + auto fillSymbol = std::make_unique(); fillSymbol->changeSymbolLayer( 0, simpleFill ); simpleFill->setColor( Qt::transparent ); simpleFill->setStrokeColor( Qt::transparent ); @@ -180,12 +180,12 @@ void TestQgsLayoutPage::borderedPaper() { QgsProject p; QgsLayout l( &p ); - std::unique_ptr page( new QgsLayoutItemPage( &l ) ); + auto page = std::make_unique( &l ); page->setPageSize( QgsLayoutSize( 297, 210, Qgis::LayoutUnit::Millimeters ) ); l.pageCollection()->addPage( page.release() ); QgsSimpleFillSymbolLayer *simpleFill = new QgsSimpleFillSymbolLayer(); - std::unique_ptr fillSymbol = std::make_unique(); + auto fillSymbol = std::make_unique(); fillSymbol->changeSymbolLayer( 0, simpleFill ); simpleFill->setColor( Qt::white ); simpleFill->setStrokeColor( Qt::black ); @@ -199,13 +199,13 @@ void TestQgsLayoutPage::markerLinePaper() { QgsProject p; QgsLayout l( &p ); - std::unique_ptr page( new QgsLayoutItemPage( &l ) ); + auto page = std::make_unique( &l ); page->setPageSize( QgsLayoutSize( 297, 210, Qgis::LayoutUnit::Millimeters ) ); l.pageCollection()->addPage( page.release() ); QgsMarkerLineSymbolLayer *markerLine = new QgsMarkerLineSymbolLayer(); static_cast( markerLine->subSymbol()->symbolLayer( 0 ) )->setStrokeColor( Qt::black ); - std::unique_ptr markerLineSymbol = std::make_unique(); + auto markerLineSymbol = std::make_unique(); markerLineSymbol->changeSymbolLayer( 0, markerLine ); l.pageCollection()->setPageStyleSymbol( markerLineSymbol.get() ); @@ -216,12 +216,12 @@ void TestQgsLayoutPage::hiddenPages() { QgsProject p; QgsLayout l( &p ); - std::unique_ptr page( new QgsLayoutItemPage( &l ) ); + auto page = std::make_unique( &l ); page->setPageSize( QgsLayoutSize( 297, 210, Qgis::LayoutUnit::Millimeters ) ); l.pageCollection()->addPage( page.release() ); QgsSimpleFillSymbolLayer *simpleFill = new QgsSimpleFillSymbolLayer(); - std::unique_ptr fillSymbol = std::make_unique(); + auto fillSymbol = std::make_unique(); fillSymbol->changeSymbolLayer( 0, simpleFill ); simpleFill->setColor( Qt::blue ); simpleFill->setStrokeColor( Qt::transparent ); @@ -236,7 +236,7 @@ void TestQgsLayoutPage::pageLayout() { QgsProject p; QgsLayout l( &p ); - std::unique_ptr page1( new QgsLayoutItemPage( &l ) ); + auto page1 = std::make_unique( &l ); page1->setPageSize( QgsLayoutSize( 297, 210, Qgis::LayoutUnit::Millimeters ) ); const QPageLayout layout1 = page1->pageLayout(); @@ -246,7 +246,7 @@ void TestQgsLayoutPage::pageLayout() QCOMPARE( layout1.pageSize().size( QPageSize::Millimeter ).width(), 210 ); QCOMPARE( layout1.pageSize().size( QPageSize::Millimeter ).height(), 297 ); - std::unique_ptr page2( new QgsLayoutItemPage( &l ) ); + auto page2 = std::make_unique( &l ); page2->setPageSize( QgsLayoutSize( 210, 297, Qgis::LayoutUnit::Millimeters ) ); const QPageLayout layout2 = page2->pageLayout(); diff --git a/tests/src/core/testqgslayoutpicture.cpp b/tests/src/core/testqgslayoutpicture.cpp index e94975438e61..6a1efa0427f6 100644 --- a/tests/src/core/testqgslayoutpicture.cpp +++ b/tests/src/core/testqgslayoutpicture.cpp @@ -169,7 +169,7 @@ void TestQgsLayoutPicture::pictureRotation() mPicture->setPictureRotation( 0 ); // Set picture rotation on uninitialized picture should not create an invalid size (NaN) - std::unique_ptr uninitialized( new QgsLayoutItemPicture( mLayout ) ); + auto uninitialized = std::make_unique( mLayout ); uninitialized->setResizeMode( QgsLayoutItemPicture::ZoomResizeFrame ); QCOMPARE( uninitialized->sizeWithUnits().toQSizeF(), QSizeF( 0, 0 ) ); uninitialized->setPictureRotation( 10 ); diff --git a/tests/src/core/testqgslayoutscalebar.cpp b/tests/src/core/testqgslayoutscalebar.cpp index 6f4a8b440f6a..25d619707a06 100644 --- a/tests/src/core/testqgslayoutscalebar.cpp +++ b/tests/src/core/testqgslayoutscalebar.cpp @@ -142,8 +142,8 @@ void TestQgsLayoutScaleBar::singleBoxLineSymbol() scalebar->setNumberOfSegments( 2 ); scalebar->setHeight( 20 ); - std::unique_ptr lineSymbol = std::make_unique(); - std::unique_ptr lineSymbolLayer = std::make_unique(); + auto lineSymbol = std::make_unique(); + auto lineSymbolLayer = std::make_unique(); lineSymbolLayer->setWidth( 4 ); lineSymbolLayer->setWidthUnit( Qgis::RenderUnit::Millimeters ); lineSymbolLayer->setColor( QColor( 255, 0, 0 ) ); @@ -184,15 +184,15 @@ void TestQgsLayoutScaleBar::singleBoxFillSymbol() scalebar->setNumberOfSegments( 2 ); scalebar->setHeight( 20 ); - std::unique_ptr fillSymbol = std::make_unique(); - std::unique_ptr fillSymbolLayer = std::make_unique(); + auto fillSymbol = std::make_unique(); + auto fillSymbolLayer = std::make_unique(); fillSymbolLayer->setColor( QColor( 255, 0, 0 ) ); fillSymbolLayer->setColor2( QColor( 255, 255, 0 ) ); fillSymbol->changeSymbolLayer( 0, fillSymbolLayer.release() ); scalebar->setFillSymbol( fillSymbol.release() ); - std::unique_ptr fillSymbol2 = std::make_unique(); - std::unique_ptr fillSymbolLayer2 = std::make_unique(); + auto fillSymbol2 = std::make_unique(); + auto fillSymbolLayer2 = std::make_unique(); fillSymbolLayer2->setColor( QColor( 0, 255, 0 ) ); fillSymbolLayer2->setColor2( QColor( 255, 255, 255 ) ); fillSymbol2->changeSymbolLayer( 0, fillSymbolLayer2.release() ); @@ -330,8 +330,8 @@ void TestQgsLayoutScaleBar::doubleBoxLineSymbol() scalebar->setNumberOfSegments( 2 ); scalebar->setHeight( 20 ); - std::unique_ptr lineSymbol = std::make_unique(); - std::unique_ptr lineSymbolLayer = std::make_unique(); + auto lineSymbol = std::make_unique(); + auto lineSymbolLayer = std::make_unique(); lineSymbolLayer->setWidth( 4 ); lineSymbolLayer->setWidthUnit( Qgis::RenderUnit::Millimeters ); lineSymbolLayer->setColor( QColor( 255, 0, 0 ) ); @@ -372,15 +372,15 @@ void TestQgsLayoutScaleBar::doubleBoxFillSymbol() scalebar->setNumberOfSegments( 2 ); scalebar->setHeight( 20 ); - std::unique_ptr fillSymbol = std::make_unique(); - std::unique_ptr fillSymbolLayer = std::make_unique(); + auto fillSymbol = std::make_unique(); + auto fillSymbolLayer = std::make_unique(); fillSymbolLayer->setColor( QColor( 255, 0, 0 ) ); fillSymbolLayer->setColor2( QColor( 255, 255, 0 ) ); fillSymbol->changeSymbolLayer( 0, fillSymbolLayer.release() ); scalebar->setFillSymbol( fillSymbol.release() ); - std::unique_ptr fillSymbol2 = std::make_unique(); - std::unique_ptr fillSymbolLayer2 = std::make_unique(); + auto fillSymbol2 = std::make_unique(); + auto fillSymbolLayer2 = std::make_unique(); fillSymbolLayer2->setColor( QColor( 0, 255, 0 ) ); fillSymbolLayer2->setColor2( QColor( 255, 255, 255 ) ); fillSymbol2->changeSymbolLayer( 0, fillSymbolLayer2.release() ); @@ -520,8 +520,8 @@ void TestQgsLayoutScaleBar::tickLineSymbol() scalebar->setNumberOfSegments( 2 ); scalebar->setHeight( 20 ); - std::unique_ptr lineSymbol = std::make_unique(); - std::unique_ptr lineSymbolLayer = std::make_unique(); + auto lineSymbol = std::make_unique(); + auto lineSymbolLayer = std::make_unique(); lineSymbolLayer->setWidth( 4 ); lineSymbolLayer->setWidthUnit( Qgis::RenderUnit::Millimeters ); lineSymbolLayer->setColor( QColor( 255, 0, 0 ) ); @@ -569,8 +569,8 @@ void TestQgsLayoutScaleBar::dataDefined() scalebar->setMinimumBarWidth( 11 ); scalebar->setMaximumBarWidth( 13 ); - std::unique_ptr lineSymbol = std::make_unique(); - std::unique_ptr lineSymbolLayer = std::make_unique(); + auto lineSymbol = std::make_unique(); + auto lineSymbolLayer = std::make_unique(); lineSymbolLayer->setWidth( 1 ); lineSymbolLayer->setWidthUnit( Qgis::RenderUnit::Millimeters ); lineSymbolLayer->setColor( QColor( 0, 0, 0 ) ); @@ -730,8 +730,8 @@ void TestQgsLayoutScaleBar::steppedLine() scalebar->setHeight( 20 ); scalebar->setSubdivisionsHeight( 25 ); //ensure subdivisionsHeight is non used in non tick-style scalebars - std::unique_ptr lineSymbol = std::make_unique(); - std::unique_ptr lineSymbolLayer = std::make_unique(); + auto lineSymbol = std::make_unique(); + auto lineSymbolLayer = std::make_unique(); lineSymbolLayer->setWidth( 4 ); lineSymbolLayer->setWidthUnit( Qgis::RenderUnit::Millimeters ); lineSymbolLayer->setColor( QColor( 255, 0, 0 ) ); @@ -773,8 +773,8 @@ void TestQgsLayoutScaleBar::hollow() scalebar->setHeight( 20 ); scalebar->setSubdivisionsHeight( 25 ); //ensure subdivisionsHeight is non used in non tick-style scalebars - std::unique_ptr lineSymbol = std::make_unique(); - std::unique_ptr lineSymbolLayer = std::make_unique(); + auto lineSymbol = std::make_unique(); + auto lineSymbolLayer = std::make_unique(); lineSymbolLayer->setWidth( 4 ); lineSymbolLayer->setWidthUnit( Qgis::RenderUnit::Millimeters ); lineSymbolLayer->setColor( QColor( 255, 0, 0 ) ); @@ -788,15 +788,15 @@ void TestQgsLayoutScaleBar::hollow() scalebar->setLineSymbol( lineSymbol.release() ); - std::unique_ptr fillSymbol = std::make_unique(); - std::unique_ptr fillSymbolLayer = std::make_unique(); + auto fillSymbol = std::make_unique(); + auto fillSymbolLayer = std::make_unique(); fillSymbolLayer->setColor( QColor( 255, 0, 0 ) ); fillSymbolLayer->setColor2( QColor( 255, 255, 0 ) ); fillSymbol->changeSymbolLayer( 0, fillSymbolLayer.release() ); scalebar->setFillSymbol( fillSymbol.release() ); - std::unique_ptr fillSymbol2 = std::make_unique(); - std::unique_ptr fillSymbolLayer2 = std::make_unique(); + auto fillSymbol2 = std::make_unique(); + auto fillSymbolLayer2 = std::make_unique(); fillSymbolLayer2->setColor( QColor( 0, 255, 0 ) ); fillSymbolLayer2->setColor2( QColor( 255, 255, 255 ) ); fillSymbol2->changeSymbolLayer( 0, fillSymbolLayer2.release() ); @@ -812,11 +812,11 @@ void TestQgsLayoutScaleBar::hollowDefaults() { QgsLayout l( QgsProject::instance() ); - std::unique_ptr scalebar = std::make_unique( &l ); + auto scalebar = std::make_unique( &l ); // apply random symbols - std::unique_ptr lineSymbol = std::make_unique(); - std::unique_ptr lineSymbolLayer = std::make_unique(); + auto lineSymbol = std::make_unique(); + auto lineSymbolLayer = std::make_unique(); lineSymbolLayer->setWidth( 4 ); lineSymbolLayer->setWidthUnit( Qgis::RenderUnit::Millimeters ); lineSymbolLayer->setColor( QColor( 255, 0, 0 ) ); @@ -830,15 +830,15 @@ void TestQgsLayoutScaleBar::hollowDefaults() scalebar->setLineSymbol( lineSymbol.release() ); - std::unique_ptr fillSymbol = std::make_unique(); - std::unique_ptr fillSymbolLayer = std::make_unique(); + auto fillSymbol = std::make_unique(); + auto fillSymbolLayer = std::make_unique(); fillSymbolLayer->setColor( QColor( 255, 0, 0 ) ); fillSymbolLayer->setColor2( QColor( 255, 255, 0 ) ); fillSymbol->changeSymbolLayer( 0, fillSymbolLayer.release() ); scalebar->setFillSymbol( fillSymbol.release() ); - std::unique_ptr fillSymbol2 = std::make_unique(); - std::unique_ptr fillSymbolLayer2 = std::make_unique(); + auto fillSymbol2 = std::make_unique(); + auto fillSymbolLayer2 = std::make_unique(); fillSymbolLayer2->setColor( QColor( 0, 255, 0 ) ); fillSymbolLayer2->setColor2( QColor( 255, 255, 255 ) ); fillSymbol2->changeSymbolLayer( 0, fillSymbolLayer2.release() ); @@ -878,8 +878,8 @@ void TestQgsLayoutScaleBar::tickSubdivisions() scalebar->setSubdivisionsHeight( 3 ); - std::unique_ptr lineSymbol = std::make_unique(); - std::unique_ptr lineSymbolLayer = std::make_unique(); + auto lineSymbol = std::make_unique(); + auto lineSymbolLayer = std::make_unique(); lineSymbolLayer->setWidth( 4 ); lineSymbolLayer->setWidthUnit( Qgis::RenderUnit::Millimeters ); lineSymbolLayer->setColor( QColor( 255, 0, 0 ) ); diff --git a/tests/src/core/testqgslayoutshapes.cpp b/tests/src/core/testqgslayoutshapes.cpp index 32ef916cc12a..ca539a201ab7 100644 --- a/tests/src/core/testqgslayoutshapes.cpp +++ b/tests/src/core/testqgslayoutshapes.cpp @@ -72,7 +72,7 @@ void TestQgsLayoutShapes::rectangle() shape->attemptResize( QgsLayoutSize( 150, 100 ) ); QgsSimpleFillSymbolLayer *simpleFill = new QgsSimpleFillSymbolLayer(); - std::unique_ptr fillSymbol( new QgsFillSymbol() ); + auto fillSymbol = std::make_unique(); fillSymbol->changeSymbolLayer( 0, simpleFill ); simpleFill->setColor( QColor( 255, 150, 0 ) ); simpleFill->setStrokeColor( QColor( 0, 0, 0 ) ); @@ -97,7 +97,7 @@ void TestQgsLayoutShapes::triangle() shape->attemptResize( QgsLayoutSize( 150, 100 ) ); QgsSimpleFillSymbolLayer *simpleFill = new QgsSimpleFillSymbolLayer(); - std::unique_ptr fillSymbol( new QgsFillSymbol() ); + auto fillSymbol = std::make_unique(); fillSymbol->changeSymbolLayer( 0, simpleFill ); simpleFill->setColor( QColor( 255, 150, 0 ) ); simpleFill->setStrokeColor( QColor( 0, 0, 0 ) ); @@ -122,7 +122,7 @@ void TestQgsLayoutShapes::ellipse() shape->attemptResize( QgsLayoutSize( 150, 100 ) ); QgsSimpleFillSymbolLayer *simpleFill = new QgsSimpleFillSymbolLayer(); - std::unique_ptr fillSymbol( new QgsFillSymbol() ); + auto fillSymbol = std::make_unique(); fillSymbol->changeSymbolLayer( 0, simpleFill ); simpleFill->setColor( QColor( 255, 150, 0 ) ); simpleFill->setStrokeColor( QColor( 0, 0, 0 ) ); @@ -146,7 +146,7 @@ void TestQgsLayoutShapes::roundedRectangle() shape->attemptResize( QgsLayoutSize( 150, 100 ) ); QgsSimpleFillSymbolLayer *simpleFill = new QgsSimpleFillSymbolLayer(); - std::unique_ptr fillSymbol( new QgsFillSymbol() ); + auto fillSymbol = std::make_unique(); fillSymbol->changeSymbolLayer( 0, simpleFill ); simpleFill->setColor( QColor( 255, 150, 0 ) ); simpleFill->setStrokeColor( QColor( 0, 0, 0 ) ); @@ -189,7 +189,7 @@ void TestQgsLayoutShapes::readWriteXml() { QgsProject p; QgsLayout l( &p ); - std::unique_ptr shape = std::make_unique( &l ); + auto shape = std::make_unique( &l ); shape->setShapeType( QgsLayoutItemShape::Triangle ); QgsSimpleFillSymbolLayer *simpleFill = new QgsSimpleFillSymbolLayer(); QgsFillSymbol *fillSymbol = new QgsFillSymbol(); @@ -211,7 +211,7 @@ void TestQgsLayoutShapes::readWriteXml() shape->writeXml( rootNode, doc, QgsReadWriteContext() ); //create new item and restore settings from xml - std::unique_ptr copy = std::make_unique( &l ); + auto copy = std::make_unique( &l ); QVERIFY( copy->readXml( rootNode.firstChildElement(), doc, QgsReadWriteContext() ) ); QCOMPARE( copy->shapeType(), QgsLayoutItemShape::Triangle ); QCOMPARE( copy->symbol()->symbolLayer( 0 )->color().name(), QStringLiteral( "#00ff00" ) ); @@ -222,7 +222,7 @@ void TestQgsLayoutShapes::bounds() { QgsProject p; QgsLayout l( &p ); - std::unique_ptr shape = std::make_unique( &l ); + auto shape = std::make_unique( &l ); shape->attemptMove( QgsLayoutPoint( 20, 20 ) ); shape->attemptResize( QgsLayoutSize( 150, 100 ) ); diff --git a/tests/src/core/testqgslayouttable.cpp b/tests/src/core/testqgslayouttable.cpp index 446c12acb228..055a6cc19d1d 100644 --- a/tests/src/core/testqgslayouttable.cpp +++ b/tests/src/core/testqgslayouttable.cpp @@ -448,7 +448,7 @@ void TestQgsLayoutTable::attributeTableInsideAtlasOnly() compareTable( table, expectedRows, false ); //setup atlas - std::unique_ptr atlasLayer = std::make_unique( QStringLiteral( "Polygon?crs=EPSG:3857" ), QStringLiteral( "atlas" ), QStringLiteral( "memory" ) ); + auto atlasLayer = std::make_unique( QStringLiteral( "Polygon?crs=EPSG:3857" ), QStringLiteral( "atlas" ), QStringLiteral( "memory" ) ); QVERIFY( atlasLayer->isValid() ); const QgsGeometry atlasGeom( QgsGeometry::fromWkt( QStringLiteral( "Polygon ((-8863916.31126776337623596 4621257.48816855065524578, -9664269.45078738406300545 5097056.938785120844841, -10049249.44194872118532658 3765399.75924854446202517, -8985488.94005555473268032 3458599.17133777122944593, -8863916.31126776337623596 4621257.48816855065524578))" ) ) ); QgsFeature f; @@ -1122,7 +1122,7 @@ void TestQgsLayoutTable::testIntegerNullCell() l.addLayoutItem( frame ); table->addFrame( frame ); - std::unique_ptr layer = std::make_unique( QStringLiteral( "Point?field=intf:integer" ), QStringLiteral( "point" ), QStringLiteral( "memory" ) ); + auto layer = std::make_unique( QStringLiteral( "Point?field=intf:integer" ), QStringLiteral( "point" ), QStringLiteral( "memory" ) ); QVERIFY( layer->isValid() ); QgsFeature f1( layer->dataProvider()->fields(), 1 ); f1.setAttribute( QStringLiteral( "intf" ), 1 ); @@ -1207,7 +1207,7 @@ void TestQgsLayoutTable::wrapChar() table->setHeaderTextFormat( QgsTextFormat::fromQFont( QgsFontUtils::getStandardTestFont( QStringLiteral( "Bold" ) ) ) ); table->setBackgroundColor( Qt::yellow ); - std::unique_ptr multiLineLayer = std::make_unique( QStringLiteral( "Point?field=col1:string&field=col2:string&field=col3:string" ), QStringLiteral( "multiline" ), QStringLiteral( "memory" ) ); + auto multiLineLayer = std::make_unique( QStringLiteral( "Point?field=col1:string&field=col2:string&field=col3:string" ), QStringLiteral( "multiline" ), QStringLiteral( "memory" ) ); QVERIFY( multiLineLayer->isValid() ); QgsFeature f1( multiLineLayer->dataProvider()->fields(), 1 ); f1.setAttribute( QStringLiteral( "col1" ), "multiline\nstring" ); @@ -1248,7 +1248,7 @@ void TestQgsLayoutTable::autoWrap() table->setHeaderTextFormat( QgsTextFormat::fromQFont( QgsFontUtils::getStandardTestFont( QStringLiteral( "Bold" ) ) ) ); table->setBackgroundColor( Qt::yellow ); - std::unique_ptr multiLineLayer = std::make_unique( QStringLiteral( "Point?field=col1:string&field=col2:string&field=col3:string" ), QStringLiteral( "multiline" ), QStringLiteral( "memory" ) ); + auto multiLineLayer = std::make_unique( QStringLiteral( "Point?field=col1:string&field=col2:string&field=col3:string" ), QStringLiteral( "multiline" ), QStringLiteral( "memory" ) ); QVERIFY( multiLineLayer->isValid() ); QgsFeature f1( multiLineLayer->dataProvider()->fields(), 1 ); f1.setAttribute( QStringLiteral( "col1" ), "long multiline\nstring" ); diff --git a/tests/src/core/testqgslegendrenderer.cpp b/tests/src/core/testqgslegendrenderer.cpp index 7be0df036bb3..5e0310ff4ea3 100644 --- a/tests/src/core/testqgslegendrenderer.cpp +++ b/tests/src/core/testqgslegendrenderer.cpp @@ -307,7 +307,7 @@ void TestQgsLegendRenderer::init() mRL = new QgsRasterLayer( QString( tempFileName ), QStringLiteral( "Raster Layer" ), QStringLiteral( "gdal" ) ); - std::unique_ptr rasterRenderer( new TestRasterRenderer( mRL->dataProvider(), 1, { QgsPalettedRasterRenderer::Class( 1, QColor( 0, 0, 0 ), QStringLiteral( "1" ) ), QgsPalettedRasterRenderer::Class( 2, QColor( 255, 255, 255 ), QStringLiteral( "2" ) ) } ) ); + auto rasterRenderer = std::make_unique( mRL->dataProvider(), 1, QgsPalettedRasterRenderer::ClassData { QgsPalettedRasterRenderer::Class( 1, QColor( 0, 0, 0 ), QStringLiteral( "1" ) ), QgsPalettedRasterRenderer::Class( 2, QColor( 255, 255, 255 ), QStringLiteral( "2" ) ) } ); mRL->setRenderer( rasterRenderer.release() ); QgsProject::instance()->addMapLayer( mRL ); @@ -615,13 +615,13 @@ void TestQgsLegendRenderer::testOverrideSymbol() QgsLayerTreeLayer *layer = legendModel.rootGroup()->findLayer( mVL2 ); - std::unique_ptr sym2 = std::make_unique(); + auto sym2 = std::make_unique(); sym2->setColor( Qt::red ); QgsLayerTreeModelLegendNode *embeddedNode = legendModel.legendNodeEmbeddedInParent( layer ); qgis::down_cast( embeddedNode )->setCustomSymbol( sym2.release() ); - std::unique_ptr sym3 = std::make_unique(); + auto sym3 = std::make_unique(); sym3->setColor( QColor( 0, 150, 0 ) ); sym3->setSize( 6 ); @@ -912,7 +912,7 @@ void TestQgsLegendRenderer::testMapUnits() sym->setSizeUnit( Qgis::RenderUnit::Millimeters ); catRenderer->updateCategorySymbol( 2, sym ); - std::unique_ptr root( new QgsLayerTree() ); + auto root = std::make_unique(); root->addLayer( mVL3 ); QgsLayerTreeModel legendModel( root.get() ); @@ -1074,7 +1074,7 @@ void TestQgsLegendRenderer::testFilterByMapSameSymbol() const QString testName = QStringLiteral( "legend_filter_by_map_dupe" ); - std::unique_ptr root( new QgsLayerTree() ); + auto root = std::make_unique(); root->addLayer( vl4 ); QgsLayerTreeModel legendModel( root.get() ); @@ -1101,7 +1101,7 @@ bool TestQgsLegendRenderer::_testLegendColumns( int itemCount, int columnCount, QgsFillSymbol *sym = new QgsFillSymbol(); sym->setColor( Qt::cyan ); - std::unique_ptr root( new QgsLayerTree() ); + auto root = std::make_unique(); QList layers; for ( int i = 1; i <= itemCount; ++i ) @@ -1305,7 +1305,7 @@ void TestQgsLegendRenderer::testRasterStroke() { const QString testName = QStringLiteral( "legend_raster_border" ); - std::unique_ptr root( new QgsLayerTree() ); + auto root = std::make_unique(); root->addLayer( mRL ); QgsLayerTreeModel legendModel( root.get() ); @@ -1392,7 +1392,7 @@ void TestQgsLegendRenderer::testFilterByExpressionWithContext() { const QString testName = QStringLiteral( "legend_filter_by_expression_context" ); - std::unique_ptr root = std::make_unique(); + auto root = std::make_unique(); root->addLayer( mVL3 ); QgsLayerTreeModel legendModel( root.get() ); @@ -1405,7 +1405,7 @@ void TestQgsLegendRenderer::testFilterByExpressionWithContext() QgsExpressionContext context; - std::unique_ptr scope = std::make_unique( QStringLiteral( "test_scope" ) ); + auto scope = std::make_unique( QStringLiteral( "test_scope" ) ); scope->setVariable( QStringLiteral( "test_var" ), QStringLiteral( "test_value" ) ); context.appendScope( scope.release() ); @@ -1480,7 +1480,7 @@ void TestQgsLegendRenderer::testDiagramAttributeLegend() dls.setShowAllDiagrams( true ); vl4->setDiagramLayerSettings( dls ); - std::unique_ptr root( new QgsLayerTree() ); + auto root = std::make_unique(); root->addLayer( vl4 ); QgsLayerTreeModel legendModel( root.get() ); @@ -1515,9 +1515,9 @@ void TestQgsLegendRenderer::testDiagramMeshLegend() rendererSettings.setActiveVectorDatasetGroup( vectorIndex ); layer->setRendererSettings( rendererSettings ); - std::unique_ptr root( std::make_unique() ); + auto root = std::make_unique(); root->addLayer( layer ); - std::unique_ptr legendModel( std::make_unique( root.get() ) ); + auto legendModel = std::make_unique( root.get() ); QgsLegendSettings settings; @@ -1598,7 +1598,7 @@ void TestQgsLegendRenderer::testDiagramSizeLegend() dls.setShowAllDiagrams( true ); vl4->setDiagramLayerSettings( dls ); - std::unique_ptr root( new QgsLayerTree() ); + auto root = std::make_unique(); root->addLayer( vl4 ); QgsLayerTreeModel legendModel( root.get() ); @@ -1925,7 +1925,7 @@ void TestQgsLegendRenderer::testColumnsMixedSymbolSize() QgsMarkerSymbol *sym = new QgsMarkerSymbol(); sym->setColor( Qt::cyan ); - std::unique_ptr root( new QgsLayerTree() ); + auto root = std::make_unique(); QList layers; for ( double size : { 4, 5, 16 } ) @@ -2140,7 +2140,7 @@ void TestQgsLegendRenderer::testLabelLegend() void TestQgsLegendRenderer::testHeatmap() { - std::unique_ptr root( new QgsLayerTree() ); + auto root = std::make_unique(); QgsVectorLayer *vl = new QgsVectorLayer( QStringLiteral( "Points" ), QStringLiteral( "Points" ), QStringLiteral( "memory" ) ); QgsProject::instance()->addMapLayer( vl ); diff --git a/tests/src/core/testqgslinefillsymbol.cpp b/tests/src/core/testqgslinefillsymbol.cpp index 5330f54c81f2..5204ec891342 100644 --- a/tests/src/core/testqgslinefillsymbol.cpp +++ b/tests/src/core/testqgslinefillsymbol.cpp @@ -144,7 +144,7 @@ void TestQgsLineFillSymbol::lineFillSymbol() void TestQgsLineFillSymbol::lineFillSymbolVector() { - std::unique_ptr layer = std::make_unique( mTestDataDir + "polys.shp" ); + auto layer = std::make_unique( mTestDataDir + "polys.shp" ); QVERIFY( layer->isValid() ); QgsLinePatternFillSymbolLayer *lineFill = new QgsLinePatternFillSymbolLayer(); @@ -165,7 +165,7 @@ void TestQgsLineFillSymbol::lineFillSymbolVector() void TestQgsLineFillSymbol::viewportLineFillSymbol() { - std::unique_ptr layer = std::make_unique( mTestDataDir + "polys.shp" ); + auto layer = std::make_unique( mTestDataDir + "polys.shp" ); QVERIFY( layer->isValid() ); QgsVectorSimplifyMethod simplifyMethod; @@ -191,7 +191,7 @@ void TestQgsLineFillSymbol::viewportLineFillSymbol() void TestQgsLineFillSymbol::viewportLineFillSymbolVector() { - std::unique_ptr layer = std::make_unique( mTestDataDir + "polys.shp" ); + auto layer = std::make_unique( mTestDataDir + "polys.shp" ); QVERIFY( layer->isValid() ); QgsLinePatternFillSymbolLayer *lineFill = new QgsLinePatternFillSymbolLayer(); @@ -222,7 +222,7 @@ void TestQgsLineFillSymbol::lineFillSymbolOffset() void TestQgsLineFillSymbol::lineFillSymbolOffsetVector() { - std::unique_ptr layer = std::make_unique( mTestDataDir + "polys.shp" ); + auto layer = std::make_unique( mTestDataDir + "polys.shp" ); QVERIFY( layer->isValid() ); QgsLinePatternFillSymbolLayer *lineFill = new QgsLinePatternFillSymbolLayer(); @@ -258,7 +258,7 @@ void TestQgsLineFillSymbol::lineFillLargeOffset() void TestQgsLineFillSymbol::lineFillLargeOffsetVector() { // test line fill with large offset compared to line distance - std::unique_ptr layer = std::make_unique( mTestDataDir + "polys.shp" ); + auto layer = std::make_unique( mTestDataDir + "polys.shp" ); QVERIFY( layer->isValid() ); QgsLinePatternFillSymbolLayer *lineFill = new QgsLinePatternFillSymbolLayer(); @@ -293,7 +293,7 @@ void TestQgsLineFillSymbol::lineFillNegativeAngle() void TestQgsLineFillSymbol::lineFillNegativeAngleVector() { - std::unique_ptr layer = std::make_unique( mTestDataDir + "polys.shp" ); + auto layer = std::make_unique( mTestDataDir + "polys.shp" ); QVERIFY( layer->isValid() ); QgsLinePatternFillSymbolLayer *lineFill = new QgsLinePatternFillSymbolLayer(); @@ -317,7 +317,7 @@ void TestQgsLineFillSymbol::lineFillNegativeAngleVector() void TestQgsLineFillSymbol::lineFillClipPainter() { // test clipping using painter path - std::unique_ptr layer = std::make_unique( mTestDataDir + "polys.shp" ); + auto layer = std::make_unique( mTestDataDir + "polys.shp" ); QVERIFY( layer->isValid() ); QgsLinePatternFillSymbolLayer *lineFill = new QgsLinePatternFillSymbolLayer(); @@ -356,7 +356,7 @@ void TestQgsLineFillSymbol::lineFillClipPainter() void TestQgsLineFillSymbol::lineFillClipIntersection() { // test clipping using intersections - std::unique_ptr layer = std::make_unique( mTestDataDir + "polys.shp" ); + auto layer = std::make_unique( mTestDataDir + "polys.shp" ); QVERIFY( layer->isValid() ); QgsLinePatternFillSymbolLayer *lineFill = new QgsLinePatternFillSymbolLayer(); @@ -395,7 +395,7 @@ void TestQgsLineFillSymbol::lineFillClipIntersection() void TestQgsLineFillSymbol::lineFillNoClip() { // test no clipping - std::unique_ptr layer = std::make_unique( mTestDataDir + "polys.shp" ); + auto layer = std::make_unique( mTestDataDir + "polys.shp" ); QVERIFY( layer->isValid() ); QgsLinePatternFillSymbolLayer *lineFill = new QgsLinePatternFillSymbolLayer(); @@ -434,7 +434,7 @@ void TestQgsLineFillSymbol::lineFillNoClip() void TestQgsLineFillSymbol::lineFillDataDefinedClip() { // test data defined clipping - std::unique_ptr layer = std::make_unique( mTestDataDir + "polys.shp" ); + auto layer = std::make_unique( mTestDataDir + "polys.shp" ); QVERIFY( layer->isValid() ); QgsLinePatternFillSymbolLayer *lineFill = new QgsLinePatternFillSymbolLayer(); diff --git a/tests/src/core/testqgsmaplayer.cpp b/tests/src/core/testqgsmaplayer.cpp index 47e6f2d5a6e9..b4a99607aa00 100644 --- a/tests/src/core/testqgsmaplayer.cpp +++ b/tests/src/core/testqgsmaplayer.cpp @@ -23,6 +23,7 @@ //qgis includes... #include +#include #include #include #include @@ -73,6 +74,8 @@ class TestQgsMapLayer : public QObject void readCustomProperties(); + void publicSourceOnGdalWithCredentials(); + private: QgsVectorLayer *mpLayer = nullptr; }; @@ -116,7 +119,7 @@ void TestQgsMapLayer::isValid() void TestQgsMapLayer::testId() { - std::unique_ptr layer = std::make_unique( QStringLiteral( "Point" ), QStringLiteral( "a" ), QStringLiteral( "memory" ) ); + auto layer = std::make_unique( QStringLiteral( "Point" ), QStringLiteral( "a" ), QStringLiteral( "memory" ) ); QSignalSpy spy( layer.get(), &QgsMapLayer::idChanged ); QVERIFY( layer->setId( QStringLiteral( "my forced id" ) ) ); QCOMPARE( layer->id(), QStringLiteral( "my forced id" ) ); @@ -427,7 +430,7 @@ void TestQgsMapLayer::notify() void TestQgsMapLayer::customEnumFlagProperties() { - std::unique_ptr ml = std::make_unique( QStringLiteral( "Point" ), QStringLiteral( "name" ), QStringLiteral( "memory" ) ); + auto ml = std::make_unique( QStringLiteral( "Point" ), QStringLiteral( "name" ), QStringLiteral( "memory" ) ); // assign to inexisting property ml->setCustomProperty( QStringLiteral( "my_property_for_units" ), -1 ); @@ -479,7 +482,7 @@ void TestQgsMapLayer::customEnumFlagProperties() void TestQgsMapLayer::readCustomProperties() { - std::unique_ptr ml = std::make_unique( QStringLiteral( "Point" ), QStringLiteral( "name" ), QStringLiteral( "memory" ) ); + auto ml = std::make_unique( QStringLiteral( "Point" ), QStringLiteral( "name" ), QStringLiteral( "memory" ) ); // assign to inexisting property ml->setCustomProperty( QStringLiteral( "my_property_one" ), 42 ); @@ -510,5 +513,15 @@ void TestQgsMapLayer::readCustomProperties() QCOMPARE( spy.at( 1 ).at( 0 ), "my_property_two" ); } +void TestQgsMapLayer::publicSourceOnGdalWithCredentials() +{ + QgsRasterLayer rl( + QStringLiteral( "test.tif|option:AN=OPTION|credential:SOMEKEY=AAAAA|credential:ANOTHER=BBB" ), QString(), QStringLiteral( "gdal" ) + ); + QCOMPARE( rl.publicSource( true ), QStringLiteral( "test.tif|option:AN=OPTION|credential:ANOTHER=XXXXXXXX|credential:SOMEKEY=XXXXXXXX" ) ); + QCOMPARE( rl.publicSource( false ), QStringLiteral( "test.tif|option:AN=OPTION" ) ); + QCOMPARE( rl.publicSource(), QStringLiteral( "test.tif|option:AN=OPTION" ) ); +} + QGSTEST_MAIN( TestQgsMapLayer ) #include "testqgsmaplayer.moc" diff --git a/tests/src/core/testqgsmaplayerstylemanager.cpp b/tests/src/core/testqgsmaplayerstylemanager.cpp index 03584f2fb04d..718f564b7bce 100644 --- a/tests/src/core/testqgsmaplayerstylemanager.cpp +++ b/tests/src/core/testqgsmaplayerstylemanager.cpp @@ -203,8 +203,8 @@ void TestQgsMapLayerStyleManager::testSwitchingStyles() void TestQgsMapLayerStyleManager::testCopyStyles() { - std::unique_ptr lines = std::make_unique( QStringLiteral( "LineString" ), QStringLiteral( "Line Layer" ), QStringLiteral( "memory" ) ); - std::unique_ptr lines2 = std::make_unique( QStringLiteral( "LineString" ), QStringLiteral( "Line Layer" ), QStringLiteral( "memory" ) ); + auto lines = std::make_unique( QStringLiteral( "LineString" ), QStringLiteral( "Line Layer" ), QStringLiteral( "memory" ) ); + auto lines2 = std::make_unique( QStringLiteral( "LineString" ), QStringLiteral( "Line Layer" ), QStringLiteral( "memory" ) ); QgsMapLayerStyleManager *sm = lines->styleManager(); diff --git a/tests/src/core/testqgsmaprendererjob.cpp b/tests/src/core/testqgsmaprendererjob.cpp index 40b56d36d89a..0ccd5f8416be 100644 --- a/tests/src/core/testqgsmaprendererjob.cpp +++ b/tests/src/core/testqgsmaprendererjob.cpp @@ -38,7 +38,6 @@ #include "qgsproject.h" #include "qgsrenderedfeaturehandlerinterface.h" #include "qgsmaprendererstagedrenderjob.h" -#include "qgsmultirenderchecker.h" #include "qgspallabeling.h" #include "qgsvectorlayerlabeling.h" #include "qgsfontutils.h" @@ -53,9 +52,6 @@ #include "qgsfillsymbol.h" #include "qgsrasterlayerelevationproperties.h" -//qgs unit test utility class -#include "qgsmultirenderchecker.h" - /** * \ingroup UnitTests * This is a unit test for the QgsMapRendererJob class. @@ -68,7 +64,7 @@ class TestQgsMapRendererJob : public QgsTest public: TestQgsMapRendererJob() - : QgsTest( QStringLiteral( "Map Renderer Job Tests" ) ) {} + : QgsTest( QStringLiteral( "Map Renderer Job Tests" ), QStringLiteral( "map_renderer" ) ) {} ~TestQgsMapRendererJob() override { @@ -105,8 +101,6 @@ class TestQgsMapRendererJob : public QgsTest void testMapShading(); private: - bool imageCheck( const QString &type, const QImage &image, int mismatchCount = 0 ); - QString mEncoding; QgsVectorFileWriter::WriterError mError = QgsVectorFileWriter::NoError; QgsCoordinateReferenceSystem mCRS; @@ -220,14 +214,8 @@ void TestQgsMapRendererJob::cleanupTestCase() void TestQgsMapRendererJob::performanceTest() { mMapSettings->setExtent( mpPolysLayer->extent() ); - QgsRenderChecker myChecker; - myChecker.setControlName( QStringLiteral( "expected_maprender" ) ); mMapSettings->setFlag( Qgis::MapSettingsFlag::Antialiasing ); - myChecker.setMapSettings( *mMapSettings ); - myChecker.setColorTolerance( 5 ); - bool myResultFlag = myChecker.runTest( QStringLiteral( "maprender" ) ); - mReport += myChecker.report(); - QVERIFY( myResultFlag ); + QGSVERIFYRENDERMAPSETTINGSCHECK( QStringLiteral( "maprender" ), QStringLiteral( "maprender" ), *mMapSettings, 0, 5 ); } void TestQgsMapRendererJob::testFourAdjacentTiles_data() @@ -239,7 +227,7 @@ void TestQgsMapRendererJob::testFourAdjacentTiles_data() QString shapeFile = TEST_DATA_DIR + QStringLiteral( "/france_parts.shp" ); QString qmlFile = TEST_DATA_DIR + QStringLiteral( "/adjacent_tiles/line_pattern_30_degree.qml" ); - QString controlName = QStringLiteral( "expected_adjacent_line_fill" ); + QString controlName = QStringLiteral( "adjacent_line_fill" ); QStringList bboxList1; bboxList1 << QStringLiteral( "-1.5,48,-0.5,49" ); @@ -250,13 +238,13 @@ void TestQgsMapRendererJob::testFourAdjacentTiles_data() QTest::newRow( "adjacent_line_fill" ) << bboxList1 << controlName << shapeFile << qmlFile; qmlFile = TEST_DATA_DIR + QStringLiteral( "/adjacent_tiles/point_pattern_simple_marker.qml" ); - controlName = QStringLiteral( "expected_adjacent_marker_fill" ); + controlName = QStringLiteral( "adjacent_marker_fill" ); QTest::newRow( "adjacent_marker_fill" ) << bboxList1 << controlName << shapeFile << qmlFile; shapeFile = TEST_DATA_DIR + QStringLiteral( "/lines.shp" ); qmlFile = TEST_DATA_DIR + QStringLiteral( "/adjacent_tiles/simple_line_dashed.qml" ); - controlName = QStringLiteral( "expected_adjacent_dashed_line" ); + controlName = QStringLiteral( "adjacent_dashed_line" ); QStringList bboxList2; bboxList2 << QStringLiteral( "-105,35,-95,45" ); @@ -333,19 +321,9 @@ void TestQgsMapRendererJob::testFourAdjacentTiles() QgsProject::instance()->removeMapLayers( QStringList() << vectorLayer->id() ); - QString renderedImagePath = QDir::tempPath() + "/" + QTest::currentDataTag() + QStringLiteral( ".png" ); - globalImage.save( renderedImagePath ); - - QgsRenderChecker checker; - - checker.setControlPathPrefix( QStringLiteral( "adjacent_tiles" ) ); - checker.setControlName( controlName ); - bool result = checker.compareImages( QTest::currentDataTag(), 100, renderedImagePath ); - mReport += checker.report(); - QVERIFY( result ); + QGSVERIFYIMAGECHECK( QTest::currentDataTag(), controlName, globalImage, QString(), 100 ); } - class TestHandler : public QgsRenderedFeatureHandlerInterface { public: @@ -378,11 +356,11 @@ class TestHandler : public QgsRenderedFeatureHandlerInterface void TestQgsMapRendererJob::testRenderedFeatureHandlers() { - std::unique_ptr pointsLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/points.shp" ), QStringLiteral( "points" ), QStringLiteral( "ogr" ) ); + auto pointsLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/points.shp" ), QStringLiteral( "points" ), QStringLiteral( "ogr" ) ); QVERIFY( pointsLayer->isValid() ); - std::unique_ptr linesLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/lines.shp" ), QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ); + auto linesLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/lines.shp" ), QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ); QVERIFY( linesLayer->isValid() ); - std::unique_ptr polygonsLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/polys.shp" ), QStringLiteral( "polys" ), QStringLiteral( "ogr" ) ); + auto polygonsLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/polys.shp" ), QStringLiteral( "polys" ), QStringLiteral( "ogr" ) ); QVERIFY( polygonsLayer->isValid() ); QgsMapSettings mapSettings; @@ -488,13 +466,13 @@ void TestQgsMapRendererJob::stagedRenderer() { // test the staged map renderer job subclass - std::unique_ptr pointsLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/points.shp" ), QStringLiteral( "points" ), QStringLiteral( "ogr" ) ); + auto pointsLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/points.shp" ), QStringLiteral( "points" ), QStringLiteral( "ogr" ) ); QVERIFY( pointsLayer->isValid() ); - std::unique_ptr linesLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/lines.shp" ), QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ); + auto linesLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/lines.shp" ), QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ); QVERIFY( linesLayer->isValid() ); - std::unique_ptr polygonsLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/polys.shp" ), QStringLiteral( "polys" ), QStringLiteral( "ogr" ) ); + auto polygonsLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/polys.shp" ), QStringLiteral( "polys" ), QStringLiteral( "ogr" ) ); QVERIFY( polygonsLayer->isValid() ); - std::unique_ptr rasterLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/raster_layer.tiff" ), QStringLiteral( "raster" ), QStringLiteral( "gdal" ) ); + auto rasterLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/raster_layer.tiff" ), QStringLiteral( "raster" ), QStringLiteral( "gdal" ) ); QVERIFY( rasterLayer->isValid() ); QgsMapSettings mapSettings; @@ -504,7 +482,7 @@ void TestQgsMapRendererJob::stagedRenderer() mapSettings.setFlag( Qgis::MapSettingsFlag::DrawLabeling, false ); mapSettings.setOutputDpi( 96 ); - std::unique_ptr job = std::make_unique( mapSettings ); + auto job = std::make_unique( mapSettings ); job->start(); // nothing to render QVERIFY( job->isFinished() ); @@ -526,7 +504,7 @@ void TestQgsMapRendererJob::stagedRenderer() QPainter painter( &im ); QVERIFY( job->renderCurrentPart( &painter ) ); painter.end(); - QVERIFY( imageCheck( QStringLiteral( "staged_render1" ), im ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "staged_render1" ), QStringLiteral( "staged_render1" ), im, QString(), 0, QSize(), 2 ); QVERIFY( !job->isFinished() ); QVERIFY( job->nextPart() ); QCOMPARE( job->currentLayerId(), rasterLayer->id() ); @@ -538,7 +516,7 @@ void TestQgsMapRendererJob::stagedRenderer() painter.begin( &im ); QVERIFY( job->renderCurrentPart( &painter ) ); painter.end(); - QVERIFY( imageCheck( QStringLiteral( "staged_render_raster" ), im ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "staged_render_raster" ), QStringLiteral( "staged_render_raster" ), im, QString(), 0, QSize(), 2 ); QVERIFY( !job->isFinished() ); QVERIFY( job->nextPart() ); QCOMPARE( job->currentLayerId(), linesLayer->id() ); @@ -550,7 +528,7 @@ void TestQgsMapRendererJob::stagedRenderer() painter.begin( &im ); QVERIFY( job->renderCurrentPart( &painter ) ); painter.end(); - QVERIFY( imageCheck( QStringLiteral( "staged_render2" ), im ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "staged_render2" ), QStringLiteral( "staged_render2" ), im, QString(), 0, QSize(), 2 ); QVERIFY( !job->isFinished() ); QVERIFY( job->nextPart() ); QCOMPARE( job->currentLayerId(), pointsLayer->id() ); @@ -562,7 +540,7 @@ void TestQgsMapRendererJob::stagedRenderer() painter.begin( &im ); QVERIFY( job->renderCurrentPart( &painter ) ); painter.end(); - QVERIFY( imageCheck( QStringLiteral( "staged_render3" ), im ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "staged_render3" ), QStringLiteral( "staged_render3" ), im, QString(), 0, QSize(), 2 ); // nothing left! QVERIFY( !job->nextPart() ); @@ -600,7 +578,7 @@ void TestQgsMapRendererJob::stagedRenderer() painter.begin( &im ); QVERIFY( job->renderCurrentPart( &painter ) ); painter.end(); - QVERIFY( imageCheck( QStringLiteral( "staged_render1" ), im ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "staged_render1" ), QStringLiteral( "staged_render1" ), im, QString(), 0, QSize(), 2 ); QVERIFY( job->nextPart() ); QVERIFY( !job->isFinished() ); QCOMPARE( job->currentLayerId(), rasterLayer->id() ); @@ -612,7 +590,7 @@ void TestQgsMapRendererJob::stagedRenderer() painter.begin( &im ); QVERIFY( job->renderCurrentPart( &painter ) ); painter.end(); - QVERIFY( imageCheck( QStringLiteral( "staged_render_raster" ), im ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "staged_render_raster" ), QStringLiteral( "staged_render_raster" ), im, QString(), 0, QSize(), 2 ); QVERIFY( job->nextPart() ); QVERIFY( !job->isFinished() ); QCOMPARE( job->currentLayerId(), linesLayer->id() ); @@ -624,7 +602,7 @@ void TestQgsMapRendererJob::stagedRenderer() painter.begin( &im ); QVERIFY( job->renderCurrentPart( &painter ) ); painter.end(); - QVERIFY( imageCheck( QStringLiteral( "staged_render2" ), im ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "staged_render2" ), QStringLiteral( "staged_render2" ), im, QString(), 0, QSize(), 2 ); QVERIFY( job->nextPart() ); QVERIFY( !job->isFinished() ); QCOMPARE( job->currentLayerId(), pointsLayer->id() ); @@ -636,7 +614,7 @@ void TestQgsMapRendererJob::stagedRenderer() painter.begin( &im ); QVERIFY( job->renderCurrentPart( &painter ) ); painter.end(); - QVERIFY( imageCheck( QStringLiteral( "staged_render3" ), im ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "staged_render3" ), QStringLiteral( "staged_render3" ), im, QString(), 0, QSize(), 2 ); QVERIFY( job->nextPart() ); QVERIFY( !job->isFinished() ); QVERIFY( job->currentLayerId().isEmpty() ); @@ -647,7 +625,7 @@ void TestQgsMapRendererJob::stagedRenderer() painter.begin( &im ); QVERIFY( job->renderCurrentPart( &painter ) ); painter.end(); - QVERIFY( imageCheck( QStringLiteral( "staged_render_points_labels" ), im ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "staged_render_points_labels" ), QStringLiteral( "staged_render_points_labels" ), im, QString(), 0, QSize(), 2 ); // nothing left! QVERIFY( !job->nextPart() ); @@ -663,11 +641,11 @@ void TestQgsMapRendererJob::stagedRendererWithStagedLabeling() { // test the staged map renderer job subclass, when using staged labeling - std::unique_ptr pointsLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/points.shp" ), QStringLiteral( "points" ), QStringLiteral( "ogr" ) ); + auto pointsLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/points.shp" ), QStringLiteral( "points" ), QStringLiteral( "ogr" ) ); QVERIFY( pointsLayer->isValid() ); - std::unique_ptr linesLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/lines.shp" ), QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ); + auto linesLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/lines.shp" ), QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ); QVERIFY( linesLayer->isValid() ); - std::unique_ptr polygonsLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/polys.shp" ), QStringLiteral( "polys" ), QStringLiteral( "ogr" ) ); + auto polygonsLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/polys.shp" ), QStringLiteral( "polys" ), QStringLiteral( "ogr" ) ); QVERIFY( polygonsLayer->isValid() ); QgsMapSettings mapSettings; @@ -677,7 +655,7 @@ void TestQgsMapRendererJob::stagedRendererWithStagedLabeling() mapSettings.setFlag( Qgis::MapSettingsFlag::DrawLabeling, false ); mapSettings.setOutputDpi( 96 ); - std::unique_ptr job = std::make_unique( mapSettings, QgsMapRendererStagedRenderJob::RenderLabelsByMapLayer ); + auto job = std::make_unique( mapSettings, QgsMapRendererStagedRenderJob::RenderLabelsByMapLayer ); job->start(); // nothing to render QVERIFY( job->isFinished() ); @@ -699,7 +677,7 @@ void TestQgsMapRendererJob::stagedRendererWithStagedLabeling() QPainter painter( &im ); QVERIFY( job->renderCurrentPart( &painter ) ); painter.end(); - QVERIFY( imageCheck( QStringLiteral( "staged_render1" ), im ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "staged_render1" ), QStringLiteral( "staged_render1" ), im, QString(), 0, QSize(), 2 ); QVERIFY( !job->isFinished() ); QVERIFY( job->nextPart() ); QCOMPARE( job->currentLayerId(), linesLayer->id() ); @@ -711,7 +689,7 @@ void TestQgsMapRendererJob::stagedRendererWithStagedLabeling() painter.begin( &im ); QVERIFY( job->renderCurrentPart( &painter ) ); painter.end(); - QVERIFY( imageCheck( QStringLiteral( "staged_render2" ), im ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "staged_render2" ), QStringLiteral( "staged_render2" ), im, QString(), 0, QSize(), 2 ); QVERIFY( !job->isFinished() ); QVERIFY( job->nextPart() ); QCOMPARE( job->currentLayerId(), pointsLayer->id() ); @@ -723,7 +701,7 @@ void TestQgsMapRendererJob::stagedRendererWithStagedLabeling() painter.begin( &im ); QVERIFY( job->renderCurrentPart( &painter ) ); painter.end(); - QVERIFY( imageCheck( QStringLiteral( "staged_render3" ), im ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "staged_render3" ), QStringLiteral( "staged_render3" ), im, QString(), 0, QSize(), 2 ); // nothing left! QVERIFY( !job->nextPart() ); @@ -775,7 +753,7 @@ void TestQgsMapRendererJob::stagedRendererWithStagedLabeling() painter.begin( &im ); QVERIFY( job->renderCurrentPart( &painter ) ); painter.end(); - QVERIFY( imageCheck( QStringLiteral( "staged_render1" ), im ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "staged_render1" ), QStringLiteral( "staged_render1" ), im, QString(), 0, QSize(), 2 ); QVERIFY( job->nextPart() ); QVERIFY( !job->isFinished() ); QCOMPARE( job->currentLayerId(), linesLayer->id() ); @@ -787,7 +765,7 @@ void TestQgsMapRendererJob::stagedRendererWithStagedLabeling() painter.begin( &im ); QVERIFY( job->renderCurrentPart( &painter ) ); painter.end(); - QVERIFY( imageCheck( QStringLiteral( "staged_render2" ), im ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "staged_render2" ), QStringLiteral( "staged_render2" ), im, QString(), 0, QSize(), 2 ); QVERIFY( job->nextPart() ); QVERIFY( !job->isFinished() ); QCOMPARE( job->currentLayerId(), pointsLayer->id() ); @@ -799,7 +777,7 @@ void TestQgsMapRendererJob::stagedRendererWithStagedLabeling() painter.begin( &im ); QVERIFY( job->renderCurrentPart( &painter ) ); painter.end(); - QVERIFY( imageCheck( QStringLiteral( "staged_render3" ), im ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "staged_render3" ), QStringLiteral( "staged_render3" ), im, QString(), 0, QSize(), 2 ); // points labels (these must be in z-order!) QVERIFY( job->nextPart() ); @@ -811,7 +789,7 @@ void TestQgsMapRendererJob::stagedRendererWithStagedLabeling() painter.begin( &im ); QVERIFY( job->renderCurrentPart( &painter ) ); painter.end(); - QVERIFY( imageCheck( QStringLiteral( "staged_render_points_staged_labels" ), im ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "staged_render_points_staged_labels" ), QStringLiteral( "staged_render_points_staged_labels" ), im, QString(), 0, QSize(), 2 ); // polygon labels QVERIFY( job->nextPart() ); @@ -824,7 +802,7 @@ void TestQgsMapRendererJob::stagedRendererWithStagedLabeling() painter.begin( &im ); QVERIFY( job->renderCurrentPart( &painter ) ); painter.end(); - QVERIFY( imageCheck( QStringLiteral( "staged_render_polygons_staged_labels" ), im ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "staged_render_polygons_staged_labels" ), QStringLiteral( "staged_render_polygons_staged_labels" ), im, QString(), 0, QSize(), 2 ); // line labels QVERIFY( job->nextPart() ); @@ -837,7 +815,7 @@ void TestQgsMapRendererJob::stagedRendererWithStagedLabeling() painter.begin( &im ); QVERIFY( job->renderCurrentPart( &painter ) ); painter.end(); - QVERIFY( imageCheck( QStringLiteral( "staged_render_lines_staged_labels" ), im ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "staged_render_lines_staged_labels" ), QStringLiteral( "staged_render_lines_staged_labels" ), im, QString(), 0, QSize(), 2 ); // nothing left! QVERIFY( !job->nextPart() ); @@ -851,13 +829,13 @@ void TestQgsMapRendererJob::stagedRendererWithStagedLabeling() void TestQgsMapRendererJob::vectorLayerBoundsWithReprojection() { - std::unique_ptr gridLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/grid_4326.geojson" ), QStringLiteral( "grid" ), QStringLiteral( "ogr" ) ); + auto gridLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/grid_4326.geojson" ), QStringLiteral( "grid" ), QStringLiteral( "ogr" ) ); QVERIFY( gridLayer->isValid() ); - std::unique_ptr symbol = std::make_unique(); + auto symbol = std::make_unique(); symbol->setColor( QColor( 255, 0, 255 ) ); symbol->setWidth( 2 ); - std::unique_ptr renderer = std::make_unique( symbol.release() ); + auto renderer = std::make_unique( symbol.release() ); gridLayer->setRenderer( renderer.release() ); QgsMapSettings mapSettings; @@ -873,12 +851,12 @@ void TestQgsMapRendererJob::vectorLayerBoundsWithReprojection() renderJob.start(); renderJob.waitForFinished(); QImage img = renderJob.renderedImage(); - QVERIFY( imageCheck( QStringLiteral( "vector_layer_bounds_with_reprojection" ), img ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "vector_layer_bounds_with_reprojection" ), QStringLiteral( "vector_layer_bounds_with_reprojection" ), img, QString(), 0, QSize(), 2 ); } void TestQgsMapRendererJob::temporalRender() { - std::unique_ptr rasterLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/raster_layer.tiff" ), QStringLiteral( "raster" ), QStringLiteral( "gdal" ) ); + auto rasterLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/raster_layer.tiff" ), QStringLiteral( "raster" ), QStringLiteral( "gdal" ) ); QVERIFY( rasterLayer->isValid() ); QgsMapSettings mapSettings; @@ -893,7 +871,7 @@ void TestQgsMapRendererJob::temporalRender() renderJob.start(); renderJob.waitForFinished(); QImage img = renderJob.renderedImage(); - QVERIFY( imageCheck( QStringLiteral( "temporal_render_visible" ), img ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "temporal_render_visible" ), QStringLiteral( "temporal_render_visible" ), img, QString(), 0, QSize(), 2 ); // set temporal properties for layer QgsRasterLayerTemporalProperties *temporalProperties = qobject_cast( rasterLayer->temporalProperties() ); @@ -906,7 +884,7 @@ void TestQgsMapRendererJob::temporalRender() renderJob2.start(); renderJob2.waitForFinished(); img = renderJob2.renderedImage(); - QVERIFY( imageCheck( QStringLiteral( "temporal_render_visible" ), img ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "temporal_render_visible" ), QStringLiteral( "temporal_render_visible" ), img, QString(), 0, QSize(), 2 ); // make render job temporal, outside of layer's fixed range mapSettings.setIsTemporal( true ); @@ -916,7 +894,7 @@ void TestQgsMapRendererJob::temporalRender() renderJob3.start(); renderJob3.waitForFinished(); img = renderJob3.renderedImage(); - QVERIFY( imageCheck( QStringLiteral( "temporal_render_invisible" ), img ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "temporal_render_invisible" ), QStringLiteral( "temporal_render_invisible" ), img, QString(), 0, QSize(), 2 ); // temporal range ok for layer mapSettings.setTemporalRange( QgsDateTimeRange( QDateTime( QDate( 2020, 1, 2 ), QTime( 0, 0, 0 ) ), QDateTime( QDate( 2020, 1, 3 ), QTime( 0, 0, 0 ) ) ) ); @@ -925,7 +903,7 @@ void TestQgsMapRendererJob::temporalRender() renderJob4.start(); renderJob4.waitForFinished(); img = renderJob4.renderedImage(); - QVERIFY( imageCheck( QStringLiteral( "temporal_render_visible" ), img ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "temporal_render_visible" ), QStringLiteral( "temporal_render_visible" ), img, QString(), 0, QSize(), 2 ); } class TestLabelSink : public QgsLabelSink @@ -947,7 +925,7 @@ class TestLabelSink : public QgsLabelSink void TestQgsMapRendererJob::labelSink() { - std::unique_ptr pointsLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/points.shp" ), QStringLiteral( "points" ), QStringLiteral( "ogr" ) ); + auto pointsLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/points.shp" ), QStringLiteral( "points" ), QStringLiteral( "ogr" ) ); QVERIFY( pointsLayer->isValid() ); QgsPalLayerSettings settings; @@ -974,18 +952,18 @@ void TestQgsMapRendererJob::labelSink() QgsMapRendererSequentialJob renderJob( mapSettings ); - std::unique_ptr labelSink = std::make_unique(); + auto labelSink = std::make_unique(); renderJob.setLabelSink( labelSink.get() ); renderJob.start(); renderJob.waitForFinished(); QImage img = renderJob.renderedImage(); - QVERIFY( imageCheck( QStringLiteral( "label_sink" ), img ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "label_sink" ), QStringLiteral( "label_sink" ), img, QString(), 0, QSize(), 2 ); QCOMPARE( labelSink->drawnCount, 17 ); } void TestQgsMapRendererJob::skipSymbolRendering() { - std::unique_ptr pointsLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/points.shp" ), QStringLiteral( "points" ), QStringLiteral( "ogr" ) ); + auto pointsLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/points.shp" ), QStringLiteral( "points" ), QStringLiteral( "ogr" ) ); QVERIFY( pointsLayer->isValid() ); QgsPalLayerSettings settings; @@ -1014,12 +992,12 @@ void TestQgsMapRendererJob::skipSymbolRendering() renderJob.start(); renderJob.waitForFinished(); QImage img = renderJob.renderedImage(); - QVERIFY( imageCheck( QStringLiteral( "skip_symbol_rendering" ), img ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "skip_symbol_rendering" ), QStringLiteral( "skip_symbol_rendering" ), img, QString(), 0, QSize(), 2 ); } void TestQgsMapRendererJob::customNullPainterJob() { - std::unique_ptr pointsLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/points.shp" ), QStringLiteral( "points" ), QStringLiteral( "ogr" ) ); + auto pointsLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/points.shp" ), QStringLiteral( "points" ), QStringLiteral( "ogr" ) ); QVERIFY( pointsLayer->isValid() ); QgsPalLayerSettings settings; @@ -1043,14 +1021,14 @@ void TestQgsMapRendererJob::customNullPainterJob() mapSettings.setOutputDpi( 96 ); mapSettings.setLayers( QList() << pointsLayer.get() ); - std::unique_ptr nullPaintDevice = std::make_unique(); + auto nullPaintDevice = std::make_unique(); nullPaintDevice->setOutputSize( QSize( 512, 512 ) ); nullPaintDevice->setOutputDpi( 96 ); - std::unique_ptr painter = std::make_unique( nullPaintDevice.get() ); + auto painter = std::make_unique( nullPaintDevice.get() ); QgsMapRendererCustomPainterJob renderJob( mapSettings, painter.get() ); - std::unique_ptr labelSink = std::make_unique(); + auto labelSink = std::make_unique(); renderJob.setLabelSink( labelSink.get() ); renderJob.start(); @@ -1061,7 +1039,7 @@ void TestQgsMapRendererJob::customNullPainterJob() void TestQgsMapRendererJob::testMapShading() { - std::unique_ptr pointCloudLayer = std::make_unique( + auto pointCloudLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/point_clouds/ept/lone-star-laszip/ept.json" ), QStringLiteral( "point-cloud" ), QStringLiteral( "ept" ) @@ -1072,7 +1050,7 @@ void TestQgsMapRendererJob::testMapShading() pointCloudRenderer->setDrawOrder2d( Qgis::PointCloudDrawOrder::BottomToTop ); pointCloudLayer->setRenderer( pointCloudRenderer.release() ); - std::unique_ptr rasterLayer = std::make_unique( + auto rasterLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/raster/raster_shading.tif" ), QStringLiteral( "raster" ), QStringLiteral( "gdal" ) @@ -1082,14 +1060,14 @@ void TestQgsMapRendererJob::testMapShading() rasterLayer->dataProvider()->enableProviderResampling( true ); rasterLayer->dataProvider()->setZoomedOutResamplingMethod( Qgis::RasterResamplingMethod::Cubic ); - std::unique_ptr meshLayer = std::make_unique( + auto meshLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/mesh/mesh_shading.nc" ), QStringLiteral( "mesh" ), QStringLiteral( "mdal" ) ); QVERIFY( meshLayer->isValid() ); - std::unique_ptr vectorLayer = std::make_unique( + auto vectorLayer = std::make_unique( QStringLiteral( "Polygon?crs=%1&field=id:integer&field=name:string(20)&index=no" ) .arg( pointCloudLayer->crs().toWkt( Qgis::CrsWktVariant::Preferred ) ), QStringLiteral( "vector-layer" ), @@ -1120,11 +1098,11 @@ void TestQgsMapRendererJob::testMapShading() shadingRenderer.setActiveHillshading( true ); shadingRenderer.setActiveEyeDomeLighting( false ); mapSettings.setElevationShadingRenderer( shadingRenderer ); - std::unique_ptr renderJob( new QgsMapRendererSequentialJob( mapSettings ) ); + auto renderJob = std::make_unique( mapSettings ); renderJob->start(); renderJob->waitForFinished(); QImage img = renderJob->renderedImage(); - QVERIFY( imageCheck( QStringLiteral( "render_shading_1" ), img ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "render_shading_1" ), QStringLiteral( "render_shading_1" ), img, QString(), 0, QSize(), 2 ); shadingRenderer.setLightAltitude( 20 ); shadingRenderer.setLightAzimuth( 60 ); @@ -1133,7 +1111,7 @@ void TestQgsMapRendererJob::testMapShading() renderJob->start(); renderJob->waitForFinished(); img = renderJob->renderedImage(); - QVERIFY( imageCheck( QStringLiteral( "render_shading_2" ), img ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "render_shading_2" ), QStringLiteral( "render_shading_2" ), img, QString(), 0, QSize(), 2 ); shadingRenderer.setHillshadingMultidirectional( true ); shadingRenderer.setHillshadingZFactor( 5 ); @@ -1142,7 +1120,7 @@ void TestQgsMapRendererJob::testMapShading() renderJob->start(); renderJob->waitForFinished(); img = renderJob->renderedImage(); - QVERIFY( imageCheck( QStringLiteral( "render_shading_3" ), img ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "render_shading_3" ), QStringLiteral( "render_shading_3" ), img, QString(), 0, QSize(), 2 ); shadingRenderer.setCombinedElevationMethod( Qgis::ElevationMapCombineMethod::NewerElevation ); shadingRenderer.setActiveHillshading( false ); @@ -1152,7 +1130,7 @@ void TestQgsMapRendererJob::testMapShading() renderJob->start(); renderJob->waitForFinished(); img = renderJob->renderedImage(); - QVERIFY( imageCheck( QStringLiteral( "render_shading_4" ), img ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "render_shading_4" ), QStringLiteral( "render_shading_4" ), img, QString(), 0, QSize(), 2 ); shadingRenderer.setEyeDomeLightingDistance( 10 ); shadingRenderer.setEyeDomeLightingStrength( 4000 ); @@ -1161,7 +1139,7 @@ void TestQgsMapRendererJob::testMapShading() renderJob->start(); renderJob->waitForFinished(); img = renderJob->renderedImage(); - QVERIFY( imageCheck( QStringLiteral( "render_shading_5" ), img ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "render_shading_5" ), QStringLiteral( "render_shading_5" ), img, QString(), 0, QSize(), 2 ); // test elevation map when rendering point cloud with triangulation QgsElevationShadingRenderer shadingRenderer2; @@ -1175,24 +1153,8 @@ void TestQgsMapRendererJob::testMapShading() renderJob->start(); renderJob->waitForFinished(); img = renderJob->renderedImage(); - QVERIFY( imageCheck( QStringLiteral( "render_shading_point_cloud_triangles" ), img ) ); + QGSVERIFYIMAGECHECK( QStringLiteral( "render_shading_point_cloud_triangles" ), QStringLiteral( "render_shading_point_cloud_triangles" ), img, QString(), 0, QSize(), 2 ); } -bool TestQgsMapRendererJob::imageCheck( const QString &testName, const QImage &image, int mismatchCount ) -{ - QString myTmpDir = QDir::tempPath() + '/'; - QString myFileName = myTmpDir + testName + ".png"; - image.save( myFileName, "PNG" ); - QgsMultiRenderChecker myChecker; - myChecker.setControlPathPrefix( QStringLiteral( "map_renderer" ) ); - myChecker.setControlName( "expected_" + testName ); - myChecker.setRenderedImage( myFileName ); - myChecker.setColorTolerance( 2 ); - bool myResultFlag = myChecker.runTest( testName, mismatchCount ); - mReport += myChecker.report(); - return myResultFlag; -} - - QGSTEST_MAIN( TestQgsMapRendererJob ) #include "testqgsmaprendererjob.moc" diff --git a/tests/src/core/testqgsmapsettings.cpp b/tests/src/core/testqgsmapsettings.cpp index 7ab81eae21c2..a0fada15c23d 100644 --- a/tests/src/core/testqgsmapsettings.cpp +++ b/tests/src/core/testqgsmapsettings.cpp @@ -632,7 +632,7 @@ void TestQgsMapSettings::testRenderedFeatureHandlers() const std::unique_ptr testHandler = std::make_unique(); const std::unique_ptr testHandler2 = std::make_unique(); - std::unique_ptr mapSettings = std::make_unique(); + auto mapSettings = std::make_unique(); QVERIFY( mapSettings->renderedFeatureHandlers().isEmpty() ); mapSettings->addRenderedFeatureHandler( testHandler.get() ); mapSettings->addRenderedFeatureHandler( testHandler2.get() ); @@ -726,9 +726,9 @@ void TestQgsMapSettings::testLayersWithGroupLayers() // test retrieving layers from map settings when a QgsGroupLayer is present QgsMapSettings settings; - std::unique_ptr vlA = std::make_unique( QStringLiteral( "Point" ), QStringLiteral( "a" ), QStringLiteral( "memory" ) ); - std::unique_ptr vlB = std::make_unique( QStringLiteral( "Point" ), QStringLiteral( "b" ), QStringLiteral( "memory" ) ); - std::unique_ptr vlC = std::make_unique( QStringLiteral( "Point" ), QStringLiteral( "c" ), QStringLiteral( "memory" ) ); + auto vlA = std::make_unique( QStringLiteral( "Point" ), QStringLiteral( "a" ), QStringLiteral( "memory" ) ); + auto vlB = std::make_unique( QStringLiteral( "Point" ), QStringLiteral( "b" ), QStringLiteral( "memory" ) ); + auto vlC = std::make_unique( QStringLiteral( "Point" ), QStringLiteral( "c" ), QStringLiteral( "memory" ) ); QgsGroupLayer::LayerOptions options( ( QgsCoordinateTransformContext() ) ); QgsGroupLayer groupLayer( QStringLiteral( "group" ), options ); diff --git a/tests/src/core/testqgsmapsettingsutils.cpp b/tests/src/core/testqgsmapsettingsutils.cpp index dd6a59198d97..6df44a86310d 100644 --- a/tests/src/core/testqgsmapsettingsutils.cpp +++ b/tests/src/core/testqgsmapsettingsutils.cpp @@ -80,7 +80,7 @@ void TestQgsMapSettingsUtils::containsAdvancedEffects() { QgsMapSettings mapSettings = mMapSettings; - std::unique_ptr layer( new QgsVectorLayer( QStringLiteral( "Point?field=col1:real" ), QStringLiteral( "layer" ), QStringLiteral( "memory" ) ) ); + auto layer = std::make_unique( QStringLiteral( "Point?field=col1:real" ), QStringLiteral( "layer" ), QStringLiteral( "memory" ) ); layer->setBlendMode( QPainter::CompositionMode_Multiply ); QList layers; diff --git a/tests/src/core/testqgsmesheditor.cpp b/tests/src/core/testqgsmesheditor.cpp index 04159a48ba62..089c25a2097b 100644 --- a/tests/src/core/testqgsmesheditor.cpp +++ b/tests/src/core/testqgsmesheditor.cpp @@ -192,7 +192,7 @@ void TestQgsMeshEditor::startEditingWithErrors() const QgsCoordinateTransform transform; QString uri( mDataDir + QStringLiteral( "/with_flat_face.2dm" ) ); - std::unique_ptr mesh = std::make_unique( uri, QStringLiteral( "With flat face" ), QStringLiteral( "mdal" ) ); + auto mesh = std::make_unique( uri, QStringLiteral( "With flat face" ), QStringLiteral( "mdal" ) ); QVERIFY( mesh->isValid() ); QCOMPARE( mesh->meshFaceCount(), 3 ); QCOMPARE( mesh->meshVertexCount(), 5 ); @@ -2142,7 +2142,7 @@ void TestQgsMeshEditor::refineMesh() void TestQgsMeshEditor::transformByExpression() { - std::unique_ptr layer = std::make_unique( mDataDir + "/quad_flower_to_edit.2dm", "mesh", "mdal" ); + auto layer = std::make_unique( mDataDir + "/quad_flower_to_edit.2dm", "mesh", "mdal" ); const QgsCoordinateTransform transform; QgsMeshEditingError error; @@ -2290,7 +2290,7 @@ void TestQgsMeshEditor::transformByExpression() void TestQgsMeshEditor::forceByLine() { QString uri( mDataDir + "/refined_quad_flower.2dm" ); - std::unique_ptr meshLayer = std::make_unique( uri, "mesh layer", "mdal" ); + auto meshLayer = std::make_unique( uri, "mesh layer", "mdal" ); QgsMeshEditingError error; QVERIFY( meshLayer->isValid() ); @@ -2455,7 +2455,7 @@ void TestQgsMeshEditor::forceByLine() QgsMeshEditForceByPolylines forceByPolyline1; forceByPolyline1.setTolerance( 5 ); - std::unique_ptr lineString = std::make_unique(); + auto lineString = std::make_unique(); lineString->addVertex( { 1250, 2250, 5 } ); lineString->addVertex( { 1850, 2850, 20 } ); lineString->addVertex( { 1850, 0, 150 } ); diff --git a/tests/src/core/testqgsmeshlayer.cpp b/tests/src/core/testqgsmeshlayer.cpp index 7b1e8980ab99..bc759e8c97df 100644 --- a/tests/src/core/testqgsmeshlayer.cpp +++ b/tests/src/core/testqgsmeshlayer.cpp @@ -990,7 +990,7 @@ void TestQgsMeshLayer::test_path() datasetFile.copy( dir1.filePath( QStringLiteral( "dataseGroup.dat" ) ) ); QString meshLayerUri = QStringLiteral( "2DM:\"" ) + dir1.filePath( QStringLiteral( "quad_and_triangle.2dm" ) ) + QStringLiteral( "\"" ); - std::unique_ptr meshLayer = std::make_unique( + auto meshLayer = std::make_unique( meshLayerUri, QStringLiteral( "mesh layer" ), QStringLiteral( "mdal" ) @@ -1473,7 +1473,7 @@ void TestQgsMeshLayer::test_dataset_group_item_tree_item() const QgsReadWriteContext context; const QDomElement rootElement = rootItem->writeXml( doc, context ); - std::unique_ptr otherRoot( new QgsMeshDatasetGroupTreeItem( rootElement, context ) ); + auto otherRoot = std::make_unique( rootElement, context ); for ( int i = 0; i < rootItem->totalChildCount(); ++i ) QCOMPARE( otherRoot->childFromDatasetGroupIndex( i )->name(), names.at( i ) ); @@ -1640,7 +1640,7 @@ void TestQgsMeshLayer::test_memory_dataset_group_1d() void TestQgsMeshLayer::test_memoryproviderdataset_invalid_values() { - std::unique_ptr memoryLayer = std::make_unique( readFile( "/quad_and_triangle.txt" ), "Triangle and Quad Memory", "mesh_memory" ); + auto memoryLayer = std::make_unique( readFile( "/quad_and_triangle.txt" ), "Triangle and Quad Memory", "mesh_memory" ); memoryLayer->addDatasets( readFile( "/quad_and_triangle_face_scalar_invalid_values.txt" ) ); memoryLayer->addDatasets( readFile( "/quad_and_triangle_face_vector_invalid_values.txt" ) ); @@ -1965,7 +1965,7 @@ void TestQgsMeshLayer::testSetDataSourceRetainStyle() const QString uri( mDataDir + "/quad_and_triangle.2dm" ); // start with a layer with valid path - std::unique_ptr layer = std::make_unique( uri, "Triangle and Quad MDAL", "mdal" ); + auto layer = std::make_unique( uri, "Triangle and Quad MDAL", "mdal" ); QVERIFY( layer->isValid() ); // ensure a default renderer is set automatically @@ -2022,7 +2022,7 @@ void TestQgsMeshLayer::keepDatasetIndexConsistency() QFile::copy( uri_1, uri ); // start with a layer with valid path - std::unique_ptr layer = std::make_unique( uri, QStringLiteral( "mesh" ), QStringLiteral( "mdal" ) ); + auto layer = std::make_unique( uri, QStringLiteral( "mesh" ), QStringLiteral( "mdal" ) ); QVERIFY( layer->isValid() ); QCOMPARE( layer->datasetGroupCount(), 4 ); @@ -2113,8 +2113,8 @@ void TestQgsMeshLayer::symbologyConsistencyWithName() const QString uri_1( mDataDir + QStringLiteral( "/mesh_z_ws_d_vel.nc" ) ); //mesh with dataset group "Bed Elevation", "Water level", "Depth" and "Velocity" const QString uri_2( mDataDir + QStringLiteral( "/mesh_z_ws_d.nc" ) ); //exactly the same mesh except without "Velocity" - std::unique_ptr layer_1 = std::make_unique( uri_1, QStringLiteral( "mesh" ), QStringLiteral( "mdal" ) ); - std::unique_ptr layer_2 = std::make_unique( uri_2, QStringLiteral( "mesh" ), QStringLiteral( "mdal" ) ); + auto layer_1 = std::make_unique( uri_1, QStringLiteral( "mesh" ), QStringLiteral( "mdal" ) ); + auto layer_2 = std::make_unique( uri_2, QStringLiteral( "mesh" ), QStringLiteral( "mdal" ) ); QMap nameToindex_1; QList indexes = layer_1->datasetGroupsIndexes(); @@ -2288,7 +2288,7 @@ void TestQgsMeshLayer::updateTimePropertiesWhenReloading() QFile::copy( uri_1, uri ); // start with a layer with valid path - std::unique_ptr layer = std::make_unique( uri, QStringLiteral( "mesh" ), QStringLiteral( "mdal" ) ); + auto layer = std::make_unique( uri, QStringLiteral( "mesh" ), QStringLiteral( "mdal" ) ); QVERIFY( layer->isValid() ); QgsMeshLayerTemporalProperties *temporalProperties = static_cast( layer->temporalProperties() ); @@ -2423,10 +2423,17 @@ void TestQgsMeshLayer::testMinimumMaximumActiveScalarDataset() QStringLiteral( "mdal" ) ); QVERIFY( layer.isValid() ); - layer.updateTriangularMesh(); datasetIndex = QgsMeshDatasetIndex( 0, 0 ); + // if triangular mesh does not exist cannot extract values + extent = layer.extent(); + found = layer.minimumMaximumActiveScalarDataset( extent, datasetIndex, min, max ); + QCOMPARE( found, false ); + + // crete triangular mesh for layer + layer.updateTriangularMesh(); + // tests for basic dataset extent = layer.extent(); found = layer.minimumMaximumActiveScalarDataset( extent, datasetIndex, min, max ); diff --git a/tests/src/core/testqgsmeshlayerinterpolator.cpp b/tests/src/core/testqgsmeshlayerinterpolator.cpp index 9475459fc5ae..7b72dab8307d 100644 --- a/tests/src/core/testqgsmeshlayerinterpolator.cpp +++ b/tests/src/core/testqgsmeshlayerinterpolator.cpp @@ -90,8 +90,8 @@ void TestQgsMeshLayerInterpolator::testExportRasterBand() QCOMPARE( block->value( 5, 5 ), 35.0 ); QVERIFY( block->isNoData( 10, 10 ) ); - std::unique_ptr virtualGroup = std::make_unique( QStringLiteral( "on face" ), QgsMeshDatasetGroupMetadata::DataOnFaces ); - std::shared_ptr dataset = std::make_shared(); + auto virtualGroup = std::make_unique( QStringLiteral( "on face" ), QgsMeshDatasetGroupMetadata::DataOnFaces ); + auto dataset = std::make_shared(); dataset->values.resize( 2 ); dataset->values[0] = 12; dataset->values[1] = 36; diff --git a/tests/src/core/testqgsmeshlayerrenderer.cpp b/tests/src/core/testqgsmeshlayerrenderer.cpp index e2ebc536cc77..bb70e4acfec0 100644 --- a/tests/src/core/testqgsmeshlayerrenderer.cpp +++ b/tests/src/core/testqgsmeshlayerrenderer.cpp @@ -886,7 +886,11 @@ void TestQgsMeshRenderer::test_color_scale_based_on_canvas_extent() layer.temporalProperties()->setIsActive( false ); int groupIndex = 0; - layer.setStaticScalarDatasetIndex( QgsMeshDatasetIndex( groupIndex, 0 ) ); + QgsMeshDatasetIndex meshDatasetIndex = QgsMeshDatasetIndex( groupIndex, 0 ); + layer.setStaticScalarDatasetIndex( meshDatasetIndex ); + + double min, max; + bool found; QgsProject::instance()->addMapLayer( &layer ); mMapSettings->setLayers( QList() << &layer ); @@ -894,31 +898,52 @@ void TestQgsMeshRenderer::test_color_scale_based_on_canvas_extent() mMapSettings->setOutputDpi( 96 ); mMapSettings->setRotation( 0 ); + QgsMeshRendererSettings defaultRendererSettings = layer.rendererSettings(); + // min max from current canvas settings for group QgsMeshRendererSettings rendererSettings = layer.rendererSettings(); QgsMeshRendererScalarSettings scalarRendererSettings = rendererSettings.scalarSettings( groupIndex ); scalarRendererSettings.setLimits( Qgis::MeshRangeLimit::MinimumMaximum ); scalarRendererSettings.setExtent( Qgis::MeshRangeExtent::UpdatedCanvas ); - rendererSettings.setScalarSettings( groupIndex, scalarRendererSettings ); - layer.setRendererSettings( rendererSettings ); QgsRectangle extent = layer.extent(); extent.grow( 0.1 ); + + found = layer.minimumMaximumActiveScalarDataset( extent, meshDatasetIndex, min, max ); + QVERIFY( found ); + scalarRendererSettings.setClassificationMinimumMaximum( min, max ); + rendererSettings.setScalarSettings( groupIndex, scalarRendererSettings ); + layer.setRendererSettings( rendererSettings ); + mMapSettings->setExtent( extent ); QGSRENDERMAPSETTINGSCHECK( "scale_interactive_from_canvas_1", "scale_interactive_from_canvas_1", *mMapSettings, 0, 5 ); extent = QgsRectangle( 0, 8, 2, 10 ); extent.grow( 0.1 ); + + found = layer.minimumMaximumActiveScalarDataset( extent, meshDatasetIndex, min, max ); + QVERIFY( found ); + scalarRendererSettings.setClassificationMinimumMaximum( min, max ); + rendererSettings.setScalarSettings( groupIndex, scalarRendererSettings ); + layer.setRendererSettings( rendererSettings ); + mMapSettings->setExtent( extent ); QGSRENDERMAPSETTINGSCHECK( "scale_interactive_from_canvas_2", "scale_interactive_from_canvas_2", *mMapSettings, 0, 5 ); extent = QgsRectangle( 8, 8, 10, 10 ); extent.grow( 0.1 ); + + found = layer.minimumMaximumActiveScalarDataset( extent, meshDatasetIndex, min, max ); + QVERIFY( found ); + scalarRendererSettings.setClassificationMinimumMaximum( min, max ); + rendererSettings.setScalarSettings( groupIndex, scalarRendererSettings ); + layer.setRendererSettings( rendererSettings ); + mMapSettings->setExtent( extent ); QGSRENDERMAPSETTINGSCHECK( "scale_interactive_from_canvas_3", "scale_interactive_from_canvas_3", *mMapSettings, 0, 5 ); // min max from whole mesh settings for group - rendererSettings = layer.rendererSettings(); + rendererSettings = defaultRendererSettings; scalarRendererSettings = rendererSettings.scalarSettings( groupIndex ); scalarRendererSettings.setLimits( Qgis::MeshRangeLimit::MinimumMaximum ); scalarRendererSettings.setExtent( Qgis::MeshRangeExtent::WholeMesh ); diff --git a/tests/src/core/testqgsogrprovider.cpp b/tests/src/core/testqgsogrprovider.cpp index 86f987bad571..56e5fc427e38 100644 --- a/tests/src/core/testqgsogrprovider.cpp +++ b/tests/src/core/testqgsogrprovider.cpp @@ -500,7 +500,7 @@ void TestQgsOgrProvider::testVsiCredentialOptions() // if actual aws dataset proves flaky, use this instead: // std::unique_ptr< QgsVectorLayer > vl = std::make_unique< QgsVectorLayer >( QStringLiteral( "/vsis3/testbucket/test|credential:AWS_NO_SIGN_REQUEST=YES|credential:AWS_REGION=eu-central-1|credential:AWS_S3_ENDPOINT=localhost" ), QStringLiteral( "test" ), QStringLiteral( "ogr" ) ); - std::unique_ptr vl = std::make_unique( QStringLiteral( "/vsis3/cdn.proj.org/files.geojson|credential:AWS_NO_SIGN_REQUEST=YES" ), QStringLiteral( "test" ), QStringLiteral( "ogr" ) ); + auto vl = std::make_unique( QStringLiteral( "/vsis3/cdn.proj.org/files.geojson|credential:AWS_NO_SIGN_REQUEST=YES" ), QStringLiteral( "test" ), QStringLiteral( "ogr" ) ); // confirm that GDAL VSI configuration options are set QString noSign( VSIGetPathSpecificOption( "/vsis3/cdn.proj.org", "AWS_NO_SIGN_REQUEST", nullptr ) ); @@ -517,7 +517,7 @@ void TestQgsOgrProvider::testVsiCredentialOptions() QCOMPARE( vl->dataProvider()->dataSourceUri(), QStringLiteral( "/vsis3/cdn.proj.org/files.geojson|credential:AWS_NO_SIGN_REQUEST=YES" ) ); // credentials should be bucket specific - std::unique_ptr vl2 = std::make_unique( QStringLiteral( "/vsis3/ogranother/subfolder/subfolder2/test|credential:AWS_NO_SIGN_REQUEST=NO|credential:AWS_REGION=eu-central-2|credential:AWS_S3_ENDPOINT=localhost" ), QStringLiteral( "test" ), QStringLiteral( "ogr" ) ); + auto vl2 = std::make_unique( QStringLiteral( "/vsis3/ogranother/subfolder/subfolder2/test|credential:AWS_NO_SIGN_REQUEST=NO|credential:AWS_REGION=eu-central-2|credential:AWS_S3_ENDPOINT=localhost" ), QStringLiteral( "test" ), QStringLiteral( "ogr" ) ); noSign = QString( VSIGetPathSpecificOption( "/vsis3/cdn.proj.org", "AWS_NO_SIGN_REQUEST", nullptr ) ); QCOMPARE( noSign, QStringLiteral( "YES" ) ); region = QString( VSIGetPathSpecificOption( "/vsis3/cdn.proj.org", "AWS_REGION", nullptr ) ); diff --git a/tests/src/core/testqgsogrutils.cpp b/tests/src/core/testqgsogrutils.cpp index 872c329baea2..0ced946249e7 100644 --- a/tests/src/core/testqgsogrutils.cpp +++ b/tests/src/core/testqgsogrutils.cpp @@ -74,6 +74,7 @@ class TestQgsOgrUtils : public QObject void testOgrStringToVariant_data(); void testOgrStringToVariant(); void testOgrUtilsStoredStyle(); + void testOgrUtilsCreateFields(); #if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION( 3, 3, 0 ) void testConvertFieldDomain(); @@ -1086,6 +1087,41 @@ void TestQgsOgrUtils::testOgrUtilsStoredStyle() QCOMPARE( QSet( names.constBegin(), names.constEnd() ), QSet() << QStringLiteral( "style1" ) << QStringLiteral( "style2" ) << QStringLiteral( "style3" ) ); } +/** + * Test for issue GH #60324 + */ +void TestQgsOgrUtils::testOgrUtilsCreateFields() +{ + // Create a test GPKG file with layer in a temporary directory + QTemporaryDir tempDir; + QVERIFY( tempDir.isValid() ); + QString tempDirPath = tempDir.path(); + QString testFile = tempDirPath + "/test.gpkg"; + // Create datasource + QString error; + QList> fields; + fields << QPair( QStringLiteral( "boolfield" ), QStringLiteral( "bool" ) ); + fields << QPair( QStringLiteral( "intfield" ), QStringLiteral( "Integer" ) ); + fields << QPair( QStringLiteral( "realfield" ), QStringLiteral( "Real" ) ); + fields << QPair( QStringLiteral( "stringfield" ), QStringLiteral( "String" ) ); + fields << QPair( QStringLiteral( "datefield" ), QStringLiteral( "Date" ) ); + fields << QPair( QStringLiteral( "datetimefield" ), QStringLiteral( "DateTime" ) ); + QVERIFY( QgsOgrProviderUtils::createEmptyDataSource( testFile, QStringLiteral( "GPKG" ), QStringLiteral( "UTF-8" ), Qgis::WkbType::Point, fields, QgsCoordinateReferenceSystem::fromEpsgId( 4326 ), error ) ); + + // Open the datasource + QgsVectorLayer vl = QgsVectorLayer( testFile, QStringLiteral( "test" ), QStringLiteral( "ogr" ) ); + QVERIFY( vl.isValid() ); + + const QgsFields gotFields = vl.fields(); + // Field 0 is the FID + QCOMPARE( gotFields[1].type(), QMetaType::Type::Bool ); + QCOMPARE( gotFields[2].type(), QMetaType::Type::Int ); + QCOMPARE( gotFields[3].type(), QMetaType::Type::Double ); + QCOMPARE( gotFields[4].type(), QMetaType::Type::QString ); + QCOMPARE( gotFields[5].type(), QMetaType::Type::QDate ); + QCOMPARE( gotFields[6].type(), QMetaType::Type::QDateTime ); +} + #if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION( 3, 3, 0 ) void TestQgsOgrUtils::testConvertFieldDomain() { diff --git a/tests/src/core/testqgspainteffect.cpp b/tests/src/core/testqgspainteffect.cpp index 5c8a23e36434..f8b302e23706 100644 --- a/tests/src/core/testqgspainteffect.cpp +++ b/tests/src/core/testqgspainteffect.cpp @@ -105,6 +105,7 @@ class TestQgsPaintEffect : public QgsTest void cleanup(); // will be called after every testfunction. void saveRestore(); void stackSaveRestore(); + void painterFlags(); //specific effects void drawSource(); @@ -272,6 +273,35 @@ void TestQgsPaintEffect::stackSaveRestore() delete restoredStack; } +void TestQgsPaintEffect::painterFlags() +{ + QImage image( 100, 100, QImage::Format_ARGB32 ); + image.setDotsPerMeterX( static_cast< int >( 96 / 25.4 * 1000 ) ); + image.setDotsPerMeterY( static_cast< int >( 96 / 25.4 * 1000 ) ); + image.fill( Qt::transparent ); + QPainter painter; + painter.begin( &image ); + painter.setRenderHint( QPainter::RenderHint::Antialiasing, true ); + QgsRenderContext context = QgsRenderContext::fromQPainter( &painter ); + context.setFlag( Qgis::RenderContextFlag::LosslessImageRendering, true ); + context.setFlag( Qgis::RenderContextFlag::HighQualityImageTransforms, false ); + QVERIFY( context.painter()->renderHints().testFlag( QPainter::RenderHint::Antialiasing ) ); + + QgsDrawSourceEffect effect; + effect.begin( context ); + // context should now be painting to the effect's internal deferred painter + QVERIFY( context.painter() != &painter ); + // which should have all the render hints set from the context correctly + QVERIFY( context.painter()->renderHints().testFlag( QPainter::RenderHint::Antialiasing ) ); + QVERIFY( context.painter()->renderHints().testFlag( QPainter::RenderHint::LosslessImageRendering ) ); + QVERIFY( !context.painter()->renderHints().testFlag( QPainter::RenderHint::SmoothPixmapTransform ) ); + effect.end( context ); + + // painter should be switched back to the original + QCOMPARE( context.painter(), &painter ); + painter.end(); +} + void TestQgsPaintEffect::drawSource() { //create @@ -619,7 +649,7 @@ void TestQgsPaintEffect::glow() void TestQgsPaintEffect::transform() { //create - std::unique_ptr effect( new QgsTransformEffect() ); + auto effect = std::make_unique(); QVERIFY( effect.get() ); effect->setEnabled( false ); QCOMPARE( effect->enabled(), false ); @@ -650,7 +680,7 @@ void TestQgsPaintEffect::transform() QCOMPARE( effect->drawMode(), QgsPaintEffect::Modifier ); //copy constructor - std::unique_ptr copy( new QgsTransformEffect( *effect ) ); + auto copy = std::make_unique( *effect ); QVERIFY( copy.get() ); QCOMPARE( copy->enabled(), false ); QCOMPARE( copy->translateX(), 6.0 ); @@ -950,7 +980,7 @@ void TestQgsPaintEffect::layout() lineLayer->setRenderer( renderer ); QgsLayout l( QgsProject::instance() ); - std::unique_ptr page = std::make_unique( &l ); + auto page = std::make_unique( &l ); page->setPageSize( QgsLayoutSize( 50, 50 ) ); l.pageCollection()->addPage( page.release() ); diff --git a/tests/src/core/testqgspallabeling.cpp b/tests/src/core/testqgspallabeling.cpp index aa32a16ab1ab..49daa8a9e7c9 100644 --- a/tests/src/core/testqgspallabeling.cpp +++ b/tests/src/core/testqgspallabeling.cpp @@ -209,7 +209,7 @@ void TestQgsPalLabeling::testGeometryGenerator() settings.geometryGeneratorType = Qgis::GeometryType::Point; settings.geometryGenerator = "translate($geometry, 1, 0)"; - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); @@ -280,7 +280,7 @@ void TestQgsPalLabeling::testPolygonWithEmptyRing() settings.placement = Qgis::LabelPlacement::OverPoint; - std::unique_ptr vl2( new QgsVectorLayer( QStringLiteral( "Polygon?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) ); + auto vl2 = std::make_unique( QStringLiteral( "Polygon?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl2->setRenderer( new QgsNullSymbolRenderer() ); diff --git a/tests/src/core/testqgspointcloudediting.cpp b/tests/src/core/testqgspointcloudediting.cpp index c160c9951ace..d99218876fba 100644 --- a/tests/src/core/testqgspointcloudediting.cpp +++ b/tests/src/core/testqgspointcloudediting.cpp @@ -48,6 +48,8 @@ class TestQgsPointCloudEditing : public QgsTest void testStartStopEditing(); void testModifyAttributeValue(); void testModifyAttributeValueInvalid(); + void testModifyAttributeValueFiltered(); + void testCommitChanges(); }; //runs before all tests @@ -69,7 +71,7 @@ void TestQgsPointCloudEditing::testQgsPointCloudEditingIndex() { const QString dataPath = copyTestData( QStringLiteral( "point_clouds/copc/sunshine-coast.copc.laz" ) ); - std::unique_ptr layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); + auto layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); QVERIFY( layer->isValid() ); auto i = layer->index(); @@ -96,7 +98,7 @@ void TestQgsPointCloudEditing::testStartStopEditing() { const QString dataPath = copyTestData( QStringLiteral( "point_clouds/copc/sunshine-coast.copc.laz" ) ); - std::unique_ptr layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); + auto layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); QVERIFY( layer->isValid() ); QVERIFY( !layer->isEditable() ); QVERIFY( !layer->isModified() ); @@ -161,10 +163,11 @@ void TestQgsPointCloudEditing::testModifyAttributeValue() { const QString dataPath = copyTestData( QStringLiteral( "point_clouds/copc/sunshine-coast.copc.laz" ) ); - std::unique_ptr layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); + auto layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); QVERIFY( layer->isValid() ); QSignalSpy spy( layer.get(), &QgsMapLayer::layerModified ); + QSignalSpy spyChunkChanged( layer.get(), &QgsPointCloudLayer::chunkAttributeValuesChanged ); QgsPointCloudCategoryList categories = QgsPointCloudRendererRegistry::classificationAttributeCategories( layer.get() ); QgsPointCloudClassifiedRenderer *renderer = new QgsPointCloudClassifiedRenderer( QStringLiteral( "Classification" ), categories ); @@ -183,6 +186,7 @@ void TestQgsPointCloudEditing::testModifyAttributeValue() QVERIFY( layer->startEditing() ); QVERIFY( layer->isEditable() ); + QCOMPARE( layer->undoStack()->index(), 0 ); // Change some points, point order should not matter QgsPointCloudAttribute at( QStringLiteral( "Classification" ), QgsPointCloudAttribute::UChar ); @@ -190,19 +194,40 @@ void TestQgsPointCloudEditing::testModifyAttributeValue() QVERIFY( layer->changeAttributeValue( n, { 4, 2, 0, 1, 3, 16, 5, 13, 15, 14 }, at, 1 ) ); QVERIFY( layer->isModified() ); QCOMPARE( spy.size(), 1 ); + QCOMPARE( spyChunkChanged.size(), 1 ); + QCOMPARE( layer->undoStack()->index(), 1 ); + QGSVERIFYRENDERMAPSETTINGSCHECK( "classified_render_edit_1", "classified_render_edit_1", mapSettings ); // Change some more QVERIFY( layer->changeAttributeValue( n, { 42, 82, 62, 52, 72 }, at, 6 ) ); QVERIFY( layer->isModified() ); QCOMPARE( spy.size(), 2 ); + QCOMPARE( spyChunkChanged.size(), 2 ); + QCOMPARE( layer->undoStack()->index(), 2 ); + QGSVERIFYRENDERMAPSETTINGSCHECK( "classified_render_edit_2", "classified_render_edit_2", mapSettings ); + + // Undo one edit + layer->undoStack()->undo(); + QCOMPARE( spy.size(), 3 ); + QCOMPARE( spyChunkChanged.size(), 3 ); + QCOMPARE( layer->undoStack()->index(), 1 ); + QGSVERIFYRENDERMAPSETTINGSCHECK( "classified_render_edit_1", "classified_render_edit_1", mapSettings ); + + // Redo edit + layer->undoStack()->redo(); + QCOMPARE( spy.size(), 4 ); + QCOMPARE( spyChunkChanged.size(), 4 ); + QCOMPARE( layer->undoStack()->index(), 2 ); QGSVERIFYRENDERMAPSETTINGSCHECK( "classified_render_edit_2", "classified_render_edit_2", mapSettings ); // Abort editing, original points should be rendered QVERIFY( layer->rollBack() ); QVERIFY( !layer->isEditable() ); QVERIFY( !layer->isModified() ); - QCOMPARE( spy.size(), 3 ); + QCOMPARE( spy.size(), 5 ); + QCOMPARE( spyChunkChanged.size(), 5 ); + QCOMPARE( layer->undoStack()->index(), 0 ); QGSVERIFYRENDERMAPSETTINGSCHECK( "classified_render", "classified_render", mapSettings ); } @@ -210,10 +235,11 @@ void TestQgsPointCloudEditing::testModifyAttributeValueInvalid() { const QString dataPath = copyTestData( QStringLiteral( "point_clouds/copc/sunshine-coast.copc.laz" ) ); - std::unique_ptr layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); + auto layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); QVERIFY( layer->isValid() ); QVERIFY( layer->startEditing() ); QVERIFY( layer->isEditable() ); + QCOMPARE( layer->undoStack()->index(), 0 ); QSignalSpy spy( layer.get(), &QgsMapLayer::layerModified ); @@ -407,6 +433,121 @@ void TestQgsPointCloudEditing::testModifyAttributeValueInvalid() QVERIFY( !layer->changeAttributeValue( n, { 42 }, at, 65536 ) ); QVERIFY( !layer->isModified() ); QCOMPARE( spy.size(), 0 ); + + QCOMPARE( layer->undoStack()->index(), 0 ); +} + +void TestQgsPointCloudEditing::testModifyAttributeValueFiltered() +{ + const QString dataPath = copyTestData( QStringLiteral( "point_clouds/copc/sunshine-coast.copc.laz" ) ); + + auto layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); + QVERIFY( layer->isValid() ); + + QSignalSpy spy( layer.get(), &QgsMapLayer::layerModified ); + + QgsPointCloudCategoryList categories = QgsPointCloudRendererRegistry::classificationAttributeCategories( layer.get() ); + QgsPointCloudClassifiedRenderer *renderer = new QgsPointCloudClassifiedRenderer( QStringLiteral( "Classification" ), categories ); + layer->setRenderer( renderer ); + + layer->renderer()->setPointSize( 2 ); + layer->renderer()->setPointSizeUnit( Qgis::RenderUnit::Millimeters ); + + QgsMapSettings mapSettings; + mapSettings.setOutputSize( QSize( 400, 400 ) ); + mapSettings.setOutputDpi( 96 ); + mapSettings.setDestinationCrs( layer->crs() ); + mapSettings.setExtent( QgsRectangle( 498061, 7050991, 498069, 7050999 ) ); + mapSettings.setLayers( { layer.get() } ); + QGSVERIFYRENDERMAPSETTINGSCHECK( "classified_render", "classified_render", mapSettings ); + + // Set a filter + QVERIFY( layer->setSubsetString( QStringLiteral( "Classification != 3" ) ) ); + QVERIFY( layer->startEditing() ); + QVERIFY( layer->isEditable() ); + QCOMPARE( layer->undoStack()->index(), 0 ); + QGSVERIFYRENDERMAPSETTINGSCHECK( "classified_render_filtered", "classified_render_filtered", mapSettings ); + + // Change some points, some where filtered out + QgsPointCloudAttribute at( QStringLiteral( "Classification" ), QgsPointCloudAttribute::UChar ); + QgsPointCloudNodeId n( 0, 0, 0, 0 ); + QVERIFY( layer->changeAttributeValue( n, { 42, 82, 62, 52, 72 }, at, 6 ) ); + QVERIFY( layer->isModified() ); + QCOMPARE( spy.size(), 1 ); + QCOMPARE( layer->undoStack()->index(), 1 ); + QGSVERIFYRENDERMAPSETTINGSCHECK( "classified_render_filtered_edit", "classified_render_filtered_edit", mapSettings ); + + // Commit changes and clear filter + QVERIFY( layer->commitChanges() ); + QVERIFY( !layer->isModified() ); + QVERIFY( layer->setSubsetString( QString() ) ); + QGSVERIFYRENDERMAPSETTINGSCHECK( "classified_render_filtered_edit_saved", "classified_render_filtered_edit_saved", mapSettings ); +} + +void TestQgsPointCloudEditing::testCommitChanges() +{ + const QString dataPath = copyTestData( QStringLiteral( "point_clouds/copc/sunshine-coast.copc.laz" ) ); + + auto layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); + QVERIFY( layer->isValid() ); + QVERIFY( layer->startEditing() ); + QVERIFY( layer->isEditable() ); + + QSignalSpy spy( layer.get(), &QgsMapLayer::layerModified ); + + QgsPointCloudNodeId n( 0, 0, 0, 0 ); + QgsPointCloudAttribute at( QStringLiteral( "Classification" ), QgsPointCloudAttribute::UChar ); + + QgsPointCloudRequest request; + request.setAttributes( QgsPointCloudAttributeCollection( QVector() << at ) ); + + // check values before any changes + std::unique_ptr block0 = layer->index().nodeData( n, request ); + const char *block0Data = block0->data(); + QCOMPARE( block0Data[0], 2 ); + QCOMPARE( block0Data[6], 2 ); + QCOMPARE( block0Data[11], 3 ); + QCOMPARE( block0Data[14], 3 ); + + // Change some points, point order should not matter + QVERIFY( layer->changeAttributeValue( n, { 4, 2, 0, 1, 3, 16, 5, 13, 15, 14 }, at, 1 ) ); + QVERIFY( layer->isModified() ); + QCOMPARE( layer->undoStack()->index(), 1 ); + QCOMPARE( layer->undoStack()->count(), 1 ); + QCOMPARE( spy.size(), 1 ); + + // check values after change, before committing + std::unique_ptr block1 = layer->index().nodeData( n, request ); + const char *block1Data = block1->data(); + QCOMPARE( block1Data[0], 1 ); + QCOMPARE( block1Data[6], 2 ); // unchanged + QCOMPARE( block1Data[11], 3 ); // unchanged + QCOMPARE( block1Data[14], 1 ); + + QVERIFY( layer->commitChanges() ); + QVERIFY( !layer->isModified() ); + QCOMPARE( layer->undoStack()->index(), 0 ); + QCOMPARE( layer->undoStack()->count(), 0 ); + QCOMPARE( spy.size(), 2 ); + + // check values after committing changes + std::unique_ptr block2 = layer->index().nodeData( n, request ); + const char *block2Data = block2->data(); + QCOMPARE( block2Data[0], 1 ); + QCOMPARE( block2Data[6], 2 ); // unchanged + QCOMPARE( block2Data[11], 3 ); // unchanged + QCOMPARE( block2Data[14], 1 ); + + // try to open the file as a new layer and check saved values + auto layerNew = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); + + // check values in the new layer + std::unique_ptr block3 = layerNew->index().nodeData( n, request ); + const char *block3Data = block3->data(); + QCOMPARE( block3Data[0], 1 ); + QCOMPARE( block3Data[6], 2 ); // unchanged + QCOMPARE( block3Data[11], 3 ); // unchanged + QCOMPARE( block3Data[14], 1 ); } QGSTEST_MAIN( TestQgsPointCloudEditing ) diff --git a/tests/src/core/testqgspointlocator.cpp b/tests/src/core/testqgspointlocator.cpp index 9c2fa9d354d2..6e2f1859fffe 100644 --- a/tests/src/core/testqgspointlocator.cpp +++ b/tests/src/core/testqgspointlocator.cpp @@ -515,7 +515,7 @@ class TestQgsPointLocator : public QObject void testInterpolatedPoint() { - std::unique_ptr curveLayer( new QgsVectorLayer( QStringLiteral( "CircularStringZ" ), QStringLiteral( "test" ), QStringLiteral( "memory" ) ) ); + auto curveLayer = std::make_unique( QStringLiteral( "CircularStringZ" ), QStringLiteral( "test" ), QStringLiteral( "memory" ) ); QgsFeature f1; const QgsGeometry f1g = QgsGeometry::fromWkt( "CircularStringZ (0 0 0, 5 5 5, 0 10 10)" ); f1.setGeometry( f1g ); @@ -539,7 +539,7 @@ class TestQgsPointLocator : public QObject QCOMPARE( pt2, QgsPointXY( 0, 10 ) ); QCOMPARE( m1.interpolatedPoint( QgsCoordinateReferenceSystem() ), QgsPoint( 3.53553390593273775, 8.53553390593273775, 7.70598050073098584 ) ); - std::unique_ptr lineLayer( new QgsVectorLayer( QStringLiteral( "LineStringZ" ), QStringLiteral( "test" ), QStringLiteral( "memory" ) ) ); + auto lineLayer = std::make_unique( QStringLiteral( "LineStringZ" ), QStringLiteral( "test" ), QStringLiteral( "memory" ) ); QgsFeature f2; const QgsGeometry f2g = QgsGeometry::fromWkt( "LineStringZ (0 0 0, 5 5 5, 0 10 10)" ); f2.setGeometry( f2g ); diff --git a/tests/src/core/testqgspointpatternfillsymbol.cpp b/tests/src/core/testqgspointpatternfillsymbol.cpp index bb65e51bdd0b..500a58621377 100644 --- a/tests/src/core/testqgspointpatternfillsymbol.cpp +++ b/tests/src/core/testqgspointpatternfillsymbol.cpp @@ -195,7 +195,7 @@ void TestQgsPointPatternFillSymbol::pointPatternFillSymbolVector() void TestQgsPointPatternFillSymbol::viewportPointPatternFillSymbol() { - std::unique_ptr layer = std::make_unique( mTestDataDir + "polys.shp" ); + auto layer = std::make_unique( mTestDataDir + "polys.shp" ); QVERIFY( layer->isValid() ); QgsVectorSimplifyMethod simplifyMethod; @@ -221,7 +221,7 @@ void TestQgsPointPatternFillSymbol::viewportPointPatternFillSymbol() void TestQgsPointPatternFillSymbol::viewportPointPatternFillSymbolVector() { - std::unique_ptr layer = std::make_unique( mTestDataDir + "polys.shp" ); + auto layer = std::make_unique( mTestDataDir + "polys.shp" ); QVERIFY( layer->isValid() ); QgsVectorSimplifyMethod simplifyMethod; @@ -355,7 +355,7 @@ void TestQgsPointPatternFillSymbol::zeroSpacedPointPatternFillSymbolVector() void TestQgsPointPatternFillSymbol::pointPatternFillNoClip() { - std::unique_ptr layer = std::make_unique( mTestDataDir + "polys.shp" ); + auto layer = std::make_unique( mTestDataDir + "polys.shp" ); QVERIFY( layer->isValid() ); QgsPointPatternFillSymbolLayer *pointPatternFill = new QgsPointPatternFillSymbolLayer(); @@ -379,7 +379,7 @@ void TestQgsPointPatternFillSymbol::pointPatternFillNoClip() void TestQgsPointPatternFillSymbol::pointPatternFillCompletelyWithin() { - std::unique_ptr layer = std::make_unique( mTestDataDir + "polys.shp" ); + auto layer = std::make_unique( mTestDataDir + "polys.shp" ); QVERIFY( layer->isValid() ); QgsPointPatternFillSymbolLayer *pointPatternFill = new QgsPointPatternFillSymbolLayer(); @@ -403,7 +403,7 @@ void TestQgsPointPatternFillSymbol::pointPatternFillCompletelyWithin() void TestQgsPointPatternFillSymbol::pointPatternFillCentroidWithin() { - std::unique_ptr layer = std::make_unique( mTestDataDir + "polys.shp" ); + auto layer = std::make_unique( mTestDataDir + "polys.shp" ); QVERIFY( layer->isValid() ); QgsPointPatternFillSymbolLayer *pointPatternFill = new QgsPointPatternFillSymbolLayer(); @@ -427,7 +427,7 @@ void TestQgsPointPatternFillSymbol::pointPatternFillCentroidWithin() void TestQgsPointPatternFillSymbol::pointPatternFillDataDefinedClip() { - std::unique_ptr layer = std::make_unique( mTestDataDir + "polys.shp" ); + auto layer = std::make_unique( mTestDataDir + "polys.shp" ); QVERIFY( layer->isValid() ); QgsPointPatternFillSymbolLayer *pointPatternFill = new QgsPointPatternFillSymbolLayer(); @@ -452,7 +452,7 @@ void TestQgsPointPatternFillSymbol::pointPatternFillDataDefinedClip() void TestQgsPointPatternFillSymbol::pointPatternFillDataDefinedWithOpacity() { - std::unique_ptr layer = std::make_unique( mTestDataDir + "polys.shp" ); + auto layer = std::make_unique( mTestDataDir + "polys.shp" ); QVERIFY( layer->isValid() ); QgsPointPatternFillSymbolLayer *pointPatternFill = new QgsPointPatternFillSymbolLayer(); @@ -482,7 +482,7 @@ void TestQgsPointPatternFillSymbol::pointPatternFillDataDefinedWithOpacity() void TestQgsPointPatternFillSymbol::pointPatternRandomOffset() { - std::unique_ptr layer = std::make_unique( mTestDataDir + "polys.shp" ); + auto layer = std::make_unique( mTestDataDir + "polys.shp" ); QVERIFY( layer->isValid() ); QgsPointPatternFillSymbolLayer *pointPatternFill = new QgsPointPatternFillSymbolLayer(); @@ -509,7 +509,7 @@ void TestQgsPointPatternFillSymbol::pointPatternRandomOffset() void TestQgsPointPatternFillSymbol::pointPatternRandomOffsetPercent() { - std::unique_ptr layer = std::make_unique( mTestDataDir + "polys.shp" ); + auto layer = std::make_unique( mTestDataDir + "polys.shp" ); QVERIFY( layer->isValid() ); QgsPointPatternFillSymbolLayer *pointPatternFill = new QgsPointPatternFillSymbolLayer(); @@ -538,7 +538,7 @@ void TestQgsPointPatternFillSymbol::pointPatternRandomOffsetPercent() void TestQgsPointPatternFillSymbol::pointPatternRandomOffsetDataDefined() { - std::unique_ptr layer = std::make_unique( mTestDataDir + "polys.shp" ); + auto layer = std::make_unique( mTestDataDir + "polys.shp" ); QVERIFY( layer->isValid() ); QgsPointPatternFillSymbolLayer *pointPatternFill = new QgsPointPatternFillSymbolLayer(); @@ -565,7 +565,7 @@ void TestQgsPointPatternFillSymbol::pointPatternRandomOffsetDataDefined() void TestQgsPointPatternFillSymbol::pointPatternAngle() { - std::unique_ptr layer = std::make_unique( mTestDataDir + "polys.shp" ); + auto layer = std::make_unique( mTestDataDir + "polys.shp" ); QVERIFY( layer->isValid() ); QgsPointPatternFillSymbolLayer *pointPatternFill = new QgsPointPatternFillSymbolLayer(); @@ -590,7 +590,7 @@ void TestQgsPointPatternFillSymbol::pointPatternAngle() void TestQgsPointPatternFillSymbol::pointPatternAngleDataDefined() { - std::unique_ptr layer = std::make_unique( mTestDataDir + "polys.shp" ); + auto layer = std::make_unique( mTestDataDir + "polys.shp" ); QVERIFY( layer->isValid() ); QgsPointPatternFillSymbolLayer *pointPatternFill = new QgsPointPatternFillSymbolLayer(); @@ -616,7 +616,7 @@ void TestQgsPointPatternFillSymbol::pointPatternAngleDataDefined() void TestQgsPointPatternFillSymbol::pointPatternAngleViewport() { - std::unique_ptr layer = std::make_unique( mTestDataDir + "polys.shp" ); + auto layer = std::make_unique( mTestDataDir + "polys.shp" ); QVERIFY( layer->isValid() ); QgsPointPatternFillSymbolLayer *pointPatternFill = new QgsPointPatternFillSymbolLayer(); diff --git a/tests/src/core/testqgsproject.cpp b/tests/src/core/testqgsproject.cpp index 4efe6afd7870..38d4931a4fad 100644 --- a/tests/src/core/testqgsproject.cpp +++ b/tests/src/core/testqgsproject.cpp @@ -32,7 +32,8 @@ #include "qgsmarkersymbol.h" #include "qgsrasterlayer.h" #include "qgssettingsregistrycore.h" - +#include "qgsvectorfilewriter.h" +#include "qgsarchive.h" class TestQgsProject : public QObject { @@ -65,6 +66,13 @@ class TestQgsProject : public QObject void testAttachmentIdentifier(); void testEmbeddedGroupWithJoins(); void testAsynchronousLayerLoading(); + void testSymlinks1LayerRasterChange(); + void testSymlinks2LayerFolder(); + void testSymlinks3LayerShapefile(); + void testSymlinks4LayerShapefileBroken(); + void testSymlinks5ProjectFile(); + void testSymlinks6ProjectFolder(); + void regression60100(); }; void TestQgsProject::init() @@ -983,7 +991,7 @@ void TestQgsProject::testEmbeddedGroupWithJoins() void TestQgsProject::testAsynchronousLayerLoading() { - std::unique_ptr project = std::make_unique(); + auto project = std::make_unique(); QStringList meshFilters; meshFilters << QStringLiteral( "*.nc" ) << QStringLiteral( "*.2dm" ); @@ -1102,6 +1110,508 @@ void TestQgsProject::testAsynchronousLayerLoading() QCOMPARE( project->mapLayers( false ).count(), layersCount ); } +QString getProjectXmlContent( const QString &projectPath ) +{ + if ( projectPath.endsWith( QLatin1String( ".qgz" ) ) ) + { + QgsProjectArchive archive; + if ( !archive.unzip( projectPath ) ) + return QString(); + + const QString qgsFile = archive.projectFile(); + if ( qgsFile.isEmpty() ) + return QString(); + + QFile file( qgsFile ); + if ( !file.open( QIODevice::ReadOnly ) ) + return QString(); + return file.readAll(); + } + + QFile file( projectPath ); + if ( !file.open( QIODevice::ReadOnly ) ) + return QString(); + return file.readAll(); +} + +QString getLayerSourceFromProjectXml( const QString &projectPath, const QString &layerName ) +{ + // Get XML content + const QString xmlContent = getProjectXmlContent( projectPath ); + if ( xmlContent.isEmpty() ) + return QString(); + + // Parse XML + QDomDocument doc; + if ( !doc.setContent( xmlContent ) ) + return QString(); + + // Find layer by name in XML + const QDomNodeList layers = doc.elementsByTagName( QStringLiteral( "maplayer" ) ); + for ( int i = 0; i < layers.count(); ++i ) + { + const QDomElement layerElem = layers.at( i ).toElement(); + if ( layerElem.firstChildElement( QStringLiteral( "layername" ) ).text() == layerName ) + { + return layerElem.firstChildElement( QStringLiteral( "datasource" ) ).text(); + } + } + return QString(); +} + +void TestQgsProject::testSymlinks1LayerRasterChange() +{ + // Verify that symlinked raster layer behaves well when target is changed + + // ++SETUP++ + // Create directory structure + QTemporaryDir tempDir; + const QString rootPath = tempDir.path(); + const QString projectDir = rootPath + "/projects/qgis/test1"; + const QString dataDir = rootPath + "/data"; + const QString projectPath = projectDir + "/proj.qgs"; + QDir().mkpath( projectDir ); + QDir().mkpath( dataDir ); + + // Copy test rasters to data dir + const QString testDataDir( TEST_DATA_DIR ); + const QStringList rasters = { "rnd_percentile_raster1_byte.tif", "rnd_percentile_raster2_byte.tif", "rnd_percentile_raster3_byte.tif" }; + for ( const QString &raster : rasters ) + { + QVERIFY( QFile::copy( testDataDir + "/raster/" + raster, dataDir + "/" + raster ) ); + } + + // Create symlink pointing to raster1 + QVERIFY( QFile::link( dataDir + "/" + rasters[0], projectDir + "/latest.tif" ) ); + + // Create project with layer pointing to symlink + auto project = std::make_unique(); + auto layer = std::make_unique( "./latest.tif", QStringLiteral( "Latest" ), QStringLiteral( "gdal" ) ); + project->addMapLayer( layer.release() ); + project->write( projectPath ); + project.reset(); + + // ++Verify symlink changes are detected++ + // Initial state - points to raster1 + project = std::make_unique(); + project->read( projectPath ); + QgsRasterLayer *loadedLayer = qobject_cast( project->mapLayersByName( QStringLiteral( "Latest" ) ).at( 0 ) ); + QCOMPARE( QFileInfo( loadedLayer->source() ).canonicalFilePath(), dataDir + "/" + rasters[0] ); + project->write( projectPath ); + project.reset(); + // Change to raster2 + QFile::remove( projectDir + "/latest.tif" ); + QVERIFY( QFile::link( dataDir + "/" + rasters[1], projectDir + "/latest.tif" ) ); + project = std::make_unique(); + project->read( projectPath ); + loadedLayer = qobject_cast( project->mapLayersByName( QStringLiteral( "Latest" ) ).at( 0 ) ); + QCOMPARE( QFileInfo( loadedLayer->source() ).canonicalFilePath(), dataDir + "/" + rasters[1] ); + project->write( projectPath ); + project.reset(); + // Change to raster3 + QFile::remove( projectDir + "/latest.tif" ); + QVERIFY( QFile::link( dataDir + "/" + rasters[2], projectDir + "/latest.tif" ) ); + project = std::make_unique(); + project->read( projectPath ); + loadedLayer = qobject_cast( project->mapLayersByName( QStringLiteral( "Latest" ) ).at( 0 ) ); + QCOMPARE( QFileInfo( loadedLayer->source() ).canonicalFilePath(), dataDir + "/" + rasters[2] ); +} + +void TestQgsProject::testSymlinks2LayerFolder() +{ + // Verify that shapefile layer added via symlinked data folder + // maintains correct relative paths in .qgz on save + + // ++SETUP++ + // Create directory structure (QGZ file) + QTemporaryDir tempDir; + const QString rootPath = tempDir.path(); + const QString testDataDir( TEST_DATA_DIR ); + const QString projectDir = rootPath + "/projects/qgis/test1"; + const QString dataDir = rootPath + "/data"; + const QString projectPath = projectDir + "/proj.qgz"; + QDir().mkpath( projectDir ); + QDir().mkpath( dataDir ); + + // Copy shapefile components + const QStringList components = { "dbf", "prj", "shp", "shx" }; + for ( const QString &ext : components ) + { + QVERIFY( QFile::copy( testDataDir + "/points." + ext, dataDir + "/points." + ext ) ); + } + + // Symlink data folder + QVERIFY( QFile::link( dataDir, projectDir + "/data" ) ); + + // Create project with relative layer + auto project = std::make_unique(); + auto layer = std::make_unique( "./data/points.shp", QStringLiteral( "Points" ), QStringLiteral( "ogr" ) ); + project->addMapLayer( layer.release() ); + project->write( projectPath ); + project.reset(); + + // ++Verify paths after re-opening++ + // XML datasource is "./data/points.shp" NOT "../../../data/points.shp" + const QString layerSource = getLayerSourceFromProjectXml( projectPath, QStringLiteral( "Points" ) ); + QCOMPARE( layerSource, QStringLiteral( "./data/points.shp" ) ); + + // Absolute layer source still in projectDir + project = std::make_unique(); + project->read( projectPath ); + QgsVectorLayer *loadedLayer = qobject_cast( project->mapLayersByName( QStringLiteral( "Points" ) ).at( 0 ) ); + QCOMPARE( loadedLayer->source(), projectDir + "/data/points.shp" ); +} + +void TestQgsProject::testSymlinks3LayerShapefile() +{ + // Verify that individually symlinked shapefile components + // maintain correct relative paths in .qgs on save and shapefile edit + + // ++SETUP++ + // Create directory structure (QGS file) + QTemporaryDir tempDir; + const QString rootPath = tempDir.path(); + const QString testDataDir( TEST_DATA_DIR ); + const QString projectDir = rootPath + "/projects/qgis/test2"; + const QString dataDir = rootPath + "/data"; + const QString projectPath = projectDir + "/proj.qgs"; + QDir().mkpath( projectDir ); + QDir().mkpath( dataDir ); + + // Copy and symlink shapefile components + const QStringList components = { "dbf", "prj", "shp", "shx" }; + for ( const QString &ext : components ) + { + QVERIFY( QFile::copy( testDataDir + "/points." + ext, dataDir + "/points." + ext ) ); + QVERIFY( QFile::link( dataDir + "/points." + ext, projectDir + "/points." + ext ) ); + } + + // Create project with relative layer + auto project = std::make_unique(); + auto layer = std::make_unique( "./points.shp", QStringLiteral( "Points" ), QStringLiteral( "ogr" ) ); + project->addMapLayer( layer.release() ); + project->write( projectPath ); + project.reset(); + + // ++Verify paths after re-opening++ + // XML datasource is "./points.shp" NOT "../../../data/points.shp" + const QString layerSource = getLayerSourceFromProjectXml( projectPath, QStringLiteral( "Points" ) ); + QCOMPARE( layerSource, QStringLiteral( "./points.shp" ) ); + + // Absolute layer source still in projectDir + project = std::make_unique(); + project->read( projectPath ); + QgsVectorLayer *loadedLayer = qobject_cast( project->mapLayersByName( QStringLiteral( "Points" ) ).at( 0 ) ); + QCOMPARE( loadedLayer->source(), projectDir + "/points.shp" ); + + // ++Verify that layer edit follows symlinks++ + const long initialCount = loadedLayer->featureCount(); + + // Add new feature + loadedLayer->startEditing(); + QgsFeature feat( loadedLayer->fields() ); + QgsGeometry geom = QgsGeometry::fromWkt( "POINT(1 2)" ); + feat.setGeometry( geom ); + loadedLayer->addFeature( feat ); + loadedLayer->commitChanges(); + project.reset(); + + // Symlinks still exist and point to correct files + for ( const QString &ext : components ) + { + const QString symlink = projectDir + "/points." + ext; + const QString target = dataDir + "/points." + ext; + // Check symlink exists + QVERIFY( QFileInfo( symlink ).isSymLink() ); + // Check canonical paths match + QFileInfo symlinkInfo( symlink ); + QFileInfo targetInfo( target ); + QCOMPARE( symlinkInfo.canonicalFilePath(), targetInfo.canonicalFilePath() ); + } + + // Feature count has increased + project = std::make_unique(); + project->read( projectPath ); + loadedLayer = qobject_cast( project->mapLayersByName( QStringLiteral( "Points" ) ).at( 0 ) ); + QCOMPARE( loadedLayer->featureCount(), initialCount + 1 ); +} + +void TestQgsProject::testSymlinks4LayerShapefileBroken() +{ + // Verify that saving a new layer to location with existing broken + // shapefile symlinks maintains the symlinks and properly saves the data + + // ++SETUP++ + // Create directory structure (QGS file) + QTemporaryDir tempDir; + const QString rootPath = tempDir.path(); + const QString projectDir = rootPath + "/projects/qgis/test3"; + const QString dataDir = rootPath + "/data"; + const QString projectPath = projectDir + "/proj.qgz"; + QDir().mkpath( projectDir ); + QDir().mkpath( dataDir ); + + // Create broken symlinks for shapefile components, also symlink ".cpg" since it WILL be created + const QStringList components = { "dbf", "prj", "shp", "shx", "cpg" }; + for ( const QString &ext : components ) + { + QVERIFY( QFile::link( dataDir + "/points." + ext, projectDir + "/points." + ext ) ); + } + + // ++Verify that layer creation follows the (broken) symlink++ + // Create memory layer with single point + auto memLayer = std::make_unique( "Point", QStringLiteral( "Points" ), QStringLiteral( "memory" ) ); + QgsFeature feat( memLayer->fields() ); + feat.setGeometry( QgsGeometry::fromWkt( "POINT(1 2)" ) ); + memLayer->startEditing(); + memLayer->addFeature( feat ); + memLayer->commitChanges(); + + // Save memory layer to shapefile at symlink location + QgsVectorFileWriter::SaveVectorOptions options; + options.driverName = QStringLiteral( "ESRI Shapefile" ); + QgsVectorFileWriter::writeAsVectorFormatV3( memLayer.get(), projectDir + "/points.shp", QgsCoordinateTransformContext(), options ); + + // Create project with the layer + auto project = std::make_unique(); + auto layer = std::make_unique( "./points.shp", QStringLiteral( "Points" ), QStringLiteral( "ogr" ) ); + project->addMapLayer( layer.release() ); + project->write( projectPath ); + project.reset(); + + // Verify symlinks and data + for ( const QString &ext : components ) + { + const QString symlink = projectDir + "/points." + ext; + const QString target = dataDir + "/points." + ext; + // Check symlink exists + QVERIFY( QFileInfo( symlink ).isSymLink() ); + // Check canonical paths match + QFileInfo symlinkInfo( symlink ); + QFileInfo targetInfo( target ); + QCOMPARE( symlinkInfo.canonicalFilePath(), targetInfo.canonicalFilePath() ); + } + + // Verify layer has 1 feature + project = std::make_unique(); + project->read( projectPath ); + QgsVectorLayer *loadedLayer = qobject_cast( project->mapLayersByName( QStringLiteral( "Points" ) ).at( 0 ) ); + QCOMPARE( loadedLayer->featureCount(), 1L ); +} + +void TestQgsProject::testSymlinks5ProjectFile() +{ + // Verify that symlinked project file maintains relative paths + // and test writing broken project links + + // ++SETUP++ + // Create directory structure + QTemporaryDir tempDir; + const QString rootPath = tempDir.path(); + const QString projectDir = rootPath + "/projects/qgis/test4"; + const QString symlinkprojDir = rootPath + "/symlinkproj"; + QDir().mkpath( projectDir ); + QDir().mkpath( symlinkprojDir ); + + // Copy shapefile components to project dir + const QString testDataDir( TEST_DATA_DIR ); + const QStringList components = { "dbf", "prj", "shp", "shx" }; + for ( const QString &ext : components ) + { + QFile::copy( testDataDir + "/points." + ext, projectDir + "/points." + ext ); + } + + // Create initial project in project dir + const QString originalPath = projectDir + "/project.qgs"; + const QString originalAttachPath = projectDir + "/project_attachments.zip"; + auto project = std::make_unique(); + auto layer = std::make_unique( "./points.shp", QStringLiteral( "Points" ), QStringLiteral( "ogr" ) ); + project->addMapLayer( layer.release() ); + project->write( originalPath ); + project.reset(); + + // ++Verify that moved project behaves well++ + // Move project file and create symlink + QVERIFY( QFile::rename( originalPath, symlinkprojDir + "/project.qgs" ) ); + QVERIFY( QFile::rename( originalAttachPath, symlinkprojDir + "/project_attachments.zip" ) ); + QVERIFY( QFile::link( symlinkprojDir + "/project.qgs", originalPath ) ); + QVERIFY( QFile::link( symlinkprojDir + "/project_attachments.zip", originalAttachPath ) ); + + // Open symlinked project and verify paths + project = std::make_unique(); + project->read( originalPath ); + QgsVectorLayer *loadedLayer = qobject_cast( project->mapLayersByName( QStringLiteral( "Points" ) ).at( 0 ) ); + QCOMPARE( loadedLayer->source(), projectDir + "/points.shp" ); + + // Save and verify XML content + project->write( originalPath ); + const QString layerSource = getLayerSourceFromProjectXml( originalPath, QStringLiteral( "Points" ) ); + QCOMPARE( layerSource, QStringLiteral( "./points.shp" ) ); + + // ++Change project settings, verify symlinks still good++ + project->setDistanceUnits( Qgis::DistanceUnit::NauticalMiles ); + project->write( originalPath ); + + // Verify symlinks and canonical paths + const QStringList symlinks = { originalPath, originalAttachPath }; + for ( const QString &symlink : symlinks ) + { + QVERIFY( QFileInfo( symlink ).isSymLink() ); + QFileInfo symlinkInfo( symlink ); + QFileInfo targetInfo( symlinkprojDir + "/" + QFileInfo( symlink ).fileName() ); + QCOMPARE( symlinkInfo.canonicalFilePath(), targetInfo.canonicalFilePath() ); + } + + // ++Break symlinks and create new project++ + // Remove symlink destinations + QVERIFY( QFile::remove( symlinkprojDir + "/project.qgs" ) ); + QVERIFY( QFile::remove( symlinkprojDir + "/project_attachments.zip" ) ); + + // Create a new project, writing to the broken symlink + project = std::make_unique(); + layer = std::make_unique( "./points.shp", QStringLiteral( "Points" ), QStringLiteral( "ogr" ) ); + project->addMapLayer( layer.release() ); + project->write( originalPath ); + + // Verify symlinks are now active and well-behaved + for ( const QString &symlink : symlinks ) + { + QVERIFY( QFileInfo( symlink ).isSymLink() ); + QFileInfo symlinkInfo( symlink ); + QFileInfo targetInfo( symlinkprojDir + "/" + QFileInfo( symlink ).fileName() ); + QCOMPARE( symlinkInfo.canonicalFilePath(), targetInfo.canonicalFilePath() ); + } +} + +void TestQgsProject::testSymlinks6ProjectFolder() +{ + // Replicate this test: python/test_qgsproject.py:testSymbolicLinkInProjectPath + // Check functionality if the immediate parent is a symlink + + // ++SETUP++ + // Create directory structure + QTemporaryDir tempDir; + const QString rootPath = tempDir.path(); + const QString projectDir = rootPath + "/projects/qgis/test4"; + const QString symlinkprojparentDir = rootPath + "/another/directory"; + QDir().mkpath( projectDir ); + QDir().mkpath( symlinkprojparentDir ); + + // Copy shapefile components to project dir + const QString testDataDir( TEST_DATA_DIR ); + const QStringList components = { "dbf", "prj", "shp", "shx" }; + for ( const QString &ext : components ) + { + QFile::copy( testDataDir + "/points." + ext, projectDir + "/points." + ext ); + } + + // Create initial project in project dir + const QString originalPath = projectDir + "/project.qgs"; + auto project = std::make_unique(); + auto layer = std::make_unique( "./points.shp", QStringLiteral( "Points" ), QStringLiteral( "ogr" ) ); + project->addMapLayer( layer.release() ); + project->write( originalPath ); + project.reset(); + + // Create a new temporary directory and a symbolic link to the original folder + const QString symlinkprojDir = symlinkprojparentDir + "/symlink_projdir"; + QVERIFY( QFile::link( projectDir, symlinkprojDir ) ); + const QString symlinkprojPath = symlinkprojDir + "/project.qgs"; + + // ++Open the project through a symlink and re-save++ + project = std::make_unique(); + QVERIFY( project->read( symlinkprojPath ) ); + QVERIFY( project->write( symlinkprojPath ) ); + project.reset(); + + // ++Verify paths after re-opening++ + // XML datasource is still "./points.shp" + const QString layerSource = getLayerSourceFromProjectXml( symlinkprojPath, QStringLiteral( "Points" ) ); + QCOMPARE( layerSource, QStringLiteral( "./points.shp" ) ); + // Absolute layer source does NOT resolve the symlink + project = std::make_unique(); + project->read( symlinkprojPath ); + QgsVectorLayer *loadedLayer = qobject_cast( project->mapLayersByName( QStringLiteral( "Points" ) ).at( 0 ) ); + QCOMPARE( loadedLayer->source(), symlinkprojDir + "/points.shp" ); +} + +void TestQgsProject::regression60100() +{ + /* + * Regression test for QGIS issue #60100 (https://github.com/qgis/QGIS/issues/60100) + * This test ensures that when saving a QGIS project with relative paths, + * the correct layer datasource is preserved, even when the current working + * directory (CWD) contains a file with the same name as the layer datasource. + * + * Previous behavior: + * - If a file with the same name as a layer datasource existed in the CWD, + * the layer path in the saved project would point to the file in the CWD, + * rather than the intended file in the project directory (PROJDIR). + * + * Test steps: + * 1. Create a temporary directory structure with two subfolders: WORKDIR and PROJDIR. + * 2. Copy a `points.geojson` file to both WORKDIR and PROJDIR. + * 3. Create a new QGIS project in PROJDIR and add the `points.geojson` file from PROJDIR as a layer. + * 4. Change the working directory to WORKDIR and save the project. + * 5. Verify that the saved project references the correct datasource (`./points.geojson` in PROJDIR) + * and does not erroneously reference the file in WORKDIR. + */ + // Create directory structure with 2 subfolders + const QTemporaryDir baseDir; + const QDir base( baseDir.path() ); + base.mkdir( QStringLiteral( "WORKDIR" ) ); + base.mkdir( QStringLiteral( "PROJDIR" ) ); + const QString workDirPath = baseDir.path() + QStringLiteral( "/WORKDIR" ); + const QString projDirPath = baseDir.path() + QStringLiteral( "/PROJDIR" ); + + // Save our old CWD and switch to the new WORKDIR + const QString oldCWD = QDir::currentPath(); + QVERIFY( QDir::setCurrent( workDirPath ) ); + + // Copy points.geojson to both subfolders + const QString testDataDir( TEST_DATA_DIR ); + const QString pointsPath = testDataDir + QStringLiteral( "/points.geojson" ); + QFile::copy( pointsPath, workDirPath + QStringLiteral( "/points.geojson" ) ); + QFile::copy( pointsPath, projDirPath + QStringLiteral( "/points.geojson" ) ); + + // Create a new/empty project in PROJDIR + const QString projectPath = projDirPath + QStringLiteral( "/project.qgs" ); + auto project = std::make_unique(); + + // Add the local points.geojson (in PROJDIR) as a layer + auto layer = std::make_unique( + projDirPath + QStringLiteral( "/points.geojson" ), + QStringLiteral( "Test Points" ), + QStringLiteral( "ogr" ) + ); + project->addMapLayer( layer.release() ); + + // Write (save) the project to disk. This used to pick up the WRONG file and save it to the proj. + project->write( projectPath ); + + // Restore old working directory + QVERIFY( QDir::setCurrent( oldCWD ) ); + + // Verify the layer path in the project file + QDomDocument doc; + QFile projectFile( projectPath ); + bool res = projectFile.open( QIODevice::ReadOnly ); + Q_ASSERT( res ); + res = static_cast( doc.setContent( &projectFile ) ); + Q_ASSERT( res ); + projectFile.close(); + + const QDomElement docElem = doc.documentElement(); + const QDomElement layersElem = docElem.firstChildElement( QStringLiteral( "projectlayers" ) ); + QDomElement layerElem = layersElem.firstChildElement(); + while ( !layerElem.isNull() ) + { + const QString layerSource = layerElem.firstChildElement( QStringLiteral( "datasource" ) ).text(); + // Should NOT be "../WORKDIR/points.geojson" + QCOMPARE( layerSource, QStringLiteral( "./points.geojson" ) ); + layerElem = layerElem.nextSiblingElement(); + } +} QGSTEST_MAIN( TestQgsProject ) #include "testqgsproject.moc" diff --git a/tests/src/core/testqgsrasterfilewriter.cpp b/tests/src/core/testqgsrasterfilewriter.cpp index 4bfd504ac3bb..855424f20eb5 100644 --- a/tests/src/core/testqgsrasterfilewriter.cpp +++ b/tests/src/core/testqgsrasterfilewriter.cpp @@ -114,7 +114,7 @@ bool TestQgsRasterFileWriter::writeTest( const QString &rasterName ) return false; } - std::unique_ptr mpRasterLayer( new QgsRasterLayer( copiedSrc, rasterFileInfo.completeBaseName() ) ); + auto mpRasterLayer = std::make_unique( copiedSrc, rasterFileInfo.completeBaseName() ); if ( !mpRasterLayer->isValid() ) return false; @@ -128,7 +128,7 @@ bool TestQgsRasterFileWriter::writeTest( const QString &rasterName ) mReport += "temporary output file: " + tmpName + "
"; QgsRasterFileWriter fileWriter( tmpName ); - std::unique_ptr pipe = std::make_unique(); + auto pipe = std::make_unique(); if ( !pipe->set( provider->clone() ) ) { appendToReport( QStringLiteral( "Write test" ), QStringLiteral( "Cannot set pipe provider" ) ); @@ -199,7 +199,7 @@ void TestQgsRasterFileWriter::testCreateOneBandRaster() QVERIFY( dp->isEditable() ); dp.reset(); - std::unique_ptr rlayer = std::make_unique( filename, QStringLiteral( "tmp" ), QStringLiteral( "gdal" ) ); + auto rlayer = std::make_unique( filename, QStringLiteral( "tmp" ), QStringLiteral( "gdal" ) ); QVERIFY( rlayer->isValid() ); QCOMPARE( rlayer->width(), width ); QCOMPARE( rlayer->height(), height ); @@ -228,7 +228,7 @@ void TestQgsRasterFileWriter::testCreateMultiBandRaster() QVERIFY( dp->isEditable() ); dp.reset(); - std::unique_ptr rlayer = std::make_unique( filename, QStringLiteral( "tmp" ), QStringLiteral( "gdal" ) ); + auto rlayer = std::make_unique( filename, QStringLiteral( "tmp" ), QStringLiteral( "gdal" ) ); QVERIFY( rlayer->isValid() ); QCOMPARE( rlayer->width(), width ); QCOMPARE( rlayer->height(), height ); @@ -268,10 +268,10 @@ void TestQgsRasterFileWriter::testVrtCreation() //create a raster layer that will be used in all tests... const QString srcFileName = mTestDataDir + QStringLiteral( "ALLINGES_RGF93_CC46_1_1.tif" ); const QFileInfo rasterFileInfo( srcFileName ); - std::unique_ptr srcRasterLayer = std::make_unique( rasterFileInfo.absoluteFilePath(), rasterFileInfo.completeBaseName() ); + auto srcRasterLayer = std::make_unique( rasterFileInfo.absoluteFilePath(), rasterFileInfo.completeBaseName() ); const QTemporaryDir dir; - std::unique_ptr rasterFileWriter = std::make_unique( dir.path() + '/' + rasterFileInfo.completeBaseName() ); + auto rasterFileWriter = std::make_unique( dir.path() + '/' + rasterFileInfo.completeBaseName() ); //2. Definition of the pyramid levels QList levelList; @@ -297,7 +297,7 @@ void TestQgsRasterFileWriter::testVrtCreation() QCOMPARE( res, Qgis::RasterFileWriterResult::Success ); // Now let's compare the georef of the original raster with the georef of the generated vrt file - std::unique_ptr vrtRasterLayer = std::make_unique( dir.path() + '/' + rasterFileInfo.completeBaseName() + '/' + rasterFileInfo.completeBaseName() + QStringLiteral( ".vrt" ), rasterFileInfo.completeBaseName() ); + auto vrtRasterLayer = std::make_unique( dir.path() + '/' + rasterFileInfo.completeBaseName() + '/' + rasterFileInfo.completeBaseName() + QStringLiteral( ".vrt" ), rasterFileInfo.completeBaseName() ); const double xminVrt = vrtRasterLayer->extent().xMinimum(); const double yminVrt = vrtRasterLayer->extent().yMaximum(); diff --git a/tests/src/core/testqgsrasterlayer.cpp b/tests/src/core/testqgsrasterlayer.cpp index 5a4b36bd2d63..f5212f4e436c 100644 --- a/tests/src/core/testqgsrasterlayer.cpp +++ b/tests/src/core/testqgsrasterlayer.cpp @@ -683,10 +683,10 @@ void TestQgsRasterLayer::multiBandColorRendererNoDataColor() void TestQgsRasterLayer::palettedRendererNoData() { const QString rasterFileName = mTestDataDir + "raster/with_color_table.tif"; - std::unique_ptr rl = std::make_unique( rasterFileName, QStringLiteral( "rl" ) ); + auto rl = std::make_unique( rasterFileName, QStringLiteral( "rl" ) ); QVERIFY( rl->isValid() ); - std::unique_ptr rasterRenderer = std::make_unique( rl->dataProvider(), 1, QList() << QgsPalettedRasterRenderer::Class( 1, QColor( 0, 255, 0 ), QStringLiteral( "class 2" ) ) << QgsPalettedRasterRenderer::Class( 3, QColor( 255, 0, 0 ), QStringLiteral( "class 1" ) ) ); + auto rasterRenderer = std::make_unique( rl->dataProvider(), 1, QList() << QgsPalettedRasterRenderer::Class( 1, QColor( 0, 255, 0 ), QStringLiteral( "class 2" ) ) << QgsPalettedRasterRenderer::Class( 3, QColor( 255, 0, 0 ), QStringLiteral( "class 1" ) ) ); QVERIFY( rl->dataProvider()->setNoDataValue( 1, 2 ) ); rl->setRenderer( rasterRenderer.release() ); mMapSettings->setLayers( QList() << rl.get() ); @@ -698,7 +698,7 @@ void TestQgsRasterLayer::palettedRendererNoData() void TestQgsRasterLayer::palettedRendererRasterAttributeTable() { const QString rasterFileName = mTestDataDir + "raster/band1_byte_attribute_table_epsg4326.tif"; - std::unique_ptr rl = std::make_unique( rasterFileName, QStringLiteral( "rl" ) ); + auto rl = std::make_unique( rasterFileName, QStringLiteral( "rl" ) ); QVERIFY( rl->isValid() ); QVERIFY( rl->dataProvider()->setNoDataValue( 1, 9999 ) ); mMapSettings->setLayers( QList() << rl.get() ); @@ -751,7 +751,7 @@ void TestQgsRasterLayer::palettedRendererRasterAttributeTable() void TestQgsRasterLayer::palettedRendererNoDataColor() { const QString rasterFileName = mTestDataDir + "raster/with_color_table.tif"; - std::unique_ptr rl = std::make_unique( rasterFileName, QStringLiteral( "rl" ) ); + auto rl = std::make_unique( rasterFileName, QStringLiteral( "rl" ) ); QVERIFY( rl->isValid() ); QgsPalettedRasterRenderer *rasterRenderer = new QgsPalettedRasterRenderer( rl->dataProvider(), 1, QList() << QgsPalettedRasterRenderer::Class( 1, QColor( 0, 255, 0 ), QStringLiteral( "class 2" ) ) << QgsPalettedRasterRenderer::Class( 3, QColor( 255, 0, 0 ), QStringLiteral( "class 1" ) ) ); @@ -774,7 +774,7 @@ void TestQgsRasterLayer::palettedRendererConstantInt() Q_ASSERT( hDS ); GDALFillRaster( GDALGetRasterBand( hDS, 1 ), value, 0 ); GDALClose( hDS ); - std::unique_ptr rl = std::make_unique( QString( tempFileName ), QStringLiteral( "rl" ) ); + auto rl = std::make_unique( QString( tempFileName ), QStringLiteral( "rl" ) ); Q_ASSERT( rl->isValid() ); const auto classData { QgsPalettedRasterRenderer::classDataFromRaster( rl->dataProvider(), 1 ) }; QCOMPARE( classData.size(), 1 ); @@ -790,10 +790,10 @@ void TestQgsRasterLayer::singleBandGrayRendererNoData() QFile::copy( mTestDataDir + "landsat.tif", tmpDir.filePath( QStringLiteral( "landsat.tif" ) ) ); const QString rasterFileName = tmpDir.filePath( QStringLiteral( "landsat.tif" ) ); - std::unique_ptr rl = std::make_unique( rasterFileName, QStringLiteral( "rl" ) ); + auto rl = std::make_unique( rasterFileName, QStringLiteral( "rl" ) ); QVERIFY( rl->isValid() ); - std::unique_ptr rasterRenderer = std::make_unique( rl->dataProvider(), 1 ); + auto rasterRenderer = std::make_unique( rl->dataProvider(), 1 ); QVERIFY( rl->dataProvider()->setNoDataValue( 1, 126 ) ); rl->setRenderer( rasterRenderer.release() ); mMapSettings->setLayers( QList() << rl.get() ); @@ -809,10 +809,10 @@ void TestQgsRasterLayer::singleBandGrayRendererNoDataColor() QFile::copy( mTestDataDir + "landsat.tif", tmpDir.filePath( QStringLiteral( "landsat.tif" ) ) ); const QString rasterFileName = tmpDir.filePath( QStringLiteral( "landsat.tif" ) ); - std::unique_ptr rl = std::make_unique( rasterFileName, QStringLiteral( "rl" ) ); + auto rl = std::make_unique( rasterFileName, QStringLiteral( "rl" ) ); QVERIFY( rl->isValid() ); - std::unique_ptr rasterRenderer = std::make_unique( rl->dataProvider(), 1 ); + auto rasterRenderer = std::make_unique( rl->dataProvider(), 1 ); QVERIFY( rl->dataProvider()->setNoDataValue( 1, 126 ) ); rasterRenderer->setNodataColor( QColor( 255, 0, 255 ) ); rl->setRenderer( rasterRenderer.release() ); @@ -829,7 +829,7 @@ void TestQgsRasterLayer::singleBandPseudoRendererNoData() QFile::copy( mTestDataDir + "landsat.tif", tmpDir.filePath( QStringLiteral( "landsat.tif" ) ) ); const QString rasterFileName = tmpDir.filePath( QStringLiteral( "landsat.tif" ) ); - std::unique_ptr rl = std::make_unique( rasterFileName, QStringLiteral( "rl" ) ); + auto rl = std::make_unique( rasterFileName, QStringLiteral( "rl" ) ); QVERIFY( rl->isValid() ); QgsRasterShader *rasterShader = new QgsRasterShader(); @@ -858,7 +858,7 @@ void TestQgsRasterLayer::singleBandPseudoRendererNoData() colorRampShader->setColorRampItemList( colorRampItems ); rasterShader->setRasterShaderFunction( colorRampShader ); - std::unique_ptr rasterRenderer = std::make_unique( rl->dataProvider(), 1, rasterShader ); + auto rasterRenderer = std::make_unique( rl->dataProvider(), 1, rasterShader ); QVERIFY( rl->dataProvider()->setNoDataValue( 1, 126 ) ); rl->setRenderer( rasterRenderer.release() ); mMapSettings->setLayers( QList() << rl.get() ); @@ -874,7 +874,7 @@ void TestQgsRasterLayer::singleBandPseudoRendererNoDataColor() QFile::copy( mTestDataDir + "landsat.tif", tmpDir.filePath( QStringLiteral( "landsat.tif" ) ) ); const QString rasterFileName = tmpDir.filePath( QStringLiteral( "landsat.tif" ) ); - std::unique_ptr rl = std::make_unique( rasterFileName, QStringLiteral( "rl" ) ); + auto rl = std::make_unique( rasterFileName, QStringLiteral( "rl" ) ); QVERIFY( rl->isValid() ); QgsRasterShader *rasterShader = new QgsRasterShader(); @@ -903,7 +903,7 @@ void TestQgsRasterLayer::singleBandPseudoRendererNoDataColor() colorRampShader->setColorRampItemList( colorRampItems ); rasterShader->setRasterShaderFunction( colorRampShader ); - std::unique_ptr rasterRenderer = std::make_unique( rl->dataProvider(), 1, rasterShader ); + auto rasterRenderer = std::make_unique( rl->dataProvider(), 1, rasterShader ); QVERIFY( rl->dataProvider()->setNoDataValue( 1, 126 ) ); rasterRenderer->setNodataColor( QColor( 255, 0, 255 ) ); rl->setRenderer( rasterRenderer.release() ); @@ -1021,7 +1021,7 @@ void TestQgsRasterLayer::sample() QString fileName = mTestDataDir + "landsat-f32-b1.tif"; QFileInfo rasterFileInfo( fileName ); - std::unique_ptr rl = std::make_unique( rasterFileInfo.filePath(), rasterFileInfo.completeBaseName() ); + auto rl = std::make_unique( rasterFileInfo.filePath(), rasterFileInfo.completeBaseName() ); QVERIFY( rl->isValid() ); QVERIFY( std::isnan( rl->dataProvider()->sample( QgsPointXY( 0, 0 ), 1 ) ) ); bool ok = false; @@ -1102,13 +1102,13 @@ void TestQgsRasterLayer::rotatedRaster() { mMapSettings->setExtent( QgsRectangle( 994, 922, 1174, 1102 ) ); - std::unique_ptr rgb = std::make_unique( mTestDataDir + "raster/rotated_rgb.png", QStringLiteral( "rgb" ) ); + auto rgb = std::make_unique( mTestDataDir + "raster/rotated_rgb.png", QStringLiteral( "rgb" ) ); QVERIFY( rgb->isValid() ); mMapSettings->setLayers( QList() << rgb.get() ); QVERIFY( render( QStringLiteral( "raster_rotated_rgb" ) ) ); - std::unique_ptr rgba = std::make_unique( mTestDataDir + "raster/rotated_rgba.png", QStringLiteral( "rgba" ) ); + auto rgba = std::make_unique( mTestDataDir + "raster/rotated_rgba.png", QStringLiteral( "rgba" ) ); QVERIFY( rgba->isValid() ); mMapSettings->setLayers( QList() << rgba.get() ); diff --git a/tests/src/core/testqgsrenderers.cpp b/tests/src/core/testqgsrenderers.cpp index 913aa82705cd..984087821af0 100644 --- a/tests/src/core/testqgsrenderers.cpp +++ b/tests/src/core/testqgsrenderers.cpp @@ -156,7 +156,7 @@ void TestQgsRenderers::emptyGeometry() QgsProject::instance()->addMapLayer( vl ); QgsFeature f; - std::unique_ptr mp = std::make_unique(); + auto mp = std::make_unique(); mp->addGeometry( new QgsPolygon() ); f.setGeometry( QgsGeometry( std::move( mp ) ) ); QVERIFY( vl->dataProvider()->addFeature( f ) ); @@ -182,7 +182,7 @@ void TestQgsRenderers::emptyGeometry() vl = new QgsVectorLayer( QStringLiteral( "MultiLineString?crs=epsg:4326&field=pk:int&field=col1:string" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( vl->isValid() ); QgsProject::instance()->addMapLayer( vl ); - std::unique_ptr mls = std::make_unique(); + auto mls = std::make_unique(); mls->addGeometry( new QgsLineString() ); f.setGeometry( QgsGeometry( std::move( mls ) ) ); QVERIFY( vl->dataProvider()->addFeature( f ) ); @@ -192,7 +192,7 @@ void TestQgsRenderers::emptyGeometry() vl = new QgsVectorLayer( QStringLiteral( "MultiPoint?crs=epsg:4326&field=pk:int&field=col1:string" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( vl->isValid() ); QgsProject::instance()->addMapLayer( vl ); - std::unique_ptr mlp = std::make_unique(); + auto mlp = std::make_unique(); f.setGeometry( QgsGeometry( std::move( mlp ) ) ); QVERIFY( vl->dataProvider()->addFeature( f ) ); QVERIFY( checkEmptyRender( "MultiPoint", vl ) ); diff --git a/tests/src/core/testqgsrulebasedrenderer.cpp b/tests/src/core/testqgsrulebasedrenderer.cpp index 2fde23257b73..473d81f66ba6 100644 --- a/tests/src/core/testqgsrulebasedrenderer.cpp +++ b/tests/src/core/testqgsrulebasedrenderer.cpp @@ -164,7 +164,7 @@ class TestQgsRuleBasedRenderer : public QgsTest */ void test_many_rules_expression_filter() { - std::unique_ptr layer = std::make_unique( QStringLiteral( "point?field=fld:int" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); + auto layer = std::make_unique( QStringLiteral( "point?field=fld:int" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); QgsRenderContext ctx; // dummy render context ctx.expressionContext().setFields( layer->fields() ); @@ -194,7 +194,7 @@ class TestQgsRuleBasedRenderer : public QgsTest void testElse() { const QString shpFile = TEST_DATA_DIR + QStringLiteral( "/rectangles.shp" ); - std::unique_ptr layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); + auto layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); QVERIFY( layer->isValid() ); QgsField vfield = QgsField( QStringLiteral( "fa_cy-fie+ld" ), QMetaType::Type::Int ); layer->addExpressionField( QStringLiteral( "\"id\"" ), vfield ); @@ -232,7 +232,7 @@ class TestQgsRuleBasedRenderer : public QgsTest void testDisabledElse() { const QString shpFile = TEST_DATA_DIR + QStringLiteral( "/rectangles.shp" ); - std::unique_ptr layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); + auto layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); QVERIFY( layer->isValid() ); QgsField vfield = QgsField( QStringLiteral( "fa_cy-fie+ld" ), QMetaType::Type::Int ); layer->addExpressionField( QStringLiteral( "\"id\"" ), vfield ); @@ -272,7 +272,7 @@ class TestQgsRuleBasedRenderer : public QgsTest void testNoMatchingZoomRanges() { const QString shpFile = TEST_DATA_DIR + QStringLiteral( "/rectangles.shp" ); - std::unique_ptr layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); + auto layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); QVERIFY( layer->isValid() ); QgsField vfield = QgsField( QStringLiteral( "fa_cy-fie+ld" ), QMetaType::Type::Int ); layer->addExpressionField( QStringLiteral( "\"id\"" ), vfield ); @@ -330,7 +330,7 @@ class TestQgsRuleBasedRenderer : public QgsTest void testWillRenderFeature() { const QString shpFile = TEST_DATA_DIR + QStringLiteral( "/rectangles.shp" ); - std::unique_ptr layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); + auto layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); QVERIFY( layer->isValid() ); QgsField vfield = QgsField( QStringLiteral( "fa_cy-fie+ld" ), QMetaType::Type::Int ); layer->addExpressionField( QStringLiteral( "\"id\"" ), vfield ); @@ -385,7 +385,7 @@ class TestQgsRuleBasedRenderer : public QgsTest void testGroupAndElseRules() { const QString shpFile = TEST_DATA_DIR + QStringLiteral( "/rectangles.shp" ); - std::unique_ptr layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); + auto layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); QVERIFY( layer->isValid() ); QgsField vfield = QgsField( QStringLiteral( "fa_cy-fie+ld" ), QMetaType::Type::Int ); layer->addExpressionField( QStringLiteral( "\"id\"" ), vfield ); @@ -430,7 +430,7 @@ class TestQgsRuleBasedRenderer : public QgsTest void testWillRenderFeatureNestedElse() { const QString shpFile = TEST_DATA_DIR + QStringLiteral( "/rectangles.shp" ); - std::unique_ptr layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); + auto layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); QVERIFY( layer->isValid() ); QgsField vfield = QgsField( QStringLiteral( "fa_cy-fie+ld" ), QMetaType::Type::Int ); layer->addExpressionField( QStringLiteral( "\"id\"" ), vfield ); @@ -480,7 +480,7 @@ class TestQgsRuleBasedRenderer : public QgsTest // Regression #21287, also test rulesForFeature since there were no tests any where and I've found a couple of issues const QString shpFile = TEST_DATA_DIR + QStringLiteral( "/rectangles.shp" ); - std::unique_ptr layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); + auto layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); QVERIFY( layer->isValid() ); QgsField vfield = QgsField( QStringLiteral( "fa_cy-fie+ld" ), QMetaType::Type::Int ); layer->addExpressionField( QStringLiteral( "\"id\"" ), vfield ); @@ -545,7 +545,7 @@ class TestQgsRuleBasedRenderer : public QgsTest rootrule->appendChild( r1 ); rootrule->appendChild( r2 ); - std::unique_ptr renderer = std::make_unique( rootrule ); + auto renderer = std::make_unique( rootrule ); QgsMapSettings mapsettings; mapsettings.setOutputSize( QSize( 400, 400 ) ); @@ -559,7 +559,7 @@ class TestQgsRuleBasedRenderer : public QgsTest void testPointsUsedAttributes() { const QString shpFile = TEST_DATA_DIR + QStringLiteral( "/points.shp" ); - std::unique_ptr layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); + auto layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); QVERIFY( layer->isValid() ); // Create rulebased style @@ -616,7 +616,7 @@ class TestQgsRuleBasedRenderer : public QgsTest void testFeatureCount() { const QString shpFile = TEST_DATA_DIR + QStringLiteral( "/rectangles.shp" ); - std::unique_ptr layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); + auto layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); QVERIFY( layer->isValid() ); QgsField vfield = QgsField( QStringLiteral( "fa_cy-fie+ld" ), QMetaType::Type::Int ); layer->addExpressionField( QStringLiteral( "\"id\"" ), vfield ); @@ -672,7 +672,7 @@ class TestQgsRuleBasedRenderer : public QgsTest // Test refining rule with categories (refs #10815) const QString shpFile = TEST_DATA_DIR + QStringLiteral( "/rectangles.shp" ); - std::unique_ptr layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); + auto layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); QVERIFY( layer->isValid() ); QgsField vfield = QgsField( QStringLiteral( "fa_cy-fie+ld" ), QMetaType::Type::Int ); layer->addExpressionField( QStringLiteral( "\"id\"" ), vfield ); @@ -686,7 +686,7 @@ class TestQgsRuleBasedRenderer : public QgsTest QgsRuleBasedRenderer::Rule *r2 = new QgsRuleBasedRenderer::Rule( sym2, 0, 0, "\"id\" = 2" ); QgsRuleBasedRenderer::Rule *r3 = new QgsRuleBasedRenderer::Rule( sym3, 0, 0, "ELSE" ); - std::unique_ptr rootrule = std::make_unique( nullptr ); + auto rootrule = std::make_unique( nullptr ); rootrule->appendChild( r1 ); rootrule->appendChild( r2 ); rootrule->appendChild( r3 ); @@ -696,7 +696,7 @@ class TestQgsRuleBasedRenderer : public QgsTest cats.append( QgsRendererCategory( 1, new QgsMarkerSymbol(), "id 1" ) ); cats.append( QgsRendererCategory( 2, new QgsMarkerSymbol(), QString() ) ); cats.append( QgsRendererCategory( QVariant(), new QgsMarkerSymbol(), QString() ) ); - std::unique_ptr c = std::make_unique( "id", cats ); + auto c = std::make_unique( "id", cats ); QgsRuleBasedRenderer::refineRuleCategories( r2, c.get() ); QCOMPARE( r2->children()[0]->filterExpression(), "\"id\" = 1" ); @@ -736,7 +736,7 @@ class TestQgsRuleBasedRenderer : public QgsTest // Test refining rule with ranges (refs #10815) const QString shpFile = TEST_DATA_DIR + QStringLiteral( "/rectangles.shp" ); - std::unique_ptr layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); + auto layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); QVERIFY( layer->isValid() ); QgsField vfield = QgsField( QStringLiteral( "fa_cy-fie+ld" ), QMetaType::Type::Int ); layer->addExpressionField( QStringLiteral( "\"id\"" ), vfield ); @@ -750,7 +750,7 @@ class TestQgsRuleBasedRenderer : public QgsTest QgsRuleBasedRenderer::Rule *r2 = new QgsRuleBasedRenderer::Rule( sym2, 0, 0, "\"id\" = 2" ); QgsRuleBasedRenderer::Rule *r3 = new QgsRuleBasedRenderer::Rule( sym3, 0, 0, "ELSE" ); - std::unique_ptr rootrule = std::make_unique( nullptr ); + auto rootrule = std::make_unique( nullptr ); rootrule->appendChild( r1 ); rootrule->appendChild( r2 ); rootrule->appendChild( r3 ); @@ -759,7 +759,7 @@ class TestQgsRuleBasedRenderer : public QgsTest QList ranges; ranges.append( QgsRendererRange( 0, 1, new QgsMarkerSymbol(), "0-1" ) ); ranges.append( QgsRendererRange( 1, 2, new QgsMarkerSymbol(), "1-2" ) ); - std::unique_ptr c = std::make_unique( "id", ranges ); + auto c = std::make_unique( "id", ranges ); QgsRuleBasedRenderer::refineRuleRanges( r2, c.get() ); QCOMPARE( r2->children()[0]->filterExpression(), "\"id\" >= 0.0000 AND \"id\" <= 1.0000" ); @@ -791,7 +791,7 @@ class TestQgsRuleBasedRenderer : public QgsTest // Test converting categorised renderer to rule based const QString shpFile = TEST_DATA_DIR + QStringLiteral( "/rectangles.shp" ); - std::unique_ptr layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); + auto layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); QVERIFY( layer->isValid() ); QgsField vfield = QgsField( QStringLiteral( "fa_cy-fie+ld" ), QMetaType::Type::Int ); layer->addExpressionField( QStringLiteral( "\"id\"" ), vfield ); @@ -805,7 +805,7 @@ class TestQgsRuleBasedRenderer : public QgsTest QgsRuleBasedRenderer::Rule *r2 = new QgsRuleBasedRenderer::Rule( sym2, 0, 0, "\"id\" = 2" ); QgsRuleBasedRenderer::Rule *r3 = new QgsRuleBasedRenderer::Rule( sym3, 0, 0, "ELSE" ); - std::unique_ptr rootrule = std::make_unique( nullptr ); + auto rootrule = std::make_unique( nullptr ); rootrule->appendChild( r1 ); rootrule->appendChild( r2 ); rootrule->appendChild( r3 ); @@ -819,7 +819,7 @@ class TestQgsRuleBasedRenderer : public QgsTest cats.append( QgsRendererCategory( "a\\b", new QgsMarkerSymbol(), "id a\\\\b" ) ); cats.append( QgsRendererCategory( "a\tb", new QgsMarkerSymbol(), "id a\\tb" ) ); cats.append( QgsRendererCategory( QVariantList( { "c", "d" } ), new QgsMarkerSymbol(), "c/d" ) ); - std::unique_ptr c = std::make_unique( "id", cats ); + auto c = std::make_unique( "id", cats ); std::unique_ptr r( QgsRuleBasedRenderer::convertFromRenderer( c.get(), layer.get() ) ); QCOMPARE( r->rootRule()->children().size(), 7 ); @@ -881,7 +881,7 @@ class TestQgsRuleBasedRenderer : public QgsTest QgsRuleBasedRenderer::Rule *r2 = new QgsRuleBasedRenderer::Rule( sym2, 0, 0, "\"id\" = 2" ); QgsRuleBasedRenderer::Rule *r3 = new QgsRuleBasedRenderer::Rule( sym3, 0, 0, "ELSE" ); - std::unique_ptr rootrule = std::make_unique( nullptr ); + auto rootrule = std::make_unique( nullptr ); rootrule->appendChild( r1 ); rootrule->appendChild( r2 ); rootrule->appendChild( r3 ); @@ -895,7 +895,7 @@ class TestQgsRuleBasedRenderer : public QgsTest cats.append( QgsRendererCategory( "a\\b", new QgsMarkerSymbol(), "id a\\\\b" ) ); cats.append( QgsRendererCategory( "a\tb", new QgsMarkerSymbol(), "id a\\tb" ) ); cats.append( QgsRendererCategory( QVariantList( { "c", "d" } ), new QgsMarkerSymbol(), "c/d" ) ); - std::unique_ptr c = std::make_unique( "id", cats ); + auto c = std::make_unique( "id", cats ); std::unique_ptr r( QgsRuleBasedRenderer::convertFromRenderer( c.get() ) ); QCOMPARE( r->rootRule()->children().size(), 7 ); @@ -950,7 +950,7 @@ class TestQgsRuleBasedRenderer : public QgsTest // Test converting graduated renderer to rule based const QString shpFile = TEST_DATA_DIR + QStringLiteral( "/rectangles.shp" ); - std::unique_ptr layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); + auto layer = std::make_unique( shpFile, QStringLiteral( "rectangles" ), QStringLiteral( "ogr" ) ); QVERIFY( layer->isValid() ); QgsField vfield = QgsField( QStringLiteral( "fa_cy-fie+ld" ), QMetaType::Type::Int ); layer->addExpressionField( QStringLiteral( "\"id\"" ), vfield ); @@ -964,7 +964,7 @@ class TestQgsRuleBasedRenderer : public QgsTest QgsRuleBasedRenderer::Rule *r2 = new QgsRuleBasedRenderer::Rule( sym2, 0, 0, "\"id\" = 2" ); QgsRuleBasedRenderer::Rule *r3 = new QgsRuleBasedRenderer::Rule( sym3, 0, 0, "ELSE" ); - std::unique_ptr rootrule = std::make_unique( nullptr ); + auto rootrule = std::make_unique( nullptr ); rootrule->appendChild( r1 ); rootrule->appendChild( r2 ); rootrule->appendChild( r3 ); @@ -973,7 +973,7 @@ class TestQgsRuleBasedRenderer : public QgsTest QList ranges; ranges.append( QgsRendererRange( 0, 1, new QgsMarkerSymbol(), "0-1" ) ); ranges.append( QgsRendererRange( 1, 2, new QgsMarkerSymbol(), "1-2" ) ); - std::unique_ptr c = std::make_unique( "id", ranges ); + auto c = std::make_unique( "id", ranges ); std::unique_ptr r( QgsRuleBasedRenderer::convertFromRenderer( c.get(), layer.get() ) ); QCOMPARE( r->rootRule()->children().size(), 2 ); @@ -1027,7 +1027,7 @@ class TestQgsRuleBasedRenderer : public QgsTest QgsRuleBasedRenderer::Rule *r2 = new QgsRuleBasedRenderer::Rule( sym2, 0, 0, "\"id\" = 2" ); QgsRuleBasedRenderer::Rule *r3 = new QgsRuleBasedRenderer::Rule( sym3, 0, 0, "ELSE" ); - std::unique_ptr rootrule = std::make_unique( nullptr ); + auto rootrule = std::make_unique( nullptr ); rootrule->appendChild( r1 ); rootrule->appendChild( r2 ); rootrule->appendChild( r3 ); @@ -1036,7 +1036,7 @@ class TestQgsRuleBasedRenderer : public QgsTest QList ranges; ranges.append( QgsRendererRange( 0, 1, new QgsMarkerSymbol(), "0-1" ) ); ranges.append( QgsRendererRange( 1, 2, new QgsMarkerSymbol(), "1-2" ) ); - std::unique_ptr c = std::make_unique( "id", ranges ); + auto c = std::make_unique( "id", ranges ); std::unique_ptr r( QgsRuleBasedRenderer::convertFromRenderer( c.get() ) ); QCOMPARE( r->rootRule()->children().size(), 2 ); @@ -1081,7 +1081,7 @@ class TestQgsRuleBasedRenderer : public QgsTest void testConvertFromEmbedded() { // Test converting an embedded symbol renderer to a rule based renderer - std::unique_ptr layer = std::make_unique( QStringLiteral( "Point" ), QStringLiteral( "points" ), QStringLiteral( "memory" ) ); + auto layer = std::make_unique( QStringLiteral( "Point" ), QStringLiteral( "points" ), QStringLiteral( "memory" ) ); QVERIFY( layer->isValid() ); QgsFeature f; @@ -1120,7 +1120,7 @@ class TestQgsRuleBasedRenderer : public QgsTest void testNullsCount() { - std::unique_ptr layer = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=number:int" ), QStringLiteral( "test" ), QStringLiteral( "memory" ) ); + auto layer = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=number:int" ), QStringLiteral( "test" ), QStringLiteral( "memory" ) ); QVERIFY( layer->isValid() ); QgsFeature f( layer->fields() ); @@ -1153,7 +1153,7 @@ class TestQgsRuleBasedRenderer : public QgsTest void testLegendKeys() { QgsRuleBasedRenderer::Rule *rootRule = new QgsRuleBasedRenderer::Rule( nullptr ); - std::unique_ptr renderer = std::make_unique( rootRule ); + auto renderer = std::make_unique( rootRule ); QVERIFY( renderer->legendKeys().empty() ); @@ -1179,7 +1179,7 @@ class TestQgsRuleBasedRenderer : public QgsTest void testLegendKeysForFeature() { QgsRuleBasedRenderer::Rule *rootRule = new QgsRuleBasedRenderer::Rule( nullptr ); - std::unique_ptr renderer = std::make_unique( rootRule ); + auto renderer = std::make_unique( rootRule ); std::unique_ptr symbol( QgsMarkerSymbol::createSimple( {} ) ); QgsRuleBasedRenderer::Rule *lessThanTwoRule = new QgsRuleBasedRenderer::Rule( symbol->clone(), 0, 0, "\"Importance\" <= 2" ); @@ -1243,7 +1243,7 @@ class TestQgsRuleBasedRenderer : public QgsTest void testLegendKeyToExpression() { QgsRuleBasedRenderer::Rule *rootRule = new QgsRuleBasedRenderer::Rule( nullptr ); - std::unique_ptr renderer = std::make_unique( rootRule ); + auto renderer = std::make_unique( rootRule ); bool ok = false; QString exp = renderer->legendKeyToExpression( "xxxx", nullptr, ok ); @@ -1362,7 +1362,7 @@ class TestQgsRuleBasedRenderer : public QgsTest void testElseRuleSld() { QgsRuleBasedRenderer::Rule *rootRule = new QgsRuleBasedRenderer::Rule( nullptr ); - std::unique_ptr renderer = std::make_unique( rootRule ); + auto renderer = std::make_unique( rootRule ); QgsRuleBasedRenderer::Rule *rule1 = new QgsRuleBasedRenderer::Rule( QgsSymbol::defaultSymbol( Qgis::GeometryType::Point ), 0, 0, "\"field_name\" = 1" ); QgsRuleBasedRenderer::Rule *rule2 = new QgsRuleBasedRenderer::Rule( QgsSymbol::defaultSymbol( Qgis::GeometryType::Point ), 0, 0, "\"field_name\" = 6" ); @@ -1383,7 +1383,7 @@ class TestQgsRuleBasedRenderer : public QgsTest QCOMPARE( exp, "NOT ((\"field_name\" = 1) OR (\"field_name\" = 6))" ); QgsFields fields; - std::unique_ptr vl = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=field_name:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); + auto vl = std::make_unique( QStringLiteral( "Point?crs=epsg:4326&field=field_name:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl->setRenderer( renderer.release() ); QString error; QDomDocument dom; diff --git a/tests/src/core/testqgssnappingutils.cpp b/tests/src/core/testqgssnappingutils.cpp index 00c8c731eeea..86d4c8baa503 100644 --- a/tests/src/core/testqgssnappingutils.cpp +++ b/tests/src/core/testqgssnappingutils.cpp @@ -319,7 +319,7 @@ class TestQgsSnappingUtils : public QObject void testSnapOnIntersectionCurveZ() { // testing with a layer with curve and Z - std::unique_ptr vCurveZ( new QgsVectorLayer( QStringLiteral( "CircularStringZ" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ) ); + auto vCurveZ = std::make_unique( QStringLiteral( "CircularStringZ" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); QgsFeature f1; const QgsGeometry f1g = QgsGeometry::fromWkt( "CircularStringZ (0 0 0, 5 5 5, 0 10 10)" ); f1.setGeometry( f1g ); @@ -362,7 +362,7 @@ class TestQgsSnappingUtils : public QObject } void testSnapOnIntersectionMultiGeom() { - std::unique_ptr vMulti( new QgsVectorLayer( QStringLiteral( "MultiLineStringZ" ), QStringLiteral( "m" ), QStringLiteral( "memory" ) ) ); + auto vMulti = std::make_unique( QStringLiteral( "MultiLineStringZ" ), QStringLiteral( "m" ), QStringLiteral( "memory" ) ); QgsFeature f1; const QgsGeometry f1g = QgsGeometry::fromWkt( "MultiLineStringZ ((0 0 0, 0 5 5), (5 0 10, 5 5 10))" ); f1.setGeometry( f1g ); @@ -403,7 +403,7 @@ class TestQgsSnappingUtils : public QObject } void testSnapOnCentroidAndMiddleSegment() { - std::unique_ptr vSnapCentroidMiddle( new QgsVectorLayer( QStringLiteral( "LineString" ), QStringLiteral( "m" ), QStringLiteral( "memory" ) ) ); + auto vSnapCentroidMiddle = std::make_unique( QStringLiteral( "LineString" ), QStringLiteral( "m" ), QStringLiteral( "memory" ) ); QgsFeature f1; const QgsGeometry f1g = QgsGeometry::fromWkt( "LineString (0 0, 0 5, 5 5, 5 0, 0 0)" ); f1.setGeometry( f1g ); @@ -440,7 +440,7 @@ class TestQgsSnappingUtils : public QObject void testSnapOnLineEndpoints() { - std::unique_ptr vSnapCentroidMiddle( new QgsVectorLayer( QStringLiteral( "LineString" ), QStringLiteral( "m" ), QStringLiteral( "memory" ) ) ); + auto vSnapCentroidMiddle = std::make_unique( QStringLiteral( "LineString" ), QStringLiteral( "m" ), QStringLiteral( "memory" ) ); QgsFeature f1; const QgsGeometry f1g = QgsGeometry::fromWkt( "LineString (0 0, 0 5, 5 5, 5 0)" ); f1.setGeometry( f1g ); @@ -489,7 +489,7 @@ class TestQgsSnappingUtils : public QObject void testSnapOnLineEndpointsMultiLine() { - std::unique_ptr vSnapCentroidMiddle( new QgsVectorLayer( QStringLiteral( "MultiLineString" ), QStringLiteral( "m" ), QStringLiteral( "memory" ) ) ); + auto vSnapCentroidMiddle = std::make_unique( QStringLiteral( "MultiLineString" ), QStringLiteral( "m" ), QStringLiteral( "memory" ) ); QgsFeature f1; const QgsGeometry f1g = QgsGeometry::fromWkt( "MultiLineString ((0 0, 0 5, 5 5, 5 0), (0 -0.1, 0 -5, 5 -0.5))" ); f1.setGeometry( f1g ); @@ -557,7 +557,7 @@ class TestQgsSnappingUtils : public QObject void testSnapOnPolygonEndpoints() { - std::unique_ptr vSnapCentroidMiddle( new QgsVectorLayer( QStringLiteral( "Polygon" ), QStringLiteral( "m" ), QStringLiteral( "memory" ) ) ); + auto vSnapCentroidMiddle = std::make_unique( QStringLiteral( "Polygon" ), QStringLiteral( "m" ), QStringLiteral( "memory" ) ); QgsFeature f1; const QgsGeometry f1g = QgsGeometry::fromWkt( "Polygon ((1 0, 0 5, 5 5, 5 0, 1 0),(3 2, 3.5 2, 3.5 3, 3 2))" ); f1.setGeometry( f1g ); @@ -608,7 +608,7 @@ class TestQgsSnappingUtils : public QObject void testSnapOnMultiPolygonEndpoints() { - std::unique_ptr vSnapCentroidMiddle( new QgsVectorLayer( QStringLiteral( "MultiPolygon" ), QStringLiteral( "m" ), QStringLiteral( "memory" ) ) ); + auto vSnapCentroidMiddle = std::make_unique( QStringLiteral( "MultiPolygon" ), QStringLiteral( "m" ), QStringLiteral( "memory" ) ); QgsFeature f1; const QgsGeometry f1g = QgsGeometry::fromWkt( "MultiPolygon (((1 0, 0 5, 5 5, 5 0, 1 0),(3 2, 3.5 2, 3.5 3, 3 2)), ((10 0, 10 5, 15 5, 15 0, 10 0),(13 2, 13.5 2, 13.5 3, 13 2)) )" ); f1.setGeometry( f1g ); diff --git a/tests/src/core/testqgsspatialindex.cpp b/tests/src/core/testqgsspatialindex.cpp index 149038dd6baf..83e62695195a 100644 --- a/tests/src/core/testqgsspatialindex.cpp +++ b/tests/src/core/testqgsspatialindex.cpp @@ -248,7 +248,7 @@ class TestQgsSpatialIndex : public QObject void bulkLoadWithCallback() { - std::unique_ptr vl = std::make_unique( QStringLiteral( "Point" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); + auto vl = std::make_unique( QStringLiteral( "Point" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); QList addedIds; for ( int i = 0; i < 10; ++i ) { diff --git a/tests/src/core/testqgsspatialindexkdbush.cpp b/tests/src/core/testqgsspatialindexkdbush.cpp index f6c0dde86f3f..8c69f7041cb4 100644 --- a/tests/src/core/testqgsspatialindexkdbush.cpp +++ b/tests/src/core/testqgsspatialindexkdbush.cpp @@ -81,7 +81,7 @@ class TestQgsSpatialIndexKdBush : public QObject void testQuery() { - std::unique_ptr vl = std::make_unique( "Point", QString(), QStringLiteral( "memory" ) ); + auto vl = std::make_unique( "Point", QString(), QStringLiteral( "memory" ) ); for ( QgsFeature f : _pointFeatures() ) vl->dataProvider()->addFeature( f ); const QgsSpatialIndexKDBush index( *vl->dataProvider() ); @@ -115,14 +115,14 @@ class TestQgsSpatialIndexKdBush : public QObject void testCopy() { - std::unique_ptr vl = std::make_unique( "Point", QString(), QStringLiteral( "memory" ) ); + auto vl = std::make_unique( "Point", QString(), QStringLiteral( "memory" ) ); for ( QgsFeature f : _pointFeatures() ) vl->dataProvider()->addFeature( f ); - std::unique_ptr index( new QgsSpatialIndexKDBush( *vl->dataProvider() ) ); + auto index = std::make_unique( *vl->dataProvider() ); // create copy of the index - std::unique_ptr indexCopy( new QgsSpatialIndexKDBush( *index ) ); + auto indexCopy = std::make_unique( *index ); QVERIFY( index->d == indexCopy->d ); QVERIFY( index->d->ref == 2 ); @@ -145,7 +145,7 @@ class TestQgsSpatialIndexKdBush : public QObject QVERIFY( indexCopy->d->ref == 1 ); // assignment operator - std::unique_ptr vl2 = std::make_unique( "Point", QString(), QStringLiteral( "memory" ) ); + auto vl2 = std::make_unique( "Point", QString(), QStringLiteral( "memory" ) ); QgsSpatialIndexKDBush index3( *vl2->dataProvider() ); QVERIFY( index3.size() == 0 ); fids = index3.intersects( QgsRectangle( 0, 0, 10, 10 ) ); diff --git a/tests/src/core/testqgssqliteexpressioncompiler.cpp b/tests/src/core/testqgssqliteexpressioncompiler.cpp index 8197d4512b5f..3ae089e9f7fb 100644 --- a/tests/src/core/testqgssqliteexpressioncompiler.cpp +++ b/tests/src/core/testqgssqliteexpressioncompiler.cpp @@ -124,7 +124,7 @@ void TestQgsSQLiteExpressionCompiler::testPreparedCachedNodes() QgsExpression exp( QStringLiteral( "\"Z\" = (1 + 2) OR \"z\" < (@static_var + 5)" ) ); QgsExpressionContext context; - std::unique_ptr scope = std::make_unique(); + auto scope = std::make_unique(); scope->setVariable( QStringLiteral( "static_var" ), 10, true ); context.appendScope( scope.release() ); // not possible to compile due to use of a variable diff --git a/tests/src/core/testqgsstyle.cpp b/tests/src/core/testqgsstyle.cpp index a1fbde844d66..2c4569c6e6aa 100644 --- a/tests/src/core/testqgsstyle.cpp +++ b/tests/src/core/testqgsstyle.cpp @@ -1581,7 +1581,7 @@ void TestStyle::testColorRampShaderClassificationEqualInterval() { // Test Type::Interpolated and ClassificationMode::EqualInterval { - std::unique_ptr shader( new QgsColorRampShader( 0.0, 255.0, new QgsGradientColorRamp( Qt::green, Qt::blue ), Qgis::ShaderInterpolationMethod::Linear, Qgis::ShaderClassificationMethod::EqualInterval ) ); + auto shader = std::make_unique( 0.0, 255.0, new QgsGradientColorRamp( Qt::green, Qt::blue ), Qgis::ShaderInterpolationMethod::Linear, Qgis::ShaderClassificationMethod::EqualInterval ); shader->classifyColorRamp( 5, -1 ); QList itemsList = shader->colorRampItemList(); @@ -1597,7 +1597,7 @@ void TestStyle::testColorRampShaderClassificationEqualInterval() // Test Type::Exact and ClassificationMode::EqualInterval { - std::unique_ptr shader( new QgsColorRampShader( 0.0, 255.0, new QgsGradientColorRamp( Qt::green, Qt::blue ), Qgis::ShaderInterpolationMethod::Exact, Qgis::ShaderClassificationMethod::EqualInterval ) ); + auto shader = std::make_unique( 0.0, 255.0, new QgsGradientColorRamp( Qt::green, Qt::blue ), Qgis::ShaderInterpolationMethod::Exact, Qgis::ShaderClassificationMethod::EqualInterval ); shader->classifyColorRamp( 5, -1 ); QList itemsList = shader->colorRampItemList(); @@ -1613,7 +1613,7 @@ void TestStyle::testColorRampShaderClassificationEqualInterval() // Test Type::Discrete and ClassificationMode::EqualInterval { - std::unique_ptr shader( new QgsColorRampShader( 0.0, 255.0, new QgsGradientColorRamp( Qt::green, Qt::blue ), Qgis::ShaderInterpolationMethod::Discrete, Qgis::ShaderClassificationMethod::EqualInterval ) ); + auto shader = std::make_unique( 0.0, 255.0, new QgsGradientColorRamp( Qt::green, Qt::blue ), Qgis::ShaderInterpolationMethod::Discrete, Qgis::ShaderClassificationMethod::EqualInterval ); shader->classifyColorRamp( 5, -1 ); QList itemsList = shader->colorRampItemList(); @@ -1631,7 +1631,7 @@ void TestStyle::testColorRampShaderClassificationEqualInterval() for ( int i = 0; i < 3; ++i ) { const Qgis::ShaderInterpolationMethod type = static_cast( i ); - std::unique_ptr shader( new QgsColorRampShader( 0.0, 0.0, new QgsGradientColorRamp( Qt::green, Qt::blue ), type, Qgis::ShaderClassificationMethod::EqualInterval ) ); + auto shader = std::make_unique( 0.0, 0.0, new QgsGradientColorRamp( Qt::green, Qt::blue ), type, Qgis::ShaderClassificationMethod::EqualInterval ); shader->classifyColorRamp( 5, -1 ); QList itemsList = shader->colorRampItemList(); @@ -1648,7 +1648,7 @@ void TestStyle::testColorRampShaderClassificationContinius() { // Test Type::Interpolated and ClassificationMode::Continuous { - std::unique_ptr shader( new QgsColorRampShader( 0.0, 255.0, new QgsGradientColorRamp( Qt::green, Qt::blue ), Qgis::ShaderInterpolationMethod::Linear, Qgis::ShaderClassificationMethod::Continuous ) ); + auto shader = std::make_unique( 0.0, 255.0, new QgsGradientColorRamp( Qt::green, Qt::blue ), Qgis::ShaderInterpolationMethod::Linear, Qgis::ShaderClassificationMethod::Continuous ); shader->classifyColorRamp( 5, -1 ); QList itemsList = shader->colorRampItemList(); @@ -1661,7 +1661,7 @@ void TestStyle::testColorRampShaderClassificationContinius() // Test Type::Exact and ClassificationMode::Continuous { - std::unique_ptr shader( new QgsColorRampShader( 0.0, 255.0, new QgsGradientColorRamp( Qt::green, Qt::blue ), Qgis::ShaderInterpolationMethod::Exact, Qgis::ShaderClassificationMethod::Continuous ) ); + auto shader = std::make_unique( 0.0, 255.0, new QgsGradientColorRamp( Qt::green, Qt::blue ), Qgis::ShaderInterpolationMethod::Exact, Qgis::ShaderClassificationMethod::Continuous ); shader->classifyColorRamp( 5, -1 ); QList itemsList = shader->colorRampItemList(); @@ -1674,7 +1674,7 @@ void TestStyle::testColorRampShaderClassificationContinius() // Test Type::Discrete and ClassificationMode::Continuous { - std::unique_ptr shader( new QgsColorRampShader( 0.0, 255.0, new QgsGradientColorRamp( Qt::green, Qt::blue ), Qgis::ShaderInterpolationMethod::Discrete, Qgis::ShaderClassificationMethod::Continuous ) ); + auto shader = std::make_unique( 0.0, 255.0, new QgsGradientColorRamp( Qt::green, Qt::blue ), Qgis::ShaderInterpolationMethod::Discrete, Qgis::ShaderClassificationMethod::Continuous ); shader->classifyColorRamp( 5, -1 ); QList itemsList = shader->colorRampItemList(); @@ -1689,7 +1689,7 @@ void TestStyle::testColorRampShaderClassificationContinius() for ( int i = 0; i < 3; ++i ) { const Qgis::ShaderInterpolationMethod type = static_cast( i ); - std::unique_ptr shader( new QgsColorRampShader( 0.0, 0.0, new QgsGradientColorRamp( Qt::green, Qt::blue ), type, Qgis::ShaderClassificationMethod::Continuous ) ); + auto shader = std::make_unique( 0.0, 0.0, new QgsGradientColorRamp( Qt::green, Qt::blue ), type, Qgis::ShaderClassificationMethod::Continuous ); shader->classifyColorRamp( 5, -1 ); QList itemsList = shader->colorRampItemList(); diff --git a/tests/src/core/testqgssvgcache.cpp b/tests/src/core/testqgssvgcache.cpp index f7b96e7fa4f8..488ba1ebe544 100644 --- a/tests/src/core/testqgssvgcache.cpp +++ b/tests/src/core/testqgssvgcache.cpp @@ -433,5 +433,6 @@ bool TestQgsSvgCache::imageCheck( const QString &testName, QImage &image, int mi mReport += checker.report(); return resultFlag; } + QGSTEST_MAIN( TestQgsSvgCache ) #include "testqgssvgcache.moc" diff --git a/tests/src/core/testqgstaskmanager.cpp b/tests/src/core/testqgstaskmanager.cpp index 67862e78fd8b..d426f848056f 100644 --- a/tests/src/core/testqgstaskmanager.cpp +++ b/tests/src/core/testqgstaskmanager.cpp @@ -376,7 +376,7 @@ void TestQgsTaskManager::cleanup() void TestQgsTaskManager::task() { - std::unique_ptr task( new TestTask( QStringLiteral( "test_task_desc" ) ) ); + auto task = std::make_unique( QStringLiteral( "test_task_desc" ) ); QCOMPARE( task->status(), QgsTask::Queued ); QCOMPARE( task->description(), QStringLiteral( "test_task_desc" ) ); QVERIFY( !task->isActive() ); @@ -394,7 +394,7 @@ void TestQgsTaskManager::task() QCOMPARE( static_cast( statusSpy.at( 1 ).at( 0 ).toInt() ), QgsTask::Complete ); //test that calling stopped sets correct state - std::unique_ptr failTask( new FailTask( QStringLiteral( "task_fail" ) ) ); + auto failTask = std::make_unique( QStringLiteral( "task_fail" ) ); QSignalSpy stoppedSpy( failTask.get(), &QgsTask::taskTerminated ); QSignalSpy statusSpy2( failTask.get(), &QgsTask::statusChanged ); failTask->start(); diff --git a/tests/src/core/testqgsvectorlayer.cpp b/tests/src/core/testqgsvectorlayer.cpp index 0fc472aca29a..cc3ce2bd2bab 100644 --- a/tests/src/core/testqgsvectorlayer.cpp +++ b/tests/src/core/testqgsvectorlayer.cpp @@ -76,6 +76,7 @@ class TestQgsVectorLayer : public QgsTest void testCopyPasteFieldConfiguration_data(); void testFieldExpression(); void testFieldAggregateExpression(); + void testAddFeatureExtentUpdated(); }; void TestQgsVectorLayer::initTestCase() @@ -495,6 +496,49 @@ void TestQgsVectorLayer::testFieldAggregateExpression() QVERIFY( qgsDoubleNear( feature2.attribute( vfIndex ).toDouble(), 359065580.0, 1 ) ); } +void TestQgsVectorLayer::testAddFeatureExtentUpdated() +{ + QgsVectorLayer *layerLine = new QgsVectorLayer( QStringLiteral( "LineString?crs=EPSG:27700" ), QStringLiteral( "layer line" ), QStringLiteral( "memory" ) ); + QVERIFY( layerLine->isValid() ); + QCOMPARE( layerLine->featureCount(), static_cast( 0 ) ); + QCOMPARE( layerLine->extent(), QgsRectangle() ); + + const QSignalSpy spyAdded( layerLine, &QgsVectorLayer::featureAdded ); + const QSignalSpy spyDeleted( layerLine, &QgsVectorLayer::featureDeleted ); + + QgsFeature lineF1; + lineF1.setGeometry( QgsGeometry::fromWkt( QStringLiteral( "LineString (2 1, 1 1, 1 5, 7 12)" ) ) ); + + connect( layerLine, &QgsVectorLayer::featureAdded, this, [&layerLine, &lineF1]( const QgsFeatureId &fid ) { + QCOMPARE( fid, lineF1.id() ); + QCOMPARE( layerLine->extent(), QgsRectangle( 1, 1, 7, 12 ) ); + QCOMPARE( layerLine->extent3D(), QgsBox3D( 1, 1, std::numeric_limits::quiet_NaN(), 7, 12, std::numeric_limits::quiet_NaN() ) ); + } ); + + connect( layerLine, &QgsVectorLayer::featureDeleted, this, [&layerLine, &lineF1]( const QgsFeatureId &fid ) { + QCOMPARE( fid, lineF1.id() ); + QCOMPARE( layerLine->extent(), QgsRectangle() ); + QCOMPARE( layerLine->extent3D(), QgsBox3D() ); + } + + ); + + layerLine->startEditing(); + layerLine->addFeature( lineF1 ); + QCOMPARE( spyAdded.count(), 1 ); + QCOMPARE( spyDeleted.count(), 0 ); + QCOMPARE( layerLine->featureCount(), static_cast( 1 ) ); + QCOMPARE( spyAdded.at( 0 ).at( 0 ), QVariant( lineF1.id() ) ); + + layerLine->deleteFeature( lineF1.id() ); + QCOMPARE( spyAdded.count(), 1 ); + QCOMPARE( spyDeleted.count(), 1 ); + QCOMPARE( layerLine->featureCount(), static_cast( 0 ) ); + QCOMPARE( spyDeleted.at( 0 ).at( 0 ), QVariant( lineF1.id() ) ); + + delete layerLine; +} + QGSTEST_MAIN( TestQgsVectorLayer ) #include "testqgsvectorlayer.moc" diff --git a/tests/src/core/testqgsvectorlayerutils.cpp b/tests/src/core/testqgsvectorlayerutils.cpp index d41e93e06d45..8a5b306876d7 100644 --- a/tests/src/core/testqgsvectorlayerutils.cpp +++ b/tests/src/core/testqgsvectorlayerutils.cpp @@ -79,7 +79,7 @@ class FeatureFetcher : public QThread void TestQgsVectorLayerUtils::testGetFeatureSource() { - std::unique_ptr vl = std::make_unique( QStringLiteral( "Point?field=col1:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); + auto vl = std::make_unique( QStringLiteral( "Point?field=col1:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); vl->startEditing(); QgsFeature f1( vl->fields(), 1 ); f1.setAttribute( QStringLiteral( "col1" ), 10 ); diff --git a/tests/src/core/testqgsvectortilelayer.cpp b/tests/src/core/testqgsvectortilelayer.cpp index 4a5f82f0b0db..200d6cef0111 100644 --- a/tests/src/core/testqgsvectortilelayer.cpp +++ b/tests/src/core/testqgsvectortilelayer.cpp @@ -67,6 +67,7 @@ class TestQgsVectorTileLayer : public QgsTest void testMbtilesProviderMetadata(); void test_relativePathsMbTiles(); void test_absoluteRelativeUriMbTiles(); + void test_mbtilesZoom16(); void test_relativePathsXyz(); void test_absoluteRelativeUriXyz(); @@ -331,7 +332,7 @@ void TestQgsVectorTileLayer::test_relativePathsMbTiles() const QString srcMbtiles = QStringLiteral( "type=mbtiles&url=%1/vector_tile/mbtiles_vt.mbtiles" ).arg( TEST_DATA_DIR ); - std::unique_ptr layer = std::make_unique( srcMbtiles ); + auto layer = std::make_unique( srcMbtiles ); QVERIFY( layer->isValid() ); QCOMPARE( layer->providerType(), QStringLiteral( "mbtilesvectortiles" ) ); @@ -371,6 +372,17 @@ void TestQgsVectorTileLayer::test_absoluteRelativeUriMbTiles() QCOMPARE( vectorTileMetadata->relativeToAbsoluteUri( relativeUri, context ), absoluteUri ); } +void TestQgsVectorTileLayer::test_mbtilesZoom16() +{ + const QString srcMbtiles = QStringLiteral( "type=mbtiles&url=%1/vector_tile/z16.mbtiles" ).arg( TEST_DATA_DIR ); + + auto layer = std::make_unique( srcMbtiles ); + QVERIFY( layer->isValid() ); + QCOMPARE( layer->providerType(), QStringLiteral( "mbtilesvectortiles" ) ); + QCOMPARE( layer->sourceMinZoom(), 16 ); + QCOMPARE( layer->sourceMaxZoom(), 16 ); +} + void TestQgsVectorTileLayer::test_relativePathsXyz() { QgsReadWriteContext contextRel; @@ -380,7 +392,7 @@ void TestQgsVectorTileLayer::test_relativePathsXyz() const QString srcXyzLocal = "type=xyz&url=file:///home/qgis/%7Bz%7D/%7Bx%7D/%7By%7D.pbf"; const QString srcXyzRemote = "type=xyz&url=http://www.example.com/%7Bz%7D/%7Bx%7D/%7By%7D.pbf"; - std::unique_ptr layer = std::make_unique( srcXyzLocal ); + auto layer = std::make_unique( srcXyzLocal ); QCOMPARE( layer->providerType(), QStringLiteral( "xyzvectortiles" ) ); // encode source: converting absolute paths to relative @@ -487,7 +499,7 @@ void TestQgsVectorTileLayer::test_relativePathsVtpk() const QString srcVtpk = QStringLiteral( "type=vtpk&url=%1/testvtpk.vtpk" ).arg( TEST_DATA_DIR ); - std::unique_ptr layer = std::make_unique( srcVtpk ); + auto layer = std::make_unique( srcVtpk ); QVERIFY( layer->isValid() ); QCOMPARE( layer->providerType(), QStringLiteral( "vtpkvectortiles" ) ); @@ -534,7 +546,7 @@ void TestQgsVectorTileLayer::test_polygonWithLineStyle() ds.setParam( "type", "xyz" ); ds.setParam( "url", QString( "file://%1/{z}-{x}-{y}.pbf" ).arg( mDataDir ) ); ds.setParam( "zmax", "1" ); - std::unique_ptr layer = std::make_unique( ds.encodedUri(), "Vector Tiles Test" ); + auto layer = std::make_unique( ds.encodedUri(), "Vector Tiles Test" ); QVERIFY( layer->isValid() ); mMapSettings->setLayers( QList() << layer.get() ); @@ -574,7 +586,7 @@ void TestQgsVectorTileLayer::test_polygonWithMarker() ds.setParam( "type", "xyz" ); ds.setParam( "url", QString( "file://%1/{z}-{x}-{y}.pbf" ).arg( mDataDir ) ); ds.setParam( "zmax", "1" ); - std::unique_ptr layer = std::make_unique( ds.encodedUri(), "Vector Tiles Test" ); + auto layer = std::make_unique( ds.encodedUri(), "Vector Tiles Test" ); QVERIFY( layer->isValid() ); mMapSettings->setLayers( QList() << layer.get() ); @@ -612,7 +624,7 @@ void TestQgsVectorTileLayer::test_styleMinZoomBeyondTileMaxZoom() ds.setParam( "type", "xyz" ); ds.setParam( "url", QString( "file://%1/{z}-{x}-{y}.pbf" ).arg( mDataDir ) ); ds.setParam( "zmax", "1" ); - std::unique_ptr layer = std::make_unique( ds.encodedUri(), "Vector Tiles Test" ); + auto layer = std::make_unique( ds.encodedUri(), "Vector Tiles Test" ); QVERIFY( layer->isValid() ); mMapSettings->setLayers( QList() << layer.get() ); @@ -652,7 +664,7 @@ void TestQgsVectorTileLayer::test_filterRuleAllLayers() QgsDataSourceUri ds; ds.setParam( "type", "mbtiles" ); ds.setParam( "url", QString( "/%1/mbtiles_vt.mbtiles" ).arg( mDataDir ) ); - std::unique_ptr layer = std::make_unique( ds.encodedUri(), "Vector Tiles Test" ); + auto layer = std::make_unique( ds.encodedUri(), "Vector Tiles Test" ); QVERIFY( layer->isValid() ); mMapSettings->setLayers( QList() << layer.get() ); diff --git a/tests/src/geometry_checker/testqgsgeometrychecks.cpp b/tests/src/geometry_checker/testqgsgeometrychecks.cpp index 76a98237f82b..b38d5fa8642d 100644 --- a/tests/src/geometry_checker/testqgsgeometrychecks.cpp +++ b/tests/src/geometry_checker/testqgsgeometrychecks.cpp @@ -639,7 +639,7 @@ void TestQgsGeometryChecks::testAllowedGaps() const auto testContext = createTestContext( dir, layers ); // Allowed gaps layer - std::unique_ptr allowedGaps = std::make_unique( QStringLiteral( "Polygon?crs=epsg:4326" ), QStringLiteral( "allowedGaps" ), QStringLiteral( "memory" ) ); + auto allowedGaps = std::make_unique( QStringLiteral( "Polygon?crs=epsg:4326" ), QStringLiteral( "allowedGaps" ), QStringLiteral( "memory" ) ); QgsProject::instance()->addMapLayer( allowedGaps.get(), true, false ); // Test detection diff --git a/tests/src/geometry_checker/testqgsvectorlayerfeaturepool.cpp b/tests/src/geometry_checker/testqgsvectorlayerfeaturepool.cpp index 2c69d4cb5acd..56ffa2ddeadb 100644 --- a/tests/src/geometry_checker/testqgsvectorlayerfeaturepool.cpp +++ b/tests/src/geometry_checker/testqgsvectorlayerfeaturepool.cpp @@ -199,7 +199,7 @@ void TestQgsVectorLayerFeaturePool::changeGeometry() std::unique_ptr TestQgsVectorLayerFeaturePool::createPopulatedLayer() { - std::unique_ptr vl = std::make_unique( QStringLiteral( "Polygon" ), QStringLiteral( "Polygons" ), QStringLiteral( "memory" ) ); + auto vl = std::make_unique( QStringLiteral( "Polygon" ), QStringLiteral( "Polygons" ), QStringLiteral( "memory" ) ); QgsFeature feature; feature.setGeometry( QgsGeometry::fromWkt( QStringLiteral( "Polygon((0 0, 10 0, 10 10, 0 10, 0 0))" ) ) ); diff --git a/tests/src/gui/CMakeLists.txt b/tests/src/gui/CMakeLists.txt index 61ac05b31bed..d995d0213d60 100644 --- a/tests/src/gui/CMakeLists.txt +++ b/tests/src/gui/CMakeLists.txt @@ -34,6 +34,7 @@ set(TESTS testqgsdoublespinbox.cpp testqgsdualview.cpp testqgsattributeform.cpp + testqgsattributesformproperties.cpp testqgsdatetimeedit.cpp testqgsdockwidget.cpp testqgsfieldexpressionwidget.cpp @@ -78,6 +79,7 @@ set(TESTS testqgscompoundcolorwidget.cpp testqgsmaskingwidget.cpp testqgssvgselectorwidget.cpp + testqgslabelingwidget.cpp ) foreach(TESTSRC ${TESTS}) diff --git a/tests/src/gui/testprocessinggui.cpp b/tests/src/gui/testprocessinggui.cpp index 93162a486072..c8b30a7326cf 100644 --- a/tests/src/gui/testprocessinggui.cpp +++ b/tests/src/gui/testprocessinggui.cpp @@ -586,19 +586,19 @@ void TestProcessingGui::testWrapperGeneral() QVERIFY( !falseDefault.widgetValue().toBool() ); delete w; - std::unique_ptr mc = std::make_unique(); + auto mc = std::make_unique(); QgsProcessingParameterWidgetContext widgetContext; widgetContext.setMapCanvas( mc.get() ); QCOMPARE( widgetContext.mapCanvas(), mc.get() ); - std::unique_ptr mb = std::make_unique(); + auto mb = std::make_unique(); widgetContext.setMessageBar( mb.get() ); QCOMPARE( widgetContext.messageBar(), mb.get() ); QgsProject p; widgetContext.setProject( &p ); QCOMPARE( widgetContext.project(), &p ); - std::unique_ptr model = std::make_unique(); + auto model = std::make_unique(); widgetContext.setModel( model.get() ); QCOMPARE( widgetContext.model(), model.get() ); widgetContext.setModelChildAlgorithmId( QStringLiteral( "xx" ) ); @@ -893,7 +893,7 @@ void TestProcessingGui::testHiddenWrapper() QVERIFY( !wrapper.createWrappedWidget( context ) ); QVERIFY( !wrapper.createWrappedLabel() ); - std::unique_ptr vl = std::make_unique( QStringLiteral( "Polygon?crs=epsg:3111&field=pk:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); + auto vl = std::make_unique( QStringLiteral( "Polygon?crs=epsg:3111&field=pk:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); QVERIFY( !wrapper.linkedVectorLayer() ); wrapper.setLinkedVectorLayer( vl.get() ); QCOMPARE( wrapper.linkedVectorLayer(), vl.get() ); @@ -984,7 +984,7 @@ void TestProcessingGui::testBooleanWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; - std::unique_ptr widget = std::make_unique( QStringLiteral( "boolean" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "boolean" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -1270,7 +1270,7 @@ void TestProcessingGui::testStringWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; - std::unique_ptr widget = std::make_unique( QStringLiteral( "string" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "string" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -1378,7 +1378,7 @@ void TestProcessingGui::testFileWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "file" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "file" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -1635,7 +1635,7 @@ void TestProcessingGui::testCrsWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; - std::unique_ptr widget = std::make_unique( QStringLiteral( "crs" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "crs" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -1831,7 +1831,7 @@ void TestProcessingGui::testNumericWrapperDouble() // config widget QgsProcessingParameterWidgetContext widgetContext; QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "number" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "number" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -2020,7 +2020,7 @@ void TestProcessingGui::testNumericWrapperInt() // config widget QgsProcessingParameterWidgetContext widgetContext; QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "number" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "number" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -2146,7 +2146,7 @@ void TestProcessingGui::testDistanceWrapper() QVERIFY( wrapper.mLabel->isVisible() ); // layer values - std::unique_ptr vl = std::make_unique( QStringLiteral( "Polygon?crs=epsg:3111&field=pk:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); + auto vl = std::make_unique( QStringLiteral( "Polygon?crs=epsg:3111&field=pk:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); wrapper.setUnitParameterValue( QVariant::fromValue( vl.get() ) ); QCOMPARE( wrapper.mLabel->text(), QStringLiteral( "meters" ) ); QVERIFY( !wrapper.mWarningLabel->isVisible() ); @@ -2154,7 +2154,7 @@ void TestProcessingGui::testDistanceWrapper() QVERIFY( !wrapper.mLabel->isVisible() ); QCOMPARE( wrapper.mUnitsCombo->currentData().toInt(), static_cast( Qgis::DistanceUnit::Meters ) ); - std::unique_ptr vl2 = std::make_unique( QStringLiteral( "Polygon?crs=epsg:4326&field=pk:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); + auto vl2 = std::make_unique( QStringLiteral( "Polygon?crs=epsg:4326&field=pk:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); wrapper.setUnitParameterValue( QVariant::fromValue( vl2.get() ) ); QCOMPARE( wrapper.mLabel->text(), QStringLiteral( "degrees" ) ); QVERIFY( wrapper.mWarningLabel->isVisible() ); @@ -2269,7 +2269,7 @@ void TestProcessingGui::testDistanceWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; - std::unique_ptr widget = std::make_unique( QStringLiteral( "distance" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "distance" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -2369,7 +2369,7 @@ void TestProcessingGui::testAreaWrapper() QVERIFY( wrapper.mLabel->isVisible() ); // layer values - std::unique_ptr vl = std::make_unique( QStringLiteral( "Polygon?crs=epsg:3111&field=pk:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); + auto vl = std::make_unique( QStringLiteral( "Polygon?crs=epsg:3111&field=pk:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); wrapper.setUnitParameterValue( QVariant::fromValue( vl.get() ) ); QCOMPARE( wrapper.mLabel->text(), QStringLiteral( "square meters" ) ); QVERIFY( !wrapper.mWarningLabel->isVisible() ); @@ -2377,7 +2377,7 @@ void TestProcessingGui::testAreaWrapper() QVERIFY( !wrapper.mLabel->isVisible() ); QCOMPARE( wrapper.mUnitsCombo->currentData().value(), Qgis::AreaUnit::SquareMeters ); - std::unique_ptr vl2 = std::make_unique( QStringLiteral( "Polygon?crs=epsg:4326&field=pk:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); + auto vl2 = std::make_unique( QStringLiteral( "Polygon?crs=epsg:4326&field=pk:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); wrapper.setUnitParameterValue( QVariant::fromValue( vl2.get() ) ); QCOMPARE( wrapper.mLabel->text(), QStringLiteral( "square degrees" ) ); QVERIFY( wrapper.mWarningLabel->isVisible() ); @@ -2492,7 +2492,7 @@ void TestProcessingGui::testAreaWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; - std::unique_ptr widget = std::make_unique( QStringLiteral( "area" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "area" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -2592,7 +2592,7 @@ void TestProcessingGui::testVolumeWrapper() QVERIFY( wrapper.mLabel->isVisible() ); // layer values - std::unique_ptr vl = std::make_unique( QStringLiteral( "Polygon?crs=epsg:3111&field=pk:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); + auto vl = std::make_unique( QStringLiteral( "Polygon?crs=epsg:3111&field=pk:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); wrapper.setUnitParameterValue( QVariant::fromValue( vl.get() ) ); QCOMPARE( wrapper.mLabel->text(), QStringLiteral( "cubic meters" ) ); QVERIFY( !wrapper.mWarningLabel->isVisible() ); @@ -2600,7 +2600,7 @@ void TestProcessingGui::testVolumeWrapper() QVERIFY( !wrapper.mLabel->isVisible() ); QCOMPARE( wrapper.mUnitsCombo->currentData().value(), Qgis::VolumeUnit::CubicMeters ); - std::unique_ptr vl2 = std::make_unique( QStringLiteral( "Polygon?crs=epsg:4326&field=pk:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); + auto vl2 = std::make_unique( QStringLiteral( "Polygon?crs=epsg:4326&field=pk:int" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ); wrapper.setUnitParameterValue( QVariant::fromValue( vl2.get() ) ); QCOMPARE( wrapper.mLabel->text(), QStringLiteral( "cubic degrees" ) ); QVERIFY( wrapper.mWarningLabel->isVisible() ); @@ -2715,7 +2715,7 @@ void TestProcessingGui::testVolumeWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; - std::unique_ptr widget = std::make_unique( QStringLiteral( "volume" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "volume" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -2854,7 +2854,7 @@ void TestProcessingGui::testDurationWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; - std::unique_ptr widget = std::make_unique( QStringLiteral( "duration" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "duration" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -2978,7 +2978,7 @@ void TestProcessingGui::testScaleWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "scale" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "scale" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -3138,7 +3138,7 @@ void TestProcessingGui::testRangeWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "range" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "range" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -3170,7 +3170,7 @@ void TestProcessingGui::testRangeWrapper() void TestProcessingGui::testMatrixDialog() { QgsProcessingParameterMatrix matrixParam( QString(), QString(), 3, false, QStringList() << QStringLiteral( "a" ) << QStringLiteral( "b" ) ); - std::unique_ptr dlg = std::make_unique( nullptr, &matrixParam ); + auto dlg = std::make_unique( nullptr, &matrixParam ); // variable length table QVERIFY( dlg->mButtonAdd->isEnabled() ); QVERIFY( dlg->mButtonRemove->isEnabled() ); @@ -3250,7 +3250,7 @@ void TestProcessingGui::testMatrixWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "matrix" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "matrix" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -3476,7 +3476,7 @@ void TestProcessingGui::testExpressionWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "expression" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "expression" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -3935,7 +3935,7 @@ void TestProcessingGui::testFieldWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "field" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "field" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !def->defaultValue().isValid() ); @@ -3978,11 +3978,11 @@ void TestProcessingGui::testMultipleSelectionDialog() { QVariantList availableOptions; QVariantList selectedOptions; - std::unique_ptr dlg = std::make_unique( availableOptions, selectedOptions ); + auto dlg = std::make_unique( availableOptions, selectedOptions ); QVERIFY( dlg->selectedOptions().isEmpty() ); QCOMPARE( dlg->mModel->rowCount(), 0 ); - std::unique_ptr vl = std::make_unique( QStringLiteral( "LineString" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); + auto vl = std::make_unique( QStringLiteral( "LineString" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); availableOptions << QVariant( "aa" ) << QVariant( 15 ) << QVariant::fromValue( vl.get() ); dlg = std::make_unique( availableOptions, selectedOptions ); QVERIFY( dlg->selectedOptions().isEmpty() ); @@ -4082,9 +4082,9 @@ void TestProcessingGui::testMultipleSelectionDialog() void TestProcessingGui::testMultipleFileSelectionDialog() { - std::unique_ptr param = std::make_unique( QString(), QString(), Qgis::ProcessingSourceType::Raster ); + auto param = std::make_unique( QString(), QString(), Qgis::ProcessingSourceType::Raster ); QVariantList selectedOptions; - std::unique_ptr dlg = std::make_unique( param.get(), selectedOptions, QList() ); + auto dlg = std::make_unique( param.get(), selectedOptions, QList() ); QVERIFY( dlg->selectedOptions().isEmpty() ); QCOMPARE( dlg->mModel->rowCount(), 0 ); @@ -4558,7 +4558,7 @@ void TestProcessingGui::testBandWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "band" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "band" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -4682,7 +4682,7 @@ void TestProcessingGui::testMultipleInputWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "multilayer" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "multilayer" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -5428,7 +5428,7 @@ void TestProcessingGui::testEnumWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "enum" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "enum" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -5749,7 +5749,7 @@ void TestProcessingGui::testLayoutItemWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "layoutitem" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "layoutitem" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -5777,7 +5777,7 @@ void TestProcessingGui::testLayoutItemWrapper() void TestProcessingGui::testPointPanel() { - std::unique_ptr panel = std::make_unique( nullptr ); + auto panel = std::make_unique( nullptr ); QSignalSpy spy( panel.get(), &QgsProcessingPointPanel::changed ); panel->setValue( QgsPointXY( 100, 150 ), QgsCoordinateReferenceSystem() ); @@ -5960,7 +5960,7 @@ void TestProcessingGui::testPointWrapper() // config widget QgsProcessingContext context; QgsProcessingParameterWidgetContext widgetContext; - std::unique_ptr widget = std::make_unique( QStringLiteral( "point" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "point" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -6072,7 +6072,7 @@ void TestProcessingGui::testGeometryWrapper() // config widget QgsProcessingContext context; QgsProcessingParameterWidgetContext widgetContext; - std::unique_ptr widget = std::make_unique( QStringLiteral( "geometry" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "geometry" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -6200,7 +6200,7 @@ void TestProcessingGui::testExtentWrapper() // config widget QgsProcessingContext context; QgsProcessingParameterWidgetContext widgetContext; - std::unique_ptr widget = std::make_unique( QStringLiteral( "extent" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "extent" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -6304,7 +6304,7 @@ void TestProcessingGui::testColorWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "color" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "color" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -6409,7 +6409,7 @@ void TestProcessingGui::testCoordinateOperationWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "coordinateoperation" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "coordinateoperation" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -6450,7 +6450,7 @@ void TestProcessingGui::mapLayerComboBox() // feature source param std::unique_ptr param( new QgsProcessingParameterFeatureSource( QStringLiteral( "param" ), QString() ) ); - std::unique_ptr combo = std::make_unique( param.get() ); + auto combo = std::make_unique( param.get() ); QSignalSpy spy( combo.get(), &QgsProcessingMapLayerComboBox::valueChanged ); QVERIFY( !combo->value().isValid() ); @@ -7156,7 +7156,7 @@ void TestProcessingGui::testMapLayerWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "layer" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "layer" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -7470,7 +7470,7 @@ void TestProcessingGui::testVectorLayerWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "vector" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "vector" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -7643,7 +7643,7 @@ void TestProcessingGui::testFeatureSourceWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "source" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "source" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -7820,7 +7820,7 @@ void TestProcessingGui::paramConfigWidget() { QgsProcessingContext context; QgsProcessingParameterWidgetContext widgetContext; - std::unique_ptr widget = std::make_unique( QStringLiteral( "string" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "string" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -7965,7 +7965,7 @@ void TestProcessingGui::testMapThemeWrapper() QgsProcessingParameterWidgetContext widgetContext; widgetContext.setProject( &p ); QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "maptheme" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "maptheme" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -8118,7 +8118,7 @@ void TestProcessingGui::testDateTimeWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "datetime" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "datetime" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -8243,7 +8243,7 @@ void TestProcessingGui::testProviderConnectionWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "providerconnection" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "providerconnection" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -8439,7 +8439,7 @@ void TestProcessingGui::testDatabaseSchemaWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "databaseschema" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "databaseschema" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -8676,7 +8676,7 @@ void TestProcessingGui::testDatabaseTableWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "databasetable" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "databasetable" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -8882,7 +8882,7 @@ void TestProcessingGui::testFieldMapWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "fields_mapping" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "fields_mapping" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -9085,7 +9085,7 @@ void TestProcessingGui::testAggregateWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "aggregates" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "aggregates" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !( def->flags() & Qgis::ProcessingParameterFlag::Optional ) ); // should default to mandatory @@ -10443,7 +10443,7 @@ void TestProcessingGui::testMeshDatasetWrapperLayerInProject() QgsProcessingContext context; context.setProject( &project ); QgsProcessingParameterWidgetContext widgetContext; - std::unique_ptr mapCanvas = std::make_unique(); + auto mapCanvas = std::make_unique(); widgetContext.setMapCanvas( mapCanvas.get() ); widgetContext.setProject( &project ); @@ -10679,7 +10679,7 @@ void TestProcessingGui::testMeshDatasetWrapperLayerOutsideProject() QgsProcessingContext context; context.setProject( &project ); QgsProcessingParameterWidgetContext widgetContext; - std::unique_ptr mapCanvas = std::make_unique(); + auto mapCanvas = std::make_unique(); widgetContext.setMapCanvas( mapCanvas.get() ); widgetContext.setProject( &project ); @@ -11251,7 +11251,7 @@ void TestProcessingGui::testPointCloudAttributeWrapper() // config widget QgsProcessingParameterWidgetContext widgetContext; QgsProcessingContext context; - std::unique_ptr widget = std::make_unique( QStringLiteral( "attribute" ), context, widgetContext ); + auto widget = std::make_unique( QStringLiteral( "attribute" ), context, widgetContext ); std::unique_ptr def( widget->createParameter( QStringLiteral( "param_name" ) ) ); QCOMPARE( def->name(), QStringLiteral( "param_name" ) ); QVERIFY( !def->defaultValue().isValid() ); diff --git a/tests/src/gui/testqgsattributeform.cpp b/tests/src/gui/testqgsattributeform.cpp index cfb4aeccc475..80a4c12f668f 100644 --- a/tests/src/gui/testqgsattributeform.cpp +++ b/tests/src/gui/testqgsattributeform.cpp @@ -1207,7 +1207,7 @@ void TestQgsAttributeForm::testMinimumWidth() ft.setAttribute( QStringLiteral( "col0" ), 0.0 ); QgsAttributeEditorContext context; context.setAttributeFormMode( QgsAttributeEditorContext::SingleEditMode ); - std::unique_ptr form = std::make_unique( &layer, QgsFeature(), context ); + auto form = std::make_unique( &layer, QgsFeature(), context ); form->setFeature( ft ); form->show(); // we don't want the larger width requirement of the search wrappers to be enforced when the attribute form diff --git a/tests/src/gui/testqgsattributesformproperties.cpp b/tests/src/gui/testqgsattributesformproperties.cpp new file mode 100644 index 000000000000..03f70dca01de --- /dev/null +++ b/tests/src/gui/testqgsattributesformproperties.cpp @@ -0,0 +1,89 @@ +/*************************************************************************** + testqgsattributesformproperties.cpp + -------------------------------------- + Date : 2025-01-21 + Copyright : (C) 2025 Mathieu Pellerin + Email : paul dot blottiere at oslandia dot com + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include "qgstest.h" + +#include "qgsattributesformproperties.h" +#include "qgsattributetypedialog.h" +#include "qgsvectorlayer.h" +#include "qgsvectordataprovider.h" +#include "qgsgui.h" + +class TestQgsAttributesFormProperties : public QObject +{ + Q_OBJECT + public: + TestQgsAttributesFormProperties() = default; + + private slots: + void initTestCase(); // will be called before the first testfunction is executed. + void cleanupTestCase(); // will be called after the last testfunction was executed. + void init(); // will be called before each testfunction is executed. + void cleanup(); // will be called after every testfunction. + + void testConfigStored(); +}; + +void TestQgsAttributesFormProperties::initTestCase() +{ + QgsApplication::init(); + QgsApplication::initQgis(); +} + +void TestQgsAttributesFormProperties::cleanupTestCase() +{ + QgsApplication::exitQgis(); +} + +void TestQgsAttributesFormProperties::init() +{ +} + +void TestQgsAttributesFormProperties::cleanup() +{ +} + +void TestQgsAttributesFormProperties::testConfigStored() +{ + QgsVectorLayer *layer = new QgsVectorLayer( QStringLiteral( "Point?field=col0:integer&field=col1:integer" ), QStringLiteral( "test" ), QStringLiteral( "memory" ) ); + QgsAttributesFormProperties attributeFormProperties( layer ); + attributeFormProperties.init(); + + // Get the fields + QVERIFY( attributeFormProperties.mAvailableWidgetsTree ); + QTreeWidgetItem *fieldsItem = attributeFormProperties.mAvailableWidgetsTree->topLevelItem( 0 ); + QVERIFY( fieldsItem ); + QCOMPARE( fieldsItem->text( 0 ), QStringLiteral( "Fields" ) ); + QCOMPARE( fieldsItem->childCount(), 2 ); + + // Insure that the configuration was stored when switching from one available widgets tree item to another + attributeFormProperties.mAvailableWidgetsTree->setCurrentItem( fieldsItem->child( 0 ) ); + QVERIFY( attributeFormProperties.mAttributeTypeDialog ); + attributeFormProperties.mAttributeTypeDialog->setAlias( QStringLiteral( "alias0" ) ); + attributeFormProperties.mAvailableWidgetsTree->setCurrentItem( fieldsItem->child( 1 ) ); + QVERIFY( attributeFormProperties.mAttributeTypeDialog ); + attributeFormProperties.mAttributeTypeDialog->setAlias( QStringLiteral( "alias1" ) ); + + attributeFormProperties.mAvailableWidgetsTree->setCurrentItem( fieldsItem->child( 0 ) ); + QVERIFY( attributeFormProperties.mAttributeTypeDialog ); + QCOMPARE( attributeFormProperties.mAttributeTypeDialog->alias(), QStringLiteral( "alias0" ) ); + attributeFormProperties.mAvailableWidgetsTree->setCurrentItem( fieldsItem->child( 1 ) ); + QVERIFY( attributeFormProperties.mAttributeTypeDialog ); + QCOMPARE( attributeFormProperties.mAttributeTypeDialog->alias(), QStringLiteral( "alias1" ) ); +} + +QGSTEST_MAIN( TestQgsAttributesFormProperties ) +#include "testqgsattributesformproperties.moc" diff --git a/tests/src/gui/testqgscategorizedrendererwidget.cpp b/tests/src/gui/testqgscategorizedrendererwidget.cpp index 21a595ae1ef2..7cf584885ab4 100644 --- a/tests/src/gui/testqgscategorizedrendererwidget.cpp +++ b/tests/src/gui/testqgscategorizedrendererwidget.cpp @@ -61,7 +61,7 @@ void TestQgsCategorizedRendererWidget::cleanup() void TestQgsCategorizedRendererWidget::testAddMissingCategories() { - std::unique_ptr vl = std::make_unique( "Point?crs=EPSG:4326&field=idx:integer&field=name:string", QString(), QStringLiteral( "memory" ) ); + auto vl = std::make_unique( "Point?crs=EPSG:4326&field=idx:integer&field=name:string", QString(), QStringLiteral( "memory" ) ); QVERIFY( vl->isValid() ); QgsFeature f; @@ -77,7 +77,7 @@ void TestQgsCategorizedRendererWidget::testAddMissingCategories() QgsCategorizedSymbolRenderer *renderer = new QgsCategorizedSymbolRenderer( QStringLiteral( "name" ) ); vl->setRenderer( renderer ); - std::unique_ptr widget = std::make_unique( vl.get(), nullptr, renderer ); + auto widget = std::make_unique( vl.get(), nullptr, renderer ); QVERIFY( static_cast( widget->renderer() )->categories().isEmpty() ); widget->addCategories(); @@ -122,7 +122,7 @@ void TestQgsCategorizedRendererWidget::merge() { // test merging categories - std::unique_ptr vl = std::make_unique( "Point?crs=EPSG:4326&field=idx:integer&field=name:string", QString(), QStringLiteral( "memory" ) ); + auto vl = std::make_unique( "Point?crs=EPSG:4326&field=idx:integer&field=name:string", QString(), QStringLiteral( "memory" ) ); QVERIFY( vl->isValid() ); QgsFeature f; @@ -140,7 +140,7 @@ void TestQgsCategorizedRendererWidget::merge() QgsCategorizedSymbolRenderer *renderer = new QgsCategorizedSymbolRenderer( QStringLiteral( "name" ) ); vl->setRenderer( renderer ); - std::unique_ptr widget = std::make_unique( vl.get(), nullptr, renderer ); + auto widget = std::make_unique( vl.get(), nullptr, renderer ); widget->addCategories(); QCOMPARE( static_cast( widget->renderer() )->categories().count(), 6 ); QCOMPARE( static_cast( widget->renderer() )->categories().at( 0 ).value().toString(), QStringLiteral( "a" ) ); @@ -266,7 +266,7 @@ void TestQgsCategorizedRendererWidget::merge() void TestQgsCategorizedRendererWidget::model() { - std::unique_ptr vl = std::make_unique( "Point?crs=EPSG:4326&field=idx:integer&field=name:string", QString(), QStringLiteral( "memory" ) ); + auto vl = std::make_unique( "Point?crs=EPSG:4326&field=idx:integer&field=name:string", QString(), QStringLiteral( "memory" ) ); QVERIFY( vl->isValid() ); QgsFeature f; @@ -289,7 +289,7 @@ void TestQgsCategorizedRendererWidget::model() vl->setRenderer( renderer ); - std::unique_ptr widget = std::make_unique( vl.get(), nullptr, renderer ); + auto widget = std::make_unique( vl.get(), nullptr, renderer ); QgsCategorizedSymbolRendererModel *model = widget->mModel; QCOMPARE( model->rowCount(), 3 ); QCOMPARE( model->data( model->index( 0, 1 ), Qt::DisplayRole ).toString(), QStringLiteral( "b" ) ); diff --git a/tests/src/gui/testqgsdualview.cpp b/tests/src/gui/testqgsdualview.cpp index be8dbb739a78..fc399c455a9e 100644 --- a/tests/src/gui/testqgsdualview.cpp +++ b/tests/src/gui/testqgsdualview.cpp @@ -322,7 +322,7 @@ void TestQgsDualView::testAttributeFormSharedValueScanning() void TestQgsDualView::testNoGeom() { //test that both the master model and cache for the dual view either both request geom or both don't request geom - std::unique_ptr dv( new QgsDualView() ); + auto dv = std::make_unique(); // request with geometry QgsFeatureRequest req; diff --git a/tests/src/gui/testqgsexternalstoragefilewidget.cpp b/tests/src/gui/testqgsexternalstoragefilewidget.cpp index 9bd532c51ca1..bc32c3e695d2 100644 --- a/tests/src/gui/testqgsexternalstoragefilewidget.cpp +++ b/tests/src/gui/testqgsexternalstoragefilewidget.cpp @@ -815,7 +815,7 @@ void TestQgsExternalStorageFileWidget::testDragAndDrop() QgsExternalStorageFileWidget w; w.show(); - std::unique_ptr mime( new QMimeData() ); + auto mime = std::make_unique(); mime->setUrls( QList() << QUrl::fromLocalFile( TEST_DATA_DIR + QStringLiteral( "/bug5598.shp" ) ) ); QIcon editIcon = QgsApplication::getThemeIcon( QStringLiteral( "/mActionToggleEditing.svg" ) ); @@ -843,11 +843,11 @@ void TestQgsExternalStorageFileWidget::testDragAndDrop() QVERIFY( !w.mCancelButton->isVisible() ); QVERIFY( w.acceptDrops() ); - std::unique_ptr dragEvent( new QDragEnterEvent( QPoint( 1, 1 ), Qt::CopyAction, mime.get(), Qt::LeftButton, Qt::NoModifier ) ); + auto dragEvent = std::make_unique( QPoint( 1, 1 ), Qt::CopyAction, mime.get(), Qt::LeftButton, Qt::NoModifier ); w.dragEnterEvent( dragEvent.get() ); QVERIFY( dragEvent->isAccepted() ); - std::unique_ptr dropEvent( new QDropEvent( QPoint( 1, 1 ), Qt::CopyAction, mime.get(), Qt::LeftButton, Qt::NoModifier ) ); + auto dropEvent = std::make_unique( QPoint( 1, 1 ), Qt::CopyAction, mime.get(), Qt::LeftButton, Qt::NoModifier ); w.dropEvent( dropEvent.get() ); QVERIFY( dropEvent->isAccepted() ); diff --git a/tests/src/gui/testqgsfeaturelistcombobox.cpp b/tests/src/gui/testqgsfeaturelistcombobox.cpp index fc6ee9ab1071..45e4b019bf78 100644 --- a/tests/src/gui/testqgsfeaturelistcombobox.cpp +++ b/tests/src/gui/testqgsfeaturelistcombobox.cpp @@ -125,7 +125,7 @@ void TestQgsFeatureListComboBox::cleanup() void TestQgsFeatureListComboBox::testSetGetLayer() { - std::unique_ptr cb( new QgsFeatureListComboBox() ); + auto cb = std::make_unique(); QVERIFY( cb->sourceLayer() == nullptr ); cb->setSourceLayer( mLayer.get() ); @@ -156,7 +156,7 @@ void TestQgsFeatureListComboBox::testSetGetForeignKey() void TestQgsFeatureListComboBox::testMultipleForeignKeys() { - std::unique_ptr cb( new QgsFeatureListComboBox() ); + auto cb = std::make_unique(); QgsApplication::setNullRepresentation( QStringLiteral( "nope" ) ); @@ -213,7 +213,7 @@ void TestQgsFeatureListComboBox::testValuesAndSelection() QFETCH( bool, allowNull ); QgsApplication::setNullRepresentation( QStringLiteral( "nope" ) ); - std::unique_ptr cb( new QgsFeatureListComboBox() ); + auto cb = std::make_unique(); QSignalSpy spy( cb.get(), &QgsFeatureListComboBox::identifierValueChanged ); @@ -251,7 +251,7 @@ void TestQgsFeatureListComboBox::testValuesAndSelection() void TestQgsFeatureListComboBox::nullRepresentation() { QgsApplication::setNullRepresentation( QStringLiteral( "nope" ) ); - std::unique_ptr cb( new QgsFeatureListComboBox() ); + auto cb = std::make_unique(); QgsFeatureFilterModel *model = qobject_cast( cb->model() ); QEventLoop loop; @@ -271,7 +271,7 @@ void TestQgsFeatureListComboBox::testNotExistingYetFeature() // test behavior when feature list combo box identifier values references a // not existing yet feature (created but not saved for instance) - std::unique_ptr cb( new QgsFeatureListComboBox() ); + auto cb = std::make_unique(); QgsFeatureFilterModel *model = qobject_cast( cb->model() ); QEventLoop loop; connect( model, &QgsFeatureFilterModel::filterJobCompleted, &loop, &QEventLoop::quit ); @@ -293,7 +293,7 @@ void TestQgsFeatureListComboBox::testFeatureFurtherThanFetchLimit() { const int fetchLimit = 20; QVERIFY( fetchLimit < mLayer->featureCount() ); - std::unique_ptr cb( new QgsFeatureListComboBox() ); + auto cb = std::make_unique(); QgsFeatureFilterModel *model = qobject_cast( cb->model() ); QSignalSpy spy( cb.get(), &QgsFeatureListComboBox::identifierValueChanged ); model->setFetchLimit( 20 ); diff --git a/tests/src/gui/testqgsfieldexpressionwidget.cpp b/tests/src/gui/testqgsfieldexpressionwidget.cpp index 054d57c69766..6c2b229e8b05 100644 --- a/tests/src/gui/testqgsfieldexpressionwidget.cpp +++ b/tests/src/gui/testqgsfieldexpressionwidget.cpp @@ -139,7 +139,7 @@ void TestQgsFieldExpressionWidget::asExpression() layer->updateFields(); QgsProject::instance()->addMapLayer( layer ); - std::unique_ptr widget( new QgsFieldExpressionWidget() ); + auto widget = std::make_unique(); widget->setLayer( layer ); const QSignalSpy spy( widget.get(), static_cast( &QgsFieldExpressionWidget::fieldChanged ) ); @@ -230,7 +230,7 @@ void TestQgsFieldExpressionWidget::testIsValid() QgsVectorLayer *layer = new QgsVectorLayer( QStringLiteral( "point?field=fld:int&field=name%20with%20space:string" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); QgsProject::instance()->addMapLayer( layer ); - std::unique_ptr widget( new QgsFieldExpressionWidget() ); + auto widget = std::make_unique(); widget->setLayer( layer ); // also check the fieldChanged signal to ensure that the emitted bool isValid value is correct @@ -287,7 +287,7 @@ void TestQgsFieldExpressionWidget::testFilters() QgsVectorLayer *layer = new QgsVectorLayer( QStringLiteral( "point?field=intfld:int&field=stringfld:string&field=string2fld:string&field=longfld:long&field=doublefld:double&field=datefld:date&field=timefld:time&field=datetimefld:datetime&field=binaryfld:binary&field=booleanfld:boolean" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); QgsProject::instance()->addMapLayer( layer ); - std::unique_ptr widget( new QgsFieldExpressionWidget() ); + auto widget = std::make_unique(); widget->setLayer( layer ); QCOMPARE( widget->mCombo->count(), 10 ); @@ -355,7 +355,7 @@ void TestQgsFieldExpressionWidget::setNull() QgsVectorLayer *layer = new QgsVectorLayer( QStringLiteral( "point?field=fld:int&field=fld2:int&field=fld3:int" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); QgsProject::instance()->addMapLayer( layer ); - std::unique_ptr widget( new QgsFieldExpressionWidget() ); + auto widget = std::make_unique(); widget->setLayer( layer ); widget->setField( QString() ); diff --git a/tests/src/gui/testqgsfilewidget.cpp b/tests/src/gui/testqgsfilewidget.cpp index a141e29a05af..f1e1a0113b65 100644 --- a/tests/src/gui/testqgsfilewidget.cpp +++ b/tests/src/gui/testqgsfilewidget.cpp @@ -96,9 +96,9 @@ void TestQgsFileWidget::testDroppedFiles() w->setStorageMode( QgsFileWidget::GetFile ); // should not accept dropped folders - std::unique_ptr mime( new QMimeData() ); + auto mime = std::make_unique(); mime->setUrls( QList() << QUrl::fromLocalFile( TEST_DATA_DIR ) ); - std::unique_ptr event( new QDropEvent( QPointF( 1, 1 ), Qt::CopyAction, mime.get(), Qt::LeftButton, Qt::NoModifier ) ); + auto event = std::make_unique( QPointF( 1, 1 ), Qt::CopyAction, mime.get(), Qt::LeftButton, Qt::NoModifier ); qobject_cast( w->lineEdit() )->dropEvent( event.get() ); QVERIFY( w->lineEdit()->text().isEmpty() ); @@ -191,7 +191,7 @@ void TestQgsFileWidget::testMultipleFiles() QgsFileWidget *w = new QgsFileWidget(); w->setStorageMode( QgsFileWidget::GetMultipleFiles ); - std::unique_ptr mime( new QMimeData() ); + auto mime = std::make_unique(); mime->setUrls( QList() << QUrl::fromLocalFile( TEST_DATA_DIR + QStringLiteral( "/bug5598.shp" ) ) << QUrl::fromLocalFile( TEST_DATA_DIR + QStringLiteral( "/elev.gpx" ) ) ); const std::unique_ptr event( new QDropEvent( QPointF( 1, 1 ), Qt::CopyAction, mime.get(), Qt::LeftButton, Qt::NoModifier ) ); diff --git a/tests/src/gui/testqgslabelingwidget.cpp b/tests/src/gui/testqgslabelingwidget.cpp new file mode 100644 index 000000000000..2a9d56511f4b --- /dev/null +++ b/tests/src/gui/testqgslabelingwidget.cpp @@ -0,0 +1,108 @@ +/*************************************************************************** + testqgslabelingwidget.cpp + --------------------- + begin : 2025/02/06 + copyright : (C) 2025 by Julien Cabieces + email : julien dot cabieces at oslandia dot com + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "qgstest.h" +#include "qgslabelingwidget.h" +#include "qgsvectorlayer.h" +#include "qgssymbollayerreference.h" +#include "qgsrulebasedlabeling.h" + +class TestQgsLabelingWidget : public QgsTest +{ + Q_OBJECT + + public: + TestQgsLabelingWidget() + : QgsTest( QStringLiteral( "Labeling Widget Tests" ) ) {} + + private slots: + void initTestCase(); // will be called before the first testfunction is executed. + void cleanupTestCase(); // will be called after the last testfunction was executed. + void init(); // will be called before each testfunction is executed. + void cleanup(); // will be called after every testfunction. + + void testRuleKeyPreserved(); +}; + +void TestQgsLabelingWidget::initTestCase() +{ +} + +void TestQgsLabelingWidget::cleanupTestCase() +{ +} + +void TestQgsLabelingWidget::init() +{ +} + +void TestQgsLabelingWidget::cleanup() +{ +} + +void TestQgsLabelingWidget::testRuleKeyPreserved() +{ + // test that rule keys are preserved and not reset when editing labels with a rule based rendering + QgsVectorLayer layer( QStringLiteral( "Point?field=pk:int" ), QStringLiteral( "layer" ), QStringLiteral( "memory" ) ); + + QgsFeature ft1( layer.fields() ); + ft1.setAttribute( QStringLiteral( "pk" ), 1 ); + ft1.setGeometry( QgsGeometry::fromWkt( QStringLiteral( "POINT( 1 1 )" ) ) ); + layer.dataProvider()->addFeature( ft1 ); + + QgsFeature ft2( layer.fields() ); + ft2.setAttribute( QStringLiteral( "pk" ), 2 ); + ft2.setGeometry( QgsGeometry::fromWkt( QStringLiteral( "POINT( 2 2 )" ) ) ); + layer.dataProvider()->addFeature( ft2 ); + + auto label_settings = std::make_unique(); + label_settings->fieldName = QStringLiteral( "pk" ); + + QgsTextMaskSettings mask; + mask.setEnabled( true ); + mask.setMaskedSymbolLayers( QList() << QgsSymbolLayerReference( layer.id(), QStringLiteral( "test_unique_id" ) ) ); + + QgsTextFormat text_format = label_settings->format(); + text_format.setMask( mask ); + label_settings->setFormat( text_format ); + + auto root = std::make_unique( new QgsPalLayerSettings() ); + + auto rule = std::make_unique( label_settings.release() ); + rule->setDescription( "test rule" ); + rule->setFilterExpression( QStringLiteral( "\"{pk}\" % 2 = 0" ) ); + rule->setActive( true ); + + const QString rootRuleKey = root->ruleKey(); + const QString ruleKey = rule->ruleKey(); + + root->appendChild( rule.release() ); + + auto ruleSettings = std::make_unique( root.release() ); + layer.setLabelsEnabled( true ); + layer.setLabeling( ruleSettings.release() ); + + QgsLabelingWidget widget( &layer, nullptr ); + widget.writeSettingsToLayer(); + + QgsRuleBasedLabeling *labelingAfter = dynamic_cast( layer.labeling() ); + QVERIFY( labelingAfter ); + QCOMPARE( labelingAfter->rootRule()->ruleKey(), rootRuleKey ); + QCOMPARE( labelingAfter->rootRule()->children().count(), 1 ); + QCOMPARE( labelingAfter->rootRule()->children().at( 0 )->ruleKey(), ruleKey ); +} + +QGSTEST_MAIN( TestQgsLabelingWidget ) +#include "testqgslabelingwidget.moc" diff --git a/tests/src/gui/testqgsmapcanvas.cpp b/tests/src/gui/testqgsmapcanvas.cpp index e13befea6ddc..a8f626d93299 100644 --- a/tests/src/gui/testqgsmapcanvas.cpp +++ b/tests/src/gui/testqgsmapcanvas.cpp @@ -371,7 +371,7 @@ void TestQgsMapCanvas::testZoomByWheel() mCanvas->setWheelFactor( 2 ); //test zoom out - std::unique_ptr e = std::make_unique( QPoint( 0, 0 ), QPointF(), QPoint( 0, -QWheelEvent::DefaultDeltasPerStep ), QPoint( 0, -QWheelEvent::DefaultDeltasPerStep ), Qt::NoButton, Qt::NoModifier, Qt::NoScrollPhase, false ); + auto e = std::make_unique( QPoint( 0, 0 ), QPointF(), QPoint( 0, -QWheelEvent::DefaultDeltasPerStep ), QPoint( 0, -QWheelEvent::DefaultDeltasPerStep ), Qt::NoButton, Qt::NoModifier, Qt::NoScrollPhase, false ); mCanvas->wheelEvent( e.get() ); QGSCOMPARENEAR( mCanvas->extent().width(), originalWidth * 2.0, 0.1 ); QGSCOMPARENEAR( mCanvas->extent().height(), originalHeight * 2.0, 0.1 ); @@ -410,7 +410,7 @@ void TestQgsMapCanvas::testShiftZoom() // start by testing a tool with shift-zoom enabled mCanvas->setMapTool( &panTool ); - std::unique_ptr e = std::make_unique( QMouseEvent::MouseButtonPress, startPos, Qt::LeftButton, Qt::LeftButton, Qt::ShiftModifier ); + auto e = std::make_unique( QMouseEvent::MouseButtonPress, startPos, Qt::LeftButton, Qt::LeftButton, Qt::ShiftModifier ); mCanvas->mousePressEvent( e.get() ); e = std::make_unique( QMouseEvent::MouseMove, endPos, Qt::LeftButton, Qt::LeftButton, Qt::ShiftModifier ); mCanvas->mouseMoveEvent( e.get() ); @@ -475,8 +475,8 @@ class TestYesDropHandler : public QgsCustomDropHandler void TestQgsMapCanvas::testDragDrop() { // default drag, should not be accepted - std::unique_ptr data = std::make_unique(); - std::unique_ptr event = std::make_unique( QPoint( 10, 10 ), Qt::CopyAction, data.get(), Qt::LeftButton, Qt::NoModifier ); + auto data = std::make_unique(); + auto event = std::make_unique( QPoint( 10, 10 ), Qt::CopyAction, data.get(), Qt::LeftButton, Qt::NoModifier ); mCanvas->dragEnterEvent( event.get() ); QVERIFY( !event->isAccepted() ); @@ -507,7 +507,7 @@ void TestQgsMapCanvas::testDragDrop() // check drop event logic mCanvas->setCustomDropHandlers( QVector>() ); - std::unique_ptr dropEvent = std::make_unique( QPoint( 10, 10 ), Qt::CopyAction, data.get(), Qt::LeftButton, Qt::NoModifier ); + auto dropEvent = std::make_unique( QPoint( 10, 10 ), Qt::CopyAction, data.get(), Qt::LeftButton, Qt::NoModifier ); mCanvas->dropEvent( dropEvent.get() ); QVERIFY( !dropEvent->isAccepted() ); mCanvas->setCustomDropHandlers( QVector>() << &handler ); @@ -596,10 +596,10 @@ void TestQgsMapCanvas::testMapLayers() QVERIFY( vl1->isValid() ); QgsProject::instance()->addMapLayer( vl1 ); - std::unique_ptr vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=halig:string&field=valig:string" ), QStringLiteral( "vl2" ), QStringLiteral( "memory" ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=halig:string&field=valig:string" ), QStringLiteral( "vl2" ), QStringLiteral( "memory" ) ); QVERIFY( vl2->isValid() ); - std::unique_ptr canvas = std::make_unique(); + auto canvas = std::make_unique(); canvas->setLayers( { vl1, vl2.get() } ); QCOMPARE( canvas->layers(), QList( { vl1, vl2.get() } ) ); diff --git a/tests/src/gui/testqgsmaptoolcapture.cpp b/tests/src/gui/testqgsmaptoolcapture.cpp index 0695dacd2a29..d45272909ae0 100644 --- a/tests/src/gui/testqgsmaptoolcapture.cpp +++ b/tests/src/gui/testqgsmaptoolcapture.cpp @@ -14,14 +14,16 @@ ***************************************************************************/ #include +#include "qgsmapcanvassnappingutils.h" #include "qgstest.h" -#include "qgsguiutils.h" #include "qgsmaptoolcapture.h" #include "qgsapplication.h" #include "qgsmapcanvas.h" #include "qgslogger.h" #include "qgsannotationlayer.h" #include "qgsadvanceddigitizingdockwidget.h" +#include "testqgsmaptoolutils.h" + class TestQgsMapToolCapture : public QObject { @@ -36,6 +38,7 @@ class TestQgsMapToolCapture : public QObject void cleanup(); // will be called after every testfunction. void addVertexNoLayer(); + void addPointNoLayerSnapping(); void addVertexNonVectorLayer(); void addVertexNonVectorLayerTransform(); }; @@ -88,6 +91,64 @@ void TestQgsMapToolCapture::addVertexNoLayer() QCOMPARE( layerPoint.y(), 6.0 ); } +void TestQgsMapToolCapture::addPointNoLayerSnapping() +{ + // checks that snapping works even if no layer is set as current layer + + QgsPoint p = QgsPoint( 2556607, 1115175 ); + + QgsProject::instance()->clear(); + + QgsMapCanvas canvas; + canvas.resize( 600, 600 ); + canvas.setDestinationCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:2056" ) ) ); + canvas.setFrameStyle( QFrame::NoFrame ); + canvas.setExtent( QgsRectangle( p.x() - 50, p.y() - 50, p.x() + 50, p.y() + 50 ) ); + canvas.show(); // to make the canvas resize + + QgsVectorLayer *layer = new QgsVectorLayer( QStringLiteral( "Point?crs=EPSG:2056" ), QStringLiteral( "point" ), QStringLiteral( "memory" ) ); + QgsProject::instance()->addMapLayer( layer ); + QgsFeature f( layer->fields() ); + f.setGeometry( QgsGeometry( p.clone() ) ); + QgsFeatureList flist { f }; + layer->dataProvider()->addFeatures( flist ); + canvas.setLayers( { layer } ); + + QgsMapSettings mapSettings = canvas.mapSettings(); + QVERIFY( mapSettings.hasValidSettings() ); + + QgsSnappingUtils u; + u.setMapSettings( mapSettings ); + + QgsSnappingConfig snappingConfig = u.config(); + snappingConfig.setEnabled( true ); + snappingConfig.setTolerance( 10 ); + snappingConfig.setUnits( Qgis::MapToolUnit::Pixels ); + snappingConfig.setMode( Qgis::SnappingMode::AllLayers ); + snappingConfig.setTypeFlag( Qgis::SnappingType::Vertex ); + u.setConfig( snappingConfig ); + + QgsMapCanvasSnappingUtils *snappingUtils = new QgsMapCanvasSnappingUtils( &canvas, this ); + snappingUtils->setConfig( snappingConfig ); + snappingUtils->setMapSettings( mapSettings ); + snappingUtils->locatorForLayer( layer )->init(); + + canvas.setSnappingUtils( snappingUtils ); + + canvas.setCurrentLayer( nullptr ); + + QgsAdvancedDigitizingDockWidget cadDock( &canvas ); + + QgsMapToolCapture tool( &canvas, &cadDock, QgsMapToolCapture::CaptureLine ); + canvas.setMapTool( &tool ); + + TestQgsMapToolAdvancedDigitizingUtils utils( &tool ); + utils.mouseClick( p.x() + .5, p.y() + .5, Qt::LeftButton, Qt::KeyboardModifiers(), true ); + + QgsPoint toolPoint = tool.captureCurve()->vertexAt( QgsVertexId( 0, 0, 0 ) ); + QCOMPARE( toolPoint, p ); +} + void TestQgsMapToolCapture::addVertexNonVectorLayer() { QgsProject::instance()->clear(); diff --git a/tests/src/gui/testqgsmaptooledit.cpp b/tests/src/gui/testqgsmaptooledit.cpp index edc444b4ac8e..5d3b58bd5374 100644 --- a/tests/src/gui/testqgsmaptooledit.cpp +++ b/tests/src/gui/testqgsmaptooledit.cpp @@ -100,13 +100,13 @@ void TestQgsMapToolEdit::checkLayers() QVERIFY( vl1->isValid() ); QgsProject::instance()->addMapLayer( vl1 ); - std::unique_ptr vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=halig:string&field=valig:string" ), QStringLiteral( "vl2" ), QStringLiteral( "memory" ) ); + auto vl2 = std::make_unique( QStringLiteral( "Point?crs=epsg:3946&field=halig:string&field=valig:string" ), QStringLiteral( "vl2" ), QStringLiteral( "memory" ) ); QVERIFY( vl2->isValid() ); - std::unique_ptr canvas = std::make_unique(); + auto canvas = std::make_unique(); canvas->setLayers( { vl1, vl2.get() } ); - std::unique_ptr tool = std::make_unique( canvas.get() ); + auto tool = std::make_unique( canvas.get() ); // retrieving layer by id should work for both layers from the project AND for freestanding layers QCOMPARE( tool->layer( vl1->id() ), vl1 ); diff --git a/tests/src/app/testqgsmaptoolutils.h b/tests/src/gui/testqgsmaptoolutils.h similarity index 99% rename from tests/src/app/testqgsmaptoolutils.h rename to tests/src/gui/testqgsmaptoolutils.h index c5cc31f691fb..2d765ff54d9d 100644 --- a/tests/src/app/testqgsmaptoolutils.h +++ b/tests/src/gui/testqgsmaptoolutils.h @@ -15,13 +15,10 @@ * * ***************************************************************************/ -#include "qgstest.h" - -#include "qgisapp.h" +//#include "qgisapp.h" #include "qgsgeometry.h" #include "qgsmapcanvas.h" #include "qgsmapmouseevent.h" -#include "qgssnappingutils.h" #include "qgsmaptooladvanceddigitizing.h" /** diff --git a/tests/src/gui/testqgsmaskingwidget.cpp b/tests/src/gui/testqgsmaskingwidget.cpp index 92b4ff449f37..b8b5ddad84e8 100644 --- a/tests/src/gui/testqgsmaskingwidget.cpp +++ b/tests/src/gui/testqgsmaskingwidget.cpp @@ -102,7 +102,7 @@ void TestQgsMaskingWidget::testTreeWidget() QCOMPARE( maskLayer->masks().count(), 0 ); // update masking widget - std::unique_ptr mw = std::make_unique(); + auto mw = std::make_unique(); QElapsedTimer timer; timer.start(); mw->setLayer( linesWithLabels ); diff --git a/tests/src/gui/testqgsmeshlayerpropertiesdialog.cpp b/tests/src/gui/testqgsmeshlayerpropertiesdialog.cpp index adb8fd55b6b9..164c1c000e1d 100644 --- a/tests/src/gui/testqgsmeshlayerpropertiesdialog.cpp +++ b/tests/src/gui/testqgsmeshlayerpropertiesdialog.cpp @@ -85,7 +85,7 @@ void TestQgsMeshLayerPropertiesDialog::testInvalidLayer() void TestQgsMeshLayerPropertiesDialog::testCrs() { QgsMapCanvas mapCanvas; - std::unique_ptr dialog = std::make_unique( mpMeshLayer, &mapCanvas ); + auto dialog = std::make_unique( mpMeshLayer, &mapCanvas ); QCOMPARE( dialog->mCrsSelector->crs(), mpMeshLayer->crs() ); const QgsCoordinateReferenceSystem crs = QgsCoordinateReferenceSystem::fromEpsgId( 27700 ); dialog->mCrsSelector->setCrs( crs ); diff --git a/tests/src/gui/testqgsrangewidgetwrapper.cpp b/tests/src/gui/testqgsrangewidgetwrapper.cpp index 0b29cf61b6fc..d3933355c99d 100644 --- a/tests/src/gui/testqgsrangewidgetwrapper.cpp +++ b/tests/src/gui/testqgsrangewidgetwrapper.cpp @@ -465,7 +465,7 @@ void TestQgsRangeWidgetWrapper::test_focus() void TestQgsRangeWidgetWrapper::testLongLong() { // test range widget with a long long field type - std::unique_ptr wrapper = std::make_unique( vl.get(), 4, nullptr, nullptr ); + auto wrapper = std::make_unique( vl.get(), 4, nullptr, nullptr ); // should use a double spin box, as a integer spin box does not have sufficient range QgsDoubleSpinBox *editor = qobject_cast( wrapper->createWidget( nullptr ) ); diff --git a/tests/src/gui/testqgsrubberband.cpp b/tests/src/gui/testqgsrubberband.cpp index 9205d416a1fb..4939c173b58e 100644 --- a/tests/src/gui/testqgsrubberband.cpp +++ b/tests/src/gui/testqgsrubberband.cpp @@ -120,7 +120,7 @@ void TestQgsRubberband::testAddSingleMultiGeometries() void TestQgsRubberband::pointGeometryAddPoints() { // point geometry - std::unique_ptr canvas = std::make_unique(); + auto canvas = std::make_unique(); QgsRubberBand r1( canvas.get(), Qgis::GeometryType::Point ); QVERIFY( r1.asGeometry().isEmpty() ); r1.addPoint( QgsPointXY( 1, 2 ) ); @@ -138,7 +138,7 @@ void TestQgsRubberband::pointGeometryAddPoints() void TestQgsRubberband::pointGeometrySetGeometry() { // point geometry, set using setToGeometry - std::unique_ptr canvas = std::make_unique(); + auto canvas = std::make_unique(); QgsRubberBand r1( canvas.get(), Qgis::GeometryType::Point ); QVERIFY( r1.asGeometry().isEmpty() ); r1.setToGeometry( QgsGeometry::fromPointXY( QgsPointXY( 1, 2 ) ) ); @@ -160,7 +160,7 @@ void TestQgsRubberband::pointGeometrySetGeometry() void TestQgsRubberband::lineGeometryAddPoints() { - std::unique_ptr canvas = std::make_unique(); + auto canvas = std::make_unique(); QgsRubberBand r1( canvas.get(), Qgis::GeometryType::Line ); QVERIFY( r1.asGeometry().isEmpty() ); r1.addPoint( QgsPointXY( 1, 2 ) ); @@ -177,7 +177,7 @@ void TestQgsRubberband::lineGeometryAddPoints() void TestQgsRubberband::copyPointsFrom() { - std::unique_ptr canvas = std::make_unique(); + auto canvas = std::make_unique(); QgsRubberBand r1( canvas.get(), Qgis::GeometryType::Point ); r1.addPoint( QgsPointXY( 1, 2 ) ); r1.addPoint( QgsPointXY( 3, 4 ) ); @@ -304,7 +304,7 @@ void TestQgsRubberband::testClose() void TestQgsRubberband::testLineSymbolRender() { - std::unique_ptr canvas = std::make_unique(); + auto canvas = std::make_unique(); canvas->setDestinationCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:4326" ) ) ); canvas->setFrameStyle( 0 ); canvas->resize( 600, 400 ); @@ -340,7 +340,7 @@ void TestQgsRubberband::testLineSymbolRender() void TestQgsRubberband::testFillSymbolRender() { - std::unique_ptr canvas = std::make_unique(); + auto canvas = std::make_unique(); canvas->setDestinationCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:4326" ) ) ); canvas->setFrameStyle( 0 ); canvas->resize( 600, 400 ); diff --git a/tests/src/gui/testqgstableeditor.cpp b/tests/src/gui/testqgstableeditor.cpp index ea71d1263f9c..b5eb9288b238 100644 --- a/tests/src/gui/testqgstableeditor.cpp +++ b/tests/src/gui/testqgstableeditor.cpp @@ -76,7 +76,7 @@ void TestQgsTableEditor::testData() const QSignalSpy spy( &w, &QgsTableEditorWidget::tableChanged ); QgsTableCell c3; c3.setContent( 87 ); - std::unique_ptr format = std::make_unique(); + auto format = std::make_unique(); format->setNumberDecimalPlaces( 2 ); format->setPrefix( QStringLiteral( "$" ) ); c3.setNumericFormat( format.release() ); @@ -127,7 +127,7 @@ void TestQgsTableEditor::insertRowsBelow() const QSignalSpy spy( &w, &QgsTableEditorWidget::tableChanged ); QgsTableCell c3; c3.setContent( 87 ); - std::unique_ptr format = std::make_unique(); + auto format = std::make_unique(); format->setNumberDecimalPlaces( 2 ); format->setPrefix( QStringLiteral( "$" ) ); c3.setNumericFormat( format.release() ); @@ -237,7 +237,7 @@ void TestQgsTableEditor::insertRowsAbove() const QSignalSpy spy( &w, &QgsTableEditorWidget::tableChanged ); QgsTableCell c3; c3.setContent( 87 ); - std::unique_ptr format = std::make_unique(); + auto format = std::make_unique(); format->setNumberDecimalPlaces( 2 ); format->setPrefix( QStringLiteral( "$" ) ); c3.setNumericFormat( format.release() ); @@ -347,7 +347,7 @@ void TestQgsTableEditor::insertColumnsBefore() const QSignalSpy spy( &w, &QgsTableEditorWidget::tableChanged ); QgsTableCell c3; c3.setContent( 87 ); - std::unique_ptr format = std::make_unique(); + auto format = std::make_unique(); format->setNumberDecimalPlaces( 2 ); format->setPrefix( QStringLiteral( "$" ) ); c3.setNumericFormat( format.release() ); @@ -429,7 +429,7 @@ void TestQgsTableEditor::insertColumnsAfter() const QSignalSpy spy( &w, &QgsTableEditorWidget::tableChanged ); QgsTableCell c3; c3.setContent( 87 ); - std::unique_ptr format = std::make_unique(); + auto format = std::make_unique(); format->setNumberDecimalPlaces( 2 ); format->setPrefix( QStringLiteral( "$" ) ); c3.setNumericFormat( format.release() ); @@ -511,7 +511,7 @@ void TestQgsTableEditor::deleteRows() const QSignalSpy spy( &w, &QgsTableEditorWidget::tableChanged ); QgsTableCell c3; c3.setContent( 87 ); - std::unique_ptr format = std::make_unique(); + auto format = std::make_unique(); format->setNumberDecimalPlaces( 2 ); format->setPrefix( QStringLiteral( "$" ) ); QgsTableCell c2( 76 ); @@ -574,7 +574,7 @@ void TestQgsTableEditor::deleteColumns() const QSignalSpy spy( &w, &QgsTableEditorWidget::tableChanged ); QgsTableCell c3; c3.setContent( 87 ); - std::unique_ptr format = std::make_unique(); + auto format = std::make_unique(); format->setNumberDecimalPlaces( 2 ); format->setPrefix( QStringLiteral( "$" ) ); QgsTableCell c2( 76 ); @@ -741,7 +741,7 @@ void TestQgsTableEditor::foregroundColor() const QSignalSpy spy( &w, &QgsTableEditorWidget::tableChanged ); QgsTableCell c3; c3.setContent( 87 ); - std::unique_ptr format = std::make_unique(); + auto format = std::make_unique(); format->setNumberDecimalPlaces( 2 ); format->setPrefix( QStringLiteral( "$" ) ); c3.setNumericFormat( format.release() ); @@ -806,7 +806,7 @@ void TestQgsTableEditor::backgroundColor() const QSignalSpy spy( &w, &QgsTableEditorWidget::tableChanged ); QgsTableCell c3; c3.setContent( 87 ); - std::unique_ptr format = std::make_unique(); + auto format = std::make_unique(); format->setNumberDecimalPlaces( 2 ); format->setPrefix( QStringLiteral( "$" ) ); c3.setNumericFormat( format.release() ); @@ -869,7 +869,7 @@ void TestQgsTableEditor::alignment() const QSignalSpy spy( &w, &QgsTableEditorWidget::tableChanged ); QgsTableCell c3; c3.setContent( 87 ); - std::unique_ptr format = std::make_unique(); + auto format = std::make_unique(); format->setNumberDecimalPlaces( 2 ); format->setPrefix( QStringLiteral( "$" ) ); c3.setNumericFormat( format.release() ); @@ -937,7 +937,7 @@ void TestQgsTableEditor::properties() const QSignalSpy spy( &w, &QgsTableEditorWidget::tableChanged ); QgsTableCell c3; c3.setContent( 87 ); - std::unique_ptr format = std::make_unique(); + auto format = std::make_unique(); format->setNumberDecimalPlaces( 2 ); format->setPrefix( QStringLiteral( "$" ) ); c3.setNumericFormat( format.release() ); @@ -1045,7 +1045,7 @@ void TestQgsTableEditor::numericFormat() const QSignalSpy spy( &w, &QgsTableEditorWidget::tableChanged ); QgsTableCell c3; c3.setContent( 87 ); - std::unique_ptr format = std::make_unique(); + auto format = std::make_unique(); format->setNumberDecimalPlaces( 2 ); format->setPrefix( QStringLiteral( "$" ) ); QgsTableCell c2( 76 ); diff --git a/tests/src/gui/testqgsvaluemapwidgetwrapper.cpp b/tests/src/gui/testqgsvaluemapwidgetwrapper.cpp index 366c7c71f4c5..03b570a1fefc 100644 --- a/tests/src/gui/testqgsvaluemapwidgetwrapper.cpp +++ b/tests/src/gui/testqgsvaluemapwidgetwrapper.cpp @@ -76,7 +76,7 @@ void TestQgsValueMapWidgetWrapper::testPopulateComboBox() config.insert( QStringLiteral( "map" ), valueList ); - std::unique_ptr combo = std::make_unique(); + auto combo = std::make_unique(); // with nulls QgsValueMapConfigDlg::populateComboBox( combo.get(), config, false ); diff --git a/tests/src/gui/testqgsvaluerelationwidgetwrapper.cpp b/tests/src/gui/testqgsvaluerelationwidgetwrapper.cpp index 57583fab9ba7..2efa972972da 100644 --- a/tests/src/gui/testqgsvaluerelationwidgetwrapper.cpp +++ b/tests/src/gui/testqgsvaluerelationwidgetwrapper.cpp @@ -1689,8 +1689,8 @@ void TestQgsValueRelationWidgetWrapper::testAllowMultiColumns() QFile::copy( myFileName + "/provider/test_json.gpkg", myTempDirName + "/test_json.gpkg" ); const QString myTempFileName = myTempDirName + "/test_json.gpkg"; const QFileInfo myMapFileInfo( myTempFileName ); - std::unique_ptr vl_text( new QgsVectorLayer( myMapFileInfo.filePath() + "|layername=foo", "test", QStringLiteral( "ogr" ) ) ); - std::unique_ptr vl_authors( new QgsVectorLayer( myMapFileInfo.filePath() + "|layername=author", "test", QStringLiteral( "ogr" ) ) ); + auto vl_text = std::make_unique( myMapFileInfo.filePath() + "|layername=foo", "test", QStringLiteral( "ogr" ) ); + auto vl_authors = std::make_unique( myMapFileInfo.filePath() + "|layername=author", "test", QStringLiteral( "ogr" ) ); QVERIFY( vl_text->isValid() ); QVERIFY( vl_authors->isValid() ); @@ -1737,8 +1737,8 @@ void TestQgsValueRelationWidgetWrapper::testAllowMultiAndCompleter() QFile::copy( myFileName + "/provider/test_json.gpkg", myTempDirName + "/test_json.gpkg" ); const QString myTempFileName = myTempDirName + "/test_json.gpkg"; const QFileInfo myMapFileInfo( myTempFileName ); - std::unique_ptr vl_text( new QgsVectorLayer( myMapFileInfo.filePath() + "|layername=foo", "test", QStringLiteral( "ogr" ) ) ); - std::unique_ptr vl_authors( new QgsVectorLayer( myMapFileInfo.filePath() + "|layername=author", "test", QStringLiteral( "ogr" ) ) ); + auto vl_text = std::make_unique( myMapFileInfo.filePath() + "|layername=foo", "test", QStringLiteral( "ogr" ) ); + auto vl_authors = std::make_unique( myMapFileInfo.filePath() + "|layername=author", "test", QStringLiteral( "ogr" ) ); QVERIFY( vl_text->isValid() ); QVERIFY( vl_authors->isValid() ); @@ -1885,14 +1885,14 @@ void TestQgsValueRelationWidgetWrapper::testGroup() void TestQgsValueRelationWidgetWrapper::testMultiEditMode() { - std::unique_ptr people = std::make_unique( QStringLiteral( "None?field=firstname:string&field=fullname:string" ), QStringLiteral( "people" ), QStringLiteral( "memory" ) ); + auto people = std::make_unique( QStringLiteral( "None?field=firstname:string&field=fullname:string" ), QStringLiteral( "people" ), QStringLiteral( "memory" ) ); QgsFeature ft( people->dataProvider()->fields(), 1 ); ft.setAttribute( QStringLiteral( "firstname" ), QStringLiteral( "Jhon" ) ); ft.setAttribute( QStringLiteral( "fullname" ), QStringLiteral( "Jhon Carpenter" ) ); people->dataProvider()->addFeature( ft ); - std::unique_ptr famous = std::make_unique( QStringLiteral( "None?field=name:string" ), QStringLiteral( "famous" ), QStringLiteral( "memory" ) ); + auto famous = std::make_unique( QStringLiteral( "None?field=name:string" ), QStringLiteral( "famous" ), QStringLiteral( "memory" ) ); const QStringList famousNames { QStringLiteral( "Jhon Carpenter" ), QStringLiteral( "Jhon F. Kennedy" ), QStringLiteral( "Jhon Lennon" ), QStringLiteral( "Paul Mc Cartney" ) }; for ( const QString &name : famousNames ) diff --git a/tests/src/providers/grass/testqgsgrassprovider.cpp b/tests/src/providers/grass/testqgsgrassprovider.cpp index b18ec149c925..597fb60410da 100644 --- a/tests/src/providers/grass/testqgsgrassprovider.cpp +++ b/tests/src/providers/grass/testqgsgrassprovider.cpp @@ -487,7 +487,7 @@ void TestQgsGrassProvider::vectorLayers() void TestQgsGrassProvider::invalidLayer() { - std::unique_ptr brokenLayer = std::make_unique( QStringLiteral( "/not/valid" ), QStringLiteral( "test" ), QStringLiteral( "grass" ) ); + auto brokenLayer = std::make_unique( QStringLiteral( "/not/valid" ), QStringLiteral( "test" ), QStringLiteral( "grass" ) ); QVERIFY( !brokenLayer->isValid() ); QgsVectorDataProvider *provider = brokenLayer->dataProvider(); QVERIFY( provider ); diff --git a/tests/src/providers/testqgscopcprovider.cpp b/tests/src/providers/testqgscopcprovider.cpp index a8499f95104c..de52c770ad3f 100644 --- a/tests/src/providers/testqgscopcprovider.cpp +++ b/tests/src/providers/testqgscopcprovider.cpp @@ -86,6 +86,7 @@ class TestQgsCopcProvider : public QgsTest void testStatsCalculator(); void testSaveLoadStats(); void testPointCloudRequest(); + void testPointCloudRequestIgnoreFilter(); void testQgsRangeRequestCache(); }; @@ -215,7 +216,7 @@ void TestQgsCopcProvider::querySublayers() void TestQgsCopcProvider::brokenPath() { // test loading a bad layer URI - std::unique_ptr layer = std::make_unique( QStringLiteral( "not valid" ), QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); + auto layer = std::make_unique( QStringLiteral( "not valid" ), QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); QVERIFY( !layer->isValid() ); } @@ -251,7 +252,7 @@ void TestQgsCopcProvider::validLayer() { const QString dataPath = copyTestData( QStringLiteral( "point_clouds/copc/sunshine-coast.copc.laz" ) ); - std::unique_ptr layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); + auto layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); QVERIFY( layer->isValid() ); QCOMPARE( layer->crs().authid(), QStringLiteral( "EPSG:28356" ) ); @@ -273,7 +274,7 @@ void TestQgsCopcProvider::validLayerWithCopcHierarchy() { const QString dataPath = copyTestData( QStringLiteral( "point_clouds/copc/lone-star.copc.laz" ) ); - std::unique_ptr layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); + auto layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); QVERIFY( layer->isValid() ); QGSCOMPARENEAR( layer->extent().xMinimum(), 515368.6022, 0.1 ); @@ -291,7 +292,7 @@ void TestQgsCopcProvider::attributes() { const QString dataPath = copyTestData( QStringLiteral( "/point_clouds/copc/sunshine-coast.copc.laz" ) ); - std::unique_ptr layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); + auto layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); QVERIFY( layer->isValid() ); const QgsPointCloudAttributeCollection attributes = layer->attributes(); @@ -344,7 +345,7 @@ void TestQgsCopcProvider::calculateZRange() { const QString dataPath = copyTestData( QStringLiteral( "/point_clouds/copc/sunshine-coast.copc.laz" ) ); - std::unique_ptr layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); + auto layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); QVERIFY( layer->isValid() ); QgsDoubleRange range = layer->elevationProperties()->calculateZRange( layer.get() ); @@ -372,7 +373,7 @@ void TestQgsCopcProvider::testIdentify() const QString datasetPath = copyTestData( srcDatasetPath ); - std::unique_ptr layer = std::make_unique( datasetPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); + auto layer = std::make_unique( datasetPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); QVERIFY( layer->isValid() ); @@ -566,7 +567,7 @@ void TestQgsCopcProvider::testExtraBytesAttributesValues() { const QString dataPath = copyTestData( QStringLiteral( "/point_clouds/copc/extrabytes-dataset.copc.laz" ) ); - std::unique_ptr layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); + auto layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); QVERIFY( layer->isValid() ); { const float maxErrorInMapCoords = 0.0015207174f; @@ -649,7 +650,7 @@ void TestQgsCopcProvider::testClassFlagsValues() { const QString dataPath = copyTestData( QStringLiteral( "/point_clouds/copc/extrabytes-dataset.copc.laz" ) ); - std::unique_ptr layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); + auto layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); QVERIFY( layer->isValid() ); { const float maxErrorInMapCoords = 0.0015207174f; @@ -821,7 +822,7 @@ void TestQgsCopcProvider::testPointCloudIndex() { const QString dataPath = copyTestData( QStringLiteral( "/point_clouds/copc/lone-star.copc.laz" ) ); - std::unique_ptr layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); + auto layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); QVERIFY( layer->isValid() ); QgsPointCloudIndex index = layer->dataProvider()->index(); @@ -877,7 +878,7 @@ void TestQgsCopcProvider::testStatsCalculator() { const QString dataPath = copyTestData( QStringLiteral( "/point_clouds/copc/extrabytes-dataset.copc.laz" ) ); - std::unique_ptr layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); + auto layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); QgsPointCloudIndex index = layer->dataProvider()->index(); QgsPointCloudStatsCalculator calculator( index ); @@ -1126,7 +1127,7 @@ void TestQgsCopcProvider::testSaveLoadStats() const QString dataPath = copyTestData( QStringLiteral( "/point_clouds/copc/lone-star.copc.laz" ) ); { - std::unique_ptr layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); + auto layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); QVERIFY( layer->isValid() ); QVERIFY( layer->dataProvider() && layer->dataProvider()->isValid() && layer->dataProvider()->index() ); @@ -1137,7 +1138,7 @@ void TestQgsCopcProvider::testSaveLoadStats() } { - std::unique_ptr layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); + auto layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); QVERIFY( layer->isValid() ); QVERIFY( layer->dataProvider() && layer->dataProvider()->isValid() && layer->dataProvider()->index() ); @@ -1154,7 +1155,7 @@ void TestQgsCopcProvider::testPointCloudRequest() { const QString dataPath = copyTestData( QStringLiteral( "/point_clouds/copc/lone-star.copc.laz" ) ); - std::unique_ptr layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); + auto layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); QVERIFY( layer->isValid() ); QgsPointCloudIndex index = layer->dataProvider()->index(); @@ -1219,5 +1220,54 @@ void TestQgsCopcProvider::testPointCloudRequest() } QCOMPARE( count, layer->pointCount() ); } + +void TestQgsCopcProvider::testPointCloudRequestIgnoreFilter() +{ + const QString dataPath = copyTestData( QStringLiteral( "/point_clouds/copc/lone-star.copc.laz" ) ); + + auto layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "copc" ) ); + QVERIFY( layer->isValid() ); + + layer->setSubsetString( QStringLiteral( "Intensity < 1000" ) ); + QgsPointCloudIndex index = layer->dataProvider()->index(); + QVERIFY( index.isValid() ); + + QVector nodes; + QQueue queue; + queue.push_back( index.root() ); + while ( !queue.empty() ) + { + QgsPointCloudNodeId node = queue.front(); + queue.pop_front(); + nodes.push_back( node ); + + for ( const QgsPointCloudNodeId &child : index.getNode( node ).children() ) + { + queue.push_back( child ); + } + } + + QgsPointCloudRequest request; + request.setAttributes( layer->attributes() ); + // layer has a filter, point count is reduced + int count = 0; + for ( QgsPointCloudNodeId node : nodes ) + { + auto block = index.nodeData( node, request ); + count += block->pointCount(); + } + QCOMPARE( count, 247636 ); + + // Now let's repeat the counting but ignore the subset string filter + request.setIgnoreIndexFilterEnabled( true ); + count = 0; + for ( QgsPointCloudNodeId node : nodes ) + { + auto block = index.nodeData( node, request ); + count += block->pointCount(); + } + QCOMPARE( count, layer->pointCount() ); +} + QGSTEST_MAIN( TestQgsCopcProvider ) #include "testqgscopcprovider.moc" diff --git a/tests/src/providers/testqgseptprovider.cpp b/tests/src/providers/testqgseptprovider.cpp index 2a63f256da49..bcc44579ac9f 100644 --- a/tests/src/providers/testqgseptprovider.cpp +++ b/tests/src/providers/testqgseptprovider.cpp @@ -79,6 +79,7 @@ class TestQgsEptProvider : public QgsTest void testExtraBytesAttributesValues(); void testPointCloudIndex(); void testPointCloudRequest(); + void testPointCloudRequestIgnoreFilter(); void testStatsCalculator(); }; @@ -207,7 +208,7 @@ void TestQgsEptProvider::querySublayers() void TestQgsEptProvider::brokenPath() { // test loading a bad layer URI - std::unique_ptr layer = std::make_unique( QStringLiteral( "not valid" ), QStringLiteral( "layer" ), QStringLiteral( "ept" ) ); + auto layer = std::make_unique( QStringLiteral( "not valid" ), QStringLiteral( "layer" ), QStringLiteral( "ept" ) ); QVERIFY( !layer->isValid() ); } @@ -251,7 +252,7 @@ void TestQgsEptProvider::validLayer() { const QString path = copyTestDataDirectory( QStringLiteral( "point_clouds/ept/sunshine-coast" ) ); - std::unique_ptr layer = std::make_unique( path + QStringLiteral( "/ept.json" ), QStringLiteral( "layer" ), QStringLiteral( "ept" ) ); + auto layer = std::make_unique( path + QStringLiteral( "/ept.json" ), QStringLiteral( "layer" ), QStringLiteral( "ept" ) ); QVERIFY( layer->isValid() ); QCOMPARE( layer->crs().authid(), QStringLiteral( "EPSG:28356" ) ); @@ -273,7 +274,7 @@ void TestQgsEptProvider::validLayerWithEptHierarchy() { const QString path = copyTestDataDirectory( QStringLiteral( "point_clouds/ept/lone-star-laszip" ) ); - std::unique_ptr layer = std::make_unique( path + QStringLiteral( "/ept.json" ), QStringLiteral( "layer" ), QStringLiteral( "ept" ) ); + auto layer = std::make_unique( path + QStringLiteral( "/ept.json" ), QStringLiteral( "layer" ), QStringLiteral( "ept" ) ); QVERIFY( layer->isValid() ); QGSCOMPARENEAR( layer->extent().xMinimum(), 515368.000000, 0.1 ); @@ -291,7 +292,7 @@ void TestQgsEptProvider::attributes() { const QString path = copyTestDataDirectory( QStringLiteral( "point_clouds/ept/sunshine-coast" ) ); - std::unique_ptr layer = std::make_unique( path + QStringLiteral( "/ept.json" ), QStringLiteral( "layer" ), QStringLiteral( "ept" ) ); + auto layer = std::make_unique( path + QStringLiteral( "/ept.json" ), QStringLiteral( "layer" ), QStringLiteral( "ept" ) ); QVERIFY( layer->isValid() ); const QgsPointCloudAttributeCollection attributes = layer->attributes(); @@ -334,7 +335,7 @@ void TestQgsEptProvider::calculateZRange() { const QString path = copyTestDataDirectory( QStringLiteral( "point_clouds/ept/sunshine-coast" ) ); - std::unique_ptr layer = std::make_unique( path + QStringLiteral( "/ept.json" ), QStringLiteral( "layer" ), QStringLiteral( "ept" ) ); + auto layer = std::make_unique( path + QStringLiteral( "/ept.json" ), QStringLiteral( "layer" ), QStringLiteral( "ept" ) ); QVERIFY( layer->isValid() ); QgsDoubleRange range = layer->elevationProperties()->calculateZRange( layer.get() ); @@ -363,7 +364,7 @@ void TestQgsEptProvider::testIdentify() const QString path = copyTestDataDirectory( datasetPath ); - std::unique_ptr layer = std::make_unique( path + QStringLiteral( "/ept.json" ), QStringLiteral( "layer" ), QStringLiteral( "ept" ) ); + auto layer = std::make_unique( path + QStringLiteral( "/ept.json" ), QStringLiteral( "layer" ), QStringLiteral( "ept" ) ); // identify 1 point click (rectangular point shape) { @@ -547,7 +548,7 @@ void TestQgsEptProvider::testExtraBytesAttributesValues() const QString path = copyTestDataDirectory( QStringLiteral( "point_clouds/ept/extrabytes-dataset" ) ); QString dataPath = path + QStringLiteral( "/ept.json" ); - std::unique_ptr layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "ept" ) ); + auto layer = std::make_unique( dataPath, QStringLiteral( "layer" ), QStringLiteral( "ept" ) ); QVERIFY( layer->isValid() ); { const float maxErrorInMapCoords = 0.0015207174f; @@ -624,7 +625,7 @@ void TestQgsEptProvider::testPointCloudIndex() { const QString path = copyTestDataDirectory( QStringLiteral( "point_clouds/ept/lone-star-laszip" ) ); - std::unique_ptr layer = std::make_unique( path + QStringLiteral( "/ept.json" ), QStringLiteral( "layer" ), QStringLiteral( "ept" ) ); + auto layer = std::make_unique( path + QStringLiteral( "/ept.json" ), QStringLiteral( "layer" ), QStringLiteral( "ept" ) ); QVERIFY( layer->isValid() ); QgsPointCloudIndex index = layer->dataProvider()->index(); @@ -681,7 +682,7 @@ void TestQgsEptProvider::testPointCloudRequest() { const QString path = copyTestDataDirectory( QStringLiteral( "point_clouds/ept/lone-star-laszip" ) ); - std::unique_ptr layer = std::make_unique( path + QStringLiteral( "/ept.json" ), QStringLiteral( "layer" ), QStringLiteral( "ept" ) ); + auto layer = std::make_unique( path + QStringLiteral( "/ept.json" ), QStringLiteral( "layer" ), QStringLiteral( "ept" ) ); QVERIFY( layer->isValid() ); QgsPointCloudIndex index = layer->dataProvider()->index(); @@ -747,11 +748,59 @@ void TestQgsEptProvider::testPointCloudRequest() QCOMPARE( count, layer->pointCount() ); } +void TestQgsEptProvider::testPointCloudRequestIgnoreFilter() +{ + const QString path = copyTestDataDirectory( QStringLiteral( "point_clouds/ept/lone-star-laszip" ) ); + + auto layer = std::make_unique( path + QStringLiteral( "/ept.json" ), QStringLiteral( "layer" ), QStringLiteral( "ept" ) ); + QVERIFY( layer->isValid() ); + + layer->setSubsetString( QStringLiteral( "Intensity < 1000" ) ); + QgsPointCloudIndex index = layer->dataProvider()->index(); + QVERIFY( index.isValid() ); + + QVector nodes; + QQueue queue; + queue.push_back( index.root() ); + while ( !queue.empty() ) + { + QgsPointCloudNodeId node = queue.front(); + queue.pop_front(); + nodes.push_back( node ); + + for ( const QgsPointCloudNodeId &child : index.getNode( node ).children() ) + { + queue.push_back( child ); + } + } + + QgsPointCloudRequest request; + request.setAttributes( layer->attributes() ); + // layer has a filter, point count is reduced + int count = 0; + for ( QgsPointCloudNodeId node : nodes ) + { + auto block = index.nodeData( node, request ); + count += block->pointCount(); + } + QCOMPARE( count, 247636 ); + + // Now let's repeat the counting but ignore the subset string filter + request.setIgnoreIndexFilterEnabled( true ); + count = 0; + for ( QgsPointCloudNodeId node : nodes ) + { + auto block = index.nodeData( node, request ); + count += block->pointCount(); + } + QCOMPARE( count, layer->pointCount() ); +} + void TestQgsEptProvider::testStatsCalculator() { const QString path = copyTestDataDirectory( QStringLiteral( "point_clouds/ept/extrabytes-dataset" ) ); - std::unique_ptr layer = std::make_unique( path + QStringLiteral( "/ept.json" ), QStringLiteral( "layer" ), QStringLiteral( "ept" ) ); + auto layer = std::make_unique( path + QStringLiteral( "/ept.json" ), QStringLiteral( "layer" ), QStringLiteral( "ept" ) ); QgsPointCloudIndex index = layer->dataProvider()->index(); QgsPointCloudStatsCalculator calculator( index ); diff --git a/tests/src/providers/testqgspdalprovider.cpp b/tests/src/providers/testqgspdalprovider.cpp index f3d48b39dc7e..dfd01d1de503 100644 --- a/tests/src/providers/testqgspdalprovider.cpp +++ b/tests/src/providers/testqgspdalprovider.cpp @@ -191,7 +191,7 @@ void TestQgsPdalProvider::querySublayers() void TestQgsPdalProvider::brokenPath() { // test loading a bad layer URI - std::unique_ptr layer = std::make_unique( + auto layer = std::make_unique( QStringLiteral( "not valid" ), QStringLiteral( "layer" ), QStringLiteral( "pdal" ) @@ -204,7 +204,7 @@ void TestQgsPdalProvider::validLayer() QgsPointCloudLayer::LayerOptions options; options.skipIndexGeneration = true; - std::unique_ptr layer = std::make_unique( + auto layer = std::make_unique( mTestDataDir + QStringLiteral( "point_clouds/las/cloud.las" ), QStringLiteral( "layer" ), QStringLiteral( "pdal" ), diff --git a/tests/src/providers/testqgspostgresconn.cpp b/tests/src/providers/testqgspostgresconn.cpp index b5629da68fe0..80dbe55d4cf3 100644 --- a/tests/src/providers/testqgspostgresconn.cpp +++ b/tests/src/providers/testqgspostgresconn.cpp @@ -20,6 +20,7 @@ #include #include #include +#include "qgspostgresutils.h" // Helper function for QCOMPARE char *toString( const QgsPostgresGeometryColumnType &t ) diff --git a/tests/src/providers/testqgsvirtualpointcloudprovider.cpp b/tests/src/providers/testqgsvirtualpointcloudprovider.cpp index 1d49725bd310..5b65842a9337 100644 --- a/tests/src/providers/testqgsvirtualpointcloudprovider.cpp +++ b/tests/src/providers/testqgsvirtualpointcloudprovider.cpp @@ -205,13 +205,13 @@ void TestQgsVirtualPointCloudProvider::querySublayers() void TestQgsVirtualPointCloudProvider::brokenPath() { // test loading a bad layer URI - std::unique_ptr layer = std::make_unique( QStringLiteral( "not valid" ), QStringLiteral( "layer" ), QStringLiteral( "vpc" ) ); + auto layer = std::make_unique( QStringLiteral( "not valid" ), QStringLiteral( "layer" ), QStringLiteral( "vpc" ) ); QVERIFY( !layer->isValid() ); } void TestQgsVirtualPointCloudProvider::validLayer() { - std::unique_ptr layer = std::make_unique( mTestDataDir + QStringLiteral( "point_clouds/virtual/tiles.vpc" ), QStringLiteral( "layer" ), QStringLiteral( "vpc" ) ); + auto layer = std::make_unique( mTestDataDir + QStringLiteral( "point_clouds/virtual/tiles.vpc" ), QStringLiteral( "layer" ), QStringLiteral( "vpc" ) ); QVERIFY( layer->isValid() ); QCOMPARE( layer->crs().authid(), QStringLiteral( "EPSG:5514" ) ); @@ -228,7 +228,7 @@ void TestQgsVirtualPointCloudProvider::validLayer() void TestQgsVirtualPointCloudProvider::attributes() { - std::unique_ptr layer = std::make_unique( mTestDataDir + QStringLiteral( "point_clouds/virtual/tiles.vpc" ), QStringLiteral( "layer" ), QStringLiteral( "vpc" ) ); + auto layer = std::make_unique( mTestDataDir + QStringLiteral( "point_clouds/virtual/tiles.vpc" ), QStringLiteral( "layer" ), QStringLiteral( "vpc" ) ); QVERIFY( layer->isValid() ); const QgsPointCloudAttributeCollection attributes = layer->attributes(); @@ -269,7 +269,7 @@ void TestQgsVirtualPointCloudProvider::attributes() void TestQgsVirtualPointCloudProvider::testLazyLoading() { - std::unique_ptr layer = std::make_unique( mTestDataDir + QStringLiteral( "point_clouds/virtual/tiles.vpc" ), QStringLiteral( "layer" ), QStringLiteral( "vpc" ) ); + auto layer = std::make_unique( mTestDataDir + QStringLiteral( "point_clouds/virtual/tiles.vpc" ), QStringLiteral( "layer" ), QStringLiteral( "vpc" ) ); QVERIFY( layer->isValid() ); QgsPointCloudIndex index = layer->dataProvider()->index(); diff --git a/tests/src/providers/testqgsvirtualrasterprovider.cpp b/tests/src/providers/testqgsvirtualrasterprovider.cpp index 592db283d8c5..718d13c549c1 100644 --- a/tests/src/providers/testqgsvirtualrasterprovider.cpp +++ b/tests/src/providers/testqgsvirtualrasterprovider.cpp @@ -105,7 +105,7 @@ void TestQgsVirtualRasterProvider::validLayer() { QgsRasterLayer::LayerOptions options; - std::unique_ptr layer = std::make_unique( + auto layer = std::make_unique( mTestDataDir + QStringLiteral( "raster/dem.tif" ), QStringLiteral( "layer" ), QStringLiteral( "virtualraster" ), @@ -195,7 +195,7 @@ void TestQgsVirtualRasterProvider::testConstructorWrong() //Giving an invalid uri, with more raster referencies compared to the raster.ref that are present in the formula QString str1 = QStringLiteral( "?crs=EPSG:4326&extent=18.6662979442000001,45.7767014376000034,18.7035979441999984,45.8117014376000000&width=373&height=350&formula=\"dem@1\" + 200&dem:provider=gdal&landsat:provider=gdal" ); QString uri = QString( "%1&%2&%3" ).arg( str1, QStringLiteral( "dem:uri=" ) % mTestDataDir % QStringLiteral( "raster/dem.tif" ), QStringLiteral( "landsat:uri=" ) % mTestDataDir % QStringLiteral( "landsat.tif" ) ); - std::unique_ptr layer = std::make_unique( uri, QStringLiteral( "layer" ), QStringLiteral( "virtualraster" ) ); + auto layer = std::make_unique( uri, QStringLiteral( "layer" ), QStringLiteral( "virtualraster" ) ); QVERIFY( !layer->isValid() ); } @@ -204,7 +204,7 @@ void TestQgsVirtualRasterProvider::testConstructor() { QString str1 = QStringLiteral( "?crs=EPSG:4326&extent=18.6662979442000001,45.7767014376000034,18.7035979441999984,45.8117014376000000&width=373&height=350&formula=\"dem@1\" + 200&dem:provider=gdal" ); QString uri1 = QString( "%1&%2" ).arg( str1, QStringLiteral( "dem:uri=" ) % mTestDataDir % QStringLiteral( "raster/dem.tif" ) ); - std::unique_ptr layer_1 = std::make_unique( uri1, QStringLiteral( "layer_1" ), QStringLiteral( "virtualraster" ) ); + auto layer_1 = std::make_unique( uri1, QStringLiteral( "layer_1" ), QStringLiteral( "virtualraster" ) ); QVERIFY( layer_1->dataProvider()->isValid() ); QVERIFY( layer_1->isValid() ); @@ -219,7 +219,7 @@ void TestQgsVirtualRasterProvider::testConstructor() const QString landsatPath = dir.filePath( QStringLiteral( "landsat.tif" ) ); QVERIFY( QFile::copy( mTestDataDir + "landsat.tif", landsatPath ) ); // remove nodata values from layer for consistent test results - std::unique_ptr landsat = std::make_unique( landsatPath, QString(), QStringLiteral( "gdal" ) ); + auto landsat = std::make_unique( landsatPath, QString(), QStringLiteral( "gdal" ) ); QVERIFY( landsat->isValid() ); landsat->dataProvider()->setNoDataValue( 1, -999999 ); landsat->dataProvider()->setNoDataValue( 2, -999999 ); @@ -227,7 +227,7 @@ void TestQgsVirtualRasterProvider::testConstructor() QString str2 = QStringLiteral( "?crs=EPSG:32633&extent=781662.375,3339523.125,793062.375,3350923.125&width=200&height=200&formula=\"landsat@1\" + \"landsat@2\"&landsat:provider=gdal" ); QString uri2 = QString( "%1&%2" ).arg( str2, QStringLiteral( "landsat:uri=" ) % landsatPath ); - std::unique_ptr layer_2 = std::make_unique( uri2, QStringLiteral( "layer_2" ), QStringLiteral( "virtualraster" ) ); + auto layer_2 = std::make_unique( uri2, QStringLiteral( "layer_2" ), QStringLiteral( "virtualraster" ) ); QVERIFY( layer_2->isValid() ); QVERIFY( layer_2->dataProvider()->isValid() ); @@ -238,7 +238,7 @@ void TestQgsVirtualRasterProvider::testConstructor() //use wrong formula QString str3 = QStringLiteral( "?crs=EPSG:32633&extent=781662.375,3339523.125,793062.375,3350923.125&width=200&height=200&formula=\"landsat@1\" xxxxxx+ \"landsat@2\"&landsat:provider=gdal" ); QString uri3 = QString( "%1&%2" ).arg( str3, QStringLiteral( "landsat:uri=" ) % landsatPath ); - std::unique_ptr layer_3 = std::make_unique( uri3, QStringLiteral( "layer_3" ), QStringLiteral( "virtualraster" ) ); + auto layer_3 = std::make_unique( uri3, QStringLiteral( "layer_3" ), QStringLiteral( "virtualraster" ) ); QVERIFY( !layer_3->isValid() ); } @@ -267,7 +267,7 @@ void TestQgsVirtualRasterProvider::testSecondGenerationVirtualRaster() // creation of the "first generation" virtual raster, meaning a virtual raster that comes directly from a file QString str = QStringLiteral( "?crs=EPSG:4326&extent=18.6662979442000001,45.7767014376000034,18.7035979441999984,45.8117014376000000&width=373&height=350&formula=\"dem@1\" + 200&dem:provider=gdal" ); QString uri = QString( "%1&%2" ).arg( str, QStringLiteral( "dem:uri=" ) % mTestDataDir % QStringLiteral( "raster/dem.tif" ) ); - std::unique_ptr layerFirst = std::make_unique( uri, QStringLiteral( "firstGenerationLayer" ), QStringLiteral( "virtualraster" ) ); + auto layerFirst = std::make_unique( uri, QStringLiteral( "firstGenerationLayer" ), QStringLiteral( "virtualraster" ) ); QVERIFY( layerFirst->dataProvider()->isValid() ); QVERIFY( layerFirst->isValid() ); @@ -287,7 +287,7 @@ void TestQgsVirtualRasterProvider::testSecondGenerationVirtualRaster() params.rInputLayers.append( rasterParams ); QString uriSecond = QgsVirtualRasterProvider::encodeVirtualRasterProviderUri( params ); - std::unique_ptr layerSecond = std::make_unique( uriSecond, QStringLiteral( "SecondGenerationLayer" ), QStringLiteral( "virtualraster" ) ); + auto layerSecond = std::make_unique( uriSecond, QStringLiteral( "SecondGenerationLayer" ), QStringLiteral( "virtualraster" ) ); QVERIFY( layerSecond->dataProvider()->isValid() ); QVERIFY( layerSecond->isValid() ); @@ -312,7 +312,7 @@ void TestQgsVirtualRasterProvider::testNoData() QString uri = QString( "%1&%2" ).arg( str, QStringLiteral( "nodata:uri=" ) % mTestDataDir % QStringLiteral( "raster/no_data.tif" ) ); - std::unique_ptr layerNoData = std::make_unique( uri, QStringLiteral( "no-data" ), QStringLiteral( "virtualraster" ) ); + auto layerNoData = std::make_unique( uri, QStringLiteral( "no-data" ), QStringLiteral( "virtualraster" ) ); QVERIFY( layerNoData->dataProvider()->isValid() ); QVERIFY( layerNoData->isValid() ); diff --git a/tests/src/providers/testqgswmscapabilities.cpp b/tests/src/providers/testqgswmscapabilities.cpp index e5f458e5f31b..653c1ff28678 100644 --- a/tests/src/providers/testqgswmscapabilities.cpp +++ b/tests/src/providers/testqgswmscapabilities.cpp @@ -100,7 +100,7 @@ class TestQgsWmsCapabilities : public QObject { QgsWmsSettings settings = QgsWmsSettings(); - QMap map = { { "2020-02-13T12:00:00Z", "yyyy-MM-ddThh:mm:ssZ" }, { "2020-02-13", "yyyy-MM-dd" } }; + QMap map = { { "2020-02-13T12:00:00Z", "yyyy-MM-ddThh:mm:ssZ" }, { "2020-02-13", "yyyy-MM-dd" }, { "2020", "yyyy" } }; QMapIterator iterator( map ); while ( iterator.hasNext() ) diff --git a/tests/src/providers/testqgswmsprovider.cpp b/tests/src/providers/testqgswmsprovider.cpp index 48ac8fa4df27..009603f9d405 100644 --- a/tests/src/providers/testqgswmsprovider.cpp +++ b/tests/src/providers/testqgswmsprovider.cpp @@ -569,7 +569,7 @@ void TestQgsWmsProvider::testResampling() QVERIFY( layer.dataProvider()->setZoomedInResamplingMethod( Qgis::RasterResamplingMethod::Cubic ) ); QVERIFY( layer.dataProvider()->setZoomedOutResamplingMethod( Qgis::RasterResamplingMethod::Cubic ) ); layer.setResamplingStage( Qgis::RasterResamplingStage::Provider ); - std::unique_ptr hillshade = std::make_unique( layer.dataProvider(), 1, 315, 45 ); + auto hillshade = std::make_unique( layer.dataProvider(), 1, 315, 45 ); hillshade->setZFactor( 0.0005 ); layer.setRenderer( hillshade.release() ); @@ -637,6 +637,12 @@ void TestQgsWmsProvider::testMaxTileSize() const QSize maxTileSize5 = provider5.maximumTileSize(); QCOMPARE( maxTileSize5.width(), 3000 ); QCOMPARE( maxTileSize5.height(), 3000 ); + + // test that max tile size is set to mStepWidth/mStepHeight if max tile size is not set + QgsWmsProvider provider6( QStringLiteral( "http://localhost:8380/mapserv?xxx&layers=buildings&styles=&format=image/jpg&stepWidth=4000&stepHeight=4000" ), QgsDataProvider::ProviderOptions(), &capabilities ); + const QSize maxTileSize6 = provider6.maximumTileSize(); + QCOMPARE( maxTileSize6.width(), 4000 ); + QCOMPARE( maxTileSize6.height(), 4000 ); } QGSTEST_MAIN( TestQgsWmsProvider ) diff --git a/tests/src/python/CMakeLists.txt b/tests/src/python/CMakeLists.txt index eb1a995bb715..1115a59495d6 100644 --- a/tests/src/python/CMakeLists.txt +++ b/tests/src/python/CMakeLists.txt @@ -127,6 +127,7 @@ ADD_PYTHON_TEST(PyQgsLayerMetadataProviderPython test_qgslayermetadataprovider_p ADD_PYTHON_TEST(PyQgsLayerMetadataProviderOgr test_qgslayermetadataprovider_ogr.py) ADD_PYTHON_TEST(PyQgsLayerTree test_qgslayertree.py) ADD_PYTHON_TEST(PyQgsLayerTreeFilterProxyModel test_qgslayertreefilterproxymodel.py) +ADD_PYTHON_TEST(PyQgsLayerTreeRegistryBridge test_qgslayertreeregistrybridge.py) ADD_PYTHON_TEST(PyQgsLayout test_qgslayout.py) ADD_PYTHON_TEST(PyQgsLayoutAlign test_qgslayoutaligner.py) ADD_PYTHON_TEST(PyQgsLayoutAtlas test_qgslayoutatlas.py) @@ -404,6 +405,7 @@ ADD_PYTHON_TEST(PyQgsAttributeEditorAction test_qgsattributeeditoraction.py) ADD_PYTHON_TEST(PyQgsVectorTile test_qgsvectortile.py) ADD_PYTHON_TEST(PyQgsVtpk test_qgsvtpk.py) ADD_PYTHON_TEST(PyQgsProcessingAlgsGdalGdalUtils test_processing_algs_gdal_gdalutils.py) +ADD_PYTHON_TEST(PyQgsInterpolation test_analysis_interpolation.py) if (NOT WIN32) ADD_PYTHON_TEST(PyQgsLogger test_qgslogger.py) diff --git a/tests/src/python/test_analysis_interpolation.py b/tests/src/python/test_analysis_interpolation.py new file mode 100644 index 000000000000..bf0bcfbd5407 --- /dev/null +++ b/tests/src/python/test_analysis_interpolation.py @@ -0,0 +1,143 @@ +""" +*************************************************************************** + test_analysis_interpolation.py + --------------------- + Date : January 2025 + Copyright : (C) 2025 by Alexander Bruy + Email : alexander dot bruy at gmail.com +*************************************************************************** +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +*************************************************************************** +""" + +__author__ = "Alexander Bruy" +__date__ = "January 2025" +__copyright__ = "(C) 2025, Alexander Bruy" + +import os +import math +import tempfile + +from qgis.core import ( + Qgis, + QgsCoordinateTransformContext, + QgsVectorLayer, + QgsRasterChecker, +) +from qgis.analysis import ( + QgsInterpolator, + QgsIDWInterpolator, + QgsTinInterpolator, + QgsGridFileWriter, +) + +import unittest +from qgis.testing import QgisTestCase + +from utilities import unitTestDataPath, start_app + +TEST_DATA_DIR = unitTestDataPath() +start_app() + + +class TestInterpolation(QgisTestCase): + + def __init__(self, methodName): + QgisTestCase.__init__(self, methodName) + self.report = "

Python Raster Analysis Interpolation Tests

\n" + + def test_idw_interpolator(self): + layer = QgsVectorLayer( + os.path.join(TEST_DATA_DIR, "points.shp"), "points", "ogr" + ) + self.assertTrue(layer.isValid()) + + pixel_size = 5 + extent = layer.extent() + context = QgsCoordinateTransformContext() + + cols = max(math.ceil(extent.width() / pixel_size), 1) + rows = max(math.ceil(extent.height() / pixel_size), 1) + + data = QgsInterpolator.LayerData() + data.source = layer + data.sourceType = QgsInterpolator.SourceType.SourcePoints + data.transformContext = context + data.valueSource = QgsInterpolator.ValueSource.ValueAttribute + data.interpolationAttribute = 3 + + interpolator = QgsIDWInterpolator([data]) + interpolator.setDistanceCoefficient(2.0) + + output_file = os.path.join(tempfile.gettempdir(), "idw_interpolation.tif") + + writer = QgsGridFileWriter(interpolator, output_file, extent, cols, rows) + writer.writeFile() + + checker = QgsRasterChecker() + ok = checker.runTest( + "gdal", + output_file, + "gdal", + os.path.join(TEST_DATA_DIR, "analysis", "idw_interpolation.tif"), + ) + self.report += checker.report() + + report_file = os.path.join(tempfile.gettempdir(), "idw_interpolation_test.html") + with open(report_file, "w", encoding="utf-8") as f: + f.write(self.report) + + self.assertTrue(ok) + + def test_tin_interpolator(self): + layer = QgsVectorLayer( + os.path.join(TEST_DATA_DIR, "points.shp"), "points", "ogr" + ) + self.assertTrue(layer.isValid()) + + pixel_size = 5 + extent = layer.extent() + context = QgsCoordinateTransformContext() + + cols = max(math.ceil(extent.width() / pixel_size), 1) + rows = max(math.ceil(extent.height() / pixel_size), 1) + + data = QgsInterpolator.LayerData() + data.source = layer + data.sourceType = QgsInterpolator.SourceType.SourcePoints + data.transformContext = context + data.valueSource = QgsInterpolator.ValueSource.ValueAttribute + data.interpolationAttribute = 3 + + interpolator = QgsTinInterpolator( + [data], QgsTinInterpolator.TinInterpolation.Linear + ) + + output_file = os.path.join(tempfile.gettempdir(), "tin_interpolation.tif") + + writer = QgsGridFileWriter(interpolator, output_file, extent, cols, rows) + writer.writeFile() + + checker = QgsRasterChecker() + ok = checker.runTest( + "gdal", + output_file, + "gdal", + os.path.join(TEST_DATA_DIR, "analysis", "tin_interpolation.tif"), + ) + self.report += checker.report() + + report_file = os.path.join(tempfile.gettempdir(), "tin_interpolation_test.html") + with open(report_file, "w", encoding="utf-8") as f: + f.write(self.report) + + self.assertTrue(ok) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/src/python/test_provider_memory.py b/tests/src/python/test_provider_memory.py index d4fbc466b279..b568f68828f4 100644 --- a/tests/src/python/test_provider_memory.py +++ b/tests/src/python/test_provider_memory.py @@ -15,6 +15,7 @@ from qgis.PyQt.QtCore import QByteArray, QDate, QDateTime, QTime, QVariant from qgis.core import ( NULL, + Qgis, QgsCoordinateReferenceSystem, QgsEditorWidgetSetup, QgsFeature, @@ -734,6 +735,44 @@ def testUniqueSource(self): layer2 = QgsVectorLayer("Point", "test2", "memory") self.assertNotEqual(layer.source(), layer2.source()) + def testAspatialLayerHasNoGeometryRelatedCapabilities(self): + + layer = QgsMemoryProviderUtils.createMemoryLayer("my name", QgsFields()) + self.assertTrue(layer.isValid()) + self.assertFalse(layer.isSpatial()) + self.assertFalse( + layer.dataProvider().capabilities() + & Qgis.VectorProviderCapability.ChangeGeometries + ) + self.assertFalse( + layer.dataProvider().capabilities() + & Qgis.VectorProviderCapability.CircularGeometries + ) + self.assertFalse( + layer.dataProvider().capabilities() + & Qgis.VectorProviderCapability.CreateSpatialIndex + ) + + def testSpatialLayerHasGeometryRelatedCapabilities(self): + + layer = QgsMemoryProviderUtils.createMemoryLayer( + "my name", QgsFields(), QgsWkbTypes.Type.Point + ) + self.assertTrue(layer.isValid()) + self.assertTrue(layer.isSpatial()) + self.assertTrue( + layer.dataProvider().capabilities() + & Qgis.VectorProviderCapability.ChangeGeometries + ) + self.assertTrue( + layer.dataProvider().capabilities() + & Qgis.VectorProviderCapability.CircularGeometries + ) + self.assertTrue( + layer.dataProvider().capabilities() + & Qgis.VectorProviderCapability.CreateSpatialIndex + ) + def testCreateMemoryLayer(self): """ Test QgsMemoryProviderUtils.createMemoryLayer() diff --git a/tests/src/python/test_provider_ogr.py b/tests/src/python/test_provider_ogr.py index 0f4a545ee261..cd6c58f9bb8e 100644 --- a/tests/src/python/test_provider_ogr.py +++ b/tests/src/python/test_provider_ogr.py @@ -174,7 +174,7 @@ def testMixOfPolygonCurvePolygon(self): self.assertEqual( vl.dataProvider().subLayers()[0], QgsDataProvider.SUBLAYER_SEPARATOR.join( - ["0", "testMixOfPolygonCurvePolygon", "4", "CurvePolygon", "", ""] + ["0", "testMixOfPolygonCurvePolygon", "4", "MultiSurface", "", ""] ), ) @@ -188,7 +188,6 @@ def testMixOfLineStringCompoundCurve(self): f.write('1,"LINESTRING(0 0,0 1)"\n') f.write('2,"COMPOUNDCURVE((0 0,0 1))"\n') f.write('3,"MULTILINESTRING((0 0,0 1))"\n') - f.write('4,"MULTICURVE((0 0,0 1))"\n') f.write('5,"CIRCULARSTRING(0 0,1 1,2 0)"\n') vl = QgsVectorLayer(f"{datasource}|layerid=0", "test", "ogr") @@ -197,7 +196,146 @@ def testMixOfLineStringCompoundCurve(self): self.assertEqual( vl.dataProvider().subLayers()[0], QgsDataProvider.SUBLAYER_SEPARATOR.join( - ["0", "testMixOfLineStringCompoundCurve", "5", "CompoundCurve", "", ""] + ["0", "testMixOfLineStringCompoundCurve", "4", "MultiCurve", "", ""] + ), + ) + + def testMixOfCurvePolygonAndMultiPolygon(self): + + datasource = os.path.join( + self.basetestpath, "testMixOfCurvePolygonAndMultiPolygon.csv" + ) + with open(datasource, "w") as f: + f.write("id,WKT\n") + f.write('1,"CURVEPOLYGON((0 0,0 1,1 1,0 0))"\n') + f.write('2,"MULTIPOLYGON(((0 0,0 1,1 1,0 0)))"\n') + + vl = QgsVectorLayer(f"{datasource}|layerid=0", "test", "ogr") + self.assertTrue(vl.isValid()) + self.assertEqual(len(vl.dataProvider().subLayers()), 1) + self.assertEqual( + vl.dataProvider().subLayers()[0], + QgsDataProvider.SUBLAYER_SEPARATOR.join( + [ + "0", + "testMixOfCurvePolygonAndMultiPolygon", + "2", + "MultiSurface", + "", + "", + ] + ), + ) + + def testMixOfLineStringAndCircularString(self): + + datasource = os.path.join( + self.basetestpath, "testMixOfLineStringAndCircularString.csv" + ) + with open(datasource, "w") as f: + f.write("id,WKT\n") + f.write('1,"LINESTRING(0 0,0 1)"\n') + f.write('2,"CIRCULARSTRING(0 0,1 1,2 0)"\n') + + vl = QgsVectorLayer(f"{datasource}|layerid=0", "test", "ogr") + self.assertTrue(vl.isValid()) + self.assertEqual(len(vl.dataProvider().subLayers()), 1) + self.assertEqual( + vl.dataProvider().subLayers()[0], + QgsDataProvider.SUBLAYER_SEPARATOR.join( + [ + "0", + "testMixOfLineStringAndCircularString", + "2", + "CompoundCurve", + "", + "", + ] + ), + ) + + def testMixOfLineStringAndCircularStringAndCompoundCurve(self): + + datasource = os.path.join( + self.basetestpath, + "testMixOfLineStringAndCircularStringAndCompoundCurve.csv", + ) + with open(datasource, "w") as f: + f.write("id,WKT\n") + f.write('1,"LINESTRING(0 0,0 1)"\n') + f.write('2,"CIRCULARSTRING(0 0,1 1,2 0)"\n') + f.write('3,"COMPOUNDCURVE((0 0,0 1))"\n') + + vl = QgsVectorLayer(f"{datasource}|layerid=0", "test", "ogr") + self.assertTrue(vl.isValid()) + self.assertEqual(len(vl.dataProvider().subLayers()), 1) + self.assertEqual( + vl.dataProvider().subLayers()[0], + QgsDataProvider.SUBLAYER_SEPARATOR.join( + [ + "0", + "testMixOfLineStringAndCircularStringAndCompoundCurve", + "3", + "CompoundCurve", + "", + "", + ] + ), + ) + + def testMixOfMultiLineStringAndCompoundCurve(self): + + datasource = os.path.join( + self.basetestpath, "testMixOfMultiLineStringAndCompoundCurve.csv" + ) + with open(datasource, "w") as f: + f.write("id,WKT\n") + f.write('1,"MULTILINESTRING((0 0,0 1))"\n') + f.write('2,"COMPOUNDCURVE((0 0,0 1))"\n') + + vl = QgsVectorLayer(f"{datasource}|layerid=0", "test", "ogr") + self.assertTrue(vl.isValid()) + self.assertEqual(len(vl.dataProvider().subLayers()), 1) + self.assertEqual( + vl.dataProvider().subLayers()[0], + QgsDataProvider.SUBLAYER_SEPARATOR.join( + [ + "0", + "testMixOfMultiLineStringAndCompoundCurve", + "2", + "MultiCurve", + "", + "", + ] + ), + ) + + def testMixOfMultiLineStringAndCompoundCurveAndMultiCurve(self): + + datasource = os.path.join( + self.basetestpath, + "testMixOfMultiLineStringAndCompoundCurveAndMultiCurve.csv", + ) + with open(datasource, "w") as f: + f.write("id,WKT\n") + f.write('1,"MULTILINESTRING((0 0,0 1))"\n') + f.write('2,"COMPOUNDCURVE((0 0,0 1))"\n') + f.write('3,"MULTICURVE((0 0,0 1))"\n') + + vl = QgsVectorLayer(f"{datasource}|layerid=0", "test", "ogr") + self.assertTrue(vl.isValid()) + self.assertEqual(len(vl.dataProvider().subLayers()), 1) + self.assertEqual( + vl.dataProvider().subLayers()[0], + QgsDataProvider.SUBLAYER_SEPARATOR.join( + [ + "0", + "testMixOfMultiLineStringAndCompoundCurveAndMultiCurve", + "3", + "MultiCurve", + "", + "", + ] ), ) @@ -2535,11 +2673,11 @@ def test_provider_sublayer_details(self): self.assertEqual( res[0].uri(), TEST_DATA_DIR - + "/multipatch.shp|geometrytype=Polygon25D|uniqueGeometryType=yes", + + "/multipatch.shp|geometrytype=MultiPolygon25D|uniqueGeometryType=yes", ) self.assertEqual(res[0].providerKey(), "ogr") self.assertEqual(res[0].type(), QgsMapLayerType.VectorLayer) - self.assertEqual(res[0].wkbType(), QgsWkbTypes.Type.PolygonZ) + self.assertEqual(res[0].wkbType(), QgsWkbTypes.Type.MultiPolygonZ) self.assertEqual(res[0].geometryColumnName(), "") self.assertEqual(res[0].driverName(), "ESRI Shapefile") @@ -3127,6 +3265,19 @@ def test_provider_sublayer_details(self): self.assertEqual(res[0].type(), QgsMapLayerType.VectorLayer) self.assertFalse(res[0].skippedContainerScan()) + res = metadata.querySublayers( + os.path.join(TEST_DATA_DIR, "mapinfo", "multipoly.tab"), + Qgis.SublayerQueryFlag.ResolveGeometryType, + ) + self.assertEqual(len(res), 1) + self.assertEqual(res[0].wkbType(), QgsWkbTypes.MultiPolygon) + layer = res[0].toLayer(options) + self.assertTrue(layer.isValid()) + self.assertEqual(layer.wkbType(), QgsWkbTypes.MultiPolygon) + # Check feature geometries + for feature in layer.getFeatures(): + self.assertEqual(feature.geometry().wkbType(), QgsWkbTypes.MultiPolygon) + @unittest.skipIf( int(gdal.VersionInfo("VERSION_NUM")) < GDAL_COMPUTE_VERSION(3, 4, 0), "GDAL 3.4 required", diff --git a/tests/src/python/test_provider_ogr_gpkg.py b/tests/src/python/test_provider_ogr_gpkg.py index cd81a16685c0..fce54b22fb99 100644 --- a/tests/src/python/test_provider_ogr_gpkg.py +++ b/tests/src/python/test_provider_ogr_gpkg.py @@ -1269,6 +1269,8 @@ def testSublayerWithComplexLayerName(self): f.SetGeometry(ogr.CreateGeometryFromWkt("POINT(0 0)")) lyr.CreateFeature(f) f = None + del lyr + del ds vl = QgsVectorLayer(f"{tmpfile}", "layer", "ogr") self.assertEqual(1, vl.dataProvider().subLayerCount()) @@ -3233,10 +3235,10 @@ def testCurveGeometryTypeInUnknownTypeLayer(self): vl.dataProvider().subLayers(), [ QgsDataProvider.SUBLAYER_SEPARATOR.join( - ["0", "test", "4", "CompoundCurve", "geom", ""] + ["0", "test", "2", "CurvePolygon", "geom", ""] ), QgsDataProvider.SUBLAYER_SEPARATOR.join( - ["0", "test", "2", "CurvePolygon", "geom", ""] + ["0", "test", "4", "MultiCurve", "geom", ""] ), ], ) @@ -3699,6 +3701,8 @@ def testQueryLayers(self): f.SetGeometry(ogr.CreateGeometryFromWkt("POINT(3 4)")) lyr.CreateFeature(f) f = None + del lyr + ds.FlushCache() vl = QgsVectorLayer(filename + "|layername=points") self.assertTrue(vl.isValid()) @@ -3714,7 +3718,7 @@ def testQueryLayers(self): f.SetGeometry(ogr.CreateGeometryFromWkt("LINESTRING(1 2, 3 4)")) lyr.CreateFeature(f) f = None - ds = None + ds.FlushCache() vl = QgsVectorLayer(filename + "|layername=lines") self.assertEqual(vl.geometryType(), Qgis.GeometryType.Line) diff --git a/tests/src/python/test_provider_oracle.py b/tests/src/python/test_provider_oracle.py index b9d6a9590162..c7e8dce1ec09 100644 --- a/tests/src/python/test_provider_oracle.py +++ b/tests/src/python/test_provider_oracle.py @@ -214,15 +214,6 @@ def testAddFeatureWrongGeomType(self): """ pass - def testCrs(self): - """ - We override this test for Oracle provider, because without PROJ >= 7 - Oracle is not able to understand correctly some EPSG code (4326 for instance) - """ - # TODO remove this when PROJ will be >= 7 - if QgsProjUtils.projVersionMajor() >= 7: - super().testCrs() - # HERE GO THE PROVIDER SPECIFIC TESTS def testDateTimeTypes(self): vl = QgsVectorLayer( @@ -1710,10 +1701,7 @@ def testCreateEmptyLayer(self): ) self.assertTrue(query.next()) self.assertEqual(query.value(0), "GEOM") - # Cannot work with proj version < 7 because it cannot identify properly EPSG:4326 - # TODO remove this when PROJ will be >= 7 - if QgsProjUtils.projVersionMajor() >= 7: - self.assertEqual(query.value(1), 4326) + self.assertEqual(query.value(1), 4326) query.finish() # no feature, so we cannot guess the geometry type, so the layer is not valid @@ -1746,10 +1734,7 @@ def testCreateEmptyLayer(self): query.exec('SELECT "l"."GEOM"."SDO_SRID" from "QGIS"."EMPTY_LAYER" "l"') ) self.assertTrue(query.next()) - # Cannot work with proj version < 7 because it cannot identify properly EPSG:4326 - # TODO remove this when PROJ will be >= 7 - if QgsProjUtils.projVersionMajor() >= 7: - self.assertEqual(query.value(0), 4326) + self.assertEqual(query.value(0), 4326) query.finish() # now we can autodetect geom type and srid @@ -1759,10 +1744,7 @@ def testCreateEmptyLayer(self): "oracle", ) self.assertTrue(vl.isValid()) - # Cannot work with proj version < 7 because it cannot identify properly EPSG:4326 - # TODO remove this when PROJ will be >= 7 - if QgsProjUtils.projVersionMajor() >= 7: - self.assertEqual(vl.sourceCrs().authid(), "EPSG:4326") + self.assertEqual(vl.sourceCrs().authid(), "EPSG:4326") def testCreateAspatialLayer(self): """ diff --git a/tests/src/python/test_provider_postgresraster.py b/tests/src/python/test_provider_postgresraster.py index 940429c60a18..5ecd291fd0ac 100644 --- a/tests/src/python/test_provider_postgresraster.py +++ b/tests/src/python/test_provider_postgresraster.py @@ -1012,6 +1012,168 @@ def testBlockSize(self): self.assertEqual(dp.xBlockSize(), 2) self.assertEqual(dp.yBlockSize(), 2) + def testStyle(self): + rl = QgsRasterLayer( + self.dbconn + + ' sslmode=disable srid=3035 table="public"."raster_tiled_3035" sql=', + "test", + "postgresraster", + ) + + self.assertTrue(rl.isValid()) + + self.assertEqual( + int(rl.dataProvider().styleStorageCapabilities()) + & Qgis.ProviderStyleStorageCapability.LoadFromDatabase, + Qgis.ProviderStyleStorageCapability.LoadFromDatabase, + ) + self.assertEqual( + int(rl.dataProvider().styleStorageCapabilities()) + & Qgis.ProviderStyleStorageCapability.SaveToDatabase, + Qgis.ProviderStyleStorageCapability.SaveToDatabase, + ) + self.assertEqual( + int(rl.dataProvider().styleStorageCapabilities()) + & Qgis.ProviderStyleStorageCapability.DeleteFromDatabase, + Qgis.ProviderStyleStorageCapability.DeleteFromDatabase, + ) + + # not style yet for layer + res, err = QgsProviderRegistry.instance().styleExists( + "postgresraster", rl.source(), "" + ) + self.assertFalse(res) + self.assertFalse(err) + + related_count, idlist, namelist, desclist, errmsg = rl.listStylesInDatabase() + self.assertEqual(related_count, -1) + self.assertEqual(idlist, []) + self.assertEqual(namelist, []) + self.assertEqual(desclist, []) + self.assertFalse(errmsg) + + # Save style twice, one as as default + errmsg = rl.saveStyleToDatabase("related raster style", "test style", False, "") + self.assertEqual(errmsg, "") + + related_count, idlist, namelist, desclist, errmsg = rl.listStylesInDatabase() + self.assertEqual(related_count, 1) + self.assertEqual(idlist, ["1"]) + self.assertEqual(namelist, ["related raster style"]) + self.assertEqual(desclist, ["test style"]) + self.assertFalse(errmsg) + + errmsg = rl.saveStyleToDatabase( + "related raster style default", "default test style", True, "" + ) + self.assertEqual(errmsg, "") + + # check style exist + res, err = QgsProviderRegistry.instance().styleExists( + "postgresraster", rl.source(), "related raster style default" + ) + self.assertTrue(res) + self.assertFalse(err) + + qml, errmsg = rl.getStyleFromDatabase("2") + self.assertTrue(qml) + self.assertEqual(errmsg, "") + + related_count, idlist, namelist, desclist, errmsg = rl.listStylesInDatabase() + self.assertEqual(related_count, 2) + self.assertEqual(idlist, ["2", "1"]) + self.assertEqual( + namelist, ["related raster style default", "related raster style"] + ) + self.assertEqual(desclist, ["default test style", "test style"]) + self.assertFalse(errmsg) + + # Remove these style + res, errmsg = rl.deleteStyleFromDatabase("1") + self.assertTrue(res) + self.assertFalse(errmsg) + + related_count, idlist, namelist, desclist, errmsg = rl.listStylesInDatabase() + self.assertEqual(related_count, 1) + self.assertEqual(idlist, ["2"]) + self.assertEqual(namelist, ["related raster style default"]) + self.assertEqual(desclist, ["default test style"]) + self.assertFalse(errmsg) + + # Raster layer with defined column + rl_1 = QgsRasterLayer( + self.dbconn + + ' sslmode=disable srid=3035 table="public"."raster_tiled_3035" (rast) sql=', + "test", + "postgresraster", + ) + + self.assertTrue(rl_1.isValid()) + + # not style yet for layer + res, err = QgsProviderRegistry.instance().styleExists( + "postgresraster", rl_1.source(), "" + ) + self.assertFalse(res) + self.assertFalse(err) + + related_count, idlist, namelist, desclist, errmsg = rl_1.listStylesInDatabase() + self.assertEqual(related_count, 0) + self.assertEqual(idlist, []) + self.assertEqual(namelist, []) + self.assertEqual(desclist, []) + self.assertFalse(errmsg) + + # Save style twice, one as as default + errmsg = rl_1.saveStyleToDatabase( + "related raster style", "test style", False, "" + ) + self.assertEqual(errmsg, "") + + related_count, idlist, namelist, desclist, errmsg = rl_1.listStylesInDatabase() + self.assertEqual(related_count, 1) + self.assertEqual(idlist, ["3"]) + self.assertEqual(namelist, ["related raster style"]) + self.assertEqual(desclist, ["test style"]) + self.assertFalse(errmsg) + + errmsg = rl_1.saveStyleToDatabase( + "related raster style default", "default test style", True, "" + ) + self.assertEqual(errmsg, "") + + # check style exist + res, err = QgsProviderRegistry.instance().styleExists( + "postgresraster", rl_1.source(), "related raster style default" + ) + self.assertTrue(res) + self.assertFalse(err) + + qml, errmsg = rl_1.getStyleFromDatabase("3") + self.assertTrue(qml) + self.assertEqual(errmsg, "") + + related_count, idlist, namelist, desclist, errmsg = rl_1.listStylesInDatabase() + self.assertEqual(related_count, 2) + self.assertEqual(idlist, ["4", "3"]) + self.assertEqual( + namelist, ["related raster style default", "related raster style"] + ) + self.assertEqual(desclist, ["default test style", "test style"]) + self.assertFalse(errmsg) + + # Remove these style + res, errmsg = rl_1.deleteStyleFromDatabase("3") + self.assertTrue(res) + self.assertFalse(errmsg) + + related_count, idlist, namelist, desclist, errmsg = rl_1.listStylesInDatabase() + self.assertEqual(related_count, 1) + self.assertEqual(idlist, ["4"]) + self.assertEqual(namelist, ["related raster style default"]) + self.assertEqual(desclist, ["default test style"]) + self.assertFalse(errmsg) + if __name__ == "__main__": unittest.main() diff --git a/tests/src/python/test_provider_sensorthings.py b/tests/src/python/test_provider_sensorthings.py index 0f27a5bf98d1..d2566410917c 100644 --- a/tests/src/python/test_provider_sensorthings.py +++ b/tests/src/python/test_provider_sensorthings.py @@ -567,6 +567,47 @@ def test_expansions_as_query_string(self): "$expand=Things($orderby=id;$top=3;$expand=Datastreams($orderby=description;$top=30;$expand=ObservedProperty($orderby=name)))", ) + def test_fields_for_entity_type(self): + """ + Test calculating fields for an entity type. + """ + fields = QgsSensorThingsUtils.fieldsForEntityType( + Qgis.SensorThingsEntity.Datastream + ) + self.assertEqual( + [field.name() for field in fields], + [ + "id", + "selfLink", + "name", + "description", + "unitOfMeasurement", + "observationType", + "properties", + "phenomenonTimeStart", + "phenomenonTimeEnd", + "resultTimeStart", + "resultTimeEnd", + ], + ) + + # hide proxy fields for missing interval field type + fields = QgsSensorThingsUtils.fieldsForEntityType( + Qgis.SensorThingsEntity.Datastream, False + ) + self.assertEqual( + [field.name() for field in fields], + [ + "id", + "selfLink", + "name", + "description", + "unitOfMeasurement", + "observationType", + "properties", + ], + ) + def test_fields_for_expanded_entity(self): """ Test calculating fields for an expanded entity @@ -636,6 +677,7 @@ def test_expandable_targets(self): [ Qgis.SensorThingsEntity.HistoricalLocation, Qgis.SensorThingsEntity.Datastream, + Qgis.SensorThingsEntity.MultiDatastream, ], ) @@ -2584,7 +2626,7 @@ def test_datastream(self): ) vl = QgsVectorLayer( - f"url='http://{endpoint}' pageSize=2 type=PointZ entity='Datastream'", + f"url='http://{endpoint}' pageSize=2 type=NoGeometry entity='Datastream'", "test", "sensorthings", ) diff --git a/tests/src/python/test_provider_wfs.py b/tests/src/python/test_provider_wfs.py index bc385e4f3880..b99d116c2765 100644 --- a/tests/src/python/test_provider_wfs.py +++ b/tests/src/python/test_provider_wfs.py @@ -695,6 +695,7 @@ def testWFS10(self): ) self.assertTrue(vl.isValid()) self.assertEqual(vl.wkbType(), QgsWkbTypes.Type.Point) + self.assertEqual(vl.dataProvider().geometryColumnName(), "geometry") self.assertEqual(len(vl.fields()), 5) self.assertEqual(vl.featureCount(), 0) reference = QgsGeometry.fromRect( @@ -4037,18 +4038,11 @@ def testGeomedia(self): self.assertEqual(vl.wkbType(), QgsWkbTypes.Type.MultiPolygon) # Extent before downloading features - reference = QgsGeometry.fromRect( - QgsRectangle( - 243900.3520259926444851, - 4427769.1559739429503679, - 1525592.3040170343592763, - 5607994.6020106188952923, - ) - ) - vl_extent = QgsGeometry.fromRect(vl.extent()) - assert QgsGeometry.compare( - vl_extent.asPolygon()[0], reference.asPolygon()[0], 0.05 - ), f"Expected {reference.asWkt()}, got {vl_extent.asWkt()}" + vl_extent = vl.extent() + self.assertAlmostEqual(vl_extent.xMinimum(), 243900, 0) + self.assertAlmostEqual(vl_extent.yMinimum(), 4427769, -2) + self.assertAlmostEqual(vl_extent.xMaximum(), 1525592, 0) + self.assertAlmostEqual(vl_extent.yMaximum(), 5607995, 0) # Download all features features = [f for f in vl.getFeatures()] @@ -4058,10 +4052,12 @@ def testGeomedia(self): # Let signals to be notified to QgsVectorLayer loop = QEventLoop() loop.processEvents() - vl_extent = QgsGeometry.fromRect(vl.extent()) - assert QgsGeometry.compare( - vl_extent.asPolygon()[0], reference.asPolygon()[0], 0.00001 - ), f"Expected {reference.asWkt()}, got {vl_extent.asWkt()}" + vl_extent = vl.extent() + self.assertAlmostEqual(vl_extent.xMinimum(), 500000, 3) + self.assertAlmostEqual(vl_extent.yMinimum(), 4500000, 3) + self.assertAlmostEqual(vl_extent.xMaximum(), 510000, 3) + self.assertAlmostEqual(vl_extent.yMaximum(), 4510000, 3) + self.assertEqual(features[0]["intfield"], 1) self.assertEqual(features[1]["intfield"], 2) diff --git a/tests/src/python/test_qgscategorizedsymbolrenderer.py b/tests/src/python/test_qgscategorizedsymbolrenderer.py index 3cb84fd7b5a1..b66c2097439b 100644 --- a/tests/src/python/test_qgscategorizedsymbolrenderer.py +++ b/tests/src/python/test_qgscategorizedsymbolrenderer.py @@ -29,6 +29,7 @@ QgsLineSymbol, QgsMapSettings, QgsMarkerSymbol, + QgsMaskMarkerSymbolLayer, QgsProject, QgsProperty, QgsReadWriteContext, @@ -36,9 +37,11 @@ QgsRenderContext, QgsRendererCategory, QgsSimpleMarkerSymbolLayer, + QgsSingleSymbolRenderer, QgsStyle, QgsSymbol, QgsSymbolLayer, + QgsSymbolLayerReference, QgsVectorLayer, ) import unittest @@ -815,6 +818,36 @@ def testConvertFromEmbedded(self): self.assertEqual(cc.label(), "") self.assertEqual(cc.symbol().color().name(), "#ff00ff") + def testConvertNoMasks(self): + """ + Test converting an embedded symbol renderer to a categorized renderer + """ + points_layer = QgsVectorLayer("Point", "Polys", "memory") + f = QgsFeature() + f.setGeometry(QgsGeometry.fromWkt("Point(-100 30)")) + self.assertTrue(points_layer.dataProvider().addFeature(f)) + f.setGeometry(QgsGeometry.fromWkt("Point(-110 40)")) + self.assertTrue(points_layer.dataProvider().addFeature(f)) + f.setGeometry(QgsGeometry.fromWkt("Point(-90 50)")) + self.assertTrue(points_layer.dataProvider().addFeature(f)) + + p = QgsMarkerSymbol.createSimple({"color": "#fdbf6f", "size": "7"}) + points_layer.setRenderer(QgsSingleSymbolRenderer(p)) + + circle_symbol = QgsMarkerSymbol.createSimple({"size": "10"}) + mask_layer = QgsMaskMarkerSymbolLayer() + mask_layer.setSubSymbol(circle_symbol) + mask_layer.setMasks( + [QgsSymbolLayerReference("test_layer_id", "test_symbollayer_id")] + ) + points_layer.renderer().symbol().appendSymbolLayer(mask_layer) + + categorized = QgsCategorizedSymbolRenderer.convertFromRenderer( + points_layer.renderer(), points_layer + ) + + self.assertFalse(categorized.sourceSymbol().symbolLayers()[1].masks()) + def test_displayString(self): """Test the displayString method""" diff --git a/tests/src/python/test_qgsdatumtransforms.py b/tests/src/python/test_qgsdatumtransforms.py index 877d8b919290..0b3e92aaf687 100644 --- a/tests/src/python/test_qgsdatumtransforms.py +++ b/tests/src/python/test_qgsdatumtransforms.py @@ -98,170 +98,83 @@ def testOperations(self): self.assertEqual(ops[op1_index].accuracy, 0.01) self.assertEqual(len(ops[op1_index].grids), 0) - if QgsProjUtils.projVersionMajor() == 6: - op2_index = [ - i - for i in range(len(ops)) - if ops[i].proj - == "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_and_distortion.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg" - ][0] - else: - op2_index = [ - i - for i in range(len(ops)) - if ops[i].proj - == "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_and_distortion.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg" - ][0] + op2_index = [ + i + for i in range(len(ops)) + if ops[i].proj + == "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_and_distortion.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg" + ][0] self.assertTrue(ops[op2_index].name) - if QgsProjUtils.projVersionMajor() == 6: - self.assertEqual( - ops[op2_index].proj, - "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_and_distortion.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg", - ) - else: - self.assertEqual( - ops[op2_index].proj, - "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_and_distortion.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg", - ) + self.assertEqual( + ops[op2_index].proj, + "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_and_distortion.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg", + ) self.assertEqual(ops[op2_index].accuracy, 0.05) self.assertEqual(len(ops[op2_index].grids), 1) - if QgsProjUtils.projVersionMajor() == 6: - self.assertEqual( - ops[op2_index].grids[0].shortName, - "GDA94_GDA2020_conformal_and_distortion.gsb", - ) - else: - self.assertEqual( - ops[op2_index].grids[0].shortName, - "au_icsm_GDA94_GDA2020_conformal_and_distortion.tif", - ) - if QgsProjUtils.projVersionMajor() == 6: - self.assertTrue(ops[op2_index].grids[0].packageName) + self.assertEqual( + ops[op2_index].grids[0].shortName, + "au_icsm_GDA94_GDA2020_conformal_and_distortion.tif", + ) self.assertIn("http", ops[op2_index].grids[0].url) self.assertTrue(ops[op2_index].grids[0].directDownload) self.assertTrue(ops[op2_index].grids[0].openLicense) - if QgsProjUtils.projVersionMajor() == 6: - op3_index = [ - i - for i in range(len(ops)) - if ops[i].proj - == "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg" - ][0] - else: - op3_index = [ - i - for i in range(len(ops)) - if ops[i].proj - == "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg" - ][0] + op3_index = [ + i + for i in range(len(ops)) + if ops[i].proj + == "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg" + ][0] self.assertTrue(ops[op3_index].name) - if QgsProjUtils.projVersionMajor() == 6: - self.assertEqual( - ops[op3_index].proj, - "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg", - ) - else: - self.assertEqual( - ops[op3_index].proj, - "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg", - ) + self.assertEqual( + ops[op3_index].proj, + "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg", + ) self.assertEqual(ops[op3_index].accuracy, 0.05) self.assertEqual(len(ops[op3_index].grids), 1) - if QgsProjUtils.projVersionMajor() == 6: - self.assertEqual( - ops[op3_index].grids[0].shortName, "GDA94_GDA2020_conformal.gsb" - ) - else: - self.assertEqual( - ops[op3_index].grids[0].shortName, "au_icsm_GDA94_GDA2020_conformal.tif" - ) - if QgsProjUtils.projVersionMajor() == 6: - self.assertTrue(ops[op3_index].grids[0].packageName) + self.assertEqual( + ops[op3_index].grids[0].shortName, "au_icsm_GDA94_GDA2020_conformal.tif" + ) self.assertIn("http", ops[op3_index].grids[0].url) self.assertTrue(ops[op3_index].grids[0].directDownload) self.assertTrue(ops[op3_index].grids[0].openLicense) - if QgsProjUtils.projVersionMajor() == 6: - op4_index = [ - i - for i in range(len(ops)) - if ops[i].proj - == "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_cocos_island.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg" - ][0] - else: - op4_index = [ - i - for i in range(len(ops)) - if ops[i].proj - == "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_cocos_island.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg" - ][0] + op4_index = [ + i + for i in range(len(ops)) + if ops[i].proj + == "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_cocos_island.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg" + ][0] self.assertTrue(ops[op4_index].name) - if QgsProjUtils.projVersionMajor() == 6: - self.assertEqual( - ops[op4_index].proj, - "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_cocos_island.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg", - ) - else: - self.assertEqual( - ops[op4_index].proj, - "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_cocos_island.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg", - ) + self.assertEqual( + ops[op4_index].proj, + "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_cocos_island.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg", + ) self.assertEqual(ops[op4_index].accuracy, 0.05) self.assertEqual(len(ops[op4_index].grids), 1) - if QgsProjUtils.projVersionMajor() == 6: - self.assertEqual( - ops[op4_index].grids[0].shortName, - "GDA94_GDA2020_conformal_cocos_island.gsb", - ) - else: - self.assertEqual( - ops[op4_index].grids[0].shortName, - "au_icsm_GDA94_GDA2020_conformal_cocos_island.tif", - ) - if QgsProjUtils.projVersionMajor() == 6: - self.assertTrue(ops[op4_index].grids[0].packageName) + self.assertEqual( + ops[op4_index].grids[0].shortName, + "au_icsm_GDA94_GDA2020_conformal_cocos_island.tif", + ) self.assertIn("http", ops[op4_index].grids[0].url) - if QgsProjUtils.projVersionMajor() == 6: - op5_index = [ - i - for i in range(len(ops)) - if ops[i].proj - == "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_christmas_island.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg" - ][0] - else: - op5_index = [ - i - for i in range(len(ops)) - if ops[i].proj - == "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_christmas_island.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg" - ][0] + op5_index = [ + i + for i in range(len(ops)) + if ops[i].proj + == "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_christmas_island.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg" + ][0] self.assertTrue(ops[op5_index].name) - if QgsProjUtils.projVersionMajor() == 6: - self.assertEqual( - ops[op5_index].proj, - "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_christmas_island.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg", - ) - else: - self.assertEqual( - ops[op5_index].proj, - "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_christmas_island.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg", - ) + self.assertEqual( + ops[op5_index].proj, + "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_christmas_island.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg", + ) self.assertEqual(ops[op5_index].accuracy, 0.05) self.assertEqual(len(ops[op5_index].grids), 1) - if QgsProjUtils.projVersionMajor() == 6: - self.assertEqual( - ops[op5_index].grids[0].shortName, - "GDA94_GDA2020_conformal_christmas_island.gsb", - ) - else: - self.assertEqual( - ops[op5_index].grids[0].shortName, - "au_icsm_GDA94_GDA2020_conformal_christmas_island.tif", - ) - if QgsProjUtils.projVersionMajor() == 6: - self.assertTrue(ops[op5_index].grids[0].packageName) + self.assertEqual( + ops[op5_index].grids[0].shortName, + "au_icsm_GDA94_GDA2020_conformal_christmas_island.tif", + ) self.assertIn("http", ops[op5_index].grids[0].url) # uses a pivot datum (technically a proj test, but this will help me sleep at night ;) @@ -287,86 +200,43 @@ def testOperations(self): self.assertEqual(ops[op1_index].accuracy, 0.01) self.assertEqual(len(ops[op1_index].grids), 0) - if QgsProjUtils.projVersionMajor() == 6: - op2_index = [ - i - for i in range(len(ops)) - if ops[i].proj - == "+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_and_distortion.gsb +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80" - ][0] - else: - op2_index = [ - i - for i in range(len(ops)) - if ops[i].proj - == "+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_and_distortion.tif +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80" - ][0] + op2_index = [ + i + for i in range(len(ops)) + if ops[i].proj + == "+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_and_distortion.tif +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80" + ][0] self.assertTrue(ops[op2_index].name) - if QgsProjUtils.projVersionMajor() == 6: - self.assertEqual( - ops[op2_index].proj, - "+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_and_distortion.gsb +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80", - ) - else: - self.assertEqual( - ops[op2_index].proj, - "+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_and_distortion.tif +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80", - ) + self.assertEqual( + ops[op2_index].proj, + "+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_and_distortion.tif +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80", + ) self.assertEqual(ops[op2_index].accuracy, 0.05) self.assertEqual(len(ops[op2_index].grids), 1) - if QgsProjUtils.projVersionMajor() == 6: - self.assertEqual( - ops[op2_index].grids[0].shortName, - "GDA94_GDA2020_conformal_and_distortion.gsb", - ) - else: - self.assertEqual( - ops[op2_index].grids[0].shortName, - "au_icsm_GDA94_GDA2020_conformal_and_distortion.tif", - ) - if QgsProjUtils.projVersionMajor() == 6: - self.assertTrue(ops[op2_index].grids[0].packageName) + self.assertEqual( + ops[op2_index].grids[0].shortName, + "au_icsm_GDA94_GDA2020_conformal_and_distortion.tif", + ) self.assertIn("http", ops[op2_index].grids[0].url) self.assertTrue(ops[op2_index].grids[0].directDownload) self.assertTrue(ops[op2_index].grids[0].openLicense) - if QgsProjUtils.projVersionMajor() == 6: - op3_index = [ - i - for i in range(len(ops)) - if ops[i].proj - == "+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=GDA94_GDA2020_conformal.gsb +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80" - ][0] - else: - op3_index = [ - i - for i in range(len(ops)) - if ops[i].proj - == "+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal.tif +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80" - ][0] + op3_index = [ + i + for i in range(len(ops)) + if ops[i].proj + == "+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal.tif +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80" + ][0] self.assertTrue(ops[op3_index].name) - if QgsProjUtils.projVersionMajor() == 6: - self.assertEqual( - ops[op3_index].proj, - "+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=GDA94_GDA2020_conformal.gsb +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80", - ) - else: - self.assertEqual( - ops[op3_index].proj, - "+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal.tif +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80", - ) + self.assertEqual( + ops[op3_index].proj, + "+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal.tif +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80", + ) self.assertEqual(ops[op3_index].accuracy, 0.05) self.assertEqual(len(ops[op3_index].grids), 1) - if QgsProjUtils.projVersionMajor() == 6: - self.assertEqual( - ops[op3_index].grids[0].shortName, "GDA94_GDA2020_conformal.gsb" - ) - else: - self.assertEqual( - ops[op3_index].grids[0].shortName, "au_icsm_GDA94_GDA2020_conformal.tif" - ) - if QgsProjUtils.projVersionMajor() == 6: - self.assertTrue(ops[op3_index].grids[0].packageName) + self.assertEqual( + ops[op3_index].grids[0].shortName, "au_icsm_GDA94_GDA2020_conformal.tif" + ) self.assertIn("http", ops[op3_index].grids[0].url) self.assertTrue(ops[op3_index].grids[0].directDownload) self.assertTrue(ops[op3_index].grids[0].openLicense) @@ -393,7 +263,6 @@ def testNoLasLos(self): self.assertTrue(ops[1].name) self.assertTrue(ops[1].proj) - @unittest.skipIf(QgsProjUtils.projVersionMajor() < 8, "Not a proj >= 8 build") def testDatumEnsembles(self): """ Test datum ensemble details diff --git a/tests/src/python/test_qgsellipsoidutils.py b/tests/src/python/test_qgsellipsoidutils.py index 250318fb1939..d07b64beac41 100644 --- a/tests/src/python/test_qgsellipsoidutils.py +++ b/tests/src/python/test_qgsellipsoidutils.py @@ -11,7 +11,7 @@ __copyright__ = "Copyright 2017, The QGIS Project" -from qgis.core import QgsEllipsoidUtils, QgsProjUtils +from qgis.core import QgsEllipsoidUtils import unittest from qgis.testing import start_app, QgisTestCase @@ -105,11 +105,7 @@ def testDefinitions(self): self.assertEqual(gany_defs.acronym, gany_id) self.assertEqual(gany_defs.description, "Ganymede 2000 IAU IAG (ESRI:107916)") - if QgsProjUtils.projVersionMajor() > 8 or ( - QgsProjUtils.projVersionMajor() == 8 - and QgsProjUtils.projVersionMinor() >= 1 - ): - self.assertEqual(gany_defs.celestialBodyName, "Ganymede") + self.assertEqual(gany_defs.celestialBodyName, "Ganymede") self.assertTrue(gany_defs.parameters.valid) self.assertEqual(gany_defs.parameters.semiMajor, 2632345.0) @@ -118,13 +114,6 @@ def testDefinitions(self): self.assertFalse(gany_defs.parameters.useCustomParameters) self.assertEqual(gany_defs.parameters.crs.authid(), "") - @unittest.skipIf( - QgsProjUtils.projVersionMajor() < 8 - or ( - QgsProjUtils.projVersionMajor() == 8 and QgsProjUtils.projVersionMinor() < 1 - ), - "Not a proj >= 8.1 build", - ) def testCelestialBodies(self): bodies = QgsEllipsoidUtils.celestialBodies() diff --git a/tests/src/python/test_qgslayertreeregistrybridge.py b/tests/src/python/test_qgslayertreeregistrybridge.py new file mode 100644 index 000000000000..611311634929 --- /dev/null +++ b/tests/src/python/test_qgslayertreeregistrybridge.py @@ -0,0 +1,62 @@ +"""QGIS Unit tests for QgsLayerTreeRegistryBridge + +.. note:: This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. +""" + +__author__ = "Jean Felder" +__date__ = "05/02/2025" +__copyright__ = "Copyright 2025, The QGIS Project" + +from qgis.core import ( + QgsLayerTreeRegistryBridge, + QgsLayerTree, + QgsProject, + QgsLayerTreeGroup, +) + +import unittest +from qgis.testing import start_app, QgisTestCase + +start_app() + + +class TestQgsLayerTreeRegistryBridge(QgisTestCase): + + def test_constructor(self): + project = QgsProject() + root_group = QgsLayerTree() + bridge = QgsLayerTreeRegistryBridge(root_group, project) + + self.assertTrue(bridge.isEnabled()) + self.assertTrue(bridge.newLayersVisible()) + self.assertEqual(bridge.layerInsertionPoint().group, root_group) + self.assertEqual(bridge.layerInsertionPoint().position, 0) + + def test_insertion_point(self): + project = QgsProject() + root_group = QgsLayerTree() + bridge = QgsLayerTreeRegistryBridge(root_group, project) + + self.assertEqual(bridge.layerInsertionPoint().group, root_group) + self.assertEqual(bridge.layerInsertionPoint().position, 0) + + group_node = QgsLayerTreeGroup() + root_group.addChildNode(group_node) + bridge.setLayerInsertionPoint( + QgsLayerTreeRegistryBridge.InsertionPoint(group_node, 4) + ) + self.assertEqual(bridge.layerInsertionPoint().group, group_node) + self.assertEqual(bridge.layerInsertionPoint().position, 4) + + bridge.setLayerInsertionPoint( + QgsLayerTreeRegistryBridge.InsertionPoint(root_group, 0) + ) + self.assertEqual(bridge.layerInsertionPoint().group, root_group) + self.assertEqual(bridge.layerInsertionPoint().position, 0) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/src/python/test_qgsmesh3dsymbol.py b/tests/src/python/test_qgsmesh3dsymbol.py index 5f4fab240e37..e527bce5e434 100644 --- a/tests/src/python/test_qgsmesh3dsymbol.py +++ b/tests/src/python/test_qgsmesh3dsymbol.py @@ -38,9 +38,9 @@ def test_getters_and_setters(self): self.assertEqual(symbol.cullingMode(), Qgs3DTypes.Front) # Test altitude clamping - self.assertEqual(symbol.altitudeClamping(), Qgis.AltitudeClamping.Relative) - symbol.setAltitudeClamping(Qgis.AltitudeClamping.Absolute) self.assertEqual(symbol.altitudeClamping(), Qgis.AltitudeClamping.Absolute) + symbol.setAltitudeClamping(Qgis.AltitudeClamping.Relative) + self.assertEqual(symbol.altitudeClamping(), Qgis.AltitudeClamping.Relative) # Test height self.assertEqual(symbol.height(), 0.0) @@ -152,9 +152,9 @@ def test_equality(self): self.assertEqual(symbol1, symbol2) # Test altitude clamping - symbol2.setAltitudeClamping(Qgis.AltitudeClamping.Absolute) - self.assertNotEqual(symbol1, symbol2) symbol2.setAltitudeClamping(Qgis.AltitudeClamping.Relative) + self.assertNotEqual(symbol1, symbol2) + symbol2.setAltitudeClamping(Qgis.AltitudeClamping.Absolute) self.assertEqual(symbol1, symbol2) # Test height diff --git a/tests/src/python/test_qgsproviderconnection_base.py b/tests/src/python/test_qgsproviderconnection_base.py index f1d38563af77..ea0c44dc870e 100644 --- a/tests/src/python/test_qgsproviderconnection_base.py +++ b/tests/src/python/test_qgsproviderconnection_base.py @@ -783,6 +783,14 @@ def testCreateSqlVectorLayer(self): self.assertEqual(vl.name(), options.layerName) self.assertEqual(vl.sourceCrs().authid(), crs) + # Test issue https://github.com/qgis/QGIS/issues/56993 + options.sql += ";;;" + vl2 = conn.createSqlVectorLayer(options) + self.assertTrue(vl2.isValid()) + self.assertTrue(vl2.isSqlQuery()) + self.assertTrue(vl2.isSpatial()) + del vl2 + # Test that a database connection can be retrieved from an existing layer vlconn = QgsMapLayerUtils.databaseConnection(vl) self.assertIsNotNone(vlconn) diff --git a/tests/src/python/test_qgsprovidersublayerdetails.py b/tests/src/python/test_qgsprovidersublayerdetails.py index 0812b281a37f..c9577fc28f17 100644 --- a/tests/src/python/test_qgsprovidersublayerdetails.py +++ b/tests/src/python/test_qgsprovidersublayerdetails.py @@ -201,7 +201,7 @@ def test_to_mime(self): details.setType(QgsMapLayerType.PointCloudLayer) uri = details.toMimeUri() - self.assertEqual(uri.layerType, "pointcloud") + self.assertEqual(uri.layerType, "point-cloud") details.setType(QgsMapLayerType.PluginLayer) uri = details.toMimeUri() diff --git a/tests/src/python/test_qgsrasterblock.py b/tests/src/python/test_qgsrasterblock.py index f8b62ebe5b84..5e25b2bf62e6 100644 --- a/tests/src/python/test_qgsrasterblock.py +++ b/tests/src/python/test_qgsrasterblock.py @@ -47,10 +47,12 @@ def testQgsRasterBlock(self): self.assertTrue((block.as_numpy() == expected_array).all()) # test with noDataValue set - block.setNoDataValue(0) + block.setNoDataValue(-999) data = numpy.array([[numpy.nan, 2], [4, 4]]) expected_masked_array = numpy.ma.masked_array(data, mask=numpy.isnan(data)) self.assertTrue((block.as_numpy() == expected_masked_array).all()) + self.assertTrue(numpy.ma.isMaskedArray(block.as_numpy())) + self.assertTrue(block.as_numpy().fill_value == -999) # test with noDataValue set and use_masking == False self.assertTrue((block.as_numpy(use_masking=False) == expected_array).all()) diff --git a/tests/src/python/test_qgsrasterlayer.py b/tests/src/python/test_qgsrasterlayer.py index 78b7a5fa81a3..31a51fb0a2a0 100644 --- a/tests/src/python/test_qgsrasterlayer.py +++ b/tests/src/python/test_qgsrasterlayer.py @@ -17,6 +17,7 @@ import os from shutil import copyfile +import numpy import numpy as np from osgeo import gdal from qgis.PyQt.QtCore import QFileInfo, QSize, QTemporaryDir @@ -1488,20 +1489,20 @@ def test_read_xml_crash(self): def test_as_numpy(self): layer = QgsRasterLayer(self.rpath, "raster") arrays = layer.as_numpy() - self.assertEqual(type(arrays[5]), np.ndarray) + self.assertTrue(numpy.ma.isMaskedArray(arrays[0])) self.assertEqual(arrays.shape, (9, 200, 200)) self.assertEqual(arrays[0].dtype, np.int8) # test with bands parameter arrays = layer.as_numpy(bands=[1, 3]) - self.assertEqual(type(arrays[0]), np.ndarray) + self.assertTrue(numpy.ma.isMaskedArray(arrays[0])) self.assertEqual(arrays.shape, (2, 200, 200)) self.assertEqual(arrays[0].dtype, np.int8) path = os.path.join(unitTestDataPath("raster"), "rgb_with_mask.tif") layer = QgsRasterLayer(path, QFileInfo(path).baseName()) arrays = layer.as_numpy() - self.assertEqual(type(arrays[0]), np.ndarray) + self.assertTrue(numpy.ma.isMaskedArray(arrays[0])) self.assertEqual(arrays.shape, (4, 150, 162)) self.assertEqual(arrays[0].dtype, np.int8) @@ -1510,9 +1511,7 @@ def test_as_numpy(self): ) layer = QgsRasterLayer(path, QFileInfo(path).baseName()) arrays = layer.as_numpy() - self.assertEqual( - type(arrays[0]), np.ndarray - ) # All maskedArrays are converted to numpy.array + self.assertTrue(numpy.ma.isMaskedArray(arrays[0])) self.assertEqual(arrays.shape, (1, 4, 4)) self.assertEqual(arrays[0].dtype, np.float64) diff --git a/tests/src/python/test_qgsserver_wfs.py b/tests/src/python/test_qgsserver_wfs.py index 77538fa68f7b..d1ac6872376b 100644 --- a/tests/src/python/test_qgsserver_wfs.py +++ b/tests/src/python/test_qgsserver_wfs.py @@ -38,10 +38,22 @@ QgsGeometry, QgsProject, QgsVectorLayer, + QgsMemoryProviderUtils, + QgsWkbTypes, + QgsVectorDataProvider, + QgsFields, + QgsField, +) +from qgis.server import ( + QgsServerRequest, + QgsServer, + QgsBufferServerResponse, + QgsBufferServerRequest, ) -from qgis.server import QgsServerRequest from qgis.testing import unittest from test_qgsserver import QgsServerTestBase +from qgis.PyQt.QtCore import QVariant, QUrl +from test_qgsserver_accesscontrol import XML_NS # Strip path and content length because path may vary RE_STRIP_UNCHECKABLE = rb'MAP=[^"]+|Content-Length: \d+|timeStamp="[^"]+"' @@ -1530,6 +1542,70 @@ def test_GetFeature_with_datetime(self): project_file=project_file, ) + def test_wfs_aspatial_getcapabilities(self): + ### Test issue GH #60185 - WFS GetCapabilities for aspatial layers""" + + # create a memory layer with no geometry + fields = QgsFields() + fields.append(QgsField("id", QVariant.Int)) + fields.append(QgsField("name", QVariant.String)) + layer = QgsMemoryProviderUtils.createMemoryLayer( + "no_geom", fields, QgsWkbTypes.NoGeometry + ) + + provider = layer.dataProvider() + self.assertTrue(layer.isValid()) + self.assertFalse(layer.isSpatial()) + self.assertFalse( + provider.capabilities() & QgsVectorDataProvider.Capability.ChangeGeometries + ) + + project = QgsProject() + project.addMapLayer(layer) + project.writeEntry("WFSLayers", "/", [layer.id()]) + project.writeEntry("WFSTLayers", "Update", [layer.id()]) + project.writeEntry("WFSTLayers", "Insert", [layer.id()]) + project.writeEntry("WFSTLayers", "Delete", [layer.id()]) + + server = QgsServer() + request = QgsServerRequest() + request.setUrl(QUrl("?SERVICE=WFS&REQUEST=GetCapabilities")) + response = QgsBufferServerResponse() + server.handleRequest(request, response, project) + body = response.body().data().decode("utf8").replace("\n", "") + self.assertIn("Update", body) + + # Test an actual transaction + post_data = f""" + + + + 1 + one + + +""" + + query_string = "?SERVICE=WFS&REQUEST=TRANSACTION" + request = QgsBufferServerRequest( + QUrl(query_string), + QgsServerRequest.PostMethod, + {}, + post_data.encode("utf-8"), + ) + response = QgsBufferServerResponse() + server.handleRequest(request, response, project) + body = response.body().data() + + self.assertIn(b"", body) + + # Check the backend + features = list(provider.getFeatures()) + self.assertEqual(len(features), 1) + f = features[0] + self.assertEqual(f["id"], 1) + self.assertEqual(f["name"], "one") + if __name__ == "__main__": unittest.main() diff --git a/tests/src/python/test_qgsserver_wms_getfeatureinfo.py b/tests/src/python/test_qgsserver_wms_getfeatureinfo.py index 080d85eda131..d0f7813d11cb 100644 --- a/tests/src/python/test_qgsserver_wms_getfeatureinfo.py +++ b/tests/src/python/test_qgsserver_wms_getfeatureinfo.py @@ -28,6 +28,7 @@ import osgeo.gdal # NOQA from qgis.core import ( + Qgis, QgsCoordinateReferenceSystem, QgsFeature, QgsField, @@ -37,9 +38,16 @@ QgsMemoryProviderUtils, QgsProject, QgsWkbTypes, + QgsPointXY, + QgsAttributeEditorField, +) +from qgis.PyQt.QtCore import QVariant, QUrl +from qgis.server import ( + QgsBufferServerRequest, + QgsBufferServerResponse, + QgsServer, + QgsServerRequest, ) -from qgis.PyQt.QtCore import QVariant -from qgis.server import QgsBufferServerRequest, QgsBufferServerResponse from qgis.testing import unittest, QgisTestCase from test_qgsserver_wms import TestQgsServerWMSTestBase @@ -1357,6 +1365,197 @@ def testGetFeatureInfoSortedByDesignerWithJoinLayer(self): "test_project_values.qgz", ) + def test_getfeatureinfo_sub_px_tolerance(self): + + # create a memory layer with points + fields = QgsFields() + fields.append(QgsField("id", QVariant.Int)) + fields.append(QgsField("name", QVariant.String)) + layer = QgsMemoryProviderUtils.createMemoryLayer( + "points", + fields, + QgsWkbTypes.Point, + QgsCoordinateReferenceSystem("EPSG:4326"), + ) + + provider = layer.dataProvider() + self.assertTrue(layer.isValid()) + + # add some features + f = QgsFeature(fields) + f.setAttribute("id", 1) + f.setAttribute("name", "point1") + f.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(0, 0))) + provider.addFeature(f) + + f = QgsFeature(fields) + f.setAttribute("id", 2) + f.setAttribute("name", "point2") + f.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(1, 1))) + provider.addFeature(f) + + f = QgsFeature(fields) + f.setAttribute("id", 3) + f.setAttribute("name", "point3") + f.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(-1, -1))) + provider.addFeature(f) + + project = QgsProject() + project.addMapLayer(layer) + + # set up the WMS server + server = QgsServer() + request = QgsServerRequest() + # Choose a small extent to trigger the sub-pixel tolerance adjustment + w = 10 + w2 = int(w / 2) + request.setUrl( + QUrl( + f"?SERVICE=WMS&REQUEST=GetFeatureInfo&LAYERS=points&QUERY_LAYERS=points&INFO_FORMAT=application/json&FEATURE_COUNT=1&WIDTH={w}&HEIGHT={w}&CRS=EPSG:4326&STYLES=&BBOX=-1,-1,1,1&X={w2}&Y={w2}&VERSION=1.3.0" + ) + ) + response = QgsBufferServerResponse() + + server.handleRequest(request, response, project) + body = response.body().data().decode("utf8").replace("\n", "") + self.assertEqual(len(json.loads(body)["features"]), 1) + + def test_getfeatureinfo_form_config(self): + """Test issue GH #59335 : getfeatureinfo with form config drag and drop settings""" + + # create a memory layer with points + fields = QgsFields() + fields.append(QgsField("id_xyz", QVariant.Int)) + fields.append(QgsField("name_xyz", QVariant.String)) + layer = QgsMemoryProviderUtils.createMemoryLayer( + "points", + fields, + QgsWkbTypes.Point, + QgsCoordinateReferenceSystem("EPSG:4326"), + ) + + provider = layer.dataProvider() + self.assertTrue(layer.isValid()) + + # add some features + f = QgsFeature(fields) + f.setAttribute("id_xyz", 1) + f.setAttribute("name_xyz", "point1") + f.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(0, 0))) + provider.addFeature(f) + + f = QgsFeature(fields) + f.setAttribute("id_xyz", 2) + f.setAttribute("name_xyz", "point2") + f.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(1, 1))) + provider.addFeature(f) + + f = QgsFeature(fields) + f.setAttribute("id_xyz", 3) + f.setAttribute("name_xyz", "point3") + f.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(-1, -1))) + provider.addFeature(f) + + project = QgsProject() + project.addMapLayer(layer) + project.writeEntry("WMSFeatureInfoUseAttributeFormSettings", "/", "true") + + # Set the form settings + editFormConfig = layer.editFormConfig() + editFormConfig.clearTabs() + editFormConfig.addTab( + QgsAttributeEditorField( + "id_xyz", 0, editFormConfig.invisibleRootContainer() + ) + ) + editFormConfig.setLayout(Qgis.AttributeFormLayout.DragAndDrop) + layer.setEditFormConfig(editFormConfig) + + # set up the WMS server + server = QgsServer() + request = QgsServerRequest() + w = 10 + w2 = int(w / 2) + + for info_format in [ + "text/plain", + "application/json", + "text/xml", + "application/vnd.ogc.gml", + ]: + + request.setUrl( + QUrl( + f"?SERVICE=WMS&REQUEST=GetFeatureInfo&LAYERS=points&QUERY_LAYERS=points&INFO_FORMAT={info_format}&FEATURE_COUNT=1&WIDTH={w}&HEIGHT={w}&CRS=EPSG:4326&STYLES=&BBOX=-1,-1,1,1&X={w2}&Y={w2}&VERSION=1.3.0" + ) + ) + response = QgsBufferServerResponse() + + server.handleRequest(request, response, project) + body = response.body().data().decode("utf8").replace("\n", " ") + self.assertNotIn("name_xyz", body) + self.assertIn("id_xyz", body) + + def test_getfeatureinfo_display_name(self): + """Test issue GH #59353""" + + # create a memory layer with points + fields = QgsFields() + fields.append(QgsField("id_xyz", QVariant.Int)) + fields.append(QgsField("name_xyz", QVariant.String)) + layer = QgsMemoryProviderUtils.createMemoryLayer( + "points", + fields, + QgsWkbTypes.Point, + QgsCoordinateReferenceSystem("EPSG:4326"), + ) + layer.setDisplayExpression("name_xyz || ' (' || id_xyz || ')'") + + provider = layer.dataProvider() + self.assertTrue(layer.isValid()) + + # add some features + f = QgsFeature(fields) + f.setAttribute("id_xyz", 1) + f.setAttribute("name_xyz", "point1") + f.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(0, 0))) + provider.addFeature(f) + + f = QgsFeature(fields) + f.setAttribute("id_xyz", 2) + f.setAttribute("name_xyz", "point2") + f.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(1, 1))) + provider.addFeature(f) + + f = QgsFeature(fields) + f.setAttribute("id_xyz", 3) + f.setAttribute("name_xyz", "point3") + f.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(-1, -1))) + provider.addFeature(f) + + project = QgsProject() + project.addMapLayer(layer) + + # set up the WMS server + server = QgsServer() + request = QgsServerRequest() + w = 10 + w2 = int(w / 2) + + # Note: not implemented for , 'application/vnd.ogc.gml' + for info_format in ["text/plain", "application/json", "text/xml"]: + + request.setUrl( + QUrl( + f"?SERVICE=WMS&REQUEST=GetFeatureInfo&LAYERS=points&QUERY_LAYERS=points&INFO_FORMAT={info_format}&FEATURE_COUNT=1&WIDTH={w}&HEIGHT={w}&CRS=EPSG:4326&STYLES=&WITH_DISPLAY_NAME=true&BBOX=-1,-1,1,1&X={w2}&Y={w2}&VERSION=1.3.0" + ) + ) + response = QgsBufferServerResponse() + + server.handleRequest(request, response, project) + body = response.body().data().decode("utf8").replace("\n", " ") + self.assertIn("point1 (1)", body) + if __name__ == "__main__": unittest.main() diff --git a/tests/src/python/test_qgsserver_wms_getprint.py b/tests/src/python/test_qgsserver_wms_getprint.py index e2555b0e0d17..d579987f6bdc 100644 --- a/tests/src/python/test_qgsserver_wms_getprint.py +++ b/tests/src/python/test_qgsserver_wms_getprint.py @@ -526,6 +526,36 @@ def test_wms_getprint_external(self): r, h = self._result(self._execute_request(qs)) self._img_diff_error(r, h, "WMS_GetPrint_External") + def test_wms_getprint_highlight_empty_labels(self): + qs = "?" + "&".join( + [ + "%s=%s" % i + for i in list( + { + "MAP": urllib.parse.quote(self.projectPath), + "SERVICE": "WMS", + "VERSION": "1.1.1", + "REQUEST": "GetPrint", + "TEMPLATE": "layoutA4", + "FORMAT": "png", + "map0:EXTENT": "-33626185.498,-13032965.185,33978427.737,16020257.031", + "map0:LAYERS": "Country,Hello", + "CRS": "EPSG:3857", + "map0:HIGHLIGHT_GEOM": "POINT(-4000000 12215266);POINT(3271207 6832268);POINT(2360238 1035192)", + "map0:HIGHLIGHT_LABELSTRING": "Arctic;;Africa", + "map0:HIGHLIGHT_SYMBOL": 'circle%23ff000017.5%237bdcb5128.4;circle%23ff000017.5%237bdcb5128.4;circle%23ff000017.5%237bdcb5128.4', + "map0:HIGHLIGHT_LABELSIZE": "16;16;16", + "map0:HIGHLIGHT_LABELCOLOR": "red;red;red", + "map0:HIGHLIGHT_LABELBUFFERCOLOR": "white;white;white", + "map0:HIGHLIGHT_LABELBUFFERSIZE": "1;1;1", + }.items() + ) + ] + ) + + r, h = self._result(self._execute_request(qs)) + self._img_diff_error(r, h, "WMS_GetPrint_Highlight_Empty_Labels") + if __name__ == "__main__": unittest.main() diff --git a/tests/src/python/test_qgssvgcache.py b/tests/src/python/test_qgssvgcache.py index 53f91fd8e05e..9164e3fd4b8d 100644 --- a/tests/src/python/test_qgssvgcache.py +++ b/tests/src/python/test_qgssvgcache.py @@ -333,6 +333,29 @@ def test_inline_svg(self): ) ) + def test_inline_svg_no_block(self): + # note, this is different content to test_inline_svg, we don't want to retrieve a cached version! + inline_svg = """data:image/svg+xml;utf8,""" + image, in_cache = QgsApplication.svgCache().svgAsImage( + inline_svg, + 100, + fill=QColor(0, 0, 0), + stroke=QColor(0, 0, 0), + strokeWidth=0.1, + widthScaleFactor=1, + blocking=False, + ) + self.assertTrue( + self.image_check( + "Inline svg", + "inline_svg", + image, + color_tolerance=2, + allowed_mismatch=20, + use_checkerboard_background=True, + ) + ) + if __name__ == "__main__": unittest.main() diff --git a/tests/src/python/test_qgstextrenderer.py b/tests/src/python/test_qgstextrenderer.py index fa667ee5d647..8468db72e16a 100644 --- a/tests/src/python/test_qgstextrenderer.py +++ b/tests/src/python/test_qgstextrenderer.py @@ -3656,6 +3656,20 @@ def testDrawTabFixedSize(self): self.checkRender(format, "text_tab_fixed_size", text=["with\ttabs", "a\tb"]) ) + def testDrawTabsMultipleHtmlFixedSize(self): + format = QgsTextFormat() + format.setFont(getTestFont("bold")) + format.setSize(20) + format.setAllowHtmlFormatting(True) + format.setSizeUnit(QgsUnitTypes.RenderUnit.RenderPoints) + format.setTabStopDistance(20) + format.setTabStopDistanceUnit(Qgis.RenderUnit.Millimeters) + self.assertTrue( + self.checkRender( + format, "text_tab_multiple_html", text=["with\t\ttabs", "a\t\tb"] + ) + ) + def testDrawTabPositionsFixedSize(self): format = QgsTextFormat() format.setFont(getTestFont("bold")) @@ -5341,6 +5355,30 @@ def testDrawTextDataDefinedProperties(self): ) ) + def test_render_with_maximum_width_too_small_one_word(self): + """ + Render where the rect size is too small to fit words when wrapping lines + and only one word present (https://github.com/qgis/QGIS/issues/60256) + """ + format = QgsTextFormat() + format.setFont(getTestFont("bold")) + format.setSize(16) + format.setSizeUnit(QgsUnitTypes.RenderUnit.RenderPoints) + format.setAllowHtmlFormatting(True) + + self.assertTrue( + self.checkRender( + format, + "wrap_small_rect_one_word", + None, + text=[ + """

Text

""" + ], + rect=QRectF(40, 20, 10, 5), + flags=Qgis.TextRendererFlag.WrapLines, + ) + ) + if __name__ == "__main__": unittest.main() diff --git a/tests/src/python/test_qgsvectorfilewriter.py b/tests/src/python/test_qgsvectorfilewriter.py index a1a2f6dcbffe..857fae26f145 100644 --- a/tests/src/python/test_qgsvectorfilewriter.py +++ b/tests/src/python/test_qgsvectorfilewriter.py @@ -903,9 +903,18 @@ def testSupportedFiltersAndFormat(self): formats = QgsVectorFileWriter.supportedFiltersAndFormats( QgsVectorFileWriter.VectorFormatOption.SortRecommended ) - self.assertEqual(formats[0].filterString, "GeoPackage (*.gpkg *.GPKG)") + if int(gdal.VersionInfo("VERSION_NUM")) >= GDAL_COMPUTE_VERSION(3, 7, 0): + self.assertEqual( + formats[0].filterString, + "GeoPackage (*.gpkg *.gpkg.zip *.GPKG *.GPKG.ZIP)", + ) + else: + self.assertEqual(formats[0].filterString, "GeoPackage (*.gpkg *.GPKG)") self.assertEqual(formats[0].driverName, "GPKG") - self.assertEqual(formats[0].globs, ["*.gpkg"]) + if int(gdal.VersionInfo("VERSION_NUM")) >= GDAL_COMPUTE_VERSION(3, 7, 0): + self.assertEqual(formats[0].globs, ["*.gpkg", "*.gpkg.zip"]) + else: + self.assertEqual(formats[0].globs, ["*.gpkg"]) self.assertEqual(formats[1].filterString, "ESRI Shapefile (*.shp *.SHP)") self.assertEqual(formats[1].driverName, "ESRI Shapefile") self.assertEqual(formats[1].globs, ["*.shp"]) diff --git a/tests/src/python/test_qgsvectorlayer.py b/tests/src/python/test_qgsvectorlayer.py index 9fddac4f96f2..1ec7dbff81a3 100644 --- a/tests/src/python/test_qgsvectorlayer.py +++ b/tests/src/python/test_qgsvectorlayer.py @@ -701,6 +701,7 @@ def test_AddFeature(self): def checkAfter(): self.assertEqual(layer.featureCount(), 1) + self.assertEqual(layer.extent(), QgsRectangle(1, 2, 1, 2)) # check select+nextFeature f = next(layer.getFeatures()) @@ -712,6 +713,7 @@ def checkAfter(): def checkBefore(): self.assertEqual(layer.featureCount(), 0) + self.assertEqual(layer.extent(), QgsRectangle()) # check select+nextFeature with self.assertRaises(StopIteration): @@ -721,10 +723,15 @@ def checkBefore(): spy = QSignalSpy(layer.layerModified) repaint_spy = QSignalSpy(layer.repaintRequested) + feature_added_spy = QSignalSpy(layer.featureAdded) + feature_deleted_spy = QSignalSpy(layer.featureDeleted) # try to add feature without editing mode self.assertFalse(layer.addFeature(feat)) self.assertEqual(len(repaint_spy), 0) + self.assertEqual(len(feature_added_spy), 0) + self.assertEqual(len(feature_deleted_spy), 0) + self.assertEqual(layer.extent(), QgsRectangle()) # add feature layer.startEditing() @@ -733,6 +740,9 @@ def checkBefore(): bad_feature = QgsFeature() self.assertFalse(layer.addFeature(bad_feature)) self.assertEqual(len(repaint_spy), 0) + self.assertEqual(len(feature_added_spy), 0) + self.assertEqual(len(feature_deleted_spy), 0) + self.assertEqual(layer.extent(), QgsRectangle()) self.assertEqual(len(spy), 0) @@ -741,12 +751,16 @@ def checkBefore(): self.assertEqual(len(spy), 1) self.assertEqual(len(repaint_spy), 1) + self.assertEqual(len(feature_added_spy), 1) + self.assertEqual(len(feature_deleted_spy), 0) checkAfter() self.assertEqual(layer.dataProvider().featureCount(), 0) # now try undo/redo layer.undoStack().undo() + self.assertEqual(len(feature_added_spy), 1) + self.assertEqual(len(feature_deleted_spy), 1) checkBefore() self.assertEqual(len(spy), 2) self.assertEqual(len(repaint_spy), 2) @@ -756,6 +770,8 @@ def checkBefore(): self.assertEqual(len(spy), 3) self.assertEqual(len(repaint_spy), 3) + self.assertEqual(len(feature_added_spy), 2) + self.assertEqual(len(feature_deleted_spy), 1) self.assertTrue(layer.commitChanges()) diff --git a/tests/src/python/test_qgsvectorlayereditbuffer.py b/tests/src/python/test_qgsvectorlayereditbuffer.py index 196f20052d94..5a76c7d8090d 100644 --- a/tests/src/python/test_qgsvectorlayereditbuffer.py +++ b/tests/src/python/test_qgsvectorlayereditbuffer.py @@ -13,7 +13,7 @@ import os from osgeo import gdal -from qgis.PyQt.QtCore import QTemporaryDir, QVariant +from qgis.PyQt.QtCore import QMetaType, QTemporaryDir, QVariant from qgis.PyQt.QtTest import QSignalSpy from qgis.core import ( Qgis, @@ -851,11 +851,35 @@ def _check_feature(wkt): # THIS FUNCTIONALITY IS BROKEN ON NEWER GDAL VERSIONS, DUE TO INCORRECT # assumptions at time of development. See https://github.com/qgis/QGIS/pull/59797#issuecomment-2544133498 - if int(gdal.VersionInfo("VERSION_NUM")) < GDAL_COMPUTE_VERSION(3, 5, 0): + # see also: https://github.com/OSGeo/gdal/pull/11695 for a GDAL 3.11 fix + if int(gdal.VersionInfo("VERSION_NUM")) < GDAL_COMPUTE_VERSION(3, 5, 0) or int( + gdal.VersionInfo("VERSION_NUM") + ) >= GDAL_COMPUTE_VERSION(3, 11, 0): _test(Qgis.TransactionMode.AutomaticGroups) _test(Qgis.TransactionMode.BufferedGroups) + def testAddNewFeatureAndNewAttribute(self): + layer = QgsVectorLayer("Point?field=fldtxt:string", "addfeat", "memory") + layer.startEditing() + + # Add a new feature with fields information attached to it + f = QgsFeature(layer.fields()) + f.setAttributes(["test"]) + f.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(100, 200))) + layer.addFeature(f) + + # Add a new attribute to the layer + layer.addAttribute(QgsField("fldint", QMetaType.Type.Int)) + + # Change the newly-added attribute value for the new feature + layer.changeAttributeValue(f.id(), 1, 123) + + # Commit changes + layer.commitChanges() + + self.assertEqual(layer.getFeature(1).attributes(), ["test", 123]) + if __name__ == "__main__": unittest.main() diff --git a/tests/src/python/test_qgsvectorlayerelevationproperties.py b/tests/src/python/test_qgsvectorlayerelevationproperties.py index 7b3b0bfbdced..a2f9e922ed19 100644 --- a/tests/src/python/test_qgsvectorlayerelevationproperties.py +++ b/tests/src/python/test_qgsvectorlayerelevationproperties.py @@ -188,12 +188,12 @@ def test_defaults(self): vl.elevationProperties().clamping(), Qgis.AltitudeClamping.Terrain ) - # a layer WITH z values present should default to relative mode + # a layer WITH z values present should default to absolute mode vl = QgsVectorLayer(unitTestDataPath() + "/3d/points_with_z.shp") self.assertTrue(vl.isValid()) self.assertEqual( - vl.elevationProperties().clamping(), Qgis.AltitudeClamping.Relative + vl.elevationProperties().clamping(), Qgis.AltitudeClamping.Absolute ) def test_show_by_default(self): diff --git a/tests/src/python/test_qgsvectorlayerprofilegenerator.py b/tests/src/python/test_qgsvectorlayerprofilegenerator.py index e1fac53c446b..d6c59e08a9fe 100644 --- a/tests/src/python/test_qgsvectorlayerprofilegenerator.py +++ b/tests/src/python/test_qgsvectorlayerprofilegenerator.py @@ -225,20 +225,12 @@ def testPointGenerationTerrain(self): self.assertTrue(generator.generateProfile()) results = generator.takeResults() - if QgsProjUtils.projVersionMajor() >= 8: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 1), - {175.6: 69.5, 31.2: 69.5, 1242.5: 55.2}, - ) - self.assertAlmostEqual(results.zRange().lower(), 55.249, 2) - self.assertAlmostEqual(results.zRange().upper(), 69.5, 2) - else: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 1), - {31.2: 67.2, 175.6: 65.8, 1242.5: 52.2}, - ) - self.assertAlmostEqual(results.zRange().lower(), 52.25, 2) - self.assertAlmostEqual(results.zRange().upper(), 67.25, 2) + self.assertEqual( + self.round_dict(results.distanceToHeightMap(), 1), + {175.6: 69.5, 31.2: 69.5, 1242.5: 55.2}, + ) + self.assertAlmostEqual(results.zRange().lower(), 55.249, 2) + self.assertAlmostEqual(results.zRange().upper(), 69.5, 2) # 70 meters tolerance req.setTolerance(70) @@ -246,20 +238,12 @@ def testPointGenerationTerrain(self): self.assertTrue(generator.generateProfile()) results = generator.takeResults() - if QgsProjUtils.projVersionMajor() >= 8: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 1), - {175.6: 69.5, 31.2: 69.5, 1223.2: 56.8, 1242.5: 55.2}, - ) - self.assertAlmostEqual(results.zRange().lower(), 55.249, 2) - self.assertAlmostEqual(results.zRange().upper(), 69.5, 2) - else: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 1), - {31.2: 67.2, 175.6: 65.8, 1242.5: 52.2}, - ) - self.assertAlmostEqual(results.zRange().lower(), 52.25, 2) - self.assertAlmostEqual(results.zRange().upper(), 67.25, 2) + self.assertEqual( + self.round_dict(results.distanceToHeightMap(), 1), + {175.6: 69.5, 31.2: 69.5, 1223.2: 56.8, 1242.5: 55.2}, + ) + self.assertAlmostEqual(results.zRange().lower(), 55.249, 2) + self.assertAlmostEqual(results.zRange().upper(), 69.5, 2) def testPointGenerationRelative(self): """ @@ -301,20 +285,12 @@ def testPointGenerationRelative(self): generator = vl.createProfileGenerator(req) self.assertTrue(generator.generateProfile()) results = generator.takeResults() - if QgsProjUtils.projVersionMajor() >= 8: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 1), - {31.2: 333.5, 175.6: 333.5, 1242.5: 267.0}, - ) - self.assertAlmostEqual(results.zRange().lower(), 267.0, 2) - self.assertAlmostEqual(results.zRange().upper(), 333.5, 2) - else: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 1), - {31.2: 331.2, 175.6: 329.8, 1242.5: 264.0}, - ) - self.assertAlmostEqual(results.zRange().lower(), 264.0, 2) - self.assertAlmostEqual(results.zRange().upper(), 331.25, 2) + self.assertEqual( + self.round_dict(results.distanceToHeightMap(), 1), + {31.2: 333.5, 175.6: 333.5, 1242.5: 267.0}, + ) + self.assertAlmostEqual(results.zRange().lower(), 267.0, 2) + self.assertAlmostEqual(results.zRange().upper(), 333.5, 2) def testPointGenerationRelativeExtrusion(self): """ @@ -355,39 +331,21 @@ def testPointGenerationRelativeExtrusion(self): self.assertTrue(generator.generateProfile()) results = generator.takeResults() - if QgsProjUtils.projVersionMajor() >= 8: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 1), - {31.2: 333.5, 175.6: 333.5, 1242.5: 267.0}, - ) - else: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 1), - {31.2: 331.2, 175.6: 329.8, 1242.5: 264.0}, - ) + self.assertEqual( + self.round_dict(results.distanceToHeightMap(), 1), + {31.2: 333.5, 175.6: 333.5, 1242.5: 267.0}, + ) - if QgsProjUtils.projVersionMajor() >= 8: - self.assertCountEqual( - [g.asWkt(1) for g in results.asGeometries()], - [ - "LineString Z (-347395 6632649.6 333.5, -347395 6632649.6 340.5)", - "LineString Z (-347533.4 6632692.2 333.5, -347533.4 6632692.2 340.5)", - "LineString Z (-346399.2 6632265.6 267, -346399.2 6632265.6 274)", - ], - ) - self.assertAlmostEqual(results.zRange().lower(), 267.0, 2) - self.assertAlmostEqual(results.zRange().upper(), 340.5, 2) - else: - self.assertCountEqual( - [g.asWkt(1) for g in results.asGeometries()], - [ - "LineString Z (-347395 6632649.6 329.8, -347395 6632649.6 336.8)", - "LineString Z (-347533.4 6632692.2 331.3, -347533.4 6632692.2 338.3)", - "LineString Z (-346399.2 6632265.6 264, -346399.2 6632265.6 271)", - ], - ) - self.assertAlmostEqual(results.zRange().lower(), 264.0, 2) - self.assertAlmostEqual(results.zRange().upper(), 338.25, 2) + self.assertCountEqual( + [g.asWkt(1) for g in results.asGeometries()], + [ + "LineString Z (-347395 6632649.6 333.5, -347395 6632649.6 340.5)", + "LineString Z (-347533.4 6632692.2 333.5, -347533.4 6632692.2 340.5)", + "LineString Z (-346399.2 6632265.6 267, -346399.2 6632265.6 274)", + ], + ) + self.assertAlmostEqual(results.zRange().lower(), 267.0, 2) + self.assertAlmostEqual(results.zRange().upper(), 340.5, 2) def testPointGenerationMultiPoint(self): vl = QgsVectorLayer("MultipointZ?crs=EPSG:27700", "trees", "memory") @@ -624,34 +582,19 @@ def testLineGenerationTerrain(self): self.assertTrue(generator.generateProfile()) results = generator.takeResults() - if QgsProjUtils.projVersionMajor() >= 8: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 1), - { - 675.2: 66.5, - 1195.7: 49.2, - 1223.1: 50.0, - 1272.0: 53.8, - 1339.4: 58.2, - 1444.4: 58.2, - }, - ) - self.assertAlmostEqual(results.zRange().lower(), 49.25, 2) - self.assertAlmostEqual(results.zRange().upper(), 66.5, 2) - else: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 1), - { - 675.2: 62.7, - 1195.7: 53.0, - 1223.1: 56.0, - 1272.0: 58.2, - 1339.4: 57.5, - 1444.4: 52.2, - }, - ) - self.assertAlmostEqual(results.zRange().lower(), 52.25, 2) - self.assertAlmostEqual(results.zRange().upper(), 62.7499, 2) + self.assertEqual( + self.round_dict(results.distanceToHeightMap(), 1), + { + 675.2: 66.5, + 1195.7: 49.2, + 1223.1: 50.0, + 1272.0: 53.8, + 1339.4: 58.2, + 1444.4: 58.2, + }, + ) + self.assertAlmostEqual(results.zRange().lower(), 49.25, 2) + self.assertAlmostEqual(results.zRange().upper(), 66.5, 2) def testLineGenerationTerrainTolerance(self): vl = QgsVectorLayer("LineStringZ?crs=EPSG:27700", "lines", "memory") @@ -698,47 +641,25 @@ def testLineGenerationTerrainTolerance(self): self.assertTrue(generator.generateProfile()) results = generator.takeResults() - if QgsProjUtils.projVersionMajor() >= 8: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 2), - { - 675.09: 66.5, - 675.24: 66.5, - 1195.73: 49.25, - 1195.74: 49.25, - 1223.14: 50.0, - 1223.15: 50.0, - 1271.97: 53.75, - 1271.99: 53.75, - 1339.33: 58.25, - 1339.51: 58.25, - 1444.18: 58.25, - 1444.59: 58.25, - }, - ) - self.assertAlmostEqual(results.zRange().lower(), 49.25, 2) - self.assertAlmostEqual(results.zRange().upper(), 66.5, 2) - else: - # TODO find a way to test with an older proj version - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 2), - { - 675.09: 66.5, - 675.24: 66.5, - 1195.73: 49.25, - 1195.74: 49.25, - 1223.14: 50.0, - 1223.15: 50.0, - 1271.97: 53.75, - 1271.99: 53.75, - 1339.33: 58.25, - 1339.51: 58.25, - 1444.18: 58.25, - 1444.59: 58.25, - }, - ) - self.assertAlmostEqual(results.zRange().lower(), 52.25, 2) - self.assertAlmostEqual(results.zRange().upper(), 62.7499, 2) + self.assertEqual( + self.round_dict(results.distanceToHeightMap(), 2), + { + 675.09: 66.5, + 675.24: 66.5, + 1195.73: 49.25, + 1195.74: 49.25, + 1223.14: 50.0, + 1223.15: 50.0, + 1271.97: 53.75, + 1271.99: 53.75, + 1339.33: 58.25, + 1339.51: 58.25, + 1444.18: 58.25, + 1444.59: 58.25, + }, + ) + self.assertAlmostEqual(results.zRange().lower(), 49.25, 2) + self.assertAlmostEqual(results.zRange().upper(), 66.5, 2) # 1 meter tolerance tolerance = 1 @@ -748,47 +669,25 @@ def testLineGenerationTerrainTolerance(self): self.assertTrue(generator.generateProfile()) results = generator.takeResults() - if QgsProjUtils.projVersionMajor() >= 8: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 2), - { - 674.43: 66.5, - 675.91: 66.5, - 1195.73: 49.25, - 1195.91: 49.25, - 1223.06: 50.0, - 1223.23: 50.0, - 1271.86: 53.75, - 1272.1: 53.75, - 1338.5: 58.25, - 1340.34: 58.25, - 1442.29: 56.75, - 1446.48: 57.5, - }, - ) - self.assertAlmostEqual(results.zRange().lower(), 49.25, 2) - self.assertAlmostEqual(results.zRange().upper(), 66.5, 2) - else: - # TODO find a way to test with an older proj version - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 2), - { - 675.09: 66.5, - 675.24: 66.5, - 1195.73: 49.25, - 1195.74: 49.25, - 1223.14: 50.0, - 1223.15: 50.0, - 1271.97: 53.75, - 1271.99: 53.75, - 1339.33: 58.25, - 1339.51: 58.25, - 1444.18: 58.25, - 1444.59: 58.25, - }, - ) - self.assertAlmostEqual(results.zRange().lower(), 52.25, 2) - self.assertAlmostEqual(results.zRange().upper(), 62.7499, 2) + self.assertEqual( + self.round_dict(results.distanceToHeightMap(), 2), + { + 674.43: 66.5, + 675.91: 66.5, + 1195.73: 49.25, + 1195.91: 49.25, + 1223.06: 50.0, + 1223.23: 50.0, + 1271.86: 53.75, + 1272.1: 53.75, + 1338.5: 58.25, + 1340.34: 58.25, + 1442.29: 56.75, + 1446.48: 57.5, + }, + ) + self.assertAlmostEqual(results.zRange().lower(), 49.25, 2) + self.assertAlmostEqual(results.zRange().upper(), 66.5, 2) # 15 meters tolerance tolerance = 15 @@ -798,47 +697,25 @@ def testLineGenerationTerrainTolerance(self): self.assertTrue(generator.generateProfile()) results = generator.takeResults() - if QgsProjUtils.projVersionMajor() >= 8: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 2), - { - 664.1: 65.75, - 686.24: 67.25, - 1195.73: 49.25, - 1198.44: 49.25, - 1221.85: 50.0, - 1224.44: 49.25, - 1270.21: 54.5, - 1273.75: 53.0, - 1325.61: 59.0, - 1353.23: 57.5, - 1412.92: 56.0, - 1475.85: 57.5, - }, - ) - self.assertAlmostEqual(results.zRange().lower(), 49.25, 2) - self.assertAlmostEqual(results.zRange().upper(), 67.25, 2) - else: - # TODO find a way to test with an older proj version - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 2), - { - 675.09: 66.5, - 675.24: 66.5, - 1195.73: 49.25, - 1195.74: 49.25, - 1223.14: 50.0, - 1223.15: 50.0, - 1271.97: 53.75, - 1271.99: 53.75, - 1339.33: 58.25, - 1339.51: 58.25, - 1444.18: 58.25, - 1444.59: 58.25, - }, - ) - self.assertAlmostEqual(results.zRange().lower(), 52.25, 2) - self.assertAlmostEqual(results.zRange().upper(), 62.7499, 2) + self.assertEqual( + self.round_dict(results.distanceToHeightMap(), 2), + { + 664.1: 65.75, + 686.24: 67.25, + 1195.73: 49.25, + 1198.44: 49.25, + 1221.85: 50.0, + 1224.44: 49.25, + 1270.21: 54.5, + 1273.75: 53.0, + 1325.61: 59.0, + 1353.23: 57.5, + 1412.92: 56.0, + 1475.85: 57.5, + }, + ) + self.assertAlmostEqual(results.zRange().lower(), 49.25, 2) + self.assertAlmostEqual(results.zRange().upper(), 67.25, 2) def testLineGenerationRelative(self): vl = QgsVectorLayer("LineStringZ?crs=EPSG:27700", "lines", "memory") @@ -881,34 +758,19 @@ def testLineGenerationRelative(self): self.assertTrue(generator.generateProfile()) results = generator.takeResults() - if QgsProjUtils.projVersionMajor() >= 8: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 1), - { - 675.2: 84.2, - 1195.7: 86.8, - 1223.1: 81.4, - 1272.0: 90.0, - 1339.4: 98.7, - 1444.4: 100.0, - }, - ) - self.assertAlmostEqual(results.zRange().lower(), 81.358, 2) - self.assertAlmostEqual(results.zRange().upper(), 100.009, 2) - else: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 1), - { - 675.2: 80.5, - 1195.7: 90.5, - 1223.1: 87.4, - 1272.0: 94.5, - 1339.4: 98.0, - 1444.4: 94.0, - }, - ) - self.assertAlmostEqual(results.zRange().lower(), 80.4564, 2) - self.assertAlmostEqual(results.zRange().upper(), 97.9811, 2) + self.assertEqual( + self.round_dict(results.distanceToHeightMap(), 1), + { + 675.2: 84.2, + 1195.7: 86.8, + 1223.1: 81.4, + 1272.0: 90.0, + 1339.4: 98.7, + 1444.4: 100.0, + }, + ) + self.assertAlmostEqual(results.zRange().lower(), 81.358, 2) + self.assertAlmostEqual(results.zRange().upper(), 100.009, 2) def testLineGenerationRelativeExtrusion(self): vl = QgsVectorLayer("LineStringZ?crs=EPSG:27700", "lines", "memory") @@ -953,59 +815,31 @@ def testLineGenerationRelativeExtrusion(self): self.assertTrue(generator.generateProfile()) results = generator.takeResults() - if QgsProjUtils.projVersionMajor() >= 8: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 1), - { - 675.2: 84.2, - 1195.7: 86.8, - 1223.1: 81.4, - 1272.0: 90.0, - 1339.4: 98.7, - 1444.4: 100.0, - }, - ) - else: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 1), - { - 675.2: 80.5, - 1195.7: 90.5, - 1223.1: 87.4, - 1272.0: 94.5, - 1339.4: 98.0, - 1444.4: 94.0, - }, - ) + self.assertEqual( + self.round_dict(results.distanceToHeightMap(), 1), + { + 675.2: 84.2, + 1195.7: 86.8, + 1223.1: 81.4, + 1272.0: 90.0, + 1339.4: 98.7, + 1444.4: 100.0, + }, + ) - if QgsProjUtils.projVersionMajor() >= 8: - self.assertCountEqual( - [g.asWkt(1) for g in results.asGeometries()], - [ - "LineString Z (-346549.8 6632363.9 81.4, -346549.8 6632363.9 88.4)", - "LineString Z (-346501.4 6632357.8 90, -346501.4 6632357.8 97)", - "LineString Z (-346434.5 6632349.2 98.7, -346434.5 6632349.2 105.7)", - "LineString Z (-346384.6 6632279.1 100, -346384.6 6632279.1 107)", - "LineString Z (-346577 6632367.4 86.8, -346577 6632367.4 93.8)", - "LineString Z (-347062.8 6632554.4 84.2, -347062.8 6632554.4 91.2)", - ], - ) - self.assertAlmostEqual(results.zRange().lower(), 81.3588, 2) - self.assertAlmostEqual(results.zRange().upper(), 107.009, 2) - else: - self.assertCountEqual( - [g.asWkt(1) for g in results.asGeometries()], - [ - "LineString Z (-346549.8 6632363.9 87.4, -346549.8 6632363.9 94.4)", - "LineString Z (-346501.4 6632357.8 94.5, -346501.4 6632357.8 101.5)", - "LineString Z (-346434.5 6632349.2 98, -346434.5 6632349.2 105)", - "LineString Z (-346384.6 6632279.1 94, -346384.6 6632279.1 101)", - "LineString Z (-346577 6632367.4 90.5, -346577 6632367.4 97.5)", - "LineString Z (-347062.8 6632554.4 80.5, -347062.8 6632554.4 87.5)", - ], - ) - self.assertAlmostEqual(results.zRange().lower(), 80.45645, 2) - self.assertAlmostEqual(results.zRange().upper(), 104.9811499, 2) + self.assertCountEqual( + [g.asWkt(1) for g in results.asGeometries()], + [ + "LineString Z (-346549.8 6632363.9 81.4, -346549.8 6632363.9 88.4)", + "LineString Z (-346501.4 6632357.8 90, -346501.4 6632357.8 97)", + "LineString Z (-346434.5 6632349.2 98.7, -346434.5 6632349.2 105.7)", + "LineString Z (-346384.6 6632279.1 100, -346384.6 6632279.1 107)", + "LineString Z (-346577 6632367.4 86.8, -346577 6632367.4 93.8)", + "LineString Z (-347062.8 6632554.4 84.2, -347062.8 6632554.4 91.2)", + ], + ) + self.assertAlmostEqual(results.zRange().lower(), 81.3588, 2) + self.assertAlmostEqual(results.zRange().upper(), 107.009, 2) def testPolygonGenerationAbsolute(self): vl = QgsVectorLayer("PolygonZ?crs=EPSG:27700", "lines", "memory") @@ -1110,54 +944,29 @@ def testPolygonGenerationTerrain(self): self.assertTrue(generator.generateProfile()) results = generator.takeResults() - if QgsProjUtils.projVersionMajor() >= 8: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 1), - { - 1041.8: 55.3, - 1042.4: 55.2, - 1049.5: 55.2, - 1070.2: 55.2, - 1073.1: 55.2, - 1074.8: 55.3, - 1078.9: 54.5, - 1083.9: 54.5, - 1091.1: 54.5, - 1186.8: 49.3, - 1189.8: 49.2, - 1192.7: 49.2, - 1199.2: 49.2, - 1450.0: 53.0, - 1455.6: 53.0, - 1458.1: 53.0, - }, - ) - self.assertAlmostEqual(results.zRange().lower(), 49.25, 2) - self.assertAlmostEqual(results.zRange().upper(), 55.250, 2) - else: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 1), - { - 1041.8: 48.5, - 1042.4: 48.5, - 1049.5: 48.5, - 1070.2: 48.5, - 1073.1: 48.5, - 1074.8: 48.5, - 1078.9: 48.5, - 1083.9: 48.5, - 1091.1: 48.5, - 1186.8: 52.3, - 1189.8: 52.2, - 1192.7: 52.2, - 1199.2: 52.2, - 1450.0: 54.5, - 1455.6: 54.5, - 1458.1: 54.5, - }, - ) - self.assertAlmostEqual(results.zRange().lower(), 48.5, 2) - self.assertAlmostEqual(results.zRange().upper(), 54.500000, 2) + self.assertEqual( + self.round_dict(results.distanceToHeightMap(), 1), + { + 1041.8: 55.3, + 1042.4: 55.2, + 1049.5: 55.2, + 1070.2: 55.2, + 1073.1: 55.2, + 1074.8: 55.3, + 1078.9: 54.5, + 1083.9: 54.5, + 1091.1: 54.5, + 1186.8: 49.3, + 1189.8: 49.2, + 1192.7: 49.2, + 1199.2: 49.2, + 1450.0: 53.0, + 1455.6: 53.0, + 1458.1: 53.0, + }, + ) + self.assertAlmostEqual(results.zRange().lower(), 49.25, 2) + self.assertAlmostEqual(results.zRange().upper(), 55.250, 2) def testPolygonGenerationRelative(self): vl = QgsVectorLayer("PolygonZ?crs=EPSG:27700", "lines", "memory") @@ -1199,76 +1008,39 @@ def testPolygonGenerationRelative(self): self.assertTrue(generator.generateProfile()) results = generator.takeResults() - if QgsProjUtils.projVersionMajor() >= 8: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 1), - { - 1041.8: 60.3, - 1042.4: 60.2, - 1049.5: 60.2, - 1070.2: 60.2, - 1073.1: 60.2, - 1074.8: 60.3, - 1078.9: 62.0, - 1083.9: 62.0, - 1091.1: 62.0, - 1186.8: 59.3, - 1189.8: 59.2, - 1192.7: 59.2, - 1199.2: 59.2, - 1450.0: 65.5, - 1455.6: 65.5, - 1458.1: 65.5, - }, - ) - self.assertAlmostEqual(results.zRange().lower(), 59.2499, 2) - self.assertAlmostEqual(results.zRange().upper(), 65.5000, 2) - - else: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 1), - { - 1041.8: 53.5, - 1042.4: 53.5, - 1049.5: 53.5, - 1070.2: 53.5, - 1073.1: 53.5, - 1074.8: 53.5, - 1078.9: 56.0, - 1083.9: 56.0, - 1091.1: 56.0, - 1186.8: 62.3, - 1189.8: 62.3, - 1192.7: 62.3, - 1199.2: 62.2, - 1450.0: 67.0, - 1455.6: 67.0, - 1458.1: 67.0, - }, - ) - self.assertAlmostEqual(results.zRange().lower(), 53.5, 2) - self.assertAlmostEqual(results.zRange().upper(), 67.000, 2) + self.assertEqual( + self.round_dict(results.distanceToHeightMap(), 1), + { + 1041.8: 60.3, + 1042.4: 60.2, + 1049.5: 60.2, + 1070.2: 60.2, + 1073.1: 60.2, + 1074.8: 60.3, + 1078.9: 62.0, + 1083.9: 62.0, + 1091.1: 62.0, + 1186.8: 59.3, + 1189.8: 59.2, + 1192.7: 59.2, + 1199.2: 59.2, + 1450.0: 65.5, + 1455.6: 65.5, + 1458.1: 65.5, + }, + ) + self.assertAlmostEqual(results.zRange().lower(), 59.2499, 2) + self.assertAlmostEqual(results.zRange().upper(), 65.5000, 2) - if QgsProjUtils.projVersionMajor() >= 8: - self.assertCountEqual( - [g.asWkt(1) for g in results.asGeometries()], - [ - "MultiLineString Z ((-346718.7 6632419.8 60.3, -346712 6632417.4 60.3),(-346719.3 6632420 60.3, -346718.7 6632419.8 60.2),(-346689.7 6632409.5 60.3, -346688.2 6632409 60.3),(-346692.5 6632410.5 60.3, -346689.7 6632409.5 60.3))", - "MultiLineString Z ((-346684.3 6632407.6 62, -346679.6 6632406 62),(-346679.6 6632406 62, -346672.8 6632403.6 62))", - "MultiLineString Z ((-346582.6 6632371.7 59.3, -346579.7 6632370.7 59.3),(-346579.7 6632370.7 59.3, -346577 6632369.7 59.2, -346570.8 6632367.9 59.3))", - "MultiLineString Z ((-346387.6 6632223.9 65.5, -346384.8 6632219 65.5),(-346384.8 6632219 65.5, -346383.5 6632216.9 65.5))", - ], - ) - else: - self.assertCountEqual( - [g.asWkt(1) for g in results.asGeometries()], - [ - "MultiLineString Z ((-346684.3 6632407.6 56, -346679.6 6632406 56),(-346679.6 6632406 56, -346672.8 6632403.6 56))", - "MultiLineString Z ((-346718.7 6632419.8 53.5, -346712 6632417.4 53.5),(-346719.3 6632420 53.5, -346718.7 6632419.8 53.5),(-346689.7 6632409.5 53.5, -346688.2 6632409 53.5),(-346692.5 6632410.5 53.5, -346689.7 6632409.5 53.5))", - "MultiLineString Z ((-346387.6 6632223.9 67, -346384.8 6632219 67),(-346384.8 6632219 67, -346383.5 6632216.9 67))", - "MultiLineString Z ((-346582.6 6632371.7 62.3, -346579.7 6632370.7 62.3),(-346579.7 6632370.7 62.3, -346577 6632369.7 62.3, -346570.8 6632367.9 62.3))", - ], - ) + self.assertCountEqual( + [g.asWkt(1) for g in results.asGeometries()], + [ + "MultiLineString Z ((-346718.7 6632419.8 60.3, -346712 6632417.4 60.3),(-346719.3 6632420 60.3, -346718.7 6632419.8 60.2),(-346689.7 6632409.5 60.3, -346688.2 6632409 60.3),(-346692.5 6632410.5 60.3, -346689.7 6632409.5 60.3))", + "MultiLineString Z ((-346684.3 6632407.6 62, -346679.6 6632406 62),(-346679.6 6632406 62, -346672.8 6632403.6 62))", + "MultiLineString Z ((-346582.6 6632371.7 59.3, -346579.7 6632370.7 59.3),(-346579.7 6632370.7 59.3, -346577 6632369.7 59.2, -346570.8 6632367.9 59.3))", + "MultiLineString Z ((-346387.6 6632223.9 65.5, -346384.8 6632219 65.5),(-346384.8 6632219 65.5, -346383.5 6632216.9 65.5))", + ], + ) def testPolygonGenerationRelativeExtrusion(self): vl = QgsVectorLayer("PolygonZ?crs=EPSG:27700", "lines", "memory") @@ -1312,75 +1084,39 @@ def testPolygonGenerationRelativeExtrusion(self): self.assertTrue(generator.generateProfile()) results = generator.takeResults() - if QgsProjUtils.projVersionMajor() >= 8: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 1), - { - 1041.8: 60.3, - 1042.4: 60.2, - 1049.5: 60.2, - 1070.2: 60.2, - 1073.1: 60.2, - 1074.8: 60.3, - 1078.9: 62.0, - 1083.9: 62.0, - 1091.1: 62.0, - 1186.8: 59.3, - 1189.8: 59.2, - 1192.7: 59.2, - 1199.2: 59.2, - 1450.0: 65.5, - 1455.6: 65.5, - 1458.1: 65.5, - }, - ) - self.assertAlmostEqual(results.zRange().lower(), 59.2499, 2) - self.assertAlmostEqual(results.zRange().upper(), 72.50000, 2) - else: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 1), - { - 1041.8: 53.5, - 1042.4: 53.5, - 1049.5: 53.5, - 1070.2: 53.5, - 1073.1: 53.5, - 1074.8: 53.5, - 1078.9: 56.0, - 1083.9: 56.0, - 1091.1: 56.0, - 1186.8: 62.3, - 1189.8: 62.3, - 1192.7: 62.3, - 1199.2: 62.2, - 1450.0: 67.0, - 1455.6: 67.0, - 1458.1: 67.0, - }, - ) - self.assertAlmostEqual(results.zRange().lower(), 53.5, 2) - self.assertAlmostEqual(results.zRange().upper(), 74.00000, 2) + self.assertEqual( + self.round_dict(results.distanceToHeightMap(), 1), + { + 1041.8: 60.3, + 1042.4: 60.2, + 1049.5: 60.2, + 1070.2: 60.2, + 1073.1: 60.2, + 1074.8: 60.3, + 1078.9: 62.0, + 1083.9: 62.0, + 1091.1: 62.0, + 1186.8: 59.3, + 1189.8: 59.2, + 1192.7: 59.2, + 1199.2: 59.2, + 1450.0: 65.5, + 1455.6: 65.5, + 1458.1: 65.5, + }, + ) + self.assertAlmostEqual(results.zRange().lower(), 59.2499, 2) + self.assertAlmostEqual(results.zRange().upper(), 72.50000, 2) - if QgsProjUtils.projVersionMajor() >= 8: - self.assertCountEqual( - [g.asWkt(1) for g in results.asGeometries()], - [ - "MultiPolygon Z (((-346718.7 6632419.8 60.3, -346712 6632417.4 60.3, -346712 6632417.4 67.3, -346718.7 6632419.8 67.3, -346718.7 6632419.8 60.3)),((-346719.3 6632420 60.3, -346718.7 6632419.8 60.2, -346718.7 6632419.8 67.3, -346719.3 6632420 67.3, -346719.3 6632420 60.3)),((-346689.7 6632409.5 60.3, -346688.2 6632409 60.3, -346688.2 6632409 67.3, -346689.7 6632409.5 67.3, -346689.7 6632409.5 60.3)),((-346692.5 6632410.5 60.3, -346689.7 6632409.5 60.3, -346689.7 6632409.5 67.3, -346692.5 6632410.5 67.3, -346692.5 6632410.5 60.3)))", - "MultiPolygon Z (((-346684.3 6632407.6 62, -346679.6 6632406 62, -346679.6 6632406 69, -346684.3 6632407.6 69, -346684.3 6632407.6 62)),((-346679.6 6632406 62, -346672.8 6632403.6 62, -346672.8 6632403.6 69, -346679.6 6632406 69, -346679.6 6632406 62)))", - "MultiPolygon Z (((-346582.6 6632371.7 59.3, -346579.7 6632370.7 59.3, -346579.7 6632370.7 66.3, -346582.6 6632371.7 66.3, -346582.6 6632371.7 59.3)),((-346579.7 6632370.7 59.3, -346577 6632369.7 59.2, -346570.8 6632367.9 59.3, -346570.8 6632367.9 66.3, -346577 6632369.7 66.3, -346579.7 6632370.7 66.3, -346579.7 6632370.7 59.3)))", - "MultiPolygon Z (((-346387.6 6632223.9 65.5, -346384.8 6632219 65.5, -346384.8 6632219 72.5, -346387.6 6632223.9 72.5, -346387.6 6632223.9 65.5)),((-346384.8 6632219 65.5, -346383.5 6632216.9 65.5, -346383.5 6632216.9 72.5, -346384.8 6632219 72.5, -346384.8 6632219 65.5)))", - ], - ) - else: - self.assertCountEqual( - [g.asWkt(1) for g in results.asGeometries()], - [ - "MultiPolygon Z (((-346684.3 6632407.6 56, -346679.6 6632406 56, -346679.6 6632406 63, -346684.3 6632407.6 63, -346684.3 6632407.6 56)),((-346679.6 6632406 56, -346672.8 6632403.6 56, -346672.8 6632403.6 63, -346679.6 6632406 63, -346679.6 6632406 56)))", - "MultiPolygon Z (((-346718.7 6632419.8 53.5, -346712 6632417.4 53.5, -346712 6632417.4 60.5, -346718.7 6632419.8 60.5, -346718.7 6632419.8 53.5)),((-346719.3 6632420 53.5, -346718.7 6632419.8 53.5, -346718.7 6632419.8 60.5, -346719.3 6632420 60.5, -346719.3 6632420 53.5)),((-346689.7 6632409.5 53.5, -346688.2 6632409 53.5, -346688.2 6632409 60.5, -346689.7 6632409.5 60.5, -346689.7 6632409.5 53.5)),((-346692.5 6632410.5 53.5, -346689.7 6632409.5 53.5, -346689.7 6632409.5 60.5, -346692.5 6632410.5 60.5, -346692.5 6632410.5 53.5)))", - "MultiPolygon Z (((-346387.6 6632223.9 67, -346384.8 6632219 67, -346384.8 6632219 74, -346387.6 6632223.9 74, -346387.6 6632223.9 67)),((-346384.8 6632219 67, -346383.5 6632216.9 67, -346383.5 6632216.9 74, -346384.8 6632219 74, -346384.8 6632219 67)))", - "MultiPolygon Z (((-346582.6 6632371.7 62.3, -346579.7 6632370.7 62.3, -346579.7 6632370.7 69.3, -346582.6 6632371.7 69.3, -346582.6 6632371.7 62.3)),((-346579.7 6632370.7 62.3, -346577 6632369.7 62.3, -346570.8 6632367.9 62.3, -346570.8 6632367.9 69.3, -346577 6632369.7 69.3, -346579.7 6632370.7 69.3, -346579.7 6632370.7 62.3)))", - ], - ) + self.assertCountEqual( + [g.asWkt(1) for g in results.asGeometries()], + [ + "MultiPolygon Z (((-346718.7 6632419.8 60.3, -346712 6632417.4 60.3, -346712 6632417.4 67.3, -346718.7 6632419.8 67.3, -346718.7 6632419.8 60.3)),((-346719.3 6632420 60.3, -346718.7 6632419.8 60.2, -346718.7 6632419.8 67.3, -346719.3 6632420 67.3, -346719.3 6632420 60.3)),((-346689.7 6632409.5 60.3, -346688.2 6632409 60.3, -346688.2 6632409 67.3, -346689.7 6632409.5 67.3, -346689.7 6632409.5 60.3)),((-346692.5 6632410.5 60.3, -346689.7 6632409.5 60.3, -346689.7 6632409.5 67.3, -346692.5 6632410.5 67.3, -346692.5 6632410.5 60.3)))", + "MultiPolygon Z (((-346684.3 6632407.6 62, -346679.6 6632406 62, -346679.6 6632406 69, -346684.3 6632407.6 69, -346684.3 6632407.6 62)),((-346679.6 6632406 62, -346672.8 6632403.6 62, -346672.8 6632403.6 69, -346679.6 6632406 69, -346679.6 6632406 62)))", + "MultiPolygon Z (((-346582.6 6632371.7 59.3, -346579.7 6632370.7 59.3, -346579.7 6632370.7 66.3, -346582.6 6632371.7 66.3, -346582.6 6632371.7 59.3)),((-346579.7 6632370.7 59.3, -346577 6632369.7 59.2, -346570.8 6632367.9 59.3, -346570.8 6632367.9 66.3, -346577 6632369.7 66.3, -346579.7 6632370.7 66.3, -346579.7 6632370.7 59.3)))", + "MultiPolygon Z (((-346387.6 6632223.9 65.5, -346384.8 6632219 65.5, -346384.8 6632219 72.5, -346387.6 6632223.9 72.5, -346387.6 6632223.9 65.5)),((-346384.8 6632219 65.5, -346383.5 6632216.9 65.5, -346383.5 6632216.9 72.5, -346384.8 6632219 72.5, -346384.8 6632219 65.5)))", + ], + ) def testPolygonGenerationRelativeExtrusionTolerance(self): vl = QgsVectorLayer("PolygonZ?crs=EPSG:27700", "lines", "memory") @@ -1428,81 +1164,45 @@ def testPolygonGenerationRelativeExtrusionTolerance(self): self.assertTrue(generator.generateProfile()) results = generator.takeResults() - if QgsProjUtils.projVersionMajor() >= 8: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 1), - { - 1041.0: 60.2, - 1042.2: 60.2, - 1042.9: 60.2, - 1048.2: 60.2, - 1050.8: 60.2, - 1066.9: 60.2, - 1073.4: 60.2, - 1076.2: 60.2, - 1077.9: 62.0, - 1079.9: 62.0, - 1089.9: 62.0, - 1092.2: 62.0, - 1185.4: 59.2, - 1188.2: 59.2, - 1192.6: 59.2, - 1192.7: 59.2, - 1197.9: 59.2, - 1200.4: 59.2, - 1449.3: 65.5, - 1450.1: 65.5, - 1451.1: 65.5, - 1458.1: 65.5, - }, - ) - self.assertAlmostEqual(results.zRange().lower(), 59.25, 2) - self.assertAlmostEqual(results.zRange().upper(), 65.5, 2) - else: - self.assertEqual( - self.round_dict(results.distanceToHeightMap(), 1), - { - 1041.8: 53.5, - 1042.4: 53.5, - 1049.5: 53.5, - 1070.2: 53.5, - 1073.1: 53.5, - 1074.8: 53.5, - 1078.9: 56.0, - 1083.9: 56.0, - 1091.1: 56.0, - 1186.8: 62.3, - 1189.8: 62.3, - 1192.7: 62.3, - 1199.2: 62.2, - 1450.0: 67.0, - 1455.6: 67.0, - 1458.1: 67.0, - }, - ) - self.assertAlmostEqual(results.zRange().lower(), 53.5, 2) - self.assertAlmostEqual(results.zRange().upper(), 74.00000, 2) + self.assertEqual( + self.round_dict(results.distanceToHeightMap(), 1), + { + 1041.0: 60.2, + 1042.2: 60.2, + 1042.9: 60.2, + 1048.2: 60.2, + 1050.8: 60.2, + 1066.9: 60.2, + 1073.4: 60.2, + 1076.2: 60.2, + 1077.9: 62.0, + 1079.9: 62.0, + 1089.9: 62.0, + 1092.2: 62.0, + 1185.4: 59.2, + 1188.2: 59.2, + 1192.6: 59.2, + 1192.7: 59.2, + 1197.9: 59.2, + 1200.4: 59.2, + 1449.3: 65.5, + 1450.1: 65.5, + 1451.1: 65.5, + 1458.1: 65.5, + }, + ) + self.assertAlmostEqual(results.zRange().lower(), 59.25, 2) + self.assertAlmostEqual(results.zRange().upper(), 65.5, 2) - if QgsProjUtils.projVersionMajor() >= 8: - self.assertCountEqual( - [g.asWkt(1) for g in results.asGeometries()], - [ - "MultiLineString Z ((-346696.3 6632409.8 60.2, -346688.9 6632411.2 60.2, -346687.5 6632406.6 60.2),(-346718.9 6632417.7 60.2, -346719.5 6632421.6 60.2, -346718.2 6632421.7 60.2, -346712.5 6632419.7 60.2, -346711.5 6632415.1 60.2))", - "LineString Z (-346684.1 6632405.4 62, -346684.6 6632409.8 62, -346673.3 6632405.9 62, -346672.4 6632401.3 62)", - "LineString Z (-346571.4 6632370.2 59.3, -346570.2 6632365.6 59.3, -346577.6 6632367.8 59.3, -346577.7 6632367.9 59.3, -346581.9 6632369.4 59.3, -346583.2 6632374 59.3, -346576.4 6632371.6 59.3)", - "LineString Z (-346381.8 6632217.9 65.5, -346385.3 6632215.9 65.5, -346388.7 6632221.9 65.5, -346387 6632224.9 65.5, -346385.8 6632224.7 65.5)", - ], - ) - else: - self.assertCountEqual( - [g.asWkt(1) for g in results.asGeometries()], - [ - "MultiPolygon Z (((-346684.3 6632407.6 56, -346679.6 6632406 56, -346679.6 6632406 63, -346684.3 6632407.6 63, -346684.3 6632407.6 56)),((-346679.6 6632406 56, -346672.8 6632403.6 56, -346672.8 6632403.6 63, -346679.6 6632406 63, -346679.6 6632406 56)))", - "MultiPolygon Z (((-346718.7 6632419.8 53.5, -346712 6632417.4 53.5, -346712 6632417.4 60.5, -346718.7 6632419.8 60.5, -346718.7 6632419.8 53.5)),((-346719.3 6632420 53.5, -346718.7 6632419.8 53.5, -346718.7 6632419.8 60.5, -346719.3 6632420 60.5, -346719.3 6632420 53.5)),((-346689.7 6632409.5 53.5, -346688.2 6632409 53.5, -346688.2 6632409 60.5, -346689.7 6632409.5 60.5, -346689.7 6632409.5 53.5)),((-346692.5 6632410.5 53.5, -346689.7 6632409.5 53.5, -346689.7 6632409.5 60.5, -346692.5 6632410.5 60.5, -346692.5 6632410.5 53.5)))", - "MultiPolygon Z (((-346387.6 6632223.9 67, -346384.8 6632219 67, -346384.8 6632219 74, -346387.6 6632223.9 74, -346387.6 6632223.9 67)),((-346384.8 6632219 67, -346383.5 6632216.9 67, -346383.5 6632216.9 74, -346384.8 6632219 74, -346384.8 6632219 67)))", - "MultiPolygon Z (((-346582.6 6632371.7 62.3, -346579.7 6632370.7 62.3, -346579.7 6632370.7 69.3, -346582.6 6632371.7 69.3, -346582.6 6632371.7 62.3)),((-346579.7 6632370.7 62.3, -346577 6632369.7 62.3, -346570.8 6632367.9 62.3, -346570.8 6632367.9 69.3, -346577 6632369.7 69.3, -346579.7 6632370.7 69.3, -346579.7 6632370.7 62.3)))", - ], - ) + self.assertCountEqual( + [g.asWkt(1) for g in results.asGeometries()], + [ + "MultiLineString Z ((-346696.3 6632409.8 60.2, -346688.9 6632411.2 60.2, -346687.5 6632406.6 60.2),(-346718.9 6632417.7 60.2, -346719.5 6632421.6 60.2, -346718.2 6632421.7 60.2, -346712.5 6632419.7 60.2, -346711.5 6632415.1 60.2))", + "LineString Z (-346684.1 6632405.4 62, -346684.6 6632409.8 62, -346673.3 6632405.9 62, -346672.4 6632401.3 62)", + "LineString Z (-346571.4 6632370.2 59.3, -346570.2 6632365.6 59.3, -346577.6 6632367.8 59.3, -346577.7 6632367.9 59.3, -346581.9 6632369.4 59.3, -346583.2 6632374 59.3, -346576.4 6632371.6 59.3)", + "LineString Z (-346381.8 6632217.9 65.5, -346385.3 6632215.9 65.5, -346388.7 6632221.9 65.5, -346387 6632224.9 65.5, -346385.8 6632224.7 65.5)", + ], + ) def test25DPolygonGeneration(self): vl = QgsVectorLayer("PolygonZ?crs=EPSG:2056", "lines", "memory") diff --git a/tests/testdata/analysis/idw_interpolation.tif b/tests/testdata/analysis/idw_interpolation.tif new file mode 100644 index 000000000000..d961111262f4 Binary files /dev/null and b/tests/testdata/analysis/idw_interpolation.tif differ diff --git a/tests/testdata/analysis/tin_interpolation.tif b/tests/testdata/analysis/tin_interpolation.tif new file mode 100644 index 000000000000..c3d416147497 Binary files /dev/null and b/tests/testdata/analysis/tin_interpolation.tif differ diff --git a/tests/testdata/control_images/3d/expected_4978_2D_line_rendering/expected_4978_2D_line_rendering_mask.png b/tests/testdata/control_images/3d/expected_4978_2D_line_rendering/expected_4978_2D_line_rendering_mask.png new file mode 100644 index 000000000000..34cb6f801188 Binary files /dev/null and b/tests/testdata/control_images/3d/expected_4978_2D_line_rendering/expected_4978_2D_line_rendering_mask.png differ diff --git a/tests/testdata/control_images/3d/expected_virtual_pointcloud_3d_extents/default/expected_virtual_pointcloud_3d_extents.png b/tests/testdata/control_images/3d/expected_virtual_pointcloud_3d_extents/default/expected_virtual_pointcloud_3d_extents.png new file mode 100644 index 000000000000..78cd6e70adc5 Binary files /dev/null and b/tests/testdata/control_images/3d/expected_virtual_pointcloud_3d_extents/default/expected_virtual_pointcloud_3d_extents.png differ diff --git a/tests/testdata/control_images/3d/expected_virtual_pointcloud_3d_extents/qt6/expected_virtual_pointcloud_3d_extents.png b/tests/testdata/control_images/3d/expected_virtual_pointcloud_3d_extents/qt6/expected_virtual_pointcloud_3d_extents.png new file mode 100755 index 000000000000..6c30596d7d21 Binary files /dev/null and b/tests/testdata/control_images/3d/expected_virtual_pointcloud_3d_extents/qt6/expected_virtual_pointcloud_3d_extents.png differ diff --git a/tests/testdata/control_images/3d/expected_virtual_pointcloud_3d_overview/default/expected_virtual_pointcloud_3d_overview.png b/tests/testdata/control_images/3d/expected_virtual_pointcloud_3d_overview/default/expected_virtual_pointcloud_3d_overview.png new file mode 100644 index 000000000000..e72fe0fe5d2c Binary files /dev/null and b/tests/testdata/control_images/3d/expected_virtual_pointcloud_3d_overview/default/expected_virtual_pointcloud_3d_overview.png differ diff --git a/tests/testdata/control_images/3d/expected_virtual_pointcloud_3d_overview/qt6/expected_virtual_pointcloud_3d_overview.png b/tests/testdata/control_images/3d/expected_virtual_pointcloud_3d_overview/qt6/expected_virtual_pointcloud_3d_overview.png new file mode 100644 index 000000000000..2fd86a008494 Binary files /dev/null and b/tests/testdata/control_images/3d/expected_virtual_pointcloud_3d_overview/qt6/expected_virtual_pointcloud_3d_overview.png differ diff --git a/tests/testdata/control_images/labelingengine/expected_data_defined_tabs/expected_data_defined_tabs.png b/tests/testdata/control_images/labelingengine/expected_data_defined_tabs/expected_data_defined_tabs.png new file mode 100644 index 000000000000..4e20e4a98fe8 Binary files /dev/null and b/tests/testdata/control_images/labelingengine/expected_data_defined_tabs/expected_data_defined_tabs.png differ diff --git a/tests/testdata/control_images/adjacent_tiles/expected_adjacent_dashed_line/expected_adjacent_dashed_line.png b/tests/testdata/control_images/map_renderer/expected_adjacent_dashed_line/expected_adjacent_dashed_line.png similarity index 100% rename from tests/testdata/control_images/adjacent_tiles/expected_adjacent_dashed_line/expected_adjacent_dashed_line.png rename to tests/testdata/control_images/map_renderer/expected_adjacent_dashed_line/expected_adjacent_dashed_line.png diff --git a/tests/testdata/control_images/adjacent_tiles/expected_adjacent_dashed_line/expected_adjacent_dashed_line_mask.png b/tests/testdata/control_images/map_renderer/expected_adjacent_dashed_line/expected_adjacent_dashed_line_mask.png similarity index 100% rename from tests/testdata/control_images/adjacent_tiles/expected_adjacent_dashed_line/expected_adjacent_dashed_line_mask.png rename to tests/testdata/control_images/map_renderer/expected_adjacent_dashed_line/expected_adjacent_dashed_line_mask.png diff --git a/tests/testdata/control_images/adjacent_tiles/expected_adjacent_line_fill/expected_adjacent_line_fill.png b/tests/testdata/control_images/map_renderer/expected_adjacent_line_fill/expected_adjacent_line_fill.png similarity index 100% rename from tests/testdata/control_images/adjacent_tiles/expected_adjacent_line_fill/expected_adjacent_line_fill.png rename to tests/testdata/control_images/map_renderer/expected_adjacent_line_fill/expected_adjacent_line_fill.png diff --git a/tests/testdata/control_images/adjacent_tiles/expected_adjacent_marker_fill/expected_adjacent_marker_fill.png b/tests/testdata/control_images/map_renderer/expected_adjacent_marker_fill/expected_adjacent_marker_fill.png similarity index 100% rename from tests/testdata/control_images/adjacent_tiles/expected_adjacent_marker_fill/expected_adjacent_marker_fill.png rename to tests/testdata/control_images/map_renderer/expected_adjacent_marker_fill/expected_adjacent_marker_fill.png diff --git a/tests/testdata/control_images/adjacent_tiles/expected_adjacent_marker_fill/expected_adjacent_marker_fill_mask.png b/tests/testdata/control_images/map_renderer/expected_adjacent_marker_fill/expected_adjacent_marker_fill_mask.png similarity index 100% rename from tests/testdata/control_images/adjacent_tiles/expected_adjacent_marker_fill/expected_adjacent_marker_fill_mask.png rename to tests/testdata/control_images/map_renderer/expected_adjacent_marker_fill/expected_adjacent_marker_fill_mask.png diff --git a/tests/testdata/control_images/expected_maprender/expected_maprender.png b/tests/testdata/control_images/map_renderer/expected_maprender/expected_maprender.png similarity index 100% rename from tests/testdata/control_images/expected_maprender/expected_maprender.png rename to tests/testdata/control_images/map_renderer/expected_maprender/expected_maprender.png diff --git a/tests/testdata/control_images/expected_maprender/expected_maprender_mask.png b/tests/testdata/control_images/map_renderer/expected_maprender/expected_maprender_mask.png similarity index 100% rename from tests/testdata/control_images/expected_maprender/expected_maprender_mask.png rename to tests/testdata/control_images/map_renderer/expected_maprender/expected_maprender_mask.png diff --git a/tests/testdata/control_images/map_renderer/expected_render_shading_1/expected_render_shading_1_mask.png b/tests/testdata/control_images/map_renderer/expected_render_shading_1/expected_render_shading_1_mask.png new file mode 100644 index 000000000000..74a1fac149c6 Binary files /dev/null and b/tests/testdata/control_images/map_renderer/expected_render_shading_1/expected_render_shading_1_mask.png differ diff --git a/tests/testdata/control_images/map_renderer/expected_render_shading_2/expected_render_shading_2_mask.png b/tests/testdata/control_images/map_renderer/expected_render_shading_2/expected_render_shading_2_mask.png new file mode 100644 index 000000000000..42637ab9599b Binary files /dev/null and b/tests/testdata/control_images/map_renderer/expected_render_shading_2/expected_render_shading_2_mask.png differ diff --git a/tests/testdata/control_images/map_renderer/expected_render_shading_3/expected_render_shading_3_mask.png b/tests/testdata/control_images/map_renderer/expected_render_shading_3/expected_render_shading_3_mask.png new file mode 100644 index 000000000000..86ce66c658b0 Binary files /dev/null and b/tests/testdata/control_images/map_renderer/expected_render_shading_3/expected_render_shading_3_mask.png differ diff --git a/tests/testdata/control_images/map_renderer/expected_render_shading_4/expected_render_shading_4_mask.png b/tests/testdata/control_images/map_renderer/expected_render_shading_4/expected_render_shading_4_mask.png new file mode 100644 index 000000000000..f61daaafa857 Binary files /dev/null and b/tests/testdata/control_images/map_renderer/expected_render_shading_4/expected_render_shading_4_mask.png differ diff --git a/tests/testdata/control_images/map_renderer/expected_render_shading_5/expected_render_shading_5_mask.png b/tests/testdata/control_images/map_renderer/expected_render_shading_5/expected_render_shading_5_mask.png new file mode 100644 index 000000000000..77cc3762ea9a Binary files /dev/null and b/tests/testdata/control_images/map_renderer/expected_render_shading_5/expected_render_shading_5_mask.png differ diff --git a/tests/testdata/control_images/map_renderer/expected_staged_render_raster/expected_staged_render_raster_mask.png b/tests/testdata/control_images/map_renderer/expected_staged_render_raster/expected_staged_render_raster_mask.png index 028cab3f52ea..623818a12f99 100644 Binary files a/tests/testdata/control_images/map_renderer/expected_staged_render_raster/expected_staged_render_raster_mask.png and b/tests/testdata/control_images/map_renderer/expected_staged_render_raster/expected_staged_render_raster_mask.png differ diff --git a/tests/testdata/control_images/pointcloud_editing/expected_classified_render_filtered/expected_classified_render_filtered.png b/tests/testdata/control_images/pointcloud_editing/expected_classified_render_filtered/expected_classified_render_filtered.png new file mode 100644 index 000000000000..eb1855bd28fe Binary files /dev/null and b/tests/testdata/control_images/pointcloud_editing/expected_classified_render_filtered/expected_classified_render_filtered.png differ diff --git a/tests/testdata/control_images/pointcloud_editing/expected_classified_render_filtered_edit/expected_classified_render_filtered_edit.png b/tests/testdata/control_images/pointcloud_editing/expected_classified_render_filtered_edit/expected_classified_render_filtered_edit.png new file mode 100644 index 000000000000..5998dda8e2ad Binary files /dev/null and b/tests/testdata/control_images/pointcloud_editing/expected_classified_render_filtered_edit/expected_classified_render_filtered_edit.png differ diff --git a/tests/testdata/control_images/pointcloud_editing/expected_classified_render_filtered_edit_saved/expected_classified_render_filtered_edit_saved.png b/tests/testdata/control_images/pointcloud_editing/expected_classified_render_filtered_edit_saved/expected_classified_render_filtered_edit_saved.png new file mode 100644 index 000000000000..059d514a3065 Binary files /dev/null and b/tests/testdata/control_images/pointcloud_editing/expected_classified_render_filtered_edit_saved/expected_classified_render_filtered_edit_saved.png differ diff --git a/tests/testdata/control_images/pointcloudrenderer/expected_classified_render_overview/expected_classified_render_overview.png b/tests/testdata/control_images/pointcloudrenderer/expected_classified_render_overview/expected_classified_render_overview.png old mode 100644 new mode 100755 index 95b6090cbd4c..bbbf78375aa8 Binary files a/tests/testdata/control_images/pointcloudrenderer/expected_classified_render_overview/expected_classified_render_overview.png and b/tests/testdata/control_images/pointcloudrenderer/expected_classified_render_overview/expected_classified_render_overview.png differ diff --git a/tests/testdata/control_images/qgis_server/WMS_GetPrint_Highlight_Empty_Labels/WMS_GetPrint_Highlight_Empty_Labels.png b/tests/testdata/control_images/qgis_server/WMS_GetPrint_Highlight_Empty_Labels/WMS_GetPrint_Highlight_Empty_Labels.png new file mode 100644 index 000000000000..202dbbc3b525 Binary files /dev/null and b/tests/testdata/control_images/qgis_server/WMS_GetPrint_Highlight_Empty_Labels/WMS_GetPrint_Highlight_Empty_Labels.png differ diff --git a/tests/testdata/control_images/qgis_server/WMS_GetPrint_Highlight_Empty_Labels/WMS_GetPrint_Highlight_Empty_Labels_mask.png b/tests/testdata/control_images/qgis_server/WMS_GetPrint_Highlight_Empty_Labels/WMS_GetPrint_Highlight_Empty_Labels_mask.png new file mode 100644 index 000000000000..e10f1634c450 Binary files /dev/null and b/tests/testdata/control_images/qgis_server/WMS_GetPrint_Highlight_Empty_Labels/WMS_GetPrint_Highlight_Empty_Labels_mask.png differ diff --git a/tests/testdata/control_images/rasterlayerrenderer/expected_painterclip_region/expected_painterclip_region_mask.png b/tests/testdata/control_images/rasterlayerrenderer/expected_painterclip_region/expected_painterclip_region_mask.png index a69f45eda8b9..089902b96a51 100644 Binary files a/tests/testdata/control_images/rasterlayerrenderer/expected_painterclip_region/expected_painterclip_region_mask.png and b/tests/testdata/control_images/rasterlayerrenderer/expected_painterclip_region/expected_painterclip_region_mask.png differ diff --git a/tests/testdata/control_images/text_renderer/text_tab_multiple_html/text_tab_multiple_html.png b/tests/testdata/control_images/text_renderer/text_tab_multiple_html/text_tab_multiple_html.png new file mode 100644 index 000000000000..db00646f40dd Binary files /dev/null and b/tests/testdata/control_images/text_renderer/text_tab_multiple_html/text_tab_multiple_html.png differ diff --git a/tests/testdata/control_images/text_renderer/text_tab_multiple_html/text_tab_multiple_html_mask.png b/tests/testdata/control_images/text_renderer/text_tab_multiple_html/text_tab_multiple_html_mask.png new file mode 100644 index 000000000000..9b6b0bc8ae98 Binary files /dev/null and b/tests/testdata/control_images/text_renderer/text_tab_multiple_html/text_tab_multiple_html_mask.png differ diff --git a/tests/testdata/control_images/text_renderer/wrap_small_rect_one_word/wrap_small_rect_one_word.png b/tests/testdata/control_images/text_renderer/wrap_small_rect_one_word/wrap_small_rect_one_word.png new file mode 100644 index 000000000000..0a654b58b041 Binary files /dev/null and b/tests/testdata/control_images/text_renderer/wrap_small_rect_one_word/wrap_small_rect_one_word.png differ diff --git a/tests/testdata/control_images/text_renderer/wrap_small_rect_one_word/wrap_small_rect_one_word_mask.png b/tests/testdata/control_images/text_renderer/wrap_small_rect_one_word/wrap_small_rect_one_word_mask.png new file mode 100644 index 000000000000..8d6fcb6b1701 Binary files /dev/null and b/tests/testdata/control_images/text_renderer/wrap_small_rect_one_word/wrap_small_rect_one_word_mask.png differ diff --git a/tests/testdata/mapinfo/multipoly.dat b/tests/testdata/mapinfo/multipoly.dat new file mode 100644 index 000000000000..947eea845d8c Binary files /dev/null and b/tests/testdata/mapinfo/multipoly.dat differ diff --git a/tests/testdata/mapinfo/multipoly.id b/tests/testdata/mapinfo/multipoly.id new file mode 100644 index 000000000000..fd2993056443 Binary files /dev/null and b/tests/testdata/mapinfo/multipoly.id differ diff --git a/tests/testdata/mapinfo/multipoly.map b/tests/testdata/mapinfo/multipoly.map new file mode 100644 index 000000000000..5a093cf1a056 Binary files /dev/null and b/tests/testdata/mapinfo/multipoly.map differ diff --git a/tests/testdata/mapinfo/multipoly.tab b/tests/testdata/mapinfo/multipoly.tab new file mode 100644 index 000000000000..13ec9363dd03 --- /dev/null +++ b/tests/testdata/mapinfo/multipoly.tab @@ -0,0 +1,9 @@ +!table +!version 300 +!charset Neutral + +Definition Table + Type NATIVE Charset "Neutral" + Fields 2 + fid Decimal (20,0) ; + field1 Char (12) ; diff --git a/tests/testdata/point_clouds/virtual/sunshine-coast/0-0.copc.laz b/tests/testdata/point_clouds/virtual/sunshine-coast/0-0.copc.laz index 187f03a3c9ca..bea88f11cf69 100644 Binary files a/tests/testdata/point_clouds/virtual/sunshine-coast/0-0.copc.laz and b/tests/testdata/point_clouds/virtual/sunshine-coast/0-0.copc.laz differ diff --git a/tests/testdata/point_clouds/virtual/sunshine-coast/0-1.copc.laz b/tests/testdata/point_clouds/virtual/sunshine-coast/0-1.copc.laz index c9790a104afc..285c2429e910 100644 Binary files a/tests/testdata/point_clouds/virtual/sunshine-coast/0-1.copc.laz and b/tests/testdata/point_clouds/virtual/sunshine-coast/0-1.copc.laz differ diff --git a/tests/testdata/point_clouds/virtual/sunshine-coast/1-0.copc.laz b/tests/testdata/point_clouds/virtual/sunshine-coast/1-0.copc.laz index e42d651409c6..f5b17255c3ae 100644 Binary files a/tests/testdata/point_clouds/virtual/sunshine-coast/1-0.copc.laz and b/tests/testdata/point_clouds/virtual/sunshine-coast/1-0.copc.laz differ diff --git a/tests/testdata/point_clouds/virtual/sunshine-coast/1-1.copc.laz b/tests/testdata/point_clouds/virtual/sunshine-coast/1-1.copc.laz index e08a4a146bc9..cf99ee34c391 100644 Binary files a/tests/testdata/point_clouds/virtual/sunshine-coast/1-1.copc.laz and b/tests/testdata/point_clouds/virtual/sunshine-coast/1-1.copc.laz differ diff --git a/tests/testdata/point_clouds/virtual/sunshine-coast/combined-with-overview-overview.copc.laz b/tests/testdata/point_clouds/virtual/sunshine-coast/combined-with-overview-overview.copc.laz index ea5610819146..eceec0f416e7 100644 Binary files a/tests/testdata/point_clouds/virtual/sunshine-coast/combined-with-overview-overview.copc.laz and b/tests/testdata/point_clouds/virtual/sunshine-coast/combined-with-overview-overview.copc.laz differ diff --git a/tests/testdata/point_clouds/virtual/sunshine-coast/combined-with-overview.vpc b/tests/testdata/point_clouds/virtual/sunshine-coast/combined-with-overview.vpc index 054337c51212..46d7237db9e9 100644 --- a/tests/testdata/point_clouds/virtual/sunshine-coast/combined-with-overview.vpc +++ b/tests/testdata/point_clouds/virtual/sunshine-coast/combined-with-overview.vpc @@ -8,33 +8,33 @@ "https://stac-extensions.github.io/pointcloud/v1.0.0/schema.json", "https://stac-extensions.github.io/projection/v1.1.0/schema.json" ], - "id": "0-0.copc", + "id": "0-0", "geometry": { "coordinates": [ [ [ - 498062.0, - 7050992.85, + 152.9805245779768, + -26.66206747620571, 74.68 ], [ - 498062.0, - 7050995.82, + 152.9805245825292, + -26.662040659997626, 74.68 ], [ - 498064.98, - 7050995.82, + 152.98055452924817, + -26.662040664098438, 75.16 ], [ - 498064.98, - 7050992.85, + 152.9805545247028, + -26.662067480306522, 75.16 ], [ - 498062.0, - 7050992.85, + 152.9805245779768, + -26.66206747620571, 74.68 ] ] @@ -42,11 +42,11 @@ "type": "Polygon" }, "bbox": [ - 498062.0, - 7050992.85, + 152.9805245779768, + -26.662067480306522, 74.68, - 498064.98, - 7050995.82, + 152.98055452924817, + -26.662040659997626, 75.16 ], "properties": { @@ -201,7 +201,7 @@ ], "type": "Polygon" }, - "proj:wkt2": "" + "proj:wkt2": "PROJCS[\"GDA94 / MGA zone 56\",GEOGCS[\"GDA94\",DATUM[\"Geocentric_Datum_of_Australia_1994\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6283\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4283\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",153],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",10000000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"28356\"]]" }, "links": [], "assets": { @@ -226,33 +226,33 @@ "https://stac-extensions.github.io/pointcloud/v1.0.0/schema.json", "https://stac-extensions.github.io/projection/v1.1.0/schema.json" ], - "id": "0-1.copc", + "id": "0-1", "geometry": { "coordinates": [ [ [ - 498062.04, - 7050995.84, + 152.9805249845292, + -26.662040479472196, 74.64 ], [ - 498062.04, - 7050997.03, + 152.9805249863532, + -26.66202973493088, 74.64 ], [ - 498064.91, - 7050997.03, + 152.9805538276536, + -26.662029738880342, 79.0 ], [ - 498064.91, - 7050995.84, + 152.98055382583235, + -26.66204048342166, 79.0 ], [ - 498062.04, - 7050995.84, + 152.9805249845292, + -26.662040479472196, 74.64 ] ] @@ -260,11 +260,11 @@ "type": "Polygon" }, "bbox": [ - 498062.04, - 7050995.84, + 152.9805249845292, + -26.66204048342166, 74.64, - 498064.91, - 7050997.03, + 152.9805538276536, + -26.66202973493088, 79.0 ], "properties": { @@ -419,7 +419,7 @@ ], "type": "Polygon" }, - "proj:wkt2": "" + "proj:wkt2": "PROJCS[\"GDA94 / MGA zone 56\",GEOGCS[\"GDA94\",DATUM[\"Geocentric_Datum_of_Australia_1994\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6283\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4283\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",153],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",10000000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"28356\"]]" }, "links": [], "assets": { @@ -444,33 +444,33 @@ "https://stac-extensions.github.io/pointcloud/v1.0.0/schema.json", "https://stac-extensions.github.io/projection/v1.1.0/schema.json" ], - "id": "1-0.copc", + "id": "1-0", "geometry": { "coordinates": [ [ [ - 498065.0, - 7050992.84, + 152.98055472567222, + -26.66206757062428, 74.46 ], [ - 498065.0, - 7050995.83, + 152.98055473024814, + -26.66204057383568, 74.46 ], [ - 498067.39, - 7050995.83, + 152.9805787479187, + -26.662040577119992, 74.91 ], [ - 498067.39, - 7050992.84, + 152.98057874334847, + -26.662067573908597, 74.91 ], [ - 498065.0, - 7050992.84, + 152.98055472567222, + -26.66206757062428, 74.46 ] ] @@ -478,11 +478,11 @@ "type": "Polygon" }, "bbox": [ - 498065.0, - 7050992.84, + 152.98055472567222, + -26.662067573908597, 74.46, - 498067.39, - 7050995.83, + 152.9805787479187, + -26.66204057383568, 74.91 ], "properties": { @@ -637,7 +637,7 @@ ], "type": "Polygon" }, - "proj:wkt2": "" + "proj:wkt2": "PROJCS[\"GDA94 / MGA zone 56\",GEOGCS[\"GDA94\",DATUM[\"Geocentric_Datum_of_Australia_1994\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6283\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4283\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",153],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",10000000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"28356\"]]" }, "links": [], "assets": { @@ -662,33 +662,33 @@ "https://stac-extensions.github.io/pointcloud/v1.0.0/schema.json", "https://stac-extensions.github.io/projection/v1.1.0/schema.json" ], - "id": "1-1.copc", + "id": "1-1", "geometry": { "coordinates": [ [ [ - 498065.01, - 7050995.9, + 152.98055483084764, + -26.662039941817586, 74.34 ], [ - 498065.01, - 7050997.04, + 152.98055483259228, + -26.662029648727586, 74.34 ], [ - 498067.32, - 7050997.04, + 152.98057804632188, + -26.66202965190201, 80.02 ], [ - 498067.32, - 7050995.9, + 152.98057804457932, + -26.662039944992003, 80.02 ], [ - 498065.01, - 7050995.9, + 152.98055483084764, + -26.662039941817586, 74.34 ] ] @@ -696,11 +696,11 @@ "type": "Polygon" }, "bbox": [ - 498065.01, - 7050995.9, + 152.98055483084764, + -26.662039944992003, 74.34, - 498067.32, - 7050997.04, + 152.98057804632188, + -26.662029648727586, 80.02 ], "properties": { @@ -855,7 +855,7 @@ ], "type": "Polygon" }, - "proj:wkt2": "" + "proj:wkt2": "PROJCS[\"GDA94 / MGA zone 56\",GEOGCS[\"GDA94\",DATUM[\"Geocentric_Datum_of_Australia_1994\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6283\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4283\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",153],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",10000000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"28356\"]]" }, "links": [], "assets": { diff --git a/tests/testdata/point_clouds/virtual/sunshine-coast/combined.vpc b/tests/testdata/point_clouds/virtual/sunshine-coast/combined.vpc index b353cfea7b03..56a42dd429cc 100644 --- a/tests/testdata/point_clouds/virtual/sunshine-coast/combined.vpc +++ b/tests/testdata/point_clouds/virtual/sunshine-coast/combined.vpc @@ -8,33 +8,33 @@ "https://stac-extensions.github.io/pointcloud/v1.0.0/schema.json", "https://stac-extensions.github.io/projection/v1.1.0/schema.json" ], - "id": "0-0.copc", + "id": "0-0", "geometry": { "coordinates": [ [ [ - 498062.0, - 7050992.85, + 152.9805245779768, + -26.66206747620571, 74.68 ], [ - 498062.0, - 7050995.82, + 152.9805245825292, + -26.662040659997626, 74.68 ], [ - 498064.98, - 7050995.82, + 152.98055452924817, + -26.662040664098438, 75.16 ], [ - 498064.98, - 7050992.85, + 152.9805545247028, + -26.662067480306522, 75.16 ], [ - 498062.0, - 7050992.85, + 152.9805245779768, + -26.66206747620571, 74.68 ] ] @@ -42,11 +42,11 @@ "type": "Polygon" }, "bbox": [ - 498062.0, - 7050992.85, + 152.9805245779768, + -26.662067480306522, 74.68, - 498064.98, - 7050995.82, + 152.98055452924817, + -26.662040659997626, 75.16 ], "properties": { @@ -201,7 +201,7 @@ ], "type": "Polygon" }, - "proj:wkt2": "" + "proj:wkt2": "PROJCS[\"GDA94 / MGA zone 56\",GEOGCS[\"GDA94\",DATUM[\"Geocentric_Datum_of_Australia_1994\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6283\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4283\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",153],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",10000000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"28356\"]]" }, "links": [], "assets": { @@ -220,33 +220,33 @@ "https://stac-extensions.github.io/pointcloud/v1.0.0/schema.json", "https://stac-extensions.github.io/projection/v1.1.0/schema.json" ], - "id": "0-1.copc", + "id": "0-1", "geometry": { "coordinates": [ [ [ - 498062.04, - 7050995.84, + 152.9805249845292, + -26.662040479472196, 74.64 ], [ - 498062.04, - 7050997.03, + 152.9805249863532, + -26.66202973493088, 74.64 ], [ - 498064.91, - 7050997.03, + 152.9805538276536, + -26.662029738880342, 79.0 ], [ - 498064.91, - 7050995.84, + 152.98055382583235, + -26.66204048342166, 79.0 ], [ - 498062.04, - 7050995.84, + 152.9805249845292, + -26.662040479472196, 74.64 ] ] @@ -254,11 +254,11 @@ "type": "Polygon" }, "bbox": [ - 498062.04, - 7050995.84, + 152.9805249845292, + -26.66204048342166, 74.64, - 498064.91, - 7050997.03, + 152.9805538276536, + -26.66202973493088, 79.0 ], "properties": { @@ -413,7 +413,7 @@ ], "type": "Polygon" }, - "proj:wkt2": "" + "proj:wkt2": "PROJCS[\"GDA94 / MGA zone 56\",GEOGCS[\"GDA94\",DATUM[\"Geocentric_Datum_of_Australia_1994\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6283\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4283\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",153],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",10000000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"28356\"]]" }, "links": [], "assets": { @@ -432,33 +432,33 @@ "https://stac-extensions.github.io/pointcloud/v1.0.0/schema.json", "https://stac-extensions.github.io/projection/v1.1.0/schema.json" ], - "id": "1-0.copc", + "id": "1-0", "geometry": { "coordinates": [ [ [ - 498065.0, - 7050992.84, + 152.98055472567222, + -26.66206757062428, 74.46 ], [ - 498065.0, - 7050995.83, + 152.98055473024814, + -26.66204057383568, 74.46 ], [ - 498067.39, - 7050995.83, + 152.9805787479187, + -26.662040577119992, 74.91 ], [ - 498067.39, - 7050992.84, + 152.98057874334847, + -26.662067573908597, 74.91 ], [ - 498065.0, - 7050992.84, + 152.98055472567222, + -26.66206757062428, 74.46 ] ] @@ -466,11 +466,11 @@ "type": "Polygon" }, "bbox": [ - 498065.0, - 7050992.84, + 152.98055472567222, + -26.662067573908597, 74.46, - 498067.39, - 7050995.83, + 152.9805787479187, + -26.66204057383568, 74.91 ], "properties": { @@ -625,7 +625,7 @@ ], "type": "Polygon" }, - "proj:wkt2": "" + "proj:wkt2": "PROJCS[\"GDA94 / MGA zone 56\",GEOGCS[\"GDA94\",DATUM[\"Geocentric_Datum_of_Australia_1994\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6283\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4283\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",153],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",10000000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"28356\"]]" }, "links": [], "assets": { @@ -644,33 +644,33 @@ "https://stac-extensions.github.io/pointcloud/v1.0.0/schema.json", "https://stac-extensions.github.io/projection/v1.1.0/schema.json" ], - "id": "1-1.copc", + "id": "1-1", "geometry": { "coordinates": [ [ [ - 498065.01, - 7050995.9, + 152.98055483084764, + -26.662039941817586, 74.34 ], [ - 498065.01, - 7050997.04, + 152.98055483259228, + -26.662029648727586, 74.34 ], [ - 498067.32, - 7050997.04, + 152.98057804632188, + -26.66202965190201, 80.02 ], [ - 498067.32, - 7050995.9, + 152.98057804457932, + -26.662039944992003, 80.02 ], [ - 498065.01, - 7050995.9, + 152.98055483084764, + -26.662039941817586, 74.34 ] ] @@ -678,11 +678,11 @@ "type": "Polygon" }, "bbox": [ - 498065.01, - 7050995.9, + 152.98055483084764, + -26.662039944992003, 74.34, - 498067.32, - 7050997.04, + 152.98057804632188, + -26.662029648727586, 80.02 ], "properties": { @@ -837,7 +837,7 @@ ], "type": "Polygon" }, - "proj:wkt2": "" + "proj:wkt2": "PROJCS[\"GDA94 / MGA zone 56\",GEOGCS[\"GDA94\",DATUM[\"Geocentric_Datum_of_Australia_1994\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6283\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4283\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",153],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",10000000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"28356\"]]" }, "links": [], "assets": { diff --git a/tests/testdata/qgis_server/wfs_getFeature_1_0_0_EXP_FILTER_invalid_expression_1_0_0.txt b/tests/testdata/qgis_server/wfs_getFeature_1_0_0_EXP_FILTER_invalid_expression_1_0_0.txt index f776977f7f16..2d21070e5a16 100644 --- a/tests/testdata/qgis_server/wfs_getFeature_1_0_0_EXP_FILTER_invalid_expression_1_0_0.txt +++ b/tests/testdata/qgis_server/wfs_getFeature_1_0_0_EXP_FILTER_invalid_expression_1_0_0.txt @@ -4,5 +4,5 @@ Content-Type: text/xml; charset=utf-8 The EXP_FILTER expression has errors: -Function is not known +Function invalid_expression is not known diff --git a/tests/testdata/qgis_server/wmts_getcapabilities.txt b/tests/testdata/qgis_server/wmts_getcapabilities.txt index 55264ba022f8..70a136d99daa 100644 --- a/tests/testdata/qgis_server/wmts_getcapabilities.txt +++ b/tests/testdata/qgis_server/wmts_getcapabilities.txt @@ -63,12 +63,12 @@ Content-Type: text/xml; charset=utf-8 QGIS Server Hello World QGIS Server Hello World - -174.766573 -69.957839 - 177.930819 84.307877 + -180 -69.957839 + 180 84.307877 - -19454925.899 -11055006.823 - 19807168.137 19143772.794 + -20037508.343 -11055006.823 + 20037508.343 19143772.794