comparison 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
comparison
equal deleted inserted replaced
592:3c939c95c477 593:b248531fa20b
1 /**
2 *
3 */
4 package de.intevation.gnv.artifacts.context; 1 package de.intevation.gnv.artifacts.context;
5 2
6 import java.awt.Color; 3 import java.awt.Color;
7 import java.awt.Paint; 4 import java.awt.Paint;
8 5
78 public final static String HORIZONTAL_CROSS_SECTION_GROUND_INTERPOLATION = 75 public final static String HORIZONTAL_CROSS_SECTION_GROUND_INTERPOLATION =
79 "/artifact-database/gnv/horizontal-cross-section/ground/@interpolation"; 76 "/artifact-database/gnv/horizontal-cross-section/ground/@interpolation";
80 77
81 public final static String HORIZONTAL_CROSS_SECTION_SAMPLES = 78 public final static String HORIZONTAL_CROSS_SECTION_SAMPLES =
82 "/artifact-database/gnv/horizontal-cross-section/samples/@number"; 79 "/artifact-database/gnv/horizontal-cross-section/samples/@number";
80
81 public final static String HORIZONTAL_CROSS_SECTION_EXTRAPOLATION_ROUNDS =
82 "/artifact-database/gnv/horizontal-cross-section/extrapolation/@rounds";
83 83
84 public final static String HORIZONTAL_CROSS_SECTION_RESULT_SHAPEFILE_PATH = 84 public final static String HORIZONTAL_CROSS_SECTION_RESULT_SHAPEFILE_PATH =
85 "/artifact-database/gnv/horizontal-cross-section/result-shapefile-directory/@path"; 85 "/artifact-database/gnv/horizontal-cross-section/result-shapefile-directory/@path";
86 86
87 public final static String VERTICAL_CROSS_SECTION_SAMPLES = 87 public final static String VERTICAL_CROSS_SECTION_SAMPLES =
362 GNVArtifactContext context 362 GNVArtifactContext context
363 ) { 363 ) {
364 log.info("configuration of horizontal cross section"); 364 log.info("configuration of horizontal cross section");
365 365
366 configureHorizontalCrossSectionSamples(config, context); 366 configureHorizontalCrossSectionSamples(config, context);
367 configureHorizontalCrossSectionExtrapolation(config, context);
367 configureHorizontalCrossSectionResultShapeFilePath(config, context); 368 configureHorizontalCrossSectionResultShapeFilePath(config, context);
368 configureHorizontalCrossSectionGroundInterpolation(config, context); 369 configureHorizontalCrossSectionGroundInterpolation(config, context);
370 }
371
372 protected void configureHorizontalCrossSectionExtrapolation(
373 Document config,
374 GNVArtifactContext context
375 )
376 {
377 log.info(
378 "configuration of horizontal cross section extrapolation");
379
380 String extrapolationRoundsValue = Config.getStringXPath(
381 config,
382 HORIZONTAL_CROSS_SECTION_EXTRAPOLATION_ROUNDS);
383
384 Integer extrapolationRounds =
385 GNVArtifactContext.DEFAULT_HORIZONTAL_CROSS_SECTION_EXTRAPOLATION_ROUNDS;
386
387 if (extrapolationRoundsValue != null
388 && (extrapolationRoundsValue = extrapolationRoundsValue.trim()).length() > 0
389 ) {
390 try {
391 extrapolationRounds =
392 Integer.valueOf(extrapolationRoundsValue);
393 }
394 catch (NumberFormatException nfe) {
395 log.error(
396 "'" + extrapolationRoundsValue + "' is not a valid integer");
397 }
398 }
399
400 log.info("extrapolation rounds: " + extrapolationRounds);
401
402 context.put(
403 GNVArtifactContext
404 .HORIZONTAL_CROSS_SECTION_EXTRAPOLATION_ROUNDS_KEY,
405 extrapolationRounds);
369 } 406 }
370 407
371 protected void configureHorizontalCrossSectionGroundInterpolation( 408 protected void configureHorizontalCrossSectionGroundInterpolation(
372 Document config, 409 Document config,
373 GNVArtifactContext context 410 GNVArtifactContext context

http://dive4elements.wald.intevation.org