Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQFacet.java @ 4896:27d58b7b5edd
Builder: When looking for a statement in contexts, also search in macro definitions.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 29 Jan 2013 10:52:57 +0100 |
parents | 5a28312aee99 |
children |
rev | line source |
---|---|
1896
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
3 import de.intevation.artifacts.Artifact; |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 import de.intevation.artifacts.CallContext; |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 import de.intevation.artifactdatabase.state.DefaultFacet; |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.flys.artifacts.WQKmsInterpolArtifact; |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 /** |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 * Facet to show W|Q Values. |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 */ |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 public class WQFacet |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 extends DefaultFacet |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 implements FacetTypes { |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 /** Trivial Constructor. */ |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 public WQFacet(String description) { |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 this(STATIC_WQ, description); |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 } |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 /** |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 * A Facet with WQ data. |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 */ |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 public WQFacet(String name, String description) { |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 this.name = name; |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 this.description = description; |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 this.index = 0; |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 } |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 /** |
4311
5a28312aee99
Doc for WQFacet and Curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3585
diff
changeset
|
34 * Returns the data this facet provides at km given in context. |
1896
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 * |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 * @param artifact the owner artifact. |
4311
5a28312aee99
Doc for WQFacet and Curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3585
diff
changeset
|
37 * @param context the CallContext. |
1896
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 * |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 * @return the data. |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 */ |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 @Override |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 public Object getData(Artifact artifact, CallContext context) { |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 WQKmsInterpolArtifact interpolData = |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 (WQKmsInterpolArtifact) artifact; |
3585
c105b4466b4e
Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3317
diff
changeset
|
45 Double currentKm = (Double)context.getContextValue("currentKm"); |
c105b4466b4e
Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3317
diff
changeset
|
46 return interpolData.getWQAtKm(currentKm); |
1896
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 } |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 /** |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 * Create a deep copy of this Facet. |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 * @return a deep copy. |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 */ |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
54 @Override |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 public WQKmsFacet deepCopy() { |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
56 WQKmsFacet copy = new WQKmsFacet(description); |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
57 copy.set(this); |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 return copy; |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
59 } |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
60 } |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |