Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYSegmentGraphic.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 
26 #include "TYSegmentGraphic.h"
27 
29 
31 
32 void TYSegmentGraphic::update(bool force /*=false*/)
33 {
35 }
36 
38 {
39  OBox reset;
40  _boundingBox = reset;
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 }
45 
46 void TYSegmentGraphic::display(TYElement* pModelerElement /*= nullptr*/, GLenum mode /*= GL_RENDER*/)
47 {
48  OColor color(getElement()->getColor());
49 
50  if (_highlight)
51  {
52  float tmpColor[4];
53  glGetFloatv(GL_CURRENT_COLOR, tmpColor);
54  if (_bFirstDisp)
55  {
57  _bFirstDisp = false;
58  }
60  if (mode == GL_COMPILE)
61  {
62  drawName(pModelerElement);
63  }
64  glColor3f(tmpColor[0], tmpColor[1], tmpColor[2]);
65  }
66 
67  if (_visible)
68  {
69 
70  if (mode == GL_SELECT)
71  {
72  TYPickingTable::addElement(getElement());
73  glPushName((GLuint)(TYPickingTable::getIndex()));
74  }
75 
76  glBegin(GL_LINES);
77 
78  glColor4fv(color);
79 
80  glVertex3dAndEnlargeBB(getElement()->_ptA._x, getElement()->_ptA._z, -getElement()->_ptA._y);
81  glVertex3dAndEnlargeBB(getElement()->_ptB._x, getElement()->_ptB._z, -getElement()->_ptB._y);
82 
83  glEnd();
84 
85  if (mode == GL_SELECT)
86  {
87  glPopName();
88  }
89 
90  // Calcul du volume englobant pour le fit:
92  }
93 }
Gestion de la table de correspondance indice/element pour le picking (fichier header)
Representation graphique d'un segment (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
classe graphique pour un element de base
void drawName(TYElement *pModelerElement=nullptr)
void glVertex3dAndEnlargeBB(GLdouble x, GLdouble y, GLdouble z)
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)
static int getIndex()
static void addElement(TYElement *pElt)
virtual void update(bool force=false)
TYSegmentGraphic(TYSegment *pElement)
virtual ~TYSegmentGraphic()
virtual void computeBoundingBox()
virtual void display(TYElement *pModelerElement=nullptr, GLenum mode=GL_RENDER)