Mercurial > dive4elements > river
comparison gwt-client/src/main/java/org/dive4elements/river/client/shared/model/SalixZone.java @ 9242:2ea7b61797d3
SupraRegionalTable final review
author | gernotbelger |
---|---|
date | Wed, 11 Jul 2018 10:19:53 +0200 |
parents | cbe393451ab0 |
children | da0bdbcd6f09 |
comparison
equal
deleted
inserted
replaced
9241:cbe393451ab0 | 9242:2ea7b61797d3 |
---|---|
133 | 133 |
134 private boolean overlaps(final SalixZone otherZone) { | 134 private boolean overlaps(final SalixZone otherZone) { |
135 final double otherLower = otherZone.getLowerFromTo(); | 135 final double otherLower = otherZone.getLowerFromTo(); |
136 final double otherUpper = otherZone.getUpperFromTo(); | 136 final double otherUpper = otherZone.getUpperFromTo(); |
137 | 137 |
138 final double upper = getUpperFromTo() - DELTA; | 138 final double upper = getUpperFromTo(); |
139 final double lower = getLowerFromTo() + DELTA; | 139 final double lower = getLowerFromTo(); |
140 final double otherSchwerpunkt = (otherLower + otherUpper) / 2; | 140 final double otherSchwerpunkt = (otherLower + otherUpper) / 2; |
141 if ((otherUpper < upper && otherUpper > lower)) { | 141 if ((otherUpper < upper && otherUpper > lower)) { |
142 return true; | 142 return true; |
143 } else if (otherLower > lower && otherLower < upper) { | 143 } else if (otherLower > lower && otherLower < upper) { |
144 return true; | 144 return true; |
145 } else if (otherSchwerpunkt > lower && otherSchwerpunkt < upper) { | 145 } else if (otherSchwerpunkt > (lower - DELTA) && otherSchwerpunkt < (upper + DELTA)) { |
146 return true; | 146 return true; |
147 } | 147 } |
148 return false; | 148 return false; |
149 } | 149 } |
150 | 150 |
163 final double anschluss = getAnschluss(list, minKm); | 163 final double anschluss = getAnschluss(list, minKm); |
164 final double differenceAbs = (lower - anschluss) > 0 ? (lower - anschluss) : (anschluss - lower); // no Math.abs allowed :-( | 164 final double differenceAbs = (lower - anschluss) > 0 ? (lower - anschluss) : (anschluss - lower); // no Math.abs allowed :-( |
165 if (differenceAbs > DELTA) { | 165 if (differenceAbs > DELTA) { |
166 return false; | 166 return false; |
167 } | 167 } |
168 | |
169 return true; | 168 return true; |
170 } | 169 } |
171 | 170 |
172 private static double getAnschluss(final List<SalixZone> list, final double minKm) { | 171 private static double getAnschluss(final List<SalixZone> list, final double minKm) { |
173 | |
174 if (list.size() > 0) { | 172 if (list.size() > 0) { |
175 return list.get(list.size() - 1).getUpperFromTo(); | 173 return list.get(list.size() - 1).getUpperFromTo(); |
176 } | 174 } |
177 return minKm; | 175 return minKm; |
178 } | 176 } |
179 | |
180 } | 177 } |