|
@@ -31,6 +31,9 @@ void Junction::SetName(string name)
|
|
|
void Junction::SetId(string id)
|
|
|
{ mId=id; }
|
|
|
|
|
|
+void Junction::SetType(string strtype)
|
|
|
+{ mType = strtype;}
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* Adds a junction connection to the junction
|
|
@@ -82,6 +85,16 @@ unsigned int Junction::AddJunctionCrossPath(string id,string crossingRoad, strin
|
|
|
mLastAddedJunctionCrossPath = mJunctionCrossPathVector.size() -1;
|
|
|
return mLastAddedJunctionCrossPath;
|
|
|
}
|
|
|
+
|
|
|
+unsigned int Junction::AddJunctionDirectConnection( string id, string linkedRoad)
|
|
|
+{
|
|
|
+ // Adds a new junction connection
|
|
|
+ mJunctionDirectConnectionVector.push_back(JunctionDirectConnection(id, linkedRoad));
|
|
|
+ // Saves the index of the newly added junction connection
|
|
|
+ mLastAddedJunctionDirectConnection = mJunctionDirectConnectionVector.size()-1;
|
|
|
+ return mLastAddedJunctionDirectConnection;
|
|
|
+}
|
|
|
+
|
|
|
//--------------
|
|
|
|
|
|
/**
|
|
@@ -130,6 +143,18 @@ unsigned int Junction::CloneJunctionPath(unsigned int index)
|
|
|
return mLastAddedJunctionCrossPath;
|
|
|
}
|
|
|
|
|
|
+unsigned int Junction::CloneJunctionDirectConnection(unsigned int index)
|
|
|
+{
|
|
|
+ if(index<mJunctionDirectConnectionVector.size()-1)
|
|
|
+ mJunctionDirectConnectionVector.insert(mJunctionDirectConnectionVector.begin()+index+1, mJunctionDirectConnectionVector[index]);
|
|
|
+ // or just push it to the back
|
|
|
+ else if(index==mJunctionDirectConnectionVector.size()-1)
|
|
|
+ mJunctionDirectConnectionVector.push_back(mJunctionDirectConnectionVector[index]);
|
|
|
+ // Save the last added record index
|
|
|
+ mLastAddedJunctionDirectConnection=index+1;
|
|
|
+ return mLastAddedJunctionDirectConnection;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* Methods used to delete child records from the respective vectors
|
|
|
*/
|
|
@@ -151,6 +176,11 @@ void Junction::DeleteJunctionCrossPath(unsigned int index)
|
|
|
mJunctionCrossPathVector.erase(mJunctionCrossPathVector.begin()+index);
|
|
|
}
|
|
|
|
|
|
+void Junction::DeleteJunctionDirectConnection(unsigned int index)
|
|
|
+{
|
|
|
+ mJunctionDirectConnectionVector.erase(mJunctionDirectConnectionVector.begin()+index);
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* Return the name of the junction
|
|
|
*/
|
|
@@ -163,6 +193,11 @@ string Junction::GetName()
|
|
|
string Junction::GetId()
|
|
|
{ return mId; }
|
|
|
|
|
|
+string Junction::GetType()
|
|
|
+{
|
|
|
+ return mType;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* Return the vector that stores junction connections
|
|
|
* @return A pointer to std::vector of JunctionConnection type that stores junction connections
|
|
@@ -328,6 +363,32 @@ JunctionCrossPath* Junction::GetLastAddedJunctionCrossPath()
|
|
|
}
|
|
|
|
|
|
|
|
|
+std::vector<JunctionDirectConnection>* Junction::GetJunctionDirectConnectionVector()
|
|
|
+{ return & mJunctionDirectConnectionVector;}
|
|
|
+
|
|
|
+unsigned int Junction::GetJunctionDirectConnectionCount()
|
|
|
+{ return mJunctionDirectConnectionVector.size();}
|
|
|
+
|
|
|
+JunctionDirectConnection * Junction::GetJunctionDirectConnection(unsigned int i)
|
|
|
+{ return &mJunctionDirectConnectionVector.at(i);}
|
|
|
+
|
|
|
+JunctionDirectConnection * Junction::GetLastJunctionDirectConnection()
|
|
|
+{
|
|
|
+ if(mJunctionDirectConnectionVector.size()>0)
|
|
|
+ return &mJunctionDirectConnectionVector.at(mJunctionDirectConnectionVector.size()-1);
|
|
|
+ else
|
|
|
+ return NULL;
|
|
|
+}
|
|
|
+
|
|
|
+JunctionDirectConnection * Junction::GetLastAddedJunctionDirectConnection()
|
|
|
+{
|
|
|
+ if(mLastAddedJunctionDirectConnection<mJunctionDirectConnectionVector.size())
|
|
|
+ return &mJunctionDirectConnectionVector.at(mLastAddedJunctionDirectConnection);
|
|
|
+ else
|
|
|
+ return NULL;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
//--------------
|
|
|
|
|
|
|
|
@@ -771,3 +832,164 @@ void JunctionCrossPath::SetJunctionCrossPathEndLaneLink(JunctionCrossPathEndLane
|
|
|
{
|
|
|
mendLaneLink = xEnd;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+* Constructor. Sets basic junction connection parameters
|
|
|
+* @param id ID within the junction
|
|
|
+* @param incomingRoad ID of the incoming road
|
|
|
+* @param connectingRoad ID of the connecting path
|
|
|
+* @param contactPoint Contact point on the connecting road (start / end)
|
|
|
+*/
|
|
|
+JunctionDirectConnection::JunctionDirectConnection( string id, string linkedRoad)
|
|
|
+{
|
|
|
+ mId=id;
|
|
|
+ mIncomingRoad.clear();
|
|
|
+ mLinkedRoad=linkedRoad;
|
|
|
+ mContactPoint.clear();
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+* Set the ID parameter
|
|
|
+*/
|
|
|
+void JunctionDirectConnection::SetId(string id)
|
|
|
+{ mId=id; }
|
|
|
+
|
|
|
+/**
|
|
|
+* Set the ID of the incoming road
|
|
|
+*/
|
|
|
+void JunctionDirectConnection::SetIncomingRoad(string incomingRoad)
|
|
|
+{
|
|
|
+ mIncomingRoad.clear();
|
|
|
+ mIncomingRoad.push_back(incomingRoad);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+* Set the ID of the connecting path
|
|
|
+*/
|
|
|
+void JunctionDirectConnection::SetLinkedRoad(string linkedRoad)
|
|
|
+{ mLinkedRoad=linkedRoad; }
|
|
|
+
|
|
|
+/**
|
|
|
+* Set the contact point parameter
|
|
|
+* @param contactPoint Contact point of the connecting road. Can be either start or end
|
|
|
+*/
|
|
|
+void JunctionDirectConnection::SetContactPoint(string contactPoint)
|
|
|
+{
|
|
|
+ mContactPoint.clear();
|
|
|
+ mContactPoint.push_back(contactPoint);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+* Add a lane link record
|
|
|
+* @param from ID of the incoming lane
|
|
|
+* @param to ID of the connecting lane
|
|
|
+*/
|
|
|
+unsigned int JunctionDirectConnection::AddJunctionLaneLink(int from, int to)
|
|
|
+{
|
|
|
+ mJunctionLaneLinkVector.push_back(JunctionLaneLink(from, to));
|
|
|
+ mLastAddedJunctionLaneLink = mJunctionLaneLinkVector.size()-1;
|
|
|
+ return mLastAddedJunctionLaneLink;
|
|
|
+}
|
|
|
+//--------------
|
|
|
+
|
|
|
+/**
|
|
|
+ * Method used to clone child record in the respective vectors
|
|
|
+ */
|
|
|
+unsigned int JunctionDirectConnection::CloneJunctionLaneLink(unsigned int index)
|
|
|
+{
|
|
|
+ // Clone the object and insert it in the middle of the vector
|
|
|
+ if(index<mJunctionLaneLinkVector.size()-1)
|
|
|
+ mJunctionLaneLinkVector.insert(mJunctionLaneLinkVector.begin()+index+1, mJunctionLaneLinkVector[index]);
|
|
|
+ // or just push it to the back
|
|
|
+ else if(index==mJunctionLaneLinkVector.size()-1)
|
|
|
+ mJunctionLaneLinkVector.push_back(mJunctionLaneLinkVector[index]);
|
|
|
+ // Save the last added record index
|
|
|
+ mLastAddedJunctionLaneLink=index+1;
|
|
|
+ return mLastAddedJunctionLaneLink;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+* Delete the lane link parameter at the provided index
|
|
|
+*/
|
|
|
+void JunctionDirectConnection::DeleteJunctionLaneLink(unsigned int index)
|
|
|
+{
|
|
|
+ mJunctionLaneLinkVector.erase(mJunctionLaneLinkVector.begin()+index);
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+* Get the ID parameter
|
|
|
+*/
|
|
|
+string JunctionDirectConnection::GetId()
|
|
|
+{ return mId; }
|
|
|
+
|
|
|
+/**
|
|
|
+* Get the ID fo the incoming road
|
|
|
+*/
|
|
|
+int JunctionDirectConnection::GetIncomingRoad(string & incomingRoad)
|
|
|
+{
|
|
|
+ if(mIncomingRoad.size() == 0)return 0;
|
|
|
+ incomingRoad = mIncomingRoad[0];
|
|
|
+ return 1; }
|
|
|
+
|
|
|
+/**
|
|
|
+* Get the ID of the connecting road
|
|
|
+*/
|
|
|
+string JunctionDirectConnection::GetLinkedRoad()
|
|
|
+{ return mLinkedRoad; }
|
|
|
+
|
|
|
+/**
|
|
|
+* Get the contact point parameter
|
|
|
+*/
|
|
|
+int JunctionDirectConnection::GetContactPoint(string & contactPoint)
|
|
|
+{
|
|
|
+ if(mContactPoint.size() == 0)return 0;
|
|
|
+ contactPoint = mContactPoint[0];
|
|
|
+ return 1; }
|
|
|
+
|
|
|
+/**
|
|
|
+* Return the vector that stores junction lane link records
|
|
|
+* @return A pointer to std::vector of JunctionLaneLink type that stores junction lane link records
|
|
|
+*/
|
|
|
+std::vector<JunctionLaneLink>* JunctionDirectConnection::GetJunctionLaneLinkVector()
|
|
|
+{ return &mJunctionLaneLinkVector; }
|
|
|
+
|
|
|
+/**
|
|
|
+* Return the number of junction lane link records
|
|
|
+* @return An unsigned int that stores the number of junction lane link records
|
|
|
+*/
|
|
|
+unsigned int JunctionDirectConnection::GetJunctionLaneLinkCount()
|
|
|
+{ return mJunctionLaneLinkVector.size(); }
|
|
|
+
|
|
|
+/**
|
|
|
+* Return the pointer to a junction lane link record at provided index
|
|
|
+* @param i Index to the junction lane link record that is returned
|
|
|
+* @return A pointer to JunctionLaneLink object
|
|
|
+*/
|
|
|
+JunctionLaneLink* JunctionDirectConnection::GetJunctionLaneLink(unsigned int i)
|
|
|
+{ return &mJunctionLaneLinkVector.at(i); }
|
|
|
+
|
|
|
+/**
|
|
|
+* Return the pointer to the last junction lane link record
|
|
|
+* @return A pointer to JunctionLaneLink object
|
|
|
+*/
|
|
|
+JunctionLaneLink* JunctionDirectConnection::GetLastJunctionLaneLink()
|
|
|
+{
|
|
|
+ if(mJunctionLaneLinkVector.size()>0)
|
|
|
+ return &mJunctionLaneLinkVector.at(mJunctionLaneLinkVector.size()-1);
|
|
|
+ else
|
|
|
+ return NULL;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+* Return the pointer to the last added junction lane link record (which might not be the one from the end of the vector)
|
|
|
+* @return A pointer to JunctionLaneLink object
|
|
|
+*/
|
|
|
+JunctionLaneLink* JunctionDirectConnection::GetLastAddedJunctionLaneLink()
|
|
|
+{
|
|
|
+ if(mLastAddedJunctionLaneLink<mJunctionLaneLinkVector.size())
|
|
|
+ return &mJunctionLaneLinkVector.at(mLastAddedJunctionLaneLink);
|
|
|
+ else
|
|
|
+ return NULL;
|
|
|
+}
|