Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FastCrossSectionLine.java @ 2119:dc28ea60b53d
Added cached/chunked access to cross section lines. TODO: Use the FastCrossSectionLines.
flys-artifacts/trunk@3689 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 16 Jan 2012 15:51:46 +0000 |
parents | |
children | f021080cb409 |
comparison
equal
deleted
inserted
replaced
2118:4d57d456e261 | 2119:dc28ea60b53d |
---|---|
1 package de.intevation.flys.artifacts.model; | |
2 | |
3 import java.util.List; | |
4 import java.util.Comparator; | |
5 | |
6 import java.io.Serializable; | |
7 | |
8 import java.math.BigDecimal; | |
9 | |
10 import de.intevation.flys.model.CrossSectionLine; | |
11 | |
12 import java.awt.geom.Point2D; | |
13 | |
14 public class FastCrossSectionLine | |
15 implements Serializable | |
16 { | |
17 public static final double EPSILON = 1e-5; | |
18 | |
19 public static final Comparator<FastCrossSectionLine> KM_CMP = | |
20 new Comparator<FastCrossSectionLine>() { | |
21 public int compare( | |
22 FastCrossSectionLine a, | |
23 FastCrossSectionLine b | |
24 ) { | |
25 double diff = a.km - b.km; | |
26 if (diff < -EPSILON) return -1; | |
27 return diff > +EPSILON ? +1 : 0; | |
28 } | |
29 }; | |
30 | |
31 protected double km; | |
32 protected List<Point2D> points; | |
33 | |
34 public FastCrossSectionLine() { | |
35 } | |
36 | |
37 public FastCrossSectionLine(double km) { | |
38 this.km = km; | |
39 } | |
40 | |
41 public FastCrossSectionLine(CrossSectionLine csl) { | |
42 BigDecimal kmBD = csl.getKm(); | |
43 km = kmBD != null ? kmBD.doubleValue() : 0d; | |
44 points = csl.fetchCrossSectionLinesPoints(); | |
45 } | |
46 | |
47 public double getKm() { | |
48 return km; | |
49 } | |
50 | |
51 public void setKm(double km) { | |
52 this.km = km; | |
53 } | |
54 | |
55 public List<Point2D> getPoints() { | |
56 return points; | |
57 } | |
58 | |
59 public void setPoints(List<Point2D> points) { | |
60 this.points = points; | |
61 } | |
62 } | |
63 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |