Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYCourbeNiveauEditor.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 
21 #include <qinputdialog.h>
22 
34 #include "TYCourbeNiveauEditor.h"
35 
36 #define TR(id) OLocalizator::getString("TYCourbeNiveauEditor", (id))
37 
39 {
40  _pCrbNiv = NULL;
41  QObject::connect(this, &TYCourbeNiveauEditor::endedSavingPoints, this,
43 }
44 
46 
48 {
49  ((TYSiteModelerFrame*)_pModeler)->showCrbNiv(true);
50 
52 }
53 
55 {
56  switch (key)
57  {
58  case Qt::Key_Space:
59  if (_active)
60  {
61  ((TYSiteModelerFrame*)_pModeler)->getSite()->updateGraphic();
62  _pInteractor->update();
63  }
64  break;
65  default:
67  }
68 }
69 
71 {
72 
73  if (!(getSavedPoints().size() > 1) || (!_pModeler->askForResetResultat()))
74  {
75  return;
76  }
77 
78  _pCrbNiv = new TYCourbeNiveau();
81 
82  if (_pCrbNiv->edit(_pModeler) == QDialog::Accepted)
83  {
84  TYSiteNode* pSite = ((TYSiteModelerFrame*)_pModeler)->getSite();
85 
86  if (pSite->getTopographie()->addCrbNiv(_pCrbNiv))
87  {
89  _pModeler, TR("id_action_addcrbniv"));
91 
92  TYProjet* pProjet = getTYApp()->getCurProjet();
93  if (pProjet)
94  {
95  LPTYCalcul pCalcul = pProjet->getCurrentCalcul();
96  if (pCalcul)
97  {
98  pCalcul->addToSelection(_pCrbNiv);
99  }
100  pProjet->getSite()->getTopographie()->updateGraphicTree();
101  }
102 
103  updateSiteFrame();
105 
107  }
108 
109  // repasse en mode camera selection
111  }
112 }
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)
#define TR(id)
Construit une courbe de niveau a partir des points saisis (fichier header)
Representation graphique d'une courbe de niveau (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)
void updateSiteFrame()
Reconstruit 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:337
LPTYProjet getCurProjet()
Set/Get du projet courant.
bool addToSelection(TYUUID id)
Adds the item to the selection of this Calculation.
Definition: TYCalcul.cpp:873
void endCourbeNiveau()
Construit une courbe de niveau a partir des points saisis.
TYCourbeNiveauEditor(TYModelerFrame *pModeler)
virtual void slotKeyPressed(int key)
LPTYCourbeNiveau _pCrbNiv
La derniere courbe de niveau creee.
void setListPoints(const TYTabPoint &pts)
void setAltitude(double alt)
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 init()
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
LPTYCalcul getCurrentCalcul()
Set/Get du pointeur du Calcul courant.
Definition: TYProjet.h:426
TYOpenGLRenderer * getRenderer()
Classe Modeler specialisee pour l'edition des sites.
LPTYTopographie getTopographie()
Definition: TYSiteNode.h:149
bool addCrbNiv(LPTYCourbeNiveauGeoNode pCrbNivGeoNode)