| | |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef PARTATTACHABLEOBJECT_H |
| | #define PARTATTACHABLEOBJECT_H |
| |
|
| | #include <App/DocumentObjectExtension.h> |
| | #include <App/ExtensionPython.h> |
| | #include <App/PropertyLinks.h> |
| | #include <App/PropertyStandard.h> |
| | #include <Base/Exception.h> |
| | #include <Base/Placement.h> |
| |
|
| | #include <Mod/Part/PartGlobal.h> |
| |
|
| | #include "Attacher.h" |
| |
|
| |
|
| | namespace Part |
| | { |
| |
|
| | class PartExport AttachEngineException: public Base::Exception |
| | { |
| | public: |
| | |
| | AttachEngineException(); |
| | explicit AttachEngineException(const char* sMessage); |
| | explicit AttachEngineException(const std::string& sMessage); |
| | |
| | ~AttachEngineException() throw() override |
| | {} |
| | }; |
| |
|
| | |
| | |
| | |
| | |
| | |
| | class PartExport AttachExtension: public App::DocumentObjectExtension |
| | { |
| | EXTENSION_PROPERTY_HEADER_WITH_OVERRIDE(Part::AttachableObject); |
| |
|
| | public: |
| | AttachExtension(); |
| | ~AttachExtension() override; |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | virtual void setAttacher(Attacher::AttachEngine* attacher, bool base = false); |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | bool changeAttacherType(const char* typeName, bool base = false); |
| |
|
| | Attacher::AttachEngine& attacher(bool base = false) const; |
| |
|
| | App::PropertyString AttacherType; |
| | App::PropertyEnumeration AttacherEngine; |
| | App::PropertyLinkSubList AttachmentSupport; |
| | App::PropertyEnumeration MapMode; |
| | App::PropertyBool MapReversed; |
| | App::PropertyPlacement AttachmentOffset; |
| |
|
| | |
| | |
| | |
| | |
| | |
| | App::PropertyFloat MapPathParameter; |
| |
|
| | |
| | |
| | |
| | |
| | virtual bool positionBySupport(); |
| |
|
| | |
| | |
| | bool isAttacherActive() const; |
| |
|
| | virtual bool isTouched_Mapping() |
| | { |
| | return true; |
| | } |
| |
|
| | short int extensionMustExecute() override; |
| | App::DocumentObjectExecReturn* extensionExecute() override; |
| | PyObject* getExtensionPyObject() override; |
| | void onExtendedDocumentRestored() override; |
| |
|
| | struct Properties |
| | { |
| | App::PropertyString* attacherType = nullptr; |
| | App::PropertyLinkSubList* attachment = nullptr; |
| | App::PropertyEnumeration* mapMode = nullptr; |
| | App::PropertyBool* mapReversed = nullptr; |
| | App::PropertyFloat* mapPathParameter = nullptr; |
| | bool matchProperty(const App::Property* prop) const |
| | { |
| | return prop == attachment || prop == mapMode || prop == mapReversed |
| | || prop == mapPathParameter; |
| | } |
| | }; |
| | Properties getProperties(bool base) const; |
| | Properties getInitedProperties(bool base); |
| |
|
| | protected: |
| | void extensionOnChanged(const App::Property* ) override; |
| | virtual bool extensionHandleChangedPropertyName( |
| | Base::XMLReader& reader, |
| | const char* TypeName, |
| | const char* PropName |
| | ) override; |
| |
|
| | App::PropertyPlacement& getPlacement() const; |
| | void initBase(bool force); |
| |
|
| | void handleLegacyTangentPlaneOrientation(); |
| |
|
| | public: |
| | void updateAttacherVals(bool base = false) const; |
| | |
| | void updatePropertyStatus(bool attached, bool base = false); |
| | |
| | void updateSinglePropertyStatus(bool attached, bool base = false); |
| |
|
| | private: |
| | struct _Properties: Properties |
| | { |
| | mutable std::unique_ptr<Attacher::AttachEngine> attacher; |
| | }; |
| | _Properties _props; |
| | _Properties _baseProps; |
| |
|
| | mutable int _active = -1; |
| | }; |
| |
|
| |
|
| | using AttachExtensionPython = App::ExtensionPythonT<AttachExtension>; |
| |
|
| | } |
| |
|
| | #endif |
| |
|