comparison artifacts/src/main/java/org/dive4elements/river/exports/process/BedheightProcessor.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 1011a40ee79c
children c7d8adb91576
comparison
equal deleted inserted replaced
7074:a2abd87c0d3b 7075:253d80af5b7f
29 private final static String BEDHEIGHT = "bedheight"; 29 private final static String BEDHEIGHT = "bedheight";
30 30
31 @Override 31 @Override
32 public void doOut( 32 public void doOut(
33 XYChartGenerator generator, 33 XYChartGenerator generator,
34 ArtifactAndFacet aandf, 34 ArtifactAndFacet bundle,
35 ThemeDocument theme, 35 ThemeDocument theme,
36 boolean visible, 36 boolean visible,
37 int index 37 int index
38 ) { 38 ) {
39 CallContext context = generator.getCallContext(); 39 CallContext context = generator.getCallContext();
40 Object data = aandf.getData(context); 40 Object data = bundle.getData(context);
41 if (data instanceof BedHeightSingle) { 41 if (data instanceof BedHeightSingle) {
42 doBedheightSingleOut(generator, aandf, theme, index, visible, 42 doBedheightSingleOut(generator, bundle, theme, index, visible,
43 (BedHeightSingle)data); 43 (BedHeightSingle)data);
44 } 44 }
45 else if (data instanceof List<?>) { 45 else if (data instanceof List<?>) {
46 doBedheightSingeValuesOut(generator, aandf, theme, index, visible, 46 doBedheightSingeValuesOut(generator, bundle, theme, index, visible,
47 (List<BedHeightSingleValue>)data); 47 (List<BedHeightSingleValue>)data);
48 } 48 }
49 logger.error("Can't process " + data.getClass().getName() + " objects"); 49 logger.error("Can't process " + data.getClass().getName() + " objects");
50 } 50 }
51 51
52 private void doBedheightSingeValuesOut(XYChartGenerator generator, 52 private void doBedheightSingeValuesOut(XYChartGenerator generator,
53 ArtifactAndFacet aandf, ThemeDocument theme, int index, boolean visible, 53 ArtifactAndFacet bundle, ThemeDocument theme, int index, boolean visible,
54 List<BedHeightSingleValue> data) { 54 List<BedHeightSingleValue> data) {
55 logger.debug("doBedheightSingeValuesOut"); 55 logger.debug("doBedheightSingeValuesOut");
56 56
57 XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), 57 XYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
58 theme); 58 theme);
59 for(BedHeightSingleValue bvalue: data) { 59 for(BedHeightSingleValue bvalue: data) {
60 series.add(bvalue.getStation(), bvalue.getSoundingWidth()); 60 series.add(bvalue.getStation(), bvalue.getSoundingWidth());
61 } 61 }
62 generator.addAxisSeries(series, index, visible); 62 generator.addAxisSeries(series, index, visible);
66 public boolean canHandle(String facettype) { 66 public boolean canHandle(String facettype) {
67 return BEDHEIGHT.equals(facettype); 67 return BEDHEIGHT.equals(facettype);
68 } 68 }
69 69
70 public void doBedheightSingleOut(XYChartGenerator generator, 70 public void doBedheightSingleOut(XYChartGenerator generator,
71 ArtifactAndFacet aandf, ThemeDocument theme, int index, boolean visible, 71 ArtifactAndFacet bundle, ThemeDocument theme, int index, boolean visible,
72 BedHeightSingle data) { 72 BedHeightSingle data) {
73 double[] width = data.getMorphWidths(); 73 double[] width = data.getMorphWidths();
74 double[] stations = data.getStations().toNativeArray(); 74 double[] stations = data.getStations().toNativeArray();
75 75
76 logger.debug("doBedheightSingleOut"); 76 logger.debug("doBedheightSingleOut");
77 77
78 XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), 78 XYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
79 theme); 79 theme);
80 80
81 for (int i = 0; i < width.length; i++) { 81 for (int i = 0; i < width.length; i++) {
82 series.add(stations[i], width[i], false); 82 series.add(stations[i], width[i], false);
83 } 83 }

http://dive4elements.wald.intevation.org