Salome HOME
41d7fe2ffa33856ae57265336b4264b9e78cc7d3
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Tool.h
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #ifndef HYDROGUI_TOOL_H
24 #define HYDROGUI_TOOL_H
25
26 #include <HYDROData_Object.h>
27
28 #include <GraphicsView_Defs.h>
29 #include <GraphicsView_ViewPort.h>
30
31 #include <TCollection_AsciiString.hxx>
32 #include <TCollection_ExtendedString.hxx>
33 #include <TCollection_HAsciiString.hxx>
34 #include <TCollection_HExtendedString.hxx>
35
36 class SUIT_ViewManager;
37
38 class HYDROGUI_DataModel;
39 class HYDROGUI_Module;
40 class HYDROGUI_Prs;
41
42 /**
43  * \class HYDROGUI_Tool
44  * \brief This class contains several useful methods.
45  */
46 class HYDROGUI_Tool
47 {
48 public:
49   /**
50    * \brief Convert \a TCollection_AsciiString to \a QString
51    */
52   static QString                                  ToQString( const TCollection_AsciiString& );
53
54   /**
55    * \brief Convert \a TCollection_ExtendedString to \a QString
56    */
57   static QString                                  ToQString( const TCollection_ExtendedString& );
58
59   /**
60    * \brief Convert \a Handle_TCollection_HAsciiString to \a QString
61    */
62   static QString                                  ToQString( const Handle(TCollection_HAsciiString)& );
63
64   /**
65    * \brief Convert \a Handle_TCollection_HExtendedString to \a QString
66    */
67   static QString                                  ToQString( const Handle(TCollection_HExtendedString)& );
68
69   /**
70    * \brief Convert \a QString to \a TCollection_AsciiString
71    */
72   static TCollection_AsciiString                  ToAsciiString( const QString& );
73
74   /**
75    * \brief Convert \a QString to \a TCollection_ExtendedString
76    */
77   static TCollection_ExtendedString               ToExtString( const QString& );
78
79   /**
80    * \brief Convert \a QString to \a Handle_TCollection_HAsciiString
81    */
82   static Handle(TCollection_HAsciiString)         ToHAsciiString( const QString& );
83
84   /**
85    * \brief Convert \a QString to \a Handle_TCollection_HExtendedString
86    */
87   static Handle(TCollection_HExtendedString)      ToHExtString( const QString& );
88
89   /**
90    * \brief Set the specified view manager to be active on the desktop.
91    * \param theModule module
92    * \param theViewManager view manager
93    */
94   static void                     SetActiveViewManager( HYDROGUI_Module* theModule,
95                                                         SUIT_ViewManager* theViewManager );
96
97   /**
98    * \brief Get sub-objects to build presentations.
99    * \param theModel data model
100    * \param theViewerId viewer id
101    * \param theSeq sequence of sub-objects
102    */
103   static void                     GetPrsSubObjects( const HYDROGUI_DataModel* theModel,
104                                                     const int theViewerId,
105                                                     HYDROData_SequenceOfObjects& theSeq );
106
107   /**
108    * \brief Get presentation built for specified data object.
109    * \param theObj data object
110    * \param theObjects list of existing presentations
111    * \return presentation
112    */
113   static HYDROGUI_Prs*            GetPresentation( const Handle(HYDROData_Object)& theObj,
114                                                    const GraphicsView_ObjectList& theObjects );
115
116   /**
117    * \brief Get list of HYDRO presentations from the specified viewport
118    * \param theViewPort viewport
119    * \return list of HYDRO presentations
120    */
121   static GraphicsView_ObjectList  GetPrsList( GraphicsView_ViewPort* theViewPort );
122 };
123
124 #endif