Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstState.java @ 9318:7b2b086e45f0
collision pdf details, ResultType refactoring, bezugswst result
author | gernotbelger |
---|---|
date | Fri, 27 Jul 2018 10:11:23 +0200 |
parents | 6ffcbb4f35d5 |
children | ddcd52d239cd |
rev | line source |
---|---|
9274 | 1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
2 * Software engineering by Intevation GmbH | |
9072
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
3 * |
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
7 */ |
9274 | 8 |
9072
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
9 package org.dive4elements.river.artifacts.bundu.bezugswst; |
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
10 |
9274 | 11 import java.util.List; |
12 | |
13 import org.apache.log4j.Logger; | |
14 import org.dive4elements.artifactdatabase.state.Facet; | |
15 import org.dive4elements.artifacts.CallContext; | |
16 import org.dive4elements.river.artifacts.D4EArtifact; | |
9313 | 17 import org.dive4elements.river.artifacts.bundu.BUNDUArtifact; |
9274 | 18 import org.dive4elements.river.artifacts.model.CalculationResult; |
19 import org.dive4elements.river.artifacts.model.DataFacet; | |
20 import org.dive4elements.river.artifacts.model.FacetTypes; | |
9072
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
21 import org.dive4elements.river.artifacts.states.DefaultState; |
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
22 |
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
23 /** |
9274 | 24 * State to compute the fixation realizing (vollmer) results. |
25 * | |
26 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> | |
9072
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
27 */ |
9274 | 28 public class BezugswstState extends DefaultState implements FacetTypes { |
9072
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
29 |
9318
7b2b086e45f0
collision pdf details, ResultType refactoring, bezugswst result
gernotbelger
parents:
9313
diff
changeset
|
30 private static final long serialVersionUID = 1L; |
9072
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
31 |
9274 | 32 /** The log used in this class. */ |
33 private static Logger log = Logger.getLogger(BezugswstState.class); | |
34 | |
35 public static final String I18N_WQ_CURVE = "fix.vollmer.wq.curve"; | |
36 | |
37 public static final String I18N_WQ_OUTLIER = "fix.vollmer.wq.outliers"; | |
9072
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
38 |
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
39 /** |
9274 | 40 * The default constructor that initializes an empty State object. |
9072
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
41 */ |
9274 | 42 public BezugswstState() { |
9072
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
43 } |
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
44 |
9274 | 45 @Override |
46 public Object computeAdvance(final D4EArtifact artifact, final String hash, final CallContext context, final List<Facet> facets, final Object old) { | |
47 log.debug("BezugswstState.computeAdvance"); | |
9318
7b2b086e45f0
collision pdf details, ResultType refactoring, bezugswst result
gernotbelger
parents:
9313
diff
changeset
|
48 // TODO: remove this old stuff, or replace it by new |
9313 | 49 // final CalculationResult res; |
50 // | |
51 // final FixRealizingAccess access = new FixRealizingAccess(artifact); | |
52 // | |
53 // if (old instanceof CalculationResult) { | |
54 // res = (CalculationResult) old; | |
55 // } else { | |
56 // | |
57 // final FixRealizingCalculation calc = new FixRealizingCalculation(access); | |
58 // res = calc.calculate(); | |
59 // } | |
60 // | |
61 // if (facets == null) { | |
62 // return res; | |
63 // } | |
64 // | |
65 // if (res.getReport().hasProblems()) { | |
66 // facets.add(new ReportFacet()); | |
67 // } | |
68 // | |
69 // final String id = getID(); | |
70 // final CallMeta meta = context.getMeta(); | |
71 // | |
72 // final FixRealizingResult fixRes = (FixRealizingResult) res.getData(); | |
73 // final WQKms[] wqkms = fixRes != null ? fixRes.getWQKms() : new WQKms[0]; | |
74 // | |
75 // for (int i = 0; i < wqkms.length; i++) { | |
76 // String nameW = null; | |
77 // String nameQ = null; | |
78 // | |
79 // if (access.isQ()) { | |
80 // nameQ = wqkms[i].getName(); | |
81 // nameW = "W(" + nameQ + ")"; | |
82 // } else { | |
83 // nameW = wqkms[i].getName(); | |
84 // nameQ = "Q(" + nameW + ")"; | |
85 // } | |
86 // | |
87 // final Facet wq = new FixWaterlevelFacet(i, FIX_WQ_LS, nameW, ComputeType.ADVANCE, hash, id); | |
88 // | |
89 // final Facet w = new FixWaterlevelFacet(i, LONGITUDINAL_W, nameW, ComputeType.ADVANCE, hash, id); | |
90 // | |
91 // final Facet q = new FixWaterlevelFacet(i, LONGITUDINAL_Q, nameQ, ComputeType.ADVANCE, hash, id); | |
92 // final Facet csFacet = new CrossSectionWaterLineFacet(i, nameW); | |
93 // | |
94 // facets.add(wq); | |
95 // facets.add(w); | |
96 // facets.add(q); | |
97 // facets.add(csFacet); | |
98 // | |
99 // // XXX: THIS CAN NOT HAPPEN! REMOVE IT! | |
100 // if (wqkms[i] instanceof WQCKms) { | |
101 // final String nameC = nameW.replace("benutzerdefiniert", "benutzerdefiniert [korrigiert]"); | |
102 // | |
103 // final Facet c = new FixWaterlevelFacet(i, DISCHARGE_LONGITUDINAL_C, nameC); | |
104 // | |
105 // facets.add(c); | |
106 // } | |
107 // } | |
108 // | |
109 // if (wqkms.length > 0) { | |
110 // final DateFormat df = Formatter.getDateFormatter(context.getMeta(), "dd.MM.yyyy"); | |
111 // final DateFormat lf = Formatter.getDateFormatter(context.getMeta(), "dd.MM.yyyy'T'HH:mm"); | |
112 // | |
113 // final Collection<Date> reds = fixRes.getReferenceEventsDates(); | |
114 // final UniqueDateFormatter cf = new UniqueDateFormatter(df, lf, reds); | |
115 // | |
116 // int i = 0; | |
117 // for (final Date d : reds) { | |
118 // facets.add(new FixReferenceEventsFacet((1 << 9) | i, FIX_EVENTS, cf.format(d))); | |
119 // i++; | |
120 // } | |
121 // | |
122 // facets.add(new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id)); | |
123 // | |
124 // facets.add(new DataFacet(WST, "WST data", ComputeType.ADVANCE, hash, id)); | |
125 // | |
126 // facets.add(new DataFacet(PDF, "PDF data", ComputeType.ADVANCE, hash, id)); | |
127 // } | |
128 // | |
129 // facets.add(new DataFacet(AT, "AT data", ComputeType.ADVANCE, hash, id)); | |
130 // | |
131 // facets.add(new FixWQCurveFacet(0, Resources.getMsg(meta, I18N_WQ_CURVE, I18N_WQ_CURVE) + " (" + access.getFunction() | |
132 // + ")")); | |
133 // | |
134 // if (access.getPreprocessing()) { | |
135 // facets.add(new FixOutlierFacet(0, FIX_OUTLIER, Resources.getMsg(meta, I18N_WQ_OUTLIER, I18N_WQ_OUTLIER))); | |
136 // } | |
137 return compute((BUNDUArtifact) artifact, context, hash, facets, old); | |
138 } | |
9274 | 139 |
9313 | 140 @Override |
141 public Object computeFeed(final D4EArtifact artifact, final String hash, final CallContext context, final List<Facet> facets, final Object old) { | |
9274 | 142 |
9313 | 143 return compute((BUNDUArtifact) artifact, context, hash, facets, old); |
144 } | |
9274 | 145 |
9313 | 146 private Object compute(final BUNDUArtifact artifact, final CallContext context, final String hash, final List<Facet> facets, final Object old) { |
9274 | 147 |
9313 | 148 final BezugswstCalculation s = new BezugswstCalculation(context); |
149 final CalculationResult res = s.calculate(artifact); | |
9274 | 150 |
9313 | 151 if (facets == null) |
152 return res; | |
9274 | 153 |
9313 | 154 final Facet csv = new DataFacet(FacetTypes.CSV, "CSV data", ComputeType.ADVANCE, hash, this.id); |
155 final Facet pdf = new DataFacet(FacetTypes.PDF, "PDF data", ComputeType.ADVANCE, hash, this.id); | |
156 | |
157 facets.add(csv); | |
158 facets.add(pdf); | |
9274 | 159 |
160 return res; | |
161 } | |
9313 | 162 |
9274 | 163 } |