Skip to content

Commit

Permalink
Adjust NetworkTools.findClosestLinksSorted and deprecate it (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
marecabo authored Apr 23, 2024
1 parent 394474e commit 21c8b79
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/org/matsim/pt2matsim/tools/NetworkTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ public static Map<Double, Set<Link>> findClosestLinks(Network network, Coord coo
* For opposite links, the link which has the coordinate on its right side is sorted "closer" to the coordinate.
* If more than two links have the exact same distance, links are sorted by distance to their respective closest node.
* After that, behaviour is undefined.
*
* @deprecated See https://github.com/matsim-org/pt2matsim/issues/199
*/
@Deprecated(since = "23.10-SNAPSHOT")
public static List<Link> findClosestLinksSorted(Network network, Coord coord, double nodeSearchRadius, Set<String> allowedTransportModes) {
List<Link> links = new ArrayList<>();
Map<Double, Set<Link>> sortedLinks = findClosestLinks(network, coord, nodeSearchRadius, allowedTransportModes);
Expand All @@ -203,7 +206,7 @@ public static List<Link> findClosestLinksSorted(Network network, Coord coord, do
Map<Double, Link> tmp = new HashMap<>();
for(Link l : list) {
double fromNodeDist = CoordUtils.calcEuclideanDistance(l.getFromNode().getCoord(), coord);
double toNodeDist = CoordUtils.calcEuclideanDistance(l.getFromNode().getCoord(), coord);
double toNodeDist = CoordUtils.calcEuclideanDistance(l.getToNode().getCoord(), coord);
double nodeDist = fromNodeDist < toNodeDist ? fromNodeDist : toNodeDist;

double d = nodeDist + (coordIsOnRightSideOfLink(coord, l) ? 1 : 100);
Expand Down

0 comments on commit 21c8b79

Please sign in to comment.