Skip to content

Commit 0f963df

Browse files
committed
[processing] Default to supporting non-file based outputs for providers
And make this support opt-out, since the vast majority of providers are based on QGIS API and don't have external dependencies which would restrict use of memory layers/etc. Plus, I'd rather see non-compliant providers expose this support when they can't use non-file-based-outputs (and make this the bug which needs fixing) then have to rely on plugin providers to discover and explicitly expose this support.
1 parent cc9f7af commit 0f963df

File tree

5 files changed

+27
-1
lines changed

5 files changed

+27
-1
lines changed

python/core/processing/qgsprocessingprovider.sip.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ indicates that none of the outputs from any of the provider's algorithms have
148148
support for non-file based outputs. Returning true indicates that the algorithm's
149149
parameters will each individually declare their non-file based support.
150150

151+
The default behavior for providers is to support non-file based outputs, and most
152+
providers which rely solely on QGIS API (and which do not depend on third-party scripts
153+
or external dependencies) will automatically support this.
154+
151155
.. seealso:: :py:func:`supportedOutputVectorLayerExtensions`
152156
%End
153157

python/plugins/processing/algs/gdal/GdalAlgorithmProvider.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,12 @@ def loadAlgorithms(self):
199199
def supportedOutputRasterLayerExtensions(self):
200200
return GdalUtils.getSupportedRasterExtensions()
201201

202+
def supportsNonFileBasedOutput(self):
203+
"""
204+
GDAL Provider doesn't support non file based outputs
205+
"""
206+
return False
207+
202208
def tr(self, string, context=''):
203209
if context == '':
204210
context = 'GdalAlgorithmProvider'

python/plugins/processing/algs/saga/SagaAlgorithmProvider.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ def defaultRasterFileExtension(self):
127127
def supportedOutputTableExtensions(self):
128128
return ['dbf']
129129

130+
def supportsNonFileBasedOutput(self):
131+
"""
132+
SAGA Provider doesn't support non file based outputs
133+
"""
134+
return False
135+
130136
def icon(self):
131137
return QIcon(os.path.join(pluginPath, 'images', 'saga.png'))
132138

src/core/processing/qgsprocessingprovider.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,8 @@ QString QgsProcessingProvider::defaultRasterFileExtension() const
140140
return defaultExtension;
141141
}
142142
}
143+
144+
bool QgsProcessingProvider::supportsNonFileBasedOutput() const
145+
{
146+
return true;
147+
}

src/core/processing/qgsprocessingprovider.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,14 @@ class CORE_EXPORT QgsProcessingProvider : public QObject
150150
* indicates that none of the outputs from any of the provider's algorithms have
151151
* support for non-file based outputs. Returning true indicates that the algorithm's
152152
* parameters will each individually declare their non-file based support.
153+
*
154+
* The default behavior for providers is to support non-file based outputs, and most
155+
* providers which rely solely on QGIS API (and which do not depend on third-party scripts
156+
* or external dependencies) will automatically support this.
157+
*
153158
* \see supportedOutputVectorLayerExtensions()
154159
*/
155-
virtual bool supportsNonFileBasedOutput() const { return false; }
160+
virtual bool supportsNonFileBasedOutput() const;
156161

157162
/**
158163
* Loads the provider. This will be called when the plugin is being loaded, and any general

0 commit comments

Comments
 (0)