Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYAcousticLineGraphic.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 
21 #include <boost/foreach.hpp>
22 
25 #include "TYAcousticLineGraphic.h"
26 
28 {
30  _pPolyLineGraphic->setElement(pElement);
31 }
32 
33 void TYAcousticLineGraphic::update(bool force /*=false*/)
34 {
36 }
37 
38 void TYAcousticLineGraphic::getChilds(TYListPtrTYElementGraphic& childs, bool recursif /*=true*/)
39 {
40  TYElementGraphic* pTYElementGraphic = _pPolyLineGraphic;
41  childs.push_back(pTYElementGraphic);
42  if (recursif)
43  {
44  pTYElementGraphic->getChilds(childs, recursif);
45  }
46 }
47 
49 {
50  OBox reset;
51  _boundingBox = reset;
52 
55 }
56 
57 void TYAcousticLineGraphic::display(TYElement* pModelerElement /*= nullptr*/, GLenum mode /*= GL_RENDER*/)
58 {
59  if (!getElement()->isInCurrentCalcul())
60  {
61  return;
62  }
63 
65 
67  tabpts.clear();
68  tabpts.reserve(getElement()->getTabPoint().size()); //->getSrcLineic()->getNbSrcs());
69 
70  BOOST_FOREACH (TYPoint pt, getElement()->getTabPoint()) //->getSrcLineic()->getSrcs())
71  {
72  tabpts.push_back(pt);
73  }
74 
76 
77  if (mode == GL_SELECT)
78  {
79  TYPickingTable::addElement(getElement());
80  glPushName((GLuint)(TYPickingTable::getIndex()));
81  }
82 
83  glColor4fv(getElement()->getColor());
84  _pPolyLineGraphic->display(pModelerElement, mode);
85 
86  if (mode == GL_SELECT)
87  {
88  glPopName();
89  }
90 }
Representation graphique d'une ligne acoustique (fichier header)
std::vector< TYPoint > TYTabPoint
Collection de TYPoint.
Definition: TYDefines.h:340
list< TYElementGraphic * > TYListPtrTYElementGraphic
List de pointeur de TYElement.
Gestion de la table de correspondance indice/element pour le picking (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
virtual void display(TYElement *pModelerElement=nullptr, GLenum mode=GL_RENDER)
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
TYAcousticLineGraphic(TYAcousticLine *pElement)
LPTYPolyLineGraphic _pPolyLineGraphic
virtual void update(bool force=false)
classe graphique pour un element de base
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)
void setElement(TYElement *pElt)
void highlight(bool state=true)
static int getIndex()
static void addElement(TYElement *pElt)
classe graphique pour representer une polyligne a partir d'un tableau de points.
void setTabPoint(const TYTabPoint &tabPts)
virtual void computeBoundingBox()
virtual void display(TYElement *pModelerElement=nullptr, GLenum mode=GL_RENDER)
TYTabPoint & getTabPoint()