37 lines
970 B
C++
37 lines
970 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include "types/BasicTypes.h"
|
|
|
|
struct IntersectionPosition {
|
|
double longitude;
|
|
double latitude;
|
|
double altitude;
|
|
};
|
|
|
|
struct Intersection {
|
|
std::string id;
|
|
std::string name;
|
|
std::string trafficLightId;
|
|
IntersectionPosition position;
|
|
double radius; // 路口影响半径,单位:米
|
|
double stopDistance; // 建议停车距离,单位:米
|
|
};
|
|
|
|
class IntersectionConfig {
|
|
public:
|
|
static IntersectionConfig load(const std::string& configFile);
|
|
|
|
// 根据红绿灯ID查找路口
|
|
const Intersection* findByTrafficLightId(const std::string& trafficLightId) const;
|
|
|
|
// 根据路口ID查找路口
|
|
const Intersection* findById(const std::string& intersectionId) const;
|
|
|
|
// 获取所有路口配置
|
|
const std::vector<Intersection>& getIntersections() const { return intersections_; }
|
|
|
|
private:
|
|
std::vector<Intersection> intersections_;
|
|
};
|