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

Method GetFormattedCoordinate

libs/map/place_page_info.cpp:336–369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

334}
335
336std::string Info::GetFormattedCoordinate(CoordinatesFormat coordsFormat) const
337{
338 auto const & ll = GetLatLon();
339 auto const lat = ll.m_lat;
340 auto const lon = ll.m_lon;
341 switch (coordsFormat)
342 {
343 default:
344 case CoordinatesFormat::LatLonDMS: // DMS, comma separated
345 return measurement_utils::FormatLatLonAsDMS(lat, lon, false /*withComma*/, 2);
346 case CoordinatesFormat::LatLonDecimal: // Decimal, comma separated
347 return measurement_utils::FormatLatLon(lat, lon, true /* withComma */);
348 case CoordinatesFormat::OLCFull: // Open location code, long format
349 return openlocationcode::Encode({lat, lon});
350 case CoordinatesFormat::OSMLink: // Link to osm.org
351 return measurement_utils::FormatOsmLink(lat, lon, 14);
352 case CoordinatesFormat::UTM: // Universal Transverse Mercator
353 {
354 std::string utmCoords = utm_mgrs_utils::FormatUTM(lat, lon);
355 if (utmCoords.empty())
356 return "UTM: N/A";
357 else
358 return "UTM: " + utmCoords;
359 }
360 case CoordinatesFormat::MGRS: // Military Grid Reference System
361 {
362 std::string mgrsCoords = utm_mgrs_utils::FormatMGRS(lat, lon, 5);
363 if (mgrsCoords.empty())
364 return "MGRS: N/A";
365 else
366 return "MGRS: " + mgrsCoords;
367 }
368 }
369}
370
371void Info::SetRoadType(RoadWarningMarkType type, std::string const & localizedType, std::string const & distance)
372{

Callers

nothing calls this directly

Calls 8

GetLatLonFunction · 0.85
FormatLatLonAsDMSFunction · 0.85
FormatLatLonFunction · 0.85
FormatOsmLinkFunction · 0.85
FormatUTMFunction · 0.85
FormatMGRSFunction · 0.85
EncodeFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected