Salome HOME
Issue #1660: Ability to change the deflection coefficient
[modules/shaper.git] / src / XGUI / XGUI_CustomPrs.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        XGUI_CustomPrs.hxx
4 // Created:     10 Mar 2015
5 // Author:      Natalia ERMOLAEVA
6
7 #ifndef XGUI_CustomPrs_H
8 #define XGUI_CustomPrs_H
9
10 #include "XGUI.h"
11 #include <GeomAPI_ICustomPrs.h>
12 #include <GeomAPI_AISObject.h>
13 #include <ModelAPI_Result.h>
14
15 class XGUI_Workshop;
16
17 /**
18 * Interface of a class which can provide specific customization of
19 * object presentation
20 */ 
21 class XGUI_CustomPrs : public GeomAPI_ICustomPrs
22 {
23 public:
24   /// Constructor
25   /// \param theWorkshop the current workshop instance
26   XGUI_EXPORT XGUI_CustomPrs(XGUI_Workshop* theWorkshop);
27
28   XGUI_EXPORT virtual ~XGUI_CustomPrs() {};
29
30   /// Modifies the given presentation in the custom way.
31   virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
32                                      std::shared_ptr<GeomAPI_ICustomPrs> theCustomPrs);
33
34   /// Returns color of a result object
35   /// \param theResult a result object
36   /// \param theColor a color in form of RGB vector
37   static void getResultColor(const ResultPtr& theResult, std::vector<int>& theColor);
38
39   /// Returns deflection of a result object
40   /// \param theResult a result object
41   /// \return theDeflection a real value
42   static double getResultDeflection(const ResultPtr& theResult);
43
44   /// Returns the default object color. It obtains colorConfigInfo of the object
45   /// and find it in preferences. If there are no this color in preference and an empty
46   /// color is interpreted as invalid, it shows error message
47   /// \param theObject an investigated object
48   /// \param isEmptyColorValid boolean state about interpretation of empty color
49   /// \param theColor the result color
50   static void XGUI_EXPORT getDefaultColor(ObjectPtr theObject, const bool isEmptyColorValid,
51                                           std::vector<int>& theColor);
52
53   /// Returns the default deflection value. The value is obtained from the application preferences
54   /// \param theObject an investigated object
55   /// \return deflection value
56   static double XGUI_EXPORT getDefaultDeflection(const ObjectPtr& theObject);
57
58 protected:
59   XGUI_Workshop* myWorkshop; ///< the current workshop
60 };
61
62 #endif