Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/chart/ChartFactory.java @ 356:3eee1369c79b
Added the Unit of the Parameter to the Query for Parameters in
all Parameterqueries where it was still missing. Now the Unit will
be displaied in the Combobox and in the Diagramm-Axis-Description
gnv-artifacts/trunk@429 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Tue, 15 Dec 2009 14:55:42 +0000 |
parents | e964a3d8f7bc |
children |
rev | line source |
---|---|
65
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
1 /** |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
2 * Title: ChartFactory, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/chart/ChartFactory.java,v 1.8 2007/12/21 12:31:15 blume Exp $ |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
3 * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/chart/ChartFactory.java,v $ |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
4 * created by: Stefan Blume (blume) |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
5 * erstellt am: 06.12.2007 |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
6 * Copyright: con terra GmbH, 2005 |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
7 * |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
8 * modified by: $Author: blume $ |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
9 * modified on: $Date: 2007/12/21 12:31:15 $ |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
10 * Version: $Revision: 1.8 $ |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
11 * TAG: $Name: $ |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
12 * locked from: $Locker: $ |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
13 * CVS State: $State: Exp $ |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
14 * Project: $ProjectName$ |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
15 */ |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
16 package de.intevation.gnv.chart; |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
17 |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
18 import java.awt.Color; |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
19 import java.awt.Font; |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
20 import java.awt.Transparency; |
65
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
21 import java.awt.image.BufferedImage; |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
22 import java.io.IOException; |
67
0e9762ebd18d
Refactor ChartFactory so that it is able to be compiled without errors.
Tim Englich <tim.englich@intevation.de>
parents:
65
diff
changeset
|
23 import java.io.OutputStream; |
0e9762ebd18d
Refactor ChartFactory so that it is able to be compiled without errors.
Tim Englich <tim.englich@intevation.de>
parents:
65
diff
changeset
|
24 import java.util.Collection; |
65
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
25 import java.util.Date; |
67
0e9762ebd18d
Refactor ChartFactory so that it is able to be compiled without errors.
Tim Englich <tim.englich@intevation.de>
parents:
65
diff
changeset
|
26 import java.util.Iterator; |
65
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
27 |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
28 import org.apache.log4j.Logger; |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
29 import org.jfree.chart.JFreeChart; |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
30 import org.jfree.chart.axis.AxisLocation; |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
31 import org.jfree.chart.axis.DateAxis; |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
32 import org.jfree.chart.axis.NumberAxis; |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
33 import org.jfree.chart.axis.NumberTickUnit; |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
34 import org.jfree.chart.encoders.KeypointPNGEncoderAdapter; |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
35 import org.jfree.chart.plot.PlotOrientation; |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
36 import org.jfree.chart.plot.XYPlot; |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
37 import org.jfree.chart.renderer.xy.StandardXYItemRenderer; |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
38 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
39 import org.jfree.data.time.Minute; |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
40 import org.jfree.data.time.TimeSeries; |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
41 import org.jfree.data.time.TimeSeriesCollection; |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
42 import org.jfree.data.xy.XYDataset; |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
43 import org.jfree.ui.RectangleInsets; |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
44 |
67
0e9762ebd18d
Refactor ChartFactory so that it is able to be compiled without errors.
Tim Englich <tim.englich@intevation.de>
parents:
65
diff
changeset
|
45 import de.intevation.gnv.chart.exception.TechnicalChartException; |
0e9762ebd18d
Refactor ChartFactory so that it is able to be compiled without errors.
Tim Englich <tim.englich@intevation.de>
parents:
65
diff
changeset
|
46 import de.intevation.gnv.geobackend.base.Result; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
225
diff
changeset
|
47 import de.intevation.gnv.state.describedata.KeyValueDescibeData; |
217
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
48 import de.intevation.gnv.timeseries.gap.TimeGap; |
65
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
49 |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
50 /** |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
51 * The class <code>ChartFactory</code> fulfills the following purposes: |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
52 * <ol> |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
53 * <li></li> |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
54 * </ol> |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
55 * |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
56 * @author blume |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
57 * @version 1.0 |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
58 * @serial 1.0 |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
59 * @see |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
60 * @since 06.12.2007 17:25:59 |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
61 */ |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
62 public class ChartFactory { |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
63 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
64 /** |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
65 * Default Logging instance |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
66 */ |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
67 private static Logger sLogger = Logger.getLogger(ChartFactory.class); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
68 private static boolean sDebug = sLogger.isDebugEnabled(); |
225
219e9666f590
Bugfix Gap-Calculation moved maxGap into negative Valies because of overflow of Long-Variable.
Tim Englich <tim.englich@intevation.de>
parents:
221
diff
changeset
|
69 |
219e9666f590
Bugfix Gap-Calculation moved maxGap into negative Valies because of overflow of Long-Variable.
Tim Englich <tim.englich@intevation.de>
parents:
221
diff
changeset
|
70 private final static long NOTIMEGAP = Long.MAX_VALUE - 1000; |
219e9666f590
Bugfix Gap-Calculation moved maxGap into negative Valies because of overflow of Long-Variable.
Tim Englich <tim.englich@intevation.de>
parents:
221
diff
changeset
|
71 // Minus 1000 damit es bei Additionen keinen �berlauf gibt |
65
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
72 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
73 public synchronized void createSimpleTimeSeriesChart( |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
74 ChartLabels pLabels, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
75 ChartStyle pStyle, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
76 Collection<KeyValueDescibeData> parameters, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
77 Collection<KeyValueDescibeData> measurements, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
78 OutputStream outputStream, |
217
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
79 Collection<Result> resultSet, |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
80 Collection<TimeGap> timeGaps) |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
81 throws IOException, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
82 TechnicalChartException { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
83 if (sDebug) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
84 sLogger.debug("createSimpleTimeSeriesChart()"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
85 int lLowerLevel = Integer.MIN_VALUE; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
86 int lUpperLevel = Integer.MAX_VALUE; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
87 if (pStyle.isUseUpperDataLevel() |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
88 && pStyle.getUpperLevel() < Integer.MAX_VALUE) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
89 lUpperLevel = pStyle.getUpperLevel(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
90 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
91 if (pStyle.isUseLowerDataLevel() |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
92 && pStyle.getLowerLevel() > Integer.MIN_VALUE) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
93 lLowerLevel = pStyle.getLowerLevel(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
94 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
95 if (sDebug) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
96 sLogger.debug(" vor createDataset()"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
97 XYDataset lSet = this.createDataset(resultSet, lUpperLevel, |
217
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
98 lLowerLevel, parameters, measurements,timeGaps); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
99 if (sDebug) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
100 sLogger.debug(" nach createDataset()"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
101 final Color[] color = { Color.black, Color.red, Color.green, Color.blue }; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
102 DateAxis domain = new DateAxis(pLabels.getDomainAxisLabel()); |
65
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
103 NumberAxis axis; |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
104 StandardXYItemRenderer renderer = new StandardXYItemRenderer(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
105 XYPlot plot = new XYPlot(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
106 // Global settings |
65
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
107 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
108 plot.setOrientation(PlotOrientation.VERTICAL); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
109 plot.setBackgroundPaint(Color.lightGray); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
110 plot.setDomainGridlinePaint(Color.white); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
111 plot.setRangeGridlinePaint(Color.white); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
112 plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
113 // plot.getRangeAxis().setFixedDimension(10.0); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
114 plot.setDomainAxis(domain); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
115 plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_LEFT); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
116 if (parameters.size() == 1) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
117 KeyValueDescibeData parameter = parameters.iterator().next(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
118 axis = new NumberAxis(parameter.getValue()); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
119 if (parameter.getValue().contains("richtung")) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
120 NumberAxis axis1 = new NumberAxis((parameter |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
121 .getValue()));// ,new Range(0.0,360.0)); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
122 axis1.setTickUnit(new NumberTickUnit(30.0)); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
123 axis1.setUpperBound(360.0); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
124 axis1.setLowerBound(0.0); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
125 // axis1.setDisplayRange(0.0,360.0); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
126 plot.setRangeAxis(axis1); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
127 } else { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
128 axis.setFixedDimension(10.0); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
129 axis.setAutoRangeIncludesZero(false); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
130 plot.setRangeAxis(axis); |
65
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
131 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
132 axis.configure(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
133 plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
134 plot.setRenderer(renderer); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
135 plot.setDataset(lSet); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
136 } else { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
137 // Individual settings for different parameters |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
138 for (int i = 0; i < lSet.getSeriesCount(); i++) { |
65
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
139 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
140 plot.setDataset(i, getDataset((TimeSeriesCollection) lSet, i)); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
141 Color mColor = color[i % color.length]; // zyklische Farbvergabe |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
142 mColor = color[0]; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
143 // if ( pParameterId.length==1){ |
65
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
144 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
145 if (((String) lSet.getSeriesKey(i)).contains("richtung")) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
146 NumberAxis axis1 = new NumberAxis(((String) lSet |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
147 .getSeriesKey(i)));// ,new Range(0.0,360.0)); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
148 axis1.setTickUnit(new NumberTickUnit(30.0)); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
149 // axis1.setDisplayRange(0.0,360.0); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
150 axis1.setLabelPaint(mColor); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
151 axis1.setTickLabelPaint(mColor); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
152 axis1.setUpperBound(360.0); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
153 axis1.setLowerBound(0.0); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
154 plot.setRangeAxis(i, axis1); |
65
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
155 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
156 } else { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
157 axis = new NumberAxis((String) lSet.getSeriesKey(i)); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
158 axis.setFixedDimension(10.0); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
159 axis.setAutoRangeIncludesZero(false); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
160 axis.setLabelPaint(mColor); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
161 axis.setTickLabelPaint(mColor); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
162 plot.setRangeAxis(i, axis); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
163 axis.configure(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
164 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
165 if (i % 2 != 0) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
166 plot.setRangeAxisLocation(i, AxisLocation.BOTTOM_OR_RIGHT); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
167 else |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
168 plot.setRangeAxisLocation(i, AxisLocation.BOTTOM_OR_LEFT); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
169 plot.mapDatasetToRangeAxis(i, i); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
170 // } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
171 renderer = new StandardXYItemRenderer(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
172 renderer.setSeriesPaint(i, mColor); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
173 // renderer.setSeriesStroke(i,stroke[j]); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
174 plot.setRenderer(i, renderer); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
175 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
176 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
177 JFreeChart chart = new JFreeChart(pLabels.getTitle(), new Font( |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
178 "SansSerif", Font.BOLD, 24), plot, true); |
65
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
179 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
180 setStyle(chart, pStyle); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
181 configureRenderingOptions(chart); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
182 if (sDebug) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
183 sLogger.debug(" vor encodeChart()"); |
65
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
184 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
185 encodeChart(chart, pStyle, outputStream); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
186 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
187 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
188 private static XYDataset getDataset(TimeSeriesCollection T, int pIndex) { // throws |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
189 // TechnicalChartException{ |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
190 // if (T.getSeriesCount() < pIndex) throw TechnicalChartException(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
191 TimeSeriesCollection TSC = new TimeSeriesCollection(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
192 TSC.addSeries(T.getSeries(pIndex)); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
193 return TSC; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
194 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
195 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
196 private void configureRenderingOptions(JFreeChart pJfreechart) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
197 org.jfree.chart.renderer.xy.XYItemRenderer xyitemrenderer = ((XYPlot) pJfreechart |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
198 .getPlot()).getRenderer(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
199 if (xyitemrenderer instanceof XYLineAndShapeRenderer) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
200 XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyitemrenderer; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
201 xylineandshaperenderer.setBaseShapesVisible(true); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
202 xylineandshaperenderer.setBaseShapesFilled(true); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
203 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
204 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
205 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
206 private void setStyle(JFreeChart pJfreechart, ChartStyle pStyle) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
207 if (sDebug) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
208 sLogger.debug("setStyle()"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
209 pJfreechart.setBackgroundPaint(pStyle.getCanvasColor()); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
210 XYPlot xyplot = (XYPlot) pJfreechart.getPlot(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
211 xyplot.setBackgroundPaint(pStyle.getPlotBackgroundColor()); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
212 xyplot.setDomainGridlinePaint(pStyle.getDomainGridlineColor()); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
213 xyplot.setRangeGridlinePaint(pStyle.getRangeGridlineColor()); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
214 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
215 Insets lOffsets = pStyle.getAxisOffset(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
216 RectangleInsets lRectangleInsets = new RectangleInsets(lOffsets.mUpper, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
217 lOffsets.mLeft, lOffsets.mLower, lOffsets.mRight); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
218 xyplot.setAxisOffset(lRectangleInsets); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
219 xyplot.setDomainCrosshairVisible(pStyle.isDomainCrosshairVisible()); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
220 xyplot.setRangeCrosshairVisible(pStyle.isRangeCrosshairVisible()); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
221 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
222 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
223 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
224 private TimeSeries createTimeSeries(String pTimeSeriesName, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
225 Collection<Result> resultSet, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
226 int lUpperCut, int lLowerCut, |
217
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
227 int pStart, int pEnd, long maxGap) |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
228 throws TechnicalChartException { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
229 if (sDebug) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
230 sLogger.debug("createTimeSeries()"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
231 Result lRow0, lRow1; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
232 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
233 Date lDate = null, lDate0 = null; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
234 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
235 TimeSeries lTimeseries = new TimeSeries(pTimeSeriesName, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
236 org.jfree.data.time.Minute.class); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
237 try { |
217
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
238 long lDateDiff = 0; |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
239 double lValue = 0; |
217
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
240 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
241 int i = 0; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
242 Iterator<Result> resultIterator = resultSet.iterator(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
243 while (resultIterator.hasNext()) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
244 Result lRow = resultIterator.next(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
245 if (i >= pStart + 1 && i <= pEnd) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
246 if (i == pStart + 1) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
247 lRow0 = lRow;// |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
248 lDate = lRow0.getDate("XORDINATE"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
249 lDate0 = lDate; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
250 lValue = lRow0.getDouble("YORDINATE"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
251 if (lValue > lLowerCut && lValue < lUpperCut) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
252 // lTimeseries.addOrUpdate(new Minute(lDate), |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
253 // lValue); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
254 lTimeseries.add(new Minute(lDate), lValue); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
255 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
256 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
257 // for (int i = pStart+1; i <= pEnd; i++) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
258 lRow1 = lRow; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
259 lDate = lRow1.getDate("XORDINATE"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
260 lValue = lRow1.getDouble("YORDINATE"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
261 lDateDiff = lDate.getTime() - lDate0.getTime(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
262 if (lDateDiff > maxGap) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
263 // add 1 minute in millisecs to left hand side Date |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
264 // and insert Dummy to break line |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
265 lDate0.setTime((lDate0.getTime() + 60000)); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
266 lTimeseries.addOrUpdate(new Minute(lDate0), null); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
267 lTimeseries.addOrUpdate(new Minute(lDate), lValue); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
268 // lTimeseries.add(new Minute(lDate0), null); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
269 } else if (lDateDiff == 0) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
270 if (sDebug) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
271 sLogger.debug("Datediff: " + lDateDiff |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
272 + " bei index : " + i + " Datum : " |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
273 + lDate + " " + lDate0); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
274 } else if (lValue > lLowerCut && lValue < lUpperCut) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
275 lTimeseries.addOrUpdate(new Minute(lDate), lValue); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
276 // lTimeseries.add(new Minute(lDate), lValue); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
277 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
278 lRow0 = lRow1; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
279 lDate0 = lDate; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
280 } else if (i > pEnd) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
281 return lTimeseries; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
282 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
283 i++; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
284 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
285 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
286 } catch (OutOfMemoryError e) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
287 sLogger.error(e.getMessage(), e); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
288 return lTimeseries; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
289 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
290 } catch (Exception e) { // TechnicalChartException |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
291 sLogger.error(e.getMessage(), e); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
292 } finally { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
293 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
294 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
295 return lTimeseries; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
296 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
297 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
298 private XYDataset createDataset(Collection<Result> resultSet, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
299 int lUpperCut, int lLowerCut, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
300 Collection<KeyValueDescibeData> parameters, |
217
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
301 Collection<KeyValueDescibeData> measurements, |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
302 Collection<TimeGap> timeGaps) |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
303 throws TechnicalChartException { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
304 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
305 TimeSeriesCollection lTimeSeriesCollection = new TimeSeriesCollection(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
306 try { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
307 Date dStart = null, dEnd = null; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
308 String break1, break2, break3; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
309 int mStart = 0; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
310 int mEnd = 0; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
311 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
312 Iterator<Result> resultIterator = resultSet.iterator(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
313 if (resultIterator.hasNext()) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
314 Result row = resultIterator.next(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
315 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
316 break1 = row.getString("GROUP1"); // 2 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
317 break2 = row.getString("GROUP2"); // 3 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
318 break3 = row.getString("GROUP3"); // 4 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
319 dStart = row.getDate("XORDINATE"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
320 int i = 1; |
217
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
321 Integer gapID = -1; |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
322 while (resultIterator.hasNext()) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
323 row = resultIterator.next(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
324 if (!break1.equals(row.getString("GROUP1")) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
325 || !break2.equals(row.getString("GROUP2")) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
326 || !break3.equals(row.getString("GROUP3"))) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
327 String mTimeSeriesName = findValueTitle(parameters, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
328 break1) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
329 + " " |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
330 + findValueTitle(measurements, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
331 break2) + "m"; |
217
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
332 long maxGap = this.calculateMaxGap(dStart, dEnd,mStart, |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
333 mEnd, gapID.intValue(), |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
334 timeGaps); |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
335 |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
336 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
337 lTimeSeriesCollection.addSeries(createTimeSeries( |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
338 mTimeSeriesName, resultSet, lUpperCut, |
217
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
339 lLowerCut, mStart, mEnd,maxGap)); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
340 mStart = i; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
341 dStart = row.getDate("XORDINATE"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
342 break1 = row.getString("GROUP1"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
343 break2 = row.getString("GROUP2"); // 3 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
344 break3 = row.getString("GROUP3"); // 4 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
345 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
346 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
347 mEnd = i; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
348 dEnd = row.getDate("XORDINATE"); |
217
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
349 gapID = row.getInteger("GAPID"); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
350 i = i + 1; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
351 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
352 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
353 String mTimeSeriesName = findValueTitle(parameters, break1) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
354 + " " |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
355 + findValueTitle(measurements, break2) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
356 + "m"; |
217
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
357 long maxGap = this.calculateMaxGap(dStart, dEnd,mStart, |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
358 mEnd,gapID.intValue(), |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
359 timeGaps); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
360 lTimeSeriesCollection.addSeries(createTimeSeries( |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
361 mTimeSeriesName, resultSet, lUpperCut, lLowerCut, |
217
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
362 mStart, mEnd, maxGap)); |
193
34f233123a6f
Adding empty Series into Chart to prevent NPE issue 19
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
363 }else{ |
217
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
364 // Es sind keine Daten vorhanden: Es wird eine Zeitserie eingef�gt. |
193
34f233123a6f
Adding empty Series into Chart to prevent NPE issue 19
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
365 lTimeSeriesCollection.addSeries(createTimeSeries( |
34f233123a6f
Adding empty Series into Chart to prevent NPE issue 19
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
366 "", resultSet, lUpperCut, lLowerCut, |
217
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
367 mStart, mEnd, 999999)); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
368 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
369 } catch (Exception e) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
370 sLogger.error(e.getMessage(), e); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
371 } finally { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
372 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
373 return lTimeSeriesCollection; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
374 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
375 |
217
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
376 /** |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
377 * @param dStart |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
378 * @param dEnd |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
379 */ |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
380 private long calculateMaxGap(Date dStart, Date dEnd, int pStart , |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
381 int pEnd, int gapID, |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
382 Collection<TimeGap> timeGaps) { |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
383 |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
384 // umgesetzt nach issue 45 |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
385 // Handle Gaps > 0.5% timeserieslength, |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
386 // i.e do not draw here |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
387 long maxGap = (dEnd.getTime() - dStart.getTime()) / 200; |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
388 // 0,5 prozent der L�nge |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
389 long timeInterval = this.getTimeGapValue(dStart, dEnd, pStart, |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
390 pEnd, gapID, timeGaps); |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
391 |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
392 if (maxGap < timeInterval){ |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
393 maxGap = timeInterval + 10; |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
394 } |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
395 // if (maxGap < (dEnd.getTime() - dStart.getTime()) |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
396 // / (pEnd - pStart)) |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
397 // maxGap = (dEnd.getTime() - dStart.getTime()) |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
398 // / (pEnd - pStart) + 1000; |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
399 |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
400 return maxGap; |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
401 } |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
402 |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
403 private long getTimeGapValue(Date dStart, Date dEnd, |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
404 int pStart ,int pEnd, |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
405 int gapID, Collection<TimeGap> timeGaps){ |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
406 long gap = 0; |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
407 |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
408 if (gapID < 0 || gapID >= 99){ |
221
21152e1bf325
Implemented the special case for TimeGaps in Meshes issue45
Tim Englich <tim.englich@intevation.de>
parents:
217
diff
changeset
|
409 |
21152e1bf325
Implemented the special case for TimeGaps in Meshes issue45
Tim Englich <tim.englich@intevation.de>
parents:
217
diff
changeset
|
410 if (gapID == -1){ // Mesh |
225
219e9666f590
Bugfix Gap-Calculation moved maxGap into negative Valies because of overflow of Long-Variable.
Tim Englich <tim.englich@intevation.de>
parents:
221
diff
changeset
|
411 gap = NOTIMEGAP; // Es gibt keine L�cken in Netzen. |
221
21152e1bf325
Implemented the special case for TimeGaps in Meshes issue45
Tim Englich <tim.englich@intevation.de>
parents:
217
diff
changeset
|
412 }else if (pEnd-pStart < 60){ |
21152e1bf325
Implemented the special case for TimeGaps in Meshes issue45
Tim Englich <tim.englich@intevation.de>
parents:
217
diff
changeset
|
413 gap = (3/(pEnd-pStart)) * (dEnd.getTime() - dStart.getTime()); |
21152e1bf325
Implemented the special case for TimeGaps in Meshes issue45
Tim Englich <tim.englich@intevation.de>
parents:
217
diff
changeset
|
414 } |
217
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
415 }else{ |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
416 |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
417 Iterator<TimeGap> it = timeGaps.iterator(); |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
418 |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
419 while (it.hasNext()){ |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
420 TimeGap tempTimeGap = it.next(); |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
421 if (tempTimeGap.getKey() == gapID){ |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
422 int gapValue = tempTimeGap.getValue(); |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
423 String unit = tempTimeGap.getUnit(); |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
424 |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
425 if (unit.equals(TimeGap.TIME_UNIT_MINUTE)){ |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
426 gap = gapValue * TimeGap.MINUTE_IN_MILLIS; |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
427 }else if (unit.equals(TimeGap.TIME_UNIT_HOUR)){ |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
428 gap = gapValue * TimeGap.HOUR_IN_MILLIS; |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
429 }else if (unit.equals(TimeGap.TIME_UNIT_DAY)){ |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
430 gap = gapValue * TimeGap.DAY_IN_MILLIS; |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
431 }else if (unit.equals(TimeGap.TIME_UNIT_WEEK)){ |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
432 gap = gapValue * TimeGap.WEEK_IN_MILLIS; |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
433 }else if (unit.equals(TimeGap.TIME_UNIT_MONTH)){ |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
434 // TODO wie soll das laufen |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
435 gap = gapValue * (TimeGap.DAY_IN_MILLIS *30); |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
436 }else if (unit.equals(TimeGap.TIME_UNIT_YEAR)){ |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
437 // TODO wie soll das laufen f�r schaltjahre |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
438 gap = gapValue * (TimeGap.DAY_IN_MILLIS *365); |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
439 } |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
440 break; |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
441 } |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
442 } |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
443 } |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
444 |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
445 return gap; |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
446 } |
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
193
diff
changeset
|
447 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
448 private void encodeChart(JFreeChart pChart, ChartStyle pStyle, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
449 OutputStream outputStream) throws IOException { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
450 if (sDebug) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
451 sLogger.debug("encodeChart()"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
452 KeypointPNGEncoderAdapter lEncoder = new KeypointPNGEncoderAdapter(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
453 lEncoder.setEncodingAlpha(true); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
454 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
455 int lWidth = (int) pStyle.getChartSize().getWidth(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
456 int lHeight = (int) pStyle.getChartSize().getHeight(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
457 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
458 BufferedImage lImage = pChart.createBufferedImage(lWidth, lHeight, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
459 Transparency.BITMASK, null); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
460 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
461 lEncoder.encode(lImage, outputStream); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
462 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
463 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
464 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
465 private String findValueTitle(Collection<KeyValueDescibeData> values, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
466 String pMmtId) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
467 int id = 0; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
468 try { |
82
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
68
diff
changeset
|
469 id = Integer.parseInt(pMmtId); |
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
68
diff
changeset
|
470 } catch (NumberFormatException e) { |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
471 sLogger.warn(e, e); |
82
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
68
diff
changeset
|
472 return pMmtId; |
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
68
diff
changeset
|
473 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
474 |
82
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
68
diff
changeset
|
475 Iterator<KeyValueDescibeData> it = values.iterator(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
476 while (it.hasNext()) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
477 KeyValueDescibeData data = it.next(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
478 if (id == Integer.parseInt(data.getKey())) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
479 return data.getValue(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
480 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
481 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
482 return ""; |
65
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
483 } |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
484 } |