annotate gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalProfileChart.java @ 626:61f688a69a55

Split up export modes from output modes. gnv-artifacts/trunk@700 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 23 Feb 2010 11:47:08 +0000
parents d2c68f2f619b
children 24a85678bd39
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;
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
4 import java.util.HashMap;
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import java.util.Iterator;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import java.util.Locale;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 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
9
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import org.jfree.chart.ChartTheme;
315
63f8b3fb7d9a Localization of chart axis with locale which fits best to server and browser settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 310
diff changeset
11 import org.jfree.chart.axis.Axis;
63f8b3fb7d9a Localization of chart axis with locale which fits best to server and browser settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 310
diff changeset
12 import org.jfree.chart.plot.XYPlot;
63f8b3fb7d9a Localization of chart axis with locale which fits best to server and browser settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 310
diff changeset
13 import org.jfree.chart.plot.PlotOrientation;
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 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
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.XYSeriesCollection;
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;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 334
diff changeset
19 import de.intevation.gnv.state.describedata.KeyValueDescibeData;
298
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 /**
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 * @author Ingo Weinzierl <ingo.weinzierl@intevation.de>
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 */
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 public class VerticalProfileChart
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 extends AbstractXYLineChart
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 {
530
d2c68f2f619b Fixed an ArrayIndexOutOfBounds-exceptions which occured if there are less than two data points for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 416
diff changeset
28 public static final String DEFAULT_AXIS = "KPOSITION";
d2c68f2f619b Fixed an ArrayIndexOutOfBounds-exceptions which occured if there are less than two data points for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 416
diff changeset
29
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 private static Logger log = Logger.getLogger(VerticalProfileChart.class);
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31
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: 335
diff changeset
32 protected final double PERCENTAGE = 5.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: 335
diff changeset
33 protected final double GAP_MAX_LEVEL = Math.sqrt(2.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: 335
diff changeset
34 protected final int GAP_MAX_VALUES = 60;
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
35
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 public VerticalProfileChart(
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 ChartLabels labels,
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 ChartTheme theme,
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 Collection parameters,
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 Collection measurements,
310
45625b5cd6d4 Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 301
diff changeset
42 Collection dates,
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 Collection result,
310
45625b5cd6d4 Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 301
diff changeset
44 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: 315
diff changeset
45 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: 315
diff changeset
46 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: 315
diff changeset
47 boolean shapesVisible
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 ) {
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 this.labels = labels;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 this.theme = theme;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 this.parameters = parameters;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 this.measurements = measurements;
310
45625b5cd6d4 Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 301
diff changeset
53 this.dates = dates;
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 this.resultSet = result;
310
45625b5cd6d4 Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 301
diff changeset
55 this.timeGaps = timeGaps;
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 this.locale = locale;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 this.PLOT_ORIENTATION = PlotOrientation.HORIZONTAL;
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: 315
diff changeset
58 this.linesVisible = 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: 315
diff changeset
59 this.shapesVisible = shapesVisible;
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
60 this.datasets = new HashMap();
364
2413273f1c13 Workarround: Store lower and upper bounds of data while iterating over all data and set the max range of axes with these information. JFreeCharts method NumberAxis.setAutoRange(true) doesn't seem to work properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 340
diff changeset
61 this.ranges = new HashMap();
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 }
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 protected void initData() {
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 log.debug("init data for VerticalProfileChart");
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 String breakPoint1 = null;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 String breakPoint2 = null;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 String breakPoint3 = null;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 Iterator iter = resultSet.iterator();
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 Result row = null;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 String seriesName = null;
364
2413273f1c13 Workarround: Store lower and upper bounds of data while iterating over all data and set the max range of axes with these information. JFreeCharts method NumberAxis.setAutoRange(true) doesn't seem to work properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 340
diff changeset
75 String parameter = null;
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 XYSeries series = null;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77
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: 335
diff changeset
78 int idx = 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: 335
diff changeset
79 int startPos = 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: 335
diff changeset
80 int endPos = 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: 335
diff changeset
81 double startValue = 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: 335
diff changeset
82 double endValue = 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: 335
diff changeset
83
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
84 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: 335
diff changeset
85 (Result[]) resultSet.toArray(new Result[resultSet.size()]);
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 while (iter.hasNext()) {
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 row = (Result) iter.next();
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 // add current data to plot and prepare for next one
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 if (!row.getString("GROUP1").equals(breakPoint1) ||
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 !row.getString("GROUP2").equals(breakPoint2) ||
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 !row.getString("GROUP3").equals(breakPoint3)
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 ) {
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 log.debug("prepare data/plot for next dataset");
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 if(series != 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: 335
diff changeset
98 gapDetection(results, series, startPos, endPos);
364
2413273f1c13 Workarround: Store lower and upper bounds of data while iterating over all data and set the max range of axes with these information. JFreeCharts method NumberAxis.setAutoRange(true) doesn't seem to work properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 340
diff changeset
99 addSeries(series, parameter, idx);
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: 335
diff changeset
100
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
101 startPos = endPos +1;
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 }
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104 // prepare variables for next plot
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 breakPoint1 = row.getString("GROUP1");
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 breakPoint2 = row.getString("GROUP2");
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107 breakPoint3 = row.getString("GROUP3");
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 seriesName = createSeriesName(
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 breakPoint1,
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 breakPoint2,
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112 breakPoint3
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113 );
364
2413273f1c13 Workarround: Store lower and upper bounds of data while iterating over all data and set the max range of axes with these information. JFreeCharts method NumberAxis.setAutoRange(true) doesn't seem to work properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 340
diff changeset
114 parameter = findParameter(seriesName);
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 log.debug("next dataset is '" + seriesName + "'");
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 series = new XYSeries(seriesName);
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 }
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 addValue(row, series);
416
04a242c67fe6 Added support of gap detection in horizontalcrossprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 370
diff changeset
121 Double value = row.getDouble("YORDINATE");
04a242c67fe6 Added support of gap detection in horizontalcrossprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 370
diff changeset
122 if (value != null)
04a242c67fe6 Added support of gap detection in horizontalcrossprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 370
diff changeset
123 storeMaxRange(value, parameter);
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: 335
diff changeset
124 endPos++;
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125 }
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126
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: 335
diff changeset
127 if (results.length == 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: 335
diff changeset
128 return;
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
129
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
130 gapDetection(results, series, startPos, endPos);
364
2413273f1c13 Workarround: Store lower and upper bounds of data while iterating over all data and set the max range of axes with these information. JFreeCharts method NumberAxis.setAutoRange(true) doesn't seem to work properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 340
diff changeset
131 addSeries(series, parameter, idx);
310
45625b5cd6d4 Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 301
diff changeset
132
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
133 addDatasets();
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134 }
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136
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: 335
diff changeset
137 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: 335
diff changeset
138 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: 335
diff changeset
139 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: 335
diff changeset
140 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: 335
diff changeset
141 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: 335
diff changeset
142 ) {
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
143 double startValue = results[startPos].getDouble("XORDINATE");
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
144 double endValue = results[endPos-1].getDouble("XORDINATE");
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
145 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: 335
diff changeset
146 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: 335
diff changeset
147 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: 335
diff changeset
148 addGaps(results, series, startValue, endValue, 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: 335
diff changeset
149 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
150
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
151
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152 protected void addValue(Result row, Series series) {
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153 ((XYSeries) series).add(
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
154 row.getDouble("XORDINATE"),
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155 row.getDouble("YORDINATE")
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156 );
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157 }
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159
364
2413273f1c13 Workarround: Store lower and upper bounds of data while iterating over all data and set the max range of axes with these information. JFreeCharts method NumberAxis.setAutoRange(true) doesn't seem to work properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 340
diff changeset
160 protected void addSeries(Series series, String parameter, int idx) {
2413273f1c13 Workarround: Store lower and upper bounds of data while iterating over all data and set the max range of axes with these information. JFreeCharts method NumberAxis.setAutoRange(true) doesn't seem to work properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 340
diff changeset
161 log.debug("add series (" + parameter + ")to chart");
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
162
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163 if (series == null) {
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
164 log.warn("no data to add");
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
165 return;
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
166 }
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
167
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
168 XYSeriesCollection xysc = null;
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
169
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
170 if (datasets.containsKey(parameter))
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
171 xysc = (XYSeriesCollection) datasets.get(parameter);
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
172 else
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
173 xysc = new XYSeriesCollection();
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
174
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
175 xysc.addSeries((XYSeries) series);
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
176 datasets.put(parameter, xysc);
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
177 }
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
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
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
180 protected void addDatasets() {
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
181 Iterator iter = parameters.iterator();
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
182 XYPlot plot = chart.getXYPlot();
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
183 int idx = 0;
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
184
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
185 XYSeriesCollection xysc = null;
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
186 KeyValueDescibeData data = null;
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
187 String key = null;
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
188 while (iter.hasNext()) {
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
189 data = (KeyValueDescibeData) iter.next();
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
190 key = data.getValue();
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
191
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
192 if (datasets.containsKey(key)) {
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
193 xysc = (XYSeriesCollection)datasets.get(key);
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
194 plot.setDataset(idx, xysc );
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
195 log.debug("Added " + key + " parameter to plot.");
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
196 prepareAxis(key, 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
197 adjustRenderer(
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
198 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
199 xysc.getSeriesCount(),
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
200 linesVisible,
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
201 shapesVisible
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
202 );
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
203 }
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
204 }
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
205 }
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
206
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
207
315
63f8b3fb7d9a Localization of chart axis with locale which fits best to server and browser settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 310
diff changeset
208 protected void localizeDomainAxis(Axis axis, Locale locale) {
63f8b3fb7d9a Localization of chart axis with locale which fits best to server and browser settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 310
diff changeset
209 // call localizeRangeAxis from superclass which formats NumberAxis
63f8b3fb7d9a Localization of chart axis with locale which fits best to server and browser settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 310
diff changeset
210 super.localizeRangeAxis(axis, locale);
63f8b3fb7d9a Localization of chart axis with locale which fits best to server and browser settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 310
diff changeset
211 }
63f8b3fb7d9a Localization of chart axis with locale which fits best to server and browser settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 310
diff changeset
212
63f8b3fb7d9a Localization of chart axis with locale which fits best to server and browser settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 310
diff changeset
213
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
214 protected String createSeriesName(
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
215 String breakPoint1,
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
216 String breakPoint2,
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
217 String breakPoint3
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
218 ) {
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
219 log.debug("create seriesname of verticalprofile chart");
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
220 return findValueTitle(parameters, breakPoint1) +
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
221 " " +
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
222 findValueTitle(measurements, breakPoint2) +
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
223 "m";
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
224 }
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: 335
diff changeset
225
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
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: 335
diff changeset
227 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: 335
diff changeset
228 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: 335
diff changeset
229 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: 335
diff changeset
230 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: 335
diff changeset
231 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: 335
diff changeset
232 ) {
530
d2c68f2f619b Fixed an ArrayIndexOutOfBounds-exceptions which occured if there are less than two data points for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 416
diff changeset
233 String axis = null;
d2c68f2f619b Fixed an ArrayIndexOutOfBounds-exceptions which occured if there are less than two data points for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 416
diff changeset
234
d2c68f2f619b Fixed an ArrayIndexOutOfBounds-exceptions which occured if there are less than two data points for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 416
diff changeset
235 if (results.length > (startPos+1)) {
d2c68f2f619b Fixed an ArrayIndexOutOfBounds-exceptions which occured if there are less than two data points for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 416
diff changeset
236 axis = getDependendAxisName(
d2c68f2f619b Fixed an ArrayIndexOutOfBounds-exceptions which occured if there are less than two data points for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 416
diff changeset
237 results[startPos],
d2c68f2f619b Fixed an ArrayIndexOutOfBounds-exceptions which occured if there are less than two data points for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 416
diff changeset
238 results[startPos+1]
d2c68f2f619b Fixed an ArrayIndexOutOfBounds-exceptions which occured if there are less than two data points for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 416
diff changeset
239 );
d2c68f2f619b Fixed an ArrayIndexOutOfBounds-exceptions which occured if there are less than two data points for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 416
diff changeset
240 }
d2c68f2f619b Fixed an ArrayIndexOutOfBounds-exceptions which occured if there are less than two data points for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 416
diff changeset
241 else {
d2c68f2f619b Fixed an ArrayIndexOutOfBounds-exceptions which occured if there are less than two data points for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 416
diff changeset
242 axis = DEFAULT_AXIS;
d2c68f2f619b Fixed an ArrayIndexOutOfBounds-exceptions which occured if there are less than two data points for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 416
diff changeset
243 }
d2c68f2f619b Fixed an ArrayIndexOutOfBounds-exceptions which occured if there are less than two data points for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 416
diff changeset
244
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: 335
diff changeset
245 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: 335
diff changeset
246 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: 335
diff changeset
247 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: 335
diff changeset
248
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
249 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: 335
diff changeset
250 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: 335
diff changeset
251 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: 335
diff changeset
252
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
253 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: 335
diff changeset
254
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
255 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: 335
diff changeset
256 double xOld = results[i-1].getDouble("XORDINATE");
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
257 double xNow = results[i].getDouble("XORDINATE");
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
258 log.debug("Gap detected on grid between "+ xOld +" and "+ xNow);
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
259 ((XYSeries) series).add(xOld+0.0001, 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: 335
diff changeset
260 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
261 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
262 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
263
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
264
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
265 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: 335
diff changeset
266 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: 335
diff changeset
267 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: 335
diff changeset
268 double 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: 335
diff changeset
269 double 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: 335
diff changeset
270 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: 335
diff changeset
271 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: 335
diff changeset
272 ) {
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
273
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
274 double 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: 335
diff changeset
275 double 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: 335
diff changeset
276 int num = 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: 335
diff changeset
277
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
278 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: 335
diff changeset
279 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: 335
diff changeset
280
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
281 last = results[i-1].getDouble("YORDINATE");
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
282 current = results[i].getDouble("YORDINATE");
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
283
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
284 // 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: 335
diff changeset
285 if (num > 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: 335
diff changeset
286 detected = simpleDetection(startValue, endValue, 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: 335
diff changeset
287 // 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: 335
diff changeset
288 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: 335
diff changeset
289 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: 335
diff changeset
290 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: 335
diff changeset
291 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: 335
diff changeset
292 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: 335
diff changeset
293 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: 335
diff changeset
294 num
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
295 );
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
296
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
297 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: 335
diff changeset
298 log.info("Gap between " + last + " and " + 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: 335
diff changeset
299 ((XYSeries) series).add((last+current)/2, 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: 335
diff changeset
300 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
301 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
302 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
303
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
304
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
305 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: 335
diff changeset
306 double 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: 335
diff changeset
307 double 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: 335
diff changeset
308 double 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: 335
diff changeset
309 double 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: 335
diff changeset
310 ) {
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
311 double delta = Math.abs(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: 335
diff changeset
312 double smallDelta = Math.abs(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: 335
diff changeset
313
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
314 return (smallDelta > 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: 335
diff changeset
315 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
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: 335
diff changeset
317
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
318 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: 335
diff changeset
319 double 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: 335
diff changeset
320 double 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: 335
diff changeset
321 double 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: 335
diff changeset
322 double 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: 335
diff changeset
323 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: 335
diff changeset
324 ) {
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
325 double delta = Math.abs(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: 335
diff changeset
326 double smallDelta = Math.abs(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: 335
diff changeset
327
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
328 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: 335
diff changeset
329 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
330
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
331
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
332 protected boolean gridDetection(double last, double 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: 335
diff changeset
333 return (Math.abs(current - last) > GAP_MAX_LEVEL);
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
334 }
07a64cfafdf1 Added gap detection in horizontal and vertical profile charts. Distinguish between meshes and other data sources.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
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: 335
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: 335
diff changeset
337 protected String getDependendAxisName(Result first, Result second) {
370
061355435075 Changed depending value for gap detection in verticalprofile charts on meshes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
338 return "KPOSITION";
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: 335
diff changeset
339 }
298
80f7c5dc09c6 Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
340 }
315
63f8b3fb7d9a Localization of chart axis with locale which fits best to server and browser settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 310
diff changeset
341 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org