6 changes: 3 additions & 3 deletions python/plugins/processing/algs/FieldsCalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from qgis.core import *

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector

from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterString import ParameterString
Expand Down Expand Up @@ -70,7 +70,7 @@ def processAlgorithm(self, progress):
formula = self.getParameterValue(self.FORMULA)
output = self.getOutputFromName(self.OUTPUT_LAYER)

layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT_LAYER))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT_LAYER))
provider = layer.dataProvider()
fields = provider.fields()
fields.append(QgsField(fieldName, self.TYPES[fieldType], "", fieldLength, fieldPrecision))
Expand All @@ -80,7 +80,7 @@ def processAlgorithm(self, progress):
inGeom = QgsGeometry()
nFeat = provider.featureCount()
nElement = 0
features = QGisLayers.features(layer)
features = vector.features(layer)

fieldnames = [field.name() for field in provider.fields()]
fieldnames.sort(key=len, reverse=False)
Expand Down
10 changes: 5 additions & 5 deletions python/plugins/processing/algs/JoinAttributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from qgis.core import *
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector


class JoinAttributes(GeoAlgorithm):
Expand Down Expand Up @@ -58,11 +58,11 @@ def processAlgorithm(self, progress):
field2 = self.getParameterValue(self.TABLE_FIELD_2)

# Layer 1
layer = QGisLayers.getObjectFromUri(input)
layer = dataobjects.getObjectFromUri(input)
provider = layer.dataProvider()
joinField1Index = layer.fieldNameIndex(field)
# Layer 2
layer2 = QGisLayers.getObjectFromUri(input2)
layer2 = dataobjects.getObjectFromUri(input2)
provider2 = layer2.dataProvider()

joinField2Index = layer2.fieldNameIndex(field2)
Expand All @@ -79,12 +79,12 @@ def processAlgorithm(self, progress):
outFeat = QgsFeature()

# Create output vector layer with additional attribute
features = QGisLayers.features(layer);
features = vector.features(layer);
for inFeat in features:
inGeom = inFeat.geometry()
attrs = inFeat.attributes()
joinValue1 = attrs[joinField1Index]
features2 = QGisLayers.features(layer2);
features2 = vector.features(layer2);
for inFeat2 in features2:
## Maybe it should cache this entries...
attrs2 = inFeat2.attributes()
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/MeanAndStdDevPlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.outputs.OutputHTML import OutputHTML
from processing.tools import *
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects

class MeanAndStdDevPlot(GeoAlgorithm):

Expand All @@ -46,7 +46,7 @@ class MeanAndStdDevPlot(GeoAlgorithm):

def processAlgorithm(self, progress):
uri = self.getParameterValue(self.INPUT)
layer = QGisLayers.getObjectFromUri(uri)
layer = dataobjects.getObjectFromUri(uri)
namefieldname = self.getParameterValue(self.NAME_FIELD)
meanfieldname = self.getParameterValue(self.MEAN_FIELD)
stddevfieldname = self.getParameterValue(self.STDDEV_FIELD)
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/algs/PointsLayerFromTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.outputs.OutputVector import OutputVector

class PointsLayerFromTable(GeoAlgorithm):
Expand All @@ -43,7 +43,7 @@ class PointsLayerFromTable(GeoAlgorithm):

def processAlgorithm(self, progress):
source = self.getParameterValue(self.INPUT)
vlayer = QGisLayers.getObjectFromUri(source)
vlayer = dataobjects.getObjectFromUri(source)
output = self.getOutputFromName(self.OUTPUT)
vprovider = vlayer.dataProvider()
fields = vprovider.fields()
Expand All @@ -57,7 +57,7 @@ def processAlgorithm(self, progress):

outFeat = QgsFeature()
nElement = 0
features = QGisLayers.features(vlayer)
features = vector.features(vlayer)
nFeat = len(features)
for feature in features:
nElement += 1
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/PolarPlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.outputs.OutputHTML import OutputHTML
from processing.tools import *
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects

class PolarPlot(GeoAlgorithm):

Expand All @@ -46,7 +46,7 @@ class PolarPlot(GeoAlgorithm):

def processAlgorithm(self, progress):
uri = self.getParameterValue(self.INPUT)
layer = QGisLayers.getObjectFromUri(uri)
layer = dataobjects.getObjectFromUri(uri)
namefieldname = self.getParameterValue(self.NAME_FIELD)
valuefieldname = self.getParameterValue(self.VALUE_FIELD)
output = self.getOutputValue(self.OUTPUT)
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/algs/Polygonize.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from qgis.core import QgsFeature, QgsField, QgsFields, QgsGeometry, QGis
from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.outputs.OutputVector import OutputVector
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException

Expand All @@ -44,7 +44,7 @@ def processAlgorithm(self, progress):
from shapely.geometry import Point,MultiLineString
except ImportError:
raise GeoAlgorithmExecutionException('Polygonize algorithm requires shapely module!')
vlayer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT))
vlayer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))
output = self.getOutputFromName(self.OUTPUT)
vprovider = vlayer.dataProvider()
if self.getParameterValue(self.FIELDS):
Expand All @@ -56,7 +56,7 @@ def processAlgorithm(self, progress):
fields.append(QgsField("area",QVariant.Double,"double",16,2))
fields.append(QgsField("perimeter",QVariant.Double,"double",16,2))
allLinesList = []
features = QGisLayers.features(vlayer)
features = vector.features(vlayer)
current = 0
total = 40.0 / float(len(features))
for inFeat in features:
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/RasterLayerHistogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from qgis.core import *
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.outputs.OutputHTML import OutputHTML
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects
from processing.parameters.ParameterNumber import ParameterNumber
from processing.parameters.ParameterRaster import ParameterRaster
from processing.tools import raster
Expand All @@ -45,7 +45,7 @@ class RasterLayerHistogram(GeoAlgorithm):

def processAlgorithm(self, progress):
uri = self.getParameterValue(self.INPUT)
layer = QGisLayers.getObjectFromUri(uri)
layer = dataobjects.getObjectFromUri(uri)
outputplot = self.getOutputValue(self.PLOT)
outputtable = self.getOutputFromName(self.TABLE)
values = raster.scanraster(layer, progress)
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/RasterLayerStatistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from PyQt4.QtCore import *
from qgis.core import *
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects
from processing.parameters.ParameterRaster import ParameterRaster
from processing.tools import raster
from processing.outputs.OutputNumber import OutputNumber
Expand All @@ -50,7 +50,7 @@ class RasterLayerStatistics(GeoAlgorithm):
def processAlgorithm(self, progress):
outputFile = self.getOutputValue(self.OUTPUT_HTML_FILE)
uri = self.getParameterValue(self.INPUT)
layer = QGisLayers.getObjectFromUri(uri)
layer = dataobjects.getObjectFromUri(uri)
values = raster.scanraster(layer, progress)

n = 0
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/processing/algs/SaveSelectedFeatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from qgis.core import *
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector


class SaveSelectedFeatures(GeoAlgorithm):
Expand Down Expand Up @@ -76,8 +76,8 @@ def processAlgorithm(self, progress):

#input layers values are always a string with its location.
#That string can be converted into a QGIS object (a QgsVectorLayer in this case))
#using the Processing.getObject() method
vectorLayer = QGisLayers.getObjectFromUri(inputFilename)
#using the processing.getObject() method
vectorLayer = dataobjects.getObjectFromUri(inputFilename)

#And now we can process

Expand All @@ -88,7 +88,7 @@ def processAlgorithm(self, progress):
writer = output.getVectorWriter( provider.fields(), provider.geometryType(), vectorLayer.crs() )

#Now we take the selected features and add them to the output layer
features = QGisLayers.features(vectorLayer)
features = vector.features(vectorLayer)
total = len(features)
i = 0
for feat in features:
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/algs/StatisticsByCategories.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from qgis.core import *
from processing.outputs.OutputTable import OutputTable
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterTableField import ParameterTableField

Expand All @@ -52,15 +52,15 @@ def defineCharacteristics(self):
self.addOutput(OutputTable(self.OUTPUT, "Statistics"))

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT_LAYER))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT_LAYER))
valuesFieldName = self.getParameterValue(self.VALUES_FIELD_NAME)
categoriesFieldName = self.getParameterValue(self.CATEGORIES_FIELD_NAME)

