Skip to content

Commit

Permalink
Make data type option translatable in GDAL algorithms dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
DelazJ authored and nyalldawson committed May 19, 2019
1 parent 83cbe24 commit 491ca33
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
5 changes: 3 additions & 2 deletions python/plugins/processing/algs/gdal/ClipRasterByExtent.py
Expand Up @@ -50,12 +50,13 @@ class ClipRasterByExtent(GdalAlgorithm):
DATA_TYPE = 'DATA_TYPE'
OUTPUT = 'OUTPUT'

TYPES = ['Use input layer data type', 'Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64', 'CInt16', 'CInt32', 'CFloat32', 'CFloat64']

def __init__(self):
super().__init__()

def initAlgorithm(self, config=None):

self.TYPES = [self.tr('Use Input Layer Data Type'), 'Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64', 'CInt16', 'CInt32', 'CFloat32', 'CFloat64']

self.addParameter(QgsProcessingParameterRasterLayer(self.INPUT,
self.tr('Input layer')))
self.addParameter(QgsProcessingParameterExtent(self.EXTENT,
Expand Down
5 changes: 3 additions & 2 deletions python/plugins/processing/algs/gdal/ClipRasterByMask.py
Expand Up @@ -61,12 +61,13 @@ class ClipRasterByMask(GdalAlgorithm):
MULTITHREADING = 'MULTITHREADING'
OUTPUT = 'OUTPUT'

TYPES = ['Use input layer data type', 'Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64', 'CInt16', 'CInt32', 'CFloat32', 'CFloat64']

def __init__(self):
super().__init__()

def initAlgorithm(self, config=None):

self.TYPES = [self.tr('Use Input Layer Data Type'), 'Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64', 'CInt16', 'CInt32', 'CFloat32', 'CFloat64']

self.addParameter(QgsProcessingParameterRasterLayer(self.INPUT,
self.tr('Input layer')))
self.addParameter(QgsProcessingParameterFeatureSource(self.MASK,
Expand Down
5 changes: 3 additions & 2 deletions python/plugins/processing/algs/gdal/rearrange_bands.py
Expand Up @@ -48,12 +48,13 @@ class rearrange_bands(GdalAlgorithm):
DATA_TYPE = 'DATA_TYPE'
OUTPUT = 'OUTPUT'

TYPES = ['Use input layer data type', 'Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64', 'CInt16', 'CInt32', 'CFloat32', 'CFloat64']

def __init__(self):
super().__init__()

def initAlgorithm(self, config=None):

self.TYPES = [self.tr('Use Input Layer Data Type'), 'Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64', 'CInt16', 'CInt32', 'CFloat32', 'CFloat64']

self.addParameter(QgsProcessingParameterRasterLayer(self.INPUT, self.tr('Input layer')))
self.addParameter(QgsProcessingParameterBand(self.BANDS,
self.tr('Selected band(s)'),
Expand Down
5 changes: 3 additions & 2 deletions python/plugins/processing/algs/gdal/translate.py
Expand Up @@ -51,12 +51,13 @@ class translate(GdalAlgorithm):
DATA_TYPE = 'DATA_TYPE'
OUTPUT = 'OUTPUT'

TYPES = ['Use input layer data type', 'Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64', 'CInt16', 'CInt32', 'CFloat32', 'CFloat64']

def __init__(self):
super().__init__()

def initAlgorithm(self, config=None):

self.TYPES = [self.tr('Use Input Layer Data Type'), 'Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64', 'CInt16', 'CInt32', 'CFloat32', 'CFloat64']

self.addParameter(QgsProcessingParameterRasterLayer(self.INPUT, self.tr('Input layer')))
self.addParameter(QgsProcessingParameterCrs(self.TARGET_CRS,
self.tr('Override the projection for the output file'),
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/warp.py
Expand Up @@ -59,8 +59,6 @@ class warp(GdalAlgorithm):
EXTRA = 'EXTRA'
OUTPUT = 'OUTPUT'

TYPES = ['Use input layer data type', 'Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64', 'CInt16', 'CInt32', 'CFloat32', 'CFloat64']

def __init__(self):
super().__init__()

Expand All @@ -78,6 +76,8 @@ def initAlgorithm(self, config=None):
(self.tr('First quartile'), 'q1'),
(self.tr('Third quartile'), 'q3'))

self.TYPES = [self.tr('Use Input Layer Data Type'), 'Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64', 'CInt16', 'CInt32', 'CFloat32', 'CFloat64']

self.addParameter(QgsProcessingParameterRasterLayer(self.INPUT, self.tr('Input layer')))
self.addParameter(QgsProcessingParameterCrs(self.SOURCE_CRS,
self.tr('Source CRS'),
Expand Down

0 comments on commit 491ca33

Please sign in to comment.