ref: 7c38fba56a72242a218c259981c57b7e451ce6b3
parent: bf716fa7786ee20a1e6c5bb2b80a3981f430fc43
author: sirjofri <sirjofri@sirjofri.de>
date: Sun Apr 6 10:18:03 EDT 2025
fixes polygon format parsing
--- a/geojson.c
+++ b/geojson.c
@@ -175,6 +175,7 @@
renderpolygon(JSON *j)
{
JSON *last;
+ JSONEl *el;
double x1, y1, x2, y2;
GPos f, t;
@@ -181,22 +182,24 @@
if (!(j && j->t == JSONArray))
return 0;
- if (!renderlinestring(j, &last))
- return 0;
-
- if (!last)
- return 0;
-
- if (!jsoncoords(j->first->val, &x2, &y2))
- return 0;
- if (!jsoncoords(last, &x1, &y1))
- return 0;
-
- f.lon = x1;
- f.lat = y1;
- t.lon = x2;
- t.lat = y2;
- drawline(f, t);
+ for (el = j->first; el; el = el->next) {
+ if (!renderlinestring(el->val, &last))
+ return 0;
+
+ if (!last)
+ return 0;
+
+ if (!jsoncoords(el->val->first->val, &x2, &y2))
+ return 0;
+ if (!jsoncoords(last, &x1, &y1))
+ return 0;
+
+ f.lon = x1;
+ f.lat = y1;
+ t.lon = x2;
+ t.lat = y2;
+ drawline(f, t);
+ }
return 1;
}
--
⑨