Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYTerrainEditor.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 
23 #include "Tympan/core/logging.h"
34 #include "TYTerrainEditor.h"
35 
36 #define TR(id) OLocalizator::getString("TYTerrainEditor", (id))
37 
39 {
40  QObject::connect(this, &TYTerrainEditor::endedSavingPoints, this, &TYTerrainEditor::endTerrain);
41 }
42 
44 
46 {
47  if (!(getSavedPoints().size() > 2) || (!_pModeler->askForResetResultat()))
48  {
49  return;
50  }
51 
52  LPTYTerrain pTerrain = new TYTerrain();
53  LPTYSol pSol = new TYSol();
54  pTerrain->setSol(pSol);
55  pTerrain->setListPoints(getSavedPoints());
56 
57  if (pTerrain->edit(_pModeler) == QDialog::Accepted)
58  {
59  TYSiteNode* pSite = ((TYSiteModelerFrame*)_pModeler)->getSite();
60 
61  // This hardly readable cascade of if is better than no reporting
62  // but should instead be handled with exceptions.
63  if (pSite->getTopographie()->addTerrain(pTerrain))
64  {
65  TYAction* pAction = new TYAddElementToTopoAction((LPTYElement&)pTerrain, pSite->getTopographie(),
66  _pModeler, TR("id_action_addsol"));
68 
69  pSite->getTopographie()->updateGraphicTree();
73  }
74 
75  // repasse en mode camera selection
77  }
78 }
fichier contenant differents types d'actions (fichier header)
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)
Classe Modeler specialisee pour l'edition des sites (fichier header)
outil IHM pour un sol (fichier header)
#define TR(id)
Construit un sol a partir des points saisis (fichier header)
void updateSiteFrame()
Reconstruit 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 la topographie.
Definition: TYActions.h:336
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()
TYOpenGLRenderer * getRenderer()
Classe Modeler specialisee pour l'edition des sites.
LPTYTopographie getTopographie()
Definition: TYSiteNode.h:148
Definition: TYSol.h:25
TYTerrainEditor(TYModelerFrame *pModeler)
bool addTerrain(LPTYTerrainGeoNode pTerGeoNode)