diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 36be8c761f..354535cb00 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -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(); diff --git a/src/App/PropertyGeo.cpp b/src/App/PropertyGeo.cpp index b938261953..19c21fc4d2 100644 --- a/src/App/PropertyGeo.cpp +++ b/src/App/PropertyGeo.cpp @@ -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(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(Property::getPathValue(path)), Unit::Length); + } + else + return Property::getPathValue(path); +} //************************************************************************** // PropertyVectorList diff --git a/src/App/PropertyGeo.h b/src/App/PropertyGeo.h index 4d48d08fb2..c2c36e4bc3 100644 --- a/src/App/PropertyGeo.h +++ b/src/App/PropertyGeo.h @@ -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 { diff --git a/src/Gui/SoFCDB.cpp b/src/Gui/SoFCDB.cpp index e895bb9f93..c8aed2114c 100644 --- a/src/Gui/SoFCDB.cpp +++ b/src/Gui/SoFCDB.cpp @@ -136,6 +136,8 @@ void Gui::SoFCDB::init() PropertyBoolItem ::init(); PropertyVectorItem ::init(); PropertyVectorDistanceItem ::init(); + PropertyPositionItem ::init(); + PropertyDirectionItem ::init(); PropertyMatrixItem ::init(); PropertyPlacementItem ::init(); PropertyEnumItem ::init(); diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp index 4c895bbfb7..d802b41a8e 100644 --- a/src/Gui/propertyeditor/PropertyItem.cpp +++ b/src/Gui/propertyeditor/PropertyItem.cpp @@ -1344,6 +1344,9 @@ void PropertyVectorDistanceItem::propertyBound() { }; } +PROPERTYITEM_SOURCE(Gui::PropertyEditor::PropertyPositionItem) + +PROPERTYITEM_SOURCE(Gui::PropertyEditor::PropertyDirectionItem) // --------------------------------------------------------------- diff --git a/src/Gui/propertyeditor/PropertyItem.h b/src/Gui/propertyeditor/PropertyItem.h index dd76cf4e4f..a425981a02 100644 --- a/src/Gui/propertyeditor/PropertyItem.h +++ b/src/Gui/propertyeditor/PropertyItem.h @@ -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