Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java @ 3124:555ed85af32e
fix issue680; hack.
flys-artifacts/trunk@4725 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 20 Jun 2012 12:46:31 +0000 |
parents | edf629d43f05 |
children | 2f922be407ea |
comparison
equal
deleted
inserted
replaced
3123:edf629d43f05 | 3124:555ed85af32e |
---|---|
32 import de.intevation.flys.artifacts.model.CalculationResult; | 32 import de.intevation.flys.artifacts.model.CalculationResult; |
33 import de.intevation.flys.artifacts.model.DischargeTables; | 33 import de.intevation.flys.artifacts.model.DischargeTables; |
34 import de.intevation.flys.artifacts.model.FacetTypes; | 34 import de.intevation.flys.artifacts.model.FacetTypes; |
35 import de.intevation.flys.artifacts.model.MainValuesFactory; | 35 import de.intevation.flys.artifacts.model.MainValuesFactory; |
36 import de.intevation.flys.artifacts.model.Segment; | 36 import de.intevation.flys.artifacts.model.Segment; |
37 import de.intevation.flys.artifacts.model.WQCKms; | |
37 import de.intevation.flys.artifacts.model.WQKms; | 38 import de.intevation.flys.artifacts.model.WQKms; |
38 import de.intevation.flys.artifacts.model.WW; | 39 import de.intevation.flys.artifacts.model.WW; |
39 import de.intevation.flys.artifacts.model.WstValueTable; | 40 import de.intevation.flys.artifacts.model.WstValueTable; |
40 import de.intevation.flys.artifacts.model.WstValueTableFactory; | 41 import de.intevation.flys.artifacts.model.WstValueTableFactory; |
41 | 42 |
718 return Segment.parseSegments(input); | 719 return Segment.parseSegments(input); |
719 } | 720 } |
720 | 721 |
721 | 722 |
722 /** | 723 /** |
724 * Get corrected waterline against surface/profile. | |
725 */ | |
726 public Lines.LineData waterLineC(int idx, FastCrossSectionLine csl) { | |
727 List<Point2D> points = csl.getPoints(); | |
728 | |
729 WQKms[] wqckms = (WQKms[]) | |
730 getDischargeLongitudinalSectionData().getData(); | |
731 | |
732 // Find index of km. | |
733 double wishKM = csl.getKm(); | |
734 | |
735 // Find W/C at km, linear naive approach. | |
736 WQCKms triple = (WQCKms) wqckms[idx-1]; | |
737 | |
738 int old_idx = 0; | |
739 | |
740 if (triple.size() == 0) { | |
741 logger.warn("Calculation of c/waterline is empty."); | |
742 return Lines.createWaterLines(points, 0.0f); | |
743 } | |
744 | |
745 // Linear seach in WQKms for closest km. | |
746 double old_dist_wish = Math.abs(wishKM - triple.getKm(0)); | |
747 double last_c = triple.getC(0); | |
748 | |
749 for (int i = 0, T = triple.size(); i < T; i++) { | |
750 double diff = Math.abs(wishKM - triple.getKm(i)); | |
751 if (diff > old_dist_wish) { | |
752 break; | |
753 } | |
754 last_c = triple.getC(i); | |
755 old_dist_wish = diff; | |
756 } | |
757 | |
758 return Lines.createWaterLines(points, last_c); | |
759 } | |
760 | |
761 | |
762 /** | |
723 * Get points of line describing the surface of water at cross section. | 763 * Get points of line describing the surface of water at cross section. |
724 * | 764 * |
725 * @param idx Index for getWaterlevelData. | 765 * @param idx Index for getWaterlevelData. |
726 * @param csl The profile/surface to fill with water. | 766 * @param csl The profile/surface to fill with water. |
727 * | 767 * |
742 } | 782 } |
743 | 783 |
744 if (wqkms.length <= idx) { | 784 if (wqkms.length <= idx) { |
745 logger.error("getWaterLines() requested index (" | 785 logger.error("getWaterLines() requested index (" |
746 + idx + " not found."); | 786 + idx + " not found."); |
747 } | 787 return waterLineC(idx, csl); |
788 } | |
789 | |
790 // Find index of km. | |
791 double wishKM = csl.getKm(); | |
748 | 792 |
749 // Find W at km, linear naive approach. | 793 // Find W at km, linear naive approach. |
750 WQKms triple = wqkms[idx]; | 794 WQKms triple = wqkms[idx]; |
751 | 795 |
752 // Find index of km. | |
753 double wishKM = csl.getKm(); | |
754 int old_idx = 0; | 796 int old_idx = 0; |
755 | 797 |
756 if (triple.size() == 0) { | 798 if (triple.size() == 0) { |
757 logger.warn("Calculation of waterline is empty."); | 799 logger.warn("Calculation of waterline is empty."); |
758 return Lines.createWaterLines(points, 0.0f); | 800 return Lines.createWaterLines(points, 0.0f); |