Mercurial > dive4elements > gnv-client
diff gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java @ 593:b248531fa20b
Added experimental support for extrapolation in "Horizontalschnitte"
gnv-artifacts/trunk@648 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sun, 31 Jan 2010 21:50:15 +0000 |
parents | 1bf058f1a2d1 |
children | 40ead2d2a08d |
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java Fri Jan 29 13:28:28 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java Sun Jan 31 21:50:15 2010 +0000 @@ -1,6 +1,3 @@ -/** - * - */ package de.intevation.gnv.artifacts.context; import java.awt.Color; @@ -81,6 +78,9 @@ public final static String HORIZONTAL_CROSS_SECTION_SAMPLES = "/artifact-database/gnv/horizontal-cross-section/samples/@number"; + public final static String HORIZONTAL_CROSS_SECTION_EXTRAPOLATION_ROUNDS = + "/artifact-database/gnv/horizontal-cross-section/extrapolation/@rounds"; + public final static String HORIZONTAL_CROSS_SECTION_RESULT_SHAPEFILE_PATH = "/artifact-database/gnv/horizontal-cross-section/result-shapefile-directory/@path"; @@ -364,10 +364,47 @@ log.info("configuration of horizontal cross section"); configureHorizontalCrossSectionSamples(config, context); + configureHorizontalCrossSectionExtrapolation(config, context); configureHorizontalCrossSectionResultShapeFilePath(config, context); configureHorizontalCrossSectionGroundInterpolation(config, context); } + protected void configureHorizontalCrossSectionExtrapolation( + Document config, + GNVArtifactContext context + ) + { + log.info( + "configuration of horizontal cross section extrapolation"); + + String extrapolationRoundsValue = Config.getStringXPath( + config, + HORIZONTAL_CROSS_SECTION_EXTRAPOLATION_ROUNDS); + + Integer extrapolationRounds = + GNVArtifactContext.DEFAULT_HORIZONTAL_CROSS_SECTION_EXTRAPOLATION_ROUNDS; + + if (extrapolationRoundsValue != null + && (extrapolationRoundsValue = extrapolationRoundsValue.trim()).length() > 0 + ) { + try { + extrapolationRounds = + Integer.valueOf(extrapolationRoundsValue); + } + catch (NumberFormatException nfe) { + log.error( + "'" + extrapolationRoundsValue + "' is not a valid integer"); + } + } + + log.info("extrapolation rounds: " + extrapolationRounds); + + context.put( + GNVArtifactContext + .HORIZONTAL_CROSS_SECTION_EXTRAPOLATION_ROUNDS_KEY, + extrapolationRounds); + } + protected void configureHorizontalCrossSectionGroundInterpolation( Document config, GNVArtifactContext context