// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// SMESH SMESHGUI : GUI for the adaptation in the SMESH component
+// SMESH SMESHGUI : GUI for the adaptation in the SMESH component
// File : SMESHGUI_AdaptDlg.cxx
// Author : Gerald NICOLAS, EDF
-// ADAPTGUI includes
-//
-#include "SMESHGUI_AdaptDlg.h"
-// SALOME Includes
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
-#include "SALOME_LifeCycleCORBA.hxx"
+// SMESH includes
+#include "SMESHGUI.h"
+#include "SMESHGUI_AdaptDlg.h"
+// SALOME GUI includes
#include <SUIT_Desktop.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
-#include <SUIT_MessageBox.h>
-#include <SUIT_OverrideCursor.h>
-#include "SUIT_ViewWindow.h"
-#include "SUIT_ViewManager.h"
-
-#include "CAM_Module.h"
-#include "OB_Browser.h"
+#include <SalomeApp_Application.h>
+#include <SalomeApp_Study.h>
-#include "SALOME_ListIO.hxx"
+// HOMARD includes
+// #include "MonCreateCase.h"
-#include "SalomeApp_Application.h"
-#include "SalomeApp_DataModel.h"
-#include "SalomeApp_Study.h"
-#include "LightApp_SelectionMgr.h"
-#include "LightApp_Selection.h"
-#include <LightApp_Preferences.h>
-#include "SalomeApp_Module.h"
-#include "SALOMEconfig.h"
+// SALOME KERNEL includes
+#include "utilities.h"
#include <SALOME_LifeCycleCORBA.hxx>
-#include <utilities.h>
-
-
-// QT Includes
-#include <QMenu>
-#include "MonCreateCase.h"
-#include "MonCreateIteration.h"
-#include "MonPursueIteration.h"
-#include "MonCreateYACS.h"
-#include "MonEditBoundaryCAO.h"
-#include "MonEditBoundaryAn.h"
-#include "MonEditBoundaryDi.h"
-#include "MonEditCase.h"
-#include "MonEditHypothesis.h"
-#include "MonEditIteration.h"
-#include "MonEditYACS.h"
-#include "MonEditZone.h"
-#include "MonMeshInfo.h"
-#include "MonIterInfo.h"
-#include "MonEditFile.h"
-#include "HomardQtCommun.h"
-
-// BOOST Includes
-#include <boost/shared_ptr.hpp>
-
-//Pour le _CAST
-#include "SALOMEDS_Study.hxx"
-#include "HOMARDGUI_Utils.h"
-
-using namespace std;
-
-static CORBA::ORB_var _orb;
-
//=================================================================================
// function : SMESHGUI_AdaptDlg()
// purpose :
//=================================================================================
SMESHGUI_AdaptDlg::SMESHGUI_AdaptDlg( SMESHGUI* theModule,
- int theCommandID )
+ int theCommandID,
+ SMESH::SMESH_Mesh_ptr theMesh )
+ : mySMESHGUI( theModule )
{
+ action( theCommandID ) ;
}
-//=======================================================================
+
+//=================================================================================
// function : ~SMESHGUI_AdaptDlg()
-// purpose : Destructor
-//=======================================================================
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
SMESHGUI_AdaptDlg::~SMESHGUI_AdaptDlg()
{
}
-// //=======================================================================
-// // function : InitHOMARDGen
-// // launch HOMARD component and return a handle
-// //=======================================================================
-// HOMARD::HOMARD_Gen_var SMESHGUI_AdaptDlg::InitHOMARDGen(SalomeApp_Application* app)
-// {
-// Engines::EngineComponent_var comp = app->lcc()->FindOrLoad_Component( "FactoryServer","HOMARD" );
-// HOMARD::HOMARD_Gen_var clr = HOMARD::HOMARD_Gen::_narrow(comp);
-// ASSERT(!CORBA::is_nil(clr));
-// return clr;
-// }
-//
-// //=======================================================================
-// // Module's initialization
-// void SMESHGUI_AdaptDlg::initialize( CAM_Application* app )
-// //=======================================================================
-// {
-// SalomeApp_Module::initialize( app );
-// InitHOMARDGen(dynamic_cast<SalomeApp_Application*>( app ));
-// anId = 0;
-// // createActions();
-// // createMenus();
+/*!
+ * \brief Pilote les actions d'adaption de maillage
+ * \param
+ * \return bool OK/notOK
+*/
+void SMESHGUI_AdaptDlg::action (int theCommandID)
+//=======================================================================
+{
+ std::cout << "SMESHGUI_AdaptDlg::action avec theCommandID : " << theCommandID << std::endl;
+
+// Preferences
// recupPreferences();
-// }
-//
-// // //================================================
-// // // function : createHOMARDAction
-// // // create an item in status bar and Homard menu
-// // //================================================
-// // void SMESHGUI_AdaptDlg::createHOMARDAction( const int id, const QString& po_id, const QString& icon_id, const int key, const bool toggle )
-// // {
-// // // MESSAGE("createHOMARDAction");
-// // QIcon icon;
-// // QWidget* parent = application()->desktop();
-// // SUIT_ResourceMgr* resMgr = application()->resourceMgr();
-// // QPixmap pix;
-// // if ( icon_id.length() )
-// // pix = resMgr->loadPixmap( "HOMARD", tr( icon_id .toLatin1().data()) );
-// // else
-// // pix = resMgr->loadPixmap( "HOMARD", tr( QString( "ICO_%1" ).arg( po_id ).toLatin1().data()), false );
-// // if ( !pix.isNull() )
-// // icon = QIcon( pix );
-// //
-// // QString tooltip = tr(QString( "HOM_TOP_%1" ).arg( po_id ).toLatin1().data()),
-// // menu = tr(QString( "HOM_MEN_%1" ).arg( po_id ).toLatin1().data()),
-// // status_bar = tr(QString( "HOM_STB_%1" ).arg( po_id ).toLatin1().data());
-// //
-// // createAction( id, tooltip, icon, menu, status_bar, key, parent, toggle, this, SLOT( OnGUIEvent() ) );
-// // }
-//
-// // //================================================
-// // // function : createAction
-// // // constructs Homard menu
-// // // calls createHOMARDAction for each item
-// // //================================================
-// // void SMESHGUI_AdaptDlg::createActions(){
-// // //
-// // createHOMARDAction( 8011, "NEW_CASE", "cas_calcule.png" );
-// // createHOMARDAction( 8012, "PURSUE_ITERATION", "iter_poursuite.png" );
-// // createHOMARDAction( 8013, "NEW_ITERATION", "iter_next.png" );
-// // createHOMARDAction( 8014, "COMPUTE", "mesh_compute.png" );
-// // createHOMARDAction( 8015, "COMPUTE_PUBLISH", "mesh_compute.png" );
-// // createHOMARDAction( 1121, "MESH_INFO", "advanced_mesh_info.png" );
-// // createHOMARDAction( 1131, "MESH_PUBLICATION", "mesh_tree_mesh.png" );
-// // //
-// // createHOMARDAction( 8016, "EDIT", "loop.png" );
-// // createHOMARDAction( 8017, "DELETE", "delete.png" );
-// // //
-// // createHOMARDAction( 1301, "MESH_INFO", "advanced_mesh_info.png" );
-// // createHOMARDAction( 1302, "EDIT_MESS_FILE", "texte.png" );
-// // //
-// // createHOMARDAction( 1401, "YACS", "table_view.png" );
-// // //
-// // }
-//
-// //================================================
-// // function : createPreferences
-// //================================================
-// void SMESHGUI_AdaptDlg::createPreferences()
-// {
-// MESSAGE("createPreferences")
-//
-// int Onglet, Bloc, Pref ;
-// // 1. Generalites
-// Onglet = addPreference( tr( "PREF_TAB_GENERAL" ) );
-// // Onglet = addPreference( tr( "PREF_TAB_SETTINGS" ) ) ;
-//
-// Bloc = addPreference( tr( "PREF_PUBLICATION" ), Onglet );
-// setPreferenceProperty( Bloc, "columns", 1 );
-//
-// Pref = addPreference( tr( "PREF_PUBLICATION_MAILLAGE_IN" ), Bloc, LightApp_Preferences::Bool, "HOMARD", "publish_mesh_in" );
-//
-// Pref = addPreference( tr( "PREF_PUBLICATION_MAILLAGE_OUT" ), Bloc, LightApp_Preferences::Bool, "HOMARD", "publish_mesh_out" );
-//
-// // 2. YACS
-// Onglet = addPreference( tr( "PREF_YACS" ) ) ;
-//
-// Bloc = addPreference( tr( "PREF_YACS_MAX" ), Onglet );
-// setPreferenceProperty( Bloc, "columns", 1 );
-//
-// Pref = addPreference( tr( "PREF_YACS_MAX_ITER" ), Bloc, LightApp_Preferences::IntSpin, "HOMARD", "yacs_max_iter" );
-// setPreferenceProperty( Pref, "min", 0 );
-// setPreferenceProperty( Pref, "max", 100000000 );
-// setPreferenceProperty( Pref, "step", 1 );
-//
-// Pref = addPreference( tr( "PREF_YACS_MAX_NODE" ), Bloc, LightApp_Preferences::IntSpin, "HOMARD", "yacs_max_node" );
-// setPreferenceProperty( Pref, "min", 0 );
-// setPreferenceProperty( Pref, "max", 100000000 );
-// setPreferenceProperty( Pref, "step", 1000 );
-//
-// Pref = addPreference( tr( "PREF_YACS_MAX_ELEM" ), Bloc, LightApp_Preferences::IntSpin, "HOMARD", "yacs_max_elem" );
-// setPreferenceProperty( Pref, "min", 0 );
-// setPreferenceProperty( Pref, "max", 100000000 );
-// setPreferenceProperty( Pref, "step", 1000 );
-//
-// Bloc = addPreference( tr( "PREF_YACS_CONVERGENCE" ), Onglet );
-// setPreferenceProperty( Bloc, "columns", 1 );
-//
-// Pref = addPreference( tr( "PREF_YACS_TYPE_TEST" ), Bloc, LightApp_Preferences::Selector, "HOMARD", "yacs_type_test" );
-// QStringList aListOfTypeTest;
-// aListOfTypeTest << "None";
-// aListOfTypeTest << "VTest > VRef";
-// aListOfTypeTest << "VTest < VRef";
-// setPreferenceProperty( Pref, "strings", aListOfTypeTest );
-// }
-//
-//
-// // //================================================
-// // // function : createMenus
-// // //================================================
-// // void SMESHGUI_AdaptDlg::createMenus()
-// // {
-// // MESSAGE("createMenus")
-// // //
-// // int HOMARD_Id = createMenu( tr( "HOM_MEN_HOMARD" ), -1, 5, 10 );
-// // createMenu( 8011, HOMARD_Id, -1 ); //Create_Case
-// // createMenu( 8012, HOMARD_Id, -1 ); //Pursue_Iteration
-// // createMenu( separator(), HOMARD_Id,-1);
-// // createMenu( 8013, HOMARD_Id, -1 ); //Create_Iteration
-// // createMenu( 8014, HOMARD_Id, -1 ); //Compute
-// // createMenu( 8015, HOMARD_Id, -1 ); //Compute and publish
-// // //
-// // HOMARD_Id = createMenu( tr( "HOM_MEN_MODIFICATION" ), -1, 5, 10 );
-// // createMenu( 8016, HOMARD_Id, -1 ); //Edit
-// // createMenu( 8017, HOMARD_Id, -1 ); //Delete
-// // //
-// // HOMARD_Id = createMenu( tr( "HOM_MEN_INFORMATION" ), -1, 5, 10 );
-// // createMenu( 1301, HOMARD_Id, -1 ); //Information sur un maillage
-// // createMenu( 1131, HOMARD_Id, -1 ); //Mesh publication
-// // createMenu( separator(), HOMARD_Id,-1);
-// // createMenu( 1302, HOMARD_Id, -1 ); //EditAsciiFile pour le fichier listeStd ou bilan
-// // createMenu( separator(), HOMARD_Id,-1);
-// // createMenu( 8016, HOMARD_Id, -1 ); //Edit
-// // createMenu( separator(), HOMARD_Id,-1);
-// // //
-// // HOMARD_Id = createMenu( tr( "HOM_MEN_YACS" ), -1, 5, 10 );
-// // createMenu( 1401, HOMARD_Id, -1 ); // Création d'un schéma YACS
-// // createMenu( separator(), HOMARD_Id,-1);
-// // }
-//
-// //================================================
-// // function : recupPreferences
-// // Pour chaque valeur, le defaut est la valeur definie dans HOMARD_Gen
-// // . Si la recuperation dans config/salome s'est bien passee a la creation de HOMARD_Gen,
-// // ces valeurs sont les valeurs definies.
-// // . Si cela ne s'est pas bien passe, ce sont les valeurs par defaut de HOMARD_Gen
-// //================================================
+
+// Menus and actions
+ bool ok = OnGUIEvent (theCommandID) ;
+ if ( ! ok ) INFOS("Erreur");
+
+ return ;
+}
+
+// /*!
+// * \brief Gets the preferences for the adaptation
+// * \param
+// * \return
+// *
+// * Pour chaque valeur, le defaut est la valeur definie dans ADAPT_Gen
+// * . Si la recuperation dans config/salome s'est bien passee a la creation de ADAPT_Gen
+// * ces valeurs sont les valeurs definies.
+// * . Si cela ne s'est pas bien passe, ce sont les valeurs par defaut de ADAPT_Gen
+// */
// void SMESHGUI_AdaptDlg::recupPreferences()
// {
-// MESSAGE("recupPreferences")
+// INFOS("Début de recupPreferences")
// //
// // A. Declarations
// //
-// SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( application() );
-// HOMARD::HOMARD_Gen_var homardGen = SMESHGUI_AdaptDlg::InitHOMARDGen(app);
-// int defaut_i ;
-// std::string defaut_s ;
-// QString QString_v ;
-// //
+// SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+// SALOME_LifeCycleCORBA* ls = new SALOME_LifeCycleCORBA(app->namingService());
+// Engines::EngineComponent_var comp = ls->FindOrLoad_Component("FactoryServer", "SMESH");
+// ADAPT::ADAPT_Gen_var adaptGen = ADAPT::ADAPT_Gen::_narrow(comp);
+// if (!CORBA::is_nil(adaptGen))
+// adaptGen->UpdateStudy();
+//
+// SUIT_ResourceMgr* resMgr = mySMESHGUI->getApp()->resourceMgr();
+//
// // B. Les valeurs
// // B.1. La langue
-// //
-// defaut_s = homardGen->GetLanguageShort();
-// SUIT_ResourceMgr* resMgr = getApp()->resourceMgr();
-// _LanguageShort = resMgr->stringValue("language", "language", QString(defaut_s.c_str()) );
-// //
-// // B.2. Les publications
+//
+// _LanguageShort = resMgr->stringValue("language", "language", "en" );
+// INFOS ("Enregistrement de LanguageShort = " << _LanguageShort.toStdString().c_str() );
+// // adaptGen->SetLanguageShort(_LanguageShort.toStdString().c_str());
+//
+// // B.2. Les publications avec HOMARD
// bool publish_mesh ;
-// //
-// _PublisMeshIN = homardGen->GetPublisMeshIN();
-// if ( _PublisMeshIN == 1 ) { publish_mesh = true ; }
-// else { publish_mesh = false ; }
-// publish_mesh = resMgr->booleanValue("HOMARD", "publish_mesh_in", publish_mesh );
+//
+// publish_mesh = resMgr->booleanValue("HOMARD", "homard_publish_mesh_in", false );
// if ( publish_mesh ) { _PublisMeshIN = 1 ; }
// else { _PublisMeshIN = 0 ; }
-// //
-// _PublisMeshOUT = homardGen->GetPublisMeshOUT();
-// if ( _PublisMeshOUT == 1 ) { publish_mesh = true ; }
-// else { publish_mesh = false ; }
-// publish_mesh = resMgr->booleanValue("HOMARD", "publish_mesh_out", publish_mesh );
+//
+// publish_mesh = resMgr->booleanValue("HOMARD", "homard_publish_mesh_out", false );
// if ( publish_mesh ) { _PublisMeshOUT = 1 ; }
// else { _PublisMeshOUT = 0 ; }
-// //
-// // B.3. Les maximum pour YACS
-// //
-// defaut_i = homardGen->GetYACSMaxIter();
-// _YACSMaxIter = resMgr->integerValue("HOMARD", "yacs_max_iter", defaut_i );
-// //
-// defaut_i = homardGen->GetYACSMaxNode();
-// _YACSMaxNode = resMgr->integerValue("HOMARD", "yacs_max_node", defaut_i );
-// //
-// defaut_i = homardGen->GetYACSMaxElem();
-// _YACSMaxElem = resMgr->integerValue("HOMARD", "yacs_max_elem", defaut_i );
-// //
-// // B.4. La convergence pour YACS
-// //
-// defaut_i = homardGen->GetYACSConvergenceType();
-// if ( defaut_i == 1 ) { QString_v = tr("VTest > VRef") ; }
-// else if ( defaut_i == 2 ) { QString_v = tr("VTest < VRef") ; }
-// else { QString_v = tr("None") ; }
-// QString_v = resMgr->stringValue ( "HOMARD", "yacs_type_test", QString_v );
+//
+// INFOS ("Enregistrement de PublisMeshIN = " << _PublisMeshIN<<", PublisMeshOUT = "<< _PublisMeshOUT);
+// // adaptGen->SetPublisMesh(_PublisMeshIN, _PublisMeshOUT);
+//
+// // B.3. Les maximum pour YACS avec HOMARD
+//
+// _YACSMaxIter = resMgr->integerValue("HOMARD", "homard_yacs_max_iter", 0 );
+// _YACSMaxNode = resMgr->integerValue("HOMARD", "homard_yacs_max_node", 0 );
+// _YACSMaxElem = resMgr->integerValue("HOMARD", "homard_yacs_max_elem", 0 );
+//
+// INFOS ("Enregistrement de YACSMaxIter = " << _YACSMaxIter<<", YACSMaxNode = "<< _YACSMaxNode<<", YACSMaxElem = "<< _YACSMaxElem);
+// // adaptGen->SetYACSMaximum(_YACSMaxIter, _YACSMaxNode, _YACSMaxElem);
+//
+// // B.4. La convergence pour YACS avec HOMARD
+//
+// QString QString_v = resMgr->stringValue ( "HOMARD", "homard_yacs_type_test", "None" );
// if ( ( QString_v == "VTest > VRef" ) || ( QString_v == "VTest > VRef" ) ) { _YACSTypeTest = 1 ; }
// else if ( ( QString_v == "VTest < VRef" ) || ( QString_v == "VTest < VRef" ) ) { _YACSTypeTest = 2 ; }
// else { _YACSTypeTest = 0 ; }
-// //
-// // C. Enregistrement dans l'objet general
-// //
-// MESSAGE ("Enregistrement de LanguageShort = " << _LanguageShort.toStdString().c_str() );
-// MESSAGE ("Enregistrement de PublisMeshIN = " << _PublisMeshIN<<", PublisMeshOUT = "<< _PublisMeshOUT);
-// MESSAGE ("Enregistrement de YACSMaxIter = " << _YACSMaxIter<<", YACSMaxNode = "<< _YACSMaxNode<<", YACSMaxElem = "<< _YACSMaxElem);
-// MESSAGE ("Enregistrement de YACSTypeTest = " << _YACSTypeTest);
-// //
-// homardGen->SetLanguageShort(_LanguageShort.toStdString().c_str());
-// homardGen->SetPublisMesh(_PublisMeshIN, _PublisMeshOUT);
-// homardGen->SetYACSMaximum(_YACSMaxIter, _YACSMaxNode, _YACSMaxElem);
-// //
-// homardGen->SetYACSConvergenceType(_YACSTypeTest);
-// }
-//
-// //================================================
-// void SMESHGUI_AdaptDlg::OnGUIEvent()
-// //================================================
-// {
-// MESSAGE("OnGUIEvent()")
-// setOrb();
-// const QObject* obj = sender();
-// if ( !obj || !obj->inherits( "QAction" ) ) { return; }
-// int id = actionId((QAction*)obj);
-// if ( id != -1 ) { bool ret = OnGUIEvent( id ); }
-// MESSAGE("Fin de OnGUIEvent()");
-// }
-//
-// //=======================================================================
-// // Method OnGUIEvent pour Homard
-// //=======================================================================
-// bool SMESHGUI_AdaptDlg::OnGUIEvent (int theCommandID)
-// {
-// MESSAGE("OnGUIEvent avec theCommandID = "<<theCommandID);
-// // A. Controles
-// SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( application() );
-// if ( !app ) return false;
-//
-// SalomeApp_Study* stud = dynamic_cast<SalomeApp_Study*> ( app->activeStudy() );
-// if ( !stud )
-// {
-// MESSAGE ( "FAILED to cast active study to SalomeApp_Study" );
-// return false;
-// }
-//
-// SUIT_Desktop* parent = application()->desktop();
-//
-// HOMARD::HOMARD_Gen_var homardGen = SMESHGUI_AdaptDlg::InitHOMARDGen(app);
-//
-// if (!CORBA::is_nil(homardGen))
-// homardGen->UpdateStudy();
-//
-// getApp()->updateObjectBrowser();
-//
-// // B. Choix selon les commandes
-// SCRUTE(theCommandID);
-// switch (theCommandID)
-// {
-// case 8011: // Creation d un Cas
-// {
-// MESSAGE("command " << theCommandID << " activated");
-// MonCreateCase *aDlg = new MonCreateCase( true,
-// HOMARD::HOMARD_Gen::_duplicate(homardGen) ) ;
-// aDlg->show();
-// break;
-// }
-//
-// case 8012: // Poursuite d une iteration
-// {
-// MESSAGE("command " << theCommandID << " activated");
-// MonPursueIteration *aDlg = new MonPursueIteration( true,
-// HOMARD::HOMARD_Gen::_duplicate(homardGen) ) ;
-// aDlg->show();
-// break;
-// }
-//
-// case 8013: // Creation d une Iteration
-// {
-// MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
-// MonCreateIteration *IterDlg = new MonCreateIteration( parent, true,
-// HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ;
-// IterDlg->show();
-// break;
-// }
-//
-// case 8014: // Compute une iteration
-// {
-// MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
-// try { homardGen->Compute(_ObjectName.toStdString().c_str(), 0, 1, -1, 1); }
-// catch( SALOME::SALOME_Exception& S_ex )
-// {
-// QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
-// QObject::tr(CORBA::string_dup(S_ex.details.text)) );
-// getApp()->updateObjectBrowser();
-// return false;
-// }
-// break;
-// }
-//
-// case 8015: // Compute une iteration et publication
-// {
-// MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
-// try { homardGen->Compute(_ObjectName.toStdString().c_str(), 0, 1, -1, 2); }
-// catch( SALOME::SALOME_Exception& S_ex )
-// {
-// QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
-// QObject::tr(CORBA::string_dup(S_ex.details.text)) );
-// getApp()->updateObjectBrowser();
-// return false;
-// }
-// break;
-// }
-//
-// case 1121: // Information sur le maillage de l'iteration
-// {
-// MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
-// MonIterInfo *IterDlg = new MonIterInfo( parent, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ;
-// IterDlg->show();
-// break;
-// }
-//
-// case 1131: // Publication du maillage de l'iteration
-// {
-// MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
-// homardGen->PublishMeshIterInSmesh(_ObjectName.toStdString().c_str());
-// break;
-// }
-//
-// case 1132: // Publication du maillage de l'iteration a partir du fichier
-// {
-// MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
-// homardGen->PublishResultInSmesh(_ObjectName.toStdString().c_str(), 1);
-// break;
-// }
-//
-// case 8016: // Edition d'un objet
-// {
-// MESSAGE("command " << theCommandID << " activated");
-// QString nomObjet = HOMARD_QT_COMMUN::SelectionArbreEtude(QString(""), 1);
-// if (nomObjet == QString("")) break;
-// _PTR(SObject) obj = chercheMonObjet();
-// if (obj)
-// {
-// // Edition d'une frontiere CAO
-// if (HOMARD_UTILS::isBoundaryCAO(obj))
-// {
-// MonEditBoundaryCAO *aDlg = new MonEditBoundaryCAO(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ;
-// aDlg->show();
-// }
-// // Edition d'une frontiere discrete
-// else if (HOMARD_UTILS::isBoundaryDi(obj))
-// {
-// MonEditBoundaryDi *aDlg = new MonEditBoundaryDi(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ;
-// aDlg->show();
-// }
-// // Edition d'une frontiere analytique
-// else if (HOMARD_UTILS::isBoundaryAn(obj))
-// {
-// MonEditBoundaryAn *aDlg = new MonEditBoundaryAn(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ;
-// aDlg->show();
-// }
-// // Edition d'un cas
-// else if (HOMARD_UTILS::isCase(obj))
-// {
-// MonEditCase *aDlg = new MonEditCase(true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ;
-// aDlg->show();
-// }
-// // Edition d'une hypothese
-// else if (HOMARD_UTILS::isHypo(obj))
-// {
-// MonEditHypothesis *aDlg = new MonEditHypothesis(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName, QString(""), QString("")) ;
-// aDlg->show();
-// }
-// // Edition d'une iteration
-// else if (HOMARD_UTILS::isIter(obj))
-// {
-// MonEditIteration *aDlg = new MonEditIteration(parent, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ;
-// aDlg->show();
-// }
-// // Edition d'un schema YACS
-// else if (HOMARD_UTILS::isYACS(obj))
-// {
-// MESSAGE("appel de MonEditYACS");
-// MonEditYACS *aDlg = new MonEditYACS(true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName) ;
-// aDlg->show();
-// }
-// // Edition d'une zone
-// else if (HOMARD_UTILS::isZone(obj))
-// {
-// MonEditZone *aDlg = new MonEditZone(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ;
-// aDlg->show();
-// }
-// }
-// break;
-// }
-//
-// case 8017: // Suppression d'un objet
-// {
-// MESSAGE("command " << theCommandID << " activated");
-// QString nomObjet = HOMARD_QT_COMMUN::SelectionArbreEtude(QString(""), 1);
-// if (nomObjet == QString("")) break;
-// _PTR(SObject) obj = chercheMonObjet();
-// if (obj)
-// {
-// // Suppression d'une frontiere
-// if ( HOMARD_UTILS::isBoundaryCAO(obj) || HOMARD_UTILS::isBoundaryDi(obj) || HOMARD_UTILS::isBoundaryAn(obj) )
-// {
-// try
-// { homardGen->DeleteBoundary(_ObjectName.toStdString().c_str()); }
-// catch( SALOME::SALOME_Exception& S_ex )
-// {
-// QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
-// QObject::tr(CORBA::string_dup(S_ex.details.text)) );
-// getApp()->updateObjectBrowser();
-// return false;
-// }
-// }
-// // Suppression d'un cas
-// else if (HOMARD_UTILS::isCase(obj))
-// {
-// try
-// { homardGen->DeleteCase(_ObjectName.toStdString().c_str(), 1); }
-// catch( SALOME::SALOME_Exception& S_ex )
-// {
-// QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
-// QObject::tr(CORBA::string_dup(S_ex.details.text)) );
-// getApp()->updateObjectBrowser();
-// return false;
-// }
-// }
-// // Suppression d'une hypothese
-// else if (HOMARD_UTILS::isHypo(obj))
-// {
-// try
-// { homardGen->DeleteHypo(_ObjectName.toStdString().c_str()); }
-// catch( SALOME::SALOME_Exception& S_ex )
-// {
-// QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
-// QObject::tr(CORBA::string_dup(S_ex.details.text)) );
-// getApp()->updateObjectBrowser();
-// return false;
-// }
-// }
-// // Suppression d'une iteration
-// else if (HOMARD_UTILS::isIter(obj))
-// {
-// try
-// { homardGen->DeleteIteration(_ObjectName.toStdString().c_str(), 1); }
-// catch( SALOME::SALOME_Exception& S_ex )
-// {
-// QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
-// QObject::tr(CORBA::string_dup(S_ex.details.text)) );
-// getApp()->updateObjectBrowser();
-// return false;
-// }
-// }
-// // Suppression d'un schema YACS
-// else if (HOMARD_UTILS::isYACS(obj))
-// {
-// try
-// { homardGen->DeleteYACS(_ObjectName.toStdString().c_str(), 1); }
-// catch( SALOME::SALOME_Exception& S_ex )
-// {
-// QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
-// QObject::tr(CORBA::string_dup(S_ex.details.text)) );
-// getApp()->updateObjectBrowser();
-// return false;
-// }
-// }
-// // Suppression d'une zone
-// else if (HOMARD_UTILS::isZone(obj))
-// {
-// try
-// { homardGen->DeleteZone(_ObjectName.toStdString().c_str()); }
-// catch( SALOME::SALOME_Exception& S_ex )
-// {
-// QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
-// QObject::tr(CORBA::string_dup(S_ex.details.text)) );
-// getApp()->updateObjectBrowser();
-// return false;
-// }
-// }
-// }
-// break;
-// }
-//
-// case 1301: // Information sur un maillage
-// {
-// MESSAGE("etape 1301")
-// MESSAGE("command " << theCommandID << " activated");
-// MonMeshInfo *aDlg = new MonMeshInfo( parent, true, HOMARD::HOMARD_Gen::_duplicate(homardGen) ) ;
-// aDlg->show();
-// break;
-// }
-//
-// case 1302: // Affichage de fichier texte
-// {
-// MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
-// _PTR(SObject) obj = chercheMonObjet();
-// if ( (obj) && ( HOMARD_UTILS::isFileType(obj,QString("log")) || HOMARD_UTILS::isFileType(obj,QString("Summary")) || HOMARD_UTILS::isFileType(obj,QString("xml")) ) )
-// {
-// MonEditFile *aDlg = new MonEditFile( 0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName, 0 ) ;
-// if ( aDlg->_codret == 0 ) { aDlg->show(); }
-// }
-// break;
-// }
-//
-// case 1401: // Création d'un schema YACS
-// {
-// MESSAGE("etape 1401")
-// MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
-// MonCreateYACS *aDlg = new MonCreateYACS( true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ;
-// aDlg->show();
-// break;
-// }
-//
-// case 1402: // Ecriture d'un schéma YACS
-// {
-// MESSAGE("etape 1402")
-// MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
-// try { homardGen->YACSWrite(_ObjectName.toStdString().c_str()); }
-// catch( SALOME::SALOME_Exception& S_ex )
-// {
-// QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
-// QObject::tr(CORBA::string_dup(S_ex.details.text)) );
-// getApp()->updateObjectBrowser();
-// return false;
-// }
-// break;
-// }
-//
-// }
-// getApp()->updateObjectBrowser();
-// return true;
-// }
-//
-// //=============================================================================
-// /*!
-// *
-// */
-// //=============================================================================
-//
-// // Module's engine IOR
-// //=============================================================================
-// QString SMESHGUI_AdaptDlg::engineIOR() const
-// //=============================================================================
-// {
-// CORBA::String_var anIOR = getApp()->orb()->object_to_string( InitHOMARDGen(getApp()) );
-// return QString( anIOR.in() );
-// }
-//
-// // Module's activation
-// //=============================================================================
-// bool SMESHGUI_AdaptDlg::activateModule( SUIT_Study* theStudy )
-// //=============================================================================
-// {
-// bool bOk = SalomeApp_Module::activateModule( theStudy );
-//
-// setMenuShown( true );
-// setToolShown( true );
-//
-// return bOk;
-// }
-//
-// // Module's deactivation
-// //=============================================================================
-// bool SMESHGUI_AdaptDlg::deactivateModule( SUIT_Study* theStudy )
-// //=============================================================================
-// {
-// setMenuShown( false );
-// setToolShown( false );
-//
-// return SalomeApp_Module::deactivateModule( theStudy );
-// }
-//
-// // Default windows
-// //=============================================================================
-// void SMESHGUI_AdaptDlg::windows( QMap<int, int>& theMap ) const
-// //=============================================================================
-// {
-// theMap.clear();
-// theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
-// #ifndef DISABLE_PYCONSOLE
-// theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
-// #endif
-// }
-//
-// //=============================================================================
-// void SMESHGUI_AdaptDlg::setOrb()
-// //=============================================================================
-// {
-// try
-// {
-// ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
-// ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
-// _orb = init( 0 , 0 );
-// }
-// catch (...)
-// {
-// INFOS("internal error : orb not found");
-// _orb = 0;
-// }
-// ASSERT(! CORBA::is_nil(_orb));
-// }
-// //========================================
-// _PTR(SObject) SMESHGUI_AdaptDlg::chercheMonObjet()
-// //========================================
-// {
-// SALOMEDSClient_SObject* aSO = NULL;
-// _PTR(SObject) obj;
-// SALOME_ListIO lst;
-// getApp()->selectionMgr()->selectedObjects( lst );
-// if ( lst.Extent() == 1 )
-// {
-// Handle(SALOME_InteractiveObject) io = lst.First();
-// SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
-// _PTR(Study) study = appStudy->studyDS();
-// _PTR(SObject) obj = study->FindObjectID( io->getEntry() );
-// _ObjectName = QString( obj->GetName().c_str() );
-// return obj;
-// }
-// else { return _PTR(SObject)(aSO); }
-// }
-// //=============================================================================
-// void SMESHGUI_AdaptDlg::contextMenuPopup( const QString& client, QMenu* menu, QString& title )
-// //=============================================================================
-// {
-// MESSAGE("Debut de contextMenuPopup");
-// _PTR(SObject) obj = chercheMonObjet();
-// if ( obj )
-// {
-// title = QString( obj->GetName().c_str() );
-// _ObjectName = title;
-// SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
-// //
-// QPixmap pix ;
-// bool DeleteObject = false ;
-// bool EditObject = false ;
-// //
-// if ( HOMARD_UTILS::isBoundaryCAO(obj) )
-// {
-// EditObject = true ;
-// DeleteObject = true ;
-// }
-// else if ( HOMARD_UTILS::isBoundaryAn(obj) )
-// {
-// EditObject = true ;
-// DeleteObject = true ;
-// }
-// else if ( HOMARD_UTILS::isBoundaryDi(obj) )
-// {
-// EditObject = true ;
-// DeleteObject = true ;
-// }
-// else if ( HOMARD_UTILS::isCase(obj) )
-// {
-// pix = resMgr->loadPixmap( "HOMARD", "table_view.png" );
-// menu->addAction(QIcon(pix), tr(QString("HOM_MEN_YACS").toLatin1().data()), this, SLOT(YACSCreate()));
-// EditObject = true ;
-// DeleteObject = true ;
-// }
-// else if ( HOMARD_UTILS::isHypo(obj) )
-// {
-// EditObject = true ;
-// DeleteObject = true ;
-// }
-// else if ( HOMARD_UTILS::isIter(obj) )
-// {
-// pix = resMgr->loadPixmap( "HOMARD", "iter_next.png" );
-// menu->addAction(QIcon(pix), tr(QString("HOM_MEN_NEW_ITERATION").toLatin1().data()), this, SLOT(NextIter()));
-// pix = resMgr->loadPixmap( "HOMARD", "mesh_compute.png" );
-// menu->addAction(QIcon(pix), tr(QString("HOM_MEN_COMPUTE").toLatin1().data()), this, SLOT(LanceCalcul0()));
-// pix = resMgr->loadPixmap( "HOMARD", "mesh_compute.png" );
-// menu->addAction(QIcon(pix), tr(QString("HOM_MEN_COMPUTE_PUBLISH").toLatin1().data()), this, SLOT(LanceCalcul1()));
-// pix = resMgr->loadPixmap( "HOMARD", "advanced_mesh_info.png" );
-// menu->addAction(QIcon(pix), tr(QString("HOM_MEN_MESH_INFO").toLatin1().data()), this, SLOT(IterInfo()));
-// pix = resMgr->loadPixmap( "HOMARD", "mesh_tree_mesh.png" );
-// menu->addAction(QIcon(pix), tr(QString("HOM_MEN_MESH_PUBLICATION").toLatin1().data()), this, SLOT(MeshPublish0()));
-// EditObject = true ;
-// DeleteObject = true ;
-// }
-// else if ( HOMARD_UTILS::isYACS(obj) )
-// {
-// pix = resMgr->loadPixmap( "HOMARD", "write.png" );
-// menu->addAction(QIcon(pix), tr(QString("HOM_MEN_WRITE").toLatin1().data()), this, SLOT(YACSWrite()));
-// EditObject = true ;
-// DeleteObject = true ;
-// }
-// else if ( HOMARD_UTILS::isZone(obj) )
-// {
-// EditObject = true ;
-// DeleteObject = true ;
-// }
-// else if ( HOMARD_UTILS::isFileType(obj,QString("log")) || HOMARD_UTILS::isFileType(obj,QString("Summary")) || HOMARD_UTILS::isFileType(obj,QString("xml")) )
-// {
-// pix = resMgr->loadPixmap( "HOMARD", "texte.png" );
-// menu->addAction(QIcon(pix), tr(QString("HOM_MEN_EDIT_MESS_FILE").toLatin1().data()), this, SLOT(EditAsciiFile()));
-// }
-// else if ( HOMARD_UTILS::isFileType(obj,QString("Mesh")) )
-// {
-// pix = resMgr->loadPixmap( "HOMARD", "mesh_tree_mesh.png" );
-// menu->addAction(QIcon(pix), tr(QString("HOM_MEN_MESH_PUBLICATION").toLatin1().data()), this, SLOT(MeshPublish1()));
-// }
-// // Ajout d'un menu d'edition pour les objets qui le proposent
-// if ( EditObject )
-// {
-// pix = resMgr->loadPixmap( "HOMARD", "loop.png" );
-// menu->addAction(QIcon(pix), tr(QString("HOM_MEN_EDIT").toLatin1().data()), this, SLOT(Edit()));
-// }
-// // Ajout d'un menu de destruction pour les objets qui le proposent
-// if ( DeleteObject )
-// {
-// pix = resMgr->loadPixmap( "HOMARD", "delete.png" );
-// menu->addAction(QIcon(pix), tr(QString("HOM_MEN_DELETE").toLatin1().data()), this, SLOT(Delete()));
-// }
-// }
-// }
-//
-// void SMESHGUI_AdaptDlg::NextIter()
-// {
-// this->OnGUIEvent(8013);
-// }
-//
-// void SMESHGUI_AdaptDlg::LanceCalcul0()
-// {
-// this->OnGUIEvent(8014);
-// }
-//
-// void SMESHGUI_AdaptDlg::LanceCalcul1()
-// {
-// this->OnGUIEvent(8015);
-// }
-//
-// void SMESHGUI_AdaptDlg::IterInfo()
-// {
-// this->OnGUIEvent(1121);
-// }
-//
-// void SMESHGUI_AdaptDlg::MeshPublish0()
-// {
-// this->OnGUIEvent(1131);
-// }
-//
-// void SMESHGUI_AdaptDlg::MeshPublish1()
-// {
-// this->OnGUIEvent(1132);
-// }
-//
-// void SMESHGUI_AdaptDlg::Edit()
-// {
-// this->OnGUIEvent(8016);
-// }
-//
-// void SMESHGUI_AdaptDlg::Delete()
-// {
-// this->OnGUIEvent(8017);
-// }
-//
-// void SMESHGUI_AdaptDlg::EditAsciiFile()
-// {
-// this->OnGUIEvent(1302);
-// }
-//
-// void SMESHGUI_AdaptDlg::YACSCreate()
-// {
-// this->OnGUIEvent(1401);
-// }
-// void SMESHGUI_AdaptDlg::YACSWrite()
-// {
-// this->OnGUIEvent(1402);
+//
+// INFOS ("Enregistrement de YACSTypeTest = " << _YACSTypeTest);
+// // adaptGen->SetYACSConvergenceType(_YACSTypeTest);
+//
// }
-//
+/*!
+ * \brief Launches the GUI for the adaptation
+ * \param theCommandID - the integer that references the operation
+ * \return bool OK/notOK
+*/
+bool SMESHGUI_AdaptDlg::OnGUIEvent (int theCommandID)
+{
+ std::cout << "OnGUIEvent avec theCommandID : " << theCommandID << std::endl;
+// A. Controles
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ if ( !app ) return false;
+
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*> ( app->activeStudy() );
+ if ( !aStudy )
+ {
+ INFOS ( "FAILED to cast active study to SalomeApp_Study" );
+ return false;
+ }
+
+ SUIT_Desktop* parent = SUIT_Session::session()->activeApplication()->desktop();
+
+ SALOME_LifeCycleCORBA* ls = new SALOME_LifeCycleCORBA(app->namingService());
+ Engines::EngineComponent_var comp = ls->FindOrLoad_Component("FactoryServer", "SMESH");
+// ADAPT::ADAPT_Gen_var adaptGen = ADAPT::ADAPT_Gen::_narrow(comp);
+// if (!CORBA::is_nil(adaptGen))
+// adaptGen->UpdateStudy();
+
+ mySMESHGUI->getApp()->updateObjectBrowser();
//
-//=============================================================================
-// Export the module
-//=============================================================================
-extern "C" {
- Standard_EXPORT CAM_Module* createModule()
+// B. Choix selon les commandes
+ bool ok = true ;
+ SCRUTE(theCommandID);
+ switch (theCommandID)
{
- return new SMESHGUI_AdaptDlg("");
+ case 8000: // Raffinement uniforme
+ {
+ INFOS("Raffinement uniforme");
+// A faire
+ break;
+ }
+ case 8011: // Création d'un Cas
+ {
+ INFOS("Création d'un Cas");
+// MonCreateCase *aDlg = new MonCreateCase( true,
+// ADAPT::ADAPT_Gen::_duplicate(adaptGen) ) ;
+// aDlg->show();
+ break;
+ }
+ case 8012: // Création d'un cas en poursuite d'une itération
+ {
+ INFOS("Création d'un cas en poursuite d'une itération");
+// A faire
+ break;
+ }
+ case 8013: // Création d'une itération
+ {
+ INFOS("Création d'une itération" );
+// A faire
+ break;
+ }
+ case 8014: // Calcule une itération
+ {
+ INFOS("Calcule une itération" );
+// A faire
+ break;
+ }
+ case 8015: // Calcule une itération et publication
+ {
+ INFOS("Calcule une itération et publication");
+// A faire
+ break;
+ }
+ case 8020: // Adaptation avec MG-Adpat
+ {
+ INFOS("Interface avec MG-Adapt" );
+// A faire
+ break;
+ }
+
}
+ mySMESHGUI->getApp()->updateObjectBrowser();
+ return ok;
}
+
+