|
@@ -3083,6 +3083,21 @@ bool OpenDriveXmlParser::ReadJunction (TiXmlElement *node)
|
|
|
ReadJunctionplanView(junction,subNode);
|
|
|
}
|
|
|
|
|
|
+ subNode=node->FirstChildElement("boundary");
|
|
|
+
|
|
|
+ if(subNode)
|
|
|
+ {
|
|
|
+ ReadJunctionboundary(junction,subNode);
|
|
|
+ }
|
|
|
+
|
|
|
+ subNode=node->FirstChildElement("elevationGrid");
|
|
|
+
|
|
|
+ if(subNode)
|
|
|
+ {
|
|
|
+ ReadJunctionelevationGrid(junction,subNode);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
return true;
|
|
|
|
|
@@ -3308,21 +3323,35 @@ bool OpenDriveXmlParser::ReadJunctionplanViewgeometry(JunctionplanView* planView
|
|
|
|
|
|
bool OpenDriveXmlParser::ReadJunctionboundary(Junction* junction, TiXmlElement *node)
|
|
|
{
|
|
|
- TiXmlElement *subNode=node->FirstChildElement("boundary");
|
|
|
-
|
|
|
- if(subNode == NULL)return false;
|
|
|
|
|
|
Junctionboundary boundary;
|
|
|
|
|
|
+ ReadJunctionboundarysegment(&boundary,node);
|
|
|
+
|
|
|
+ TiXmlElement *subNode=node->FirstChildElement("segment");
|
|
|
+
|
|
|
+ while(subNode)
|
|
|
+ {
|
|
|
+ ReadJunctionboundarysegment(&boundary,subNode);
|
|
|
+ subNode=node->NextSiblingElement("segment");
|
|
|
+ }
|
|
|
+
|
|
|
+ if((boundary.GetJunctionboundarysegmentjointCount()>0) || (boundary.GetJunctionboundarysegmentlaneCount()>0) )
|
|
|
+ {
|
|
|
+ junction->SetJunctionboundary(boundary);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ std::cout<<" ReadJunctionboundary, junction boundary no joint lane."<<std::endl;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- junction->SetJunctionboundary(boundary);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
bool OpenDriveXmlParser::ReadJunctionboundarysegment(Junctionboundary * junctionboundary, TiXmlElement *node)
|
|
|
{
|
|
|
- TiXmlElement *subNode=node->FirstChildElement("segment");
|
|
|
|
|
|
int boundaryLane;
|
|
|
string roadId;
|
|
@@ -3336,32 +3365,134 @@ bool OpenDriveXmlParser::ReadJunctionboundarysegment(Junctionboundary * junction
|
|
|
|
|
|
string type;
|
|
|
|
|
|
- while(subNode)
|
|
|
+
|
|
|
+ if(node->QueryStringAttribute("type",&type) == TIXML_SUCCESS)
|
|
|
{
|
|
|
- if(subNode->QueryStringAttribute("type",&type) == TIXML_SUCCESS)
|
|
|
+ if(type == "lane")
|
|
|
{
|
|
|
- if(type == "lane")
|
|
|
- {
|
|
|
- int checker=TIXML_SUCCESS;
|
|
|
- checker+=node->QueryIntAttribute("boundaryLane",&boundaryLane);
|
|
|
- checker+=node->QueryStringAttribute("roadId",&roadId);
|
|
|
- checker+=node->QueryDoubleAttribute("sEnd",&sEnd);
|
|
|
- checker+=node->QueryDoubleAttribute("sStart",&sStart);
|
|
|
- if(checker == TIXML_SUCCESS)
|
|
|
+ int checker=TIXML_SUCCESS;
|
|
|
+ checker+=node->QueryIntAttribute("boundaryLane",&boundaryLane);
|
|
|
+ checker+=node->QueryStringAttribute("roadId",&roadId);
|
|
|
+ checker+=node->QueryDoubleAttribute("sEnd",&sEnd);
|
|
|
+ checker+=node->QueryDoubleAttribute("sStart",&sStart);
|
|
|
+ if(checker == TIXML_SUCCESS)
|
|
|
+ {
|
|
|
+ junctionboundary->AddJunctionboundarysegmentlane(boundaryLane,roadId,sEnd,sStart);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ std::cout<<" Parse Junction Boundary Lane Fail. "<<std::endl;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(type == "joint")
|
|
|
+ {
|
|
|
+ int checker=TIXML_SUCCESS;
|
|
|
+ checker+=node->QueryStringAttribute("contactPoint",&contactPoint);
|
|
|
+ checker+=node->QueryStringAttribute("roadId",&roadId);
|
|
|
+ if(checker == TIXML_SUCCESS)
|
|
|
+ {
|
|
|
+ junctionboundary->AddJunctionboundarysegmentjoint(contactPoint,roadId);
|
|
|
+
|
|
|
+ Junctionboundarysegmentjoint * pjoint = junctionboundary->GetLastAddedJunctionboundarysegmentjoint();
|
|
|
+
|
|
|
+ if(node->QueryIntAttribute("jointLaneEnd",&jointLaneEnd) == TIXML_SUCCESS)
|
|
|
{
|
|
|
- junctionboundary->AddJunctionboundarysegmentlane(boundaryLane,roadId,sEnd,sStart);
|
|
|
+ pjoint->SetjointLaneEnd(jointLaneEnd);
|
|
|
+ }
|
|
|
+ if(node->QueryIntAttribute("jointLaneStart",&jointLaneStart) == TIXML_SUCCESS)
|
|
|
+ {
|
|
|
+ pjoint->SetjointLaneEnd(jointLaneStart);
|
|
|
+ }
|
|
|
+ if(node->QueryDoubleAttribute("transitionLength",&transitionLength) == TIXML_SUCCESS)
|
|
|
+ {
|
|
|
+ pjoint->SettransitionLength(transitionLength);
|
|
|
}
|
|
|
- }
|
|
|
- if(type == "joint")
|
|
|
- {
|
|
|
|
|
|
- }
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ std::cout<<" Parse Junction Boundary joint Fail. "<<std::endl;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- subNode=node->NextSiblingElement("segment");
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
+bool OpenDriveXmlParser::ReadJunctionelevationGrid(Junction* junction, TiXmlElement *node)
|
|
|
+{
|
|
|
+ double gridSpacing;
|
|
|
+ double sStart;
|
|
|
+
|
|
|
+ int checker=TIXML_SUCCESS;
|
|
|
+ checker+=node->QueryDoubleAttribute("gridSpacing",&gridSpacing);
|
|
|
+ checker+=node->QueryDoubleAttribute("sStart",&sStart);
|
|
|
+
|
|
|
+ if(checker == TIXML_SUCCESS)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ std::cout<<" Parse ReadJunctionelevationGrid Fail. Junction id: "<<junction->GetId()<<std::endl;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ JunctionelevationGrid elevationGrid(gridSpacing,sStart);
|
|
|
+
|
|
|
+
|
|
|
+ TiXmlElement *subNode=node->FirstChildElement("elevation");
|
|
|
+
|
|
|
+ while(subNode)
|
|
|
+ {
|
|
|
+ ReadJunctionelevationGridelevation(&elevationGrid,subNode);
|
|
|
+ subNode=node->NextSiblingElement("elevation");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ junction->SetJunctionelevationGrid(elevationGrid);
|
|
|
+
|
|
|
+ return true;;
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+bool OpenDriveXmlParser::ReadJunctionelevationGridelevation(JunctionelevationGrid * junctionelevationGrid, TiXmlElement *node)
|
|
|
+{
|
|
|
+ string left;
|
|
|
+ string center;
|
|
|
+ string right;
|
|
|
+
|
|
|
+ int checker=TIXML_SUCCESS;
|
|
|
+ checker+=node->QueryStringAttribute("center",¢er);
|
|
|
+
|
|
|
+ if(checker == TIXML_SUCCESS)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ std::cout<<" Parse Junction elevation Grid Fail."<<std::endl;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ junctionelevationGrid->Addelevation(center);
|
|
|
+
|
|
|
+ JunctionelevationGridelevation * pelevation = junctionelevationGrid->GetLastAddedelevation();
|
|
|
+
|
|
|
+ if(node->QueryStringAttribute("left",&left) == TIXML_SUCCESS)
|
|
|
+ {
|
|
|
+ pelevation->Setleft(left);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(node->QueryStringAttribute("right",&right) == TIXML_SUCCESS)
|
|
|
+ {
|
|
|
+ pelevation->Setright(right);
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
bool OpenDriveXmlParser::ReadJunctionPriority (Junction* junction, TiXmlElement *node)
|