Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYRouteEditor.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 
32 #include "TYRouteEditor.h"
33 
34 #define TR(id) OLocalizator::getString("TYRouteEditor", (id))
35 
37 {
38  QObject::connect(this, &TYRouteEditor::endedSavingPoints, this, &TYRouteEditor::endRoute);
39 }
40 
42 
44 {
45  if (!(getSavedPoints().size() > 1) || (!_pModeler->askForResetResultat()))
46  {
47  return;
48  }
49 
50  LPTYRoute pRoute = new TYRoute();
51  pRoute->setTabPoint(this->getSavedPoints());
52 
53  if (pRoute->edit(_pModeler) == QDialog::Accepted)
54  {
55  TYSiteNode* pSite = ((TYSiteModelerFrame*)_pModeler)->getSite();
56 
57  if (pSite->getInfrastructure()->addRoute(pRoute))
58  {
59  // On ajoute cette route a la selection du calcul courant
60  if (getTYApp()->getCurProjet() && (getTYApp()->getCurProjet()->getSite() == pSite))
61  {
63 
64  if (pCalcul)
65  {
66  pCalcul->addToSelection(pRoute);
67  }
68  }
69 
70  TYAction* pAction = new TYAddElementToInfraAction(
71  (LPTYElement&)pRoute, pSite->getInfrastructure(), _pModeler, TR("id_action_addroute"));
73 
74  // repasse en mode camera selection
76 
77  TYProjet* pProjet = getTYApp()->getCurProjet();
78  pProjet->getSite()->updateGraphicTree();
79  pProjet->getSite()->updateGraphic();
83  }
84  }
85 }
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)
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...
#define TR(id)
Construit une route a partir des points saisis (fichier header)
outil IHM pour une route (fichier header)
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.
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 une infrastructure.
Definition: TYActions.h:399
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()
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()
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()
TYRouteEditor(TYModelerFrame *pModeler)
Classe Modeler specialisee pour l'edition des sites.
LPTYInfrastructure getInfrastructure()
Definition: TYSiteNode.h:174