Skip to content
Permalink
Browse files

Remove some unrequired iface usage from processing algs

Flip to context.project().crs() use instead
  • Loading branch information
nyalldawson committed Jul 27, 2017
1 parent 2e8d940 commit 6ae2ddaa876ecd1e3e3956301043012446afe52a
@@ -53,7 +53,6 @@
QgsGraphBuilder,
QgsGraphAnalyzer
)
from qgis.utils import iface

from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm

@@ -199,7 +198,7 @@ def processAlgorithm(self, parameters, context, feedback):
bothValue,
defaultDirection)

distUnit = iface.mapCanvas().mapSettings().destinationCrs().mapUnits()
distUnit = context.project().crs().mapUnits()
multiplier = QgsUnitTypes.fromUnitToUnitFactor(distUnit, QgsUnitTypes.DistanceMeters)
if strategy == 0:
strategy = QgsNetworkDistanceStrategy()
@@ -209,7 +208,7 @@ def processAlgorithm(self, parameters, context, feedback):
multiplier * 1000.0 / 3600.0)

director.addStrategy(strategy)
builder = QgsGraphBuilder(iface.mapCanvas().mapSettings().destinationCrs(),
builder = QgsGraphBuilder(context.project().crs(),
True,
tolerance)

@@ -53,7 +53,6 @@
QgsGraphBuilder,
QgsGraphAnalyzer
)
from qgis.utils import iface

from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm

@@ -191,7 +190,7 @@ def processAlgorithm(self, parameters, context, feedback):
bothValue,
defaultDirection)

distUnit = iface.mapCanvas().mapSettings().destinationCrs().mapUnits()
distUnit = context.project().crs().mapUnits()
multiplier = QgsUnitTypes.fromUnitToUnitFactor(distUnit, QgsUnitTypes.DistanceMeters)
if strategy == 0:
strategy = QgsNetworkDistanceStrategy()
@@ -201,7 +200,7 @@ def processAlgorithm(self, parameters, context, feedback):
multiplier * 1000.0 / 3600.0)

director.addStrategy(strategy)
builder = QgsGraphBuilder(iface.mapCanvas().mapSettings().destinationCrs(),
builder = QgsGraphBuilder(context.project().crs(),
True,
tolerance)
feedback.pushInfo(self.tr('Building graph...'))
@@ -36,7 +36,6 @@
from processing.core.parameters import ParameterRaster
from processing.core.outputs import OutputRaster
from processing.tools import dataobjects
from qgis.utils import iface


class SetRasterStyle(QgisAlgorithm):
@@ -33,7 +33,6 @@
from processing.core.outputs import OutputVector
from processing.core.parameters import ParameterFile
from processing.tools import dataobjects
from qgis.utils import iface


class SetVectorStyle(QgisAlgorithm):
@@ -54,7 +54,6 @@
QgsGraphBuilder,
QgsGraphAnalyzer
)
from qgis.utils import iface

from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm

@@ -196,7 +195,7 @@ def processAlgorithm(self, parameters, context, feedback):
bothValue,
defaultDirection)

distUnit = iface.mapCanvas().mapSettings().destinationCrs().mapUnits()
distUnit = context.project().crs().mapUnits()
multiplier = QgsUnitTypes.fromUnitToUnitFactor(distUnit, QgsUnitTypes.DistanceMeters)
if strategy == 0:
strategy = QgsNetworkDistanceStrategy()
@@ -207,7 +206,7 @@ def processAlgorithm(self, parameters, context, feedback):
multiplier = 3600

director.addStrategy(strategy)
builder = QgsGraphBuilder(iface.mapCanvas().mapSettings().destinationCrs(),
builder = QgsGraphBuilder(context.project().crs(),
True,
tolerance)

@@ -54,7 +54,6 @@
QgsGraphBuilder,
QgsGraphAnalyzer
)
from qgis.utils import iface

from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm

@@ -196,7 +195,7 @@ def processAlgorithm(self, parameters, context, feedback):
bothValue,
defaultDirection)

distUnit = iface.mapCanvas().mapSettings().destinationCrs().mapUnits()
distUnit = context.project().crs().mapUnits()
multiplier = QgsUnitTypes.fromUnitToUnitFactor(distUnit, QgsUnitTypes.DistanceMeters)
if strategy == 0:
strategy = QgsNetworkDistanceStrategy()
@@ -207,7 +206,7 @@ def processAlgorithm(self, parameters, context, feedback):
multiplier = 3600

director.addStrategy(strategy)
builder = QgsGraphBuilder(iface.mapCanvas().mapSettings().destinationCrs(),
builder = QgsGraphBuilder(context.project().crs(),
True,
tolerance)

@@ -55,7 +55,6 @@
QgsGraphBuilder,
QgsGraphAnalyzer
)
from qgis.utils import iface

from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm

@@ -196,7 +195,7 @@ def processAlgorithm(self, parameters, context, feedback):
bothValue,
defaultDirection)

distUnit = iface.mapCanvas().mapSettings().destinationCrs().mapUnits()
distUnit = context.project().crs().mapUnits()
multiplier = QgsUnitTypes.fromUnitToUnitFactor(distUnit, QgsUnitTypes.DistanceMeters)
if strategy == 0:
strategy = QgsNetworkDistanceStrategy()
@@ -207,7 +206,7 @@ def processAlgorithm(self, parameters, context, feedback):
multiplier = 3600

director.addStrategy(strategy)
builder = QgsGraphBuilder(iface.mapCanvas().mapSettings().destinationCrs(),
builder = QgsGraphBuilder(context.project().crs(),
True,
tolerance)
feedback.pushInfo(self.tr('Building graph...'))

0 comments on commit 6ae2dda

Please sign in to comment.
You can’t perform that action at this time.