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