Skip to content

Commit

Permalink
reorganized native algorithms into one single group
Browse files Browse the repository at this point in the history
  • Loading branch information
volaya committed Dec 19, 2012
1 parent ae57418 commit 98e9c27
Show file tree
Hide file tree
Showing 141 changed files with 771 additions and 755 deletions.
11 changes: 0 additions & 11 deletions python/plugins/sextante/add_weights_to_r.neighbors.patch

This file was deleted.

8 changes: 5 additions & 3 deletions python/plugins/sextante/algs/AddTableField.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ class AddTableField(GeoAlgorithm):
TYPE_NAMES = ["Integer", "Float", "String"]
TYPES = [QVariant.Int, QVariant.Double, QVariant.String]

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

def defineCharacteristics(self):
self.name = "Add field to attributes table"
self.group = "Algorithms for vector layers"
self.group = "Vector table tools"
self.addParameter(ParameterVector(self.INPUT_LAYER, "Input layer", ParameterVector.VECTOR_TYPE_ANY, False))
self.addParameter(ParameterString(self.FIELD_NAME, "Field name"))
self.addParameter(ParameterSelection(self.FIELD_TYPE, "Field type", self.TYPE_NAMES))
Expand Down
8 changes: 5 additions & 3 deletions python/plugins/sextante/algs/AutoincrementalField.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ class AutoincrementalField(GeoAlgorithm):
INPUT = "INPUT"
OUTPUT = "OUTPUT"

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

def processAlgorithm(self, progress):
output = self.getOutputFromName(self.OUTPUT)
Expand Down Expand Up @@ -67,7 +69,7 @@ def processAlgorithm(self, progress):

def defineCharacteristics(self):
self.name = "Add autoincremental field"
self.group = "Algorithms for vector layers"
self.group = "Vector table tools"
self.addParameter(ParameterVector(self.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_ANY))
self.addOutput(OutputVector(self.OUTPUT, "Output layer"))

3 changes: 3 additions & 0 deletions python/plugins/sextante/algs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
FILE(GLOB PY_FILES *.py)

ADD_SUBDIRECTORY(mmqgisx)
ADD_SUBDIRECTORY(ftools)

PLUGIN_INSTALL(sextante ./algs ${PY_FILES})
8 changes: 5 additions & 3 deletions python/plugins/sextante/algs/EquivalentNumField.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ class EquivalentNumField(GeoAlgorithm):
OUTPUT = "OUTPUT"
FIELD = "FIELD"

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

def processAlgorithm(self, progress):
fieldname = self.getParameterValue(self.FIELD)
Expand Down Expand Up @@ -80,7 +82,7 @@ def processAlgorithm(self, progress):

def defineCharacteristics(self):
self.name = "Create equivalent numerical field"
self.group = "Algorithms for vector layers"
self.group = "Vector table tools"
self.addParameter(ParameterVector(self.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_ANY))
self.addParameter(ParameterTableField(self.FIELD, "Class field", self.INPUT))
self.addOutput(OutputVector(self.OUTPUT, "Output layer"))
Expand Down
8 changes: 5 additions & 3 deletions python/plugins/sextante/algs/Explode.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ class Explode(GeoAlgorithm):
INPUT = "INPUT"
OUTPUT = "OUTPUT"

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

def processAlgorithm(self, progress):
vlayer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT))
Expand Down Expand Up @@ -88,7 +90,7 @@ def getPolylineAsSingleSegments(self, polyline):

def defineCharacteristics(self):
self.name = "Explode lines"
self.group = "Algorithms for vector layers"
self.group = "Vector geometry tools"
self.addParameter(ParameterVector(self.INPUT, "Input layer",ParameterVector.VECTOR_TYPE_LINE))
self.addOutput(OutputVector(self.OUTPUT, "Output layer"))

10 changes: 6 additions & 4 deletions python/plugins/sextante/algs/FieldPyculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ class FieldsPyculator(GeoAlgorithm):
OUTPUT_LAYER ="OUTPUT_LAYER"
RESULT_VAR_NAME = "value"

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

def defineCharacteristics(self):
self.name = "Field Pyculator"
self.group = "Algorithms for vector layers"
self.name = "Advanced Python field calculator"
self.group = "Vector table tools"
self.addParameter(ParameterVector(self.INPUT_LAYER, "Input layer", ParameterVector.VECTOR_TYPE_ANY, False))
self.addParameter(ParameterBoolean(self.USE_SELECTED, "Use only selected features (all if noone selected)", False))
self.addParameter(ParameterString(self.FIELD_NAME, "Result field name", "NewField"))
Expand Down
8 changes: 5 additions & 3 deletions python/plugins/sextante/algs/FieldsCalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ class FieldsCalculator(GeoAlgorithm):
FORMULA = "FORMULA"
OUTPUT_LAYER ="OUTPUT_LAYER"

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

