Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FastCrossSectionChunk.java @ 2126:d626ae185305
Use the fast cross section lines from backend now.
flys-artifacts/trunk@3697 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 17 Jan 2012 17:05:18 +0000 |
parents | dc28ea60b53d |
children | 5642a83420f2 |
comparison
equal
deleted
inserted
replaced
2125:7a8f52267a5c | 2126:d626ae185305 |
---|---|
1 package de.intevation.flys.artifacts.model; | 1 package de.intevation.flys.artifacts.model; |
2 | 2 |
3 import java.util.ArrayList; | |
4 import java.util.List; | 3 import java.util.List; |
5 import java.util.Collections; | 4 import java.util.Collections; |
6 | 5 |
7 import java.io.Serializable; | 6 import java.io.Serializable; |
8 | 7 |
9 import de.intevation.flys.model.CrossSectionLine; | |
10 import de.intevation.flys.model.CrossSection; | 8 import de.intevation.flys.model.CrossSection; |
9 | |
10 import de.intevation.flys.model.FastCrossSectionLine; | |
11 | |
12 import org.apache.log4j.Logger; | |
11 | 13 |
12 public class FastCrossSectionChunk | 14 public class FastCrossSectionChunk |
13 implements Serializable | 15 implements Serializable |
14 { | 16 { |
17 private static Logger log = Logger.getLogger(FastCrossSectionChunk.class); | |
18 | |
15 public static final String PREFIX = "FCSC:"; | 19 public static final String PREFIX = "FCSC:"; |
16 public static final double KM_RANGE = 1.0; | 20 public static final double KM_RANGE = 1.0; |
17 | 21 |
18 protected double startKm; | 22 protected double startKm; |
19 protected int crossSectionId; | 23 protected int crossSectionId; |
27 | 31 |
28 crossSectionId = cs.getId(); | 32 crossSectionId = cs.getId(); |
29 startKm = Math.floor(km); | 33 startKm = Math.floor(km); |
30 double stopKm = startKm + KM_RANGE; | 34 double stopKm = startKm + KM_RANGE; |
31 | 35 |
32 List<CrossSectionLine> csls = cs.getLines(startKm, stopKm); | 36 long startTime = System.currentTimeMillis(); |
33 | 37 |
34 crossSectionLines = new ArrayList | 38 crossSectionLines = cs.getFastLines(startKm, stopKm); |
35 <FastCrossSectionLine>(csls.size()); | |
36 | 39 |
37 for (CrossSectionLine csl: csls) { | 40 long stopTime = System.currentTimeMillis(); |
38 crossSectionLines.add(new FastCrossSectionLine(csl)); | 41 |
42 if (log.isDebugEnabled()) { | |
43 log.debug("Fetching cross section lines took " + | |
44 (float)(stopTime-startTime)/1000f + " secs."); | |
39 } | 45 } |
40 } | 46 } |
41 | 47 |
42 public FastCrossSectionLine getCrossSectionLine(double km) { | 48 public FastCrossSectionLine getCrossSectionLine(double km) { |
43 FastCrossSectionLine key = new FastCrossSectionLine(km); | 49 FastCrossSectionLine key = new FastCrossSectionLine(km); |