source: PSPA/Interface_Web/trunk/pspaWT/src/GWt_initialBeam.cc @ 106

Last change on this file since 106 was 106, checked in by touze, 12 years ago

gestion des elts etiquetes

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