Skip to content

remove flagsDefault method. Was: DataFlagEncoder fails in flagsDefault #800

Closed

Description

@highsource

Turning on the generic encoder fails with "do not call flagsDefault":

java.lang.RuntimeException: do not call flagsDefault
    at com.graphhopper.routing.util.DataFlagEncoder.flagsDefault(DataFlagEncoder.java:412)
    at com.graphhopper.routing.util.EncodingManager.flagsDefault(EncodingManager.java:305)
    at com.graphhopper.storage.BaseGraph.edge(BaseGraph.java:324)
    at com.graphhopper.storage.GraphHopperStorage.edge(GraphHopperStorage.java:364)
    at com.graphhopper.reader.dem.TunnelElevationInterpolatorTest.interpolatesElevationOfTunnelWithTwoOuterNodes(TunnelElevationInterpolatorTest.java:148)

Removing the flagsDefault method and relying on the super method does not work either:

java.lang.NullPointerException
    at com.graphhopper.routing.util.AbstractFlagEncoder.flagsDefault(AbstractFlagEncoder.java:282)
    at com.graphhopper.routing.util.EncodingManager.flagsDefault(EncodingManager.java:305)
    at com.graphhopper.storage.BaseGraph.edge(BaseGraph.java:324)
    at com.graphhopper.storage.GraphHopperStorage.edge(GraphHopperStorage.java:364)
    at com.graphhopper.reader.dem.TunnelElevationInterpolatorTest.interpolatesElevationOfTunnelWithTwoOuterNodes(TunnelElevationInterpolatorTest.java:148)

Apparently, speedEncoder is null.

I'm currently working around this as follows:

    @Override
    public long flagsDefault(boolean forward, boolean backward) {
        //// just pick car mode to set access values?
        // throw new RuntimeException("do not call flagsDefault");
        // TODO This is called on each of the encoders so I had to replace the
        //// runtime exception with something,
        // but I'm not sure this is correct.
        return setAccess(0, forward, backward);
    }

Activity

  1. karussell commented on Sep 20, 2016

    @karussell
    Member

    Yes, indeed. We should either avoid usage of this method entirely or init it properly e.g. with the carFwdMaxspeedEncoder ... please then we would also need to set a default value for the backward direction via carBwdMaxspeedEncoder. But again the real solution would be to get rid of that method, as this is only important for tests where we currently can create edges with just two nodes & distance, and then imply a default speed.

  2. karussell commented on Sep 20, 2016

    @karussell
    Member

    There is something very wrong with the subnetwork removal (removes nearly the full network for generic) and I have the feeling that this might cause it - thanks for catching it! Will investigate and probably provide a workaround until we fully migrate to a new interface.

  3. karussell commented on Sep 23, 2016

    @karussell
    Member

    Wasn't really related. Solved the issue via implementing a filter in acceptWay. So now OSM ways will be skipped before they got added to the graph, which avoids removing them afterwards (currently we are not that efficient if more than 40% of the nodes should be removed)

  4. karussell commented on Sep 23, 2016

    @karussell
    Member

    This is also fixed now but I'll keep it open as 'improvement' as we should be able to get rid of the method somehow.

  5. changed the title [-]DataFlagEncoder fails in flagsDefault[/-] [+]remove flagsDefault method. Was: DataFlagEncoder fails in flagsDefault[/+] on Jul 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions