Skip to content
Snippets Groups Projects
Commit 7a6e5434 authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Added changes to comply with the Opendrive standard for the center lane.

parent d78f70b6
No related branches found
No related tags found
1 merge request!1Param poly3
......@@ -709,13 +709,16 @@ bool OpenDriveXmlParser::ReadLane (LaneSection* laneSection, TiXmlElement *node,
lane->SetSuccessor(successor);
}
//Proceed to the Road width
subNode=node->FirstChildElement("width");
while (subNode)
{
ReadLaneWidth(lane, subNode);
subNode=subNode->NextSiblingElement("width");
}
if(side!=0)
{
//Proceed to the Road width
subNode=node->FirstChildElement("width");
while (subNode)
{
ReadLaneWidth(lane, subNode);
subNode=subNode->NextSiblingElement("width");
}
}
//Proceed to the Road Mark
subNode=node->FirstChildElement("roadMark");
......@@ -725,45 +728,48 @@ bool OpenDriveXmlParser::ReadLane (LaneSection* laneSection, TiXmlElement *node,
subNode=subNode->NextSiblingElement("roadMark");
}
//Proceed to the Lane Material
subNode=node->FirstChildElement("material");
while (subNode)
{
ReadLaneMaterial(lane, subNode);
subNode=subNode->NextSiblingElement("material");
}
//Proceed to the Lane Visibility
subNode=node->FirstChildElement("visibility");
while (subNode)
{
ReadLaneVisibility(lane, subNode);
subNode=subNode->NextSiblingElement("visibility");
}
//Proceed to the Lane speed
subNode=node->FirstChildElement("speed");
while (subNode)
{
ReadLaneSpeed(lane, subNode);
subNode=subNode->NextSiblingElement("speed");
}
//Proceed to the Lane access
subNode=node->FirstChildElement("access");
while (subNode)
{
ReadLaneAccess(lane, subNode);
subNode=subNode->NextSiblingElement("access");
}
//Proceed to the Lane height
subNode=node->FirstChildElement("height");
while (subNode)
{
ReadLaneHeight(lane, subNode);
subNode=subNode->NextSiblingElement("height");
}
if(side!=0)
{
//Proceed to the Lane Material
subNode=node->FirstChildElement("material");
while (subNode)
{
ReadLaneMaterial(lane, subNode);
subNode=subNode->NextSiblingElement("material");
}
//Proceed to the Lane Visibility
subNode=node->FirstChildElement("visibility");
while (subNode)
{
ReadLaneVisibility(lane, subNode);
subNode=subNode->NextSiblingElement("visibility");
}
//Proceed to the Lane speed
subNode=node->FirstChildElement("speed");
while (subNode)
{
ReadLaneSpeed(lane, subNode);
subNode=subNode->NextSiblingElement("speed");
}
//Proceed to the Lane access
subNode=node->FirstChildElement("access");
while (subNode)
{
ReadLaneAccess(lane, subNode);
subNode=subNode->NextSiblingElement("access");
}
//Proceed to the Lane height
subNode=node->FirstChildElement("height");
while (subNode)
{
ReadLaneHeight(lane, subNode);
subNode=subNode->NextSiblingElement("height");
}
}
return true;
}
......
......@@ -567,7 +567,7 @@ bool OpenDriveXmlWriter::WriteLaneSections (TiXmlElement *node, LaneSection *lan
}
else if(lType==0)
{
WriteLane(nodeLanesCenter, lLane);
WriteLane(nodeLanesCenter, lLane,true);
}
else if(lType<0 && nodeLanesRight!=NULL)
{
......@@ -579,7 +579,7 @@ bool OpenDriveXmlWriter::WriteLaneSections (TiXmlElement *node, LaneSection *lan
}
//--------------
bool OpenDriveXmlWriter::WriteLane (TiXmlElement *node, Lane* lane)
bool OpenDriveXmlWriter::WriteLane (TiXmlElement *node, Lane* lane, bool center)
{
//Write Lane attributes
int id;
......@@ -621,13 +621,15 @@ bool OpenDriveXmlWriter::WriteLane (TiXmlElement *node, Lane* lane)
nodeLaneLinkSuccessor->SetAttribute("id",successor);
}
//Lane Width
unsigned int lLaneWidthCount = lane->GetLaneWidthCount();
for(unsigned int i=0; i<lLaneWidthCount; i++)
{
WriteLaneWidth(nodeLane, lane->GetLaneWidth(i));
}
if(!center)
{
//Lane Width
unsigned int lLaneWidthCount = lane->GetLaneWidthCount();
for(unsigned int i=0; i<lLaneWidthCount; i++)
{
WriteLaneWidth(nodeLane, lane->GetLaneWidth(i));
}
}
//Lane Road Mark
unsigned int lLaneRoadMark = lane->GetLaneRoadMarkCount();
for(unsigned int i=0; i<lLaneRoadMark; i++)
......@@ -635,40 +637,43 @@ bool OpenDriveXmlWriter::WriteLane (TiXmlElement *node, Lane* lane)
WriteLaneRoadMark(nodeLane, lane->GetLaneRoadMark(i));
}
//Lane Material
unsigned int lLaneMaterial = lane->GetLaneMaterialCount();
for(unsigned int i=0; i<lLaneMaterial; i++)
{
WriteLaneMaterial(nodeLane, lane->GetLaneMaterial(i));
}
//Lane Visibility
unsigned int lLaneVisibility = lane->GetLaneVisibilityCount();
for(unsigned int i=0; i<lLaneVisibility; i++)
{
WriteLaneVisibility(nodeLane, lane->GetLaneVisibility(i));
}
//Lane speed
unsigned int lLaneSpeed = lane->GetLaneSpeedCount();
for(unsigned int i=0; i<lLaneSpeed; i++)
{
WriteLaneSpeed(nodeLane, lane->GetLaneSpeed(i));
}
//Lane access
unsigned int lLaneAccess = lane->GetLaneAccessCount();
for(unsigned int i=0; i<lLaneAccess; i++)
{
WriteLaneAccess(nodeLane, lane->GetLaneAccess(i));
}
//Lane height
unsigned int lLaneHeight = lane->GetLaneHeightCount();
for(unsigned int i=0; i<lLaneHeight; i++)
{
WriteLaneHeight(nodeLane, lane->GetLaneHeight(i));
}
if(!center)
{
//Lane Material
unsigned int lLaneMaterial = lane->GetLaneMaterialCount();
for(unsigned int i=0; i<lLaneMaterial; i++)
{
WriteLaneMaterial(nodeLane, lane->GetLaneMaterial(i));
}
//Lane Visibility
unsigned int lLaneVisibility = lane->GetLaneVisibilityCount();
for(unsigned int i=0; i<lLaneVisibility; i++)
{
WriteLaneVisibility(nodeLane, lane->GetLaneVisibility(i));
}
//Lane speed
unsigned int lLaneSpeed = lane->GetLaneSpeedCount();
for(unsigned int i=0; i<lLaneSpeed; i++)
{
WriteLaneSpeed(nodeLane, lane->GetLaneSpeed(i));
}
//Lane access
unsigned int lLaneAccess = lane->GetLaneAccessCount();
for(unsigned int i=0; i<lLaneAccess; i++)
{
WriteLaneAccess(nodeLane, lane->GetLaneAccess(i));
}
//Lane height
unsigned int lLaneHeight = lane->GetLaneHeightCount();
for(unsigned int i=0; i<lLaneHeight; i++)
{
WriteLaneHeight(nodeLane, lane->GetLaneHeight(i));
}
}
return true;
}
......
......@@ -53,7 +53,7 @@ public:
bool WriteLanes (TiXmlElement *node, Road* road);
bool WriteLaneSections (TiXmlElement *node, LaneSection *laneSection);
bool WriteLane (TiXmlElement *node, Lane* lane);
bool WriteLane (TiXmlElement *node, Lane* lane,bool center=false);
bool WriteLaneWidth(TiXmlElement *node, LaneWidth* laneWidth);
bool WriteLaneRoadMark(TiXmlElement *node, LaneRoadMark* laneRoadMark);
bool WriteLaneMaterial(TiXmlElement *node, LaneMaterial* laneMaterial);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment