Skip to content
Permalink
Browse files

[processing] remove explicit outputs definitions

(cherry picked from commit 22fea14)
  • Loading branch information
alexbruy committed Mar 2, 2018
1 parent 511fa36 commit c39e2a41e13384476cda5723d7f4f8d1e2fd8f26
@@ -29,8 +29,8 @@
QgsProcessingParameterRasterLayer,
QgsProcessingParameterBand,
QgsProcessingParameterBoolean,
QgsProcessingParameterFileDestination,
QgsProcessingOutputFile)
QgsProcessingParameterFileDestination
)
from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
from processing.algs.gdal.GdalUtils import GdalUtils
from processing.tools.system import isWindows
@@ -58,7 +58,6 @@ def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT,
self.tr('XYZ ASCII file'),
self.tr('CSV files (*.csv)')))
self.addOutput(QgsProcessingOutputFile(self.OUTPUT, self.tr('XYZ ASCII file')))

def name(self):
return 'gdal2xyz'
@@ -30,8 +30,7 @@
from qgis.PyQt.QtGui import QIcon
from qgis.core import (QgsProcessingParameterRasterLayer,
QgsProcessingParameterBoolean,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml)
QgsProcessingParameterFileDestination)
from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
from processing.algs.gdal.GdalUtils import GdalUtils

@@ -69,7 +68,6 @@ def initAlgorithm(self, config=None):
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'
@@ -28,8 +28,7 @@

from qgis.core import (QgsProcessingParameterVectorLayer,
QgsProcessingParameterBoolean,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml)
QgsProcessingParameterFileDestination)
from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
from processing.algs.gdal.GdalUtils import GdalUtils

@@ -57,7 +56,6 @@ def initAlgorithm(self, config=None):
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 'ogrinfo'
@@ -59,10 +59,6 @@
QgsProcessingParameterFileDestination,
QgsProcessingParameterFile,
QgsProcessingParameterFolderDestination,
QgsProcessingOutputFolder,
QgsProcessingOutputVectorLayer,
QgsProcessingOutputRasterLayer,
QgsProcessingOutputHtml,
QgsProcessingUtils)
from qgis.utils import iface

@@ -178,10 +174,6 @@ def initAlgorithm(self, config=None):
for p in self.params:
# We use createOutput argument for automatic output creation
res = self.addParameter(p, True)
# File destinations are not automatically added as outputs
if (isinstance(p, QgsProcessingParameterFileDestination)
and p.defaultFileExtension().lower() == 'html'):
self.addOutput(QgsProcessingOutputHtml(p.name(), p.description()))

