Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYProjetGraphic.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 
24 #include "TYProjetGraphic.h"
25 
26 #include "gui/gl/TYRenderContext.h"
27 #include <QtOpenGL>
28 
30 
32 
33 void TYProjetGraphic::update(bool force /*=false*/)
34 {
36 }
37 
38 void TYProjetGraphic::getChilds(TYListPtrTYElementGraphic& childs, bool recursif /*=true*/)
39 {
40  TYElementGraphic* pTYElementGraphic = getElement()->getSite()->getGraphicObject().getRealPointer();
41  childs.push_back(pTYElementGraphic);
42  if (recursif)
43  {
44  pTYElementGraphic->getChilds(childs, recursif);
45  }
46  if (getElement()->getCurrentCalcul())
47  {
48  pTYElementGraphic = getElement()->getCurrentCalcul()->getGraphicObject().getRealPointer();
49  childs.push_back(pTYElementGraphic);
50  if (recursif)
51  {
52  pTYElementGraphic->getChilds(childs, recursif);
53  }
54  }
55 
56  // Points de controle
57  unsigned int i = 0;
58  for (i = 0; i < getElement()->getPointsControl().size(); i++)
59  {
60  pTYElementGraphic = getElement()->getPointControl(i)->getGraphicObject().getRealPointer();
61  childs.push_back(pTYElementGraphic);
62  if (recursif)
63  {
64  pTYElementGraphic->getChilds(childs, recursif);
65  }
66  }
67 
68  // Maillage
69  TYTabMaillageGeoNode* pTabMaillage = &getElement()->getMaillages();
70  LPTYMaillageGeoNode pMaillageGeoNode;
71  for (i = 0; i < pTabMaillage->size(); i++)
72  {
73  pMaillageGeoNode = pTabMaillage->operator[](i);
74  pTYElementGraphic = pMaillageGeoNode->getGraphicObject().getRealPointer();
75  childs.push_back(pTYElementGraphic);
76  if (recursif)
77  {
78  pTYElementGraphic->getChilds(childs, recursif);
79  }
80  }
81 }
82 
84 {
85  TYElementGraphic::display(renderContext);
86 
87  // Site
88  getElement()->getSite()->getGraphicObject()->display(renderContext);
89 
90  // Draw project objects in root site node 3D referential
91  float fSiteNodeAltitude = (float)getElement()->getSite()->getAltiEmprise();
92  glTranslatef(0.0f, 0.0f, -fSiteNodeAltitude);
93 
94  // Points de controle
95  unsigned int i = 0;
96  for (i = 0; i < getElement()->getPointsControl().size(); i++)
97  {
98  getElement()->getPointControl(i)->getGraphicObject()->display(renderContext);
99  }
100 
101  // Maillage
102  TYTabMaillageGeoNode* pTabMaillage = &getElement()->getMaillages();
103  TYMaillageGeoNode* pMaillageGeoNode = NULL;
104  for (i = 0; i < pTabMaillage->size(); i++)
105  {
106  pMaillageGeoNode = pTabMaillage->operator[](i);
107  pMaillageGeoNode->getGraphicObject()->display(renderContext);
108  }
109 
110  // Calcul courant
111  if (getElement()->getCurrentCalcul())
112  {
113  getElement()->getCurrentCalcul()->getGraphicObject()->display(renderContext);
114  }
115 
116  glTranslatef(0.0f, 0.0f, +fSiteNodeAltitude);
117 
118  activateSignal();
119 }
120 
121 #if TY_USE_IHM
122 void TYProjetGraphic::connectUpdateSignal(QObject* pReceiver, const char* member)
123 {
124  // _pUpdateSignal->connect(pReceiver, member);
125 }
126 #endif // TY_USE_IHM
127 
128 #if TY_USE_IHM
129 void TYProjetGraphic::disconnectUpdateSignal(QObject* pReceiver, const char* member)
130 {
131  // _pUpdateSignal->disconnect(pReceiver, member);
132 }
133 #endif // TY_USE_IHM
list< TYElementGraphic * > TYListPtrTYElementGraphic
List de pointeur de TYElement.
std::vector< LPTYMaillageGeoNode > TYTabMaillageGeoNode
Collection de noeuds geometriques de type TYMaillage.
Definition: TYMaillage.h:438
Representation graphique d'un projet (fichier header)
Contexte de rendu utilisé par les fonctions d'affichage.
classe graphique pour un element de base
virtual void update(bool force=false)
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
virtual void display(TYRenderContext &renderContext)
virtual ~TYProjetGraphic()
virtual void update(bool force=false)
virtual void display(TYRenderContext &renderContext)
TYProjetGraphic(TYProjet *pElement)
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
classe de definition d'un projet.
Definition: TYProjet.h:45