Salome HOME
152ef4bba942210e94c09a525632d5fcc696f9b1
[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 #include <vector>
13
14 /**\class Model_ResultCompSolid
15 * \ingroup DataModel
16 * \brief The compsolid (container of body results) result of a feature.
17 *
18 * Provides a container of shapes that may be displayed in the viewer.
19 */
20 class Model_ResultCompSolid : public ModelAPI_ResultCompSolid
21 {
22   /// Sub-bodies if this is compsolid: zero base index to subs
23   std::vector<std::shared_ptr<ModelAPI_ResultBody> > mySubs;
24
25 public:
26
27   /// Removes the stored builders
28   MODEL_EXPORT virtual ~Model_ResultCompSolid();
29
30   /// Request for initialization of data model of the object: adding all attributes
31   MODEL_EXPORT virtual void initAttributes();
32
33   /// Stores the shape (called by the execution method). Creates sub-results for compsolid.
34   MODEL_EXPORT virtual void store(const std::shared_ptr<GeomAPI_Shape>& theShape);
35
36   /// Stores the generated shape.  Creates sub-results for compsolid.
37   MODEL_EXPORT virtual void storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
38     const std::shared_ptr<GeomAPI_Shape>& theToShape);
39
40   /// Stores the modified shape.  Creates sub-results for compsolid.
41   MODEL_EXPORT virtual void storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
42     const std::shared_ptr<GeomAPI_Shape>& theNewShape, const int theDecomposeSolidsTag = 0);
43
44   /// Returns the number of sub-elements
45   MODEL_EXPORT virtual int numberOfSubs(bool forTree = false) const;
46
47   /// Returns the sub-result by zero-base index
48   MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultBody> subResult(const int theIndex,
49     bool forTree = false) const;
50
51   /// Returns true if feature or reuslt belong to this composite feature as subs
52   MODEL_EXPORT virtual bool isSub(ObjectPtr theObject) const;
53
54   /// Returns the parameters of color definition in the resources config manager
55   MODEL_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName,
56                                             std::string& theDefault);
57
58   /// Disables the result body: keeps the resulting shape as selection, but erases the underlaying
59   /// naming data structure if theFlag if false. Or restores everything on theFlag is true.
60   MODEL_EXPORT virtual bool setDisabled(std::shared_ptr<ModelAPI_Result> theThis,
61     const bool theFlag);
62
63   /// The compsolid is concealed if at least one of the sub is concealed
64   MODEL_EXPORT virtual bool isConcealed();
65 protected:
66   /// Makes a body on the given feature
67   Model_ResultCompSolid();
68
69   /// Updates the sub-bodies if shape of this object is composite-solid
70   void updateSubs(const std::shared_ptr<GeomAPI_Shape>& theThisShape);
71
72   friend class Model_Objects;
73 };
74
75 #endif