|
@@ -34,9 +34,11 @@ bool OpenDriveXmlWriter::WriteHeader(TiXmlElement *node)
|
|
|
double lat0;
|
|
|
double lon0;
|
|
|
double hdg0;
|
|
|
+ string strvendor;
|
|
|
|
|
|
Header *lHeader = mOpenDrive->GetHeader();
|
|
|
lHeader->GetAllParams(revMajor, revMinor, name, version, date, north, south, east, west,lat0,lon0,hdg0);
|
|
|
+ lHeader->GetVendor(strvendor);
|
|
|
|
|
|
TiXmlElement *nodeHeader = new TiXmlElement("header");
|
|
|
node->LinkEndChild(nodeHeader);
|
|
@@ -75,6 +77,36 @@ bool OpenDriveXmlWriter::WriteHeader(TiXmlElement *node)
|
|
|
shdg0 << setprecision(16) << setiosflags (ios_base::scientific) << hdg0;
|
|
|
nodeHeader->SetAttribute("hdg0",shdg0.str());
|
|
|
|
|
|
+ if(strvendor.size()>0)
|
|
|
+ nodeHeader->SetAttribute("vendor",strvendor);
|
|
|
+ else
|
|
|
+ {
|
|
|
+ nodeHeader->SetAttribute("vendor","adc");
|
|
|
+ }
|
|
|
+
|
|
|
+ std::string strgeoReference;
|
|
|
+ std::string struserData;
|
|
|
+ lHeader->GetgeoReference(strgeoReference);
|
|
|
+ lHeader->GetuserData(struserData);
|
|
|
+
|
|
|
+ if(strgeoReference != "")
|
|
|
+ {
|
|
|
+ TiXmlElement * nodegeoReference = new TiXmlElement("geoReference");
|
|
|
+ nodegeoReference->Parse(strgeoReference.data(),0,TIXML_ENCODING_UTF8);
|
|
|
+ nodeHeader->LinkEndChild(nodegeoReference);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if(struserData != "")
|
|
|
+ {
|
|
|
+ TiXmlElement * nodeuserData = new TiXmlElement("userData");
|
|
|
+ nodeuserData->Parse(struserData.data(),0,TIXML_ENCODING_UTF8);
|
|
|
+ nodeHeader->LinkEndChild(nodeuserData);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
return true;
|
|
|
}
|
|
@@ -86,11 +118,13 @@ bool OpenDriveXmlWriter::WriteRoad(TiXmlElement *node, Road *road)
|
|
|
double length;
|
|
|
string id;
|
|
|
string junction;
|
|
|
+ string rule;
|
|
|
|
|
|
name = road->GetRoadName();
|
|
|
length = road->GetRoadLength();
|
|
|
id = road->GetRoadId();
|
|
|
junction = road->GetRoadJunction();
|
|
|
+ rule = road->GetRoadRule();
|
|
|
|
|
|
TiXmlElement *nodeRoad = new TiXmlElement("road");
|
|
|
node->LinkEndChild(nodeRoad);
|
|
@@ -101,6 +135,10 @@ bool OpenDriveXmlWriter::WriteRoad(TiXmlElement *node, Road *road)
|
|
|
nodeRoad->SetAttribute("length",slength.str());
|
|
|
nodeRoad->SetAttribute("id",id);
|
|
|
nodeRoad->SetAttribute("junction",junction);
|
|
|
+ if(rule != "")
|
|
|
+ {
|
|
|
+ nodeRoad->SetAttribute("rule",rule);
|
|
|
+ }
|
|
|
|
|
|
//Fill in
|
|
|
|
|
@@ -123,6 +161,8 @@ bool OpenDriveXmlWriter::WriteRoad(TiXmlElement *node, Road *road)
|
|
|
WriteLanes(nodeRoad, road);
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
//Proceed to Objects
|
|
|
WriteObjects(nodeRoad, road);
|
|
|
|
|
@@ -155,6 +195,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)
|
|
@@ -164,6 +214,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)
|
|
@@ -186,6 +246,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)
|
|
@@ -208,6 +296,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;
|
|
@@ -531,6 +621,12 @@ bool OpenDriveXmlWriter::WriteLanes (TiXmlElement *node, Road* road)
|
|
|
WriteLaneSections(nodeLanes, road->GetLaneSection(i));
|
|
|
}
|
|
|
|
|
|
+ unsigned int lLaneOffsetCount = road->GetLaneOffsetCount();
|
|
|
+ for(unsigned int i=0; i<lLaneOffsetCount; i++)
|
|
|
+ {
|
|
|
+ WriteLaneOffset(nodeLanes, road->GetLaneOffset(i));
|
|
|
+ }
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
//--------------
|
|
@@ -547,6 +643,11 @@ bool OpenDriveXmlWriter::WriteLaneSections (TiXmlElement *node, LaneSection *lan
|
|
|
ss << setprecision(16) << setiosflags (ios_base::scientific) << s;
|
|
|
nodeLaneSection->SetAttribute("s",ss.str());
|
|
|
|
|
|
+ if(laneSection->GetSingleSide() != "")
|
|
|
+ {
|
|
|
+ nodeLaneSection->SetAttribute("singleSide",laneSection->GetSingleSide());
|
|
|
+ }
|
|
|
+
|
|
|
//Fill in lane section
|
|
|
short int curType=1;
|
|
|
TiXmlElement* nodeLanesLeft=NULL;
|
|
@@ -590,6 +691,42 @@ bool OpenDriveXmlWriter::WriteLaneSections (TiXmlElement *node, LaneSection *lan
|
|
|
}
|
|
|
//--------------
|
|
|
|
|
|
+bool OpenDriveXmlWriter::WriteLaneOffset(TiXmlElement *node, LaneOffset *laneOffset)
|
|
|
+{
|
|
|
+ double s;
|
|
|
+ s=laneOffset->GetS();
|
|
|
+
|
|
|
+ TiXmlElement* nodeLaneSection = new TiXmlElement("laneOffset");
|
|
|
+ node->LinkEndChild(nodeLaneSection);
|
|
|
+
|
|
|
+ nodeLaneSection->SetDoubleAttribute("s",laneOffset->GetS());
|
|
|
+ nodeLaneSection->SetDoubleAttribute("a",laneOffset->Geta());
|
|
|
+ nodeLaneSection->SetDoubleAttribute("b",laneOffset->Getb());
|
|
|
+ nodeLaneSection->SetDoubleAttribute("c",laneOffset->Getc());
|
|
|
+ nodeLaneSection->SetDoubleAttribute("d",laneOffset->Getd());
|
|
|
+
|
|
|
+// std::stringstream ss;
|
|
|
+// ss << setprecision(16) << setiosflags (ios_base::scientific) << s;
|
|
|
+// nodeLaneSection->SetAttribute("s",ss.str());
|
|
|
+
|
|
|
+
|
|
|
+// ss << setprecision(16) << setiosflags (ios_base::scientific) << laneOffset->Geta();
|
|
|
+// nodeLaneSection->SetAttribute("a",ss.str());
|
|
|
+
|
|
|
+
|
|
|
+// ss << setprecision(16) << setiosflags (ios_base::scientific) << laneOffset->Getb();
|
|
|
+// nodeLaneSection->SetAttribute("b",ss.str());
|
|
|
+
|
|
|
+// ss << setprecision(16) << setiosflags (ios_base::scientific) << laneOffset->Getc();
|
|
|
+// nodeLaneSection->SetAttribute("c",ss.str());
|
|
|
+
|
|
|
+// ss << setprecision(16) << setiosflags (ios_base::scientific) << laneOffset->Getd();
|
|
|
+// nodeLaneSection->SetAttribute("d",ss.str());
|
|
|
+
|
|
|
+ return true;
|
|
|
+}
|
|
|
+//--------------
|
|
|
+
|
|
|
bool OpenDriveXmlWriter::WriteLane (TiXmlElement *node, Lane* lane)
|
|
|
{
|
|
|
//Write Lane attributes
|
|
@@ -639,6 +776,13 @@ bool OpenDriveXmlWriter::WriteLane (TiXmlElement *node, Lane* lane)
|
|
|
WriteLaneWidth(nodeLane, lane->GetLaneWidth(i));
|
|
|
}
|
|
|
|
|
|
+ //Lane Border
|
|
|
+ unsigned int lLaneBorderCount = lane->GetLaneBorderCount();
|
|
|
+ for(unsigned int i=0; i<lLaneBorderCount; i++)
|
|
|
+ {
|
|
|
+ WriteLaneBorder(nodeLane, lane->GetLaneBorder(i));
|
|
|
+ }
|
|
|
+
|
|
|
//Lane Road Mark
|
|
|
unsigned int lLaneRoadMark = lane->GetLaneRoadMarkCount();
|
|
|
for(unsigned int i=0; i<lLaneRoadMark; i++)
|
|
@@ -681,10 +825,56 @@ bool OpenDriveXmlWriter::WriteLane (TiXmlElement *node, Lane* lane)
|
|
|
WriteLaneHeight(nodeLane, lane->GetLaneHeight(i));
|
|
|
}
|
|
|
|
|
|
+ string struserData;
|
|
|
+ lane->GetuserData(struserData);
|
|
|
+ if(struserData != "")
|
|
|
+ {
|
|
|
+ TiXmlElement * nodeuserData = new TiXmlElement("userData");
|
|
|
+ nodeuserData->Parse(struserData.data(),0,TIXML_ENCODING_UTF8);
|
|
|
+ nodeLane->LinkEndChild(nodeuserData);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
//--------------
|
|
|
|
|
|
+bool OpenDriveXmlWriter::WriteLaneBorder(TiXmlElement *node, LaneBorder* laneBorder)
|
|
|
+{
|
|
|
+ double sOffset, a, b, c, d;
|
|
|
+
|
|
|
+ sOffset=laneBorder->GetS();
|
|
|
+ a=laneBorder->GetA();
|
|
|
+ b=laneBorder->GetB();
|
|
|
+ c=laneBorder->GetC();
|
|
|
+ d=laneBorder->GetD();
|
|
|
+
|
|
|
+ TiXmlElement* nodeLaneBorder = new TiXmlElement("border");
|
|
|
+ node->LinkEndChild(nodeLaneBorder);
|
|
|
+
|
|
|
+ std::stringstream ssOffset;
|
|
|
+ ssOffset << setprecision(16) << setiosflags (ios_base::scientific) << sOffset;
|
|
|
+ nodeLaneBorder->SetAttribute("sOffset",ssOffset.str());
|
|
|
+
|
|
|
+ std::stringstream sa;
|
|
|
+ sa << setprecision(16) << setiosflags (ios_base::scientific) << a;
|
|
|
+ nodeLaneBorder->SetAttribute("a",sa.str());
|
|
|
+
|
|
|
+ std::stringstream sb;
|
|
|
+ sb << setprecision(16) << setiosflags (ios_base::scientific) << b;
|
|
|
+ nodeLaneBorder->SetAttribute("b",sb.str());
|
|
|
+
|
|
|
+ std::stringstream sc;
|
|
|
+ sc << setprecision(16) << setiosflags (ios_base::scientific) << c;
|
|
|
+ nodeLaneBorder->SetAttribute("c",sc.str());
|
|
|
+
|
|
|
+ std::stringstream sd;
|
|
|
+ sd << setprecision(16) << setiosflags (ios_base::scientific) << d;
|
|
|
+ nodeLaneBorder->SetAttribute("d",sd.str());
|
|
|
+
|
|
|
+ return true;
|
|
|
+}
|
|
|
+//--------------
|
|
|
|
|
|
bool OpenDriveXmlWriter::WriteLaneWidth(TiXmlElement *node, LaneWidth* laneWidth)
|
|
|
{
|
|
@@ -911,9 +1101,214 @@ bool OpenDriveXmlWriter::WriteObjects (TiXmlElement *node, Road* road)
|
|
|
TiXmlElement* nodeObjects = new TiXmlElement("objects");
|
|
|
node->LinkEndChild(nodeObjects);
|
|
|
|
|
|
+ unsigned int lObjectCount = road->GetObjectCount();
|
|
|
+ for(unsigned int i=0; i<lObjectCount; i++)
|
|
|
+ {
|
|
|
+ WriteObject(nodeObjects, road->GetObject(i));
|
|
|
+ }
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
//--------------
|
|
|
+bool OpenDriveXmlWriter::WriteObject(TiXmlElement *node, Object *pObject)
|
|
|
+{
|
|
|
+ TiXmlElement* nodeObject = new TiXmlElement("object");
|
|
|
+ node->LinkEndChild(nodeObject);
|
|
|
+
|
|
|
+ nodeObject->SetDoubleAttribute("t",pObject->Gett());
|
|
|
+ nodeObject->SetDoubleAttribute("zOffset",pObject->GetzOffset());
|
|
|
+ if(pObject->Gettype() != "")
|
|
|
+ {
|
|
|
+ nodeObject->SetAttribute("type",pObject->Gettype());
|
|
|
+ }
|
|
|
+ double validLength;
|
|
|
+ if(pObject->GetvalidLength(validLength) == 1)
|
|
|
+ {
|
|
|
+ nodeObject->SetDoubleAttribute("validLength",validLength);
|
|
|
+ }
|
|
|
+ if(pObject->Getorientation() != "")
|
|
|
+ {
|
|
|
+ nodeObject->SetAttribute("orientation",pObject->Getorientation());
|
|
|
+ }
|
|
|
+ if(pObject->Getsubtype() != "")
|
|
|
+ {
|
|
|
+ nodeObject->SetAttribute("subtype",pObject->Getsubtype());
|
|
|
+ }
|
|
|
+ if(pObject->Getdynamic() != "")
|
|
|
+ {
|
|
|
+ nodeObject->SetAttribute("dynamic",pObject->Getdynamic());
|
|
|
+ }
|
|
|
+ double hdg;
|
|
|
+ if(pObject->Gethdg(hdg) == 1)
|
|
|
+ {
|
|
|
+ nodeObject->SetDoubleAttribute("hdg",hdg);
|
|
|
+ }
|
|
|
+ if(pObject->Getname() != "")
|
|
|
+ {
|
|
|
+ nodeObject->SetAttribute("name",pObject->Getname());
|
|
|
+ }
|
|
|
+ double pitch;
|
|
|
+ if(pObject->Getpitch(pitch) == 1)
|
|
|
+ {
|
|
|
+ nodeObject->SetDoubleAttribute("pitch",pitch);
|
|
|
+ }
|
|
|
+ nodeObject->SetAttribute("id",pObject->Getid());
|
|
|
+ double roll;
|
|
|
+ if(pObject->Getroll(roll) == 1)
|
|
|
+ {
|
|
|
+ nodeObject->SetDoubleAttribute("roll",roll);
|
|
|
+ }
|
|
|
+ double height;
|
|
|
+ if(pObject->Getheight(height) == 1)
|
|
|
+ {
|
|
|
+ nodeObject->SetDoubleAttribute("height",height);
|
|
|
+ }
|
|
|
+ nodeObject->SetDoubleAttribute("s",pObject->Gets());
|
|
|
+ double length;
|
|
|
+ if(pObject->Getlength(length) == 1)
|
|
|
+ {
|
|
|
+ nodeObject->SetDoubleAttribute("length",length);
|
|
|
+ }
|
|
|
+ double width;
|
|
|
+ if(pObject->Getwidth(width) == 1)
|
|
|
+ {
|
|
|
+ nodeObject->SetDoubleAttribute("width",width);
|
|
|
+ }
|
|
|
+ double radius;
|
|
|
+ if(pObject->Getradius(radius) == 1)
|
|
|
+ {
|
|
|
+ nodeObject->SetDoubleAttribute("radius",radius);
|
|
|
+ }
|
|
|
+
|
|
|
+ Object_parkingSpace parkingSpace;
|
|
|
+ if(pObject->GetparkingSpace(parkingSpace) == 1)
|
|
|
+ {
|
|
|
+ WriteObjectParkingSpace(nodeObject,&parkingSpace);
|
|
|
+ }
|
|
|
+
|
|
|
+ unsigned int i;
|
|
|
+
|
|
|
+ unsigned nrepeatcount = pObject->GetObjectrepeatCount();
|
|
|
+ for(i=0;i<nrepeatcount;i++)
|
|
|
+ {
|
|
|
+ Object_repeat * pObject_repeat = pObject->GetObjectrepeat(i);
|
|
|
+ WriteObjectrepeat(nodeObject,pObject_repeat);
|
|
|
+ }
|
|
|
+
|
|
|
+ unsigned nmaterialcount = pObject->GetObjectmaterialCount();
|
|
|
+ for(i=0;i<nmaterialcount;i++)
|
|
|
+ {
|
|
|
+ Object_material * pObject_material = pObject->GetObjectmaterial(i);
|
|
|
+ WriteObjectMaterial(nodeObject,pObject_material);
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+}
|
|
|
+//--------------
|
|
|
+
|
|
|
+bool OpenDriveXmlWriter::WriteObjectrepeat(TiXmlElement * node,Object_repeat * pObject_repeat)
|
|
|
+{
|
|
|
+ double s;
|
|
|
+ double length;
|
|
|
+ double distance;
|
|
|
+ double tStart;
|
|
|
+ double tEnd;
|
|
|
+ double heightStart;
|
|
|
+ double heightEnd;
|
|
|
+ double zOffsetStart;
|
|
|
+ double zOffsetEnd;
|
|
|
+
|
|
|
+ double widthStart;
|
|
|
+ double widthEnd;
|
|
|
+ double lengthStart;
|
|
|
+ double lengthEnd;
|
|
|
+ double radiusStart;
|
|
|
+ double radiusEnd;
|
|
|
+
|
|
|
+ s = pObject_repeat->Gets();
|
|
|
+ length = pObject_repeat->Getlength();
|
|
|
+ distance = pObject_repeat->Getdistance();
|
|
|
+ tStart = pObject_repeat->GettStart();
|
|
|
+ tEnd = pObject_repeat->GettEnd();
|
|
|
+ heightStart = pObject_repeat->GetheightStart();
|
|
|
+ heightEnd = pObject_repeat->GetheightEnd();
|
|
|
+ zOffsetStart = pObject_repeat->GetzOffsetStart();
|
|
|
+ zOffsetEnd = pObject_repeat->GetzOffsetEnd();
|
|
|
+
|
|
|
+ TiXmlElement* nodeObjectRepeat = new TiXmlElement("repeat");
|
|
|
+ node->LinkEndChild(nodeObjectRepeat);
|
|
|
+ nodeObjectRepeat->SetDoubleAttribute("s",s);
|
|
|
+ nodeObjectRepeat->SetDoubleAttribute("length",length);
|
|
|
+ nodeObjectRepeat->SetDoubleAttribute("distance",distance);
|
|
|
+ nodeObjectRepeat->SetDoubleAttribute("tStart",tStart);
|
|
|
+ nodeObjectRepeat->SetDoubleAttribute("tEnd",tEnd);
|
|
|
+ nodeObjectRepeat->SetDoubleAttribute("heightStart",heightStart);
|
|
|
+ nodeObjectRepeat->SetDoubleAttribute("heightEnd",heightEnd);
|
|
|
+ nodeObjectRepeat->SetDoubleAttribute("zOffsetStart",zOffsetStart);
|
|
|
+ nodeObjectRepeat->SetDoubleAttribute("zOffsetEnd",zOffsetEnd);
|
|
|
+
|
|
|
+ if(pObject_repeat->GetwidthStart(widthStart) == 1)
|
|
|
+ {
|
|
|
+ nodeObjectRepeat->SetDoubleAttribute("widthStart",widthStart);
|
|
|
+ }
|
|
|
+ if(pObject_repeat->GetwidthEnd(widthEnd) == 1)
|
|
|
+ {
|
|
|
+ nodeObjectRepeat->SetDoubleAttribute("widthEnd",widthEnd);
|
|
|
+ }
|
|
|
+ if(pObject_repeat->GetlengthStart(lengthStart) == 1)
|
|
|
+ {
|
|
|
+ nodeObjectRepeat->SetDoubleAttribute("lengthStart",lengthStart);
|
|
|
+ }
|
|
|
+ if(pObject_repeat->GetlengthEnd(lengthEnd) == 1)
|
|
|
+ {
|
|
|
+ nodeObjectRepeat->SetDoubleAttribute("lengthEnd",lengthEnd);
|
|
|
+ }
|
|
|
+ if(pObject_repeat->GetradiusStart(radiusStart) == 1)
|
|
|
+ {
|
|
|
+ nodeObjectRepeat->SetDoubleAttribute("radiusStart",radiusStart);
|
|
|
+ }
|
|
|
+ if(pObject_repeat->GetradiusEnd(radiusEnd) == 1)
|
|
|
+ {
|
|
|
+ nodeObjectRepeat->SetDoubleAttribute("radiusEnd",radiusEnd);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+}
|
|
|
+//--------------
|
|
|
+bool OpenDriveXmlWriter::WriteObjectMaterial(TiXmlElement * node,Object_material * pObject_material)
|
|
|
+{
|
|
|
+ TiXmlElement* nodeObjectMaterial = new TiXmlElement("material");
|
|
|
+ node->LinkEndChild(nodeObjectMaterial);
|
|
|
+ string surface;
|
|
|
+ double friction;
|
|
|
+ double roughness;
|
|
|
+ if(pObject_material->Getsurface(surface) == 1)
|
|
|
+ {
|
|
|
+ nodeObjectMaterial->SetAttribute("surface",surface);
|
|
|
+ }
|
|
|
+ if(pObject_material->Getfriction(friction) == 1)
|
|
|
+ {
|
|
|
+ nodeObjectMaterial->SetDoubleAttribute("friction",friction);
|
|
|
+ }
|
|
|
+ if(pObject_material->Getroughness(roughness) == 1)
|
|
|
+ {
|
|
|
+ nodeObjectMaterial->SetDoubleAttribute("roughness",roughness);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
+//--------------
|
|
|
+bool OpenDriveXmlWriter::WriteObjectParkingSpace(TiXmlElement *node, Object_parkingSpace *pObject_parkingSpace)
|
|
|
+{
|
|
|
+ TiXmlElement* nodeObjectParkingSpace = new TiXmlElement("parkingSpace");
|
|
|
+ node->LinkEndChild(nodeObjectParkingSpace);
|
|
|
+ nodeObjectParkingSpace->SetAttribute("access",pObject_parkingSpace->Getaccess());
|
|
|
+ if(pObject_parkingSpace->Getrestrictions() != "")
|
|
|
+ {
|
|
|
+ nodeObjectParkingSpace->SetAttribute("restrictions",pObject_parkingSpace->Getrestrictions());
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+}
|
|
|
+//--------------
|
|
|
|
|
|
bool OpenDriveXmlWriter::WriteSignals (TiXmlElement *node, Road* road)
|
|
|
{
|
|
@@ -934,8 +1329,8 @@ bool OpenDriveXmlWriter::WriteSignal(TiXmlElement *node, Signal * pSignal)
|
|
|
TiXmlElement* nodeSignal = new TiXmlElement("signal");
|
|
|
node->LinkEndChild(nodeSignal);
|
|
|
|
|
|
- nodeSignal->SetAttribute("s",pSignal->Gets());
|
|
|
- nodeSignal->SetAttribute("t",pSignal->Gett());
|
|
|
+ nodeSignal->SetDoubleAttribute("s",pSignal->Gets());
|
|
|
+ nodeSignal->SetDoubleAttribute("t",pSignal->Gett());
|
|
|
nodeSignal->SetAttribute("id",pSignal->Getid());
|
|
|
nodeSignal->SetAttribute("name",pSignal->Getname());
|
|
|
if(pSignal->Getdynamic() == true)
|
|
@@ -943,16 +1338,16 @@ bool OpenDriveXmlWriter::WriteSignal(TiXmlElement *node, Signal * pSignal)
|
|
|
else
|
|
|
nodeSignal->SetAttribute("dynamic","no");
|
|
|
nodeSignal->SetAttribute("orientation",pSignal->Getorientation());
|
|
|
- nodeSignal->SetAttribute("zOffset",pSignal->GetzOffset());
|
|
|
+ nodeSignal->SetDoubleAttribute("zOffset",pSignal->GetzOffset());
|
|
|
nodeSignal->SetAttribute("type",pSignal->Gettype());
|
|
|
nodeSignal->SetAttribute("country",pSignal->Getcountry());
|
|
|
nodeSignal->SetAttribute("countryRevision",pSignal->GetcountryRevision());
|
|
|
nodeSignal->SetAttribute("subtype",pSignal->Getsubtype());
|
|
|
- nodeSignal->SetAttribute("hOffset",pSignal->GethOffset());
|
|
|
- nodeSignal->SetAttribute("pitch",pSignal->Getpitch());
|
|
|
- nodeSignal->SetAttribute("roll",pSignal->Getroll());
|
|
|
- nodeSignal->SetAttribute("height",pSignal->Getheight());
|
|
|
- nodeSignal->SetAttribute("width",pSignal->Getwidth());
|
|
|
+ nodeSignal->SetDoubleAttribute("hOffset",pSignal->GethOffset());
|
|
|
+ nodeSignal->SetDoubleAttribute("pitch",pSignal->Getpitch());
|
|
|
+ nodeSignal->SetDoubleAttribute("roll",pSignal->Getroll());
|
|
|
+ nodeSignal->SetDoubleAttribute("height",pSignal->Getheight());
|
|
|
+ nodeSignal->SetDoubleAttribute("width",pSignal->Getwidth());
|
|
|
|
|
|
signal_laneValidity * psignal_lanevalidity = pSignal->GetlaneValidity();
|
|
|
if(psignal_lanevalidity != 0)
|