| 139 | } |
| 140 | |
| 141 | bool 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 | |
| 163 | bool GetBordersRect(std::string const & baseDir, std::string const & country, m2::RectD & bordersRect) |
| 164 | { |