changeset 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 06887e2e3f7a
children a6a33ef35809
files gnv-artifacts/ChangeLog gnv-artifacts/doc/conf/conf.xml gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContext.java gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java
diffstat 4 files changed, 101 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog	Tue Jan 12 17:41:59 2010 +0000
+++ b/gnv-artifacts/ChangeLog	Wed Jan 13 18:58:26 2010 +0000
@@ -1,3 +1,11 @@
+2010-01-12	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* doc/conf/conf.xml,
+	  src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContext.java,
+	  src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java:
+	  Added configuration od file system directory of generate "Horizontalschnitt"
+	  shape files.
+
 2010-01-12	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/gnv/utils/WKTUtils.java,
--- a/gnv-artifacts/doc/conf/conf.xml	Tue Jan 12 17:41:59 2010 +0000
+++ b/gnv-artifacts/doc/conf/conf.xml	Wed Jan 13 18:58:26 2010 +0000
@@ -412,14 +412,18 @@
                      description="Palette for water temperature"
                      file="${artifacts.config.dir}/palette/water-temperature.xml"/>
         </palettes>
+
         <horizontal-cross-section-profile>
             <!-- This section configures the "horizontales Schnittprofil" -->
             <samples number="200"/>
         </horizontal-cross-section-profile>
+
         <horizontal-cross-section>
             <!-- This section configures the HorizontalCrossSection ("Horizontalschnitt") -->
-            <samples number="200"/>
+            <samples number="1024"/>
+            <result-shapefile-directory path="${artifacts.config.dir}/../shapefiles/"/>
         </horizontal-cross-section>
+
         <vertical-cross-section>
             <!-- This section configures the "Profilschnitt" -->
             <samples width="1024" height="768"/>
@@ -433,12 +437,14 @@
             -->
         </vertical-cross-section>
     </gnv>
+
     <ehcache>
         <!--  In this Section the Path to Configurationfile for the EHCache,
               which is unsed to store the Results of the Artifacts ,
               is given.-->
         <configuration>${artifacts.config.dir}/ehcache.xml</configuration>
     </ehcache>
+
     <geo-backend>
         <!--  In this Section the required Configuration for the geo-backend is
               given. It is possible to configue the Path of the  ConnectionPool-
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContext.java	Tue Jan 12 17:41:59 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContext.java	Wed Jan 13 18:58:26 2010 +0000
@@ -9,6 +9,8 @@
 
 import java.awt.Dimension;
 
+import java.io.File;
+
 import de.intevation.artifactdatabase.DefaultArtifactContext;
 
 /**
@@ -32,6 +34,14 @@
     public static final String HORIZONTAL_CROSS_SECTION_SAMPLES_KEY =
         "gnv.horizontal.cross.section.samples";
 
+    public static final String
+        HORIZONTAL_CROSS_SECTION_RESULT_SHAPEFILE_PATH_KEY =
+        "gnv.horizontal.cross.section.result.shapefile";
+
+    public static final File
+        DEFAULT_HORIZONTAL_CROSS_SECTION_PROFILE_SHAPEFILE_PATH = 
+        new File(System.getProperty("java.io.tmpdir"));
+
     public static final Integer 
         DEFAULT_HORIZONTAL_CROSS_SECTION_PROFILE_SAMPLES = Integer.valueOf(250);
     
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java	Tue Jan 12 17:41:59 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java	Wed Jan 13 18:58:26 2010 +0000
@@ -75,6 +75,9 @@
     public final static String HORIZONTAL_CROSS_SECTION_SAMPLES =
         "/artifact-database/gnv/horizontal-cross-section/samples/@number";
     
+    public final static String HORIZONTAL_CROSS_SECTION_RESULT_SHAPEFILE_PATH =
+        "/artifact-database/gnv/horizontal-cross-section/result-shapefile-directory/@path";
+    
     public final static String VERTICAL_CROSS_SECTION_SAMPLES =
         "/artifact-database/gnv/vertical-cross-section/samples";
 
@@ -313,37 +316,79 @@
     }
     
     protected void configureHorizontalCrossSection(
-          Document           config,
-          GNVArtifactContext context
-      )
-      {
-          log.info("configuration of horizontal cross section");
-    
-          String numSamples = Config.getStringXPath(
-              config,
-              HORIZONTAL_CROSS_SECTION_SAMPLES);
-    
-          Integer samples =
-              GNVArtifactContext.DEFAULT_HORIZONTAL_CROSS_SECTION_SAMPLES;
-    
-          if (numSamples == null) {
-              log.warn("No number of samples found.");
-          }
-          else {
-              try {
-                  samples = Integer.valueOf(numSamples);
-              }
-              catch (NumberFormatException nfe) {
-                  log.warn("Invalid integer for number of samples");
-              }
-          }
-    
-          log.info("# horizontal cross section profile samples: " + samples);
-    
-          context.put(
-              GNVArtifactContext.HORIZONTAL_CROSS_SECTION_SAMPLES_KEY,
-              samples);
-      }
+        Document           config,
+        GNVArtifactContext context
+    ) {
+        log.info("configuration of horizontal cross section");
+
+        configureHorizontalCrossSectionSamples(config, context);
+        configureHorizontalCrossSectionResultShapeFilePath(config, context);
+    }
+
+    protected void configureHorizontalCrossSectionResultShapeFilePath(
+        Document           config,
+        GNVArtifactContext context
+    )
+    {
+        log.info(
+            "configuration of horizontal cross section result shape file path");
+
+        File dir = 
+            GNVArtifactContext.
+            DEFAULT_HORIZONTAL_CROSS_SECTION_PROFILE_SHAPEFILE_PATH;
+
+        String path = Config.getStringXPath(
+            config,
+            HORIZONTAL_CROSS_SECTION_RESULT_SHAPEFILE_PATH);
+
+        if (path != null && (path = path.trim()).length() > 0) {
+            dir = new File(Config.replaceConfigDir(path));
+        }
+        else {
+            log.warn("No 'result-shapefile-directory' given");
+        }
+
+        log.info("writing shape files to '" 
+            + dir.getAbsolutePath() + "'");
+
+        context.put(
+            GNVArtifactContext
+                .HORIZONTAL_CROSS_SECTION_RESULT_SHAPEFILE_PATH_KEY,
+            dir);
+    }
+
+    protected void configureHorizontalCrossSectionSamples(
+        Document           config,
+        GNVArtifactContext context
+    )
+    {
+        log.info("configuration of horizontal cross section samples");
+        String numSamples = Config.getStringXPath(
+            config,
+            HORIZONTAL_CROSS_SECTION_SAMPLES);
+
+        Integer samples =
+            GNVArtifactContext.DEFAULT_HORIZONTAL_CROSS_SECTION_SAMPLES;
+
+        if (numSamples == null) {
+            log.warn("No number of samples found.");
+        }
+        else {
+            try {
+                samples = Integer.valueOf(numSamples);
+            }
+            catch (NumberFormatException nfe) {
+                log.warn("Invalid integer for number of samples");
+            }
+        }
+
+        log.info("# horizontal cross section profile samples: " + samples);
+
+        context.put(
+            GNVArtifactContext.HORIZONTAL_CROSS_SECTION_SAMPLES_KEY,
+            samples);
+    }
+
 
     protected void configureChartTemplate(
         Document           config,

http://dive4elements.wald.intevation.org