Mercurial > dive4elements > river
changeset 7527:0ee545a02204
Simplified code.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Wed, 06 Nov 2013 19:41:12 +0100 |
parents | a836adfaccc6 |
children | d828b659a593 |
files | artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java |
diffstat | 1 files changed, 36 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Wed Nov 06 19:18:50 2013 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Wed Nov 06 19:41:12 2013 +0100 @@ -275,41 +275,47 @@ } /** Add analysis event points to chart. */ - protected void doAnalysisEventsOut(ArtifactAndFacet aaf, ThemeDocument doc, boolean visible) { + protected void doAnalysisEventsOut( + ArtifactAndFacet aaf, + ThemeDocument doc, + boolean visible + ) { logger.debug("doAnalysisEventsOut"); QWD qwd = (QWD)aaf.getData(context); - if(qwd != null) { - XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), doc); - List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); - - DateFormat dateFormat = DateFormat.getDateInstance( - DateFormat.SHORT); - - double gaugeDatum = getCurrentGaugeDatum(); - double factor = (gaugeDatum == 0d) ? 1d : 100d; - series.add(qwd.getQ(), factor*(qwd.getW()-gaugeDatum)); - XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( - dateFormat.format(qwd.getDate()), - qwd.getQ(), - factor*(qwd.getW()-gaugeDatum)); - textAnnos.add(anno); + if (qwd == null) { + logger.debug("doAnalysisEventsOut: qwd == null"); + return; + } - if (gaugeDatum == 0d) { - addAxisSeries(series, YAXIS.W.idx, visible); - } - else { - addAxisSeries(series, YAXIS.WCm.idx, visible); - } - if(visible && doc.parseShowPointLabel()) { - RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc); - flysAnno.setTextAnnotations(textAnnos); - addAnnotations(flysAnno); - } - } - else { - logger.debug("doAnalysisEventsOut: qwds == null"); + XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), doc); + List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); + + DateFormat dateFormat = DateFormat.getDateInstance( + DateFormat.SHORT); + + double gaugeDatum = getCurrentGaugeDatum(); + boolean atGauge = gaugeDatum != 0d; + + double factor = atGauge ? 100d : 1d; + + double w = factor*(qwd.getW()-gaugeDatum); + + series.add(qwd.getQ(), w); + + XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( + dateFormat.format(qwd.getDate()), + qwd.getQ(), + w); + textAnnos.add(anno); + + addAxisSeries(series, atGauge ? YAXIS.WCm.idx : YAXIS.W.idx, visible); + + if (visible && doc.parseShowPointLabel()) { + RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc); + flysAnno.setTextAnnotations(textAnnos); + addAnnotations(flysAnno); } }