From 7abca16d05a26432b3151eb259c0f8576a9755c8 Mon Sep 17 00:00:00 2001 From: Alexia Mondot Date: Fri, 31 Jan 2014 16:12:28 +0100 Subject: [PATCH] fixes bugs about processing evolution --- python/plugins/processing/otb/CMakeLists.txt | 2 +- python/plugins/processing/otb/OTBAlgorithm.py | 6 ++-- python/plugins/processing/otb/OTBUtils.py | 11 ++++--- .../processing/otb/description/SplitImage.xml | 30 ------------------- 4 files changed, 9 insertions(+), 40 deletions(-) delete mode 100644 python/plugins/processing/otb/description/SplitImage.xml diff --git a/python/plugins/processing/otb/CMakeLists.txt b/python/plugins/processing/otb/CMakeLists.txt index 4e3617d1fda..8dc08da98e3 100644 --- a/python/plugins/processing/otb/CMakeLists.txt +++ b/python/plugins/processing/otb/CMakeLists.txt @@ -1,5 +1,5 @@ FILE(GLOB PY_FILES *.py) -FILE(GLOB DESCR_FILES description/*.txt) +FILE(GLOB DESCR_FILES description/*.xml) FILE(GLOB HELPER_FILES helper/*.py) FiLE(GLOB HELP_FILES description/doc/*.html) diff --git a/python/plugins/processing/otb/OTBAlgorithm.py b/python/plugins/processing/otb/OTBAlgorithm.py index 45b8fb70ecf..e77b7625604 100644 --- a/python/plugins/processing/otb/OTBAlgorithm.py +++ b/python/plugins/processing/otb/OTBAlgorithm.py @@ -40,12 +40,12 @@ from processing.parameters.ParameterBoolean import ParameterBoolean from processing.parameters.ParameterSelection import ParameterSelection from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException from processing.core.ProcessingLog import ProcessingLog -from processing.core.ProcessingUtils import ProcessingUtils from processing.core.WrongHelpFileException import WrongHelpFileException from processing.parameters.ParameterFactory import ParameterFactory from processing.outputs.OutputFactory import OutputFactory from processing.otb.OTBUtils import OTBUtils from processing.parameters.ParameterExtent import ParameterExtent +from processing.tools.system import * import xml.etree.ElementTree as ET import traceback import inspect @@ -250,7 +250,7 @@ class OTBAlgorithm(GeoAlgorithm): if isinstance(param, ParameterVector): commands.append(param.name) if self.hasROI: - roiFile = ProcessingUtils.getTempFilename('shp') + roiFile = getTempFilename('shp') commands.append(roiFile) self.roiVectors[param.value] = roiFile else: @@ -258,7 +258,7 @@ class OTBAlgorithm(GeoAlgorithm): elif isinstance(param, ParameterRaster): commands.append(param.name) if self.hasROI: - roiFile = ProcessingUtils.getTempFilename('tif') + roiFile = getTempFilename('tif') commands.append(roiFile) self.roiRasters[param.value] = roiFile else: diff --git a/python/plugins/processing/otb/OTBUtils.py b/python/plugins/processing/otb/OTBUtils.py index 15678c2d820..f225e80d1e1 100644 --- a/python/plugins/processing/otb/OTBUtils.py +++ b/python/plugins/processing/otb/OTBUtils.py @@ -34,11 +34,10 @@ from qgis.core import QgsApplication import subprocess from processing.core.ProcessingConfig import ProcessingConfig from processing.core.ProcessingLog import ProcessingLog -from processing.core.ProcessingUtils import ProcessingUtils +from processing.tools.system import * import logging import xml.etree.ElementTree as ET import traceback -from processing.core.QGisLayers import QGisLayers import qgis.core import PyQt4.QtGui @@ -56,7 +55,7 @@ class OTBUtils: if folder == None: folder = "" #try to configure the path automatically - if ProcessingUtils.isMac(): + if isMac(): testfolder = os.path.join(str(QgsApplication.prefixPath()), "bin") if os.path.exists(os.path.join(testfolder, "otbcli")): folder = testfolder @@ -64,7 +63,7 @@ class OTBUtils: testfolder = "/usr/local/bin" if os.path.exists(os.path.join(testfolder, "otbcli")): folder = testfolder - elif ProcessingUtils.isWindows(): + elif isWindows(): testfolder = os.path.dirname(str(QgsApplication.prefixPath())) testfolder = os.path.dirname(testfolder) testfolder = os.path.join(testfolder, "bin") @@ -83,7 +82,7 @@ class OTBUtils: if folder == None: folder ="" #try to configure the path automatically - if ProcessingUtils.isMac(): + if isMac(): testfolder = os.path.join(str(QgsApplication.prefixPath()), "lib/otb/applications") if os.path.exists(testfolder): folder = testfolder @@ -91,7 +90,7 @@ class OTBUtils: testfolder = "/usr/local/lib/otb/applications" if os.path.exists(testfolder): folder = testfolder - elif ProcessingUtils.isWindows(): + elif isWindows(): testfolder = os.path.dirname(str(QgsApplication.prefixPath())) testfolder = os.path.join(testfolder, "orfeotoolbox") testfolder = os.path.join(testfolder, "applications") diff --git a/python/plugins/processing/otb/description/SplitImage.xml b/python/plugins/processing/otb/description/SplitImage.xml deleted file mode 100644 index 298a935096a..00000000000 --- a/python/plugins/processing/otb/description/SplitImage.xml +++ /dev/null @@ -1,30 +0,0 @@ - - SplitImage - otbcli_SplitImage - Split Image - Image Manipulation - Split a N multiband image into N images - - ParameterRaster - in - Input Image - Input multiband image filename. - False - - - OutputFile - out - Output Image - Output filename that will be used to get the prefix and the extension of the output images to write - - - - ParameterNumber - ram - Available RAM (Mb) - Available memory for processing (in MB) - - - 128 - -