Mercurial > dive4elements > river
changeset 9238:1c756bfee472
salix.supraregional table revision -> Anschluss
author | gernotbelger |
---|---|
date | Tue, 10 Jul 2018 13:27:17 +0200 |
parents | 972e10522ed6 |
children | 4e3757202d5c |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixZone.java gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/SupraRegionalTablePanel.java gwt-client/src/main/java/org/dive4elements/river/client/shared/model/SalixZone.java |
diffstat | 6 files changed, 51 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixZone.java Tue Jul 10 11:24:12 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixZone.java Tue Jul 10 13:27:17 2018 +0200 @@ -105,7 +105,7 @@ if (((upper - lower) > DELTA) && list.size() == 0) return true; - final TreeSet<SalixZone> treeList = new TreeSet<SalixZone>(); + final TreeSet<SalixZone> treeList = new TreeSet<>(); treeList.addAll(list); double lowerCompare = lower + DELTA; for (final SalixZone zone : treeList) { @@ -151,4 +151,24 @@ return basicCompare; } -} \ No newline at end of file + public static boolean isValidAnschlussRange(final double fromTest, final double toTest, final List<SalixZone> list, final double minKm) { + final SalixZone zone = new SalixZone(0, fromTest, toTest); + final double lower = zone.getLowerFromTo(); + final double anschluss = getAnschluss(list, minKm); + final double differenceAbs = (lower - anschluss) > 0 ? (lower - anschluss) : (anschluss - lower); // no Math.abs allowed :-( + if (differenceAbs > DELTA) { + return false; + } + + return true; + } + + private static double getAnschluss(final List<SalixZone> list, final double minKm) { + + if (list.size() > 0) { + return list.get(list.size() - 1).getUpperFromTo(); + } + return minKm; + } + +}
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java Tue Jul 10 11:24:12 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java Tue Jul 10 13:27:17 2018 +0200 @@ -1566,4 +1566,6 @@ String uinfo_salix_km_overlap(); String uinfo_salix_km_has_gaps(); + + String uinfo_salix_km_anschluss(); } \ No newline at end of file
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties Tue Jul 10 11:24:12 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties Tue Jul 10 13:27:17 2018 +0200 @@ -834,6 +834,7 @@ uinfo_salix_km_limit_exceed = Die Zahl ist au\u00dferhalb des g\u00fcltigen km-Bereichs. uinfo_salix_km_overlap = Km-Bereiche \u00fcperlappen. uinfo_salix_km_has_gaps = Der Km-Bereich ist nicht vollst. belegt. +uinfo_salix_km_anschluss = Der eingegebene Bereich schlie\u00dft nicht an den letzten Wert an. bundu = Betrieb und Unterhaltung
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties Tue Jul 10 11:24:12 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties Tue Jul 10 13:27:17 2018 +0200 @@ -834,6 +834,7 @@ uinfo_salix_km_limit_exceed = Die Zahl ist au\u00dferhalb des g\u00fcltigen km-Bereichs. uinfo_salix_km_overlap = Km-Bereiche \u00fcperlappen. uinfo_salix_km_has_gaps = Der Km-Bereich ist nicht vollst. belegt. +uinfo_salix_km_anschluss = Der eingegebene Bereich schlie\u00dft nicht an den letzten Wert an. bundu = Betrieb und Unterhaltung
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/SupraRegionalTablePanel.java Tue Jul 10 11:24:12 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/SupraRegionalTablePanel.java Tue Jul 10 13:27:17 2018 +0200 @@ -393,6 +393,11 @@ if (from < this.minKm || from > this.maxKm || to > this.maxKm || to < this.minKm) return this.MSG.uinfo_salix_km_limit_exceed(); + + // range anschluss + if (!SalixZone.isValidAnschlussRange(from, to, getSalixZones(this.table.getRecords()), this.minKm)) { + return this.MSG.uinfo_salix_km_anschluss(); + } return null; } catch (final NumberFormatException e) {
--- a/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/SalixZone.java Tue Jul 10 11:24:12 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/SalixZone.java Tue Jul 10 13:27:17 2018 +0200 @@ -152,4 +152,24 @@ return basicCompare; } + public static boolean isValidAnschlussRange(final double fromTest, final double toTest, final List<SalixZone> list, final double minKm) { + final SalixZone zone = new SalixZone(0, fromTest, toTest); + final double lower = zone.getLowerFromTo(); + final double anschluss = getAnschluss(list, minKm); + final double differenceAbs = (lower - anschluss) > 0 ? (lower - anschluss) : (anschluss - lower); // no Math.abs allowed :-( + if (differenceAbs > DELTA) { + return false; + } + + return true; + } + + private static double getAnschluss(final List<SalixZone> list, final double minKm) { + + if (list.size() > 0) { + return list.get(list.size() - 1).getUpperFromTo(); + } + return minKm; + } + }