Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYCourbeNiveauGraphic.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 
23 #include "TYCourbeNiveauGraphic.h"
25 #include <QtOpenGL>
26 
28 {
30  _pPolyLineGraphic->setElement(pElement);
31 }
32 
33 void TYCourbeNiveauGraphic::update(bool force /*=false*/)
34 {
36 }
37 
38 void TYCourbeNiveauGraphic::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 {
52  return boundingBox;
53 }
54 
56 {
57  if (!_visible || !getElement()->isInCurrentCalcul())
58  {
59  return;
60  }
61 
62  TYElementGraphic::display(renderContext);
63  TYTabPoint tabpoints = getElement()->getListPoints();
64 
65  // Ajout d'un offset pour voir la courbe de niveau sur l'image site
66  for (unsigned int i = 0; i < tabpoints.size(); i++)
67  {
68  tabpoints[i]._z += 0.5; // Anciennement 0.05
69  }
70 
72  _pPolyLineGraphic->setTabPoint(tabpoints);
73 
74  if (renderContext.type == TYRenderType::Picking)
75  {
76  TYPickingTable::addElement(getElement());
77  glPushName((GLuint)(TYPickingTable::getIndex()));
78  }
79  glColor4fv(getElement()->getColor());
80  float color[4]; // az++ test
81  glGetFloatv(GL_CURRENT_COLOR, color); // az++ test
83  _pPolyLineGraphic->display(renderContext);
84 
85  if (renderContext.type == TYRenderType::Picking)
86  {
87  glPopName();
88  }
89 }
QColor getColor
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)
Contexte de rendu utilisé par les fonctions d'affichage.
@ Picking
The current render is only done for picking purpose.
The box class.
Definition: 3d.h:1346
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)
virtual OBox computeBoundingBox() const
TYCourbeNiveauGraphic(TYCourbeNiveau *pElement)
virtual void display(TYRenderContext &renderContext)
LPTYPolyLineGraphic _pPolyLineGraphic
classe graphique pour un element de base
bool _visible
Inique si l'element est visible.
void setModified(bool modified=true)
OBox boundingBox() const
void setBoundingBoxVisible(bool state=true)
virtual void update(bool force=false)
bool isBoundingBoxVisible() const
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
virtual void display(TYRenderContext &renderContext)
void setElement(TYElement *pElt)
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 display(TYRenderContext &renderContext)
const TYRenderType type