[PATCH 2 of 4] Simplify code to prepare DiagramGenerator signature
Wald Commits
scm-commit at wald.intevation.org
Mon Sep 23 10:26:19 CEST 2013
# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1379924572 -7200
# Branch generator-refactoring
# Node ID c7d8adb91576287c6968dddae216c8d87566ec50
# Parent 9a37d6dce2c7cce51dabe92fad194ee44b0b4564
Simplify code to prepare DiagramGenerator signature
diff -r 9a37d6dce2c7 -r c7d8adb91576 artifacts/src/main/java/org/dive4elements/river/exports/process/BedheightProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedheightProcessor.java Mon Sep 23 10:21:59 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedheightProcessor.java Mon Sep 23 10:22:52 2013 +0200
@@ -38,26 +38,26 @@
) {
CallContext context = generator.getCallContext();
Object data = bundle.getData(context);
- if (data instanceof BedHeightSingle) {
- doBedheightSingleOut(generator, bundle, theme, index, visible,
- (BedHeightSingle)data);
- }
- else if (data instanceof List<?>) {
- doBedheightSingeValuesOut(generator, bundle, theme, index, visible,
- (List<BedHeightSingleValue>)data);
- }
- logger.error("Can't process " + data.getClass().getName() + " objects");
- }
-
- private void doBedheightSingeValuesOut(XYChartGenerator generator,
- ArtifactAndFacet bundle, ThemeDocument theme, int index, boolean visible,
- List<BedHeightSingleValue> data) {
- logger.debug("doBedheightSingeValuesOut");
-
XYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
theme);
- for(BedHeightSingleValue bvalue: data) {
- series.add(bvalue.getStation(), bvalue.getSoundingWidth());
+ if (data instanceof BedHeightSingle) {
+ BedHeightSingle bData = (BedHeightSingle)data;
+ double[] width = bData.getMorphWidths();
+ double[] stations = bData.getStations().toNativeArray();
+
+ logger.debug("doBedheightSingleOut");
+
+ for (int i = 0; i < width.length; i++) {
+ series.add(stations[i], width[i], false);
+ }
+ } else if (data instanceof List<?>) {
+ List<BedHeightSingleValue> bData = (List<BedHeightSingleValue>)data;
+
+ logger.debug("doBedheightSingleValueOut");
+
+ for(BedHeightSingleValue bvalue: bData) {
+ series.add(bvalue.getStation(), bvalue.getSoundingWidth());
+ }
}
generator.addAxisSeries(series, index, visible);
}
@@ -66,22 +66,4 @@
public boolean canHandle(String facettype) {
return BEDHEIGHT.equals(facettype);
}
-
- public void doBedheightSingleOut(XYChartGenerator generator,
- ArtifactAndFacet bundle, ThemeDocument theme, int index, boolean visible,
- BedHeightSingle data) {
- double[] width = data.getMorphWidths();
- double[] stations = data.getStations().toNativeArray();
-
- logger.debug("doBedheightSingleOut");
-
- XYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
- theme);
-
- for (int i = 0; i < width.length; i++) {
- series.add(stations[i], width[i], false);
- }
-
- generator.addAxisSeries(series, index, visible);
- }
}
More information about the Dive4elements-commits
mailing list