Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SoundingsSelect.java @ 2716:150dcdefeb7d
Only offer soundings that fit to the current km range in MINFO bed height workflow.
flys-artifacts/trunk@4444 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 18 May 2012 12:44:20 +0000 |
parents | ed612b85fb6d |
children | 4bd3d8bbb60c |
comparison
equal
deleted
inserted
replaced
2715:250a370c377d | 2716:150dcdefeb7d |
---|---|
49 throw new IllegalArgumentException( | 49 throw new IllegalArgumentException( |
50 "Invalid parameter for state: '" + parameterName + "'"); | 50 "Invalid parameter for state: '" + parameterName + "'"); |
51 } | 51 } |
52 | 52 |
53 River river = FLYSUtils.getRiver((FLYSArtifact) artifact); | 53 River river = FLYSUtils.getRiver((FLYSArtifact) artifact); |
54 double lo = ((FLYSArtifact) artifact).getDataAsDouble("ld_from"); | |
55 double hi = ((FLYSArtifact) artifact).getDataAsDouble("ld_to"); | |
56 | |
57 double kmLo = Math.min(lo, hi); | |
58 double kmHi = Math.max(lo, hi); | |
54 | 59 |
55 List<KVP<String, String>> kvp = new ArrayList<KVP<String, String>>(); | 60 List<KVP<String, String>> kvp = new ArrayList<KVP<String, String>>(); |
56 | 61 |
57 appendSingles(river, kvp); | 62 appendSingles(river, kmLo, kmHi, kvp); |
58 appendEpochs(river, kvp); | 63 appendEpochs(river, kmLo, kmHi, kvp); |
59 | 64 |
60 return (KVP<String,String>[]) kvp.toArray(new KVP[kvp.size()]); | 65 return (KVP<String,String>[]) kvp.toArray(new KVP[kvp.size()]); |
61 } | 66 } |
62 | 67 |
63 | 68 |
64 protected void appendSingles(River river, List<KVP<String, String>> kvp) { | 69 protected void appendSingles( |
70 River river, | |
71 double kmLo, | |
72 double kmHi, | |
73 List<KVP<String, String>> kvp | |
74 ) { | |
65 List<BedHeightSingle> singles = | 75 List<BedHeightSingle> singles = |
66 BedHeightSingle.getBedHeightSingles(river); | 76 BedHeightSingle.getBedHeightSingles(river, kmLo, kmHi); |
67 | 77 |
68 if (singles != null) { | 78 if (singles != null) { |
69 for (int i = 0; i < singles.size(); i++) { | 79 for (int i = 0; i < singles.size(); i++) { |
70 BedHeightSingle s = singles.get(i); | 80 BedHeightSingle s = singles.get(i); |
71 | 81 |
76 } | 86 } |
77 } | 87 } |
78 } | 88 } |
79 | 89 |
80 | 90 |
81 protected void appendEpochs(River river, List<KVP<String, String>> kvp) { | 91 protected void appendEpochs( |
92 River river, | |
93 double kmLo, | |
94 double kmHi, | |
95 List<KVP<String, String>> kvp | |
96 ) { | |
82 List<BedHeightEpoch> epochs = | 97 List<BedHeightEpoch> epochs = |
83 BedHeightEpoch.getBedHeightEpochs(river); | 98 BedHeightEpoch.getBedHeightEpochs(river, kmLo, kmHi); |
84 | 99 |
85 if (epochs != null) { | 100 if (epochs != null) { |
86 for (int i = 0; i < epochs.size(); i++) { | 101 for (int i = 0; i < epochs.size(); i++) { |
87 BedHeightEpoch e = epochs.get(i); | 102 BedHeightEpoch e = epochs.get(i); |
88 | 103 |