Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYAcousticVolumeNodeGraphic.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 
27 #include <QtOpenGL>
28 
30  : TYElementGraphic(pElement)
31 {
32 }
33 
34 void TYAcousticVolumeNodeGraphic::update(bool force /*=false*/)
35 {
37 }
38 
40 {
41  TYTabAcousticVolumeGeoNode& pTab = getElement()->getTabAcousticVol();
42  LPTYElementGraphic pTYElementGraphic;
43  TYAcousticVolumeGeoNode* pAccVolGeoNode = NULL;
44 
45  for (unsigned int i = 0; i < pTab.size(); i++)
46  {
47  pAccVolGeoNode = pTab[i];
48  pTYElementGraphic = pAccVolGeoNode->getGraphicObject();
49  childs.push_back(pTYElementGraphic.getRealPointer());
50  if (recursif)
51  {
52  pTYElementGraphic->getChilds(childs, recursif);
53  }
54  }
55 }
56 
58 {
59  if (!getElement()->isInCurrentCalcul())
60  {
61  return;
62  }
63 
64  // CLM-NT35: En overlay, affiche seulement le nom de l'élément localisé
65  if (renderContext.pass == TYRenderPass::Overlay)
66  {
67  drawName(renderContext);
68  }
69  else
70  {
71  TYTabAcousticVolumeGeoNode* pTab = &getElement()->getTabAcousticVol();
72  TYAcousticVolumeGeoNode* pAccVolGeoNode = NULL;
73 
74  for (unsigned int i = 0; i < pTab->size(); i++)
75  {
76  // Get face child
77  pAccVolGeoNode = pTab->operator[](i);
78  pAccVolGeoNode->getGraphicObject()->display(renderContext);
79  }
80  }
81 }
82 
84 {
86  TYTabAcousticVolumeGeoNode* pTab = &getElement()->getTabAcousticVol();
87  if (pTab->size() > 0)
88  {
89  TYAcousticVolumeGeoNode* pAccVolGeoNode = nullptr;
90 
91  pAccVolGeoNode = pTab->operator[](0);
92  boundingBox = pAccVolGeoNode->getGraphicObject()->boundingBox();
93  OPoint3D origin = pAccVolGeoNode->getORepere3D()._origin;
94  boundingBox.Translate(origin);
95 
96  for (unsigned int i = 1; i < pTab->size(); i++)
97  {
98  // Get face child
99  pAccVolGeoNode = pTab->operator[](i);
100 
101  // CLM-NT33 : Correction calcul BB des machines
102  //_boundingBox.Enlarge(pAccVolGeoNode->getGraphicObject()->GetBox());
103  OBox bb = pAccVolGeoNode->getGraphicObject()->boundingBox();
104  OPoint3D origin = pAccVolGeoNode->getORepere3D()._origin;
105  bb.Translate(origin);
106  boundingBox.Enlarge(bb);
107  // CLM-NT33
108  }
109  }
110  return boundingBox;
111 
112  /*
113  TYTabPoint sommets = getElement()->sommets();
114 
115  size_t nbPts = sommets.size();
116  TYPoint pt;
117  for (size_t i = 0; i < nbPts; i++)
118  {
119  pt = sommets[i];
120  _boundingBox.Enlarge((float)(pt._x), (float)(pt._y), (float)(pt._z));
121  }*/
122 }
std::vector< LPTYAcousticFaceSetGeoNode > TYTabAcousticVolumeGeoNode
Collection de noeuds geometriques de type TYAcousticFaceSet.
Representation graphique d'un ensemble de volumes acoustiques (fichier header)
list< TYElementGraphic * > TYListPtrTYElementGraphic
List de pointeur de TYElement.
Contexte de rendu utilisé par les fonctions d'affichage.
@ Overlay
The current render pass is for overlay elements.
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
virtual void Translate(const OPoint3D &vectorTranslate)
Translate this box.
Definition: 3d.cpp:1688
The 3D point class.
Definition: 3d.h:487
OPoint3D _origin
The origin point.
Definition: 3d.h:1331
T * getRealPointer()
Definition: smartptr.h:291
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
TYAcousticVolumeNodeGraphic(TYAcousticVolumeNode *pElement)
virtual void update(bool force=false)
virtual void display(TYRenderContext &renderContext)
classe graphique pour un element de base
void drawName(TYRenderContext &renderContext)
OBox boundingBox() const
virtual void update(bool force=false)
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
const ORepere3D & getORepere3D() const
const TYRenderPass pass