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