Skip to content

Commit

Permalink
indentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed May 18, 2013
1 parent 350f224 commit 7ac1baf
Show file tree
Hide file tree
Showing 28 changed files with 304 additions and 302 deletions.
2 changes: 1 addition & 1 deletion python/plugins/fTools/tools/doEliminate.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def eliminate(self, inLayer, boundary, progressBar, outFileName):
mergeWithFid = None
mergeWithGeom = None
max = 0

selFeat = QgsFeature()
while fit.nextFeature(selFeat):
selGeom = selFeat.geometry()
Expand Down
12 changes: 6 additions & 6 deletions python/plugins/sextante/grass/GrassAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@

class GrassAlgorithm(GeoAlgorithm):

GRASS_OUTPUT_TYPE_PARAMETER = "GRASS_OUTPUT_TYPE_PARAMETER"
GRASS_OUTPUT_TYPE_PARAMETER = "GRASS_OUTPUT_TYPE_PARAMETER"
GRASS_MIN_AREA_PARAMETER = "GRASS_MIN_AREA_PARAMETER"
GRASS_SNAP_TOLERANCE_PARAMETER = "GRASS_SNAP_TOLERANCE_PARAMETER"
GRASS_REGION_EXTENT_PARAMETER = "GRASS_REGION_PARAMETER"
GRASS_REGION_CELLSIZE_PARAMETER = "GRASS_REGION_CELLSIZE_PARAMETER"
GRASS_REGION_ALIGN_TO_RESOLUTION = "-a_r.region"

OUTPUT_TYPES = ["auto", "point", "line", "area"]

def __init__(self, descriptionfile):
Expand Down Expand Up @@ -156,12 +156,12 @@ def defineCharacteristicsFromFile(self):
param = ParameterNumber(self.GRASS_MIN_AREA_PARAMETER, "v.in.ogr min area", 0, None, 0.0001)
param.isAdvanced = True
self.addParameter(param)
if vectorOutputs == 1:
if vectorOutputs == 1:
param = ParameterSelection(self.GRASS_OUTPUT_TYPE_PARAMETER, "v.out.ogr output type", self.OUTPUT_TYPES)
param.isAdvanced = True
self.addParameter(param)


def getDefaultCellsize(self):
cellsize = 0
for param in self.parameters:
Expand Down Expand Up @@ -340,7 +340,7 @@ def processAlgorithm(self, progress):
command += " format=ESRI_Shapefile"
command += " olayer=" + os.path.basename(out.value)[:-4]
typeidx = self.getParameterValue(self.GRASS_OUTPUT_TYPE_PARAMETER);
outtype = "auto" if typeidx is None else self.OUTPUT_TYPES[typeidx]
outtype = "auto" if typeidx is None else self.OUTPUT_TYPES[typeidx]
command += " type=" + outtype
commands.append(command)
outputCommands.append(command)
Expand Down
22 changes: 11 additions & 11 deletions python/plugins/sextante/modeler/ModelerAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __init__(self):

#position of items in canvas
self.algPos = []
self.paramPos = []
self.paramPos = []
self.outputPos = [] #same structure as algOutputs

#deactivated algorithms that should not be executed
Expand Down Expand Up @@ -162,15 +162,15 @@ def openModel(self, filename):
else:
tokens = line.split("|")
algParams[param.name] = AlgorithmAndParameter(int(tokens[0]), tokens[1])
outputPos = {}
outputPos = {}
for out in alg.outputs:
line = lines.readline().strip("\n").strip("\r")
if str(None)!=line:
if "|" in line:
tokens = line.split("|")
name = tokens[0]
tokens = tokens[1].split(",")
outputPos[out.name] = QtCore.QPointF(float(tokens[0]), float(tokens[1]))
outputPos[out.name] = QtCore.QPointF(float(tokens[0]), float(tokens[1]))
else:
name = line
outputPos[out.name] = None
Expand All @@ -183,7 +183,7 @@ def openModel(self, filename):
self.addOutput(output)
else:
algOutputs[out.name] = None
self.outputPos.append(outputPos)
self.outputPos.append(outputPos)
self.algOutputs.append(algOutputs)
self.algParameters.append(algParams)
self.dependencies.append(dependencies)
Expand Down Expand Up @@ -217,9 +217,9 @@ def addAlgorithm(self, alg, parametersMap, valuesMap, outputsMap, dependencies):
pos = {}
i = 0
from sextante.modeler.ModelerGraphicItem import ModelerGraphicItem
for out in outputsMap:
for out in outputsMap:
pos[out] = algPos + QtCore.QPointF(ModelerGraphicItem.BOX_WIDTH, i * ModelerGraphicItem.BOX_HEIGHT)
i+=1
i+=1
self.outputPos.append(pos)

def updateAlgorithm(self, algIndex, parametersMap, valuesMap, outputsMap, dependencies):
Expand All @@ -229,13 +229,13 @@ def updateAlgorithm(self, algIndex, parametersMap, valuesMap, outputsMap, depend
for value in valuesMap.keys():
self.paramValues[value] = valuesMap[value]
self.updateModelerView()
algPos = self.algPos[algIndex]
algPos = self.algPos[algIndex]
pos = {}
i = 0
from sextante.modeler.ModelerGraphicItem import ModelerGraphicItem
for out in outputsMap:
pos[out] = algPos + QtCore.QPointF(ModelerGraphicItem.BOX_WIDTH, i * ModelerGraphicItem.BOX_HEIGHT)
i+=1
i+=1
self.outputPos[algIndex] = pos


Expand All @@ -252,7 +252,7 @@ def removeAlgorithm(self, index):
del self.algParameters[index]
del self.algOutputs[index]
del self.algPos[index]
del self.outputPos[index]
del self.outputPos[index]

i = -1
for paramValues in self.algParameters:
Expand Down Expand Up @@ -423,14 +423,14 @@ def serialize(self):
s+=value.serialize() + "\n"
else:
s+=str(None) + "\n"
for out in alg.outputs:
for out in alg.outputs:
value = self.algOutputs[i][out.name]
s+=unicode(value)
if value is not None:
pt = self.outputPos[i][out.name]
s += "|" + str(pt.x()) + "," + str(pt.y())
s += "\n"

return s


Expand Down
26 changes: 13 additions & 13 deletions python/plugins/sextante/modeler/ModelerArrowItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def __init__(self, startItem, outputIndex, endItem, paramIndex ,parent=None, sce
self.setPen(QtGui.QPen(self.myColor, 1, QtCore.Qt.SolidLine,
QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin))
self.setZValue(0)


def startItem(self):
return self.myStartItem

Expand All @@ -78,28 +78,28 @@ def paint(self, painter, option, widget=None):
controlPoints = []
endPt = self.endItem().getLinkPointForParameter(self.paramIndex)
startPt = self.startItem().getLinkPointForOutput(self.outputIndex)
if isinstance(self.startItem().element, GeoAlgorithm):
if self.startItem().element.outputs:
controlPoints.append(startItem.pos() + startPt)
controlPoints.append(startItem.pos() + startPt + QtCore.QPointF(ModelerGraphicItem.BOX_WIDTH /2,0))
if isinstance(self.startItem().element, GeoAlgorithm):
if self.startItem().element.outputs:
controlPoints.append(startItem.pos() + startPt)
controlPoints.append(startItem.pos() + startPt + QtCore.QPointF(ModelerGraphicItem.BOX_WIDTH /2,0))
controlPoints.append(endItem.pos() + endPt - QtCore.QPointF(ModelerGraphicItem.BOX_WIDTH /2, 0))
controlPoints.append(endItem.pos() + endPt)
controlPoints.append(endItem.pos() + endPt)
pt = QtCore.QPointF(startItem.pos() + startPt + QtCore.QPointF(-3, -3))
painter.drawEllipse(pt.x(), pt.y(), 6, 6)
pt = QtCore.QPointF(endItem.pos() + endPt + QtCore.QPointF(-3, -3))
painter.drawEllipse(pt.x(), pt.y(), 6, 6)
painter.drawEllipse(pt.x(), pt.y(), 6, 6)
else: # case where there is a dependency on an algorithm not on an output
controlPoints.append(startItem.pos() + startPt)
controlPoints.append(startItem.pos() + startPt)
controlPoints.append(startItem.pos() + startPt + QtCore.QPointF(ModelerGraphicItem.BOX_WIDTH /2,0))
controlPoints.append(endItem.pos() + endPt - QtCore.QPointF(ModelerGraphicItem.BOX_WIDTH /2, 0))
controlPoints.append(endItem.pos() + endPt)
else:
controlPoints.append(endItem.pos() + endPt)
else:
controlPoints.append(startItem.pos())
controlPoints.append(startItem.pos() + QtCore.QPointF(ModelerGraphicItem.BOX_WIDTH /2,0))
controlPoints.append(endItem.pos() + endPt - QtCore.QPointF(ModelerGraphicItem.BOX_WIDTH /2, 0))
controlPoints.append(endItem.pos() + endPt)
controlPoints.append(endItem.pos() + endPt)
pt = QtCore.QPointF(endItem.pos() + endPt + QtCore.QPointF(-3, -3))
painter.drawEllipse(pt.x(), pt.y(), 6, 6)
painter.drawEllipse(pt.x(), pt.y(), 6, 6)

path = QtGui.QPainterPath()
path.moveTo(controlPoints[0])
Expand Down

0 comments on commit 7ac1baf

Please sign in to comment.