Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYInfrastructureGraphic.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 
24 
26 
28 
29 void TYInfrastructureGraphic::update(bool force /*=false*/)
30 {
32 }
33 
34 void TYInfrastructureGraphic::getChilds(TYListPtrTYElementGraphic& childs, bool recursif /*=true*/)
35 {
36  TYListPtrTYElementGraphic Localchilds;
37  unsigned int i = 0;
38 #if WITH_NMPB
39  TYTabRouteGeoNode* pTabRoute = &getElement()->getListRoute();
40  TYRouteGeoNode* pRouteGeoNode = NULL;
41  for (i = 0; i < pTabRoute->size(); i++)
42  {
43  pRouteGeoNode = pTabRoute->at(i);
44  Localchilds.push_back(pRouteGeoNode->getGraphicObject().getRealPointer());
45  }
46 #endif
47 
48  // Reseaux de transport
49  TYTabReseauTransportGeoNode* pTabResTransp = &getElement()->getListResTrans();
50  TYReseauTransportGeoNode* pResTranspGeoNode = NULL;
51  for (i = 0; i < pTabResTransp->size(); i++)
52  {
53  pResTranspGeoNode = pTabResTransp->at(i);
54  Localchilds.push_back(pResTranspGeoNode->getGraphicObject().getRealPointer());
55  }
56 
57  // Bâtiments
58  TYTabBatimentGeoNode* pTabBat = &getElement()->getListBatiment();
59  TYBatimentGeoNode* pBatGeoNode = NULL;
60  for (i = 0; i < pTabBat->size(); i++)
61  {
62  pBatGeoNode = pTabBat->at(i);
63  Localchilds.push_back(pBatGeoNode->getGraphicObject().getRealPointer());
64  }
65 
66  // Machines
67  TYTabMachineGeoNode* pTabMachine = &getElement()->getListMachine();
68  TYMachineGeoNode* pMachineGeoNode = NULL;
69  for (i = 0; i < pTabMachine->size(); i++)
70  {
71  pMachineGeoNode = pTabMachine->at(i);
72  Localchilds.push_back(pMachineGeoNode->getGraphicObject().getRealPointer());
73  }
74 
75  // Source ponctuelles utilisateur
76  TYTabSourcePonctuelleGeoNode* pTabSrc = &getElement()->getSrcs();
77  LPTYSourcePonctuelleGeoNode pSrcPonctGeoNode = NULL;
78  for (i = 0; i < pTabSrc->size(); i++)
79  {
80  pSrcPonctGeoNode = pTabSrc->at(i);
81  Localchilds.push_back(pSrcPonctGeoNode->getGraphicObject().getRealPointer());
82  }
83 
84  TYListPtrTYElementGraphic::iterator ite = Localchilds.begin();
85  TYElementGraphic* pTYElementGraphic = NULL;
86  for (i = 0; i < Localchilds.size(); i++)
87  {
88  pTYElementGraphic = (TYElementGraphic*)(*ite);
89  childs.push_back(pTYElementGraphic);
90  if (recursif)
91  {
92  pTYElementGraphic->getChilds(childs, recursif);
93  }
94  ite++;
95  }
96 }
97 
98 void TYInfrastructureGraphic::display(TYElement* pModelerElement /*= nullptr*/, GLenum mode /*= GL_RENDER*/)
99 {
100  unsigned int i = 0;
101 #if WITH_NMPB
102  // Routes
103  TYTabRouteGeoNode* pTabRoute = &getElement()->getListRoute();
104  TYRouteGeoNode* pRouteGeoNode = NULL;
105  for (i = 0; i < pTabRoute->size(); i++)
106  {
107  pRouteGeoNode = pTabRoute->at(i);
108  pRouteGeoNode->getGraphicObject()->display(pModelerElement, mode);
109  }
110 #endif
111  // Reseaux de transport
112  TYTabReseauTransportGeoNode* pTabResTransp = &getElement()->getListResTrans();
113  TYReseauTransportGeoNode* pResTranspGeoNode = NULL;
114  for (i = 0; i < pTabResTransp->size(); i++)
115  {
116  pResTranspGeoNode = pTabResTransp->at(i);
117  pResTranspGeoNode->getGraphicObject()->display(pModelerElement, mode);
118  }
119 
120  // Bâtiments
121  TYTabBatimentGeoNode* pTabBat = &getElement()->getListBatiment();
122  TYBatimentGeoNode* pBatGeoNode = NULL;
123  for (i = 0; i < pTabBat->size(); i++)
124  {
125  pBatGeoNode = pTabBat->at(i);
126  pBatGeoNode->getGraphicObject()->display(pModelerElement, mode);
127  }
128 
129  // Machines
130  TYTabMachineGeoNode* pTabMachine = &getElement()->getListMachine();
131  TYMachineGeoNode* pMachineGeoNode = NULL;
132  for (i = 0; i < pTabMachine->size(); i++)
133  {
134  pMachineGeoNode = pTabMachine->at(i);
135  pMachineGeoNode->getGraphicObject()->display(pModelerElement, mode);
136  }
137 
138  // Source ponctuelles utilisateur
139  TYTabSourcePonctuelleGeoNode* pTabSrc = &getElement()->getSrcs();
140  LPTYSourcePonctuelleGeoNode pSrcPonctGeoNode = NULL;
141  for (i = 0; i < pTabSrc->size(); i++)
142  {
143  pSrcPonctGeoNode = pTabSrc->at(i);
144  pSrcPonctGeoNode->getGraphicObject()->display(pModelerElement, mode);
145  }
146 }
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
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(TYElement *pModelerElement=nullptr, GLenum mode=GL_RENDER)
virtual void update(bool force=false)
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)