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 #include "MonIterInfo.h"
23 #include <QTextStream>
24 #include <QFileDialog>
25 #include <QMessageBox>
27 #include "SalomeApp_Tools.h"
28 #include "HOMARDGUI_Utils.h"
29 #include "HomardQtCommun.h"
30 #include "MonEditFile.h"
31 #include <utilities.h>
35 // -----------------------------------------------------------------------------------------
36 MonIterInfo::MonIterInfo(QWidget* parent, bool modal, ADAPT::ADAPT_Gen_var myAdaptGen0, QString IterName)
37 // -----------------------------------------------------------------------------------------
38 /* Constructs a MonIterInfo
39 * Inherits from CasHomard
40 * Sets attributes to default values
53 MESSAGE("appel de _duplicate");
54 myAdaptGen=ADAPT::ADAPT_Gen::_duplicate(myAdaptGen0);
62 // ------------------------------------------------------------------------
63 MonIterInfo::~MonIterInfo()
64 // ------------------------------------------------------------------------
66 // no need to delete child widgets, Qt does it all for us
68 // ------------------------------------------------------------------------
69 void MonIterInfo::InitConnect()
70 // ------------------------------------------------------------------------
72 MESSAGE("InitConnect");
73 connect( CBBlockSize, SIGNAL(stateChanged(int)), this, SLOT(SetBlockSize()));
74 connect( CBConnection, SIGNAL(stateChanged(int)), this, SLOT(SetConnection()));
75 connect( CBDiametre, SIGNAL(stateChanged(int)), this, SLOT(SetDiametre()));
76 connect( CBEntanglement, SIGNAL(stateChanged(int)), this, SLOT(SetEntanglement()));
77 connect( CBQuality, SIGNAL(stateChanged(int)), this, SLOT(SetQuality()));
79 connect( buttonOk, SIGNAL(pressed()), this, SLOT(PushOnOK()));
80 connect( buttonApply, SIGNAL(pressed()), this, SLOT(PushOnApply()));
81 connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close()));
82 connect( buttonHelp, SIGNAL(pressed()), this, SLOT(PushOnHelp()));
84 // -------------------------------
85 bool MonIterInfo::PushOnApply()
86 // --------------------------------
88 MESSAGE("PushOnApply");
90 // Au moins une option a ete choisie
91 if ( ( _Quality == 0 ) && ( _Diametre == 0 ) && ( _Connection == 0 ) && ( _BlockSize == 0 ) && ( _Entanglement == 0 ) )
93 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
94 QObject::tr("HOM_MESH_INFO_1") );
98 // Recuperation de l'iteration
99 aIter = myAdaptGen->GetIteration(_IterName.toStdString().c_str()) ;
101 // Lancement de l'analyse
104 aIter->MeshInfoOption( _Quality, _Diametre, _Connection, _BlockSize, _Entanglement, _Option );
106 catch( SALOME::SALOME_Exception& S_ex )
108 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
109 QObject::tr(CORBA::string_dup(S_ex.details.text)) );
113 // Le bilan de l'analyse a afficher
114 QString aFileName = aIter->GetFileInfo() ;
115 MonEditFile *aDlg = new MonEditFile( 0, true, ADAPT::ADAPT_Gen::_duplicate(myAdaptGen), aFileName, 0 ) ;
116 if ( aDlg->_codret == 0 ) { aDlg->show(); }
119 HOMARD_UTILS::updateObjBrowser();
122 // ---------------------------
123 void MonIterInfo::PushOnOK()
124 // ---------------------------
126 bool bOK = PushOnApply();
127 if ( bOK ) this->close();
129 //------------------------------
130 void MonIterInfo::PushOnHelp()
131 //-------------------------------
133 std::string LanguageShort = myAdaptGen->GetLanguageShort();
134 HOMARD_UTILS::PushOnHelp(QString("gui_mesh_info.html"), QString(""), QString(LanguageShort.c_str()));
136 // ------------------------------------------------------------------------
137 void MonIterInfo::SetBlockSize()
138 // ------------------------------------------------------------------------
140 MESSAGE("Debut de SetBlockSize ");
141 if ( CBBlockSize->isChecked() ) { _BlockSize = 1 ; }
142 else { _BlockSize = 0 ; }
144 // ------------------------------------------------------------------------
145 void MonIterInfo::SetConnection()
146 // ------------------------------------------------------------------------
148 MESSAGE("Debut de SetConnection ");
149 if ( CBConnection->isChecked() ) { _Connection = 1 ; }
150 else { _Connection = 0 ; }
152 // ------------------------------------------------------------------------
153 void MonIterInfo::SetDiametre()
154 // ------------------------------------------------------------------------
156 MESSAGE("Debut de SetDiametre ");
157 if ( CBDiametre->isChecked() ) { _Diametre = 1 ; }
158 else { _Diametre = 0 ; }
160 // ------------------------------------------------------------------------
161 void MonIterInfo::SetEntanglement()
162 // ------------------------------------------------------------------------
164 MESSAGE("Debut de SetEntanglement ");
165 if ( CBEntanglement->isChecked() ) { _Entanglement = 1 ; }
166 else { _Entanglement = 0 ; }
168 // ------------------------------------------------------------------------
169 void MonIterInfo::SetQuality()
170 // ------------------------------------------------------------------------
172 MESSAGE("Debut de SetQuality ");
173 if ( CBQuality->isChecked() ) { _Quality = 1 ; }
174 else { _Quality = 0 ; }