Salome HOME
bos #26374 Merge branch 'CR26374'
[modules/shaper.git] / src / Model / Model_AttributeSelection.h
index 1896caa017f435687409907b388f0ac42a6c2d06..905c4d163671849a873695fcce62cdf42dbe835f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2021  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
@@ -40,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
@@ -48,7 +48,8 @@ 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;
 
@@ -63,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,21 +98,21 @@ public:
 
   /// Returns a textual string of the selection
   /// \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 = "");
+  MODEL_EXPORT virtual std::wstring namingName(const std::wstring& theDefaultValue = L"");
 
   /// Defines the sub-shape by Id
   MODEL_EXPORT virtual void setId(int theID);
 
   /// Selects (i.e. creates Naming data structure) of sub-shape specified by textual name
   MODEL_EXPORT virtual void selectSubShape(const std::string& theType,
-                                           const std::string& theSubShapeName);
+                                           const std::wstring& theSubShapeName);
 
   /// Selects sub-shape by its inner point
   MODEL_EXPORT virtual void selectSubShape(const std::string& theType,
                                            const std::shared_ptr<GeomAPI_Pnt>& thePoint);
   /// Selects sub-shape by weak naming index
   MODEL_EXPORT virtual void selectSubShape(const std::string& theType,
-    const std::string& theContextName, const int theIndex);
+    const std::wstring& theContextName, const int theIndex);
 
   /// Returns true if attribute was  initialized by some value
   MODEL_EXPORT virtual bool isInitialized();
@@ -122,15 +123,15 @@ public:
   /// Updates the arguments of selection if something was affected by creation
   /// or reorder of features upper in the history line (issue #1757)
   /// Returns theRemove true if this attribute must be removed (become deleted)
-  MODEL_EXPORT virtual void updateInHistory(bool& theRemove);
+  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
-  MODEL_EXPORT virtual std::string contextName(const TDF_Label theSelectionLab) override;
+  MODEL_EXPORT virtual std::wstring contextName(const TDF_Label theSelectionLab) override;
 
   /// This method restores by the context and value name the context label and
   /// sub-label where the value is. Returns true if it is valid.
-  MODEL_EXPORT virtual bool restoreContext(std::string theName,
+  MODEL_EXPORT virtual bool restoreContext(std::wstring theName,
     TDF_Label& theContext, TDF_Label& theValue) override;
 
   /// Returns true if the first result is newer than the second one in the tree of features
@@ -138,11 +139,14 @@ public:
     const override;
 
   /// 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;
+  MODEL_EXPORT virtual std::wstring 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);
@@ -202,6 +206,13 @@ protected:
   /// 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;
 };