|
@@ -370,3 +370,69 @@ int CDAProc::Proc(std::string strxlsxpath,OpenDrive * pxodr)
|
|
|
|
|
|
return ProcRoad(pxodr,strtype,strradius,strroadlen,strlanewidth,strlannecount,strlanemarktype,strlanemarkcolor,strlanemarktype);
|
|
|
}
|
|
|
+
|
|
|
+#include <QDateTime>
|
|
|
+#include <OpenDrive/OpenDriveXmlWriter.h>
|
|
|
+int CDAProc::ProcRoads(std::string strxlsxpath,std::string stroutpath)
|
|
|
+{
|
|
|
+ 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;
|
|
|
+ std::string strname;
|
|
|
+ bool bComplete = false;
|
|
|
+ int i = 4;
|
|
|
+ int nr = 0;
|
|
|
+ while(bComplete == false)
|
|
|
+ {
|
|
|
+ strtype = "";
|
|
|
+ strname = "";
|
|
|
+ ServiceExcelAPI.getcellvalue(pexcel,26,i,strname);
|
|
|
+ ServiceExcelAPI.getcellvalue(pexcel,119,i,strtype);
|
|
|
+ ServiceExcelAPI.getcellvalue(pexcel,120,i,strradius);
|
|
|
+ ServiceExcelAPI.getcellvalue(pexcel,121,i,strroadlen);
|
|
|
+ ServiceExcelAPI.getcellvalue(pexcel,122,i,strlanewidth);
|
|
|
+ ServiceExcelAPI.getcellvalue(pexcel,123,i,strlannecount);
|
|
|
+ // ServiceExcelAPI.getcellvalue(pexcel,124,4,strlanetype);
|
|
|
+ ServiceExcelAPI.getcellvalue(pexcel,124,i,strlanemarkcolor);
|
|
|
+ ServiceExcelAPI.getcellvalue(pexcel,125,i,strlanemarktype);
|
|
|
+ if((strtype == "")||(strname == ""))
|
|
|
+ {
|
|
|
+ bComplete = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ std::cout<<" name : "<<strname<<" type: "<<strtype<<std::endl;
|
|
|
+ OpenDrive xxodr;
|
|
|
+ int nrtn = ProcRoad(&xxodr,strtype,strradius,strroadlen,strlanewidth,strlannecount,strlanemarktype,strlanemarkcolor,strlanemarktype);
|
|
|
+ if(nrtn == 0)
|
|
|
+ {
|
|
|
+ if(xxodr.GetHeader() == NULL)
|
|
|
+ {
|
|
|
+ xxodr.SetHeader(1,1,"adcmap",1.1,QDateTime::currentDateTime().toString("yyyy-MM-dd").toLatin1().data(),0,0,0,0,39,117,0);
|
|
|
+ xxodr.GetHeader()->SetVendor("adc");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ xxodr.GetHeader()->SetVendor("adc");
|
|
|
+ }
|
|
|
+ OpenDriveXmlWriter x(&xxodr);
|
|
|
+ std::string strfilepath = stroutpath + "/"+ strname+".xodr";
|
|
|
+ x.WriteFile(strfilepath);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ nr = nr + nrtn;
|
|
|
+ std::cout<<" Convert row "<<i<<" name: "<<strname<<" fail. fail code : "<<nrtn<<std::endl;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ ServiceExcelAPI.Closexlsx(pexcel);
|
|
|
+ return nr;
|
|
|
+}
|