changeset 8030:fac1aa67931b

Fix for flys/issue1735 (Versatz in den HYK-Dateien)
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 11 Jul 2014 11:32:18 +0200
parents cdb9f6d97f6a
children 6954ac9b7591
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/HYKFactory.java
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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>();
         }
 

http://dive4elements.wald.intevation.org