Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYEtageGraphic.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 
23 #include "TYEtageGraphic.h"
24 
26 {
27  TYMurElement dummy;
28  _pPolyLineGraphic = new TYPolyLineGraphic(); // az++
29  _pPolyLineGraphic->setElement(pElement);
30 }
31 
33 {
34  delete _pPolyLineGraphic;
35 }
36 
37 void TYEtageGraphic::update(bool force /*=false*/)
38 {
40 }
41 
42 void TYEtageGraphic::getChilds(TYListPtrTYElementGraphic& childs, bool recursif /*=true*/)
43 {
44  TYListPtrTYElementGraphic Localchilds;
45  int i = 0;
46  for (i = 0; i < getElement()->getTabMachine().size(); i++)
47  {
48  Localchilds.push_back(getElement()->getTabMachine()[i]->getGraphicObject().getRealPointer());
49  }
50  // Sources
51  for (i = 0; i < getElement()->getTabSources().size(); i++)
52  {
53  Localchilds.push_back(getElement()->getTabSources()[i]->getGraphicObject().getRealPointer());
54  }
55 
56  // Murs
57  for (i = 0; i < getElement()->getTabMur().size(); i++)
58  {
59  Localchilds.push_back(getElement()->getTabMur()[i]->getGraphicObject().getRealPointer());
60  }
61  if (!getElement()->getClosed())
62  {
63  Localchilds.push_back(_pPolyLineGraphic);
64  }
65  else
66  {
67  Localchilds.push_back(getElement()->getSol()->getGraphicObject().getRealPointer());
68  Localchilds.push_back(getElement()->getPlafond()->getGraphicObject().getRealPointer());
69  }
70 
71  TYListPtrTYElementGraphic::iterator ite = Localchilds.begin();
72  for (i = 0; i < Localchilds.size(); i++)
73  {
74  TYElementGraphic* pTYElementGraphic = (TYElementGraphic*)(*ite);
75  childs.push_back(pTYElementGraphic);
76  if (recursif)
77  {
78  pTYElementGraphic->getChilds(childs, recursif);
79  }
80  ite++;
81  }
82 }
83 
85 {
87 
88  int i = 0;
89  for (i = 0; i < getElement()->getTabMachine().size(); i++)
90  {
91  boundingBox.Enlarge(getElement()->getTabMachine()[i]->getGraphicObject()->boundingBox());
92  }
93 
94  // Sources
95  for (i = 0; i < getElement()->getTabSources().size(); i++)
96  {
97  boundingBox.Enlarge(getElement()->getTabSources()[i]->getGraphicObject()->boundingBox());
98  }
99 
100  // Murs
101  for (i = 0; i < getElement()->getTabMur().size(); i++)
102  {
103  boundingBox.Enlarge(getElement()->getTabMur()[i]->getGraphicObject()->boundingBox());
104  }
105 
106  // Sol et plafond
108  if (!getElement()->getClosed())
109  {
110  boundingBox.Enlarge(pPolyLineGraphic->boundingBox());
111  }
112  else
113  {
114  boundingBox.Enlarge(getElement()->getSol()->getGraphicObject()->boundingBox());
115  boundingBox.Enlarge(getElement()->getPlafond()->getGraphicObject()->boundingBox());
116  }
117  return boundingBox;
118 }
119 
121 {
122  int i = 0;
123 
124  for (i = 0; i < getElement()->getTabMachine().size(); i++)
125  {
126  // Met l'attribut inCurrentCalcul a trou pour rendre la machine visible
127  getElement()->getTabMachine()[i]->getElement()->setInCurrentCalcul(true);
128  getElement()->getTabMachine()[i]->getGraphicObject()->display(renderContext);
129  }
130 
131  // Sources
132  for (i = 0; i < getElement()->getTabSources().size(); i++)
133  {
134  // Met l'attribut inCurrentCalcul a trou pour rendre la source visible
135  getElement()->getTabSources()[i]->getElement()->setInCurrentCalcul(true);
136  getElement()->getTabSources()[i]->getGraphicObject()->display(renderContext);
137  }
138 
139  // Murs
140  for (i = 0; i < getElement()->getTabMur().size(); i++)
141  {
142  getElement()->getTabMur()[i]->getGraphicObject()->display(renderContext);
143  }
144 
145  // Sol et plafond
147  if (!getElement()->getClosed())
148  {
149  pPolyLineGraphic->setTabPoint(getElement()->sommets());
150  pPolyLineGraphic->display(renderContext);
151  }
152  else
153  {
154  getElement()->getSol()->getGraphicObject()->display(renderContext);
156  {
157  getElement()->getPlafond()->getGraphicObject()->display(renderContext);
158  }
159  }
160 }
list< TYElementGraphic * > TYListPtrTYElementGraphic
List de pointeur de TYElement.
Representation graphique d'un etage (fichier header)
Representation graphique d'une polyligne (fichier header)
The box class.
Definition: 3d.h:1346
virtual void Enlarge(const OPoint3D &pt)
Enlarge the box with the point if the point is outside the box.
Definition: 3d.cpp:1614
classe graphique pour un element de base
OBox boundingBox() const
virtual void update(bool force=false)
static bool _gDrawPlafond
Indique si les plafonds doivent etre visible.
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
void setElement(TYElement *pElt)
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
virtual void display(TYRenderContext &renderContext)
TYEtageGraphic(TYEtage *pElement)
virtual void update(bool force=false)
virtual ~TYEtageGraphic()
virtual OBox computeBoundingBox() const
TYElementGraphic * _pPolyLineGraphic
classe graphique pour representer une polyligne a partir d'un tableau de points.
void setTabPoint(const TYTabPoint &tabPts)
virtual void display(TYRenderContext &renderContext)