Files
comaps/traffic/speed_groups.hpp
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

45 lines
1.3 KiB
C++

#pragma once
#include <cstdint>
#include <string>
namespace traffic
{
enum class SpeedGroup : uint8_t
{
G0 = 0,
G1,
G2,
G3,
G4,
G5,
TempBlock,
Unknown,
Count
};
static_assert(static_cast<uint8_t>(SpeedGroup::Count) <= 8, "");
// Let M be the maximal speed that is possible on a free road
// and let V be the maximal speed that is possible on this road when
// taking the traffic data into account.
// We group all possible ratios (V/M) into a small number of
// buckets and only use the number of a bucket everywhere.
// That is, we forget the specific values of V when transmitting and
// displaying traffic information. The value M of a road is known at the
// stage of building the mwm containing this road.
//
// kSpeedGroupThresholdPercentage[g] denotes the maximal value of (V/M)
// that is possible for group |g|. Values falling on a border of two groups
// may belong to either group.
//
// The threshold percentage is defined to be 100 for the
// special groups where V is unknown or not defined.
extern uint32_t const kSpeedGroupThresholdPercentage[static_cast<size_t>(SpeedGroup::Count)];
/// \note This method is used in traffic jam generation.
SpeedGroup GetSpeedGroupByPercentage(double p);
std::string DebugPrint(SpeedGroup const & group);
} // namespace traffic