annotate artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java @ 9354:13bbc75ed0bc

Change theme legend label if interpolated
author gernotbelger
date Tue, 31 Jul 2018 18:12:19 +0200
parents a3f318347707
children ddcd52d239cd
rev   line source
8858
a805211690f7 Fix license headers.
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
a805211690f7 Fix license headers.
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
2 * Software engineering by Intevation GmbH
a805211690f7 Fix license headers.
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
3 *
a805211690f7 Fix license headers.
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
a805211690f7 Fix license headers.
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
a805211690f7 Fix license headers.
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
6 * documentation coming with Dive4Elements River for details.
a805211690f7 Fix license headers.
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
7 */
a805211690f7 Fix license headers.
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
8
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
9 package org.dive4elements.river.exports.process;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
10
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11 import java.awt.BasicStroke;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12 import java.awt.Color;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
13 import java.text.DateFormat;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
14 import java.util.ArrayList;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
15 import java.util.List;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
16
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
17 import org.apache.log4j.Logger;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
8354
9f9857f6c464 Added y axis label to discharge processors.
Raimund Renkert <rrenkert@intevation.de>
parents: 8206
diff changeset
19 import org.dive4elements.artifacts.CallMeta;
9f9857f6c464 Added y axis label to discharge processors.
Raimund Renkert <rrenkert@intevation.de>
parents: 8206
diff changeset
20 import org.dive4elements.river.artifacts.D4EArtifact;
9f9857f6c464 Added y axis label to discharge processors.
Raimund Renkert <rrenkert@intevation.de>
parents: 8206
diff changeset
21 import org.dive4elements.river.artifacts.access.RiverAccess;
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 import org.dive4elements.river.artifacts.model.FacetTypes;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23 import org.dive4elements.river.artifacts.model.NamedDouble;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24 import org.dive4elements.river.artifacts.model.QWDDateRange;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25 import org.dive4elements.river.artifacts.model.WQKms;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 import org.dive4elements.river.artifacts.model.fixings.FixFunction;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 import org.dive4elements.river.artifacts.model.fixings.FixWQCurveFacet;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 import org.dive4elements.river.artifacts.model.fixings.QWD;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 import org.dive4elements.river.artifacts.model.fixings.QWI;
8354
9f9857f6c464 Added y axis label to discharge processors.
Raimund Renkert <rrenkert@intevation.de>
parents: 8206
diff changeset
30 import org.dive4elements.river.artifacts.resources.Resources;
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 import org.dive4elements.river.exports.DiagramGenerator;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 import org.dive4elements.river.exports.StyledSeriesBuilder;
9325
094ed9d1f2ad Fixed: change of point style of interpolated data did not change in WQ chart of fixanalysis
gernotbelger
parents: 9123
diff changeset
33 import org.dive4elements.river.exports.fixings.FixWQCurveGenerator;
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 import org.dive4elements.river.jfree.CollisionFreeXYTextAnnotation;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 import org.dive4elements.river.jfree.JFreeUtil;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36 import org.dive4elements.river.jfree.RiverAnnotation;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37 import org.dive4elements.river.jfree.StickyAxisAnnotation;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 import org.dive4elements.river.jfree.StyledXYSeries;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 import org.dive4elements.river.themes.ThemeDocument;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 import org.jfree.chart.annotations.XYTextAnnotation;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41 import org.jfree.chart.plot.Marker;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
42 import org.jfree.chart.plot.ValueMarker;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
43 import org.jfree.data.xy.XYSeries;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44 import org.jfree.ui.RectangleAnchor;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45 import org.jfree.ui.RectangleInsets;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46 import org.jfree.ui.TextAnchor;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47
8364
abef2584c9a7 Fetch current km from context (and remove obsolete or superfluous comments and logging).
Tom Gottfried <tom@intevation.de>
parents: 8354
diff changeset
48 import static org.dive4elements.river.exports.injector.InjectorConstants.CURRENT_KM;
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
49
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
50 public class FixWQProcessor
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
51 extends DefaultProcessor
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
52 implements FacetTypes
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
53 {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
54
8366
061e85212d25 s/logger/log/ or removed unused logger.
Tom Gottfried <tom@intevation.de>
parents: 8364
diff changeset
55 private static Logger log = Logger.getLogger(FixWQProcessor.class);
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
56
8354
9f9857f6c464 Added y axis label to discharge processors.
Raimund Renkert <rrenkert@intevation.de>
parents: 8206
diff changeset
57 private String I18N_AXIS_LABEL = "chart.discharge.curve.yaxis.label";
9f9857f6c464 Added y axis label to discharge processors.
Raimund Renkert <rrenkert@intevation.de>
parents: 8206
diff changeset
58
8370
e1ff1263d79a Fixed W/Q diagram subtitle in fix analysis.
Raimund Renkert <rrenkert@intevation.de>
parents: 8354
diff changeset
59
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
60 public FixWQProcessor() {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
61 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
62
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
63 @Override
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
64 public void doOut(
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
65 DiagramGenerator generator,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
66 ArtifactAndFacet bundle,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
67 ThemeDocument theme,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
68 boolean visible
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
69 ) {
8364
abef2584c9a7 Fetch current km from context (and remove obsolete or superfluous comments and logging).
Tom Gottfried <tom@intevation.de>
parents: 8354
diff changeset
70 // TODO: Simplify this processor and move general facets/data to
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
71 // MiscDischargeProcessor or something...
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
72 String facetType = bundle.getFacetName();
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
73 log.debug("facet: " + facetType
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
74 + " name: " + bundle.getFacetDescription());
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
75 if(facetType.startsWith(FIX_SECTOR_AVERAGE_WQ)) {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
76 doSectorAverageOut(generator, bundle, theme, visible);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
77 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
78 else if(FIX_ANALYSIS_EVENTS_WQ.equals(facetType)
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
79 || FIX_REFERENCE_EVENTS_WQ.equals(facetType)
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
80 || FIX_EVENTS.equals(facetType)) {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
81 doEventsOut(generator, bundle, theme, visible);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
82 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
83 else if(FIX_WQ_CURVE.equals(facetType)) {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
84 doWQCurveOut(generator, bundle, theme, visible);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
85 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
86 else if(FIX_OUTLIER.equals(facetType)) {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
87 doOutlierOut(generator, bundle, theme, visible);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
88 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
89 else if(QSECTOR.equals(facetType)) {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
90 doQSectorOut(generator, bundle, theme, visible);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
91 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
92 else if(STATIC_WKMS_MARKS.equals(facetType) ||
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
93 STATIC_WKMS.equals(facetType) ||
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
94 HEIGHTMARKS_POINTS.equals(facetType) ) {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
95 doWAnnotations(generator, bundle, theme, visible);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
96 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
97 else if (LONGITUDINAL_W.equals(facetType)
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
98 || STATIC_WKMS_INTERPOL.equals(facetType)
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
99 || FIX_WQ_LS.equals(facetType)) {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
100 doWQOut(generator, bundle, theme, visible);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
101 }
8387
8c60595fd74c Unify discharge curve subtitles.
Tom Gottfried <tom@intevation.de>
parents: 8375
diff changeset
102
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
103 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
104
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
105 /** Add sector average points to chart. */
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
106 protected void doSectorAverageOut(
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
107 DiagramGenerator generator,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
108 ArtifactAndFacet bundle,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
109 ThemeDocument theme,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
110 boolean visible
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
111 ) {
8366
061e85212d25 s/logger/log/ or removed unused logger.
Tom Gottfried <tom@intevation.de>
parents: 8364
diff changeset
112 log.debug("doSectorAverageOut");
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
113 QWDDateRange qwdd = (QWDDateRange)bundle.getData(
9123
1cc7653ca84f Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
gernotbelger
parents: 8858
diff changeset
114 generator.getContext());
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
115 QWD qwd = qwdd != null ? qwdd.getQWD() : null;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
116
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
117 if(qwd != null) {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
118 XYSeries series = new StyledXYSeries(
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
119 bundle.getFacetDescription(),
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
120 false, true,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
121 theme);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
122 DateFormat dateFormat = DateFormat.getDateInstance(
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
123 DateFormat.SHORT);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
124
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
125 series.add(qwd.getQ(), qwd.getW(), false);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
126
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
127 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
128 dateFormat.format(qwd.getDate()),
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
129 qwd.getQ(),
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
130 qwd.getW());
9348
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 9325
diff changeset
131 List<XYTextAnnotation> annos = new ArrayList<>();
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
132 annos.add(anno);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
133 generator.addAxisSeries(series, axisName, visible);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
134
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
135 if (visible && theme != null && theme.parseShowPointLabel()) {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
136 RiverAnnotation flysAnno =
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
137 new RiverAnnotation(null, null, null, theme);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
138 flysAnno.setTextAnnotations(annos);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
139 generator.addAnnotations(flysAnno);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
140 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
141 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
142 else {
8366
061e85212d25 s/logger/log/ or removed unused logger.
Tom Gottfried <tom@intevation.de>
parents: 8364
diff changeset
143 log.debug("doSectorAverageOut: qwd == null");
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
144 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
145 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
146
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
147
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
148 /** Add analysis event points to chart. */
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
149 protected void doEventsOut(
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
150 DiagramGenerator generator,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
151 ArtifactAndFacet bundle,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
152 ThemeDocument theme,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
153 boolean visible
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
154 ) {
8366
061e85212d25 s/logger/log/ or removed unused logger.
Tom Gottfried <tom@intevation.de>
parents: 8364
diff changeset
155 log.debug("doAnalysisEventsOut");
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
156
9123
1cc7653ca84f Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
gernotbelger
parents: 8858
diff changeset
157 QWD qwd = (QWD)bundle.getData(generator.getContext());
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
158
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
159 if (qwd == null) {
8366
061e85212d25 s/logger/log/ or removed unused logger.
Tom Gottfried <tom@intevation.de>
parents: 8364
diff changeset
160 log.debug("doAnalysisEventsOut: qwd == null");
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
161 return;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
162 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
163
9325
094ed9d1f2ad Fixed: change of point style of interpolated data did not change in WQ chart of fixanalysis
gernotbelger
parents: 9123
diff changeset
164 // prevent potential side effects
094ed9d1f2ad Fixed: change of point style of interpolated data did not change in WQ chart of fixanalysis
gernotbelger
parents: 9123
diff changeset
165 final ThemeDocument themeInterpolated = FixWQCurveGenerator.configureThemeInterpolated(theme, qwd);
9354
13bbc75ed0bc Change theme legend label if interpolated
gernotbelger
parents: 9348
diff changeset
166 final XYSeries series = FixWQCurveGenerator.createQWDSeries(bundle, themeInterpolated, qwd);
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
167
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
168 generator.addAxisSeries(series, axisName, visible);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
169
9325
094ed9d1f2ad Fixed: change of point style of interpolated data did not change in WQ chart of fixanalysis
gernotbelger
parents: 9123
diff changeset
170 if (visible && themeInterpolated.parseShowPointLabel()) {
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
171
9348
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 9325
diff changeset
172 final List<XYTextAnnotation> textAnnos = new ArrayList<>();
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
173
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
174 DateFormat dateFormat = DateFormat.getDateInstance(
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
175 DateFormat.SHORT);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
176 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
177 dateFormat.format(qwd.getDate()),
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
178 qwd.getQ(),
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
179 qwd.getW());
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
180 textAnnos.add(anno);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
181
9348
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 9325
diff changeset
182 RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, themeInterpolated);
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
183 flysAnno.setTextAnnotations(textAnnos);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
184 generator.addAnnotations(flysAnno);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
185 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
186 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
187
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
188 /** Add reference event points to chart. */
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
189 protected void doReferenceEventsOut(
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
190 DiagramGenerator generator,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
191 ArtifactAndFacet bundle,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
192 ThemeDocument theme,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
193 boolean visible) {
8366
061e85212d25 s/logger/log/ or removed unused logger.
Tom Gottfried <tom@intevation.de>
parents: 8364
diff changeset
194 log.debug("doReferenceEventsOut");
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
195
9123
1cc7653ca84f Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
gernotbelger
parents: 8858
diff changeset
196 QWI qwd = (QWI)bundle.getData(generator.getContext());
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
197 if (qwd == null) {
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
198 log.debug("doReferenceEventsOut: qwds == null in "
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
199 + bundle.getFacetDescription());
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
200 return;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
201 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
202
9354
13bbc75ed0bc Change theme legend label if interpolated
gernotbelger
parents: 9348
diff changeset
203
9325
094ed9d1f2ad Fixed: change of point style of interpolated data did not change in WQ chart of fixanalysis
gernotbelger
parents: 9123
diff changeset
204 final ThemeDocument themeInterpolated = FixWQCurveGenerator.configureThemeInterpolated(theme, qwd);
9354
13bbc75ed0bc Change theme legend label if interpolated
gernotbelger
parents: 9348
diff changeset
205 final XYSeries series = FixWQCurveGenerator.createQWDSeries(bundle, themeInterpolated, qwd);
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
206 series.add(qwd.getQ(), qwd.getW(), false);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
207
9325
094ed9d1f2ad Fixed: change of point style of interpolated data did not change in WQ chart of fixanalysis
gernotbelger
parents: 9123
diff changeset
208 if (visible && themeInterpolated.parseShowPointLabel()) {
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
209 DateFormat dateFormat = DateFormat.getDateInstance(
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
210 DateFormat.SHORT);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
211
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
212 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
213 dateFormat.format(qwd.getDate()),
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
214 qwd.getQ(),
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
215 qwd.getW());
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
216
9348
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 9325
diff changeset
217 List<XYTextAnnotation> textAnnos = new ArrayList<>();
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
218 textAnnos.add(anno);
9348
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 9325
diff changeset
219 RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, themeInterpolated);
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
220 flysAnno.setTextAnnotations(textAnnos);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
221 generator.addAnnotations(flysAnno);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
222 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
223
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
224 generator.addAxisSeries(series, axisName, visible);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
225 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
226
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
227 protected void doWQCurveOut(
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
228 DiagramGenerator generator,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
229 ArtifactAndFacet bundle,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
230 ThemeDocument theme,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
231 boolean visible
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
232 ) {
8366
061e85212d25 s/logger/log/ or removed unused logger.
Tom Gottfried <tom@intevation.de>
parents: 8364
diff changeset
233 log.debug("doWQCurveOut");
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
234
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
235 FixWQCurveFacet facet = (FixWQCurveFacet)bundle.getFacet();
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
236 FixFunction func = (FixFunction)facet.getData(
9123
1cc7653ca84f Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
gernotbelger
parents: 8858
diff changeset
237 bundle.getArtifact(), generator.getContext());
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
238
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
239 if (func == null) {
8366
061e85212d25 s/logger/log/ or removed unused logger.
Tom Gottfried <tom@intevation.de>
parents: 8364
diff changeset
240 log.warn("doWQCurveOut: Facet does not contain FixFunction");
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
241 return;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
242 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
243
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
244 double maxQ = func.getMaxQ();
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
245
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
246 if (maxQ > 0) {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
247 StyledXYSeries series = JFreeUtil.sampleFunction2D(
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
248 func.getFunction(),
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
249 theme,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
250 bundle.getFacetDescription(),
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
251 500, // number of samples
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
252 0.0 , // start
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
253 maxQ); // end
8375
0faa82973f60 Re-add line previously removed accidentally between lots of comments.
Tom Gottfried <tom@intevation.de>
parents: 8372
diff changeset
254
0faa82973f60 Re-add line previously removed accidentally between lots of comments.
Tom Gottfried <tom@intevation.de>
parents: 8372
diff changeset
255 generator.addAxisSeries(series, axisName, visible);
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
256 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
257 else {
8366
061e85212d25 s/logger/log/ or removed unused logger.
Tom Gottfried <tom@intevation.de>
parents: 8364
diff changeset
258 log.warn("doWQCurveOut: maxQ <= 0");
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
259 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
260 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
261
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
262 protected void doOutlierOut(
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
263 DiagramGenerator generator,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
264 ArtifactAndFacet bundle,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
265 ThemeDocument theme,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
266 boolean visible
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
267 ) {
8366
061e85212d25 s/logger/log/ or removed unused logger.
Tom Gottfried <tom@intevation.de>
parents: 8364
diff changeset
268 log.debug("doOutlierOut");
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
269
9123
1cc7653ca84f Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
gernotbelger
parents: 8858
diff changeset
270 QWI[] qws = (QWI[])bundle.getData(generator.getContext());
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
271 if(qws != null) {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
272 XYSeries series = new StyledXYSeries(
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
273 bundle.getFacetDescription(),
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
274 false, true,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
275 theme);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
276 DateFormat dateFormat = DateFormat.getDateInstance(
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
277 DateFormat.SHORT);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
278
9348
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 9325
diff changeset
279 List<XYTextAnnotation> annos = new ArrayList<>();
8364
abef2584c9a7 Fetch current km from context (and remove obsolete or superfluous comments and logging).
Tom Gottfried <tom@intevation.de>
parents: 8354
diff changeset
280
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
281 for (QWI qw: qws) {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
282 series.add(qw.getQ(), qw.getW(), false);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
283
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
284 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
285 dateFormat.format(qw.getDate()),
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
286 qw.getQ(),
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
287 qw.getW());
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
288 annos.add(anno);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
289 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
290 generator.addAxisSeries(series, axisName, visible);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
291
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
292 if (visible && theme != null && theme.parseShowPointLabel()) {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
293 RiverAnnotation flysAnno =
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
294 new RiverAnnotation(null, null, null, theme);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
295 flysAnno.setTextAnnotations(annos);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
296 generator.addAnnotations(flysAnno);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
297 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
298 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
299 else {
8366
061e85212d25 s/logger/log/ or removed unused logger.
Tom Gottfried <tom@intevation.de>
parents: 8364
diff changeset
300 log.debug("doOutlierOut: qwd == null");
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
301 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
302 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
303
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
304 /** Add markers for q sectors. */
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
305 protected void doQSectorOut(
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
306 DiagramGenerator generator,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
307 ArtifactAndFacet bundle,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
308 ThemeDocument theme,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
309 boolean visible
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
310 ) {
8366
061e85212d25 s/logger/log/ or removed unused logger.
Tom Gottfried <tom@intevation.de>
parents: 8364
diff changeset
311 log.debug("doQSectorOut");
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
312 if (!visible) {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
313 return;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
314 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
315
9123
1cc7653ca84f Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
gernotbelger
parents: 8858
diff changeset
316 Object qsectorsObj = bundle.getData(generator.getContext());
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
317 if (qsectorsObj == null || !(qsectorsObj instanceof List)) {
8366
061e85212d25 s/logger/log/ or removed unused logger.
Tom Gottfried <tom@intevation.de>
parents: 8364
diff changeset
318 log.warn("No QSectors coming from data.");
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
319 return;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
320 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
321
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
322 List<?> qsectorsList = (List<?>) qsectorsObj;
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
323 if (qsectorsList.size() == 0
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
324 || !(qsectorsList.get(0) instanceof NamedDouble)
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
325 ) {
8366
061e85212d25 s/logger/log/ or removed unused logger.
Tom Gottfried <tom@intevation.de>
parents: 8364
diff changeset
326 log.warn("No QSectors coming from data.");
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
327 return;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
328 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
329
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
330 @SuppressWarnings("unchecked")
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
331 List<NamedDouble> qsectors = (List<NamedDouble>) qsectorsList;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
332
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
333 for (NamedDouble qsector : qsectors) {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
334 if (Double.isNaN(qsector.getValue())) {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
335 continue;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
336 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
337 Marker m = new ValueMarker(qsector.getValue());
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
338 m.setPaint(Color.black);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
339
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
340 float[] dashes = theme.parseLineStyle();
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
341 int size = theme.parseLineWidth();
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
342 BasicStroke stroke;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
343 if (dashes.length <= 1) {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
344 stroke = new BasicStroke(size);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
345 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
346 else {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
347 stroke = new BasicStroke(size,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
348 BasicStroke.CAP_BUTT,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
349 BasicStroke.JOIN_ROUND,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
350 1.0f,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
351 dashes,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
352 0.0f);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
353 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
354 m.setStroke(stroke);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
355
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
356 if (theme.parseShowLineLabel()) {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
357 m.setLabel(qsector.getName());
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
358 m.setPaint(theme.parseTextColor());
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
359 m.setLabelFont(theme.parseTextFont());
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
360 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
361 Color paint = theme.parseLineColorField();
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
362 if (paint != null) {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
363 m.setPaint(paint);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
364 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
365 m.setLabelAnchor(RectangleAnchor.TOP_LEFT);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
366 m.setLabelTextAnchor(TextAnchor.TOP_LEFT);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
367 m.setLabelOffset(new RectangleInsets(5, 5, 10, 10));
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
368 generator.addDomainMarker(m);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
369 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
370 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
371
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
372 /**
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
373 * Add W-Annotations to plot.
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
374 * @param wqkms actual data (double[][]).
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
375 * @param theme theme to use.
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
376 */
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
377 protected void doWAnnotations(
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
378 DiagramGenerator generator,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
379 ArtifactAndFacet bundle,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
380 ThemeDocument theme,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
381 boolean visible
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
382 ) {
9123
1cc7653ca84f Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
gernotbelger
parents: 8858
diff changeset
383 Object data = bundle.getData(generator.getContext());
9348
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 9325
diff changeset
384 List<StickyAxisAnnotation> xy = new ArrayList<>();
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
385 if (data instanceof double[][]) {
8366
061e85212d25 s/logger/log/ or removed unused logger.
Tom Gottfried <tom@intevation.de>
parents: 8364
diff changeset
386 log.debug("Got double[][]");
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
387 double [][] values = (double [][]) data;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
388 for (int i = 0; i< values[0].length; i++) {
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
389 xy.add(new StickyAxisAnnotation(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
390 bundle.getFacetDescription(),
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
391 (float) values[1][i],
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
392 StickyAxisAnnotation.SimpleAxis.Y_AXIS));
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
393 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
394
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
395 if (visible) {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
396 generator.addAnnotations(
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
397 new RiverAnnotation(
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
398 bundle.getFacetDescription(), xy, null, theme));
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
399 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
400 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
401 else {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
402 // Assume its WKms.
8366
061e85212d25 s/logger/log/ or removed unused logger.
Tom Gottfried <tom@intevation.de>
parents: 8364
diff changeset
403 log.debug("Got WKms");
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
404 /* TODO
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
405 WKms wkms = (WKms) data;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
406
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
407 Double ckm =
9123
1cc7653ca84f Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
gernotbelger
parents: 8858
diff changeset
408 (Double)generator.getContext().getContextValue(
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
409 FixChartGenerator.CURRENT_KM);
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
410 double location = (ckm != null)
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
411 ? ckm.doubleValue()
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
412 : getRange()[0];
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
413 double w = StaticWKmsArtifact.getWAtKmLin(data, location);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
414 xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(),
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
415 (float) w, StickyAxisAnnotation.SimpleAxis.Y_AXIS));
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
416
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
417 doAnnotations(new RiverAnnotation(facet.getDescription(), xy),
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
418 aandf, theme, visible);*/
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
419 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
420 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
421
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
422 /**
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
423 * Add WQ Data to plot.
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
424 * @param wqkms data as double[][]
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
425 */
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
426 protected void doWQOut(
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
427 DiagramGenerator generator,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
428 ArtifactAndFacet bundle,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
429 ThemeDocument theme,
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
430 boolean visible
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
431 ) {
9123
1cc7653ca84f Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
gernotbelger
parents: 8858
diff changeset
432 Object data = bundle.getData(generator.getContext());
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
433 if (data instanceof WQKms) {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
434 WQKms wqkms = (WQKms)data;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
435 // TODO As in doEventsOut, the value-searching should
8364
abef2584c9a7 Fetch current km from context (and remove obsolete or superfluous comments and logging).
Tom Gottfried <tom@intevation.de>
parents: 8354
diff changeset
436 // be delivered by the facet already
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
437 XYSeries series = new StyledXYSeries(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
438 bundle.getFacetDescription(), theme);
9123
1cc7653ca84f Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
gernotbelger
parents: 8858
diff changeset
439 Double ckm = (Double) generator.getContext()
8364
abef2584c9a7 Fetch current km from context (and remove obsolete or superfluous comments and logging).
Tom Gottfried <tom@intevation.de>
parents: 8354
diff changeset
440 .getContextValue(CURRENT_KM);
abef2584c9a7 Fetch current km from context (and remove obsolete or superfluous comments and logging).
Tom Gottfried <tom@intevation.de>
parents: 8354
diff changeset
441
9348
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 9325
diff changeset
442 if (wqkms.getKms().length == 0 || ckm == null) {
8366
061e85212d25 s/logger/log/ or removed unused logger.
Tom Gottfried <tom@intevation.de>
parents: 8364
diff changeset
443 log.info("addPointFromWQKms: No event data to show.");
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
444 return;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
445 }
8364
abef2584c9a7 Fetch current km from context (and remove obsolete or superfluous comments and logging).
Tom Gottfried <tom@intevation.de>
parents: 8354
diff changeset
446
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
447 double[] kms = wqkms.getKms();
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
448 for (int i = 0 ; i< kms.length; i++) {
8472
3f505fba522f (issue1772) Use 0.001km tolarance instead of 0.1 to find matching km.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8391
diff changeset
449 /* We use a tolerance of 1m here to find a hit.
3f505fba522f (issue1772) Use 0.001km tolarance instead of 0.1 to find matching km.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8391
diff changeset
450 * Probably to avoid some rounding errors. */
3f505fba522f (issue1772) Use 0.001km tolarance instead of 0.1 to find matching km.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8391
diff changeset
451 if (Math.abs(kms[i] - ckm) <= 0.001) {
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
452 series.add(wqkms.getQ(i), wqkms.getW(i), false);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
453 generator.addAxisSeries(series, axisName, visible);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
454 if(visible && theme.parseShowPointLabel()) {
9348
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 9325
diff changeset
455 List<XYTextAnnotation> textAnnos = new ArrayList<>();
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
456 XYTextAnnotation anno =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
457 new CollisionFreeXYTextAnnotation(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
458 bundle.getFacetDescription(),
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
459 wqkms.getQ(i),
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
460 wqkms.getW(i));
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
461 textAnnos.add(anno);
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
462 RiverAnnotation flysAnno =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
463 new RiverAnnotation(null, null, null, theme);
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
464 flysAnno.setTextAnnotations(textAnnos);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
465 generator.addAnnotations(flysAnno);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
466 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
467 return;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
468 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
469 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
470 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
471 else {
8366
061e85212d25 s/logger/log/ or removed unused logger.
Tom Gottfried <tom@intevation.de>
parents: 8364
diff changeset
472 log.debug("FixWQCurveGenerator: doWQOut: double[][]");
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
473 double [][] values = (double [][]) data;
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
474
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
475 XYSeries series = new StyledXYSeries(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
476 bundle.getFacetDescription(), false, true, theme);
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
477 StyledSeriesBuilder.addPoints(series, values, true);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
478
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
479 generator.addAxisSeries(series, axisName, visible);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
480 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
481 }
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
482
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
483 @Override
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
484 public boolean canHandle(String facettype) {
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
485 return facettype.startsWith(FIX_SECTOR_AVERAGE_WQ)
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
486 || FIX_ANALYSIS_EVENTS_WQ.equals(facettype)
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
487 || FIX_REFERENCE_EVENTS_WQ.equals(facettype)
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
488 || FIX_EVENTS.equals(facettype)
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
489 || FIX_WQ_CURVE.equals(facettype)
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
490 || FIX_OUTLIER.equals(facettype)
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
491 || QSECTOR.equals(facettype)
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
492 || STATIC_WKMS_MARKS.equals(facettype)
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
493 || STATIC_WKMS.equals(facettype)
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
494 || HEIGHTMARKS_POINTS.equals(facettype)
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
495 || LONGITUDINAL_W.equals(facettype)
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
496 || STATIC_WKMS_INTERPOL.equals(facettype)
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
497 || FIX_WQ_LS.equals(facettype);
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
498 }
8354
9f9857f6c464 Added y axis label to discharge processors.
Raimund Renkert <rrenkert@intevation.de>
parents: 8206
diff changeset
499
9f9857f6c464 Added y axis label to discharge processors.
Raimund Renkert <rrenkert@intevation.de>
parents: 8206
diff changeset
500 @Override
9f9857f6c464 Added y axis label to discharge processors.
Raimund Renkert <rrenkert@intevation.de>
parents: 8206
diff changeset
501 public String getAxisLabel(DiagramGenerator generator) {
9123
1cc7653ca84f Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
gernotbelger
parents: 8858
diff changeset
502 CallMeta meta = generator.getContext().getMeta();
8354
9f9857f6c464 Added y axis label to discharge processors.
Raimund Renkert <rrenkert@intevation.de>
parents: 8206
diff changeset
503
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
504 RiverAccess access = new RiverAccess((D4EArtifact)generator
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
505 .getMaster());
8354
9f9857f6c464 Added y axis label to discharge processors.
Raimund Renkert <rrenkert@intevation.de>
parents: 8206
diff changeset
506 String unit = access.getRiver().getWstUnit().getName();
9f9857f6c464 Added y axis label to discharge processors.
Raimund Renkert <rrenkert@intevation.de>
parents: 8206
diff changeset
507 return Resources.getMsg(
9f9857f6c464 Added y axis label to discharge processors.
Raimund Renkert <rrenkert@intevation.de>
parents: 8206
diff changeset
508 meta,
9f9857f6c464 Added y axis label to discharge processors.
Raimund Renkert <rrenkert@intevation.de>
parents: 8206
diff changeset
509 I18N_AXIS_LABEL,
9f9857f6c464 Added y axis label to discharge processors.
Raimund Renkert <rrenkert@intevation.de>
parents: 8206
diff changeset
510 new Object[] { unit });
9f9857f6c464 Added y axis label to discharge processors.
Raimund Renkert <rrenkert@intevation.de>
parents: 8206
diff changeset
511 }
8206
436512d9bd94 Added processor for discharge curve in fixanalysis.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
512 }

http://dive4elements.wald.intevation.org