Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/DifferenceCurveFacet.java @ 2013:9d5f339d83a3
#380 Validate the user selected DEM in the server.
flys-artifacts/trunk@3462 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 19 Dec 2011 10:01:17 +0000 |
parents | 8afd6a9bb244 |
children | 81312f84689a |
rev | line source |
---|---|
1643
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
3 import org.apache.log4j.Logger; |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 import de.intevation.artifacts.Artifact; |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 import de.intevation.artifacts.CallContext; |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.artifactdatabase.state.Facet; |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.flys.artifacts.WINFOArtifact; |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 /** |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 * Facet with the curve of a subtraction of two waterlevel-lines. |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 */ |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 public class DifferenceCurveFacet extends WaterlevelFacet { |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 private static Logger logger = Logger.getLogger(DifferenceCurveFacet.class); |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 |
1886
6f047a407f84
Removed dead ';' from empty bodies.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1691
diff
changeset
|
23 public DifferenceCurveFacet() { |
6f047a407f84
Removed dead ';' from empty bodies.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1691
diff
changeset
|
24 } |
1643
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 public DifferenceCurveFacet( |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 int index, |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 String name, |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 String description, |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 ComputeType type, |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 String stateID, |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 String hash |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 ) { |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 super(index, name, description, type, stateID, hash); |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 } |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 /** |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 * Get difference curve data. |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 * @return a WKms at given index. |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 */ |
1691
17648043429f
Cosmetics, docs, annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1646
diff
changeset
|
42 @Override |
1643
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 public Object getData(Artifact artifact, CallContext context) { |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 WINFOArtifact winfo = (WINFOArtifact)artifact; |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 CalculationResult res = (CalculationResult) |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 winfo.compute(context, hash, stateID, type, false); |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 WKms [] wkms = (WKms [])res.getData(); |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 WKms result = wkms[index]; |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 logger.debug("Got difference curve data (" + result.getName() |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 + ") at index: " + index); |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
54 |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 return result; |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
56 } |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
57 |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
59 /** Copy deeply. */ |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
60 @Override |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 public Facet deepCopy() { |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 WaterlevelFacet copy = new DifferenceCurveFacet(); |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 copy.set(this); |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
64 copy.type = type; |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
65 copy.stateID = stateID; |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
66 copy.hash = hash; |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
67 return copy; |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
68 } |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
69 } |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
70 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |