Mercurial > dive4elements > river
diff 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 |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesQFacet.java Mon Jan 23 11:06:06 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesQFacet.java Mon Jan 23 14:18:53 2012 +0000 @@ -13,6 +13,8 @@ import de.intevation.flys.jfree.FLYSAnnotation; import de.intevation.flys.jfree.StickyAxisAnnotation; +import de.intevation.flys.exports.DurationCurveGenerator; + /** * Facet to show Main Q Values. * TODO Join with W implementation. @@ -27,9 +29,9 @@ /** Trivial Constructor. */ public MainValuesQFacet(String name, String description, boolean atGauge) { this.description = description; - this.name = name; - this.index = 0; - this.isAtGauge = atGauge; + this.name = name; + this.index = 0; + this.isAtGauge = atGauge; } @@ -45,14 +47,26 @@ public Object getData(Artifact artifact, CallContext context) { MainValuesArtifact mvArtifact = (MainValuesArtifact) artifact; - List<NamedDouble> qs = mvArtifact.getMainValuesQ(isAtGauge); + List<NamedDouble> qs = mvArtifact.getMainValuesQ(isAtGauge); List<StickyAxisAnnotation> xy = new ArrayList<StickyAxisAnnotation>(); - for (NamedDouble q: qs) { - xy.add(new StickyAxisAnnotation( - q.getName(), - (float) q.getValue(), - StickyAxisAnnotation.SimpleAxis.X_AXIS)); + // Rather specific case, Q-Annotations at a maybe second yaxis. + if (this.name.equals(DURATION_MAINVALUES_Q)) { + for (NamedDouble q: qs) { + xy.add(new StickyAxisAnnotation( + q.getName(), + (float) q.getValue(), + StickyAxisAnnotation.SimpleAxis.Y_AXIS, + DurationCurveGenerator.YAXIS.Q.idx)); + } + } + else { + for (NamedDouble q: qs) { + xy.add(new StickyAxisAnnotation( + q.getName(), + (float) q.getValue(), + StickyAxisAnnotation.SimpleAxis.X_AXIS)); + } } return new FLYSAnnotation(description, xy);