#include "MyApp.h"
#include "MainFrame.h"
#include <regex>
#include "Calculate.h"
using namespace std;
//画时域波形
void MainFrame::draw_time_domain(wxDC* dc) {
int w=0, h=0;
//获得面板大小
this->imagePanel->GetSize(&w, &h);
//画信号一x轴
dc->DrawLine(wxPoint(0.03*w, h*0.3), wxPoint(0.98*w, h*0.3));
//画信号一x轴箭头
dc->DrawLine(wxPoint(0.98*w, h*0.3), wxPoint(0.98*w - 8, h*0.3 + 8));
dc->DrawLine(wxPoint(0.98*w, h*0.3), wxPoint(0.98*w - 8, h*0.3 - 8));
//画信号一x轴标注
dc->DrawText(_T("t"), wxPoint(0.95*w, h*0.3 + 30));
//画信号一y轴
dc->DrawLine(wxPoint(0.05*w, h*0.1), wxPoint(0.05*w, h*0.5));
//画信号一轴箭头
dc->DrawLine(wxPoint(0.05*w, h*0.1), wxPoint(0.05*w - 8, h*0.1 + 8));
dc->DrawLine(wxPoint(0.05*w, h*0.1), wxPoint(0.05*w + 8, h*0.1 + 8));
//画信号一轴标注
dc->DrawText(_T("signal"), wxPoint(0.05*w + 8, h*0.1 - 8));
dc->SetPen(*wxBLACK_PEN);
//画信号二x轴
dc->DrawLine(wxPoint(0.03*w, h*0.8), wxPoint(0.98*w, h*0.8));
//画信号二x轴箭头
dc->DrawLine(wxPoint(0.98*w, h*0.8), wxPoint(0.98*w - 8, h*0.8 + 8));
dc->DrawLine(wxPoint(0.98*w, h*0.8), wxPoint(0.98*w - 8, h*0.8 - 8));
//画信号二x轴标注
dc->DrawText(_T("t"), wxPoint(0.95*w, h*0.8 + 30));
//画信号二y轴
dc->DrawLine(wxPoint(0.05*w, h*0.6), wxPoint(0.05*w, h));
//画信号二轴箭头
dc->DrawLine(wxPoint(0.05*w, h*0.6), wxPoint(0.05*w - 8, h*0.6 + 8));
dc->DrawLine(wxPoint(0.05*w, h*0.6), wxPoint(0.05*w + 8, h*0.6 + 8));
//画信号二轴标注
dc->DrawText(_T("signal"), wxPoint(0.05*w + 8, h*0.6 - 8));
//画信号一
if (isUseSignal1->GetValue()) {
wxString type = signal_1_choice->GetValue();
std::regex r("([1-9]+[0-9]*|0)(\\.[\\d]+)?");
std::regex r_i("^[10]*$");
if (type.Contains(_T("BOC"))) {
string signal = string(signal_1_in_signal_input->GetValue().mb_str());
string fs = string(signal_1_in_fs_input->GetValue().mb_str());
string fc = string(signal_1_in_fc_input->GetValue().mb_str());
if (regex_match(signal, r_i) && regex_match(fs, r) && regex_match(fc, r)) {
dc->DrawText(_T("信号一:BOC"), wxPoint(5, 5));
int signal_len = signal.length();
int element_len = 0.9*w / signal.length();
int n = 2 * Calculate::stringToNum<double>(fs) / Calculate::stringToNum<double>(fc);
int v_len = element_len / n;
dc->SetPen(*wxBLACK_DASHED_PEN);
for (int signal_inex = 0; signal_inex < signal_len; signal_inex++) {
for (int i = 1; i <= n; i++) {
dc->DrawLine(wxPoint(0.05*w + i*v_len + element_len*signal_inex, h*0.1), wxPoint(0.05*w + i*v_len + element_len*signal_inex, h*0.5));
}
}
dc->SetPen(*wxRED_PEN);
for (int signal_inex = 0; signal_inex < signal_len; signal_inex++) {
if (signal[signal_inex] == '0') {
for (int i = 0; i < n; i++) {
dc->DrawLine(wxPoint(0.05*w + i*v_len + element_len*signal_inex, i % 2 == 0 ? h*0.45 : h*0.15), wxPoint(0.05*w + (i + 1)*v_len + element_len*signal_inex, i % 2 == 0 ? h*0.45 : h*0.15));
}
}
else{
for (int i = 0; i < n; i++) {
dc->DrawLine(wxPoint(0.05*w + i*v_len + element_len*signal_inex, i % 2 == 0 ? h*0.15 : h*0.45), wxPoint(0.05*w + (i + 1)*v_len + element_len*signal_inex, i % 2 == 0 ? h*0.15 : h*0.45));
}
}
}
}
else{
dc->DrawText(_T("输入错误"), wxPoint(5, 5));
}
}
else if (type.Contains(_T("BPSK"))) {
string signal = string(signal_1_in_signal_input->GetValue().mb_str());
if (regex_match(signal, r_i)) {
dc->DrawText(_T("信号一:BPSK"), wxPoint(5, 5));
int signal_len = signal.length();
int element_len = 0.9*w / signal.length();
dc->SetPen(*wxBLACK_DASHED_PEN);
for (int signal_inex = 1; signal_inex <= signal_len; signal_inex++) {
dc->DrawLine(wxPoint(0.05*w + element_len*signal_inex, h*0.1), wxPoint(0.05*w + element_len*signal_inex, h*0.5));
}
dc->SetPen(*wxRED_PEN);
for (int signal_inex = 1; signal_inex <= signal_len; signal_inex++) {
int i_x_o = (signal_inex - 1)*element_len+0.05*w, i_y_o = 0.3*h, x = 0, y = 0;
if (signal[signal_inex-1] == '0') {
for (x = i_x_o; x < signal_inex*element_len + 0.05*w; x++) {
y = 0.3*h + sin((x - (signal_inex - 1)*element_len - 0.05*w) * 2 * PI / element_len)*0.15*h;
dc->DrawLine(wxPoint(i_x_o, i_y_o), wxPoint(x, y));
i_x_o = x;
i_y_o = y;
}
}
else {
for (x = i_x_o; x < signal_inex*element_len + 0.05*w; x++) {
y = 0.3*h - sin((x - (signal_inex - 1)*element_len - 0.05*w) * 2 * PI / element_len)*0.15*h;
dc->DrawLine(wxPoint(i_x_o, i_y_o), wxPoint(x, y));
i_x_o = x;
i_y_o = y;
}
}
}
}
else{
dc->DrawText(_T("输入错误"), wxPoint(5, 5));
}
}
else{
dc->DrawText(_T("未选择信号类型"), wxPoint(5, 5));
}
}
//画信号二
if (isUseSignal1->GetValue()) {
wxString type = signal_2_choice->GetValue();
std::regex r("([1-9]+[0-9]*|0)(\\.[\\d]+)?");
std::regex r_i("^[10]*$");
if (type.Contains(_T("BOC"))) {
string signal = string(signal_2_in_signal_input->GetValue().mb_str());
string fs = string(signal_2_in_fs_input->GetValue().mb_str());
string fc = string(signal_2_in_fc_input->GetValue().mb_str());
if (regex_match(signal, r_i) && regex_match(fs, r) && regex_match(fc, r)) {
dc->DrawText(_T("信号二:BOC"), wxPoint(5, h*0.5 + 5));
int signal_len = signal.length();
int element_len = 0.9*w / signal.length();
int n = 2 * Calculate::stringToNum<double>(fs) / Calculate::stringToNum<double>(fc);
int v_len = element_len / n;
dc->SetPen(*wxBLACK_DASHED_PEN);
for (int signal_inex = 0; signal_inex < signal_len; signal_inex++) {
for (int i = 1; i <= n; i++) {
dc->DrawLine(wxPoint(0.05*w + i*v_len + element_len*signal_inex, h*0.1 + h*0.5), wxPoint(0.05*w + i*v_len + element_len*signal_inex, h*0.5 + h*0.5));
}
}
dc->SetPen(*wxRED_PEN);
for (int signal_inex = 0; signal_inex < signal_len; signal_inex++) {
if (signal[signal_inex] == '0') {
for (int i = 0; i < n; i++) {
dc->DrawLine(wxPoint(0.05*w + i*v_len + element_len*signal_inex, h*0.5 + (i % 2 == 0 ? h*0.45 : h*0.15)), wxPoint(0.05*w + (i + 1)*v_len + element_len*signal_inex, h*0.5 + (i % 2 == 0 ? h*0.45 : h*0.15)));
}
}
else {
for (int i = 0; i < n; i++) {
dc->DrawLine(wxPoint(0.05*w + i*v_len + element_len*signal_inex, h*0.5 + (i % 2 == 0 ? h*0.15 : h*0.45)), wxPoint(0.05*w + (i + 1)*v_len + element_len*signal_inex, h*0.5 + (i % 2 == 0 ? h*0.15 : h*0.45)));
}
}
}
}
else {
dc->DrawText(_T("输入错误"), wxPoint(5, h*0.5 + 5));
}
}
else if (type.Contains(_T("BPSK"))) {
string signal = string(signal_2_in_signal_input->GetValue().mb_str());
if (regex_match(signal, r_i)) {
dc->DrawText(_T("信号二:BPSK"), wxPoint(5, h*0.5 + 5));
int signal_len = signal.length();
int element_len = 0.9*w / signal.length();
dc->SetPen(*wxBLACK_DASHED_PEN);
for (int signal_inex = 1; signal_inex <= signal_len; signal_inex++) {
dc->DrawLine(wxPoint(0.05*w + element_len*signal_inex, h*0.5 + h*0.1), wxPoint(0.05*w + element_len*signal_inex, h*0.5 + h*0.5));
}
dc->SetPen(*wxRED_PEN);
for (int signal_inex = 1; signal_inex <= signal_len; signal_inex++) {
int i_x_o = (signal_inex - 1)*element_len + 0.05*w, i_y_o = h*0.5 + 0.3*h, x = 0, y = 0;
if (signal[signal_inex - 1] == '0') {
for (x = i_x_o; x < signal_inex*element_len + 0.05*w; x++) {
y = h*0.5 + 0.3*h + sin((x - (signal_inex - 1)*element_len - 0.05*w) * 2 * PI / element_len)*0.15*h;
dc->DrawLine(wxPoint(i_x_o, i_y_o), wxPoint(x, y));
i_x_o = x;
i_y_o = y;
}
}
else {
for (x = i_x_o; x < signal_inex*element_len + 0.05*w; x++) {
y = h*0.5 + 0.3*h - sin((x - (signal_inex - 1)*element_len - 0.05*w) * 2 * PI / element_len)*0.15*h;
dc->DrawLine(wxPoint(i_x_o, i_y_o), wxPoint(x, y));
i_x_o = x;
i_y_o = y;
}
}
}
}
else {
dc->DrawText(_T("输入错误"),
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
项目工程资源经过严格测试可直接运行成功且功能正常的情况才上传,可轻松复刻,拿到资料包后可轻松复现出一样的项目,本人系统开发经验充足(全领域),有任何使用问题欢迎随时与我联系,我会及时为您解惑,提供帮助。 【资源内容】:包含完整源码+工程文件+说明(如有)等。答辩评审平均分达到96分,放心下载使用!可轻松复现,设计报告也可借鉴此项目,该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的。 【提供帮助】:有任何使用问题欢迎随时与我联系,我会及时解答解惑,提供帮助 【附带帮助】:若还需要相关开发工具、学习资料等,我会提供帮助,提供资料,鼓励学习进步 【项目价值】:可用在相关项目设计中,皆可应用在项目、毕业设计、课程设计、期末/期中/大作业、工程实训、大创等学科竞赛比赛、初期项目立项、学习/练手等方面,可借鉴此优质项目实现复刻,设计报告也可借鉴此项目,也可基于此项目来扩展开发出更多功能 下载后请首先打开README文件(如有),项目工程可直接复现复刻,如果基础还行,也可在此程序基础上进行修改,以实现其它功能。供开源学习/技术交流/学习参考,勿用于商业用途。质量优质,放心下载使用。
资源推荐
资源详情
资源评论
收起资源包目录
软件课程设计--GNSS信号BPSK、BOC调制性能仿真分析.zip (65个子文件)
DSqrs942240909
GNSS_mod.VC.db 69.07MB
GNSS_mod.sln 1KB
Release
image.png 15KB
GNSS_mod.exe 3.65MB
GNSS_mod.iobj 3.13MB
T@L]AW_AD)~__QYHN`{CYGC.png 25KB
GNSS_mod.pdb 22.32MB
BTBK1YPQES3O)`S_L]LPQ_B.png 132KB
data.csv 865B
LB~QXQA$(0L2LQCGWTC20_8.png 28KB
GNSS_mod.ipdb 702KB
GNSS_mod
image.png 7KB
Calculate.cpp 14KB
GUI.cpp 523B
GNSS_mod.vcxproj.filters 2KB
MainFrame.h 7KB
MyApp.h 409B
GNSS_mod.vcxproj 9KB
Draw.cpp 58KB
Release
SaveImage.obj 5.1MB
GNSS_mod.log 823B
TableFrame.obj 5.33MB
Calculate.obj 962KB
Draw.obj 6.1MB
GUI.obj 5.11MB
FrameEvent.obj 6.24MB
MainFrame.obj 5.22MB
vc140.pdb 3.2MB
GNSS_mod.tlog
CL.write.1.tlog 8KB
GNSS_mod.lastbuildstate 224B
CL.command.1.tlog 5KB
link.command.1.tlog 3KB
link.read.1.tlog 8KB
link.write.1.tlog 1KB
CL.read.1.tlog 381KB
SaveImage.cpp 904B
FrameEvent.cpp 27KB
TableFrame.h 382B
data.csv 865B
TableFrame.cpp 10KB
Calculate.h 7KB
Debug
imagePanel.obj 2.98MB
SaveImage.obj 2.87MB
GNSS_mod.log 610B
TableFrame.obj 3.44MB
Calculate.obj 399KB
vc140.idb 1.77MB
Draw.obj 4.62MB
GUI.obj 2.87MB
FrameEvent.obj 4.71MB
MainFrame.obj 3.42MB
vc140.pdb 2.89MB
GNSS_mod.tlog
CL.write.1.tlog 18KB
GNSS_mod.lastbuildstate 222B
CL.command.1.tlog 7KB
link.command.1.tlog 5KB
link.read.1.tlog 8KB
link.write.1.tlog 1KB
CL.read.1.tlog 437KB
MainFrame.cpp 23KB
Debug
image.png 11KB
GNSS_mod.exe 7.24MB
GNSS_mod.ilk 22.24MB
GNSS_mod.pdb 16.67MB
data.csv 865B
共 65 条
- 1
资源评论
热爱技术。
- 粉丝: 2535
- 资源: 7861
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功