\brief The route is composed of one or several subroutes. Every subroute is composed of segments. For every Segment is kept some attributes in the structure SegmentInfo.
| 44 | /// \brief The route is composed of one or several subroutes. Every subroute is composed of segments. |
| 45 | /// For every Segment is kept some attributes in the structure SegmentInfo. |
| 46 | class RouteSegment final |
| 47 | { |
| 48 | public: |
| 49 | struct SpeedCamera |
| 50 | { |
| 51 | SpeedCamera() = default; |
| 52 | SpeedCamera(double coef, uint8_t maxSpeedKmPH) : m_coef(coef), m_maxSpeedKmPH(maxSpeedKmPH) {} |
| 53 | |
| 54 | bool EqualCoef(SpeedCamera const & rhs) const { return AlmostEqualAbs(m_coef, rhs.m_coef, 1.0E-5); } |
| 55 | |
| 56 | bool operator<(SpeedCamera const & rhs) const |
| 57 | { |
| 58 | if (!EqualCoef(rhs)) |
| 59 | return m_coef < rhs.m_coef; |
| 60 | |
| 61 | // Keep a camera with lowest speed (unique). |
| 62 | return m_maxSpeedKmPH < rhs.m_maxSpeedKmPH; |
| 63 | } |
| 64 | |
| 65 | friend std::string DebugPrint(SpeedCamera const & rhs); |
| 66 | |
| 67 | /// @todo Can replace with uint16_t feature node index, assuming that all cameras are placed on nodes. |
| 68 | // Сoefficient where camera placed at the segment (number from 0 to 1). |
| 69 | double m_coef = 0.0; |
| 70 | // Max speed |
| 71 | uint8_t m_maxSpeedKmPH = 0; |
| 72 | }; |
| 73 | |
| 74 | struct RoadNameInfo |
| 75 | { |
| 76 | // This is for street/road. |m_ref| |m_name|. |
| 77 | std::string m_name; // E.g "Johnson Ave.". |
| 78 | std::string m_destination_ref; // Number of next road, e.g. "CA 85", Sometimes "CA 85 South". Usually match |m_ref| |
| 79 | // of next main road. |
| 80 | // This is for 1st segment of link after junction. Exit |junction_ref| to |m_destination_ref| for |m_destination|. |
| 81 | std::string m_junction_ref; // Number of junction e.g. "398B". |
| 82 | std::string m_destination; // E.g. "Cupertino". |
| 83 | std::string m_ref; // Number of street/road e.g. "CA 85". |
| 84 | bool m_isLink = false; |
| 85 | |
| 86 | RoadNameInfo() = default; |
| 87 | RoadNameInfo(std::string name) : m_name(std::move(name)) {} |
| 88 | RoadNameInfo(std::string name, std::string destination_ref) |
| 89 | : m_name(std::move(name)) |
| 90 | , m_destination_ref(std::move(destination_ref)) |
| 91 | {} |
| 92 | RoadNameInfo(std::string name, std::string destination_ref, std::string junction_ref) |
| 93 | : m_name(std::move(name)) |
| 94 | , m_destination_ref(std::move(destination_ref)) |
| 95 | , m_junction_ref(std::move(junction_ref)) |
| 96 | {} |
| 97 | RoadNameInfo(std::string name, std::string ref, std::string junction_ref, std::string destination_ref, |
| 98 | std::string destination, bool isLink) |
| 99 | : m_name(std::move(name)) |
| 100 | , m_destination_ref(std::move(destination_ref)) |
| 101 | , m_junction_ref(std::move(junction_ref)) |
| 102 | , m_destination(std::move(destination)) |
| 103 | , m_ref(std::move(ref)) |