Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYSegmentGraphic.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 
26 #include "TYSegmentGraphic.h"
28 
30 
32 
33 void TYSegmentGraphic::update(bool force /*=false*/)
34 {
36 }
37 
39 {
41 
42  boundingBox.Enlarge(getElement()->_ptA._x, getElement()->_ptA._z, -getElement()->_ptA._y);
43  boundingBox.Enlarge(getElement()->_ptB._x, getElement()->_ptB._z, -getElement()->_ptB._y);
44  return boundingBox;
45 }
46 
48 {
49  OColor color(getElement()->getColor());
50  OBox fitBox;
51  fitBox = boundingBox();
52 
53  if (_highlight)
54  {
55  float tmpColor[4];
56  glGetFloatv(GL_CURRENT_COLOR, tmpColor);
57  if (renderContext.pass == TYRenderPass::Overlay)
58  {
59  drawName(renderContext);
60  }
61  glColor3f(tmpColor[0], tmpColor[1], tmpColor[2]);
62  }
63 
64  if (_visible)
65  {
66 
67  if (renderContext.type == TYRenderType::Picking)
68  {
69  TYPickingTable::addElement(getElement());
70  glPushName((GLuint)(TYPickingTable::getIndex()));
71  }
72 
73  glBegin(GL_LINES);
74 
75  glColor4fv(color);
76 
77  glVertex3d(getElement()->_ptA._x, getElement()->_ptA._z, -getElement()->_ptA._y);
78  glVertex3d(getElement()->_ptB._x, getElement()->_ptB._z, -getElement()->_ptB._y);
79 
80  glEnd();
81 
82  if (renderContext.type == TYRenderType::Picking)
83  {
84  glPopName();
85  }
86  }
87 }
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.
Representation graphique d'un segment (fichier header)
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:36
classe graphique pour un element de base
void drawName(TYRenderContext &renderContext)
bool _visible
Inique si l'element est visible.
OBox boundingBox() const
bool _highlight
Indique si le highlight est active pour cet element.
virtual void update(bool force=false)
static int getIndex()
static void addElement(TYElement *pElt)
TYRenderType type
TYRenderPass pass
virtual void update(bool force=false)
virtual void display(TYRenderContext &renderContext)
virtual OBox computeBoundingBox() const
TYSegmentGraphic(TYSegment *pElement)
virtual ~TYSegmentGraphic()