annotate gnv-artifacts/src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java @ 767:79401c871da4

Added and repaired javadoc in de.intevation.gnv.chart package. gnv-artifacts/trunk@823 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 24 Mar 2010 14:48:55 +0000
parents b98d1adee7a6
children 9a828e5a2390
rev   line source
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.gnv.chart;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import java.util.Collection;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 import java.util.Locale;
656
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
5 import java.util.Map;
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import com.vividsolutions.jts.geom.Point;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import com.vividsolutions.jts.io.WKTReader;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import com.vividsolutions.jts.io.ParseException;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import org.apache.log4j.Logger;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import org.jfree.chart.ChartTheme;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import org.jfree.chart.plot.PlotOrientation;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import org.jfree.data.general.Series;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import org.jfree.data.xy.XYSeries;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 import de.intevation.gnv.geobackend.base.Result;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 import de.intevation.gnv.utils.DistanceCalculator;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 /**
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
23 * This class is used to create xy-charts of horizontal profiles.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
24 *
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
25 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 */
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 public class HorizontalProfileChart
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 extends VerticalProfileChart
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 {
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
30 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
31 * Logger used for logging with log4j.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
32 */
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 private static Logger log = Logger.getLogger(HorizontalProfileChart.class);
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
35 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
36 * <code>WKTReader</code> used to turn wkt strings into geometries.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
37 */
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 private static WKTReader wktReader = new WKTReader();
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
39
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
40 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
41 * The first point in a HorizontalProfileChart. It is used to calculate the
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
42 * distance between the currently processed point an the start.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
43 */
644
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
44 private Point firstPoint;
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
46 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
47 * Constructor used to create horizontal profile charts.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
48 *
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
49 * @param labels Labels used to be displayed in title, subtitle and so on.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
50 * @param theme ChartTheme used to adjust the rendering of this chart.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
51 * @param parameters Collection containing a bunch of parameters.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
52 * @param measurements Collection containing a bunch of measurements.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
53 * @param dates Collection containing a bunch of date objects.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
54 * @param result Collection containing a bunch of <code>Result</code>
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
55 * objects which contain the actual data items to be displayed.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
56 * @param timeGaps Collection with timegap definitions.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
57 * @param locale Locale used to specify the format of labels, numbers, ...
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
58 * @param linesVisible Render lines between data points if true, otherwise
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
59 * not.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
60 * @param shapesVisible Render vertices as points if true, otherwise not.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
61 */
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 public HorizontalProfileChart(
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 ChartLabels labels,
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 ChartTheme theme,
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 Collection parameters,
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 Collection measurements,
310
45625b5cd6d4 Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
67 Collection dates,
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 Collection result,
310
45625b5cd6d4 Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
69 Collection timeGaps,
327
22a6493e8460 New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 324
diff changeset
70 Locale locale,
22a6493e8460 New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 324
diff changeset
71 boolean linesVisible,
22a6493e8460 New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 324
diff changeset
72 boolean shapesVisible
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 ) {
310
45625b5cd6d4 Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
74 super(
45625b5cd6d4 Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
75 labels,
45625b5cd6d4 Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
76 theme,
45625b5cd6d4 Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
77 parameters,
45625b5cd6d4 Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
78 measurements,
45625b5cd6d4 Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
79 dates,
45625b5cd6d4 Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
80 result,
45625b5cd6d4 Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
81 timeGaps,
327
22a6493e8460 New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 324
diff changeset
82 locale,
22a6493e8460 New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 324
diff changeset
83 linesVisible,
22a6493e8460 New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 324
diff changeset
84 shapesVisible
310
45625b5cd6d4 Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
85 );
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 this.PLOT_ORIENTATION = PlotOrientation.VERTICAL;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 }
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
90 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
91 * @see de.intevation.gnv.chart.VerticalProfileChart#getValue(Result)
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
92 */
656
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
93 @Override
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
94 protected Object getValue(Result row) {
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
95 try {
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
96 return (Point) wktReader.read(row.getString("SHAPE"));
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
97 }
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
98 catch(ParseException pe) {
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
99 log.warn("No data found while parsing.");
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
100 return null;
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
101 }
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
102 }
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
103
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
104
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
105 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
106 * @see de.intevation.gnv.chart.VerticalProfileChart#gapDetection(Result,
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
107 * Series, int, int)
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
108 */
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
109 @Override
340
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
110 protected void gapDetection(
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
111 Result[] results,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
112 Series series,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
113 int startPos,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
114 int endPos
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
115 ) {
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
116 log.debug("Start gap detection.");
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
117 try {
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
118 Point startValue = getPoint(results[startPos]);
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
119 Point endValue = getPoint(results[endPos-1]);
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
120 if (results[0].getInteger("DATAID") == 2)
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
121 addGapsOnGrid(results, series, startPos, endPos);
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
122 else
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
123 addGaps(
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
124 results,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
125 series,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
126 startValue,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
127 endValue,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
128 startPos,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
129 endPos
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
130 );
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
131 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
132 catch (ParseException pe) {
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
133 log.warn(
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
134 "Error while parsing points for gap detection. " +
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
135 "No gaps for current series will be detected."
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
136 );
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
137 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
138
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
139 log.debug("Gap detection finished.");
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
140 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
141
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
142
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
143 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
144 * @see de.intevation.gnv.chart.AbstractXYLineChart(Result, Series)
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
145 */
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
146 @Override
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147 protected void addValue(Result row, Series series) {
644
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
148 double distance = 0;
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
149
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150 try {
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151 Point point = (Point) wktReader.read(row.getString("SHAPE"));
644
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
152 if (firstPoint != null) {
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
153 distance = DistanceCalculator.calculateDistance(
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
154 firstPoint, point
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155 );
644
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
156 }
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
157 else {
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
158 firstPoint = point;
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
159 }
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
160
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
161 ((XYSeries) series).add(
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
162 distance,
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163 row.getDouble("YORDINATE")
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
164 );
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
165 }
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
166 catch(ParseException pe) {
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
167 log.warn("No data found while parsing.");
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
168 }
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
169 }
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
170
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
171
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
172
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
173 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
174 * @see de.intevation.gnv.chart.AbstractXYLineChart#addSeries(Series,
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
175 * String, int)
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
176 */
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
177 @Override
334
e37930705daa Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 327
diff changeset
178 protected void addSeries(Series series, String label, int idx) {
e37930705daa Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 327
diff changeset
179 super.addSeries(series, label, idx);
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
180
644
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
181 // reset firstPoint for next series
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
182 firstPoint = null;
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
183 }
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
184
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
185
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
186 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
187 * @see de.intevation.gnv.chart.VerticalProfileChart#prepareRangeAxis(String,
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
188 * int)
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
189 */
656
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
190 @Override
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
191 protected void prepareRangeAxis(String seriesKey, int idx) {
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
192 return;
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
193 // do nothing here
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
194 }
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
195
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
196
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
197 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
198 * @see de.intevation.gnv.chart.VerticalProfileChart#storeMaxValue(Map,
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
199 * Object, String)
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
200 */
656
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
201 @Override
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
202 protected void storeMaxValue(Map values, Object value, String parameter) {
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
203 return;
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
204 // do nothing here
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
205 }
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
206
b98d1adee7a6 Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 644
diff changeset
207
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
208 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
209 * @see de.intevation.gnv.chart.AbstractXYLineChart#createSeriesName(String,
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
210 * String, String)
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
211 */
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
212 @Override
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
213 protected String createSeriesName(
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
214 String breakPoint1,
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
215 String breakPoint2,
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
216 String breakPoint3
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
217 ) {
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
218 log.debug("create seriesname of horizontalprofile chart");
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
219 return super.createSeriesName(
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
220 breakPoint1,
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
221 breakPoint2,
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
222 breakPoint3) +
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
223 " " +
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
224 findValueTitle(dates, breakPoint3);
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
225 }
340
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
226
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
227
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
228 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
229 * @see de.intevation.gnv.chart.VerticalProfileChart#addGapsOnGrid(Result[],
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
230 * Series, int, int)
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
231 */
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
232 @Override
340
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
233 protected void addGapsOnGrid(
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
234 Result[] results,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
235 Series series,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
236 int startPos,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
237 int endPos
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
238 ) {
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
239 String axis = getDependendAxisName(
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
240 results[startPos],
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
241 results[startPos+1]
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
242 );
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
243
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
244 int last = 0;
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
245 int current = 0;
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
246 Point lastPoint = null;
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
247 Point currentPoint = null;
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
248
644
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
249 try {
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
250 firstPoint = getPoint(results[0]);
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
251 }
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
252 catch (ParseException pe) {
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
253 log.error("Unable to parse start point for gap detection.");
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
254 return;
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
255 }
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
256
340
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
257 for (int i = startPos+1; i < endPos; i++) {
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
258 try {
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
259 last = results[i-1].getInteger(axis);
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
260 lastPoint = getPoint(results[i-1]);
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
261 current = results[i].getInteger(axis);
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
262 currentPoint = getPoint(results[i]);
644
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
263 double distance = DistanceCalculator.calculateDistance(
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
264 firstPoint,
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
265 currentPoint);
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
266 double distanceOld = DistanceCalculator.calculateDistance(
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
267 firstPoint,
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
268 lastPoint);
340
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
269
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
270 boolean detected = gridDetection(last, current);
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
271
643
24a85678bd39 Added some more debug information while gap detection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 370
diff changeset
272 if (log.isDebugEnabled()) {
24a85678bd39 Added some more debug information while gap detection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 370
diff changeset
273 log.debug("Last point: " + lastPoint.toString());
24a85678bd39 Added some more debug information while gap detection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 370
diff changeset
274 log.debug("Current point: " + currentPoint.toString());
644
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
275 log.debug("Current distance from start: " + distance);
643
24a85678bd39 Added some more debug information while gap detection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 370
diff changeset
276 }
24a85678bd39 Added some more debug information while gap detection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 370
diff changeset
277
340
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
278 if (detected) {
643
24a85678bd39 Added some more debug information while gap detection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 370
diff changeset
279 log.info(
644
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
280 "Gap detected on grid between " + distanceOld +
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
281 " and " + distance);
340
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
282
644
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
283 ((XYSeries) series).add(distance-1d, null);
f3882e94c7e0 Changed the way of calculating the total distance in 'Horizontalprofil'-charts (issue171).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 643
diff changeset
284 ((XYSeries) series).add(distanceOld+1d, null);
340
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
285 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
286 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
287 catch (ParseException pe) {
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
288 log.warn("Error while parsing point for gap detection.", pe);
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
289 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
290 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
291 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
292
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
293
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
294 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
295 * Method to add gaps between two data points. The real detection is done by
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
296 * {@link #simpleDetection} and {@link #specialDetection}.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
297 *
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
298 * @param results All data points in this dataset.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
299 * @param series Series to be processed.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
300 * @param startValue <code>Point</code> where the scan for gaps should begin.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
301 * @param endValue <code>Point</code> where the scan should end.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
302 * @param startPos Start position of this series in <code>results</code>.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
303 * @param endPos End position of a series in <code>results</code>
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
304 */
340
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
305 protected void addGaps(
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
306 Result[] results,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
307 Series series,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
308 Point startValue,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
309 Point endValue,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
310 int startPos,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
311 int endPos
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
312 ) {
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
313 double range = 0;
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
314 Point last = null;
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
315 Point now = null;
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
316
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
317 for (int i = startPos+1; i < endPos; i++) {
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
318 boolean detected = false;
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
319
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
320 try {
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
321 last = (Point) getPoint(results[i-1]);
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
322 now = (Point) getPoint(results[i]);
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
323
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
324 // gap detection for more than GAP_MAX_VALUES values
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
325 if (results.length > GAP_MAX_VALUES)
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
326 detected = simpleDetection(startValue, endValue, last, now);
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
327 // gap detection for less than GAP_MAX_VALUES values
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
328 else
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
329 detected = specialDetection(
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
330 startValue,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
331 endValue,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
332 last,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
333 now,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
334 results.length
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
335 );
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
336
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
337 // gap detected, insert null value to break line
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
338 if (detected) {
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
339 log.info("Gap after " + range);
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
340 double x = range + 0.0001;
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
341
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
342 ((XYSeries)series).add(x, null);
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
343 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
344
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
345 range += DistanceCalculator.calculateDistance(last,now);
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
346 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
347 catch (ParseException pe) {
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
348 log.warn("Error while parsing point.");
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
349 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
350
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
351 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
352 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
353
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
354
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
355 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
356 * Simple method to detect gaps. A gap is detected if the delta between two
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
357 * data points (current, last) is bigger than <code>PERCENTAGE</code> percent
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
358 * of delta of start and end.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
359 * <br>
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
360 * (smallDelta &gt; delta / 100 * PERCENTAGE)
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
361 *
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
362 * @param start First data point in a series
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
363 * @param end Last data point in a series
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
364 * @param last Left point
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
365 * @param current Right point
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
366 *
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
367 * @return true, if a gap is detected between last and current - otherwise
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
368 * false.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
369 */
340
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
370 protected boolean simpleDetection(
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
371 Point start,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
372 Point end,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
373 Point last,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
374 Point current
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
375 ) {
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
376 double delta = DistanceCalculator.calculateDistance(start, end);
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
377 double deltaSmall = DistanceCalculator.calculateDistance(last,current);
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
378
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
379 return (deltaSmall > (delta / 100 * PERCENTAGE));
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
380 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
381
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
382
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
383 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
384 * Method to detect gaps between two data points. Following formula is used
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
385 * for detection:<br>
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
386 * smallDelta &gt; (3.0 / (count - 1) * delta)<br>
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
387 * smallDelta = distance between <code>current</code> and <code>last</code>
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
388 * <br>
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
389 * delta = distance between <code>start</code> and <code>end</code>
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
390 *
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
391 * @param start First data point in a series
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
392 * @param end Last data point in a series
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
393 * @param last Left point
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
394 * @param current Right point
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
395 *
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
396 * @return true, if a gap is detected between last and current - otherwise
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
397 * false.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
398 */
340
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
399 protected boolean specialDetection(
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
400 Point start,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
401 Point end,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
402 Point last,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
403 Point current,
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
404 int count
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
405 ) {
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
406 double delta = Math.abs(
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
407 DistanceCalculator.calculateDistance(end, start)
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
408 );
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
409 double smallDelta = Math.abs(
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
410 DistanceCalculator.calculateDistance(current, last)
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
411 );
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
412
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
413 return (smallDelta > (3.0 / (count - 1) * delta));
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
414 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
415
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
416 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
417 * @see de.intevation.gnv.chart.VerticalProfileChart#getDependendAxisName(Result,
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
418 * Result)
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
419 */
370
061355435075 Changed depending value for gap detection in verticalprofile charts on meshes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 340
diff changeset
420 @Override
061355435075 Changed depending value for gap detection in verticalprofile charts on meshes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 340
diff changeset
421 protected String getDependendAxisName(Result first, Result second) {
061355435075 Changed depending value for gap detection in verticalprofile charts on meshes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 340
diff changeset
422 if (first.getInteger("IPOSITION") == second.getInteger("IPOSITION"))
061355435075 Changed depending value for gap detection in verticalprofile charts on meshes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 340
diff changeset
423 return "JPOSITION";
061355435075 Changed depending value for gap detection in verticalprofile charts on meshes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 340
diff changeset
424
061355435075 Changed depending value for gap detection in verticalprofile charts on meshes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 340
diff changeset
425 return "IPOSITION";
061355435075 Changed depending value for gap detection in verticalprofile charts on meshes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 340
diff changeset
426 }
340
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
427
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
428 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
429 * This method returns a point from a given wkt string stored in
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
430 * <code>result</code>.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
431 *
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
432 * @param result <code>Result</code> object which contains the wkt string.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
433 * The wkt string needs to be available under the key SHAPE.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
434 *
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
435 * @return Point representation of wkt string.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 656
diff changeset
436 */
340
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
437 private Point getPoint(Result result)
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
438 throws ParseException
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
439 {
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
440 return (Point) wktReader.read(result.getString("SHAPE"));
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 334
diff changeset
441 }
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
442 }
327
22a6493e8460 New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 324
diff changeset
443 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org