|
@@ -20,7 +20,7 @@ NDSDataProc::NDSDataProc()
|
|
//-2 can't open vehicle data file
|
|
//-2 can't open vehicle data file
|
|
//-3 no valid line data.
|
|
//-3 no valid line data.
|
|
//-4 no valid vehicle data.
|
|
//-4 no valid vehicle data.
|
|
-int NDSDataProc::ProcNDSData(std::string strlinepath,std::string strvehiclepath,OpenDrive * mpxodr)
|
|
|
|
|
|
+int NDSDataProc::ProcNDSData(std::string strlinepath,std::string strvehiclepath,OpenDrive * mpxodr,int nleftlanecount,int nrightlanecount)
|
|
{
|
|
{
|
|
mnProc = 0;
|
|
mnProc = 0;
|
|
mstrState = "Loading Data.";
|
|
mstrState = "Loading Data.";
|
|
@@ -42,6 +42,9 @@ int NDSDataProc::ProcNDSData(std::string strlinepath,std::string strvehiclepath,
|
|
return -2;
|
|
return -2;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ double flaneavgwidthtotal = 0;
|
|
|
|
+ double flaneavgwidth = 3.5;
|
|
|
|
+
|
|
|
|
|
|
std::vector<iv::nds_line> xvectorline;
|
|
std::vector<iv::nds_line> xvectorline;
|
|
std::vector<iv::nds_vehicle> xvectorvehicle;
|
|
std::vector<iv::nds_vehicle> xvectorvehicle;
|
|
@@ -72,10 +75,16 @@ int NDSDataProc::ProcNDSData(std::string strlinepath,std::string strvehiclepath,
|
|
xline.nlanetype = badata[23].toDouble();
|
|
xline.nlanetype = badata[23].toDouble();
|
|
if(xline.feature >=0)xvectorline.push_back(xline);
|
|
if(xline.feature >=0)xvectorline.push_back(xline);
|
|
|
|
|
|
|
|
+ flaneavgwidthtotal = flaneavgwidthtotal + xline.lanewidth;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if(nline>0)
|
|
|
|
+ {
|
|
|
|
+ flaneavgwidth = flaneavgwidthtotal/nline;
|
|
|
|
+ }
|
|
|
|
+
|
|
if(xvectorline.size() < 2)
|
|
if(xvectorline.size() < 2)
|
|
{
|
|
{
|
|
xFileline.close();
|
|
xFileline.close();
|
|
@@ -671,6 +680,64 @@ int NDSDataProc::ProcNDSData(std::string strlinepath,std::string strvehiclepath,
|
|
LaneSection * pLS = p->GetLaneSection(0);
|
|
LaneSection * pLS = p->GetLaneSection(0);
|
|
|
|
|
|
pLS->AddLane(0,0,"none",false);
|
|
pLS->AddLane(0,0,"none",false);
|
|
|
|
+
|
|
|
|
+ int noldtype = 0;
|
|
|
|
+ int ntype = 0;
|
|
|
|
+ Lane * pCenterLane = pLS->GetLastCenterLane();
|
|
|
|
+ if(nleftlanecount == 0)
|
|
|
|
+ {
|
|
|
|
+ if(nvlsize > 0)
|
|
|
|
+ {
|
|
|
|
+ ntype = xvectorvehicle[xvectorvl[0].mvehindex].nleftlanetype;
|
|
|
|
+ pCenterLane->AddRoadMarkRecord(xvectorvehicle[xvectorvl[0].mvehindex].s,roadmarktypetostr(ntype),"standard","white",0.15,"none");
|
|
|
|
+ noldtype = ntype;
|
|
|
|
+ }
|
|
|
|
+ for(i=1;i<(int)(nvlsize-1);i++)
|
|
|
|
+ {
|
|
|
|
+ int ntype = xvectorvehicle[xvectorvl[i].mvehindex].nleftlanetype;
|
|
|
|
+ if(ntype!= noldtype )
|
|
|
|
+ {
|
|
|
|
+ pCenterLane->AddRoadMarkRecord(xvectorvehicle[xvectorvl[i].mvehindex].s,roadmarktypetostr(ntype),"standard","white",0.15,"none");
|
|
|
|
+ noldtype = ntype;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ pCenterLane->AddRoadMarkRecord(0,"solid","standard","yellow",0.15,"none");
|
|
|
|
+ p->AddLaneOffset(0,nleftlanecount*flaneavgwidth,0,0,0);
|
|
|
|
+ int k;
|
|
|
|
+ for(k=0;k<nleftlanecount;k++)
|
|
|
|
+ {
|
|
|
|
+ pLS->AddLane(-1,(-1)*(pLS->GetRightLaneCount()+1),"driving",false);
|
|
|
|
+ Lane * pLane = pLS->GetLastRightLane();
|
|
|
|
+ pLane->AddWidthRecord(0,flaneavgwidth,0,0,0);
|
|
|
|
+ if(k != (nleftlanecount-1))
|
|
|
|
+ {
|
|
|
|
+ pLane->AddRoadMarkRecord(0,"broken","standard","standard",0.15,"none");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if(nvlsize > 0)
|
|
|
|
+ {
|
|
|
|
+ ntype = xvectorvehicle[xvectorvl[0].mvehindex].nleftlanetype;
|
|
|
|
+ pLane->AddRoadMarkRecord(xvectorvehicle[xvectorvl[0].mvehindex].s,roadmarktypetostr(ntype),"standard","white",0.15,"none");
|
|
|
|
+ noldtype = ntype;
|
|
|
|
+ }
|
|
|
|
+ for(i=1;i<(int)(nvlsize-1);i++)
|
|
|
|
+ {
|
|
|
|
+ int ntype = xvectorvehicle[xvectorvl[i].mvehindex].nleftlanetype;
|
|
|
|
+ if(ntype!= noldtype )
|
|
|
|
+ {
|
|
|
|
+ pLane->AddRoadMarkRecord(xvectorvehicle[xvectorvl[i].mvehindex].s,roadmarktypetostr(ntype),"standard","white",0.15,"none");
|
|
|
|
+ noldtype = ntype;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
pLS->AddLane(-1,(-1)*(pLS->GetRightLaneCount()+1),"driving",false);
|
|
pLS->AddLane(-1,(-1)*(pLS->GetRightLaneCount()+1),"driving",false);
|
|
Lane * pLane = pLS->GetLastRightLane();
|
|
Lane * pLane = pLS->GetLastRightLane();
|
|
for(j=0;j<(int)xvectorwidthabcd.size();j++)
|
|
for(j=0;j<(int)xvectorwidthabcd.size();j++)
|
|
@@ -685,24 +752,7 @@ int NDSDataProc::ProcNDSData(std::string strlinepath,std::string strvehiclepath,
|
|
p->AddElevation(pwa->s,pwa->A,pwa->B,pwa->C,pwa->D);
|
|
p->AddElevation(pwa->s,pwa->A,pwa->B,pwa->C,pwa->D);
|
|
}
|
|
}
|
|
|
|
|
|
- int noldtype = 0;
|
|
|
|
- int ntype = 0;
|
|
|
|
- Lane * pCenterLane = pLS->GetLastCenterLane();
|
|
|
|
- if(nvlsize > 0)
|
|
|
|
- {
|
|
|
|
- ntype = xvectorvehicle[xvectorvl[0].mvehindex].nleftlanetype;
|
|
|
|
- pCenterLane->AddRoadMarkRecord(xvectorvehicle[xvectorvl[0].mvehindex].s,roadmarktypetostr(ntype),"standard","white",0.15,"none");
|
|
|
|
- noldtype = ntype;
|
|
|
|
- }
|
|
|
|
- for(i=1;i<(int)(nvlsize-1);i++)
|
|
|
|
- {
|
|
|
|
- int ntype = xvectorvehicle[xvectorvl[i].mvehindex].nleftlanetype;
|
|
|
|
- if(ntype!= noldtype )
|
|
|
|
- {
|
|
|
|
- pCenterLane->AddRoadMarkRecord(xvectorvehicle[xvectorvl[i].mvehindex].s,roadmarktypetostr(ntype),"standard","white",0.15,"none");
|
|
|
|
- noldtype = ntype;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
|
|
noldtype = 0;
|
|
noldtype = 0;
|
|
ntype = 0;
|
|
ntype = 0;
|
|
@@ -722,6 +772,21 @@ int NDSDataProc::ProcNDSData(std::string strlinepath,std::string strvehiclepath,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ for(i=0;i<nrightlanecount;i++)
|
|
|
|
+ {
|
|
|
|
+ pLS->AddLane(-1,(-1)*(pLS->GetRightLaneCount()+1),"driving",false);
|
|
|
|
+ Lane * pLane = pLS->GetLastRightLane();
|
|
|
|
+ pLane->AddWidthRecord(0,flaneavgwidth,0,0,0);
|
|
|
|
+ if(i != (nrightlanecount-1))
|
|
|
|
+ {
|
|
|
|
+ pLane->AddRoadMarkRecord(0,"broken","standard","standard",0.15,"none");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ pLane->AddRoadMarkRecord(0,"solid","standard","standard",0.15,"none");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
mnProc = 100;
|
|
mnProc = 100;
|
|
mstrState = " Complete. ";
|
|
mstrState = " Complete. ";
|