-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathWave_Zone.cs
164 lines (146 loc) · 4.77 KB
/
Wave_Zone.cs
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace CellInfo
{
public partial class Wave_Zone : Form
{
#region 变量定义
public List<float> x1 = new List<float>();
public List<float> y1 = new List<float>();
public List<float> x2 = new List<float>();
public List<float> y2 = new List<float>();
public List<float> x3 = new List<float>();
public List<float> y3 = new List<float>();
public List<float> x4 = new List<float>();
public List<float> y4 = new List<float>();
//波形图上表示横轴变量t
private int timerDrawI = 0;
private int timerInerval = 1000;
private float X_End = 120;
public int dBmMain;
public int dBmNeighbour1;
public int dBmNeighbour2;
public int dBmNeighbour3;
public int dBmNeighbour4;
public int dBmNeighbour5;
public int dBmNeighbour6;
#endregion
public Wave_Zone()
{
InitializeComponent();
InitializeForm();
}
/// <summary>
/// 窗口初始化
/// </summary>
private void InitializeForm()
{
zGraph1.m_fXBeginSYS = 0;
zGraph1.m_fXEndSYS = X_End;
zGraph1.m_fYBeginSYS = -120;
zGraph1.m_fYEndSYS = 0;
zGraph1.m_SySnameX = "时间/s";
zGraph1.m_SySnameY = "信号强度/dBm";
x1.Clear();
y1.Clear();
x2.Clear();
y2.Clear();
x3.Clear();
y3.Clear();
x4.Clear();
y4.Clear();
zGraph1.f_ClearAllPix();
zGraph1.f_reXY();
zGraph1.f_LoadOnePix(ref x1, ref y1, Color.Red, 2);
zGraph1.f_AddPix(ref x2, ref y2, Color.Yellow, 2);
zGraph1.f_AddPix(ref x3, ref y3, Color.Blue, 2);
zGraph1.f_AddPix(ref x4, ref y4, Color.Green, 2);
timer1.Interval = timerInerval;
timer1.Enabled = false;
}
/// <summary>
/// 重新绘制
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void 刷新_Click(object sender, EventArgs e)
{
x1.Clear();
y1.Clear();
x2.Clear();
y2.Clear();
x3.Clear();
y3.Clear();
x4.Clear();
y4.Clear();
zGraph1.f_ClearAllPix();
zGraph1.f_reXY();
zGraph1.f_LoadOnePix(ref x1, ref y1, Color.Red, 2);
zGraph1.f_AddPix(ref x2, ref y2, Color.Yellow, 2);
zGraph1.f_AddPix(ref x3, ref y3, Color.Blue, 2);
zGraph1.f_AddPix(ref x4, ref y4, Color.Green, 2);
timerDrawI = 0;
timer1.Start();
}
/// <summary>
/// 变量赋值
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
public void Wave_Assignment(string[] x, string[] y)
{
dBmMain = int.Parse(x[28]);
dBmNeighbour1 = int.Parse(y[11]);
dBmNeighbour2 = int.Parse(y[19]);
dBmNeighbour3 = int.Parse(y[27]);
dBmNeighbour4 = int.Parse(y[35]);
dBmNeighbour5 = int.Parse(y[43]);
dBmNeighbour6 = int.Parse(y[51]);
}
/// <summary>
/// 曲线绘制
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void timer1_Tick(object sender, EventArgs e)
{
zGraph1.f_Refresh();
if (timerDrawI < X_End)
{
x1.Add(timerDrawI);
y1.Add(dBmMain);
x2.Add(timerDrawI);
y2.Add(dBmNeighbour1);
x3.Add(timerDrawI);
y3.Add(dBmNeighbour2);
x4.Add(timerDrawI);
y4.Add(dBmNeighbour3);
timerDrawI = timerDrawI + 1;
}
else if ((timerDrawI > X_End) || (timerDrawI == X_End))
{
timerDrawI = 0;
}
}
/// <summary>
/// 描点定时器启动
/// </summary>
public void TimerStart()
{
timer1.Interval = 300;
timer1.Start();
}
/// <summary>
/// 描点定时器关闭
/// </summary>
public void TimerEnd()
{
timer1.Enabled = false;
}
}
}