Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYAcousticPolygonGraphic.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 
24 #include "gui/gl/TYRenderContext.h"
25 
26 #include <QtOpenGL>
27 
29 {
30 }
31 
32 void TYAcousticPolygonGraphic::update(bool force /*=false*/)
33 {
35 }
36 
37 void TYAcousticPolygonGraphic::getChilds(TYListPtrTYElementGraphic& childs, bool recursif /*=true*/)
38 {
39  TYElementGraphic* pTYElementGraphic = nullptr;
40  pTYElementGraphic = getElement()->getSrcSurf()->getGraphicObject();
41  childs.push_back(pTYElementGraphic);
42  if (recursif)
43  {
44  pTYElementGraphic->getChilds(childs, recursif);
45  }
46 
47  pTYElementGraphic = getElement()->getPolygon()->getGraphicObject();
48  childs.push_back(pTYElementGraphic);
49  if (recursif)
50  {
51  pTYElementGraphic->getChilds(childs, recursif);
52  }
53 }
54 
56 {
58 
59  boundingBox.Enlarge(getElement()->getSrcSurf()->getGraphicObject()->boundingBox());
60  boundingBox.Enlarge(getElement()->getPolygon()->getGraphicObject()->boundingBox());
61  return boundingBox;
62 }
63 
65 {
66  OColor color = getElement()->getColor();
67  color.a = 1.0;
68  glColor4fv(color);
69  getElement()->getSrcSurf()->getGraphicObject()->display(renderContext);
70  getElement()->getPolygon()->getGraphicObject()->setBoundingBoxVisible(_highlight);
71 
72  if (renderContext.type == TYRenderType::Picking)
73  {
74  TYPickingTable::addElement(getElement());
75  glPushName((GLuint)(TYPickingTable::getIndex()));
76  }
77 
78  getElement()->getPolygon()->getGraphicObject()->display(renderContext);
79 
80  if (renderContext.type == TYRenderType::Picking)
81  {
82  glPopName();
83  }
84 }
Representation graphique d'un polygone accoustique (fichier header)
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
Definition: color.h:31
float a
Definition: color.h:33
virtual void display(TYRenderContext &renderContext)
virtual void update(bool force=false)
TYAcousticPolygonGraphic(TYAcousticPolygon *pElement)
virtual OBox computeBoundingBox() const
void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
classe graphique pour un element de base
OBox boundingBox() const
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)
static int getIndex()
static void addElement(TYElement *pElt)
const TYRenderType type