Merge branch 'master' into regularShape_gui

This commit is contained in:
lbartoletti 2017-09-06 21:55:33 +02:00 committed by GitHub
commit e57c3b3974
1186 changed files with 21451 additions and 12550 deletions

View File

@ -13,6 +13,8 @@
# #
###########################################################################
set -e
export PYTHONPATH=${HOME}/osgeo4travis/lib/python3.3/site-packages/
export PATH=${HOME}/osgeo4travis/bin:${HOME}/osgeo4travis/sbin:${HOME}/OTB-5.6.0-Linux64/bin:${PATH}
export LD_LIBRARY_PATH=${HOME}/osgeo4travis/lib
@ -27,18 +29,17 @@ 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
export CTEST_BUILD_COMMAND="/usr/bin/make -j3 -i -k"
export CTEST_BUILD_COMMAND="/usr/bin/make -j3 -i"
# This works around an issue where travis would timeout on master because
# This works around an issue where travis would timeout because
# when make is run inside ctest no output is generated. At the current time
# nobody know why, but at least this workaround gets travis results for master
# nobody know why, but at least this workaround gets travis results
# back. Better approaches VERY welcome.
if [[ ${TRAVIS_PULL_REQUEST} == "false" ]];
then
pushd build
$CTEST_BUILD_COMMAND
popd
fi
pushd build
echo "travis_fold:start:qgis_build"
$CTEST_BUILD_COMMAND
echo "travis_fold:end:qgis_build"
popd
python ${TRAVIS_BUILD_DIR}/.ci/travis/scripts/ctest2travis.py \
xvfb-run ctest -V -E "$(cat ${DIR}/blacklist.txt | sed -r '/^(#.*?)?$/d' | paste -sd '|' -)" -S ${DIR}/../travis.ctest --output-on-failure

1
.gitignore vendored
View File

