Salome HOME
80335f2179da458b55c2d71ccc0e915641991187
[modules/shaper.git] / src / ModelAPI / ModelAPI_AttributeSelection.h
1 // File:        ModelAPI_AttributeSelection.h
2 // Created:     2 Oct 2014
3 // Author:      Mikhail PONIKAROV
4
5 #ifndef ModelAPI_AttributeSelection_H_
6 #define ModelAPI_AttributeSelection_H_
7
8 #include "ModelAPI_Attribute.h"
9 #include <ModelAPI_Result.h>
10
11 /**\class ModelAPI_AttributeSelection
12  * \ingroup DataModel
13  * \brief Attribute that contains reference to the sub-shape of some result, the selected shape.
14  */
15
16 class ModelAPI_AttributeSelection : public ModelAPI_Attribute
17 {
18  public:
19   /// Defines the result and its selected sub-shape
20   virtual void setValue(
21     const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape) = 0;
22
23   /// Returns the selected subshape
24   virtual std::shared_ptr<GeomAPI_Shape> value() = 0;
25
26   /// Returns the context of the selection (the whole shape owner)
27   virtual ResultPtr context() = 0;
28
29   /// Updates the underlied selection due to the changes in the referenced objects
30   /// \returns false if update is failed
31   virtual bool update() = 0;
32
33   /// Returns the type of this class of attributes
34   static std::string type()
35   {
36     return "Selection";
37   }
38
39   /// Returns the type of this class of attributes, not static method
40   virtual std::string attributeType()
41   {
42     return type();
43   }
44
45   /// To virtually destroy the fields of successors
46   virtual ~ModelAPI_AttributeSelection()
47   {
48   }
49
50  protected:
51   /// Objects are created for features automatically
52   MODELAPI_EXPORT ModelAPI_AttributeSelection()
53   {
54   }
55 };
56
57 //! Pointer on double attribute
58 typedef std::shared_ptr<ModelAPI_AttributeSelection> AttributeSelectionPtr;
59
60 #endif