output = self.getOutputFromName(self.OUTPUT)
valuesField = layer.fieldNameIndex(valuesFieldName)
categoriesField = layer.fieldNameIndex(categoriesFieldName)

features = QGisLayers.features(layer)
features = vector.features(layer)
nFeats = len(features)
values = {}
nFeat = 0
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/VectorLayerHistogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.outputs.OutputHTML import OutputHTML
from processing.tools import *
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects
from processing.parameters.ParameterNumber import ParameterNumber

class VectorLayerHistogram(GeoAlgorithm):
Expand All @@ -45,7 +45,7 @@ class VectorLayerHistogram(GeoAlgorithm):

def processAlgorithm(self, progress):
uri = self.getParameterValue(self.INPUT)
layer = QGisLayers.getObjectFromUri(uri)
layer = dataobjects.getObjectFromUri(uri)
fieldname = self.getParameterValue(self.FIELD)
output = self.getOutputValue(self.OUTPUT)
values = vector.getAttributeValues(layer, fieldname)
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/VectorLayerScatterplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.outputs.OutputHTML import OutputHTML
from processing.tools import *
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects

class VectorLayerScatterplot(GeoAlgorithm):

Expand All @@ -45,7 +45,7 @@ class VectorLayerScatterplot(GeoAlgorithm):

def processAlgorithm(self, progress):
uri = self.getParameterValue(self.INPUT)
layer = QGisLayers.getObjectFromUri(uri)
layer = dataobjects.getObjectFromUri(uri)
xfieldname = self.getParameterValue(self.YFIELD)
yfieldname = self.getParameterValue(self.XFIELD)
output = self.getOutputValue(self.OUTPUT)
Expand Down
12 changes: 3 additions & 9 deletions python/plugins/processing/algs/ftools/BasicStatisticsNumbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@
__revision__ = '$Format:%H$'

import math

from PyQt4.QtCore import *
from qgis.core import *
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterTableField import ParameterTableField
from processing.outputs.OutputHTML import OutputHTML
Expand All @@ -52,11 +51,6 @@ class BasicStatisticsNumbers(GeoAlgorithm):
MEDIAN = "MEDIAN"
UNIQUE = "UNIQUE"

#===========================================================================
# def getIcon(self):
# return QtGui.QIcon(os.path.dirname(__file__) + "/icons/basic_statistics.png")
#===========================================================================

def defineCharacteristics(self):
self.name = "Basic statistics for numeric fields"
self.group = "Vector table tools"
Expand All @@ -79,7 +73,7 @@ def defineCharacteristics(self):
self.addOutput(OutputNumber(self.STD_DEV, "Standard deviation"))

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT_LAYER))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT_LAYER))
fieldName = self.getParameterValue(self.FIELD_NAME)

outputFile = self.getOutputValue(self.OUTPUT_HTML_FILE)
Expand All @@ -97,7 +91,7 @@ def processAlgorithm(self, progress):
isFirst = True
values = []

features = QGisLayers.features(layer)
features = vector.features(layer)
count = len(features)
total = 100.0 / float(count)
current = 0
Expand Down
12 changes: 3 additions & 9 deletions python/plugins/processing/algs/ftools/BasicStatisticsStrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@
__revision__ = '$Format:%H$'

import codecs

from PyQt4.QtCore import *
from qgis.core import *
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterTableField import ParameterTableField
from processing.outputs.OutputHTML import OutputHTML
Expand All @@ -49,11 +48,6 @@ class BasicStatisticsStrings(GeoAlgorithm):
FILLED = "FILLED"
UNIQUE = "UNIQUE"

#===========================================================================
# def getIcon(self):
# return QtGui.QIcon(os.path.dirname(__file__) + "/icons/basic_statistics.png")
#===========================================================================

def defineCharacteristics(self):
self.name = "Basic statistics for text fields"
self.group = "Vector table tools"
Expand All @@ -72,7 +66,7 @@ def defineCharacteristics(self):
self.addOutput(OutputNumber(self.UNIQUE, "Number of unique values"))

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT_LAYER))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT_LAYER))
fieldName = self.getParameterValue(self.FIELD_NAME)

outputFile = self.getOutputValue(self.OUTPUT_HTML_FILE)
Expand All @@ -89,7 +83,7 @@ def processAlgorithm(self, progress):
isFirst = True
values = []

features = QGisLayers.features(layer)
features = vector.features(layer)
count = len(features)
total = 100.0 / float(count)
current = 0
Expand Down
67 changes: 20 additions & 47 deletions python/plugins/processing/algs/ftools/Buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
Expand All @@ -25,15 +26,11 @@


from PyQt4.QtCore import *

from qgis.core import *

from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.core.ProcessingLog import ProcessingLog

def buffering(progress, writer, distance, field, useField, layer, dissolve, segments):
GEOS_EXCEPT = True
FEATURE_EXCEPT = True

if useField:
field = layer.fieldNameIndex(field)
Expand All @@ -44,7 +41,7 @@ def buffering(progress, writer, distance, field, useField, layer, dissolve, segm
outGeom = QgsGeometry()

current = 0
features = QGisLayers.features(layer)
features = vector.features(layer)
total = 100.0 / float(len(features))

# with dissolve
Expand All @@ -57,30 +54,21 @@ def buffering(progress, writer, distance, field, useField, layer, dissolve, segm
else:
value = distance

inGeom = QgsGeometry(inFeat.geometry())
try:
outGeom = inGeom.buffer(float(value), segments)
if first:
tempGeom = QgsGeometry(outGeom)
first = False
else:
try:
tempGeom = tempGeom.combine(outGeom)
except:
GEOS_EXCEPT = False
continue
except:
GEOS_EXCEPT = False
continue
inGeom = QgsGeometry(inFeat.geometry())
outGeom = inGeom.buffer(float(value), segments)
if first:
tempGeom = QgsGeometry(outGeom)
first = False
else:
tempGeom = tempGeom.combine(outGeom)

current += 1
progress.setPercentage(int(current * total))
try:
outFeat.setGeometry(tempGeom)
outFeat.setAttributes(attrs)
writer.addFeature(outFeat)
except:
FEATURE_EXCEPT = False

outFeat.setGeometry(tempGeom)
outFeat.setAttributes(attrs)
writer.addFeature(outFeat)

# without dissolve
else:
for inFeat in features:
Expand All @@ -89,27 +77,12 @@ def buffering(progress, writer, distance, field, useField, layer, dissolve, segm
value = attrs[field]
else:
value = distance

inGeom = QgsGeometry(inFeat.geometry())
try:
outGeom = inGeom.buffer(float(value), segments)
try:
outFeat.setGeometry(outGeom)
outFeat.setAttributes(attrs)
writer.addFeature(outFeat)
except:
FEATURE_EXCEPT = False
continue
except:
GEOS_EXCEPT = False
continue

inGeom = QgsGeometry(inFeat.geometry())
outGeom = inGeom.buffer(float(value), segments)
outFeat.setGeometry(outGeom)
outFeat.setAttributes(attrs)
writer.addFeature(outFeat)
current += 1
progress.setPercentage(int(current * total))

del writer

if not GEOS_EXCEPT:
ProcessingLog.addToLog(ProcessingLog.LOG_WARNING, "Geometry exception while computing buffer")
if not FEATURE_EXCEPT:
ProcessingLog.addToLog(ProcessingLog.LOG_WARNING, "Feature exception while computing buffer")
14 changes: 3 additions & 11 deletions python/plugins/processing/algs/ftools/Centroids.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,10 @@
__revision__ = '$Format:%H$'

from PyQt4.QtCore import *

from qgis.core import *

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException

from processing.parameters.ParameterVector import ParameterVector
from processing.outputs.OutputVector import OutputVector

Expand All @@ -39,11 +36,6 @@ class Centroids(GeoAlgorithm):
INPUT_LAYER = "INPUT_LAYER"
OUTPUT_LAYER = "OUTPUT_LAYER"

#===========================================================================
# def getIcon(self):
# return QtGui.QIcon(os.path.dirname(__file__) + "/icons/centroids.png")
#===========================================================================

def defineCharacteristics(self):
self.name = "Polygon centroids"
self.group = "Vector geometry tools"
Expand All @@ -53,14 +45,14 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT_LAYER, "Output layer"))

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT_LAYER))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT_LAYER))

