Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/geom/Lines.java @ 2650:a6fa128e4654
Add method to calculate length of water lines.
flys-artifacts/trunk@4311 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 26 Apr 2012 13:38:56 +0000 |
parents | a7def20539fb |
children | 9d2a06c3a134 |
comparison
equal
deleted
inserted
replaced
2649:6f5fc3de0d48 | 2650:a6fa128e4654 |
---|---|
20 public static final double EPSILON = 1e-4; | 20 public static final double EPSILON = 1e-4; |
21 | 21 |
22 public static enum Mode { UNDEF, WET, DRY }; | 22 public static enum Mode { UNDEF, WET, DRY }; |
23 | 23 |
24 protected Lines() { | 24 protected Lines() { |
25 } | |
26 | |
27 public static double length(List<Line2D> lines) { | |
28 double sum = 0d; | |
29 for (Line2D line: lines) { | |
30 double xDiff = line.getX1() - line.getX2(); | |
31 double yDiff = line.getY1() - line.getY2(); | |
32 sum += Math.sqrt(xDiff*xDiff + yDiff*yDiff); | |
33 } | |
34 return sum; | |
25 } | 35 } |
26 | 36 |
27 public static List<Line2D> fillWater(List<Point2D> points, double waterLevel) { | 37 public static List<Line2D> fillWater(List<Point2D> points, double waterLevel) { |
28 | 38 |
29 boolean debug = log.isDebugEnabled(); | 39 boolean debug = log.isDebugEnabled(); |