Salome HOME
Fix for the issue #2808 : Documentation on the "Groups" panel. Added description...
[modules/shaper.git] / src / ModelAPI / ModelAPI_AttributeSelection.h
index 904711ea2776363b14e1921203f8e0e2ebabce7b..d2dec5bc49e02e0e4b0ceb595b33acd1c849f9f6 100644 (file)
@@ -25,6 +25,7 @@
 #include <ModelAPI_Result.h>
 
 class GeomAPI_Edge;
+class GeomAPI_Pnt;
 
 /**\class ModelAPI_AttributeSelection
  * \ingroup DataModel
@@ -46,16 +47,16 @@ class ModelAPI_AttributeSelection : public ModelAPI_Attribute
   /// \param theContext object where the sub-shape was selected
   /// \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)
+  ///           (used to remove immediately, without the following updates)
   /// \returns true if attribute was updated
   virtual bool setValue(
-    const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
+    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;
 
@@ -72,7 +73,12 @@ class ModelAPI_AttributeSelection : public ModelAPI_Attribute
   /// Returns the context of the selection (the whole shape owner)
   virtual ResultPtr context() = 0;
 
-  /// Updates the underlied selection due to the changes in the referenced objects
+  /// 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 selection due to the changes in the referenced objects
   /// \returns false if update is failed
   virtual bool update() = 0;
 
@@ -98,12 +104,29 @@ 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;
+
+  /// Selects sub-shape by weak naming index
+  virtual void selectSubShape(const std::string& theType,
+    const std::string& theContextName, const int theIndex) = 0;
+
   /// Returns true if recompute of selection become impossible
   virtual bool isInvalid() = 0;
 
+  /// Returns true if is geometrical selection.
+  virtual bool isGeometricalSelection() const = 0;
+
   /// To virtually destroy the fields of successors
   MODELAPI_EXPORT virtual ~ModelAPI_AttributeSelection();
 
+  /// Returns the name by context. Adds the part name if the context is located in other document
+  MODELAPI_EXPORT virtual std::string contextName(const ResultPtr& theContext) const = 0;
+
+  /// Makes the current local selection becomes all sub-shapes with same base geometry.
+  MODELAPI_EXPORT virtual void combineGeometrical() = 0;
+
  protected:
   /// Objects are created for features automatically
   MODELAPI_EXPORT ModelAPI_AttributeSelection();