writer = self.getOutputFromName(self.OUTPUT_LAYER).getVectorWriter(layer.pendingFields().toList(),
QGis.WKBPoint, layer.crs())

outFeat = QgsFeature()

features = QGisLayers.features(layer)
features = vector.features(layer)
total = 100.0 / float(len(features))
current = 0

Expand Down
59 changes: 17 additions & 42 deletions python/plugins/processing/algs/ftools/Clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from PyQt4.QtCore import *
from qgis.core import *
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.core.ProcessingLog import ProcessingLog
from processing.parameters.ParameterVector import ParameterVector
from processing.outputs.OutputVector import OutputVector
Expand All @@ -38,11 +38,6 @@ class Clip(GeoAlgorithm):
OVERLAY = "OVERLAY"
OUTPUT = "OUTPUT"

#===========================================================================
# def getIcon(self):
# return QtGui.QIcon(os.path.dirname(__file__) + "/icons/clip.png")
#===========================================================================

def defineCharacteristics(self):
self.name = "Clip"
self.group = "Vector overlay tools"
Expand All @@ -51,11 +46,8 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(Clip.OUTPUT, "Clipped"))

def processAlgorithm(self, progress):
layerA = QGisLayers.getObjectFromUri(self.getParameterValue(Clip.INPUT))
layerB = QGisLayers.getObjectFromUri(self.getParameterValue(Clip.OVERLAY))

GEOS_EXCEPT = True
FEATURE_EXCEPT = True
layerA = dataobjects.getObjectFromUri(self.getParameterValue(Clip.INPUT))
layerB = dataobjects.getObjectFromUri(self.getParameterValue(Clip.OVERLAY))

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(layerA.pendingFields(),
layerA.dataProvider().geometryType(), layerA.dataProvider().crs())
Expand All @@ -66,7 +58,7 @@ def processAlgorithm(self, progress):

index = utils.spatialindex(layerB)

selectionA = QGisLayers.features(layerA)
selectionA = vector.features(layerA)

current = 0
total = 100.0 / float(len(selectionA))
Expand All @@ -88,38 +80,21 @@ def processAlgorithm(self, progress):
outFeat.setGeometry(QgsGeometry(tmpGeom))
first = False
else:
try:
cur_geom = QgsGeometry(outFeat.geometry())
new_geom = QgsGeometry(cur_geom.combine(tmpGeom))
outFeat.setGeometry(QgsGeometry(new_geom))
except:
GEOS_EXCEPT = False
break
if found:
try:
cur_geom = QgsGeometry(outFeat.geometry())
new_geom = QgsGeometry(geom.intersection(cur_geom))
if new_geom.wkbType() == QGis.WKBNoGeometry :
int_com = QgsGeometry(geom.combine(cur_geom))
int_sym = QgsGeometry(geom.symDifference(cur_geom))
new_geom = QgsGeometry(int_com.difference(int_sym))
try:
outFeat.setGeometry(new_geom)
outFeat.setAttributes(attrs)
writer.addFeature(outFeat)
except:
FEATURE_EXCEPT = False
continue
except:
GEOS_EXCEPT = False
continue
cur_geom = QgsGeometry(outFeat.geometry())
new_geom = QgsGeometry(cur_geom.combine(tmpGeom))
outFeat.setGeometry(QgsGeometry(new_geom))
if found:
cur_geom = QgsGeometry(outFeat.geometry())
new_geom = QgsGeometry(geom.intersection(cur_geom))
if new_geom.wkbType() == QGis.WKBNoGeometry :
int_com = QgsGeometry(geom.combine(cur_geom))
int_sym = QgsGeometry(geom.symDifference(cur_geom))
new_geom = QgsGeometry(int_com.difference(int_sym))
outFeat.setGeometry(new_geom)
outFeat.setAttributes(attrs)
writer.addFeature(outFeat)

current += 1
progress.setPercentage(int(current * total))

del writer

if not GEOS_EXCEPT:
ProcessingLog.addToLog(ProcessingLog.LOG_WARNING, "Geometry exception while computing clip")
if not FEATURE_EXCEPT:
ProcessingLog.addToLog(ProcessingLog.LOG_WARNING, "Feature exception while computing clip")
16 changes: 5 additions & 11 deletions python/plugins/processing/algs/ftools/ConvexHull.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from PyQt4.QtGui import *
from qgis.core import *
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterTableField import ParameterTableField
from processing.parameters.ParameterSelection import ParameterSelection
Expand All @@ -42,13 +42,7 @@ class ConvexHull(GeoAlgorithm):
FIELD = "FIELD"
METHOD = "METHOD"
METHODS = ["Create single minimum convex hull",
"Create convex hulls based on field"
]

#===========================================================================
# def getIcon(self):
# return QtGui.QIcon(os.path.dirname(__file__) + "/icons/convex_hull.png")
#===========================================================================
"Create convex hulls based on field"]

def defineCharacteristics(self):
self.name = "Convex hull"
Expand All @@ -61,7 +55,7 @@ def defineCharacteristics(self):
def processAlgorithm(self, progress):
useField = (self.getParameterValue(ConvexHull.METHOD) == 1)
fieldName = self.getParameterValue(ConvexHull.FIELD)
layer = QGisLayers.getObjectFromUri(self.getParameterValue(ConvexHull.INPUT))
layer = dataobjects.getObjectFromUri(self.getParameterValue(ConvexHull.INPUT))

f = QgsField("value")
f.setType(QVariant.String)
Expand Down Expand Up @@ -103,7 +97,7 @@ def processAlgorithm(self, progress):
for i in unique:
hull = []
first = True
features = QGisLayers.features(layer)
features = vector.features(layer)
for f in features:
idVar = f[fieldName]
if unicode(idVar).strip() == unicode(i).strip:
Expand All @@ -130,7 +124,7 @@ def processAlgorithm(self, progress):
else:
hull = []
total = 100.0 / float(layer.featureCount())
features = QGisLayers.features(layer)
features = vector.features(layer)
for f in features:
inGeom = QgsGeometry(f.geometry())
points = utils.extractPoints(inGeom)
Expand Down
18 changes: 3 additions & 15 deletions python/plugins/processing/algs/ftools/Delaunay.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,20 @@
__revision__ = '$Format:%H$'

from sets import Set

from PyQt4.QtCore import *

from qgis.core import *

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from processing.core.QGisLayers import QGisLayers

from processing.tools import dataobjects, vector
from processing.parameters.ParameterVector import ParameterVector

from processing.outputs.OutputVector import OutputVector

from processing.algs.ftools import voronoi


class Delaunay(GeoAlgorithm):

INPUT = "INPUT"
OUTPUT = "OUTPUT"

#===========================================================================
# def getIcon(self):
# return QtGui.QIcon(os.path.dirname(__file__) + "/icons/delaunay.png")
#===========================================================================

def defineCharacteristics(self):
self.name = "Delaunay triangulation"
self.group = "Vector geometry tools"
Expand All @@ -59,7 +47,7 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, "Delaunay triangulation"))

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))


fields = [QgsField("POINTA", QVariant.Double, "", 24, 15),
Expand All @@ -74,7 +62,7 @@ def processAlgorithm(self, progress):
ptDict = {}
ptNdx = -1
c = voronoi.Context()
features = QGisLayers.features(layer)
features = vector.features(layer)
for inFeat in features:
geom = QgsGeometry(inFeat.geometry())
point = geom.asPoint()
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/algs/ftools/DensifyGeometries.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from qgis.core import *

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector

from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterNumber import ParameterNumber
Expand All @@ -51,15 +51,15 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, "Densified layer"))

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))
vertices = self.getParameterValue(self.VERTICES)

isPolygon = layer.geometryType() == QGis.Polygon

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(layer.pendingFields().toList(),
layer.wkbType(), layer.crs())

