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

Function ReadPolygon

generator/borders.cpp:102–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100};
101
102bool ReadPolygon(std::istream & stream, Polygon & poly, std::string const & filename)
103{
104 std::string line, name;
105 double lon, lat;
106
107 // read ring id, fail if it's empty
108 std::getline(stream, name);
109 if (name.empty() || name == "END")
110 return false;
111
112 while (stream.good())
113 {
114 std::getline(stream, line);
115 strings::Trim(line);
116
117 if (line.empty())
118 continue;
119
120 if (line == "END")
121 break;
122
123 std::istringstream iss(line);
124 iss >> lon >> lat;
125 CHECK(!iss.fail(), ("Incorrect data in", filename));
126
127 poly.AddPoint(mercator::FromLatLon(lat, lon));
128 }
129
130 // drop inner rings
131 return name[0] != '!';
132}
133} // namespace
134
135bool CountryPolygons::Contains(m2::PointD const & point) const

Callers 1

LoadBordersFunction · 0.85

Calls 4

TrimFunction · 0.85
FromLatLonFunction · 0.70
emptyMethod · 0.45
AddPointMethod · 0.45

Tested by

no test coverage detected