91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 10KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-01
  • 語言: 其他
  • 標簽: c++??

資源簡介

先在win10系統下搭建vs+qt+qgis環境,然后利用無線數傳通過串口通信接收傳輸的數據并在地圖上標注出位置,供大家參考!

資源截圖

代碼片段和文件信息

#include
#includeyer.h>
#include
#include“mygis.h“
#include
#include?
#include
?
#include?

/////////////////////////////////////////////////////////////////////
#?pragma?warning?(disable:4819)
//#include?“stdafx.h“??
#include?“SerialPort.h“??
#include
using?namespace?std;
?

//#########################################################################################
??
int?main(int?argc?_TCHAR*?argv[])
{
/////////////////////??gis初始化??///////////////////////////////////////////////////////
//std::cout?< QgsApplication?a(argc?argv?true);
QgsApplication::setPrefixPath(“F://OSGeo4W64/apps/qgis“?true);//QGIS路徑
QgsApplication::initQgis();//初始化QGIS應用



/////////////////////??串口初始化??//////////////////////////////////////////////////////

CSerialPort?mySerialPort;//首先將之前定義的類實例化
int?length?=?8;//定義傳輸的長度


unsigned?char?*temp?=?new?unsigned?char[8];//動態創建一個數組



if?(!mySerialPort.InitPort(3?CBR_9600?‘N‘?8?1?EV_RXCHAR))//是否打開串口,3就是你外設連接電腦的com口,可以在設備管理器查看,然后更改這個參數
{
std::cout?< }
else
{
std::cout?< }
if?(!mySerialPort.OpenListenThread())//是否打開監聽線程,開啟線程用來傳輸返回值
{
std::cout?< }
else
{
std::cout?< }
?
temp[0]?=?12;
temp[1]?=?17;//632628;
temp[2]?=?22;
//temp[3]?=?04;
//temp[4]?=?05;
//temp[5]?=?06;
//temp[6]?=?07;
//temp[7]?=?00;
//cout?< //cout?< ?//delete?temp[];
//system(“pause“);


////////////////建圖層,打開地圖//////////////////////////////////////

mygis?w;//創建一個窗體,類似于Qt
QgsVectorlayer*newlayer?=?new?QgsVectorlayer();
QgsMapCanvas*mapCanvas?=?new?QgsMapCanvas();
newlayer?=?w.createlayer(newlayer);
w.openMap(newlayer);

?//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&


?//打開串口讀取數據
while?(1)
{
a.processEvents();//qgis線程
UINT?BytesInQue?=?mySerialPort.GetBytesInCOM();
//**?如果串口輸入緩沖區中無數據則休息一會再查詢?
if?(BytesInQue?==?0)
{
Sleep(100);
continue;
}
///??讀取輸入緩沖區中的數據并輸出顯示?/
//std::string?str;
unsigned?char?cRecved?=?0x00;
int?i?=?0;
double?r[8];

do
{
cRecved?=?0x00;

if?(mySerialPort.ReadChar(cRecved)?==?true)?
{
//***********************************************************************
std::stringstream??ss;
double?tm?=?cRecved;
ss?< ss?< string?a?=?ss.str();
string?b;
transform(a.begin()?a.end()?back_inserter(b)?::toupper);
////////////////////////////////////

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????4748??2020-10-05?19:31??SerialPort.h

?????文件???????3996??2020-11-07?12:19??main.cpp

?????文件???????5203??2020-10-16?21:12??mygis.cpp

?????文件????????375??2020-10-05?19:31??mygis.h

?????文件??????11071??2020-10-05?19:31??SerialPort.cpp

-----------?---------??----------?-----??----

????????????????25393????????????????????5


評論

共有 條評論