From 6b149fa89a48d3e082f4e928cd579c94f1f339b5 Mon Sep 17 00:00:00 2001
From: Riegel <alexander.riegel@hft-stuttgart.de>
Date: Fri, 13 Dec 2024 10:21:48 +0100
Subject: [PATCH] Refactor: Add logging output for missing EPSG code

---
 .../hft/stuttgart/citydoctor2/parser/CityGmlParser.java   | 8 +++++++-
 .../src/main/resources/CityDoctorLocalization.properties  | 3 ++-
 .../main/resources/CityDoctorLocalization_de.properties   | 5 +++--
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/parser/CityGmlParser.java b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/parser/CityGmlParser.java
index 765bb50..495b2c0 100644
--- a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/parser/CityGmlParser.java
+++ b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/parser/CityGmlParser.java
@@ -570,18 +570,24 @@ public class CityGmlParser {
     private static void logEpsgParseError(Exception e) {
         logger.debug("Exception while parsing for EPSG code", e);
         if (logger.isWarnEnabled()) {
-            logger.warn(Localization.getText("CityGmlParser.noEPSG"));
+            logger.warn(Localization.getText("CityGmlParser.failedEPSGParse"));
         }
     }
 
     private static void parseCoordinateSystem(ParserConfiguration config, CityGmlHandler handler) {
         if (handler.getEpsg() == null) {
+            if (logger.isWarnEnabled()) {
+                logger.warn(Localization.getText("CityGmlParser.missingEPSGCode"));
+            }
             return;
         }
         CoordinateReferenceSystem crs = crsFromSrsName(handler.getEpsg());
         if (crs == null) {
             // could not find a coordinate system for srsName
             // assuming metric system
+            if (logger.isWarnEnabled()) {
+                logger.warn(Localization.getText("CityGmlParser.missingEPSGCode"));
+            }
             return;
         }
         if (crs.getProjection().getUnits() == Units.METRES) {
diff --git a/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization.properties b/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization.properties
index f7ad545..01a8b3c 100644
--- a/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization.properties
+++ b/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization.properties
@@ -121,7 +121,8 @@ CityGmlParser.notValidGmlFile=This is not a valid GML-File\n
 CityGmlParser.errorReadingGmlFile=Error while reading city gml file\n{}
 CityGmlParser.errorWritingGmlFile=Error while writing city gml file\n{}
 CityGmlParser.noConversionNeeded=Coordinate system is in meters, no conversion done
-CityGmlParser.noEPSG=Could not read EPSG code, assuming metric system
+CityGmlParser.failedEPSGParse=Could not read EPSG code, fallback to metric system
+CityGmlParser.missingEPSGCode=No EPSG code found, assuming metric system
 OpenFileDialog.loadFailed=Failed to load CityGML File
 MainWindow.memoryLabel=Memory:
 CheckDialog.checksReenabledAlert=Some checks have been reenabled so that other wanted checks can be executed\nSee the log for more information.
diff --git a/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization_de.properties b/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization_de.properties
index 9023f19..a62ecf9 100644
--- a/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization_de.properties
+++ b/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization_de.properties
@@ -111,7 +111,7 @@ WriteReportDialog.xAxisLabel=Fehler
 WriteReportDialog.yAxisLabel=Anzahl
 Unit.Radian=Radiant
 Unit.Degree=Grad
-FeatureMapper.polygonUnreferenced=Polygon {} ist referenziert wurde aber nicht gefunden
+FeatureMapper.polygonUnreferenced=Polygon {} ist referenziert, konnte aber nicht gefunden werden
 GeometryMapper.emptyPolygon=Polygon ohne externen Ring gefunden, ignoriere
 CityGmlParser.parsedObjects=Modell mit {} Objekten gelesen
 CityGmlParser.chunkReadFailed=Konnte Datei nicht in St\u00fccken lesen, versuche komplett zu lesen
@@ -119,7 +119,8 @@ CityGmlParser.notValidGmlFile=Dies ist keine korrekte CityGML Datei\n
 CityGmlParser.errorReadingGmlFile=Fehler beim lesen der CityGML Datei\n{}
 CityGmlParser.errorWritingGmlFile=Fehler beim schreiben der CityGML Datei\n{}
 CityGmlParser.noConversionNeeded=Koordinatensystem in Metern, keine Konvertierung notwendig
-CityGmlParser.noEPSG=Konnte EPSG Code nicht lesen, nehme metrisches System an
+CityGmlParser.failedEPSGParse=Lesen des EPSG Codes fehlgeschlagen, greife auf metrisches System zur\u00fcck
+CityGmlParser.missingEPSGCode=Kein EPSG Code gefunden, nehme metrisches System an
 OpenFileDialog.loadFailed=Konnte CityGML Datei nicht laden
 MainWindow.memoryLabel=Speicher:
 CheckDialog.checksReenabledAlert=Manche Pr\u00fcfungen wurden reaktiviert damit andere gewollte Pr\u00fcfungen durchgef\u00fchrt werden k\u00f6nnen\nMehr Details sind im Log geschrieben
-- 
GitLab