#include "showxodrinvtk.h" #include #include #include "xodrfunc.h" static int gnLineIndex = 0; void DrawLine(std::vector & xveclastlp,std::vector & xveclp,pcl::visualization::PCLVisualizer& viewer, double fz) { unsigned int i,j; for(i=0;iGetLaneSectionCount()<1) { qDebug("no lane,return;"); return; } double fRoadLen = pRoad->GetRoadLength(); double s = 0; double fSpace = 0.1; double x,y,fhdg; double flasthdg = 0; double flastS = 0; pRoad->GetGeometryCoords(s,x,y,fhdg); std::vector xveclp = xodrfunc::GetAllLanePoint(pRoad,s,x,y,fhdg); std::vector xveclastlp = xveclp; flasthdg = fhdg; flastS = s; s = s+ fSpace; while(sGetGeometryCoords(s,x,y,fhdg); xveclp = xodrfunc::GetAllLanePoint(pRoad,s,x,y,fhdg); double fhdgdiff = fhdg - flasthdg; double fSDiff = s - flastS; if((fabs(fhdgdiff) > 0.01) || (fSDiff>= 10.0)) { //Draw Line DrawLine(xveclastlp,xveclp,viewer,fz); xveclastlp = xveclp; flasthdg = fhdg; flastS = s; } s= s + fSpace; } if(flastSGetGeometryCoords(fRoadLen,x,y,fhdg); xveclp = xodrfunc::GetAllLanePoint(pRoad,s,x,y,fhdg); DrawLine(xveclastlp,xveclp,viewer,fz); } } void ShowXODRINVTK(pcl::visualization::PCLVisualizer& viewer,double & flon,double & flat,bool & bxodr,double fz) { char strpath[256]; snprintf(strpath,256,"%s/map/map.xodr",getenv("HOME")); OpenDrive xxodr; OpenDriveXmlParser xp(&xxodr); bxodr = xp.ReadFile(strpath); if(bxodr) { xxodr.GetHeader()->GetLat0Lon0(flat,flon); } unsigned int i; for(i=0;i