engine.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #pragma once
  2. #include <vector>
  3. #include <string>
  4. // 定义地图相关信息结构体
  5. // 定义坐标点结构体
  6. struct Point
  7. {
  8. // 构造函数
  9. Point(double x, double y, double h) : pos_x(x), pos_y(y), heading(h) {};
  10. double pos_x;
  11. double pos_y;
  12. double heading; // 大地坐标系,弧度
  13. };
  14. // 定义交通标牌信息结构体
  15. struct SignalInfo
  16. {
  17. int sign_id;
  18. int sign_type;
  19. int sign_type1;
  20. int sign_ref_link;
  21. std::vector<Point> sign_coords;
  22. };
  23. // 定义人行横道信息结构体
  24. struct CrosswalkInfo
  25. {
  26. int cross_id;
  27. std::vector<Point> cross_coords;
  28. };
  29. // 定义交通信号灯信息结构体
  30. struct TrafficlightInfo
  31. {
  32. int trafficlight_id;
  33. int trafficlight_ref_link;
  34. std::vector<int> trafficlight_ref_lane;
  35. int trafficlight_type;
  36. // int trafficlight_head;
  37. std::vector<int> trafficlight_head;
  38. std::vector<Point> trafficlight_coords;
  39. };
  40. // 定义路口信息结构体
  41. struct InterInfo
  42. {
  43. int inter_id;
  44. std::vector<int> inter_ref_link;
  45. int inter_type;
  46. int inter_in_shape;
  47. std::vector<Point> inter_coords;
  48. };
  49. // 定义车道停止线信息结构体
  50. struct StoplineInfo
  51. {
  52. int stopline_id;
  53. int stopline_ref_link;
  54. std::vector<int> stopline_ref_lane;
  55. int stopline_color;
  56. int stopline_type;
  57. std::vector<Point> stopline_coords;
  58. };
  59. // 定义道路信息结构体
  60. struct RoadInfo
  61. {
  62. int link_id;
  63. int link_fc;
  64. int link_type;
  65. int link_speed_max;
  66. int link_speed_min;
  67. int link_direction;
  68. int link_lanenum;
  69. std::vector<Point> link_coords;
  70. };
  71. // 定义车道信息结构体
  72. struct LaneInfo
  73. {
  74. int lane_id;
  75. double lane_length;
  76. int lane_type;
  77. double lane_width;
  78. int lane_turn;
  79. int lane_ref_link;
  80. int lane_speed_max;
  81. int lane_speed_min;
  82. std::vector<Point> lane_coords;
  83. };
  84. // 定义车道箭头信息结构体
  85. struct ArrowInfo
  86. {
  87. int arrow_id;
  88. int arrow_ref_lane;
  89. std::vector<int> arrow_direction;
  90. std::vector<Point> arrow_coords;
  91. };
  92. // 获取地图相关信息函数声明
  93. // 初始化函数
  94. bool engineInit(const std::string &folder_path);
  95. // 2024.10.30
  96. // 根据位置获取指定范围内所有路口信息
  97. std::vector<InterInfo> getInters(const std::string &intercsvPath, const Point &point, double distance);
  98. // 根据位置获取指定范围内所有人行横道信息
  99. std::vector<CrosswalkInfo> getCrosswalks(const std::string &crosscsvPath, const Point &point, double distance);
  100. // 根据位置获取前方指定范围内所有交通信号灯信息
  101. std::vector<TrafficlightInfo> getForwardTrafficlight(const std::string &lightcsvPath, const Point &point, double distance);
  102. // 根据位置获取所在道路信息
  103. std::vector<RoadInfo> getLink(const std::string &linkcsvPath, const Point &point);
  104. // 根据位置获取所在车道信息
  105. std::vector<LaneInfo> getLane(const std::string &lanecsvPath, const Point &point);
  106. // 根据位置获取指定范围内所有交通标牌信息
  107. std::vector<SignalInfo> getSignals(const std::string &signcsvPath, const Point &point, double distance);
  108. // 根据位置获取指定范围内车道停止线信息;
  109. std::vector<StoplineInfo> getStopline(const std::string &stoplinecsvPath, const Point &point, double distance);
  110. // 根据位置获取指定范围内车道箭头信息
  111. std::vector<ArrowInfo> getArrow(const std::string &arrowcsvPath, const Point &point, double distance);