def defineCharacteristics(self):
self.name = "Field calculator"
self.group = "Algorithms for vector layers"
self.group = "Vector table tools"
self.addParameter(ParameterVector(self.INPUT_LAYER, "Input layer", ParameterVector.VECTOR_TYPE_ANY, False))
self.addParameter(ParameterString(self.FIELD_NAME, "Result field name"))
self.addParameter(ParameterString(self.FORMULA, "Formula"))
Expand Down
147 changes: 147 additions & 0 deletions python/plugins/sextante/algs/QGISAlgorithmProvider.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
SextanteAlgorithmProvider.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""

__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$'

from sextante.algs.ftools.PointsInPolygon import PointsInPolygon
from sextante.algs.ftools.PointsInPolygonUnique import PointsInPolygonUnique
from sextante.algs.ftools.PointsInPolygonWeighted import PointsInPolygonWeighted
from sextante.algs.ftools.SumLines import SumLines
from sextante.algs.ftools.BasicStatisticsNumbers import BasicStatisticsNumbers
from sextante.algs.ftools.BasicStatisticsStrings import BasicStatisticsStrings
from sextante.algs.ftools.NearestNeighbourAnalysis import NearestNeighbourAnalysis
from sextante.algs.ftools.LinesIntersection import LinesIntersection
from sextante.algs.ftools.MeanCoords import MeanCoords
from sextante.algs.ftools.PointDistance import PointDistance
from sextante.algs.ftools.UniqueValues import UniqueValues
from sextante.algs.ftools.ReprojectLayer import ReprojectLayer
from sextante.algs.ftools.ExportGeometryInfo import ExportGeometryInfo
from sextante.algs.ftools.Centroids import Centroids
from sextante.algs.ftools.Delaunay import Delaunay
from sextante.algs.ftools.VoronoiPolygons import VoronoiPolygons
from sextante.algs.ftools.DensifyGeometries import DensifyGeometries
from sextante.algs.ftools.MultipartToSingleparts import MultipartToSingleparts
from sextante.algs.ftools.SimplifyGeometries import SimplifyGeometries
from sextante.algs.ftools.LinesToPolygons import LinesToPolygons
from sextante.algs.ftools.PolygonsToLines import PolygonsToLines
from sextante.algs.ftools.SinglePartsToMultiparts import SinglePartsToMultiparts
from sextante.algs.ftools.ExtractNodes import ExtractNodes
from sextante.algs.ftools.ConvexHull import ConvexHull
from sextante.algs.ftools.FixedDistanceBuffer import FixedDistanceBuffer
from sextante.algs.ftools.VariableDistanceBuffer import VariableDistanceBuffer
from sextante.algs.ftools.Clip import Clip
from sextante.algs.ftools.Difference import Difference
from sextante.algs.ftools.Dissolve import Dissolve
from sextante.algs.ftools.Intersection import Intersection
from sextante.algs.ftools.ExtentFromLayer import ExtentFromLayer
from sextante.algs.ftools.RandomSelection import RandomSelection
from sextante.algs.ftools.RandomSelectionWithinSubsets import RandomSelectionWithinSubsets
from sextante.algs.ftools.SelectByLocation import SelectByLocation
from sextante.algs.ftools.Union import Union
from sextante.algs.ftools.DensifyGeometriesInterval import DensifyGeometriesInterval
from sextante.algs.mmqgisx.MMQGISXAlgorithms import mmqgisx_attribute_export_algorithm,\
mmqgisx_attribute_join_algorithm, mmqgisx_delete_columns_algorithm,\
mmqgisx_delete_duplicate_geometries_algorithm,\
mmqgisx_geocode_google_algorithm, mmqgisx_geometry_convert_algorithm,\
mmqgisx_geometry_export_algorithm, mmqgisx_geometry_import_algorithm,\
mmqgisx_grid_algorithm, mmqgisx_gridify_algorithm,\
mmqgisx_hub_distance_algorithm, mmqgisx_hub_lines_algorithm,\
mmqgisx_label_point_algorithm, mmqgisx_merge_algorithm,\
mmqgisx_select_algorithm, mmqgisx_sort_algorithm,\
mmqgisx_text_to_float_algorithm, mmqgisx_voronoi_algorithm

