From 358dfea599bd5c0f4babacffd4d4aeac212f5051 Mon Sep 17 00:00:00 2001 From: Matthias Betz <matthias.betz@hft-stuttgart.de> Date: Tue, 16 May 2023 16:09:54 +0200 Subject: [PATCH] Add option to not store quality ade --- .../citydoctor2/datastructure/CityDoctorModel.java | 9 ++++++++- .../citydoctor2/datastructure/CityDoctorModelTest.java | 4 ++-- .../hft/stuttgart/citydoctor2/CityDoctorValidation.java | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/CityDoctorModel.java b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/CityDoctorModel.java index 9e39779..0647f15 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/CityDoctorModel.java +++ b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/CityDoctorModel.java @@ -123,11 +123,18 @@ public class CityDoctorModel { water.stream()).flatMap(co -> co); } - public void saveAs(String file) throws CityDoctorWriteException { + public void saveAs(String file, boolean saveQualityAde) throws CityDoctorWriteException { if (file.endsWith(".off")) { exportAsOff(file); } else { + ValidationPlan tempPlan = plan; + if (!saveQualityAde) { + setValidated(null); + } exportAsGML(file); + if (!saveQualityAde) { + setValidated(tempPlan); + } } } diff --git a/CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/CityDoctorModelTest.java b/CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/CityDoctorModelTest.java index 5695a17..6d7cda6 100644 --- a/CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/CityDoctorModelTest.java +++ b/CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/CityDoctorModelTest.java @@ -140,7 +140,7 @@ public class CityDoctorModelTest { b.setGmlObject(gmlBuilding); model.addBuilding(b); File saveFile = folder.newFile(); - model.saveAs(saveFile.getAbsolutePath()); + model.saveAs(saveFile.getAbsolutePath(), true); assertTrue(saveFile.exists()); assertTrue(saveFile.length() > 0); @@ -206,7 +206,7 @@ public class CityDoctorModelTest { b.setGmlObject(gmlBuilding); model.addBuilding(b); File saveFile = folder.newFile(); - model.saveAs(saveFile.getAbsolutePath()); + model.saveAs(saveFile.getAbsolutePath(), true); assertTrue(saveFile.exists()); assertTrue(saveFile.length() > 0); diff --git a/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/CityDoctorValidation.java b/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/CityDoctorValidation.java index 3d9d228..9b5e1f1 100644 --- a/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/CityDoctorValidation.java +++ b/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/CityDoctorValidation.java @@ -176,7 +176,7 @@ public class CityDoctorValidation { Checker c = new Checker(config, model); c.runChecks(xmlOutput, pdfOutput, null); if (outputFile != null) { - model.saveAs(outputFile); + model.saveAs(outputFile, true); } } } -- GitLab