comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/DifferenceCurveFacet.java @ 3814:8083f6384023

merged flys-artifacts/pre2.6-2012-01-04
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:56 +0200
parents 8afd6a9bb244
children 81312f84689a
comparison
equal deleted inserted replaced
1491:2a00f4849738 3814:8083f6384023
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 */
18 public class DifferenceCurveFacet extends WaterlevelFacet {
19
20 private static Logger logger = Logger.getLogger(DifferenceCurveFacet.class);
21
22
23 public DifferenceCurveFacet() {
24 }
25
26 public DifferenceCurveFacet(
27 int index,
28 String name,
29 String description,
30 ComputeType type,
31 String stateID,
32 String hash
33
34 ) {
35 super(index, name, description, type, stateID, hash);
36 }
37
38 /**
39 * Get difference curve data.
40 * @return a WKms at given index.
41 */
42 @Override
43 public Object getData(Artifact artifact, CallContext context) {
44 WINFOArtifact winfo = (WINFOArtifact)artifact;
45
46 CalculationResult res = (CalculationResult)
47 winfo.compute(context, hash, stateID, type, false);
48
49 WKms [] wkms = (WKms [])res.getData();
50
51 WKms result = wkms[index];
52 logger.debug("Got difference curve data (" + result.getName()
53 + ") at index: " + index);
54
55 return result;
56 }
57
58
59 /** Copy deeply. */
60 @Override
61 public Facet deepCopy() {
62 WaterlevelFacet copy = new DifferenceCurveFacet();
63 copy.set(this);
64 copy.type = type;
65 copy.stateID = stateID;
66 copy.hash = hash;
67 return copy;
68 }
69 }
70 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org