Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYReseauTransportEditor.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 
21 #include <qinputdialog.h>
22 
32 
33 #define TR(id) OLocalizator::getString("TYReseauTransportEditor", (id))
34 
36 {
37  // Disambiguate the overloaded slot TYReseauTransportEditor::endReseauTransport
38  void (TYReseauTransportEditor::*tyReseauTransportEditor_endReseauTransport)() =
40  QObject::connect(this, &TYReseauTransportEditor::endedSavingPoints, this,
41  tyReseauTransportEditor_endReseauTransport);
42 }
43 
45 
47 {
48  if (!(getSavedPoints().size() > 1) || (!_pModeler->askForResetResultat()))
49  {
50  return;
51  }
52 
53  LPTYReseauTransport pReseauTransport = new TYReseauTransport();
54  pReseauTransport->setTabPoint(getSavedPoints());
55 
56  if (pReseauTransport->edit(_pModeler) == QDialog::Accepted)
57  {
58  TYSiteNode* pSite = ((TYSiteModelerFrame*)_pModeler)->getSite();
59 
60  if (pSite->getInfrastructure()->addResTrans(pReseauTransport))
61  {
62  // On ajoute ce reseau a la selection du calcul courant
63  if (getTYApp()->getCurProjet() && (getTYApp()->getCurProjet()->getSite() == pSite))
64  {
66 
67  if (pCalcul)
68  {
69  pCalcul->addToSelection(pReseauTransport);
70  }
71  }
72 
73  TYAction* pAction =
74  new TYAddElementToInfraAction((LPTYElement&)pReseauTransport, pSite->getInfrastructure(),
75  _pModeler, TR("id_action_addrestrans"));
77 
78  TYProjet* pProjet = getTYApp()->getCurProjet();
79  pProjet->getSite()->getInfrastructure()->updateGraphicTree();
80  pProjet->getSite()->updateGraphic();
84  }
85 
86  // repasse en mode camera selection
88  }
89 }
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 un reseau de transport a partir des points saisis (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:398
LPTYProjet getCurProjet()
Set/Get du projet courant.
bool addToSelection(TYUUID id)
Adds the item to the selection of this Calculation.
Definition: TYCalcul.cpp:872
bool addResTrans(LPTYReseauTransportGeoNode pResTransGeoNode)
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()
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()
Construit un reseau de transport a partir des points saisis.
TYReseauTransportEditor(TYModelerFrame *pModeler)
Classe Modeler specialisee pour l'edition des sites.
LPTYInfrastructure getInfrastructure()
Definition: TYSiteNode.h:173