Skip to content

Commit

Permalink
indentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jul 2, 2014
1 parent 7aef548 commit 8871be0
Show file tree
Hide file tree
Showing 34 changed files with 357 additions and 357 deletions.
10 changes: 5 additions & 5 deletions python/plugins/fTools/tools/doSelectByLocation.py
Expand Up @@ -85,10 +85,10 @@ def compute(self, inLayer, selLayer, modify, selection):
geom = QgsGeometry()
selectedSet = []
index = ftools_utils.createIndex(inputProvider)

def _points_op(geomA,geomB):
return geomA.intersects(geomB)

def _poly_lines_op(geomA,geomB):
if geomA.disjoint(geomB):
return False
Expand All @@ -102,14 +102,14 @@ def _poly_lines_op(geomA,geomB):
intersects |= geomA.overlaps(geomB)
if not intersects and (self.opFlags & self.WITHIN):
intersects |= geomA.contains(geomB)
return intersects
return intersects

def _sp_operator():
if inputLayer.geometryType() == QGis.Point:
return _points_op
else:
return _poly_lines_op

self.opFlags = 0
if self.chkTouches.checkState() == Qt.Checked:
self.opFlags |= self.TOUCH
Expand Down
12 changes: 6 additions & 6 deletions python/plugins/processing/algs/lidar/fusion/CanopyModel.py
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-

"""
***************************************************************************
Expand Down Expand Up @@ -43,7 +43,7 @@ class CanopyModel(FusionAlgorithm):

INPUT = 'INPUT'
OUTPUT_DTM = 'OUTPUT_DTM'
CELLSIZE = 'CELLSIZE'
CELLSIZE = 'CELLSIZE'
XYUNITS = 'XYUNITS'
ZUNITS = 'ZUNITS'
UNITS = ['Meter', 'Feet']
Expand All @@ -57,11 +57,11 @@ class CanopyModel(FusionAlgorithm):
def defineCharacteristics(self):
self.name = 'Canopy Model'
self.group = 'Points'
self.addParameter(ParameterFile(self.INPUT, 'Input las layer'))
self.addParameter(ParameterFile(self.INPUT, 'Input las layer'))
self.addParameter(ParameterNumber(self.CELLSIZE, 'Cellsize', 0, None, 10.0))
self.addParameter(ParameterSelection(self.XYUNITS, 'XY Units', self.UNITS))
self.addParameter(ParameterSelection(self.ZUNITS, 'Z Units', self.UNITS))
self.addOutput(OutputFile(self.OUTPUT_DTM, 'DTM Output Surface', 'dtm'))
self.addOutput(OutputFile(self.OUTPUT_DTM, 'DTM Output Surface', 'dtm'))
ground = ParameterFile(self.GROUND, 'Input ground DTM layer', False, True)
ground.isAdvanced = True
self.addParameter(ground)
Expand All @@ -70,7 +70,7 @@ def defineCharacteristics(self):
self.addParameter(median)
smooth = ParameterString(self.SMOOTH, 'Smooth', '', False, True)
smooth.isAdvanced = True
self.addParameter(smooth)
self.addParameter(smooth)
slope = ParameterString(self.SLOPE, 'Slope', '', False, True)
slope.isAdvanced = True
self.addParameter(slope)
Expand All @@ -79,7 +79,7 @@ def defineCharacteristics(self):
self.addParameter(class_var)
advance_modifiers = ParameterString(self.ADVANCED_MODIFIERS, 'Additional modifiers', '', False, True)
advance_modifiers.isAdvanced = True
self.addParameter(advance_modifiers)
self.addParameter(advance_modifiers)

def processAlgorithm(self, progress):
commands = [os.path.join(FusionUtils.FusionPath(), 'CanopyModel.exe')]
Expand Down
10 changes: 5 additions & 5 deletions python/plugins/processing/algs/lidar/fusion/Catalog.py
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-

"""
***************************************************************************
Expand Down Expand Up @@ -43,7 +43,7 @@ class Catalog(FusionAlgorithm):
def defineCharacteristics(self):
self.name = 'Catalog'
self.group = 'Points'
self.addParameter(ParameterFile(self.INPUT, 'Input las layer'))
self.addParameter(ParameterFile(self.INPUT, 'Input las layer'))
self.addOutput(OutputFile(self.OUTPUT, 'Output files'))
density = ParameterString(self.DENSITY, 'Density - area, min, max (set blank if not used)', '', False, True)
density.isAdvanced = True
Expand All @@ -58,7 +58,7 @@ def defineCharacteristics(self):
advanced_modifiers.isAdvanced = True
self.addParameter(advanced_modifiers)


