Code_TYMPAN
4.4.0
Industrial site acoustic simulation
Tympan
gui
gl
TYPlanEauGraphic.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 "
gui/gl/TYRenderContext.h
"
24
#include <QtOpenGL>
25
26
#include "
TYPlanEauGraphic.h
"
27
28
#include "
Tympan/models/business/topography/TYPlanEau.h
"
29
30
#include "
Tympan/models/business/TYPreferenceManager.h
"
31
#include "
Tympan/gui/gl/TYPickingTable.h
"
32
#include "
gui/gl/TYRenderContext.h
"
33
34
TYPlanEauGraphic::TYPlanEauGraphic
(
TYPlanEau
* pElement) :
TYElementGraphic
(pElement)
35
{
36
_pPolygon
=
new
TYPolygon
();
37
}
38
39
void
TYPlanEauGraphic::update
(
bool
force
/*=false*/
)
40
{
41
TYElementGraphic::update
(force);
42
}
43
44
void
TYPlanEauGraphic::getChilds
(
TYListPtrTYElementGraphic
& childs,
bool
recursif
/*=true*/
)
45
{
46
TYElementGraphic
* pTYElementGraphic =
_pPolygon
->getGraphicObject();
47
childs.push_back(pTYElementGraphic);
48
if
(recursif)
49
{
50
pTYElementGraphic->
getChilds
(childs, recursif);
51
}
52
}
53
54
OBox
TYPlanEauGraphic::computeBoundingBox
()
const
55
{
56
OBox
boundingBox
;
57
boundingBox
=
_pPolygon
->getGraphicObject()->boundingBox();
58
return
boundingBox
;
59
}
60
61
void
TYPlanEauGraphic::display
(
TYRenderContext
& renderContext)
62
{
63
if
(!
_visible
|| !getElement()->isInCurrentCalcul())
64
{
65
return
;
66
}
67
68
TYElementGraphic::display
(renderContext);
69
70
TYTabPoint
tabpoints = getElement()->getListPoints();
71
72
// Ajout d'un offset pour limiter le flickering avec l'altimetrie
73
for
(
unsigned
int
i = 0; i < tabpoints.size(); i++)
74
{
75
tabpoints[i]._z += 0.5;
// Anciennement 0.05
76
}
77
78
_pPolygon
->
setPoints
(tabpoints);
79
80
if
(renderContext.
type
==
TYRenderType::Picking
)
81
{
82
TYPickingTable::addElement
(getElement());
83
glPushName((GLuint)(
TYPickingTable::getIndex
()));
84
}
85
86
glColor4fv(getElement()->
getColor
());
87
88
_pPolygon
->getGraphicObject()->setBoundingBoxVisible(
_highlight
);
89
_pPolygon
->getGraphicObject()->display(renderContext);
90
if
((
_highlight
) && (renderContext.
pass
==
TYRenderPass::Overlay
))
91
{
92
drawName
(renderContext);
93
}
94
95
if
(renderContext.
type
==
TYRenderType::Picking
)
96
{
97
glPopName();
98
}
99
}
getColor
QColor getColor
Definition:
OGLSimpleMaterial.cpp:18
TYTabPoint
std::vector< TYPoint > TYTabPoint
Collection de TYPoint.
Definition:
TYDefines.h:340
TYListPtrTYElementGraphic
list< TYElementGraphic * > TYListPtrTYElementGraphic
List de pointeur de TYElement.
Definition:
TYElementGraphic.h:52
TYPickingTable.h
Gestion de la table de correspondance indice/element pour le picking (fichier header)
TYPlanEauGraphic.h
Representation graphique d'un plan d'eau (fichier header)
TYPlanEau.h
TYPreferenceManager.h
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.
OBox
The box class.
Definition:
3d.h:1346
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
TYElementGraphic::getChilds
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
Definition:
TYElementGraphic.h:181
TYElementGraphic::display
virtual void display(TYRenderContext &renderContext)
Definition:
TYElementGraphic.cpp:206
TYPickingTable::getIndex
static int getIndex()
Definition:
TYPickingTable.h:92
TYPickingTable::addElement
static void addElement(TYElement *pElt)
Definition:
TYPickingTable.cpp:38
TYPlanEauGraphic::_pPolygon
LPTYPolygon _pPolygon
Definition:
TYPlanEauGraphic.h:87
TYPlanEauGraphic::display
virtual void display(TYRenderContext &renderContext)
Definition:
TYPlanEauGraphic.cpp:61
TYPlanEauGraphic::update
virtual void update(bool force=false)
Definition:
TYPlanEauGraphic.cpp:39
TYPlanEauGraphic::TYPlanEauGraphic
TYPlanEauGraphic(TYPlanEau *pElement)
Definition:
TYPlanEauGraphic.cpp:34
TYPlanEauGraphic::computeBoundingBox
virtual OBox computeBoundingBox() const
Definition:
TYPlanEauGraphic.cpp:54
TYPlanEauGraphic::getChilds
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
Definition:
TYPlanEauGraphic.cpp:44
TYPlanEau
Definition:
TYPlanEau.h:33
TYPolygon
Definition:
TYPolygon.h:31
TYPolygon::setPoints
void setPoints(const TYTabPoint &pts)
Definition:
TYPolygon.cpp:389
TYRenderContext
Definition:
TYRenderContext.h:45
TYRenderContext::type
const TYRenderType type
Definition:
TYRenderContext.h:52
TYRenderContext::pass
const TYRenderPass pass
Definition:
TYRenderContext.h:53
Generated on Wed May 13 2026 12:41:17 for Code_TYMPAN by
1.9.1