features = QGisLayers.features(layer)
features = vector.features(layer)
total = 100.0 / float(len(features))
current = 0
for f in features:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from qgis.core import *

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterNumber import ParameterNumber
from processing.outputs.OutputVector import OutputVector
Expand All @@ -52,15 +52,15 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, "Densified layer"))

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))
interval = self.getParameterValue(self.INTERVAL)

isPolygon = layer.geometryType() == QGis.Polygon

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(layer.pendingFields().toList(),
layer.wkbType(), layer.crs())

features = QGisLayers.features(layer)
features = vector.features(layer)
total = 100.0 / float(len(features))
current = 0
for f in features:
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/processing/algs/ftools/Difference.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

from PyQt4.QtCore import *
from qgis.core import *
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.core.ProcessingLog import ProcessingLog
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.parameters.ParameterVector import ParameterVector
Expand All @@ -50,8 +50,8 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(Difference.OUTPUT, "Difference"))

def processAlgorithm(self, progress):
layerA = QGisLayers.getObjectFromUri(self.getParameterValue(Difference.INPUT))
layerB = QGisLayers.getObjectFromUri(self.getParameterValue(Difference.OVERLAY))
layerA = dataobjects.getObjectFromUri(self.getParameterValue(Difference.INPUT))
layerB = dataobjects.getObjectFromUri(self.getParameterValue(Difference.OVERLAY))

GEOS_EXCEPT = True

Expand All @@ -66,7 +66,7 @@ def processAlgorithm(self, progress):

index = utils.spatialindex(layerB)

selectionA = QGisLayers.features(layerA)
selectionA = vector.features(layerA)

