# HG changeset patch # User Felix Wolfsteller # Date 1336643071 0 # Node ID b94b367d8b4dc368c3b284c69811b9a3ab14b456 # Parent c0fbff11d287bd258fee3380a70b64c6b84a58f9 Minor refactoring, docs. flys-artifacts/trunk@4379 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r c0fbff11d287 -r b94b367d8b4d flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Thu May 10 09:40:39 2012 +0000 +++ b/flys-artifacts/ChangeLog Thu May 10 09:44:31 2012 +0000 @@ -1,3 +1,8 @@ +2012-05-10 Felix Wolfsteller + + * src/main/java/de/intevation/flys/artifacts/geom/Lines.java: + Minor refactoring, doc. + 2012-05-10 Ingo Weinzierl * doc/conf/mapserver/layer.vm: Added a 'PROJECTION' section. diff -r c0fbff11d287 -r b94b367d8b4d flys-artifacts/src/main/java/de/intevation/flys/artifacts/geom/Lines.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/geom/Lines.java Thu May 10 09:40:39 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/geom/Lines.java Thu May 10 09:44:31 2012 +0000 @@ -24,6 +24,8 @@ public static enum Mode { UNDEF, WET, DRY }; + + /** Never instantiate Lines, use static functions instead. */ protected Lines() { } @@ -47,6 +49,7 @@ /** * Calculate the 'length' of the given lines. + * @param lines lines of which to calculate length. */ public static double length(List lines) { double sum = 0d; @@ -333,6 +336,17 @@ } + /** Return length of a single line. */ + public static double lineLength(Line2D line) { + double xDiff = line.getX1() - line.getX2(); + double yDiff = line.getY1() - line.getY2(); + return Math.sqrt(xDiff*xDiff + yDiff*yDiff); + } + + + /** + * @param points the riverbed. + */ public static LineData createWaterLines( List points, double waterlevel @@ -354,9 +368,7 @@ lys.add(p2.getY()); // Length calculation. - double xDiff = line.getX1() - line.getX2(); - double yDiff = line.getY1() - line.getY2(); - linesLength += Math.sqrt(xDiff*xDiff + yDiff*yDiff); + linesLength += lineLength(line); if (iter.hasNext()) { lxs.add(Double.NaN);