Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java @ 7542:db780379ea82
issue1585: Part 2/2 of patch from Sascha Teichmann to define datapoint shapes.
Minor fix by me.
author | sascha.teichmann@intevation.de |
---|---|
date | Fri, 08 Nov 2013 11:58:55 +0100 |
parents | 0ee545a02204 |
children | 4dbbdf0c8b2c |
comparison
equal
deleted
inserted
replaced
7541:d20a26e96ef1 | 7542:db780379ea82 |
---|---|
56 import org.dive4elements.river.jfree.StyledXYSeries; | 56 import org.dive4elements.river.jfree.StyledXYSeries; |
57 import org.dive4elements.river.model.Gauge; | 57 import org.dive4elements.river.model.Gauge; |
58 import org.dive4elements.river.model.River; | 58 import org.dive4elements.river.model.River; |
59 import org.dive4elements.river.themes.ThemeDocument; | 59 import org.dive4elements.river.themes.ThemeDocument; |
60 import org.dive4elements.river.utils.RiverUtils; | 60 import org.dive4elements.river.utils.RiverUtils; |
61 import org.dive4elements.river.java2d.ShapeUtils; | |
61 | 62 |
62 /** | 63 /** |
63 * Generator for WQ fixing charts. | 64 * Generator for WQ fixing charts. |
64 * @author <a href="mailto:christian.lins@intevation.de">Christian Lins</a> | 65 * @author <a href="mailto:christian.lins@intevation.de">Christian Lins</a> |
65 */ | 66 */ |
287 if (qwd == null) { | 288 if (qwd == null) { |
288 logger.debug("doAnalysisEventsOut: qwd == null"); | 289 logger.debug("doAnalysisEventsOut: qwd == null"); |
289 return; | 290 return; |
290 } | 291 } |
291 | 292 |
292 XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), doc); | |
293 List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); | |
294 | |
295 DateFormat dateFormat = DateFormat.getDateInstance( | |
296 DateFormat.SHORT); | |
297 | |
298 double gaugeDatum = getCurrentGaugeDatum(); | 293 double gaugeDatum = getCurrentGaugeDatum(); |
299 boolean atGauge = gaugeDatum != 0d; | 294 boolean atGauge = gaugeDatum != 0d; |
300 | 295 |
301 double factor = atGauge ? 100d : 1d; | 296 double factor = atGauge ? 100d : 1d; |
302 | 297 |
303 double w = factor*(qwd.getW()-gaugeDatum); | 298 double w = factor*(qwd.getW()-gaugeDatum); |
304 | 299 |
300 XYSeries series = new StyledXYSeries( | |
301 aaf.getFacetDescription(), | |
302 doc, | |
303 qwd.getInterpolated() | |
304 ? ShapeUtils.INTERPOLATED_SHAPE | |
305 : ShapeUtils.MEASURED_SHAPE); | |
306 | |
305 series.add(qwd.getQ(), w); | 307 series.add(qwd.getQ(), w); |
306 | 308 |
307 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( | |
308 dateFormat.format(qwd.getDate()), | |
309 qwd.getQ(), | |
310 w); | |
311 textAnnos.add(anno); | |
312 | |
313 addAxisSeries(series, atGauge ? YAXIS.WCm.idx : YAXIS.W.idx, visible); | 309 addAxisSeries(series, atGauge ? YAXIS.WCm.idx : YAXIS.W.idx, visible); |
314 | 310 |
315 if (visible && doc.parseShowPointLabel()) { | 311 if (visible && doc.parseShowPointLabel()) { |
312 | |
313 List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); | |
314 | |
315 DateFormat dateFormat = DateFormat.getDateInstance( | |
316 DateFormat.SHORT); | |
317 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( | |
318 dateFormat.format(qwd.getDate()), | |
319 qwd.getQ(), | |
320 w); | |
321 textAnnos.add(anno); | |
322 | |
316 RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc); | 323 RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc); |
317 flysAnno.setTextAnnotations(textAnnos); | 324 flysAnno.setTextAnnotations(textAnnos); |
318 addAnnotations(flysAnno); | 325 addAnnotations(flysAnno); |
319 } | 326 } |
320 } | 327 } |
328 if (qwd == null) { | 335 if (qwd == null) { |
329 logger.debug("doReferenceEventsOut: qwds == null"); | 336 logger.debug("doReferenceEventsOut: qwds == null"); |
330 return; | 337 return; |
331 } | 338 } |
332 | 339 |
333 XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), false, true, doc); | 340 XYSeries series = new StyledXYSeries( |
334 List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); | 341 aaf.getFacetDescription(), |
335 | 342 false, true, doc, |
336 DateFormat dateFormat = DateFormat.getDateInstance( | 343 qwd.getInterpolated() |
344 ? ShapeUtils.INTERPOLATED_SHAPE | |
345 : ShapeUtils.MEASURED_SHAPE); | |
346 | |
347 double gaugeDatum = getCurrentGaugeDatum(); | |
348 | |
349 boolean atGauge = gaugeDatum != 0d; | |
350 | |
351 double factor = atGauge ? 100d : 1d; | |
352 double w = factor*(qwd.getW()-gaugeDatum); | |
353 | |
354 series.add(qwd.getQ(), w, false); | |
355 | |
356 if (visible && doc.parseShowPointLabel()) { | |
357 DateFormat dateFormat = DateFormat.getDateInstance( | |
337 DateFormat.SHORT); | 358 DateFormat.SHORT); |
338 | 359 |
339 double gaugeDatum = getCurrentGaugeDatum(); | 360 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( |
340 double factor = (gaugeDatum == 0d) ? 1d : 100d; | |
341 | |
342 series.add(qwd.getQ(), factor*(qwd.getW()-gaugeDatum), false); | |
343 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( | |
344 dateFormat.format(qwd.getDate()), | 361 dateFormat.format(qwd.getDate()), |
345 qwd.getQ(), | 362 qwd.getQ(), |
346 factor*(qwd.getW()-gaugeDatum)); | 363 w); |
347 textAnnos.add(anno); | 364 |
348 | 365 List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); |
349 if(visible && doc.parseShowPointLabel()) { | 366 textAnnos.add(anno); |
350 RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc); | 367 RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc); |
351 flysAnno.setTextAnnotations(textAnnos); | 368 flysAnno.setTextAnnotations(textAnnos); |
352 addAnnotations(flysAnno); | 369 addAnnotations(flysAnno); |
353 } | 370 } |
354 | 371 |
355 if (gaugeDatum == 0d) { | 372 addAxisSeries(series, atGauge ? YAXIS.WCm.idx : YAXIS.W.idx, visible); |
356 addAxisSeries(series, YAXIS.W.idx, visible); | |
357 } | |
358 else { | |
359 addAxisSeries(series, YAXIS.WCm.idx, visible); | |
360 } | |
361 } | 373 } |
362 | 374 |
363 | 375 |
364 private void addPointFromWQKms(WQKms wqkms, | 376 private void addPointFromWQKms(WQKms wqkms, |
365 String title, | 377 String title, |