annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/geom/Lines.java @ 2687:dc67ddd4a34c

Progressed area calculation while line computation a bit. flys-artifacts/trunk@4388 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 11 May 2012 07:24:12 +0000
parents b94b367d8b4d
children 99350b06a780
rev   line source
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
1 package de.intevation.flys.geom;
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
1651
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 938
diff changeset
3 import java.util.ArrayList;
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4 import java.util.List;
1651
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 938
diff changeset
5 import java.util.Iterator;
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7 import java.awt.geom.Point2D;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8 import java.awt.geom.Line2D;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10 import de.intevation.flys.artifacts.math.Linear;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
12 import org.apache.log4j.Logger;
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
13
1651
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 938
diff changeset
14 import gnu.trove.TDoubleArrayList;
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 938
diff changeset
15
2652
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
16 /**
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
17 * Utility to create lines (intersect water with cross-section etc).
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
18 */
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19 public class Lines
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20 {
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
21 private static Logger log = Logger.getLogger(Lines.class);
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
22
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
23 public static final double EPSILON = 1e-4;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25 public static enum Mode { UNDEF, WET, DRY };
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26
2681
b94b367d8b4d Minor refactoring, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2679
diff changeset
27
b94b367d8b4d Minor refactoring, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2679
diff changeset
28 /** Never instantiate Lines, use static functions instead. */
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
29 protected Lines() {
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 }
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31
2673
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
32
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
33 /**
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
34 * Calculate area of polygon with four vertices.
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
35 * @return area of polygon with four vertices.
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
36 */
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
37 public static double area(Point2D p1, Point2D p2, Point2D p3, Point2D p4) {
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
38 double[] x = new double[] {p1.getX(), p2.getX(), p3.getX(), p4.getX() };
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
39 double[] y = new double[] {p1.getY(), p2.getY(), p3.getY(), p4.getY() };
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
40 double area = 0d;
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
41 int j = 3;
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
42 for (int i=0; i <4; i++) {
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
43 area += (x[j] + x[i]) * (y[j] - y[i]);
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
44 j = i;
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
45 }
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
46 return area * 0.5d;
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
47 }
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
48
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
49
2652
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
50 /**
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
51 * Calculate the 'length' of the given lines.
2681
b94b367d8b4d Minor refactoring, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2679
diff changeset
52 * @param lines lines of which to calculate length.
2652
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
53 */
2650
a6fa128e4654 Add method to calculate length of water lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
54 public static double length(List<Line2D> lines) {
a6fa128e4654 Add method to calculate length of water lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
55 double sum = 0d;
a6fa128e4654 Add method to calculate length of water lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
56 for (Line2D line: lines) {
a6fa128e4654 Add method to calculate length of water lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
57 double xDiff = line.getX1() - line.getX2();
a6fa128e4654 Add method to calculate length of water lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
58 double yDiff = line.getY1() - line.getY2();
a6fa128e4654 Add method to calculate length of water lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
59 sum += Math.sqrt(xDiff*xDiff + yDiff*yDiff);
a6fa128e4654 Add method to calculate length of water lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
60 }
a6fa128e4654 Add method to calculate length of water lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
61 return sum;
a6fa128e4654 Add method to calculate length of water lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
62 }
a6fa128e4654 Add method to calculate length of water lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
63
2674
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
64
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
65 /** List of lines and a double-precision area. */
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
66 private static class ListWithArea {
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
67 public List<Line2D> lines;
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
68 public double area;
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
69 public ListWithArea(List<Line2D> lines, double area) {
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
70 this.lines = lines;
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
71 this.area = area;
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
72 }
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
73 }
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
74
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
75
2679
22c8a9b4de31 Minimal doc, TODO.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
76 /**
22c8a9b4de31 Minimal doc, TODO.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
77 * For a cross section given as points and a waterlevel (in meters),
22c8a9b4de31 Minimal doc, TODO.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
78 * create a set of lines that represent the water surface, assuming it
22c8a9b4de31 Minimal doc, TODO.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
79 * is distributed horizontally equally.
22c8a9b4de31 Minimal doc, TODO.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
80 * @param points the points describing the river bed.
22c8a9b4de31 Minimal doc, TODO.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
81 * @param waterLevel the height of the horizontal water line.
22c8a9b4de31 Minimal doc, TODO.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
82 * @return A list of Lines representing the water surface and the
22c8a9b4de31 Minimal doc, TODO.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
83 * calculated area between water surface and river bed.
22c8a9b4de31 Minimal doc, TODO.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
84 */
2674
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
85 public static ListWithArea fillWater(List<Point2D> points, double waterLevel) {
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
86
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
87 boolean debug = log.isDebugEnabled();
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
88
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
89 if (debug) {
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
90 log.debug("fillWater");
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
91 log.debug("----------------------------");
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
92 }
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
93
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
94 List<Line2D> result = new ArrayList();
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
95
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
96 int N = points.size();
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
97
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
98 if (N == 0) {
2674
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
99 return new ListWithArea(result, 0d);
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
100 }
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
101
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
102 if (N == 1) {
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
103 Point2D p = points.get(0);
2673
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
104 // Only generate point if over profile
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
105 if (waterLevel > p.getY()) {
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
106 result.add(new Line2D.Double(
934
d0f3fea20f01 Fixed corner case.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 933
diff changeset
107 p.getX(), waterLevel,
d0f3fea20f01 Fixed corner case.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 933
diff changeset
108 p.getX(), waterLevel));
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
109 }
2679
22c8a9b4de31 Minimal doc, TODO.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
110 // TODO continue calculating area.
2674
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
111 return new ListWithArea(result, 0d);
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
112 }
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
113
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
114 double minX = Double.MAX_VALUE;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
115 double minY = Double.MAX_VALUE;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
116 double maxX = -Double.MAX_VALUE;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
117 double maxY = -Double.MAX_VALUE;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
118
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
119 // To ensure for sequences of equals x's that
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
120 // the original index order is preserved.
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
121 for (Point2D p: points) {
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
122 double x = p.getX(), y = p.getY();
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
123 if (x < minX) minX = x;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
124 if (x > maxX) maxX = x;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
125 if (y < minY) minY = y;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
126 if (y > maxY) maxY = y;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
127 }
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
128
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
129 if (minY > waterLevel) { // profile completely over water level
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
130 log.debug("complete over water");
2674
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
131 return new ListWithArea(result, 0d);
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
132 }
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
133
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
134 if (waterLevel > maxY) { // water floods profile
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
135 log.debug("complete under water");
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
136 result.add(new Line2D.Double(minX, waterLevel, maxX, waterLevel));
2674
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
137 return new ListWithArea(result, 0d);
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
138 }
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
139
2673
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
140 // Water is sometimes above, sometimes under profile.
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
141 Mode mode = Mode.UNDEF;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
142
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
143 double startX = minX;
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
144
2673
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
145 double area = 0d;
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
146 // Walking along the profile.
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
147 for (int i = 1; i < N; ++i) {
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
148 Point2D p1 = points.get(i-1);
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
149 Point2D p2 = points.get(i);
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
150
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
151 if (p1.getY() < waterLevel && p2.getY() < waterLevel) {
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
152 // completely under water
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
153 if (debug) {
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
154 log.debug("under water: " + p1 + " " + p2);
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
155 }
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
156 if (mode != Mode.WET) {
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
157 startX = p1.getX();
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
158 mode = Mode.WET;
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
159 }
2673
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
160 area += area(p1, p2,
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
161 new Point2D.Double(p2.getX(), waterLevel),
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
162 new Point2D.Double(p1.getX(), waterLevel));
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
163 continue;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
164 }
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
165
2673
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
166 // TODO trigger area calculation
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
167 if (p1.getY() > waterLevel && p2.getY() > waterLevel) {
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
168 if (debug) {
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
169 log.debug("over water: " + p1 + " " + p2);
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
170 }
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
171 // completely over water
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
172 if (mode == Mode.WET) {
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
173 log.debug("over/wet");
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
174 result.add(new Line2D.Double(
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
175 startX, waterLevel,
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
176 p1.getX(), waterLevel));
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
177 }
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
178 mode = Mode.DRY;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
179 continue;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
180 }
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
181
2673
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
182 // TODO trigger area calculation
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
183 if (Math.abs(p1.getX() - p2.getX()) < EPSILON) {
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
184 // vertical line
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
185 switch (mode) {
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
186 case WET:
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
187 log.debug("vertical/wet");
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
188 mode = Mode.DRY;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
189 result.add(new Line2D.Double(
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
190 startX, waterLevel,
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
191 p1.getX(), waterLevel));
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
192 break;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
193 case DRY:
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
194 log.debug("vertical/dry");
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
195 mode = Mode.WET;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
196 startX = p2.getX();
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
197 break;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
198 default: // UNDEF
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
199 log.debug("vertical/undef");
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
200 if (p2.getY() < waterLevel) {
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
201 mode = Mode.WET;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
202 startX = p2.getX();
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
203 }
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
204 else {
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
205 mode = Mode.DRY;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
206 }
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
207 }
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
208 continue;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
209 }
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
210
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
211 // check if waterlevel directly hits the vertices;
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
212
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
213 boolean p1W = Math.abs(waterLevel - p1.getY()) < EPSILON;
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
214 boolean p2W = Math.abs(waterLevel - p2.getY()) < EPSILON;
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
215
2673
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
216 // TODO trigger area calculation
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
217 if (p1W || p2W) {
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
218 if (debug) {
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
219 log.debug("water hits vertex: " + p1 + " " + p2 + " " + mode);
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
220 }
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
221 if (p1W && p2W) { // parallel to water -> dry
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
222 log.debug("water hits both vertices");
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
223 if (mode == Mode.WET) {
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
224 result.add(new Line2D.Double(
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
225 startX, waterLevel,
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
226 p1.getX(), waterLevel));
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
227 }
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
228 mode = Mode.DRY;
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
229 }
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
230 else if (p1W) { // p1 == waterlevel
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
231 log.debug("water hits first vertex");
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
232 if (p2.getY() > waterLevel) { // --> dry
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
233 if (mode == Mode.WET) {
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
234 result.add(new Line2D.Double(
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
235 startX, waterLevel,
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
236 p1.getX(), waterLevel));
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
237 }
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
238 mode = Mode.DRY;
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
239 }
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
240 else { // --> wet
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
241 if (mode != Mode.WET) {
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
242 startX = p1.getX();
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
243 mode = Mode.WET;
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
244 }
2687
dc67ddd4a34c Progressed area calculation while line computation a bit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2681
diff changeset
245 area += area(p1, p2,
dc67ddd4a34c Progressed area calculation while line computation a bit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2681
diff changeset
246 new Point2D.Double(p2.getX(), waterLevel),
dc67ddd4a34c Progressed area calculation while line computation a bit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2681
diff changeset
247 new Point2D.Double(p2.getX(), waterLevel));
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
248 }
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
249 }
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
250 else { // p2 == waterlevel
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
251 log.debug("water hits second vertex");
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
252 if (p1.getY() > waterLevel) { // --> wet
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
253 if (mode != Mode.WET) {
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
254 startX = p2.getX();
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
255 mode = Mode.WET;
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
256 }
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
257 }
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
258 else { // --> dry
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
259 if (mode == Mode.WET) {
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
260 result.add(new Line2D.Double(
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
261 startX, waterLevel,
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
262 p2.getX(), waterLevel));
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
263 }
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
264 mode = Mode.DRY;
2687
dc67ddd4a34c Progressed area calculation while line computation a bit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2681
diff changeset
265 area += area(p1, p2,
dc67ddd4a34c Progressed area calculation while line computation a bit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2681
diff changeset
266 new Point2D.Double(p1.getX(), waterLevel),
dc67ddd4a34c Progressed area calculation while line computation a bit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2681
diff changeset
267 new Point2D.Double(p1.getX(), waterLevel));
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
268 }
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
269 }
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
270 if (debug) {
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
271 log.debug("mode is now: " + mode);
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
272 }
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
273 continue;
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
274 }
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
275
2673
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
276 // TODO trigger area calculation
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
277 // intersection case
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
278 double x = Linear.linear(
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
279 waterLevel,
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
280 p1.getY(), p2.getY(),
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
281 p1.getX(), p2.getX());
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
282
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
283 if (debug) {
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
284 log.debug("intersection p1:" + p1);
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
285 log.debug("intersection p2:" + p2);
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
286 log.debug("intersection at x: " + x);
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
287 }
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
288
2687
dc67ddd4a34c Progressed area calculation while line computation a bit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2681
diff changeset
289 // Add area of that part of intersection that is 'wet'.
dc67ddd4a34c Progressed area calculation while line computation a bit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2681
diff changeset
290 if (p1.getY() > waterLevel) {
dc67ddd4a34c Progressed area calculation while line computation a bit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2681
diff changeset
291 area += area(new Point2D.Double(x, waterLevel),
dc67ddd4a34c Progressed area calculation while line computation a bit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2681
diff changeset
292 p2,
dc67ddd4a34c Progressed area calculation while line computation a bit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2681
diff changeset
293 new Point2D.Double(p2.getX(), waterLevel),
dc67ddd4a34c Progressed area calculation while line computation a bit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2681
diff changeset
294 new Point2D.Double(x, waterLevel));
dc67ddd4a34c Progressed area calculation while line computation a bit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2681
diff changeset
295 }
dc67ddd4a34c Progressed area calculation while line computation a bit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2681
diff changeset
296 else {
dc67ddd4a34c Progressed area calculation while line computation a bit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2681
diff changeset
297 area += area(new Point2D.Double(x, waterLevel),
dc67ddd4a34c Progressed area calculation while line computation a bit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2681
diff changeset
298 p1,
dc67ddd4a34c Progressed area calculation while line computation a bit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2681
diff changeset
299 new Point2D.Double(p1.getX(), waterLevel),
dc67ddd4a34c Progressed area calculation while line computation a bit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2681
diff changeset
300 new Point2D.Double(x, waterLevel));
dc67ddd4a34c Progressed area calculation while line computation a bit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2681
diff changeset
301 }
dc67ddd4a34c Progressed area calculation while line computation a bit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2681
diff changeset
302
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
303 switch (mode) {
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
304 case WET:
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
305 log.debug("intersect/wet");
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
306 mode = Mode.DRY;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
307 result.add(new Line2D.Double(
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
308 startX, waterLevel,
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
309 x, waterLevel));
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
310 break;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
311
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
312 case DRY:
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
313 log.debug("intersect/dry");
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
314 mode = Mode.WET;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
315 startX = x;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
316 break;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
317
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
318 default: // UNDEF
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
319 log.debug("intersect/undef");
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
320 if (p2.getY() > waterLevel) {
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 934
diff changeset
321 log.debug("intersect/undef/over");
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
322 mode = Mode.DRY;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
323 result.add(new Line2D.Double(
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
324 p1.getX(), waterLevel,
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
325 x, waterLevel));
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
326 }
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
327 else {
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
328 mode = Mode.WET;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
329 startX = x;
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
330 }
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
331 } // switch mode
934
d0f3fea20f01 Fixed corner case.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 933
diff changeset
332 } // for all points p[i] and p[i-1]
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
333
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
334 if (mode == Mode.WET) {
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
335 result.add(new Line2D.Double(
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
336 startX, waterLevel,
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
337 maxX, waterLevel));
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
338 }
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
339
2674
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
340 return new ListWithArea(result, area);
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
341 }
1651
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 938
diff changeset
342
2652
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
343
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
344 /**
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
345 * Class holding points that form lines and the calculated length.
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
346 */
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
347 public static class LineData {
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
348 public double [][] points;
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
349 public double width;
2673
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
350 public double area;
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
351 public LineData(double[][] points, double width, double area) {
2652
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
352 this.points = points;
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
353 this.width = width;
2673
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
354 this.area = area;
2652
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
355 }
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
356 }
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
357
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
358
2681
b94b367d8b4d Minor refactoring, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2679
diff changeset
359 /** Return length of a single line. */
b94b367d8b4d Minor refactoring, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2679
diff changeset
360 public static double lineLength(Line2D line) {
b94b367d8b4d Minor refactoring, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2679
diff changeset
361 double xDiff = line.getX1() - line.getX2();
b94b367d8b4d Minor refactoring, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2679
diff changeset
362 double yDiff = line.getY1() - line.getY2();
b94b367d8b4d Minor refactoring, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2679
diff changeset
363 return Math.sqrt(xDiff*xDiff + yDiff*yDiff);
b94b367d8b4d Minor refactoring, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2679
diff changeset
364 }
b94b367d8b4d Minor refactoring, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2679
diff changeset
365
b94b367d8b4d Minor refactoring, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2679
diff changeset
366
b94b367d8b4d Minor refactoring, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2679
diff changeset
367 /**
b94b367d8b4d Minor refactoring, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2679
diff changeset
368 * @param points the riverbed.
b94b367d8b4d Minor refactoring, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2679
diff changeset
369 */
2652
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
370 public static LineData createWaterLines(
1651
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 938
diff changeset
371 List<Point2D> points,
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 938
diff changeset
372 double waterlevel
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 938
diff changeset
373 ) {
2674
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
374 ListWithArea listAndArea = fillWater(points, waterlevel);
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
375 List<Line2D> lines = listAndArea.lines;
1651
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 938
diff changeset
376
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 938
diff changeset
377 TDoubleArrayList lxs = new TDoubleArrayList();
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 938
diff changeset
378 TDoubleArrayList lys = new TDoubleArrayList();
2652
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
379 double linesLength = 0.0f;
1651
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 938
diff changeset
380
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 938
diff changeset
381 for (Iterator<Line2D> iter = lines.iterator(); iter.hasNext();) {
2652
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
382 Line2D line = iter.next();
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
383 Point2D p1 = line.getP1();
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
384 Point2D p2 = line.getP2();
1651
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 938
diff changeset
385 lxs.add(p1.getX());
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 938
diff changeset
386 lys.add(p1.getY());
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 938
diff changeset
387 lxs.add(p2.getX());
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 938
diff changeset
388 lys.add(p2.getY());
2652
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
389
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
390 // Length calculation.
2681
b94b367d8b4d Minor refactoring, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2679
diff changeset
391 linesLength += lineLength(line);
2652
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
392
1651
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 938
diff changeset
393 if (iter.hasNext()) {
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 938
diff changeset
394 lxs.add(Double.NaN);
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 938
diff changeset
395 lys.add(Double.NaN);
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 938
diff changeset
396 }
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 938
diff changeset
397 }
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 938
diff changeset
398
2652
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
399 return new LineData(
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
400 new double [][] { lxs.toNativeArray(), lys.toNativeArray() },
2674
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
401 linesLength, listAndArea.area
2652
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2650
diff changeset
402 );
1651
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 938
diff changeset
403 }
933
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
404 }
34136924661b Generate water level lines for given cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
405 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org