Mercurial > dive4elements > river
changeset 3006:1b1af1597401
FixA: Added new km filter
flys-artifacts/trunk@4562 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 30 May 2012 15:38:23 +0000 |
parents | 9aa1d770da4a |
children | d520a0869972 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsFilterBuilder.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsOverview.java |
diffstat | 3 files changed, 40 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Wed May 30 15:00:18 2012 +0000 +++ b/flys-artifacts/ChangeLog Wed May 30 15:38:23 2012 +0000 @@ -1,3 +1,12 @@ +2012-05-30 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/flys/artifacts/model/FixingsOverview.java: + Added a km filter to find columns with touches a given km. + + * src/main/java/de/intevation/flys/artifacts/model/FixingsFilterBuilder.java: + Expose the new km filter to the fixing overview service. Syntax: + <position km="<value>"/> + 2012-05-30 Sascha L. Teichmann <sascha.teichmann@intevation.de> Better persistence model for delta w/t calculations. Supports
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsFilterBuilder.java Wed May 30 15:00:18 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsFilterBuilder.java Wed May 30 15:38:23 2012 +0000 @@ -7,6 +7,7 @@ import de.intevation.flys.artifacts.model.FixingsOverview.Fixing.Filter; import de.intevation.flys.artifacts.model.FixingsOverview.IdFilter; +import de.intevation.flys.artifacts.model.FixingsOverview.KmFilter; import de.intevation.flys.artifacts.model.FixingsOverview.NotFilter; import de.intevation.flys.artifacts.model.FixingsOverview.OrFilter; import de.intevation.flys.artifacts.model.FixingsOverview.Range; @@ -197,6 +198,17 @@ } } } + else if ("position".equals(name)) { + String km = element.getAttribute("km").trim(); + if (km.length() > 0) { + try { + filters.add(new KmFilter(Double.parseDouble(km))); + } + catch (NumberFormatException nfe) { + log.warn(nfe); + } + } + } } return filters;
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsOverview.java Wed May 30 15:00:18 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsOverview.java Wed May 30 15:38:23 2012 +0000 @@ -877,6 +877,25 @@ } } // class SectorRangeFilter + public static class KmFilter implements Fixing.Filter { + + protected double km; + + public KmFilter(double km) { + this.km = km; + } + + @Override + public boolean accept(Fixing.Column column) { + for (SectorRange s: column.getSectors()) { + if (s.inside(km)) { + return true; + } + } + return false; + } + } // class KmFilter + public void generateOverview(Document document) { generateOverview(document, FULL_EXTENT, ACCEPT); }