Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java @ 471:06887e2e3f7a
Some minor code cleanup
gnv-artifacts/trunk@534 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 12 Jan 2010 17:41:59 +0000 |
parents | 7ba4c7222265 |
children | ab29e4ff2fda |
comparison
equal
deleted
inserted
replaced
470:b7bb66440cc8 | 471:06887e2e3f7a |
---|---|
149 | 149 |
150 if (meshId == null) { | 150 if (meshId == null) { |
151 log.error("meshid is not defined"); | 151 log.error("meshid is not defined"); |
152 throw new IllegalStateException("missing meshid"); | 152 throw new IllegalStateException("missing meshid"); |
153 } | 153 } |
154 | |
155 Polygon p = WKTUtils.toPolygon(meshPolygon.getValue()); | |
156 | |
157 if (p == null) { | |
158 log.error("no valid polygon"); | |
159 throw new IllegalStateException("no valid polygon"); | |
160 } | |
161 | |
154 try { | 162 try { |
155 // TODO: Refactore in own Method to WKTUtils? | |
156 Polygon p = (Polygon)new WKTReader().read(meshPolygon.getValue()); | |
157 Envelope env = p.getEnvelopeInternal(); | 163 Envelope env = p.getEnvelopeInternal(); |
158 Coordinate[] coords = new Coordinate[4]; | 164 |
159 coords[0] = new Coordinate(env.getMinX(), env.getMinY()); | 165 Coordinate [] coords = new Coordinate [] { |
160 coords[1] = new Coordinate(env.getMinX(), env.getMaxY()); | 166 new Coordinate(env.getMinX(), env.getMinY()), |
161 coords[2] = new Coordinate(env.getMaxX(), env.getMaxY()); | 167 new Coordinate(env.getMinX(), env.getMaxY()), |
162 coords[2] = new Coordinate(env.getMaxX(), env.getMinY()); | 168 new Coordinate(env.getMaxX(), env.getMaxY()), |
169 new Coordinate(env.getMaxX(), env.getMinY()) }; | |
163 | 170 |
164 String additionWhere = | 171 String additionWhere = |
165 WKTUtils.worldEnvelopeCoordinatesToIndex( | 172 WKTUtils.worldEnvelopeCoordinatesToIndex( |
166 coords, | 173 coords, |
167 result, | 174 result, |
178 | 185 |
179 result = process( | 186 result = process( |
180 Arrays.asList(coords), | 187 Arrays.asList(coords), |
181 numSamples(callContext), | 188 numSamples(callContext), |
182 queryExecutor.executeQuery( | 189 queryExecutor.executeQuery( |
183 queryID, | 190 queryID, |
184 addedFilterValues), | 191 addedFilterValues), |
185 p); | 192 p); |
186 } catch (QueryException e) { | 193 } |
187 log.error(e,e); | 194 catch (QueryException e) { |
188 } catch (ParseException e) { | |
189 log.error(e,e); | 195 log.error(e,e); |
190 } | 196 } |
191 | 197 |
192 if (CacheFactory.getInstance().isInitialized()) { | 198 if (CacheFactory.getInstance().isInitialized()) { |
193 CacheFactory.getInstance().getCache().put(new net.sf.ehcache.Element(key, result)); | 199 CacheFactory.getInstance().getCache().put(new net.sf.ehcache.Element(key, result)); |
194 } | 200 } |
195 | |
196 } | 201 } |
197 } | 202 } |
198 return result; | 203 return result; |
199 | |
200 | |
201 } | 204 } |
202 | 205 |
203 public static Collection<Result> process( | 206 public static Collection<Result> process( |
204 List<Coordinate> path, | 207 List<Coordinate> path, |
205 int numSamples, | 208 int numSamples, |