|
@@ -1908,7 +1908,7 @@ int Road::GetLeftDrivingLaneCount(double s_check)
|
|
|
pLS = GetLaneSection(i);
|
|
|
}
|
|
|
|
|
|
- if(pLS == NULL)return 0;
|
|
|
+ if(pLS == NULL)return -1;
|
|
|
|
|
|
int nrtn;
|
|
|
|
|
@@ -1950,11 +1950,11 @@ int Road::GetRightDrivingLaneCount(double s_check)
|
|
|
pLS = GetLaneSection(i);
|
|
|
}
|
|
|
|
|
|
- if(pLS == NULL)return 0;
|
|
|
+ if(pLS == NULL)return -1;
|
|
|
|
|
|
int nrtn;
|
|
|
|
|
|
- unsigned int nlanecount = pLS->GetLeftLaneCount();
|
|
|
+ unsigned int nlanecount = pLS->GetRightLaneCount();
|
|
|
for(i=0;i<nlanecount;i++)
|
|
|
{
|
|
|
Lane * pLane = pLS->GetRightLaneAt(i+1);
|
|
@@ -1977,6 +1977,153 @@ int Road::GetRightDrivingLaneCount(double s_check)
|
|
|
return nrtn;
|
|
|
}
|
|
|
|
|
|
+//-------------------------------------------------
|
|
|
+
|
|
|
+std::vector<double> Road::GetLaneWidthVector(double s_check,int nlr) //Lane Width, From Refline to side. nlr 1 left 2 right
|
|
|
+{
|
|
|
+ std::vector<double> xrtn;
|
|
|
+ xrtn.clear();
|
|
|
+
|
|
|
+ LaneSection * pLS = NULL;
|
|
|
+
|
|
|
+ unsigned int nsecCount = GetLaneSectionCount();
|
|
|
+ unsigned int i;
|
|
|
+ if(nsecCount == 0)return xrtn;
|
|
|
+ for(i=0;i<nsecCount;i++)
|
|
|
+ {
|
|
|
+ if(GetLaneSection(i)->GetS()>s_check)break;
|
|
|
+ pLS = GetLaneSection(i);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(pLS == NULL)return xrtn;
|
|
|
+
|
|
|
+ if(nlr == 1)
|
|
|
+ {
|
|
|
+ unsigned int nlanecount = pLS->GetLeftLaneCount();
|
|
|
+ for(i=0;i<nlanecount;i++)
|
|
|
+ {
|
|
|
+ Lane * pLane = pLS->GetLeftLaneAt(i+1);
|
|
|
+
|
|
|
+ if(pLane == NULL)
|
|
|
+ {
|
|
|
+ std::cout<<" Road::GetLaneWidthVector Fail."<<" s_check: "<<s_check<<" nlr: "<<nlr<<std::endl;
|
|
|
+ return xrtn;
|
|
|
+ }
|
|
|
+ double fwidth = pLane->GetWidthValue(s_check - pLS->GetS());
|
|
|
+
|
|
|
+ xrtn.push_back(fwidth);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ unsigned int nlanecount = pLS->GetRightLaneCount();
|
|
|
+ for(i=0;i<nlanecount;i++)
|
|
|
+ {
|
|
|
+ Lane * pLane = pLS->GetRightLaneAt(i+1);
|
|
|
+ if(pLane == NULL)
|
|
|
+ {
|
|
|
+ std::cout<<" Road::GetLaneWidthVector Fail."<<" s_check: "<<s_check<<" nlr: "<<nlr<<std::endl;
|
|
|
+ return xrtn;
|
|
|
+ }
|
|
|
+
|
|
|
+ double fwidth = pLane->GetWidthValue(s_check - pLS->GetS());
|
|
|
+
|
|
|
+ xrtn.push_back(fwidth);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return xrtn;
|
|
|
+}
|
|
|
+
|
|
|
+//-------------------------------------------------
|
|
|
+
|
|
|
+int Road::GetLeftLaneCount(double s_check)
|
|
|
+{
|
|
|
+ LaneSection * pLS = NULL;
|
|
|
+
|
|
|
+ unsigned int nsecCount = GetLaneSectionCount();
|
|
|
+ unsigned int i;
|
|
|
+ if(nsecCount == 0)return 0;
|
|
|
+ for(i=0;i<nsecCount;i++)
|
|
|
+ {
|
|
|
+ if(GetLaneSection(i)->GetS()>s_check)break;
|
|
|
+ pLS = GetLaneSection(i);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(pLS == NULL)return 0;
|
|
|
+
|
|
|
+ return static_cast<int>(pLS->GetLeftLaneCount());
|
|
|
+}
|
|
|
+
|
|
|
+//-------------------------------------------------
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+int Road::GetRightLaneCount(double s_check)
|
|
|
+{
|
|
|
+ LaneSection * pLS = NULL;
|
|
|
+
|
|
|
+ unsigned int nsecCount = GetLaneSectionCount();
|
|
|
+ unsigned int i;
|
|
|
+ if(nsecCount == 0)return 0;
|
|
|
+ for(i=0;i<nsecCount;i++)
|
|
|
+ {
|
|
|
+ if(GetLaneSection(i)->GetS()>s_check)break;
|
|
|
+ pLS = GetLaneSection(i);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(pLS == NULL)return -1;
|
|
|
+
|
|
|
+ return static_cast<int>(pLS->GetRightLaneCount());
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+//-------------------------------------------------
|
|
|
+
|
|
|
+LaneRoadMark Road::GetLaneRoadMarkValue(double s_check,int nlane)
|
|
|
+{
|
|
|
+ LaneRoadMark xRoadMark;
|
|
|
+ LaneSection * pLS = NULL;
|
|
|
+
|
|
|
+ unsigned int nsecCount = GetLaneSectionCount();
|
|
|
+ unsigned int i;
|
|
|
+ if(nsecCount == 0)return xRoadMark;
|
|
|
+ for(i=0;i<nsecCount;i++)
|
|
|
+ {
|
|
|
+ if(GetLaneSection(i)->GetS()>s_check)break;
|
|
|
+ pLS = GetLaneSection(i);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(pLS == NULL)return xRoadMark;
|
|
|
+
|
|
|
+ Lane * pLane = NULL;
|
|
|
+
|
|
|
+ if(nlane == 0)pLane = pLS->GetCenterLane();
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(nlane<0)pLane = pLS->GetRightLaneAt(static_cast<unsigned int>(abs(nlane)));
|
|
|
+ else
|
|
|
+ pLane = pLS->GetLeftLaneAt(static_cast<unsigned int>(nlane));
|
|
|
+ }
|
|
|
+
|
|
|
+ if(pLane == NULL)
|
|
|
+ {
|
|
|
+ std::cout<<"Road::GetLaneRoadMark "<<"Can't Find lane s:"<<s_check<<" lane: "<<nlane<<std::endl;
|
|
|
+ return xRoadMark;
|
|
|
+ }
|
|
|
+
|
|
|
+ return pLane->GetRoadMarkValue(s_check - pLS->GetS());
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
|
|
|
//-------------------------------------------------
|
|
|
|