Code_TYMPAN  4.4.0
Industrial site acoustic simulation
OGLLineElement.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14  */
15 
16 /*
17  *
18  */
19 
20 #include "OGLLineElement.h"
21 
22 #if _WIN32
23  #include <windows.h>
24 #endif //_WIN32
25 
26 #include <GL/gl.h>
27 
28 #include "OGLLine.h"
30 
32 {
34  m_oPoint1 = OPoint3D(0.0, 0.0, 0.0);
35  m_oPoint2 = OPoint3D(0.0, 0.0, 0.0);
36  m_bIs3D = false;
37  m_fLineWidth = 1.0;
39 }
40 
42 {
44  {
45  delete m_pOGLLineToDisplay;
46  }
47 }
48 
49 void OGLLineElement::setColor(const OColor& oColor)
50 {
51  m_oColor = oColor;
52 }
53 
55 {
56  if (m_bVisible)
57  {
58  if (m_bIs3D)
59  {
60  // Nouvelle vue
61  glMatrixMode(GL_MODELVIEW);
62  glPushMatrix();
64  // Ancienne vue
65  glPopMatrix();
66  }
67  else
68  {
69  // Nouvelle projection
70  glMatrixMode(GL_PROJECTION);
71  glPushMatrix();
72  glLoadIdentity();
73  unsigned int width = OSizeManager::get()->getWidth();
74  unsigned int height = OSizeManager::get()->getHeight();
75  glOrtho(0, width, 0.0, height, 0.0, 1.0);
76 
77  // Nouvelle vue
78  glMatrixMode(GL_MODELVIEW);
79  glPushMatrix();
80  glLoadIdentity();
81 
83 
84  // Ancienne projection
85  glMatrixMode(GL_PROJECTION);
86  glPopMatrix();
87 
88  // Ancienne vue
89  glMatrixMode(GL_MODELVIEW);
90  glPopMatrix();
91  }
92  }
93 
94  return 0;
95 }
Definition: color.h:31
static const OColor BLACK
Definition: color.h:86
bool m_bVisible
Definition: OGLElement.h:76
bool m_bIs3D
Definition: OGLElement.h:77
void setColor(const OColor &oColor)
OPoint3D m_oPoint2
OGLLine * m_pOGLLineToDisplay
OPoint3D m_oPoint1
virtual int render()
virtual ~OGLLineElement()
void drawLine(const OPoint3D &point1, const OPoint3D &point2, const OColor &oColor, float lineWidth) const
Definition: OGLLine.cpp:35
The 3D point class.
Definition: 3d.h:487
static LPOSizeManager get()