Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYAcousticBoxGraphic.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 
24 
25 #include "TYAcousticBoxGraphic.h"
26 #include "gui/gl/TYRenderContext.h"
27 
29 
30 void TYAcousticBoxGraphic::update(bool force /*=false*/)
31 {
33 }
34 
35 void TYAcousticBoxGraphic::getChilds(TYListPtrTYElementGraphic& childs, bool recursif /*=true*/)
36 {
37  for (int i = 0; i < 6; i++)
38  {
39  // On recupere la face
40  LPTYAcousticRectangleNodeGeoNode pAccRectNodeGeoNode = getElement()->getFace(i);
41  TYElementGraphic* pTYElementGraphic = pAccRectNodeGeoNode->getGraphicObject().getRealPointer();
42  childs.push_back(pTYElementGraphic);
43  if (recursif)
44  {
45  pTYElementGraphic->getChilds(childs, recursif);
46  }
47  }
48 }
49 
51 {
53 
54  // CLM-NT35 : Correction calcul BB des machines
55  // Attention les bb des faces sont orientes dans leur repere local
56  // --> Utilisation de 2 Faces pour calculer la bb d'une box
57  LPTYAcousticRectangleNodeGeoNode pAccRectNodeGeoNode1 = getElement()->getFace(0);
58  OBox rect_bb1 = pAccRectNodeGeoNode1->getGraphicObject()->boundingBox();
59 
60  LPTYAcousticRectangleNodeGeoNode pAccRectNodeGeoNode2 = getElement()->getFace(1);
61  OBox rect_bb2 = pAccRectNodeGeoNode2->getGraphicObject()->boundingBox();
62  boundingBox._min._x = rect_bb2._min._x;
63  boundingBox._max._x = rect_bb2._max._x;
64  boundingBox._min._y = rect_bb1._min._x;
65  boundingBox._max._y = rect_bb1._max._x;
66  boundingBox._min._z = rect_bb1._min._y;
67  boundingBox._max._z = rect_bb1._max._y;
68  return boundingBox;
69 }
70 
72 {
73  TYElementGraphic::display(renderContext);
74 
75  int i = 0;
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  for (i = 0; i < 6; i++)
85  {
86  // On recupere la face
87  LPTYAcousticRectangleNodeGeoNode pAccRectNodeGeoNode = getElement()->getFace(i);
88  pAccRectNodeGeoNode->getGraphicObject()->display(renderContext);
89  }
90  }
91 }
Representation graphique d'une boite acoustique (fichier header)
list< TYElementGraphic * > TYListPtrTYElementGraphic
List de pointeur de TYElement.
Contexte de rendu utilisé par les fonctions d'affichage.
@ Overlay
The current render pass is for overlay elements.
The box class.
Definition: 3d.h:1346
OPoint3D _min
Minimal coordinates of the OBox.
Definition: 3d.h:1423
OPoint3D _max
Maximal coordinates of the OBox.
Definition: 3d.h:1424
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
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
virtual void display(TYRenderContext &renderContext) override
TYAcousticBoxGraphic(TYAcousticBox *pElement)
virtual OBox computeBoundingBox() const
virtual void update(bool force=false)
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)
virtual void display(TYRenderContext &renderContext)
TYRenderPass pass