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

Function ParsePoint

qt/screenshoter.cpp:30–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28namespace
29{
30bool ParsePoint(std::string_view s, char const * delim, m2::PointD & pt, uint8_t & zoom)
31{
32 // Order in string is: lat, lon, zoom.
33 strings::SimpleTokenizer iter(s, delim);
34 if (!iter)
35 return false;
36
37 double lat;
38 double lon;
39 uint8_t zoomLevel;
40 if (strings::to_double(*iter, lat) && mercator::ValidLat(lat) && ++iter && strings::to_double(*iter, lon) &&
41 mercator::ValidLon(lon) && ++iter && strings::to_uint(*iter, zoomLevel) && zoomLevel >= 1 &&
42 zoomLevel <= scales::GetUpperStyleScale())
43 {
44 pt = mercator::FromLatLon(lat, lon);
45 zoom = zoomLevel;
46 return true;
47 }
48 return false;
49}
50
51bool ParseRect(std::string_view s, char const * delim, m2::RectD & rect)
52{

Callers 1

ParsePointsStrFunction · 0.70

Calls 6

ValidLatFunction · 0.85
ValidLonFunction · 0.85
to_uintFunction · 0.85
GetUpperStyleScaleFunction · 0.85
to_doubleFunction · 0.50
FromLatLonFunction · 0.50

Tested by

no test coverage detected