Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYPlanEauEditor.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 #include <qinputdialog.h>
22 
31 #include "TYPlanEauEditor.h"
32 
33 #define TR(id) OLocalizator::getString("TYPlanEauEditor", (id))
34 
36 {
37  _pPlanEau = NULL;
38  QObject::connect(this, &TYPlanEauEditor::endedSavingPoints, this, &TYPlanEauEditor::endPlanEau);
39 }
40 
42 
44 {
45  switch (key)
46  {
47  case Qt::Key_Space:
48  if (_active)
49  {
50  ((TYSiteModelerFrame*)_pModeler)->getSite()->updateGraphicTree();
52  }
53  break;
54  default:
56  }
57 }
58 
60 {
61  if (!(getSavedPoints().size() > 2) || (!_pModeler->askForResetResultat()))
62  {
63  return;
64  }
65 
66  TYTabPoint tabPts = this->getSavedPoints();
67  _pPlanEau = new TYPlanEau();
68  _pPlanEau->setListPoints(tabPts);
69 
70  if (_pPlanEau->edit(_pModeler) == QDialog::Accepted)
71  {
72  TYSiteNode* pSite = ((TYSiteModelerFrame*)_pModeler)->getSite();
73 
74  if (pSite->getTopographie()->addPlanEau(_pPlanEau))
75  {
77  _pModeler, TR("id_action_addplaneau"));
79 
80  TYProjet* pProjet = getTYApp()->getCurProjet();
81  if (pProjet)
82  {
83  pProjet->getSite()->getTopographie()->updateGraphicTree();
84  }
85 
89  }
90 
91  // repasse en mode camera selection
93  }
94 }
fichier contenant differents types d'actions (fichier header)
TYApplication * getTYApp()
Retourne le pointeur sur l'application.
TYMainWindow * getTYMainWnd()
Retourne le pointeur sur la fenetre principale.
pour l'application Tympan (fichier header)
std::vector< TYPoint > TYTabPoint
Collection de TYPoint.
Definition: TYDefines.h:340
Fenetre principale de l'application Tympan (fichier header)
Classe generique pour une fenetre de modeleur (fichier header)
#define TR(id)
Construit un plan d'eau a partir des points saisis (fichier header)
Le role de cette classe est limite a emettre des signaux pouvant etre utilise pour interagir sur le r...
Classe Modeler specialisee pour l'edition des sites (fichier header)
void refreshSiteFrame()
Rafraichit l'arborescence du TYSiteFrame.
TYModelerFrame * _pModeler
Le modeler associe a cet editor.
TYRenderWindowInteractor * _pInteractor
La vue graphique associee a cet editor.
void addAction(TYAction *pAction)
Ajoute une nouvelle action a l'historique.
Definit une action, necessaire pour la gestion de l'undo.
Definition: TYAction.h:37
Ajout d'un element a la topographie.
Definition: TYActions.h:336
LPTYProjet getCurProjet()
Set/Get du projet courant.
void setDefaultCameraMode()
Classe generique pour une fenetre de modeleur.
TYRenderWindowInteractor * getView()
TYActionManager * getActionManager()
bool askForResetResultat()
virtual void updateView(bool clipping=true, bool axesAndGrid=true)
void updateDisplayList(void)
LPTYPlanEau _pPlanEau
Le dernier plan d'eau cree.
TYPlanEauEditor(TYModelerFrame *pModeler)
virtual void slotKeyPressed(int key)
virtual void setListPoints(const TYTabPoint &liste)
Definition: TYPlanEau.h:132
gestion de l'edition d'une polyligne
void endedSavingPoints()
TYTabPoint & getSavedPoints()
virtual void slotKeyPressed(int key)
bool _active
Indique si cet editor est actif.
classe de definition d'un projet.
Definition: TYProjet.h:45
LPTYSiteNode getSite()
Get du site.
Definition: TYProjet.h:169
virtual void updateGL()
TYOpenGLRenderer * getRenderer()
Classe Modeler specialisee pour l'edition des sites.
LPTYTopographie getTopographie()
Definition: TYSiteNode.h:148
bool addPlanEau(LPTYPlanEauGeoNode pPlanEauGeoNode)