Skip to content
Snippets Groups Projects
Commit a2255bfd authored by Julien Michel's avatar Julien Michel
Browse files

ENH: Adding factory for float params

parent eb9642c3
No related branches found
No related tags found
No related merge requests found
/*=========================================================================
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;
}
}
}
/*=========================================================================
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment