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
3c745779
Commit
3c745779
authored
Feb 14, 2009
by
Olivier Lagrasse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
affichage des etats
parent
a2e31afa
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
216 additions
and
105 deletions
+216
-105
interface/Makefile
interface/Makefile
+3
-3
interface/README
interface/README
+2
-1
interface/src/interface_graphic.cpp
interface/src/interface_graphic.cpp
+35
-8
interface/src/interface_graphic.hpp
interface/src/interface_graphic.hpp
+5
-1
interface/src/main_window.ui
interface/src/main_window.ui
+63
-0
interface/src/render_area.cpp
interface/src/render_area.cpp
+67
-75
interface/src/render_area.hpp
interface/src/render_area.hpp
+11
-17
interface/src/resource.hpp
interface/src/resource.hpp
+2
-0
interface/tests/resource_test.hpp
interface/tests/resource_test.hpp
+6
-0
interface/tests/test_trace.hpp
interface/tests/test_trace.hpp
+22
-0
No files found.
interface/Makefile
View file @
3c745779
...
...
@@ -50,8 +50,8 @@ plugins:
#@echo " "
tests
:
all
cd
./tests
&&
qmake-qt4
-project
&&
qmake-qt4
-makefile
-o
Makefile
"OBJECTS_DIR=../bin"
"CONFIG+=uitools debug"
"QT+=opengl"
"DESTDIR = ../bin"
tests.pro
&&
make all
tests
:
cd
./tests
&&
make all
@
echo
" "
@
echo
"Compilation completed! (test)"
@
echo
" "
...
...
@@ -66,6 +66,6 @@ clean:
# Must be called with option -i, otherwise an error occured in the first instructions, the followings won't be executed.
wash
:
cd
./src
&&
rm
*
~
*
.o Makefile qrc_vite.cpp core
cd
./tests
&&
rm
*
~
*
.o
*
pro
Makefile core
cd
./tests
&&
rm
*
~
*
.o Makefile core
cd
./bin
&&
rm
*
.o
cd
./debug
&&
rm
*
interface/README
View file @
3c745779
...
...
@@ -2,9 +2,10 @@ To compile the interface code source :
Visit : http://www.qtsoftware.com/downloads/opensource/appdev and download the development files for your operating system.
Install also GLUT.
For Debian/Ubuntu users, you can use apt-get :
sudo apt-get install libqt4-dev libqt4-opengl-dev
sudo apt-get install libqt4-dev libqt4-opengl-dev
libglut3-dev
For Doxygen, it necessary to have epstopdf for the latex version. You can install it with the package texlive-extra-utils.
...
...
interface/src/interface_graphic.cpp
View file @
3c745779
...
...
@@ -89,6 +89,7 @@ void Interface_graphic::load_windows(){
/* Create the render area and bind it to a layout (_ui_render_area_layout) */
_ui_render_area
=
new
Render_area
(
this
);
_ui_render_area_layout
->
addWidget
(
_ui_render_area
);
/*
Special function of Qt which allows methods declared as slots and which name are 'on_[widget]_[action]()' to be called when the 'widget' triggered the signal corresponding to 'action'.
...
...
@@ -201,13 +202,15 @@ void Interface_graphic::on_open_triggered(){
If 'this' is put, the application closes after the getOpenFilename() dialog box closes.
*/
QString
filename
=
QFileDialog
::
getOpenFileName
(
_ui_main_window
);
if
(
!
filename
.
isEmpty
()){
if
(
_is_rendering_trace
==
true
)
/* Realease the previous trace */
Interface_graphic
(
filename
.
toStdString
());
/* create a new window */
/* if (_ui_render_area->unbuild()==false)
error("Close file : an error occured with trace releasing.");*/
if
(
_is_rendering_trace
==
true
){
/* Realease the previous trace */
warning
(
"Cannot opening an other file"
);
}
else
opening_file
(
filename
.
toStdString
());
}
...
...
@@ -274,13 +277,37 @@ void Interface_graphic::on_help_triggered(){
void
Interface_graphic
::
on_about_triggered
(){
QMessageBox
::
about
(
_ui_main_window
,
tr
(
"About ViTE"
),
/*
QMessageBox::about(_ui_main_window, tr("About ViTE"),
tr("<b>ViTE</b> is a trace format visualizer developped "
"by french engineering school students for INRIA searchers (<a href='http://www.inria.fr'>http://www.inria.fr</a>).<br/><br/>"
"It is licensed under <i>CECILL-A</i>."
));
"by french engineering school students for INRIA researchers (<a href='http://www.inria.fr'>http://www.inria.fr</a>).<br/><br/>"
"It is licensed under <i>CECILL-A</i>."));*/
QMessageBox
::
about
(
_ui_main_window
,
tr
(
"About ViTE"
),
tr
(
"<b>ViTE</b> version 0.1"
));
}
void
Interface_graphic
::
on_scale_state_valueChanged
(
int
new_value
){
_ui_render_area
->
change_scale
(
new_value
);
}
void
Interface_graphic
::
on_translate_state_valueChanged
(
int
new_value
){
_ui_render_area
->
change_translate
(
new_value
);
}
void
Interface_graphic
::
on_main_window_hide
(){
cerr
<<
"GoodBye"
<<
endl
;
}
interface/src/interface_graphic.hpp
View file @
3c745779
...
...
@@ -63,7 +63,7 @@ class Interface_graphic : public QWidget, public Interface{
* \brief Layout which will contain the render area.
*/
QVBoxLayout
*
_ui_render_area_layout
;
/***********************************
...
...
@@ -253,6 +253,10 @@ protected slots:
*\brief A slot which called when 'about' in the menu is clicked.
*/
void
on_about_triggered
();
void
on_scale_state_valueChanged
(
int
new_value
);
/* temporary slot */
void
on_translate_state_valueChanged
(
int
new_value
);
/* temporary slot */
void
on_main_window_hide
();
};
#endif
interface/src/main_window.ui
View file @
3c745779
...
...
@@ -30,6 +30,69 @@
<item>
<layout class="QVBoxLayout" name="render_area_layout" />
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" >
<item>
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Change position:</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="translate_state" >
<property name="maximum" >
<number>10000</number>
</property>
<property name="singleStep" >
<number>1</number>
</property>
<property name="pageStep" >
<number>1</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout" >
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>Change scale :</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="scale_state" >
<property name="minimum" >
<number>1</number>
</property>
<property name="maximum" >
<number>100000</number>
</property>
<property name="singleStep" >
<number>1</number>
</property>
<property name="pageStep" >
<number>1</number>
</property>
<property name="value" >
<number>10</number>
</property>
<property name="sliderPosition" >
<number>10</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar" >
...
...
interface/src/render_area.cpp
View file @
3c745779
...
...
@@ -47,9 +47,7 @@ Render_area::Render_area(QWidget *parent)
_container_h_space
=
DRAWING_CONTAINER_H_SPACE_DEFAULT
;
_container_v_space
=
DRAWING_CONTAINER_V_SPACE_DEFAULT
;
_state_width
=
DRAWING_STATE_WIDTH_DEFAULT
;
_state_height
=
DRAWING_STATE_HEIGHT_DEFAULT
;
_state_h_space
=
DRAWING_STATE_H_SPACE_DEFAULT
;
_state_v_space
=
DRAWING_STATE_V_SPACE_DEFAULT
;
_trace
=
NULL
;
...
...
@@ -58,14 +56,15 @@ Render_area::Render_area(QWidget *parent)
_container_y_max
=
0
;
_state_x_max
=
0
;
_state_y_max
=
0
;
_state_x_min
=
1000
;
/* bad values ! */
_state_y_min
=
1000
;
/* attributes */
list_containers
=
0
;
list_states
=
0
;
_state_scale
=
1
;
/* temporary, for states scaling */
_state_translate
=
0
;
/* temporary, for states translation */
setAutoFillBackground
(
false
);
...
...
@@ -183,7 +182,7 @@ void Render_area::paintGL(){
/* Draw containers */
glPushMatrix
();
glTranslatef
(
0.0
f
,
5
0.0
f
,
-
1.0
f
);
glTranslatef
(
0.0
f
,
4
0.0
f
,
-
1.0
f
);
glScalef
(
10.0
f
/
_container_x_max
,
50.0
f
/
_container_y_max
,
0.0
f
);
...
...
@@ -213,7 +212,7 @@ void Render_area::paintGL(){
glPushMatrix
();
glTranslatef
(
0.0
f
,
5
0.0
f
,
0.0
f
);
glTranslatef
(
0.0
f
,
4
0.0
f
,
0.0
f
);
glScalef
(
10.0
f
/
_container_x_max
,
50.0
f
/
_container_y_max
,
0.0
f
);
glColor3d
(
1
,
1
,
1
);
...
...
@@ -225,7 +224,7 @@ void Render_area::paintGL(){
cerr
<<
"Container texts position: (x = "
<<
buf_x
<<
", y = "
<<
buf_y
<<
") -> '"
<<
buf_txt
<<
"'"
<<
endl
<<
endl
;
#endif
for
(
int
i
=
0
;
i
<
buf_txt
.
length
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
buf_txt
.
length
();
i
++
){
glutBitmapCharacter
(
GLUT_BITMAP_8_BY_13
,
buf_txt
.
c_str
()[
i
]);
}
...
...
@@ -235,19 +234,18 @@ void Render_area::paintGL(){
/* Draw states */
glPushMatrix
();
// glTranslated(-250, -250, 0);
// glTranslatef(-_state_x_max, 100-_state_y_max, 0);
// glScalef(100/(_state_x_max-_state_x_min), 100/(_state_y_max-_state_y_min), 0);
// glScalef(_state_scale/(_state_x_max-_state_x_min), 50.0f/_container_y_max, 0.0f);
//glOrtho(0, 0, 20, 100, 0, 1000);
glTranslated
(
-
230.0
f
,
50.0
f
,
0.0
f
);
glScalef
(
100.0
f
,
10.0
f
,
0.0
f
);
glCallList
(
list_states
);
glTranslated
(
20.0
f
-
_state_translate
,
40.0
f
,
-
2.0
f
);
glScalef
(
_state_scale
,
50.0
f
/
_container_y_max
,
0.0
f
);
glPopMatrix
();
glCallList
(
list_states
);
glPopMatrix
();
break
;
default:
...
...
@@ -269,13 +267,18 @@ void Render_area::paintGL(){
//void Render_area::paintEvent(QPaintEvent *event){
void
Render_area
::
change_scale
(
int
scale
){
_state_scale
=
scale
;
updateGL
();
}
//}
void
Render_area
::
change_translate
(
int
translate
){
_state_translate
=
translate
;
updateGL
();
}
...
...
@@ -645,48 +648,50 @@ GLuint Render_area::draw_trace(){//Trace trace)
State
*
buf_entity
;
Element_count
i
;
/* for the level (y axis) of the states */
i
=
0
;
while
(
!
stack_states
.
empty
()){
buf_list
=
stack_states
.
top
();
i
=
0
;
for
(
buf_list
.
go_beginning
()
,
i
=
0
;
buf_list
.
has_next
()
;
buf_list
.
next
(),
i
++
)
{
for
(
buf_list
.
go_beginning
()
;
buf_list
.
has_next
()
;
buf_list
.
next
()
)
{
buf_entity
=
(
State
*
)
buf_list
.
get_current_entity
();
if
(
buf_entity
->
get_end_time
().
get_value
()
>
_state_y_max
)
_state_y_max
=
buf_entity
->
get_end_time
().
get_value
();
if
(
buf_entity
->
get_start_time
().
get_value
()
<
_state_x_min
)
_state_x_min
=
buf_entity
->
get_start_time
().
get_value
();
if
(
buf_entity
->
get_end_time
().
get_value
()
<
_state_y_min
)
_state_y_min
=
buf_entity
->
get_end_time
().
get_value
();
if
(
buf_entity
->
get_start_time
().
get_value
()
<
_state_x_min
)
_state_x_min
=
buf_entity
->
get_start_time
().
get_value
();
if
(
buf_entity
->
get_end_time
().
get_value
()
>
_state_x_max
)
_state_x_max
=
buf_entity
->
get_end_time
().
get_value
();
draw_state
(
buf_entity
->
get_start_time
().
get_value
(),
buf_entity
->
get_end_time
().
get_value
(),
i
,
0.7
,
0.7
,
0.75
);
}
/* end for */
i
++
;
draw_state
(
buf_entity
->
get_start_time
().
get_value
(),
buf_entity
->
get_end_time
().
get_value
(),
i
,
1.0
,
1.0
,
0.0
);
}
/*To draw the last element of the list*/
if
(
buf_list
.
get_current_entity
()
!=
NULL
){
buf_entity
=
(
State
*
)
buf_list
.
get_current_entity
();
if
(
buf_entity
->
get_end_time
().
get_value
()
>
_state_y_max
)
_state_y_max
=
buf_entity
->
get_end_time
().
get_value
();
if
(
buf_entity
->
get_start_time
().
get_value
()
<
_state_x_min
)
_state_x_min
=
buf_entity
->
get_start_time
().
get_value
();
if
(
buf_entity
->
get_end_time
().
get_value
()
<
_state_y_min
)
_state_
y_min
=
buf_entity
->
get_end_time
().
get_value
();
if
(
buf_entity
->
get_end_time
().
get_value
()
>
_state_x_max
)
_state_
x_max
=
buf_entity
->
get_end_time
().
get_value
();
draw_state
(
buf_entity
->
get_start_time
().
get_value
(),
buf_entity
->
get_end_time
().
get_value
(),
i
,
1.0
,
1.0
,
0.0
);
}
draw_state
(
buf_entity
->
get_start_time
().
get_value
(),
buf_entity
->
get_end_time
().
get_value
(),
i
,
0.7
,
0.7
,
0.75
);
}
/* end if */
stack_states
.
pop
();
}
stack_states
.
pop
();
}
}
/* end while (!stack_states.empty()) */
}
/* end list */
glEndList
();
/* close the list */
...
...
@@ -710,6 +715,12 @@ GLuint Render_area::draw_trace(){//Trace trace)
inline
Element_count
Render_area
::
number_of_children
(
const
Container
*
c
){
if
(
c
->
get_children
()
==
NULL
){
_parent
->
warning
(
string
(
"Container child list is empty"
));
return
0
;
}
return
c
->
get_children
()
->
size
();
}
...
...
@@ -738,11 +749,6 @@ void Render_area::draw_container(const Element_pos x, const Element_pos y, const
float
j
=
0.6
;
/* glPushMatrix();
glTranslatef(20, 40, 0);
glScalef(20, 20, 20);*/
glBegin
(
GL_QUADS
);
/* create a quads */
{
glColor3d
(
0
,
0
,
j
);
glVertex2d
(
x
,
y
);
...
...
@@ -751,42 +757,28 @@ void Render_area::draw_container(const Element_pos x, const Element_pos y, const
glColor3d
(
0
,
0
,
j
);
glVertex2d
(
x
-
w
,
y
);
}
glEnd
();
// glPopMatrix();
}
void
Render_area
::
draw_state
(
const
Element_pos
start
,
const
Element_pos
end
,
const
Element_count
level
,
const
Element_col
r
,
const
Element_col
g
,
const
Element_col
b
)
const
{
double
r1
=
0.6
;
double
g1
=
0.6
;
double
b1
=
0.6
;
Element_pos
base
=
level
*
(
_container_height
+
_container_v_space
);
// double state_height = 10;
// base = 50;
Element_pos
base
=
((
double
)
level
)
*
_container_height
+
((
double
)
level
)
*
_container_v_space
+
_container_v_space
;
#ifdef DEBUG_MODE_RENDER_AREA
#ifdef DEBUG_MODE_RENDER_AREA
cerr
<<
__FILE__
<<
" l."
<<
__LINE__
<<
":"
<<
endl
;
cerr
<<
"States position (for drawing): (x = "
<<
start
<<
", y = "
<<
base
<<
", w = "
<<
end
-
start
<<
", h = "
<<
_state_height
<<
")"
<<
endl
<<
endl
;
cerr
<<
"States position (for drawing): (x = "
<<
start
<<
", y = "
<<
base
<<
", w = "
<<
end
-
start
<<
", h = "
<<
_state_height
<<
") -> level:"
<<
level
<<
endl
<<
endl
;
#endif
glBegin
(
GL_QUADS
);
/* create a quads */
{
glColor3d
(
r1
,
g1
,
b1
);
glVertex2d
(
start
,
base
);
// glColor3d(r1, g1, b1);glVertex2d(0, 10);
glColor3d
(
r1
,
g1
,
b1
);
glVertex2d
(
start
,
base
+
_state_height
);
glColor3d
(
r1
,
g1
,
b1
);
glVertex2d
(
end
,
base
+
_state_height
);
glColor3d
(
r1
,
g1
,
b1
);
glVertex2d
(
end
,
base
);
/* glColor3d(r1, g1, b1);glVertex2d(0, 10);
glColor3d(r1, g1, b1);glVertex2d(10, 10);
glColor3d(r1, g1, b1);glVertex2d(10, 5);
glColor3d(r1, g1, b1);glVertex2d(5, 5);*/
glColor3d
(
r
,
g
,
b
);
glVertex2d
(
start
,
base
);
glColor3d
(
r
,
g
,
b
);
glVertex2d
(
start
,
base
+
_state_height
);
glColor3d
(
r
*
2
,
g
*
2
,
b
*
2
);
glVertex2d
(
end
,
base
+
_state_height
);
glColor3d
(
r
*
2
,
g
*
2
,
b
*
2
);
glVertex2d
(
end
,
base
);
}
glEnd
();
// glPopMatrix();
}
interface/src/render_area.hpp
View file @
3c745779
...
...
@@ -208,18 +208,8 @@ class Render_area : public QGLWidget
/*!
* \brief The default height for states.
*/
static
const
float
DRAWING_STATE_HEIGHT_DEFAULT
=
1.0
f
;
/*!
* \brief The default width for states.
*/
static
const
float
DRAWING_STATE_WIDTH_DEFAULT
=
2.0
f
;
/*!
* \brief The default horizontal space between states.
*/
static
const
float
DRAWING_STATE_H_SPACE_DEFAULT
=
0.2
f
;
static
const
float
DRAWING_STATE_HEIGHT_DEFAULT
=
1.2
f
;
/*!
* \brief The default vertical space between states.
*/
...
...
@@ -232,18 +222,17 @@ class Render_area : public QGLWidget
double
_container_height
;
double
_container_h_space
;
double
_container_v_space
;
double
_state_width
;
double
_state_height
;
double
_state_h_space
;
double
_state_v_space
;
double
_state_v_space
;
double
_container_x_max
;
double
_container_y_max
;
double
_state_x_max
;
double
_state_y_max
;
//
double _state_y_max;
double
_state_x_min
;
double
_state_y_min
;
//
double _state_y_min;
/***********************************
* Trace Drawing functions and attributes.
...
...
@@ -289,6 +278,8 @@ class Render_area : public QGLWidget
void
draw_state
(
const
Element_pos
start
,
const
Element_pos
end
,
const
Element_count
level
,
const
Element_col
r
,
const
Element_col
g
,
const
Element_col
b
)
const
;
int
_state_scale
;
/* temporary */
int
_state_translate
;
/* temporary */
public:
...
...
@@ -329,6 +320,9 @@ class Render_area : public QGLWidget
*/
bool
unbuild
();
void
change_scale
(
int
scale
);
/* temporary -> to change the scale to view states */
void
change_translate
(
int
translate
);
/* temporary -> to change the translate to view states */
};
#endif
interface/src/resource.hpp
View file @
3c745779
...
...
@@ -9,8 +9,10 @@
#define RESOURCE_HPP
#include "../../main_resource.hpp"
//#include "../tests/resource_test.hpp"
...
...
interface/tests/resource_test.hpp
View file @
3c745779
...
...
@@ -9,6 +9,8 @@
//#include "../../main_resource.hpp"
#include <QApplication>
#include <QtGui>
/* for all of the Qt's Widgets */
...
...
@@ -59,6 +61,9 @@ class Interface_console;
class
Interface_graphic
;
class
Render_area
;
/* Test classes */
class
Trace
;
class
Container
;
//include "interface/tests/test_trace.hpp"
...
...
@@ -69,6 +74,7 @@ class Render_area;
//#include "../../parser/src/ParserPaje.hpp"
#define INTERFACE_TEST
#include "../src/interface.hpp"
#include "../src/interface_console.hpp"
...
...
interface/tests/test_trace.hpp
View file @
3c745779
...
...
@@ -71,4 +71,26 @@ public:
};
class
ParserPaje
{
public:
bool
parse
(
const
std
::
string
,
Trace
&
);
};
class
EntityList
{
public:
void
go_beginning
()
const
;
void
has_next
()
const
;
void
next
()
const
;
const
Entity
*
get_current_entity
()
const
;
};
class
State
{
};
#endif
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