Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYAcousticVolumeNodeGraphic.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  : TYElementGraphic(pElement)
29 {
30 }
31 
32 void TYAcousticVolumeNodeGraphic::update(bool force /*=false*/)
33 {
35 }
36 
38 {
39  TYTabAcousticVolumeGeoNode& pTab = getElement()->getTabAcousticVol();
40  LPTYElementGraphic pTYElementGraphic;
41  TYAcousticVolumeGeoNode* pAccVolGeoNode = NULL;
42 
43  for (unsigned int i = 0; i < pTab.size(); i++)
44  {
45  pAccVolGeoNode = pTab[i];
46  pTYElementGraphic = pAccVolGeoNode->getGraphicObject();
47  childs.push_back(pTYElementGraphic.getRealPointer());
48  if (recursif)
49  {
50  pTYElementGraphic->getChilds(childs, recursif);
51  }
52  }
53 }
54 
55 void TYAcousticVolumeNodeGraphic::display(TYElement* pModelerElement /*= nullptr*/,
56  GLenum mode /*= GL_RENDER*/)
57 {
58  if (!getElement()->isInCurrentCalcul())
59  {
60  return;
61  }
62 
63  // CLM-NT35: En overlay, affiche seulement le nom de l'élément localisé
64  if (mode == GL_COMPILE)
65  {
66  drawName(pModelerElement);
67  }
68  else
69  {
70  if (_highlight)
71  {
72  if (_bFirstDisp)
73  {
75  _bFirstDisp = false;
76  }
78 
79  // Calcul du volume englobant pour le fit:
81  }
82 
83  TYTabAcousticVolumeGeoNode* pTab = &getElement()->getTabAcousticVol();
84  TYAcousticVolumeGeoNode* pAccVolGeoNode = NULL;
85 
86  for (unsigned int i = 0; i < pTab->size(); i++)
87  {
88  // Get face child
89  pAccVolGeoNode = pTab->operator[](i);
90  pAccVolGeoNode->getGraphicObject()->display(pModelerElement, mode);
91  }
92  }
93 }
94 
96 {
97  OBox reset;
98  _boundingBox = reset;
99 
100  TYTabAcousticVolumeGeoNode* pTab = &getElement()->getTabAcousticVol();
101  TYAcousticVolumeGeoNode* pAccVolGeoNode = NULL;
102 
103  for (unsigned int i = 0; i < pTab->size(); i++)
104  {
105  // Get face child
106  pAccVolGeoNode = pTab->operator[](i);
107  pAccVolGeoNode->getGraphicObject()->computeBoundingBox();
108 
109  // CLM-NT33 : Correction calcul BB des machines
110  //_boundingBox.Enlarge(pAccVolGeoNode->getGraphicObject()->GetBox());
111  OBox bb = pAccVolGeoNode->getGraphicObject()->GetBox();
112  OPoint3D origin = pAccVolGeoNode->getORepere3D()._origin;
113  bb.Translate(origin);
114  _boundingBox.Enlarge(bb);
115  // CLM-NT33
116  }
117 
118  /*
119  TYTabPoint sommets = getElement()->sommets();
120 
121  size_t nbPts = sommets.size();
122  TYPoint pt;
123  for (size_t i = 0; i < nbPts; i++)
124  {
125  pt = sommets[i];
126  _boundingBox.Enlarge((float)(pt._x), (float)(pt._y), (float)(pt._z));
127  }*/
128 }
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.
The box class.
Definition: 3d.h:1294
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:1279
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(TYElement *pModelerElement=nullptr, GLenum mode=GL_RENDER)
classe graphique pour un element de base
void drawName(TYElement *pModelerElement=nullptr)
static OBox _globalBoundingBox
bool _highlight
Indique si le highlight est active pour cet element.
virtual void update(bool force=false)
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
const ORepere3D & getORepere3D() const