Skip to content
Snippets Groups Projects
Commit c6478a71 authored by Victor Poughon's avatar Victor Poughon
Browse files

CookBook: add label to AppRefDoc & remove unused file

parent 8b43da40
Branches
Tags
No related merge requests found
...@@ -422,8 +422,11 @@ def GetApplicationExamplePython(app,idx): ...@@ -422,8 +422,11 @@ def GetApplicationExamplePython(app,idx):
output+= linesep output+= linesep
return output return output
def RstHeading(text, delimiter): def RstHeading(text, delimiter, ref=None):
heading = text + linesep heading = ""
if ref:
heading += ".. _" + ref + ":" + linesep + linesep
heading += text + linesep
heading += delimiter * len(text) + linesep heading += delimiter * len(text) + linesep
heading += linesep heading += linesep
return heading return heading
...@@ -491,8 +494,8 @@ def GetApplicationTags(appname): ...@@ -491,8 +494,8 @@ def GetApplicationTags(appname):
import shutil import shutil
def RstPageHeading(text, maxdepth): def RstPageHeading(text, maxdepth, ref=None):
output = RstHeading(text, "=") + linesep output = RstHeading(text, "=", ref=ref) + linesep
output += ".. toctree::" + linesep output += ".. toctree::" + linesep
output += "\t:maxdepth: " + maxdepth + linesep output += "\t:maxdepth: " + maxdepth + linesep
output += linesep + linesep output += linesep + linesep
...@@ -502,53 +505,30 @@ def GenerateRstForApplications(): ...@@ -502,53 +505,30 @@ def GenerateRstForApplications():
out = "" out = ""
blackList = ["TestApplication", "Example", "ApplicationExample"] blackList = ["TestApplication", "Example", "ApplicationExample"]
allApps = None allApps = None
try: try:
allApps = otbApplication.Registry.GetAvailableApplications( ) allApps = otbApplication.Registry.GetAvailableApplications( )
except e: except e:
print 'error in otbApplication.Registry.GetAvailableApplications()' print 'error in otbApplication.Registry.GetAvailableApplications()'
sys.exit(1) sys.exit(1)
# appNames = [app for app in otbApplication.Registry.GetAvailableApplications() if app not in blackList]
if not allApps: if not allApps:
print 'No OTB applications available. Please check OTB_APPLICATION_PATH env variable' print 'No OTB applications available. Please check OTB_APPLICATION_PATH env variable'
sys.exit(1) sys.exit(1)
# sectionTags = ["Image Manipulation", writtenTags = []
# "Vector Data Manipulation",
# "Calibration","Geometry", "Image Filtering","Feature Extraction",
# "Stereo","Learning","Segmentation", "Miscellaneous"]
# for tag in sectionTags:
# #directory= "Applications/" + tag
# # if not os.path.exists(directory):
# # os.makedirs(directory)
# appIndexFile.write('\tApplications/' + tag.replace(' ', '_') + '.rst' + linese)
# #chapterIndexFile = open('Applications/' + tag + '.rst', 'w')
# #chapterIndexFile.write(RstPageHeading(tag))
# #print linesep + RstHeading(tag, '=')
#miscFile = open('Applications/Miscellaneous.rst', 'w')
# misctag = "Miscellaneous" #should this be Utilities
# if not os.path.exists("Applications/" + misctag):
# os.makedirs("Applications/" + misctag)
# appIndexFile.write('\tApplications/' + misctag + linesep)
writtenTags = []
appNames = [app for app in allApps if app not in blackList] appNames = [app for app in allApps if app not in blackList]
print "All apps: %s" % (appNames,) print "All apps: %s" % (appNames,)
appIndexFile = open(RST_DIR + '/Applications.rst', 'w') appIndexFile = open(RST_DIR + '/Applications.rst', 'w')
appIndexFile.write(RstPageHeading("Applications", "2")) appIndexFile.write(RstPageHeading("Applications", "2", ref="apprefdoc"))
for appName in appNames: for appName in appNames:
tags = GetApplicationTags(appName) tags = GetApplicationTags(appName)
if not tags: if not tags:
print "No tags for application: " + appName print "No tags for application: " + appName
sys.exit(1) sys.exit(1)
tag = tags[0] tag = tags[0]
tag_ = tag tag_ = tag
...@@ -557,11 +537,11 @@ def GenerateRstForApplications(): ...@@ -557,11 +537,11 @@ def GenerateRstForApplications():
if not tag_: if not tag_:
print 'empty tag found for ' + appName print 'empty tag found for ' + appName
if not tag_ in writtenTags: if not tag_ in writtenTags:
appIndexFile.write('\tApplications/' + tag_ + '.rst' + linesep) appIndexFile.write('\tApplications/' + tag_ + '.rst' + linesep)
writtenTags.append(tag_) writtenTags.append(tag_)
tagFileName = RST_DIR + '/Applications/' + tag_ + '.rst' tagFileName = RST_DIR + '/Applications/' + tag_ + '.rst'
if os.path.isfile(tagFileName): if os.path.isfile(tagFileName):
tagFile = open(tagFileName, 'a') tagFile = open(tagFileName, 'a')
...@@ -572,15 +552,13 @@ def GenerateRstForApplications(): ...@@ -572,15 +552,13 @@ def GenerateRstForApplications():
tagFile.write( RstPageHeading(tag, "1") ) tagFile.write( RstPageHeading(tag, "1") )
tagFile.write("\tapp_" + appName + linesep) tagFile.write("\tapp_" + appName + linesep)
tagFile.close() tagFile.close()
print "Generating " + appName + ".rst" + " on tag " + tag_ print "Generating " + appName + ".rst" + " on tag " + tag_
appFile = open(RST_DIR + '/Applications/app_' + appName + '.rst', 'w') appFile = open(RST_DIR + '/Applications/app_' + appName + '.rst', 'w')
out = ApplicationToRst(appName) out = ApplicationToRst(appName)
appFile.write(out) appFile.write(out)
appFile.close() appFile.close()
appIndexFile.close()
return out return out
......
Applications
============
This chapter is the reference documentation for applications delivered
with OTB. It provides detailed description of the application behaviour and
parameters, as well as python and bash snippets describing how to use them.
.. toctree::
:maxdepth: 3
Applications/Image_Manipulation.rst
Applications/Vector_Data_Manipulation.rst
Applications/Calibration.rst
Applications/Geometry.rst
Applications/Image_Filtering.rst
Applications/Feature_Extraction.rst
Applications/Stereo.rst
Applications/Learning.rst
Applications/Segmentation.rst
Applications/Miscellaneous.rst
...@@ -30,9 +30,8 @@ entry points. The framework can be extended, but Orfeo Toolbox ships with the fo ...@@ -30,9 +30,8 @@ entry points. The framework can be extended, but Orfeo Toolbox ships with the fo
the SWIG/Python interface is available with seamless integration within the SWIG/Python interface is available with seamless integration within
QGIS. QGIS.
The OTB Applications are now rich of more than 90 tools, which are The complete list of applications is described in the :ref:`Application
listed in the applications reference documentation, presented in Reference Documentation <apprefdoc>`.
chapter [chap:apprefdoc], page.
All standard applications share the same implementation and expose All standard applications share the same implementation and expose
automatically generated interfaces. automatically generated interfaces.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment