PropertyPlacement: Fixed setting of angle (missing deg to radian conversion).
This commit is contained in:
parent
7760c6ac18
commit
6f39eed25e
|
@ -35,6 +35,7 @@
|
|||
#include <Base/Stream.h>
|
||||
#include <Base/Rotation.h>
|
||||
#include <Base/Quantity.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/VectorPy.h>
|
||||
#include <Base/MatrixPy.h>
|
||||
#include <Base/PlacementPy.h>
|
||||
|
@ -567,6 +568,32 @@ void PropertyPlacement::getPaths(std::vector<ObjectIdentifier> &paths) const
|
|||
<< ObjectIdentifier::Component::SimpleComponent(ObjectIdentifier::String("z")));
|
||||
}
|
||||
|
||||
void PropertyPlacement::setPathValue(const ObjectIdentifier &path, const boost::any &value)
|
||||
{
|
||||
if (path.getSubPathStr() == ".Rotation.Angle") {
|
||||
double avalue;
|
||||
|
||||
if (value.type() == typeid(Base::Quantity))
|
||||
avalue = boost::any_cast<Base::Quantity>(value).getValue();
|
||||
else if (value.type() == typeid(double))
|
||||
avalue = boost::any_cast<double>(value);
|
||||
else if (value.type() == typeid(int))
|
||||
avalue = boost::any_cast<int>(value);
|
||||
else if (value.type() == typeid(unsigned int))
|
||||
avalue = boost::any_cast<unsigned int >(value);
|
||||
else if (value.type() == typeid(short))
|
||||
avalue = boost::any_cast<short>(value);
|
||||
else if (value.type() == typeid(unsigned short))
|
||||
avalue = boost::any_cast<unsigned short>(value);
|
||||
else
|
||||
throw std::bad_cast();
|
||||
|
||||
Property::setPathValue(path, Base::toRadians(avalue));
|
||||
}
|
||||
else
|
||||
Property::setPathValue(path, value);
|
||||
}
|
||||
|
||||
PyObject *PropertyPlacement::getPyObject(void)
|
||||
{
|
||||
return new Base::PlacementPy(new Base::Placement(_cPos));
|
||||
|
|
|
@ -263,6 +263,8 @@ public:
|
|||
/// Get valid paths for this property; used by auto completer
|
||||
void getPaths(std::vector<ObjectIdentifier> &paths) const;
|
||||
|
||||
void setPathValue(const ObjectIdentifier &path, const boost::any &value);
|
||||
|
||||
const char* getEditorName(void) const {
|
||||
return "Gui::PropertyEditor::PropertyPlacementItem";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user