Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/states/WDifferencesState.java @ 8860:28df64078f27
Merge with 0862ea5d66baf60e7eee496d130a35157cc9ec12
author | gernotbelger |
---|---|
date | Fri, 19 Jan 2018 11:23:42 +0100 |
parents | 8c64617a7991 5e38e2924c07 |
children | 23264d1a528f |
comparison
equal
deleted
inserted
replaced
8854:7bbfb24e6eec | 8860:28df64078f27 |
---|---|
108 | 108 |
109 /** | 109 /** |
110 * Access the data (wkms) of an artifact, coded in mingle. | 110 * Access the data (wkms) of an artifact, coded in mingle. |
111 */ | 111 */ |
112 // FIXME: meanwhile used by several places outside this context; refactor into separate helper class to access waterlevels | 112 // FIXME: meanwhile used by several places outside this context; refactor into separate helper class to access waterlevels |
113 public WKms getWKms(String mingle, CallContext context, double from, double to) { | 113 public WKms getWKms( |
114 String mingle, | |
115 CallContext context, | |
116 double from, | |
117 double to | |
118 ) { | |
114 log.debug("WDifferencesState.getWKms " + mingle); | 119 log.debug("WDifferencesState.getWKms " + mingle); |
115 String[] def = mingle.split(";"); | 120 String[] def = mingle.split(";"); |
116 String uuid = def[0]; | 121 String uuid = def[0]; |
117 String name = def[1]; | 122 String name = def[1]; |
118 int idx = Integer.parseInt(def[2]); | 123 int idx = Integer.parseInt(def[2]); |
119 D4EArtifact d4eArtifact = RiverUtils.getArtifact( | 124 D4EArtifact d4eArtifact = RiverUtils.getArtifact( |
120 uuid, | 125 uuid, |
121 context); | 126 context); |
122 | 127 |
123 if (d4eArtifact == null) { | 128 if (d4eArtifact == null) { |
124 log.warn("One of the artifacts (1) for diff calculation could not be loaded"); | 129 log.warn("One of the artifacts (1) for diff calculation " |
130 + "could not be loaded"); | |
125 return null; | 131 return null; |
126 } | 132 } |
127 | 133 |
128 WKms retval = null; | 134 WKms retval = null; |
129 if (d4eArtifact instanceof StaticWKmsArtifact) { | 135 if (d4eArtifact instanceof StaticWKmsArtifact) { |
161 retval = frR.getWQKms()[idx]; | 167 retval = frR.getWQKms()[idx]; |
162 } | 168 } |
163 | 169 |
164 | 170 |
165 if (retval == null) { | 171 if (retval == null) { |
166 log.error("Do not know how to handle (getWKms) minuend/subtrahend"); | 172 log.error( |
173 "Do not know how to handle (getWKms) minuend/subtrahend"); | |
167 } else if (!Double.isNaN(from) && !Double.isNaN(to)) { | 174 } else if (!Double.isNaN(from) && !Double.isNaN(to)) { |
168 /* Filter out only the relevant data points for calulation results.*/ | 175 /* Filter out only relevant data points for calulation results.*/ |
169 log.debug("Before filter: " + retval.size()); | 176 log.debug("Before filter: " + retval.size()); |
170 retval = retval.filteredKms(from, to); | 177 retval = retval.filteredKms(from, to); |
171 log.debug("After filter: " + retval.size()); | 178 log.debug("After filter: " + retval.size()); |
172 } | 179 } |
173 | 180 |
197 RangeAccess rangeAccess = new RangeAccess(artifact); | 204 RangeAccess rangeAccess = new RangeAccess(artifact); |
198 double from = rangeAccess.getFrom(true); | 205 double from = rangeAccess.getFrom(true); |
199 double to = rangeAccess.getTo(true); | 206 double to = rangeAccess.getTo(true); |
200 // Load the Artifacts/facets that we want to subtract and display. | 207 // Load the Artifacts/facets that we want to subtract and display. |
201 // Expected format is: | 208 // Expected format is: |
202 // [42537f1e-3522-42ef-8968-635b03d8e9c6;longitudinal_section.w;0]#[1231f2-....] | 209 //[42537f1e-3522-42ef-8968-635b03d8e9c6;longitudinal_section.w;0]#[...] |
203 String diffids = winfo.getDataAsString("diffids"); | 210 String diffids = winfo.getDataAsString("diffids"); |
204 log.debug("WDifferencesState has: " + diffids); | 211 log.debug("WDifferencesState has: " + diffids); |
205 String datas[] = diffids.split("#"); | 212 String datas[] = diffids.split("#"); |
206 | 213 |
207 log.debug("Difference from: " + from + " to: " + to); | 214 log.debug("Difference from: " + from + " to: " + to); |