Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / src / XGUI / XGUI_CustomPrs.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef XGUI_CustomPrs_H
22 #define XGUI_CustomPrs_H
23
24 #include "XGUI.h"
25 #include <GeomAPI_ICustomPrs.h>
26 #include <GeomAPI_AISObject.h>
27 #include <ModelAPI_Result.h>
28
29 class XGUI_Workshop;
30
31 /**
32 * Interface of a class which can provide specific customization of
33 * object presentation
34 */ 
35 class XGUI_CustomPrs : public GeomAPI_ICustomPrs
36 {
37 public:
38   /// Constructor
39   /// \param theWorkshop the current workshop instance
40   XGUI_EXPORT XGUI_CustomPrs(XGUI_Workshop* theWorkshop);
41
42   XGUI_EXPORT virtual ~XGUI_CustomPrs() {};
43
44   /// Modifies the given presentation in the custom way.
45   virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
46                                      std::shared_ptr<GeomAPI_ICustomPrs> theCustomPrs);
47
48   /// Returns color of a result object
49   /// \param theResult a result object
50   /// \param theColor a color in form of RGB vector
51   static void getResultColor(const ResultPtr& theResult, std::vector<int>& theColor);
52
53   /// Returns deflection of a result object
54   /// \param theResult a result object
55   /// \return theDeflection a real value
56   static double getResultDeflection(const ResultPtr& theResult);
57
58   /// Returns the default object color. It obtains colorConfigInfo of the object
59   /// and find it in preferences. If there are no this color in preference and an empty
60   /// color is interpreted as invalid, it shows error message
61   /// \param theObject an investigated object
62   /// \param isEmptyColorValid boolean state about interpretation of empty color
63   /// \param theColor the result color
64   static void XGUI_EXPORT getDefaultColor(ObjectPtr theObject, const bool isEmptyColorValid,
65                                           std::vector<int>& theColor);
66
67   /// Returns the default deflection value. The value is obtained from the application preferences
68   /// \param theObject an investigated object
69   /// \return deflection value
70   static double XGUI_EXPORT getDefaultDeflection(const ObjectPtr& theObject);
71
72 protected:
73   XGUI_Workshop* myWorkshop; ///< the current workshop
74 };
75
76 #endif