Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYPointGraphic.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 
22 #include "gui/gl/TYRenderContext.h"
23 #include <QtOpenGL>
24 
25 #include "TYPointGraphic.h"
28 
30 
32 
33 void TYPointGraphic::update(bool force /*=false*/)
34 {
36 }
37 
39 {
41 
42  static const float crossSize = 0.2f;
43  boundingBox.Enlarge((float)(getElement()->_x - crossSize), (float)(getElement()->_y - crossSize),
44  (float)(getElement()->_z - crossSize));
45  boundingBox.Enlarge((float)(getElement()->_x + crossSize), (float)(getElement()->_y + crossSize),
46  (float)(getElement()->_z + crossSize));
47  return boundingBox;
48 }
49 
51 {
52  static const float crossSize = 0.2f;
53 
54  if (_visible)
55  {
56 
57  if (renderContext.type == TYRenderType::Picking)
58  {
59  TYPickingTable::addElement(getElement());
60  glPushName((GLuint)(TYPickingTable::getIndex()));
61  }
62 
63  glBegin(GL_LINES);
64 
65  OColor color(1.0f, 0.0f, 0.0f);
66 
67  if (_highlight)
68  {
69  if (renderContext.pass == TYRenderPass::Overlay)
70  {
71  drawName(renderContext);
72  }
73  }
74 
75  glColor4fv(color);
76 
77  glVertex3f(getElement()->_x - crossSize, getElement()->_y, getElement()->_z);
78  glVertex3f(getElement()->_x + crossSize, getElement()->_y, getElement()->_z);
79 
80  glVertex3f(getElement()->_x, getElement()->_y - crossSize, getElement()->_z);
81  glVertex3f(getElement()->_x, getElement()->_y + crossSize, getElement()->_z);
82 
83  glVertex3f(getElement()->_x, getElement()->_y, getElement()->_z + crossSize);
84  glVertex3f(getElement()->_x, getElement()->_y, getElement()->_z - crossSize);
85 
86  glEnd();
87 
88  glLineWidth(1);
89 
90  if (renderContext.type == TYRenderType::Picking)
91  {
92  glPopName();
93  }
94  }
95 }
Gestion de la table de correspondance indice/element pour le picking (fichier header)
Representation graphique d'un point (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
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)
virtual void update(bool force=false)
TYPointGraphic(TYPoint *pElement)
virtual void display(TYRenderContext &renderContext)
virtual OBox computeBoundingBox() const
virtual ~TYPointGraphic()
const TYRenderType type
const TYRenderPass pass