#include "GWt_beam.h" #include #include #include #include #include GWt_beam::GWt_beam(PspaApplication* ps,abstractElement* elem) : GWt_abstractElement(ps,elem) { string* param = element_-> getParametersString(); if ( param == NULL ) { pspa_->addConsoleMessage(" GWt_beam : empty parameter set"); } int nbparam = atoi(param[0].c_str()); if ( nbparam != element_->getNbParams() ) { pspa_->addConsoleMessage(WString(" element uncoherently programmed for number of parameters: beam ")); } dialog_ = new WDialog("element : beam"); new WText(" 1/2 horizontal beam extend rms (cm) : ",dialog_->contents()); xEdit_ = new WLineEdit(param[1].c_str(), dialog_->contents()); // new WBreak(dialog_->contents()); new WText("1/2 horizontal beam divergence rms (mrad) : ",dialog_->contents()); xpEdit_ = new WLineEdit(param[2].c_str(), dialog_->contents()); new WBreak(dialog_->contents()); new WText("1/2 vertical beam extend rms (cm) : ",dialog_->contents()); yEdit_ = new WLineEdit(param[3].c_str(), dialog_->contents()); // new WBreak(dialog_->contents()); new WText("1/2 horizontal beam divergence rms (mrad) : ",dialog_->contents()); ypEdit_ = new WLineEdit(param[4].c_str(), dialog_->contents()); new WBreak(dialog_->contents()); new WText("1/2 longitudinal beam extend rms (cm) : ",dialog_->contents()); dlEdit_ = new WLineEdit(param[5].c_str(), dialog_->contents()); // new WBreak(dialog_->contents()); new WText("1/2 momentum spread rms (mrad) : ",dialog_->contents()); delEdit_ = new WLineEdit(param[6].c_str(), dialog_->contents()); new WBreak(dialog_->contents()); new WText("momentum of the central trajectory (GeV/c) : ",dialog_->contents()); p0Edit_ = new WLineEdit(param[7].c_str(), dialog_->contents()); new WBreak(dialog_->contents()); WPushButton *submit = new WPushButton("OK",dialog_->contents()); submit->clicked().connect(dialog_, &Wt::WDialog::accept); dialog_->finished().connect(this, &GWt_beam::dialogDone); } void GWt_beam::dialogDone() { string envoi[8]; envoi[0] = string("7"); envoi[1] = xEdit_->text().toUTF8(); envoi[2] = xpEdit_->text().toUTF8(); envoi[3] = yEdit_->text().toUTF8(); envoi[4] = ypEdit_->text().toUTF8(); envoi[5] = dlEdit_->text().toUTF8(); envoi[6] = delEdit_->text().toUTF8(); envoi[7] = p0Edit_->text().toUTF8(); element_->setParametersString(envoi); }