CurrMapInfo.cpp
上传用户:yffx2008
上传日期:2014-10-12
资源大小:12414k
文件大小:4k
源码类别:

交通/航空行业

开发平台:

Visual C++

  1. // CurrMapInfo.cpp: implementation of the CCurrMapInfo class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include "stdafx.h"
  5. #include "GpsSC.h"
  6. #include "CurrMapInfo.h"
  7. #include "GpsRoadStruct.h"
  8. #include "GpsRoadCrossPoint.h"
  9. #include "GpsColorBlock.h"
  10. #include "GpsSignObject.h"
  11. #include "GpsAreaLibStruct.h"
  12. #include "BRCrossStruct.h"
  13. #ifdef _DEBUG
  14. #undef THIS_FILE
  15. static char THIS_FILE[]=__FILE__;
  16. #define new DEBUG_NEW
  17. #endif
  18. //////////////////////////////////////////////////////////////////////
  19. // Construction/Destruction
  20. //////////////////////////////////////////////////////////////////////
  21. CCurrMapInfo::CCurrMapInfo()
  22. {
  23. BYTE i;
  24. for(i = 0; i < GpsLibFileLen + 1; i++) {
  25. m_DataFileName[i] = 0;
  26. }
  27. for(i = 0; i < GpsLibFileLen + 1; i++) {
  28. m_LinkFileName[i] = 0;
  29. }
  30. for(i = 0; i < GpsLibFileLen + 1; i++) {
  31. m_SignFileName[i] = 0;
  32. }
  33. m_lWnd_Max_X = m_lWnd_Max_Y = 0;
  34. }
  35. CCurrMapInfo::~CCurrMapInfo()
  36. {
  37. ClearRoadList(lCurrRoadList);
  38. ClearCrossList();
  39. ClearColorBList();
  40. ClearSignList();
  41. }
  42. void CCurrMapInfo::Clear()
  43. {
  44. BYTE i;
  45. for(i = 0; i < GpsLibFileLen + 1; i++) {
  46. m_DataFileName[i] = 0;
  47. }
  48. for(i = 0; i < GpsLibFileLen + 1; i++) {
  49. m_LinkFileName[i] = 0;
  50. }
  51. for(i = 0; i < GpsLibFileLen + 1;i ++) {
  52. m_SignFileName[i] = 0;
  53. }
  54. }
  55. void CCurrMapInfo::LinkName2MapName(char *LinkName,char *MapName)
  56. {
  57. BYTE i;
  58. MapName[0] = LinkName[0] - 0x10;
  59. for(i = 1; i < GpsLibFileLen; i++) {
  60. MapName[i] = LinkName[i];
  61. }
  62. }
  63. void CCurrMapInfo::MapName2LinkName(char *MapName ,char *LinkName)
  64. {
  65. BYTE i;
  66. LinkName[0] = MapName[0] + 0x10;
  67. for(i = 1; i < GpsLibFileLen; i++) {
  68. LinkName[i] = MapName[i];
  69. }
  70. }
  71. void CCurrMapInfo::LinkName2DataLib(char *LinkName,char *DataLib)
  72. {
  73. BYTE i;
  74. DataLib[0] = LinkName[0] + 6;
  75. for(i = 1; i < GpsLibFileLen; i++) {
  76. DataLib[i] = LinkName[i];
  77. }
  78. }
  79. void CCurrMapInfo::DataLib2LinkName(char DataLib[], char LinkName[])
  80. {
  81. BYTE i;
  82. LinkName[0] = DataLib[0] - 6;
  83. for(i = 1; i < GpsLibFileLen; i++) {
  84. LinkName[i] = DataLib[i];
  85. }
  86. }
  87. void CCurrMapInfo::ClearRoadList(CObList &TempList)
  88. {
  89. CGpsRoadStruct *pRoad;
  90. POSITION pos;
  91. pos = lCurrRoadList.GetHeadPosition();
  92. while(pos != NULL) {
  93. pRoad  = (CGpsRoadStruct*)lCurrRoadList.GetNext(pos);
  94. delete pRoad;
  95. }
  96. lCurrRoadList.RemoveAll();
  97. }
  98. void CCurrMapInfo::ClearCrossList()
  99. {
  100. CGpsRoadCrossPoint *pCross;
  101. POSITION pos;
  102. pos = lCurrCrossList.GetHeadPosition();
  103. while(pos != NULL) {
  104. pCross = (CGpsRoadCrossPoint*)lCurrCrossList.GetNext(pos);
  105. delete pCross;
  106. }
  107. lCurrCrossList.RemoveAll();
  108. }
  109. void CCurrMapInfo::ClearColorBList()
  110. {
  111. CGpsColorBlock *pBlock;
  112. POSITION pos;
  113. pos = lCurrColorBList.GetHeadPosition();
  114. while(pos != NULL) {
  115. pBlock = (CGpsColorBlock*)lCurrColorBList.GetNext(pos);
  116. delete pBlock;
  117. }
  118. lCurrColorBList.RemoveAll();
  119. }
  120. void CCurrMapInfo::ClearSignList()
  121. {
  122. CGpsSignObject *pSign;
  123. POSITION pos;
  124. pos = lCurrSignList.GetHeadPosition();
  125. while(pos != NULL) {
  126. pSign  = (CGpsSignObject*)lCurrSignList.GetNext(pos);
  127. delete pSign;
  128. }
  129. lCurrSignList.RemoveAll();
  130. }
  131. void CCurrMapInfo::ClearAreaLibList()
  132. {
  133. CGpsAreaLibStruct *pArea;
  134. POSITION pos;
  135. pos = lAreaLibList.GetHeadPosition();
  136. while(pos != NULL) {
  137. pArea  = (CGpsAreaLibStruct*)lAreaLibList.GetNext(pos);
  138. delete pArea;
  139. }
  140. lAreaLibList.RemoveAll();
  141. }
  142. void CCurrMapInfo::ClearBRoadSaveList(CObList *TempList)
  143. {
  144. CBRCrossStruct *pCross;
  145. POSITION pos = TempList->GetHeadPosition();
  146. while(pos != NULL) {
  147. pCross = (CBRCrossStruct*)TempList->GetNext(pos);
  148. delete pCross;
  149. }
  150. TempList->RemoveAll();
  151. }
  152. void CCurrMapInfo::ClearPointList(CObList *PointList)
  153. {
  154. CGpsPoint *pPoint;
  155. POSITION pos;
  156. pos = PointList->GetHeadPosition();
  157. while(pos != NULL) {
  158. pPoint = (CGpsPoint*)PointList->GetNext(pos);
  159. delete pPoint;
  160. }
  161. PointList->RemoveAll();
  162. }