comparison flys-artifacts/src/main/java/de/intevation/flys/utils/GeometryUtils.java @ 5170:c1b60f8c3390

Made river mapfile generator more tolerant. * Ignores missing river axes. * Ignores invalid river axes. * Ignores invalid geometries.
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 04 Mar 2013 17:11:31 +0100
parents 1b41dc00b1f7
children 14d19313268a
comparison
equal deleted inserted replaced
5169:db1a000a21a9 5170:c1b60f8c3390
48 48
49 private GeometryUtils() { 49 private GeometryUtils() {
50 } 50 }
51 51
52 public static Envelope getRiverBoundary(String rivername) { 52 public static Envelope getRiverBoundary(String rivername) {
53 List<RiverAxis> axes = RiverAxis.getRiverAxis(rivername); 53 try {
54 if (axes != null && axes.size() > 0) { 54 List<RiverAxis> axes = RiverAxis.getRiverAxis(rivername);
55 Envelope max = null; 55 if (axes != null && axes.size() > 0) {
56 56 Envelope max = null;
57 for (RiverAxis axis: axes) { 57
58 // TODO Take the correct EPSG into account. Maybe, we need to 58 for (RiverAxis axis: axes) {
59 // reproject the geometry. 59 // TODO Take the correct EPSG into account. Maybe, we need to
60 Envelope env = axis.getGeom().getEnvelopeInternal(); 60 // reproject the geometry.
61 61 Envelope env = axis.getGeom().getEnvelopeInternal();
62 if (max == null) { 62
63 max = env; 63 if (max == null) {
64 max = env;
65 }
66 else {
67 max.expandToInclude(env);
68 }
64 } 69 }
65 else { 70
66 max.expandToInclude(env); 71 return max;
67 } 72 }
68 } 73 }
69 74 catch(RuntimeException e) {
70 return max; 75 return null;
71 } 76 }
72 77
73 return null; 78 return null;
74 } 79 }
75 80

http://dive4elements.wald.intevation.org