MCPcopy Create free account
hub / github.com/comaps/comaps / CalcMaxSpeed

Function CalcMaxSpeed

libs/routing/index_router.cpp:91–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89double constexpr kCloseMwmPointsDistanceM = 300000;
90
91double CalcMaxSpeed(NumMwmIds const & numMwmIds, VehicleModelFactoryInterface const & vehicleModelFactory,
92 VehicleType vehicleType)
93{
94 if (vehicleType == VehicleType::Transit)
95 return kTransitMaxSpeedKMpH;
96
97 double maxSpeed = 0.0;
98 numMwmIds.ForEachId([&](NumMwmId id)
99 {
100 string const & country = numMwmIds.GetFile(id).GetName();
101 double const mwmMaxSpeed = vehicleModelFactory.GetVehicleModelForCountry(country)->GetMaxWeightSpeed();
102 maxSpeed = max(maxSpeed, mwmMaxSpeed);
103 });
104 CHECK_GREATER(maxSpeed, 0.0, ("Most likely |numMwmIds| is empty."));
105 return maxSpeed;
106}
107
108SpeedKMpH const & CalcOffroadSpeed(VehicleModelFactoryInterface const & vehicleModelFactory)
109{

Callers 1

IndexRouterMethod · 0.85

Calls 5

ForEachIdMethod · 0.80
GetFileMethod · 0.80
GetNameMethod · 0.45
GetMaxWeightSpeedMethod · 0.45

Tested by

no test coverage detected