comparison flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java @ 1915:6b7557ffe2f8

Handle STATIC_WQ_ANNOTATION type facets in Computed Discharge Curve Diagrams. flys-artifacts/trunk@3275 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 16 Nov 2011 15:49:35 +0000
parents 6c5229d0b8e5
children d99fdc234da1
comparison
equal deleted inserted replaced
1914:e20a47be6207 1915:6b7557ffe2f8
1 package de.intevation.flys.exports; 1 package de.intevation.flys.exports;
2
3 import java.util.List;
4 import java.util.ArrayList;
2 5
3 import org.apache.log4j.Logger; 6 import org.apache.log4j.Logger;
4 7
5 import org.w3c.dom.Document; 8 import org.w3c.dom.Document;
9
10 import org.jfree.chart.annotations.XYTextAnnotation;
6 11
7 import org.jfree.chart.JFreeChart; 12 import org.jfree.chart.JFreeChart;
8 import org.jfree.chart.title.TextTitle; 13 import org.jfree.chart.title.TextTitle;
9 import org.jfree.data.xy.XYSeries; 14 import org.jfree.data.xy.XYSeries;
10 15
15 import de.intevation.flys.artifacts.FLYSArtifact; 20 import de.intevation.flys.artifacts.FLYSArtifact;
16 import de.intevation.flys.artifacts.model.FacetTypes; 21 import de.intevation.flys.artifacts.model.FacetTypes;
17 import de.intevation.flys.artifacts.model.WQKms; 22 import de.intevation.flys.artifacts.model.WQKms;
18 23
19 import de.intevation.flys.jfree.FLYSAnnotation; 24 import de.intevation.flys.jfree.FLYSAnnotation;
25 import de.intevation.flys.jfree.StickyAxisAnnotation;
20 26
21 27
22 /** 28 /**
23 * An OutGenerator that generates discharge curves. 29 * An OutGenerator that generates discharge curves.
24 * 30 *
102 doQOut((WQKms) f.getData(artifact, context), facet, attr, visible); 108 doQOut((WQKms) f.getData(artifact, context), facet, attr, visible);
103 } 109 }
104 else if (name.equals(STATIC_WQ)) { 110 else if (name.equals(STATIC_WQ)) {
105 doWQOut(f.getData(artifact, context), facet, attr, visible); 111 doWQOut(f.getData(artifact, context), facet, attr, visible);
106 } 112 }
113 else if (name.equals(STATIC_WQ_ANNOTATIONS)) {
114 doWQAnnotations(f.getData(artifact, context), facet, attr, visible);
115 }
107 else if (name.equals(COMPUTED_DISCHARGE_MAINVALUES_Q) 116 else if (name.equals(COMPUTED_DISCHARGE_MAINVALUES_Q)
108 || name.equals(MAINVALUES_Q) 117 || name.equals(MAINVALUES_Q)
109 || name.equals(COMPUTED_DISCHARGE_MAINVALUES_W) 118 || name.equals(COMPUTED_DISCHARGE_MAINVALUES_W)
110 || name.equals(MAINVALUES_W) 119 || name.equals(MAINVALUES_W)
111 ) { 120 ) {
144 WQKms wqkms, 153 WQKms wqkms,
145 Facet facet, 154 Facet facet,
146 Document theme, 155 Document theme,
147 boolean visible 156 boolean visible
148 ) { 157 ) {
149 int size = wqkms.size();
150
151
152 XYSeries series = new StyledXYSeries(facet.getDescription(), theme); 158 XYSeries series = new StyledXYSeries(facet.getDescription(), theme);
153 StyledSeriesBuilder.addPointsQW(series, wqkms); 159 StyledSeriesBuilder.addPointsQW(series, wqkms);
154 160
155 addFirstAxisSeries(series, visible); 161 addFirstAxisSeries(series, visible);
156 } 162 }
163
164
165 /**
166 * Add WQ-Annotations to plot.
167 * @param wqkms actual data
168 * @param theme theme to use.
169 */
170 protected void doWQAnnotations(
171 Object wqkms,
172 Facet facet,
173 Document theme,
174 boolean visible
175 ) {
176 List<XYTextAnnotation> xy = new ArrayList<XYTextAnnotation>();
177 double [][] data = (double [][]) wqkms;
178 for (int i = 0; i< data[0].length; i++) {
179 xy.add(new StickyAxisAnnotation(facet.getDescription(),
180 (float) data[0][i], StickyAxisAnnotation.SimpleAxis.X_AXIS));
181 xy.add(new StickyAxisAnnotation(facet.getDescription(),
182 (float) data[1][i], StickyAxisAnnotation.SimpleAxis.Y_AXIS));
183 }
184
185 doAnnotations(new FLYSAnnotation(facet.getDescription(), xy),
186 facet, theme, visible);
187 }
157 } 188 }
158 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 189 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org