Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYAcousticSemiCylinderWidget.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 
29 
30 #define TR(id) OLocalizator::getString("TYAcousticSemiCylinderWidget", (id))
31 
33  QWidget* _pParent /*=NULL*/)
34  : TYWidget(pElement, _pParent)
35 {
36 
37  _elmW = new TYAcousticVolumeWidget(pElement, this);
38 
39  resize(300, 650);
40  setWindowTitle(TR("id_caption"));
41  _acousticSemiCylinderLayout = new QGridLayout();
42  setLayout(_acousticSemiCylinderLayout);
43 
44  _acousticSemiCylinderLayout->addWidget(_elmW, 0, 0);
45 
46  _groupBoxEnveloppe = new QGroupBox(this);
47  _groupBoxEnveloppe->setTitle(TR("id_enveloppe"));
48  _groupBoxEnveloppeLayout = new QGridLayout();
50 
51  _checkBoxEnveloppe = new QCheckBox(_groupBoxEnveloppe);
53 
55  _lineEditNomEnveloppe->setText(TR("spectre d'attenuation"));
56  _lineEditNomEnveloppe->setEnabled(false);
58 
59  _pushButtonEnveloppe = new QPushButton(_groupBoxEnveloppe);
60  _pushButtonEnveloppe->setText(TR("id_proprietes_button"));
62 
64 
65  _groupBoxCircTop = new QGroupBox(this);
66  _groupBoxCircTop->setTitle(TR("id_circtop"));
67  _groupBoxCircTopLayout = new QGridLayout();
69 
70  _checkBoxSemiCircTop = new QCheckBox(_groupBoxCircTop);
72 
73  _lineEditNomCircTop = new QLineEdit(_groupBoxCircTop);
74  _lineEditNomCircTop->setText(getElement()->getSemiCircTop()->getName());
75  _lineEditNomCircTop->setEnabled(false);
77 
78  _pushButtonSemicircTop = new QPushButton(_groupBoxCircTop);
79  _pushButtonSemicircTop->setText(TR("id_proprietes_button"));
81 
83 
84  _groupBoxCircBottom = new QGroupBox(this);
85  _groupBoxCircBottom->setTitle(TR("id_circbottom"));
86  _groupBoxCircBottomLayout = new QGridLayout();
88 
91 
93  _lineEditNomCircBottom->setText(getElement()->getSemiCircBottom()->getName());
94  _lineEditNomCircBottom->setEnabled(false);
96 
98  _pushButtonSemiCircBottom->setText(TR("id_proprietes_button"));
100 
102 
103  _groupBoxRect = new QGroupBox(this);
104  _groupBoxRect->setTitle(TR("id_rect"));
105  _groupBoxRectLayout = new QGridLayout();
107 
108  _checkBoxRect = new QCheckBox(_groupBoxRect);
109  _groupBoxRectLayout->addWidget(_checkBoxRect, 0, 0);
110 
111  _lineEditNomRect = new QLineEdit(_groupBoxRect);
112  _lineEditNomRect->setText(getElement()->getRect()->getName());
113  _lineEditNomRect->setEnabled(false);
114  _groupBoxRectLayout->addWidget(_lineEditNomRect, 0, 1);
115 
116  _pushButtonRect = new QPushButton(_groupBoxRect);
117  _pushButtonRect->setText(TR("id_proprietes_button"));
118  _groupBoxRectLayout->addWidget(_pushButtonRect, 0, 2);
119 
120  _acousticSemiCylinderLayout->addWidget(_groupBoxRect, 4, 0);
121 
122  connect(_pushButtonEnveloppe, &QPushButton::clicked, this, &TYAcousticSemiCylinderWidget::editEnveloppe);
123  connect(_pushButtonSemicircTop, &QPushButton::clicked, this,
125  connect(_pushButtonSemiCircBottom, &QPushButton::clicked, this,
127  connect(_pushButtonRect, &QPushButton::clicked, this, &TYAcousticSemiCylinderWidget::editRect);
128 
129  _groupBoxDimensions = new QGroupBox(this);
130  _groupBoxDimensions->setTitle(TR("id_title_dimensions"));
131  _groupBoxDimensionsLayout = new QGridLayout();
133 
134  _dimensionsDiamLabel = new QLabel("labelName");
135  _dimensionsDiamLabel->setText(TR("id_diameter_label"));
136  _dimensionsDiamLineEdit = new TYLineEdit("", true);
137 
138  _dimensionsHauteurLabel = new QLabel("labelName");
139  _dimensionsHauteurLabel->setText(TR("id_hauteur_label"));
140  _dimensionsHauteurLineEdit = new TYLineEdit("", true);
141 
146 
148 
149  updateContent();
150 }
151 
153 
155 {
156  _elmW->updateContent();
157 
158  _lineEditNomEnveloppe->setText(getElement()->getAcEnveloppe()->getName());
159  _lineEditNomRect->setText(getElement()->getRect()->getName());
160  _lineEditNomCircBottom->setText(getElement()->getSemiCircBottom()->getName());
161  _lineEditNomCircTop->setText(getElement()->getSemiCircTop()->getName());
162 
163  _checkBoxEnveloppe->setChecked(getElement()->getAcEnveloppe()->getIsRayonnant());
164  _checkBoxSemiCircTop->setChecked(getElement()->getSemiCircTop()->getIsRayonnant());
165  _checkBoxSemiCircBottom->setChecked(getElement()->getSemiCircBottom()->getIsRayonnant());
166  _checkBoxRect->setChecked(getElement()->getRect()->getIsRayonnant());
167 
168  _dimensionsDiamLineEdit->setText(
169  QString().setNum(((TYAcousticSemiCylinder*)_pElement)->getDiameter(), 'f', 2));
171  QString().setNum(((TYAcousticSemiCylinder*)_pElement)->getHauteur(), 'f', 2));
172 }
173 
175 {
176  _elmW->apply();
177 
178  getElement()->getAcEnveloppe()->setIsRayonnant(_checkBoxEnveloppe->isChecked());
179  getElement()->getSemiCircTop()->setIsRayonnant(_checkBoxSemiCircTop->isChecked());
180  getElement()->getSemiCircBottom()->setIsRayonnant(_checkBoxSemiCircBottom->isChecked());
181  getElement()->getRect()->setIsRayonnant(_checkBoxRect->isChecked());
182 
183  double diameter = _dimensionsDiamLineEdit->text().toDouble();
184  double hauteur = _dimensionsHauteurLineEdit->text().toDouble();
185 
186  ((TYAcousticSemiCylinder*)_pElement)->setDiameter(diameter);
187  ((TYAcousticSemiCylinder*)_pElement)->setHauteur(hauteur);
188 
189  emit modified();
190 }
191 
193 {
194  int ret = getElement()->getAcEnveloppe()->edit(this);
195 
196  if (ret == QDialog::Accepted)
197  {
198  _lineEditNomEnveloppe->setText(TR("spectre d'attenuation"));
199  }
200 
201  _checkBoxEnveloppe->setChecked(getElement()->getAcEnveloppe()->getIsRayonnant());
202 }
203 
205 {
206  getElement()->getSemiCircTop()->setIsRayonnant(_checkBoxSemiCircTop->isChecked());
207 
208  int ret = getElement()->getSemiCircTop()->edit(this);
209 
210  if (ret == QDialog::Accepted)
211  {
212  _lineEditNomCircTop->setText(getElement()->getSemiCircTop()->getName());
213  }
214 
215  _checkBoxSemiCircTop->setChecked(getElement()->getSemiCircTop()->getIsRayonnant());
216 }
217 
219 {
220  getElement()->getSemiCircBottom()->setIsRayonnant(_checkBoxSemiCircBottom->isChecked());
221 
222  int ret = getElement()->getSemiCircBottom()->edit(this);
223 
224  if (ret == QDialog::Accepted)
225  {
226  _lineEditNomCircBottom->setText(getElement()->getSemiCircBottom()->getName());
227  }
228 
229  _checkBoxSemiCircBottom->setChecked(getElement()->getSemiCircBottom()->getIsRayonnant());
230 }
231 
233 {
234  getElement()->getRect()->setIsRayonnant(_checkBoxRect->isChecked());
235 
236  int ret = getElement()->getRect()->edit(this);
237 
238  if (ret == QDialog::Accepted)
239  {
240  _lineEditNomRect->setText(getElement()->getRect()->getName());
241  }
242 
243  _checkBoxRect->setChecked(getElement()->getRect()->getIsRayonnant());
244 }
#define TR(id)
outil IHM pour un demi cylindre acoustique (fichier header)
outil IHM pour un volume acoustique (fichier header)
outil IHM pour une entrée utilisateur (fichier header)
TYAcousticSemiCylinderWidget(TYAcousticSemiCylinder *pElement, QWidget *_pParent=NULL)
classe de l'objet IHM pour un volume acoustique
classe de l'objet IHM pour un objet metier de type TYElement
Definition: TYWidget.h:43
TYElement * _pElement
Definition: TYWidget.h:114
void modified()