Code_TYMPAN
4.4.0
Industrial site acoustic simulation
Tympan
gui
gl
TYRayGraphic.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
16
/*
17
*
18
*/
19
20
#include "
Tympan/models/business/TYRay.h
"
21
22
#include "
TYRayGraphic.h
"
23
#include "
Tympan/gui/gl/TYRenderContext.h
"
24
#include <QtOpenGL>
25
26
bool
TYRayGraphic::_gVisible
=
false
;
27
28
TYRayGraphic::TYRayGraphic
(
TYRay
* pElement) :
TYElementGraphic
(pElement) {}
29
30
TYRayGraphic::~TYRayGraphic
() {}
31
32
void
TYRayGraphic::update
(
bool
force
/*=false*/
)
33
{
34
TYElementGraphic::update
(force);
35
}
36
37
OBox
TYRayGraphic::computeBoundingBox
()
const
38
{
39
OBox
boundingBox
;
40
return
boundingBox
;
41
}
42
43
void
TYRayGraphic::getRayEventColor
(
acoustic_event
& e)
44
{
45
switch
(e.
type
)
46
{
47
case
TYSOURCE
:
48
_r
= 1.0f;
49
_g
= 1.0f;
50
_b
= 0.0f;
// jaune;
51
break
;
52
53
case
TYDIFFRACTION
:
54
_r
= 0.2f;
55
_g
= 0.55f;
56
_b
= 0.91f;
// bleu
57
break
;
58
59
case
TYREFLEXION
:
60
_r
= 1.0f;
61
_g
= 0.0f;
62
_b
= 0.0f;
// rouge
63
break
;
64
65
case
TYREFLEXIONSOL
:
66
_r
= 1.0f;
67
_g
= 0.5f;
68
_b
= 0.0f;
// orange
69
70
case
TYREFRACTION
:
71
// Do nothing
72
// _r=0.0f; _g=0.84f; _b=0.35f; // vert
73
break
;
74
75
case
TYRECEPTEUR
:
76
_r
= 1.0f;
77
_g
= 0.43f;
78
_b
= 0.71f;
// rose
79
break
;
80
81
case
TY_NO_TYPE
:
82
// Do nothing ?
83
break
;
84
85
case
TY_ALL_TYPE
:
86
// Do nothing ?
87
break
;
88
}
89
}
90
91
void
TYRayGraphic::display
(
TYRenderContext
& renderContext)
92
{
93
TYRay
* pRay = getElement();
94
95
if
(
_visible
)
96
{
97
// Dessine les evenements du rayon
98
glLineWidth(2.0);
99
glBegin(GL_LINE_STRIP);
100
101
_lastRayEventType
= 0;
102
_repeatRayEventCount
= 0;
103
for
(
unsigned
int
j = 0; j < pRay->
getEvents
().size(); j++)
104
{
105
acoustic_event
* e = pRay->
getEvents
().at(j);
106
107
if
(j != 0)
108
{
109
// 2nd point du segment
110
OPoint3D
pt(e->
pos
);
111
glVertex3f(pt.
_x
, pt.
_y
, pt.
_z
);
112
}
113
114
getRayEventColor
(*e);
115
glColor3f(
_r
,
_g
,
_b
);
116
_lastRayEventType
= e->
type
;
117
_lastRayEventPos
= e->
pos
;
118
119
// 1er point du segment
120
OPoint3D
pt(e->
pos
);
121
glVertex3f(pt.
_x
, pt.
_y
, pt.
_z
);
122
}
123
124
glEnd();
125
}
126
}
TYRayGraphic.h
TYRay.h
TYRenderContext.h
Contexte de rendu utilisé par les fonctions d'affichage.
TYREFLEXION
@ TYREFLEXION
Definition:
acoustic_path.h:25
TYRECEPTEUR
@ TYRECEPTEUR
Definition:
acoustic_path.h:29
TYSOURCE
@ TYSOURCE
Definition:
acoustic_path.h:28
TY_NO_TYPE
@ TY_NO_TYPE
Definition:
acoustic_path.h:23
TYREFLEXIONSOL
@ TYREFLEXIONSOL
Definition:
acoustic_path.h:26
TYREFRACTION
@ TYREFRACTION
Definition:
acoustic_path.h:27
TY_ALL_TYPE
@ TY_ALL_TYPE
Definition:
acoustic_path.h:30
TYDIFFRACTION
@ TYDIFFRACTION
Definition:
acoustic_path.h:24
OBox
The box class.
Definition:
3d.h:1346
OCoord3D::_y
double _y
y coordinate of OCoord3D
Definition:
3d.h:283
OCoord3D::_z
double _z
z coordinate of OCoord3D
Definition:
3d.h:284
OCoord3D::_x
double _x
x coordinate of OCoord3D
Definition:
3d.h:282
OPoint3D
The 3D point class.
Definition:
3d.h:487
TYElementGraphic
classe graphique pour un element de base
Definition:
TYElementGraphic.h:63
TYElementGraphic::_visible
bool _visible
Inique si l'element est visible.
Definition:
TYElementGraphic.h:270
TYElementGraphic::boundingBox
OBox boundingBox() const
Definition:
TYElementGraphic.cpp:227
TYElementGraphic::update
virtual void update(bool force=false)
Definition:
TYElementGraphic.cpp:83
TYRayGraphic::_repeatRayEventCount
int _repeatRayEventCount
Definition:
TYRayGraphic.h:83
TYRayGraphic::getRayEventColor
void getRayEventColor(acoustic_event &e)
Definition:
TYRayGraphic.cpp:43
TYRayGraphic::_lastRayEventPos
TYPoint _lastRayEventPos
Definition:
TYRayGraphic.h:82
TYRayGraphic::_g
float _g
Definition:
TYRayGraphic.h:79
TYRayGraphic::_b
float _b
Definition:
TYRayGraphic.h:79
TYRayGraphic::display
virtual void display(TYRenderContext &renderContext)
Definition:
TYRayGraphic.cpp:91
TYRayGraphic::TYRayGraphic
TYRayGraphic(TYRay *pElement)
Definition:
TYRayGraphic.cpp:28
TYRayGraphic::_r
float _r
Definition:
TYRayGraphic.h:79
TYRayGraphic::~TYRayGraphic
virtual ~TYRayGraphic()
Definition:
TYRayGraphic.cpp:30
TYRayGraphic::update
virtual void update(bool force=false)
Definition:
TYRayGraphic.cpp:32
TYRayGraphic::computeBoundingBox
virtual OBox computeBoundingBox() const
Definition:
TYRayGraphic.cpp:37
TYRayGraphic::_gVisible
static bool _gVisible
Indique si toutes les instances sont visibles.
Definition:
TYRayGraphic.h:75
TYRayGraphic::_lastRayEventType
int _lastRayEventType
Definition:
TYRayGraphic.h:81
TYRay
Classe decrivant un rayon acoustique gere par un lancer de rayon. Cette classe doit permettre la mode...
Definition:
TYRay.h:35
TYRenderContext
Definition:
TYRenderContext.h:45
acoustic_event
This class store data and provide functions to manipulate event in the acoustic context.
Definition:
acoustic_path.h:40
acoustic_event::type
ACOUSTIC_EVENT_TYPES type
Event type.
Definition:
acoustic_path.h:60
acoustic_event::pos
OPoint3D pos
Event position.
Definition:
acoustic_path.h:53
acoustic_path::getEvents
virtual tab_acoustic_events & getEvents()
Get the events list of the ray.
Definition:
acoustic_path.h:195
Generated on Mon Feb 2 2026 12:03:42 for Code_TYMPAN by
1.9.1