From 85bea7d446e1efd4d9e7cde04dce458d21a1337f Mon Sep 17 00:00:00 2001 From: Alexia Mondot Date: Thu, 25 Jun 2015 12:01:04 +0200 Subject: [PATCH] [processing/otb]remove unused code and imports --- .../maintenance/OTBSpecific_XMLcreation.py | 48 +++++++++---------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/python/plugins/processing/algs/otb/maintenance/OTBSpecific_XMLcreation.py b/python/plugins/processing/algs/otb/maintenance/OTBSpecific_XMLcreation.py index e29fc3d2f36..fafe67da467 100644 --- a/python/plugins/processing/algs/otb/maintenance/OTBSpecific_XMLcreation.py +++ b/python/plugins/processing/algs/otb/maintenance/OTBSpecific_XMLcreation.py @@ -32,25 +32,15 @@ __version__ = "3.8" import copy -try: - import processing -except ImportError as e: - raise Exception("Processing must be installed and available in PYTHONPATH") - -try: - import otbApplication -except ImportError as e: - raise Exception("OTB python plugins must be installed and available in PYTHONPATH") - from processing.algs.otb.OTBUtils import (renameValueField, - remove_dependant_choices, - remove_other_choices, - remove_parameter_by_key, - defaultSplit, - split_by_choice, - defaultWrite, - remove_choice, - remove_independant_choices) + remove_dependant_choices, + remove_other_choices, + remove_parameter_by_key, + defaultSplit, + split_by_choice, + defaultWrite, + remove_choice, + remove_independant_choices ) def getBinaryMorphologicalOperation(available_app, original_dom_document): @@ -65,7 +55,6 @@ def getBinaryMorphologicalOperation(available_app, original_dom_document): remove_other_choices(the_root, 'structype', 'ball') remove_dependant_choices(the_root, 'filter', 'dilate') remove_parameter_by_key(the_root, 'structype.ball.yradius') - #defaultWrite(available_app, the_root) the_list = defaultSplit(available_app, the_root, 'filter') return the_list @@ -139,6 +128,9 @@ def getOrthoRectification(available_app, original_dom_document): remove_independant_choices(the_root, 'outputs.mode', 'orthofit') merged = copy.deepcopy(the_root) + + + split = split_by_choice(the_root, 'map') the_list = [] @@ -407,7 +399,6 @@ def getSmoothing(available_app, original_dom_document): # the_list.append(split[key]) #return the_list - def getColorMapping(available_app, original_dom_document): """ Remove the option colortolabel @@ -463,6 +454,7 @@ def getColorMapping(available_app, original_dom_document): return the_list + def getFusionOfClassifications(available_app, original_dom_document): """ Split by method of fusion of classification (dempstershafer, majorityvoting) @@ -492,6 +484,7 @@ def getTrainImagesClassifier(available_app, original_dom_document): return the_list + def getLineSegmentDetection(available_app, original_dom_document): """ Delete GEOID and DEM parameter as they are not updated at the creation of the otb algorithms when you launch QGIS. @@ -505,6 +498,7 @@ def getLineSegmentDetection(available_app, original_dom_document): return [the_root] + def getImageEnvelope(available_app, original_dom_document): """ Delete GEOID and DEM parameter as they are not updated at the creation of the otb algorithms when you launch QGIS. @@ -559,6 +553,7 @@ def getReadImageInfo(available_app, original_dom_document): return [the_root] + def getComputeModulusAndPhase(available_app, original_dom_document): """ Split the application according the field nbinput. @@ -575,7 +570,7 @@ def getComputeModulusAndPhase(available_app, original_dom_document): the_doc.find('longname').text = '%s (%s)' % (old_app_name, 'OneEntry') defaultWrite('%s-%s' % (available_app, 'OneEntry'), the_doc) the_list.append(the_doc) - else: + else : the_doc = split[key] old_app_name = the_doc.find('key').text the_doc.find('key').text = '%s-%s' % (old_app_name, 'TwoEntries') @@ -615,7 +610,7 @@ def getConnectedComponentSegmentation(available_app, original_dom_document): The values are picked from the settings. """ the_root = original_dom_document - deleteGeoidSrtm(the_root) + deleteGeoidSrtm( the_root ) defaultWrite(available_app, the_root) return [the_root] @@ -626,7 +621,7 @@ def getKmzExport(available_app, original_dom_document): The values are picked from the settings. """ the_root = original_dom_document - deleteGeoidSrtm(the_root) + deleteGeoidSrtm( the_root ) defaultWrite(available_app, the_root) return [the_root] @@ -637,7 +632,7 @@ def getSuperimpose(available_app, original_dom_document): The values are picked from the settings. """ the_root = original_dom_document - deleteGeoidSrtm(the_root) + deleteGeoidSrtm( the_root ) defaultWrite(available_app, the_root) return [the_root] @@ -648,12 +643,13 @@ def getStereoFramework(available_app, original_dom_document): The values are picked from the settings. """ the_root = original_dom_document - deleteGeoidSrtm(the_root) + deleteGeoidSrtm( the_root ) defaultWrite(available_app, the_root) return [the_root] -def deleteGeoidSrtm(doc): + +def deleteGeoidSrtm(doc) : """ Delete GEOID and DEM parameter as they are not updated at the creation of the otb algorithms when you launch QGIS. The values are picked from the settings.