21 #include <qmessagebox.h>
25 #include <qpushbutton.h>
26 #include <qbuttongroup.h>
28 #include <QHBoxLayout>
29 #include <QGridLayout>
51 #define TR(id) OLocalizator::getString("TYEtageEditor", (id))
65 bool onlyEcran =
false;
74 if (tabPts.size() >= 3)
88 QMessageBox::warning(
_pModeler,
TR(
"id_caption"),
TR(
"id_msg_etage_invalid"));
100 int ret = pDlg->exec();
102 if (ret == QDialog::Accepted)
136 size_t nbPts = tabPts.size();
138 for (
size_t i = 0; (i < nbPts) && !invalid; i++)
140 TYSegment seg1(tabPts[i], tabPts[(i + 1) % nbPts]);
142 for (
size_t j = 0; (j < nbPts) && !invalid; j++)
144 TYSegment seg2(tabPts[j], tabPts[(j + 1) % nbPts]);
153 if ((i == nbPts - 1) || (j == nbPts - 1))
171 if (tabPts.size() > 2)
177 for (
unsigned int i = 1; i < tabPts.size() - 1; i++)
184 somme = somme + v1.
cross(v2).
_z;
191 vector<TYPoint>::reverse_iterator it;
192 for (it = tabPtsTemp.rbegin(); it != tabPtsTemp.rend(); it++)
194 tabPts.push_back((*it));
203 for (
size_t i = 0; i < tabPts.size(); i++)
211 size_t nbPts = tabPts.size();
217 for (
size_t i = 0; i < nbPts; i++)
219 centre.
_x += tabPts[i]._x;
220 centre.
_y += tabPts[i]._y;
228 for (
size_t i = 0; i < nbPts; i++)
230 tabPts[i] =
OVector3D(tabPts[i]) - centre;
234 centre.
_z = initialOffset;
245 pEtage->
setMurs(tabPts, hauteur, closed);
251 if (QString(
_pModeler->metaObject()->className()).compare(
"TYBatimentModelerFrame") == 0)
264 else if (QString(
_pModeler->metaObject()->className()).compare(
"TYSiteModelerFrame") == 0)
298 pBat->updateGraphicTree();
311 pEcran->setElements(tabPts, height, thickness);
317 if (QString(
_pModeler->metaObject()->className()).compare(
"TYBatimentModelerFrame") == 0)
330 else if (QString(
_pModeler->metaObject()->className()).compare(
"TYSiteModelerFrame") == 0)
367 pBat->updateGraphicTree();
384 this->setWindowTitle(
TR(
"id_caption"));
386 QGridLayout* pLayout =
new QGridLayout();
393 QLabel* pHauteurLabelName =
new QLabel(
this);
394 pHauteurLabelName->setText(
TR(
"id_hauteur_label"));
398 double hauteur = 5.0;
421 double epaisseur = 0.3;
441 QLabel* pHauteurSolLabelName =
new QLabel(
this);
442 pHauteurSolLabelName->setText(
TR(
"id_hauteur_sol_label"));
454 QButtonGroup* pEcranOuBatBtnGroup =
new QButtonGroup();
455 pEcranOuBatBtnGroup->setExclusive(
true);
456 _pBatBtn =
new QRadioButton(
TR(
"id_bat_label"));
457 pEcranOuBatBtnGroup->addButton(
_pBatBtn, 0);
459 pEcranOuBatBtnGroup->addButton(
_pEcranBtn, 1);
462 QGridLayout* groupBoxEcranOuBatLayout =
new QGridLayout();
463 groupBoxEcranOuBatLayout->addWidget(
_pBatBtn, 0, 0);
464 groupBoxEcranOuBatLayout->addWidget(
_pEcranBtn, 0, 1);
466 QGroupBox* groupBoxEcranOuBat =
new QGroupBox();
467 groupBoxEcranOuBat->setTitle(
TR(
""));
468 groupBoxEcranOuBat->setLayout(groupBoxEcranOuBatLayout);
482 void (QButtonGroup::*_qButtonGroup_clicked)(int) = &QButtonGroup::idClicked;
484 QObject::connect(pEcranOuBatBtnGroup, _qButtonGroup_clicked,
this,
490 QHBoxLayout* tabPointsLayout =
new QHBoxLayout();
491 tabPointsLayout->setContentsMargins(10, 10, 10, 10);
492 pLayout->addLayout(tabPointsLayout, 4, 0);
493 tabPointsLayout->addWidget(
_tabPtsW);
502 QPushButton* pButtonOK =
new QPushButton(
TR(
"id_ok_btn"),
this);
503 pButtonOK->setDefault(
true);
508 QPushButton* pButtonCancel =
new QPushButton(
TR(
"id_cancel_btn"),
this);
509 pButtonCancel->setShortcut(Qt::Key_Escape);
510 QObject::connect(pButtonCancel, &QPushButton::clicked,
this, &TYEtageEditorPropertiesDlg::reject);
All base classes related to 3D manipulation.
#define INTERS_NULLE
No intersection.
fichier contenant differents types d'actions (fichier header)
TYApplication * getTYApp()
Retourne le pointeur sur l'application.
void writeDebugMsg(QString msg)
Affiche un message de debug dans la fenetre de sortie.
TYMainWindow * getTYMainWnd()
Retourne le pointeur sur la fenetre principale.
pour l'application Tympan (fichier header)
Modeler specialisee pour l'edition des batiments (fichier header)
std::vector< TYPoint > TYTabPoint
Collection de TYPoint.
#define TYDIRPREFERENCEMANAGER
Construit un etage a partir des points saisis (fichier header)
Fenetre principale de l'application Tympan (fichier header)
Classe Modeler specialisee pour l'edition des sites (fichier header)
double _y
y coordinate of OCoord3D
double _z
z coordinate of OCoord3D
double _x
x coordinate of OCoord3D
OPoint3D _origin
The origin point.
OPoint3D _ptA
Point A of the segment.
virtual int intersects(const OSegment3D &seg, OPoint3D &pt, double seuilConfondus) const
Return the intersection point with another segment.
OPoint3D _ptB
Point B of the segment.
void normalize()
Normalizes this vector.
OVector3D cross(const OVector3D &vector) const
Cross product.
void refreshSiteFrame()
Rafraichit l'arborescence du TYSiteFrame.
TYModelerFrame * _pModeler
Le modeler associe a cet editor.
bool addAcousticVol(LPTYAcousticVolumeGeoNode pAccVolGeoNode, bool recursif=true)
void addAction(TYAction *pAction)
Ajoute une nouvelle action a l'historique.
Definit une action, necessaire pour la gestion de l'undo.
ajout d'un volume acoustique a un ensemble de volumes acoustiques
Ajout d'un element a une infrastructure.
LPTYProjet getCurProjet()
Set/Get du projet courant.
Classe Modeler specialisee pour l'edition des batiments.
bool addToSelection(TYUUID id)
Adds the item to the selection of this Calculation.
~TYEtageEditorPropertiesDlg()
TYLineEdit * _pEpaisseurLineEdit
QBoxLayout * _pEpaisseurLayout
double getEpaisseur()
Retourne l'epaisseur saisie.
void toggleButton(int i)
Callback qd l'utilisateur selectionne la creation d'un ecran.
QBoxLayout * _pEcranOuBatLayout
TYEtageEditorPropertiesDlg(QWidget *parent, TYTabPoint &tabPts, bool onlyEcran=false)
QLabel * _pEpaisseurLabelName
QBoxLayout * _pHauteurLayout
double getHauteurSol()
Retourne la hauteur au sol saisie.
bool etageSelected()
Retourne si l'utilisateur a selectionne la construction d'un etage.
TabPointsWidget * _tabPtsW
TYLineEdit * _pHauteurSolLineEdit
QBoxLayout * _pHauteurSolLayout
QRadioButton * _pEcranBtn
TYLineEdit * _pHauteurLineEdit
double getHauteur()
Retourne la hauteur saisie.
void initZ(TYTabPoint &tabPts)
TYEtageEditor(TYModelerFrame *pModeler)
bool testCrossSegment(TYTabPoint &tabPts, bool &onlyEcran)
void computeCenter(const double initialOffset, TYTabPoint &tabPts, TYRepere &rep)
void buildScreen(TYTabPoint &tabPts, TYRepere &rep, double height, double thickness)
void buildFloor(TYTabPoint &tabPts, TYRepere &rep, double hauteur, bool closed)
void endEtage()
Construit un etage a partir des points saisis.
void forceNormals(TYTabPoint &tabPts)
bool setMurs(const TYTabPoint &tabPts, double hauteur=2.0, bool close=true)
bool addBatiment(LPTYBatimentGeoNode pBatimentGeoNode)
bool remBatiment(const LPTYBatimentGeoNode pBatimentGeoNode)
void setDefaultCameraMode()
Classe generique pour une fenetre de modeleur.
TYRenderWindowInteractor * getView()
TYActionManager * getActionManager()
bool isElementInCurrentProjet()
bool askForResetResultat()
virtual void updateView(bool clipping=true, bool axesAndGrid=true)
void updateDisplayList(void)
gestion de l'edition d'une polyligne
TYTabPoint & getSavedPoints()
bool _dispDist
Indique si l'information de distance doit etre affichee ou non.
LPTYCalcul getCurrentCalcul()
Set/Get du pointeur du Calcul courant.
TYOpenGLRenderer * getRenderer()
Classe Modeler specialisee pour l'edition des sites.