16
16
* *
17
17
***************************************************************************
18
18
"""
19
+ from processing .parameters .ParameterTableField import ParameterTableField
19
20
20
21
__author__ = 'Victor Olaya'
21
22
__date__ = 'August 2012'
@@ -237,7 +238,8 @@ def processAlgorithm(self, progress):
237
238
raise GeoAlgorithmExecutionException ("Unsupported file format" )
238
239
239
240
#2: set parameters and outputs
240
- if ProcessingUtils .isWindows () or ProcessingUtils .isMac ():
241
+ saga208 = ProcessingConfig .getSetting (SagaUtils .SAGA_208 )
242
+ if ProcessingUtils .isWindows () or ProcessingUtils .isMac () or not saga208 :
241
243
command = self .undecoratedGroup + " \" " + self .cmdname + "\" "
242
244
else :
243
245
command = "lib" + self .undecoratedGroup + " \" " + self .cmdname + "\" "
@@ -304,8 +306,9 @@ def processAlgorithm(self, progress):
304
306
if isinstance (out , OutputRaster ):
305
307
filename = out .getCompatibleFileName (self )
306
308
filename2 = ProcessingUtils .tempFolder () + os .sep + os .path .basename (filename ) + ".sgrd"
307
- if ProcessingUtils .isWindows () or ProcessingUtils .isMac ():
308
- commands .append ("io_gdal 1 -GRIDS \" " + filename2 + "\" -FORMAT 4 -TYPE 0 -FILE \" " + filename + "\" " );
309
+ formatIndex = 1 if saga208 else 4
310
+ if ProcessingUtils .isWindows () or ProcessingUtils .isMac () or not saga208 :
311
+ commands .append ("io_gdal 1 -GRIDS \" " + filename2 + "\" -FORMAT " + str (formatIndex ) + " -TYPE 0 -FILE \" " + filename + "\" " );
309
312
else :
310
313
commands .append ("libio_gdal 1 -GRIDS \" " + filename2 + "\" -FORMAT 1 -TYPE 0 -FILE \" " + filename + "\" " );
311
314
@@ -363,7 +366,8 @@ def resampleRasterLayer(self,layer):
363
366
inputFilename = layer
364
367
destFilename = ProcessingUtils .getTempFilename ("sgrd" )
365
368
self .exportedLayers [layer ]= destFilename
366
- if ProcessingUtils .isWindows () or ProcessingUtils .isMac ():
369
+ saga208 = ProcessingConfig .getSetting (SagaUtils .SAGA_208 )
370
+ if ProcessingUtils .isWindows () or ProcessingUtils .isMac () or not saga208 :
367
371
s = "grid_tools \" Resampling\" -INPUT \" " + inputFilename + "\" -TARGET 0 -SCALE_UP_METHOD 4 -SCALE_DOWN_METHOD 4 -USER_XMIN " + \
368
372
str (self .xmin ) + " -USER_XMAX " + str (self .xmax ) + " -USER_YMIN " + str (self .ymin ) + " -USER_YMAX " + str (self .ymax ) + \
369
373
" -USER_SIZE " + str (self .cellsize ) + " -USER_GRID \" " + destFilename + "\" "
@@ -377,7 +381,8 @@ def resampleRasterLayer(self,layer):
377
381
def exportRasterLayer (self , layer ):
378
382
destFilename = ProcessingUtils .getTempFilenameInTempFolder (os .path .basename (layer )[0 :5 ] + ".sgrd" )
379
383
self .exportedLayers [layer ]= destFilename
380
- if ProcessingUtils .isWindows () or ProcessingUtils .isMac ():
384
+ saga208 = ProcessingConfig .getSetting (SagaUtils .SAGA_208 )
385
+ if ProcessingUtils .isWindows () or ProcessingUtils .isMac () or not saga208 :
381
386
return "io_gdal 0 -GRIDS \" " + destFilename + "\" -FILES \" " + layer + "\" "
382
387
else :
383
388
return "libio_gdal 0 -GRIDS \" " + destFilename + "\" -FILES \" " + layer + "\" "
0 commit comments