cdaproc.cpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #include "cdaproc.h"
  2. #include <iostream>
  3. CDAProc::CDAProc()
  4. {
  5. }
  6. int CDAProc::ProcLineRoad(OpenDrive * pxodr, std::string strtype,std::string strradius,std::string strroadlen,std::string strlanewidth,
  7. std::string strlannecount,std::string strlanetype,std::string strlanemarkcolor,std::string strlanemarktype)
  8. {
  9. pxodr->AddRoad("zl",atof(strroadlen.data()),"1","-1");
  10. Road * pRoad = pxodr->GetLastAddedRoad();
  11. pRoad->AddGeometryBlock();
  12. GeometryBlock * pgeob = pRoad->GetLastAddedGeometryBlock();
  13. pgeob->AddGeometryLine(0,0,0,0,atof(strroadlen.data()));
  14. pRoad->AddLaneSection(0);
  15. LaneSection * pLS = pRoad->GetLaneSection(0);
  16. pLS->AddLane(0,0,"none",false);
  17. Lane * pcenterlane = pLS->GetLastAddedLane();
  18. pcenterlane->AddRoadMarkRecord(0,"solid solid","standard","yellow",0.15,"none");
  19. int nlanecount = atoi(strlannecount.data());
  20. double flanewidth = atof(strlanewidth.data());
  21. int i;
  22. for(i=0;i<nlanecount;i++)
  23. {
  24. pLS->AddLane(-1,(i+1)*(-1),"driving",false,true);
  25. Lane * pnewlane = pLS->GetLastAddedLane();
  26. pnewlane->AddWidthRecord(0,flanewidth,0,0,0);
  27. if(i == (nlanecount -1))
  28. {
  29. pnewlane->AddRoadMarkRecord(0,"solid","standard","standard",0.15,"none");
  30. }
  31. else
  32. pnewlane->AddRoadMarkRecord(0,"broken","standard","standard",0.15,"none");
  33. }
  34. return 0;
  35. }
  36. int CDAProc::Proc(std::string strxlsxpath,OpenDrive * pxodr)
  37. {
  38. void * pexcel = ServiceExcelAPI.Openxlsx(strxlsxpath);
  39. std::string strtype;
  40. std::string strradius;
  41. std::string strroadlen;
  42. std::string strlanewidth;
  43. std::string strlannecount;
  44. std::string strlanetype;
  45. std::string strlanemarkcolor;
  46. std::string strlanemarktype;
  47. ServiceExcelAPI.getcellvalue(pexcel,119,4,strtype);
  48. ServiceExcelAPI.getcellvalue(pexcel,129,4,strradius);
  49. ServiceExcelAPI.getcellvalue(pexcel,121,4,strroadlen);
  50. ServiceExcelAPI.getcellvalue(pexcel,122,4,strlanewidth);
  51. ServiceExcelAPI.getcellvalue(pexcel,123,4,strlannecount);
  52. ServiceExcelAPI.getcellvalue(pexcel,124,4,strlanetype);
  53. ServiceExcelAPI.getcellvalue(pexcel,125,4,strlanemarkcolor);
  54. ServiceExcelAPI.getcellvalue(pexcel,126,4,strlanemarktype);
  55. std::cout<<"type : "<<strtype<<std::endl;
  56. ServiceExcelAPI.Closexlsx(pexcel);
  57. if(strtype == "直路" )
  58. {
  59. std::cout<<" is zl . "<<std::endl;
  60. return ProcLineRoad(pxodr,strtype,strradius,strroadlen,strlanewidth,strlannecount,strlanetype,strlanemarkcolor,strlanemarktype);
  61. }
  62. return 0;
  63. }