Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYReseauTransportWidget.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012-2024> <EDF-DTG> <FRANCE>
3  * This file is part of Code_TYMPAN (R).
4  * Code_TYMPAN (R) is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  * Code_TYMPAN (R) is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  * See the GNU General Public License for more details.
12  * You should have received a copy of the GNU General Public License along
13  * with Code_TYMPAN (R). If not, see <https://www.gnu.org/licenses/>.
14  */
15 
21 // Added by qt3to4:
22 #include <QGridLayout>
23 #include <QLabel>
24 #include <QtWidgets>
25 
31 
32 #define TR(id) OLocalizator::getString("TYReseauTransportWidget", (id))
33 
35  : TYWidget(pElement, _pParent)
36 {
37  QString num;
38 
39  _elmW = new TYAcousticLineWidget(pElement, this);
40 
41  resize(300, 610);
42  setWindowTitle(TR("id_caption"));
43  _reseauTransportLayout = new QGridLayout();
44  setLayout(_reseauTransportLayout);
45 
46  _reseauTransportLayout->addWidget(_elmW, 0, 0);
47 
48  _groupBox = new QGroupBox(this);
49  _groupBox->setTitle(TR(""));
50  _groupBoxLayout = new QGridLayout();
51  _groupBox->setLayout(_groupBoxLayout);
52 
54  _lineEditNbBrins->setText(num.setNum(getElement()->getNbBrins()));
55  _groupBoxLayout->addWidget(_lineEditNbBrins, 0, 1);
56 
57  _labelNbBrins = new QLabel(_groupBox);
58  _labelNbBrins->setText(TR("id_nbbrins_label"));
59  _groupBoxLayout->addWidget(_labelNbBrins, 0, 0);
60 
61  _labelTension = new QLabel(_groupBox);
62  _labelTension->setText(TR("id_tension_label"));
63  _groupBoxLayout->addWidget(_labelTension, 1, 0);
64 
66  _lineEditTension->setText(num.setNum(getElement()->getTension(), 'f', 2));
67  _groupBoxLayout->addWidget(_lineEditTension, 1, 1);
68  QLabel* pUnitTension = new QLabel(_groupBox);
69  pUnitTension->setText(TR("id_unite_tension"));
70  _groupBoxLayout->addWidget(pUnitTension, 1, 2);
71 
72  _labelPuissance = new QLabel(_groupBox);
73  _labelPuissance->setText(TR("id_puissance_label"));
74  _groupBoxLayout->addWidget(_labelPuissance, 2, 0);
75 
77  _lineEditPuissance->setText(num.setNum(getElement()->getPuissance(), 'f', 2));
78  _groupBoxLayout->addWidget(_lineEditPuissance, 2, 1);
79  QLabel* pUnitPuissance = new QLabel(_groupBox);
80  pUnitPuissance->setText(TR("id_unite_puissance"));
81  _groupBoxLayout->addWidget(pUnitPuissance, 2, 2);
82 
84  _lineEditHautMoy->setText(num.setNum(getElement()->getHauteurMoyenne(), 'f', 2));
85  _groupBoxLayout->addWidget(_lineEditHautMoy, 3, 1);
86  QLabel* pUnitHautMoy = new QLabel(_groupBox);
87  pUnitHautMoy->setText(TR("id_unite_hauteurmoyenne"));
88  _groupBoxLayout->addWidget(pUnitHautMoy, 3, 2);
89 
90  _labelHautMoy = new QLabel(_groupBox);
91  _labelHautMoy->setText(TR("id_hautmoy_label"));
92  _groupBoxLayout->addWidget(_labelHautMoy, 3, 0);
93 
94  _reseauTransportLayout->addWidget(_groupBox, 1, 0);
95 }
96 
98 
100 {
101  QString num;
102 
103  _elmW->updateContent();
104 
105  _lineEditNbBrins->setText(num.setNum(getElement()->getNbBrins()));
106  _lineEditTension->setText(num.setNum(getElement()->getTension(), 'f', 2));
107  _lineEditPuissance->setText(num.setNum(getElement()->getPuissance(), 'f', 2));
108  _lineEditHautMoy->setText(num.setNum(getElement()->getHauteurMoyenne(), 'f', 2));
109 }
110 
112 {
113  _elmW->apply();
114 
115  getElement()->setNbBrins(_lineEditNbBrins->text().toInt());
116  getElement()->setTension(_lineEditTension->text().toDouble());
117  getElement()->setPuissance(_lineEditPuissance->text().toDouble());
118  getElement()->setHauteurMoyenne(_lineEditHautMoy->text().toDouble());
119 
120  emit modified();
121 }
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()