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 
25 #include <QtOpenGL>
26 
28  : TYElementGraphic(pElement)
29 {
30 }
31 
32 void TYAcousticSurfaceNodeGraphic::update(bool force /*=false*/) {}
33 
35 {
36  TYTabAcousticSurfaceGeoNode* pTab = &getElement()->getTabAcousticSurf();
37  LPTYElementGraphic pTYElementGraphic = nullptr;
38  for (int i = 0; i < pTab->size(); i++)
39  {
40  TYAcousticSurfaceGeoNode* pAccSurfGeoNode = pTab->operator[](i);
41  pTYElementGraphic = pAccSurfGeoNode->getGraphicObject();
42  childs.push_back(pTYElementGraphic.getRealPointer());
43  if (recursif)
44  {
45  pTYElementGraphic->getChilds(childs, recursif);
46  }
47  }
48 }
49 
51 {
53 
54  TYTabAcousticSurfaceGeoNode* pTab = &getElement()->getTabAcousticSurf();
55  for (int i = 0; i < pTab->size(); i++)
56  {
57  TYAcousticSurfaceGeoNode* pAccSurfGeoNode = pTab->operator[](i);
58 
59  // CLM-NT33 : Correction calcul BB des machines
60  //_boundingBox.Enlarge(pAccSurfGeoNode->getGraphicObject()->GetBox());
61  OBox bb = pAccSurfGeoNode->getGraphicObject()->boundingBox();
62  bb.Translate(pAccSurfGeoNode->getORepere3D()._origin);
63  boundingBox.Enlarge(bb);
64  }
65  return boundingBox;
66 }
67 
69 {
70  // CLM-NT35: En overlay, affiche seulement le nom de l'élément localisé
71  if (renderContext.pass == TYRenderPass::Overlay)
72  {
73  drawName(renderContext);
74  }
75  else
76  {
77 
78  TYTabAcousticSurfaceGeoNode* pTab = &getElement()->getTabAcousticSurf();
79  for (int i = 0; i < pTab->size(); i++)
80  {
81  // Get face child
82  TYAcousticSurfaceGeoNode* pAccSurfGeoNode = pTab->operator[](i);
83 
84  if (renderContext.type == TYRenderType::Picking)
85  {
86  TYPickingTable::addElement(getElement());
87  glPushName((GLuint)(TYPickingTable::getIndex()));
88  }
89 
90  // pAccSurfGeoNode->getElement()->getGraphicObject()->highlight(_highlight); //sm++ repercution du
91  // highlight sur les elements composes.
92  pAccSurfGeoNode->getGraphicObject()->display(renderContext);
93 
94  if (renderContext.type == TYRenderType::Picking)
95  {
96  glPopName();
97  }
98  }
99  }
100 }
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)
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 getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
const ORepere3D & getORepere3D() const
static int getIndex()
static void addElement(TYElement *pElt)
const TYRenderType type
const TYRenderPass pass