Skip to content

JUSEOUNGHYUN/GPS_Parsing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

0. 기본 화면

Basic Screen

1. GPS 데이터(NMEA) Parsing후 html 파일 생성

	file.Open(m_total, CStdioFile::modeCreate | CStdioFile::modeNoTruncate | CStdioFile::modeWrite | CStdioFile::typeText);
	file.WriteString(_T("<!DOCTYPE html>\n"));
	file.WriteString(_T("<html>\n"));
	file.WriteString(_T("<head>\n"));
	file.WriteString(_T("\t<meta charset='utf-8'>\n"));
	file.WriteString(_T("\t<title>Multi-Position Mark</title>\n"));
	file.WriteString(_T("</html>\n"));
	file.WriteString(_T("<body>\n"));
	file.WriteString(_T("<div id='map' style='width:100 %; height:350px;'></div>\n"));
	file.WriteString(_T("<script type='text/javascript' src='https://dapi.kakao.com/v2/maps/sdk.js?appkey=31b4550cf25c251d62cae2a593f6ac38'></script>\n"));
	file.WriteString(_T("<script>\n"));
	file.WriteString(_T("var mapContainer = document.getElementById('map'),\n"));
	file.WriteString(_T("\tmapOption = {\n"));
	file.WriteString(_T("\t\tcenter: new kakao.maps.LatLng(") + CavgLat + _T(", ") + CavgLon + _T("),\n"));
	file.WriteString(_T("\t\tlevel: 6\n"));
	file.WriteString(_T("\t};\n"));
	file.WriteString(_T("var map = new kakao.maps.Map(mapContainer, mapOption);\n"));
	file.WriteString(_T("var positions = [\n"));
 
         // for문 = html에 위도, 경도 데이터 주입
	for (int i = 0; i < GGALatCount; i++)
	{
		CString inf;
		CString GGALat = CA2CT(strGroupGGALat[i].c_str()); // 위도 
		CString GGALon = CA2CT(strGroupGGALon[i].c_str()); // 경도
		inf.Format(_T("%d"), i + 1);
		file.WriteString(_T("\t{\n"));
		file.WriteString(_T("\t\ttitle: '") + inf + _T("',\n"));
		file.WriteString(_T("\t\tlatlng: new kakao.maps.LatLng(") + GGALat + _T(", ") + GGALon + _T(")\n"));
		file.WriteString(_T("\t},\n"));
	}
	file.WriteString(_T("];\n"));
	file.WriteString(_T("var imageSrc = 'https://t1.daumcdn.net/localimg/localimages/07/mapapidoc/markerStar.png'; \n"));
	file.WriteString(_T("\n"));
	file.WriteString(_T("for (var i = 0; i < positions.length; i ++) {\n"));
	file.WriteString(_T("var imageSize = new kakao.maps.Size(24, 35);\n"));
	file.WriteString(_T("var markerImage = new kakao.maps.MarkerImage(imageSrc, imageSize);\n"));
	file.WriteString(_T("var marker = new kakao.maps.Marker({\n"));
	file.WriteString(_T("map: map,\n"));
	file.WriteString(_T("position: positions[i].latlng,\n"));
	file.WriteString(_T("title : positions[i].title,\n"));
	file.WriteString(_T("image : markerImage\n"));
	file.WriteString(_T("});\n"));
	file.WriteString(_T("}\n"));
	file.WriteString(_T("</script>\n"));
	file.WriteString(_T("</body>\n"));
	file.WriteString(_T("</html>\n"));

1.1 파일 생성

화면 캡처 2023-11-02 013915

1.2 html에 위치 데이터 마크업

var positions = [
	{
		title: '1',
		latlng: new kakao.maps.LatLng(33.30344, 126.29545)
	},
	...........
	{
		title: '40',
		latlng: new kakao.maps.LatLng(33.28140, 126.31317)
	},
];

2. SetViewHtml()

void CGpsParsingDlg::SetViewHtml()
{
	DWORD m_NetConnectCheck = NULL;
	BOOL m_NetWork = NULL;

	if (InternetGetConnectedState(&m_NetConnectCheck, 0))
	{
		m_NetWork = TRUE;
		if ((m_NetConnectCheck & INTERNET_CONNECTION_OFFLINE) != 0)
		{
			m_NetWork = FALSE;
		}
	}
	else
	{
		m_NetWork = FALSE;
	}

	if (m_NetWork)
	{
		CRect m_map_rc;
		GetDlgItem(IDC_EXPLORER_HTML_VIEW)->GetWindowRect(m_map_rc);
		ScreenToClient(m_map_rc);

		m_map_html_view = new explorerview();
		m_map_html_view->Create(NULL, _T(""), WS_CHILD | WS_VISIBLE, m_map_rc, this, 20008);
		m_map_html_view->OnInitialUpdate();
	}
	else
	{
		AfxMessageBox(_T("Not connecting Network. GPS Maps disable mode"));
	}
}

3. GPS 위치 데이터 마크업 html (카카오 지도)

화면 캡처 2023-11-02 014037

4. GPS 위치 데이터 마크업 html (구글 지도)

google map

5. 컴파일

gps_1

About

(개인 프로젝트) NMEA Parsing Markup GPS

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published