SHAPER  9.15.0
Model_Document.h
1 // Copyright (C) 2014-2025 CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef Model_Document_H_
21 #define Model_Document_H_
22 
23 #include <Model.h>
24 #include <ModelAPI_Document.h>
25 #include <ModelAPI_Feature.h>
26 #include <ModelAPI_Result.h>
27 #include <ModelAPI_ResultParameter.h>
28 
29 #include <TDocStd_Document.hxx>
30 #include <map>
31 #include <set>
32 
33 class Handle_Model_Document;
34 class Model_Objects;
36 class TopoDS_Shape;
37 
45 {
46  public:
50  MODEL_EXPORT virtual const std::string& kind() const {return myKind;}
51 
57  MODEL_EXPORT virtual bool load(
58  const char* theDirName, const char* theFileName, DocumentPtr theThis);
59 
67  MODEL_EXPORT virtual bool importPart(const char* theFileName,
68  std::list<std::shared_ptr<ModelAPI_Feature> >& theImported,
69  bool theCheckOnly = false);
70 
76  MODEL_EXPORT virtual bool save(
77  const char* theDirName, const char* theFileName, std::list<std::string>& theResults, bool doBackup=false);
78 
82  MODEL_EXPORT virtual bool save(const char* theFilename,
83  const std::list<std::shared_ptr<ModelAPI_Feature> >& theExportFeatures) const;
84 
88  MODEL_EXPORT virtual void close(const bool theForever = false);
89 
91  MODEL_EXPORT virtual void startOperation();
94  MODEL_EXPORT virtual bool finishOperation();
96  MODEL_EXPORT virtual void abortOperation();
98  MODEL_EXPORT virtual bool isOperation() const;
100  MODEL_EXPORT virtual bool isModified();
101 
103  MODEL_EXPORT virtual bool canUndo();
105  MODEL_EXPORT virtual void undo();
107  MODEL_EXPORT virtual bool canRedo();
109  MODEL_EXPORT virtual void redo();
111  MODEL_EXPORT virtual void clearUndoRedo();
112 
116  MODEL_EXPORT virtual FeaturePtr addFeature(std::string theID, const bool theMakeCurrent = true);
117 
122  MODEL_EXPORT virtual void refsToFeature(FeaturePtr theFeature,
123  std::set<FeaturePtr>& theRefs,
124  const bool isSendError = true);
125 
130  MODEL_EXPORT virtual void removeFeature(FeaturePtr theFeature);
131 
133  MODEL_EXPORT virtual void moveFeature(
134  FeaturePtr theMoved, FeaturePtr theAfterThis, const bool theSplit = false);
135 
140  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Object> objectByName(
141  const std::string& theGroupID, const std::wstring& theName);
142 
147  MODEL_EXPORT virtual int index(std::shared_ptr<ModelAPI_Object> theObject,
148  const bool theAllowFolder = false);
149 
151  MODEL_EXPORT virtual std::shared_ptr<Model_Document> subDoc(int theDocID);
152 
154  MODEL_EXPORT virtual const int id() const
155  {
156  return myID;
157  }
158 
163  MODEL_EXPORT virtual ObjectPtr object(const std::string& theGroupID,
164  const int theIndex,
165  const bool theAllowFolder = false);
166 
170  MODEL_EXPORT virtual int size(const std::string& theGroupID, const bool theAllowFolder = false);
171 
174  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Object> parent(
175  const std::shared_ptr<ModelAPI_Object> theChild);
176 
181  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> currentFeature(const bool theVisible);
182 
187  MODEL_EXPORT virtual void setCurrentFeature(std::shared_ptr<ModelAPI_Feature> theCurrent,
188  const bool theVisible);
189 
191  MODEL_EXPORT virtual void setCurrentFeatureUp();
192 
194  MODEL_EXPORT virtual int numInternalFeatures();
196  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> internalFeature(const int theIndex);
201  MODEL_EXPORT virtual void synchronizeTransactions();
202 
204  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultConstruction> createConstruction(
205  const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
207  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultBody> createBody(
208  const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
210  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultPart> createPart(
211  const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
213  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultPart> copyPart(
214  const std::shared_ptr<ModelAPI_ResultPart>& theOrigin,
215  const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
217  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultGroup> createGroup(
218  const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
220  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultField> createField(
221  const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
223  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultParameter> createParameter(
224  const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
225 
227  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature>
228  feature(const std::shared_ptr<ModelAPI_Result>& theResult);
229 
233  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Folder> addFolder(
234  std::shared_ptr<ModelAPI_Feature> theAddBefore = std::shared_ptr<ModelAPI_Feature>());
236  MODEL_EXPORT virtual void removeFolder(std::shared_ptr<ModelAPI_Folder> theFolder);
240  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Folder> findFolderAbove(
241  const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures);
245  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Folder> findFolderBelow(
246  const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures);
252  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Folder> findContainingFolder(
253  const std::shared_ptr<ModelAPI_Feature>& theFeature,
254  int& theIndexInFolder);
258  MODEL_EXPORT virtual bool moveToFolder(
259  const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures,
260  const std::shared_ptr<ModelAPI_Folder>& theFolder);
267  MODEL_EXPORT virtual bool removeFromFolder(
268  const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures,
269  const bool theBefore = true);
270 
273  bool executeFeatures() {return myExecuteFeatures;}
274 
276  void setExecuteFeatures(const bool theFlag);
277 
279  void addNamingName(const TDF_Label theLabel, std::wstring theName);
281  void changeNamingName(std::wstring theOldName, const std::wstring theNewName,
282  const TDF_Label& theLabel);
284  TDF_Label findNamingName(std::wstring theName, ResultPtr theContext);
287  int numberOfNameInHistory(const ObjectPtr& theNameObject, const TDF_Label& theStartFrom);
290  ResultPtr findByName(std::wstring& theName,
291  std::wstring& theSubShapeName,
292  bool& theUniqueContext);
293 
296  MODEL_EXPORT virtual std::list<std::shared_ptr<ModelAPI_Feature> > allFeatures();
297 
300  MODEL_EXPORT virtual std::list<std::shared_ptr<ModelAPI_Object> > allObjects();
301 
303  MODEL_EXPORT virtual int transactionID();
305  MODEL_EXPORT virtual void incrementTransactionID();
306 
308  MODEL_EXPORT virtual bool isOpened();
309 
312  FeaturePtr lastFeature();
313 
315  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> producedByFeature(
316  std::shared_ptr<ModelAPI_Result> theResult,
317  const std::shared_ptr<GeomAPI_Shape>& theShape);
318 
320  MODEL_EXPORT virtual bool isLater(FeaturePtr theLater, FeaturePtr theCurrent) const;
321 
323  MODEL_EXPORT virtual void eraseAllFeatures();
324 
328  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> nextFeature(
329  std::shared_ptr<ModelAPI_Feature> theCurrent, const bool theReverse = false) const;
330 
332  ~Model_Document();
333 
334  protected:
336  TDF_Label generalLabel() const;
337 
339  Model_Document(const int theID, const std::string theKind);
340 
342  Handle_TDocStd_Document document()
343  {
344  return myDoc;
345  }
346 
349  void compactNested();
350 
352  const std::set<int> subDocuments() const;
353 
355  void undoInternal(const bool theWithSubs, const bool theSynchronize);
356 
358  void operationId(const std::string& theId);
359 
361  std::list<std::string> undoList() const;
362 
364  std::list<std::string> redoList() const;
365 
367  virtual void updateHistory(const std::shared_ptr<ModelAPI_Object> theObject);
369  virtual void updateHistory(const std::string theGroup);
370 
372  bool isRoot() const;
373 
375  void setThis(DocumentPtr theDoc);
376 
378  Model_Objects* objects() {return myObjs;}
379 
381  virtual void setActive(const bool theFlag);
383  virtual bool isActive() const;
384 
387  std::shared_ptr<ModelAPI_AttributeSelectionList> selectionInPartFeature();
388 
390  std::shared_ptr<ModelAPI_AttributeSelection> selectionInResult();
391 
394  virtual void storeNodesState(const std::list<bool>& theStates);
395 
398  virtual void restoreNodesState(std::list<bool>& theStates) const;
399 
401  TDF_Label extConstructionsLabel() const;
402 
404  FeaturePtr featureByLab(const TDF_Label& theLab);
406  ResultPtr resultByLab(const TDF_Label& theLab);
407 
409  bool isLaterByDep(FeaturePtr theThis, FeaturePtr theOther);
410 
413 
415  void setAutoRecomutationState(const bool theState);
417  bool autoRecomutationState() const;
418 
419  friend class Model_Application;
420  friend class Model_Session;
421  friend class Model_Update;
422  friend class Model_AttributeReference;
423  friend class Model_AttributeRefAttr;
424  friend class Model_AttributeRefList;
425  friend class Model_AttributeRefAttrList;
426  friend class Model_AttributeSelection;
427  friend class Model_AttributeSelectionList;
428  friend class Model_ResultPart;
429  friend class Model_ResultBody;
430  friend class Model_ResultConstruction;
431  friend class Model_SelectionInResult;
432  friend class Model_SelectionNaming;
433  friend class Model_BodyBuilder;
434  friend class DFBrowser;
435 
436  private:
437  int myID;
438  std::string myKind;
439  Handle_TDocStd_Document myDoc;
440 
441  Model_Objects *myObjs;
442 
444  int myTransactionSave;
447  std::list<int> myNestedNum;
448 
450  struct Transaction {
451  int myOCAFNum;
452  std::string myId;
454  Transaction(): myOCAFNum(0), myId("") {}
455  };
456 
459  std::list<Transaction> myTransactions;
461  std::list<Transaction> myRedos;
462 
465  std::map<std::wstring, std::list<TDF_Label> > myNamingNames;
467  bool myExecuteFeatures;
468 
469  bool myIsActive;
470 
472  FeaturePtr mySelectionFeature;
473 
474  bool myIsSetCurrentFeature;
475 };
476 
477 #endif
Attribute that contains list of references to the sub-shapes with possibility to manage them.
Definition: ModelAPI_AttributeSelectionList.h:37
Document for internal data structure of any object storage.
Definition: ModelAPI_Document.h:53
Realization of Open CASCADE application abstraction.
Definition: Model_Application.h:38
Attribute that contains list of references to features (located in the same document) or references t...
Definition: Model_AttributeRefAttrList.h:38
Attribute that contains reference to an attribute of a feature (located in the same document).
Definition: Model_AttributeRefAttr.h:36
Attribute that contains list of references to features, may be located in different documents.
Definition: Model_AttributeRefList.h:37
Attribute that contains reference to feature (located in the same document).
Definition: Model_AttributeReference.h:35
Attribute that contains list of references to the sub-shapes with possibility to manage them.
Definition: Model_AttributeSelectionList.h:38
Attribute that contains reference to the sub-shape of some result, the selected shape.
Definition: Model_AttributeSelection.h:40
Extra API for the ResultBody that allows to work with naming.
Definition: Model_BodyBuilder.h:37
Document for internal data structure of any object storage.
Definition: Model_Document.h:45
virtual MODEL_EXPORT void startOperation()
Starts a new operation (opens a transaction)
Definition: Model_Document.cpp:650
virtual MODEL_EXPORT int index(std::shared_ptr< ModelAPI_Object > theObject, const bool theAllowFolder=false)
Returns the object index in the group.
Definition: Model_Document.cpp:1392
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_Feature > producedByFeature(std::shared_ptr< ModelAPI_Result > theResult, const std::shared_ptr< GeomAPI_Shape > &theShape)
Returns the feature that produced the given face of the given result.
Definition: Model_Document.cpp:2222
ResultPtr findByName(std::wstring &theName, std::wstring &theSubShapeName, bool &theUniqueContext)
Returns the result by name of the result (names of results must be unique, used for naming selection ...
Definition: Model_Document.cpp:1974
bool isLaterByDep(FeaturePtr theThis, FeaturePtr theOther)
returns true if theThis is later in the features tree and dependencies than theOther
Definition: Model_Document.cpp:1898
virtual MODEL_EXPORT void removeFolder(std::shared_ptr< ModelAPI_Folder > theFolder)
Removes the folder from the document (all features in the folder will be kept).
Definition: Model_Document.cpp:1645
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_Feature > currentFeature(const bool theVisible)
Returns the feature that is currently edited in this document, normally this is the latest created fe...
Definition: Model_Document.cpp:1413
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_Feature > internalFeature(const int theIndex)
Returns the feature by zero-based index: features in the history or not.
Definition: Model_Document.cpp:2073
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_Folder > findContainingFolder(const std::shared_ptr< ModelAPI_Feature > &theFeature, int &theIndexInFolder)
Search a folder containing the given feature.
Definition: Model_Document.cpp:1663
virtual MODEL_EXPORT bool load(const char *theDirName, const char *theFileName, DocumentPtr theThis)
Loads the OCAF document from the file.
Definition: Model_Document.cpp:313
virtual MODEL_EXPORT int numInternalFeatures()
Returns the number of all features: in the history or not.
Definition: Model_Document.cpp:2068
virtual MODEL_EXPORT void setCurrentFeatureUp()
Makes the current feature one feature upper.
Definition: Model_Document.cpp:1570
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_Object > objectByName(const std::string &theGroupID, const std::wstring &theName)
Returns the first found object in the group by the object name.
Definition: Model_Document.cpp:1386
void appendTransactionToPrevious()
appends the latest transaction to the previous one (used for AutoUpdate enabling transaction)
Definition: Model_Document.cpp:2395
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_ResultField > createField(const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0)
Creates a field result.
Definition: Model_Document.cpp:1627
virtual MODEL_EXPORT void incrementTransactionID()
Increases the transaction ID.
Definition: Model_Document.cpp:2052
virtual MODEL_EXPORT const int id() const
! Returns the id of the document
Definition: Model_Document.h:154
void setAutoRecomutationState(const bool theState)
Sets the automatic recomputation flag: true means enabled.
Definition: Model_Document.cpp:2414
virtual MODEL_EXPORT void close(const bool theForever=false)
Removes document data.
Definition: Model_Document.cpp:610
virtual MODEL_EXPORT bool isOperation() const
Returns true if operation has been started, but not yet finished or aborted.
Definition: Model_Document.cpp:1007
TDF_Label extConstructionsLabel() const
Label that contains structures for selection of constructions of another document.
Definition: Model_Document.cpp:2058
Handle_TDocStd_Document document()
Returns the internal OCCT document of this interface.
Definition: Model_Document.h:342
virtual MODEL_EXPORT bool finishOperation()
Finishes the previously started operation (closes the transaction)
Definition: Model_Document.cpp:814
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_Folder > findFolderAbove(const std::list< std::shared_ptr< ModelAPI_Feature > > &theFeatures)
Search a folder above the list of features applicable to store them (it means the list of features st...
Definition: Model_Document.cpp:1651
bool executeFeatures()
! Returns true if parametric updater need to execute feature on recomputation On abort,...
Definition: Model_Document.h:273
virtual MODEL_EXPORT bool isOpened()
Returns true if document is opened and valid.
Definition: Model_Document.cpp:2063
virtual void setActive(const bool theFlag)
! Informs the document that it becomes active and some actions must be performed
Definition: Model_Document.cpp:2014
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_Folder > addFolder(std::shared_ptr< ModelAPI_Feature > theAddBefore=std::shared_ptr< ModelAPI_Feature >())
Creates a folder (group of the features in the object browser)
Definition: Model_Document.cpp:1639
virtual MODEL_EXPORT bool moveToFolder(const std::list< std::shared_ptr< ModelAPI_Feature > > &theFeatures, const std::shared_ptr< ModelAPI_Folder > &theFolder)
Add a list of features to the folder.
Definition: Model_Document.cpp:1670
virtual MODEL_EXPORT void undo()
Undoes last operation.
Definition: Model_Document.cpp:1091
virtual MODEL_EXPORT bool isLater(FeaturePtr theLater, FeaturePtr theCurrent) const
Returns true if theLater is in history of features creation later than theCurrent.
Definition: Model_Document.cpp:2333
ResultPtr resultByLab(const TDF_Label &theLab)
searches in this document result that contains this label
Definition: Model_Document.cpp:1699
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_Folder > findFolderBelow(const std::list< std::shared_ptr< ModelAPI_Feature > > &theFeatures)
Search a folder below the list of features applicable to store them (it means the list of features st...
Definition: Model_Document.cpp:1657
std::shared_ptr< ModelAPI_AttributeSelectionList > selectionInPartFeature()
Returns the selection attribute that is used for calculation of selection externally from the documen...
Definition: Model_Document.cpp:2119
virtual MODEL_EXPORT bool isModified()
Returns true if document was modified (since creation/opening)
Definition: Model_Document.cpp:1013
virtual MODEL_EXPORT std::list< std::shared_ptr< ModelAPI_Feature > > allFeatures()
! Returns all features of the document including the hidden features which are not in history.
Definition: Model_Document.cpp:2004
~Model_Document()
Erases the document structure.
Definition: Model_Document.cpp:128
virtual MODEL_EXPORT bool canUndo()
Returns True if there are available Undo-s.
Definition: Model_Document.cpp:1019
TDF_Label generalLabel() const
Returns (creates if needed) the general label.
Definition: Model_Document.cpp:1591
virtual void restoreNodesState(std::list< bool > &theStates) const
Returns the stored nodes states.
Definition: Model_Document.cpp:2354
TDF_Label findNamingName(std::wstring theName, ResultPtr theContext)
Returns the label, keeper of the name for the topological naming needs.
Definition: Model_Document.cpp:1824
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_ResultBody > createBody(const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0)
Creates a body results.
Definition: Model_Document.cpp:1602
std::shared_ptr< ModelAPI_AttributeSelection > selectionInResult()
Returns the selection attribute that is used.
Definition: Model_Document.cpp:2165
std::list< std::string > redoList() const
Returns the list of Ids of the operations that can be redone (called for the root document)
Definition: Model_Document.cpp:1169
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_ResultPart > copyPart(const std::shared_ptr< ModelAPI_ResultPart > &theOrigin, const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0)
Copies a part result, keeping the reference to origin.
Definition: Model_Document.cpp:1614
virtual MODEL_EXPORT FeaturePtr addFeature(std::string theID, const bool theMakeCurrent=true)
Adds to the document the new feature of the given feature id.
Definition: Model_Document.cpp:1185
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_ResultConstruction > createConstruction(const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0)
Creates construction results.
Definition: Model_Document.cpp:1596
virtual MODEL_EXPORT bool save(const char *theDirName, const char *theFileName, std::list< std::string > &theResults, bool doBackup=false)
Saves the OCAF document to the file.
Definition: Model_Document.cpp:488
virtual MODEL_EXPORT void clearUndoRedo()
Clears undo/redo lists.
Definition: Model_Document.cpp:1137
virtual MODEL_EXPORT std::list< std::shared_ptr< ModelAPI_Object > > allObjects()
Returns all objects of the document including the hidden features which are not in history.
Definition: Model_Document.cpp:2009
void undoInternal(const bool theWithSubs, const bool theSynchronize)
The implementation of undo: with or without recursive calls in the sub-documents.
Definition: Model_Document.cpp:1042
Model_Document(const int theID, const std::string theKind)
Creates new document with binary file format.
Definition: Model_Document.cpp:108
virtual void updateHistory(const std::shared_ptr< ModelAPI_Object > theObject)
Internally makes document know that feature was removed or added in history after creation.
Definition: Model_Document.cpp:1345
void compactNested()
performs compactification of all nested operations into one
Definition: Model_Document.cpp:675
virtual MODEL_EXPORT void abortOperation()
Aborts the operation.
Definition: Model_Document.cpp:962
void addNamingName(const TDF_Label theLabel, std::wstring theName)
Registers the name of the shape for the topological naming needs.
Definition: Model_Document.cpp:1712
virtual MODEL_EXPORT int transactionID()
Returns the global identifier of the current transaction (needed for the update algo)
Definition: Model_Document.cpp:2042
void setExecuteFeatures(const bool theFlag)
! On abort, undo or redo it is not necessary: results in document are updated automatically
Definition: Model_Document.cpp:2383
FeaturePtr featureByLab(const TDF_Label &theLab)
searches in this document feature that contains this label
Definition: Model_Document.cpp:1692
virtual MODEL_EXPORT void moveFeature(FeaturePtr theMoved, FeaturePtr theAfterThis, const bool theSplit=false)
Moves the feature to make it after the given one in the history.
Definition: Model_Document.cpp:1282
FeaturePtr lastFeature()
Returns the last feature in the document (even not visible or disabled)
Definition: Model_Document.cpp:2184
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_Feature > nextFeature(std::shared_ptr< ModelAPI_Feature > theCurrent, const bool theReverse=false) const
Returns the next (from the history point of view) feature, any: invisible or disabled.
Definition: Model_Document.cpp:2373
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_ResultGroup > createGroup(const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0)
Creates a group result.
Definition: Model_Document.cpp:1621
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_ResultParameter > createParameter(const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0)
Creates a parameter result.
Definition: Model_Document.cpp:1633
virtual MODEL_EXPORT std::shared_ptr< Model_Document > subDoc(int theDocID)
Internal sub-document by ID.
Definition: Model_Document.cpp:1372
virtual MODEL_EXPORT void setCurrentFeature(std::shared_ptr< ModelAPI_Feature > theCurrent, const bool theVisible)
Sets the current feature: all features below will be disabled, new features will be appended after th...
Definition: Model_Document.cpp:1433
std::list< std::string > undoList() const
Returns the list of Ids of the operations that can be undone (called for the root document)
Definition: Model_Document.cpp:1153
virtual MODEL_EXPORT void synchronizeTransactions()
Performs synchronization of transactions with the module document: If some document is not active (by...
Definition: Model_Document.cpp:2078
virtual MODEL_EXPORT void refsToFeature(FeaturePtr theFeature, std::set< FeaturePtr > &theRefs, const bool isSendError=true)
Return a list of features, which refers to the feature.
Definition: Model_Document.cpp:1244
virtual MODEL_EXPORT int size(const std::string &theGroupID, const bool theAllowFolder=false)
Returns the number of features in the group.
Definition: Model_Document.cpp:1398
virtual MODEL_EXPORT void redo()
Redoes last operation.
Definition: Model_Document.cpp:1112
Model_Objects * objects()
Returns the objects manager.
Definition: Model_Document.h:378
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_Object > parent(const std::shared_ptr< ModelAPI_Object > theChild)
Returns the parent object of this child.
Definition: Model_Document.cpp:1405
void operationId(const std::string &theId)
Stores the Id of the current operation (normally is called for the root document)
Definition: Model_Document.cpp:1180
virtual MODEL_EXPORT bool importPart(const char *theFileName, std::list< std::shared_ptr< ModelAPI_Feature > > &theImported, bool theCheckOnly=false)
Loads the OCAF document from the file into the current document.
Definition: Model_Document.cpp:368
virtual MODEL_EXPORT bool canRedo()
Returns True if there are available Redo-s.
Definition: Model_Document.cpp:1096
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_ResultPart > createPart(const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0)
Creates a part results.
Definition: Model_Document.cpp:1608
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_Feature > feature(const std::shared_ptr< ModelAPI_Result > &theResult)
Returns a feature by result (owner of result)
Definition: Model_Document.cpp:1684
virtual bool isActive() const
Returns true if this document is currently active.
Definition: Model_Document.cpp:2037
virtual MODEL_EXPORT bool removeFromFolder(const std::list< std::shared_ptr< ModelAPI_Feature > > &theFeatures, const bool theBefore=true)
Remove features from the folder.
Definition: Model_Document.cpp:1677
virtual MODEL_EXPORT ObjectPtr object(const std::string &theGroupID, const int theIndex, const bool theAllowFolder=false)
Returns the feature in the group by the index (started from zero)
Definition: Model_Document.cpp:1379
bool isRoot() const
Returns true if the document is root module document.
Definition: Model_Document.cpp:156
int numberOfNameInHistory(const ObjectPtr &theNameObject, const TDF_Label &theStartFrom)
Returns the number of the name in the history relatively to the given object (by label).
Definition: Model_Document.cpp:1934
void setThis(DocumentPtr theDoc)
Sets shared pointer to this.
Definition: Model_Document.cpp:137
virtual MODEL_EXPORT void eraseAllFeatures()
Just removes all features without touching the document data (to be able undo)
Definition: Model_Document.cpp:2367
void changeNamingName(std::wstring theOldName, const std::wstring theNewName, const TDF_Label &theLabel)
Updates the name of some object.
Definition: Model_Document.cpp:1746
virtual void storeNodesState(const std::list< bool > &theStates)
Stores in the document boolean flags: states of the nodes in the object browser.
Definition: Model_Document.cpp:2340
virtual MODEL_EXPORT const std::string & kind() const
Returns the kind of the document: "PartSet", "Part", or something else.
Definition: Model_Document.h:50
const std::set< int > subDocuments() const
Returns all loaded sub documents.
Definition: Model_Document.cpp:1357
bool autoRecomutationState() const
Returns the current automatic recomputation flag: true means enabled.
Definition: Model_Document.cpp:2423
virtual MODEL_EXPORT void removeFeature(FeaturePtr theFeature)
Removes the feature from the document (with result) It is necessary to flush REDISPLAY signal manuall...
Definition: Model_Document.cpp:1250
Manager of objects of the document.
Definition: Model_Objects.h:46
The body (shape) result of a feature.
Definition: Model_ResultBody.h:40
The construction element result of a feature.
Definition: Model_ResultConstruction.h:38
The Part document, result of a creation of new part feature.
Definition: Model_ResultPart.h:37
Feature that is used for use selection attribute.
Definition: Model_Document.cpp:2145
Object that knows (from the initial XML file) which plugin contains which feature,...
Definition: Model_Session.h:43
Updates the results of features when it is needed.
Definition: Model_Update.h:40