Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffEpochFacet.java @ 4672:12e3da5724e6
Added new facets for filtered bed height diffs to have filtered and raw data.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Thu, 13 Dec 2012 17:18:53 +0100 |
parents | e3f28be45103 |
children | 756aba0d2a7a |
comparison
equal
deleted
inserted
replaced
4671:4ca05e5f3399 | 4672:12e3da5724e6 |
---|---|
35 | 35 |
36 CalculationResult res = (CalculationResult) flys.compute(context, hash, | 36 CalculationResult res = (CalculationResult) flys.compute(context, hash, |
37 stateId, type, false); | 37 stateId, type, false); |
38 | 38 |
39 BedDiffEpochResult[] data = | 39 BedDiffEpochResult[] data = |
40 (BedDiffEpochResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS | 40 (BedDiffEpochResult[]) res.getData(); |
41 Double start = (Double)context.getContextValue("startkm"); | |
42 Double end = (Double)context.getContextValue("endkm"); | |
43 | 41 |
44 if(start != null && end != null) { | |
45 FLYSContext fc = (FLYSContext)context.globalContext(); | |
46 ZoomScale scales = (ZoomScale)fc.get("zoomscale"); | |
47 RiverAccess access = new RiverAccess((FLYSArtifact)artifact); | |
48 String river = access.getRiver(); | |
49 | |
50 double radius = scales.getRadius(river, start, end); | |
51 BedDiffEpochResult oldData = data[index]; | |
52 BedDiffEpochResult newData = new BedDiffEpochResult(); | |
53 newData.setStart(oldData.getStart()); | |
54 newData.setEnd(oldData.getEnd()); | |
55 double[][] diffs = MovingAverage.weighted(oldData.getDifferencesData(), radius); | |
56 double[][] heights1 = MovingAverage.weighted(oldData.getHeights1Data(), radius); | |
57 double[][] heights2 = MovingAverage.weighted(oldData.getHeights2Data(), radius); | |
58 for(int j = 0; j < diffs[0].length; j++) { | |
59 newData.addKm(diffs[0][j]); | |
60 newData.addDifference(diffs[1][j]); | |
61 newData.addHeight1(heights1[1][j]); | |
62 newData.addHeight2(heights2[1][j]); | |
63 } | |
64 return newData; | |
65 } | |
66 return data != null && data.length > index ? data[index] : null; | 42 return data != null && data.length > index ? data[index] : null; |
67 } | 43 } |
68 | 44 |
69 /** Copy deeply. */ | 45 /** Copy deeply. */ |
70 @Override | 46 @Override |