Skip to content
Permalink
Browse files

Revert "Make Extent and Extent CRS GDAL parameters optional"

This reverts commit dc2df62.
  • Loading branch information
volaya committed Oct 21, 2016
1 parent a965a13 commit f35c60adf9a0d9188bcc64576dcc02cd5bf88e65
@@ -91,8 +91,7 @@ def defineCharacteristics(self):

if GdalUtils.version() >= 2000000:
self.addParameter(ParameterCrs(self.EXT_CRS,
self.tr('CRS of the raster extent, leave blank for using Destination SRS'),
optional=True))
self.tr('CRS of the raster extent'), ''))

params = []
params.append(ParameterSelection(self.RTYPE,
@@ -136,7 +135,7 @@ def getConsoleCommands(self):
compress = self.COMPRESSTYPE[self.getParameterValue(self.COMPRESS)]
bigtiff = self.BIGTIFFTYPE[self.getParameterValue(self.BIGTIFF)]
tfw = unicode(self.getParameterValue(self.TFW))
rastext = self.getParameterValue(self.RAST_EXT)
rastext = unicode(self.getParameterValue(self.RAST_EXT))
rastext_crs = self.getParameterValue(self.EXT_CRS)

arguments = []
@@ -164,17 +163,21 @@ def getConsoleCommands(self):
extra = self.getParameterValue(self.EXTRA)
if extra is not None:
extra = unicode(extra)
regionCoords = rastext.split(',')
try:
rastext = []
rastext.append('-te')
rastext.append(regionCoords[0])
rastext.append(regionCoords[2])
rastext.append(regionCoords[1])
rastext.append(regionCoords[3])
except IndexError:
rastext = []
if rastext:
regionCoords = rastext.split(',')
if len(regionCoords) >= 4:
arguments.append('-te')
arguments.append(regionCoords[0])
arguments.append(regionCoords[2])
arguments.append(regionCoords[1])
arguments.append(regionCoords[3])
arguments.extend(rastext)

if GdalUtils.version() >= 2000000:
if rastext and rastext_crs:
if rastext and rastext_crs is not None:
arguments.append('-te_srs')
arguments.append(rastext_crs)

@@ -198,7 +198,7 @@ def __init__(self, name='', description='', default=None, optional=False):
# The value is a string in the form "xmin, xmax, ymin, ymax"

def setValue(self, text):
if not text:
if text is None:
if not self.optional:
return False
self.value = None
@@ -58,7 +58,7 @@ def __init__(self, dialog, alg, default=None):
if self.canUseAutoExtent():
if hasattr(self.leText, 'setPlaceholderText'):
self.leText.setPlaceholderText(
self.tr('[Use "auto" to use min covering extent]'))
self.tr('[Leave blank to use min covering extent]'))

self.btnSelect.clicked.connect(self.selectExtent)

@@ -112,7 +112,7 @@ def selectExtent(self):
popupmenu.exec_(QCursor.pos())

def useMinCoveringExtent(self):
self.leText.setText('auto')
self.leText.setText('')

def getMinCoveringExtent(self):
first = True
@@ -205,10 +205,10 @@ def setValueFromRect(self, r):
self.dialog.activateWindow()

def getValue(self):
if unicode(self.leText.text()).strip() == 'auto':
return self.getMinCoveringExtent()
else:
if unicode(self.leText.text()).strip() != '':
return unicode(self.leText.text())
else:
return self.getMinCoveringExtent()

def setExtentFromString(self, s):
self.leText.setText(s)

0 comments on commit f35c60a

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