[PATCH 2 of 3] BedDiffHeightYearGenerator: Correct list size check, in
Wald Commits
scm-commit at wald.intevation.org
Wed Jul 10 09:56:22 CEST 2013
# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1373441503 -7200
# Node ID 7cf3b3bcd439a4a131ef74417379fca9870a21c6
# Parent e7eb3c4afcf33ccbe97ce0d6487eebe7d5561bb6
BedDiffHeightYearGenerator: Correct list size check, in
BedDifferenceYearGenerator do analog refactoring.
diff -r e7eb3c4afcf3 -r 7cf3b3bcd439 artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDiffHeightYearGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDiffHeightYearGenerator.java Tue Jul 09 10:50:33 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDiffHeightYearGenerator.java Wed Jul 10 09:31:43 2013 +0200
@@ -133,7 +133,7 @@
}
else if (getXBounds(0) == null && getDomainAxisRange() == null) {
BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context);
- if (data.getKms().size() >= 0) {
+ if (data.getKms().size() > 0) {
context.putContextValue("startkm", data.getKms().min());
context.putContextValue("endkm", data.getKms().max());
}
diff -r e7eb3c4afcf3 -r 7cf3b3bcd439 artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceYearGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceYearGenerator.java Tue Jul 09 10:50:33 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceYearGenerator.java Wed Jul 10 09:31:43 2013 +0200
@@ -86,6 +86,37 @@
};
}
+ public void setContextBounds(ArtifactAndFacet bundle) {
+ if (getXBounds(0) != null && getDomainAxisRange() != null) {
+ Bounds bounds =
+ calculateZoom(getXBounds(0), getDomainAxisRange());
+ context.putContextValue("startkm", bounds.getLower());
+ context.putContextValue("endkm", bounds.getUpper());
+ }
+ else if (getXBounds(0) != null && getDomainAxisRange() == null) {
+ context.putContextValue("startkm", getXBounds(0).getLower());
+ context.putContextValue("endkm", getXBounds(0).getUpper());
+ }
+ else if (getXBounds(0) == null && getDomainAxisRange() == null) {
+ BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context);
+ if (data.getKms().size() > 0) {
+ context.putContextValue("startkm", data.getKms().min());
+ context.putContextValue("endkm", data.getKms().max());
+ }
+ else {
+ logger.warn("No data to define start and end km");
+ }
+ }
+ else if (getXBounds(0) == null && getDomainAxisRange() != null){
+ BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context);
+ Bounds b = new DoubleBounds(data.getKms().min(), data.getKms().max());
+ Bounds bounds =
+ calculateZoom(b, getDomainAxisRange());
+ context.putContextValue("startkm", bounds.getLower());
+ context.putContextValue("endkm", bounds.getUpper());
+ }
+ }
+
@Override
public void doOut(ArtifactAndFacet bundle, Document attr, boolean visible) {
String name = bundle.getFacetName();
@@ -103,29 +134,8 @@
return;
}
- if (getXBounds(0) != null && getDomainAxisRange() != null) {
- Bounds bounds =
- calculateZoom(getXBounds(0), getDomainAxisRange());
- context.putContextValue("startkm", bounds.getLower());
- context.putContextValue("endkm", bounds.getUpper());
- }
- else if (getXBounds(0) != null && getDomainAxisRange() == null) {
- context.putContextValue("startkm", getXBounds(0).getLower());
- context.putContextValue("endkm", getXBounds(0).getUpper());
- }
- else if (getXBounds(0) == null && getDomainAxisRange() == null) {
- BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context);
- context.putContextValue("startkm", data.getKms().min());
- context.putContextValue("endkm", data.getKms().max());
- }
- else if (getXBounds(0) == null && getDomainAxisRange() != null){
- BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context);
- Bounds b = new DoubleBounds(data.getKms().min(), data.getKms().max());
- Bounds bounds =
- calculateZoom(b, getDomainAxisRange());
- context.putContextValue("startkm", bounds.getLower());
- context.putContextValue("endkm", bounds.getUpper());
- }
+ setContextBounds(bundle);
+
Processor processor = new KMIndexProcessor();
Processor woutp = new WOutProcessor();
if (name.equals(BED_DIFFERENCE_YEAR)) {
More information about the Dive4elements-commits
mailing list