Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/artifacts/states/FloodMapState.java @ 8747:e9d912c97fa8
We expect that every river has only one RiverAxis of kind 1
This allowed to reduce code duplication and some cleanups.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 05 Jun 2015 16:56:47 +0200 |
parents | 572c102b1819 |
children | 5e38e2924c07 |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/FloodMapState.java Fri Jun 05 16:53:07 2015 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/FloodMapState.java Fri Jun 05 16:56:47 2015 +0200 @@ -787,15 +787,15 @@ String srid = String.valueOf(access.getDGM().getSrid()); String srs = "EPSG:" + srid; - List<RiverAxis> axes = null; + RiverAxis axis = null; try { - axes = RiverAxis.getRiverAxis(river); + axis = RiverAxis.getRiverAxis(river); } catch (HibernateException iae) { log.warn("No valid river axis found for " + river); return; } - if (axes == null || axes.isEmpty()) { + if (axis == null) { log.warn("Could not find river axis for: '" + river + "'"); return; } @@ -806,14 +806,8 @@ SimpleFeatureBuilder builder = new SimpleFeatureBuilder(ft); FeatureCollection collection = FeatureCollections.newCollection(); - for (int i = 0, n = axes.size(); i < n; i++) { - RiverAxis axis = axes.get(i); - - builder.add(axis.getGeom()); - collection.add(builder.buildFeature(String.valueOf(i))); - - builder.reset(); - } + builder.add(axis.getGeom()); + collection.add(builder.buildFeature("0")); File axisShape = new File(dir, WSPLGEN_AXIS);