Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYPointGraphic.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 
23 #include "TYPointGraphic.h"
26 
28 
30 
31 void TYPointGraphic::update(bool force /*=false*/)
32 {
34 }
35 
37 {
38  OBox reset;
39  _boundingBox = reset;
40 
41  static const float crossSize = 0.2f;
42  _boundingBox.Enlarge((float)(getElement()->_x - crossSize), (float)(getElement()->_y - crossSize),
43  (float)(getElement()->_z - crossSize));
44  _boundingBox.Enlarge((float)(getElement()->_x + crossSize), (float)(getElement()->_y + crossSize),
45  (float)(getElement()->_z + crossSize));
46 }
47 
48 void TYPointGraphic::display(TYElement* pModelerElement /*= nullptr*/, GLenum mode /*= GL_RENDER*/)
49 {
50  static const float crossSize = 0.2f;
51 
52  if (_visible)
53  {
54 
55  if (mode == GL_SELECT)
56  {
57  TYPickingTable::addElement(getElement());
58  glPushName((GLuint)(TYPickingTable::getIndex()));
59  }
60 
61  glBegin(GL_LINES);
62 
63  OColor color(1.0f, 0.0f, 0.0f);
64 
65  if (_highlight)
66  {
67  if (_bFirstDisp)
68  {
70  _bFirstDisp = false;
71  }
73  if (mode == GL_COMPILE)
74  {
75  drawName(pModelerElement);
76  }
77  }
78 
79  glColor4fv(color);
80 
81  glVertex3f(getElement()->_x - crossSize, getElement()->_y, getElement()->_z);
82  glVertex3f(getElement()->_x + crossSize, getElement()->_y, getElement()->_z);
83 
84  glVertex3f(getElement()->_x, getElement()->_y - crossSize, getElement()->_z);
85  glVertex3f(getElement()->_x, getElement()->_y + crossSize, getElement()->_z);
86 
87  glVertex3f(getElement()->_x, getElement()->_y, getElement()->_z + crossSize);
88  glVertex3f(getElement()->_x, getElement()->_y, getElement()->_z - crossSize);
89 
90  glEnd();
91 
92  glLineWidth(1);
93 
94  if (mode == GL_SELECT)
95  {
96  glPopName();
97  }
98  // Calcul du volume englobant pour le fit:
100  }
101 }
Gestion de la table de correspondance indice/element pour le picking (fichier header)
Representation graphique d'un point (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)
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)
virtual void computeBoundingBox()
virtual void display(TYElement *pModelerElement=nullptr, GLenum mode=GL_RENDER)
TYPointGraphic(TYPoint *pElement)
virtual ~TYPointGraphic()