Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge linfiniti2:/tmp/sextante-clone into sextante-import
- Loading branch information
Showing
2,080 changed files
with
86,200 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#Sat Jul 28 13:07:03 CEST 2012 | ||
eclipse.preferences.version=1 | ||
encoding//src/sextante/ftools/ftools_utils.py=utf-8 | ||
encoding//src/sextante/gui/AlgorithmExecutionDialog.py=latin1 | ||
encoding//src/sextante/gui/ParametersDialog.py=latin1 | ||
encoding//src/sextante/gui/ui_ParametersDialog.py=utf-8 | ||
encoding//src/sextante/gui/ui_SextanteToolbox.py=utf-8 | ||
encoding//src/sextante/resources.py=utf-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<project name="SEXTANTE_LIB" default="copy" basedir="."> | ||
<description> | ||
SEXTANTE | ||
</description> | ||
<property name="version.number" value="1.0"/> | ||
<target name="copy" | ||
description="copy files"> | ||
<copy todir="C:/Users/volaya/.qgis/python/plugins"> | ||
<fileset dir="src" includes="**"/> | ||
</copy> | ||
</target> | ||
</project> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*~ | ||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
from PyQt4.QtCore import * | ||
from PyQt4.QtGui import * | ||
from qgis.core import * | ||
import os, sys | ||
import inspect | ||
from sextante.core.Sextante import Sextante | ||
from sextante.gui.SextanteToolbox import SextanteToolbox | ||
from sextante.core.QGisLayers import QGisLayers | ||
from sextante.gui.HistoryDialog import HistoryDialog | ||
from sextante.core.SextanteUtils import SextanteUtils | ||
from sextante.gui.ConfigDialog import ConfigDialog | ||
from sextante.modeler.ModelerDialog import ModelerDialog | ||
from sextante.gui.ResultsDialog import ResultsDialog | ||
from sextante.about.AboutDialog import AboutDialog | ||
import subprocess | ||
|
||
cmd_folder = os.path.split(inspect.getfile( inspect.currentframe() ))[0] | ||
if cmd_folder not in sys.path: | ||
sys.path.insert(0, cmd_folder) | ||
|
||
class SextantePlugin: | ||
|
||
def __init__(self, iface): | ||
self.iface = iface | ||
QGisLayers.setInterface(iface) | ||
Sextante.initialize() | ||
Sextante.setInterface(iface) | ||
|
||
def initGui(self): | ||
self.toolbox = SextanteToolbox(self.iface) | ||
self.toolbox.setVisible(False) | ||
Sextante.addAlgListListener(self.toolbox) | ||
|
||
self.menu = QMenu(self.iface.mainWindow()) | ||
self.menu.setTitle("Analysis") | ||
|
||
icon = QIcon(os.path.dirname(__file__) + "/images/toolbox.png") | ||
self.toolboxAction = QAction(icon, \ | ||
"&SEXTANTE Toolbox", self.iface.mainWindow()) | ||
QObject.connect(self.toolboxAction, SIGNAL("triggered()"), self.openToolbox) | ||
self.menu.addAction(self.toolboxAction) | ||
|
||
icon = QIcon(os.path.dirname(__file__) + "/images/model.png") | ||
self.modelerAction = QAction(icon, \ | ||
"&SEXTANTE Modeler", self.iface.mainWindow()) | ||
QObject.connect(self.modelerAction, SIGNAL("triggered()"), self.openModeler) | ||
self.menu.addAction(self.modelerAction) | ||
|
||
icon = QIcon(os.path.dirname(__file__) + "/images/history.gif") | ||
self.historyAction = QAction(icon, \ | ||
"&SEXTANTE History and log", self.iface.mainWindow()) | ||
QObject.connect(self.historyAction, SIGNAL("triggered()"), self.openHistory) | ||
self.menu.addAction(self.historyAction) | ||
|
||
icon = QIcon(os.path.dirname(__file__) + "/images/config.png") | ||
self.configAction = QAction(icon, \ | ||
"&SEXTANTE options and configuration", self.iface.mainWindow()) | ||
QObject.connect(self.configAction, SIGNAL("triggered()"), self.openConfig) | ||
self.menu.addAction(self.configAction) | ||
|
||
icon = QIcon(os.path.dirname(__file__) + "/images/results.png") | ||
self.resultsAction = QAction(icon, \ | ||
"&SEXTANTE results viewer", self.iface.mainWindow()) | ||
QObject.connect(self.resultsAction, SIGNAL("triggered()"), self.openResults) | ||
self.menu.addAction(self.resultsAction) | ||
|
||
icon = QIcon(os.path.dirname(__file__) + "/images/help.png") | ||
self.helpAction = QAction(icon, \ | ||
"&SEXTANTE help", self.iface.mainWindow()) | ||
QObject.connect(self.helpAction, SIGNAL("triggered()"), self.openHelp) | ||
self.menu.addAction(self.helpAction) | ||
|
||
icon = QIcon(os.path.dirname(__file__) + "/images/info.png") | ||
self.aboutAction = QAction(icon, \ | ||
"&About SEXTANTE", self.iface.mainWindow()) | ||
QObject.connect(self.aboutAction, SIGNAL("triggered()"), self.openAbout) | ||
self.menu.addAction(self.aboutAction) | ||
|
||
menuBar = self.iface.mainWindow().menuBar() | ||
menuBar.insertMenu(menuBar.actions()[-1], self.menu) | ||
|
||
def unload(self): | ||
self.toolbox.setVisible(False) | ||
self.menu.deleteLater() | ||
#delete temporary output files | ||
folder = SextanteUtils.tempFolder() | ||
for f in os.listdir(folder): | ||
path = os.path.join(folder,f) | ||
try: | ||
os.unlink(path) | ||
except: | ||
#leave files that could not be deleted | ||
pass | ||
|
||
|
||
def openToolbox(self): | ||
self.toolbox.setVisible(True) | ||
|
||
def openModeler(self): | ||
dlg = ModelerDialog() | ||
dlg.exec_() | ||
if dlg.update: | ||
self.toolbox.updateTree() | ||
|
||
def openResults(self): | ||
dlg = ResultsDialog() | ||
dlg.exec_() | ||
|
||
def openHistory(self): | ||
dlg = HistoryDialog() | ||
dlg.exec_() | ||
|
||
def openConfig(self): | ||
dlg = ConfigDialog(self.toolbox) | ||
dlg.exec_() | ||
|
||
def openAbout(self): | ||
dlg = AboutDialog() | ||
dlg.exec_() | ||
|
||
def openHelp(self): | ||
filename = os.path.dirname(__file__) + "/help/index.html" | ||
if os.name == "nt": | ||
os.startfile(filename) | ||
elif sys.platform == "darwin": | ||
subprocess.Popen(('open', filename)) | ||
else: | ||
subprocess.call(('xdg-open', filename)) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
def name(): | ||
return "SEXTANTE" | ||
def description(): | ||
return "SEXTANTE Geoprocessing Platform for QGIS" | ||
def version(): | ||
return "Version 1.0.7" | ||
def icon(): | ||
return "icon.png" | ||
def qgisMinimumVersion(): | ||
return "1.0" | ||
def classFactory(iface): | ||
from sextante.SextantePlugin import SextantePlugin | ||
return SextantePlugin(iface) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from PyQt4 import QtCore, QtGui, QtWebKit | ||
from PyQt4.QtCore import * | ||
from PyQt4.QtGui import * | ||
import os | ||
|
||
class AboutDialog(QtGui.QDialog): | ||
|
||
def __init__(self): | ||
QtGui.QDialog.__init__(self) | ||
self.setModal(True) | ||
self.setupUi() | ||
|
||
def setupUi(self): | ||
self.resize(600, 500) | ||
self.webView = QtWebKit.QWebView() | ||
self.setWindowTitle("About SEXTANTE") | ||
self.verticalLayout= QtGui.QVBoxLayout() | ||
self.verticalLayout.setSpacing(2) | ||
self.verticalLayout.setMargin(0) | ||
self.verticalLayout.addWidget(self.webView) | ||
self.closeButton = QtGui.QPushButton() | ||
self.closeButton.setText("Close") | ||
self.closeButton.setMaximumWidth(150) | ||
self.horizontalLayout= QtGui.QHBoxLayout() | ||
self.horizontalLayout.setSpacing(2) | ||
self.horizontalLayout.setMargin(0) | ||
self.horizontalLayout.addStretch(1000) | ||
self.horizontalLayout.addWidget(self.closeButton) | ||
QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), self.closeWindow) | ||
self.verticalLayout.addLayout(self.horizontalLayout) | ||
self.setLayout(self.verticalLayout) | ||
filename = os.path.dirname(__file__) + "/about.htm" | ||
url = QtCore.QUrl(filename) | ||
self.webView.load(url) | ||
|
||
def closeWindow(self): | ||
self.close() |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head> | ||
<title>SEXTANTE</title> | ||
</head> | ||
<body> | ||
<img src="sextante_logo.png" /> | ||
<h2>SEXTANTE for QGIS</h2> | ||
<p>SEXTANTE, a geoprocessing platform for QGIS</p> | ||
<p>A development by Victor Olaya (volayaf@gmail.com).</p> | ||
<p>Portions of this software contributed by: | ||
<ul> | ||
<li>Michael Nimm (mmqgis algorithms)</li> | ||
<li>Carson Farmer (fTools algorithms)</li> | ||
<li>Julien Malik (Orfeo Toolbox connectors)</li> | ||
<li>Camilo Polymeris (Threading). Developed as part of Google Summer of Code 2012</li> | ||
</ul> | ||
</p> | ||
<p>You are currently using SEXTANTE v1.0.7</p> | ||
<p>This software is distributed under the terms of the GNU GPL License v2. | ||
<p>For more information, please visit our website at <a href="http://sextantegis.com">http://sextantegis.com</a></p> | ||
</body> | ||
</html> |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
from sextante.core.GeoAlgorithm import GeoAlgorithm | ||
from sextante.outputs.OutputVector import OutputVector | ||
from sextante.parameters.ParameterVector import ParameterVector | ||
from qgis.core import * | ||
from PyQt4.QtCore import * | ||
from PyQt4.QtGui import * | ||
from sextante.parameters.ParameterString import ParameterString | ||
from sextante.parameters.ParameterSelection import ParameterSelection | ||
from sextante.core.QGisLayers import QGisLayers | ||
import os | ||
from PyQt4 import QtGui | ||
|
||
|
||
class AddTableField(GeoAlgorithm): | ||
|
||
OUTPUT_LAYER = "OUTPUT_LAYER" | ||
INPUT_LAYER = "INPUT_LAYER" | ||
FIELD_NAME = "FIELD_NAME" | ||
FIELD_TYPE = "FIELD_TYPE" | ||
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 defineCharacteristics(self): | ||
self.name = "Add field to attributes table" | ||
self.group = "Algorithms for vector layers" | ||
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)) | ||
self.addOutput(OutputVector(self.OUTPUT_LAYER, "Output layer")) | ||
|
||
def processAlgorithm(self, progress): | ||
fieldtype = self.getParameterValue(self.FIELD_TYPE) | ||
fieldname = self.getParameterValue(self.FIELD_NAME) | ||
settings = QSettings() | ||
systemEncoding = settings.value( "/UI/encoding", "System" ).toString() | ||
output = self.getOutputValue(self.OUTPUT_LAYER) | ||
vlayer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT_LAYER)) | ||
vprovider = vlayer.dataProvider() | ||
allAttrs = vprovider.attributeIndexes() | ||
vprovider.select( allAttrs ) | ||
fields = vprovider.fields() | ||
fields[len(fields)] = QgsField(fieldname, self.TYPES[fieldtype]) | ||
writer = QgsVectorFileWriter( output, systemEncoding,fields, vprovider.geometryType(), vprovider.crs() ) | ||
inFeat = QgsFeature() | ||
outFeat = QgsFeature() | ||
inGeom = QgsGeometry() | ||
nFeat = vprovider.featureCount() | ||
nElement = 0 | ||
while vprovider.nextFeature(inFeat): | ||
progress.setPercentage(int((100 * nElement)/nFeat)) | ||
nElement += 1 | ||
inGeom = inFeat.geometry() | ||
outFeat.setGeometry( inGeom ) | ||
atMap = inFeat.attributeMap() | ||
outFeat.setAttributeMap( atMap ) | ||
outFeat.addAttribute( len(vprovider.fields()), QVariant() ) | ||
writer.addFeature( outFeat ) | ||
del writer | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from sextante.core.GeoAlgorithm import GeoAlgorithm | ||
from PyQt4.QtCore import * | ||
from qgis.core import * | ||
from sextante.parameters.ParameterVector import ParameterVector | ||
from sextante.core.QGisLayers import QGisLayers | ||
from sextante.outputs.OutputVector import OutputVector | ||
import os | ||
from PyQt4 import QtGui | ||
|
||
class AutoincrementalField(GeoAlgorithm): | ||
|
||
INPUT = "INPUT" | ||
OUTPUT = "OUTPUT" | ||
|
||
def getIcon(self): | ||
return QtGui.QIcon(os.path.dirname(__file__) + "/../images/toolbox.png") | ||
|
||
def processAlgorithm(self, progress): | ||
settings = QSettings() | ||
systemEncoding = settings.value( "/UI/encoding", "System" ).toString() | ||
output = self.getOutputValue(self.OUTPUT) | ||
vlayer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT)) | ||
vprovider = vlayer.dataProvider() | ||
allAttrs = vprovider.attributeIndexes() | ||
vprovider.select( allAttrs ) | ||
fields = vprovider.fields() | ||
fields[len(fields)] = QgsField("AUTO", QVariant.Int) | ||
writer = QgsVectorFileWriter( output, systemEncoding,fields, vprovider.geometryType(), vprovider.crs() ) | ||
inFeat = QgsFeature() | ||
outFeat = QgsFeature() | ||
inGeom = QgsGeometry() | ||
nFeat = vprovider.featureCount() | ||
nElement = 0 | ||
while vprovider.nextFeature(inFeat): | ||
progress.setPercentage(int((100 * nElement)/nFeat)) | ||
nElement += 1 | ||
inGeom = inFeat.geometry() | ||
outFeat.setGeometry( inGeom ) | ||
atMap = inFeat.attributeMap() | ||
outFeat.setAttributeMap( atMap ) | ||
outFeat.addAttribute( len(vprovider.fields()), QVariant(nElement) ) | ||
writer.addFeature( outFeat ) | ||
del writer | ||
|
||
def defineCharacteristics(self): | ||
self.name = "Add autoincremental field" | ||
self.group = "Algorithms for vector layers" | ||
self.addParameter(ParameterVector(self.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_ANY)) | ||
self.addOutput(OutputVector(self.OUTPUT, "Output layer")) | ||
|
Oops, something went wrong.