Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/math/L1Comparator.java @ 361:aec85d00d82c
Added code to do 2D interpolations along a digitied track on the map.
Not connected to the transition model, yet.
gnv-artifacts/trunk@435 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 15 Dec 2009 22:25:53 +0000 |
parents | |
children | ab29e4ff2fda |
comparison
equal
deleted
inserted
replaced
360:ee760729f6b8 | 361:aec85d00d82c |
---|---|
1 package de.intevation.gnv.math; | |
2 | |
3 import java.util.Comparator; | |
4 | |
5 import com.vividsolutions.jts.geom.Coordinate; | |
6 | |
7 /** | |
8 * @author Sascha L. Teichmann | |
9 */ | |
10 public class L1Comparator | |
11 implements Comparator | |
12 { | |
13 private Coordinate ref; | |
14 | |
15 public L1Comparator(Coordinate ref) { | |
16 this.ref = ref; | |
17 } | |
18 | |
19 public int compare(Object a, Object b) { | |
20 Coordinate pa = (Coordinate)a; | |
21 Coordinate pb = (Coordinate)b; | |
22 double da = Point2d.L1(ref, pa); | |
23 double db = Point2d.L1(ref, pb); | |
24 if (da < db) return -1; | |
25 if (da > db) return +1; | |
26 return 0; | |
27 } | |
28 } | |
29 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: | |
30 |