Salome HOME
f1c697e5631fec076819af8933099d3c329290c9
[modules/shaper.git] / src / Model / Model_ResultCompSolid.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        Model_ResultCompSolid.h
4 // Created:     20 Jul 2015
5 // Author:      Natalia ERMOLAEVA
6
7 #ifndef Model_ResultCompSolid_H_
8 #define Model_ResultCompSolid_H_
9
10 #include "Model.h"
11 #include <ModelAPI_ResultCompSolid.h>
12
13 /**\class Model_ResultCompSolid
14  * \ingroup DataModel
15  * \brief The compsolid (container of body results) result of a feature.
16  *
17  * Provides a container of shapes that may be displayed in the viewer.
18  */
19 class Model_ResultCompSolid : public ModelAPI_ResultCompSolid
20 {
21 public:
22   /// All features of this sketch (list of references)
23   inline static const std::string& BODIES_ID()
24   {
25     static const std::string MY_BODIES_ID("Bodies");
26     return MY_BODIES_ID;
27   }
28
29   /// Removes the stored builders
30   MODEL_EXPORT virtual ~Model_ResultCompSolid();
31
32   /// Request for initialization of data model of the object: adding all attributes
33   MODEL_EXPORT virtual void initAttributes();
34
35   /// Adds result to the sketch and to its document
36   /// \param theIndex an index of the created body result in the compsolid
37   /// The real index in the document of the result is an incremented given index
38   /// The reason is that the first index is used for the comp solid result on the data
39   virtual std::shared_ptr<ModelAPI_ResultBody> addResult(const int theIndex);
40
41   /// Returns the number of sub-elements
42   virtual int numberOfSubs(bool forTree = false) const;
43
44   /// Returns the sub-result by zero-base index
45   virtual std::shared_ptr<ModelAPI_ResultBody> subResult(const int theIndex,
46                                                          bool forTree = false) const;
47
48   /// Returns the sub-feature unique identifier in this composite feature by zero-base index
49   //virtual int subResultId(const int theIndex) const;
50
51   /// Returns true if feature or reuslt belong to this composite feature as subs
52   virtual bool isSub(ObjectPtr theObject) const;
53
54   /// This method to inform that sub-feature is removed and must be removed from the internal data
55   /// structures of the owner (the remove from the document will be done outside just after)
56   virtual void removeResult(std::shared_ptr<ModelAPI_ResultBody> theResult);
57
58 protected:
59   /// Makes a body on the given feature
60   Model_ResultCompSolid();
61
62   friend class Model_Objects;
63 };
64
65 #endif