Fix stops with same exits
This commit is contained in:
parent
00a1496d14
commit
9777dae8b4
2 changed files with 18 additions and 2 deletions
|
@ -128,6 +128,18 @@ public class TransportStop extends MapObject {
|
|||
return exitsString;
|
||||
}
|
||||
|
||||
public boolean compareStopExits(TransportStop thatObj) {
|
||||
if (this.exits != null && thatObj.exits != null) {
|
||||
for (int i = 0; i < this.exits.size(); i++) {
|
||||
if (!this.exits.get(i).compareExit(thatObj.exits.get(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean compareStop(TransportStop thatObj) {
|
||||
if (this.compareObject(thatObj) &&
|
||||
((this.referencesToRoutes == null && thatObj.referencesToRoutes == null) ||
|
||||
|
|
|
@ -166,7 +166,7 @@ public class TransportStopController extends MenuController {
|
|||
|
||||
private void addTransportStopRoutes(List<TransportStop> stops, List<TransportStopRoute> routes, boolean useEnglishNames, TransportIndexRepository t) {
|
||||
for (TransportStop tstop : stops) {
|
||||
if (!tstop.isDeleted() && (tstop.getId().longValue() != transportStop.getId().longValue())) {
|
||||
if (!tstop.isDeleted()) {
|
||||
addRoutes(routes, useEnglishNames, t, tstop, transportStop, (int) MapUtils.getDistance(tstop.getLocation(), transportStop.getLocation()));
|
||||
}
|
||||
}
|
||||
|
@ -245,7 +245,11 @@ public class TransportStopController extends MenuController {
|
|||
TransportStop nearestStop = null;
|
||||
for (TransportStop stop : transportStops) {
|
||||
stop.setTransportStopAggregated(stopAggregated);
|
||||
if (stop.getName().startsWith(amenity.getName())) {
|
||||
if ((stop.getName().startsWith(amenity.getName())
|
||||
&& (nearestStop == null
|
||||
|| nearestStop.getLocation().equals(stop.getLocation())
|
||||
|| nearestStop.compareStopExits(stop)))
|
||||
|| stop.getLocation().equals(loc)) {
|
||||
stopAggregated.addLocalTransportStop(stop);
|
||||
if (nearestStop == null) {
|
||||
nearestStop = stop;
|
||||
|
|
Loading…
Reference in a new issue