Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/DistanceOnlyPartHistoricalSelect.java @ 9391:2da486c7c05f
salix historical sounding workflow changed
author | gernotbelger |
---|---|
date | Thu, 09 Aug 2018 17:25:13 +0200 |
parents | e014eca211a3 |
children | 6dd539efebb1 |
comparison
equal
deleted
inserted
replaced
9390:f575ff573cbb | 9391:2da486c7c05f |
---|---|
6 * documentation coming with Dive4Elements River for details. | 6 * documentation coming with Dive4Elements River for details. |
7 */ | 7 */ |
8 | 8 |
9 package org.dive4elements.river.artifacts.uinfo.salix; | 9 package org.dive4elements.river.artifacts.uinfo.salix; |
10 | 10 |
11 import java.util.ArrayList; | |
11 import java.util.HashMap; | 12 import java.util.HashMap; |
12 import java.util.Iterator; | 13 import java.util.Iterator; |
13 import java.util.List; | 14 import java.util.List; |
14 import java.util.Map; | 15 import java.util.Map; |
15 import java.util.TreeMap; | 16 import java.util.TreeMap; |
28 | 29 |
29 public class DistanceOnlyPartHistoricalSelect extends DistanceOnlySelect { | 30 public class DistanceOnlyPartHistoricalSelect extends DistanceOnlySelect { |
30 | 31 |
31 private static final long serialVersionUID = 1L; | 32 private static final long serialVersionUID = 1L; |
32 | 33 |
33 private List<BedHeight> bhs = null; | 34 private final List<BedHeight> bhs = null; |
34 private Integer epoch = null; | 35 private final Integer epoch = null; |
35 private Integer year = null; | 36 private final Integer year = null; |
36 private Double lowerKm = null; | 37 private final Double lowerKm = null; |
37 private Double upperKm = null; | 38 private final Double upperKm = null; |
38 private River river = null; | 39 private final River river = null; |
39 | 40 |
40 @Override | 41 @Override |
41 protected String getUIProvider() { | 42 protected String getUIProvider() { |
42 return "distance_only_part_historical_panel"; | 43 return "distance_only_part_historical_panel"; |
43 } | 44 } |
91 iae.printStackTrace(); | 92 iae.printStackTrace(); |
92 } | 93 } |
93 } | 94 } |
94 | 95 |
95 private List<BedHeight> getBedheights(final Artifact artifact) { | 96 private List<BedHeight> getBedheights(final Artifact artifact) { |
96 | 97 final List<BedHeight> list = new ArrayList<>(); |
97 final SalixLineAccess access = new SalixLineAccess((UINFOArtifact) artifact); // improved lazy-loading | 98 list.add(new SalixLineAccess((UINFOArtifact) artifact).getBedHeight()); |
98 final Integer year = access.getYear(); | 99 return list; |
99 final Integer epoch = access.getEpoch(); | |
100 final River river = access.getRiver(); // comparable? workflow does not allow return and change anyway... | |
101 final Double lower = access.getLowerKm(); | |
102 final Double upper = access.getUpperKm(); | |
103 if (!(this.year == year && this.epoch == epoch && this.river == river && this.lowerKm == lower && this.upperKm == upper)) { | |
104 this.bhs = null; | |
105 } | |
106 if (this.bhs == null) { | |
107 final boolean isEpoch = epoch == null ? false : true; | |
108 this.bhs = BedHeight.getBedHeightYearEpoch(isEpoch, isEpoch ? epoch : year, river, lower, upper); | |
109 this.year = year; | |
110 this.epoch = epoch; | |
111 this.river = river; | |
112 this.lowerKm = lower; | |
113 this.upperKm = upper; | |
114 } | |
115 return this.bhs; | |
116 | 100 |
117 } | 101 } |
118 | 102 |
119 private static final void makeDataSourceYearEpoch(final ElementCreator creator, final Element select, final CallContext context, | 103 private static final void makeDataSourceYearEpoch(final ElementCreator creator, final Element select, final CallContext context, |
120 final List<BedHeight> bedheights) { | 104 final List<BedHeight> bedheights) { |
130 helper.addColumn(0, "year", "60", "year", "INTEGER", "LEFT", null); | 114 helper.addColumn(0, "year", "60", "year", "INTEGER", "LEFT", null); |
131 helper.addColumn(1, "range", "130", "state.uinfo.salix.historical.km_range_part", "STRING", "LEFT", null); | 115 helper.addColumn(1, "range", "130", "state.uinfo.salix.historical.km_range_part", "STRING", "LEFT", null); |
132 helper.addColumn(2, "description", "500", "uinfo.salix.sounding", "STRING", "LEFT", null); | 116 helper.addColumn(2, "description", "500", "uinfo.salix.sounding", "STRING", "LEFT", null); |
133 | 117 |
134 final TreeMap<String, String> bedHeightSorted = new TreeMap<>(); | 118 final TreeMap<String, String> bedHeightSorted = new TreeMap<>(); |
135 final double min = Double.MAX_VALUE; | |
136 final double max = -Double.MAX_VALUE; | |
137 final java.text.NumberFormat formatter = Formatter.getCalculationKm(context.getMeta()); | 119 final java.text.NumberFormat formatter = Formatter.getCalculationKm(context.getMeta()); |
138 | 120 |
139 for (final BedHeight bh : bedheights) { | 121 for (final BedHeight bh : bedheights) { |
140 final org.dive4elements.river.model.Range range = BedHeight.getRangeFromBedHeights(bh); | 122 final org.dive4elements.river.model.Range range = BedHeight.getRangeFromBedHeights(bh); |
141 final Double from = range.getA().doubleValue(); // NullPointer check?? | 123 final Double from = range.getA().doubleValue(); // NullPointer check?? |