Salome HOME
Change color for construction/body/group.
[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
13 /**\class Model_ResultConstruction
14  * \ingroup DataModel
15  * \brief The construction element result of a feature.
16  *
17  * Provides a shape that may be displayed in the viewer.
18  * Intermediate, light result that in many cases produces a result on the fly.
19  */
20 class Model_ResultConstruction : public ModelAPI_ResultConstruction
21 {
22   std::shared_ptr<ModelAPI_Feature> myOwner;  ///< owner of this result
23   std::shared_ptr<GeomAPI_Shape> myShape;  ///< shape of this result created "on the fly"
24   bool myIsInHistory;
25  public:
26   /// default color for a result construction
27   inline static const std::string& DEFAULT_COLOR()
28   {
29     static const std::string RESULT_CONSTRUCTION_COLOR("#000000");
30     return RESULT_CONSTRUCTION_COLOR;
31   }
32
33   /// Request for initialization of data model of the result: adding all attributes
34   virtual void initAttributes();
35
36   // Retuns the parameters of color definition in the resources config manager
37   MODEL_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName,
38                                             std::string& theDefault);
39
40   /// By default object is displayed in the object browser.
41   MODEL_EXPORT virtual bool isInHistory()
42   {
43     return myIsInHistory;
44   }
45
46   /// Sets the result
47   MODEL_EXPORT virtual void setShape(std::shared_ptr<GeomAPI_Shape> theShape);
48   /// Returns the shape-result produced by this feature
49   MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
50
51   /// Sets the flag that it must be displayed in history (default is true)
52   MODEL_EXPORT virtual void setIsInHistory(const bool myIsInHistory);
53
54  protected:
55   /// Makes a body on the given feature
56   Model_ResultConstruction();
57
58   friend class Model_Document;
59 };
60
61 #endif