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

Function ParsePoint

libs/kml/serdes.cpp:595–618  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

593}
594
595bool ParsePoint(std::string_view s, char const * delim, m2::PointD & pt, geometry::Altitude & altitude)
596{
597 // Order in string is: lon, lat, z.
598 strings::SimpleTokenizer iter(s, delim);
599 if (!iter)
600 return false;
601
602 double lon;
603 if (strings::to_double(*iter, lon) && mercator::ValidLon(lon) && ++iter)
604 {
605 double lat;
606 if (strings::to_double(*iter, lat) && mercator::ValidLat(lat))
607 {
608 pt = mercator::FromLatLon(lat, lon);
609
610 double rawAltitude;
611 if (++iter && strings::to_double(*iter, rawAltitude))
612 altitude = static_cast<geometry::Altitude>(round(rawAltitude));
613
614 return true;
615 }
616 }
617 return false;
618}
619
620bool ParsePoint(std::string_view s, char const * delim, m2::PointD & pt)
621{

Callers 2

ParsePointWithAltitudeFunction · 0.70
SetOriginMethod · 0.70

Calls 4

ValidLonFunction · 0.85
ValidLatFunction · 0.85
to_doubleFunction · 0.50
FromLatLonFunction · 0.50

Tested by

no test coverage detected