292 lines
7.5 KiB
C++
292 lines
7.5 KiB
C++
// AppDataCEIpCurveDlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "geomative.h"
|
|
#include "AppDataCEIpCurveDlg.h"
|
|
#include "AppDataCEIpCurveGraphView.h"
|
|
#include "TdChannel.h"
|
|
|
|
#include "TdRecord.h"
|
|
#include "IpspCETdRecord.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
|
|
BEGIN_EASYSIZE_MAP(CAppDataCEIpCurveDlg)
|
|
|
|
EASYSIZE(IDC_STATIC_CE,ES_BORDER,ES_BORDER,ES_BORDER,ES_KEEPSIZE,0)
|
|
|
|
EASYSIZE(IDC_CE_WINDOW_TIME,ES_BORDER,ES_BORDER,ES_BORDER,IDC_CE_DATA_LIST,0)
|
|
EASYSIZE(IDC_CE_DATA_LIST,ES_BORDER,ES_BORDER,ES_BORDER,ES_BORDER,0)
|
|
EASYSIZE(IDOK, ES_BORDER,IDC_CE_DATA_LIST,ES_KEEPSIZE,ES_BORDER,0)
|
|
EASYSIZE(IDCANCEL, ES_BORDER,IDC_CE_DATA_LIST,ES_BORDER,ES_BORDER,ES_HCENTER)
|
|
EASYSIZE(IDC_MODIFY,ES_KEEPSIZE,IDC_CE_DATA_LIST,ES_BORDER,ES_BORDER,0)
|
|
|
|
END_EASYSIZE_MAP
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CAppDataCEIpCurveDlg dialog
|
|
|
|
|
|
// CAppDataCEIpCurveDlg::CAppDataCEIpCurveDlg(CWnd* pParent /*=NULL*/)
|
|
// : CDialog(CAppDataCEIpCurveDlg::IDD, pParent)
|
|
// {
|
|
// //{{AFX_DATA_INIT(CAppDataCEIpCurveDlg)
|
|
// // NOTE: the ClassWizard will add member initialization here
|
|
// //}}AFX_DATA_INIT
|
|
// }
|
|
|
|
CAppDataCEIpCurveDlg::CAppDataCEIpCurveDlg(CTestingData *const pIpsptd, CWnd* pParent /*=NULL*/)
|
|
: CDialog(CAppDataCEIpCurveDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CAppDataCEIpCurveDlg)
|
|
// NOTE: the ClassWizard will add member initialization here
|
|
//}}AFX_DATA_INIT
|
|
m_pCEtd = pIpsptd;
|
|
m_pGraph = NULL;
|
|
m_dPeriod = 0;
|
|
m_dwCurTSN = 0;
|
|
|
|
}
|
|
|
|
|
|
void CAppDataCEIpCurveDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CAppDataCEIpCurveDlg)
|
|
DDX_Control(pDX, IDC_CE_WINDOW_TIME, m_TimeWindow);
|
|
DDX_Control(pDX, IDC_CE_DATA_LIST, m_DataList);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CAppDataCEIpCurveDlg, CDialog)
|
|
//{{AFX_MSG_MAP(CAppDataCEIpCurveDlg)
|
|
ON_NOTIFY(NM_CLICK, IDC_CE_DATA_LIST, OnClickCeDataList)
|
|
ON_BN_CLICKED(IDC_MODIFY, OnModify)
|
|
ON_WM_SIZE()
|
|
ON_WM_SIZING()
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CAppDataCEIpCurveDlg message handlers
|
|
|
|
BOOL CAppDataCEIpCurveDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
// TODO: Add extra initialization here
|
|
m_DataList.SetExtendedStyle(m_DataList.GetExtendedStyle()|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
|
|
m_TimeWindow.SetExtendedStyle(m_TimeWindow.GetExtendedStyle()|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
|
|
|
|
int ColumnCount = m_DataList.GetHeaderCtrl()->GetItemCount();
|
|
for (int n = 0; n < ColumnCount; n++)
|
|
{
|
|
m_DataList.DeleteColumn(0);
|
|
}
|
|
|
|
m_DataList.InsertColumn(0,"A", 70,72);
|
|
m_DataList.InsertColumn(1,"B", 70,72);
|
|
m_DataList.InsertColumn(2,"M", 70,72);
|
|
m_DataList.InsertColumn(3,"N", 70,72);
|
|
m_DataList.InsertColumn(4,"Iteration", 70,72);
|
|
m_DataList.InsertColumn(5,"K", 70,72);
|
|
m_DataList.InsertColumn(6,"(I(mA", 70,72);
|
|
m_DataList.InsertColumn(7,"(V(mV", 70,72);
|
|
m_DataList.InsertColumn(8,"R0", 70,72);
|
|
m_DataList.InsertColumn(9,"SP", 70,72);
|
|
|
|
m_pCEtd->ShowConList(m_DataList);
|
|
m_dPeriod = m_pCEtd->GetPeriod();
|
|
|
|
|
|
//时窗--------------------
|
|
m_TimeWindow.InsertColumn(0,"Index", 70,72);
|
|
m_TimeWindow.InsertColumn(1,"Start", 70,72);
|
|
m_TimeWindow.InsertColumn(2,"Width", 70,72);
|
|
m_TimeWindow.InsertColumn(3,"(V2(mV", 70,72);
|
|
m_TimeWindow.InsertColumn(4,"(%)ETA ", 70,72);
|
|
m_TimeWindow.InsertColumn(5,"M", 70,72);
|
|
m_TimeWindow.InsertColumn(6,"(V2_1(mV", 70,72);
|
|
m_TimeWindow.InsertColumn(7,"(%)ETA_1 ",70,72);
|
|
m_TimeWindow.InsertColumn(8,"M_1", 70,72);
|
|
m_TimeWindow.InsertColumn(9,"(V2_2(mV", 70,72);
|
|
m_TimeWindow.InsertColumn(10,"(%)ETA_2",70,72);
|
|
m_TimeWindow.InsertColumn(11,"M_2", 70,72);
|
|
|
|
//默认让他显示第一行的图形-----------------------------------------
|
|
if (m_DataList.GetItemCount() != 0)
|
|
{
|
|
DWORD dwTSN = m_DataList.GetItemData(0);
|
|
m_dwCurTSN = dwTSN;
|
|
CTdRecord *m_record;
|
|
m_record = ((CTdChannel*)m_pCEtd->m_tdChaList.GetAt(m_pCEtd->m_tdChaList.FindIndex(0)))->GetTdRecord(dwTSN);
|
|
m_record->LoadOrgData();
|
|
|
|
this->m_saOrgData.RemoveAll();
|
|
this->m_saOrgData.Copy(m_record->m_saVRawData);
|
|
this->m_fMaxAbsV = m_record->GetMaxAbsV();
|
|
|
|
CreateCEIpCurveGraphView();
|
|
|
|
m_pCEtd->ShowTimeWindow(m_TimeWindow, dwTSN);
|
|
|
|
|
|
}
|
|
//默认让他显示第一行的图形-----------------------------------------
|
|
|
|
|
|
|
|
|
|
//初始化窗口自适应控件
|
|
INIT_EASYSIZE;
|
|
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
|
|
void CAppDataCEIpCurveDlg::OnClickCeDataList(NMHDR* pNMHDR, LRESULT* pResult)
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
DWORD dwTSN = (DWORD)VAL_ZERO;
|
|
|
|
POSITION pos = m_DataList.GetFirstSelectedItemPosition();
|
|
if (pos == NULL)
|
|
{
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
while (pos)
|
|
{
|
|
int nItem = m_DataList.GetNextSelectedItem(pos);
|
|
dwTSN = m_DataList.GetItemData(nItem);
|
|
m_dwCurTSN = dwTSN;
|
|
CTdRecord *m_record;
|
|
m_record = ((CTdChannel*)m_pCEtd->m_tdChaList.GetAt(m_pCEtd->m_tdChaList.FindIndex(0)))->GetTdRecord(dwTSN);
|
|
m_record->LoadOrgData();
|
|
|
|
this->m_saOrgData.RemoveAll();
|
|
this->m_saOrgData.Copy(m_record->m_saVRawData);
|
|
this->m_fMaxAbsV = m_record->GetMaxAbsV();
|
|
|
|
CreateCEIpCurveGraphView();
|
|
|
|
// for (int n = 0; n < 3; n++)
|
|
// {//ShowTimeWindow函数中,有异常处理的那段代码有时有问题,不好重现,故暂时用次方法解决
|
|
m_pCEtd->ShowTimeWindow(m_TimeWindow,dwTSN);
|
|
// break;
|
|
// }
|
|
}
|
|
}
|
|
|
|
*pResult = 0;
|
|
}
|
|
|
|
void CAppDataCEIpCurveDlg::CreateCEIpCurveGraphView()
|
|
{
|
|
//创建图像
|
|
if (m_pGraph)
|
|
{
|
|
m_pGraph->DestroyWindow();
|
|
m_pGraph = NULL;
|
|
}
|
|
|
|
CWnd *pStatic = this->GetDlgItem(IDC_STATIC_CE);
|
|
CRect rect;
|
|
pStatic->GetWindowRect(&rect);
|
|
// pStatic->DestroyWindow();
|
|
|
|
this->ScreenToClient(&rect);
|
|
|
|
DWORD dwStyle = AFX_WS_DEFAULT_VIEW;
|
|
|
|
CRuntimeClass* pClass = (CRuntimeClass*)RUNTIME_CLASS(CAppDataCEIpCurveGraphView);
|
|
|
|
m_pGraph = (CAppDataCEIpCurveGraphView*)pClass->CreateObject();
|
|
|
|
m_pGraph->Create(NULL, NULL, dwStyle, rect, this, CAppDataCEIpCurveDlg::IDD);
|
|
|
|
m_pGraph->m_saOrgDataOne.RemoveAll();
|
|
m_pGraph->m_saOrgDataOne.Copy(this->m_saOrgData);
|
|
m_pGraph->m_fMaxAbsV = this->m_fMaxAbsV;
|
|
m_pGraph->m_dPeriodInfo = m_dPeriod;
|
|
GetTimeWindow(m_pGraph->m_vtTimeWin);
|
|
m_pGraph->OnInitialUpdate();
|
|
m_pGraph->EnableWindow(TRUE);
|
|
m_pGraph->ShowWindow(SW_SHOW);
|
|
m_pGraph->Invalidate();
|
|
//创建图像
|
|
|
|
}
|
|
|
|
void CAppDataCEIpCurveDlg::OnOK()
|
|
{
|
|
// TODO: Add extra validation here
|
|
|
|
CDialog::OnOK();
|
|
}
|
|
|
|
void CAppDataCEIpCurveDlg::OnModify()
|
|
{
|
|
CModifyIpCurveDlg *Curve = new CModifyIpCurveDlg(this->m_pCEtd);
|
|
Curve->SetDischargePeriod((int)m_dPeriod/4);
|
|
|
|
if (IDOK == Curve->DoModal())
|
|
{
|
|
CreateCEIpCurveGraphView();
|
|
m_pCEtd->ShowTimeWindow(m_TimeWindow, m_dwCurTSN);
|
|
}
|
|
|
|
|
|
delete Curve;
|
|
}
|
|
|
|
BOOL CAppDataCEIpCurveDlg::PreTranslateMessage(MSG* pMsg)
|
|
{
|
|
// TODO: Add your specialized code here and/or call the base class
|
|
|
|
if(pMsg->message==WM_KEYDOWN && pMsg->wParam==VK_RETURN)
|
|
{
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
return CDialog::PreTranslateMessage(pMsg);
|
|
}
|
|
|
|
void CAppDataCEIpCurveDlg::OnSize(UINT nType, int cx, int cy)
|
|
{
|
|
CDialog::OnSize(nType, cx, cy);
|
|
|
|
UPDATE_EASYSIZE;
|
|
|
|
if (m_pGraph)
|
|
{
|
|
CreateCEIpCurveGraphView();
|
|
}
|
|
|
|
// TODO: Add your message handler code here
|
|
}
|
|
|
|
void CAppDataCEIpCurveDlg::OnSizing(UINT fwSide, LPRECT pRect)
|
|
{
|
|
CDialog::OnSizing(fwSide, pRect);
|
|
|
|
// TODO: Add your message handler code here
|
|
|
|
}
|
|
|
|
void CAppDataCEIpCurveDlg::GetTimeWindow(std::vector<STSigTWInfo>& vtTWInfo)
|
|
{
|
|
vtTWInfo.clear();
|
|
m_pCEtd->GetTimeWindowInfo(vtTWInfo);
|
|
}
|