Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstState.java @ 9360:ddcd52d239cd
Outliers in fixation calculation are now shown within the other 'B' event themes and get a separate symbol (triangle).
Removed old outliers theme.
Also consider showpoints property.
Also consider pointsize property.
author | gernotbelger |
---|---|
date | Wed, 01 Aug 2018 17:13:52 +0200 |
parents | 7b2b086e45f0 |
children | d194c5b24bf8 |
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 | |
9360
ddcd52d239cd
Outliers in fixation calculation are now shown within the other 'B' event themes and get a separate symbol (triangle).
gernotbelger
parents:
9318
diff
changeset
|
35 private static final String I18N_WQ_CURVE = "fix.vollmer.wq.curve"; |
9072
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
36 |
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
37 /** |
9274 | 38 * 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
|
39 */ |
9274 | 40 public BezugswstState() { |
9072
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
41 } |
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
diff
changeset
|
42 |
9274 | 43 @Override |
44 public Object computeAdvance(final D4EArtifact artifact, final String hash, final CallContext context, final List<Facet> facets, final Object old) { | |
45 log.debug("BezugswstState.computeAdvance"); | |
9318
7b2b086e45f0
collision pdf details, ResultType refactoring, bezugswst result
gernotbelger
parents:
9313
diff
changeset
|
46 // TODO: remove this old stuff, or replace it by new |
9313 | 47 // final CalculationResult res; |
48 // | |
49 // final FixRealizingAccess access = new FixRealizingAccess(artifact); | |
50 // | |
51 // if (old instanceof CalculationResult) { | |
52 // res = (CalculationResult) old; | |
53 // } else { | |
54 // | |
55 // final FixRealizingCalculation calc = new FixRealizingCalculation(access); | |
56 // res = calc.calculate(); | |
57 // } | |
58 // | |
59 // if (facets == null) { | |
60 // return res; | |
61 // } | |
62 // | |
63 // if (res.getReport().hasProblems()) { | |
64 // facets.add(new ReportFacet()); | |
65 // } | |
66 // | |
67 // final String id = getID(); | |
68 // final CallMeta meta = context.getMeta(); | |
69 // | |
70 // final FixRealizingResult fixRes = (FixRealizingResult) res.getData(); | |
71 // final WQKms[] wqkms = fixRes != null ? fixRes.getWQKms() : new WQKms[0]; | |
72 // | |
73 // for (int i = 0; i < wqkms.length; i++) { | |
74 // String nameW = null; | |
75 // String nameQ = null; | |
76 // | |
77 // if (access.isQ()) { | |
78 // nameQ = wqkms[i].getName(); | |
79 // nameW = "W(" + nameQ + ")"; | |
80 // } else { | |
81 // nameW = wqkms[i].getName(); | |
82 // nameQ = "Q(" + nameW + ")"; | |
83 // } | |
84 // | |
85 // final Facet wq = new FixWaterlevelFacet(i, FIX_WQ_LS, nameW, ComputeType.ADVANCE, hash, id); | |
86 // | |
87 // final Facet w = new FixWaterlevelFacet(i, LONGITUDINAL_W, nameW, ComputeType.ADVANCE, hash, id); | |
88 // | |
89 // final Facet q = new FixWaterlevelFacet(i, LONGITUDINAL_Q, nameQ, ComputeType.ADVANCE, hash, id); | |
90 // final Facet csFacet = new CrossSectionWaterLineFacet(i, nameW); | |
91 // | |
92 // facets.add(wq); | |
93 // facets.add(w); | |
94 // facets.add(q); | |
95 // facets.add(csFacet); | |
96 // | |
97 // // XXX: THIS CAN NOT HAPPEN! REMOVE IT! | |
98 // if (wqkms[i] instanceof WQCKms) { | |
99 // final String nameC = nameW.replace("benutzerdefiniert", "benutzerdefiniert [korrigiert]"); | |
100 // | |
101 // final Facet c = new FixWaterlevelFacet(i, DISCHARGE_LONGITUDINAL_C, nameC); | |
102 // | |
103 // facets.add(c); | |
104 // } | |
105 // } | |
106 // | |
107 // if (wqkms.length > 0) { | |
108 // final DateFormat df = Formatter.getDateFormatter(context.getMeta(), "dd.MM.yyyy"); | |
109 // final DateFormat lf = Formatter.getDateFormatter(context.getMeta(), "dd.MM.yyyy'T'HH:mm"); | |
110 // | |
111 // final Collection<Date> reds = fixRes.getReferenceEventsDates(); | |
112 // final UniqueDateFormatter cf = new UniqueDateFormatter(df, lf, reds); | |
113 // | |
114 // int i = 0; | |
115 // for (final Date d : reds) { | |
116 // facets.add(new FixReferenceEventsFacet((1 << 9) | i, FIX_EVENTS, cf.format(d))); | |
117 // i++; | |
118 // } | |
119 // | |
120 // facets.add(new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id)); | |
121 // | |
122 // facets.add(new DataFacet(WST, "WST data", ComputeType.ADVANCE, hash, id)); | |
123 // | |
124 // facets.add(new DataFacet(PDF, "PDF data", ComputeType.ADVANCE, hash, id)); | |
125 // } | |
126 // | |
127 // facets.add(new DataFacet(AT, "AT data", ComputeType.ADVANCE, hash, id)); | |
128 // | |
129 // facets.add(new FixWQCurveFacet(0, Resources.getMsg(meta, I18N_WQ_CURVE, I18N_WQ_CURVE) + " (" + access.getFunction() | |
130 // + ")")); | |
131 // | |
132 return compute((BUNDUArtifact) artifact, context, hash, facets, old); | |
133 } | |
9274 | 134 |
9313 | 135 @Override |
136 public Object computeFeed(final D4EArtifact artifact, final String hash, final CallContext context, final List<Facet> facets, final Object old) { | |
9274 | 137 |
9313 | 138 return compute((BUNDUArtifact) artifact, context, hash, facets, old); |
139 } | |
9274 | 140 |
9313 | 141 private Object compute(final BUNDUArtifact artifact, final CallContext context, final String hash, final List<Facet> facets, final Object old) { |
9274 | 142 |
9313 | 143 final BezugswstCalculation s = new BezugswstCalculation(context); |
144 final CalculationResult res = s.calculate(artifact); | |
9274 | 145 |
9313 | 146 if (facets == null) |
147 return res; | |
9274 | 148 |
9313 | 149 final Facet csv = new DataFacet(FacetTypes.CSV, "CSV data", ComputeType.ADVANCE, hash, this.id); |
150 final Facet pdf = new DataFacet(FacetTypes.PDF, "PDF data", ComputeType.ADVANCE, hash, this.id); | |
151 | |
152 facets.add(csv); | |
153 facets.add(pdf); | |
9274 | 154 |
155 return res; | |
156 } | |
9313 | 157 |
9274 | 158 } |