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

Function ParseRect

qt/screenshoter.cpp:51–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51bool ParseRect(std::string_view s, char const * delim, m2::RectD & rect)
52{
53 // Order in string is: latLeftBottom, lonLeftBottom, latRigthTop, lonRigthTop.
54 strings::SimpleTokenizer iter(s, delim);
55 if (!iter)
56 return false;
57
58 double latLeftBottom;
59 double lonLeftBottom;
60 double latRigthTop;
61 double lonRigthTop;
62 if (strings::to_double(*iter, latLeftBottom) && mercator::ValidLat(latLeftBottom) && ++iter &&
63 strings::to_double(*iter, lonLeftBottom) && mercator::ValidLon(lonLeftBottom) && ++iter &&
64 strings::to_double(*iter, latRigthTop) && mercator::ValidLat(latRigthTop) && ++iter &&
65 strings::to_double(*iter, lonRigthTop) && mercator::ValidLon(lonRigthTop))
66 {
67 rect =
68 m2::RectD(mercator::FromLatLon(latLeftBottom, lonLeftBottom), mercator::FromLatLon(latRigthTop, lonRigthTop));
69 return true;
70 }
71 return false;
72}
73
74bool ParsePointsStr(std::string const & pointsStr, std::list<std::pair<m2::PointD, int>> & points)
75{

Callers 1

ParseRectsStrFunction · 0.85

Calls 4

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

Tested by

no test coverage detected