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

交通/航空行业

开发平台:

Visual C++

  1. // GpsRoadStruct.cpp: implementation of the CGpsRoadStruct class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include "stdafx.h"
  5. #include "GpsSC.h"
  6. #include "GpsRoadStruct.h"
  7. #include "SmallRoadStruct.h"
  8. #ifdef _DEBUG
  9. #undef THIS_FILE
  10. static char THIS_FILE[]=__FILE__;
  11. #define new DEBUG_NEW
  12. #endif
  13. //////////////////////////////////////////////////////////////////////
  14. // Construction/Destruction
  15. //////////////////////////////////////////////////////////////////////
  16. CGpsRoadStruct::CGpsRoadStruct()
  17. {
  18. BigRoad_SN_Bytes = 1;
  19. BigRoad_Serial = 0;
  20. m_BigRoad_Number = 0;
  21. m_byBigRoad_Number_Bytes = 2;
  22. SmallRoadTotal = 0;
  23. SmallRoadTotal_Bytes= 1; //相同的两个字节表示
  24. m_byIsHelpRoad = 0;
  25. m_byHelpRoad_Bytes = 1;
  26. ClearSmallRoadList();
  27. }
  28. CGpsRoadStruct::~CGpsRoadStruct()
  29. {
  30. ClearSmallRoadList();
  31. }
  32. CGpsRoadStruct::ClearSmallRoadList()
  33. {
  34. CSmallRoadStruct *pSmallRoadStruct;
  35. POSITION pos = SmallRoadList.GetHeadPosition();
  36. while(pos != NULL) {
  37. pSmallRoadStruct = (CSmallRoadStruct*)SmallRoadList.GetNext(pos);
  38. delete pSmallRoadStruct;
  39. }
  40. SmallRoadList.RemoveAll();
  41. }
  42. CGpsRoadStruct& CGpsRoadStruct::operator = (const CGpsRoadStruct& ds)
  43. {
  44. BigRoad_Serial = ds.BigRoad_Serial;
  45. m_BigRoad_Number = ds.m_BigRoad_Number;
  46. SmallRoadTotal = ds.SmallRoadTotal;
  47. CopyRoadList(&ds.SmallRoadList,&SmallRoadList);
  48. return *this;
  49. }
  50. CGpsRoadStruct::CopyRoadList(const CObList *SourceList,CObList *DestList)
  51. {
  52. CSmallRoadStruct *pSmallRoad,*pTemp;
  53. POSITION pos;
  54. pos = SourceList->GetTailPosition();
  55. while(pos != NULL) {
  56. pSmallRoad = (CSmallRoadStruct*)SourceList->GetPrev(pos);
  57. pTemp  = new CSmallRoadStruct;
  58. *pTemp = *pSmallRoad;
  59. DestList->AddHead(pTemp);
  60. }
  61. }