def defineCharacteristicsFromFile(self):
"""
@@ -31,8 +31,7 @@

from qgis.core import (QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml)
QgsProcessingParameterFileDestination)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
from processing.tools import vector

@@ -65,8 +64,6 @@ def initAlgorithm(self, config=None):

self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT, self.tr('Bar plot'), self.tr('HTML files (*.html)')))

self.addOutput(QgsProcessingOutputHtml(self.OUTPUT, self.tr('Bar plot')))

def name(self):
return 'barplot'

@@ -38,7 +38,6 @@
QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml,
QgsProcessingOutputNumber)

from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
@@ -98,7 +97,6 @@ def initAlgorithm(self, config=None):
None, self.INPUT_LAYER, QgsProcessingParameterField.Any))

self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT_HTML_FILE, self.tr('Statistics'), self.tr('HTML files (*.html)'), None, True))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT_HTML_FILE, self.tr('Statistics')))

self.addOutput(QgsProcessingOutputNumber(self.COUNT, self.tr('Count')))
self.addOutput(QgsProcessingOutputNumber(self.UNIQUE, self.tr('Number of unique values')))
@@ -32,7 +32,6 @@
QgsProcessingParameterField,
QgsProcessingParameterEnum,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml,
QgsFeatureRequest)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
from processing.tools import vector
@@ -76,7 +75,6 @@ def initAlgorithm(self, config=None):
options=msd, defaultValue=0))

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'
@@ -31,8 +31,7 @@
from qgis.core import (QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
QgsProcessingUtils,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml)
QgsProcessingParameterFileDestination)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm

from processing.tools import vector
@@ -64,7 +63,6 @@ def initAlgorithm(self, config=None):
self.tr('Value field'), parentLayerParameterName=self.INPUT))

self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT, self.tr('Plot'), self.tr('HTML files (*.html)')))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT, self.tr('Plot')))

def name(self):
return 'meanandstandarddeviationplot'
@@ -37,7 +37,6 @@
QgsProcessing,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml,
QgsProcessingOutputNumber,
QgsSpatialIndex)

@@ -73,7 +72,6 @@ def initAlgorithm(self, config=None):
self.tr('Input layer'), [QgsProcessing.TypeVectorPoint]))

self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT_HTML_FILE, self.tr('Nearest neighbour'), self.tr('HTML files (*.html)'), None, True))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT_HTML_FILE, self.tr('Nearest neighbour')))

self.addOutput(QgsProcessingOutputNumber(self.OBSERVED_MD,
self.tr('Observed mean distance')))
@@ -31,8 +31,7 @@

from qgis.core import (QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml)
QgsProcessingParameterFileDestination)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
from processing.tools import vector

@@ -62,7 +61,6 @@ def initAlgorithm(self, config=None):
self.tr('Value field'), parentLayerParameterName=self.INPUT))

self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT, self.tr('Polar plot'), self.tr('HTML files (*.html)')))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT, self.tr('Polar plot')))

def name(self):
return 'polarplot'
@@ -31,8 +31,7 @@
from qgis.core import (QgsProcessingParameterRasterLayer,
QgsProcessingParameterBand,
QgsProcessingParameterNumber,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml)
QgsProcessingParameterFileDestination)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
from processing.tools import raster

@@ -64,7 +63,6 @@ def initAlgorithm(self, config=None):
self.tr('number of bins'), minValue=2, defaultValue=10))

self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT, self.tr('Histogram'), self.tr('HTML files (*.html)')))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT, self.tr('Histogram')))

def name(self):
return 'rasterlayerhistogram'
@@ -32,7 +32,6 @@
QgsProcessingParameterRasterLayer,
QgsProcessingParameterBand,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml,
QgsProcessingOutputNumber)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm

@@ -68,7 +67,6 @@ def initAlgorithm(self, config=None):
1,
self.INPUT))
self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT_HTML_FILE, self.tr('Statistics'), self.tr('HTML files (*.html)'), None, True))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT_HTML_FILE, self.tr('Statistics')))

self.addOutput(QgsProcessingOutputNumber(self.MIN, self.tr('Minimum value')))
self.addOutput(QgsProcessingOutputNumber(self.MAX, self.tr('Maximum value')))
@@ -42,8 +42,7 @@
QgsProcessingParameterFeatureSink,
QgsProcessingOutputNumber,
QgsProcessingOutputString,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml)
QgsProcessingParameterFileDestination)

from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm

@@ -81,7 +80,6 @@ def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterFeatureSink(self.OUTPUT, self.tr('Unique values'), optional=True, defaultValue=''))

self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT_HTML_FILE, self.tr('HTML report'), self.tr('HTML files (*.html)'), None, True))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT_HTML_FILE, self.tr('HTML report')))
self.addOutput(QgsProcessingOutputNumber(self.TOTAL_VALUES, self.tr('Total unique values')))
self.addOutput(QgsProcessingOutputString(self.UNIQUE_VALUES, self.tr('Unique values')))

@@ -31,8 +31,7 @@
from qgis.core import (QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
QgsProcessingParameterNumber,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml)
QgsProcessingParameterFileDestination)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
from processing.tools import vector

@@ -63,7 +62,6 @@ def initAlgorithm(self, config=None):
self.tr('number of bins'), minValue=2, defaultValue=10))

self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT, self.tr('Histogram'), self.tr('HTML files (*.html)')))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT, self.tr('Histogram')))

def name(self):
return 'vectorlayerhistogram'
@@ -31,8 +31,7 @@
from qgis.core import (QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
QgsProcessingUtils,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml)
QgsProcessingParameterFileDestination)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
from processing.tools import vector

@@ -66,7 +65,6 @@ def initAlgorithm(self, config=None):
type=QgsProcessingParameterField.Numeric))

self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT, self.tr('Scatterplot'), self.tr('HTML files (*.html)')))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT, self.tr('Scatterplot')))

def name(self):
return 'vectorlayerscatterplot'
@@ -31,7 +31,6 @@
from qgis.core import (QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml,
QgsProcessingUtils)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm

@@ -72,7 +71,6 @@ def initAlgorithm(self, config=None):
type=QgsProcessingParameterField.Numeric))

self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT, self.tr('Histogram'), self.tr('HTML files (*.html)')))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT, self.tr('Histogram')))

def name(self):
return 'scatter3dplot'

0 comments on commit c39e2a4

Please sign in to comment.
You can’t perform that action at this time.