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