Salome HOME
Issue #2660: Update data model before save.
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_Selection.h
index b4fa7d66ba8bbacd1388b8bca867f0da6e60acc0..8612a81256884465f831bd860368418fe0b8c861 100644 (file)
@@ -14,7 +14,8 @@
 // License along with this library; if not, write to the Free Software
 // 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<mailto:webmaster.salome@opencascade.com>
 //
 
 #ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_SELECTION_H_
@@ -27,6 +28,7 @@
 #include <string>
 #include <utility>
 //--------------------------------------------------------------------------------------
+class GeomAPI_Pnt;
 class GeomAPI_Shape;
 class ModelAPI_AttributeSelection;
 class ModelAPI_AttributeSelectionList;
@@ -35,6 +37,8 @@ class ModelAPI_Result;
 typedef std::pair<std::shared_ptr<ModelAPI_Result>, std::shared_ptr<GeomAPI_Shape> >
   ResultSubShapePair;
 typedef std::pair<std::string, std::string> TypeSubShapeNamePair;
+typedef std::pair<std::string, std::shared_ptr<GeomAPI_Pnt> > TypeInnerPointPair;
+typedef std::pair<std::string, std::pair<std::string, int> > TypeWeakNamingPair;
 //--------------------------------------------------------------------------------------
 /**\class ModelHighAPI_Selection
  * \ingroup CPPHighAPI
@@ -46,7 +50,9 @@ public:
   enum VariantType {
     VT_Empty,
     VT_ResultSubShapePair,
-    VT_TypeSubShapeNamePair
+    VT_TypeSubShapeNamePair,
+    VT_TypeInnerPointPair,
+    VT_WeakNamingPair
   };
 
 public:
@@ -63,6 +69,18 @@ public:
   MODELHIGHAPI_EXPORT
   ModelHighAPI_Selection(const std::string& theType,
                          const std::string& theSubShapeName);
+
+  /// Constructor for sub-shape by inner point coordinates
+  MODELHIGHAPI_EXPORT
+  ModelHighAPI_Selection(const std::string& theType,
+                         const std::shared_ptr<GeomAPI_Pnt>& theSubShapeInnerPoint);
+
+
+  /// Constructor for sub-shape by weak naming identifier
+  MODELHIGHAPI_EXPORT
+    ModelHighAPI_Selection(const std::string& theType,
+      const std::string& theContextName, const int theIndex);
+
   /// Destructor
   MODELHIGHAPI_EXPORT
   virtual ~ModelHighAPI_Selection();
@@ -87,6 +105,10 @@ public:
   MODELHIGHAPI_EXPORT
   virtual TypeSubShapeNamePair typeSubShapeNamePair() const;
 
+  /// \return pair of sub-shape type and inner point to identify sub-shape.
+  MODELHIGHAPI_EXPORT
+  virtual TypeInnerPointPair typeInnerPointPair() const;
+
   /// \return shape type.
   MODELHIGHAPI_EXPORT
   virtual std::string shapeType() const;
@@ -95,6 +117,10 @@ public:
   MODELHIGHAPI_EXPORT
   void setName(const std::string& theName);
 
+  /// Shortcut for result()->data()->name()
+  MODELHIGHAPI_EXPORT
+  std::string name() const;
+
   /// Change result's color
   MODELHIGHAPI_EXPORT
   void setColor(int theRed, int theGreen, int theBlue);
@@ -103,6 +129,10 @@ public:
   MODELHIGHAPI_EXPORT
   void setDeflection(double theValue);
 
+  /// Change result's transparency
+  MODELHIGHAPI_EXPORT
+  void setTransparency(double theValue);
+
   /// Returns the number of sub-elements.
   MODELHIGHAPI_EXPORT
   int numberOfSubs() const;
@@ -115,6 +145,8 @@ private:
   VariantType myVariantType;
   ResultSubShapePair myResultSubShapePair;
   TypeSubShapeNamePair myTypeSubShapeNamePair;
+  TypeInnerPointPair myTypeInnerPointPair;
+  TypeWeakNamingPair myWeakNamingPair;
 };
 
 //--------------------------------------------------------------------------------------