def processAlgorithm(self, progress):
commands = [os.path.join(FusionUtils.FusionPath(), 'Catalog.exe')]
commands.append('/verbose')
Expand All @@ -79,6 +79,6 @@ def processAlgorithm(self, progress):
commands.append(self.getParameterValue(self.INPUT))
else:
FusionUtils.createFileList(files)
commands.append(FusionUtils.tempFileListFilepath())
commands.append(self.getOutputValue(self.OUTPUT))
commands.append(FusionUtils.tempFileListFilepath())
commands.append(self.getOutputValue(self.OUTPUT))
FusionUtils.runFusion(commands, progress)
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-

"""
***************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/lidar/fusion/Csv2Grid.py
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-

"""
***************************************************************************
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/lidar/fusion/GridMetrics.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
GridMetrics.py
Expand Down Expand Up @@ -86,7 +86,7 @@ def defineCharacteristics(self):
class_var = ParameterString(self.CLASS, 'Class (set blank if not used)', '', False, True)
class_var.isAdvanced = True
self.addParameter(class_var)


def processAlgorithm(self, progress):
commands = [os.path.join(FusionUtils.FusionPath(), 'GridMetrics.exe')]
Expand Down
12 changes: 6 additions & 6 deletions python/plugins/processing/algs/lidar/fusion/GridSurfaceCreate.py
Expand Up @@ -61,7 +61,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterFile(self.INPUT, 'Input las layer'))
self.addParameter(ParameterNumber(self.CELLSIZE, 'Cellsize', 0, None, 10.0))
self.addParameter(ParameterSelection(self.XYUNITS, 'XY Units', self.UNITS))
self.addParameter(ParameterSelection(self.ZUNITS, 'Z Units', self.UNITS))
self.addParameter(ParameterSelection(self.ZUNITS, 'Z Units', self.UNITS))
self.addOutput(OutputFile(self.OUTPUT_DTM, 'DTM Output Surface', 'dtm'))
spike = ParameterString(self.SPIKE, 'Spike (set blank if not used)', '', False, True)
spike.isAdvanced = True
Expand All @@ -71,19 +71,19 @@ def defineCharacteristics(self):
self.addParameter(median)
smooth = ParameterString(self.SMOOTH, 'Smooth', '', False, True)
smooth.isAdvanced = True
self.addParameter(smooth)
self.addParameter(smooth)
slope = ParameterString(self.SLOPE, 'Slope', '', False, True)
slope.isAdvanced = True
self.addParameter(slope)
self.addParameter(slope)
minimum = ParameterBoolean(self.MINIMUM, 'Minimum (set blank if not used)', False)
minimum.isAdvanced = True
self.addParameter(minimum)
self.addParameter(minimum)
class_var = ParameterString(self.CLASS, 'Class(es)', 2, False, True)
class_var.isAdvanced = True
self.addParameter(class_var)
advance_modifiers = ParameterString(self.ADVANCED_MODIFIERS, 'Additional modifiers', '', False, True)
advance_modifiers.isAdvanced = True
self.addParameter(advance_modifiers)
self.addParameter(advance_modifiers)

