Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYAcousticFaceSetGraphic.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 
25 #include "gui/gl/TYRenderContext.h"
26 #include <QtOpenGL>
27 
29 {
30 }
31 
32 void TYAcousticFaceSetGraphic::update(bool force /*=false*/)
33 {
34  if (getModified() || force)
35  {
36  TYFaceSet* pFaces = getElement()->getFaceSet();
37  // LPTYFaceSetGraphic* pFacesGraphic= pFaces->getGraphicObject();
38  // pFacesGraphic->update();
39  pFaces->getGraphicObject()->update();
41  }
42 }
43 
45 {
46  TYElementGraphic::display(renderContext);
47 
48  glColor4fv(getElement()->getColor());
49 
50  if (renderContext.type == TYRenderType::Picking)
51  {
52  TYPickingTable::addElement(getElement());
53  glPushName((GLuint)(TYPickingTable::getIndex()));
54  }
55 
56  TYFaceSet* pFaces = getElement()->getFaceSet();
57  pFaces->getGraphicObject()->display(renderContext);
58 
59  if (renderContext.type == TYRenderType::Picking)
60  {
61  glPopName();
62  }
63 }
64 
66 {
68  TYTabPoint sommets = getElement()->sommets();
69 
70  size_t nbPts = sommets.size();
71  TYPoint pt;
72  for (size_t i = 0; i < nbPts; i++)
73  {
74  pt = sommets[i];
75  boundingBox.Enlarge((float)(pt._x), (float)(pt._y), (float)(pt._z));
76  }
77  return boundingBox;
78 }
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)
Contexte de rendu utilisé par les fonctions d'affichage.
@ Picking
The current render is only done for picking purpose.
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
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(TYRenderContext &renderContext)
virtual OBox computeBoundingBox() const
classe graphique pour un element de base
OBox boundingBox() const
virtual void update(bool force=false)
virtual void display(TYRenderContext &renderContext)
bool getModified() const
static int getIndex()
static void addElement(TYElement *pElt)
TYRenderType type