changeset 6270:44ee7d26eb18

issue1267: Polishing: Move the sorting into the db/sql-query.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 11 Jun 2013 12:19:01 +0200
parents 5b1cc816fcdb
children 9b7f1288e6c4
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/FastCrossSectionChunk.java backend/src/main/java/org/dive4elements/river/model/CrossSection.java
diffstat 2 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/FastCrossSectionChunk.java	Tue Jun 11 12:05:01 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/FastCrossSectionChunk.java	Tue Jun 11 12:19:01 2013 +0200
@@ -56,9 +56,6 @@
     /** Finds the FastCrossSectionLine at km (null if not found). */
     public FastCrossSectionLine getCrossSectionLine(double km) {
         FastCrossSectionLine key = new FastCrossSectionLine(km);
-        // TODO follwing is braindead. Create the list in sorted fashion
-        // instead and remove sorting here.
-        Collections.sort(crossSectionLines, FastCrossSectionLine.KM_CMP);
         int pos = Collections.binarySearch(
             crossSectionLines, key, FastCrossSectionLine.KM_CMP);
         return pos < 0 ? null : crossSectionLines.get(pos);
--- a/backend/src/main/java/org/dive4elements/river/model/CrossSection.java	Tue Jun 11 12:05:01 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/model/CrossSection.java	Tue Jun 11 12:19:01 2013 +0200
@@ -51,7 +51,7 @@
         "ON csp.cross_section_line_id = csl.id " +
         "WHERE csl.cross_section_id = :cs_id AND " +
         "km between :from_km AND :to_km " +
-        "ORDER BY csl.id, csp.col_pos";
+        "ORDER BY csl.km, csl.id, csp.col_pos";
 
     private Integer                id;
     private River                  river;

http://dive4elements.wald.intevation.org