annotate artifacts/src/main/java/org/dive4elements/river/artifacts/states/LocationDistanceSelect.java @ 8490:07df414d5d88

Removed obsolete imports.
author Sascha L. Teichmann <teichmann@intevation.de>
date Tue, 02 Dec 2014 17:51:56 +0100
parents e3e5d6bb4902
children 34dc0163ad2d 0a5239a1e46e
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: 4043
diff changeset
9 package org.dive4elements.river.artifacts.states;
136
2e510c998adb New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
2e510c998adb New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import org.apache.log4j.Logger;
2e510c998adb New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4043
diff changeset
13 import org.dive4elements.artifacts.Artifact;
136
2e510c998adb New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4043
diff changeset
15 import org.dive4elements.artifactdatabase.data.StateData;
313
89bd0417418f The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 136
diff changeset
16
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
17 import org.dive4elements.river.artifacts.D4EArtifact;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4043
diff changeset
18 import org.dive4elements.river.artifacts.WINFOArtifact;
697
b972eba2ed8a Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 692
diff changeset
19
8451
e3e5d6bb4902 (issue1733) Use rangeaccess to access range information in location select
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8202
diff changeset
20 import org.dive4elements.river.artifacts.access.RangeAccess;
e3e5d6bb4902 (issue1733) Use rangeaccess to access range information in location select
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8202
diff changeset
21
136
2e510c998adb New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22
2e510c998adb New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 /**
2e510c998adb New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
2e510c998adb New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 */
742
c09c9e05ecfa Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 722
diff changeset
26 public class LocationDistanceSelect
921
610d0e0f4f85 #159 Modifications in the transition model to support a state with a kilometer range input only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
27 extends ComputationRangeState
721
7298d58a1f5a Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 705
diff changeset
28 {
136
2e510c998adb New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
30 /** The log used in this class. */
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
31 private static Logger log = Logger.getLogger(LocationDistanceSelect.class);
136
2e510c998adb New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32
627
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
33 /** The name of the 'mode' field. */
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
34 public static final String MODE = "ld_mode";
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
35
2235
ee5310134463 Cosmetics/care/refac.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1838
diff changeset
36 /** The name of the 'locations' field. */
627
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
37 public static final String LOCATIONS = "ld_locations";
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
38
322
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
39
136
2e510c998adb New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 /**
2e510c998adb New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 * The default constructor that initializes an empty State object.
2e510c998adb New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 */
2e510c998adb New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 public LocationDistanceSelect() {
2e510c998adb New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 }
2e510c998adb New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45
2e510c998adb New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46
660
627be3ca1ab6 code clean up in states
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 629
diff changeset
47 @Override
136
2e510c998adb New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 protected String getUIProvider() {
2e510c998adb New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 return "location_distance_panel";
2e510c998adb New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 }
313
89bd0417418f The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 136
diff changeset
51
89bd0417418f The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 136
diff changeset
52
3265
c1f445b94d03 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2235
diff changeset
53 /** Validates the range (or location). */
322
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
54 @Override
1050
eccf966fb677 State engine: Removed CallContext from state validation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 921
diff changeset
55 public boolean validate(Artifact artifact)
322
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
56 throws IllegalArgumentException
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
57 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
58 log.debug("LocationDistanceSelect.validate");
322
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
59
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
60 D4EArtifact flys = (D4EArtifact)artifact;
3628
7467b091fb8e Refactored location/distance state to use FLYSArtifact instead of WINFOArtifact.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3265
diff changeset
61 StateData mode = getData(flys, MODE);
7467b091fb8e Refactored location/distance state to use FLYSArtifact instead of WINFOArtifact.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3265
diff changeset
62 String mValue = mode != null ? (String)mode.getValue() : null;
7467b091fb8e Refactored location/distance state to use FLYSArtifact instead of WINFOArtifact.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3265
diff changeset
63 if (mValue != null) {
7467b091fb8e Refactored location/distance state to use FLYSArtifact instead of WINFOArtifact.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3265
diff changeset
64 if (mValue.equals("distance")) {
7467b091fb8e Refactored location/distance state to use FLYSArtifact instead of WINFOArtifact.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3265
diff changeset
65 return super.validate(flys);
7467b091fb8e Refactored location/distance state to use FLYSArtifact instead of WINFOArtifact.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3265
diff changeset
66 }
7467b091fb8e Refactored location/distance state to use FLYSArtifact instead of WINFOArtifact.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3265
diff changeset
67 else {
7467b091fb8e Refactored location/distance state to use FLYSArtifact instead of WINFOArtifact.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3265
diff changeset
68 return validateLocations(flys);
7467b091fb8e Refactored location/distance state to use FLYSArtifact instead of WINFOArtifact.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3265
diff changeset
69 }
627
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
70 }
3628
7467b091fb8e Refactored location/distance state to use FLYSArtifact instead of WINFOArtifact.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3265
diff changeset
71 return false;
627
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
72 }
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
73
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
74
4043
eb5564662e19 Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3628
diff changeset
75 /** Validate selected locations. */
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
76 protected boolean validateLocations(D4EArtifact flys)
627
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
77 throws IllegalArgumentException
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
78 {
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
79 StateData dValues = getData(flys, LOCATIONS);
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
80 String values = dValues != null ? (String)dValues.getValue() : null;
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
81
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
82 if (values == null || values.length() == 0) {
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
83 throw new IllegalArgumentException("error_empty_state");
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
84 }
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
85
921
610d0e0f4f85 #159 Modifications in the transition model to support a state with a kilometer range input only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
86 double[] absMinMax = getMinMax(flys);
627
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
87 double[] relMinMax = getMinMaxFromString(values);
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
88
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
89 if (relMinMax[0] < absMinMax[0] || relMinMax[0] > absMinMax[1]) {
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
90 throw new IllegalArgumentException("error_feed_from_out_of_range");
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
91 }
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
92
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
93 if (relMinMax[1] > absMinMax[1] || relMinMax[1] < absMinMax[0]) {
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
94 throw new IllegalArgumentException("error_feed_to_out_of_range");
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
95 }
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
96
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
97 return true;
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
98 }
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
99
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
100
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
101 /**
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
102 * Extracts the min/max values from String <i>s</i>. An
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
103 * IllegalArgumentException is thrown if there is a value that throws a
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
104 * NumberFormatException.
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
105 *
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
106 * @param s String that contains whitespace separated double values.
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
107 *
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
108 * @return a 2dmin array [min,max].
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
109 */
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
110 public static double[] getMinMaxFromString(String s)
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
111 throws IllegalArgumentException
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
112 {
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
113 String[] values = s.split(" ");
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
114
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
115 double[] minmax = new double[] {
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
116 Double.MAX_VALUE,
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
117 -Double.MAX_VALUE };
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
118
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
119 for (String v: values) {
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
120 try {
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
121 double value = Double.valueOf(v);
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
122
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
123 minmax[0] = minmax[0] < value ? minmax[0] : value;
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
124 minmax[1] = minmax[1] > value ? minmax[1] : value;
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
125 }
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
126 catch (NumberFormatException nfe) {
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
127 throw new IllegalArgumentException(
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
128 "error_invalid_double_value");
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
129 }
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
130 }
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
131
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
132 return minmax;
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
133 }
628
51b69bca4560 ISSUE-85 (part III/III) Use the given kilometer values for the waterlevel computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 627
diff changeset
134
51b69bca4560 ISSUE-85 (part III/III) Use the given kilometer values for the waterlevel computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 627
diff changeset
135
1055
61c051e53f9b Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1051
diff changeset
136 public static double[] getLocations(WINFOArtifact flys) {
8451
e3e5d6bb4902 (issue1733) Use rangeaccess to access range information in location select
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8202
diff changeset
137 RangeAccess ra = new RangeAccess(flys);
e3e5d6bb4902 (issue1733) Use rangeaccess to access range information in location select
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8202
diff changeset
138 return ra.getLocations();
628
51b69bca4560 ISSUE-85 (part III/III) Use the given kilometer values for the waterlevel computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 627
diff changeset
139 }
136
2e510c998adb New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140 }
2e510c998adb New state for the location/distance input and some litte modifications of the DefaultState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org