Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
canghaiwuhen
OpenXG-RAN
Commits
8114422f
Commit
8114422f
authored
Apr 11, 2016
by
Cedric Roux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plot points in XY plot
parent
98d2cf8b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
0 deletions
+67
-0
common/utils/T/tracer/gui/gui.h
common/utils/T/tracer/gui/gui.h
+2
-0
common/utils/T/tracer/gui/xy_plot.c
common/utils/T/tracer/gui/xy_plot.c
+65
-0
No files found.
common/utils/T/tracer/gui/gui.h
View file @
8114422f
...
@@ -23,6 +23,8 @@ widget *new_text_list(gui *_gui, int width, int nlines, int background_color);
...
@@ -23,6 +23,8 @@ widget *new_text_list(gui *_gui, int width, int nlines, int background_color);
void
xy_plot_set_range
(
gui
*
gui
,
widget
*
this
,
void
xy_plot_set_range
(
gui
*
gui
,
widget
*
this
,
float
xmin
,
float
xmax
,
float
ymin
,
float
ymax
);
float
xmin
,
float
xmax
,
float
ymin
,
float
ymax
);
void
xy_plot_set_points
(
gui
*
gui
,
widget
*
this
,
int
npoints
,
float
*
x
,
float
*
y
);
void
text_list_add
(
gui
*
gui
,
widget
*
this
,
const
char
*
text
,
int
position
);
void
text_list_add
(
gui
*
gui
,
widget
*
this
,
const
char
*
text
,
int
position
);
...
...
common/utils/T/tracer/gui/xy_plot.c
View file @
8114422f
...
@@ -20,6 +20,7 @@ static void paint(gui *_gui, widget *_this)
...
@@ -20,6 +20,7 @@ static void paint(gui *_gui, widget *_this)
float
allocated_xmin
,
allocated_xmax
;
float
allocated_xmin
,
allocated_xmax
;
float
allocated_ymin
,
allocated_ymax
;
float
allocated_ymin
,
allocated_ymax
;
float
center
;
float
center
;
int
i
;
printf
(
"PAINT xy plot xywh %d %d %d %d
\n
"
,
this
->
common
.
x
,
this
->
common
.
y
,
this
->
common
.
width
,
this
->
common
.
height
);
printf
(
"PAINT xy plot xywh %d %d %d %d
\n
"
,
this
->
common
.
x
,
this
->
common
.
y
,
this
->
common
.
width
,
this
->
common
.
height
);
...
@@ -128,6 +129,24 @@ printf("ymin/max %g %g height wanted allocated %d %d alloc ymin/max %g %g ticste
...
@@ -128,6 +129,24 @@ printf("ymin/max %g %g height wanted allocated %d %d alloc ymin/max %g %g ticste
this
->
common
.
y
+
this
->
common
.
height
-
this
->
label_height
this
->
common
.
y
+
this
->
common
.
height
-
this
->
label_height
+
this
->
label_baseline
,
+
this
->
label_baseline
,
this
->
label
);
this
->
label
);
/* points */
float
ax
,
bx
,
ay
,
by
;
ax
=
(
allocated_plot_width
-
1
)
/
(
allocated_xmax
-
allocated_xmin
);
bx
=
-
ax
*
allocated_xmin
;
ay
=
(
allocated_plot_height
-
1
)
/
(
allocated_ymax
-
allocated_ymin
);
by
=
-
ay
*
allocated_ymin
;
for
(
i
=
0
;
i
<
this
->
npoints
;
i
++
)
{
int
x
,
y
;
x
=
ax
*
this
->
x
[
i
]
+
bx
;
y
=
ay
*
this
->
y
[
i
]
+
by
;
if
(
x
>=
0
&&
x
<
allocated_plot_width
&&
y
>=
0
&&
y
<
allocated_plot_height
)
x_add_point
(
g
->
x
,
this
->
common
.
x
+
this
->
vrule_width
+
x
,
this
->
common
.
y
+
y
);
}
x_plot_points
(
g
->
x
,
g
->
xwin
,
FOREGROUND_COLOR
);
}
}
static
void
hints
(
gui
*
_gui
,
widget
*
_w
,
int
*
width
,
int
*
height
)
static
void
hints
(
gui
*
_gui
,
widget
*
_w
,
int
*
width
,
int
*
height
)
...
@@ -171,3 +190,49 @@ printf("XY PLOT label wh %d %d\n", w->label_width, w->label_height);
...
@@ -171,3 +190,49 @@ printf("XY PLOT label wh %d %d\n", w->label_width, w->label_height);
return
w
;
return
w
;
}
}
/*************************************************************************/
/* public functions */
/*************************************************************************/
void
xy_plot_set_range
(
gui
*
_gui
,
widget
*
_this
,
float
xmin
,
float
xmax
,
float
ymin
,
float
ymax
)
{
struct
gui
*
g
=
_gui
;
struct
xy_plot_widget
*
this
=
_this
;
glock
(
g
);
this
->
xmin
=
xmin
;
this
->
xmax
=
xmax
;
this
->
ymin
=
ymin
;
this
->
ymax
=
ymax
;
send_event
(
g
,
DIRTY
,
this
->
common
.
id
);
gunlock
(
g
);
}
void
xy_plot_set_points
(
gui
*
_gui
,
widget
*
_this
,
int
npoints
,
float
*
x
,
float
*
y
)
{
struct
gui
*
g
=
_gui
;
struct
xy_plot_widget
*
this
=
_this
;
glock
(
g
);
if
(
npoints
!=
this
->
npoints
)
{
free
(
this
->
x
);
free
(
this
->
y
);
this
->
x
=
calloc
(
sizeof
(
float
),
npoints
);
this
->
y
=
calloc
(
sizeof
(
float
),
npoints
);
this
->
npoints
=
npoints
;
}
memcpy
(
this
->
x
,
x
,
npoints
*
sizeof
(
float
));
memcpy
(
this
->
y
,
y
,
npoints
*
sizeof
(
float
));
send_event
(
g
,
DIRTY
,
this
->
common
.
id
);
gunlock
(
g
);
}
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