Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/FixAnalysisCompute.java @ 9479:2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
author | gernotbelger |
---|---|
date | Mon, 10 Sep 2018 15:31:55 +0200 |
parents | 9744ce3c3853 |
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:
5646
diff
changeset
|
9 package org.dive4elements.river.artifacts.states.fixation; |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
3610
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3599
diff
changeset
|
11 import java.text.DateFormat; |
6844
437d056ce426
Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6101
diff
changeset
|
12 import java.util.Collection; |
3610
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3599
diff
changeset
|
13 import java.util.Date; |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3599
diff
changeset
|
14 import java.util.List; |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3599
diff
changeset
|
15 |
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
|
16 import org.apache.commons.lang.math.DoubleRange; |
3610
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3599
diff
changeset
|
17 import org.apache.log4j.Logger; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
18 import org.dive4elements.artifactdatabase.state.Facet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
19 import org.dive4elements.artifactdatabase.state.FacetActivity; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
20 import org.dive4elements.artifacts.Artifact; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
21 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
|
22 import org.dive4elements.river.artifacts.D4EArtifact; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
23 import org.dive4elements.river.artifacts.access.FixAnalysisAccess; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
24 import org.dive4elements.river.artifacts.model.CalculationResult; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
25 import org.dive4elements.river.artifacts.model.DataFacet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
26 import org.dive4elements.river.artifacts.model.DateRange; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
27 import org.dive4elements.river.artifacts.model.FacetTypes; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
28 import org.dive4elements.river.artifacts.model.ReportFacet; |
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
|
29 import org.dive4elements.river.artifacts.model.fixings.AnalysisPeriodEventResults; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
30 import org.dive4elements.river.artifacts.model.fixings.FixAnalysisCalculation; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
31 import org.dive4elements.river.artifacts.model.fixings.FixAnalysisEventsFacet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
32 import org.dive4elements.river.artifacts.model.fixings.FixAnalysisPeriodsFacet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
33 import org.dive4elements.river.artifacts.model.fixings.FixAnalysisResult; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
34 import org.dive4elements.river.artifacts.model.fixings.FixAvSectorFacet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
35 import org.dive4elements.river.artifacts.model.fixings.FixDerivateFacet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
36 import org.dive4elements.river.artifacts.model.fixings.FixDeviationFacet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
37 import org.dive4elements.river.artifacts.model.fixings.FixLongitudinalAnalysisFacet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
38 import org.dive4elements.river.artifacts.model.fixings.FixLongitudinalAvSectorFacet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
39 import org.dive4elements.river.artifacts.model.fixings.FixLongitudinalDeviationFacet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
40 import org.dive4elements.river.artifacts.model.fixings.FixLongitudinalReferenceFacet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
41 import org.dive4elements.river.artifacts.model.fixings.FixReferenceEventsFacet; |
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
|
42 import org.dive4elements.river.artifacts.model.fixings.FixResultColumn; |
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
|
43 import org.dive4elements.river.artifacts.model.fixings.FixResultColumns; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
44 import org.dive4elements.river.artifacts.model.fixings.FixWQCurveFacet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
45 import org.dive4elements.river.artifacts.resources.Resources; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
46 import org.dive4elements.river.artifacts.states.DefaultState; |
6844
437d056ce426
Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6101
diff
changeset
|
47 import org.dive4elements.river.utils.Formatter; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5646
diff
changeset
|
48 import org.dive4elements.river.utils.IdGenerator; |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 /** |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 */ |
9082 | 53 public class FixAnalysisCompute extends DefaultState implements FacetTypes { |
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
|
54 |
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
|
55 private static final long serialVersionUID = 1L; |
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
|
56 |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 /** The log used in this class. */ |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 private static Logger log = Logger.getLogger(FixAnalysisCompute.class); |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 |
9082 | 60 private static final String I18N_REFERENCEPERIOD_SHORT = "fix.reference.period.event.short"; |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 private static final String I18N_ANALYSISPERIODS = "fix.analysis.periods"; |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 private static final String I18N_DERIVATIVE = "fix.derivative"; |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
65 |
3610
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3599
diff
changeset
|
66 private static final String I18N_ANALYSIS = "fix.analysis.short"; |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 private static final String I18N_DEVIATION = "fix.deviation"; |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 |
9082 | 70 private static final String I18N_REFERENCEDEVIATION = "fix.reference.deviation"; |
3907
9a2c38fb5f29
Add reference period facet to delta W/t chart
Christian Lins <christian.lins@intevation.de>
parents:
3785
diff
changeset
|
71 |
9082 | 72 private static final String I18N_REFERENCEPERIOD = "state.fix.analysis.referenceperiod"; |
73 | |
74 public static final String[] SECTOR_LABELS = { "fix.mnq", "fix.mq", "fix.mhq", "fix.hq5" }; | |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
75 |
3785
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3730
diff
changeset
|
76 static { |
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3730
diff
changeset
|
77 // Active/deactivate facets. |
9082 | 78 FacetActivity.Registry.getInstance().register("fixanalysis", new FacetActivity() { |
79 @Override | |
80 public Boolean isInitialActive(final Artifact artifact, final Facet facet, final String output) { | |
81 if (output.contains(FacetTypes.ChartType.FLSC.toString())) { | |
82 // Longitudinal section chart | |
83 final String name = facet.getName(); | |
3785
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3730
diff
changeset
|
84 |
9082 | 85 if (name.contains(FacetTypes.FIX_ANALYSIS_EVENTS_DWT) || name.contains(FacetTypes.FIX_ANALYSIS_EVENTS_LS) |
86 || name.contains(FacetTypes.FIX_ANALYSIS_EVENTS_WQ) || name.contains(FacetTypes.FIX_REFERENCE_EVENTS_DWT) | |
87 || name.contains(FacetTypes.FIX_REFERENCE_EVENTS_LS) || name.contains(FacetTypes.FIX_REFERENCE_EVENTS_WQ)) { | |
4166
48e09640e8ec
Let fix sector average facets in deltawt-diagrams enter inactively.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3917
diff
changeset
|
88 return Boolean.FALSE; |
48e09640e8ec
Let fix sector average facets in deltawt-diagrams enter inactively.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3917
diff
changeset
|
89 } |
3785
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3730
diff
changeset
|
90 } |
9082 | 91 if (output.contains(FacetTypes.ChartType.FDWC.toString()) && facet.getName().contains(FacetTypes.FIX_SECTOR_AVERAGE_DWT)) { |
92 return Boolean.FALSE; | |
93 } | |
94 | |
95 return Boolean.TRUE; | |
96 } | |
97 }); | |
3785
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3730
diff
changeset
|
98 } |
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3730
diff
changeset
|
99 |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
100 /** |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
101 * The default constructor that initializes an empty State object. |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
102 */ |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
103 public FixAnalysisCompute() { |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
104 } |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
105 |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
106 @Override |
9082 | 107 public Object computeAdvance(final D4EArtifact artifact, final String hash, final CallContext context, final List<Facet> facets, final Object old) { |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
108 log.debug("FixAnalysisCompute.computeAdvance"); |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
109 |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
110 CalculationResult res; |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
111 |
9082 | 112 final FixAnalysisAccess access = new FixAnalysisAccess(artifact); |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
113 |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
114 if (old instanceof CalculationResult) { |
9082 | 115 res = (CalculationResult) old; |
116 } else { | |
117 final FixAnalysisCalculation calc = new FixAnalysisCalculation(access); | |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9415
diff
changeset
|
118 res = calc.calculate(context.getMeta()); |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
119 } |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
120 |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
121 if (facets == null) { |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
122 return res; |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
123 } |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
124 |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
125 if (res.getReport().hasProblems()) { |
9082 | 126 facets.add(new ReportFacet(ComputeType.ADVANCE, hash, this.id)); |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
127 } |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
128 |
9082 | 129 final FixAnalysisResult fr = (FixAnalysisResult) res.getData(); |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
130 if (fr == null) { |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
131 return res; |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
132 } |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
133 |
9082 | 134 facets.add(new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, this.id)); |
135 facets.add(new DataFacet(FIX_PARAMETERS, "parameters", ComputeType.ADVANCE, hash, this.id)); | |
136 facets.add(new DataFacet(AT, "AT data", ComputeType.ADVANCE, hash, this.id)); | |
137 facets.add(new DataFacet(PDF, "PDF data", ComputeType.ADVANCE, hash, this.id)); | |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
138 |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
139 int maxId = -100; |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
140 |
9082 | 141 final int sectorMask = fr.getUsedSectorsInAnalysisPeriods(); |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
142 |
9082 | 143 final int qsS = access.getQSectorStart(); |
144 final int qsE = access.getQSectorEnd(); | |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
145 |
9082 | 146 final DateFormat df = Formatter.getDateFormatter(context.getMeta(), "dd.MM.yyyy"); |
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
|
147 final UniqueDateFormatter cf = new UniqueDateFormatter(df); |
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
|
148 |
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
|
149 final AnalysisPeriodEventResults analysisEventResults = fr.getAnalysisEventResults(); |
9082 | 150 |
151 final DateRange[] periods = access.getAnalysisPeriods(); | |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
152 |
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
|
153 int facetIndex = 0; |
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
|
154 |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
155 for (int i = 0; i < periods.length; i++) { |
9082 | 156 final DateRange period = periods[i]; |
157 final String startDate = df.format(period.getFrom()); | |
158 final String endDate = df.format(period.getTo()); | |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
159 |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
160 for (int j = qsS; j <= qsE; j++) { |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
161 |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
162 // Only emit facets for sectors that really have data. |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
163 if ((sectorMask & (1 << j)) == 0) { |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
164 continue; |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
165 } |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
166 |
9082 | 167 final String sector = SECTOR_LABELS[j]; |
168 final String description = "\u0394W (" + Resources.getMsg(context.getMeta(), sector, sector) + ")"; | |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
169 |
9082 | 170 final int sectorNdx = j - qsS; |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
171 int facetNdx = i << 2; |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
172 facetNdx = facetNdx | j; |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
173 |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
174 if (facetNdx > maxId) { |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
175 maxId = facetNdx; |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
176 } |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
177 |
9082 | 178 facets.add(new FixAvSectorFacet(facetNdx, FIX_SECTOR_AVERAGE_DWT + "_" + sectorNdx, description)); |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
179 facets.add( |
9082 | 180 new FixLongitudinalAvSectorFacet(facetNdx, FIX_SECTOR_AVERAGE_LS + "_" + sectorNdx, description + ":" + startDate + " - " + endDate)); |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
181 // TODO: i18n |
9082 | 182 final String dev = "Abweichung: " + description; |
183 facets.add(new FixLongitudinalAvSectorFacet(facetNdx, FIX_SECTOR_AVERAGE_LS_DEVIATION + "_" + sectorNdx, dev)); | |
184 facets.add(new FixAvSectorFacet(facetNdx, FIX_SECTOR_AVERAGE_WQ + "_" + sectorNdx, description)); | |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
185 } |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
186 |
9082 | 187 final String eventDesc = Resources.getMsg(context.getMeta(), I18N_ANALYSIS, I18N_ANALYSIS); |
3610
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3599
diff
changeset
|
188 |
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
|
189 final FixResultColumns analysisEventResult = analysisEventResults.getEventResults(i); |
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
|
190 final Collection<FixResultColumn> columns = analysisEventResult.getSortedColumns(); |
6844
437d056ce426
Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6101
diff
changeset
|
191 |
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
|
192 for (final FixResultColumn analysisEventColumn : columns) { |
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
|
193 |
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
|
194 final int columnId = analysisEventColumn.getColumnId(); |
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
|
195 final Date d = analysisEventColumn.getDate(); |
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
|
196 final DoubleRange stationRange = analysisEventColumn.getStationRange(); |
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
|
197 |
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
|
198 final String facetDescription = eventDesc + (i + 1) + " - " + cf.format(d); |
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
|
199 |
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
|
200 facets.add(new FixAnalysisEventsFacet(facetIndex++, i, columnId, FIX_ANALYSIS_EVENTS_DWT, facetDescription, 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
|
201 facets.add(new FixLongitudinalAnalysisFacet(facetIndex++, i, columnId, FIX_ANALYSIS_EVENTS_LS, facetDescription)); |
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
|
202 facets.add(new FixAnalysisEventsFacet(facetIndex++, i, columnId, FIX_ANALYSIS_EVENTS_WQ, facetDescription, stationRange)); |
3610
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3599
diff
changeset
|
203 } |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
204 } |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
205 |
9082 | 206 final IdGenerator idg = new IdGenerator(maxId + 1); |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
207 |
9082 | 208 final String i18n_ref = Resources.getMsg(context.getMeta(), I18N_REFERENCEPERIOD_SHORT, I18N_REFERENCEPERIOD_SHORT); |
209 final String i18n_dev = Resources.getMsg(context.getMeta(), I18N_REFERENCEDEVIATION, I18N_REFERENCEDEVIATION); | |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
210 |
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
|
211 final FixResultColumns columns = fr.getFixResultColumns(); |
6844
437d056ce426
Part of flys/issue1168: Make facet names unique. It should help but there must be bug before the facet generation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6101
diff
changeset
|
212 |
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
|
213 final Collection<FixResultColumn> fixEvents = columns.getSortedColumns(); |
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
|
214 for (final FixResultColumn event : fixEvents) { |
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
|
215 |
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
|
216 final int columnId = event.getColumnId(); |
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
|
217 final DoubleRange stationRange = event.getStationRange(); |
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
|
218 |
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
|
219 final Date date = event.getDate(); |
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
|
220 final String dateText = cf.format(date); |
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
|
221 final String facetDescription = i18n_ref + " - " + dateText; |
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
|
222 |
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
|
223 facets.add(new FixReferenceEventsFacet(facetIndex++, columnId, FIX_REFERENCE_EVENTS_DWT, facetDescription, 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
|
224 facets.add(new FixLongitudinalReferenceFacet(facetIndex++, columnId, FIX_REFERENCE_EVENTS_LS, facetDescription)); |
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
|
225 facets.add(new FixReferenceEventsFacet(facetIndex++, columnId, FIX_REFERENCE_EVENTS_WQ, facetDescription, stationRange)); |
3610
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3599
diff
changeset
|
226 } |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
227 |
9082 | 228 facets.add(new FixLongitudinalDeviationFacet(idg.next(), FIX_DEVIATION_LS, i18n_dev)); |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
229 |
9082 | 230 final String i18n_ana = Resources.getMsg(context.getMeta(), I18N_ANALYSISPERIODS, I18N_ANALYSISPERIODS); |
231 facets.add(new FixAnalysisPeriodsFacet(idg.next(), FIX_ANALYSIS_PERIODS_DWT, i18n_ana)); | |
232 facets.add(new FixAnalysisPeriodsFacet(idg.next(), FIX_ANALYSIS_PERIODS_LS, i18n_ana)); | |
233 facets.add(new FixAnalysisPeriodsFacet(idg.next(), FIX_ANALYSIS_PERIODS_WQ, i18n_ana)); | |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
234 |
9082 | 235 final String i18n_refp = Resources.getMsg(context.getMeta(), I18N_REFERENCEPERIOD, I18N_REFERENCEPERIOD); |
236 facets.add(new DataFacet(idg.next(), FIX_REFERENCE_PERIOD_DWT, i18n_refp, ComputeType.ADVANCE, null, null)); | |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
237 facets.add(new FixWQCurveFacet(idg.next(), "W/Q")); |
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
|
238 facets.add(new FixDerivateFacet(idg.next(), FIX_DERIVATE_CURVE, Resources.getMsg(context.getMeta(), I18N_DERIVATIVE, I18N_DERIVATIVE))); |
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
|
239 facets.add(new FixDeviationFacet(idg.next(), FIX_DEVIATION_DWT, Resources.getMsg(context.getMeta(), I18N_DEVIATION, I18N_DEVIATION))); |
3412
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
240 |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
241 return res; |
da000d9513f7
FixA: Renamed FixationCompute to FixAnalysisCompute
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
242 } |
9360
ddcd52d239cd
Outliers in fixation calculation are now shown within the other 'B' event themes and get a separate symbol (triangle).
gernotbelger
parents:
9082
diff
changeset
|
243 } |