Add decline support
This commit is contained in:
parent
cf4155aff8
commit
47b4d762a7
2 changed files with 7 additions and 6 deletions
|
@ -448,8 +448,9 @@ public class BinaryRoutePlanner {
|
||||||
}
|
}
|
||||||
double heightObstacle = ctx.getRouter().defineHeightObstacle(road, !reverseWaySearch ? prevInd : segmentPoint,
|
double heightObstacle = ctx.getRouter().defineHeightObstacle(road, !reverseWaySearch ? prevInd : segmentPoint,
|
||||||
!reverseWaySearch ? segmentPoint : prevInd);
|
!reverseWaySearch ? segmentPoint : prevInd);
|
||||||
if(heightObstacle > 0) {
|
if(heightObstacle < 0) {
|
||||||
|
directionAllowed = false;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
boolean alreadyVisited = checkIfOppositeSegmentWasVisited(ctx, reverseWaySearch, graphSegments, segment, oppositeSegments,
|
boolean alreadyVisited = checkIfOppositeSegmentWasVisited(ctx, reverseWaySearch, graphSegments, segment, oppositeSegments,
|
||||||
segmentPoint, segmentDist, obstaclesTime);
|
segmentPoint, segmentDist, obstaclesTime);
|
||||||
|
|
|
@ -305,12 +305,12 @@ public class GeneralRouter implements VehicleRouter {
|
||||||
knext = startIndex < endIndex ? k + 1 : k - 1;
|
knext = startIndex < endIndex ? k + 1 : k - 1;
|
||||||
double dist = startIndex < endIndex ? heightArray[2 * knext] : heightArray[2 * k] ;
|
double dist = startIndex < endIndex ? heightArray[2 * knext] : heightArray[2 * k] ;
|
||||||
double diff = heightArray[2 * knext + 1] - heightArray[2 * k + 1] ;
|
double diff = heightArray[2 * knext + 1] - heightArray[2 * k + 1] ;
|
||||||
if(diff > 0 && dist > 0) {
|
if(diff != 0 && dist > 0) {
|
||||||
double incl = diff / dist;
|
double incl = Math.abs(diff / dist);
|
||||||
int percentIncl = (int) (incl * 100);
|
int percentIncl = (int) (incl * 100);
|
||||||
percentIncl = (percentIncl + 2)/ 3 * 3 - 2; // 1, 4, 7, 10, .
|
percentIncl = (percentIncl + 2)/ 3 * 3 - 2; // 1, 4, 7, 10, .
|
||||||
if(percentIncl > 0) {
|
if(percentIncl >= 1) {
|
||||||
objContext.paramContext.incline = percentIncl;
|
objContext.paramContext.incline = diff > 0 ? percentIncl : -percentIncl;
|
||||||
sum += objContext.evaluateFloat(road.region, types, 0) * diff;
|
sum += objContext.evaluateFloat(road.region, types, 0) * diff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue