[PATCH] (issue1594) Move Bed differences absolute height into the correct processor
Wald Commits
scm-commit at wald.intevation.org
Tue Dec 17 18:28:16 CET 2013
# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1387301233 -3600
# Node ID f1257717fa4b09e8a3449c87ca6b5ce7b34109dc
# Parent a877d2680a4a3c9ddd0a898d613e641093b47445
(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.
diff -r a877d2680a4a -r f1257717fa4b artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java Tue Dec 17 17:59:37 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java Tue Dec 17 18:27:13 2013 +0100
@@ -47,15 +47,9 @@
String facetType = bundle.getFacetName();
BedDiffYearResult bData = (BedDiffYearResult) data;
- double[][] points;
- if (BED_DIFFERENCE_YEAR_HEIGHT1.equals(facetType)) {
- points = bData.getHeights1Data();
- } else {
- points = bData.getHeights2Data();
- }
XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme);
StyledSeriesBuilder.addPointsFactorY(series,
- points,
+ bData.getHeightPerYearData(),
false,
GAP_TOLERANCE,
100d);
@@ -68,51 +62,8 @@
}
@Override
- public void doOut(
- XYChartGenerator generator,
- ArtifactAndFacet bundle,
- ThemeDocument theme,
- boolean visible,
- int axidx
- ) {
- CallContext context = generator.getCallContext();
- Object data = bundle.getData(context);
- if (data instanceof BedDiffYearResult) {
- String facetType = bundle.getFacetName();
- BedDiffYearResult bData = (BedDiffYearResult) data;
-
- double[][] points;
- if (BED_DIFFERENCE_YEAR.equals(facetType)
- || BED_DIFFERENCE_YEAR_FILTERED.equals(facetType)) {
- points = bData.getHeightPerYearData();
- }
- else if (BED_DIFFERENCE_YEAR_HEIGHT1.equals(facetType)) {
- points = bData.getHeights1Data();
- } else {
- points = bData.getHeights2Data();
- }
- XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme);
- StyledSeriesBuilder.addPointsFactorY(series,
- points,
- false,
- GAP_TOLERANCE,
- 100d);
-
- generator.addAxisSeries(series, axidx, visible);
-
- return;
- }
- logger.error("Can't process " + data.getClass().getName() + " objects");
- }
-
- @Override
public boolean canHandle(String facetType) {
- return
- BED_DIFFERENCE_YEAR_HEIGHT1.equals(facetType)
- || BED_DIFFERENCE_YEAR_HEIGHT2.equals(facetType)
- || BED_DIFFERENCE_YEAR_HEIGHT1_FILTERED.equals(facetType)
- || BED_DIFFERENCE_YEAR_HEIGHT2_FILTERED.equals(facetType)
- || BED_DIFFERENCE_YEAR.equals(facetType) // from BedDifferencesYear
+ return BED_DIFFERENCE_YEAR.equals(facetType) // from BedDifferencesYear
|| BED_DIFFERENCE_YEAR_FILTERED.equals(facetType); // from BedDifferencesYear
}
diff -r a877d2680a4a -r f1257717fa4b artifacts/src/main/java/org/dive4elements/river/exports/process/BedHeightProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedHeightProcessor.java Tue Dec 17 17:59:37 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedHeightProcessor.java Tue Dec 17 18:27:13 2013 +0100
@@ -17,9 +17,11 @@
import org.dive4elements.artifacts.CallContext;
import org.dive4elements.river.artifacts.D4EArtifact;
import org.dive4elements.river.artifacts.model.minfo.BedHeightSingleData;
+import org.dive4elements.river.artifacts.model.minfo.BedDiffYearResult;
import org.dive4elements.river.artifacts.model.FacetTypes;
import org.dive4elements.river.exports.XYChartGenerator;
import org.dive4elements.river.exports.DiagramGenerator;
+import org.dive4elements.river.exports.StyledSeriesBuilder;
import org.dive4elements.river.jfree.StyledXYSeries;
import org.dive4elements.river.model.BedHeightSingleValue;
import org.dive4elements.river.themes.ThemeDocument;
@@ -35,6 +37,8 @@
public static final String I18N_AXIS_LABEL =
"chart.bedheight.height.yaxis.label";
+ protected static double GAP_TOLERANCE = 0.101d;
+
@Override
public void doOut(
DiagramGenerator generator,
@@ -63,7 +67,24 @@
Object data = bundle.getData(context);
XYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
theme);
- if (data instanceof BedHeightSingleData) {
+ if (data instanceof BedDiffYearResult) {
+ BedDiffYearResult bData = (BedDiffYearResult) data;
+
+ double[][] points;
+ String facetType = bundle.getFacetName();
+
+ if (FacetTypes.BED_DIFFERENCE_YEAR_HEIGHT1.equals(facetType) ||
+ FacetTypes.BED_DIFFERENCE_YEAR_HEIGHT1_FILTERED.equals(facetType)) {
+ points = bData.getHeights1Data();
+ } else {
+ points = bData.getHeights2Data();
+ }
+ StyledSeriesBuilder.addPointsFactorY(series,
+ points,
+ false,
+ GAP_TOLERANCE,
+ 1d);
+ } else if (data instanceof BedHeightSingleData) {
BedHeightSingleData bData = (BedHeightSingleData)data;
double[] heights = bData.getHeights();
double[] stations = bData.getStations().toNativeArray();
@@ -73,7 +94,8 @@
for (int i = 0; i < heights.length; i++) {
series.add(stations[i], heights[i], false);
}
- } else if (data instanceof List<?>) {
+ }
+ else if (data instanceof List<?>) {
List<BedHeightSingleValue> bData = (List<BedHeightSingleValue>)data;
logger.debug("doBedheightSingleValueOut");
@@ -90,8 +112,12 @@
@Override
- public boolean canHandle(String facettype) {
- return FacetTypes.BEDHEIGHT.equals(facettype);
+ public boolean canHandle(String facetType) {
+ return FacetTypes.BEDHEIGHT.equals(facetType)
+ || FacetTypes.BED_DIFFERENCE_YEAR_HEIGHT1.equals(facetType)
+ || FacetTypes.BED_DIFFERENCE_YEAR_HEIGHT2.equals(facetType)
+ || FacetTypes.BED_DIFFERENCE_YEAR_HEIGHT1_FILTERED.equals(facetType)
+ || FacetTypes.BED_DIFFERENCE_YEAR_HEIGHT2_FILTERED.equals(facetType);
}
@Override
More information about the Dive4elements-commits
mailing list