Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WaterlevelFacet.java @ 1666:09c1292cf36d
Bugfix: #351 Modified determination of single values specified by min/max values and an interval.
flys-artifacts/trunk@2874 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 30 Sep 2011 14:29:26 +0000 |
parents | 8da5f5a9ed3c |
children | eb35570df0e8 |
rev | line source |
---|---|
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import org.apache.log4j.Logger; |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import de.intevation.artifacts.Artifact; |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import de.intevation.artifacts.CallContext; |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.artifactdatabase.state.DefaultFacet; |
1061
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
9 import de.intevation.artifactdatabase.state.Facet; |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.flys.artifacts.WINFOArtifact; |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
697
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
13 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 public class WaterlevelFacet extends DefaultFacet { |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 private static Logger logger = Logger.getLogger(WaterlevelFacet.class); |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 |
722
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
709
diff
changeset
|
19 protected ComputeType type; |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
709
diff
changeset
|
20 protected String stateID; |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
709
diff
changeset
|
21 protected String hash; |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 |
1136
8da5f5a9ed3c
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
23 |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 public WaterlevelFacet(int index, String name, String description) { |
722
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
709
diff
changeset
|
25 this(index, name, description, ComputeType.ADVANCE, null, null); |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 } |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 |
1136
8da5f5a9ed3c
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
28 |
1061
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
29 public WaterlevelFacet() { |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
30 } |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
31 |
1136
8da5f5a9ed3c
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
32 |
722
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
709
diff
changeset
|
33 public WaterlevelFacet( |
742
c09c9e05ecfa
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
722
diff
changeset
|
34 int index, |
c09c9e05ecfa
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
722
diff
changeset
|
35 String name, |
722
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
709
diff
changeset
|
36 String description, |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
709
diff
changeset
|
37 ComputeType type, |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
709
diff
changeset
|
38 String stateID, |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
709
diff
changeset
|
39 String hash |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
709
diff
changeset
|
40 |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
709
diff
changeset
|
41 ) { |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
709
diff
changeset
|
42 super(index, name, description); |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
709
diff
changeset
|
43 this.type = type; |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
709
diff
changeset
|
44 this.stateID = stateID; |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
709
diff
changeset
|
45 this.hash = hash; |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
709
diff
changeset
|
46 } |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 |
1136
8da5f5a9ed3c
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
48 |
8da5f5a9ed3c
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
49 /** |
8da5f5a9ed3c
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
50 * Get waterlevel data. |
8da5f5a9ed3c
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
51 * @return a WQKms at given index. |
8da5f5a9ed3c
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
52 */ |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 public Object getData(Artifact artifact, CallContext context) { |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 logger.debug("Get data for waterlevels at index: " + index); |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
705
diff
changeset
|
56 WINFOArtifact winfo = (WINFOArtifact)artifact; |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
705
diff
changeset
|
58 CalculationResult res = (CalculationResult) |
1117
ea80e652f033
Reordered some parameters in a FLYSArtifact method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1061
diff
changeset
|
59 winfo.compute(context, hash, stateID, type, false); |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
705
diff
changeset
|
60 |
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
705
diff
changeset
|
61 WQKms [] wqkms = (WQKms [])res.getData(); |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 return wqkms[index]; |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 } |
1061
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
65 |
1136
8da5f5a9ed3c
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
66 |
8da5f5a9ed3c
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
67 /** Copy deeply. */ |
8da5f5a9ed3c
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
68 @Override |
1061
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
69 public Facet deepCopy() { |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
70 WaterlevelFacet copy = new WaterlevelFacet(); |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
71 copy.set(this); |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
72 copy.type = type; |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
73 copy.stateID = stateID; |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
74 copy.hash = hash; |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
75 return copy; |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
76 } |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 } |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |