Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYCourbeNiveauGraphic.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 
23 #include "TYCourbeNiveauGraphic.h"
24 
26 {
28  _pPolyLineGraphic->setElement(pElement);
29 }
30 
31 void TYCourbeNiveauGraphic::update(bool force /*=false*/)
32 {
34 }
35 
36 void TYCourbeNiveauGraphic::getChilds(TYListPtrTYElementGraphic& childs, bool recursif /*=true*/)
37 {
38  TYElementGraphic* pTYElementGraphic = _pPolyLineGraphic;
39  childs.push_back(pTYElementGraphic);
40  if (recursif)
41  {
42  pTYElementGraphic->getChilds(childs, recursif);
43  }
44 }
45 
47 {
48  OBox reset;
49  _boundingBox = reset;
52 }
53 
54 void TYCourbeNiveauGraphic::display(TYElement* pModelerElement /*= nullptr*/, GLenum mode /*= GL_RENDER*/)
55 {
56  if (!_visible)
57  {
58  return;
59  }
60 
61  TYElementGraphic::display(pModelerElement, mode);
62  TYTabPoint tabpoints = getElement()->getListPoints();
63 
64  // Ajout d'un offset pour voir la courbe de niveau sur l'image site
65  for (unsigned int i = 0; i < tabpoints.size(); i++)
66  {
67  tabpoints[i]._z += 0.5; // Anciennement 0.05
68  }
69 
71  _pPolyLineGraphic->setTabPoint(tabpoints);
72 
73  if (mode == GL_SELECT)
74  {
75  TYPickingTable::addElement(getElement());
76  glPushName((GLuint)(TYPickingTable::getIndex()));
77  }
78  GLenum Error = 0;
79  Error = glGetError();
80  if (Error != GL_NO_ERROR)
81  printf("Erreur OpenGL %d\n", Error);
82  glColor4fv(getElement()->getColor());
83  Error = glGetError(); // GL_INVALID_ENUM
84  if (Error != GL_NO_ERROR)
85  printf("Erreur OpenGL %d\n", Error);
86  float color[4]; // az++ test
87  glGetFloatv(GL_CURRENT_COLOR, color); // az++ test
88  Error = glGetError();
89  if (Error != GL_NO_ERROR)
90  printf("Erreur OpenGL %d\n", Error);
91  // delete [] color;//az++ test
93  _pPolyLineGraphic->display(pModelerElement, mode);
94 
95  if (mode == GL_SELECT)
96  {
97  glPopName();
98  }
99 }
Representation graphique d'une courbe de niveau (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 getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
virtual void update(bool force=false)
TYCourbeNiveauGraphic(TYCourbeNiveau *pElement)
virtual void display(TYElement *pModelerElement=nullptr, GLenum mode=GL_RENDER)
LPTYPolyLineGraphic _pPolyLineGraphic
classe graphique pour un element de base
bool _visible
Inique si l'element est visible.
void setModified(bool modified=true)
virtual void update(bool force=false)
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
void setElement(TYElement *pElt)
virtual void display(TYElement *pModelerElement=nullptr, GLenum mode=GL_RENDER)
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)