|
@@ -64,6 +64,7 @@ Road::Road (const Road& road)
|
|
|
mLaneOffsetVector=road.mLaneOffsetVector;
|
|
|
mRoadBorrowVector = road.mRoadBorrowVector;
|
|
|
mRoadNoavoidVector = road.mRoadNoavoidVector;
|
|
|
+ mSurfaceCRGVector = road.mSurfaceCRGVector;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -109,6 +110,7 @@ const Road& Road::operator=(const Road& otherRoad)
|
|
|
mLaneOffsetVector=otherRoad.mLaneOffsetVector;
|
|
|
mRoadBorrowVector = otherRoad.mRoadBorrowVector;
|
|
|
mRoadNoavoidVector = otherRoad.mRoadNoavoidVector;
|
|
|
+ mSurfaceCRGVector = otherRoad.mSurfaceCRGVector;
|
|
|
}
|
|
|
return *this;
|
|
|
}
|
|
@@ -455,22 +457,22 @@ unsigned int Road::GetRoadNoavoidCount()
|
|
|
return mRoadNoavoidVector.size();
|
|
|
}
|
|
|
//-------------------------------------------------
|
|
|
-vector<surface> *Road::GetSurfaceVector()
|
|
|
+vector<surface_CRG> *Road::GetSurfaceCRGVector()
|
|
|
{
|
|
|
- return &mSurfaceVector;
|
|
|
+ return &mSurfaceCRGVector;
|
|
|
}
|
|
|
|
|
|
-surface* Road::GetSurface(unsigned int i)
|
|
|
+surface_CRG* Road::GetSurfaceCRG(unsigned int i)
|
|
|
{
|
|
|
- if((mSurfaceVector.size()>0)&&(i<mSurfaceVector.size()))
|
|
|
- return &mSurfaceVector.at(i);
|
|
|
+ if((mSurfaceCRGVector.size()>0)&&(i<mSurfaceCRGVector.size()))
|
|
|
+ return &mSurfaceCRGVector.at(i);
|
|
|
else
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
|
-unsigned int Road::GetSurfaceCount()
|
|
|
+unsigned int Road::GetSurfaceCRGCount()
|
|
|
{
|
|
|
- return static_cast<unsigned int>(mSurfaceVector.size());
|
|
|
+ return static_cast<unsigned int>(mSurfaceCRGVector.size());
|
|
|
}
|
|
|
//-------------------------------------------------
|
|
|
|
|
@@ -581,10 +583,10 @@ RoadNoavoid* Road::GetLastRoadNoavoid()
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
|
-surface * Road::GetLastSurface()
|
|
|
+surface_CRG * Road::GetLastSurfaceCRG()
|
|
|
{
|
|
|
- if(mSurfaceVector.size()>0)
|
|
|
- return &mSurfaceVector.at(mSurfaceVector.size()-1);
|
|
|
+ if(mSurfaceCRGVector.size()>0)
|
|
|
+ return &mSurfaceCRGVector.at(mSurfaceCRGVector.size()-1);
|
|
|
else
|
|
|
return NULL;
|
|
|
}
|
|
@@ -695,10 +697,10 @@ RoadNoavoid* Road::GetLastAddedRoadNoavoid()
|
|
|
else
|
|
|
return NULL;
|
|
|
}
|
|
|
-surface* Road::GetLastAddedSurface()
|
|
|
+surface_CRG* Road::GetLastAddedSurfaceCRG()
|
|
|
{
|
|
|
- if(mLastAddedSurface<mSurfaceVector.size())
|
|
|
- return &mSurfaceVector.at(mLastAddedSurface);
|
|
|
+ if(mLastAddedSurfaceCRG<mSurfaceCRGVector.size())
|
|
|
+ return &mSurfaceCRGVector.at(mLastAddedSurfaceCRG);
|
|
|
else
|
|
|
return NULL;
|
|
|
}
|
|
@@ -901,11 +903,14 @@ unsigned int Road::AddRoadNoavoid(double s, double length)
|
|
|
return index;
|
|
|
}
|
|
|
|
|
|
-unsigned int Road::AddSurface()
|
|
|
+unsigned int Road::AddSurfaceCRG(std::string file,double sStart,double sEnd,std::string orientation,std::string mode)
|
|
|
{
|
|
|
- mSurfaceVector.push_back(surface());
|
|
|
- mLastAddedSurface = static_cast<unsigned int >( mSurfaceVector.size()-1);
|
|
|
- return mLastAddedSurface;
|
|
|
+ unsigned int index = CheckSurfaceCRGInterval(sStart)+1;
|
|
|
+ if(index>=GetSurfaceCRGCount()) mSurfaceCRGVector.push_back(surface_CRG(file, sStart, sEnd, orientation, mode));
|
|
|
+ else mSurfaceCRGVector.insert(mSurfaceCRGVector.begin()+index, surface_CRG(file, sStart, sEnd, orientation, mode));
|
|
|
+ mLastAddedSurfaceCRG=index;
|
|
|
+ return index;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//-------------
|
|
@@ -1201,14 +1206,14 @@ unsigned int Road::CloneRoadNoavoid(unsigned int index)
|
|
|
return mLastAddedRoadNoavoid;
|
|
|
}
|
|
|
|
|
|
-unsigned int Road::CloneSurface(unsigned int index)
|
|
|
+unsigned int Road::CloneSurfaceCRG(unsigned int index)
|
|
|
{
|
|
|
- if(index<mSurfaceVector.size()-1)
|
|
|
- mSurfaceVector.insert(mSurfaceVector.begin()+index+1, mSurfaceVector[index]);
|
|
|
- else if(index==mSurfaceVector.size()-1)
|
|
|
- mSurfaceVector.push_back(mSurfaceVector[index]);
|
|
|
- mLastAddedSurface=index+1;
|
|
|
- return mLastAddedSurface;
|
|
|
+ if(index<mSurfaceCRGVector.size()-1)
|
|
|
+ mSurfaceCRGVector.insert(mSurfaceCRGVector.begin()+index+1, mSurfaceCRGVector[index]);
|
|
|
+ else if(index==mSurfaceCRGVector.size()-1)
|
|
|
+ mSurfaceCRGVector.push_back(mSurfaceCRGVector[index]);
|
|
|
+ mLastAddedSurfaceCRG=index+1;
|
|
|
+ return mLastAddedSurfaceCRG;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1280,9 +1285,9 @@ void Road::DeleteRoadNoavoid(unsigned int index)
|
|
|
mRoadNoavoidVector.erase(mRoadNoavoidVector.begin()+index);
|
|
|
}
|
|
|
|
|
|
-void Road::DeleteSurface(unsigned int index)
|
|
|
+void Road::DeleteSurfaceCRG(unsigned int index)
|
|
|
{
|
|
|
- mSurfaceVector.erase(mSurfaceVector.begin()+index);
|
|
|
+ mSurfaceCRGVector.erase(mSurfaceCRGVector.begin()+index);
|
|
|
}
|
|
|
|
|
|
//-------------------------------------------------
|
|
@@ -1734,6 +1739,21 @@ int Road::CheckLaneOffsetInterval(double s_check)
|
|
|
|
|
|
}
|
|
|
//-----------
|
|
|
+int Road::CheckSurfaceCRGInterval(double s_check)
|
|
|
+{
|
|
|
+ int res=-1;
|
|
|
+ //Go through all the lane section records
|
|
|
+ for (unsigned int i=0;i<mSurfaceCRGVector.size();i++)
|
|
|
+ {
|
|
|
+ //check if the s_check belongs to the current record
|
|
|
+ if (mSurfaceCRGVector.at(i).CheckInterval(s_check))
|
|
|
+ res=i; //assign it to the result id
|
|
|
+ else
|
|
|
+ break; //if not, break;
|
|
|
+ }
|
|
|
+ return res; //return the result: 0 to MaxInt as the index to the record containing s_check or -1 if nothing found
|
|
|
+}
|
|
|
+//-----------
|
|
|
void Road::FillLaneSectionSample(double s_check, LaneSectionSample& laneSectionSample)
|
|
|
{
|
|
|
int index=CheckLaneSectionInterval(s_check);
|