Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYPolygonWidget.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 #include <QTreeWidget>
24 #include <QTreeWidgetItem>
25 
29 #include "TYPolygonWidget.h"
30 
31 #define TR(id) OLocalizator::getString("TYPolygonWidget", (id))
32 
33 TYPolygonWidget::TYPolygonWidget(TYPolygon* pElement, QWidget* _pParent /*=NULL*/)
34  : TYWidget(pElement, _pParent)
35 {
36  _elmW = new TYElementWidget(pElement, this);
37  _surfaceW = new TYSurfaceInterfaceWidget(pElement, this);
38 
39  resize(300, 200);
40  setWindowTitle(TR("id_caption"));
41  _polygonLayout = new QGridLayout();
42  setLayout(_polygonLayout);
43  _polygonLayout->addWidget(_elmW, 0, 0);
44  _polygonLayout->addWidget(_surfaceW, 1, 0);
45 
46  _groupBox = new QGroupBox(this);
47  _groupBox->setTitle(TR("id_pts"));
48  _groupBoxLayout = new QGridLayout();
49  _groupBox->setLayout(_groupBoxLayout);
50 
51  _listViewTabPt = new QTreeWidget(_groupBox);
52  QStringList stringList;
53  stringList.append(TR("id_x"));
54  stringList.append(TR("id_y"));
55  stringList.append(TR("id_z"));
56  _listViewTabPt->setColumnCount(3);
57  _listViewTabPt->setHeaderLabels(stringList);
58  _listViewTabPt->setSelectionMode(QTreeWidget::NoSelection);
59  // _listViewTabPt->setRootIsDecorated( true );
60 
61  _groupBoxLayout->addWidget(_listViewTabPt, 0, 0);
62 
63  _polygonLayout->addWidget(_groupBox, 2, 0);
64 
65  updateContent();
66 }
67 
69 
71 {
72  QString num;
73 
76 
77  _listViewTabPt->clear();
78  for (int i = 0; i < getElement()->getNbPts(); i++)
79  {
80  QTreeWidgetItem* item = new QTreeWidgetItem(_listViewTabPt, 0);
81  item->setText(0, num.setNum(getElement()->getPoints()[i]._x, 'f', 2));
82  item->setText(1, num.setNum(getElement()->getPoints()[i]._y, 'f', 2));
83  item->setText(2, num.setNum(getElement()->getPoints()[i]._z, 'f', 2));
84  }
85 }
86 
88 {
89  _elmW->apply();
90  _surfaceW->apply();
91 
92  emit modified();
93 }
#define TR(id)
outil IHM pour un polygone (fichier header)
outil IHM pour la gestion des objets de type SurfaceInterface (fichier header)
classe de l'objet IHM pour un element
virtual void apply()
virtual void updateContent()
QGridLayout * _groupBoxLayout
TYSurfaceInterfaceWidget * _surfaceW
QGridLayout * _polygonLayout
virtual ~TYPolygonWidget()
virtual void updateContent()
TYElementWidget * _elmW
QTreeWidget * _listViewTabPt
QGroupBox * _groupBox
TYPolygonWidget(TYPolygon *pElement, QWidget *_pParent=NULL)
virtual void apply()
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
void modified()