Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesQFacet.java @ 2163:105097966111
Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
flys-artifacts/trunk@3750 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 23 Jan 2012 14:18:53 +0000 |
parents | c68f4f227c09 |
children | 26f2e7e500dd |
comparison
equal
deleted
inserted
replaced
2162:df70f14af981 | 2163:105097966111 |
---|---|
11 import de.intevation.flys.artifacts.MainValuesArtifact; | 11 import de.intevation.flys.artifacts.MainValuesArtifact; |
12 import de.intevation.flys.artifacts.model.FacetTypes; | 12 import de.intevation.flys.artifacts.model.FacetTypes; |
13 import de.intevation.flys.jfree.FLYSAnnotation; | 13 import de.intevation.flys.jfree.FLYSAnnotation; |
14 import de.intevation.flys.jfree.StickyAxisAnnotation; | 14 import de.intevation.flys.jfree.StickyAxisAnnotation; |
15 | 15 |
16 import de.intevation.flys.exports.DurationCurveGenerator; | |
17 | |
16 /** | 18 /** |
17 * Facet to show Main Q Values. | 19 * Facet to show Main Q Values. |
18 * TODO Join with W implementation. | 20 * TODO Join with W implementation. |
19 */ | 21 */ |
20 public class MainValuesQFacet | 22 public class MainValuesQFacet |
25 protected boolean isAtGauge; | 27 protected boolean isAtGauge; |
26 | 28 |
27 /** Trivial Constructor. */ | 29 /** Trivial Constructor. */ |
28 public MainValuesQFacet(String name, String description, boolean atGauge) { | 30 public MainValuesQFacet(String name, String description, boolean atGauge) { |
29 this.description = description; | 31 this.description = description; |
30 this.name = name; | 32 this.name = name; |
31 this.index = 0; | 33 this.index = 0; |
32 this.isAtGauge = atGauge; | 34 this.isAtGauge = atGauge; |
33 } | 35 } |
34 | 36 |
35 | 37 |
36 /** | 38 /** |
37 * Returns the data this facet requires. | 39 * Returns the data this facet requires. |
43 */ | 45 */ |
44 @Override | 46 @Override |
45 public Object getData(Artifact artifact, CallContext context) { | 47 public Object getData(Artifact artifact, CallContext context) { |
46 MainValuesArtifact mvArtifact = (MainValuesArtifact) artifact; | 48 MainValuesArtifact mvArtifact = (MainValuesArtifact) artifact; |
47 | 49 |
48 List<NamedDouble> qs = mvArtifact.getMainValuesQ(isAtGauge); | 50 List<NamedDouble> qs = mvArtifact.getMainValuesQ(isAtGauge); |
49 List<StickyAxisAnnotation> xy = new ArrayList<StickyAxisAnnotation>(); | 51 List<StickyAxisAnnotation> xy = new ArrayList<StickyAxisAnnotation>(); |
50 | 52 |
51 for (NamedDouble q: qs) { | 53 // Rather specific case, Q-Annotations at a maybe second yaxis. |
52 xy.add(new StickyAxisAnnotation( | 54 if (this.name.equals(DURATION_MAINVALUES_Q)) { |
53 q.getName(), | 55 for (NamedDouble q: qs) { |
54 (float) q.getValue(), | 56 xy.add(new StickyAxisAnnotation( |
55 StickyAxisAnnotation.SimpleAxis.X_AXIS)); | 57 q.getName(), |
58 (float) q.getValue(), | |
59 StickyAxisAnnotation.SimpleAxis.Y_AXIS, | |
60 DurationCurveGenerator.YAXIS.Q.idx)); | |
61 } | |
62 } | |
63 else { | |
64 for (NamedDouble q: qs) { | |
65 xy.add(new StickyAxisAnnotation( | |
66 q.getName(), | |
67 (float) q.getValue(), | |
68 StickyAxisAnnotation.SimpleAxis.X_AXIS)); | |
69 } | |
56 } | 70 } |
57 | 71 |
58 return new FLYSAnnotation(description, xy); | 72 return new FLYSAnnotation(description, xy); |
59 } | 73 } |
60 | 74 |