Skip to content
Permalink
Browse files

[sextante] changed how saga installation test is performed (now it us…

…es the test data)
  • Loading branch information
volaya committed Mar 27, 2013
1 parent 72037dc commit 0dd760215b87d25294a246c595c92d49f75d4ca6
Showing with 23 additions and 21 deletions.
  1. +2 −3 python/plugins/sextante/saga/SagaAlgorithm.py
  2. +21 −18 python/plugins/sextante/saga/SagaUtils.py
@@ -348,9 +348,8 @@ def exportRasterLayer(self, layer):
return "libio_gdal 0 -GRIDS \"" + destFilename + "\" -FILES \"" + layer + "\""


def checkBeforeOpeningParametersDialog(self):
pass
#return SagaUtils.checkSagaIsInstalled()
def checkBeforeOpeningParametersDialog(self):
return SagaUtils.checkSagaIsInstalled()


def checkParameterValuesBeforeExecuting(self):
@@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from sextante.tests.TestData import points

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
@@ -132,25 +133,27 @@ def checkSagaIsInstalled(cls):
return

try:
qgis = QGisLayers.iface
crs = qgis.mapCanvas().mapRenderer().destinationCrs()
fields = []
fields.append(QgsField("NUM_FIELD", QVariant.Int))
filename = SextanteUtils.getTempFilename("shp")
writer = SextanteVectorWriter(filename, None, fields, QGis.WKBPoint, crs)
for x in range(5):
for y in range(5):
attrs = []
attrs.append(QVariant(x))
outFeat = QgsFeature()
pt = QgsPoint(x, y)
outFeat.setGeometry(QgsGeometry.fromPoint(pt))
outFeat.setAttributes(attrs)
writer.addFeature(outFeat)
del writer.writer
del writer
#===================================================================
# qgis = QGisLayers.iface
# crs = qgis.mapCanvas().mapRenderer().destinationCrs()
# fields = []
# fields.append(QgsField("NUM_FIELD", QVariant.Int))
# filename = SextanteUtils.getTempFilename("shp")
# writer = SextanteVectorWriter(filename, None, fields, QGis.WKBPoint, crs)
# for x in range(5):
# for y in range(5):
# attrs = []
# attrs.append(QVariant(x))
# outFeat = QgsFeature()
# pt = QgsPoint(x, y)
# outFeat.setGeometry(QgsGeometry.fromPoint(pt))
# outFeat.setAttributes(attrs)
# writer.addFeature(outFeat)
# del writer.writer
# del writer
#===================================================================
from sextante.core.Sextante import runalg
result = runalg("saga:thiessenpolygons", filename, None)
result = runalg("saga:thiessenpolygons", points(), None)
if not os.path.exists(result['POLYGONS']):
return "It seems that SAGA is not correctly installed in your system.\nPlease install it before running SAGA algorithms."
except:

0 comments on commit 0dd7602

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