1 // Copyright (C) 2014-2019 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef XGUI_CustomPrs_H
21 #define XGUI_CustomPrs_H
24 #include <GeomAPI_ICustomPrs.h>
25 #include <GeomAPI_AISObject.h>
26 #include <ModelAPI_Result.h>
31 * Interface of a class which can provide specific customization of
34 class XGUI_CustomPrs : public GeomAPI_ICustomPrs
38 /// \param theWorkshop the current workshop instance
39 XGUI_EXPORT XGUI_CustomPrs(XGUI_Workshop* theWorkshop);
41 XGUI_EXPORT virtual ~XGUI_CustomPrs() {};
43 /// Modifies the given presentation in the custom way.
44 virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
45 std::shared_ptr<GeomAPI_ICustomPrs> theCustomPrs);
47 /// Returns color of a result object
48 /// \param theResult a result object
49 /// \param theColor a color in form of RGB vector
50 static void getResultColor(const ResultPtr& theResult, std::vector<int>& theColor);
52 /// Returns deflection of a result object
53 /// \param theResult a result object
54 /// \return theDeflection a real value
55 static double getResultDeflection(const ResultPtr& theResult);
57 /// Returns transparency of a result object
58 /// \param theResult a result object
59 /// \return theTransparency a real value
60 static double getResultTransparency(const ResultPtr& theResult);
62 /// Returns the default object color. It obtains colorConfigInfo of the object
63 /// and find it in preferences. If there are no this color in preference and an empty
64 /// color is interpreted as invalid, it shows error message
65 /// \param theObject an investigated object
66 /// \param isEmptyColorValid boolean state about interpretation of empty color
67 /// \param theColor the result color
68 static void XGUI_EXPORT getDefaultColor(ObjectPtr theObject, const bool isEmptyColorValid,
69 std::vector<int>& theColor);
71 /// Returns the default deflection value. The value is obtained from the application preferences
72 /// \param theObject an investigated object
73 /// \return deflection value
74 static double XGUI_EXPORT getDefaultDeflection(const ObjectPtr& theObject);
77 XGUI_Workshop* myWorkshop; ///< the current workshop