Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYRotationDialog.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 <QBoxLayout>
24 #include <QHBoxLayout>
25 #include <QLabel>
26 
32 #include "TYRotationDialog.h"
33 
34 #define TR(id) OLocalizator::getString("TYRotationDialog", (id))
35 
36 TYRotationDialog::TYRotationDialog(OPoint3D* pElement, QWidget* _pParent /*=NULL*/) : TYFormDialog(_pParent)
37 {
38  Q_ASSERT(pElement);
39  _pElement = pElement;
40 
41  resize(300, 174);
42  setWindowTitle(TR("id_caption"));
43  _pointLayout = new QGridLayout();
44  setLayout(_pointLayout);
45 
46  _groupBox = new QGroupBox(this);
47  _groupBox->setTitle(TR(""));
48  _groupBoxLayout = new QGridLayout();
49  _groupBox->setLayout(_groupBoxLayout);
50 
51  _labelX = new QLabel(_groupBox);
52  _labelX->setText(TR("id_x_label"));
53  _groupBoxLayout->addWidget(_labelX, 0, 0);
54 
55  _labelZ = new QLabel(_groupBox);
56  _labelZ->setText(TR("id_z_label"));
57  _groupBoxLayout->addWidget(_labelZ, 2, 0);
58 
59  _labelY = new QLabel(_groupBox);
60  _labelY->setText(TR("id_y_label"));
61  _groupBoxLayout->addWidget(_labelY, 1, 0);
62 
64  _groupBoxLayout->addWidget(_lineEditX, 0, 1);
65 
67  _groupBoxLayout->addWidget(_lineEditY, 1, 1);
68 
70  _groupBoxLayout->addWidget(_lineEditZ, 2, 1);
71 
72  _pointLayout->addWidget(_groupBox, 0, 0);
73 
74  // Ajout de la checkBox de concatenation des rotations
75  _pConcatenateCheckBox = new QCheckBox(TR("id_concatenate_checkbox"), this);
76  _pConcatenateCheckBox->setChecked(false);
77  _pointLayout->addWidget(_pConcatenateCheckBox, 1, 0);
78 
79  // Bonton ok et cancel
80  QBoxLayout* pBtnLayout = new QHBoxLayout();
81 
82  pBtnLayout->addStretch(1);
83 
84  QPushButton* pButtonOK = new QPushButton(TR("id_ok_btn"), this);
85  pButtonOK->setDefault(true);
86  QObject::connect(pButtonOK, &QPushButton::clicked, this, &TYRotationDialog::apply);
87  pBtnLayout->addWidget(pButtonOK);
88 
89  QPushButton* pButtonCancel = new QPushButton(TR("id_cancel_btn"), this);
90  pButtonCancel->setShortcut(Qt::Key_Escape);
91  QObject::connect(pButtonCancel, &QPushButton::clicked, this, &TYRotationDialog::reject);
92  pBtnLayout->addWidget(pButtonCancel);
93 
94  _pointLayout->addLayout(pBtnLayout, 2, 0);
95 
96  updateContent();
97 }
98 
100 
102 {
103  if (_pConcatenateCheckBox->isChecked() == true)
104  {
105  _pConcatenateCheckBox->setChecked(false);
106  }
107  else
108  {
109  _pConcatenateCheckBox->setChecked(true);
110  }
111 }
112 
114 {
115  _lineEditX->setText(QString().setNum(_pElement->_x, 'f', 2));
116  _lineEditY->setText(QString().setNum(_pElement->_y, 'f', 2));
117  _lineEditZ->setText(QString().setNum(_pElement->_z, 'f', 2));
118 }
119 
121 {
122  _pElement->_x = _lineEditX->text().toDouble();
123  _pElement->_y = _lineEditY->text().toDouble();
124  _pElement->_z = _lineEditZ->text().toDouble();
125 
126  accept();
127 }
128 
130 {
131  _lineEditX->setText("0.0");
132  _lineEditX->setEnabled(false);
133  _lineEditY->setText("0.0");
134  _lineEditY->setEnabled(false);
135 }
All base classes related to 3D manipulation.
outil IHM pour un element (fichier header)
outil IHM pour une entrée utilisateur (fichier header)
#define TR(id)
Boite de dialogue pour la saisie de la l'angle des objets (fichier header)
double _y
y coordinate of OCoord3D
Definition: 3d.h:283
double _z
z coordinate of OCoord3D
Definition: 3d.h:284
double _x
x coordinate of OCoord3D
Definition: 3d.h:282
The 3D point class.
Definition: 3d.h:487
TYLineEdit * _lineEditZ
TYRotationDialog(OPoint3D *pElement, QWidget *_pParent=NULL)
virtual void switchConcatenate()
void lockXY()
Empeche les rotations selon X et Y (utile pour les sites ...)
virtual void updateContent()
virtual void apply()
TYLineEdit * _lineEditY
QGridLayout * _groupBoxLayout
virtual ~TYRotationDialog()
QGridLayout * _pointLayout
TYLineEdit * _lineEditX
QCheckBox * _pConcatenateCheckBox
QGroupBox * _groupBox