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

Method GetDistanceString

libs/platform/distance.cpp:137–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135}
136
137std::string Distance::GetDistanceString() const
138{
139 if (!IsValid())
140 return "";
141
142 // Default precision is 0 (no decimals).
143 int precision = 0;
144
145 // Set 1 decimal precision for high distances (km, miles) lower than 10.0 (9.5, 7.0,...).
146 if (m_distance < 10.0 && IsHighUnits())
147 precision = 1;
148
149 return ToStringPrecision(m_distance, precision);
150}
151
152std::string Distance::GetUnitsString() const
153{

Callers 3

ToJavaDistanceFunction · 0.80
UNIT_TESTFunction · 0.80
FormatDistanceFunction · 0.80

Calls 2

ToStringPrecisionFunction · 0.85
IsValidFunction · 0.50

Tested by 1

UNIT_TESTFunction · 0.64