Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make data type option translatable in GDAL algorithms dialog
  • Loading branch information
DelazJ authored and nyalldawson committed May 20, 2019
1 parent e997737 commit bfe746d
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 @@ -54,12 +54,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 @@ -58,12 +58,13 @@ class ClipRasterByMask(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(QgsProcessingParameterFeatureSource(self.MASK,
Expand Down
5 changes: 3 additions & 2 deletions python/plugins/processing/algs/gdal/rearrange_bands.py
Expand Up @@ -52,12 +52,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 @@ -55,12 +55,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 @@ -63,8 +63,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 @@ -82,6 +80,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 bfe746d

Please sign in to comment.