source: PSPA/Interface_Web/trunk/pspaWT/src/GWt_beam.cc @ 225

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

element 'fit' + label en parametre

File size: 2.5 KB
Line 
1#include "GWt_beam.h"
2#include "mixedTools.h"
3
4#include <Wt/WText>
5#include <Wt/WLineEdit>
6#include <Wt/WBreak>
7#include <Wt/WDialog>
8#include <Wt/WPushButton>
9
10GWt_beam::GWt_beam(PspaApplication* ps,abstractElement* elem) : GWt_abstractElement(ps,elem) {
11
12
13  string* param = beginDialog();
14
15  new WText(" 1/2 horizontal beam extend rms (cm) : ",dialog_->contents());
16  xEdit_ = new WLineEdit(param->c_str(), dialog_->contents());
17  //  new WBreak(dialog_->contents());
18
19  new WText("1/2 horizontal beam divergence rms (mrad) : ",dialog_->contents());
20  xpEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
21  new WBreak(dialog_->contents());
22
23  new WText("1/2 vertical beam extend rms (cm) : ",dialog_->contents());
24  yEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
25  //  new WBreak(dialog_->contents());
26
27  new WText("1/2 horizontal beam divergence rms (mrad) : ",dialog_->contents());
28  ypEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
29  new WBreak(dialog_->contents());
30
31  new WText("1/2 longitudinal beam extend rms (cm) : ",dialog_->contents());
32  dlEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
33  //  new WBreak(dialog_->contents());
34
35  new WText("1/2 momentum spread rms (mrad) : ",dialog_->contents());
36  delEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
37  new WBreak(dialog_->contents());
38
39  new WText("momentum of the central trajectory (GeV/c) : ",dialog_->contents());
40  p0Edit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
41  new WBreak(dialog_->contents());
42
43  WPushButton *submit = new WPushButton("OK",dialog_->contents());
44  submit->clicked().connect(dialog_, &Wt::WDialog::accept);
45  dialog_->finished().connect(this, &GWt_beam::dialogDone);
46}
47
48void GWt_beam::dialogDone()
49{
50  unsigned nbParam = element_->getNbParams();
51  string* envoi = new string[nbParam+1];
52  int compteur = -1;
53  envoi[++compteur] = mixedTools::intToString(nbParam);
54  envoi[++compteur] = labelEdit_->text().toUTF8();
55  envoi[++compteur] = xEdit_->text().toUTF8();
56  envoi[++compteur] = xpEdit_->text().toUTF8();
57  envoi[++compteur] = yEdit_->text().toUTF8();
58  envoi[++compteur] = ypEdit_->text().toUTF8();
59  envoi[++compteur] = dlEdit_->text().toUTF8();
60  envoi[++compteur] = delEdit_->text().toUTF8();
61  envoi[++compteur] = p0Edit_->text().toUTF8();
62  if ( compteur !=  (int)nbParam ) {
63    cerr << " GWt_beam::dialogDone() pb nb de parametres, compteur = " << compteur << " nbParam= " << nbParam << endl;
64    return;
65  }
66  element_->setParametersString(envoi);
67  delete [] envoi;
68}
69
Note: See TracBrowser for help on using the repository browser.