Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYAcousticRectangleGraphic.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 
25 #include "gui/gl/TYRenderContext.h"
26 
27 #include <QtOpenGL>
28 
30  : TYElementGraphic(pElement)
31 {
32 }
33 
34 void TYAcousticRectangleGraphic::update(bool force /*=false*/)
35 {
37 }
38 
40 {
41  TYElementGraphic* pTYElementGraphic = nullptr;
42  pTYElementGraphic = getElement()->getSrcSurf()->getGraphicObject();
43  childs.push_back(pTYElementGraphic);
44  if (recursif)
45  {
46  pTYElementGraphic->getChilds(childs, recursif);
47  }
48 
49  pTYElementGraphic = getElement()->getShape()->getGraphicObject();
50  childs.push_back(pTYElementGraphic);
51  if (recursif)
52  {
53  pTYElementGraphic->getChilds(childs, recursif);
54  }
55 }
56 
58 {
60 
61  boundingBox.Enlarge(getElement()->getSrcSurf()->getGraphicObject()->boundingBox());
62  boundingBox.Enlarge(getElement()->getShape()->getGraphicObject()->boundingBox());
63  return boundingBox;
64 }
65 
67 {
68  // CLM-NT35: En overlay, affiche seulement le nom de l'élément localisé
69  if (renderContext.pass == TYRenderPass::Overlay)
70  {
71  drawName(renderContext);
72  }
73  else
74  {
75  OColor color = getElement()->getColor();
76  color.a = 1.0;
77 
78 #if TY_USE_IHM
79  if (getElement()->getIsSub() && strcmp(getElement()->getClassName(), "TYMurElement") == 0)
80  {
81  if (TYPreferenceManager::exists(TYDIRPREFERENCEMANAGER, "WinOpacity"))
82  {
83  color.a = TYPreferenceManager::getDouble(TYDIRPREFERENCEMANAGER, "WinOpacity");
84  }
85  else
86  {
87  TYPreferenceManager::setDouble(TYDIRPREFERENCEMANAGER, "WinOpacity", color.a);
88  }
89  }
90 #endif // TY_USE_IHM
91 
92  if (_visible)
93  {
94  glColor4fv(color);
95 
96  getElement()->getSrcSurf()->getGraphicObject()->display(renderContext);
97  // getElement()->getShape()->setInCurrentCalcul(getElement()->isInCurrentCalcul());
98  // Update shape
99 
100  if ((getElement()->getIsSub()) && (renderContext.type == TYRenderType::Picking))
101  {
102  TYPickingTable::addElement(getElement());
103  glPushName((GLuint)(TYPickingTable::getIndex()));
104  }
105 
106  getElement()->getShape()->getGraphicObject()->display(renderContext);
107 
108  if ((getElement()->getIsSub()) && (renderContext.type == TYRenderType::Picking))
109  {
110  glPopName();
111  }
112  }
113  }
114 }
Representation graphique d'un rectangle acoustique (fichier header)
list< TYElementGraphic * > TYListPtrTYElementGraphic
List de pointeur de TYElement.
#define TYDIRPREFERENCEMANAGER
Definition: TYElement.h:51
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.
@ Overlay
The current render pass is for overlay elements.
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 getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
virtual void update(bool force=false)
TYAcousticRectangleGraphic(TYAcousticRectangle *pElement)
classe graphique pour un element de base
void drawName(TYRenderContext &renderContext)
bool _visible
Inique si l'element est visible.
OBox boundingBox() const
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
const TYRenderPass pass