OpenDriveXmlParser.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #ifndef OPENDRIVEXMLPARSER_H
  2. #define OPENDRIVEXMLPARSER_H
  3. #include <vector>
  4. #include <string>
  5. #include <iostream>
  6. #include <fstream>
  7. #include "../TinyXML/tinyxml.h"
  8. #include "OpenDrive.h"
  9. /**
  10. * Class used to parse an XML file and fill in the OpenDrive structure
  11. *
  12. */
  13. class OpenDriveXmlParser
  14. {
  15. private:
  16. OpenDrive* mOpenDrive;
  17. public:
  18. /**
  19. * Constructor which saves a reference to OpenDrive structure
  20. */
  21. OpenDriveXmlParser (OpenDrive* openDriveObj);
  22. /**
  23. * Reads the data from the OpenDrive structure to a file
  24. */
  25. bool ReadFile(std::string fileName);
  26. /**
  27. * The following methods are used to read the data from the XML file and fill in the the OpenDrive structure
  28. * Methods follow the hierarchical structure and are called automatically when ReadFile is executed
  29. */
  30. bool ReadHeader (TiXmlElement *node);
  31. bool ReadRoad (TiXmlElement *node);
  32. bool ReadRoadLinks (Road* road, TiXmlElement *node);
  33. bool ReadRoadLink (Road* road, TiXmlElement *node, short int type);
  34. bool ReadRoadType (Road* road, TiXmlElement *node);
  35. //--------------
  36. bool ReadPlanView(Road* road, TiXmlElement *node);
  37. bool ReadGeometryBlock (Road* road, TiXmlElement *&node, short int blockType);
  38. bool ReadGeometry(GeometryBlock* geomBlock, TiXmlElement *node, short int geometryType);
  39. //--------------
  40. bool ReadElevationProfile (Road* road, TiXmlElement *node);
  41. bool ReadLateralProfile (Road* road, TiXmlElement *node);
  42. //--------------
  43. bool ReadLanes (Road* road, TiXmlElement *node);
  44. bool ReadLaneSections (Road* road, TiXmlElement *node);
  45. bool ReadLane (LaneSection* laneSection, TiXmlElement *node, short int laneType);
  46. bool ReadLaneWidth(Lane* lane, TiXmlElement *node);
  47. bool ReadLaneRoadMark(Lane* lane, TiXmlElement *node);
  48. bool ReadLaneMaterial(Lane* lane, TiXmlElement *node);
  49. bool ReadLaneVisibility(Lane* lane, TiXmlElement *node);
  50. bool ReadLaneSpeed(Lane* lane, TiXmlElement *node);
  51. bool ReadLaneAccess(Lane* lane, TiXmlElement *node);
  52. bool ReadLaneHeight(Lane* lane, TiXmlElement *node);
  53. //--------------
  54. bool ReadObjects (Road* road, TiXmlElement *node);
  55. bool ReadSignals (Road* road, TiXmlElement *node);
  56. //--------------
  57. bool ReadSurface (Road* road, TiXmlElement *node);
  58. //--------------
  59. bool ReadController (TiXmlElement *node);
  60. //--------------
  61. bool ReadJunction (TiXmlElement *node);
  62. bool ReadJunctionConnection (Junction* junction, TiXmlElement *node);
  63. bool ReadJunctionConnectionLaneLink (JunctionConnection* junctionConnection, TiXmlElement *node);
  64. //--------------
  65. bool ReadJunctionPriority (Junction* junction, TiXmlElement *node);
  66. bool ReadJunctionController (Junction* junction, TiXmlElement *node);
  67. //--------------
  68. };
  69. #endif