- // CurrMapInfo.cpp: implementation of the CCurrMapInfo class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "GpsSC.h"
- #include "CurrMapInfo.h"
- #include "GpsRoadStruct.h"
- #include "GpsRoadCrossPoint.h"
- #include "GpsColorBlock.h"
- #include "GpsSignObject.h"
- #include "GpsAreaLibStruct.h"
- #include "BRCrossStruct.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- CCurrMapInfo::CCurrMapInfo()
- {
- BYTE i;
- for(i = 0; i < GpsLibFileLen + 1; i++) {
- m_DataFileName[i] = 0;
- }
- for(i = 0; i < GpsLibFileLen + 1; i++) {
- m_LinkFileName[i] = 0;
- }
- for(i = 0; i < GpsLibFileLen + 1; i++) {
- m_SignFileName[i] = 0;
- }
- m_lWnd_Max_X = m_lWnd_Max_Y = 0;
- }
- CCurrMapInfo::~CCurrMapInfo()
- {
- ClearRoadList(lCurrRoadList);
- ClearCrossList();
- ClearColorBList();
- ClearSignList();
- }
- void CCurrMapInfo::Clear()
- {
- BYTE i;
- for(i = 0; i < GpsLibFileLen + 1; i++) {
- m_DataFileName[i] = 0;
- }
- for(i = 0; i < GpsLibFileLen + 1; i++) {
- m_LinkFileName[i] = 0;
- }
- for(i = 0; i < GpsLibFileLen + 1;i ++) {
- m_SignFileName[i] = 0;
- }
- }
- void CCurrMapInfo::LinkName2MapName(char *LinkName,char *MapName)
- {
- BYTE i;
- MapName[0] = LinkName[0] - 0x10;
- for(i = 1; i < GpsLibFileLen; i++) {
- MapName[i] = LinkName[i];
- }
- }
- void CCurrMapInfo::MapName2LinkName(char *MapName ,char *LinkName)
- {
- BYTE i;
- LinkName[0] = MapName[0] + 0x10;
- for(i = 1; i < GpsLibFileLen; i++) {
- LinkName[i] = MapName[i];
- }
- }
- void CCurrMapInfo::LinkName2DataLib(char *LinkName,char *DataLib)
- {
- BYTE i;
- DataLib[0] = LinkName[0] + 6;
- for(i = 1; i < GpsLibFileLen; i++) {
- DataLib[i] = LinkName[i];
- }
- }
- void CCurrMapInfo::DataLib2LinkName(char DataLib[], char LinkName[])
- {
- BYTE i;
- LinkName[0] = DataLib[0] - 6;
- for(i = 1; i < GpsLibFileLen; i++) {
- LinkName[i] = DataLib[i];
- }
- }
- void CCurrMapInfo::ClearRoadList(CObList &TempList)
- {
- CGpsRoadStruct *pRoad;
- POSITION pos;
- pos = lCurrRoadList.GetHeadPosition();
- while(pos != NULL) {
- pRoad = (CGpsRoadStruct*)lCurrRoadList.GetNext(pos);
- delete pRoad;
- }
- lCurrRoadList.RemoveAll();
- }
- void CCurrMapInfo::ClearCrossList()
- {
- CGpsRoadCrossPoint *pCross;
- POSITION pos;
- pos = lCurrCrossList.GetHeadPosition();
- while(pos != NULL) {
- pCross = (CGpsRoadCrossPoint*)lCurrCrossList.GetNext(pos);
- delete pCross;
- }
- lCurrCrossList.RemoveAll();
- }
- void CCurrMapInfo::ClearColorBList()
- {
- CGpsColorBlock *pBlock;
- POSITION pos;
- pos = lCurrColorBList.GetHeadPosition();
- while(pos != NULL) {
- pBlock = (CGpsColorBlock*)lCurrColorBList.GetNext(pos);
- delete pBlock;
- }
- lCurrColorBList.RemoveAll();
- }
- void CCurrMapInfo::ClearSignList()
- {
- CGpsSignObject *pSign;
- POSITION pos;
- pos = lCurrSignList.GetHeadPosition();
- while(pos != NULL) {
- pSign = (CGpsSignObject*)lCurrSignList.GetNext(pos);
- delete pSign;
- }
- lCurrSignList.RemoveAll();
- }
- void CCurrMapInfo::ClearAreaLibList()
- {
- CGpsAreaLibStruct *pArea;
- POSITION pos;
- pos = lAreaLibList.GetHeadPosition();
- while(pos != NULL) {
- pArea = (CGpsAreaLibStruct*)lAreaLibList.GetNext(pos);
- delete pArea;
- }
- lAreaLibList.RemoveAll();
- }
- void CCurrMapInfo::ClearBRoadSaveList(CObList *TempList)
- {
- CBRCrossStruct *pCross;
- POSITION pos = TempList->GetHeadPosition();
- while(pos != NULL) {
- pCross = (CBRCrossStruct*)TempList->GetNext(pos);
- delete pCross;
- }
- TempList->RemoveAll();
- }
- void CCurrMapInfo::ClearPointList(CObList *PointList)
- {
- CGpsPoint *pPoint;
- POSITION pos;
- pos = PointList->GetHeadPosition();
- while(pos != NULL) {
- pPoint = (CGpsPoint*)PointList->GetNext(pos);
- delete pPoint;
- }
- PointList->RemoveAll();
- }