Skip to content
Browse files
[processing] added some in-code docs and comments
  • Loading branch information
volaya committed Sep 14, 2013
1 parent 2e3dfba commit a7dfcaa6af5b11ab24a72a11e527bc6de506a0f5
@@ -80,7 +80,8 @@ def processAlgorithm(self, progress):
inputFilename = self.getParameterValue(self.INPUT_LAYER)

#The output. It will get the value of the destinatation file entered by the user.
#If the user select "Save to temporary file", when we arrive here it will already have an asigned value, which will be
#If the user select "Save to temporary file", when we arrive here it will already have an asigned value,
#which will be a temporary file using the first supported file format of the corresponding algorithm provider
output = self.getOutputFromName(self.OUTPUT_LAYER)

#input layers values are always a string with its location.
@@ -93,6 +94,9 @@ def processAlgorithm(self, progress):
#First we create the output layer.
#To do so, we call the getVectorWriter method in the Output object.
#That will give us a VectorWriter, that we can later use to add features.
#The destination file has its format selected based on the file extension.
#If the selected format is not supported, the first available format from
#the provider is used, and the corresponding file extension appended
provider = vectorLayer.dataProvider()
writer = output.getVectorWriter( provider.fields(),
@@ -52,6 +52,7 @@ def __init__(self):


@@ -2,7 +2,7 @@

Date : August 2012
Copyright : (C) 2012 by Victor Olaya
@@ -101,6 +101,7 @@ def loadList(layers):

def load(fileName, name = None, crs = None, style = None):
'''Loads a layer/table into the current project, given its file'''
if fileName == None:
prjSetting = None
@@ -156,6 +157,10 @@ def getObject(uriorname):
return ret

def getObjectFromUri(uri, forceLoad = True):
'''returns an object (layer/table) given a file location.
if forceLoad is true, it tries to load it if it is not currently open
Otherwise, it will return the object only if it is loaded in QGIS'''

if uri is None:
return None
layers = getRasterLayers()
@@ -236,8 +236,8 @@ def getUniqueValues(layer, fieldIndex):
def getUniqueValuesCount(layer, fieldIndex):
return len(getUniqueValues(layer, fieldIndex))

# From two input field maps, create single field map
def combineVectorFields(layerA, layerB):
'''Create single field map from two input field maps'''
fields = []
fieldsA = layerA.dataProvider().fields()

0 comments on commit a7dfcaa

Please sign in to comment.