Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYAcousticFaceSetGraphic.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 
25 
27 {
28 }
29 
30 void TYAcousticFaceSetGraphic::update(bool force /*=false*/)
31 {
32  TYFaceSet* pFaces = getElement()->getFaceSet();
33  // LPTYFaceSetGraphic* pFacesGraphic= pFaces->getGraphicObject();
34  // pFacesGraphic->update();
35  pFaces->getGraphicObject()->update();
36 
38 }
39 
40 void TYAcousticFaceSetGraphic::display(TYElement* pModelerElement /*= nullptr*/, GLenum mode /*= GL_RENDER*/)
41 {
42  TYElementGraphic::display(pModelerElement, mode);
43 
44  glColor4fv(getElement()->getColor());
45 
46  if (mode == GL_SELECT)
47  {
48  TYPickingTable::addElement(getElement());
49  glPushName((GLuint)(TYPickingTable::getIndex()));
50  }
51 
52  TYFaceSet* pFaces = getElement()->getFaceSet();
53  pFaces->getGraphicObject()->display(pModelerElement, mode);
54 
55  if (mode == GL_SELECT)
56  {
57  glPopName();
58  }
59 }
60 
62 {
63  OBox reset;
64  _boundingBox = reset;
65 
66  TYTabPoint sommets = getElement()->sommets();
67 
68  size_t nbPts = sommets.size();
69  TYPoint pt;
70  for (size_t i = 0; i < nbPts; i++)
71  {
72  pt = sommets[i];
73  _boundingBox.Enlarge((float)(pt._x), (float)(pt._y), (float)(pt._z));
74  }
75 }
Representation graphique d'un ensemble de faces acoustiques (fichier header)
std::vector< TYPoint > TYTabPoint
Collection de TYPoint.
Definition: TYDefines.h:340
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
double _y
y coordinate of OCoord3D
Definition: 3d.h:283
double _z
z coordinate of OCoord3D
Definition: 3d.h:284
double _x
x coordinate of OCoord3D
Definition: 3d.h:282
TYAcousticFaceSetGraphic(TYAcousticFaceSet *pElement)
virtual void update(bool force=false)
virtual void display(TYElement *pModelerElement=nullptr, GLenum mode=GL_RENDER)
classe graphique pour un element de base
virtual void update(bool force=false)
virtual void display(TYElement *pModelerElement=nullptr, GLenum mode=GL_RENDER)
static int getIndex()
static void addElement(TYElement *pElt)