⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gpstestview.cpp

📁 GPS-OEM模块卫星方位图测试软件设计程序(采用Microsoft Visual C++6.0进行编程设计。)
💻 CPP
📖 第 1 页 / 共 2 页
字号:
			        
				    msg.Delete(0,msg.Find(',')+1);
					CString weixing1=msg.Mid(0,msg.Find(','));
					msg.Delete(0,msg.Find(',')+1);
					CString yajiao1=msg.Mid(0,msg.Find(','));
					
					msg.Delete(0,msg.Find(',')+1);
					CString xuanjiao1=msg.Mid(0,msg.Find(','));
					msg.Delete(0,msg.Find(',')+1);
					CString xingzao1=msg.Mid(0,msg.Find(','));
					
					 msg.Delete(0,msg.Find(',')+1); 
					 
				    CString weixing2=msg.Mid(0,msg.Find(','));
					
					msg.Delete(0,msg.Find(',')+1);
					CString yajiao2=msg.Mid(0,msg.Find(','));
					msg.Delete(0,msg.Find(',')+1);
					CString xuanjiao2=msg.Mid(0,msg.Find(','));
					msg.Delete(0,msg.Find(',')+1);
					CString xingzao2=msg.Mid(0,msg.Find(','));
					 msg.Delete(0,msg.Find(',')+1);
					CString weixing3=msg.Mid(0,msg.Find(','));
					msg.Delete(0,msg.Find(',')+1);
					CString yajiao3=msg.Mid(0,msg.Find(','));
					msg.Delete(0,msg.Find(',')+1);
					CString xuanjiao3=msg.Mid(0,msg.Find(','));
					msg.Delete(0,msg.Find(',')+1);
					CString xingzao3=msg.Mid(0,msg.Find(','));
					msg.Delete(0,msg.Find(',')+1);
					 CString weixing4=msg.Mid(0,msg.Find(','));
					msg.Delete(0,msg.Find(',')+1);
					CString yajiao4=msg.Mid(0,msg.Find(','));
					msg.Delete(0,msg.Find(',')+1);
					CString xuanjiao4=msg.Mid(0,msg.Find(','));
					msg.Delete(0,msg.Find(',')+1);
					CString xingzao4=msg.Mid(0,msg.Find('*'));
					yajiao=yajiao1+","+yajiao2+","+yajiao3+","+yajiao4+",";
					xuanjiao=xuanjiao1+","+xuanjiao2+","+xuanjiao3+","+xuanjiao4+",";
					xingzao=xingzao1+","+xingzao2+","+xingzao3+","+xingzao4+",";
					weixing=weixing1+" ,"+weixing2+" ,"+weixing3+" ,"+weixing4+" ,";
				
				
					  }

				 if(atoi(msg.Mid(0,msg.Find(',')))==2)
				 {   
                     msg.Delete(0,msg.Find(',')+1);
					 msg.Delete(0,msg.Find(',')+1);
					 CString weixing5=msg.Mid(0,msg.Find(','));
					 msg.Delete(0,msg.Find(',')+1);
                     CString yajiao5=msg.Mid(0,msg.Find(','));
					 msg.Delete(0,msg.Find(',')+1);
					 CString xuanjiao5=msg.Mid(0,msg.Find(','));
					 msg.Delete(0,msg.Find(',')+1);
					 CString xingzao5=msg.Mid(0,msg.Find(','));
					 msg.Delete(0,msg.Find(',')+1);
					 CString weixing6=msg.Mid(0,msg.Find(','));
					 msg.Delete(0,msg.Find(',')+1);
					 CString yajiao6=msg.Mid(0,msg.Find(','));
					 msg.Delete(0,msg.Find(',')+1);
					 CString xuanjiao6=msg.Mid(0,msg.Find(','));
					 msg.Delete(0,msg.Find(',')+1);
					 CString xingzao6=msg.Mid(0,msg.Find(','));
					 msg.Delete(0,msg.Find(',')+1);
					 CString weixing7=msg.Mid(0,msg.Find(','));
					  msg.Delete(0,msg.Find(',')+1);
					  CString yajiao7=msg.Mid(0,msg.Find(','));
					 msg.Delete(0,msg.Find(',')+1);
					 CString xuanjiao7=msg.Mid(0,msg.Find(','));
					 msg.Delete(0,msg.Find(',')+1);
					 CString xingzao7=msg.Mid(0,msg.Find(','));
					 msg.Delete(0,msg.Find(',')+1);
					 CString weixing8=msg.Mid(0,msg.Find(','));
					 msg.Delete(0,msg.Find(',')+1);
					 CString yajiao8=msg.Mid(0,msg.Find(','));
					 msg.Delete(0,msg.Find(',')+1);
					 CString xuanjiao8=msg.Mid(0,msg.Find(','));
					 msg.Delete(0,msg.Find(',')+1);
					 CString xingzao8=msg.Mid(0,msg.Find('*'));
                      yajiao+=yajiao5+","+yajiao6+","+yajiao7+","+yajiao8+",";
					xuanjiao+=xuanjiao5+","+xuanjiao6+","+xuanjiao7+","+xuanjiao8+",";
					 xingzao+=xingzao5+","+xingzao6+","+xingzao7+","+xingzao8+",";
					 weixing+=weixing5+" ,"+weixing6+" ,"+weixing7+" ,"+weixing8+" ,";
					if (n==8)
					{
						Invalidate();
						UpdateWindow();}
	    
				
				 }
				 if(atoi(msg.Mid(0,msg.Find(',')))==3)
				 {
                     
					 msg.Delete(0,msg.Find(',')+1);
					 
					 CString gsv3=msg.Mid(0,msg.Find('*'))+",";
					 
					 CString s[4],y[4],xj[4],x[4],a,b,c,d;
					 for(int m=8;m<n;m++)
					 {
					 gsv3.Delete(0,gsv3.Find(',')+1);
					 s[m-8]=gsv3.Mid(0,gsv3.Find(','));
					 gsv3.Delete(0,gsv3.Find(',')+1);
					 y[m-8]=gsv3.Mid(0,gsv3.Find(','));
					 gsv3.Delete(0,gsv3.Find(',')+1);
					 xj[m-8]=gsv3.Mid(0,gsv3.Find(','));
					 gsv3.Delete(0,gsv3.Find(',')+1);
					 x[m-8]=gsv3.Mid(0,gsv3.Find(','));
					 
					
					 a+=s[m-8]+" ,";
					 b+=x[m-8]+",";
					 c+=y[m-8]+",";
					 d+=xj[m-8]+",";
					 
					 
						
					 }
					 weixing+=a;
					 xingzao+=b;
					 yajiao+=c;
					 xuanjiao+=d;
					 Invalidate();
	                 UpdateWindow();
					 
				 }

		
                 
				 }
				 }
			  


			 }
			 }
	 
		
	}


    UpdateData(FALSE);

}

