source: PSPA/Interface_Web/trunk/pspaWT/src/GWt_rfgun.cc @ 199

Last change on this file since 199 was 156, checked in by lemeur, 12 years ago

renommage GWt_initialBeam en GWt_rfgun

File size: 2.1 KB
Line 
1#include "GWt_rfgun.h"
2
3#include <Wt/WText>
4#include <Wt/WLineEdit>
5#include <Wt/WBreak>
6#include <Wt/WDialog>
7#include <Wt/WPushButton>
8
9GWt_rfgun::GWt_rfgun(PspaApplication* ps,abstractElement* elem) : GWt_abstractElement(ps,elem)
10{
11  string* param = element_-> getParametersString();
12  if ( param == NULL )
13    {
14      pspa_->addConsoleMessage(" GWt_rfgun : empty parameter set");
15    }
16  int nbparam = atoi(param[0].c_str());
17  if ( nbparam != 6 ) 
18    {
19      pspa_->addConsoleMessage(" element seems not to be a initialBeam");
20    }
21
22  dialog_ = new WDialog("element initialBeam");
23
24  new WText("nr of macroparticles : ",dialog_->contents());
25  nmacropEdit_ = new WLineEdit(param[1].c_str(), dialog_->contents());
26  new WBreak(dialog_->contents());
27
28  new WText("sigma_t (ps) : ",dialog_->contents());
29  sigma_tEdit_ = new WLineEdit(param[2].c_str(), dialog_->contents());
30  new WBreak(dialog_->contents());
31
32  new WText("sigma_r (cm) : ",dialog_->contents());
33  sigma_rEdit_ = new WLineEdit(param[3].c_str(), dialog_->contents());
34  new WBreak(dialog_->contents());
35
36  new WText("initial kinetic energy (MeV) : ",dialog_->contents());
37  E_cinEdit_ = new WLineEdit(param[4].c_str(), dialog_->contents());
38  new WBreak(dialog_->contents());
39
40  new WText("sigma_Ecin (MeV) : ",dialog_->contents());
41  sigma_EEdit_ = new WLineEdit(param[5].c_str(), dialog_->contents());
42  new WBreak(dialog_->contents());
43
44  new WText("true number of part. in beam : ",dialog_->contents());
45  nb_true_particlesEdit_ = new WLineEdit(param[6].c_str(), dialog_->contents());
46
47  // Submit
48  WPushButton *submit = new WPushButton("OK",dialog_->contents());
49  submit->clicked().connect(dialog_, &Wt::WDialog::accept);
50  dialog_->finished().connect(this, &GWt_rfgun::dialogDone);
51}
52
53void GWt_rfgun::dialogDone()
54{
55  string envoi[7];
56  envoi[0] = string("6");
57  envoi[1] = nmacropEdit_->text().toUTF8();
58  envoi[2] = sigma_tEdit_->text().toUTF8();
59  envoi[3] = sigma_rEdit_->text().toUTF8();
60  envoi[4] = E_cinEdit_->text().toUTF8();
61  envoi[5] = sigma_EEdit_->text().toUTF8();
62  envoi[6] = nb_true_particlesEdit_->text().toUTF8();
63
64  element_->setParametersString(envoi);
65}
Note: See TracBrowser for help on using the repository browser.