# HG changeset patch # User Tom Gottfried # Date 1449587010 -3600 # Node ID 4289930e276cd1d652885c79081a59f2342a4708 # Parent 9530a00056dd03c6e4f1b5dc65166ccbbbc0476d Issue1854: Adapt to QualityMeasurementFactory and filter with river distance. diff -r 9530a00056dd -r 4289930e276c artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadOverview.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadOverview.java Tue Dec 08 15:56:12 2015 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadOverview.java Tue Dec 08 16:03:30 2015 +0100 @@ -94,12 +94,14 @@ " JOIN gewaesser g " + " ON s.gewaesserid = g.gewaesserid " + "WHERE" + - " g.name = :name AND " + - " m.km IS NOT NULL " + - "ORDER by" + - " m.km, m.datum"; + " g.name = :name" + + " AND m.km IS NOT NULL" + + " AND m.km BETWEEN :from AND :to " + + " AND m.d10 IS NOT NULL" + + "ORDER BY m.km, m.datum"; - protected String riverName; + protected String riverName; + protected String SeddbRiverName; protected KMIndex> entries; @@ -109,7 +111,8 @@ public BedloadOverview(String riverName) { this(); - this.riverName = RiverFactory.getRiver(riverName).nameForSeddb(); + this.riverName = riverName; + this.SeddbRiverName = RiverFactory.getRiver(riverName).nameForSeddb(); } private static final boolean epsilonEquals(double a, double b) { @@ -117,16 +120,21 @@ } protected void loadData(Session session) { + double [] fromTo = RiverFactory.getRiver(riverName) + .determineMinMaxDistance(); + SQLQuery query = session.createSQLQuery(SQL_SQ) .addScalar("km", StandardBasicTypes.DOUBLE) .addScalar("datum", StandardBasicTypes.DATE); - query.setString("name", riverName); + query.setString("name", SeddbRiverName); + query.setDouble("from", fromTo[0]); + query.setDouble("to", fromTo[1]); List list = query.list(); if (list.isEmpty()) { - log.warn("No river '" + riverName + "' found."); + log.warn("No river '" + SeddbRiverName + "' found."); } Double prevKm = -Double.MAX_VALUE; @@ -174,7 +182,7 @@ Element riverElement = document.createElement("river"); - riverElement.setAttribute("name", riverName); + riverElement.setAttribute("name", SeddbRiverName); sqElement.appendChild(riverElement);