Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYEmpriseEditor.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 
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();
54  _pInteractor->update();
55  }
56  break;
57  default:
59  }
60 }
61 
63 {
64  if (getSavedPoints().size() != 0)
65  {
67  {
68  // Set points at site default altitude
69  for (unsigned int i = 0; i < getSavedPoints().size(); i++)
70  {
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->updateGraphic();
92  pTopo->updateGraphicTree();
93 
96 
97  // repasse en mode camera selection
99  }
100  }
101 }
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()
Generic class for a modeler window.
TYRenderWindowInteractor * getView()
TYActionManager * getActionManager()
virtual float getDefaultZCoord()
Returns default Z coordinate for editors This value will depend on the type of modeler and of the fix...
bool askForResetResultat()
virtual void updateView(bool clipping=true, bool axesAndGrid=true)
void invalidateScene(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.
TYOpenGLRenderer * getRenderer()
Action de positionnement de l'emprise de la topographie.
Definition: TYActions.h:849
Classe Modeler specialisee pour l'edition des sites.
LPTYAltimetrie getAltimetry() const
LPTYTopographie getTopographie()
Definition: TYSiteNode.h:149
void setEmprise(const TYTabPoint &pts, const bool &defTerrain=true)