|
@@ -0,0 +1,72 @@
|
|
|
|
+#include "cdaproc.h"
|
|
|
|
+
|
|
|
|
+#include <iostream>
|
|
|
|
+
|
|
|
|
+CDAProc::CDAProc()
|
|
|
|
+{
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+int CDAProc::ProcLineRoad(OpenDrive * pxodr, std::string strtype,std::string strradius,std::string strroadlen,std::string strlanewidth,
|
|
|
|
+ std::string strlannecount,std::string strlanetype,std::string strlanemarkcolor,std::string strlanemarktype)
|
|
|
|
+{
|
|
|
|
+
|
|
|
|
+ pxodr->AddRoad("zl",atof(strroadlen.data()),"1","-1");
|
|
|
|
+ Road * pRoad = pxodr->GetLastAddedRoad();
|
|
|
|
+ pRoad->AddGeometryBlock();
|
|
|
|
+ GeometryBlock * pgeob = pRoad->GetLastAddedGeometryBlock();
|
|
|
|
+ pgeob->AddGeometryLine(0,0,0,0,atof(strroadlen.data()));
|
|
|
|
+ pRoad->AddLaneSection(0);
|
|
|
|
+ LaneSection * pLS = pRoad->GetLaneSection(0);
|
|
|
|
+ pLS->AddLane(0,0,"none",false);
|
|
|
|
+ Lane * pcenterlane = pLS->GetLastAddedLane();
|
|
|
|
+ pcenterlane->AddRoadMarkRecord(0,"solid solid","standard","yellow",0.15,"none");
|
|
|
|
+
|
|
|
|
+ int nlanecount = atoi(strlannecount.data());
|
|
|
|
+ double flanewidth = atof(strlanewidth.data());
|
|
|
|
+ int i;
|
|
|
|
+ for(i=0;i<nlanecount;i++)
|
|
|
|
+ {
|
|
|
|
+ pLS->AddLane(-1,(i+1)*(-1),"driving",false,true);
|
|
|
|
+ Lane * pnewlane = pLS->GetLastAddedLane();
|
|
|
|
+ pnewlane->AddWidthRecord(0,flanewidth,0,0,0);
|
|
|
|
+ if(i == (nlanecount -1))
|
|
|
|
+ {
|
|
|
|
+ pnewlane->AddRoadMarkRecord(0,"solid","standard","standard",0.15,"none");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ pnewlane->AddRoadMarkRecord(0,"broken","standard","standard",0.15,"none");
|
|
|
|
+ }
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+int CDAProc::Proc(std::string strxlsxpath,OpenDrive * pxodr)
|
|
|
|
+{
|
|
|
|
+ void * pexcel = ServiceExcelAPI.Openxlsx(strxlsxpath);
|
|
|
|
+
|
|
|
|
+ std::string strtype;
|
|
|
|
+ std::string strradius;
|
|
|
|
+ std::string strroadlen;
|
|
|
|
+ std::string strlanewidth;
|
|
|
|
+ std::string strlannecount;
|
|
|
|
+ std::string strlanetype;
|
|
|
|
+ std::string strlanemarkcolor;
|
|
|
|
+ std::string strlanemarktype;
|
|
|
|
+ ServiceExcelAPI.getcellvalue(pexcel,119,4,strtype);
|
|
|
|
+ ServiceExcelAPI.getcellvalue(pexcel,129,4,strradius);
|
|
|
|
+ ServiceExcelAPI.getcellvalue(pexcel,121,4,strroadlen);
|
|
|
|
+ ServiceExcelAPI.getcellvalue(pexcel,122,4,strlanewidth);
|
|
|
|
+ ServiceExcelAPI.getcellvalue(pexcel,123,4,strlannecount);
|
|
|
|
+ ServiceExcelAPI.getcellvalue(pexcel,124,4,strlanetype);
|
|
|
|
+ ServiceExcelAPI.getcellvalue(pexcel,125,4,strlanemarkcolor);
|
|
|
|
+ ServiceExcelAPI.getcellvalue(pexcel,126,4,strlanemarktype);
|
|
|
|
+ std::cout<<"type : "<<strtype<<std::endl;
|
|
|
|
+ ServiceExcelAPI.Closexlsx(pexcel);
|
|
|
|
+
|
|
|
|
+ if(strtype == "直路" )
|
|
|
|
+ {
|
|
|
|
+ std::cout<<" is zl . "<<std::endl;
|
|
|
|
+ return ProcLineRoad(pxodr,strtype,strradius,strroadlen,strlanewidth,strlannecount,strlanetype,strlanemarkcolor,strlanemarktype);
|
|
|
|
+ }
|
|
|
|
+ return 0;
|
|
|
|
+}
|