Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDeltaWtGenerator.java @ 6874:d9dfa52f69eb
FixA Delta W(t): Add 30 seconds to colliding dates to avoid them vanishing from the diagrams.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Tue, 20 Aug 2013 11:20:25 +0200 |
parents | 9bd2d5c40f17 |
children | 1b35b2ddfc28 |
comparison
equal
deleted
inserted
replaced
6873:6848c5c8fc23 | 6874:d9dfa52f69eb |
---|---|
39 import org.jfree.data.time.FixedMillisecond; | 39 import org.jfree.data.time.FixedMillisecond; |
40 import org.jfree.data.time.TimeSeries; | 40 import org.jfree.data.time.TimeSeries; |
41 import org.jfree.data.time.TimeSeriesCollection; | 41 import org.jfree.data.time.TimeSeriesCollection; |
42 import org.w3c.dom.Document; | 42 import org.w3c.dom.Document; |
43 | 43 |
44 import gnu.trove.TLongHashSet; | |
45 | |
44 | 46 |
45 /** | 47 /** |
46 * Generator for Delta W(t) charts. | 48 * Generator for Delta W(t) charts. |
47 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> | 49 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
48 */ | 50 */ |
77 idx = c; | 79 idx = c; |
78 } | 80 } |
79 } | 81 } |
80 | 82 |
81 | 83 |
82 private D4EArtifact artifact = null; | 84 private D4EArtifact artifact; |
85 | |
86 // Used to make the dates collision free. | |
87 private TLongHashSet uniqueDates = new TLongHashSet(); | |
83 | 88 |
84 | 89 |
85 @Override | 90 @Override |
86 protected YAxisWalker getYAxisWalker() { | 91 protected YAxisWalker getYAxisWalker() { |
87 return new YAxisWalker() { | 92 return new YAxisWalker() { |
245 theme); | 250 theme); |
246 domainMarker.add(marker); | 251 domainMarker.add(marker); |
247 } | 252 } |
248 } | 253 } |
249 | 254 |
255 private long uniqueDate(long date) { | |
256 return uniqueDates.add(date) | |
257 ? date | |
258 : uniqueDate(date+30L*1000L); // add 30secs. | |
259 } | |
260 | |
250 | 261 |
251 protected void doSectorAverageOut( | 262 protected void doSectorAverageOut( |
252 D4EArtifact artifact, | 263 D4EArtifact artifact, |
253 Object data, | 264 Object data, |
254 String desc, | 265 String desc, |
321 | 332 |
322 Map<Integer, int[]> annoIdxMap = new HashMap<Integer, int[]>(); | 333 Map<Integer, int[]> annoIdxMap = new HashMap<Integer, int[]>(); |
323 | 334 |
324 int idxInterpol = 0; | 335 int idxInterpol = 0; |
325 int idxRegular = 0; | 336 int idxRegular = 0; |
326 RegularTimePeriod rtp = new FixedMillisecond(qwd.getDate()); | 337 long time = uniqueDate(qwd.getDate().getTime()); |
338 RegularTimePeriod rtp = new FixedMillisecond(time); | |
327 double value = qwd.getDeltaW(); | 339 double value = qwd.getDeltaW(); |
328 boolean interpolate = qwd.getInterpolated(); | 340 boolean interpolate = qwd.getInterpolated(); |
329 if (interpolate) { | 341 if (interpolate) { |
330 if(interpol.addOrUpdate(rtp, value) == null) { | 342 if(interpol.addOrUpdate(rtp, value) == null) { |
331 annoIdxMap.put( | 343 annoIdxMap.put( |