Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYInfrastructureGraphic.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 
26 #include "gui/gl/TYRenderContext.h"
27 #include <QtOpenGL>
28 
30 
31 void TYInfrastructureGraphic::update(bool force /*=false*/)
32 {
34 }
35 
36 void TYInfrastructureGraphic::getChilds(TYListPtrTYElementGraphic& childs, bool recursif /*=true*/)
37 {
38  TYListPtrTYElementGraphic Localchilds;
39  unsigned int i = 0;
40 #if WITH_NMPB
41  TYTabRouteGeoNode* pTabRoute = &getElement()->getListRoute();
42  TYRouteGeoNode* pRouteGeoNode = NULL;
43  for (i = 0; i < pTabRoute->size(); i++)
44  {
45  pRouteGeoNode = pTabRoute->at(i);
46  Localchilds.push_back(pRouteGeoNode->getGraphicObject().getRealPointer());
47  }
48 #endif
49 
50  // Reseaux de transport
51  TYTabReseauTransportGeoNode* pTabResTransp = &getElement()->getListResTrans();
52  TYReseauTransportGeoNode* pResTranspGeoNode = NULL;
53  for (i = 0; i < pTabResTransp->size(); i++)
54  {
55  pResTranspGeoNode = pTabResTransp->at(i);
56  Localchilds.push_back(pResTranspGeoNode->getGraphicObject().getRealPointer());
57  }
58 
59  // Bâtiments
60  TYTabBatimentGeoNode* pTabBat = &getElement()->getListBatiment();
61  TYBatimentGeoNode* pBatGeoNode = NULL;
62  for (i = 0; i < pTabBat->size(); i++)
63  {
64  pBatGeoNode = pTabBat->at(i);
65  Localchilds.push_back(pBatGeoNode->getGraphicObject().getRealPointer());
66  }
67 
68  // Machines
69  TYTabMachineGeoNode* pTabMachine = &getElement()->getListMachine();
70  TYMachineGeoNode* pMachineGeoNode = NULL;
71  for (i = 0; i < pTabMachine->size(); i++)
72  {
73  pMachineGeoNode = pTabMachine->at(i);
74  Localchilds.push_back(pMachineGeoNode->getGraphicObject().getRealPointer());
75  }
76 
77  // Source ponctuelles utilisateur
78  TYTabSourcePonctuelleGeoNode* pTabSrc = &getElement()->getSrcs();
79  LPTYSourcePonctuelleGeoNode pSrcPonctGeoNode = NULL;
80  for (i = 0; i < pTabSrc->size(); i++)
81  {
82  pSrcPonctGeoNode = pTabSrc->at(i);
83  Localchilds.push_back(pSrcPonctGeoNode->getGraphicObject().getRealPointer());
84  }
85 
86  TYListPtrTYElementGraphic::iterator ite = Localchilds.begin();
87  TYElementGraphic* pTYElementGraphic = NULL;
88  for (i = 0; i < Localchilds.size(); i++)
89  {
90  pTYElementGraphic = (TYElementGraphic*)(*ite);
91  childs.push_back(pTYElementGraphic);
92  if (recursif)
93  {
94  pTYElementGraphic->getChilds(childs, recursif);
95  }
96  ite++;
97  }
98 }
99 
101 {
102  unsigned int i = 0;
103 #if WITH_NMPB
104  // Routes
105  TYTabRouteGeoNode* pTabRoute = &getElement()->getListRoute();
106  TYRouteGeoNode* pRouteGeoNode = NULL;
107  for (i = 0; i < pTabRoute->size(); i++)
108  {
109  pRouteGeoNode = pTabRoute->at(i);
110  pRouteGeoNode->getGraphicObject()->display(renderContext);
111  }
112 #endif
113  // Reseaux de transport
114  TYTabReseauTransportGeoNode* pTabResTransp = &getElement()->getListResTrans();
115  TYReseauTransportGeoNode* pResTranspGeoNode = NULL;
116  for (i = 0; i < pTabResTransp->size(); i++)
117  {
118  pResTranspGeoNode = pTabResTransp->at(i);
119  pResTranspGeoNode->getGraphicObject()->display(renderContext);
120  }
121 
122  // Bâtiments
123  TYTabBatimentGeoNode* pTabBat = &getElement()->getListBatiment();
124  TYBatimentGeoNode* pBatGeoNode = NULL;
125  for (i = 0; i < pTabBat->size(); i++)
126  {
127  pBatGeoNode = pTabBat->at(i);
128  pBatGeoNode->getGraphicObject()->display(renderContext);
129  }
130 
131  // Machines
132  TYTabMachineGeoNode* pTabMachine = &getElement()->getListMachine();
133  TYMachineGeoNode* pMachineGeoNode = NULL;
134  for (i = 0; i < pTabMachine->size(); i++)
135  {
136  pMachineGeoNode = pTabMachine->at(i);
137  pMachineGeoNode->getGraphicObject()->display(renderContext);
138  }
139 
140  // Source ponctuelles utilisateur
141  TYTabSourcePonctuelleGeoNode* pTabSrc = &getElement()->getSrcs();
142  LPTYSourcePonctuelleGeoNode pSrcPonctGeoNode = NULL;
143  for (i = 0; i < pTabSrc->size(); i++)
144  {
145  pSrcPonctGeoNode = pTabSrc->at(i);
146  pSrcPonctGeoNode->getGraphicObject()->display(renderContext);
147  }
148 }
std::vector< LPTYBatimentGeoNode > TYTabBatimentGeoNode
Collection de noeuds geometriques de type TYBatiment.
Definition: TYBatiment.h:94
list< TYElementGraphic * > TYListPtrTYElementGraphic
List de pointeur de TYElement.
Representation graphique d'une infrastructure (fichier header)
std::vector< LPTYMachineGeoNode > TYTabMachineGeoNode
Collection de noeuds geometriques de type TYMachine.
Definition: TYMachine.h:168
Contexte de rendu utilisé par les fonctions d'affichage.
std::vector< LPTYReseauTransportGeoNode > TYTabReseauTransportGeoNode
Collection de noeuds geometriques de type TYReseauTransport.
std::vector< LPTYRouteGeoNode > TYTabRouteGeoNode
Collection of geometrical nodes of type TYRoute.
Definition: TYRoute.h:37
std::vector< LPTYSourcePonctuelleGeoNode > TYTabSourcePonctuelleGeoNode
Collection de noeuds geometriques de type TYSourcePonctuelle.
T * getRealPointer()
Definition: smartptr.h:291
classe graphique pour un element de base
virtual void update(bool force=false)
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
TYInfrastructureGraphic(TYInfrastructure *pElement)
virtual void display(TYRenderContext &renderContext)
virtual void update(bool force=false)
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)