Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ReferenceCurveFacet.java @ 2637:baaf7d125c43
Issue 560.
Enabled GetFeatureInfo-request for WSPLGEN-layer.
flys-artifacts/trunk@4264 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 18 Apr 2012 11:35:14 +0000 |
parents | dce0cc856357 |
children | ba15eb120a02 |
rev | line source |
---|---|
2196
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
2256
dd93a8e1377a
First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2221
diff
changeset
|
3 import java.util.List; |
2407
dce0cc856357
'Bezugslinien': Added axis labels matching the displayed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2405
diff
changeset
|
4 import java.util.Collections; |
2256
dd93a8e1377a
First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2221
diff
changeset
|
5 |
2196
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 import de.intevation.artifactdatabase.state.Facet; |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.artifacts.Artifact; |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.artifacts.CallContext; |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.flys.artifacts.FLYSArtifact; |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 import org.apache.log4j.Logger; |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 |
2221
fdeb6d61c24c
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2198
diff
changeset
|
17 /** Facet for W-over-Ws. */ |
2196
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 public class ReferenceCurveFacet |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 extends DataFacet |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 { |
2407
dce0cc856357
'Bezugslinien': Added axis labels matching the displayed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2405
diff
changeset
|
21 private static Logger log = Logger.getLogger(ReferenceCurveFacet.class); |
2256
dd93a8e1377a
First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2221
diff
changeset
|
22 |
2407
dce0cc856357
'Bezugslinien': Added axis labels matching the displayed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2405
diff
changeset
|
23 public static final String CONTEXT_KEY = "reference.curve.axis.scale"; |
2196
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 public ReferenceCurveFacet() { |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 } |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 public ReferenceCurveFacet(int index, String name, String description) { |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 super(index, name, description, ComputeType.ADVANCE, null, null); |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 } |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 public ReferenceCurveFacet( |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 int index, |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 String name, |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 String description, |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 ComputeType type, |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 String stateID, |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 String hash |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 ) { |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 super(index, name, description, type, hash, stateID); |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 } |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 public Object getData(Artifact artifact, CallContext context) { |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 if (log.isDebugEnabled()) { |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 log.debug("Get data for reference curve at index: " + index + |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 " /stateId: " + stateId); |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 } |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 |
2283
d4330439be3a
Let reference curve calculation result in wwqq.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2256
diff
changeset
|
50 return getWWQQ(artifact, context); |
2256
dd93a8e1377a
First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2221
diff
changeset
|
51 } |
dd93a8e1377a
First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2221
diff
changeset
|
52 |
2283
d4330439be3a
Let reference curve calculation result in wwqq.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2256
diff
changeset
|
53 protected WWQQ getWWQQ(Artifact artifact, CallContext context) { |
2196
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 FLYSArtifact winfo = (FLYSArtifact)artifact; |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 CalculationResult res = (CalculationResult) |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 winfo.compute(context, hash, stateId, type, false); |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 |
2283
d4330439be3a
Let reference curve calculation result in wwqq.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2256
diff
changeset
|
59 return ((WWQQ [])res.getData())[index]; |
2196
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 } |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 @Override |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 public void set(Facet other) { |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 super.set(other); |
2405
f008c3335a77
Towards fixe of flys/issue495.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2402
diff
changeset
|
65 ReferenceCurveFacet o = (ReferenceCurveFacet)other; |
f008c3335a77
Towards fixe of flys/issue495.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2402
diff
changeset
|
66 type = o.type; |
f008c3335a77
Towards fixe of flys/issue495.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2402
diff
changeset
|
67 hash = o.hash; |
f008c3335a77
Towards fixe of flys/issue495.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2402
diff
changeset
|
68 stateId = o.stateId; |
2196
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 } |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
70 |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
71 /** Copy deeply. */ |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
72 @Override |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
73 public Facet deepCopy() { |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
74 ReferenceCurveFacet copy = new ReferenceCurveFacet(); |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
75 copy.set(this); |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
76 return copy; |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
77 } |
2256
dd93a8e1377a
First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2221
diff
changeset
|
78 |
dd93a8e1377a
First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2221
diff
changeset
|
79 @Override |
2405
f008c3335a77
Towards fixe of flys/issue495.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2402
diff
changeset
|
80 public List getDataProviderKeys(Artifact art, CallContext context) { |
2407
dce0cc856357
'Bezugslinien': Added axis labels matching the displayed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2405
diff
changeset
|
81 |
2405
f008c3335a77
Towards fixe of flys/issue495.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2402
diff
changeset
|
82 // compute / get data |
2407
dce0cc856357
'Bezugslinien': Added axis labels matching the displayed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2405
diff
changeset
|
83 Object obj = context.getContextValue(CONTEXT_KEY); |
2405
f008c3335a77
Towards fixe of flys/issue495.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2402
diff
changeset
|
84 |
f008c3335a77
Towards fixe of flys/issue495.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2402
diff
changeset
|
85 if (!(obj instanceof WWAxisTypes)) { |
f008c3335a77
Towards fixe of flys/issue495.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2402
diff
changeset
|
86 obj = new WWAxisTypes(getWWQQ(art, context)); |
2407
dce0cc856357
'Bezugslinien': Added axis labels matching the displayed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2405
diff
changeset
|
87 context.putContextValue(CONTEXT_KEY, obj); |
2405
f008c3335a77
Towards fixe of flys/issue495.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2402
diff
changeset
|
88 } |
f008c3335a77
Towards fixe of flys/issue495.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2402
diff
changeset
|
89 else { |
f008c3335a77
Towards fixe of flys/issue495.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2402
diff
changeset
|
90 ((WWAxisTypes)obj).classify(getWWQQ(art, context)); |
f008c3335a77
Towards fixe of flys/issue495.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2402
diff
changeset
|
91 } |
2256
dd93a8e1377a
First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2221
diff
changeset
|
92 |
2407
dce0cc856357
'Bezugslinien': Added axis labels matching the displayed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2405
diff
changeset
|
93 return Collections.emptyList(); |
2256
dd93a8e1377a
First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2221
diff
changeset
|
94 } |
2196
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
95 } |
5f3726f31f00
"Bezugslinienverfahren": Added facet classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
96 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |