Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java @ 2120:f021080cb409
Use improved caching for cross section lines data.
flys-artifacts/trunk@3690 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 16 Jan 2012 17:38:39 +0000 |
parents | 51b9899f819d |
children | d626ae185305 |
comparison
equal
deleted
inserted
replaced
2119:dc28ea60b53d | 2120:f021080cb409 |
---|---|
34 import de.intevation.flys.artifacts.model.MainValuesFactory; | 34 import de.intevation.flys.artifacts.model.MainValuesFactory; |
35 import de.intevation.flys.artifacts.model.Segment; | 35 import de.intevation.flys.artifacts.model.Segment; |
36 import de.intevation.flys.artifacts.model.WQKms; | 36 import de.intevation.flys.artifacts.model.WQKms; |
37 import de.intevation.flys.artifacts.model.WstValueTable; | 37 import de.intevation.flys.artifacts.model.WstValueTable; |
38 import de.intevation.flys.artifacts.model.WstValueTableFactory; | 38 import de.intevation.flys.artifacts.model.WstValueTableFactory; |
39 import de.intevation.flys.artifacts.model.FastCrossSectionLine; | |
39 | 40 |
40 import de.intevation.flys.artifacts.states.DefaultState; | 41 import de.intevation.flys.artifacts.states.DefaultState; |
41 import de.intevation.flys.artifacts.states.LocationDistanceSelect; | 42 import de.intevation.flys.artifacts.states.LocationDistanceSelect; |
42 | 43 |
43 import de.intevation.flys.geom.Lines; | 44 import de.intevation.flys.geom.Lines; |
44 | 45 |
45 import de.intevation.flys.model.Gauge; | 46 import de.intevation.flys.model.Gauge; |
46 import de.intevation.flys.model.River; | 47 import de.intevation.flys.model.River; |
47 import de.intevation.flys.model.CrossSectionLine; | |
48 | 48 |
49 import de.intevation.flys.utils.DoubleUtil; | 49 import de.intevation.flys.utils.DoubleUtil; |
50 import de.intevation.flys.utils.FLYSUtils; | 50 import de.intevation.flys.utils.FLYSUtils; |
51 | 51 |
52 import gnu.trove.TDoubleArrayList; | 52 import gnu.trove.TDoubleArrayList; |
658 * Get points of line describing the surface of water at cross section. | 658 * Get points of line describing the surface of water at cross section. |
659 * | 659 * |
660 * @return an array holding coordinates of points of surface of water ( | 660 * @return an array holding coordinates of points of surface of water ( |
661 * in the form {{x1, x2} {y1, y2}} ). | 661 * in the form {{x1, x2} {y1, y2}} ). |
662 */ | 662 */ |
663 public double [][] getWaterLines(int idx, CrossSectionLine csl) { | 663 public double [][] getWaterLines(int idx, FastCrossSectionLine csl) { |
664 logger.debug("getWaterLines(" + idx + ")"); | 664 logger.debug("getWaterLines(" + idx + ")"); |
665 | 665 |
666 List<Point2D> points = csl.fetchCrossSectionLinesPoints(); | 666 List<Point2D> points = csl.getPoints(); |
667 | 667 |
668 // Need W at km | 668 // Need W at km |
669 WQKms [] wqkms = (WQKms[]) getWaterlevelData().getData(); | 669 WQKms [] wqkms = (WQKms[]) getWaterlevelData().getData(); |
670 if (wqkms.length == 0) { | 670 if (wqkms.length == 0) { |
671 logger.error("No WQKms found."); | 671 logger.error("No WQKms found."); |
679 | 679 |
680 // Find W at km, linear naive approach. | 680 // Find W at km, linear naive approach. |
681 WQKms triple = wqkms[idx]; | 681 WQKms triple = wqkms[idx]; |
682 | 682 |
683 // Find index of km. | 683 // Find index of km. |
684 double wishKM = csl.getKm().doubleValue(); | 684 double wishKM = csl.getKm(); |
685 int old_idx = 0; | 685 int old_idx = 0; |
686 | 686 |
687 if (triple.size() == 0) { | 687 if (triple.size() == 0) { |
688 logger.warn("Calculation of waterline is empty."); | 688 logger.warn("Calculation of waterline is empty."); |
689 return Lines.createWaterLines(points, 0.0f); | 689 return Lines.createWaterLines(points, 0.0f); |