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