comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQFacet.java @ 3786:4adc35aa655c

merged flys-artifacts/2.9.1
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:47 +0200
parents c105b4466b4e
children 5a28312aee99
comparison
equal deleted inserted replaced
3719:e82acd5c86f7 3786:4adc35aa655c
1 package de.intevation.flys.artifacts.model;
2
3 import de.intevation.artifacts.Artifact;
4 import de.intevation.artifacts.CallContext;
5
6 import de.intevation.artifactdatabase.state.DefaultFacet;
7
8 import de.intevation.flys.artifacts.WQKmsInterpolArtifact;
9
10 /**
11 * Facet to show W|Q Values.
12 */
13 public class WQFacet
14 extends DefaultFacet
15 implements FacetTypes {
16
17 /** Trivial Constructor. */
18 public WQFacet(String description) {
19 this(STATIC_WQ, description);
20 }
21
22
23 /**
24 * A Facet with WQ data.
25 */
26 public WQFacet(String name, String description) {
27 this.name = name;
28 this.description = description;
29 this.index = 0;
30 }
31
32
33 /**
34 * Returns the data this facet requires.
35 *
36 * @param artifact the owner artifact.
37 * @param context the CallContext (ignored).
38 *
39 * @return the data.
40 */
41 @Override
42 public Object getData(Artifact artifact, CallContext context) {
43 WQKmsInterpolArtifact interpolData =
44 (WQKmsInterpolArtifact) artifact;
45 Double currentKm = (Double)context.getContextValue("currentKm");
46 return interpolData.getWQAtKm(currentKm);
47 }
48
49
50 /**
51 * Create a deep copy of this Facet.
52 * @return a deep copy.
53 */
54 @Override
55 public WQKmsFacet deepCopy() {
56 WQKmsFacet copy = new WQKmsFacet(description);
57 copy.set(this);
58 return copy;
59 }
60 }
61 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org