|
@@ -46,6 +46,10 @@ void CollectConvert::ConvertRoad(iv::map::collectvehroad *proad, OpenDrive *pxod
|
|
|
// double fl2 = ppoint->mflat();
|
|
|
GaussProjCal(ppoint->mflon(),ppoint->mflat(),&x,&y);
|
|
|
iv::collectxy xc;
|
|
|
+ xc.mLaneColor_Left = ppoint->mlanecolor_left();
|
|
|
+ xc.mLaneColor_Right = ppoint->mlanecolor_right();
|
|
|
+ xc.mLaneType_Left = ppoint->mlanetype_left();
|
|
|
+ xc.mLaneType_Right = ppoint->mlanetype_right();
|
|
|
xc.height = 0;
|
|
|
xc.width = ppoint->mflanewidth();
|
|
|
xc.fhdg = (90 -ppoint->mfheading())*M_PI/180.0;
|
|
@@ -363,6 +367,27 @@ void CollectConvert::ConvertRoad(iv::map::collectvehroad *proad, OpenDrive *pxod
|
|
|
LaneSection * pLS = p->GetLaneSection(0);
|
|
|
|
|
|
pLS->AddLane(0,0,"none",false);
|
|
|
+ Lane * pCenterLane = pLS->GetLastAddedLane();
|
|
|
+ iv::map::collectvehroadpoint_LaneType xLastType;
|
|
|
+ if(xvectorcollectxy.size()>0)
|
|
|
+ {
|
|
|
+ xLastType = xvectorcollectxy[0].mLaneType_Left;
|
|
|
+ std::string strlanecolor = "white";
|
|
|
+ if(xvectorcollectxy[0].mLaneColor_Left == iv::map::collectvehroadpoint_LaneColor_YELLOW)strlanecolor = "yellow";
|
|
|
+ pCenterLane->AddRoadMarkRecord(xvectorcollectxy[0].s,LaneTypeToStr(xLastType),
|
|
|
+ "standard",strlanecolor,0.15,"none");
|
|
|
+ }
|
|
|
+ for(i=1;i<(int)xvectorcollectxy.size();i++)
|
|
|
+ {
|
|
|
+ if(xvectorcollectxy[i].mLaneType_Left != xLastType)
|
|
|
+ {
|
|
|
+ xLastType = xvectorcollectxy[i].mLaneType_Left;
|
|
|
+ std::string strlanecolor = "white";
|
|
|
+ if(xvectorcollectxy[i].mLaneColor_Left == iv::map::collectvehroadpoint_LaneColor_YELLOW)strlanecolor = "yellow";
|
|
|
+ pCenterLane->AddRoadMarkRecord(xvectorcollectxy[i].s,LaneTypeToStr(xLastType),
|
|
|
+ "standard",strlanecolor,0.15,"none");
|
|
|
+ }
|
|
|
+ }
|
|
|
pLS->AddLane(-1,(-1)*(pLS->GetRightLaneCount()+1),"driving",false);
|
|
|
Lane * pLane = pLS->GetLastRightLane();
|
|
|
for(j=0;j<(int)xvectorwidthabcd.size();j++)
|
|
@@ -371,6 +396,94 @@ void CollectConvert::ConvertRoad(iv::map::collectvehroad *proad, OpenDrive *pxod
|
|
|
pLane->AddWidthRecord(pwa->s,pwa->A,pwa->B,pwa->C,pwa->D);
|
|
|
}
|
|
|
|
|
|
+ if(xvectorcollectxy.size()>0)
|
|
|
+ {
|
|
|
+ xLastType = xvectorcollectxy[0].mLaneType_Right;
|
|
|
+ std::string strlanecolor = "white";
|
|
|
+ if(xvectorcollectxy[0].mLaneColor_Right == iv::map::collectvehroadpoint_LaneColor_YELLOW)strlanecolor = "yellow";
|
|
|
+ pLane->AddRoadMarkRecord(xvectorcollectxy[0].s,LaneTypeToStr(xLastType),
|
|
|
+ "standard",strlanecolor,0.15,"none");
|
|
|
+ }
|
|
|
+ for(i=1;i<(int)xvectorcollectxy.size();i++)
|
|
|
+ {
|
|
|
+ if(xvectorcollectxy[i].mLaneType_Right != xLastType)
|
|
|
+ {
|
|
|
+ xLastType = xvectorcollectxy[i].mLaneType_Right;
|
|
|
+ std::string strlanecolor = "white";
|
|
|
+ if(xvectorcollectxy[i].mLaneColor_Right == iv::map::collectvehroadpoint_LaneColor_YELLOW)strlanecolor = "yellow";
|
|
|
+ pLane->AddRoadMarkRecord(xvectorcollectxy[i].s,LaneTypeToStr(xLastType),
|
|
|
+ "standard",strlanecolor,0.15,"none");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+std::string CollectConvert::LaneTypeToStr(iv::map::collectvehroadpoint_LaneType xType)
|
|
|
+{
|
|
|
+ switch (xType) {
|
|
|
+ case iv::map::collectvehroadpoint_LaneType_NONE:
|
|
|
+ return "none";
|
|
|
+ break;
|
|
|
+ case iv::map::collectvehroadpoint_LaneType_SOLID:
|
|
|
+ return "solid";
|
|
|
+ break;
|
|
|
+ case iv::map::collectvehroadpoint_LaneType_DASH:
|
|
|
+ return "broken";
|
|
|
+ break;
|
|
|
+ case iv::map::collectvehroadpoint_LaneType_SOLID_SOLID:
|
|
|
+ return "solid solid";
|
|
|
+ break;
|
|
|
+ case iv::map::collectvehroadpoint_LaneType_SOLID_DASH:
|
|
|
+ return "solid broken";
|
|
|
+ break;
|
|
|
+ case iv::map::collectvehroadpoint_LaneType_DASH_SOLID:
|
|
|
+ return "broken solid";
|
|
|
+ break;
|
|
|
+ case iv::map::collectvehroadpoint_LaneType_DASH_DASH:
|
|
|
+ return "broken broken";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ return "none";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void CollectConvert::convertconnect(iv::map::roadconnect *pconnect, OpenDrive *pxodr)
|
|
|
+{
|
|
|
+ Road * p1, * p2;
|
|
|
+ std::string strroad1name = pconnect->strroad1();
|
|
|
+ std::string strroad2name = pconnect->strroad2();
|
|
|
+ int i;
|
|
|
+ p1 = NULL;
|
|
|
+ p2 = NULL;
|
|
|
+ for(i=0;i<(int)pxodr->GetRoadCount();i++)
|
|
|
+ {
|
|
|
+ if(pxodr->GetRoad(i)->GetRoadName() == strroad1name)
|
|
|
+ {
|
|
|
+ p1 = pxodr->GetRoad(i);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for(i=0;i<(int)pxodr->GetRoadCount();i++)
|
|
|
+ {
|
|
|
+ if(pxodr->GetRoad(i)->GetRoadName() == strroad2name)
|
|
|
+ {
|
|
|
+ p2 = pxodr->GetRoad(i);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if((p1 == NULL)||(p2 == NULL))
|
|
|
+ {
|
|
|
+ std::cout<<"convertconnect can not find road. "<<std::endl;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ double startx,starty,starthdg;
|
|
|
+ double endx,endy,endhdg;
|
|
|
+ p1->GetGeometryCoords(p1->GetRoadLength() - 0.001,startx,starty,starthdg);
|
|
|
+ p2->GetGeometryCoords(0,endx,endy,endhdg);
|
|
|
|
|
|
|
|
|
}
|