Mercurial > dive4elements > river
changeset 2375:61cb16549eb1
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
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 05 Jan 2012 10:42:20 +0000 (2012-01-05) |
parents | ab1e642e7c85 |
children | 918877ee70e7 |
files | flys-backend/ChangeLog flys-backend/src/main/java/de/intevation/flys/backend/SpatialInfo.java flys-backend/src/main/java/de/intevation/flys/model/RiverAxis.java |
diffstat | 3 files changed, 22 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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 <ingo@intevation.de> + + * 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 <ingo@intevation.de> * src/main/java/de/intevation/flys/model/Wst.java: Added a method
--- 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<RiverAxis> 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.");
--- 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<RiverAxis> getRiverAxis(String river) { Session session = SessionHolder.HOLDER.get(); Query query = session.createQuery( @@ -89,7 +96,7 @@ List<RiverAxis> 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 :