Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
vite
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
solverstack
vite
Commits
40531fd7
Commit
40531fd7
authored
Mar 05, 2009
by
Olivier Lagrasse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dessin des fleches
parent
1f02df15
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
34 deletions
+79
-34
src/interface/render_area.cpp
src/interface/render_area.cpp
+6
-0
src/interface/render_area.hpp
src/interface/render_area.hpp
+73
-34
No files found.
src/interface/render_area.cpp
View file @
40531fd7
...
...
@@ -72,6 +72,7 @@ Render_area::Render_area(QWidget *parent)
_state_translate
=
0
;
/* temporary, for states translation */
//_container_view_size = 50;/* temporary, for container view */
/* Camera is placed on (0,0,0) and looks to (0,0,-1) */
_z_container
=
-
1.0
f
;
_z_arrow
=
-
2.0
f
;
/* closer to camera than containers or states (MUST be negative)*/
_z_state
=
-
3.0
f
;
...
...
@@ -271,6 +272,9 @@ void Render_area::paintGL(){
glPopMatrix
();
//glCallList(_list_counters);
draw_stored_arrows
(
_arrows
);
/* draw arrows without display lists */
draw_stored_events
(
_events
);
/* draw events without display lists */
break
;
...
...
@@ -379,6 +383,8 @@ bool Render_area::unbuild(){
glEnable
(
GL_BLEND
);
/* enable blending for the alpha color */
glBlendFunc
(
GL_SRC_ALPHA
,
GL_ONE_MINUS_SRC_ALPHA
);
glColor3d
(
1.0
,
1.0
,
1.0
);
/* init color to white */
return
true
;
}
...
...
src/interface/render_area.hpp
View file @
40531fd7
...
...
@@ -26,6 +26,14 @@ struct Event_{
Element_pos
container_height
;
};
struct
Arrow_
{
Element_pos
start_time
;
Element_pos
end_time
;
Element_pos
start_height
;
Element_pos
end_height
;
};
/*!
* \brief This class redefined the OpenGL widget - QGLWidget - to display the trace.
...
...
@@ -43,6 +51,7 @@ class Render_area : public QGLWidget, public Render
std
::
list
<
Element_pos
>
_text_pos
;
std
::
list
<
std
::
string
>
_text_value
;
std
::
vector
<
Event_
>
_events
;
std
::
vector
<
Arrow_
>
_arrows
;
/***********************************
...
...
@@ -329,6 +338,8 @@ class Render_area : public QGLWidget, public Render
void
draw_arrow
(
const
Element_pos
start_time
,
const
Element_pos
end_time
,
const
Element_pos
start_height
,
const
Element_pos
end_height
);
void
draw_stored_arrows
(
std
::
vector
<
Arrow_
>
&
arrows
);
void
draw_event
(
const
Element_pos
time
,
const
Element_pos
height
,
const
Element_pos
container_height
);
void
draw_stored_events
(
std
::
vector
<
Event_
>
&
events
);
...
...
@@ -468,8 +479,37 @@ inline void Render_area::end_draw_states(){
inline
void
Render_area
::
draw_arrow
(
const
Element_pos
start_time
,
const
Element_pos
end_time
,
const
Element_pos
start_height
,
const
Element_pos
end_height
){
Arrow_
buf
;
buf
.
start_time
=
start_time
;
buf
.
end_time
=
end_time
;
buf
.
start_height
=
start_height
;
buf
.
end_height
=
end_height
;
_arrows
.
push_back
(
buf
);
}
inline
void
Render_area
::
draw_stored_arrows
(
std
::
vector
<
Arrow_
>
&
arrows
){
Element_pos
start_time
,
end_time
,
start_height
,
end_height
;
/* Manage the event drawing size from state size and render area dimensions */
Element_pos
arrow_scale_x
=
_state_scale
*
(
_render_width
/
_state_x_max
);
Element_pos
arrow_scale_y
=
_render_height
/
_state_y_max
;
Element_pos
angle
;
for
(
long
i
=
0
;
i
<
(
long
)
arrows
.
size
()
;
i
++
){
start_time
=
arrows
[
i
].
start_time
*
arrow_scale_x
+
_render_width
*
_x_scale_container_state
-
_state_translate
;
end_time
=
arrows
[
i
].
end_time
*
arrow_scale_x
+
_render_width
*
_x_scale_container_state
-
_state_translate
;
start_height
=
arrows
[
i
].
start_height
*
arrow_scale_y
;
end_height
=
arrows
[
i
].
end_height
*
arrow_scale_y
;
/* DEBUG */
// std::cerr << "Arrow draw: (" << start_time << ", " << start_height << ") to (" << end_time << ", " << end_height << ")" << std::endl;
...
...
@@ -492,13 +532,13 @@ inline void Render_area::draw_arrow(const Element_pos start_time, const Element_
//
glBegin(GL_TRIANGLES);/* create an arrow */
/*
{
glBegin
(
GL_TRIANGLES
);
/* create an arrow */
{
glColor3d
(
1.0
,
0.7
,
0.7
);
glVertex2d
(
0.5
,
0.0
);
glColor3d
(
0.9
,
0.6
,
0.6
);
glVertex2d
(
-
0.5
,
-
0.5
);
glColor3d
(
0.9
,
0.6
,
0.6
);
glVertex2d
(
-
0.5
,
0.5
);
}
glEnd();*/
glEnd
();
glPopMatrix
();
...
...
@@ -508,18 +548,17 @@ inline void Render_area::draw_arrow(const Element_pos start_time, const Element_
glLineWidth
(
2.5
f
);
glBegin
(
GL_LINES
);
{
glColor3d
(
1.0
,
0.7
,
0.7
);
glVertex3d
(
start_time
,
start_height
,
_z_arrow
);
glColor3d
(
0.9
,
0.6
,
0.6
);
glVertex3d
(
end_time
,
end_height
,
_z_arrow
);
glColor3d
(
1.0
,
0.7
,
0.7
);
glVertex2d
(
start_time
,
start_height
);
glColor3d
(
0.9
,
0.6
,
0.6
);
glVertex2d
(
end_time
,
end_height
);
}
glEnd
();
glLineWidth
(
1.0
f
);
/* 1 is the default value */
glPopMatrix
();
}
}
inline
void
Render_area
::
draw_event
(
const
Element_pos
time
,
const
Element_pos
height
,
const
Element_pos
container_height
){
Event_
buf
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment