Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/templating/FunctionResolver.java @ 6176:4edad3e414cb
Fix km filtering in Datacage, we default to mode distance now
Patch approved by Sascha Teichmann
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 03 Jun 2013 18:17:45 +0200 |
parents | 57fb50f8c9fc |
children | e30d396defa5 |
comparison
equal
deleted
inserted
replaced
6175:6a04081a2f69 | 6176:4edad3e414cb |
---|---|
247 } | 247 } |
248 catch (NumberFormatException nfe) { | 248 catch (NumberFormatException nfe) { |
249 return -FAR_AWAY; | 249 return -FAR_AWAY; |
250 } | 250 } |
251 } | 251 } |
252 else if (mode.equals("distance")) { | 252 else { |
253 if (!(from instanceof String)) { | 253 if (!(from instanceof String)) { |
254 return -FAR_AWAY; | 254 return -FAR_AWAY; |
255 } | 255 } |
256 String f = (String)from; | 256 String f = (String)from; |
257 try { | 257 try { |
258 return Double.parseDouble(f); | 258 return Double.parseDouble(f); |
259 } | 259 } |
260 catch(NumberFormatException nfe) { | 260 catch(NumberFormatException nfe) { |
261 return -FAR_AWAY; | 261 return -FAR_AWAY; |
262 } | 262 } |
263 } | |
264 else { | |
265 return -FAR_AWAY; | |
266 } | 263 } |
267 } | 264 } |
268 | 265 |
269 /** Implementation for getting the maximum value of location or distance | 266 /** Implementation for getting the maximum value of location or distance |
270 * dc:toValue. | 267 * dc:toValue. |
299 } | 296 } |
300 catch (NumberFormatException nfe) { | 297 catch (NumberFormatException nfe) { |
301 return FAR_AWAY; | 298 return FAR_AWAY; |
302 } | 299 } |
303 } | 300 } |
304 else if (mode.equals("distance")) { | 301 else { |
305 if (!(to instanceof String)) { | 302 if (!(to instanceof String)) { |
306 return FAR_AWAY; | 303 return FAR_AWAY; |
307 } | 304 } |
308 else { | 305 else { |
309 String t = (String)to; | 306 String t = (String)to; |
312 } | 309 } |
313 catch (NumberFormatException nfe) { | 310 catch (NumberFormatException nfe) { |
314 return FAR_AWAY; | 311 return FAR_AWAY; |
315 } | 312 } |
316 } | 313 } |
317 } | |
318 else { | |
319 return FAR_AWAY; | |
320 } | 314 } |
321 } | 315 } |
322 | 316 |
323 /** Implementation for doing a string replace | 317 /** Implementation for doing a string replace |
324 * dc:replace | 318 * dc:replace |