Commit f0a312fd authored by Rashad Kanavath's avatar Rashad Kanavath

DOC: update cookbook generation

parent bda015a9
......@@ -3,4 +3,4 @@
export LD_LIBRARY_PATH=@OTB_INSTALL_PREFIX@/lib:$LD_LIBRARY_PATH
export PYTHONPATH=@OTB_PYTHONPATH@:$PYTHONPATH
export OTB_APPLICATION_PATH=@OTB_APPLICATION_PATH@
@PYTHON_EXECUTABLE@ @CMAKE_SOURCE_DIR@/Scripts/otbGenerateWrappersRstDoc.py
@PYTHON_EXECUTABLE@ @CMAKE_SOURCE_DIR@/Scripts/otbGenerateWrappersRstDoc.py -o "$1"
......@@ -48,6 +48,14 @@ if(NOT OTB_INSTALL_PREFIX)
message(FATAL_ERROR "OTB_INSTALL_PREFIX empty")
endif()
macro(remove_and_make_directories)
foreach(dir in ${ARGV})
execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${dir})
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${dir})
endforeach()
endmacro()
#find Python
find_package(PythonInterp REQUIRED)
......@@ -78,14 +86,14 @@ set(RST_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/rst)
set(LATEX_DIR ${CMAKE_CURRENT_BINARY_DIR}/latex)
set(HTML_DIR ${CMAKE_CURRENT_BINARY_DIR}/html)
execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${RST_BINARY_DIR})
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${RST_BINARY_DIR})
execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${HTML_DIR})
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${HTML_DIR})
execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${LATEX_DIR})
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${LATEX_DIR})
remove_and_make_directories(
${HTML_DIR}
${RST_BINARY_DIR}
${HTML_DIR}
${LATEX_DIR}
${CMAKE_CURRENT_BINARY_DIR}/_static
)
execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/RunApplicationsRstGenerator.sh)
......@@ -112,6 +120,7 @@ configure_file(${RST_SOURCE_DIR}/conf.py.in ${SPHINX_CONF_DIR}/conf.py @ONLY)
add_custom_target(generate_otbapps_rst
ALL
COMMAND ${SH_INTERP} ${CMAKE_CURRENT_BINARY_DIR}/RunApplicationsRstGenerator.sh
${RST_BINARY_DIR}
WORKING_DIRECTORY ${RST_BINARY_DIR}
COMMENT "Auto-generating Application Reference Documentation in RST"
)
......
......@@ -491,17 +491,16 @@ def GetApplicationTags(appname):
import shutil
def RstPageHeading(text):
def RstPageHeading(text, maxdepth):
output = RstHeading(text, "=") + linesep
output += ".. toctree::" + linesep
output += "\t:maxdepth: 2" + linesep
output += "\t:maxdepth: " + maxdepth + linesep
output += linesep + linesep
return output
def GenerateRstForApplications():
out = ""
blackList = ["TestApplication", "Example", "ApplicationExample"]
appIndexFile = open('Applications.rst', 'w')
allApps = None
try:
allApps = otbApplication.Registry.GetAvailableApplications( )
......@@ -514,74 +513,86 @@ def GenerateRstForApplications():
print 'No OTB applications available. Please check OTB_APPLICATION_PATH env variable'
sys.exit(1)
sectionTags = ["Image Manipulation",
"Vector Data Manipulation",
"Calibration","Geometry", "Image Filtering","Feature Extraction",
"Stereo","Learning","Segmentation", "Miscellaneous"]
appIndexFile.write(RstPageHeading("Applications"))
for tag in sectionTags:
#directory= "Applications/" + tag
# if not os.path.exists(directory):
# os.makedirs(directory)
appIndexFile.write('\tApplications/' + tag.replace(' ', '_') + '.rst' + linesep)
#chapterIndexFile = open('Applications/' + tag + '.rst', 'w')
#chapterIndexFile.write(RstPageHeading(tag))
#print linesep + RstHeading(tag, '=')
# sectionTags = ["Image Manipulation",
# "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)
appIndexFile.close()
#appsRemoved = []
writtenTags = []
appNames = [app for app in allApps if app not in blackList]
print "All apps: %s" % (appNames,)
appIndexFile = open(RST_DIR + '/Applications.rst', 'w')
appIndexFile.write(RstPageHeading("Applications", "2"))
for appName in appNames:
apptags = GetApplicationTags(appName)
tags = GetApplicationTags(appName)
if not tags:
print "No tags for application: " + appName
sys.exit(1)
tag = tags[0]
tag_ = tag
if tag.find(' '):
tag_ = tag.replace(' ', '_')
if not tag_:
print 'empty tag found for ' + appName
if not tag_ in writtenTags:
appIndexFile.write('\tApplications/' + tag_ + '.rst' + linesep)
writtenTags.append(tag_)
tagFileName = RST_DIR + '/Applications/' + tag_ + '.rst'
if os.path.isfile(tagFileName):
tagFile = open(tagFileName, 'a')
tagFile.write("\tapp_" + appName + linesep)
tagFile.close()
else:
tagFile = open(tagFileName, 'w')
tagFile.write( RstPageHeading(tag, "1") )
tagFile.write("\tapp_" + appName + linesep)
tagFile.close()
# if apptags.count(tag) > 0:
print "Generating " + appName + ".rst"
#chapterIndexFile.write("\t" + tag + '/' + appName + linesep)
appFile = open('Applications/app_' + appName + '.rst', 'w')
print "Generating " + appName + ".rst" + " on tag " + tag_
appFile = open(RST_DIR + '/Applications/app_' + appName + '.rst', 'w')
out = ApplicationToRst(appName)
appFile.write(out)
appFile.close()
#appsRemoved.append(appName)
# for appName in appsRemoved:
# appNames.remove(appName)
#chapterIndexFile.close()
appIndexFile.close()
#miscChapterIndexFile = open("Applications/" + misctag + '.rst', 'w')
#miscChapterIndexFile.write(RstPageHeading(misctag))
# for appName in appNames:
# print "Generating " + appName + ".rst"
# appFile = open("Applications/app_" + appName + ".rst", 'w')
# out = ApplicationToRst(appName)
# appFile.write(out)
# appFile.close()
# #miscChapterIndexFile.write('\t' + misctag + '/' + appName + linesep)
# out = ""
return out
# Start parsing options
parser = OptionParser(usage="Export application(s) to tex or pdf file.")
parser = OptionParser(usage="Export application(s) to rst file.")
parser.add_option("-a",dest="appname",help="Generate rst only for this application (eg: OrthoRectification)")
parser.add_option("-m",dest="module",help="Generate rst only for this module (eg: Image Manipulation)")
parser.add_option("-o",dest="rstdir",help="directory where rst files are generated")
(options, args) = parser.parse_args()
RST_DIR = options.rstdir
if not options.appname is None:
out = ApplicationToRst(options.appname)
#print out
......
Calibration
===========
.. toctree::
:maxdepth: 1
app_OpticalCalibration
app_SARCalibration
app_SARDecompositions
app_SARPolarMatrixConvert
app_SARPolarSynth
app_SarRadiometricCalibration
Feature Extraction
==================
.. toctree::
:maxdepth: 1
app_BinaryMorphologicalOperation
app_ComputePolylineFeatureFromImage
app_DSFuzzyModelEstimation
app_EdgeExtraction
app_GrayScaleMorphologicalOperation
app_HaralickTextureExtraction
app_HomologousPointsExtraction
app_LineSegmentDetection
app_LocalStatisticExtraction
app_MultivariateAlterationDetector
app_RadiometricIndices
app_SFSTextureExtraction
app_VectorDataDSValidation
Geometry
========
.. toctree::
:maxdepth: 1
app_BundleToPerfectSensor
app_ConvertCartoToGeoPoint
app_ConvertSensorToGeoPoint
app_GeneratePlyFile
app_GenerateRPCSensorModel
app_GridBasedImageResampling
app_ImageEnvelope
app_OrthoRectification
app_Pansharpening
app_RefineSensorModel
app_RigidTransformResample
app_Superimpose
Image Filtering
===============
.. toctree::
:maxdepth: 1
app_Despeckle
app_DimensionalityReduction
app_MeanShiftSmoothing
app_Smoothing
Image Manipulation
==================
.. toctree::
:maxdepth: 1
app_ColorMapping
app_ConcatenateImages
app_Convert
app_DEMConvert
app_DownloadSRTMTiles
app_ExtractROI
app_ManageNoData
app_MultiResolutionPyramid
app_Quicklook
app_ReadImageInfo
app_Rescale
app_SplitImage
app_TileFusion
Learning
========
.. toctree::
:maxdepth: 1
app_ClassificationMapRegularization
app_ComputeConfusionMatrix
app_ComputeImagesStatistics
app_FusionOfClassifications
app_ImageClassifier
app_KMeansClassification
app_MultiImageSamplingRate
app_PolygonClassStatistics
app_PredictRegression
app_SampleExtraction
app_SampleSelection
app_SOMClassification
app_TrainImagesClassifier
app_TrainRegression
app_TrainVectorClassifier
Miscellaneous
=============
.. toctree::
:maxdepth: 1
app_BandMath
app_BandMathX
app_CompareImages
app_HyperspectralUnmixing
app_KmzExport
app_OSMDownloader
app_ObtainUTMZoneFromGeoPoint
app_PixelValue
app_VertexComponentAnalysis
Segmentation
============
.. toctree::
:maxdepth: 1
app_ComputeOGRLayersFeaturesStatistics
app_ConnectedComponentSegmentation
app_HooverCompareSegmentation
app_LSMSSegmentation
app_LSMSSmallRegionsMerging
app_LSMSVectorization
app_OGRLayerClassifier
app_Segmentation
app_TrainOGRLayersClassifier
Stereo
======
.. toctree::
:maxdepth: 1
app_BlockMatching
app_DisparityMapToElevationMap
app_FineRegistration
app_StereoFramework
app_StereoRectificationGridGenerator
Vector Data Manipulation
========================
.. toctree::
:maxdepth: 1
app_ConcatenateVectorData
app_Rasterization
app_VectorDataExtractROI
app_VectorDataReprojection
app_VectorDataSetField
app_VectorDataTransform
......@@ -132,7 +132,7 @@ if HAVE_RTD_THEME:
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
html_logo = "Art/logo.png"
html_logo = "rst/Art/logo.png"
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment