Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYEmpriseEditor.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 
35 #include "TYEmpriseEditor.h"
36 
37 #define TR(id) OLocalizator::getString("TYEmpriseEditor", (id))
38 
40 {
41  QObject::connect(this, &TYEmpriseEditor::endedSavingPoints, this, &TYEmpriseEditor::endEmprise);
42 }
43 
45 
47 {
48  switch (key)
49  {
50  case Qt::Key_Space:
51  if (_active)
52  {
53  ((TYSiteModelerFrame*)_pModeler)->getSite()->updateGraphic();
55  }
56  break;
57  default:
59  }
60 }
61 
63 {
64  if (getSavedPoints().size() != 0)
65  {
67  {
68  // On met les points a altitude 0
69  for (unsigned int i = 0; i < getSavedPoints().size(); i++)
70  {
71  getSavedPoints()[i]._z = 0.0;
72  }
73 
74  // Close the polyline
75  getSavedPoints().push_back(getSavedPoints().at(0));
76 
77  // Le site en edition
78  LPTYSiteNode pSite = ((TYSiteModelerFrame*)_pModeler)->getSite();
79  LPTYTopographie pTopo = pSite->getTopographie();
80 
81  // Action
82  TYAction* pAction =
83  new TYSetEmpriseTopoAction(pTopo, getSavedPoints(), _pModeler, TR("id_action_setemprise"));
85 
86  // On assigne les points saisies pour l'emprise de la topo
87  pTopo->setEmprise(getSavedPoints());
88  pSite->getAltimetry()->setIsGeometryModified(true);
89 
90  // Update
91  pTopo->updateGraphicTree();
92 
95 
96  // repasse en mode camera selection
98  }
99  }
100 }
fichier contenant differents types d'actions (fichier header)
TYMainWindow * getTYMainWnd()
Retourne le pointeur sur la fenetre principale.
pour l'application Tympan (fichier header)
#define TR(id)
Construit l'emprise a partir des points saisis (fichier header)
Fenetre principale de l'application Tympan (fichier header)
Classe generique pour une fenetre de modeleur (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)
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
virtual void setIsGeometryModified(bool isModified)
Definition: TYElement.cpp:253
TYEmpriseEditor(TYModelerFrame *pModeler)
virtual void slotKeyPressed(int key)
void endEmprise()
Construit l'emprise a partir des points saisis.
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)
gestion de l'edition d'une polyligne
void endedSavingPoints()
TYTabPoint & getSavedPoints()
virtual void slotKeyPressed(int key)
bool _active
Indique si cet editor est actif.
virtual void updateGL()
TYOpenGLRenderer * getRenderer()
Action de positionnement de l'emprise de la topographie.
Definition: TYActions.h:848
Classe Modeler specialisee pour l'edition des sites.
LPTYAltimetrie getAltimetry() const
LPTYTopographie getTopographie()
Definition: TYSiteNode.h:148
void setEmprise(const TYTabPoint &pts, const bool &defTerrain=true)