Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java @ 7075:253d80af5b7f generator-refactoring
More Processor refactoring
- Unify aandf aaf and bundle variable names to bundle
- Factor out diagram inversion code
- Add function with new signature to BedDiffYear and QOut processors
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 20 Sep 2013 16:25:43 +0200 |
parents | 5c07024cdc24 |
children | 6563262052ab |
comparison
equal
deleted
inserted
replaced
7074:a2abd87c0d3b | 7075:253d80af5b7f |
---|---|
30 protected static double GAP_TOLERANCE = 0.101d; | 30 protected static double GAP_TOLERANCE = 0.101d; |
31 | 31 |
32 @Override | 32 @Override |
33 public void doOut( | 33 public void doOut( |
34 XYChartGenerator generator, | 34 XYChartGenerator generator, |
35 ArtifactAndFacet aandf, | 35 ArtifactAndFacet bundle, |
36 ThemeDocument theme, | 36 ThemeDocument theme, |
37 boolean visible, | 37 boolean visible, |
38 int axidx | 38 int axidx |
39 ) { | 39 ) { |
40 CallContext context = generator.getCallContext(); | 40 CallContext context = generator.getCallContext(); |
41 Object data = aandf.getData(context); | 41 Object data = bundle.getData(context); |
42 if (data instanceof BedDiffYearResult) { | 42 if (data instanceof BedDiffYearResult) { |
43 String facetType = aandf.getFacetName(); | 43 String facetType = bundle.getFacetName(); |
44 int index = | 44 BedDiffYearResult bData = (BedDiffYearResult) data; |
45 (BED_DIFFERENCE_YEAR_HEIGHT1.equals(facetType) | 45 |
46 || BED_DIFFERENCE_YEAR_HEIGHT1_FILTERED.equals(facetType))?0:1; | 46 double[][] points; |
47 doBedDifferenceHeightsOut( | 47 if (BED_DIFFERENCE_YEAR_HEIGHT1.equals(facetType)) { |
48 generator, | 48 points = bData.getHeights1Data(); |
49 (BedDiffYearResult) data, | 49 } else { |
50 aandf, theme, visible, index, axidx); | 50 points = bData.getHeights2Data(); |
51 } | |
52 XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme); | |
53 StyledSeriesBuilder.addPointsFactorY(series, | |
54 points, | |
55 false, | |
56 GAP_TOLERANCE, | |
57 100d); | |
58 | |
59 generator.addAxisSeries(series, axidx, visible); | |
60 | |
51 return; | 61 return; |
52 } | 62 } |
53 logger.error("Can't process " + data.getClass().getName() + " objects"); | 63 logger.error("Can't process " + data.getClass().getName() + " objects"); |
54 } | 64 } |
55 | 65 |
59 BED_DIFFERENCE_YEAR_HEIGHT1.equals(facetType) | 69 BED_DIFFERENCE_YEAR_HEIGHT1.equals(facetType) |
60 || BED_DIFFERENCE_YEAR_HEIGHT2.equals(facetType) | 70 || BED_DIFFERENCE_YEAR_HEIGHT2.equals(facetType) |
61 || BED_DIFFERENCE_YEAR_HEIGHT1_FILTERED.equals(facetType) | 71 || BED_DIFFERENCE_YEAR_HEIGHT1_FILTERED.equals(facetType) |
62 || BED_DIFFERENCE_YEAR_HEIGHT2_FILTERED.equals(facetType); | 72 || BED_DIFFERENCE_YEAR_HEIGHT2_FILTERED.equals(facetType); |
63 } | 73 } |
64 | |
65 private void doBedDifferenceHeightsOut( | |
66 XYChartGenerator generator, | |
67 BedDiffYearResult data, | |
68 ArtifactAndFacet bundle, | |
69 ThemeDocument attr, | |
70 boolean visible, | |
71 int idx, | |
72 int axidx) { | |
73 logger.debug("doBedDifferenceHeightsOut()"); | |
74 | |
75 XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), attr); | |
76 double[][] points; | |
77 if (idx == 0) { | |
78 points = data.getHeights1Data(); | |
79 } | |
80 else { | |
81 points = data.getHeights2Data(); | |
82 } | |
83 | |
84 StyledSeriesBuilder.addPointsFactorY(series, | |
85 points, | |
86 false, | |
87 GAP_TOLERANCE, | |
88 100d); | |
89 | |
90 generator.addAxisSeries(series, axidx, visible); | |
91 } | |
92 } | 74 } |
93 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 75 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |