📄 atmeasureview.cpp
字号:
if((NumCtrl++)==0)
return;
while(!m_pSet->IsEOF())
{
m_pSet->MoveNext();
CString cs;
cs=m_pSet->m_time.Format("%H");
HH=atoi(cs);
cs=m_pSet->m_time.Format("%M");
MM=atoi(cs);
cs=m_pSet->m_time.Format("%S");
SS=atoi(cs);
if(!m_pSet->IsEOF())
{
CenterPoint.x=LeftTop.x+((HH-tem3)*3600+MM*60+SS)*24*24/((tem4-tem3)*3600);
CenterPoint.y=LeftBottom.y-(m_pSet->m_temp-tem1)*(LeftBottom.y-LeftTop.y)/(tem2-tem1);
dc.LineTo(CenterPoint.x,CenterPoint.y);
}
}
m_pSet->Close();
////////////////////////////////////////////第四条///////////
if(m_pSet->IsOpen())
m_pSet->Close();
d.Format("select * from [测量值] where time between #%s 00:00:00# and #%s 23:59:59# and channel=%d and point=%d ",m_Time,m_Time,chl2,pt2);
m_pSet->Open(AFX_DB_USE_DEFAULT_TYPE,d);
if(m_pSet->GetRecordCount()==0)
return;
CPen cpen6(PS_SOLID,1,RGB(0,0,0));
dc.SelectObject(&cpen6);
m_pSet->MoveFirst();
cs=m_pSet->m_time.Format("%H");
HH=atoi(cs);
cs=m_pSet->m_time.Format("%M");
MM=atoi(cs);
cs=m_pSet->m_time.Format("%S");
SS=atoi(cs);
//////////////////////////////////////////////////////////////////
CenterPoint.x=LeftTop.x+((HH-tem3)*3600+MM*60+SS)*24*24/((tem4-tem3)*3600);
CenterPoint.y=LeftBottom.y-(m_pSet->m_temp-tem1)*(LeftBottom.y-LeftTop.y)/(tem2-tem1);
dc.MoveTo(CenterPoint.x,CenterPoint.y);
if((NumCtrl++)==0)
return;
while(!m_pSet->IsEOF())
{
m_pSet->MoveNext();
CString cs;
cs=m_pSet->m_time.Format("%H");
HH=atoi(cs);
cs=m_pSet->m_time.Format("%M");
MM=atoi(cs);
cs=m_pSet->m_time.Format("%S");
SS=atoi(cs);
if(!m_pSet->IsEOF())
{
CenterPoint.x=LeftTop.x+((HH-tem3)*3600+MM*60+SS)*24*24/((tem4-tem3)*3600);
CenterPoint.y=LeftBottom.y-(m_pSet->m_temp-tem1)*(LeftBottom.y-LeftTop.y)/(tem2-tem1);
dc.LineTo(CenterPoint.x,CenterPoint.y);
}
}
m_pSet->Close();
///////////////////////第五条////////////////////////
if(m_pSet->IsOpen())
m_pSet->Close();
e.Format("select * from [测量值] where time between #%s 00:00:00# and #%s 23:59:59# and channel=%d and point=%d ",m_Time,m_Time,chl3,pt3);
m_pSet->Open(AFX_DB_USE_DEFAULT_TYPE,e);
if(m_pSet->GetRecordCount()==0)
return;
CPen cpen7(PS_SOLID,1,RGB(255,55,0));
dc.SelectObject(&cpen7);
m_pSet->MoveFirst();
cs=m_pSet->m_time.Format("%H");
HH=atoi(cs);
cs=m_pSet->m_time.Format("%M");
MM=atoi(cs);
cs=m_pSet->m_time.Format("%S");
SS=atoi(cs);
//////////////////////////////////////////////////////////////////
CenterPoint.x=LeftTop.x+((HH-tem3)*3600+MM*60+SS)*24*24/((tem4-tem3)*3600);
CenterPoint.y=LeftBottom.y-(m_pSet->m_temp-tem1)*(LeftBottom.y-LeftTop.y)/(tem2-tem1);
dc.MoveTo(CenterPoint.x,CenterPoint.y);
if((NumCtrl++)==0)
return;
while(!m_pSet->IsEOF())
{
m_pSet->MoveNext();
CString cs;
cs=m_pSet->m_time.Format("%H");
HH=atoi(cs);
cs=m_pSet->m_time.Format("%M");
MM=atoi(cs);
cs=m_pSet->m_time.Format("%S");
SS=atoi(cs);
if(!m_pSet->IsEOF())
{
CenterPoint.x=LeftTop.x+((HH-tem3)*3600+MM*60+SS)*24*24/((tem4-tem3)*3600);
CenterPoint.y=LeftBottom.y-(m_pSet->m_temp-tem1)*(LeftBottom.y-LeftTop.y)/(tem2-tem1);
dc.LineTo(CenterPoint.x,CenterPoint.y);
}
}
m_pSet->Close();
}
// case 1:
if(flag1==1)
// GetDlgItem(IDC_temp)->ShowWindow(SW_HIDE);
// GetDlgItem(IDC_CHANGE)->ShowWindow(SW_SHOW);
// GetDlgItem(IDC_temp)->ShowWindow(SW_HIDE);
// GetDlgItem(IDC_CHANGE)->ShowWindow(SW_SHOW);
// GetDlgItem(IDC_preasure)->ShowWindow(SW_HIDE);
{
if(m_pSet->IsOpen())
m_pSet->Close();
CString a,b,c,d,e;
// sql.Format("SELECT * FROM [测量值]");
// sql.Format("select * from [测量值] where time between #%s 00:00:00# and #%s 23:59:59# and channel=%d and point=%d order by time",m_Time,m_Time,chl,pt);
//////////////////////////////画第一条线/////////////////
a.Format("select * from [测量值] where time between #%s 00:00:00# and #%s 23:59:59# and channel=%d and point=%d",m_Time,m_Time,chl,pt);
m_pSet->Open(AFX_DB_USE_DEFAULT_TYPE,a);
if(m_pSet->GetRecordCount()==0)
return;
CPen cpen2(PS_SOLID,1,RGB(164,55,232));
dc.SelectObject(&cpen2);
m_pSet->MoveFirst();
//////////////////////////////////////////////////////
int HH,MM,SS;
CString cs;
cs=m_pSet->m_time.Format("%H");
HH=atoi(cs);
cs=m_pSet->m_time.Format("%M");
MM=atoi(cs);
cs=m_pSet->m_time.Format("%S");
SS=atoi(cs);
int tem11 = atoi((LPCTSTR)m_tem1);
int tem22 = atoi((LPCTSTR)m_tem2);
int tem1=tem11*10;
int tem2=tem22*10;
CenterPoint.x=LeftTop.x+((HH-tem3)*3600+MM*60+SS)*24*24/((tem4-tem3)*3600);
CenterPoint.y=LeftBottom.y-(m_pSet->m_change-tem1)*(LeftBottom.y-LeftTop.y)/(tem2-tem1);
dc.MoveTo(CenterPoint.x,CenterPoint.y);
if((NumCtrl++)==0)
return;
while(!m_pSet->IsEOF())
{
m_pSet->MoveNext();
CString cs;
cs=m_pSet->m_time.Format("%H");
HH=atoi(cs);
cs=m_pSet->m_time.Format("%M");
MM=atoi(cs);
cs=m_pSet->m_time.Format("%S");
SS=atoi(cs);
if(!m_pSet->IsEOF())
{
CenterPoint.x=LeftTop.x+((HH-tem3)*3600+MM*60+SS)*24*24/((tem4-tem3)*3600);
CenterPoint.y=LeftBottom.y-(m_pSet->m_change-tem1)*(LeftBottom.y-LeftTop.y)/(tem2-tem1);
dc.LineTo(CenterPoint.x,CenterPoint.y);
}
}
m_pSet->Close();
/////////////////////画第二条线//////////////
if(m_pSet->IsOpen())
m_pSet->Close();
b.Format("select * from [测量值] where time between #%s 00:00:00# and #%s 23:59:59# and channel=%d and point=%d ",m_Time,m_Time,chl0,pt0);
m_pSet->Open(AFX_DB_USE_DEFAULT_TYPE,b);
CPen cpen4(PS_SOLID,1,RGB(164,55,100));
dc.SelectObject(&cpen4);
m_pSet->MoveFirst();
cs=m_pSet->m_time.Format("%H");
HH=atoi(cs);
cs=m_pSet->m_time.Format("%M");
MM=atoi(cs);
cs=m_pSet->m_time.Format("%S");
SS=atoi(cs);
////////////////////////////////////////////////////////
CenterPoint.x=LeftTop.x+((HH-tem3)*3600+MM*60+SS)*24*24/((tem4-tem3)*3600);
CenterPoint.y=LeftBottom.y-(m_pSet->m_change-tem1)*(LeftBottom.y-LeftTop.y)/(tem2-tem1);
dc.MoveTo(CenterPoint.x,CenterPoint.y);
if((NumCtrl++)==0)
return;
while(!m_pSet->IsEOF())
{
m_pSet->MoveNext();
CString cs;
cs=m_pSet->m_time.Format("%H");
HH=atoi(cs);
cs=m_pSet->m_time.Format("%M");
MM=atoi(cs);
cs=m_pSet->m_time.Format("%S");
SS=atoi(cs);
if(!m_pSet->IsEOF())
{
CenterPoint.x=LeftTop.x+((HH-tem3)*3600+MM*60+SS)*24*24/((tem4-tem3)*3600);
CenterPoint.y=LeftBottom.y-(m_pSet->m_change-tem1)*(LeftBottom.y-LeftTop.y)/(tem2-tem1);
dc.LineTo(CenterPoint.x,CenterPoint.y);
}
}
m_pSet->Close();
///////////////////////////画第三条线////////////////////
if(m_pSet->IsOpen())
m_pSet->Close();
c.Format("select * from [测量值] where time between #%s 00:00:00# and #%s 23:59:59# and channel=%d and point=%d ",m_Time,m_Time,chl1,pt1);
m_pSet->Open(AFX_DB_USE_DEFAULT_TYPE,c);
CPen cpen5(PS_SOLID,1,RGB(0,55,100));
dc.SelectObject(&cpen5);
m_pSet->MoveFirst();
cs=m_pSet->m_time.Format("%H");
HH=atoi(cs);
cs=m_pSet->m_time.Format("%M");
MM=atoi(cs);
cs=m_pSet->m_time.Format("%S");
SS=atoi(cs);
//////////////////////////////////////////////////////////////////
CenterPoint.x=LeftTop.x+((HH-tem3)*3600+MM*60+SS)*24*24/((tem4-tem3)*3600);
CenterPoint.y=LeftBottom.y-(m_pSet->m_change-tem1)*(LeftBottom.y-LeftTop.y)/(tem2-tem1);
dc.MoveTo(CenterPoint.x,CenterPoint.y);
if((NumCtrl++)==0)
return;
while(!m_pSet->IsEOF())
{
m_pSet->MoveNext();
CString cs;
cs=m_pSet->m_time.Format("%H");
HH=atoi(cs);
cs=m_pSet->m_time.Format("%M");
MM=atoi(cs);
cs=m_pSet->m_time.Format("%S");
SS=atoi(cs);
if(!m_pSet->IsEOF())
{
CenterPoint.x=LeftTop.x+((HH-tem3)*3600+MM*60+SS)*24*24/((tem4-tem3)*3600);
CenterPoint.y=LeftBottom.y-(m_pSet->m_change-tem1)*(LeftBottom.y-LeftTop.y)/(tem2-tem1);
dc.LineTo(CenterPoint.x,CenterPoint.y);
}
}
m_pSet->Close();
////////////////////////////////////////////第四条///////////
if(m_pSet->IsOpen())
m_pSet->Close();
d.Format("select * from [测量值] where time between #%s 00:00:00# and #%s 23:59:59# and channel=%d and point=%d ",m_Time,m_Time,chl2,pt2);
m_pSet->Open(AFX_DB_USE_DEFAULT_TYPE,d);
CPen cpen6(PS_SOLID,1,RGB(255,0,100));
dc.SelectObject(&cpen6);
m_pSet->MoveFirst();
cs=m_pSet->m_time.Format("%H");
HH=atoi(cs);
cs=m_pSet->m_time.Format("%M");
MM=atoi(cs);
cs=m_pSet->m_time.Format("%S");
SS=atoi(cs);
//////////////////////////////////////////////////////////////////
CenterPoint.x=LeftTop.x+((HH-tem3)*3600+MM*60+SS)*24*24/((tem4-tem3)*3600);
CenterPoint.y=LeftBottom.y-(m_pSet->m_change-tem1)*(LeftBottom.y-LeftTop.y)/(tem2-tem1);
dc.MoveTo(CenterPoint.x,CenterPoint.y);
if((NumCtrl++)==0)
return;
while(!m_pSet->IsEOF())
{
m_pSet->MoveNext();
CString cs;
cs=m_pSet->m_time.Format("%H");
HH=atoi(cs);
cs=m_pSet->m_time.Format("%M");
MM=atoi(cs);
cs=m_pSet->m_time.Format("%S");
SS=atoi(cs);
if(!m_pSet->IsEOF())
{
CenterPoint.x=LeftTop.x+((HH-tem3)*3600+MM*60+SS)*24*24/((tem4-tem3)*3600);
CenterPoint.y=LeftBottom.y-(m_pSet->m_change-tem1)*(LeftBottom.y-LeftTop.y)/(tem2-tem1);
dc.LineTo(CenterPoint.x,CenterPoint.y);
}
}
m_pSet->Close();
///////////////////////第五条////////////////////////
if(m_pSet->IsOpen())
m_pSet->Close();
e.Format("select * from [测量值] where time between #%s 00:00:00# and #%s 23:59:59# and channel=%d and point=%d ",m_Time,m_Time,chl3,pt3);
m_pSet->Open(AFX_DB_USE_DEFAULT_TYPE,e);
CPen cpen7(PS_SOLID,1,RGB(255,55,0));
dc.SelectObject(&cpen7);
m_pSet->MoveFirst();
cs=m_pSet->m_time.Format("%H");
HH=atoi(cs);
cs=m_pSet->m_time.Format("%M");
MM=atoi(cs);
cs=m_pSet->m_time.Format("%S");
SS=atoi(cs);
//////////////////////////////////////////////////////////////////
CenterPoint.x=LeftTop.x+((HH-tem3)*3600+MM*60+SS)*24*24/((tem4-tem3)*3600);
CenterPoint.y=LeftBottom.y-(m_pSet->m_change-tem1)*(LeftBottom.y-LeftTop.y)/(tem2-tem1);
dc.MoveTo(CenterPoint.x,CenterPoint.y);
if((NumCtrl++)==0)
return;
while(!m_pSet->IsEOF())
{
m_pSet->MoveNext();
CString cs;
cs=m_pSet->m_time.Format("%H");
HH=atoi(cs);
cs=m_pSet->m_time.Format("%M");
MM=atoi(cs);
cs=m_pSet->m_time.Format("%S");
SS=atoi(cs);
if(!m_pSet->IsEOF())
{
CenterPoint.x=LeftTop.x+((HH-tem3)*3600+MM*60+SS)*24*24/((tem4-tem3)*3600);
CenterPoint.y=LeftBottom.y-(m_pSet->m_change-tem1)*(LeftBottom.y-LeftTop.y)/(tem2-tem1);
dc.LineTo(CenterPoint.x,CenterPoint.y);
}
}
m_pSet->Close();
}
}
void CAtmeasureView::OnOk()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_PointRoadCtrl.GetLBText(m_PointRoadCtrl.GetCurSel(),m_PointRoad);
m_PointNameCtrl.GetLBText(m_PointNameCtrl.GetCurSel(),m_PointData);
m_PointRoadCtrl0.GetLBText(m_PointRoadCtrl0.GetCurSel(),m_PointRoad0);
m_PointNameCtrl0.GetLBText(m_PointNameCtrl0.GetCurSel(),m_PointData0);
m_PointRoadCtrl1.GetLBText(m_PointRoadCtrl1.GetCurSel(),m_PointRoad1);
m_PointNameCtrl1.GetLBText(m_PointNameCtrl1.GetCurSel(),m_PointData1);
m_PointRoadCtrl2.GetLBText(m_PointRoadCtrl2.GetCurSel(),m_PointRoad2);
m_PointNameCtrl2.GetLBText(m_PointNameCtrl2.GetCurSel(),m_PointData2);
m_PointRoadCtrl3.GetLBText(m_PointRoadCtrl3.GetCurSel(),m_PointRoad3);
m_PointNameCtrl3.GetLBText(m_PointNameCtrl3.GetCurSel(),m_PointData3);
m_TimeData.GetCurrentTime();
m_TimeChoose.GetTime(m_TimeData);
m_Time=m_TimeData.Format("%Y-%m-%d");
AfxMessageBox(m_Time);
//画出搜索的数据库
long chl,pt,chl0,pt0,chl1,pt1,chl2,pt2,chl3,pt3;
chl = atol(m_PointRoad);
pt=atol(m_PointData);
chl0 = atol(m_PointRoad0);
pt0=atol(m_PointData0);
chl1 = atol(m_PointRoad1);
pt1=atol(m_PointData1);
chl2 = atol(m_PointRoad2);
pt2=atol(m_PointData2);
chl3 = atol(m_PointRoad3);
pt3=atol(m_PointData3);
CString s;
// s.Format("select * from [测量值] where time between #%s 00:00:00# and #%s 23:59:59# and (channel=%d and point=%d or channel=%d and point=%d or channel=%d and point=%d or channel=%d and point=%d or channel=%d and point=%d) order by time",m_Time,m_Time,chl,pt,chl0,pt0,chl1,pt1,chl2,pt2,chl3,pt3);
// s.Format("select * from [测量值] where time between #%s 00:00:00# and #%s 23:59:59# and channel=%d and point=%d or channel=%d and point=%d or channel=%d and point=%d or channel=%d and point=%d or channel=%d and point=%d order by time",m_Time,m_Time,chl,pt,chl0,pt0,chl1,pt1,chl2,pt2,chl3,pt3);
// s.Format("select * from [测量值] where time between #%s 00:00:00# and #%s 23:59:59# and channel=%d and point=%d order by time",m_Time,m_Time,chl,pt);
//记录打开判断一下是否有记录,没有记录的情况下,不能MOVE记录
if(m_pSet->IsOpen())
m_pSet->Close();
m_ListCtrl.DeleteAllItems();
// m_pSet->Open(AFX_DB_USE_DEFAULT_TYPE,s);
s.Format("select * from [测量值] where time between #%s 00:00:00# and #%s 23:59:59# and (channel=%d and point=%d or channel=%d and point=%d or channel=%d and point=%d or channel=%d and point=%d or channel=%d and point=%d) order by channel,point",m_Time,m_Time,chl,pt,chl0,pt0,chl1,pt1,chl2,pt2,chl3,pt3);
m_pSet->Open(AFX_DB_USE_DEFAULT_TYPE,s);
if(m_pSet->IsBOF())
{
AfxMessageBox(_T("没有找到任何记录"));
return ;
}
InvalidateRect(NULL,TRUE);
this->show();
UpdateData(FALSE);
}
void CAtmeasureView::OnDraw()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_Tem1Ctrl.GetLBText(m_Tem1Ctrl.GetCurSel(),m_tem1);
m_Tem2Ctrl.GetLBText(m_Tem2Ctrl.GetCurSel(),m_tem2);
m_Tem3Ctrl.GetLBText(m_Tem3Ctrl.GetCurSel(),m_tem3);
m_Tem4Ctrl.GetLBText(m_Tem4Ctrl.GetCurSel(),m_tem4);
int tem1 = atoi((LPCTSTR)m_tem1);
int tem2 = atoi((LPCTSTR)m_tem2);
int tem3 = atoi((CString)m_tem3);
int tem4 = atoi((CString)m_tem4);
// if(m_Tem3Ctrl.GetLBText(m_Tem3Ctrl.GetCurSel(),m_tem3)<=m_Tem4Ctrl.GetLBText(m_Tem4Ctrl.GetCurSel(),m_tem4))
if(tem4<=tem3)
{
AfxMessageBox(_T("时间段选择错误,请重新设定时间"));
return;
}
if(tem2<=tem1)
{
AfxMessageBox(_T("温度段选择错误,请重新设定温度"));
return;
}
m_pSet->Close();
// GetDlgItem(IDC_temp)->ShowWindow(SW_HIDE);
// GetDlgItem(IDC_CHANGE)->ShowWindow(SW_SHOW);
m_PointRoadCtrl.GetLBText(m_PointRoadCtrl.GetCurSel(),m_PointRoad);
m_PointNameCtrl.GetLBText(m_PointNameCtrl.GetCurSel(),m_PointData);
long chl,pt;
chl = atol(m_PointRoad);
pt=atol(m_PointData);
CString flag;
int flag1;
CSysSet *ws;
ws=new CSysSet;
flag.Format("select * from [参数初始化] where channel_id=%d and point_id=%d",chl,pt);
ws->Open(AFX_DB_USE_DEFAULT_TYPE,flag);
flag1=ws->m_flag;
if(flag1==0)
{
GetDlgItem(IDC_temp)->ShowWindow(SW_SHOW);
GetDlgItem(IDC_CHANGE)->ShowWindow(SW_HIDE);
}
if(flag1==1)
{
GetDlgItem(IDC_temp)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_CHANGE)->ShowWindow(SW_SHOW);
}
ws->Close();
InvalidateRect(NULL,TRUE);//d调用onpaint函数
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -