Add decline support

This commit is contained in:
Victor Shcherb 2017-02-22 18:32:16 +01:00
parent cf4155aff8
commit 47b4d762a7
2 changed files with 7 additions and 6 deletions

View file

@ -448,8 +448,9 @@ public class BinaryRoutePlanner {
}
double heightObstacle = ctx.getRouter().defineHeightObstacle(road, !reverseWaySearch ? prevInd : segmentPoint,
!reverseWaySearch ? segmentPoint : prevInd);
if(heightObstacle > 0) {
if(heightObstacle < 0) {
directionAllowed = false;
continue;
}
boolean alreadyVisited = checkIfOppositeSegmentWasVisited(ctx, reverseWaySearch, graphSegments, segment, oppositeSegments,
segmentPoint, segmentDist, obstaclesTime);

View file

@ -305,12 +305,12 @@ public class GeneralRouter implements VehicleRouter {
knext = startIndex < endIndex ? k + 1 : k - 1;
double dist = startIndex < endIndex ? heightArray[2 * knext] : heightArray[2 * k] ;
double diff = heightArray[2 * knext + 1] - heightArray[2 * k + 1] ;
if(diff > 0 && dist > 0) {
double incl = diff / dist;
if(diff != 0 && dist > 0) {
double incl = Math.abs(diff / dist);
int percentIncl = (int) (incl * 100);
percentIncl = (percentIncl + 2)/ 3 * 3 - 2; // 1, 4, 7, 10, .
if(percentIncl > 0) {
objContext.paramContext.incline = percentIncl;
if(percentIncl >= 1) {
objContext.paramContext.incline = diff > 0 ? percentIncl : -percentIncl;
sum += objContext.evaluateFloat(road.region, types, 0) * diff;
}
}