Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/model/FastCrossSectionLine.java @ 3962:d609fd83310a
merged flys-backend
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:15:04 +0200 |
parents | 2f874d14ac68 |
children |
comparison
equal
deleted
inserted
replaced
3938:c0cab28ba1ea | 3962:d609fd83310a |
---|---|
1 package de.intevation.flys.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 : |