comparison artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java @ 7527:0ee545a02204

Simplified code.
author Sascha L. Teichmann <teichmann@intevation.de>
date Wed, 06 Nov 2013 19:41:12 +0100
parents 6650485c2c9b
children db780379ea82
comparison
equal deleted inserted replaced
7526:a836adfaccc6 7527:0ee545a02204
273 logger.debug("doSectorAverageOut: qwd == null"); 273 logger.debug("doSectorAverageOut: qwd == null");
274 } 274 }
275 } 275 }
276 276
277 /** Add analysis event points to chart. */ 277 /** Add analysis event points to chart. */
278 protected void doAnalysisEventsOut(ArtifactAndFacet aaf, ThemeDocument doc, boolean visible) { 278 protected void doAnalysisEventsOut(
279 ArtifactAndFacet aaf,
280 ThemeDocument doc,
281 boolean visible
282 ) {
279 logger.debug("doAnalysisEventsOut"); 283 logger.debug("doAnalysisEventsOut");
280 284
281 QWD qwd = (QWD)aaf.getData(context); 285 QWD qwd = (QWD)aaf.getData(context);
282 if(qwd != null) { 286
283 XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), doc); 287 if (qwd == null) {
284 List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); 288 logger.debug("doAnalysisEventsOut: qwd == null");
285 289 return;
286 DateFormat dateFormat = DateFormat.getDateInstance( 290 }
287 DateFormat.SHORT); 291
288 292 XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), doc);
289 double gaugeDatum = getCurrentGaugeDatum(); 293 List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>();
290 double factor = (gaugeDatum == 0d) ? 1d : 100d; 294
291 295 DateFormat dateFormat = DateFormat.getDateInstance(
292 series.add(qwd.getQ(), factor*(qwd.getW()-gaugeDatum)); 296 DateFormat.SHORT);
293 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( 297
294 dateFormat.format(qwd.getDate()), 298 double gaugeDatum = getCurrentGaugeDatum();
295 qwd.getQ(), 299 boolean atGauge = gaugeDatum != 0d;
296 factor*(qwd.getW()-gaugeDatum)); 300
297 textAnnos.add(anno); 301 double factor = atGauge ? 100d : 1d;
298 302
299 if (gaugeDatum == 0d) { 303 double w = factor*(qwd.getW()-gaugeDatum);
300 addAxisSeries(series, YAXIS.W.idx, visible); 304
301 } 305 series.add(qwd.getQ(), w);
302 else { 306
303 addAxisSeries(series, YAXIS.WCm.idx, visible); 307 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
304 } 308 dateFormat.format(qwd.getDate()),
305 if(visible && doc.parseShowPointLabel()) { 309 qwd.getQ(),
306 RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc); 310 w);
307 flysAnno.setTextAnnotations(textAnnos); 311 textAnnos.add(anno);
308 addAnnotations(flysAnno); 312
309 } 313 addAxisSeries(series, atGauge ? YAXIS.WCm.idx : YAXIS.W.idx, visible);
310 } 314
311 else { 315 if (visible && doc.parseShowPointLabel()) {
312 logger.debug("doAnalysisEventsOut: qwds == null"); 316 RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc);
317 flysAnno.setTextAnnotations(textAnnos);
318 addAnnotations(flysAnno);
313 } 319 }
314 } 320 }
315 321
316 322
317 /** Add reference event points to chart. */ 323 /** Add reference event points to chart. */

http://dive4elements.wald.intevation.org