void  CGpstestView::UpdateControlsFromDoc()	
{
	CGpstestDoc *pDoc=GetDocument();
	m_data=pDoc->m_ddd;

	UpdateData(FALSE);
}

void CGpstestView::OnReadButton() 
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);								
	UpdateControlsFromDoc();
	m_strReceived=m_data;

	
}

void CGpstestView::OnSaveButton() 
{
	// TODO: Add your control notification handler code here
	CGpstestDoc *pDoc=GetDocument();
	UpdateData(TRUE);
	pDoc->m_ddd=m_data;

	
}

void CGpstestView::OnDraw(CDC* pDC) 
{
	// TODO: Add your specialized code here and/or call the base class
	 CPen   pen,*pOldPen;   
        CBrush   brush,*pOldBrush;   
        pen.CreatePen(PS_SOLID,1,RGB(0,255,0));   
        brush.CreateSolidBrush(RGB(44,94,118));   
        pOldPen   =   pDC->SelectObject(&pen);                     
        pOldBrush   =   pDC->SelectObject(&brush);                     
        pDC->Ellipse(400,  220,  720,  540);
		pDC->Ellipse(464,  284,  656,  476);
		pDC->SetBkColor(RGB(0,0,5));

       
        //Release   GDI   Object                 
        pDC->SelectObject(pOldPen);                     
        pDC->SelectObject(pOldBrush);   
        pen.DeleteObject();   
        brush.DeleteObject(); 
		int xLine = 70;
			int yLine = 558;
			int X,Y,R;
			double e=3.1415926;
			pDC->SetTextColor(RGB(250,0,0));
			pDC->SetBkMode(TRANSPARENT);
            pDC->TextOut(550,20,"〖GPS基本定位数据显示〗");
         

		    pDC->SetTextColor(RGB(128,0,254));
	//		pDC->SetBkMode(TRANSPARENT);
			pDC->TextOut(xLine-65,yLine+1,"卫星星号");
			pDC->TextOut(xLine-60,yLine-295,"信噪比");

			pDC->SetTextColor(RGB(128,0,254));
			pDC->SetBkMode(TRANSPARENT);
			pDC->TextOut(8,14,"选择串口");
				pDC->TextOut(12,42,"波特率");


            pDC->SetTextColor(RGB(128,0,254));
			pDC->SetBkMode(TRANSPARENT);
			pDC->TextOut(548,190,"北");
			pDC->TextOut(550,554,"南");
			pDC->TextOut(730,375,"东");
			pDC->TextOut(370,379,"西");

			pDC->SetTextColor(RGB(0,128,64));
				pDC->TextOut(500,44,"日期:");
				pDC->TextOut(500,74,"时间:");
				pDC->TextOut(500,104,"高度:");
				pDC->TextOut(500,134,"经度:");
				pDC->TextOut(500,164,"纬度:");
				pDC->TextOut(625,44,"当前状态:");
				pDC->TextOut(625,74,"水平精度:");
				pDC->TextOut(625,104,"垂直精度:");
				pDC->TextOut(625,134,"位置精度:");
				pDC->TextOut(625,164,"对地航速:");
							


              
		//	pDC->SetTextColor(RGB(20,220,25));



			
			//pDC->Rectangle(xLine,yLine-16,xLine+18,yLine);
		    int SNR[12];
			CString wx[12];
			double yj[12],xj[12];
			for(int k=0;k<12;k++)
				{
					a[k]=sa.Mid(0,sa.Find(','));
					sa.Delete(0,sa.Find(',')+1);
				}
		
            if (h>1)
			{
			for(int i=0;i<n;i++){
				wx[i]=weixing.Mid(0,weixing.Find(','));
				yj[i]=atof(yajiao.Mid(0,yajiao.Find(',')));
				xj[i]=atof(xuanjiao.Mid(0,xuanjiao.Find(',')));
				SNR[i]=atoi(xingzao.Mid(0,xingzao.Find(',')));
				CString str,Text;int text1;
				
				Text=wx[i];
				text1=atoi(Text);
			str.Format("%d",SNR[i]);
			if(text1==atoi(a[0])|| text1==atoi(a[1]) || text1==atoi(a[2]) || text1==atoi(a[3]) ||text1==atoi(a[4]) ||text1==atoi(a[5]) ||text1==atoi(a[6]) ||text1==atoi(a[7])||text1==atoi(a[8])||text1==atoi(a[9])||text1==atoi(a[10])||text1==atoi(a[11]))

			{ CPen cpen1; 
				cpen1.CreatePen(PS_SOLID,1,RGB(197,41,214)); 
			CPen* pOldPen=(CPen*)pDC->SelectObject(&cpen1);
						
			CBrush brush(RGB(197,41,214));
			CBrush* pOldBrush=(CBrush*)pDC->SelectObject(&brush);

			pDC->SetBkMode(TRANSPARENT);
			pDC->SetTextColor(RGB(255,255,255));
						
		    R = int(160*(90 - yj[i])/90.0);
			X = int(560 + R*sin(xj[i]*e/180));
			Y = int(380 - R*cos(xj[i]*e/180));
			if(text1>0){			
			pDC->Ellipse(X-10,Y-10,X+10,Y+10);
	
			pDC->TextOut(X-8,Y-8,Text); }

			pDC->Rectangle(xLine,yLine-7*SNR[i],xLine+21,yLine);
                

               	pDC->SetTextColor(RGB(255,45,45));
				pDC->TextOut(xLine+1,yLine+1,Text);

			
		
				pDC->SetTextColor(RGB(0,0,0));
				if (SNR[i]>0)
				{
					pDC->SetTextColor(RGB(255,255,255));
				pDC->TextOut(xLine+1,yLine-15,str);
				}
				else
				{
				pDC->TextOut(xLine+1,yLine-15,"");
				}

	//			pDC->SelectObject(pOldPen);
	//			pDC->SelectObject(pOldBrush);

				xLine = xLine+24;
				weixing.Delete(0,weixing.Find(',')+1);
                xingzao.Delete(0,xingzao.Find(',')+1);
				
				yajiao.Delete(0,yajiao.Find(',')+1);
				xuanjiao.Delete(0,xuanjiao.Find(',')+1);}
				else
				{
	

                CPen cpen1; 
				cpen1.CreatePen(PS_SOLID,1,RGB(4,153,227)); 
			CPen* pOldPen=(CPen*)pDC->SelectObject(&cpen1);
						
			CBrush brush(RGB(4,153,227));//蓝色
			CBrush* pOldBrush=(CBrush*)pDC->SelectObject(&brush);

			pDC->SetBkMode(TRANSPARENT);
			pDC->SetTextColor(RGB(220,220,220));//白色文字
						
		    R = int(160*(90 - yj[i])/90.0);
			X = int(560 + R*sin(xj[i]*e/180));
			Y = int(380 - R*cos(xj[i]*e/180));
			if(text1>0){			
			pDC->Ellipse(X-10,Y-10,X+10,Y+10);
	
			pDC->TextOut(X-8,Y-8,Text); }

			pDC->Rectangle(xLine,yLine-7*SNR[i],xLine+21,yLine);
                

              	pDC->SetTextColor(RGB(10,155,23));
				pDC->TextOut(xLine+1,yLine+1,Text);

			
		
				pDC->SetTextColor(RGB(220,220,220));
				if (SNR[i]>0)
				{
				pDC->TextOut(xLine+1,yLine-15,str);
				}
				else
				{
				pDC->TextOut(xLine+1,yLine-15,"");
				}

				pDC->SelectObject(pOldPen);
				pDC->SelectObject(pOldBrush);

				xLine = xLine+24;
				weixing.Delete(0,weixing.Find(',')+1);
                xingzao.Delete(0,xingzao.Find(',')+1);
				
				yajiao.Delete(0,yajiao.Find(',')+1);
				xuanjiao.Delete(0,xuanjiao.Find(',')+1);
				}
			
			
			
			}
			}
			else
			{
				for(int i=0;i<n;i++){
				wx[i]=weixing.Mid(0,weixing.Find(','));
				yj[i]=atof(yajiao.Mid(0,yajiao.Find(',')));
				xj[i]=atof(xuanjiao.Mid(0,xuanjiao.Find(',')));
				SNR[i]=atoi(xingzao.Mid(0,xingzao.Find(',')));
				CString str,Text;int text2;
			
				
				Text=wx[i];
			   text2=atoi(Text);
				
					str.Format("%d",SNR[i]);
				//	str=str.Mid(0,str.Find('.'));


				
          

                CPen cpen1; 
				cpen1.CreatePen(PS_SOLID,1,RGB(4,153,227)); 
			CPen* pOldPen=(CPen*)pDC->SelectObject(&cpen1);
						
			CBrush brush(RGB(4,153,227));//蓝色
			CBrush* pOldBrush=(CBrush*)pDC->SelectObject(&brush);

			pDC->SetBkMode(TRANSPARENT);
			pDC->SetTextColor(RGB(220,220,220));//白色文字
						
		    R = int(160*(90 - yj[i])/90.0);
			X = int(560 + R*sin(xj[i]*e/180));
			Y = int(380 - R*cos(xj[i]*e/180));
		if(text2>0){			
			pDC->Ellipse(X-10,Y-10,X+10,Y+10);
	
			pDC->TextOut(X-8,Y-8,Text); }

			pDC->Rectangle(xLine,yLine-7*SNR[i],xLine+21,yLine);
                

               	pDC->SetTextColor(RGB(10,155,23));
				pDC->TextOut(xLine+1,yLine+1,Text);

			
		
				pDC->SetTextColor(RGB(220,220,220));
				if (SNR[i]>0)
				{
				pDC->TextOut(xLine+1,yLine-15,str);
				}
				else
				{
				pDC->TextOut(xLine+1,yLine-15,"");
				}

				pDC->SelectObject(pOldPen);
				pDC->SelectObject(pOldBrush);

				xLine = xLine+24;
				weixing.Delete(0,weixing.Find(',')+1);
                xingzao.Delete(0,xingzao.Find(',')+1);
				
				yajiao.Delete(0,yajiao.Find(',')+1);
				xuanjiao.Delete(0,xuanjiao.Find(',')+1);
			
			}
			
		
			}

	
}

BOOL CGpstestView::OnEraseBkgnd(CDC* pDC) 
{
	// TODO: Add your message handler code here and/or call default
	RECT           rect;   
 CBrush       br;   
 br.CreateSolidBrush(RGB(192,192,242));     //创建一个刷子,颜色为黑色   
 GetClientRect(   &rect   );               //取得客户区边界   
  pDC->FillRect(   &rect,   &br   );     //用刚才创建的刷子画客户区   
    
  return   true;  


	
//	return CFormView::OnEraseBkgnd(pDC);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -