Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/RangeAccess.java @ 5251:8fa0c522bef3
Improve make_release script to optinally handle tagging and be more generic.
It can now be used to prepare a fully configured version of flys.
There are still some variables to set in the script or to be overwritten by
environment variables.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Tue, 12 Mar 2013 16:52:55 +0100 |
parents | a0949259181e |
children | 14db045d6368 |
rev | line source |
---|---|
4647
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.access; |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
3 import org.apache.log4j.Logger; |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 |
4850
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
5 import gnu.trove.TDoubleArrayList; |
4647
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 import de.intevation.artifacts.CallContext; |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 import de.intevation.flys.artifacts.FLYSArtifact; |
4850
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
8 import de.intevation.flys.artifacts.WINFOArtifact; |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
9 |
4647
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.flys.utils.FLYSUtils; |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 |
4850
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
12 |
4647
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 /** For the moment, light-weight wrapper around FLYSUtils. */ |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 // TODO employ 'Caching' like other Accesses, remove usage of FLYSUtils. |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 public class RangeAccess |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 extends RiverAccess |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 { |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 private static Logger logger = Logger.getLogger(RangeAccess.class); |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 private CallContext context; |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 |
4852
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
22 public static enum KM_MODE { RANGE, LOCATIONS, NONE }; |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
23 |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
24 double[] kmRange; |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
25 |
4824
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
26 Double from; |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
27 |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
28 Double to; |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
29 |
4825
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
30 Double step; |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
31 |
4852
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
32 private KM_MODE mode; |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
33 |
4647
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 public RangeAccess(FLYSArtifact artifact, CallContext context) { |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 super(artifact); |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 this.context = context; |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 } |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 |
4852
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
41 /** Evaluate the ld_mode data of artifact. */ |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
42 public KM_MODE getKmRangeMode() { |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
43 if (mode != null) { |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
44 return mode; |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
45 } |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
46 String modeData = getString("ld_mode"); |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
47 |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
48 if (modeData == null || modeData.length() == 0) { |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
49 mode = KM_MODE.NONE; |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
50 } |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
51 else if (modeData.equals("distance")) { |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
52 mode = KM_MODE.RANGE; |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
53 } |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
54 else if (modeData.equals("locations")) { |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
55 mode = KM_MODE.LOCATIONS; |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
56 } |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
57 else { |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
58 mode = KM_MODE.NONE; |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
59 } |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
60 |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
61 return mode; |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
62 } |
9790a284246c
RangeAccess, FLYSUtils; Moved getKmRangeMode implementation to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4850
diff
changeset
|
63 |
4850
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
64 /** |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
65 * Return sorted array of locations at which stuff was calculated |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
66 * (from ld_locations data), null if not parameterized this way. |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
67 */ |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
68 public double[] getLocations() { |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
69 String locationStr = getString("ld_locations"); |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
70 |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
71 if (locationStr == null || locationStr.length() == 0) { |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
72 if (getArtifact() instanceof WINFOArtifact) { |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
73 WINFOArtifact winfo = (WINFOArtifact) getArtifact(); |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
74 if (winfo.getReferenceStartKm() != null && winfo.getReferenceEndKms() != null) { |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
75 return new double[] |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
76 { |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
77 winfo.getReferenceStartKm().doubleValue(), |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
78 winfo.getReferenceEndKms()[0] |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
79 }; |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
80 } |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
81 } |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
82 return null; |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
83 } |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
84 |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
85 String[] tmp = locationStr.split(" "); |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
86 TDoubleArrayList locations = new TDoubleArrayList(); |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
87 |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
88 for (String l: tmp) { |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
89 try { |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
90 locations.add(Double.parseDouble(l)); |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
91 } |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
92 catch (NumberFormatException nfe) { |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
93 logger.debug(nfe.getLocalizedMessage(), nfe); |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
94 } |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
95 } |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
96 |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
97 locations.sort(); |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
98 |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
99 return locations.toNativeArray(); |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
100 } |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
101 |
c9a27912840d
RangeAccess: Add accidentally omitted implementation of getLocations from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4827
diff
changeset
|
102 |
4827
15e55fdbb402
RangeAccess: Doc and debug.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4825
diff
changeset
|
103 /** Return ld_from data (in km). */ |
4824
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
104 public double getFrom() { |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
105 if (from == null) { |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
106 from = getDouble("ld_from"); |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
107 } |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
108 |
4827
15e55fdbb402
RangeAccess: Doc and debug.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4825
diff
changeset
|
109 if (logger.isDebugEnabled()) { |
15e55fdbb402
RangeAccess: Doc and debug.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4825
diff
changeset
|
110 logger.debug("from: '" + from + "'"); |
15e55fdbb402
RangeAccess: Doc and debug.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4825
diff
changeset
|
111 } |
15e55fdbb402
RangeAccess: Doc and debug.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4825
diff
changeset
|
112 |
4824
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
113 return from.doubleValue(); |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
114 } |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
115 |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
116 |
4827
15e55fdbb402
RangeAccess: Doc and debug.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4825
diff
changeset
|
117 /** Return ld_to data (in km). */ |
4824
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
118 public double getTo() { |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
119 if (to == null) { |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
120 to = getDouble("ld_to"); |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
121 } |
4827
15e55fdbb402
RangeAccess: Doc and debug.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4825
diff
changeset
|
122 |
15e55fdbb402
RangeAccess: Doc and debug.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4825
diff
changeset
|
123 if (logger.isDebugEnabled()) { |
15e55fdbb402
RangeAccess: Doc and debug.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4825
diff
changeset
|
124 logger.debug("to: '" + to + "'"); |
15e55fdbb402
RangeAccess: Doc and debug.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4825
diff
changeset
|
125 } |
15e55fdbb402
RangeAccess: Doc and debug.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4825
diff
changeset
|
126 |
4824
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
127 return to.doubleValue(); |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
128 } |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
129 |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
130 |
4825
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
131 /** Step width for calculation. */ |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
132 public Double getStep() { |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
133 |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
134 if (step == null) { |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
135 step = getDouble("ld_step"); |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
136 } |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
137 |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
138 if (logger.isDebugEnabled()) { |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
139 logger.debug("step: '" + step + "'"); |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
140 } |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
141 |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
142 return step; |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
143 } |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
144 |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
145 |
4647
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
146 /** |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
147 * Get min and max kilometer, independent of parametization |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
148 * (ld_from/to vs ld_locations). |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
149 */ |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
150 public double[] getKmRange() { |
4853
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
151 // TODO store kmRange in field. |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
152 switch (getKmRangeMode()) { |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
153 case RANGE: { |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
154 return getKmFromTo(); |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
155 } |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
156 |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
157 case LOCATIONS: { |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
158 double[] locs = getLocations(); |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
159 // if no locations, nPE. |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
160 if (locs == null) { |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
161 logger.warn("no locations to get km range from."); |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
162 return new double[] { Double.NaN, Double.NaN }; |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
163 } |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
164 return new double[] { locs[0], locs[locs.length-1] }; |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
165 } |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
166 |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
167 case NONE: { |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
168 double[] locs = getLocations(); |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
169 if (locs != null) { |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
170 return new double[] { locs[0], locs[locs.length-1] }; |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
171 } |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
172 else { |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
173 return getKmFromTo(); |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
174 } |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
175 } |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
176 } |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
177 |
a0949259181e
RangeAccess.getKmRange: Extracted from FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4852
diff
changeset
|
178 return new double[] { Double.NaN, Double.NaN }; |
4647
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
179 } |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
180 |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
181 |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
182 public double[] getKmFromTo() { |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
183 return FLYSUtils.getKmFromTo(this.getArtifact()); |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
184 } |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
185 } |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
186 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |