comparison artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java @ 5865:73da40528cf2

River artifacts: Renamed FLYSUtils to RiverUtils.
author Sascha L. Teichmann <teichmann@intevation.de>
date Sun, 28 Apr 2013 15:09:31 +0200
parents 4897a58c8746
children 59ff03ff48f1
comparison
equal deleted inserted replaced
5864:f2e46a668fe6 5865:73da40528cf2
49 import org.dive4elements.river.model.FastCrossSectionLine; 49 import org.dive4elements.river.model.FastCrossSectionLine;
50 import org.dive4elements.river.model.Gauge; 50 import org.dive4elements.river.model.Gauge;
51 import org.dive4elements.river.model.River; 51 import org.dive4elements.river.model.River;
52 52
53 import org.dive4elements.river.utils.DoubleUtil; 53 import org.dive4elements.river.utils.DoubleUtil;
54 import org.dive4elements.river.utils.FLYSUtils; 54 import org.dive4elements.river.utils.RiverUtils;
55 55
56 import gnu.trove.TDoubleArrayList; 56 import gnu.trove.TDoubleArrayList;
57 57
58 import java.awt.geom.Point2D; 58 import java.awt.geom.Point2D;
59 59
207 else if (calculationMode.equals("calc.extreme.curve")) { 207 else if (calculationMode.equals("calc.extreme.curve")) {
208 return (CalculationResult) 208 return (CalculationResult)
209 this.compute(context, ComputeType.ADVANCE, false); 209 this.compute(context, ComputeType.ADVANCE, false);
210 } 210 }
211 211
212 River river = FLYSUtils.getRiver(this); 212 River river = RiverUtils.getRiver(this);
213 if (river == null) { 213 if (river == null) {
214 return error(new WQKms[0], "no.river.selected"); 214 return error(new WQKms[0], "no.river.selected");
215 } 215 }
216 216
217 double[] kms = getKms(); 217 double[] kms = getKms();
310 * @return the data computed by a duration curve computation. 310 * @return the data computed by a duration curve computation.
311 */ 311 */
312 public CalculationResult getDurationCurveData() { 312 public CalculationResult getDurationCurveData() {
313 logger.debug("WINFOArtifact.getDurationCurveData"); 313 logger.debug("WINFOArtifact.getDurationCurveData");
314 314
315 River r = FLYSUtils.getRiver(this); 315 River r = RiverUtils.getRiver(this);
316 316
317 if (r == null) { 317 if (r == null) {
318 return error(null, "no.river.selected"); 318 return error(null, "no.river.selected");
319 } 319 }
320 320
374 public CalculationResult getComputedDischargeCurveData() 374 public CalculationResult getComputedDischargeCurveData()
375 throws NullPointerException 375 throws NullPointerException
376 { 376 {
377 logger.debug("WINFOArtifact.getComputedDischargeCurveData"); 377 logger.debug("WINFOArtifact.getComputedDischargeCurveData");
378 378
379 River r = FLYSUtils.getRiver(this); 379 River r = RiverUtils.getRiver(this);
380 380
381 if (r == null) { 381 if (r == null) {
382 return error(new WQKms[0], "no.river.selected"); 382 return error(new WQKms[0], "no.river.selected");
383 } 383 }
384 384
450 return error(new WW[0], "no.reference.end.kms"); 450 return error(new WW[0], "no.reference.end.kms");
451 } 451 }
452 452
453 Calculation5 calc5 = new Calculation5(startKm, endKms); 453 Calculation5 calc5 = new Calculation5(startKm, endKms);
454 454
455 River r = FLYSUtils.getRiver(this); 455 River r = RiverUtils.getRiver(this);
456 if (r == null) { 456 if (r == null) {
457 return error(new WW[0], "no.river.found"); 457 return error(new WW[0], "no.river.found");
458 } 458 }
459 459
460 WstValueTable wst = WstValueTableFactory.getTable(r); 460 WstValueTable wst = WstValueTableFactory.getTable(r);
535 return endKms.toNativeArray(); 535 return endKms.toNativeArray();
536 } 536 }
537 537
538 538
539 public CalculationResult getHistoricalDischargeData() { 539 public CalculationResult getHistoricalDischargeData() {
540 Gauge gauge = FLYSUtils.getReferenceGauge(this); 540 Gauge gauge = RiverUtils.getReferenceGauge(this);
541 String rawTimerange = getDataAsString("year_range"); 541 String rawTimerange = getDataAsString("year_range");
542 String rawValues = getDataAsString("historical_values"); 542 String rawValues = getDataAsString("historical_values");
543 int mode = getDataAsInteger("historical_mode"); 543 int mode = getDataAsInteger("historical_mode");
544 544
545 long[] timerange = FLYSUtils.longArrayFromString(rawTimerange); 545 long[] timerange = RiverUtils.longArrayFromString(rawTimerange);
546 double[] values = FLYSUtils.doubleArrayFromString(rawValues); 546 double[] values = RiverUtils.doubleArrayFromString(rawValues);
547 547
548 Calendar start = new GregorianCalendar(); 548 Calendar start = new GregorianCalendar();
549 start.setTimeInMillis(timerange[0]); 549 start.setTimeInMillis(timerange[0]);
550 Calendar end = new GregorianCalendar(); 550 Calendar end = new GregorianCalendar();
551 end.setTimeInMillis(timerange[1]); 551 end.setTimeInMillis(timerange[1]);
697 697
698 if (debug) { 698 if (debug) {
699 logger.debug("FLYSArtifact.getQsForWs"); 699 logger.debug("FLYSArtifact.getQsForWs");
700 } 700 }
701 701
702 River r = FLYSUtils.getRiver(this); 702 River r = RiverUtils.getRiver(this);
703 if (r == null) { 703 if (r == null) {
704 logger.warn("no river found"); 704 logger.warn("no river found");
705 return null; 705 return null;
706 } 706 }
707 707
924 * Returns the gauge based on the current distance and river. 924 * Returns the gauge based on the current distance and river.
925 * 925 *
926 * @return the gauge. 926 * @return the gauge.
927 */ 927 */
928 public Gauge getGauge() { 928 public Gauge getGauge() {
929 return FLYSUtils.getGauge(this); 929 return RiverUtils.getGauge(this);
930 } 930 }
931 931
932 932
933 933
934 934
1185 1185
1186 /** 1186 /**
1187 * Returns the WstValueTable of current river. 1187 * Returns the WstValueTable of current river.
1188 */ 1188 */
1189 public WstValueTable getWstValueTable() { 1189 public WstValueTable getWstValueTable() {
1190 River r = FLYSUtils.getRiver(this); 1190 River r = RiverUtils.getRiver(this);
1191 return WstValueTableFactory.getTable(r); 1191 return WstValueTableFactory.getTable(r);
1192 } 1192 }
1193 } 1193 }
1194 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 1194 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org