|
@@ -193,6 +193,16 @@ bool OpenDriveXmlWriter::WriteRoadLinks (TiXmlElement *node, Road* road)
|
|
|
nodeLinkPredecessor->SetAttribute("elementType", lPredecessor->GetElementType());
|
|
|
nodeLinkPredecessor->SetAttribute("elementId", lPredecessor->GetElementId());
|
|
|
nodeLinkPredecessor->SetAttribute("contactPoint", lPredecessor->GetContactPoint());
|
|
|
+ if(lPredecessor->GetElementS()>=0)
|
|
|
+ {
|
|
|
+ std::stringstream ss;
|
|
|
+ ss << setprecision(16) << setiosflags (ios_base::scientific) << lPredecessor->GetElementS();
|
|
|
+ nodeLinkPredecessor->SetAttribute("elementS", ss.str());
|
|
|
+ }
|
|
|
+ if(lPredecessor->GetElementDir() != "")
|
|
|
+ {
|
|
|
+ nodeLinkPredecessor->SetAttribute("elementDir",lPredecessor->GetElementDir());
|
|
|
+ }
|
|
|
}
|
|
|
RoadLink *lSuccessor = road->GetSuccessor();
|
|
|
if(lSuccessor)
|
|
@@ -202,6 +212,16 @@ bool OpenDriveXmlWriter::WriteRoadLinks (TiXmlElement *node, Road* road)
|
|
|
nodeLinkSuccessor->SetAttribute("elementType", lSuccessor->GetElementType());
|
|
|
nodeLinkSuccessor->SetAttribute("elementId", lSuccessor->GetElementId());
|
|
|
nodeLinkSuccessor->SetAttribute("contactPoint", lSuccessor->GetContactPoint());
|
|
|
+ if(lSuccessor->GetElementS()>=0)
|
|
|
+ {
|
|
|
+ std::stringstream ss;
|
|
|
+ ss << setprecision(16) << setiosflags (ios_base::scientific) << lSuccessor->GetElementS();
|
|
|
+ nodeLinkSuccessor->SetAttribute("elementS", ss.str());
|
|
|
+ }
|
|
|
+ if(lSuccessor->GetElementDir() != "")
|
|
|
+ {
|
|
|
+ nodeLinkSuccessor->SetAttribute("elementDir",lSuccessor->GetElementDir());
|
|
|
+ }
|
|
|
}
|
|
|
RoadNeighbor *lNeighbor1 = road->GetNeighbor1();
|
|
|
if(lNeighbor1)
|
|
@@ -224,6 +244,34 @@ bool OpenDriveXmlWriter::WriteRoadLinks (TiXmlElement *node, Road* road)
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+//--------------
|
|
|
+
|
|
|
+bool OpenDriveXmlWriter::WriteRoadTypeSpeed(TiXmlElement *node, RoadType *roadtype)
|
|
|
+{
|
|
|
+ double maxSpeed;
|
|
|
+ string unit;
|
|
|
+
|
|
|
+ unsigned int roadTypeSpeedCount = roadtype->GetRoadTypeSpeedCount();
|
|
|
+ for(unsigned int i=0;i<roadTypeSpeedCount;i++)
|
|
|
+ {
|
|
|
+ RoadTypeSpeed * lRoadTypeSpeed = roadtype->GetRoadTypeSpeed(i);
|
|
|
+
|
|
|
+ maxSpeed = lRoadTypeSpeed->GetmaxSpeed();
|
|
|
+ unit = lRoadTypeSpeed->Getunit();
|
|
|
+
|
|
|
+ TiXmlElement * nodeRoadTypeSpeed = new TiXmlElement("speed");
|
|
|
+ node->LinkEndChild(nodeRoadTypeSpeed);
|
|
|
+
|
|
|
+ std::stringstream ss;
|
|
|
+ ss << setprecision(16) << setiosflags (ios_base::scientific) << maxSpeed;
|
|
|
+ nodeRoadTypeSpeed->SetAttribute("max",ss.str());
|
|
|
+ nodeRoadTypeSpeed->SetAttribute("unit",unit);
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
//--------------
|
|
|
|
|
|
bool OpenDriveXmlWriter::WriteRoadType (TiXmlElement *node, Road* road)
|
|
@@ -246,6 +294,8 @@ bool OpenDriveXmlWriter::WriteRoadType (TiXmlElement *node, Road* road)
|
|
|
ss << setprecision(16) << setiosflags (ios_base::scientific) << s;
|
|
|
nodeRoadType->SetAttribute("s",ss.str());
|
|
|
nodeRoadType->SetAttribute("type",type);
|
|
|
+
|
|
|
+ WriteRoadTypeSpeed(nodeRoadType,lRoadType);
|
|
|
}
|
|
|
|
|
|
return true;
|