#pragma once #include <deque> #include <vector> #include <string> #include <optional>…
- User
#pragma once #include #include #include #include #include #include <unordered_map> #include
// Boost.Geometry #include <boost/geometry.hpp> #include <boost/geometry/algorithms/distance.hpp> #include <boost/geometry/algorithms/length.hpp> #include <boost/geometry/algorithms/intersection.hpp>
// Boost.Graph #include <boost/graph/adjacency_list.hpp> #include <boost/graph/dijkstra_shortest_paths.hpp>
#ifdef _WIN32 #ifdef ROADNETWORKMATCHER_EXPORTS #define ROADNETWORKMATCHER_API __declspec(dllexport) #else #define ROADNETWORKMATCHER_API __declspec(dllimport) #endif #else #define ROADNETWORKMATCHER_API #endif
namespace bg = boost::geometry; using BgPoint = bg::model::point<double, 2, bg::cs::cartesian>; using BgLine = bg::model::linestring; using BgPolygon = bg::model::polygon;
struct VertexProperties { BgPoint coord; };
// 定义图类型:顶点属性 + 边权重 using Graph = boost::adjacency_list< boost::listS, boost::vecS, boost::undirectedS, VertexProperties, // 顶点属性 boost::property<boost::edge_weight_t, double> // 边属性(权重)
;
using Vertex = boost::graph_traits::vertex_descriptor; using Edge = boost::graph_traits::edge_descriptor;
/// 基础结构体 struct TrajectoryPoint { double x; double y; double z; long long timestamp; // 时间戳 (毫秒/秒) };
struct MatchResult { double matched_x; double matched_y; double matched_z; int road_id; // 匹配到的道路/边 ID (-1 表示无) long long timestamp; // 对应的时间戳 bool valid; // 是否匹配成功(false 表示匹配失败或补点) }; struct Candidate { BgPoint proj; // 投影点 int roadIdx; // 道路索引 double dist; // 点到道路的距离 std::unordered_map<std::string, double> meta; // 额外信息(s, L, ends 等) };
struct RoadNode { int id; std::vector<std::pair<double, double>> coordinates; };
struct RoadProperties { std::string mapCode; int sourceId; int targetId; int cost; int reverseCost; std::vector rpadNodes; };
struct Geometry { std::string type; std::vector<std::pair<double, double>> coordinates; };
struct Segment { int id; int regionId; int mapId; std::string boundaryType; // "wall" or "gate" Geometry geometry; std::optional gpsGeometry; };
struct RegionInfo { int id; std::string name; int mapId; std::string shapeType; std::string regionType; // "Enclosure" or "Forbidden" or other Geometry geometry; std::optional gpsGeometry; std::optionalstd::string description; int zIndex; bool useRoadnetwork; std::string createdTime; std::string updatedTime; std::vector segments; };
struct RoadNetworkInfo { std::string roadType; RoadProperties properties; Geometry geometry; std::vector regions; };
class ROADNETWORKMATCHER_API RoadNetworkMatcher { public: RoadNetworkMatcher(const RoadNetworkInfo& networkInfo); ~RoadNetworkMatcher(); // 执行匹配,返回一个或多个匹配结果 RoadNetworkMatcher(const std::map<std::string, const RoadNetworkInfo>& networkInfo_set); ~RoadNetworkMatcher();
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.