comparison backend/src/main/java/org/dive4elements/river/model/FastCrossSectionLine.java @ 5838:5aa05a7a34b7

Rename modules to more fitting names.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 15:23:37 +0200
parents flys-backend/src/main/java/org/dive4elements/river/model/FastCrossSectionLine.java@18619c1e7c2a
children 4dd33b86dc61
comparison
equal deleted inserted replaced
5837:d9901a08d0a6 5838:5aa05a7a34b7
1 package org.dive4elements.river.model;
2
3 import java.util.List;
4 import java.util.Comparator;
5
6 import java.io.Serializable;
7
8 import java.awt.geom.Point2D;
9
10 public class FastCrossSectionLine
11 implements Serializable
12 {
13 public static final double EPSILON = 1e-5;
14
15 public static final Comparator<FastCrossSectionLine> KM_CMP =
16 new Comparator<FastCrossSectionLine>() {
17 public int compare(
18 FastCrossSectionLine a,
19 FastCrossSectionLine b
20 ) {
21 double diff = a.km - b.km;
22 if (diff < -EPSILON) return -1;
23 return diff > +EPSILON ? +1 : 0;
24 }
25 };
26
27 protected double km;
28 protected List<Point2D> points;
29
30 public FastCrossSectionLine() {
31 }
32
33 public FastCrossSectionLine(double km) {
34 this.km = km;
35 }
36
37 public FastCrossSectionLine(double km, List<Point2D> points) {
38 this(km);
39 this.points = points;
40 }
41
42 public FastCrossSectionLine(CrossSectionLine csl) {
43 Double kmBD = csl.getKm();
44 km = kmBD != null ? kmBD.doubleValue() : 0d;
45 points = csl.fetchCrossSectionLinesPoints();
46 }
47
48 public double getKm() {
49 return km;
50 }
51
52 public void setKm(double km) {
53 this.km = km;
54 }
55
56 public List<Point2D> getPoints() {
57 return points;
58 }
59
60 public void setPoints(List<Point2D> points) {
61 this.points = points;
62 }
63
64 public double [][] fetchCrossSectionProfile() {
65 return CrossSectionLine.fetchCrossSectionProfile(points);
66 }
67 }
68 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org