From b63b08df530a55fafd47cf9ca1016e5177b7228f Mon Sep 17 00:00:00 2001 From: Otmane Lahlou <otmane.lahlou@c-s.fr> Date: Mon, 19 Sep 2011 16:43:13 +0200 Subject: [PATCH] ENH : handle the output image pixel type choice in the QtWidgetOutputImageParameter --- ...otbWrapperQtWidgetOutputImageParameter.cxx | 23 +++++++++++++++++++ .../otbWrapperQtWidgetOutputImageParameter.h | 7 ++++++ 2 files changed, 30 insertions(+) diff --git a/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputImageParameter.cxx b/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputImageParameter.cxx index f75f106522..767dc50926 100644 --- a/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputImageParameter.cxx +++ b/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputImageParameter.cxx @@ -16,6 +16,7 @@ =========================================================================*/ #include "otbWrapperQtWidgetOutputImageParameter.h" +#include "otbWrapperTypes.h" namespace otb { @@ -49,6 +50,22 @@ void QtWidgetOutputImageParameter::DoCreateWidget() connect( m_Input, SIGNAL(textChanged(const QString&)), GetModel(), SLOT(NotifyUpdate()) ); m_HLayout->addWidget(m_Input); + // Set the Output PixelType choice Combobox + m_ComboBox = new QComboBox; + m_ComboBox->setToolTip("Output Pixel Type"); + m_ComboBox->addItem( "char"); + m_ComboBox->addItem( "unsigned char"); + m_ComboBox->addItem( "short"); + m_ComboBox->addItem( "unsigned short"); + m_ComboBox->addItem( "int"); + m_ComboBox->addItem( "unsigned int"); + m_ComboBox->addItem( "float"); + m_ComboBox->addItem( "double"); + m_ComboBox->setCurrentIndex(m_OutputImageParam->GetPixelType()); + connect( m_ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(SetPixelType(int)) ); + connect( m_ComboBox, SIGNAL(currentIndexChanged(int)), GetModel(), SLOT(NotifyUpdate()) ); + m_HLayout->addWidget(m_ComboBox); + // Set up input text edit m_Button = new QPushButton; m_Button->setText("..."); @@ -86,5 +103,11 @@ void QtWidgetOutputImageParameter::SetFileName(const QString& value) emit ParameterChanged(key); } +void QtWidgetOutputImageParameter::SetPixelType(int pixelType) +{ + m_OutputImageParam->SetPixelType(static_cast< ImagePixelType >(pixelType)); + m_PixelType = pixelType; +} + } } diff --git a/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputImageParameter.h b/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputImageParameter.h index da514aeecb..b3eec8f870 100644 --- a/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputImageParameter.h +++ b/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputImageParameter.h @@ -38,9 +38,13 @@ public: QtWidgetOutputImageParameter(OutputImageParameter*, QtWidgetModel*); virtual ~QtWidgetOutputImageParameter(); + /** Get the PixelType*/ + //itkGetMacro(PixelType, int); + protected slots: void SetFileName( const QString& value ); void SelectFile(); + void SetPixelType(int pixelType); private: QtWidgetOutputImageParameter(const QtWidgetOutputImageParameter&); //purposely not implemented @@ -56,6 +60,9 @@ private: QHBoxLayout * m_HLayout; QLineEdit* m_Input; QPushButton * m_Button; + QComboBox* m_ComboBox; + int m_PixelType; + }; -- GitLab