Mercurial > dive4elements > river
comparison 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 |
comparison
equal
deleted
inserted
replaced
2077:29459ddb6f30 | 2078:cbeeaaad1056 |
---|---|
508 protected void setAxis(FLYSArtifact artifact, File dir, WSPLGENJob job) { | 508 protected void setAxis(FLYSArtifact artifact, File dir, WSPLGENJob job) { |
509 String river = artifact.getDataAsString("river"); | 509 String river = artifact.getDataAsString("river"); |
510 String srid = FLYSUtils.getRiverSrid(artifact); | 510 String srid = FLYSUtils.getRiverSrid(artifact); |
511 String srs = "EPSG:" + srid; | 511 String srs = "EPSG:" + srid; |
512 | 512 |
513 RiverAxis axis = RiverAxis.getRiverAxis(river); | 513 List<RiverAxis> axes = RiverAxis.getRiverAxis(river); |
514 if (axis == null) { | 514 if (axes == null || axes.size() == 0) { |
515 logger.warn("Could not find river axis for: '" + river + "'"); | 515 logger.warn("Could not find river axis for: '" + river + "'"); |
516 return; | 516 return; |
517 } | 517 } |
518 | 518 |
519 Geometry geom = axis.getGeom(); | |
520 | |
521 SimpleFeatureType ft = GeometryUtils.buildFeatureType( | 519 SimpleFeatureType ft = GeometryUtils.buildFeatureType( |
522 "axis", srs, LineString.class); | 520 "axis", srs, LineString.class); |
523 | 521 |
524 SimpleFeatureBuilder builder = new SimpleFeatureBuilder(ft); | 522 SimpleFeatureBuilder builder = new SimpleFeatureBuilder(ft); |
525 builder.add(geom); | |
526 | |
527 FeatureCollection collection = FeatureCollections.newCollection(); | 523 FeatureCollection collection = FeatureCollections.newCollection(); |
528 collection.add(builder.buildFeature("0")); | 524 |
525 for (int i = 0, n = axes.size(); i < n; i++) { | |
526 RiverAxis axis = axes.get(i); | |
527 | |
528 builder.add(axis.getGeom()); | |
529 collection.add(builder.buildFeature(String.valueOf(i))); | |
530 | |
531 builder.reset(); | |
532 } | |
529 | 533 |
530 File axisShape = new File(dir, WSPLGEN_AXIS); | 534 File axisShape = new File(dir, WSPLGEN_AXIS); |
531 | 535 |
532 boolean a = GeometryUtils.writeShapefile( | 536 boolean a = GeometryUtils.writeShapefile( |
533 axisShape, | 537 axisShape, |