Skip to content

Modify TripPattern logic for updating stop-to-stop geometry - #3988

Merged
Bartosz-Kruba merged 1 commit into
opentripplanner:dev-2.xfrom
Skanetrafiken:realtime_geometry
Mar 17, 2022
Merged

Bartosz-Kruba merged 1 commit into
opentripplanner:dev-2.xfrom
Skanetrafiken:realtime_geometry

Conversation

@Bartosz-Kruba

@Bartosz-Kruba Bartosz-Kruba commented Mar 15, 2022

Copy link
Copy Markdown
Contributor

Summary

In case journey stop point is updated to different one do not reduce journey geometry to stop-to-stop straight line. Instead use original journey pattern and just patch first and last point to locations of new stop point. This happens only if both stop points lies within same parent station

Issue

N/A

Unit tests

No unit tests (as currently there are no tests for TripPattern class).

Code style

Yes

Documentation

Updated method java doc for modified method.

@Bartosz-Kruba Bartosz-Kruba self-assigned this Mar 15, 2022
}
else {
// Use old geometry but patch first and last point with new stops
Coordinate newStart;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason that you put variable definition and assignment on two lines?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason at all. I joined definition and assignment into one statement now.

boolean stopsAreSame = other.getStop(i).equals(this.getStop(i)) && other.getStop(i + 1)
.equals(this.getStop(i + 1));
boolean parentStationsAreSame = other.getStop(i)
.getParentStation()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.getParentStation() might return null

@Bartosz-Kruba Bartosz-Kruba Mar 15, 2022

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed code to use Objects.equals instead so that it is protected against nulls.

@Bartosz-Kruba Bartosz-Kruba changed the title 10924 journey pattern geometries Modify TripPattern logic for updating stop-to-stop geometry Mar 15, 2022
- Do not default to straight line on stop point override (as long as it is the same stop place)
@Bartosz-Kruba
Bartosz-Kruba marked this pull request as ready for review March 15, 2022 13:59
@Bartosz-Kruba
Bartosz-Kruba requested a review from a team as a code owner March 15, 2022 13:59
@Bartosz-Kruba
Bartosz-Kruba merged commit 2271199 into opentripplanner:dev-2.x Mar 17, 2022
t2gran pushed a commit that referenced this pull request Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants