Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
[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 typeId()
37   {
38     return "Selection";
39   }
40
41   /// Returns the type of this class of attributes, not static method
42   MODELAPI_EXPORT virtual std::string attributeType();
43
44   /// Returns a textual string of the selection
45   virtual std::string namingName() = 0;
46   
47   /// Returns an id of the selection
48   virtual int Id() = 0;
49
50
51   /// Selects sub-shape by the textual Name
52   virtual void selectSubShape(const std::string& theType, const std::string& theSubShapeName) = 0;
53
54   /// To virtually destroy the fields of successors
55   MODELAPI_EXPORT virtual ~ModelAPI_AttributeSelection();
56
57  protected:
58   /// Objects are created for features automatically
59   MODELAPI_EXPORT ModelAPI_AttributeSelection();
60 };
61
62 //! Pointer on double attribute
63 typedef std::shared_ptr<ModelAPI_AttributeSelection> AttributeSelectionPtr;
64
65 #endif