Files
create/src/App/DocumentObjectPy.xml
Zheng, Lei b057952a7e App: API changes for document recompute/save/restore/import/export
This patch adds support of recomputation with external linked object,
as well as external document auto loading and partial loading.

Application:

* Modified new/openDocument()/signalNewDocument to choose whether to
  signal GUI for creating a view for the document. This makes it possible
  to suppress view creation when opening external documents.

* New API openDocuments() which does the actual job of loading the
  document together with any external dependencies. There are afew
  extra arguments to allow setting FileName property differently from
  the actual file path, which are required when auto loading
  dependencies during document recovery (with future patch to
  Gui::DocumentRecovery)

* openDocumentPrivate() is an internal helper for opening individual
  document.

* New signalStart/FinishOpenDocument to be signaled before and after
  opening a document. There may be multiple depending documents actually
  opened in between these two signals.

* New signalBeforeRecomputeDocument signaled before recompute a
  document.

* New API addPendingDocument() for use by external capable link
  properties' to queue up external documents.

* isRestoring/isClosingAll(), for convenience status reporting.

Document:

* signalFinishImport/RestoreObjects, new signal triggered after imported
  or restored all input objects

* signalBeforeRecompute, signaled before start recomputing this document

* Modified signalRecomputed with additional recomputed objects, this is
  to make it more efficient for Gui::TreeWidget to check recomputation
  result.

* signalSkipRecompute, signal to inform which objects are skipped
  during recomputation because of their owner document SkipRecompute
  setting.

* restore/save/read/writeObjects() modified to suport partial
  loading. See [here](https://git.io/fj6PY) for more information.

* afterRestore(), internal function called to finish restore. The
  function is separated from restore() because there is quite a few
  critical steps needed to fully restore a document with external
  linking. See [here](https://git.io/fj6P4) for more information.

* DocumentP::_RecomputeLog is modified to store more accurate object
  recomputation error, including those happened during restore/import.

* isExporting(), new API for checking if an object is exporting.
  External linking properties will use this function to decide how to
  export.

* copyObject(), modified to support external linking objects, and
  accepts multiple input objects.

* moveObject(), modified to support arbitary object moves. The original
  implementation may cause crash if undo/redo is enabled. Furthermore,
  because the original information fakes the object's deletion to break
  its dependency, it does not work for objects that may auto delete their
  children when being deleted. The new implementation copy the object,
  and than paste it to the other document. It then deletes the input
  objects from the original document. In case of recursive move, it only
  deletes the depending object if it has an empty in list.

* importLinks(), new API to import any external object linked by the
  input objects into this document. It will auto correct all link
  references after importing.

* getDependencyList/_rebuildDependencyList(), these two APIs are unified
  and implemented by an internal function _buildDependencyList() with a
  new algorithm to handle external objects. The returned dependency list
  will now include objects from external documents. In case of cyclic
  dependencies, getDpendencyList() will report the actual objects
  involved in dependency loops.

* mustExecute(), new API to check if there are any object requires
  recomputation. This function will call _buildDependencyList() and
  check for external objects as well.

* addRecomputeObject(), new API for marking changes during document
  restore. It only marks the object but does not actually recompute
  them for performance reason. One use case is for geo feature to
  request for recomputation to generate geometry topological names.

* recompute(), support partial, external, and inverse dependency
  recomputation. Improve error handling during recomputation.
  See [here](https://git.io/fj6PO) for more information.

* _recomputeFeature(), suppoert user abort.

* getDependentDocuments/getInList(), new API to obtain an optional
  dependency sorted list of depending documents.

DocumentObject:

* Add various ObjectStatus flags

* isExporting/getExportName(), return a safe name for exporting, in the
  form of <ObjName>@<DocName>, which is guarrenteed to be unique.
  Various link property will save linked object using this name if the
  the linked object is exported together with the owner object, see
  [PropertyLinkBase::restoreLabelReference()](https://git.io/fj6XO)
  for more information.

* recomputeFeature(), add option to recompute this object together with
  all its dependent objects.

* canLoadPartial(), new API for [partial document loading](https://git.io/fj6PY).

MergeDocuments:

* Move object name mapping logic to various link properties. See

Base::Sequencer:

* Add new API checkAbort() for checking user abort.
2019-08-17 14:52:10 +02:00

291 lines
12 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>recompute(recursive=False): 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>
<Methode Name="resolveSubElement" Const="true">
<Documentation>
<UserDocu>
resolveSubElement(subname,append,type) -- resolve both new and old style sub element
subname: subname reference contianing object hierarchy
append: Whether to append object hierarchy prefix inside subname to returned element name
type: 0: normal, 1: for import, 2: for export
Return tuple(obj,newElementName,oldElementName)
</UserDocu>
</Documentation>
</Methode>
<Methode Name="adjustRelativeLinks">
<Documentation>
<UserDocu>adjustRelativeLinks(parent,recursive=True) -- auto correct potential cyclic dependencies</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="MustExecute" ReadOnly="true">
<Documentation>
<UserDocu>Check if the object must be recomputed</UserDocu>
</Documentation>
<Parameter Name="MustExecute" Type="Boolean"/>
</Attribute>
<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="Removing" ReadOnly="true">
<Documentation>
<UserDocu>Indicate if the object is being removed</UserDocu>
</Documentation>
<Parameter Name="Removing" Type="Boolean"/>
</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>
<Attribute Name="OldLabel" ReadOnly="true">
<Documentation>
<UserDocu>Contains the old label before change</UserDocu>
</Documentation>
<Parameter Name="OldLabel" Type="String"/>
</Attribute>
<Attribute Name="NoTouch">
<Documentation>
<UserDocu>Enable/disable no touch on any property change</UserDocu>
</Documentation>
<Parameter Name="NoTouch" Type="Boolean"/>
</Attribute>
</PythonExport>
</GenerateModel>