Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ReferenceCurveState.java @ 5578:c0eca1287e0e
Use the layer name for the default riveraxis class
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 05 Apr 2013 12:52:21 +0200 |
parents | 23b4ff116015 |
children |
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; |
2283
d4330439be3a
Let reference curve calculation result in wwqq.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2277
diff
changeset
|
15 import de.intevation.flys.artifacts.model.WWQQ; |
2195
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
16 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
17 import java.util.List; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
18 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
19 import org.apache.log4j.Logger; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
20 |
2251
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2222
diff
changeset
|
21 |
2760
23b4ff116015
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2326
diff
changeset
|
22 /** State of WINFO in which reference curves can be produced. */ |
2170
90dfc25007f1
Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 public class ReferenceCurveState |
90dfc25007f1
Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 extends DefaultState |
2195
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
25 implements FacetTypes |
2170
90dfc25007f1
Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 { |
2259
0dcb8326be08
Add a not-yet-looked-at CSV facet for Reference Curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2251
diff
changeset
|
27 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
|
28 |
2760
23b4ff116015
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2326
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 |
2760
23b4ff116015
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2326
diff
changeset
|
33 |
2195
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
34 @Override |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
35 public Object computeAdvance( |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
36 FLYSArtifact artifact, |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
37 String hash, |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
38 CallContext context, |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
39 List<Facet> facets, |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
40 Object old |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
41 ) { |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
42 if (!(artifact instanceof WINFOArtifact)) { |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
43 return null; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
44 } |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
45 |
2259
0dcb8326be08
Add a not-yet-looked-at CSV facet for Reference Curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2251
diff
changeset
|
46 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
|
47 |
2195
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
48 WINFOArtifact winfo = (WINFOArtifact)artifact; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
49 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
50 CalculationResult res = old instanceof CalculationResult |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
51 ? (CalculationResult)old |
2326
c321b39b39ab
'Bezugslinienverfahren': Generate valid i18n names for datasets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2323
diff
changeset
|
52 : winfo.getReferenceCurveData(context); |
2195
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
53 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
54 if (facets == null) { |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
55 return res; |
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 |
2283
d4330439be3a
Let reference curve calculation result in wwqq.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2277
diff
changeset
|
58 WWQQ [] wws = (WWQQ [])res.getData(); |
2195
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
59 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
60 for (int i = 0; i < wws.length; ++i) { |
2307
51f530476e36
Better description for reference curve facets (seen in client).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2283
diff
changeset
|
61 String wwsName = wws[i].getName(); |
2251
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2222
diff
changeset
|
62 facets.add(new ReferenceCurveFacet(i, |
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2222
diff
changeset
|
63 REFERENCE_CURVE, |
2307
51f530476e36
Better description for reference curve facets (seen in client).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2283
diff
changeset
|
64 wwsName |
51f530476e36
Better description for reference curve facets (seen in client).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2283
diff
changeset
|
65 )); |
2277
3f3e4f94171b
Added generator for "Reduzierte Bezugslinie".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2259
diff
changeset
|
66 facets.add(new ReferenceCurveFacet(i, |
3f3e4f94171b
Added generator for "Reduzierte Bezugslinie".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2259
diff
changeset
|
67 REFERENCE_CURVE_NORMALIZED, |
2307
51f530476e36
Better description for reference curve facets (seen in client).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2283
diff
changeset
|
68 wwsName |
51f530476e36
Better description for reference curve facets (seen in client).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2283
diff
changeset
|
69 )); |
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 (wws.length > 0) { |
2310
ecb76933362f
Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2307
diff
changeset
|
73 logger.debug("Adding CSV and PDF data facet."); |
2259
0dcb8326be08
Add a not-yet-looked-at CSV facet for Reference Curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2251
diff
changeset
|
74 Facet csv = new DataFacet (CSV, "CSV data", ComputeType.ADVANCE, hash, id); |
2310
ecb76933362f
Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2307
diff
changeset
|
75 Facet pdf = new DataFacet (PDF, "PDF data", ComputeType.ADVANCE, hash, id); |
2259
0dcb8326be08
Add a not-yet-looked-at CSV facet for Reference Curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2251
diff
changeset
|
76 facets.add(csv); |
2310
ecb76933362f
Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2307
diff
changeset
|
77 facets.add(pdf); |
2195
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
78 } |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
79 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
80 if (res.getReport().hasProblems()) { |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
81 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
|
82 } |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
83 |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
84 return res; |
e14beb93a854
"Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2170
diff
changeset
|
85 } |
2170
90dfc25007f1
Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
86 } |
90dfc25007f1
Added transition/state stubs for "Bezugslinienverfahren".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
87 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |