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