Mercurial > dive4elements > river
changeset 7682:2f7a01fdb093
Extracted method.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 11 Dec 2013 10:39:11 +0100 |
parents | 4e76bfff5fa6 |
children | 28758f51f1b2 |
files | artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceEpochGenerator.java |
diffstat | 1 files changed, 30 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceEpochGenerator.java Tue Dec 10 11:22:06 2013 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceEpochGenerator.java Wed Dec 11 10:39:11 2013 +0100 @@ -101,31 +101,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) { - D4EArtifact artifact = (D4EArtifact)bundle.getArtifact(); - FlowVelocityAccess access = new FlowVelocityAccess(artifact); - context.putContextValue("startkm", access.getLowerKM()); - context.putContextValue("endkm", access.getUpperKM()); - } - else if (getXBounds(0) == null && getDomainAxisRange() != null){ - D4EArtifact artifact = (D4EArtifact)bundle.getArtifact(); - FlowVelocityAccess access = new FlowVelocityAccess(artifact); - Bounds b = new DoubleBounds(access.getLowerKM(), access.getUpperKM()); - Bounds bounds = - calculateZoom(b, getDomainAxisRange()); - context.putContextValue("startkm", bounds.getLower()); - context.putContextValue("endkm", bounds.getUpper()); - } + setContextBoundsEpoch(bundle); + Processor processor = new KMIndexProcessor(); Processor woutp = new WOutProcessor(); if (name.equals(BED_DIFFERENCE_EPOCH)) { @@ -179,6 +156,34 @@ } } + protected void setContextBoundsEpoch(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) { + D4EArtifact artifact = (D4EArtifact)bundle.getArtifact(); + FlowVelocityAccess access = new FlowVelocityAccess(artifact); + context.putContextValue("startkm", access.getLowerKM()); + context.putContextValue("endkm", access.getUpperKM()); + } + else if (getXBounds(0) == null && getDomainAxisRange() != null){ + D4EArtifact artifact = (D4EArtifact)bundle.getArtifact(); + FlowVelocityAccess access = new FlowVelocityAccess(artifact); + Bounds b = new DoubleBounds(access.getLowerKM(), access.getUpperKM()); + Bounds bounds = + calculateZoom(b, getDomainAxisRange()); + context.putContextValue("startkm", bounds.getLower()); + context.putContextValue("endkm", bounds.getUpper()); + } + } + @Override protected String getDefaultChartTitle() { return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT);