diff --git a/.tx/config b/.tx/config
index e7dd5b303fa..4bfd8d6858f 100644
--- a/.tx/config
+++ b/.tx/config
@@ -13,6 +13,7 @@ trans.cs = i18n/qgis_cs.ts
trans.da = i18n/qgis_da.ts
trans.de = i18n/qgis_de.ts
trans.el = i18n/qgis_el.ts
+trans.eo = i18n/qgis_eo.ts
trans.es = i18n/qgis_es.ts
trans.et = i18n/qgis_et.ts
trans.eu = i18n/qgis_eu.ts
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2ab1d46d358..3899cb3dc41 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -564,32 +564,15 @@ IF(COMMAND cmake_policy)
ENDIF(COMMAND cmake_policy)
IF (WIN32)
- SET(DLLIMPORT "__declspec(dllimport)")
- SET(DLLEXPORT "__declspec(dllexport)")
-ELSE (WIN32)
- IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
- SET(DLLEXPORT "__attribute__ ((visibility (\\\"default\\\")))")
- ELSE()
- SET(DLLEXPORT "")
- ENDIF()
-
IF(PEDANTIC AND NOT APPLE)
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-undefined")
ENDIF(PEDANTIC AND NOT APPLE)
-
ENDIF(WIN32)
-ADD_DEFINITIONS("-DCORE_EXPORT=${DLLIMPORT}")
-ADD_DEFINITIONS("-DGUI_EXPORT=${DLLIMPORT}")
-ADD_DEFINITIONS("-DPYTHON_EXPORT=${DLLIMPORT}")
-ADD_DEFINITIONS("-DANALYSIS_EXPORT=${DLLIMPORT}")
-ADD_DEFINITIONS("-DAPP_EXPORT=${DLLIMPORT}")
-ADD_DEFINITIONS("-DCUSTOMWIDGETS_EXPORT=${DLLIMPORT}")
-ADD_DEFINITIONS("-DSERVER_EXPORT=${DLLIMPORT}")
-
SET(CMAKE_CXX_VISIBILITY_PRESET hidden)
+INCLUDE(GenerateExportHeader)
#############################################################
# user-changeable settings which can be used to customize
diff --git a/INSTALL b/INSTALL
index 2cf22094dfa..8ec81eb5c6f 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,10 +1,10 @@
QGIS
Building QGIS from source - step by step
-Monday November 07, 2016
+Monday January 09, 2017
-Last Updated: Monday November 07, 2016
-Last Change : Monday November 07, 2016
+Last Updated: Monday January 09, 2017
+Last Change : Monday January 09, 2017
1. Introduction
@@ -87,7 +87,7 @@ source directory.
2. Overview
===========
-QGIS, like a number of major projects (eg. KDE 4.0), uses CMake
+QGIS, like a number of major projects (e.g., KDE 4.0), uses CMake
(http://www.cmake.org) for building from source.
Following a summary of the required dependencies for building:
@@ -100,14 +100,17 @@ Required build tools:
Required build dependencies:
-- Qt >= 4.8.0
+- Qt >= 5.3.0
- Proj >= 4.4.x
- GEOS >= 3.4
- Sqlite3 >= 3.0.0
-- GDAL/OGR >= 1.4.x
+- SpatiaLite
+- libspatialindex
+- GDAL/OGR >= 2.0
- Qwt >= 5.0 & (< 6.1 with internal QwtPolar)
- expat >= 1.95
- QScintilla2
+- QCA
Optional dependencies:
@@ -118,14 +121,14 @@ Optional dependencies:
- for georeferencer - GSL >= 1.8
- for postgis support and SPIT plugin - PostgreSQL >= 8.0.x
- for gps plugin - gpsbabel
-- for mapserver export and PyQGIS - Python >= 2.3 (2.5+ preferred)
-- for python support - SIP >= 4.12, PyQt >= 4.8.3 must match Qt version, Qscintilla2
+- for mapserver export and PyQGIS - Python >= 3.3
+- for python support - SIP >= 4.12, PyQt >= 5.3 must match Qt version, Qscintilla2
- for qgis mapserver - FastCGI
- for oracle provider - Oracle OCI library
Indirect dependencies:
-Some proprietary formats (eg. ECW and MrSid) supported by GDAL require
+Some proprietary formats (e.g., ECW and MrSid) supported by GDAL require
proprietary third party libraries. QGIS doesn't need any of those itself to
build, but will only support those formats if GDAL is built accordingly. Refer
to http://gdal.org/formats_list.html ff. for instructions how to include
@@ -262,27 +265,55 @@ interactive dialog.
Now on with the build:
- make
- make install
+ make -jX
-It may take a little while to build depending on your platform.
+where X is the number of available cores. Depending on your platform,
+this can speed up the build time considerably.
+
+Then you can directly run from the build directory:
+
+ ./output/bin/qgis
+
+Another option is to install to your system:
+
+ make install
After that you can try to run QGIS:
$HOME/apps/bin/qgis
If all has worked properly the QGIS application should start up and appear
-on your screen. If you get the error message "error while loading shared libraries",
+on your screen. If you get the error message "error while loading shared libraries",
execute this command in your shell.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${HOME}/apps/lib/
+Optionally, if you already know what aspects you want in your custom build
+then you can skip the interactive ccmake .. part by using the cmake -D
+option for each aspect, e.g.:
+
+ cmake -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=${HOME}/apps ..
+
+Also, if you want to speed your build times, you can easily do it with ninja,
+an alternative to make with similar build options.
+
+For example, to configure your build you can do either one of:
+
+ ccmake -G Ninja ..
+
+ cmake -G Ninja -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=${HOME}/apps ..
+
+Build and install with ninja:
+
+ ninja (uses all cores by default; also supports the above described -jX option)
+ ninja install
+
3.8. Building Debian packages
=============================
Instead of creating a personal installation as in the previous step you can
-also create debian package. This is done from the QGIS root directory, where
+also create debian package. This is done from the QGIS root directory, where
you'll find a debian directory.
First you need to install the debian packaging tools once:
diff --git a/NEWS b/NEWS
index 756fcec52af..70118c47c1a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,6 @@
QGIS News
Change history for the QGIS Project
-Monday November 07, 2016
+Monday January 09, 2017
------------------------------------------------------------------------
@@ -39,12 +39,12 @@ Monday November 07, 2016
------------------------------------------------------------------------
-Last Updated: Monday November 07, 2016
-Last Change : Wednesday July 27, 2016
+Last Updated: Monday January 09, 2017
+Last Change : Sunday January 01, 2017
1. What's new in Version 2.16 'Nødebo'?
- ========================================
+ =======================================
This release has following new features:
@@ -814,7 +814,7 @@ changed so we will just provide a bullet list of key new features here.
- Optionally re-use entered attribute values for next digitized feature.
- Allow merging/assigning attribute values to a set of features.-
- - Allow OGR 'save as' without attributes (for eg. DGN/DXF).
+ - Allow OGR 'save as' without attributes (e.g., DGN/DXF).
14.7. Api and Developer Centric
@@ -908,7 +908,7 @@ as' option, you can now specify OGR creation options.
15.3. Labeling (New generation only)
- =====================================
+ ====================================
- Data defined label position in labeling-ng.
- Line wrapping, data defined font and buffer settings for labeling-ng.
@@ -1055,7 +1055,7 @@ we recommend that you use a copy of QGIS from our Long Term Support (LTS)1.0.x
release series. In all other cases we recommend that you use this version.
This release includes around 200 bug fixes, nearly 30 new features and has had
-a lot of love and attention poured in to it to take our favourite desktop GIS
+a lot of love and attention poured in to it to take our favorite desktop GIS
application another step on the road to GIS nirvana! So much has happened in
the 3 months since our last release that it is impossible to document
everything here. Instead we will just highlight a couple of important new
diff --git a/ci/travis/linux/after_script.sh b/ci/travis/linux/after_script.sh
index a3a0dabdfe3..d636b486556 100755
--- a/ci/travis/linux/after_script.sh
+++ b/ci/travis/linux/after_script.sh
@@ -13,4 +13,6 @@
# #
###########################################################################
+ccache -s
+
[ -r /tmp/ctest-important.log ] && cat /tmp/ctest-important.log
diff --git a/ci/travis/linux/install.sh b/ci/travis/linux/install.sh
index 344607830e7..48a0b377580 100755
--- a/ci/travis/linux/install.sh
+++ b/ci/travis/linux/install.sh
@@ -20,6 +20,7 @@ ln -s ${HOME}/osgeo4travis/bin/ccache ${HOME}/osgeo4travis/bin/clang++-${LLVM_VE
ln -s ${HOME}/osgeo4travis/bin/ccache ${HOME}/osgeo4travis/bin/clang-${LLVM_VERSION}
ccache -s
+ccache -z
export CXX="clang++-${LLVM_VERSION}"
export CC="clang-${LLVM_VERSION}"
@@ -38,21 +39,39 @@ CLANG_WARNINGS=""
# Include this line for debug reasons
# -DCMAKE_BUILD_TYPE=RelWithDebInfo \
#
-cmake \
- -DCMAKE_PREFIX_PATH=/home/travis/osgeo4travis \
- -DWITH_STAGED_PLUGINS=ON \
- -DWITH_GRASS=ON \
- -DWITH_GRASS7=ON \
- -DGRASS_PREFIX7=/home/travis/osgeo4travis/grass-7.0.4 \
- -DSUPPRESS_QT_WARNINGS=ON \
- -DENABLE_MODELTEST=ON \
- -DENABLE_PGTEST=ON \
- -DWITH_QSPATIALITE=ON \
- -DWITH_QWTPOLAR=OFF \
- -DWITH_APIDOC=ON \
- -DWITH_ASTYLE=ON \
- -DWITH_SERVER=ON \
- -DWITH_INTERNAL_YAML=OFF \
- -DDISABLE_DEPRECATED=ON \
- -DCXX_EXTRA_FLAGS="$CLANG_WARNINGS" \
- ..
+CMAKE_FLAGS="
+ -DCMAKE_PREFIX_PATH=/home/travis/osgeo4travis
+ -DWITH_STAGED_PLUGINS=ON
+ -DWITH_GRASS=ON
+ -DWITH_GRASS7=ON
+ -DGRASS_PREFIX7=/home/travis/osgeo4travis/grass-7.0.4
+ -DSUPPRESS_QT_WARNINGS=ON
+ -DENABLE_MODELTEST=ON
+ -DENABLE_PGTEST=ON
+ -DWITH_QSPATIALITE=ON
+ -DWITH_QWTPOLAR=OFF
+ -DWITH_APIDOC=ON
+ -DWITH_ASTYLE=ON
+ -DWITH_INTERNAL_YAML=OFF
+ -DDISABLE_DEPRECATED=ON
+ -DCXX_EXTRA_FLAGS=${CLANG_WARNINGS}
+ "
+
+# The following options trigger a minimalized build to
+# reduce the travis build time so we don't time out and
+# have a chance of slowly filling the ccache.
+if [ "$CACHE_WARMING" = true ] ; then
+ CMAKE_FLAGS="
+ ${CMAKE_FLAGS}
+ -DWITH_DESKTOP=OFF
+ -DWITH_SERVER=OFF
+ "
+else
+ CMAKE_FLAGS="
+ ${CMAKE_FLAGS}
+ -DWITH_DESKTOP=ON
+ -DWITH_SERVER=ON
+ "
+fi
+
+cmake $CMAKE_FLAGS ..
diff --git a/ci/travis/linux/script.sh b/ci/travis/linux/script.sh
index 977e70b84f3..95a6836ff34 100755
--- a/ci/travis/linux/script.sh
+++ b/ci/travis/linux/script.sh
@@ -18,6 +18,7 @@ export PATH=${HOME}/osgeo4travis/bin:${HOME}/osgeo4travis/sbin:${HOME}/OTB-5.6.0
export LD_LIBRARY_PATH=${HOME}/osgeo4travis/lib
export CTEST_PARALLEL_LEVEL=1
export CCACHE_TEMPDIR=/tmp
+ccache -M 2G
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@@ -25,5 +26,11 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export OTB_APPLICATION_PATH=${HOME}/OTB-5.6.0-Linux64/lib/otb/applications
export LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so
-xvfb-run ctest -V -E "qgis_filedownloader|qgis_openstreetmaptest|qgis_wcsprovidertest|PyQgsWFSProviderGUI|qgis_ziplayertest|$(cat ${DIR}/blacklist.txt | paste -sd '|' -)" -S ./qgis-test-travis.ctest --output-on-failure
# xvfb-run ctest -V -E "qgis_openstreetmaptest|qgis_wcsprovidertest" -S ./qgis-test-travis.ctest --output-on-failure
+if [ "$CACHE_WARMING" = true ] ; then
+ echo "WARNING: CACHE WARMING IS ACTIVE. SET CACHE_WARMING=false TO GET MEANINGFUL RESULTS."
+ xvfb-run ctest -V -R NOTESTS -S ./qgis-test-travis.ctest --output-on-failure
+ false
+else
+ xvfb-run ctest -V -E "qgis_filedownloader|qgis_openstreetmaptest|qgis_wcsprovidertest|PyQgsWFSProviderGUI|qgis_ziplayertest|$(cat ${DIR}/blacklist.txt | paste -sd '|' -)" -S ./qgis-test-travis.ctest --output-on-failure
+fi
diff --git a/cmake/FindGDAL.cmake b/cmake/FindGDAL.cmake
index 617cdf9f843..b4b90e4e1a9 100644
--- a/cmake/FindGDAL.cmake
+++ b/cmake/FindGDAL.cmake
@@ -61,13 +61,9 @@ ELSE(WIN32)
ENDIF (NOT GDAL_VERSION)
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" GDAL_VERSION_MAJOR "${GDAL_VERSION}")
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" GDAL_VERSION_MINOR "${GDAL_VERSION}")
- IF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION EQUAL 1 AND GDAL_VERSION_MINOR LESS 4))
- MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 1.4.0 or higher.")
- ENDIF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION EQUAL 1 AND GDAL_VERSION_MINOR LESS 4))
-
- IF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION_MAJOR EQUAL 1 AND GDAL_VERSION_MINOR LESS 11))
- MESSAGE (WARNING "GDAL version is too old (${GDAL_VERSION}) to support GeoPackage. 1.11.0 or higher is recommended.")
- ENDIF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION_MAJOR EQUAL 1 AND GDAL_VERSION_MINOR LESS 11))
+ IF (GDAL_VERSION_MAJOR LESS 2)
+ MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 2.0 or higher.")
+ ENDIF (GDAL_VERSION_MAJOR LESS 2)
ENDIF (GDAL_LIBRARY)
SET (CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_save} CACHE STRING "" FORCE)
@@ -105,14 +101,10 @@ ELSE(WIN32)
# check for gdal version
# version 1.2.5 is known NOT to be supported (missing CPL_STDCALL macro)
- # According to INSTALL, 1.4.0+ is required
- IF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION_MAJOR EQUAL 1 AND GDAL_VERSION_MINOR LESS 4))
- MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 1.4.0 or higher.")
- ENDIF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION_MAJOR EQUAL 1 AND GDAL_VERSION_MINOR LESS 4))
-
- IF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION_MAJOR EQUAL 1 AND GDAL_VERSION_MINOR LESS 11))
- MESSAGE (WARNING "GDAL version is too old (${GDAL_VERSION}) to support GeoPackage. 1.11.0 or higher is recommended.")
- ENDIF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION_MAJOR EQUAL 1 AND GDAL_VERSION_MINOR LESS 11))
+ # According to INSTALL, 2.0+ is required
+ IF (GDAL_VERSION_MAJOR LESS 2)
+ MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 2.0 or higher.")
+ ENDIF (GDAL_VERSION_MAJOR LESS 2)
# set INCLUDE_DIR to prefix+include
EXEC_PROGRAM(${GDAL_CONFIG}
diff --git a/cmake/FindGRASS.cmake b/cmake/FindGRASS.cmake
index d09ec59ccbf..64cfebbe27f 100644
--- a/cmake/FindGRASS.cmake
+++ b/cmake/FindGRASS.cmake
@@ -167,7 +167,7 @@ IF (UNIX)
IF (GRASS_FIND_VERSION EQUAL 6)
LIST(APPEND GRASS_PATHS /usr/lib64/grass64 /usr/lib/grass64)
ELSEIF (GRASS_FIND_VERSION EQUAL 7)
- LIST(APPEND GRASS_PATHS /usr/lib64/grass70 /usr/lib/grass70 /usr/lib64/grass71 /usr/lib/grass71)
+ LIST(APPEND GRASS_PATHS /usr/lib64/grass70 /usr/lib/grass70 /usr/lib64/grass71 /usr/lib/grass71 /usr/lib64/grass72 /usr/lib/grass72)
ENDIF ()
ENDIF (UNIX)
@@ -181,6 +181,7 @@ IF (APPLE)
LIST(APPEND GRASS_PATHS
/Applications/GRASS-7.0.app/Contents/MacOS
/Applications/GRASS-7.1.app/Contents/MacOS
+ /Applications/GRASS-7.2.app/Contents/MacOS
)
ENDIF ()
LIST(APPEND GRASS_PATHS /Applications/GRASS.app/Contents/Resources)
diff --git a/cmake/QCAMacros.cmake b/cmake/QCAMacros.cmake
index 5df3611e91e..486c6a869b3 100644
--- a/cmake/QCAMacros.cmake
+++ b/cmake/QCAMacros.cmake
@@ -92,7 +92,7 @@ function(FIND_QCATOOL TOOL_REQUIRED)
$ENV{OSGEO4W_ROOT}/bin
)
else()
- find_program(QCATOOL_EXECUTABLE NAMES qcatool qcatool2)
+ find_program(QCATOOL_EXECUTABLE NAMES qcatool qcatool2 qcatool-qt5)
endif()
if(NOT QCATOOL_EXECUTABLE)
diff --git a/cmake/Txt2Tags.cmake b/cmake/Txt2Tags.cmake
index c2afedb827c..7b216f87d0e 100644
--- a/cmake/Txt2Tags.cmake
+++ b/cmake/Txt2Tags.cmake
@@ -42,7 +42,7 @@ MACRO(ADD_TXT2TAGS_FILES _sources)
ADD_CUSTOM_COMMAND(
OUTPUT ${_out}
COMMAND ${TXT2TAGS_EXECUTABLE}
- ARGS -o${_out} -t txt ${_in}
+ ARGS --encoding=utf-8 -o${_out} -t txt ${_in}
DEPENDS ${_in}
COMMENT "Building ${_out} from ${_in}"
)
diff --git a/cmake_templates/Doxyfile.in b/cmake_templates/Doxyfile.in
index 42a41571f01..3b1fb1e6bb3 100644
--- a/cmake_templates/Doxyfile.in
+++ b/cmake_templates/Doxyfile.in
@@ -1448,7 +1448,7 @@ DOT_NUM_THREADS = 0
# By default doxygen will write a font called FreeSans.ttf to the output
# directory and reference it in all dot files that doxygen generates. This
-# font does not include all possible unicode characters however, so when you need
+# font does not include all possible Unicode characters however, so when you need
# these (or just want a differently looking font) you can specify the font name
# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
# which can be done by putting it in a standard location or by setting the
diff --git a/debian/qgis.install b/debian/qgis.install
index d17e9b75dec..3c2521bc80a 100644
--- a/debian/qgis.install
+++ b/debian/qgis.install
@@ -1,8 +1,6 @@
usr/lib/qgis/plugins/libgeorefplugin.so
usr/lib/qgis/plugins/libgpsimporterplugin.so
-usr/lib/qgis/plugins/libinterpolationplugin.so
usr/lib/qgis/plugins/libcoordinatecaptureplugin.so
-usr/lib/qgis/plugins/liboracleplugin.so
usr/lib/qgis/plugins/libevis.so
usr/lib/qgis/plugins/libspatialqueryplugin.so
usr/lib/qgis/plugins/libofflineeditingplugin.so
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index c1802517118..b6b34e6b3c3 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -53,6 +53,7 @@ IF(WITH_APIDOC)
${CMAKE_SOURCE_DIR}/src/core/diagram
${CMAKE_SOURCE_DIR}/src/core/dxf
${CMAKE_SOURCE_DIR}/src/core/effects
+ ${CMAKE_SOURCE_DIR}/src/core/fieldformatter
${CMAKE_SOURCE_DIR}/src/core/geometry
${CMAKE_SOURCE_DIR}/src/core/gps
${CMAKE_SOURCE_DIR}/src/core/layertree
diff --git a/doc/INSTALL.html b/doc/INSTALL.html
index 8216371302f..cf1d14ad466 100644
--- a/doc/INSTALL.html
+++ b/doc/INSTALL.html
@@ -77,13 +77,13 @@ label{ background-color: #FFFFCC;
QGIS
Building QGIS from source - step by step
-
Monday November 07, 2016
+
Monday January 09, 2017
-Last Updated: Monday November 07, 2016
-Last Change : Monday November 07, 2016
+Last Updated: Monday January 09, 2017
+Last Change : Monday January 09, 2017
@@ -186,7 +186,7 @@ source directory.
2. Overview
-QGIS, like a number of major projects (eg. KDE 4.0), uses CMake
+QGIS, like a number of major projects (e.g., KDE 4.0), uses CMake
(http://www.cmake.org) for building from source.
-Some proprietary formats (eg. ECW and MrSid) supported by GDAL require
+Some proprietary formats (e.g., ECW and MrSid) supported by GDAL require
proprietary third party libraries. QGIS doesn't need any of those itself to
build, but will only support those formats if GDAL is built accordingly. Refer
to http://gdal.org/formats_list.html ff. for instructions how to include
@@ -434,13 +437,29 @@ Now on with the build:
-make
-make install
+make -jX
-It may take a little while to build depending on your platform.
+where X is the number of available cores. Depending on your platform,
+this can speed up the build time considerably.
+
+Then you can directly run from the build directory:
+
+
+
+./output/bin/qgis
+
+
+
+Another option is to install to your system:
+
+
+
+make install
+
+
After that you can try to run QGIS:
@@ -451,7 +470,7 @@ $HOME/apps/bin/qgis
If all has worked properly the QGIS application should start up and appear
-on your screen. If you get the error message "error while loading shared libraries",
+on your screen. If you get the error message "error while loading shared libraries",
execute this command in your shell.
@@ -459,12 +478,47 @@ execute this command in your shell.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${HOME}/apps/lib/
+
+Optionally, if you already know what aspects you want in your custom build
+then you can skip the interactive ccmake .. part by using the cmake -D
+option for each aspect, e.g.:
+
+ninja (uses all cores by default; also supports the above described -jX option)
+ninja install
+
+
3.8. Building Debian packages
Instead of creating a personal installation as in the previous step you can
-also create debian package. This is done from the QGIS root directory, where
+also create debian package. This is done from the QGIS root directory, where
you'll find a debian directory.
@@ -549,7 +603,7 @@ subdirectory called `build` or `build-qt5` in it.
diff --git a/doc/INSTALL.t2t b/doc/INSTALL.t2t
index 92222b1a629..7f75b29c0c9 100644
--- a/doc/INSTALL.t2t
+++ b/doc/INSTALL.t2t
@@ -50,14 +50,8 @@ Building QGIS from source - step by step
%apply vim formatting to the whole document as it screws up some formatting
%rather apply it selectively to paragraphs where needed.
-% To generate the text version of this document:
-% txt2tags -t txt -o INSTALL INSTALL.t2t
-% To generate the mediawiki version of this document:
-% txt2tags -t wiki --no-enum-title -o INSTALL.wiki INSTALL.t2t
-% To generate the html version of this document:
-% txt2tags -t html -o INSTALL.html INSTALL.t2t
-% To generate the LaTeX version of this document:
-% txt2tags -t tex -o INSTALL.tex INSTALL.t2t; pdflatex INSTALL.tex
+% To generate output fies from this document:
+% cmake --build $YOURBUILDDIR --target t2tdoc
% End of comments
% -------------------
diff --git a/doc/TRANSLATORS b/doc/TRANSLATORS
index 94b0e4ef353..51c9f23a8c0 100644
--- a/doc/TRANSLATORS
+++ b/doc/TRANSLATORS
@@ -37,4 +37,5 @@
editorWidgetText
@@ -258,6 +262,7 @@ should now call QgsCoordinateReferenceSystem::invalidateCache() and QgsCoordinat
- QgsMapLayerRegistry. Its functionality has been moved to QgsProject.
- QgsMapRenderer. It has been replaced by QgsMapRendererJob with subclasses and QgsMapSettings.
- QgsPseudoColorShader. This shader has been broken for some time and was replaced by QgsSingleBandPseudoColorRenderer.
+- QgsProjectBadLayerGuiHandler was removed. It was unused in QGIS code and barely useful. Implement your own QgsProjectBadLayerHandler subclass if needed.
- QgsRendererV2DataDefinedMenus was removed. Use QgsDataDefinedButton instead.
- QgsLegacyHelpers.
- QgsProviderCountCalcEvent and QgsProviderExtentCalcEvent. These classes were unused in QGIS core and unmaintained.
@@ -309,7 +314,7 @@ Data Providers {#qgis_api_break_3_0_DataProviders}
Qgis {#qgis_api_break_3_0_Qgis}
----
-- The QGis class was renamed to Qgis for capitalisation consistency with other class names
+- The QGis class was renamed to Qgis for capitalization consistency with other class names
- permissiveToDouble() and permissiveToInt() where moved out of the QGis class and renamed to qgsPermissiveToDouble() and
qgsPermissiveToInt()
- The constants DEFAULT_IDENTIFY_RADIUS and MINIMUM_POINT_SIZE were removed
@@ -475,6 +480,12 @@ QgsColorRampShader {#qgis_api_break_3_0_QgsColorRampShader}
------------------
- maximumColorCacheSize() and setMaximumColorCacheSize() were no longer used and are removed.
+- ColorRamp_TYPE enum was renamed to Type, and its value names decapitalized
+
+QgsColorSchemeRegistry {#qgis_api_break_3_0_QgsColorSchemeRegistry}
+----------------------
+
+- This class is no longer a singleton and instance() has been removed. Instead use QgsApplication::colorSchemeRegistry() to access an application-wide registry.
QgsComposerArrow {#qgis_api_break_3_0_QgsComposerArrow}
@@ -604,6 +615,7 @@ QgsComposerTableV2 {#qgis_api_break_3_0_QgsComposerTableV2}
QgsComposition {#qgis_api_break_3_0_QgsComposition}
--------------
+- constructor requires QgsProject instance as the second argument
- addItemsFromXML() has been renamed to addItemsFromXml()
- Constructor with QgsMapRenderer parameter has been removed. Use the variant with QgsMapSettings parameter.
- mapRenderer() has been removed. Use mapSettings() instead.
@@ -680,6 +692,13 @@ QgsCptCitySelectionItem {#qgis_api_break_3_0_QgsCptCitySelectionItem}
- parseXML() has been renamed to parseXml()
+
+QgsCustomLayerOrderWidget {#qgis_api_break_3_0_QgsCustomLayerOrderWidget}
+-------------------------
+
+- the signature of the visibilityChanged() signal is changed to visibilityChanged( QgsLayerTreeNode *node )
+
+
QgsCRSCache {#qgis_api_break_3_0_QgsCRSCache}
-----------
@@ -726,6 +745,12 @@ QgsDataItem {#qgis_api_break_3_0_QgsDataItem}
- emitBeginInsertItems(), emitEndInsertItems(), emitBeginRemoveItems(), emitEndRemoveItems(), emitDataChanged(), emitStateChanged() have been removed.
- Favourites was renamed to Favorites
+QgsDataItemProviderRegistry {#qgis_api_break_3_0_QgsDataItemProviderRegistry}
+---------------------------
+
+- This class is no longer a singleton and instance() has been removed. Instead use QgsApplication::dataItemProviderRegistry() to access an application-wide registry.
+
+
QgsDataProvider {#qgis_api_break_3_0_QgsDataProvider}
---------------
@@ -756,11 +781,15 @@ Use renderDiagram( const QgsFeature& feature, QgsRenderContext& c, const QgsDiag
- The deprecated diagramSize( const QgsAttributes& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is ) method has been removed.
Use diagramSize( const QgsFeature& feature, const QgsRenderContext& c, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is ) instead.
+QgsDiagramInterpolationSettings {#qgis_api_break_3_0_QgsDiagramInterpolationSettings}
+-------------------------------
+- The classificationAttribute member variable was removed, and has been replaced by the classificationField variable which stores the string name.
+
QgsDiagramRenderer {#qgis_api_break_3_0_QgsDiagramRenderer}
------------------
-
- xform, fields were no longer required and are removed.
+- referencedFields() no longer takes a QgsFields argument.
QgsDiagramLayerSettings {#qgis_api_break_3_0_QgsDiagramLayerSettings}
@@ -771,7 +800,15 @@ be returned in place of a null pointer.
- setCoordinateTransform() now takes a QgsCoordinateTransform object, not a pointer. Use an invalid QgsCoordinateTransform in
place of a null pointer.
- The ct member has been removed. Use coordinateTransform() and setCoordinateTransform() instead.
-
+- The LinePlacementFlags enum was renamed to LinePlacementFlag
+- The placement member variable was removed, and getPlacement() was renamed to placement()
+- The placementFlags member variable was removed
+- The priority member variable was removed, and getPriority() was renamed to priority()
+- The zIndex member variable was removed, and getZIndex() was renamed to zIndex()
+- The obstacle member variable was removed. setIsObstacle() and isObstacle() should be used instead.
+- The dist member variable was removed. setDistance() and distance() should be used instead.
+- The renderer member variable was removed, and getRenderer() was renamed to renderer()
+- The showAll member variable was removed. setShowAllDiagrams() and showAllDiagrams() should be used instead.
QgsDiagramSettings {#qgis_api_break_3_0_QgsDiagramSettings}
------------------
@@ -851,6 +888,12 @@ QgsExpression::Function {#qgis_api_break_3_0_QgsExpression_Function}
- `QgsExpression::Function::helptext()` has been renamed to `helpText()`
+QgsExpressionContextUtils {#qgis_api_break_3_0_QgsExpressionContextUtils}
+-------------------------
+
+- projectScope(), setProjectVariable() and setProjectVariables() require pointer to QgsProject as the first argument.
+
+
QgsFeature {#qgis_api_break_3_0_QgsFeature}
----------
@@ -923,6 +966,7 @@ method to determine if a geometry is valid.
- static bool compare( const QgsPolygon& p1, const QgsPolygon& p2, double epsilon ) has been renamed to comparePolygons
- static bool compare( const QgsMultiPolygon& p1, const QgsMultiPolygon& p2, double epsilon ) has been renamed to compareMultiPolygons
- smoothLine and smoothPolygon are no longer public API (use smooth() instead)
+- avoidIntersections() got an extra argument: list of layers to include in the operation (previously read from active QgsProject)
QgsGeometryAnalyzer {#qgis_api_break_3_0_QgsGeometryAnalyzer}
@@ -985,6 +1029,11 @@ QgsEditorWidgetFactory {#qgis_api_break_3_0_QgsEditorWidgetFactory}
- `alignmentFlag` has been removed. Use QgsFieldFormatter::representValue() instead
- `createCache` has been removed. Use QgsFieldFormatter::representValue() instead
+QgsGPSConnectionRegistry {#qgis_api_break_3_0_QgsGPSConnectionRegistry}
+------------------------
+
+- This class is no longer a singleton and instance() has been removed. Instead use QgsApplication::gpsConnectionRegistry() to access an application-wide registry.
+
QgsGraduatedRenderer {#qgis_api_break_3_0_QgsGraduatedRenderer}
--------------------
@@ -1041,12 +1090,16 @@ QgsLayerTreeGroup {#qgis_api_break_3_0_QgsLayerTreeGroup}
-----------------
- readChildrenFromXML() has been renamed to readChildrenFromXml()
-
+- isVisible() is moved to QgsLayerTreeNode
+- setVisible() is replaced by QgsLayerTreeNode::setItemVisibilityChecked()
+- protected methods updateVisibilityFromChildren() and updateChildVisibility() removed
QgsLayerTreeLayer {#qgis_api_break_3_0_QgsLayerTreeLayer}
-----------------
- setLayerName(), layerName() were renamed to setName(), name()
+- isVisible() is moved to QgsLayerTreeNode
+- setVisible() is replaced by QgsLayerTreeNode::setItemVisibilityChecked()
QgsLayerTreeModel {#qgis_api_break_3_0_QgsLayerTreeMode}
@@ -1072,7 +1125,7 @@ QgsLayerTreeNode {#qgis_api_break_3_0_QgsLayerTreeNode}
- readCommonXML() has been renamed to readCommonXml()
- writeCommonXML() has been renamed to writeCommonXml()
-
+- the signature of the visibilityChanged() signal is changed to visibilityChanged( QgsLayerTreeNode *node )
QgsLimitedRandomColorRampDialog {#qgis_api_break_3_0_QgsLimitedRandomRampDialog}
-------------------------------
@@ -1082,6 +1135,13 @@ and the new ramp can be retrieved after executing the dialog by calling ramp().
- Some internal methods which were previously public or protected were made private.
+QgsLinearlyInterpolatedDiagramRenderer {#qgis_api_break_3_0_QgsLinearlyInterpolatedDiagramRenderer}
+--------------------------------------
+
+- The classificationAttribute() and setClassificationAttribute() methods were replace by
+classificationField() and setClassificationField() which use the field names instead of field
+indexes.
+
QgsMapCanvas {#qgis_api_break_3_0_QgsMapCanvas}
------------
@@ -1129,6 +1189,7 @@ screenUpdateRequested() were removed. These members have had no effect for a num
- drawLabels() method was removed. It used old deprecated labeling. Replaced by labeling based on PAL library, see QgsLabelingEngine.
- readLayerXML() was renamed to readLayerXml()
- writeLayerXML() was renamed to writeLayerXml()
+- capitaliseLayerName() was renamed to capitalizeLayerName()
QgsMapLayerRegistry {#qgis_api_break_3_0_QgsMapLayerRegistry}
@@ -1207,6 +1268,12 @@ QgsMarkerSymbolLayer {#qgis_api_break_3_0_QgsMarkerSymbolLayer}
- bounds() is now pure virtual and must be implemented in all subclasses.
+QgsMessageLog {#qgis_api_break_3_0_QgsMessageLog}
+---------------------------
+
+- This class is no longer a singleton and instance() has been removed. Instead use QgsApplication::messageLog() to access an application-wide log.
+
+
QgsMimeDataUtils {#qgis_api_break_3_0_QgsMimeDataUtils}
----------------
@@ -1257,6 +1324,11 @@ QgsNumericSortTreeWidgetItem {#qgis_api_break_3_0_QgsNumericSortTreeWidge
has improved sort capabilities including the ability to set custom sort values for items
and for forcing certain items to always sort on top.
+QgsPaintEffectRegistry {#qgis_api_break_3_0_QgsPaintEffectRegistry}
+----------------------
+
+- This class is no longer a singleton and instance() has been removed. Instead use QgsApplication::paintEffectRegistry() to access an application-wide registry.
+
QgsPalettedRasterRenderer {#qgis_api_break_3_0_QgsPalettedRasterRenderer}
-------------------------
@@ -1299,6 +1371,12 @@ QgsPluginLayer {#qgis_api_break_3_0_QgsPluginLayer}
- createMapRenderer(): default implementation (which called plugin's draw() method) has been removed. Plugin layers must implement createMapRenderer().
+QgsPluginLayerRegistry {#qgis_api_break_3_0_QgsPluginLayerRegistry}
+----------------------
+
+- This class is no longer a singleton and instance() has been removed. Instead use QgsApplication::pluginLayerRegistry() to access an application-wide registry.
+
+
QgsPointDisplacementRenderer {#qgis_api_break_3_0_QgsPointDisplacementRenderer}
----------------------------
@@ -1323,8 +1401,16 @@ QgsProject {#qgis_api_break_3_0_QgsProject}
- title( const QString & title ) was removed. Use setTitle() instead.
- dirty( bool b ) was removed. Use setDirty() instead.
- clearProperties() was removed. Use clear() instead.
+- read( QDomNode& layerNode ) was renamed to readLayer( const QDomNode& layerNode ).
+- read( const QFileInfo& file ) was replaced by read( const QString& filename ).
+- write( const QFileInfo& file ) was replaced by write( const QString& filename ).
+QgsProjectPropertyValue {#qgis_api_break_3_0_QgsProjectPropertyValue}
+-----------------------
+
+- The unused count() and entryList() methods were removed.
+
QgsRaster {#qgis_api_break_3_0_QgsRaster}
---------
@@ -1404,6 +1490,12 @@ be returned instead of a null pointer if no transformation is required.
- setCoordinateTransform() now takes a QgsCoordinateTransform reference, not a pointer. An invalid QgsCoordinateTransform should be used instead of a null pointer if no transformation is required.
+QgsRendererRegistry {#qgis_api_break_3_0_QgsRendererRegistry}
+----------------------
+
+- This class is no longer a singleton and instance() has been removed. Instead use QgsApplication::rendererRegistry() to access an application-wide registry.
+
+
QgsRendererWidget {#qgis_api_break_3_0_QgsRendererWidget}
-----------------
@@ -1465,6 +1557,7 @@ QgsSingleSymbolRendererWidget {#qgis_api_break_3_0_QgsSingleSymbolRendere
-----------------------------
- sizeScaleFieldChanged() and scaleMethodChanged() were removed. These settings are no longer exposed in the widget's GUI.
+- The Mode enum was removed.
QgsSnapper {#qgis_api_break_3_0_QgsSnapper}
@@ -1484,6 +1577,7 @@ QgsSublayersDialog {#qgis_api_break_3_0_QgsSublayersDialog}
QgsSvgCache {#qgis_api_break_3_0_QgsSvgCache}
-----------
+- This class is no longer a singleton and instance() has been removed. Instead use QgsApplication::svgCache() to access an application-wide cache.
- containsParamsV2() was removed. Use containsParamsV3() instead.
QgsStyle (renamed from QgsStyleV2) {#qgis_api_break_3_0_QgsStyle}
@@ -1517,6 +1611,11 @@ the variant which takes QgsSymbolRenderContext instead.
- evaluateDataDefinedProperty( const QString& property, const QgsFeature* feature ) was removed. Use the variant which takes QgsSymbolRenderContext instead.
- expression() was removed. Use getDataDefinedProperty or evaluateDataDefinedProperty instead.
+QgsSymbolLayerRegistry {#qgis_api_break_3_0_QgsSymbolLayerRegistry}
+----------------------
+
+- This class is no longer a singleton and instance() has been removed. Instead use QgsApplication::symbolLayerRegistry() to access an application-wide registry.
+
QgsSymbolLayerWidget {#qgis_api_break_3_0_QgsSymbolLayerWidget}
--------------------
diff --git a/doc/api_custom.css b/doc/api_custom.css
index cab4de68b88..4b5bc31fd6d 100644
--- a/doc/api_custom.css
+++ b/doc/api_custom.css
@@ -177,6 +177,12 @@ div.header {
width: 80%;
}
+#main-nav {
+ width: 80%;
+ margin-left: auto;
+ margin-right: auto;
+}
+
div.qindex, div.navpath {
width: 80%;
margin-left: auto;
diff --git a/doc/build.sh b/doc/build.sh
deleted file mode 100755
index 7ce44bf6f12..00000000000
--- a/doc/build.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-###########################################################################
-# build.sh
-# ---------------------
-# Date : November 2010
-# Copyright : (C) 2010 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. #
-# #
-###########################################################################
-
-txt2tags -o ../INSTALL -t txt INSTALL.t2t
-txt2tags -o INSTALL.html -t html INSTALL.t2t
-txt2tags -o INSTALL.tex -t tex INSTALL.t2t
-pdflatex INSTALL.tex
-mv INSTALL.pdf ..
diff --git a/doc/linux.t2t b/doc/linux.t2t
index 32ee2b661c6..a0534c83aa6 100644
--- a/doc/linux.t2t
+++ b/doc/linux.t2t
@@ -135,8 +135,8 @@ Now on with the build:
make -jX
```
-where X is the number of available cores. Without the -j option
-it may take a little while to build depending on your platform.
+where X is the number of available cores. Depending on your platform,
+this can speed up the build time considerably.
Then you can directly run from the build directory:
@@ -164,6 +164,33 @@ execute this command in your shell.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${HOME}/apps/lib/
```
+Optionally, if you already know what aspects you want in your custom build
+then you can skip the interactive ccmake .. part by using the cmake -D
+option for each aspect, e.g.:
+
+```
+cmake -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=${HOME}/apps ..
+```
+
+Also, if you want to speed your build times, you can easily do it with ninja,
+an alternative to make with similar build options.
+
+For example, to configure your build you can do either one of:
+
+```
+ccmake -G Ninja ..
+```
+
+```
+cmake -G Ninja -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=${HOME}/apps ..
+```
+
+Build and install with ninja:
+
+```
+ninja (uses all cores by default; also supports the above described -jX option)
+ninja install
+```
== Building Debian packages ==
diff --git a/doc/news.html b/doc/news.html
index 3c593af9463..ff35f350d8c 100644
--- a/doc/news.html
+++ b/doc/news.html
@@ -174,7 +174,7 @@ This release has following new features:
Map Composer: Parameterized svg support for composer svg images
Map Composer: Easier use of HTML in labels
Map Composer: Relative links in composer labels
-
Map Composer: Georeference outputs (eg PDF) from composer
+
Map Composer: Georeference outputs (e.g., PDF) from composer
Map Composer: Composer maps now auto-update with presets
Analysis tools: Named parameters in expressions
Analysis tools: More distance units
@@ -935,7 +935,7 @@ changed so we will just provide a bullet list of key new features here.
Optionally re-use entered attribute values for next digitized feature.
Allow merging/assigning attribute values to a set of features.-
-
Allow OGR 'save as' without attributes (for eg. DGN/DXF).
+
Allow OGR 'save as' without attributes (e.g., DGN/DXF).
".join(self.errors)
- QErrorMessage(self).showMessage(msg)
-
- inDir = self.getInputFileName()
- outDir = self.getOutputFileName()
- if outDir is None or inDir == outDir:
- self.outFiles = self.inFiles
-
- # load layers managing the render flag to avoid waste of time
- canvas = self.iface.mapCanvas()
- previousRenderFlag = canvas.renderFlag()
- canvas.setRenderFlag(False)
- notCreatedList = []
- for item in self.outFiles:
- fileInfo = QFileInfo(item)
- if fileInfo.exists():
- if self.base.loadCheckBox.isChecked():
- self.addLayerIntoCanvas(fileInfo)
- else:
- notCreatedList.append(item)
- canvas.setRenderFlag(previousRenderFlag)
-
- if len(notCreatedList) == 0:
- QMessageBox.information(self, self.tr("Finished"), self.tr("Operation completed."))
- else:
- QMessageBox.warning(self, self.tr("Warning"), self.tr("The following files were not created: \n{0}").format(', '.join(notCreatedList)))
diff --git a/python/plugins/GdalTools/tools/widgetBuildVRT.ui b/python/plugins/GdalTools/tools/widgetBuildVRT.ui
deleted file mode 100644
index b78df2a4401..00000000000
--- a/python/plugins/GdalTools/tools/widgetBuildVRT.ui
+++ /dev/null
@@ -1,173 +0,0 @@
-
-
- GdalToolsWidget
-
-
-
- 0
- 0
- 348
- 304
-
-
-
-
- 0
- 0
-
-
-
- Build Virtual Raster (Catalog)
-
-
-
-
-
- QLayout::SetNoConstraint
-
-
-
-
- Allow projection difference
-
-
-
-
-
-
- &Output file
-
-
- outSelector
-
-
-
-
-
-
-
-
-
- &Input files
-
-
- inSelector
-
-
-
-
-
-
- Se¶te
-
-
-
-
-
-
- Choose input directory instead of files
-
-
-
-
-
-
-
-
-
- Target SRS
-
-
-
-
-
-
- Use visible raster layers for input
-
-
-
-
-
-
- &Resolution
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 1
-
-
-
- Highest
-
-
-
-
- Average
-
-
-
-
- Lowest
-
-
-
-
-
-
-
- &Source No Data
-
-
-
-
-
-
- Recurse subdirectories
-
-
-
-
-
-
-
-
-
-
-
- Select
-
-
-
-
-
-
-
-
- 0
-
-
-
-
-
-
-
-
-
- GdalToolsInOutSelector
- QWidget
- .inOutSelector
- 1
-
-
-
-
-
diff --git a/python/plugins/GdalTools/tools/widgetClipper.ui b/python/plugins/GdalTools/tools/widgetClipper.ui
deleted file mode 100644
index 5d4b8e95664..00000000000
--- a/python/plugins/GdalTools/tools/widgetClipper.ui
+++ /dev/null
@@ -1,356 +0,0 @@
-
-
- GdalToolsWidget
-
-
-
- 0
- 0
- 531
- 330
-
-
-
-
- 0
- 0
-
-
-
- Clipper
-
-
-
- 9
-
-
-
-
-
-
- &Input file (raster)
-
-
- inSelector
-
-
-
-
-
-
- &Output file
-
-
- outSelector
-
-
-
-
-
-
-
-
-
-
-
-
- -100000
-
-
- 65000
-
-
-
-
-
-
- &No data value
-
-
-
-
-
-
-
-
- Clipping mode
-
-
-
- 0
-
-
-
-
- 1
-
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
-
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
-
-
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
- Create an output alpha band
-
-
-
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- Mask layer
-
-
-
-
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
- Qt::LeftToRight
-
-
- X Resolution
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
-
-
-
- 1
-
-
- 0.100000000000000
-
-
- 999999.000000000000000
-
-
- 0.100000000000000
-
-
- 12.500000000000000
-
-
-
-
-
-
- Y Resolution
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
-
-
-
- 1
-
-
- 0.100000000000000
-
-
- 999999.000000000000000
-
-
- 0.100000000000000
-
-
- 12.500000000000000
-
-
-
-
-
-
-
-
-
- Set output file resolution
-
-
-
-
-
-
- Keep resolution of input raster
-
-
- true
-
-
-
-
-
-
-
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
-
-
-
- Crop the extent of the target dataset to the extent of the cutline
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
- Extent
-
-
- true
-
-
-
-
-
-
- Qt::LeftToRight
-
-
- Mask layer
-
-
-
-
-
-
-
-
-
-
-
-
-
- GdalToolsInOutSelector
- QWidget
- .inOutSelector
- 1
-
-
- GdalToolsExtentSelector
- QWidget
- .extentSelector
- 1
-
-
-
-
-
diff --git a/python/plugins/GdalTools/tools/widgetContour.ui b/python/plugins/GdalTools/tools/widgetContour.ui
deleted file mode 100644
index 9ea66279f5f..00000000000
--- a/python/plugins/GdalTools/tools/widgetContour.ui
+++ /dev/null
@@ -1,144 +0,0 @@
-
-
- GdalToolsWidget
-
-
-
- 0
- 0
- 520
- 163
-
-
-
-
- 0
- 0
-
-
-
- Contour
-
-
-
-
-
-
-
- &Input file (raster)
-
-
- inSelector
-
-
-
-
-
-
- &Output file for contour lines (vector)
-
-
- outSelector
-
-
-
-
-
-
- I&nterval between contour lines
-
-
- intervalDSpinBox
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 3
-
-
- 2140000000.000000000000000
-
-
-
-
-
-
-
-
- &Attribute name
-
-
-
-
-
-
-
- 8
-
-
-
- If not provided, no elevation attribute is attached.
-
-
- 16
-
-
-
-
-
-
-
-
-
-
- ELEV
-
-
-
-
-
-
- Qt::Vertical
-
-
- QSizePolicy::Minimum
-
-
-
- 20
- 0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- GdalToolsInOutSelector
- QWidget
- .inOutSelector
- 1
-
-
-
-
-
diff --git a/python/plugins/GdalTools/tools/widgetConvert.ui b/python/plugins/GdalTools/tools/widgetConvert.ui
deleted file mode 100644
index 4a68ed7d18d..00000000000
--- a/python/plugins/GdalTools/tools/widgetConvert.ui
+++ /dev/null
@@ -1,109 +0,0 @@
-
-
- GdalToolsWidget
-
-
-
- 0
- 0
- 356
- 191
-
-
-
-
- 0
- 0
-
-
-
- Convert RGB image to paletted
-
-
-
-
-
- Batch mode (for processing whole directory)
-
-
-
-
-
-
-
-
- &Input file
-
-
- inSelector
-
-
-
-
-
-
- &Output file
-
-
- outSelector
-
-
-
-
-
-
- Number of colors
-
-
-
-
-
-
- 2
-
-
- 256
-
-
-
-
-
-
- 1
-
-
- 256
-
-
-
-
-
-
- Band to convert
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- GdalToolsInOutSelector
- QWidget
- .inOutSelector
- 1
-
-
-
-
-
diff --git a/python/plugins/GdalTools/tools/widgetDEM.ui b/python/plugins/GdalTools/tools/widgetDEM.ui
deleted file mode 100644
index 9b90cd25295..00000000000
--- a/python/plugins/GdalTools/tools/widgetDEM.ui
+++ /dev/null
@@ -1,478 +0,0 @@
-
-
- GdalToolsWidget
-
-
-
- 0
- 0
- 478
- 404
-
-
-
-
- 0
- 0
-
-
-
- DEM (Terrain models)
-
-
-
- 5
-
-
-
-
-
-
- &Input file (DEM raster)
-
-
- inSelector
-
-
-
-
-
-
- &Output file
-
-
- outSelector
-
-
-
-
-
-
- &Band
-
-
-
-
-
-
- 1
-
-
-
-
-
-
- Compute &edges
-
-
-
-
-
-
- Use Zevenbergen&&Thorne formula (instead of the Horn's one)
-
-
-
-
-
-
-
-
-
-
-
-
- &Mode
-
-
- modeCombo
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 0
-
-
-
- Hillshade
-
-
-
-
- Slope
-
-
-
-
- Aspect
-
-
-
-
- Color relief
-
-
-
-
- TRI (Terrain Ruggedness Index)
-
-
-
-
- TPI (Topographic Position Index)
-
-
-
-
- Roughness
-
-
-
-
-
-
-
-
-
- Mode Options
-
-
-
- 0
-
-
- 0
-
-
-
-
- 0
-
-
-
-
-
-
- Z factor (vertical exaggeration)
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 2
-
-
- 100000000.0
-
-
-
-
-
-
- Scale (ratio of vert. units to horiz.)
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 2
-
-
- 999999.000000000000000
-
-
-
-
-
-
- Azimuth of the light
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 1
-
-
- 359.000000000000000
-
-
-
-
-
-
- Altitude of the light
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 1
-
-
- 359.000000000000000
-
-
-
-
-
-
-
-
-
-
- Slope expressed as percent (instead of as degrees)
-
-
-
-
-
-
- Scale (ratio of vert. units to horiz.)
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 2
-
-
- 999999.000000000000000
-
-
-
-
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
-
-
-
-
-
-
-
- Return trigonometric angle (instead of azimuth)
-
-
-
-
-
-
- Return 0 for flat (instead of -9999)
-
-
-
-
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
-
-
-
-
-
-
-
- Color configuration file
-
-
-
-
-
-
- Matching mode
-
-
- true
-
-
- false
-
-
-
-
-
- Exact color (otherwise "0,0,0,0" RGBA)
-
-
- true
-
-
- true
-
-
-
-
-
-
- Nearest color
-
-
-
-
-
-
-
-
-
- Add alpha channel
-
-
-
-
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- modeCombo
- stackedWidget
-
-
-
- falsetrue
-
- true
-
-
- &Creation Options
-
-
- true
-
-
- false
-
-
-
- 9
-
-
-
-
-
-
-
-
-
-
-
-
- GdalToolsInOutSelector
- QWidget
- .inOutSelector
- 1
-
-
- QgsCollapsibleGroupBox
- QGroupBox
- qgis.gui
- 1
-
-
- QgsRasterFormatSaveOptionsWidget
- QWidget
- qgis.gui
- 1
-
-
-
-
-
- modeCombo
- currentIndexChanged(int)
- stackedWidget
- setCurrentIndex(int)
-
-
- 282
- 201
-
-
- 208
- 310
-
-
-
-
-
diff --git a/python/plugins/GdalTools/tools/widgetFillNodata.ui b/python/plugins/GdalTools/tools/widgetFillNodata.ui
deleted file mode 100644
index c63602a0f8e..00000000000
--- a/python/plugins/GdalTools/tools/widgetFillNodata.ui
+++ /dev/null
@@ -1,159 +0,0 @@
-
-
- GdalToolsWidget
-
-
-
- 0
- 0
- 368
- 300
-
-
-
-
- 0
- 0
-
-
-
- Fill Nodata
-
-
-
-
-
- Batch mode (for processing whole directory)
-
-
-
-
-
-
- &Input Layer
-
-
- inSelector
-
-
-
-
-
-
-
-
-
- &Output file
-
-
- outSelector
-
-
-
-
-
-
-
-
-
- QFrame::NoFrame
-
-
- Output format
-
-
-
-
-
-
-
- 0
- 0
-
-
-
-
-
-
-
- Search distance
-
-
-
-
-
-
- 1
-
-
- 1000000
-
-
- 100
-
-
-
-
-
-
- Smooth iterations
-
-
-
-
-
-
- 0
-
-
- 0
-
-
-
-
-
-
- Band to operate on
-
-
-
-
-
-
- 1
-
-
-
-
-
-
- Validity mask
-
-
-
-
-
-
-
-
-
- Do not use the default validity mask
-
-
-
-
-
-
-
-
-
-
- GdalToolsInOutSelector
- QWidget
- .inOutSelector
- 1
-
-
-
-
-
diff --git a/python/plugins/GdalTools/tools/widgetGrid.ui b/python/plugins/GdalTools/tools/widgetGrid.ui
deleted file mode 100644
index 5c2720ea375..00000000000
--- a/python/plugins/GdalTools/tools/widgetGrid.ui
+++ /dev/null
@@ -1,854 +0,0 @@
-
-
- GdalToolsWidget
-
-
-
- 0
- 0
- 777
- 348
-
-
-
-
- 0
- 0
-
-
-
- Grid (Interpolation)
-
-
-
-
-
-
-
- &Input file
-
-
- inSelector
-
-
-
-
-
-
- &Z Field
-
-
-
-
-
-
-
-
-
- &Output file
-
-
- outSelector
-
-
-
-
-
-
- &Algorithm
-
-
-
-
-
-
-
- Inverse distance to a power
-
-
-
-
- Moving average
-
-
-
-
- Nearest neighbor
-
-
-
-
- Data metrics
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- QFrame::NoFrame
-
-
- 0
-
-
-
-
-
-
- Power
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 1
-
-
-
-
-
-
- Smoothing
-
-
- 30
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 1
-
-
- 65000.000000000000000
-
-
-
-
-
-
- Radius1
-
-
- 30
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 1
-
-
- 65000.000000000000000
-
-
-
-
-
-
- Radius2
-
-
- 30
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 1
-
-
- 65000.000000000000000
-
-
-
-
-
-
- Max points
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 65000
-
-
-
-
-
-
- Min points
-
-
- 30
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 65000
-
-
-
-
-
-
- Angle
-
-
- 30
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 1
-
-
- 359.000000000000000
-
-
-
-
-
-
- No data
-
-
- 30
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 1
-
-
- -100000.000000000000000
-
-
- 65000.000000000000000
-
-
-
-
-
-
- Qt::Vertical
-
-
-
- 20
- 0
-
-
-
-
-
-
-
-
-
-
-
- Radius1
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 1
-
-
- 65000.000000000000000
-
-
-
-
-
-
- Radius2
-
-
- 40
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 1
-
-
- 65000.000000000000000
-
-
-
-
-
-
- Angle
-
-
- 40
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 1
-
-
- 359.000000000000000
-
-
-
-
-
-
- Min points
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 65000
-
-
-
-
-
-
- No data
-
-
- 40
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 1
-
-
- 65000.000000000000000
-
-
-
-
-
-
- Qt::Vertical
-
-
-
- 20
- 0
-
-
-
-
-
-
-
-
-
-
-
- Radius1
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 1
-
-
- 65000.000000000000000
-
-
-
-
-
-
- Radius2
-
-
- 40
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 1
-
-
- 65000.000000000000000
-
-
-
-
-
-
- Angle
-
-
- 40
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 1
-
-
- 359.000000000000000
-
-
-
-
-
-
- No data
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 1
-
-
- 65000.000000000000000
-
-
-
-
-
-
- Qt::Vertical
-
-
-
- 20
- 0
-
-
-
-
-
-
-
-
-
-
-
- Metrics
-
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- Minimum
-
-
-
-
- Maximum
-
-
-
-
- Range
-
-
-
-
-
-
-
- Radius1
-
-
- 40
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 1
-
-
- 65000.000000000000000
-
-
-
-
-
-
- Radius2
-
-
- 40
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 1
-
-
- 65000.000000000000000
-
-
-
-
-
-
- Angle
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 1
-
-
- 359.000000000000000
-
-
-
-
-
-
- No data
-
-
- 40
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 1
-
-
- 65000.000000000000000
-
-
-
-
-
-
- Min points
-
-
- 40
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 65000
-
-
-
-
-
-
- Qt::Vertical
-
-
-
- 20
- 0
-
-
-
-
-
-
-
-
-
-
-
- Resize
-
-
- true
-
-
- false
-
-
-
-
-
-
- 0
- 0
-
-
-
- Width
-
-
-
-
-
-
- 999999
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- Height
-
-
- 40
-
-
-
-
-
-
- 999999
-
-
-
-
-
-
-
-
-
- Extent
-
-
- true
-
-
- false
-
-
-
-
-
-
-
-
-
-
-
-
- GdalToolsInOutSelector
- QWidget
- .inOutSelector
- 1
-
-
- GdalToolsExtentSelector
- QWidget
- .extentSelector
- 1
-
-
-
-
-
- algorithmCombo
- currentIndexChanged(int)
- stackedWidget
- setCurrentIndex(int)
-
-
- 159
- 129
-
-
- 159
- 290
-
-
-
-
-
diff --git a/python/plugins/GdalTools/tools/widgetInfo.ui b/python/plugins/GdalTools/tools/widgetInfo.ui
deleted file mode 100644
index d2012ac401e..00000000000
--- a/python/plugins/GdalTools/tools/widgetInfo.ui
+++ /dev/null
@@ -1,86 +0,0 @@
-
-
- GdalToolsWidget
-
-
-
- 0
- 0
- 426
- 292
-
-
-
-
- 0
- 0
-
-
-
- Info
-
-
-
-
-
-
-
- &Input file
-
-
- inSelector
-
-
-
-
-
-
-
-
-
-
-
- Raster info
-
-
-
-
-
-
- QAbstractItemView::NoEditTriggers
-
-
- true
-
-
- QAbstractItemView::ExtendedSelection
-
-
-
-
-
-
- Suppress GCP printing
-
-
-
-
-
-
- Suppress metadata printing
-
-
-
-
-
-
-
- GdalToolsInOutSelector
- QWidget
- .inOutSelector
- 1
-
-
-
-
-
diff --git a/python/plugins/GdalTools/tools/widgetMerge.ui b/python/plugins/GdalTools/tools/widgetMerge.ui
deleted file mode 100644
index 4ba15550a40..00000000000
--- a/python/plugins/GdalTools/tools/widgetMerge.ui
+++ /dev/null
@@ -1,159 +0,0 @@
-
-
- GdalToolsWidget
-
-
-
- 0
- 0
- 371
- 284
-
-
-
-
- 0
- 0
-
-
-
- Merge
-
-
-
-
-
-
-
- &Input files
-
-
- inSelector
-
-
-
-
-
-
- &Output file
-
-
- outSelector
-
-
-
-
-
-
- &No data value
-
-
-
-
-
-
- -100000
-
-
- 65000
-
-
-
-
-
-
-
-
-
-
-
-
- Choose input directory instead of files
-
-
-
-
-
-
- Recurse subdirectories
-
-
-
-
-
-
-
-
- Place each input file into a separate band
-
-
-
-
-
-
- false
-
-
- Use intersected extent
-
-
-
-
-
-
- Grab pseudocolor table from the first image
-
-
-
-
-
-
- &Creation Options
-
-
- true
-
-
- false
-
-
- false
-
-
- true
-
-
-
- 9
-
-
-
-
-
-
-
-
-
-
-
- GdalToolsInOutSelector
- QWidget
- .inOutSelector
- 1
-
-
- QgsRasterFormatSaveOptionsWidget
- QWidget
- qgis.gui
- 1
-
-
- QgsCollapsibleGroupBox
- QGroupBox
- qgis.gui
- 1
-
-
-
-
-
diff --git a/python/plugins/GdalTools/tools/widgetNearBlack.ui b/python/plugins/GdalTools/tools/widgetNearBlack.ui
deleted file mode 100644
index 9ce19fe48c2..00000000000
--- a/python/plugins/GdalTools/tools/widgetNearBlack.ui
+++ /dev/null
@@ -1,86 +0,0 @@
-
-
- GdalToolsWidget
-
-
-
- 0
- 0
- 443
- 125
-
-
-
-
- 0
- 0
-
-
-
- Near Black
-
-
-
-
-
-
-
- &Input file
-
-
- inSelector
-
-
-
-
-
-
- &Output file
-
-
- outSelector
-
-
-
-
-
-
- How &far from black (or white)
-
-
-
-
-
-
- 255
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Search for nearly &white (255) pixels instead of black ones
-
-
-
-
-
-
-
- GdalToolsInOutSelector
- QWidget
- .inOutSelector
- 1
-
-
-
-
-
diff --git a/python/plugins/GdalTools/tools/widgetOverview.ui b/python/plugins/GdalTools/tools/widgetOverview.ui
deleted file mode 100644
index 5686648f826..00000000000
--- a/python/plugins/GdalTools/tools/widgetOverview.ui
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
- GdalToolsWidget
-
-
-
- 0
- 0
- 376
- 342
-
-
-
-
- 0
- 0
-
-
-
- Build overviews (Pyramids)
-
-
-
-
-
- true
-
-
- Batch mode (for processing whole directory)
-
-
-
-
-
-
-
-
- &Input file
-
-
- inSelector
-
-
-
-
-
-
-
-
-
-
-
- Remove all overviews.
-
-
- Clean
-
-
-
-
-
-
-
- 0
- 1
-
-
-
-
-
-
-
-
-
-
-
- GdalToolsInOutSelector
- QWidget
- .inOutSelector
- 1
-
-
- QgsRasterPyramidsOptionsWidget
- QWidget
- qgis.gui
- 1
-
-
-
-
-
diff --git a/python/plugins/GdalTools/tools/widgetPluginBase.py b/python/plugins/GdalTools/tools/widgetPluginBase.py
deleted file mode 100644
index 77505e54335..00000000000
--- a/python/plugins/GdalTools/tools/widgetPluginBase.py
+++ /dev/null
@@ -1,210 +0,0 @@
-# -*- coding: utf-8 -*-
-
-"""
-***************************************************************************
- widgetPluginBase.py
- ---------------------
- Date : June 2010
- Copyright : (C) 2010 by Giuseppe Sucameli
- Email : brush dot tyler 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. *
-* *
-***************************************************************************
-"""
-from builtins import object
-
-__author__ = 'Giuseppe Sucameli'
-__date__ = 'June 2010'
-__copyright__ = '(C) 2010, Giuseppe Sucameli'
-# This will get replaced with a git SHA1 when you do a git archive
-__revision__ = '$Format:%H$'
-
-from qgis.PyQt.QtCore import QFileInfo
-from qgis.PyQt.QtWidgets import QWidget, QMessageBox, QAbstractButton, QGroupBox
-
-from .dialogBase import GdalToolsBaseDialog as BaseDialog
-from . import GdalTools_utils as Utils
-
-
-class GdalToolsBasePluginWidget(object):
-
- def __init__(self, iface, commandName):
- self.iface = iface
- self.initialized = False
- self.base = BaseDialog(iface.mainWindow(), iface, self, self.windowTitle(), commandName)
-
- self.base.processError.connect(self.onError)
- self.base.processFinished.connect(self.onFinished)
-
- self.base.okClicked.connect(self.onRun)
- self.base.closeClicked.connect(self.onClosing)
- self.base.helpClicked.connect(self.onHelp)
-
- self.base.finished.connect(self.finished)
- self.base.refreshArgs.connect(self.someValueChanged)
-
- def someValueChanged(self):
- if self.initialized:
- self.base.valuesChanged.emit(self.getArguments())
-
- def onLayersChanged(self):
- pass
-
- def initialize(self):
- if not self.initialized:
- Utils.LayerRegistry.instance().layersChanged.connect(self.onLayersChanged)
- self.onLayersChanged()
- self.initialized = True
- self.someValueChanged()
-
- def exec_(self):
- self.initialize()
- return self.base.exec_()
-
- def show_(self):
- self.initialize()
- return self.base.show()
-
- def setCommandViewerEnabled(self, enable):
- self.base.setCommandViewerEnabled(enable)
- self.someValueChanged()
-
- def onRun(self):
- self.base.onRun()
-
- def onClosing(self):
- Utils.LayerRegistry.instance().layersChanged.disconnect(self.onLayersChanged)
- self.base.onClosing()
- self.initialized = False
-
- def onHelp(self):
- self.base.onHelp()
-
- def onFinished(self, exitCode, status):
- self.base.onFinished(exitCode, status)
-
- def onError(self, error):
- self.base.onError(error)
-
- def getArguments(self):
- pass
-
- def getInputFileName(self):
- pass
-
- def getOutputFileName(self):
- pass
-
- def addLayerIntoCanvas(self, fileInfo):
- pass
-
- def finished(self, load):
- outFn = self.getOutputFileName()
- if outFn is None:
- return
-
- if outFn == '':
- QMessageBox.warning(self, self.tr("Warning"), self.tr("No output file created."))
- return
-
- fileInfo = QFileInfo(outFn)
- if fileInfo.exists():
- if load:
- self.addLayerIntoCanvas(fileInfo)
- QMessageBox.information(self, self.tr("Finished"), self.tr("Processing completed."))
- else:
- #QMessageBox.warning(self, self.tr( "Warning" ), self.tr( "%1 not created." ).arg( outFn ) )
- QMessageBox.warning(self, self.tr("Warning"), self.tr("%s not created.") % outFn)
-
- # This method is useful to set up options for the command. It sets for each passed widget:
- # 1. its passed signals to connect to the BasePluginWidget.someValueChanged() slot,
- # 2. its enabler checkbox or enabled status,
- # 3. its status as visible (hide) if the installed gdal version is greater or equal (lesser) then the passed version
- #
- # wdgts_sgnls_chk_ver_list: list of wdgts_sgnls_chk_ver
- # wdgts_sgnls_chk_ver: tuple containing widgets, signals, enabler checkbox or enabled status, required version
- def setParamsStatus(self, wdgts_sgnls_chk_ver_list):
- if isinstance(wdgts_sgnls_chk_ver_list, list):
- for wdgts_sgnls_chk_ver in wdgts_sgnls_chk_ver_list:
- self.setParamsStatus(wdgts_sgnls_chk_ver)
- return
-
- wdgts_sgnls_chk_ver = wdgts_sgnls_chk_ver_list
- if not isinstance(wdgts_sgnls_chk_ver, tuple):
- return
-
- if len(wdgts_sgnls_chk_ver) > 0:
- wdgts = wdgts_sgnls_chk_ver[0]
- else:
- wdgts = None
-
- if len(wdgts_sgnls_chk_ver) > 1:
- sgnls = wdgts_sgnls_chk_ver[1]
- else:
- sgnls = None
-
- if len(wdgts_sgnls_chk_ver) > 2:
- chk = wdgts_sgnls_chk_ver[2]
- else:
- chk = None
-
- if len(wdgts_sgnls_chk_ver) > 3:
- ver = wdgts_sgnls_chk_ver[3]
- else:
- ver = None
-
- if isinstance(wdgts, list):
- for wdgt in wdgts:
- self.setParamsStatus((wdgt, sgnls, chk, ver))
- return
-
- wdgt = wdgts
- if not isinstance(wdgt, QWidget):
- return
-
- # if check version fails, disable the widget then hide both it and its enabler checkbox
- # new check for gdal 1.10, must update all widgets for this and then remove previous check
- if ver is not None and isinstance(ver, int):
- gdalVerNum = Utils.GdalConfig.versionNum()
- if ver > gdalVerNum:
- wdgt.setVisible(False)
- if isinstance(chk, QWidget):
- chk.setVisible(False)
- chk.setChecked(False)
- sgnls = None
- chk = False
-
- elif ver is not None:
- if not isinstance(ver, Utils.Version):
- ver = Utils.Version(ver)
- gdalVer = Utils.GdalConfig.version()
- if ver < Utils.Version("0") or (gdalVer is not None and ver > gdalVer):
- wdgt.setVisible(False)
- if isinstance(chk, QWidget):
- chk.setVisible(False)
- chk.setChecked(False)
- sgnls = None
- chk = False
-
- # connects the passed signals to the BasePluginWidget.someValueChanged slot
- if isinstance(sgnls, list):
- for sgnl in sgnls:
- self.setParamsStatus((wdgt, sgnl, chk))
- return
-
- sgnl = sgnls
- if sgnl is not None:
- getattr(wdgt, sgnl).connect(self.someValueChanged)
-
- # set the passed checkbox as widget enabler
- if isinstance(chk, bool):
- wdgt.setEnabled(chk)
- if (isinstance(chk, QAbstractButton) or isinstance(chk, QGroupBox)) and chk.isCheckable():
- wdgt.setEnabled(chk.isChecked())
- chk.toggled.connect(wdgt.setEnabled)
- chk.toggled.connect(self.someValueChanged)
diff --git a/python/plugins/GdalTools/tools/widgetPolygonize.ui b/python/plugins/GdalTools/tools/widgetPolygonize.ui
deleted file mode 100644
index bd7d1ce6ca6..00000000000
--- a/python/plugins/GdalTools/tools/widgetPolygonize.ui
+++ /dev/null
@@ -1,85 +0,0 @@
-
-
- GdalToolsWidget
-
-
-
- 0
- 0
- 446
- 121
-
-
-
-
- 0
- 0
-
-
-
- Polygonize (Raster to vector)
-
-
-
-
-
- &Input file (raster)
-
-
- inSelector
-
-
-
-
-
-
-
-
-
- &Output file for polygons (shapefile)
-
-
- outSelector
-
-
-
-
-
-
-
-
-
- &Field name
-
-
-
-
-
-
- DN
-
-
-
-
-
-
- Use mask
-
-
-
-
-
-
-
-
-
-
- GdalToolsInOutSelector
- QWidget
- .inOutSelector
- 1
-
-
-
-
-
diff --git a/python/plugins/GdalTools/tools/widgetProjection.ui b/python/plugins/GdalTools/tools/widgetProjection.ui
deleted file mode 100644
index 17afd435f05..00000000000
--- a/python/plugins/GdalTools/tools/widgetProjection.ui
+++ /dev/null
@@ -1,109 +0,0 @@
-
-
- GdalToolsWidget
-
-
-
- 0
- 0
- 369
- 244
-
-
-
-
- 0
- 0
-
-
-
- Assign projection
-
-
-
-
-
- Batch mode (for processing whole directory)
-
-
-
-
-
-
- WARNING: current projection definition will be cleared
-
-
-
-
-
-
-
-
- &Input file
-
-
- inSelector
-
-
-
-
-
-
- Recurse subdirectories
-
-
-
-
-
-
- Desired SRS
-
-
-
-
-
-
- Output will be:
-- new GeoTiff if input file is not GeoTiff
-- overwritten if input is GeoTiff
-
-
- Qt::AutoText
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Select...
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- GdalToolsInOutSelector
- QWidget
- .inOutSelector
- 1
-
-
-
-
-
diff --git a/python/plugins/GdalTools/tools/widgetProximity.ui b/python/plugins/GdalTools/tools/widgetProximity.ui
deleted file mode 100644
index 927d6c2d7ed..00000000000
--- a/python/plugins/GdalTools/tools/widgetProximity.ui
+++ /dev/null
@@ -1,148 +0,0 @@
-
-
- GdalToolsWidget
-
-
-
- 0
- 0
- 327
- 229
-
-
-
-
- 0
- 0
-
-
-
- Proximity (Raster distance)
-
-
-
-
-
-
-
- &Input file
-
-
- inSelector
-
-
-
-
-
-
- &Output file
-
-
- outSelector
-
-
-
-
-
-
- &Values
-
-
-
-
-
-
- &Dist units
-
-
- true
-
-
-
-
-
-
-
- GEO
-
-
-
-
- PIXEL
-
-
-
-
-
-
-
- &Max dist
-
-
-
-
-
-
- 65000
-
-
-
-
-
-
- &No data
-
-
-
-
-
-
- -100000
-
-
- 65000
-
-
-
-
-
-
- &Fixed buf val
-
-
-
-
-
-
- 65000
-
-
-
-
-
-
- 0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- GdalToolsInOutSelector
- QWidget
- .inOutSelector
- 1
-
-
-
-
-
diff --git a/python/plugins/GdalTools/tools/widgetRasterize.ui b/python/plugins/GdalTools/tools/widgetRasterize.ui
deleted file mode 100644
index f98e30751b2..00000000000
--- a/python/plugins/GdalTools/tools/widgetRasterize.ui
+++ /dev/null
@@ -1,285 +0,0 @@
-
-
- GdalToolsWidget
-
-
-
- 0
- 0
- 509
- 261
-
-
-
-
- 0
- 0
-
-
-
- Rasterize (Vector to raster)
-
-
-
-
-
-
-
- &Input file (shapefile)
-
-
- inSelector
-
-
-
-
-
-
- &Attribute field
-
-
- attributeComboBox
-
-
-
-
-
-
-
- 0
- 0
-
-
-
-
-
-
-
- &Output file for rasterized vectors (raster)
-
-
- outSelector
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Keep existing raster size and resolution
-
-
- true
-
-
-
-
-
-
- Raster size in pixels
-
-
- false
-
-
-
-
-
-
- false
-
-
-
- 30
-
-
- 0
-
-
- 0
-
-
-
-
-
- 0
- 0
-
-
-
- Width
-
-
-
-
-
-
- 999999
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- Height
-
-
- 40
-
-
-
-
-
-
- 999999
-
-
-
-
-
-
-
-
-
- Raster resolution in map units per pixel
-
-
-
-
-
-
- false
-
-
-
- 30
-
-
- 0
-
-
- 0
-
-
-
-
-
- 0
- 0
-
-
-
- Horizontal
-
-
-
-
-
-
- 8
-
-
- 999999999.990000009536743
-
-
- 1.000000000000000
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- Vertical
-
-
- 40
-
-
-
-
-
-
- Qt::ImhNone
-
-
- 8
-
-
- 999999999.990000009536743
-
-
- 1.000000000000000
-
-
- 2.000000000000000
-
-
-
-
-
-
-
-
-
-
- GdalToolsInOutSelector
- QWidget
- .inOutSelector
- 1
-
-
-
-
-
- radioSetSize
- toggled(bool)
- widgetSize
- setEnabled(bool)
-
-
- 254
- 128
-
-
- 254
- 163
-
-
-
-
- radioSetResolution
- toggled(bool)
- widgetResolution
- setEnabled(bool)
-
-
- 254
- 198
-
-
- 254
- 233
-
-
-
-
-
diff --git a/python/plugins/GdalTools/tools/widgetSieve.ui b/python/plugins/GdalTools/tools/widgetSieve.ui
deleted file mode 100644
index 2867a0e180d..00000000000
--- a/python/plugins/GdalTools/tools/widgetSieve.ui
+++ /dev/null
@@ -1,100 +0,0 @@
-
-
- GdalToolsWidget
-
-
-
- 0
- 0
- 365
- 129
-
-
-
-
- 0
- 0
-
-
-
- Sieve
-
-
-
-
-
-
-
- &Input file
-
-
- inSelector
-
-
-
-
-
-
- &Output file
-
-
- outSelector
-
-
-
-
-
-
- &Threshold
-
-
-
-
-
-
- 65000
-
-
-
-
-
-
- &Pixel connections
-
-
-
-
-
-
-
- 4
-
-
-
-
- 8
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- GdalToolsInOutSelector
- QWidget
- .inOutSelector
- 1
-
-
-
-
-
diff --git a/python/plugins/GdalTools/tools/widgetTileIndex.ui b/python/plugins/GdalTools/tools/widgetTileIndex.ui
deleted file mode 100644
index 777e74248d0..00000000000
--- a/python/plugins/GdalTools/tools/widgetTileIndex.ui
+++ /dev/null
@@ -1,90 +0,0 @@
-
-
- GdalToolsWidget
-
-
-
- 0
- 0
- 400
- 153
-
-
-
- Raster tile index
-
-
-
-
-
-
-
- Input directory
-
-
- inSelector
-
-
-
-
-
-
- Recurse subdirectories
-
-
-
-
-
-
- Output shapefile
-
-
- outSelector
-
-
-
-
-
-
- Tile index field
-
-
-
-
-
-
- true
-
-
- location
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Skip files with different projection ref
-
-
-
-
-
-
-
- GdalToolsInOutSelector
- QWidget
- .inOutSelector
- 1
-
-
-
-
-
diff --git a/python/plugins/GdalTools/tools/widgetTranslate.ui b/python/plugins/GdalTools/tools/widgetTranslate.ui
deleted file mode 100644
index ad679d425c3..00000000000
--- a/python/plugins/GdalTools/tools/widgetTranslate.ui
+++ /dev/null
@@ -1,303 +0,0 @@
-
-
- GdalToolsWidget
-
-
-
- 0
- 0
- 335
- 429
-
-
-
-
- 0
- 0
-
-
-
- Translate (Convert format)
-
-
-
-
-
- Batch mode (for processing whole directory)
-
-
-
-
-
-
-
-
- &Input Layer
-
-
- inSelector
-
-
-
-
-
-
- &Output file
-
-
- outSelector
-
-
-
-
-
-
- Output format
-
-
-
-
-
-
-
- 0
- 0
-
-
-
-
-
-
-
- &Target SRS
-
-
-
-
-
-
-
-
-
- 100
- 0
-
-
-
-
-
-
-
- Select...
-
-
-
-
-
-
-
-
-
- 100
- 16777215
-
-
-
- Percentage to resize image. This will change pixel size/image resolution accordingly: 25% will create an image with pixels 4x larger.
-
-
- Outsize
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- Percentage to resize image. This will change pixel size/image resolution accordingly: 25% will create an image with pixels 4x larger.
-
-
- %
-
-
- 1
-
-
- 1000
-
-
-
-
-
-
- Assign a specified nodata value to output bands.
-
-
- No data
-
-
-
-
-
-
- To expose a dataset with 1 band with a color table as a dataset with 3 (RGB) or 4 (RGBA) bands.
-Useful for output drivers such as JPEG, JPEG2000, MrSID, ECW that don't support color indexed datasets.
-The 'gray' value (from GDAL 1.7.0) enables to expand a dataset with a color table that only contains gray levels to a gray indexed dataset.
-
-
- Expand
-
-
-
-
-
-
- To expose a dataset with 1 band with a color table as a dataset with 3 (RGB) or 4 (RGBA) bands.
-Useful for output drivers such as JPEG, JPEG2000, MrSID, ECW that don't support color indexed datasets.
-The 'gray' value (from GDAL 1.7.0) enables to expand a dataset with a color table that only contains gray levels to a gray indexed dataset.
-
-
-
- Gray
-
-
-
-
- RGB
-
-
-
-
- RGBA
-
-
-
-
-
-
-
- Selects a subwindow from the source image for copying based on pixel/line location. (Enter Xoff Yoff Xsize Ysize)
-
-
- Srcwin
-
-
-
-
-
-
- Selects a subwindow from the source image for copying based on pixel/line location. (Enter Xoff Yoff Xsize Ysize)
-
-
-
-
-
-
- Selects a subwindow from the source image for copying (like -srcwin) but with the corners given in georeferenced coordinates. (Enter ulx uly lrx lry)
-
-
- Prjwin
-
-
-
-
-
-
- Selects a subwindow from the source image for copying (like -srcwin) but with the corners given in georeferenced coordinates. (Enter ulx uly lrx lry)
-
-
-
-
-
-
- Copy all subdatasets of this file to individual output files. Use with formats like HDF or OGDI that have subdatasets.
-
-
- Sds
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- Assign a specified nodata value to output bands.
-
-
- -999999999
-
-
- 999999999
-
-
-
-
-
-
-
-
-
-
-
-
- falsetrue
-
- &Creation Options
-
-
- true
-
-
- false
-
-
-
- 9
-
-
- 9
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- GdalToolsInOutSelector
- QWidget
- .inOutSelector
- 1
-
-
- QgsCollapsibleGroupBox
- QGroupBox
- qgis.gui
- 1
-
-
- QgsRasterFormatSaveOptionsWidget
- QWidget
- qgis.gui
- 1
-
-
-
-
-
diff --git a/python/plugins/GdalTools/tools/widgetWarp.ui b/python/plugins/GdalTools/tools/widgetWarp.ui
deleted file mode 100644
index 6850da048bf..00000000000
--- a/python/plugins/GdalTools/tools/widgetWarp.ui
+++ /dev/null
@@ -1,276 +0,0 @@
-
-
- GdalToolsWidget
-
-
-
- 0
- 0
- 415
- 422
-
-
-
-
- 0
- 0
-
-
-
- Warp (Reproject)
-
-
-
-
-
- Batch mode (for processing whole directory)
-
-
-
-
-
-
-
-
- &Input file
-
-
- inSelector
-
-
-
-
-
-
- &Output file
-
-
- outSelector
-
-
-
-
-
-
- &Source SRS
-
-
-
-
-
-
-
-
-
- 100
- 0
-
-
-
-
-
-
-
- Select...
-
-
-
-
-
-
-
-
- &Target SRS
-
-
-
-
-
-
-
-
-
- 100
- 0
-
-
-
-
-
-
-
- Select...
-
-
-
-
-
-
-
-
- &Resampling method
-
-
-
-
-
-
-
- Near
-
-
-
-
- Bilinear
-
-
-
-
- Cubic
-
-
-
-
- Cubic spline
-
-
-
-
- Lanczos
-
-
-
-
-
-
-
- No data values
-
-
-
-
-
-
- 0
-
-
-
-
-
-
- &Memory used for caching
-
-
-
-
-
-
- MB
-
-
- 20
-
-
- 1024
-
-
-
-
-
-
- Mask layer
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Resize
-
-
- true
-
-
- false
-
-
-
-
-
-
- 0
- 0
-
-
-
- Width
-
-
-
-
-
-
- 999999
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- Height
-
-
- 40
-
-
-
-
-
-
- 999999
-
-
-
-
-
-
-
-
-
-
-
-
- Use m&ultithreaded warping implementation
-
-
-
-
-
-
-
- GdalToolsInOutSelector
- QWidget
- .inOutSelector
- 1
-
-
-
-
-
diff --git a/python/plugins/db_manager/db_plugins/data_model.py b/python/plugins/db_manager/db_plugins/data_model.py
index 6ffc3f52232..de0ddd2208b 100644
--- a/python/plugins/db_manager/db_plugins/data_model.py
+++ b/python/plugins/db_manager/db_plugins/data_model.py
@@ -89,7 +89,7 @@ class BaseTableModel(QAbstractTableModel):
# too much data to display, elide the string
val = val[:300]
try:
- return str(val) # convert to unicode
+ return str(val) # convert to Unicode
except UnicodeDecodeError:
return str(val, 'utf-8', 'replace') # convert from utf8 and replace errors (if any)
diff --git a/python/plugins/db_manager/db_plugins/plugin.py b/python/plugins/db_manager/db_plugins/plugin.py
index f56a8d2fcc2..8da1344c75a 100644
--- a/python/plugins/db_manager/db_plugins/plugin.py
+++ b/python/plugins/db_manager/db_plugins/plugin.py
@@ -424,7 +424,7 @@ class Database(DbItemObject):
QApplication.restoreOverrideCursor()
try:
if not isinstance(item, Table) or item.isView:
- parent.infoBar.pushMessage(QApplication.translate("DBManagerPlugin", "Select a table for editation."),
+ parent.infoBar.pushMessage(QApplication.translate("DBManagerPlugin", "Select a table to edit."),
QgsMessageBar.INFO, parent.iface.messageTimeout())
return
from ..dlg_table_properties import DlgTableProperties
diff --git a/python/plugins/db_manager/dlg_sql_layer_window.py b/python/plugins/db_manager/dlg_sql_layer_window.py
index dc7bc22ad6a..e23901eafad 100644
--- a/python/plugins/db_manager/dlg_sql_layer_window.py
+++ b/python/plugins/db_manager/dlg_sql_layer_window.py
@@ -397,7 +397,7 @@ class DlgSqlLayerWindow(QWidget, Ui_Dialog):
QApplication.restoreOverrideCursor()
def setColumnCombos(self, cols, quotedCols):
- # get sensible default columns. do this before sorting in case there's hints in the column order (eg, id is more likely to be first)
+ # get sensible default columns. do this before sorting in case there's hints in the column order (e.g., id is more likely to be first)
try:
defaultGeomCol = next(col for col in cols if col in ['geom', 'geometry', 'the_geom', 'way'])
except:
diff --git a/python/plugins/db_manager/dlg_sql_window.py b/python/plugins/db_manager/dlg_sql_window.py
index c876d63e739..22a57d9618f 100644
--- a/python/plugins/db_manager/dlg_sql_window.py
+++ b/python/plugins/db_manager/dlg_sql_window.py
@@ -333,7 +333,7 @@ class DlgSqlWindow(QWidget, Ui_Dialog):
QApplication.restoreOverrideCursor()
def setColumnCombos(self, cols, quotedCols):
- # get sensible default columns. do this before sorting in case there's hints in the column order (eg, id is more likely to be first)
+ # get sensible default columns. do this before sorting in case there's hints in the column order (e.g., id is more likely to be first)
try:
defaultGeomCol = next(col for col in cols if col in ['geom', 'geometry', 'the_geom', 'way'])
except:
diff --git a/python/plugins/processing/ProcessingPlugin.py b/python/plugins/processing/ProcessingPlugin.py
index 459a52b39b6..add03335516 100644
--- a/python/plugins/processing/ProcessingPlugin.py
+++ b/python/plugins/processing/ProcessingPlugin.py
@@ -31,6 +31,7 @@ import inspect
import os
import sys
+from qgis.core import QgsApplication
from qgis.PyQt.QtCore import Qt, QCoreApplication, QDir
from qgis.PyQt.QtWidgets import QMenu, QAction
from qgis.PyQt.QtGui import QIcon
@@ -71,13 +72,13 @@ class ProcessingPlugin(object):
self.toolboxAction = self.toolbox.toggleViewAction()
self.toolboxAction.setObjectName('toolboxAction')
self.toolboxAction.setIcon(
- QIcon(os.path.join(cmd_folder, 'images', 'alg.png')))
+ QIcon(os.path.join(cmd_folder, 'images', 'alg.svg')))
self.toolboxAction.setText(self.tr('&Toolbox'))
self.iface.registerMainWindowAction(self.toolboxAction, 'Ctrl+Alt+T')
self.menu.addAction(self.toolboxAction)
self.modelerAction = QAction(
- QIcon(os.path.join(cmd_folder, 'images', 'model.png')),
+ QIcon(os.path.join(cmd_folder, 'images', 'model.svg')),
self.tr('Graphical &Modeler...'), self.iface.mainWindow())
self.modelerAction.setObjectName('modelerAction')
self.modelerAction.triggered.connect(self.openModeler)
@@ -85,23 +86,15 @@ class ProcessingPlugin(object):
self.menu.addAction(self.modelerAction)
self.historyAction = QAction(
- QIcon(os.path.join(cmd_folder, 'images', 'history.gif')),
+ QIcon(os.path.join(cmd_folder, 'images', 'history.svg')),
self.tr('&History...'), self.iface.mainWindow())
self.historyAction.setObjectName('historyAction')
self.historyAction.triggered.connect(self.openHistory)
self.iface.registerMainWindowAction(self.historyAction, 'Ctrl+Alt+H')
self.menu.addAction(self.historyAction)
- self.configAction = QAction(
- QIcon(os.path.join(cmd_folder, 'images', 'config.png')),
- self.tr('&Options...'), self.iface.mainWindow())
- self.configAction.setObjectName('configAction')
- self.configAction.triggered.connect(self.openConfig)
- self.iface.registerMainWindowAction(self.configAction, 'Ctrl+Alt+C')
- self.menu.addAction(self.configAction)
-
self.resultsAction = QAction(
- QIcon(os.path.join(cmd_folder, 'images', 'results.png')),
+ QIcon(os.path.join(cmd_folder, 'images', 'results.svg')),
self.tr('&Results Viewer...'), self.iface.mainWindow())
self.resultsAction.setObjectName('resultsAction')
self.resultsAction.triggered.connect(self.openResults)
@@ -113,7 +106,7 @@ class ProcessingPlugin(object):
self.iface.firstRightStandardMenu().menuAction(), self.menu)
self.commanderAction = QAction(
- QIcon(os.path.join(cmd_folder, 'images', 'commander.png')),
+ QIcon(os.path.join(cmd_folder, 'images', 'commander.svg')),
self.tr('&Commander'), self.iface.mainWindow())
self.commanderAction.setObjectName('commanderAction')
self.commanderAction.triggered.connect(self.openCommander)
@@ -121,6 +114,18 @@ class ProcessingPlugin(object):
self.iface.registerMainWindowAction(self.commanderAction,
self.tr('Ctrl+Alt+D'))
+ self.menu.addSeparator()
+
+ self.configAction = QAction(
+ QIcon(QgsApplication.getThemeIcon('mActionOptions.svg')),
+ self.tr('&Options...'), self.iface.mainWindow())
+ self.configAction.setObjectName('configAction')
+ self.configAction.setMenuRole(QAction.NoRole)
+
+ self.configAction.triggered.connect(self.openConfig)
+ self.iface.registerMainWindowAction(self.configAction, 'Ctrl+Alt+C')
+ self.menu.addAction(self.configAction)
+
initializeMenus()
createMenus()
diff --git a/python/plugins/processing/algs/gdal/CMakeLists.txt b/python/plugins/processing/algs/gdal/CMakeLists.txt
index 38228582859..3381dcf771f 100644
--- a/python/plugins/processing/algs/gdal/CMakeLists.txt
+++ b/python/plugins/processing/algs/gdal/CMakeLists.txt
@@ -1,3 +1,5 @@
FILE(GLOB PY_FILES *.py)
+ADD_SUBDIRECTORY(ui)
+
PLUGIN_INSTALL(processing ./algs/gdal ${PY_FILES})
diff --git a/python/plugins/processing/algs/gdal/ClipByExtent.py b/python/plugins/processing/algs/gdal/ClipByExtent.py
index 5f5394a8970..311a49bae45 100644
--- a/python/plugins/processing/algs/gdal/ClipByExtent.py
+++ b/python/plugins/processing/algs/gdal/ClipByExtent.py
@@ -32,13 +32,11 @@ from qgis.PyQt.QtGui import QIcon
from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
-from processing.core.parameters import ParameterRaster
-from processing.core.parameters import ParameterExtent
-from processing.core.parameters import ParameterString
+from processing.core.parameters import (ParameterRaster,
+ ParameterExtent,
+ ParameterString,
+ ParameterSelection)
from processing.core.outputs import OutputRaster
-from processing.core.parameters import ParameterSelection
-from processing.core.parameters import ParameterNumber
-from processing.core.parameters import ParameterBoolean
from processing.algs.gdal.GdalUtils import GdalUtils
@@ -51,18 +49,9 @@ class ClipByExtent(GdalAlgorithm):
OUTPUT = 'OUTPUT'
NO_DATA = 'NO_DATA'
PROJWIN = 'PROJWIN'
- EXTRA = 'EXTRA'
+ OPTIONS = 'OPTIONS'
RTYPE = 'RTYPE'
TYPE = ['Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64']
- TILED = 'TILED'
- COMPRESS = 'COMPRESS'
- JPEGCOMPRESSION = 'JPEGCOMPRESSION'
- PREDICTOR = 'PREDICTOR'
- ZLEVEL = 'ZLEVEL'
- BIGTIFF = 'BIGTIFF'
- BIGTIFFTYPE = ['', 'YES', 'NO', 'IF_NEEDED', 'IF_SAFER']
- COMPRESSTYPE = ['NONE', 'JPEG', 'LZW', 'PACKBITS', 'DEFLATE']
- TFW = 'TFW'
def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'raster-clip.png'))
@@ -70,58 +59,31 @@ class ClipByExtent(GdalAlgorithm):
def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Clip raster by extent')
self.group, self.i18n_group = self.trAlgorithm('[GDAL] Extraction')
- self.addParameter(ParameterRaster(
- self.INPUT, self.tr('Input layer'), False))
+
+ self.addParameter(ParameterRaster(self.INPUT, self.tr('Input layer')))
self.addParameter(ParameterString(self.NO_DATA,
self.tr("Nodata value, leave blank to take the nodata value from input"),
- '', optional=True))
+ '',
+ optional=True))
self.addParameter(ParameterExtent(self.PROJWIN, self.tr('Clipping extent')))
-
- params = []
- params.append(ParameterSelection(self.RTYPE,
- self.tr('Output raster type'), self.TYPE, 5))
- params.append(ParameterSelection(self.COMPRESS,
- self.tr('GeoTIFF options. Compression type:'), self.COMPRESSTYPE, 4))
- params.append(ParameterNumber(self.JPEGCOMPRESSION,
- self.tr('Set the JPEG compression level'),
- 1, 100, 75))
- params.append(ParameterNumber(self.ZLEVEL,
- self.tr('Set the DEFLATE compression level'),
- 1, 9, 6))
- params.append(ParameterNumber(self.PREDICTOR,
- self.tr('Set the predictor for LZW or DEFLATE compression'),
- 1, 3, 1))
- params.append(ParameterBoolean(self.TILED,
- self.tr('Create tiled output (only used for the GTiff format)'), False))
- params.append(ParameterSelection(self.BIGTIFF,
- self.tr('Control whether the created file is a BigTIFF or a classic TIFF'), self.BIGTIFFTYPE, 0))
- params.append(ParameterBoolean(self.TFW,
- self.tr('Force the generation of an associated ESRI world file (.tfw))'), False))
- params.append(ParameterString(self.EXTRA,
- self.tr('Additional creation parameters'), '', optional=True))
-
- for param in params:
- param.isAdvanced = True
- self.addParameter(param)
+ self.addParameter(ParameterString(self.OPTIONS,
+ self.tr('Additional creation options'),
+ optional=True,
+ metadata={'widget_wrapper': 'processing.algs.gdal.ui.RasterOptionsWidget.RasterOptionsWidgetWrapper'}))
+ self.addParameter(ParameterSelection(self.RTYPE,
+ self.tr('Output raster type'),
+ self.TYPE, 5))
self.addOutput(OutputRaster(self.OUTPUT, self.tr('Clipped (extent)')))
def getConsoleCommands(self):
out = self.getOutputValue(self.OUTPUT)
noData = self.getParameterValue(self.NO_DATA)
+ opts = self.getParameterValue(self.OPTIONS)
+ projwin = self.getParameterValue(self.PROJWIN)
+
if noData is not None:
noData = str(noData)
- projwin = str(self.getParameterValue(self.PROJWIN))
- extra = self.getParameterValue(self.EXTRA)
- if extra is not None:
- extra = str(extra)
- jpegcompression = str(self.getParameterValue(self.JPEGCOMPRESSION))
- predictor = str(self.getParameterValue(self.PREDICTOR))
- zlevel = str(self.getParameterValue(self.ZLEVEL))
- tiled = str(self.getParameterValue(self.TILED))
- compress = self.COMPRESSTYPE[self.getParameterValue(self.COMPRESS)]
- bigtiff = self.BIGTIFFTYPE[self.getParameterValue(self.BIGTIFF)]
- tfw = str(self.getParameterValue(self.TFW))
arguments = []
arguments.append('-of')
@@ -139,22 +101,9 @@ class ClipByExtent(GdalAlgorithm):
arguments.append(regionCoords[1])
arguments.append(regionCoords[2])
- if extra and len(extra) > 0:
- arguments.append(extra)
- if GdalUtils.getFormatShortNameFromFilename(out) == "GTiff":
- arguments.append("-co COMPRESS=" + compress)
- if compress == 'JPEG':
- arguments.append("-co JPEG_QUALITY=" + jpegcompression)
- elif (compress == 'LZW') or (compress == 'DEFLATE'):
- arguments.append("-co PREDICTOR=" + predictor)
- if compress == 'DEFLATE':
- arguments.append("-co ZLEVEL=" + zlevel)
- if tiled == "True":
- arguments.append("-co TILED=YES")
- if tfw == "True":
- arguments.append("-co TFW=YES")
- if len(bigtiff) > 0:
- arguments.append("-co BIGTIFF=" + bigtiff)
+ if opts:
+ arguments.append('-co')
+ arguments.append(opts)
arguments.append(self.getParameterValue(self.INPUT))
arguments.append(out)
diff --git a/python/plugins/processing/algs/gdal/ClipByMask.py b/python/plugins/processing/algs/gdal/ClipByMask.py
index 5fc720c4f91..bf411de774e 100644
--- a/python/plugins/processing/algs/gdal/ClipByMask.py
+++ b/python/plugins/processing/algs/gdal/ClipByMask.py
@@ -32,12 +32,11 @@ from qgis.PyQt.QtGui import QIcon
from osgeo import gdal
-from processing.core.parameters import ParameterRaster
-from processing.core.parameters import ParameterVector
-from processing.core.parameters import ParameterBoolean
-from processing.core.parameters import ParameterString
-from processing.core.parameters import ParameterSelection
-from processing.core.parameters import ParameterNumber
+from processing.core.parameters import (ParameterRaster,
+ ParameterVector,
+ ParameterBoolean,
+ ParameterString,
+ ParameterSelection)
from processing.core.outputs import OutputRaster
@@ -59,18 +58,9 @@ class ClipByMask(GdalAlgorithm):
ALPHA_BAND = 'ALPHA_BAND'
CROP_TO_CUTLINE = 'CROP_TO_CUTLINE'
KEEP_RESOLUTION = 'KEEP_RESOLUTION'
- EXTRA = 'EXTRA'
+ OPTIONS = 'OPTIONS'
RTYPE = 'RTYPE'
TYPE = ['Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64']
- TILED = 'TILED'
- COMPRESS = 'COMPRESS'
- JPEGCOMPRESSION = 'JPEGCOMPRESSION'
- PREDICTOR = 'PREDICTOR'
- ZLEVEL = 'ZLEVEL'
- BIGTIFF = 'BIGTIFF'
- BIGTIFFTYPE = ['', 'YES', 'NO', 'IF_NEEDED', 'IF_SAFER']
- COMPRESSTYPE = ['NONE', 'JPEG', 'LZW', 'PACKBITS', 'DEFLATE']
- TFW = 'TFW'
def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'raster-clip.png'))
@@ -78,6 +68,7 @@ class ClipByMask(GdalAlgorithm):
def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Clip raster by mask layer')
self.group, self.i18n_group = self.trAlgorithm('[GDAL] Extraction')
+
self.addParameter(ParameterRaster(self.INPUT, self.tr('Input layer'), False))
self.addParameter(ParameterVector(self.MASK, self.tr('Mask layer'),
[dataobjects.TYPE_VECTOR_POLYGON]))
@@ -85,38 +76,21 @@ class ClipByMask(GdalAlgorithm):
self.tr("Nodata value, leave blank to take the nodata value from input"),
'', optional=True))
self.addParameter(ParameterBoolean(self.ALPHA_BAND,
- self.tr('Create and output alpha band'), False))
+ self.tr('Create and output alpha band'),
+ False))
self.addParameter(ParameterBoolean(self.CROP_TO_CUTLINE,
- self.tr('Crop the extent of the target dataset to the extent of the cutline'), True))
+ self.tr('Crop the extent of the target dataset to the extent of the cutline'),
+ True))
self.addParameter(ParameterBoolean(self.KEEP_RESOLUTION,
- self.tr('Keep resolution of output raster'), False))
-
- params = []
- params.append(ParameterSelection(self.RTYPE,
- self.tr('Output raster type'), self.TYPE, 5))
- params.append(ParameterSelection(self.COMPRESS,
- self.tr('GeoTIFF options. Compression type:'), self.COMPRESSTYPE, 4))
- params.append(ParameterNumber(self.JPEGCOMPRESSION,
- self.tr('Set the JPEG compression level'),
- 1, 100, 75))
- params.append(ParameterNumber(self.ZLEVEL,
- self.tr('Set the DEFLATE compression level'),
- 1, 9, 6))
- params.append(ParameterNumber(self.PREDICTOR,
- self.tr('Set the predictor for LZW or DEFLATE compression'),
- 1, 3, 1))
- params.append(ParameterBoolean(self.TILED,
- self.tr('Create tiled output (only used for the GTiff format)'), False))
- params.append(ParameterSelection(self.BIGTIFF,
- self.tr('Control whether the created file is a BigTIFF or a classic TIFF'), self.BIGTIFFTYPE, 0))
- params.append(ParameterBoolean(self.TFW,
- self.tr('Force the generation of an associated ESRI world file (.tfw))'), False))
- params.append(ParameterString(self.EXTRA,
- self.tr('Additional creation parameters'), '', optional=True))
-
- for param in params:
- param.isAdvanced = True
- self.addParameter(param)
+ self.tr('Keep resolution of output raster'),
+ False))
+ self.addParameter(ParameterString(self.OPTIONS,
+ self.tr('Additional creation options'),
+ optional=True,
+ metadata={'widget_wrapper': 'processing.algs.gdal.ui.RasterOptionsWidget.RasterOptionsWidgetWrapper'}))
+ self.addParameter(ParameterSelection(self.RTYPE,
+ self.tr('Output raster type'),
+ self.TYPE, 5))
self.addOutput(OutputRaster(self.OUTPUT, self.tr('Clipped (mask)')))
@@ -127,21 +101,14 @@ class ClipByMask(GdalAlgorithm):
self.getParameterValue(self.MASK))
ogrMask = ogrConnectionString(mask)[1:-1]
noData = self.getParameterValue(self.NO_DATA)
+ opts = self.getParameterValue(self.OPTIONS)
+
if noData is not None:
noData = str(noData)
+
addAlphaBand = self.getParameterValue(self.ALPHA_BAND)
cropToCutline = self.getParameterValue(self.CROP_TO_CUTLINE)
keepResolution = self.getParameterValue(self.KEEP_RESOLUTION)
- extra = self.getParameterValue(self.EXTRA)
- if extra is not None:
- extra = str(extra)
- jpegcompression = str(self.getParameterValue(self.JPEGCOMPRESSION))
- predictor = str(self.getParameterValue(self.PREDICTOR))
- zlevel = str(self.getParameterValue(self.ZLEVEL))
- tiled = str(self.getParameterValue(self.TILED))
- compress = self.COMPRESSTYPE[self.getParameterValue(self.COMPRESS)]
- bigtiff = self.BIGTIFFTYPE[self.getParameterValue(self.BIGTIFF)]
- tfw = str(self.getParameterValue(self.TFW))
arguments = []
arguments.append('-ot')
@@ -174,24 +141,9 @@ class ClipByMask(GdalAlgorithm):
if addAlphaBand:
arguments.append('-dstalpha')
- if extra and len(extra) > 0:
- arguments.append(extra)
- if GdalUtils.getFormatShortNameFromFilename(out) == "GTiff":
- arguments.append("-co COMPRESS=" + compress)
- if compress == 'JPEG':
- arguments.append("-co JPEG_QUALITY=" + jpegcompression)
- elif (compress == 'LZW') or (compress == 'DEFLATE'):
- arguments.append("-co PREDICTOR=" + predictor)
- if compress == 'DEFLATE':
- arguments.append("-co ZLEVEL=" + zlevel)
- if tiled == "True":
- arguments.append("-co TILED=YES")
- if tfw == "True":
- arguments.append("-co TFW=YES")
- if len(bigtiff) > 0:
- arguments.append("-co BIGTIFF=" + bigtiff)
-
- arguments.append("-wo OPTIMIZE_SIZE=TRUE")
+ if opts:
+ arguments.append('-co')
+ arguments.append(opts)
if GdalUtils.version() in [2010000, 2010100]:
arguments.append("--config GDALWARP_IGNORE_BAD_CUTLINE YES")
diff --git a/python/plugins/processing/algs/gdal/GdalAlgorithm.py b/python/plugins/processing/algs/gdal/GdalAlgorithm.py
index 5df8012983f..2fda9a736ce 100644
--- a/python/plugins/processing/algs/gdal/GdalAlgorithm.py
+++ b/python/plugins/processing/algs/gdal/GdalAlgorithm.py
@@ -29,11 +29,12 @@ import os
import re
from qgis.PyQt.QtGui import QIcon
+from qgis.PyQt.QtCore import QUrl
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.algs.gdal.GdalAlgorithmDialog import GdalAlgorithmDialog
from processing.algs.gdal.GdalUtils import GdalUtils
-from processing.tools import dataobjects
+from processing.tools import dataobjects, system
pluginPath = os.path.normpath(os.path.join(
os.path.split(os.path.dirname(__file__))[0], os.pardir))
@@ -73,9 +74,18 @@ class GdalAlgorithm(GeoAlgorithm):
GdalUtils.runGdal(commands, progress)
def shortHelp(self):
- return self._formatHelp('''This algorithm is based on the GDAL %s module.
- For more info, see the module help
- ''' % (self.commandName(), self.commandName()))
+ helpPath = GdalUtils.gdalHelpPath()
+ if helpPath == '':
+ return
+
+ if os.path.exists(helpPath):
+ url = QUrl.fromLocalFile(os.path.join(helpPath, '{}.html'.format(self.commandName()))).toString()
+ else:
+ url = helpPath + '{}.html'.format(self.commandName())
+
+ return self._formatHelp('''This algorithm is based on the GDAL {} module.
+ For more info, see the module help
+ '''.format(self.commandName(), url))
def commandName(self):
alg = self.getCopy()
diff --git a/python/plugins/processing/algs/gdal/GdalOgrAlgorithmProvider.py b/python/plugins/processing/algs/gdal/GdalAlgorithmProvider.py
similarity index 88%
rename from python/plugins/processing/algs/gdal/GdalOgrAlgorithmProvider.py
rename to python/plugins/processing/algs/gdal/GdalAlgorithmProvider.py
index 20eb2fc836a..45fa358f1c7 100644
--- a/python/plugins/processing/algs/gdal/GdalOgrAlgorithmProvider.py
+++ b/python/plugins/processing/algs/gdal/GdalAlgorithmProvider.py
@@ -29,6 +29,7 @@ import os
from qgis.PyQt.QtGui import QIcon
from processing.core.AlgorithmProvider import AlgorithmProvider
+from processing.core.ProcessingConfig import ProcessingConfig, Setting
from .GdalUtils import GdalUtils
from .nearblack import nearblack
@@ -86,7 +87,7 @@ pluginPath = os.path.normpath(os.path.join(
os.path.split(os.path.dirname(__file__))[0], os.pardir))
-class GdalOgrAlgorithmProvider(AlgorithmProvider):
+class GdalAlgorithmProvider(AlgorithmProvider):
"""This provider incorporates GDAL-based algorithms into the
Processing framework.
@@ -99,11 +100,24 @@ class GdalOgrAlgorithmProvider(AlgorithmProvider):
AlgorithmProvider.__init__(self)
self.createAlgsList()
+ def initializeSettings(self):
+ AlgorithmProvider.initializeSettings(self)
+ ProcessingConfig.addSetting(Setting(
+ self.getDescription(),
+ GdalUtils.GDAL_HELP_PATH,
+ self.tr('Location of GDAL docs'),
+ GdalUtils.gdalHelpPath()))
+
+ def unload(self):
+ AlgorithmProvider.unload(self)
+ ProcessingConfig.removeSetting(GdalUtils.GDAL_HELP_PATH)
+
def getDescription(self):
- return self.tr('GDAL/OGR')
+ version = GdalUtils.readableVersion()
+ return 'GDAL ({})'.format(version)
def getName(self):
- return 'gdalogr'
+ return 'gdal'
def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdal.svg'))
diff --git a/python/plugins/processing/algs/gdal/GdalUtils.py b/python/plugins/processing/algs/gdal/GdalUtils.py
index 162c8c81dcb..f2ebe456230 100644
--- a/python/plugins/processing/algs/gdal/GdalUtils.py
+++ b/python/plugins/processing/algs/gdal/GdalUtils.py
@@ -36,8 +36,10 @@ from osgeo import gdal
from qgis.PyQt.QtCore import QSettings
from qgis.core import QgsApplication, QgsVectorFileWriter
+from processing.core.ProcessingConfig import ProcessingConfig
from processing.core.ProcessingLog import ProcessingLog
from processing.core.SilentProgress import SilentProgress
+from processing.tools.system import isWindows, isMac
try:
from osgeo import gdal
@@ -48,6 +50,8 @@ except:
class GdalUtils(object):
+ GDAL_HELP_PATH = 'GDAL_HELP_PATH'
+
supportedRasters = None
@staticmethod
@@ -186,3 +190,25 @@ class GdalUtils(object):
@staticmethod
def version():
return int(gdal.VersionInfo('VERSION_NUM'))
+
+ @staticmethod
+ def readableVersion():
+ return gdal.VersionInfo('RELEASE_NAME')
+
+ @staticmethod
+ def gdalHelpPath():
+ helpPath = ProcessingConfig.getSetting(GdalUtils.GDAL_HELP_PATH)
+
+ if helpPath is None:
+ if isWindows():
+ pass
+ elif isMac():
+ pass
+ else:
+ searchPaths = ['/usr/share/doc/libgdal-doc/gdal']
+ for path in searchPaths:
+ if os.path.exists(path):
+ helpPath = os.path.abspath(path)
+ break
+
+ return helpPath if helpPath is not None else 'http://www.gdal.org/'
diff --git a/python/plugins/processing/algs/gdal/GridAverage.py b/python/plugins/processing/algs/gdal/GridAverage.py
index 59cad977a92..c66ac026e0c 100644
--- a/python/plugins/processing/algs/gdal/GridAverage.py
+++ b/python/plugins/processing/algs/gdal/GridAverage.py
@@ -60,7 +60,7 @@ class GridAverage(GdalAlgorithm):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'grid.png'))
def commandLineName(self):
- return "gdalogr:gridaverage"
+ return "gdal:gridaverage"
def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Grid (Moving average)')
diff --git a/python/plugins/processing/algs/gdal/GridDataMetrics.py b/python/plugins/processing/algs/gdal/GridDataMetrics.py
index d38b20444c6..cf7be900dc8 100644
--- a/python/plugins/processing/algs/gdal/GridDataMetrics.py
+++ b/python/plugins/processing/algs/gdal/GridDataMetrics.py
@@ -65,7 +65,7 @@ class GridDataMetrics(GdalAlgorithm):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'grid.png'))
def commandLineName(self):
- return "gdalogr:griddatametrics"
+ return "gdal:griddatametrics"
def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Grid (Data metrics)')
diff --git a/python/plugins/processing/algs/gdal/GridInvDist.py b/python/plugins/processing/algs/gdal/GridInvDist.py
index 6b5440b80dc..07ebdfeba34 100644
--- a/python/plugins/processing/algs/gdal/GridInvDist.py
+++ b/python/plugins/processing/algs/gdal/GridInvDist.py
@@ -64,7 +64,7 @@ class GridInvDist(GdalAlgorithm):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'grid.png'))
def commandLineName(self):
- return "gdalogr:gridinvdist"
+ return "gdal:gridinvdist"
def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Grid (Inverse distance to a power)')
diff --git a/python/plugins/processing/algs/gdal/GridNearest.py b/python/plugins/processing/algs/gdal/GridNearest.py
index 1fb5645ff15..9f8f42b7dc6 100644
--- a/python/plugins/processing/algs/gdal/GridNearest.py
+++ b/python/plugins/processing/algs/gdal/GridNearest.py
@@ -60,7 +60,7 @@ class GridNearest(GdalAlgorithm):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'grid.png'))
def commandLineName(self):
- return "gdalogr:gridnearestneighbor"
+ return "gdal:gridnearestneighbor"
def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Grid (Nearest neighbor)')
diff --git a/python/plugins/processing/algs/gdal/gdal2tiles.py b/python/plugins/processing/algs/gdal/gdal2tiles.py
index f63c794628d..edd4c658c8e 100644
--- a/python/plugins/processing/algs/gdal/gdal2tiles.py
+++ b/python/plugins/processing/algs/gdal/gdal2tiles.py
@@ -61,7 +61,7 @@ class gdal2tiles(GdalAlgorithm):
WEBVIEWERS = ['all', 'google', 'openlayers', 'leaflet', 'none']
def commandLineName(self):
- return "gdalogr:gdal2tiles"
+ return "gdal:gdal2tiles"
def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('gdal2tiles')
diff --git a/python/plugins/processing/algs/gdal/gdaladdo.py b/python/plugins/processing/algs/gdal/gdaladdo.py
index 525573b6375..2e97a71e6d7 100644
--- a/python/plugins/processing/algs/gdal/gdaladdo.py
+++ b/python/plugins/processing/algs/gdal/gdaladdo.py
@@ -67,7 +67,7 @@ class gdaladdo(GdalAlgorithm):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'raster-overview.png'))
def commandLineName(self):
- return "gdalogr:overviews"
+ return "gdal:overviews"
def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Build overviews (pyramids)')
diff --git a/python/plugins/processing/algs/gdal/information.py b/python/plugins/processing/algs/gdal/information.py
index da5a1489a2d..249bbd2d1ff 100644
--- a/python/plugins/processing/algs/gdal/information.py
+++ b/python/plugins/processing/algs/gdal/information.py
@@ -50,7 +50,7 @@ class information(GdalAlgorithm):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'raster-info.png'))
def commandLineName(self):
- return "gdalorg:rasterinfo"
+ return "gdal:gdalinfo"
def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Information')
diff --git a/python/plugins/processing/algs/gdal/merge.py b/python/plugins/processing/algs/gdal/merge.py
index 5d3dc942bd5..ac8785608bd 100644
--- a/python/plugins/processing/algs/gdal/merge.py
+++ b/python/plugins/processing/algs/gdal/merge.py
@@ -30,12 +30,14 @@ import os
from qgis.PyQt.QtGui import QIcon
from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
+from processing.core.parameters import (ParameterBoolean,
+ ParameterString,
+ ParameterSelection,
+ ParameterMultipleInput)
from processing.core.outputs import OutputRaster
-from processing.core.parameters import ParameterBoolean
-from processing.core.parameters import ParameterMultipleInput
-from processing.core.parameters import ParameterSelection
from processing.tools.system import isWindows
from processing.tools import dataobjects
+
from processing.algs.gdal.GdalUtils import GdalUtils
pluginPath = os.path.split(os.path.split(os.path.dirname(__file__))[0])[0]
@@ -44,10 +46,11 @@ pluginPath = os.path.split(os.path.split(os.path.dirname(__file__))[0])[0]
class merge(GdalAlgorithm):
INPUT = 'INPUT'
- OUTPUT = 'OUTPUT'
+ OPTIONS = 'OPTIONS'
PCT = 'PCT'
SEPARATE = 'SEPARATE'
RTYPE = 'RTYPE'
+ OUTPUT = 'OUTPUT'
TYPE = ['Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64']
@@ -57,31 +60,44 @@ class merge(GdalAlgorithm):
def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Merge')
self.group, self.i18n_group = self.trAlgorithm('[GDAL] Miscellaneous')
- self.addParameter(ParameterMultipleInput(merge.INPUT,
- self.tr('Input layers'), dataobjects.TYPE_RASTER))
- self.addParameter(ParameterBoolean(merge.PCT,
- self.tr('Grab pseudocolor table from first layer'), False))
- self.addParameter(ParameterBoolean(merge.SEPARATE,
- self.tr('Place each input file into a separate band'), False))
+ self.addParameter(ParameterMultipleInput(self.INPUT,
+ self.tr('Input layers'),
+ dataobjects.TYPE_RASTER))
+ self.addParameter(ParameterString(self.OPTIONS,
+ self.tr('Additional creation options'),
+ optional=True,
+ metadata={'widget_wrapper': 'processing.algs.gdal.ui.RasterOptionsWidget.RasterOptionsWidgetWrapper'}))
+ self.addParameter(ParameterBoolean(self.PCT,
+ self.tr('Grab pseudocolor table from first layer'),
+ False))
+ self.addParameter(ParameterBoolean(self.SEPARATE,
+ self.tr('Place each input file into a separate band'),
+ False))
self.addParameter(ParameterSelection(self.RTYPE,
- self.tr('Output raster type'), self.TYPE, 5))
+ self.tr('Output raster type'),
+ self.TYPE, 5))
- self.addOutput(OutputRaster(merge.OUTPUT, self.tr('Merged')))
+ self.addOutput(OutputRaster(self.OUTPUT, self.tr('Merged')))
def getConsoleCommands(self):
arguments = []
arguments.append('-ot')
arguments.append(self.TYPE[self.getParameterValue(self.RTYPE)])
- if self.getParameterValue(merge.SEPARATE):
+ if self.getParameterValue(self.SEPARATE):
arguments.append('-separate')
- if self.getParameterValue(merge.PCT):
+ if self.getParameterValue(self.PCT):
arguments.append('-pct')
+ opts = self.getParameterValue(self.OPTIONS)
+ if opts:
+ arguments.append('-co')
+ arguments.append(opts)
+
arguments.append('-o')
- out = self.getOutputValue(merge.OUTPUT)
+ out = self.getOutputValue(self.OUTPUT)
arguments.append(out)
arguments.append('-of')
arguments.append(GdalUtils.getFormatShortNameFromFilename(out))
- arguments.extend(self.getParameterValue(merge.INPUT).split(';'))
+ arguments.extend(self.getParameterValue(self.INPUT).split(';'))
commands = []
if isWindows():
diff --git a/python/plugins/processing/algs/gdal/ogrinfo.py b/python/plugins/processing/algs/gdal/ogrinfo.py
index 73c24e5d297..2d831a013e5 100644
--- a/python/plugins/processing/algs/gdal/ogrinfo.py
+++ b/python/plugins/processing/algs/gdal/ogrinfo.py
@@ -43,6 +43,9 @@ class OgrInfo(GdalAlgorithm):
SUMMARY_ONLY = 'SUMMARY_ONLY'
OUTPUT = 'OUTPUT'
+ def commandLineName(self):
+ return "gdal:ogrinfo"
+
def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Information')
self.group, self.i18n_group = self.trAlgorithm('[OGR] Miscellaneous')
diff --git a/python/plugins/processing/algs/gdal/polygonize.py b/python/plugins/processing/algs/gdal/polygonize.py
index 92510c62a57..178a1ada4df 100644
--- a/python/plugins/processing/algs/gdal/polygonize.py
+++ b/python/plugins/processing/algs/gdal/polygonize.py
@@ -50,7 +50,7 @@ class polygonize(GdalAlgorithm):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'polygonize.png'))
def commandLineName(self):
- return "gdalogr:polygonize"
+ return "gdal:polygonize"
def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Polygonize (raster to vector)')
diff --git a/python/plugins/processing/algs/gdal/proximity.py b/python/plugins/processing/algs/gdal/proximity.py
index 892330ed9a4..5010f70dc4f 100644
--- a/python/plugins/processing/algs/gdal/proximity.py
+++ b/python/plugins/processing/algs/gdal/proximity.py
@@ -61,7 +61,7 @@ class proximity(GdalAlgorithm):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'proximity.png'))
def commandLineName(self):
- return "gdalogr:proximity"
+ return "gdal:proximity"
def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Proximity (raster distance)')
diff --git a/python/plugins/processing/algs/gdal/rasterize.py b/python/plugins/processing/algs/gdal/rasterize.py
index d2f2505f1d0..7779ad6e12d 100644
--- a/python/plugins/processing/algs/gdal/rasterize.py
+++ b/python/plugins/processing/algs/gdal/rasterize.py
@@ -30,13 +30,12 @@ import os
from qgis.PyQt.QtGui import QIcon
-from processing.core.parameters import ParameterVector
-from processing.core.parameters import ParameterExtent
-from processing.core.parameters import ParameterTableField
-from processing.core.parameters import ParameterSelection
-from processing.core.parameters import ParameterNumber
-from processing.core.parameters import ParameterBoolean
-from processing.core.parameters import ParameterString
+from processing.core.parameters import (ParameterVector,
+ ParameterExtent,
+ ParameterTableField,
+ ParameterSelection,
+ ParameterNumber,
+ ParameterString)
from processing.core.outputs import OutputRaster
from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
@@ -54,31 +53,25 @@ class rasterize(GdalAlgorithm):
DIMENSIONS = 'DIMENSIONS'
WIDTH = 'WIDTH'
HEIGHT = 'HEIGHT'
- EXTRA = 'EXTRA'
- RTYPE = 'RTYPE'
- OUTPUT = 'OUTPUT'
- TYPE = ['Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64']
NO_DATA = 'NO_DATA'
- TILED = 'TILED'
- COMPRESS = 'COMPRESS'
- JPEGCOMPRESSION = 'JPEGCOMPRESSION'
- PREDICTOR = 'PREDICTOR'
- ZLEVEL = 'ZLEVEL'
- BIGTIFF = 'BIGTIFF'
- BIGTIFFTYPE = ['', 'YES', 'NO', 'IF_NEEDED', 'IF_SAFER']
- COMPRESSTYPE = ['NONE', 'JPEG', 'LZW', 'PACKBITS', 'DEFLATE']
- TFW = 'TFW'
+ RTYPE = 'RTYPE'
+ OPTIONS = 'OPTIONS'
+ OUTPUT = 'OUTPUT'
+
+ TYPE = ['Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64']
+
RAST_EXT = 'RAST_EXT'
def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'rasterize.png'))
def commandLineName(self):
- return "gdalogr:rasterize"
+ return "gdal:rasterize"
def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Rasterize (vector to raster)')
self.group, self.i18n_group = self.trAlgorithm('[GDAL] Conversion')
+
self.addParameter(ParameterVector(self.INPUT, self.tr('Input layer')))
self.addParameter(ParameterTableField(self.FIELD,
self.tr('Attribute field'), self.INPUT))
@@ -90,58 +83,32 @@ class rasterize(GdalAlgorithm):
self.addParameter(ParameterNumber(self.HEIGHT,
self.tr('Vertical'), 0.0, 99999999.999999, 100.0))
self.addParameter(ParameterExtent(self.RAST_EXT, self.tr('Raster extent')))
+ self.addParameter(ParameterString(self.NO_DATA,
+ self.tr("Nodata value"),
+ '', optional=True))
- params = []
- params.append(ParameterSelection(self.RTYPE, self.tr('Raster type'),
- self.TYPE, 5))
- params.append(ParameterString(self.NO_DATA,
- self.tr("Nodata value"),
- '', optional=True))
- params.append(ParameterSelection(self.COMPRESS,
- self.tr('GeoTIFF options. Compression type:'), self.COMPRESSTYPE, 4))
- params.append(ParameterNumber(self.JPEGCOMPRESSION,
- self.tr('Set the JPEG compression level'),
- 1, 100, 75))
- params.append(ParameterNumber(self.ZLEVEL,
- self.tr('Set the DEFLATE compression level'),
- 1, 9, 6))
- params.append(ParameterNumber(self.PREDICTOR,
- self.tr('Set the predictor for LZW or DEFLATE compression'),
- 1, 3, 1))
- params.append(ParameterBoolean(self.TILED,
- self.tr('Create tiled output (only used for the GTiff format)'), False))
- params.append(ParameterSelection(self.BIGTIFF,
- self.tr('Control whether the created file is a BigTIFF or a classic TIFF'), self.BIGTIFFTYPE, 0))
- self.addParameter(ParameterBoolean(self.TFW,
- self.tr('Force the generation of an associated ESRI world file (.tfw)'), False))
- params.append(ParameterString(self.EXTRA,
- self.tr('Additional creation parameters'), '', optional=True))
-
- for param in params:
- param.isAdvanced = True
- self.addParameter(param)
+ self.addParameter(ParameterString(self.OPTIONS,
+ self.tr('Additional creation options'),
+ optional=True,
+ metadata={'widget_wrapper': 'processing.algs.gdal.ui.RasterOptionsWidget.RasterOptionsWidgetWrapper'}))
+ self.addParameter(ParameterSelection(self.RTYPE,
+ self.tr('Raster type'),
+ self.TYPE, 5))
self.addOutput(OutputRaster(self.OUTPUT,
self.tr('Rasterized')))
def getConsoleCommands(self):
inLayer = self.getParameterValue(self.INPUT)
- ogrLayer = ogrConnectionString(inLayer)[1:-1]
noData = self.getParameterValue(self.NO_DATA)
+ rastext = str(self.getParameterValue(self.RAST_EXT))
+ opts = self.getParameterValue(self.OPTIONS)
+ out = self.getOutputValue(self.OUTPUT)
+
+ ogrLayer = ogrConnectionString(inLayer)[1:-1]
+
if noData is not None:
noData = str(noData)
- jpegcompression = str(self.getParameterValue(self.JPEGCOMPRESSION))
- predictor = str(self.getParameterValue(self.PREDICTOR))
- zlevel = str(self.getParameterValue(self.ZLEVEL))
- tiled = str(self.getParameterValue(self.TILED))
- compress = self.COMPRESSTYPE[self.getParameterValue(self.COMPRESS)]
- bigtiff = self.BIGTIFFTYPE[self.getParameterValue(self.BIGTIFF)]
- tfw = str(self.getParameterValue(self.TFW))
- out = self.getOutputValue(self.OUTPUT)
- extra = self.getParameterValue(self.EXTRA)
- if extra is not None:
- extra = str(extra)
- rastext = str(self.getParameterValue(self.RAST_EXT))
arguments = []
arguments.append('-a')
@@ -181,26 +148,15 @@ class rasterize(GdalAlgorithm):
arguments.append('-a_nodata')
arguments.append(noData)
- if (GdalUtils.getFormatShortNameFromFilename(out) == "GTiff"):
- arguments.append("-co COMPRESS=" + compress)
- if compress == 'JPEG':
- arguments.append("-co JPEG_QUALITY=" + jpegcompression)
- elif (compress == 'LZW') or (compress == 'DEFLATE'):
- arguments.append("-co PREDICTOR=" + predictor)
- if compress == 'DEFLATE':
- arguments.append("-co ZLEVEL=" + zlevel)
- if tiled == "True":
- arguments.append("-co TILED=YES")
- if tfw == "True":
- arguments.append("-co TFW=YES")
- if len(bigtiff) > 0:
- arguments.append("-co BIGTIFF=" + bigtiff)
- if extra and len(extra) > 0:
- arguments.append(extra)
+ if opts:
+ arguments.append('-co')
+ arguments.append(opts)
+
arguments.append('-l')
+ print(ogrLayerName(inLayer))
arguments.append(ogrLayerName(inLayer))
arguments.append(ogrLayer)
- arguments.append(str(self.getOutputValue(self.OUTPUT)))
+ arguments.append(out)
return ['gdal_rasterize', GdalUtils.escapeAndJoin(arguments)]
diff --git a/python/plugins/processing/algs/gdal/rasterize_over.py b/python/plugins/processing/algs/gdal/rasterize_over.py
index e7bc4b686db..50ed8bc9428 100644
--- a/python/plugins/processing/algs/gdal/rasterize_over.py
+++ b/python/plugins/processing/algs/gdal/rasterize_over.py
@@ -52,7 +52,7 @@ class rasterize_over(GdalAlgorithm):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'rasterize.png'))
def commandLineName(self):
- return "gdalogr:rasterize_over"
+ return "gdal:rasterize_over"
def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Rasterize (write over existing raster)')
@@ -64,9 +64,10 @@ class rasterize_over(GdalAlgorithm):
self.tr('Existing raster layer'), False))
def getConsoleCommands(self):
- inLayer = self.getParameterValue(self.INPUT)
+ inLayer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))
+ inRasterLayer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT_RASTER))
+
ogrLayer = ogrConnectionString(inLayer)[1:-1]
- inRasterLayer = self.getParameterValue(self.INPUT_RASTER)
ogrRasterLayer = ogrConnectionString(inRasterLayer)[1:-1]
arguments = []
diff --git a/python/plugins/processing/algs/gdal/retile.py b/python/plugins/processing/algs/gdal/retile.py
index 25b157fb34d..b111af0a4c2 100644
--- a/python/plugins/processing/algs/gdal/retile.py
+++ b/python/plugins/processing/algs/gdal/retile.py
@@ -61,7 +61,7 @@ class retile(GdalAlgorithm):
ALGO = ['near', 'bilinear', 'cubic', 'cubicspline', 'lanczos']
def commandLineName(self):
- return "gdalogr:retile"
+ return "gdal:retile"
def commandName(self):
return "gdal_retile"
diff --git a/python/plugins/processing/algs/gdal/translate.py b/python/plugins/processing/algs/gdal/translate.py
index 6eca20be728..c5bf87a5f93 100644
--- a/python/plugins/processing/algs/gdal/translate.py
+++ b/python/plugins/processing/algs/gdal/translate.py
@@ -31,13 +31,13 @@ import os
from qgis.PyQt.QtGui import QIcon
from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
-from processing.core.parameters import ParameterString
-from processing.core.parameters import ParameterRaster
-from processing.core.parameters import ParameterNumber
-from processing.core.parameters import ParameterBoolean
-from processing.core.parameters import ParameterSelection
-from processing.core.parameters import ParameterExtent
-from processing.core.parameters import ParameterCrs
+from processing.core.parameters import (ParameterRaster,
+ ParameterString,
+ ParameterNumber,
+ ParameterBoolean,
+ ParameterSelection,
+ ParameterExtent,
+ ParameterCrs)
from processing.core.outputs import OutputRaster
from processing.algs.gdal.GdalUtils import GdalUtils
@@ -56,29 +56,21 @@ class translate(GdalAlgorithm):
PROJWIN = 'PROJWIN'
SRS = 'SRS'
SDS = 'SDS'
- EXTRA = 'EXTRA'
RTYPE = 'RTYPE'
+ OPTIONS = 'OPTIONS'
TYPE = ['Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64']
- TILED = 'TILED'
- COMPRESS = 'COMPRESS'
- JPEGCOMPRESSION = 'JPEGCOMPRESSION'
- PREDICTOR = 'PREDICTOR'
- ZLEVEL = 'ZLEVEL'
- BIGTIFF = 'BIGTIFF'
- BIGTIFFTYPE = ['', 'YES', 'NO', 'IF_NEEDED', 'IF_SAFER']
- COMPRESSTYPE = ['NONE', 'JPEG', 'LZW', 'PACKBITS', 'DEFLATE']
- TFW = 'TFW'
def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'translate.png'))
def commandLineName(self):
- return "gdalogr:translate"
+ return "gdal:translate"
def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Translate (convert format)')
self.group, self.i18n_group = self.trAlgorithm('[GDAL] Conversion')
- self.addParameter(ParameterRaster(self.INPUT, self.tr('Input layer'), False))
+
+ self.addParameter(ParameterRaster(self.INPUT, self.tr('Input layer')))
self.addParameter(ParameterNumber(self.OUTSIZE,
self.tr('Set the size of the output file (In pixels or %)'),
1, None, 100))
@@ -97,32 +89,13 @@ class translate(GdalAlgorithm):
self.tr('Copy all subdatasets of this file to individual output files'),
False))
- params = []
- params.append(ParameterSelection(self.RTYPE,
- self.tr('Output raster type'), self.TYPE, 5))
- params.append(ParameterSelection(self.COMPRESS,
- self.tr('GeoTIFF options. Compression type:'), self.COMPRESSTYPE, 4))
- params.append(ParameterNumber(self.JPEGCOMPRESSION,
- self.tr('Set the JPEG compression level'),
- 1, 100, 75))
- params.append(ParameterNumber(self.ZLEVEL,
- self.tr('Set the DEFLATE compression level'),
- 1, 9, 6))
- params.append(ParameterNumber(self.PREDICTOR,
- self.tr('Set the predictor for LZW or DEFLATE compression'),
- 1, 3, 1))
- params.append(ParameterBoolean(self.TILED,
- self.tr('Create tiled output (only used for the GTiff format)'), False))
- params.append(ParameterSelection(self.BIGTIFF,
- self.tr('Control whether the created file is a BigTIFF or a classic TIFF'), self.BIGTIFFTYPE, 0))
- params.append(ParameterBoolean(self.TFW,
- self.tr('Force the generation of an associated ESRI world file (.tfw))'), False))
- params.append(ParameterString(self.EXTRA,
- self.tr('Additional creation parameters'), '', optional=True))
-
- for param in params:
- param.isAdvanced = True
- self.addParameter(param)
+ self.addParameter(ParameterString(self.OPTIONS,
+ self.tr('Additional creation options'),
+ optional=True,
+ metadata={'widget_wrapper': 'processing.algs.gdal.ui.RasterOptionsWidget.RasterOptionsWidgetWrapper'}))
+ self.addParameter(ParameterSelection(self.RTYPE,
+ self.tr('Output raster type'),
+ self.TYPE, 5))
self.addOutput(OutputRaster(self.OUTPUT, self.tr('Converted')))
@@ -131,23 +104,15 @@ class translate(GdalAlgorithm):
outsize = str(self.getParameterValue(self.OUTSIZE))
outsizePerc = str(self.getParameterValue(self.OUTSIZE_PERC))
noData = self.getParameterValue(self.NO_DATA)
- if noData is not None:
- noData = str(noData)
expand = str(self.getParameterFromName(
self.EXPAND).options[self.getParameterValue(self.EXPAND)])
projwin = str(self.getParameterValue(self.PROJWIN))
crsId = self.getParameterValue(self.SRS)
sds = self.getParameterValue(self.SDS)
- extra = self.getParameterValue(self.EXTRA)
- if extra is not None:
- extra = str(extra)
- jpegcompression = str(self.getParameterValue(self.JPEGCOMPRESSION))
- predictor = str(self.getParameterValue(self.PREDICTOR))
- zlevel = str(self.getParameterValue(self.ZLEVEL))
- tiled = str(self.getParameterValue(self.TILED))
- compress = self.COMPRESSTYPE[self.getParameterValue(self.COMPRESS)]
- bigtiff = self.BIGTIFFTYPE[self.getParameterValue(self.BIGTIFF)]
- tfw = str(self.getParameterValue(self.TFW))
+ opts = self.getParameterValue(self.OPTIONS)
+
+ if noData is not None:
+ noData = str(noData)
arguments = []
arguments.append('-of')
@@ -185,22 +150,10 @@ class translate(GdalAlgorithm):
arguments.append(str(crsId))
if sds:
arguments.append('-sds')
- if extra and len(extra) > 0:
- arguments.append(extra)
- if GdalUtils.getFormatShortNameFromFilename(out) == "GTiff":
- arguments.append("-co COMPRESS=" + compress)
- if compress == 'JPEG':
- arguments.append("-co JPEG_QUALITY=" + jpegcompression)
- elif (compress == 'LZW') or (compress == 'DEFLATE'):
- arguments.append("-co PREDICTOR=" + predictor)
- if compress == 'DEFLATE':
- arguments.append("-co ZLEVEL=" + zlevel)
- if tiled == "True":
- arguments.append("-co TILED=YES")
- if tfw == "True":
- arguments.append("-co TFW=YES")
- if len(bigtiff) > 0:
- arguments.append("-co BIGTIFF=" + bigtiff)
+
+ if opts:
+ arguments.append('-co')
+ arguments.append(opts)
arguments.append(self.getParameterValue(self.INPUT))
arguments.append(out)
diff --git a/python/plugins/processing/algs/gdal/ui/CMakeLists.txt b/python/plugins/processing/algs/gdal/ui/CMakeLists.txt
new file mode 100644
index 00000000000..0d137a1f926
--- /dev/null
+++ b/python/plugins/processing/algs/gdal/ui/CMakeLists.txt
@@ -0,0 +1,4 @@
+FILE(GLOB PY_FILES *.py)
+FILE(GLOB UI_FILES *.ui)
+
+PLUGIN_INSTALL(processing ./algs/gdal/ui ${PY_FILES} ${UI_FILES})
diff --git a/python/plugins/processing/algs/gdal/ui/RasterOptionsWidget.py b/python/plugins/processing/algs/gdal/ui/RasterOptionsWidget.py
new file mode 100644
index 00000000000..1648f023b5f
--- /dev/null
+++ b/python/plugins/processing/algs/gdal/ui/RasterOptionsWidget.py
@@ -0,0 +1,72 @@
+# -*- coding: utf-8 -*-
+
+"""
+***************************************************************************
+ RasterOptionsWidget.py
+ ---------------------
+ Date : December 2016
+ Copyright : (C) 2016 by Alexander Bruy
+ Email : alexander dot bruy 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__ = 'Alexander Bruy'
+__date__ = 'December 2016'
+__copyright__ = '(C) 2016, Alexander Bruy'
+
+# This will get replaced with a git SHA1 when you do a git archive
+
+__revision__ = '$Format:%H$'
+
+from qgis.PyQt.QtWidgets import QLineEdit, QComboBox
+from qgis.gui import QgsRasterFormatSaveOptionsWidget
+
+from processing.core.parameters import ParameterString
+from processing.core.outputs import OutputString
+from processing.gui.wrappers import WidgetWrapper, DIALOG_MODELER, DIALOG_BATCH
+
+
+class RasterOptionsWidgetWrapper(WidgetWrapper):
+
+ def createWidget(self):
+ if self.dialogType == DIALOG_MODELER:
+ widget = QComboBox()
+ widget.setEditable(True)
+ strings = self.dialog.getAvailableValuesOfType(ParameterString, OutputString)
+ options = [(self.dialog.resolveValueDescription(s), s) for s in strings]
+ for desc, val in options:
+ widget.addItem(desc, val)
+ widget.setEditText(self.param.default or '')
+ return widget
+ elif self.dialogType == DIALOG_BATCH:
+ widget = QLineEdit()
+ if self.param.default:
+ widget.setText(self.param.default)
+ else:
+ return QgsRasterFormatSaveOptionsWidget()
+
+ def setValue(self, value):
+ if value is None:
+ value = ''
+
+ if self.dialogType == DIALOG_MODELER:
+ self.setComboValue(value)
+ elif self.dialogType == DIALOG_BATCH:
+ self.widget.setText(value)
+ else:
+ self.widget.setValue(value)
+
+ def value(self):
+ if self.dialogType == DIALOG_MODELER:
+ return self.comboValue()
+ elif self.dialogType == DIALOG_BATCH:
+ return self.widget.text()
+ else:
+ return ' '.join(self.widget.options())
diff --git a/python/plugins/GdalTools/tools/__init__.py b/python/plugins/processing/algs/gdal/ui/__init__.py
similarity index 100%
rename from python/plugins/GdalTools/tools/__init__.py
rename to python/plugins/processing/algs/gdal/ui/__init__.py
diff --git a/python/plugins/processing/algs/gdal/warp.py b/python/plugins/processing/algs/gdal/warp.py
index f38b39fbeb5..23e531393dd 100644
--- a/python/plugins/processing/algs/gdal/warp.py
+++ b/python/plugins/processing/algs/gdal/warp.py
@@ -31,13 +31,13 @@ import os
from qgis.PyQt.QtGui import QIcon
from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
-from processing.core.parameters import ParameterRaster
-from processing.core.parameters import ParameterExtent
-from processing.core.parameters import ParameterSelection
-from processing.core.parameters import ParameterCrs
-from processing.core.parameters import ParameterNumber
-from processing.core.parameters import ParameterString
-from processing.core.parameters import ParameterBoolean
+from processing.core.parameters import (ParameterRaster,
+ ParameterExtent,
+ ParameterSelection,
+ ParameterCrs,
+ ParameterNumber,
+ ParameterString,
+ ParameterBoolean)
from processing.core.outputs import OutputRaster
from processing.algs.gdal.GdalUtils import GdalUtils
@@ -51,23 +51,15 @@ class warp(GdalAlgorithm):
SOURCE_SRS = 'SOURCE_SRS'
DEST_SRS = 'DEST_SRS'
METHOD = 'METHOD'
- METHOD_OPTIONS = ['near', 'bilinear', 'cubic', 'cubicspline', 'lanczos']
TR = 'TR'
NO_DATA = 'NO_DATA'
- EXTRA = 'EXTRA'
- RTYPE = 'RTYPE'
- TYPE = ['Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64']
- TILED = 'TILED'
- COMPRESS = 'COMPRESS'
- JPEGCOMPRESSION = 'JPEGCOMPRESSION'
- PREDICTOR = 'PREDICTOR'
- ZLEVEL = 'ZLEVEL'
- BIGTIFF = 'BIGTIFF'
- BIGTIFFTYPE = ['', 'YES', 'NO', 'IF_NEEDED', 'IF_SAFER']
- COMPRESSTYPE = ['NONE', 'JPEG', 'LZW', 'PACKBITS', 'DEFLATE']
- TFW = 'TFW'
RAST_EXT = 'RAST_EXT'
EXT_CRS = 'EXT_CRS'
+ RTYPE = 'RTYPE'
+ OPTIONS = 'OPTIONS'
+
+ METHOD_OPTIONS = ['near', 'bilinear', 'cubic', 'cubicspline', 'lanczos']
+ TYPE = ['Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64']
def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'warp.png'))
@@ -75,12 +67,16 @@ class warp(GdalAlgorithm):
def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Warp (reproject)')
self.group, self.i18n_group = self.trAlgorithm('[GDAL] Projections')
+
self.tags = self.tr('transform,reproject,crs,srs')
self.addParameter(ParameterRaster(self.INPUT, self.tr('Input layer'), False))
self.addParameter(ParameterCrs(self.SOURCE_SRS,
- self.tr('Source SRS'), '', optional=True))
+ self.tr('Source SRS'),
+ '',
+ optional=True))
self.addParameter(ParameterCrs(self.DEST_SRS,
- self.tr('Destination SRS'), 'EPSG:4326'))
+ self.tr('Destination SRS'),
+ 'EPSG:4326'))
self.addParameter(ParameterString(self.NO_DATA,
self.tr("Nodata value, leave blank to take the nodata value from input"),
'', optional=True))
@@ -88,58 +84,37 @@ class warp(GdalAlgorithm):
self.tr('Output file resolution in target georeferenced units (leave 0 for no change)'),
0.0, None, 0.0))
self.addParameter(ParameterSelection(self.METHOD,
- self.tr('Resampling method'), self.METHOD_OPTIONS))
- self.addParameter(ParameterExtent(self.RAST_EXT, self.tr('Raster extent'), optional=True))
+ self.tr('Resampling method'),
+ self.METHOD_OPTIONS))
+ self.addParameter(ParameterExtent(self.RAST_EXT,
+ self.tr('Raster extent'),
+ optional=True))
if GdalUtils.version() >= 2000000:
self.addParameter(ParameterCrs(self.EXT_CRS,
self.tr('CRS of the raster extent, leave blank for using Destination SRS'),
optional=True))
- params = []
- params.append(ParameterSelection(self.RTYPE,
- self.tr('Output raster type'), self.TYPE, 5))
- params.append(ParameterSelection(self.COMPRESS,
- self.tr('GeoTIFF options. Compression type:'), self.COMPRESSTYPE, 4))
- params.append(ParameterNumber(self.JPEGCOMPRESSION,
- self.tr('Set the JPEG compression level'),
- 1, 100, 75))
- params.append(ParameterNumber(self.ZLEVEL,
- self.tr('Set the DEFLATE compression level'),
- 1, 9, 6))
- params.append(ParameterNumber(self.PREDICTOR,
- self.tr('Set the predictor for LZW or DEFLATE compression'),
- 1, 3, 1))
- params.append(ParameterBoolean(self.TILED,
- self.tr('Create tiled output (only used for the GTiff format)'), False))
- params.append(ParameterSelection(self.BIGTIFF,
- self.tr('Control whether the created file is a BigTIFF or a classic TIFF'), self.BIGTIFFTYPE, 0))
- params.append(ParameterBoolean(self.TFW,
- self.tr('Force the generation of an associated ESRI world file (.tfw))'), False))
- params.append(ParameterString(self.EXTRA,
- self.tr('Additional creation parameters'), '', optional=True))
-
- for param in params:
- param.isAdvanced = True
- self.addParameter(param)
+ self.addParameter(ParameterString(self.OPTIONS,
+ self.tr('Additional creation options'),
+ optional=True,
+ metadata={'widget_wrapper': 'processing.algs.gdal.ui.RasterOptionsWidget.RasterOptionsWidgetWrapper'}))
+ self.addParameter(ParameterSelection(self.RTYPE,
+ self.tr('Output raster type'),
+ self.TYPE, 5))
self.addOutput(OutputRaster(self.OUTPUT, self.tr('Reprojected')))
def getConsoleCommands(self):
- noData = self.getParameterValue(self.NO_DATA)
- if noData is not None:
- noData = str(noData)
srccrs = self.getParameterValue(self.SOURCE_SRS)
dstcrs = self.getParameterValue(self.DEST_SRS)
- jpegcompression = str(self.getParameterValue(self.JPEGCOMPRESSION))
- predictor = str(self.getParameterValue(self.PREDICTOR))
- zlevel = str(self.getParameterValue(self.ZLEVEL))
- tiled = str(self.getParameterValue(self.TILED))
- compress = self.COMPRESSTYPE[self.getParameterValue(self.COMPRESS)]
- bigtiff = self.BIGTIFFTYPE[self.getParameterValue(self.BIGTIFF)]
- tfw = str(self.getParameterValue(self.TFW))
rastext = self.getParameterValue(self.RAST_EXT)
rastext_crs = self.getParameterValue(self.EXT_CRS)
+ opts = self.getParameterValue(self.OPTIONS)
+ noData = self.getParameterValue(self.NO_DATA)
+
+ if noData is not None:
+ noData = str(noData)
arguments = []
arguments.append('-ot')
@@ -153,19 +128,20 @@ class warp(GdalAlgorithm):
if noData:
arguments.append('-dstnodata')
arguments.append(noData)
+
arguments.append('-r')
arguments.append(
self.METHOD_OPTIONS[self.getParameterValue(self.METHOD)])
+
arguments.append('-of')
out = self.getOutputValue(self.OUTPUT)
arguments.append(GdalUtils.getFormatShortNameFromFilename(out))
+
if self.getParameterValue(self.TR) != 0:
arguments.append('-tr')
arguments.append(str(self.getParameterValue(self.TR)))
arguments.append(str(self.getParameterValue(self.TR)))
- extra = self.getParameterValue(self.EXTRA)
- if extra is not None:
- extra = str(extra)
+
if rastext:
regionCoords = rastext.split(',')
if len(regionCoords) >= 4:
@@ -180,24 +156,9 @@ class warp(GdalAlgorithm):
arguments.append('-te_srs')
arguments.append(rastext_crs)
- if extra and len(extra) > 0:
- arguments.append(extra)
- if GdalUtils.getFormatShortNameFromFilename(out) == "GTiff":
- arguments.append("-co COMPRESS=" + compress)
- if compress == 'JPEG':
- arguments.append("-co JPEG_QUALITY=" + jpegcompression)
- elif (compress == 'LZW') or (compress == 'DEFLATE'):
- arguments.append("-co PREDICTOR=" + predictor)
- if compress == 'DEFLATE':
- arguments.append("-co ZLEVEL=" + zlevel)
- if tiled == "True":
- arguments.append("-co TILED=YES")
- if tfw == "True":
- arguments.append("-co TFW=YES")
- if len(bigtiff) > 0:
- arguments.append("-co BIGTIFF=" + bigtiff)
-
- arguments.append("-wo OPTIMIZE_SIZE=TRUE")
+ if opts:
+ arguments.append('-co')
+ arguments.append(opts)
if GdalUtils.version() in [2010000, 2010100]:
arguments.append("--config GDALWARP_IGNORE_BAD_CUTLINE YES")
diff --git a/python/plugins/processing/algs/grass7/Grass7Algorithm.py b/python/plugins/processing/algs/grass7/Grass7Algorithm.py
index 9def6636041..b0601d769e2 100644
--- a/python/plugins/processing/algs/grass7/Grass7Algorithm.py
+++ b/python/plugins/processing/algs/grass7/Grass7Algorithm.py
@@ -106,34 +106,14 @@ class Grass7Algorithm(GeoAlgorithm):
return self._icon
def help(self):
- localDoc = None
- html = self.grass7Name + '.html'
- if system.isWindows():
- # For MS-Windows, use the configured GRASS7 path
- localPath = os.path.join(Grass7Utils.grassPath(), 'docs/html', html)
- if os.path.exists(localPath):
- localDoc = os.path.abspath(localPath)
- elif system.isMac():
- # For MacOSX official package
- localPath = os.path.join('/Applications/GRASS-7.0.app/Contents/MacOS/docs/html', html)
- if os.path.exists(localPath):
- localDoc = os.path.abspath(localPath)
+ helpPath = Grass7Utils.grassHelpPath()
+ if helpPath == '':
+ return False, None
+
+ if os.path.exists(helpPath):
+ return False, QUrl.fromLocalFile(os.path.join(helpPath, '{}.html'.format(self.grass7Name))).toString()
else:
- # For GNU/Linux distributions
- searchPaths = ['/usr/share/doc/grass-doc/html', '/opt/grass/docs/html',
- '/usr/share/doc/grass/docs/html']
- for path in searchPaths:
- localPath = os.path.join(path, html)
- if os.path.exists(localPath):
- localDoc = os.path.abspath(localPath)
-
- # Found the local documentation
- if localDoc:
- localDoc = QUrl.fromLocalFile(localDoc).toString()
- return False, localDoc
-
- # Return the URL if local doc is not found
- return False, 'http://grass.osgeo.org/grass70/manuals/' + self.grass7Name + '.html'
+ return False, helpPath + '{}.html'.format(self.grass7Name)
def getParameterDescriptions(self):
descs = {}
diff --git a/python/plugins/processing/algs/grass7/Grass7AlgorithmProvider.py b/python/plugins/processing/algs/grass7/Grass7AlgorithmProvider.py
index c81537dc65b..c616343fba5 100644
--- a/python/plugins/processing/algs/grass7/Grass7AlgorithmProvider.py
+++ b/python/plugins/processing/algs/grass7/Grass7AlgorithmProvider.py
@@ -61,6 +61,11 @@ class Grass7AlgorithmProvider(AlgorithmProvider):
self.getDescription(),
Grass7Utils.GRASS_LOG_CONSOLE,
self.tr('Log console output'), False))
+ ProcessingConfig.addSetting(Setting(
+ self.getDescription(),
+ Grass7Utils.GRASS_HELP_PATH,
+ self.tr('Location of GRASS docs'),
+ Grass7Utils.grassHelpPath()))
def unload(self):
AlgorithmProvider.unload(self)
@@ -68,6 +73,7 @@ class Grass7AlgorithmProvider(AlgorithmProvider):
ProcessingConfig.removeSetting(Grass7Utils.GRASS_FOLDER)
ProcessingConfig.removeSetting(Grass7Utils.GRASS_LOG_COMMANDS)
ProcessingConfig.removeSetting(Grass7Utils.GRASS_LOG_CONSOLE)
+ ProcessingConfig.removeSetting(Grass7Utils.GRASS_HELP_PATH)
def createAlgsList(self):
self.preloadedAlgs = []
@@ -92,10 +98,11 @@ class Grass7AlgorithmProvider(AlgorithmProvider):
self.algs = self.preloadedAlgs
def getDescription(self):
- return self.tr('GRASS GIS 7 commands')
+ version = Grass7Utils.installedVersion()
+ return 'GRASS GIS ({})'.format(version) if version is not None else "GRASS GIS"
def getName(self):
- return 'grass70'
+ return 'grass7'
def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'grass.svg'))
diff --git a/python/plugins/processing/algs/grass7/Grass7Utils.py b/python/plugins/processing/algs/grass7/Grass7Utils.py
index b3eb2db5a40..fb9c66144e5 100644
--- a/python/plugins/processing/algs/grass7/Grass7Utils.py
+++ b/python/plugins/processing/algs/grass7/Grass7Utils.py
@@ -35,6 +35,7 @@ from qgis.core import QgsApplication
from qgis.PyQt.QtCore import QCoreApplication
from processing.core.ProcessingConfig import ProcessingConfig
from processing.core.ProcessingLog import ProcessingLog
+from processing.core.SilentProgress import SilentProgress
from processing.tools.system import userFolder, isWindows, isMac, tempFolder, mkdir
from processing.tests.TestData import points
@@ -49,6 +50,7 @@ class Grass7Utils(object):
GRASS_FOLDER = 'GRASS7_FOLDER'
GRASS_LOG_COMMANDS = 'GRASS7_LOG_COMMANDS'
GRASS_LOG_CONSOLE = 'GRASS7_LOG_CONSOLE'
+ GRASS_HELP_PATH = 'GRASS_HELP_PATH'
sessionRunning = False
sessionLayers = {}
@@ -56,6 +58,8 @@ class Grass7Utils(object):
isGrass7Installed = False
+ version = None
+
@staticmethod
def grassBatchJobFilename():
'''This is used in Linux. This is the batch job that we assign to
@@ -74,11 +78,39 @@ class Grass7Utils(object):
filename = os.path.join(userFolder(), filename)
return filename
+ #~ @staticmethod
+ #~ def installedVersion():
+ #~ out = Grass7Utils.executeGrass7("grass -v")
+ #~ # FIXME: I do not know if this should be removed or let the user enter it
+ #~ # or something like that... This is just a temporary thing
+ #~ return '7.0.0'
+
@staticmethod
- def getGrassVersion():
- # FIXME: I do not know if this should be removed or let the user enter it
- # or something like that... This is just a temporary thing
- return '7.0.0'
+ def installedVersion(run=False):
+ if Grass7Utils.isGrass7Installed and not run:
+ return Grass7Utils.version
+
+ if Grass7Utils.grassPath() is None:
+ return None
+ commands = ["grass70 -v"]
+ with subprocess.Popen(
+ commands,
+ shell=True,
+ stdout=subprocess.PIPE,
+ stdin=subprocess.DEVNULL,
+ stderr=subprocess.STDOUT,
+ universal_newlines=True,
+ ) as proc:
+ try:
+ lines = proc.stdout.readlines()
+ for line in lines:
+ if "GRASS GIS " in line:
+ Grass7Utils.version = line.split(" ")[-1].strip()
+ break
+ except:
+ pass
+
+ return Grass7Utils.version
@staticmethod
def grassPath():
@@ -140,7 +172,7 @@ class Grass7Utils(object):
output.write('if "%GRASS_ADDON_PATH%"=="" set PATH=%WINGISBASE%\\bin;%WINGISBASE%\\lib;%PATH%\n')
output.write('if not "%GRASS_ADDON_PATH%"=="" set PATH=%WINGISBASE%\\bin;%WINGISBASE%\\lib;%GRASS_ADDON_PATH%;%PATH%\n')
output.write('\n')
- output.write('set GRASS_VERSION=' + Grass7Utils.getGrassVersion() + '\n')
+ output.write('set GRASS_VERSION=' + Grass7Utils.installedVersion() + '\n')
output.write('if not "%LANG%"=="" goto langset\n')
output.write('FOR /F "usebackq delims==" %%i IN (`"%WINGISBASE%\\etc\\winlocale"`) DO @set LANG=%%i\n')
output.write(':langset\n')
@@ -395,3 +427,27 @@ class Grass7Utils(object):
except TypeError:
# Python 3
output.write(command + '\n')
+
+ @staticmethod
+ def grassHelpPath():
+ helpPath = ProcessingConfig.getSetting(Grass7Utils.GRASS_HELP_PATH)
+
+ if helpPath is None:
+ if isWindows():
+ localPath = os.path.join(Grass7Utils.grassPath(), 'docs/html')
+ if os.path.exists(localPath):
+ helpPath = os.path.abspath(localPath)
+ elif isMac():
+ localPath = '/Applications/GRASS-7.0.app/Contents/MacOS/docs/html'
+ if os.path.exists(localPath):
+ helpPath = os.path.abspath(localPath)
+ else:
+ searchPaths = ['/usr/share/doc/grass-doc/html',
+ '/opt/grass/docs/html',
+ '/usr/share/doc/grass/docs/html']
+ for path in searchPaths:
+ if os.path.exists(path):
+ helpPath = os.path.abspath(path)
+ break
+
+ return helpPath if helpPath is not None else 'http://grass.osgeo.org/grass70/manuals/'
diff --git a/python/plugins/processing/algs/help/qgis.yaml b/python/plugins/processing/algs/help/qgis.yaml
index 37d89d4aec0..188f45bc7e9 100644
--- a/python/plugins/processing/algs/help/qgis.yaml
+++ b/python/plugins/processing/algs/help/qgis.yaml
@@ -93,7 +93,7 @@ qgis:createattributeindex: >
Creates an index to speed up queries made against a field in a table. Support for index creation is dependent on the layer's data provider and the field type.
qgis:createconstantrasterlayer: >
- Given an input raster layer an a value, this algorithm generates a new layer with the same extent and cellsize as the input one, and all cells with the specified value.
+ Given an input raster layer an a value, this algorithm generates a new layer with the same extent and cell size as the input one, and all cells with the specified value.
qgis:creategridlines:
This algorithm creates a line vector layer with a grid covering a given extent.
@@ -114,6 +114,9 @@ qgis:createpointsalonglines: >
Start and end points can be defined, so the first and last point do not fall on the line first and last node. Start and end points are defined as distances, mesaureed from the first and last nodes of the lines, in the units of the projection used by the lines layer.
+qgis:createspatialindex: >
+ Creates an index to speed up access to the features in a layer based on their spatial location. Support for spatial index creation is dependent on the layer's data provider.
+
qgis:delaunaytriangulation: >
This algorithm creates a polygon layer with the delaunay triangulation corresponding to a points layer.
@@ -190,9 +193,9 @@ qgis:extractnodes: >
qgis:extractspecificnodes: >
This algorithm takes a line or polygon layer and generates a point layer with points representing specific nodes in the input lines or polygons. For instance, this algorithm can be used to extract the first or last nodes in the geometry. The attributes associated to each point are the same ones associated to the line or polygon that the point belongs to.
- The node indices parameter accepts a comma separated string specifying the indices of the nodes to extract. The first node corresponds to an index of 0, the second node has an index of 1, etc. Negative indices can be used to find nodes at the end of the geometry, eg an index of -1 corresponds to the last node, -2 corresponds to the second last node, etc.
+ The node indices parameter accepts a comma separated string specifying the indices of the nodes to extract. The first node corresponds to an index of 0, the second node has an index of 1, etc. Negative indices can be used to find nodes at the end of the geometry, e.g., an index of -1 corresponds to the last node, -2 corresponds to the second last node, etc.
- Additional fields are added to the nodes indicating the specific node position (eg 0, -1, etc), the original node index, distance along the original geometry and bisector angle of node for the original geometry.
+ Additional fields are added to the nodes indicating the specific node position (e.g., 0, -1, etc), the original node index, distance along the original geometry and bisector angle of node for the original geometry.
qgis:fieldcalculator: >
This algorithm computes a new vector layer with the same features of the input layer, but with an additional attribute. The values of this new attribute are computed from each feature using a mathematical formula, based on te properties and attributes of the feature.
@@ -501,7 +504,7 @@ qgis:smoothgeometry: >
The offset parameter controls how "tightly" the smoothed geometries follow the original geometries. Smaller values results in a tighter fit, and larger values will create a looser fit.
- The maximum angle parameter can be used to prevent smoothing of nodes with large angles. Any node where the angle of the segments to either side is larger then this will not be smoothed. Eg setting the maximum angle to 90 degrees or lower would preserve right angles in the geometry.
+ The maximum angle parameter can be used to prevent smoothing of nodes with large angles. Any node where the angle of the segments to either side is larger then this will not be smoothed. For example, setting the maximum angle to 90 degrees or lower would preserve right angles in the geometry.
qgis:snapgeometriestolayer: >
This algorithm snaps the geometries in a layer to the geometries in another layer. A tolerance is specified in layer units to control how close vertices need to be to the reference layer geometries before they are snapped. Snapping occurs to both vertices and edges, but snapping to a vertex is preferred. Vertices will be inserted or removed as required to make the geometries match the reference geometries.
@@ -537,6 +540,11 @@ qgis:texttofloat: >
qgis:translate: >
This algorithm moves the geometries within a layer, by offsetting them with a specified x and y displacement.
+qgis:truncatetable: >
+ This algorithm truncates a layer, by deleting all features from within the layer.
+
+ Warning - this algorithm modifies the layer in place, and deleted features cannot be restored!
+
qgis:union: >
This algorithm creates a layer containing all the features from both input layers. In the case of polygon layers, separate features are created for overlapping and non-overlapping features. The attribute table of the union layer contains attribute values from the respective input layer for non-overlapping features, and attribute values from both input layers for overlapping features.
@@ -568,9 +576,9 @@ qgis:rastercalculator: >
- sin(), cos(), tan(), atan2(), ln(), log10()
- The extent and cellsize can be defined by the user. If the extent is not specified, the minimum extent that covers the input layers will be used. If the cellsize is not specified, the minimum cellsize of all input layers will be used.
+ The extent and cellsize can be defined by the user. If the extent is not specified, the minimum extent that covers the input layers will be used. If the cell size is not specified, the minimum cell size of all input layers will be used.
- The cellsize is assumed to be the same in both X and Y axes.
+ The cell size is assumed to be the same in both X and Y axes.
Layers are refered by their name as displayed in the layer list and the number of the band to use (based on 1), using the pattern 'layer_name@band number'. For instance, the first band from a layer named DEM will be referred as DEM@1.
diff --git a/python/plugins/processing/algs/help/saga.yaml b/python/plugins/processing/algs/help/saga.yaml
index 8068ccbb149..182c7893ffa 100644
--- a/python/plugins/processing/algs/help/saga.yaml
+++ b/python/plugins/processing/algs/help/saga.yaml
@@ -3,7 +3,7 @@ saga:rastercalculator: >
It requires a base layer, and a set of additional layers. The base layer is identified as "a" in the formula, while the additional layers are identified as "b, c, d...", using the order in which they appear in the multiple selection dialog.
- The resulting layer has the extent and cellsize of the main layer.
+ The resulting layer has the extent and cell size of the main layer.
The following operators and functions are available.
diff --git a/python/plugins/processing/algs/lidar/fusion/CanopyModel.py b/python/plugins/processing/algs/lidar/fusion/CanopyModel.py
index 7b7982158e8..5d21ceef4fa 100644
--- a/python/plugins/processing/algs/lidar/fusion/CanopyModel.py
+++ b/python/plugins/processing/algs/lidar/fusion/CanopyModel.py
@@ -62,7 +62,7 @@ class CanopyModel(FusionAlgorithm):
self.addParameter(ParameterFile(
self.INPUT, self.tr('Input LAS layer')))
self.addParameter(ParameterNumber(
- self.CELLSIZE, self.tr('Cellsize'), 0, None, 10.0))
+ self.CELLSIZE, self.tr('Cell Size'), 0, None, 10.0))
self.addParameter(ParameterSelection(
self.XYUNITS, self.tr('XY Units'), self.UNITS))
self.addParameter(ParameterSelection(
diff --git a/python/plugins/processing/algs/lidar/fusion/Cover.py b/python/plugins/processing/algs/lidar/fusion/Cover.py
index 11113e1e02c..c0c5ca0d2be 100644
--- a/python/plugins/processing/algs/lidar/fusion/Cover.py
+++ b/python/plugins/processing/algs/lidar/fusion/Cover.py
@@ -57,7 +57,7 @@ class Cover(FusionAlgorithm):
self.addParameter(ParameterFile(
self.GROUND, self.tr('Input ground DTM layer')))
self.addParameter(ParameterNumber(
- self.CELLSIZE, self.tr('Cellsize'), 0, None, 10.0))
+ self.CELLSIZE, self.tr('Cell Size'), 0, None, 10.0))
self.addParameter(ParameterNumber(
self.HEIGHTBREAK, self.tr('Heightbreak'), 0, None, 10.0))
self.addParameter(ParameterSelection(
diff --git a/python/plugins/processing/algs/lidar/fusion/GridMetrics.py b/python/plugins/processing/algs/lidar/fusion/GridMetrics.py
index adc69e7b389..3917e21a50b 100644
--- a/python/plugins/processing/algs/lidar/fusion/GridMetrics.py
+++ b/python/plugins/processing/algs/lidar/fusion/GridMetrics.py
@@ -65,7 +65,7 @@ class GridMetrics(FusionAlgorithm):
self.addParameter(ParameterNumber(
self.HEIGHT, self.tr('Height break')))
self.addParameter(ParameterNumber(
- self.CELLSIZE, self.tr('Cellsize')))
+ self.CELLSIZE, self.tr('Cell Size')))
self.addOutput(OutputFile(
self.OUTPUT_CSV_ELEVATION, self.tr('Output table with grid metrics')))
diff --git a/python/plugins/processing/algs/lidar/fusion/GridSurfaceCreate.py b/python/plugins/processing/algs/lidar/fusion/GridSurfaceCreate.py
index 509346efc03..d93da5ab915 100644
--- a/python/plugins/processing/algs/lidar/fusion/GridSurfaceCreate.py
+++ b/python/plugins/processing/algs/lidar/fusion/GridSurfaceCreate.py
@@ -63,7 +63,7 @@ class GridSurfaceCreate(FusionAlgorithm):
self.addParameter(ParameterFile(
self.INPUT, self.tr('Input LAS layer')))
self.addParameter(ParameterNumber(
- self.CELLSIZE, self.tr('Cellsize'), 0, None, 10.0))
+ self.CELLSIZE, self.tr('Cell Size'), 0, None, 10.0))
self.addParameter(ParameterSelection(
self.XYUNITS, self.tr('XY Units'), self.UNITS))
self.addParameter(ParameterSelection(
diff --git a/python/plugins/processing/algs/lidar/fusion/GroundFilter.py b/python/plugins/processing/algs/lidar/fusion/GroundFilter.py
index f89e8c17ad8..29d3643de63 100644
--- a/python/plugins/processing/algs/lidar/fusion/GroundFilter.py
+++ b/python/plugins/processing/algs/lidar/fusion/GroundFilter.py
@@ -50,7 +50,7 @@ class GroundFilter(FusionAlgorithm):
self.addParameter(ParameterFile(
self.INPUT, self.tr('Input LAS layer')))
self.addParameter(ParameterNumber(self.CELLSIZE,
- self.tr('Cellsize for intermediate surfaces'), 0, None, 10))
+ self.tr('Cell size for intermediate surfaces'), 0, None, 10))
self.addOutput(OutputFile(
self.OUTPUT, self.tr('Output ground LAS file')))
self.addParameter(ParameterBoolean(
diff --git a/python/plugins/processing/algs/lidar/fusion/TinSurfaceCreate.py b/python/plugins/processing/algs/lidar/fusion/TinSurfaceCreate.py
index 1732496f42b..68ba8df055d 100644
--- a/python/plugins/processing/algs/lidar/fusion/TinSurfaceCreate.py
+++ b/python/plugins/processing/algs/lidar/fusion/TinSurfaceCreate.py
@@ -54,7 +54,7 @@ class TinSurfaceCreate(FusionAlgorithm):
self.addParameter(ParameterFile(
self.INPUT, self.tr('Input LAS layer')))
self.addParameter(ParameterNumber(self.CELLSIZE,
- self.tr('Cellsize'), 0, None, 10.0))
+ self.tr('Cell Size'), 0, None, 10.0))
self.addParameter(ParameterSelection(self.XYUNITS,
self.tr('XY Units'), self.UNITS))
self.addParameter(ParameterSelection(self.ZUNITS,
diff --git a/python/plugins/processing/algs/otb/OTBAlgorithmProvider.py b/python/plugins/processing/algs/otb/OTBAlgorithmProvider.py
index 5b33250fbbd..68e9073b783 100644
--- a/python/plugins/processing/algs/otb/OTBAlgorithmProvider.py
+++ b/python/plugins/processing/algs/otb/OTBAlgorithmProvider.py
@@ -48,7 +48,8 @@ class OTBAlgorithmProvider(AlgorithmProvider):
self.activate = True
def getDescription(self):
- return self.tr("Orfeo Toolbox (Image analysis)")
+ version = OTBUtils.getInstalledVersion()
+ return "Orfeo ToolBox ({})".format(version) if version is not None else "Orfeo ToolBox"
def getName(self):
return "otb"
diff --git a/python/plugins/processing/algs/qgis/Buffer.py b/python/plugins/processing/algs/qgis/Buffer.py
index fedc130555c..3efc696c181 100644
--- a/python/plugins/processing/algs/qgis/Buffer.py
+++ b/python/plugins/processing/algs/qgis/Buffer.py
@@ -45,7 +45,6 @@ def buffering(progress, writer, distance, field, useField, layer, dissolve,
# With dissolve
if dissolve:
- first = True
buffered_geometries = []
for inFeat in features:
attrs = inFeat.attributes()
@@ -55,12 +54,7 @@ def buffering(progress, writer, distance, field, useField, layer, dissolve,
value = distance
inGeom = inFeat.geometry()
- if not inGeom:
- ProcessingLog.addToLog(ProcessingLog.LOG_WARNING, 'Feature {} has empty geometry. Skipping...'.format(inFeat.id()))
- continue
- if not inGeom.isGeosValid():
- ProcessingLog.addToLog(ProcessingLog.LOG_WARNING, 'Feature {} has invalid geometry. Skipping...'.format(inFeat.id()))
- continue
+
buffered_geometries.append(inGeom.buffer(float(value), segments, endCapStyle, joinStyle, mitreLimit))
current += 1
@@ -80,14 +74,8 @@ def buffering(progress, writer, distance, field, useField, layer, dissolve,
value = distance
inGeom = inFeat.geometry()
outFeat = QgsFeature()
- if inGeom.isEmpty() or inGeom.isGeosEmpty():
- pass
- elif not inGeom.isGeosValid():
- ProcessingLog.addToLog(ProcessingLog.LOG_WARNING, 'Feature {} has invalid geometry. Skipping...'.format(inFeat.id()))
- continue
- else:
- outGeom = inGeom.buffer(float(value), segments, endCapStyle, joinStyle, mitreLimit)
- outFeat.setGeometry(outGeom)
+ outGeom = inGeom.buffer(float(value), segments, endCapStyle, joinStyle, mitreLimit)
+ outFeat.setGeometry(outGeom)
outFeat.setAttributes(attrs)
writer.addFeature(outFeat)
current += 1
diff --git a/python/plugins/processing/algs/qgis/Clip.py b/python/plugins/processing/algs/qgis/Clip.py
index 0c9d17ad80b..99be2a4954f 100644
--- a/python/plugins/processing/algs/qgis/Clip.py
+++ b/python/plugins/processing/algs/qgis/Clip.py
@@ -119,16 +119,7 @@ class Clip(GeoAlgorithm):
if new_geom.wkbType() == QgsWkbTypes.Unknown or QgsWkbTypes.flatType(new_geom.geometry().wkbType()) == QgsWkbTypes.GeometryCollection:
int_com = in_feat.geometry().combine(new_geom)
int_sym = in_feat.geometry().symDifference(new_geom)
- if not int_com or not int_sym:
- ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
- self.tr('GEOS geoprocessing error: One or more '
- 'input features have invalid geometry.'))
- else:
- new_geom = int_com.difference(int_sym)
- if new_geom.isGeosEmpty() or not new_geom.isGeosValid():
- ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
- self.tr('GEOS geoprocessing error: One or more '
- 'input features have invalid geometry.'))
+ new_geom = int_com.difference(int_sym)
else:
# clip geometry totally contains feature geometry, so no need to perform intersection
new_geom = in_feat.geometry()
diff --git a/python/plugins/processing/algs/qgis/CreateAttributeIndex.py b/python/plugins/processing/algs/qgis/CreateAttributeIndex.py
index 817820358e0..ead96c41595 100644
--- a/python/plugins/processing/algs/qgis/CreateAttributeIndex.py
+++ b/python/plugins/processing/algs/qgis/CreateAttributeIndex.py
@@ -28,7 +28,7 @@ __revision__ = '$Format:%H$'
from qgis.core import QgsVectorDataProvider, QgsFields
from processing.core.GeoAlgorithm import GeoAlgorithm
-from processing.core.parameters import ParameterVector
+from processing.core.parameters import ParameterTable
from processing.core.parameters import ParameterTableField
from processing.core.outputs import OutputVector
@@ -45,8 +45,8 @@ class CreateAttributeIndex(GeoAlgorithm):
self.name, self.i18n_name = self.trAlgorithm('Create attribute index')
self.group, self.i18n_group = self.trAlgorithm('Vector general tools')
- self.addParameter(ParameterVector(self.INPUT,
- self.tr('Input Layer')))
+ self.addParameter(ParameterTable(self.INPUT,
+ self.tr('Input Layer')))
self.addParameter(ParameterTableField(self.FIELD,
self.tr('Attribute to index'), self.INPUT))
self.addOutput(OutputVector(self.OUTPUT,
diff --git a/python/plugins/processing/algs/qgis/Difference.py b/python/plugins/processing/algs/qgis/Difference.py
index 9045757b41e..6c5ef67f707 100644
--- a/python/plugins/processing/algs/qgis/Difference.py
+++ b/python/plugins/processing/algs/qgis/Difference.py
@@ -58,8 +58,6 @@ class Difference(GeoAlgorithm):
self.tr('Input layer')))
self.addParameter(ParameterVector(Difference.OVERLAY,
self.tr('Difference layer')))
- self.addParameter(ParameterBoolean(Difference.IGNORE_INVALID,
- self.tr('Ignore invalid input features'), False, True))
self.addOutput(OutputVector(Difference.OUTPUT, self.tr('Difference')))
def processAlgorithm(self, progress):
@@ -67,7 +65,6 @@ class Difference(GeoAlgorithm):
self.getParameterValue(Difference.INPUT))
layerB = dataobjects.getObjectFromUri(
self.getParameterValue(Difference.OVERLAY))
- ignoreInvalid = self.getParameterValue(Difference.IGNORE_INVALID)
geomType = QgsWkbTypes.multiType(layerA.wkbType())
writer = self.getOutputFromName(
@@ -80,7 +77,6 @@ class Difference(GeoAlgorithm):
selectionA = vector.features(layerA)
total = 100.0 / len(selectionA)
for current, inFeatA in enumerate(selectionA):
- add = True
geom = inFeatA.geometry()
diff_geom = QgsGeometry(geom)
attrs = inFeatA.attributes()
@@ -91,27 +87,15 @@ class Difference(GeoAlgorithm):
tmpGeom = inFeatB.geometry()
if diff_geom.intersects(tmpGeom):
diff_geom = QgsGeometry(diff_geom.difference(tmpGeom))
- if diff_geom.isGeosEmpty():
- ProcessingLog.addToLog(ProcessingLog.LOG_INFO,
- self.tr('Feature with NULL geometry found.'))
- if not diff_geom.isGeosValid():
- if ignoreInvalid:
- ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
- self.tr('GEOS geoprocessing error: One or more input features have invalid geometry.'))
- add = False
- else:
- raise GeoAlgorithmExecutionException(self.tr('Features with invalid geometries found. Please fix these errors or specify the "Ignore invalid input features" flag'))
- break
- if add:
- try:
- outFeat.setGeometry(diff_geom)
- outFeat.setAttributes(attrs)
- writer.addFeature(outFeat)
- except:
- ProcessingLog.addToLog(ProcessingLog.LOG_WARNING,
- self.tr('Feature geometry error: One or more output features ignored due to invalid geometry.'))
- continue
+ try:
+ outFeat.setGeometry(diff_geom)
+ outFeat.setAttributes(attrs)
+ writer.addFeature(outFeat)
+ except:
+ ProcessingLog.addToLog(ProcessingLog.LOG_WARNING,
+ self.tr('Feature geometry error: One or more output features ignored due to invalid geometry.'))
+ continue
progress.setPercentage(int(current * total))
diff --git a/python/plugins/processing/algs/qgis/Eliminate.py b/python/plugins/processing/algs/qgis/Eliminate.py
index 144f5c59e2c..6b3766eb2c1 100644
--- a/python/plugins/processing/algs/qgis/Eliminate.py
+++ b/python/plugins/processing/algs/qgis/Eliminate.py
@@ -133,7 +133,7 @@ class Eliminate(GeoAlgorithm):
y = str(comparisonvalue)
except ValueError:
selectionError = True
- msg = self.tr('Cannot convert "%s" to unicode' % str(comparisonvalue))
+ msg = self.tr('Cannot convert "%s" to Unicode' % str(comparisonvalue))
elif selectType == QVariant.Date:
# date
dateAndFormat = comparisonvalue.split(' ')
diff --git a/python/plugins/processing/algs/qgis/FieldsCalculator.py b/python/plugins/processing/algs/qgis/FieldsCalculator.py
index d97df4332d9..d04e65c6029 100644
--- a/python/plugins/processing/algs/qgis/FieldsCalculator.py
+++ b/python/plugins/processing/algs/qgis/FieldsCalculator.py
@@ -108,10 +108,7 @@ class FieldsCalculator(GeoAlgorithm):
exp.setDistanceUnits(QgsProject.instance().distanceUnits())
exp.setAreaUnits(QgsProject.instance().areaUnits())
- exp_context = QgsExpressionContext()
- exp_context.appendScope(QgsExpressionContextUtils.globalScope())
- exp_context.appendScope(QgsExpressionContextUtils.projectScope())
- exp_context.appendScope(QgsExpressionContextUtils.layerScope(layer))
+ exp_context = QgsExpressionContext(QgsExpressionContextUtils.globalProjectLayerScopes(layer))
if not exp.prepare(exp_context):
raise GeoAlgorithmExecutionException(
diff --git a/python/plugins/processing/algs/qgis/GeometryByExpression.py b/python/plugins/processing/algs/qgis/GeometryByExpression.py
index be927c09e08..c8dc36d4d25 100644
--- a/python/plugins/processing/algs/qgis/GeometryByExpression.py
+++ b/python/plugins/processing/algs/qgis/GeometryByExpression.py
@@ -95,10 +95,7 @@ class GeometryByExpression(GeoAlgorithm):
if expression.hasParserError():
raise GeoAlgorithmExecutionException(expression.parserErrorString())
- exp_context = QgsExpressionContext()
- exp_context.appendScope(QgsExpressionContextUtils.globalScope())
- exp_context.appendScope(QgsExpressionContextUtils.projectScope())
- exp_context.appendScope(QgsExpressionContextUtils.layerScope(layer))
+ exp_context = QgsExpressionContext(QgsExpressionContextUtils.globalProjectLayerScopes(layer))
if not expression.prepare(exp_context):
raise GeoAlgorithmExecutionException(
diff --git a/python/plugins/processing/algs/qgis/Heatmap.py b/python/plugins/processing/algs/qgis/Heatmap.py
index 1e8faee8f2c..5807c039941 100644
--- a/python/plugins/processing/algs/qgis/Heatmap.py
+++ b/python/plugins/processing/algs/qgis/Heatmap.py
@@ -32,6 +32,7 @@ from qgis.PyQt.QtGui import QIcon
from qgis.core import QgsFeatureRequest
from qgis.analysis import QgsKernelDensityEstimation
+from processing.core.ProcessingLog import ProcessingLog
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from processing.core.parameters import ParameterVector
@@ -166,8 +167,8 @@ class Heatmap(GeoAlgorithm):
total = 100.0 / len(features)
for current, f in enumerate(features):
if kde.addFeature(f) != QgsKernelDensityEstimation.Success:
- raise GeoAlgorithmExecutionException(
- self.tr('Error adding feature to heatmap'))
+ ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
+ self.tr('Error adding feature with ID {} to heatmap').format(f.id()))
progress.setPercentage(int(current * total))
diff --git a/python/plugins/processing/algs/qgis/IdwInterpolationZValue.py b/python/plugins/processing/algs/qgis/IdwInterpolation.py
similarity index 54%
rename from python/plugins/processing/algs/qgis/IdwInterpolationZValue.py
rename to python/plugins/processing/algs/qgis/IdwInterpolation.py
index fd9ee291d44..f97a29e625f 100644
--- a/python/plugins/processing/algs/qgis/IdwInterpolationZValue.py
+++ b/python/plugins/processing/algs/qgis/IdwInterpolation.py
@@ -2,7 +2,7 @@
"""
***************************************************************************
- IdwInterpolationZValue.py
+ IdwInterpolation.py
---------------------
Date : October 2016
Copyright : (C) 2016 by Alexander Bruy
@@ -29,7 +29,7 @@ import os
from qgis.PyQt.QtGui import QIcon
-from qgis.core import QgsRectangle, QgsWkbTypes
+from qgis.core import QgsRectangle
from qgis.analysis import (QgsInterpolator,
QgsIDWInterpolator,
QgsGridFileWriter
@@ -37,20 +37,20 @@ from qgis.analysis import (QgsInterpolator,
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
-from processing.core.parameters import ParameterVector
-from processing.core.parameters import ParameterSelection
-from processing.core.parameters import ParameterNumber
-from processing.core.parameters import ParameterExtent
+from processing.core.parameters import (Parameter,
+ ParameterNumber,
+ ParameterExtent,
+ _splitParameterOptions
+ )
from processing.core.outputs import OutputRaster
from processing.tools import dataobjects
pluginPath = os.path.split(os.path.split(os.path.dirname(__file__))[0])[0]
-class IdwInterpolationZValue(GeoAlgorithm):
+class IdwInterpolation(GeoAlgorithm):
- INPUT_LAYER = 'INPUT_LAYER'
- LAYER_TYPE = 'LAYER_TYPE'
+ INTERPOLATION_DATA = 'INTERPOLATION_DATA'
DISTANCE_COEFFICIENT = 'DISTANCE_COEFFICIENT'
COLUMNS = 'COLUMNS'
ROWS = 'ROWS'
@@ -63,20 +63,61 @@ class IdwInterpolationZValue(GeoAlgorithm):
return QIcon(os.path.join(pluginPath, 'images', 'interpolation.png'))
def defineCharacteristics(self):
- self.name, self.i18n_name = self.trAlgorithm('IDW interpolation (using Z-values)')
+ self.name, self.i18n_name = self.trAlgorithm('IDW interpolation')
self.group, self.i18n_group = self.trAlgorithm('Interpolation')
- self.TYPES = [self.tr('Points'),
- self.tr('Structure lines'),
- self.tr('Break lines')
- ]
+ class ParameterInterpolationData(Parameter):
+ default_metadata = {
+ 'widget_wrapper': 'processing.algs.qgis.ui.InterpolationDataWidget.InterpolationDataWidgetWrapper'
+ }
- self.addParameter(ParameterVector(self.INPUT_LAYER,
- self.tr('Vector layer')))
- self.addParameter(ParameterSelection(self.LAYER_TYPE,
- self.tr('Type'),
- self.TYPES,
- 0))
+ def __init__(self, name='', description=''):
+ Parameter.__init__(self, name, description)
+
+ def setValue(self, value):
+ if value is None:
+ if not self.optional:
+ return False
+ self.value = None
+ return True
+
+ if value == '':
+ if not self.optional:
+ return False
+
+ if isinstance(value, str):
+ self.value = value if value != '' else None
+ else:
+ self.value = ParameterInterpolationData.dataToString(value)
+ return True
+
+ def getValueAsCommandLineParameter(self):
+ return '"{}"'.format(self.value)
+
+ def getAsScriptCode(self):
+ param_type = ''
+ param_type += 'interpolation data '
+ return '##' + self.name + '=' + param_type
+
+ @classmethod
+ def fromScriptCode(self, line):
+ isOptional, name, definition = _splitParameterOptions(line)
+ descName = _createDescriptiveName(name)
+ parent = definition.lower().strip()[len('interpolation data') + 1:]
+ return ParameterInterpolationData(name, description, parent)
+
+ @staticmethod
+ def dataToString(data):
+ s = ''
+ for d in data:
+ s += '{}, {}, {:d}, {:d};'.format(c[0],
+ c[1],
+ c[2],
+ c[3])
+ return s[:-1]
+
+ self.addParameter(ParameterInterpolationData(self.INTERPOLATION_DATA,
+ self.tr('Input layer(s)')))
self.addParameter(ParameterNumber(self.DISTANCE_COEFFICIENT,
self.tr('Distance coefficient P'),
0.0, 99.99, 2.0))
@@ -87,10 +128,10 @@ class IdwInterpolationZValue(GeoAlgorithm):
self.tr('Number of rows'),
0, 10000000, 300))
self.addParameter(ParameterNumber(self.CELLSIZE_X,
- self.tr('Cellsize X'),
+ self.tr('Cell Size X'),
0.0, 999999.000000, 0.0))
self.addParameter(ParameterNumber(self.CELLSIZE_Y,
- self.tr('Cellsize Y'),
+ self.tr('Cell Size Y'),
0.0, 999999.000000, 0.0))
self.addParameter(ParameterExtent(self.EXTENT,
self.tr('Extent')))
@@ -98,9 +139,7 @@ class IdwInterpolationZValue(GeoAlgorithm):
self.tr('Interpolated')))
def processAlgorithm(self, progress):
- layer = dataobjects.getObjectFromUri(
- self.getParameterValue(self.INPUT_LAYER))
- layerType = self.getParameterValue(self.LAYER_TYPE)
+ interpolationData = self.getParameterValue(self.INTERPOLATION_DATA)
coefficient = self.getParameterValue(self.DISTANCE_COEFFICIENT)
columns = self.getParameterValue(self.COLUMNS)
rows = self.getParameterValue(self.ROWS)
@@ -109,9 +148,9 @@ class IdwInterpolationZValue(GeoAlgorithm):
extent = self.getParameterValue(self.EXTENT).split(',')
output = self.getOutputValue(self.OUTPUT_LAYER)
- if not QgsWkbTypes.hasZ(layer.wkbType()):
+ if interpolationData is None:
raise GeoAlgorithmExecutionException(
- self.tr('Geometries in input layer does not have Z coordinates.'))
+ self.tr('You need to specify at least one input layer.'))
xMin = float(extent[0])
xMax = float(extent[1])
@@ -119,19 +158,22 @@ class IdwInterpolationZValue(GeoAlgorithm):
yMax = float(extent[3])
bbox = QgsRectangle(xMin, yMin, xMax, yMax)
- layerData = QgsInterpolator.LayerData()
- layerData.vectorLayer = layer
- layerData.zCoordInterpolation = True
- layerData.interpolationAttribute = -1
+ layerData = []
+ for row in interpolationData.split(';'):
+ v = row.split(',')
+ data = QgsInterpolator.LayerData()
+ data.vectorLayer = dataobjects.getObjectFromUri(v[0])
+ data.zCoordInterpolation = bool(v[1])
+ data.interpolationAttribute = int(v[2])
+ if v[3] == '0':
+ data.mInputType = QgsInterpolator.POINTS
+ elif v[3] == '1':
+ data.mInputType = QgsInterpolator.STRUCTURE_LINES
+ else:
+ data.mInputType = QgsInterpolator.BREAK_LINES
+ layerData.append(data)
- if layerType == 0:
- layerData.mInputType = QgsInterpolator.POINTS
- elif layerType == 1:
- layerData.mInputType = QgsInterpolator.STRUCTURE_LINES
- else:
- layerData.mInputType = QgsInterpolator.BREAK_LINES
-
- interpolator = QgsIDWInterpolator([layerData])
+ interpolator = QgsIDWInterpolator(layerData)
interpolator.setDistanceCoefficient(coefficient)
writer = QgsGridFileWriter(interpolator,
diff --git a/python/plugins/processing/algs/qgis/IdwInterpolationAttribute.py b/python/plugins/processing/algs/qgis/IdwInterpolationAttribute.py
deleted file mode 100644
index 64a9fc72e72..00000000000
--- a/python/plugins/processing/algs/qgis/IdwInterpolationAttribute.py
+++ /dev/null
@@ -1,147 +0,0 @@
-# -*- coding: utf-8 -*-
-
-"""
-***************************************************************************
- IdwInterpolationAttribute.py
- ---------------------
- Date : October 2016
- Copyright : (C) 2016 by Alexander Bruy
- Email : alexander dot bruy 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__ = 'Alexander Bruy'
-__date__ = 'October 2016'
-__copyright__ = '(C) 2016, Alexander Bruy'
-
-# This will get replaced with a git SHA1 when you do a git archive
-
-__revision__ = '$Format:%H$'
-
-import os
-
-from qgis.PyQt.QtGui import QIcon
-
-from qgis.core import QgsRectangle
-from qgis.analysis import (QgsInterpolator,
- QgsIDWInterpolator,
- QgsGridFileWriter
- )
-
-from processing.core.GeoAlgorithm import GeoAlgorithm
-from processing.core.parameters import ParameterVector
-from processing.core.parameters import ParameterTableField
-from processing.core.parameters import ParameterSelection
-from processing.core.parameters import ParameterNumber
-from processing.core.parameters import ParameterExtent
-from processing.core.outputs import OutputRaster
-from processing.tools import dataobjects
-
-pluginPath = os.path.split(os.path.split(os.path.dirname(__file__))[0])[0]
-
-
-class IdwInterpolationAttribute(GeoAlgorithm):
-
- INPUT_LAYER = 'INPUT_LAYER'
- ATTRIBUTE = 'ATTRIBUTE'
- LAYER_TYPE = 'LAYER_TYPE'
- DISTANCE_COEFFICIENT = 'DISTANCE_COEFFICIENT'
- COLUMNS = 'COLUMNS'
- ROWS = 'ROWS'
- CELLSIZE_X = 'CELLSIZE_X'
- CELLSIZE_Y = 'CELLSIZE_Y'
- EXTENT = 'EXTENT'
- OUTPUT_LAYER = 'OUTPUT_LAYER'
-
- def getIcon(self):
- return QIcon(os.path.join(pluginPath, 'images', 'interpolation.png'))
-
- def defineCharacteristics(self):
- self.name, self.i18n_name = self.trAlgorithm('IDW interpolation (using attribute)')
- self.group, self.i18n_group = self.trAlgorithm('Interpolation')
-
- self.TYPES = [self.tr('Points'),
- self.tr('Structure lines'),
- self.tr('Break lines')
- ]
-
- self.addParameter(ParameterVector(self.INPUT_LAYER,
- self.tr('Vector layer')))
- self.addParameter(ParameterTableField(self.ATTRIBUTE,
- self.tr('Interpolation attribute'),
- self.INPUT_LAYER,
- ParameterTableField.DATA_TYPE_NUMBER))
- self.addParameter(ParameterSelection(self.LAYER_TYPE,
- self.tr('Type'),
- self.TYPES,
- 0))
- self.addParameter(ParameterNumber(self.DISTANCE_COEFFICIENT,
- self.tr('Distance coefficient P'),
- 0.0, 99.99, 2.0))
- self.addParameter(ParameterNumber(self.COLUMNS,
- self.tr('Number of columns'),
- 0, 10000000, 300))
- self.addParameter(ParameterNumber(self.ROWS,
- self.tr('Number of rows'),
- 0, 10000000, 300))
- self.addParameter(ParameterNumber(self.CELLSIZE_X,
- self.tr('Cellsize X'),
- 0.0, 999999.000000, 0.0))
- self.addParameter(ParameterNumber(self.CELLSIZE_Y,
- self.tr('Cellsize Y'),
- 0.0, 999999.000000, 0.0))
- self.addParameter(ParameterExtent(self.EXTENT,
- self.tr('Extent')))
- self.addOutput(OutputRaster(self.OUTPUT_LAYER,
- self.tr('Interpolated')))
-
- def processAlgorithm(self, progress):
- layer = dataobjects.getObjectFromUri(
- self.getParameterValue(self.INPUT_LAYER))
- fieldName = self.getParameterValue(self.ATTRIBUTE)
- layerType = self.getParameterValue(self.LAYER_TYPE)
- coefficient = self.getParameterValue(self.DISTANCE_COEFFICIENT)
- columns = self.getParameterValue(self.COLUMNS)
- rows = self.getParameterValue(self.ROWS)
- cellsizeX = self.getParameterValue(self.CELLSIZE_X)
- cellsizeY = self.getParameterValue(self.CELLSIZE_Y)
- extent = self.getParameterValue(self.EXTENT).split(',')
- output = self.getOutputValue(self.OUTPUT_LAYER)
-
- xMin = float(extent[0])
- xMax = float(extent[1])
- yMin = float(extent[2])
- yMax = float(extent[3])
- bbox = QgsRectangle(xMin, yMin, xMax, yMax)
-
- layerData = QgsInterpolator.LayerData()
- layerData.vectorLayer = layer
- layerData.zCoordInterpolation = False
- layerData.interpolationAttribute = layer.dataProvider().fieldNameIndex(fieldName)
-
- if layerType == 0:
- layerData.mInputType = QgsInterpolator.POINTS
- elif layerType == 1:
- layerData.mInputType = QgsInterpolator.STRUCTURE_LINES
- else:
- layerData.mInputType = QgsInterpolator.BREAK_LINES
-
- interpolator = QgsIDWInterpolator([layerData])
- interpolator.setDistanceCoefficient(coefficient)
-
- writer = QgsGridFileWriter(interpolator,
- output,
- bbox,
- columns,
- rows,
- cellsizeX,
- cellsizeY)
-
- writer.writeFile()
diff --git a/python/plugins/processing/algs/qgis/QGISAlgorithmProvider.py b/python/plugins/processing/algs/qgis/QGISAlgorithmProvider.py
index 828e366e584..9e5cbd4a023 100644
--- a/python/plugins/processing/algs/qgis/QGISAlgorithmProvider.py
+++ b/python/plugins/processing/algs/qgis/QGISAlgorithmProvider.py
@@ -167,10 +167,8 @@ from .Slope import Slope
from .Ruggedness import Ruggedness
from .Hillshade import Hillshade
from .Relief import Relief
-from .IdwInterpolationZValue import IdwInterpolationZValue
-from .IdwInterpolationAttribute import IdwInterpolationAttribute
-from .TinInterpolationZValue import TinInterpolationZValue
-from .TinInterpolationAttribute import TinInterpolationAttribute
+from .IdwInterpolation import IdwInterpolation
+from .TinInterpolation import TinInterpolation
from .ZonalStatisticsQgis import ZonalStatisticsQgis
from .RemoveNullGeometry import RemoveNullGeometry
from .ExtendLines import ExtendLines
@@ -189,6 +187,7 @@ from .ShortestPathPointToLayer import ShortestPathPointToLayer
from .ShortestPathLayerToPoint import ShortestPathLayerToPoint
from .ServiceAreaFromPoint import ServiceAreaFromPoint
from .ServiceAreaFromLayer import ServiceAreaFromLayer
+from .TruncateTable import TruncateTable
pluginPath = os.path.normpath(os.path.join(
os.path.split(os.path.dirname(__file__))[0], os.pardir))
@@ -248,8 +247,7 @@ class QGISAlgorithmProvider(AlgorithmProvider):
SingleSidedBuffer(), PointsAlongGeometry(),
Aspect(), Slope(), Ruggedness(), Hillshade(),
Relief(), ZonalStatisticsQgis(),
- IdwInterpolationZValue(), IdwInterpolationAttribute(),
- TinInterpolationZValue(), TinInterpolationAttribute(),
+ IdwInterpolation(), TinInterpolation(),
RemoveNullGeometry(), ExtractByExpression(),
ExtendLines(), ExtractSpecificNodes(),
GeometryByExpression(), SnapGeometriesToLayer(),
@@ -258,7 +256,7 @@ class QGISAlgorithmProvider(AlgorithmProvider):
RasterCalculator(), Heatmap(), Orthogonalize(),
ShortestPathPointToPoint(), ShortestPathPointToLayer(),
ShortestPathLayerToPoint(), ServiceAreaFromPoint(),
- ServiceAreaFromLayer()
+ ServiceAreaFromLayer(), TruncateTable()
]
if hasMatplotlib:
@@ -303,7 +301,7 @@ class QGISAlgorithmProvider(AlgorithmProvider):
return 'qgis'
def getDescription(self):
- return self.tr('QGIS geoalgorithms')
+ return 'QGIS'
def getIcon(self):
return self._icon
diff --git a/python/plugins/processing/algs/qgis/RasterCalculator.py b/python/plugins/processing/algs/qgis/RasterCalculator.py
index 8eaf5bd328d..f8d27d9179f 100644
--- a/python/plugins/processing/algs/qgis/RasterCalculator.py
+++ b/python/plugins/processing/algs/qgis/RasterCalculator.py
@@ -81,7 +81,7 @@ class RasterCalculator(GeoAlgorithm):
multiline=True,
metadata={'widget_wrapper': ExpressionWidgetWrapper}))
self.addParameter(ParameterNumber(self.CELLSIZE,
- self.tr('Cellsize (use 0 or empty to set it automatically)'),
+ self.tr('Cell size (use 0 or empty to set it automatically)'),
minValue=0.0, default=0.0, optional=True))
self.addParameter(ParameterExtent(self.EXTENT,
self.tr('Output extent'),
diff --git a/python/plugins/processing/algs/qgis/Relief.py b/python/plugins/processing/algs/qgis/Relief.py
index 8eb64ac0fc9..3f8fec3c2e3 100644
--- a/python/plugins/processing/algs/qgis/Relief.py
+++ b/python/plugins/processing/algs/qgis/Relief.py
@@ -76,8 +76,8 @@ class Relief(GeoAlgorithm):
return True
if value == '':
- if not self.optional:
- return False
+ if not self.optional:
+ return False
if isinstance(value, str):
self.value = value if value != '' else None
@@ -97,7 +97,7 @@ class Relief(GeoAlgorithm):
def fromScriptCode(self, line):
isOptional, name, definition = _splitParameterOptions(line)
descName = _createDescriptiveName(name)
- parent = definition.lower().strip()[len('relief colors') + 1:]
+ parent = definition.lower().strip()[len('relief colors') + 1:]
return ParameterReliefColors(name, description, parent)
@staticmethod
@@ -117,7 +117,7 @@ class Relief(GeoAlgorithm):
self.tr('Z factor'),
1.0, 999999.99, 1.0))
self.addParameter(ParameterBoolean(self.AUTO_COLORS,
- self.tr('Generate relief classes automaticaly'),
+ self.tr('Generate relief classes automatically'),
False))
self.addParameter(ParameterReliefColors(self.COLORS,
self.tr('Relief colors'),
@@ -145,7 +145,7 @@ class Relief(GeoAlgorithm):
else:
if colors is None:
raise GeoAlgorithmExecutionException(
- self.tr('Specify relief colors or activate "Generate relief classes automaticaly" option.'))
+ self.tr('Specify relief colors or activate "Generate relief classes automatically" option.'))
reliefColors = []
for c in colors.split(';'):
diff --git a/python/plugins/processing/algs/qgis/ServiceAreaFromLayer.py b/python/plugins/processing/algs/qgis/ServiceAreaFromLayer.py
index cdd4e19e759..bb73ba89666 100644
--- a/python/plugins/processing/algs/qgis/ServiceAreaFromLayer.py
+++ b/python/plugins/processing/algs/qgis/ServiceAreaFromLayer.py
@@ -258,6 +258,11 @@ class ServiceAreaFromLayer(GeoAlgorithm):
feat['start'] = origPoint
writerPoints.addFeature(feat)
+ upperBoundary.append(startPoint)
+ lowerBoundary.append(startPoint)
+ geomUpper = QgsGeometry.fromMultiPoint(upperBoundary)
+ geomLower = QgsGeometry.fromMultiPoint(lowerBoundary)
+
geom = geomUpper.convexHull()
feat.setGeometry(geom)
feat['type'] = 'upper'
diff --git a/python/plugins/processing/algs/qgis/ServiceAreaFromPoint.py b/python/plugins/processing/algs/qgis/ServiceAreaFromPoint.py
index 197031a29c1..8471e725ca7 100644
--- a/python/plugins/processing/algs/qgis/ServiceAreaFromPoint.py
+++ b/python/plugins/processing/algs/qgis/ServiceAreaFromPoint.py
@@ -215,7 +215,7 @@ class ServiceAreaFromPoint(GeoAlgorithm):
upperBoundary.append(graph.vertex(graph.edge(tree[i]).inVertex()).point())
lowerBoundary.append(graph.vertex(graph.edge(tree[i]).outVertex()).point())
- progress.setInfo(self.tr('Writting results...'))
+ progress.setInfo(self.tr('Writing results...'))
fields = QgsFields()
fields.append(QgsField('type', QVariant.String, '', 254, 0))
@@ -245,6 +245,11 @@ class ServiceAreaFromPoint(GeoAlgorithm):
del writer
+ upperBoundary.append(startPoint)
+ lowerBoundary.append(startPoint)
+ geomUpper = QgsGeometry.fromMultiPoint(upperBoundary)
+ geomLower = QgsGeometry.fromMultiPoint(lowerBoundary)
+
writer = self.getOutputFromName(
self.OUTPUT_POLYGON).getVectorWriter(
fields,
diff --git a/python/plugins/processing/algs/qgis/ShortestPathPointToPoint.py b/python/plugins/processing/algs/qgis/ShortestPathPointToPoint.py
index 776285c8100..b3ff7154e93 100644
--- a/python/plugins/processing/algs/qgis/ShortestPathPointToPoint.py
+++ b/python/plugins/processing/algs/qgis/ShortestPathPointToPoint.py
@@ -232,7 +232,7 @@ class ShortestPathPointToPoint(GeoAlgorithm):
self.setOutputValue(self.TRAVEL_COST, cost / multiplier)
- progress.setInfo(self.tr('Writting results...'))
+ progress.setInfo(self.tr('Writing results...'))
geom = QgsGeometry.fromPolyline(route)
feat = QgsFeature()
feat.setFields(fields)
diff --git a/python/plugins/processing/algs/qgis/SpatialIndex.py b/python/plugins/processing/algs/qgis/SpatialIndex.py
index 75cc74ef4e2..d517329ef63 100644
--- a/python/plugins/processing/algs/qgis/SpatialIndex.py
+++ b/python/plugins/processing/algs/qgis/SpatialIndex.py
@@ -62,7 +62,7 @@ class SpatialIndex(GeoAlgorithm):
if provider.capabilities() & QgsVectorDataProvider.CreateSpatialIndex:
if not provider.createSpatialIndex():
- progress.setInfo(self.tr('Can not create spatial index'))
+ progress.setInfo(self.tr('Could not create spatial index'))
else:
progress.setInfo(self.tr("Layer's data provider does not support "
"spatial indexes"))
diff --git a/python/plugins/processing/algs/qgis/SymmetricalDifference.py b/python/plugins/processing/algs/qgis/SymmetricalDifference.py
index 098f7da0cca..23b5deb9bd0 100644
--- a/python/plugins/processing/algs/qgis/SymmetricalDifference.py
+++ b/python/plugins/processing/algs/qgis/SymmetricalDifference.py
@@ -83,7 +83,6 @@ class SymmetricalDifference(GeoAlgorithm):
count = 0
for featA in featuresA:
- add = True
geom = featA.geometry()
diffGeom = QgsGeometry(geom)
attrs = featA.attributes()
@@ -93,23 +92,15 @@ class SymmetricalDifference(GeoAlgorithm):
tmpGeom = featB.geometry()
if diffGeom.intersects(tmpGeom):
diffGeom = QgsGeometry(diffGeom.difference(tmpGeom))
- if not diffGeom.isGeosValid():
- ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
- self.tr('GEOS geoprocessing error: One or '
- 'more input features have invalid '
- 'geometry.'))
- add = False
- break
- if add:
- try:
- outFeat.setGeometry(diffGeom)
- outFeat.setAttributes(attrs)
- writer.addFeature(outFeat)
- except:
- ProcessingLog.addToLog(ProcessingLog.LOG_WARNING,
- self.tr('Feature geometry error: One or more output features ignored due to invalid geometry.'))
- continue
+ try:
+ outFeat.setGeometry(diffGeom)
+ outFeat.setAttributes(attrs)
+ writer.addFeature(outFeat)
+ except:
+ ProcessingLog.addToLog(ProcessingLog.LOG_WARNING,
+ self.tr('Feature geometry error: One or more output features ignored due to invalid geometry.'))
+ continue
count += 1
progress.setPercentage(int(count * total))
@@ -117,7 +108,6 @@ class SymmetricalDifference(GeoAlgorithm):
length = len(layerA.fields())
for featA in featuresB:
- add = True
geom = featA.geometry()
diffGeom = QgsGeometry(geom)
attrs = featA.attributes()
@@ -128,23 +118,15 @@ class SymmetricalDifference(GeoAlgorithm):
tmpGeom = featB.geometry()
if diffGeom.intersects(tmpGeom):
diffGeom = QgsGeometry(diffGeom.difference(tmpGeom))
- if not diffGeom.isGeosValid():
- ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
- self.tr('GEOS geoprocessing error: One or '
- 'more input features have invalid '
- 'geometry.'))
- add = False
- break
- if add:
- try:
- outFeat.setGeometry(diffGeom)
- outFeat.setAttributes(attrs)
- writer.addFeature(outFeat)
- except:
- ProcessingLog.addToLog(ProcessingLog.LOG_WARNING,
- self.tr('Feature geometry error: One or more output features ignored due to invalid geometry.'))
- continue
+ try:
+ outFeat.setGeometry(diffGeom)
+ outFeat.setAttributes(attrs)
+ writer.addFeature(outFeat)
+ except:
+ ProcessingLog.addToLog(ProcessingLog.LOG_WARNING,
+ self.tr('Feature geometry error: One or more output features ignored due to invalid geometry.'))
+ continue
count += 1
progress.setPercentage(int(count * total))
diff --git a/python/plugins/processing/algs/qgis/TinInterpolationZValue.py b/python/plugins/processing/algs/qgis/TinInterpolation.py
similarity index 55%
rename from python/plugins/processing/algs/qgis/TinInterpolationZValue.py
rename to python/plugins/processing/algs/qgis/TinInterpolation.py
index 332f6303f61..dce6eaca15c 100644
--- a/python/plugins/processing/algs/qgis/TinInterpolationZValue.py
+++ b/python/plugins/processing/algs/qgis/TinInterpolation.py
@@ -2,7 +2,7 @@
"""
***************************************************************************
- TinInterpolationZValue.py
+ TinInterpolation.py
---------------------
Date : October 2016
Copyright : (C) 2016 by Alexander Bruy
@@ -29,28 +29,31 @@ import os
from qgis.PyQt.QtGui import QIcon
-from qgis.core import QgsRectangle, QgsWkbTypes
+from qgis.core import QgsRectangle
from qgis.analysis import (QgsInterpolator,
QgsTINInterpolator,
QgsGridFileWriter
)
from processing.core.GeoAlgorithm import GeoAlgorithm
-from processing.core.parameters import ParameterVector
-from processing.core.parameters import ParameterSelection
-from processing.core.parameters import ParameterNumber
-from processing.core.parameters import ParameterExtent
-from processing.core.outputs import OutputRaster
-from processing.core.outputs import OutputVector
+from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
+from processing.core.parameters import (Parameter,
+ ParameterNumber,
+ ParameterExtent,
+ ParameterSelection,
+ _splitParameterOptions
+ )
+from processing.core.outputs import (OutputRaster,
+ OutputVector
+ )
from processing.tools import dataobjects
pluginPath = os.path.split(os.path.split(os.path.dirname(__file__))[0])[0]
-class TinInterpolationZValue(GeoAlgorithm):
+class TinInterpolation(GeoAlgorithm):
- INPUT_LAYER = 'INPUT_LAYER'
- LAYER_TYPE = 'LAYER_TYPE'
+ INTERPOLATION_DATA = 'INTERPOLATION_DATA'
METHOD = 'METHOD'
COLUMNS = 'COLUMNS'
ROWS = 'ROWS'
@@ -64,23 +67,65 @@ class TinInterpolationZValue(GeoAlgorithm):
return QIcon(os.path.join(pluginPath, 'images', 'interpolation.png'))
def defineCharacteristics(self):
- self.name, self.i18n_name = self.trAlgorithm('TIN interpolation (using Z-values)')
+ self.name, self.i18n_name = self.trAlgorithm('TIN interpolation')
self.group, self.i18n_group = self.trAlgorithm('Interpolation')
- self.TYPES = [self.tr('Points'),
- self.tr('Structure lines'),
- self.tr('Break lines')
- ]
self.METHODS = [self.tr('Linear'),
self.tr('Clough-Toucher (cubic)')
]
- self.addParameter(ParameterVector(self.INPUT_LAYER,
- self.tr('Vector layer')))
- self.addParameter(ParameterSelection(self.LAYER_TYPE,
- self.tr('Type'),
- self.TYPES,
- 0))
+ class ParameterInterpolationData(Parameter):
+ default_metadata = {
+ 'widget_wrapper': 'processing.algs.qgis.ui.InterpolationDataWidget.InterpolationDataWidgetWrapper'
+ }
+
+ def __init__(self, name='', description=''):
+ Parameter.__init__(self, name, description)
+
+ def setValue(self, value):
+ if value is None:
+ if not self.optional:
+ return False
+ self.value = None
+ return True
+
+ if value == '':
+ if not self.optional:
+ return False
+
+ if isinstance(value, str):
+ self.value = value if value != '' else None
+ else:
+ self.value = ParameterInterpolationData.dataToString(value)
+ return True
+
+ def getValueAsCommandLineParameter(self):
+ return '"{}"'.format(self.value)
+
+ def getAsScriptCode(self):
+ param_type = ''
+ param_type += 'interpolation data '
+ return '##' + self.name + '=' + param_type
+
+ @classmethod
+ def fromScriptCode(self, line):
+ isOptional, name, definition = _splitParameterOptions(line)
+ descName = _createDescriptiveName(name)
+ parent = definition.lower().strip()[len('interpolation data') + 1:]
+ return ParameterInterpolationData(name, description, parent)
+
+ @staticmethod
+ def dataToString(data):
+ s = ''
+ for d in data:
+ s += '{}, {}, {:d}, {:d};'.format(c[0],
+ c[1],
+ c[2],
+ c[3])
+ return s[:-1]
+
+ self.addParameter(ParameterInterpolationData(self.INTERPOLATION_DATA,
+ self.tr('Input layer(s)')))
self.addParameter(ParameterSelection(self.METHOD,
self.tr('Interpolation method'),
self.METHODS,
@@ -92,10 +137,10 @@ class TinInterpolationZValue(GeoAlgorithm):
self.tr('Number of rows'),
0, 10000000, 300))
self.addParameter(ParameterNumber(self.CELLSIZE_X,
- self.tr('Cellsize X'),
+ self.tr('Cell size X'),
0.0, 999999.000000, 0.0))
self.addParameter(ParameterNumber(self.CELLSIZE_Y,
- self.tr('Cellsize Y'),
+ self.tr('Cell size Y'),
0.0, 999999.000000, 0.0))
self.addParameter(ParameterExtent(self.EXTENT,
self.tr('Extent')))
@@ -106,9 +151,7 @@ class TinInterpolationZValue(GeoAlgorithm):
)) # datatype=dataobjects.TYPE_VECTOR_LINE))
def processAlgorithm(self, progress):
- layer = dataobjects.getObjectFromUri(
- self.getParameterValue(self.INPUT_LAYER))
- layerType = self.getParameterValue(self.LAYER_TYPE)
+ interpolationData = self.getParameterValue(self.INTERPOLATION_DATA)
method = self.getParameterValue(self.METHOD)
columns = self.getParameterValue(self.COLUMNS)
rows = self.getParameterValue(self.ROWS)
@@ -118,9 +161,9 @@ class TinInterpolationZValue(GeoAlgorithm):
output = self.getOutputValue(self.OUTPUT_LAYER)
triangulation = self.getOutputValue(self.TRIANULATION_FILE)
- if not QgsWkbTypes.hasZ(layer.wkbType()):
+ if interpolationData is None:
raise GeoAlgorithmExecutionException(
- self.tr('Geometries in input layer does not have Z coordinates.'))
+ self.tr('You need to specify at least one input layer.'))
xMin = float(extent[0])
xMax = float(extent[1])
@@ -128,24 +171,27 @@ class TinInterpolationZValue(GeoAlgorithm):
yMax = float(extent[3])
bbox = QgsRectangle(xMin, yMin, xMax, yMax)
- layerData = QgsInterpolator.LayerData()
- layerData.vectorLayer = layer
- layerData.zCoordInterpolation = True
- layerData.interpolationAttribute = -1
-
- if layerType == 0:
- layerData.mInputType = QgsInterpolator.POINTS
- elif layerType == 1:
- layerData.mInputType = QgsInterpolator.STRUCTURE_LINES
- else:
- layerData.mInputType = QgsInterpolator.BREAK_LINES
+ layerData = []
+ for row in interpolationData.split(';'):
+ v = row.split(',')
+ data = QgsInterpolator.LayerData()
+ data.vectorLayer = dataobjects.getObjectFromUri(v[0])
+ data.zCoordInterpolation = bool(v[1])
+ data.interpolationAttribute = int(v[2])
+ if v[3] == '0':
+ data.mInputType = QgsInterpolator.POINTS
+ elif v[3] == '1':
+ data.mInputType = QgsInterpolator.STRUCTURE_LINES
+ else:
+ data.mInputType = QgsInterpolator.BREAK_LINES
+ layerData.append(data)
if method == 0:
interpolationMethod = QgsTINInterpolator.Linear
else:
interpolationMethod = QgsTINInterpolator.CloughTocher
- interpolator = QgsTINInterpolator([layerData], interpolationMethod)
+ interpolator = QgsTINInterpolator(layerData, interpolationMethod)
interpolator.setExportTriangulationToFile(True)
interpolator.setTriangulationFilePath(triangulation)
diff --git a/python/plugins/processing/algs/qgis/TinInterpolationAttribute.py b/python/plugins/processing/algs/qgis/TinInterpolationAttribute.py
deleted file mode 100644
index fdf4b30bda8..00000000000
--- a/python/plugins/processing/algs/qgis/TinInterpolationAttribute.py
+++ /dev/null
@@ -1,163 +0,0 @@
-# -*- coding: utf-8 -*-
-
-"""
-***************************************************************************
- TinInterpolationAttribute.py
- ---------------------
- Date : October 2016
- Copyright : (C) 2016 by Alexander Bruy
- Email : alexander dot bruy 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__ = 'Alexander Bruy'
-__date__ = 'October 2016'
-__copyright__ = '(C) 2016, Alexander Bruy'
-
-# This will get replaced with a git SHA1 when you do a git archive
-
-__revision__ = '$Format:%H$'
-
-import os
-
-from qgis.PyQt.QtGui import QIcon
-
-from qgis.core import QgsRectangle
-from qgis.analysis import (QgsInterpolator,
- QgsTINInterpolator,
- QgsGridFileWriter
- )
-
-from processing.core.GeoAlgorithm import GeoAlgorithm
-from processing.core.parameters import ParameterVector
-from processing.core.parameters import ParameterTableField
-from processing.core.parameters import ParameterSelection
-from processing.core.parameters import ParameterNumber
-from processing.core.parameters import ParameterExtent
-from processing.core.outputs import OutputRaster
-from processing.core.outputs import OutputVector
-from processing.tools import dataobjects
-
-pluginPath = os.path.split(os.path.split(os.path.dirname(__file__))[0])[0]
-
-
-class TinInterpolationAttribute(GeoAlgorithm):
-
- INPUT_LAYER = 'INPUT_LAYER'
- ATTRIBUTE = 'ATTRIBUTE'
- LAYER_TYPE = 'LAYER_TYPE'
- METHOD = 'METHOD'
- COLUMNS = 'COLUMNS'
- ROWS = 'ROWS'
- CELLSIZE_X = 'CELLSIZE_X'
- CELLSIZE_Y = 'CELLSIZE_Y'
- EXTENT = 'EXTENT'
- OUTPUT_LAYER = 'OUTPUT_LAYER'
- TRIANULATION_FILE = 'TRIANULATION_FILE'
-
- def getIcon(self):
- return QIcon(os.path.join(pluginPath, 'images', 'interpolation.png'))
-
- def defineCharacteristics(self):
- self.name, self.i18n_name = self.trAlgorithm('TIN interpolation (using attribute)')
- self.group, self.i18n_group = self.trAlgorithm('Interpolation')
-
- self.TYPES = [self.tr('Points'),
- self.tr('Structure lines'),
- self.tr('Break lines')
- ]
- self.METHODS = [self.tr('Linear'),
- self.tr('Clough-Toucher (cubic)')
- ]
-
- self.addParameter(ParameterVector(self.INPUT_LAYER,
- self.tr('Vector layer')))
- self.addParameter(ParameterTableField(self.ATTRIBUTE,
- self.tr('Interpolation attribute'),
- self.INPUT_LAYER,
- ParameterTableField.DATA_TYPE_NUMBER))
- self.addParameter(ParameterSelection(self.LAYER_TYPE,
- self.tr('Type'),
- self.TYPES,
- 0))
- self.addParameter(ParameterSelection(self.METHOD,
- self.tr('Interpolation method'),
- self.METHODS,
- 0))
- self.addParameter(ParameterNumber(self.COLUMNS,
- self.tr('Number of columns'),
- 0, 10000000, 300))
- self.addParameter(ParameterNumber(self.ROWS,
- self.tr('Number of rows'),
- 0, 10000000, 300))
- self.addParameter(ParameterNumber(self.CELLSIZE_X,
- self.tr('Cellsize X'),
- 0.0, 999999.000000, 0.0))
- self.addParameter(ParameterNumber(self.CELLSIZE_Y,
- self.tr('Cellsize Y'),
- 0.0, 999999.000000, 0.0))
- self.addParameter(ParameterExtent(self.EXTENT,
- self.tr('Extent')))
- self.addOutput(OutputRaster(self.OUTPUT_LAYER,
- self.tr('Interpolated')))
- self.addOutput(OutputVector(self.TRIANULATION_FILE,
- self.tr('Triangulation'),
- )) # datatype=dataobjects.TYPE_VECTOR_LINE))
-
- def processAlgorithm(self, progress):
- layer = dataobjects.getObjectFromUri(
- self.getParameterValue(self.INPUT_LAYER))
- fieldName = self.getParameterValue(self.ATTRIBUTE)
- layerType = self.getParameterValue(self.LAYER_TYPE)
- method = self.getParameterValue(self.METHOD)
- columns = self.getParameterValue(self.COLUMNS)
- rows = self.getParameterValue(self.ROWS)
- cellsizeX = self.getParameterValue(self.CELLSIZE_X)
- cellsizeY = self.getParameterValue(self.CELLSIZE_Y)
- extent = self.getParameterValue(self.EXTENT).split(',')
- output = self.getOutputValue(self.OUTPUT_LAYER)
- triangulation = self.getOutputValue(self.TRIANULATION_FILE)
-
- xMin = float(extent[0])
- xMax = float(extent[1])
- yMin = float(extent[2])
- yMax = float(extent[3])
- bbox = QgsRectangle(xMin, yMin, xMax, yMax)
-
- layerData = QgsInterpolator.LayerData()
- layerData.vectorLayer = layer
- layerData.zCoordInterpolation = False
- layerData.interpolationAttribute = layer.dataProvider().fieldNameIndex(fieldName)
-
- if layerType == 0:
- layerData.mInputType = QgsInterpolator.POINTS
- elif layerType == 1:
- layerData.mInputType = QgsInterpolator.STRUCTURE_LINES
- else:
- layerData.mInputType = QgsInterpolator.BREAK_LINES
-
- if method == 0:
- interpolationMethod = QgsTINInterpolator.Linear
- else:
- interpolationMethod = QgsTINInterpolator.CloughTocher
-
- interpolator = QgsTINInterpolator([layerData], interpolationMethod)
- interpolator.setExportTriangulationToFile(True)
- interpolator.setTriangulationFilePath(triangulation)
-
- writer = QgsGridFileWriter(interpolator,
- output,
- bbox,
- columns,
- rows,
- cellsizeX,
- cellsizeY)
-
- writer.writeFile()
diff --git a/python/plugins/processing/algs/qgis/TruncateTable.py b/python/plugins/processing/algs/qgis/TruncateTable.py
new file mode 100644
index 00000000000..4095678d69a
--- /dev/null
+++ b/python/plugins/processing/algs/qgis/TruncateTable.py
@@ -0,0 +1,59 @@
+# -*- coding: utf-8 -*-
+
+"""
+***************************************************************************
+ TruncateTable.py
+ -----------------------
+ Date : January 2017
+ Copyright : (C) 2017 by Nyall Dawson
+ Email : nyall dot dawson 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__ = 'Nyall Dawson'
+__date__ = 'January 2017'
+__copyright__ = '(C) 2017, Nyall Dawson'
+
+# This will get replaced with a git SHA1 when you do a git archive
+
+__revision__ = '$Format:%H$'
+
+from processing.core.GeoAlgorithm import GeoAlgorithm
+from processing.core.parameters import ParameterTable
+from processing.core.outputs import OutputVector
+from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
+from processing.tools import dataobjects
+
+
+class TruncateTable(GeoAlgorithm):
+
+ INPUT = 'INPUT'
+ OUTPUT = 'OUTPUT'
+
+ def defineCharacteristics(self):
+ self.name, self.i18n_name = self.trAlgorithm('Truncate table')
+ self.tags = self.tr('empty,delete,layer,clear,features')
+ self.group, self.i18n_group = self.trAlgorithm('Vector general tools')
+
+ self.addParameter(ParameterTable(self.INPUT,
+ self.tr('Input Layer')))
+ self.addOutput(OutputVector(self.OUTPUT,
+ self.tr('Truncated layer'), True))
+
+ def processAlgorithm(self, progress):
+ file_name = self.getParameterValue(self.INPUT)
+ layer = dataobjects.getObjectFromUri(file_name)
+ provider = layer.dataProvider()
+
+ if not provider.truncate():
+ raise GeoAlgorithmExecutionException(
+ self.tr('Could not truncate table.'))
+
+ self.setOutputValue(self.OUTPUT, file_name)
diff --git a/python/plugins/processing/algs/qgis/Union.py b/python/plugins/processing/algs/qgis/Union.py
index 6cca0ad4f14..2c980566768 100644
--- a/python/plugins/processing/algs/qgis/Union.py
+++ b/python/plugins/processing/algs/qgis/Union.py
@@ -161,9 +161,6 @@ class Union(GeoAlgorithm):
if len(lstIntersectingB) != 0:
intB = QgsGeometry.unaryUnion(lstIntersectingB)
diff_geom = diff_geom.difference(intB)
- if diff_geom.isGeosEmpty() or not diff_geom.isGeosValid():
- ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
- self.tr('GEOS geoprocessing error: One or more input features have invalid geometry.'))
if diff_geom.wkbType() == 0 or QgsWkbTypes.flatType(diff_geom.geometry().wkbType()) == QgsWkbTypes.GeometryCollection:
temp_list = diff_geom.asGeometryCollection()
@@ -214,9 +211,6 @@ class Union(GeoAlgorithm):
if engine.intersects(tmpGeom.geometry()):
add = True
diff_geom = QgsGeometry(diff_geom.difference(tmpGeom))
- if diff_geom.isGeosEmpty() or not diff_geom.isGeosValid():
- ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
- self.tr('GEOS geoprocessing error: One or more input features have invalid geometry.'))
else:
try:
# Ihis only happends if the bounding box
diff --git a/python/plugins/processing/algs/qgis/ui/FieldsCalculatorDialog.py b/python/plugins/processing/algs/qgis/ui/FieldsCalculatorDialog.py
index 63b71868791..b963c1b461e 100644
--- a/python/plugins/processing/algs/qgis/ui/FieldsCalculatorDialog.py
+++ b/python/plugins/processing/algs/qgis/ui/FieldsCalculatorDialog.py
@@ -95,9 +95,7 @@ class FieldsCalculatorDialog(BASE, WIDGET):
def initContext(self):
exp_context = self.builder.expressionContext()
- exp_context.appendScope(QgsExpressionContextUtils.globalScope())
- exp_context.appendScope(QgsExpressionContextUtils.projectScope())
- exp_context.appendScope(QgsExpressionContextUtils.layerScope(self.layer))
+ exp_context.appendScopes(QgsExpressionContextUtils.globalProjectLayerScopes(self.layer))
exp_context.lastScope().setVariable("row_number", 1)
exp_context.setHighlightedVariables(["row_number"])
self.builder.setExpressionContext(exp_context)
diff --git a/python/plugins/processing/algs/qgis/ui/InterpolationDataWidget.py b/python/plugins/processing/algs/qgis/ui/InterpolationDataWidget.py
new file mode 100644
index 00000000000..674019262c3
--- /dev/null
+++ b/python/plugins/processing/algs/qgis/ui/InterpolationDataWidget.py
@@ -0,0 +1,174 @@
+# -*- coding: utf-8 -*-
+
+"""
+***************************************************************************
+ InterpolationDataWidget.py
+ ---------------------
+ Date : December 2016
+ Copyright : (C) 2016 by Alexander Bruy
+ Email : alexander dot bruy 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__ = 'Alexander Bruy'
+__date__ = 'December 2016'
+__copyright__ = '(C) 2016, Alexander Bruy'
+
+# This will get replaced with a git SHA1 when you do a git archive
+
+__revision__ = '$Format:%H$'
+
+import os
+
+from qgis.PyQt import uic
+from qgis.PyQt.QtCore import pyqtSlot, QEvent
+from qgis.PyQt.QtGui import (QIcon,
+ QBrush,
+ QColor)
+from qgis.PyQt.QtWidgets import (QTreeWidgetItem,
+ QComboBox
+ )
+from qgis.core import (QgsApplication,
+ QgsMapLayer,
+ QgsMapLayerProxyModel,
+ QgsWkbTypes
+ )
+from qgis.gui import QgsFieldProxyModel
+from qgis.analysis import QgsInterpolator
+
+from processing.gui.wrappers import WidgetWrapper
+from processing.tools import dataobjects
+
+pluginPath = os.path.dirname(__file__)
+WIDGET, BASE = uic.loadUiType(os.path.join(pluginPath, 'interpolationdatawidgetbase.ui'))
+
+
+class InterpolationDataWidget(BASE, WIDGET):
+
+ def __init__(self):
+ super(InterpolationDataWidget, self).__init__(None)
+ self.setupUi(self)
+
+ self.btnAdd.setIcon(QgsApplication.getThemeIcon('/symbologyAdd.svg'))
+ self.btnRemove.setIcon(QgsApplication.getThemeIcon('/symbologyRemove.svg'))
+
+ self.cmbLayers.setFilters(QgsMapLayerProxyModel.VectorLayer)
+ self.cmbFields.setFilters(QgsFieldProxyModel.Numeric)
+ self.cmbFields.setLayer(self.cmbLayers.currentLayer())
+
+ #self.delegate = InterpolationTypeDelegate()
+ #self.layersTree.setItemDelegateForColumn(2, self.delegate)
+
+ @pyqtSlot()
+ def on_btnAdd_clicked(self):
+ layer = self.cmbLayers.currentLayer()
+
+ attribute = ''
+ if self.chkUseZCoordinate.isChecked():
+ attribute = 'Z_COORD'
+ else:
+ attribute = self.cmbFields.currentField()
+
+ self.addLayerData(layer.name(), attribute)
+
+ @pyqtSlot()
+ def on_btnRemove_clicked(self):
+ item = self.layersTree.currentItem()
+ if not item:
+ return
+ self.layersTree.invisibleRootItem().removeChild(item)
+
+ @pyqtSlot(QgsMapLayer)
+ def on_cmbLayers_layerChanged(self, layer):
+ self.chkUseZCoordinate.setEnabled(False)
+
+ if layer is None or not layer.isValid():
+ return
+
+ provider = layer.dataProvider()
+ if not provider:
+ return
+
+ if QgsWkbTypes.hasZ(provider.wkbType()):
+ self.chkUseZCoordinate.setEnabled(True)
+
+ self.cmbFields.setLayer(layer)
+
+ def addLayerData(self, layerName, attribute):
+ item = QTreeWidgetItem()
+ item.setText(0, layerName)
+ item.setText(1, attribute)
+ self.layersTree.addTopLevelItem(item)
+
+ comboBox = QComboBox()
+ comboBox.addItem(self.tr('Points'))
+ comboBox.addItem(self.tr('Structure lines'))
+ comboBox.addItem(self.tr('Break lines'))
+ comboBox.setCurrentIndex(0)
+ self.layersTree.setItemWidget(item, 2, comboBox)
+
+ def setValue(self, value):
+ self.layersTree.clear()
+ rows = value.split(';')
+ for i, r in enumerate(rows):
+ v = r.split(',')
+ self.addLayerData(v[0], v[1])
+
+ comboBox = self.layersTree.itemWidget(self.layersTree.topLevelItem(i), 2)
+ comboBox.setCurrentIndex(comboBox.findText(v[3]))
+
+ def value(self):
+ layers = ''
+ for i in range(self.layersTree.topLevelItemCount()):
+ item = self.layersTree.topLevelItem(i)
+ if item:
+ layerName = item.text(0)
+ layer = dataobjects.getObjectFromName(layerName)
+ if not layer:
+ continue
+
+ provider = layer.dataProvider()
+ if not provider:
+ continue
+
+ interpolationAttribute = item.text(1)
+ if interpolationAttribute == 'Z_COORD':
+ zCoord = True
+ fieldIndex = -1
+ else:
+ zCoord = False
+ fieldIndex = layer.fields().indexFromName(interpolationAttribute)
+
+ comboBox = self.layersTree.itemWidget(self.layersTree.topLevelItem(i), 2)
+ inputTypeName = comboBox.currentText()
+ if inputTypeName == self.tr('Points'):
+ inputType = QgsInterpolator.POINTS
+ elif inputTypeName == self.tr('Structure lines'):
+ inputType = QgsInterpolator.STRUCTURE_LINES
+ else:
+ inputType = QgsInterpolator.BREAK_LINES
+
+ layers += '{},{},{:d},{:d};'.format(layer.source(),
+ zCoord,
+ fieldIndex,
+ inputType)
+ return layers[:-1]
+
+
+class InterpolationDataWidgetWrapper(WidgetWrapper):
+
+ def createWidget(self):
+ return InterpolationDataWidget()
+
+ def setValue(self, value):
+ self.widget.setValue(value)
+
+ def value(self):
+ return self.widget.value()
diff --git a/python/plugins/processing/algs/qgis/ui/ReliefColorsWidget.py b/python/plugins/processing/algs/qgis/ui/ReliefColorsWidget.py
index 0f4956416c1..32584631250 100644
--- a/python/plugins/processing/algs/qgis/ui/ReliefColorsWidget.py
+++ b/python/plugins/processing/algs/qgis/ui/ReliefColorsWidget.py
@@ -38,7 +38,7 @@ from qgis.PyQt.QtWidgets import (QTreeWidgetItem,
QMessageBox,
QInputDialog,
QColorDialog
- )
+ )
from qgis.PyQt.QtXml import QDomDocument
from qgis.core import QgsApplication, QgsMapLayer
diff --git a/python/plugins/processing/algs/qgis/ui/interpolationdatawidgetbase.ui b/python/plugins/processing/algs/qgis/ui/interpolationdatawidgetbase.ui
new file mode 100644
index 00000000000..cdd91cea345
--- /dev/null
+++ b/python/plugins/processing/algs/qgis/ui/interpolationdatawidgetbase.ui
@@ -0,0 +1,130 @@
+
+
+ Form
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Form
+
+
+
+
+
+ Vector layer
+
+
+ cmbLayers
+
+
+
+
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+
+ Interpolation attribute
+
+
+ cmbFields
+
+
+
+
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+
+
+ Vector layer
+
+
+
+
+ Attribute
+
+
+
+
+ Type
+
+
+
+
+
+
+
+ Use Z-coordinate for interpolation
+
+
+
+
+
+
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+ ...
+
+
+
+
+
+
+ ...
+
+
+
+
+
+
+
+
+
+ QgsMapLayerComboBox
+ QComboBox
+ qgis.gui
+
+
+ QgsFieldComboBox
+ QComboBox
+ qgis.gui
+
+
+
+
+
diff --git a/python/plugins/processing/algs/saga/SagaAlgorithm212.py b/python/plugins/processing/algs/saga/SagaAlgorithm212.py
index b4b8787784d..86dab873853 100644
--- a/python/plugins/processing/algs/saga/SagaAlgorithm212.py
+++ b/python/plugins/processing/algs/saga/SagaAlgorithm212.py
@@ -293,7 +293,7 @@ class SagaAlgorithm212(GeoAlgorithm):
return commands
def getOutputCellsize(self):
- """Tries to guess the cellsize of the output, searching for
+ """Tries to guess the cell size of the output, searching for
a parameter with an appropriate name for it.
"""
diff --git a/python/plugins/processing/algs/saga/SagaAlgorithmProvider.py b/python/plugins/processing/algs/saga/SagaAlgorithmProvider.py
index 43dc6e0c06b..931b268f2f5 100644
--- a/python/plugins/processing/algs/saga/SagaAlgorithmProvider.py
+++ b/python/plugins/processing/algs/saga/SagaAlgorithmProvider.py
@@ -86,7 +86,7 @@ class SagaAlgorithmProvider(AlgorithmProvider):
def _loadAlgorithms(self):
self.algs = []
- version = SagaUtils.getSagaInstalledVersion(True)
+ version = SagaUtils.getInstalledVersion(True)
if version is None:
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
self.tr('Problem with SAGA installation: SAGA was not found or is not correctly installed'))
@@ -121,8 +121,8 @@ class SagaAlgorithmProvider(AlgorithmProvider):
self.tr('Could not open SAGA algorithm: %s\n%s' % (descriptionFile, str(e))))
def getDescription(self):
- version = SagaUtils.getSagaInstalledVersion()
- return 'SAGA (%s)' % version if version is not None else 'SAGA'
+ version = SagaUtils.getInstalledVersion()
+ return 'SAGA ({})'.format(version) if version is not None else 'SAGA'
def getName(self):
return 'saga'
diff --git a/python/plugins/processing/algs/saga/SagaUtils.py b/python/plugins/processing/algs/saga/SagaUtils.py
index 26d4251d2fc..5a83cb55ff5 100644
--- a/python/plugins/processing/algs/saga/SagaUtils.py
+++ b/python/plugins/processing/algs/saga/SagaUtils.py
@@ -72,7 +72,7 @@ def findSagaFolder():
def sagaPath():
folder = ProcessingConfig.getSetting(SAGA_FOLDER)
- if not os.path.isdir(folder):
+ if folder and not os.path.isdir(folder):
folder = None
ProcessingLog.addToLog(ProcessingLog.LOG_WARNING,
'Specified SAGA folder does not exist. Will try to find built-in binaries.')
@@ -112,7 +112,7 @@ _installedVersion = None
_installedVersionFound = False
-def getSagaInstalledVersion(runSaga=False):
+def getInstalledVersion(runSaga=False):
global _installedVersion
global _installedVersionFound
diff --git a/python/plugins/processing/core/AlgorithmProvider.py b/python/plugins/processing/core/AlgorithmProvider.py
index 386725b3721..f0ba71bafba 100644
--- a/python/plugins/processing/core/AlgorithmProvider.py
+++ b/python/plugins/processing/core/AlgorithmProvider.py
@@ -101,7 +101,7 @@ class AlgorithmProvider(object):
return self.tr('Generic algorithm provider')
def getIcon(self):
- return QIcon(os.path.dirname(__file__) + '/../images/alg.png')
+ return QIcon(os.path.dirname(__file__) + '/../images/alg.svg')
def getSupportedOutputRasterLayerExtensions(self):
return ['tif']
diff --git a/python/plugins/processing/core/GeoAlgorithm.py b/python/plugins/processing/core/GeoAlgorithm.py
index 96897e5c3a8..da8a56dd574 100644
--- a/python/plugins/processing/core/GeoAlgorithm.py
+++ b/python/plugins/processing/core/GeoAlgorithm.py
@@ -52,7 +52,7 @@ from processing.algs.help import shortHelp
class GeoAlgorithm(object):
def __init__(self):
- self._icon = QIcon(os.path.dirname(__file__) + '/../images/alg.png')
+ self._icon = QIcon(os.path.dirname(__file__) + '/../images/alg.svg')
# Parameters needed by the algorithm
self.parameters = list()
diff --git a/python/plugins/processing/core/Processing.py b/python/plugins/processing/core/Processing.py
index def9b6bd599..f920b8eb33c 100644
--- a/python/plugins/processing/core/Processing.py
+++ b/python/plugins/processing/core/Processing.py
@@ -57,7 +57,7 @@ from processing.modeler.ModelerAlgorithmProvider import ModelerAlgorithmProvider
from processing.algs.qgis.QGISAlgorithmProvider import QGISAlgorithmProvider
from processing.algs.grass7.Grass7AlgorithmProvider import Grass7AlgorithmProvider
from processing.algs.lidar.LidarToolsAlgorithmProvider import LidarToolsAlgorithmProvider
-from processing.algs.gdal.GdalOgrAlgorithmProvider import GdalOgrAlgorithmProvider
+from processing.algs.gdal.GdalAlgorithmProvider import GdalAlgorithmProvider
from processing.algs.otb.OTBAlgorithmProvider import OTBAlgorithmProvider
from processing.algs.r.RAlgorithmProvider import RAlgorithmProvider
from processing.algs.saga.SagaAlgorithmProvider import SagaAlgorithmProvider
diff --git a/python/plugins/processing/core/ProcessingConfig.py b/python/plugins/processing/core/ProcessingConfig.py
index 72254a87959..87067648adc 100644
--- a/python/plugins/processing/core/ProcessingConfig.py
+++ b/python/plugins/processing/core/ProcessingConfig.py
@@ -52,6 +52,7 @@ class ProcessingConfig(object):
VECTOR_POLYGON_STYLE = 'VECTOR_POLYGON_STYLE'
SHOW_RECENT_ALGORITHMS = 'SHOW_RECENT_ALGORITHMS'
USE_SELECTED = 'USE_SELECTED'
+ FILTER_INVALID_GEOMETRIES = 'FILTER_INVALID_GEOMETRIES'
USE_FILENAME_AS_LAYER_NAME = 'USE_FILENAME_AS_LAYER_NAME'
KEEP_DIALOG_OPEN = 'KEEP_DIALOG_OPEN'
SHOW_DEBUG_IN_DIALOG = 'SHOW_DEBUG_IN_DIALOG'
@@ -70,7 +71,7 @@ class ProcessingConfig(object):
@staticmethod
def initialize():
- icon = QIcon(os.path.dirname(__file__) + '/../images/alg.png')
+ icon = QIcon(os.path.dirname(__file__) + '/../images/alg.svg')
ProcessingConfig.settingIcons['General'] = icon
ProcessingConfig.addSetting(Setting(
ProcessingConfig.tr('General'),
@@ -84,6 +85,14 @@ class ProcessingConfig(object):
ProcessingConfig.tr('General'),
ProcessingConfig.USE_SELECTED,
ProcessingConfig.tr('Use only selected features'), True))
+ invalidFeaturesOptions = [ProcessingConfig.tr('Do not filter (better performance'),
+ ProcessingConfig.tr('Ignore features with invalid geometries'),
+ ProcessingConfig.tr('Stop algorithm execution when a geometry is invalid')]
+ ProcessingConfig.addSetting(Setting(
+ ProcessingConfig.tr('General'),
+ ProcessingConfig.FILTER_INVALID_GEOMETRIES,
+ ProcessingConfig.tr('Invalid features filtering'), invalidFeaturesOptions[2],
+ valuetype=Setting.SELECTION, options=invalidFeaturesOptions))
ProcessingConfig.addSetting(Setting(
ProcessingConfig.tr('General'),
ProcessingConfig.USE_FILENAME_AS_LAYER_NAME,
@@ -146,7 +155,7 @@ class ProcessingConfig(object):
ProcessingConfig.addSetting(Setting(
ProcessingConfig.tr('General'),
ProcessingConfig.RECENT_ALGORITHMS,
- ProcessingConfig.tr('Recent algs'), '', hidden=True))
+ ProcessingConfig.tr('Recent algorithms'), '', hidden=True))
extensions = processing.tools.dataobjects.getSupportedOutputVectorLayerExtensions()
ProcessingConfig.addSetting(Setting(
ProcessingConfig.tr('General'),
@@ -167,11 +176,11 @@ class ProcessingConfig(object):
@staticmethod
def getGroupIcon(group):
if group == ProcessingConfig.tr('General'):
- return QIcon(os.path.dirname(__file__) + '/../images/alg.png')
+ return QIcon(os.path.dirname(__file__) + '/../images/alg.svg')
if group in ProcessingConfig.settingIcons:
return ProcessingConfig.settingIcons[group]
else:
- return QIcon(os.path.dirname(__file__) + '/../images/alg.png')
+ return QIcon(os.path.dirname(__file__) + '/../images/alg.svg')
@staticmethod
def addSetting(setting):
@@ -289,16 +298,15 @@ class Setting(object):
self.validator(value)
self.value = value
- def read(self):
- qsettings = QSettings()
+ def read(self, qsettings=QSettings()):
value = qsettings.value(self.qname, None)
if value is not None:
if isinstance(self.value, bool):
value = str(value).lower() == str(True).lower()
self.value = value
- def save(self):
- QSettings().setValue(self.qname, self.value)
+ def save(self, qsettings=QSettings()):
+ qsettings.setValue(self.qname, self.value)
def __str__(self):
return self.name + '=' + str(self.value)
diff --git a/python/plugins/processing/core/outputs.py b/python/plugins/processing/core/outputs.py
index 57f30e569ed..b68427d65d1 100644
--- a/python/plugins/processing/core/outputs.py
+++ b/python/plugins/processing/core/outputs.py
@@ -38,13 +38,13 @@ from processing.tools.system import isWindows, getTempFilenameInTempFolder, getT
from processing.tools.vector import VectorWriter, TableWriter
from processing.tools import dataobjects
-from qgis.core import QgsExpressionContext, QgsExpressionContextUtils, QgsExpression, QgsExpressionContextScope
+from qgis.core import QgsExpressionContext, QgsExpressionContextUtils, QgsExpression, QgsExpressionContextScope, QgsProject
def _expressionContext(alg):
context = QgsExpressionContext()
context.appendScope(QgsExpressionContextUtils.globalScope())
- context.appendScope(QgsExpressionContextUtils.projectScope())
+ context.appendScope(QgsExpressionContextUtils.projectScope(QgsProject.instance()))
processingScope = QgsExpressionContextScope()
for param in alg.parameters:
processingScope.setVariable('%s_value' % param.name, '')
diff --git a/python/plugins/processing/core/parameters.py b/python/plugins/processing/core/parameters.py
index af31e227763..089bca31312 100644
--- a/python/plugins/processing/core/parameters.py
+++ b/python/plugins/processing/core/parameters.py
@@ -38,7 +38,8 @@ import numbers
from qgis.utils import iface
from qgis.PyQt.QtCore import QCoreApplication
from qgis.core import (QgsRasterLayer, QgsVectorLayer, QgsMapLayer, QgsCoordinateReferenceSystem,
- QgsExpressionContext, QgsExpressionContextUtils, QgsExpression, QgsExpressionContextScope)
+ QgsExpressionContext, QgsExpressionContextUtils, QgsExpression, QgsExpressionContextScope,
+ QgsProject)
from processing.tools.vector import resolveFieldIndex, features
from processing.tools import dataobjects
@@ -70,7 +71,7 @@ def _createDescriptiveName(s):
def _expressionContext():
context = QgsExpressionContext()
context.appendScope(QgsExpressionContextUtils.globalScope())
- context.appendScope(QgsExpressionContextUtils.projectScope())
+ context.appendScope(QgsExpressionContextUtils.projectScope(QgsProject.instance()))
if iface.mapCanvas():
context.appendScope(QgsExpressionContextUtils.mapSettingsScope(iface.mapCanvas().mapSettings()))
@@ -229,7 +230,9 @@ class ParameterBoolean(Parameter):
isOptional, name, definition = _splitParameterOptions(line)
if definition.startswith("boolean"):
descName = _createDescriptiveName(name)
- default = definition.strip()[len('boolean') + 1:]
+ default = definition.strip()[len('boolean') + 1:] or None
+ if default == 'None':
+ default = None
if default:
param = ParameterBoolean(name, descName, default)
else:
@@ -292,6 +295,8 @@ class ParameterCrs(Parameter):
if definition.startswith("crs"):
descName = _createDescriptiveName(name)
default = definition.strip()[len('crs') + 1:]
+ if default == 'None':
+ default = None
if default:
return ParameterCrs(name, descName, default, isOptional)
else:
@@ -574,7 +579,7 @@ class ParameterFixedTable(Parameter):
if definition.startswith("fixedtable"):
descName = _createDescriptiveName(name)
default = definition.strip()[len('fixedtable') + 1:] or None
- return ParameterFixedTable(name, descName, default, isOptional)
+ return ParameterFixedTable(name, descName, optional=isOptional)
class ParameterMultipleInput(ParameterDataObject):
@@ -1186,15 +1191,19 @@ class ParameterString(Parameter):
param_type = ''
if self.optional:
param_type += 'optional '
- param_type += 'string'
- return '##' + self.name + '=' + param_type + self.default
+ param_type += 'string '
+ return '##' + self.name + '=' + param_type + repr(self.default)
@classmethod
def fromScriptCode(self, line):
isOptional, name, definition = _splitParameterOptions(line)
descName = _createDescriptiveName(name)
if definition.lower().strip().startswith('string'):
- default = definition.strip()[len('string') + 1:]
+ default = definition.strip()[len('string') + 1:] or None
+ if default == 'None':
+ default = None
+ elif default.startswith('"') or default.startswith('\''):
+ default = eval(default)
if default:
return ParameterString(name, descName, default, optional=isOptional)
else:
@@ -1255,15 +1264,17 @@ class ParameterExpression(Parameter):
param_type = ''
if self.optional:
param_type += 'optional '
- param_type += 'expression'
- return '##' + self.name + '=' + param_type + self.default
+ param_type += 'expression '
+ return '##' + self.name + '=' + param_type + str(self.default)
@classmethod
def fromScriptCode(self, line):
isOptional, name, definition = _splitParameterOptions(line)
if definition.lower().strip().startswith('expression'):
descName = _createDescriptiveName(name)
- default = definition.strip()[len('expression') + 1:]
+ default = definition.strip()[len('expression') + 1:] or None
+ if default == 'None':
+ default = None
if default:
return ParameterExpression(name, descName, default, optional=isOptional)
else:
@@ -1413,7 +1424,7 @@ class ParameterTableField(Parameter):
if self.optional:
param_type += 'optional '
param_type += 'field'
- return '##' + self.name + '=' + param_type + self.parent
+ return '##' + self.name + '=' + param_type + str(self.parent)
@classmethod
def fromScriptCode(self, line):
@@ -1559,5 +1570,5 @@ def getParameterFromString(s):
param = paramClass.fromScriptCode(s)
if param is not None:
return param
- except AttributeError:
+ except:
pass
diff --git a/python/plugins/processing/gui/BatchPanel.py b/python/plugins/processing/gui/BatchPanel.py
index 1f0cf3410bd..eb5ccbb399a 100644
--- a/python/plugins/processing/gui/BatchPanel.py
+++ b/python/plugins/processing/gui/BatchPanel.py
@@ -73,7 +73,7 @@ class BatchPanel(BASE, WIDGET):
self.btnRemove.setIcon(QgsApplication.getThemeIcon('/symbologyRemove.svg'))
self.btnOpen.setIcon(QgsApplication.getThemeIcon('/mActionFileOpen.svg'))
self.btnSave.setIcon(QgsApplication.getThemeIcon('/mActionFileSave.svg'))
- self.btnAdvanced.setIcon(QIcon(os.path.join(pluginPath, 'images', 'alg.png')))
+ self.btnAdvanced.setIcon(QIcon(os.path.join(pluginPath, 'images', 'alg.svg')))
self.alg = alg
self.parent = parent
diff --git a/python/plugins/processing/gui/ConfigDialog.py b/python/plugins/processing/gui/ConfigDialog.py
index d4d96578c03..9c29afd1b0d 100644
--- a/python/plugins/processing/gui/ConfigDialog.py
+++ b/python/plugins/processing/gui/ConfigDialog.py
@@ -30,8 +30,7 @@ __revision__ = '$Format:%H$'
import os
from qgis.PyQt import uic
-from qgis.PyQt.QtCore import (Qt,
- QEvent)
+from qgis.PyQt.QtCore import Qt, QEvent, QSettings
from qgis.PyQt.QtWidgets import (QFileDialog,
QDialog,
QStyle,
@@ -160,7 +159,7 @@ class ConfigDialog(BASE, WIDGET):
Filter 'Providers' items
"""
providersItem = QStandardItem(self.tr('Providers'))
- icon = QIcon(os.path.join(pluginPath, 'images', 'alg.png'))
+ icon = QIcon(os.path.join(pluginPath, 'images', 'alg.svg'))
providersItem.setIcon(icon)
providersItem.setEditable(False)
emptyItem = QStandardItem()
@@ -266,6 +265,7 @@ class ConfigDialog(BASE, WIDGET):
def accept(self):
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
+ qsettings = QSettings()
for setting in list(self.items.keys()):
if setting.group != menusSettingsGroup or self.saveMenus:
if isinstance(setting.value, bool):
@@ -277,7 +277,7 @@ class ConfigDialog(BASE, WIDGET):
QMessageBox.warning(self, self.tr('Wrong value'),
self.tr('Wrong value for parameter "%s":\n\n%s' % (setting.description, str(e))))
return
- setting.save()
+ setting.save(qsettings)
Processing.updateAlgsList()
settingsWatcher.settingsChanged.emit()
QApplication.restoreOverrideCursor()
diff --git a/python/plugins/processing/gui/CreateNewScriptAction.py b/python/plugins/processing/gui/CreateNewScriptAction.py
index e3df462f87a..0c0c92ef1b8 100644
--- a/python/plugins/processing/gui/CreateNewScriptAction.py
+++ b/python/plugins/processing/gui/CreateNewScriptAction.py
@@ -49,7 +49,7 @@ class CreateNewScriptAction(ToolboxAction):
def getIcon(self):
if self.scriptType == self.SCRIPT_PYTHON:
- return QIcon(os.path.join(pluginPath, 'images', 'script.png'))
+ return QIcon(os.path.join(pluginPath, 'images', 'script.svg'))
elif self.scriptType == self.SCRIPT_R:
return QIcon(os.path.join(pluginPath, 'images', 'r.svg'))
diff --git a/python/plugins/processing/gui/GetScriptsAndModels.py b/python/plugins/processing/gui/GetScriptsAndModels.py
index d1adb7d27df..662904a9f25 100644
--- a/python/plugins/processing/gui/GetScriptsAndModels.py
+++ b/python/plugins/processing/gui/GetScriptsAndModels.py
@@ -62,7 +62,7 @@ class GetScriptsAction(ToolboxAction):
self.group, self.i18n_group = self.trAction('Tools')
def getIcon(self):
- return QIcon(os.path.join(pluginPath, 'images', 'script.png'))
+ return QIcon(os.path.join(pluginPath, 'images', 'script.svg'))
def execute(self):
dlg = GetScriptsAndModelsDialog(GetScriptsAndModelsDialog.SCRIPTS)
@@ -94,7 +94,7 @@ class GetModelsAction(ToolboxAction):
self.group, self.i18n_group = self.trAction('Tools')
def getIcon(self):
- return QIcon(os.path.join(pluginPath, 'images', 'model.png'))
+ return QIcon(os.path.join(pluginPath, 'images', 'model.svg'))
def execute(self):
dlg = GetScriptsAndModelsDialog(GetScriptsAndModelsDialog.MODELS)
@@ -137,11 +137,11 @@ class GetScriptsAndModelsDialog(BASE, WIDGET):
if self.resourceType == self.MODELS:
self.folder = ModelerUtils.modelsFolders()[0]
self.urlBase = 'https://raw.githubusercontent.com/qgis/QGIS-Processing/master/models/'
- self.icon = QIcon(os.path.join(pluginPath, 'images', 'model.png'))
+ self.icon = QIcon(os.path.join(pluginPath, 'images', 'model.svg'))
elif self.resourceType == self.SCRIPTS:
self.folder = ScriptUtils.scriptsFolders()[0]
self.urlBase = 'https://raw.githubusercontent.com/qgis/QGIS-Processing/master/scripts/'
- self.icon = QIcon(os.path.join(pluginPath, 'images', 'script.png'))
+ self.icon = QIcon(os.path.join(pluginPath, 'images', 'script.svg'))
else:
self.folder = RUtils.RScriptsFolders()[0]
self.urlBase = 'https://raw.githubusercontent.com/qgis/QGIS-Processing/master/rscripts/'
diff --git a/python/plugins/processing/gui/ParametersPanel.py b/python/plugins/processing/gui/ParametersPanel.py
index ff3d80353a5..6ed71ba4177 100644
--- a/python/plugins/processing/gui/ParametersPanel.py
+++ b/python/plugins/processing/gui/ParametersPanel.py
@@ -123,15 +123,24 @@ class ParametersPanel(BASE, WIDGET):
tooltips = self.alg.getParameterDescriptions()
widget.setToolTip(tooltips.get(param.name, param.description))
- label = QLabel(desc)
- # label.setToolTip(tooltip)
- self.labels[param.name] = label
+ if type(widget) is QCheckBox:
+ # checkbox widget - so description is embedded in widget rather than a separate
+ # label
+ widget.setText(desc)
+ else:
+ label = QLabel(desc)
+ # label.setToolTip(tooltip)
+ self.labels[param.name] = label
+
+ if param.isAdvanced:
+ self.layoutAdvanced.addWidget(label)
+ else:
+ self.layoutMain.insertWidget(
+ self.layoutMain.count() - 2, label)
+
if param.isAdvanced:
- self.layoutAdvanced.addWidget(label)
self.layoutAdvanced.addWidget(widget)
else:
- self.layoutMain.insertWidget(
- self.layoutMain.count() - 2, label)
self.layoutMain.insertWidget(
self.layoutMain.count() - 2, widget)
diff --git a/python/plugins/processing/gui/ToolboxAction.py b/python/plugins/processing/gui/ToolboxAction.py
index 55b91ada024..7c4201950ac 100644
--- a/python/plugins/processing/gui/ToolboxAction.py
+++ b/python/plugins/processing/gui/ToolboxAction.py
@@ -37,7 +37,7 @@ class ToolboxAction(object):
self.toolbox = toolbox
def getIcon(self):
- return QIcon(os.path.dirname(__file__) + '/../images/alg.png')
+ return QIcon(os.path.dirname(__file__) + '/../images/alg.svg')
def tr(self, string, context=''):
if context == '':
diff --git a/python/plugins/processing/gui/algnames.txt b/python/plugins/processing/gui/algnames.txt
index 9e63d4d06c9..740ca635e5c 100644
--- a/python/plugins/processing/gui/algnames.txt
+++ b/python/plugins/processing/gui/algnames.txt
@@ -1,20 +1,20 @@
-gdalogr:executesql,Execute SQL on vector layer
-gdalogr:rasterinfo,Raster layer information
-gdalogr:merge,Merge raster layers
-gdalogr:ogr2ogr,Export vector layer
-gdalogr:vectorinfo,Vector layer information
-gdalogr:pcttorgb,PCT to RGB
-gdalogr:rgbtopct,RGB to PCT
-gdalogr:sieve,Remove small pixel clumps (nearest neighbour)
-gdalogr:translate,Export raster layer
-gdalogr:warpreproject,Reproject raster layer
-gdalogr:polygonize,Vectorize raster layer
-gdalogr:gridrasterize,Rasterize vector layer
-gdalogr:gridnearestneighbor,Interpolate (Nearest Neighbor)
-gdalogr:griddatametrics,Interpolate (Data metrics)
-gdalogr:gridinvdist,Interpolate (Inverse distance weighting)
-gdalogr:gridaverage,Interpolate (Average)
-gdalogr:contour,Contour lines
+gdal:executesql,Execute SQL on vector layer
+gdal:rasterinfo,Raster layer information
+gdal:merge,Merge raster layers
+gdal:ogr2ogr,Export vector layer
+gdal:vectorinfo,Vector layer information
+gdal:pcttorgb,PCT to RGB
+gdal:rgbtopct,RGB to PCT
+gdal:sieve,Remove small pixel clumps (nearest neighbour)
+gdal:translate,Export raster layer
+gdal:warpreproject,Reproject raster layer
+gdal:polygonize,Vectorize raster layer
+gdal:gridrasterize,Rasterize vector layer
+gdal:gridnearestneighbor,Interpolate (Nearest Neighbor)
+gdal:griddatametrics,Interpolate (Data metrics)
+gdal:gridinvdist,Interpolate (Inverse distance weighting)
+gdal:gridaverage,Interpolate (Average)
+gdal:contour,Contour lines
qgis:creategrid,Create graticule
saga:changegridvalues,Reclassify (simple)
saga:creategraticule,Create graticule from extent
diff --git a/python/plugins/processing/gui/menus.py b/python/plugins/processing/gui/menus.py
index bab75d27df6..364790f0b04 100644
--- a/python/plugins/processing/gui/menus.py
+++ b/python/plugins/processing/gui/menus.py
@@ -70,44 +70,44 @@ defaultMenuEntries.update({'qgis:definecurrentprojection': managementToolsMenu,
'qgis:splitvectorlayer': managementToolsMenu,
'qgis:mergevectorlayers': managementToolsMenu,
'qgis:createspatialindex': managementToolsMenu})
-"""
+
rasterMenu = Processing.tr('&Raster')
projectionsMenu = rasterMenu + "/" + Processing.tr('Projections')
-defaultMenuEntries.update({'gdalogr:warpreproject':projectionsMenu,
- 'gdalogr:assignprojection':projectionsMenu,
- 'gdalogr:extractprojection':projectionsMenu})
+defaultMenuEntries.update({'gdal:warpreproject': projectionsMenu,
+ 'gdal:assignprojection': projectionsMenu,
+ 'gdal:extractprojection': projectionsMenu})
conversionMenu = rasterMenu + "/" + Processing.tr('Conversion')
-defaultMenuEntries.update({'gdalogr:rasterize':conversionMenu,
- 'gdalogr:rasterize_over':conversionMenu,
- 'gdalogr:polygonize':conversionMenu,
- 'gdalogr:translate':conversionMenu,
- 'gdalogr:rgbtopct':conversionMenu,
- 'gdalogr:pcttorgb':conversionMenu})
+defaultMenuEntries.update({'gdal:rasterize': conversionMenu,
+ 'gdal:rasterize_over': conversionMenu,
+ 'gdal:polygonize': conversionMenu,
+ 'gdal:translate': conversionMenu,
+ 'gdal:rgbtopct': conversionMenu,
+ 'gdal:pcttorgb': conversionMenu})
extractionMenu = rasterMenu + "/" + Processing.tr('Extraction')
-defaultMenuEntries.update({'gdalogr:contour':extractionMenu,
- 'gdalogr:cliprasterbyextent':extractionMenu,
- 'gdalogr:cliprasterbymasklayer':extractionMenu})
+defaultMenuEntries.update({'gdal:contour': extractionMenu,
+ 'gdal:cliprasterbyextent': extractionMenu,
+ 'gdal:cliprasterbymasklayer': extractionMenu})
analysisMenu = rasterMenu + "/" + Processing.tr('Analysis')
-defaultMenuEntries.update({'gdalogr:sieve':analysisMenu, 'gdalogr:nearblack':analysisMenu,
- 'gdalogr:fillnodata':analysisMenu,
- 'gdalogr:proximity':analysisMenu,
- 'gdalogr:griddatametrics':analysisMenu,
- 'gdalogr:gridaverage':analysisMenu,
- 'gdalogr:gridinvdist':analysisMenu,
- 'gdalogr:gridnearestneighbor':analysisMenu,
- 'gdalogr:aspect':analysisMenu,
- 'gdalogr:hillshade':analysisMenu,
- 'gdalogr:roughness':analysisMenu,
- 'gdalogr:slope':analysisMenu,
- 'gdalogr:tpi':analysisMenu,
- 'gdalogr:tri':analysisMenu})
+defaultMenuEntries.update({'gdal:sieve': analysisMenu,
+ 'gdal:nearblack': analysisMenu,
+ 'gdal:fillnodata': analysisMenu,
+ 'gdal:proximity': analysisMenu,
+ 'gdal:griddatametrics': analysisMenu,
+ 'gdal:gridaverage': analysisMenu,
+ 'gdal:gridinvdist': analysisMenu,
+ 'gdal:gridnearestneighbor': analysisMenu,
+ 'gdal:aspect': analysisMenu,
+ 'gdal:hillshade': analysisMenu,
+ 'gdal:roughness': analysisMenu,
+ 'gdal:slope': analysisMenu,
+ 'gdal:tpi': analysisMenu,
+ 'gdal:tri': analysisMenu})
miscMenu = rasterMenu + "/" + Processing.tr('Miscellaneous')
-defaultMenuEntries.update({'gdalogr:buildvirtualraster':miscMenu,
- 'gdalogr:merge':miscMenu,
- 'gdalogr:rasterinfo':miscMenu,
- 'gdalogr:overviews':miscMenu,
- 'gdalogr:tileindex':miscMenu})
-"""
+defaultMenuEntries.update({'gdal:buildvirtualraster': miscMenu,
+ 'gdal:merge': miscMenu,
+ 'gdal:rasterinfo': miscMenu,
+ 'gdal:overviews': miscMenu,
+ 'gdal:tileindex': miscMenu})
def initializeMenus():
diff --git a/python/plugins/processing/images/alg.png b/python/plugins/processing/images/alg.png
deleted file mode 100644
index d90ab661cbb..00000000000
Binary files a/python/plugins/processing/images/alg.png and /dev/null differ
diff --git a/python/plugins/processing/images/alg.svg b/python/plugins/processing/images/alg.svg
new file mode 100644
index 00000000000..f891c284c52
--- /dev/null
+++ b/python/plugins/processing/images/alg.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/python/plugins/processing/images/commander.png b/python/plugins/processing/images/commander.png
deleted file mode 100644
index 73969b9fa0b..00000000000
Binary files a/python/plugins/processing/images/commander.png and /dev/null differ
diff --git a/python/plugins/processing/images/commander.svg b/python/plugins/processing/images/commander.svg
new file mode 100644
index 00000000000..5f1b2765b05
--- /dev/null
+++ b/python/plugins/processing/images/commander.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/python/plugins/processing/images/config.png b/python/plugins/processing/images/config.png
deleted file mode 100644
index 9460dfc746b..00000000000
Binary files a/python/plugins/processing/images/config.png and /dev/null differ
diff --git a/python/plugins/processing/images/delete.png b/python/plugins/processing/images/delete.png
deleted file mode 100644
index dbe7a52cbe4..00000000000
Binary files a/python/plugins/processing/images/delete.png and /dev/null differ
diff --git a/python/plugins/processing/images/delete.svg b/python/plugins/processing/images/delete.svg
new file mode 100644
index 00000000000..6c1a09a1ca6
--- /dev/null
+++ b/python/plugins/processing/images/delete.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/python/plugins/processing/images/edit.png b/python/plugins/processing/images/edit.png
deleted file mode 100644
index 04b9ef6648b..00000000000
Binary files a/python/plugins/processing/images/edit.png and /dev/null differ
diff --git a/python/plugins/processing/images/edit.svg b/python/plugins/processing/images/edit.svg
new file mode 100644
index 00000000000..cc9af01b02b
--- /dev/null
+++ b/python/plugins/processing/images/edit.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/python/plugins/processing/images/history.gif b/python/plugins/processing/images/history.gif
deleted file mode 100644
index f5eb471895c..00000000000
Binary files a/python/plugins/processing/images/history.gif and /dev/null differ
diff --git a/python/plugins/processing/images/history.svg b/python/plugins/processing/images/history.svg
new file mode 100644
index 00000000000..44c0ad35952
--- /dev/null
+++ b/python/plugins/processing/images/history.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/python/plugins/processing/images/input.png b/python/plugins/processing/images/input.png
deleted file mode 100644
index 1aa7f095c6c..00000000000
Binary files a/python/plugins/processing/images/input.png and /dev/null differ
diff --git a/python/plugins/processing/images/input.svg b/python/plugins/processing/images/input.svg
new file mode 100644
index 00000000000..42fec177554
--- /dev/null
+++ b/python/plugins/processing/images/input.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/python/plugins/processing/images/minus.png b/python/plugins/processing/images/minus.png
deleted file mode 100644
index a6d648fac17..00000000000
Binary files a/python/plugins/processing/images/minus.png and /dev/null differ
diff --git a/python/plugins/processing/images/minus.svg b/python/plugins/processing/images/minus.svg
new file mode 100644
index 00000000000..1cc42c97ce5
--- /dev/null
+++ b/python/plugins/processing/images/minus.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/python/plugins/processing/images/model.png b/python/plugins/processing/images/model.png
deleted file mode 100644
index 0a96a7d7825..00000000000
Binary files a/python/plugins/processing/images/model.png and /dev/null differ
diff --git a/python/plugins/processing/images/model.svg b/python/plugins/processing/images/model.svg
new file mode 100644
index 00000000000..961ce92eb98
--- /dev/null
+++ b/python/plugins/processing/images/model.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/python/plugins/processing/images/output.png b/python/plugins/processing/images/output.png
deleted file mode 100644
index c824d563898..00000000000
Binary files a/python/plugins/processing/images/output.png and /dev/null differ
diff --git a/python/plugins/processing/images/output.svg b/python/plugins/processing/images/output.svg
new file mode 100644
index 00000000000..b11d50657b8
--- /dev/null
+++ b/python/plugins/processing/images/output.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/python/plugins/processing/images/plus.png b/python/plugins/processing/images/plus.png
deleted file mode 100644
index 71cd64a54f1..00000000000
Binary files a/python/plugins/processing/images/plus.png and /dev/null differ
diff --git a/python/plugins/processing/images/plus.svg b/python/plugins/processing/images/plus.svg
new file mode 100644
index 00000000000..eeb05d1a95d
--- /dev/null
+++ b/python/plugins/processing/images/plus.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/python/plugins/processing/images/results.png b/python/plugins/processing/images/results.png
deleted file mode 100644
index 6f47415f512..00000000000
Binary files a/python/plugins/processing/images/results.png and /dev/null differ
diff --git a/python/plugins/processing/images/results.svg b/python/plugins/processing/images/results.svg
new file mode 100644
index 00000000000..4c2b3d0036d
--- /dev/null
+++ b/python/plugins/processing/images/results.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/python/plugins/processing/images/script.png b/python/plugins/processing/images/script.png
deleted file mode 100644
index c5b797a7dfe..00000000000
Binary files a/python/plugins/processing/images/script.png and /dev/null differ
diff --git a/python/plugins/processing/images/script.svg b/python/plugins/processing/images/script.svg
new file mode 100644
index 00000000000..6fb50b66347
--- /dev/null
+++ b/python/plugins/processing/images/script.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/python/plugins/processing/metadata.txt b/python/plugins/processing/metadata.txt
index 9ad3b4b9146..54aff9d8586 100644
--- a/python/plugins/processing/metadata.txt
+++ b/python/plugins/processing/metadata.txt
@@ -9,8 +9,8 @@ qgisMinimumVersion=2.13
author=Victor Olaya
email=volayaf@gmail.com
-icon=images/alg.png
+icon=images/alg.svg
homepage=http://qgis.org
tracker=https://hub.qgis.org/projects/quantum-gis/issues
-repository=https://github.com/qgis/QGIS
\ No newline at end of file
+repository=https://github.com/qgis/QGIS
diff --git a/python/plugins/processing/modeler/AddModelFromFileAction.py b/python/plugins/processing/modeler/AddModelFromFileAction.py
index 2909c98703e..3b83fd8d13b 100644
--- a/python/plugins/processing/modeler/AddModelFromFileAction.py
+++ b/python/plugins/processing/modeler/AddModelFromFileAction.py
@@ -46,7 +46,7 @@ class AddModelFromFileAction(ToolboxAction):
self.group, self.i18n_group = self.trAction('Tools')
def getIcon(self):
- return QIcon(os.path.join(pluginPath, 'images', 'model.png'))
+ return QIcon(os.path.join(pluginPath, 'images', 'model.svg'))
def execute(self):
settings = QSettings()
diff --git a/python/plugins/processing/modeler/CreateNewModelAction.py b/python/plugins/processing/modeler/CreateNewModelAction.py
index 345570818f1..2639e7133eb 100644
--- a/python/plugins/processing/modeler/CreateNewModelAction.py
+++ b/python/plugins/processing/modeler/CreateNewModelAction.py
@@ -41,7 +41,7 @@ class CreateNewModelAction(ToolboxAction):
self.group, self.i18n_group = self.trAction('Tools')
def getIcon(self):
- return QIcon(os.path.join(pluginPath, 'images', 'model.png'))
+ return QIcon(os.path.join(pluginPath, 'images', 'model.svg'))
def execute(self):
dlg = ModelerDialog()
diff --git a/python/plugins/processing/modeler/ModelerAlgorithm.py b/python/plugins/processing/modeler/ModelerAlgorithm.py
index 98a80448520..e327250d5f1 100644
--- a/python/plugins/processing/modeler/ModelerAlgorithm.py
+++ b/python/plugins/processing/modeler/ModelerAlgorithm.py
@@ -263,7 +263,7 @@ class ModelerAlgorithm(GeoAlgorithm):
GeoAlgorithm.__init__(self)
def getIcon(self):
- return QIcon(os.path.join(pluginPath, 'images', 'model.png'))
+ return QIcon(os.path.join(pluginPath, 'images', 'model.svg'))
def defineCharacteristics(self):
classes = [ParameterRaster, ParameterVector, ParameterTable, ParameterTableField,
@@ -507,6 +507,15 @@ class ModelerAlgorithm(GeoAlgorithm):
t0 = time.time()
alg.algorithm.execute(progress, self)
dt = time.time() - t0
+
+ # copy algorithm output value(s) back to model in case the algorithm modified those
+ for out in alg.algorithm.outputs:
+ if not out.hidden:
+ if out.name in alg.outputs:
+ modelOut = self.getOutputFromName(self.getSafeNameForOutput(alg.name, out.name))
+ if modelOut:
+ modelOut.value = out.value
+
executed.append(alg.name)
progress.setDebugInfo(
self.tr('OK. Execution took %0.3f ms (%i outputs).', 'ModelerAlgorithm') % (dt, len(alg.algorithm.outputs)))
diff --git a/python/plugins/processing/modeler/ModelerAlgorithmProvider.py b/python/plugins/processing/modeler/ModelerAlgorithmProvider.py
index bf8af0bce48..4ad13ddc812 100644
--- a/python/plugins/processing/modeler/ModelerAlgorithmProvider.py
+++ b/python/plugins/processing/modeler/ModelerAlgorithmProvider.py
@@ -67,7 +67,7 @@ class ModelerAlgorithmProvider(AlgorithmProvider):
return 'model'
def getIcon(self):
- return QIcon(os.path.join(pluginPath, 'images', 'model.png'))
+ return QIcon(os.path.join(pluginPath, 'images', 'model.svg'))
def _loadAlgorithms(self):
folders = ModelerUtils.modelsFolders()
diff --git a/python/plugins/processing/modeler/ModelerDialog.py b/python/plugins/processing/modeler/ModelerDialog.py
index d337da8fb09..21af69f2602 100644
--- a/python/plugins/processing/modeler/ModelerDialog.py
+++ b/python/plugins/processing/modeler/ModelerDialog.py
@@ -31,9 +31,11 @@ import sys
import os
from qgis.PyQt import uic
-from qgis.PyQt.QtCore import Qt, QRectF, QMimeData, QPoint, QPointF, QSettings, QByteArray, QSize, pyqtSignal
-from qgis.PyQt.QtWidgets import QGraphicsView, QTreeWidget, QMessageBox, QFileDialog, QTreeWidgetItem, QSizePolicy, QMainWindow
-from qgis.PyQt.QtGui import QIcon, QImage, QPainter
+from qgis.PyQt.QtCore import Qt, QRectF, QMimeData, QPoint, QPointF, QSettings, QByteArray, QSize, QSizeF, pyqtSignal
+from qgis.PyQt.QtWidgets import QGraphicsView, QTreeWidget, QMessageBox, QFileDialog, QTreeWidgetItem, QSizePolicy, QMainWindow, QShortcut
+from qgis.PyQt.QtGui import QIcon, QImage, QPainter, QKeySequence
+from qgis.PyQt.QtSvg import QSvgGenerator
+from qgis.PyQt.QtPrintSupport import QPrinter
from qgis.core import QgsApplication
from qgis.gui import QgsMessageBar
from processing.core.ProcessingConfig import ProcessingConfig
@@ -207,12 +209,22 @@ class ModelerDialog(BASE, WIDGET):
self.searchBox.textChanged.connect(self.fillAlgorithmTree)
self.algorithmTree.doubleClicked.connect(self.addAlgorithm)
+ # Ctrl+= should also trigger a zoom in action
+ ctrlEquals = QShortcut(QKeySequence("Ctrl+="), self)
+ ctrlEquals.activated.connect(self.zoomIn)
+
iconSize = settings.value("iconsize", 24)
self.mToolbar.setIconSize(QSize(iconSize, iconSize))
self.mActionOpen.triggered.connect(self.openModel)
self.mActionSave.triggered.connect(self.save)
self.mActionSaveAs.triggered.connect(self.saveAs)
+ self.mActionZoomIn.triggered.connect(self.zoomIn)
+ self.mActionZoomOut.triggered.connect(self.zoomOut)
+ self.mActionZoomActual.triggered.connect(self.zoomActual)
+ self.mActionZoomToItems.triggered.connect(self.zoomToItems)
self.mActionExportImage.triggered.connect(self.exportAsImage)
+ self.mActionExportPdf.triggered.connect(self.exportAsPdf)
+ self.mActionExportSvg.triggered.connect(self.exportAsSvg)
self.mActionExportPython.triggered.connect(self.exportAsPython)
self.mActionEditHelp.triggered.connect(self.editHelp)
self.mActionRun.triggered.connect(self.runModel)
@@ -286,7 +298,41 @@ class ModelerDialog(BASE, WIDGET):
def saveAs(self):
self.saveModel(True)
+ def zoomIn(self):
+ self.view.setTransformationAnchor(QGraphicsView.NoAnchor)
+ point = self.view.mapToScene(QPoint(self.view.viewport().width() / 2, self.view.viewport().height() / 2))
+
+ settings = QSettings()
+ factor = settings.value('/qgis/zoom_favor', 2.0)
+
+ self.view.scale(factor, factor)
+ self.view.centerOn(point)
+ self.repaintModel()
+
+ def zoomOut(self):
+ self.view.setTransformationAnchor(QGraphicsView.NoAnchor)
+ point = self.view.mapToScene(QPoint(self.view.viewport().width() / 2, self.view.viewport().height() / 2))
+
+ settings = QSettings()
+ factor = settings.value('/qgis/zoom_favor', 2.0)
+ factor = 1 / factor
+
+ self.view.scale(factor, factor)
+ self.view.centerOn(point)
+ self.repaintModel()
+
+ def zoomActual(self):
+ point = self.view.mapToScene(QPoint(self.view.viewport().width() / 2, self.view.viewport().height() / 2))
+ self.view.resetTransform()
+ self.view.centerOn(point)
+
+ def zoomToItems(self):
+ totalRect = self.scene.itemsBoundingRect()
+ totalRect.adjust(-10, -10, 10, 10)
+ self.view.fitInView(totalRect, Qt.KeepAspectRatio)
+
def exportAsImage(self):
+ self.repaintModel(controls=False)
filename, fileFilter = QFileDialog.getSaveFileName(self,
self.tr('Save Model As Image'), '',
self.tr('PNG files (*.png *.PNG)'))
@@ -296,10 +342,9 @@ class ModelerDialog(BASE, WIDGET):
if not filename.lower().endswith('.png'):
filename += '.png'
- totalRect = QRectF(0, 0, 1, 1)
- for item in list(self.scene.items()):
- totalRect = totalRect.united(item.sceneBoundingRect())
+ totalRect = self.scene.itemsBoundingRect()
totalRect.adjust(-10, -10, 10, 10)
+ imgRect = QRectF(0, 0, totalRect.width(), totalRect.height())
img = QImage(totalRect.width(), totalRect.height(),
QImage.Format_ARGB32_Premultiplied)
@@ -307,12 +352,69 @@ class ModelerDialog(BASE, WIDGET):
painter = QPainter()
painter.setRenderHint(QPainter.Antialiasing)
painter.begin(img)
- self.scene.render(painter, totalRect, totalRect)
+ self.scene.render(painter, imgRect, totalRect)
painter.end()
img.save(filename)
self.bar.pushMessage("", "Model was correctly exported as image", level=QgsMessageBar.SUCCESS, duration=5)
+ self.repaintModel(controls=True)
+
+ def exportAsPdf(self):
+ self.repaintModel(controls=False)
+ filename, fileFilter = QFileDialog.getSaveFileName(self,
+ self.tr('Save Model As PDF'), '',
+ self.tr('SVG files (*.pdf *.PDF)'))
+ if not filename:
+ return
+
+ if not filename.lower().endswith('.pdf'):
+ filename += '.pdf'
+
+ totalRect = self.scene.itemsBoundingRect()
+ totalRect.adjust(-10, -10, 10, 10)
+ printerRect = QRectF(0, 0, totalRect.width(), totalRect.height())
+
+ printer = QPrinter()
+ printer.setOutputFormat(QPrinter.PdfFormat)
+ printer.setOutputFileName(filename)
+ printer.setPaperSize(QSizeF(printerRect.width(), printerRect.height()), QPrinter.DevicePixel)
+ printer.setFullPage(True)
+
+ painter = QPainter(printer)
+ self.scene.render(painter, printerRect, totalRect)
+ painter.end()
+
+ self.bar.pushMessage("", "Model was correctly exported as PDF", level=QgsMessageBar.SUCCESS, duration=5)
+ self.repaintModel(controls=True)
+
+ def exportAsSvg(self):
+ self.repaintModel(controls=False)
+ filename, fileFilter = QFileDialog.getSaveFileName(self,
+ self.tr('Save Model As SVG'), '',
+ self.tr('SVG files (*.svg *.SVG)'))
+ if not filename:
+ return
+
+ if not filename.lower().endswith('.svg'):
+ filename += '.svg'
+
+ totalRect = self.scene.itemsBoundingRect()
+ totalRect.adjust(-10, -10, 10, 10)
+ svgRect = QRectF(0, 0, totalRect.width(), totalRect.height())
+
+ svg = QSvgGenerator()
+ svg.setFileName(filename)
+ svg.setSize(QSize(totalRect.width(), totalRect.height()))
+ svg.setViewBox(svgRect)
+ svg.setTitle(self.alg.name)
+
+ painter = QPainter(svg)
+ self.scene.render(painter, svgRect, totalRect)
+ painter.end()
+
+ self.bar.pushMessage("", "Model was correctly exported as SVG", level=QgsMessageBar.SUCCESS, duration=5)
+ self.repaintModel(controls=True)
def exportAsPython(self):
filename, filter = QFileDialog.getSaveFileName(self,
@@ -399,11 +501,11 @@ class ModelerDialog(BASE, WIDGET):
self.tr('The selected model could not be loaded.\n'
'See the log for more information.'))
- def repaintModel(self):
+ def repaintModel(self, controls=True):
self.scene = ModelerScene()
self.scene.setSceneRect(QRectF(0, 0, ModelerAlgorithm.CANVAS_SIZE,
ModelerAlgorithm.CANVAS_SIZE))
- self.scene.paintModel(self.alg)
+ self.scene.paintModel(self.alg, controls)
self.view.setScene(self.scene)
def addInput(self):
@@ -437,7 +539,7 @@ class ModelerDialog(BASE, WIDGET):
return QPointF(newX, MARGIN + BOX_HEIGHT / 2)
def fillInputsTree(self):
- icon = QIcon(os.path.join(pluginPath, 'images', 'input.png'))
+ icon = QIcon(os.path.join(pluginPath, 'images', 'input.svg'))
parametersItem = QTreeWidgetItem()
parametersItem.setText(0, self.tr('Parameters'))
for paramType in ModelerParameterDefinitionDialog.paramTypes:
diff --git a/python/plugins/processing/modeler/ModelerGraphicItem.py b/python/plugins/processing/modeler/ModelerGraphicItem.py
index b0fdf6c7c1d..d3a9668fda6 100644
--- a/python/plugins/processing/modeler/ModelerGraphicItem.py
+++ b/python/plugins/processing/modeler/ModelerGraphicItem.py
@@ -27,9 +27,12 @@ __copyright__ = '(C) 2012, Victor Olaya'
__revision__ = '$Format:%H$'
import os
+import math
+
from qgis.PyQt.QtCore import Qt, QPointF, QRectF
-from qgis.PyQt.QtGui import QIcon, QFont, QFontMetricsF, QPen, QBrush, QColor, QPolygonF
+from qgis.PyQt.QtGui import QIcon, QFont, QFontMetricsF, QPen, QBrush, QColor, QPolygonF, QPicture, QPainter
from qgis.PyQt.QtWidgets import QGraphicsItem, QMessageBox, QMenu
+from qgis.PyQt.QtSvg import QSvgRenderer
from processing.modeler.ModelerAlgorithm import ModelerParameter, Algorithm, ModelerOutput
from processing.modeler.ModelerParameterDefinitionDialog import ModelerParameterDefinitionDialog
from processing.modeler.ModelerParametersDialog import ModelerParametersDialog
@@ -42,18 +45,25 @@ class ModelerGraphicItem(QGraphicsItem):
BOX_HEIGHT = 30
BOX_WIDTH = 200
- def __init__(self, element, model):
+ def __init__(self, element, model, controls):
super(ModelerGraphicItem, self).__init__(None)
+ self.controls = controls
self.model = model
self.element = element
if isinstance(element, ModelerParameter):
- icon = QIcon(os.path.join(pluginPath, 'images', 'input.png'))
- self.pixmap = icon.pixmap(20, 20, state=QIcon.On)
+ svg = QSvgRenderer(os.path.join(pluginPath, 'images', 'input.svg'))
+ self.picture = QPicture()
+ painter = QPainter(self.picture)
+ svg.render(painter)
+ self.pixmap = None
self.text = element.param.description
elif isinstance(element, ModelerOutput):
# Output name
- icon = QIcon(os.path.join(pluginPath, 'images', 'output.png'))
- self.pixmap = icon.pixmap(20, 20, state=QIcon.On)
+ svg = QSvgRenderer(os.path.join(pluginPath, 'images', 'output.svg'))
+ self.picture = QPicture()
+ painter = QPainter(self.picture)
+ svg.render(painter)
+ self.pixmap = None
self.text = element.description
else:
self.text = element.description
@@ -64,20 +74,26 @@ class ModelerGraphicItem(QGraphicsItem):
self.setFlag(QGraphicsItem.ItemSendsGeometryChanges, True)
self.setZValue(1000)
- if not isinstance(element, ModelerOutput):
- icon = QIcon(os.path.join(pluginPath, 'images', 'edit.png'))
+ if not isinstance(element, ModelerOutput) and controls:
+ svg = QSvgRenderer(os.path.join(pluginPath, 'images', 'edit.svg'))
+ picture = QPicture()
+ painter = QPainter(picture)
+ svg.render(painter)
pt = QPointF(ModelerGraphicItem.BOX_WIDTH / 2
- FlatButtonGraphicItem.WIDTH / 2,
ModelerGraphicItem.BOX_HEIGHT / 2
- - FlatButtonGraphicItem.HEIGHT / 2 + 1)
- self.editButton = FlatButtonGraphicItem(icon, pt, self.editElement)
+ - FlatButtonGraphicItem.HEIGHT / 2)
+ self.editButton = FlatButtonGraphicItem(picture, pt, self.editElement)
self.editButton.setParentItem(self)
- icon = QIcon(os.path.join(pluginPath, 'images', 'delete.png'))
+ svg = QSvgRenderer(os.path.join(pluginPath, 'images', 'delete.svg'))
+ picture = QPicture()
+ painter = QPainter(picture)
+ svg.render(painter)
pt = QPointF(ModelerGraphicItem.BOX_WIDTH / 2
- FlatButtonGraphicItem.WIDTH / 2,
- ModelerGraphicItem.BOX_HEIGHT / 2
- + FlatButtonGraphicItem.HEIGHT / 2 + 1)
- self.deleteButton = FlatButtonGraphicItem(icon, pt,
+ + FlatButtonGraphicItem.HEIGHT / 2)
+ self.deleteButton = FlatButtonGraphicItem(picture, pt,
self.removeElement)
self.deleteButton.setParentItem(self)
@@ -85,14 +101,16 @@ class ModelerGraphicItem(QGraphicsItem):
alg = element.algorithm
if alg.parameters:
pt = self.getLinkPointForParameter(-1)
- pt = QPointF(0, pt.y() + 2)
- self.inButton = FoldButtonGraphicItem(pt, self.foldInput, self.element.paramsFolded)
- self.inButton.setParentItem(self)
+ pt = QPointF(0, pt.y())
+ if controls:
+ self.inButton = FoldButtonGraphicItem(pt, self.foldInput, self.element.paramsFolded)
+ self.inButton.setParentItem(self)
if alg.outputs:
pt = self.getLinkPointForOutput(-1)
- pt = QPointF(0, pt.y() + 2)
- self.outButton = FoldButtonGraphicItem(pt, self.foldOutput, self.element.outputsFolded)
- self.outButton.setParentItem(self)
+ pt = QPointF(0, pt.y())
+ if controls:
+ self.outButton = FoldButtonGraphicItem(pt, self.foldOutput, self.element.outputsFolded)
+ self.outButton.setParentItem(self)
def foldInput(self, folded):
self.element.paramsFolded = folded
@@ -117,6 +135,7 @@ class ModelerGraphicItem(QGraphicsItem):
def boundingRect(self):
font = QFont('Verdana', 8)
+ font.setPixelSize(12)
fm = QFontMetricsF(font)
unfolded = isinstance(self.element, Algorithm) and not self.element.paramsFolded
numParams = len(self.element.algorithm.parameters) if unfolded else 0
@@ -201,6 +220,7 @@ class ModelerGraphicItem(QGraphicsItem):
def getAdjustedText(self, text):
font = QFont('Verdana', 8)
+ font.setPixelSize(12)
fm = QFontMetricsF(font)
w = fm.width(text)
if w < self.BOX_WIDTH - 25 - FlatButtonGraphicItem.WIDTH:
@@ -218,27 +238,37 @@ class ModelerGraphicItem(QGraphicsItem):
-(ModelerGraphicItem.BOX_HEIGHT + 2) / 2.0,
ModelerGraphicItem.BOX_WIDTH + 2,
ModelerGraphicItem.BOX_HEIGHT + 2)
- painter.setPen(QPen(Qt.gray, 1))
- color = QColor(125, 232, 232)
+
if isinstance(self.element, ModelerParameter):
- color = QColor(179, 179, 255)
+ color = QColor(238, 242, 131)
+ outline = QColor(234, 226, 118)
+ selected = QColor(116, 113, 68)
elif isinstance(self.element, Algorithm):
- color = Qt.white
+ color = QColor(255, 255, 255)
+ outline = Qt.gray
+ selected = QColor(50, 50, 50)
+ else:
+ color = QColor(172, 196, 114)
+ outline = QColor(90, 140, 90)
+ selected = QColor(42, 65, 42)
+ if self.isSelected():
+ outline = selected
+ color = color.darker(110)
+ painter.setPen(QPen(outline, 0)) # 0 width "cosmetic" pen
painter.setBrush(QBrush(color, Qt.SolidPattern))
painter.drawRect(rect)
font = QFont('Verdana', 8)
+ font.setPixelSize(12)
painter.setFont(font)
painter.setPen(QPen(Qt.black))
text = self.getAdjustedText(self.text)
if isinstance(self.element, Algorithm) and not self.element.active:
painter.setPen(QPen(Qt.gray))
text = text + "\n(deactivated)"
- elif self.isSelected():
- painter.setPen(QPen(Qt.blue))
fm = QFontMetricsF(font)
text = self.getAdjustedText(self.text)
- h = fm.height()
- pt = QPointF(-ModelerGraphicItem.BOX_WIDTH / 2 + 25, h / 2.0)
+ h = fm.ascent()
+ pt = QPointF(-ModelerGraphicItem.BOX_WIDTH / 2 + 25, ModelerGraphicItem.BOX_HEIGHT / 2.0 - h + 1)
painter.drawText(pt, text)
painter.setPen(QPen(Qt.black))
if isinstance(self.element, Algorithm):
@@ -257,7 +287,7 @@ class ModelerGraphicItem(QGraphicsItem):
+ 33, h)
painter.drawText(pt, text)
i += 1
- h = fm.height() * 1.2
+ h = fm.height() * 1.1
h = h + ModelerGraphicItem.BOX_HEIGHT / 2.0
pt = QPointF(-ModelerGraphicItem.BOX_WIDTH / 2 + 25, h)
painter.drawText(pt, 'Out')
@@ -272,6 +302,9 @@ class ModelerGraphicItem(QGraphicsItem):
if self.pixmap:
painter.drawPixmap(-(ModelerGraphicItem.BOX_WIDTH / 2.0) + 3, -8,
self.pixmap)
+ elif self.picture:
+ painter.drawPicture(-(ModelerGraphicItem.BOX_WIDTH / 2.0) + 3, -8,
+ self.picture)
def getLinkPointForParameter(self, paramIndex):
offsetX = 25
@@ -279,6 +312,7 @@ class ModelerGraphicItem(QGraphicsItem):
paramIndex = -1
offsetX = 17
font = QFont('Verdana', 8)
+ font.setPixelSize(12)
fm = QFontMetricsF(font)
if isinstance(self.element, Algorithm):
h = -(fm.height() * 1.2) * (paramIndex + 2) - fm.height() / 2.0 + 8
@@ -292,6 +326,7 @@ class ModelerGraphicItem(QGraphicsItem):
outputIndex = (outputIndex if not self.element.outputsFolded else -1)
text = self.getAdjustedText(self.element.algorithm.outputs[outputIndex].description)
font = QFont('Verdana', 8)
+ font.setPixelSize(12)
fm = QFontMetricsF(font)
w = fm.width(text)
h = fm.height() * 1.2 * (outputIndex + 1) + fm.height() / 2.0
@@ -312,6 +347,7 @@ class ModelerGraphicItem(QGraphicsItem):
def polygon(self):
font = QFont('Verdana', 8)
+ font.setPixelSize(12)
fm = QFontMetricsF(font)
hUp = fm.height() * 1.2 * (len(self.element.parameters) + 2)
hDown = fm.height() * 1.2 * (len(self.element.outputs) + 2)
@@ -335,12 +371,11 @@ class FlatButtonGraphicItem(QGraphicsItem):
WIDTH = 16
HEIGHT = 16
- def __init__(self, icon, position, action):
+ def __init__(self, picture, position, action):
super(FlatButtonGraphicItem, self).__init__(None)
self.setAcceptHoverEvents(True)
self.setFlag(QGraphicsItem.ItemIsMovable, False)
- self.pixmap = icon.pixmap(self.WIDTH, self.HEIGHT,
- state=QIcon.On)
+ self.picture = picture
self.position = position
self.isIn = False
self.action = action
@@ -349,22 +384,22 @@ class FlatButtonGraphicItem(QGraphicsItem):
self.action()
def paint(self, painter, option, widget=None):
- pt = QPointF(-self.WIDTH / 2, -self.HEIGHT / 2) + self.position
+ pt = QPointF(-math.floor(self.WIDTH / 2), -math.floor(self.HEIGHT / 2)) + self.position
rect = QRectF(pt.x(), pt.y(), self.WIDTH, self.HEIGHT)
if self.isIn:
painter.setPen(QPen(Qt.transparent, 1))
- painter.setBrush(QBrush(Qt.lightGray,
+ painter.setBrush(QBrush(QColor(55, 55, 55, 33),
Qt.SolidPattern))
else:
painter.setPen(QPen(Qt.transparent, 1))
painter.setBrush(QBrush(Qt.transparent,
Qt.SolidPattern))
painter.drawRect(rect)
- painter.drawPixmap(pt.x(), pt.y(), self.pixmap)
+ painter.drawPicture(pt.x(), pt.y(), self.picture)
def boundingRect(self):
- rect = QRectF(self.position.x() - self.WIDTH / 2,
- self.position.y() - self.HEIGHT / 2,
+ rect = QRectF(self.position.x() - math.floor(self.WIDTH / 2),
+ self.position.y() - math.floor(self.HEIGHT / 2),
self.WIDTH,
self.HEIGHT)
return rect
@@ -384,16 +419,24 @@ class FoldButtonGraphicItem(FlatButtonGraphicItem):
HEIGHT = 11
def __init__(self, position, action, folded):
- self.icons = {True: QIcon(os.path.join(pluginPath, 'images', 'plus.png')),
- False: QIcon(os.path.join(pluginPath, 'images', 'minus.png'))}
+ plus = QPicture()
+ minus = QPicture()
+
+ svg = QSvgRenderer(os.path.join(pluginPath, 'images', 'plus.svg'))
+ painter = QPainter(plus)
+ svg.render(painter)
+ svg = QSvgRenderer(os.path.join(pluginPath, 'images', 'minus.svg'))
+ painter = QPainter(minus)
+ svg.render(painter)
+
+ self.pictures = {True: plus,
+ False: minus}
self.folded = folded
- icon = self.icons[self.folded]
- super(FoldButtonGraphicItem, self).__init__(icon, position, action)
+ picture = self.pictures[self.folded]
+ super(FoldButtonGraphicItem, self).__init__(picture, position, action)
def mousePressEvent(self, event):
self.folded = not self.folded
- icon = self.icons[self.folded]
- self.pixmap = icon.pixmap(self.WIDTH, self.HEIGHT,
- state=QIcon.On)
+ self.picture = self.pictures[self.folded]
self.action(self.folded)
diff --git a/python/plugins/processing/modeler/ModelerScene.py b/python/plugins/processing/modeler/ModelerScene.py
index 280c3a757b9..4d315a36404 100644
--- a/python/plugins/processing/modeler/ModelerScene.py
+++ b/python/plugins/processing/modeler/ModelerScene.py
@@ -78,11 +78,11 @@ class ModelerScene(QGraphicsScene):
items.append((self.algItems[value.alg], i))
return items
- def paintModel(self, model):
+ def paintModel(self, model, controls=True):
self.model = model
# Inputs
for inp in list(model.inputs.values()):
- item = ModelerGraphicItem(inp, model)
+ item = ModelerGraphicItem(inp, model, controls)
item.setFlag(QGraphicsItem.ItemIsMovable, True)
item.setFlag(QGraphicsItem.ItemIsSelectable, True)
self.addItem(item)
@@ -91,7 +91,7 @@ class ModelerScene(QGraphicsScene):
# We add the algs
for alg in list(model.algs.values()):
- item = ModelerGraphicItem(alg, model)
+ item = ModelerGraphicItem(alg, model, controls)
item.setFlag(QGraphicsItem.ItemIsMovable, True)
item.setFlag(QGraphicsItem.ItemIsSelectable, True)
self.addItem(item)
@@ -131,7 +131,7 @@ class ModelerScene(QGraphicsScene):
for key in outputs:
out = outputs[key]
if out is not None:
- item = ModelerGraphicItem(out, model)
+ item = ModelerGraphicItem(out, model, controls)
item.setFlag(QGraphicsItem.ItemIsMovable, True)
item.setFlag(QGraphicsItem.ItemIsSelectable, True)
self.addItem(item)
diff --git a/python/plugins/processing/preconfigured/PreconfiguredAlgorithmProvider.py b/python/plugins/processing/preconfigured/PreconfiguredAlgorithmProvider.py
index fa348e88f36..dc711a94444 100644
--- a/python/plugins/processing/preconfigured/PreconfiguredAlgorithmProvider.py
+++ b/python/plugins/processing/preconfigured/PreconfiguredAlgorithmProvider.py
@@ -54,7 +54,7 @@ class PreconfiguredAlgorithmProvider(AlgorithmProvider):
self.algs.append(alg)
def getIcon(self):
- return QIcon(os.path.join(os.path.dirname(os.path.dirname(__file__)), 'images', 'alg.png'))
+ return QIcon(os.path.join(os.path.dirname(os.path.dirname(__file__)), 'images', 'alg.svg'))
def getName(self):
return 'preconfigured'
diff --git a/python/plugins/processing/script/AddScriptFromFileAction.py b/python/plugins/processing/script/AddScriptFromFileAction.py
index e23ec7bec1a..1546829a5f1 100644
--- a/python/plugins/processing/script/AddScriptFromFileAction.py
+++ b/python/plugins/processing/script/AddScriptFromFileAction.py
@@ -47,7 +47,7 @@ class AddScriptFromFileAction(ToolboxAction):
self.group, self.i18n_group = self.trAction('Tools')
def getIcon(self):
- return QIcon(os.path.join(pluginPath, 'images', 'script.png'))
+ return QIcon(os.path.join(pluginPath, 'images', 'script.svg'))
def execute(self):
settings = QSettings()
diff --git a/python/plugins/processing/script/CreateScriptCollectionPluginAction.py b/python/plugins/processing/script/CreateScriptCollectionPluginAction.py
index 1ee2e2285d3..2dfd56f78be 100644
--- a/python/plugins/processing/script/CreateScriptCollectionPluginAction.py
+++ b/python/plugins/processing/script/CreateScriptCollectionPluginAction.py
@@ -77,7 +77,7 @@ class CreateScriptCollectionPluginAction(ToolboxAction):
self.group, self.i18n_group = self.trAction('Tools')
def getIcon(self):
- return QIcon(os.path.join(pluginPath, 'images', 'script.png'))
+ return QIcon(os.path.join(pluginPath, 'images', 'script.svg'))
def execute(self):
dlg = ScriptSelector()
diff --git a/python/plugins/processing/script/ScriptAlgorithm.py b/python/plugins/processing/script/ScriptAlgorithm.py
index ade671b4425..3a594885a2b 100644
--- a/python/plugins/processing/script/ScriptAlgorithm.py
+++ b/python/plugins/processing/script/ScriptAlgorithm.py
@@ -29,7 +29,7 @@ __revision__ = '$Format:%H$'
import os
import re
import json
-from qgis.core import QgsExpressionContextUtils, QgsExpressionContext
+from qgis.core import QgsExpressionContextUtils, QgsExpressionContext, QgsProject
from qgis.PyQt.QtGui import QIcon
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.gui.Help2Html import getHtmlFromHelpFile
@@ -52,7 +52,7 @@ class ScriptAlgorithm(GeoAlgorithm):
"""
GeoAlgorithm.__init__(self)
- self._icon = QIcon(os.path.join(pluginPath, 'images', 'script.png'))
+ self._icon = QIcon(os.path.join(pluginPath, 'images', 'script.svg'))
self.script = script
self.allowEdit = True
@@ -166,7 +166,7 @@ class ScriptAlgorithm(GeoAlgorithm):
context = QgsExpressionContext()
context.appendScope(QgsExpressionContextUtils.globalScope())
- context.appendScope(QgsExpressionContextUtils.projectScope())
+ context.appendScope(QgsExpressionContextUtils.projectScope(QgsProject.instance()))
for var in variables:
varname = var[1:]
if context.hasVariable(varname):
diff --git a/python/plugins/processing/script/ScriptAlgorithmProvider.py b/python/plugins/processing/script/ScriptAlgorithmProvider.py
index 9d18a538ffd..ffff9d14570 100644
--- a/python/plugins/processing/script/ScriptAlgorithmProvider.py
+++ b/python/plugins/processing/script/ScriptAlgorithmProvider.py
@@ -67,7 +67,7 @@ class ScriptAlgorithmProvider(AlgorithmProvider):
ProcessingConfig.addSetting(ScriptUtils.SCRIPTS_FOLDER)
def getIcon(self):
- return QIcon(os.path.join(pluginPath, 'images', 'script.png'))
+ return QIcon(os.path.join(pluginPath, 'images', 'script.svg'))
def getName(self):
return 'script'
diff --git a/python/plugins/processing/tests/AlgorithmsTestBase.py b/python/plugins/processing/tests/AlgorithmsTestBase.py
index fda8998d256..d573cdd71ef 100644
--- a/python/plugins/processing/tests/AlgorithmsTestBase.py
+++ b/python/plugins/processing/tests/AlgorithmsTestBase.py
@@ -36,6 +36,8 @@ import os
import yaml
import nose2
import gdal
+import shutil
+import glob
import hashlib
import tempfile
@@ -47,7 +49,7 @@ from processing.modeler.ModelerAlgorithmProvider import ModelerAlgorithmProvider
from processing.algs.qgis.QGISAlgorithmProvider import QGISAlgorithmProvider
from processing.algs.grass7.Grass7AlgorithmProvider import Grass7AlgorithmProvider
from processing.algs.lidar.LidarToolsAlgorithmProvider import LidarToolsAlgorithmProvider
-from processing.algs.gdal.GdalOgrAlgorithmProvider import GdalOgrAlgorithmProvider
+from processing.algs.gdal.GdalAlgorithmProvider import GdalAlgorithmProvider
from processing.algs.otb.OTBAlgorithmProvider import OTBAlgorithmProvider
from processing.algs.r.RAlgorithmProvider import RAlgorithmProvider
from processing.algs.saga.SagaAlgorithmProvider import SagaAlgorithmProvider
@@ -69,6 +71,8 @@ def processingTestDataPath():
class AlgorithmsTest(object):
+ in_place_layers = {}
+
def test_algorithms(self):
"""
This is the main test function. All others will be executed based on the definitions in testdata/algorithm_tests.yaml
@@ -110,14 +114,14 @@ class AlgorithmsTest(object):
if expectFailure:
try:
alg.execute()
- self.check_results(alg.getOutputValuesAsDictionary(), defs['results'])
+ self.check_results(alg.getOutputValuesAsDictionary(), defs['params'], defs['results'])
except Exception:
pass
else:
raise _UnexpectedSuccess
else:
alg.execute()
- self.check_results(alg.getOutputValuesAsDictionary(), defs['results'])
+ self.check_results(alg.getOutputValuesAsDictionary(), defs['params'], defs['results'])
def load_params(self, params):
"""
@@ -126,22 +130,30 @@ class AlgorithmsTest(object):
if isinstance(params, list):
return [self.load_param(p) for p in params]
elif isinstance(params, dict):
- return {key: self.load_param(p) for key, p in list(params.items())}
+ return {key: self.load_param(p, key) for key, p in list(params.items())}
else:
return params
- def load_param(self, param):
+ def load_param(self, param, id=None):
"""
Loads a parameter. If it's not a map, the parameter will be returned as-is. If it is a map, it will process the
parameter based on its key `type` and return the appropriate parameter to pass to the algorithm.
"""
try:
if param['type'] in ('vector', 'raster', 'table'):
- return self.load_layer(param)
+ return self.load_layer(id, param)
elif param['type'] == 'multi':
return [self.load_param(p) for p in param['params']]
elif param['type'] == 'file':
return self.filepath_from_param(param)
+ elif param['type'] == 'interpolation':
+ prefix = processingTestDataPath()
+ tmp = ''
+ for r in param['name'].split(';'):
+ v = r.split(',')
+ tmp += '{},{},{},{};'.format(os.path.join(prefix, v[0]),
+ v[1], v[2], v[3])
+ return tmp[:-1]
except TypeError:
# No type specified, use whatever is there
return param
@@ -168,12 +180,26 @@ class AlgorithmsTest(object):
raise KeyError("Unknown type '{}' specified for parameter".format(param['type']))
- def load_layer(self, param):
+ def load_layer(self, id, param):
"""
Loads a layer which was specified as parameter.
"""
filepath = self.filepath_from_param(param)
+ try:
+ # check if alg modifies layer in place
+ if param['in_place']:
+ tmpdir = tempfile.mkdtemp()
+ self.cleanup_paths.append(tmpdir)
+ path, file_name = os.path.split(filepath)
+ base, ext = os.path.splitext(file_name)
+ for file in glob.glob(os.path.join(path, '{}.*'.format(base))):
+ shutil.copy(os.path.join(path, file), tmpdir)
+ filepath = os.path.join(tmpdir, file_name)
+ self.in_place_layers[id] = filepath
+ except:
+ pass
+
if param['type'] in ('vector', 'table'):
lyr = QgsVectorLayer(filepath, param['name'], 'ogr')
elif param['type'] == 'raster':
@@ -193,19 +219,22 @@ class AlgorithmsTest(object):
return os.path.join(prefix, param['name'])
- def check_results(self, results, expected):
+ def check_results(self, results, params, expected):
"""
Checks if result produced by an algorithm matches with the expected specification.
"""
for id, expected_result in list(expected.items()):
if expected_result['type'] in ('vector', 'table'):
- expected_lyr = self.load_layer(expected_result)
- try:
- results[id]
- except KeyError as e:
- raise KeyError('Expected result {} does not exist in {}'.format(str(e), list(results.keys())))
+ expected_lyr = self.load_layer(id, expected_result)
+ if 'in_place_result' in expected_result:
+ result_lyr = QgsVectorLayer(self.in_place_layers[id], id, 'ogr')
+ else:
+ try:
+ results[id]
+ except KeyError as e:
+ raise KeyError('Expected result {} does not exist in {}'.format(str(e), list(results.keys())))
- result_lyr = QgsVectorLayer(results[id], id, 'ogr')
+ result_lyr = QgsVectorLayer(results[id], id, 'ogr')
compare = expected_result.get('compare', {})
diff --git a/python/plugins/processing/tests/ParametersTest.py b/python/plugins/processing/tests/ParametersTest.py
index 74d136bdbf8..08ae80d7f74 100644
--- a/python/plugins/processing/tests/ParametersTest.py
+++ b/python/plugins/processing/tests/ParametersTest.py
@@ -25,6 +25,8 @@ __copyright__ = '(C) 2013, Victor Olaya'
__revision__ = '$Format:%H$'
+import sys
+from inspect import isclass
from qgis.testing import start_app, unittest
from processing.core.parameters import (Parameter,
@@ -66,6 +68,19 @@ class ParameterTest(unittest.TestCase):
parameter.setValue(123)
self.assertEqual(parameter.getValueAsCommandLineParameter(), '123')
+ def testScriptCode(self):
+ """Simple check that default constructed object export/import correctly"""
+ paramClasses = [c for c in list(sys.modules[__name__].__dict__.values())
+ if isclass(c) and issubclass(c, Parameter) and c != Parameter]
+
+ for paramClass in paramClasses:
+ param = paramClass()
+ if hasattr(param, 'getAsScriptCode'):
+ code = param.getAsScriptCode()
+ importedParam = paramClass.fromScriptCode(code)
+ self.assertEquals(param.optional, importedParam.optional)
+ self.assertEquals(param.default, importedParam.default, param)
+
class ParameterBooleanTest(unittest.TestCase):
@@ -578,12 +593,29 @@ class ParameterStringTest(unittest.TestCase):
code = parameter.getAsScriptCode()
result = getParameterFromString(code)
self.assertIsInstance(result, ParameterString)
+ self.assertEqual(result.default, parameter.default)
+ parameter.default = None
parameter.optional = True
code = parameter.getAsScriptCode()
result = getParameterFromString(code)
self.assertIsInstance(result, ParameterString)
self.assertTrue(result.optional)
+ self.assertEqual(result.default, parameter.default)
+
+ parameter.default = 'None'
+ code = parameter.getAsScriptCode()
+ result = getParameterFromString(code)
+ self.assertIsInstance(result, ParameterString)
+ self.assertTrue(result.optional)
+ self.assertEqual(result.default, parameter.default)
+
+ parameter.default = 'It\'s Mario'
+ code = parameter.getAsScriptCode()
+ result = getParameterFromString(code)
+ self.assertIsInstance(result, ParameterString)
+ self.assertTrue(result.optional)
+ self.assertEqual(result.default, parameter.default)
class ParameterExpressionTest(unittest.TestCase):
@@ -619,6 +651,7 @@ class ParameterExpressionTest(unittest.TestCase):
result = getParameterFromString(code)
self.assertIsInstance(result, ParameterExpression)
self.assertTrue(result.optional)
+ self.assertEquals(result.default, parameter.default)
class ParameterTableFieldTest(unittest.TestCase):
diff --git a/python/plugins/processing/tests/TestData.py b/python/plugins/processing/tests/TestData.py
index a0d34da7a9d..80f42b41c4a 100644
--- a/python/plugins/processing/tests/TestData.py
+++ b/python/plugins/processing/tests/TestData.py
@@ -36,3 +36,7 @@ def table():
def points():
return os.path.join(testDataPath, 'points.gml')
+
+
+def invalid_geometries():
+ return os.path.join(testDataPath, 'invalidgeometries.gml')
diff --git a/python/plugins/processing/tests/ToolsTest.py b/python/plugins/processing/tests/ToolsTest.py
index 12496b4c184..cdf089378b5 100644
--- a/python/plugins/processing/tests/ToolsTest.py
+++ b/python/plugins/processing/tests/ToolsTest.py
@@ -32,8 +32,9 @@ import tempfile
from qgis.core import (QgsVectorLayer, QgsFeatureRequest)
from qgis.testing import start_app, unittest
+from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from processing.core.ProcessingConfig import ProcessingConfig
-from processing.tests.TestData import testDataPath, points
+from processing.tests.TestData import testDataPath, points, invalid_geometries
from processing.tools import vector
testDataPath = os.path.join(os.path.dirname(__file__), 'testdata')
diff --git a/python/plugins/processing/tests/testdata/custom/points.cpg b/python/plugins/processing/tests/testdata/custom/points.cpg
new file mode 100644
index 00000000000..3ad133c048f
--- /dev/null
+++ b/python/plugins/processing/tests/testdata/custom/points.cpg
@@ -0,0 +1 @@
+UTF-8
\ No newline at end of file
diff --git a/python/plugins/processing/tests/testdata/custom/points.dbf b/python/plugins/processing/tests/testdata/custom/points.dbf
new file mode 100644
index 00000000000..9fad2e9ba68
Binary files /dev/null and b/python/plugins/processing/tests/testdata/custom/points.dbf differ
diff --git a/python/plugins/processing/tests/testdata/custom/points.prj b/python/plugins/processing/tests/testdata/custom/points.prj
new file mode 100644
index 00000000000..a30c00a55de
--- /dev/null
+++ b/python/plugins/processing/tests/testdata/custom/points.prj
@@ -0,0 +1 @@
+GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
\ No newline at end of file
diff --git a/python/plugins/processing/tests/testdata/custom/points.qpj b/python/plugins/processing/tests/testdata/custom/points.qpj
new file mode 100644
index 00000000000..5fbc831e743
--- /dev/null
+++ b/python/plugins/processing/tests/testdata/custom/points.qpj
@@ -0,0 +1 @@
+GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]
diff --git a/python/plugins/processing/tests/testdata/custom/points.shp b/python/plugins/processing/tests/testdata/custom/points.shp
new file mode 100644
index 00000000000..a0a4405be68
Binary files /dev/null and b/python/plugins/processing/tests/testdata/custom/points.shp differ
diff --git a/python/plugins/processing/tests/testdata/custom/points.shx b/python/plugins/processing/tests/testdata/custom/points.shx
new file mode 100644
index 00000000000..7699aa20d55
Binary files /dev/null and b/python/plugins/processing/tests/testdata/custom/points.shx differ
diff --git a/python/plugins/processing/tests/testdata/expected/create_attr_index_points.cpg b/python/plugins/processing/tests/testdata/expected/create_attr_index_points.cpg
new file mode 100644
index 00000000000..3ad133c048f
--- /dev/null
+++ b/python/plugins/processing/tests/testdata/expected/create_attr_index_points.cpg
@@ -0,0 +1 @@
+UTF-8
\ No newline at end of file
diff --git a/python/plugins/processing/tests/testdata/expected/create_attr_index_points.dbf b/python/plugins/processing/tests/testdata/expected/create_attr_index_points.dbf
new file mode 100644
index 00000000000..d22e822c089
Binary files /dev/null and b/python/plugins/processing/tests/testdata/expected/create_attr_index_points.dbf differ
diff --git a/python/plugins/processing/tests/testdata/expected/create_attr_index_points.ind b/python/plugins/processing/tests/testdata/expected/create_attr_index_points.ind
new file mode 100644
index 00000000000..f32e58c11a1
Binary files /dev/null and b/python/plugins/processing/tests/testdata/expected/create_attr_index_points.ind differ
diff --git a/python/plugins/processing/tests/testdata/expected/create_attr_index_points.prj b/python/plugins/processing/tests/testdata/expected/create_attr_index_points.prj
new file mode 100644
index 00000000000..a30c00a55de
--- /dev/null
+++ b/python/plugins/processing/tests/testdata/expected/create_attr_index_points.prj
@@ -0,0 +1 @@
+GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
\ No newline at end of file
diff --git a/python/plugins/processing/tests/testdata/expected/create_attr_index_points.qpj b/python/plugins/processing/tests/testdata/expected/create_attr_index_points.qpj
new file mode 100644
index 00000000000..5fbc831e743
--- /dev/null
+++ b/python/plugins/processing/tests/testdata/expected/create_attr_index_points.qpj
@@ -0,0 +1 @@
+GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]
diff --git a/python/plugins/processing/tests/testdata/expected/create_attr_index_points.shp b/python/plugins/processing/tests/testdata/expected/create_attr_index_points.shp
new file mode 100644
index 00000000000..a0a4405be68
Binary files /dev/null and b/python/plugins/processing/tests/testdata/expected/create_attr_index_points.shp differ
diff --git a/python/plugins/processing/tests/testdata/expected/create_attr_index_points.shx b/python/plugins/processing/tests/testdata/expected/create_attr_index_points.shx
new file mode 100644
index 00000000000..7699aa20d55
Binary files /dev/null and b/python/plugins/processing/tests/testdata/expected/create_attr_index_points.shx differ
diff --git a/python/plugins/processing/tests/testdata/expected/truncated.cpg b/python/plugins/processing/tests/testdata/expected/truncated.cpg
new file mode 100644
index 00000000000..3ad133c048f
--- /dev/null
+++ b/python/plugins/processing/tests/testdata/expected/truncated.cpg
@@ -0,0 +1 @@
+UTF-8
\ No newline at end of file
diff --git a/python/plugins/processing/tests/testdata/expected/truncated.dbf b/python/plugins/processing/tests/testdata/expected/truncated.dbf
new file mode 100644
index 00000000000..14d19cdcea7
Binary files /dev/null and b/python/plugins/processing/tests/testdata/expected/truncated.dbf differ
diff --git a/python/plugins/processing/tests/testdata/expected/truncated.prj b/python/plugins/processing/tests/testdata/expected/truncated.prj
new file mode 100644
index 00000000000..a30c00a55de
--- /dev/null
+++ b/python/plugins/processing/tests/testdata/expected/truncated.prj
@@ -0,0 +1 @@
+GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
\ No newline at end of file
diff --git a/python/plugins/processing/tests/testdata/expected/truncated.qpj b/python/plugins/processing/tests/testdata/expected/truncated.qpj
new file mode 100644
index 00000000000..5fbc831e743
--- /dev/null
+++ b/python/plugins/processing/tests/testdata/expected/truncated.qpj
@@ -0,0 +1 @@
+GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]
diff --git a/python/plugins/processing/tests/testdata/expected/truncated.shp b/python/plugins/processing/tests/testdata/expected/truncated.shp
new file mode 100644
index 00000000000..29de63a12be
Binary files /dev/null and b/python/plugins/processing/tests/testdata/expected/truncated.shp differ
diff --git a/python/plugins/processing/tests/testdata/expected/truncated.shx b/python/plugins/processing/tests/testdata/expected/truncated.shx
new file mode 100644
index 00000000000..29de63a12be
Binary files /dev/null and b/python/plugins/processing/tests/testdata/expected/truncated.shx differ
diff --git a/python/plugins/processing/tests/testdata/gdal_algorithm_tests.yaml b/python/plugins/processing/tests/testdata/gdal_algorithm_tests.yaml
index 46eb3e43782..bde997c8489 100644
--- a/python/plugins/processing/tests/testdata/gdal_algorithm_tests.yaml
+++ b/python/plugins/processing/tests/testdata/gdal_algorithm_tests.yaml
@@ -1,34 +1,8 @@
# See ../README.md for a description of the file format
tests:
-# MK: 23.2.2016 / Fails on travis:OSX
-# - algorithm: gdalogr:rasterize
-# name: Test (gdalogr:rasterize)
-# params:
-# BIGTIFF: 0
-# COMPRESS: 4
-# DIMENSIONS: 0
-# EXTRA: ""
-# FIELD: "Bfloatval"
-# HEIGHT: 100
-# INPUT:
-# name: multipolys.gml
-# type: vector
-# JPEGCOMPRESSION: 75
-# NO_DATA: -9999
-# PREDICTOR: 1
-# RTYPE: 5
-# TFW: False
-# TILED: False
-# WIDTH: 100
-# ZLEVEL: 6
-# results:
-# OUTPUT:
-# hash: f1fedeb6782f9389cf43590d4c85ada9155ab61fef6dc285aaeb54d6
-# type: rasterhash
-
- - algorithm: gdalorg:rasterinfo
- name: GDAL gdalinfo
+ - algorithm: gdal:gdalinfo
+ name: gdalinfo
params:
INPUT:
name: raster.tif
@@ -44,20 +18,8 @@ tests:
- 'Band 1 Block=16x14 Type=Float32, ColorInterp=Gray'
- ' NoData Value=-32768'
-# - algorithm: gdalogr:polygonize
-# name: GDAL polygonize
-# params:
-# FIELD: DN
-# INPUT:
-# name: raster.tif
-# type: raster
-# results:
-# OUTPUT:
-# name: expected/gdal/polygonize.gml
-# type: vector
-
- - algorithm: gdalogr:information
- name: GDAL ogrinfo
+ - algorithm: gdal:ogrinfo
+ name: ogrinfo
params:
INPUT:
name: lines.gml
@@ -72,8 +34,8 @@ tests:
- 'Geometry: Line String'
- 'Feature Count: [6|7]' # On some platforms returns 6 instead of 7...
- - algorithm: gdalogr:buffervectors
- name: OGR buffer lines
+ - algorithm: gdal:buffervectors
+ name: Buffer lines
params:
DISSOLVEALL: false
DISTANCE: 1.0
@@ -92,8 +54,8 @@ tests:
expectedFailure:
- int(1)
- - algorithm: gdalogr:buffervectors
- name: OGR basic polygon buffer
+ - algorithm: gdal:buffervectors
+ name: Basic polygon buffer
params:
DISSOLVEALL: false
DISTANCE: 0.5
@@ -110,8 +72,8 @@ tests:
geometry:
precision: 7
- - algorithm: gdalogr:buffervectors
- name: OGR polygon buffer with dissolve
+ - algorithm: gdal:buffervectors
+ name: Polygon buffer with dissolve
params:
DISSOLVEALL: true
DISTANCE: 0.5
@@ -128,8 +90,8 @@ tests:
geometry:
precision: 7
- - algorithm: gdalogr:createpointsalonglines
- name: OGR points along lines
+ - algorithm: gdal:createpointsalonglines
+ name: Points along lines
params:
DISTANCE: 0.25
GEOMETRY: geometry
@@ -141,8 +103,8 @@ tests:
name: expected/gdal/points_along_lines.gml
type: vector
- - algorithm: gdalogr:offsetlinesforlines
- name: OGR offset lines for lines (right-handed)
+ - algorithm: gdal:offsetlinesforlines
+ name: Offset lines for lines (right-handed)
params:
DISSOLVEALL: false
GEOMETRY: geometry
@@ -159,8 +121,8 @@ tests:
geometry:
precision: 7
- - algorithm: gdalogr:singlesidedbufferforlines
- name: OGR one-side buffer for lines (left-handed)
+ - algorithm: gdal:singlesidedbufferforlines
+ name: One-side buffer for lines (left-handed)
params:
DISSOLVEALL: false
GEOMETRY: geometry
@@ -177,3 +139,318 @@ tests:
compare:
geometry:
precision: 7
+
+ - algorithm: gdal:aspect
+ name: Aspect with standard parameters
+ params:
+ BAND: 1
+ COMPUTE_EDGES: false
+ INPUT:
+ name: dem.tif
+ type: raster
+ TRIG_ANGLE: false
+ ZERO_FLAT: false
+ ZEVENBERGEN: false
+ results:
+ OUTPUT:
+ hash: 8436df662a44a00762aa29768e5d6ecfaf2d42e9a4da02d8afc6e3f6
+ type: rasterhash
+
+ - algorithm: gdal:aspect
+ name: Aspect without NULL (-9999) values (0 instead)
+ params:
+ BAND: 1
+ COMPUTE_EDGES: false
+ INPUT:
+ name: dem.tif
+ type: raster
+ TRIG_ANGLE: false
+ ZERO_FLAT: true
+ ZEVENBERGEN: false
+ results:
+ OUTPUT:
+ hash: 43cccb440c7febb0095103eee3509b740e9f1bf2b3ad3b8a4c25622e
+ type: rasterhash
+
+ - algorithm: gdal:aspect
+ name: Aspect with trigonometric angle
+ params:
+ BAND: 1
+ COMPUTE_EDGES: false
+ INPUT:
+ name: dem.tif
+ type: raster
+ TRIG_ANGLE: true
+ ZERO_FLAT: false
+ ZEVENBERGEN: false
+ results:
+ OUTPUT:
+ hash: a95e8a09a613b551d3f33dfb4975c430f599dc55f761063ae9529124
+ type: rasterhash
+
+ - algorithm: gdal:aspect
+ name: Aspect zevenbergen
+ params:
+ BAND: 1
+ COMPUTE_EDGES: false
+ INPUT:
+ name: dem.tif
+ type: raster
+ TRIG_ANGLE: false
+ ZERO_FLAT: false
+ ZEVENBERGEN: true
+ results:
+ OUTPUT:
+ hash: 2cd5868b21efbd286f4977795143c89df77ac8976f8bc2a2c4e310d8
+ type: rasterhash
+
+ - algorithm: gdal:aspect
+ name: Aspect with edges
+ params:
+ BAND: 1
+ COMPUTE_EDGES: true
+ INPUT:
+ name: dem.tif
+ type: raster
+ TRIG_ANGLE: false
+ ZERO_FLAT: false
+ ZEVENBERGEN: false
+ results:
+ OUTPUT:
+ hash: d3a354c6e5f207779bb58f9bd23fd89a9f90a77d81aafc661d0ae077
+ type: rasterhash
+
+ - algorithm: gdal:cliprasterbyextent
+ name: Clip raster by extent
+ params:
+ BIGTIFF: '0'
+ COMPRESS: '4'
+ INPUT:
+ name: dem.tif
+ type: raster
+ JPEGCOMPRESSION: 75
+ PREDICTOR: 1
+ PROJWIN: 18.67551824296977,18.697800756150787,45.78984181545589,45.804309302274866
+ RTYPE: '5'
+ TFW: false
+ TILED: false
+ ZLEVEL: 6
+ results:
+ OUTPUT:
+ hash: 9913a7c0e1ced2c2ce1cd8f0e8103475bc2b0dd4d1d0adafe4920f93
+ type: rasterhash
+
+ - algorithm: gdal:cliprasterbyextent
+ name: Clip raster by extent and change no data values
+ params:
+ BIGTIFF: '0'
+ COMPRESS: '4'
+ INPUT:
+ name: dem.tif
+ type: raster
+ JPEGCOMPRESSION: 75
+ NO_DATA: '-9999'
+ PREDICTOR: 1
+ PROJWIN: 18.67460436727692,18.698371162148714,45.78995019401027,45.804344168369234
+ RTYPE: '5'
+ TFW: false
+ TILED: false
+ ZLEVEL: 6
+ results:
+ OUTPUT:
+ hash: df5de501bcec0c10f738d77f3b48d5545b48f0a22e0e028a8b1ccbe7
+ type: rasterhash
+
+ - algorithm: gdal:cliprasterbymasklayer
+ name: Clip raster by mask layer
+ params:
+ ALPHA_BAND: false
+ BIGTIFF: '0'
+ COMPRESS: '4'
+ CROP_TO_CUTLINE: true
+ INPUT:
+ name: dem.tif
+ type: raster
+ JPEGCOMPRESSION: 75
+ KEEP_RESOLUTION: false
+ MASK:
+ name: custom/polygon_mask.gml
+ type: vector
+ PREDICTOR: 1
+ RTYPE: '5'
+ TFW: false
+ TILED: false
+ ZLEVEL: 6
+ results:
+ OUTPUT:
+ hash: 4f4720e4efe59a7f238f622659917bbeb5262369d15d5e2917dbcf8b
+ type: rasterhash
+
+ - algorithm: gdal:cliprasterbymasklayer
+ name: Clip raster by mask layer and change no data value
+ params:
+ ALPHA_BAND: false
+ BIGTIFF: '0'
+ COMPRESS: '4'
+ CROP_TO_CUTLINE: true
+ INPUT:
+ name: dem.tif
+ type: raster
+ JPEGCOMPRESSION: 75
+ KEEP_RESOLUTION: false
+ MASK:
+ name: custom/polygon_mask.gml
+ type: vector
+ NO_DATA: '-9999'
+ PREDICTOR: 1
+ RTYPE: '5'
+ TFW: false
+ TILED: false
+ ZLEVEL: 6
+ results:
+ OUTPUT:
+ hash: 1e0252e63c65dcf4ed1f2b17d2490d3e0331aeb59d8f59b59554f442
+ type: rasterhash
+
+ - algorithm: gdal:cliprasterbymasklayer
+ name: Clip raster by mask layer and add alpha band
+ params:
+ ALPHA_BAND: true
+ BIGTIFF: '0'
+ COMPRESS: '4'
+ CROP_TO_CUTLINE: true
+ INPUT:
+ name: dem.tif
+ type: raster
+ JPEGCOMPRESSION: 75
+ KEEP_RESOLUTION: false
+ MASK:
+ name: custom/polygon_mask.gml
+ type: vector
+ PREDICTOR: 1
+ RTYPE: '5'
+ TFW: false
+ TILED: false
+ ZLEVEL: 6
+ results:
+ OUTPUT:
+ hash: 8f69431c6ff7db5174c1ca8e879ae39582fd4ce86f9b53edae0f38ce
+ type: rasterhash
+
+ - algorithm: gdal:hillshade
+ name: Hillshade
+ params:
+ ALTITUDE: 45.0
+ AZIMUTH: 315.0
+ BAND: 1
+ COMPUTE_EDGES: false
+ INPUT:
+ name: dem.tif
+ type: raster
+ SCALE: 1.0
+ ZEVENBERGEN: false
+ Z_FACTOR: 1.0
+ results:
+ OUTPUT:
+ hash: e5cf91b875b918682e456463165eddc4af4ae8855b143068e198ce2a
+ type: rasterhash
+
+ - algorithm: gdal:hillshade
+ name: Hillshade with edges calculation
+ params:
+ ALTITUDE: 45.0
+ AZIMUTH: 315.0
+ BAND: 1
+ COMPUTE_EDGES: true
+ INPUT:
+ name: dem.tif
+ type: raster
+ SCALE: 1.0
+ ZEVENBERGEN: false
+ Z_FACTOR: 1.0
+ results:
+ OUTPUT:
+ hash: 570671408b020c9cc817e876f0e8081e0b11920c7d297abfe1cb3368
+ type: rasterhash
+
+ - algorithm: gdal:hillshade
+ name: Hillshade with Zevenbergen formula
+ params:
+ ALTITUDE: 45.0
+ AZIMUTH: 315.0
+ BAND: 1
+ COMPUTE_EDGES: false
+ INPUT:
+ name: dem.tif
+ type: raster
+ SCALE: 1.0
+ ZEVENBERGEN: true
+ Z_FACTOR: 1.0
+ results:
+ OUTPUT:
+ hash: ce2174ab155023367d38785fb867456c6a1ae3535ea0ec5ad7a694d5
+ type: rasterhash
+
+ - algorithm: gdal:slope
+ name: Slope
+ params:
+ AS_PERCENT: false
+ BAND: 1
+ COMPUTE_EDGES: false
+ INPUT:
+ name: dem.tif
+ type: raster
+ SCALE: 1.0
+ ZEVENBERGEN: false
+ results:
+ OUTPUT:
+ hash: 319c470de3315f440371d5df8a6e478a8ecaf1cf904a013dbf1b3a6a
+ type: rasterhash
+
+ - algorithm: gdal:slope
+ name: Slope with edges
+ params:
+ AS_PERCENT: false
+ BAND: 1
+ COMPUTE_EDGES: true
+ INPUT:
+ name: dem.tif
+ type: raster
+ SCALE: 1.0
+ ZEVENBERGEN: false
+ results:
+ OUTPUT:
+ hash: f7f8df8b6517fd8660304f7f2fbd6ade2ae68035f4dd9a224c80b465
+ type: rasterhash
+
+ - algorithm: gdal:slope
+ name: Slope with Zevenbergen formula
+ params:
+ AS_PERCENT: false
+ BAND: 1
+ COMPUTE_EDGES: false
+ INPUT:
+ name: dem.tif
+ type: raster
+ SCALE: 1.0
+ ZEVENBERGEN: true
+ results:
+ OUTPUT:
+ hash: 90e42b1bc7be9cf7b4a729c6db44dde0bba39dd33012ade6bc8080e7
+ type: rasterhash
+
+ - algorithm: gdal:slope
+ name: Slope with percent instead of degree
+ params:
+ AS_PERCENT: true
+ BAND: 1
+ COMPUTE_EDGES: false
+ INPUT:
+ name: dem.tif
+ type: raster
+ SCALE: 1.0
+ ZEVENBERGEN: false
+ results:
+ OUTPUT:
+ hash: c9dc888254a571e7fbf66691fb72b35f030f87decf59ce67e32ad89d
+ type: rasterhash
diff --git a/python/plugins/processing/tests/testdata/invalidgeometries.gfs b/python/plugins/processing/tests/testdata/invalidgeometries.gfs
new file mode 100644
index 00000000000..cb490f0326f
--- /dev/null
+++ b/python/plugins/processing/tests/testdata/invalidgeometries.gfs
@@ -0,0 +1,15 @@
+
+
+ invalidgeometries
+ invalidgeometries
+ 3
+ EPSG:4326
+
+ 1
+ 122.17632
+ 122.19038
+ -8.60636
+ -8.59579
+
+
+
diff --git a/python/plugins/processing/tests/testdata/invalidgeometries.gml b/python/plugins/processing/tests/testdata/invalidgeometries.gml
new file mode 100644
index 00000000000..b8b426b2865
--- /dev/null
+++ b/python/plugins/processing/tests/testdata/invalidgeometries.gml
@@ -0,0 +1,19 @@
+
+
+
+
+ 122.1763203897661-8.606355050987483
+ 122.1903768142314-8.595792419886385
+
+
+
+
+
+ 122.176320389766076,-8.601236237453875 122.179976685147238,-8.597742444089665 122.184526741621553,-8.598392452157425 122.188508041036584,-8.602129998547044 122.186395514816354,-8.606355050987483 122.183795482545321,-8.602617504597864 122.188508041036584,-8.598311201148954 122.190376814231385,-8.595792419886385 122.190376814231385,-8.595792419886385 122.176320389766076,-8.601236237453875
+
+
+
diff --git a/python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml b/python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml
index a02a50bc555..af2bb45c39e 100644
--- a/python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml
+++ b/python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml
@@ -1226,26 +1226,24 @@ tests:
name: expected/multipoint_delaunay.gml
type: vector
- - algorithm: qgis:idwinterpolationusingattribute
+ - algorithm: qgis:idwinterpolation
name: IDW interpolation using attribute
params:
- ATTRIBUTE: elev
CELLSIZE_X: 0.02667
CELLSIZE_Y: 0.02667
COLUMNS: 300
DISTANCE_COEFFICIENT: 2.0
EXTENT: 0, 8, -5, 3
- INPUT_LAYER:
- name: pointsz.gml
- type: vector
- LAYER_TYPE: '0'
+ INTERPOLATION_DATA:
+ name: pointsz.gml,False,1,0
+ type: interpolation
ROWS: 300
results:
OUTPUT_LAYER:
hash: 56d2671d50444f8571affba3f9e585830b82af5e380394178f521065
type: rasterhash
- - algorithm: qgis:idwinterpolationusingzvalues
+ - algorithm: qgis:idwinterpolation
name: IDW interpolation using Z value
params:
CELLSIZE_X: 0.02667
@@ -1253,28 +1251,25 @@ tests:
COLUMNS: 300
DISTANCE_COEFFICIENT: 2.0
EXTENT: 0, 8, -5, 3
- INPUT_LAYER:
- name: pointsz.gml
- type: vector
- LAYER_TYPE: '0'
+ INTERPOLATION_DATA:
+ name: pointsz.gml,True,-1,0
+ type: interpolation
ROWS: 300
results:
OUTPUT_LAYER:
hash: 56d2671d50444f8571affba3f9e585830b82af5e380394178f521065
type: rasterhash
- - algorithm: qgis:tininterpolationusingattribute
+ - algorithm: qgis:tininterpolation
name: TIN interpolation using attribute
params:
- ATTRIBUTE: elev
CELLSIZE_X: 0.02667
CELLSIZE_Y: 0.02667
COLUMNS: 300
EXTENT: 0, 8, -5, 3
- INPUT_LAYER:
- name: pointsz.gml
- type: vector
- LAYER_TYPE: '0'
+ INTERPOLATION_DATA:
+ name: pointsz.gml,False,1,0
+ type: interpolation
METHOD: '0'
ROWS: 300
results:
@@ -1285,17 +1280,16 @@ tests:
# name: expected/triangulation.gml
# type: vector
- - algorithm: qgis:tininterpolationusingzvalues
+ - algorithm: qgis:tininterpolation
name: TIN interpolation using Z value
params:
CELLSIZE_X: 0.02667
CELLSIZE_Y: 0.02667
COLUMNS: 300
EXTENT: 0, 8, -5, 3
- INPUT_LAYER:
- name: pointsz.gml
- type: vector
- LAYER_TYPE: '0'
+ INTERPOLATION_DATA:
+ name: pointsz.gml,True,-1,0
+ type: interpolation
METHOD: '1'
ROWS: 300
results:
@@ -2040,348 +2034,6 @@ tests:
name: expected/convex_hull_fields.gml
type: vector
- - algorithm: gdalogr:aspect
- name: aspect with standard parameters
- params:
- BAND: 1
- COMPUTE_EDGES: false
- INPUT:
- name: dem.tif
- type: raster
- TRIG_ANGLE: false
- ZERO_FLAT: false
- ZEVENBERGEN: false
- results:
- OUTPUT:
- hash: 8436df662a44a00762aa29768e5d6ecfaf2d42e9a4da02d8afc6e3f6
- type: rasterhash
-
- - algorithm: gdalogr:aspect
- name: aspect without NULL (-9999) values (0 instead)
- params:
- BAND: 1
- COMPUTE_EDGES: false
- INPUT:
- name: dem.tif
- type: raster
- TRIG_ANGLE: false
- ZERO_FLAT: true
- ZEVENBERGEN: false
- results:
- OUTPUT:
- hash: 43cccb440c7febb0095103eee3509b740e9f1bf2b3ad3b8a4c25622e
- type: rasterhash
-
- - algorithm: gdalogr:aspect
- name: aspect with trigonometric angle
- params:
- BAND: 1
- COMPUTE_EDGES: false
- INPUT:
- name: dem.tif
- type: raster
- TRIG_ANGLE: true
- ZERO_FLAT: false
- ZEVENBERGEN: false
- results:
- OUTPUT:
- hash: a95e8a09a613b551d3f33dfb4975c430f599dc55f761063ae9529124
- type: rasterhash
-
- - algorithm: gdalogr:aspect
- name: aspect zevenbergen
- params:
- BAND: 1
- COMPUTE_EDGES: false
- INPUT:
- name: dem.tif
- type: raster
- TRIG_ANGLE: false
- ZERO_FLAT: false
- ZEVENBERGEN: true
- results:
- OUTPUT:
- hash: 2cd5868b21efbd286f4977795143c89df77ac8976f8bc2a2c4e310d8
- type: rasterhash
-
-
- - algorithm: gdalogr:aspect
- name: aspect with edges
- params:
- BAND: 1
- COMPUTE_EDGES: true
- INPUT:
- name: dem.tif
- type: raster
- TRIG_ANGLE: false
- ZERO_FLAT: false
- ZEVENBERGEN: false
- results:
- OUTPUT:
- hash: d3a354c6e5f207779bb58f9bd23fd89a9f90a77d81aafc661d0ae077
- type: rasterhash
-
- - algorithm: gdalogr:cliprasterbyextent
- name: standard clip raster by extent
- params:
- BIGTIFF: '0'
- COMPRESS: '4'
- INPUT:
- name: dem.tif
- type: raster
- JPEGCOMPRESSION: 75
- PREDICTOR: 1
- PROJWIN: 18.67551824296977,18.697800756150787,45.78984181545589,45.804309302274866
- RTYPE: '5'
- TFW: false
- TILED: false
- ZLEVEL: 6
- results:
- OUTPUT:
- hash: 9913a7c0e1ced2c2ce1cd8f0e8103475bc2b0dd4d1d0adafe4920f93
- type: rasterhash
-
- - algorithm: gdalogr:cliprasterbyextent
- name: clip by extent and change no data values
- params:
- BIGTIFF: '0'
- COMPRESS: '4'
- INPUT:
- name: dem.tif
- type: raster
- JPEGCOMPRESSION: 75
- NO_DATA: '-9999'
- PREDICTOR: 1
- PROJWIN: 18.67460436727692,18.698371162148714,45.78995019401027,45.804344168369234
- RTYPE: '5'
- TFW: false
- TILED: false
- ZLEVEL: 6
- results:
- OUTPUT:
- hash: df5de501bcec0c10f738d77f3b48d5545b48f0a22e0e028a8b1ccbe7
- type: rasterhash
-
-
- - algorithm: gdalogr:cliprasterbymasklayer
- name: clip by extent standard (with crop to cutline)
- params:
- ALPHA_BAND: false
- BIGTIFF: '0'
- COMPRESS: '4'
- CROP_TO_CUTLINE: true
- INPUT:
- name: dem.tif
- type: raster
- JPEGCOMPRESSION: 75
- KEEP_RESOLUTION: false
- MASK:
- name: custom/polygon_mask.gml
- type: vector
- PREDICTOR: 1
- RTYPE: '5'
- TFW: false
- TILED: false
- ZLEVEL: 6
- results:
- OUTPUT:
- hash: 4f4720e4efe59a7f238f622659917bbeb5262369d15d5e2917dbcf8b
- type: rasterhash
-
- - algorithm: gdalogr:cliprasterbymasklayer
- name: clip by extent and change no data value
- params:
- ALPHA_BAND: false
- BIGTIFF: '0'
- COMPRESS: '4'
- CROP_TO_CUTLINE: true
- INPUT:
- name: dem.tif
- type: raster
- JPEGCOMPRESSION: 75
- KEEP_RESOLUTION: false
- MASK:
- name: custom/polygon_mask.gml
- type: vector
- NO_DATA: '-9999'
- PREDICTOR: 1
- RTYPE: '5'
- TFW: false
- TILED: false
- ZLEVEL: 6
- results:
- OUTPUT:
- hash: 1e0252e63c65dcf4ed1f2b17d2490d3e0331aeb59d8f59b59554f442
- type: rasterhash
-
- - algorithm: gdalogr:cliprasterbymasklayer
- name: clip by extent and add alpha band
- params:
- ALPHA_BAND: true
- BIGTIFF: '0'
- COMPRESS: '4'
- CROP_TO_CUTLINE: true
- INPUT:
- name: dem.tif
- type: raster
- JPEGCOMPRESSION: 75
- KEEP_RESOLUTION: false
- MASK:
- name: custom/polygon_mask.gml
- type: vector
- PREDICTOR: 1
- RTYPE: '5'
- TFW: false
- TILED: false
- ZLEVEL: 6
- results:
- OUTPUT:
- hash: 8f69431c6ff7db5174c1ca8e879ae39582fd4ce86f9b53edae0f38ce
- type: rasterhash
-
- - algorithm: gdalogr:cliprasterbymasklayer
- name: clip by extent without cropping to cutline
- params:
- ALPHA_BAND: false
- BIGTIFF: '0'
- COMPRESS: '4'
- CROP_TO_CUTLINE: false
- INPUT:
- name: dem.tif
- type: raster
- JPEGCOMPRESSION: 75
- KEEP_RESOLUTION: false
- MASK:
- name: custom/polygon_mask.gml
- type: vector
- PREDICTOR: 1
- RTYPE: '5'
- TFW: false
- TILED: false
- ZLEVEL: 6
- results:
- OUTPUT:
- hash: 638165612b8cf59c631533438633c6c5b0fd5d3698d6ce75b359eef3
- type: rasterhash
-
- - algorithm: gdalogr:hillshade
- name: hillshade standard
- params:
- ALTITUDE: 45.0
- AZIMUTH: 315.0
- BAND: 1
- COMPUTE_EDGES: false
- INPUT:
- name: dem.tif
- type: raster
- SCALE: 1.0
- ZEVENBERGEN: false
- Z_FACTOR: 1.0
- results:
- OUTPUT:
- hash: e5cf91b875b918682e456463165eddc4af4ae8855b143068e198ce2a
- type: rasterhash
-
- - algorithm: gdalogr:hillshade
- name: hillshade with edges calculation
- params:
- ALTITUDE: 45.0
- AZIMUTH: 315.0
- BAND: 1
- COMPUTE_EDGES: true
- INPUT:
- name: dem.tif
- type: raster
- SCALE: 1.0
- ZEVENBERGEN: false
- Z_FACTOR: 1.0
- results:
- OUTPUT:
- hash: 570671408b020c9cc817e876f0e8081e0b11920c7d297abfe1cb3368
- type: rasterhash
-
- - algorithm: gdalogr:hillshade
- name: hillshade with zevenbergen formula
- params:
- ALTITUDE: 45.0
- AZIMUTH: 315.0
- BAND: 1
- COMPUTE_EDGES: false
- INPUT:
- name: dem.tif
- type: raster
- SCALE: 1.0
- ZEVENBERGEN: true
- Z_FACTOR: 1.0
- results:
- OUTPUT:
- hash: ce2174ab155023367d38785fb867456c6a1ae3535ea0ec5ad7a694d5
- type: rasterhash
-
- - algorithm: gdalogr:slope
- name: slope with standard parameters
- params:
- AS_PERCENT: false
- BAND: 1
- COMPUTE_EDGES: false
- INPUT:
- name: dem.tif
- type: raster
- SCALE: 1.0
- ZEVENBERGEN: false
- results:
- OUTPUT:
- hash: 319c470de3315f440371d5df8a6e478a8ecaf1cf904a013dbf1b3a6a
- type: rasterhash
-
- - algorithm: gdalogr:slope
- name: slope with edges
- params:
- AS_PERCENT: false
- BAND: 1
- COMPUTE_EDGES: true
- INPUT:
- name: dem.tif
- type: raster
- SCALE: 1.0
- ZEVENBERGEN: false
- results:
- OUTPUT:
- hash: f7f8df8b6517fd8660304f7f2fbd6ade2ae68035f4dd9a224c80b465
- type: rasterhash
-
- - algorithm: gdalogr:slope
- name: slope with zevenbergen formula
- params:
- AS_PERCENT: false
- BAND: 1
- COMPUTE_EDGES: false
- INPUT:
- name: dem.tif
- type: raster
- SCALE: 1.0
- ZEVENBERGEN: true
- results:
- OUTPUT:
- hash: 90e42b1bc7be9cf7b4a729c6db44dde0bba39dd33012ade6bc8080e7
- type: rasterhash
-
- - algorithm: gdalogr:slope
- name: slope with percent instead of degree
- params:
- AS_PERCENT: true
- BAND: 1
- COMPUTE_EDGES: false
- INPUT:
- name: dem.tif
- type: raster
- SCALE: 1.0
- ZEVENBERGEN: false
- results:
- OUTPUT:
- hash: c9dc888254a571e7fbf66691fb72b35f030f87decf59ce67e32ad89d
- type: rasterhash
-
# These tests dissabled because algs require access to iface which
# is not available in the test suite.
#- algorithm: qgis:shortestpathpointtopoint
@@ -2438,3 +2090,43 @@ tests:
# OUTPUT_POLYGON:
# name: expected/servicearea_bounds.gml
# type: vector
+
+ - algorithm: qgis:createattributeindex
+ name: Create attribute index
+ params:
+ FIELD: id
+ INPUT:
+ name: custom/points.shp
+ type: vector
+ in_place: true
+ results:
+ INPUT:
+ name: expected/create_attr_index_points.shp
+ type: vector
+ in_place_result: true
+
+ - algorithm: qgis:createspatialindex
+ name: Create spatial index
+ params:
+ INPUT:
+ name: custom/points.shp
+ type: vector
+ in_place: true
+ results:
+ INPUT:
+ name: expected/create_attr_index_points.shp
+ type: vector
+ in_place_result: true
+
+ - algorithm: qgis:truncatetable
+ name: Truncate table
+ params:
+ INPUT:
+ name: custom/points.shp
+ type: vector
+ in_place: true
+ results:
+ INPUT:
+ name: expected/truncated.shp
+ type: vector
+ in_place_result: true
diff --git a/python/plugins/processing/tools/vector.py b/python/plugins/processing/tools/vector.py
index 1413ae5a883..4677940a712 100644
--- a/python/plugins/processing/tools/vector.py
+++ b/python/plugins/processing/tools/vector.py
@@ -24,6 +24,7 @@ from builtins import str
from builtins import range
from builtins import object
+
__author__ = 'Victor Olaya'
__date__ = 'February 2013'
__copyright__ = '(C) 2013, Victor Olaya'
@@ -42,13 +43,14 @@ import io
import psycopg2
from osgeo import ogr
-from qgis.PyQt.QtCore import QVariant, QSettings
+from qgis.PyQt.QtCore import QVariant, QSettings, QCoreApplication
from qgis.core import (Qgis, QgsFields, QgsField, QgsGeometry, QgsRectangle, QgsWkbTypes,
QgsSpatialIndex, QgsProject, QgsMapLayer, QgsVectorLayer,
QgsVectorFileWriter, QgsDistanceArea, QgsDataSourceUri, QgsCredentials,
QgsFeatureRequest, QgsWkbTypes)
from processing.core.ProcessingConfig import ProcessingConfig
+from processing.core.ProcessingLog import ProcessingLog
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from processing.tools import dataobjects, spatialite, postgis
@@ -95,6 +97,8 @@ def features(layer, request=QgsFeatureRequest()):
"""
class Features(object):
+ DO_NOT_CHECK, IGNORE, RAISE_EXCEPTION = range(3)
+
def __init__(self, layer, request):
self.layer = layer
self.selection = False
@@ -105,6 +109,27 @@ def features(layer, request=QgsFeatureRequest()):
else:
self.iter = layer.getFeatures(request)
+ invalidFeaturesMethod = ProcessingConfig.getSetting(ProcessingConfig.FILTER_INVALID_GEOMETRIES)
+
+ def filterFeature(f, ignoreInvalid):
+ geom = f.geometry()
+ if geom is None:
+ ProcessingLog.addToLog(ProcessingLog.LOG_INFO,
+ self.tr('Feature with NULL geometry found.'))
+ elif not geom.isGeosValid():
+ ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
+ self.tr('GEOS geoprocessing error: One or more input features have invalid geometry.'))
+ if ignoreInvalid:
+ return False
+ else:
+ raise GeoAlgorithmExecutionException(self.tr('Features with invalid geometries found. Please fix these geometries or specify the "Ignore invalid input features" flag'))
+ return True
+
+ if invalidFeaturesMethod == self.IGNORE:
+ self.iter = filter(lambda x: filterFeature(x, True), self.iter)
+ elif invalidFeaturesMethod == self.RAISE_EXCEPTION:
+ self.iter = filter(lambda x: filterFeature(x, False), self.iter)
+
def __iter__(self):
return self.iter
@@ -114,6 +139,9 @@ def features(layer, request=QgsFeatureRequest()):
else:
return int(self.layer.featureCount())
+ def tr(self, string):
+ return QCoreApplication.translate("FeatureIterator", string)
+
return Features(layer, request)
diff --git a/python/plugins/processing/ui/DlgModeler.ui b/python/plugins/processing/ui/DlgModeler.ui
index 42535793757..79da12ad29a 100644
--- a/python/plugins/processing/ui/DlgModeler.ui
+++ b/python/plugins/processing/ui/DlgModeler.ui
@@ -19,7 +19,7 @@
3
- 6
+ 2
@@ -55,7 +55,7 @@
Qt::WheelFocus
- QFrame::StyledPanel
+ QFrame::NoFrameQFrame::Plain
@@ -149,7 +149,7 @@
Qt::WheelFocus
- QFrame::StyledPanel
+ QFrame::NoFrameQFrame::Plain
@@ -171,7 +171,7 @@
4
- 6
+ 2
@@ -179,7 +179,7 @@
4
- 6
+ 0
@@ -219,7 +219,7 @@
0
- 0
+ 2
@@ -233,7 +233,7 @@
Qt::WheelFocus
- QFrame::StyledPanel
+ QFrame::NoFrameQFrame::Plain
@@ -252,18 +252,18 @@
- 4
+ 0
- 6
+ 2
- 4
+ 0
- 6
+ 0
@@ -309,7 +309,14 @@
+
+
+
+
+
+
+
@@ -361,6 +368,51 @@
Ctrl+Shift+S
+
+
+
+ :/images/themes/default/mActionZoomActual.svg:/images/themes/default/mActionZoomActual.svg
+
+
+ Zoom to &100%
+
+
+ Zoom to &100%
+
+
+ Ctrl+1
+
+
+
+
+
+ :/images/themes/default/mActionZoomIn.svg:/images/themes/default/mActionZoomIn.svg
+
+
+ Zoom in
+
+
+ Zoom in
+
+
+ Ctrl++
+
+
+
+
+
+ :/images/themes/default/mActionZoomOut.svg:/images/themes/default/mActionZoomOut.svg
+
+
+ Zoom out
+
+
+ Zoom out
+
+
+ Ctrl+-
+
+
@@ -373,6 +425,45 @@
Export as image
+
+
+
+ :/images/themes/default/mActionZoomFullExtent.svg:/images/themes/default/mActionZoomFullExtent.svg
+
+
+ Zoom full
+
+
+ Zoom full
+
+
+ Ctrl+0
+
+
+
+
+
+ :/images/themes/default/mActionSaveAsPDF.svg:/images/themes/default/mActionSaveAsPDF.svg
+
+
+ Export as PDF...
+
+
+ Export as PDF
+
+
+
+
+
+ :/images/themes/default/mActionSaveAsSVG.svg:/images/themes/default/mActionSaveAsSVG.svg
+
+
+ Export as SVG...
+
+
+ Export as SVG
+
+
diff --git a/python/pyplugin_installer/version_compare.py b/python/pyplugin_installer/version_compare.py
index 116ba723b2f..4071d3091fd 100644
--- a/python/pyplugin_installer/version_compare.py
+++ b/python/pyplugin_installer/version_compare.py
@@ -23,7 +23,7 @@ and recognizes all major notations, prefixes (ver. and version), delimiters
Usage: compareVersions(version1, version2)
-The function accepts arguments of any type convertable to unicode string
+The function accepts arguments of any type convertable to Unicode string
and returns integer value:
0 - the versions are equal
1 - version 1 is higher
@@ -31,7 +31,7 @@ and returns integer value:
-----------------------------------------------------------------------------
HOW DOES IT WORK...
-First, both arguments are converted to uppercase unicode and stripped of
+First, both arguments are converted to uppercase Unicode and stripped of
'VERSION' or 'VER.' prefix. Then they are chopped into a list of particular
numeric and alphabetic elements. The dots, dashes and underlines are recognized
as delimiters. Also numbers and non numbers are separated. See example below:
diff --git a/python/sip_helpers/CMakeLists.txt b/python/sip_helpers/CMakeLists.txt
index 88f0f812fcd..46460fbd069 100644
--- a/python/sip_helpers/CMakeLists.txt
+++ b/python/sip_helpers/CMakeLists.txt
@@ -17,7 +17,8 @@ INCLUDE_DIRECTORIES(SYSTEM
)
INCLUDE_DIRECTORIES(
- ${CMAKE_CURRENT_BINARY_DIR}/../core
+ ${CMAKE_BINARY_DIR}/python/core
+ ${CMAKE_BINARY_DIR}/src/core
../../src/core
../../src/core/auth
../../src/core/pal
diff --git a/resources/context_help/QgsDelimitedTextSourceSelect b/resources/context_help/QgsDelimitedTextSourceSelect
index 7c3f549c97b..9c8689ac1c2 100644
--- a/resources/context_help/QgsDelimitedTextSourceSelect
+++ b/resources/context_help/QgsDelimitedTextSourceSelect
@@ -166,9 +166,9 @@ are escaped.
Regular expressions are mini-language used to represent character patterns. There are many variations
of regular expression syntax - QGIS uses the syntax provided by the QRegExp class of the Qt framework.
In a regular expression delimited file each line is treated as a record. Each match of the regular expression in the line is treated as the end of a field.
-If the regular expression contains capture groups (eg (cat|dog))
+If the regular expression contains capture groups (e.g., (cat|dog))
then these are extracted as fields.
- If this is not desired then use non-capturing groups (eg (?:cat|dog)).
+ If this is not desired then use non-capturing groups (e.g., (?:cat|dog)).
The regular expression is treated differently if it is anchored to the start of the line (that is, the pattern starts with ^).
In this case the regular expression is matched against each line. If the line does not match it is discarded
@@ -190,12 +190,12 @@ The delimited text layer recognizes the following
well known text types -
POINT, MULTIPOINT, LINESTRING, MULTILINESTRING, POLYGON, and MULTIPOLYGON.
It will accept geometries with
-a Z coordinate (eg POINT Z), a measure (POINT M), or both (POINT ZM).
+a Z coordinate (e.g., POINT Z), a measure (POINT M), or both (POINT ZM).
It can also handle the PostGIS EWKT variation, in which the geometry is preceded by an spatial reference
-system id (eg SRID=4326;POINT(175.3 41.2)), and a variant used by Informix in which the WKT is
-preceded by an integer spatial reference id (eg 1 POINT(175.3 41.2)).
+system id (e.g., SRID=4326;POINT(175.3 41.2)), and a variant used by Informix in which the WKT is
+preceded by an integer spatial reference id (e.g., 1 POINT(175.3 41.2)).
In both cases the SRID is ignored.
diff --git a/resources/context_help/QgsOpenVectorLayerDialog b/resources/context_help/QgsOpenVectorLayerDialog
index af4a822755c..666844542e1 100644
--- a/resources/context_help/QgsOpenVectorLayerDialog
+++ b/resources/context_help/QgsOpenVectorLayerDialog
@@ -2,5 +2,5 @@
The open vector layer dialog is used to add vector data to the QGIS map view. Vector data are spatial data described using geometries of points, lines and polygons (enclosed areas).
QGIS supports vector data in a number of formats, including those supported by the OGR library data provider plugin, such as ESRI shape files, MapInfo MIF (interchange format) and MapInfo TAB (native format).
-QGIS supports PostGIS layers in a PostgreSQL database and SpatiaLite layers. Support for additional data types (eg. delimited text) is provided by additional data provider plugins. A list of OGR supported vector formats can be found in Appendix A.1 of the User Guide.
+QGIS supports PostGIS layers in a PostgreSQL database and SpatiaLite layers. Support for additional data types (e.g., delimited text) is provided by additional data provider plugins. A list of OGR supported vector formats can be found in Appendix A.1 of the User Guide.
Detailed description how to proceed with vector data is described in chapter 5 'Working with Vector Data'.
diff --git a/resources/context_help/QgsPgNewConnection b/resources/context_help/QgsPgNewConnection
index 6571f9c2b90..e744d548f74 100644
--- a/resources/context_help/QgsPgNewConnection
+++ b/resources/context_help/QgsPgNewConnection
@@ -27,6 +27,6 @@ This dialog allows you to define the settings for a connection to a PostgreSQL/P
Indicates that tables without geometry should also be listed by default.
-
When initializing layers, various queries may be needed to establish the characteristics of the geometries stored in the database table. When this option is checked, these queries examine only a sample of the rows and use the table statistics, rather than the entire table. This can drastically speed up operations on large datasets, but may result in incorrect characterization of layers (eg. the feature count of filtered layers will not be accurately determined) and may even cause strange behaviour in case columns that are supposed to be unique actually are not.
+
When initializing layers, various queries may be needed to establish the characteristics of the geometries stored in the database table. When this option is checked, these queries examine only a sample of the rows and use the table statistics, rather than the entire table. This can drastically speed up operations on large datasets, but may result in incorrect characterization of layers (e.g., the feature count of filtered layers will not be accurately determined) and may even cause strange behaviour in case columns that are supposed to be unique actually are not.
diff --git a/resources/context_help/QgsQueryBuilder b/resources/context_help/QgsQueryBuilder
index ebe2f13cbfa..15356522114 100644
--- a/resources/context_help/QgsQueryBuilder
+++ b/resources/context_help/QgsQueryBuilder
@@ -14,8 +14,8 @@ are sometimes limited (e.g. for shape files) or behave diffently.
diff --git a/resources/function_help/json/$area b/resources/function_help/json/$area
index fb15461a32f..f529aea95a9 100644
--- a/resources/function_help/json/$area
+++ b/resources/function_help/json/$area
@@ -1,6 +1,6 @@
{
"name": "$area",
"type": "function",
- "description": "Returns the area of the current feature. The area calculated by this function respects both the current project's ellipsoid setting and area unit settings. Eg, if an ellipsoid has been set for the project then the calculated area will be ellipsoidal, and if no ellipsoid is set then the calculated area will be planimetric.",
+ "description": "Returns the area of the current feature. The area calculated by this function respects both the current project's ellipsoid setting and area unit settings. For example, if an ellipsoid has been set for the project then the calculated area will be ellipsoidal, and if no ellipsoid is set then the calculated area will be planimetric.",
"examples": [ { "expression":"$area", "returns":"42"}]
}
diff --git a/resources/function_help/json/$length b/resources/function_help/json/$length
index 74dc20cac2b..72c4bc29acc 100644
--- a/resources/function_help/json/$length
+++ b/resources/function_help/json/$length
@@ -1,7 +1,7 @@
{
"name": "$length",
"type": "function",
- "description": "Returns the length of a linestring. If you need the length of a border of a polygon, use $perimeter instead. The length calculated by this function respects both the current project's ellipsoid setting and distance unit settings. Eg, if an ellipsoid has been set for the project then the calculated length will be ellipsoidal, and if no ellipsoid is set then the calculated length will be planimetric.",
+ "description": "Returns the length of a linestring. If you need the length of a border of a polygon, use $perimeter instead. The length calculated by this function respects both the current project's ellipsoid setting and distance unit settings. For example, if an ellipsoid has been set for the project then the calculated length will be ellipsoidal, and if no ellipsoid is set then the calculated length will be planimetric.",
"examples": [
{ "expression":"$length", "returns":"42.4711"}
]
diff --git a/resources/function_help/json/$perimeter b/resources/function_help/json/$perimeter
index cc1aec52aa8..d241c55ea65 100644
--- a/resources/function_help/json/$perimeter
+++ b/resources/function_help/json/$perimeter
@@ -1,7 +1,7 @@
{
"name": "$perimeter",
"type": "function",
- "description": "Returns the perimeter length of the current feature. The perimeter calculated by this function respects both the current project's ellipsoid setting and distance unit settings. Eg, if an ellipsoid has been set for the project then the calculated perimeter will be ellipsoidal, and if no ellipsoid is set then the calculated perimeter will be planimetric.",
+ "description": "Returns the perimeter length of the current feature. The perimeter calculated by this function respects both the current project's ellipsoid setting and distance unit settings. For example, if an ellipsoid has been set for the project then the calculated perimeter will be ellipsoidal, and if no ellipsoid is set then the calculated perimeter will be planimetric.",
"examples": [ { "expression":"$perimeter", "returns":"42"}
]
}
diff --git a/resources/function_help/json/boundary b/resources/function_help/json/boundary
index 2fb8b0f8b01..996684f66f3 100644
--- a/resources/function_help/json/boundary
+++ b/resources/function_help/json/boundary
@@ -1,7 +1,7 @@
{
"name": "boundary",
"type": "function",
- "description":"Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the geometry). For instance, a polygon geometry will have a boundary consisting of the linestrings for each ring in the polygon. Some geometry types do not have a defined boundary, eg points or geometry collections, and will return null.",
+ "description":"Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the geometry). For instance, a polygon geometry will have a boundary consisting of the linestrings for each ring in the polygon. Some geometry types do not have a defined boundary, e.g., points or geometry collections, and will return null.",
"arguments": [ {"arg":"geometry","description":"a geometry"} ],
"examples": [ { "expression":"geom_to_wkt(boundary(geom_from_wkt('Polygon((1 1, 0 0, -1 1, 1 1))')))", "returns":"'LineString(1 1,0 0,-1 1,1 1)'"}]
}
diff --git a/resources/function_help/json/color_part b/resources/function_help/json/color_part
index c54e4f57e18..d3ba42a40b1 100644
--- a/resources/function_help/json/color_part
+++ b/resources/function_help/json/color_part
@@ -1,7 +1,7 @@
{
"name": "color_part",
"type": "function",
- "description": "Returns a specific component from a color string, eg the red component or alpha component.",
+ "description": "Returns a specific component from a color string, e.g., the red component or alpha component.",
"arguments": [
{"arg":"color", "description":"a color string"},
{"arg":"component", "description":"a string corresponding to the color component to return. Valid options are:
red: RGB red component (0-255)
green: RGB green component (0-255)
blue: RGB blue component (0-255)
alpha: alpha (transparency) value (0-255)
hue: HSV hue (0-360)
saturation: HSV saturation (0-100)
value: HSV value (0-100)
hsl_hue: HSL hue (0-360)
hsl_saturation: HSL saturation (0-100)
lightness: HSL lightness (0-100)
cyan: CMYK cyan component (0-100)
magenta: CMYK magenta component (0-100)
yellow: CMYK yellow component (0-100)
black: CMYK black component (0-100)
"}
diff --git a/resources/function_help/json/layer_property b/resources/function_help/json/layer_property
index ca98189e151..470c33db79b 100644
--- a/resources/function_help/json/layer_property
+++ b/resources/function_help/json/layer_property
@@ -4,7 +4,7 @@
"description": "Returns a matching layer property or metadata value.",
"arguments": [
{"arg":"layer", "description":"a string, representing either a layer name or layer ID"},
- {"arg":"property", "description":"a string corresponding to the property to return. Valid options are:
name: layer name
id: layer ID
title: metadata title string
abstract: metadata abstract string
keywords: metadata keywords
data_url: metadata URL
attribution: metadata attribution string
attribution_url: metadata attribution URL
source: layer source
min_scale: minimum display scale for layer
max_scale: maximum display scale for layer
crs: layer CRS
crs_definition: layer CRS full definition
extent: layer extent (as a geometry object)
type: layer type, eg Vector or Raster
storage_type: storage format (vector layers only)
geometry_type: geometry type, eg Point (vector layers only)
feature_count: approximate feature count for layer (vector layers only)
"}
+ {"arg":"property", "description":"a string corresponding to the property to return. Valid options are:
name: layer name
id: layer ID
title: metadata title string
abstract: metadata abstract string
keywords: metadata keywords
data_url: metadata URL
attribution: metadata attribution string
attribution_url: metadata attribution URL
source: layer source
min_scale: minimum display scale for layer
max_scale: maximum display scale for layer
crs: layer CRS
crs_definition: layer CRS full definition
extent: layer extent (as a geometry object)
type: layer type, e.g., Vector or Raster
storage_type: storage format (vector layers only)
geometry_type: geometry type, e.g., Point (vector layers only)
feature_count: approximate feature count for layer (vector layers only)
"}
],
"examples": [
{ "expression":"layer_property('streets','title')", "returns":"'Basemap Streets'"},
diff --git a/resources/function_help/json/longest_common_substring b/resources/function_help/json/longest_common_substring
index 2b8ff7d0d72..a7fd0e358a6 100644
--- a/resources/function_help/json/longest_common_substring
+++ b/resources/function_help/json/longest_common_substring
@@ -1,7 +1,7 @@
{
"name": "longest_common_substring",
"type": "function",
- "description": "Returns the longest common substring between two strings. This substring is the longest string that is a substring of the two input strings. Eg, the longest common substring of \"ABABC\" and \"BABCA\" is \"ABC\". The substring is case sensitive.",
+ "description": "Returns the longest common substring between two strings. This substring is the longest string that is a substring of the two input strings. For example, the longest common substring of \"ABABC\" and \"BABCA\" is \"ABC\". The substring is case sensitive.",
"arguments": [
{"arg":"string1","description":"a string"},
{"arg":"string2","description":"a string"}
diff --git a/resources/function_help/json/regexp_match b/resources/function_help/json/regexp_match
index 330010deefd..cd97cb1ae61 100644
--- a/resources/function_help/json/regexp_match
+++ b/resources/function_help/json/regexp_match
@@ -3,7 +3,7 @@
"type": "function",
"description": "Return the first matching position matching a regular expression within a string, or 0 if the substring is not found.",
"arguments": [ {"arg":"input_string","description":"the string to test against the regular expression"},
- {"arg":"regex","description":"The regular expression to test against. Backslash characters must be double escaped (eg \"\\\\\\\\s\" to match a white space character)."}
+ {"arg":"regex","description":"The regular expression to test against. Backslash characters must be double escaped (e.g., \"\\\\\\\\s\" to match a white space character)."}
],
"examples": [ { "expression":"regexp_match('QGIS ROCKS','\\\\\\\\sROCKS')", "returns":"4"}]
}
diff --git a/resources/function_help/json/regexp_matches b/resources/function_help/json/regexp_matches
index 7b77ecfe05b..68f914564d0 100644
--- a/resources/function_help/json/regexp_matches
+++ b/resources/function_help/json/regexp_matches
@@ -6,7 +6,7 @@
{"arg":"string", "description":"the string to capture groups from against the regular expression"},
{"arg":"regex","description":"the regular expression used to capture groups"},
{"arg":"empty_value","optional":true,"default":"''","description":"the optional string to use as replacement for empty (zero length) matches"}],
- "examples": [ { "expression":"regexp_matches('qgis=>rocks','(.*)=>(.*)')", "returns":"array: 'qgis', 'rocks'"},
+ "examples": [ { "expression":"regexp_matches('QGIS=>rocks','(.*)=>(.*)')", "returns":"array: 'QGIS', 'rocks'"},
{ "expression":"regexp_matches('key=>','(.*)=>(.*)','empty value')", "returns":"array: 'key', 'empty value'"}
]
}
diff --git a/resources/function_help/json/regexp_replace b/resources/function_help/json/regexp_replace
index f480f29bb71..de5beeb83d3 100644
--- a/resources/function_help/json/regexp_replace
+++ b/resources/function_help/json/regexp_replace
@@ -3,7 +3,7 @@
"type": "function",
"description": "Returns a string with the supplied regular expression replaced.",
"arguments": [ {"arg":"input_string","description":"the string to replace matches in"},
- {"arg":"regex","description":"The regular expression to replace. Backslash characters must be double escaped (eg \"\\\\\\\\s\" to match a white space character)."},
+ {"arg":"regex","description":"The regular expression to replace. Backslash characters must be double escaped (e.g., \"\\\\\\\\s\" to match a white space character)."},
{"arg":"replacement","description":"The string that will replace any matching occurrences of the supplied regular expression. Captured groups can be inserted into the replacement string using \\\\\\\\1, \\\\\\\\2, etc."}
],
"examples": [ { "expression":"regexp_replace('QGIS SHOULD ROCK','\\\\\\\\sSHOULD\\\\\\\\s',' DOES ')", "returns":"'QGIS DOES ROCK'"}]
diff --git a/resources/function_help/json/regexp_substr b/resources/function_help/json/regexp_substr
index 7ce1beb3f2d..857a44330b5 100644
--- a/resources/function_help/json/regexp_substr
+++ b/resources/function_help/json/regexp_substr
@@ -3,7 +3,7 @@
"type": "function",
"description": "Returns the portion of a string which matches a supplied regular expression.",
"arguments": [ {"arg":"input_string","description":"the string to find matches in"},
- {"arg":"regex","description":"The regular expression to match against. Backslash characters must be double escaped (eg \"\\\\\\\\s\" to match a white space character)."}
+ {"arg":"regex","description":"The regular expression to match against. Backslash characters must be double escaped (e.g., \"\\\\\\\\s\" to match a white space character)."}
],
"examples": [ { "expression":"regexp_substr('abc123','(\\\\\\\\d+)')", "returns":"'123'"}]
}
diff --git a/resources/function_help/json/set_color_part b/resources/function_help/json/set_color_part
index 2abdd631322..e4cf8f0ba43 100644
--- a/resources/function_help/json/set_color_part
+++ b/resources/function_help/json/set_color_part
@@ -1,7 +1,7 @@
{
"name": "set_color_part",
"type": "function",
- "description": "Sets a specific color component for a color string, eg the red component or alpha component.",
+ "description": "Sets a specific color component for a color string, e.g., the red component or alpha component.",
"arguments": [
{"arg":"color", "description":"a color string"},
{"arg":"component", "description":"a string corresponding to the color component to set. Valid options are:
red: RGB red component (0-255)
green: RGB green component (0-255)
blue: RGB blue component (0-255)
alpha: alpha (transparency) value (0-255)
hue: HSV hue (0-360)
saturation: HSV saturation (0-100)
value: HSV value (0-100)
hsl_hue: HSL hue (0-360)
hsl_saturation: HSL saturation (0-100)
lightness: HSL lightness (0-100)
cyan: CMYK cyan component (0-100)
magenta: CMYK magenta component (0-100)
yellow: CMYK yellow component (0-100)
black: CMYK black component (0-100)
"},
diff --git a/resources/function_help/json/simplify_vw b/resources/function_help/json/simplify_vw
index ad4f84b9009..1543092fc01 100644
--- a/resources/function_help/json/simplify_vw
+++ b/resources/function_help/json/simplify_vw
@@ -1,7 +1,7 @@
{
"name": "simplify_vw",
"type": "function",
- "description":"Simplifies a geometry by removing nodes using an area based threshold (ie, the Visvalingam-Whyatt algorithm). The algorithm removes vertices which create small areas in geometries, eg narrow spikes or nearly straight segments.",
+ "description":"Simplifies a geometry by removing nodes using an area based threshold (ie, the Visvalingam-Whyatt algorithm). The algorithm removes vertices which create small areas in geometries, e.g., narrow spikes or nearly straight segments.",
"arguments": [ {"arg":"geometry","description":"a geometry"},
{"arg":"tolerance","description":"a measure of the maximum area created by a node for the node to be removed"} ],
"examples": [ { "expression":"geom_to_wkt(simplify_vw(geometry:=geom_from_wkt('LineString(0 0, 5 0, 5.01 10, 5.02 0, 10 0)'),tolerance:=5))", "returns":"'LineString(0 0, 10 0)'"}]
diff --git a/resources/symbology-ng-style.xml b/resources/symbology-ng-style.xml
index 723fae7d38c..d0cf49f0c02 100644
--- a/resources/symbology-ng-style.xml
+++ b/resources/symbology-ng-style.xml
@@ -4078,19 +4078,19 @@
-
+
-
+
-
+
@@ -4197,7 +4197,7 @@
-
+
@@ -4227,13 +4227,13 @@
-
+
-
+
diff --git a/scripts/chkspelling_ag.sh b/scripts/chkspelling_ag.sh
index ad44767959c..29e54a13a4a 100755
--- a/scripts/chkspelling_ag.sh
+++ b/scripts/chkspelling_ag.sh
@@ -1,6 +1,6 @@
#!/bin/bash
###########################################################################
-# chkspelling.sh
+# chkspelling_ag.sh
# ---------------------
# Date : December 2016
# Copyright : (C) 2016 by Denis Rouzaud
@@ -40,7 +40,7 @@ if [[ ! -z $OUTPUT ]]; then
# < ---------- get files + error ---------------------------------------------------------------------->
ag --smart-case --only-matching --nogroup --nonumbers --all-text --word-regexp -p $AGIGNORE "$RE" $FILES | \
# <-- generate sed command .... <------------------------------ get correction word ----------------------------------> <------------------------------- match case -------------------------------------------> <-----replace : by / and add word boundary------> ...finalize sed command>
- sed -e 's/\(\S*\):\([[:alnum:]]*\)$/ echo "sed -i \x27s\/"$( echo "\2:$(ag --nonumbers --ignore-case --word-regexp \2 scripts\/spelling.dat | cut -d: -f2)" | sed -r \x27s\/([A-Z]+):(.*)\/\\1:\\U\\2\/; s\/([A-Z][a-z]+):([a-z])\/\\1:\\U\\2\\L\/\x27 | sed -r \x27s\/(\\S\*):\/\\\\b\\1\\\\b\\\/\/\x27)"\/g\x27 \1" /e' | \
+ sed -e 's/\(\S*\):\([[:alnum:]]*\)$/ echo "sed -i \x27s\/\/"$( echo "\2:$(ag --nonumbers --ignore-case --word-regexp \2 scripts\/spelling.dat | cut -d: -f2)" | sed -r \x27s\/([A-Z]+):(.*)\/\\1:\\U\\2\/; s\/([A-Z][a-z]+):([a-z])\/\\1:\\U\\2\\L\/\x27 | sed -r \x27s\/(\\S\*):\/\\\\b\\1\\\\b\\\/\/\x27)"\/g\x27 \1" /e' | \
# remove duplicate line
sort -u
echo "****"
diff --git a/scripts/qgis_fixes/fix_uiimport.py b/scripts/qgis_fixes/fix_uiimport.py
index 0ed6b937dcb..e4a924ba71c 100644
--- a/scripts/qgis_fixes/fix_uiimport.py
+++ b/scripts/qgis_fixes/fix_uiimport.py
@@ -20,9 +20,9 @@ class FixUiimport(fixer_base.BaseFix):
imp = results.get('imp')
if node.type == syms.import_from:
- # Some imps are top-level (eg: 'import ham')
- # some are first level (eg: 'import ham.eggs')
- # some are third level (eg: 'import ham.eggs as spam')
+ # Some imps are top-level (e.g., 'import ham')
+ # some are first level (e.g., 'import ham.eggs')
+ # some are third level (e.g., 'import ham.eggs as spam')
# Hence, the loop
while not hasattr(imp, 'value'):
imp = imp.children[0]
diff --git a/scripts/qgis_srs.sh b/scripts/qgis_srs.sh
index bc7d24dbfef..5a3ca124c5d 100755
--- a/scripts/qgis_srs.sh
+++ b/scripts/qgis_srs.sh
@@ -55,7 +55,7 @@
# DETAILS:
#
# The script creates an SQL plain text dump that can be imported into
-# SQlite db eg. using SQLite Database Browser's "Import > Database from
+# SQlite db e.g.,. using SQLite Database Browser's "Import > Database from
# SQL file" tool.
#
# The ellipsoids (tbl_ellipsoid) and projections (tbl_projection) tables
diff --git a/scripts/spelling.dat b/scripts/spelling.dat
index 4b0487df0a2..bc208aa934c 100644
--- a/scripts/spelling.dat
+++ b/scripts/spelling.dat
@@ -67,6 +67,7 @@ attemtps:attempts
attribut:attribute
attruibutes:attributes
authentification:authentication
+automaticaly:automatically
automaticly:automatically
automatize:automate
automatized:automated
@@ -91,6 +92,7 @@ calender:calendar
cancelation:cancellation
capabilites:capabilities
capatibilities:capabilities
+capitalise:capitalize
cariage:carriage
centimetre:centimeter
centimetres:centimeters
@@ -139,6 +141,7 @@ debians:Debian's
decompres:decompress
definate:definite
definately:definitely
+definintion:definition
deimiter:delimiter
delemeter:delimiter
delemiter:delimiter
@@ -193,8 +196,10 @@ extention:extension
failuer:failure
familar:familiar
fatser:faster
-feture:feature
fetaures:features
+feture:feature
+flavour:flavor
+flavours:flavors
forse:force
fortan:fortran
forwardig:forwarding
@@ -208,9 +213,9 @@ furter:further
futher:further
futhermore:furthermore
generiously:generously
-granulatiry:granularity
grahical:graphical
grahpical:graphical
+granulatiry:granularity
grapic:graphic
guage:gauge
halfs:halves
@@ -235,8 +240,8 @@ informatiom:information
informations:information
infromation:information
initalize:initialize
-initialisation:initialization
initators:initiators
+initialisation:initialization
initializiation:initialization
inofficial:unofficial
instersction:intersection
@@ -244,6 +249,7 @@ integreated:integrated
integrety:integrity
integrey:integrity
intendet:intended
+interactivly:interactively
interchangable:interchangeable
intermittant:intermittent
intersecton:intersection
@@ -254,6 +260,7 @@ jave:java
kilometre:kilometer
kilometres:kilometers
labelling:labeling
+labour:labor
langage:language
langauage:language
langugage:language
@@ -284,6 +291,7 @@ microprocesspr:microprocessor
millimetre:millimeter
millimetres:millimeters
milliseonds:milliseconds
+minimise:minimize
miscelleneous:miscellaneous
misformed:malformed
mispelled:misspelled
@@ -336,6 +344,7 @@ paramter:parameter
paramters:parameters
particularily:particularly
pased:passed
+peference:preference
peprocessor:preprocessor
perfoming:performing
permissons:permissions
@@ -356,6 +365,8 @@ prepaired:prepared
primative:primitive
princliple:principle
priorty:priority
+prioritise:prioritize
+prioritising:prioritizing
proccesors:processors
proces:process
processessing:processing
@@ -378,6 +389,7 @@ protecion:protection
protocoll:protocol
psychadelic:psychedelic
quering:querying
+rasterise:rasterize
recieve:receive
recieved:received
reciever:receiver
@@ -458,6 +470,7 @@ supress:suppress
surpress:suppress
suspicously:suspiciously
swaped:swapped
+symbo:symbol
syle:style
symetrical:symmetrical
synax:syntax
@@ -507,5 +520,6 @@ wich:which
widht:width
wierd:weird
writeable:writable
+writting:writing
xwindows:X
yur:your
diff --git a/scripts/tsstat.pl b/scripts/tsstat.pl
index b7657a26fdd..77b56ed4c83 100755
--- a/scripts/tsstat.pl
+++ b/scripts/tsstat.pl
@@ -45,6 +45,7 @@ my $translators= {
'de' => 'Jürgen E. Fischer, Stephan Holl, Otto Dassau, Werner Macho',
'es' => 'Carlos Dávila, Javier César Aldariz, Gabriela Awad, Edwin Amado, Mayeul Kauffmann, Diana Galindo',
'el' => 'Theodoros Vakkas, Ioannis Tsimpiris, Evripidis Argyropoulos, Mike Pegnigiannis, Nikos Ves',
+ 'eo' => 'Augustin Roche, Nikolay Korotkiy',
'et' => 'Veiko Viil',
'eu' => 'Asier Sarasua Garmendia, Irantzu Alvarez',
'fa' => 'Mola Pahnadayan, Masoud Pashotan , Masoud Erfanyan',
diff --git a/src/analysis/CMakeLists.txt b/src/analysis/CMakeLists.txt
index 062cdb6aa15..d0632074d76 100644
--- a/src/analysis/CMakeLists.txt
+++ b/src/analysis/CMakeLists.txt
@@ -162,6 +162,8 @@ INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}/../core/geometry
${CMAKE_CURRENT_SOURCE_DIR}/../core/raster
${CMAKE_CURRENT_SOURCE_DIR}/../core/symbology-ng
+ ${CMAKE_BINARY_DIR}/src/core
+ ${CMAKE_BINARY_DIR}/src/analysis
interpolation
network
)
@@ -172,14 +174,19 @@ INCLUDE_DIRECTORIES(SYSTEM
${SQLITE3_INCLUDE_DIR}
)
-REMOVE_DEFINITIONS("-DANALYSIS_EXPORT=${DLLIMPORT}")
-ADD_DEFINITIONS("\"-DANALYSIS_EXPORT=${DLLEXPORT}\"")
-
#############################################################
# qgis_analysis library
ADD_LIBRARY(qgis_analysis SHARED ${QGIS_ANALYSIS_SRCS} ${QGIS_ANALYSIS_MOC_SRCS} ${QGIS_ANALYSIS_HDRS})
+GENERATE_EXPORT_HEADER(
+ qgis_analysis
+ BASE_NAME ANALYSIS
+ EXPORT_FILE_NAME qgis_analysis.h
+ )
+
+SET(QGIS_ANALYSIS_HDRS ${QGIS_ANALYSIS_HDRS} ${CMAKE_CURRENT_BINARY_DIR}/qgis_analysis.h)
+
IF(NOT APPLE)
INSTALL(FILES ${QGIS_ANALYSIS_HDRS} DESTINATION ${QGIS_INCLUDE_DIR})
ELSE(NOT APPLE)
diff --git a/src/analysis/interpolation/Bezier3D.h b/src/analysis/interpolation/Bezier3D.h
index bc471924f61..872305f8d45 100644
--- a/src/analysis/interpolation/Bezier3D.h
+++ b/src/analysis/interpolation/Bezier3D.h
@@ -19,6 +19,7 @@
#include "ParametricLine.h"
#include "qgslogger.h"
+#include "qgis_analysis.h"
/** \ingroup analysis
* Class Bezier3D represents a bezier curve, represented by control points. Parameter t is running from 0 to 1. The class is capable to calculate the curve point and the first two derivatives belonging to t.*/
@@ -31,7 +32,7 @@ class ANALYSIS_EXPORT Bezier3D: public ParametricLine
Bezier3D();
//! Constructor, par is a pointer to the parent, controlpoly a controlpolygon
Bezier3D( ParametricLine* par, QVector* controlpoly );
- //! Destructor
+
virtual ~Bezier3D();
//! Do not use this method, since a Bezier curve does not consist of other curves
virtual void add( ParametricLine *pl ) override;
diff --git a/src/analysis/interpolation/CloughTocherInterpolator.h b/src/analysis/interpolation/CloughTocherInterpolator.h
index 7458c962c3e..e6fdd3b7b8f 100644
--- a/src/analysis/interpolation/CloughTocherInterpolator.h
+++ b/src/analysis/interpolation/CloughTocherInterpolator.h
@@ -19,6 +19,7 @@
#include "TriangleInterpolator.h"
#include "Point3D.h"
+#include "qgis_analysis.h"
class NormVecDecorator;
@@ -81,7 +82,6 @@ class ANALYSIS_EXPORT CloughTocherInterpolator : public TriangleInterpolator
CloughTocherInterpolator();
//! Constructor with a pointer to the triangulation as argument
CloughTocherInterpolator( NormVecDecorator* tin );
- //! Destructor
virtual ~CloughTocherInterpolator();
//! Calculates the normal vector and assigns it to vec (not implemented at the moment)
virtual bool calcNormVec( double x, double y, Vector3D* result ) override;
diff --git a/src/analysis/interpolation/DualEdgeTriangulation.h b/src/analysis/interpolation/DualEdgeTriangulation.h
index f3c3830d463..289fda8ed45 100644
--- a/src/analysis/interpolation/DualEdgeTriangulation.h
+++ b/src/analysis/interpolation/DualEdgeTriangulation.h
@@ -31,6 +31,7 @@
#include
#include
#include
+#include "qgis_analysis.h"
/** \ingroup analysis
* DualEdgeTriangulation is an implementation of a triangulation class based on the dual edge data structure*/
diff --git a/src/analysis/interpolation/HalfEdge.h b/src/analysis/interpolation/HalfEdge.h
index 17d26874778..678eb964288 100644
--- a/src/analysis/interpolation/HalfEdge.h
+++ b/src/analysis/interpolation/HalfEdge.h
@@ -17,6 +17,8 @@
#ifndef HALFEDGE_H
#define HALFEDGE_H
+#include "qgis_analysis.h"
+
/** \ingroup analysis
* \class HalfEdge
*/
@@ -38,7 +40,7 @@ class ANALYSIS_EXPORT HalfEdge
//! Default constructor. Values for mDual, mNext, mPoint are set to -10 which means that they are undefined
HalfEdge();
HalfEdge( int dual, int next, int point, bool mbreak, bool forced );
- ~HalfEdge();
+
//! Returns the number of the dual HalfEdge
int getDual() const;
//! Returns the number of the next HalfEdge
@@ -71,11 +73,6 @@ inline HalfEdge::HalfEdge( int dual, int next, int point, bool mbreak, bool forc
}
-inline HalfEdge::~HalfEdge()
-{
-
-}
-
inline int HalfEdge::getDual() const
{
return mDual;
diff --git a/src/analysis/interpolation/LinTriangleInterpolator.h b/src/analysis/interpolation/LinTriangleInterpolator.h
index 75de7762533..06c7e16bb38 100644
--- a/src/analysis/interpolation/LinTriangleInterpolator.h
+++ b/src/analysis/interpolation/LinTriangleInterpolator.h
@@ -19,6 +19,7 @@
#include "TriangleInterpolator.h"
#include "DualEdgeTriangulation.h"
+#include "qgis_analysis.h"
/** \ingroup analysis
* LinTriangleInterpolator is a class which interpolates linearly on a triangulation*/
@@ -29,7 +30,6 @@ class ANALYSIS_EXPORT LinTriangleInterpolator : public TriangleInterpolator
LinTriangleInterpolator();
//! Constructor with reference to a DualEdgeTriangulation object
LinTriangleInterpolator( DualEdgeTriangulation* tin );
- //! Destructor
virtual ~LinTriangleInterpolator();
//! Calculates the normal vector and assigns it to vec
virtual bool calcNormVec( double x, double y, Vector3D* result ) override;
diff --git a/src/analysis/interpolation/Line3D.h b/src/analysis/interpolation/Line3D.h
index f0635f86c38..ce7f80e507e 100644
--- a/src/analysis/interpolation/Line3D.h
+++ b/src/analysis/interpolation/Line3D.h
@@ -18,6 +18,7 @@
#define LINE3D_H
#include "Node.h"
+#include "qgis_analysis.h"
/** \ingroup analysis
* This class represents a line. It is implemented as a single directed linked list of nodes (with related Point3D objects). Attention: the points inserted in a line are not deleted from Line3D*/
diff --git a/src/analysis/interpolation/MathUtils.h b/src/analysis/interpolation/MathUtils.h
index 8cab13a703a..986754b19f1 100644
--- a/src/analysis/interpolation/MathUtils.h
+++ b/src/analysis/interpolation/MathUtils.h
@@ -18,6 +18,7 @@
#define MATHUTILS_H
#include
+#include "qgis_analysis.h"
class Point3D;
class Vector3D;
diff --git a/src/analysis/interpolation/Node.h b/src/analysis/interpolation/Node.h
index 0e941ebec9c..a481ab830f3 100644
--- a/src/analysis/interpolation/Node.h
+++ b/src/analysis/interpolation/Node.h
@@ -18,6 +18,7 @@
#define NODE_H
#include "Point3D.h"
+#include "qgis_analysis.h"
/** \ingroup analysis
* Node is a class used by Line3D. It represents a node in the single directed linked list. Associated Point3D objects are deleted when the node is deleted.*/
diff --git a/src/analysis/interpolation/NormVecDecorator.h b/src/analysis/interpolation/NormVecDecorator.h
index d69dd69964b..4dd93f5ec7d 100644
--- a/src/analysis/interpolation/NormVecDecorator.h
+++ b/src/analysis/interpolation/NormVecDecorator.h
@@ -21,6 +21,7 @@
#include
#include
#include "qgslogger.h"
+#include "qgis_analysis.h"
class QProgressDialog;
diff --git a/src/analysis/interpolation/ParametricLine.h b/src/analysis/interpolation/ParametricLine.h
index 1204c9a86c4..5243418bc23 100644
--- a/src/analysis/interpolation/ParametricLine.h
+++ b/src/analysis/interpolation/ParametricLine.h
@@ -19,6 +19,7 @@
#include "Point3D.h"
#include
+#include "qgis_analysis.h"
class Vector3D;
@@ -41,7 +42,6 @@ class ANALYSIS_EXPORT ParametricLine
/** Constructor, par is a pointer to the parent object, controlpoly the controlpolygon
*/
ParametricLine( ParametricLine* par, QVector* controlpoly );
- //! Destructor
virtual ~ParametricLine();
virtual void add( ParametricLine* pl ) = 0;
virtual void calcFirstDer( float t, Vector3D* v ) = 0;
diff --git a/src/analysis/interpolation/Point3D.h b/src/analysis/interpolation/Point3D.h
index 013d4832d8f..9e4e31d5138 100644
--- a/src/analysis/interpolation/Point3D.h
+++ b/src/analysis/interpolation/Point3D.h
@@ -18,6 +18,7 @@
#define POINT3D_H
#include
+#include "qgis_analysis.h"
/** \ingroup analysis
* Point3D is a class to represent a three dimensional point*/
@@ -35,7 +36,6 @@ class ANALYSIS_EXPORT Point3D
//! Constructor with the x-, y- and z-coordinate as arguments
Point3D( double x, double y, double z );
Point3D( const Point3D& p );
- ~Point3D();
Point3D& operator=( const Point3D& p );
bool operator==( const Point3D& p ) const;
bool operator!=( const Point3D& p ) const;
@@ -76,11 +76,6 @@ inline Point3D::Point3D( const Point3D& p ): mX( p.mX ), mY( p.mY ), mZ( p.mZ )
}
-inline Point3D::~Point3D()
-{
-
-}
-
inline double Point3D::getX() const
{
return mX;
diff --git a/src/analysis/interpolation/TriDecorator.h b/src/analysis/interpolation/TriDecorator.h
index 2c65eff9925..c2d7876c73d 100644
--- a/src/analysis/interpolation/TriDecorator.h
+++ b/src/analysis/interpolation/TriDecorator.h
@@ -18,6 +18,7 @@
#define TRIDECORATOR_H
#include "Triangulation.h"
+#include "qgis_analysis.h"
/** \ingroup analysis
* Decorator class for Triangulations (s. Decorator pattern in Gamma et al.)*/
diff --git a/src/analysis/interpolation/TriangleInterpolator.h b/src/analysis/interpolation/TriangleInterpolator.h
index 4155ca29a00..a67108a27f8 100644
--- a/src/analysis/interpolation/TriangleInterpolator.h
+++ b/src/analysis/interpolation/TriangleInterpolator.h
@@ -19,13 +19,14 @@
#include
#include
+#include "qgis_analysis.h"
/** \ingroup analysis
* This is an interface for interpolator classes for triangulations*/
class ANALYSIS_EXPORT TriangleInterpolator
{
public:
- virtual ~TriangleInterpolator() {}
+ virtual ~TriangleInterpolator() = default;
//! Calculates the normal vector and assigns it to vec
virtual bool calcNormVec( double x, double y, Vector3D* result ) = 0;
//! Performs a linear interpolation in a triangle and assigns the x-,y- and z-coordinates to point
diff --git a/src/analysis/interpolation/Triangulation.h b/src/analysis/interpolation/Triangulation.h
index d6edfb19a68..33d0aa29e2b 100644
--- a/src/analysis/interpolation/Triangulation.h
+++ b/src/analysis/interpolation/Triangulation.h
@@ -20,6 +20,7 @@
#include
#include
#include
+#include "qgis_analysis.h"
class Line3D;
diff --git a/src/analysis/interpolation/Vector3D.h b/src/analysis/interpolation/Vector3D.h
index f4ae8441614..a28d524eee8 100644
--- a/src/analysis/interpolation/Vector3D.h
+++ b/src/analysis/interpolation/Vector3D.h
@@ -18,6 +18,7 @@
#define VECTOR3D_H
#include
+#include "qgis_analysis.h"
/** \ingroup analysis
* Class Vector3D represents a 3D-Vector, capable to store x-,y- and
@@ -42,8 +43,7 @@ class ANALYSIS_EXPORT Vector3D
Vector3D();
//! Copy constructor
Vector3D( const Vector3D& v );
- //! Destructor
- ~Vector3D();
+
Vector3D& operator=( const Vector3D& v );
bool operator==( const Vector3D& v ) const;
bool operator!=( const Vector3D& v ) const;
@@ -83,11 +83,6 @@ inline Vector3D::Vector3D()
}
-inline Vector3D::~Vector3D()
-{
-
-}
-
//-------------------------------------------setter and getters-------------------------------
inline double Vector3D::getX() const
diff --git a/src/analysis/interpolation/qgsgridfilewriter.h b/src/analysis/interpolation/qgsgridfilewriter.h
index 9c4e7cfa2b9..beb8ed21497 100644
--- a/src/analysis/interpolation/qgsgridfilewriter.h
+++ b/src/analysis/interpolation/qgsgridfilewriter.h
@@ -21,6 +21,7 @@
#include "qgsrectangle.h"
#include
#include
+#include "qgis_analysis.h"
class QgsInterpolator;
diff --git a/src/analysis/interpolation/qgsidwinterpolator.cpp b/src/analysis/interpolation/qgsidwinterpolator.cpp
index 1eedbce81b7..22995fee70a 100644
--- a/src/analysis/interpolation/qgsidwinterpolator.cpp
+++ b/src/analysis/interpolation/qgsidwinterpolator.cpp
@@ -29,11 +29,6 @@ QgsIDWInterpolator::QgsIDWInterpolator(): QgsInterpolator( QList() ),
}
-QgsIDWInterpolator::~QgsIDWInterpolator()
-{
-
-}
-
int QgsIDWInterpolator::interpolatePoint( double x, double y, double& result )
{
if ( !mDataIsCached )
diff --git a/src/analysis/interpolation/qgsidwinterpolator.h b/src/analysis/interpolation/qgsidwinterpolator.h
index 76ae1c290a9..93ef659a9aa 100644
--- a/src/analysis/interpolation/qgsidwinterpolator.h
+++ b/src/analysis/interpolation/qgsidwinterpolator.h
@@ -19,6 +19,7 @@
#define QGSIDWINTERPOLATOR_H
#include "qgsinterpolator.h"
+#include "qgis_analysis.h"
/** \ingroup analysis
* \class QgsIDWInterpolator
@@ -27,7 +28,6 @@ class ANALYSIS_EXPORT QgsIDWInterpolator: public QgsInterpolator
{
public:
QgsIDWInterpolator( const QList& layerData );
- ~QgsIDWInterpolator();
/** Calculates interpolation value for map coordinates x, y
@param x x-coordinate (in map units)
diff --git a/src/analysis/interpolation/qgsinterpolator.h b/src/analysis/interpolation/qgsinterpolator.h
index dda56649009..1843ce0aac9 100644
--- a/src/analysis/interpolation/qgsinterpolator.h
+++ b/src/analysis/interpolation/qgsinterpolator.h
@@ -19,6 +19,7 @@
#define QGSINTERPOLATOR_H
#include
+#include "qgis_analysis.h"
class QgsVectorLayer;
class QgsGeometry;
diff --git a/src/analysis/interpolation/qgstininterpolator.h b/src/analysis/interpolation/qgstininterpolator.h
index 9a12f75d6bc..538a79497de 100644
--- a/src/analysis/interpolation/qgstininterpolator.h
+++ b/src/analysis/interpolation/qgstininterpolator.h
@@ -20,6 +20,7 @@
#include "qgsinterpolator.h"
#include
+#include "qgis_analysis.h"
class Triangulation;
class TriangleInterpolator;
diff --git a/src/analysis/network/qgsgraph.h b/src/analysis/network/qgsgraph.h
index e93b773b44a..8a15df80137 100644
--- a/src/analysis/network/qgsgraph.h
+++ b/src/analysis/network/qgsgraph.h
@@ -30,6 +30,7 @@
#include
#include "qgspoint.h"
+#include "qgis_analysis.h"
class QgsGraphVertex;
diff --git a/src/analysis/network/qgsgraphanalyzer.h b/src/analysis/network/qgsgraphanalyzer.h
index 16ce6477789..7e52af5d786 100644
--- a/src/analysis/network/qgsgraphanalyzer.h
+++ b/src/analysis/network/qgsgraphanalyzer.h
@@ -17,6 +17,7 @@
#define QGSGRAPHANALYZER_H
#include
+#include "qgis_analysis.h"
class QgsGraph;
diff --git a/src/analysis/network/qgsgraphbuilder.h b/src/analysis/network/qgsgraphbuilder.h
index a3d8434cca6..6f89ea46da7 100644
--- a/src/analysis/network/qgsgraphbuilder.h
+++ b/src/analysis/network/qgsgraphbuilder.h
@@ -19,6 +19,7 @@
#include "qgsgraphbuilderinterface.h"
#include
+#include "qgis_analysis.h"
class QgsDistanceArea;
class QgsCoordinateTransform;
diff --git a/src/analysis/network/qgsgraphbuilderinterface.h b/src/analysis/network/qgsgraphbuilderinterface.h
index e63672e0df5..c4ae8b42ab7 100644
--- a/src/analysis/network/qgsgraphbuilderinterface.h
+++ b/src/analysis/network/qgsgraphbuilderinterface.h
@@ -22,6 +22,7 @@
#include
#include
#include
+#include "qgis_analysis.h"
/**
* \ingroup analysis
@@ -50,7 +51,6 @@ class ANALYSIS_EXPORT QgsGraphBuilderInterface
mDa.setEllipsoidalMode( ctfEnabled );
}
- //! Destructor
virtual ~QgsGraphBuilderInterface()
{ }
diff --git a/src/analysis/network/qgsgraphdirector.h b/src/analysis/network/qgsgraphdirector.h
index bb7de5c8d3f..ea38b15615f 100644
--- a/src/analysis/network/qgsgraphdirector.h
+++ b/src/analysis/network/qgsgraphdirector.h
@@ -22,6 +22,7 @@
#include
#include "qgsnetworkstrategy.h"
+#include "qgis_analysis.h"
class QgsGraphBuilderInterface;
@@ -40,7 +41,7 @@ class ANALYSIS_EXPORT QgsGraphDirector : public QObject
void buildMessage( const QString& ) const;
public:
- //! Destructor
+
virtual ~QgsGraphDirector() { }
/**
diff --git a/src/analysis/network/qgsnetworkdistancestrategy.h b/src/analysis/network/qgsnetworkdistancestrategy.h
index 53f340585b8..ec5d79d3a8d 100644
--- a/src/analysis/network/qgsnetworkdistancestrategy.h
+++ b/src/analysis/network/qgsnetworkdistancestrategy.h
@@ -17,6 +17,7 @@
#define QGSNETWORKDISTANCESTRATEGY_H
#include
+#include "qgis_analysis.h"
/** \ingroup analysis
* \class QgsNetworkDistanceStrategy
diff --git a/src/analysis/network/qgsnetworkspeedstrategy.h b/src/analysis/network/qgsnetworkspeedstrategy.h
index c19eac39b10..6844ebc9981 100644
--- a/src/analysis/network/qgsnetworkspeedstrategy.h
+++ b/src/analysis/network/qgsnetworkspeedstrategy.h
@@ -17,6 +17,7 @@
#define QGSNETWORKSPEEDSTRATEGY_H
#include
+#include "qgis_analysis.h"
/** \ingroup analysis
* \class QgsNetworkSpeedStrategy
diff --git a/src/analysis/network/qgsnetworkstrategy.h b/src/analysis/network/qgsnetworkstrategy.h
index dd8bffdc782..be78275f4ce 100644
--- a/src/analysis/network/qgsnetworkstrategy.h
+++ b/src/analysis/network/qgsnetworkstrategy.h
@@ -20,6 +20,7 @@
#include
#include
+#include "qgis_analysis.h"
/**
* \ingroup analysis
@@ -39,7 +40,7 @@ class ANALYSIS_EXPORT QgsNetworkStrategy
*/
QgsNetworkStrategy() {}
- virtual ~QgsNetworkStrategy() {}
+ virtual ~QgsNetworkStrategy() = default;
/**
* Returns list of the source layer attributes needed for cost calculation.
diff --git a/src/analysis/network/qgsvectorlayerdirector.h b/src/analysis/network/qgsvectorlayerdirector.h
index 6b4fd8816f8..b8b35148352 100644
--- a/src/analysis/network/qgsvectorlayerdirector.h
+++ b/src/analysis/network/qgsvectorlayerdirector.h
@@ -17,6 +17,7 @@
#define QGSVECTORLAYERDIRECTOR_H
#include "qgsgraphdirector.h"
+#include "qgis_analysis.h"
class QgsGraphBuilderInterface;
class QgsVectorLayer;
@@ -64,7 +65,6 @@ class ANALYSIS_EXPORT QgsVectorLayerDirector : public QgsGraphDirector
const Direction defaultDirection
);
- //! Destructor
virtual ~QgsVectorLayerDirector();
/*
diff --git a/src/analysis/openstreetmap/qgsosmbase.h b/src/analysis/openstreetmap/qgsosmbase.h
index c70cad42a50..d0566256251 100644
--- a/src/analysis/openstreetmap/qgsosmbase.h
+++ b/src/analysis/openstreetmap/qgsosmbase.h
@@ -20,6 +20,7 @@
#include "qgspoint.h"
#include
+#include "qgis_analysis.h"
typedef qint64 QgsOSMId;
diff --git a/src/analysis/openstreetmap/qgsosmdatabase.h b/src/analysis/openstreetmap/qgsosmdatabase.h
index d55344a3bf9..1b52c556b9c 100644
--- a/src/analysis/openstreetmap/qgsosmdatabase.h
+++ b/src/analysis/openstreetmap/qgsosmdatabase.h
@@ -22,6 +22,7 @@
#include "qgsosmbase.h"
#include "qgsgeometry.h"
+#include "qgis_analysis.h"
class QgsOSMNodeIterator;
class QgsOSMWayIterator;
@@ -49,6 +50,11 @@ class ANALYSIS_EXPORT QgsOSMDatabase
explicit QgsOSMDatabase( const QString& dbFileName = QString() );
~QgsOSMDatabase();
+ //! QgsOSMDatabase cannot be copied.
+ QgsOSMDatabase( const QgsOSMDatabase& rh ) = delete;
+ //! QgsOSMDatabase cannot be copied.
+ QgsOSMDatabase& operator=( const QgsOSMDatabase& rh ) = delete;
+
void setFileName( const QString& dbFileName ) { mDbFileName = dbFileName; }
QString filename() const { return mDbFileName; }
bool isOpen() const;
@@ -120,8 +126,6 @@ class ANALYSIS_EXPORT QgsOSMDatabase
sqlite3_stmt* mStmtWayNodePoints;
sqlite3_stmt* mStmtWayTags;
- QgsOSMDatabase( const QgsOSMDatabase& rh );
- QgsOSMDatabase& operator=( const QgsOSMDatabase& rh );
};
diff --git a/src/analysis/openstreetmap/qgsosmdownload.h b/src/analysis/openstreetmap/qgsosmdownload.h
index 4b9dea23c2b..123b4399729 100644
--- a/src/analysis/openstreetmap/qgsosmdownload.h
+++ b/src/analysis/openstreetmap/qgsosmdownload.h
@@ -20,6 +20,7 @@
#include
#include
#include
+#include "qgis_analysis.h"
class QgsRectangle;
diff --git a/src/analysis/openstreetmap/qgsosmimport.h b/src/analysis/openstreetmap/qgsosmimport.h
index 992a57ce6cf..5a1d4cef54e 100644
--- a/src/analysis/openstreetmap/qgsosmimport.h
+++ b/src/analysis/openstreetmap/qgsosmimport.h
@@ -20,6 +20,7 @@
#include
#include "qgsosmbase.h"
+#include "qgis_analysis.h"
class QXmlStreamReader;
diff --git a/src/analysis/raster/qgsalignraster.h b/src/analysis/raster/qgsalignraster.h
index 1de12ae122c..a2212beaa14 100644
--- a/src/analysis/raster/qgsalignraster.h
+++ b/src/analysis/raster/qgsalignraster.h
@@ -21,6 +21,7 @@
#include
#include
#include
+#include "qgis_analysis.h"
class QgsRectangle;
@@ -49,6 +50,9 @@ class ANALYSIS_EXPORT QgsAlignRaster
RasterInfo( const QString& layerpath );
~RasterInfo();
+ RasterInfo( const RasterInfo& rh ) = delete;
+ RasterInfo& operator=( const RasterInfo& rh ) = delete;
+
//! Check whether the given path is a valid raster
bool isValid() const { return nullptr != mDataset; }
@@ -87,9 +91,6 @@ class ANALYSIS_EXPORT QgsAlignRaster
private:
- RasterInfo( const RasterInfo& rh );
- RasterInfo& operator=( const RasterInfo& rh );
-
friend class QgsAlignRaster;
};
@@ -147,7 +148,7 @@ class ANALYSIS_EXPORT QgsAlignRaster
//! @return false if the execution should be cancelled, true otherwise
virtual bool progress( double complete ) = 0;
- virtual ~ProgressHandler() {}
+ virtual ~ProgressHandler() = default;
};
//! Assign a progress handler instance. Does not take ownership. nullptr can be passed.
diff --git a/src/analysis/raster/qgsaspectfilter.cpp b/src/analysis/raster/qgsaspectfilter.cpp
index e70ea6badf7..7c881492c59 100644
--- a/src/analysis/raster/qgsaspectfilter.cpp
+++ b/src/analysis/raster/qgsaspectfilter.cpp
@@ -23,11 +23,6 @@ QgsAspectFilter::QgsAspectFilter( const QString& inputFile, const QString& outpu
}
-QgsAspectFilter::~QgsAspectFilter()
-{
-
-}
-
float QgsAspectFilter::processNineCellWindow(
float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32,
diff --git a/src/analysis/raster/qgsaspectfilter.h b/src/analysis/raster/qgsaspectfilter.h
index a3437315fe9..6368b191059 100644
--- a/src/analysis/raster/qgsaspectfilter.h
+++ b/src/analysis/raster/qgsaspectfilter.h
@@ -19,6 +19,7 @@
#define QGSASPECTFILTER_H
#include "qgsderivativefilter.h"
+#include "qgis_analysis.h"
/** \ingroup analysis
* Calculates aspect values in a window of 3x3 cells based on first order derivatives in x- and y- directions. Direction is clockwise starting from north*/
@@ -26,7 +27,6 @@ class ANALYSIS_EXPORT QgsAspectFilter: public QgsDerivativeFilter
{
public:
QgsAspectFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat );
- ~QgsAspectFilter();
/** Calculates output value from nine input values. The input values and the output value can be equal to the
nodata value if not present or outside of the border. Must be implemented by subclasses*/
diff --git a/src/analysis/raster/qgsderivativefilter.h b/src/analysis/raster/qgsderivativefilter.h
index 796b089fb9a..67b9678beaa 100644
--- a/src/analysis/raster/qgsderivativefilter.h
+++ b/src/analysis/raster/qgsderivativefilter.h
@@ -19,6 +19,7 @@
#define QGSDERIVATIVEFILTER_H
#include "qgsninecellfilter.h"
+#include "qgis_analysis.h"
/** \ingroup analysis
* Adds the ability to calculate derivatives in x- and y-directions. Needs to be subclassed (e.g. for slope and aspect)*/
diff --git a/src/analysis/raster/qgshillshadefilter.cpp b/src/analysis/raster/qgshillshadefilter.cpp
index 5d72d044d49..34a796cfaf2 100644
--- a/src/analysis/raster/qgshillshadefilter.cpp
+++ b/src/analysis/raster/qgshillshadefilter.cpp
@@ -25,10 +25,6 @@ QgsHillshadeFilter::QgsHillshadeFilter( const QString& inputFile, const QString&
{
}
-QgsHillshadeFilter::~QgsHillshadeFilter()
-{
-}
-
float QgsHillshadeFilter::processNineCellWindow( float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32,
float* x13, float* x23, float* x33 )
diff --git a/src/analysis/raster/qgshillshadefilter.h b/src/analysis/raster/qgshillshadefilter.h
index 1cb4444c14b..6bf3cd7ee29 100644
--- a/src/analysis/raster/qgshillshadefilter.h
+++ b/src/analysis/raster/qgshillshadefilter.h
@@ -19,6 +19,7 @@
#define QGSHILLSHADEFILTER_H
#include "qgsderivativefilter.h"
+#include "qgis_analysis.h"
/** \ingroup analysis
* \class QgsHillshadeFilter
@@ -28,7 +29,6 @@ class ANALYSIS_EXPORT QgsHillshadeFilter: public QgsDerivativeFilter
public:
QgsHillshadeFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat, double lightAzimuth = 300,
double lightAngle = 40 );
- ~QgsHillshadeFilter();
/** Calculates output value from nine input values. The input values and the output value can be equal to the
nodata value if not present or outside of the border. Must be implemented by subclasses*/
diff --git a/src/analysis/raster/qgskde.cpp b/src/analysis/raster/qgskde.cpp
index 57543e013bb..0c30f0d7355 100644
--- a/src/analysis/raster/qgskde.cpp
+++ b/src/analysis/raster/qgskde.cpp
@@ -23,12 +23,6 @@
#define M_PI 3.14159265358979323846
#endif
-#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1800
-#define TO8F(x) (x).toUtf8().constData()
-#else
-#define TO8F(x) QFile::encodeName( x ).constData()
-#endif
-
QgsKernelDensityEstimation::QgsKernelDensityEstimation( const QgsKernelDensityEstimation::Parameters& parameters, const QString& outputFile, const QString& outputFormat )
: mInputLayer( parameters.vectorLayer )
, mOutputFile( outputFile )
@@ -99,7 +93,7 @@ QgsKernelDensityEstimation::Result QgsKernelDensityEstimation::prepare()
return FileCreationError;
// open the raster in GA_Update mode
- mDatasetH = GDALOpen( TO8F( mOutputFile ), GA_Update );
+ mDatasetH = GDALOpen( mOutputFile.toUtf8().constData(), GA_Update );
if ( !mDatasetH )
return FileCreationError;
mRasterBandH = GDALGetRasterBand( mDatasetH, 1 );
diff --git a/src/analysis/raster/qgskde.h b/src/analysis/raster/qgskde.h
index 960c3cb8167..820eb45abfa 100644
--- a/src/analysis/raster/qgskde.h
+++ b/src/analysis/raster/qgskde.h
@@ -23,6 +23,7 @@
#include
#include
#include
+#include "qgis_analysis.h"
class QgsVectorLayer;
class QProgressDialog;
diff --git a/src/analysis/raster/qgsninecellfilter.cpp b/src/analysis/raster/qgsninecellfilter.cpp
index 30ccce47020..105a80fb242 100644
--- a/src/analysis/raster/qgsninecellfilter.cpp
+++ b/src/analysis/raster/qgsninecellfilter.cpp
@@ -21,12 +21,6 @@
#include
#include
-#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1800
-#define TO8F(x) (x).toUtf8().constData()
-#else
-#define TO8F(x) QFile::encodeName( x ).constData()
-#endif
-
QgsNineCellFilter::QgsNineCellFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat )
: mInputFile( inputFile )
, mOutputFile( outputFile )
@@ -208,7 +202,7 @@ int QgsNineCellFilter::processRaster( QProgressDialog* p )
if ( p && p->wasCanceled() )
{
//delete the dataset without closing (because it is faster)
- GDALDeleteDataset( outputDriver, TO8F( mOutputFile ) );
+ GDALDeleteDataset( outputDriver, mOutputFile.toUtf8().constData() );
return 7;
}
GDALClose( outputDataset );
@@ -218,7 +212,7 @@ int QgsNineCellFilter::processRaster( QProgressDialog* p )
GDALDatasetH QgsNineCellFilter::openInputFile( int& nCellsX, int& nCellsY )
{
- GDALDatasetH inputDataset = GDALOpen( TO8F( mInputFile ), GA_ReadOnly );
+ GDALDatasetH inputDataset = GDALOpen( mInputFile.toUtf8().constData(), GA_ReadOnly );
if ( inputDataset )
{
nCellsX = GDALGetRasterXSize( inputDataset );
@@ -267,7 +261,7 @@ GDALDatasetH QgsNineCellFilter::openOutputFile( GDALDatasetH inputDataset, GDALD
//open output file
char **papszOptions = nullptr;
- GDALDatasetH outputDataset = GDALCreate( outputDriver, TO8F( mOutputFile ), xSize, ySize, 1, GDT_Float32, papszOptions );
+ GDALDatasetH outputDataset = GDALCreate( outputDriver, mOutputFile.toUtf8().constData(), xSize, ySize, 1, GDT_Float32, papszOptions );
if ( !outputDataset )
{
return outputDataset;
diff --git a/src/analysis/raster/qgsninecellfilter.h b/src/analysis/raster/qgsninecellfilter.h
index 03e42db770b..5838910a90b 100644
--- a/src/analysis/raster/qgsninecellfilter.h
+++ b/src/analysis/raster/qgsninecellfilter.h
@@ -20,6 +20,7 @@
#include
#include "gdal.h"
+#include "qgis_analysis.h"
class QProgressDialog;
diff --git a/src/analysis/raster/qgsrastercalcnode.h b/src/analysis/raster/qgsrastercalcnode.h
index f95f9cb9115..eaf7c5454a6 100644
--- a/src/analysis/raster/qgsrastercalcnode.h
+++ b/src/analysis/raster/qgsrastercalcnode.h
@@ -21,6 +21,7 @@
#include
#include
+#include "qgis_analysis.h"
class QgsRasterBlock;
class QgsRasterMatrix;
@@ -76,6 +77,11 @@ class ANALYSIS_EXPORT QgsRasterCalcNode
QgsRasterCalcNode( const QString& rasterName );
~QgsRasterCalcNode();
+ //! QgsRasterCalcNode cannot be copied
+ QgsRasterCalcNode( const QgsRasterCalcNode& rh ) = delete;
+ //! QgsRasterCalcNode cannot be copied
+ QgsRasterCalcNode& operator=( const QgsRasterCalcNode& rh ) = delete;
+
Type type() const { return mType; }
//set left node
@@ -103,8 +109,6 @@ class ANALYSIS_EXPORT QgsRasterCalcNode
QgsRasterMatrix* mMatrix;
Operator mOperator;
- QgsRasterCalcNode( const QgsRasterCalcNode& rh );
- QgsRasterCalcNode& operator=( const QgsRasterCalcNode& rh );
};
diff --git a/src/analysis/raster/qgsrastercalculator.cpp b/src/analysis/raster/qgsrastercalculator.cpp
index 1be0718b25e..b50aa175b5a 100644
--- a/src/analysis/raster/qgsrastercalculator.cpp
+++ b/src/analysis/raster/qgsrastercalculator.cpp
@@ -29,14 +29,6 @@
#include
#include
-#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1800
-#define TO8(x) (x).toUtf8().constData()
-#define TO8F(x) (x).toUtf8().constData()
-#else
-#define TO8(x) (x).toLocal8Bit().constData()
-#define TO8F(x) QFile::encodeName( x ).constData()
-#endif
-
QgsRasterCalculator::QgsRasterCalculator( const QString& formulaString, const QString& outputFile, const QString& outputFormat,
const QgsRectangle& outputExtent, int nOutputColumns, int nOutputRows, const QVector& rasterEntries )
: mFormulaString( formulaString )
@@ -180,7 +172,7 @@ int QgsRasterCalculator::processCalculation( QProgressDialog* p )
if ( p && p->wasCanceled() )
{
//delete the dataset without closing (because it is faster)
- GDALDeleteDataset( outputDriver, TO8F( mOutputFile ) );
+ GDALDeleteDataset( outputDriver, mOutputFile.toUtf8().constData() );
return static_cast< int >( Cancelled );
}
GDALClose( outputDataset );
@@ -219,7 +211,7 @@ GDALDatasetH QgsRasterCalculator::openOutputFile( GDALDriverH outputDriver )
{
//open output file
char **papszOptions = nullptr;
- GDALDatasetH outputDataset = GDALCreate( outputDriver, TO8F( mOutputFile ), mNumOutputColumns, mNumOutputRows, 1, GDT_Float32, papszOptions );
+ GDALDatasetH outputDataset = GDALCreate( outputDriver, mOutputFile.toUtf8().constData(), mNumOutputColumns, mNumOutputRows, 1, GDT_Float32, papszOptions );
if ( !outputDataset )
{
return outputDataset;
diff --git a/src/analysis/raster/qgsrastercalculator.h b/src/analysis/raster/qgsrastercalculator.h
index 27dc82696b2..a936d1a1781 100644
--- a/src/analysis/raster/qgsrastercalculator.h
+++ b/src/analysis/raster/qgsrastercalculator.h
@@ -23,6 +23,7 @@
#include
#include
#include "gdal.h"
+#include "qgis_analysis.h"
class QgsRasterLayer;
class QProgressDialog;
diff --git a/src/analysis/raster/qgsrastermatrix.h b/src/analysis/raster/qgsrastermatrix.h
index 81282553e02..fea61e14929 100644
--- a/src/analysis/raster/qgsrastermatrix.h
+++ b/src/analysis/raster/qgsrastermatrix.h
@@ -18,6 +18,8 @@
#ifndef QGSRASTERMATRIX_H
#define QGSRASTERMATRIX_H
+#include "qgis_analysis.h"
+
/** \ingroup analysis
* \class QgsRasterMatrix
*/
diff --git a/src/analysis/raster/qgsrelief.cpp b/src/analysis/raster/qgsrelief.cpp
index 01187b5b015..6aa592251be 100644
--- a/src/analysis/raster/qgsrelief.cpp
+++ b/src/analysis/raster/qgsrelief.cpp
@@ -28,12 +28,6 @@
#include
#include
-#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1800
-#define TO8F(x) (x).toUtf8().constData()
-#else
-#define TO8F(x) QFile::encodeName( x ).constData()
-#endif
-
QgsRelief::QgsRelief( const QString& inputFile, const QString& outputFile, const QString& outputFormat )
: mInputFile( inputFile )
, mOutputFile( outputFile )
@@ -292,7 +286,7 @@ int QgsRelief::processRaster( QProgressDialog* p )
if ( p && p->wasCanceled() )
{
//delete the dataset without closing (because it is faster)
- GDALDeleteDataset( outputDriver, TO8F( mOutputFile ) );
+ GDALDeleteDataset( outputDriver, mOutputFile.toUtf8().constData() );
return 7;
}
GDALClose( outputDataset );
@@ -415,7 +409,7 @@ bool QgsRelief::setElevationColor( double elevation, int* red, int* green, int*
//duplicated from QgsNineCellFilter. Todo: make common base class
GDALDatasetH QgsRelief::openInputFile( int& nCellsX, int& nCellsY )
{
- GDALDatasetH inputDataset = GDALOpen( TO8F( mInputFile ), GA_ReadOnly );
+ GDALDatasetH inputDataset = GDALOpen( mInputFile.toUtf8().constData(), GA_ReadOnly );
if ( inputDataset )
{
nCellsX = GDALGetRasterXSize( inputDataset );
@@ -469,7 +463,7 @@ GDALDatasetH QgsRelief::openOutputFile( GDALDatasetH inputDataset, GDALDriverH o
papszOptions = CSLSetNameValue( papszOptions, "COMPRESS", "PACKBITS" );
//create three band raster (reg, green, blue)
- GDALDatasetH outputDataset = GDALCreate( outputDriver, TO8F( mOutputFile ), xSize, ySize, 3, GDT_Byte, papszOptions );
+ GDALDatasetH outputDataset = GDALCreate( outputDriver, mOutputFile.toUtf8().constData(), xSize, ySize, 3, GDT_Byte, papszOptions );
if ( !outputDataset )
{
return outputDataset;
diff --git a/src/analysis/raster/qgsrelief.h b/src/analysis/raster/qgsrelief.h
index eaca801fc6f..2915a4787c8 100644
--- a/src/analysis/raster/qgsrelief.h
+++ b/src/analysis/raster/qgsrelief.h
@@ -23,6 +23,7 @@
#include
#include
#include "gdal.h"
+#include "qgis_analysis.h"
class QgsAspectFilter;
class QgsSlopeFilter;
@@ -45,6 +46,11 @@ class ANALYSIS_EXPORT QgsRelief
QgsRelief( const QString& inputFile, const QString& outputFile, const QString& outputFormat );
~QgsRelief();
+ //! QgsRelief cannot be copied
+ QgsRelief( const QgsRelief& rh ) = delete;
+ //! QgsRelief cannot be copied
+ QgsRelief& operator=( const QgsRelief& rh ) = delete;
+
/** Starts the calculation, reads from mInputFile and stores the result in mOutputFile
@param p progress dialog that receives update and that is checked for abort. 0 if no progress bar is needed.
@return 0 in case of success*/
@@ -122,8 +128,6 @@ class ANALYSIS_EXPORT QgsRelief
*/
bool calculateRegression( const QList< QPair < int, double > >& input, double& a, double& b );
- QgsRelief( const QgsRelief& rh );
- QgsRelief& operator=( const QgsRelief& rh );
};
#endif // QGSRELIEF_H
diff --git a/src/analysis/raster/qgsruggednessfilter.h b/src/analysis/raster/qgsruggednessfilter.h
index dfe86115e7f..af217c6e741 100644
--- a/src/analysis/raster/qgsruggednessfilter.h
+++ b/src/analysis/raster/qgsruggednessfilter.h
@@ -19,6 +19,7 @@
#define QGSRUGGEDNESSFILTER_H
#include "qgsninecellfilter.h"
+#include "qgis_analysis.h"
/** \ingroup analysis
* Calculates the ruggedness index based on a 3x3 moving window.
diff --git a/src/analysis/raster/qgsslopefilter.h b/src/analysis/raster/qgsslopefilter.h
index 8eaa9a1594e..e410e219022 100644
--- a/src/analysis/raster/qgsslopefilter.h
+++ b/src/analysis/raster/qgsslopefilter.h
@@ -19,6 +19,7 @@
#define QGSSLOPEFILTER_H
#include "qgsderivativefilter.h"
+#include "qgis_analysis.h"
/** \ingroup analysis
* Calculates slope values in a window of 3x3 cells based on first order derivatives in x- and y- directions*/
diff --git a/src/analysis/raster/qgstotalcurvaturefilter.h b/src/analysis/raster/qgstotalcurvaturefilter.h
index df108ebaa48..22b4967109e 100644
--- a/src/analysis/raster/qgstotalcurvaturefilter.h
+++ b/src/analysis/raster/qgstotalcurvaturefilter.h
@@ -19,6 +19,7 @@
#define QGSTOTALCURVATUREFILTER_H
#include "qgsninecellfilter.h"
+#include "qgis_analysis.h"
/** \ingroup analysis
* Calculates total curvature as described by Wilson, Gallant (2000): terrain analysis*/
diff --git a/src/analysis/vector/qgsgeometryanalyzer.h b/src/analysis/vector/qgsgeometryanalyzer.h
index d96e7547ef3..722fa5695a6 100644
--- a/src/analysis/vector/qgsgeometryanalyzer.h
+++ b/src/analysis/vector/qgsgeometryanalyzer.h
@@ -20,6 +20,7 @@
#include "qgsfeature.h"
#include "qgsgeometry.h"
+#include "qgis_analysis.h"
class QgsVectorFileWriter;
class QProgressDialog;
diff --git a/src/analysis/vector/qgsgeometrysnapper.h b/src/analysis/vector/qgsgeometrysnapper.h
index 26926576533..a440ce40e89 100644
--- a/src/analysis/vector/qgsgeometrysnapper.h
+++ b/src/analysis/vector/qgsgeometrysnapper.h
@@ -23,6 +23,7 @@
#include "qgsspatialindex.h"
#include "qgsabstractgeometry.h"
#include "qgspointv2.h"
+#include "qgis_analysis.h"
class QgsVectorLayer;
@@ -122,7 +123,7 @@ class QgsSnapIndex
class SnapItem
{
public:
- virtual ~SnapItem() {}
+ virtual ~SnapItem() = default;
SnapType type;
virtual QgsPointV2 getSnapPoint( const QgsPointV2& p ) const = 0;
diff --git a/src/analysis/vector/qgsoverlayanalyzer.h b/src/analysis/vector/qgsoverlayanalyzer.h
index a15b88348d7..b68db6f3477 100644
--- a/src/analysis/vector/qgsoverlayanalyzer.h
+++ b/src/analysis/vector/qgsoverlayanalyzer.h
@@ -19,6 +19,7 @@
#define QGSOVERLAYANALYZERH
#include "qgsvectorlayer.h"
+#include "qgis_analysis.h"
class QgsVectorFileWriter;
class QProgressDialog;
diff --git a/src/analysis/vector/qgspointsample.h b/src/analysis/vector/qgspointsample.h
index 7db3d188571..b8d3ddf92bf 100644
--- a/src/analysis/vector/qgspointsample.h
+++ b/src/analysis/vector/qgspointsample.h
@@ -17,6 +17,7 @@
#include "qgsfeature.h"
#include
+#include "qgis_analysis.h"
class QgsFeature;
class QgsPoint;
diff --git a/src/analysis/vector/qgstransectsample.h b/src/analysis/vector/qgstransectsample.h
index b00c01e62f8..5fffbbb8cfc 100644
--- a/src/analysis/vector/qgstransectsample.h
+++ b/src/analysis/vector/qgstransectsample.h
@@ -18,6 +18,7 @@
#include "qgsfeature.h"
#include
#include
+#include "qgis_analysis.h"
class QgsDistanceArea;
class QgsGeometry;
diff --git a/src/analysis/vector/qgszonalstatistics.cpp b/src/analysis/vector/qgszonalstatistics.cpp
index 0fd2df0cb28..3003daefe2b 100644
--- a/src/analysis/vector/qgszonalstatistics.cpp
+++ b/src/analysis/vector/qgszonalstatistics.cpp
@@ -28,12 +28,6 @@
#include
#include
-#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1800
-#define TO8F(x) (x).toUtf8().constData()
-#else
-#define TO8F(x) QFile::encodeName( x ).constData()
-#endif
-
QgsZonalStatistics::QgsZonalStatistics( QgsVectorLayer* polygonLayer, const QString& rasterFile, const QString& attributePrefix, int rasterBand, Statistics stats )
: mRasterFilePath( rasterFile )
, mRasterBand( rasterBand )
@@ -69,7 +63,7 @@ int QgsZonalStatistics::calculateStatistics( QProgressDialog* p )
//open the raster layer and the raster band
GDALAllRegister();
- GDALDatasetH inputDataset = GDALOpen( TO8F( mRasterFilePath ), GA_ReadOnly );
+ GDALDatasetH inputDataset = GDALOpen( mRasterFilePath.toUtf8().constData(), GA_ReadOnly );
if ( !inputDataset )
{
return 3;
diff --git a/src/analysis/vector/qgszonalstatistics.h b/src/analysis/vector/qgszonalstatistics.h
index 05d2d10325d..4ad1a45d486 100644
--- a/src/analysis/vector/qgszonalstatistics.h
+++ b/src/analysis/vector/qgszonalstatistics.h
@@ -22,6 +22,7 @@
#include
#include
#include
+#include "qgis_analysis.h"
class QgsGeometry;
class QgsVectorLayer;
diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt
index 92a2e5c8f8a..9affa8e6fe2 100644
--- a/src/app/CMakeLists.txt
+++ b/src/app/CMakeLists.txt
@@ -524,6 +524,11 @@ INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR} composer legend pluginmanager
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/../ui
+ ${CMAKE_BINARY_DIR}/src/core
+ ${CMAKE_BINARY_DIR}/src/gui
+ ${CMAKE_BINARY_DIR}/src/python
+ ${CMAKE_BINARY_DIR}/src/analysis
+ ${CMAKE_BINARY_DIR}/src/app
)
INCLUDE_DIRECTORIES(SYSTEM
${QWT_INCLUDE_DIR}
@@ -587,9 +592,6 @@ ELSE (ANDROID)
ADD_EXECUTABLE(${QGIS_APP_NAME} MACOSX_BUNDLE WIN32 ${QGIS_APPMAIN_SRCS} ${IMAGE_RCC_SRCS} ${TEST_RCC_SRCS})
ENDIF (ANDROID)
-REMOVE_DEFINITIONS("-DAPP_EXPORT=${DLLIMPORT}")
-ADD_DEFINITIONS("\"-DAPP_EXPORT=${DLLEXPORT}\"")
-
# Putting IMAGE_RCC_SRCS into qgis_app lib is causing problems when the lib is
# loaded (by plugin for example) in test unit (qgis_composerpicturetest).
ADD_LIBRARY(qgis_app SHARED ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS} ${QGIS_APP_HDRS} ${QGIS_APP_MOC_HDRS})
@@ -609,6 +611,12 @@ TARGET_LINK_LIBRARIES(qgis_app
libdxfrw
)
+GENERATE_EXPORT_HEADER(
+ qgis_app
+ BASE_NAME APP
+ EXPORT_FILE_NAME qgis_app.h
+)
+
IF (NOT ANDROID)
SET_TARGET_PROPERTIES(qgis_app PROPERTIES
VERSION ${COMPLETE_VERSION}
diff --git a/src/app/composer/qgscomposer.cpp b/src/app/composer/qgscomposer.cpp
index 294089982ba..7bd18909db4 100644
--- a/src/app/composer/qgscomposer.cpp
+++ b/src/app/composer/qgscomposer.cpp
@@ -547,7 +547,7 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )
connect( mActionShowRulers, SIGNAL( triggered( bool ) ), this, SLOT( toggleRulers( bool ) ) );
//init undo/redo buttons
- mComposition = new QgsComposition( mQgis->mapCanvas()->mapSettings() );
+ mComposition = new QgsComposition( mQgis->mapCanvas()->mapSettings(), QgsProject::instance() );
mActionUndo->setEnabled( false );
mActionRedo->setEnabled( false );
@@ -878,7 +878,7 @@ void QgsComposer::changeEvent( QEvent* event )
#endif
case QEvent::WindowStateChange:
{
- /* Listen out for window un-minimisation and restore composer map states.
+ /* Listen out for window un-minimization and restore composer map states.
* We can't use showEvent to detect this due to QT Bug 36675 (see #6085).
*/
QWindowStateChangeEvent* changeEv = static_cast< QWindowStateChangeEvent* >( event );
@@ -1128,7 +1128,7 @@ void QgsComposer::on_mActionAtlasPreview_triggered( bool checked )
bool previewEnabled = mComposition->setAtlasMode( checked ? QgsComposition::PreviewAtlas : QgsComposition::AtlasOff );
if ( !previewEnabled )
{
- //something went wrong, eg, no matching features
+ //something went wrong, e.g., no matching features
QMessageBox::warning( nullptr, tr( "Enable atlas preview" ),
tr( "No matching atlas features found!" ),
QMessageBox::Ok,
@@ -2488,7 +2488,7 @@ void QgsComposer::exportCompositionAsSVG( QgsComposer::OutputMode mode )
"with layers not being clipped to the map "
"bounding box." )
+ tr( "If you require a vector-based output file from "
- "Qgis it is suggested that you try printing "
+ "QGIS it is suggested that you try printing "
"to PostScript if the SVG output is not "
"satisfactory."
"" ) );
@@ -3471,7 +3471,7 @@ void QgsComposer::writeXml( QDomNode& parentNode, QDomDocument& doc )
QDomElement composerElem = doc.createElement( QStringLiteral( "Composer" ) );
composerElem.setAttribute( QStringLiteral( "title" ), mTitle );
- //change preview mode of minimised / hidden maps before saving XML (show contents only on demand)
+ //change preview mode of minimized / hidden maps before saving XML (show contents only on demand)
QMap< QgsComposerMap*, int >::const_iterator mapIt = mMapsToRestore.constBegin();
for ( ; mapIt != mMapsToRestore.constEnd(); ++mapIt )
{
@@ -3543,7 +3543,7 @@ void QgsComposer::readXml( const QDomElement& composerElem, const QDomDocument&
createComposerView();
//read composition settings
- mComposition = new QgsComposition( mQgis->mapCanvas()->mapSettings() );
+ mComposition = new QgsComposition( mQgis->mapCanvas()->mapSettings(), QgsProject::instance() );
QDomNodeList compositionNodeList = composerElem.elementsByTagName( QStringLiteral( "Composition" ) );
if ( compositionNodeList.size() > 0 )
{
diff --git a/src/app/composer/qgscomposeritemwidget.cpp b/src/app/composer/qgscomposeritemwidget.cpp
index 11bea4e4709..479449e552d 100644
--- a/src/app/composer/qgscomposeritemwidget.cpp
+++ b/src/app/composer/qgscomposeritemwidget.cpp
@@ -177,12 +177,9 @@ QgsComposerItemWidget::QgsComposerItemWidget( QWidget* parent, QgsComposerItem*
updateVariables();
connect( mVariableEditor, SIGNAL( scopeChanged() ), this, SLOT( variablesChanged() ) );
// listen out for variable edits
- QgsApplication* app = qobject_cast( QgsApplication::instance() );
- if ( app )
- {
- connect( app, SIGNAL( settingsChanged() ), this, SLOT( updateVariables() ) );
- }
- connect( QgsProject::instance(), SIGNAL( variablesChanged() ), this, SLOT( updateVariables() ) );
+ connect( QgsApplication::instance(), &QgsApplication::customVariablesChanged, this, &QgsComposerItemWidget::updateVariables );
+ connect( QgsProject::instance(), &QgsProject::customVariablesChanged, this, &QgsComposerItemWidget::updateVariables );
+
if ( mItem->composition() )
connect( mItem->composition(), SIGNAL( variablesChanged() ), this, SLOT( updateVariables() ) );
}
diff --git a/src/app/composer/qgscomposeritemwidget.h b/src/app/composer/qgscomposeritemwidget.h
index 9df2f5e27da..b13932c5e31 100644
--- a/src/app/composer/qgscomposeritemwidget.h
+++ b/src/app/composer/qgscomposeritemwidget.h
@@ -39,7 +39,7 @@ class QgsDataDefinedButton;
// contains a child QgsPanelWidget, which breaks lots of assumptions made in QgsPanelWidget
// and related classes).
// So QgsComposerItemWidget HAS a QgsComposerConfigObject to handle these common tasks.
-// Specific item property widgets (eg QgsComposerMapWidget) should inherit from QgsComposerItemBaseWidget
+// Specific item property widgets (e.g., QgsComposerMapWidget) should inherit from QgsComposerItemBaseWidget
// (which is a QgsPanelWidget) and also HAS a QgsComposerConfigObject, with protected methods
// which are just proxied through to the QgsComposerConfigObject.
// phew!
@@ -78,7 +78,7 @@ class QgsComposerConfigObject: public QObject
//! Must be called when a data defined button changes
void updateDataDefinedProperty();
- //! Updates data defined buttons to reflect current state of atlas (eg coverage layer)
+ //! Updates data defined buttons to reflect current state of atlas (e.g., coverage layer)
void updateDataDefinedButtons();
private:
diff --git a/src/app/composer/qgscomposerpicturewidget.cpp b/src/app/composer/qgscomposerpicturewidget.cpp
index 57ea1a536e6..3630095f9ac 100644
--- a/src/app/composer/qgscomposerpicturewidget.cpp
+++ b/src/app/composer/qgscomposerpicturewidget.cpp
@@ -417,7 +417,7 @@ QIcon QgsComposerPictureWidget::svgToIcon( const QString& filePath ) const
bool fillParam, fillOpacityParam, outlineParam, outlineWidthParam, outlineOpacityParam;
bool hasDefaultFillColor = false, hasDefaultFillOpacity = false, hasDefaultOutlineColor = false,
hasDefaultOutlineWidth = false, hasDefaultOutlineOpacity = false;
- QgsSvgCache::instance()->containsParams( filePath, fillParam, hasDefaultFillColor, fill,
+ QgsApplication::svgCache()->containsParams( filePath, fillParam, hasDefaultFillColor, fill,
fillOpacityParam, hasDefaultFillOpacity, fillOpacity,
outlineParam, hasDefaultOutlineColor, outline,
outlineWidthParam, hasDefaultOutlineWidth, outlineWidth,
@@ -434,7 +434,7 @@ QIcon QgsComposerPictureWidget::svgToIcon( const QString& filePath ) const
outlineWidth = 0.6;
bool fitsInCache; // should always fit in cache at these sizes (i.e. under 559 px ^ 2, or half cache size)
- const QImage& img = QgsSvgCache::instance()->svgAsImage( filePath, 30.0, fill, outline, outlineWidth, 3.5 /*appr. 88 dpi*/, 1.0, fitsInCache );
+ const QImage& img = QgsApplication::svgCache()->svgAsImage( filePath, 30.0, fill, outline, outlineWidth, 3.5 /*appr. 88 dpi*/, 1.0, fitsInCache );
return QIcon( QPixmap::fromImage( img ) );
}
@@ -458,7 +458,7 @@ void QgsComposerPictureWidget::updateSvgParamGui( bool resetValues )
QColor defaultFill, defaultOutline;
double defaultOutlineWidth, defaultFillOpacity, defaultOutlineOpacity;
bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultOutlineColor, hasDefaultOutlineWidth, hasDefaultOutlineOpacity;
- QgsSvgCache::instance()->containsParams( picturePath, hasFillParam, hasDefaultFillColor, defaultFill,
+ QgsApplication::svgCache()->containsParams( picturePath, hasFillParam, hasDefaultFillColor, defaultFill,
hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity,
hasOutlineParam, hasDefaultOutlineColor, defaultOutline,
hasOutlineWidthParam, hasDefaultOutlineWidth, defaultOutlineWidth,
diff --git a/src/app/composer/qgscompositionwidget.cpp b/src/app/composer/qgscompositionwidget.cpp
index 13f91864560..cb1816afa71 100644
--- a/src/app/composer/qgscompositionwidget.cpp
+++ b/src/app/composer/qgscompositionwidget.cpp
@@ -28,10 +28,9 @@
#include
#include //for screen resolution
-QgsCompositionWidget::QgsCompositionWidget( QWidget* parent, QgsComposition* c )\
-:
-QgsPanelWidget( parent )
-, mComposition( c )
+QgsCompositionWidget::QgsCompositionWidget( QWidget* parent, QgsComposition* c )
+ : QgsPanelWidget( parent )
+ , mComposition( c )
{
setupUi( this );
setPanelTitle( tr( "Composition properties" ) );
@@ -53,12 +52,8 @@ QgsPanelWidget( parent )
updateVariables();
connect( mVariableEditor, SIGNAL( scopeChanged() ), this, SLOT( variablesChanged() ) );
// listen out for variable edits
- QgsApplication* app = qobject_cast( QgsApplication::instance() );
- if ( app )
- {
- connect( app, SIGNAL( settingsChanged() ), this, SLOT( updateVariables() ) );
- }
- connect( QgsProject::instance(), SIGNAL( variablesChanged() ), this, SLOT( updateVariables() ) );
+ connect( QgsApplication::instance(), &QgsApplication::customVariablesChanged, this, &QgsCompositionWidget::updateVariables );
+ connect( QgsProject::instance(), &QgsProject::customVariablesChanged, this, &QgsCompositionWidget::updateVariables );
if ( mComposition )
{
@@ -210,7 +205,7 @@ void QgsCompositionWidget::updateVariables()
{
QgsExpressionContext context;
context << QgsExpressionContextUtils::globalScope()
- << QgsExpressionContextUtils::projectScope()
+ << QgsExpressionContextUtils::projectScope( QgsProject::instance() )
<< QgsExpressionContextUtils::compositionScope( mComposition );
mVariableEditor->setContext( &context );
mVariableEditor->setEditableScopeIndex( 2 );
diff --git a/src/app/dwg/libdxfrw/CMakeLists.txt b/src/app/dwg/libdxfrw/CMakeLists.txt
index 8437c05b264..c8a10cdb47a 100644
--- a/src/app/dwg/libdxfrw/CMakeLists.txt
+++ b/src/app/dwg/libdxfrw/CMakeLists.txt
@@ -1,5 +1,6 @@
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/src/core
+ ${CMAKE_BINARY_DIR}/src/core
${Qt5Core_INCLUDE_DIRS}
)
diff --git a/src/app/dwg/libdxfrw/drw_base.h b/src/app/dwg/libdxfrw/drw_base.h
index 6d1fd6874d3..090a2c2a68d 100644
--- a/src/app/dwg/libdxfrw/drw_base.h
+++ b/src/app/dwg/libdxfrw/drw_base.h
@@ -68,33 +68,33 @@ namespace DRW
//! Version numbers for the DXF Format.
enum Version
{
- UNKNOWNV, /*!< UNKNOWN VERSION. */
- AC1006, /*!< R10. */
- AC1009, /*!< R11 & R12. */
- AC1012, /*!< R13. */
- AC1014, /*!< R14. */
- AC1015, /*!< ACAD 2000. */
- AC1018, /*!< ACAD 2004. */
- AC1021, /*!< ACAD 2007. */
- AC1024, /*!< ACAD 2010. */
- AC1027 /*!< ACAD 2013. */
+ UNKNOWNV, //!< UNKNOWN VERSION.
+ AC1006, //!< R10.
+ AC1009, //!< R11 & R12.
+ AC1012, //!< R13.
+ AC1014, //!< R14.
+ AC1015, //!< ACAD 2000.
+ AC1018, //!< ACAD 2004.
+ AC1021, //!< ACAD 2007.
+ AC1024, //!< ACAD 2010.
+ AC1027 //!< ACAD 2013.
};
enum error
{
- BAD_NONE, /*!< No error. */
- BAD_UNKNOWN, /*!< UNKNOWN. */
- BAD_OPEN, /*!< error opening file. */
- BAD_VERSION, /*!< unsupported version. */
- BAD_READ_METADATA, /*!< error reading matadata. */
- BAD_READ_FILE_HEADER, /*!< error in file header read process. */
- BAD_READ_HEADER, /*!< error in header vars read process. */
- BAD_READ_HANDLES, /*!< error in object map read process. */
- BAD_READ_CLASSES, /*!< error in classes read process. */
- BAD_READ_TABLES, /*!< error in tables read process. */
- BAD_READ_BLOCKS, /*!< error in block read process. */
- BAD_READ_ENTITIES, /*!< error in entities read process. */
- BAD_READ_OBJECTS /*!< error in objects read process. */
+ BAD_NONE, //!< No error.
+ BAD_UNKNOWN, //!< UNKNOWN.
+ BAD_OPEN, //!< Error opening file.
+ BAD_VERSION, //!< Unsupported version.
+ BAD_READ_METADATA, //!< Error reading matadata.
+ BAD_READ_FILE_HEADER, //!< Error in file header read process.
+ BAD_READ_HEADER, //!< Error in header vars read process.
+ BAD_READ_HANDLES, //!< Error in object map read process.
+ BAD_READ_CLASSES, //!< Error in classes read process.
+ BAD_READ_TABLES, //!< Error in tables read process.
+ BAD_READ_BLOCKS, //!< Error in block read process.
+ BAD_READ_ENTITIES, //!< Error in entities read process.
+ BAD_READ_OBJECTS //!< Error in objects read process.
};
enum DBG_LEVEL
@@ -171,7 +171,7 @@ class DRW_Coord
z = data.z;
return *this;
}
- /** < convert to unitary vector */
+ //! < convert to unitary vector
void unitize()
{
double dist;
@@ -204,11 +204,11 @@ class DRW_Vertex2D
DRW_Vertex2D( double sx, double sy, double b ): x( sx ), y( sy ), stawidth( 0 ), endwidth( 0 ), bulge( b ) {}
public:
- double x; /*!< x coordinate, code 10 */
- double y; /*!< y coordinate, code 20 */
- double stawidth; /*!< Start width, code 40 */
- double endwidth; /*!< End width, code 41 */
- double bulge; /*!< bulge, code 42 */
+ double x; //!< X coordinate, code 10
+ double y; //!< Y coordinate, code 20
+ double stawidth; //!< Start width, code 40
+ double endwidth; //!< End width, code 41
+ double bulge; //!< Bulge, code 42
};
@@ -261,7 +261,7 @@ class DRW_Variant
void setCoordY( double d ) { if ( vType == COORD ) vdata.y = d;}
void setCoordZ( double d ) { if ( vType == COORD ) vdata.z = d;}
enum TYPE type() { return vType;}
- int code() { return vCode;} /*!< returns dxf code of this value*/
+ int code() { return vCode;} //!< Returns dxf code of this value
private:
std::string sdata;
@@ -285,7 +285,7 @@ class DRW_Variant
DRW_VarContent content;
private:
enum TYPE vType;
- int vCode; /*!< dxf code of this value*/
+ int vCode; //!< Dxf code of this value
};
@@ -317,33 +317,33 @@ class DRW_LW_Conv
public:
enum lineWidth
{
- width00 = 0, /*!< 0.00mm (dxf 0)*/
- width01 = 1, /*!< 0.05mm (dxf 5)*/
- width02 = 2, /*!< 0.09mm (dxf 9)*/
- width03 = 3, /*!< 0.13mm (dxf 13)*/
- width04 = 4, /*!< 0.15mm (dxf 15)*/
- width05 = 5, /*!< 0.18mm (dxf 18)*/
- width06 = 6, /*!< 0.20mm (dxf 20)*/
- width07 = 7, /*!< 0.25mm (dxf 25)*/
- width08 = 8, /*!< 0.30mm (dxf 30)*/
- width09 = 9, /*!< 0.35mm (dxf 35)*/
- width10 = 10, /*!< 0.40mm (dxf 40)*/
- width11 = 11, /*!< 0.50mm (dxf 50)*/
- width12 = 12, /*!< 0.53mm (dxf 53)*/
- width13 = 13, /*!< 0.60mm (dxf 60)*/
- width14 = 14, /*!< 0.70mm (dxf 70)*/
- width15 = 15, /*!< 0.80mm (dxf 80)*/
- width16 = 16, /*!< 0.90mm (dxf 90)*/
- width17 = 17, /*!< 1.00mm (dxf 100)*/
- width18 = 18, /*!< 1.06mm (dxf 106)*/
- width19 = 19, /*!< 1.20mm (dxf 120)*/
- width20 = 20, /*!< 1.40mm (dxf 140)*/
- width21 = 21, /*!< 1.58mm (dxf 158)*/
- width22 = 22, /*!< 2.00mm (dxf 200)*/
- width23 = 23, /*!< 2.11mm (dxf 211)*/
- widthByLayer = 29, /*!< by layer (dxf -1) */
- widthByBlock = 30, /*!< by block (dxf -2) */
- widthDefault = 31 /*!< by default (dxf -3) */
+ width00 = 0, //!< 0.00mm (dxf 0)
+ width01 = 1, //!< 0.05mm (dxf 5)
+ width02 = 2, //!< 0.09mm (dxf 9)
+ width03 = 3, //!< 0.13mm (dxf 13)
+ width04 = 4, //!< 0.15mm (dxf 15)
+ width05 = 5, //!< 0.18mm (dxf 18)
+ width06 = 6, //!< 0.20mm (dxf 20)
+ width07 = 7, //!< 0.25mm (dxf 25)
+ width08 = 8, //!< 0.30mm (dxf 30)
+ width09 = 9, //!< 0.35mm (dxf 35)
+ width10 = 10, //!< 0.40mm (dxf 40)
+ width11 = 11, //!< 0.50mm (dxf 50)
+ width12 = 12, //!< 0.53mm (dxf 53)
+ width13 = 13, //!< 0.60mm (dxf 60)
+ width14 = 14, //!< 0.70mm (dxf 70)
+ width15 = 15, //!< 0.80mm (dxf 80)
+ width16 = 16, //!< 0.90mm (dxf 90)
+ width17 = 17, //!< 1.00mm (dxf 100)
+ width18 = 18, //!< 1.06mm (dxf 106)
+ width19 = 19, //!< 1.20mm (dxf 120)
+ width20 = 20, //!< 1.40mm (dxf 140)
+ width21 = 21, //!< 1.58mm (dxf 158)
+ width22 = 22, //!< 2.00mm (dxf 200)
+ width23 = 23, //!< 2.11mm (dxf 211)
+ widthByLayer = 29, //!< By layer (dxf -1)
+ widthByBlock = 30, //!< By block (dxf -2)
+ widthDefault = 31 //!< By default (dxf -3)
};
static int lineWidth2dxfInt( enum lineWidth lw )
diff --git a/src/app/dwg/libdxfrw/drw_classes.h b/src/app/dwg/libdxfrw/drw_classes.h
index fe7325d0c6e..ed83c713b1a 100644
--- a/src/app/dwg/libdxfrw/drw_classes.h
+++ b/src/app/dwg/libdxfrw/drw_classes.h
@@ -48,13 +48,13 @@ class DRW_Class
private:
void toDwgType();
public:
- UTF8STRING recName; /*!< record name, code 1 */
- UTF8STRING className; /*!< C++ class name, code 2 */
- UTF8STRING appName; /*!< app name, code 3 */
- int proxyFlag; /*!< Proxy capabilities flag, code 90 */
- int instanceCount; /*!< number of instances for a custom class, code 91*/
- int wasaProxyFlag; /*!< proxy flag (app loaded on save), code 280 */
- int entityFlag; /*!< entity flag, code 281 (0 object, 1 entity)*/
+ UTF8STRING recName; //!< Record name, code 1
+ UTF8STRING className; //!< C++ class name, code 2
+ UTF8STRING appName; //!< App name, code 3
+ int proxyFlag; //!< Proxy capabilities flag, code 90
+ int instanceCount; //!< Number of instances for a custom class, code 91
+ int wasaProxyFlag; //!< Proxy flag (app loaded on save), code 280
+ int entityFlag; //!< Entity flag, code 281 (0 object, 1 entity)
public: //only for read dwg
duint16 classNum;
int dwgType;
diff --git a/src/app/dwg/libdxfrw/drw_entities.cpp b/src/app/dwg/libdxfrw/drw_entities.cpp
index bf1961173b2..5d35d048e75 100644
--- a/src/app/dwg/libdxfrw/drw_entities.cpp
+++ b/src/app/dwg/libdxfrw/drw_entities.cpp
@@ -1224,8 +1224,7 @@ void DRW_Insert::parseCode( int code, dxfReader *reader )
zscale = reader->getDouble();
break;
case 50:
- angle = reader->getDouble();
- angle = angle / ARAD; //convert to radian
+ angle = reader->getDouble() / ARAD;
break;
case 70:
colcount = reader->getInt32();
@@ -1590,7 +1589,7 @@ void DRW_Text::parseCode( int code, dxfReader *reader )
widthscale = reader->getDouble();
break;
case 50:
- angle = reader->getDouble();
+ angle = reader->getDouble() / ARAD;
break;
case 51:
oblique = reader->getDouble();
@@ -1630,7 +1629,7 @@ bool DRW_Text::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs )
QgsDebugMsg( "***************************** parsing text *********************************************" );
-// DataFlags RC Used to determine presence of subsquent data, set to 0xFF for R14-
+ // DataFlags RC Used to determine presence of subsequent data, set to 0xFF for R14-
duint8 data_flags = 0x00;
if ( version > DRW::AC1014 ) //2000+
{
diff --git a/src/app/dwg/libdxfrw/drw_entities.h b/src/app/dwg/libdxfrw/drw_entities.h
index 245180acbe2..af22ac6f445 100644
--- a/src/app/dwg/libdxfrw/drw_entities.h
+++ b/src/app/dwg/libdxfrw/drw_entities.h
@@ -209,27 +209,27 @@ class DRW_Entity
bool parseDxfGroups( int code, dxfReader *reader );
public:
- enum DRW::ETYPE eType; /*!< enum: entity type, code 0 */
- duint32 handle; /*!< entity identifier, code 5 */
- duint32 parentHandle; /*!< Soft-pointer ID/handle to owner BLOCK_RECORD object, code 330 */
- std::list > appData; /*!< list of application data, code 102 */
- DRW::Space space; /*!< space indicator, code 67*/
- UTF8STRING layer; /*!< layer name, code 8 */
- UTF8STRING lineType; /*!< line type, code 6 */
- duint32 material; /*!< hard pointer id to material object, code 347 */
- int color; /*!< entity color, code 62 */
- enum DRW_LW_Conv::lineWidth lWeight; /*!< entity lineweight, code 370 */
- double ltypeScale; /*!< linetype scale, code 48 */
- bool visible; /*!< entity visibility, code 60 */
- int numProxyGraph; /*!< Number of bytes in proxy graphics, code 92 */
- std::string proxyGraphics; /*!< proxy graphics bytes, code 310 */
- int color24; /*!< 24-bit color, code 420 */
- std::string colorName; /*!< color name, code 430 */
- int transparency; /*!< transparency, code 440 */
- int plotStyle; /*!< hard pointer id to plot style object, code 390 */
- DRW::ShadowMode shadow; /*!< shadow mode, code 284 */
- bool haveExtrusion; /*!< set to true if the entity have extrusion*/
- std::vector extData; /*!< FIFO list of extended data, codes 1000 to 1071*/
+ enum DRW::ETYPE eType; //!< Enum: entity type, code 0
+ duint32 handle; //!< Entity identifier, code 5
+ duint32 parentHandle; //!< Soft-pointer ID/handle to owner BLOCK_RECORD object, code 330
+ std::list > appData; //!< List of application data, code 102
+ DRW::Space space; //!< Space indicator, code 67
+ UTF8STRING layer; //!< Layer name, code 8
+ UTF8STRING lineType; //!< Line type, code 6
+ duint32 material; //!< Hard pointer id to material object, code 347
+ int color; //!< Entity color, code 62
+ enum DRW_LW_Conv::lineWidth lWeight; //!< Entity lineweight, code 370
+ double ltypeScale; //!< Linetype scale, code 48
+ bool visible; //!< Entity visibility, code 60
+ int numProxyGraph; //!< Number of bytes in proxy graphics, code 92
+ std::string proxyGraphics; //!< Proxy graphics bytes, code 310
+ int color24; //!< 24-bit color, code 420
+ std::string colorName; //!< Color name, code 430
+ int transparency; //!< Transparency, code 440
+ int plotStyle; //!< Hard pointer id to plot style object, code 390
+ DRW::ShadowMode shadow; //!< Shadow mode, code 284
+ bool haveExtrusion; //!< Set to true if the entity have extrusion
+ std::vector extData; //!< FIFO list of extended data, codes 1000 to 1071
protected: //only for read dwg
duint8 haveNextLinks; // aka nolinks //B
@@ -277,9 +277,9 @@ class DRW_Point : public DRW_Entity
virtual bool parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs = 0 );
public:
- DRW_Coord basePoint; /*!< base point, code 10, 20 & 30 */
- double thickness; /*!< thickness, code 39 */
- DRW_Coord extPoint; /*!< Dir extrusion normal vector, code 210, 220 & 230 */
+ DRW_Coord basePoint; //!< Base point, code 10, 20 & 30
+ double thickness; //!< Thickness, code 39
+ DRW_Coord extPoint; //!< Dir extrusion normal vector, code 210, 220 & 230
// TNick: we're not handling code 50 - Angle of the X axis for
// the UCS in effect when the point was drawn
};
@@ -304,7 +304,7 @@ class DRW_Line : public DRW_Point
virtual bool parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs = 0 );
public:
- DRW_Coord secPoint; /*!< second point, code 11, 21 & 31 */
+ DRW_Coord secPoint; //!< Second point, code 11, 21 & 31
};
/** Class to handle ray entity
@@ -354,7 +354,7 @@ class DRW_Circle : public DRW_Point
virtual bool parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs = 0 );
public:
- double mRadius; /*!< radius, code 40 */
+ double mRadius; //!< Radius, code 40
};
/** Class to handle arc entity
@@ -394,9 +394,9 @@ class DRW_Arc : public DRW_Circle
virtual bool parseDwg( DRW::Version v, dwgBuffer *buf, duint32 bs = 0 );
public:
- double staangle; /*!< start angle, code 50 in radians*/
- double endangle; /*!< end angle, code 51 in radians */
- int isccw; /*!< is counter clockwise arc?, only used in hatch, code 73 */
+ double staangle; //!< Start angle, code 50 in radians
+ double endangle; //!< End angle, code 51 in radians
+ int isccw; //!< Is counter clockwise arc?, only used in hatch, code 73
};
/** Class to handle ellipse and elliptic arc entity
@@ -432,10 +432,10 @@ class DRW_Ellipse : public DRW_Line
void correctAxis();
public:
- double ratio; /*!< ratio, code 40 */
- double staparam; /*!< start parameter, code 41, 0.0 for full ellipse*/
- double endparam; /*!< end parameter, code 42, 2*PI for full ellipse */
- int isccw; /*!< is counter clockwise arc?, only used in hatch, code 73 */
+ double ratio; //!< Ratio, code 40
+ double staparam; //!< Start parameter, code 41, 0.0 for full ellipse
+ double endparam; //!< End parameter, code 42, 2*PI for full ellipse
+ int isccw; //!< Is counter clockwise arc?, only used in hatch, code 73
};
/** Class to handle trace entity
@@ -460,8 +460,8 @@ class DRW_Trace : public DRW_Line
virtual bool parseDwg( DRW::Version v, dwgBuffer *buf, duint32 bs = 0 );
public:
- DRW_Coord thirdPoint; /*!< third point, code 12, 22 & 32 */
- DRW_Coord fourthPoint; /*!< four point, code 13, 23 & 33 */
+ DRW_Coord thirdPoint; //!< Third point, code 12, 22 & 32
+ DRW_Coord fourthPoint; //!< Four point, code 13, 23 & 33
};
/** Class to handle solid entity
@@ -544,7 +544,7 @@ class DRW_3Dface : public DRW_Trace
virtual bool parseDwg( DRW::Version v, dwgBuffer *buf, duint32 bs = 0 );
public:
- int invisibleflag; /*!< invisible edge flag, code 70 */
+ int invisibleflag; //!< Invisible edge flag, code 70
};
@@ -570,8 +570,8 @@ class DRW_Block : public DRW_Point
virtual bool parseDwg( DRW::Version v, dwgBuffer *buf, duint32 bs = 0 );
public:
- UTF8STRING name; /*!< block name, code 2 */
- int flags; /*!< block type, code 70 */
+ UTF8STRING name; //!< Block name, code 2
+ int flags; //!< Block type, code 70
private:
bool isEnd; //for dwg parsing
};
@@ -604,15 +604,15 @@ class DRW_Insert : public DRW_Point
virtual bool parseDwg( DRW::Version v, dwgBuffer *buf, duint32 bs = 0 );
public:
- UTF8STRING name; /*!< block name, code 2 */
- double xscale; /*!< x scale factor, code 41 */
- double yscale; /*!< y scale factor, code 42 */
- double zscale; /*!< z scale factor, code 43 */
- double angle; /*!< rotation angle in radians, code 50 */
- int colcount; /*!< column count, code 70 */
- int rowcount; /*!< row count, code 71 */
- double colspace; /*!< column space, code 44 */
- double rowspace; /*!< row space, code 45 */
+ UTF8STRING name; //!< Block name, code 2
+ double xscale; //!< X scale factor, code 41
+ double yscale; //!< Y scale factor, code 42
+ double zscale; //!< Z scale factor, code 43
+ double angle; //!< Rotation angle in radians, code 50
+ int colcount; //!< Column count, code 70
+ int rowcount; //!< Row count, code 71
+ double colspace; //!< Column space, code 44
+ double rowspace; //!< Row space, code 45
public: //only for read dwg
dwgHandle blockRecH;
dwgHandle seqendH; //RLZ: on implement attrib remove this handle from obj list (see pline/vertex code)
@@ -684,14 +684,14 @@ class DRW_LWPolyline : public DRW_Entity
bool parseDwg( DRW::Version v, dwgBuffer *buf, duint32 bs = 0 );
public:
- std::vector::size_type vertexnum; /*!< number of vertices, code 90 */
- int flags; /*!< polyline flag, code 70, default 0 */
- double width; /*!< constant width, code 43 */
- double elevation; /*!< elevation, code 38 */
- double thickness; /*!< thickness, code 39 */
- DRW_Coord extPoint; /*!< Dir extrusion normal vector, code 210, 220 & 230 */
- DRW_Vertex2D *vertex; /*!< current vertex to add data */
- std::vector vertlist; /*!< vertex list */
+ std::vector::size_type vertexnum; //!< Number of vertices, code 90
+ int flags; //!< Polyline flag, code 70, default 0
+ double width; //!< Constant width, code 43
+ double elevation; //!< Elevation, code 38
+ double thickness; //!< Thickness, code 39
+ DRW_Coord extPoint; //!< Dir extrusion normal vector, code 210, 220 & 230
+ DRW_Vertex2D *vertex; //!< Current vertex to add data
+ std::vector vertlist; //!< Vertex list
};
/** Class to handle insert entries
@@ -704,21 +704,21 @@ class DRW_Text : public DRW_Line
//! Vertical alignments.
enum VAlign
{
- VBaseLine = 0, /*!< Top = 0 */
- VBottom, /*!< Bottom = 1 */
- VMiddle, /*!< Middle = 2 */
- VTop /*!< Top = 3 */
+ VBaseLine = 0, //!< Top = 0
+ VBottom, //!< Bottom = 1
+ VMiddle, //!< Middle = 2
+ VTop //!< Top = 3
};
//! Horizontal alignments.
enum HAlign
{
- HLeft = 0, /*!< Left = 0 */
- HCenter, /*!< Centered = 1 */
- HRight, /*!< Right = 2 */
- HAligned, /*!< Aligned = 3 (if VAlign==0) */
- HMiddle, /*!< middle = 4 (if VAlign==0) */
- HFit /*!< fit into point = 5 (if VAlign==0) */
+ HLeft = 0, //!< Left = 0
+ HCenter, //!< Centered = 1
+ HRight, //!< Right = 2
+ HAligned, //!< Aligned = 3 (if VAlign==0)
+ HMiddle, //!< Middle = 4 (if VAlign==0)
+ HFit //!< Fit into point = 5 (if VAlign==0)
};
DRW_Text( enum DRW::ETYPE type = DRW::TEXT )
@@ -741,16 +741,16 @@ class DRW_Text : public DRW_Line
virtual bool parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs = 0 );
public:
- double height; /*!< height text, code 40 */
- UTF8STRING text; /*!< text string, code 1 */
- double angle; /*!< rotation angle in degrees (360), code 50 */
- double widthscale; /*!< width factor, code 41 */
- double oblique; /*!< oblique angle, code 51 */
- UTF8STRING style; /*!< style name, code 7 */
- int textgen; /*!< text generation, code 71 */
- enum HAlign alignH; /*!< horizontal align, code 72 */
- enum VAlign alignV; /*!< vertical align, code 73 */
- dwgHandle styleH; /*!< handle for text style */
+ double height; //!< Height text, code 40
+ UTF8STRING text; //!< Text string, code 1
+ double angle; //!< Rotation angle in degrees (360), code 50
+ double widthscale; //!< Width factor, code 41
+ double oblique; //!< Oblique angle, code 51
+ UTF8STRING style; //!< Style name, code 7
+ int textgen; //!< Text generation, code 71
+ enum HAlign alignH; //!< Horizontal align, code 72
+ enum VAlign alignV; //!< Vertical align, code 73
+ dwgHandle styleH; //!< Handle for text style
};
/** Class to handle insert entries
@@ -789,7 +789,7 @@ class DRW_MText : public DRW_Text
virtual bool parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs = 0 );
public:
- double interlin; /*!< width factor, code 44 */
+ double interlin; //!< Width factor, code 44
private:
bool haveXAxis;
};
@@ -843,17 +843,17 @@ class DRW_Vertex : public DRW_Point
}
public:
- double stawidth; /*!< Start width, code 40 */
- double endwidth; /*!< End width, code 41 */
- double bulge; /*!< bulge, code 42 */
+ double stawidth; //!< Start width, code 40
+ double endwidth; //!< End width, code 41
+ double bulge; //!< Bulge, code 42
- int flags; /*!< vertex flag, code 70, default 0 */
- double tgdir; /*!< curve fit tangent direction, code 50 */
- int vindex1; /*!< polyface mesh vertex index, code 71, default 0 */
- int vindex2; /*!< polyface mesh vertex index, code 72, default 0 */
- int vindex3; /*!< polyface mesh vertex index, code 73, default 0 */
- int vindex4; /*!< polyface mesh vertex index, code 74, default 0 */
- int identifier; /*!< vertex identifier, code 91, default 0 */
+ int flags; //!< Vertex flag, code 70, default 0
+ double tgdir; //!< Curve fit tangent direction, code 50
+ int vindex1; //!< Polyface mesh vertex index, code 71, default 0
+ int vindex2; //!< Polyface mesh vertex index, code 72, default 0
+ int vindex3; //!< Polyface mesh vertex index, code 73, default 0
+ int vindex4; //!< Polyface mesh vertex index, code 74, default 0
+ int identifier; //!< Vertex identifier, code 91, default 0
};
/** Class to handle polyline entity
@@ -904,16 +904,16 @@ class DRW_Polyline : public DRW_Point
virtual bool parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs = 0 );
public:
- int flags; /*!< polyline flag, code 70, default 0 */
- double defstawidth; /*!< Start width, code 40, default 0 */
- double defendwidth; /*!< End width, code 41, default 0 */
- int vertexcount; /*!< polygon mesh M vertex or polyface vertex num, code 71, default 0 */
- int facecount; /*!< polygon mesh N vertex or polyface face num, code 72, default 0 */
- int smoothM; /*!< smooth surface M density, code 73, default 0 */
- int smoothN; /*!< smooth surface M density, code 74, default 0 */
- int curvetype; /*!< curves & smooth surface type, code 75, default 0 */
+ int flags; //!< Polyline flag, code 70, default 0
+ double defstawidth; //!< Start width, code 40, default 0
+ double defendwidth; //!< End width, code 41, default 0
+ int vertexcount; //!< Polygon mesh M vertex or polyface vertex num, code 71, default 0
+ int facecount; //!< Polygon mesh N vertex or polyface face num, code 72, default 0
+ int smoothM; //!< Smooth surface M density, code 73, default 0
+ int smoothN; //!< Smooth surface M density, code 74, default 0
+ int curvetype; //!< Curves & smooth surface type, code 75, default 0
- std::vector vertlist; /*!< vertex list */
+ std::vector vertlist; //!< Vertex list
private:
std::list handleList; // list of handles, only in 2004+
@@ -962,34 +962,34 @@ class DRW_Spline : public DRW_Entity
virtual bool parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs = 0 );
public:
-// double ex; /*!< normal vector x coordinate, code 210 */
-// double ey; /*!< normal vector y coordinate, code 220 */
-// double ez; /*!< normal vector z coordinate, code 230 */
- DRW_Coord normalVec; /*!< normal vector, code 210, 220, 230 */
- DRW_Coord tgStart; /*!< start tangent, code 12, 22, 32 */
-// double tgsx; /*!< start tangent x coordinate, code 12 */
-// double tgsy; /*!< start tangent y coordinate, code 22 */
-// double tgsz; /*!< start tangent z coordinate, code 32 */
- DRW_Coord tgEnd; /*!< end tangent, code 13, 23, 33 */
-// double tgex; /*!< end tangent x coordinate, code 13 */
-// double tgey; /*!< end tangent y coordinate, code 23 */
-// double tgez; /*!< end tangent z coordinate, code 33 */
- int flags; /*!< spline flag, code 70 */
- int degree; /*!< degree of the spline, code 71 */
- dint32 nknots; /*!< number of knots, code 72, default 0 */
- dint32 ncontrol; /*!< number of control points, code 73, default 0 */
- dint32 nfit; /*!< number of fit points, code 74, default 0 */
- double tolknot; /*!< knot tolerance, code 42, default 0.0000001 */
- double tolcontrol; /*!< control point tolerance, code 43, default 0.0000001 */
- double tolfit; /*!< fit point tolerance, code 44, default 0.0000001 */
+// double ex; //!< Normal vector x coordinate, code 210
+// double ey; //!< Normal vector y coordinate, code 220
+// double ez; //!< Normal vector z coordinate, code 230
+ DRW_Coord normalVec; //!< Normal vector, code 210, 220, 230
+ DRW_Coord tgStart; //!< Start tangent, code 12, 22, 32
+// double tgsx; //!< Start tangent x coordinate, code 12
+// double tgsy; //!< Start tangent y coordinate, code 22
+// double tgsz; //!< Start tangent z coordinate, code 32
+ DRW_Coord tgEnd; //!< End tangent, code 13, 23, 33
+// double tgex; //!< End tangent x coordinate, code 13
+// double tgey; //!< End tangent y coordinate, code 23
+// double tgez; //!< End tangent z coordinate, code 33
+ int flags; //!< Spline flag, code 70
+ int degree; //!< Degree of the spline, code 71
+ dint32 nknots; //!< Number of knots, code 72, default 0
+ dint32 ncontrol; //!< Number of control points, code 73, default 0
+ dint32 nfit; //!< Number of fit points, code 74, default 0
+ double tolknot; //!< Knot tolerance, code 42, default 0.0000001
+ double tolcontrol; //!< Control point tolerance, code 43, default 0.0000001
+ double tolfit; //!< Fit point tolerance, code 44, default 0.0000001
- std::vector knotslist; /*!< knots list, code 40 */
- std::vector controllist; /*!< control points list, code 10, 20 & 30 */
- std::vector fitlist; /*!< fit points list, code 11, 21 & 31 */
+ std::vector knotslist; //!< Knots list, code 40
+ std::vector controllist; //!< Control points list, code 10, 20 & 30
+ std::vector fitlist; //!< Fit points list, code 11, 21 & 31
private:
- DRW_Coord *controlpoint; /*!< current control point to add data */
- DRW_Coord *fitpoint; /*!< current fit point to add data */
+ DRW_Coord *controlpoint; //!< Current control point to add data
+ DRW_Coord *fitpoint; //!< Current fit point to add data
};
/** Class to handle hatch loop
@@ -1024,11 +1024,11 @@ class DRW_HatchLoop
}
public:
- int type; /*!< boundary path type, code 92, polyline=2, default=0 */
- std::vector::size_type numedges; /*!< number of edges (if not a polyline), code 93 */
+ int type; //!< Boundary path type, code 92, polyline=2, default=0
+ std::vector::size_type numedges; //!< Number of edges (if not a polyline), code 93
//TODO: store lwpolylines as entities
-// std::vector pollist; /*!< polyline list */
- std::vector objlist; /*!< entities list */
+// std::vector pollist; //!< Polyline list
+ std::vector objlist; //!< Entities list
};
/** Class to handle hatch entity
@@ -1075,18 +1075,18 @@ class DRW_Hatch : public DRW_Point
virtual bool parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs = 0 );
public:
- UTF8STRING name; /*!< hatch pattern name, code 2 */
- int solid; /*!< solid fill flag, code 70, solid=1, pattern=0 */
- int associative; /*!< associativity, code 71, associatve=1, non-assoc.=0 */
- int hstyle; /*!< hatch style, code 75 */
- int hpattern; /*!< hatch pattern type, code 76 */
- int doubleflag; /*!< hatch pattern double flag, code 77, double=1, single=0 */
- std::vector::size_type loopsnum; /*!< number of boundary paths (loops), code 91 */
- double angle; /*!< hatch pattern angle, code 52 */
- double scale; /*!< hatch pattern scale, code 41 */
- int deflines; /*!< number of pattern definition lines, code 78 */
+ UTF8STRING name; //!< Hatch pattern name, code 2
+ int solid; //!< Solid fill flag, code 70, solid=1, pattern=0
+ int associative; //!< Associativity, code 71, associatve=1, non-assoc.=0
+ int hstyle; //!< Hatch style, code 75
+ int hpattern; //!< Hatch pattern type, code 76
+ int doubleflag; //!< Hatch pattern double flag, code 77, double=1, single=0
+ std::vector::size_type loopsnum; //!< Number of boundary paths (loops), code 91
+ double angle; //!< Hatch pattern angle, code 52
+ double scale; //!< Hatch pattern scale, code 41
+ int deflines; //!< Number of pattern definition lines, code 78
- std::vector looplist; /*!< polyline list */
+ std::vector looplist; //!< Polyline list
private:
void clearEntities()
@@ -1140,7 +1140,7 @@ class DRW_Hatch : public DRW_Point
}
}
- DRW_HatchLoop *loop; /*!< current loop to add data */
+ DRW_HatchLoop *loop; //!< Current loop to add data
DRW_Line *line;
DRW_Arc *arc;
DRW_Ellipse *ellipse;
@@ -1176,15 +1176,15 @@ class DRW_Image : public DRW_Line
virtual bool parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs = 0 );
public:
- duint32 ref; /*!< Hard reference to imagedef object, code 340 */
- DRW_Coord vVector; /*!< V-vector of single pixel, x coordinate, code 12, 22 & 32 */
- double sizeu; /*!< image size in pixels, U value, code 13 */
- double sizev; /*!< image size in pixels, V value, code 23 */
- double dz; /*!< z coordinate, code 33 */
- int clip; /*!< Clipping state, code 280, 0=off 1=on */
- int brightness; /*!< Brightness value, code 281, (0-100) default 50 */
- int contrast; /*!< Brightness value, code 282, (0-100) default 50 */
- int fade; /*!< Brightness value, code 283, (0-100) default 0 */
+ duint32 ref; //!< Hard reference to imagedef object, code 340
+ DRW_Coord vVector; //!< V-vector of single pixel, x coordinate, code 12, 22 & 32
+ double sizeu; //!< Image size in pixels, U value, code 13
+ double sizev; //!< Image size in pixels, V value, code 23
+ double dz; //!< Z coordinate, code 33
+ int clip; //!< Clipping state, code 280, 0=off 1=on
+ int brightness; //!< Brightness value, code 281, (0-100) default 50
+ int contrast; //!< Brightness value, code 282, (0-100) default 50
+ int fade; //!< Brightness value, code 283, (0-100) default 0
};
@@ -1237,8 +1237,6 @@ class DRW_Dimension : public DRW_Entity
{
}
- virtual ~DRW_Dimension() {}
-
virtual void applyExtrusion() {}
protected:
@@ -1253,28 +1251,28 @@ class DRW_Dimension : public DRW_Entity
}
public:
- DRW_Coord getDefPoint() const {return defPoint;} /*!< Definition point, code 10, 20 & 30 */
+ DRW_Coord getDefPoint() const {return defPoint;} //!< Definition point, code 10, 20 & 30
void setDefPoint( const DRW_Coord &p ) {defPoint = p;}
- DRW_Coord getTextPoint() const {return textPoint;} /*!< Middle point of text, code 11, 21 & 31 */
+ DRW_Coord getTextPoint() const {return textPoint;} //!< Middle point of text, code 11, 21 & 31
void setTextPoint( const DRW_Coord &p ) {textPoint = p;}
- std::string getStyle() const {return style;} /*!< Dimension style, code 3 */
+ std::string getStyle() const {return style;} //!< Dimension style, code 3
void setStyle( const std::string &s ) {style = s;}
- int getAlign() const { return align;} /*!< attachment point, code 71 */
+ int getAlign() const { return align;} //!< Attachment point, code 71
void setAlign( const int a ) { align = a;}
- int getTextLineStyle() const { return linesty;} /*!< Dimension text line spacing style, code 72, default 1 */
+ int getTextLineStyle() const { return linesty;} //!< Dimension text line spacing style, code 72, default 1
void setTextLineStyle( const int l ) { linesty = l;}
- std::string getText() const {return text;} /*!< Dimension text explicitly entered by the user, code 1 */
+ std::string getText() const {return text;} //!< Dimension text explicitly entered by the user, code 1
void setText( const std::string &t ) {text = t;}
- double getTextLineFactor() const { return linefactor;} /*!< Dimension text line spacing factor, code 41, default 1? */
+ double getTextLineFactor() const { return linefactor;} //!< Dimension text line spacing factor, code 41, default 1?
void setTextLineFactor( const double l ) { linefactor = l;}
- double getDir() const { return rot;} /*!< rotation angle of the dimension text, code 53 (optional) default 0 */
+ double getDir() const { return rot;} //!< Rotation angle of the dimension text, code 53 (optional) default 0
void setDir( const double d ) { rot = d;}
- DRW_Coord getExtrusion() {return extPoint;} /*!< extrusion, code 210, 220 & 230 */
+ DRW_Coord getExtrusion() {return extPoint;} //!< Extrusion, code 210, 220 & 230
void setExtrusion( const DRW_Coord &p ) {extPoint = p;}
- std::string getName() {return name;} /*!< Name of the block that contains the entities, code 2 */
+ std::string getName() {return name;} //!< Name of the block that contains the entities, code 2
void setName( const std::string &s ) {name = s;}
-// int getType(){ return type;} /*!< Dimension type, code 70 */
+// int getType(){ return type;} //!< Dimension type, code 70
protected:
DRW_Coord getPt2() const {return clonePoint;}
@@ -1287,36 +1285,36 @@ class DRW_Dimension : public DRW_Entity
void setPt5( const DRW_Coord &p ) {circlePoint = p;}
DRW_Coord getPt6() const {return arcPoint;}
void setPt6( const DRW_Coord &p ) {arcPoint = p;}
- double getAn50() const {return angle;} /*!< Angle of rotated, horizontal, or vertical dimensions, code 50 */
+ double getAn50() const {return angle;} //!< Angle of rotated, horizontal, or vertical dimensions, code 50
void setAn50( const double d ) {angle = d;}
- double getOb52() const {return oblique;} /*!< oblique angle, code 52 */
+ double getOb52() const {return oblique;} //!< Oblique angle, code 52
void setOb52( const double d ) {oblique = d;}
- double getRa40() const {return length;} /*!< Leader length, code 40 */
+ double getRa40() const {return length;} //!< Leader length, code 40
void setRa40( const double d ) {length = d;}
public:
- int type; /*!< Dimension type, code 70 */
+ int type; //!< Dimension type, code 70
private:
- std::string name; /*!< Name of the block that contains the entities, code 2 */
- DRW_Coord defPoint; /*!< definition point, code 10, 20 & 30 (WCS) */
- DRW_Coord textPoint; /*!< Middle point of text, code 11, 21 & 31 (OCS) */
- UTF8STRING text; /*!< Dimension text explicitly entered by the user, code 1 */
- UTF8STRING style; /*!< Dimension style, code 3 */
- int align; /*!< attachment point, code 71 */
- int linesty; /*!< Dimension text line spacing style, code 72, default 1 */
- double linefactor; /*!< Dimension text line spacing factor, code 41, default 1? (value range 0.25 to 4.00) */
- double rot; /*!< rotation angle of the dimension text, code 53 */
- DRW_Coord extPoint; /*!< extrusion normal vector, code 210, 220 & 230 */
+ std::string name; //!< Name of the block that contains the entities, code 2
+ DRW_Coord defPoint; //!< Definition point, code 10, 20 & 30 (WCS)
+ DRW_Coord textPoint; //!< Middle point of text, code 11, 21 & 31 (OCS)
+ UTF8STRING text; //!< Dimension text explicitly entered by the user, code 1
+ UTF8STRING style; //!< Dimension style, code 3
+ int align; //!< Attachment point, code 71
+ int linesty; //!< Dimension text line spacing style, code 72, default 1
+ double linefactor; //!< Dimension text line spacing factor, code 41, default 1? (value range 0.25 to 4.00)
+ double rot; //!< Rotation angle of the dimension text, code 53
+ DRW_Coord extPoint; //!< Extrusion normal vector, code 210, 220 & 230
- double hdir; /*!< horizontal direction for the dimension, code 51, default ? */
- DRW_Coord clonePoint; /*!< Insertion point for clones (Baseline & Continue), code 12, 22 & 32 (OCS) */
- DRW_Coord def1; /*!< Definition point 1for linear & angular, code 13, 23 & 33 (WCS) */
- DRW_Coord def2; /*!< Definition point 2, code 14, 24 & 34 (WCS) */
- double angle; /*!< Angle of rotated, horizontal, or vertical dimensions, code 50 */
- double oblique; /*!< oblique angle, code 52 */
+ double hdir; //!< Horizontal direction for the dimension, code 51, default ?
+ DRW_Coord clonePoint; //!< Insertion point for clones (Baseline & Continue), code 12, 22 & 32 (OCS)
+ DRW_Coord def1; //!< Definition point 1for linear & angular, code 13, 23 & 33 (WCS)
+ DRW_Coord def2; //!< Definition point 2, code 14, 24 & 34 (WCS)
+ double angle; //!< Angle of rotated, horizontal, or vertical dimensions, code 50
+ double oblique; //!< Oblique angle, code 52
- DRW_Coord circlePoint; /*!< Definition point for diameter, radius & angular dims code 15, 25 & 35 (WCS) */
- DRW_Coord arcPoint; /*!< Point defining dimension arc, x coordinate, code 16, 26 & 36 (OCS) */
- double length; /*!< Leader length, code 40 */
+ DRW_Coord circlePoint; //!< Definition point for diameter, radius & angular dims code 15, 25 & 35 (WCS)
+ DRW_Coord arcPoint; //!< Point defining dimension arc, x coordinate, code 16, 26 & 36 (OCS)
+ double length; //!< Leader length, code 40
protected:
dwgHandle dimStyleH;
@@ -1341,14 +1339,14 @@ class DRW_DimAligned : public DRW_Dimension
eType = DRW::DIMALIGNED;
}
- DRW_Coord getClonepoint() const {return getPt2();} /*!< Insertion for clones (Baseline & Continue), 12, 22 & 32 */
+ DRW_Coord getClonepoint() const {return getPt2();} //!< Insertion for clones (Baseline & Continue), 12, 22 & 32
void setClonePoint( DRW_Coord &c ) {setPt2( c );}
- DRW_Coord getDimPoint() const {return getDefPoint();} /*!< dim line location point, code 10, 20 & 30 */
+ DRW_Coord getDimPoint() const {return getDefPoint();} //!< Dim line location point, code 10, 20 & 30
void setDimPoint( const DRW_Coord &p ) {setDefPoint( p );}
- DRW_Coord getDef1Point() const {return getPt3();} /*!< Definition point 1, code 13, 23 & 33 */
+ DRW_Coord getDef1Point() const {return getPt3();} //!< Definition point 1, code 13, 23 & 33
void setDef1Point( const DRW_Coord &p ) {setPt3( p );}
- DRW_Coord getDef2Point() const {return getPt4();} /*!< Definition point 2, code 14, 24 & 34 */
+ DRW_Coord getDef2Point() const {return getPt4();} //!< Definition point 2, code 14, 24 & 34
void setDef2Point( const DRW_Coord &p ) {setPt4( p );}
protected:
@@ -1371,9 +1369,9 @@ class DRW_DimLinear : public DRW_DimAligned
eType = DRW::DIMLINEAR;
}
- double getAngle() const {return getAn50();} /*!< Angle of rotated, horizontal, or vertical dimensions, code 50 */
+ double getAngle() const {return getAn50();} //!< Angle of rotated, horizontal, or vertical dimensions, code 50
void setAngle( const double d ) {setAn50( d );}
- double getOblique() const {return getOb52();} /*!< oblique angle, code 52 */
+ double getOblique() const {return getOb52();} //!< Oblique angle, code 52
void setOblique( const double d ) {setOb52( d );}
};
@@ -1394,11 +1392,11 @@ class DRW_DimRadial : public DRW_Dimension
eType = DRW::DIMRADIAL;
}
- DRW_Coord getCenterPoint() const {return getDefPoint();} /*!< center point, code 10, 20 & 30 */
+ DRW_Coord getCenterPoint() const {return getDefPoint();} //!< Center point, code 10, 20 & 30
void setCenterPoint( const DRW_Coord &p ) {setDefPoint( p );}
- DRW_Coord getDiameterPoint() const {return getPt5();} /*!< Definition point for radius, code 15, 25 & 35 */
+ DRW_Coord getDiameterPoint() const {return getPt5();} //!< Definition point for radius, code 15, 25 & 35
void setDiameterPoint( const DRW_Coord &p ) {setPt5( p );}
- double getLeaderLength() const {return getRa40();} /*!< Leader length, code 40 */
+ double getLeaderLength() const {return getRa40();} //!< Leader length, code 40
void setLeaderLength( const double d ) {setRa40( d );}
protected:
@@ -1422,11 +1420,11 @@ class DRW_DimDiametric : public DRW_Dimension
eType = DRW::DIMDIAMETRIC;
}
- DRW_Coord getDiameter1Point() const {return getPt5();} /*!< First definition point for diameter, code 15, 25 & 35 */
+ DRW_Coord getDiameter1Point() const {return getPt5();} //!< First definition point for diameter, code 15, 25 & 35
void setDiameter1Point( const DRW_Coord &p ) {setPt5( p );}
- DRW_Coord getDiameter2Point() const {return getDefPoint();} /*!< Oposite point for diameter, code 10, 20 & 30 */
+ DRW_Coord getDiameter2Point() const {return getDefPoint();} //!< Oposite point for diameter, code 10, 20 & 30
void setDiameter2Point( const DRW_Coord &p ) {setDefPoint( p );}
- double getLeaderLength() const {return getRa40();} /*!< Leader length, code 40 */
+ double getLeaderLength() const {return getRa40();} //!< Leader length, code 40
void setLeaderLength( const double d ) {setRa40( d );}
protected:
@@ -1450,15 +1448,15 @@ class DRW_DimAngular : public DRW_Dimension
eType = DRW::DIMANGULAR;
}
- DRW_Coord getFirstLine1() const {return getPt3();} /*!< Definition point line 1-1, code 13, 23 & 33 */
+ DRW_Coord getFirstLine1() const {return getPt3();} //!< Definition point line 1-1, code 13, 23 & 33
void setFirstLine1( const DRW_Coord &p ) {setPt3( p );}
- DRW_Coord getFirstLine2() const {return getPt4();} /*!< Definition point line 1-2, code 14, 24 & 34 */
+ DRW_Coord getFirstLine2() const {return getPt4();} //!< Definition point line 1-2, code 14, 24 & 34
void setFirstLine2( const DRW_Coord &p ) {setPt4( p );}
- DRW_Coord getSecondLine1() const {return getPt5();} /*!< Definition point line 2-1, code 15, 25 & 35 */
+ DRW_Coord getSecondLine1() const {return getPt5();} //!< Definition point line 2-1, code 15, 25 & 35
void setSecondLine1( const DRW_Coord &p ) {setPt5( p );}
- DRW_Coord getSecondLine2() const {return getDefPoint();} /*!< Definition point line 2-2, code 10, 20 & 30 */
+ DRW_Coord getSecondLine2() const {return getDefPoint();} //!< Definition point line 2-2, code 10, 20 & 30
void setSecondLine2( const DRW_Coord &p ) {setDefPoint( p );}
- DRW_Coord getDimPoint() const {return getPt6();} /*!< Dimension definition point, code 16, 26 & 36 */
+ DRW_Coord getDimPoint() const {return getPt6();} //!< Dimension definition point, code 16, 26 & 36
void setDimPoint( const DRW_Coord &p ) {setPt6( p );}
protected:
@@ -1483,13 +1481,13 @@ class DRW_DimAngular3p : public DRW_Dimension
eType = DRW::DIMANGULAR3P;
}
- DRW_Coord getFirstLine() const {return getPt3();} /*!< Definition point line 1, code 13, 23 & 33 */
+ DRW_Coord getFirstLine() const {return getPt3();} //!< Definition point line 1, code 13, 23 & 33
void setFirstLine( const DRW_Coord &p ) {setPt3( p );}
- DRW_Coord getSecondLine() const {return getPt4();} /*!< Definition point line 2, code 14, 24 & 34 */
+ DRW_Coord getSecondLine() const {return getPt4();} //!< Definition point line 2, code 14, 24 & 34
void setSecondLine( const DRW_Coord &p ) {setPt4( p );}
- DRW_Coord getVertexPoint() const {return getPt5();} /*!< Vertex point, code 15, 25 & 35 */
+ DRW_Coord getVertexPoint() const {return getPt5();} //!< Vertex point, code 15, 25 & 35
void SetVertexPoint( const DRW_Coord &p ) {setPt5( p );}
- DRW_Coord getDimPoint() const {return getDefPoint();} /*!< Dimension definition point, code 10, 20 & 30 */
+ DRW_Coord getDimPoint() const {return getDefPoint();} //!< Dimension definition point, code 10, 20 & 30
void setDimPoint( const DRW_Coord &p ) {setDefPoint( p );}
protected:
@@ -1513,11 +1511,11 @@ class DRW_DimOrdinate : public DRW_Dimension
eType = DRW::DIMORDINATE;
}
- DRW_Coord getOriginPoint() const {return getDefPoint();} /*!< Origin definition point, code 10, 20 & 30 */
+ DRW_Coord getOriginPoint() const {return getDefPoint();} //!< Origin definition point, code 10, 20 & 30
void setOriginPoint( const DRW_Coord &p ) {setDefPoint( p );}
- DRW_Coord getFirstLine() const {return getPt3();} /*!< Feature location point, code 13, 23 & 33 */
+ DRW_Coord getFirstLine() const {return getPt3();} //!< Feature location point, code 13, 23 & 33
void setFirstLine( const DRW_Coord &p ) {setPt3( p );}
- DRW_Coord getSecondLine() const {return getPt4();} /*!< Leader end point, code 14, 24 & 34 */
+ DRW_Coord getSecondLine() const {return getPt4();} //!< Leader end point, code 14, 24 & 34
void setSecondLine( const DRW_Coord &p ) {setPt4( p );}
protected:
@@ -1564,26 +1562,26 @@ class DRW_Leader : public DRW_Entity
virtual bool parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs = 0 );
public:
- UTF8STRING style; /*!< Dimension style name, code 3 */
- int arrow; /*!< Arrowhead flag, code 71, 0=Disabled; 1=Enabled */
- int leadertype; /*!< Leader path type, code 72, 0=Straight line segments; 1=Spline */
- int flag; /*!< Leader creation flag, code 73, default 3 */
- int hookline; /*!< Hook line direction flag, code 74, default 1 */
- int hookflag; /*!< Hook line flag, code 75 */
- double textheight; /*!< Text annotation height, code 40 */
- double textwidth; /*!< Text annotation width, code 41 */
- int vertnum; /*!< Number of vertices, code 76 */
- int coloruse; /*!< Color to use if leader's DIMCLRD = BYBLOCK, code 77 */
- duint32 annotHandle; /*!< Hard reference to associated annotation, code 340 */
- DRW_Coord extrusionPoint; /*!< Normal vector, code 210, 220 & 230 */
- DRW_Coord horizdir; /*!< "Horizontal" direction for leader, code 211, 221 & 231 */
- DRW_Coord offsetblock; /*!< Offset of last leader vertex from block, code 212, 222 & 232 */
- DRW_Coord offsettext; /*!< Offset of last leader vertex from annotation, code 213, 223 & 233 */
+ UTF8STRING style; //!< Dimension style name, code 3
+ int arrow; //!< Arrowhead flag, code 71, 0=Disabled; 1=Enabled
+ int leadertype; //!< Leader path type, code 72, 0=Straight line segments; 1=Spline
+ int flag; //!< Leader creation flag, code 73, default 3
+ int hookline; //!< Hook line direction flag, code 74, default 1
+ int hookflag; //!< Hook line flag, code 75
+ double textheight; //!< Text annotation height, code 40
+ double textwidth; //!< Text annotation width, code 41
+ int vertnum; //!< Number of vertices, code 76
+ int coloruse; //!< Color to use if leader's DIMCLRD = BYBLOCK, code 77
+ duint32 annotHandle; //!< Hard reference to associated annotation, code 340
+ DRW_Coord extrusionPoint; //!< Normal vector, code 210, 220 & 230
+ DRW_Coord horizdir; //!< "Horizontal" direction for leader, code 211, 221 & 231
+ DRW_Coord offsetblock; //!< Offset of last leader vertex from block, code 212, 222 & 232
+ DRW_Coord offsettext; //!< Offset of last leader vertex from annotation, code 213, 223 & 233
- std::vector vertexlist; /*!< vertex points list, code 10, 20 & 30 */
+ std::vector vertexlist; //!< Vertex points list, code 10, 20 & 30
private:
- DRW_Coord *vertexpoint; /*!< current control point to add data */
+ DRW_Coord *vertexpoint; //!< Current control point to add data
dwgHandle dimStyleH;
dwgHandle AnnotH;
};
@@ -1624,25 +1622,25 @@ class DRW_Viewport : public DRW_Point
virtual bool parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs = 0 );
public:
- double pswidth; /*!< Width in paper space units, code 40 */
- double psheight; /*!< Height in paper space units, code 41 */
- int vpstatus; /*!< Viewport status, code 68 */
- int vpID; /*!< Viewport ID, code 69 */
- double centerPX; /*!< view center point X, code 12 */
- double centerPY; /*!< view center point Y, code 22 */
- double snapPX; /*!< Snap base point X, code 13 */
- double snapPY; /*!< Snap base point Y, code 23 */
- double snapSpPX; /*!< Snap spacing X, code 14 */
- double snapSpPY; /*!< Snap spacing Y, code 24 */
+ double pswidth; //!< Width in paper space units, code 40
+ double psheight; //!< Height in paper space units, code 41
+ int vpstatus; //!< Viewport status, code 68
+ int vpID; //!< Viewport ID, code 69
+ double centerPX; //!< View center point X, code 12
+ double centerPY; //!< View center point Y, code 22
+ double snapPX; //!< Snap base point X, code 13
+ double snapPY; //!< Snap base point Y, code 23
+ double snapSpPX; //!< Snap spacing X, code 14
+ double snapSpPY; //!< Snap spacing Y, code 24
//TODO: complete in dxf
- DRW_Coord viewDir; /*!< View direction vector, code 16, 26 & 36 */
- DRW_Coord viewTarget; /*!< View target point, code 17, 27, 37 */
- double viewLength; /*!< Perspective lens length, code 42 */
- double frontClip; /*!< Front clip plane Z value, code 43 */
- double backClip; /*!< Back clip plane Z value, code 44 */
- double viewHeight; /*!< View height in model space units, code 45 */
- double snapAngle; /*!< Snap angle, code 50 */
- double twistAngle; /*!< view twist angle, code 51 */
+ DRW_Coord viewDir; //!< View direction vector, code 16, 26 & 36
+ DRW_Coord viewTarget; //!< View target point, code 17, 27, 37
+ double viewLength; //!< Perspective lens length, code 42
+ double frontClip; //!< Front clip plane Z value, code 43
+ double backClip; //!< Back clip plane Z value, code 44
+ double viewHeight; //!< View height in model space units, code 45
+ double snapAngle; //!< Snap angle, code 50
+ double twistAngle; //!< View twist angle, code 51
private:
duint32 frozenLyCount;
@@ -1650,30 +1648,30 @@ class DRW_Viewport : public DRW_Point
#if 0
//used
-DRW_Coord basePoint; /*!< base point, code 10, 20 & 30 */
+DRW_Coord basePoint; //!< Base point, code 10, 20 & 30
-double thickness; /*!< thickness, code 39 */
-DRW_Coord extPoint; /*!< Dir extrusion normal vector, code 210, 220 & 230 */
-enum DRW::ETYPE eType; /*!< enum: entity type, code 0 */
-duint32 handle; /*!< entity identifier, code 5 */
-std::list > appData; /*!< list of application data, code 102 */
-duint32 parentHandle; /*!< Soft-pointer ID/handle to owner BLOCK_RECORD object, code 330 */
-DRW::Space space; /*!< space indicator, code 67*/
-UTF8STRING layer; /*!< layer name, code 8 */
-UTF8STRING lineType; /*!< line type, code 6 */
-duint32 material; /*!< hard pointer id to material object, code 347 */
-int color; /*!< entity color, code 62 */
-enum DRW_LW_Conv::lineWidth lWeight; /*!< entity lineweight, code 370 */
-double ltypeScale; /*!< linetype scale, code 48 */
-bool visible; /*!< entity visibility, code 60 */
-int numProxyGraph; /*!< Number of bytes in proxy graphics, code 92 */
-std::string proxyGraphics; /*!< proxy graphics bytes, code 310 */
-int color24; /*!< 24-bit color, code 420 */
-std::string colorName; /*!< color name, code 430 */
-int transparency; /*!< transparency, code 440 */
-int plotStyle; /*!< hard pointer id to plot style object, code 390 */
-DRW::ShadowMode shadow; /*!< shadow mode, code 284 */
-bool haveExtrusion; /*!< set to true if the entity have extrusion*/
+double thickness; //!< Thickness, code 39
+DRW_Coord extPoint; //!< Dir extrusion normal vector, code 210, 220 & 230
+enum DRW::ETYPE eType; //!< Enum: entity type, code 0
+duint32 handle; //!< Entity identifier, code 5
+std::list > appData; //!< List of application data, code 102
+duint32 parentHandle; //!< Soft-pointer ID/handle to owner BLOCK_RECORD object, code 330
+DRW::Space space; //!< Space indicator, code 67
+UTF8STRING layer; //!< Layer name, code 8
+UTF8STRING lineType; //!< Line type, code 6
+duint32 material; //!< Hard pointer id to material object, code 347
+int color; //!< Entity color, code 62
+enum DRW_LW_Conv::lineWidth lWeight; //!< Entity lineweight, code 370
+double ltypeScale; //!< Linetype scale, code 48
+bool visible; //!< Entity visibility, code 60
+int numProxyGraph; //!< Number of bytes in proxy graphics, code 92
+std::string proxyGraphics; //!< Proxy graphics bytes, code 310
+int color24; //!< 24-bit color, code 420
+std::string colorName; //!< Color name, code 430
+int transparency; //!< Transparency, code 440
+int plotStyle; //!< Hard pointer id to plot style object, code 390
+DRW::ShadowMode shadow; //!< Shadow mode, code 284
+bool haveExtrusion; //!< Set to true if the entity have extrusion
#endif
#endif
diff --git a/src/app/dwg/libdxfrw/drw_interface.h b/src/app/dwg/libdxfrw/drw_interface.h
index e886c78fc50..49940220d15 100644
--- a/src/app/dwg/libdxfrw/drw_interface.h
+++ b/src/app/dwg/libdxfrw/drw_interface.h
@@ -36,20 +36,20 @@ class DRW_Interface
{
}
- /** Called when header is parsed. */
+ //! Called when header is parsed.
virtual void addHeader( const DRW_Header* data ) = 0;
- /** Called for every line Type. */
+ //! Called for every line Type.
virtual void addLType( const DRW_LType& data ) = 0;
- /** Called for every layer. */
+ //! Called for every layer.
virtual void addLayer( const DRW_Layer& data ) = 0;
- /** Called for every dim style. */
+ //! Called for every dim style.
virtual void addDimStyle( const DRW_Dimstyle& data ) = 0;
- /** Called for every VPORT table. */
+ //! Called for every VPORT table.
virtual void addVport( const DRW_Vport& data ) = 0;
- /** Called for every text style. */
+ //! Called for every text style.
virtual void addTextStyle( const DRW_Textstyle& data ) = 0;
- /** Called for every AppId entry. */
+ //! Called for every AppId entry.
virtual void addAppId( const DRW_AppId& data ) = 0;
/**
@@ -69,98 +69,98 @@ class DRW_Interface
*/
virtual void setBlock( const int handle ) = 0;
- /** Called to end the current block */
+ //! Called to end the current block
virtual void endBlock() = 0;
- /** Called for every point */
+ //! Called for every point
virtual void addPoint( const DRW_Point& data ) = 0;
- /** Called for every line */
+ //! Called for every line
virtual void addLine( const DRW_Line& data ) = 0;
- /** Called for every ray */
+ //! Called for every ray
virtual void addRay( const DRW_Ray& data ) = 0;
- /** Called for every xline */
+ //! Called for every xline
virtual void addXline( const DRW_Xline& data ) = 0;
- /** Called for every arc */
+ //! Called for every arc
virtual void addArc( const DRW_Arc& data ) = 0;
- /** Called for every circle */
+ //! Called for every circle
virtual void addCircle( const DRW_Circle& data ) = 0;
- /** Called for every ellipse */
+ //! Called for every ellipse
virtual void addEllipse( const DRW_Ellipse& data ) = 0;
- /** Called for every lwpolyline */
+ //! Called for every lwpolyline
virtual void addLWPolyline( const DRW_LWPolyline& data ) = 0;
- /** Called for every polyline start */
+ //! Called for every polyline start
virtual void addPolyline( const DRW_Polyline& data ) = 0;
- /** Called for every spline */
+ //! Called for every spline
virtual void addSpline( const DRW_Spline* data ) = 0;
- /** Called for every spline knot value */
+ //! Called for every spline knot value
virtual void addKnot( const DRW_Entity& data ) = 0;
- /** Called for every insert. */
+ //! Called for every insert.
virtual void addInsert( const DRW_Insert& data ) = 0;
- /** Called for every trace start */
+ //! Called for every trace start
virtual void addTrace( const DRW_Trace& data ) = 0;
- /** Called for every 3dface start */
+ //! Called for every 3dface start
virtual void add3dFace( const DRW_3Dface& data ) = 0;
- /** Called for every solid start */
+ //! Called for every solid start
virtual void addSolid( const DRW_Solid& data ) = 0;
- /** Called for every Multi Text entity. */
+ //! Called for every Multi Text entity.
virtual void addMText( const DRW_MText& data ) = 0;
- /** Called for every Text entity. */
+ //! Called for every Text entity.
virtual void addText( const DRW_Text& data ) = 0;
- /** Called for every aligned dimension entity. */
+ //! Called for every aligned dimension entity.
virtual void addDimAlign( const DRW_DimAligned *data ) = 0;
- /** Called for every linear or rotated dimension entity. */
+ //! Called for every linear or rotated dimension entity.
virtual void addDimLinear( const DRW_DimLinear *data ) = 0;
- /** Called for every radial dimension entity. */
+ //! Called for every radial dimension entity.
virtual void addDimRadial( const DRW_DimRadial *data ) = 0;
- /** Called for every diametric dimension entity. */
+ //! Called for every diametric dimension entity.
virtual void addDimDiametric( const DRW_DimDiametric *data ) = 0;
- /** Called for every angular dimension (2 lines version) entity. */
+ //! Called for every angular dimension (2 lines version) entity.
virtual void addDimAngular( const DRW_DimAngular *data ) = 0;
- /** Called for every angular dimension (3 points version) entity. */
+ //! Called for every angular dimension (3 points version) entity.
virtual void addDimAngular3P( const DRW_DimAngular3p *data ) = 0;
- /** Called for every ordinate dimension entity. */
+ //! Called for every ordinate dimension entity.
virtual void addDimOrdinate( const DRW_DimOrdinate *data ) = 0;
- /** Called for every leader start. */
+ //! Called for every leader start.
virtual void addLeader( const DRW_Leader *data ) = 0;
- /** Called for every hatch entity. */
+ //! Called for every hatch entity.
virtual void addHatch( const DRW_Hatch *data ) = 0;
- /** Called for every viewport entity. */
+ //! Called for every viewport entity.
virtual void addViewport( const DRW_Viewport& data ) = 0;
- /** Called for every image entity. */
+ //! Called for every image entity.
virtual void addImage( const DRW_Image *data ) = 0;
- /** Called for every image definition. */
+ //! Called for every image definition.
virtual void linkImage( const DRW_ImageDef *data ) = 0;
- /** Called for every comment in the DXF file (code 999). */
+ //! Called for every comment in the DXF file (code 999).
virtual void addComment( const char* comment ) = 0;
virtual void writeHeader( DRW_Header& data ) = 0;
diff --git a/src/app/dwg/libdxfrw/drw_objects.h b/src/app/dwg/libdxfrw/drw_objects.h
index 141daac1170..d9160b40443 100644
--- a/src/app/dwg/libdxfrw/drw_objects.h
+++ b/src/app/dwg/libdxfrw/drw_objects.h
@@ -106,12 +106,12 @@ class DRW_TableEntry
}
public:
- enum DRW::TTYPE tType; /*!< enum: entity type, code 0 */
- duint32 handle; /*!< entity identifier, code 5 */
- int parentHandle; /*!< Soft-pointer ID/handle to owner object, code 330 */
- UTF8STRING name; /*!< entry name, code 2 */
- int flags; /*!< Flags relevant to entry, code 70 */
- std::vector extData; /*!< FIFO list of extended data, codes 1000 to 1071*/
+ enum DRW::TTYPE tType; //!< Enum: entity type, code 0
+ duint32 handle; //!< Entity identifier, code 5
+ int parentHandle; //!< Soft-pointer ID/handle to owner object, code 330
+ UTF8STRING name; //!< Entry name, code 2
+ int flags; //!< Flags relevant to entry, code 70
+ std::vector extData; //!< FIFO list of extended data, codes 1000 to 1071
private:
DRW_Variant *curr;
@@ -166,75 +166,75 @@ class DRW_Dimstyle : public DRW_TableEntry
public:
//V12
- UTF8STRING dimpost; /*!< code 3 */
- UTF8STRING dimapost; /*!< code 4 */
+ UTF8STRING dimpost; //!< Code 3
+ UTF8STRING dimapost; //!< Code 4
/* handle are code 105 */
- UTF8STRING dimblk; /*!< code 5, code 342 V2000+ */
- UTF8STRING dimblk1; /*!< code 6, code 343 V2000+ */
- UTF8STRING dimblk2; /*!< code 7, code 344 V2000+ */
- double dimscale; /*!< code 40 */
- double dimasz; /*!< code 41 */
- double dimexo; /*!< code 42 */
- double dimdli; /*!< code 43 */
- double dimexe; /*!< code 44 */
- double dimrnd; /*!< code 45 */
- double dimdle; /*!< code 46 */
- double dimtp; /*!< code 47 */
- double dimtm; /*!< code 48 */
- double dimfxl; /*!< code 49 V2007+ */
- double dimtxt; /*!< code 140 */
- double dimcen; /*!< code 141 */
- double dimtsz; /*!< code 142 */
- double dimaltf; /*!< code 143 */
- double dimlfac; /*!< code 144 */
- double dimtvp; /*!< code 145 */
- double dimtfac; /*!< code 146 */
- double dimgap; /*!< code 147 */
- double dimaltrnd; /*!< code 148 V2000+ */
- int dimtol; /*!< code 71 */
- int dimlim; /*!< code 72 */
- int dimtih; /*!< code 73 */
- int dimtoh; /*!< code 74 */
- int dimse1; /*!< code 75 */
- int dimse2; /*!< code 76 */
- int dimtad; /*!< code 77 */
- int dimzin; /*!< code 78 */
- int dimazin; /*!< code 79 V2000+ */
- int dimalt; /*!< code 170 */
- int dimaltd; /*!< code 171 */
- int dimtofl; /*!< code 172 */
- int dimsah; /*!< code 173 */
- int dimtix; /*!< code 174 */
- int dimsoxd; /*!< code 175 */
- int dimclrd; /*!< code 176 */
- int dimclre; /*!< code 177 */
- int dimclrt; /*!< code 178 */
- int dimadec; /*!< code 179 V2000+ */
- int dimunit; /*!< code 270 R13+ (obsolete 2000+, use dimlunit & dimfrac) */
- int dimdec; /*!< code 271 R13+ */
- int dimtdec; /*!< code 272 R13+ */
- int dimaltu; /*!< code 273 R13+ */
- int dimalttd; /*!< code 274 R13+ */
- int dimaunit; /*!< code 275 R13+ */
- int dimfrac; /*!< code 276 V2000+ */
- int dimlunit; /*!< code 277 V2000+ */
- int dimdsep; /*!< code 278 V2000+ */
- int dimtmove; /*!< code 279 V2000+ */
- int dimjust; /*!< code 280 R13+ */
- int dimsd1; /*!< code 281 R13+ */
- int dimsd2; /*!< code 282 R13+ */
- int dimtolj; /*!< code 283 R13+ */
- int dimtzin; /*!< code 284 R13+ */
- int dimaltz; /*!< code 285 R13+ */
- int dimaltttz; /*!< code 286 R13+ */
- int dimfit; /*!< code 287 R13+ (obsolete 2000+, use dimatfit & dimtmove)*/
- int dimupt; /*!< code 288 R13+ */
- int dimatfit; /*!< code 289 V2000+ */
- int dimfxlon; /*!< code 290 V2007+ */
- UTF8STRING dimtxsty; /*!< code 340 R13+ */
- UTF8STRING dimldrblk; /*!< code 341 V2000+ */
- int dimlwd; /*!< code 371 V2000+ */
- int dimlwe; /*!< code 372 V2000+ */
+ UTF8STRING dimblk; //!< Code 5, code 342 V2000+
+ UTF8STRING dimblk1; //!< Code 6, code 343 V2000+
+ UTF8STRING dimblk2; //!< Code 7, code 344 V2000+
+ double dimscale; //!< Code 40
+ double dimasz; //!< Code 41
+ double dimexo; //!< Code 42
+ double dimdli; //!< Code 43
+ double dimexe; //!< Code 44
+ double dimrnd; //!< Code 45
+ double dimdle; //!< Code 46
+ double dimtp; //!< Code 47
+ double dimtm; //!< Code 48
+ double dimfxl; //!< Code 49 V2007+
+ double dimtxt; //!< Code 140
+ double dimcen; //!< Code 141
+ double dimtsz; //!< Code 142
+ double dimaltf; //!< Code 143
+ double dimlfac; //!< Code 144
+ double dimtvp; //!< Code 145
+ double dimtfac; //!< Code 146
+ double dimgap; //!< Code 147
+ double dimaltrnd; //!< Code 148 V2000+
+ int dimtol; //!< Code 71
+ int dimlim; //!< Code 72
+ int dimtih; //!< Code 73
+ int dimtoh; //!< Code 74
+ int dimse1; //!< Code 75
+ int dimse2; //!< Code 76
+ int dimtad; //!< Code 77
+ int dimzin; //!< Code 78
+ int dimazin; //!< Code 79 V2000+
+ int dimalt; //!< Code 170
+ int dimaltd; //!< Code 171
+ int dimtofl; //!< Code 172
+ int dimsah; //!< Code 173
+ int dimtix; //!< Code 174
+ int dimsoxd; //!< Code 175
+ int dimclrd; //!< Code 176
+ int dimclre; //!< Code 177
+ int dimclrt; //!< Code 178
+ int dimadec; //!< Code 179 V2000+
+ int dimunit; //!< Code 270 R13+ (obsolete 2000+, use dimlunit & dimfrac)
+ int dimdec; //!< Code 271 R13+
+ int dimtdec; //!< Code 272 R13+
+ int dimaltu; //!< Code 273 R13+
+ int dimalttd; //!< Code 274 R13+
+ int dimaunit; //!< Code 275 R13+
+ int dimfrac; //!< Code 276 V2000+
+ int dimlunit; //!< Code 277 V2000+
+ int dimdsep; //!< Code 278 V2000+
+ int dimtmove; //!< Code 279 V2000+
+ int dimjust; //!< Code 280 R13+
+ int dimsd1; //!< Code 281 R13+
+ int dimsd2; //!< Code 282 R13+
+ int dimtolj; //!< Code 283 R13+
+ int dimtzin; //!< Code 284 R13+
+ int dimaltz; //!< Code 285 R13+
+ int dimaltttz; //!< Code 286 R13+
+ int dimfit; //!< Code 287 R13+ (obsolete 2000+, use dimatfit & dimtmove)
+ int dimupt; //!< Code 288 R13+
+ int dimatfit; //!< Code 289 V2000+
+ int dimfxlon; //!< Code 290 V2007+
+ UTF8STRING dimtxsty; //!< Code 340 R13+
+ UTF8STRING dimldrblk; //!< Code 341 V2000+
+ int dimlwd; //!< Code 371 V2000+
+ int dimlwe; //!< Code 372 V2000+
};
@@ -264,12 +264,12 @@ class DRW_LType : public DRW_TableEntry
void update();
public:
- UTF8STRING desc; /*!< descriptive string, code 3 */
-// int align; /*!< align code, always 65 ('A') code 72 */
- std::vector::size_type size; /*!< element number, code 73 */
- double length; /*!< total length of pattern, code 40 */
-// int haveShape; /*!< complex linetype type, code 74 */
- std::vector path; /*!< trace, point or space length sequence, code 49 */
+ UTF8STRING desc; //!< Descriptive string, code 3
+// int align; //!< Align code, always 65 ('A') code 72
+ std::vector::size_type size; //!< Element number, code 73
+ double length; //!< Total length of pattern, code 40
+// int haveShape; //!< Complex linetype type, code 74
+ std::vector path; //!< Trace, point or space length sequence, code 49
private:
int pathIdx;
};
@@ -300,14 +300,14 @@ class DRW_Layer : public DRW_TableEntry
bool parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs = 0 );
public:
- UTF8STRING lineType; /*!< line type, code 6 */
- int color; /*!< layer color, code 62 */
- int color24; /*!< 24-bit color, code 420 */
- int transparency; /*!< Transparency, code 440 */
- bool plotF; /*!< Plot flag, code 290 */
- enum DRW_LW_Conv::lineWidth lWeight; /*!< layer lineweight, code 370 */
- std::string handlePlotS; /*!< Hard-pointer ID/handle of plotstyle, code 390 */
- std::string handleMaterialS; /*!< Hard-pointer ID/handle of materialstyle, code 347 */
+ UTF8STRING lineType; //!< Line type, code 6
+ int color; //!< Layer color, code 62
+ int color24; //!< 24-bit color, code 420
+ int transparency; //!< Transparency, code 440
+ bool plotF; //!< Plot flag, code 290
+ enum DRW_LW_Conv::lineWidth lWeight; //!< Layer lineweight, code 370
+ std::string handlePlotS; //!< Hard-pointer ID/handle of plotstyle, code 390
+ std::string handleMaterialS; //!< Hard-pointer ID/handle of materialstyle, code 347
/*only used for read dwg*/
dwgHandle lTypeH;
};
@@ -334,8 +334,8 @@ class DRW_Block_Record : public DRW_TableEntry
public:
//Note: int DRW_TableEntry::flags; contains code 70 of block
- int insUnits; /*!< block insertion units, code 70 of block_record*/
- DRW_Coord basePoint; /*!< block insertion base point dwg only */
+ int insUnits; //!< Block insertion units, code 70 of block_record
+ DRW_Coord basePoint; //!< Block insertion base point dwg only
protected:
//dwg parser
private:
@@ -371,14 +371,14 @@ class DRW_Textstyle : public DRW_TableEntry
bool parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs = 0 );
public:
- double height; /*!< Fixed text height (0 not set), code 40 */
- double width; /*!< Width factor, code 41 */
- double oblique; /*!< Oblique angle, code 50 */
- int genFlag; /*!< Text generation flags, code 71 */
- double lastHeight; /*!< Last height used, code 42 */
- UTF8STRING font; /*!< primary font file name, code 3 */
- UTF8STRING bigFont; /*!< bigfont file name or blank if none, code 4 */
- int fontFamily; /*!< ttf font family, italic and bold flags, code 1071 */
+ double height; //!< Fixed text height (0 not set), code 40
+ double width; //!< Width factor, code 41
+ double oblique; //!< Oblique angle, code 50
+ int genFlag; //!< Text generation flags, code 71
+ double lastHeight; //!< Last height used, code 42
+ UTF8STRING font; //!< Primary font file name, code 3
+ UTF8STRING bigFont; //!< Bigfont file name or blank if none, code 4
+ int fontFamily; //!< Ttf font family, italic and bold flags, code 1071
};
/** Class to handle vport symbol table entries
@@ -416,30 +416,31 @@ class DRW_Vport : public DRW_TableEntry
bool parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs = 0 );
public:
- DRW_Coord lowerLeft; /*!< Lower left corner, code 10 & 20 */
- DRW_Coord UpperRight; /*!< Upper right corner, code 11 & 21 */
- DRW_Coord center; /*!< center point in WCS, code 12 & 22 */
- DRW_Coord snapBase; /*!< snap base point in DCS, code 13 & 23 */
- DRW_Coord snapSpacing; /*!< snap Spacing, code 14 & 24 */
- DRW_Coord gridSpacing; /*!< grid Spacing, code 15 & 25 */
- DRW_Coord viewDir; /*!< view direction from target point, code 16, 26 & 36 */
- DRW_Coord viewTarget; /*!< view target point, code 17, 27 & 37 */
- double height; /*!< view height, code 40 */
- double ratio; /*!< viewport aspect ratio, code 41 */
- double lensHeight; /*!< lens height, code 42 */
- double frontClip; /*!< front clipping plane, code 43 */
- double backClip; /*!< back clipping plane, code 44 */
- double snapAngle; /*!< snap rotation angle, code 50 */
- double twistAngle; /*!< view twist angle, code 51 */
- int viewMode; /*!< view mode, code 71 */
- int circleZoom; /*!< circle zoom percent, code 72 */
- int fastZoom; /*!< fast zoom setting, code 73 */
- int ucsIcon; /*!< UCSICON setting, code 74 */
- int snap; /*!< snap on/off, code 75 */
- int grid; /*!< grid on/off, code 76 */
- int snapStyle; /*!< snap style, code 77 */
- int snapIsopair; /*!< snap isopair, code 78 */
- int gridBehavior; /*!< grid behavior, code 60, undocumented */
+ DRW_Coord lowerLeft; //!< Lower left corner, code 10 & 20
+ DRW_Coord UpperRight; //!< Upper right corner, code 11 & 21
+ DRW_Coord center; //!< Center point in WCS, code 12 & 22
+ DRW_Coord snapBase; //!< Snap base point in DCS, code 13 & 23
+ DRW_Coord snapSpacing; //!< Snap Spacing, code 14 & 24
+ DRW_Coord gridSpacing; //!< Grid Spacing, code 15 & 25
+ DRW_Coord viewDir; //!< View direction from target point, code 16, 26 & 36
+ DRW_Coord viewTarget; //!< View target point, code 17, 27 & 37
+ double height; //!< View height, code 40
+ double ratio; //!< Viewport aspect ratio, code 41
+ double lensHeight; //!< Lens height, code 42
+ double frontClip; //!< Front clipping plane, code 43
+ double backClip; //!< Back clipping plane, code 44
+ double snapAngle; //!< Snap rotation angle, code 50
+ double twistAngle; //!< View twist angle, code 51
+ int viewMode; //!< View mode, code 71
+ int circleZoom; //!< Circle zoom percent, code 72
+ int fastZoom; //!< Fast zoom setting, code 73
+ int ucsIcon; //!< UCSICON setting, code 74
+ int snap; //!< Snap on/off, code 75
+ int grid; //!< Grid on/off, code 76
+ int snapStyle; //!< Snap style, code 77
+ int snapIsopair; //!< Snap isopair, code 78
+ int gridBehavior; //!< Grid behavior, code 60, undocumented
+
/** Code 60, bit coded possible value are
* bit 1 (1) show out of limits
* bit 2 (2) adaptive grid
@@ -473,15 +474,15 @@ class DRW_ImageDef : public DRW_TableEntry //
bool parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs = 0 );
public:
-// std::string handle; /*!< entity identifier, code 5 */
- UTF8STRING name; /*!< File name of image, code 1 */
- int imgVersion; /*!< class version, code 90, 0=R14 version */
- double u; /*!< image size in pixels U value, code 10 */
- double v; /*!< image size in pixels V value, code 20 */
- double up; /*!< default size of one pixel U value, code 11 */
- double vp; /*!< default size of one pixel V value, code 12 really is 21*/
- int loaded; /*!< image is loaded flag, code 280, 0=unloaded, 1=loaded */
- int resolution; /*!< resolution units, code 281, 0=no, 2=centimeters, 5=inch */
+// std::string handle; //!< Entity identifier, code 5
+ UTF8STRING name; //!< File name of image, code 1
+ int imgVersion; //!< Class version, code 90, 0=R14 version
+ double u; //!< Image size in pixels U value, code 10
+ double v; //!< Image size in pixels V value, code 20
+ double up; //!< Default size of one pixel U value, code 11
+ double vp; //!< Default size of one pixel V value, code 12 really is 21
+ int loaded; //!< Image is loaded flag, code 280, 0=unloaded, 1=loaded
+ int resolution; //!< Resolution units, code 281, 0=no, 2=centimeters, 5=inch
std::map reactors;
};
diff --git a/src/app/dwg/libdxfrw/intern/drw_dbg.cpp b/src/app/dwg/libdxfrw/intern/drw_dbg.cpp
index b2b0e16b7d4..8c6067086e6 100644
--- a/src/app/dwg/libdxfrw/intern/drw_dbg.cpp
+++ b/src/app/dwg/libdxfrw/intern/drw_dbg.cpp
@@ -33,7 +33,7 @@ class print_none
virtual void printHL( int c, int s, int h ) {( void )c;( void )s;( void )h;}
virtual void printPT( double x, double y, double z ) {( void )x;( void )y;( void )z;}
print_none() {}
- virtual ~print_none() {}
+ virtual ~print_none() = default;
};
class print_debug : public print_none
diff --git a/src/app/dwg/libdxfrw/intern/drw_textcodec.h b/src/app/dwg/libdxfrw/intern/drw_textcodec.h
index d37fdb106ea..d5fe5f66986 100644
--- a/src/app/dwg/libdxfrw/intern/drw_textcodec.h
+++ b/src/app/dwg/libdxfrw/intern/drw_textcodec.h
@@ -36,7 +36,7 @@ class DRW_Converter
table = t;
cpLenght = l;
}
- virtual ~DRW_Converter() {}
+ virtual ~DRW_Converter() = default;
virtual std::string fromUtf8( std::string *s ) {return *s;}
virtual std::string toUtf8( std::string *s );
std::string encodeText( std::string stmp );
diff --git a/src/app/dwg/libdxfrw/intern/dwgbuffer.h b/src/app/dwg/libdxfrw/intern/dwgbuffer.h
index 96f7ccce734..69f8ef7ed46 100644
--- a/src/app/dwg/libdxfrw/intern/dwgbuffer.h
+++ b/src/app/dwg/libdxfrw/intern/dwgbuffer.h
@@ -25,7 +25,7 @@ class dwgBasicStream
protected:
dwgBasicStream() {}
public:
- virtual ~dwgBasicStream() {}
+ virtual ~dwgBasicStream() = default;
virtual bool read( duint8* s, duint64 n ) = 0;
virtual duint64 size() = 0;
virtual duint64 getPos() = 0;
@@ -44,7 +44,6 @@ class dwgFileStream: public dwgBasicStream
sz = stream->tellg();
stream->seekg( 0, std::ios_base::beg );
}
- virtual ~dwgFileStream() {}
virtual bool read( duint8* s, duint64 n );
virtual duint64 size() {return sz;}
virtual duint64 getPos() {return stream->tellg();}
@@ -66,7 +65,6 @@ class dwgCharStream: public dwgBasicStream
pos = 0;
isOk = true;
}
- virtual ~dwgCharStream() {}
virtual bool read( duint8* s, duint64 n );
virtual duint64 size() {return sz;}
virtual duint64 getPos() {return pos;}
diff --git a/src/app/dwg/libdxfrw/intern/dwgreader.h b/src/app/dwg/libdxfrw/intern/dwgreader.h
index 68947bd306a..64868883c37 100644
--- a/src/app/dwg/libdxfrw/intern/dwgreader.h
+++ b/src/app/dwg/libdxfrw/intern/dwgreader.h
@@ -69,7 +69,7 @@ class dwgPageInfo
, uSize( 0 )
{
}
- ~dwgPageInfo() {}
+
duint64 Id;
duint64 address; //in file stream, for rd18, rd21
duint64 size; //in file stream, for rd18, rd21
@@ -101,7 +101,7 @@ class dwgSectionInfo
, address( 0 )
{
}
- ~dwgSectionInfo() {}
+
dint32 Id; //section Id, 2000- rd15 rd18
std::string name; //section name rd18
duint32 compressed;//is compressed? 1=no, 2=yes rd18, rd21(encoding)
diff --git a/src/app/dwg/libdxfrw/intern/dwgreader15.h b/src/app/dwg/libdxfrw/intern/dwgreader15.h
index 38f7d469b5e..a6ea43c884b 100644
--- a/src/app/dwg/libdxfrw/intern/dwgreader15.h
+++ b/src/app/dwg/libdxfrw/intern/dwgreader15.h
@@ -23,7 +23,6 @@ class dwgReader15 : public dwgReader
{
public:
dwgReader15( std::ifstream *stream, dwgR *p ): dwgReader( stream, p ) { }
- virtual ~dwgReader15() {}
bool readMetaData();
bool readFileHeader();
bool readDwgHeader( DRW_Header& hdr );
diff --git a/src/app/dwg/libdxfrw/intern/dwgreader18.cpp b/src/app/dwg/libdxfrw/intern/dwgreader18.cpp
index 7d69aa4d68a..bef9c978588 100644
--- a/src/app/dwg/libdxfrw/intern/dwgreader18.cpp
+++ b/src/app/dwg/libdxfrw/intern/dwgreader18.cpp
@@ -762,6 +762,7 @@ bool dwgReader18::readDwgClasses()
/*********** objects map ************************/
+
/** Note: object map are split in sections with max size 2035?
* heach section are 2 bytes size + data bytes + 2 bytes crc
* size value are data bytes + 2 and to calculate crc are used
@@ -796,6 +797,7 @@ bool dwgReader18::readDwgHandles()
/*********** objects ************************/
+
/**
* Reads all the object referenced in the object map section of the DWG file
* (using their object file offsets)
diff --git a/src/app/dwg/libdxfrw/intern/dwgreader21.cpp b/src/app/dwg/libdxfrw/intern/dwgreader21.cpp
index 0fc42c92770..30adc9ffb26 100644
--- a/src/app/dwg/libdxfrw/intern/dwgreader21.cpp
+++ b/src/app/dwg/libdxfrw/intern/dwgreader21.cpp
@@ -621,6 +621,7 @@ bool dwgReader21::readDwgHandles()
}
/*********** objects ************************/
+
/**
* Reads all the object referenced in the object map section of the DWG file
* (using their object file offsets)
diff --git a/src/app/dwg/libdxfrw/intern/dwgreader24.h b/src/app/dwg/libdxfrw/intern/dwgreader24.h
index 58b7ffaa591..6d0ffffe18c 100644
--- a/src/app/dwg/libdxfrw/intern/dwgreader24.h
+++ b/src/app/dwg/libdxfrw/intern/dwgreader24.h
@@ -23,7 +23,6 @@ class dwgReader24 : public dwgReader18
{
public:
dwgReader24( std::ifstream *stream, dwgR *p ): dwgReader18( stream, p ) { }
- virtual ~dwgReader24() {}
bool readFileHeader();
bool readDwgHeader( DRW_Header& hdr );
bool readDwgClasses();
diff --git a/src/app/dwg/libdxfrw/intern/dwgreader27.h b/src/app/dwg/libdxfrw/intern/dwgreader27.h
index 7bb960bdbfd..4637fe9790e 100644
--- a/src/app/dwg/libdxfrw/intern/dwgreader27.h
+++ b/src/app/dwg/libdxfrw/intern/dwgreader27.h
@@ -23,7 +23,6 @@ class dwgReader27 : public dwgReader18
{
public:
dwgReader27( std::ifstream *stream, dwgR *p ): dwgReader18( stream, p ) { }
- virtual ~dwgReader27() {}
bool readFileHeader();
bool readDwgHeader( DRW_Header& hdr );
bool readDwgClasses();
diff --git a/src/app/dwg/libdxfrw/intern/dwgutil.h b/src/app/dwg/libdxfrw/intern/dwgutil.h
index 53b936240fb..07d19117343 100644
--- a/src/app/dwg/libdxfrw/intern/dwgutil.h
+++ b/src/app/dwg/libdxfrw/intern/dwgutil.h
@@ -24,7 +24,7 @@ class dwgRSCodec
{
public:
dwgRSCodec() {}
- ~dwgRSCodec() {}
+
static void decode239I( duint8 *in, duint8 *out, duint32 blk );
static void decode251I( duint8 *in, duint8 *out, duint32 blk );
};
@@ -41,8 +41,6 @@ class dwgCompressor
, rpos( 0 )
{}
- ~dwgCompressor() {}
-
void decompress18( duint8 *cbuf, duint8 *dbuf, duint32 csize, duint32 dsize );
static void decrypt18Hdr( duint8 *buf, duint32 size, duint32 offset );
// static void decrypt18Data(duint8 *buf, duint32 size, duint32 offset);
@@ -72,31 +70,30 @@ class secEnum
public:
enum DWGSection
{
- UNKNOWNS, /*!< UNKNOWN section. */
- FILEHEADER, /*!< File Header (in R3-R15*/
- HEADER, /*!< AcDb:Header */
- CLASSES, /*!< AcDb:Classes */
- SUMARYINFO, /*!< AcDb:SummaryInfo */
- PREVIEW, /*!< AcDb:Preview */
- VBAPROY, /*!< AcDb:VBAProject */
- APPINFO, /*!< AcDb:AppInfo */
- FILEDEP, /*!< AcDb:FileDepList */
- REVHISTORY, /*!< AcDb:RevHistory */
- SECURITY, /*!< AcDb:Security */
- OBJECTS, /*!< AcDb:AcDbObjects */
- OBJFREESPACE, /*!< AcDb:ObjFreeSpace */
- TEMPLATE, /*!< AcDb:Template */
- HANDLES, /*!< AcDb:Handles */
- PROTOTYPE, /*!< AcDb:AcDsPrototype_1b */
- AUXHEADER, /*!< AcDb:AuxHeader, in (R13-R15) second file header */
- SIGNATURE, /*!< AcDb:Signature */
- APPINFOHISTORY, /*!< AcDb:AppInfoHistory (in ac1021 may be a renamed section?*/
- EXTEDATA, /*!< Extended Entity Data */
- PROXYGRAPHICS /*!< PROXY ENTITY GRAPHICS */
+ UNKNOWNS, //!< UNKNOWN section.
+ FILEHEADER, //!< File Header (in R3-R15
+ HEADER, //!< AcDb:Header
+ CLASSES, //!< AcDb:Classes
+ SUMARYINFO, //!< AcDb:SummaryInfo
+ PREVIEW, //!< AcDb:Preview
+ VBAPROY, //!< AcDb:VBAProject
+ APPINFO, //!< AcDb:AppInfo
+ FILEDEP, //!< AcDb:FileDepList
+ REVHISTORY, //!< AcDb:RevHistory
+ SECURITY, //!< AcDb:Security
+ OBJECTS, //!< AcDb:AcDbObjects
+ OBJFREESPACE, //!< AcDb:ObjFreeSpace
+ TEMPLATE, //!< AcDb:Template
+ HANDLES, //!< AcDb:Handles
+ PROTOTYPE, //!< AcDb:AcDsPrototype_1b
+ AUXHEADER, //!< AcDb:AuxHeader, in (R13-R15) second file header
+ SIGNATURE, //!< AcDb:Signature
+ APPINFOHISTORY, //!< AcDb:AppInfoHistory (in ac1021 may be a renamed section?
+ EXTEDATA, //!< Extended Entity Data
+ PROXYGRAPHICS //!< PROXY ENTITY GRAPHICS
};
secEnum() {}
- ~secEnum() {}
static DWGSection getEnum( std::string nameSec );
};
diff --git a/src/app/dwg/libdxfrw/intern/dxfreader.h b/src/app/dwg/libdxfrw/intern/dxfreader.h
index 0db0753228c..7bd8d1c4301 100644
--- a/src/app/dwg/libdxfrw/intern/dxfreader.h
+++ b/src/app/dwg/libdxfrw/intern/dxfreader.h
@@ -38,7 +38,7 @@ class dxfReader
filestr = stream;
type = INVALID;
}
- virtual ~dxfReader() {}
+ virtual ~dxfReader() = default;
bool readRec( int *code );
std::string getString() {return strData;}
@@ -81,7 +81,6 @@ class dxfReaderBinary : public dxfReader
explicit dxfReaderBinary( std::ifstream *stream )
: dxfReader( stream, false )
{}
- virtual ~dxfReaderBinary() {}
virtual bool readCode( int *code );
virtual bool readString( std::string *text );
virtual bool readString();
@@ -98,7 +97,6 @@ class dxfReaderAscii : public dxfReader
explicit dxfReaderAscii( std::ifstream *stream )
: dxfReader( stream, true )
{}
- virtual ~dxfReaderAscii() {}
virtual bool readCode( int *code );
virtual bool readString( std::string *text );
virtual bool readString();
diff --git a/src/app/dwg/libdxfrw/intern/dxfwriter.h b/src/app/dwg/libdxfrw/intern/dxfwriter.h
index 56761138e9b..fbf644509fb 100644
--- a/src/app/dwg/libdxfrw/intern/dxfwriter.h
+++ b/src/app/dwg/libdxfrw/intern/dxfwriter.h
@@ -22,7 +22,7 @@ class dxfWriter
: filestr( stream )
// , count( 0 )
{}
- virtual ~dxfWriter() {}
+ virtual ~dxfWriter() = default;
virtual bool writeString( int code, std::string text ) = 0;
bool writeUtf8String( int code, std::string text );
bool writeUtf8Caps( int code, std::string text );
@@ -47,7 +47,6 @@ class dxfWriterBinary : public dxfWriter
explicit dxfWriterBinary( std::ofstream *stream )
: dxfWriter( stream )
{}
- virtual ~dxfWriterBinary() {}
virtual bool writeString( int code, std::string text );
virtual bool writeInt16( int code, int data );
virtual bool writeInt32( int code, int data );
@@ -60,7 +59,6 @@ class dxfWriterAscii : public dxfWriter
{
public:
explicit dxfWriterAscii( std::ofstream *stream );
- virtual ~dxfWriterAscii() {}
virtual bool writeString( int code, std::string text );
virtual bool writeInt16( int code, int data );
virtual bool writeInt32( int code, int data );
diff --git a/src/app/dwg/libdxfrw/intern/rscodec.cpp b/src/app/dwg/libdxfrw/intern/rscodec.cpp
index 44173f4ff53..48708be775a 100644
--- a/src/app/dwg/libdxfrw/intern/rscodec.cpp
+++ b/src/app/dwg/libdxfrw/intern/rscodec.cpp
@@ -424,7 +424,7 @@ bool RScodec::encode( unsigned char *data, unsigned char *parity )
symbols will be okay and that if we are in luck, the errors are in the
parity part of the transmitted codeword). Of course, these insoluble cases
can be returned as error flags to the calling routine if desired. */
-/** Return value: number of corrected errors or -1 if can't correct it */
+//! Return value: number of corrected errors or -1 if can't correct it
int RScodec::decode( unsigned char *data )
{
if ( !isOk ) return -1;
diff --git a/src/app/dwg/libdxfrw/intern/rscodec.h b/src/app/dwg/libdxfrw/intern/rscodec.h
index d0a13e442fb..aedb7db65da 100644
--- a/src/app/dwg/libdxfrw/intern/rscodec.h
+++ b/src/app/dwg/libdxfrw/intern/rscodec.h
@@ -28,6 +28,7 @@
#ifndef RSCODEC_H
#define RSCODEC_H
+
/**
mm: RS code over GF(2^4)
nn: nn= (2^mm) - 1 length of codeword
diff --git a/src/app/dwg/libdxfrw/libdxfrw.h b/src/app/dwg/libdxfrw/libdxfrw.h
index f9a5f9fec89..3896eb687d0 100644
--- a/src/app/dwg/libdxfrw/libdxfrw.h
+++ b/src/app/dwg/libdxfrw/libdxfrw.h
@@ -70,7 +70,7 @@ class dxfRW
DRW_ImageDef *writeImage( DRW_Image *ent, std::string name );
bool writeLeader( DRW_Leader *ent );
bool writeDimension( DRW_Dimension *ent );
- void setEllipseParts( int parts ) {elParts = parts;} /*!< set parts number when convert ellipse to polyline */
+ void setEllipseParts( int parts ) {elParts = parts;} //!< Set parts number when convert ellipse to polyline
private:
/// used by read() to parse the content of the file
@@ -138,9 +138,9 @@ class dxfRW
bool dimstyleStd;
bool applyExt;
bool writingBlock;
- int elParts; /*!< parts number when convert ellipse to polyline */
+ int elParts; //!< Parts number when convert ellipse to polyline
std::map blockMap;
- std::vector imageDef; /*!< imageDef list */
+ std::vector imageDef; //!< ImageDef list
int currHandle;
};
diff --git a/src/app/dwg/qgsdwgimportdialog.cpp b/src/app/dwg/qgsdwgimportdialog.cpp
index 18c73bb64db..ba03d5415ee 100644
--- a/src/app/dwg/qgsdwgimportdialog.cpp
+++ b/src/app/dwg/qgsdwgimportdialog.cpp
@@ -69,11 +69,6 @@ QgsDwgImportDialog::QgsDwgImportDialog( QWidget *parent, Qt::WindowFlags f )
cbMergeLayers->setChecked( s.value( "/DwgImport/lastMergeLayers", false ).toBool() );
cbUseCurves->setChecked( s.value( "/DwgImport/lastUseCurves", true ).toBool() );
-#if !defined(GDAL_COMPUTE_VERSION) || GDAL_VERSION_NUM < GDAL_COMPUTE_VERSION(2,0,0)
- cbUseCurves->setChecked( false );
- cbUseCurves->setHidden( true );
-#endif
-
leDrawing->setReadOnly( true );
pbImportDrawing->setHidden( true );
lblMessage->setHidden( true );
@@ -422,7 +417,7 @@ void QgsDwgImportDialog::createGroup( QgsLayerTreeGroup *group, QString name, QS
if ( !layerGroup->children().isEmpty() )
{
layerGroup->setExpanded( false );
- layerGroup->setVisible( visible ? Qt::Checked : Qt::Unchecked );
+ layerGroup->setItemVisibilityChecked( visible );
}
else
{
diff --git a/src/app/dwg/qgsdwgimporter.cpp b/src/app/dwg/qgsdwgimporter.cpp
index 7b1f9660efb..2e6d3dc1a2f 100644
--- a/src/app/dwg/qgsdwgimporter.cpp
+++ b/src/app/dwg/qgsdwgimporter.cpp
@@ -140,7 +140,6 @@ void QgsDwgImporter::startTransaction()
{
Q_ASSERT( mDs );
-#if defined(GDAL_COMPUTE_VERSION) && GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(2,0,0)
mInTransaction = GDALDatasetStartTransaction( mDs, 0 ) == OGRERR_NONE;
if ( !mInTransaction )
{
@@ -148,14 +147,12 @@ void QgsDwgImporter::startTransaction()
.arg( mDatabase )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ) );
}
-#endif
}
void QgsDwgImporter::commitTransaction()
{
Q_ASSERT( mDs != nullptr );
-#if defined(GDAL_COMPUTE_VERSION) && GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(2,0,0)
if ( mInTransaction && GDALDatasetCommitTransaction( mDs ) != OGRERR_NONE )
{
LOG( QObject::tr( "Could not commit transaction\nDatabase:%1\nError:%2" )
@@ -163,7 +160,6 @@ void QgsDwgImporter::commitTransaction()
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ) );
}
mInTransaction = false;
-#endif
}
QgsDwgImporter::~QgsDwgImporter()
@@ -186,13 +182,8 @@ bool QgsDwgImporter::import( const QString &drawing, QString &error, bool doExpa
OGRwkbGeometryType lineGeomType, hatchGeomType;
if ( useCurves )
{
-#if !defined(GDAL_COMPUTE_VERSION) || GDAL_VERSION_NUM < GDAL_COMPUTE_VERSION(2,0,0)
- error = QObject::tr( "Curves only supported with GDAL2" );
- return false;
-#else
lineGeomType = wkbCompoundCurveZ;
hatchGeomType = wkbCurvePolygonZ;
-#endif
}
else
{
@@ -2270,8 +2261,10 @@ void QgsDwgImporter::addText( const DRW_Text &data )
setPoint( dfn, f, "ext", data.extPoint );
- QgsPointV2 p( QgsWkbTypes::PointZ, data.secPoint.x, data.secPoint.y, data.secPoint.z );
-
+ QgsPointV2 p( QgsWkbTypes::PointZ,
+ ( data.alignH > 0 || data.alignV > 0 ) ? data.secPoint.x : data.basePoint.x,
+ ( data.alignH > 0 || data.alignV > 0 ) ? data.secPoint.y : data.basePoint.y,
+ ( data.alignH > 0 || data.alignV > 0 ) ? data.secPoint.z : data.basePoint.z );
if ( !createFeature( layer, f, p ) )
{
diff --git a/src/app/gps/qgsgpsinformationwidget.cpp b/src/app/gps/qgsgpsinformationwidget.cpp
index 9b168b6188f..4525fd64bbe 100644
--- a/src/app/gps/qgsgpsinformationwidget.cpp
+++ b/src/app/gps/qgsgpsinformationwidget.cpp
@@ -441,7 +441,7 @@ void QgsGPSInformationWidget::connected( QgsGPSConnection *conn )
mGPSPlainTextEdit->appendPlainText( tr( "Connected!" ) );
mConnectButton->setText( tr( "Dis&connect" ) );
//insert connection into registry such that it can also be used by other dialogs or plugins
- QgsGPSConnectionRegistry::instance()->registerConnection( mNmea );
+ QgsApplication::gpsConnectionRegistry()->registerConnection( mNmea );
showStatusBarMessage( tr( "Connected to GPS device." ) );
if ( mLogFileGroupBox->isChecked() && ! mTxtLogFile->text().isEmpty() )
@@ -481,7 +481,7 @@ void QgsGPSInformationWidget::disconnectGps()
mLogFile = nullptr;
}
- QgsGPSConnectionRegistry::instance()->unregisterConnection( mNmea );
+ QgsApplication::gpsConnectionRegistry()->unregisterConnection( mNmea );
delete mNmea;
mNmea = nullptr;
if ( mpMapMarker ) // marker should not be shown on GPS disconnected - not current position
@@ -703,7 +703,7 @@ void QgsGPSInformationWidget::displayGPSInformation( const QgsGPSInformation& in
QgsRectangle myExtentLimit( mpCanvas->extent() );
myExtentLimit.scale( mSpinMapExtentMultiplier->value() * 0.01 );
- // only change the extents if the point is beyond the current extents to minimise repaints
+ // only change the extents if the point is beyond the current extents to minimize repaints
if ( radRecenterMap->isChecked() ||
( radRecenterWhenNeeded->isChecked() && !myExtentLimit.contains( myPoint ) ) )
{
@@ -909,7 +909,7 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked()
f->setGeometry( g );
QgsGeometry featGeom = f->geometry();
- int avoidIntersectionsReturn = featGeom.avoidIntersections();
+ int avoidIntersectionsReturn = featGeom.avoidIntersections( QgsProject::instance()->avoidIntersectionsLayers() );
f->setGeometry( featGeom );
if ( avoidIntersectionsReturn == 1 )
{
diff --git a/src/app/main.cpp b/src/app/main.cpp
index 3075d89b35e..efb088e3e02 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -99,6 +99,7 @@ typedef SInt32 SRefCon;
#include "qgsdxfexport.h"
#include "qgsmapthemes.h"
#include "qgsvectorlayer.h"
+#include "qgis_app.h"
/** Print usage text
*/
diff --git a/src/app/nodetool/qgsselectedfeature.cpp b/src/app/nodetool/qgsselectedfeature.cpp
index 3e91448b0b7..4bb237874ad 100644
--- a/src/app/nodetool/qgsselectedfeature.cpp
+++ b/src/app/nodetool/qgsselectedfeature.cpp
@@ -285,7 +285,7 @@ void QgsSelectedFeature::deleteSelectedVertexes()
if ( res == QgsVectorLayer::EmptyGeometry )
{
- //geometry has been cleared as a result of deleting vertices (eg not enough vertices left to leave a valid geometry),
+ //geometry has been cleared as a result of deleting vertices (e.g., not enough vertices left to leave a valid geometry),
//so nothing more to do
QgsGeometry empty;
geometryChanged( mFeatureId, empty );
diff --git a/src/app/nodetool/qgsvertexentry.h b/src/app/nodetool/qgsvertexentry.h
index 9f95d465ef1..07dcbff19df 100644
--- a/src/app/nodetool/qgsvertexentry.h
+++ b/src/app/nodetool/qgsvertexentry.h
@@ -43,6 +43,9 @@ class QgsVertexEntry
int penWidth = 2 );
~QgsVertexEntry();
+ QgsVertexEntry( const QgsVertexEntry& rh ) = delete;
+ QgsVertexEntry& operator=( const QgsVertexEntry& rh ) = delete;
+
const QgsPointV2& point() const { return mPoint; }
QgsPoint pointV1() const { return QgsPoint( mPoint.x(), mPoint.y() ); }
QgsVertexId vertexId() const { return mVertexId; }
@@ -52,10 +55,6 @@ class QgsVertexEntry
void setSelected( bool selected = true );
- private:
-
- QgsVertexEntry( const QgsVertexEntry& rh );
- QgsVertexEntry& operator=( const QgsVertexEntry& rh );
};
#endif
diff --git a/src/app/ogr/qgsnewogrconnection.cpp b/src/app/ogr/qgsnewogrconnection.cpp
index dd7058c03df..2d74cae8504 100644
--- a/src/app/ogr/qgsnewogrconnection.cpp
+++ b/src/app/ogr/qgsnewogrconnection.cpp
@@ -22,15 +22,10 @@
#include "qgslogger.h"
#include "qgsproviderregistry.h"
#include "qgsogrhelperfunctions.h"
+#include "qgsapplication.h"
#include
#include
-#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1800
-#define TO8F(x) (x).toUtf8().constData()
-#else
-#define TO8F(x) QFile::encodeName( x ).constData()
-#endif
-
QgsNewOgrConnection::QgsNewOgrConnection( QWidget *parent, const QString& connType, const QString& connName, Qt::WindowFlags fl )
: QDialog( parent, fl )
, mOriginalConnName( connName )
@@ -88,7 +83,7 @@ void QgsNewOgrConnection::testConnection()
OGRDataSourceH poDS;
OGRSFDriverH pahDriver;
CPLErrorReset();
- poDS = OGROpen( TO8F( uri ), false, &pahDriver );
+ poDS = OGROpen( uri.toUtf8().constData(), false, &pahDriver );
if ( !poDS )
{
QMessageBox::information( this, tr( "Test connection" ), tr( "Connection failed - Check settings and try again.\n\nExtended error information:\n%1" ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ) );
diff --git a/src/app/ogr/qgsnewogrconnection.h b/src/app/ogr/qgsnewogrconnection.h
index 100d829232b..c93cd992751 100644
--- a/src/app/ogr/qgsnewogrconnection.h
+++ b/src/app/ogr/qgsnewogrconnection.h
@@ -32,7 +32,7 @@ class QgsNewOgrConnection : public QDialog, private Ui::QgsNewOgrConnectionBase
public:
//! Constructor
QgsNewOgrConnection( QWidget *parent = nullptr, const QString& connType = QString::null, const QString& connName = QString::null, Qt::WindowFlags fl = QgisGui::ModalDialogFlags );
- //! Destructor
+
~QgsNewOgrConnection();
//! Tests the connection using the parameters supplied
void testConnection();
diff --git a/src/app/ogr/qgsopenvectorlayerdialog.cpp b/src/app/ogr/qgsopenvectorlayerdialog.cpp
index 5649d5c1ca0..10e2c582c3f 100644
--- a/src/app/ogr/qgsopenvectorlayerdialog.cpp
+++ b/src/app/ogr/qgsopenvectorlayerdialog.cpp
@@ -31,6 +31,7 @@
#include "qgsnewogrconnection.h"
#include "qgsogrhelperfunctions.h"
#include "qgscontexthelp.h"
+#include "qgsapplication.h"
QgsOpenVectorLayerDialog::QgsOpenVectorLayerDialog( QWidget* parent, Qt::WindowFlags fl )
: QDialog( parent, fl )
diff --git a/src/app/ogr/qgsvectorlayersaveasdialog.cpp b/src/app/ogr/qgsvectorlayersaveasdialog.cpp
index f3a22ff0d31..8c2c0f93980 100644
--- a/src/app/ogr/qgsvectorlayersaveasdialog.cpp
+++ b/src/app/ogr/qgsvectorlayersaveasdialog.cpp
@@ -345,12 +345,7 @@ void QgsVectorLayerSaveAsDialog::on_mFormatComboBox_currentIndexChanged( int idx
bool fieldsAsDisplayedValues = false;
const QString sFormat( format() );
- if ( sFormat == QLatin1String( "KML" ) )
- {
- mAttributesSelection->setEnabled( true );
- selectAllFields = false;
- }
- else if ( sFormat == QLatin1String( "DXF" ) )
+ if ( sFormat == QLatin1String( "DXF" ) )
{
mAttributesSelection->setEnabled( false );
selectAllFields = false;
diff --git a/src/app/ogr/qgsvectorlayersaveasdialog.h b/src/app/ogr/qgsvectorlayersaveasdialog.h
index c586e976020..e01732cc098 100644
--- a/src/app/ogr/qgsvectorlayersaveasdialog.h
+++ b/src/app/ogr/qgsvectorlayersaveasdialog.h
@@ -23,6 +23,7 @@
#include "qgscontexthelp.h"
#include "qgsfields.h"
#include "qgsvectorfilewriter.h"
+#include "qgis_app.h"
class QgsVectorLayer;
diff --git a/src/app/pluginmanager/qgsapppluginmanagerinterface.h b/src/app/pluginmanager/qgsapppluginmanagerinterface.h
index 7e528827bea..3a18e6d572e 100644
--- a/src/app/pluginmanager/qgsapppluginmanagerinterface.h
+++ b/src/app/pluginmanager/qgsapppluginmanagerinterface.h
@@ -34,7 +34,6 @@ class QgsAppPluginManagerInterface : public QgsPluginManagerInterface
//! Constructor
explicit QgsAppPluginManagerInterface( QgsPluginManager * pluginManager );
- //! Destructor
~QgsAppPluginManagerInterface();
//! remove python plugins from the metadata registry (c++ plugins stay)
diff --git a/src/app/pluginmanager/qgspluginmanager.h b/src/app/pluginmanager/qgspluginmanager.h
index 08307b12225..fdece7a7501 100644
--- a/src/app/pluginmanager/qgspluginmanager.h
+++ b/src/app/pluginmanager/qgspluginmanager.h
@@ -50,7 +50,6 @@ class QgsPluginManager : public QgsOptionsDialogBase, private Ui::QgsPluginManag
//! Constructor; set pluginsAreEnabled to false in --noplugins mode
QgsPluginManager( QWidget *parent = nullptr, bool pluginsAreEnabled = true, Qt::WindowFlags fl = QgisGui::ModalDialogFlags );
- //! Destructor
~QgsPluginManager();
//! Save pointer to python utils and enable Python support
diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp
index 1655c651faf..7121276b92c 100644
--- a/src/app/qgisapp.cpp
+++ b/src/app/qgisapp.cpp
@@ -266,10 +266,6 @@
#include
#include
-#if defined(GDAL_COMPUTE_VERSION) && GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
-#define SUPPORT_GEOPACKAGE
-#endif
-
//
// Other includes
//
@@ -879,7 +875,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
mLogDock->hide();
connect( mMessageButton, SIGNAL( toggled( bool ) ), mLogDock, SLOT( setVisible( bool ) ) );
connect( mLogDock, SIGNAL( visibilityChanged( bool ) ), mMessageButton, SLOT( setChecked( bool ) ) );
- connect( QgsMessageLog::instance(), SIGNAL( messageReceived( bool ) ), this, SLOT( toggleLogMessageIcon( bool ) ) );
+ connect( QgsApplication::messageLog(), SIGNAL( messageReceived( bool ) ), this, SLOT( toggleLogMessageIcon( bool ) ) );
connect( mMessageButton, SIGNAL( toggled( bool ) ), this, SLOT( toggleLogMessageIcon( bool ) ) );
mVectorLayerTools = new QgsGuiVectorLayerTools();
@@ -1707,6 +1703,7 @@ void QgisApp::createActions()
connect( mActionHideAllLayers, SIGNAL( triggered() ), this, SLOT( hideAllLayers() ) );
connect( mActionShowSelectedLayers, SIGNAL( triggered() ), this, SLOT( showSelectedLayers() ) );
connect( mActionHideSelectedLayers, SIGNAL( triggered() ), this, SLOT( hideSelectedLayers() ) );
+ connect( mActionHideDeselectedLayers, &QAction::triggered, this, &QgisApp::hideDeselectedLayers );
// Plugin Menu Items
@@ -1721,7 +1718,7 @@ void QgisApp::createActions()
connect( mActionOptions, SIGNAL( triggered() ), this, SLOT( options() ) );
connect( mActionCustomProjection, SIGNAL( triggered() ), this, SLOT( customProjection() ) );
connect( mActionConfigureShortcuts, SIGNAL( triggered() ), this, SLOT( configureShortcuts() ) );
- connect( mActionStyleManagerV2, SIGNAL( triggered() ), this, SLOT( showStyleManager() ) );
+ connect( mActionStyleManager, SIGNAL( triggered() ), this, SLOT( showStyleManager() ) );
connect( mActionCustomization, SIGNAL( triggered() ), this, SLOT( customize() ) );
#ifdef Q_OS_MAC
@@ -1963,10 +1960,6 @@ void QgisApp::createMenus()
*/
// Layer menu
-#ifndef SUPPORT_GEOPACKAGE
- mProjectMenu->removeAction( mActionDwgImport );
- mNewLayerMenu->removeAction( mActionNewGeoPackageLayer );
-#endif
// Panel and Toolbar Submenus
mPanelMenu = new QMenu( tr( "Panels" ), this );
@@ -2028,7 +2021,11 @@ void QgisApp::createMenus()
// keep plugins from hijacking About and Preferences application menus
// these duplicate actions will be moved to application menus by Qt
mProjectMenu->addAction( mActionAbout );
- mProjectMenu->addAction( mActionOptions );
+ QAction* actionPrefs = new QAction( tr( "Preferences..." ), this );
+ actionPrefs->setMenuRole( QAction::PreferencesRole );
+ actionPrefs->setIcon( mActionOptions->icon() );
+ connect( actionPrefs, &QAction::triggered, this, &QgisApp::options );
+ mProjectMenu->addAction( actionPrefs );
// Window Menu
@@ -2112,10 +2109,10 @@ void QgisApp::createToolBars()
QToolButton *bt = new QToolButton( mAttributesToolBar );
bt->setPopupMode( QToolButton::MenuButtonPopup );
QList selectActions;
- selectActions << mActionSelectByExpression << mActionSelectByForm << mActionSelectAll
+ selectActions << mActionSelectByForm << mActionSelectByExpression << mActionSelectAll
<< mActionInvertSelection;
bt->addActions( selectActions );
- bt->setDefaultAction( mActionSelectByExpression );
+ bt->setDefaultAction( mActionSelectByForm );
QAction* selectionAction = mAttributesToolBar->insertWidget( mActionDeselectAll, bt );
selectionAction->setObjectName( QStringLiteral( "ActionSelection" ) );
@@ -2236,9 +2233,7 @@ void QgisApp::createToolBars()
bt->setPopupMode( QToolButton::MenuButtonPopup );
bt->addAction( mActionNewVectorLayer );
bt->addAction( mActionNewSpatiaLiteLayer );
-#ifdef SUPPORT_GEOPACKAGE
bt->addAction( mActionNewGeoPackageLayer );
-#endif
bt->addAction( mActionNewMemoryLayer );
QAction* defNewLayerAction = mActionNewVectorLayer;
@@ -2253,11 +2248,9 @@ void QgisApp::createToolBars()
case 2:
defNewLayerAction = mActionNewMemoryLayer;
break;
-#ifdef SUPPORT_GEOPACKAGE
case 3:
defNewLayerAction = mActionNewGeoPackageLayer;
break;
-#endif
}
bt->setDefaultAction( defNewLayerAction );
QAction* newLayerAction = mLayerToolBar->addWidget( bt );
@@ -2626,8 +2619,8 @@ void QgisApp::setTheme( const QString& theThemeName )
mActionShowPythonDialog->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "console/iconRunConsole.png" ) ) );
mActionCheckQgisVersion->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionCheckQgisVersion.png" ) ) );
mActionOptions->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionOptions.svg" ) ) );
- mActionConfigureShortcuts->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionOptions.svg" ) ) );
- mActionCustomization->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionOptions.svg" ) ) );
+ mActionConfigureShortcuts->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionKeyboardShortcuts.svg" ) ) );
+ mActionCustomization->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionInterfaceCustomization.svg" ) ) );
mActionHelpContents->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionHelpContents.svg" ) ) );
mActionLocalHistogramStretch->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionLocalHistogramStretch.svg" ) ) );
mActionFullHistogramStretch->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionFullHistogramStretch.svg" ) ) );
@@ -2726,7 +2719,7 @@ void QgisApp::setTheme( const QString& theThemeName )
mActionMoveLabel->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionMoveLabel.svg" ) ) );
mActionRotateLabel->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionRotateLabel.svg" ) ) );
mActionChangeLabelProperties->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionChangeLabelProperties.svg" ) ) );
- mActionDiagramProperties->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionDiagramProperties.svg" ) ) );
+ mActionDiagramProperties->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/propertyicons/diagram.svg" ) ) );
mActionDecorationCopyright->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/copyright_label.png" ) ) );
mActionDecorationNorthArrow->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/north_arrow.png" ) ) );
mActionDecorationScaleBar->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/scale_bar.png" ) ) );
@@ -2803,7 +2796,7 @@ void QgisApp::setupConnections()
this, SLOT( markDirty() ) );
connect( mLayerTreeView->layerTreeModel()->rootGroup(), SIGNAL( removedChildren( QgsLayerTreeNode*, int, int ) ),
this, SLOT( updateNewLayerInsertionPoint() ) );
- connect( mLayerTreeView->layerTreeModel()->rootGroup(), SIGNAL( visibilityChanged( QgsLayerTreeNode*, Qt::CheckState ) ),
+ connect( mLayerTreeView->layerTreeModel()->rootGroup(), SIGNAL( visibilityChanged( QgsLayerTreeNode* ) ),
this, SLOT( markDirty() ) );
connect( mLayerTreeView->layerTreeModel()->rootGroup(), SIGNAL( customPropertyChanged( QgsLayerTreeNode*, QString ) ),
this, SLOT( markDirty() ) );
@@ -5754,9 +5747,8 @@ void QgisApp::stopRendering()
void QgisApp::hideAllLayers()
{
QgsDebugMsg( "hiding all layers!" );
+ mLayerTreeView->layerTreeModel()->rootGroup()->setItemVisibilityCheckedRecursive( false );
- Q_FOREACH ( QgsLayerTreeLayer* nodeLayer, mLayerTreeView->layerTreeModel()->rootGroup()->findLayers() )
- nodeLayer->setVisible( Qt::Unchecked );
}
@@ -5764,9 +5756,7 @@ void QgisApp::hideAllLayers()
void QgisApp::showAllLayers()
{
QgsDebugMsg( "Showing all layers!" );
-
- Q_FOREACH ( QgsLayerTreeLayer* nodeLayer, mLayerTreeView->layerTreeModel()->rootGroup()->findLayers() )
- nodeLayer->setVisible( Qt::Checked );
+ mLayerTreeView->layerTreeModel()->rootGroup()->setItemVisibilityCheckedRecursive( true );
}
//reimplements method from base (gui) class
@@ -5776,13 +5766,21 @@ void QgisApp::hideSelectedLayers()
Q_FOREACH ( QgsLayerTreeNode* node, mLayerTreeView->selectedNodes() )
{
- if ( QgsLayerTree::isGroup( node ) )
- QgsLayerTree::toGroup( node )->setVisible( Qt::Unchecked );
- else if ( QgsLayerTree::isLayer( node ) )
- QgsLayerTree::toLayer( node )->setVisible( Qt::Unchecked );
+ node->setItemVisibilityChecked( false );
}
}
+void QgisApp::hideDeselectedLayers()
+{
+ QList selectedLayerNodes = mLayerTreeView->selectedLayerNodes();
+
+ Q_FOREACH ( QgsLayerTreeLayer* nodeLayer, mLayerTreeView->layerTreeModel()->rootGroup()->findLayers() )
+ {
+ if ( selectedLayerNodes.contains( nodeLayer ) )
+ continue;
+ nodeLayer->setItemVisibilityChecked( false );
+ }
+}
// reimplements method from base (gui) class
void QgisApp::showSelectedLayers()
@@ -5791,10 +5789,12 @@ void QgisApp::showSelectedLayers()
Q_FOREACH ( QgsLayerTreeNode* node, mLayerTreeView->selectedNodes() )
{
- if ( QgsLayerTree::isGroup( node ) )
- QgsLayerTree::toGroup( node )->setVisible( Qt::Checked );
- else if ( QgsLayerTree::isLayer( node ) )
- QgsLayerTree::toLayer( node )->setVisible( Qt::Checked );
+ QgsLayerTreeNode* nodeIter = node;
+ while ( nodeIter )
+ {
+ nodeIter->setItemVisibilityChecked( true );
+ nodeIter = nodeIter->parent();
+ }
}
}
@@ -6353,7 +6353,7 @@ void QgisApp::saveAsLayerDefinition()
bool saved = QgsLayerDefinition::exportLayerDefinition( path, mLayerTreeView->selectedNodes(), errorMessage );
if ( !saved )
{
- messageBar()->pushMessage( tr( "Error saving layer definintion file" ), errorMessage, QgsMessageBar::WARNING );
+ messageBar()->pushMessage( tr( "Error saving layer definition file" ), errorMessage, QgsMessageBar::WARNING );
}
}
@@ -7492,6 +7492,8 @@ void QgisApp::selectByExpression()
}
QgsExpressionSelectionDialog* dlg = new QgsExpressionSelectionDialog( vlayer, QString(), this );
+ dlg->setMessageBar( messageBar() );
+ dlg->setMapCanvas( mapCanvas() );
dlg->setAttribute( Qt::WA_DeleteOnClose );
dlg->show();
}
@@ -7520,6 +7522,7 @@ void QgisApp::selectByForm()
QgsSelectByFormDialog* dlg = new QgsSelectByFormDialog( vlayer, context, this );
dlg->setMessageBar( messageBar() );
+ dlg->setMapCanvas( mapCanvas() );
dlg->setAttribute( Qt::WA_DeleteOnClose );
dlg->show();
}
@@ -7641,7 +7644,7 @@ void QgisApp::editPaste( QgsMapLayer *destinationLayer )
geom = newGeometry;
}
// avoid intersection if enabled in digitize settings
- geom.avoidIntersections();
+ geom.avoidIntersections( QgsProject::instance()->avoidIntersectionsLayers() );
}
// now create new feature using pasted feature as a template. This automatically handles default
@@ -8354,7 +8357,7 @@ void QgisApp::layerSubsetString()
// hide the old layer
QgsLayerTreeLayer* vLayerTreeLayer = QgsProject::instance()->layerTreeRoot()->findLayer( vlayer->id() );
if ( vLayerTreeLayer )
- vLayerTreeLayer->setVisible( Qt::Unchecked );
+ vLayerTreeLayer->setItemVisibilityChecked( false );
vlayer = newLayer;
}
else
@@ -8644,7 +8647,7 @@ void QgisApp::duplicateLayers( const QList& lyrList )
QgsLayerTreeLayer* nodeDupLayer = parentGroup->insertLayer( parentGroup->children().indexOf( nodeSelectedLyr ) + 1, dupLayer );
// always set duplicated layers to not visible so layer can be configured before being turned on
- nodeDupLayer->setVisible( Qt::Unchecked );
+ nodeDupLayer->setItemVisibilityChecked( false );
// duplicate the layer style
QString errMsg;
@@ -9099,7 +9102,7 @@ void QgisApp::showOptionsDialog( QWidget *parent, const QString& currentPage )
QSettings mySettings;
QString oldScales = mySettings.value( QStringLiteral( "Map/scales" ), PROJECT_SCALES ).toString();
- bool oldCapitalise = mySettings.value( QStringLiteral( "/qgis/capitaliseLayerName" ), QVariant( false ) ).toBool();
+ bool oldCapitalize = mySettings.value( QStringLiteral( "/qgis/capitalizeLayerName" ), QVariant( false ) ).toBool();
QgsOptions *optionsDialog = new QgsOptions( parent );
if ( !currentPage.isEmpty() )
@@ -9124,7 +9127,7 @@ void QgisApp::showOptionsDialog( QWidget *parent, const QString& currentPage )
mMapCanvas->setMapUpdateInterval( mySettings.value( QStringLiteral( "/qgis/map_update_interval" ), 250 ).toInt() );
- if ( oldCapitalise != mySettings.value( QStringLiteral( "/qgis/capitaliseLayerName" ), QVariant( false ) ).toBool() )
+ if ( oldCapitalize != mySettings.value( QStringLiteral( "/qgis/capitalizeLayerName" ), QVariant( false ) ).toBool() )
{
// if the layer capitalization has changed, we need to update all layer names
Q_FOREACH ( QgsMapLayer* layer, QgsProject::instance()->mapLayers() )
@@ -10810,8 +10813,10 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionPasteFeatures->setEnabled( isEditable && canAddFeatures && !clipboard()->isEmpty() );
mActionAddFeature->setEnabled( isEditable && canAddFeatures );
- mActionCircularStringCurvePoint->setEnabled( isEditable && isSpatial && ( canAddFeatures || canChangeGeometry ) && vlayer->geometryType() != QgsWkbTypes::PointGeometry );
- mActionCircularStringRadius->setEnabled( isEditable && isSpatial && ( canAddFeatures || canChangeGeometry ) );
+ mActionCircularStringCurvePoint->setEnabled( isEditable && ( canAddFeatures || canChangeGeometry )
+ && ( vlayer->geometryType() == QgsWkbTypes::LineGeometry || vlayer->geometryType() == QgsWkbTypes::PolygonGeometry ) );
+ mActionCircularStringRadius->setEnabled( isEditable && ( canAddFeatures || canChangeGeometry )
+ && ( vlayer->geometryType() == QgsWkbTypes::LineGeometry || vlayer->geometryType() == QgsWkbTypes::PolygonGeometry ) );
//does provider allow deleting of features?
mActionDeleteSelected->setEnabled( isEditable && canDeleteFeatures && layerHasSelection );
@@ -11337,7 +11342,7 @@ bool QgisApp::addRasterLayers( QStringList const &theFileNameQStringList, bool g
QgsPluginLayer* QgisApp::addPluginLayer( const QString& uri, const QString& baseName, const QString& providerKey )
{
- QgsPluginLayer* layer = QgsPluginLayerRegistry::instance()->createLayer( providerKey, uri );
+ QgsPluginLayer* layer = QgsApplication::pluginLayerRegistry()->createLayer( providerKey, uri );
if ( !layer )
return nullptr;
@@ -11654,7 +11659,7 @@ void QgisApp::showLayerProperties( QgsMapLayer *ml )
if ( !pl )
return;
- QgsPluginLayerType* plt = QgsPluginLayerRegistry::instance()->pluginLayerType( pl->pluginLayerType() );
+ QgsPluginLayerType* plt = QgsApplication::pluginLayerRegistry()->pluginLayerType( pl->pluginLayerType() );
if ( !plt )
return;
diff --git a/src/app/qgisapp.h b/src/app/qgisapp.h
index 145a40c8e32..1b7ff79b08a 100644
--- a/src/app/qgisapp.h
+++ b/src/app/qgisapp.h
@@ -128,6 +128,7 @@ class QgsDiagramProperties;
#include "qgsrasterminmaxorigin.h"
#include "ui_qgisapp.h"
+#include "qgis_app.h"
#ifdef HAVE_TOUCH
#include
@@ -151,9 +152,12 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
QgisApp( QSplashScreen *splash, bool restorePlugins = true, bool skipVersionCheck = false, QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::Window );
//! Constructor for unit tests
QgisApp();
- //! Destructor
+
~QgisApp();
+ QgisApp( QgisApp const & ) = delete;
+ QgisApp & operator=( QgisApp const & ) = delete;
+
/**
* Add a vector layer to the canvas, returns pointer to it
*/
@@ -411,6 +415,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
QAction *actionHideAllLayers() { return mActionHideAllLayers; }
QAction *actionShowAllLayers() { return mActionShowAllLayers; }
QAction *actionHideSelectedLayers() { return mActionHideSelectedLayers; }
+ QAction *actionHideDeselectedLayers() { return mActionHideDeselectedLayers; }
QAction *actionShowSelectedLayers() { return mActionShowSelectedLayers; }
QAction *actionManagePlugins() { return mActionManagePlugins; }
@@ -1027,6 +1032,8 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
void showAllLayers();
//reimplements method from base (gui) class
void hideSelectedLayers();
+ //! Hides any layers which are not selected
+ void hideDeselectedLayers();
//reimplements method from base (gui) class
void showSelectedLayers();
//! Return pointer to the active layer
@@ -1506,11 +1513,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
//! Configure layer tree view according to the user options from QSettings
void setupLayerTreeViewFromSettings();
- /// QgisApp aren't copyable
- QgisApp( QgisApp const & );
- /// QgisApp aren't copyable
- QgisApp & operator=( QgisApp const & );
-
void readSettings();
void writeSettings();
void createActions();
diff --git a/src/app/qgisappinterface.cpp b/src/app/qgisappinterface.cpp
index a93236bd0ad..16771ac82c4 100644
--- a/src/app/qgisappinterface.cpp
+++ b/src/app/qgisappinterface.cpp
@@ -71,10 +71,6 @@ QgisAppInterface::QgisAppInterface( QgisApp * _qgis )
this, SIGNAL( layerSavedAs( QgsMapLayer*, QString ) ) );
}
-QgisAppInterface::~QgisAppInterface()
-{
-}
-
QgsPluginManagerInterface* QgisAppInterface::pluginManagerInterface()
{
return &pluginManagerIface;
@@ -631,6 +627,7 @@ QAction *QgisAppInterface::actionRemoveAllFromOverview() { return qgis->actionRe
QAction *QgisAppInterface::actionHideAllLayers() { return qgis->actionHideAllLayers(); }
QAction *QgisAppInterface::actionShowAllLayers() { return qgis->actionShowAllLayers(); }
QAction *QgisAppInterface::actionHideSelectedLayers() { return qgis->actionHideSelectedLayers(); }
+QAction*QgisAppInterface::actionHideDeselectedLayers() { return qgis->actionHideDeselectedLayers(); }
QAction *QgisAppInterface::actionShowSelectedLayers() { return qgis->actionShowSelectedLayers(); }
//! Plugin menu actions
diff --git a/src/app/qgisappinterface.h b/src/app/qgisappinterface.h
index 02de57d0d6d..8a5c924cc47 100644
--- a/src/app/qgisappinterface.h
+++ b/src/app/qgisappinterface.h
@@ -20,6 +20,7 @@
#include "qgisinterface.h"
#include "qgsapppluginmanagerinterface.h"
+#include "qgis_app.h"
class QgisApp;
@@ -43,7 +44,9 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
* @param qgis Pointer to the QgisApp object
*/
QgisAppInterface( QgisApp *qgisapp );
- ~QgisAppInterface();
+
+ QgisAppInterface( QgisAppInterface const & ) = delete;
+ QgisAppInterface & operator=( QgisAppInterface const & ) = delete;
QgsPluginManagerInterface* pluginManagerInterface() override;
@@ -445,6 +448,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
virtual QAction *actionHideAllLayers() override;
virtual QAction *actionShowAllLayers() override;
virtual QAction *actionHideSelectedLayers() override;
+ virtual QAction *actionHideDeselectedLayers() override;
virtual QAction *actionShowSelectedLayers() override;
//! Plugin menu actions
@@ -523,12 +527,6 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
private:
- /// QgisInterface aren't copied
- QgisAppInterface( QgisAppInterface const & );
-
- /// QgisInterface aren't copied
- QgisAppInterface & operator=( QgisAppInterface const & );
-
//! Pointer to the QgisApp object
QgisApp *qgis;
diff --git a/src/app/qgisappstylesheet.h b/src/app/qgisappstylesheet.h
index 71eb8371854..25b406853de 100644
--- a/src/app/qgisappstylesheet.h
+++ b/src/app/qgisappstylesheet.h
@@ -21,6 +21,7 @@
#include
#include
#include
+#include "qgis_app.h"
/** @class QgisAppStyleSheet
* @brief Adjustable stylesheet for the Qgis application
diff --git a/src/app/qgsabout.h b/src/app/qgsabout.h
index 162e7547bd1..2912a022e01 100644
--- a/src/app/qgsabout.h
+++ b/src/app/qgsabout.h
@@ -19,6 +19,7 @@
#include "ui_qgsabout.h"
#include "qgsoptionsdialogbase.h"
+#include "qgis_app.h"
class APP_EXPORT QgsAbout : public QgsOptionsDialogBase, private Ui::QgsAbout
{
diff --git a/src/app/qgsaddattrdialog.h b/src/app/qgsaddattrdialog.h
index 5d26b8ca718..27ab7bedb1a 100644
--- a/src/app/qgsaddattrdialog.h
+++ b/src/app/qgsaddattrdialog.h
@@ -21,6 +21,7 @@
#include "ui_qgsaddattrdialogbase.h"
#include "qgisgui.h"
#include "qgsfields.h"
+#include "qgis_app.h"
class QgsVectorLayer;
diff --git a/src/app/qgsaddtaborgroup.h b/src/app/qgsaddtaborgroup.h
index ebdbd7feb69..5b51eff9b89 100644
--- a/src/app/qgsaddtaborgroup.h
+++ b/src/app/qgsaddtaborgroup.h
@@ -21,6 +21,7 @@
#include "ui_qgsaddtaborgroupbase.h"
#include "qgisgui.h"
+#include "qgis_app.h"
class QTreeWidgetItem;
class QgsVectorLayer;
diff --git a/src/app/qgsalignrasterdialog.cpp b/src/app/qgsalignrasterdialog.cpp
index e0edb5b8de0..bbced151694 100644
--- a/src/app/qgsalignrasterdialog.cpp
+++ b/src/app/qgsalignrasterdialog.cpp
@@ -393,13 +393,11 @@ QgsAlignRasterLayerConfigDialog::QgsAlignRasterLayerConfigDialog()
cboResample->addItem( tr( "Lanczos (6x6 kernel)" ), QgsAlignRaster::RA_Lanczos );
cboResample->addItem( tr( "Average" ), QgsAlignRaster::RA_Average );
cboResample->addItem( tr( "Mode" ), QgsAlignRaster::RA_Mode );
-#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 2000000
cboResample->addItem( tr( "Maximum" ), QgsAlignRaster::RA_Max );
cboResample->addItem( tr( "Minimum" ), QgsAlignRaster::RA_Min );
cboResample->addItem( tr( "Median" ), QgsAlignRaster::RA_Median );
cboResample->addItem( tr( "First Quartile (Q1)" ), QgsAlignRaster::RA_Q1 );
cboResample->addItem( tr( "Third Quartile (Q3)" ), QgsAlignRaster::RA_Q3 );
-#endif
editOutput = new QLineEdit( this );
btnBrowse = new QPushButton( tr( "Browse..." ), this );
diff --git a/src/app/qgsannotationwidget.h b/src/app/qgsannotationwidget.h
index 91f7f657a87..fba5fa01df8 100644
--- a/src/app/qgsannotationwidget.h
+++ b/src/app/qgsannotationwidget.h
@@ -19,6 +19,7 @@
#define QGSANNOTATIONWIDGET_H
#include "ui_qgsannotationwidgetbase.h"
+#include "qgis_app.h"
class QgsAnnotationItem;
class QgsMarkerSymbol;
diff --git a/src/app/qgsapplayertreeviewmenuprovider.cpp b/src/app/qgsapplayertreeviewmenuprovider.cpp
index 2d02f21e5d7..a18a4b92070 100644
--- a/src/app/qgsapplayertreeviewmenuprovider.cpp
+++ b/src/app/qgsapplayertreeviewmenuprovider.cpp
@@ -80,6 +80,10 @@ QMenu* QgsAppLayerTreeViewMenuProvider::createContextMenu()
menu->addAction( actions->actionMutuallyExclusiveGroup( menu ) );
+ menu->addAction( actions->actionCheckAndAllChildren( menu ) );
+
+ menu->addAction( actions->actionUncheckAndAllChildren( menu ) );
+
if ( mView->selectedNodes( true ).count() >= 2 )
menu->addAction( actions->actionGroupSelected( menu ) );
@@ -125,6 +129,8 @@ QMenu* QgsAppLayerTreeViewMenuProvider::createContextMenu()
if ( !layer->isInScaleRange( mCanvas->scale() ) )
menu->addAction( tr( "Zoom to &Visible Scale" ), QgisApp::instance(), SLOT( zoomToLayerScale() ) );
+ menu->addAction( actions->actionCheckAndAllParents( menu ) );
+
// set layer crs
menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionSetCRS.png" ) ), tr( "Set Layer CRS" ), QgisApp::instance(), SLOT( setLayerCrs() ) );
@@ -169,7 +175,7 @@ QMenu* QgsAppLayerTreeViewMenuProvider::createContextMenu()
//add recent colors action
QList recentSchemes;
- QgsColorSchemeRegistry::instance()->schemes( recentSchemes );
+ QgsApplication::colorSchemeRegistry()->schemes( recentSchemes );
if ( !recentSchemes.isEmpty() )
{
QgsColorSwatchGridAction* recentColorAction = new QgsColorSwatchGridAction( recentSchemes.at( 0 ), menuStyleManager, QStringLiteral( "symbology" ), menuStyleManager );
@@ -306,7 +312,7 @@ QMenu* QgsAppLayerTreeViewMenuProvider::createContextMenu()
//add recent colors action
QList recentSchemes;
- QgsColorSchemeRegistry::instance()->schemes( recentSchemes );
+ QgsApplication::colorSchemeRegistry()->schemes( recentSchemes );
if ( !recentSchemes.isEmpty() )
{
QgsColorSwatchGridAction* recentColorAction = new QgsColorSwatchGridAction( recentSchemes.at( 0 ), menu, QStringLiteral( "symbology" ), menu );
diff --git a/src/app/qgsattributeactiondialog.cpp b/src/app/qgsattributeactiondialog.cpp
index 43bc8343507..a15360c5bad 100644
--- a/src/app/qgsattributeactiondialog.cpp
+++ b/src/app/qgsattributeactiondialog.cpp
@@ -150,7 +150,8 @@ void QgsAttributeActionDialog::insertRow( int row, const QgsAction& action )
void QgsAttributeActionDialog::insertRow( int row, QgsAction::ActionType type, const QString& name, const QString& actionText, const QString& iconPath, bool capture, const QString& shortTitle, const QSet& actionScopes )
{
- insertRow( row, QgsAction( type, name, actionText, iconPath, capture, shortTitle, actionScopes ) );
+ if ( uniqueName( name ) == name )
+ insertRow( row, QgsAction( type, name, actionText, iconPath, capture, shortTitle, actionScopes ) );
}
void QgsAttributeActionDialog::moveUp()
@@ -356,7 +357,7 @@ QString QgsAttributeActionDialog::uniqueName( QString name )
for ( int i = 0; i < pos; ++i )
{
- if ( mAttributeActionTable->item( i, 0 )->text() == name )
+ if ( mAttributeActionTable->item( i, Description )->text() == name )
unique = false;
}
diff --git a/src/app/qgsattributeactiondialog.h b/src/app/qgsattributeactiondialog.h
index 53703be4ab1..de2d2d3049e 100644
--- a/src/app/qgsattributeactiondialog.h
+++ b/src/app/qgsattributeactiondialog.h
@@ -27,6 +27,7 @@ back to QgsVectorLayer.
#include "qgsattributetableconfig.h"
#include "qgsaction.h"
#include
+#include "qgis_app.h"
class QgsActionManager;
class QgsVectorLayer;
@@ -49,8 +50,6 @@ class APP_EXPORT QgsAttributeActionDialog: public QWidget, private Ui::QgsAttrib
QgsAttributeActionDialog( const QgsActionManager& actions,
QWidget* parent = nullptr );
- ~QgsAttributeActionDialog() {}
-
void init( const QgsActionManager& action , const QgsAttributeTableConfig& attributeTableConfig );
QList actions() const;
diff --git a/src/app/qgsattributetabledialog.cpp b/src/app/qgsattributetabledialog.cpp
index 96578a47824..328aaa5b218 100644
--- a/src/app/qgsattributetabledialog.cpp
+++ b/src/app/qgsattributetabledialog.cpp
@@ -54,7 +54,7 @@ QgsExpressionContext QgsAttributeTableDialog::createExpressionContext() const
{
QgsExpressionContext expContext;
expContext << QgsExpressionContextUtils::globalScope()
- << QgsExpressionContextUtils::projectScope();
+ << QgsExpressionContextUtils::projectScope( QgsProject::instance() );
if ( mLayer )
expContext << QgsExpressionContextUtils::layerScope( mLayer );
@@ -474,10 +474,7 @@ void QgsAttributeTableDialog::runFieldCalculation( QgsVectorLayer* layer, const
int rownum = 1;
- QgsExpressionContext context;
- context << QgsExpressionContextUtils::globalScope()
- << QgsExpressionContextUtils::projectScope()
- << QgsExpressionContextUtils::layerScope( layer );
+ QgsExpressionContext context( QgsExpressionContextUtils::globalProjectLayerScopes( layer ) );
QgsField fld = layer->fields().at( fieldindex );
@@ -583,10 +580,7 @@ void QgsAttributeTableDialog::filterColumnChanged( QObject* filterAction )
void QgsAttributeTableDialog::filterExpressionBuilder()
{
// Show expression builder
- QgsExpressionContext context;
- context << QgsExpressionContextUtils::globalScope()
- << QgsExpressionContextUtils::projectScope()
- << QgsExpressionContextUtils::layerScope( mLayer );
+ QgsExpressionContext context( QgsExpressionContextUtils::globalProjectLayerScopes( mLayer ) );
QgsExpressionBuilderDialog dlg( mLayer, mFilterQuery->text(), this, QStringLiteral( "generic" ), context );
dlg.setWindowTitle( tr( "Expression based filter" ) );
@@ -965,10 +959,7 @@ void QgsAttributeTableDialog::setFilterExpression( const QString& filterString,
return;
}
- QgsExpressionContext context;
- context << QgsExpressionContextUtils::globalScope()
- << QgsExpressionContextUtils::projectScope()
- << QgsExpressionContextUtils::layerScope( mLayer );
+ QgsExpressionContext context( QgsExpressionContextUtils::globalProjectLayerScopes( mLayer ) );
if ( !filterExpression.prepare( &context ) )
{
diff --git a/src/app/qgsattributetabledialog.h b/src/app/qgsattributetabledialog.h
index 0f017741dd0..b9015eb4f6c 100644
--- a/src/app/qgsattributetabledialog.h
+++ b/src/app/qgsattributetabledialog.h
@@ -26,6 +26,7 @@
#include "ui_qgsattributetabledialog.h"
#include "qgssearchwidgetwrapper.h"
#include "qgsdockwidget.h"
+#include "qgis_app.h"
class QDialogButtonBox;
class QPushButton;
diff --git a/src/app/qgsattributetypedialog.h b/src/app/qgsattributetypedialog.h
index b189f88f286..33173be6842 100644
--- a/src/app/qgsattributetypedialog.h
+++ b/src/app/qgsattributetypedialog.h
@@ -22,6 +22,7 @@
#include "qgseditorconfigwidget.h"
#include "qgsfeature.h"
#include "qgsvectordataprovider.h"
+#include "qgis_app.h"
class QDialog;
diff --git a/src/app/qgsbookmarks.h b/src/app/qgsbookmarks.h
index 7e05c762825..94997f724df 100644
--- a/src/app/qgsbookmarks.h
+++ b/src/app/qgsbookmarks.h
@@ -22,6 +22,7 @@
#include "ui_qgsbookmarksbase.h"
#include "qgsdockwidget.h"
+#include "qgis_app.h"
/*
* Model for project bookmarks
diff --git a/src/app/qgsbrowserdockwidget.h b/src/app/qgsbrowserdockwidget.h
index 05328cedd8c..40f3e23a680 100644
--- a/src/app/qgsbrowserdockwidget.h
+++ b/src/app/qgsbrowserdockwidget.h
@@ -24,6 +24,7 @@
#include "qgsbrowsertreeview.h"
#include "qgsdockwidget.h"
#include
+#include "qgis_app.h"
class QgsBrowserModel;
class QModelIndex;
diff --git a/src/app/qgsclipboard.h b/src/app/qgsclipboard.h
index 16b56fac6a7..4fd89900291 100644
--- a/src/app/qgsclipboard.h
+++ b/src/app/qgsclipboard.h
@@ -25,6 +25,7 @@
#include "qgsfields.h"
#include "qgsfeature.h"
#include "qgscoordinatereferencesystem.h"
+#include "qgis_app.h"
/**
\brief QGIS internal clipboard for features.
@@ -67,7 +68,6 @@ class APP_EXPORT QgsClipboard : public QObject
*/
QgsClipboard();
- //! Destructor
virtual ~QgsClipboard();
/**
diff --git a/src/app/qgscustomization.h b/src/app/qgscustomization.h
index a50b640aa1c..f146c22960e 100644
--- a/src/app/qgscustomization.h
+++ b/src/app/qgscustomization.h
@@ -25,6 +25,7 @@
#include
#include
#include
+#include "qgis_app.h"
class QString;
class QWidget;
diff --git a/src/app/qgscustomprojectiondialog.h b/src/app/qgscustomprojectiondialog.h
index 056eb56fc46..45f1bcfb115 100644
--- a/src/app/qgscustomprojectiondialog.h
+++ b/src/app/qgscustomprojectiondialog.h
@@ -21,6 +21,7 @@
#include "ui_qgscustomprojectiondialogbase.h"
#include "qgscontexthelp.h"
#include "qgscoordinatereferencesystem.h"
+#include "qgis_app.h"
class QDir;
diff --git a/src/app/qgsdecorationcopyright.cpp b/src/app/qgsdecorationcopyright.cpp
index e64893b1c07..0c035e35cea 100644
--- a/src/app/qgsdecorationcopyright.cpp
+++ b/src/app/qgsdecorationcopyright.cpp
@@ -54,9 +54,6 @@ QgsDecorationCopyright::QgsDecorationCopyright( QObject* parent )
projectRead();
}
-QgsDecorationCopyright::~QgsDecorationCopyright()
-{}
-
void QgsDecorationCopyright::projectRead()
{
QgsDecorationItem::projectRead();
diff --git a/src/app/qgsdecorationcopyright.h b/src/app/qgsdecorationcopyright.h
index 55754c2b027..50093078a1b 100644
--- a/src/app/qgsdecorationcopyright.h
+++ b/src/app/qgsdecorationcopyright.h
@@ -24,6 +24,7 @@
#include
#include
#include
+#include "qgis_app.h"
class QAction;
class QPainter;
@@ -36,8 +37,6 @@ class APP_EXPORT QgsDecorationCopyright : public QgsDecorationItem
//! Constructor
QgsDecorationCopyright( QObject* parent = nullptr );
- //! Destructor
- virtual ~QgsDecorationCopyright();
public slots:
//! set values on the gui when a project is read or the gui first loaded
diff --git a/src/app/qgsdecorationcopyrightdialog.h b/src/app/qgsdecorationcopyrightdialog.h
index f36ceb6f43d..ea8d914598c 100644
--- a/src/app/qgsdecorationcopyrightdialog.h
+++ b/src/app/qgsdecorationcopyrightdialog.h
@@ -13,6 +13,7 @@
#define QGSCOPYRIGHTLABELPLUGINGUI_H
#include "ui_qgsdecorationcopyrightdialog.h"
+#include "qgis_app.h"
class QColor;
class QFont;
diff --git a/src/app/qgsdecorationgrid.h b/src/app/qgsdecorationgrid.h
index 692442b98db..4ee188b9e88 100644
--- a/src/app/qgsdecorationgrid.h
+++ b/src/app/qgsdecorationgrid.h
@@ -28,6 +28,7 @@ class QgsMarkerSymbol;
#include
#include
#include
+#include "qgis_app.h"
class APP_EXPORT QgsDecorationGrid: public QgsDecorationItem
{
@@ -35,7 +36,7 @@ class APP_EXPORT QgsDecorationGrid: public QgsDecorationItem
public:
//! Constructor
QgsDecorationGrid( QObject* parent = nullptr );
- //! Destructor
+
virtual ~ QgsDecorationGrid();
enum GridStyle
diff --git a/src/app/qgsdecorationgriddialog.h b/src/app/qgsdecorationgriddialog.h
index 6bcbc6028fa..bc5ccda9c19 100644
--- a/src/app/qgsdecorationgriddialog.h
+++ b/src/app/qgsdecorationgriddialog.h
@@ -20,6 +20,7 @@
#include "ui_qgsdecorationgriddialog.h"
#include
+#include "qgis_app.h"
class QgsDecorationGrid;
class QgsLineSymbol;
diff --git a/src/app/qgsdecorationitem.h b/src/app/qgsdecorationitem.h
index 9e6ea80473d..1b526c88dc9 100644
--- a/src/app/qgsdecorationitem.h
+++ b/src/app/qgsdecorationitem.h
@@ -20,6 +20,7 @@
#include
#include "qgsunittypes.h"
+#include "qgis_app.h"
class QPainter;
@@ -41,7 +42,7 @@ class APP_EXPORT QgsDecorationItem: public QObject
//! Constructor
QgsDecorationItem( QObject* parent = nullptr );
- //! Destructor
+
virtual ~ QgsDecorationItem();
void setEnabled( bool enabled ) { mEnabled = enabled; }
diff --git a/src/app/qgsdecorationnortharrow.h b/src/app/qgsdecorationnortharrow.h
index 0a1b934ab09..5e520fe1751 100644
--- a/src/app/qgsdecorationnortharrow.h
+++ b/src/app/qgsdecorationnortharrow.h
@@ -22,6 +22,7 @@
#include "qgsdecorationitem.h"
#include
+#include "qgis_app.h"
class QAction;
class QToolBar;
@@ -34,7 +35,7 @@ class APP_EXPORT QgsDecorationNorthArrow: public QgsDecorationItem
public:
//! Constructor
QgsDecorationNorthArrow( QObject* parent = nullptr );
- //! Destructor
+
virtual ~QgsDecorationNorthArrow();
public slots:
diff --git a/src/app/qgsdecorationnortharrowdialog.h b/src/app/qgsdecorationnortharrowdialog.h
index b989cc83249..73f1609c026 100644
--- a/src/app/qgsdecorationnortharrowdialog.h
+++ b/src/app/qgsdecorationnortharrowdialog.h
@@ -13,6 +13,7 @@
#define QGSNORTHARROWPLUGINGUI_H
#include "ui_qgsdecorationnortharrowdialog.h"
+#include "qgis_app.h"
class QgsDecorationNorthArrow;
diff --git a/src/app/qgsdecorationscalebar.h b/src/app/qgsdecorationscalebar.h
index 1121824d31a..2f1e3573c9a 100644
--- a/src/app/qgsdecorationscalebar.h
+++ b/src/app/qgsdecorationscalebar.h
@@ -27,6 +27,7 @@ email : sbr00pwb@users.sourceforge.net
class QPainter;
#include
+#include "qgis_app.h"
class APP_EXPORT QgsDecorationScaleBar: public QgsDecorationItem
{
@@ -34,7 +35,7 @@ class APP_EXPORT QgsDecorationScaleBar: public QgsDecorationItem
public:
//! Constructor
QgsDecorationScaleBar( QObject* parent = nullptr );
- //! Destructor
+
virtual ~ QgsDecorationScaleBar();
public slots:
diff --git a/src/app/qgsdecorationscalebardialog.h b/src/app/qgsdecorationscalebardialog.h
index c06c01a8427..7069adac9b8 100644
--- a/src/app/qgsdecorationscalebardialog.h
+++ b/src/app/qgsdecorationscalebardialog.h
@@ -14,6 +14,7 @@
#include "ui_qgsdecorationscalebardialog.h"
#include
+#include "qgis_app.h"
class QgsDecorationScaleBar;
diff --git a/src/app/qgsdelattrdialog.h b/src/app/qgsdelattrdialog.h
index b6ddf6ecfa8..188a73aed36 100644
--- a/src/app/qgsdelattrdialog.h
+++ b/src/app/qgsdelattrdialog.h
@@ -21,6 +21,7 @@
#include "ui_qgsdelattrdialogbase.h"
#include
#include
+#include "qgis_app.h"
class QgsVectorLayer;
diff --git a/src/app/qgsdiagramproperties.cpp b/src/app/qgsdiagramproperties.cpp
index 1edc9545a90..20904fabea6 100644
--- a/src/app/qgsdiagramproperties.cpp
+++ b/src/app/qgsdiagramproperties.cpp
@@ -47,7 +47,7 @@ QgsExpressionContext QgsDiagramProperties::createExpressionContext() const
{
QgsExpressionContext expContext;
expContext << QgsExpressionContextUtils::globalScope()
- << QgsExpressionContextUtils::projectScope()
+ << QgsExpressionContextUtils::projectScope( QgsProject::instance() )
<< QgsExpressionContextUtils::atlasScope( nullptr )
<< QgsExpressionContextUtils::mapSettingsScope( mMapCanvas->mapSettings() )
<< QgsExpressionContextUtils::layerScope( mLayer );
@@ -370,7 +370,7 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare
}
else
{
- mSizeFieldExpressionWidget->setField( mLayer->fields().at( lidr->classificationAttribute() ).name() );
+ mSizeFieldExpressionWidget->setField( lidr->classificationField() );
}
}
}
@@ -379,15 +379,15 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare
if ( dls )
{
mDiagramDistanceSpinBox->setValue( dls->distance() );
- mPrioritySlider->setValue( dls->getPriority() );
- mZIndexSpinBox->setValue( dls->getZIndex() );
+ mPrioritySlider->setValue( dls->priority() );
+ mZIndexSpinBox->setValue( dls->zIndex() );
mDataDefinedXComboBox->setCurrentIndex( mDataDefinedXComboBox->findData( dls->xPosColumn ) );
mDataDefinedYComboBox->setCurrentIndex( mDataDefinedYComboBox->findData( dls->yPosColumn ) );
if ( dls->xPosColumn != -1 || dls->yPosColumn != -1 )
{
mDataDefinedPositionGroupBox->setChecked( true );
}
- mPlacementComboBox->setCurrentIndex( mPlacementComboBox->findData( dls->getPlacement() ) );
+ mPlacementComboBox->setCurrentIndex( mPlacementComboBox->findData( dls->placement() ) );
chkLineAbove->setChecked( dls->linePlacementFlags() & QgsDiagramLayerSettings::AboveLine );
chkLineBelow->setChecked( dls->linePlacementFlags() & QgsDiagramLayerSettings::BelowLine );
@@ -571,7 +571,7 @@ void QgsDiagramProperties::on_mFindMaximumValueButton_clicked()
QgsExpression exp( sizeFieldNameOrExp );
QgsExpressionContext context;
context << QgsExpressionContextUtils::globalScope()
- << QgsExpressionContextUtils::projectScope()
+ << QgsExpressionContextUtils::projectScope( QgsProject::instance() )
<< QgsExpressionContextUtils::mapSettingsScope( mMapCanvas->mapSettings() )
<< QgsExpressionContextUtils::layerScope( mLayer );
@@ -801,8 +801,7 @@ void QgsDiagramProperties::apply()
}
else
{
- int attributeNumber = mLayer->fields().lookupField( sizeFieldNameOrExp );
- dr->setClassificationAttribute( attributeNumber );
+ dr->setClassificationField( sizeFieldNameOrExp );
}
dr->setDiagramSettings( ds );
renderer = dr;
@@ -838,7 +837,7 @@ void QgsDiagramProperties::apply()
}
dls.setPlacement(( QgsDiagramLayerSettings::Placement )mPlacementComboBox->currentData().toInt() );
- unsigned int flags = 0;
+ QgsDiagramLayerSettings::LinePlacementFlags flags = 0;
if ( chkLineAbove->isChecked() )
flags |= QgsDiagramLayerSettings::AboveLine;
if ( chkLineBelow->isChecked() )
@@ -860,7 +859,7 @@ QString QgsDiagramProperties::showExpressionBuilder( const QString& initialExpre
{
QgsExpressionContext context;
context << QgsExpressionContextUtils::globalScope()
- << QgsExpressionContextUtils::projectScope()
+ << QgsExpressionContextUtils::projectScope( QgsProject::instance() )
<< QgsExpressionContextUtils::atlasScope( nullptr )
<< QgsExpressionContextUtils::mapSettingsScope( mMapCanvas->mapSettings() )
<< QgsExpressionContextUtils::layerScope( mLayer );
diff --git a/src/app/qgsdiagramproperties.h b/src/app/qgsdiagramproperties.h
index 5bc297e0674..429a3b7c547 100644
--- a/src/app/qgsdiagramproperties.h
+++ b/src/app/qgsdiagramproperties.h
@@ -21,6 +21,7 @@
#include
#include
#include
+#include "qgis_app.h"
class QgsVectorLayer;
class QgsMapCanvas;
diff --git a/src/app/qgsdiscoverrelationsdlg.h b/src/app/qgsdiscoverrelationsdlg.h
index b890b524e12..ce9dbb69f13 100644
--- a/src/app/qgsdiscoverrelationsdlg.h
+++ b/src/app/qgsdiscoverrelationsdlg.h
@@ -18,6 +18,7 @@
#include
#include "ui_qgsdiscoverrelationsdlgbase.h"
#include "qgsrelation.h"
+#include "qgis_app.h"
class QgsRelationManager;
class QgsVectorLayer;
diff --git a/src/app/qgsdisplayangle.h b/src/app/qgsdisplayangle.h
index f0047a4b504..66e25bd0604 100644
--- a/src/app/qgsdisplayangle.h
+++ b/src/app/qgsdisplayangle.h
@@ -17,6 +17,7 @@
#define QGSDISPLAYANGLE_H
#include "ui_qgsdisplayanglebase.h"
+#include "qgis_app.h"
class QgsMapToolMeasureAngle;
diff --git a/src/app/qgsfeatureaction.h b/src/app/qgsfeatureaction.h
index 6f9688ad3bb..606a95a674c 100644
--- a/src/app/qgsfeatureaction.h
+++ b/src/app/qgsfeatureaction.h
@@ -23,6 +23,7 @@
#include
#include
#include
+#include "qgis_app.h"
class QgsIdentifyResultsDialog;
class QgsVectorLayer;
diff --git a/src/app/qgsfieldcalculator.cpp b/src/app/qgsfieldcalculator.cpp
index 3c5453ba8c4..012c3f9b684 100644
--- a/src/app/qgsfieldcalculator.cpp
+++ b/src/app/qgsfieldcalculator.cpp
@@ -39,10 +39,7 @@ QgsFieldCalculator::QgsFieldCalculator( QgsVectorLayer* vl, QWidget* parent )
return;
- QgsExpressionContext expContext;
- expContext << QgsExpressionContextUtils::globalScope()
- << QgsExpressionContextUtils::projectScope()
- << QgsExpressionContextUtils::layerScope( mVectorLayer );
+ QgsExpressionContext expContext( QgsExpressionContextUtils::globalProjectLayerScopes( mVectorLayer ) );
expContext.lastScope()->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "row_number" ), 1, true ) );
expContext.setHighlightedVariables( QStringList() << QStringLiteral( "row_number" ) );
@@ -168,10 +165,7 @@ void QgsFieldCalculator::accept()
exp.setDistanceUnits( QgsProject::instance()->distanceUnits() );
exp.setAreaUnits( QgsProject::instance()->areaUnits() );
- QgsExpressionContext expContext;
- expContext << QgsExpressionContextUtils::globalScope()
- << QgsExpressionContextUtils::projectScope()
- << QgsExpressionContextUtils::layerScope( mVectorLayer );
+ QgsExpressionContext expContext( QgsExpressionContextUtils::globalProjectLayerScopes( mVectorLayer ) );
if ( !exp.prepare( &expContext ) )
{
@@ -455,6 +449,7 @@ void QgsFieldCalculator::populateFields()
font.setItalic( true );
mExistingFieldComboBox->setItemData( mExistingFieldComboBox->count() - 1, font, Qt::FontRole );
}
+ mExistingFieldComboBox->setCurrentIndex( -1 );
}
void QgsFieldCalculator::setOkButtonState()
diff --git a/src/app/qgsfieldcalculator.h b/src/app/qgsfieldcalculator.h
index 54936d9d6f3..7a270f620a8 100644
--- a/src/app/qgsfieldcalculator.h
+++ b/src/app/qgsfieldcalculator.h
@@ -19,6 +19,7 @@
#include "ui_qgsfieldcalculatorbase.h"
#include "qgscontexthelp.h"
#include "qgsfields.h"
+#include "qgis_app.h"
class QgsVectorLayer;
diff --git a/src/app/qgsfieldsproperties.cpp b/src/app/qgsfieldsproperties.cpp
index 22f1eef3681..659ef9626db 100644
--- a/src/app/qgsfieldsproperties.cpp
+++ b/src/app/qgsfieldsproperties.cpp
@@ -841,7 +841,7 @@ void QgsFieldsProperties::updateExpression()
QgsExpressionContext context;
context << QgsExpressionContextUtils::globalScope()
- << QgsExpressionContextUtils::projectScope();
+ << QgsExpressionContextUtils::projectScope( QgsProject::instance() );
QgsExpressionBuilderDialog dlg( mLayer, exp, nullptr, QStringLiteral( "generic" ), context );
diff --git a/src/app/qgsfieldsproperties.h b/src/app/qgsfieldsproperties.h
index 5bcddab6a59..0cb075ee43c 100644
--- a/src/app/qgsfieldsproperties.h
+++ b/src/app/qgsfieldsproperties.h
@@ -26,6 +26,7 @@
#include "qgsvectorlayer.h"
#include "ui_qgsfieldspropertiesbase.h"
+#include "qgis_app.h"
class DesignerTree;
class DragList;
diff --git a/src/app/qgsformannotationdialog.h b/src/app/qgsformannotationdialog.h
index 8f8ff5854b2..114c9389437 100644
--- a/src/app/qgsformannotationdialog.h
+++ b/src/app/qgsformannotationdialog.h
@@ -16,6 +16,7 @@
#define QGSFORMANNOTATIONDIALOG_H
#include "ui_qgsformannotationdialogbase.h"
+#include "qgis_app.h"
class QgsAnnotationWidget;
class QgsFormAnnotationItem;
diff --git a/src/app/qgshandlebadlayers.cpp b/src/app/qgshandlebadlayers.cpp
index daf56b84dbe..42e70c48273 100644
--- a/src/app/qgshandlebadlayers.cpp
+++ b/src/app/qgshandlebadlayers.cpp
@@ -369,7 +369,7 @@ void QgsHandleBadLayers::apply()
QString datasource = item->text();
node.namedItem( QStringLiteral( "datasource" ) ).toElement().firstChild().toText().setData( datasource );
- if ( QgsProject::instance()->read( node ) )
+ if ( QgsProject::instance()->readLayer( node ) )
{
mLayerList->removeRow( i-- );
}
diff --git a/src/app/qgshandlebadlayers.h b/src/app/qgshandlebadlayers.h
index c2aeaed5643..f59f37b6365 100644
--- a/src/app/qgshandlebadlayers.h
+++ b/src/app/qgshandlebadlayers.h
@@ -20,6 +20,7 @@
#include "ui_qgshandlebadlayersbase.h"
#include "qgsproject.h"
#include "qgsprojectbadlayerhandler.h"
+#include "qgis_app.h"
class APP_EXPORT QgsHandleBadLayersHandler
: public QObject
diff --git a/src/app/qgshtmlannotationdialog.h b/src/app/qgshtmlannotationdialog.h
index d520cf9c2a1..eabb361335b 100644
--- a/src/app/qgshtmlannotationdialog.h
+++ b/src/app/qgshtmlannotationdialog.h
@@ -16,6 +16,7 @@
#define QgsHTMLAnnotationDialog_H
#include "ui_qgsformannotationdialogbase.h"
+#include "qgis_app.h"
class QgsAnnotationWidget;
class QgsHtmlAnnotationItem;
diff --git a/src/app/qgsidentifyresultsdialog.cpp b/src/app/qgsidentifyresultsdialog.cpp
index 04bea1b48a7..347cedc8e92 100644
--- a/src/app/qgsidentifyresultsdialog.cpp
+++ b/src/app/qgsidentifyresultsdialog.cpp
@@ -201,7 +201,7 @@ QgsWebView *QgsIdentifyResultsWebView::createWindow( QWebPage::WebWindowType typ
// loaded and contentsSizeChanged () is emitted.
//
// 3) If QgsIdentifyResultsWebView is resized (on page load) after it was inserted into
-// QTreeWidget, the row does not reflect that change automaticaly and
+// QTreeWidget, the row does not reflect that change automatically and
// consecutive resize of QTreeWidget will cause to shrink QgsIdentifyResultsWebView to the
// original row height. That is expected, Qt: "setItemWidget() should only
// be used to display static content... => we must not change QgsIdentifyResultsWebView
@@ -587,10 +587,7 @@ void QgsIdentifyResultsDialog::addFeature( QgsVectorLayer *vlayer, const QgsFeat
if ( !featureLabeled )
{
featItem->setText( 0, tr( "Title" ) );
- QgsExpressionContext context;
- context << QgsExpressionContextUtils::globalScope()
- << QgsExpressionContextUtils::projectScope()
- << QgsExpressionContextUtils::layerScope( vlayer );
+ QgsExpressionContext context( QgsExpressionContextUtils::globalProjectLayerScopes( vlayer ) );
context.setFeature( f );
QString value = QgsExpression( vlayer->displayExpression() ).evaluate( &context ).toString();
diff --git a/src/app/qgsidentifyresultsdialog.h b/src/app/qgsidentifyresultsdialog.h
index bc7cfac356e..3ecb79056b4 100644
--- a/src/app/qgsidentifyresultsdialog.h
+++ b/src/app/qgsidentifyresultsdialog.h
@@ -31,6 +31,7 @@
#include
#include
#include
+#include "qgis_app.h"
class QCloseEvent;
class QTreeWidgetItem;
@@ -110,11 +111,12 @@ class APP_EXPORT QgsIdentifyPlotCurve
QwtPlot* plot, const QString &title = QString(), QColor color = QColor() );
~QgsIdentifyPlotCurve();
+ QgsIdentifyPlotCurve( const QgsIdentifyPlotCurve& rh ) = delete;
+ QgsIdentifyPlotCurve& operator=( const QgsIdentifyPlotCurve& rh ) = delete;
+
private:
QwtPlotCurve* mPlotCurve;
- QgsIdentifyPlotCurve( const QgsIdentifyPlotCurve& rh );
- QgsIdentifyPlotCurve& operator=( const QgsIdentifyPlotCurve& rh );
};
class APP_EXPORT QgsIdentifyResultsDialog: public QDialog, private Ui::QgsIdentifyResultsBase
diff --git a/src/app/qgsjoindialog.h b/src/app/qgsjoindialog.h
index b80e3636c5b..0086535a13b 100644
--- a/src/app/qgsjoindialog.h
+++ b/src/app/qgsjoindialog.h
@@ -19,6 +19,7 @@
#define QgsJoinDIALOG_H
#include "ui_qgsjoindialogbase.h"
+#include "qgis_app.h"
class QgsVectorLayer;
struct QgsVectorJoinInfo;
diff --git a/src/app/qgslabelengineconfigdialog.h b/src/app/qgslabelengineconfigdialog.h
index 79d42a047ba..1705fe8d590 100644
--- a/src/app/qgslabelengineconfigdialog.h
+++ b/src/app/qgslabelengineconfigdialog.h
@@ -18,6 +18,7 @@
#include
#include "ui_qgsengineconfigdialog.h"
+#include "qgis_app.h"
class APP_EXPORT QgsLabelEngineConfigDialog : public QDialog, private Ui::QgsEngineConfigDialog
diff --git a/src/app/qgslabelinggui.cpp b/src/app/qgslabelinggui.cpp
index 3fbed4d5f90..a52bc44e3a5 100644
--- a/src/app/qgslabelinggui.cpp
+++ b/src/app/qgslabelinggui.cpp
@@ -26,7 +26,7 @@ QgsExpressionContext QgsLabelingGui::createExpressionContext() const
{
QgsExpressionContext expContext;
expContext << QgsExpressionContextUtils::globalScope()
- << QgsExpressionContextUtils::projectScope()
+ << QgsExpressionContextUtils::projectScope( QgsProject::instance() )
<< QgsExpressionContextUtils::atlasScope( nullptr )
<< QgsExpressionContextUtils::mapSettingsScope( QgisApp::instance()->mapCanvas()->mapSettings() );
diff --git a/src/app/qgslabelinggui.h b/src/app/qgslabelinggui.h
index a4671b1ed21..d5e745e54f3 100644
--- a/src/app/qgslabelinggui.h
+++ b/src/app/qgslabelinggui.h
@@ -20,6 +20,7 @@
#include "qgspallabeling.h"
#include "qgstextformatwidget.h"
+#include "qgis_app.h"
class APP_EXPORT QgsLabelingGui : public QgsTextFormatWidget, private QgsExpressionContextGenerator
{
diff --git a/src/app/qgslabelpropertydialog.cpp b/src/app/qgslabelpropertydialog.cpp
index 45fd2cfb45d..1e4617fadbc 100644
--- a/src/app/qgslabelpropertydialog.cpp
+++ b/src/app/qgslabelpropertydialog.cpp
@@ -223,7 +223,7 @@ void QgsLabelPropertyDialog::setDataDefinedValues( const QgsPalLayerSettings &la
QgsExpressionContext context;
context << QgsExpressionContextUtils::globalScope()
- << QgsExpressionContextUtils::projectScope()
+ << QgsExpressionContextUtils::projectScope( QgsProject::instance() )
<< QgsExpressionContextUtils::atlasScope( nullptr )
<< QgsExpressionContextUtils::mapSettingsScope( QgisApp::instance()->mapCanvas()->mapSettings() )
<< QgsExpressionContextUtils::layerScope( vlayer );
diff --git a/src/app/qgslabelpropertydialog.h b/src/app/qgslabelpropertydialog.h
index 2aa3279021c..45d227d570d 100644
--- a/src/app/qgslabelpropertydialog.h
+++ b/src/app/qgslabelpropertydialog.h
@@ -22,6 +22,7 @@
#include "qgsfeature.h"
#include "qgspallabeling.h"
#include
+#include "qgis_app.h"
//! A dialog to enter data defined label attributes
diff --git a/src/app/qgslayerstylingwidget.cpp b/src/app/qgslayerstylingwidget.cpp
index 19afa865ce6..7e22e63f8a4 100644
--- a/src/app/qgslayerstylingwidget.cpp
+++ b/src/app/qgslayerstylingwidget.cpp
@@ -241,7 +241,7 @@ void QgsLayerStylingWidget::apply()
{
widget->apply();
QgsVectorLayer* layer = qobject_cast( mCurrentLayer );
- QgsRendererAbstractMetadata* m = QgsRendererRegistry::instance()->rendererMetadata( layer->renderer()->type() );
+ QgsRendererAbstractMetadata* m = QgsApplication::rendererRegistry()->rendererMetadata( layer->renderer()->type() );
undoName = QStringLiteral( "Style Change - %1" ).arg( m->visibleName() );
styleWasChanged = true;
}
diff --git a/src/app/qgslayerstylingwidget.h b/src/app/qgslayerstylingwidget.h
index b16d2deee28..3273ae5bbfc 100644
--- a/src/app/qgslayerstylingwidget.h
+++ b/src/app/qgslayerstylingwidget.h
@@ -29,6 +29,7 @@
#include "ui_qgsmapstylingwidgetbase.h"
#include "qgsmaplayerconfigwidgetfactory.h"
+#include "qgis_app.h"
class QgsLabelingWidget;
class QgsMapLayer;
diff --git a/src/app/qgsloadstylefromdbdialog.h b/src/app/qgsloadstylefromdbdialog.h
index f81af253a2e..e5b20b12231 100644
--- a/src/app/qgsloadstylefromdbdialog.h
+++ b/src/app/qgsloadstylefromdbdialog.h
@@ -18,6 +18,7 @@
#include "ui_qgsloadstylefromdbdialog.h"
#include "qgisgui.h"
+#include "qgis_app.h"
class APP_EXPORT QgsLoadStyleFromDBDialog : public QDialog, private Ui::QgsLoadStyleFromDBDialogLayout
{
diff --git a/src/app/qgsmapthemes.cpp b/src/app/qgsmapthemes.cpp
index 179ba0654e0..1374cec68f3 100644
--- a/src/app/qgsmapthemes.cpp
+++ b/src/app/qgsmapthemes.cpp
@@ -42,6 +42,7 @@ QgsMapThemes::QgsMapThemes()
mMenu->addAction( QgisApp::instance()->actionHideAllLayers() );
mMenu->addAction( QgisApp::instance()->actionShowSelectedLayers() );
mMenu->addAction( QgisApp::instance()->actionHideSelectedLayers() );
+ mMenu->addAction( QgisApp::instance()->actionHideDeselectedLayers() );
mMenu->addSeparator();
mReplaceMenu = new QMenu( tr( "Replace Theme" ) );
diff --git a/src/app/qgsmapthemes.h b/src/app/qgsmapthemes.h
index c63ee065fef..5f0d7203e67 100644
--- a/src/app/qgsmapthemes.h
+++ b/src/app/qgsmapthemes.h
@@ -21,6 +21,7 @@
#include
#include
#include
+#include "qgis_app.h"
class QAction;
class QDomDocument;
diff --git a/src/app/qgsmaptooladdfeature.cpp b/src/app/qgsmaptooladdfeature.cpp
index af3de0da71a..298f77a993f 100644
--- a/src/app/qgsmaptooladdfeature.cpp
+++ b/src/app/qgsmaptooladdfeature.cpp
@@ -273,7 +273,7 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent* e )
delete g;
QgsGeometry featGeom = f->geometry();
- int avoidIntersectionsReturn = featGeom.avoidIntersections();
+ int avoidIntersectionsReturn = featGeom.avoidIntersections( QgsProject::instance()->avoidIntersectionsLayers() );
f->setGeometry( featGeom );
if ( avoidIntersectionsReturn == 1 )
{
@@ -295,17 +295,14 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent* e )
//use always topological editing for avoidIntersection.
//Otherwise, no way to guarantee the geometries don't have a small gap in between.
- QStringList intersectionLayers = QgsProject::instance()->avoidIntersectionsList();
+ QList intersectionLayers = QgsProject::instance()->avoidIntersectionsLayers();
bool avoidIntersection = !intersectionLayers.isEmpty();
if ( avoidIntersection ) //try to add topological points also to background layers
{
- QStringList::const_iterator lIt = intersectionLayers.constBegin();
- for ( ; lIt != intersectionLayers.constEnd(); ++lIt )
+ Q_FOREACH ( QgsVectorLayer* vl, intersectionLayers )
{
- QgsMapLayer* ml = QgsProject::instance()->mapLayer( *lIt );
- QgsVectorLayer* vl = qobject_cast( ml );
//can only add topological points if background layer is editable...
- if ( vl && vl->geometryType() == QgsWkbTypes::PolygonGeometry && vl->isEditable() )
+ if ( vl->geometryType() == QgsWkbTypes::PolygonGeometry && vl->isEditable() )
{
vl->addTopologicalPoints( f->geometry() );
}
diff --git a/src/app/qgsmaptooladdfeature.h b/src/app/qgsmaptooladdfeature.h
index 86c944aa329..ce5035bf987 100644
--- a/src/app/qgsmaptooladdfeature.h
+++ b/src/app/qgsmaptooladdfeature.h
@@ -14,6 +14,7 @@
***************************************************************************/
#include "qgsmaptoolcapture.h"
+#include "qgis_app.h"
//! This tool adds new point/line/polygon features to already existing vector layers
class APP_EXPORT QgsMapToolAddFeature : public QgsMapToolCapture
diff --git a/src/app/qgsmaptooladdpart.cpp b/src/app/qgsmaptooladdpart.cpp
index 7b65e40bdb5..adeb79da0d8 100644
--- a/src/app/qgsmaptooladdpart.cpp
+++ b/src/app/qgsmaptooladdpart.cpp
@@ -149,7 +149,7 @@ void QgsMapToolAddPart::cadCanvasReleaseEvent( QgsMapMouseEvent * e )
QgsCurvePolygon* cp = new QgsCurvePolygon();
cp->setExteriorRing( curveToAdd );
QgsGeometry* geom = new QgsGeometry( cp );
- geom->avoidIntersections();
+ geom->avoidIntersections( QgsProject::instance()->avoidIntersectionsLayers() );
const QgsCurvePolygon* cpGeom = dynamic_cast( geom->geometry() );
if ( !cpGeom )
diff --git a/src/app/qgsmaptooladdpart.h b/src/app/qgsmaptooladdpart.h
index c9af2e1923a..d935d3fb057 100644
--- a/src/app/qgsmaptooladdpart.h
+++ b/src/app/qgsmaptooladdpart.h
@@ -14,6 +14,7 @@
***************************************************************************/
#include "qgsmaptoolcapture.h"
+#include "qgis_app.h"
//! A map tool that adds new parts to multipart features
class APP_EXPORT QgsMapToolAddPart : public QgsMapToolCapture
diff --git a/src/app/qgsmaptooladdring.h b/src/app/qgsmaptooladdring.h
index 8a21c8a3e60..295138c110f 100644
--- a/src/app/qgsmaptooladdring.h
+++ b/src/app/qgsmaptooladdring.h
@@ -14,6 +14,7 @@
***************************************************************************/
#include "qgsmaptoolcapture.h"
+#include "qgis_app.h"
//! A tool to cut holes into polygons and multipolygon features
class APP_EXPORT QgsMapToolAddRing: public QgsMapToolCapture
diff --git a/src/app/qgsmaptoolannotation.h b/src/app/qgsmaptoolannotation.h
index d94632e8676..0d81dfbba7d 100644
--- a/src/app/qgsmaptoolannotation.h
+++ b/src/app/qgsmaptoolannotation.h
@@ -20,6 +20,7 @@
#include "qgsmaptool.h"
#include "qgsannotationitem.h"
+#include "qgis_app.h"
class APP_EXPORT QgsMapToolAnnotation: public QgsMapTool
{
diff --git a/src/app/qgsmaptoolchangelabelproperties.h b/src/app/qgsmaptoolchangelabelproperties.h
index e46e9a7567a..c8b1dce6eb7 100644
--- a/src/app/qgsmaptoolchangelabelproperties.h
+++ b/src/app/qgsmaptoolchangelabelproperties.h
@@ -19,6 +19,7 @@
#define QGSMAPTOOLCHANGELABELPROPERTIES_H
#include "qgsmaptoollabel.h"
+#include "qgis_app.h"
class APP_EXPORT QgsMapToolChangeLabelProperties: public QgsMapToolLabel
{
diff --git a/src/app/qgsmaptooldeletepart.h b/src/app/qgsmaptooldeletepart.h
index efbe76412d1..1feee8debc8 100644
--- a/src/app/qgsmaptooldeletepart.h
+++ b/src/app/qgsmaptooldeletepart.h
@@ -17,6 +17,7 @@
#define QGSMAPTOOLDELETEPART_H
#include "qgsmaptooledit.h"
+#include "qgis_app.h"
class QgsVertexMarker;
diff --git a/src/app/qgsmaptooldeletering.h b/src/app/qgsmaptooldeletering.h
index 9281069b116..ae2fc0f7512 100644
--- a/src/app/qgsmaptooldeletering.h
+++ b/src/app/qgsmaptooldeletering.h
@@ -17,6 +17,7 @@
#define QGSMAPTOOLDELETERING_H
#include "qgsmaptooledit.h"
+#include "qgis_app.h"
class QgsVertexMarker;
//! Map tool to delete vertices from line/polygon features
diff --git a/src/app/qgsmaptoolfeatureaction.cpp b/src/app/qgsmaptoolfeatureaction.cpp
index 0337f347dfd..a0dc4c6ad6c 100644
--- a/src/app/qgsmaptoolfeatureaction.cpp
+++ b/src/app/qgsmaptoolfeatureaction.cpp
@@ -134,7 +134,7 @@ bool QgsMapToolFeatureAction::doAction( QgsVectorLayer *layer, int x, int y )
// define custom substitutions: layer id and clicked coords
QgsExpressionContext context;
context << QgsExpressionContextUtils::globalScope()
- << QgsExpressionContextUtils::projectScope()
+ << QgsExpressionContextUtils::projectScope( QgsProject::instance() )
<< QgsExpressionContextUtils::mapSettingsScope( mCanvas->mapSettings() );
QgsExpressionContextScope* actionScope = new QgsExpressionContextScope();
actionScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "click_x" ), point.x(), true ) );
diff --git a/src/app/qgsmaptoolfeatureaction.h b/src/app/qgsmaptoolfeatureaction.h
index 385e02b2139..377e486e96e 100644
--- a/src/app/qgsmaptoolfeatureaction.h
+++ b/src/app/qgsmaptoolfeatureaction.h
@@ -21,6 +21,7 @@
#include
#include
+#include "qgis_app.h"
class QgsVectorLayer;
diff --git a/src/app/qgsmaptoolfillring.h b/src/app/qgsmaptoolfillring.h
index afe01c488ce..3cdf9c36d50 100644
--- a/src/app/qgsmaptoolfillring.h
+++ b/src/app/qgsmaptoolfillring.h
@@ -15,6 +15,7 @@
***************************************************************************/
#include "qgsmaptoolcapture.h"
+#include "qgis_app.h"
/** A tool to cut holes into polygon and multipolygon features and fill them
* with new feature. Attributes are copied from parent feature.
diff --git a/src/app/qgsmaptoolformannotation.h b/src/app/qgsmaptoolformannotation.h
index f7c4dda6aa7..43934c5bbc5 100644
--- a/src/app/qgsmaptoolformannotation.h
+++ b/src/app/qgsmaptoolformannotation.h
@@ -19,6 +19,7 @@
#define QGSMAPTOOFORMANNOTATION_H
#include "qgsmaptoolannotation.h"
+#include "qgis_app.h"
class APP_EXPORT QgsMapToolFormAnnotation: public QgsMapToolAnnotation
{
diff --git a/src/app/qgsmaptoolhtmlannotation.h b/src/app/qgsmaptoolhtmlannotation.h
index 6f2e465c172..573d53f1c1c 100644
--- a/src/app/qgsmaptoolhtmlannotation.h
+++ b/src/app/qgsmaptoolhtmlannotation.h
@@ -19,6 +19,7 @@
#define QGSMAPTOOLHTMLANNOTATION_H
#include "qgsmaptoolannotation.h"
+#include "qgis_app.h"
class APP_EXPORT QgsMapToolHtmlAnnotation: public QgsMapToolAnnotation
{
diff --git a/src/app/qgsmaptoolidentifyaction.h b/src/app/qgsmaptoolidentifyaction.h
index 8507891f16c..33bbf4c166b 100644
--- a/src/app/qgsmaptoolidentifyaction.h
+++ b/src/app/qgsmaptoolidentifyaction.h
@@ -21,6 +21,7 @@
#include
#include
+#include "qgis_app.h"
class QgsIdentifyResultsDialog;
class QgsMapLayer;
diff --git a/src/app/qgsmaptoollabel.h b/src/app/qgsmaptoollabel.h
index 21921acdf18..d7998503d69 100644
--- a/src/app/qgsmaptoollabel.h
+++ b/src/app/qgsmaptoollabel.h
@@ -20,6 +20,7 @@
#include "qgsmaptool.h"
#include "qgspallabeling.h"
+#include "qgis_app.h"
class QgsRubberBand;
diff --git a/src/app/qgsmaptoolmeasureangle.h b/src/app/qgsmaptoolmeasureangle.h
index 2b1acd53e40..621872ccc44 100644
--- a/src/app/qgsmaptoolmeasureangle.h
+++ b/src/app/qgsmaptoolmeasureangle.h
@@ -19,6 +19,7 @@
#include "qgsmaptool.h"
#include "qgspoint.h"
#include "qgsdistancearea.h"
+#include "qgis_app.h"
class QgsDisplayAngle;
class QgsRubberBand;
diff --git a/src/app/qgsmaptoolmovefeature.h b/src/app/qgsmaptoolmovefeature.h
index eda9c22712e..bc68abd755c 100644
--- a/src/app/qgsmaptoolmovefeature.h
+++ b/src/app/qgsmaptoolmovefeature.h
@@ -17,6 +17,7 @@
#define QGSMAPTOOLMOVEFEATURE_H
#include "qgsmaptooladvanceddigitizing.h"
+#include "qgis_app.h"
//! Map tool for translating feature position by mouse drag
class APP_EXPORT QgsMapToolMoveFeature: public QgsMapToolAdvancedDigitizing
diff --git a/src/app/qgsmaptoolmovelabel.h b/src/app/qgsmaptoolmovelabel.h
index 464eb99c4ad..58d072fbedf 100644
--- a/src/app/qgsmaptoolmovelabel.h
+++ b/src/app/qgsmaptoolmovelabel.h
@@ -19,6 +19,7 @@
#define QGSMAPTOOLMOVELABEL_H
#include "qgsmaptoollabel.h"
+#include "qgis_app.h"
//! A map tool for dragging label positions
class APP_EXPORT QgsMapToolMoveLabel: public QgsMapToolLabel
diff --git a/src/app/qgsmaptooloffsetcurve.h b/src/app/qgsmaptooloffsetcurve.h
index d3b685f021b..29b21215876 100644
--- a/src/app/qgsmaptooloffsetcurve.h
+++ b/src/app/qgsmaptooloffsetcurve.h
@@ -18,6 +18,7 @@
#include "qgsmaptooledit.h"
#include "qgsgeometry.h"
+#include "qgis_app.h"
class QgsVertexMarker;
class QgsDoubleSpinBox;
diff --git a/src/app/qgsmaptooloffsetpointsymbol.h b/src/app/qgsmaptooloffsetpointsymbol.h
index 62dfa8e6492..2cab37b5042 100644
--- a/src/app/qgsmaptooloffsetpointsymbol.h
+++ b/src/app/qgsmaptooloffsetpointsymbol.h
@@ -18,6 +18,7 @@
#include "qgsmaptoolpointsymbol.h"
#include "qgssymbol.h"
+#include "qgis_app.h"
class QgsMarkerSymbol;
class QgsPointMarkerItem;
diff --git a/src/app/qgsmaptoolpinlabels.h b/src/app/qgsmaptoolpinlabels.h
index 3a4e4120a5d..b0729a87c89 100644
--- a/src/app/qgsmaptoolpinlabels.h
+++ b/src/app/qgsmaptoolpinlabels.h
@@ -19,6 +19,7 @@
#define QGSMAPTOOLPINLABELS_H
#include "qgsmaptoollabel.h"
+#include "qgis_app.h"
class QgsRubberBand;
class QgsLabelPosition;
diff --git a/src/app/qgsmaptoolpointsymbol.h b/src/app/qgsmaptoolpointsymbol.h
index 8ac68288965..6c6855d2bbc 100644
--- a/src/app/qgsmaptoolpointsymbol.h
+++ b/src/app/qgsmaptoolpointsymbol.h
@@ -18,6 +18,7 @@
#include "qgsmaptooledit.h"
#include "qgsfeature.h"
+#include "qgis_app.h"
class QgsMarkerSymbol;
diff --git a/src/app/qgsmaptoolreshape.cpp b/src/app/qgsmaptoolreshape.cpp
index af02b8bce62..ca1733868d6 100644
--- a/src/app/qgsmaptoolreshape.cpp
+++ b/src/app/qgsmaptoolreshape.cpp
@@ -17,6 +17,7 @@
#include "qgsfeatureiterator.h"
#include "qgsgeometry.h"
#include "qgsmapcanvas.h"
+#include "qgsproject.h"
#include "qgsvectorlayer.h"
#include "qgisapp.h"
@@ -108,7 +109,7 @@ void QgsMapToolReshape::cadCanvasReleaseEvent( QgsMapMouseEvent * e )
QHash > ignoreFeatures;
ignoreFeatures.insert( vlayer, vlayer->allFeatureIds() );
- if ( geom.avoidIntersections( ignoreFeatures ) != 0 )
+ if ( geom.avoidIntersections( QgsProject::instance()->avoidIntersectionsLayers(), ignoreFeatures ) != 0 )
{
emit messageEmitted( tr( "An error was reported during intersection removal" ), QgsMessageBar::CRITICAL );
vlayer->destroyEditCommand();
diff --git a/src/app/qgsmaptoolreshape.h b/src/app/qgsmaptoolreshape.h
index e0d0ebc1212..8ea0f309169 100644
--- a/src/app/qgsmaptoolreshape.h
+++ b/src/app/qgsmaptoolreshape.h
@@ -17,6 +17,7 @@
#define QGSMAPTOOLRESHAPE_H
#include "qgsmaptoolcapture.h"
+#include "qgis_app.h"
//! A map tool that draws a line and splits the features cut by the line
class APP_EXPORT QgsMapToolReshape: public QgsMapToolCapture
diff --git a/src/app/qgsmaptoolrotatefeature.h b/src/app/qgsmaptoolrotatefeature.h
index 19c479bb667..1b99fcfcda1 100644
--- a/src/app/qgsmaptoolrotatefeature.h
+++ b/src/app/qgsmaptoolrotatefeature.h
@@ -19,6 +19,7 @@
#include
#include "qgsmaptooledit.h"
+#include "qgis_app.h"
class QgsDoubleSpinBox;
class QHBoxLayout;
diff --git a/src/app/qgsmaptoolrotatelabel.h b/src/app/qgsmaptoolrotatelabel.h
index 06af32172b4..b61a7506a02 100644
--- a/src/app/qgsmaptoolrotatelabel.h
+++ b/src/app/qgsmaptoolrotatelabel.h
@@ -19,6 +19,7 @@
#define QGSMAPTOOLROTATELABEL_H
#include "qgsmaptoollabel.h"
+#include "qgis_app.h"
class QgsPointRotationItem;
class APP_EXPORT QgsMapToolRotateLabel: public QgsMapToolLabel
diff --git a/src/app/qgsmaptoolrotatepointsymbols.h b/src/app/qgsmaptoolrotatepointsymbols.h
index 087cccc1ca5..dfb0ea6439b 100644
--- a/src/app/qgsmaptoolrotatepointsymbols.h
+++ b/src/app/qgsmaptoolrotatepointsymbols.h
@@ -17,6 +17,7 @@
#define QGSMAPTOOLROTATEPOINTSYMBOLS_H
#include "qgsmaptoolpointsymbol.h"
+#include "qgis_app.h"
class QgsPointRotationItem;
class QgsMarkerSymbol;
diff --git a/src/app/qgsmaptoolselect.h b/src/app/qgsmaptoolselect.h
index e3cb869ff8e..aad655bf10a 100644
--- a/src/app/qgsmaptoolselect.h
+++ b/src/app/qgsmaptoolselect.h
@@ -17,6 +17,7 @@
#define QGSMAPTOOLSELECT_H
#include "qgsmaptool.h"
+#include "qgis_app.h"
class QgsMapCanvas;
class QMouseEvent;
diff --git a/src/app/qgsmaptoolselectfreehand.h b/src/app/qgsmaptoolselectfreehand.h
index 45776865c75..5cddce45bf8 100644
--- a/src/app/qgsmaptoolselectfreehand.h
+++ b/src/app/qgsmaptoolselectfreehand.h
@@ -17,6 +17,7 @@
#define QGSMAPTOOLSELECTFREEHAND_H
#include "qgsmaptool.h"
+#include "qgis_app.h"
class QgsMapCanvas;
class QgsRubberBand;
diff --git a/src/app/qgsmaptoolselectpolygon.h b/src/app/qgsmaptoolselectpolygon.h
index 0ef804427f4..d0415fe893f 100644
--- a/src/app/qgsmaptoolselectpolygon.h
+++ b/src/app/qgsmaptoolselectpolygon.h
@@ -17,6 +17,7 @@ email : jpalmer at linz dot govt dot nz
#define QGSMAPTOOLSELECTPOLYGON_H
#include "qgsmaptool.h"
+#include "qgis_app.h"
class QgsMapCanvas;
class QgsRubberBand;
diff --git a/src/app/qgsmaptoolselectradius.h b/src/app/qgsmaptoolselectradius.h
index fa0fb1f59ad..61f101865c8 100644
--- a/src/app/qgsmaptoolselectradius.h
+++ b/src/app/qgsmaptoolselectradius.h
@@ -19,6 +19,7 @@ email : jpalmer at linz dot govt dot nz
#include "qgsmaptool.h"
#include "qgspoint.h"
+#include "qgis_app.h"
class QgsMapCanvas;
class QgsRubberBand;
diff --git a/src/app/qgsmaptoolselectrectangle.h b/src/app/qgsmaptoolselectrectangle.h
index 269fc4868d9..cfc35096100 100644
--- a/src/app/qgsmaptoolselectrectangle.h
+++ b/src/app/qgsmaptoolselectrectangle.h
@@ -19,6 +19,7 @@
#include
#include "qgsmaptool.h"
+#include "qgis_app.h"
class QPoint;
class QMouseEvent;
diff --git a/src/app/qgsmaptoolshowhidelabels.h b/src/app/qgsmaptoolshowhidelabels.h
index 25cc468d8a0..0677d38c04f 100644
--- a/src/app/qgsmaptoolshowhidelabels.h
+++ b/src/app/qgsmaptoolshowhidelabels.h
@@ -20,6 +20,7 @@
#include "qgsmaptoollabel.h"
#include "qgsfeature.h"
+#include "qgis_app.h"
//! A map tool for showing or hidding a feature's label
diff --git a/src/app/qgsmaptoolsimplify.h b/src/app/qgsmaptoolsimplify.h
index d3b83c6382a..96ae196699e 100644
--- a/src/app/qgsmaptoolsimplify.h
+++ b/src/app/qgsmaptoolsimplify.h
@@ -22,6 +22,7 @@
#include
#include "qgsfeature.h"
#include "qgstolerance.h"
+#include "qgis_app.h"
class QgsRubberBand;
class QgsMapToolSimplify;
diff --git a/src/app/qgsmaptoolsplitfeatures.h b/src/app/qgsmaptoolsplitfeatures.h
index 249df5a6562..1d528acd4a5 100644
--- a/src/app/qgsmaptoolsplitfeatures.h
+++ b/src/app/qgsmaptoolsplitfeatures.h
@@ -17,6 +17,7 @@
#define QGSMAPTOOLSPLITFEATURES_H
#include "qgsmaptoolcapture.h"
+#include "qgis_app.h"
//! A map tool that draws a line and splits the features cut by the line
class APP_EXPORT QgsMapToolSplitFeatures: public QgsMapToolCapture
diff --git a/src/app/qgsmaptoolsvgannotation.h b/src/app/qgsmaptoolsvgannotation.h
index 061a72ad2de..2e5103f4485 100644
--- a/src/app/qgsmaptoolsvgannotation.h
+++ b/src/app/qgsmaptoolsvgannotation.h
@@ -19,6 +19,7 @@
#define QGSMAPTOOLSVGANNOTATION_H
#include "qgsmaptoolannotation.h"
+#include "qgis_app.h"
class APP_EXPORT QgsMapToolSvgAnnotation: public QgsMapToolAnnotation
{
diff --git a/src/app/qgsmaptooltextannotation.h b/src/app/qgsmaptooltextannotation.h
index 6f485dc21fd..27fb66109e9 100644
--- a/src/app/qgsmaptooltextannotation.h
+++ b/src/app/qgsmaptooltextannotation.h
@@ -19,6 +19,7 @@
#define QGSMAPTOOLTEXTANNOTATION_H
#include "qgsmaptoolannotation.h"
+#include "qgis_app.h"
class APP_EXPORT QgsMapToolTextAnnotation: public QgsMapToolAnnotation
{
diff --git a/src/app/qgsmeasuredialog.cpp b/src/app/qgsmeasuredialog.cpp
index 361af14f3d7..332efd68613 100644
--- a/src/app/qgsmeasuredialog.cpp
+++ b/src/app/qgsmeasuredialog.cpp
@@ -348,7 +348,7 @@ void QgsMeasureDialog::updateUi()
QgsUnitTypes::unitType( mAreaUnits ) == QgsUnitTypes::Standard )
{
// only shown if both conditions are true:
- // - the display unit is a standard distance measurement (eg square feet)
+ // - the display unit is a standard distance measurement (e.g., square feet)
// - either the canvas units is also a standard distance OR we are using an ellipsoid (in which case the
// value will be in square meters)
toolTip += " * " + tr( "The value is converted from %1 to %2." ).arg( QgsUnitTypes::toString( resultUnit ),
@@ -422,7 +422,7 @@ void QgsMeasureDialog::updateUi()
QgsUnitTypes::unitType( mDistanceUnits ) == QgsUnitTypes::Standard )
{
// only shown if both conditions are true:
- // - the display unit is a standard distance measurement (eg feet)
+ // - the display unit is a standard distance measurement (e.g., feet)
// - either the canvas units is also a standard distance OR we are using an ellipsoid (in which case the
// value will be in meters)
toolTip += " * " + tr( "The value is converted from %1 to %2." ).arg( QgsUnitTypes::toString( resultUnit ),
diff --git a/src/app/qgsmeasuredialog.h b/src/app/qgsmeasuredialog.h
index 0cbc2684b08..620aeecc7f9 100644
--- a/src/app/qgsmeasuredialog.h
+++ b/src/app/qgsmeasuredialog.h
@@ -22,6 +22,7 @@
#include "qgspoint.h"
#include "qgsdistancearea.h"
#include "qgscontexthelp.h"
+#include "qgis_app.h"
class QCloseEvent;
class QgsMeasureTool;
diff --git a/src/app/qgsmeasuretool.h b/src/app/qgsmeasuretool.h
index ca35cb8bd06..4f31922462b 100644
--- a/src/app/qgsmeasuretool.h
+++ b/src/app/qgsmeasuretool.h
@@ -18,6 +18,7 @@
#define QGSMEASURETOOL_H
#include "qgsmaptool.h"
+#include "qgis_app.h"
class QgsDistanceArea;
class QgsMapCanvas;
diff --git a/src/app/qgsmergeattributesdialog.cpp b/src/app/qgsmergeattributesdialog.cpp
index 23b4d21cd3d..c8a80c81103 100644
--- a/src/app/qgsmergeattributesdialog.cpp
+++ b/src/app/qgsmergeattributesdialog.cpp
@@ -367,7 +367,8 @@ QVariant QgsMergeAttributesDialog::calcStatistic( int col, QgsStatisticalSummary
summary.calculate( values );
- return QVariant::fromValue( summary.statistic( stat ) );
+ double val = summary.statistic( stat );
+ return qIsNaN( val ) ? QVariant( QVariant::Double ) : val;
}
QVariant QgsMergeAttributesDialog::concatenationAttribute( int col )
diff --git a/src/app/qgsmergeattributesdialog.h b/src/app/qgsmergeattributesdialog.h
index 82338ee8903..7d79d26d364 100644
--- a/src/app/qgsmergeattributesdialog.h
+++ b/src/app/qgsmergeattributesdialog.h
@@ -23,6 +23,7 @@
#include "qgsfeature.h"
#include "qgsstatisticalsummary.h"
#include "qgsfields.h"
+#include "qgis_app.h"
class QgsMapCanvas;
class QgsRubberBand;
@@ -47,7 +48,7 @@ class APP_EXPORT QgsMergeAttributesDialog: public QDialog, private Ui::QgsMergeA
QgsAttributes mergedAttributes() const;
- /** Returns a list of attribute indexes which should be skipped when merging (eg, attributes
+ /** Returns a list of attribute indexes which should be skipped when merging (e.g., attributes
* which have been set to "skip"
*/
QSet skippedAttributeIndexes() const;
diff --git a/src/app/qgsnewspatialitelayerdialog.h b/src/app/qgsnewspatialitelayerdialog.h
index d1f6dacf3c0..8417b90aa8b 100644
--- a/src/app/qgsnewspatialitelayerdialog.h
+++ b/src/app/qgsnewspatialitelayerdialog.h
@@ -27,6 +27,7 @@ extern "C"
{
#include
#include
+#include "qgis_app.h"
}
class APP_EXPORT QgsNewSpatialiteLayerDialog: public QDialog, private Ui::QgsNewSpatialiteLayerDialogBase
diff --git a/src/app/qgsoptions.cpp b/src/app/qgsoptions.cpp
index 82a223b44f4..2eb9668427f 100644
--- a/src/app/qgsoptions.cpp
+++ b/src/app/qgsoptions.cpp
@@ -138,7 +138,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
mRemoveCustomVarBtn->setEnabled( false );
mCustomVariablesTable->setEnabled( false );
}
- QStringList customVarsList = mSettings->value( QStringLiteral( "qgis/customEnvVars" ), "" ).toStringList();
+ QStringList customVarsList = mSettings->value( QStringLiteral( "qgis/customEnvVars" ) ).toStringList();
Q_FOREACH ( const QString &varStr, customVarsList )
{
int pos = varStr.indexOf( QLatin1Char( '|' ) );
@@ -221,25 +221,20 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
mCurrentVariablesTable->resizeColumnToContents( 0 );
//local directories to search when loading c++ plugins
- QString myPaths = mSettings->value( QStringLiteral( "plugins/searchPathsForPlugins" ), "" ).toString();
- if ( !myPaths.isEmpty() )
+ QStringList pathList = mSettings->value( QStringLiteral( "plugins/searchPathsForPlugins" ) ).toStringList();
+ Q_FOREACH ( const QString& path, pathList )
{
- QStringList myPathList = myPaths.split( '|' );
- QStringList::const_iterator pathIt = myPathList.constBegin();
- for ( ; pathIt != myPathList.constEnd(); ++pathIt )
- {
- QListWidgetItem* newItem = new QListWidgetItem( mListPluginPaths );
- newItem->setText( *pathIt );
- newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
- mListPluginPaths->addItem( newItem );
- }
+ QListWidgetItem* newItem = new QListWidgetItem( mListPluginPaths );
+ newItem->setText( path );
+ newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
+ mListPluginPaths->addItem( newItem );
}
//local directories to search when looking for an SVG with a given basename
- QStringList svgPaths = QgsApplication::svgPaths();
- if ( !svgPaths.isEmpty() )
+ pathList = QgsApplication::svgPaths();
+ if ( !pathList.isEmpty() )
{
- Q_FOREACH ( const QString& path, svgPaths )
+ Q_FOREACH ( const QString& path, pathList )
{
QListWidgetItem* newItem = new QListWidgetItem( mListSVGPaths );
newItem->setText( path );
@@ -248,10 +243,11 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
}
}
- QStringList templatePaths = QgsApplication::composerTemplatePaths();
- if ( !templatePaths.isEmpty() )
+ //local directories to search when looking for a composer templates
+ pathList = QgsApplication::composerTemplatePaths();
+ if ( !pathList.isEmpty() )
{
- Q_FOREACH ( const QString& path, templatePaths )
+ Q_FOREACH ( const QString& path, pathList )
{
QListWidgetItem* newItem = new QListWidgetItem( mListComposerTemplatePaths );
newItem->setText( path );
@@ -260,13 +256,12 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
}
}
- QStringList hiddenItems = mSettings->value( QStringLiteral( "/browser/hiddenPaths" ),
- QStringList() ).toStringList();
- QStringList::const_iterator pathIt = hiddenItems.constBegin();
- for ( ; pathIt != hiddenItems.constEnd(); ++pathIt )
+ //paths hidden from browser
+ pathList = mSettings->value( QStringLiteral( "/browser/hiddenPaths" ) ).toStringList();
+ Q_FOREACH ( const QString& path, pathList )
{
QListWidgetItem* newItem = new QListWidgetItem( mListHiddenBrowserPaths );
- newItem->setText( *pathIt );
+ newItem->setText( path );
mListHiddenBrowserPaths->addItem( newItem );
}
@@ -300,18 +295,13 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
mProxyTypeComboBox->setCurrentIndex( mProxyTypeComboBox->findText( settingProxyType ) );
//URLs excluded not going through proxies
- QString proxyExcludedURLs = mSettings->value( QStringLiteral( "proxy/proxyExcludedUrls" ), "" ).toString();
- if ( !proxyExcludedURLs.isEmpty() )
+ pathList = mSettings->value( QStringLiteral( "proxy/proxyExcludedUrls" ) ).toStringList();
+ Q_FOREACH ( const QString& path, pathList )
{
- QStringList splitUrls = proxyExcludedURLs.split( '|' );
- QStringList::const_iterator urlIt = splitUrls.constBegin();
- for ( ; urlIt != splitUrls.constEnd(); ++urlIt )
- {
- QListWidgetItem* newItem = new QListWidgetItem( mExcludeUrlListWidget );
- newItem->setText( *urlIt );
- newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
- mExcludeUrlListWidget->addItem( newItem );
- }
+ QListWidgetItem* newItem = new QListWidgetItem( mExcludeUrlListWidget );
+ newItem->setText( path );
+ newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
+ mExcludeUrlListWidget->addItem( newItem );
}
// cache settings
@@ -703,7 +693,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
pbnMeasureColor->setContext( QStringLiteral( "gui" ) );
pbnMeasureColor->setDefaultColor( QColor( 222, 155, 67 ) );
- capitaliseCheckBox->setChecked( mSettings->value( QStringLiteral( "/qgis/capitaliseLayerName" ), QVariant( false ) ).toBool() );
+ capitalizeCheckBox->setChecked( mSettings->value( QStringLiteral( "/qgis/capitalizeLayerName" ), QVariant( false ) ).toBool() );
int projOpen = mSettings->value( QStringLiteral( "/qgis/projOpenAtLaunch" ), 0 ).toInt();
mProjectOnLaunchCmbBx->setCurrentIndex( projOpen );
@@ -731,7 +721,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
spinZoomFactor->setValue( mSettings->value( QStringLiteral( "/qgis/zoom_factor" ), 2 ).toDouble() );
// predefined scales for scale combobox
- myPaths = mSettings->value( QStringLiteral( "Map/scales" ), PROJECT_SCALES ).toString();
+ QString myPaths = mSettings->value( QStringLiteral( "Map/scales" ), PROJECT_SCALES ).toString();
if ( !myPaths.isEmpty() )
{
QStringList myScalesList = myPaths.split( ',' );
@@ -753,7 +743,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
//find custom color scheme from registry
QList customSchemes;
- QgsColorSchemeRegistry::instance()->schemes( customSchemes );
+ QgsApplication::colorSchemeRegistry()->schemes( customSchemes );
if ( customSchemes.length() > 0 )
{
mTreeCustomColors->setScheme( customSchemes.at( 0 ) );
@@ -826,7 +816,9 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
QStringList myI18nList = i18nList();
Q_FOREACH ( const QString& l, myI18nList )
{
- cboLocale->addItem( QIcon( QString( ":/images/flags/%1.png" ).arg( l ) ), QLocale( l ).nativeLanguageName(), l );
+ // QTBUG-57802: eo locale is improperly handled
+ QString displayName = l.startsWith( QLatin1String( "eo" ) ) ? QLocale::languageToString( QLocale::Esperanto ) : QLocale( l ).nativeLanguageName();
+ cboLocale->addItem( QIcon( QString( ":/images/flags/%1.png" ).arg( l ) ), displayName, l );
}
cboLocale->setCurrentIndex( cboLocale->findData( myUserLocale ) );
bool myLocaleOverrideFlag = mSettings->value( QStringLiteral( "locale/overrideFlag" ), false ).toBool();
@@ -937,15 +929,13 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
mVariableEditor->reloadContext();
mVariableEditor->setEditableScopeIndex( 0 );
-
-
mAdvancedSettingsEditor->setSettingsObject( mSettings );
// restore window and widget geometry/state
restoreOptionsBaseUi();
}
-//! Destructor
+
QgsOptions::~QgsOptions()
{
delete mSettings;
@@ -987,7 +977,7 @@ void QgsOptions::on_cbxProjectDefaultNew_toggled( bool checked )
void QgsOptions::on_pbnProjectDefaultSetCurrent_clicked()
{
QString fileName = QgsApplication::qgisSettingsDirPath() + QStringLiteral( "project_default.qgs" );
- if ( QgsProject::instance()->write( QFileInfo( fileName ) ) )
+ if ( QgsProject::instance()->write( fileName ) )
{
QMessageBox::information( nullptr, tr( "Save default project" ), tr( "Current project saved as default" ) );
}
@@ -1081,46 +1071,34 @@ void QgsOptions::saveOptions()
mSettings->setValue( QStringLiteral( "qgis/customEnvVars" ), QVariant( customVars ) );
//search directories for user plugins
- QString myPaths;
+ QStringList pathsList;
for ( int i = 0; i < mListPluginPaths->count(); ++i )
{
- if ( i != 0 )
- {
- myPaths += '|';
- }
- myPaths += mListPluginPaths->item( i )->text();
+ pathsList << mListPluginPaths->item( i )->text();
}
- mSettings->setValue( QStringLiteral( "plugins/searchPathsForPlugins" ), myPaths );
+ mSettings->setValue( QStringLiteral( "help/helpSearchPath" ), pathsList );
//search directories for svgs
- myPaths.clear();
+ pathsList.clear();
for ( int i = 0; i < mListSVGPaths->count(); ++i )
{
- if ( i != 0 )
- {
- myPaths += '|';
- }
- myPaths += mListSVGPaths->item( i )->text();
+ pathsList << mListSVGPaths->item( i )->text();
}
- mSettings->setValue( QStringLiteral( "svg/searchPathsForSVG" ), myPaths );
+ mSettings->setValue( QStringLiteral( "svg/searchPathsForSVG" ), pathsList );
- myPaths.clear();
+ pathsList.clear();
for ( int i = 0; i < mListComposerTemplatePaths->count(); ++i )
{
- if ( i != 0 )
- {
- myPaths += '|';
- }
- myPaths += mListComposerTemplatePaths->item( i )->text();
+ pathsList << mListComposerTemplatePaths->item( i )->text();
}
- mSettings->setValue( QStringLiteral( "composer/searchPathsForTemplates" ), myPaths );
+ mSettings->setValue( QStringLiteral( "composer/searchPathsForTemplates" ), pathsList );
- QStringList paths;
+ pathsList.clear();
for ( int i = 0; i < mListHiddenBrowserPaths->count(); ++i )
{
- paths << mListHiddenBrowserPaths->item( i )->text();
+ pathsList << mListHiddenBrowserPaths->item( i )->text();
}
- mSettings->setValue( QStringLiteral( "/browser/hiddenPaths" ), paths );
+ mSettings->setValue( QStringLiteral( "/browser/hiddenPaths" ), pathsList );
//Network timeout
mSettings->setValue( QStringLiteral( "/qgis/networkAndProxy/networkTimeout" ), mNetworkTimeoutSpinBox->value() );
@@ -1213,8 +1191,8 @@ void QgsOptions::saveOptions()
mSettings->setValue( QStringLiteral( "/qgis/map_update_interval" ), spinMapUpdateInterval->value() );
mSettings->setValue( QStringLiteral( "/qgis/legendDoubleClickAction" ), cmbLegendDoubleClickAction->currentIndex() );
- bool legendLayersCapitalise = mSettings->value( QStringLiteral( "/qgis/capitaliseLayerName" ), false ).toBool();
- mSettings->setValue( QStringLiteral( "/qgis/capitaliseLayerName" ), capitaliseCheckBox->isChecked() );
+ bool legendLayersCapitalize = mSettings->value( QStringLiteral( "/qgis/capitalizeLayerName" ), false ).toBool();
+ mSettings->setValue( QStringLiteral( "/qgis/capitalizeLayerName" ), capitalizeCheckBox->isChecked() );
// Default simplify drawing configuration
QgsVectorSimplifyMethod::SimplifyHints simplifyHints = QgsVectorSimplifyMethod::NoSimplification;
@@ -1404,7 +1382,7 @@ void QgsOptions::saveOptions()
mSettings->setValue( QStringLiteral( "/qgis/digitizing/offset_miter_limit" ), mCurveOffsetMiterLimitComboBox->value() );
// default scale list
- myPaths.clear();
+ QString myPaths;
for ( int i = 0; i < mListGlobalScales->count(); ++i )
{
if ( i != 0 )
@@ -1470,7 +1448,7 @@ void QgsOptions::saveOptions()
// refresh legend if any legend item's state is to be changed
if ( legendLayersBold != mLegendLayersBoldChkBx->isChecked()
|| legendGroupsBold != mLegendGroupsBoldChkBx->isChecked()
- || legendLayersCapitalise != capitaliseCheckBox->isChecked() )
+ || legendLayersCapitalize != capitalizeCheckBox->isChecked() )
{
// TODO[MD] QgisApp::instance()->legend()->updateLegendItemStyles();
}
@@ -1492,12 +1470,6 @@ void QgsOptions::saveOptions()
}
saveDefaultDatumTransformations();
-
- QgsApplication* app = qobject_cast( QgsApplication::instance() );
- if ( app )
- {
- app->emitSettingsChanged();
- }
}
void QgsOptions::rejectOptions()
@@ -1886,12 +1858,8 @@ void QgsOptions::loadGdalDriverList()
// in GDAL 2.0 vector and mixed drivers are returned by GDALGetDriver, so filter out non-raster drivers
// TODO add same UI for vector drivers
-#ifdef GDAL_COMPUTE_VERSION
-#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(2,0,0)
if ( QString( GDALGetMetadataItem( myGdalDriver, GDAL_DCAP_RASTER, nullptr ) ) != "YES" )
continue;
-#endif
-#endif
myGdalDriverDescription = GDALGetDescription( myGdalDriver );
myDrivers << myGdalDriverDescription;
diff --git a/src/app/qgsoptions.h b/src/app/qgsoptions.h
index 355999b11d9..e4b4500b319 100644
--- a/src/app/qgsoptions.h
+++ b/src/app/qgsoptions.h
@@ -27,6 +27,7 @@
#include
#include
+#include "qgis_app.h"
class QgsExpressionContext;
@@ -46,7 +47,7 @@ class APP_EXPORT QgsOptions : public QgsOptionsDialogBase, private Ui::QgsOption
* @param modal true for modal dialog
*/
QgsOptions( QWidget *parent = nullptr, Qt::WindowFlags fl = QgisGui::ModalDialogFlags );
- //! Destructor
+
~QgsOptions();
/** Sets the page with the specified widget name as the current page
diff --git a/src/app/qgspluginmetadata.h b/src/app/qgspluginmetadata.h
index 4b133af4964..8de356f43a7 100644
--- a/src/app/qgspluginmetadata.h
+++ b/src/app/qgspluginmetadata.h
@@ -19,6 +19,7 @@
#ifndef QGSPLUGINMETADATA_H
#define QGSPLUGINMETADATA_H
#include
+#include "qgis_app.h"
class QgisPlugin;
/**
diff --git a/src/app/qgspluginregistry.cpp b/src/app/qgspluginregistry.cpp
index ba7bcf4e22d..88868b348f6 100644
--- a/src/app/qgspluginregistry.cpp
+++ b/src/app/qgspluginregistry.cpp
@@ -380,7 +380,7 @@ void QgsPluginRegistry::loadCppPlugin( const QString& theFullPathName )
{
// something went wrong
QMessageBox::warning( mQgisInterface->mainWindow(), QObject::tr( "Error Loading Plugin" ),
- QObject::tr( "There was an error loading a plugin."
+ QObject::tr( "There was an error loading a plugin. "
"The following diagnostic information may help the QGIS developers resolve the issue:\n%1." )
.arg( myError ) );
//disable it to the qsettings file [ts]
diff --git a/src/app/qgspluginregistry.h b/src/app/qgspluginregistry.h
index 7403e8b6037..78414b2b9c9 100644
--- a/src/app/qgspluginregistry.h
+++ b/src/app/qgspluginregistry.h
@@ -21,6 +21,7 @@
#include
#include "qgspluginmetadata.h"
+#include "qgis_app.h"
class QgsPythonUtils;
class QgisPlugin;
diff --git a/src/app/qgspointmarkeritem.cpp b/src/app/qgspointmarkeritem.cpp
index 158055436fd..bdaad7800ab 100644
--- a/src/app/qgspointmarkeritem.cpp
+++ b/src/app/qgspointmarkeritem.cpp
@@ -17,6 +17,7 @@
#include "qgssymbol.h"
#include "qgsmapcanvas.h"
#include "qgsmapsettings.h"
+#include "qgsproject.h"
#include
#include
@@ -31,7 +32,7 @@ QgsRenderContext QgsPointMarkerItem::renderContext( QPainter* painter )
{
QgsExpressionContext context;
context << QgsExpressionContextUtils::globalScope()
- << QgsExpressionContextUtils::projectScope()
+ << QgsExpressionContextUtils::projectScope( QgsProject::instance() )
<< QgsExpressionContextUtils::atlasScope( nullptr );
if ( mMapCanvas )
{
diff --git a/src/app/qgspointmarkeritem.h b/src/app/qgspointmarkeritem.h
index f2400486a50..3c728980c31 100644
--- a/src/app/qgspointmarkeritem.h
+++ b/src/app/qgspointmarkeritem.h
@@ -21,6 +21,7 @@
#include "effects/qgspainteffect.h"
#include
#include
+#include "qgis_app.h"
class QgsMarkerSymbol;
diff --git a/src/app/qgspointrotationitem.h b/src/app/qgspointrotationitem.h
index d8fa69bdcbd..71def87c64e 100644
--- a/src/app/qgspointrotationitem.h
+++ b/src/app/qgspointrotationitem.h
@@ -19,6 +19,7 @@
#include "qgsmapcanvasitem.h"
#include
#include
+#include "qgis_app.h"
//! An item that shows a rotated point symbol (e.g. arrow) centered to a map location together with a text displaying the rotation value
class APP_EXPORT QgsPointRotationItem: public QgsMapCanvasItem
diff --git a/src/app/qgsprojectlayergroupdialog.h b/src/app/qgsprojectlayergroupdialog.h
index 9ca1fc34216..f5ead903f7b 100644
--- a/src/app/qgsprojectlayergroupdialog.h
+++ b/src/app/qgsprojectlayergroupdialog.h
@@ -17,6 +17,7 @@
#include "QDialog"
#include "ui_qgsprojectlayergroupdialogbase.h"
+#include "qgis_app.h"
class QDomElement;
diff --git a/src/app/qgsprojectproperties.cpp b/src/app/qgsprojectproperties.cpp
index f42c8cb13be..8d9fe85dbc6 100644
--- a/src/app/qgsprojectproperties.cpp
+++ b/src/app/qgsprojectproperties.cpp
@@ -674,7 +674,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
connect( mButtonExportColors, SIGNAL( clicked( bool ) ), mTreeProjectColors, SLOT( showExportColorsDialog() ) );
QList projectSchemes;
- QgsColorSchemeRegistry::instance()->schemes( projectSchemes );
+ QgsApplication::colorSchemeRegistry()->schemes( projectSchemes );
if ( projectSchemes.length() > 0 )
{
mTreeProjectColors->setScheme( projectSchemes.at( 0 ) );
@@ -723,7 +723,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
// Variables editor
mVariableEditor->context()->appendScope( QgsExpressionContextUtils::globalScope() );
- mVariableEditor->context()->appendScope( QgsExpressionContextUtils::projectScope() );
+ mVariableEditor->context()->appendScope( QgsExpressionContextUtils::projectScope( QgsProject::instance() ) );
mVariableEditor->reloadContext();
mVariableEditor->setEditableScopeIndex( 1 );
@@ -1190,7 +1190,7 @@ void QgsProjectProperties::apply()
QgsProject::instance()->relationManager()->setRelations( mRelationManagerDlg->relations() );
//save variables
- QgsProject::instance()->setVariables( mVariableEditor->variablesInActiveScope() );
+ QgsProject::instance()->setCustomVariables( mVariableEditor->variablesInActiveScope() );
emit refresh();
}
diff --git a/src/app/qgsprojectproperties.h b/src/app/qgsprojectproperties.h
index 54a086fbf66..9e9f109c8ad 100644
--- a/src/app/qgsprojectproperties.h
+++ b/src/app/qgsprojectproperties.h
@@ -23,6 +23,7 @@
#include "qgsunittypes.h"
#include "qgisgui.h"
#include "qgscontexthelp.h"
+#include "qgis_app.h"
class QgsMapCanvas;
class QgsRelationManagerDialog;
@@ -43,7 +44,7 @@ class APP_EXPORT QgsProjectProperties : public QgsOptionsDialogBase, private Ui:
//! Constructor
QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *parent = nullptr, Qt::WindowFlags fl = QgisGui::ModalDialogFlags );
- //! Destructor
+
~QgsProjectProperties();
/** Gets the currently select map units
diff --git a/src/app/qgsrastercalcdialog.h b/src/app/qgsrastercalcdialog.h
index f2dbfcaa32a..20e67c356d0 100644
--- a/src/app/qgsrastercalcdialog.h
+++ b/src/app/qgsrastercalcdialog.h
@@ -20,6 +20,7 @@
#include "ui_qgsrastercalcdialogbase.h"
#include "qgsrastercalculator.h"
+#include "qgis_app.h"
//! A dialog to enter a raster calculation expression
class APP_EXPORT QgsRasterCalcDialog: public QDialog, private Ui::QgsRasterCalcDialogBase
diff --git a/src/app/qgsrasterlayerproperties.cpp b/src/app/qgsrasterlayerproperties.cpp
index ad09df54423..412718c51f3 100644
--- a/src/app/qgsrasterlayerproperties.cpp
+++ b/src/app/qgsrasterlayerproperties.cpp
@@ -361,17 +361,17 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanv
}
//insert renderer widgets into registry
- QgsRasterRendererRegistry::instance()->insertWidgetFunction( QStringLiteral( "paletted" ), QgsPalettedRendererWidget::create );
- QgsRasterRendererRegistry::instance()->insertWidgetFunction( QStringLiteral( "multibandcolor" ), QgsMultiBandColorRendererWidget::create );
- QgsRasterRendererRegistry::instance()->insertWidgetFunction( QStringLiteral( "singlebandpseudocolor" ), QgsSingleBandPseudoColorRendererWidget::create );
- QgsRasterRendererRegistry::instance()->insertWidgetFunction( QStringLiteral( "singlebandgray" ), QgsSingleBandGrayRendererWidget::create );
- QgsRasterRendererRegistry::instance()->insertWidgetFunction( QStringLiteral( "hillshade" ), QgsHillshadeRendererWidget::create );
+ QgsApplication::rasterRendererRegistry()->insertWidgetFunction( QStringLiteral( "paletted" ), QgsPalettedRendererWidget::create );
+ QgsApplication::rasterRendererRegistry()->insertWidgetFunction( QStringLiteral( "multibandcolor" ), QgsMultiBandColorRendererWidget::create );
+ QgsApplication::rasterRendererRegistry()->insertWidgetFunction( QStringLiteral( "singlebandpseudocolor" ), QgsSingleBandPseudoColorRendererWidget::create );
+ QgsApplication::rasterRendererRegistry()->insertWidgetFunction( QStringLiteral( "singlebandgray" ), QgsSingleBandGrayRendererWidget::create );
+ QgsApplication::rasterRendererRegistry()->insertWidgetFunction( QStringLiteral( "hillshade" ), QgsHillshadeRendererWidget::create );
//fill available renderers into combo box
QgsRasterRendererRegistryEntry entry;
- Q_FOREACH ( const QString& name, QgsRasterRendererRegistry::instance()->renderersList() )
+ Q_FOREACH ( const QString& name, QgsApplication::rasterRendererRegistry()->renderersList() )
{
- if ( QgsRasterRendererRegistry::instance()->rendererData( name, entry ) )
+ if ( QgsApplication::rasterRendererRegistry()->rendererData( name, entry ) )
{
if (( mRasterLayer->rasterType() != QgsRasterLayer::ColorLayer && entry.name != QLatin1String( "singlebandcolordata" ) ) ||
( mRasterLayer->rasterType() == QgsRasterLayer::ColorLayer && entry.name == QLatin1String( "singlebandcolordata" ) ) )
@@ -540,15 +540,40 @@ void QgsRasterLayerProperties::setRendererWidget( const QString& rendererName )
{
QgsDebugMsg( "rendererName = " + rendererName );
QgsRasterRendererWidget* oldWidget = mRendererWidget;
+ QgsRasterRenderer* oldRenderer = mRasterLayer->renderer();
+
+ int alphaBand = -1;
+ double opacity = 1;
+ if ( oldRenderer )
+ {
+ // Retain alpha band and opacity when switching renderer
+ alphaBand = oldRenderer->alphaBand();
+ opacity = oldRenderer->opacity();
+ }
QgsRasterRendererRegistryEntry rendererEntry;
- if ( QgsRasterRendererRegistry::instance()->rendererData( rendererName, rendererEntry ) )
+ if ( QgsApplication::rasterRendererRegistry()->rendererData( rendererName, rendererEntry ) )
{
if ( rendererEntry.widgetCreateFunction ) //single band color data renderer e.g. has no widget
{
QgsDebugMsg( "renderer has widgetCreateFunction" );
// Current canvas extent (used to calc min/max) in layer CRS
QgsRectangle myExtent = mMapCanvas->mapSettings().outputExtentToLayerExtent( mRasterLayer, mMapCanvas->extent() );
+ if ( oldWidget )
+ {
+ if ( rendererName == "singlebandgray" )
+ {
+ whileBlocking( mRasterLayer )->setRenderer( QgsApplication::rasterRendererRegistry()->defaultRendererForDrawingStyle( QgsRaster::SingleBandGray, mRasterLayer->dataProvider() ) );
+ whileBlocking( mRasterLayer )->setDefaultContrastEnhancement();
+ }
+ else if ( rendererName == "multibandcolor" )
+ {
+ whileBlocking( mRasterLayer )->setRenderer( QgsApplication::rasterRendererRegistry()->defaultRendererForDrawingStyle( QgsRaster::MultiBandColor, mRasterLayer->dataProvider() ) );
+ whileBlocking( mRasterLayer )->setDefaultContrastEnhancement();
+ }
+ }
+ mRasterLayer->renderer()->setAlphaBand( alphaBand );
+ mRasterLayer->renderer()->setOpacity( opacity );
mRendererWidget = rendererEntry.widgetCreateFunction( mRasterLayer, myExtent );
mRendererWidget->setMapCanvas( mMapCanvas );
mRendererStackedWidget->addWidget( mRendererWidget );
@@ -994,7 +1019,7 @@ void QgsRasterLayerProperties::apply()
void QgsRasterLayerProperties::on_mLayerOrigNameLineEd_textEdited( const QString& text )
{
- leDisplayName->setText( mRasterLayer->capitaliseLayerName( text ) );
+ leDisplayName->setText( mRasterLayer->capitalizeLayerName( text ) );
}
void QgsRasterLayerProperties::on_buttonBuildPyramids_clicked()
diff --git a/src/app/qgsrasterlayerproperties.h b/src/app/qgsrasterlayerproperties.h
index 42aa87ad9a5..004504d9ddc 100644
--- a/src/app/qgsrasterlayerproperties.h
+++ b/src/app/qgsrasterlayerproperties.h
@@ -24,6 +24,7 @@
#include "qgisgui.h"
#include "qgscontexthelp.h"
#include "qgsmaplayerstylemanager.h"
+#include "qgis_app.h"
class QgsPoint;
class QgsMapLayer;
@@ -48,7 +49,7 @@ class APP_EXPORT QgsRasterLayerProperties : public QgsOptionsDialogBase, private
* @param ml Map layer for which properties will be displayed
*/
QgsRasterLayerProperties( QgsMapLayer *lyr, QgsMapCanvas* theCanvas, QWidget *parent = nullptr, Qt::WindowFlags = QgisGui::ModalDialogFlags );
- //! \brief Destructor
+
~QgsRasterLayerProperties();
//! Synchronize state with associated raster layer
diff --git a/src/app/qgsrelationadddlg.h b/src/app/qgsrelationadddlg.h
index 696217cbf4a..3be468c322f 100644
--- a/src/app/qgsrelationadddlg.h
+++ b/src/app/qgsrelationadddlg.h
@@ -17,6 +17,7 @@
#include
#include "ui_qgsrelationadddlgbase.h"
+#include "qgis_app.h"
class QgsVectorLayer;
diff --git a/src/app/qgsrelationmanagerdialog.h b/src/app/qgsrelationmanagerdialog.h
index 48a0964afe5..af9ab7f4645 100644
--- a/src/app/qgsrelationmanagerdialog.h
+++ b/src/app/qgsrelationmanagerdialog.h
@@ -18,6 +18,7 @@
#include
#include "ui_qgsrelationmanagerdialogbase.h"
+#include "qgis_app.h"
class QgsRelation;
class QgsRelationManager;
diff --git a/src/app/qgsrulebasedlabelingwidget.cpp b/src/app/qgsrulebasedlabelingwidget.cpp
index 6e77a1fe15b..74e03324ab6 100644
--- a/src/app/qgsrulebasedlabelingwidget.cpp
+++ b/src/app/qgsrulebasedlabelingwidget.cpp
@@ -19,6 +19,7 @@
#include "qgsfeatureiterator.h"
#include "qgslabelinggui.h"
#include "qgsmapcanvas.h"
+#include "qgsproject.h"
#include "qgsrulebasedlabeling.h"
#include "qgsvectorlayer.h"
#include "qgsvectorlayerlabeling.h"
@@ -27,6 +28,27 @@
#include
#include
+
+static QList _globalProjectAtlasMapLayerScopes( QgsMapCanvas* mapCanvas, const QgsMapLayer* layer )
+{
+ QList scopes;
+ scopes << QgsExpressionContextUtils::globalScope()
+ << QgsExpressionContextUtils::projectScope( QgsProject::instance() )
+ << QgsExpressionContextUtils::atlasScope( nullptr );
+ if ( mapCanvas )
+ {
+ scopes << QgsExpressionContextUtils::mapSettingsScope( mapCanvas->mapSettings() )
+ << new QgsExpressionContextScope( mapCanvas->expressionContextScope() );
+ }
+ else
+ {
+ scopes << QgsExpressionContextUtils::mapSettingsScope( QgsMapSettings() );
+ }
+ scopes << QgsExpressionContextUtils::layerScope( layer );
+ return scopes;
+}
+
+
QgsRuleBasedLabelingWidget::QgsRuleBasedLabelingWidget( QgsVectorLayer* layer, QgsMapCanvas* canvas, QWidget* parent )
: QgsPanelWidget( parent )
, mLayer( layer )
@@ -643,20 +665,7 @@ void QgsLabelingRulePropsWidget::testFilter()
return;
}
- QgsExpressionContext context;
- context << QgsExpressionContextUtils::globalScope()
- << QgsExpressionContextUtils::projectScope()
- << QgsExpressionContextUtils::atlasScope( nullptr );
- if ( mMapCanvas )
- {
- context << QgsExpressionContextUtils::mapSettingsScope( mMapCanvas->mapSettings() )
- << new QgsExpressionContextScope( mMapCanvas->expressionContextScope() );
- }
- else
- {
- context << QgsExpressionContextUtils::mapSettingsScope( QgsMapSettings() );
- }
- context << QgsExpressionContextUtils::layerScope( mLayer );
+ QgsExpressionContext context( _globalProjectAtlasMapLayerScopes( mMapCanvas, mLayer ) );
if ( !filter.prepare( &context ) )
{
@@ -686,22 +695,10 @@ void QgsLabelingRulePropsWidget::testFilter()
QMessageBox::information( this, tr( "Filter" ), tr( "Filter returned %n feature(s)", "number of filtered features", count ) );
}
+
void QgsLabelingRulePropsWidget::buildExpression()
{
- QgsExpressionContext context;
- context << QgsExpressionContextUtils::globalScope()
- << QgsExpressionContextUtils::projectScope()
- << QgsExpressionContextUtils::atlasScope( nullptr );
- if ( mMapCanvas )
- {
- context << QgsExpressionContextUtils::mapSettingsScope( mMapCanvas->mapSettings() )
- << new QgsExpressionContextScope( mMapCanvas->expressionContextScope() );
- }
- else
- {
- context << QgsExpressionContextUtils::mapSettingsScope( QgsMapSettings() );
- }
- context << QgsExpressionContextUtils::layerScope( mLayer );
+ QgsExpressionContext context( _globalProjectAtlasMapLayerScopes( mMapCanvas, mLayer ) );
QgsExpressionBuilderDialog dlg( mLayer, editFilter->text(), this, QStringLiteral( "generic" ), context );
diff --git a/src/app/qgsrulebasedlabelingwidget.h b/src/app/qgsrulebasedlabelingwidget.h
index 54f166e06ab..b1c330824da 100644
--- a/src/app/qgsrulebasedlabelingwidget.h
+++ b/src/app/qgsrulebasedlabelingwidget.h
@@ -22,6 +22,7 @@
#include
#include "qgsrulebasedlabeling.h"
+#include "qgis_app.h"
class QgsMapCanvas;
class QgsVectorLayer;
diff --git a/src/app/qgssavestyletodbdialog.h b/src/app/qgssavestyletodbdialog.h
index bfc0b5444c9..b0aef4c698d 100644
--- a/src/app/qgssavestyletodbdialog.h
+++ b/src/app/qgssavestyletodbdialog.h
@@ -18,6 +18,7 @@
#include "ui_qgssavetodbdialog.h"
#include "qgisgui.h"
+#include "qgis_app.h"
class APP_EXPORT QgsSaveStyleToDbDialog : public QDialog, private Ui::QgsSaveToDBDialog
{
diff --git a/src/app/qgsselectbyformdialog.cpp b/src/app/qgsselectbyformdialog.cpp
index c7536f204c1..3b9c01e7adf 100644
--- a/src/app/qgsselectbyformdialog.cpp
+++ b/src/app/qgsselectbyformdialog.cpp
@@ -15,11 +15,14 @@
#include "qgsselectbyformdialog.h"
#include "qgsattributeform.h"
+#include "qgsmapcanvas.h"
#include
#include
QgsSelectByFormDialog::QgsSelectByFormDialog( QgsVectorLayer* layer, const QgsAttributeEditorContext& context, QWidget* parent, Qt::WindowFlags fl )
: QDialog( parent, fl )
+ , mLayer( layer )
+ , mMessageBar( nullptr )
{
QgsAttributeEditorContext dlgContext = context;
dlgContext.setFormMode( QgsAttributeEditorContext::StandaloneDialog );
@@ -51,5 +54,62 @@ QgsSelectByFormDialog::~QgsSelectByFormDialog()
void QgsSelectByFormDialog::setMessageBar( QgsMessageBar* messageBar )
{
+ mMessageBar = messageBar;
mForm->setMessageBar( messageBar );
}
+
+void QgsSelectByFormDialog::setMapCanvas( QgsMapCanvas* canvas )
+{
+ mMapCanvas = canvas;
+ connect( mForm, &QgsAttributeForm::zoomToFeatures, this, &QgsSelectByFormDialog::zoomToFeatures );
+}
+
+void QgsSelectByFormDialog::zoomToFeatures( const QString& filter )
+{
+ QgsFeatureIds ids;
+
+ QgsExpressionContext context( QgsExpressionContextUtils::globalProjectLayerScopes( mLayer ) );
+
+ QgsFeatureRequest request = QgsFeatureRequest().setFilterExpression( filter )
+ .setExpressionContext( context )
+ .setSubsetOfAttributes( QgsAttributeList() );
+
+ QgsFeatureIterator features = mLayer->getFeatures( request );
+
+ QgsRectangle bbox;
+ bbox.setMinimal();
+ QgsFeature feat;
+ int featureCount = 0;
+ while ( features.nextFeature( feat ) )
+ {
+ QgsGeometry geom = feat.geometry();
+ if ( geom.isEmpty() || geom.geometry()->isEmpty() )
+ continue;
+
+ QgsRectangle r = mMapCanvas->mapSettings().layerExtentToOutputExtent( mLayer, geom.boundingBox() );
+ bbox.combineExtentWith( r );
+ featureCount++;
+ }
+ features.close();
+
+ QSettings settings;
+ int timeout = settings.value( QStringLiteral( "/qgis/messageTimeout" ), 5 ).toInt();
+ if ( featureCount > 0 )
+ {
+ mMapCanvas->zoomToFeatureExtent( bbox );
+ if ( mMessageBar )
+ {
+ mMessageBar->pushMessage( QString(),
+ tr( "Zoomed to %n matching feature(s)", "number of matching features", featureCount ),
+ QgsMessageBar::INFO,
+ timeout );
+ }
+ }
+ else if ( mMessageBar )
+ {
+ mMessageBar->pushMessage( QString(),
+ tr( "No matching features found" ),
+ QgsMessageBar::INFO,
+ timeout );
+ }
+}
diff --git a/src/app/qgsselectbyformdialog.h b/src/app/qgsselectbyformdialog.h
index b62520f5c3b..2ce875a1eb4 100644
--- a/src/app/qgsselectbyformdialog.h
+++ b/src/app/qgsselectbyformdialog.h
@@ -18,10 +18,12 @@
#include
#include "qgsattributeeditorcontext.h"
+#include "qgis_app.h"
class QgsAttributeForm;
class QgsMessageBar;
class QgsVectorLayer;
+class QgsMapCanvas;
/** \ingroup app
* \class QgsSelectByFormDialog
@@ -54,9 +56,21 @@ class APP_EXPORT QgsSelectByFormDialog : public QDialog
*/
void setMessageBar( QgsMessageBar* messageBar );
+ /**
+ * Sets a map canvas associated with the dialog.
+ */
+ void setMapCanvas( QgsMapCanvas* canvas );
+
+ private slots:
+
+ void zoomToFeatures( const QString& filter );
+
private:
QgsAttributeForm* mForm;
+ QgsVectorLayer* mLayer;
+ QgsMessageBar* mMessageBar;
+ QgsMapCanvas* mMapCanvas;
};
diff --git a/src/app/qgssnappinglayertreemodel.cpp b/src/app/qgssnappinglayertreemodel.cpp
index 3a55cebd771..6b38d523cf5 100644
--- a/src/app/qgssnappinglayertreemodel.cpp
+++ b/src/app/qgssnappinglayertreemodel.cpp
@@ -144,7 +144,7 @@ QgsSnappingLayerTreeModel::QgsSnappingLayerTreeModel( QgsProject* project, QObje
, mLayerTreeModel( nullptr )
{
connect( project, &QgsProject::snappingConfigChanged, this, &QgsSnappingLayerTreeModel::onSnappingSettingsChanged );
- connect( project, &QgsProject::avoidIntersectionsListChanged, this, &QgsSnappingLayerTreeModel::onSnappingSettingsChanged );
+ connect( project, &QgsProject::avoidIntersectionsLayersChanged, this, &QgsSnappingLayerTreeModel::onSnappingSettingsChanged );
}
QgsSnappingLayerTreeModel::~QgsSnappingLayerTreeModel()
@@ -494,7 +494,7 @@ QVariant QgsSnappingLayerTreeModel::data( const QModelIndex& idx, int role ) con
{
if ( role == Qt::CheckStateRole && vl->geometryType() == QgsWkbTypes::PolygonGeometry )
{
- if ( mProject->avoidIntersectionsList().contains( vl->id() ) )
+ if ( mProject->avoidIntersectionsLayers().contains( vl ) )
{
return Qt::Checked;
}
@@ -620,14 +620,14 @@ bool QgsSnappingLayerTreeModel::setData( const QModelIndex& index, const QVarian
if ( !mIndividualLayerSettings.contains( vl ) )
return false;
- QStringList avoidIntersectionsList = mProject->avoidIntersectionsList();
+ QList avoidIntersectionsList = mProject->avoidIntersectionsLayers();
- if ( value.toInt() == Qt::Checked && !avoidIntersectionsList.contains( vl->id() ) )
- avoidIntersectionsList.append( vl->id() );
+ if ( value.toInt() == Qt::Checked && !avoidIntersectionsList.contains( vl ) )
+ avoidIntersectionsList.append( vl );
else
- avoidIntersectionsList.removeAll( vl->id() );
+ avoidIntersectionsList.removeAll( vl );
- mProject->setAvoidIntersectionsList( avoidIntersectionsList );
+ mProject->setAvoidIntersectionsLayers( avoidIntersectionsList );
return true;
}
}
diff --git a/src/app/qgssnappinglayertreemodel.h b/src/app/qgssnappinglayertreemodel.h
index e54890b0516..da6f1087162 100644
--- a/src/app/qgssnappinglayertreemodel.h
+++ b/src/app/qgssnappinglayertreemodel.h
@@ -23,6 +23,7 @@
#include "qgslayertreemodel.h"
#include "qgssnappingconfig.h"
+#include "qgis_app.h"
class QgsMapCanvas;
class QgsProject;
diff --git a/src/app/qgssnappingwidget.h b/src/app/qgssnappingwidget.h
index dccf5c71212..4f99b96a253 100644
--- a/src/app/qgssnappingwidget.h
+++ b/src/app/qgssnappingwidget.h
@@ -34,6 +34,7 @@ class QgsProject;
#include
#include
+#include "qgis_app.h"
/**
* A widget which lets the user defines settings for snapping on a project
@@ -55,7 +56,7 @@ class APP_EXPORT QgsSnappingWidget : public QWidget
*/
QgsSnappingWidget( QgsProject* project, QgsMapCanvas* canvas, QWidget* parent = nullptr );
- //! Destructor
+
virtual ~QgsSnappingWidget();
/**
diff --git a/src/app/qgssponsors.cpp b/src/app/qgssponsors.cpp
index 6d43cc7bcef..07f88e50f1e 100644
--- a/src/app/qgssponsors.cpp
+++ b/src/app/qgssponsors.cpp
@@ -32,7 +32,7 @@ QgsSponsors::QgsSponsors( QWidget *parent )
init();
QString intro = tr( "
We work really hard to make this nice software for you. "
"See all the cool features it has? Get a warm fuzzy feeling when you use it? "
- "QGIS is a labour of love by a dedicated team of developers. We want you to copy "
+ "QGIS is a labor of love by a dedicated team of developers. We want you to copy "
"& share it and put it in the hands of as many people as possible. If QGIS "
"is saving you money or you like our work and have the financial ability to "
"help, please consider sponsoring the development of QGIS. We use money from "
diff --git a/src/app/qgssponsors.h b/src/app/qgssponsors.h
index 8b05b082f53..f238c2fe10b 100644
--- a/src/app/qgssponsors.h
+++ b/src/app/qgssponsors.h
@@ -18,6 +18,7 @@
#define QGSSPONSORS_H
#include "ui_qgssponsorsbase.h"
+#include "qgis_app.h"
class APP_EXPORT QgsSponsors : public QDialog, private Ui::QgsSponsorsBase
{
diff --git a/src/app/qgsstatisticalsummarydockwidget.cpp b/src/app/qgsstatisticalsummarydockwidget.cpp
index c7513fa0c7b..b9b561ed20f 100644
--- a/src/app/qgsstatisticalsummarydockwidget.cpp
+++ b/src/app/qgsstatisticalsummarydockwidget.cpp
@@ -62,7 +62,7 @@ QgsExpressionContext QgsStatisticalSummaryDockWidget::createExpressionContext()
{
QgsExpressionContext expContext;
expContext << QgsExpressionContextUtils::globalScope()
- << QgsExpressionContextUtils::projectScope()
+ << QgsExpressionContextUtils::projectScope( QgsProject::instance() )
<< QgsExpressionContextUtils::mapSettingsScope( QgisApp::instance()->mapCanvas()->mapSettings() )
<< QgsExpressionContextUtils::layerScope( mLayer );
@@ -202,8 +202,9 @@ void QgsStatisticalSummaryDockWidget::updateNumericStatistics( bool selectedOnly
int row = 0;
Q_FOREACH ( QgsStatisticalSummary::Statistic stat, statsToDisplay )
{
+ double val = stats.statistic( stat );
addRow( row, QgsStatisticalSummary::displayName( stat ),
- QString::number( stats.statistic( stat ) ),
+ qIsNaN( val ) ? QString() : QString::number( val ),
stats.count() != 0 );
row++;
}
diff --git a/src/app/qgsstatisticalsummarydockwidget.h b/src/app/qgsstatisticalsummarydockwidget.h
index b8f33f3c5d2..6e3f22df289 100644
--- a/src/app/qgsstatisticalsummarydockwidget.h
+++ b/src/app/qgsstatisticalsummarydockwidget.h
@@ -22,6 +22,7 @@
#include "qgsstringstatisticalsummary.h"
#include "qgsdatetimestatisticalsummary.h"
#include "qgsdockwidget.h"
+#include "qgis_app.h"
class QgsBrowserModel;
class QModelIndex;
diff --git a/src/app/qgsstatusbarcoordinateswidget.h b/src/app/qgsstatusbarcoordinateswidget.h
index 7384fffeb7b..5cb237a7a96 100644
--- a/src/app/qgsstatusbarcoordinateswidget.h
+++ b/src/app/qgsstatusbarcoordinateswidget.h
@@ -28,6 +28,7 @@ class QgsMapCanvas;
class QgsPoint;
#include
+#include "qgis_app.h"
class APP_EXPORT QgsStatusBarCoordinatesWidget : public QWidget
{
diff --git a/src/app/qgsstatusbarmagnifierwidget.h b/src/app/qgsstatusbarmagnifierwidget.h
index 88784893922..56c994d2fb9 100644
--- a/src/app/qgsstatusbarmagnifierwidget.h
+++ b/src/app/qgsstatusbarmagnifierwidget.h
@@ -23,6 +23,7 @@ class QHBoxLayout;
class QgsDoubleSpinBox;
#include
+#include "qgis_app.h"
/**
* A widget which lets the user select the current level of magnification to
@@ -40,7 +41,7 @@ class APP_EXPORT QgsStatusBarMagnifierWidget : public QWidget
*/
QgsStatusBarMagnifierWidget( QWidget* parent = nullptr );
- //! Destructor
+
virtual ~QgsStatusBarMagnifierWidget();
void setDefaultFactor( double factor );
diff --git a/src/app/qgsstatusbarscalewidget.h b/src/app/qgsstatusbarscalewidget.h
index aa382b4d2a0..5cfe2665824 100644
--- a/src/app/qgsstatusbarscalewidget.h
+++ b/src/app/qgsstatusbarscalewidget.h
@@ -28,6 +28,7 @@ class QgsScaleComboBox;
#include
+#include "qgis_app.h"
/**
* Widget to define scale of the map canvas.
@@ -39,7 +40,7 @@ class APP_EXPORT QgsStatusBarScaleWidget : public QWidget
public:
explicit QgsStatusBarScaleWidget( QgsMapCanvas* canvas, QWidget *parent = 0 );
- //! Destructor
+
virtual ~QgsStatusBarScaleWidget();
/**
diff --git a/src/app/qgssvgannotationdialog.h b/src/app/qgssvgannotationdialog.h
index b15751a42d4..2e2c4b8307e 100644
--- a/src/app/qgssvgannotationdialog.h
+++ b/src/app/qgssvgannotationdialog.h
@@ -19,6 +19,7 @@
#define QGSSVGANNOTATIONDIALOG_H
#include "ui_qgsformannotationdialogbase.h"
+#include "qgis_app.h"
class QgsSvgAnnotationItem;
class QgsAnnotationWidget;
diff --git a/src/app/qgstextannotationdialog.h b/src/app/qgstextannotationdialog.h
index c673dc961dd..9a784829b6e 100644
--- a/src/app/qgstextannotationdialog.h
+++ b/src/app/qgstextannotationdialog.h
@@ -19,6 +19,7 @@
#define QGSTEXTANNOTATIONDIALOG_H
#include "ui_qgstextannotationdialogbase.h"
+#include "qgis_app.h"
class QgsAnnotationWidget;
class QgsTextAnnotationItem;
diff --git a/src/app/qgstip.h b/src/app/qgstip.h
index c81ddbd8355..13905755908 100644
--- a/src/app/qgstip.h
+++ b/src/app/qgstip.h
@@ -17,6 +17,7 @@
#include
#include
+#include "qgis_app.h"
/** \ingroup app
* \brief An QgsTip represents a tip generated by the
diff --git a/src/app/qgstipfactory.h b/src/app/qgstipfactory.h
index eeba72e6421..f79864e19a8 100644
--- a/src/app/qgstipfactory.h
+++ b/src/app/qgstipfactory.h
@@ -18,6 +18,7 @@
#include "qgstip.h"
#include
+#include "qgis_app.h"
/** \ingroup app
* \brief A factory class to serve up tips to the user.
@@ -33,7 +34,7 @@ class APP_EXPORT QgsTipFactory : public QObject
public:
//! Constructor
QgsTipFactory();
- //! Destructor
+
~QgsTipFactory();
/** Get a random tip (generic or gui-centric)
diff --git a/src/app/qgstipgui.h b/src/app/qgstipgui.h
index 506fe62baf9..454ece926bc 100644
--- a/src/app/qgstipgui.h
+++ b/src/app/qgstipgui.h
@@ -18,6 +18,7 @@
#define QGSTIPGUI_H
#include "ui_qgstipguibase.h"
+#include "qgis_app.h"
class QgsTip;
class APP_EXPORT QgsTipGui : public QDialog, private Ui::QgsTipGuiBase
diff --git a/src/app/qgsundowidget.h b/src/app/qgsundowidget.h
index 5687bd7fc4e..b5ebfaf218d 100644
--- a/src/app/qgsundowidget.h
+++ b/src/app/qgsundowidget.h
@@ -27,6 +27,7 @@
#include
#include "qgspanelwidget.h"
+#include "qgis_app.h"
class QgsMapCanvas;
class QgsMapLayer;
diff --git a/src/app/qgsvectorlayerproperties.cpp b/src/app/qgsvectorlayerproperties.cpp
index 3d85c6d3f9a..646fd014da2 100644
--- a/src/app/qgsvectorlayerproperties.cpp
+++ b/src/app/qgsvectorlayerproperties.cpp
@@ -112,7 +112,7 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
connect( mOptionsStackedWidget, SIGNAL( currentChanged( int ) ), this, SLOT( mOptionsStackedWidget_CurrentChanged( int ) ) );
mContext << QgsExpressionContextUtils::globalScope()
- << QgsExpressionContextUtils::projectScope()
+ << QgsExpressionContextUtils::projectScope( QgsProject::instance() )
<< QgsExpressionContextUtils::atlasScope( nullptr )
<< QgsExpressionContextUtils::mapSettingsScope( QgisApp::instance()->mapCanvas()->mapSettings() )
<< QgsExpressionContextUtils::layerScope( mLayer );
@@ -309,7 +309,7 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
// use visibility as selection
mLayersDependenciesTreeModel->setFlag( QgsLayerTreeModel::AllowNodeChangeVisibility );
- mLayersDependenciesTreeGroup->setVisible( Qt::Unchecked );
+ mLayersDependenciesTreeGroup->setItemVisibilityChecked( false );
QSet dependencySources;
Q_FOREACH ( const QgsMapLayerDependency& dep, mLayer->dependencies() )
@@ -318,7 +318,7 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
}
Q_FOREACH ( QgsLayerTreeLayer* layer, mLayersDependenciesTreeGroup->findLayers() )
{
- layer->setVisible( dependencySources.contains( layer->layerId() ) ? Qt::Checked : Qt::Unchecked );
+ layer->setItemVisibilityChecked( dependencySources.contains( layer->layerId() ) );
}
mLayersDependenciesTreeView->setModel( mLayersDependenciesTreeModel.data() );
@@ -693,7 +693,7 @@ QString QgsVectorLayerProperties::metadata()
void QgsVectorLayerProperties::on_mLayerOrigNameLineEdit_textEdited( const QString& text )
{
- txtDisplayName->setText( mLayer->capitaliseLayerName( text ) );
+ txtDisplayName->setText( mLayer->capitalizeLayerName( text ) );
}
void QgsVectorLayerProperties::on_mCrsSelector_crsChanged( const QgsCoordinateReferenceSystem& crs )
@@ -1333,7 +1333,7 @@ void QgsVectorLayerProperties::updateVariableEditor()
QgsExpressionContext context;
mVariableEditor->setContext( &context );
mVariableEditor->context()->appendScope( QgsExpressionContextUtils::globalScope() );
- mVariableEditor->context()->appendScope( QgsExpressionContextUtils::projectScope() );
+ mVariableEditor->context()->appendScope( QgsExpressionContextUtils::projectScope( QgsProject::instance() ) );
mVariableEditor->context()->appendScope( QgsExpressionContextUtils::layerScope( mLayer ) );
mVariableEditor->reloadContext();
mVariableEditor->setEditableScopeIndex( 2 );
diff --git a/src/app/qgsvectorlayerproperties.h b/src/app/qgsvectorlayerproperties.h
index ebfb3018c31..2be398d73f6 100644
--- a/src/app/qgsvectorlayerproperties.h
+++ b/src/app/qgsvectorlayerproperties.h
@@ -27,6 +27,7 @@
#include "qgsvectorlayer.h"
#include "layertree/qgslayertreemodel.h"
#include "layertree/qgslayertreegroup.h"
+#include "qgis_app.h"
class QgsMapLayer;
diff --git a/src/app/qgsversioninfo.cpp b/src/app/qgsversioninfo.cpp
index 973289e67df..9fb093430d5 100644
--- a/src/app/qgsversioninfo.cpp
+++ b/src/app/qgsversioninfo.cpp
@@ -15,7 +15,7 @@
#include "qgsversioninfo.h"
#include "qgis.h"
-
+#include "qgsapplication.h"
#include "qgsnetworkaccessmanager.h"
QgsVersionInfo::QgsVersionInfo( QObject *parent )
diff --git a/src/auth/basic/CMakeLists.txt b/src/auth/basic/CMakeLists.txt
index ec718bf39a9..cca6c9d43a4 100644
--- a/src/auth/basic/CMakeLists.txt
+++ b/src/auth/basic/CMakeLists.txt
@@ -19,6 +19,8 @@ INCLUDE_DIRECTORIES (
../../core
../../core/auth
../../core/geometry
+ ${CMAKE_BINARY_DIR}/src/core
+ ${CMAKE_BINARY_DIR}/src/gui
)
INCLUDE_DIRECTORIES (SYSTEM
${QCA_INCLUDE_DIR}
diff --git a/src/auth/identcert/CMakeLists.txt b/src/auth/identcert/CMakeLists.txt
index 4d15aabfd5d..0819efd5014 100644
--- a/src/auth/identcert/CMakeLists.txt
+++ b/src/auth/identcert/CMakeLists.txt
@@ -19,6 +19,8 @@ INCLUDE_DIRECTORIES (
../../core
../../core/auth
../../core/geometry
+ ${CMAKE_BINARY_DIR}/src/core
+ ${CMAKE_BINARY_DIR}/src/gui
)
INCLUDE_DIRECTORIES (SYSTEM
${QCA_INCLUDE_DIR}
diff --git a/src/auth/pkipaths/CMakeLists.txt b/src/auth/pkipaths/CMakeLists.txt
index c6bb95fd3f0..093078f347a 100644
--- a/src/auth/pkipaths/CMakeLists.txt
+++ b/src/auth/pkipaths/CMakeLists.txt
@@ -19,6 +19,8 @@ INCLUDE_DIRECTORIES (
../../core
../../core/auth
../../core/geometry
+ ${CMAKE_BINARY_DIR}/src/core
+ ${CMAKE_BINARY_DIR}/src/gui
)
INCLUDE_DIRECTORIES (SYSTEM
${QCA_INCLUDE_DIR}
diff --git a/src/auth/pkipkcs12/CMakeLists.txt b/src/auth/pkipkcs12/CMakeLists.txt
index 44f23bb6b34..39009b860b2 100644
--- a/src/auth/pkipkcs12/CMakeLists.txt
+++ b/src/auth/pkipkcs12/CMakeLists.txt
@@ -19,6 +19,8 @@ INCLUDE_DIRECTORIES (
../../core
../../core/auth
../../core/geometry
+ ${CMAKE_BINARY_DIR}/src/core
+ ${CMAKE_BINARY_DIR}/src/gui
)
INCLUDE_DIRECTORIES (SYSTEM
${QCA_INCLUDE_DIR}
diff --git a/src/browser/CMakeLists.txt b/src/browser/CMakeLists.txt
index 4864f78bebf..55b68facd7c 100644
--- a/src/browser/CMakeLists.txt
+++ b/src/browser/CMakeLists.txt
@@ -65,6 +65,8 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../gui/editorwidgets/core
${CMAKE_CURRENT_BINARY_DIR}/../ui
${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}/src/core
+ ${CMAKE_BINARY_DIR}/src/gui
)
INCLUDE_DIRECTORIES(SYSTEM
${GEOS_INCLUDE_DIR}
diff --git a/src/browser/main.cpp b/src/browser/main.cpp
index c4f4df0db7f..948d863817f 100644
--- a/src/browser/main.cpp
+++ b/src/browser/main.cpp
@@ -114,8 +114,6 @@ int main( int argc, char ** argv )
}
}
- QgsNetworkAccessManager::instance();
-
QgsBrowser w;
a.connect( &a, SIGNAL( aboutToQuit() ), &w, SLOT( saveWindowState() ) );
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index a7534fc6f97..ecfc306243c 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -903,6 +903,7 @@ ENDIF (QT_MOBILITY_LOCATION_FOUND OR Qt5Positioning_FOUND)
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
auth
composer
dxf
@@ -927,10 +928,6 @@ INCLUDE_DIRECTORIES(SYSTEM
${QCA_INCLUDE_DIR}
)
-REMOVE_DEFINITIONS("-DCORE_EXPORT=${DLLIMPORT}")
-ADD_DEFINITIONS("\"-DCORE_EXPORT=${DLLEXPORT}\"")
-
-
#for PAL classes
IF (WIN32)
ADD_DEFINITIONS("-D_HAVE_WINDOWS_H_")
@@ -946,6 +943,14 @@ ADD_DEFINITIONS(-DTEST_DATA_DIR="\\"${TEST_DATA_DIR}\\"")
ADD_LIBRARY(qgis_core SHARED ${QGIS_CORE_SRCS} ${QGIS_CORE_MOC_SRCS} ${QGIS_CORE_HDRS} ${QGIS_CORE_MOC_HDRS})
+GENERATE_EXPORT_HEADER(
+ qgis_core
+ BASE_NAME CORE
+ EXPORT_FILE_NAME qgis_core.h
+)
+
+SET(QGIS_CORE_HDRS ${QGIS_CORE_HDRS} ${CMAKE_CURRENT_BINARY_DIR}/qgis_core.h)
+
IF(ENABLE_MODELTEST)
TARGET_LINK_LIBRARIES(qgis_core ${QT_QTTEST_LIBRARY})
ENDIF(ENABLE_MODELTEST)
diff --git a/src/core/auth/qgsauthcertutils.h b/src/core/auth/qgsauthcertutils.h
index 8625c4587c8..119e61854dd 100644
--- a/src/core/auth/qgsauthcertutils.h
+++ b/src/core/auth/qgsauthcertutils.h
@@ -23,6 +23,8 @@
#include
#include
+#include "qgis_core.h"
+
class QgsAuthConfigSslServer;
#define SSL_ISSUER_INFO( var, prop ) var.issuerInfo( prop ).value(0)
diff --git a/src/core/auth/qgsauthconfig.cpp b/src/core/auth/qgsauthconfig.cpp
index 6c7d2704ff9..b3ab2272db0 100644
--- a/src/core/auth/qgsauthconfig.cpp
+++ b/src/core/auth/qgsauthconfig.cpp
@@ -357,18 +357,10 @@ QgsAuthConfigSslServer::QgsAuthConfigSslServer()
, mVersion( 1 )
{
// TODO: figure out if Qt 5 has changed yet again, e.g. TLS-only
-#if QT_VERSION >= 0x040800
mQtVersion = 480;
// Qt 4.8 defaults to SecureProtocols, i.e. TlsV1SslV3
// http://qt-project.org/doc/qt-4.8/qssl.html#SslProtocol-enum
mSslProtocol = QSsl::SecureProtocols;
-#else
- mQtVersion = 470;
- // older Qt 4.7 defaults to now-vulnerable SSLv3
- // http://qt-project.org/doc/qt-4.7/qssl.html
- // Default this to TlsV1 instead
- mSslProtocol = QSsl::TlsV1;
-#endif
}
const QList QgsAuthConfigSslServer::sslIgnoredErrors() const
diff --git a/src/core/auth/qgsauthconfig.h b/src/core/auth/qgsauthconfig.h
index ac103fd2700..f98abada01d 100644
--- a/src/core/auth/qgsauthconfig.h
+++ b/src/core/auth/qgsauthconfig.h
@@ -17,6 +17,7 @@
#ifndef QGSAUTHCONFIG_H
#define QGSAUTHCONFIG_H
+#include "qgis_core.h"
#include
#include
@@ -299,8 +300,6 @@ class CORE_EXPORT QgsAuthConfigSslServer
//! Construct a default SSL server configuration
QgsAuthConfigSslServer();
- ~QgsAuthConfigSslServer() {}
-
//! Server certificate object
const QSslCertificate sslCertificate() const { return mSslCert; }
//! Set server certificate object
diff --git a/src/core/auth/qgsauthcrypto.h b/src/core/auth/qgsauthcrypto.h
index 0625804054c..9469b95f679 100644
--- a/src/core/auth/qgsauthcrypto.h
+++ b/src/core/auth/qgsauthcrypto.h
@@ -20,6 +20,8 @@
#include
#include
+#include "qgis_core.h"
+
/** \ingroup core
* Funtions for hashing/checking master password and encrypt/decrypting data with password
* \since 2.8
diff --git a/src/core/auth/qgsauthmanager.h b/src/core/auth/qgsauthmanager.h
index 9f241f9c727..e4f47473c1e 100644
--- a/src/core/auth/qgsauthmanager.h
+++ b/src/core/auth/qgsauthmanager.h
@@ -17,6 +17,7 @@
#ifndef QGSAUTHMANAGER_H
#define QGSAUTHMANAGER_H
+#include "qgis_core.h"
#include
#include
#include
diff --git a/src/core/auth/qgsauthmethod.h b/src/core/auth/qgsauthmethod.h
index 08cc9b3ab52..c72d628c7aa 100644
--- a/src/core/auth/qgsauthmethod.h
+++ b/src/core/auth/qgsauthmethod.h
@@ -24,6 +24,8 @@
#include
#include
+#include "qgis_core.h"
+
class QgsAuthMethodConfig;
/** \ingroup core
@@ -53,8 +55,6 @@ class CORE_EXPORT QgsAuthMethod : public QObject
};
Q_DECLARE_FLAGS( Expansions, Expansion )
- virtual ~QgsAuthMethod() {}
-
//! A non-translated short name representing the auth method
virtual QString key() const = 0;
diff --git a/src/core/auth/qgsauthmethodmetadata.h b/src/core/auth/qgsauthmethodmetadata.h
index 7f80a94bb3e..3cae0e4f291 100644
--- a/src/core/auth/qgsauthmethodmetadata.h
+++ b/src/core/auth/qgsauthmethodmetadata.h
@@ -19,6 +19,8 @@
#include
+#include "qgis_core.h"
+
/** \ingroup core
* Holds data auth method key, description, and associated shared library file information.
diff --git a/src/core/auth/qgsauthmethodregistry.cpp b/src/core/auth/qgsauthmethodregistry.cpp
index 62bc0381ea4..2c80fa56726 100644
--- a/src/core/auth/qgsauthmethodregistry.cpp
+++ b/src/core/auth/qgsauthmethodregistry.cpp
@@ -324,7 +324,6 @@ QWidget *QgsAuthMethodRegistry::editWidget( const QString &authMethodKey, QWidge
return editFactory( parent );
}
-#if QT_VERSION >= 0x050000
QFunctionPointer QgsAuthMethodRegistry::function( QString const & authMethodKey,
QString const & functionName )
{
@@ -342,25 +341,6 @@ QFunctionPointer QgsAuthMethodRegistry::function( QString const & authMethodKey,
return 0;
}
}
-#else
-void *QgsAuthMethodRegistry::function( QString const & authMethodKey,
- QString const & functionName )
-{
- QLibrary myLib( library( authMethodKey ) );
-
- QgsDebugMsg( "Library name is " + myLib.fileName() );
-
- if ( myLib.load() )
- {
- return myLib.resolve( functionName.toLatin1().data() );
- }
- else
- {
- QgsDebugMsg( "Cannot load library: " + myLib.errorString() );
- return nullptr;
- }
-}
-#endif
QLibrary *QgsAuthMethodRegistry::authMethodLibrary( const QString &authMethodKey ) const
{
diff --git a/src/core/auth/qgsauthmethodregistry.h b/src/core/auth/qgsauthmethodregistry.h
index 1b6054efdb4..857316b113a 100644
--- a/src/core/auth/qgsauthmethodregistry.h
+++ b/src/core/auth/qgsauthmethodregistry.h
@@ -22,6 +22,8 @@
#include
#include
+#include "qgis_core.h"
+
class QgsAuthMethod;
class QgsAuthMethodMetadata;
@@ -76,8 +78,6 @@ class CORE_EXPORT QgsAuthMethodRegistry
*/
QWidget *editWidget( const QString & authMethodKey, QWidget * parent = nullptr );
-#if QT_VERSION >= 0x050000
-
/** Get pointer to auth method function
@param authMethodKey identificator of the auth method
@param functionName name of function
@@ -85,16 +85,6 @@ class CORE_EXPORT QgsAuthMethodRegistry
*/
QFunctionPointer function( const QString & authMethodKey,
const QString & functionName );
-#else
-
- /** Get pointer to auth method function
- @param authMethodKey identificator of the auth method
- @param functionName name of function
- @return pointer to function or nullptr on error
- */
- void *function( const QString & authMethodKey,
- const QString & functionName );
-#endif
//! Return the library object associated with an auth method key
QLibrary *authMethodLibrary( const QString & authMethodKey ) const;
diff --git a/src/core/composer/qgsaddremoveitemcommand.cpp b/src/core/composer/qgsaddremoveitemcommand.cpp
index aee29dc9b9c..42e1f815943 100644
--- a/src/core/composer/qgsaddremoveitemcommand.cpp
+++ b/src/core/composer/qgsaddremoveitemcommand.cpp
@@ -80,5 +80,5 @@ void QgsAddRemoveItemCommand::switchState()
emit itemAdded( mItem );
mState = Added;
}
- QgsProject::instance()->setDirty( true );
+ mComposition->project()->setDirty( true );
}
diff --git a/src/core/composer/qgsaddremoveitemcommand.h b/src/core/composer/qgsaddremoveitemcommand.h
index 11a4aa08cce..e1ead45e5e1 100644
--- a/src/core/composer/qgsaddremoveitemcommand.h
+++ b/src/core/composer/qgsaddremoveitemcommand.h
@@ -19,6 +19,9 @@
#define QGSADDREMOVEITEMCOMMAND_H
#include
+
+#include "qgis_core.h"
+
class QgsComposerItem;
class QgsComposition;
diff --git a/src/core/composer/qgsaddremovemultiframecommand.cpp b/src/core/composer/qgsaddremovemultiframecommand.cpp
index edb4aef10b8..f9d968e5a1f 100644
--- a/src/core/composer/qgsaddremovemultiframecommand.cpp
+++ b/src/core/composer/qgsaddremovemultiframecommand.cpp
@@ -78,7 +78,7 @@ void QgsAddRemoveMultiFrameCommand::switchState()
mComposition->addMultiFrame( mMultiFrame );
mState = Added;
}
- QgsProject::instance()->setDirty( true );
+ mComposition->project()->setDirty( true );
}
}
diff --git a/src/core/composer/qgsaddremovemultiframecommand.h b/src/core/composer/qgsaddremovemultiframecommand.h
index 3a216c007a2..74f32b20125 100644
--- a/src/core/composer/qgsaddremovemultiframecommand.h
+++ b/src/core/composer/qgsaddremovemultiframecommand.h
@@ -20,6 +20,8 @@
#include
+#include "qgis_core.h"
+
class QgsComposerMultiFrame;
class QgsComposition;
diff --git a/src/core/composer/qgsatlascomposition.cpp b/src/core/composer/qgsatlascomposition.cpp
index 005c4264556..ba2fd16aa19 100644
--- a/src/core/composer/qgsatlascomposition.cpp
+++ b/src/core/composer/qgsatlascomposition.cpp
@@ -45,11 +45,7 @@ QgsAtlasComposition::QgsAtlasComposition( QgsComposition* composition )
{
//listen out for layer removal
- connect( QgsProject::instance(), SIGNAL( layersWillBeRemoved( QStringList ) ), this, SLOT( removeLayers( QStringList ) ) );
-}
-
-QgsAtlasComposition::~QgsAtlasComposition()
-{
+ connect( mComposition->project(), SIGNAL( layersWillBeRemoved( QStringList ) ), this, SLOT( removeLayers( QStringList ) ) );
}
void QgsAtlasComposition::setEnabled( bool enabled )
@@ -629,7 +625,7 @@ void QgsAtlasComposition::readXml( const QDomElement& atlasElem, const QDomDocum
// look for stored layer name
QString coverageLayerId = atlasElem.attribute( QStringLiteral( "coverageLayer" ) );
- mCoverageLayer = qobject_cast( QgsProject::instance()->mapLayer( coverageLayerId ) );
+ mCoverageLayer = qobject_cast( mComposition->project()->mapLayer( coverageLayerId ) );
mPageNameExpression = atlasElem.attribute( QStringLiteral( "pageNameExpression" ), QString() );
mSingleFile = atlasElem.attribute( QStringLiteral( "singleFile" ), QStringLiteral( "false" ) ) == QLatin1String( "true" ) ? true : false;
@@ -722,7 +718,7 @@ QgsExpressionContext QgsAtlasComposition::createExpressionContext()
{
QgsExpressionContext expressionContext;
expressionContext << QgsExpressionContextUtils::globalScope()
- << QgsExpressionContextUtils::projectScope();
+ << QgsExpressionContextUtils::projectScope( mComposition->project() );
if ( mComposition )
expressionContext << QgsExpressionContextUtils::compositionScope( mComposition );
diff --git a/src/core/composer/qgsatlascomposition.h b/src/core/composer/qgsatlascomposition.h
index 3ce5f287166..e7529f9ad52 100644
--- a/src/core/composer/qgsatlascomposition.h
+++ b/src/core/composer/qgsatlascomposition.h
@@ -16,9 +16,11 @@
#ifndef QGSATLASCOMPOSITION_H
#define QGSATLASCOMPOSITION_H
+#include "qgis_core.h"
#include "qgsfeature.h"
#include "qgsgeometry.h"
#include "qgsrectangle.h"
+#include "qgsexpression.h"
#include
#include
@@ -45,7 +47,6 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
Q_OBJECT
public:
QgsAtlasComposition( QgsComposition* composition );
- ~QgsAtlasComposition();
/** Returns whether the atlas generation is enabled
* @returns true if atlas is enabled
diff --git a/src/core/composer/qgscomposerarrow.cpp b/src/core/composer/qgscomposerarrow.cpp
index 9b710994082..0352e56998f 100644
--- a/src/core/composer/qgscomposerarrow.cpp
+++ b/src/core/composer/qgscomposerarrow.cpp
@@ -258,7 +258,7 @@ void QgsComposerArrow::drawSVGMarker( QPainter* p, MarkerType type, const QStrin
return;
QSvgRenderer r;
- const QByteArray &svgContent = QgsSvgCache::instance()->svgContent( svgFileName, mArrowHeadWidth, mArrowHeadFillColor, mArrowHeadOutlineColor, mArrowHeadOutlineWidth,
+ const QByteArray &svgContent = QgsApplication::svgCache()->svgContent( svgFileName, mArrowHeadWidth, mArrowHeadFillColor, mArrowHeadOutlineColor, mArrowHeadOutlineWidth,
1.0, 1.0 );
r.load( svgContent );
diff --git a/src/core/composer/qgscomposerarrow.h b/src/core/composer/qgscomposerarrow.h
index 9d2cf13d350..5e929ada1e7 100644
--- a/src/core/composer/qgscomposerarrow.h
+++ b/src/core/composer/qgscomposerarrow.h
@@ -18,6 +18,7 @@
#ifndef QGSCOMPOSERARROW_H
#define QGSCOMPOSERARROW_H
+#include "qgis_core.h"
#include "qgscomposeritem.h"
#include
#include
diff --git a/src/core/composer/qgscomposerattributetablemodelv2.cpp b/src/core/composer/qgscomposerattributetablemodelv2.cpp
index e7ccb3401e7..0569469a1d8 100644
--- a/src/core/composer/qgscomposerattributetablemodelv2.cpp
+++ b/src/core/composer/qgscomposerattributetablemodelv2.cpp
@@ -26,12 +26,6 @@
QgsComposerAttributeTableColumnModelV2::QgsComposerAttributeTableColumnModelV2( QgsComposerAttributeTableV2 *composerTable, QObject *parent ) : QAbstractTableModel( parent )
, mComposerTable( composerTable )
{
-
-}
-
-QgsComposerAttributeTableColumnModelV2::~QgsComposerAttributeTableColumnModelV2()
-{
-
}
QModelIndex QgsComposerAttributeTableColumnModelV2::index( int row, int column, const QModelIndex &parent ) const
@@ -451,11 +445,6 @@ QgsComposerTableSortColumnsProxyModelV2::QgsComposerTableSortColumnsProxyModelV2
setDynamicSortFilter( true );
}
-QgsComposerTableSortColumnsProxyModelV2::~QgsComposerTableSortColumnsProxyModelV2()
-{
-
-}
-
bool QgsComposerTableSortColumnsProxyModelV2::filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const
{
//get QgsComposerTableColumn corresponding to row
diff --git a/src/core/composer/qgscomposerattributetablemodelv2.h b/src/core/composer/qgscomposerattributetablemodelv2.h
index f1b6a648710..36c698af0dc 100644
--- a/src/core/composer/qgscomposerattributetablemodelv2.h
+++ b/src/core/composer/qgscomposerattributetablemodelv2.h
@@ -21,6 +21,8 @@
#include
#include
+#include "qgis_core.h"
+
class QgsComposerAttributeTableV2;
class QgsComposerTableColumn;
@@ -48,7 +50,6 @@ class CORE_EXPORT QgsComposerAttributeTableColumnModelV2: public QAbstractTableM
* @param parent optional parent
*/
QgsComposerAttributeTableColumnModelV2( QgsComposerAttributeTableV2 *composerTable, QObject *parent = nullptr );
- virtual ~QgsComposerAttributeTableColumnModelV2();
virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const override;
int columnCount( const QModelIndex &parent = QModelIndex() ) const override;
@@ -150,8 +151,6 @@ class CORE_EXPORT QgsComposerTableSortColumnsProxyModelV2: public QSortFilterPro
*/
QgsComposerTableSortColumnsProxyModelV2( QgsComposerAttributeTableV2 *composerTable, ColumnFilterType filterType, QObject *parent = nullptr );
- virtual ~QgsComposerTableSortColumnsProxyModelV2();
-
bool lessThan( const QModelIndex &left, const QModelIndex &right ) const override;
int columnCount( const QModelIndex &parent = QModelIndex() ) const override;
virtual QVariant data( const QModelIndex &index, int role ) const override;
diff --git a/src/core/composer/qgscomposerattributetablev2.cpp b/src/core/composer/qgscomposerattributetablev2.cpp
index 24b047f95b3..1dded1b143f 100644
--- a/src/core/composer/qgscomposerattributetablev2.cpp
+++ b/src/core/composer/qgscomposerattributetablev2.cpp
@@ -62,7 +62,7 @@ QgsComposerAttributeTableV2::QgsComposerAttributeTableV2( QgsComposition* compos
, mFeatureFilter( QLatin1String( "" ) )
{
//set first vector layer from layer registry as default one
- QMap layerMap = QgsProject::instance()->mapLayers();
+ QMap layerMap = mComposition->project()->mapLayers();
QMap::const_iterator mapIt = layerMap.constBegin();
for ( ; mapIt != layerMap.constEnd(); ++mapIt )
{
@@ -79,10 +79,11 @@ QgsComposerAttributeTableV2::QgsComposerAttributeTableV2( QgsComposition* compos
//listen for modifications to layer and refresh table when they occur
connect( mVectorLayer, SIGNAL( layerModified() ), this, SLOT( refreshAttributes() ) );
}
- connect( QgsProject::instance(), SIGNAL( layerWillBeRemoved( QString ) ), this, SLOT( removeLayer( const QString& ) ) );
if ( mComposition )
{
+ connect( mComposition->project(), SIGNAL( layerWillBeRemoved( QString ) ), this, SLOT( removeLayer( const QString& ) ) );
+
//refresh table attributes when composition is refreshed
connect( mComposition, SIGNAL( refreshItemsTriggered() ), this, SLOT( refreshAttributes() ) );
@@ -95,10 +96,6 @@ QgsComposerAttributeTableV2::QgsComposerAttributeTableV2( QgsComposition* compos
refreshAttributes();
}
-QgsComposerAttributeTableV2::~QgsComposerAttributeTableV2()
-{
-}
-
QString QgsComposerAttributeTableV2::displayName() const
{
return tr( "" );
@@ -144,7 +141,7 @@ void QgsComposerAttributeTableV2::setRelationId( const QString& relationId )
QgsVectorLayer* prevLayer = sourceLayer();
mRelationId = relationId;
- QgsRelation relation = QgsProject::instance()->relationManager()->relation( mRelationId );
+ QgsRelation relation = mComposition->project()->relationManager()->relation( mRelationId );
QgsVectorLayer* newLayer = relation.referencingLayer();
if ( mSource == QgsComposerAttributeTableV2::RelationChildren && newLayer != prevLayer )
@@ -442,7 +439,7 @@ bool QgsComposerAttributeTableV2::getTableContents( QgsComposerTableContents &co
if ( mSource == QgsComposerAttributeTableV2::RelationChildren )
{
- QgsRelation relation = QgsProject::instance()->relationManager()->relation( mRelationId );
+ QgsRelation relation = mComposition->project()->relationManager()->relation( mRelationId );
QgsFeature atlasFeature = mComposition->atlasComposition().feature();
req = relation.getRelatedFeaturesRequest( atlasFeature );
}
@@ -568,7 +565,7 @@ QgsVectorLayer *QgsComposerAttributeTableV2::sourceLayer()
return mVectorLayer;
case QgsComposerAttributeTableV2::RelationChildren:
{
- QgsRelation relation = QgsProject::instance()->relationManager()->relation( mRelationId );
+ QgsRelation relation = mComposition->project()->relationManager()->relation( mRelationId );
return relation.referencingLayer();
}
}
@@ -735,7 +732,7 @@ bool QgsComposerAttributeTableV2::readXml( const QDomElement& itemElem, const QD
}
else
{
- QgsMapLayer* ml = QgsProject::instance()->mapLayer( layerId );
+ QgsMapLayer* ml = mComposition->project()->mapLayer( layerId );
if ( ml )
{
mVectorLayer = dynamic_cast( ml );
diff --git a/src/core/composer/qgscomposerattributetablev2.h b/src/core/composer/qgscomposerattributetablev2.h
index fde6a128b34..f2569053f37 100644
--- a/src/core/composer/qgscomposerattributetablev2.h
+++ b/src/core/composer/qgscomposerattributetablev2.h
@@ -18,6 +18,7 @@
#ifndef QGSCOMPOSERATTRIBUTETABLEV2_H
#define QGSCOMPOSERATTRIBUTETABLEV2_H
+#include "qgis_core.h"
#include "qgscomposertablev2.h"
class QgsComposerMap;
@@ -67,7 +68,6 @@ class CORE_EXPORT QgsComposerAttributeTableV2: public QgsComposerTableV2
};
QgsComposerAttributeTableV2( QgsComposition* composition, bool createUndoCommands );
- ~QgsComposerAttributeTableV2();
virtual QString displayName() const override;
@@ -101,7 +101,7 @@ class CORE_EXPORT QgsComposerAttributeTableV2: public QgsComposerTableV2
*/
ContentSource source() const { return mSource; }
- /** Returns the source layer for the table, considering the table source mode. Eg,
+ /** Returns the source layer for the table, considering the table source mode. For example,
* if the table is set to atlas feature mode, then the source layer will be the
* atlas coverage layer. If the table is set to layer attributes mode, then
* the source layer will be the user specified vector layer.
diff --git a/src/core/composer/qgscomposereffect.cpp b/src/core/composer/qgscomposereffect.cpp
index 1cb4ff57ca9..895dcd77d72 100644
--- a/src/core/composer/qgscomposereffect.cpp
+++ b/src/core/composer/qgscomposereffect.cpp
@@ -24,10 +24,6 @@ QgsComposerEffect::QgsComposerEffect()
{
}
-QgsComposerEffect::~QgsComposerEffect()
-{
-}
-
void QgsComposerEffect::draw( QPainter *painter )
{
QPoint offset;
diff --git a/src/core/composer/qgscomposereffect.h b/src/core/composer/qgscomposereffect.h
index d6069a6d43d..a9afdfe3b5e 100644
--- a/src/core/composer/qgscomposereffect.h
+++ b/src/core/composer/qgscomposereffect.h
@@ -21,6 +21,8 @@
#include
#include
+#include "qgis_core.h"
+
/** \ingroup core
* \class QgsComposerEffect
*/
@@ -30,7 +32,6 @@ class CORE_EXPORT QgsComposerEffect : public QGraphicsEffect
public:
QgsComposerEffect();
- ~QgsComposerEffect();
void setCompositionMode( QPainter::CompositionMode compositionMode );
diff --git a/src/core/composer/qgscomposerframe.cpp b/src/core/composer/qgscomposerframe.cpp
index 6efc2194901..0fc39afa9eb 100644
--- a/src/core/composer/qgscomposerframe.cpp
+++ b/src/core/composer/qgscomposerframe.cpp
@@ -46,10 +46,6 @@ QgsComposerFrame::QgsComposerFrame()
setBackgroundEnabled( false );
}
-QgsComposerFrame::~QgsComposerFrame()
-{
-}
-
bool QgsComposerFrame::writeXml( QDomElement& elem, QDomDocument & doc ) const
{
QDomElement frameElem = doc.createElement( QStringLiteral( "ComposerFrame" ) );
diff --git a/src/core/composer/qgscomposerframe.h b/src/core/composer/qgscomposerframe.h
index 323565a59f5..1eefd82b0e4 100644
--- a/src/core/composer/qgscomposerframe.h
+++ b/src/core/composer/qgscomposerframe.h
@@ -16,6 +16,7 @@
#ifndef QGSCOMPOSERFRAME_H
#define QGSCOMPOSERFRAME_H
+#include "qgis_core.h"
#include "qgscomposeritem.h"
class QgsComposition;
@@ -31,8 +32,6 @@ class CORE_EXPORT QgsComposerFrame: public QgsComposerItem
public:
QgsComposerFrame( QgsComposition* c, QgsComposerMultiFrame* mf, qreal x, qreal y, qreal width, qreal height );
- ~QgsComposerFrame();
-
/** Sets the visible part of the multiframe's content which is visible within
* this frame (relative to the total multiframe extent in mm).
* @param section visible portion of content
diff --git a/src/core/composer/qgscomposerhtml.cpp b/src/core/composer/qgscomposerhtml.cpp
index 18bbbc2059e..c59622384c9 100644
--- a/src/core/composer/qgscomposerhtml.cpp
+++ b/src/core/composer/qgscomposerhtml.cpp
@@ -185,7 +185,7 @@ void QgsComposerHtml::loadHtml( const bool useCache, const QgsExpressionContext
//set html, using the specified url as base if in Url mode or the project file if in manual mode
const QUrl baseUrl = mContentMode == QgsComposerHtml::Url ?
QUrl( mActualFetchedUrl ) :
- QUrl::fromLocalFile( QgsProject::instance()->fileInfo().absoluteFilePath() );
+ QUrl::fromLocalFile( mComposition->project()->fileInfo().absoluteFilePath() );
mWebPage->mainFrame()->setHtml( loadedHtml, baseUrl );
//set user stylesheet
@@ -547,8 +547,8 @@ void QgsComposerHtml::setExpressionContext( const QgsFeature &feature, QgsVector
if ( mComposition )
{
mDistanceArea->setEllipsoidalMode( mComposition->mapSettings().hasCrsTransformEnabled() );
+ mDistanceArea->setEllipsoid( mComposition->project()->ellipsoid() );
}
- mDistanceArea->setEllipsoid( QgsProject::instance()->ellipsoid() );
// create JSON representation of feature
QgsJSONExporter exporter( layer );
diff --git a/src/core/composer/qgscomposerhtml.h b/src/core/composer/qgscomposerhtml.h
index d083c6192f7..c915d17edff 100644
--- a/src/core/composer/qgscomposerhtml.h
+++ b/src/core/composer/qgscomposerhtml.h
@@ -16,6 +16,7 @@
#ifndef QGSCOMPOSERHTML_H
#define QGSCOMPOSERHTML_H
+#include "qgis_core.h"
#include "qgscomposermultiframe.h"
#include "qgsfeature.h"
#include
diff --git a/src/core/composer/qgscomposeritem.h b/src/core/composer/qgscomposeritem.h
index 05f4580e432..d96f287623e 100644
--- a/src/core/composer/qgscomposeritem.h
+++ b/src/core/composer/qgscomposeritem.h
@@ -17,6 +17,7 @@
#ifndef QGSCOMPOSERITEM_H
#define QGSCOMPOSERITEM_H
+#include "qgis_core.h"
#include "qgscomposeritemcommand.h"
#include "qgscomposerobject.h"
#include
@@ -375,7 +376,7 @@ class CORE_EXPORT QgsComposerItem: public QgsComposerObject, public QGraphicsRec
*/
void setTransparency( const int transparency );
- /** Returns whether effects (eg blend modes) are enabled for the item
+ /** Returns whether effects (e.g., blend modes) are enabled for the item
* @returns true if effects are enabled
* @see setEffectsEnabled
* @see transparency
@@ -383,7 +384,7 @@ class CORE_EXPORT QgsComposerItem: public QgsComposerObject, public QGraphicsRec
*/
bool effectsEnabled() const { return mEffectsEnabled; }
- /** Sets whether effects (eg blend modes) are enabled for the item
+ /** Sets whether effects (e.g., blend modes) are enabled for the item
* @param effectsEnabled set to true to enable effects
* @see effectsEnabled
* @see setTransparency
@@ -467,7 +468,7 @@ class CORE_EXPORT QgsComposerItem: public QgsComposerObject, public QGraphicsRec
/** Sets visibility for item.
* @param visible set to true to show item, false to hide item
* @note QGraphicsItem::setVisible should not be called directly
- * on a QgsComposerItem, as some item types (eg groups) need to override
+ * on a QgsComposerItem, as some item types (e.g., groups) need to override
* the visibility toggle.
* @note added in version 2.5
*/
diff --git a/src/core/composer/qgscomposeritemcommand.cpp b/src/core/composer/qgscomposeritemcommand.cpp
index 8c29729d941..233a0b01f5f 100644
--- a/src/core/composer/qgscomposeritemcommand.cpp
+++ b/src/core/composer/qgscomposeritemcommand.cpp
@@ -19,6 +19,7 @@
#include "qgscomposeritem.h"
#include "qgscomposerframe.h"
#include "qgscomposermultiframe.h"
+#include "qgscomposition.h"
#include "qgsproject.h"
#include "qgslogger.h"
@@ -39,10 +40,6 @@ QgsComposerItemCommand::QgsComposerItemCommand( QgsComposerItem* item, const QSt
}
}
-QgsComposerItemCommand::~QgsComposerItemCommand()
-{
-}
-
void QgsComposerItemCommand::undo()
{
restoreState( mPreviousState );
@@ -118,7 +115,7 @@ void QgsComposerItemCommand::restoreState( QDomDocument& stateDoc ) const
destItem->readXml( stateDoc.documentElement().firstChild().toElement(), stateDoc );
destItem->repaint();
- QgsProject::instance()->setDirty( true );
+ destItem->composition()->project()->setDirty( true );
}
//
@@ -131,10 +128,6 @@ QgsComposerMergeCommand::QgsComposerMergeCommand( Context c, QgsComposerItem* it
{
}
-QgsComposerMergeCommand::~QgsComposerMergeCommand()
-{
-}
-
bool QgsComposerMergeCommand::mergeWith( const QUndoCommand * command )
{
QgsComposerItem* thisItem = item();
diff --git a/src/core/composer/qgscomposeritemcommand.h b/src/core/composer/qgscomposeritemcommand.h
index 00ca73049f4..49c765743c2 100644
--- a/src/core/composer/qgscomposeritemcommand.h
+++ b/src/core/composer/qgscomposeritemcommand.h
@@ -21,6 +21,8 @@
#include
#include
+#include "qgis_core.h"
+
class QgsComposerItem;
class QgsComposerMultiFrame;
@@ -31,7 +33,6 @@ class CORE_EXPORT QgsComposerItemCommand: public QUndoCommand
{
public:
QgsComposerItemCommand( QgsComposerItem* item, const QString& text, QUndoCommand* parent = nullptr );
- virtual ~QgsComposerItemCommand();
//! Reverses the command
void undo() override;
@@ -157,7 +158,6 @@ class CORE_EXPORT QgsComposerMergeCommand: public QgsComposerItemCommand
};
QgsComposerMergeCommand( Context c, QgsComposerItem* item, const QString& text );
- ~QgsComposerMergeCommand();
bool mergeWith( const QUndoCommand * command ) override;
int id() const override { return static_cast< int >( mContext ); }
diff --git a/src/core/composer/qgscomposeritemgroup.h b/src/core/composer/qgscomposeritemgroup.h
index 09e3132963a..8ab27ed3b63 100644
--- a/src/core/composer/qgscomposeritemgroup.h
+++ b/src/core/composer/qgscomposeritemgroup.h
@@ -17,6 +17,7 @@
#ifndef QGSCOMPOSERITEMGROUP_H
#define QGSCOMPOSERITEMGROUP_H
+#include "qgis_core.h"
#include "qgscomposeritem.h"
#include