from sextante.algs.EquivalentNumField import EquivalentNumField
from sextante.core.AlgorithmProvider import AlgorithmProvider
from sextante.algs.AddTableField import AddTableField
from PyQt4 import QtGui
import os
from sextante.algs.FieldsCalculator import FieldsCalculator
from sextante.algs.SaveSelectedFeatures import SaveSelectedFeatures
from sextante.algs.Explode import Explode
from sextante.algs.AutoincrementalField import AutoincrementalField
from sextante.algs.FieldPyculator import FieldsPyculator

class QGISAlgorithmProvider(AlgorithmProvider):

def __init__(self):
AlgorithmProvider.__init__(self)
self.alglist = [AddTableField(), FieldsCalculator(), SaveSelectedFeatures(),
AutoincrementalField(), Explode(), FieldsPyculator(), EquivalentNumField(),
#FTOOLS
SumLines(), PointsInPolygon(), PointsInPolygonWeighted(), PointsInPolygonUnique(),
BasicStatisticsStrings(), BasicStatisticsNumbers(), NearestNeighbourAnalysis(),
MeanCoords(), LinesIntersection(), UniqueValues(), PointDistance(),
# data management
ReprojectLayer(),
# geometry
ExportGeometryInfo(), Centroids(), Delaunay(), VoronoiPolygons(),
SimplifyGeometries(), DensifyGeometries(), DensifyGeometriesInterval(),
MultipartToSingleparts(), SinglePartsToMultiparts(), PolygonsToLines(),
LinesToPolygons(), ExtractNodes(),
# geoprocessing
ConvexHull(), FixedDistanceBuffer(), VariableDistanceBuffer(),
Dissolve(), Difference(), Intersection(), Union(), Clip(),
# research
ExtentFromLayer(), RandomSelection(), RandomSelectionWithinSubsets(),
SelectByLocation(),
#MMQGISX
mmqgisx_attribute_export_algorithm(),
mmqgisx_attribute_join_algorithm(),
mmqgisx_delete_columns_algorithm(),
mmqgisx_delete_duplicate_geometries_algorithm(),
mmqgisx_geocode_google_algorithm(),
mmqgisx_geometry_convert_algorithm(),
mmqgisx_geometry_export_algorithm(),
#mmqgisx_geometry_import_algorithm(),
mmqgisx_grid_algorithm(),
mmqgisx_gridify_algorithm(),
mmqgisx_hub_distance_algorithm(),
mmqgisx_hub_lines_algorithm(),
mmqgisx_label_point_algorithm(),
mmqgisx_merge_algorithm(),
mmqgisx_select_algorithm(),
mmqgisx_sort_algorithm(),
mmqgisx_text_to_float_algorithm()]

def initializeSettings(self):
AlgorithmProvider.initializeSettings(self)


def unload(self):
AlgorithmProvider.unload(self)


def getName(self):
return "qgis"

def getDescription(self):
return "QGIS geoalgorithms"

def getIcon(self):
return QtGui.QIcon(os.path.dirname(__file__) + "/../images/qgis.png")

def _loadAlgorithms(self):
self.algs = self.alglist

def supportsNonFileBasedOutput(self):
return True
8 changes: 5 additions & 3 deletions python/plugins/sextante/algs/SaveSelectedFeatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,18 @@ def defineCharacteristics(self):
self.name = "Create new layer with selected features"

#the branch of the toolbox under which the algorithm will appear
self.group = "Algorithms for vector layers"
self.group = "Vector general tools"

#we add the input vector layer. It can have any kind of geometry
#It is a mandatory (not optional) one, hence the False argument
self.addParameter(ParameterVector(self.INPUT_LAYER, "Input layer", ParameterVector.VECTOR_TYPE_ANY, False))
# we add a vector layer as output
self.addOutput(OutputVector(self.OUTPUT_LAYER, "Output layer with selected features"))

def getIcon(self):
return QIcon(os.path.dirname(__file__) + "/../images/toolbox.png")
#===========================================================================
# def getIcon(self):
# return QIcon(os.path.dirname(__file__) + "/../images/qgis.png")
#===========================================================================

def processAlgorithm(self, progress):
'''Here is where the processing itself takes place'''
Expand Down
64 changes: 0 additions & 64 deletions python/plugins/sextante/algs/SextanteAlgorithmProvider.py

This file was deleted.

Loading

0 comments on commit 98e9c27

Please sign in to comment.