Fix area of placeholders for degenerate multipolygons

This commit is contained in:
Eric Fischer
2017-02-06 14:14:34 -08:00
parent 4517bd6e90
commit 62e1018c87
6 changed files with 30 additions and 4 deletions
+21
View File
@@ -166,6 +166,27 @@ double get_area(drawvec &geom, size_t i, size_t j) {
return area;
}
double get_mp_area(drawvec &geom) {
double ret = 0;
for (size_t i = 0; i < geom.size(); i++) {
if (geom[i].op == VT_MOVETO) {
size_t j;
for (j = i + 1; j < geom.size(); j++) {
if (geom[j].op != VT_LINETO) {
break;
}
}
ret += get_area(geom, i, j);
i = j - 1;
}
}
return ret;
}
static void decode_clipped(mapbox::geometry::multi_polygon<long long> &t, drawvec &out) {
out.clear();