Added PropertyVectorDistance::getPathValue() to return vector elements with correct unit.

This commit is contained in:
Eivind Kvedalen
2017-07-21 16:32:18 +02:00
committed by wmayer
parent 705bb1c56e
commit 3a8ceb2929
2 changed files with 14 additions and 0 deletions

View File

@@ -216,6 +216,18 @@ PropertyVectorDistance::PropertyVectorDistance()
}
const boost::any PropertyVectorDistance::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);
}
PropertyVectorDistance::~PropertyVectorDistance()
{

View File

@@ -120,6 +120,8 @@ public:
*/
virtual ~PropertyVectorDistance();
const boost::any getPathValue(const ObjectIdentifier &path) const;
const char* getEditorName(void) const {
return "Gui::PropertyEditor::PropertyVectorDistanceItem";
}