Skip to content

Preparing support of turn restrictions (2): Encode turn costs depending on vehicle type - #134

Merged
karussell merged 1 commit into
graphhopper:masterfrom
kschrab:master
Dec 22, 2013
Merged

karussell merged 1 commit into
graphhopper:masterfrom
kschrab:master

Conversation

@kschrab

@kschrab kschrab commented Dec 22, 2013

Copy link
Copy Markdown
Contributor

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.

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.
@karussell

Copy link
Copy Markdown
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
@karussell
karussell merged commit 7f85ee7 into graphhopper:master Dec 22, 2013
@ghost ghost assigned kschrab Dec 22, 2013
@kschrab

kschrab commented Dec 22, 2013

Copy link
Copy Markdown
Contributor Author

Did you try how it looks & feels if the turn encoder interface is directly implemented from AbstractFlagEncoder

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.

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.

2 participants