diff --git a/Code/Wrappers/QtWidget/otbWrapperQtWidgetFloatParameterFactory.cxx b/Code/Wrappers/QtWidget/otbWrapperQtWidgetFloatParameterFactory.cxx new file mode 100644 index 0000000000000000000000000000000000000000..902a82bc93648d8cae9783b3c86af22cd53727f9 --- /dev/null +++ b/Code/Wrappers/QtWidget/otbWrapperQtWidgetFloatParameterFactory.cxx @@ -0,0 +1,65 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#include "otbWrapperQtWidgetFloatParameterFactory.h" +#include "otbWrapperNumericalParameter.h" + + +namespace otb +{ + +namespace Wrapper +{ + +QtWidgetFloatParameterFactory::QtWidgetFloatParameterFactory() +{} + +QtWidgetFloatParameterFactory::~QtWidgetFloatParameterFactory() +{} + +QWidget * QtWidgetFloatParameterFactory::CreateQtWidget(Parameter * param) +{ + // Try to cast to int parameter + FloatParameter * floatParam = dynamic_cast<FloatParameter *>(param); + + // Check if dynamic cast succeeds + if(!param) + { + return 0; + } + + // 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()); + + QString optionID(floatParam->GetName()); + hLayout->addWidget(input); + hLayout->addStretch(); + + QGroupBox *paramHGroup = new QGroupBox; + paramHGroup->setLayout(hLayout); + return paramHGroup; +} +} +} diff --git a/Code/Wrappers/QtWidget/otbWrapperQtWidgetFloatParameterFactory.h b/Code/Wrappers/QtWidget/otbWrapperQtWidgetFloatParameterFactory.h new file mode 100644 index 0000000000000000000000000000000000000000..23b30d5a32e9bb919cc70c9aaf3b8bebd625b15d --- /dev/null +++ b/Code/Wrappers/QtWidget/otbWrapperQtWidgetFloatParameterFactory.h @@ -0,0 +1,59 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#ifndef __otbWrapperQtWidgetFloatParameterFactory_h +#define __otbWrapperQtWidgetFloatParameterFactory_h + +#include "otbWrapperNumericalParameter.h" +#include "otbWrapperQtWidgetParameterFactory.h" + +namespace otb +{ +namespace Wrapper +{ + +class QtWidgetFloatParameterFactory +: public QtWidgetParameterFactory +{ +public: + /** Standard class typedef */ + typedef QtWidgetFloatParameterFactory Self; + typedef QtWidgetParameterFactory Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Defining ::New() static method */ + itkNewMacro(Self); + + /** RTTI support */ + itkTypeMacro(QtWidgetFloatParameterFactory,otb::Wrapper::QtWidgetParameterFactory); + + /** Create the appropriate ImageIO depending on the particulars of the file. */ + static QWidget * CreateQtWidget(Parameter * param); + +protected: + QtWidgetFloatParameterFactory(); + ~QtWidgetFloatParameterFactory(); + +private: + QtWidgetFloatParameterFactory(const Self&); //purposely not implemented + void operator=(const Self&); //purposely not implemented +}; +} +} + +#endif