comparison artifacts/src/main/java/org/dive4elements/river/artifacts/states/FloodMapState.java @ 6983:93e7f947f6fa

flys/issue1417 Be more fault tolerant if a river has no flood plain.
author Sascha L. Teichmann <teichmann@intevation.de>
date Tue, 10 Sep 2013 17:48:48 +0200
parents ffc9cb39cea7
children 1f38656b68c4
comparison
equal deleted inserted replaced
6982:5149e6e5c2eb 6983:93e7f947f6fa
880 String srid = RiverUtils.getRiverDGMSrid(river); 880 String srid = RiverUtils.getRiverDGMSrid(river);
881 String srs = "EPSG:" + srid; 881 String srs = "EPSG:" + srid;
882 882
883 Floodplain plain = Floodplain.getFloodplain(river); 883 Floodplain plain = Floodplain.getFloodplain(river);
884 884
885 if (plain == null) {
886 logger.debug("No flood plain for river '" + river + "'");
887 return;
888 }
889
890 Polygon polygon = plain.getGeom();
891 if (polygon == null) {
892 logger.warn("Floodplain has no geometry.");
893 return;
894 }
895
885 SimpleFeatureType ft = GeometryUtils.buildFeatureType( 896 SimpleFeatureType ft = GeometryUtils.buildFeatureType(
886 "talaue", srs, Polygon.class); 897 "talaue", srs, Polygon.class);
887 898
888 SimpleFeatureBuilder builder = new SimpleFeatureBuilder(ft); 899 SimpleFeatureBuilder builder = new SimpleFeatureBuilder(ft);
889 builder.add(plain.getGeom()); 900 builder.add(polygon);
890 901
891 FeatureCollection collection = FeatureCollections.newCollection(); 902 FeatureCollection collection = FeatureCollections.newCollection();
892 collection.add(builder.buildFeature("0")); 903 collection.add(builder.buildFeature("0"));
893 904
894 File talaueShape = new File(dir, WSPLGEN_FLOODPLAIN); 905 File talaueShape = new File(dir, WSPLGEN_FLOODPLAIN);

http://dive4elements.wald.intevation.org