Salome HOME
Issue #2614: Implement point 2: optimization of selection synchronization
[modules/shaper.git] / src / ModelAPI / ModelAPI_AttributeSelection.h
index 44eace64ffbba7793492591b684aef5ba9d4193e..9829bde7981cc73f8efa15b205a43dd53197a3e3 100644 (file)
@@ -25,6 +25,7 @@
 #include <ModelAPI_Result.h>
 
 class GeomAPI_Edge;
+class GeomAPI_Pnt;
 
 /**\class ModelAPI_AttributeSelection
  * \ingroup DataModel
@@ -47,17 +48,22 @@ class ModelAPI_AttributeSelection : public ModelAPI_Attribute
   /// \param theSubShape selected sub-shape (if null, the whole context is selected)
   /// \param theTemporarily if it is true, do not store and name the added in the data framework
   ///           (used to remove immideately, without the following updates)
-  virtual void setValue(
-    const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
+  /// \returns true if attribute was updated
+  virtual bool setValue(
+    const ObjectPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
     const bool theTemporarily = false) = 0;
 
   /// Same as SetValue, but it takes an edge (on circular or elliptical curve)
   /// and stores the vertex of the central point (for ellipse the first or the second focus point)
   virtual void setValueCenter(
-    const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Edge>& theEdge,
+    const ObjectPtr& theContext, const std::shared_ptr<GeomAPI_Edge>& theEdge,
     const CenterType theCenterType,
     const bool theTemporarily = false) = 0;
 
+  /// Makes this selection attribute selects the same as in theSource selection
+  virtual void selectValue(
+    const std::shared_ptr<ModelAPI_AttributeSelection>& theSource) = 0;
+
   /// Reset temporary stored values
   virtual void removeTemporaryValues() = 0;
 
@@ -67,6 +73,11 @@ class ModelAPI_AttributeSelection : public ModelAPI_Attribute
   /// Returns the context of the selection (the whole shape owner)
   virtual ResultPtr context() = 0;
 
+  /// Returns the context of the selection if the whole feature was selected
+  virtual std::shared_ptr<ModelAPI_Feature> contextFeature() = 0;
+  /// Returns the context of the selection : result or feature
+  virtual std::shared_ptr<ModelAPI_Object> contextObject() = 0;
+
   /// Updates the underlied selection due to the changes in the referenced objects
   /// \returns false if update is failed
   virtual bool update() = 0;
@@ -93,6 +104,10 @@ class ModelAPI_AttributeSelection : public ModelAPI_Attribute
   /// Selects sub-shape by the textual Name
   virtual void selectSubShape(const std::string& theType, const std::string& theSubShapeName) = 0;
 
+  /// Selects sub-shape by its inner point
+  virtual void selectSubShape(const std::string& theType,
+                              const std::shared_ptr<GeomAPI_Pnt>& thePoint) = 0;
+
   /// Returns true if recompute of selection become impossible
   virtual bool isInvalid() = 0;