# HG changeset patch # User Felix Wolfsteller # Date 1341326396 0 # Node ID 1aec30e75bcb9ec02ac101c11ac6b12bfd21f169 # Parent 7e5460d08eb0242a4e6d1c91dcd43b571cb5d774 Very basic point labels in DeltaWt-diagrams. flys-artifacts/trunk@4865 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 7e5460d08eb0 -r 1aec30e75bcb flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Tue Jul 03 13:21:11 2012 +0000 +++ b/flys-artifacts/ChangeLog Tue Jul 03 14:39:56 2012 +0000 @@ -1,3 +1,8 @@ +2012-07-03 Felix Wolfsteller + + * src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java: + Very basic, unstyled, always-on labels of points in DeltaWt-Diagrams. + 2012-07-03 Sascha L. Teichmann * src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java: diff -r 7e5460d08eb0 -r 1aec30e75bcb 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 Tue Jul 03 13:21:11 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java Tue Jul 03 14:39:56 2012 +0000 @@ -231,12 +231,15 @@ return; } RegularTimePeriod rtp = new Day(qwd.getDate()); - double value = qwd.getDeltaW(); + double value = qwd.getDeltaW(); series.add(rtp, value); tsc.addSeries(series); addAxisDataset(tsc, 0, visible); addAttribute(desc, "outline"); + Map annoIdxMap = new HashMap(); + annoIdxMap.put (0, new int[]{0,0}); + doQWDTextAnnotations(annoIdxMap, tsc, new QWD[]{qwd}, theme, visible); } @@ -277,12 +280,15 @@ boolean interpolate = qwds[i].getInterpolated(); if (interpolate) { interpol.add(rtp, value); + annoIdxMap.put( + i, + new int[]{1, i}); } else { + series.add(rtp, value); annoIdxMap.put( i, - new int[]{series.getItemCount(), tsc.getSeriesCount()}); - series.add(rtp, value); + new int[]{0, i}); } } tsc.addSeries(series); @@ -295,19 +301,23 @@ } + /** + * @param annoIdxMap map of index in qwds to series/dataitem indices in tsc. + */ protected void doQWDTextAnnotations(Map annoIdxMap, - TimeSeriesCollection tsc, QWD[] qwds, Document theme, boolean visible) { + TimeSeriesCollection tsc, QWD[] qwds, Document theme, + boolean visible) { List textAnnos = new ArrayList(); Set> entries = annoIdxMap.entrySet(); for(Map.Entry entry : entries) { QWD qwd = qwds[entry.getKey()]; int[] idxs = entry.getValue(); double x = tsc.getXValue(idxs[0], idxs[1]); - XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( - qwd.getQ() + " m\u00B3/s", - x, - qwd.getDeltaW()); - textAnnos.add(anno); + XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( + qwd.getQ() + " m\u00B3/s", + x, + qwd.getDeltaW()); + textAnnos.add(anno); logger.debug("annotation: " + x + "/" + qwd.getDeltaW()); } @@ -347,11 +357,14 @@ boolean interpolate = qwds[i].getInterpolated(); if (interpolate) { interpol.addOrUpdate(rtp, value); + annoIdxMap.put( + i, + new int[]{1, i}); } else { annoIdxMap.put( i, - new int[]{series.getItemCount(), tsc.getSeriesCount()}); + new int[]{0, i}); series.addOrUpdate(rtp, value); } @@ -363,7 +376,7 @@ addAttribute(desc + "interpol", "interpolate"); addAttribute(desc, "outline"); - //doQWDTextAnnotations(annoIdxMap, tsc, qwds, theme, visible); + doQWDTextAnnotations(annoIdxMap, tsc, qwds, theme, visible); }