Repository navigation
Preparing support of turn restrictions (2): Encode turn costs depending on vehicle type - #134
Merged
Merged
Conversation
by the EncodingManager. A TurnCostEncoder encodes and decodes turn restrictions/turn costs of several vehicle types into an integer flag, like FlagEncoders do. For CAR, BIKE a DefaultTurnCostEncoder has been declared, which stores turn restrictions only (yet). For FOOT a NoTurnRestrictionEncoder has been defined, which encodes whether restrictions nor costs. To define which TurnCostEncoders should be used, the EncodingManager accepts a second list of turnCostEncoders, which can be defined the same way as edgeFlagEncoders are defined. However, those TurnCostEncoders are not beeing used anywhere in the code. This is just preparation for turn restriction support, which will be introduces step by step.
Member
|
This makes completely sense! Thanks! Did you try how it looks & feels if the turn encoder interface is directly implemented from AbstractFlagEncoder? This way one would not need the separate encoder list in the manager and I could imagine it would look a bit simpler although we could have duplicate code for bike+car. |
karussell
pushed a commit
that referenced
this pull request
Dec 22, 2013
Preparing support of turn restrictions (2): Encode turn costs depending on vehicle type
Contributor
Author
Good point, I will consider this in the post-xmas era. :) Also, the analyzing part is still missing, this will be done in the next step when processing OSM data. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The second step of the integration of support of turn restrictions: The turn costs are stored within the graph by using turn tables (nope, not those ones DJs use, instead see #133). Now we need the turn cost values to be encoded depending on the vehicle type being used. In line with FlagEncoders this is handled the same way: for different vehicle types (such as CAR, BIKE, or FOOT) different turnCostEncoders will be used. Those encoders store their encoded turn cost value within ONE integer flag, which is stored in the turn cost table.
Some details:
Next to FlagEncoders for edge properties, TurnCostEncoders are now held by the EncodingManager. A TurnCostEncoder encodes and decodes turn restrictions/turn costs of several vehicle types into an integer flag,
like FlagEncoders do. For CAR, BIKE a DefaultTurnCostEncoder has been
declared, which stores turn restrictions only (DefaultTurnCostEncoder is ready for turn costs as well, but we don't need them yet). For FOOT a NoTurnRestrictionEncoder has been defined, which encodes neither restrictions nor costs. To define which TurnCostEncoders should be used, the EncodingManager accepts a second list of turnCostEncoders, which can be defined the same way as edgeFlagEncoders are defined.
However, those TurnCostEncoders are not being used anywhere in the code. This is just preparation for turn restriction support, which will be introduces step by step.