Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust NetworkTools.findClosestLinksSorted(..) and deprecate it #205

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading