Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java @ 1279:af6ad7522351
Bugfix: #336 Improved determination of min/max KM values - code moved to ArtifactDescription.
flys-client/trunk@2861 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 29 Sep 2011 09:14:41 +0000 |
parents | 393e5d37d85d |
children | b9b4d27bcf63 |
comparison
equal
deleted
inserted
replaced
1278:4c3329db2536 | 1279:af6ad7522351 |
---|---|
1334 * current artifact. | 1334 * current artifact. |
1335 * | 1335 * |
1336 * @return a double array with [min, max]. | 1336 * @return a double array with [min, max]. |
1337 */ | 1337 */ |
1338 protected double[] getMinMaxKM(DataList[] data) { | 1338 protected double[] getMinMaxKM(DataList[] data) { |
1339 int num = data != null ? data.length : 0; | 1339 ArtifactDescription adesc = artifact.getArtifactDescription(); |
1340 double[] mm = new double[] { Double.MAX_VALUE, -Double.MAX_VALUE }; | 1340 return adesc.getKMRange(); |
1341 | |
1342 for (int i = 0; i < num; i++) { | |
1343 DataList dl = data[i]; | |
1344 | |
1345 if (dl.getState().equals("state.winfo.location_distance")) { | |
1346 for (int j = 0, n = dl.size(); j < n; j++) { | |
1347 Data d = dl.get(j); | |
1348 | |
1349 String label = d.getLabel(); | |
1350 if (label.equals("ld_step") || label.equals("ld_mode")) { | |
1351 continue; | |
1352 } | |
1353 | |
1354 for (DataItem item: d.getItems()) { | |
1355 String itemValue = item.getStringValue(); | |
1356 | |
1357 try { | |
1358 double v = Double.valueOf(itemValue); | |
1359 | |
1360 mm[0] = mm[0] < v ? mm[0] : v; | |
1361 mm[1] = mm[1] > v ? mm[1] : v; | |
1362 } | |
1363 catch (NumberFormatException nfe) { | |
1364 // do nothing | |
1365 } | |
1366 } | |
1367 } | |
1368 } | |
1369 } | |
1370 | |
1371 return mm; | |
1372 } | 1341 } |
1373 | 1342 |
1374 | 1343 |
1375 /** | 1344 /** |
1376 * Returns the name of the selected river. | 1345 * Returns the name of the selected river. |
1378 * @param data The DataList with all data. | 1347 * @param data The DataList with all data. |
1379 * | 1348 * |
1380 * @return the name of the current river. | 1349 * @return the name of the current river. |
1381 */ | 1350 */ |
1382 protected String getRiverName(DataList[] data) { | 1351 protected String getRiverName(DataList[] data) { |
1383 if (data != null && data.length > 0) { | 1352 ArtifactDescription adesc = artifact.getArtifactDescription(); |
1384 for (int i = 0; i < data.length; i++) { | 1353 return adesc.getRiver(); |
1385 DataList dl = data[i]; | |
1386 | |
1387 if (dl.getState().equals("state.winfo.river")) { | |
1388 for (int j = 0; j < dl.size(); j++) { | |
1389 Data d = dl.get(j); | |
1390 DataItem[] di = d.getItems(); | |
1391 | |
1392 if (di != null && di.length == 1) { | |
1393 return d.getItems()[0].getStringValue(); | |
1394 } | |
1395 } | |
1396 } | |
1397 } | |
1398 } | |
1399 | |
1400 return null; | |
1401 } | 1354 } |
1402 | 1355 |
1403 | 1356 |
1404 protected void fetchWQData() { | 1357 protected void fetchWQData() { |
1405 Config config = Config.getInstance(); | 1358 Config config = Config.getInstance(); |