Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYAcousticCylinderWidget.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 
31 #define TR(id) OLocalizator::getString("TYAcousticCylinderWidget", (id))
32 
34  : TYWidget(pElement, _pParent)
35 {
36 
37  resize(300, 700);
38  setWindowTitle(TR("id_caption"));
39  _acousticCylinderLayout = new QGridLayout();
40  setLayout(_acousticCylinderLayout);
41 
42  _elmW = new TYAcousticVolumeWidget(pElement, this);
43 
44  _acousticCylinderLayout->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(getElement()->getAcEnveloppe()->getName());
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  _checkBoxCircTop = new QCheckBox(_groupBoxCircTop);
71  _groupBoxCircTopLayout->addWidget(_checkBoxCircTop, 0, 0);
72 
73  _lineEditNomCircTop = new QLineEdit(_groupBoxCircTop);
74  _lineEditNomCircTop->setText(getElement()->getCircTop()->getName());
75  _lineEditNomCircTop->setEnabled(false);
77 
78  _pushButtonCircTop = new QPushButton(_groupBoxCircTop);
79  _pushButtonCircTop->setText(TR("id_proprietes_button"));
81 
82  _acousticCylinderLayout->addWidget(_groupBoxCircTop, 2, 0);
83 
84  _groupBoxCircBottom = new QGroupBox(this);
85  _groupBoxCircBottom->setTitle(TR("id_circbottom"));
86  _groupBoxCircBottomLayout = new QGridLayout();
88 
91 
93  _lineEditNomCircBottom->setText(getElement()->getCircBottom()->getName());
94  _lineEditNomCircBottom->setEnabled(false);
96 
97  _pushButtonCircBottom = new QPushButton(_groupBoxCircBottom);
98  _pushButtonCircBottom->setText(TR("id_proprietes_button"));
100 
102 
103  _groupBoxDimensions = new QGroupBox(this);
104  _groupBoxDimensions->setTitle(TR("id_title_dimensions"));
105  _groupBoxDimensionsLayout = new QGridLayout();
107 
108  _dimensionsDiamLabel = new QLabel("labelName");
109  _dimensionsDiamLabel->setText(TR("id_diameter_label"));
111 
112  _dimensionsHauteurLabel = new QLabel("labelName");
113  _dimensionsHauteurLabel->setText(TR("id_hauteur_label"));
115 
120 
122 
123  connect(_pushButtonEnveloppe, &QPushButton::clicked, this, &TYAcousticCylinderWidget::editEnveloppe);
124  connect(_pushButtonCircTop, &QPushButton::clicked, this, &TYAcousticCylinderWidget::editCircTop);
125  connect(_pushButtonCircBottom, &QPushButton::clicked, this, &TYAcousticCylinderWidget::editCircBottom);
126 
127  updateContent();
128 }
129 
131 
133 {
134  _elmW->updateContent();
135 
136  _lineEditNomEnveloppe->setText(getElement()->getAcEnveloppe()->getName());
137  _lineEditNomCircTop->setText(getElement()->getCircTop()->getName());
138  _lineEditNomCircBottom->setText(getElement()->getCircBottom()->getName());
139 
140  _checkBoxEnveloppe->setChecked(getElement()->getAcEnveloppe()->getIsRayonnant());
141  _checkBoxCircTop->setChecked(getElement()->getCircTop()->getIsRayonnant());
142  _checkBoxCircBottom->setChecked(getElement()->getCircBottom()->getIsRayonnant());
143 
144  _dimensionsDiamLineEdit->setText(QString().setNum(getElement()->getDiameter(), 'f', 2));
145  _dimensionsHauteurLineEdit->setText(QString().setNum(getElement()->getHauteur(), 'f', 2));
146 }
147 
149 {
150  _elmW->apply();
151 
152  getElement()->getAcEnveloppe()->setIsRayonnant(_checkBoxEnveloppe->isChecked());
153  getElement()->getCircTop()->setIsRayonnant(_checkBoxCircTop->isChecked());
154  getElement()->getCircBottom()->setIsRayonnant(_checkBoxCircBottom->isChecked());
155 
156  double diameter = _dimensionsDiamLineEdit->text().toDouble();
157  double hauteur = _dimensionsHauteurLineEdit->text().toDouble();
158 
159  getElement()->setDiameter(diameter);
160  getElement()->setHauteur(hauteur);
161 
162  emit modified();
163 }
164 
166 {
167  getElement()->getAcEnveloppe()->setIsRayonnant(_checkBoxEnveloppe->isChecked());
168 
169  int ret = getElement()->getAcEnveloppe()->edit(this);
170 
171  if (ret == QDialog::Accepted)
172  {
173  _lineEditNomEnveloppe->setText(getElement()->getAcEnveloppe()->getName());
174  }
175 
176  _checkBoxEnveloppe->setChecked(getElement()->getAcEnveloppe()->getIsRayonnant());
177 }
178 
180 {
181  getElement()->getCircTop()->setIsRayonnant(_checkBoxCircTop->isChecked());
182 
183  int ret = getElement()->getCircTop()->edit(this);
184 
185  if (ret == QDialog::Accepted)
186  {
187  _lineEditNomCircTop->setText(getElement()->getCircTop()->getName());
188  }
189 
190  _checkBoxCircTop->setChecked(getElement()->getCircTop()->getIsRayonnant());
191 }
192 
194 {
195  getElement()->getCircBottom()->setIsRayonnant(_checkBoxCircBottom->isChecked());
196 
197  int ret = getElement()->getCircBottom()->edit(this);
198 
199  if (ret == QDialog::Accepted)
200  {
201  _lineEditNomCircBottom->setText(getElement()->getCircBottom()->getName());
202  }
203 
204  _checkBoxCircBottom->setChecked(getElement()->getCircBottom()->getIsRayonnant());
205 }
#define TR(id)
outil IHM pour un cylindre acoustique (fichier header)
outil IHM pour un volume acoustique (fichier header)
outil IHM pour une entrée utilisateur (fichier header)
TYAcousticVolumeWidget * _elmW
TYAcousticCylinderWidget(TYAcousticCylinder *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
void modified()