]> SALOME platform Git repositories - modules/shaper.git/blob - src/Model/Model_ResultConstruction.h
Salome HOME
Issue #555: Infinite boolean state is stored in Result construction.
[modules/shaper.git] / src / Model / Model_ResultConstruction.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModelAPI_ResultConstruction.hxx
4 // Created:     07 Jul 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef Model_ResultConstruction_H_
8 #define Model_ResultConstruction_H_
9
10 #include "Model.h"
11 #include <ModelAPI_ResultConstruction.h>
12 #include <vector>
13
14 /**\class Model_ResultConstruction
15  * \ingroup DataModel
16  * \brief The construction element result of a feature.
17  *
18  * Provides a shape that may be displayed in the viewer.
19  * Intermediate, light result that in many cases produces a result on the fly.
20  */
21 class Model_ResultConstruction : public ModelAPI_ResultConstruction
22 {
23   std::shared_ptr<ModelAPI_Feature> myOwner;  ///< owner of this result
24   std::shared_ptr<GeomAPI_Shape> myShape;  ///< shape of this result created "on the fly"
25   bool myFacesUpToDate; ///< is true if faces in myuFaces are computed and up to date
26   std::vector<std::shared_ptr<GeomAPI_Face> > myFaces; ///< stores the up to date faces if they exist
27   bool myIsInHistory;
28   bool myIsInfinite;
29  public:
30   /// default color for a result construction
31   inline static const std::string& DEFAULT_COLOR()
32   {
33     static const std::string RESULT_CONSTRUCTION_COLOR("120,120,120");
34     return RESULT_CONSTRUCTION_COLOR;
35   }
36
37   /// Request for initialization of data model of the result: adding all attributes
38   virtual void initAttributes();
39
40   // Retuns the parameters of color definition in the resources config manager
41   MODEL_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName,
42                                             std::string& theDefault);
43
44   /// By default object is displayed in the object browser.
45   MODEL_EXPORT virtual bool isInHistory()
46   {
47     return myIsInHistory;
48   }
49
50   /// Sets the result
51   MODEL_EXPORT virtual void setShape(std::shared_ptr<GeomAPI_Shape> theShape);
52   /// Returns the shape-result produced by this feature
53   MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
54
55   /// Sets the flag that it must be displayed in history (default is true)
56   MODEL_EXPORT virtual void setIsInHistory(const bool myIsInHistory);
57
58   /// if the construction result may be used as faces, this method returns not zero number of faces
59   MODEL_EXPORT virtual int facesNum();
60   /// if the construction result may be used as faces, this method returns face by zero based index
61   MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Face> face(const int theIndex);
62
63   /// By default object is not infinite.
64   MODEL_EXPORT virtual bool isInfinite();
65   /// Sets the flag that it is infinite
66   MODEL_EXPORT virtual void setInfinite(const bool theInfinite);
67
68  protected:
69   /// Makes a body on the given feature
70   Model_ResultConstruction();
71
72   friend class Model_Objects;
73 };
74
75 #endif