def processAlgorithm(self, progress):
commands = [os.path.join(FusionUtils.FusionPath(), 'GridSurfaceCreate.exe')]
Expand Down Expand Up @@ -122,5 +122,5 @@ def processAlgorithm(self, progress):
commands.append(self.getParameterValue(self.INPUT))
else:
FusionUtils.createFileList(files)
commands.append(FusionUtils.tempFileListFilepath())
commands.append(FusionUtils.tempFileListFilepath())
FusionUtils.runFusion(commands, progress)
6 changes: 3 additions & 3 deletions python/plugins/processing/algs/lidar/fusion/PolyClipData.py
Expand Up @@ -56,9 +56,9 @@ def defineCharacteristics(self):
## 'field' e 'value' box should appear or get activated if Shape attribute is switched ON
self.addParameter(ParameterString(self.FIELD, 'Shape field index'))
self.addParameter(ParameterString(self.VALUE, "Shape value"))
self.addAdvancedModifiers()
self.addAdvancedModifiers()


def processAlgorithm(self, progress):
commands = [os.path.join(FusionUtils.FusionPath(), 'PolyClipData.exe')]
commands.append('/verbose')
Expand Down
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-

"""
***************************************************************************
Expand Down Expand Up @@ -76,5 +76,5 @@ def processAlgorithm(self, progress):
if len(files) == 1:
commands.append(self.getParameterValue(self.INPUT))
else:
commands.extend(files)
commands.extend(files)
FusionUtils.runFusion(commands, progress)
12 changes: 6 additions & 6 deletions python/plugins/processing/algs/qgis/ftools/ExtractByLocation.py
Expand Up @@ -42,7 +42,7 @@ class ExtractByLocation(GeoAlgorithm):
OVERLAPS = 'OVERLAPS'
WITHIN = 'WITHIN'
OUTPUT = 'OUTPUT'

METHODS = ['creating new selection', 'adding to current selection',
'removing from current selection']
opFlags = 0
Expand Down Expand Up @@ -73,10 +73,10 @@ def processAlgorithm(self, progress):
filename = self.getParameterValue(self.INTERSECT)
selectLayer = dataobjects.getObjectFromUri(filename)
index = vector.spatialindex(layer)

def _points_op(geomA,geomB):
return geomA.intersects(geomB)

def _poly_lines_op(geomA,geomB):
if geomA.disjoint(geomB):
return False
Expand All @@ -90,14 +90,14 @@ def _poly_lines_op(geomA,geomB):
intersects |= geomA.overlaps(geomB)
if not intersects and (self.opFlags & self.operators['WITHIN']):
intersects |= geomA.contains(geomB)
return intersects
return intersects

def _sp_operator():
if layer.geometryType() == QGis.Point:
return _points_op
else:
return _poly_lines_op

self.opFlags = 0
if self.getParameterValue(self.TOUCHES):
self.opFlags |= self.operators['TOUCHES']
Expand Down
10 changes: 5 additions & 5 deletions python/plugins/processing/algs/qgis/ftools/SelectByLocation.py
Expand Up @@ -81,10 +81,10 @@ def processAlgorithm(self, progress):

oldSelection = set(inputLayer.selectedFeaturesIds())
index = vector.spatialindex(inputLayer)

def _points_op(geomA,geomB):
return geomA.intersects(geomB)

def _poly_lines_op(geomA,geomB):
if geomA.disjoint(geomB):
return False
Expand All @@ -98,14 +98,14 @@ def _poly_lines_op(geomA,geomB):
intersects |= geomA.overlaps(geomB)
if not intersects and (self.opFlags & self.operators['WITHIN']):
intersects |= geomA.contains(geomB)
return intersects
return intersects

def _sp_operator():
if inputLayer.geometryType() == QGis.Point:
return _points_op
else:
return _poly_lines_op

self.opFlags = 0
if self.getParameterValue(self.TOUCHES):
self.opFlags |= self.operators['TOUCHES']
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/processing/core/Processing.py
Expand Up @@ -138,7 +138,7 @@ def initialize():
Processing.addProvider(SagaAlgorithmProvider())
Processing.addProvider(GrassAlgorithmProvider())
Processing.addProvider(Grass7AlgorithmProvider())
Processing.addProvider(ScriptAlgorithmProvider())
Processing.addProvider(ScriptAlgorithmProvider())
Processing.addProvider(TauDEMAlgorithmProvider())
Processing.addProvider(ModelerAlgorithmProvider())
Processing.modeler.initializeSettings()
Expand Down Expand Up @@ -211,7 +211,7 @@ def loadActions():
for action in providerActions:
actions.append(action)
Processing.actions[provider.getName()] = actions

Processing.actions[provider.getName()] = actions

@staticmethod
Expand Down Expand Up @@ -256,9 +256,9 @@ def runAlgorithm(algOrName, onFinish, *args):
print 'Error: Algorithm not found\n'
return
alg = alg.getCopy()

if len(args) == 1 and isinstance(args[0], dict):
# Set params by name and try to run the alg even if not all parameter values are provided,
# Set params by name and try to run the alg even if not all parameter values are provided,
# by using the default values instead.
setParams = []
for (name, value) in args[0].items():
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/processing/gui/HelpEditionDialog.py
Expand Up @@ -55,11 +55,11 @@ def __init__(self, alg):
helpfile = alg.descriptionFile + '.help'
if os.path.exists(helpfile):
try:
with open(helpfile) as f:
with open(helpfile) as f:
self.descriptions = json.load(f)
except Exception, e:
ProcessingLog.addToLog(ProcessingLog.LOG_WARNING, "Cannot open help file: " + helpfile)
ProcessingLog.addToLog(ProcessingLog.LOG_WARNING, "Cannot open help file: " + helpfile)

self.currentName = self.ALG_DESC
if self.ALG_DESC in self.descriptions:
self.text.setText(self.descriptions[self.ALG_DESC])
Expand All @@ -80,7 +80,7 @@ def accept(self):
if self.alg.descriptionFile is not None:
try:
with open(self.alg.descriptionFile + '.help', 'w') as f:
json.dump(self.descriptions, f)
json.dump(self.descriptions, f)
except Exception, e:
QMessageBox.warning(self, 'Error saving help file',
'Help file could not be saved.\n'
Expand Down
Expand Up @@ -47,7 +47,7 @@ def execute(self):
'*.model')
if filename:
try:
ModelerAlgorithm.fromJsonFile(filename)
ModelerAlgorithm.fromJsonFile(filename)
except WrongModelException:
QtGui.QMessageBox.warning(self.toolbox, "Error reading model", "The selected file does not contain a valid model")
return
Expand Down
18 changes: 9 additions & 9 deletions python/plugins/processing/modeler/CalculatorModelerAlgorithm.py
Expand Up @@ -40,7 +40,7 @@
NUMBER = 'NUMBER'
RESULT = 'RESULT'
AVAILABLE_VARIABLES = 10

class CalculatorModelerAlgorithm(GeoAlgorithm):

def defineCharacteristics(self):
Expand Down Expand Up @@ -68,10 +68,10 @@ def processAlgorithm(self, progress):

def getCustomModelerParametersDialog(self, modelAlg, algIndex=None):
return CalculatorModelerParametersDialog(self, modelAlg, algIndex)


class CalculatorModelerParametersDialog(ModelerParametersDialog):

def setupUi(self):
self.valueItems = {}
self.dependentItems = {}
Expand Down Expand Up @@ -112,21 +112,21 @@ def setupUi(self):
def createAlgorithm(self):
alg = Algorithm('modelertools:calculator')
alg.setName(self.model)
alg.description = "Calculator"
alg.description = "Calculator"

formula = self.formulaText.text()
alg.params[FORMULA] = formula

for i in xrange(AVAILABLE_VARIABLES):
paramname = NUMBER + str(i)
alg.params[paramname] = None

numbers = self.getAvailableValuesOfType(ParameterNumber, OutputNumber)
used = []
for i in range(len(numbers)):
if str(chr(i + 97)) in formula:
used.append(numbers[i])
used.append(numbers[i])

for i, variable in enumerate(used):
paramname = NUMBER + str(i)
alg.params[paramname] = variable
Expand All @@ -135,4 +135,4 @@ def createAlgorithm(self):
return alg



0 comments on commit 8871be0

Please sign in to comment.