📄 gpsscview.cpp
字号:
// OnHScroll(SB_LINERIGHT, 0 ,NULL); //响应RIGHT键
m_nVMove=0;
}
}
m_pRBDownPoint = point;
}
/*************Set status prompt*************/
void CGpsSCView::StatusPrompt(CString pmt,UINT uID)
{
CStatusBar* pStatus=(CStatusBar*)
AfxGetApp()->m_pMainWnd->GetDescendantWindow(ID_VIEW_STATUS_BAR);
ASSERT(pStatus);
if(pStatus) {
pStatus->SetPaneText(uID,pmt,TRUE);
}
}
void CGpsSCView::CovertDFS(double LongNE,int *Angle,int *Minute,int *Second)
{
double dTmp;
dTmp = LongNE;
dTmp = dTmp / 100.0;
*Angle = (int)(dTmp);
dTmp = (dTmp - *Angle) * 100.0;
*Minute = (int)(dTmp);
*Second = (int)((dTmp - *Minute) * 60);
}
void CGpsSCView::TrackDispData(CPoint point)
{
CGpsPoint cGpsPoint;
CString Prompt;
int Angle1,Minute1,Second1,Angle2,Minute2,Second2;
cGpsPoint.m_lx = point.x; cGpsPoint.m_ly = point.y;
m_cDrawMap.CovertNEXY(&cGpsPoint, m_cDrawMap.m_cCurrMapInfo.CoeffXY_NE, false);
CovertDFS(cGpsPoint.m_dgx,&Angle1,&Minute1,&Second1);
CovertDFS(cGpsPoint.m_dgy,&Angle2,&Minute2,&Second2);
Prompt.Format("(%d,%d);(%d°%02d′%02d″,%d°%02d′%02d″)",point.x,point.y,Angle1,Minute1,Second1,Angle2,Minute2,Second2);
StatusPrompt(Prompt,1);
}
void CGpsSCView::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
#if 0
CGpsSCDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CString SystemTitle;
SystemTitle = m_cDrawMap.m_cCurrMapInfo.m_LinkFileName;
pDoc->SetTitle(SystemTitle);
#endif
CScrollView::OnTimer(nIDEvent);
}
void CGpsSCView::OnMzoomDown()
{
// TODO: Add your command handler code here
m_cDrawMap.ZoomDown();
}
void CGpsSCView::OnUpdateMzoomDown(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
}
void CGpsSCView::OnMzoomUp()
{
// TODO: Add your command handler code here
m_cDrawMap.ZoomUp();
}
void CGpsSCView::OnUpdateMzoomUp(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
}
//开锁
void CGpsSCView::OnOpenlock()
{
// TODO: Add your command handler code here
procSM.OnOpenlock();
}
//取位置
void CGpsSCView::OnGetvehicleposition()
{
// TODO: Add your command handler code here
procSM.OnGetvehicleposition();
}
//上锁
void CGpsSCView::OnSetlock()
{
// TODO: Add your command handler code here
procSM.OnSetlock();
}
//断油
void CGpsSCView::OnShutoil()
{
// TODO: Add your command handler code here
procSM. OnShutoil();
}
void CGpsSCView::SetCommonUserTelNo(CString)
{
}
//Host change his owen password
void CGpsSCView::OnSetpassword()
{
procSM.HoseChangePassWord();
}
void CGpsSCView::OnSendnormalsm()
{
// TODO: Add your command handler code here
AfxMessageBox("对不起! 此功能只提供给正式版用户!");
}
void CGpsSCView::OnSendinfotogroup()
{
// TODO: Add your command handler code here
AfxMessageBox("对不起! 此功能只提供给正式用户!");
}
void CGpsSCView::OnSelectUserType()
{
// TODO: Add your command handler code here
procSM.SelectUserType();
if(procSM.m_nUserType==1)
flag_usertype=FALSE;
if(procSM.m_nUserType==0)
flag_usertype=TRUE;
}
void CGpsSCView::OnAutomonitor()
{
// TODO: Add your command handler code here
procSM.AutoMonitor();
}
void CGpsSCView::OnGethelp()
{
// TODO: Add your command handler code here
procSM.GetHelp();
}
void CGpsSCView::OnShowconnetDlg()
{
// CGpsSCApp *vpsapp=NULL;
/* {
m_pDoc = GetDocument();
if(m_pDoc->OnConnetComm())
procSM.SystermInite(this);
}*/
}
void CGpsSCView::OnMdispSignPoint()
{
// TODO: Add your command handler code here
if(!m_bDispSignPoint) {
if(!m_cDrawMap.ShowSignLib()) return;
m_bDispSignPoint = true;
}
else {
m_bDispSignPoint = false;
}
OnRefresh();
}
void CGpsSCView::OnUpdateMdispSignPoint(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
}
void CGpsSCView::OnMsearchSignByRegion()
{
// TODO: Add your command handler code here
m_bSearchSignbyRegion = true;
m_cDrawMap.SearchSign();
}
void CGpsSCView::OnUpdateMsearchSignByRegion(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(theApp.m_bUserType);
}
void CGpsSCView::OnMsearchBestRoad()
{
// TODO: Add your command handler code here
if(!m_bSearchBestRoad) {
m_bSearchBestRoad = true;
AfxMessageBox("请选择起点");
}
else {
m_bSearchBestRoad = false;
OnRefresh();
}
}
void CGpsSCView::OnUpdateMsearchBestRoad(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(FALSE);
}
void CGpsSCView::OnFindmessage()
{
// TODO: Add your command handler code here
CFindMessageDlg dlg;
dlg.DoModal();
}
void CGpsSCView::OnUpdateAutomonitor(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
BOOL MenuEnable = procSM.m_bSysTemInit;
// MenuEnable = MenuEnable && flag_usertype;
pCmdUI->Enable(MenuEnable);
}
void CGpsSCView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
DrawMoveRect(point);
if(m_bSearchBestRoad) m_cDrawMap.CalculateBRroadPath(point);
m_bMoveFatMap = true;
m_pRBDownPoint = point;
CScrollView::OnLButtonDown(nFlags, point);
}
void CGpsSCView::DrawMoveRect(CPoint point)
{
if(!m_bLButtomDown) {
SetCursor(AfxGetApp()->LoadCursor(IDC_CURSOR_MOVE));
m_bLButtomDown = true;
}
return;
CRectTracker cRect;
CPoint cPoint;
cRect.m_rect.SetRect(10, 10, 300, 300);
cRect.m_nStyle = CRectTracker::resizeInside | CRectTracker::dottedLine;
cRect.TrackRubberBand(this,point);
}
void CGpsSCView::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if(m_bLButtomDown) {
m_bLButtomDown = false;
}
m_bMoveFatMap = false;
CScrollView::OnLButtonUp(nFlags, point);
}
void CGpsSCView::OnUpdateGetvehicleposition(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(procSM.m_bSysTemInit);
}
void CGpsSCView::OnUpdateSetlock(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(procSM.m_bSysTemInit);
}
void CGpsSCView::OnUpdateShutoil(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(procSM.m_bSysTemInit);
}
void CGpsSCView::OnUpdateGethelp(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(procSM.m_bSysTemInit);
}
void CGpsSCView::OnUpdateOpenlock(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(procSM.m_bSysTemInit);
}
void CGpsSCView::OnUpdateSendnormalsm(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(procSM.m_bSysTemInit);
}
void CGpsSCView::OnUpdateSendinfotogroup(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(procSM.m_bSysTemInit);
}
void CGpsSCView::OnUpdateSelecttype(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(procSM.m_bSysTemInit);
}
void CGpsSCView::OnUpdateChangeuserpassword(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(procSM.m_bSysTemInit);
}
void CGpsSCView::OnUpdateSetpassword(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(procSM.m_bSysTemInit);
}
void CGpsSCView::OnCconnectCom()
{
// TODO: Add your command handler code here
CGpsSCDoc *pDoc = GetDocument();
ASSERT_VALID(pDoc);
m_pDoc->OnConnetComm();
procSM.m_bSysTemInit = FALSE;
}
void CGpsSCView::OnUpdateCconnectCom(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(!procSM.m_bSysTemInit);
}
void CGpsSCView::OnCdisconnetComm()
{
// TODO: Add your command handler code here
CGpsSCDoc *pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDoc->CloseConnection();
procSM.m_bSysTemInit = FALSE;
}
void CGpsSCView::OnUpdateCdisconnetComm(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(procSM.m_bSysTemInit);
}
LRESULT CGpsSCView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
switch(message)
{
case WM_MOUSEMOVE:
{
MSG msg;
msg.hwnd=m_hWnd;
msg.message=message;
msg.wParam=wParam;
msg.lParam=lParam;
m_ToolTip.RelayEvent(&msg);
}
}
return CScrollView::WindowProc(message, wParam, lParam);
}
BOOL CGpsSCView::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(m_ToolTip)
m_ToolTip.RelayEvent(pMsg);
m_ToolTip.SetTipBkColor(RGB(050,250,255));
return CScrollView::PreTranslateMessage(pMsg);
}
void CGpsSCView::OnCancelautomonitor()
{
// TODO: Add your command handler code here
procSM.CanceLautoMonitor();
if(procSM.CheckMonitorCar())
{
CMainFrame* mainfrm=(CMainFrame*)AfxGetApp()->m_pMainWnd;
bool bConctrol = false;
mainfrm->EditTreeItem(bConctrol);
}
}
void CGpsSCView::OnUpdateCancelautomonitor(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(procSM.m_bSysTemInit);
}
void CGpsSCView::CheckMousePointInList(CPoint point)
{
CMainFrame *pMainFrame = NULL;
CString Str,Data("");
int nListCount,i;
// int j;
double gx,gy;
long x,y;
pMainFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd;
nListCount = pMainFrame->m_wndListCtrl.GetItemCount();
for(i = 0; i < nListCount; i++) {
gx = CovertStdNE(pMainFrame->m_wndListCtrl.GetItemText(i,5));
gy = CovertStdNE(pMainFrame->m_wndListCtrl.GetItemText(i,6));
// for(j = 0; j < 7; j++) {
Data="";
Str.Format("%s,%c",pMainFrame->m_wndListCtrl.GetItemText(i,1),'\n');
Data += Str;
Str.Format("%s,%c",pMainFrame->m_wndListCtrl.GetItemText(i,2),'\n');
Data += Str;
Str.Format("%s,%c",pMainFrame->m_wndListCtrl.GetItemText(i,7),'\n');
Data += Str;
Str.Format("%s",pMainFrame->m_wndListCtrl.GetItemText(i,9));
Data += Str;
// }
m_cDrawMap.CalcNE2XY(gx,gy,x,y);
if((abs(point.x - x) < 3) && (abs(point.y - y) < 3)) {
m_ToolTip.AddTool(this,Data);
m_ToolTip.Activate(TRUE);
}
}
}
//移动滚动条
void CGpsSCView::MoveScroll()
{
int nx,ny;
nx=ny=0;
if((m_bDrawMap==TRUE)&&(m_cDrawMap.m_byZoomCoeffic>1))
{
SetScrollRange(SB_HORZ,0,430,TRUE);
SetScrollRange(SB_VERT,0,260,TRUE);
if(m_nx>430)
nx = m_nx-430;
if(m_ny>260)
ny = m_ny-260;
SetScrollPos(SB_HORZ,nx,TRUE);
SetScrollPos(SB_VERT,ny,TRUE);
}
m_bDrawMap = FALSE;
}
void CGpsSCView::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or call default
m_bDrawMap = FALSE;
CScrollView::OnVScroll(nSBCode, nPos, pScrollBar);
}
void CGpsSCView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or call default
m_bDrawMap = FALSE;
CScrollView::OnHScroll(nSBCode, nPos, pScrollBar);
}
void CGpsSCView::OnPopFresh()
{
// TODO: Add your command handler code here
CGpsSCDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDoc->UpdateAllViews(NULL);
}
void CGpsSCView::OnUpdatePopFresh(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
}
void CGpsSCView::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CMenu PopMenu,*pSubMenu;
CRect lpRect;
GetWindowRect(&lpRect);
PopMenu.LoadMenu(IDR_POP_MENU);
pSubMenu = PopMenu.GetSubMenu(1);
pSubMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
point.x + lpRect.left,
point.y + lpRect.top, AfxGetMainWnd(),NULL);
pSubMenu = NULL;
PopMenu.DestroyMenu();
CScrollView::OnRButtonDown(nFlags, point);
}
void CGpsSCView::OnMsearchSign()
{
// TODO: Add your command handler code here
m_bSearchSignbyRegion = true;
m_cDrawMap.SearchSignByInput();
}
void CGpsSCView::OnUpdateMsearchSign(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
}
BOOL CGpsSCView::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
return FALSE;
// return CScrollView::OnEraseBkgnd(pDC);
}
void CGpsSCView::OnCancelCurrMonitorCar()
{
// TODO: Add your command handler code here
if(procSM.CheckMonitorCar())
{
CMainFrame* mainfrm=(CMainFrame*)AfxGetApp()->m_pMainWnd;
bool bConctrol = false;
mainfrm->EditTreeItem(bConctrol);
}
}
void CGpsSCView::OnUpdateCancelCurrMonitorCar(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
BOOL MenuEnable = procSM.m_bSysTemInit;
pCmdUI->Enable(MenuEnable);
}
void CGpsSCView::OnSetCurrMonitorCar()
{
// TODO: Add your command handler code here
CClientinfoSet cSet;
CString VehicleID,VehicleTel;
CMainFrame* mainfrm=(CMainFrame*)AfxGetApp()->m_pMainWnd;
cSet.FindCarNumberAndPhone(str_GetTreeItemText,VehicleID,VehicleTel);
procSM.SetMonitorCar(VehicleID);
if(!procSM.CheckMonitorCar())
{
mainfrm->EditTreeItem();
}
}
void CGpsSCView::OnUpdateSetCurrMonitorCar(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
BOOL MenuEnable = procSM.m_bSysTemInit;
pCmdUI->Enable(MenuEnable);
}
void CGpsSCView::OnUpdateCconnetComm(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(theApp.m_bUserType);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -