Branch data Line data Source code
1 : : // ----------------- BEGIN LICENSE BLOCK --------------------------------- 2 : : // 3 : : // Copyright (C) 2019-2021 Intel Corporation 4 : : // 5 : : // SPDX-License-Identifier: MIT 6 : : // 7 : : // ----------------- END LICENSE BLOCK ----------------------------------- 8 : : 9 : : #pragma once 10 : : 11 : : #include <opendrive/types.hpp> 12 : : #include "ad/map/landmark/Types.hpp" 13 : : #include "ad/map/lane/Types.hpp" 14 : : 15 : : /** @brief namespace ad */ 16 : : namespace ad { 17 : : /** @brief namespace map */ 18 : : namespace map { 19 : : /** @brief namespace opendrive */ 20 : : namespace opendrive { 21 : : 22 : : /** 23 : : * @brief Converts an opendrive id into an ad::map::LaneId 24 : : * @param[in] id opendrive::Id 25 : : */ 26 : 226394 : inline lane::LaneId toLaneId(::opendrive::Id id) 27 : : { 28 : 226394 : return lane::LaneId(id); 29 : : } 30 : : 31 : : /** 32 : : * @brief Converts an OpenDRIVE landmark id 33 : : */ 34 : 4000 : inline landmark::LandmarkId toLandmarkId(int id) 35 : : { 36 : 4000 : return landmark::LandmarkId(size_t(id)); 37 : : } 38 : : 39 : : /** 40 : : * @brief Converts an OpenDRIVE signal type and subtype to a Landmark Type 41 : : */ 42 : : landmark::LandmarkType toLandmarkType(int type); 43 : : 44 : : /** 45 : : * @brief Converts an OpenDRIVE traffic sign type and subtype to a TrafficSignType 46 : : */ 47 : : landmark::TrafficSignType toTrafficSignType(int type, int subtype); 48 : : 49 : : /** 50 : : * @brief Derives the contact type from the given traffic signal type. Used for Right of way. 51 : : */ 52 : : lane::ContactType toContactType(int type); 53 : : 54 : : /** 55 : : * @brief Determines the contact location of a landmark based on heursitics. 56 : : * @param[in] signalReference ::opendrive::SignalReference the signal reference info 57 : : * @param[in] isJunction bool indicating whether the signal is present inside a lane that belongs to an intersection 58 : : * @returns \c The resulting contact location 59 : : */ 60 : : lane::ContactLocation toContactLocation(::opendrive::SignalReference const &signalReference, bool const &isJunction); 61 : : 62 : : /** 63 : : * @brief Converts an OpenDRIVE traffic signal type and subtype into a TrafficLightType 64 : : */ 65 : : landmark::TrafficLightType toTrafficLightType(int type, int subtype); 66 : : 67 : : /** 68 : : * @brief Converts an opendrive::LaneType into a ad::map::lane::Lane::Type 69 : : */ 70 : : lane::LaneType toLaneType(::opendrive::LaneType const &laneType); 71 : : 72 : : /** 73 : : * @brief Calculates the driving direction of the lane given its attributes 74 : : */ 75 : : lane::LaneDirection toLaneDirection(::opendrive::Lane const &lane, bool rightHandTraffic = true); 76 : : 77 : : /** 78 : : * @brief Converts an opendrive::Point type (in geo coordinates) to a point::GeoPoint type 79 : : */ 80 : : point::GeoPoint toGeo(::opendrive::Point const &geoPoint); 81 : : 82 : : /** 83 : : * @brief Converts an opendrive::Point type (in geo coordinates) to a point::ECEFPoint type 84 : : */ 85 : : point::ECEFPoint toECEF(::opendrive::Point const &geoPoint); 86 : : 87 : : /** 88 : : * @brief Converts an opendrive::Edge type to a point::Geometry type 89 : : * @param[in] edge Opendrive Edge to be converted 90 : : * @returns The equivalent point::Geometry 91 : : */ 92 : : point::Geometry toGeometry(std::vector<::opendrive::Point> edgePoints); 93 : : 94 : : } // namespace opendrive 95 : : } // namespace map 96 : : } // namespace ad