Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from sextante.outputs.OutputHTML import OutputHTML
from sextante.outputs.OutputNumber import OutputNumber

from sextante.ftools import FToolsUtils as utils
from sextante.algs.ftools import FToolsUtils as utils

class BasicStatisticsNumbers(GeoAlgorithm):

Expand All @@ -61,12 +61,14 @@ class BasicStatisticsNumbers(GeoAlgorithm):
UNIQUE = "UNIQUE"
STD_DEV = "STD_DEV"

def getIcon(self):
return QtGui.QIcon(os.path.dirname(__file__) + "/icons/basic_statistics.png")
#===========================================================================
# 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 = "Analysis tools"
self.group = "Vector table tools"

self.addParameter(ParameterVector(self.INPUT_LAYER, "Input vector layer", ParameterVector.VECTOR_TYPE_ANY, False))
self.addParameter(ParameterTableField(self.FIELD_NAME, "Field to calculate statistics on", self.INPUT_LAYER, ParameterTableField.DATA_TYPE_NUMBER))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os.path

from PyQt4 import QtGui
from PyQt4.QtCore import *
Expand All @@ -40,7 +39,7 @@
from sextante.outputs.OutputHTML import OutputHTML
from sextante.outputs.OutputNumber import OutputNumber

from sextante.ftools import FToolsUtils as utils
from sextante.algs.ftools import FToolsUtils as utils

class BasicStatisticsStrings(GeoAlgorithm):

Expand All @@ -57,12 +56,14 @@ class BasicStatisticsStrings(GeoAlgorithm):
FILLED = "FILLED"
UNIQUE = "UNIQUE"

def getIcon(self):
return QtGui.QIcon(os.path.dirname(__file__) + "/icons/basic_statistics.png")
#===========================================================================
# 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 = "Analysis tools"
self.group = "Vector table tools"

