Repository navigation
Block area setting for all weightings - #1078
Conversation
| cloneDoubleAttribute(weightingMap, cMap, GenericWeighting.HEIGHT_LIMIT, 0d); | ||
| cloneDoubleAttribute(weightingMap, cMap, GenericWeighting.WEIGHT_LIMIT, 0d); | ||
| cloneDoubleAttribute(weightingMap, cMap, GenericWeighting.WIDTH_LIMIT, 0d); | ||
| public class Result { |
There was a problem hiding this comment.
I like how we can keep the 'strange' speedArray local to the DataFlagEncoder
There was a problem hiding this comment.
Why is this called result? Wouldn't be Config or RoadConfig or something similar be a better matching name?
There was a problem hiding this comment.
The naming is indeed suboptimal it should be more like RequestConfig ... as this class is probably always used via DataFlagEncoder.XY the naming could be done with this association in mind
| return blockArea; | ||
| } | ||
|
|
||
| public static class BlockArea { |
There was a problem hiding this comment.
Same here: the logic and difference of shapes and edgeIds is all local to this class and no longer in the Weighting
|
|
||
| return cMap; | ||
| } | ||
| public double getSpeed(EdgeIteratorState edgeState) { |
There was a problem hiding this comment.
I would expect this method to check the speed encoder of the edge as well, if there is no speed stored, we return the value of speedArray.
There was a problem hiding this comment.
check the speed encoder of the edge as well
What do you mean here? There is no speed for DataFlagEncoder. Only a max speed value.
There was a problem hiding this comment.
Yes sorry, this is what I meant. I would have expected the same result as when calling getSpeed in a different Encoder.
There was a problem hiding this comment.
So, what you mean is that if there is no request value for the speed we should use the default maxspeed value of the highway?
There was a problem hiding this comment.
This is just what I would have expected when reading the method head. The getSpeed method of the other encoders reads the speed that is saved in the edge. So here I would have expected that there is a check, if maxSpeed stored -> return maxSpeed, else return speed for highway type. In this case we would also need to pass a forward flag to do this.
There was a problem hiding this comment.
I think we need to adjust the createResult method and use Math.min(requestSpeedValue, storedSpeedValue). So the provided request parameters should be able to reduce the stored maxspeed values.
There was a problem hiding this comment.
Let us do this in a later issue as this was so before
There was a problem hiding this comment.
Ok no problem, it always bothered me ;).
There was a problem hiding this comment.
BTW: this seems to be already implemented in GenericWeighting.calcMillis
There was a problem hiding this comment.
I know, I am just used to have the getSpeed in the FlageEncoder ;).
| /** | ||
| * This weighting is a wrapper for every weighting to support block_area | ||
| */ | ||
| public class BlockAreaWeighting implements Weighting { |
There was a problem hiding this comment.
Is there are reason to not use the AbstractAdjustedWeighting?
| protected final DataFlagEncoder.Result result; | ||
| protected final int accessType; | ||
| protected final int eventuallAccessiblePenalty = 10; | ||
| protected final int eventualAccessiblePenalty = 10; |
There was a problem hiding this comment.
I think naming this uncertainAccessiblePenaltyor something like this would be better. Eventual is a false friend to the German eventuell. I think this was introduced by me some time ago :), but since I just saw it, we should fix it.
| if (tmpSpeed > encoder.getMaxPossibleSpeed()) | ||
| throw new IllegalArgumentException("Speed bigger than maximum speed: " + tmpSpeed + " > " + encoder.getMaxPossibleSpeed()); | ||
| result = encoder.createResult(hintsMap); | ||
| double biggestSpecifiedSpeed = result.getMaxspeed(); |
There was a problem hiding this comment.
Maybe we should rename the getMaxspeed method also to biggestSpecifiedSpeed?
There was a problem hiding this comment.
This PR adds a lot of nice things and really improves the handling of blocked areas.
Currently the init part for CH is commented out.
Also as you noted, an integration test with DefaultBlockedAreas + adding a new area would be very nice.
I didn't run the code yet. Would do this once it's ready.
|
The problem with the default block_area is that we would have to lazy load the GraphEdge finding stuff too and not only the setGraph. Because the weighting should be read very early but the graph and locationIndex might be still uninitialized. So I have decided to remove this for now. |
boldtrn
left a comment
There was a problem hiding this comment.
This looks good to me. I think removing the default blocked areas is OK, as I think most want to use this on demand anyway. Still a bit unfortunate.
Yes. But better a smaller feature now than a bigger or more features later (?) |
This is a replacement for #1029 (as no feedback and want to have it in 0.9) ie. a fix for #958. Furthermore it does some cleanup in DataFlagEncoder, allows the block area option for all weightings and removes ConfigMap to improve #940 too.
It is not yet complete although all tests pass: the setGraph method is removed but necessary. I think a graph creation with the block area setting in the config will fail. We should add a test for this.