App::LinkBaseExtension Class Reference

#include <Link.h>


struct  PropInfo

Public Types

enum  { LinkModeNone , LinkModeAutoDelete , LinkModeAutoLink , LinkModeAutoUnlink }

Public Member Functions

 LinkBaseExtension ()
virtual ~LinkBaseExtension ()
- Public Member Functions inherited from App::DocumentObjectExtension
 DocumentObjectExtension ()
virtual App::DocumentObjectExecReturnextensionExecute ()
virtual bool extensionGetLinkedObject (DocumentObject *&ret, bool recursive, Base::Matrix4D *mat, bool transform, int depth) const
 Get the linked object. More...
virtual bool extensionGetSubObject (DocumentObject *&ret, const char *subname, PyObject **pyObj, Base::Matrix4D *mat, bool transform, int depth) const
 Get the sub object by name. More...
virtual bool extensionGetSubObjects (std::vector< std::string > &ret, int reason) const
 Get name references of all sub objects. More...
virtual bool extensionHasChildElement () const
virtual int extensionIsElementVisible (const char *)
virtual short extensionMustExecute ()
virtual int extensionSetElementVisible (const char *, bool)
App::DocumentObjectgetExtendedObject ()
const App::DocumentObjectgetExtendedObject () const
virtual PyObjectgetExtensionPyObject () override
virtual const char * getViewProviderExtensionName () const
 returns the type name of the ViewProviderExtension which is automatically attached to the viewprovider object when it is initiated More...
virtual void onExtendedDocumentRestored ()
 get called after a document has been fully restored More...
virtual void onExtendedSettingDocument ()
 get called after setting the document More...
virtual void onExtendedSetupObject ()
 get called after a brand new object was created More...
virtual void onExtendedUnsetupObject ()
 get called when object is going to be removed from the document More...
virtual ~DocumentObjectExtension ()
- Public Member Functions inherited from App::Extension
 Extension ()
App::ExtensionContainergetExtendedContainer ()
const App::ExtensionContainergetExtendedContainer () const
virtual PyObjectgetExtensionPyObject ()
virtual void initExtension (App::ExtensionContainer *obj)
bool isPythonExtension ()
std::string name () const
virtual ~Extension ()
virtual const char * extensionGetPropertyName (const Property *prop) const
 get the name of a property More...
virtual void extensionGetPropertyMap (std::map< std::string, Property * > &Map) const
 get all properties of the class (including properties of the parent) More...
virtual void extensionGetPropertyList (std::vector< Property * > &List) const
 get all properties of the class (including properties of the parent) More...
virtual short extensionGetPropertyType (const Property *prop) const
 get the Type of a Property More...
virtual short extensionGetPropertyType (const char *name) const
 get the Type of a named Property More...
virtual const char * extensionGetPropertyGroup (const Property *prop) const
 get the Group of a Property More...
virtual const char * extensionGetPropertyGroup (const char *name) const
 get the Group of a named Property More...
virtual const char * extensionGetPropertyDocumentation (const Property *prop) const
 get the Group of a Property More...
virtual const char * extensionGetPropertyDocumentation (const char *name) const
 get the Group of a named Property More...
virtual void extensionSave (Base::Writer &) const
virtual void extensionRestore (Base::XMLReader &)
bool extensionIsDerivedFrom (const Base::Type type) const

Parameter definition

Parameter definition (Name, Type, Property Type, Default, Document).

The variadic is here so that the parameter can be extended by adding extra fields. See LINK_PARAM_EXT() for an example

enum  PropIndex { PropMax }
enum  LinkCopyOnChangeType { CopyOnChangeDisabled = 0 , CopyOnChangeEnabled = 1 , CopyOnChangeOwned = 2 , CopyOnChangeTracking = 3 }
enum class  OnChangeCopyOptions { Exclude = 1 , ApplyAll = 2 }
 Options used in setOnChangeCopyObject() Multiple options can be combined by bitwise or operator. More...
