Code_TYMPAN
4.4.0
Industrial site acoustic simulation
Tympan
gui
gl
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
23
#include "
Tympan/models/business/geometry/TYSegment.h
"
24
#include "
Tympan/gui/gl/TYPickingTable.h
"
25
26
#include "
TYSegmentGraphic.h
"
27
#include "
Tympan/gui/gl/TYRenderContext.h
"
28
29
TYSegmentGraphic::TYSegmentGraphic
(
TYSegment
* pElement) :
TYElementGraphic
(pElement) {}
30
31
TYSegmentGraphic::~TYSegmentGraphic
() {}
32
33
void
TYSegmentGraphic::update
(
bool
force
/*=false*/
)
34
{
35
TYElementGraphic::update
(force);
36
}
37
38
OBox
TYSegmentGraphic::computeBoundingBox
()
const
39
{
40
OBox
boundingBox
;
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
47
void
TYSegmentGraphic::display
(
TYRenderContext
& renderContext)
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
}
getColor
QColor getColor
Definition:
OGLSimpleMaterial.cpp:18
TYPickingTable.h
Gestion de la table de correspondance indice/element pour le picking (fichier header)
TYRenderContext.h
Contexte de rendu utilisé par les fonctions d'affichage.
TYRenderType::Picking
@ Picking
The current render is only done for picking purpose.
TYRenderPass::Overlay
@ Overlay
The current render pass is for overlay elements.
TYSegmentGraphic.h
Representation graphique d'un segment (fichier header)
TYSegment.h
OBox
The box class.
Definition:
3d.h:1346
OBox::Enlarge
virtual void Enlarge(const OPoint3D &pt)
Enlarge the box with the point if the point is outside the box.
Definition:
3d.cpp:1614
OColor
Definition:
color.h:31
TYElementGraphic
classe graphique pour un element de base
Definition:
TYElementGraphic.h:63
TYElementGraphic::drawName
void drawName(TYRenderContext &renderContext)
Definition:
TYElementGraphic.cpp:138
TYElementGraphic::_visible
bool _visible
Inique si l'element est visible.
Definition:
TYElementGraphic.h:270
TYElementGraphic::boundingBox
OBox boundingBox() const
Definition:
TYElementGraphic.cpp:227
TYElementGraphic::_highlight
bool _highlight
Indique si le highlight est active pour cet element.
Definition:
TYElementGraphic.h:264
TYElementGraphic::update
virtual void update(bool force=false)
Definition:
TYElementGraphic.cpp:83
TYPickingTable::getIndex
static int getIndex()
Definition:
TYPickingTable.h:92
TYPickingTable::addElement
static void addElement(TYElement *pElt)
Definition:
TYPickingTable.cpp:38
TYRenderContext
Definition:
TYRenderContext.h:45
TYRenderContext::type
const TYRenderType type
Definition:
TYRenderContext.h:52
TYRenderContext::pass
const TYRenderPass pass
Definition:
TYRenderContext.h:53
TYSegmentGraphic::update
virtual void update(bool force=false)
Definition:
TYSegmentGraphic.cpp:33
TYSegmentGraphic::display
virtual void display(TYRenderContext &renderContext)
Definition:
TYSegmentGraphic.cpp:47
TYSegmentGraphic::computeBoundingBox
virtual OBox computeBoundingBox() const
Definition:
TYSegmentGraphic.cpp:38
TYSegmentGraphic::TYSegmentGraphic
TYSegmentGraphic(TYSegment *pElement)
Definition:
TYSegmentGraphic.cpp:29
TYSegmentGraphic::~TYSegmentGraphic
virtual ~TYSegmentGraphic()
Definition:
TYSegmentGraphic.cpp:31
TYSegment
Definition:
TYSegment.h:35
Generated on Fri Jan 23 2026 15:52:19 for Code_TYMPAN by
1.9.1