# HG changeset patch # User Christian Lins # Date 1347365288 0 # Node ID 7bc61f4ab26be2e54af7655915607ae838086500 # Parent e86cd517667873b0a72bc9be9bc9c37364971aa7 Fix for #837 flys-artifacts/trunk@5431 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r e86cd5176678 -r 7bc61f4ab26b flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Mon Sep 10 20:32:39 2012 +0000 +++ b/flys-artifacts/ChangeLog Tue Sep 11 12:08:08 2012 +0000 @@ -1,3 +1,10 @@ +2012-09-11 Christian Lins + + * doc/conf/second-themes.xml, + doc/conf/default-themes.xml, + src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java: + Fix for line text annotations in Delta W(t) charts (#837). + 2012-09-10 Christian Lins * src/main/java/de/intevation/flys/artifacts/states/GaugeTimerangeState.java: diff -r e86cd5176678 -r 7bc61f4ab26b flys-artifacts/doc/conf/default-themes.xml --- a/flys-artifacts/doc/conf/default-themes.xml Mon Sep 10 20:32:39 2012 +0000 +++ b/flys-artifacts/doc/conf/default-themes.xml Tue Sep 11 12:08:08 2012 +0000 @@ -1272,6 +1272,7 @@ display="Beschriftung anzeigen" default="false" hints="h" /> + @@ -1283,6 +1284,7 @@ display="Beschriftung anzeigen" default="false" hints="h" /> + @@ -1294,6 +1296,7 @@ display="Beschriftung anzeigen" default="false" hints="h" /> + @@ -1305,6 +1308,7 @@ display="Beschriftung anzeigen" default="false" hints="h" /> + diff -r e86cd5176678 -r 7bc61f4ab26b flys-artifacts/doc/conf/second-themes.xml --- a/flys-artifacts/doc/conf/second-themes.xml Mon Sep 10 20:32:39 2012 +0000 +++ b/flys-artifacts/doc/conf/second-themes.xml Tue Sep 11 12:08:08 2012 +0000 @@ -1275,6 +1275,7 @@ default="0, 128, 128" /> + @@ -1288,6 +1289,7 @@ default="128, 0, 255" /> + @@ -1301,6 +1303,7 @@ default="255, 128, 255" /> + @@ -1314,6 +1317,7 @@ default="255, 0, 0" /> + diff -r e86cd5176678 -r 7bc61f4ab26b flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java Mon Sep 10 20:32:39 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java Tue Sep 11 12:08:08 2012 +0000 @@ -1,5 +1,20 @@ package de.intevation.flys.exports.fixings; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.log4j.Logger; +import org.jfree.chart.annotations.XYTextAnnotation; +import org.jfree.data.time.Day; +import org.jfree.data.time.RegularTimePeriod; +import org.jfree.data.time.TimeSeries; +import org.jfree.data.time.TimeSeriesCollection; +import org.w3c.dom.Document; + import de.intevation.artifactdatabase.state.ArtifactAndFacet; import de.intevation.artifacts.CallContext; import de.intevation.flys.artifacts.FLYSArtifact; @@ -17,21 +32,6 @@ import de.intevation.flys.jfree.StyledValueMarker; import de.intevation.flys.utils.ThemeUtil; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.log4j.Logger; -import org.jfree.chart.annotations.XYTextAnnotation; -import org.jfree.data.time.Day; -import org.jfree.data.time.RegularTimePeriod; -import org.jfree.data.time.TimeSeries; -import org.jfree.data.time.TimeSeriesCollection; -import org.w3c.dom.Document; - /** * Generator for Delta W(t) charts. @@ -43,22 +43,22 @@ { /** Private logger. */ private static Logger logger = - Logger.getLogger(FixDeltaWtGenerator.class); + Logger.getLogger(FixDeltaWtGenerator.class); public static final String I18N_CHART_TITLE = - "chart.fix.deltawt.title"; + "chart.fix.deltawt.title"; public static final String I18N_CHART_SUBTITLE = - "chart.fix.deltawt.subtitle"; + "chart.fix.deltawt.subtitle"; public static final String I18N_XAXIS_LABEL = - "chart.fix.deltawt.xaxis.label"; + "chart.fix.deltawt.xaxis.label"; public static final String I18N_YAXIS_LABEL = - "chart.fix.deltawt.yaxis.label"; + "chart.fix.deltawt.yaxis.label"; public static final String I18N_YAXIS_SECOND_LABEL = - "chart.fix.deltawt.yaxis.second.label"; + "chart.fix.deltawt.yaxis.second.label"; public static enum YAXIS { @@ -103,7 +103,7 @@ I18N_CHART_TITLE, "", FixChartGenerator - .getCurrentKmFromRequest(request).doubleValue()); + .getCurrentKmFromRequest(request).doubleValue()); } @@ -145,10 +145,10 @@ @Override public void doOut( - ArtifactAndFacet artifactFacet, - Document theme, - boolean visible - ) { + ArtifactAndFacet artifactFacet, + Document theme, + boolean visible + ) { String name = artifactFacet.getFacetName(); logger.debug("FixDeltaWtGenerator.doOut: " + name); logger.debug("Theme description is: " + artifactFacet.getFacetDescription()); @@ -157,57 +157,57 @@ if (name.contains(FIX_SECTOR_AVERAGE_DWT)) { doSectorAverageOut( - (FLYSArtifact) artifactFacet.getArtifact(), - artifactFacet.getData(context), - artifactFacet.getFacetDescription(), - theme, - visible); + (FLYSArtifact) artifactFacet.getArtifact(), + artifactFacet.getData(context), + artifactFacet.getFacetDescription(), + theme, + visible); } else if (name.equals(FIX_REFERENCE_EVENTS_DWT)) { doReferenceEventsOut( - (FLYSArtifact) artifactFacet.getArtifact(), - artifactFacet.getData(context), - artifactFacet.getFacetDescription(), - theme, - visible); + (FLYSArtifact) artifactFacet.getArtifact(), + artifactFacet.getData(context), + artifactFacet.getFacetDescription(), + theme, + visible); } else if (name.equals(FIX_ANALYSIS_EVENTS_DWT)) { doAnalysisEventsOut( - (FLYSArtifact) artifactFacet.getArtifact(), - artifactFacet.getData(context), - artifactFacet.getFacetDescription(), - theme, - visible); + (FLYSArtifact) artifactFacet.getArtifact(), + artifactFacet.getData(context), + artifactFacet.getFacetDescription(), + theme, + visible); } else if (name.equals(FIX_DEVIATION_DWT)) { doDeviationOut( - (FLYSArtifact) artifactFacet.getArtifact(), - artifactFacet.getData(context), - artifactFacet.getFacetDescription(), - theme, - visible); + (FLYSArtifact) artifactFacet.getArtifact(), + artifactFacet.getData(context), + artifactFacet.getFacetDescription(), + theme, + visible); } else if (name.equals(FIX_ANALYSIS_PERIODS_DWT)) { doAnalysisPeriodsOut( - (FLYSArtifact) artifactFacet.getArtifact(), - artifactFacet.getData(context), - artifactFacet.getFacetDescription(), - theme, - visible); + (FLYSArtifact) artifactFacet.getArtifact(), + artifactFacet.getData(context), + artifactFacet.getFacetDescription(), + theme, + visible); } else { - logger.warn("doOut(): unknown facet name: " + name); - return; + logger.warn("doOut(): unknown facet name: " + name); + return; } } protected void doSectorAverageOut( - FLYSArtifact artifact, - Object data, - String desc, - Document theme, - boolean visible) + FLYSArtifact artifact, + Object data, + String desc, + Document theme, + boolean visible) { logger.debug("doSectorAverageOut(): description = " + desc); @@ -231,19 +231,29 @@ tsc.addSeries(series); addAxisDataset(tsc, 0, visible); - Map annoIdxMap = new HashMap(); - annoIdxMap.put (0, new int[]{0,0}); - doQWDTextAnnotations(annoIdxMap, tsc, qwd.qwd, theme, visible); + + if (visible && ThemeUtil.parseShowLineLabel(theme)) { + List textAnnos = new ArrayList(); + XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( + "\u0394 W(t) [cm] " + (float)Math.round(qwd.qwd.getDeltaW() * 10000) / 10000, + tsc.getXValue(0, 0), + qwd.qwd.getDeltaW()); + textAnnos.add(anno); + + FLYSAnnotation flysAnno = new FLYSAnnotation(null, null, null, theme); + flysAnno.setTextAnnotations(textAnnos); + addAnnotations(flysAnno); + } } protected void doAnalysisEventsOut( - FLYSArtifact artifact, - Object data, - String desc, - Document theme, - boolean visible - ) { + FLYSArtifact artifact, + Object data, + String desc, + Document theme, + boolean visible + ) { logger.debug("doAnalysisEventsOut: desc = " + desc); QWD qwd = (QWD) data; @@ -317,9 +327,9 @@ int[] idxs = entry.getValue(); double x = tsc.getXValue(idxs[0], idxs[1]); XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( - qwd.getQ() + " m\u00B3/s", - x, - qwd.getDeltaW()); + qwd.getQ() + " m\u00B3/s", + x, + qwd.getDeltaW()); textAnnos.add(anno); } @@ -330,12 +340,12 @@ protected void doReferenceEventsOut( - FLYSArtifact artifact, - Object data, - String desc, - Document theme, - boolean visible - ) { + FLYSArtifact artifact, + Object data, + String desc, + Document theme, + boolean visible + ) { logger.debug("doReferenceEventsOut: desc = " + desc); QWD qwd = (QWD) data; @@ -344,12 +354,12 @@ protected void doDeviationOut( - FLYSArtifact artifact, - Object data, - String desc, - Document theme, - boolean visible - ) { + FLYSArtifact artifact, + Object data, + String desc, + Document theme, + boolean visible + ) { logger.debug("doDeviationOut: desc = " + desc); if (data == null || !visible) { @@ -366,12 +376,12 @@ protected void doAnalysisPeriodsOut( - FLYSArtifact artifact, - Object data, - String desc, - Document theme, - boolean visible - ) { + FLYSArtifact artifact, + Object data, + String desc, + Document theme, + boolean visible + ) { logger.debug("doHistoricalDischargeDifferenceOut: desc = " + desc); DateRange[] ranges = (DateRange[]) data; @@ -383,8 +393,8 @@ RegularTimePeriod start = new Day(ranges[i].getFrom()); RegularTimePeriod end = new Day(ranges[i].getTo()); StyledDomainMarker marker = - new StyledDomainMarker(start.getMiddleMillisecond(), - end.getMiddleMillisecond(), theme); + new StyledDomainMarker(start.getMiddleMillisecond(), + end.getMiddleMillisecond(), theme); marker.useSecondColor(i % 2 == 0); domainMarker.add(marker); }