Skip to content

Introduce Interface for AbstractFlagEncoder #1164

Closed

Description

@jtheuer

I heavily use the low-level api and have a very custom FlagEncoder implementation (for example I store custom information in the flags, I have no speed information, etc.)

What do you think about introducing a super interface of FlagEncoder that only contains the methods needed to import data. With this minimal interface it would be easier to implement custom encoder with the Low Level API (especially easier to upgrade version because changes in AbstractFlagEncoder don't matter).

For example this interface would include public abstract long acceptWay(ReaderWay way); because if is referenced from the EncodingManager but not methods like public long setBool(long flags, int key, boolean value) because this is only used by AbstractFlagEncoder and its implementations.

I would open a PR if this is generally ok with you. The logic would not change as far as I can oversee this at the moment.

Activity

  1. karussell commented on Sep 26, 2017

    @karussell
    Member

    This use case will be covered in #1112, no need to create another abstraction. The FlagEncoder is a bit too ugly and after the mentioned issue we'll have hopefully a better foundation that better separates the storage from reading but also OSM from the core and much more.

  2. jtheuer commented on Sep 26, 2017

    @jtheuer
    Author

    That looks great, thanks for the information! As far as I can see the FlagEncoder only needs to expose a very minimal interface.

    Would be great if there is an interface in the hierarchy doesn't require me to implement any methods used in (only some) Weighting implementations or in com.graphhopper.routing.Path - namely Speed, Waytype, Way name (or Turn costs).

  3. karussell commented on Sep 26, 2017

    @karussell
    Member

    The FlagEncoder is no longer necessary and if I invest a bit more time will remove it entirely. The only things then should be some parsers that feed into 'their' EncodedValue (that e.g. store average and max speed)

    The Weighting then fetches those EncodedValues - see the new FastestCarWeighting. Turn costs is something currently unsolved but will probably get a similar (or better identical) approach of EncodedValues.

  4. karussell commented on Sep 26, 2017

    @karussell
    Member

    This will still take lots of weeks of coding but as I mainly invest into this now (besides some 'minor' other stuff here ;)) I hope to get out a prototype this year.

  5. jtheuer commented on Sep 26, 2017

    @jtheuer
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions