Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYAcousticSurfaceWidget.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 
32 #include "TYElementWidget.h"
33 
34 #define TR(id) OLocalizator::getString("TYAcousticSurfaceWidget", (id))
35 
37  : TYWidget(pElement, _pParent)
38 {
39 
40  _elmW = new TYElementWidget(pElement, this);
41  _colorW = new TYColorInterfaceWidget(dynamic_cast<TYColorInterface*>(pElement), this);
42  _interW = new TYAcousticInterfaceWidget(dynamic_cast<TYAcousticInterface*>(pElement), this);
43  _surfaceW = new TYSurfaceInterfaceWidget(dynamic_cast<TYSurfaceInterface*>(pElement), this);
44 
45  resize(300, 570);
46  setWindowTitle(TR("id_caption"));
47  _acousticSurfaceLayout = new QGridLayout();
48  setLayout(_acousticSurfaceLayout);
49 
50  unsigned short numLine = 0;
51 
52  _acousticSurfaceLayout->addWidget(_elmW, numLine, 0);
53  _acousticSurfaceLayout->addWidget(_colorW, ++numLine, 0);
54  _acousticSurfaceLayout->addWidget(_surfaceW, ++numLine, 0);
55  _acousticSurfaceLayout->addWidget(_interW, ++numLine, 0);
56 
57  /* _groupBoxSrcSurf = new QGroupBox( this, "_groupBoxSrcSurf" );
58  _groupBoxSrcSurf->setTitle( TR( "id_srcSurf" ) );
59  _groupBoxSrcSurf->setColumnLayout(0, Qt::Vertical );
60  _groupBoxSrcSurf->layout()->setSpacing( 6 );
61  _groupBoxSrcSurf->layout()->setContentsMargins(11, 11, 11, 11);
62  _groupBoxSrcSurfLayout = new QGridLayout( _groupBoxSrcSurf->layout() );
63  _groupBoxSrcSurfLayout->setAlignment( Qt::AlignTop );
64 
65  _lineEditNomSrcsurf = new QLineEdit( _groupBoxSrcSurf, "_lineEditNomSrcsurf" );
66  _lineEditNomSrcsurf->setText( getElement()->getSrcSurf()->getName() );
67  _lineEditNomSrcsurf->setEnabled( false );
68  _groupBoxSrcSurfLayout->addWidget( _lineEditNomSrcsurf, 0, 0 );
69 
70  _pushButtonSrcSurf = new QPushButton( _groupBoxSrcSurf, "_pushButtonSrcSurf" );
71  _pushButtonSrcSurf->setText( TR( "id_proprietes_button" ) );
72  _groupBoxSrcSurfLayout->addWidget( _pushButtonSrcSurf, 0, 1 );
73 
74  _acousticSurfaceLayout->addWidget( _groupBoxSrcSurf, 4, 0 );
75  */
76  _groupBoxMat = new QGroupBox(this);
77  _groupBoxMat->setTitle(TR("id_mat"));
78  _groupBoxMatLayout = new QGridLayout();
79  _groupBoxMat->setLayout(_groupBoxMatLayout);
80 
81  _lineEditNomMat = new QLineEdit(_groupBoxMat);
82  _lineEditNomMat->setEnabled(false);
83  _groupBoxMatLayout->addWidget(_lineEditNomMat, 0, 0);
84 
85  _pushButtonMat = new QPushButton(_groupBoxMat);
86  _pushButtonMat->setText(TR("id_proprietes_button"));
87  _groupBoxMatLayout->addWidget(_pushButtonMat, 0, 1);
88 
89  if (getElement()->getMateriau() != NULL)
90  {
91  _lineEditNomMat->setText(getElement()->getMateriau()->getName());
92  }
93  else
94  {
95  _groupBoxMat->setEnabled(false);
96  }
97 
98  _acousticSurfaceLayout->addWidget(_groupBoxMat, ++numLine, 0);
99  /*
100  _groupBoxRect = new QGroupBox( this, "_groupBoxRect" );
101  _groupBoxRect->setTitle( TR( "id_rect" ) );
102  _groupBoxRect->setColumnLayout(0, Qt::Vertical );
103  _groupBoxRect->layout()->setSpacing( 6 );
104  _groupBoxRect->layout()->setContentsMargins(11, 11, 11, 11);
105  _groupBoxRectLayout = new QGridLayout( _groupBoxRect->layout() );
106  _groupBoxRectLayout->setAlignment( Qt::AlignTop );
107 
108  _lineEditNomRect = new QLineEdit( _groupBoxRect, "_lineEditNomRect" );
109  _lineEditNomRect->setText( getElement()->getBoundingRect()->getName() );
110  _lineEditNomRect->setEnabled( false );
111  _groupBoxRectLayout->addWidget( _lineEditNomRect, 0, 0 );
112 
113  _pushButtonRect = new QPushButton( _groupBoxRect, "_pushButtonRect" );
114  _pushButtonRect->setText( TR( "id_proprietes_button" ) );
115  _groupBoxRectLayout->addWidget( _pushButtonRect, 0, 1 );
116 
117  _acousticSurfaceLayout->addWidget( _groupBoxRect, 6, 0 );
118  */
119  // connect(_pushButtonRect,&QPushButton::clicked,this, &TYAcousticSurfaceWidget::editRect);
120  connect(_pushButtonMat, &QPushButton::clicked, this, &TYAcousticSurfaceWidget::editMat);
121  // connect(_pushButtonSrcSurf,&QPushButton::clicked,this, &TYAcousticSurfaceWidget::editSrcSurf);
122 
123  updateContent();
124 }
125 
127 
129 {
130  _elmW->updateContent();
134 
135  if (getElement()->getMateriau() != NULL)
136  {
137  _lineEditNomMat->setText(getElement()->getMateriau()->getName());
138  }
139  // _lineEditNomSrcsurf->setText( getElement()->getSrcSurf()->getName() );
140  // _lineEditNomRect->setText( getElement()->getBoundingRect()->getName() );
141 }
142 
144 {
145  _elmW->apply();
146  _colorW->apply();
147  _interW->apply();
148  _surfaceW->apply();
149 
151 
152  emit modified();
153 }
154 /*
155 void TYAcousticSurfaceWidget::editRect()
156 {
157  int ret = getElement()->getBoundingRect()->edit(this);
158 
159  if (ret == QDialog::Accepted) {
160  _lineEditNomRect->setText( getElement()->getBoundingRect()->getName() );
161  }
162 }
163 
164 void TYAcousticSurfaceWidget::editSrcSurf()
165 {
166  int ret = getElement()->getSrcSurf()->edit(this);
167 
168  if (ret == QDialog::Accepted) {
169 // _lineEditNomSrcsurf->setText( getElement()->getSrcSurf()->getName() );
170  }
171 }
172 */
174 {
175  int ret = getElement()->getMateriau()->edit(this);
176 
177  if ((ret == QDialog::Accepted) && (getElement()->getMateriau() != NULL))
178  {
179  _lineEditNomMat->setText(getElement()->getMateriau()->getName());
180  }
181 }
Outil IHM pour une interface acoustique (fichier header)
#define TR(id)
outil IHM pour une surface acoustique (fichier header)
outil IHM pour l'objet ColorInterface (fichier header)
outil IHM pour un element (fichier header)
outil IHM pour la gestion des objets de type SurfaceInterface (fichier header)
classe de l'objet IHM pour une interface acoustique
TYAcousticSurfaceWidget(TYAcousticSurface *pElement, QWidget *_pParent=NULL)
TYAcousticInterfaceWidget * _interW
TYColorInterfaceWidget * _colorW
TYSurfaceInterfaceWidget * _surfaceW
classe de l'objet IHM pour l'objet ColorInterface
classe de l'objet IHM pour un element
virtual void apply()
virtual void updateContent()
virtual void setIsAcousticModified(bool isModified)
Definition: TYElement.cpp:248
classe de l'objet IHM pour la gestion des objets de type SurfaceInterface
classe de l'objet IHM pour un objet metier de type TYElement
Definition: TYWidget.h:43
TYElement * _pElement
Definition: TYWidget.h:114
void modified()