Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/chart/ChartFactory.java @ 204:734ac082c8d1
Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
gnv-artifacts/trunk@259 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Thu, 22 Oct 2009 08:50:21 +0000 |
parents | 34f233123a6f |
children | 3dcd2b0b456e |
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; |
0e9762ebd18d
Refactor ChartFactory so that it is able to be compiled without errors.
Tim Englich <tim.englich@intevation.de>
parents:
65
diff
changeset
|
47 import de.intevation.gnv.transition.describedata.KeyValueDescibeData; |
65
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
48 |
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 * 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
|
51 * <ol> |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
52 * <li></li> |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
53 * </ol> |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
54 * |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
55 * @author blume |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
56 * @version 1.0 |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
57 * @serial 1.0 |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
58 * @see |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
59 * @since 06.12.2007 17:25:59 |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
60 */ |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
61 public class ChartFactory { |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
62 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
63 /** |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
64 * Default Logging instance |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
65 */ |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
66 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
|
67 private static boolean sDebug = sLogger.isDebugEnabled(); |
65
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
68 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
69 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
|
70 ChartLabels pLabels, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
71 ChartStyle pStyle, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
72 Collection<KeyValueDescibeData> parameters, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
73 Collection<KeyValueDescibeData> measurements, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
74 OutputStream outputStream, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
75 Collection<Result> resultSet) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
76 throws IOException, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
77 TechnicalChartException { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
78 if (sDebug) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
79 sLogger.debug("createSimpleTimeSeriesChart()"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
80 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
|
81 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
|
82 if (pStyle.isUseUpperDataLevel() |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
83 && 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
|
84 lUpperLevel = pStyle.getUpperLevel(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
85 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
86 if (pStyle.isUseLowerDataLevel() |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
87 && 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
|
88 lLowerLevel = pStyle.getLowerLevel(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
89 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
90 if (sDebug) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
91 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
|
92 XYDataset lSet = this.createDataset(resultSet, lUpperLevel, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
93 lLowerLevel, parameters, measurements); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
94 if (sDebug) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
95 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
|
96 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
|
97 DateAxis domain = new DateAxis(pLabels.getDomainAxisLabel()); |
65
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
98 NumberAxis axis; |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
99 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
|
100 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
|
101 // Global settings |
65
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
102 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
103 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
|
104 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
|
105 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
|
106 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
|
107 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
|
108 // 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
|
109 plot.setDomainAxis(domain); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
110 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
|
111 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
|
112 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
|
113 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
|
114 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
|
115 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
|
116 .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
|
117 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
|
118 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
|
119 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
|
120 // 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
|
121 plot.setRangeAxis(axis1); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
122 } else { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
123 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
|
124 axis.setAutoRangeIncludesZero(false); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
125 plot.setRangeAxis(axis); |
65
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
126 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
127 axis.configure(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
128 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
|
129 plot.setRenderer(renderer); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
130 plot.setDataset(lSet); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
131 } else { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
132 // 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
|
133 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
|
134 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
135 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
|
136 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
|
137 mColor = color[0]; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
138 // if ( pParameterId.length==1){ |
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 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
|
141 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
|
142 .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
|
143 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
|
144 // 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
|
145 axis1.setLabelPaint(mColor); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
146 axis1.setTickLabelPaint(mColor); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
147 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
|
148 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
|
149 plot.setRangeAxis(i, axis1); |
65
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
150 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
151 } else { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
152 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
|
153 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
|
154 axis.setAutoRangeIncludesZero(false); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
155 axis.setLabelPaint(mColor); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
156 axis.setTickLabelPaint(mColor); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
157 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
|
158 axis.configure(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
159 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
160 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
|
161 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
|
162 else |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
163 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
|
164 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
|
165 // } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
166 renderer = new StandardXYItemRenderer(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
167 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
|
168 // 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
|
169 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
|
170 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
171 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
172 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
|
173 "SansSerif", Font.BOLD, 24), plot, true); |
65
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
174 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
175 setStyle(chart, pStyle); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
176 configureRenderingOptions(chart); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
177 if (sDebug) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
178 sLogger.debug(" vor encodeChart()"); |
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 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
|
181 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
182 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
183 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
|
184 // TechnicalChartException{ |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
185 // 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
|
186 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
|
187 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
|
188 return TSC; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
189 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
190 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
191 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
|
192 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
|
193 .getPlot()).getRenderer(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
194 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
|
195 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
|
196 xylineandshaperenderer.setBaseShapesVisible(true); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
197 xylineandshaperenderer.setBaseShapesFilled(true); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
198 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
199 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
200 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
201 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
|
202 if (sDebug) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
203 sLogger.debug("setStyle()"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
204 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
|
205 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
|
206 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
|
207 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
|
208 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
|
209 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
210 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
|
211 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
|
212 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
|
213 xyplot.setAxisOffset(lRectangleInsets); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
214 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
|
215 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
|
216 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
217 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
218 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
219 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
|
220 Collection<Result> resultSet, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
221 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
|
222 int pStart, int pEnd, Date dStart, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
223 Date dEnd) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
224 throws TechnicalChartException { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
225 if (sDebug) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
226 sLogger.debug("createTimeSeries()"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
227 Result lRow0, lRow1; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
228 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
229 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
|
230 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
231 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
|
232 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
|
233 try { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
234 long maxGap = 0, lDateDiff = 0; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
235 double lValue = 0; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
236 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
237 int i = 0; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
238 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
|
239 while (resultIterator.hasNext()) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
240 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
|
241 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
|
242 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
|
243 lRow0 = lRow;// |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
244 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
245 // Handle Gaps > 0.5% timeserieslength, i.e do not draw |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
246 // here |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
247 // +TODO mache maxGap variabel �ber diagram options |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
248 maxGap = (dEnd.getTime() - dStart.getTime()) / 200; // 0,5 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
249 // prozent |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
250 // der |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
251 // L�nge |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
252 if (maxGap < 3600000) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
253 maxGap = 3600010; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
254 if (maxGap < (dEnd.getTime() - dStart.getTime()) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
255 / (pEnd - pStart)) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
256 maxGap = (dEnd.getTime() - dStart.getTime()) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
257 / (pEnd - pStart) + 1000; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
258 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
259 if (sDebug) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
260 sLogger.debug("MaxGap : " + maxGap / 1000 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
261 + " L�nge : " |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
262 + (dEnd.getTime() - dStart.getTime()) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
263 / 1000 + "Intervall " |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
264 + (dEnd.getTime() - dStart.getTime()) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
265 / (pEnd - pStart) / 1000); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
266 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
|
267 lDate0 = lDate; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
268 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
|
269 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
|
270 // 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
|
271 // lValue); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
272 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
|
273 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
274 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
275 // 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
|
276 lRow1 = lRow; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
277 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
|
278 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
|
279 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
|
280 if (lDateDiff > maxGap) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
281 // 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
|
282 // 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
|
283 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
|
284 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
|
285 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
|
286 // 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
|
287 } 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
|
288 if (sDebug) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
289 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
|
290 + " 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
|
291 + lDate + " " + lDate0); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
292 } 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
|
293 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
|
294 // 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
|
295 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
296 lRow0 = lRow1; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
297 lDate0 = lDate; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
298 } 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
|
299 return lTimeseries; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
300 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
301 i++; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
302 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
303 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
304 } catch (OutOfMemoryError e) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
305 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
|
306 return lTimeseries; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
307 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
308 } 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
|
309 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
|
310 } finally { |
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 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
313 return lTimeseries; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
314 } |
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 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
|
317 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
|
318 Collection<KeyValueDescibeData> parameters, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
319 Collection<KeyValueDescibeData> measurements) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
320 throws TechnicalChartException { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
321 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
322 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
|
323 try { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
324 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
|
325 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
|
326 int mStart = 0; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
327 int mEnd = 0; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
328 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
329 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
|
330 if (resultIterator.hasNext()) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
331 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
|
332 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
333 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
|
334 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
|
335 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
|
336 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
|
337 int i = 1; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
338 while (resultIterator.hasNext()) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
339 row = resultIterator.next(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
340 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
|
341 || !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
|
342 || !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
|
343 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
|
344 break1) |
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 + findValueTitle(measurements, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
347 break2) + "m"; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
348 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
349 lTimeSeriesCollection.addSeries(createTimeSeries( |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
350 mTimeSeriesName, resultSet, lUpperCut, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
351 lLowerCut, mStart, mEnd, dStart, dEnd)); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
352 mStart = i; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
353 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
|
354 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
|
355 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
|
356 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
|
357 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
358 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
359 mEnd = i; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
360 dEnd = row.getDate("XORDINATE"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
361 i = i + 1; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
362 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
363 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
364 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
|
365 + " " |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
366 + findValueTitle(measurements, break2) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
367 + "m"; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
368 lTimeSeriesCollection.addSeries(createTimeSeries( |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
369 mTimeSeriesName, resultSet, lUpperCut, lLowerCut, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
370 mStart, mEnd, dStart, dEnd)); |
193
34f233123a6f
Adding empty Series into Chart to prevent NPE issue 19
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
371 }else{ |
34f233123a6f
Adding empty Series into Chart to prevent NPE issue 19
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
372 lTimeSeriesCollection.addSeries(createTimeSeries( |
34f233123a6f
Adding empty Series into Chart to prevent NPE issue 19
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
373 "", resultSet, lUpperCut, lLowerCut, |
34f233123a6f
Adding empty Series into Chart to prevent NPE issue 19
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
374 mStart, mEnd, dStart, dEnd)); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
375 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
376 } catch (Exception e) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
377 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
|
378 } finally { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
379 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
380 return lTimeSeriesCollection; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
381 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
382 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
383 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
|
384 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
|
385 if (sDebug) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
386 sLogger.debug("encodeChart()"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
387 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
|
388 lEncoder.setEncodingAlpha(true); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
389 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
390 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
|
391 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
|
392 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
393 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
|
394 Transparency.BITMASK, null); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
395 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
396 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
|
397 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
398 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
399 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
400 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
|
401 String pMmtId) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
402 int id = 0; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
403 try { |
82
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
68
diff
changeset
|
404 id = Integer.parseInt(pMmtId); |
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
68
diff
changeset
|
405 } 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
|
406 sLogger.warn(e, e); |
82
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
68
diff
changeset
|
407 return pMmtId; |
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
68
diff
changeset
|
408 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
409 |
82
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
68
diff
changeset
|
410 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
|
411 while (it.hasNext()) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
412 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
|
413 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
|
414 return data.getValue(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
415 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
416 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
100
diff
changeset
|
417 return ""; |
65
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
418 } |
8b75d01fa5b5
Insert Chart-Classes from old Repository
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
419 } |