Added PropertyPosition and PropertyDirection classes. Basically PropertyVector classes with units.

This commit is contained in:
Eivind Kvedalen
2017-07-21 16:33:50 +02:00
committed by wmayer
parent b6d733d37b
commit f8a76066da
6 changed files with 130 additions and 0 deletions

View File

@@ -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