Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYSourceSurfacicGraphic.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 
26 
28 
30 {
31  _srcVisible = false;
32 }
33 
34 void TYSourceSurfacicGraphic::update(bool force) //=false
35 {
37 }
38 
39 void TYSourceSurfacicGraphic::getChilds(TYListPtrTYElementGraphic& childs, bool recursif /*=true*/)
40 {
41  unsigned int i = 0;
42  LPTYSourcePonctuelle pSrcPonct = NULL;
43 
44  for (i = 0; i < getElement()->getNbSrcs(); i++)
45  {
46  // On recupere la source
47  pSrcPonct = getElement()->getSrc(i);
48  TYElementGraphic* pTYElementGraphic = pSrcPonct->getGraphicObject();
49  childs.push_back(pTYElementGraphic);
50  if (recursif)
51  {
52  pTYElementGraphic->getChilds(childs, recursif);
53  }
54  }
55 }
56 
58 {
59  OBox reset;
60  _boundingBox = reset;
61 
62  unsigned int i = 0;
63  LPTYSourcePonctuelle pSrcPonct = NULL;
64 
65  for (i = 0; i < getElement()->getNbSrcs(); i++)
66  {
67  // On recupere la source
68  pSrcPonct = getElement()->getSrc(i);
69  pSrcPonct->getGraphicObject()->computeBoundingBox();
70  _boundingBox.Enlarge(pSrcPonct->getGraphicObject()->GetBox());
71  }
72 }
73 
74 void TYSourceSurfacicGraphic::display(TYElement* pModelerElement /*= nullptr*/, GLenum mode /*= GL_RENDER*/)
75 {
76  unsigned int i = 0;
77  LPTYSourcePonctuelle pSrcPonct = NULL;
78 
79  if ((_visible) && (_srcVisible || _gVisible))
80  {
81  for (i = 0; i < getElement()->getNbSrcs(); i++)
82  {
83  // On recupere la source
84  pSrcPonct = getElement()->getSrc(i);
85  pSrcPonct->getGraphicObject()->display(pModelerElement, mode);
86  }
87  }
88 }
list< TYElementGraphic * > TYListPtrTYElementGraphic
List de pointeur de TYElement.
Representation graphique d'une surface de source (fichier header)
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
classe graphique pour un element de base
bool _visible
Inique si l'element est visible.
virtual void update(bool force=false)
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
virtual void update(bool force=false)
bool _srcVisible
Indique si cette instance est visible.
TYSourceSurfacicGraphic(TYSourceSurfacic *pElement)
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
static bool _gVisible
Indique si toutes les instances sont visibles.
virtual void display(TYElement *pModelerElement=nullptr, GLenum mode=GL_RENDER)