Skip to content
Snippets Groups Projects
Commit 15634c45 authored by Julien Malik's avatar Julien Malik
Browse files

ENH: finalize Smoothing example

parent 0d7b0fbe
Branches
Tags
No related merge requests found
Showing
with 321 additions and 138 deletions
......@@ -17,6 +17,8 @@
=========================================================================*/
#include "otbWrapperApplication.h"
#include "itkImageFileWriter.h"
#include "otbStandardWriterWatcher.h"
namespace otb
{
......@@ -28,7 +30,46 @@ Application::Application(): m_Name(""), m_Description("")
}
Application::~Application()
{}
{
}
void Application::Init()
{
m_ParameterList = ParameterGroup::New();
this->DoCreateParameters();
}
void Application::UpdateParameters()
{
this->DoUpdateParameters();
}
void Application::Execute()
{
this->DoExecute();
ParameterGroup* params = GetParameterList();
for (unsigned int i = 0; i < params->GetNumberOfParameters(); ++i)
{
Parameter* p = params->GetParameter( i );
OutputImageParameter* pAsOutputImage = dynamic_cast<OutputImageParameter*>(p);
if ( pAsOutputImage != 0 )
{
OutputImageParameter::VectorImageType* image = pAsOutputImage->GetValue();
typedef itk::ImageFileWriter<OutputImageParameter::VectorImageType> WriterType;
WriterType::Pointer writer = WriterType::New();
writer->SetInput(image);
writer->SetFileName(pAsOutputImage->GetFileName());
std::cout << image << std::endl;
itk::ProcessObject* source = image->GetSource();
std::cout << source << std::endl;
otb::StandardWriterWatcher watcher(writer, source, "test");
writer->Update();
}
}
}
}
}
......
......@@ -76,21 +76,11 @@ public:
/** Get the parameter description */
itkGetStringMacro(Description);
void Init()
{
m_ParameterList = ParameterGroup::New();
this->DoCreateParameters();
}
void Init();
void UpdateParameters()
{
this->DoUpdateParameters();
}
void UpdateParameters();
void Execute()
{
this->DoExecute();
}
void Execute();
ParameterGroup* GetParameterList()
{
......
......@@ -19,6 +19,7 @@
#define __otbWrapperChoiceParameter_h
#include "otbWrapperParameter.h"
#include "otbWrapperParameterGroup.h"
namespace otb
{
......@@ -48,19 +49,39 @@ public:
itkTypeMacro(ChoiceParameter, Parameter);
/** Add a value to the choice */
void AddChoice( std::string key, Parameter::Pointer param )
void AddChoice( std::string key, std::string name, Parameter* param )
{
m_ChoiceList.push_back(std::make_pair(key, param));
ParameterGroup* paramAsGroup = dynamic_cast<ParameterGroup*>(param);
if ( paramAsGroup != 0 )
{
Choice choice;
choice.m_Key = key;
choice.m_Name = name;
choice.m_AssociatedParameter = paramAsGroup;
m_ChoiceList.push_back(choice);
}
else
{
// wrap in group first
ParameterGroup::Pointer group = ParameterGroup::New();
group->AddParameter(param);
AddChoice(key, name, group.GetPointer());
}
}
std::string GetChoiceKey( int i )
{
return m_ChoiceList[i].first;
return m_ChoiceList[i].m_Key;
}
Parameter::Pointer GetChoiceAssociatedParameter( int i )
std::string GetChoiceName( int i )
{
return m_ChoiceList[i].second;
return m_ChoiceList[i].m_Name;
}
ParameterGroup::Pointer GetChoiceAssociatedParameter( int i )
{
return m_ChoiceList[i].m_AssociatedParameter;
}
unsigned int GetNbChoices( void )
......@@ -73,7 +94,6 @@ public:
{
// Perform any cast
m_CurrentChoice = v;
// Call Modified();
this->Modified();
}
......@@ -88,7 +108,14 @@ public:
virtual void SetAnyValue(boost::any v)
{
// Perform any cast
m_CurrentChoice = boost::any_cast<unsigned int>(v);
unsigned int val = boost::any_cast<unsigned int>(v);
if ( val >= GetNbChoices() )
{
itkExceptionMacro(<< "Invalid choice value : " << val)
}
m_CurrentChoice = val;
// Call Modified();
this->Modified();
......@@ -104,13 +131,21 @@ public:
protected:
/** Constructor */
ChoiceParameter()
: m_CurrentChoice(0)
{}
/** Destructor */
virtual ~ChoiceParameter()
{}
typedef std::pair<std::string, Parameter::Pointer> Choice;
struct Choice
{
Choice() {}
std::string m_Key;
std::string m_Name;
ParameterGroup::Pointer m_AssociatedParameter;
};
typedef std::vector<Choice> ChoiceList;
ChoiceList m_ChoiceList;
......
......@@ -62,6 +62,7 @@ public:
ImageFileReaderType::Pointer reader = ImageFileReaderType::New();
reader->SetFileName(filename);
reader->UpdateOutputInformation();
m_Reader = reader;
m_Image = reader->GetOutput();
}
......@@ -84,6 +85,7 @@ protected:
{}
VectorImageType::Pointer m_Image;
itk::ProcessObject::Pointer m_Reader;
private:
InputImageParameter(const Parameter &); //purposely not implemented
......
......@@ -59,6 +59,21 @@ public:
return boost::any(m_Image);
}
/** Return any value */
void SetValue(VectorImageType* image)
{
m_Image = image;
}
/** Return any value */
VectorImageType* GetValue( void )
{
return m_Image;
}
itkSetStringMacro(FileName);
itkGetStringMacro(FileName);
protected:
/** Constructor */
OutputImageParameter()
......@@ -72,6 +87,7 @@ protected:
{}
VectorImageType::Pointer m_Image;
std::string m_FileName;
private:
OutputImageParameter(const Parameter &); //purposely not implemented
......
......@@ -29,57 +29,56 @@ QtWidgetChoiceParameter::QtWidgetChoiceParameter(ChoiceParameter* param, QtWidge
: QtWidgetParameterBase(m),
m_ChoiceParam(param)
{
this->CreateWidget();
}
QtWidgetChoiceParameter::~QtWidgetChoiceParameter()
{
}
void QtWidgetChoiceParameter::CreateWidget()
void QtWidgetChoiceParameter::DoUpdateGUI()
{
// Update the combobox value
unsigned int value = m_ChoiceParam->GetValue( );
m_ComboBox->setCurrentIndex(value);
// Update the choice subparameters
WidgetListIteratorType it = m_WidgetList.begin();
for (it = m_WidgetList.begin(); it != m_WidgetList.end(); ++it)
{
(*it)->UpdateGUI();
}
}
void QtWidgetChoiceParameter::DoCreateWidget()
{
m_ComboBox = new QComboBox;
m_ComboBox->setToolTip(m_ChoiceParam->GetDescription());
m_StackWidget = new QStackedWidget;
connect( m_ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(SetValue(int)) );
connect( m_ComboBox, SIGNAL(currentIndexChanged(int)), m_StackWidget, SLOT(setCurrentIndex(int)) );
for (unsigned int i = 0; i < m_ChoiceParam->GetNbChoices(); ++i)
{
QString key = QString::fromStdString( m_ChoiceParam->GetChoiceKey(i) );
QString key = QString::fromStdString( m_ChoiceParam->GetChoiceName(i) );
m_ComboBox->addItem( key, QVariant(key) );
Parameter::Pointer param = m_ChoiceParam->GetChoiceAssociatedParameter(i);
ParameterGroup::Pointer param = m_ChoiceParam->GetChoiceAssociatedParameter(i);
if (param.IsNotNull())
{
std::cout << param->GetName() << std::endl;
QWidget* label = new QtWidgetParameterLabel( param );
QWidget* specificWidget = QtWidgetParameterFactory::CreateQtWidget( param, GetModel() );
QHBoxLayout* hbox = new QHBoxLayout;
hbox->addWidget(label);
hbox->addWidget(specificWidget);
QGroupBox* group = new QGroupBox;
group->setLayout(hbox);
m_StackWidget->addWidget(group);
QtWidgetParameterBase* widget = QtWidgetParameterFactory::CreateQtWidget( param, GetModel() );
m_StackWidget->addWidget(widget);
m_WidgetList.push_back(widget);
}
}
connect( m_ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(SetValue(int)) );
connect( m_ComboBox, SIGNAL(currentIndexChanged(int)), m_StackWidget, SLOT(setCurrentIndex(int)) );
m_VLayout = new QVBoxLayout;
m_VLayout->addWidget(m_ComboBox);
m_VLayout->addWidget(m_StackWidget);
m_VLayout->addStretch();
m_VLayoutGroup = new QGroupBox;
m_VLayoutGroup->setLayout(m_VLayout);
m_VLayoutGroup->setFlat(true);
m_MainHLayout = new QHBoxLayout;
m_MainHLayout->setSpacing(0);
m_MainHLayout->setContentsMargins(0,0,0,0);
m_MainHLayout->addWidget(m_VLayoutGroup);
this->setLayout(m_MainHLayout);
this->setLayout(m_VLayout);
}
void QtWidgetChoiceParameter::SetValue(int value)
......
......@@ -20,6 +20,7 @@
#include <QtGui>
#include "otbWrapperChoiceParameter.h"
#include "otbWrapperParameterGroup.h"
#include "otbWrapperQtWidgetParameterBase.h"
namespace otb
......@@ -40,15 +41,16 @@ public:
protected slots:
void SetValue( int value );
protected:
void CreateWidget();
ChoiceParameter::Pointer m_ChoiceParam;
private:
QtWidgetChoiceParameter(const QtWidgetChoiceParameter&); //purposely not implemented
void operator=(const QtWidgetChoiceParameter&); //purposely not implemented
virtual void DoCreateWidget();
virtual void DoUpdateGUI();
ChoiceParameter::Pointer m_ChoiceParam;
QHBoxLayout* m_MainHLayout;
QComboBox* m_ComboBox;
......@@ -56,6 +58,10 @@ private:
QVBoxLayout* m_VLayout;
QGroupBox* m_VLayoutGroup;
typedef std::vector<QtWidgetParameterBase*> WidgetListType;
typedef WidgetListType::iterator WidgetListIteratorType;
WidgetListType m_WidgetList;
};
}
......
......@@ -24,6 +24,19 @@ namespace Wrapper
QtWidgetEmptyParameter::QtWidgetEmptyParameter(EmptyParameter* emptyParam, QtWidgetModel* m)
: QtWidgetParameterBase(m)
{
}
QtWidgetEmptyParameter::~QtWidgetEmptyParameter()
{
}
void QtWidgetEmptyParameter::DoUpdateGUI()
{
}
void QtWidgetEmptyParameter::DoCreateWidget()
{
// Set up input text edit
QHBoxLayout *hLayout = new QHBoxLayout;
......@@ -40,9 +53,5 @@ QtWidgetEmptyParameter::QtWidgetEmptyParameter(EmptyParameter* emptyParam, QtWid
this->setLayout(hLayout);
}
QtWidgetEmptyParameter::~QtWidgetEmptyParameter()
{
}
}
}
......@@ -42,6 +42,9 @@ private:
QtWidgetEmptyParameter(const QtWidgetEmptyParameter&); //purposely not implemented
void operator=(const QtWidgetEmptyParameter&); //purposely not implemented
virtual void DoCreateWidget();
virtual void DoUpdateGUI();
};
......
......@@ -26,33 +26,42 @@ QtWidgetFloatParameter::QtWidgetFloatParameter(FloatParameter* floatParam, QtWid
: QtWidgetParameterBase(m),
m_FloatParam(floatParam)
{
// Set up input text edit
QHBoxLayout *hLayout = new QHBoxLayout;
hLayout->setSpacing(0);
hLayout->setContentsMargins(0,0,0,0);
QDoubleSpinBox* input = new QDoubleSpinBox;
input->setDecimals(5);
input->setRange(floatParam->GetMinimumValue(), floatParam->GetMaximumValue());
input->setToolTip(floatParam->GetDescription());
connect( input, SIGNAL(valueChanged(double)), this, SLOT(SetValue(double)) );
connect( input, SIGNAL(valueChanged(double)), GetModel(), SLOT(NotifyUpdate()) );
}
//QString optionID(floatParam->GetName());
hLayout->addWidget(input);
hLayout->addStretch();
QtWidgetFloatParameter::~QtWidgetFloatParameter()
{
}
this->setLayout(hLayout);
void QtWidgetFloatParameter::DoUpdateGUI()
{
bool signalsBlocked = m_QDoubleSpinBox->blockSignals( true );
m_QDoubleSpinBox->setValue(m_FloatParam->GetValue());
m_QDoubleSpinBox->blockSignals( signalsBlocked );
}
QtWidgetFloatParameter::~QtWidgetFloatParameter()
void QtWidgetFloatParameter::DoCreateWidget()
{
m_QHBoxLayout = new QHBoxLayout;
m_QHBoxLayout->setSpacing(0);
m_QHBoxLayout->setContentsMargins(0,0,0,0);
m_QDoubleSpinBox = new QDoubleSpinBox;
m_QDoubleSpinBox->setDecimals(5);
m_QDoubleSpinBox->setRange(m_FloatParam->GetMinimumValue(), m_FloatParam->GetMaximumValue());
m_QDoubleSpinBox->setToolTip(m_FloatParam->GetDescription());
connect( m_QDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(SetValue(double)) );
connect( m_QDoubleSpinBox, SIGNAL(valueChanged(double)), GetModel(), SLOT(NotifyUpdate()) );
m_QHBoxLayout->addWidget(m_QDoubleSpinBox);
m_QHBoxLayout->addStretch();
this->setLayout(m_QHBoxLayout);
}
void QtWidgetFloatParameter::SetValue(double value)
{
std::cout << "QtWidgetFloatParameter::SetValue " << value << std::endl;
m_FloatParam->SetValue( static_cast<float>(value) );
}
......
......@@ -44,6 +44,13 @@ private:
QtWidgetFloatParameter(const QtWidgetFloatParameter&); //purposely not implemented
void operator=(const QtWidgetFloatParameter&); //purposely not implemented
virtual void DoCreateWidget();
virtual void DoUpdateGUI();
QHBoxLayout * m_QHBoxLayout;
QDoubleSpinBox * m_QDoubleSpinBox;
FloatParameter::Pointer m_FloatParam;
};
......
......@@ -26,45 +26,50 @@ QtWidgetInputImageParameter::QtWidgetInputImageParameter(InputImageParameter* pa
: QtWidgetParameterBase(m),
m_InputImageParam(param)
{
this->CreateWidget();
}
QtWidgetInputImageParameter::~QtWidgetInputImageParameter()
{
}
void QtWidgetInputImageParameter::CreateWidget()
void QtWidgetInputImageParameter::DoUpdateGUI()
{
}
void QtWidgetInputImageParameter::DoCreateWidget()
{
// Set up input text edit
QHBoxLayout *hLayout = new QHBoxLayout;
hLayout->setSpacing(0);
hLayout->setContentsMargins(0,0,0,0);
QLineEdit* input = new QLineEdit;
input->setToolTip( m_InputImageParam->GetDescription() );
connect( input, SIGNAL(textChanged(const QString&)), this, SLOT(SetFileName(const QString&)) );
hLayout->addWidget(input);
m_HLayout = new QHBoxLayout;
m_HLayout->setSpacing(0);
m_HLayout->setContentsMargins(0,0,0,0);
m_Input = new QLineEdit;
m_Input->setToolTip( m_InputImageParam->GetDescription() );
connect( m_Input, SIGNAL(textChanged(const QString&)), this, SLOT(SetFileName(const QString&)) );
m_HLayout->addWidget(m_Input);
// Set up input text edit
QPushButton *button = new QPushButton;
button->setText("...");
button->setToolTip("Select file...");
button->setMaximumWidth(button->width());
connect( button, SIGNAL(clicked()), this, SLOT(SelectFile()) );
hLayout->addWidget(button);
this->setLayout(hLayout);
m_Button = new QPushButton;
m_Button->setText("...");
m_Button->setToolTip("Select file...");
m_Button->setMaximumWidth(m_Button->width());
connect( m_Button, SIGNAL(clicked()), this, SLOT(SelectFile()) );
m_HLayout->addWidget(m_Button);
this->setLayout(m_HLayout);
}
void QtWidgetInputImageParameter::SelectFile()
{
QFileDialog fileDialog;
fileDialog.setConfirmOverwrite(true);
fileDialog.setFileMode(QFileDialog::AnyFile);
fileDialog.setFileMode(QFileDialog::ExistingFile);
fileDialog.setNameFilter("Raster files (*)");
if (fileDialog.exec())
{
this->SetFileName(fileDialog.selectedFiles().at(0));
//this->SetFileName(fileDialog.selectedFiles().at(0));
m_Input->setText(fileDialog.selectedFiles().at(0));
}
}
......
......@@ -42,14 +42,19 @@ protected slots:
void SetFileName( const QString& value );
void SelectFile();
protected:
void CreateWidget();
private:
QtWidgetInputImageParameter(const QtWidgetInputImageParameter&); //purposely not implemented
void operator=(const QtWidgetInputImageParameter&); //purposely not implemented
virtual void DoCreateWidget();
virtual void DoUpdateGUI();
InputImageParameter::Pointer m_InputImageParam;
QHBoxLayout * m_HLayout;
QLineEdit* m_Input;
QPushButton * m_Button;
};
......
......@@ -25,32 +25,42 @@ namespace Wrapper
QtWidgetIntParameter::QtWidgetIntParameter(IntParameter* param, QtWidgetModel* m)
: QtWidgetParameterBase(m),
m_IntParam(param)
{
}
QtWidgetIntParameter::~QtWidgetIntParameter()
{
}
void QtWidgetIntParameter::DoCreateWidget()
{
// Set up input text edit
QHBoxLayout *hLayout = new QHBoxLayout;
hLayout->setSpacing(0);
hLayout->setContentsMargins(0,0,0,0);
m_QHBoxLayout = new QHBoxLayout;
m_QHBoxLayout->setSpacing(0);
m_QHBoxLayout->setContentsMargins(0,0,0,0);
QSpinBox* input = new QSpinBox;
input->setRange(param->GetMinimumValue(), param->GetMaximumValue());
input->setToolTip(param->GetDescription());
m_QSpinBox = new QSpinBox;
m_QSpinBox->setRange(m_IntParam->GetMinimumValue(), m_IntParam->GetMaximumValue());
m_QSpinBox->setToolTip(m_IntParam->GetDescription());
connect( input, SIGNAL(valueChanged(int)), this, SLOT(SetValue(int)) );
connect( input, SIGNAL(valueChanged(int)), GetModel(), SLOT(NotifyUpdate()) );
connect( m_QSpinBox, SIGNAL(valueChanged(int)), this, SLOT(SetValue(int)) );
connect( m_QSpinBox, SIGNAL(valueChanged(int)), GetModel(), SLOT(NotifyUpdate()) );
hLayout->addWidget(input);
hLayout->addStretch();
m_QHBoxLayout->addWidget(m_QSpinBox);
m_QHBoxLayout->addStretch();
this->setLayout(hLayout);
this->setLayout(m_QHBoxLayout);
}
QtWidgetIntParameter::~QtWidgetIntParameter()
void QtWidgetIntParameter::DoUpdateGUI()
{
bool signalsBlocked = m_QSpinBox->blockSignals( true );
m_QSpinBox->setValue(m_IntParam->GetValue());
m_QSpinBox->blockSignals( signalsBlocked );
}
void QtWidgetIntParameter::SetValue(int value)
{
std::cout << "QtWidgetIntParameter::SetValue " << value << std::endl;
m_IntParam->SetValue(value);
}
......
......@@ -45,6 +45,13 @@ private:
QtWidgetIntParameter(const QtWidgetIntParameter&); //purposely not implemented
void operator=(const QtWidgetIntParameter&); //purposely not implemented
virtual void DoCreateWidget();
virtual void DoUpdateGUI();
QHBoxLayout * m_QHBoxLayout;
QSpinBox * m_QSpinBox;
IntParameter::Pointer m_IntParam;
};
......
......@@ -26,33 +26,37 @@ QtWidgetOutputImageParameter::QtWidgetOutputImageParameter(OutputImageParameter*
: QtWidgetParameterBase(m),
m_OutputImageParam(param)
{
this->CreateWidget();
}
QtWidgetOutputImageParameter::~QtWidgetOutputImageParameter()
{
}
void QtWidgetOutputImageParameter::CreateWidget()
void QtWidgetOutputImageParameter::DoUpdateGUI()
{
}
void QtWidgetOutputImageParameter::DoCreateWidget()
{
// Set up input text edit
QHBoxLayout *hLayout = new QHBoxLayout;
hLayout->setSpacing(0);
hLayout->setContentsMargins(0,0,0,0);
QLineEdit* input = new QLineEdit;
input->setToolTip( m_OutputImageParam->GetDescription() );
connect( input, SIGNAL(textChanged(const QString&)), this, SLOT(SetFileName(const QString&)) );
hLayout->addWidget(input);
m_HLayout = new QHBoxLayout;
m_HLayout->setSpacing(0);
m_HLayout->setContentsMargins(0,0,0,0);
m_Input = new QLineEdit;
m_Input->setToolTip( m_OutputImageParam->GetDescription() );
connect( m_Input, SIGNAL(textChanged(const QString&)), this, SLOT(SetFileName(const QString&)) );
m_HLayout->addWidget(m_Input);
// Set up input text edit
QPushButton *button = new QPushButton;
button->setText("...");
button->setToolTip("Select output filename...");
button->setMaximumWidth(button->width());
connect( button, SIGNAL(clicked()), this, SLOT(SelectFile()) );
hLayout->addWidget(button);
this->setLayout(hLayout);
m_Button = new QPushButton;
m_Button->setText("...");
m_Button->setToolTip("Select output filename...");
m_Button->setMaximumWidth(m_Button->width());
connect( m_Button, SIGNAL(clicked()), this, SLOT(SelectFile()) );
m_HLayout->addWidget(m_Button);
this->setLayout(m_HLayout);
}
void QtWidgetOutputImageParameter::SelectFile()
......@@ -64,7 +68,8 @@ void QtWidgetOutputImageParameter::SelectFile()
if (fileDialog.exec())
{
this->SetFileName(fileDialog.selectedFiles().at(0));
//this->SetFileName(fileDialog.selectedFiles().at(0));
m_Input->setText(fileDialog.selectedFiles().at(0));
}
}
......@@ -73,6 +78,8 @@ void QtWidgetOutputImageParameter::SetFileName(const QString& value)
// save value
m_FileName = value.toStdString();
m_OutputImageParam->SetFileName(m_FileName);
// notify of value change
QString key( QString::fromStdString(m_OutputImageParam->GetKey()) );
emit ParameterChanged(key);
......
......@@ -42,16 +42,20 @@ protected slots:
void SetFileName( const QString& value );
void SelectFile();
protected:
void CreateWidget();
private:
QtWidgetOutputImageParameter(const QtWidgetOutputImageParameter&); //purposely not implemented
void operator=(const QtWidgetOutputImageParameter&); //purposely not implemented
virtual void DoCreateWidget();
virtual void DoUpdateGUI();
std::string m_FileName;
OutputImageParameter::Pointer m_OutputImageParam;
QHBoxLayout * m_HLayout;
QLineEdit* m_Input;
QPushButton * m_Button;
};
......
......@@ -31,6 +31,16 @@ QtWidgetParameterBase::~QtWidgetParameterBase()
{
}
void QtWidgetParameterBase::CreateWidget()
{
this->DoCreateWidget();
}
void QtWidgetParameterBase::UpdateGUI()
{
this->DoUpdateGUI();
}
void QtWidgetParameterBase::ParameterChanged(const QString& key)
{
......
......@@ -37,6 +37,9 @@ public:
QtWidgetParameterBase(QtWidgetModel*);
virtual ~QtWidgetParameterBase();
void CreateWidget();
void UpdateGUI();
protected slots:
void ParameterChanged(const QString& key);
......@@ -47,6 +50,10 @@ private:
QtWidgetParameterBase(const QtWidgetParameterBase&); //purposely not implemented
void operator=(const QtWidgetParameterBase&); //purposely not implemented
virtual void DoUpdateGUI() = 0;
virtual void DoCreateWidget() = 0;
QtWidgetModel* m_Model;
};
......
......@@ -17,6 +17,11 @@
=========================================================================*/
#include "otbWrapperQtWidgetParameterFactory.h"
#include "otbWrapperParameter.h"
#include "otbWrapperQtWidgetModel.h"
#include "otbWrapperQtWidgetParameterBase.h"
#include "otbWrapperQtWidgetEmptyParameter.h"
#include "otbWrapperQtWidgetIntParameter.h"
#include "otbWrapperQtWidgetFloatParameter.h"
......@@ -41,9 +46,9 @@ public:
return dynamic_cast<TParameterType *>(param) != 0;
}
static QWidget* Create( Parameter* param, QtWidgetModel* model )
static QtWidgetParameterBase* Create( Parameter* param, QtWidgetModel* model )
{
QWidget* widget = 0;
QtWidgetParameterBase* widget = 0;
TParameterType* specificParam = dynamic_cast<TParameterType *>(param);
if (specificParam)
......@@ -62,10 +67,10 @@ QtWidgetParameterFactory::~QtWidgetParameterFactory()
{
}
QWidget*
QtWidgetParameterBase*
QtWidgetParameterFactory::CreateQtWidget( Parameter* param, QtWidgetModel* model )
{
QtWidgetParameterBase* widget = 0;
#define CREATEWIDGET( ParameterType, WidgetType ) \
else if ( QtWidgetParameterGenericFactory<ParameterType, WidgetType>::CanCreate(param) ) \
......@@ -73,8 +78,6 @@ QtWidgetParameterFactory::CreateQtWidget( Parameter* param, QtWidgetModel* model
widget = QtWidgetParameterGenericFactory<ParameterType, WidgetType>::Create(param, model); \
}
QWidget* widget = 0;
if (0) {}
CREATEWIDGET(EmptyParameter, QtWidgetEmptyParameter)
CREATEWIDGET(IntParameter, QtWidgetIntParameter)
......@@ -86,9 +89,17 @@ QtWidgetParameterFactory::CreateQtWidget( Parameter* param, QtWidgetModel* model
CREATEWIDGET(EmptyParameter, QtWidgetEmptyParameter)
CREATEWIDGET(ParameterGroup, QtWidgetParameterGroup)
#undef CREATEWIDGET
if (widget)
{
widget->CreateWidget();
widget->UpdateGUI();
}
return widget;
#undef CREATEWIDGET
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment