Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYAcousticBoxGraphic.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 
24 
25 #include "TYAcousticBoxGraphic.h"
26 
28 
29 void TYAcousticBoxGraphic::update(bool force /*=false*/)
30 {
32 }
33 
34 void TYAcousticBoxGraphic::getChilds(TYListPtrTYElementGraphic& childs, bool recursif /*=true*/)
35 {
36  for (int i = 0; i < 6; i++)
37  {
38  // On recupere la face
39  LPTYAcousticRectangleNodeGeoNode pAccRectNodeGeoNode = getElement()->getFace(i);
40  TYElementGraphic* pTYElementGraphic = pAccRectNodeGeoNode->getGraphicObject().getRealPointer();
41  childs.push_back(pTYElementGraphic);
42  if (recursif)
43  {
44  pTYElementGraphic->getChilds(childs, recursif);
45  }
46  }
47 }
48 
50 {
51  OBox reset;
52  _boundingBox = reset;
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  pAccRectNodeGeoNode1->getGraphicObject()->computeBoundingBox();
59  OBox rect_bb1 = pAccRectNodeGeoNode1->getGraphicObject()->GetBox();
60  LPTYAcousticRectangleNodeGeoNode pAccRectNodeGeoNode2 = getElement()->getFace(1);
61  pAccRectNodeGeoNode2->getGraphicObject()->computeBoundingBox();
62  OBox rect_bb2 = pAccRectNodeGeoNode2->getGraphicObject()->GetBox();
63 
64  _boundingBox._min._x = rect_bb2._min._x;
65  _boundingBox._max._x = rect_bb2._max._x;
66  _boundingBox._min._y = rect_bb1._min._x;
67  _boundingBox._max._y = rect_bb1._max._x;
68  _boundingBox._min._z = rect_bb1._min._y;
69  _boundingBox._max._z = rect_bb1._max._y;
70  // CLM-NT35 : Correction calcul BB des machines
71 }
72 
73 void TYAcousticBoxGraphic::display(TYElement* pModelerElement /*= nullptr*/, GLenum mode /*= GL_RENDER*/)
74 {
75  TYElementGraphic::display(pModelerElement, mode);
76 
77  int i = 0;
78 
79  // CLM-NT35: En overlay, affiche seulement le nom de l'élément localisé
80  if (mode == GL_COMPILE)
81  {
82  drawName(pModelerElement);
83  }
84  else
85  {
86  if (_highlight)
87  {
88  if (_bFirstDisp)
89  {
91  _bFirstDisp = false;
92  }
94  // Calcul du volume englobant pour le fit:
96  }
97 
98  for (i = 0; i < 6; i++)
99  {
100  // On recupere la face
101  LPTYAcousticRectangleNodeGeoNode pAccRectNodeGeoNode = getElement()->getFace(i);
102  pAccRectNodeGeoNode->getGraphicObject()->display(pModelerElement, mode);
103  }
104  }
105 }
Representation graphique d'une boite acoustique (fichier header)
list< TYElementGraphic * > TYListPtrTYElementGraphic
List de pointeur de TYElement.
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
OPoint3D _min
Minimal coordinates of the OBox.
Definition: 3d.h:1371
OPoint3D _max
Maximal coordinates of the OBox.
Definition: 3d.h:1372
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(TYElement *pModelerElement=nullptr, GLenum mode=GL_RENDER)
TYAcousticBoxGraphic(TYAcousticBox *pElement)
virtual void computeBoundingBox()
virtual void update(bool force=false)
classe graphique pour un element de base
void drawName(TYElement *pModelerElement=nullptr)
static OBox _globalBoundingBox
bool _highlight
Indique si le highlight est active pour cet element.
virtual void update(bool force=false)
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
virtual void display(TYElement *pModelerElement=nullptr, GLenum mode=GL_RENDER)