Mercurial > dive4elements > river
comparison gwt-client/src/main/java/org/dive4elements/river/client/client/ui/fixation/FixationPanel.java @ 9099:850ce16034e9
2.3.4.1.10 Berechnung mit Start-km > End-km
author | gernotbelger |
---|---|
date | Mon, 28 May 2018 13:22:45 +0200 |
parents | 02739b8c010d |
children | 9be51f776798 |
comparison
equal
deleted
inserted
replaced
9098:32dd7e761e4e | 9099:850ce16034e9 |
---|---|
159 FixationPanel.this.htmlOverview = info.getHTML(); | 159 FixationPanel.this.htmlOverview = info.getHTML(); |
160 final AbstractFixBunduArtifact art = (AbstractFixBunduArtifact) FixationPanel.this.artifact; | 160 final AbstractFixBunduArtifact art = (AbstractFixBunduArtifact) FixationPanel.this.artifact; |
161 final FixFilter filter = art.getFilter(); | 161 final FixFilter filter = art.getFilter(); |
162 filter.setRiver(info.getRiver()); | 162 filter.setRiver(info.getRiver()); |
163 if (filter.getCurrentKm() == -Double.MAX_VALUE || filter.getCurrentKm() == -1d) { | 163 if (filter.getCurrentKm() == -Double.MAX_VALUE || filter.getCurrentKm() == -1d) { |
164 filter.setCurrentKm(info.getFrom()); | 164 filter.setCurrentKm(filter.getLowerKm()); |
165 filter.setToKm(info.getTo()); | 165 filter.setToKm(filter.getUpperKm()); |
166 } | 166 } |
167 if (FixationPanel.this.kmText != null) { | 167 if (FixationPanel.this.kmText != null) { |
168 final NumberFormat nf = NumberFormat.getDecimalFormat(); | 168 final NumberFormat nf = NumberFormat.getDecimalFormat(); |
169 try { | 169 try { |
170 final double d = Double.valueOf(filter.getCurrentKm()); | 170 final double d = Double.valueOf(filter.getCurrentKm()); |
173 catch (final NumberFormatException e) { | 173 catch (final NumberFormatException e) { |
174 FixationPanel.this.kmText.setValue(filter.getCurrentKm()); | 174 FixationPanel.this.kmText.setValue(filter.getCurrentKm()); |
175 } | 175 } |
176 } | 176 } |
177 eventPane.setContents(FixationPanel.this.htmlOverview); | 177 eventPane.setContents(FixationPanel.this.htmlOverview); |
178 updateChartTab(FixationPanel.this.fixInfo.getFrom()); | 178 updateChartTab(FixationPanel.this.fixInfo.getLowerKm()); |
179 FixationPanel.this.events.setPane(eventPane); | 179 FixationPanel.this.events.setPane(eventPane); |
180 success(); | 180 success(); |
181 } | 181 } |
182 }); | 182 }); |
183 | 183 |
259 final Config config = Config.getInstance(); | 259 final Config config = Config.getInstance(); |
260 final String locale = config.getLocale(); | 260 final String locale = config.getLocale(); |
261 | 261 |
262 final AbstractFixBunduArtifact art = (AbstractFixBunduArtifact) this.artifact; | 262 final AbstractFixBunduArtifact art = (AbstractFixBunduArtifact) this.artifact; |
263 | 263 |
264 // was soll das all | |
264 if (this.fixInfo != null) { | 265 if (this.fixInfo != null) { |
265 if (km < this.fixInfo.getFrom()) | 266 if (km < this.fixInfo.getLowerKm()) |
266 km = this.fixInfo.getFrom(); | 267 km = this.fixInfo.getLowerKm(); |
267 if (km > this.fixInfo.getTo()) | 268 // if (km > this.fixInfo.getTo()) |
268 km = this.fixInfo.getTo(); | 269 // km = this.fixInfo.getTo(); |
269 } | 270 } |
270 | 271 |
271 final FixFilter filter = art.getFilter(); | 272 final FixFilter filter = art.getFilter(); |
272 | 273 |
273 if (km < filter.getFromKm()) | 274 if (km < filter.getLowerKm()) |
274 km = filter.getFromKm(); | 275 km = filter.getLowerKm(); |
275 if (km > filter.getToKm()) | 276 if (km > filter.getUpperKm()) |
276 km = filter.getToKm(); | 277 km = filter.getUpperKm(); |
277 | 278 |
278 filter.setCurrentKm(km); | 279 filter.setCurrentKm(km); |
279 | 280 |
280 int hWidth = this.helperContainer.getWidth() - 12; | 281 int hWidth = this.helperContainer.getWidth() - 12; |
281 int hHeight = this.helperContainer.getHeight() - 62; | 282 int hHeight = this.helperContainer.getHeight() - 62; |
305 final AbstractFixBunduArtifact art = (AbstractFixBunduArtifact) this.artifact; | 306 final AbstractFixBunduArtifact art = (AbstractFixBunduArtifact) this.artifact; |
306 | 307 |
307 final FixFilter filter = art.getFilter(); | 308 final FixFilter filter = art.getFilter(); |
308 | 309 |
309 final double curr = filter.getCurrentKm(); | 310 final double curr = filter.getCurrentKm(); |
310 if (curr > filter.getFromKm()) { | 311 if (curr > filter.getLowerKm()) { |
311 final double newVal = (curr - 0.1) * 10; | 312 final double newVal = (curr - 0.1) * 10; |
312 final long round = Math.round(newVal); | 313 final long round = Math.round(newVal); |
313 updateChartTab(((double) round) / 10); | 314 updateChartTab(((double) round) / 10); |
314 } | 315 } |
315 return filter; | 316 return filter; |
319 final AbstractFixBunduArtifact art = (AbstractFixBunduArtifact) this.artifact; | 320 final AbstractFixBunduArtifact art = (AbstractFixBunduArtifact) this.artifact; |
320 | 321 |
321 final FixFilter filter = art.getFilter(); | 322 final FixFilter filter = art.getFilter(); |
322 | 323 |
323 final double curr = filter.getCurrentKm(); | 324 final double curr = filter.getCurrentKm(); |
324 if (curr < filter.getToKm()) { | 325 if (curr < filter.getUpperKm()) { |
325 final double newVal = (curr + 0.1) * 10; | 326 final double newVal = (curr + 0.1) * 10; |
326 final long round = Math.round(newVal); | 327 final long round = Math.round(newVal); |
327 updateChartTab(((double) round) / 10); | 328 updateChartTab(((double) round) / 10); |
328 } | 329 } |
329 return filter; | 330 return filter; |
381 } | 382 } |
382 | 383 |
383 public String getChartFilter(final FixFilter filter, final int width, final int height) { | 384 public String getChartFilter(final FixFilter filter, final int width, final int height) { |
384 final String river = filter.getRiver(); | 385 final String river = filter.getRiver(); |
385 final double currentKm = filter.getCurrentKm(); | 386 final double currentKm = filter.getCurrentKm(); |
386 final double fromKm = filter.getFromKm(); | 387 final double fromKm = filter.getLowerKm(); |
387 final double toKm = filter.getToKm(); | 388 final double toKm = filter.getUpperKm(); |
388 | 389 |
389 if (river != null && river.length() > 0 && currentKm >= fromKm && currentKm <= toKm) { | 390 if (river != null && river.length() > 0 && currentKm >= fromKm && currentKm <= toKm) { |
390 final JSONObject jfix = new JSONObject(); | 391 final JSONObject jfix = new JSONObject(); |
391 final JSONObject jfilter = new JSONObject(); | 392 final JSONObject jfilter = new JSONObject(); |
392 final JSONObject jrName = new JSONObject(); | 393 final JSONObject jrName = new JSONObject(); |
409 } | 410 } |
410 return ""; | 411 return ""; |
411 } | 412 } |
412 | 413 |
413 protected static JSONObject createFilter(final FixFilter filter, final JSONObject root) { | 414 protected static JSONObject createFilter(final FixFilter filter, final JSONObject root) { |
414 final double fromKm = filter.getFromKm(); | 415 final double fromKm = filter.getLowerKm(); |
415 final double toKm = filter.getToKm(); | 416 final double toKm = filter.getUpperKm(); |
416 final boolean hasDate = filter.hasDate(); | 417 final boolean hasDate = filter.hasDate(); |
417 | 418 |
418 if (fromKm >= 0 && toKm >= 0 && fromKm <= toKm) { | 419 if (fromKm >= 0 && toKm >= 0 && fromKm <= toKm) { |
419 final JSONObject range = new JSONObject(); | 420 final JSONObject range = new JSONObject(); |
420 final JSONObject fromtokm = new JSONObject(); | 421 final JSONObject fromtokm = new JSONObject(); |