SHAPER  9.12.0
1 // Copyright (C) 2014-2023 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
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 or email :
18 //
20 #ifndef Model_Document_H_
21 #define Model_Document_H_
23 #include <Model.h>
24 #include <ModelAPI_Document.h>
25 #include <ModelAPI_Feature.h>
26 #include <ModelAPI_Result.h>
27 #include <ModelAPI_ResultParameter.h>
29 #include <TDocStd_Document.hxx>
30 #include <map>
31 #include <set>
33 class Handle_Model_Document;
34 class Model_Objects;
44 {
45  public:
49  MODEL_EXPORT virtual const std::string& kind() const {return myKind;}
56  MODEL_EXPORT virtual bool load(
57  const char* theDirName, const char* theFileName, DocumentPtr theThis);
66  MODEL_EXPORT virtual bool importPart(const char* theFileName,
67  std::list<std::shared_ptr<ModelAPI_Feature> >& theImported,
68  bool theCheckOnly = false);
75  MODEL_EXPORT virtual bool save(
76  const char* theDirName, const char* theFileName, std::list<std::string>& theResults);
81  MODEL_EXPORT virtual bool save(const char* theFilename,
82  const std::list<std::shared_ptr<ModelAPI_Feature> >& theExportFeatures) const;
87  MODEL_EXPORT virtual void close(const bool theForever = false);
90  MODEL_EXPORT virtual void startOperation();
93  MODEL_EXPORT virtual bool finishOperation();
95  MODEL_EXPORT virtual void abortOperation();
97  MODEL_EXPORT virtual bool isOperation() const;
99  MODEL_EXPORT virtual bool isModified();
102  MODEL_EXPORT virtual bool canUndo();
104  MODEL_EXPORT virtual void undo();
106  MODEL_EXPORT virtual bool canRedo();
108  MODEL_EXPORT virtual void redo();
110  MODEL_EXPORT virtual void clearUndoRedo();
115  MODEL_EXPORT virtual FeaturePtr addFeature(std::string theID, const bool theMakeCurrent = true);
121  MODEL_EXPORT virtual void refsToFeature(FeaturePtr theFeature,
122  std::set<FeaturePtr>& theRefs,
123  const bool isSendError = true);
129  MODEL_EXPORT virtual void removeFeature(FeaturePtr theFeature);
132  MODEL_EXPORT virtual void moveFeature(
133  FeaturePtr theMoved, FeaturePtr theAfterThis, const bool theSplit = false);
139  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Object> objectByName(
140  const std::string& theGroupID, const std::wstring& theName);
146  MODEL_EXPORT virtual const int index(std::shared_ptr<ModelAPI_Object> theObject,
147  const bool theAllowFolder = false);
150  MODEL_EXPORT virtual std::shared_ptr<Model_Document> subDoc(int theDocID);
153  MODEL_EXPORT virtual const int id() const
154  {
155  return myID;
156  }
162  MODEL_EXPORT virtual ObjectPtr object(const std::string& theGroupID,
163  const int theIndex,
164  const bool theAllowFolder = false);
169  MODEL_EXPORT virtual int size(const std::string& theGroupID, const bool theAllowFolder = false);
173  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Object> parent(
174  const std::shared_ptr<ModelAPI_Object> theChild);
180  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> currentFeature(const bool theVisible);
186  MODEL_EXPORT virtual void setCurrentFeature(std::shared_ptr<ModelAPI_Feature> theCurrent,
187  const bool theVisible);
190  MODEL_EXPORT virtual void setCurrentFeatureUp();
193  MODEL_EXPORT virtual int numInternalFeatures();
195  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> internalFeature(const int theIndex);
200  MODEL_EXPORT virtual void synchronizeTransactions();
203  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultConstruction> createConstruction(
204  const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
206  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultBody> createBody(
207  const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
209  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultPart> createPart(
210  const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
212  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultPart> copyPart(
213  const std::shared_ptr<ModelAPI_ResultPart>& theOrigin,
214  const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
216  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultGroup> createGroup(
217  const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
219  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultField> createField(
220  const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
222  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultParameter> createParameter(
223  const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
226  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature>
227  feature(const std::shared_ptr<ModelAPI_Result>& theResult);
232  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Folder> addFolder(
233  std::shared_ptr<ModelAPI_Feature> theAddBefore = std::shared_ptr<ModelAPI_Feature>());
235  MODEL_EXPORT virtual void removeFolder(std::shared_ptr<ModelAPI_Folder> theFolder);
239  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Folder> findFolderAbove(
240  const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures);
244  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Folder> findFolderBelow(
245  const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures);
251  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Folder> findContainingFolder(
252  const std::shared_ptr<ModelAPI_Feature>& theFeature,
253  int& theIndexInFolder);
257  MODEL_EXPORT virtual bool moveToFolder(
258  const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures,
259  const std::shared_ptr<ModelAPI_Folder>& theFolder);
266  MODEL_EXPORT virtual bool removeFromFolder(
267  const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures,
268  const bool theBefore = true);
272  bool executeFeatures() {return myExecuteFeatures;}
275  void setExecuteFeatures(const bool theFlag);
278  void addNamingName(const TDF_Label theLabel, std::wstring theName);
280  void changeNamingName(std::wstring theOldName, const std::wstring theNewName,
281  const TDF_Label& theLabel);
283  TDF_Label findNamingName(std::wstring theName, ResultPtr theContext);
286  int numberOfNameInHistory(const ObjectPtr& theNameObject, const TDF_Label& theStartFrom);
289  ResultPtr findByName(std::wstring& theName,
290  std::wstring& theSubShapeName,
291  bool& theUniqueContext);
295  MODEL_EXPORT virtual std::list<std::shared_ptr<ModelAPI_Feature> > allFeatures();
299  MODEL_EXPORT virtual std::list<std::shared_ptr<ModelAPI_Object> > allObjects();
302  MODEL_EXPORT virtual int transactionID();
304  MODEL_EXPORT virtual void incrementTransactionID();
307  MODEL_EXPORT virtual bool isOpened();
311  FeaturePtr lastFeature();
314  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> producedByFeature(
315  std::shared_ptr<ModelAPI_Result> theResult,
316  const std::shared_ptr<GeomAPI_Shape>& theShape);
319  MODEL_EXPORT virtual bool isLater(FeaturePtr theLater, FeaturePtr theCurrent) const;
322  MODEL_EXPORT virtual void eraseAllFeatures();
327  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> nextFeature(
328  std::shared_ptr<ModelAPI_Feature> theCurrent, const bool theReverse = false) const;
331  ~Model_Document();
333  protected:
335  TDF_Label generalLabel() const;
338  Model_Document(const int theID, const std::string theKind);
341  Handle_TDocStd_Document document()
342  {
343  return myDoc;
344  }
348  void compactNested();
351  const std::set<int> subDocuments() const;
354  void undoInternal(const bool theWithSubs, const bool theSynchronize);
357  void operationId(const std::string& theId);
360  std::list<std::string> undoList() const;
363  std::list<std::string> redoList() const;
366  virtual void updateHistory(const std::shared_ptr<ModelAPI_Object> theObject);
368  virtual void updateHistory(const std::string theGroup);
371  bool isRoot() const;
374  void setThis(DocumentPtr theDoc);
377  Model_Objects* objects() {return myObjs;}
380  virtual void setActive(const bool theFlag);
382  virtual bool isActive() const;
386  std::shared_ptr<ModelAPI_AttributeSelectionList> selectionInPartFeature();
390  virtual void storeNodesState(const std::list<bool>& theStates);
394  virtual void restoreNodesState(std::list<bool>& theStates) const;
397  TDF_Label extConstructionsLabel() const;
400  FeaturePtr featureByLab(const TDF_Label& theLab);
402  ResultPtr resultByLab(const TDF_Label& theLab);
405  bool isLaterByDep(FeaturePtr theThis, FeaturePtr theOther);
411  void setAutoRecomutationState(const bool theState);
413  bool autoRecomutationState() const;
415  friend class Model_Application;
416  friend class Model_Session;
417  friend class Model_Update;
418  friend class Model_AttributeReference;
419  friend class Model_AttributeRefAttr;
420  friend class Model_AttributeRefList;
421  friend class Model_AttributeRefAttrList;
422  friend class Model_AttributeSelection;
423  friend class Model_AttributeSelectionList;
424  friend class Model_ResultPart;
425  friend class Model_ResultBody;
426  friend class Model_ResultConstruction;
427  friend class Model_SelectionNaming;
428  friend class Model_BodyBuilder;
429  friend class DFBrowser;
431  private:
432  int myID;
433  std::string myKind;
434  Handle_TDocStd_Document myDoc;
436  Model_Objects *myObjs;
439  int myTransactionSave;
442  std::list<int> myNestedNum;
445  struct Transaction {
446  int myOCAFNum;
447  std::string myId;
449  Transaction(): myOCAFNum(0), myId("") {}
450  };
454  std::list<Transaction> myTransactions;
456  std::list<Transaction> myRedos;
460  std::map<std::wstring, std::list<TDF_Label> > myNamingNames;
462  bool myExecuteFeatures;
464  bool myIsActive;
467  FeaturePtr mySelectionFeature;
469  bool myIsSetCurrentFeature;
470 };
472 #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:52
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:44
virtual MODEL_EXPORT void startOperation()
Starts a new operation (opens a transaction)
Definition: Model_Document.cpp:647
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:2160
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:1953
bool isLaterByDep(FeaturePtr theThis, FeaturePtr theOther)
returns true if theThis is later in the features tree and dependencies than theOther
Definition: Model_Document.cpp:1877
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:1624
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:1392
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:2052
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:1642
virtual MODEL_EXPORT bool load(const char *theDirName, const char *theFileName, DocumentPtr theThis)
Loads the OCAF document from the file.
Definition: Model_Document.cpp:312
virtual MODEL_EXPORT int numInternalFeatures()
Returns the number of all features: in the history or not.
Definition: Model_Document.cpp:2047
virtual MODEL_EXPORT void setCurrentFeatureUp()
Makes the current feature one feature upper.
Definition: Model_Document.cpp:1549
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:1365
void appendTransactionToPrevious()
appends the latest transaction to the previous one (used for AutoUpdate enabling transaction)
Definition: Model_Document.cpp:2333
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:1606
virtual MODEL_EXPORT void incrementTransactionID()
Increases the transaction ID.
Definition: Model_Document.cpp:2031
virtual MODEL_EXPORT const int id() const
! Returns the id of the document
Definition: Model_Document.h:153
void setAutoRecomutationState(const bool theState)
Sets the automatic recomputation flag: true means enabled.
Definition: Model_Document.cpp:2352
virtual MODEL_EXPORT void close(const bool theForever=false)
Removes document data.
Definition: Model_Document.cpp:607
virtual MODEL_EXPORT bool isOperation() const
Returns true if operation has been started, but not yet finished or aborted.
Definition: Model_Document.cpp:1003
TDF_Label extConstructionsLabel() const
Label that contains structures for selection of constructions of another document.
Definition: Model_Document.cpp:2037
Handle_TDocStd_Document document()
Returns the internal OCCT document of this interface.
Definition: Model_Document.h:341
virtual MODEL_EXPORT bool finishOperation()
Finishes the previously started operation (closes the transaction)
Definition: Model_Document.cpp:810
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:1630
bool executeFeatures()
! Returns true if parametric updater need to execute feature on recomputation On abort,...
Definition: Model_Document.h:272
virtual MODEL_EXPORT bool isOpened()
Returns true if document is opened and valid.
Definition: Model_Document.cpp:2042
virtual void setActive(const bool theFlag)
! Informs the document that it becomes active and some actions must be performed
Definition: Model_Document.cpp:1993
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:1618
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:1649
virtual MODEL_EXPORT void undo()
Undoes last operation.
Definition: Model_Document.cpp:1087
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:2271
ResultPtr resultByLab(const TDF_Label &theLab)
searches in this document result that contains this label
Definition: Model_Document.cpp:1678
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:1636
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:2098
virtual MODEL_EXPORT bool isModified()
Returns true if document was modified (since creation/opening)
Definition: Model_Document.cpp:1009
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:1983
Erases the document structure.
Definition: Model_Document.cpp:127
virtual MODEL_EXPORT const int index(std::shared_ptr< ModelAPI_Object > theObject, const bool theAllowFolder=false)
Returns the object index in the group.
Definition: Model_Document.cpp:1371
virtual MODEL_EXPORT bool canUndo()
Returns True if there are available Undo-s.
Definition: Model_Document.cpp:1015
TDF_Label generalLabel() const
Returns (creates if needed) the general label.
Definition: Model_Document.cpp:1570
virtual void restoreNodesState(std::list< bool > &theStates) const
Returns the stored nodes states.
Definition: Model_Document.cpp:2292
TDF_Label findNamingName(std::wstring theName, ResultPtr theContext)
Returns the label, keeper of the name for the topological naming needs.
Definition: Model_Document.cpp:1803
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:1581
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:1165
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:1593
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:1181
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:1575
virtual MODEL_EXPORT void clearUndoRedo()
Clears undo/redo lists.
Definition: Model_Document.cpp:1133
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:1988
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:1038
Model_Document(const int theID, const std::string theKind)
Creates new document with binary file format.
Definition: Model_Document.cpp:107
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:1324
void compactNested()
performs compactification of all nested operations into one
Definition: Model_Document.cpp:672
virtual MODEL_EXPORT void abortOperation()
Aborts the operation.
Definition: Model_Document.cpp:958
void addNamingName(const TDF_Label theLabel, std::wstring theName)
Registers the name of the shape for the topological naming needs.
Definition: Model_Document.cpp:1691
virtual MODEL_EXPORT int transactionID()
Returns the global identifier of the current transaction (needed for the update algo)
Definition: Model_Document.cpp:2021
void setExecuteFeatures(const bool theFlag)
! On abort, undo or redo it is not necessary: results in document are updated automatically
Definition: Model_Document.cpp:2321
FeaturePtr featureByLab(const TDF_Label &theLab)
searches in this document feature that contains this label
Definition: Model_Document.cpp:1671
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:1278
FeaturePtr lastFeature()
Returns the last feature in the document (even not visible or disabled)
Definition: Model_Document.cpp:2122
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:2311
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:1600
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:1612
virtual MODEL_EXPORT std::shared_ptr< Model_Document > subDoc(int theDocID)
Internal sub-document by ID.
Definition: Model_Document.cpp:1351
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:1412
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:1149
virtual MODEL_EXPORT void synchronizeTransactions()
Performs synchronization of transactions with the module document: If some document is not active (by...
Definition: Model_Document.cpp:2057
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:1240
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:1377
virtual MODEL_EXPORT bool save(const char *theDirName, const char *theFileName, std::list< std::string > &theResults)
Saves the OCAF document to the file.
Definition: Model_Document.cpp:487
virtual MODEL_EXPORT void redo()
Redoes last operation.
Definition: Model_Document.cpp:1108
Model_Objects * objects()
Returns the objects manager.
Definition: Model_Document.h:377
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:1384
void operationId(const std::string &theId)
Stores the Id of the current operation (normally is called for the root document)
Definition: Model_Document.cpp:1176
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:367
virtual MODEL_EXPORT bool canRedo()
Returns True if there are available Redo-s.
Definition: Model_Document.cpp:1092
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:1587
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:1663
virtual bool isActive() const
Returns true if this document is currently active.
Definition: Model_Document.cpp:2016
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:1656
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:1358
bool isRoot() const
Returns true if the document is root module document.
Definition: Model_Document.cpp:155
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:1913
void setThis(DocumentPtr theDoc)
Sets shared pointer to this.
Definition: Model_Document.cpp:136
virtual MODEL_EXPORT void eraseAllFeatures()
Just removes all features without touching the document data (to be able undo)
Definition: Model_Document.cpp:2305
void changeNamingName(std::wstring theOldName, const std::wstring theNewName, const TDF_Label &theLabel)
Updates the name of some object.
Definition: Model_Document.cpp:1725
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:2278
virtual MODEL_EXPORT const std::string & kind() const
Returns the kind of the document: "PartSet", "Part", or something else.
Definition: Model_Document.h:49
const std::set< int > subDocuments() const
Returns all loaded sub documents.
Definition: Model_Document.cpp:1336
bool autoRecomutationState() const
Returns the current automatic recomputation flag: true means enabled.
Definition: Model_Document.cpp:2361
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:1246
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:36
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