|
@@ -10,6 +10,10 @@ namespace iv {
|
|
|
RoadSample::RoadSample(Road * pRoad)
|
|
|
{
|
|
|
SampleRoad(pRoad);
|
|
|
+
|
|
|
+ std::vector<RoadPoint> xvectorRoadPoint = mvectorRoadPoint;
|
|
|
+
|
|
|
+ int n = 1;
|
|
|
}
|
|
|
|
|
|
int RoadSample::SampleRoad(Road * pRoad)
|
|
@@ -19,10 +23,11 @@ int RoadSample::SampleRoad(Road * pRoad)
|
|
|
mstrroadname = pRoad->GetRoadName();
|
|
|
|
|
|
double fS = 0;
|
|
|
- const double fStep = 0;
|
|
|
+ const double fStep = 0.1;
|
|
|
LaneSection * pLS;
|
|
|
unsigned int nLSCount = pRoad->GetLaneSectionCount();
|
|
|
unsigned int i;
|
|
|
+ int nSec = 0;
|
|
|
|
|
|
for(i=0;i<nLSCount;i++)
|
|
|
{
|
|
@@ -35,14 +40,41 @@ int RoadSample::SampleRoad(Road * pRoad)
|
|
|
|
|
|
double fLastRefX,fLastRefY,fLastRefZ,fLastRefHdg,fLastOffsetValue,fLastS;
|
|
|
bool bHaveLast = false;
|
|
|
+ std::vector<LanePoint> xvectorLastLanePoint;
|
|
|
|
|
|
- while(fS<pLS->GetS2())
|
|
|
+ double send_Section = pLS->GetS();
|
|
|
+ if(i == (nLSCount -1))
|
|
|
+ {
|
|
|
+ send_Section = pRoad->GetRoadLength();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LaneSection * pLSNext = pRoad->GetLaneSection(i+1);
|
|
|
+ if(pLSNext != NULL)
|
|
|
+ {
|
|
|
+ send_Section = pLSNext->GetS();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ nSec++;
|
|
|
+ while(fS<send_Section)
|
|
|
{
|
|
|
double fRefX,fRefY,fRefZ,fRefHdg,fOffsetValue;
|
|
|
pRoad->GetGeometryCoords(fS,fRefX,fRefY,fRefHdg);
|
|
|
fRefZ = pRoad->GetElevationValue(fS);
|
|
|
fOffsetValue = pRoad->GetLaneOffsetValue(fS);
|
|
|
|
|
|
+ if(fabs(send_Section - fS)<0.1)
|
|
|
+ {
|
|
|
+ if(i == (nLSCount - 1))
|
|
|
+ {
|
|
|
+ fS = send_Section;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ break; //If Not Last Section, use Next Section Start Value.
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
RoadPoint xRP;
|
|
|
xRP.ms = fS;
|
|
|
xRP.mfRefX = fRefX;
|
|
@@ -50,10 +82,12 @@ int RoadSample::SampleRoad(Road * pRoad)
|
|
|
xRP.mfRefZ = fRefZ;
|
|
|
xRP.mfHdg = fRefHdg;
|
|
|
xRP.mfLaneOffValue = fOffsetValue;
|
|
|
+ xRP.nSecNum = nSec;
|
|
|
|
|
|
std::vector<LanePoint> xvectorLanePoint;
|
|
|
SampleLanePoint(pRoad,pLS,fS,xvectorLanePoint);
|
|
|
|
|
|
+
|
|
|
bool bInserPoint = false;
|
|
|
|
|
|
if(bHaveLast == false)
|
|
@@ -68,21 +102,36 @@ int RoadSample::SampleRoad(Road * pRoad)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if((fabs((fRefHdg - fLastRefHdg)/(fS - fLastS))>0.01) ||((fS - fLastS)>10))
|
|
|
+ if((fabs((fRefHdg - fLastRefHdg)/(fS - fLastS))>0.01) ||((fS - fLastS)>=10.0))
|
|
|
{
|
|
|
bInserPoint = true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if((bInserPoint == false)&&(bHaveLast))
|
|
|
+ {
|
|
|
+ if(IsMarkChange(xvectorLanePoint,xvectorLastLanePoint))
|
|
|
+ {
|
|
|
+ bInserPoint = true;
|
|
|
+ nSec++;
|
|
|
+ xRP.nSecNum = nSec;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
if(bInserPoint)
|
|
|
{
|
|
|
+ xRP.mvectorLanePoint = xvectorLanePoint;
|
|
|
+ mvectorRoadPoint.push_back(xRP);
|
|
|
+
|
|
|
fLastS = fS;
|
|
|
fLastRefX = fRefX;
|
|
|
fLastRefY = fRefY;
|
|
|
fLastRefZ = fRefZ;
|
|
|
fLastRefHdg = fRefHdg;
|
|
|
fLastOffsetValue = fOffsetValue;
|
|
|
+ xvectorLastLanePoint = xvectorLanePoint;
|
|
|
bHaveLast = true;
|
|
|
}
|
|
|
|
|
@@ -185,6 +234,39 @@ int RoadSample::SampleLanePoint(Road * pRoad,LaneSection * pLS, double fS,std::v
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+bool RoadSample::IsMarkChange(std::vector<LanePoint> & xvectorLastLanePoint,std::vector<LanePoint> & xvectorLanePoint)
|
|
|
+{
|
|
|
+ if(xvectorLanePoint.size() != xvectorLastLanePoint.size())
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ unsigned int i;
|
|
|
+ unsigned int nSize = static_cast<unsigned int >(xvectorLanePoint.size());
|
|
|
+
|
|
|
+ for(i=0;i<nSize;i++)
|
|
|
+ {
|
|
|
+ if(xvectorLanePoint[i].mstrroadmarkcolor != xvectorLastLanePoint[i].mstrroadmarkcolor)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if(xvectorLanePoint[i].mstrroadmarktype != xvectorLastLanePoint[i].mstrroadmarktype)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+std::vector<RoadPoint> * RoadSample::GetRoadPointVector()
|
|
|
+{
|
|
|
+ return &mvectorRoadPoint;
|
|
|
+}
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
|