]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/Model/Model_AttributeSelection.h
Salome HOME
Merge branch 'V9_5_BR'
[modules/shaper.git] / src / Model / Model_AttributeSelection.h
index 98e35767e845f19293df3fdeed2feeb15578e360..ab7f06cf4a7ab1a2e399df573c84b3a7d215421c 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_AttributeSelection_H_
@@ -41,7 +40,7 @@ class Model_AttributeSelection : public ModelAPI_AttributeSelection,
 {
   Model_AttributeReference myRef;  ///< The reference functionality re-usage
   /// temporarily storages to avoid keeping in the data structure if not needed
-  ResultPtr myTmpContext;
+  ObjectPtr myTmpContext;
   /// temporarily storages to avoid keeping in the data structure if not needed
   std::shared_ptr<GeomAPI_Shape> myTmpSubShape;
   /// temporarily storages to avoid keeping in the data structure if not needed
@@ -49,7 +48,11 @@ class Model_AttributeSelection : public ModelAPI_AttributeSelection,
   /// Reference to the parent attribute, if any (to split selection compounds in issue 1799)
   Model_AttributeSelectionList* myParent;
 
-  std::shared_ptr<Model_Document> myRestoreDocument; // current document to restore by name
+  /// current document to restore by name
+  std::shared_ptr<Model_Document> myRestoreDocument;
+  /// If true attribute selects geometry instead of shape.
+  bool myIsGeometricalSelection;
+
 public:
   /// Defines the result and its selected sub-shape
   /// \param theContext object where the sub-shape was selected
@@ -61,7 +64,7 @@ public:
     const ObjectPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
     const bool theTemporarily = false);
 
-  /// Same as SetValue, but it takes an edge (on circular or elliptical curve)
+  /// Same as SetValue, but it takes an edge (on circular or elliptic curve)
   /// and stores the vertex of the central point (for ellipse the first or the second focus point)
   MODEL_EXPORT virtual void setValueCenter(
     const ObjectPtr& theContext, const std::shared_ptr<GeomAPI_Edge>& theEdge,
@@ -97,14 +100,7 @@ public:
   /// \param theDefaultValue a name, which is returned if the naming name can not be obtained
   MODEL_EXPORT virtual std::string namingName(const std::string& theDefaultValue = "");
 
-  /// Returns an Id of the selection
-  /// NOTE: This method has been added for temporary export of groups towards old GEOM
-  /// It should then be removed when a direct use of objects from SHAPER
-  /// will be possible from SMESH module of SALOME.
-  MODEL_EXPORT virtual int Id();
-
   /// Defines the sub-shape by Id
-  /// NOTE: This method is opposite to Id() method.
   MODEL_EXPORT virtual void setId(int theID);
 
   /// Selects (i.e. creates Naming data structure) of sub-shape specified by textual name
@@ -126,7 +122,8 @@ public:
 
   /// Updates the arguments of selection if something was affected by creation
   /// or reorder of features upper in the history line (issue #1757)
-  MODEL_EXPORT virtual void updateInHistory();
+  /// Returns theRemove true if this attribute must be removed (become deleted)
+  MODEL_EXPORT virtual void updateInHistory(bool& theRemove) override;
 
   // Implementation of the name generator method from the Selector package
   // This method returns the context name by the label of the sub-selected shape
@@ -137,9 +134,6 @@ public:
   MODEL_EXPORT virtual bool restoreContext(std::string theName,
     TDF_Label& theContext, TDF_Label& theValue) override;
 
-  /// Returns the label of the newest context presented by the current one
-  MODEL_EXPORT virtual TDF_Label newestContext(const TDF_Label theCurrentContext) override;
-
   /// Returns true if the first result is newer than the second one in the tree of features
   MODEL_EXPORT virtual bool isLater(const TDF_Label theResult1, const TDF_Label theResult2)
     const override;
@@ -147,6 +141,12 @@ public:
   /// Returns the name by context. Adds the part name if the context is located in other document
   MODEL_EXPORT virtual std::string contextName(const ResultPtr& theContext) const;
 
+  /// Makes the current local selection becomes all sub-shapes with same base geometry.
+  MODEL_EXPORT virtual void combineGeometrical();
+
+  /// Resets attribute to deafult state
+  MODEL_EXPORT virtual void reset();
+
 protected:
   /// Objects are created for features automatically
   MODEL_EXPORT Model_AttributeSelection(TDF_Label& theLabel);
@@ -189,14 +189,30 @@ protected:
                         std::list<ResultPtr>& theResults, TopTools_ListOfShape& theValShapes);
 
   /// Searches for the newest context, modification of the current, that contains theValue
-  ResultPtr newestContext(const ResultPtr theCurrent,
-    const std::shared_ptr<GeomAPI_Shape> theValue, const bool theAnyValue = false);
+  ResultPtr newestContext(
+    const ResultPtr theCurrent, const std::shared_ptr<GeomAPI_Shape> theValue);
 
   /// computes theShapes list - shapes that were generated/modified/deleted the theValShape
   /// during creation from new to old context
   void computeValues(ResultPtr theOldContext, ResultPtr theNewContext, TopoDS_Shape theValShape,
     TopTools_ListOfShape& theShapes);
 
+  /// Returns true if is geometrical selection.
+  virtual bool isGeometricalSelection() const {
+    return myIsGeometricalSelection;
+  };
+
+  /// Returns the module document label if this selection attribute is not in this document.
+  /// Returns null label otherwise.
+  TDF_Label baseDocumentLab();
+
+  /// Returns features that conceals theFeature and located in history before theStop
+  /// theResultOfFeature if not null defines exact referenced result of a feature
+  void concealedFeature(
+    const FeaturePtr theFeature, const FeaturePtr theStop, const bool theCheckCopy,
+    std::list<FeaturePtr>& theConcealers, const ResultPtr theResultOfFeature,
+    const bool theCheckWholeFeature = false);
+
   friend class Model_Data;
   friend class Model_AttributeSelectionList;
 };