@ -61,6 +61,7 @@ tests/testdata/grass/wgs84/test/.gislock
tests/testdata/grass/wgs84/test6/.gislock
tests/testdata/grass/wgs84/test7/.gislock
tests/testdata/*.aux.xml
tests/testdata/landsat-int16-b1.tif.aux.xml
tests/testdata/raster/*.aux.xml
tests/testdata/raster/band1_byte_noct_epsg4326.tif.aux.xml
tests/testdata/raster/band1_float32_noct_epsg4326.tif.aux.xml

View File

@ -66,18 +66,18 @@ matrix:
- coreutils
- libyaml-tiny-perl
# OSX based build with QT4 and Python 2
- os: osx
osx_image: xcode8.3 # MacOS 10.12: Sierra
cache:
pip: true
directories:
- $HOME/.ccache
env:
- TRAVIS_CONFIG=macos
- IGNORE_BUILD_FAILURES=YES
allow_failures:
- os: osx
# - os: osx
# osx_image: xcode8.3 # MacOS 10.12: Sierra
# cache:
# pip: true
# directories:
# - $HOME/.ccache
# env:
# - TRAVIS_CONFIG=macos
# - IGNORE_BUILD_FAILURES=YES
#
# allow_failures:
# - os: osx
git:
depth: 30

View File

@ -581,7 +581,6 @@ IF (WITH_CORE)
#hoops to escape compiler directives then
IF(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
cmake_policy(SET CMP0005 OLD)
IF(NOT "${CMAKE_VERSION}" VERSION_LESS "3.3")
cmake_policy(SET CMP0063 NEW)
ENDIF(NOT "${CMAKE_VERSION}" VERSION_LESS "3.3")

View File

@ -17,6 +17,8 @@ WORKDIR /usr/src/QGIS/build
RUN cmake \
-GNinja \
-DCMAKE_INSTALL_PREFIX=/usr \
-DBINDINGS_GLOBAL_INSTALL=ON \
-DWITH_STAGED_PLUGINS=ON \
-DWITH_GRASS=ON \
-DSUPPRESS_QT_WARNINGS=ON \
@ -30,4 +32,6 @@ RUN cmake \
-DDISABLE_DEPRECATED=ON \
.. \
&& ninja install \
&& rm -rf /usr/src/QGIS/build/*
&& rm -rf /usr/src/QGIS
WORKDIR /

View File

@ -102,7 +102,7 @@ Required build dependencies:
- Sqlite3 >= 3.0.0
- SpatiaLite
- libspatialindex
- GDAL/OGR >= 2.0
- GDAL/OGR >= 2.1
- Qwt >= 5.0 & (< 6.1 with internal QwtPolar)
- expat >= 1.95
- QScintilla2

View File

@ -27,7 +27,7 @@ modified.
## Supported raster formats include:
* Grass
* GRASS
* USGS DEM
* ArcInfo binary grid
* ArcInfo ASCII grid

View File

@ -62,8 +62,11 @@ ELSE(WIN32)
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 2)
MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 2.0 or higher.")
MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 2.1 or higher.")
ENDIF (GDAL_VERSION_MAJOR LESS 2)
IF ( (GDAL_VERSION_MAJOR EQUAL 2) AND (GDAL_VERSION_MINOR LESS 1) )
MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 2.1 or higher.")
ENDIF( (GDAL_VERSION_MAJOR EQUAL 2) AND (GDAL_VERSION_MINOR LESS 1) )
ENDIF (GDAL_LIBRARY)
SET (CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_save} CACHE STRING "" FORCE)
@ -101,10 +104,13 @@ ELSE(WIN32)
# check for gdal version
# version 1.2.5 is known NOT to be supported (missing CPL_STDCALL macro)
# According to INSTALL, 2.0+ is required
# According to INSTALL, 2.1+ is required
IF (GDAL_VERSION_MAJOR LESS 2)
MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 2.0 or higher.")
MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 2.1 or higher.")
ENDIF (GDAL_VERSION_MAJOR LESS 2)
IF ( (GDAL_VERSION_MAJOR EQUAL 2) AND (GDAL_VERSION_MINOR LESS 1) )
MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 2.1 or higher.")
ENDIF( (GDAL_VERSION_MAJOR EQUAL 2) AND (GDAL_VERSION_MINOR LESS 1) )
# set INCLUDE_DIR to prefix+include
EXEC_PROGRAM(${GDAL_CONFIG}

View File

@ -107,7 +107,7 @@ ELSE(WIN32)
# MESSAGE("DBG GSL_LINK_DIRECTORIES=${GSL_LINK_DIRECTORIES}")
# MESSAGE("DBG GSL_EXE_LINKER_FLAGS=${GSL_EXE_LINKER_FLAGS}")
# ADD_DEFINITIONS("-DHAVE_GSL")
# ADD_DEFINITIONS(-DHAVE_GSL)
# SET(GSL_DEFINITIONS "-DHAVE_GSL")
MARK_AS_ADVANCED(
GSL_CXX_FLAGS

View File

@ -48,11 +48,11 @@ FIND_OSGEARTH_INCLUDE( OSGEARTH_ELEVATION_QUERY osgEarth/ElevationQuery )
###### libraries ######
MACRO( FIND_OSGEARTH_LIBRARY MYLIBRARY MYLIBRARYNAME )
MACRO( FIND_OSGEARTH_LIBRARY MYLIBRARY )
FIND_LIBRARY(${MYLIBRARY}
NAMES
${MYLIBRARYNAME}
${ARGN}
PATHS
${OSGEARTH_DIR}
$ENV{OSGEARTH_BUILD_DIR}
@ -93,8 +93,8 @@ FIND_OSGEARTH_LIBRARY( OSGEARTHFEATURES_LIBRARY_DEBUG osgEarthFeaturesd )
FIND_OSGEARTH_LIBRARY( OSGEARTHSYMBOLOGY_LIBRARY osgEarthSymbology )
FIND_OSGEARTH_LIBRARY( OSGEARTHSYMBOLOGY_LIBRARY_DEBUG osgEarthSymbologyd )
FIND_OSGEARTH_LIBRARY( OSGEARTHQT_LIBRARY osgEarthQt )
FIND_OSGEARTH_LIBRARY( OSGEARTHQT_LIBRARY_DEBUG osgEarthQtd )
FIND_OSGEARTH_LIBRARY( OSGEARTHQT_LIBRARY osgEarthQt5 osgEarthQt)
FIND_OSGEARTH_LIBRARY( OSGEARTHQT_LIBRARY_DEBUG osgEarthQtd osgEarthQt5d)
FIND_OSGEARTH_LIBRARY( OSGEARTHANNOTATION_LIBRARY osgEarthAnnotation )
FIND_OSGEARTH_LIBRARY( OSGEARTHANNOTATION_LIBRARY_DEBUG osgEarthAnnotationd )

View File

@ -249,6 +249,8 @@ Removed Classes {#qgis_api_break_3_0_removed_classes}
- QgsAnnotationItem was removed. This was replaced by QgsAnnotation and QgsMapCanvasAnnotationItem.
- QgsAttributeAction was removed, and replaced by QgsActionManager.
- QgsAttributeEditor was removed. Use QgsEditorWidgetRegistry::create() instead.
- Bezier3D.
- CloughTocherInterpolator.
- QgsColorbutton was removed. QgsColorButtonV2 has now been renamed to QgsColorButton. Hence, QgsColorButtonV2 does not exist anymore.
- QgsColorDialog was removed, and QgsColorDialogV2 was renamed to QgsColorDialog. Hence, QgsColorButtonV2 does not exist anymore.
All the functionality from the old QgsColorDialog has been moved to the new class.
@ -266,10 +268,12 @@ should now call QgsCoordinateReferenceSystem::invalidateCache() and QgsCoordinat
- QgsDataDefinedButton was removed. Use QgsPropertyOverrideButton instead.
- QgsDataDefinedSymbolDialog was removed. Code using this dialog should be reworked to use QgsPropertyOverrideButton
- QgsDefaultPluginLayerLegend was removed. Use QgsMapLayer::setLegend() to provide legend nodes for plugin layers.
- DualEdgeTriangulation
- QgsFileNameWidgetWrapper was removed. Use QgsExternalResourceWidgetWrapper instead.
- QgsFileDropEdit was removed. Use QgsFileWidget instead.
- QgsFormAnnotationItem. Use QgsFormAnnotation instead.
- QgsGeometryAnalyzer. Use the equivalent Processing algorithms instead.
- HalfEdge.
- QgsHtmlAnnotationItem. Use QgsHtmlAnnotation instead.
- QgsHttpTransaction. This class was outdated and code should be ported to native Qt or Python implementations.
- QgsGenericProjectionSelector. Use QgsProjectionSelectionTreeWidget instead.
@ -282,11 +286,16 @@ should now call QgsCoordinateReferenceSystem::invalidateCache() and QgsCoordinat
- addLegendLayerActionForLayer() moved to QgisInterface::addCustomActionForLayer()
- removeLegendLayerAction() moved to QgisInterface::removeCustomActionForLayerType()
- QgsLegendModel was removed.
- Line3D.
- LinTriangleInterpolator.
- QgsMapCanvasLayer. Map canvas and overview canvas are updated separately with their own setLayers() calls.
- QgsMapCanvasMap. It is an internal class used by map canvas.
- QgsMapLayerRegistry. Its functionality has been moved to QgsProject.
- QgsMapRenderer. It has been replaced by QgsMapRendererJob with subclasses and QgsMapSettings.
- QgsMapToolTouch. The touch navigation functionality is now built into the standard QgsMapToolPan tool.
- Node.
- NormVecDecorator.
- ParametericLine.
- QgsPhotoWidgetWrapper was removed. Use QgsExternalResourceWidgetWrapper instead.
- QgsPointSample. Use the Processing "Random Points in Polygon" algorithm instead.
- QgsPseudoColorShader. This shader has been broken for some time and was replaced by QgsSingleBandPseudoColorRenderer.
@ -302,10 +311,14 @@ should now call QgsCoordinateReferenceSystem::invalidateCache() and QgsCoordinat
- QgsSvgAnnotationItem. Use QgsSvgAnnotation instead.
- QgsSymbologyV2Conversion was removed. Reading of renderers from pre-1.0 versions is not supported anymore.
- QgsTextAnnotationItem. Use QgsTextAnnotation instead.
- QgsTransectSample. This class was unused and unmaintained.
- TriangleInterpolator.
- Triangulation.
- TriDecorator.
- QgsSnapper. Use QgsSnappingUtils instead.
- QgsSnappingResult. Use QgsSnappingUtils instead.
- QgsMapCanvasSnapper. Use QgsMapCanvas::snappingUtils() instead.
- Vector3D
General changes {#qgis_api_break_3_0_global}
---------------
@ -1348,6 +1361,13 @@ QgsGraduatedRenderer {#qgis_api_break_3_0_QgsGraduatedRenderer}
- setInvertedColorRamp() and invertedColorRamp() functions are gone, QgsColorRamp now responsible for invert
- createRenderer() and updateColorRamp()'s inverted parameter is gone
QgsGridFileWriter {#qgis_api_break_3_0_QgsGridFileWriter}
-----------------
- writeFile() now takes an optional QgsFeedback argument instead of using a QProgressDialog
QgsGroupWMSDataDialog {#qgis_api_break_3_0_QgsGroupWMSDataDialog}
---------------------
@ -1889,7 +1909,8 @@ QgsRasterCalculator {#qgis_api_break_3_0_QgsRasterCalculator}
-------------------
- Cancelled (Result enum value) has been renamed to Canceled <!--#spellok-->
- processCalculation() now uses an optional QgsFeedback instead of QProgressDialog
for progress reports and cancelation.
QgsRasterDataProvider {#qgis_api_break_3_0_QgsRasterDataProvider}
---------------------
@ -1973,6 +1994,11 @@ QgsRelation {#qgis_api_break_3_0_QgsRelation}
- `setRelationName()` has been renamed to `QgsRelation::setName()`
- `setRelationId()` has been renamed to `QgsRelation::setId()`
QgsRelief {#qgis_api_break_3_0_QgsRelief}
---------
- processRaster() now uses a QgsFeedback object instead of a QProgressDialog
QgsRenderChecker {#qgis_api_break_3_0_QgsRenderChecker}
----------------
@ -2309,6 +2335,12 @@ QgsSymbolsListWidget {#qgis_api_break_3_0_QgsSymbolsListWidget}
- expressionContext(), setExpressionContext(), setMapCanvas() and mapCanvas() have been removed in favor of setContext()/context()
QgsTINInterpolator {#qgis_api_break_3_0_QgsTINInterpolator}
------------------
- The constructor takes a QgsFeedback argument instead of using a QProgressDialog.
- setExportTriangulationToFile() and setTriangulationFilePath() were removed. Use setTriangulationSink() instead.
QgsTolerance {#qgis_api_break_3_0_QgsTolerance}
------------

View File

@ -342,6 +342,9 @@
<file>themes/default/mIconDelete.png</file>
<file>themes/default/mIconDeselected.svg</file>
<file>themes/default/mIconDropDownMenu.svg</file>
<file>themes/default/mIconJoinNotEditable.svg</file>
<file>themes/default/mIconJoinedLayerNotEditable.svg</file>
<file>themes/default/mIconJoinHasNotUpsertOnEdit.svg</file>
<file>themes/default/mIconEditableEdits.svg</file>
<file>themes/default/mIconExpand.svg</file>
<file>themes/default/mIconExpandSmall.svg</file>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 463 KiB

After

Width:  |  Height:  |  Size: 417 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 10 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 12 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -35,8 +35,6 @@ RequestExecutionLevel admin
;Set the installer variables, depending on the selected version to build
!define COMPLETE_NAME "${QGIS_BASE} ${VERSION_NUMBER} ${VERSION_NAME}"
!addplugindir osgeo4w/untgz
!addplugindir osgeo4w/nsis
@ -58,7 +56,6 @@ Name "${DISPLAYED_NAME}"
;Name of the output file (installer executable)
OutFile "${INSTALLER_NAME}"
;Tell the installer to show Install and Uninstall details as default
ShowInstDetails hide
ShowUnInstDetails hide
@ -88,6 +85,10 @@ ShowUnInstDetails hide
; if the uninstall procedure succeeded, call the current installer asking for the install PATH
Function .onInit
!ifdef INNER
WriteUninstaller "${UNINSTALLERDEST}\uninstall.exe"
Quit
!endif
${If} ${ARCH} == "x86_64"
${If} ${RunningX64}
DetailPrint "Installer running on 64-bit host"
@ -199,7 +200,6 @@ Function .onInit
Abort
${EndIf}
${EndIf}
FunctionEnd
;----------------------------------------------------------------------------------------------------------------------------
@ -280,6 +280,7 @@ Var /GLOBAL ARCHIVE_SIZE_KB
Var /GLOBAL ARCHIVE_SIZE_MB
Var /GLOBAL DOWNLOAD_MESSAGE_
!ifndef INNER
Section "QGIS" SecQGIS
SectionIn RO
@ -320,8 +321,10 @@ Section "QGIS" SecQGIS
SetOutPath "$INSTALL_DIR"
File /r ${PACKAGE_FOLDER}\*.*
;Create the Uninstaller
WriteUninstaller "$INSTALL_DIR\Uninstall-QGIS.exe"
!ifndef INNER
SetOutPath $INSTDIR
File uninstall.exe
!endif
;Registry Key Entries
@ -337,8 +340,8 @@ Section "QGIS" SecQGIS
WriteRegStr HKLM "Software\${QGIS_BASE}" "InstallPath" "$INSTALL_DIR"
;HKEY_LOCAL_MACHINE Uninstall entries
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "DisplayName" "${COMPLETE_NAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "UninstallString" "$INSTALL_DIR\Uninstall-QGIS.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "DisplayName" "${DISPLAYED_NAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "UninstallString" "$INSTALL_DIR\uninstall.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "DisplayIcon" "$INSTALL_DIR\icons\QGIS.ico"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "EstimatedSize" 1
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "HelpLink" "${WIKI_PAGE}"
@ -371,6 +374,7 @@ RebootNecessary:
NoRebootNecessary:
SectionEnd
!endif
Function DownloadDataSet
@ -481,7 +485,15 @@ SectionEnd
;Uninstaller Section
!ifdef INNER
Section "Uninstall"
${If} ${ARCH} == "x86_64"
${If} ${RunningX64}
DetailPrint "Installer running on 64-bit host"
; disable registry redirection (enable access to 64-bit portion of registry)
SetRegView 64
${EndIf}
${EndIf}
GetFullPathName /SHORT $0 $INSTDIR
System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("OSGEO4W_ROOT", "$0").r0'
@ -493,12 +505,13 @@ Section "Uninstall"
ReadEnvStr $0 COMSPEC
nsExec::ExecToLog '"$0" /c "$INSTDIR\preremove.bat"'
Delete "$INSTDIR\Uninstall-QGIS.exe"
Delete "$INSTDIR\uninstall.exe"
Delete "$INSTDIR\*.bat.done"
Delete "$INSTDIR\*.log"
Delete "$INSTDIR\*.txt"
Delete "$INSTDIR\*.ico"
Delete "$INSTDIR\*.bat"
Delete "$INSTDIR\*.dll"
RMDir /r "$INSTDIR\bin"
RMDir /r "$INSTDIR\apps"
@ -529,9 +542,11 @@ Section "Uninstall"
DeleteRegKey HKLM "Software\${QGIS_BASE}"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}"
SectionEnd
!endif
;----------------------------------------------------------------------------------------------------------------------------
!ifndef INNER
;Installer Section Descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecQGIS} "Install ${QGIS_BASE}"
@ -539,5 +554,6 @@ SectionEnd
!insertmacro MUI_DESCRIPTION_TEXT ${SecSpearfishSDB} "Download and install the South Dakota (Spearfish) sample data set"
!insertmacro MUI_DESCRIPTION_TEXT ${SecAlaskaSDB} "Download and install the Alaska sample database (shapefiles and TIFF data)"
!insertmacro MUI_FUNCTION_DESCRIPTION_END
!endif
;----------------------------------------------------------------------------------------------------------------------------

View File

@ -7,12 +7,18 @@
# 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.
# (at your option) any later version.
#
# Download OSGeo4W packages
#
BEGIN {
# ignore requireAdministrator execution level while producing the
# uninstaller
$ENV{"__COMPAT_LAYER"} = 'RUNASINVOKER';
}
use strict;
use warnings;
use Getopt::Long;
@ -29,11 +35,15 @@ my $binary;
my $root = "http://download.osgeo.org/osgeo4w";
my $ininame = "setup.ini";
my $arch = "x86_64";
my $signwith;
my $signpass;
my $help;
my $result = GetOptions(
"verbose+" => \$verbose,
"keep" => \$keep,
"signwith=s" => \$signwith,
"signpass=s" => \$signpass,
"releasename=s" => \$releasename,
"version=s" => \$version,
"binary=i" => \$binary,
@ -45,6 +55,8 @@ my $result = GetOptions(
"help" => \$help
);
die "certificate not found" if defined $signwith && ! -f $signwith;
pod2usage(1) if $help;
my $wgetopt = $verbose ? "" : "-nv";
@ -265,78 +277,6 @@ unless(-d $unpacked ) {
chdir "..";
}
#
# Create postinstall.bat
#
open F, ">../Installer-Files/postinstall.bat";
my $r = ">>postinstall.log 2>&1\r\n";
print F "\@echo off\r\n";
print F "if exist postinstall.log del postinstall.log\r\n";
print F "set OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT:\\=/%$r";
print F "if \"%OSGEO4W_ROOT_MSYS:~1,1%\"==\":\" set OSGEO4W_ROOT_MSYS=/%OSGEO4W_ROOT_MSYS:~0,1%/%OSGEO4W_ROOT_MSYS:~3%$r";
print F "del preremove-conf.bat$r";
my $c = ">>preremove-conf.bat\r\n";
print F "echo set OSGEO4W_ROOT=%OSGEO4W_ROOT%$c";
print F "echo set OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT_MSYS%$c";
print F "echo set OSGEO4W_STARTMENU=%OSGEO4W_STARTMENU%$c";
print F "echo set OSGEO4W_DESKTOP=%OSGEO4W_DESKTOP%$c";
print F "echo OSGEO4W_ROOT=%OSGEO4W_ROOT%$r";
print F "echo OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT_MSYS%$r";
print F "echo OSGEO4W_STARTMENU=%OSGEO4W_STARTMENU%$r";
print F "echo OSGEO4W_DESKTOP=%OSGEO4W_DESKTOP%$r";
print F "PATH %OSGEO4W_ROOT%\\bin;%PATH%$r";
print F "cd %OSGEO4W_ROOT%$r";
chdir $unpacked;
for my $p (<etc/postinstall/*.bat>) {
$p =~ s/\//\\/g;
my($dir,$file) = $p =~ /^(.+)\\([^\\]+)$/;
print F "echo Running postinstall $file...$r";
print F "%COMSPEC% /c $p$r";
print F "ren $p $file.done$r";
}
chdir "..";
print F "ren postinstall.bat postinstall.bat.done$r";
close F;
open F, ">../Installer-Files/preremove.bat";
$r = ">>%TEMP%\\$packagename-OSGeo4W-$version-$binary-preremove.log 2>&1\r\n";
print F "\@echo off\r\n";
print F "call \"%~dp0\\preremove-conf.bat\"$r";
print F "echo OSGEO4W_ROOT=%OSGEO4W_ROOT%$r";
print F "echo OSGEO4W_STARTMENU=%OSGEO4W_STARTMENU%$r";
print F "echo OSGEO4W_DESKTOP=%OSGEO4W_DESKTOP%$r";
print F "set OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT:\\=/%$r";
print F "if \"%OSGEO4W_ROOT_MSYS:~1,1%\"==\":\" set OSGEO4W_ROOT_MSYS=/%OSGEO4W_ROOT_MSYS:~0,1%/%OSGEO4W_ROOT_MSYS:~3%$r";
print F "echo OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT_MSYS%$r";
print F "PATH %OSGEO4W_ROOT%\\bin;%PATH%$r";
print F "cd %OSGEO4W_ROOT%$r";
chdir $unpacked;
for my $p (<etc/preremove/*.bat>) {
$p =~ s/\//\\/g;
my($dir,$file) = $p =~ /^(.+)\\([^\\]+)$/;
print F "echo Running preremove $file...$r";
print F "%COMSPEC% /c $p$r";
print F "ren $p $file.done$r";
}
chdir "..";
print F "ren preremove.bat preremove.bat.done$r";
close F;
my($major, $minor, $patch);
open F, "../../CMakeLists.txt";
@ -369,6 +309,78 @@ unless( defined $binary ) {
}
}
#
# Create postinstall.bat
#
open F, ">../Installer-Files/postinstall.bat";
my $r = ">>postinstall.log 2>&1\r\n";
print F "\@echo off\r\n";
print F "if exist postinstall.log del postinstall.log\r\n";
print F "set OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT:\\=/%$r";
print F "if \"%OSGEO4W_ROOT_MSYS:~1,1%\"==\":\" set OSGEO4W_ROOT_MSYS=/%OSGEO4W_ROOT_MSYS:~0,1%/%OSGEO4W_ROOT_MSYS:~3%$r";
print F "del preremove-conf.bat$r";
my $c = ">>preremove-conf.bat\r\n";
print F "echo set OSGEO4W_ROOT=%OSGEO4W_ROOT%$c";
print F "echo set OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT_MSYS%$c";
print F "echo set OSGEO4W_STARTMENU=%OSGEO4W_STARTMENU%$c";
print F "echo set OSGEO4W_DESKTOP=%OSGEO4W_DESKTOP%$c";
print F "echo OSGEO4W_ROOT=%OSGEO4W_ROOT%$r";
print F "echo OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT_MSYS%$r";
print F "echo OSGEO4W_STARTMENU=%OSGEO4W_STARTMENU%$r";
print F "echo OSGEO4W_DESKTOP=%OSGEO4W_DESKTOP%$r";
print F "PATH %OSGEO4W_ROOT%\\bin;%PATH%$r";
print F "cd /d %OSGEO4W_ROOT%$r";
chdir $unpacked;
for my $p (<etc/postinstall/*.bat>) {
$p =~ s/\//\\/g;
my($dir,$file) = $p =~ /^(.+)\\([^\\]+)$/;
print F "echo Running postinstall $file...$r";
print F "%COMSPEC% /c $p$r";
print F "ren $p $file.done$r";
}
chdir "..";
print F "ren postinstall.bat postinstall.bat.done$r";
close F;
open F, ">../Installer-Files/preremove.bat";
$r = ">>%TEMP%\\$packagename-OSGeo4W-$version-$binary-preremove.log 2>&1\r\n";
print F "\@echo off\r\n";
print F "call \"%~dp0\\preremove-conf.bat\"$r";
print F "echo OSGEO4W_ROOT=%OSGEO4W_ROOT%$r";
print F "echo OSGEO4W_STARTMENU=%OSGEO4W_STARTMENU%$r";
print F "echo OSGEO4W_DESKTOP=%OSGEO4W_DESKTOP%$r";
print F "set OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT:\\=/%$r";
print F "if \"%OSGEO4W_ROOT_MSYS:~1,1%\"==\":\" set OSGEO4W_ROOT_MSYS=/%OSGEO4W_ROOT_MSYS:~0,1%/%OSGEO4W_ROOT_MSYS:~3%$r";
print F "echo OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT_MSYS%$r";
print F "PATH %OSGEO4W_ROOT%\\bin;%PATH%$r";
print F "cd /d \"%OSGEO4W_ROOT%\"$r";
chdir $unpacked;
for my $p (<etc/preremove/*.bat>) {
$p =~ s/\//\\/g;
my($dir,$file) = $p =~ /^(.+)\\([^\\]+)$/;
print F "echo Running preremove $file...$r";
print F "%COMSPEC% /c $p$r";
print F "ren $p $file.done$r";
}
chdir "..";
print F "ren preremove.bat preremove.bat.done$r";
close F;
unless(-d "untgz") {
system "unzip $packages/Untgz.zip";
die "unpacking Untgz.zip failed" if $?;
@ -438,29 +450,81 @@ if( -f "osgeo4w/$unpacked/apps/$shortname/doc/LICENSE" ) {
print "Running NSIS\n" if $verbose;
my $cmd = "makensis";
$cmd .= " -V$verbose";
$cmd .= " -DVERSION_NAME='$releasename'";
$cmd .= " -DVERSION_NUMBER='$version'";
$cmd .= " -DBINARY_REVISION=$binary";
$cmd .= sprintf( " -DVERSION_INT='%d%02d%02d%02d'", $pmajor, $pminor, $ppatch, $binary );
$cmd .= sprintf( " -DQGIS_BASE='$packagename %d.%d'", $pmajor, $pminor );
$cmd .= " -DINSTALLER_NAME='$packagename-OSGeo4W-$version-$binary-Setup$archpostfix.exe'";
$cmd .= " -DDISPLAYED_NAME=\"$packagename '$releasename' ($version)\"";
$cmd .= " -DSHORTNAME='$shortname'";
$cmd .= " -DINSTALLER_TYPE=OSGeo4W";
$cmd .= " -DPACKAGE_FOLDER=osgeo4w/$unpacked";
$cmd .= " -DLICENSE_FILE='$license'";
$cmd .= " -DARCH='$arch'";
$cmd .= " QGIS-Installer.nsi";
my $installerbase = "$packagename-OSGeo4W-$version-$binary-Setup$archpostfix";
my $run;
my $instdest;
if($^O eq "cygwin") {
$run = "cygstart ";
$instdest = `cygpath -w \$PWD`;
} else {
$run = "wine ";
$instdest = `winepath -w \$PWD`;
}
$instdest =~ s/\s+$//;
$instdest =~ s/\\/\\\\/g;
my $args = "";
$args .= " -V$verbose";
$args .= " -DVERSION_NAME='$releasename'";
$args .= " -DVERSION_NUMBER='$version'";
$args .= " -DBINARY_REVISION=$binary";
$args .= sprintf( " -DVERSION_INT='%d%02d%02d%02d'", $pmajor, $pminor, $ppatch, $binary );
$args .= sprintf( " -DQGIS_BASE='$packagename %d.%d'", $pmajor, $pminor );
$args .= " -DDISPLAYED_NAME=\"$packagename $version '$releasename'\"";
$args .= " -DPACKAGE_FOLDER=osgeo4w/$unpacked";
$args .= " -DLICENSE_FILE='$license'";
$args .= " -DARCH='$arch'";
$args .= " QGIS-Installer.nsi";
sub sign {
my $base = shift;
my $cmd = "osslsigncode sign";
$cmd .= " -pkcs12 \"$signwith\"";
$cmd .= " -pass \"$signpass\"" if defined $signpass;
$cmd .= " -n \"$packagename $version '$releasename'\"";
$cmd .= " -h sha256";
$cmd .= " -i \"https://qgis.org\"";
$cmd .= " -t \"http://timestamp.digicert.com\"";
$cmd .= " -in \"$base.exe\"";
$cmd .= " $base-signed.exe";
system $cmd;
die "signing failed [$cmd]" if $?;
rename("$base-signed.exe", "$base.exe") or die "rename failed: $!";
}
my $cmd;
unlink "makeuinst.exe";
$cmd = "makensis -DINNER=1 -DUNINSTALLERDEST='$instdest' -DINSTALLER_NAME='makeuinst.exe' $args";
system $cmd;
die "running nsis failed [$cmd]" if $?;
die "running makensis failed [$cmd]" if $?;
die "makeuinst.exe not created" unless -f "makeuinst.exe";
unlink "uninstall.exe";
chmod 0755, "makeuinst.exe";
system "${run}makeuinst.exe";
sleep 5;
die "uninstall.exe not created" unless -f "uninstall.exe";
unlink "makeuinst.exe";
sign "uninstall" if $signwith;
$cmd = "makensis -DINSTALLER_NAME='$installerbase.exe' $args";
system $cmd;
die "running makensis failed [$cmd]" if $?;
sign "$installerbase" if $signwith;
open P, ">osgeo4w/binary$archpostfix-$version";
print P $binary;
close P;
system "md5sum $installerbase.exe >$installerbase.exe.md5sum";
__END__
@ -476,6 +540,8 @@ creatensis.pl [options] [packages...]
-verbose increase verbosity
-releasename=name name of release (defaults to CMakeLists.txt setting)
-keep don't start with a fresh unpacked directory
-signwith=cert.p12 optionall sign package with certificate (requires osslsigncode)
-signpass=password password of certificate
-version=m.m.p package version (defaults to CMakeLists.txt setting)
-binary=b binary version of package
-ininame=filename name of the setup.ini (defaults to setup.ini)

View File

@ -12,27 +12,16 @@
%Include raster/qgsrastermatrix.sip
%Include raster/qgsrastercalcnode.sip
%Include raster/qgstotalcurvaturefilter.sip
%Include vector/qgstransectsample.sip
%Include vector/qgsgeometrysnapper.sip
%Include vector/qgszonalstatistics.sip
%Include interpolation/qgsinterpolator.sip
%Include interpolation/qgsgridfilewriter.sip
%Include interpolation/qgsidwinterpolator.sip
%Include interpolation/qgstininterpolator.sip
%Include interpolation/Bezier3D.sip
%Include interpolation/ParametricLine.sip
%Include interpolation/CloughTocherInterpolator.sip
%Include interpolation/TriangleInterpolator.sip
%Include interpolation/Vector3D.sip
%Include interpolation/DualEdgeTriangulation.sip
%Include interpolation/Node.sip
%Include interpolation/TriDecorator.sip
%Include interpolation/Triangulation.sip
%Include interpolation/HalfEdge.sip
%Include interpolation/LinTriangleInterpolator.sip
%Include interpolation/NormVecDecorator.sip
%Include interpolation/Line3D.sip
%Include openstreetmap/qgsosmbase.sip
%Include openstreetmap/qgsosmdatabase.sip
%Include openstreetmap/qgsosmdownload.sip
%Include openstreetmap/qgsosmimport.sip
%Include network/qgsgraph.sip
%Include network/qgsgraphbuilderinterface.sip
%Include network/qgsgraphbuilder.sip
@ -40,8 +29,5 @@
%Include network/qgsnetworkspeedstrategy.sip
%Include network/qgsnetworkdistancestrategy.sip
%Include network/qgsgraphanalyzer.sip
%Include openstreetmap/qgsosmdownload.sip
%Include openstreetmap/qgsosmimport.sip
%Include vector/qgsgeometrysnapper.sip
%Include network/qgsgraphdirector.sip
%Include network/qgsvectorlayerdirector.sip
%Include network/qgsgraphdirector.sip

View File

@ -59,7 +59,7 @@ Eliminates the horizontal triangles by swapping or by insertion of new points. I
Estimates the first derivative a point. Return true in case of succes and false otherwise
:rtype: bool
%End
bool estimateFirstDerivatives( QProgressDialog *d = 0 );
bool estimateFirstDerivatives( QgsFeedback *feedback = 0 );
%Docstring
This method adds the functionality of estimating normals at the data points. Return true in the case of success and false otherwise
:rtype: bool

View File

@ -20,10 +20,10 @@ class QgsGridFileWriter
QgsGridFileWriter( QgsInterpolator *i, const QString &outputPath, const QgsRectangle &extent, int nCols, int nRows, double cellSizeX, double cellSizeY );
int writeFile( bool showProgressDialog = false );
int writeFile( QgsFeedback *feedback = 0 );
%Docstring
Writes the grid file.
\param showProgressDialog shows a dialog with the possibility to cancel
\param feedback optional feedback object for progress reports and cancelation support
:return: 0 in case of success*
:rtype: int
%End

View File

@ -25,7 +25,13 @@ class QgsTINInterpolator: QgsInterpolator
Linear,
CloughTocher
};
QgsTINInterpolator( const QList<QgsInterpolator::LayerData> &inputData, TINInterpolation interpolation = Linear, bool showProgressDialog = false );
QgsTINInterpolator( const QList<QgsInterpolator::LayerData> &inputData, TINInterpolation interpolation = Linear, QgsFeedback *feedback = 0 );
%Docstring
Constructor for QgsTINInterpolator.
The ``feedback`` object specifies an optional QgsFeedback object for progress reports and cancelation support.
Ownership of ``feedback`` is not transferred and callers must ensure that it exists for the lifetime of this object.
%End
~QgsTINInterpolator();
virtual int interpolatePoint( double x, double y, double &result );
@ -39,8 +45,26 @@ class QgsTINInterpolator: QgsInterpolator
:rtype: int
%End
void setExportTriangulationToFile( bool e );
void setTriangulationFilePath( const QString &filepath );
static QgsFields triangulationFields();
%Docstring
Returns the fields output by features when saving the triangulation.
These fields should be used when creating
a suitable feature sink for setTriangulationSink()
.. seealso:: setTriangulationSink()
.. versionadded:: 3.0
:rtype: QgsFields
%End
void setTriangulationSink( QgsFeatureSink *sink );
%Docstring
Sets the optional ``sink`` for saving the triangulation features.
The sink must be setup to accept LineString features, with fields matching
those returned by triangulationFields().
.. seealso:: triangulationFields()
.. versionadded:: 3.0
%End
};

View File

@ -71,7 +71,7 @@ class QgsRasterCalculator
.. versionadded:: 2.10
%End
int processCalculation( QProgressDialog *p = 0 );
int processCalculation( QgsFeedback *feedback = 0 );
%Docstring
:rtype: int
%End

View File

@ -32,10 +32,10 @@ class QgsRelief
~QgsRelief();
int processRaster( QProgressDialog *p );
int processRaster( QgsFeedback *feedback = 0 );
%Docstring
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.
\param feedback feedback object that receives update and that is checked for cancelation.
:return: 0 in case of success*
:rtype: int
%End

View File

@ -1,46 +0,0 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/analysis/vector/qgstransectsample.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsTransectSample
{
%Docstring
A class for the creation of transect sample lines based on a set of strata polygons and baselines*
%End
%TypeHeaderCode
#include "qgstransectsample.h"
%End
public:
enum DistanceUnits
{
Meters,
StrataUnits
};
QgsTransectSample( QgsVectorLayer *strataLayer, const QString &strataIdAttribute, const QString &minDistanceAttribute, const QString &nPointsAttribute,
DistanceUnits minDistUnits, QgsVectorLayer *baselineLayer, bool shareBaseline,
const QString &baselineStrataId, const QString &outputPointLayer, const QString &outputLineLayer, const QString &usedBaselineLayer, double minTransectLength = 0.0,
double baselineBufferDistance = -1.0, double baselineSimplificationTolerance = -1.0 );
int createSample( QProgressDialog *pd );
%Docstring
:rtype: int
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/analysis/vector/qgstransectsample.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -59,7 +59,7 @@ def show_console():
# Shows help on first launch of the console
settings = QgsSettings()
if settings.value('pythonConsole/contextHelpOnFirstLaunch', True, type=bool):
QgsHelp.openHelp("../pyqgis_developer_cookbook/intro.html#python-console")
QgsHelp.openHelp("plugins/python_console.html")
settings.setValue('pythonConsole/contextHelpOnFirstLaunch', False)
return _console

View File

@ -112,7 +112,7 @@ def register_function(function, arg_count, group, usesgeometry=False,
helptemplate = string.Template("""<h3>$name function</h3><br>$doc""")
name = kwargs.get('name', function.__name__)
helptext = function.__doc__ or ''
helptext = kwargs.get('helpText') or function.__doc__ or ''
helptext = helptext.strip()
expandargs = False

View File

@ -198,7 +198,6 @@
%Include raster/qgsrasterfilewriter.sip
%Include raster/qgsrasterhistogram.sip
%Include raster/qgsrasteridentifyresult.sip
%Include raster/qgsrasterinterface.sip
%Include raster/qgsrasteriterator.sip
%Include raster/qgsrasterminmaxorigin.sip
%Include raster/qgsrasternuller.sip
@ -269,6 +268,7 @@
%Include geometry/qgsmultisurface.sip
%Include geometry/qgspolygon.sip
%Include geometry/qgsrectangle.sip
%Include geometry/qgsreferencedgeometry.sip
%Include geometry/qgsregularpolygon.sip
%Include geometry/qgstriangle.sip
%Include geometry/qgssurface.sip
@ -377,6 +377,7 @@
%Include raster/qgsrasterfilewritertask.sip
%Include raster/qgsrasterlayer.sip
%Include raster/qgsrasterdataprovider.sip
%Include raster/qgsrasterinterface.sip
%Include geometry/qgspoint.sip
%Include gps/qgsgpsconnection.sip
%Include gps/qgsgpsdetector.sip

View File

@ -126,6 +126,21 @@ class QgsDxfExport
:rtype: bool
%End
void setForce2d( bool force2d );
%Docstring
Force 2d output (eg. to support linewidth in polylines)
\param force2d flag
.. seealso:: force2d
%End
bool force2d();
%Docstring
Retrieve whether the output should be forced to 2d
:return: flag
.. seealso:: setForce2d
:rtype: bool
%End
static int closestColorMatch( QRgb color );
%Docstring
Get DXF palette index of nearest entry for given color

View File

@ -112,6 +112,19 @@ class QgsCircle : QgsEllipse
:rtype: QgsCircle
%End
static QgsCircle minimalCircleFrom3Points( const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3, double epsilon = 1E-8 );
%Docstring
Constructs the smallest circle from 3 points.
Z and m values are dropped for the center point.
The azimuth always takes the default value.
If the points are colinear an empty circle is returned.
\param pt1 First point.
\param pt2 Second point.
\param pt3 Third point.
\param epsilon Value used to compare point.
:rtype: QgsCircle
%End
virtual double area() const;
virtual double perimeter() const;
@ -159,6 +172,11 @@ Set the radius of the circle
:rtype: QgsCircularString
%End
bool contains( const QgsPoint &point, double epsilon = 1E-8 ) const;
%Docstring
Returns true if the circle contains the ``point``.
:rtype: bool
%End
virtual QgsRectangle boundingBox() const;

View File

@ -241,6 +241,47 @@ Returns true if WKB of the geometry is of WKBMulti* type
:rtype: float
%End
double hausdorffDistance( const QgsGeometry &geom ) const;
%Docstring
Returns the Hausdorff distance between this geometry and ``geom``. This is basically a measure of how similar or dissimilar 2 geometries are.
This algorithm is an approximation to the standard Hausdorff distance. This approximation is exact or close enough for a large
subset of useful cases. Examples of these are:
- computing distance between Linestrings that are roughly parallel to each other,
and roughly equal in length. This occurs in matching linear networks.
- Testing similarity of geometries.
If the default approximate provided by this method is insufficient, use hausdorffDistanceDensify() instead.
In case of error -1 will be returned.
.. versionadded:: 3.0
.. seealso:: hausdorffDistanceDensify()
:rtype: float
%End
double hausdorffDistanceDensify( const QgsGeometry &geom, double densifyFraction ) const;
%Docstring
Returns the Hausdorff distance between this geometry and ``geom``. This is basically a measure of how similar or dissimilar 2 geometries are.
This function accepts a ``densifyFraction`` argument. The function performs a segment
densification before computing the discrete Hausdorff distance. The ``densifyFraction`` parameter
sets the fraction by which to densify each segment. Each segment will be split into a
number of equal-length subsegments, whose fraction of the total length is
closest to the given fraction.
This method can be used when the default approximation provided by hausdorffDistance()
is not sufficient. Decreasing the ``densifyFraction`` parameter will make the
distance returned approach the true Hausdorff distance for the geometries.
In case of error -1 will be returned.
.. versionadded:: 3.0
.. seealso:: hausdorffDistance()
:rtype: float
%End
QgsPointXY closestVertex( const QgsPointXY &point, int &atVertex /Out/, int &beforeVertex /Out/, int &afterVertex /Out/, double &sqrDist /Out/ ) const;
%Docstring
:rtype: QgsPointXY
@ -536,6 +577,16 @@ Returns true if WKB of the geometry is of WKBMulti* type
:rtype: QgsGeometry
%End
QgsGeometry minimalEnclosingCircle( QgsPointXY &center /Out/, double &radius /Out/, unsigned int segments = 36 ) const;
%Docstring
Returns the minimal enclosing circle for the geometry.
\param center Center of the minimal enclosing circle returneds
\param radius Radius of the minimal enclosing circle returned
.. seealso:: QgsEllipse.toPolygon()
.. versionadded:: 3.0
:rtype: QgsGeometry
%End
QgsGeometry orthogonalize( double tolerance = 1.0E-8, int maxIterations = 1000, double angleThreshold = 15.0 ) const;
%Docstring
Attempts to orthogonalize a line or polygon geometry by shifting vertices to make the geometries
@ -1251,10 +1302,11 @@ Returns an extruded version of this geometry.
:rtype: int
%End
QString error() const;
QString lastError() const;
%Docstring
Returns an error string referring to an error that was produced
when this geometry was created.
Returns an error string referring to the last error encountered
either when this geometry was created or when an operation
was performed on the geometry.
.. versionadded:: 3.0
:rtype: str

View File

@ -42,6 +42,8 @@ Construct a rectangle from a QRectF. The rectangle is normalized after construct
Copy constructor
%End
~QgsRectangle();
void set( const QgsPointXY &p1, const QgsPointXY &p2 );
%Docstring
Sets the rectangle from two QgsPoints. The rectangle is
@ -315,9 +317,15 @@ Copy constructor
:rtype: QgsBox3d
%End
operator QVariant() const;
%Docstring
Allows direct construction of QVariants from rectangles.
%End
};
/************************************************************************
* This file has been generated automatically from *
* *

View File

@ -0,0 +1,120 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/geometry/qgsreferencedgeometry.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsReferencedGeometryBase
{
%Docstring
A base class for geometry primitives which are stored with an associated reference system.
QgsReferencedGeometryBase classes represent some form of geometry primitive
(such as rectangles) which have an optional coordinate reference system
associated with them.
.. versionadded:: 3.0
.. seealso:: QgsReferencedRectangle
%End
%TypeHeaderCode
#include "qgsreferencedgeometry.h"
%End
public:
QgsReferencedGeometryBase( const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() );
%Docstring
Constructor for QgsReferencedGeometryBase, with the specified ``crs``.
%End
QgsCoordinateReferenceSystem crs() const;
%Docstring
Returns the associated coordinate reference system, or an invalid CRS if
no reference system is set.
.. seealso:: setCrs()
:rtype: QgsCoordinateReferenceSystem
%End
void setCrs( const QgsCoordinateReferenceSystem &crs );
%Docstring
Sets the associated ``crs``. Set to an invalid CRS if
no reference system is required.
.. seealso:: crs()
%End
};
class QgsReferencedRectangle : QgsRectangle, QgsReferencedGeometryBase
{
%Docstring
A QgsRectangle with associated coordinate reference system.
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgsreferencedgeometry.h"
%End
public:
QgsReferencedRectangle( const QgsRectangle &rectangle, const QgsCoordinateReferenceSystem &crs );
%Docstring
Constructor for QgsReferencedRectangle, with the specified initial ``rectangle``
and ``crs``.
%End
QgsReferencedRectangle();
%Docstring
Constructor for QgsReferencedRectangle.
%End
operator QVariant() const;
%Docstring
Allows direct construction of QVariants from rectangle.
%End
};
class QgsReferencedPointXY : QgsPointXY, QgsReferencedGeometryBase
{
%Docstring
A QgsPointXY with associated coordinate reference system.
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgsreferencedgeometry.h"
%End
public:
QgsReferencedPointXY( const QgsPointXY &point, const QgsCoordinateReferenceSystem &crs );
%Docstring
Constructor for QgsReferencedPointXY, with the specified initial ``point``
and ``crs``.
%End
QgsReferencedPointXY();
%Docstring
Constructor for QgsReferencedPointXY.
%End
operator QVariant() const;
%Docstring
Allows direct construction of QVariants from point.
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/geometry/qgsreferencedgeometry.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -385,6 +385,8 @@ Filter nodes from QgsMapLayerLegend according to the current filtering rules
QFlags<QgsLayerTreeModel::Flag> operator|(QgsLayerTreeModel::Flag f1, QFlags<QgsLayerTreeModel::Flag> f2);
/************************************************************************
* This file has been generated automatically from *
* *

View File

@ -26,16 +26,16 @@ class QgsProcessing
%End
public:
enum LayerType
enum SourceType
{
TypeAny,
TypeVectorAny,
TypeMapLayer,
TypeVectorAnyGeometry,
TypeVectorPoint,
TypeVectorLine,
TypeVectorPolygon,
TypeRaster,
TypeFile,
TypeTable,
TypeVector,
};

View File

@ -760,11 +760,11 @@ class QgsProcessingFeatureBasedAlgorithm : QgsProcessingAlgorithm
:rtype: str
%End
virtual QgsProcessing::LayerType outputLayerType() const;
virtual QgsProcessing::SourceType outputLayerType() const;
%Docstring
Returns the layer type for layers generated by this algorithm, if
this is possible to determine in advance.
:rtype: QgsProcessing.LayerType
:rtype: QgsProcessing.SourceType
%End
virtual QgsWkbTypes::Type outputWkbType( QgsWkbTypes::Type inputWkbType ) const;

View File

@ -92,7 +92,7 @@ class QgsProcessingContext
struct LayerDetails
{
LayerDetails( const QString &name, QgsProject *project );
LayerDetails( const QString &name, QgsProject *project, const QString &outputName = QString() );
%Docstring
Constructor for LayerDetails.
%End
@ -100,6 +100,11 @@ class QgsProcessingContext
QString name;
%Docstring
Friendly name for layer, to use when loading layer into project.
%End
QString outputName;
%Docstring
Associated output name from algorithm which generated the layer.
%End
QgsProject *project;

View File

@ -108,7 +108,7 @@ class QgsProcessingOutputVectorLayer : QgsProcessingOutputDefinition
%End
public:
QgsProcessingOutputVectorLayer( const QString &name, const QString &description = QString(), QgsProcessing::LayerType type = QgsProcessing::TypeVectorAny );
QgsProcessingOutputVectorLayer( const QString &name, const QString &description = QString(), QgsProcessing::SourceType type = QgsProcessing::TypeVectorAnyGeometry );
%Docstring
Constructor for QgsProcessingOutputVectorLayer.
%End
@ -120,14 +120,14 @@ class QgsProcessingOutputVectorLayer : QgsProcessingOutputDefinition
%End
virtual QString type() const;
QgsProcessing::LayerType dataType() const;
QgsProcessing::SourceType dataType() const;
%Docstring
Returns the layer type for the output layer.
.. seealso:: setDataType()
:rtype: QgsProcessing.LayerType
:rtype: QgsProcessing.SourceType
%End
void setDataType( QgsProcessing::LayerType type );
void setDataType( QgsProcessing::SourceType type );
%Docstring
Sets the layer ``type`` for the output layer.
.. seealso:: dataType()

View File

@ -213,6 +213,12 @@ class QgsProcessingParameterDefinition
virtual ~QgsProcessingParameterDefinition();
virtual QgsProcessingParameterDefinition *clone() const = 0 /Factory/;
%Docstring
Creates a clone of the parameter definition.
:rtype: QgsProcessingParameterDefinition
%End
virtual QString type() const = 0;
%Docstring
Unique parameter type name.
@ -620,6 +626,8 @@ class QgsProcessingParameterBoolean : QgsProcessingParameterDefinition
Returns the type name for the parameter class.
:rtype: str
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
@ -656,6 +664,8 @@ class QgsProcessingParameterCrs : QgsProcessingParameterDefinition
Returns the type name for the parameter class.
:rtype: str
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
@ -693,6 +703,8 @@ class QgsProcessingParameterMapLayer : QgsProcessingParameterDefinition
Returns the type name for the parameter class.
:rtype: str
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
@ -730,6 +742,8 @@ class QgsProcessingParameterExtent : QgsProcessingParameterDefinition
Returns the type name for the parameter class.
:rtype: str
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
@ -768,6 +782,8 @@ class QgsProcessingParameterPoint : QgsProcessingParameterDefinition
Returns the type name for the parameter class.
:rtype: str
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
@ -809,6 +825,8 @@ class QgsProcessingParameterFile : QgsProcessingParameterDefinition
Returns the type name for the parameter class.
:rtype: str
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
@ -879,6 +897,8 @@ class QgsProcessingParameterMatrix : QgsProcessingParameterDefinition
Returns the type name for the parameter class.
:rtype: str
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
@ -955,7 +975,7 @@ class QgsProcessingParameterMultipleLayers : QgsProcessingParameterDefinition
%End
public:
QgsProcessingParameterMultipleLayers( const QString &name, const QString &description = QString(), QgsProcessing::LayerType layerType = QgsProcessing::TypeVectorAny,
QgsProcessingParameterMultipleLayers( const QString &name, const QString &description = QString(), QgsProcessing::SourceType layerType = QgsProcessing::TypeVectorAnyGeometry,
const QVariant &defaultValue = QVariant(),
bool optional = false );
%Docstring
@ -967,6 +987,8 @@ class QgsProcessingParameterMultipleLayers : QgsProcessingParameterDefinition
Returns the type name for the parameter class.
:rtype: str
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
@ -975,14 +997,14 @@ class QgsProcessingParameterMultipleLayers : QgsProcessingParameterDefinition
virtual QString asScriptCode() const;
QgsProcessing::LayerType layerType() const;
QgsProcessing::SourceType layerType() const;
%Docstring
Returns the layer type for layers acceptable by the parameter.
.. seealso:: setLayerType()
:rtype: QgsProcessing.LayerType
:rtype: QgsProcessing.SourceType
%End
void setLayerType( QgsProcessing::LayerType type );
void setLayerType( QgsProcessing::SourceType type );
%Docstring
Sets the layer ``type`` for layers acceptable by the parameter.
.. seealso:: layerType()
@ -1050,6 +1072,8 @@ class QgsProcessingParameterNumber : QgsProcessingParameterDefinition
Returns the type name for the parameter class.
:rtype: str
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
@ -1133,6 +1157,8 @@ class QgsProcessingParameterRange : QgsProcessingParameterDefinition
Returns the type name for the parameter class.
:rtype: str
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
@ -1188,6 +1214,8 @@ class QgsProcessingParameterRasterLayer : QgsProcessingParameterDefinition
Returns the type name for the parameter class.
:rtype: str
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
@ -1227,6 +1255,8 @@ class QgsProcessingParameterEnum : QgsProcessingParameterDefinition
Returns the type name for the parameter class.
:rtype: str
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
@ -1298,6 +1328,8 @@ class QgsProcessingParameterString : QgsProcessingParameterDefinition
Returns the type name for the parameter class.
:rtype: str
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
@ -1354,6 +1386,8 @@ class QgsProcessingParameterExpression : QgsProcessingParameterDefinition
Returns the type name for the parameter class.
:rtype: str
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
@ -1386,7 +1420,42 @@ class QgsProcessingParameterExpression : QgsProcessingParameterDefinition
};
class QgsProcessingParameterVectorLayer : QgsProcessingParameterDefinition
class QgsProcessingParameterLimitedDataTypes
{
%Docstring
Can be inherited by parameters which require limits to their acceptable data types.
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterLimitedDataTypes( const QList< int > &types = QList< int >() );
%Docstring
Constructor for QgsProcessingParameterLimitedDataTypes, with a list of acceptable data ``types``.
%End
QList< int > dataTypes() const;
%Docstring
Returns the geometry types for sources acceptable by the parameter.
.. seealso:: setDataTypes()
:rtype: list of int
%End
void setDataTypes( const QList< int > &types );
%Docstring
Sets the geometry ``types`` for sources acceptable by the parameter.
.. seealso:: dataTypes()
%End
protected:
};
class QgsProcessingParameterVectorLayer : QgsProcessingParameterDefinition, QgsProcessingParameterLimitedDataTypes
{
%Docstring
A vector layer (with or without geometry) parameter for processing algorithms. Consider using
@ -1413,25 +1482,14 @@ class QgsProcessingParameterVectorLayer : QgsProcessingParameterDefinition
Returns the type name for the parameter class.
:rtype: str
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
QList< int > dataTypes() const;
%Docstring
Returns the geometry types for sources acceptable by the parameter.
.. seealso:: setDataTypes()
:rtype: list of int
%End
void setDataTypes( const QList< int > &types );
%Docstring
Sets the geometry ``types`` for sources acceptable by the parameter.
.. seealso:: dataTypes()
%End
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
@ -1479,6 +1537,8 @@ class QgsProcessingParameterField : QgsProcessingParameterDefinition
Returns the type name for the parameter class.
:rtype: str
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
@ -1541,7 +1601,8 @@ class QgsProcessingParameterField : QgsProcessingParameterDefinition
};
class QgsProcessingParameterFeatureSource : QgsProcessingParameterDefinition
class QgsProcessingParameterFeatureSource : QgsProcessingParameterDefinition, QgsProcessingParameterLimitedDataTypes
{
%Docstring
An input feature source (such as vector layers) parameter for processing algorithms.
@ -1565,6 +1626,8 @@ class QgsProcessingParameterFeatureSource : QgsProcessingParameterDefinition
Returns the type name for the parameter class.
:rtype: str
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
@ -1573,19 +1636,6 @@ class QgsProcessingParameterFeatureSource : QgsProcessingParameterDefinition
virtual QString asScriptCode() const;
QList< int > dataTypes() const;
%Docstring
Returns the geometry types for sources acceptable by the parameter.
.. seealso:: setDataTypes()
:rtype: list of int
%End
void setDataTypes( const QList< int > &types );
%Docstring
Sets the geometry ``types`` for sources acceptable by the parameter.
.. seealso:: dataTypes()
%End
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
@ -1693,7 +1743,7 @@ class QgsProcessingParameterFeatureSink : QgsProcessingDestinationParameter
%End
public:
QgsProcessingParameterFeatureSink( const QString &name, const QString &description = QString(), QgsProcessing::LayerType type = QgsProcessing::TypeVectorAny, const QVariant &defaultValue = QVariant(),
QgsProcessingParameterFeatureSink( const QString &name, const QString &description = QString(), QgsProcessing::SourceType type = QgsProcessing::TypeVectorAnyGeometry, const QVariant &defaultValue = QVariant(),
bool optional = false );
%Docstring
Constructor for QgsProcessingParameterFeatureSink.
@ -1704,6 +1754,8 @@ class QgsProcessingParameterFeatureSink : QgsProcessingDestinationParameter
Returns the type name for the parameter class.
:rtype: str
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
@ -1716,11 +1768,11 @@ class QgsProcessingParameterFeatureSink : QgsProcessingDestinationParameter
virtual QString defaultFileExtension() const;
QgsProcessing::LayerType dataType() const;
QgsProcessing::SourceType dataType() const;
%Docstring
Returns the layer type for sinks associated with the parameter.
.. seealso:: setDataType()
:rtype: QgsProcessing.LayerType
:rtype: QgsProcessing.SourceType
%End
bool hasGeometry() const;
@ -1730,7 +1782,7 @@ class QgsProcessingParameterFeatureSink : QgsProcessingDestinationParameter
:rtype: bool
%End
void setDataType( QgsProcessing::LayerType type );
void setDataType( QgsProcessing::SourceType type );
%Docstring
Sets the layer ``type`` for the sinks associated with the parameter.
.. seealso:: dataType()
@ -1770,7 +1822,7 @@ class QgsProcessingParameterVectorDestination : QgsProcessingDestinationParamete
%End
public:
QgsProcessingParameterVectorDestination( const QString &name, const QString &description = QString(), QgsProcessing::LayerType type = QgsProcessing::TypeVectorAny, const QVariant &defaultValue = QVariant(),
QgsProcessingParameterVectorDestination( const QString &name, const QString &description = QString(), QgsProcessing::SourceType type = QgsProcessing::TypeVectorAnyGeometry, const QVariant &defaultValue = QVariant(),
bool optional = false );
%Docstring
Constructor for QgsProcessingParameterVectorDestination.
@ -1781,6 +1833,8 @@ class QgsProcessingParameterVectorDestination : QgsProcessingDestinationParamete
Returns the type name for the parameter class.
:rtype: str
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
@ -1793,11 +1847,11 @@ class QgsProcessingParameterVectorDestination : QgsProcessingDestinationParamete
virtual QString defaultFileExtension() const;
QgsProcessing::LayerType dataType() const;
QgsProcessing::SourceType dataType() const;
%Docstring
Returns the layer type for this created vector layer.
.. seealso:: setDataType()
:rtype: QgsProcessing.LayerType
:rtype: QgsProcessing.SourceType
%End
bool hasGeometry() const;
@ -1807,7 +1861,7 @@ class QgsProcessingParameterVectorDestination : QgsProcessingDestinationParamete
:rtype: bool
%End
void setDataType( QgsProcessing::LayerType type );
void setDataType( QgsProcessing::SourceType type );
%Docstring
Sets the layer ``type`` for the created vector layer.
.. seealso:: dataType()
@ -1852,6 +1906,8 @@ class QgsProcessingParameterRasterDestination : QgsProcessingDestinationParamete
Returns the type name for the parameter class.
:rtype: str
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
@ -1895,6 +1951,8 @@ class QgsProcessingParameterFileDestination : QgsProcessingDestinationParameter
Returns the type name for the parameter class.
:rtype: str
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
@ -1958,6 +2016,8 @@ class QgsProcessingParameterFolderDestination : QgsProcessingDestinationParamete
Returns the type name for the parameter class.
:rtype: str
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
@ -1998,6 +2058,8 @@ class QgsProcessingParameterBand : QgsProcessingParameterDefinition
Returns the type name for the parameter class.
:rtype: str
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;

View File

@ -153,12 +153,6 @@ Compare two doubles using specified number of significant digits
:rtype: bool
%End
double qgsRound( double x );
%Docstring
A round function which returns a double to guard against overflows
:rtype: float
%End
double qgsRound( double number, double places );
%Docstring
Returns a double ``number``, rounded (as close as possible) to the specified number of ``places``.
@ -167,6 +161,8 @@ double qgsRound( double number, double places );
:rtype: float
%End
double qgsPermissiveToDouble( QString string, bool &ok );
%Docstring
Converts a string to a double in a permissive way, e.g., allowing for incorrect

View File

@ -52,6 +52,7 @@ class QgsDataItem : QObject
Project
};
QgsDataItem( QgsDataItem::Type type, QgsDataItem *parent /TransferThis/, const QString &name, const QString &path );
%Docstring
Create new data item.

View File

@ -46,7 +46,6 @@ class QgsDataProvider : QObject
%End
public:
enum DataCapability
{
NoDataCapabilities,

View File

@ -179,7 +179,7 @@ Constructor
:rtype: float
%End
double measureLineProjected( const QgsPointXY &p1, double distance = 1, double azimuth = M_PI / 2, QgsPointXY *projectedPoint /Out/ = 0 ) const;
double measureLineProjected( const QgsPointXY &p1, double distance = 1, double azimuth = M_PI_2, QgsPointXY *projectedPoint /Out/ = 0 ) const;
%Docstring
Calculates the distance from one point with distance in meters and azimuth (direction)
When the sourceCrs() is geographic, computeSpheroidProject() will be called
@ -279,7 +279,7 @@ Constructor
:rtype: float
%End
QgsPointXY computeSpheroidProject( const QgsPointXY &p1, double distance = 1, double azimuth = M_PI / 2 ) const;
QgsPointXY computeSpheroidProject( const QgsPointXY &p1, double distance = 1, double azimuth = M_PI_2 ) const;
%Docstring
Given a location, an azimuth and a distance, computes the
location of the projected point. Based on Vincenty's formula

View File

@ -48,6 +48,14 @@ Returns encoded representation of the object
:rtype: QgsVectorLayer
%End
QgsRasterLayer *rasterLayer( bool &owner, QString &error ) const;
%Docstring
Get raster layer from uri if possible, otherwise returns 0 and error is set
\param owner set to true if caller becomes owner
\param error set to error message if cannot get raster
:rtype: QgsRasterLayer
%End
QString layerType;
%Docstring
Type of URI. Recognized types: "vector" / "raster" / "plugin" / "custom"

View File

@ -285,6 +285,11 @@ Divides the coordinates in this point by a scalar quantity in place
:rtype: QgsPointXY
%End
operator QVariant() const;
%Docstring
Allows direct construction of QVariants from points.
%End
SIP_PYOBJECT __repr__();
%MethodCode
QString str = "(" + QString::number( sipCpp->x() ) + "," + QString::number( sipCpp->y() ) + ")";

View File

@ -10,7 +10,6 @@
class QgsStatisticalSummary
{
%Docstring

View File

@ -34,7 +34,7 @@ class QgsUserProfileManager : QObject
User profile manager used to manage user profiles for the instance of QGIS.
%End
static QString resolveProfilesFolder( const QString &basePath = QString() );
static QString resolveProfilesFolder( const QString &basePath = QString() );
%Docstring
Resolves the profiles folder for the given path. Path will have \\profiles appended to the path
\param basePath The base path to resolve the path from to append the \\profiles folder to.
@ -58,7 +58,7 @@ class QgsUserProfileManager : QObject
:rtype: QgsUserProfile
%End
void setRootLocation( QString rootProfileLocation );
void setRootLocation( const QString &rootProfileLocation );
%Docstring
Set the root profile location for the profile manager. All profiles are loaded from this
location. Will also contain a profiles.ini for holding profile settings.
@ -72,6 +72,28 @@ class QgsUserProfileManager : QObject
:rtype: str
%End
void setNewProfileNotificationEnabled( bool enabled );
%Docstring
Sets whether the manager should watch for the creation of new user profiles and emit
the profilesChanged() signal when this occurs. By default new profile notification
is disabled.
Before calling this, ensure that the correct root location has been set via
calling setRootLocation().
.. seealso:: isNewProfileNotificationEnabled()
%End
bool isNewProfileNotificationEnabled() const;
%Docstring
Returns whether the manager is watching for the creation of new user profiles and emitting
the profilesChanged() signal when this occurs. By default new profile notification
is disabled.
.. seealso:: setNewProfileNotificationEnabled()
:rtype: bool
%End
bool rootLocationIsSet() const;
%Docstring
Check if the root location has been set for the manager.
@ -118,7 +140,7 @@ class QgsUserProfileManager : QObject
Set the default profile name from the current active profile.
%End
QgsUserProfile *profileForName( const QString name ) const;
QgsUserProfile *profileForName( const QString &name ) const /Factory/;
%Docstring
Return the profile found for a given name.
\param name The name of the profile to return.
@ -134,7 +156,7 @@ class QgsUserProfileManager : QObject
:rtype: QgsError
%End
QgsError deleteProfile( const QString name );
QgsError deleteProfile( const QString &name );
%Docstring
Deletes a profile from the root profiles folder.
.. note::
@ -169,9 +191,15 @@ class QgsUserProfileManager : QObject
signals:
void profilesChanged( );
void profilesChanged();
%Docstring
Emitted when the list of profiles is changed.
This signal will only be emitted when isNewProfileNotificationEnabled() is true.
By default new profile notification is disabled.
.. seealso:: isNewProfileNotificationEnabled()
.. seealso:: setNewProfileNotificationEnabled()
%End
};

View File

@ -905,7 +905,7 @@ Return the provider type for this layer
:rtype: QgsFeatureIterator
%End
QgsFeature getFeature( QgsFeatureId fid );
QgsFeature getFeature( QgsFeatureId fid ) const;
%Docstring
Query the layer for the feature with the given id.
If there is no such feature, the returned feature will be invalid.
@ -1787,10 +1787,6 @@ Returns the current blending mode for features
:rtype: bool
%End
protected slots:
void invalidateSymbolCountedFlag();
signals:
void selectionChanged( const QgsFeatureIds &selected, const QgsFeatureIds &deselected, const bool clearAndSelect );

View File

@ -52,7 +52,7 @@ class QgsVectorLayerExporter : QgsFeatureSink
const QgsCoordinateReferenceSystem &destCRS,
bool onlySelected = false,
QString *errorMessage /Out/ = 0,
QMap<QString, QVariant> *options = 0,
const QMap<QString, QVariant> &options = QMap<QString, QVariant>(),
QgsFeedback *feedback = 0
);
%Docstring
@ -76,7 +76,7 @@ class QgsVectorLayerExporter : QgsFeatureSink
QgsWkbTypes::Type geometryType,
const QgsCoordinateReferenceSystem &crs,
bool overwrite = false,
const QMap<QString, QVariant> *options = 0 );
const QMap<QString, QVariant> &options = QMap<QString, QVariant>() );
%Docstring
Constructor for QgsVectorLayerExporter.
\param uri URI for destination data source
@ -152,7 +152,7 @@ class QgsVectorLayerExporterTask : QgsTask
const QString &uri,
const QString &providerKey,
const QgsCoordinateReferenceSystem &destinationCrs,
QMap<QString, QVariant> *options = 0,
const QMap<QString, QVariant> &options = QMap<QString, QVariant>(),
bool ownsLayer = false );
%Docstring
Constructor for QgsVectorLayerExporterTask. Takes a source ``layer``, destination ``uri``
@ -165,7 +165,7 @@ class QgsVectorLayerExporterTask : QgsTask
const QString &uri,
const QString &providerKey,
const QgsCoordinateReferenceSystem &destinationCrs,
QMap<QString, QVariant> *options = 0 ) /Factory/;
const QMap<QString, QVariant> &options = QMap<QString, QVariant>() ) /Factory/;
%Docstring
Creates a new QgsVectorLayerExporterTask which has ownership over a source ``layer``.
When the export task has completed (successfully or otherwise) ``layer`` will be

View File

@ -14,7 +14,7 @@
typedef QList< QgsVectorLayerJoinInfo > QgsVectorJoinList;
class QgsVectorLayerJoinBuffer : QObject
class QgsVectorLayerJoinBuffer : QObject, QgsFeatureSink
{
%Docstring
Manages joined fields for a vector layer*
@ -117,12 +117,83 @@ Quick way to test if there is any join at all
:rtype: QgsFeature
%End
QgsFeature targetedFeatureOf( const QgsVectorLayerJoinInfo *info, const QgsFeature &feature ) const;
%Docstring
Returns the targeted feature corresponding to the joined feature.
\param info the vector join information
\param feature the feature of the joined layer
.. versionadded:: 3.0
:rtype: QgsFeature
%End
QgsVectorLayerJoinBuffer *clone() const /Factory/;
%Docstring
.. versionadded:: 2.6
:rtype: QgsVectorLayerJoinBuffer
%End
virtual bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = 0 );
%Docstring
Adds a list of features in joined layers. Features given in parameter
are those added in target layer. If a corresponding joined feature yet
exists in a joined layer, then this feature is just updated. Note that
if a corresponding joined feature has only empty fields, then it's not
created nor added.
\param features The list of features added in the target layer
\param flags Unused parameter
:return: false if an error happened, true otherwise
.. versionadded:: 3.0
:rtype: bool
%End
bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() );
%Docstring
Changes attribute value in joined layers. The feature id given in
parameter is the one added in target layer. If the corresponding joined
feature does not exist in a joined layer, then it's automatically
created if its fields are not empty.
\param fid The feature id
\param field The field to update
\param newValue The new value of the attribute
\param oldValue The old value of the attribute
:return: false if an error happened, true otherwise
.. versionadded:: 3.0
:rtype: bool
%End
bool deleteFeature( QgsFeatureId fid ) const;
%Docstring
Deletes a feature from joined layers. The feature id given in
parameter is the one coming from the target layer.
\param fid The feature id from the target layer to delete
:return: false if an error happened, true otherwise
.. versionadded:: 3.0
:rtype: bool
%End
bool deleteFeatures( const QgsFeatureIds &fids ) const;
%Docstring
Deletes a list of features from joined layers. Feature ids given
in aprameter are those coming from the target layer.
\param fids Feature ids from the target layer to delete
:return: false if an error happened, true otherwise
.. versionadded:: 3.0
:rtype: bool
%End
signals:
void joinedFieldsChanged();
%Docstring

View File

@ -101,6 +101,50 @@ Returns whether values from the joined layer should be cached in memory to speed
Sets whether the form has to be dynamically updated with joined fields
when a feature is being created in the target layer.
.. versionadded:: 3.0
%End
bool isEditable() const;
%Docstring
Returns whether joined fields may be edited through the form of
the target layer.
.. versionadded:: 3.0
:rtype: bool
%End
void setEditable( bool enabled );
%Docstring
Sets whether the form of the target layer allows editing joined fields.
.. versionadded:: 3.0
%End
bool hasUpsertOnEdit() const;
%Docstring
Returns whether a feature created on the target layer has to impact
the joined layer by creating a new feature if necessary.
.. versionadded:: 3.0
:rtype: bool
%End
void setUpsertOnEdit( bool enabled );
%Docstring
Sets whether a feature created on the target layer has to impact
the joined layer by creating a new feature if necessary.
.. versionadded:: 3.0
%End
bool hasCascadedDelete() const;
%Docstring
Returns whether a feature deleted on the target layer has to impact the
joined layer by deleting the corresponding joined feature.
.. versionadded:: 3.0
:rtype: bool
%End
void setCascadedDelete( bool enabled );
%Docstring
Sets whether a feature deleted on the target layer has to impact the
joined layer by deleting the corresponding joined feature.
.. versionadded:: 3.0
%End
QString prefixedFieldName( const QgsField &field ) const;
@ -112,6 +156,16 @@ Returns whether values from the joined layer should be cached in memory to speed
:rtype: str
%End
QgsFeature extractJoinedFeature( const QgsFeature &feature ) const;
%Docstring
Extract the join feature from the target feature for the current
join layer information.
\param feature A feature from the target layer
:return: the corresponding joined feature
.. versionadded:: 3.0
:rtype: QgsFeature
%End
bool operator==( const QgsVectorLayerJoinInfo &other ) const;
void setJoinFieldNamesSubset( QStringList *fieldNamesSubset /Transfer/ );
@ -137,6 +191,9 @@ Returns whether values from the joined layer should be cached in memory to speed
};

View File

@ -47,7 +47,7 @@ class QgsRasterHistogram
Whether histogram includes out of range values (in first and last bin)
%End
HistogramVector histogramVector;
QgsRasterHistogram::HistogramVector histogramVector;
%Docstring
Store the histogram for a given layer
.. note::

View File

@ -11,7 +11,6 @@
class QgsSymbolLayer
{

View File

@ -26,7 +26,7 @@ ELSE(MSVC)
SET_SOURCE_FILES_PROPERTIES(${PYSPATIALITE_SRC} PROPERTIES COMPILE_FLAGS -w)
ENDIF(MSVC)
ADD_DEFINITIONS(-DMODULE_NAME=\\\"spatialite.dbapi2\\\")
ADD_DEFINITIONS(-DMODULE_NAME="spatialite.dbapi2")
IF (CYGWIN OR APPLE)
ADD_LIBRARY(pyspatialite MODULE ${PYSPATIALITE_SRC})

View File

@ -34,6 +34,7 @@ class QgsDualView : QStackedWidget
AttributeEditor
};
explicit QgsDualView( QWidget *parent /TransferThis/ = 0 );
%Docstring
Constructor
@ -170,13 +171,6 @@ class QgsDualView : QStackedWidget
:rtype: str
%End
protected:
void columnBoxInit();
%Docstring
Initializes widgets which depend on the attributes of this layer
%End
public slots:
void setCurrentEditSelection( const QgsFeatureIds &fids );
@ -243,6 +237,9 @@ class QgsDualView : QStackedWidget
\param mode new mode
%End
protected:
virtual void hideEvent( QHideEvent *event );
};
class QgsAttributeTableAction : QAction

View File

@ -90,6 +90,8 @@ class QgsSearchWidgetWrapper : QgsWidgetWrapper
IsNull,
IsNotBetween,
IsNotNull,
StartsWith,
EndsWith,
};
typedef QFlags<QgsSearchWidgetWrapper::FilterFlag> FilterFlags;

View File

@ -21,6 +21,8 @@
%Include qgsvertexmarker.sip
%Include qgsfiledownloader.sip
%Include qgsabstractdatasourcewidget.sip
%Include qgssourceselectprovider.sip
%Include qgssourceselectproviderregistry.sip
%Include attributetable/qgsfeaturemodel.sip
%Include auth/qgsauthauthoritieseditor.sip
%Include auth/qgsauthcertificateinfo.sip

View File

@ -90,6 +90,16 @@ Emitted when a vector layer has been selected for addition
\param dataSourceType string (can be "file" or "database")
%End
void replaceVectorLayer( const QString &oldId, const QString &source, const QString &name, const QString &provider );
%Docstring
Emitted when a layer needs to be replaced
\param oldId old layer ID
\param source URI of the layer
\param name of the layer
\param provider key
%End
void progress( int, int );
%Docstring
Emitted when a progress dialog is shown by the provider dialog

View File

@ -28,6 +28,7 @@ class QgsCodeEditorSQL : QgsCodeEditor
};
/************************************************************************
* This file has been generated automatically from *
* *

View File

@ -30,7 +30,8 @@ class QgsFileWidget : QWidget
enum StorageMode
{
GetFile,
GetDirectory
GetDirectory,
GetMultipleFiles,
};
enum RelativeStorage
@ -47,10 +48,20 @@ class QgsFileWidget : QWidget
QString filePath();
%Docstring
Returns the current file path
Returns the current file path(s)
when multiple files are selected, they are quoted and separated
by a single space (for example: '"/path/foo" "path/bar"')
.. seealso:: filePaths
:rtype: str
%End
static QStringList splitFilePaths( const QString &path );
%Docstring
Split the the quoted and space separated ``path`` and returns a QString list
.. seealso:: filePath
:rtype: list of str
%End
void setFilePath( QString path );
%Docstring
Sets the file path
@ -72,7 +83,7 @@ returns the open file dialog title
setDialogTitle defines the open file dialog title
.. note::
if not defined, the title is "Select a file" or "Select a directory" depending on the configuration.
if not defined, the title is "Select a file" or "Select a directory" or "Select one or more files" depending on the configuration.
%End
QString filter() const;

View File

@ -31,13 +31,13 @@ class QgsFontButton : QToolButton
%End
public:
enum Mode
{
ModeTextRenderer,
ModeQFont,
};
QgsFontButton( QWidget *parent /TransferThis/ = 0, const QString &dialogTitle = QString() );
%Docstring
Construct a new font button.

View File

@ -38,6 +38,12 @@ class QgsGui
:rtype: QgsEditorWidgetRegistry
%End
static QgsSourceSelectProviderRegistry *sourceSelectProviderRegistry();
%Docstring
Returns the global source select provider registry, used for managing all known source select widget factories.
:rtype: QgsSourceSelectProviderRegistry
%End
static QgsShortcutsManager *shortcutsManager();
%Docstring
Returns the global shortcuts manager, used for managing a QAction and QShortcut sequences.

View File

@ -593,6 +593,27 @@ returns last position of mouse cursor
:rtype: QgsLabelingEngineSettings
%End
bool previewJobsEnabled() const;
%Docstring
Returns true if canvas map preview jobs (low priority render jobs which render portions
of the view just outside of the canvas extent, to allow preview of these
out-of-canvas areas when panning or zooming out the map) are enabled
for the canvas.
.. seealso:: setPreviewJobsEnabled()
.. versionadded:: 3.0
:rtype: bool
%End
void setPreviewJobsEnabled( bool enabled );
%Docstring
Sets whether canvas map preview jobs (low priority render jobs which render portions
of the view just outside of the canvas extent, to allow preview of these
out-of-canvas areas when panning or zooming out the map) are ``enabled``
for the canvas.
.. seealso:: previewJobsEnabled()
.. versionadded:: 3.0
%End
public slots:
void refresh();

View File

@ -0,0 +1,85 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgssourceselectprovider.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsSourceSelectProvider
{
%Docstring
This is the interface for those who want to add entries to the QgsDataSourceManagerDialog
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgssourceselectprovider.h"
%End
public:
virtual ~QgsSourceSelectProvider();
virtual QString providerKey() const = 0;
%Docstring
Data Provider key
:rtype: str
%End
virtual QString name() const;
%Docstring
Source select provider name, this is useful to retrieve
a particular source select in case the provider has more
than one, it should be unique among all providers.
The default implementation returns the providerKey()
:rtype: str
%End
virtual QString text() const = 0;
%Docstring
Text for the menu item entry, it will be visible to the user so make sure it's translatable
:rtype: str
%End
virtual QString toolTip() const;
%Docstring
Text for the tooltip menu item entry, it will be visible to the user so make sure it's translatable
The default implementation returns an empty string.
:rtype: str
%End
virtual QIcon icon() const = 0;
%Docstring
Creates a new instance of an QIcon for the menu item entry
:rtype: QIcon
%End
virtual int ordering( ) const;
%Docstring
Ordering: the source select provider registry will be able to sort
the source selects (ascending) using this integer value
:rtype: int
%End
virtual QgsAbstractDataSourceWidget *createDataSourceWidget( QWidget *parent = 0, Qt::WindowFlags fl = Qt::Widget, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::Embedded ) const = 0 /Factory/;
%Docstring
Create a new instance of QgsAbstractDataSourceWidget (or null).
Caller takes responsibility of deleting created.
:rtype: QgsAbstractDataSourceWidget
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgssourceselectprovider.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -0,0 +1,78 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgssourceselectproviderregistry.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsSourceSelectProviderRegistry
{
%Docstring
This class keeps a list of source select providers that may add items to the QgsDataSourceManagerDialog
When created, it automatically adds providers from data provider plugins (e.g. PostGIS, WMS, ...)
QgsSourceSelectProviderRegistry is not usually directly created, but rather accessed through
QgsGui.sourceSelectProviderRegistry().
.. note::
This class access to QgsProviderRegistry instance to initialize, but QgsProviderRegistry is
typically initialized after QgsGui is constructed, for this reason a delayed initialization has been
implemented in the class.
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgssourceselectproviderregistry.h"
%End
public:
QgsSourceSelectProviderRegistry();
~QgsSourceSelectProviderRegistry();
QList< QgsSourceSelectProvider *> providers();
%Docstring
Get list of available providers
:rtype: list of QgsSourceSelectProvider
%End
void addProvider( QgsSourceSelectProvider *provider /Transfer/ );
%Docstring
Add a ``provider`` implementation. Takes ownership of the object.
%End
bool removeProvider( QgsSourceSelectProvider *provider /Transfer/ );
%Docstring
:return: true if the provider was actually removed and deleted
:rtype: bool
%End
QgsSourceSelectProvider *providerByName( const QString &name );
%Docstring
Return a provider by ``name`` or None if not found
:rtype: QgsSourceSelectProvider
%End
QList<QgsSourceSelectProvider *> providersByKey( const QString &providerKey );
%Docstring
Return a (possibly empty) list of providers by data ``providerkey``
:rtype: list of QgsSourceSelectProvider
%End
private:
QgsSourceSelectProviderRegistry( const QgsSourceSelectProviderRegistry &rh );
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgssourceselectproviderregistry.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -40,6 +40,7 @@ Returns configuration as set up in the dialog (may be null). Ownership is passed
};
/************************************************************************
* This file has been generated automatically from *
* *

View File

@ -8,7 +8,6 @@
class QgsSymbolLevelsDialog : QDialog
{

View File

@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Add versioning support to a table</string>
<string>Add Versioning Support to a Table</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0" rowspan="2">
@ -19,60 +19,50 @@
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Table is expected to be empty, with a primary key.</string>
<string>Table should be empty, with a primary key</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QComboBox" name="cboSchema"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Schema</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="cboSchema"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Table</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="cboTable"/>
</item>
<item row="0" column="2" rowspan="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>48</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="chkCreateCurrent">
<property name="text">
<string>create a view with current content (&lt;TABLE&gt;_current)</string>
<string>Create a view with current content (&lt;TABLE&gt;_current)</string>
</property>
<property name="checked">
<bool>true</bool>
@ -88,10 +78,10 @@
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Prim. key</string>
<string>Primary key</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
@ -108,7 +98,7 @@
<string>Start time</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
@ -125,7 +115,7 @@
<string>End time</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
@ -157,7 +147,7 @@
<item row="0" column="1">
<widget class="QLabel" name="label_5">
<property name="text">
<string>SQL to be executed:</string>
<string>SQL to be executed</string>
</property>
</widget>
</item>

View File

@ -37,12 +37,13 @@ from .AssignProjection import AssignProjection
from .aspect import aspect
from .buildvrt import buildvrt
from .ColorRelief import ColorRelief
from .information import information
from .rgb2pct import rgb2pct
from .translate import translate
from .tri import tri
from .warp import warp
from .nearblack import nearblack
# from .information import information
# from .rgb2pct import rgb2pct
# from .translate import translate
# from .pct2rgb import pct2rgb
# from .merge import merge
# from .polygonize import polygonize
@ -140,16 +141,16 @@ class GdalAlgorithmProvider(QgsProcessingProvider):
def loadAlgorithms(self):
self.algs = [
nearblack(),
# information(),
AssignProjection(),
aspect(),
buildvrt(),
ColorRelief(),
information(),
nearblack(),
rgb2pct(),
translate(),
tri(),
warp(),
# translate(),
# rgb2pct(),
# pct2rgb(),
# merge(),
# polygonize(),

View File

@ -193,6 +193,8 @@ class GdalUtils(object):
def escapeAndJoin(strList):
joined = ''
for s in strList:
if not isinstance(s, str):
s = str(s)
if s and s[0] != '-' and ' ' in s:
escaped = '"' + s.replace('\\', '\\\\').replace('"', '\\"') \
+ '"'

View File

@ -63,6 +63,10 @@ class buildvrt(GdalAlgorithm):
def __init__(self, name, description):
super().__init__(name, description)
def clone(self):
copy = ParameterVrtDestination(self.name(), self.description())
return copy
def type(self):
return 'vrt_destination'

View File

@ -29,10 +29,11 @@ __revision__ = '$Format:%H$'
import os
from qgis.PyQt.QtGui import QIcon
from qgis.core import (QgsProcessingParameterRasterLayer,
QgsProcessingParameterBoolean,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml)
from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
from processing.core.parameters import ParameterRaster
from processing.core.parameters import ParameterBoolean
from processing.core.outputs import OutputHTML
from processing.algs.gdal.GdalUtils import GdalUtils
@ -53,14 +54,15 @@ class information(GdalAlgorithm):
super().__init__()
def initAlgorithm(self, config=None):
self.addParameter(ParameterRaster(information.INPUT,
self.tr('Input layer'), False))
self.addParameter(ParameterBoolean(information.NOGCP,
self.tr('Suppress GCP info'), False))
self.addParameter(ParameterBoolean(information.NOMETADATA,
self.tr('Suppress metadata info'), False))
self.addOutput(OutputHTML(information.OUTPUT,
self.tr('Layer information')))
self.addParameter(QgsProcessingParameterRasterLayer(information.INPUT,
self.tr('Input layer'), optional=False))
self.addParameter(QgsProcessingParameterBoolean(information.NOGCP,
self.tr('Suppress GCP info'), defaultValue=False))
self.addParameter(QgsProcessingParameterBoolean(information.NOMETADATA,
self.tr('Suppress metadata info'), defaultValue=False))
self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT, self.tr('Layer information'), self.tr('HTML files (*.html)')))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT, self.tr('Layer information')))
def name(self):
return 'gdalinfo'
@ -73,18 +75,20 @@ class information(GdalAlgorithm):
def getConsoleCommands(self, parameters, context, feedback):
arguments = []
if self.getParameterValue(information.NOGCP):
if self.parameterAsBool(parameters, information.NOGCP, context):
arguments.append('-nogcp')
if self.getParameterValue(information.NOMETADATA):
if self.parameterAsBool(parameters, information.NOMETADATA, context):
arguments.append('-nomd')
arguments.append(self.getParameterValue(information.INPUT))
arguments.append(self.parameterAsRasterLayer(parameters, information.INPUT, context).source())
return ['gdalinfo', GdalUtils.escapeAndJoin(arguments)]
def processAlgorithm(self, parameters, context, feedback):
GdalUtils.runGdal(self.getConsoleCommands(parameters), feedback)
output = self.getOutputValue(information.OUTPUT)
GdalUtils.runGdal(self.getConsoleCommands(parameters, context, feedback), feedback)
output = self.parameterAsFileOutput(parameters, self.OUTPUT, context)
with open(output, 'w') as f:
f.write('<pre>')
for s in GdalUtils.getConsoleOutput()[1:]:
f.write(str(s))
f.write('</pre>')
return {self.OUTPUT: output}

View File

@ -31,10 +31,10 @@ import os
from qgis.PyQt.QtGui import QIcon
from qgis.core import (QgsProcessingParameterRasterLayer,
QgsProcessingParameterNumber,
QgsProcessingParameterRasterDestination)
from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
from processing.core.parameters import ParameterRaster
from processing.core.parameters import ParameterNumber
from processing.core.outputs import OutputRaster
from processing.tools.system import isWindows
from processing.algs.gdal.GdalUtils import GdalUtils
@ -57,11 +57,11 @@ class rgb2pct(GdalAlgorithm):
super().__init__()
def initAlgorithm(self, config=None):
self.addParameter(ParameterRaster(rgb2pct.INPUT,
self.tr('Input layer'), False))
self.addParameter(ParameterNumber(rgb2pct.NCOLORS,
self.tr('Number of colors'), 1, None, 2))
self.addOutput(OutputRaster(rgb2pct.OUTPUT, self.tr('RGB to PCT')))
self.addParameter(QgsProcessingParameterRasterLayer(rgb2pct.INPUT,
self.tr('Input layer'), optional=False))
self.addParameter(QgsProcessingParameterNumber(rgb2pct.NCOLORS,
self.tr('Number of colors'), minValue=1, defaultValue=2))
self.addParameter(QgsProcessingParameterRasterDestination(self.OUTPUT, self.tr('RGB to PCT')))
def name(self):
return 'rgbtopct'
@ -72,11 +72,11 @@ class rgb2pct(GdalAlgorithm):
def getConsoleCommands(self, parameters, context, feedback):
arguments = []
arguments.append('-n')
arguments.append(str(self.getParameterValue(rgb2pct.NCOLORS)))
arguments.append(str(self.parameterAsInt(parameters, rgb2pct.NCOLORS, context)))
arguments.append('-of')
out = self.getOutputValue(rgb2pct.OUTPUT)
out = self.parameterAsOutputLayer(parameters, self.OUTPUT, context)
arguments.append(GdalUtils.getFormatShortNameFromFilename(out))
arguments.append(self.getParameterValue(rgb2pct.INPUT))
arguments.append(self.parameterAsRasterLayer(parameters, self.INPUT, context).source())
arguments.append(out)
if isWindows():

View File

@ -30,15 +30,16 @@ import os
from qgis.PyQt.QtGui import QIcon
from qgis.core import (QgsProcessingParameterRasterLayer,
QgsProcessingParameterNumber,
QgsProcessingParameterBoolean,
QgsProcessingParameterString,
QgsProcessingParameterEnum,
QgsProcessingParameterCrs,
QgsProcessingParameterExtent,
QgsProcessingParameterRasterDestination,
QgsProcessingUtils)
from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
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
@ -67,34 +68,35 @@ class translate(GdalAlgorithm):
super().__init__()
def initAlgorithm(self, config=None):
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))
self.addParameter(ParameterBoolean(self.OUTSIZE_PERC,
self.tr('Output size is a percentage of input size'), True))
self.addParameter(ParameterString(self.NO_DATA,
self.tr("Nodata value, leave blank to take the nodata value from input"),
'', optional=True))
self.addParameter(ParameterSelection(self.EXPAND,
self.tr('Expand'), ['none', 'gray', 'rgb', 'rgba'], default=0))
self.addParameter(ParameterCrs(self.SRS,
self.tr('Output projection for output file [leave blank to use input projection]'), None, optional=True))
self.addParameter(ParameterExtent(self.PROJWIN,
self.tr('Subset based on georeferenced coordinates'), optional=True))
self.addParameter(ParameterBoolean(self.SDS,
self.tr('Copy all subdatasets of this file to individual output files'),
False))
self.addParameter(QgsProcessingParameterRasterLayer(self.INPUT, self.tr('Input layer')))
self.addParameter(QgsProcessingParameterNumber(self.OUTSIZE,
self.tr('Set the size of the output file (In pixels or %)'),
minValue=1, defaultValue=100))
self.addParameter(QgsProcessingParameterBoolean(self.OUTSIZE_PERC,
self.tr('Output size is a percentage of input size'), defaultValue=True))
self.addParameter(QgsProcessingParameterString(self.NO_DATA,
self.tr("Nodata value, leave blank to take the nodata value from input"),
defaultValue='', optional=True))
self.addParameter(QgsProcessingParameterEnum(self.EXPAND,
self.tr('Expand'), options=['none', 'gray', 'rgb', 'rgba'], defaultValue=0))
self.addParameter(QgsProcessingParameterCrs(self.SRS,
self.tr('Output projection for output file [leave blank to use input projection]'), defaultValue=None, optional=True))
self.addParameter(QgsProcessingParameterExtent(self.PROJWIN,
self.tr('Subset based on georeferenced coordinates'), optional=True))
self.addParameter(QgsProcessingParameterBoolean(self.SDS,
self.tr('Copy all subdatasets of this file to individual output files'),
defaultValue=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))
create_options_param = QgsProcessingParameterString(self.OPTIONS,
self.tr('Additional creation options'),
optional=True)
create_options_param.setMetadata({'widget_wrapper': 'processing.algs.gdal.ui.RasterOptionsWidget.RasterOptionsWidgetWrapper'})
self.addParameter(create_options_param)
self.addParameter(QgsProcessingParameterEnum(self.RTYPE,
self.tr('Output raster type'),
options=self.TYPE, defaultValue=5))
self.addOutput(OutputRaster(self.OUTPUT, self.tr('Converted')))
self.addParameter(QgsProcessingParameterRasterDestination(self.OUTPUT, self.tr('Converted')))
def name(self):
return 'translate'
@ -106,18 +108,19 @@ class translate(GdalAlgorithm):
return self.tr('Raster conversion')
def getConsoleCommands(self, parameters, context, feedback):
inLayer = self.getParameterValue(self.INPUT)
out = self.getOutputValue(translate.OUTPUT)
outsize = str(self.getParameterValue(self.OUTSIZE))
outsizePerc = str(self.getParameterValue(self.OUTSIZE_PERC))
noData = self.getParameterValue(self.NO_DATA)
expand = parameters[self.EXPAND].options[self.getParameterValue(self.EXPAND)][1]
projwin = str(self.getParameterValue(self.PROJWIN))
if not projwin:
projwin = QgsProcessingUtils.combineLayerExtents([inLayer])
crsId = self.getParameterValue(self.SRS)
sds = self.getParameterValue(self.SDS)
opts = self.getParameterValue(self.OPTIONS)
inLayer = self.parameterAsRasterLayer(parameters, self.INPUT, context)
out = self.parameterAsOutputLayer(parameters, self.OUTPUT, context)
outsize = str(self.parameterAsInt(parameters, self.OUTSIZE, context))
outsizePerc = self.parameterAsBool(parameters, self.OUTSIZE_PERC, context)
noData = self.parameterAsString(parameters, self.NO_DATA, context)
expand = self.parameterDefinition(self.EXPAND).options()[self.parameterAsEnum(parameters, self.EXPAND, context)]
proj_extent = self.parameterAsExtent(parameters, self.PROJWIN, context)
if proj_extent.isNull():
proj_extent = QgsProcessingUtils.combineLayerExtents([inLayer])
crsId = self.parameterAsCrs(parameters, self.SRS, context).authid()
sds = self.parameterAsBool(parameters, self.SDS, context)
opts = self.parameterAsString(parameters, self.OPTIONS, context)
if noData is not None:
noData = str(noData)
@ -126,8 +129,8 @@ class translate(GdalAlgorithm):
arguments.append('-of')
arguments.append(GdalUtils.getFormatShortNameFromFilename(out))
arguments.append('-ot')
arguments.append(self.TYPE[self.getParameterValue(self.RTYPE)])
if outsizePerc == 'True':
arguments.append(self.TYPE[self.parameterAsEnum(parameters, self.RTYPE, context)])
if outsizePerc:
arguments.append('-outsize')
arguments.append(outsize + '%')
arguments.append(outsize + '%')
@ -141,14 +144,13 @@ class translate(GdalAlgorithm):
if expand != 'none':
arguments.append('-expand')
arguments.append(expand)
regionCoords = projwin.split(',')
try:
projwin = []
projwin.append('-projwin')
projwin.append(regionCoords[0])
projwin.append(regionCoords[3])
projwin.append(regionCoords[1])
projwin.append(regionCoords[2])
projwin.append(proj_extent.xMinimum())
projwin.append(proj_extent.yMaximum())
projwin.append(proj_extent.xMaximum())
projwin.append(proj_extent.yMinimum())
except IndexError:
projwin = []
if projwin:
@ -163,7 +165,7 @@ class translate(GdalAlgorithm):
arguments.append('-co')
arguments.append(opts)
arguments.append(self.getParameterValue(self.INPUT))
arguments.append(inLayer.source())
arguments.append(out)
return ['gdal_translate', GdalUtils.escapeAndJoin(arguments)]

View File

@ -1,8 +1,8 @@
v.in.dxf
Converts files in DXF format to GRASS vector map format.
Vector (v.*)
ParameterFile|input|Name of input DXF file|False
ParameterString|layers|List of layers to import|
ParameterFile|input|Name of input DXF file|False|False
ParameterString|layers|List of layers to import||False|True
ParameterBoolean|-e|Ignore the map extent of DXF file|True
ParameterBoolean|-t|Do not create attribute tables|False
ParameterBoolean|-f|Import polyface meshes as 3D wire frame|True

View File

@ -20,6 +20,17 @@ qgis:adduniquevalueindexfield: >
qgis:advancedpythonfieldcalculator: >
This algorithm adds a new attribute to a vector layer, with values resulting from applying an expression to each feature. The expression is defined as a Python function.
qgis:aggregate: >
This algorithm take a vector or table layer and aggregate features based on a group by expression. Features for which group by expression return the same value are grouped together.
It is possible to group all source features together using constant value in group by parameter, example: NULL.
It is also possible to group features using multiple fields using Array function, example: Array("Field1", "Field2").
Geometries (if present) are combined into one multipart geometry for each group.
Output attributes are computed depending on each given aggregate definition.
qgis:barplot:
qgis:basicstatisticsforfields: >
@ -32,9 +43,6 @@ qgis:basicstatisticsforfields: >
qgis:boundary: >
Returns the closure of the combinatorial boundary of the input geometries (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. Only valid for polygon or line layers.
qgis:boundingboxes: >
This algorithm calculates the bounding box (envelope) of each feature in an input layer.
qgis:buildvirtualvector: >
This algorithm creates a virtual layer that contains a set of vector layer.
@ -65,11 +73,6 @@ qgis:convertgeometrytype: >
See the "Polygonize" or "Lines to polygons" algorithm for alternative options.
qgis:convexhull: >
This algorithm computes the convex hull of features in a layer.
If a field is specified, it will divide the features into classes based on that field, and compute a separate convex hull for the features in each class.
qgis:countpointsinpolygon: >
This algorithm takes a points layer and a polygon layer and counts the number of points from the first one in each polygons of the second one.
@ -150,7 +153,7 @@ qgis:dissolve: >
If the geometries to be dissolved are spatially separated from each other the output will be multi geometries. In case the input is a polygon layer, common boundaries of adjacent polygons being dissolved will get erased.
qgis:distancematrix: >
This algorithms creates a table containing a distance matrix, with distances between all the points in a points layer.
This algorithm creates a table containing a distance matrix, with distances between all the points in a points layer.
qgis:distancetonearesthub: >
Given a layer with source point and another one representing destination points, this algorithm computes the distance between each source point and the closest destination one.
@ -274,7 +277,7 @@ qgis:joinattributestable: >
The additional attributes and their values are taken from a second vector layer. An attribute is selected in each of them to define the join criteria.
qgis:keepnbiggestparts: >
This algorithms takes a polygon layer and creates a new polygon layer in which multipart geometries have been removed, leaving only the n largest (in terms of area) parts.
This algorithm takes a polygon layer and creates a new polygon layer in which multipart geometries have been removed, leaving only the n largest (in terms of area) parts.
qgis:lineintersections: >
This algorithm creates point features where the lines in the Intersect layer intersect the lines in the Input layer.
@ -313,6 +316,13 @@ qgis:mergevectorlayers: >
The layers will all be reprojected to match the coordinate reference system of the first input layer.
qgis:minimumboundinggeometry: >
This algorithm creates geometries which enclose the features from an input layer.
Numerous enclosing geometry types are supported, including bounding boxes (envelopes), oriented rectangles, circles and convex hulls.
Optionally, the features can be grouped by a field. If set, this causes the output layer to contain one feature per grouped value with a minimal geometry covering just the features with matching values.
qgis:multiparttosingleparts: >
This algorithm takes a vector layer with multipart geometries and generates a new one in which all geometries contain a single part. Features with multipart geometries are divided in as many different features as parts the geometry contain, and the same attributes are used for each of them.
@ -338,10 +348,10 @@ qgis:offsetline: >
The miter limit parameter is only applicable for miter join styles, and controls the maximum distance from the offset curve to use when creating a mitered join.
qgis:orientedminimumboundingbox: >
This algorithm takes a vector layer and generate a new one with the minimum rectangle that covers all the input features.
qgis:minimalenclosingcircle: >
This algorithm takes a vector layer and generate a new one with the minimum enclosing circle that covers all the input features.
As an alternative, the output layer can contain not just a single rectangle, but one for each input feature, representing the minimum rectangle that covers each of them.
As an alternative, the output layer can contain not just a single circle, but one for each input feature, representing the minimum enclosing circle that covers each of them.
qgis:orthogonalize: >
This algorithm takes a line or polygon layer and attempts to orthogonalize all the geometries in the layer. This process shifts the nodes in the geometries to try to make every angle in the geometry either a right angle or a straight line.
@ -391,11 +401,8 @@ qgis:polygoncentroids: >
NOTE: This algorithm is deprecated and the generic "centroids" algorithm (which works for line and multi geometry layers) should be used instead.
qgis:polygonfromlayerextent: >
This algorithm takes a vector layer and generates a new one with the minimum bounding box (rectangle with N-S orientation) that covers all the input features.
As an alternative, the output layer can contain not just a single bounding box, but one for each input feature, representing the bounding box of each of them.
This algorithm takes a map layer and generates a new vector layer with the minimum bounding box (rectangle with N-S orientation) that covers the input layer.
qgis:polygonize: >
This algorithm takes a lines layer and creates a polygon layer, with polygons generated from the lines in the input layer.
@ -507,9 +514,6 @@ qgis:saveselectedfeatures: >
qgis:selectbyattribute: >
This algorithm creates a selection in a vector layer. The criteria for selected features is defined based on the values of an attribute from the input layer.
qgis:selectbyattributesum:
qgis:selectbyexpression: >
This algorithm creates a selection in a vector layer. The criteria for selecting features is based on a QGIS expression.
@ -540,9 +544,6 @@ qgis:simplifygeometries: >
The algorithm gives a choice of simplification methods, including distance based (the "Douglas-Peucker" algorithm), area based ("Visvalingam" algorithm) and snapping geometries to grid.
qgis:singlepartstomultipart:
qgis:singlesidedbuffer: >
This algorithm buffers lines by a specified distance on one side of the line only.

View File

@ -43,7 +43,7 @@ class AddTableField(QgisFeatureBasedAlgorithm):
TYPES = [QVariant.Int, QVariant.Double, QVariant.String]
def group(self):
return self.tr('Vector table tools')
return self.tr('Vector table')
def __init__(self):
super().__init__()

View File

@ -0,0 +1,273 @@
# -*- coding: utf-8 -*-
"""
***************************************************************************
Aggregate.py
---------------------
Date : February 2017
Copyright : (C) 2017 by Arnaud Morvan
Email : arnaud dot morvan at camptocamp 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__ = 'Arnaud Morvan'
__date__ = 'February 2017'
__copyright__ = '(C) 2017, Arnaud Morvan'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
from qgis.core import (
QgsDistanceArea,
QgsExpression,
QgsExpressionContextUtils,
QgsFeature,
QgsFeatureSink,
QgsField,
QgsFields,
QgsGeometry,
QgsProcessingParameterDefinition,
QgsProcessingParameterExpression,
QgsProcessingParameterFeatureSink,
QgsProcessingParameterFeatureSource,
QgsProcessingException,
QgsProcessingUtils,
QgsWkbTypes,
)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
class Aggregate(QgisAlgorithm):
INPUT = 'INPUT'
GROUP_BY = 'GROUP_BY'
AGGREGATES = 'AGGREGATES'
DISSOLVE = 'DISSOLVE'
OUTPUT = 'OUTPUT'
def group(self):
return self.tr('Vector geometry')
def name(self):
return 'aggregate'
def displayName(self):
return self.tr('Aggregate')
def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT,
self.tr('Input layer')))
self.addParameter(QgsProcessingParameterExpression(self.GROUP_BY,
self.tr('Group by expression (NULL to group all features)'),
defaultValue='NULL',
optional=False,
parentLayerParameterName=self.INPUT))
class ParameterAggregates(QgsProcessingParameterDefinition):
def __init__(self, name, description, parentLayerParameterName='INPUT'):
super().__init__(name, description)
self._parentLayerParameter = parentLayerParameterName
def clone(self):
copy = ParameterAggregates(self.name(), self.description(), self._parentLayerParameter)
return copy
def type(self):
return 'aggregates'
def checkValueIsAcceptable(self, value, context=None):
if not isinstance(value, list):
return False
for field_def in value:
if not isinstance(field_def, dict):
return False
if not field_def.get('input', False):
return False
if not field_def.get('aggregate', False):
return False
if not field_def.get('name', False):
return False
if not field_def.get('type', False):
return False
return True
def valueAsPythonString(self, value, context):
return str(value)
def asScriptCode(self):
raise NotImplementedError()
@classmethod
def fromScriptCode(cls, name, description, isOptional, definition):
raise NotImplementedError()
def parentLayerParameter(self):
return self._parentLayerParameter
self.addParameter(ParameterAggregates(self.AGGREGATES,
description=self.tr('Aggregates')))
self.parameterDefinition(self.AGGREGATES).setMetadata({
'widget_wrapper': 'processing.algs.qgis.ui.AggregatesPanel.AggregatesWidgetWrapper'
})
self.addParameter(QgsProcessingParameterFeatureSink(self.OUTPUT,
self.tr('Aggregated')))
def parameterAsAggregates(self, parameters, name, context):
return parameters[name]
def prepareAlgorithm(self, parameters, context, feedback):
source = self.parameterAsSource(parameters, self.INPUT, context)
group_by = self.parameterAsExpression(parameters, self.GROUP_BY, context)
aggregates = self.parameterAsAggregates(parameters, self.AGGREGATES, context)
da = QgsDistanceArea()
da.setSourceCrs(source.sourceCrs())
da.setEllipsoid(context.project().ellipsoid())
self.source = source
self.group_by = group_by
self.group_by_expr = self.createExpression(group_by, da, context)
self.geometry_expr = self.createExpression('collect($geometry, {})'.format(group_by), da, context)
self.fields = QgsFields()
self.fields_expr = []
for field_def in aggregates:
self.fields.append(QgsField(name=field_def['name'],
type=field_def['type'],
typeName="",
len=field_def['length'],
prec=field_def['precision']))
aggregate = field_def['aggregate']
if aggregate == 'first_value':
expression = field_def['input']
elif aggregate == 'concatenate':
expression = ('{}({}, {}, {}, \'{}\')'
.format(field_def['aggregate'],
field_def['input'],
group_by,
'TRUE',
field_def['delimiter']))
else:
expression = '{}({}, {})'.format(field_def['aggregate'],
field_def['input'],
group_by)
expr = self.createExpression(expression, da, context)
self.fields_expr.append(expr)
return True
def processAlgorithm(self, parameters, context, feedback):
expr_context = self.createExpressionContext(parameters, context)
self.group_by_expr.prepare(expr_context)
# Group features in memory layers
source = self.source
count = self.source.featureCount()
if count:
progress_step = 50.0 / count
current = 0
groups = {}
keys = [] # We need deterministic order for the tests
feature = QgsFeature()
for feature in self.source.getFeatures():
expr_context.setFeature(feature)
group_by_value = self.evaluateExpression(self.group_by_expr, expr_context)
# Get an hashable key for the dict
key = group_by_value
if isinstance(key, list):
key = tuple(key)
group = groups.get(key, None)
if group is None:
sink, id = QgsProcessingUtils.createFeatureSink(
'memory:',
context,
source.fields(),
source.wkbType(),
source.sourceCrs())
layer = QgsProcessingUtils.mapLayerFromString(id, context)
group = {
'sink': sink,
'layer': layer,
'feature': feature
}
groups[key] = group
keys.append(key)
group['sink'].addFeature(feature, QgsFeatureSink.FastInsert)
current += 1
feedback.setProgress(int(current * progress_step))
if feedback.isCanceled():
return
(sink, dest_id) = self.parameterAsSink(parameters,
self.OUTPUT,
context,
self.fields,
QgsWkbTypes.multiType(source.wkbType()),
source.sourceCrs())
# Calculate aggregates on memory layers
if len(keys):
progress_step = 50.0 / len(keys)
for current, key in enumerate(keys):
group = groups[key]
expr_context = self.createExpressionContext(parameters, context)
expr_context.appendScope(QgsExpressionContextUtils.layerScope(group['layer']))
expr_context.setFeature(group['feature'])
geometry = self.evaluateExpression(self.geometry_expr, expr_context)
if geometry is not None and not geometry.isEmpty():
geometry = QgsGeometry.unaryUnion(geometry.asGeometryCollection())
if geometry.isEmpty():
raise QgsProcessingException(
'Impossible to combine geometries for {} = {}'
.format(self.group_by, group_by_value))
attrs = []
for fields_expr in self.fields_expr:
attrs.append(self.evaluateExpression(fields_expr, expr_context))
# Write output feature
outFeat = QgsFeature()
if geometry is not None:
outFeat.setGeometry(geometry)
outFeat.setAttributes(attrs)
sink.addFeature(outFeat, QgsFeatureSink.FastInsert)
feedback.setProgress(50 + int(current * progress_step))
if feedback.isCanceled():
return
return {self.OUTPUT: dest_id}
def createExpression(self, text, da, context):
expr = QgsExpression(text)
expr.setGeomCalculator(da)
expr.setDistanceUnits(context.project().distanceUnits())
expr.setAreaUnits(context.project().areaUnits())
if expr.hasParserError():
raise QgsProcessingException(
self.tr(u'Parser error in expression "{}": {}')
.format(text, expr.parserErrorString()))
return expr
def evaluateExpression(self, expr, context):
value = expr.evaluate(context)
if expr.hasEvalError():
raise QgsProcessingException(
self.tr(u'Evaluation error in expression "{}": {}')
.format(expr.expression(), expr.evalErrorString()))
return value

View File

@ -60,7 +60,7 @@ class Aspect(QgisAlgorithm):
self.tr('Elevation layer')))
self.addParameter(QgsProcessingParameterNumber(self.Z_FACTOR,
self.tr('Z factor'), QgsProcessingParameterNumber.Double,
1, False, 1, 999999.99))
1, False, 0.00, 999999.99))
self.addParameter(QgsProcessingParameterRasterDestination(self.OUTPUT, self.tr('Aspect')))
def name(self):

View File

@ -37,7 +37,7 @@ class AutoincrementalField(QgisFeatureBasedAlgorithm):
self.current = 0
def group(self):
return self.tr('Vector table tools')
return self.tr('Vector table')
def name(self):
return 'addautoincrementalfield'

View File

@ -29,10 +29,7 @@ import plotly as plt
import plotly.graph_objs as go
from qgis.core import (QgsApplication,
QgsFeatureSink,
QgsProcessingUtils,
QgsProcessingParameterFeatureSource,
from qgis.core import (QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml)
@ -63,7 +60,7 @@ class BarPlot(QgisAlgorithm):
self.tr('Value field'),
None, self.INPUT, QgsProcessingParameterField.Numeric))
self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT, self.tr('Added'), self.tr('HTML files (*.html)')))
self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT, self.tr('Bar plot'), self.tr('HTML files (*.html)')))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT, self.tr('Bar plot')))

View File

@ -81,7 +81,7 @@ class BasicStatisticsForField(QgisAlgorithm):
'count,distinct,unique,variance,median,quartile,range,majority,minority').split(',')
def group(self):
return self.tr('Vector table tools')
return self.tr('Vector analysis')
def __init__(self):
super().__init__()

View File

@ -46,7 +46,7 @@ class Boundary(QgisFeatureBasedAlgorithm):
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'convex_hull.png'))
def group(self):
return self.tr('Vector geometry tools')
return self.tr('Vector geometry')
def name(self):
return 'boundary'

View File

@ -1,75 +0,0 @@
# -*- coding: utf-8 -*-
"""
***************************************************************************
BoundingBox.py
--------------
Date : July 2016
Copyright : (C) 2016 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__ = 'July 2016'
__copyright__ = '(C) 2016, Nyall Dawson'
# This will get replaced with a git SHA1 when you do a git archive323
__revision__ = '$Format:%H$'
import os
from qgis.core import (QgsGeometry,
QgsWkbTypes,
QgsProcessingException)
from qgis.PyQt.QtGui import QIcon
from processing.algs.qgis.QgisAlgorithm import QgisFeatureBasedAlgorithm
pluginPath = os.path.split(os.path.split(os.path.dirname(__file__))[0])[0]
class BoundingBox(QgisFeatureBasedAlgorithm):
def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'matrix.png'))
def group(self):
return self.tr('Vector geometry tools')
def __init__(self):
super().__init__()
def name(self):
return 'boundingboxes'
def displayName(self):
return self.tr('Bounding boxes')
def outputName(self):
return self.tr('Bounds')
def outputWkbType(self, inputWkb):
return QgsWkbTypes.Polygon
def processFeature(self, feature, feedback):
input_geometry = feature.geometry()
if input_geometry:
output_geometry = QgsGeometry.fromRect(input_geometry.boundingBox())
if not output_geometry:
raise QgsProcessingException(
self.tr('Error calculating bounding box'))
feature.setGeometry(output_geometry)
return feature

View File

@ -28,14 +28,13 @@ __revision__ = '$Format:%H$'
import plotly as plt
import plotly.graph_objs as go
from qgis.core import (QgsApplication,
QgsFeatureSink,
QgsProcessingUtils)
from processing.core.parameters import ParameterTable
from processing.core.parameters import ParameterTableField
from processing.core.parameters import ParameterSelection
from qgis.core import (QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
QgsProcessingParameterEnum,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml,
QgsFeatureRequest)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
from processing.core.outputs import OutputHTML
from processing.tools import vector
@ -54,25 +53,27 @@ class BoxPlot(QgisAlgorithm):
super().__init__()
def initAlgorithm(self, config=None):
self.addParameter(ParameterTable(self.INPUT, self.tr('Input table')))
self.addParameter(ParameterTableField(self.NAME_FIELD,
self.tr('Category name field'),
self.INPUT,
ParameterTableField.DATA_TYPE_ANY))
self.addParameter(ParameterTableField(self.VALUE_FIELD,
self.tr('Value field'),
self.INPUT,
ParameterTableField.DATA_TYPE_NUMBER))
self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT,
self.tr('Input layer')))
self.addParameter(QgsProcessingParameterField(self.NAME_FIELD,
self.tr('Category name field'),
parentLayerParameterName=self.INPUT,
type=QgsProcessingParameterField.Any))
self.addParameter(QgsProcessingParameterField(self.VALUE_FIELD,
self.tr('Value field'),
parentLayerParameterName=self.INPUT,
type=QgsProcessingParameterField.Numeric))
msd = [self.tr('Show Mean'),
self.tr('Show Standard Deviation'),
self.tr('Don\'t show Mean and Standard Deviation')
]
self.addParameter(ParameterSelection(
self.addParameter(QgsProcessingParameterEnum(
self.MSD,
self.tr('Additional Statistic Lines'),
msd, default=0))
options=msd, defaultValue=0))
self.addOutput(OutputHTML(self.OUTPUT, self.tr('Box plot')))
self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT, self.tr('Box plot'), self.tr('HTML files (*.html)')))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT, self.tr('Box plot')))
def name(self):
return 'boxplot'
@ -81,17 +82,18 @@ class BoxPlot(QgisAlgorithm):
return self.tr('Box plot')
def processAlgorithm(self, parameters, context, feedback):
layer = QgsProcessingUtils.mapLayerFromString(self.getParameterValue(self.INPUT), context)
namefieldname = self.getParameterValue(self.NAME_FIELD)
valuefieldname = self.getParameterValue(self.VALUE_FIELD)
source = self.parameterAsSource(parameters, self.INPUT, context)
namefieldname = self.parameterAsString(parameters, self.NAME_FIELD, context)
valuefieldname = self.parameterAsString(parameters, self.VALUE_FIELD, context)
output = self.getOutputValue(self.OUTPUT)
output = self.parameterAsFileOutput(parameters, self.OUTPUT, context)
values = vector.values(layer, valuefieldname)
values = vector.values(source, valuefieldname)
x_var = [i[namefieldname] for i in layer.getFeatures()]
x_index = source.fields().lookupField(namefieldname)
x_var = [i[namefieldname] for i in source.getFeatures(QgsFeatureRequest().setFlags(QgsFeatureRequest.NoGeometry).setSubsetOfAttributes([x_index]))]
msdIndex = self.getParameterValue(self.MSD)
msdIndex = self.parameterAsEnum(parameters, self.MSD, context)
msd = True
if msdIndex == 1:
@ -105,3 +107,5 @@ class BoxPlot(QgisAlgorithm):
boxmean=msd)]
plt.offline.plot(data, filename=output, auto_open=False)
return {self.OUTPUT: output}

View File

@ -66,7 +66,7 @@ class CheckValidity(QgisAlgorithm):
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'check_geometry.png'))
def group(self):
return self.tr('Vector geometry tools')
return self.tr('Vector geometry')
def __init__(self):
super().__init__()
@ -81,13 +81,13 @@ class CheckValidity(QgisAlgorithm):
self.addParameter(QgsProcessingParameterEnum(self.METHOD,
self.tr('Method'), self.methods))
self.addParameter(QgsProcessingParameterFeatureSink(self.VALID_OUTPUT, self.tr('Valid output'), QgsProcessing.TypeVectorAny, '', True))
self.addParameter(QgsProcessingParameterFeatureSink(self.VALID_OUTPUT, self.tr('Valid output'), QgsProcessing.TypeVectorAnyGeometry, '', True))
self.addOutput(QgsProcessingOutputNumber(self.VALID_COUNT, self.tr('Count of valid features')))
self.addParameter(QgsProcessingParameterFeatureSink(self.INVALID_OUTPUT, self.tr('Invalid output'), QgsProcessing.TypeVectorAny, '', True))
self.addParameter(QgsProcessingParameterFeatureSink(self.INVALID_OUTPUT, self.tr('Invalid output'), QgsProcessing.TypeVectorAnyGeometry, '', True))
self.addOutput(QgsProcessingOutputNumber(self.INVALID_COUNT, self.tr('Count of invalid features')))
self.addParameter(QgsProcessingParameterFeatureSink(self.ERROR_OUTPUT, self.tr('Error output'), QgsProcessing.TypeVectorAny, '', True))
self.addParameter(QgsProcessingParameterFeatureSink(self.ERROR_OUTPUT, self.tr('Error output'), QgsProcessing.TypeVectorAnyGeometry, '', True))
self.addOutput(QgsProcessingOutputNumber(self.ERROR_COUNT, self.tr('Count of errors')))
def name(self):

View File

@ -50,7 +50,7 @@ class ConcaveHull(QgisAlgorithm):
OUTPUT = 'OUTPUT'
def group(self):
return self.tr('Vector geometry tools')
return self.tr('Vector geometry')
def __init__(self):
super().__init__()

View File

@ -1,191 +0,0 @@
# -*- coding: utf-8 -*-
"""
***************************************************************************
ConvexHull.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf 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 str
__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
# 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.PyQt.QtCore import QVariant
from qgis.core import (QgsField,
QgsFeature,
QgsFeatureSink,
QgsGeometry,
QgsWkbTypes,
QgsFeatureRequest,
QgsFields,
NULL,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
QgsProcessingParameterFeatureSink,
QgsProcessing,
QgsProcessingException)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
from processing.tools import dataobjects, vector
pluginPath = os.path.split(os.path.split(os.path.dirname(__file__))[0])[0]
class ConvexHull(QgisAlgorithm):
INPUT = 'INPUT'
OUTPUT = 'OUTPUT'
FIELD = 'FIELD'
def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'convex_hull.png'))
def group(self):
return self.tr('Vector geometry tools')
def __init__(self):
super().__init__()
def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT,
self.tr('Input layer')))
self.addParameter(QgsProcessingParameterField(self.FIELD,
self.tr('Field (optional, set if creating convex hulls by classes)'),
parentLayerParameterName=self.INPUT, optional=True))
self.addParameter(QgsProcessingParameterFeatureSink(self.OUTPUT, self.tr('Convex hull'), QgsProcessing.TypeVectorPolygon))
def name(self):
return 'convexhull'
def displayName(self):
return self.tr('Convex hull')
def processAlgorithm(self, parameters, context, feedback):
source = self.parameterAsSource(parameters, self.INPUT, context)
fieldName = self.parameterAsString(parameters, self.FIELD, context)
useField = bool(fieldName)
field_index = None
f = QgsField('value', QVariant.String, '', 255)
if useField:
field_index = source.fields().lookupField(fieldName)
fType = source.fields()[field_index].type()
if fType in [QVariant.Int, QVariant.UInt, QVariant.LongLong, QVariant.ULongLong]:
f.setType(fType)
f.setLength(20)
elif fType == QVariant.Double:
f.setType(QVariant.Double)
f.setLength(20)
f.setPrecision(6)
else:
f.setType(QVariant.String)
f.setLength(255)
fields = QgsFields()
fields.append(QgsField('id', QVariant.Int, '', 20))
fields.append(f)
fields.append(QgsField('area', QVariant.Double, '', 20, 6))
fields.append(QgsField('perim', QVariant.Double, '', 20, 6))
(sink, dest_id) = self.parameterAsSink(parameters, self.OUTPUT, context,
fields, QgsWkbTypes.Polygon, source.sourceCrs())
outFeat = QgsFeature()
outGeom = QgsGeometry()
fid = 0
val = None
if useField:
unique = source.uniqueValues(field_index)
current = 0
total = 100.0 / (source.featureCount() * len(unique)) if source.featureCount() else 1
for i in unique:
if feedback.isCanceled():
break
first = True
hull = []
features = source.getFeatures(QgsFeatureRequest().setSubsetOfAttributes([field_index]))
for f in features:
if feedback.isCanceled():
break
idVar = f.attributes()[field_index]
if str(idVar).strip() == str(i).strip():
if first:
val = idVar
first = False
inGeom = f.geometry()
points = vector.extractPoints(inGeom)
hull.extend(points)
current += 1
feedback.setProgress(int(current * total))
if len(hull) >= 3:
tmpGeom = QgsGeometry(outGeom.fromMultiPoint(hull))
try:
outGeom = tmpGeom.convexHull()
if outGeom:
area = outGeom.geometry().area()
perim = outGeom.geometry().perimeter()
else:
area = NULL
perim = NULL
outFeat.setGeometry(outGeom)
outFeat.setAttributes([fid, val, area, perim])
sink.addFeature(outFeat, QgsFeatureSink.FastInsert)
except:
raise QgsProcessingException(
self.tr('Exception while computing convex hull'))
fid += 1
else:
hull = []
total = 100.0 / source.featureCount() if source.featureCount() else 1
features = source.getFeatures(QgsFeatureRequest().setSubsetOfAttributes([]))
for current, f in enumerate(features):
if feedback.isCanceled():
break
inGeom = f.geometry()
points = vector.extractPoints(inGeom)
hull.extend(points)
feedback.setProgress(int(current * total))
tmpGeom = QgsGeometry(outGeom.fromMultiPoint(hull))
try:
outGeom = tmpGeom.convexHull()
if outGeom:
area = outGeom.geometry().area()
perim = outGeom.geometry().perimeter()
else:
area = NULL
perim = NULL
outFeat.setGeometry(outGeom)
outFeat.setAttributes([0, 'all', area, perim])
sink.addFeature(outFeat, QgsFeatureSink.FastInsert)
except:
raise QgsProcessingException(
self.tr('Exception while computing convex hull'))
return {self.OUTPUT: dest_id}

View File

@ -41,7 +41,7 @@ class CreateAttributeIndex(QgisAlgorithm):
OUTPUT = 'OUTPUT'
def group(self):
return self.tr('Vector general tools')
return self.tr('Vector general')
def __init__(self):
super().__init__()

View File

@ -31,41 +31,55 @@ import xml.sax.saxutils
from osgeo import ogr
from qgis.core import (QgsProcessingFeedback,
QgsApplication)
from processing.tools import dataobjects
QgsProcessingParameterMultipleLayers,
QgsProcessingParameterBoolean,
QgsProcessing,
QgsProcessingParameterVectorDestination,
QgsProcessingOutputString,
QgsProcessingException)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from processing.core.parameters import ParameterMultipleInput
from processing.core.parameters import ParameterBoolean
from processing.core.outputs import OutputFile
from processing.core.outputs import OutputString
class Datasources2Vrt(QgisAlgorithm):
DATASOURCES = 'DATASOURCES'
INPUT = 'INPUT'
UNIONED = 'UNIONED'
VRT_FILE = 'VRT_FILE'
OUTPUT = 'OUTPUT'
VRT_STRING = 'VRT_STRING'
def group(self):
return self.tr('Vector general tools')
return self.tr('Vector general')
def __init__(self):
super().__init__()
def initAlgorithm(self, config=None):
self.addParameter(ParameterMultipleInput(self.DATASOURCES,
self.tr('Input datasources'),
dataobjects.TYPE_TABLE))
self.addParameter(ParameterBoolean(self.UNIONED,
self.tr('Create "unioned" VRT'),
default=False))
self.addParameter(QgsProcessingParameterMultipleLayers(self.INPUT,
self.tr('Input datasources'),
QgsProcessing.TypeVector))
self.addParameter(QgsProcessingParameterBoolean(self.UNIONED,
self.tr('Create "unioned" VRT'),
defaultValue=False))
self.addOutput(OutputFile(self.VRT_FILE,
self.tr('Virtual vector'), ext='vrt'))
self.addOutput(OutputString(self.VRT_STRING,
self.tr('Virtual string')))
class ParameterVectorVrtDestination(QgsProcessingParameterVectorDestination):
def __init__(self, name, description):
super().__init__(name, description)
def clone(self):
copy = ParameterVectorVrtDestination(self.name(), self.description())
return copy
def type(self):
return 'vrt_vector_destination'
def defaultFileExtension(self):
return 'vrt'
self.addParameter(ParameterVectorVrtDestination(self.OUTPUT,
self.tr('Virtual vector')))
self.addOutput(QgsProcessingOutputString(self.VRT_STRING,
self.tr('Virtual string')))
def name(self):
return 'buildvirtualvector'
@ -74,20 +88,17 @@ class Datasources2Vrt(QgisAlgorithm):
return self.tr('Build virtual vector')
def processAlgorithm(self, parameters, context, feedback):
input_layers = self.getParameterValue(self.DATASOURCES)
unioned = self.getParameterValue(self.UNIONED)
vrtPath = self.getOutputValue(self.VRT_FILE)
input_layers = self.parameterAsLayerList(parameters, self.INPUT, context)
unioned = self.parameterAsBool(parameters, self.UNIONED, context)
vrtPath = self.parameterAsOutputLayer(parameters, self.OUTPUT, context)
layers = input_layers.split(';')
vrtString = self.mergeDataSources2Vrt(layers,
vrtString = self.mergeDataSources2Vrt(input_layers,
vrtPath,
union=unioned,
relative=False,
schema=False,
feedback=feedback)
self.setOutputValue(self.VRT_STRING, vrtString)
return {self.OUTPUT: vrtPath, self.VRT_STRING: vrtString}
def mergeDataSources2Vrt(self, dataSources, outFile, union=False, relative=False,
schema=False, feedback=None):
@ -107,12 +118,16 @@ class Datasources2Vrt(QgisAlgorithm):
vrt += '<OGRVRTUnionLayer name="UnionedLayer">'
total = 100.0 / len(dataSources) if dataSources else 1
for current, inFile in enumerate(dataSources):
for current, layer in enumerate(dataSources):
if feedback.isCanceled():
break
feedback.setProgress(int(current * total))
inFile = layer.source()
srcDS = ogr.Open(inFile, 0)
if srcDS is None:
raise GeoAlgorithmExecutionException(
raise QgsProcessingException(
self.tr('Invalid datasource: {}'.format(inFile)))
if schema:

View File

@ -28,15 +28,12 @@ __revision__ = '$Format:%H$'
import os
import re
from qgis.core import (QgsCoordinateReferenceSystem,
QgsApplication,
QgsProcessingUtils)
from qgis.utils import iface
from qgis.core import (QgsProcessing,
QgsProcessingParameterVectorLayer,
QgsProcessingParameterCrs,
QgsProcessingOutputVectorLayer)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
from processing.core.parameters import ParameterVector
from processing.core.parameters import ParameterCrs
from processing.core.outputs import OutputVector
pluginPath = os.path.split(os.path.split(os.path.dirname(__file__))[0])[0]
@ -45,20 +42,19 @@ class DefineProjection(QgisAlgorithm):
INPUT = 'INPUT'
CRS = 'CRS'
OUTPUT = 'OUTPUT'
def group(self):
return self.tr('Vector general tools')
return self.tr('Vector general')
def __init__(self):
super().__init__()
def initAlgorithm(self, config=None):
self.addParameter(ParameterVector(self.INPUT,
self.tr('Input Layer')))
self.addParameter(ParameterCrs(self.CRS, 'Output CRS'))
self.addOutput(OutputVector(self.OUTPUT,
self.tr('Layer with projection'), True))
self.addParameter(QgsProcessingParameterVectorLayer(self.INPUT,
self.tr('Input Layer'), types=[QgsProcessing.TypeVectorAnyGeometry]))
self.addParameter(QgsProcessingParameterCrs(self.CRS, 'Output CRS'))
self.addOutput(QgsProcessingOutputVectorLayer(self.INPUT,
self.tr('Layer with projection')))
def name(self):
return 'definecurrentprojection'
@ -67,9 +63,8 @@ class DefineProjection(QgisAlgorithm):
return self.tr('Define current projection')
def processAlgorithm(self, parameters, context, feedback):
fileName = self.getParameterValue(self.INPUT)
layer = QgsProcessingUtils.mapLayerFromString(fileName, context)
crs = QgsCoordinateReferenceSystem(self.getParameterValue(self.CRS))
layer = self.parameterAsVectorLayer(parameters, self.INPUT, context)
crs = self.parameterAsCrs(parameters, self.CRS, context)
provider = layer.dataProvider()
ds = provider.dataSourceUri()
@ -89,6 +84,6 @@ class DefineProjection(QgisAlgorithm):
f.write(wkt)
layer.setCrs(crs)
iface.mapCanvas().refresh()
layer.triggerRepaint()
self.setOutputValue(self.OUTPUT, fileName)
return {self.INPUT: layer}

View File

@ -60,7 +60,7 @@ class Delaunay(QgisAlgorithm):
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'delaunay.png'))
def group(self):
return self.tr('Vector geometry tools')
return self.tr('Vector geometry')
def __init__(self):
super().__init__()

View File

@ -37,7 +37,7 @@ class DeleteColumn(QgisFeatureBasedAlgorithm):
return self.tr('drop,delete,remove,fields,columns,attributes').split(',')
def group(self):
return self.tr('Vector table tools')
return self.tr('Vector table')
def __init__(self):
super().__init__()

View File

@ -38,7 +38,7 @@ class DeleteDuplicateGeometries(QgisAlgorithm):
OUTPUT = 'OUTPUT'
def group(self):
return self.tr('Vector general tools')
return self.tr('Vector general')
def __init__(self):
super().__init__()

View File

@ -45,7 +45,7 @@ class DeleteHoles(QgisFeatureBasedAlgorithm):
return self.tr('remove,delete,drop,holes,rings,fill').split(',')
def group(self):
return self.tr('Vector geometry tools')
return self.tr('Vector geometry')
def name(self):
return 'deleteholes'

View File

@ -41,7 +41,7 @@ class DensifyGeometries(QgisFeatureBasedAlgorithm):
return self.tr('add,vertices,points').split(',')
def group(self):
return self.tr('Vector geometry tools')
return self.tr('Vector geometry')
def __init__(self):
super().__init__()

View File

@ -37,7 +37,7 @@ class DensifyGeometriesInterval(QgisFeatureBasedAlgorithm):
INTERVAL = 'INTERVAL'
def group(self):
return self.tr('Vector geometry tools')
return self.tr('Vector geometry')
def __init__(self):
super().__init__()

View File

@ -52,7 +52,7 @@ class Difference(QgisAlgorithm):
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'difference.png'))
def group(self):
return self.tr('Vector overlay tools')
return self.tr('Vector overlay')
def __init__(self):
super().__init__()

View File

@ -37,7 +37,7 @@ class DropGeometry(QgisFeatureBasedAlgorithm):
return self.tr('remove,drop,delete,geometry,objects').split(',')
def group(self):
return self.tr('Vector general tools')
return self.tr('Vector general')
def __init__(self):
super().__init__()

Some files were not shown because too many files have changed in this diff Show More