From 794ad259dfea8c30fdc3f0fe4db48b562630b572 Mon Sep 17 00:00:00 2001 From: Christopher Tate Date: Wed, 15 Nov 2023 15:31:27 -0700 Subject: [PATCH] Support for GeoJson Paths and Polygons --- .../org/computate/frFR/java/EcrireGenClasse.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/computate/frFR/java/EcrireGenClasse.java b/src/main/java/org/computate/frFR/java/EcrireGenClasse.java index f4dfb9c6..81a38b48 100644 --- a/src/main/java/org/computate/frFR/java/EcrireGenClasse.java +++ b/src/main/java/org/computate/frFR/java/EcrireGenClasse.java @@ -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);");