diff --git a/.gitignore b/.gitignore index d298a39d58b31307e5489a9b510af0134a292aad..c2bb26272239db6a8ed18a05e118e80c8fc0432c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ .cache/ +.clwb/ .vscode/ +bazel-* build/ compile_commands.json diff --git a/include/MapAPI/Common/identifier.h b/include/MapAPI/Common/identifier.h index e7e59e465e63526cc80c82b037b3b8754550d674..a1b8964790dc0fc51799d1f4f40f24cc5dd7712a 100644 --- a/include/MapAPI/Common/identifier.h +++ b/include/MapAPI/Common/identifier.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2023, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023-2024, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * Copyright (C) 2023, ANSYS, Inc. * * This program and the accompanying materials are made @@ -13,6 +13,7 @@ #define MAPSDK_MAPAPI_COMMON_IDENTIFIER_H #include <cstdint> +#include <limits> namespace map_api { diff --git a/include/MapAPI/lane.h b/include/MapAPI/lane.h index 29ca4b96e5dd6508a789e1a54aec220e519e2fe0..9be64a8df937bd653ef8427bacef02f921ff736f 100644 --- a/include/MapAPI/lane.h +++ b/include/MapAPI/lane.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2023, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023-2024, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * Copyright (C) 2023, ANSYS, Inc. * * This program and the accompanying materials are made @@ -12,6 +12,7 @@ #ifndef MAPSDK_MAPAPI_LANE_H #define MAPSDK_MAPAPI_LANE_H +#include <limits> #include <vector> #include "Common/common.h" @@ -19,6 +20,9 @@ namespace map_api { +using LocalLaneId = std::int64_t; +constexpr LocalLaneId UndefinedLocalLaneId{std::numeric_limits<LocalLaneId>::max()}; + struct Lane; struct RoadCondition @@ -80,6 +84,7 @@ struct Lane }; Identifier id{UndefinedId}; + LocalLaneId local_id{UndefinedLocalLaneId}; Type type; Subtype sub_type; @@ -145,6 +150,7 @@ inline bool ShallowVectorLaneComparison(const std::vector<Lane>& lhs, const std: inline bool operator==(const Lane& lhs, const Lane& rhs) noexcept { if (std::tie(lhs.id, + lhs.local_id, lhs.type, lhs.sub_type, lhs.centerline, @@ -154,6 +160,7 @@ inline bool operator==(const Lane& lhs, const Lane& rhs) noexcept lhs.road_condition, lhs.source_references) != std::tie(rhs.id, + rhs.local_id, rhs.type, rhs.sub_type, rhs.centerline, diff --git a/include/MapAPI/map.h b/include/MapAPI/map.h index c25f51fdf78fbd2bd81ab0340bf225c7c1b10168..2b22185d828faa232aa0e8855d37dad8c4219cfa 100644 --- a/include/MapAPI/map.h +++ b/include/MapAPI/map.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2023, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023-2024, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * Copyright (C) 2023, ANSYS, Inc. * * This program and the accompanying materials are made @@ -12,6 +12,7 @@ #ifndef MAPSDK_MAPAPI_MAP_H #define MAPSDK_MAPAPI_MAP_H +#include <limits> #include <memory> #include <string> #include <vector> diff --git a/test/map_test.cpp b/test/map_test.cpp index 7761f6f7c83075e37dd6b16498d8bad61d9243a6..831c23d66f332743a09b6d976974348d009cc096 100644 --- a/test/map_test.cpp +++ b/test/map_test.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2023, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2023-2024, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * Copyright (C) 2023, ANSYS, Inc. * * This program and the accompanying materials are made @@ -14,7 +14,7 @@ #include <gmock/gmock.h> #include <gtest/gtest.h> -#include "MapAPI/map.h" +#include <limits> namespace { @@ -51,10 +51,11 @@ inline auto CreateLaneBoundary(Identifier id, const units::length::meter_t start return std::move(lane_boundary); } -inline auto CreateLane(Identifier id, const units::length::meter_t start_x, const units::length::meter_t y_offset) +inline auto CreateLane(Identifier id, LocalLaneId local_id, const units::length::meter_t start_x, const units::length::meter_t y_offset) { auto lane = std::make_unique<Lane>(); lane->id = id; + lane->local_id = local_id; lane->type = Lane::Type::kDriving; lane->sub_type = Lane::Subtype::kUnknown; lane->centerline = Lane::Polyline{ @@ -76,10 +77,10 @@ inline Map CreateMapWithConnectedLanes() auto lane_boundary_104 = CreateLaneBoundary(104, 1000.0_m, 1.5_m); auto lane_boundary_105 = CreateLaneBoundary(105, 1000.0_m, -1.5_m); - auto lane_0 = CreateLane(0, 0.0_m, 3.0_m); - auto lane_1 = CreateLane(1, 0.0_m, 3.0_m); - auto lane_2 = CreateLane(2, 1000.0_m, 3.0_m); - auto lane_3 = CreateLane(3, 1000.0_m, 0.0_m); + auto lane_0 = CreateLane(0, 4, 0.0_m, 3.0_m); + auto lane_1 = CreateLane(1, 5, 0.0_m, 3.0_m); + auto lane_2 = CreateLane(2, 6, 1000.0_m, 3.0_m); + auto lane_3 = CreateLane(3, 7, 1000.0_m, 0.0_m); lane_0->left_lane_boundaries.push_back(*lane_boundary_100); lane_0->right_lane_boundaries.push_back(*lane_boundary_101);