self.addParameter(ParameterVector(self.INPUT_LAYER, "Input vector layer", ParameterVector.VECTOR_TYPE_ANY, False))
self.addParameter(ParameterTableField(self.FIELD_NAME, "Field to calculate statistics on", self.INPUT_LAYER, ParameterTableField.DATA_TYPE_STRING))
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions python/plugins/sextante/algs/ftools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FILE(GLOB PY_FILES *.py)
FILE(GLOB OTHER_FILES copyright.txt)
FILE(GLOB ICON_FILES icons/*.png)

PLUGIN_INSTALL(sextante ./algs/ftools ${PY_FILES} ${OTHER_FILES})
PLUGIN_INSTALL(sextante ./algs/ftools/icons ${ICON_FILES})
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,22 @@ 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 getIcon(self):
# return QtGui.QIcon(os.path.dirname(__file__) + "/icons/centroids.png")
#===========================================================================

def defineCharacteristics(self):
self.name = "Polygon centroids"
self.group = "Geometry tools"
self.group = "Vector geometry tools"

self.addParameter(ParameterVector(self.INPUT_LAYER, "Input layer", ParameterVector.VECTOR_TYPE_POLYGON))

self.addOutput(OutputVector(self.OUTPUT_LAYER, "Output layer"))

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

outFileName = self.getOutputValue(self.OUTPUT_LAYER)

settings = QSettings()
encoding = settings.value( "/UI/encoding", "System" ).toString()


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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from sextante.parameters.ParameterVector import ParameterVector
from sextante.core.QGisLayers import QGisLayers
from sextante.outputs.OutputVector import OutputVector
from sextante.ftools import ftools_utils
from sextante.algs.ftools import ftools_utils
from sextante.core.SextanteLog import SextanteLog
from sextante.parameters.ParameterBoolean import ParameterBoolean

Expand All @@ -44,8 +44,10 @@ class Clip(GeoAlgorithm):
USE_SELECTED = "USE_SELECTED"
USE_SELECTED2 = "USE_SELECTED2"

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

def processAlgorithm(self, progress):
settings = QSettings()
Expand Down Expand Up @@ -277,7 +279,7 @@ def processAlgorithm(self, progress):

def defineCharacteristics(self):
self.name = "Clip"
self.group = "Geoprocessing tools"
self.group = "Vector overlay tools"
self.addParameter(ParameterVector(Clip.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterVector(Clip.INPUT2, "Clip layer", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterBoolean(Clip.USE_SELECTED, "Use selected features (input)", False))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from sextante.core.QGisLayers import QGisLayers
from sextante.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from sextante.outputs.OutputVector import OutputVector
from sextante.ftools import ftools_utils
from sextante.algs.ftools import ftools_utils
from sextante.core.SextanteLog import SextanteLog
from sextante.parameters.ParameterTableField import ParameterTableField
from sextante.parameters.ParameterSelection import ParameterSelection
Expand All @@ -48,8 +48,10 @@ class ConvexHull(GeoAlgorithm):
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")
#===========================================================================
# def getIcon(self):
# return QtGui.QIcon(os.path.dirname(__file__) + "/icons/convex_hull.png")
#===========================================================================

def processAlgorithm(self, progress):
useSelection = self.getParameterValue(ConvexHull.USE_SELECTED)
Expand Down Expand Up @@ -208,7 +210,7 @@ def perimMeasure(self, inGeom, measure ):

def defineCharacteristics(self):
self.name = "Convex hull"
self.group = "Geoprocessing tools"
self.group = "Vector geometry tools"
self.addParameter(ParameterVector(ConvexHull.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterTableField(ConvexHull.FIELD, "Field", ConvexHull.INPUT))
self.addParameter(ParameterSelection(ConvexHull.METHOD, "Method", ConvexHull.METHODS))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,21 @@
from sextante.parameters.ParameterVector import ParameterVector
from sextante.outputs.OutputVector import OutputVector

from sextante.ftools import voronoi
from sextante.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 getIcon(self):
# return QtGui.QIcon(os.path.dirname(__file__) + "/icons/delaunay.png")
#===========================================================================

def defineCharacteristics(self):
self.name = "Delaunay triangulation"
self.group = "Geometry tools"
self.group = "Vector geometry tools"

self.addParameter(ParameterVector(self.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_POINT))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class DensifyGeometries(GeoAlgorithm):

def defineCharacteristics(self):
self.name = "Densify geometries"
self.group = "Geometry tools"
self.group = "Vector geometry tools"

self.addParameter(ParameterVector(self.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterNumber(self.VERTICES, "Vertices to add", 1, 10000000, 1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,16 @@

class DensifyGeometriesInterval(GeoAlgorithm):

INPUT = "INPUT"
#VERTICES = "VERTICES"
INPUT = "INPUT"
INTERVAL = "INTERVAL"
USE_SELECTION = "USE_SELECTION"
OUTPUT = "OUTPUT"

def defineCharacteristics(self):
self.name = "Densify geometries given an interval"
self.group = "Geometry tools"
self.group = "Vector geometry tools"

self.addParameter(ParameterVector(self.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_ANY))
#self.addParameter(ParameterNumber(self.VERTICES, "Vertices to add", 1, 10000000, 1))
self.addParameter(ParameterVector(self.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterNumber(self.INTERVAL, "Interval between Vertices to add", 1, 10000000, 1))
self.addParameter(ParameterBoolean(self.USE_SELECTION, "Use only selected features", False))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@
from qgis.core import *
from sextante.parameters.ParameterVector import ParameterVector
from sextante.core.QGisLayers import QGisLayers
from sextante.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from sextante.outputs.OutputVector import OutputVector
from sextante.ftools import ftools_utils
from sextante.algs.ftools import ftools_utils
from sextante.core.SextanteLog import SextanteLog
from sextante.parameters.ParameterBoolean import ParameterBoolean

Expand All @@ -45,8 +44,10 @@ class Difference(GeoAlgorithm):
USE_SELECTED = "USE_SELECTED"
USE_SELECTED2 = "USE_SELECTED2"

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

def processAlgorithm(self, progress):
useSelection = self.getParameterValue(Difference.USE_SELECTED)
Expand Down Expand Up @@ -210,7 +211,7 @@ def processAlgorithm(self, progress):

def defineCharacteristics(self):
self.name = "Difference"
self.group = "Geoprocessing tools"
self.group = "Vector overlay tools"
self.addParameter(ParameterVector(Difference.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterVector(Difference.INPUT2, "Difference layer", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterBoolean(Difference.USE_SELECTED, "Use selected features (input)", False))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
from sextante.outputs.OutputVector import OutputVector
from sextante.parameters.ParameterBoolean import ParameterBoolean
from sextante.parameters.ParameterTableField import ParameterTableField
from sextante.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from sextante.core.SextanteLog import SextanteLog

class Dissolve(GeoAlgorithm):
Expand All @@ -45,8 +44,10 @@ class Dissolve(GeoAlgorithm):
USE_SELECTED = "USE_SELECTED"
DISSOLVE_ALL = "DISSOLVE_ALL"

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

def processAlgorithm(self, progress):
useSelection = self.getParameterValue(Dissolve.USE_SELECTED)
Expand Down Expand Up @@ -188,7 +189,7 @@ def processAlgorithm(self, progress):

def defineCharacteristics(self):
self.name = "Dissolve"
self.group = "Geoprocessing tools"
self.group = "Vector geometry tools"
self.addParameter(ParameterVector(Dissolve.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_POLYGON))
self.addParameter(ParameterBoolean(Dissolve.USE_SELECTED, "Use selected features", False))
self.addParameter(ParameterBoolean(Dissolve.DISSOLVE_ALL, "Dissolve all (do not use field)", True))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

from sextante.outputs.OutputVector import OutputVector

from sextante.ftools import FToolsUtils as utils
from sextante.algs.ftools import FToolsUtils as utils

class ExportGeometryInfo(GeoAlgorithm):

Expand All @@ -51,12 +51,14 @@ class ExportGeometryInfo(GeoAlgorithm):
"Ellipsoidal"
]

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

def defineCharacteristics(self):
self.name = "Export/Add geometry columns"
self.group = "Geometry tools"
self.group = "Vector table tools"

self.addParameter(ParameterVector(self.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterSelection(self.METHOD, "Calculate using", self.CALC_METHODS, 0))
Expand All @@ -66,9 +68,7 @@ def defineCharacteristics(self):

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

output = self.getOutputValue(self.OUTPUT)
method = self.getParameterValue(self.METHOD)

provider = layer.dataProvider()
geometryType = layer.geometryType()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ class ExtentFromLayer(GeoAlgorithm):

OUTPUT = "OUTPUT"

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

def defineCharacteristics(self):
self.name = "Polygon from layer extent"
self.group = "Research tools"
self.group = "Vector general tools"

self.addParameter(ParameterVector(self.INPUT_LAYER, "Input layer", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterBoolean(self.USE_SELECTION, "Use selection", False))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,28 @@

from sextante.outputs.OutputVector import OutputVector

from sextante.ftools import FToolsUtils as utils
from sextante.algs.ftools import FToolsUtils as utils

class ExtractNodes(GeoAlgorithm):

INPUT = "INPUT"
OUTPUT = "OUTPUT"

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

def defineCharacteristics(self):
self.name = "Extract nodes"
self.group = "Geometry tools"
self.group = "Vector geometry tools"

self.addParameter(ParameterVector(self.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_ANY))

self.addOutput(OutputVector(self.OUTPUT, "Output layer"))

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

provider = layer.dataProvider()
layer.select(layer.pendingAllAttributesList())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def __init__(self):
]

def getDescription(self):
return "fTools (Vector analysis)"
return "QGIS native algorithms"

def getName(self):
return "ftools"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

from sextante.outputs.OutputVector import OutputVector

from sextante.ftools import Buffer as buff
from sextante.algs.ftools import Buffer as buff

class FixedDistanceBuffer(GeoAlgorithm):

Expand All @@ -51,12 +51,14 @@ class FixedDistanceBuffer(GeoAlgorithm):
SEGMENTS = "SEGMENTS"
DISSOLVE = "DISSOLVE"

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

def defineCharacteristics(self):
self.name = "Fixed distance buffer"
self.group = "Geoprocessing tools"
self.group = "Vector geometry tools"

self.addParameter(ParameterVector(self.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterBoolean(self.USE_SELECTED, "Use selected features", False))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from sextante.core.QGisLayers import QGisLayers
from sextante.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from sextante.outputs.OutputVector import OutputVector
from sextante.ftools import ftools_utils
from sextante.algs.ftools import ftools_utils
from sextante.core.SextanteLog import SextanteLog
from sextante.parameters.ParameterBoolean import ParameterBoolean

Expand All @@ -45,8 +45,10 @@ class Intersection(GeoAlgorithm):
USE_SELECTED = "USE_SELECTED"
USE_SELECTED2 = "USE_SELECTED2"

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

def processAlgorithm(self, progress):
useSelection = self.getParameterValue(Intersection.USE_SELECTED)
Expand Down Expand Up @@ -215,7 +217,7 @@ def processAlgorithm(self, progress):

def defineCharacteristics(self):
self.name = "Intersection"
self.group = "Geoprocessing tools"
self.group = "Vector overlay tools"
self.addParameter(ParameterVector(Intersection.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterVector(Intersection.INPUT2, "Intersect layer", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterBoolean(Intersection.USE_SELECTED, "Use selected features (input)", False))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@
from qgis.core import *

from sextante.core.GeoAlgorithm import GeoAlgorithm
from sextante.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from sextante.core.QGisLayers import QGisLayers

from sextante.parameters.ParameterVector import ParameterVector
from sextante.parameters.ParameterTableField import ParameterTableField

from sextante.outputs.OutputVector import OutputVector

from sextante.ftools import FToolsUtils as utils
from sextante.algs.ftools import FToolsUtils as utils

class LinesIntersection(GeoAlgorithm):

Expand All @@ -50,12 +49,14 @@ class LinesIntersection(GeoAlgorithm):

OUTPUT = "OUTPUT"

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

def defineCharacteristics(self):
self.name = "Line intersections"
self.group = "Analysis tools"
self.group = "Vector overlay tools"

self.addParameter(ParameterVector(self.INPUT_A, "Input layer", ParameterVector.VECTOR_TYPE_LINE))
self.addParameter(ParameterVector(self.INPUT_B, "Intersect layer", ParameterVector.VECTOR_TYPE_LINE))
Expand All @@ -69,9 +70,7 @@ def processAlgorithm(self, progress):
layerB = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT_B))
fieldA = self.getParameterValue(self.FIELD_A)
fieldB = self.getParameterValue(self.FIELD_B)

output = self.getOutputValue(self.OUTPUT)


providerA = layerA.dataProvider()
providerB = layerB.dataProvider()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,20 @@ class LinesToPolygons(GeoAlgorithm):
INPUT = "INPUT"
OUTPUT = "OUTPUT"

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

def defineCharacteristics(self):
self.name = "Lines to polygons"
self.group = "Geometry tools"
self.group = "Vector geometry tools"

self.addParameter(ParameterVector(self.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_LINE))
self.addOutput(OutputVector(self.OUTPUT, "Output layer"))

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

provider = layer.dataProvider()
layer.select(layer.pendingAllAttributesList())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

from sextante.outputs.OutputVector import OutputVector

from sextante.ftools import FToolsUtils as utils
from sextante.algs.ftools import FToolsUtils as utils


class MeanCoords(GeoAlgorithm):
Expand All @@ -49,12 +49,14 @@ class MeanCoords(GeoAlgorithm):
UID = "UID"
WEIGHT = "WEIGHT"

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

def defineCharacteristics(self):
self.name = "Mean coordinate(s)"
self.group = "Analysis tools"
self.group = "Vector analysis tools"

self.addParameter(ParameterVector(self.POINTS, "Input layer", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterTableField(self.WEIGHT, "Weight field", MeanCoords.POINTS, ParameterTableField.DATA_TYPE_NUMBER))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ class MultipartToSingleparts(GeoAlgorithm):
INPUT = "INPUT"
OUTPUT = "OUTPUT"

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

def defineCharacteristics(self):
self.name = "Multipart to singleparts"
self.group = "Geometry tools"
self.group = "Vector geometry tools"

self.addParameter(ParameterVector(self.INPUT, "Input layer"))
self.addOutput(OutputVector(self.OUTPUT, "Output layer"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from sextante.outputs.OutputHTML import OutputHTML
from sextante.outputs.OutputNumber import OutputNumber

from sextante.ftools import FToolsUtils as utils
from sextante.algs.ftools import FToolsUtils as utils

class NearestNeighbourAnalysis(GeoAlgorithm):

Expand All @@ -52,12 +52,14 @@ class NearestNeighbourAnalysis(GeoAlgorithm):
POINT_COUNT = "POINT_COUNT"
Z_SCORE = "Z_SCORE"

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

def defineCharacteristics(self):
self.name = "Nearest neighbour analysis"
self.group = "Analysis tools"
self.group = "Vector analysis tools"

self.addParameter(ParameterVector(self.POINTS, "Points", ParameterVector.VECTOR_TYPE_POINT))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@ class PointDistance(GeoAlgorithm):
"Summary distance matrix (mean, std. dev., min, max)"
]

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

def defineCharacteristics(self):
self.name = "Distance matrix"
self.group = "Analysis tools"
self.group = "Vector analysis tools"

self.addParameter(ParameterVector(self.INPUT_LAYER, "Input point layer", ParameterVector.VECTOR_TYPE_POINT))
self.addParameter(ParameterTableField(self.INPUT_FIELD, "Input unique ID field", self.INPUT_LAYER, ParameterTableField.DATA_TYPE_ANY))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

from sextante.outputs.OutputVector import OutputVector

from sextante.ftools import FToolsUtils as utils
from sextante.algs.ftools import FToolsUtils as utils


class PointsInPolygon(GeoAlgorithm):
Expand All @@ -49,12 +49,14 @@ class PointsInPolygon(GeoAlgorithm):
OUTPUT = "OUTPUT"
FIELD = "FIELD"

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

def defineCharacteristics(self):
self.name = "Count points in polygon"
self.group = "Analysis tools"
self.group = "Vector analysis tools"
self.addParameter(ParameterVector(self.POLYGONS, "Polygons", ParameterVector.VECTOR_TYPE_POLYGON))
self.addParameter(ParameterVector(self.POINTS, "Points", ParameterVector.VECTOR_TYPE_POINT))
self.addParameter(ParameterString(self.FIELD, "Count field name", "NUMPOINTS"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

from sextante.outputs.OutputVector import OutputVector

from sextante.ftools import FToolsUtils as utils
from sextante.algs.ftools import FToolsUtils as utils


class PointsInPolygonUnique(GeoAlgorithm):
Expand All @@ -51,12 +51,14 @@ class PointsInPolygonUnique(GeoAlgorithm):
FIELD = "FIELD"
CLASSFIELD = "CLASSFIELD"

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

def defineCharacteristics(self):
self.name = "Count unique points in polygon"
self.group = "Analysis tools"
self.group = "Vector analysis tools"
self.addParameter(ParameterVector(self.POLYGONS, "Polygons", ParameterVector.VECTOR_TYPE_POLYGON))
self.addParameter(ParameterVector(self.POINTS, "Points", ParameterVector.VECTOR_TYPE_POINT))
self.addParameter(ParameterTableField(self.CLASSFIELD, "Class field", self.POINTS))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

from sextante.outputs.OutputVector import OutputVector

from sextante.ftools import FToolsUtils as utils
from sextante.algs.ftools import FToolsUtils as utils


class PointsInPolygonWeighted(GeoAlgorithm):
Expand All @@ -51,12 +51,14 @@ class PointsInPolygonWeighted(GeoAlgorithm):
FIELD = "FIELD"
WEIGHT = "WEIGHT"

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

def defineCharacteristics(self):
self.name = "Count points in polygon(weighted)"
self.group = "Analysis tools"
self.group = "Vector analysis tools"

self.addParameter(ParameterVector(self.POLYGONS, "Polygons", ParameterVector.VECTOR_TYPE_POLYGON))
self.addParameter(ParameterVector(self.POINTS, "Points", ParameterVector.VECTOR_TYPE_POINT))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@ class PolygonsToLines(GeoAlgorithm):
INPUT = "INPUT"
OUTPUT = "OUTPUT"

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

def defineCharacteristics(self):
self.name = "Polygons to lines"
self.group = "Geometry tools"
self.group = "Vector geometry tools"

self.addParameter(ParameterVector(self.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_POLYGON))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@ class RandomSelection(GeoAlgorithm):
"Percentage of selected features"
]

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

def defineCharacteristics(self):
self.name = "Random selection"
self.group = "Research tools"
self.group = "Vector selection tools"

self.addParameter(ParameterVector(self.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterSelection(self.METHOD, "Method", self.METHODS, 0))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,19 @@ class RandomSelectionWithinSubsets(GeoAlgorithm):
"Percentage of selected features"
]

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

def defineCharacteristics(self):
self.name = "Random selection within subsets"
self.group = "Research tools"
self.group = "Vector selection tools"

self.addParameter(ParameterVector(self.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterTableField(self.FIELD, "ID Field", self.INPUT))
self.addParameter(ParameterSelection(self.METHOD, "Method", self.METHODS, 0))
self.addParameter(ParameterNumber(self.NUMBER, "Number/persentage of selected features", 1, None, 10))
self.addParameter(ParameterNumber(self.NUMBER, "Number/percentage of selected features", 1, None, 10))

self.addOutput(OutputVector(self.OUTPUT, "Selection", True))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ class ReprojectLayer(GeoAlgorithm):
TARGET_CRS = "TARGET_CRS"
OUTPUT = "OUTPUT"

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

def defineCharacteristics(self):
self.name = "Reproject layer"
self.group = "Data management tools"
self.group = "Vector general tools"

self.addParameter(ParameterVector(self.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterCrs(self.TARGET_CRS, "Target CRS", "4326"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

from sextante.outputs.OutputVector import OutputVector

from sextante.ftools import FToolsUtils as utils
from sextante.algs.ftools import FToolsUtils as utils

class SelectByLocation(GeoAlgorithm):

Expand All @@ -53,12 +53,14 @@ class SelectByLocation(GeoAlgorithm):
"adding to current selection",
"removing from current selection"]

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

def defineCharacteristics(self):
self.name = "Select by location"
self.group = "Research tools"
self.group = "Vector selection tools"

self.addParameter(ParameterVector(self.INPUT, "Layer to select from", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterVector(self.INTERSECT, "Additional layer (intersection layer)", ParameterVector.VECTOR_TYPE_ANY))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@ class SimplifyGeometries(GeoAlgorithm):
USE_SELECTION = "USE_SELECTION"
OUTPUT = "OUTPUT"

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

def defineCharacteristics(self):
self.name = "Simplify geometries"
self.group = "Geometry tools"
self.group = "Vector geometry tools"

self.addParameter(ParameterVector(self.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterNumber(self.TOLERANCE, "Tolerance", 0.0, 10000000.0, 1.0))
Expand All @@ -63,8 +65,7 @@ def defineCharacteristics(self):
def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT))
useSelection = self.getParameterValue(self.USE_SELECTION)
tolerance =self.getParameterValue(self.TOLERANCE)
output = self.getOutputValue(self.OUTPUT)
tolerance =self.getParameterValue(self.TOLERANCE)

pointsBefore = 0
pointsAfter = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ class SinglePartsToMultiparts(GeoAlgorithm):
FIELD = "FIELD"
OUTPUT = "OUTPUT"

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

def defineCharacteristics(self):
self.name = "Singleparts to multipart"
self.group = "Geometry tools"
self.group = "Vector geometry tools"

self.addParameter(ParameterVector(self.INPUT, "Input layer"))
self.addParameter(ParameterTableField(self.FIELD, "Unique ID field", self.INPUT))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from sextante.parameters.ParameterString import ParameterString
from sextante.outputs.OutputVector import OutputVector

from sextante.ftools import FToolsUtils as utils
from sextante.algs.ftools import FToolsUtils as utils

class SumLines(GeoAlgorithm):

Expand All @@ -48,12 +48,14 @@ class SumLines(GeoAlgorithm):
COUNT_FIELD = "COUNT_FIELD"
OUTPUT = "OUTPUT"

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

def defineCharacteristics(self):
self.name = "Sum line lengths"
self.group = "Analysis tools"
self.group = "Vector analysis tools"

self.addParameter(ParameterVector(self.LINES, "Lines", ParameterVector.VECTOR_TYPE_LINE))
self.addParameter(ParameterVector(self.POLYGONS, "Polygons", ParameterVector.VECTOR_TYPE_POLYGON))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from sextante.core.QGisLayers import QGisLayers
from sextante.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from sextante.outputs.OutputVector import OutputVector
from sextante.ftools import ftools_utils
from sextante.algs.ftools import ftools_utils
from sextante.core.SextanteLog import SextanteLog

class Union(GeoAlgorithm):
Expand All @@ -42,8 +42,10 @@ class Union(GeoAlgorithm):
INPUT2 = "INPUT2"
OUTPUT = "OUTPUT"

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

def processAlgorithm(self, progress):
vlayerA = QGisLayers.getObjectFromUri(self.getParameterValue(Union.INPUT))
Expand Down Expand Up @@ -217,7 +219,7 @@ def processAlgorithm(self, progress):

def defineCharacteristics(self):
self.name = "Union"
self.group = "Geoprocessing tools"
self.group = "Vector overlay tools"
self.addParameter(ParameterVector(Union.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterVector(Union.INPUT2, "Input layer 2", ParameterVector.VECTOR_TYPE_ANY))
self.addOutput(OutputVector(Union.OUTPUT, "Intersection"))
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

from sextante.core.GeoAlgorithm import GeoAlgorithm
from sextante.core.QGisLayers import QGisLayers
from sextante.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException

from sextante.parameters.ParameterVector import ParameterVector
from sextante.parameters.ParameterTableField import ParameterTableField
Expand All @@ -45,12 +44,14 @@ class UniqueValues(GeoAlgorithm):
TOTAL_VALUES = "TOTAL_VALUES"
OUTPUT = "OUTPUT"

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

def defineCharacteristics(self):
self.name = "List unique values"
self.group = "Analysis tools"
self.group = "Vector table tools"
self.addParameter(ParameterVector(self.INPUT_LAYER, "Input layer", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterTableField(self.FIELD_NAME, "Targer field", self.INPUT_LAYER, ParameterTableField.DATA_TYPE_ANY))
self.addOutput(OutputHTML(self.OUTPUT, "Unique values"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

from sextante.outputs.OutputVector import OutputVector

from sextante.ftools import Buffer as buff
from sextante.algs.ftools import Buffer as buff

class VariableDistanceBuffer(GeoAlgorithm):

Expand All @@ -51,12 +51,14 @@ class VariableDistanceBuffer(GeoAlgorithm):
SEGMENTS = "SEGMENTS"
DISSOLVE = "DISSOLVE"

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

def defineCharacteristics(self):
self.name = "Variable distance buffer"
self.group = "Geoprocessing tools"
self.group = "Vector geometry tools"

self.addParameter(ParameterVector(self.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterBoolean(self.USE_SELECTED, "Use selected features", False))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,21 @@

from sextante.outputs.OutputVector import OutputVector

from sextante.ftools import voronoi
from sextante.algs.ftools import voronoi

class VoronoiPolygons(GeoAlgorithm):

INPUT = "INPUT"
OUTPUT = "OUTPUT"

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

def defineCharacteristics(self):
self.name = "Voronoi polygons"
self.group = "Geometry tools"
self.group = "Vector geometry tools"

self.addParameter(ParameterVector(self.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_POINT))

Expand All @@ -59,8 +61,6 @@ def defineCharacteristics(self):
def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT))

output = self.getOutputValue(self.OUTPUT)

provider = layer.dataProvider()
layer.select(layer.pendingAllAttributesList())

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
6 changes: 6 additions & 0 deletions python/plugins/sextante/algs/mmqgisx/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FILE(GLOB PY_FILES *.py)
FILE(GLOB OTHER_FILES copyright.txt)
FILE(GLOB ICON_FILES icons/*.png)

PLUGIN_INSTALL(sextante ./algs/mmqgisx ${PY_FILES} ${OTHER_FILES})
PLUGIN_INSTALL(sextante ./algs/mmqgisx/icons ${ICON_FILES})

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes

Large diffs are not rendered by default.

10 changes: 2 additions & 8 deletions python/plugins/sextante/core/Sextante.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,12 @@
from sextante.modeler.Providers import Providers
from sextante.modeler.ModelerAlgorithmProvider import ModelerAlgorithmProvider
from sextante.modeler.ModelerOnlyAlgorithmProvider import ModelerOnlyAlgorithmProvider
from sextante.algs.SextanteAlgorithmProvider import SextanteAlgorithmProvider
from sextante.algs.QGISAlgorithmProvider import QGISAlgorithmProvider
from sextante.parameters.ParameterSelection import ParameterSelection
from sextante.ftools.FToolsAlgorithmProvider import FToolsAlgorithmProvider
from sextante.grass.GrassAlgorithmProvider import GrassAlgorithmProvider
from sextante.lidar.LidarToolsAlgorithmProvider import LidarToolsAlgorithmProvider
from sextante.gdal.GdalOgrAlgorithmProvider import GdalOgrAlgorithmProvider
from sextante.mmqgisx.MMQGISXAlgorithmProvider import MMQGISXAlgorithmProvider
from sextante.otb.OTBAlgorithmProvider import OTBAlgorithmProvider
#from sextante.pymorph.PymorphAlgorithmProvider import PymorphAlgorithmProvider
from sextante.r.RAlgorithmProvider import RAlgorithmProvider
from sextante.saga.SagaAlgorithmProvider import SagaAlgorithmProvider
from sextante.script.ScriptAlgorithmProvider import ScriptAlgorithmProvider
Expand Down Expand Up @@ -116,12 +113,9 @@ def setInterface(iface):
@staticmethod
def initialize():
#add the basic providers
Sextante.addProvider(SextanteAlgorithmProvider())
Sextante.addProvider(MMQGISXAlgorithmProvider())
Sextante.addProvider(FToolsAlgorithmProvider())
Sextante.addProvider(QGISAlgorithmProvider())
Sextante.addProvider(ModelerOnlyAlgorithmProvider())
Sextante.addProvider(GdalOgrAlgorithmProvider())
#Sextante.addProvider(PymorphAlgorithmProvider())
Sextante.addProvider(LidarToolsAlgorithmProvider())
Sextante.addProvider(OTBAlgorithmProvider())
Sextante.addProvider(RAlgorithmProvider())
Expand Down
6 changes: 0 additions & 6 deletions python/plugins/sextante/ftools/CMakeLists.txt

This file was deleted.

25 changes: 19 additions & 6 deletions python/plugins/sextante/grass/GrassAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
Expand Down Expand Up @@ -195,7 +196,7 @@ def processAlgorithm(self, progress):
if value in self.exportedLayers.keys():
continue
else:
self.setSessionProjection(value, commands)
self.setSessionProjectionFromLayer(value, commands)
commands.append(self.exportRasterLayer(value))
if isinstance(param, ParameterVector):
if param.value == None:
Expand All @@ -204,7 +205,7 @@ def processAlgorithm(self, progress):
if value in self.exportedLayers.keys():
continue
else:
self.setSessionProjection(value, commands)
self.setSessionProjectionFromLayer(value, commands)
commands.append(self.exportVectorLayer(value))
if isinstance(param, ParameterTable):
pass
Expand All @@ -219,16 +220,18 @@ def processAlgorithm(self, progress):
if layer in self.exportedLayers.keys():
continue
else:
self.setSessionProjection(layer, commands)
self.setSessionProjectionFromLayer(layer, commands)
commands.append(self.exportRasterLayer(layer))
elif param.datatype == ParameterMultipleInput.TYPE_VECTOR_ANY:
for layer in layers:
if layer in self.exportedLayers.keys():
continue
else:
self.setSessionProjection(layer, commands)
self.setSessionProjectionFromLayer(layer, commands)
commands.append(self.exportVectorLayer(layer))

self.setSessionProjectionFromProject(commands)

region = str(self.getParameterValue(self.GRASS_REGION_EXTENT_PARAMETER))
regionCoords = region.split(",")
command = "g.region"
Expand Down Expand Up @@ -368,8 +371,18 @@ def exportVectorLayer(self, orgFilename):
command +=" --overwrite -o"
return command


def setSessionProjection(self, layer, commands):
def setSessionProjectionFromProject(self, commands):
if not GrassUtils.projectionSet:
from sextante.core.Sextante import Sextante
qgis = Sextante.getInterface()
proj4 = qgis.mapCanvas().mapRenderer().getDestinationCrs().toProj4()
command = "g.proj"
command +=" -c"
command +=" proj4=\""+proj4+"\""
commands.append(command)
GrassUtils.projectionSet = True

def setSessionProjectionFromLayer(self, layer, commands):
if not GrassUtils.projectionSet:
qGisLayer = QGisLayers.getObjectFromUri(layer)
if qGisLayer:
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/sextante/grass/description/r.grow.distance.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
r.grow.distance
r.grow.distance - Generates a raster map layer of distance to features in input layer.
r.grow.distance - Generates a raster layer of distance to features in input layer.
Raster (r.*)
ParameterRaster|input|Name of input raster map|False
ParameterRaster|input|Input input raster layer|False
ParameterSelection|metric|Metric|euclidean;squared;maximum;manhattan
OutputRaster|distance|Name for distance output map
OutputRaster|value|Name for value output map
OutputRaster|distance|Distance layer
OutputRaster|value|Output value
6 changes: 3 additions & 3 deletions python/plugins/sextante/grass/description/r.grow.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
r.grow
r.grow - Generates a raster map layer with contiguous areas grown by one cell.
r.grow - Generates a raster layer with contiguous areas grown by one cell.
Raster (r.*)
ParameterRaster|input|Name of input raster map|False
ParameterRaster|input|input raster layer|False
ParameterNumber|radius|Radius of buffer in raster cells|None|None|1.01
ParameterSelection|metric|Metric|euclidean;maximum;manhattan
ParameterNumber|old|Value to write for input cells which are non-NULL (-1 => NULL)|None|None|0
ParameterNumber|new|Value to write for "grown" cells|None|None|1
OutputRaster|output|Name for output raster map
OutputRaster|output|Output layer
14 changes: 7 additions & 7 deletions python/plugins/sextante/grass/description/r.his.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
r.his
r.his - Generates red, green and blue raster map layers combining hue, intensity and saturation (HIS) values from user-specified input raster map layers.
r.his - Generates red, green and blue raster layers combining hue, intensity and saturation (HIS) values from user-specified input raster layers.
Raster (r.*)
ParameterRaster|h_map|Name of layer to be used for HUE|False
ParameterRaster|i_map|Name of layer to be used for INTENSITY|False
ParameterRaster|s_map|Name of layer to be used for SATURATION|False
ParameterRaster|h_map|Hue|False
ParameterRaster|i_map|Intensity|False
ParameterRaster|s_map|Saturation|False
ParameterBoolean|-n|Respect NULL values while drawing|False
OutputRaster|r_map|Name of output layer to be used for RED
OutputRaster|g_map|Name of output layer to be used for GREEN
OutputRaster|b_map|Name of output layer to be used for BLUE
OutputRaster|r_map|Red
OutputRaster|g_map|Green
OutputRaster|b_map|Blue
Binary file added python/plugins/sextante/images/qgis.png
Binary file modified python/plugins/sextante/images/tool.png
6 changes: 0 additions & 6 deletions python/plugins/sextante/mmqgisx/CMakeLists.txt

This file was deleted.

64 changes: 58 additions & 6 deletions python/plugins/sextante/modeler/ModelerAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,37 @@
* *
***************************************************************************
"""
from sextante.outputs.OutputString import OutputString

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import copy
import os.path
import codecs
import time
from qgis.core import *
from sextante.core.GeoAlgorithm import GeoAlgorithm
from sextante.parameters.ParameterFactory import ParameterFactory
from sextante.modeler.WrongModelException import WrongModelException
from sextante.modeler.ModelerUtils import ModelerUtils
import copy
from sextante.parameters.ParameterRaster import ParameterRaster
from sextante.core.QGisLayers import QGisLayers
from sextante.parameters.ParameterExtent import ParameterExtent
from PyQt4 import QtCore, QtGui
from sextante.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
import os.path
from sextante.parameters.ParameterMultipleInput import ParameterMultipleInput
from sextante.outputs.OutputRaster import OutputRaster
from sextante.outputs.OutputHTML import OutputHTML
from sextante.outputs.OutputTable import OutputTable
from sextante.outputs.OutputVector import OutputVector
from sextante.outputs.OutputNumber import OutputNumber
from sextante.outputs.OutputString import OutputString
from sextante.parameters.Parameter import Parameter
from sextante.parameters.ParameterVector import ParameterVector
from sextante.parameters.ParameterTableField import ParameterTableField
from sextante.gui.Help2Html import Help2Html
import codecs
import time

class ModelerAlgorithm(GeoAlgorithm):

Expand Down Expand Up @@ -343,6 +346,12 @@ def prepareAlgorithm(self, alg, iAlg):
for param in alg.parameters:
aap = self.algParameters[iAlg][param.name]
if aap == None:
if isinstance(param, ParameterExtent):
value = self.getValueFromAlgorithmAndParameter(aap)
if value is None:
value = self.getMinCoveringExtent()
if not param.setValue(value):
raise GeoAlgorithmExecutionException("Wrong value: " + str(value))
continue
if isinstance(param, ParameterMultipleInput):
value = self.getValueFromAlgorithmAndParameter(aap)
Expand All @@ -356,6 +365,7 @@ def prepareAlgorithm(self, alg, iAlg):
value = ";".join(layerslist)
if not param.setValue(value):
raise GeoAlgorithmExecutionException("Wrong value: " + str(value))

else:
value = self.getValueFromAlgorithmAndParameter(aap)
if not param.setValue(value):
Expand All @@ -368,11 +378,53 @@ def prepareAlgorithm(self, alg, iAlg):
else:
out.value = None


def getMinCoveringExtent(self):
first = True
found = False
for param in self.parameters:
if param.value:
if isinstance(param, (ParameterRaster, ParameterVector)):
found = True
if isinstance(param.value, (QgsRasterLayer, QgsVectorLayer)):
layer = param.value
else:
layer = QGisLayers.getObjectFromUri(param.value)
self.addToRegion(layer, first)
first = False
elif isinstance(param, ParameterMultipleInput):
found = True
layers = param.value.split(";")
for layername in layers:
layer = QGisLayers.getObjectFromUri(layername)
self.addToRegion(layer, first)
first = False
if found:
return str(self.xmin) + "," + str(self.xmax) + "," + str(self.ymin) + "," + str(self.ymax)
else:
return None


def addToRegion(self, layer, first):
if first:
self.xmin = layer.extent().xMinimum()
self.xmax = layer.extent().xMaximum()
self.ymin = layer.extent().yMinimum()
self.ymax = layer.extent().yMaximum()
else:
self.xmin = min(self.xmin, layer.extent().xMinimum())
self.xmax = max(self.xmax, layer.extent().xMaximum())
self.ymin = min(self.ymin, layer.extent().yMinimum())
self.ymax = max(self.ymax, layer.extent().yMaximum())


def getSafeNameForOutput(self, ialg, out):
return out.name +"_ALG" + str(ialg)


def getValueFromAlgorithmAndParameter(self, aap):
if aap is None:
return None
if float(aap.alg) == float(AlgorithmAndParameter.PARENT_MODEL_ALGORITHM):
for key in self.paramValues.keys():
if aap.param == key:
Expand Down
32 changes: 17 additions & 15 deletions python/plugins/sextante/modeler/ModelerParametersDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,18 @@
* *
***************************************************************************
"""
from sextante.parameters.ParameterCrs import ParameterCrs
from sextante.outputs.OutputString import OutputString

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os.path

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4 import QtCore, QtGui, QtWebKit

from sextante.parameters.ParameterCrs import ParameterCrs
from sextante.outputs.OutputString import OutputString
from sextante.parameters.ParameterRaster import ParameterRaster
from sextante.parameters.ParameterVector import ParameterVector
from sextante.parameters.ParameterBoolean import ParameterBoolean
Expand Down Expand Up @@ -60,6 +57,7 @@ class ModelerParametersDialog(QtGui.QDialog):

ENTER_NAME = "[Enter name if this is a final result]"
NOT_SELECTED = "[Not selected]"
USE_MIN_COVERING_EXTENT = "[Use min covering extent]"

def __init__(self, alg, model, algIndex = None):
QtGui.QDialog.__init__(self)
Expand Down Expand Up @@ -257,7 +255,7 @@ def getExtents(self):
params = self.model.parameters
for param in params:
if isinstance(param, ParameterExtent):
extents.append(AlgorithmAndParameter(AlgorithmAndParameter.PARENT_MODEL_ALGORITHM, param.name, "", param.description))
extents.append(AlgorithmAndParameter(AlgorithmAndParameter.PARENT_MODEL_ALGORITHM, param.name, "", param.description))
return extents

def getNumbers(self):
Expand Down Expand Up @@ -414,9 +412,12 @@ def getWidgetFromParameter(self, param):
item = QtGui.QComboBox()
item.setEditable(True)
extents = self.getExtents()
if self.canUseAutoExtent():
item.addItem(self.USE_MIN_COVERING_EXTENT, None)
for ex in extents:
item.addItem(ex.name(), ex)
item.setEditText(str(param.default))
item.addItem(ex.name(), ex)
if not self.canUseAutoExtent():
item.setEditText(str(param.default))
elif isinstance(param, ParameterFile):
item = QtGui.QComboBox()
item.setEditable(True)
Expand All @@ -431,6 +432,13 @@ def getWidgetFromParameter(self, param):
pass
return item

def canUseAutoExtent(self):
for param in self.alg.parameters:
if isinstance(param, (ParameterRaster, ParameterVector)):
return True
if isinstance(param, ParameterMultipleInput):
return True

def setTableContent(self):
params = self.alg.parameters
outputs = self.alg.outputs
Expand Down Expand Up @@ -549,7 +557,7 @@ def setParamValues(self):
return False
for output in outputs:
if output.hidden:
self.outputs[output.name] = None
self.outputs[output.name] = None
else:
name= unicode(self.valueItems[output.name].text())
if name.strip()!="" and name != ModelerParametersDialog.ENTER_NAME:
Expand All @@ -572,12 +580,6 @@ def setParamValueLayerOrTable(self, param, widget):
self.params[param.name] = value
return True

if widget.currentIndex() < 0:
return False
value = widget.itemData(widget.currentIndex()).toPyObject()
self.params[param.name] = value
return True

def setParamBooleanValue(self, param, widget):
if widget.currentIndex() < 2:
name = self.getSafeNameForHarcodedParameter(param)
Expand Down
2 changes: 2 additions & 0 deletions python/plugins/sextante/parameters/ParameterExtent.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

class ParameterExtent(Parameter):

USE_MIN_COVERING_EXTENT = "USE_MIN_COVERING_EXTENT"

def __init__(self, name="", description="", default="0,1,0,1"):
Parameter.__init__(self, name, description)
self.default = default
Expand Down

This file was deleted.

8 changes: 0 additions & 8 deletions python/plugins/sextante/saga/description/TrendAnalysis.txt

This file was deleted.

5 changes: 2 additions & 3 deletions python/plugins/sextante/script/ScriptAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
* *
***************************************************************************
"""
from sextante.outputs.OutputNumber import OutputNumber
from sextante.outputs.OutputString import OutputString

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
Expand All @@ -36,6 +33,8 @@
from sextante.outputs.OutputTable import OutputTable
from sextante.outputs.OutputVector import OutputVector
from sextante.outputs.OutputRaster import OutputRaster
from sextante.outputs.OutputNumber import OutputNumber
from sextante.outputs.OutputString import OutputString
from sextante.parameters.ParameterString import ParameterString
from sextante.parameters.ParameterNumber import ParameterNumber
from sextante.parameters.ParameterBoolean import ParameterBoolean
Expand Down