-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwgt_sig_base.cpp
executable file
·58 lines (51 loc) · 1.12 KB
/
wgt_sig_base.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "wgt_sig_base.h"
wgt_Sig_Base::wgt_Sig_Base()
{
}
/*
Add a new trace to this graph to display
*/
QCPGraph *wgt_Sig_Base::AddGraph(QString tracename,QColor color)
{
QCPGraph *graph = plot->addGraph(plot->xAxis);
graph->setPen(QPen(color,1));
graph->setName(QString(tracename));
graphs.insert(tracename,graph);
return graph;
}
QCPGraph *wgt_Sig_Base::AddGraph(QString tracename, QCPAxis *axis, QColor color)
{
QCPGraph *graph = plot->addGraph(axis);
graph->setPen(QPen(color,1));
graph->setName(QString(tracename));
graphs.insert(tracename,graph);
return graph;
}
/*
Return a trace for direct manipulation
*/
QCPGraph *wgt_Sig_Base::GetGraph(QString tracename)
{
if(graphs.contains(tracename))
{
return graphs[tracename];
}
return 0;
}
/*
remove a trace if present
*/
void wgt_Sig_Base::RemoveGraph(QString tracename)
{
if(graphs.contains(tracename))
{
graphs.remove(tracename);
}
}
bool wgt_Sig_Base::GraphVisible(QString tracename)
{
QCPGraph *graph = GetGraph(tracename);
if(graph)
return graph->visible();
return false;
}