Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java @ 5914:1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Tue, 07 May 2013 17:32:33 +0200 |
parents | 59ff03ff48f1 |
children | c35323148b98 |
comparison
equal
deleted
inserted
replaced
5913:37a0f4f7c54f | 5914:1058b3436dad |
---|---|
26 import org.dive4elements.river.artifacts.model.Calculation1; | 26 import org.dive4elements.river.artifacts.model.Calculation1; |
27 import org.dive4elements.river.artifacts.model.Calculation2; | 27 import org.dive4elements.river.artifacts.model.Calculation2; |
28 import org.dive4elements.river.artifacts.model.Calculation3; | 28 import org.dive4elements.river.artifacts.model.Calculation3; |
29 import org.dive4elements.river.artifacts.model.Calculation4; | 29 import org.dive4elements.river.artifacts.model.Calculation4; |
30 import org.dive4elements.river.artifacts.model.Calculation5; | 30 import org.dive4elements.river.artifacts.model.Calculation5; |
31 import org.dive4elements.river.artifacts.model.Calculation6; | |
32 import org.dive4elements.river.artifacts.model.Calculation; | 31 import org.dive4elements.river.artifacts.model.Calculation; |
33 import org.dive4elements.river.artifacts.model.CalculationResult; | 32 import org.dive4elements.river.artifacts.model.CalculationResult; |
34 import org.dive4elements.river.artifacts.model.DischargeTables; | 33 import org.dive4elements.river.artifacts.model.DischargeTables; |
35 import org.dive4elements.river.artifacts.model.FacetTypes; | 34 import org.dive4elements.river.artifacts.model.FacetTypes; |
36 import org.dive4elements.river.artifacts.model.WQCKms; | 35 import org.dive4elements.river.artifacts.model.WQCKms; |
534 | 533 |
535 return endKms.toNativeArray(); | 534 return endKms.toNativeArray(); |
536 } | 535 } |
537 | 536 |
538 | 537 |
539 public CalculationResult getHistoricalDischargeData() { | |
540 Gauge gauge = RiverUtils.getReferenceGauge(this); | |
541 String rawTimerange = getDataAsString("year_range"); | |
542 String rawValues = getDataAsString("historical_values"); | |
543 int mode = getDataAsInteger("historical_mode"); | |
544 | |
545 long[] timerange = RiverUtils.longArrayFromString(rawTimerange); | |
546 double[] values = RiverUtils.doubleArrayFromString(rawValues); | |
547 | |
548 Calendar start = new GregorianCalendar(); | |
549 start.setTimeInMillis(timerange[0]); | |
550 Calendar end = new GregorianCalendar(); | |
551 end.setTimeInMillis(timerange[1]); | |
552 | |
553 Calculation6 calc = new Calculation6( | |
554 mode, | |
555 new long[] { start.getTimeInMillis(), end.getTimeInMillis() }, | |
556 values); | |
557 | |
558 return calc.calculate(gauge); | |
559 } | |
560 | |
561 | |
562 /** | 538 /** |
563 * Get corrected waterline against surface/profile. | 539 * Get corrected waterline against surface/profile. |
564 */ | 540 */ |
565 public Lines.LineData waterLineC(int idx, FastCrossSectionLine csl) { | 541 public Lines.LineData waterLineC(int idx, FastCrossSectionLine csl) { |
566 List<Point2D> points = csl.getPoints(); | 542 List<Point2D> points = csl.getPoints(); |
571 // Find index of km. | 547 // Find index of km. |
572 double wishKM = csl.getKm(); | 548 double wishKM = csl.getKm(); |
573 | 549 |
574 // Find W/C at km, linear naive approach. | 550 // Find W/C at km, linear naive approach. |
575 WQCKms triple = (WQCKms) wqckms[idx-1]; | 551 WQCKms triple = (WQCKms) wqckms[idx-1]; |
576 | |
577 int old_idx = 0; | |
578 | 552 |
579 if (triple.size() == 0) { | 553 if (triple.size() == 0) { |
580 logger.warn("Calculation of c/waterline is empty."); | 554 logger.warn("Calculation of c/waterline is empty."); |
581 return Lines.createWaterLines(points, 0.0f); | 555 return Lines.createWaterLines(points, 0.0f); |
582 } | 556 } |