X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FXGUI%2FXGUI_CustomPrs.h;h=6a2af267c0e7d73b876b162f7aa9a22c2bb439c0;hb=94f55fc020e6ef6e311ef4997b01a8a50ec2e513;hp=a1e636a5c15368e2a37ad91280baef85ed43134c;hpb=b6ec94fb365b2e63057f78ae0e63fe9a72ecb829;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_CustomPrs.h b/src/XGUI/XGUI_CustomPrs.h index a1e636a5c..6a2af267c 100644 --- a/src/XGUI/XGUI_CustomPrs.h +++ b/src/XGUI/XGUI_CustomPrs.h @@ -1,8 +1,22 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: XGUI_CustomPrs.hxx -// Created: 10 Mar 2015 -// Author: Natalia ERMOLAEVA +// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or +// email : webmaster.salome@opencascade.com +// #ifndef XGUI_CustomPrs_H #define XGUI_CustomPrs_H @@ -12,6 +26,8 @@ #include #include +class XGUI_Workshop; + /** * Interface of a class which can provide specific customization of * object presentation @@ -19,13 +35,47 @@ class XGUI_CustomPrs : public GeomAPI_ICustomPrs { public: + /// Constructor + /// \param theWorkshop the current workshop instance + XGUI_EXPORT XGUI_CustomPrs(XGUI_Workshop* theWorkshop); + XGUI_EXPORT virtual ~XGUI_CustomPrs() {}; /// Modifies the given presentation in the custom way. virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs, std::shared_ptr theCustomPrs); - static void getResultColor(ResultPtr theResult, std::vector& theColor); + /// Returns color of a result object + /// \param theResult a result object + /// \param theColor a color in form of RGB vector + static void getResultColor(const ResultPtr& theResult, std::vector& theColor); + + /// Returns deflection of a result object + /// \param theResult a result object + /// \return theDeflection a real value + static double getResultDeflection(const ResultPtr& theResult); + + /// Returns transparency of a result object + /// \param theResult a result object + /// \return theTransparency a real value + static double getResultTransparency(const ResultPtr& theResult); + + /// Returns the default object color. It obtains colorConfigInfo of the object + /// and find it in preferences. If there are no this color in preference and an empty + /// color is interpreted as invalid, it shows error message + /// \param theObject an investigated object + /// \param isEmptyColorValid boolean state about interpretation of empty color + /// \param theColor the result color + static void XGUI_EXPORT getDefaultColor(ObjectPtr theObject, const bool isEmptyColorValid, + std::vector& theColor); + + /// Returns the default deflection value. The value is obtained from the application preferences + /// \param theObject an investigated object + /// \return deflection value + static double XGUI_EXPORT getDefaultDeflection(const ObjectPtr& theObject); + +protected: + XGUI_Workshop* myWorkshop; ///< the current workshop }; #endif