fixed problem for same-segment searches with exact node matches
This commit is contained in:
parent
8159eaf024
commit
7e4bcebd3c
1 changed files with 8 additions and 1 deletions
|
@ -590,11 +590,18 @@ public class RoutingEngine extends Thread
|
||||||
OsmPath p = getStartPath( n1, n2, new OsmNodeNamed( mwp.waypoint ), endPos );
|
OsmPath p = getStartPath( n1, n2, new OsmNodeNamed( mwp.waypoint ), endPos );
|
||||||
|
|
||||||
// special case: start+end on same segment
|
// special case: start+end on same segment
|
||||||
if ( sameSegmentSearch )
|
if ( p.cost >= 0 && sameSegmentSearch )
|
||||||
{
|
{
|
||||||
|
OsmPath path2end = getStartPath( n1, n2, endPos, endPos );
|
||||||
|
boolean isDirect = path2end.cost >= p.cost;
|
||||||
|
|
||||||
OsmPath pe = getEndPath( n1, p.getLink(), endPos );
|
OsmPath pe = getEndPath( n1, p.getLink(), endPos );
|
||||||
OsmPath pt = getEndPath( n1, p.getLink(), null );
|
OsmPath pt = getEndPath( n1, p.getLink(), null );
|
||||||
int costdelta = pt.cost - p.cost;
|
int costdelta = pt.cost - p.cost;
|
||||||
|
if ( isDirect && pe.cost < costdelta )
|
||||||
|
{
|
||||||
|
costdelta = pe.cost;
|
||||||
|
}
|
||||||
if ( pe.cost >= costdelta )
|
if ( pe.cost >= costdelta )
|
||||||
{
|
{
|
||||||
pe.cost -= costdelta;
|
pe.cost -= costdelta;
|
||||||
|
|
Loading…
Reference in a new issue