Commit be1c61ba authored by Stéphane Albert's avatar Stéphane Albert

ENH: Automated Qt's widget; REFAC: Separated inline methods declaration from...

ENH: Automated Qt's widget; REFAC: Separated inline methods declaration from inline body implementation.
parent 9515379d
......@@ -62,7 +62,19 @@ ColorDynamicsWidget
/*******************************************************************************/
/* SLOTS */
/*******************************************************************************/
/*****************************************************************************/
void
ColorDynamicsWidget
::on_lowQuantileSpinBox_valueChanged( double value )
{
}
/*****************************************************************************/
void
ColorDynamicsWidget
::on_highQuantileSpinBox_valueChanged( double value )
{
}
/*******************************************************************************/
......
......@@ -24,6 +24,10 @@
//// Included at first position before any other ones.
#include "ConfigureMonteverdi2.h"
/*****************************************************************************/
/* INCLUDE SECTION */
//
// Qt includes (sorted by alphabetic order)
//// Must be included before system/custom includes.
......@@ -41,6 +45,10 @@
//
// Monteverdi includes (sorted by alphabetic order)
/*****************************************************************************/
/* PRE-DECLARATION SECTION */
//
// External classes pre-declaration.
namespace
......@@ -56,14 +64,65 @@ namespace Ui
class ColorDynamicsWidget;
};
/*****************************************************************************/
/* CLASS DEFINITION SECTION */
/**
* \class ColorDynamicsWidget
*/
class Monteverdi2_EXPORT ColorDynamicsWidget :
public QWidget
{
/*-[ QOBJECT SECTION ]-----------------------------------------------------*/
Q_OBJECT;
#if 0
/** */
Q_PROPERTY( double lowIntensity
READ GetLowIntensity
WRITE SetLowIntensity );
/** */
Q_PROPERTY( double highIntensity
READ GetHighIntensity
WRITE SetHighIntensity );
/** */
Q_PROPERTY( double minIntensity
READ GetMinIntensity
WRITE SetMinIntensity );
/** */
Q_PROPERTY( double maxIntensity
READ GetMinIntensity
WRITE SetMinIntensity );
/** */
Q_PROPERTY( double lowQuantile
READ GetLowQuantile
WRITE SetLowQuantile );
/** */
Q_PROPERTY( double highQuantile
READ GetHighQuantile
WRITE SetHighQuantile );
/** */
Q_PROPERTY( double minQuantile
READ GetMinQuantile
WRITE SetMinQuantile );
/** */
Q_PROPERTY( double maxQuantile
READ GetMinQuantile
WRITE SetMinQuantile );
#endif
/*-[ PUBLIC SECTION ]------------------------------------------------------*/
//
// Public methods.
public:
......@@ -74,10 +133,14 @@ public:
/** Destructor */
virtual ~ColorDynamicsWidget();
/*-[ SIGNALS SECTION ]-----------------------------------------------------*/
//
// SIGNALS.
// Signals.
signals:
/*-[ PROTECTED SECTION ]---------------------------------------------------*/
//
// Protected methods.
protected:
......@@ -86,6 +149,8 @@ protected:
// Protected attributes.
protected:
/*-[ PRIVATE SECTION ]-----------------------------------------------------*/
//
// Private methods.
private:
......@@ -98,11 +163,56 @@ private:
*/
Ui::ColorDynamicsWidget* m_UI;
/*-[ PRIVATE SLOTS SECTION ]-----------------------------------------------*/
//
// SLOTS.
// Slots.
private slots:
inline void on_lowIntensitySpinBox_valueChanged( double );
inline void on_highIntensitySpinBox_valueChanged( double );
void on_lowQuantileSpinBox_valueChanged( double );
void on_highQuantileSpinBox_valueChanged( double );
void on_minMaxButton_clicked();
void on_defaultsButton_clicked();
};
/*****************************************************************************/
/* INLINE SECTION */
/*****************************************************************************/
inline
void
ColorDynamicsWidget
::on_lowIntensitySpinBox_valueChanged( double value )
{
}
/*****************************************************************************/
inline
void
ColorDynamicsWidget
::on_highIntensitySpinBox_valueChanged( double value )
{
}
/*****************************************************************************/
inline
void
ColorDynamicsWidget
::on_minMaxButton_clicked()
{
}
/*****************************************************************************/
inline
void
ColorDynamicsWidget
::on_defaultsButton_clicked()
{
}
} // end namespace 'mvd'
#endif // __mvdColorDynamicsWidget_h
......@@ -20,7 +20,7 @@
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QLabel" name="m_LowLabel">
<widget class="QLabel" name="lowLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
......@@ -36,7 +36,7 @@
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="m_HighLabel">
<widget class="QLabel" name="highLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
......@@ -52,7 +52,7 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="m_IntensityLabel">
<widget class="QLabel" name="intensityLabel">
<property name="text">
<string>Intensity:</string>
</property>
......@@ -62,7 +62,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="m_LowIntensitySpinBox">
<widget class="QDoubleSpinBox" name="lowIntensitySpinBox">
<property name="frame">
<bool>true</bool>
</property>
......@@ -78,7 +78,7 @@
</widget>
</item>
<item row="1" column="2">
<widget class="QDoubleSpinBox" name="m_HighIntensitySpinBox">
<widget class="QDoubleSpinBox" name="highIntensitySpinBox">
<property name="frame">
<bool>true</bool>
</property>
......@@ -94,7 +94,10 @@
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="m_MinMaxButton">
<widget class="QPushButton" name="minMaxButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
......@@ -107,7 +110,7 @@
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="m_QuantileLabel">
<widget class="QLabel" name="quantileLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
......@@ -123,7 +126,10 @@
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="m_LowQuantileSpinBox">
<widget class="QDoubleSpinBox" name="lowQuantileSpinBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="frame">
<bool>true</bool>
</property>
......@@ -136,7 +142,10 @@
</widget>
</item>
<item row="2" column="2">
<widget class="QDoubleSpinBox" name="m_HighQuantileSpinBox">
<widget class="QDoubleSpinBox" name="highQuantileSpinBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="frame">
<bool>true</bool>
</property>
......@@ -149,7 +158,10 @@
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="m_DefaultsButton">
<widget class="QPushButton" name="defaultsButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
......
......@@ -42,9 +42,9 @@ namespace
{
const char* QCOMBOBOX_NAMES[ /* ColorSetupWidget::CHANNEL_COUNT */ ] = {
"m_RedComboBox",
"m_GreenComboBox",
"m_BlueComboBox"
"redComboBox",
"greenComboBox",
"blueComboBox"
};
}
......@@ -64,21 +64,6 @@ ColorSetupWidget
m_UI( new mvd::Ui::ColorSetupWidget() )
{
m_UI->setupUi( this );
QObject::connect(
m_UI->m_RedComboBox, SIGNAL( currentIndexChanged( int ) ),
this, SLOT( onRedIndexChanged( int ) )
);
QObject::connect(
m_UI->m_GreenComboBox, SIGNAL( currentIndexChanged( int ) ),
this, SLOT( onGreenIndexChanged( int ) )
);
QObject::connect(
m_UI->m_BlueComboBox, SIGNAL( currentIndexChanged( int ) ),
this, SLOT( onBlueIndexChanged( int ) )
);
}
/*******************************************************************************/
......@@ -94,9 +79,9 @@ ColorSetupWidget
{
m_Components = components;
m_UI->m_RedComboBox->clear();
m_UI->m_GreenComboBox->clear();
m_UI->m_BlueComboBox->clear();
m_UI->redComboBox->clear();
m_UI->greenComboBox->clear();
m_UI->blueComboBox->clear();
QStringList itemTexts( components );
......@@ -114,41 +99,14 @@ ColorSetupWidget
}
}
m_UI->m_RedComboBox->addItems( itemTexts );
m_UI->m_GreenComboBox->addItems( itemTexts );
m_UI->m_BlueComboBox->addItems( itemTexts );
/*
switch( components.size() )
{
case 0:
// No components should not be met but in case...
// ...disable all (RGB) video channels.
m_UI->m_RedComboBox->setCurrentIndex( 0 );
m_UI->m_GreenComboBox->setCurrentIndex( 0 );
m_UI->m_BlueComboBox->setCurrentIndex( 0 );
break;
case 1:
case 2:
m_UI->m_RedComboBox->setCurrentIndex( 1 );
m_UI->m_GreenComboBox->setCurrentIndex( 1 );
m_UI->m_BlueComboBox->setCurrentIndex( 1 );
break;
default:
// TODO: Choose indices depending on component name.
m_UI->m_RedComboBox->setCurrentIndex( 1 );
m_UI->m_GreenComboBox->setCurrentIndex( 2 );
m_UI->m_BlueComboBox->setCurrentIndex( 3 );
break;
}
*/
m_UI->redComboBox->addItems( itemTexts );
m_UI->greenComboBox->addItems( itemTexts );
m_UI->blueComboBox->addItems( itemTexts );
// Black screen.
m_UI->m_RedComboBox->setCurrentIndex( 0 );
m_UI->m_GreenComboBox->setCurrentIndex( 0 );
m_UI->m_BlueComboBox->setCurrentIndex( 0 );
m_UI->redComboBox->setCurrentIndex( 0 );
m_UI->greenComboBox->setCurrentIndex( 0 );
m_UI->blueComboBox->setCurrentIndex( 0 );
}
/*******************************************************************************/
......
......@@ -67,7 +67,7 @@ class Monteverdi2_EXPORT ColorSetupWidget :
/**
* The (user) component-name list.
*/
Q_PROPERTY( QStringList m_Components
Q_PROPERTY( QStringList components
READ GetComponents
WRITE SetComponents );
......@@ -202,7 +202,7 @@ private slots:
*/
inline
void
onRedIndexChanged( int index )
on_redComboBox_currentIndexChanged( int index )
{
emit currentIndexChanged( CHANNEL_RED, index );
}
......@@ -213,19 +213,18 @@ private slots:
*/
inline
void
onGreenIndexChanged( int index )
on_greenComboBox_currentIndexChanged( int index )
{
emit currentIndexChanged( CHANNEL_GREEN, index );
}
/**
* Slot called when the curernt-index of the blue video-channel has
* been modified.
*/
inline
void
onBlueIndexChanged( int index )
on_blueComboBox_currentIndexChanged( int index )
{
emit currentIndexChanged( CHANNEL_BLUE, index );
}
......
......@@ -20,7 +20,7 @@
<item row="0" column="1">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QLabel" name="m_FileComponentLabel">
<widget class="QLabel" name="fileComponentLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
......@@ -38,7 +38,7 @@
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<widget class="QLabel" name="m_RedLabel">
<widget class="QLabel" name="redLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
......@@ -54,7 +54,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="m_RLabel">
<widget class="QLabel" name="rLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
......@@ -67,7 +67,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<widget class="QLabel" name="rLeftArrow">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
......@@ -82,7 +82,7 @@
</layout>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="m_RedComboBox">
<widget class="QComboBox" name="redComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
......@@ -112,7 +112,7 @@
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<widget class="QLabel" name="m_GreenLabel">
<widget class="QLabel" name="greenLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
......@@ -128,7 +128,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="m_GLabel">
<widget class="QLabel" name="gLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
......@@ -141,7 +141,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<widget class="QLabel" name="greenLeftArrow">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
......@@ -156,7 +156,7 @@
</layout>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="m_GreenComboBox">
<widget class="QComboBox" name="greenComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
......@@ -186,7 +186,7 @@
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<widget class="QLabel" name="m_BlueLabel">
<widget class="QLabel" name="blueLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
......@@ -202,7 +202,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="m_BLabel">
<widget class="QLabel" name="bLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
......@@ -215,7 +215,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label_7">
<widget class="QLabel" name="rLeftArrow_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
......@@ -230,7 +230,7 @@
</layout>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="m_BlueComboBox">
<widget class="QComboBox" name="blueComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
......
......@@ -75,6 +75,8 @@ class Monteverdi2_EXPORT MyClass :
Q_OBJECT;
/*-[ PUBLIC SECTION ]------------------------------------------------------*/
//
// Public methods.
public:
......@@ -119,6 +121,9 @@ private:
private slots:
};
/*****************************************************************************/
/* INLINE SECTION */
} // end namespace 'mvd'
#endif // __mvdMyClass_h
......@@ -128,6 +128,9 @@ private:
private slots:
};
/*****************************************************************************/
/* INLINE SECTION */
} // end namespace 'mvd'
#endif // __mvdMyWidget_h
......@@ -25,6 +25,10 @@
//// Included at first position before any other ones.
#include "ConfigureMonteverdi2.h"
/*****************************************************************************/
/* INCLUDE SECTION */
//
// Monteverdi includes (sorted by alphabetic order)
#include "mvdColorSetupWidget.h"
......@@ -46,6 +50,10 @@
// OTB includes (sorted by alphabetic order)
#include "otbRenderingImageFilter.h"
/*****************************************************************************/
/* PRE-DECLARATION SECTION */
//
// External classes pre-declaration.
namespace
......@@ -57,14 +65,23 @@ namespace mvd
//
// Internal classes pre-declaration.
/*****************************************************************************/
/* CLASS DEFINITION SECTION */
/** \class VectorImageModel
*
*/
class Monteverdi2_EXPORT VectorImageModel :
public AbstractImageModel
{
/*-[ QOBJECT SECTION ]-----------------------------------------------------*/
Q_OBJECT;
/*-[ PUBLIC SECTION ]------------------------------------------------------*/
//
// Public types.
public:
......@@ -175,28 +192,16 @@ public:
virtual ~VectorImageModel();
/**
* TEMPORARY!
* TEMPORARY?
*/
// TODO: Remove getter onto internal type when interface is designed.
inline
DefaultImageType*
GetOutput( int index )
{
return m_ImageFileReader->GetOutput( index );
}
inline DefaultImageType* GetOutput( int index );
/**
* TEMPORARY!
* TEMPORARY?
*/
// TODO: Remove getter onto internal type when interface is designed.
inline
const DefaultImageType*
GetOutput( int index ) const
{
//return const_cast< VectorImageModel* >( this )->GetOutput( index
//);
return m_ImageFileReader->GetOutput( index );
}
inline const DefaultImageType* GetOutput( int index ) const;
/**
*/
......@@ -204,12 +209,7 @@ public:
/**
*/
inline
const Settings&
GetSettings() const
{
return m_Settings;
}
inline const Settings& GetSettings() const;
/**
*/
......@@ -218,8 +218,10 @@ public:
/** Rasterize the buffered region in a buffer */
unsigned char * RasterizeRegion(const ImageRegionType& region);
/*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/
//
// Public SLOTS.
// Public slots.
public slots:
/**
*/
......@@ -227,13 +229,17 @@ public slots:
// VectorImageModel and move slot.
void onCurrentIndexChanged( ColorSetupWidget::Channel channel, int index );
/*-[ SIGNALS SECTION ]-----------------------------------------------------*/
//
// SIGNALS.
// Signals.
signals:
/**
*/
void settingsUpdated();
/*-[ PROTECTED SECTION ]---------------------------------------------------*/
//
// Protected methods.
protected:
......@@ -245,6 +251,8 @@ protected:
// Protected attributes.
protected:
/*-[ PRIVATE SECTION ]-----------------------------------------------------*/
//
// Private types.
private:
......@@ -279,26 +287,17 @@ private:
/** */
inline
DefaultImageType::ImageMetadataInterfacePointerType
GetMetadataInterface() const
{
assert( m_ImageFileReader->GetNumberOfOutputs()==1 );
itk::MetaDataDictionary dictionary(
m_ImageFileReader->GetOutput( 0 )->GetMetaDataDictionary()
);
return otb::ImageMetadataInterfaceFactory::CreateIMI( dictionary );
}
GetMetadataInterface() const;
/** Compute the linear buffer index according to the 2D region and
* its 2D index.This method is used when OTB_GL_USE_ACCEL is ON.
* \param index 2D index
* \param region 2D region
*/
static inline unsigned int ComputeBufferIndex(const IndexType& index, const ImageRegionType& region)
{
return (index[1] - region.GetIndex()[1]) * 3 * region.GetSize()[0] + 3 * (index[0] - region.GetIndex()[0]);
}
static inline
unsigned int
ComputeBufferIndex(const IndexType& index,
const ImageRegionType& region);
/** Compute the linear buffer index according to the 2D region and
* its 2D index.This method is used when OTB_GL_USE_ACCEL is OFF.
......@@ -306,28 +305,20 @@ private:
* \param index 2D index
* \param region 2D region
*/
static inline unsigned int ComputeXAxisFlippedBufferIndex(const IndexType& index, const ImageRegionType& region)
{
return (region.GetSize()[1] - 1 + region.GetIndex()[1] -
index[1]) * 3 * region.GetSize()[0] + 3 * (index[0] - region.GetIndex()[0]);
}
static inline
unsigned int
ComputeXAxisFlippedBufferIndex(const IndexType& index,
const ImageRegionType& region);
/** Compute the image index according to a linear buffer index and its
* 2D region
* \param index 2D index
* \param region 2D region
*/
static inline IndexType
ComputeImageIndexFromFlippedBuffer(const unsigned int & index, const ImageRegionType& region)
{
IndexType imageIndex;
imageIndex[0] = ( index % region.GetSize(0) ) + region.GetIndex()[0];
imageIndex[1] = region.GetSize()[1] - 1 + region.GetIndex()[1]
- static_cast<unsigned int>(vcl_floor( static_cast<double>(index) / static_cast<double>(region.GetSize(0) )));
return imageIndex;
}
static inline
IndexType