Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FastCrossSectionChunk.java @ 3649:33bfc01410fb
Merged revisions 5375,5379,5382 via svnmerge from
file:///home/clients/bsh/bsh-generischer-viewer/Material/SVN/flys-artifacts/trunk
........
r5375 | ingo | 2012-09-07 11:26:45 +0200 (Fr, 07 Sep 2012) | 1 line
Tagged 'flys-artifacts' as 2.9
........
r5379 | rrenkert | 2012-09-07 13:58:41 +0200 (Fr, 07 Sep 2012) | 4 lines
Issue 791.
Add start km to data to compare reference and target km in next state.
........
r5382 | rrenkert | 2012-09-07 14:03:48 +0200 (Fr, 07 Sep 2012) | 3 lines
Set data for characteristic diameter for use in parameter matrix UI.
........
flys-artifacts/tags/2.9@5388 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 07 Sep 2012 13:12:08 +0000 |
parents | 5642a83420f2 |
children |
line wrap: on
line source
package de.intevation.flys.artifacts.model; import java.util.List; import java.util.Collections; import java.io.Serializable; import de.intevation.flys.model.CrossSection; import de.intevation.flys.model.FastCrossSectionLine; import org.apache.log4j.Logger; public class FastCrossSectionChunk implements Serializable { private static Logger log = Logger.getLogger(FastCrossSectionChunk.class); public static final String PREFIX = "FCSC:"; public static final double KM_RANGE = 1.0; protected double startKm; protected int crossSectionId; protected List<FastCrossSectionLine> crossSectionLines; public FastCrossSectionChunk() { } public FastCrossSectionChunk(CrossSection cs, double km) { crossSectionId = cs.getId(); startKm = Math.floor(km); double stopKm = startKm + KM_RANGE; long startTime = System.currentTimeMillis(); crossSectionLines = cs.getFastLines(startKm, stopKm); long stopTime = System.currentTimeMillis(); if (log.isDebugEnabled()) { log.debug("Fetching cross section lines took " + (float)(stopTime-startTime)/1000f + " secs."); } } public FastCrossSectionLine getCrossSectionLine(double km) { FastCrossSectionLine key = new FastCrossSectionLine(km); int pos = Collections.binarySearch( crossSectionLines, key, FastCrossSectionLine.KM_CMP); return pos < 0 ? null : crossSectionLines.get(pos); } public static String createHashKey(CrossSection cs, double km) { return PREFIX + cs.getId() + ":" + (int)Math.floor(km); } public String getHashKey() { return PREFIX + crossSectionId + ":" + (int)Math.floor(startKm); } public double getStartKm() { return startKm; } public void setStartKm(double startKm) { this.startKm = startKm; } public double getStopKm() { return startKm + KM_RANGE; } public int getCrossSectionId() { return crossSectionId; } public void setCrossSectionId(int crossSectionId) { this.crossSectionId = crossSectionId; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :