]> SALOME platform Git repositories - modules/shaper.git/blob - src/Model/Model_AttributeSelection.h
Salome HOME
Make construction elements correctly selected: points, axes, planes
[modules/shaper.git] / src / Model / Model_AttributeSelection.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        Model_AttributeSelection.h
4 // Created:     8 May 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef Model_AttributeSelection_H_
8 #define Model_AttributeSelection_H_
9
10 #include "Model.h"
11 #include "Model_AttributeReference.h"
12 #include <ModelAPI_AttributeSelection.h>
13
14 /**\class Model_AttributeSelection
15  * \ingroup DataModel
16  * \brief Attribute that contains reference to the sub-shape of some result, the selected shape.
17  */
18
19 class Model_AttributeSelection : public ModelAPI_AttributeSelection
20 {
21   Model_AttributeReference myRef;  ///< The reference functionality reusage
22 public:
23   /// Defines the result and its selected sub-shape
24   MODEL_EXPORT virtual void setValue(
25     const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape);
26
27   /// Returns the selected subshape
28   MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> value();
29
30   /// Returns the context of the selection (the whole shape owner)
31   MODEL_EXPORT virtual ResultPtr context();
32
33   /// Sets the feature object
34   MODEL_EXPORT virtual void setObject(const std::shared_ptr<ModelAPI_Object>& theObject);
35
36   /// Updates the underlied selection due to the changes in the referenced objects
37   /// \returns false if update is failed
38   MODEL_EXPORT virtual bool update();
39
40 protected:
41   /// Objects are created for features automatically
42   MODEL_EXPORT Model_AttributeSelection(TDF_Label& theLabel);
43     /// Performs the selection for the body result (TNaming Selection)
44
45   /// Performs the selection for the body result (TNaming selection)
46   virtual void selectBody(
47     const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape);
48   /// Performs the selection for the construction result (selection by index)
49   virtual void selectConstruction(
50     const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape);
51
52   /// Returns the label where TNaming_Selection results are stored
53   /// Note: there must be no attributes stored at the same label because Selector clears this lab
54   TDF_Label selectionLabel();
55
56   friend class Model_Data;
57   friend class Model_AttributeSelectionList;
58 };
59
60 #endif