Skip to content

Commit

Permalink
[processing] improvements in help for algorithms
Browse files Browse the repository at this point in the history
Avoid creating temporary helpfiles
Added basic converter to convert rst into html on the fly
Added SAGA help files
  • Loading branch information
volaya committed Apr 19, 2014
1 parent 9b277cb commit bce5b89
Show file tree
Hide file tree
Showing 249 changed files with 9,145 additions and 75 deletions.
7 changes: 3 additions & 4 deletions python/plugins/processing/algs/grass/GrassAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,13 @@ def getCopy(self):
def getIcon(self):
return QIcon(os.path.dirname(__file__) + '/../../images/grass.png')

def helpFile(self):
return 'http://grass.osgeo.org/grass64/manuals/' + self.grassName \
+ '.html'
def help(self):
return False, 'http://grass.osgeo.org/grass64/manuals/' + self.grassName + '.html'

def getParameterDescriptions(self):
descs = {}
try:
helpfile = self.helpFile()
_, helpfile = self.help()
except WrongHelpFileException:
return descs
if helpfile:
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/otb/OTBAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ def getCopy(self):
def getIcon(self):
return PyQt4.QtGui.QIcon(os.path.dirname(__file__) + "/../../images/otb.png")

def helpFile(self):
def help(self):
folder = os.path.join( OTBUtils.otbDescriptionPath(), 'doc' )
helpfile = os.path.join( str(folder), self.appkey + ".html")
if os.path.exists(helpfile):
return helpfile
return False, helpfile
else:
raise WrongHelpFileException("Could not find help file for this algorithm. \nIf you have it put it in: \n"+str(folder))

Expand Down
7 changes: 3 additions & 4 deletions python/plugins/processing/algs/r/RAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from processing.core.GeoAlgorithmExecutionException import \
GeoAlgorithmExecutionException
from processing.core.ProcessingLog import ProcessingLog
from processing.gui.Help2Html import Help2Html
from processing.gui.Help2Html import getHtmlFromHelpFile
from processing.parameters.ParameterRaster import ParameterRaster
from processing.parameters.ParameterTable import ParameterTable
from processing.parameters.ParameterVector import ParameterVector
Expand Down Expand Up @@ -401,11 +401,10 @@ def getImportCommands(self):
def getRCommands(self):
return self.commands

def helpFile(self):
def help(self):
helpfile = unicode(self.descriptionFile) + '.help'
if os.path.exists(helpfile):
h2h = Help2Html()
return h2h.getHtmlFile(self, helpfile)
return True, getHtmlFromHelpFile(self, helpfile)
else:
return None

Expand Down
13 changes: 10 additions & 3 deletions python/plugins/processing/algs/saga/SagaAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from processing.gui.Help2Html import getHtmlFromRstFile

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
Expand Down Expand Up @@ -501,9 +502,15 @@ def checkParameterValuesBeforeExecuting(self):
+ ' has more than one band.\n' \
+ 'Multiband layers are not supported by SAGA'

def helpFile(self):
return os.path.join(os.path.dirname(__file__), 'help',
self.name.replace(' ', '') + '.html')
def help(self):
name = self.cmdname.lower()
validChars = 'abcdefghijklmnopqrstuvwxyz'
name = ''.join(c for c in name if c in validChars)
html = getHtmlFromRstFile(os.path.join(os.path.dirname(__file__), 'help',
name + '.rst'))
imgpath = os.path.join(os.path.dirname(__file__),os.pardir, os.pardir, 'images', 'saga100x100.jpg')
html = ('<img src="%s"/>' % imgpath) + html
return True, html

def getPostProcessingErrorMessage(self, wrongLayers):
html = GeoAlgorithm.getPostProcessingErrorMessage(self, wrongLayers)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
ACCUMULATED COST (ANISOTROPIC)
==============================

Description
-----------

Parameters
----------

- ``Cost Grid[Raster]``:
- ``Direction of max cost[Raster]``:
- ``Destination Points[Raster]``:
- ``k factor[Number]``:
- ``Threshold for different route[Number]``:

Outputs
-------

- ``Accumulated Cost[Raster]``:

See also
---------


Console usage
-------------


::

sextante.runalg('saga:accumulatedcostanisotropic', cost, direction, points, k, threshold, acccost)
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
ACCUMULATED COST (ISOTROPIC)
============================

Description
-----------

Parameters
----------

- ``Cost Grid[Raster]``:
- ``Destination Points[Raster]``:
- ``Threshold for different route[Number]``:

Outputs
-------

- ``Accumulated Cost[Raster]``:
- ``Closest Point[Raster]``:

See also
---------


Console usage
-------------


::

sextante.runalg('saga:accumulatedcostisotropic', cost, points, threshold, acccost, closestpt)
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
ADD COORDINATES TO POINTS
=========================

Description
-----------
This algorithm adds the X and Y coordinates in the attribute table.

Parameters
----------

- ``Points[Vector]``: input points layer

Outputs
-------

- ``Output[Vector]``: resulting layer with the updated attribute table.

See also
---------


Console usage
-------------


::

sextante.runalg('saga:addcoordinatestopoints', input, output)
44 changes: 44 additions & 0 deletions python/plugins/processing/algs/saga/help/addgridvaluestopoints.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
ADD GRID VALUES TO POINTS
=========================

Description
-----------
This algorithm creates a new vector layer as a result of the union of a points layer with the interpolated value of one or more base background grid layer/s. This way, the new layer created will have a new column in the attribute table that reflects the interpolated value of the background grid.
There are several interpolation methods available:
- nearest neighbor
- bilinear interpolation
- inverse distance interpolation
- bicubic spline interpolation
- b-spline interpolation
Parameters