changeset 1955:ccf2235035d6

Various bugfixes in WSPLGEN parameterization. flys-artifacts/trunk@3351 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 05 Dec 2011 09:35:00 +0000
parents 2adfedaf4dd2
children a5f87f8dbe57
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java
diffstat 2 files changed, 43 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Mon Dec 05 09:33:20 2011 +0000
+++ b/flys-artifacts/ChangeLog	Mon Dec 05 09:35:00 2011 +0000
@@ -1,3 +1,10 @@
+2011-12-05  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java:
+	  Bugfix: Evaluate the correct parameter whether to set the floodplain or
+	  not. In addition, the scenario parameter used by WSPLGEN is now set
+	  correctly.
+
 2011-12-05	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	Allow longitudinal_section.q facets in wdiff states output.
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java	Mon Dec 05 09:33:20 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java	Mon Dec 05 09:35:00 2011 +0000
@@ -287,17 +287,21 @@
 
 
     protected void setGel(FLYSArtifact artifact, WSPLGENJob job) {
-        String gel = artifact.getDataAsString("use_floodplain");
-
-        if (gel != null && gel.length() > 0) {
-            boolean use = Boolean.parseBoolean(gel);
+        String gel = artifact.getDataAsString("scenario");
 
-            if (use) {
-                job.setGel(WSPLGENJob.GEL_SPERRE);
-            }
-            else {
-                job.setGel(WSPLGENJob.GEL_NOSPERRE);
-            }
+        logger.debug("Selected gel = '" + gel + "'");
+
+        if (gel == null || gel.length() == 0) {
+            job.setGel(WSPLGENJob.GEL_NOSPERRE);
+        }
+        else if (gel.equals("scenario.current")) {
+            job.setGel(WSPLGENJob.GEL_SPERRE);
+        }
+        else if (gel.equals("scenario.scenario")) {
+            job.setGel(WSPLGENJob.GEL_SPERRE);
+        }
+        else {
+            job.setGel(WSPLGENJob.GEL_NOSPERRE);
         }
     }
 
@@ -347,6 +351,8 @@
             new Object[] { "typ", String.class }
         };
 
+        String scenario = job.getGel();
+
         boolean l = GeometryUtils.writeShapefile(
             shapeLines,
             GeometryUtils.buildFeatureType("lines", srs, LineString.class, obj),
@@ -356,7 +362,13 @@
             logger.debug(
                 "Successfully created barrier line shapefile. " +
                 "Write shapefile path into WSPLGEN job.");
-            job.addLin(shapeLines.getAbsolutePath());
+
+            if (scenario.equals(WSPLGENJob.GEL_NOSPERRE)) {
+                logger.debug("WSPLGEN will not use barrier features.");
+            }
+            else {
+                job.addLin(shapeLines.getAbsolutePath());
+            }
         }
 
         boolean p = GeometryUtils.writeShapefile(
@@ -368,7 +380,13 @@
             logger.debug(
                 "Successfully created barrier polygon shapefile. " +
                 "Write shapefile path into WSPLGEN job.");
-            job.addLin(shapePolys.getAbsolutePath());
+
+            if (scenario.equals(WSPLGENJob.GEL_NOSPERRE)) {
+                logger.debug("WSPLGEN will not use barrier features.");
+            }
+            else {
+                job.addLin(shapePolys.getAbsolutePath());
+            }
         }
 
         if (p || l) {
@@ -581,6 +599,12 @@
 
 
     protected void setArea(FLYSArtifact artifact, File dir, WSPLGENJob job) {
+        String useFloodplain = artifact.getDataAsString("use_floodplain");
+        if (!Boolean.valueOf(useFloodplain)) {
+            logger.debug("WSPLGEN will not use floodplain.");
+            return;
+        }
+
         String river = artifact.getDataAsString("river");
         String srid  = FLYSUtils.getRiverSrid(artifact);
         String srs   = "EPSG:" + srid;

http://dive4elements.wald.intevation.org