diff --git a/Applications/Util/otbRescale.cxx b/Applications/Util/otbRescale.cxx index 10ca7afbe696dd761a4f14a560189e9d4621482e..a0998585b91621abc458b4c9782dbadeea071189 100644 --- a/Applications/Util/otbRescale.cxx +++ b/Applications/Util/otbRescale.cxx @@ -73,6 +73,7 @@ private: SetParameterDescription( "outmax", "Maximum value of the output image." ); MandatoryOff("outmin"); + MandatoryOff("outmax"); } void DoUpdateParameters() diff --git a/Code/ApplicationEngine/otbWrapperOutputImageParameter.cxx b/Code/ApplicationEngine/otbWrapperOutputImageParameter.cxx index 95873b741889e659d0ee25ae0f6ada29e94b373d..2f025c2bf51151bbbdf9689df765594499cb5bc1 100644 --- a/Code/ApplicationEngine/otbWrapperOutputImageParameter.cxx +++ b/Code/ApplicationEngine/otbWrapperOutputImageParameter.cxx @@ -17,7 +17,7 @@ =========================================================================*/ #include "otbWrapperOutputImageParameter.h" #include "itkCastImageFilter.h" -#include "otbStandardFilterWatcher.h" + namespace otb { namespace Wrapper @@ -113,7 +113,6 @@ OutputImageParameter::Write( ) { m_FloatWriter->SetFileName( this->GetFileName() ); m_FloatWriter->SetInput(this->GetImage()); - //StandardFilterWatcher watch(static_cast<itk::ProcessObject*>(m_FloatWriter), "oss.str()"); m_FloatWriter->Update(); } break; diff --git a/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx b/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx index ecf6aa5d98fb245c2f41886ff7ba8bd7f5287ff8..a4038607ca2fadf84c6a5d375fa8f0bad4e3d7cb 100644 --- a/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx +++ b/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx @@ -48,7 +48,7 @@ namespace otb namespace Wrapper { -CommandLineLauncher::CommandLineLauncher() : m_Expression(""), m_FilterWatcherList(), m_WriterWatcherList() +CommandLineLauncher::CommandLineLauncher() : m_Expression(""), m_WatcherList() { m_Application = NULL; m_Parser = CommandLineParser::New(); @@ -62,8 +62,21 @@ CommandLineLauncher::CommandLineLauncher(const char * exp) : m_Expression(exp) CommandLineLauncher::~CommandLineLauncher() { + this->DeleteWatcherList(); } +void +CommandLineLauncher::DeleteWatcherList() +{ + for( unsigned int i= 0; i<m_WatcherList.size(); i++ ) + { + delete m_WatcherList[i]; + m_WatcherList[i] = NULL; + } + m_WatcherList.clear(); +} + + bool CommandLineLauncher::Load( const std::string & exp ) { @@ -348,43 +361,30 @@ CommandLineLauncher::LoadParameters() void CommandLineLauncher::LinkWatchers() { - m_FilterWatcherList.clear(); - m_WriterWatcherList.clear(); + this->DeleteWatcherList(); // Link internall filters watcher for( unsigned int i=0; i<m_Application->GetInternalProcessList().size(); i++ ) { - //std::cout<<"BRRRRRRRRRRRRRRR"<<std::endl; - //StandardFilterWatcher watch(m_Application->GetInternalProcessList()[i], m_Application->GetInternalProcessListName()[i]); - //m_FilterWatcherList.push_back( watch ); + StandardFilterWatcher * watch = new StandardFilterWatcher(m_Application->GetInternalProcessList()[i], m_Application->GetInternalProcessListName()[i]); + m_WatcherList.push_back( watch ); } // Link output image writers watchers std::vector<std::string> paramList = m_Application->GetParametersKeys(true); std::vector<std::string>::const_iterator it = paramList.begin(); - std::cout<<"BRRRRRRRRRRRRRRR"<<std::endl; for (; it != paramList.end(); ++it) { if (m_Application->GetParameterType(*it) == ParameterType_OutputImage) { - std::cout<<"-------------------------------------------------------------t'en as?"<<std::endl; Parameter* param = m_Application->GetParameterByKey(*it); OutputImageParameter* outputParam = dynamic_cast<OutputImageParameter*>(param); itk::OStringStream oss; - oss<< "Wrinting "<< param->GetName()<<std::endl; - - std::cout<<"----++++"<<std::endl; - std::cout<<"----++++: "<<outputParam->GetWriter()<<std::endl; - std::cout<<"----++++"<<std::endl; - //typedef otb::StreamingImageFileWriter<FloatVectorImageType> FloatWriterType; - //StandardWriterWatcher watch(static_cast<FloatWriterType::Pointer>(static_cast<FloatWriterType *>(outputParam->GetWriter())), "write that"); - //StandardWriterWatcher watch(outputParam->GetWriter(), "write that"); - //m_WriterWatcherList.push_back( watch ); - //StandardFilterWatcher watch(outputParam->GetWriter(), oss.str()); - //m_FilterWatcherList.push_back( watch ); - + oss<< "Wrinting "<< param->GetName()<<"..."; + + StandardFilterWatcher * watch = new StandardFilterWatcher(outputParam->GetWriter(), oss.str()); + m_WatcherList.push_back( watch ); } } - std::cout<<"BRRRRRRRRRRRRRRR fin"<<std::endl; } void diff --git a/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.h b/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.h index 60bcfc07ba080ec7e4df3b239e39814c8c80a3aa..470daeaa979a6d11fd5ab2ee16beaf168be5f268 100644 --- a/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.h +++ b/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.h @@ -27,7 +27,6 @@ #include "itksys/SystemTools.hxx" #include "otbWrapperCommandLineParser.h" -#include "otbStandardWriterWatcher.h" #include "otbStandardFilterWatcher.h" @@ -66,9 +65,7 @@ public: typedef enum { OKPARAM, MISSINGMANDATORYPARAMETER, MISSINGPARAMETERVALUE, WRONGPARAMETERVALUE, INVALIDNUMBEROFVALUE, DEFAULT} ParamResultType; /** Filter watcher list type */ - typedef std::vector<StandardFilterWatcher> FilterWatcherListType; - /** Writer watcher list type */ - typedef std::vector<StandardWriterWatcher> WriterWatcherListType; + typedef std::vector<StandardFilterWatcher *> WatcherListType; /** Load the application in several steps : * - Load the paths @@ -128,6 +125,9 @@ protected: /** Load the watchers for internal progress and writeing progress report. */ void LinkWatchers(); + /** Clear watcher list, deleting its pointers. */ + void DeleteWatcherList(); + private: CommandLineLauncher(const CommandLineLauncher &); //purposely not implemented @@ -139,8 +139,7 @@ private: std::string m_Expression; CommandLineParser::Pointer m_Parser; - FilterWatcherListType m_FilterWatcherList; - WriterWatcherListType m_WriterWatcherList; + WatcherListType m_WatcherList; }; //end class