Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYReseauTransportWidget.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14  */
15 
21 // Added by qt3to4:
22 #include <QGridLayout>
23 #include <QLabel>
24 
30 
31 #define TR(id) OLocalizator::getString("TYReseauTransportWidget", (id))
32 
34  : TYWidget(pElement, _pParent)
35 {
36  QString num;
37 
38  _elmW = new TYAcousticLineWidget(pElement, this);
39 
40  resize(300, 610);
41  setWindowTitle(TR("id_caption"));
42  _reseauTransportLayout = new QGridLayout();
43  setLayout(_reseauTransportLayout);
44 
45  _reseauTransportLayout->addWidget(_elmW, 0, 0);
46 
47  _groupBox = new QGroupBox(this);
48  _groupBox->setTitle(TR(""));
49  _groupBoxLayout = new QGridLayout();
50  _groupBox->setLayout(_groupBoxLayout);
51 
53  _lineEditNbBrins->setText(num.setNum(getElement()->getNbBrins()));
54  _groupBoxLayout->addWidget(_lineEditNbBrins, 0, 1);
55 
56  _labelNbBrins = new QLabel(_groupBox);
57  _labelNbBrins->setText(TR("id_nbbrins_label"));
58  _groupBoxLayout->addWidget(_labelNbBrins, 0, 0);
59 
60  _labelTension = new QLabel(_groupBox);
61  _labelTension->setText(TR("id_tension_label"));
62  _groupBoxLayout->addWidget(_labelTension, 1, 0);
63 
65  _lineEditTension->setText(num.setNum(getElement()->getTension(), 'f', 2));
66  _groupBoxLayout->addWidget(_lineEditTension, 1, 1);
67  QLabel* pUnitTension = new QLabel(_groupBox);
68  pUnitTension->setText(TR("id_unite_tension"));
69  _groupBoxLayout->addWidget(pUnitTension, 1, 2);
70 
71  _labelPuissance = new QLabel(_groupBox);
72  _labelPuissance->setText(TR("id_puissance_label"));
73  _groupBoxLayout->addWidget(_labelPuissance, 2, 0);
74 
76  _lineEditPuissance->setText(num.setNum(getElement()->getPuissance(), 'f', 2));
77  _groupBoxLayout->addWidget(_lineEditPuissance, 2, 1);
78  QLabel* pUnitPuissance = new QLabel(_groupBox);
79  pUnitPuissance->setText(TR("id_unite_puissance"));
80  _groupBoxLayout->addWidget(pUnitPuissance, 2, 2);
81 
83  _lineEditHautMoy->setText(num.setNum(getElement()->getHauteurMoyenne(), 'f', 2));
84  _groupBoxLayout->addWidget(_lineEditHautMoy, 3, 1);
85  QLabel* pUnitHautMoy = new QLabel(_groupBox);
86  pUnitHautMoy->setText(TR("id_unite_hauteurmoyenne"));
87  _groupBoxLayout->addWidget(pUnitHautMoy, 3, 2);
88 
89  _labelHautMoy = new QLabel(_groupBox);
90  _labelHautMoy->setText(TR("id_hautmoy_label"));
91  _groupBoxLayout->addWidget(_labelHautMoy, 3, 0);
92 
93  _reseauTransportLayout->addWidget(_groupBox, 1, 0);
94 }
95 
97 
99 {
100  QString num;
101 
102  _elmW->updateContent();
103 
104  _lineEditNbBrins->setText(num.setNum(getElement()->getNbBrins()));
105  _lineEditTension->setText(num.setNum(getElement()->getTension(), 'f', 2));
106  _lineEditPuissance->setText(num.setNum(getElement()->getPuissance(), 'f', 2));
107  _lineEditHautMoy->setText(num.setNum(getElement()->getHauteurMoyenne(), 'f', 2));
108 }
109 
111 {
112  _elmW->apply();
113 
114  getElement()->setNbBrins(_lineEditNbBrins->text().toInt());
115  getElement()->setTension(_lineEditTension->text().toDouble());
116  getElement()->setPuissance(_lineEditPuissance->text().toDouble());
117  getElement()->setHauteurMoyenne(_lineEditHautMoy->text().toDouble());
118 
119  emit modified();
120 }
Outil IHM pour une ligne acoustique (fichier header)
outil IHM pour une entrée utilisateur (fichier header)
#define TR(id)
Outil IHM pour un reseau de transport (fichier header)
classe de l'objet IHM pour une ligne acoustique
TYReseauTransportWidget(TYReseauTransport *pElement, QWidget *_pParent=NULL)
TYAcousticLineWidget * _elmW
classe de l'objet IHM pour un objet metier de type TYElement
Definition: TYWidget.h:43
void modified()