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