Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WDifferencesState.java @ 1646:614ffddb860e
Removed superfluous imports
flys-artifacts/trunk@2833 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 27 Sep 2011 10:15:27 +0000 |
parents | ff7bffb7d5f0 |
children | 46a2a5dc98b7 |
rev | line source |
---|---|
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.states; |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
1643
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
3 import java.util.ArrayList; |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 import java.util.List; |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 import org.apache.log4j.Logger; |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 |
1643
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
8 import de.intevation.artifactdatabase.state.Facet; |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
9 import de.intevation.artifactdatabase.data.StateData; |
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 de.intevation.artifacts.CallContext; |
1184
7552ae1061d7
Fix build.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1183
diff
changeset
|
12 import de.intevation.artifacts.Artifact; |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.flys.artifacts.FLYSArtifact; |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.flys.artifacts.WINFOArtifact; |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.flys.artifacts.math.WKmsOperation; |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 |
1643
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
18 import de.intevation.flys.artifacts.model.CalculationResult; |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
19 import de.intevation.flys.artifacts.model.DataFacet; |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
20 import de.intevation.flys.artifacts.model.DifferenceCurveFacet; |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.flys.artifacts.model.FacetTypes; |
1643
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
22 import de.intevation.flys.artifacts.model.WaterlevelFacet; |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 import de.intevation.flys.artifacts.model.WKms; |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.flys.artifacts.model.WQKms; |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 import de.intevation.flys.utils.FLYSUtils; |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 |
1158
fbe18ad4caff
Removed needless imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1153
diff
changeset
|
28 |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 public class WDifferencesState |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 extends DefaultState |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 implements FacetTypes |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 { |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 /** The logger that is used in this state. */ |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 private static Logger logger = Logger.getLogger(WDifferencesState.class); |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 |
1173
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1161
diff
changeset
|
36 |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 public WDifferencesState() { |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 } |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 |
1173
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1161
diff
changeset
|
41 /** 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
|
42 @Override |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 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
|
44 return "noinput"; |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 } |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 @Override |
1183
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
49 public boolean validate(Artifact artifact) |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
50 throws IllegalArgumentException |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
51 { |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
52 FLYSArtifact flys = (FLYSArtifact) artifact; |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
53 |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
54 StateData data = flys.getData("diffids"); |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
55 |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
56 if (data == null) { |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
57 throw new IllegalArgumentException("diffids is empty"); |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
58 } |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
59 |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
60 // TODO: Also validate format. |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
61 |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
62 return true; |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
63 } |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
64 |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
65 |
1643
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
66 /** |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
67 * Return List of WKms that are difference of pairs. |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
68 */ |
1183
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
69 @Override |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
70 public Object computeAdvance( |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 FLYSArtifact artifact, |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 String hash, |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
73 CallContext context, |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
74 List<Facet> facets, |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
75 Object old |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
76 ) { |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
77 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
|
78 String id = getID(); |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
79 |
1183
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
80 // 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
|
81 // Expected format is: |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
82 // [42537f1e-3522-42ef-8968-635b03d8e9c6;longitudinal_section.w;0]#[1231f2-....] |
1184
7552ae1061d7
Fix build.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1183
diff
changeset
|
83 String datas[] = winfo.getDataAsString("diffids").split("#"); |
1183
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
84 |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
85 // Validate the Data-Strings. |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
86 for (String s: datas) { |
1184
7552ae1061d7
Fix build.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1183
diff
changeset
|
87 if (!WaterlevelSelectState.isValueValid(winfo.getDataAsString("diffids"))) { |
1183
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
88 // TODO: escalate. |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
89 } |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
90 } |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
91 |
1626
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
92 if (datas.length < 2) { |
1183
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
93 // TODO crash with style |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
94 ; |
9c1cda9e2bc4
Load given artifacts for w-diff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1173
diff
changeset
|
95 } |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
96 |
1643
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
97 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
|
98 |
1626
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
99 for(int i = 0; i < datas.length /2; i++) { |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
100 String uuid1 = WaterlevelSelectState.strip(datas[i+0]).split(";")[0]; |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
101 String uuid2 = WaterlevelSelectState.strip(datas[i+1]).split(";")[0]; |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
102 |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
103 WINFOArtifact flys1 = (WINFOArtifact) FLYSUtils.getArtifact( |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
104 uuid1, |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
105 context); |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
106 WINFOArtifact flys2 = (WINFOArtifact) FLYSUtils.getArtifact( |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
107 uuid2, |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
108 context); |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
109 |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
110 if (flys1 == null) { |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
111 logger.warn("One of the artifacts (1) for diff calculation could not be loaded"); |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
112 } |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
113 if (flys2 == null) { |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
114 logger.warn("One of the artifacts (2) for diff calculation could not be loaded"); |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
115 } |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
116 // TODO: Issue of multiple results in calculation |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
117 String facetName = "diff ()"; |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
118 |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
119 if (flys1 != null && flys2 != null) { |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
120 // TODO Also check size. |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
121 // TODO Also need index of wqkms. |
1643
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
122 WQKms[] minuend = (WQKms[]) flys1.getWaterlevelData(). |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
123 getData(); |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
124 WQKms[] subtrahend = (WQKms[]) flys2.getWaterlevelData(). |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
125 getData(); |
1626
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
126 |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
127 if (datas.length > 2) { |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
128 logger.error("Cannot keep more than one calculation."); |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
129 } |
1643
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
130 facetName = "W (" + minuend[0].getName() + ") - W (" + subtrahend[0].getName() + ")"; |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
131 WKms wkms = WKmsOperation.SUBTRACTION.operate(minuend[0], subtrahend[0]); |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
132 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
|
133 wkmss.add(wkms); |
1626
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
134 logger.debug("WKMSSubtraction happened"); |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
135 } |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
136 |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
137 if (facets != null) { |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
138 // TODO: pass computetype and state id. |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
139 //, ComputeType.ADVANCE, getID(), hash)); |
1643
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
140 //facets.add(new DataFacet(W_DIFFERENCES, facetName)); |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
141 facets.add(new DifferenceCurveFacet(i, W_DIFFERENCES, facetName, |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
142 ComputeType.ADVANCE, id, hash)); |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
143 //facets.add(new WaterlevelFacet |
1626
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
144 facets.add(new DataFacet(CSV, "CSV data")); |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
145 } |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
146 else { |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
147 logger.debug("Not adding facets in WDifferencesState."); |
b9b47af71564
Preparations for ability to display multiple differences in one plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
148 } |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
149 } |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
150 |
1643
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
151 CalculationResult result = new CalculationResult(); |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
152 WKms[] diffs = wkmss.toArray(new WKms[wkmss.size()]); |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
153 result.setData(diffs); |
ff7bffb7d5f0
Let WDifferences-diagram show more than one difference, if asked to.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1626
diff
changeset
|
154 return result; |
1151
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
155 } |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
156 } |
08048bd090e6
Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
157 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |