fixes issue #1167, odd routing instructions
- the turn angle for compressed edges was not computed from the uncompressed geometry - for a given turn (a,b,c) the last compressed node for edge (a,b) and the first packed node for (b,c) is returned - adds a cucumber test to guard against regression
This commit is contained in:
parent
577cf5ddc4
commit
f2ceeb35da
@ -37,6 +37,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <iomanip>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
EdgeBasedGraphFactory::EdgeBasedGraphFactory(
|
EdgeBasedGraphFactory::EdgeBasedGraphFactory(
|
||||||
@ -630,10 +631,22 @@ EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(const std::string &original_edg
|
|||||||
{
|
{
|
||||||
distance += speed_profile.traffic_signal_penalty;
|
distance += speed_profile.traffic_signal_penalty;
|
||||||
}
|
}
|
||||||
const double angle = ComputeAngle::OfThreeFixedPointCoordinates(
|
|
||||||
m_node_info_list[u], m_node_info_list[v], m_node_info_list[w]);
|
// unpack last node of first segment if packed
|
||||||
const int turn_penalty = GetTurnPenalty(angle, lua_state);
|
auto first_coordinate = m_node_info_list[(m_geometry_compressor.HasEntryForID(e1) ?
|
||||||
TurnInstruction turn_instruction = AnalyzeTurn(u, v, w, angle);
|
m_geometry_compressor.GetLastNodeIDOfBucket(e1) :
|
||||||
|
u)];
|
||||||
|
|
||||||
|
// unpack first node of second segment if packed
|
||||||
|
auto third_coordinate = m_node_info_list[(m_geometry_compressor.HasEntryForID(e2) ?
|
||||||
|
m_geometry_compressor.GetFirstNodeIDOfBucket(e2) :
|
||||||
|
w)];
|
||||||
|
|
||||||
|
const double turn_angle = ComputeAngle::OfThreeFixedPointCoordinates(
|
||||||
|
first_coordinate, m_node_info_list[v], third_coordinate);
|
||||||
|
|
||||||
|
const int turn_penalty = GetTurnPenalty(turn_angle, lua_state);
|
||||||
|
TurnInstruction turn_instruction = AnalyzeTurn(u, v, w, turn_angle);
|
||||||
if (turn_instruction == TurnInstruction::UTurn)
|
if (turn_instruction == TurnInstruction::UTurn)
|
||||||
{
|
{
|
||||||
distance += speed_profile.u_turn_penalty;
|
distance += speed_profile.u_turn_penalty;
|
||||||
|
@ -19,3 +19,22 @@ Feature: Basic Routing
|
|||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| a | e | abc,dce |
|
| a | e | abc,dce |
|
||||||
|
|
||||||
|
Scenario: Turn instructions on compressed road network geometry
|
||||||
|
Given the node map
|
||||||
|
| x | a | | |
|
||||||
|
| | b | | |
|
||||||
|
| f | | | e |
|
||||||
|
| | | | |
|
||||||
|
| | | | |
|
||||||
|
| y | c | | d |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | name |
|
||||||
|
| xa | first |
|
||||||
|
| abcdef | compr |
|
||||||
|
| fy | last |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | turns |
|
||||||
|
| x | y | first,compr,last | head,right,left,destination |
|
||||||
|
Loading…
Reference in New Issue
Block a user