Files
FreeCAD/src/App/DocumentObjectPy.xml
T
Zheng, Lei ff1d1cd341 App: add New APIs for future Link function
DocumentObject:

* getSubObject(): the most important API for Link to work with
  hierarchies. The function is a inspired from and replaces the
  getPySubObjects(). It returns a child object following a dot separated
  subname reference, and can optionally return accumulated
  transformation, and/or a python object of the refered
  sub-object/element. The default implementation here is to look for
  link type property, and search for the referenced object. This patch also
  include other specialized implementation of this API, such as
  (GeoFeature)GroupExtension (through extensionGetSubObject()),
  PartDesign::Body, and so on. A link type object is expected to
  call the linked object's getSubObject() for resolving.

* getSubObjectList(): helper function to return a list of object
  referenced in the given subname.

* getSubObjects(): return a list of subname references of all children
  objects. The purpose of this function is similar to
  ViewProvider::claimChildren().  Container type object is expected to
  implement this function.  The reason it returns subname references
  instead of just object is to allow the container to skip hierarchies.
  For example, the Assembly3 container uses this to skip the constraint
  and element group.

* getLinkedObject(), obtain the linked object, and optionally with the
  accumulated transformation. It is expected to return a linked object
  or the object itself if it is not a link. In case there are multiple
  levels of linking involved, this function allows the caller to retrieve
  the linked object recursively.

* hasChildElement(), set/isElementVisible(), controls the children
  visibility for a group type object. Because the child object may be
  claimed by other objects, it is essential to have independent control
  of children visibilities. These APIs are designed to abstract how
  group manages the child visibility. For performance reason, these
  function are meant to control only the immediate child object.

* resolve(), helper function to parse subname reference and resolve the
  final object, and optionally the immediate parent of the final object,
  the final object reference name (for calling `set/isElementVisible()`),
  and the subname reference if there is one.

* touch(), add optional argument 'noRecompute' for better backward
  compatibility with the NoRecompute flag. By default, touch() causes
  recompute unless noRecompute is true

* signalChanged/signalBeforeChange, two new signal for tracking changes
  of a specific object.

* getViewProviderNameOverride(), return a string of the view provider
  type of this object. This allows Python class to override the view
  provider of an object. This feature will be used by ViewProviderLink
  which is designed to work with any object that has LinkBaseExtension.

* canLinkProperties(), will be used by Gui::PropertyView to display
  linked object properties together with the object's own properties.

* redirectSubname(), will be used by Gui::Tree to allow an object to
  redirect selection to some other object when (pre)selected in the tree
  view.

* Visibility, new property serve as the same purpose as view provider
  property of the same name. It is added here so that App namespace
  code can check for visibility without Gui module. This is useful,
  for example, when constructing a compound shape of a container that
  respects the children visibility.

* (has)hasHiddenMarker(), return or check for a special sub-element
  name used as marker for overriding sub-object visibility. Will be
  used by Gui::ViewProvider, it is put here for the same reason as
  adding Visibility property.

* getID(), return object internal identifier. Each object is now
  assigned an integer identifier that is unique within its containing
  document.

Document:

* ShowHidden, new property to tell tree view whether to show hidden
  object items.

* signalTouchedObject, new signal triggered when manually touch an
  object when calling its touch() function

* getObjectByID(), get object by its identifier

* addObject() is modified to allow overriding view provider

* has/getLinksTo(), helper function to obtain links to a given object.

Application:

* checkLinkDepth(), helper function to check recursive depth for link
  traversal. The depth is checked against the total object count of
  all opened documents. The count (_objCount) is internally updated
  whenever object is added or removed.

* has/getLinksTo(), same as Document::has/getLinksTo() but return links
  from all opened documents.

GroupExtension/OriginGroupExtension/DatumFeature/DatumCS/Part::Feature:
implement sepcialized getSubObject/getSubObjects().
2019-08-17 14:52:08 +02:00

249 lines
10 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="ExtensionContainerPy"
Name="DocumentObjectPy"
Twin="DocumentObject"
TwinPointer="DocumentObject"
Include="App/DocumentObject.h"
Namespace="App"
FatherInclude="App/ExtensionContainerPy.h"
FatherNamespace="App">
<Documentation>
<Author Licence="LGPL" Name="Juergen Riegel" EMail="FreeCAD@juergen-riegel.net" />
<UserDocu>This is the father of all classes handled by the document</UserDocu>
</Documentation>
<Methode Name="addProperty">
<Documentation>
<UserDocu>
addProperty(string, string) -- Add a generic property.
The first argument specifies the type, the second the
name of the property.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="removeProperty">
<Documentation>
<UserDocu>
removeProperty(string) -- Remove a generic property.
Note, you can only remove user-defined properties but not built-in ones.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="supportedProperties">
<Documentation>
<UserDocu>A list of supported property types</UserDocu>
</Documentation>
</Methode>
<Methode Name="touch">
<Documentation>
<UserDocu>Mark the object as changed (touched)</UserDocu>
</Documentation>
</Methode>
<Methode Name="purgeTouched">
<Documentation>
<UserDocu>Mark the object as unchanged</UserDocu>
</Documentation>
</Methode>
<Methode Name="enforceRecompute">
<Documentation>
<UserDocu>Mark the object for recompute</UserDocu>
</Documentation>
</Methode>
<Methode Name="setExpression">
<Documentation>
<UserDocu>Register an expression for a property</UserDocu>
</Documentation>
</Methode>
<Methode Name="recompute">
<Documentation>
<UserDocu>Recomputes this object</UserDocu>
</Documentation>
</Methode>
<Methode Name="getSubObject" Keyword="true">
<Documentation>
<UserDocu>
getSubObject(subname, retType=0, matrix=None, transform=True, depth=0)
* subname(string|list|tuple): dot separated string or sequence of strings
referencing subobject.
* retType: return type, 0=PyObject, 1=DocObject, 2=DocAndPyObject, 3=Placement
PyObject: return a python binding object for the (sub)object referenced in
each 'subname' The actual type of 'PyObject' is impelementation dependent.
For Part::Feature compatible objects, this will be of type TopoShapePy and
pre-transformed by accumulated transformation matrix along the object path.
DocObject: return the document object referenced in subname, if 'matrix' is
None. Or, return a tuple (object, matrix) for each 'subname' and 'matrix' is
the accumulated transformation matrix for the sub object.
DocAndPyObject: return a tuple (object, matrix, pyobj) for each subname
Placement: return a trasformed placement of the sub-object
* matrix: the initial transformation to be applied to the sub object.
* transform: whether to transform the sub object using this object's placement
* depth: current recursive depth
</UserDocu>
</Documentation>
</Methode>
<Methode Name="getSubObjectList">
<Documentation>
<UserDocu>
getSubObjectList(subname)
Return a list of objects referenced by a given subname including this object
</UserDocu>
</Documentation>
</Methode>
<Methode Name="getSubObjects">
<Documentation>
<UserDocu>getSubObjects(reason=0): Return subname reference of all sub-objects</UserDocu>
</Documentation>
</Methode>
<Methode Name="getLinkedObject" Keyword="true">
<Documentation>
<UserDocu>
getLinkedObject(recursive=True, matrix=None, transform=True, depth=0)
Returns the linked object if there is one, or else return itself
* recusive: whether to recursively resolve the links
* transform: whether to transform the sub object using this object's placement
* matrix: If not none, this sepcifies the initial transformation to be applied
to the sub object. And cause the method to return a tuple (object, matrix)
containing the accumulated transformation matrix
* depth: current recursive depth
</UserDocu>
</Documentation>
</Methode>
<Methode Name="setElementVisible">
<Documentation>
<UserDocu>
setElementVisible(element,visible): Set the visibility of a child element
Return -1 if element visibility is not supported, 0 if element not found, 1 if success
</UserDocu>
</Documentation>
</Methode>
<Methode Name="isElementVisible">
<Documentation>
<UserDocu>
isElementVisible(element): Check if a child element is visible
Return -1 if element visibility is not supported or element not found, 0 if invisible, or else 1
</UserDocu>
</Documentation>
</Methode>
<Methode Name="hasChildElement">
<Documentation>
<UserDocu>Return true to indicate the object having child elements</UserDocu>
</Documentation>
</Methode>
<Methode Name="getParentGroup">
<Documentation>
<UserDocu>Returns the group the object is in or None if it is not part of a group.
Note that an object can only be in a single group, hence only a single return
value.</UserDocu>
</Documentation>
</Methode>
<Methode Name="getParentGeoFeatureGroup">
<Documentation>
<UserDocu>Returns the GeoFeatureGroup, and hence the local coorinate system, the object
is in or None if it is not part of a group. Note that an object can only be
in a single group, hence only a single return value.</UserDocu>
</Documentation>
</Methode>
<Methode Name="getPathsByOutList">
<Documentation>
<UserDocu>Get all paths from this object to another object following the OutList.</UserDocu>
</Documentation>
</Methode>
<Methode Name="resolve" Const="true">
<Documentation>
<UserDocu>
resolve(subname) -- resolve the sub object
Returns a tuple (subobj,parent,elementName,subElement), where 'subobj' is the
last object referenced in 'subname', and 'parent' is the direct parent of
'subobj', and 'elementName' is the name of the subobj, which can be used
to call parent.isElementVisible/setElementVisible(). 'subElement' is the
non-object sub-element name if any.
</UserDocu>
</Documentation>
</Methode>
<Attribute Name="OutList" ReadOnly="true">
<Documentation>
<UserDocu>A list of all objects this object links to.</UserDocu>
</Documentation>
<Parameter Name="OutList" Type="List"/>
</Attribute>
<Attribute Name="OutListRecursive" ReadOnly="true">
<Documentation>
<UserDocu>A list of all objects this object links to recursively.</UserDocu>
</Documentation>
<Parameter Name="OutListRecursive" Type="List"/>
</Attribute>
<Attribute Name="InList" ReadOnly="true">
<Documentation>
<UserDocu>A list of all objects which link to this object.</UserDocu>
</Documentation>
<Parameter Name="InList" Type="List"/>
</Attribute>
<Attribute Name="InListRecursive" ReadOnly="true">
<Documentation>
<UserDocu>A list of all objects which link to this object recursively.</UserDocu>
</Documentation>
<Parameter Name="InListRecursive" Type="List"/>
</Attribute>
<Attribute Name="FullName" ReadOnly="true">
<Documentation>
<UserDocu>Return the document name and internal name of this object</UserDocu>
</Documentation>
<Parameter Name="FullName" Type="String"/>
</Attribute>
<Attribute Name="Name" ReadOnly="true">
<Documentation>
<UserDocu>Return the internal name of this object</UserDocu>
</Documentation>
<Parameter Name="Name" Type="String"/>
</Attribute>
<Attribute Name="Document" ReadOnly="true">
<Documentation>
<UserDocu>Return the document this object is part of</UserDocu>
</Documentation>
<Parameter Name="Document" Type="Object"/>
</Attribute>
<Attribute Name="State" ReadOnly="true">
<Documentation>
<UserDocu>State of the object in the document</UserDocu>
</Documentation>
<Parameter Name="State" Type="List"/>
</Attribute>
<Attribute Name="ViewObject" ReadOnly="true">
<Documentation>
<UserDocu>If the GUI is loaded the associated view provider is returned
or None if the GUI is not up</UserDocu>
</Documentation>
<Parameter Name="ViewObject" Type="Object"/>
</Attribute>
<CustomAttributes />
<Attribute Name="ID" ReadOnly="true">
<Documentation>
<UserDocu>The unique identifier (among its document) of this object</UserDocu>
</Documentation>
<Parameter Name="ID" Type="Int"/>
</Attribute>
<Attribute Name="Parents" ReadOnly="true">
<Documentation>
<UserDocu>A List of tuple(parent,subname) holding all parents to this object</UserDocu>
</Documentation>
<Parameter Name="Parents" Type="List"/>
</Attribute>
</PythonExport>
</GenerateModel>