typedef std::map< std::string, PropInfoPropInfoMap
typedef std::map< const Property *, std::pair< LinkBaseExtension *, int > > LinkPropMap
std::vector< Property * > props
std::unordered_set< const App::DocumentObject * > myHiddenElements
std::vector< std::string > mySubElements
std::string mySubName
std::unordered_map< const App::DocumentObject *, boost::signals2::scoped_connection > plainGroupConns
long prevLinkedObjectID = 0
std::unordered_map< std::string, intmyLabelCache
bool enableLabelCache
bool hasOldSubElement
std::vector< boost::signals2::scoped_connection > copyOnChangeConns
std::vector< boost::signals2::scoped_connection > copyOnChangeSrcConns
bool hasCopyOnChange
bool checkingProperty = false
bool pauseCopyOnChange = false
boost::signals2::scoped_connection connCopyOnChangeSource
virtual void setProperty (int idx, Property *prop)
PropertygetProperty (int idx)
PropertygetProperty (const char *)
virtual const std::vector< PropInfo > & getPropertyInfo () const
virtual const PropInfoMapgetPropertyInfoMap () const
std::vector< DocumentObject * > getLinkedChildren (bool filter=true) const
const char * flattenSubname (const char *subname) const
void expandSubname (std::string &subname) const
DocumentObjectgetLink (int depth=0) const
Base::Matrix4D getTransform (bool transform) const
Base::Vector3d getScaleVector () const
App::GroupExtensionlinkedPlainGroup () const
bool linkTransform () const
const char * getSubName () const
const std::vector< std::string > & getSubElements () const
bool extensionGetSubObject (DocumentObject *&ret, const char *subname, PyObject **pyObj=nullptr, Base::Matrix4D *mat=nullptr, bool transform=false, int depth=0) const override
 Get the sub object by name. More...
bool extensionGetSubObjects (std::vector< std::string > &ret, int reason) const override
 Get name references of all sub objects. More...
bool extensionGetLinkedObject (DocumentObject *&ret, bool recurse, Base::Matrix4D *mat, bool transform, int depth) const override
 Get the linked object. More...
virtual App::DocumentObjectExecReturnextensionExecute (void) override
virtual short extensionMustExecute (void) override
virtual void extensionOnChanged (const Property *p) override
virtual void onExtendedUnsetupObject () override
 get called when object is going to be removed from the document More...
virtual void onExtendedDocumentRestored () override
 get called after a document has been fully restored More...
virtual int extensionSetElementVisible (const char *, bool) override
virtual int extensionIsElementVisible (const char *) override
virtual bool extensionHasChildElement () const override
virtual PyObjectgetExtensionPyObject (void) override
virtual PropertyextensionGetPropertyByName (const char *name) const override
 find a property by its name More...
int getElementIndex (const char *subname, const char **psubname=nullptr) const
void elementNameFromIndex (int idx, std::ostream &ss) const
DocumentObjectgetContainer ()
const DocumentObjectgetContainer () const
void setLink (int index, DocumentObject *obj, const char *subname=nullptr, const std::vector< std::string > &subs=std::vector< std::string >())
DocumentObjectgetTrueLinkedObject (bool recurse, Base::Matrix4D *mat=nullptr, int depth=0, bool noElement=false) const
bool hasPlacement () const
void cacheChildLabel (int enable=-1) const
void syncCopyOnChange ()
void setOnChangeCopyObject (App::DocumentObject *obj, OnChangeCopyOptions options)
 Include or exclude object from list of objects to copy on change. More...
std::vector< App::DocumentObject * > getOnChangeCopyObjects (std::vector< App::DocumentObject * > *excludes=nullptr, App::DocumentObject *src=nullptr)
bool isLinkedToConfigurableObject () const
void monitorOnChangeCopyObjects (const std::vector< App::DocumentObject * > &objs)
bool isLinkMutated () const
 Check if the linked object is a copy on change. More...
static int getArrayIndex (const char *subname, const char **psubname=nullptr)
static bool setupCopyOnChange (App::DocumentObject *obj, App::DocumentObject *linked, std::vector< boost::signals2::scoped_connection > *copyOnChangeConns, bool checkExisting)
static bool isCopyOnChangeProperty (App::DocumentObject *obj, const Property &prop)
void parseSubName () const
void update (App::DocumentObject *parent, const Property *prop)
void checkCopyOnChange (App::DocumentObject *parent, const App::Property &prop)
void setupCopyOnChange (App::DocumentObject *parent, bool checkSource=false)
App::DocumentObjectmakeCopyOnChange ()
void syncElementList ()
void detachElement (App::DocumentObject *obj)
void detachElements ()
void checkGeoElementMap (const App::DocumentObject *obj, const App::DocumentObject *linked, PyObject **pyObj, const char *postfix) const
void updateGroup ()
void slotChangedPlainGroup (const App::DocumentObject &, const App::Property &)

Additional Inherited Members

- Protected Member Functions inherited from App::Extension
void initExtensionType (Base::Type type)
- Static Protected Member Functions inherited from App::Extension
static void initExtensionSubclass (Base::Type &toInit, const char *ClassName, const char *ParentName, Base::Type::instantiationMethod method=nullptr)
- Protected Attributes inherited from App::Extension
bool m_isPythonExtension = false
Py::SmartPtr ExtensionPythonObject

Member Typedef Documentation

◆ LinkPropMap

typedef std::map<const Property*,std::pair<LinkBaseExtension*,int> > App::LinkBaseExtension::LinkPropMap

◆ PropInfoMap

typedef std::map<std::string, PropInfo> App::LinkBaseExtension::PropInfoMap

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

◆ LinkCopyOnChangeType


◆ OnChangeCopyOptions

Options used in setOnChangeCopyObject() Multiple options can be combined by bitwise or operator.


If set, then exclude the input from object list to copy on change, or else, include the input object.


If set , then apply the setting to all links to the input object, or else, apply only to this link.

◆ PropIndex


Constructor & Destructor Documentation

◆ LinkBaseExtension()

LinkBaseExtension::LinkBaseExtension ( void  )

◆ ~LinkBaseExtension()

LinkBaseExtension::~LinkBaseExtension ( )

Member Function Documentation

◆ cacheChildLabel()

void LinkBaseExtension::cacheChildLabel ( int  enable = -1) const

References enableLabelCache, and myLabelCache.

Referenced by getElementIndex().

◆ checkCopyOnChange()

◆ checkGeoElementMap()

void LinkBaseExtension::checkGeoElementMap ( const App::DocumentObject obj,
const App::DocumentObject linked,
PyObject **  pyObj,
const char *  postfix 
) const

◆ detachElement()

void LinkBaseExtension::detachElement ( App::DocumentObject obj)

◆ detachElements()

void LinkBaseExtension::detachElements ( )

References detachElement().

Referenced by onExtendedUnsetupObject(), and setLink().

◆ elementNameFromIndex()

void LinkBaseExtension::elementNameFromIndex ( int  idx,
std::ostream &  ss 
) const

◆ expandSubname()

void LinkBaseExtension::expandSubname ( std::string &  subname) const

◆ extensionExecute()

◆ extensionGetLinkedObject()

bool LinkBaseExtension::extensionGetLinkedObject ( DocumentObject *&  ret,
bool  recursive,
Base::Matrix4D mat,
bool  transform,
int  depth 
) const

Get the linked object.

See also
Return turn if handled, the linked object is returned in ret

Reimplemented from App::DocumentObjectExtension.

References getContainer(), getTransform(), and getTrueLinkedObject().

◆ extensionGetPropertyByName()

Property * LinkBaseExtension::extensionGetPropertyByName ( const char *  name) const

find a property by its name

Reimplemented from App::Extension.

References checkingProperty, App::Extension::extensionGetPropertyByName(), getContainer(), and getTrueLinkedObject().

◆ extensionGetSubObject()

bool LinkBaseExtension::extensionGetSubObject ( DocumentObject *&  ret,
const char *  subname,
PyObject **  pyObj = nullptr,
Base::Matrix4D mat = nullptr,
bool  transform = false,
int  depth = 0 
) const

◆ extensionGetSubObjects()

bool LinkBaseExtension::extensionGetSubObjects ( std::vector< std::string > &  ret,
int  reason 
) const

Get name references of all sub objects.

See also
Return turn if handled, the sub object is returned in ret

Reimplemented from App::DocumentObjectExtension.

References App::DocumentObject::getSubObjects(), getTrueLinkedObject(), mySubElements, and App::Extension::name().

◆ extensionHasChildElement()

bool LinkBaseExtension::extensionHasChildElement ( ) const

◆ extensionIsElementVisible()

int LinkBaseExtension::extensionIsElementVisible ( const char *  element)

◆ extensionMustExecute()

short LinkBaseExtension::extensionMustExecute ( void  )

Reimplemented from App::DocumentObjectExtension.

