comparison flys-backend/src/main/java/de/intevation/flys/model/CrossSectionLine.java @ 2378:c5d83366d0b1

CrossSectionLine: Simplified creation of Point2Ds. flys-backend/trunk@3687 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 16 Jan 2012 14:16:52 +0000
parents 3efc3942b765
children e237a08acf6e
comparison
equal deleted inserted replaced
2377:d183ae164cfc 2378:c5d83366d0b1
117 this.points = points; 117 this.points = points;
118 } 118 }
119 119
120 120
121 public List<Point2D> fetchCrossSectionLinesPoints() { 121 public List<Point2D> fetchCrossSectionLinesPoints() {
122 List<Point2D> points = new ArrayList<Point2D>();
123 122
124 List<CrossSectionPoint> linePoints = getPoints(); 123 List<CrossSectionPoint> linePoints =
124 new ArrayList<CrossSectionPoint>(getPoints());
125 125
126 if (linePoints.isEmpty()) {
127 logger.info("No points in selected CrossSectionLine.");
128 return points;
129 }
130
131 linePoints = new ArrayList(linePoints);
132 Collections.sort(linePoints, COL_POS_CMP); 126 Collections.sort(linePoints, COL_POS_CMP);
133 127
128 List<Point2D> points = new ArrayList<Point2D>(linePoints.size());
134 for (CrossSectionPoint p: linePoints) { 129 for (CrossSectionPoint p: linePoints) {
135 double x = p.getX().doubleValue(); 130 double x = p.getX().doubleValue();
136 double y = p.getY().doubleValue(); 131 double y = p.getY().doubleValue();
137 if (isValid(x) && isValid(y)) { 132 if (isValid(x) && isValid(y)) {
138 points.add(new Point2D.Double(x, y)); 133 points.add(new Point2D.Double(x, y));

http://dive4elements.wald.intevation.org