1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SMESH SMESHGUI : GUI for SMESH component
24 // File : SMESHGUI_Utils.h
25 // Author : Open CASCADE S.A.S.
27 #ifndef SMESHGUI_UTILS_H
28 #define SMESHGUI_UTILS_H
31 #include "SMESH_SMESHGUI.hxx"
34 #include <omniORB4/CORBA.h>
36 // SALOME KERNEL includes
37 #include <SALOMEDSClient_definitions.hxx>
39 // SALOME GUI includes
40 #include <SALOME_InteractiveObject.hxx>
41 #include <LightApp_DataOwner.h>
46 class SUIT_ViewWindow;
49 class SUIT_ResourceMgr;
53 class SALOMEDSClient_Study;
54 class SALOMEDSClient_SObject;
56 class SalomeApp_Study;
57 class SalomeApp_Module;
58 class LightApp_SelectionMgr;
66 GetDesktop( const CAM_Module* );
69 LightApp_SelectionMgr*
70 GetSelectionMgr( const SalomeApp_Module* );
74 GetAppStudy( const CAM_Module* );
78 GetResourceMgr( const SalomeApp_Module* );
82 GetCStudy( const SalomeApp_Study* );
85 CORBA::Object_var DataOwnerToObject( const LightApp_DataOwnerPtr& );
87 template<class TInterface> typename TInterface::_var_type
88 DataOwnerToInterface( const LightApp_DataOwnerPtr& theDataOwner )
90 CORBA::Object_var anObj = DataOwnerToObject(theDataOwner);
91 if(!CORBA::is_nil(anObj))
92 return TInterface::_narrow(anObj);
93 return TInterface::_nil();
97 SUIT_Study* GetActiveStudy();
100 SUIT_ViewWindow* GetActiveWindow();
103 _PTR(Study) GetActiveStudyDocument();
106 _PTR(SObject) FindSObject( CORBA::Object_ptr );
109 void SetName( _PTR(SObject), const QString& );
112 void SetValue( _PTR(SObject), const QString& );
113 void setFileType( _PTR(SObject), const QString& );
114 void setFileName( _PTR(SObject), const QString& );
117 CORBA::Object_var SObjectToObject( _PTR(SObject),
121 CORBA::Object_var SObjectToObject( _PTR(SObject) );
123 template<class TInterface> typename TInterface::_var_type
124 SObjectToInterface( _PTR(SObject) theSObject )
126 CORBA::Object_var anObj = SObjectToObject(theSObject);
127 if(!CORBA::is_nil(anObj))
128 return TInterface::_narrow(anObj);
129 return TInterface::_nil();
133 _PTR(SObject) ObjectToSObject( CORBA::Object_ptr );
136 CORBA::Object_var IObjectToObject( const Handle(SALOME_InteractiveObject)& );
138 template<class TInterface> typename TInterface::_var_type
139 IObjectToInterface( const Handle(SALOME_InteractiveObject)& theIO )
141 CORBA::Object_var anObj = IObjectToObject(theIO);
142 if(!CORBA::is_nil(anObj))
143 return TInterface::_narrow(anObj);
144 return TInterface::_nil();
148 CORBA::Object_var IORToObject( const QString& );
150 template<class TInterface> typename TInterface::_var_type
151 IORToInterface( const QString& theIOR )
153 CORBA::Object_var anObj = IORToObject( theIOR );
154 if ( !CORBA::is_nil( anObj ) )
155 return TInterface::_narrow( anObj );
156 return TInterface::_nil();
160 int GetNameOfSelectedIObjects( LightApp_SelectionMgr*, QString& );
163 _PTR(SObject) GetMeshOrSubmesh( _PTR(SObject) );
166 void ModifiedMesh( _PTR(SObject), bool, bool = false );
169 void ShowHelpFile( const QString& );
172 * \brief Return the normal to a face
173 * \param theFace - input face
174 * \retval gp_XYZ - normal to a face
177 gp_XYZ getNormale( const SMDS_MeshFace* theFace );
181 #endif // SMESHGUI_UTILS_H