source: PSPA/Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_bend.cc @ 305

Last change on this file since 305 was 305, checked in by garnier, 11 years ago

Suppression de la classe "elementsCollection" et bug fixed #20

File size: 2.8 KB
Line 
1
2#include "GWt_bend.h"
3#include "mixedTools.h"
4
5#include <Wt/WText>
6#include <Wt/WLineEdit>
7#include <Wt/WBreak>
8#include <Wt/WDialog>
9#include <Wt/WPushButton>
10
11GWt_bend::GWt_bend(GWt_elementLigneFaisceau* elemLigne )
12:GWt_abstractElement(new elementBend())
13{
14    elementLigneFaiseauContainer_ = elemLigne;
15    string* param = beginDialog();
16   
17    new WText("angle (deg.) : ",dialog_->contents());
18    angleEdit_ = new WLineEdit( param->c_str(), dialog_->contents());
19    new WBreak(dialog_->contents());
20   
21    new WText("radius (m) : ",dialog_->contents());
22    radiusEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
23    new WBreak(dialog_->contents());
24   
25    new WText("momentum (MeV/c) : ",dialog_->contents());
26    momentumEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
27    new WBreak(dialog_->contents());
28   
29    new WText("length (cm) : ",dialog_->contents());
30    xlengthEdit_ = new WLineEdit("0", dialog_->contents());
31    xlengthEdit_->setDisabled(true);
32    new WBreak(dialog_->contents());
33   
34    new WText("aperture (cm) : ",dialog_->contents());
35    apertureEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
36    apertureEdit_->setDisabled(true);
37    new WBreak(dialog_->contents());
38   
39    new WText("pole face rotations (deg.) entrance : ",dialog_->contents());
40    beta1Edit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
41    new WText("exit : ",dialog_->contents());
42    beta2Edit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
43    new WBreak(dialog_->contents());
44   
45    WPushButton *submit = new WPushButton("OK",dialog_->contents());
46    submit->clicked().connect(dialog_, &Wt::WDialog::accept);
47    dialog_->finished().connect(this, &GWt_bend::dialogDone);
48   
49    initialize();
50}
51
52void GWt_bend::dialogDone()
53{
54    unsigned nbParam = abstractElement_->getNbParams();
55    string* envoi = new string[nbParam+1];
56    int compteur = -1;
57    envoi[++compteur] = string(mixedTools::intToString(nbParam) );
58    envoi[++compteur] = labelEdit_->text().toUTF8();
59    cout << " GWt_bend::dialogDone() j'envoie " << envoi[compteur] << endl;
60    envoi[++compteur] = angleEdit_->text().toUTF8();
61    envoi[++compteur] = radiusEdit_->text().toUTF8();
62    envoi[++compteur] = momentumEdit_->text().toUTF8();
63    envoi[++compteur] = apertureEdit_->text().toUTF8();
64    envoi[++compteur] = beta1Edit_->text().toUTF8();
65    envoi[++compteur] = beta2Edit_->text().toUTF8();
66   
67    if ( compteur !=  (int)nbParam ) {
68        cerr << " GWt_bend::dialogDone() pb nb de parametres, compteur = " << compteur << " nbParam= " << nbParam << endl;
69        return;
70    }
71    abstractElement_->setParametersString(envoi);
72    updateLabelWidget();
73    delete [] envoi;
74}
75
76
77WImage* GWt_bend::getImage() {
78    return image_;
79}
80
81
82WString GWt_bend::print(){
83    return WString(abstractElement_->print());
84}
Note: See TracBrowser for help on using the repository browser.