Skip to content
Permalink
Browse files
importing sextante for qgis plugin
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@6 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
volayaf@gmail.com committed Jan 7, 2012
0 parents commit 5d97e5563fd41990c14c816faea59e53f275bd1a
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>sextante</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse-pydev version="1.0"?>

<pydev_project>
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
<path>/sextante/src</path>
</pydev_pathproperty>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
</pydev_project>
@@ -0,0 +1,11 @@
from core.Sextante import Sextante


def main():
sextante = Sextante()
print(str(sextante))



if __name__ == '__main__':
main()
@@ -0,0 +1,5 @@
class AlgorithmProvider():

@property
def algs(self):
return self._algs
@@ -0,0 +1,73 @@
from outputs.Output import Output
from parameters.Parameter import Parameter

class GeoAlgorithm:

def __init__(self):
self.parameters = {}
self.outputs = {}
self.name = ""
self.group = ""
self.defineCharacteristics()

def execute(self):
if self.checkParameters():
self.proccessAlgorithm()


def checkParameters(self):
#TODO!!!!!!
return True

def defineCharacteristics(self):
pass

def processAlgorithm(self):
pass

@property
def outputs(self):
return self._outputs

@property
def parameters(self):
return self._parameters

@property
def group(self):
return self._group

@group.setter
def group(self, g):
self._group = g

@property
def name(self):
return self._name

@name.setter
def name(self, name):
self._name = name

def putOutput(self, output):
if isinstance(output, Output):
self.outputs[output.name] = output


def putParameter(self, param):
if isinstance(param, Parameter):
self.parameters[param.name] = param

def setParameterValue(self, paramName, value):
param = self.parameters[paramName]
if param != None:
param.value = value

def __str__(self):
s = "ALGORITHM: " + self.name + "\n"
for param in self.parameters.values():
s+=(str(param) + "\n")
for out in self.outputs.values():
s+=(str(out) + "\n")
s+=("\n")
return s
@@ -0,0 +1,62 @@
from saga.SagaAlgorithmProvider import SagaAlgorithmProvider
import os

class Sextante:

def __init__(self):
self._providers = [SagaAlgorithmProvider()]
self._algs = {}
self.loadAlgorithms()


def loadAlgorithms(self):
for provider in self._providers:
algs = provider.algs
for alg in algs:
self._algs[alg.name] = alg

def getAlgorithm(self, name):
return self._algs[name]

@property
def algs(self):
return self._algs

def __str__(self):
s=""
for alg in self.algs.values():
s+=(str(alg) + "\n")
s+=str(len(self.algs)) + " algorithms"
return s


@staticmethod
def isWindows():
return True


@staticmethod
def userFolder():
userfolder = os.getenv('HOME') + os.sep + "sextante"
mkdir(userfolder)

return userfolder



def mkdir(newdir):
if os.path.isdir(newdir):
pass
else:
head, tail = os.path.split(newdir)
if head and not os.path.isdir(head):
mkdir(head)
if tail:
os.mkdir(newdir)







@@ -0,0 +1,11 @@
class SextanteUtils:

@staticmethod
def setTempOutput(out):
pass

@staticmethod
def tempfolder():
pass


Empty file.
@@ -0,0 +1,38 @@
class Output:

@property
def value(self):
return self._value

@value.setter
def value(self, value):
self._value = value

@property
def name(self):
return self._name

@name.setter
def name(self, name):
self._name = name

@property
def description(self):
return self._description

@description.setter
def description(self, description):
self._description = description

@property
def channel(self):
return self._channel

@channel.setter
def channel(self, channel):
self._channel = channel


def __str__(self):
return self.name + " <" + self.__module__.split(".")[-1] +">"

@@ -0,0 +1,5 @@
from outputs.Output import Output

class OutputRaster(Output):
pass

@@ -0,0 +1,4 @@
from outputs.Output import Output

class OutputTable(Output):
pass
@@ -0,0 +1,4 @@
from outputs.Output import Output

class OutputVector(Output):
pass
Empty file.
@@ -0,0 +1,29 @@
class Parameter:

@property
def value(self):
return self._value

@value.setter
def value(self, value):
self._value = value

@property
def name(self):
return self._name

@name.setter
def name(self, name):
self._name = name

@property
def description(self):
return self._description

@description.setter
def description(self, description):
self._description = description

def __str__(self):
return self.name + " <" + self.__module__.split(".")[-1] + ">"

@@ -0,0 +1,4 @@
from parameters.Parameter import Parameter

class ParameterBoolean(Parameter):
pass
@@ -0,0 +1,12 @@
from parameters.Parameter import Parameter

class ParameterDataObject(Parameter):

@property
def optional(self):
return self._optional

@optional.setter
def optional(self, optional):
self._optional = optional

@@ -0,0 +1,27 @@
from parameters.Parameter import Parameter

class ParameterFixedTable(Parameter):

@property
def cols(self):
return self._cols

@cols.setter
def cols(self, cols):
self._cols = cols

@property
def fixedNumOfRows(self):
return self._fixedNumOfRows

@fixedNumOfRows.setter
def fixedNumOfRows(self, fixedNumOfRows):
self._fixedNumOfRows = fixedNumOfRows

@property
def numRows(self):
return self._numRows

@numRows.setter
def numRows(self, numRows):
self._numRows = numRows
@@ -0,0 +1,19 @@
from parameters.ParameterDataObject import ParameterDataObject

class ParameterMultipleInput(ParameterDataObject):

TYPE_VECTOR_POINT = 0
TYPE_VECTOR_LINE = 1
TYPE_VECTOR_POLYGON = 2
TYPE_VECTOR_ANY = 3
TYPE_RASTER = 4
TYPE_TABLE = 5


@property
def datatype(self):
return self._type

@datatype.setter
def datatype(self, shapetype):
self._type = type
@@ -0,0 +1,4 @@
from parameters.Parameter import Parameter

class ParameterNumber(Parameter):
pass
@@ -0,0 +1,4 @@
from parameters.ParameterDataObject import ParameterDataObject

class ParameterRaster(ParameterDataObject):
pass
@@ -0,0 +1,14 @@
from parameters.Parameter import Parameter

class ParameterSelection(Parameter):

@property
def options(self):
return self._options

@options.setter
def options(self, options):
self._options = options



@@ -0,0 +1,4 @@
from parameters.Parameter import Parameter

class ParameterString(Parameter):
pass
@@ -0,0 +1,5 @@
from parameters.ParameterDataObject import ParameterDataObject

class ParameterTable(ParameterDataObject):
pass

0 comments on commit 5d97e55

Please sign in to comment.