Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WaterlevelFacet.java @ 2018:3f1a63da2cf4
Prepare ability to paint areas in longitudinal section diagrams, too (next to CrossSection diagrams).
flys-artifacts/trunk@3473 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 20 Dec 2011 06:37:41 +0000 |
parents | e384d78ff78b |
children | 9d79f6ceefca |
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 |
2017
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1721
diff
changeset
|
15 |
1721
eb35570df0e8
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1136
diff
changeset
|
16 /** |
eb35570df0e8
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1136
diff
changeset
|
17 * Facet of a Waterlevel (WQKms). |
eb35570df0e8
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1136
diff
changeset
|
18 */ |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 public class WaterlevelFacet extends DefaultFacet { |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 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
|
22 |
722
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
709
diff
changeset
|
23 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
|
24 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
|
25 protected String hash; |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 |
1136
8da5f5a9ed3c
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
27 |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 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
|
29 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
|
30 } |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
1136
8da5f5a9ed3c
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
32 |
1061
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
33 public WaterlevelFacet() { |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
34 } |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
35 |
1136
8da5f5a9ed3c
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
36 |
722
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
709
diff
changeset
|
37 public WaterlevelFacet( |
742
c09c9e05ecfa
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
722
diff
changeset
|
38 int index, |
c09c9e05ecfa
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
722
diff
changeset
|
39 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
|
40 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
|
41 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
|
42 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
|
43 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
|
44 |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
709
diff
changeset
|
45 ) { |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
709
diff
changeset
|
46 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
|
47 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
|
48 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
|
49 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
|
50 } |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 |
1136
8da5f5a9ed3c
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
52 |
8da5f5a9ed3c
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
53 /** |
8da5f5a9ed3c
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
54 * Get waterlevel data. |
8da5f5a9ed3c
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
55 * @return a WQKms at given index. |
8da5f5a9ed3c
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
56 */ |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 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
|
58 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
|
59 |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
705
diff
changeset
|
60 WINFOArtifact winfo = (WINFOArtifact)artifact; |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
705
diff
changeset
|
62 CalculationResult res = (CalculationResult) |
1117
ea80e652f033
Reordered some parameters in a FLYSArtifact method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1061
diff
changeset
|
63 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
|
64 |
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
705
diff
changeset
|
65 WQKms [] wqkms = (WQKms [])res.getData(); |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 return wqkms[index]; |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 } |
1061
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
69 |
1136
8da5f5a9ed3c
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
70 |
8da5f5a9ed3c
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
71 /** Copy deeply. */ |
8da5f5a9ed3c
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
72 @Override |
1061
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
73 public Facet deepCopy() { |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
74 WaterlevelFacet copy = new WaterlevelFacet(); |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
75 copy.set(this); |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
76 copy.type = type; |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
77 copy.stateID = stateID; |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
78 copy.hash = hash; |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
79 return copy; |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
80 } |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 } |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |