comparison 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
comparison
equal deleted inserted replaced
1950:37a7b3841565 3809:cc83b8e42dbe
285 } 285 }
286 } 286 }
287 287
288 288
289 protected void setGel(FLYSArtifact artifact, WSPLGENJob job) { 289 protected void setGel(FLYSArtifact artifact, WSPLGENJob job) {
290 String gel = artifact.getDataAsString("use_floodplain"); 290 String gel = artifact.getDataAsString("scenario");
291 291
292 if (gel != null && gel.length() > 0) { 292 logger.debug("Selected gel = '" + gel + "'");
293 boolean use = Boolean.parseBoolean(gel); 293
294 294 if (gel == null || gel.length() == 0) {
295 if (use) { 295 job.setGel(WSPLGENJob.GEL_NOSPERRE);
296 job.setGel(WSPLGENJob.GEL_SPERRE); 296 }
297 } 297 else if (gel.equals("scenario.current")) {
298 else { 298 job.setGel(WSPLGENJob.GEL_SPERRE);
299 job.setGel(WSPLGENJob.GEL_NOSPERRE); 299 }
300 } 300 else if (gel.equals("scenario.scenario")) {
301 job.setGel(WSPLGENJob.GEL_SPERRE);
302 }
303 else {
304 job.setGel(WSPLGENJob.GEL_NOSPERRE);
301 } 305 }
302 } 306 }
303 307
304 308
305 protected void setDist(FLYSArtifact artifact, WSPLGENJob job) { 309 protected void setDist(FLYSArtifact artifact, WSPLGENJob job) {
345 349
346 Object[][] obj = new Object[][] { 350 Object[][] obj = new Object[][] {
347 new Object[] { "typ", String.class } 351 new Object[] { "typ", String.class }
348 }; 352 };
349 353
354 String scenario = job.getGel();
355
350 boolean l = GeometryUtils.writeShapefile( 356 boolean l = GeometryUtils.writeShapefile(
351 shapeLines, 357 shapeLines,
352 GeometryUtils.buildFeatureType("lines", srs, LineString.class, obj), 358 GeometryUtils.buildFeatureType("lines", srs, LineString.class, obj),
353 fcs[0]); 359 fcs[0]);
354 360
355 if (l) { 361 if (l) {
356 logger.debug( 362 logger.debug(
357 "Successfully created barrier line shapefile. " + 363 "Successfully created barrier line shapefile. " +
358 "Write shapefile path into WSPLGEN job."); 364 "Write shapefile path into WSPLGEN job.");
359 job.addLin(shapeLines.getAbsolutePath()); 365
366 if (scenario.equals(WSPLGENJob.GEL_NOSPERRE)) {
367 logger.debug("WSPLGEN will not use barrier features.");
368 }
369 else {
370 job.addLin(shapeLines.getAbsolutePath());
371 }
360 } 372 }
361 373
362 boolean p = GeometryUtils.writeShapefile( 374 boolean p = GeometryUtils.writeShapefile(
363 shapePolys, 375 shapePolys,
364 GeometryUtils.buildFeatureType("polygons", srs, Polygon.class, obj), 376 GeometryUtils.buildFeatureType("polygons", srs, Polygon.class, obj),
366 378
367 if (p) { 379 if (p) {
368 logger.debug( 380 logger.debug(
369 "Successfully created barrier polygon shapefile. " + 381 "Successfully created barrier polygon shapefile. " +
370 "Write shapefile path into WSPLGEN job."); 382 "Write shapefile path into WSPLGEN job.");
371 job.addLin(shapePolys.getAbsolutePath()); 383
384 if (scenario.equals(WSPLGENJob.GEL_NOSPERRE)) {
385 logger.debug("WSPLGEN will not use barrier features.");
386 }
387 else {
388 job.addLin(shapePolys.getAbsolutePath());
389 }
372 } 390 }
373 391
374 if (p || l) { 392 if (p || l) {
375 facetCreator.createBarrierFacet(); 393 facetCreator.createBarrierFacet();
376 } 394 }
579 job.setDgm(dgm.getPath()); 597 job.setDgm(dgm.getPath());
580 } 598 }
581 599
582 600
583 protected void setArea(FLYSArtifact artifact, File dir, WSPLGENJob job) { 601 protected void setArea(FLYSArtifact artifact, File dir, WSPLGENJob job) {
602 String useFloodplain = artifact.getDataAsString("use_floodplain");
603 if (!Boolean.valueOf(useFloodplain)) {
604 logger.debug("WSPLGEN will not use floodplain.");
605 return;
606 }
607
584 String river = artifact.getDataAsString("river"); 608 String river = artifact.getDataAsString("river");
585 String srid = FLYSUtils.getRiverSrid(artifact); 609 String srid = FLYSUtils.getRiverSrid(artifact);
586 String srs = "EPSG:" + srid; 610 String srs = "EPSG:" + srid;
587 611
588 Floodplain plain = Floodplain.getFloodplain(river); 612 Floodplain plain = Floodplain.getFloodplain(river);

http://dive4elements.wald.intevation.org