Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesWFacet.java @ 1957:3b08b8aacfb0
Fix flys/issue423, do not interpolate main values at gauge.
flys-artifacts/trunk@3357 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 06 Dec 2011 08:26:24 +0000 |
parents | f6a190f6aaff |
children | c68f4f227c09 |
comparison
equal
deleted
inserted
replaced
1956:a5f87f8dbe57 | 1957:3b08b8aacfb0 |
---|---|
20 */ | 20 */ |
21 public class MainValuesWFacet | 21 public class MainValuesWFacet |
22 extends DefaultFacet | 22 extends DefaultFacet |
23 implements FacetTypes { | 23 implements FacetTypes { |
24 | 24 |
25 /** Do we want MainValues at Gauge (not interpolated)? */ | |
26 protected boolean isAtGauge; | |
27 | |
25 /** Trivial Constructor. */ | 28 /** Trivial Constructor. */ |
26 public MainValuesWFacet(String name, String description) { | 29 public MainValuesWFacet(String name, String description, boolean atGauge) { |
27 this.description = description; | 30 this.description = description; |
28 this.name = name; | 31 this.name = name; |
29 index = 0; | 32 this.index = 0; |
33 this.isAtGauge = atGauge; | |
30 } | 34 } |
31 | 35 |
32 | 36 |
33 /** | 37 /** |
34 * Returns the data this facet requires. | 38 * Returns the data this facet requires. |
40 */ | 44 */ |
41 @Override | 45 @Override |
42 public Object getData(Artifact artifact, CallContext context) { | 46 public Object getData(Artifact artifact, CallContext context) { |
43 MainValuesArtifact mvArtifact = (MainValuesArtifact) artifact; | 47 MainValuesArtifact mvArtifact = (MainValuesArtifact) artifact; |
44 | 48 |
45 List<NamedDouble> ws = mvArtifact.getMainValuesW(); | 49 List<NamedDouble> ws = mvArtifact.getMainValuesW(isAtGauge); |
46 List<XYTextAnnotation> xy = new ArrayList<XYTextAnnotation>(); | 50 List<XYTextAnnotation> xy = new ArrayList<XYTextAnnotation>(); |
47 | 51 |
48 for (NamedDouble w: ws) { | 52 for (NamedDouble w: ws) { |
49 xy.add(new StickyAxisAnnotation( | 53 xy.add(new StickyAxisAnnotation( |
50 w.getName(), | 54 w.getName(), |
51 (float) w.getValue(), | 55 (float) w.getValue(), |
52 StickyAxisAnnotation.SimpleAxis.Y_AXIS)); | 56 StickyAxisAnnotation.SimpleAxis.Y_AXIS)); |
53 | |
54 } | 57 } |
55 | 58 |
56 return new FLYSAnnotation(description, xy); | 59 return new FLYSAnnotation(description, xy); |
57 } | 60 } |
58 | 61 |
61 * Create a deep copy of this Facet. | 64 * Create a deep copy of this Facet. |
62 * @return a deep copy. | 65 * @return a deep copy. |
63 */ | 66 */ |
64 @Override | 67 @Override |
65 public MainValuesWFacet deepCopy() { | 68 public MainValuesWFacet deepCopy() { |
66 MainValuesWFacet copy = new MainValuesWFacet(this.name, description); | 69 MainValuesWFacet copy = new MainValuesWFacet(this.name, |
70 description, this.isAtGauge); | |
67 copy.set(this); | 71 copy.set(this); |
68 return copy; | 72 return copy; |
69 } | 73 } |
70 } | 74 } |
71 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 75 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |