sascha@2380: package de.intevation.flys.model; sascha@2380: sascha@2380: import java.util.List; sascha@2380: import java.util.Comparator; sascha@2380: sascha@2380: import java.io.Serializable; sascha@2380: sascha@2380: import java.awt.geom.Point2D; sascha@2380: sascha@2380: public class FastCrossSectionLine sascha@2380: implements Serializable sascha@2380: { sascha@2380: public static final double EPSILON = 1e-5; sascha@2380: sascha@2380: public static final Comparator KM_CMP = sascha@2380: new Comparator() { sascha@2380: public int compare( sascha@2380: FastCrossSectionLine a, sascha@2380: FastCrossSectionLine b sascha@2380: ) { sascha@2380: double diff = a.km - b.km; sascha@2380: if (diff < -EPSILON) return -1; sascha@2380: return diff > +EPSILON ? +1 : 0; sascha@2380: } sascha@2380: }; sascha@2380: sascha@2380: protected double km; sascha@2380: protected List points; sascha@2380: sascha@2380: public FastCrossSectionLine() { sascha@2380: } sascha@2380: sascha@2380: public FastCrossSectionLine(double km) { sascha@2380: this.km = km; sascha@2380: } sascha@2380: sascha@2380: public FastCrossSectionLine(double km, List points) { sascha@2380: this(km); sascha@2380: this.points = points; sascha@2380: } sascha@2380: sascha@2380: public FastCrossSectionLine(CrossSectionLine csl) { sascha@2860: Double kmBD = csl.getKm(); sascha@2380: km = kmBD != null ? kmBD.doubleValue() : 0d; sascha@2380: points = csl.fetchCrossSectionLinesPoints(); sascha@2380: } sascha@2380: sascha@2380: public double getKm() { sascha@2380: return km; sascha@2380: } sascha@2380: sascha@2380: public void setKm(double km) { sascha@2380: this.km = km; sascha@2380: } sascha@2380: sascha@2380: public List getPoints() { sascha@2380: return points; sascha@2380: } sascha@2380: sascha@2380: public void setPoints(List points) { sascha@2380: this.points = points; sascha@2380: } sascha@2380: sascha@2380: public double [][] fetchCrossSectionProfile() { sascha@2380: return CrossSectionLine.fetchCrossSectionProfile(points); sascha@2380: } sascha@2380: } sascha@2380: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :