Added PropertyPosition and PropertyDirection classes. Basically PropertyVector classes with units.
This commit is contained in:
@@ -1256,6 +1256,8 @@ void Application::initTypes(void)
|
||||
App ::PropertyMatrix ::init();
|
||||
App ::PropertyVector ::init();
|
||||
App ::PropertyVectorDistance ::init();
|
||||
App ::PropertyPosition ::init();
|
||||
App ::PropertyDirection ::init();
|
||||
App ::PropertyVectorList ::init();
|
||||
App ::PropertyPlacement ::init();
|
||||
App ::PropertyPlacementList ::init();
|
||||
|
||||
@@ -233,6 +233,69 @@ PropertyVectorDistance::~PropertyVectorDistance()
|
||||
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// PropertyPosition
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
TYPESYSTEM_SOURCE(App::PropertyPosition , App::PropertyVector);
|
||||
|
||||
//**************************************************************************
|
||||
// Construction/Destruction
|
||||
|
||||
|
||||
PropertyPosition::PropertyPosition()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
PropertyPosition::~PropertyPosition()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
const boost::any PropertyPosition::getPathValue(const ObjectIdentifier &path) const
|
||||
{
|
||||
std::string p = path.getSubPathStr();
|
||||
|
||||
if (p == ".x" || p == ".y" || p == ".z") {
|
||||
// Convert double to quantity
|
||||
return Base::Quantity(boost::any_cast<double>(Property::getPathValue(path)), Unit::Length);
|
||||
}
|
||||
else
|
||||
return Property::getPathValue(path);
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// PropertyPosition
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
TYPESYSTEM_SOURCE(App::PropertyDirection , App::PropertyVector);
|
||||
|
||||
//**************************************************************************
|
||||
// Construction/Destruction
|
||||
|
||||
|
||||
PropertyDirection::PropertyDirection()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
PropertyDirection::~PropertyDirection()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
const boost::any PropertyDirection::getPathValue(const ObjectIdentifier &path) const
|
||||
{
|
||||
std::string p = path.getSubPathStr();
|
||||
|
||||
if (p == ".x" || p == ".y" || p == ".z") {
|
||||
// Convert double to quantity
|
||||
return Base::Quantity(boost::any_cast<double>(Property::getPathValue(path)), Unit::Length);
|
||||
}
|
||||
else
|
||||
return Property::getPathValue(path);
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// PropertyVectorList
|
||||
|
||||
@@ -127,6 +127,53 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class AppExport PropertyPosition: public PropertyVector
|
||||
{
|
||||
TYPESYSTEM_HEADER();
|
||||
|
||||
public:
|
||||
/**
|
||||
* A constructor.
|
||||
* A more elaborate description of the constructor.
|
||||
*/
|
||||
PropertyPosition();
|
||||
|
||||
/**
|
||||
* A destructor.
|
||||
* A more elaborate description of the destructor.
|
||||
*/
|
||||
virtual ~PropertyPosition();
|
||||
|
||||
const boost::any getPathValue(const ObjectIdentifier &path) const;
|
||||
|
||||
const char* getEditorName(void) const {
|
||||
return "Gui::PropertyEditor::PropertyPositionItem";
|
||||
}
|
||||
};
|
||||
|
||||
class AppExport PropertyDirection: public PropertyVector
|
||||
{
|
||||
TYPESYSTEM_HEADER();
|
||||
|
||||
public:
|
||||
/**
|
||||
* A constructor.
|
||||
* A more elaborate description of the constructor.
|
||||
*/
|
||||
PropertyDirection();
|
||||
|
||||
/**
|
||||
* A destructor.
|
||||
* A more elaborate description of the destructor.
|
||||
*/
|
||||
virtual ~PropertyDirection();
|
||||
|
||||
const boost::any getPathValue(const ObjectIdentifier &path) const;
|
||||
|
||||
const char* getEditorName(void) const {
|
||||
return "Gui::PropertyEditor::PropertyDirectionItem";
|
||||
}
|
||||
};
|
||||
|
||||
class AppExport PropertyVectorList: public PropertyLists
|
||||
{
|
||||
|
||||
@@ -136,6 +136,8 @@ void Gui::SoFCDB::init()
|
||||
PropertyBoolItem ::init();
|
||||
PropertyVectorItem ::init();
|
||||
PropertyVectorDistanceItem ::init();
|
||||
PropertyPositionItem ::init();
|
||||
PropertyDirectionItem ::init();
|
||||
PropertyMatrixItem ::init();
|
||||
PropertyPlacementItem ::init();
|
||||
PropertyEnumItem ::init();
|
||||
|
||||
@@ -1344,6 +1344,9 @@ void PropertyVectorDistanceItem::propertyBound() {
|
||||
};
|
||||
}
|
||||
|
||||
PROPERTYITEM_SOURCE(Gui::PropertyEditor::PropertyPositionItem)
|
||||
|
||||
PROPERTYITEM_SOURCE(Gui::PropertyEditor::PropertyDirectionItem)
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -473,6 +473,19 @@ private:
|
||||
PropertyUnitItem* m_z;
|
||||
};
|
||||
|
||||
class GuiExport PropertyPositionItem: public PropertyVectorDistanceItem
|
||||
{
|
||||
Q_OBJECT
|
||||
PROPERTYITEM_HEADER
|
||||
|
||||
};
|
||||
|
||||
class GuiExport PropertyDirectionItem: public PropertyVectorDistanceItem
|
||||
{
|
||||
Q_OBJECT
|
||||
PROPERTYITEM_HEADER
|
||||
};
|
||||
|
||||
class GuiExport PropertyMatrixItem: public PropertyItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Reference in New Issue
Block a user