|
@@ -66,6 +66,7 @@ Road::Road (const Road& road)
|
|
|
mRoadNoavoidVector = road.mRoadNoavoidVector;
|
|
|
mSurfaceCRGVector = road.mSurfaceCRGVector;
|
|
|
mRoadPriorityVector = road.mRoadPriorityVector;
|
|
|
+ mShapeVector = road.mShapeVector;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -113,6 +114,7 @@ const Road& Road::operator=(const Road& otherRoad)
|
|
|
mRoadNoavoidVector = otherRoad.mRoadNoavoidVector;
|
|
|
mSurfaceCRGVector = otherRoad.mSurfaceCRGVector;
|
|
|
mRoadPriorityVector = otherRoad.mRoadPriorityVector;
|
|
|
+ mShapeVector = otherRoad.mShapeVector;
|
|
|
}
|
|
|
return *this;
|
|
|
}
|
|
@@ -245,6 +247,22 @@ unsigned int Road::GetElevationCount()
|
|
|
{
|
|
|
return mElevationVector.size();
|
|
|
}
|
|
|
+// Road Shape records
|
|
|
+vector<Shape> *Road::GetShapeVector()
|
|
|
+{
|
|
|
+ return &mShapeVector;
|
|
|
+}
|
|
|
+Shape* Road::GetShape(unsigned int i)
|
|
|
+{
|
|
|
+ if ((mShapeVector.size()>0)&&(i<mShapeVector.size()))
|
|
|
+ return &mShapeVector.at(i);
|
|
|
+ else
|
|
|
+ return NULL;
|
|
|
+}
|
|
|
+unsigned int Road::GetShapeCount()
|
|
|
+{
|
|
|
+ return static_cast<unsigned int>(mShapeVector.size()) ;
|
|
|
+}
|
|
|
// Road superelevation records
|
|
|
vector<SuperElevation> *Road::GetSuperElevationVector()
|
|
|
{
|
|
@@ -525,6 +543,13 @@ Elevation* Road::GetLastElevation()
|
|
|
else
|
|
|
return NULL;
|
|
|
}
|
|
|
+Shape* Road::GetLastShape()
|
|
|
+{
|
|
|
+ if(mShapeVector.size()>0)
|
|
|
+ return &mShapeVector.at(mShapeVector.size()-1);
|
|
|
+ else
|
|
|
+ return NULL;
|
|
|
+}
|
|
|
SuperElevation* Road::GetLastSuperElevation()
|
|
|
{
|
|
|
if (mSuperElevationVector.size()>0)
|
|
@@ -647,6 +672,13 @@ Elevation* Road::GetLastAddedElevation()
|
|
|
else
|
|
|
return NULL;
|
|
|
}
|
|
|
+Shape* Road::GetLastAddedShape()
|
|
|
+{
|
|
|
+ if(mLastAddedShape<mShapeVector.size())
|
|
|
+ return &mShapeVector.at(mLastAddedShape);
|
|
|
+ else
|
|
|
+ return NULL;
|
|
|
+}
|
|
|
SuperElevation* Road::GetLastAddedSuperElevation()
|
|
|
{
|
|
|
if(mLastAddedSuperElevation<mSuperElevationVector.size())
|
|
@@ -882,6 +914,17 @@ unsigned int Road::AddElevation(double s, double a, double b, double c, double d
|
|
|
return index;
|
|
|
}
|
|
|
//-------------
|
|
|
+unsigned int Road::AddShape(double s, double t, double a, double b, double c, double d)
|
|
|
+{
|
|
|
+ // Check the first method in the group for details
|
|
|
+
|
|
|
+ unsigned int index = CheckShapeInterval(s,t)+1;
|
|
|
+ if(index>=GetShapeCount()) mShapeVector.push_back(Shape(s,t,a,b,c,d));
|
|
|
+ else mShapeVector.insert(mShapeVector.begin()+index, Shape(s,t,a,b,c,d));
|
|
|
+ mLastAddedShape=index;
|
|
|
+ return index;
|
|
|
+}
|
|
|
+//-------------
|
|
|
unsigned int Road::AddSuperElevation(double s, double a, double b, double c, double d)
|
|
|
{
|
|
|
// Check the first method in the group for details
|
|
@@ -1048,6 +1091,17 @@ unsigned int Road::CloneElevation(unsigned int index)
|
|
|
mLastAddedElevation=index+1;
|
|
|
return mLastAddedElevation;
|
|
|
}
|
|
|
+unsigned int Road::CloneShape(unsigned int index)
|
|
|
+{
|
|
|
+ // Check the first method in the group for details
|
|
|
+
|
|
|
+ if(index<mShapeVector.size()-1)
|
|
|
+ mShapeVector.insert(mShapeVector.begin()+index+1, mShapeVector[index]);
|
|
|
+ else if(index==mShapeVector.size()-1)
|
|
|
+ mShapeVector.push_back(mShapeVector[index]);
|
|
|
+ mLastAddedShape=index+1;
|
|
|
+ return mLastAddedShape;
|
|
|
+}
|
|
|
unsigned int Road::CloneSuperElevation(unsigned int index)
|
|
|
{
|
|
|
// Check the first method in the group for details
|
|
@@ -1287,6 +1341,10 @@ void Road::DeleteElevation(unsigned int index)
|
|
|
{
|
|
|
mElevationVector.erase(mElevationVector.begin()+index);
|
|
|
}
|
|
|
+void Road::DeleteShape(unsigned int index)
|
|
|
+{
|
|
|
+ mShapeVector.erase(mShapeVector.begin()+index);
|
|
|
+}
|
|
|
void Road::DeleteSuperElevation(unsigned int index)
|
|
|
{
|
|
|
mSuperElevationVector.erase(mSuperElevationVector.begin()+index);
|
|
@@ -1585,6 +1643,33 @@ double Road::GetElevationValue (double s_check)
|
|
|
retVal= (mElevationVector.at(index).GetValue(s_check));
|
|
|
return retVal;
|
|
|
|
|
|
+}
|
|
|
+//-----------
|
|
|
+int Road::CheckShapeInterval(double s_check,double t_check)
|
|
|
+{
|
|
|
+ int res=-1;
|
|
|
+ //Go through all the road type records
|
|
|
+ for (unsigned int i=0;i<mShapeVector.size();i++)
|
|
|
+ {
|
|
|
+ //check if the s_check belongs to the current record
|
|
|
+ if (mShapeVector.at(i).CheckInterval(s_check,t_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
|
|
|
+}
|
|
|
+//-----------
|
|
|
+double Road::GetShapeValue (double s_check,double t_check)
|
|
|
+{
|
|
|
+ double retVal=0;
|
|
|
+ //find the record where s_check belongs
|
|
|
+ int index=CheckShapeInterval(s_check,t_check);
|
|
|
+ //If found, return the type
|
|
|
+ if (index>=0)
|
|
|
+ retVal= (mShapeVector.at(index).GetValue(t_check));
|
|
|
+ return retVal;
|
|
|
+
|
|
|
}
|
|
|
//-----------
|
|
|
int Road::CheckSuperElevationInterval(double s_check)
|
|
@@ -2351,7 +2436,29 @@ double Road::GetDis(const double x,const double y, const double hdg, double & fR
|
|
|
}
|
|
|
|
|
|
|
|
|
+short int Road::GetLaneCoords(double s_check, double t_check,double &retX, double &retY, double &retZ,double &retHDG)
|
|
|
+{
|
|
|
+ short int nrtn;
|
|
|
+ double fRefX,fRefY,fRefHDG;
|
|
|
+ nrtn = GetGeometryCoords(s_check,fRefX,fRefY,fRefHDG);
|
|
|
+ if(nrtn<0)
|
|
|
+ {
|
|
|
+ return nrtn;
|
|
|
+ }
|
|
|
+
|
|
|
+ double fOffValue = GetLaneOffsetValue(s_check);
|
|
|
+
|
|
|
+ double fSuperElevationValue = GetSuperElevationValue(s_check);
|
|
|
+
|
|
|
+ retX = fRefX + t_check*cos(fSuperElevationValue)*cos(retHDG + M_PI/2.0) + fOffValue;
|
|
|
+ retY = fRefY + t_check*cos(fSuperElevationValue)*sin(retHDG + M_PI/2.0) + fOffValue;
|
|
|
+
|
|
|
+ double fElevation = GetElevationValue(s_check);
|
|
|
|
|
|
+ retZ = fElevation + t_check*sin(fSuperElevationValue) + GetShapeValue(s_check,t_check);
|
|
|
+
|
|
|
+ return nrtn;
|
|
|
+}
|
|
|
|
|
|
//-------------------------------------------------
|
|
|
|
|
@@ -2643,6 +2750,16 @@ SuperElevation::SuperElevation(double s, double a, double b, double c, double d)
|
|
|
{}
|
|
|
|
|
|
|
|
|
+//***********************************************************************************
|
|
|
+//Shape record
|
|
|
+//***********************************************************************************
|
|
|
+/**
|
|
|
+ * Constructor which intializes the basic properties
|
|
|
+ */
|
|
|
+Shape::Shape(double s, double t, double a, double b, double c, double d): Third2DOrderPolynom(s,t,a,b,c,d)
|
|
|
+{}
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|