[PATCH] Fix for flys/issue1735 (Versatz in den HYK-Dateien)

Wald Commits scm-commit at wald.intevation.org
Fri Jul 11 11:32:40 CEST 2014


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1405071138 -7200
# Node ID fac1aa67931be54acac75ea7d24d29379ef0cc2d
# Parent  cdb9f6d97f6aa3fca8d6745781362b8ea80cd47a
Fix for flys/issue1735 (Versatz in den HYK-Dateien)

diff -r cdb9f6d97f6a -r fac1aa67931b artifacts/src/main/java/org/dive4elements/river/artifacts/model/HYKFactory.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/HYKFactory.java	Thu Jul 10 18:02:08 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/HYKFactory.java	Fri Jul 11 11:32:18 2014 +0200
@@ -148,9 +148,9 @@
             "   ON e.id = f.hyk_entry_id " +
             " WHERE e.hyk_id = :hykid " +
             "   AND :km between " +
-            "     LEAST(e.km, e.km + :flowDir*(f.distance_vl/1000.0+0.001)) " +
+            "     LEAST(e.km, e.km + :flowDir*(f.distance_vl/1000.0-0.001)) " +
             "   AND " +
-            "     GREATEST(e.km, e.km + :flowDir*(f.distance_vl/1000.0+0.001))";
+            "     GREATEST(e.km, e.km + :flowDir*(f.distance_vl/1000.0-0.001))";
 
         SQLQuery sqlQuery = session.createSQLQuery(SQL)
             .addScalar("FID", StandardBasicTypes.INTEGER)
@@ -162,14 +162,22 @@
         sqlQuery.setDouble("flowDir", flowDir);
         sqlQuery.setDouble("km", km);
 
-        logger.debug("HYK SQL: " + sqlQuery.getQueryString());
+        boolean debug = logger.isDebugEnabled();
+
+        if (debug) {
+            logger.debug("HYK SQL: " + sqlQuery.getQueryString());
+        }
 
         List<Object[]> results = sqlQuery.list();
 
-        logger.debug("Found " + results.size() + " HYKFormation IDs in DB.");
+        if (debug) {
+            logger.debug("Found " + results.size() + " HYKFormation IDs in DB.");
+        }
 
         if (results == null || results.isEmpty()) {
-            logger.debug("No HYK found for ID " + hykid + " at km " + km);
+            if (debug) {
+                logger.debug("No HYK found for ID " + hykid + " at km " + km);
+            }
             return new ArrayList<HYKFormation>();
         }
 


More information about the Dive4Elements-commits mailing list