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