annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ReferenceCurveState.java @ 2273:7b8d59436be3

Set proper bounds for date axes in the chart info document; tell the transformation matrix which type it is (date/number). flys-artifacts/trunk@3930 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 06 Feb 2012 14:37:30 +0000
parents 0dcb8326be08
children 3f3e4f94171b
rev   line source
2170
90dfc25007f1 Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.states;
90dfc25007f1 Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
3 import de.intevation.artifactdatabase.state.Facet;
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
4
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
5 import de.intevation.artifacts.CallContext;
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
6
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
7 import de.intevation.flys.artifacts.FLYSArtifact;
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
8 import de.intevation.flys.artifacts.WINFOArtifact;
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
9
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
10 import de.intevation.flys.artifacts.model.CalculationResult;
2259
0dcb8326be08 Add a not-yet-looked-at CSV facet for Reference Curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2251
diff changeset
11 import de.intevation.flys.artifacts.model.DataFacet;
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
12 import de.intevation.flys.artifacts.model.FacetTypes;
2222
606f4fd7f815 Add more-or-less dummy Facet in ReferenceCurveState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2195
diff changeset
13 import de.intevation.flys.artifacts.model.ReferenceCurveFacet;
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
14 import de.intevation.flys.artifacts.model.ReportFacet;
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
15 import de.intevation.flys.artifacts.model.WW;
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
16
2251
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2222
diff changeset
17 import de.intevation.flys.artifacts.resources.Resources;
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2222
diff changeset
18
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
19 import java.util.List;
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
20
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
21 import org.apache.log4j.Logger;
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
22
2251
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2222
diff changeset
23
2170
90dfc25007f1 Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24 public class ReferenceCurveState
90dfc25007f1 Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25 extends DefaultState
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
26 implements FacetTypes
2170
90dfc25007f1 Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27 {
2259
0dcb8326be08 Add a not-yet-looked-at CSV facet for Reference Curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2251
diff changeset
28 private static Logger logger = Logger.getLogger(ReferenceCurveState.class);
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
29
2170
90dfc25007f1 Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 public ReferenceCurveState() {
90dfc25007f1 Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 }
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
32
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
33 @Override
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
34 public Object computeAdvance(
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
35 FLYSArtifact artifact,
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
36 String hash,
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
37 CallContext context,
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
38 List<Facet> facets,
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
39 Object old
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
40 ) {
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
41 if (!(artifact instanceof WINFOArtifact)) {
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
42 return null;
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
43 }
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
44
2259
0dcb8326be08 Add a not-yet-looked-at CSV facet for Reference Curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2251
diff changeset
45 String id = getID();
0dcb8326be08 Add a not-yet-looked-at CSV facet for Reference Curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2251
diff changeset
46
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
47 WINFOArtifact winfo = (WINFOArtifact)artifact;
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
48
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
49 CalculationResult res = old instanceof CalculationResult
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
50 ? (CalculationResult)old
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
51 : winfo.getReferenceCurveData();
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
52
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
53 if (facets == null) {
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
54 return res;
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
55 }
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
56
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
57 WW [] wws = (WW [])res.getData();
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
58
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
59 for (int i = 0; i < wws.length; ++i) {
2251
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2222
diff changeset
60 facets.add(new ReferenceCurveFacet(i,
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2222
diff changeset
61 REFERENCE_CURVE,
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2222
diff changeset
62 Resources.getMsg(context.getMeta(), REFERENCE_CURVE, REFERENCE_CURVE)));
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
63 }
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
64
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
65 if (wws.length > 0) {
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
66 // TODO: Add CSV/PDF facets.
2259
0dcb8326be08 Add a not-yet-looked-at CSV facet for Reference Curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2251
diff changeset
67 logger.debug("Adding CSV data facet.");
0dcb8326be08 Add a not-yet-looked-at CSV facet for Reference Curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2251
diff changeset
68 Facet csv = new DataFacet (CSV, "CSV data", ComputeType.ADVANCE, hash, id);
0dcb8326be08 Add a not-yet-looked-at CSV facet for Reference Curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2251
diff changeset
69 facets.add(csv);
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
70 }
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
71
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
72 if (res.getReport().hasProblems()) {
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
73 facets.add(new ReportFacet(ComputeType.ADVANCE, hash, id));
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
74 }
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
75
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
76 return res;
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2170
diff changeset
77 }
2170
90dfc25007f1 Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
78 }
90dfc25007f1 Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
79 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org