Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYAcousticRectangleGraphic.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 
25 
27  : TYElementGraphic(pElement)
28 {
29 }
30 
31 void TYAcousticRectangleGraphic::update(bool force /*=false*/)
32 {
34 }
35 
37 {
38  TYElementGraphic* pTYElementGraphic = nullptr;
39  pTYElementGraphic = getElement()->getSrcSurf()->getGraphicObject();
40  childs.push_back(pTYElementGraphic);
41  if (recursif)
42  {
43  pTYElementGraphic->getChilds(childs, recursif);
44  }
45 
46  pTYElementGraphic = getElement()->getShape()->getGraphicObject();
47  childs.push_back(pTYElementGraphic);
48  if (recursif)
49  {
50  pTYElementGraphic->getChilds(childs, recursif);
51  }
52 }
53 
55 {
56  OBox reset;
57  _boundingBox = reset;
58 
59  getElement()->getSrcSurf()->getGraphicObject()->computeBoundingBox();
60  getElement()->getShape()->getGraphicObject()->computeBoundingBox();
61  _boundingBox.Enlarge(getElement()->getSrcSurf()->getGraphicObject()->GetBox());
62  _boundingBox.Enlarge(getElement()->getShape()->getGraphicObject()->GetBox());
63 }
64 
65 void TYAcousticRectangleGraphic::display(TYElement* pModelerElement /*= nullptr*/,
66  GLenum mode /*= GL_RENDER*/)
67 {
68  // CLM-NT35: En overlay, affiche seulement le nom de l'élément localisé
69  if (mode == GL_COMPILE)
70  {
71  drawName(pModelerElement);
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 (_highlight)
93  {
94  float tmpColor[4];
95  glGetFloatv(GL_CURRENT_COLOR, tmpColor);
96  if (_bFirstDisp)
97  {
99  _bFirstDisp = false;
100  }
102  glColor3f(tmpColor[0], tmpColor[1], tmpColor[2]);
103  }
104 
105  if (_visible)
106  {
107  glColor4fv(color);
108 
109  getElement()->getSrcSurf()->getGraphicObject()->display(pModelerElement, mode);
110  // getElement()->getShape()->setInCurrentCalcul(getElement()->isInCurrentCalcul());
111  // Update shape
112 
113  if ((getElement()->getIsSub()) && (mode == GL_SELECT))
114  {
115  TYPickingTable::addElement(getElement());
116  glPushName((GLuint)(TYPickingTable::getIndex()));
117  }
118 
119  getElement()->getShape()->getGraphicObject()->display(pModelerElement, mode);
120 
121  if ((getElement()->getIsSub()) && (mode == GL_SELECT))
122  {
123  glPopName();
124  }
125 
126  // Calcul du volume englobant pour le fit:
128  }
129  }
130 }
Representation graphique d'un rectangle acoustique (fichier header)
list< TYElementGraphic * > TYListPtrTYElementGraphic
List de pointeur de TYElement.
#define TYDIRPREFERENCEMANAGER
Definition: TYElement.h:52
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
Definition: color.h:31
float a
Definition: color.h:33
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
virtual void update(bool force=false)
virtual void display(TYElement *pModelerElement=nullptr, GLenum mode=GL_RENDER)
TYAcousticRectangleGraphic(TYAcousticRectangle *pElement)
classe graphique pour un element de base
void drawName(TYElement *pModelerElement=nullptr)
static OBox _globalBoundingBox
bool _visible
Inique si l'element est visible.
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)