# HG changeset patch # User Ingo Weinzierl # Date 1325760140 0 # Node ID 61cb16549eb1898c8ad982d9fb2bd2989bf3d915 # Parent ab1e642e7c853e61acca519c59bcc70d79591d44 Modified the signature of RiverAxis.getRiverAxis() which now returns a list of RiverAxis objects instead of a single instance. flys-backend/trunk@3592 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r ab1e642e7c85 -r 61cb16549eb1 flys-backend/ChangeLog --- a/flys-backend/ChangeLog Tue Jan 03 10:10:56 2012 +0000 +++ b/flys-backend/ChangeLog Thu Jan 05 10:42:20 2012 +0000 @@ -1,3 +1,13 @@ +2012-01-05 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/RiverAxis.java: The method + getRiverAxis() now returns a list of RiverAxis objects. There is a + modeling problem (see comment in the header of the class) which should + be fixed! + + * src/main/java/de/intevation/flys/backend/SpatialInfo.java: Adapted the + code based on the modified signature in RiverAxis. + 2012-01-03 Ingo Weinzierl * src/main/java/de/intevation/flys/model/Wst.java: Added a method diff -r ab1e642e7c85 -r 61cb16549eb1 flys-backend/src/main/java/de/intevation/flys/backend/SpatialInfo.java --- a/flys-backend/src/main/java/de/intevation/flys/backend/SpatialInfo.java Tue Jan 03 10:10:56 2012 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/backend/SpatialInfo.java Thu Jan 05 10:42:20 2012 +0000 @@ -88,11 +88,9 @@ protected void doRiverAxisInfo(River river) { - RiverAxis axis = RiverAxis.getRiverAxis(river.getName()); - if (axis != null) { - LineString ls = axis.getGeom(); - logger.info("River axis is " + ls.getLength() + " long."); - logger.info("River boundary: " + ls.getBoundary()); + List axis = RiverAxis.getRiverAxis(river.getName()); + if (axis != null && axis.size() > 0) { + logger.debug("TODO: Compute length and boundary."); } else { logger.warn("River has no RiverAxis."); diff -r ab1e642e7c85 -r 61cb16549eb1 flys-backend/src/main/java/de/intevation/flys/model/RiverAxis.java --- a/flys-backend/src/main/java/de/intevation/flys/model/RiverAxis.java Tue Jan 03 10:10:56 2012 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/RiverAxis.java Thu Jan 05 10:42:20 2012 +0000 @@ -19,6 +19,13 @@ import de.intevation.flys.backend.SessionHolder; +/** + * There is a modeling problem with the RiverAxis. The initial idea was, that a + * river can have a riveraxis that consist of exact one geometry. Now, it has + * turned out, that a single geometry is not enough for a riveraxis (arm of a + * river, inflows, ...). As workaround, we now expect, that a river can just + * have a single riveraxis. + */ @Entity @Table(name = "river_axes") public class RiverAxis @@ -80,7 +87,7 @@ } - public static RiverAxis getRiverAxis(String river) { + public static List getRiverAxis(String river) { Session session = SessionHolder.HOLDER.get(); Query query = session.createQuery( @@ -89,7 +96,7 @@ List list = query.list(); - return list.isEmpty() ? null : list.get(0); + return list.isEmpty() ? null : list; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :