Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYAcousticSurfaceNodeGraphic.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  : TYElementGraphic(pElement)
27 {
28 }
29 
30 void TYAcousticSurfaceNodeGraphic::update(bool force /*=false*/) {}
31 
33 {
34  TYTabAcousticSurfaceGeoNode* pTab = &getElement()->getTabAcousticSurf();
35  LPTYElementGraphic pTYElementGraphic = nullptr;
36  for (int i = 0; i < pTab->size(); i++)
37  {
38  TYAcousticSurfaceGeoNode* pAccSurfGeoNode = pTab->operator[](i);
39  pTYElementGraphic = pAccSurfGeoNode->getGraphicObject();
40  childs.push_back(pTYElementGraphic.getRealPointer());
41  if (recursif)
42  {
43  pTYElementGraphic->getChilds(childs, recursif);
44  }
45  }
46 }
47 
49 {
50  OBox reset;
51  _boundingBox = reset;
52 
53  TYTabAcousticSurfaceGeoNode* pTab = &getElement()->getTabAcousticSurf();
54  for (int i = 0; i < pTab->size(); i++)
55  {
56  TYAcousticSurfaceGeoNode* pAccSurfGeoNode = pTab->operator[](i);
57  pAccSurfGeoNode->getGraphicObject()->computeBoundingBox();
58 
59  // CLM-NT33 : Correction calcul BB des machines
60  //_boundingBox.Enlarge(pAccSurfGeoNode->getGraphicObject()->GetBox());
61  OBox bb = pAccSurfGeoNode->getGraphicObject()->GetBox();
62  bb.Translate(pAccSurfGeoNode->getORepere3D()._origin);
64  }
65 }
66 
67 void TYAcousticSurfaceNodeGraphic::display(TYElement* pModelerElement /*= nullptr*/,
68  GLenum mode /*= GL_RENDER*/)
69 {
70  // CLM-NT35: En overlay, affiche seulement le nom de l'élément localisé
71  if (mode == GL_COMPILE)
72  {
73  drawName(pModelerElement);
74  }
75  else
76  {
77  if (_highlight)
78  {
79  if (_bFirstDisp)
80  {
82  _bFirstDisp = false;
83  }
85  }
86 
87  TYTabAcousticSurfaceGeoNode* pTab = &getElement()->getTabAcousticSurf();
88  for (int i = 0; i < pTab->size(); i++)
89  {
90  // Get face child
91  TYAcousticSurfaceGeoNode* pAccSurfGeoNode = pTab->operator[](i);
92 
93  if (mode == GL_SELECT)
94  {
95  TYPickingTable::addElement(getElement());
96  glPushName((GLuint)(TYPickingTable::getIndex()));
97  }
98 
99  // pAccSurfGeoNode->getElement()->getGraphicObject()->highlight(_highlight); //sm++ repercution du
100  // highlight sur les elements composes.
101  pAccSurfGeoNode->getGraphicObject()->display(pModelerElement, mode);
102 
103  if (mode == GL_SELECT)
104  {
105  glPopName();
106  }
107  }
108  }
109 }
Representation graphique d'un ensemble de surfaces acoustiques (fichier header)
std::vector< LPTYAcousticSurfaceGeoNode > TYTabAcousticSurfaceGeoNode
Collection de noeuds geometriques de type TYAcousticSurface.
list< TYElementGraphic * > TYListPtrTYElementGraphic
List de pointeur de TYElement.
Gestion de la table de correspondance indice/element pour le picking (fichier header)
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
OPoint3D _origin
The origin point.
Definition: 3d.h:1279
T * getRealPointer()
Definition: smartptr.h:291
virtual void update(bool force=false)
TYAcousticSurfaceNodeGraphic(TYAcousticSurfaceNode *pElement)
virtual void display(TYElement *pModelerElement=nullptr, GLenum mode=GL_RENDER)
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
classe graphique pour un element de base
void drawName(TYElement *pModelerElement=nullptr)
bool _highlight
Indique si le highlight est active pour cet element.
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
const ORepere3D & getORepere3D() const
static int getIndex()
static void addElement(TYElement *pElt)