1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef XGUI_CustomPrs_H
22 #define XGUI_CustomPrs_H
25 #include <GeomAPI_ICustomPrs.h>
26 #include <GeomAPI_AISObject.h>
27 #include <ModelAPI_Result.h>
32 * Interface of a class which can provide specific customization of
35 class XGUI_CustomPrs : public GeomAPI_ICustomPrs
39 /// \param theWorkshop the current workshop instance
40 XGUI_EXPORT XGUI_CustomPrs(XGUI_Workshop* theWorkshop);
42 XGUI_EXPORT virtual ~XGUI_CustomPrs() {};
44 /// Modifies the given presentation in the custom way.
45 virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
46 std::shared_ptr<GeomAPI_ICustomPrs> theCustomPrs);
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);
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);
58 /// Returns transparency of a result object
59 /// \param theResult a result object
60 /// \return theTransparency a real value
61 static double getResultTransparency(const ResultPtr& theResult);
63 /// Returns the default object color. It obtains colorConfigInfo of the object
64 /// and find it in preferences. If there are no this color in preference and an empty
65 /// color is interpreted as invalid, it shows error message
66 /// \param theObject an investigated object
67 /// \param isEmptyColorValid boolean state about interpretation of empty color
68 /// \param theColor the result color
69 static void XGUI_EXPORT getDefaultColor(ObjectPtr theObject, const bool isEmptyColorValid,
70 std::vector<int>& theColor);
72 /// Returns the default deflection value. The value is obtained from the application preferences
73 /// \param theObject an investigated object
74 /// \return deflection value
75 static double XGUI_EXPORT getDefaultDeflection(const ObjectPtr& theObject);
78 XGUI_Workshop* myWorkshop; ///< the current workshop