annotate artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelState.java @ 9425:3f49835a00c3

Extended CrossSectionFacet so it may fetch different data from within the artifact result. Also allows to have acces to the potentially already computed artifact result via its normal computation cache.
author gernotbelger
date Fri, 17 Aug 2018 15:31:02 +0200
parents 5e38e2924c07
children
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4412
diff changeset
9 package org.dive4elements.river.artifacts.states;
688
dc3613c4daf6 Moved Waterlevel state into the correct package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
6510
1e6bd2831280 artifacts: Desktop-FLYS conform official line messages in error reports.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6501
diff changeset
11 import java.util.Date;
3883
f858028dde5f Manual points (work in progress)
Christian Lins <christian.lins@intevation.de>
parents: 2618
diff changeset
12 import java.util.List;
f858028dde5f Manual points (work in progress)
Christian Lins <christian.lins@intevation.de>
parents: 2618
diff changeset
13
f858028dde5f Manual points (work in progress)
Christian Lins <christian.lins@intevation.de>
parents: 2618
diff changeset
14 import org.apache.log4j.Logger;
f858028dde5f Manual points (work in progress)
Christian Lins <christian.lins@intevation.de>
parents: 2618
diff changeset
15
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4412
diff changeset
16 import org.dive4elements.artifactdatabase.state.Facet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4412
diff changeset
17 import org.dive4elements.artifacts.CallContext;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4412
diff changeset
18 import org.dive4elements.river.artifacts.ChartArtifact;
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
19 import org.dive4elements.river.artifacts.D4EArtifact;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4412
diff changeset
20 import org.dive4elements.river.artifacts.WINFOArtifact;
6501
7cb247824ed1 Amtl. Linien: Added report if an official line was found in report.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
21 import org.dive4elements.river.artifacts.model.Calculation;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4412
diff changeset
22 import org.dive4elements.river.artifacts.model.CalculationResult;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4412
diff changeset
23 import org.dive4elements.river.artifacts.model.CrossSectionWaterLineFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4412
diff changeset
24 import org.dive4elements.river.artifacts.model.DataFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4412
diff changeset
25 import org.dive4elements.river.artifacts.model.EmptyFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4412
diff changeset
26 import org.dive4elements.river.artifacts.model.FacetTypes;
6501
7cb247824ed1 Amtl. Linien: Added report if an official line was found in report.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
27 import org.dive4elements.river.artifacts.model.OfficialLineFinder;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4412
diff changeset
28 import org.dive4elements.river.artifacts.model.ReportFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4412
diff changeset
29 import org.dive4elements.river.artifacts.model.WQKms;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4412
diff changeset
30 import org.dive4elements.river.artifacts.model.WaterlevelFacet;
6501
7cb247824ed1 Amtl. Linien: Added report if an official line was found in report.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
31 import org.dive4elements.river.artifacts.resources.Resources;
5865
73da40528cf2 River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
32 import org.dive4elements.river.utils.RiverUtils;
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2176
diff changeset
33
4412
1b4aaa7dbd07 WaterevelState: Doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3883
diff changeset
34 /** State in which a waterlevel has been calculated. */
692
22e4bffbe240 Generated facets for each output aspect.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 689
diff changeset
35 public class WaterlevelState
22e4bffbe240 Generated facets for each output aspect.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 689
diff changeset
36 extends DefaultState
22e4bffbe240 Generated facets for each output aspect.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 689
diff changeset
37 implements FacetTypes
22e4bffbe240 Generated facets for each output aspect.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 689
diff changeset
38 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6554
diff changeset
39 /** The log that is used in this state. */
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6554
diff changeset
40 private static Logger log = Logger.getLogger(WaterlevelState.class);
688
dc3613c4daf6 Moved Waterlevel state into the correct package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41
dc3613c4daf6 Moved Waterlevel state into the correct package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42
1770
e8a98eee816d Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1740
diff changeset
43 /**
e8a98eee816d Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1740
diff changeset
44 * From this state can only be continued trivially.
e8a98eee816d Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1740
diff changeset
45 */
688
dc3613c4daf6 Moved Waterlevel state into the correct package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 @Override
927
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
47 protected String getUIProvider() {
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
48 return "continue";
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
49 }
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
50
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
51
2123
907322e269e3 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2017
diff changeset
52 /**
907322e269e3 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2017
diff changeset
53 * Compute result or returned object from cache, create facets.
9425
3f49835a00c3 Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents: 8856
diff changeset
54 * @param feed
2123
907322e269e3 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2017
diff changeset
55 * @param old Object that was cached.
907322e269e3 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2017
diff changeset
56 */
9425
3f49835a00c3 Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents: 8856
diff changeset
57 private Object compute(
1140
96d7842e80ee Cosmetics, refactored, resolved todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1138
diff changeset
58 WINFOArtifact winfo,
1664
71d5abde92f2 Bugfix: #176 and #349 Create proper titles for W and Q waterlevel facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
59 CallContext cc,
9425
3f49835a00c3 Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents: 8856
diff changeset
60 ComputeType type,
1140
96d7842e80ee Cosmetics, refactored, resolved todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1138
diff changeset
61 String hash,
96d7842e80ee Cosmetics, refactored, resolved todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1138
diff changeset
62 List<Facet> facets,
96d7842e80ee Cosmetics, refactored, resolved todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1138
diff changeset
63 Object old
1138
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
64 ) {
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
65 String id = getID();
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
66
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
67 CalculationResult res = old instanceof CalculationResult
2123
907322e269e3 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2017
diff changeset
68 ? (CalculationResult) old
1138
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
69 : winfo.getWaterlevelData();
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
70
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
71 if (facets == null) {
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
72 return res;
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
73 }
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
74
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6554
diff changeset
75 boolean debug = log.isDebugEnabled();
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2176
diff changeset
76
2123
907322e269e3 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2017
diff changeset
77 WQKms [] wqkms = (WQKms []) res.getData();
1138
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
78
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
79 for (int i = 0; i < wqkms.length; i++) {
2123
907322e269e3 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2017
diff changeset
80 String name = wqkms[i].getName();
1138
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
81
5865
73da40528cf2 River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
82 String nameW = RiverUtils.createWspWTitle(winfo, cc, name);
73da40528cf2 River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
83 String nameQ = RiverUtils.createWspQTitle(winfo, cc, name);
1138
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
84
2618
3a93bbbe2ec7 Fix for 'W free' validation and theme names.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2573
diff changeset
85 // Hotfix for theme names. Themes with the same name cause problems
3a93bbbe2ec7 Fix for 'W free' validation and theme names.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2573
diff changeset
86 // aggregating chart legend items.
3a93bbbe2ec7 Fix for 'W free' validation and theme names.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2573
diff changeset
87 if (i > 0 && name.equals(wqkms[i - 1].getName())) {
3a93bbbe2ec7 Fix for 'W free' validation and theme names.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2573
diff changeset
88 nameW += "; Q=" + wqkms[i].get(0, new double[3])[1];
3a93bbbe2ec7 Fix for 'W free' validation and theme names.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2573
diff changeset
89 nameQ += " = " + wqkms[i].get(0, new double[3])[1];
3a93bbbe2ec7 Fix for 'W free' validation and theme names.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2573
diff changeset
90 }
3a93bbbe2ec7 Fix for 'W free' validation and theme names.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2573
diff changeset
91
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2176
diff changeset
92 if (debug) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6554
diff changeset
93 log.debug("Create facet: " + nameW);
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6554
diff changeset
94 log.debug("Create facet: " + nameQ);
2195
e14beb93a854 "Bezugslinenverfahren": Added stub loop for creating facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2176
diff changeset
95 }
1138
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
96
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
97 Facet w = new WaterlevelFacet(
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
98 i, LONGITUDINAL_W, nameW, ComputeType.ADVANCE, id, hash);
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
99 Facet q = new WaterlevelFacet(
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
100 i, LONGITUDINAL_Q, nameQ, ComputeType.ADVANCE, id, hash);
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
101
9425
3f49835a00c3 Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents: 8856
diff changeset
102 facets.add(new CrossSectionWaterLineFacet(i, nameW, type, hash, getID(), Integer.valueOf(i)));
1802
26d7077e42d2 Corrected CrossSection diagram/out to include one facet per computed waterlevel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1770
diff changeset
103
1138
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
104 facets.add(w);
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
105 facets.add(q);
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
106 }
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
107
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
108 if (wqkms.length > 0) {
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
109 Facet wst = new DataFacet(
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
110 WST, "WST data", ComputeType.ADVANCE, hash, id);
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
111 Facet csv = new DataFacet(
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
112 CSV, "CSV data", ComputeType.ADVANCE, hash, id);
2176
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2154
diff changeset
113 Facet pdf = new DataFacet(
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2154
diff changeset
114 PDF, "PDF data", ComputeType.ADVANCE, hash, id);
1138
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
115
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
116 facets.add(wst);
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
117 facets.add(csv);
2176
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2154
diff changeset
118 facets.add(pdf);
1138
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
119 }
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
120
6501
7cb247824ed1 Amtl. Linien: Added report if an official line was found in report.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
121 Calculation report = res.getReport();
7cb247824ed1 Amtl. Linien: Added report if an official line was found in report.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
122
7cb247824ed1 Amtl. Linien: Added report if an official line was found in report.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
123 List<OfficialLineFinder.ValueRange> ols =
7cb247824ed1 Amtl. Linien: Added report if an official line was found in report.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
124 OfficialLineFinder.findOfficialLines(winfo);
7cb247824ed1 Amtl. Linien: Added report if an official line was found in report.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
125
7cb247824ed1 Amtl. Linien: Added report if an official line was found in report.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
126 if (!ols.isEmpty()) {
7cb247824ed1 Amtl. Linien: Added report if an official line was found in report.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
127 for (OfficialLineFinder.ValueRange ol: ols) {
7cb247824ed1 Amtl. Linien: Added report if an official line was found in report.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
128 report.addProblem(Resources.format(
7cb247824ed1 Amtl. Linien: Added report if an official line was found in report.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
129 cc.getMeta(),
7cb247824ed1 Amtl. Linien: Added report if an official line was found in report.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
130 "official.line.found",
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
131 "Found official line for {0} from year {1,date,yyyy} "
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
132 + "from {2}.",
6510
1e6bd2831280 artifacts: Desktop-FLYS conform official line messages in error reports.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6501
diff changeset
133 ol.getName(), nn(ol.getDate()), nn(ol.getSource())));
6501
7cb247824ed1 Amtl. Linien: Added report if an official line was found in report.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
134 }
7cb247824ed1 Amtl. Linien: Added report if an official line was found in report.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
135 }
7cb247824ed1 Amtl. Linien: Added report if an official line was found in report.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
136
7cb247824ed1 Amtl. Linien: Added report if an official line was found in report.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
137 if (report.hasProblems()) {
1138
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
138 facets.add(new ReportFacet(ComputeType.ADVANCE, hash, id));
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
139 }
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
140
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
141 return res;
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
142 }
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
143
6554
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6510
diff changeset
144 /** Returns empty String if argument is null, argument itself otherwise. */
6510
1e6bd2831280 artifacts: Desktop-FLYS conform official line messages in error reports.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6501
diff changeset
145 private static final String nn(String s) {
1e6bd2831280 artifacts: Desktop-FLYS conform official line messages in error reports.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6501
diff changeset
146 return s != null ? s : "";
1e6bd2831280 artifacts: Desktop-FLYS conform official line messages in error reports.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6501
diff changeset
147 }
1e6bd2831280 artifacts: Desktop-FLYS conform official line messages in error reports.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6501
diff changeset
148
1e6bd2831280 artifacts: Desktop-FLYS conform official line messages in error reports.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6501
diff changeset
149 private static final Date nn(Date d) {
1e6bd2831280 artifacts: Desktop-FLYS conform official line messages in error reports.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6501
diff changeset
150 return d != null ? d : new Date();
1e6bd2831280 artifacts: Desktop-FLYS conform official line messages in error reports.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6501
diff changeset
151 }
1138
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
152
1140
96d7842e80ee Cosmetics, refactored, resolved todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1138
diff changeset
153 /**
96d7842e80ee Cosmetics, refactored, resolved todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1138
diff changeset
154 * @param context Ignored.
96d7842e80ee Cosmetics, refactored, resolved todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1138
diff changeset
155 */
96d7842e80ee Cosmetics, refactored, resolved todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1138
diff changeset
156 @Override
96d7842e80ee Cosmetics, refactored, resolved todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1138
diff changeset
157 public Object computeFeed(
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
158 D4EArtifact artifact,
1140
96d7842e80ee Cosmetics, refactored, resolved todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1138
diff changeset
159 String hash,
96d7842e80ee Cosmetics, refactored, resolved todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1138
diff changeset
160 CallContext context,
96d7842e80ee Cosmetics, refactored, resolved todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1138
diff changeset
161 List<Facet> facets,
96d7842e80ee Cosmetics, refactored, resolved todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1138
diff changeset
162 Object old
96d7842e80ee Cosmetics, refactored, resolved todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1138
diff changeset
163 ) {
2154
ce9b15673f3f Use waterlevel state and longitudinal section generator for longitudinal
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2123
diff changeset
164 if (artifact instanceof ChartArtifact) {
ce9b15673f3f Use waterlevel state and longitudinal section generator for longitudinal
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2123
diff changeset
165 facets.add(new EmptyFacet());
ce9b15673f3f Use waterlevel state and longitudinal section generator for longitudinal
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2123
diff changeset
166 return null;
ce9b15673f3f Use waterlevel state and longitudinal section generator for longitudinal
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2123
diff changeset
167 }
9425
3f49835a00c3 Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents: 8856
diff changeset
168 return compute((WINFOArtifact) artifact, context, ComputeType.FEED, hash, facets, old);
1140
96d7842e80ee Cosmetics, refactored, resolved todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1138
diff changeset
169 }
96d7842e80ee Cosmetics, refactored, resolved todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1138
diff changeset
170
96d7842e80ee Cosmetics, refactored, resolved todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1138
diff changeset
171
96d7842e80ee Cosmetics, refactored, resolved todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1138
diff changeset
172 /**
96d7842e80ee Cosmetics, refactored, resolved todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1138
diff changeset
173 * @param context Ignored.
96d7842e80ee Cosmetics, refactored, resolved todo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1138
diff changeset
174 */
927
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
175 @Override
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
176 public Object computeAdvance(
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
177 D4EArtifact artifact,
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
178 String hash,
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
179 CallContext context,
742
c09c9e05ecfa Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 711
diff changeset
180 List<Facet> facets,
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
181 Object old
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
182 ) {
2154
ce9b15673f3f Use waterlevel state and longitudinal section generator for longitudinal
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2123
diff changeset
183 if (artifact instanceof ChartArtifact) {
ce9b15673f3f Use waterlevel state and longitudinal section generator for longitudinal
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2123
diff changeset
184 facets.add(new EmptyFacet());
ce9b15673f3f Use waterlevel state and longitudinal section generator for longitudinal
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2123
diff changeset
185 return null;
ce9b15673f3f Use waterlevel state and longitudinal section generator for longitudinal
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2123
diff changeset
186 }
9425
3f49835a00c3 Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents: 8856
diff changeset
187 return compute((WINFOArtifact) artifact, context, ComputeType.ADVANCE, hash, facets, old);
688
dc3613c4daf6 Moved Waterlevel state into the correct package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
188 }
dc3613c4daf6 Moved Waterlevel state into the correct package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
189 }
dc3613c4daf6 Moved Waterlevel state into the correct package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
190 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org