Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYPlanEauEditor.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 
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();
51  _pInteractor->update();
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);
70 
71  if (_pPlanEau->edit(_pModeler) == QDialog::Accepted)
72  {
73  TYSiteNode* pSite = ((TYSiteModelerFrame*)_pModeler)->getSite();
74 
75  if (pSite->getTopographie()->addPlanEau(_pPlanEau))
76  {
78  _pModeler, TR("id_action_addplaneau"));
80 
81  TYProjet* pProjet = getTYApp()->getCurProjet();
82  if (pProjet)
83  {
84  LPTYCalcul pCalcul = pProjet->getCurrentCalcul();
85  if (pCalcul)
86  {
87  pCalcul->addToSelection(_pPlanEau);
88  }
89  pProjet->getSite()->getTopographie()->updateGraphicTree();
90  }
91 
95  }
96 
97  // repasse en mode camera selection
99  }
100 }
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: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 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)
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
void setAltitude(double alt)
Definition: TYPlanEau.h:109
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
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 addPlanEau(LPTYPlanEauGeoNode pPlanEauGeoNode)