Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYAcousticCylinderWidget.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("TYAcousticCylinderWidget", (id))
31 
33  : TYWidget(pElement, _pParent)
34 {
35 
36  resize(300, 700);
37  setWindowTitle(TR("id_caption"));
38  _acousticCylinderLayout = new QGridLayout();
39  setLayout(_acousticCylinderLayout);
40 
41  _elmW = new TYAcousticVolumeWidget(pElement, this);
42 
43  _acousticCylinderLayout->addWidget(_elmW, 0, 0);
44 
45  _groupBoxEnveloppe = new QGroupBox(this);
46  _groupBoxEnveloppe->setTitle(TR("id_enveloppe"));
47  _groupBoxEnveloppeLayout = new QGridLayout();
49 
50  _checkBoxEnveloppe = new QCheckBox(_groupBoxEnveloppe);
52 
54  _lineEditNomEnveloppe->setText(getElement()->getAcEnveloppe()->getName());
55  _lineEditNomEnveloppe->setEnabled(false);
57 
58  _pushButtonEnveloppe = new QPushButton(_groupBoxEnveloppe);
59  _pushButtonEnveloppe->setText(TR("id_proprietes_button"));
61 
63 
64  _groupBoxCircTop = new QGroupBox(this);
65  _groupBoxCircTop->setTitle(TR("id_circtop"));
66  _groupBoxCircTopLayout = new QGridLayout();
68 
69  _checkBoxCircTop = new QCheckBox(_groupBoxCircTop);
70  _groupBoxCircTopLayout->addWidget(_checkBoxCircTop, 0, 0);
71 
72  _lineEditNomCircTop = new QLineEdit(_groupBoxCircTop);
73  _lineEditNomCircTop->setText(getElement()->getCircTop()->getName());
74  _lineEditNomCircTop->setEnabled(false);
76 
77  _pushButtonCircTop = new QPushButton(_groupBoxCircTop);
78  _pushButtonCircTop->setText(TR("id_proprietes_button"));
80 
81  _acousticCylinderLayout->addWidget(_groupBoxCircTop, 2, 0);
82 
83  _groupBoxCircBottom = new QGroupBox(this);
84  _groupBoxCircBottom->setTitle(TR("id_circbottom"));
85  _groupBoxCircBottomLayout = new QGridLayout();
87 
90 
92  _lineEditNomCircBottom->setText(getElement()->getCircBottom()->getName());
93  _lineEditNomCircBottom->setEnabled(false);
95 
96  _pushButtonCircBottom = new QPushButton(_groupBoxCircBottom);
97  _pushButtonCircBottom->setText(TR("id_proprietes_button"));
99 
101 
102  _groupBoxDimensions = new QGroupBox(this);
103  _groupBoxDimensions->setTitle(TR("id_title_dimensions"));
104  _groupBoxDimensionsLayout = new QGridLayout();
106 
107  _dimensionsDiamLabel = new QLabel("labelName");
108  _dimensionsDiamLabel->setText(TR("id_diameter_label"));
110 
111  _dimensionsHauteurLabel = new QLabel("labelName");
112  _dimensionsHauteurLabel->setText(TR("id_hauteur_label"));
114 
119 
121 
122  connect(_pushButtonEnveloppe, &QPushButton::clicked, this, &TYAcousticCylinderWidget::editEnveloppe);
123  connect(_pushButtonCircTop, &QPushButton::clicked, this, &TYAcousticCylinderWidget::editCircTop);
124  connect(_pushButtonCircBottom, &QPushButton::clicked, this, &TYAcousticCylinderWidget::editCircBottom);
125 
126  updateContent();
127 }
128 
130 
132 {
133  _elmW->updateContent();
134 
135  _lineEditNomEnveloppe->setText(getElement()->getAcEnveloppe()->getName());
136  _lineEditNomCircTop->setText(getElement()->getCircTop()->getName());
137  _lineEditNomCircBottom->setText(getElement()->getCircBottom()->getName());
138 
139  _checkBoxEnveloppe->setChecked(getElement()->getAcEnveloppe()->getIsRayonnant());
140  _checkBoxCircTop->setChecked(getElement()->getCircTop()->getIsRayonnant());
141  _checkBoxCircBottom->setChecked(getElement()->getCircBottom()->getIsRayonnant());
142 
143  _dimensionsDiamLineEdit->setText(QString().setNum(getElement()->getDiameter(), 'f', 2));
144  _dimensionsHauteurLineEdit->setText(QString().setNum(getElement()->getHauteur(), 'f', 2));
145 }
146 
148 {
149  _elmW->apply();
150 
151  getElement()->getAcEnveloppe()->setIsRayonnant(_checkBoxEnveloppe->isChecked());
152  getElement()->getCircTop()->setIsRayonnant(_checkBoxCircTop->isChecked());
153  getElement()->getCircBottom()->setIsRayonnant(_checkBoxCircBottom->isChecked());
154 
155  double diameter = _dimensionsDiamLineEdit->text().toDouble();
156  double hauteur = _dimensionsHauteurLineEdit->text().toDouble();
157 
158  getElement()->setDiameter(diameter);
159  getElement()->setHauteur(hauteur);
160 
161  emit modified();
162 }
163 
165 {
166  getElement()->getAcEnveloppe()->setIsRayonnant(_checkBoxEnveloppe->isChecked());
167 
168  int ret = getElement()->getAcEnveloppe()->edit(this);
169 
170  if (ret == QDialog::Accepted)
171  {
172  _lineEditNomEnveloppe->setText(getElement()->getAcEnveloppe()->getName());
173  }
174 
175  _checkBoxEnveloppe->setChecked(getElement()->getAcEnveloppe()->getIsRayonnant());
176 }
177 
179 {
180  getElement()->getCircTop()->setIsRayonnant(_checkBoxCircTop->isChecked());
181 
182  int ret = getElement()->getCircTop()->edit(this);
183 
184  if (ret == QDialog::Accepted)
185  {
186  _lineEditNomCircTop->setText(getElement()->getCircTop()->getName());
187  }
188 
189  _checkBoxCircTop->setChecked(getElement()->getCircTop()->getIsRayonnant());
190 }
191 
193 {
194  getElement()->getCircBottom()->setIsRayonnant(_checkBoxCircBottom->isChecked());
195 
196  int ret = getElement()->getCircBottom()->edit(this);
197 
198  if (ret == QDialog::Accepted)
199  {
200  _lineEditNomCircBottom->setText(getElement()->getCircBottom()->getName());
201  }
202 
203  _checkBoxCircBottom->setChecked(getElement()->getCircBottom()->getIsRayonnant());
204 }
#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()