Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
不卤废丝
taskbus
提交
846204fe
taskbus
项目概览
不卤废丝
/
taskbus
与 Fork 源项目一致
Fork自
colorEagleStdio / taskbus
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
taskbus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
846204fe
编写于
5月 07, 2022
作者:
M
manjaro-xfce
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Plot显示更为美观
上级
44a7f7aa
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
54 addition
and
15 deletion
+54
-15
modules/sinks/sink_plots/dialogplots.cpp
modules/sinks/sink_plots/dialogplots.cpp
+42
-13
modules/sinks/sink_plots/dialogplots.h
modules/sinks/sink_plots/dialogplots.h
+1
-0
modules/sinks/sink_plots/spectrowidget.cpp
modules/sinks/sink_plots/spectrowidget.cpp
+9
-2
modules/sinks/sink_plots/spectrowidget.h
modules/sinks/sink_plots/spectrowidget.h
+2
-0
未找到文件。
modules/sinks/sink_plots/dialogplots.cpp
浏览文件 @
846204fe
...
...
@@ -89,6 +89,7 @@ void DialogPlots::deal_package(QByteArray package)
if
(
channels
<
2
)
{
serials
=
new
QLineSeries
(
this
);
serials
->
setPen
(
QPen
(
QColor
(
255
,
255
,
0
)));
}
else
{
...
...
@@ -117,7 +118,7 @@ void DialogPlots::deal_package(QByteArray package)
pv
->
setChart
(
chart
);
chart
->
setTitle
(
tr
(
"SUB%1 PATH%2"
).
arg
(
pheader
->
subject_id
).
arg
(
pheader
->
path_id
));
pv
->
setRubberBand
(
QChartView
::
Rectangle
RubberBand
);
pv
->
setRubberBand
(
QChartView
::
Vertical
RubberBand
);
chart
->
addSeries
(
serials
);
serials
->
attachAxis
(
ax
);
...
...
@@ -288,20 +289,21 @@ void DialogPlots::on_pushButton_reset_clicked()
bool
needup_x
=
false
,
needup_y
=
false
;
if
(
max_x
>
new_max_x
)
new_max_x
=
max_x
+
seed_x
*
0.2
,
needup_x
=
true
;
if
(
max_x
*
1.2
<
new_max_x
)
new_max_x
=
max_x
+
seed_x
*
0.2
,
needup_x
=
true
;
if
(
max_x
!=
new_max_x
)
new_max_x
=
max_x
,
needup_x
=
true
;
//
if (max_x *1.2 < new_max_x) new_max_x = max_x + seed_x * 0.2,needup_x=true;
if
(
max_y
>
new_max_y
)
new_max_y
=
max_y
+
seed_y
*
0.2
,
needup_y
=
true
;
if
(
max_y
*
1.2
<
new_max_y
)
new_max_y
=
max_y
+
seed_y
*
0.2
,
needup_y
=
true
;
if
(
min_x
<
new_min_x
)
new_min_x
=
min_x
,
needup_x
=
true
;
if
(
min_x
>
new_min_x
*
1.2
)
new_min_x
=
min_x
,
needup_x
=
true
;
if
(
min_x
!=
new_min_x
)
new_min_x
=
min_x
,
needup_x
=
true
;
//
if (min_x > new_min_x * 1.2) new_min_x = min_x,needup_x=true;
if
(
min_y
<
new_min_y
)
new_min_y
=
min_y
,
needup_y
=
true
;
if
(
min_y
>
new_min_y
*
1.2
)
new_min_y
=
min_y
,
needup_y
=
true
;
if
(
needup_x
==
true
)
ax
->
setRange
(
new_min_x
,
new_max_x
);
if
(
needup_y
==
true
)
...
...
@@ -343,7 +345,32 @@ void DialogPlots::timerEvent(QTimerEvent *event)
QXYSeries
*
serials
=
m_chat_serials
[
subid
];
const
int
pts
=
m_plot_buffer
[
hash_subidx
].
size
();
const
double
*
fdata
=
m_plot_buffer
[
hash_subidx
].
constData
();
QList
<
QVector
<
double
>
>
&
avgList
=
m_plot_lastUpdates
[
hash_subidx
];
bool
clear_lst
=
false
;
for
(
QList
<
QVector
<
double
>
>::
iterator
pit
=
avgList
.
begin
();
pit
!=
avgList
.
end
();
++
pit
)
{
if
(
pit
->
size
()
!=
pts
)
{
clear_lst
=
true
;
break
;
}
}
if
(
clear_lst
)
avgList
.
clear
();
avgList
.
push_back
(
m_plot_buffer
[
hash_subidx
]);
while
(
avgList
.
size
()
>
6
)
avgList
.
pop_front
();
QVector
<
double
>
vec_tmp
(
pts
,
0
);
double
*
fdata
=
vec_tmp
.
data
();
const
int
avgsz
=
avgList
.
size
();
for
(
QList
<
QVector
<
double
>
>::
iterator
pit
=
avgList
.
begin
();
pit
!=
avgList
.
end
();
++
pit
)
{
for
(
int
i
=
0
;
i
<
pts
;
++
i
)
fdata
[
i
]
+=
pit
->
at
(
i
)
/
avgsz
;
}
double
max_x
=
0
,
max_y
=
fdata
[
0
];
double
min_x
=
0
,
min_y
=
fdata
[
0
];
...
...
@@ -377,11 +404,12 @@ void DialogPlots::timerEvent(QTimerEvent *event)
{
QChart
*
ca
=
m_chars
[
subid
];
QValueAxis
*
axx
=
m_char_axis_x
[
subid
];
QValueAxis
*
axy
=
m_char_axis_y
[
subid
];
double
dmin
=
axx
->
min
();
double
dmax
=
axx
->
max
();
QRectF
r
=
ca
->
plotArea
();
ws
->
setMinMaxRange
(
axy
->
min
(),
axy
->
max
());
ws
->
append_data
(
m_plot_buffer
[
hash_subidx
],
r
.
left
(),
r
.
right
(),
...
...
@@ -423,20 +451,21 @@ void DialogPlots::timerEvent(QTimerEvent *event)
bool
needup_x
=
false
,
needup_y
=
false
;
if
(
max_x
>
new_max_x
)
new_max_x
=
max_x
+
seed_x
*
0.2
,
needup_x
=
true
;
if
(
max_x
*
1.2
<
new_max_x
)
new_max_x
=
max_x
+
seed_x
*
0.2
,
needup_x
=
true
;
if
(
max_x
!=
new_max_x
)
new_max_x
=
max_x
,
needup_x
=
true
;
//
if (max_x *1.2 < new_max_x) new_max_x = max_x + seed_x * 0.2,needup_x=true;
if
(
max_y
>
new_max_y
)
new_max_y
=
max_y
+
seed_y
*
0.2
,
needup_y
=
true
;
if
(
max_y
*
1.2
<
new_max_y
)
new_max_y
=
max_y
+
seed_y
*
0.2
,
needup_y
=
true
;
if
(
min_x
<
new_min_x
)
new_min_x
=
min_x
,
needup_x
=
true
;
if
(
min_x
>
new_min_x
*
1.2
)
new_min_x
=
min_x
,
needup_x
=
true
;
if
(
min_x
!=
new_min_x
)
new_min_x
=
min_x
,
needup_x
=
true
;
//
if (min_x > new_min_x * 1.2) new_min_x = min_x,needup_x=true;
if
(
min_y
<
new_min_y
)
new_min_y
=
min_y
,
needup_y
=
true
;
if
(
min_y
>
new_min_y
*
1.2
)
new_min_y
=
min_y
,
needup_y
=
true
;
if
(
ui
->
checkBox_auto_reser
->
isChecked
())
if
(
ui
->
checkBox_auto_reser
->
isChecked
()
||
needup_x
)
{
if
(
needup_x
==
true
)
ax
->
setRange
(
new_min_x
,
new_max_x
);
...
...
@@ -445,7 +474,7 @@ void DialogPlots::timerEvent(QTimerEvent *event)
}
}
refid
=
startTimer
(
40
);
refid
=
startTimer
(
25
);
}
}
modules/sinks/sink_plots/dialogplots.h
浏览文件 @
846204fe
...
...
@@ -42,6 +42,7 @@ private:
QVector
<
int
>
m_plot_types
;
QMap
<
quint64
,
QVector
<
double
>
>
m_plot_buffer
;
QMap
<
quint64
,
QList
<
QVector
<
double
>
>
>
m_plot_lastUpdates
;
QMap
<
quint64
,
bool
>
m_plot_refresh
;
int
tid
=
-
1
;
...
...
modules/sinks/sink_plots/spectrowidget.cpp
浏览文件 @
846204fe
...
...
@@ -45,6 +45,7 @@ void SpectroWidget::append_data(QVector<double> vec_data,
for
(
int
r
=
0
;
r
<
width
;
++
r
)
{
m_image
.
setPixel
(
r
,
0
,
qRgb
(
0
,
0
,
0
));
if
(
r
<
left
||
r
>
right
)
continue
;
int
from
=
(
r
-
left
)
/
(
right
-
left
)
*
(
right_x
-
left_x
)
+
left_x
+
.5
;
...
...
@@ -65,15 +66,21 @@ void SpectroWidget::append_data(QVector<double> vec_data,
}
else
if
(
vii
>=
0.75
&&
vii
<
1
)
{
red
=
255
;
red
=
(
1
-
vii
)
/
0.25
*
255
;
green
=
255
;
blue
=
(
vii
-
0.75
)
/
0.25
*
255
;
}
else
if
(
vii
>=
1
)
red
=
255
,
blue
=
255
,
green
=
255
;
red
=
0
,
blue
=
255
,
green
=
255
;
m_image
.
setPixel
(
r
,
0
,
qRgb
(
red
,
green
,
blue
));
}
update
();
}
void
SpectroWidget
::
setMinMaxRange
(
double
vmin
,
double
vmax
)
{
m_maxBound
=
vmax
;
m_minBound
=
vmin
;
}
modules/sinks/sink_plots/spectrowidget.h
浏览文件 @
846204fe
...
...
@@ -10,6 +10,8 @@ public:
explicit
SpectroWidget
(
QWidget
*
parent
=
nullptr
);
protected:
void
paintEvent
(
QPaintEvent
*
evt
);
public
slots
:
void
setMinMaxRange
(
double
vmin
,
double
vmax
);
public:
void
append_data
(
QVector
<
double
>
vec_data
,
double
left
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录