Mercurial > dive4elements > river
comparison backend/src/main/java/org/dive4elements/river/model/CrossSectionLine.java @ 8813:8abe94270f32
Do not filter cross section points for display.
Filtering coordinates outside an extent probably aimed at omitting
outliers from the diagram. This is obsolete and had the side effect of
filtering the important point at x = 0.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 28 Apr 2017 19:03:56 +0200 |
parents | 9d2e69f971f5 |
children | 0a5239a1e46e |
comparison
equal
deleted
inserted
replaced
8812:8ce2d749f0a7 | 8813:8abe94270f32 |
---|---|
37 { | 37 { |
38 private static Logger log = Logger.getLogger(CrossSectionLine.class); | 38 private static Logger log = Logger.getLogger(CrossSectionLine.class); |
39 | 39 |
40 public static final double EPSILON = 1e-4; | 40 public static final double EPSILON = 1e-4; |
41 | 41 |
42 public static final double TOO_SMALL = 0.2; | |
43 public static final double TOO_BIG = 2500; | |
44 | |
45 private Integer id; | 42 private Integer id; |
46 private Double km; | 43 private Double km; |
47 private CrossSection crossSection; | 44 private CrossSection crossSection; |
48 | 45 |
49 private List<CrossSectionPoint> points; | 46 private List<CrossSectionPoint> points; |
59 if (d > +EPSILON) return +1; | 56 if (d > +EPSILON) return +1; |
60 int diff = a.getColPos() - b.getColPos(); | 57 int diff = a.getColPos() - b.getColPos(); |
61 return diff < 0 ? -1 : diff > 0 ? +1 : 0; | 58 return diff < 0 ? -1 : diff > 0 ? +1 : 0; |
62 } | 59 } |
63 }; | 60 }; |
64 | |
65 | |
66 public static final boolean isValid(double x) { | |
67 x = Math.abs(x); | |
68 return x > TOO_SMALL && x < TOO_BIG; | |
69 } | |
70 | |
71 public static final boolean isValid(Point2D p) { | |
72 return isValid(p.getX()) && isValid(p.getY()); | |
73 } | |
74 | 61 |
75 | 62 |
76 public CrossSectionLine() { | 63 public CrossSectionLine() { |
77 } | 64 } |
78 | 65 |
137 | 124 |
138 List<Point2D> points = new ArrayList<Point2D>(linePoints.size()); | 125 List<Point2D> points = new ArrayList<Point2D>(linePoints.size()); |
139 for (CrossSectionPoint p: linePoints) { | 126 for (CrossSectionPoint p: linePoints) { |
140 double x = p.getX().doubleValue(); | 127 double x = p.getX().doubleValue(); |
141 double y = p.getY().doubleValue(); | 128 double y = p.getY().doubleValue(); |
142 if (isValid(x) && isValid(y)) { | 129 points.add(new Point2D.Double(x, y)); |
143 points.add(new Point2D.Double(x, y)); | |
144 } | |
145 } | 130 } |
146 | 131 |
147 return points; | 132 return points; |
148 } | 133 } |
149 | 134 |