Commit 665b5a6b authored by Guillaume Pasero's avatar Guillaume Pasero

MRG: Merge bugfixes from branch 'release-6.2' into develop

parents c6f02268 b9ec696e
...@@ -344,8 +344,8 @@ def GetApplicationExamplePythonSnippet(app,idx,expand = False, inputpath="",outp ...@@ -344,8 +344,8 @@ def GetApplicationExamplePythonSnippet(app,idx,expand = False, inputpath="",outp
#app.SetParameterString(param,value) #app.SetParameterString(param,value)
output+= "\t" + appname + ".SetParameterString(" + EncloseString(param) + "," + EncloseString(value) + ")" + linesep output+= "\t" + appname + ".SetParameterString(" + EncloseString(param) + "," + EncloseString(value) + ")" + linesep
if paramtype == otbApplication.ParameterType_Empty: if paramtype == otbApplication.ParameterType_Empty:
app.SetParameterString(param,"1") app.EnableParameter(param)
output+= "\t" + appname + ".SetParameterString("+EncloseString(param)+",\"1\")" + linesep output+= "\t" + appname + ".EnableParameter("+EncloseString(param)+")" + linesep
if paramtype == otbApplication.ParameterType_Int \ if paramtype == otbApplication.ParameterType_Int \
or paramtype == otbApplication.ParameterType_Radius \ or paramtype == otbApplication.ParameterType_Radius \
or paramtype == otbApplication.ParameterType_RAM: or paramtype == otbApplication.ParameterType_RAM:
......
This diff is collapsed.
...@@ -3,4 +3,4 @@ ...@@ -3,4 +3,4 @@
TEXINPUTS=$TEXINPUTS:${ITK_TEXINPUTS} TEXINPUTS=$TEXINPUTS:${ITK_TEXINPUTS}
export TEXINPUTS export TEXINPUTS
${LATEX_COMPILER} -file-line-error -halt-on-error "$@" ${LATEX_COMPILER} -file-line-error -halt-on-error -shell-escape "$@"
...@@ -89,7 +89,7 @@ SET(DVIPS_CONVERTER_OPTIONS -D600) ...@@ -89,7 +89,7 @@ SET(DVIPS_CONVERTER_OPTIONS -D600)
# Option for html generation # Option for html generation
SET(TEX4HT_OPTIONS html,2,sections+) SET(TEX4HT_OPTIONS "html,2,sections+ \"\" \"\" -shell-escape")
SET (HTML_OUTPUT "SoftwareGuide-${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}") SET (HTML_OUTPUT "SoftwareGuide-${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}")
# Copy RELEASE_NOTES.txt from OTB source tree to Software Guide build directory # Copy RELEASE_NOTES.txt from OTB source tree to Software Guide build directory
......
...@@ -112,17 +112,17 @@ section~\ref{chapter:WriteAFilter}, page~\pageref{chapter:WriteAFilter}. ...@@ -112,17 +112,17 @@ section~\ref{chapter:WriteAFilter}, page~\pageref{chapter:WriteAFilter}.
The first step is to write a persistent mean image filter. We need to The first step is to write a persistent mean image filter. We need to
include the appropriate header : include the appropriate header :
\begin{lstlisting} \begin{cppcode}
#include "otbPersistentImageFilter.h" #include "otbPersistentImageFilter.h"
\end{lstlisting} \end{cppcode}
Then, we declare the class prototype as follows: Then, we declare the class prototype as follows:
\begin{lstlisting} \begin{cppcode}
template<class TInputImage > template<class TInputImage >
class ITK_EXPORT PersistentMeanImageFilter : class ITK_EXPORT PersistentMeanImageFilter :
public PersistentImageFilter<TInputImage, TInputImage> public PersistentImageFilter<TInputImage, TInputImage>
\end{lstlisting} \end{cppcode}
Since the output image will only be used for streaming purpose, we do Since the output image will only be used for streaming purpose, we do
not need to declare different input and output template types. not need to declare different input and output template types.
...@@ -131,14 +131,14 @@ In the \emph{private} section of the class, we will declare a member which ...@@ -131,14 +131,14 @@ In the \emph{private} section of the class, we will declare a member which
will be used to store temporary results, and a member which will be will be used to store temporary results, and a member which will be
used to store the final result. used to store the final result.
\begin{lstlisting} \begin{cppcode}
private: private:
// Temporary results container // Temporary results container
std::vector<PixelType> m_TemporarySums; std::vector<PixelType> m_TemporarySums;
// Final result member // Final result member
double m_Mean; double m_Mean;
\end{lstlisting} \end{cppcode}
Next, we will write the \verb?Reset()? method implementation in the Next, we will write the \verb?Reset()? method implementation in the
\emph{protected} section of the class. Proper allocation of the \emph{protected} section of the class. Proper allocation of the
...@@ -146,7 +146,7 @@ temporary results container with respect to the number of threads is ...@@ -146,7 +146,7 @@ temporary results container with respect to the number of threads is
handled here. handled here.
\begin{lstlisting} \begin{cppcode}
protected: protected:
virtual void Reset() virtual void Reset()
{ {
...@@ -160,13 +160,13 @@ protected: ...@@ -160,13 +160,13 @@ protected:
// Reset the final result // Reset the final result
m_Mean = 0.; m_Mean = 0.;
} }
\end{lstlisting} \end{cppcode}
Now, we need to write the \verb?ThreadedGenerateData()? methods (also Now, we need to write the \verb?ThreadedGenerateData()? methods (also
in the \emph{protected} section), were in the \emph{protected} section), were
temporary results will be computed for each piece of stream. temporary results will be computed for each piece of stream.
\begin{lstlisting} \begin{cppcode}
virtual void ThreadedGenerateData(const RegionType& virtual void ThreadedGenerateData(const RegionType&
outputRegionForThread, itk::ThreadIdType threadId) outputRegionForThread, itk::ThreadIdType threadId)
{ {
...@@ -190,12 +190,12 @@ for (it.GoToBegin(); !it.IsAtEnd(); ++it, progress.CompletedPixel()) ...@@ -190,12 +190,12 @@ for (it.GoToBegin(); !it.IsAtEnd(); ++it, progress.CompletedPixel())
m_TemporarySums[threadId]+= value; m_TemporarySums[threadId]+= value;
} }
\end{lstlisting} \end{cppcode}
Last, we need to define the \verb?Synthetize()? method (still in the Last, we need to define the \verb?Synthetize()? method (still in the
\emph{protected} section), which will yield the final results: \emph{protected} section), which will yield the final results:
\begin{lstlisting} \begin{cppcode}
virtual void Synthetize() virtual void Synthetize()
{ {
// For each thread // For each thread
...@@ -214,7 +214,7 @@ if(nbPixels!=0) ...@@ -214,7 +214,7 @@ if(nbPixels!=0)
m_Mean/=nbPixels; m_Mean/=nbPixels;
} }
} }
\end{lstlisting} \end{cppcode}
\subsection{Second step: Decorating the filter and using it} \subsection{Second step: Decorating the filter and using it}
...@@ -222,41 +222,41 @@ Now, to use the filter, one only has to decorate it with the ...@@ -222,41 +222,41 @@ Now, to use the filter, one only has to decorate it with the
\doxygen{otb}{PersistentFilterStreamingDecorator}. First step is \doxygen{otb}{PersistentFilterStreamingDecorator}. First step is
to include the appropriate header: to include the appropriate header:
\begin{lstlisting} \begin{cppcode}
#include "otbPersistentMeanImageFilter.h" #include "otbPersistentMeanImageFilter.h"
#include "otbPersistentFilterStreamingDecorator.h" #include "otbPersistentFilterStreamingDecorator.h"
\end{lstlisting} \end{cppcode}
Then, we decorate the filter with some typedefs: Then, we decorate the filter with some typedefs:
\begin{lstlisting} \begin{cppcode}
typedef otb::PersistentMeanImageFilter<ImageType> typedef otb::PersistentMeanImageFilter<ImageType>
PersitentMeanFilterType; PersitentMeanFilterType;
typedef otb::PersistentFilterStreamingDecorator typedef otb::PersistentFilterStreamingDecorator
< PersitentMeanFilterType> StreamingMeanFilterType; < PersitentMeanFilterType> StreamingMeanFilterType;
\end{lstlisting} \end{cppcode}
Now, the decorated filter can be used like any standard filter: Now, the decorated filter can be used like any standard filter:
\begin{lstlisting} \begin{cppcode}
StreamingMeanFilterType::Pointer filter = StreamingMeanFilterType::Pointer filter =
StreamingMeanFilterType::New(); StreamingMeanFilterType::New();
filter->SetInput(reader->GetOutput()); filter->SetInput(reader->GetOutput());
filter->Update(); filter->Update();
\end{lstlisting} \end{cppcode}
\subsection{Third step: one class to rule them all} \subsection{Third step: one class to rule them all}
It is often convenient to avoid the few typedefs of the previous It is often convenient to avoid the few typedefs of the previous
section by deriving a new class from the decorated filter: section by deriving a new class from the decorated filter:
\begin{lstlisting} \begin{cppcode}
template<class TInputImage > template<class TInputImage >
class ITK_EXPORT StreamingMeanImageFilter : class ITK_EXPORT StreamingMeanImageFilter :
public PersistentFilterStreamingDecorator< public PersistentFilterStreamingDecorator<
PersistentImageFilter<TInputImage, TInputImage> > PersistentImageFilter<TInputImage, TInputImage> >
\end{lstlisting} \end{cppcode}
This also allows to redefine setters and getters for parameters, This also allows to redefine setters and getters for parameters,
avoiding to call the \verb?GetFilter()? method to set them. avoiding to call the \verb?GetFilter()? method to set them.
...@@ -32,40 +32,14 @@ ...@@ -32,40 +32,14 @@
\definecolor{listlightgray}{gray}{0.955} \definecolor{listlightgray}{gray}{0.955}
\definecolor{listwhite}{gray}{1.0} \definecolor{listwhite}{gray}{1.0}
\usepackage{listings} \usepackage{minted}
\newcommand{\lstsetcpp} \newminted{cpp}{fontsize=\small}
{ \newminted{cmake}{fontsize=\small}
\lstset{frame = tb, \newminted{bat}{fontsize=\small}
framerule = 0.25pt,
float,
fontadjust,
backgroundcolor={\color{listlightgray}},
basicstyle = {\ttfamily\footnotesize},
keywordstyle = {\ttfamily\color{listkeyword}\textbf},
identifierstyle = {\ttfamily},
commentstyle = {\ttfamily\color{listcomment}\textit},
stringstyle = {\ttfamily},
showstringspaces = false,
showtabs = false,
numbers = none,
numbersep = 6pt,
numberstyle={\ttfamily\color{listnumbers}},
tabsize = 2,
language=[ANSI]C++,
floatplacement=!h
}
}
\newcommand{\lstsetpython}
{
\lstset{language=Python
}
}
\newcommand{\lstsetjava}
{
\lstset{language=Java
}
}
\usepackage{mdframed}
\BeforeBeginEnvironment{cppcode}{\begin{mdframed}[leftline=false,rightline=false,backgroundcolor=listlightgray]}
\AfterEndEnvironment{cppcode}{\end{mdframed}}
\newif\ifitkFullVersion \newif\ifitkFullVersion
\itkFullVersiontrue \itkFullVersiontrue
...@@ -170,8 +144,6 @@ colorlinks,linkcolor={blue},citecolor={blue},urlcolor={blue}, ...@@ -170,8 +144,6 @@ colorlinks,linkcolor={blue},citecolor={blue},urlcolor={blue},
\hyperbaseurl{http://www.orfeo-toolbox.org} \hyperbaseurl{http://www.orfeo-toolbox.org}
\lstsetcpp
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
......
...@@ -36,9 +36,7 @@ directory. The \code{CMakeLists.txt} will be very similar between your projects. ...@@ -36,9 +36,7 @@ directory. The \code{CMakeLists.txt} will be very similar between your projects.
Open the \code{CMakeLists.txt} file and write in the few lines: Open the \code{CMakeLists.txt} file and write in the few lines:
\begin{cmakecode}
\begin{small}
\begin{verbatim}
PROJECT(Tutorials) PROJECT(Tutorials)
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.6)
...@@ -53,8 +51,7 @@ ENDIF(OTB_FOUND) ...@@ -53,8 +51,7 @@ ENDIF(OTB_FOUND)
ADD_EXECUTABLE(HelloWorldOTB HelloWorldOTB.cxx ) ADD_EXECUTABLE(HelloWorldOTB HelloWorldOTB.cxx )
TARGET_LINK_LIBRARIES(HelloWorldOTB ${OTB_LIBRARIES}) TARGET_LINK_LIBRARIES(HelloWorldOTB ${OTB_LIBRARIES})
\end{verbatim} \end{cmakecode}
\end{small}
The first line defines the name of your project as it appears in Visual Studio The first line defines the name of your project as it appears in Visual Studio
...@@ -102,8 +99,7 @@ Follow the following steps: ...@@ -102,8 +99,7 @@ Follow the following steps:
\item Create a CMakeLists.txt into the src repository with the following lines: \item Create a CMakeLists.txt into the src repository with the following lines:
\begin{verbatim} \begin{cmakecode}
project(MyFirstProcessing) project(MyFirstProcessing)
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
...@@ -114,10 +110,11 @@ include(${OTB_USE_FILE}) ...@@ -114,10 +110,11 @@ include(${OTB_USE_FILE})
add_executable(MyFirstProcessing MyFirstProcessing.cxx ) add_executable(MyFirstProcessing MyFirstProcessing.cxx )
target_link_libraries(MyFirstProcessing ${OTB_LIBRARIES} ) target_link_libraries(MyFirstProcessing ${OTB_LIBRARIES} )
\end{verbatim} \end{cmakecode}
\item Create a MyFirstProcessing.cxx into the src repository with the following lines: \item Create a MyFirstProcessing.cxx into the src repository with the following lines:
\begin{verbatim}
\begin{cppcode}
#include "otbImage.h" #include "otbImage.h"
#include "otbVectorImage.h" #include "otbVectorImage.h"
#include "otbImageFileReader.h" #include "otbImageFileReader.h"
...@@ -151,9 +148,9 @@ int main(int argc, char* argv[]) ...@@ -151,9 +148,9 @@ int main(int argc, char* argv[])
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
\end{verbatim} \end{cppcode}
\item create a file named BuildMyFirstProcessing.bat into the MyFirstCode directory with the following lines: \item create a file named BuildMyFirstProcessing.bat into the MyFirstCode directory with the following lines:
\begin{verbatim} \begin{batcode}
@echo off @echo off
set /A ARGS_COUNT=0 set /A ARGS_COUNT=0
...@@ -193,7 +190,7 @@ echo You need to run this script from an OSGeo4W shell ...@@ -193,7 +190,7 @@ echo You need to run this script from an OSGeo4W shell
GOTO :END GOTO :END
:END :END
\end{verbatim} \end{batcode}
\item into a OSGEo4W shell, run the configure.bat with the right arguments: full path to your src directory, full path to your build directory, full path to the place where find OTBConfig.cmake file (should be C:\textbackslash path\textbackslash to\textbackslash MyOTBDir\textbackslash install\textbackslash lib\textbackslash otb). \item into a OSGEo4W shell, run the configure.bat with the right arguments: full path to your src directory, full path to your build directory, full path to the place where find OTBConfig.cmake file (should be C:\textbackslash path\textbackslash to\textbackslash MyOTBDir\textbackslash install\textbackslash lib\textbackslash otb).
\item into the OSGeo4W shell, open the MyFirstProcessing.sln \item into the OSGeo4W shell, open the MyFirstProcessing.sln
\item build the solution \item build the solution
...@@ -212,12 +209,10 @@ write images and the basics of the pipeline system. ...@@ -212,12 +209,10 @@ write images and the basics of the pipeline system.
First, let's add the following lines at the end of the \code{CMakeLists.txt} First, let's add the following lines at the end of the \code{CMakeLists.txt}
file: file:
\begin{small} \begin{cmakecode}
\begin{verbatim}
ADD_EXECUTABLE(Pipeline Pipeline.cxx ) ADD_EXECUTABLE(Pipeline Pipeline.cxx )
TARGET_LINK_LIBRARIES(Pipeline ${OTB_LIBRARIES}) TARGET_LINK_LIBRARIES(Pipeline ${OTB_LIBRARIES})
\end{verbatim} \end{cmakecode}
\end{small}
Now, create a \code{Pipeline.cxx} file. Now, create a \code{Pipeline.cxx} file.
...@@ -264,12 +259,10 @@ reader and the writer. ...@@ -264,12 +259,10 @@ reader and the writer.
Let's first add the 2 following lines to the \code{CMakeLists.txt} file: Let's first add the 2 following lines to the \code{CMakeLists.txt} file:
\begin{small} \begin{cmakecode}
\begin{verbatim}
ADD_EXECUTABLE(FilteringPipeline FilteringPipeline.cxx ) ADD_EXECUTABLE(FilteringPipeline FilteringPipeline.cxx )
TARGET_LINK_LIBRARIES(FilteringPipeline ${OTB_LIBRARIES}) TARGET_LINK_LIBRARIES(FilteringPipeline ${OTB_LIBRARIES})
\end{verbatim} \end{cmakecode}
\end{small}
\input{FilteringPipeline.tex} \input{FilteringPipeline.tex}
...@@ -303,12 +296,10 @@ To realize this conversion, we will use the ...@@ -303,12 +296,10 @@ To realize this conversion, we will use the
Add the two lines to the \code{CMakeLists.txt} file: Add the two lines to the \code{CMakeLists.txt} file:
\begin{small} \begin{cmakecode}
\begin{verbatim}
ADD_EXECUTABLE(ScalingPipeline ScalingPipeline.cxx ) ADD_EXECUTABLE(ScalingPipeline ScalingPipeline.cxx )
TARGET_LINK_LIBRARIES(ScalingPipeline ${OTB_LIBRARIES}) TARGET_LINK_LIBRARIES(ScalingPipeline ${OTB_LIBRARIES})
\end{verbatim} \end{cmakecode}
\end{small}
\input{ScalingPipeline} \input{ScalingPipeline}
...@@ -331,12 +322,10 @@ process multispectral images. ...@@ -331,12 +322,10 @@ process multispectral images.
Add the following lines in the \code{CMakeLists.txt} file: Add the following lines in the \code{CMakeLists.txt} file:
\begin{small} \begin{cmakecode}
\begin{verbatim}
ADD_EXECUTABLE(Multispectral Multispectral.cxx ) ADD_EXECUTABLE(Multispectral Multispectral.cxx )
TARGET_LINK_LIBRARIES(Multispectral ${OTB_LIBRARIES}) TARGET_LINK_LIBRARIES(Multispectral ${OTB_LIBRARIES})
\end{verbatim} \end{cmakecode}
\end{small}
\input{Multispectral} \input{Multispectral}
...@@ -355,12 +344,10 @@ try it! ...@@ -355,12 +344,10 @@ try it!
Add the following lines in the \code{CMakeLists.txt} file: Add the following lines in the \code{CMakeLists.txt} file:
\begin{small} \begin{cmakecode}
\begin{verbatim}
ADD_EXECUTABLE(SmarterFilteringPipeline SmarterFilteringPipeline.cxx ) ADD_EXECUTABLE(SmarterFilteringPipeline SmarterFilteringPipeline.cxx )
TARGET_LINK_LIBRARIES(SmarterFilteringPipeline ${OTB_LIBRARIES}) TARGET_LINK_LIBRARIES(SmarterFilteringPipeline ${OTB_LIBRARIES})
\end{verbatim} \end{cmakecode}
\end{small}
\input{SmarterFilteringPipeline} \input{SmarterFilteringPipeline}
...@@ -410,12 +397,10 @@ To get the best of the image processing algorithms, you want to combine these da ...@@ -410,12 +397,10 @@ To get the best of the image processing algorithms, you want to combine these da
First you need to add the following lines in the \code{CMakeLists.txt} file: First you need to add the following lines in the \code{CMakeLists.txt} file:
\begin{small} \begin{cmakecode}
\begin{verbatim}
ADD_EXECUTABLE(OrthoFusion OrthoFusion.cxx) ADD_EXECUTABLE(OrthoFusion OrthoFusion.cxx)
TARGET_LINK_LIBRARIES(OrthoFusion ${OTB_LIBRARIES}) TARGET_LINK_LIBRARIES(OrthoFusion ${OTB_LIBRARIES})
\end{verbatim} \end{cmakecode}
\end{small}
\input{OrthoFusion} \input{OrthoFusion}
......
...@@ -248,14 +248,12 @@ in order to launch each internal application. The order should be compatible wit ...@@ -248,14 +248,12 @@ in order to launch each internal application. The order should be compatible wit
image parameter connexions. If you want to do "in-memory" connexions, you can do it between image parameter connexions. If you want to do "in-memory" connexions, you can do it between
two calls to \code{ExecuteInternal()}, for instance : two calls to \code{ExecuteInternal()}, for instance :
\small \begin{cppcode}
\begin{lstlisting}
ExecuteInternal("a"); ExecuteInternal("a");
GetInternalApplication("b")->SetParameterInputImage("in", GetInternalApplication("b")->SetParameterInputImage("in",
GetInternalApplication("a")->GetParameterOutputImage("out")); GetInternalApplication("a")->GetParameterOutputImage("out"));
ExecuteInternal("b"); ExecuteInternal("b");
\end{lstlisting} \end{cppcode}
\normalsize
The application BundleToPerfectSensor is a simple example of composite applications. The application BundleToPerfectSensor is a simple example of composite applications.
For a more complex example, you can check the application TrainImagesClassifier. For a more complex example, you can check the application TrainImagesClassifier.
......
...@@ -92,8 +92,7 @@ sub ParseCxxFile { ...@@ -92,8 +92,7 @@ sub ParseCxxFile {
$tagfound = 1; $tagfound = 1;
$dumpinglatex = 0; $dumpinglatex = 0;
$dumpingcode = 1; $dumpingcode = 1;
print OUTFILE "\\small\n"; print OUTFILE "\\begin{cppcode}\n";
print OUTFILE "\\begin{lstlisting}\n";
} }
elsif( /$endlatextag/ ) { elsif( /$endlatextag/ ) {
$tagfound = 1; $tagfound = 1;
...@@ -102,8 +101,7 @@ sub ParseCxxFile { ...@@ -102,8 +101,7 @@ sub ParseCxxFile {
elsif( /$endcodesnippettag/ ) { elsif( /$endcodesnippettag/ ) {
$tagfound = 1; $tagfound = 1;
$dumpingcode = 0; $dumpingcode = 0;
print OUTFILE "\\end{lstlisting}\n"; print OUTFILE "\\end{cppcode}\n";
print OUTFILE "\\normalsize\n";
} }
if( !$tagfound ) { if( !$tagfound ) {
if( $dumpinglatex ) { if( $dumpinglatex ) {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
TEXINPUTS=$TEXINPUTS:${ITK_TEXINPUTS} TEXINPUTS=$TEXINPUTS:${ITK_TEXINPUTS}
export TEXINPUTS export TEXINPUTS
mkdir ${HTML_OUTPUT} mkdir -p ${HTML_OUTPUT}
cd ${HTML_OUTPUT} cd ${HTML_OUTPUT}
${TEX4HT_COMPILER} "$@" ${TEX4HT_OPTIONS} ${TEX4HT_COMPILER} "$@" ${TEX4HT_OPTIONS}
......
...@@ -120,6 +120,9 @@ ...@@ -120,6 +120,9 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>When the image width or height is lower than this minimum, overview generation is not proposed</string>
</property>
<property name="text"> <property name="text">
<string>Minimum size:</string> <string>Minimum size:</string>
</property> </property>
...@@ -127,6 +130,9 @@ ...@@ -127,6 +130,9 @@
</item> </item>
<item row="1" column="2"> <item row="1" column="2">
<widget class="QSpinBox" name="overviewsSpinBox"> <widget class="QSpinBox" name="overviewsSpinBox">
<property name="toolTip">
<string>When the image width or height is lower than this minimum, overview generation is not proposed</string>
</property>
<property name="maximum"> <property name="maximum">
<number>999999999</number> <number>999999999</number>
</property> </property>
......
...@@ -250,6 +250,10 @@ void Application::SetParameterString(std::string parameter, std::string value, b ...@@ -250,6 +250,10 @@ void Application::SetParameterString(std::string parameter, std::string value, b
if ( !paramDown->SetFileName(value) ) if ( !paramDown->SetFileName(value) )
otbAppLogCRITICAL( <<"Invalid XML parameter filename " << value <<"."); otbAppLogCRITICAL( <<"Invalid XML parameter filename " << value <<".");
} }
else
{
otbAppLogWARNING( <<"This parameter can't be set using SetParameterString().");
}
this->SetParameterUserValue(parameter, hasUserValueFlag); this->SetParameterUserValue(parameter, hasUserValueFlag);
} }
......
...@@ -18,6 +18,55 @@ ...@@ -18,6 +18,55 @@
# limitations under the License. # limitations under the License.
# #
function(sanitize_system_paths input_file)
# does not support Windows ...
if(APPLE)
set(SHARED_EXT "\\.dylib")
elseif(UNIX)
set(SHARED_EXT "\\.so")
endif()
set(filtered_content)
file(STRINGS "${input_file}" source_file_content NEWLINE_CONSUME)
string(REGEX REPLACE "\n" "\n;" source_file_content "${source_file_content}")
set(SEARCH_REGEX "(^[^#\"]+(LIBRARIES|INCLUDE_DIR[A-Z]*) +\")(.+)(\"[^\"]*)")
foreach(line ${source_file_content})
set(filtered_line "${line}")
if(line MATCHES "${SEARCH_REGEX}")
string(REGEX REPLACE "${SEARCH_REGEX}" "\\3" extract_str "${line}" )
string(REGEX REPLACE ";;" ";" extract_str "${extract_str}")
set(_to_be_removed)
set(_to_be_added)
foreach(path ${extract_str})
if(IS_ABSOLUTE ${path})
list(APPEND _to_be_removed "${path}")
if(NOT IS_DIRECTORY ${path})
if(path MATCHES "^.*/lib[^\\.]+${SHARED_EXT}.*")
string(REGEX REPLACE "^.*/lib([^\\.]+)${SHARED_EXT}.*" "\\1" _lib_name "${path}")
list(APPEND _to_be_added "${_lib_name}")
endif()
endif()
endif()
endforeach()
if(_to_be_removed)
list(REMOVE_ITEM extract_str ${_to_be_removed})
endif()
if(_to_be_added)
list(INSERT extract_str 0 ${_to_be_added})
endif()
if(extract_str)
list(REMOVE_DUPLICATES extract_str)
endif()
string(REGEX REPLACE "${SEARCH_REGEX}" "\\1${extract_str}\\4" filtered_line "${line}" )
endif()
list(APPEND filtered_content "${filtered_line}")
endforeach()
string(REGEX REPLACE "\n;" "\n" filtered_content "${filtered_content}")
file(WRITE "${input_file}" "${filtered_content}")
endfunction()
#check variables are set #check variables are set
foreach(var P_DIRS P_MATCH P_REPLACE) foreach(var P_DIRS P_MATCH P_REPLACE)
if(NOT ${var}) if(NOT ${var})
...@@ -42,5 +91,8 @@ foreach( p_dir ${P_DIRS} ) ...@@ -42,5 +91,8 @@ foreach( p_dir ${P_DIRS} )
file(WRITE "${cmake_file}" "# This file is modified by OTB after installation. file(WRITE "${cmake_file}" "# This file is modified by OTB after installation.
\n${cmake_file_CONTENTS}") \n${cmake_file_CONTENTS}")
endif() endif()
if(UNIX)
sanitize_system_paths(${cmake_file})
endif()
endforeach() # foreach( cmake_file endforeach() # foreach( cmake_file
endforeach() # foreach( p_dir endforeach() # foreach( p_dir