Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixReferenceEventsFacet.java @ 9415:9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
The facets also put the valid station range into their xml-metadata
author | gernotbelger |
---|---|
date | Thu, 16 Aug 2018 16:27:53 +0200 |
parents | ddcd52d239cd |
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:
5335
diff
changeset
|
9 package org.dive4elements.river.artifacts.model.fixings; |
3035
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
11 import org.apache.commons.lang.math.DoubleRange; |
3466
8160e62bbb3a
Registered new output 'fix_vollmer_wq_curve' for the vollmer path of fixings analysis module; create required Facets for it after calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3415
diff
changeset
|
12 import org.apache.log4j.Logger; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5335
diff
changeset
|
13 import org.dive4elements.artifacts.Artifact; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5335
diff
changeset
|
14 import org.dive4elements.artifacts.CallContext; |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
15 import org.dive4elements.river.artifacts.D4EArtifact; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5335
diff
changeset
|
16 import org.dive4elements.river.artifacts.model.CalculationResult; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5335
diff
changeset
|
17 import org.dive4elements.river.artifacts.model.FacetTypes; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5335
diff
changeset
|
18 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; |
3035
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 /** |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 * Facet to show W values for Q values at km for a date. |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 * |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 */ |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
25 public class FixReferenceEventsFacet extends FixingsEventFacet implements FacetTypes { |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
26 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
27 private static final long serialVersionUID = 1L; |
3035
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6875
diff
changeset
|
29 /** House log. */ |
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6875
diff
changeset
|
30 private static Logger log = Logger.getLogger(FixReferenceEventsFacet.class); |
3035
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
32 private int columnId; |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
33 |
3035
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 /** Trivial Constructor. */ |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 public FixReferenceEventsFacet() { |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 } |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
38 public FixReferenceEventsFacet(final int facetIndex, final int columnId, final String name, final String description, final DoubleRange stationRange) { |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
39 super(facetIndex, name, description, ComputeType.ADVANCE, null, null, stationRange); |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
40 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
41 this.columnId = columnId; |
3035
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 } |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 /** |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 * Returns the data this facet requires. |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 * |
9348
a3f318347707
Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents:
8202
diff
changeset
|
47 * @param artifact |
a3f318347707
Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents:
8202
diff
changeset
|
48 * the owner artifact. |
a3f318347707
Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents:
8202
diff
changeset
|
49 * @param context |
a3f318347707
Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents:
8202
diff
changeset
|
50 * the CallContext (ignored). |
3035
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 * |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 * @return the data. |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 */ |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 @Override |
9348
a3f318347707
Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents:
8202
diff
changeset
|
55 public Object getData(final Artifact artifact, final CallContext context) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6875
diff
changeset
|
56 log.debug("FixReferenceEventsFacet.getData"); |
3035
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 |
6868
08e3c22500f3
Fix Analysis: Code simplification in facets.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
58 if (!(artifact instanceof D4EArtifact)) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6875
diff
changeset
|
59 log.debug("Not an instance of FixationArtifact."); |
3035
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 return null; |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 } |
6868
08e3c22500f3
Fix Analysis: Code simplification in facets.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
62 |
9348
a3f318347707
Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents:
8202
diff
changeset
|
63 final D4EArtifact flys = (D4EArtifact) artifact; |
6868
08e3c22500f3
Fix Analysis: Code simplification in facets.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
64 |
9348
a3f318347707
Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents:
8202
diff
changeset
|
65 final CalculationResult res = (CalculationResult) flys.compute(context, ComputeType.ADVANCE, false); |
6868
08e3c22500f3
Fix Analysis: Code simplification in facets.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
66 |
9348
a3f318347707
Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents:
8202
diff
changeset
|
67 final FixResult result = (FixResult) res.getData(); |
a3f318347707
Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents:
8202
diff
changeset
|
68 final double currentKm = getCurrentKm(context); |
6868
08e3c22500f3
Fix Analysis: Code simplification in facets.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
69 |
9360
ddcd52d239cd
Outliers in fixation calculation are now shown within the other 'B' event themes and get a separate symbol (triangle).
gernotbelger
parents:
9348
diff
changeset
|
70 if (log.isDebugEnabled()) |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6875
diff
changeset
|
71 log.debug("current km in FRE: " + currentKm); |
6868
08e3c22500f3
Fix Analysis: Code simplification in facets.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
72 |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
73 final FixResultColumns resultColumns = result.getFixResultColumns(); |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
74 final FixResultColumn event = resultColumns.getColumn(this.columnId); |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
75 if (event == null) { |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
76 log.error("Missing event with columnId: " + this.columnId); |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
77 return null; |
9348
a3f318347707
Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents:
8202
diff
changeset
|
78 } |
a3f318347707
Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents:
8202
diff
changeset
|
79 |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
80 return event.getQWD(currentKm); |
9348
a3f318347707
Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents:
8202
diff
changeset
|
81 } |
3035
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
82 |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
83 /** |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
84 * Create a deep copy of this Facet. |
9348
a3f318347707
Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents:
8202
diff
changeset
|
85 * |
3035
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
86 * @return a deep copy. |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
87 */ |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
88 @Override |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
89 public FixReferenceEventsFacet deepCopy() { |
9348
a3f318347707
Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents:
8202
diff
changeset
|
90 final FixReferenceEventsFacet copy = new FixReferenceEventsFacet(); |
3035
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
91 copy.set(this); |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
92 copy.columnId = this.columnId; |
3035
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
93 return copy; |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 } |
9348
a3f318347707
Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents:
8202
diff
changeset
|
95 } |