]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModelHighAPI/ModelHighAPI_Selection.h
Salome HOME
Debug for deflection dump
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_Selection.h
1 // Name   : ModelHighAPI_Selection.h
2 // Purpose: 
3 //
4 // History:
5 // 06/06/16 - Sergey POKHODENKO - Creation of the file
6
7 #ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_SELECTION_H_
8 #define SRC_MODELHIGHAPI_MODELHIGHAPI_SELECTION_H_
9
10 //--------------------------------------------------------------------------------------
11 #include "ModelHighAPI.h"
12
13 #include <memory>
14 #include <string>
15 #include <utility>
16 //--------------------------------------------------------------------------------------
17 class GeomAPI_Shape;
18 class ModelAPI_AttributeSelection;
19 class ModelAPI_AttributeSelectionList;
20 class ModelAPI_Result;
21 //--------------------------------------------------------------------------------------
22 typedef std::pair<std::shared_ptr<ModelAPI_Result>, std::shared_ptr<GeomAPI_Shape> > ResultSubShapePair;
23 typedef std::pair<std::string, std::string> TypeSubShapeNamePair;
24 //--------------------------------------------------------------------------------------
25 /**\class ModelHighAPI_Selection
26  * \ingroup CPPHighAPI
27  * \brief Class for filling ModelAPI_AttributeSelection
28  */
29 class ModelHighAPI_Selection
30 {
31 public:
32   enum VariantType {
33     VT_Empty,
34     VT_ResultSubShapePair,
35     VT_TypeSubShapeNamePair
36   };
37
38 public:
39   /// Default constructor with empty selection.
40   MODELHIGHAPI_EXPORT
41   ModelHighAPI_Selection();
42
43   /// Constructor for result and sub-shape
44   MODELHIGHAPI_EXPORT
45   ModelHighAPI_Selection(const std::shared_ptr<ModelAPI_Result>& theContext,
46                          const std::shared_ptr<GeomAPI_Shape>& theSubShape = std::shared_ptr<GeomAPI_Shape>());
47   /// Constructor for sub-shape by the textual Name
48   MODELHIGHAPI_EXPORT
49   ModelHighAPI_Selection(const std::string& theType,
50                          const std::string& theSubShapeName);
51   /// Destructor
52   MODELHIGHAPI_EXPORT
53   virtual ~ModelHighAPI_Selection();
54
55   /// Fill attribute values
56   MODELHIGHAPI_EXPORT
57   virtual void fillAttribute(const std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute) const;
58
59   /// Append to list attribute
60   MODELHIGHAPI_EXPORT
61   virtual void appendToList(const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute) const;
62
63   /// \return variant type.
64   MODELHIGHAPI_EXPORT
65   virtual VariantType variantType() const;
66
67   /// \return pair of result and sub-shape.
68   MODELHIGHAPI_EXPORT
69   virtual ResultSubShapePair resultSubShapePair() const;
70
71   /// \return pair of sub-shape type and name.
72   MODELHIGHAPI_EXPORT
73   virtual TypeSubShapeNamePair typeSubShapeNamePair() const;
74
75   /// \return shape type.
76   MODELHIGHAPI_EXPORT
77   virtual std::string shapeType() const;
78
79   /// Shortcut for result()->data()->setName()
80   MODELHIGHAPI_EXPORT
81   void setName(const std::string& theName);
82
83   /// Change result's color
84   MODELHIGHAPI_EXPORT
85   void setColor(int theRed, int theGreen, int theBlue);
86
87   /// Change result's deflection
88   MODELHIGHAPI_EXPORT
89   void setDeflection(double theValue);
90
91 private:
92   VariantType myVariantType;
93   ResultSubShapePair myResultSubShapePair;
94   TypeSubShapeNamePair myTypeSubShapeNamePair;
95 };
96
97 //--------------------------------------------------------------------------------------
98 //--------------------------------------------------------------------------------------
99 #endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_SELECTION_H_ */