Salome HOME
Dialogue pour l'adaptation
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_AdaptDlg.cxx
1 // Copyright (C) 2011-2020  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // SMESH SMESHGUI : GUI for the adaptation in the SMESH component
21 //  File   : SMESHGUI_AdaptDlg.cxx
22 //  Author : Gerald NICOLAS, EDF
23 //  ADAPTGUI includes
24 //
25 #include "SMESHGUI_AdaptDlg.h"
26
27 // SALOME Includes
28 #include "Utils_ORB_INIT.hxx"
29 #include "Utils_SINGLETON.hxx"
30 #include "SALOME_LifeCycleCORBA.hxx"
31
32 #include <SUIT_Desktop.h>
33 #include <SUIT_ResourceMgr.h>
34 #include <SUIT_Session.h>
35 #include <SUIT_MessageBox.h>
36 #include <SUIT_OverrideCursor.h>
37 #include "SUIT_ViewWindow.h"
38 #include "SUIT_ViewManager.h"
39
40 #include "CAM_Module.h"
41 #include "OB_Browser.h"
42
43 #include "SALOME_ListIO.hxx"
44
45 #include "SalomeApp_Application.h"
46 #include "SalomeApp_DataModel.h"
47 #include "SalomeApp_Study.h"
48 #include "LightApp_SelectionMgr.h"
49 #include "LightApp_Selection.h"
50 #include <LightApp_Preferences.h>
51 #include "SalomeApp_Module.h"
52 #include "SALOMEconfig.h"
53 #include <SALOME_LifeCycleCORBA.hxx>
54
55 #include <utilities.h>
56
57
58 // QT Includes
59 #include <QMenu>
60 #include "MonCreateCase.h"
61 #include "MonCreateIteration.h"
62 #include "MonPursueIteration.h"
63 #include "MonCreateYACS.h"
64 #include "MonEditBoundaryCAO.h"
65 #include "MonEditBoundaryAn.h"
66 #include "MonEditBoundaryDi.h"
67 #include "MonEditCase.h"
68 #include "MonEditHypothesis.h"
69 #include "MonEditIteration.h"
70 #include "MonEditYACS.h"
71 #include "MonEditZone.h"
72 #include "MonMeshInfo.h"
73 #include "MonIterInfo.h"
74 #include "MonEditFile.h"
75 #include "HomardQtCommun.h"
76
77 // BOOST Includes
78 #include <boost/shared_ptr.hpp>
79
80 //Pour le _CAST
81 #include "SALOMEDS_Study.hxx"
82 #include "HOMARDGUI_Utils.h"
83
84 using namespace std;
85
86 static CORBA::ORB_var _orb;
87
88 //=================================================================================
89 // function : SMESHGUI_AdaptDlg()
90 // purpose  :
91 //=================================================================================
92 SMESHGUI_AdaptDlg::SMESHGUI_AdaptDlg( SMESHGUI* theModule,
93                                       int theCommandID )
94 {
95 }
96 //=======================================================================
97 // function : ~SMESHGUI_AdaptDlg()
98 // purpose  : Destructor
99 //=======================================================================
100 SMESHGUI_AdaptDlg::~SMESHGUI_AdaptDlg()
101 {
102 }
103
104 // //=======================================================================
105 // // function : InitHOMARDGen
106 // // launch HOMARD component and return a handle
107 // //=======================================================================
108 // HOMARD::HOMARD_Gen_var SMESHGUI_AdaptDlg::InitHOMARDGen(SalomeApp_Application* app)
109 // {
110 //   Engines::EngineComponent_var comp = app->lcc()->FindOrLoad_Component( "FactoryServer","HOMARD" );
111 //   HOMARD::HOMARD_Gen_var clr = HOMARD::HOMARD_Gen::_narrow(comp);
112 //   ASSERT(!CORBA::is_nil(clr));
113 //   return clr;
114 // }
115 // 
116 // //=======================================================================
117 // // Module's initialization
118 // void SMESHGUI_AdaptDlg::initialize( CAM_Application* app )
119 // //=======================================================================
120 // {
121 //   SalomeApp_Module::initialize( app );
122 //   InitHOMARDGen(dynamic_cast<SalomeApp_Application*>( app ));
123 //   anId = 0;
124 // //   createActions();
125 // //   createMenus();
126 //   recupPreferences();
127 // }
128 // 
129 // // //================================================
130 // // // function : createHOMARDAction
131 // // // create an item in status bar and Homard menu
132 // // //================================================
133 // // void SMESHGUI_AdaptDlg::createHOMARDAction( const int id, const QString& po_id, const QString& icon_id, const int key, const bool toggle  )
134 // // {
135 // // //   MESSAGE("createHOMARDAction");
136 // //   QIcon icon;
137 // //   QWidget* parent = application()->desktop();
138 // //   SUIT_ResourceMgr* resMgr = application()->resourceMgr();
139 // //   QPixmap pix;
140 // //   if ( icon_id.length() )
141 // //      pix = resMgr->loadPixmap( "HOMARD", tr( icon_id .toLatin1().data()) );
142 // //   else
143 // //      pix = resMgr->loadPixmap( "HOMARD", tr( QString( "ICO_%1" ).arg( po_id ).toLatin1().data()), false );
144 // //   if ( !pix.isNull() )
145 // //       icon = QIcon( pix );
146 // // 
147 // //   QString tooltip    = tr(QString( "HOM_TOP_%1" ).arg( po_id ).toLatin1().data()),
148 // //           menu       = tr(QString( "HOM_MEN_%1" ).arg( po_id ).toLatin1().data()),
149 // //           status_bar = tr(QString( "HOM_STB_%1" ).arg( po_id ).toLatin1().data());
150 // // 
151 // //   createAction( id, tooltip, icon, menu, status_bar, key, parent, toggle, this, SLOT( OnGUIEvent() )  );
152 // // }
153 // 
154 // // //================================================
155 // // // function : createAction
156 // // // constructs Homard menu
157 // // // calls createHOMARDAction for each item
158 // // //================================================
159 // // void SMESHGUI_AdaptDlg::createActions(){
160 // // //
161 // //   createHOMARDAction( 8011, "NEW_CASE",         "cas_calcule.png"        );
162 // //   createHOMARDAction( 8012, "PURSUE_ITERATION", "iter_poursuite.png"     );
163 // //   createHOMARDAction( 8013, "NEW_ITERATION",    "iter_next.png"          );
164 // //   createHOMARDAction( 8014, "COMPUTE",          "mesh_compute.png"       );
165 // //   createHOMARDAction( 8015, "COMPUTE_PUBLISH",  "mesh_compute.png"       );
166 // //   createHOMARDAction( 1121, "MESH_INFO",        "advanced_mesh_info.png" );
167 // //   createHOMARDAction( 1131, "MESH_PUBLICATION", "mesh_tree_mesh.png"     );
168 // // //
169 // //   createHOMARDAction( 8016, "EDIT",             "loop.png"         );
170 // //   createHOMARDAction( 8017, "DELETE",           "delete.png"       );
171 // // //
172 // //   createHOMARDAction( 1301, "MESH_INFO",        "advanced_mesh_info.png" );
173 // //   createHOMARDAction( 1302, "EDIT_MESS_FILE",   "texte.png"              );
174 // // //
175 // //   createHOMARDAction( 1401, "YACS",             "table_view.png" );
176 // // //
177 // // }
178 // 
179 // //================================================
180 // // function : createPreferences
181 // //================================================
182 // void SMESHGUI_AdaptDlg::createPreferences()
183 // {
184 //   MESSAGE("createPreferences")
185 // 
186 //   int Onglet, Bloc, Pref ;
187 //   // 1. Generalites
188 //   Onglet = addPreference( tr( "PREF_TAB_GENERAL" ) );
189 // //   Onglet = addPreference( tr( "PREF_TAB_SETTINGS" ) ) ;
190 // 
191 //   Bloc = addPreference( tr( "PREF_PUBLICATION" ), Onglet );
192 //   setPreferenceProperty( Bloc, "columns", 1 );
193 // 
194 //   Pref = addPreference( tr( "PREF_PUBLICATION_MAILLAGE_IN" ), Bloc, LightApp_Preferences::Bool, "HOMARD", "publish_mesh_in" );
195 // 
196 //   Pref = addPreference( tr( "PREF_PUBLICATION_MAILLAGE_OUT" ), Bloc, LightApp_Preferences::Bool, "HOMARD", "publish_mesh_out" );
197 // 
198 //   // 2. YACS
199 //   Onglet = addPreference( tr( "PREF_YACS" ) ) ;
200 // 
201 //   Bloc = addPreference( tr( "PREF_YACS_MAX" ), Onglet );
202 //   setPreferenceProperty( Bloc, "columns", 1 );
203 // 
204 //   Pref = addPreference( tr( "PREF_YACS_MAX_ITER" ), Bloc, LightApp_Preferences::IntSpin, "HOMARD", "yacs_max_iter" );
205 //   setPreferenceProperty( Pref, "min",  0 );
206 //   setPreferenceProperty( Pref, "max",  100000000 );
207 //   setPreferenceProperty( Pref, "step", 1 );
208 // 
209 //   Pref = addPreference( tr( "PREF_YACS_MAX_NODE" ), Bloc, LightApp_Preferences::IntSpin, "HOMARD", "yacs_max_node" );
210 //   setPreferenceProperty( Pref, "min",  0 );
211 //   setPreferenceProperty( Pref, "max",  100000000 );
212 //   setPreferenceProperty( Pref, "step", 1000 );
213 // 
214 //   Pref = addPreference( tr( "PREF_YACS_MAX_ELEM" ), Bloc, LightApp_Preferences::IntSpin, "HOMARD", "yacs_max_elem" );
215 //   setPreferenceProperty( Pref, "min",  0 );
216 //   setPreferenceProperty( Pref, "max",  100000000 );
217 //   setPreferenceProperty( Pref, "step", 1000 );
218 // 
219 //   Bloc = addPreference( tr( "PREF_YACS_CONVERGENCE" ), Onglet );
220 //   setPreferenceProperty( Bloc, "columns", 1 );
221 // 
222 //   Pref = addPreference( tr( "PREF_YACS_TYPE_TEST" ), Bloc, LightApp_Preferences::Selector, "HOMARD", "yacs_type_test" );
223 //   QStringList aListOfTypeTest;
224 //   aListOfTypeTest << "None";
225 //   aListOfTypeTest << "VTest > VRef";
226 //   aListOfTypeTest << "VTest < VRef";
227 //   setPreferenceProperty( Pref, "strings", aListOfTypeTest );
228 // }
229 // 
230 // 
231 // // //================================================
232 // // // function : createMenus
233 // // //================================================
234 // // void SMESHGUI_AdaptDlg::createMenus()
235 // // {
236 // //   MESSAGE("createMenus")
237 // // //
238 // //   int HOMARD_Id  = createMenu( tr( "HOM_MEN_HOMARD" ),  -1,  5, 10 );
239 // //   createMenu( 8011, HOMARD_Id, -1 ); //Create_Case
240 // //   createMenu( 8012, HOMARD_Id, -1 ); //Pursue_Iteration
241 // //   createMenu( separator(), HOMARD_Id,-1);
242 // //   createMenu( 8013, HOMARD_Id, -1 ); //Create_Iteration
243 // //   createMenu( 8014, HOMARD_Id, -1 ); //Compute
244 // //   createMenu( 8015, HOMARD_Id, -1 ); //Compute and publish
245 // // //
246 // //   HOMARD_Id  = createMenu( tr( "HOM_MEN_MODIFICATION" ),  -1,  5, 10 );
247 // //   createMenu( 8016, HOMARD_Id, -1 ); //Edit
248 // //   createMenu( 8017, HOMARD_Id, -1 ); //Delete
249 // // //
250 // //   HOMARD_Id  = createMenu( tr( "HOM_MEN_INFORMATION" ),  -1,  5, 10 );
251 // //   createMenu( 1301, HOMARD_Id, -1 ); //Information sur un maillage
252 // //   createMenu( 1131, HOMARD_Id, -1 ); //Mesh publication
253 // //   createMenu( separator(), HOMARD_Id,-1);
254 // //   createMenu( 1302, HOMARD_Id, -1 ); //EditAsciiFile pour le fichier listeStd ou bilan
255 // //   createMenu( separator(), HOMARD_Id,-1);
256 // //   createMenu( 8016, HOMARD_Id, -1 ); //Edit
257 // //   createMenu( separator(), HOMARD_Id,-1);
258 // // //
259 // //   HOMARD_Id  = createMenu( tr( "HOM_MEN_YACS" ),  -1,  5, 10 );
260 // //   createMenu( 1401, HOMARD_Id, -1 ); // Création d'un schéma YACS
261 // //   createMenu( separator(), HOMARD_Id,-1);
262 // // }
263 // 
264 // //================================================
265 // // function : recupPreferences
266 // // Pour chaque valeur, le defaut est la valeur definie dans HOMARD_Gen
267 // // . Si la recuperation dans config/salome s'est bien passee a la creation de HOMARD_Gen,
268 // //   ces valeurs sont les valeurs definies.
269 // // . Si cela ne s'est pas bien passe, ce sont les valeurs par defaut de HOMARD_Gen
270 // //================================================
271 // void SMESHGUI_AdaptDlg::recupPreferences()
272 // {
273 //   MESSAGE("recupPreferences")
274 // //
275 // // A. Declarations
276 // //
277 //   SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( application() );
278 //   HOMARD::HOMARD_Gen_var homardGen = SMESHGUI_AdaptDlg::InitHOMARDGen(app);
279 //   int defaut_i ;
280 //   std::string defaut_s ;
281 //   QString QString_v ;
282 // //
283 // // B. Les valeurs
284 // // B.1. La langue
285 // //
286 //   defaut_s = homardGen->GetLanguageShort();
287 //   SUIT_ResourceMgr* resMgr = getApp()->resourceMgr();
288 //   _LanguageShort = resMgr->stringValue("language", "language", QString(defaut_s.c_str()) );
289 // //
290 // // B.2. Les publications
291 //   bool publish_mesh ;
292 // //
293 //   _PublisMeshIN = homardGen->GetPublisMeshIN();
294 //   if ( _PublisMeshIN == 1 ) { publish_mesh = true ;  }
295 //   else                      { publish_mesh = false ; }
296 //   publish_mesh = resMgr->booleanValue("HOMARD", "publish_mesh_in", publish_mesh );
297 //   if ( publish_mesh ) { _PublisMeshIN = 1 ; }
298 //   else                { _PublisMeshIN = 0 ; }
299 // //
300 //   _PublisMeshOUT = homardGen->GetPublisMeshOUT();
301 //   if ( _PublisMeshOUT == 1 ) { publish_mesh = true ;  }
302 //   else                       { publish_mesh = false ; }
303 //   publish_mesh = resMgr->booleanValue("HOMARD", "publish_mesh_out", publish_mesh );
304 //   if ( publish_mesh ) { _PublisMeshOUT = 1 ; }
305 //   else                { _PublisMeshOUT = 0 ; }
306 // //
307 // // B.3. Les maximum pour YACS
308 // //
309 //   defaut_i = homardGen->GetYACSMaxIter();
310 //   _YACSMaxIter = resMgr->integerValue("HOMARD", "yacs_max_iter", defaut_i );
311 // //
312 //   defaut_i = homardGen->GetYACSMaxNode();
313 //   _YACSMaxNode = resMgr->integerValue("HOMARD", "yacs_max_node", defaut_i );
314 // //
315 //   defaut_i = homardGen->GetYACSMaxElem();
316 //   _YACSMaxElem = resMgr->integerValue("HOMARD", "yacs_max_elem", defaut_i );
317 // //
318 // // B.4. La convergence pour YACS
319 // //
320 //   defaut_i = homardGen->GetYACSConvergenceType();
321 //   if ( defaut_i == 1 )      { QString_v = tr("VTest > VRef") ; }
322 //   else if ( defaut_i == 2 ) { QString_v = tr("VTest < VRef") ; }
323 //   else                      { QString_v = tr("None") ; }
324 //   QString_v = resMgr->stringValue ( "HOMARD", "yacs_type_test", QString_v );
325 //   if ( ( QString_v == "VTest > VRef" ) || ( QString_v == "VTest &gt; VRef" ) )      { _YACSTypeTest = 1 ; }
326 //   else if ( ( QString_v == "VTest < VRef" ) || ( QString_v == "VTest &lt; VRef" ) ) { _YACSTypeTest = 2 ; }
327 //   else                                                                              { _YACSTypeTest = 0 ; }
328 // //
329 // // C. Enregistrement dans l'objet general
330 // //
331 //   MESSAGE ("Enregistrement de LanguageShort = " << _LanguageShort.toStdString().c_str() );
332 //   MESSAGE ("Enregistrement de PublisMeshIN = " << _PublisMeshIN<<", PublisMeshOUT = "<< _PublisMeshOUT);
333 //   MESSAGE ("Enregistrement de YACSMaxIter = " << _YACSMaxIter<<", YACSMaxNode = "<< _YACSMaxNode<<", YACSMaxElem = "<< _YACSMaxElem);
334 //   MESSAGE ("Enregistrement de YACSTypeTest = " << _YACSTypeTest);
335 // //
336 //   homardGen->SetLanguageShort(_LanguageShort.toStdString().c_str());
337 //   homardGen->SetPublisMesh(_PublisMeshIN, _PublisMeshOUT);
338 //   homardGen->SetYACSMaximum(_YACSMaxIter, _YACSMaxNode, _YACSMaxElem);
339 // //
340 //   homardGen->SetYACSConvergenceType(_YACSTypeTest);
341 // }
342 // 
343 // //================================================
344 // void SMESHGUI_AdaptDlg::OnGUIEvent()
345 // //================================================
346 // {
347 //   MESSAGE("OnGUIEvent()")
348 //   setOrb();
349 //   const QObject* obj = sender();
350 //   if ( !obj || !obj->inherits( "QAction" ) ) { return; }
351 //   int id = actionId((QAction*)obj);
352 //   if ( id != -1 ) { bool ret = OnGUIEvent( id ); }
353 //   MESSAGE("Fin de OnGUIEvent()");
354 // }
355 // 
356 // //=======================================================================
357 // // Method OnGUIEvent pour Homard
358 // //=======================================================================
359 // bool SMESHGUI_AdaptDlg::OnGUIEvent (int theCommandID)
360 // {
361 //   MESSAGE("OnGUIEvent avec theCommandID = "<<theCommandID);
362 // // A. Controles
363 //   SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( application() );
364 //   if ( !app ) return false;
365 // 
366 //   SalomeApp_Study* stud = dynamic_cast<SalomeApp_Study*> ( app->activeStudy() );
367 //   if ( !stud )
368 //   {
369 //     MESSAGE ( "FAILED to cast active study to SalomeApp_Study" );
370 //     return false;
371 //   }
372 // 
373 //   SUIT_Desktop* parent = application()->desktop();
374 // 
375 //   HOMARD::HOMARD_Gen_var homardGen = SMESHGUI_AdaptDlg::InitHOMARDGen(app);
376 // 
377 //   if (!CORBA::is_nil(homardGen))
378 //     homardGen->UpdateStudy();
379 // 
380 //   getApp()->updateObjectBrowser();
381 // 
382 // // B. Choix selon les commandes
383 //   SCRUTE(theCommandID);
384 //   switch (theCommandID)
385 //   {
386 //     case 8011: // Creation d un Cas
387 //     {
388 //       MESSAGE("command " << theCommandID << " activated");
389 //       MonCreateCase *aDlg = new MonCreateCase( true,
390 //                             HOMARD::HOMARD_Gen::_duplicate(homardGen) ) ;
391 //       aDlg->show();
392 //       break;
393 //     }
394 // 
395 //     case 8012: // Poursuite d une iteration
396 //     {
397 //       MESSAGE("command " << theCommandID << " activated");
398 //       MonPursueIteration *aDlg = new MonPursueIteration( true,
399 //                                 HOMARD::HOMARD_Gen::_duplicate(homardGen) ) ;
400 //       aDlg->show();
401 //       break;
402 //     }
403 // 
404 //     case 8013: // Creation d une Iteration
405 //     {
406 //       MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
407 //       MonCreateIteration *IterDlg = new MonCreateIteration( parent, true,
408 //                                      HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ;
409 //       IterDlg->show();
410 //       break;
411 //     }
412 // 
413 //     case 8014: // Compute une iteration
414 //     {
415 //       MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
416 //       try { homardGen->Compute(_ObjectName.toStdString().c_str(), 0, 1, -1, 1); }
417 //       catch( SALOME::SALOME_Exception& S_ex )
418 //       {
419 //         QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
420 //                                   QObject::tr(CORBA::string_dup(S_ex.details.text)) );
421 //         getApp()->updateObjectBrowser();
422 //         return false;
423 //       }
424 //       break;
425 //     }
426 // 
427 //     case 8015: // Compute une iteration et publication
428 //     {
429 //       MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
430 //       try { homardGen->Compute(_ObjectName.toStdString().c_str(), 0, 1, -1, 2); }
431 //       catch( SALOME::SALOME_Exception& S_ex )
432 //       {
433 //         QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
434 //                                   QObject::tr(CORBA::string_dup(S_ex.details.text)) );
435 //         getApp()->updateObjectBrowser();
436 //         return false;
437 //       }
438 //       break;
439 //     }
440 // 
441 //     case 1121: // Information sur le maillage de l'iteration
442 //     {
443 //       MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
444 //       MonIterInfo *IterDlg = new MonIterInfo( parent, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ;
445 //       IterDlg->show();
446 //       break;
447 //     }
448 // 
449 //     case 1131: // Publication du maillage de l'iteration
450 //     {
451 //       MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
452 //       homardGen->PublishMeshIterInSmesh(_ObjectName.toStdString().c_str());
453 //       break;
454 //     }
455 // 
456 //     case 1132: // Publication du maillage de l'iteration a partir du fichier
457 //     {
458 //       MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
459 //       homardGen->PublishResultInSmesh(_ObjectName.toStdString().c_str(), 1);
460 //       break;
461 //     }
462 // 
463 //     case 8016: // Edition d'un objet
464 //     {
465 //       MESSAGE("command " << theCommandID << " activated");
466 //       QString nomObjet = HOMARD_QT_COMMUN::SelectionArbreEtude(QString(""), 1);
467 //       if (nomObjet == QString("")) break;
468 //       _PTR(SObject) obj = chercheMonObjet();
469 //       if (obj)
470 //       {
471 //         // Edition d'une frontiere CAO
472 //         if (HOMARD_UTILS::isBoundaryCAO(obj))
473 //         {
474 //           MonEditBoundaryCAO *aDlg = new MonEditBoundaryCAO(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ;
475 //           aDlg->show();
476 //         }
477 //         // Edition d'une frontiere discrete
478 //         else if (HOMARD_UTILS::isBoundaryDi(obj))
479 //         {
480 //           MonEditBoundaryDi *aDlg = new MonEditBoundaryDi(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ;
481 //           aDlg->show();
482 //         }
483 //         // Edition d'une frontiere analytique
484 //         else if (HOMARD_UTILS::isBoundaryAn(obj))
485 //         {
486 //           MonEditBoundaryAn *aDlg = new MonEditBoundaryAn(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ;
487 //           aDlg->show();
488 //         }
489 //         // Edition d'un cas
490 //         else if (HOMARD_UTILS::isCase(obj))
491 //         {
492 //           MonEditCase *aDlg = new MonEditCase(true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ;
493 //           aDlg->show();
494 //         }
495 //         // Edition d'une hypothese
496 //         else if (HOMARD_UTILS::isHypo(obj))
497 //         {
498 //           MonEditHypothesis *aDlg = new MonEditHypothesis(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen),  _ObjectName, QString(""), QString("")) ;
499 //           aDlg->show();
500 //         }
501 //         // Edition d'une iteration
502 //         else if (HOMARD_UTILS::isIter(obj))
503 //         {
504 //           MonEditIteration *aDlg = new MonEditIteration(parent, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ;
505 //           aDlg->show();
506 //         }
507 //         // Edition d'un schema YACS
508 //         else if (HOMARD_UTILS::isYACS(obj))
509 //         {
510 //           MESSAGE("appel de MonEditYACS");
511 //           MonEditYACS *aDlg = new MonEditYACS(true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName) ;
512 //           aDlg->show();
513 //         }
514 //         // Edition d'une zone
515 //         else if (HOMARD_UTILS::isZone(obj))
516 //         {
517 //           MonEditZone *aDlg = new MonEditZone(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ;
518 //           aDlg->show();
519 //         }
520 //       }
521 //       break;
522 //     }
523 // 
524 //     case 8017: // Suppression d'un objet
525 //     {
526 //       MESSAGE("command " << theCommandID << " activated");
527 //       QString nomObjet = HOMARD_QT_COMMUN::SelectionArbreEtude(QString(""), 1);
528 //       if (nomObjet == QString("")) break;
529 //       _PTR(SObject) obj = chercheMonObjet();
530 //       if (obj)
531 //       {
532 //         // Suppression d'une frontiere
533 //         if ( HOMARD_UTILS::isBoundaryCAO(obj) || HOMARD_UTILS::isBoundaryDi(obj) || HOMARD_UTILS::isBoundaryAn(obj) )
534 //         {
535 //           try
536 //           { homardGen->DeleteBoundary(_ObjectName.toStdString().c_str()); }
537 //           catch( SALOME::SALOME_Exception& S_ex )
538 //           {
539 //             QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
540 //                                       QObject::tr(CORBA::string_dup(S_ex.details.text)) );
541 //             getApp()->updateObjectBrowser();
542 //             return false;
543 //           }
544 //         }
545 //         // Suppression d'un cas
546 //         else if (HOMARD_UTILS::isCase(obj))
547 //         {
548 //           try
549 //           { homardGen->DeleteCase(_ObjectName.toStdString().c_str(), 1); }
550 //           catch( SALOME::SALOME_Exception& S_ex )
551 //           {
552 //             QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
553 //                                       QObject::tr(CORBA::string_dup(S_ex.details.text)) );
554 //             getApp()->updateObjectBrowser();
555 //             return false;
556 //           }
557 //         }
558 //         // Suppression d'une hypothese
559 //         else if (HOMARD_UTILS::isHypo(obj))
560 //         {
561 //           try
562 //           { homardGen->DeleteHypo(_ObjectName.toStdString().c_str()); }
563 //           catch( SALOME::SALOME_Exception& S_ex )
564 //           {
565 //             QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
566 //                                       QObject::tr(CORBA::string_dup(S_ex.details.text)) );
567 //             getApp()->updateObjectBrowser();
568 //             return false;
569 //           }
570 //         }
571 //         // Suppression d'une iteration
572 //         else if (HOMARD_UTILS::isIter(obj))
573 //         {
574 //           try
575 //           { homardGen->DeleteIteration(_ObjectName.toStdString().c_str(), 1); }
576 //           catch( SALOME::SALOME_Exception& S_ex )
577 //           {
578 //             QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
579 //                                       QObject::tr(CORBA::string_dup(S_ex.details.text)) );
580 //             getApp()->updateObjectBrowser();
581 //             return false;
582 //           }
583 //         }
584 //         // Suppression d'un schema YACS
585 //         else if (HOMARD_UTILS::isYACS(obj))
586 //         {
587 //           try
588 //           { homardGen->DeleteYACS(_ObjectName.toStdString().c_str(), 1); }
589 //           catch( SALOME::SALOME_Exception& S_ex )
590 //           {
591 //             QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
592 //                                       QObject::tr(CORBA::string_dup(S_ex.details.text)) );
593 //             getApp()->updateObjectBrowser();
594 //             return false;
595 //           }
596 //         }
597 //         // Suppression d'une zone
598 //         else if (HOMARD_UTILS::isZone(obj))
599 //         {
600 //           try
601 //           { homardGen->DeleteZone(_ObjectName.toStdString().c_str()); }
602 //           catch( SALOME::SALOME_Exception& S_ex )
603 //           {
604 //             QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
605 //                                       QObject::tr(CORBA::string_dup(S_ex.details.text)) );
606 //             getApp()->updateObjectBrowser();
607 //             return false;
608 //           }
609 //         }
610 //       }
611 //       break;
612 //     }
613 // 
614 //     case 1301: // Information sur un maillage
615 //     {
616 //       MESSAGE("etape 1301")
617 //       MESSAGE("command " << theCommandID << " activated");
618 //       MonMeshInfo *aDlg = new MonMeshInfo( parent, true, HOMARD::HOMARD_Gen::_duplicate(homardGen) ) ;
619 //       aDlg->show();
620 //       break;
621 //     }
622 // 
623 //     case 1302: // Affichage de fichier texte
624 //     {
625 //       MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
626 //       _PTR(SObject) obj = chercheMonObjet();
627 //       if ( (obj) && ( HOMARD_UTILS::isFileType(obj,QString("log")) || HOMARD_UTILS::isFileType(obj,QString("Summary")) || HOMARD_UTILS::isFileType(obj,QString("xml")) ) )
628 //       {
629 //           MonEditFile *aDlg = new MonEditFile( 0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName, 0 ) ;
630 //           if ( aDlg->_codret == 0 ) { aDlg->show(); }
631 //       }
632 //       break;
633 //     }
634 // 
635 //     case 1401: // Création d'un schema YACS
636 //     {
637 //       MESSAGE("etape 1401")
638 //       MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
639 //       MonCreateYACS *aDlg = new MonCreateYACS( true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ;
640 //       aDlg->show();
641 //       break;
642 //     }
643 // 
644 //     case 1402: // Ecriture d'un schéma YACS
645 //     {
646 //       MESSAGE("etape 1402")
647 //       MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
648 //       try { homardGen->YACSWrite(_ObjectName.toStdString().c_str()); }
649 //       catch( SALOME::SALOME_Exception& S_ex )
650 //       {
651 //         QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
652 //                                   QObject::tr(CORBA::string_dup(S_ex.details.text)) );
653 //         getApp()->updateObjectBrowser();
654 //         return false;
655 //       }
656 //       break;
657 //     }
658 // 
659 //   }
660 //   getApp()->updateObjectBrowser();
661 //   return true;
662 // }
663 // 
664 // //=============================================================================
665 // /*!
666 //  *
667 //  */
668 // //=============================================================================
669 // 
670 // // Module's engine IOR
671 // //=============================================================================
672 // QString SMESHGUI_AdaptDlg::engineIOR() const
673 // //=============================================================================
674 // {
675 //   CORBA::String_var anIOR = getApp()->orb()->object_to_string( InitHOMARDGen(getApp()) );
676 //   return QString( anIOR.in() );
677 // }
678 // 
679 // // Module's activation
680 // //=============================================================================
681 // bool SMESHGUI_AdaptDlg::activateModule( SUIT_Study* theStudy )
682 // //=============================================================================
683 // {
684 //   bool bOk = SalomeApp_Module::activateModule( theStudy );
685 // 
686 //   setMenuShown( true );
687 //   setToolShown( true );
688 // 
689 //   return bOk;
690 // }
691 // 
692 // // Module's deactivation
693 // //=============================================================================
694 // bool SMESHGUI_AdaptDlg::deactivateModule( SUIT_Study* theStudy )
695 // //=============================================================================
696 // {
697 //   setMenuShown( false );
698 //   setToolShown( false );
699 // 
700 //   return SalomeApp_Module::deactivateModule( theStudy );
701 // }
702 // 
703 // // Default windows
704 // //=============================================================================
705 // void SMESHGUI_AdaptDlg::windows( QMap<int, int>& theMap ) const
706 // //=============================================================================
707 // {
708 //   theMap.clear();
709 //   theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
710 // #ifndef DISABLE_PYCONSOLE
711 //   theMap.insert( SalomeApp_Application::WT_PyConsole,     Qt::BottomDockWidgetArea );
712 // #endif
713 // }
714 // 
715 // //=============================================================================
716 // void SMESHGUI_AdaptDlg::setOrb()
717 // //=============================================================================
718 // {
719 //   try
720 //   {
721 //      ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
722 //      ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
723 //      _orb = init( 0 , 0 );
724 //   }
725 //   catch (...)
726 //   {
727 //      INFOS("internal error : orb not found");
728 //      _orb = 0;
729 //   }
730 //          ASSERT(! CORBA::is_nil(_orb));
731 // }
732 // //========================================
733 // _PTR(SObject) SMESHGUI_AdaptDlg::chercheMonObjet()
734 // //========================================
735 // {
736 //   SALOMEDSClient_SObject* aSO = NULL;
737 //   _PTR(SObject) obj;
738 //   SALOME_ListIO lst;
739 //   getApp()->selectionMgr()->selectedObjects( lst );
740 //   if (  lst.Extent() == 1 )
741 //   {
742 //     Handle(SALOME_InteractiveObject) io = lst.First();
743 //     SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
744 //     _PTR(Study) study = appStudy->studyDS();
745 //     _PTR(SObject) obj = study->FindObjectID( io->getEntry() );
746 //     _ObjectName = QString( obj->GetName().c_str() );
747 //     return obj;
748 //   }
749 //   else { return _PTR(SObject)(aSO); }
750 // }
751 // //=============================================================================
752 // void SMESHGUI_AdaptDlg::contextMenuPopup( const QString& client, QMenu* menu, QString& title )
753 // //=============================================================================
754 // {
755 //   MESSAGE("Debut de contextMenuPopup");
756 //   _PTR(SObject) obj = chercheMonObjet();
757 //   if ( obj )
758 //   {
759 //     title = QString( obj->GetName().c_str() );
760 //     _ObjectName = title;
761 //     SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
762 // //
763 //     QPixmap pix ;
764 //     bool DeleteObject = false ;
765 //     bool EditObject = false ;
766 // //
767 //     if ( HOMARD_UTILS::isBoundaryCAO(obj) )
768 //     {
769 //       EditObject = true ;
770 //       DeleteObject = true ;
771 //     }
772 //     else if ( HOMARD_UTILS::isBoundaryAn(obj) )
773 //     {
774 //       EditObject = true ;
775 //       DeleteObject = true ;
776 //     }
777 //     else if ( HOMARD_UTILS::isBoundaryDi(obj) )
778 //     {
779 //       EditObject = true ;
780 //       DeleteObject = true ;
781 //     }
782 //     else if ( HOMARD_UTILS::isCase(obj) )
783 //     {
784 //       pix = resMgr->loadPixmap( "HOMARD", "table_view.png" );
785 //       menu->addAction(QIcon(pix), tr(QString("HOM_MEN_YACS").toLatin1().data()), this, SLOT(YACSCreate()));
786 //       EditObject = true ;
787 //       DeleteObject = true ;
788 //     }
789 //     else if ( HOMARD_UTILS::isHypo(obj) )
790 //     {
791 //       EditObject = true ;
792 //       DeleteObject = true ;
793 //     }
794 //     else if ( HOMARD_UTILS::isIter(obj) )
795 //     {
796 //       pix = resMgr->loadPixmap( "HOMARD", "iter_next.png" );
797 //       menu->addAction(QIcon(pix), tr(QString("HOM_MEN_NEW_ITERATION").toLatin1().data()), this, SLOT(NextIter()));
798 //       pix = resMgr->loadPixmap( "HOMARD", "mesh_compute.png" );
799 //       menu->addAction(QIcon(pix), tr(QString("HOM_MEN_COMPUTE").toLatin1().data()), this, SLOT(LanceCalcul0()));
800 //       pix = resMgr->loadPixmap( "HOMARD", "mesh_compute.png" );
801 //       menu->addAction(QIcon(pix), tr(QString("HOM_MEN_COMPUTE_PUBLISH").toLatin1().data()), this, SLOT(LanceCalcul1()));
802 //       pix = resMgr->loadPixmap( "HOMARD", "advanced_mesh_info.png" );
803 //       menu->addAction(QIcon(pix), tr(QString("HOM_MEN_MESH_INFO").toLatin1().data()), this, SLOT(IterInfo()));
804 //       pix = resMgr->loadPixmap( "HOMARD", "mesh_tree_mesh.png" );
805 //       menu->addAction(QIcon(pix), tr(QString("HOM_MEN_MESH_PUBLICATION").toLatin1().data()), this, SLOT(MeshPublish0()));
806 //       EditObject = true ;
807 //       DeleteObject = true ;
808 //     }
809 //     else if ( HOMARD_UTILS::isYACS(obj) )
810 //     {
811 //       pix = resMgr->loadPixmap( "HOMARD", "write.png" );
812 //       menu->addAction(QIcon(pix), tr(QString("HOM_MEN_WRITE").toLatin1().data()), this, SLOT(YACSWrite()));
813 //       EditObject = true ;
814 //       DeleteObject = true ;
815 //     }
816 //     else if ( HOMARD_UTILS::isZone(obj) )
817 //     {
818 //       EditObject = true ;
819 //       DeleteObject = true ;
820 //     }
821 //     else if ( HOMARD_UTILS::isFileType(obj,QString("log")) || HOMARD_UTILS::isFileType(obj,QString("Summary")) || HOMARD_UTILS::isFileType(obj,QString("xml")) )
822 //     {
823 //       pix = resMgr->loadPixmap( "HOMARD", "texte.png" );
824 //       menu->addAction(QIcon(pix), tr(QString("HOM_MEN_EDIT_MESS_FILE").toLatin1().data()), this, SLOT(EditAsciiFile()));
825 //     }
826 //     else if ( HOMARD_UTILS::isFileType(obj,QString("Mesh")) )
827 //     {
828 //       pix = resMgr->loadPixmap( "HOMARD", "mesh_tree_mesh.png" );
829 //       menu->addAction(QIcon(pix), tr(QString("HOM_MEN_MESH_PUBLICATION").toLatin1().data()), this, SLOT(MeshPublish1()));
830 //     }
831 // //  Ajout d'un menu d'edition pour les objets qui le proposent
832 //     if ( EditObject )
833 //     {
834 //       pix = resMgr->loadPixmap( "HOMARD", "loop.png" );
835 //       menu->addAction(QIcon(pix), tr(QString("HOM_MEN_EDIT").toLatin1().data()), this, SLOT(Edit()));
836 //     }
837 // //  Ajout d'un menu de destruction pour les objets qui le proposent
838 //     if ( DeleteObject )
839 //     {
840 //       pix = resMgr->loadPixmap( "HOMARD", "delete.png" );
841 //       menu->addAction(QIcon(pix), tr(QString("HOM_MEN_DELETE").toLatin1().data()), this, SLOT(Delete()));
842 //     }
843 //   }
844 // }
845 // 
846 // void SMESHGUI_AdaptDlg::NextIter()
847 // {
848 //   this->OnGUIEvent(8013);
849 // }
850 // 
851 // void SMESHGUI_AdaptDlg::LanceCalcul0()
852 // {
853 //   this->OnGUIEvent(8014);
854 // }
855 // 
856 // void SMESHGUI_AdaptDlg::LanceCalcul1()
857 // {
858 //   this->OnGUIEvent(8015);
859 // }
860 // 
861 // void SMESHGUI_AdaptDlg::IterInfo()
862 // {
863 //   this->OnGUIEvent(1121);
864 // }
865 // 
866 // void SMESHGUI_AdaptDlg::MeshPublish0()
867 // {
868 //   this->OnGUIEvent(1131);
869 // }
870 // 
871 // void SMESHGUI_AdaptDlg::MeshPublish1()
872 // {
873 //   this->OnGUIEvent(1132);
874 // }
875 // 
876 // void SMESHGUI_AdaptDlg::Edit()
877 // {
878 //   this->OnGUIEvent(8016);
879 // }
880 // 
881 // void SMESHGUI_AdaptDlg::Delete()
882 // {
883 //   this->OnGUIEvent(8017);
884 // }
885 // 
886 // void SMESHGUI_AdaptDlg::EditAsciiFile()
887 // {
888 //   this->OnGUIEvent(1302);
889 // }
890 // 
891 // void SMESHGUI_AdaptDlg::YACSCreate()
892 // {
893 //   this->OnGUIEvent(1401);
894 // }
895 // void SMESHGUI_AdaptDlg::YACSWrite()
896 // {
897 //   this->OnGUIEvent(1402);
898 // }
899 // 
900
901 //
902 //=============================================================================
903 // Export the module
904 //=============================================================================
905 extern "C" {
906   Standard_EXPORT CAM_Module* createModule()
907   {
908     return new SMESHGUI_AdaptDlg("");
909   }
910 }
911