diff --git a/Code/Common/otbCommandLineArgumentParser.cxx b/Code/Common/otbCommandLineArgumentParser.cxx index e2973d4b9c7b29917671790ba222d40641cc8850..7e19266012f9953d9d30c0c76666dd326c558fac 100755 --- a/Code/Common/otbCommandLineArgumentParser.cxx +++ b/Code/Common/otbCommandLineArgumentParser.cxx @@ -58,6 +58,19 @@ CommandLineArgumentParseResult return ( lString ); } +std::string +CommandLineArgumentParseResult +::GetInputImage(void) const +{ + return (GetParameterString("--InputImage")); +} +std::string +CommandLineArgumentParseResult +::GetOutputImage(void) const +{ + return (GetParameterString("--OutputImage")); +} + int CommandLineArgumentParseResult ::GetNumberOfParameters(const char *option) @@ -102,6 +115,20 @@ CommandLineArgumentParser AddOption("--version","Version","-v",0,false); } + +void +CommandLineArgumentParser +::AddInputImage(void) +{ + AddOption("--InputImage","input image file name ","-in",1,true); +} +void +CommandLineArgumentParser +::AddOutputImage(void) +{ + AddOption("--OutputImage","output image file name ","-out",1,true); +} + void CommandLineArgumentParser ::AddOption(const char *name, const char * comment, char *synonim, int nParameters, bool obligatory ) @@ -207,7 +234,7 @@ CommandLineArgumentParser } //Check the option m_OptionList[index].Finded = true; - // Si le nombre de parametres est prédéfini : + // Si le nombre de parametres est prïŋ―dïŋ―fini : if (m_OptionList[index].NumberOfParametersFixed == true) { // Check if the number of parameters is correct @@ -230,7 +257,7 @@ CommandLineArgumentParser outResult->AddParameter(m_OptionList[index].CommonName,std::string(argv[i+1])); } } - // Si le nombre de parametres n'est pas prédéfini, lecture jusqu'a la prochaine option ou fin argv : + // Si le nombre de parametres n'est pas prïŋ―dïŋ―fini, lecture jusqu'a la prochaine option ou fin argv : else { // Tell the result that the option has been encountered @@ -261,7 +288,7 @@ CommandLineArgumentParser } - // Controle que toutes les options obligatoire sont présentes dans la ligne d'argument + // Controle que toutes les options obligatoire sont prïŋ―sentes dans la ligne d'argument for(unsigned int cpt=0 ; cpt < m_OptionList.size() ; cpt++ ) { if ( (m_OptionList[cpt].Obligatory == true) && (m_OptionList[cpt].Finded == false) ) @@ -283,7 +310,7 @@ bool CommandLineArgumentParser ::FindOption(const std::string & option, int & index) { - //Cherche dans la liste des options installées + //Cherche dans la liste des options installïŋ―es bool trouve(false); bool continuer(true); unsigned int cpt(0); @@ -321,7 +348,7 @@ CommandLineArgumentParser if ( largeur > largeurmax ) largeurmax = largeur; } - // Controle que toutes les options obligatoire sont présentes dans la ligne d'argument + // Controle que toutes les options obligatoire sont prïŋ―sentes dans la ligne d'argument for(i=0 ; i < m_OptionList.size() ; i++ ) { int largeur = m_OptionList[i].CommonName.size() + m_OptionList[i].Synonim.size(); @@ -335,7 +362,7 @@ CommandLineArgumentParser } if ( m_OptionList[i].Obligatory == false ) os <<"]"; else os << " "; - //Aligne le texte avec la différence en blanc + //Aligne le texte avec la diffïŋ―rence en blanc for (int b=largeur ; b< largeurmax ; b++) os <<" "; os << " : "<<m_OptionList[i].Description; if (m_OptionList[i].NumberOfParametersFixed == true ) diff --git a/Code/Common/otbCommandLineArgumentParser.h b/Code/Common/otbCommandLineArgumentParser.h index c57bde8456000637adc6fd12d76cff8bfd4d7111..d34ce497bbe5184a89ec4d7068ac011eda9d271e 100755 --- a/Code/Common/otbCommandLineArgumentParser.h +++ b/Code/Common/otbCommandLineArgumentParser.h @@ -40,7 +40,7 @@ namespace otb /** * \class CommandLineArgumentParseResult - * \brief Objet retourné par lCommandLineArgumentParser + * \brief Objet retournïŋ― par lCommandLineArgumentParser * \see CommandLineArgumentParser */ class ITK_EXPORT CommandLineArgumentParseResult : public itk::ProcessObject @@ -95,6 +95,9 @@ public: */ std::string GetParameterString(const char *option, unsigned int number=0) const; + std::string GetInputImage(void) const; + std::string GetOutputImage(void) const; + protected: CommandLineArgumentParseResult(){}; @@ -119,7 +122,7 @@ private: /** * \class CommandLineArgumentParser - * \brief Utilisé pour parser une ligne de commande contenant des arguments et la traduit en liste de paramčtres. + * \brief Utilisïŋ― pour parser une ligne de commande contenant des arguments et la traduit en liste de paramïŋ―tres. * Usage: * \code * // Initialise le parser @@ -149,12 +152,17 @@ public: itkNewMacro(Self); itkTypeMacro(CommandLineArgumentParser,itk::ProcessObject); + /** Add an input image option */ + void AddInputImage(void); + /** Add an output image option */ + void AddOutputImage(void); + /** Add an option with 0 or more parameters (words that follow it) */ // void AddOption(const char *name, const int nParameters, const char * comment); // Au moins une valeur void AddOption(const char *name, const char * comment, char *synonim = NULL, int nParameters = 1, bool obligatory =true); - // Si -1, alors on ne connait pas le nombre de parametres ā l'avance. + // Si -1, alors on ne connait pas le nombre de parametres ïŋ― l'avance. void AddOptionNParams(const char *name, const char * comment, char *synonim = NULL, bool obligatory =true); /** Add a different string that envokes the same option (--file and -f) */ @@ -188,7 +196,7 @@ private: bool NumberOfParametersFixed; //Precise si le nombre de valeurs attendues est connu int NumberOfParameters; //Nombre de valeurs pour cette option bool Obligatory; //Precise si l'option est obligatoire - bool Finded; //Precise si l'option a été trouvée dans la ligne de commande + bool Finded; //Precise si l'option a ïŋ―tïŋ― trouvïŋ―e dans la ligne de commande } OptionType; // typedef std::map< std::string, OptionType> OptionMapType; typedef std::vector< OptionType> ListOptionType;