1 | |
---|
2 | #include "GWt_bend.h" |
---|
3 | |
---|
4 | #include <Wt/WText> |
---|
5 | #include <Wt/WLineEdit> |
---|
6 | #include <Wt/WBreak> |
---|
7 | #include <Wt/WDialog> |
---|
8 | #include <Wt/WPushButton> |
---|
9 | |
---|
10 | GWt_bend::GWt_bend(PspaApplication* ps,abstractElement* elem) : GWt_abstractElement(ps,elem) |
---|
11 | { |
---|
12 | string* param = element_-> getParametersString(); |
---|
13 | if ( param == NULL ) |
---|
14 | { |
---|
15 | pspa_->addConsoleMessage(" GWt_bend : empty parameter set"); |
---|
16 | } |
---|
17 | int nbparam = atoi(param[0].c_str()); |
---|
18 | if ( nbparam != element_->getNbParams() ) |
---|
19 | { |
---|
20 | pspa_->addConsoleMessage(WString(" element uncoherently programmed for munmber of parameters: bend ")); |
---|
21 | } |
---|
22 | |
---|
23 | dialog_ = new WDialog("element : bend"); |
---|
24 | |
---|
25 | new WText("angle (deg.) : ",dialog_->contents()); |
---|
26 | angleEdit_ = new WLineEdit(param[1].c_str(), dialog_->contents()); |
---|
27 | new WBreak(dialog_->contents()); |
---|
28 | |
---|
29 | new WText("radius (m) : ",dialog_->contents()); |
---|
30 | radiusEdit_ = new WLineEdit(param[2].c_str(), dialog_->contents()); |
---|
31 | new WBreak(dialog_->contents()); |
---|
32 | |
---|
33 | new WText("length (cm) : ",dialog_->contents()); |
---|
34 | xlengthEdit_ = new WLineEdit("0", dialog_->contents()); |
---|
35 | xlengthEdit_->setDisabled(true); |
---|
36 | new WBreak(dialog_->contents()); |
---|
37 | |
---|
38 | new WText("aperture (cm) : ",dialog_->contents()); |
---|
39 | apertureEdit_ = new WLineEdit(param[3].c_str(), dialog_->contents()); |
---|
40 | apertureEdit_->setDisabled(true); |
---|
41 | new WBreak(dialog_->contents()); |
---|
42 | |
---|
43 | new WText("pole face rotations (deg.) entrance : ",dialog_->contents()); |
---|
44 | beta1Edit_ = new WLineEdit(param[4].c_str(), dialog_->contents()); |
---|
45 | new WText("exit : ",dialog_->contents()); |
---|
46 | beta2Edit_ = new WLineEdit(param[5].c_str(), dialog_->contents()); |
---|
47 | new WBreak(dialog_->contents()); |
---|
48 | |
---|
49 | WPushButton *submit = new WPushButton("OK",dialog_->contents()); |
---|
50 | submit->clicked().connect(dialog_, &Wt::WDialog::accept); |
---|
51 | dialog_->finished().connect(this, &GWt_bend::dialogDone); |
---|
52 | } |
---|
53 | |
---|
54 | void GWt_bend::dialogDone() |
---|
55 | { |
---|
56 | string envoi[6]; |
---|
57 | envoi[0] = string("5"); |
---|
58 | envoi[1] = angleEdit_->text().toUTF8(); |
---|
59 | envoi[2] = radiusEdit_->text().toUTF8(); |
---|
60 | envoi[3] = apertureEdit_->text().toUTF8(); |
---|
61 | envoi[4] = beta1Edit_->text().toUTF8(); |
---|
62 | envoi[5] = beta2Edit_->text().toUTF8(); |
---|
63 | element_->setParametersString(envoi); |
---|
64 | } |
---|