Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/server/DistanceInfoServiceImpl.java @ 567:d9fc58e30a53
Loop through 'Unterkante' 'Oberkante' from service.
flys-client/trunk@2114 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 14 Jun 2011 14:19:45 +0000 |
parents | 924da6695800 |
children | c7301a701da9 |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/DistanceInfoServiceImpl.java Tue Jun 14 14:01:08 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/DistanceInfoServiceImpl.java Tue Jun 14 14:19:45 2011 +0000 @@ -131,6 +131,9 @@ * @return a valid DistanceInfoObject. */ protected DistanceInfoObject buildDistanceInfoObject(Node node) { + + // XXX: Using XPath here is much too expensive. DOM will do! + String desc = XMLUtils.xpathString( node, "@art:description", ArtifactNamespaceContext.INSTANCE); @@ -143,13 +146,29 @@ String riverside = XMLUtils.xpathString( node, "@art:riverside", ArtifactNamespaceContext.INSTANCE); + String bottom = XMLUtils.xpathString( + node, "@art:bottom", ArtifactNamespaceContext.INSTANCE); + + String top = XMLUtils.xpathString( + node, "@art:top", ArtifactNamespaceContext.INSTANCE); + if (desc != null && from != null) { try { - return new DistanceInfoObjectImpl( - desc, - new Double(from), - to != null && to.trim().length() > 0 ? new Double(to) : null, - riverside); + Double f = new Double(from); + + Double t = to != null && (to=to.trim()).length() > 0 + ? new Double(to) + : null; + + Double tp = top != null && (top=top.trim()).length() > 0 + ? new Double(top) + : null; + + Double b = bottom != null && (bottom=bottom.trim()).length() > 0 + ? new Double(bottom) + : null; + + return new DistanceInfoObjectImpl(desc, f, t, riverside, b, tp); } catch (NumberFormatException nfe) { System.err.println(nfe.getLocalizedMessage());