current = 0
total = 100.0 / float(len(selectionA))
Expand Down
10 changes: 5 additions & 5 deletions python/plugins/processing/algs/ftools/Dissolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
from processing.tools import vector as utils
from processing.tools import vector as utils, vector
from processing.parameters.ParameterVector import ParameterVector
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects
from processing.outputs.OutputVector import OutputVector
from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.parameters.ParameterTableField import ParameterTableField
Expand All @@ -50,7 +50,7 @@ class Dissolve(GeoAlgorithm):
def processAlgorithm(self, progress):
useField = not self.getParameterValue(Dissolve.DISSOLVE_ALL)
fieldname = self.getParameterValue(Dissolve.FIELD)
vlayerA = QGisLayers.getObjectFromUri(self.getParameterValue(Dissolve.INPUT))
vlayerA = dataobjects.getObjectFromUri(self.getParameterValue(Dissolve.INPUT))
field = vlayerA.fieldNameIndex(fieldname)
vproviderA = vlayerA.dataProvider()
fields = vproviderA.fields()
Expand All @@ -60,7 +60,7 @@ def processAlgorithm(self, progress):
nFeat = vproviderA.featureCount()
if not useField:
first = True
features = QGisLayers.features(vlayerA)
features = vector.features(vlayerA)
for inFeat in features:
nElement += 1
progress.setPercentage(int(nElement/nFeat * 100))
Expand All @@ -85,7 +85,7 @@ def processAlgorithm(self, progress):
for item in unique:
first = True
add = True
features = QGisLayers.features(vlayerA)
features = vector.features(vlayerA)
for inFeat in features:
nElement += 1
progress.setPercentage(int(nElement/nFeat * 100))
Expand Down
12 changes: 7 additions & 5 deletions python/plugins/processing/algs/ftools/ExportGeometryInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
***************************************************************************
"""


__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
Expand All @@ -25,8 +26,9 @@

from PyQt4.QtCore import *
from qgis.core import *
from processing import interface
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterSelection import ParameterSelection
from processing.outputs.OutputVector import OutputVector
Expand Down Expand Up @@ -58,7 +60,7 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, "Output layer"))

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))
method = self.getParameterValue(self.METHOD)

geometryType = layer.geometryType()
Expand Down Expand Up @@ -91,10 +93,10 @@ def processAlgorithm(self, progress):
# 1 - project CRS
# 2 - ellipsoidal
if method == 2:
ellips = QgsProject.instance().readEntry("Measure", "/Ellipsoid", GEO_NONE)[0]
ellips = QgsProject.instance().readEntry("Measure", "/Ellipsoid", "NONE")[0]
crs = layer.crs().srsid()
elif method == 1:
mapCRS = QGisLayers.iface.mapCanvas().mapRenderer().destinationCrs()
mapCRS = interface.iface.mapCanvas().mapRenderer().destinationCrs()
layCRS = layer.crs()
coordTransform = QgsCoordinateTransform(layCRS, mapCRS)

Expand All @@ -105,7 +107,7 @@ def processAlgorithm(self, progress):
outFeat.setFields(fields)

current = 0
features = QGisLayers.features(layer)
features = vector.features(layer)
total = 100.0 / float(len(features))
for f in features:
inGeom = f.geometry()
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/algs/ftools/ExtentFromLayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from qgis.core import *

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector

from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterBoolean import ParameterBoolean
Expand Down Expand Up @@ -57,7 +57,7 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, "Output layer"))

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT_LAYER))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT_LAYER))
byFeature = self.getParameterValue(self.BY_FEATURE)

fields = [ QgsField("MINX", QVariant.Double),
Expand Down Expand Up @@ -110,7 +110,7 @@ def layerExtent(self, layer, writer, progress):

def featureExtent(self, layer, writer, progress):
current = 0
features = QGisLayers.features(layer)
features = vector.features(layer)
total = 100.0 / float(len(features))
feat = QgsFeature()
for f in features:
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/algs/ftools/ExtractNodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from PyQt4.QtCore import *
from qgis.core import *
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.parameters.ParameterVector import ParameterVector
from processing.outputs.OutputVector import OutputVector
from processing.tools import vector as utils
Expand All @@ -50,7 +50,7 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, "Output layer"))

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(layer.pendingFields().toList(),
QGis.WKBPoint, layer.crs())
Expand All @@ -60,7 +60,7 @@ def processAlgorithm(self, progress):
outGeom = QgsGeometry()

current = 0
features = QGisLayers.features(layer)
features = vector.features(layer)
total = 100.0 / float(len(features))
for f in features:
inGeom = f.geometry()
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/ftools/FixedDistanceBuffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from qgis.core import *

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects

from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterBoolean import ParameterBoolean
Expand Down Expand Up @@ -63,7 +63,7 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, "Buffer"))

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))
distance = self.getParameterValue(self.DISTANCE)
dissolve = self.getParameterValue(self.DISSOLVE)
segments = int(self.getParameterValue(self.SEGMENTS))
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/processing/algs/ftools/Intersection.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from PyQt4.QtGui import *
from qgis.core import *
from processing.parameters.ParameterVector import ParameterVector
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.outputs.OutputVector import OutputVector
from processing.tools import vector as utils

Expand All @@ -44,8 +44,8 @@ class Intersection(GeoAlgorithm):
#===========================================================================

def processAlgorithm(self, progress):
vlayerA = QGisLayers.getObjectFromUri(self.getParameterValue(Intersection.INPUT))
vlayerB = QGisLayers.getObjectFromUri(self.getParameterValue(Intersection.INPUT2))
vlayerA = dataobjects.getObjectFromUri(self.getParameterValue(Intersection.INPUT))
vlayerB = dataobjects.getObjectFromUri(self.getParameterValue(Intersection.INPUT2))
vproviderA = vlayerA.dataProvider()

fields = utils.combineVectorFields(vlayerA, vlayerB)
Expand All @@ -55,7 +55,7 @@ def processAlgorithm(self, progress):
outFeat = QgsFeature()
index = utils.spatialindex(vlayerB)
nElement = 0
selectionA = QGisLayers.features(vlayerA)
selectionA = vector.features(vlayerA)
nFeat = len(selectionA)
for inFeatA in selectionA:
nElement += 1
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/processing/algs/ftools/LinesIntersection.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from PyQt4.QtCore import *
from qgis.core import *
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterTableField import ParameterTableField
from processing.outputs.OutputVector import OutputVector
Expand Down Expand Up @@ -58,8 +58,8 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, "Output layer"))

def processAlgorithm(self, progress):
layerA = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT_A))
layerB = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT_B))
layerA = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT_A))
layerB = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT_B))
fieldA = self.getParameterValue(self.FIELD_A)
fieldB = self.getParameterValue(self.FIELD_B)

Expand All @@ -81,7 +81,7 @@ def processAlgorithm(self, progress):
inGeom = QgsGeometry()
tmpGeom = QgsGeometry()

features = QGisLayers.features(layerA)
features = vector.features(layerA)

current = 0
total = 100.0 / float(len(features))
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/algs/ftools/LinesToPolygons.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from qgis.core import *

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.parameters.ParameterVector import ParameterVector
from processing.outputs.OutputVector import OutputVector

Expand All @@ -49,15 +49,15 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, "Output layer"))

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(layer.pendingFields().toList(),
QGis.WKBPolygon, layer.crs())

outFeat = QgsFeature()

current = 0
features = QGisLayers.features(layer)
features = vector.features(layer)
total = 100.0 / float(len(features))
for f in features:
outGeomList = []
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/algs/ftools/MeanCoords.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from PyQt4.QtCore import *
from qgis.core import *
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.parameters.ParameterTableField import ParameterTableField
from processing.parameters.ParameterVector import ParameterVector
from processing.outputs.OutputVector import OutputVector
Expand Down Expand Up @@ -56,7 +56,7 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(MeanCoords.OUTPUT, "Result"))

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.POINTS))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.POINTS))
weightField = self.getParameterValue(self.WEIGHT)
uniqueField = self.getParameterValue(self.UID)

Expand All @@ -72,7 +72,7 @@ def processAlgorithm(self, progress):
QGis.WKBPoint, layer.crs())

current = 0
features = QGisLayers.features(layer)
features = vector.features(layer)
total = 100.0 / float(len(features))

means = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector

from processing.parameters.ParameterVector import ParameterVector

Expand All @@ -53,7 +53,7 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, "Output layer"))

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))

geomType = self.multiToSingleGeom(layer.dataProvider().geometryType())

Expand All @@ -64,7 +64,7 @@ def processAlgorithm(self, progress):
inGeom = QgsGeometry()

current = 0
features = QGisLayers.features(layer)
features = vector.features(layer)
total = 100.0 / float(len(features))
for f in features:
inGeom = f.geometry()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import math
from qgis.core import *
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.parameters.ParameterVector import ParameterVector
from processing.outputs.OutputHTML import OutputHTML
from processing.outputs.OutputNumber import OutputNumber
Expand Down Expand Up @@ -64,7 +64,7 @@ def defineCharacteristics(self):
self.addOutput(OutputNumber(self.Z_SCORE, "Z-Score"))

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.POINTS))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.POINTS))
output = self.getOutputValue(self.OUTPUT)

spatialIndex = utils.spatialindex(layer)
Expand All @@ -77,7 +77,7 @@ def processAlgorithm(self, progress):
A = float(A.width() * A.height())

current = 0
features = QGisLayers.features(layer)
features = vector.features(layer)
count = len(features)
total = 100.0 / float(len(features))
for feat in features:
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/processing/algs/ftools/PointsInPolygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from PyQt4.QtCore import *
from qgis.core import *
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterString import ParameterString
from processing.outputs.OutputVector import OutputVector
Expand Down Expand Up @@ -54,8 +54,8 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, "Result"))

def processAlgorithm(self, progress):
polyLayer = QGisLayers.getObjectFromUri(self.getParameterValue(self.POLYGONS))
pointLayer = QGisLayers.getObjectFromUri(self.getParameterValue(self.POINTS))
polyLayer = dataobjects.getObjectFromUri(self.getParameterValue(self.POLYGONS))
pointLayer = dataobjects.getObjectFromUri(self.getParameterValue(self.POINTS))
fieldName = self.getParameterValue(self.FIELD)

polyProvider = polyLayer.dataProvider()
Expand All @@ -75,7 +75,7 @@ def processAlgorithm(self, progress):
current = 0
hasIntersections = False

features = QGisLayers.features(polyLayer)
features = vector.features(polyLayer)
total = 100.0 / float(len(features))
for ftPoly in features:
geom = ftPoly.geometry()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from PyQt4.QtCore import *
from qgis.core import *
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterString import ParameterString
from processing.outputs.OutputVector import OutputVector
Expand Down Expand Up @@ -56,8 +56,8 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, "Result"))

def processAlgorithm(self, progress):
polyLayer = QGisLayers.getObjectFromUri(self.getParameterValue(self.POLYGONS))
pointLayer = QGisLayers.getObjectFromUri(self.getParameterValue(self.POINTS))
polyLayer = dataobjects.getObjectFromUri(self.getParameterValue(self.POLYGONS))
pointLayer = dataobjects.getObjectFromUri(self.getParameterValue(self.POINTS))
fieldName = self.getParameterValue(self.FIELD)
classFieldName = self.getParameterValue(self.CLASSFIELD)

Expand All @@ -78,7 +78,7 @@ def processAlgorithm(self, progress):
current = 0
hasIntersections = False

features = QGisLayers.features(polyLayer)
features = vector.features(polyLayer)
total = 100.0 / float(len(features))
for ftPoly in features:
geom = ftPoly.geometry()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from PyQt4.QtCore import *
from qgis.core import *
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterString import ParameterString
from processing.outputs.OutputVector import OutputVector
Expand Down Expand Up @@ -58,8 +58,8 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, "Result"))

def processAlgorithm(self, progress):
polyLayer = QGisLayers.getObjectFromUri(self.getParameterValue(self.POLYGONS))
pointLayer = QGisLayers.getObjectFromUri(self.getParameterValue(self.POINTS))
polyLayer = dataobjects.getObjectFromUri(self.getParameterValue(self.POLYGONS))
pointLayer = dataobjects.getObjectFromUri(self.getParameterValue(self.POINTS))
fieldName = self.getParameterValue(self.FIELD)
fieldIdx = pointLayer.fieldNameIndex(self.getParameterValue(self.WEIGHT))

Expand All @@ -79,7 +79,7 @@ def processAlgorithm(self, progress):
current = 0
hasIntersections = False

features = QGisLayers.features(polyLayer)
features = vector.features(polyLayer)
total = 100.0 / float(len(features))
for ftPoly in features:
geom = ftPoly.geometry()
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/algs/ftools/PolygonsToLines.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from qgis.core import *

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector

from processing.parameters.ParameterVector import ParameterVector

Expand All @@ -54,7 +54,7 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, "Output layer"))

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(layer.pendingFields().toList(),
QGis.WKBLineString, layer.crs())
Expand All @@ -64,7 +64,7 @@ def processAlgorithm(self, progress):
outGeom = QgsGeometry()

current = 0
features = QGisLayers.features(layer)
features = vector.features(layer)
total = 100.0 / float(len(features))
for f in features:
inGeom = f.geometry()
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/ftools/RandomSelection.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects

from processing.parameters.ParameterSelection import ParameterSelection
from processing.parameters.ParameterVector import ParameterVector
Expand Down Expand Up @@ -67,7 +67,7 @@ def defineCharacteristics(self):

def processAlgorithm(self, progress):
filename = self.getParameterValue(self.INPUT)
layer = QGisLayers.getObjectFromUri(filename)
layer = dataobjects.getObjectFromUri(filename)
method = self.getParameterValue(self.METHOD)

featureCount = layer.featureCount()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from qgis.core import *
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.tools import vector as utils
from processing.parameters.ParameterSelection import ParameterSelection
from processing.parameters.ParameterVector import ParameterVector
Expand Down Expand Up @@ -69,7 +69,7 @@ def defineCharacteristics(self):
def processAlgorithm(self, progress):
filename = self.getParameterValue(self.INPUT)

layer = QGisLayers.getObjectFromUri(filename)
layer = dataobjects.getObjectFromUri(filename)
field = self.getParameterValue(self.FIELD)
method = self.getParameterValue(self.METHOD)

Expand All @@ -94,7 +94,7 @@ def processAlgorithm(self, progress):
current = 0
total = 100.0 / float(featureCount * len(unique))

features = QGisLayers.features(layer)
features = vector.features(layer)

if not len(unique) == featureCount:
for i in unique:
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/algs/ftools/ReprojectLayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from PyQt4.QtCore import *
from qgis.core import *
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterCrs import ParameterCrs
from processing.outputs.OutputVector import OutputVector
Expand All @@ -52,7 +52,7 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, "Reprojected layer"))

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))
crsId = self.getParameterValue(self.TARGET_CRS)
targetCrs = QgsCoordinateReferenceSystem(crsId)

Expand All @@ -64,7 +64,7 @@ def processAlgorithm(self, progress):

outFeat = QgsFeature()
current = 0
features = QGisLayers.features(layer)
features = vector.features(layer)
total = 100.0 / float(len(features))
for f in features:
geom = f.geometry()
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/processing/algs/ftools/SelectByLocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from PyQt4.QtCore import *
from qgis.core import *
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.parameters.ParameterSelection import ParameterSelection
from processing.parameters.ParameterVector import ParameterVector
from processing.outputs.OutputVector import OutputVector
Expand Down Expand Up @@ -59,10 +59,10 @@ def defineCharacteristics(self):

def processAlgorithm(self, progress):
filename = self.getParameterValue(self.INPUT)
inputLayer = QGisLayers.getObjectFromUri(filename)
inputLayer = dataobjects.getObjectFromUri(filename)
method = self.getParameterValue(self.METHOD)
filename = self.getParameterValue(self.INTERSECT)
selectLayer = QGisLayers.getObjectFromUri(filename)
selectLayer = dataobjects.getObjectFromUri(filename)

oldSelection = set(inputLayer.selectedFeaturesIds())
index = spatialIndex = utils.spatialindex(inputLayer)
Expand All @@ -71,7 +71,7 @@ def processAlgorithm(self, progress):
geom = QgsGeometry()
selectedSet = []
current = 0
features = QGisLayers.features(selectLayer)
features = vector.features(selectLayer)
total = 100.0 / float(len(features))
for f in features:
geom = QgsGeometry(f.geometry())
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/algs/ftools/SimplifyGeometries.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from qgis.core import *

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.core.ProcessingLog import ProcessingLog
from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterNumber import ParameterNumber
Expand All @@ -55,7 +55,7 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, "Simplified layer"))

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))
tolerance =self.getParameterValue(self.TOLERANCE)

pointsBefore = 0
Expand All @@ -65,7 +65,7 @@ def processAlgorithm(self, progress):
layer.wkbType(), layer.crs())

current = 0
selection = QGisLayers.features(layer)
selection = vector.features(layer)
total = 100.0 / float(len(selection))
for f in selection:
featGeometry = QgsGeometry(f.geometry())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from qgis.core import *
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.tools import vector as utils
from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterTableField import ParameterTableField
Expand All @@ -54,7 +54,7 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, "Output layer"))

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))
output = self.getOutputValue(self.OUTPUT)
fieldName = self.getParameterValue(self.FIELD)

Expand All @@ -72,14 +72,14 @@ def processAlgorithm(self, progress):
unique = utils.getUniqueValues(layer, index)

current = 0
features = QGisLayers.features(layer)
features = vector.features(layer)
total = 100.0 / float(len(features) * len(unique))

if not len(unique) == layer.featureCount():
for i in unique:
multi_feature= []
first = True
features = QGisLayers.features(layer)
features = vector.features(layer)
for inFeat in features:
atMap = inFeat.attributes()
idVar = atMap[index]
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/processing/algs/ftools/SumLines.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from PyQt4.QtCore import *
from qgis.core import *
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterString import ParameterString
from processing.outputs.OutputVector import OutputVector
Expand Down Expand Up @@ -58,8 +58,8 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, "Result"))

def processAlgorithm(self, progress):
lineLayer = QGisLayers.getObjectFromUri(self.getParameterValue(self.LINES))
polyLayer = QGisLayers.getObjectFromUri(self.getParameterValue(self.POLYGONS))
lineLayer = dataobjects.getObjectFromUri(self.getParameterValue(self.LINES))
polyLayer = dataobjects.getObjectFromUri(self.getParameterValue(self.POLYGONS))
lengthFieldName = self.getParameterValue(self.LEN_FIELD)
countFieldName = self.getParameterValue(self.COUNT_FIELD)

Expand All @@ -81,7 +81,7 @@ def processAlgorithm(self, progress):
distArea = QgsDistanceArea()

current = 0
features = QGisLayers.features(polyLayer)
features = vector.features(polyLayer)
total = 100.0 / float(len(features))
hasIntersections = False
for ftPoly in features:
Expand Down
10 changes: 5 additions & 5 deletions python/plugins/processing/algs/ftools/Union.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from PyQt4.QtGui import *
from qgis.core import *
from processing.parameters.ParameterVector import ParameterVector
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.outputs.OutputVector import OutputVector
from processing.tools import vector as utils
from processing.core.ProcessingLog import ProcessingLog
Expand All @@ -46,8 +46,8 @@ class Union(GeoAlgorithm):
#===========================================================================

def processAlgorithm(self, progress):
vlayerA = QGisLayers.getObjectFromUri(self.getParameterValue(Union.INPUT))
vlayerB = QGisLayers.getObjectFromUri(self.getParameterValue(Union.INPUT2))
vlayerA = dataobjects.getObjectFromUri(self.getParameterValue(Union.INPUT))
vlayerB = dataobjects.getObjectFromUri(self.getParameterValue(Union.INPUT2))
GEOS_EXCEPT = True
FEATURE_EXCEPT = True
vproviderA = vlayerA.dataProvider()
Expand All @@ -64,7 +64,7 @@ def processAlgorithm(self, progress):

count = 0
nElement = 0
featuresA = QGisLayers.features(vlayerA)
featuresA = vector.features(vlayerA)
nFeat = len(featuresA)
for inFeatA in featuresA:
progress.setPercentage(nElement/float(nFeat) * 50)
Expand Down Expand Up @@ -151,7 +151,7 @@ def processAlgorithm(self, progress):

length = len(vproviderA.fields())

featuresA = QGisLayers.features(vlayerB)
featuresA = vector.features(vlayerB)
nFeat = len(featuresA)
for inFeatA in featuresA:
progress.setPercentage(nElement/float(nFeat) * 100)
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/ftools/UniqueValues.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

import codecs
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects
from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterTableField import ParameterTableField
from processing.outputs.OutputHTML import OutputHTML
Expand Down Expand Up @@ -56,7 +56,7 @@ def defineCharacteristics(self):
self.addOutput(OutputString(self.UNIQUE_VALUES, "Unique values"))

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT_LAYER))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT_LAYER))
fieldName = self.getParameterValue(self.FIELD_NAME)
outputFile = self.getOutputValue(self.OUTPUT)
values = utils.getUniqueValues(layer, layer.fieldNameIndex(fieldName))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from qgis.core import *

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects
from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.parameters.ParameterNumber import ParameterNumber
Expand Down Expand Up @@ -63,7 +63,7 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, "Buffer"))

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))
dissolve = self.getParameterValue(self.DISSOLVE)
field = self.getParameterValue(self.FIELD)
segments = int(self.getParameterValue(self.SEGMENTS))
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/algs/ftools/VoronoiPolygons.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from qgis.core import *

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException

from processing.parameters.ParameterVector import ParameterVector
Expand Down Expand Up @@ -58,7 +58,7 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, "Voronoi polygons"))

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(layer.pendingFields().toList(),
QGis.WKBPolygon, layer.crs())
Expand All @@ -73,7 +73,7 @@ def processAlgorithm(self, progress):
ptDict = {}
ptNdx = -1

features = QGisLayers.features(layer)
features = vector.features(layer)
for inFeat in features:
geom = QgsGeometry(inFeat.geometry())
point = geom.asPoint()
Expand Down
46 changes: 23 additions & 23 deletions python/plugins/processing/algs/mmqgisx/MMQGISXAlgorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from processing.parameters.ParameterTableField import ParameterTableField
from processing.parameters.ParameterVector import ParameterVector
from processing.outputs.OutputVector import OutputVector
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.parameters.ParameterCrs import ParameterCrs


Expand All @@ -49,7 +49,7 @@ def defineCharacteristics(self):

def processAlgorithm(self, progress):

layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.LAYERNAME))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.LAYERNAME))
idx = layer.fieldNameIndex(self.getParameterValue(self.COLUMN))
output = self.getOutputFromName(self.SAVENAME)
fields = layer.pendingFields()
Expand All @@ -60,7 +60,7 @@ def processAlgorithm(self, progress):
newFields.append(field)
i += 1
outfile = output.getVectorWriter(newFields, layer.wkbType(), layer.crs() )
features = QGisLayers.features(layer)
features = vector.features(layer)
featurecount = len(features)
i = 0
outFeat = QgsFeature()
Expand Down Expand Up @@ -97,11 +97,11 @@ def defineCharacteristics(self):
#===========================================================================

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.LAYERNAME))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.LAYERNAME))
output = self.getOutputFromName(self.SAVENAME)
fields = layer.pendingFields()
outfile = output.getVectorWriter(fields, layer.wkbType(), layer.crs() )
features = QGisLayers.features(layer)
features = vector.features(layer)
featurecount = len(features)
i = 0
cleaned = {}
Expand Down Expand Up @@ -139,7 +139,7 @@ def defineCharacteristics(self):

def processAlgorithm(self, progress):

layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.LAYERNAME))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.LAYERNAME))
output = self.getOutputFromName(self.SAVENAME)
index = self.getParameterValue(self.NEWTYPE)

Expand All @@ -161,7 +161,7 @@ def processAlgorithm(self, progress):
fields = layer.pendingFields()
outfile = output.getVectorWriter(fields, newtype, layer.crs() )

features = QGisLayers.features(layer)
features = vector.features(layer)
feature_count = len(features)
i = 0
for feature in features:
Expand Down Expand Up @@ -590,7 +590,7 @@ def defineCharacteristics(self):

def processAlgorithm(self, progress):

layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.LAYERNAME))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.LAYERNAME))
hspacing = self.getParameterValue(self.HSPACING)
vspacing = self.getParameterValue(self.VSPACING)

Expand All @@ -604,7 +604,7 @@ def processAlgorithm(self, progress):
deleted_points = 0
feature_number = 0

features = QGisLayers.features(layer)
features = vector.features(layer)
feature_count = len(features)
for feature in features:
progress.setPercentage(float(feature_number) / feature_count * 100)
Expand Down Expand Up @@ -778,8 +778,8 @@ def defineCharacteristics(self):

def processAlgorithm(self, progress):

layersource = QGisLayers.getObjectFromUri(self.getParameterValue(self.SOURCENAME))
layerdest = QGisLayers.getObjectFromUri(self.getParameterValue(self.DESTNAME))
layersource = dataobjects.getObjectFromUri(self.getParameterValue(self.SOURCENAME))
layerdest = dataobjects.getObjectFromUri(self.getParameterValue(self.DESTNAME))

nameattribute = self.getParameterValue(self.NAMEATTRIBUTE)
units = self.unitlist[self.getParameterValue(self.UNITS)]
Expand All @@ -806,14 +806,14 @@ def processAlgorithm(self, progress):

# Create array of hubs in memory
hubs = []
features = QGisLayers.features(layerdest)
features = vector.features(layerdest)
for feature in features:
hubs.append(mmqgisx_hub(feature.geometry().boundingBox().center(), \
unicode(feature.attributes()[nameindex])))

# Scan source points, find nearest hub, and write to output file
writecount = 0
features = QGisLayers.features(layersource)
features = vector.features(layersource)
featureCount = len(features)
for feature in features:
source = feature.geometry().boundingBox().center()
Expand Down Expand Up @@ -889,8 +889,8 @@ def defineCharacteristics(self):

def processAlgorithm(self, progress):

hublayer = QGisLayers.getObjectFromUri(self.getParameterValue(self.HUBNAME))
spokelayer = QGisLayers.getObjectFromUri(self.getParameterValue(self.SPOKENAME))
hublayer = dataobjects.getObjectFromUri(self.getParameterValue(self.HUBNAME))
spokelayer = dataobjects.getObjectFromUri(self.getParameterValue(self.SPOKENAME))

hubattr = self.getParameterValue(self.HUBATTRIBUTE)
spokeattr = self.getParameterValue(self.SPOKEATTRIBUTE)
Expand All @@ -909,7 +909,7 @@ def processAlgorithm(self, progress):

# Scan spoke points
linecount = 0
spokepoints = QGisLayers.features(spokelayer)
spokepoints = vector.features(spokelayer)
i = 0
for spokepoint in spokepoints:
i += 1
Expand All @@ -918,7 +918,7 @@ def processAlgorithm(self, progress):
spokeid = unicode(spokepoint.attributes()[spokeindex])
progress.setPercentage(float(i) / len(spokepoints) * 100)
# Scan hub points to find first matching hub
hubpoints = QGisLayers.features(hublayer)
hubpoints = vector.features(hublayer)
for hubpoint in hubpoints:
hubid = unicode(hubpoint.attributes()[hubindex])
if hubid == spokeid:
Expand Down Expand Up @@ -965,8 +965,8 @@ def defineCharacteristics(self):

def processAlgorithm(self, progress):

layer1 = QGisLayers.getObjectFromUri(self.getParameterValue(self.LAYER1))
layer2 = QGisLayers.getObjectFromUri(self.getParameterValue(self.LAYER2))
layer1 = dataobjects.getObjectFromUri(self.getParameterValue(self.LAYER1))
layer2 = dataobjects.getObjectFromUri(self.getParameterValue(self.LAYER2))

fields = []
layers = [layer1, layer2]
Expand Down Expand Up @@ -1006,7 +1006,7 @@ def processAlgorithm(self, progress):
break
i += 1

features = QGisLayers.features(layer)
features = vector.features(layer)
for feature in features:
sattributes = feature.attributes()
dattributes = []
Expand Down Expand Up @@ -1053,7 +1053,7 @@ def defineCharacteristics(self):
def processAlgorithm(self, progress):

filename = self.getParameterValue(self.LAYERNAME)
layer = QGisLayers.getObjectFromUri(filename)
layer = dataobjects.getObjectFromUri(filename)

attribute = self.getParameterValue(self.ATTRIBUTE)
comparison = self.comparisons [self.getParameterValue(self.COMPARISON)]
Expand Down Expand Up @@ -1122,7 +1122,7 @@ def defineCharacteristics(self):
#===========================================================================

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.LAYERNAME))
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.LAYERNAME))
attribute = self.getParameterValue(self.ATTRIBUTE)
idx = layer.fieldNameIndex(attribute)
fields = layer.pendingFields()
Expand All @@ -1131,7 +1131,7 @@ def processAlgorithm(self, progress):
out = output.getVectorWriter(fields, layer.wkbType(), layer.crs())

i = 0
features = QGisLayers.features(layer)
features = vector.features(layer)
featurecount = len(features)
for feature in features:
i+=1
Expand Down
9 changes: 5 additions & 4 deletions python/plugins/processing/commander/CommanderWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from processing import interface
__author__ = 'Victor Olaya'
__date__ = 'April 2013'
__copyright__ = '(C) 2013, Victor Olaya'
Expand All @@ -28,8 +29,8 @@
from processing.core.Processing import Processing
from processing.gui.MissingDependencyDialog import MissingDependencyDialog
from processing.gui.ParametersDialog import ParametersDialog
from processing.core.QGisLayers import QGisLayers
from processing.core.ProcessingUtils import ProcessingUtils, mkdir
from processing.tools import dataobjects
from processing.tools.system import *
import types
import os
import imp
Expand All @@ -47,7 +48,7 @@ def __init__(self, parent, canvas):
self.initGui()

def commandsFolder(self):
folder = unicode(os.path.join(ProcessingUtils.userFolder(), "commander"))
folder = unicode(os.path.join(userFolder(), "commander"))
mkdir(folder)
return os.path.abspath(folder)

Expand Down Expand Up @@ -206,7 +207,7 @@ def runAlgorithm(self, alg):
dlg = alg.getCustomParametersDialog()
if not dlg:
dlg = ParametersDialog(alg)
canvas = QGisLayers.iface.mapCanvas()
canvas = interface.iface.mapCanvas()
prevMapTool = canvas.mapTool()
dlg.show()
dlg.exec_()
Expand Down
28 changes: 14 additions & 14 deletions python/plugins/processing/core/GeoAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
import copy
from processing.outputs.Output import Output
from processing.parameters.Parameter import Parameter
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects, vector
from processing.parameters.ParameterRaster import ParameterRaster
from processing.parameters.ParameterVector import ParameterVector
from PyQt4 import QtGui
from PyQt4.QtCore import *
from qgis.core import *
from processing.core.ProcessingUtils import ProcessingUtils
from processing.tools.system import *
from processing.parameters.ParameterMultipleInput import ParameterMultipleInput
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from processing.core.ProcessingLog import ProcessingLog
Expand Down Expand Up @@ -198,28 +198,28 @@ def convertUnsupportedFormats(self, progress):
for out in self.outputs:
if isinstance(out, OutputVector):
if out.compatible is not None:
layer = QGisLayers.getObjectFromUri(out.compatible)
layer = dataobjects.getObjectFromUri(out.compatible)
if layer is None: # for the case of memory layer, if the getCompatible method has been called
continue
provider = layer.dataProvider()
writer = out.getVectorWriter( provider.fields(), provider.geometryType(), layer.crs())
features = QGisLayers.features(layer)
features = vector.features(layer)
for feature in features:
writer.addFeature(feature)
elif isinstance(out, OutputRaster):
if out.compatible is not None:
layer = QGisLayers.getObjectFromUri(out.compatible)
layer = dataobjects.getObjectFromUri(out.compatible)
provider = layer.dataProvider()
writer = QgsRasterFileWriter(out.value)
format = self.getFormatShortNameFromFilename(out.value)
writer.setOutputFormat(format);
writer.writeRaster(layer.pipe(), layer.width(), layer.height(), layer.extent(), layer.crs())
elif isinstance(out, OutputTable):
if out.compatible is not None:
layer = QGisLayers.getObjectFromUri(out.compatible)
layer = dataobjects.getObjectFromUri(out.compatible)
provider = layer.dataProvider()
writer = out.getTableWriter(provider.fields())
features = QGisLayers.features(layer)
features = vector.features(layer)
for feature in features:
writer.addRecord(feature)
progress.setPercentage(100 * i / float(len(self.outputs)))
Expand All @@ -241,11 +241,11 @@ def checkOutputFileExtensions(self):
if not os.path.isabs(out.value):
continue
if isinstance(out, OutputRaster):
exts = QGisLayers.getSupportedOutputRasterLayerExtensions()
exts = dataobjects.getSupportedOutputRasterLayerExtensions()
elif isinstance(out, OutputVector):
exts = QGisLayers.getSupportedOutputVectorLayerExtensions()
exts = dataobjects.getSupportedOutputVectorLayerExtensions()
elif isinstance(out, OutputTable):
exts = QGisLayers.getSupportedOutputTableExtensions()
exts = dataobjects.getSupportedOutputTableExtensions()
elif isinstance(out, OutputHTML):
exts =["html", "htm"]
else:
Expand All @@ -262,10 +262,10 @@ def resolveTemporaryOutputs(self):
'''sets temporary outputs (output.value = None) with a temporary file instead'''
for out in self.outputs:
if (not out.hidden) and out.value == None:
ProcessingUtils.setTempOutput(out, self)
setTempOutput(out, self)

def setOutputCRS(self):
layers = QGisLayers.getAllLayers()
layers = dataobjects.getAllLayers()
for param in self.parameters:
if isinstance(param, (ParameterRaster, ParameterVector, ParameterMultipleInput)):
if param.value:
Expand All @@ -283,13 +283,13 @@ def setOutputCRS(self):
if p is not None:
self.crs = p.crs()
return
qgis = QGisLayers.iface
qgis = dataobjects.iface
self.crs = qgis.mapCanvas().mapRenderer().destinationCrs()

def checkInputCRS(self):
'''it checks that all input layers use the same CRS. If so, returns True. False otherwise'''
crs = None;
layers = QGisLayers.getAllLayers()
layers = dataobjects.getAllLayers()
for param in self.parameters:
if isinstance(param, (ParameterRaster, ParameterVector, ParameterMultipleInput)):
if param.value:
Expand Down
136 changes: 0 additions & 136 deletions python/plugins/processing/core/LayerExporter.py

This file was deleted.

17 changes: 5 additions & 12 deletions python/plugins/processing/core/Processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from processing import interface

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
Expand All @@ -27,7 +28,7 @@
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
from processing.core.QGisLayers import QGisLayers
from processing.tools import dataobjects
from processing.core.ProcessingConfig import ProcessingConfig
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.ProcessingLog import ProcessingLog
Expand All @@ -53,7 +54,6 @@

class Processing:

iface = None
listeners = []
providers = []
#a dictionary of algorithms. Keys are names of providers
Expand Down Expand Up @@ -102,19 +102,12 @@ def getProviderFromName(name):

@staticmethod
def getInterface():
return Processing.iface
return interface.iface

@staticmethod
def setInterface(iface):
Processing.iface = iface
pass#Processing.iface = iface

@staticmethod
def setPlugin(iface):
Processing.plugin = iface

@staticmethod
def getPlugin():
return Processing.plugin

@staticmethod
def initialize():
Expand Down Expand Up @@ -251,7 +244,7 @@ def getAlgorithmFromFullName(name):
@staticmethod
def getObject(uri):
'''Returns the QGIS object identified by the given URI'''
return QGisLayers.getObjectFromUri(uri)
return dataobjects.getObjectFromUri(uri)

@staticmethod
def runandload(name, *args):
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/core/ProcessingConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

from processing.core.ProcessingUtils import ProcessingUtils
from processing.tools.system import *
import os.path
from PyQt4 import QtGui

Expand Down Expand Up @@ -61,7 +61,7 @@ def initialize():
ProcessingConfig.addSetting(Setting("General", ProcessingConfig.TABLE_LIKE_PARAM_PANEL, "Show table-like parameter panels", False))
ProcessingConfig.addSetting(Setting("General", ProcessingConfig.USE_FILENAME_AS_LAYER_NAME, "Use filename as layer name", False))
ProcessingConfig.addSetting(Setting("General", ProcessingConfig.SHOW_RECENT_ALGORITHMS, "Show recently executed algorithms", True))
ProcessingConfig.addSetting(Setting("General", ProcessingConfig.OUTPUT_FOLDER, "Output folder", ProcessingUtils.tempFolder()))
ProcessingConfig.addSetting(Setting("General", ProcessingConfig.OUTPUT_FOLDER, "Output folder", tempFolder()))
ProcessingConfig.addSetting(Setting("General", ProcessingConfig.SHOW_CRS_DEF, "Show layer CRS definition in selection boxes", True))
ProcessingConfig.addSetting(Setting("General", ProcessingConfig.WARN_UNMATCHING_CRS, "Warn before executing if layer CRS's do not match", True))
ProcessingConfig.addSetting(Setting("General", ProcessingConfig.RASTER_STYLE,"Style for raster layers",""))
Expand Down Expand Up @@ -109,7 +109,7 @@ def getSettings():

@staticmethod
def configFile():
return os.path.join(ProcessingUtils.userFolder(), "processing_qgis.conf")
return os.path.join(userFolder(), "processing_qgis.conf")

@staticmethod
def loadSettings():
Expand Down
5 changes: 2 additions & 3 deletions python/plugins/processing/core/ProcessingLog.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
import codecs
import datetime
from PyQt4 import QtGui

from processing.core.ProcessingUtils import ProcessingUtils
from processing.tools.system import *
from processing.core.ProcessingConfig import ProcessingConfig

class ProcessingLog():
Expand All @@ -51,7 +50,7 @@ def startLogging():

@staticmethod
def logFilename():
batchfile = ProcessingUtils.userFolder() + os.sep + "processing_qgis.log"
batchfile = userFolder() + os.sep + "processing_qgis.log"
return batchfile

@staticmethod
Expand Down
97 changes: 0 additions & 97 deletions python/plugins/processing/core/ProcessingUtils.py

This file was deleted.

Loading