Repository navigation
Preparing support of turn restrictions (1): Extended GraphStorage - #133
Conversation
nodes. By default no additional values will be stored and current graphs are still valid. Any implementation of ExtendedStorage can be put into GraphHopperStorage, which take care of any additional storages, which depends on nodes or edges ( e.g. turn cost tables) by reading/writing those additional values. An example implementation can be found in TurnCostStorage. This will be mandandatory to implement support of turn restrictions later.
I really appreciate this move! This makes everything a lot simpler!
Wow, Really nice! Is it already possible to show in a test case that a graph traversal is turn restricted for car? I would like to see this restriction integrated in the EdgeExplorer somehow, so this should be (somehow ;)) possible to show this functionality even without an edge-based algorithm. Having the restriction separated from the algorithm would also make the switch e.g. between CAR and FOOT easier - e.g. somehow encoder.getTurnIterator() ? |
Preparing support of turn restrictions: Extended GraphStorage
Nope, it's not possible yet. Hmpf, I can't switch off the term "turn costs" in my head, when thinking about the code. :D For me a restriction is the same as infinite turn costs, therefore I never think about restrictions, but about costs. However, integrating the restrictions into the edge explorer would be nice indeed, but that's more like "make it clean and faster". I would like to introduce this feature on edge-based algorithms first, using some kind of TurnCostCalculation in each of those algorithms. When this whole thing is finally merged and can be used by some users as an experimental feature, we can go further and implement such improvements. But of course, you and any other one can try to implement such things already, but I want to concentrate on integrating my current progress. Nevertheless, I integrated turn cost encoding/decoding, see #134. For me Christmas time has come, need to get the last gifts and then I won't be available for a few days. I wish you all Merry Christmas and happy routing! |
Indeed, then restriction is only a special case and could be tuned which we should do later on.
Sure and thanks for the pre-xmas presents here already :) ! |
The last attempt to implement turn restriction support "failed" due to one huge commit no one could work with. However, I would love to see this feature in the master very soon, therefore I decided to use the knowledge I gained and try to redesign the whole thing step by step. So here is the first step: storing turn restrictions.
Turn restrictions need to be stored within the graph. To do so and to keep an eye on further extensions like turn costs, a turn cost table needs be stored next to nodes and edges. However, we need to store pointers from nodes to those table somehow which requires additional fields on the nodes. In my first attempt, I created a new complete Graph which extended the current GraphHopperStorage, which was not a good decision. However, I designed the storage problem of turn cost tables from scratch and therefore I want to introduce a component called ExtendedStorage:
An implementation of such ExtendedStorage will be put into GraphHopperStorage on initialization time and offers the possibility to store additional stuff next to nodes and edges without touching GraphHopperStorage. GraphHopperStorage now has an additional integer field for each node and edge. Both fields are optional and the implementation of ExtendedStorage decides, whether those fields will be created or not and those fields should be used.
For example, TurnCostStorage (extends ExtendedStorage) requires the additional field for nodes and stores a pointer towards the first entry of a turn cost table, which is managed by TurnCostStorage.
Relates to #55 and #2