diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java @ 3809:cc83b8e42dbe

Picked rev3347-rev3351 from trunk. flys-artifacts/tags/pre2.6-2011-12-05@3352 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 05 Dec 2011 09:48:44 +0000
parents 06c157848c8f
children 368040e5c400
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java	Fri Dec 02 11:01:11 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java	Mon Dec 05 09:48:44 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