Code_TYMPAN
4.4.0
Industrial site acoustic simulation
Tympan
gui
gl
TYAcousticLineGraphic.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
21
#include <boost/foreach.hpp>
22
23
#include "
Tympan/models/business/geoacoustic/TYAcousticLine.h
"
24
#include "
Tympan/gui/gl/TYPickingTable.h
"
25
#include "
TYAcousticLineGraphic.h
"
26
#include "
gui/gl/TYRenderContext.h
"
27
#include <QtOpenGL>
28
29
TYAcousticLineGraphic::TYAcousticLineGraphic
(
TYAcousticLine
* pElement) :
TYElementGraphic
(pElement)
30
{
31
_pPolyLineGraphic
=
new
TYPolyLineGraphic
(
false
);
32
_pPolyLineGraphic
->
setElement
(pElement);
33
}
34
35
void
TYAcousticLineGraphic::update
(
bool
force
/*=false*/
)
36
{
37
TYElementGraphic::update
(force);
38
}
39
40
void
TYAcousticLineGraphic::getChilds
(
TYListPtrTYElementGraphic
& childs,
bool
recursif
/*=true*/
)
41
{
42
TYElementGraphic
* pTYElementGraphic =
_pPolyLineGraphic
;
43
childs.push_back(pTYElementGraphic);
44
if
(recursif)
45
{
46
pTYElementGraphic->
getChilds
(childs, recursif);
47
}
48
}
49
50
OBox
TYAcousticLineGraphic::computeBoundingBox
()
const
51
{
52
return
_pPolyLineGraphic
->
boundingBox
();
53
}
54
55
void
TYAcousticLineGraphic::display
(
TYRenderContext
& renderContext)
56
{
57
if
(!getElement()->isInCurrentCalcul())
58
{
59
return
;
60
}
61
62
_pPolyLineGraphic
->
setBoundingBoxVisible
(
_highlight
);
63
64
TYTabPoint
& tabpts =
_pPolyLineGraphic
->
getTabPoint
();
65
tabpts.clear();
66
tabpts.reserve(getElement()->getTabPoint().size());
//->getSrcLineic()->getNbSrcs());
67
68
BOOST_FOREACH (
TYPoint
pt, getElement()->getTabPoint())
//->getSrcLineic()->getSrcs())
69
{
70
tabpts.push_back(pt);
71
}
72
73
_pPolyLineGraphic
->
setTabPoint
(tabpts);
74
75
if
(renderContext.
type
==
TYRenderType::Picking
)
76
{
77
TYPickingTable::addElement
(getElement());
78
glPushName((GLuint)(
TYPickingTable::getIndex
()));
79
}
80
81
glColor4fv(getElement()->
getColor
());
82
_pPolyLineGraphic
->
display
(renderContext);
83
84
if
(renderContext.
type
==
TYRenderType::Picking
)
85
{
86
glPopName();
87
}
88
}
getColor
QColor getColor
Definition:
OGLSimpleMaterial.cpp:18
TYAcousticLineGraphic.h
Representation graphique d'une ligne acoustique (fichier header)
TYAcousticLine.h
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)
TYRenderContext.h
Contexte de rendu utilisé par les fonctions d'affichage.
TYRenderType::Picking
@ Picking
The current render is only done for picking purpose.
OBox
The box class.
Definition:
3d.h:1346
TYAcousticLineGraphic::computeBoundingBox
virtual OBox computeBoundingBox() const
Definition:
TYAcousticLineGraphic.cpp:50
TYAcousticLineGraphic::getChilds
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
Definition:
TYAcousticLineGraphic.cpp:40
TYAcousticLineGraphic::display
virtual void display(TYRenderContext &renderContext)
Definition:
TYAcousticLineGraphic.cpp:55
TYAcousticLineGraphic::TYAcousticLineGraphic
TYAcousticLineGraphic(TYAcousticLine *pElement)
Definition:
TYAcousticLineGraphic.cpp:29
TYAcousticLineGraphic::_pPolyLineGraphic
LPTYPolyLineGraphic _pPolyLineGraphic
Definition:
TYAcousticLineGraphic.h:87
TYAcousticLineGraphic::update
virtual void update(bool force=false)
Definition:
TYAcousticLineGraphic.cpp:35
TYAcousticLine
Definition:
TYAcousticLine.h:33
TYElementGraphic
classe graphique pour un element de base
Definition:
TYElementGraphic.h:63
TYElementGraphic::boundingBox
OBox boundingBox() const
Definition:
TYElementGraphic.cpp:227
TYElementGraphic::setBoundingBoxVisible
void setBoundingBoxVisible(bool state=true)
Definition:
TYElementGraphic.cpp:115
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::setElement
void setElement(TYElement *pElt)
Definition:
TYElementGraphic.cpp:59
TYPickingTable::getIndex
static int getIndex()
Definition:
TYPickingTable.h:92
TYPickingTable::addElement
static void addElement(TYElement *pElt)
Definition:
TYPickingTable.cpp:38
TYPoint
Definition:
TYPoint.h:31
TYPolyLineGraphic
classe graphique pour representer une polyligne a partir d'un tableau de points.
Definition:
TYPolyLineGraphic.h:42
TYPolyLineGraphic::setTabPoint
void setTabPoint(const TYTabPoint &tabPts)
Definition:
TYPolyLineGraphic.h:84
TYPolyLineGraphic::display
virtual void display(TYRenderContext &renderContext)
Definition:
TYPolyLineGraphic.cpp:57
TYPolyLineGraphic::getTabPoint
TYTabPoint & getTabPoint()
Definition:
TYPolyLineGraphic.h:89
TYRenderContext
Definition:
TYRenderContext.h:45
TYRenderContext::type
const TYRenderType type
Definition:
TYRenderContext.h:52
Generated on Mon Dec 22 2025 10:42:02 for Code_TYMPAN by
1.9.1