Salome HOME
Remove extra code
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_Selection.h
index 36706aacbc612956fff2a30723a0310a2344d6e6..db78cb69ee7c3911d1b2ca6cd3bc0e19a7397c46 100644 (file)
@@ -1,5 +1,6 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
 // Name   : ModelHighAPI_Selection.h
-// Purpose: 
+// Purpose:
 //
 // History:
 // 06/06/16 - Sergey POKHODENKO - Creation of the file
 #include <memory>
 #include <string>
 #include <utility>
-
-#include <boost/variant.hpp>
 //--------------------------------------------------------------------------------------
 class GeomAPI_Shape;
 class ModelAPI_AttributeSelection;
 class ModelAPI_AttributeSelectionList;
 class ModelAPI_Result;
 //--------------------------------------------------------------------------------------
-typedef std::pair<std::shared_ptr<ModelAPI_Result>, std::shared_ptr<GeomAPI_Shape> > ResultSubShapePair;
+typedef std::pair<std::shared_ptr<ModelAPI_Result>, std::shared_ptr<GeomAPI_Shape> >
+  ResultSubShapePair;
 typedef std::pair<std::string, std::string> TypeSubShapeNamePair;
 //--------------------------------------------------------------------------------------
 /**\class ModelHighAPI_Selection
@@ -31,10 +31,22 @@ typedef std::pair<std::string, std::string> TypeSubShapeNamePair;
 class ModelHighAPI_Selection
 {
 public:
+  enum VariantType {
+    VT_Empty,
+    VT_ResultSubShapePair,
+    VT_TypeSubShapeNamePair
+  };
+
+public:
+  /// Default constructor with empty selection.
+  MODELHIGHAPI_EXPORT
+  ModelHighAPI_Selection();
+
   /// Constructor for result and sub-shape
   MODELHIGHAPI_EXPORT
-  ModelHighAPI_Selection(const std::shared_ptr<ModelAPI_Result>& theContext = std::shared_ptr<ModelAPI_Result>(),
-                         const std::shared_ptr<GeomAPI_Shape>& theSubShape = std::shared_ptr<GeomAPI_Shape>());
+  ModelHighAPI_Selection(const std::shared_ptr<ModelAPI_Result>& theContext,
+                         const std::shared_ptr<GeomAPI_Shape>& theSubShape =
+                         std::shared_ptr<GeomAPI_Shape>());
   /// Constructor for sub-shape by the textual Name
   MODELHIGHAPI_EXPORT
   ModelHighAPI_Selection(const std::string& theType,
@@ -44,15 +56,45 @@ public:
   virtual ~ModelHighAPI_Selection();
 
   /// Fill attribute values
-  MODELHIGHAPI_EXPORT
-  virtual void fillAttribute(const std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute) const;
+  MODELHIGHAPI_EXPORT virtual
+    void fillAttribute(const std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute) const;
 
   /// Append to list attribute
+  MODELHIGHAPI_EXPORT virtual
+    void appendToList(const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute) const;
+
+  /// \return variant type.
+  MODELHIGHAPI_EXPORT
+  virtual VariantType variantType() const;
+
+  /// \return pair of result and sub-shape.
+  MODELHIGHAPI_EXPORT
+  virtual ResultSubShapePair resultSubShapePair() const;
+
+  /// \return pair of sub-shape type and name.
+  MODELHIGHAPI_EXPORT
+  virtual TypeSubShapeNamePair typeSubShapeNamePair() const;
+
+  /// \return shape type.
+  MODELHIGHAPI_EXPORT
+  virtual std::string shapeType() const;
+
+  /// Shortcut for result()->data()->setName()
+  MODELHIGHAPI_EXPORT
+  void setName(const std::string& theName);
+
+  /// Change result's color
+  MODELHIGHAPI_EXPORT
+  void setColor(int theRed, int theGreen, int theBlue);
+
+  /// Change result's deflection
   MODELHIGHAPI_EXPORT
-  virtual void appendToList(const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute) const;
+  void setDeflection(double theValue);
 
 private:
-  boost::variant<ResultSubShapePair, TypeSubShapeNamePair> myValue;
+  VariantType myVariantType;
+  ResultSubShapePair myResultSubShapePair;
+  TypeSubShapeNamePair myTypeSubShapeNamePair;
 };
 
 //--------------------------------------------------------------------------------------