Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/states/WDifferencesState.java @ 9053:ad2ae847e10e
- RadioButton-Auswahl generisch
- Überflutungsdauern (inudation of infrastructures) Ablauf states
author | gernotbelger |
---|---|
date | Fri, 04 May 2018 13:17:57 +0200 |
parents | 6b93a2498e06 |
children | 3f49835a00c3 |
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:
4054
diff
changeset
|
9 package org.dive4elements.river.artifacts.states; |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 |
1643
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
11 import java.util.ArrayList; |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 import java.util.List; |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 import org.apache.log4j.Logger; |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4054
diff
changeset
|
16 import org.dive4elements.artifactdatabase.state.Facet; |
7792
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
17 import org.dive4elements.artifactdatabase.state.FacetActivity; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4054
diff
changeset
|
18 import org.dive4elements.artifactdatabase.data.StateData; |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4054
diff
changeset
|
20 import org.dive4elements.artifacts.CallContext; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4054
diff
changeset
|
21 import org.dive4elements.artifacts.Artifact; |
8547
04367906f158
(issue1754) Add distantce handling to WINFO differences state
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8546
diff
changeset
|
22 import org.dive4elements.river.artifacts.access.RangeAccess; |
6582
7216143665d9
issue1394, issue1366: Prepare difference state to handle other artifacts, esp.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6573
diff
changeset
|
23 import org.dive4elements.river.artifacts.ChartArtifact; |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5865
diff
changeset
|
24 import org.dive4elements.river.artifacts.D4EArtifact; |
6582
7216143665d9
issue1394, issue1366: Prepare difference state to handle other artifacts, esp.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6573
diff
changeset
|
25 import org.dive4elements.river.artifacts.FixationArtifact; |
7216143665d9
issue1394, issue1366: Prepare difference state to handle other artifacts, esp.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6573
diff
changeset
|
26 import org.dive4elements.river.artifacts.MINFOArtifact; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4054
diff
changeset
|
27 import org.dive4elements.river.artifacts.StaticWKmsArtifact; |
8876
23264d1a528f
Allow access to staticwqkms data; also allow to acces by km range
gernotbelger
parents:
8860
diff
changeset
|
28 import org.dive4elements.river.artifacts.StaticWQKmsArtifact; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4054
diff
changeset
|
29 import org.dive4elements.river.artifacts.WINFOArtifact; |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4054
diff
changeset
|
31 import org.dive4elements.river.artifacts.math.WKmsOperation; |
2136
3a5ef4ac8e0f
'New Chart' for w-differences curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1886
diff
changeset
|
32 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4054
diff
changeset
|
33 import org.dive4elements.river.artifacts.model.CalculationResult; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4054
diff
changeset
|
34 import org.dive4elements.river.artifacts.model.DataFacet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4054
diff
changeset
|
35 import org.dive4elements.river.artifacts.model.DifferenceCurveFacet; |
7792
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
36 import org.dive4elements.river.artifacts.model.DifferenceCurveFilterFacet; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4054
diff
changeset
|
37 import org.dive4elements.river.artifacts.model.EmptyFacet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4054
diff
changeset
|
38 import org.dive4elements.river.artifacts.model.FacetTypes; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4054
diff
changeset
|
39 import org.dive4elements.river.artifacts.model.WKms; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4054
diff
changeset
|
40 import org.dive4elements.river.artifacts.model.WQKms; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4054
diff
changeset
|
41 |
6582
7216143665d9
issue1394, issue1366: Prepare difference state to handle other artifacts, esp.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6573
diff
changeset
|
42 import org.dive4elements.river.artifacts.model.fixings.FixRealizingResult; |
7792
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
43 import org.dive4elements.river.artifacts.resources.Resources; |
6582
7216143665d9
issue1394, issue1366: Prepare difference state to handle other artifacts, esp.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6573
diff
changeset
|
44 |
5865
73da40528cf2
River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
45 import org.dive4elements.river.utils.RiverUtils; |
8186
a1ceacf15d3a
Removed NASTY package clash. We had too org.dive4elements.river.util packages.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7792
diff
changeset
|
46 import org.dive4elements.river.backend.utils.StringUtil; |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 |
6573
7d86ed4537d9
Cosmetics, doc, obsolete import removal.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5994
diff
changeset
|
48 /** State of a WINFOArtifact to get differences of data of other artifacts. */ |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 public class WDifferencesState |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 extends DefaultState |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 implements FacetTypes |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8186
diff
changeset
|
53 /** The log that is used in this state. */ |
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8186
diff
changeset
|
54 private static Logger log = Logger.getLogger(WDifferencesState.class); |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 |
7792
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
56 private static final String I18N_DIFFERENCES_FACET_NAME = |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
57 "facet.w_differences"; |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
58 private static final String I18N_DIFFERENCES_FACET_NAME_RAW = |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
59 "facet.w_differences.raw"; |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
60 |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
61 static { |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
62 // Active/deactivate facets. |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
63 FacetActivity.Registry.getInstance().register( |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
64 "winfo", |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
65 new FacetActivity() { |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
66 @Override |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
67 public Boolean isInitialActive( |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
68 Artifact artifact, |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
69 Facet facet, |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
70 String output |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
71 ) { |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
72 String name = facet.getName(); |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
73 |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
74 if (name.equals(FacetTypes.W_DIFFERENCES)) { |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
75 return Boolean.FALSE; |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
76 } |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
77 return Boolean.TRUE; |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
78 } |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
79 }); |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
80 } |
1173
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1161
diff
changeset
|
81 |
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1161
diff
changeset
|
82 /** Specify to display nothing (this is kind of a "final" state). */ |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
83 @Override |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
84 protected String getUIProvider() { |
1173
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1161
diff
changeset
|
85 return "noinput"; |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
86 } |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
87 |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
88 |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
89 @Override |
1183
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
90 public boolean validate(Artifact artifact) |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
91 throws IllegalArgumentException |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
92 { |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5865
diff
changeset
|
93 D4EArtifact flys = (D4EArtifact) artifact; |
7029
a3d4153afb16
issue1470: Make validate of WDifferencesState return true if in "new chart".
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6618
diff
changeset
|
94 if (artifact instanceof ChartArtifact) { |
a3d4153afb16
issue1470: Make validate of WDifferencesState return true if in "new chart".
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6618
diff
changeset
|
95 return true; |
a3d4153afb16
issue1470: Make validate of WDifferencesState return true if in "new chart".
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6618
diff
changeset
|
96 } |
1183
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
97 |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
98 StateData data = flys.getData("diffids"); |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
99 |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
100 if (data == null) { |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
101 throw new IllegalArgumentException("diffids is empty"); |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
102 } |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
103 |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
104 // TODO: Also validate format. |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
105 |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
106 return true; |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
107 } |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
108 |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
109 |
3122
721298eeb694
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3076
diff
changeset
|
110 /** |
6582
7216143665d9
issue1394, issue1366: Prepare difference state to handle other artifacts, esp.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6573
diff
changeset
|
111 * Access the data (wkms) of an artifact, coded in mingle. |
3122
721298eeb694
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3076
diff
changeset
|
112 */ |
8853 | 113 // FIXME: meanwhile used by several places outside this context; refactor into separate helper class to access waterlevels |
8881
6b93a2498e06
Slightly better abstraction for extraction waterlevels via datacage
gernotbelger
parents:
8876
diff
changeset
|
114 // FIXME: use org.dive4elements.river.artifacts.states.WaterlevelFetcher instead |
8856 | 115 public WKms getWKms( |
116 String mingle, | |
117 CallContext context, | |
118 double from, | |
119 double to | |
120 ) { | |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8186
diff
changeset
|
121 log.debug("WDifferencesState.getWKms " + mingle); |
1732
1a57027286ce
Handle StaticWKmsArtifacts in WDifferencesState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1696
diff
changeset
|
122 String[] def = mingle.split(";"); |
1a57027286ce
Handle StaticWKmsArtifacts in WDifferencesState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1696
diff
changeset
|
123 String uuid = def[0]; |
1a57027286ce
Handle StaticWKmsArtifacts in WDifferencesState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1696
diff
changeset
|
124 String name = def[1]; |
1a57027286ce
Handle StaticWKmsArtifacts in WDifferencesState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1696
diff
changeset
|
125 int idx = Integer.parseInt(def[2]); |
6582
7216143665d9
issue1394, issue1366: Prepare difference state to handle other artifacts, esp.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6573
diff
changeset
|
126 D4EArtifact d4eArtifact = RiverUtils.getArtifact( |
1732
1a57027286ce
Handle StaticWKmsArtifacts in WDifferencesState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1696
diff
changeset
|
127 uuid, |
1a57027286ce
Handle StaticWKmsArtifacts in WDifferencesState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1696
diff
changeset
|
128 context); |
1a57027286ce
Handle StaticWKmsArtifacts in WDifferencesState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1696
diff
changeset
|
129 |
6582
7216143665d9
issue1394, issue1366: Prepare difference state to handle other artifacts, esp.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6573
diff
changeset
|
130 if (d4eArtifact == null) { |
8856 | 131 log.warn("One of the artifacts (1) for diff calculation " |
132 + "could not be loaded"); | |
1732
1a57027286ce
Handle StaticWKmsArtifacts in WDifferencesState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1696
diff
changeset
|
133 return null; |
1a57027286ce
Handle StaticWKmsArtifacts in WDifferencesState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1696
diff
changeset
|
134 } |
6582
7216143665d9
issue1394, issue1366: Prepare difference state to handle other artifacts, esp.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6573
diff
changeset
|
135 |
8552
fa57a2cb1dfa
(issue1754) Add km filtering for winfo anf fixanal results in difference calculations
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8547
diff
changeset
|
136 WKms retval = null; |
8547
04367906f158
(issue1754) Add distantce handling to WINFO differences state
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8546
diff
changeset
|
137 if (d4eArtifact instanceof StaticWKmsArtifact) { |
04367906f158
(issue1754) Add distantce handling to WINFO differences state
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8546
diff
changeset
|
138 StaticWKmsArtifact staticWKms = (StaticWKmsArtifact) d4eArtifact; |
04367906f158
(issue1754) Add distantce handling to WINFO differences state
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8546
diff
changeset
|
139 log.debug("WDifferencesState obtain data from StaticWKms"); |
04367906f158
(issue1754) Add distantce handling to WINFO differences state
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8546
diff
changeset
|
140 WKms wkms = staticWKms.getWKms(idx, from, to); |
04367906f158
(issue1754) Add distantce handling to WINFO differences state
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8546
diff
changeset
|
141 if (wkms == null) { |
04367906f158
(issue1754) Add distantce handling to WINFO differences state
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8546
diff
changeset
|
142 log.error("No WKms from Static artifact for this range."); |
8876
23264d1a528f
Allow access to staticwqkms data; also allow to acces by km range
gernotbelger
parents:
8860
diff
changeset
|
143 // FIXME: why does in error case we return Q's? |
23264d1a528f
Allow access to staticwqkms data; also allow to acces by km range
gernotbelger
parents:
8860
diff
changeset
|
144 return new WQKms(); |
23264d1a528f
Allow access to staticwqkms data; also allow to acces by km range
gernotbelger
parents:
8860
diff
changeset
|
145 } |
23264d1a528f
Allow access to staticwqkms data; also allow to acces by km range
gernotbelger
parents:
8860
diff
changeset
|
146 return wkms; /* No need for additional km filtering */ |
23264d1a528f
Allow access to staticwqkms data; also allow to acces by km range
gernotbelger
parents:
8860
diff
changeset
|
147 } else if (d4eArtifact instanceof StaticWQKmsArtifact) { |
23264d1a528f
Allow access to staticwqkms data; also allow to acces by km range
gernotbelger
parents:
8860
diff
changeset
|
148 final StaticWQKmsArtifact staticWKms = (StaticWQKmsArtifact) d4eArtifact; |
23264d1a528f
Allow access to staticwqkms data; also allow to acces by km range
gernotbelger
parents:
8860
diff
changeset
|
149 log.debug("WDifferencesState obtain data from StaticWQKms"); |
23264d1a528f
Allow access to staticwqkms data; also allow to acces by km range
gernotbelger
parents:
8860
diff
changeset
|
150 WQKms wkms = staticWKms.getWQKms(from, to); |
23264d1a528f
Allow access to staticwqkms data; also allow to acces by km range
gernotbelger
parents:
8860
diff
changeset
|
151 if (wkms == null) { |
23264d1a528f
Allow access to staticwqkms data; also allow to acces by km range
gernotbelger
parents:
8860
diff
changeset
|
152 log.error("No WKms from Static artifact for this range."); |
8547
04367906f158
(issue1754) Add distantce handling to WINFO differences state
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8546
diff
changeset
|
153 return new WQKms(); |
04367906f158
(issue1754) Add distantce handling to WINFO differences state
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8546
diff
changeset
|
154 } |
8552
fa57a2cb1dfa
(issue1754) Add km filtering for winfo anf fixanal results in difference calculations
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8547
diff
changeset
|
155 return wkms; /* No need for additional km filtering */ |
8547
04367906f158
(issue1754) Add distantce handling to WINFO differences state
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8546
diff
changeset
|
156 } else if (d4eArtifact instanceof WINFOArtifact) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8186
diff
changeset
|
157 log.debug("Get WKms from WINFOArtifact"); |
6582
7216143665d9
issue1394, issue1366: Prepare difference state to handle other artifacts, esp.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6573
diff
changeset
|
158 WINFOArtifact flys = (WINFOArtifact) d4eArtifact; |
7216143665d9
issue1394, issue1366: Prepare difference state to handle other artifacts, esp.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6573
diff
changeset
|
159 |
6618
e8e76d50d119
issue1399: Use WKms instead of WQKms object, as W-Difference artifact themselves
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6582
diff
changeset
|
160 WKms[] wkms = (WKms[]) flys.getWaterlevelData(context). |
1732
1a57027286ce
Handle StaticWKmsArtifacts in WDifferencesState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1696
diff
changeset
|
161 getData(); |
6618
e8e76d50d119
issue1399: Use WKms instead of WQKms object, as W-Difference artifact themselves
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6582
diff
changeset
|
162 if (wkms == null || wkms.length == 0) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8186
diff
changeset
|
163 log.warn("no waterlevels in artifact"); |
8881
6b93a2498e06
Slightly better abstraction for extraction waterlevels via datacage
gernotbelger
parents:
8876
diff
changeset
|
164 // FIXME: fall through will lead to exception... |
6582
7216143665d9
issue1394, issue1366: Prepare difference state to handle other artifacts, esp.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6573
diff
changeset
|
165 } |
6618
e8e76d50d119
issue1399: Use WKms instead of WQKms object, as W-Difference artifact themselves
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6582
diff
changeset
|
166 else if (wkms.length < idx+1) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8186
diff
changeset
|
167 log.warn("Not enough waterlevels in artifact."); |
8552
fa57a2cb1dfa
(issue1754) Add km filtering for winfo anf fixanal results in difference calculations
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8547
diff
changeset
|
168 retval = new WQKms(); |
6582
7216143665d9
issue1394, issue1366: Prepare difference state to handle other artifacts, esp.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6573
diff
changeset
|
169 } |
8552
fa57a2cb1dfa
(issue1754) Add km filtering for winfo anf fixanal results in difference calculations
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8547
diff
changeset
|
170 retval = wkms[idx]; |
8547
04367906f158
(issue1754) Add distantce handling to WINFO differences state
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8546
diff
changeset
|
171 } else if (d4eArtifact instanceof MINFOArtifact) { |
8546
522f72f43ae6
Warn for not implemented difference handling of minfo artifacts.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8202
diff
changeset
|
172 log.warn("Get WKms from MINFOArtifact not implemented!"); |
522f72f43ae6
Warn for not implemented difference handling of minfo artifacts.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8202
diff
changeset
|
173 // CalculationResult r = (CalculationResult) |
522f72f43ae6
Warn for not implemented difference handling of minfo artifacts.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8202
diff
changeset
|
174 // d4eArtifact.compute(context, ComputeType.ADVANCE, false); |
8547
04367906f158
(issue1754) Add distantce handling to WINFO differences state
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8546
diff
changeset
|
175 } else if (d4eArtifact instanceof FixationArtifact) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8186
diff
changeset
|
176 log.debug ("Get WKms from FixationArtifact."); |
6582
7216143665d9
issue1394, issue1366: Prepare difference state to handle other artifacts, esp.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6573
diff
changeset
|
177 CalculationResult r = (CalculationResult) |
7216143665d9
issue1394, issue1366: Prepare difference state to handle other artifacts, esp.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6573
diff
changeset
|
178 d4eArtifact.compute(context, ComputeType.ADVANCE, false); |
7216143665d9
issue1394, issue1366: Prepare difference state to handle other artifacts, esp.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6573
diff
changeset
|
179 FixRealizingResult frR = (FixRealizingResult) r.getData(); |
8552
fa57a2cb1dfa
(issue1754) Add km filtering for winfo anf fixanal results in difference calculations
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8547
diff
changeset
|
180 retval = frR.getWQKms()[idx]; |
6582
7216143665d9
issue1394, issue1366: Prepare difference state to handle other artifacts, esp.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6573
diff
changeset
|
181 } |
7216143665d9
issue1394, issue1366: Prepare difference state to handle other artifacts, esp.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6573
diff
changeset
|
182 |
8552
fa57a2cb1dfa
(issue1754) Add km filtering for winfo anf fixanal results in difference calculations
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8547
diff
changeset
|
183 |
fa57a2cb1dfa
(issue1754) Add km filtering for winfo anf fixanal results in difference calculations
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8547
diff
changeset
|
184 if (retval == null) { |
8856 | 185 log.error( |
186 "Do not know how to handle (getWKms) minuend/subtrahend"); | |
8552
fa57a2cb1dfa
(issue1754) Add km filtering for winfo anf fixanal results in difference calculations
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8547
diff
changeset
|
187 } else if (!Double.isNaN(from) && !Double.isNaN(to)) { |
8856 | 188 /* Filter out only relevant data points for calulation results.*/ |
8552
fa57a2cb1dfa
(issue1754) Add km filtering for winfo anf fixanal results in difference calculations
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8547
diff
changeset
|
189 log.debug("Before filter: " + retval.size()); |
fa57a2cb1dfa
(issue1754) Add km filtering for winfo anf fixanal results in difference calculations
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8547
diff
changeset
|
190 retval = retval.filteredKms(from, to); |
fa57a2cb1dfa
(issue1754) Add km filtering for winfo anf fixanal results in difference calculations
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8547
diff
changeset
|
191 log.debug("After filter: " + retval.size()); |
fa57a2cb1dfa
(issue1754) Add km filtering for winfo anf fixanal results in difference calculations
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8547
diff
changeset
|
192 } |
fa57a2cb1dfa
(issue1754) Add km filtering for winfo anf fixanal results in difference calculations
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8547
diff
changeset
|
193 |
fa57a2cb1dfa
(issue1754) Add km filtering for winfo anf fixanal results in difference calculations
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8547
diff
changeset
|
194 return retval; |
1732
1a57027286ce
Handle StaticWKmsArtifacts in WDifferencesState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1696
diff
changeset
|
195 } |
1a57027286ce
Handle StaticWKmsArtifacts in WDifferencesState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1696
diff
changeset
|
196 |
1a57027286ce
Handle StaticWKmsArtifacts in WDifferencesState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1696
diff
changeset
|
197 |
1643
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
198 /** |
1652
46a2a5dc98b7
In W-Difference-calculation, respect indices of selected facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1643
diff
changeset
|
199 * Return CalculationResult with Array of WKms that are difference of |
46a2a5dc98b7
In W-Difference-calculation, respect indices of selected facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1643
diff
changeset
|
200 * Waterlevels. Add respective facets (DifferencesCurveFacet, DataFacet). |
1643
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
201 */ |
1183
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
202 @Override |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
203 public Object computeAdvance( |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5865
diff
changeset
|
204 D4EArtifact artifact, |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
205 String hash, |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
206 CallContext context, |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
207 List<Facet> facets, |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
208 Object old |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
209 ) { |
2136
3a5ef4ac8e0f
'New Chart' for w-differences curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1886
diff
changeset
|
210 if (artifact instanceof ChartArtifact) { |
3a5ef4ac8e0f
'New Chart' for w-differences curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1886
diff
changeset
|
211 ChartArtifact chart = (ChartArtifact)artifact; |
3a5ef4ac8e0f
'New Chart' for w-differences curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1886
diff
changeset
|
212 facets.add(new EmptyFacet()); |
3a5ef4ac8e0f
'New Chart' for w-differences curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1886
diff
changeset
|
213 return null; |
3a5ef4ac8e0f
'New Chart' for w-differences curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1886
diff
changeset
|
214 } |
1732
1a57027286ce
Handle StaticWKmsArtifacts in WDifferencesState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1696
diff
changeset
|
215 WINFOArtifact winfo = (WINFOArtifact) artifact; |
1173
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1161
diff
changeset
|
216 String id = getID(); |
8547
04367906f158
(issue1754) Add distantce handling to WINFO differences state
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8546
diff
changeset
|
217 RangeAccess rangeAccess = new RangeAccess(artifact); |
8647
5f60bd7c4b42
(issue1754) Simplify code to handle a>b cases.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8608
diff
changeset
|
218 double from = rangeAccess.getFrom(true); |
5f60bd7c4b42
(issue1754) Simplify code to handle a>b cases.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8608
diff
changeset
|
219 double to = rangeAccess.getTo(true); |
1183
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
220 // Load the Artifacts/facets that we want to subtract and display. |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
221 // Expected format is: |
8856 | 222 //[42537f1e-3522-42ef-8968-635b03d8e9c6;longitudinal_section.w;0]#[...] |
1661
a890bf077de5
Use StringUtil.wWrap , fix wrong loop, minor refac and cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1655
diff
changeset
|
223 String diffids = winfo.getDataAsString("diffids"); |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8186
diff
changeset
|
224 log.debug("WDifferencesState has: " + diffids); |
1661
a890bf077de5
Use StringUtil.wWrap , fix wrong loop, minor refac and cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1655
diff
changeset
|
225 String datas[] = diffids.split("#"); |
1183
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
226 |
8608
0f6f702742b4
(issue1754) Check if start > end and handle this
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8552
diff
changeset
|
227 log.debug("Difference from: " + from + " to: " + to); |
0f6f702742b4
(issue1754) Check if start > end and handle this
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8552
diff
changeset
|
228 /* Check if we need to obtain the data in a different order */ |
1183
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
229 // Validate the Data-Strings. |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
230 for (String s: datas) { |
4054
102050c4fc00
fix issue909: strange validation code. be fearles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3122
diff
changeset
|
231 if (!WaterlevelSelectState.isValueValid(s)) { |
1183
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
232 // TODO: escalate. |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
233 } |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
234 } |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
235 |
1626
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
236 if (datas.length < 2) { |
1183
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
237 // TODO crash with style |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
238 } |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
239 |
1643
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
240 List<WKms> wkmss = new ArrayList<WKms>(); |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
241 |
1661
a890bf077de5
Use StringUtil.wWrap , fix wrong loop, minor refac and cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1655
diff
changeset
|
242 for(int i = 0; i < datas.length; i+=2) { |
1652
46a2a5dc98b7
In W-Difference-calculation, respect indices of selected facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1643
diff
changeset
|
243 // e.g.: |
46a2a5dc98b7
In W-Difference-calculation, respect indices of selected facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1643
diff
changeset
|
244 // 42537f1e-3522-42ef-8968-635b03d8e9c6;longitudinal_section.w;1 |
1732
1a57027286ce
Handle StaticWKmsArtifacts in WDifferencesState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1696
diff
changeset
|
245 WKms minuendWKms = getWKms(StringUtil.unbracket(datas[i+0]), |
8647
5f60bd7c4b42
(issue1754) Simplify code to handle a>b cases.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8608
diff
changeset
|
246 context, from, to); |
1732
1a57027286ce
Handle StaticWKmsArtifacts in WDifferencesState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1696
diff
changeset
|
247 WKms subtrahendWKms = getWKms(StringUtil.unbracket(datas[i+1]), |
8647
5f60bd7c4b42
(issue1754) Simplify code to handle a>b cases.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8608
diff
changeset
|
248 context, from, to); |
1732
1a57027286ce
Handle StaticWKmsArtifacts in WDifferencesState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1696
diff
changeset
|
249 |
1626
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
250 String facetName = "diff ()"; |
7792
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
251 String minName = "min"; |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
252 String subName = "sub"; |
1626
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
253 |
1732
1a57027286ce
Handle StaticWKmsArtifacts in WDifferencesState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1696
diff
changeset
|
254 if (minuendWKms != null && subtrahendWKms != null) { |
7792
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
255 minName = StringUtil.wWrap(minuendWKms.getName()); |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
256 subName = StringUtil.wWrap(subtrahendWKms.getName()); |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
257 facetName = minName + " - " + subName; |
1732
1a57027286ce
Handle StaticWKmsArtifacts in WDifferencesState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1696
diff
changeset
|
258 WKms wkms = WKmsOperation.SUBTRACTION.operate(minuendWKms, |
1a57027286ce
Handle StaticWKmsArtifacts in WDifferencesState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1696
diff
changeset
|
259 subtrahendWKms); |
1643
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
260 wkms.setName(facetName); |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
261 wkmss.add(wkms); |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8186
diff
changeset
|
262 log.debug("WKMSSubtraction happened"); |
1626
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
263 } |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
264 if (facets != null) { |
7792
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
265 facets.add(new DifferenceCurveFacet( |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
266 i/2, |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
267 W_DIFFERENCES, |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
268 Resources.getMsg( |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
269 context.getMeta(), |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
270 I18N_DIFFERENCES_FACET_NAME_RAW, |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
271 facetName, |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
272 new Object[] { minName, subName }), |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
273 ComputeType.ADVANCE, |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
274 id, |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
275 hash)); |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
276 facets.add(new DifferenceCurveFilterFacet(i/2, |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
277 W_DIFFERENCES_FILTERED, |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
278 Resources.getMsg( |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
279 context.getMeta(), |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
280 I18N_DIFFERENCES_FACET_NAME, |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
281 facetName, |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
282 new Object[] { minName, subName }), |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
283 ComputeType.ADVANCE, |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
284 id, |
6451970e0562
Add the new difference facet and set facets active/inactive.
Raimund Renkert <rrenkert@intevation.de>
parents:
7697
diff
changeset
|
285 hash)); |
1626
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
286 } |
2180
65b32220f197
Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2136
diff
changeset
|
287 } |
65b32220f197
Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2136
diff
changeset
|
288 |
65b32220f197
Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2136
diff
changeset
|
289 if (facets != null) { |
65b32220f197
Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2136
diff
changeset
|
290 facets.add(new DataFacet(CSV, "CSV data")); |
65b32220f197
Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2136
diff
changeset
|
291 facets.add(new DataFacet(PDF, "PDF data")); |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8186
diff
changeset
|
292 log.debug("Adding facets in WDifferencesState."); |
2180
65b32220f197
Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2136
diff
changeset
|
293 } |
65b32220f197
Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2136
diff
changeset
|
294 else { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8186
diff
changeset
|
295 log.debug("Not adding facets in WDifferencesState."); |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
296 } |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
297 |
1652
46a2a5dc98b7
In W-Difference-calculation, respect indices of selected facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1643
diff
changeset
|
298 // TODO Evaluate whether null is okay as reports. |
1643
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
299 WKms[] diffs = wkmss.toArray(new WKms[wkmss.size()]); |
1652
46a2a5dc98b7
In W-Difference-calculation, respect indices of selected facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1643
diff
changeset
|
300 CalculationResult result = new CalculationResult(diffs, null); |
1643
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
301 return result; |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
302 } |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
303 } |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
304 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |