Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffYearFacet.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 |
---|---|
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 BedDiffYearResult[] data = | 39 BedDiffYearResult[] data = |
40 (BedDiffYearResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS | 40 (BedDiffYearResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS |
41 Double start = (Double)context.getContextValue("startkm"); | |
42 Double end = (Double)context.getContextValue("endkm"); | |
43 if(start != null && end != null) { | |
44 FLYSContext fc = (FLYSContext)context.globalContext(); | |
45 ZoomScale scales = (ZoomScale)fc.get("zoomscale"); | |
46 RiverAccess access = new RiverAccess((FLYSArtifact)artifact); | |
47 String river = access.getRiver(); | |
48 | 41 |
49 double radius = scales.getRadius(river, start, end); | |
50 BedDiffYearResult oldData = data[index]; | |
51 BedDiffYearResult newData = new BedDiffYearResult(); | |
52 newData.setStart(oldData.getStart()); | |
53 newData.setEnd(oldData.getEnd()); | |
54 double[][] diffs = MovingAverage.weighted(oldData.getDifferencesData(), radius); | |
55 double[][] heights1 = MovingAverage.weighted(oldData.getHeights1Data(), radius); | |
56 double[][] heights2 = MovingAverage.weighted(oldData.getHeights2Data(), radius); | |
57 double[][] morph = oldData.getMorphWidthData(); | |
58 double[][] year = MovingAverage.weighted(oldData.getHeightPerYearData(), radius); | |
59 for(int j = 0; j < diffs[0].length; j++) { | |
60 newData.addKm(diffs[0][j]); | |
61 newData.addBedHeights(year[1][j]); | |
62 newData.addMorphWidth(morph[1][j]); | |
63 newData.addDifference(diffs[1][j]); | |
64 newData.addHeight1(heights1[1][j]); | |
65 newData.addHeight2(heights2[1][j]); | |
66 } | |
67 return newData; | |
68 } | |
69 return data != null && data.length > index ? data[index] : null; | 42 return data != null && data.length > index ? data[index] : null; |
70 } | 43 } |
71 | 44 |
72 /** Copy deeply. */ | 45 /** Copy deeply. */ |
73 @Override | 46 @Override |