Mercurial > dive4elements > river
changeset 3234:1aec30e75bcb
Very basic point labels in DeltaWt-diagrams.
flys-artifacts/trunk@4865 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 03 Jul 2012 14:39:56 +0000 |
parents | 7e5460d08eb0 |
children | 07231dcd5755 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java |
diffstat | 2 files changed, 29 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- 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 <felix.wolfsteller@intevation.de> + + * 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 <sascha.teichmann@intevation.de> * src/main/java/de/intevation/flys/artifacts/WINFOArtifact.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<Integer, int[]> annoIdxMap = new HashMap<Integer, int[]>(); + 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<Integer, int[]> annoIdxMap, - TimeSeriesCollection tsc, QWD[] qwds, Document theme, boolean visible) { + TimeSeriesCollection tsc, QWD[] qwds, Document theme, + boolean visible) { List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); Set<Map.Entry<Integer, int[]>> entries = annoIdxMap.entrySet(); for(Map.Entry<Integer, int[]> 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); }