|
@@ -3,7 +3,7 @@
|
|
#include <math.h>
|
|
#include <math.h>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
+#include <iostream>
|
|
|
|
|
|
//***********************************************************************************
|
|
//***********************************************************************************
|
|
//Road segment
|
|
//Road segment
|
|
@@ -289,7 +289,7 @@ LaneSection* Road::GetLaneSection(unsigned int i)
|
|
}
|
|
}
|
|
unsigned int Road::GetLaneSectionCount()
|
|
unsigned int Road::GetLaneSectionCount()
|
|
{
|
|
{
|
|
- return mLaneSectionsVector.size();
|
|
|
|
|
|
+ return static_cast<unsigned int>(mLaneSectionsVector.size()) ;
|
|
}
|
|
}
|
|
|
|
|
|
// Road lane offset records
|
|
// Road lane offset records
|
|
@@ -1821,6 +1821,162 @@ void Road::FillLaneSectionSample(double s_check, LaneSectionSample& laneSection
|
|
|
|
|
|
//-------------------------------------------------
|
|
//-------------------------------------------------
|
|
|
|
|
|
|
|
+std::vector<double> Road::GetDrivingLaneWidthVector(double s_check,int nlr)
|
|
|
|
+{
|
|
|
|
+ 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;
|
|
|
|
+ }
|
|
|
|
+ if(pLane->GetType() != "driving")
|
|
|
|
+ {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ 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;
|
|
|
|
+ }
|
|
|
|
+ if(pLane->GetType() != "driving")
|
|
|
|
+ {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ double fwidth = pLane->GetWidthValue(s_check - pLS->GetS());
|
|
|
|
+
|
|
|
|
+ xrtn.push_back(fwidth);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return xrtn;
|
|
|
|
+}
|
|
|
|
+//-------------------------------------------------
|
|
|
|
+
|
|
|
|
+int Road::GetLeftDrivingLaneCount(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;
|
|
|
|
+
|
|
|
|
+ int nrtn;
|
|
|
|
+
|
|
|
|
+ unsigned int nlanecount = pLS->GetLeftLaneCount();
|
|
|
|
+ for(i=0;i<nlanecount;i++)
|
|
|
|
+ {
|
|
|
|
+ Lane * pLane = pLS->GetLeftLaneAt(i+1);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if(pLane == NULL)
|
|
|
|
+ {
|
|
|
|
+ return nrtn;
|
|
|
|
+ }
|
|
|
|
+ if(pLane->GetType() != "driving")
|
|
|
|
+ {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ nrtn++;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return nrtn;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//-------------------------------------------------
|
|
|
|
+
|
|
|
|
+int Road::GetRightDrivingLaneCount(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;
|
|
|
|
+
|
|
|
|
+ int nrtn;
|
|
|
|
+
|
|
|
|
+ unsigned int nlanecount = pLS->GetLeftLaneCount();
|
|
|
|
+ for(i=0;i<nlanecount;i++)
|
|
|
|
+ {
|
|
|
|
+ Lane * pLane = pLS->GetRightLaneAt(i+1);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if(pLane == NULL)
|
|
|
|
+ {
|
|
|
|
+ return nrtn;
|
|
|
|
+ }
|
|
|
|
+ if(pLane->GetType() != "driving")
|
|
|
|
+ {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ nrtn++;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return nrtn;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//-------------------------------------------------
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Destructor
|
|
* Destructor
|
|
*/
|
|
*/
|