Commit f4b5b38d authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[STYLE]

[CHANGE] extended list of properties ( color and position )
parent 02f04ac5
......@@ -136,6 +136,16 @@ WPropList WProperties2::addProperty( std::string name, std::string description,
return addProperty< WPVBaseTypes::PV_LIST >( name, description, initial, hide );
}
WPropPosition WProperties2::addProperty( std::string name, std::string description, const WPVBaseTypes::PV_POSITION& initial, bool hide )
{
return addProperty< WPVBaseTypes::PV_POSITION >( name, description, initial, hide );
}
WPropColor WProperties2::addProperty( std::string name, std::string description, const WPVBaseTypes::PV_COLOR& initial, bool hide )
{
return addProperty< WPVBaseTypes::PV_COLOR >( name, description, initial, hide );
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// convenience methods for
// template< typename T>
......@@ -179,6 +189,18 @@ WPropList WProperties2::addProperty( std::string name, std::string description,
return addProperty< WPVBaseTypes::PV_LIST >( name, description, initial, condition, hide );
}
WPropPosition WProperties2::addProperty( std::string name, std::string description, const WPVBaseTypes::PV_POSITION& initial,
boost::shared_ptr< WCondition > condition, bool hide )
{
return addProperty< WPVBaseTypes::PV_POSITION >( name, description, initial, condition, hide );
}
WPropColor WProperties2::addProperty( std::string name, std::string description, const WPVBaseTypes::PV_COLOR& initial,
boost::shared_ptr< WCondition > condition, bool hide )
{
return addProperty< WPVBaseTypes::PV_COLOR >( name, description, initial, condition, hide );
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// convenience methods for
// template< typename T>
......@@ -222,6 +244,19 @@ WPropList WProperties2::addProperty( std::string name, std::string description,
return addProperty< WPVBaseTypes::PV_LIST >( name, description, initial, notifier, hide );
}
WPropPosition WProperties2::addProperty( std::string name, std::string description, const WPVBaseTypes::PV_POSITION& initial,
WCondition::t_ConditionNotifierType notifier, bool hide )
{
return addProperty< WPVBaseTypes::PV_POSITION >( name, description, initial, notifier, hide );
}
WPropColor WProperties2::addProperty( std::string name, std::string description, const WPVBaseTypes::PV_COLOR& initial,
WCondition::t_ConditionNotifierType notifier, bool hide )
{
return addProperty< WPVBaseTypes::PV_COLOR >( name, description, initial, notifier, hide );
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// convenience methods for
// template< typename T>
......@@ -272,3 +307,17 @@ WPropList WProperties2::addProperty( std::string name, std::string description,
return addProperty< WPVBaseTypes::PV_LIST >( name, description, initial, condition, notifier, hide );
}
WPropPosition WProperties2::addProperty( std::string name, std::string description, const WPVBaseTypes::PV_POSITION& initial,
boost::shared_ptr< WCondition > condition,
WCondition::t_ConditionNotifierType notifier, bool hide )
{
return addProperty< WPVBaseTypes::PV_POSITION >( name, description, initial, condition, notifier, hide );
}
WPropColor WProperties2::addProperty( std::string name, std::string description, const WPVBaseTypes::PV_COLOR& initial,
boost::shared_ptr< WCondition > condition,
WCondition::t_ConditionNotifierType notifier, bool hide )
{
return addProperty< WPVBaseTypes::PV_COLOR >( name, description, initial, condition, notifier, hide );
}
......@@ -272,6 +272,35 @@ public:
*/
WPropList addProperty( std::string name, std::string description, const WPVBaseTypes::PV_LIST& initial, bool hide = false );
/**
* Create and add a new property of the template type. For more details see appropriate constructor ow WPropertyVariable.
*
* \see WPropertyVariable
*
* \param name the property name
* \param description the property description
* \param initial the initial value
* \param hide set to true to set the hide flag directly.
*
* \return the newly created property variable instance.
*/
WPropPosition addProperty( std::string name, std::string description, const WPVBaseTypes::PV_POSITION& initial, bool hide = false );
/**
* Create and add a new property of the template type. For more details see appropriate constructor ow WPropertyVariable.
*
* \see WPropertyVariable
*
* \param name the property name
* \param description the property description
* \param initial the initial value
* \param hide set to true to set the hide flag directly.
*
* \return the newly created property variable instance.
*/
WPropColor addProperty( std::string name, std::string description, const WPVBaseTypes::PV_COLOR& initial, bool hide = false );
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// convenience methods for
// template< typename T>
......@@ -375,6 +404,38 @@ public:
WPropList addProperty( std::string name, std::string description, const WPVBaseTypes::PV_LIST& initial,
boost::shared_ptr< WCondition > condition, bool hide = false );
/**
* Create and add a new property of the template type. For more details see appropriate constructor ow WPropertyVariable.
*
* \see WPropertyVariable
*
* \param name the property name
* \param description the property description
* \param initial the initial value
* \param condition use this external condition for notification.
* \param hide set to true to set the hide flag directly.
*
* \return the newly created property variable instance.
*/
WPropPosition addProperty( std::string name, std::string description, const WPVBaseTypes::PV_POSITION& initial,
boost::shared_ptr< WCondition > condition, bool hide = false );
/**
* Create and add a new property of the template type. For more details see appropriate constructor ow WPropertyVariable.
*
* \see WPropertyVariable
*
* \param name the property name
* \param description the property description
* \param initial the initial value
* \param condition use this external condition for notification.
* \param hide set to true to set the hide flag directly.
*
* \return the newly created property variable instance.
*/
WPropColor addProperty( std::string name, std::string description, const WPVBaseTypes::PV_COLOR& initial,
boost::shared_ptr< WCondition > condition, bool hide = false );
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// convenience methods for
// template< typename T>
......@@ -478,6 +539,37 @@ public:
WPropList addProperty( std::string name, std::string description, const WPVBaseTypes::PV_LIST& initial,
WCondition::t_ConditionNotifierType notifier, bool hide = false );
/**
* Create and add a new property of the template type. For more details see appropriate constructor ow WPropertyVariable.
*
* \see WPropertyVariable
*
* \param name the property name
* \param description the property description
* \param initial the initial value
* \param notifier use this notifier for change callbacks.
* \param hide set to true to set the hide flag directly.
*
* \return the newly created property variable instance.
*/
WPropPosition addProperty( std::string name, std::string description, const WPVBaseTypes::PV_POSITION& initial,
WCondition::t_ConditionNotifierType notifier, bool hide = false );
/**
* Create and add a new property of the template type. For more details see appropriate constructor ow WPropertyVariable.
*
* \see WPropertyVariable
*
* \param name the property name
* \param description the property description
* \param initial the initial value
* \param notifier use this notifier for change callbacks.
* \param hide set to true to set the hide flag directly.
*
* \return the newly created property variable instance.
*/
WPropColor addProperty( std::string name, std::string description, const WPVBaseTypes::PV_COLOR& initial,
WCondition::t_ConditionNotifierType notifier, bool hide = false );
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// convenience methods for
// template< typename T>
......@@ -595,6 +687,42 @@ public:
boost::shared_ptr< WCondition > condition,
WCondition::t_ConditionNotifierType notifier, bool hide = false );
/**
* Create and add a new property of the template type. For more details see appropriate constructor ow WPropertyVariable.
*
* \see WPropertyVariable
*
* \param name the property name
* \param description the property description
* \param initial the initial value
* \param notifier use this notifier for change callbacks.
* \param condition use this external condition for notification
* \param hide set to true to set the hide flag directly.
*
* \return the newly created property variable instance.
*/
WPropPosition addProperty( std::string name, std::string description, const WPVBaseTypes::PV_POSITION& initial,
boost::shared_ptr< WCondition > condition,
WCondition::t_ConditionNotifierType notifier, bool hide = false );
/**
* Create and add a new property of the template type. For more details see appropriate constructor ow WPropertyVariable.
*
* \see WPropertyVariable
*
* \param name the property name
* \param description the property description
* \param initial the initial value
* \param notifier use this notifier for change callbacks.
* \param condition use this external condition for notification
* \param hide set to true to set the hide flag directly.
*
* \return the newly created property variable instance.
*/
WPropColor addProperty( std::string name, std::string description, const WPVBaseTypes::PV_COLOR& initial,
boost::shared_ptr< WCondition > condition,
WCondition::t_ConditionNotifierType notifier, bool hide = false );
private:
/**
......
......@@ -34,6 +34,7 @@ typedef enum
PC_MIN, // type ID for WPropertyConstraintMin
PC_MAX, // type ID for WPropertyConstraintMax
PC_NOTEMPTY // type ID for WPropertyConstraintNotEmpty
} PROPERTYCONSTRAINT_TYPE;
}
PROPERTYCONSTRAINT_TYPE;
#endif // WPROPERTYCONSTRAINTTYPES_H
......@@ -32,6 +32,9 @@
#include <boost/filesystem.hpp>
#include "../math/WPosition.h"
#include "WColor.h"
template < typename T >
class WPropertyVariable;
......@@ -54,7 +57,9 @@ typedef enum
PV_BOOL, // boolean
PV_STRING, // a string
PV_PATH, // a Boost Path object denoting a filename/path
PV_LIST // a list of strings
PV_LIST, // a list of strings
PV_POSITION, // a position property
PV_COLOR // a color property
}
PROPERTY_TYPE;
......@@ -64,12 +69,14 @@ PROPERTY_TYPE;
*/
namespace WPVBaseTypes
{
typedef int32_t PV_INT; //!< base type used for every WPVInt
typedef double PV_DOUBLE; //!< base type used for every WPVDouble
typedef bool PV_BOOL; //!< base type used for every WPVBool
typedef std::string PV_STRING; //!< base type used for every WPVString
typedef boost::filesystem::path PV_PATH; //!< base type used for every WPVFilename
typedef std::list< std::string > PV_LIST; //!< base type used for every WPVList
typedef int32_t PV_INT; //!< base type used for every WPVInt
typedef double PV_DOUBLE; //!< base type used for every WPVDouble
typedef bool PV_BOOL; //!< base type used for every WPVBool
typedef std::string PV_STRING; //!< base type used for every WPVString
typedef boost::filesystem::path PV_PATH; //!< base type used for every WPVFilename
typedef std::list< std::pair< std::string, bool > > PV_LIST; //!< base type used for every WPVList
typedef wmath::WPosition PV_POSITION; //!< base type used for every WPVPosition
typedef WColor PV_COLOR; //!< base type used for every WPVColor
}
/**
......@@ -108,6 +115,16 @@ typedef WPropertyVariable< WPVBaseTypes::PV_PATH > WPVFilename;
*/
typedef WPropertyVariable< WPVBaseTypes::PV_LIST > WPVList;
/**
* position (vec3d) properties
*/
typedef WPropertyVariable< WPVBaseTypes::PV_POSITION > WPVPosition;
/**
* Color properties
*/
typedef WPropertyVariable< WPVBaseTypes::PV_COLOR > WPVColor;
/**
* Some convenience type alias for a even more easy usage of WPropertyVariable.
* These typdefs define some pointer alias.
......@@ -143,6 +160,16 @@ typedef boost::shared_ptr< WPVFilename > WPropFilename;
*/
typedef boost::shared_ptr< WPVList > WPropList;
/**
* Alias for position property variables.
*/
typedef boost::shared_ptr< WPVPosition > WPropPosition;
/**
* Alias for color property variables.
*/
typedef boost::shared_ptr< WPVColor > WPropColor;
/**
* This namespace contains several helper classes which translate their template type to an enum.
*/
......@@ -273,6 +300,42 @@ namespace PROPERTY_TYPE_HELPER
return PV_LIST;
}
};
/**
* Class helping to adapt types specified as template parameter into an enum.
*/
template<>
class WTypeIdentifier< WPVBaseTypes::PV_POSITION >
{
public:
/**
* Get type identifier of the template type T.
*
* \return type identifier-
*/
PROPERTY_TYPE getType()
{
return PV_POSITION;
}
};
/**
* Class helping to adapt types specified as template parameter into an enum.
*/
template<>
class WTypeIdentifier< WPVBaseTypes::PV_COLOR >
{
public:
/**
* Get type identifier of the template type T.
*
* \return type identifier-
*/
PROPERTY_TYPE getType()
{
return PV_COLOR;
}
};
}
#endif // WPROPERTYTYPES_H
......@@ -23,6 +23,7 @@
//---------------------------------------------------------------------------
#include <cmath>
#include <string>
#include <boost/lexical_cast.hpp>
......@@ -53,7 +54,7 @@ WPropertyDoubleWidget::WPropertyDoubleWidget( WPropDouble property, QGridLayout*
else
{
WLogger::getLogger()->addLogMessage(
std::string( "The property has no minimum constraint. You should define it to avoid unexpected behaviour. ") +
std::string( "The property has no minimum constraint. You should define it to avoid unexpected behaviour." ) +
std::string( "Using default (" + boost::lexical_cast< std::string >( min ) + ")." ),
"PropertyWidget( " + m_doubleProperty->getName() + " )", LL_WARNING );
}
......@@ -68,7 +69,7 @@ WPropertyDoubleWidget::WPropertyDoubleWidget( WPropDouble property, QGridLayout*
else
{
WLogger::getLogger()->addLogMessage(
std::string( "The property has no maximum constraint. You should define it to avoid unexpected behaviour. ") +
std::string( "The property has no maximum constraint. You should define it to avoid unexpected behaviour." ) +
std::string( "Using default (" + boost::lexical_cast< std::string >( max ) + ")." ),
"PropertyWidget( " + m_doubleProperty->getName() + " )", LL_WARNING );
}
......
......@@ -24,6 +24,8 @@
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <boost/lexical_cast.hpp>
......@@ -58,7 +60,7 @@ WPropertyIntWidget::WPropertyIntWidget( WPropInt property, QGridLayout* property
else
{
WLogger::getLogger()->addLogMessage(
std::string( "The property has no minimum constraint. You should define it to avoid unexpected behaviour. ") +
std::string( "The property has no minimum constraint. You should define it to avoid unexpected behaviour." ) +
std::string( "Using default (" + boost::lexical_cast< std::string >( min ) + ")." ),
"PropertyWidget( " + m_intProperty->getName() + " )", LL_WARNING );
}
......@@ -73,7 +75,7 @@ WPropertyIntWidget::WPropertyIntWidget( WPropInt property, QGridLayout* property
else
{
WLogger::getLogger()->addLogMessage(
std::string( "The property has no maximum constraint. You should define it to avoid unexpected behaviour. ") +
std::string( "The property has no maximum constraint. You should define it to avoid unexpected behaviour." ) +
std::string( "Using default (" + boost::lexical_cast< std::string >( max ) + ")." ),
"PropertyWidget( " + m_intProperty->getName() + " )", LL_WARNING );
}
......
......@@ -22,8 +22,8 @@
//
//---------------------------------------------------------------------------
#include <iostream>
#include <cmath>
#include <string>
#include <boost/lexical_cast.hpp>
......
......@@ -22,6 +22,8 @@
//
//---------------------------------------------------------------------------
#include <string>
#include "WPropertyWidget.h"
WPropertyWidget::WPropertyWidget( boost::shared_ptr< WPropertyBase > property, QGridLayout* propertyGrid, QWidget* parent ):
......
......@@ -360,10 +360,20 @@ void WQtDatasetBrowser::selectTreeItem()
tab->addPropString( ( *iter )->toPropString() );
break;
case PV_PATH:
WLogger::getLogger()->addLogMessage( "This property type \"PV_PATH\" is not yet supported.", "DatasetBrowser", LL_WARNING );
WLogger::getLogger()->addLogMessage( "This property type \"PV_PATH\" is not yet supported by the GUI.", "DatasetBrowser",
LL_WARNING );
break;
case PV_LIST:
WLogger::getLogger()->addLogMessage( "This property type \"PV_LIST\" is not yet supported.", "DatasetBrowser", LL_WARNING );
WLogger::getLogger()->addLogMessage( "This property type \"PV_LIST\" is not yet supported by the GUI.", "DatasetBrowser",
LL_WARNING );
break;
case PV_COLOR:
WLogger::getLogger()->addLogMessage( "This property type \"PV_COLOR\" is not yet supported by the GUI.", "DatasetBrowser",
LL_WARNING );
break;
case PV_POSITION:
WLogger::getLogger()->addLogMessage( "This property type \"PV_POSITION\" is not yet supported by the GUI.", "DatasetBrowser",
LL_WARNING );
break;
default:
WLogger::getLogger()->addLogMessage( "This property type is not yet supported.", "DatasetBrowser", LL_WARNING );
......
......@@ -22,7 +22,7 @@
//
//---------------------------------------------------------------------------
#include <iostream>
#include <set>
#include <string>
#include "../../../common/WProgressCombiner.h"
......
......@@ -100,7 +100,7 @@ protected:
*
* \param progress the current progress as string.
*/
void updateTooltip( std::string propgress );
void updateTooltip( std::string progress );
private:
......
......@@ -147,8 +147,8 @@ void WMNavSlices::properties()
d->setMin( 0.5 );
d->setMax( 10.2 );
WPropString s = m_properties2->addProperty( "hallo2", "Position of axial slice.", std::string( "hallo du" ) );
s->addConstraint( boost::shared_ptr< WPropertyConstraintNotEmpty< std::string > >(new WPropertyConstraintNotEmpty< std::string >() ) );
WPropString s = m_properties2->addProperty( "hallo2", "Position of axial slice.", std::string( "hallo du" ) );
s->addConstraint( boost::shared_ptr< WPropertyConstraintNotEmpty< std::string > >( new WPropertyConstraintNotEmpty< std::string >() ) );
}
void WMNavSlices::notifyDataChange( boost::shared_ptr<WModuleConnector> input,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment