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

Add basic controls for the routing helper reimplementation #25

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

floscher
Copy link
Member

cc @sudhanshu2

Fixes #23 .

@floscher floscher added this to the v2.2 milestone Aug 24, 2020
@floscher floscher self-assigned this Aug 24, 2020
@floscher floscher marked this pull request as draft August 24, 2020 08:16
Comment on lines 24 to 29
public class RoutingHelperAction extends AbstractRelationEditorAction {
private static final Set<ITransportMode> TRANSPORT_MODES = Collections.singleton(new BusTransportMode());
Copy link
Member Author

Choose a reason for hiding this comment

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

There's now a set of transport modes (for now just bus, others could follow later). The transport mode handles everything specific to the transport mode, like determining if you are allowed to travel along a certain way.

The routing helper selects the appropriate mode for a relation and queries the transport mode when there is something specific to the transport mode.

…ke forward/backward navigation work and show connectivity (very primitive check)
floscher and others added 2 commits November 15, 2020 14:33
Extended the highways they are allowed to use.

And tried to make sure turn restriction relations are processed correctly.

This needs some unit tests...

I also added a class for trolley buses. Did I do that correctly?
floscher and others added 10 commits November 16, 2020 16:14
I think the name fits better and also makes it easier to distinguish between the original routing helper and this new one.
…tTransportMode, where it's not getting the referrers of the from Way. I do see those referrers in my variables list while single stepping though.
…sted for bus, mandatory "only_" still need to be added
…tTrue statements most likely means not all cases are tested. So this needs some more thought.
I added support for TRs which have a via way instead of a via node
}

@Override
public boolean canTurn(@NotNull final Way from, @NotNull final Way via, @NotNull final Way to) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

You cannot check this that easily. Have a look at the specs: Via can be a list of multiple ways.

The problem with turn restrictions is, that you cannot step through the route easilly, because you never know if they are part of a via or not.

if have not seen any usages of canTurn. What is the use case of it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

… and this is my suggestion to check turn restrictions:

  • Inputs
    ** ``List routeAll previous ways traversed as list (more than we need, but they are for free) **PartOfWay next` The next way we want to add
  • Returns
    ** true iff turning into that way is not blocked by any turn relation. (=> Returns true even if we might traverse the next segment but would be blocked later by a no_*** relation)
  • Algorithm
    ** (Check for no_* restrictions)
    ** Let R be the set of relations for which these conditions are met
    *** relation has next as member
    *** role of next is 'to'
    *** relation is a turn for the current transport mode with no_ type
    ** For each item r in R, do:
    *** Check if r matches current state. If it does => return false;
    ** (check for only_* relations)
    ** Let last be the last way of ways.
    ** Let O be the set of relations with:
    *** Relation is a only_* relation for the current transport type
    *** last is a from or via member of the relation.
    *** If it is a via member, the previous members need to match the route
    ** If O is empty, return true (no only_candidates)
    ** If any relation in O has next as next way (=> the way after last, no matter if it was a via or to), return true
    ** In all other cases return false

To check if no_ turn relation matches*

  • If the relation has via ways:
    ** Traverse the route backwards and check if it matches the via ways
    ** Now traverse back one more way and check for the from way.
  • If the relation has via nodes:
    ** Check if the via node is the connecting node.

Copy link
Collaborator

Choose a reason for hiding this comment

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

When the routing helper/ route explorer arrives at a gap, it would continue until the next junction.

At the junction it needs to propose ways that are

  1. suitable for the mode of transport
  2. the mode of transport is allowed to turn onto

We are creating the building blocks that can be used later on, so it's to be expected that they are not used yet. But they will be.

Thanks for the suggested workflow. I'll try to implement it. It is a lot more complex than I had expected it would be. But maybe that was to be expected :-)

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.

Routing helper: Top panel with basic control (go to next/previous)
3 participants