]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModelAPI/ModelAPI_Result.h
Salome HOME
Make features history working. Optimization of features and results management and...
[modules/shaper.git] / src / ModelAPI / ModelAPI_Result.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModelAPI_Result.hxx
4 // Created:     07 Jul 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef ModelAPI_Result_H_
8 #define ModelAPI_Result_H_
9
10 #include "ModelAPI_Object.h"
11 #include <GeomAPI_Shape.h>
12
13 class ModelAPI_Feature;
14
15 /**\class ModelAPI_Result
16  * \ingroup DataModel
17  * \brief The result of a feature.
18  *
19  * A generic class that .
20  */
21 class ModelAPI_Result : public ModelAPI_Object
22 {
23   bool myIsConcealed; ///< the result is concealed from the data tree (referenced by other objects)
24   bool myIsDisabled; ///< the result is disabled: removed for the user, but keeps the general info
25  public:
26
27   /// Reference to the color of the result.
28   /// The integer array is used. It contains tree values for red green and blue values. The values are in
29   /// [0, 255] range
30   inline static const std::string& COLOR_ID()
31   {
32     static const std::string MY_COLOR_ID("Color");
33     return MY_COLOR_ID;
34   }
35
36   /// Returns true if the result is concealed from the data tree (referenced by other objects)
37   inline bool isConcealed()
38   {
39     return myIsConcealed;
40   }
41
42   /// Returns true if the result is concealed from the data tree (referenced by other objects)
43   MODELAPI_EXPORT void setIsConcealed(const bool theValue);
44
45   /// Enables/disables the result. The disabled result does not participate in any calculation
46   /// and visualization: like it was removed. But it keeps the general parameters: colors, 
47   /// visibility, etc.
48   /// \param theThis pointer to this object, needed to generate all events if it is neccessary
49   /// \param theFlag makes disabled if it is true
50   /// \returns true if state is really changed
51   MODELAPI_EXPORT virtual bool setDisabled(std::shared_ptr<ModelAPI_Result> theThis,
52     const bool theFlag);
53
54   /// Returns the result is disabled or not.
55   MODELAPI_EXPORT virtual bool isDisabled() const;
56
57   // Retuns the parameters of color definition in the resources config manager
58   virtual void colorConfigInfo(std::string& theSection, std::string& theName,
59     std::string& theDefault) {}
60
61   /// Request for initialization of data model of the result: adding all attributes
62   virtual void initAttributes() {};
63
64   /// To virtually destroy the fields of successors
65   MODELAPI_EXPORT virtual ~ModelAPI_Result();
66
67   /// Returns the shape-result produced by this feature (or null if no shapes)
68   MODELAPI_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
69
70   /// On change of attribute of the result update presentation of this result:
71   /// for the current moment there are only presentation attributes assigned to results
72   MODELAPI_EXPORT virtual void attributeChanged(const std::string& theID);
73 };
74
75 //! Pointer on feature object
76 typedef std::shared_ptr<ModelAPI_Result> ResultPtr;
77
78 #endif