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

Function LoadBorders

generator/borders.cpp:141–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141bool LoadBorders(std::string const & borderFile, PolygonsList & outBorders)
142{
143 std::ifstream stream(borderFile);
144 std::string line;
145 if (!std::getline(stream, line).good()) // skip title
146 {
147 LOG(LERROR, ("Polygon file is empty:", borderFile));
148 return false;
149 }
150
151 Polygon currentPolygon;
152 while (ReadPolygon(stream, currentPolygon, borderFile))
153 {
154 CHECK(currentPolygon.IsValid(), ("Invalid region in", borderFile));
155 outBorders.emplace_back(std::move(currentPolygon));
156 currentPolygon = {};
157 }
158
159 CHECK(!outBorders.empty(), ("No borders were loaded from", borderFile));
160 return true;
161}
162
163bool GetBordersRect(std::string const & baseDir, std::string const & country, m2::RectD & bordersRect)
164{

Callers 7

CalcCrossMwmConnectorsFunction · 0.70
ForEachCountryFunction · 0.70
GetBordersRectFunction · 0.70
PointToMwmIdMethod · 0.50
InitMethod · 0.50
UNIT_TESTFunction · 0.50

Calls 4

ReadPolygonFunction · 0.85
IsValidMethod · 0.45
emplace_backMethod · 0.45
emptyMethod · 0.45

Tested by 1

UNIT_TESTFunction · 0.40