comparison artifacts/src/main/java/org/dive4elements/river/artifacts/services/DynamicMainValuesService.java @ 9454:4cccbd32b680

Bundu.wst.UD -> Q-Values are set on Client side now
author gernotbelger
date Thu, 23 Aug 2018 16:32:28 +0200
parents bc9a45d2b1fa
children 879c902c4a2d
comparison
equal deleted inserted replaced
9453:9e471031cc1e 9454:4cccbd32b680
123 123
124 // Step through the sorted Q list and get the duration discharges 124 // Step through the sorted Q list and get the duration discharges
125 final int yearCnt = DateUtils.getYearFromDate(endTime) - DateUtils.getYearFromDate(startTime) + 1; 125 final int yearCnt = DateUtils.getYearFromDate(endTime) - DateUtils.getYearFromDate(startTime) + 1;
126 double glq20 = Double.NaN; 126 double glq20 = Double.NaN;
127 for (int i = 0, k = 0; (i <= 364) && (k <= qs.size() - 1); i++, k += yearCnt) { 127 for (int i = 0, k = 0; (i <= 364) && (k <= qs.size() - 1); i++, k += yearCnt) {
128 final NamedMainValue nmv = fetchNamedQMainValue(i, session, mainValues.get(0).getMainValue().getType()); 128 final NamedMainValue nmv = fetchNamedQMainValue(i, session);
129 if (nmv != null) { 129 if (nmv != null) {
130 final double q = getDurationQ(qs, k); 130 final double q = getDurationQ(qs, k);
131 mainValues.add(createMainValue(gauge, nmv, q, timeperiod)); 131 mainValues.add(createMainValue(gauge, nmv, q, timeperiod));
132 if (i == 20) 132 if (i == 20)
133 glq20 = q; 133 glq20 = q;
173 } 173 }
174 174
175 /** 175 /**
176 * Fetches a named main Q(duration) value from the database, if existing 176 * Fetches a named main Q(duration) value from the database, if existing
177 */ 177 */
178 private NamedMainValue fetchNamedQMainValue(final int days, final Session session, final MainValueType qType) { 178 private NamedMainValue fetchNamedQMainValue(final int days, final Session session) {
179 final NamedMainValue nmv = NamedMainValue.fetchByNameAndType(Integer.toString(days), MainValueTypeKey.DURATION.getName(), session); 179
180 // final NamedMainValue nmv = new NamedMainValue(Integer.toString(days), qType); 180 NamedMainValue nmv = NamedMainValue.fetchByNameAndType(Integer.toString(days), MainValueTypeKey.DURATION.getName(), session);
181 if (nmv != null) 181 if (nmv == null) {
182 nmv.setOfficialLines(new ArrayList<OfficialLine>()); 182 final MainValueType mvt = new MainValueType(MainValueTypeKey.INVISIBLE_D.name());
183 nmv = new NamedMainValue(Integer.toString(days), mvt);
184 }
185
186 nmv.setOfficialLines(new ArrayList<OfficialLine>());
187
183 return nmv; 188 return nmv;
184 } 189 }
185 190
186 /** 191 /**
187 * Creates a main value for a main value name 192 * Creates a main value for a main value name

http://dive4elements.wald.intevation.org