Salome HOME
Issue #1660: Ability to change the deflection coefficient
[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  protected:
25   bool myIsDisabled; ///< the result is disabled: removed for the user, but keeps the general info
26  public:
27
28   /// Reference to the color of the result.
29   /// The integer array is used. It contains tree values for red green and blue values. The values are in
30   /// [0, 255] range
31   inline static const std::string& COLOR_ID()
32   {
33     static const std::string MY_COLOR_ID("Color");
34     return MY_COLOR_ID;
35   }
36
37   /// Reference to the deflection of the result.
38   /// The double value is used. The values is in [0, 1] range
39   inline static const std::string& DEFLECTION_ID()
40   {
41     static const std::string MY_DEFLECTION_ID("Deflection");
42     return MY_DEFLECTION_ID;
43   }
44
45   /// Returns true if the result is concealed from the data tree (referenced by other objects)
46   MODELAPI_EXPORT virtual bool isConcealed();
47
48   /// Sets the result as concealed in the data tree (referenced by other objects)
49   MODELAPI_EXPORT virtual void setIsConcealed(const bool theValue);
50
51   /// Enables/disables the result. The disabled result does not participate in any calculation
52   /// and visualization: like it was removed. But it keeps the general parameters: colors, 
53   /// visibility, etc.
54   /// \param theThis pointer to this object, needed to generate all events if it is necessary
55   /// \param theFlag makes disabled if it is true
56   /// \returns true if state is really changed
57   MODELAPI_EXPORT virtual bool setDisabled(std::shared_ptr<ModelAPI_Result> theThis,
58     const bool theFlag);
59
60   /// Returns the result is disabled or not.
61   MODELAPI_EXPORT virtual bool isDisabled();
62
63   /// Request for initialization of data model of the result: adding all attributes
64   MODELAPI_EXPORT virtual void initAttributes();
65
66   /// To virtually destroy the fields of successors
67   MODELAPI_EXPORT virtual ~ModelAPI_Result();
68
69   /// Returns the shape-result produced by this feature (or null if no shapes)
70   MODELAPI_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
71
72   /// On change of attribute of the result update presentation of this result:
73   /// for the current moment there are only presentation attributes assigned to results
74   MODELAPI_EXPORT virtual void attributeChanged(const std::string& theID);
75
76 protected:
77   /// This method is called just after creation of the object: it must initialize
78   /// all fields, normally initialized in the constructor
79   MODELAPI_EXPORT virtual void init();
80
81 friend class Model_Objects;
82 };
83
84 //! Pointer on feature object
85 typedef std::shared_ptr<ModelAPI_Result> ResultPtr;
86
87 #endif