annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixReferenceEventsFacet.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 a3f318347707
children 9744ce3c3853
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
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
11 import org.apache.log4j.Logger;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5335
diff changeset
12 import org.dive4elements.artifacts.Artifact;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5335
diff changeset
13 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
14 import org.dive4elements.river.artifacts.D4EArtifact;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5335
diff changeset
15 import org.dive4elements.river.artifacts.model.CalculationResult;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5335
diff changeset
16 import org.dive4elements.river.artifacts.model.FacetTypes;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5335
diff changeset
17 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5335
diff changeset
18 import org.dive4elements.river.utils.KMIndex;
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 */
9348
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
25 public class FixReferenceEventsFacet extends FixingsFacet implements FacetTypes {
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
26
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6875
diff changeset
27 /** House log. */
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6875
diff changeset
28 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
29
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
30 /** 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
31 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
32 }
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
33
9348
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
34 public FixReferenceEventsFacet(final int index, final String name, final String description) {
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
35 super(index, name, description, ComputeType.ADVANCE, null, null);
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
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
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
38 /**
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
39 * 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
40 *
9348
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
41 * @param artifact
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
42 * the owner artifact.
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
43 * @param context
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
44 * 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
45 *
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 * @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
47 */
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
48 @Override
9348
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
49 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
50 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
51
6868
08e3c22500f3 Fix Analysis: Code simplification in facets.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
52 if (!(artifact instanceof D4EArtifact)) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6875
diff changeset
53 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
54 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
55 }
6868
08e3c22500f3 Fix Analysis: Code simplification in facets.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
56
9348
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
57 final D4EArtifact flys = (D4EArtifact) artifact;
6868
08e3c22500f3 Fix Analysis: Code simplification in facets.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
58
9348
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
59 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
60
9348
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
61 final FixResult result = (FixResult) res.getData();
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
62 final double currentKm = getCurrentKm(context);
6868
08e3c22500f3 Fix Analysis: Code simplification in facets.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
63
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
64 if (log.isDebugEnabled())
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6875
diff changeset
65 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
66
9348
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
67 /* first search in referenced */
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
68 final KMIndex<QWD[]> referenced = result.getFixings();
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
69 return find(referenced, currentKm);
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
70 }
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
71
9348
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
72 private QWD find(final KMIndex<QWD[]> kmQWs, final double currentKm) {
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
73
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
74 final KMIndex.Entry<QWD[]> kmQWsEntry = kmQWs.binarySearch(currentKm);
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
75 if (kmQWsEntry != null) {
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
76 final int ndx = this.index & 255;
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
77 for (final QWD qwd : kmQWsEntry.getValue()) {
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
78 if (qwd.getIndex() == ndx)
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
79 return qwd;
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
80 }
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
81 }
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
82
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
83 return null;
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
84 }
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
85
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 /**
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 * 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
88 *
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
89 * @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
90 */
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 @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
92 public FixReferenceEventsFacet deepCopy() {
9348
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
93 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
94 copy.set(this);
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
95 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
96 }
9348
a3f318347707 Show wq outliers within same thems with different symbol: not ready yet
gernotbelger
parents: 8202
diff changeset
97 }

http://dive4elements.wald.intevation.org