Skip to content

Commit

Permalink
Support for GeoJson Paths and Polygons
Browse files Browse the repository at this point in the history
  • Loading branch information
computate committed Nov 15, 2023
1 parent 34104e2 commit 794ad25
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/main/java/org/computate/frFR/java/EcrireGenClasse.java
Original file line number Diff line number Diff line change
Expand Up @@ -3768,11 +3768,17 @@ else if(entiteSetUpper)
tl(2, "if(o != null) {");
tl(3, "try {");
tl(4, entiteNomCanoniqueGenerique == null ? entiteNomSimple : entiteNomSimpleGenerique, " shape = new ", entiteNomCanoniqueGenerique == null ? entiteNomSimple : entiteNomSimpleGenerique, "();");
tl(4, "o.getJsonArray(\"coordinates\").stream().map(a -> (JsonArray)a).forEach(g -> {");
tl(5, "g.stream().map(a -> (JsonArray)a).forEach(points -> {");
tl(6, "shape.addPoint(new Point(Double.parseDouble(points.getString(0)), Double.parseDouble(points.getString(1))));");
tl(5, "});");
tl(4, "});");
if(StringUtils.equals(entiteNomCanonique, VAL_nomCanoniquePath) || StringUtils.equals(entiteNomCanoniqueGenerique, VAL_nomCanoniquePath)) {
tl(4, "o.getJsonArray(\"coordinates\").stream().map(a -> (JsonArray)a).forEach(points -> {");
tl(5, "shape.addPoint(new Point(Double.parseDouble(points.getString(0)), Double.parseDouble(points.getString(1))));");
tl(4, "});");
} else if(StringUtils.equals(entiteNomCanonique, VAL_nomCanoniquePolygon) || StringUtils.equals(entiteNomCanoniqueGenerique, VAL_nomCanoniquePolygon)) {
tl(4, "o.getJsonArray(\"coordinates\").stream().map(a -> (JsonArray)a).forEach(g -> {");
tl(5, "g.stream().map(a -> (JsonArray)a).forEach(points -> {");
tl(6, "shape.addPoint(new Point(Double.parseDouble(points.getString(0)), Double.parseDouble(points.getString(1))));");
tl(5, "});");
tl(4, "});");
}
tl(4, "return shape;");
tl(3, "} catch(Exception ex) {");
tl(4, "ExceptionUtils.rethrow(ex);");
Expand Down

0 comments on commit 794ad25

Please sign in to comment.