comparison flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java @ 1684:bdb05dc9b763

Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained. flys-artifacts/trunk@2902 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 07 Oct 2011 10:51:09 +0000
parents 69929c471646
children 7eb9015489b0
comparison
equal deleted inserted replaced
1683:acb4d20b130e 1684:bdb05dc9b763
170 xaxis.setInverted(true); 170 xaxis.setInverted(true);
171 } 171 }
172 } 172 }
173 173
174 174
175 public void doOut(Artifact artifact, Facet facet, Document attr) { 175 public void doOut(
176 Artifact artifact,
177 Facet facet,
178 Document attr,
179 boolean visible
180 ) {
176 String name = facet.getName(); 181 String name = facet.getName();
177 182
178 logger.debug("LongitudinalSectionGenerator.doOut: " + name); 183 logger.debug("LongitudinalSectionGenerator.doOut: " + name);
179 184
180 if (name == null) { 185 if (name == null) {
188 if (f == null) { 193 if (f == null) {
189 return; 194 return;
190 } 195 }
191 196
192 if (name.equals(LONGITUDINAL_W)) { 197 if (name.equals(LONGITUDINAL_W)) {
193 doWOut((WQKms) f.getData(artifact, context), attr); 198 doWOut((WQKms) f.getData(artifact, context), attr, visible);
194 } 199 }
195 else if (name.equals(LONGITUDINAL_Q)) { 200 else if (name.equals(LONGITUDINAL_Q)) {
196 doQOut((WQKms) f.getData(artifact, context), attr); 201 doQOut((WQKms) f.getData(artifact, context), attr, visible);
197 } 202 }
198 else if (name.equals(LONGITUDINAL_ANNOTATION)) { 203 else if (name.equals(LONGITUDINAL_ANNOTATION)) {
199 doAnnotationsOut(f.getData(artifact, context), attr); 204 doAnnotationsOut(f.getData(artifact, context), attr, visible);
200 } 205 }
201 else { 206 else {
202 logger.warn("Unknown facet name: " + name); 207 logger.warn("Unknown facet name: " + name);
203 return; 208 return;
204 } 209 }
209 * Register annotations available for the diagram. 214 * Register annotations available for the diagram.
210 * 215 *
211 * @param o list of annotations (data of facet). 216 * @param o list of annotations (data of facet).
212 * @param theme yet ignored. 217 * @param theme yet ignored.
213 */ 218 */
214 protected void doAnnotationsOut(Object o, Document theme) { 219 protected void doAnnotationsOut(Object o, Document theme, boolean visible) {
215 logger.debug("LongitudinalSectionGenerator.doAnnotationsOut"); 220 logger.debug("LongitudinalSectionGenerator.doAnnotationsOut");
216 221
217 // Add all annotations in list o to our annotation pool. 222 // Add all annotations in list o to our annotation pool.
218 FLYSAnnotation fa = (FLYSAnnotation) o; 223 FLYSAnnotation fa = (FLYSAnnotation) o;
219 addAnnotations(fa); 224 addAnnotations(fa, visible);
220 } 225 }
221 226
222 227
223 /** 228 /**
224 * Process the output for W facets in a longitudinal section curve. 229 * Process the output for W facets in a longitudinal section curve.
225 * 230 *
226 * @param wqkms An array of WQKms values. 231 * @param wqkms An array of WQKms values.
227 * @param theme The theme that contains styling information. 232 * @param theme The theme that contains styling information.
228 */ 233 */
229 protected void doWOut(WQKms wqkms, Document theme) { 234 protected void doWOut(WQKms wqkms, Document theme, boolean visible) {
230 logger.debug("LongitudinalSectionGenerator.doWOut"); 235 logger.debug("LongitudinalSectionGenerator.doWOut");
231 236
232 XYSeries series = new StyledXYSeries(getSeriesName(wqkms, "W"), theme); 237 XYSeries series = new StyledXYSeries(getSeriesName(wqkms, "W"), theme);
233 238
234 int size = wqkms.size(); 239 int size = wqkms.size();
244 249
245 for (int i = 0; i < size; i++) { 250 for (int i = 0; i < size; i++) {
246 series.add(wqkms.getKm(i), wqkms.getW(i)); 251 series.add(wqkms.getKm(i), wqkms.getW(i));
247 } 252 }
248 253
249 addFirstAxisSeries(series); 254 addFirstAxisSeries(series, visible);
250 255
251 if (wqkms.guessWaterIncreasing()) { 256 if (wqkms.guessWaterIncreasing()) {
252 setInverted(true); 257 setInverted(true);
253 } 258 }
254 } 259 }
258 * Process the output for Q facets in a longitudinal section curve. 263 * Process the output for Q facets in a longitudinal section curve.
259 * 264 *
260 * @param wqkms An array of WQKms values. 265 * @param wqkms An array of WQKms values.
261 * @param theme The theme that contains styling information. 266 * @param theme The theme that contains styling information.
262 */ 267 */
263 protected void doQOut(WQKms wqkms, Document theme) { 268 protected void doQOut(WQKms wqkms, Document theme, boolean visible) {
264 logger.debug("LongitudinalSectionGenerator.doQOut"); 269 logger.debug("LongitudinalSectionGenerator.doQOut");
265 270
266 XYSeries series = new StyledXYSeries(getSeriesName(wqkms, "Q"), theme); 271 XYSeries series = new StyledXYSeries(getSeriesName(wqkms, "Q"), theme);
267 272
268 int size = wqkms.size(); 273 int size = wqkms.size();
278 283
279 for (int i = 0; i < size; i++) { 284 for (int i = 0; i < size; i++) {
280 series.add(wqkms.getKm(i), wqkms.getQ(i)); 285 series.add(wqkms.getKm(i), wqkms.getQ(i));
281 } 286 }
282 287
283 addSecondAxisSeries(series); 288 addSecondAxisSeries(series, visible);
284 289
285 if (wqkms.guessWaterIncreasing()) { 290 if (wqkms.guessWaterIncreasing()) {
286 setInverted(true); 291 setInverted(true);
287 } 292 }
288 } 293 }

http://dive4elements.wald.intevation.org