References getLink().

◆ extensionOnChanged()

void LinkBaseExtension::extensionOnChanged ( const Property p)

◆ extensionSetElementVisible()

int LinkBaseExtension::extensionSetElementVisible ( const char *  element,
bool  visible 

◆ flattenSubname()

const char * LinkBaseExtension::flattenSubname ( const char *  subname) const

◆ getArrayIndex()

int LinkBaseExtension::getArrayIndex ( const char *  subname,
const char **  psubname = nullptr 

◆ getContainer() [1/2]

◆ getContainer() [2/2]

const DocumentObject * LinkBaseExtension::getContainer ( ) const

◆ getElementIndex()

◆ getExtensionPyObject()

PyObject * LinkBaseExtension::getExtensionPyObject ( void  )

◆ getLink()

DocumentObject * LinkBaseExtension::getLink ( int  depth = 0) const

◆ getLinkedChildren()

std::vector< App::DocumentObject * > LinkBaseExtension::getLinkedChildren ( bool  filter = true) const

◆ getOnChangeCopyObjects()

std::vector< App::DocumentObject * > LinkBaseExtension::getOnChangeCopyObjects ( std::vector< App::DocumentObject * > *  excludes = nullptr,
App::DocumentObject src = nullptr 

◆ getProperty() [1/2]

Property * LinkBaseExtension::getProperty ( const char *  name)

◆ getProperty() [2/2]

Property * LinkBaseExtension::getProperty ( int  idx)

Referenced by getProperty().

◆ getPropertyInfo()

const std::vector< LinkBaseExtension::PropInfo > & LinkBaseExtension::getPropertyInfo ( ) const

Referenced by getPropertyInfoMap(), and setProperty().

◆ getPropertyInfoMap()

const LinkBaseExtension::PropInfoMap & LinkBaseExtension::getPropertyInfoMap ( ) const

References getPropertyInfo().

Referenced by getProperty().

◆ getScaleVector()

Base::Vector3d LinkBaseExtension::getScaleVector ( ) const

◆ getSubElements()

const std::vector< std::string > & App::LinkBaseExtension::getSubElements ( ) const

◆ getSubName()

const char * App::LinkBaseExtension::getSubName ( ) const

Referenced by getTrueLinkedObject().

◆ getTransform()

Base::Matrix4D LinkBaseExtension::getTransform ( bool  transform) const

◆ getTrueLinkedObject()

◆ hasPlacement()

bool App::LinkBaseExtension::hasPlacement ( ) const

◆ isCopyOnChangeProperty()

◆ isLinkedToConfigurableObject()

bool LinkBaseExtension::isLinkedToConfigurableObject ( ) const

◆ isLinkMutated()

bool LinkBaseExtension::isLinkMutated ( ) const

Check if the linked object is a copy on change.

References CopyOnChangeDisabled.

◆ linkedPlainGroup()

App::GroupExtension * LinkBaseExtension::linkedPlainGroup ( ) const

References getTrueLinkedObject(), and mySubElements.

Referenced by update(), and updateGroup().

◆ linkTransform()

bool LinkBaseExtension::linkTransform ( ) const

Referenced by getTrueLinkedObject().

◆ makeCopyOnChange()

◆ monitorOnChangeCopyObjects()

void LinkBaseExtension::monitorOnChangeCopyObjects ( const std::vector< App::DocumentObject * > &  objs)

◆ onExtendedDocumentRestored()

◆ onExtendedUnsetupObject()

void LinkBaseExtension::onExtendedUnsetupObject ( )

get called when object is going to be removed from the document

Reimplemented from App::DocumentObjectExtension.

References detachElements().

◆ parseSubName()

void LinkBaseExtension::parseSubName ( ) const

◆ setLink()

◆ setOnChangeCopyObject()

void LinkBaseExtension::setOnChangeCopyObject ( App::DocumentObject obj,
OnChangeCopyOptions  options 

Include or exclude object from list of objects to copy on change.

objinput object
optionscontrol options.
See also

References ApplyAll, Exclude, and getContainer().

◆ setProperty()

◆ setupCopyOnChange() [1/2]

◆ setupCopyOnChange() [2/2]

void LinkBaseExtension::setupCopyOnChange ( App::DocumentObject parent,
bool  checkSource = false 

◆ slotChangedPlainGroup()

void LinkBaseExtension::slotChangedPlainGroup ( const App::DocumentObject obj,
const App::Property prop 

References updateGroup().

Referenced by updateGroup().

◆ syncCopyOnChange()

◆ syncElementList()

void LinkBaseExtension::syncElementList ( )

◆ update()

void LinkBaseExtension::update ( App::DocumentObject parent,
const Property prop 

References App::Document::addObject(), checkCopyOnChange(), connCopyOnChangeSource, CopyOnChangeDisabled, CopyOnChangeEnabled, CopyOnChangeOwned, enableLabelCache, getContainer(), App::DocumentObject::getDocument(), App::DocumentObject::getNameInDocument(), App::Property::getType(), App::Property::Hidden, App::Document::isAnyRestoring(), App::Document::isPerformingTransaction(), linkedPlainGroup(), myHiddenElements, myLabelCache, App::Property::Output, parseSubName(), pauseCopyOnChange, App::Prop_Output, setupCopyOnChange(), syncElementList(), App::Property::testStatus(), update(), updateGroup(), and App::Property::User3.

Referenced by ArchStructure.CommandStructuralSystem::Activated(), ArchAxisSystem.AxisSystemTaskPanel::addElement(), ArchComponent.ComponentTaskPanel::addElement(), ArchSectionPlane.SectionPlaneTaskPanel::addElement(), DraftGui.FacebinderTaskPanel::addElement(), femtaskpanels.task_result_mechanical._TaskPanel::calculate(), Spreadsheet_legacy.SpreadsheetView::changeCell(), draftguitools.gui_edit.Edit::endEditing(), extensionOnChanged(), draftguitools.gui_trackers.boxTracker::height(), onExtendedDocumentRestored(), draftguitools.gui_trackers.rectangleTracker::p3(), Plot.Plot::plot(), Spreadsheet_legacy.SpreadsheetView::recompute(), ArchAxisSystem.AxisSystemTaskPanel::removeElement(), ArchComponent.ComponentTaskPanel::removeElement(), ArchSectionPlane.SectionPlaneTaskPanel::removeElement(), DraftGui.FacebinderTaskPanel::removeElement(), draftguitools.gui_trackers.gridTracker::reset(), ArchNesting.Nester::run(), draftguitools.gui_trackers.gridTracker::setMainlines(), draftguitools.gui_trackers.gridTracker::setSize(), draftguitools.gui_trackers.gridTracker::setSpacing(), update(), and draftguitools.gui_edit_arch_objects.ArchWallGuiTools::update_object_from_edit_points().

◆ updateGroup()

Member Data Documentation

◆ checkingProperty

bool App::LinkBaseExtension::checkingProperty = false

◆ connCopyOnChangeSource

boost::signals2::scoped_connection App::LinkBaseExtension::connCopyOnChangeSource

Referenced by update().

◆ copyOnChangeConns

std::vector<boost::signals2::scoped_connection> App::LinkBaseExtension::copyOnChangeConns

Referenced by setupCopyOnChange().

◆ copyOnChangeSrcConns

std::vector<boost::signals2::scoped_connection> App::LinkBaseExtension::copyOnChangeSrcConns

◆ enableLabelCache

bool App::LinkBaseExtension::enableLabelCache

◆ hasCopyOnChange

bool App::LinkBaseExtension::hasCopyOnChange

◆ hasOldSubElement

bool App::LinkBaseExtension::hasOldSubElement

◆ myHiddenElements

std::unordered_set<const App::DocumentObject*> App::LinkBaseExtension::myHiddenElements

◆ myLabelCache

std::unordered_map<std::string,int> App::LinkBaseExtension::myLabelCache

◆ mySubElements

std::vector<std::string> App::LinkBaseExtension::mySubElements

◆ mySubName

std::string App::LinkBaseExtension::mySubName

Referenced by parseSubName().

◆ pauseCopyOnChange

bool App::LinkBaseExtension::pauseCopyOnChange = false

◆ plainGroupConns

std::unordered_map<const App::DocumentObject*, boost::signals2::scoped_connection> App::LinkBaseExtension::plainGroupConns

Referenced by updateGroup().

◆ prevLinkedObjectID

long App::LinkBaseExtension::prevLinkedObjectID = 0

◆ props

The documentation for this class was generated from the following files: