1 // Copyright (C) 2011-2020 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 email : webmaster.salome@opencascade.com
20 // SMESH SMESHGUI : GUI for the adaptation in the SMESH component
21 // File : SMESHGUI_AdaptDlg.cxx
22 // Author : Gerald NICOLAS, EDF
25 #include "SMESHGUI_AdaptDlg.h"
28 #include "Utils_ORB_INIT.hxx"
29 #include "Utils_SINGLETON.hxx"
30 #include "SALOME_LifeCycleCORBA.hxx"
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"
40 #include "CAM_Module.h"
41 #include "OB_Browser.h"
43 #include "SALOME_ListIO.hxx"
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>
55 #include <utilities.h>
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"
78 #include <boost/shared_ptr.hpp>
81 #include "SALOMEDS_Study.hxx"
82 #include "HOMARDGUI_Utils.h"
86 static CORBA::ORB_var _orb;
88 //=================================================================================
89 // function : SMESHGUI_AdaptDlg()
91 //=================================================================================
92 SMESHGUI_AdaptDlg::SMESHGUI_AdaptDlg( SMESHGUI* theModule,
96 //=======================================================================
97 // function : ~SMESHGUI_AdaptDlg()
98 // purpose : Destructor
99 //=======================================================================
100 SMESHGUI_AdaptDlg::~SMESHGUI_AdaptDlg()
104 // //=======================================================================
105 // // function : InitHOMARDGen
106 // // launch HOMARD component and return a handle
107 // //=======================================================================
108 // HOMARD::HOMARD_Gen_var SMESHGUI_AdaptDlg::InitHOMARDGen(SalomeApp_Application* app)
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));
116 // //=======================================================================
117 // // Module's initialization
118 // void SMESHGUI_AdaptDlg::initialize( CAM_Application* app )
119 // //=======================================================================
121 // SalomeApp_Module::initialize( app );
122 // InitHOMARDGen(dynamic_cast<SalomeApp_Application*>( app ));
124 // // createActions();
126 // recupPreferences();
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 )
135 // // // MESSAGE("createHOMARDAction");
137 // // QWidget* parent = application()->desktop();
138 // // SUIT_ResourceMgr* resMgr = application()->resourceMgr();
140 // // if ( icon_id.length() )
141 // // pix = resMgr->loadPixmap( "HOMARD", tr( icon_id .toLatin1().data()) );
143 // // pix = resMgr->loadPixmap( "HOMARD", tr( QString( "ICO_%1" ).arg( po_id ).toLatin1().data()), false );
144 // // if ( !pix.isNull() )
145 // // icon = QIcon( pix );
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());
151 // // createAction( id, tooltip, icon, menu, status_bar, key, parent, toggle, this, SLOT( OnGUIEvent() ) );
154 // // //================================================
155 // // // function : createAction
156 // // // constructs Homard menu
157 // // // calls createHOMARDAction for each item
158 // // //================================================
159 // // void SMESHGUI_AdaptDlg::createActions(){
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" );
169 // // createHOMARDAction( 8016, "EDIT", "loop.png" );
170 // // createHOMARDAction( 8017, "DELETE", "delete.png" );
172 // // createHOMARDAction( 1301, "MESH_INFO", "advanced_mesh_info.png" );
173 // // createHOMARDAction( 1302, "EDIT_MESS_FILE", "texte.png" );
175 // // createHOMARDAction( 1401, "YACS", "table_view.png" );
179 // //================================================
180 // // function : createPreferences
181 // //================================================
182 // void SMESHGUI_AdaptDlg::createPreferences()
184 // MESSAGE("createPreferences")
186 // int Onglet, Bloc, Pref ;
188 // Onglet = addPreference( tr( "PREF_TAB_GENERAL" ) );
189 // // Onglet = addPreference( tr( "PREF_TAB_SETTINGS" ) ) ;
191 // Bloc = addPreference( tr( "PREF_PUBLICATION" ), Onglet );
192 // setPreferenceProperty( Bloc, "columns", 1 );
194 // Pref = addPreference( tr( "PREF_PUBLICATION_MAILLAGE_IN" ), Bloc, LightApp_Preferences::Bool, "HOMARD", "publish_mesh_in" );
196 // Pref = addPreference( tr( "PREF_PUBLICATION_MAILLAGE_OUT" ), Bloc, LightApp_Preferences::Bool, "HOMARD", "publish_mesh_out" );
199 // Onglet = addPreference( tr( "PREF_YACS" ) ) ;
201 // Bloc = addPreference( tr( "PREF_YACS_MAX" ), Onglet );
202 // setPreferenceProperty( Bloc, "columns", 1 );
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 );
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 );
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 );
219 // Bloc = addPreference( tr( "PREF_YACS_CONVERGENCE" ), Onglet );
220 // setPreferenceProperty( Bloc, "columns", 1 );
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 );
231 // // //================================================
232 // // // function : createMenus
233 // // //================================================
234 // // void SMESHGUI_AdaptDlg::createMenus()
236 // // MESSAGE("createMenus")
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
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
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);
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);
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()
273 // MESSAGE("recupPreferences")
275 // // A. Declarations
277 // SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( application() );
278 // HOMARD::HOMARD_Gen_var homardGen = SMESHGUI_AdaptDlg::InitHOMARDGen(app);
280 // std::string defaut_s ;
281 // QString QString_v ;
286 // defaut_s = homardGen->GetLanguageShort();
287 // SUIT_ResourceMgr* resMgr = getApp()->resourceMgr();
288 // _LanguageShort = resMgr->stringValue("language", "language", QString(defaut_s.c_str()) );
290 // // B.2. Les publications
291 // bool publish_mesh ;
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 ; }
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 ; }
307 // // B.3. Les maximum pour YACS
309 // defaut_i = homardGen->GetYACSMaxIter();
310 // _YACSMaxIter = resMgr->integerValue("HOMARD", "yacs_max_iter", defaut_i );
312 // defaut_i = homardGen->GetYACSMaxNode();
313 // _YACSMaxNode = resMgr->integerValue("HOMARD", "yacs_max_node", defaut_i );
315 // defaut_i = homardGen->GetYACSMaxElem();
316 // _YACSMaxElem = resMgr->integerValue("HOMARD", "yacs_max_elem", defaut_i );
318 // // B.4. La convergence pour YACS
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 > VRef" ) ) { _YACSTypeTest = 1 ; }
326 // else if ( ( QString_v == "VTest < VRef" ) || ( QString_v == "VTest < VRef" ) ) { _YACSTypeTest = 2 ; }
327 // else { _YACSTypeTest = 0 ; }
329 // // C. Enregistrement dans l'objet general
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);
336 // homardGen->SetLanguageShort(_LanguageShort.toStdString().c_str());
337 // homardGen->SetPublisMesh(_PublisMeshIN, _PublisMeshOUT);
338 // homardGen->SetYACSMaximum(_YACSMaxIter, _YACSMaxNode, _YACSMaxElem);
340 // homardGen->SetYACSConvergenceType(_YACSTypeTest);
343 // //================================================
344 // void SMESHGUI_AdaptDlg::OnGUIEvent()
345 // //================================================
347 // MESSAGE("OnGUIEvent()")
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()");
356 // //=======================================================================
357 // // Method OnGUIEvent pour Homard
358 // //=======================================================================
359 // bool SMESHGUI_AdaptDlg::OnGUIEvent (int theCommandID)
361 // MESSAGE("OnGUIEvent avec theCommandID = "<<theCommandID);
363 // SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( application() );
364 // if ( !app ) return false;
366 // SalomeApp_Study* stud = dynamic_cast<SalomeApp_Study*> ( app->activeStudy() );
369 // MESSAGE ( "FAILED to cast active study to SalomeApp_Study" );
373 // SUIT_Desktop* parent = application()->desktop();
375 // HOMARD::HOMARD_Gen_var homardGen = SMESHGUI_AdaptDlg::InitHOMARDGen(app);
377 // if (!CORBA::is_nil(homardGen))
378 // homardGen->UpdateStudy();
380 // getApp()->updateObjectBrowser();
382 // // B. Choix selon les commandes
383 // SCRUTE(theCommandID);
384 // switch (theCommandID)
386 // case 8011: // Creation d un Cas
388 // MESSAGE("command " << theCommandID << " activated");
389 // MonCreateCase *aDlg = new MonCreateCase( true,
390 // HOMARD::HOMARD_Gen::_duplicate(homardGen) ) ;
395 // case 8012: // Poursuite d une iteration
397 // MESSAGE("command " << theCommandID << " activated");
398 // MonPursueIteration *aDlg = new MonPursueIteration( true,
399 // HOMARD::HOMARD_Gen::_duplicate(homardGen) ) ;
404 // case 8013: // Creation d une Iteration
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 ) ;
413 // case 8014: // Compute une iteration
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 )
419 // QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
420 // QObject::tr(CORBA::string_dup(S_ex.details.text)) );
421 // getApp()->updateObjectBrowser();
427 // case 8015: // Compute une iteration et publication
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 )
433 // QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
434 // QObject::tr(CORBA::string_dup(S_ex.details.text)) );
435 // getApp()->updateObjectBrowser();
441 // case 1121: // Information sur le maillage de l'iteration
443 // MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
444 // MonIterInfo *IterDlg = new MonIterInfo( parent, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ;
449 // case 1131: // Publication du maillage de l'iteration
451 // MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
452 // homardGen->PublishMeshIterInSmesh(_ObjectName.toStdString().c_str());
456 // case 1132: // Publication du maillage de l'iteration a partir du fichier
458 // MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
459 // homardGen->PublishResultInSmesh(_ObjectName.toStdString().c_str(), 1);
463 // case 8016: // Edition d'un objet
465 // MESSAGE("command " << theCommandID << " activated");
466 // QString nomObjet = HOMARD_QT_COMMUN::SelectionArbreEtude(QString(""), 1);
467 // if (nomObjet == QString("")) break;
468 // _PTR(SObject) obj = chercheMonObjet();
471 // // Edition d'une frontiere CAO
472 // if (HOMARD_UTILS::isBoundaryCAO(obj))
474 // MonEditBoundaryCAO *aDlg = new MonEditBoundaryCAO(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ;
477 // // Edition d'une frontiere discrete
478 // else if (HOMARD_UTILS::isBoundaryDi(obj))
480 // MonEditBoundaryDi *aDlg = new MonEditBoundaryDi(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ;
483 // // Edition d'une frontiere analytique
484 // else if (HOMARD_UTILS::isBoundaryAn(obj))
486 // MonEditBoundaryAn *aDlg = new MonEditBoundaryAn(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ;
489 // // Edition d'un cas
490 // else if (HOMARD_UTILS::isCase(obj))
492 // MonEditCase *aDlg = new MonEditCase(true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ;
495 // // Edition d'une hypothese
496 // else if (HOMARD_UTILS::isHypo(obj))
498 // MonEditHypothesis *aDlg = new MonEditHypothesis(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName, QString(""), QString("")) ;
501 // // Edition d'une iteration
502 // else if (HOMARD_UTILS::isIter(obj))
504 // MonEditIteration *aDlg = new MonEditIteration(parent, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ;
507 // // Edition d'un schema YACS
508 // else if (HOMARD_UTILS::isYACS(obj))
510 // MESSAGE("appel de MonEditYACS");
511 // MonEditYACS *aDlg = new MonEditYACS(true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName) ;
514 // // Edition d'une zone
515 // else if (HOMARD_UTILS::isZone(obj))
517 // MonEditZone *aDlg = new MonEditZone(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ;
524 // case 8017: // Suppression d'un objet
526 // MESSAGE("command " << theCommandID << " activated");
527 // QString nomObjet = HOMARD_QT_COMMUN::SelectionArbreEtude(QString(""), 1);
528 // if (nomObjet == QString("")) break;
529 // _PTR(SObject) obj = chercheMonObjet();
532 // // Suppression d'une frontiere
533 // if ( HOMARD_UTILS::isBoundaryCAO(obj) || HOMARD_UTILS::isBoundaryDi(obj) || HOMARD_UTILS::isBoundaryAn(obj) )
536 // { homardGen->DeleteBoundary(_ObjectName.toStdString().c_str()); }
537 // catch( SALOME::SALOME_Exception& S_ex )
539 // QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
540 // QObject::tr(CORBA::string_dup(S_ex.details.text)) );
541 // getApp()->updateObjectBrowser();
545 // // Suppression d'un cas
546 // else if (HOMARD_UTILS::isCase(obj))
549 // { homardGen->DeleteCase(_ObjectName.toStdString().c_str(), 1); }
550 // catch( SALOME::SALOME_Exception& S_ex )
552 // QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
553 // QObject::tr(CORBA::string_dup(S_ex.details.text)) );
554 // getApp()->updateObjectBrowser();
558 // // Suppression d'une hypothese
559 // else if (HOMARD_UTILS::isHypo(obj))
562 // { homardGen->DeleteHypo(_ObjectName.toStdString().c_str()); }
563 // catch( SALOME::SALOME_Exception& S_ex )
565 // QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
566 // QObject::tr(CORBA::string_dup(S_ex.details.text)) );
567 // getApp()->updateObjectBrowser();
571 // // Suppression d'une iteration
572 // else if (HOMARD_UTILS::isIter(obj))
575 // { homardGen->DeleteIteration(_ObjectName.toStdString().c_str(), 1); }
576 // catch( SALOME::SALOME_Exception& S_ex )
578 // QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
579 // QObject::tr(CORBA::string_dup(S_ex.details.text)) );
580 // getApp()->updateObjectBrowser();
584 // // Suppression d'un schema YACS
585 // else if (HOMARD_UTILS::isYACS(obj))
588 // { homardGen->DeleteYACS(_ObjectName.toStdString().c_str(), 1); }
589 // catch( SALOME::SALOME_Exception& S_ex )
591 // QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
592 // QObject::tr(CORBA::string_dup(S_ex.details.text)) );
593 // getApp()->updateObjectBrowser();
597 // // Suppression d'une zone
598 // else if (HOMARD_UTILS::isZone(obj))
601 // { homardGen->DeleteZone(_ObjectName.toStdString().c_str()); }
602 // catch( SALOME::SALOME_Exception& S_ex )
604 // QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
605 // QObject::tr(CORBA::string_dup(S_ex.details.text)) );
606 // getApp()->updateObjectBrowser();
614 // case 1301: // Information sur un maillage
616 // MESSAGE("etape 1301")
617 // MESSAGE("command " << theCommandID << " activated");
618 // MonMeshInfo *aDlg = new MonMeshInfo( parent, true, HOMARD::HOMARD_Gen::_duplicate(homardGen) ) ;
623 // case 1302: // Affichage de fichier texte
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")) ) )
629 // MonEditFile *aDlg = new MonEditFile( 0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName, 0 ) ;
630 // if ( aDlg->_codret == 0 ) { aDlg->show(); }
635 // case 1401: // Création d'un schema YACS
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 ) ;
644 // case 1402: // Ecriture d'un schéma YACS
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 )
651 // QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
652 // QObject::tr(CORBA::string_dup(S_ex.details.text)) );
653 // getApp()->updateObjectBrowser();
660 // getApp()->updateObjectBrowser();
664 // //=============================================================================
668 // //=============================================================================
670 // // Module's engine IOR
671 // //=============================================================================
672 // QString SMESHGUI_AdaptDlg::engineIOR() const
673 // //=============================================================================
675 // CORBA::String_var anIOR = getApp()->orb()->object_to_string( InitHOMARDGen(getApp()) );
676 // return QString( anIOR.in() );
679 // // Module's activation
680 // //=============================================================================
681 // bool SMESHGUI_AdaptDlg::activateModule( SUIT_Study* theStudy )
682 // //=============================================================================
684 // bool bOk = SalomeApp_Module::activateModule( theStudy );
686 // setMenuShown( true );
687 // setToolShown( true );
692 // // Module's deactivation
693 // //=============================================================================
694 // bool SMESHGUI_AdaptDlg::deactivateModule( SUIT_Study* theStudy )
695 // //=============================================================================
697 // setMenuShown( false );
698 // setToolShown( false );
700 // return SalomeApp_Module::deactivateModule( theStudy );
703 // // Default windows
704 // //=============================================================================
705 // void SMESHGUI_AdaptDlg::windows( QMap<int, int>& theMap ) const
706 // //=============================================================================
709 // theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
710 // #ifndef DISABLE_PYCONSOLE
711 // theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
715 // //=============================================================================
716 // void SMESHGUI_AdaptDlg::setOrb()
717 // //=============================================================================
721 // ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
722 // ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
723 // _orb = init( 0 , 0 );
727 // INFOS("internal error : orb not found");
730 // ASSERT(! CORBA::is_nil(_orb));
732 // //========================================
733 // _PTR(SObject) SMESHGUI_AdaptDlg::chercheMonObjet()
734 // //========================================
736 // SALOMEDSClient_SObject* aSO = NULL;
737 // _PTR(SObject) obj;
738 // SALOME_ListIO lst;
739 // getApp()->selectionMgr()->selectedObjects( lst );
740 // if ( lst.Extent() == 1 )
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() );
749 // else { return _PTR(SObject)(aSO); }
751 // //=============================================================================
752 // void SMESHGUI_AdaptDlg::contextMenuPopup( const QString& client, QMenu* menu, QString& title )
753 // //=============================================================================
755 // MESSAGE("Debut de contextMenuPopup");
756 // _PTR(SObject) obj = chercheMonObjet();
759 // title = QString( obj->GetName().c_str() );
760 // _ObjectName = title;
761 // SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
764 // bool DeleteObject = false ;
765 // bool EditObject = false ;
767 // if ( HOMARD_UTILS::isBoundaryCAO(obj) )
769 // EditObject = true ;
770 // DeleteObject = true ;
772 // else if ( HOMARD_UTILS::isBoundaryAn(obj) )
774 // EditObject = true ;
775 // DeleteObject = true ;
777 // else if ( HOMARD_UTILS::isBoundaryDi(obj) )
779 // EditObject = true ;
780 // DeleteObject = true ;
782 // else if ( HOMARD_UTILS::isCase(obj) )
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 ;
789 // else if ( HOMARD_UTILS::isHypo(obj) )
791 // EditObject = true ;
792 // DeleteObject = true ;
794 // else if ( HOMARD_UTILS::isIter(obj) )
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 ;
809 // else if ( HOMARD_UTILS::isYACS(obj) )
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 ;
816 // else if ( HOMARD_UTILS::isZone(obj) )
818 // EditObject = true ;
819 // DeleteObject = true ;
821 // else if ( HOMARD_UTILS::isFileType(obj,QString("log")) || HOMARD_UTILS::isFileType(obj,QString("Summary")) || HOMARD_UTILS::isFileType(obj,QString("xml")) )
823 // pix = resMgr->loadPixmap( "HOMARD", "texte.png" );
824 // menu->addAction(QIcon(pix), tr(QString("HOM_MEN_EDIT_MESS_FILE").toLatin1().data()), this, SLOT(EditAsciiFile()));
826 // else if ( HOMARD_UTILS::isFileType(obj,QString("Mesh")) )
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()));
831 // // Ajout d'un menu d'edition pour les objets qui le proposent
834 // pix = resMgr->loadPixmap( "HOMARD", "loop.png" );
835 // menu->addAction(QIcon(pix), tr(QString("HOM_MEN_EDIT").toLatin1().data()), this, SLOT(Edit()));
837 // // Ajout d'un menu de destruction pour les objets qui le proposent
838 // if ( DeleteObject )
840 // pix = resMgr->loadPixmap( "HOMARD", "delete.png" );
841 // menu->addAction(QIcon(pix), tr(QString("HOM_MEN_DELETE").toLatin1().data()), this, SLOT(Delete()));
846 // void SMESHGUI_AdaptDlg::NextIter()
848 // this->OnGUIEvent(8013);
851 // void SMESHGUI_AdaptDlg::LanceCalcul0()
853 // this->OnGUIEvent(8014);
856 // void SMESHGUI_AdaptDlg::LanceCalcul1()
858 // this->OnGUIEvent(8015);
861 // void SMESHGUI_AdaptDlg::IterInfo()
863 // this->OnGUIEvent(1121);
866 // void SMESHGUI_AdaptDlg::MeshPublish0()
868 // this->OnGUIEvent(1131);
871 // void SMESHGUI_AdaptDlg::MeshPublish1()
873 // this->OnGUIEvent(1132);
876 // void SMESHGUI_AdaptDlg::Edit()
878 // this->OnGUIEvent(8016);
881 // void SMESHGUI_AdaptDlg::Delete()
883 // this->OnGUIEvent(8017);
886 // void SMESHGUI_AdaptDlg::EditAsciiFile()
888 // this->OnGUIEvent(1302);
891 // void SMESHGUI_AdaptDlg::YACSCreate()
893 // this->OnGUIEvent(1401);
895 // void SMESHGUI_AdaptDlg::YACSWrite()
897 // this->OnGUIEvent(1402);
902 //=============================================================================
904 //=============================================================================
906 Standard_EXPORT CAM_Module* createModule()
908 return new SMESHGUI_AdaptDlg("");