Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/charts/CrossSectionApp.java @ 1122:111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
flys-artifacts/trunk@2631 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 01 Sep 2011 12:15:46 +0000 |
parents | bd3683453928 |
children | a7def20539fb |
comparison
equal
deleted
inserted
replaced
1121:66783d957201 | 1122:111794adf285 |
---|---|
62 import gnu.trove.TDoubleArrayList; | 62 import gnu.trove.TDoubleArrayList; |
63 | 63 |
64 public class CrossSectionApp | 64 public class CrossSectionApp |
65 extends ApplicationFrame | 65 extends ApplicationFrame |
66 { | 66 { |
67 public static final String RIVER = System.getProperty("river", "Mosel"); | 67 public static final String RIVER = System.getProperty("river", "Saar"); |
68 | 68 |
69 public static final double EPSILON = 1e-4; | 69 public static final double EPSILON = 1e-4; |
70 | 70 |
71 public static final double TOO_SMALL = 0.2; | 71 public static final double TOO_SMALL = 0.2; |
72 public static final double TOO_BIG = 500; | 72 public static final double TOO_BIG = 500; |
73 | 73 |
74 public static final Comparator<CrossSectionPoint> COL_POS_CMP = | 74 public static final Comparator<CrossSectionPoint> COL_POS_CMP = |
75 new Comparator<CrossSectionPoint>() { | 75 new Comparator<CrossSectionPoint>() { |
76 @Override | 76 @Override |
77 public int compare(CrossSectionPoint a, CrossSectionPoint b) { | 77 public int compare(CrossSectionPoint a, CrossSectionPoint b) { |
78 // TODO evaluate: isnt it enough to | |
79 // return (|d| > |EPS|) ? d : diff | |
78 double xa = a.getX().doubleValue(); | 80 double xa = a.getX().doubleValue(); |
79 double xb = b.getX().doubleValue(); | 81 double xb = b.getX().doubleValue(); |
80 double d = xa - xb; | 82 double d = xa - xb; |
81 if (d < -EPSILON) return -1; | 83 if (d < -EPSILON) return -1; |
82 if (d > +EPSILON) return +1; | 84 if (d > +EPSILON) return +1; |
310 out.close(); | 312 out.close(); |
311 } | 313 } |
312 } | 314 } |
313 } | 315 } |
314 | 316 |
315 protected XYDataset generateDataset( | 317 public static XYDataset generateDataset( |
316 CrossSectionLine line, | 318 CrossSectionLine line, |
317 Double waterlevel | 319 Double waterlevel |
318 ) { | 320 ) { |
319 DefaultXYDataset dataset = new DefaultXYDataset(); | 321 DefaultXYDataset dataset = new DefaultXYDataset(); |
320 | 322 |
371 dataset.addSeries(legend, new double [][] { xs, ys }); | 373 dataset.addSeries(legend, new double [][] { xs, ys }); |
372 | 374 |
373 return dataset; | 375 return dataset; |
374 } | 376 } |
375 | 377 |
376 protected static double [][] createWaterLines( | 378 public static double [][] createWaterLines( |
377 List<Point2D> points, | 379 List<Point2D> points, |
378 double waterlevel | 380 double waterlevel |
379 ) { | 381 ) { |
380 List<Line2D> lines = Lines.fillWater(points, waterlevel); | 382 List<Line2D> lines = Lines.fillWater(points, waterlevel); |
381 | 383 |