Branch data Line data Source code
1 : : // ----------------- BEGIN LICENSE BLOCK --------------------------------- 2 : : // 3 : : // Copyright (C) 2018-2021 Intel Corporation 4 : : // 5 : : // SPDX-License-Identifier: MIT 6 : : // 7 : : // ----------------- END LICENSE BLOCK ----------------------------------- 8 : : /** 9 : : * @file 10 : : */ 11 : : 12 : : #pragma once 13 : : 14 : : #include "ad/map/landmark/LandmarkIdValidInputRange.hpp" 15 : : #include "ad/map/landmark/LandmarkValidInputRange.hpp" 16 : : #include "ad/map/landmark/Types.hpp" 17 : : #include "ad/map/lane/Types.hpp" 18 : : 19 : : /** @brief namespace ad */ 20 : : namespace ad { 21 : : /** @brief namespace map */ 22 : : namespace map { 23 : : /** @brief namespace landmark */ 24 : : namespace landmark { 25 : : 26 : : /** 27 : : * @brief checks if the given Landmark is valid 28 : : * 29 : : * The landmark is valid if it's within valid input range. 30 : : */ 31 : : inline bool isValid(Landmark const &landmark, bool const logErrors = true) 32 : : { 33 : : return withinValidInputRange(landmark, logErrors); 34 : : } 35 : : 36 : : /** 37 : : * @brief checks if the given LandmarkId is valid 38 : : * 39 : : * The landmarkId is valid if it's within valid input range. 40 : : */ 41 : 5606 : inline bool isValid(LandmarkId const &landmarkId, bool const logErrors = true) 42 : : { 43 : 5606 : return withinValidInputRange(landmarkId, logErrors); 44 : : } 45 : : 46 : : /** 47 : : * @brief Method to be called to retrieve Landmark::Ptr from the Store. 48 : : * @param[in] id Landmark identifier. 49 : : * @returns Landmark::Ptr with given identifier. 50 : : * Throws std::invalid_argument if landmark does not exist in the store. 51 : : */ 52 : : Landmark::ConstPtr getLandmarkPtr(LandmarkId const &id); 53 : : 54 : : /** 55 : : * @brief Method to be called to retrieve Landmark from the Store. 56 : : * @param[in] id Landmark identifier. 57 : : * @returns Landmark with given identifier. 58 : : * Throws std::invalid_argument if landmark does not exist in the store. 59 : : */ 60 : : Landmark const &getLandmark(LandmarkId const &id); 61 : : 62 : : /** 63 : : * @returns the enu heading of the landmark 64 : : */ 65 : : point::ENUHeading getENUHeading(Landmark const &landmark); 66 : : 67 : : /** 68 : : * @returns all Landmarks in the Store. 69 : : */ 70 : : landmark::LandmarkIdList getLandmarks(); 71 : : 72 : : /** 73 : : * @brief Method to be called to retrieve Landmark from the Store and convert to ENU representation. 74 : : * @param[in] id Landmark identifier. 75 : : * @returns Landmark with given identifier. 76 : : * @throws std::invalid_argument if the landmark id does not exist in the store 77 : : */ 78 : : ENULandmark getENULandmark(LandmarkId const &id); 79 : : 80 : : /** 81 : : * @brief Method to be called to retrieve all the visible landmarks from the given lane 82 : : * @param[in] laneId the lane the landmarks refer to 83 : : * @returns Landmarks visible from given lane. 84 : : */ 85 : : LandmarkIdList getVisibleLandmarks(lane::LaneId const &laneId); 86 : : 87 : : /** 88 : : * @brief Method to be called to retrieve all the visible landmarks of type landmarkType from the given lane 89 : : * @param[in] landmarkType Landmark type desired. 90 : : * @param[in] laneId the lane the landmarks refer to 91 : : * @returns Landmarks of landmarkType visible from given lane. 92 : : */ 93 : : LandmarkIdList getVisibleLandmarks(LandmarkType const &landmarkType, lane::LaneId const &laneId); 94 : : 95 : : /** 96 : : * @brief Method to be called to search the nearest landmarkid given the geo point 97 : : * @param[in] The geo point given 98 : : * @returns returns search result of Landmarkid from given geo point. 99 : : */ 100 : : LandmarkId uniqueLandmarkId(point::GeoPoint const &geoPoint); 101 : : 102 : : /** 103 : : * @brief Method to be called to retrieve all the visible traffic lights from the given lane 104 : : * @param[in] laneId the lane the landmarks refer to 105 : : * @returns Traffic light landmarks visible from given lane. 106 : : */ 107 : 2 : inline LandmarkIdList getVisibleTrafficLights(lane::LaneId const &laneId) 108 : : { 109 [ + + ]: 3 : return getVisibleLandmarks(landmark::LandmarkType::TRAFFIC_LIGHT, laneId); 110 : : } 111 : : 112 : : } // namespace landmark 113 : : } // namespace map 114 : : } // namespace ad