Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java @ 3278:c27c4e06dd87
Re-add HYK rendering code to CrossSectionGenerator
flys-artifacts/trunk@4924 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Wed, 11 Jul 2012 09:24:07 +0000 |
parents | 1dca41dba135 |
children | 66f539df4e8b |
comparison
equal
deleted
inserted
replaced
3277:fc0d613e5073 | 3278:c27c4e06dd87 |
---|---|
1 package de.intevation.flys.exports; | 1 package de.intevation.flys.exports; |
2 | |
3 import de.intevation.artifactdatabase.state.ArtifactAndFacet; | |
4 import de.intevation.flys.jfree.Bounds; | |
5 import de.intevation.flys.jfree.CollisionFreeXYTextAnnotation; | |
6 import de.intevation.flys.jfree.DoubleBounds; | |
7 import de.intevation.flys.jfree.FLYSAnnotation; | |
8 import de.intevation.flys.jfree.StyledTimeSeries; | |
9 import de.intevation.flys.jfree.TimeBounds; | |
2 | 10 |
3 import java.awt.Color; | 11 import java.awt.Color; |
4 import java.awt.Font; | 12 import java.awt.Font; |
5 import java.awt.Paint; | |
6 import java.util.ArrayList; | 13 import java.util.ArrayList; |
7 import java.util.Date; | 14 import java.util.Date; |
8 import java.util.HashMap; | 15 import java.util.HashMap; |
9 import java.util.List; | 16 import java.util.List; |
10 import java.util.Map; | 17 import java.util.Map; |
26 import org.jfree.ui.Layer; | 33 import org.jfree.ui.Layer; |
27 import org.json.JSONArray; | 34 import org.json.JSONArray; |
28 import org.json.JSONException; | 35 import org.json.JSONException; |
29 import org.w3c.dom.Document; | 36 import org.w3c.dom.Document; |
30 | 37 |
31 import de.intevation.artifactdatabase.state.ArtifactAndFacet; | |
32 import de.intevation.flys.jfree.Bounds; | |
33 import de.intevation.flys.jfree.CollisionFreeXYTextAnnotation; | |
34 import de.intevation.flys.jfree.DoubleBounds; | |
35 import de.intevation.flys.jfree.FLYSAnnotation; | |
36 import de.intevation.flys.jfree.StyledTimeSeries; | |
37 import de.intevation.flys.jfree.TimeBounds; | |
38 | |
39 /** | 38 /** |
40 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 39 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
41 */ | 40 */ |
42 public abstract class TimeseriesChartGenerator extends ChartGenerator { | 41 public abstract class TimeseriesChartGenerator extends ChartGenerator { |
43 | 42 |
75 } | 74 } |
76 | 75 |
77 | 76 |
78 @Override | 77 @Override |
79 public XYDataset[] getDatasets() { | 78 public XYDataset[] getDatasets() { |
80 return (XYDataset[]) | 79 return datasets.toArray(new XYDataset[datasets.size()]); |
81 datasets.toArray(new XYDataset[datasets.size()]); | |
82 } | 80 } |
83 | 81 |
84 | 82 |
85 @Override | 83 @Override |
86 public boolean isEmpty() { | 84 public boolean isEmpty() { |
429 if (user != null) { | 427 if (user != null) { |
430 long min = total.getLower().longValue(); | 428 long min = total.getLower().longValue(); |
431 long max = total.getUpper().longValue(); | 429 long max = total.getUpper().longValue(); |
432 long diff = max > min ? max - min : min - max; | 430 long diff = max > min ? max - min : min - max; |
433 | 431 |
434 long newMin = (long) Math.round(min + user.getLower().doubleValue() * diff); | 432 long newMin = Math.round(min + user.getLower().doubleValue() * diff); |
435 long newMax = (long) Math.round(min + user.getUpper().doubleValue() * diff); | 433 long newMax = Math.round(min + user.getUpper().doubleValue() * diff); |
436 | 434 |
437 TimeBounds newBounds = new TimeBounds(newMin, newMax); | 435 TimeBounds newBounds = new TimeBounds(newMin, newMax); |
438 | 436 |
439 logger.debug(" Zoom axis to: " + newBounds); | 437 logger.debug(" Zoom axis to: " + newBounds); |
440 | 438 |
562 | 560 |
563 // Do not generate second legend entry. (null was passed for the aand before). | 561 // Do not generate second legend entry. (null was passed for the aand before). |
564 doAnnotations(annotations, null, theme, visible); | 562 doAnnotations(annotations, null, theme, visible); |
565 | 563 |
566 addAxisDataset(tsc, axisIndex, visible); | 564 addAxisDataset(tsc, axisIndex, visible); |
567 } | |
568 | |
569 /** Get color for hyk zones by their type (which is the name). */ | |
570 public Paint colorForHYKZone(String zoneName) { | |
571 if (zoneName.startsWith("R")) { | |
572 // Brownish. | |
573 return new Color(153, 60, 0); | |
574 } | |
575 else if (zoneName.startsWith("V")) { | |
576 // Greenish. | |
577 return new Color(0, 255, 0); | |
578 } | |
579 else if (zoneName.startsWith("B")) { | |
580 // Grayish. | |
581 return new Color(128, 128, 128); | |
582 } | |
583 else if (zoneName.startsWith("H")) { | |
584 // Blueish. | |
585 return new Color(0, 0, 255); | |
586 } | |
587 else { | |
588 // Default. | |
589 logger.debug("Unknown zone type found."); | |
590 return new Color(255, 0, 0); | |
591 } | |
592 } | 565 } |
593 | 566 |
594 public void addDomainAxisMarker(XYPlot plot) { | 567 public void addDomainAxisMarker(XYPlot plot) { |
595 logger.debug("domainmarkers: " + domainMarker.size()); | 568 logger.debug("domainmarkers: " + domainMarker.size()); |
596 for (Marker marker: domainMarker) { | 569 for (Marker marker: domainMarker) { |