comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/DifferenceCurveFacet.java @ 2424:092e519ff461

merged flys-artifacts/2.6.1
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:26 +0200
parents 81312f84689a
children 5642a83420f2
comparison
equal deleted inserted replaced
2392:8112ec686a9a 2424:092e519ff461
1 package de.intevation.flys.artifacts.model;
2
3 import org.apache.log4j.Logger;
4
5 import de.intevation.artifacts.Artifact;
6 import de.intevation.artifacts.CallContext;
7
8 import de.intevation.artifactdatabase.state.Facet;
9
10 import de.intevation.flys.artifacts.WINFOArtifact;
11
12 import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
13
14
15 /**
16 * Facet with the curve of a subtraction of two waterlevel-lines.
17 * TODO inherit directly from DataFacet? Check whether this Facet is obsolete.
18 */
19 public class DifferenceCurveFacet extends WaterlevelFacet {
20
21 private static Logger logger = Logger.getLogger(DifferenceCurveFacet.class);
22
23
24 public DifferenceCurveFacet() {
25 }
26
27 public DifferenceCurveFacet(
28 int index,
29 String name,
30 String description,
31 ComputeType type,
32 String stateID,
33 String hash
34
35 ) {
36 super(index, name, description, type, stateID, hash);
37 }
38
39 /**
40 * Get difference curve data.
41 * @return a WKms at given index.
42 */
43 @Override
44 public Object getData(Artifact artifact, CallContext context) {
45 WINFOArtifact winfo = (WINFOArtifact)artifact;
46
47 CalculationResult res = (CalculationResult)
48 winfo.compute(context, hash, stateId, type, false);
49
50 WKms [] wkms = (WKms [])res.getData();
51
52 WKms result = wkms[index];
53 logger.debug("Got difference curve data (" + result.getName()
54 + ") at index: " + index);
55
56 return result;
57 }
58
59
60 /** Copy deeply. */
61 @Override
62 public Facet deepCopy() {
63 WaterlevelFacet copy = new DifferenceCurveFacet();
64 copy.set(this);
65 copy.type = type;
66 copy.stateId = stateId;
67 copy.hash = hash;
68 return copy;
69 }
70 }
71 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org