Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java @ 2078:cbeeaaad1056
#440 Support river axes that consist of more than a single geometry.
flys-artifacts/trunk@3593 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 05 Jan 2012 10:46:32 +0000 |
parents | 368040e5c400 |
children | ebc2aa64c1be |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java Thu Jan 05 08:34:47 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java Thu Jan 05 10:46:32 2012 +0000 @@ -510,22 +510,26 @@ String srid = FLYSUtils.getRiverSrid(artifact); String srs = "EPSG:" + srid; - RiverAxis axis = RiverAxis.getRiverAxis(river); - if (axis == null) { + List<RiverAxis> axes = RiverAxis.getRiverAxis(river); + if (axes == null || axes.size() == 0) { logger.warn("Could not find river axis for: '" + river + "'"); return; } - Geometry geom = axis.getGeom(); - SimpleFeatureType ft = GeometryUtils.buildFeatureType( "axis", srs, LineString.class); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(ft); - builder.add(geom); + FeatureCollection collection = FeatureCollections.newCollection(); - FeatureCollection collection = FeatureCollections.newCollection(); - collection.add(builder.buildFeature("0")); + 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(); + } File axisShape = new File(dir, WSPLGEN_AXIS);