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