comparison flys-artifacts/src/main/java/de/intevation/flys/utils/GeometryUtils.java @ 3303:96daa8a4c48f

Fix and workaround NullPointerExceptions flys-artifacts/trunk@4988 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Fri, 13 Jul 2012 10:54:56 +0000
parents c8f670ae96e8
children 1b41dc00b1f7
comparison
equal deleted inserted replaced
3302:453d2d0c4258 3303:96daa8a4c48f
74 } 74 }
75 75
76 public static String getRiverBounds(String rivername) { 76 public static String getRiverBounds(String rivername) {
77 Envelope env = getRiverBoundary(rivername); 77 Envelope env = getRiverBoundary(rivername);
78 78
79 if (env == null) { 79 if (env != null) {
80 return jtsBoundsToOLBounds(env); 80 return jtsBoundsToOLBounds(env);
81 } 81 }
82 82
83 return null; 83 return null;
84 } 84 }
89 * @param env The envelope of a geometry. 89 * @param env The envelope of a geometry.
90 * 90 *
91 * @return the OpenLayers boundary of <i>env</i>. 91 * @return the OpenLayers boundary of <i>env</i>.
92 */ 92 */
93 public static String jtsBoundsToOLBounds(Envelope env) { 93 public static String jtsBoundsToOLBounds(Envelope env) {
94 return "" + 94 StringBuilder buf = new StringBuilder();
95 env.getMinX() + " " + 95 buf.append(env.getMinX()); buf.append(' ');
96 env.getMinY() + " " + 96 buf.append(env.getMinY()); buf.append(' ');
97 env.getMaxX() + " " + 97 buf.append(env.getMaxX()); buf.append(' ');
98 env.getMaxY(); 98 buf.append(env.getMaxY());
99 return buf.toString();
99 } 100 }
100 101
101 public static String createOLBounds(Geometry a, Geometry b) { 102 public static String createOLBounds(Geometry a, Geometry b) {
102 Coordinate[] ca = a.getCoordinates(); 103 Coordinate[] ca = a.getCoordinates();
103 Coordinate[] cb = b.getCoordinates(); 104 Coordinate[] cb = b.getCoordinates();

http://dive4elements.wald.intevation.org