Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java @ 3251:aeeb9192e395
W(t) chart point label rotation working
flys-artifacts/trunk@4884 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Fri, 06 Jul 2012 11:12:55 +0000 |
parents | 1dca41dba135 |
children | 9a4707ec7800 |
comparison
equal
deleted
inserted
replaced
3250:7613cfb037f5 | 3251:aeeb9192e395 |
---|---|
1 package de.intevation.flys.exports.fixings; | 1 package de.intevation.flys.exports.fixings; |
2 | 2 |
3 import de.intevation.artifactdatabase.state.ArtifactAndFacet; | 3 import de.intevation.artifactdatabase.state.ArtifactAndFacet; |
4 | |
5 import de.intevation.artifacts.ArtifactNamespaceContext; | 4 import de.intevation.artifacts.ArtifactNamespaceContext; |
6 import de.intevation.artifacts.CallContext; | 5 import de.intevation.artifacts.CallContext; |
7 | |
8 import de.intevation.artifacts.common.utils.XMLUtils; | 6 import de.intevation.artifacts.common.utils.XMLUtils; |
9 | |
10 import de.intevation.flys.artifacts.FLYSArtifact; | 7 import de.intevation.flys.artifacts.FLYSArtifact; |
11 | |
12 import de.intevation.flys.artifacts.model.DateRange; | 8 import de.intevation.flys.artifacts.model.DateRange; |
13 import de.intevation.flys.artifacts.model.FacetTypes; | 9 import de.intevation.flys.artifacts.model.FacetTypes; |
14 | |
15 import de.intevation.flys.artifacts.model.fixings.QWD; | 10 import de.intevation.flys.artifacts.model.fixings.QWD; |
16 | |
17 import de.intevation.flys.exports.TimeseriesChartGenerator; | 11 import de.intevation.flys.exports.TimeseriesChartGenerator; |
18 | |
19 import de.intevation.flys.jfree.CollisionFreeXYTextAnnotation; | 12 import de.intevation.flys.jfree.CollisionFreeXYTextAnnotation; |
20 import de.intevation.flys.jfree.FLYSAnnotation; | 13 import de.intevation.flys.jfree.FLYSAnnotation; |
21 import de.intevation.flys.jfree.StyledTimeSeries; | 14 import de.intevation.flys.jfree.StyledTimeSeries; |
22 | |
23 import de.intevation.flys.utils.FLYSUtils; | 15 import de.intevation.flys.utils.FLYSUtils; |
24 import de.intevation.flys.utils.ThemeUtil; | 16 import de.intevation.flys.utils.ThemeUtil; |
25 | 17 |
26 import java.awt.BasicStroke; | 18 import java.awt.BasicStroke; |
27 import java.awt.Color; | 19 import java.awt.Color; |
28 | |
29 import java.io.OutputStream; | 20 import java.io.OutputStream; |
30 | |
31 import java.util.ArrayList; | 21 import java.util.ArrayList; |
32 import java.util.HashMap; | 22 import java.util.HashMap; |
33 import java.util.List; | 23 import java.util.List; |
34 import java.util.Map; | 24 import java.util.Map; |
35 import java.util.Set; | 25 import java.util.Set; |
36 | 26 |
37 import javax.xml.xpath.XPathConstants; | 27 import javax.xml.xpath.XPathConstants; |
38 | 28 |
39 import org.apache.log4j.Logger; | 29 import org.apache.log4j.Logger; |
40 | |
41 import org.jfree.chart.JFreeChart; | 30 import org.jfree.chart.JFreeChart; |
42 | |
43 import org.jfree.chart.annotations.XYTextAnnotation; | 31 import org.jfree.chart.annotations.XYTextAnnotation; |
44 | |
45 import org.jfree.chart.plot.IntervalMarker; | 32 import org.jfree.chart.plot.IntervalMarker; |
46 import org.jfree.chart.plot.ValueMarker; | 33 import org.jfree.chart.plot.ValueMarker; |
47 | |
48 import org.jfree.chart.title.TextTitle; | 34 import org.jfree.chart.title.TextTitle; |
49 | |
50 import org.jfree.data.time.Day; | 35 import org.jfree.data.time.Day; |
51 import org.jfree.data.time.Month; | 36 import org.jfree.data.time.Month; |
52 import org.jfree.data.time.RegularTimePeriod; | 37 import org.jfree.data.time.RegularTimePeriod; |
53 import org.jfree.data.time.TimeSeries; | 38 import org.jfree.data.time.TimeSeries; |
54 import org.jfree.data.time.TimeSeriesCollection; | 39 import org.jfree.data.time.TimeSeriesCollection; |
55 | |
56 //import org.jfree.ui.TextAnchor; | |
57 | |
58 import org.w3c.dom.Document; | 40 import org.w3c.dom.Document; |
59 import org.w3c.dom.Element; | 41 import org.w3c.dom.Element; |
60 | 42 |
43 | |
61 /** | 44 /** |
45 * Generator for Delta W(t) charts. | |
62 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> | 46 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
63 */ | 47 */ |
64 public class FixDeltaWtGenerator | 48 public class FixDeltaWtGenerator |
65 extends TimeseriesChartGenerator | 49 extends TimeseriesChartGenerator |
66 implements FacetTypes | 50 implements FacetTypes |
159 return "NO TITLE FOR Y AXIS: " + pos; | 143 return "NO TITLE FOR Y AXIS: " + pos; |
160 } | 144 } |
161 } | 145 } |
162 | 146 |
163 | 147 |
148 @Override | |
164 public void doOut( | 149 public void doOut( |
165 ArtifactAndFacet artifactFacet, | 150 ArtifactAndFacet artifactFacet, |
166 Document theme, | 151 Document theme, |
167 boolean visible | 152 boolean visible |
168 ) { | 153 ) { |
336 //anno.setRotationAnchor(TextAnchor.CENTER_LEFT); | 321 //anno.setRotationAnchor(TextAnchor.CENTER_LEFT); |
337 textAnnos.add(anno); | 322 textAnnos.add(anno); |
338 logger.debug("annotation: " + x + "/" + qwd.getDeltaW()); | 323 logger.debug("annotation: " + x + "/" + qwd.getDeltaW()); |
339 } | 324 } |
340 | 325 |
341 FLYSAnnotation flysAnno = new FLYSAnnotation(null, null, null, theme); | 326 if(visible) { |
342 flysAnno.setTextAnnotations(textAnnos); | 327 FLYSAnnotation flysAnno = new FLYSAnnotation(null, null, null, theme); |
343 addAnnotations(flysAnno); | 328 flysAnno.setTextAnnotations(textAnnos); |
329 addAnnotations(flysAnno); | |
330 } | |
344 } | 331 } |
345 | 332 |
346 | 333 |
347 protected void doReferenceEventsOut( | 334 protected void doReferenceEventsOut( |
348 FLYSArtifact artifact, | 335 FLYSArtifact artifact, |
373 } | 360 } |
374 RegularTimePeriod rtp = new Day(qwds[i].getDate()); | 361 RegularTimePeriod rtp = new Day(qwds[i].getDate()); |
375 double value = qwds[i].getDeltaW(); | 362 double value = qwds[i].getDeltaW(); |
376 boolean interpolate = qwds[i].getInterpolated(); | 363 boolean interpolate = qwds[i].getInterpolated(); |
377 if (interpolate) { | 364 if (interpolate) { |
378 interpol.addOrUpdate(rtp, value); | 365 if(interpol.addOrUpdate(rtp, value) == null) { |
379 annoIdxMap.put( | 366 annoIdxMap.put( |
380 i, | 367 i, |
381 new int[]{1, idxInterpol++}); | 368 new int[]{1, idxInterpol}); |
369 idxInterpol++; | |
370 } | |
382 } | 371 } |
383 else { | 372 else { |
384 annoIdxMap.put( | 373 if(series.addOrUpdate(rtp, value) == null) { |
385 i, | 374 annoIdxMap.put( |
386 new int[]{0, idxRegular++}); | 375 i, |
387 series.addOrUpdate(rtp, value); | 376 new int[]{0, idxRegular}); |
377 idxRegular++; | |
378 } | |
388 } | 379 } |
389 } | 380 } |
390 tsc.addSeries(series); | 381 tsc.addSeries(series); |
391 tsc.addSeries(interpol); | 382 tsc.addSeries(interpol); |
392 | 383 |