Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java @ 7705:f1257717fa4b
(issue1594) Move Bed differences absolute height into the correct processor
This also fixes that the filtered data of Height2 was never shown because
of a to wide else clause.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Tue, 17 Dec 2013 18:27:13 +0100 |
parents | 28758f51f1b2 |
children | 8f1a5d0802b5 |
comparison
equal
deleted
inserted
replaced
7704:a877d2680a4a | 7705:f1257717fa4b |
---|---|
45 Object data = bundle.getData(context); | 45 Object data = bundle.getData(context); |
46 if (data instanceof BedDiffYearResult) { | 46 if (data instanceof BedDiffYearResult) { |
47 String facetType = bundle.getFacetName(); | 47 String facetType = bundle.getFacetName(); |
48 BedDiffYearResult bData = (BedDiffYearResult) data; | 48 BedDiffYearResult bData = (BedDiffYearResult) data; |
49 | 49 |
50 double[][] points; | |
51 if (BED_DIFFERENCE_YEAR_HEIGHT1.equals(facetType)) { | |
52 points = bData.getHeights1Data(); | |
53 } else { | |
54 points = bData.getHeights2Data(); | |
55 } | |
56 XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme); | 50 XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme); |
57 StyledSeriesBuilder.addPointsFactorY(series, | 51 StyledSeriesBuilder.addPointsFactorY(series, |
58 points, | 52 bData.getHeightPerYearData(), |
59 false, | 53 false, |
60 GAP_TOLERANCE, | 54 GAP_TOLERANCE, |
61 100d); | 55 100d); |
62 | 56 |
63 generator.addAxisSeries(series, axisName, visible); | 57 generator.addAxisSeries(series, axisName, visible); |
66 } | 60 } |
67 logger.error("Can't process " + data.getClass().getName() + " objects"); | 61 logger.error("Can't process " + data.getClass().getName() + " objects"); |
68 } | 62 } |
69 | 63 |
70 @Override | 64 @Override |
71 public void doOut( | |
72 XYChartGenerator generator, | |
73 ArtifactAndFacet bundle, | |
74 ThemeDocument theme, | |
75 boolean visible, | |
76 int axidx | |
77 ) { | |
78 CallContext context = generator.getCallContext(); | |
79 Object data = bundle.getData(context); | |
80 if (data instanceof BedDiffYearResult) { | |
81 String facetType = bundle.getFacetName(); | |
82 BedDiffYearResult bData = (BedDiffYearResult) data; | |
83 | |
84 double[][] points; | |
85 if (BED_DIFFERENCE_YEAR.equals(facetType) | |
86 || BED_DIFFERENCE_YEAR_FILTERED.equals(facetType)) { | |
87 points = bData.getHeightPerYearData(); | |
88 } | |
89 else if (BED_DIFFERENCE_YEAR_HEIGHT1.equals(facetType)) { | |
90 points = bData.getHeights1Data(); | |
91 } else { | |
92 points = bData.getHeights2Data(); | |
93 } | |
94 XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme); | |
95 StyledSeriesBuilder.addPointsFactorY(series, | |
96 points, | |
97 false, | |
98 GAP_TOLERANCE, | |
99 100d); | |
100 | |
101 generator.addAxisSeries(series, axidx, visible); | |
102 | |
103 return; | |
104 } | |
105 logger.error("Can't process " + data.getClass().getName() + " objects"); | |
106 } | |
107 | |
108 @Override | |
109 public boolean canHandle(String facetType) { | 65 public boolean canHandle(String facetType) { |
110 return | 66 return BED_DIFFERENCE_YEAR.equals(facetType) // from BedDifferencesYear |
111 BED_DIFFERENCE_YEAR_HEIGHT1.equals(facetType) | |
112 || BED_DIFFERENCE_YEAR_HEIGHT2.equals(facetType) | |
113 || BED_DIFFERENCE_YEAR_HEIGHT1_FILTERED.equals(facetType) | |
114 || BED_DIFFERENCE_YEAR_HEIGHT2_FILTERED.equals(facetType) | |
115 || BED_DIFFERENCE_YEAR.equals(facetType) // from BedDifferencesYear | |
116 || BED_DIFFERENCE_YEAR_FILTERED.equals(facetType); // from BedDifferencesYear | 67 || BED_DIFFERENCE_YEAR_FILTERED.equals(facetType); // from BedDifferencesYear |
117 } | 68 } |
118 | 69 |
119 @Override | 70 @Override |
120 public String getAxisLabel(DiagramGenerator generator) { | 71 public String getAxisLabel(DiagramGenerator generator) { |