Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java @ 472:d6a100d5f74a
Added configuration of directory of "Horizontalschnitt" shape files.
gnv-artifacts/trunk@537 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 13 Jan 2010 18:58:26 +0000 |
parents | 7ba4c7222265 |
children | ab29e4ff2fda |
comparison
equal
deleted
inserted
replaced
471:06887e2e3f7a | 472:d6a100d5f74a |
---|---|
72 public final static String HORIZONTAL_CROSS_SECTION_PROFILE_SAMPLES = | 72 public final static String HORIZONTAL_CROSS_SECTION_PROFILE_SAMPLES = |
73 "/artifact-database/gnv/horizontal-cross-section-profile/samples/@number"; | 73 "/artifact-database/gnv/horizontal-cross-section-profile/samples/@number"; |
74 | 74 |
75 public final static String HORIZONTAL_CROSS_SECTION_SAMPLES = | 75 public final static String HORIZONTAL_CROSS_SECTION_SAMPLES = |
76 "/artifact-database/gnv/horizontal-cross-section/samples/@number"; | 76 "/artifact-database/gnv/horizontal-cross-section/samples/@number"; |
77 | |
78 public final static String HORIZONTAL_CROSS_SECTION_RESULT_SHAPEFILE_PATH = | |
79 "/artifact-database/gnv/horizontal-cross-section/result-shapefile-directory/@path"; | |
77 | 80 |
78 public final static String VERTICAL_CROSS_SECTION_SAMPLES = | 81 public final static String VERTICAL_CROSS_SECTION_SAMPLES = |
79 "/artifact-database/gnv/vertical-cross-section/samples"; | 82 "/artifact-database/gnv/vertical-cross-section/samples"; |
80 | 83 |
81 public final static String VERTICAL_CROSS_SECTION_FILTERS = | 84 public final static String VERTICAL_CROSS_SECTION_FILTERS = |
311 GNVArtifactContext.HORIZONTAL_CROSS_SECTION_PROFILE_SAMPLES_KEY, | 314 GNVArtifactContext.HORIZONTAL_CROSS_SECTION_PROFILE_SAMPLES_KEY, |
312 samples); | 315 samples); |
313 } | 316 } |
314 | 317 |
315 protected void configureHorizontalCrossSection( | 318 protected void configureHorizontalCrossSection( |
316 Document config, | 319 Document config, |
317 GNVArtifactContext context | 320 GNVArtifactContext context |
318 ) | 321 ) { |
319 { | 322 log.info("configuration of horizontal cross section"); |
320 log.info("configuration of horizontal cross section"); | 323 |
321 | 324 configureHorizontalCrossSectionSamples(config, context); |
322 String numSamples = Config.getStringXPath( | 325 configureHorizontalCrossSectionResultShapeFilePath(config, context); |
323 config, | 326 } |
324 HORIZONTAL_CROSS_SECTION_SAMPLES); | 327 |
325 | 328 protected void configureHorizontalCrossSectionResultShapeFilePath( |
326 Integer samples = | 329 Document config, |
327 GNVArtifactContext.DEFAULT_HORIZONTAL_CROSS_SECTION_SAMPLES; | 330 GNVArtifactContext context |
328 | 331 ) |
329 if (numSamples == null) { | 332 { |
330 log.warn("No number of samples found."); | 333 log.info( |
331 } | 334 "configuration of horizontal cross section result shape file path"); |
332 else { | 335 |
333 try { | 336 File dir = |
334 samples = Integer.valueOf(numSamples); | 337 GNVArtifactContext. |
335 } | 338 DEFAULT_HORIZONTAL_CROSS_SECTION_PROFILE_SHAPEFILE_PATH; |
336 catch (NumberFormatException nfe) { | 339 |
337 log.warn("Invalid integer for number of samples"); | 340 String path = Config.getStringXPath( |
338 } | 341 config, |
339 } | 342 HORIZONTAL_CROSS_SECTION_RESULT_SHAPEFILE_PATH); |
340 | 343 |
341 log.info("# horizontal cross section profile samples: " + samples); | 344 if (path != null && (path = path.trim()).length() > 0) { |
342 | 345 dir = new File(Config.replaceConfigDir(path)); |
343 context.put( | 346 } |
344 GNVArtifactContext.HORIZONTAL_CROSS_SECTION_SAMPLES_KEY, | 347 else { |
345 samples); | 348 log.warn("No 'result-shapefile-directory' given"); |
346 } | 349 } |
350 | |
351 log.info("writing shape files to '" | |
352 + dir.getAbsolutePath() + "'"); | |
353 | |
354 context.put( | |
355 GNVArtifactContext | |
356 .HORIZONTAL_CROSS_SECTION_RESULT_SHAPEFILE_PATH_KEY, | |
357 dir); | |
358 } | |
359 | |
360 protected void configureHorizontalCrossSectionSamples( | |
361 Document config, | |
362 GNVArtifactContext context | |
363 ) | |
364 { | |
365 log.info("configuration of horizontal cross section samples"); | |
366 String numSamples = Config.getStringXPath( | |
367 config, | |
368 HORIZONTAL_CROSS_SECTION_SAMPLES); | |
369 | |
370 Integer samples = | |
371 GNVArtifactContext.DEFAULT_HORIZONTAL_CROSS_SECTION_SAMPLES; | |
372 | |
373 if (numSamples == null) { | |
374 log.warn("No number of samples found."); | |
375 } | |
376 else { | |
377 try { | |
378 samples = Integer.valueOf(numSamples); | |
379 } | |
380 catch (NumberFormatException nfe) { | |
381 log.warn("Invalid integer for number of samples"); | |
382 } | |
383 } | |
384 | |
385 log.info("# horizontal cross section profile samples: " + samples); | |
386 | |
387 context.put( | |
388 GNVArtifactContext.HORIZONTAL_CROSS_SECTION_SAMPLES_KEY, | |
389 samples); | |
390 } | |
391 | |
347 | 392 |
348 protected void configureChartTemplate( | 393 protected void configureChartTemplate( |
349 Document config, | 394 Document config, |
350 GNVArtifactContext context | 395 GNVArtifactContext context |
351 ) { | 396 ) { |