Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYRepereWidget.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 
23 #include <stdlib.h>
27 // Added by qt3to4:
28 #include <QGridLayout>
29 #include <QLabel>
30 #include <QtWidgets>
31 
32 #include "TYRepereWidget.h"
33 #include "TYElementWidget.h"
34 
35 #define TR(id) OLocalizator::getString("TYRepereWidget", (id))
36 
37 TYRepereWidget::TYRepereWidget(TYRepere* pElement, QWidget* _pParent /*=NULL*/) : TYWidget(pElement, _pParent)
38 {
39  QString buf;
40 
41  elmW = new TYElementWidget(getElement(), this);
42 
43  resize(300, 200);
44  setWindowTitle(TR("id_caption"));
45  RepereLayout = new QGridLayout();
46  setLayout(RepereLayout);
47 
48  RepereLayout->addWidget(elmW, 0, 0, 1, 2);
49 
50  GroupBoxOrigine = new QGroupBox(this);
51  GroupBoxOrigine->setTitle(TR("id_origine"));
52  GroupBoxOrigineLayout = new QGridLayout();
54 
55  labelX = new QLabel(GroupBoxOrigine);
56  labelX->setText(TR("id_x_label"));
57  GroupBoxOrigineLayout->addWidget(labelX, 0, 0);
58 
59  labelZ = new QLabel(GroupBoxOrigine);
60  labelZ->setText(TR("id_z_label"));
61  GroupBoxOrigineLayout->addWidget(labelZ, 2, 0);
62 
63  labelY = new QLabel(GroupBoxOrigine);
64  labelY->setText(TR("id_y_label"));
65  GroupBoxOrigineLayout->addWidget(labelY, 1, 0);
66 
68  lineEditX->setText(buf.setNum(getElement()->_origin._x, 'g', 10));
69  GroupBoxOrigineLayout->addWidget(lineEditX, 0, 1);
70 
72  lineEditY->setText(buf.setNum(getElement()->_origin._y, 'g', 10));
73  GroupBoxOrigineLayout->addWidget(lineEditY, 1, 1);
74 
76  lineEditZ->setText(buf.setNum(getElement()->_origin._z, 'g', 10));
77  GroupBoxOrigineLayout->addWidget(lineEditZ, 2, 1);
78 
79  RepereLayout->addWidget(GroupBoxOrigine, 1, 0);
80 
81  GroupBoxVecI = new QGroupBox(this);
82  GroupBoxVecI->setTitle(TR("id_veci"));
83  GroupBoxVecILayout = new QGridLayout();
84  GroupBoxVecI->setLayout(GroupBoxVecILayout);
85 
86  labelX_2 = new QLabel(GroupBoxVecI);
87  labelX_2->setText(TR("id_x_label"));
88  GroupBoxVecILayout->addWidget(labelX_2, 0, 0);
89 
90  labelZ_2 = new QLabel(GroupBoxVecI);
91  labelZ_2->setText(TR("id_z_label"));
92  GroupBoxVecILayout->addWidget(labelZ_2, 2, 0);
93 
94  labelY_2 = new QLabel(GroupBoxVecI);
95  labelY_2->setText(TR("id_y_label"));
96  GroupBoxVecILayout->addWidget(labelY_2, 1, 0);
97 
99  lineEditX_2->setText(buf.setNum(getElement()->_vecI._x, 'g', 10));
100  GroupBoxVecILayout->addWidget(lineEditX_2, 0, 1);
101 
103  lineEditY_2->setText(buf.setNum(getElement()->_vecI._y, 'g', 10));
104  GroupBoxVecILayout->addWidget(lineEditY_2, 1, 1);
105 
107  lineEditZ_2->setText(buf.setNum(getElement()->_vecI._z, 'g', 10));
108  GroupBoxVecILayout->addWidget(lineEditZ_2, 2, 1);
109 
110  RepereLayout->addWidget(GroupBoxVecI, 1, 1);
111 
112  GroupBoxVecK = new QGroupBox(this);
113  GroupBoxVecK->setTitle(TR("id_vecj"));
114  GroupBoxVecKLayout = new QGridLayout();
115  GroupBoxVecK->setLayout(GroupBoxVecKLayout);
116 
117  labelX_4 = new QLabel(GroupBoxVecK);
118  labelX_4->setText(TR("id_x_label"));
119  GroupBoxVecKLayout->addWidget(labelX_4, 0, 0);
120 
121  labelZ_4 = new QLabel(GroupBoxVecK);
122  labelZ_4->setText(TR("id_z_label"));
123  GroupBoxVecKLayout->addWidget(labelZ_4, 2, 0);
124 
125  labelY_4 = new QLabel(GroupBoxVecK);
126  labelY_4->setText(TR("id_y_label"));
127  GroupBoxVecKLayout->addWidget(labelY_4, 1, 0);
128 
130  lineEditX_4->setText(buf.setNum(getElement()->_vecJ._x, 'g', 10));
131  GroupBoxVecKLayout->addWidget(lineEditX_4, 0, 1);
132 
134  lineEditY_4->setText(buf.setNum(getElement()->_vecJ._y, 'g', 10));
135  GroupBoxVecKLayout->addWidget(lineEditY_4, 1, 1);
136 
138  lineEditZ_4->setText(buf.setNum(getElement()->_vecJ._z, 'g', 10));
139  GroupBoxVecKLayout->addWidget(lineEditZ_4, 2, 1);
140 
141  RepereLayout->addWidget(GroupBoxVecK, 2, 1);
142 
143  GroupBoxVecJ = new QGroupBox(this);
144  GroupBoxVecJ->setTitle(TR("id_veck"));
145  GroupBoxVecJLayout = new QGridLayout();
146  GroupBoxVecJ->setLayout(GroupBoxVecJLayout);
147 
148  labelX_3 = new QLabel(GroupBoxVecJ);
149  labelX_3->setText(TR("id_x_label"));
150  GroupBoxVecJLayout->addWidget(labelX_3, 0, 0);
151 
152  labelZ_3 = new QLabel(GroupBoxVecJ);
153  labelZ_3->setText(TR("id_z_label"));
154  GroupBoxVecJLayout->addWidget(labelZ_3, 2, 0);
155 
156  labelY_3 = new QLabel(GroupBoxVecJ);
157  labelY_3->setText(TR("id_y_label"));
158  GroupBoxVecJLayout->addWidget(labelY_3, 1, 0);
159 
161  lineEditX_3->setText(buf.setNum(getElement()->_vecK._x, 'g', 10));
162  GroupBoxVecJLayout->addWidget(lineEditX_3, 0, 1);
163 
165  lineEditY_3->setText(buf.setNum(getElement()->_vecK._y, 'g', 10));
166  GroupBoxVecJLayout->addWidget(lineEditY_3, 1, 1);
167 
169  lineEditZ_3->setText(buf.setNum(getElement()->_vecK._z, 'g', 10));
170  GroupBoxVecJLayout->addWidget(lineEditZ_3, 2, 1);
171 
172  RepereLayout->addWidget(GroupBoxVecJ, 2, 0);
173 }
174 
176 
178 {
179  QString buf;
180 
181  elmW->updateContent();
182 
183  lineEditZ_3->setText(buf.setNum(getElement()->_vecK._z, 'g', 10));
184  lineEditX_3->setText(buf.setNum(getElement()->_vecK._x, 'g', 10));
185  lineEditY_3->setText(buf.setNum(getElement()->_vecK._y, 'g', 10));
186 
187  lineEditZ_4->setText(buf.setNum(getElement()->_vecJ._z, 'g', 10));
188  lineEditX_4->setText(buf.setNum(getElement()->_vecJ._x, 'g', 10));
189  lineEditY_4->setText(buf.setNum(getElement()->_vecJ._y, 'g', 10));
190 
191  lineEditZ_2->setText(buf.setNum(getElement()->_vecI._z, 'g', 10));
192  lineEditX_2->setText(buf.setNum(getElement()->_vecI._x, 'g', 10));
193  lineEditY_2->setText(buf.setNum(getElement()->_vecI._y, 'g', 10));
194 
195  lineEditZ->setText(buf.setNum(getElement()->_origin._z, 'g', 10));
196  lineEditX->setText(buf.setNum(getElement()->_origin._x, 'g', 10));
197  lineEditY->setText(buf.setNum(getElement()->_origin._y, 'g', 10));
198 }
199 
201 {
202  elmW->apply();
203 
204  getElement()->_origin._x = lineEditX->text().toDouble();
205  getElement()->_origin._y = lineEditY->text().toDouble();
206  getElement()->_origin._z = lineEditZ->text().toDouble();
207 
208  getElement()->_vecI._x = lineEditX_2->text().toDouble();
209  getElement()->_vecI._y = lineEditY_2->text().toDouble();
210  getElement()->_vecI._z = lineEditZ_2->text().toDouble();
211 
212  getElement()->_vecJ._x = lineEditX_4->text().toDouble();
213  getElement()->_vecJ._y = lineEditY_4->text().toDouble();
214  getElement()->_vecJ._z = lineEditZ_4->text().toDouble();
215 
216  getElement()->_vecK._x = lineEditX_3->text().toDouble();
217  getElement()->_vecK._y = lineEditY_3->text().toDouble();
218  getElement()->_vecK._z = lineEditZ_3->text().toDouble();
219 
220  emit modified();
221 }
outil IHM pour un element (fichier header)
outil IHM pour une entrée utilisateur (fichier header)
#define TR(id)
Outil IHM pour un repere (fichier header)
classe de l'objet IHM pour un element
virtual void apply()
virtual void updateContent()
QLabel * labelX_3
TYLineEdit * lineEditX_2
QGridLayout * GroupBoxVecILayout
TYLineEdit * lineEditX
QLabel * labelX_4
virtual ~TYRepereWidget()
QLabel * labelY_4
QGridLayout * GroupBoxOrigineLayout
QGroupBox * GroupBoxVecI
TYLineEdit * lineEditY_3
QGridLayout * GroupBoxVecKLayout
QLabel * labelY_3
TYElementWidget * elmW
QGridLayout * RepereLayout
QGroupBox * GroupBoxOrigine
TYLineEdit * lineEditY_4
QLabel * labelX_2
TYLineEdit * lineEditZ_2
TYLineEdit * lineEditZ_3
QLabel * labelZ_3
TYLineEdit * lineEditX_3
TYLineEdit * lineEditY_2
TYLineEdit * lineEditX_4
virtual void apply()
QGroupBox * GroupBoxVecK
QGroupBox * GroupBoxVecJ
QLabel * labelY_2
virtual void updateContent()
QLabel * labelZ_2
TYRepereWidget(TYRepere *pElement, QWidget *_pParent=NULL)
TYLineEdit * lineEditY
QLabel * labelZ_4
TYLineEdit * lineEditZ
TYLineEdit * lineEditZ_4
QGridLayout * GroupBoxVecJLayout
classe de l'objet IHM pour un objet metier de type TYElement
Definition: TYWidget.h:43
void modified()