Salome HOME
Copyright update 2020
[modules/shaper.git] / src / Model / Model_Document.h
index f4c6233d1c72cd18e37a588fda9c798295f3d6fe..f2acb48a68a1719898e44a765c86726a48a78808 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2020  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #ifndef Model_Document_H_
@@ -57,6 +56,17 @@ class Model_Document : public ModelAPI_Document
   MODEL_EXPORT virtual bool load(
     const char* theDirName, const char* theFileName, DocumentPtr theThis);
 
+  //! Loads the OCAF document from the file into the current document.
+  //! All the features are added after the active feature.
+  //! \param theFileName name of the file to import
+  //! \param theImported list of features imported from the file
+  //! \param theCheckOnly verify the document does not contain unappropriate features
+  //!                     (useful for import to PartSet), but do not import it
+  //! \returns true if file was loaded successfully
+  MODEL_EXPORT virtual bool importPart(const char* theFileName,
+                                   std::list<std::shared_ptr<ModelAPI_Feature> >& theImported,
+                                   bool theCheckOnly = false);
+
   //! Saves the OCAF document to the file.
   //! \param theDirName directory where the document will be saved
   //! \param theFileName a name of the document file to store
@@ -65,6 +75,12 @@ class Model_Document : public ModelAPI_Document
   MODEL_EXPORT virtual bool save(
     const char* theDirName, const char* theFileName, std::list<std::string>& theResults);
 
+  //! Export the list of features to the file
+  //! \param theFilename path to save the file
+  //! \param theExportFeatures list of features to export
+  MODEL_EXPORT virtual bool save(const char* theFilename,
+    const std::list<std::shared_ptr<ModelAPI_Feature> >& theExportFeatures) const;
+
   //! Removes document data
   //! \param theForever if it is false, document is just hidden
   //!                   (to keep possibility make it back on Undo/Redo)
@@ -111,7 +127,8 @@ class Model_Document : public ModelAPI_Document
   MODEL_EXPORT virtual void removeFeature(FeaturePtr theFeature);
 
   //! Moves the feature to make it after the given one in the history.
-  MODEL_EXPORT virtual void moveFeature(FeaturePtr theMoved, FeaturePtr theAfterThis);
+  MODEL_EXPORT virtual void moveFeature(
+    FeaturePtr theMoved, FeaturePtr theAfterThis, const bool theSplit = false);
 
   //! Returns the first found object in the group by the object name
   //! \param theGroupID group that contains an object
@@ -180,10 +197,6 @@ class Model_Document : public ModelAPI_Document
   //! without this participation
   MODEL_EXPORT virtual void synchronizeTransactions();
 
-  //! Returns feature by the id of the feature (produced by the Data "featureId" method)
-  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> featureById(const int theId);
-
-
   /// Creates construction results
   MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultConstruction> createConstruction(
       const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
@@ -285,8 +298,6 @@ class Model_Document : public ModelAPI_Document
   MODEL_EXPORT virtual int transactionID();
   /// Increases the transaction ID
   MODEL_EXPORT virtual void incrementTransactionID();
-  /// Decreases the transaction ID
-  MODEL_EXPORT virtual void decrementTransactionID();
 
   /// Returns true if document is opened and valid
   MODEL_EXPORT virtual bool isOpened();
@@ -306,6 +317,11 @@ class Model_Document : public ModelAPI_Document
   /// Just removes all features without touching the document data (to be able undo)
   MODEL_EXPORT virtual void eraseAllFeatures();
 
+  /// Returns the next (from the history point of view) feature, any: invisible or disabled
+  /// \param theCurrent previous to the resulting feature
+  /// \param theReverse if it is true, iterates in reversed order (next becomes previous)
+  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> nextFeature(
+    std::shared_ptr<ModelAPI_Feature> theCurrent, const bool theReverse = false) const;
 
  protected:
   //! Returns (creates if needed) the general label
@@ -397,6 +413,7 @@ class Model_Document : public ModelAPI_Document
   friend class Model_AttributeRefList;
   friend class Model_AttributeRefAttrList;
   friend class Model_AttributeSelection;
+  friend class Model_AttributeSelectionList;
   friend class Model_ResultPart;
   friend class Model_ResultBody;
   friend class Model_ResultConstruction;