| | |
| | | } |
| | | |
| | | private List<NavigateNode> normalizeStationPath(List<NavigateNode> path) { |
| | | HashSet<Integer> stationIdSet = new HashSet<>(); |
| | | List<NavigateNode> filterList = new ArrayList<>(); |
| | | Integer lastStationId = null; |
| | | for (NavigateNode navigateNode : safeList(path)) { |
| | | if (navigateNode == null) { |
| | | continue; |
| | |
| | | continue; |
| | | } |
| | | Integer stationId = valueObject.getInteger("stationId"); |
| | | if (stationId == null || !stationIdSet.add(stationId)) { |
| | | if (stationId == null) { |
| | | continue; |
| | | } |
| | | // 仅压缩连续重复站点,保留环线重算场景下后续再次经过的同一站点。 |
| | | if (lastStationId != null && lastStationId.equals(stationId)) { |
| | | continue; |
| | | } |
| | | lastStationId = stationId; |
| | | NavigateNode clonedNode = navigateNode.clone(); |
| | | if (clonedNode == null) { |
| | | continue; |