… | |
… | |
3258 | int original_d = 0; |
3258 | int original_d = 0; |
3259 | |
3259 | |
3260 | dbg(0, "STRAI:000:\n"); |
3260 | dbg(0, "STRAI:000:\n"); |
3261 | dbg(0, "STRAI:000:======================================\n"); |
3261 | dbg(0, "STRAI:000:======================================\n"); |
3262 | |
3262 | |
|
|
3263 | tests_dbg(0, "\n=== maneuver_required2 [ENTER] ==="); |
|
|
3264 | |
3263 | // --------------------------- |
3265 | // --------------------------- |
3264 | // |
3266 | // |
3265 | // HINT: angle < 0 --> left |
3267 | // HINT: angle < 0 --> left |
3266 | // > 0 --> right |
3268 | // > 0 --> right |
3267 | // = 0 --> straight |
3269 | // = 0 --> straight |
… | |
… | |
3269 | // --------------------------- |
3271 | // --------------------------- |
3270 | |
3272 | |
3271 | d = angle_delta(old->angle_end, new->way.angle2); |
3273 | d = angle_delta(old->angle_end, new->way.angle2); |
3272 | original_d = d; |
3274 | original_d = d; |
3273 | |
3275 | |
|
|
3276 | |
|
|
3277 | #ifdef _CIDEBUG_BUILD_ |
|
|
3278 | tests_dbg(0, "angle<0 : left"); |
|
|
3279 | struct coord_geo g22; |
|
|
3280 | transform_to_geo(projection_mg, &old->end, &g22); |
|
|
3281 | tests_dbg(0, "http://www.openstreetmap.org/search?query=%f %f#map=19/%f/%f", g22.lat, g22.lng, g22.lat, g22.lng); |
|
|
3282 | |
|
|
3283 | tests_dbg(0, "delta=%d delta_real=%d d=%d", *delta, *delta_real, d); |
|
|
3284 | tests_dbg(0, "old->angle_end=%d new->way.angle2=%d", old->angle_end, new->way.angle2); |
|
|
3285 | tests_dbg(0, "from type=%s", item_to_name(old->way.item.type)); |
|
|
3286 | tests_dbg(0, "to type=%s", item_to_name(new->way.item.type)); |
|
|
3287 | #endif |
|
|
3288 | |
|
|
3289 | |
3274 | //long long wayid_old = navigation_item_get_wayid(&(old->way)); |
3290 | //long long wayid_old = navigation_item_get_wayid(&(old->way)); |
3275 | //long long wayid_new = navigation_item_get_wayid(&(new->way)); |
3291 | //long long wayid_new = navigation_item_get_wayid(&(new->way)); |
3276 | //dbg(0, "Enter d=%d old->angle_end=%d new->way.angle2=%d old_way_id=%lld new_way_id=%lld\n", d, old->angle_end, new->way.angle2, wayid_old, wayid_new); |
3292 | //dbg(0, "Enter d=%d old->angle_end=%d new->way.angle2=%d old_way_id=%lld new_way_id=%lld\n", d, old->angle_end, new->way.angle2, wayid_old, wayid_new); |
3277 | |
3293 | |
3278 | if ((global_vehicle_profile == 1) || (global_vehicle_profile == 2)) // bicycle mode |
3294 | if ((global_vehicle_profile == 1) || (global_vehicle_profile == 2)) // bicycle mode |
… | |
… | |
3285 | //dbg(0, "(b3)old flags=%x new flags=%x\n", (flags_old & NAVIT_AF_ONEWAYREV), (flags_new & NAVIT_AF_ONEWAYREV)); |
3301 | //dbg(0, "(b3)old flags=%x new flags=%x\n", (flags_old & NAVIT_AF_ONEWAYREV), (flags_new & NAVIT_AF_ONEWAYREV)); |
3286 | |
3302 | |
3287 | if ((old->way.dir == 1) && ((new->way.dir == -1) && (new->way.flags & NAVIT_AF_ONEWAY_BICYCLE_NO))) |
3303 | if ((old->way.dir == 1) && ((new->way.dir == -1) && (new->way.flags & NAVIT_AF_ONEWAY_BICYCLE_NO))) |
3288 | { |
3304 | { |
3289 | r = "yes: bicycle starts going against oneway here (1)"; |
3305 | r = "yes: bicycle starts going against oneway here (1)"; |
|
|
3306 | tests_dbg(0, "yes: bicycle starts going against oneway here (1)"); |
3290 | ret = 1; |
3307 | ret = 1; |
3291 | //dbg(0, "%s\n", r); |
3308 | //dbg(0, "%s\n", r); |
3292 | } |
3309 | } |
3293 | else if ( ((old->way.dir == -1) && (!(old->way.flags & NAVIT_AF_ONEWAY_BICYCLE_NO)) ) && ((new->way.dir == -1) && (new->way.flags & NAVIT_AF_ONEWAY_BICYCLE_NO))) |
3310 | else if ( ((old->way.dir == -1) && (!(old->way.flags & NAVIT_AF_ONEWAY_BICYCLE_NO)) ) && ((new->way.dir == -1) && (new->way.flags & NAVIT_AF_ONEWAY_BICYCLE_NO))) |
3294 | { |
3311 | { |
… | |
… | |
3315 | int old_angle_abs = abs(d); |
3332 | int old_angle_abs = abs(d); |
3316 | int new_angle_closest_to_cur = 999; |
3333 | int new_angle_closest_to_cur = 999; |
3317 | int no_correction = 0; |
3334 | int no_correction = 0; |
3318 | |
3335 | |
3319 | dbg(0, "STRAI:001:d=%d original_d=%d\n", old_angle_abs, original_d); |
3336 | dbg(0, "STRAI:001:d=%d original_d=%d\n", old_angle_abs, original_d); |
|
|
3337 | tests_dbg(0, "STRAI:001:d=%d original_d=%d", old_angle_abs, original_d); |
|
|
3338 | |
|
|
3339 | tests_dbg(0, "\n-- other ways START --"); |
3320 | |
3340 | |
3321 | while (w22) |
3341 | while (w22) |
3322 | { |
3342 | { |
3323 | |
3343 | |
3324 | dbg(0, "STRAI:002\n"); |
3344 | dbg(0, "STRAI:002\n"); |
… | |
… | |
3345 | if (new_angle_abs < new_angle_abs_min) |
3365 | if (new_angle_abs < new_angle_abs_min) |
3346 | { |
3366 | { |
3347 | new_angle_abs_min = new_angle_abs; |
3367 | new_angle_abs_min = new_angle_abs; |
3348 | } |
3368 | } |
3349 | |
3369 | |
|
|
3370 | tests_dbg(0, "new_angle_real=%d new_angle_abs=%d is allowed=%d", new_angle_real, new_angle_abs, is_way_allowed(nav, w22, 1)); |
|
|
3371 | tests_dbg(0, "old->angle_end=%d w22->angle2=%d", old->angle_end, w22->angle2); |
|
|
3372 | tests_dbg(0, "new_angle_abs_min=%d", new_angle_abs_min); |
|
|
3373 | tests_dbg(0, "other type=%s is_ramp=%d", item_to_name(w22->item.type), item_is_ramp(w22->item)); |
|
|
3374 | |
3350 | if (is_way_allowed(nav, w22, 1)) |
3375 | if (is_way_allowed(nav, w22, 1)) |
3351 | { |
3376 | { |
3352 | have_more_than_one_way_to_turn = 1; |
3377 | have_more_than_one_way_to_turn = 1; |
3353 | |
3378 | |
3354 | if ((global_vehicle_profile == 1) || (global_vehicle_profile == 2)) // bicycle mode |
3379 | if ((global_vehicle_profile == 1) || (global_vehicle_profile == 2)) // bicycle mode |
… | |
… | |
3384 | } |
3409 | } |
3385 | } |
3410 | } |
3386 | |
3411 | |
3387 | dbg(0, "STRAI:003:new angle abs=%d min_allowed=%d have_more_than_one_way_to_turn=%d new_angle_closest_to_cur=%d d=%d\n", new_angle_abs, new_angle_abs_min_allowed, have_more_than_one_way_to_turn, new_angle_closest_to_cur, d); |
3412 | dbg(0, "STRAI:003:new angle abs=%d min_allowed=%d have_more_than_one_way_to_turn=%d new_angle_closest_to_cur=%d d=%d\n", new_angle_abs, new_angle_abs_min_allowed, have_more_than_one_way_to_turn, new_angle_closest_to_cur, d); |
3388 | |
3413 | |
|
|
3414 | tests_dbg(0, "STRAI:003:new angle abs=%d min_allowed=%d have_more_than_one_way_to_turn=%d new_angle_closest_to_cur=%d d=%d", new_angle_abs, new_angle_abs_min_allowed, have_more_than_one_way_to_turn, new_angle_closest_to_cur, d); |
|
|
3415 | |
|
|
3416 | |
3389 | } |
3417 | } |
3390 | } |
3418 | } |
3391 | w22 = w22->next; |
3419 | w22 = w22->next; |
3392 | } |
3420 | } |
3393 | |
3421 | |
3394 | dbg(0, "STRAI:004 new_angle_abs_min=%d new_angle_abs_min_allowed=%d\n", new_angle_abs_min, new_angle_abs_min_allowed); |
3422 | dbg(0, "STRAI:004 new_angle_abs_min=%d new_angle_abs_min_allowed=%d\n", new_angle_abs_min, new_angle_abs_min_allowed); |
|
|
3423 | tests_dbg(0, "STRAI:004 new_angle_abs_min=%d new_angle_abs_min_allowed=%d", new_angle_abs_min, new_angle_abs_min_allowed); |
|
|
3424 | |
|
|
3425 | tests_dbg(0, "-- other ways END --\n"); |
|
|
3426 | |
3395 | |
3427 | |
3396 | if ((new_angle_abs_min_allowed > ROAD_ANGLE_IS_STRAIGHT_ABS) && (old_angle_abs <= ROAD_ANGLE_IS_STRAIGHT_ABS)) |
3428 | if ((new_angle_abs_min_allowed > ROAD_ANGLE_IS_STRAIGHT_ABS) && (old_angle_abs <= ROAD_ANGLE_IS_STRAIGHT_ABS)) |
3397 | { |
3429 | { |
3398 | dbg(0, "STRAI:005 new_abs=%d old_abs=%d\n", new_angle_abs_min_allowed, old_angle_abs); |
3430 | dbg(0, "STRAI:005 new_abs=%d old_abs=%d\n", new_angle_abs_min_allowed, old_angle_abs); |
3399 | |
3431 | tests_dbg(0, "we want to drive almost straight, set angle to 0"); |
3400 | // we want to drive almost straight, set angle to "0" |
3432 | // we want to drive almost straight, set angle to "0" |
3401 | d = 0; |
3433 | d = 0; |
3402 | } |
3434 | } |
3403 | |
3435 | |
3404 | dbg(0, "STRAI:005a:d=%d\n", d); |
3436 | dbg(0, "STRAI:005a:d=%d\n", d); |
|
|
3437 | tests_dbg(0, "STRAI:005a:d=%d", d); |
3405 | |
3438 | |
3406 | if (!r) |
3439 | if (!r) |
3407 | { |
3440 | { |
3408 | if (have_more_than_one_way_to_turn == 1) // more than 1 possibility |
3441 | if (have_more_than_one_way_to_turn == 1) // more than 1 possibility |
3409 | { |
3442 | { |
… | |
… | |
3412 | // highway to highway, nearest ramp is more than 15° angle turn |
3445 | // highway to highway, nearest ramp is more than 15° angle turn |
3413 | if ( (cat > 6) && (ncat > 6) && (highest_other_cat <= 6) && (abs(d) < 12) && (new_angle_abs_min_ramp_allowed > 15) ) |
3446 | if ( (cat > 6) && (ncat > 6) && (highest_other_cat <= 6) && (abs(d) < 12) && (new_angle_abs_min_ramp_allowed > 15) ) |
3414 | { |
3447 | { |
3415 | dbg(0, "STRAI:005a:d=%d\n", d); |
3448 | dbg(0, "STRAI:005a:d=%d\n", d); |
3416 | r = "no: driving almost straight on highway and no other highway possibilities (1)"; |
3449 | r = "no: driving almost straight on highway and no other highway possibilities (1)"; |
|
|
3450 | tests_dbg(0, "no: driving almost straight on highway and no other highway possibilities (1)"); |
3417 | } |
3451 | } |
3418 | else |
3452 | else |
3419 | { |
3453 | { |
3420 | // r = "yes: we have an exit-sign to tell the user"; |
3454 | // r = "yes: we have an exit-sign to tell the user"; |
3421 | // ret = 1; |
3455 | // ret = 1; |
… | |
… | |
3425 | { |
3459 | { |
3426 | if ( (cat > 6) && (ncat > 6) && (highest_other_cat <= 6) && (abs(d) < 12) && (new_angle_abs_min_ramp_allowed > 15) ) |
3460 | if ( (cat > 6) && (ncat > 6) && (highest_other_cat <= 6) && (abs(d) < 12) && (new_angle_abs_min_ramp_allowed > 15) ) |
3427 | { |
3461 | { |
3428 | dbg(0, "STRAI:005a:d=%d\n", d); |
3462 | dbg(0, "STRAI:005a:d=%d\n", d); |
3429 | r = "no: driving almost straight on highway and no other highway possibilities (2)"; |
3463 | r = "no: driving almost straight on highway and no other highway possibilities (2)"; |
|
|
3464 | tests_dbg(0, "no: driving almost straight on highway and no other highway possibilities (2)"); |
3430 | } |
3465 | } |
3431 | else |
3466 | else |
3432 | { |
3467 | { |
3433 | // r = "yes: we have a road-sign to tell the user"; |
3468 | // r = "yes: we have a road-sign to tell the user"; |
3434 | // ret = 1; |
3469 | // ret = 1; |
3435 | } |
3470 | } |
3436 | } |
3471 | } |
3437 | else if (item_is_ramp(old->way.item)) |
3472 | else if (item_is_ramp(old->way.item)) |
3438 | { |
3473 | { |
3439 | r = "yes: we are currently on a ramp and have more than 1 road to take"; |
3474 | r = "yes: we are currently on a ramp and have more than 1 road to take"; |
|
|
3475 | tests_dbg(0, "yes: we are currently on a ramp and have more than 1 road to take"); |
3440 | ret = 1; |
3476 | ret = 1; |
3441 | } |
3477 | } |
3442 | } |
3478 | } |
3443 | } |
3479 | } |
3444 | |
3480 | |
… | |
… | |
3447 | { |
3483 | { |
3448 | if (!new->way.next) |
3484 | if (!new->way.next) |
3449 | { |
3485 | { |
3450 | /* No announcement necessary */ |
3486 | /* No announcement necessary */ |
3451 | r = "no: Only one possibility"; |
3487 | r = "no: Only one possibility"; |
|
|
3488 | tests_dbg(0, "no: Only one possibility"); |
3452 | } |
3489 | } |
3453 | else if (!new->way.next->next && item_is_ramp(new->way.next->item) && !is_way_allowed(nav, new->way.next, 1)) |
3490 | else if (!new->way.next->next && item_is_ramp(new->way.next->item) && !is_way_allowed(nav, new->way.next, 1)) |
3454 | { |
3491 | { |
3455 | /* If the other way is only a ramp and it is one-way in the wrong direction, no announcement necessary */ |
3492 | /* If the other way is only a ramp and it is one-way in the wrong direction, no announcement necessary */ |
3456 | r = "no: Only ramp"; |
3493 | r = "no: Only ramp"; |
|
|
3494 | tests_dbg(0, "no: Only ramp"); |
3457 | } |
3495 | } |
3458 | } |
3496 | } |
3459 | else // bicycle mode -------------------- |
3497 | else // bicycle mode -------------------- |
3460 | { |
3498 | { |
3461 | if (!r) |
3499 | if (!r) |
… | |
… | |
3463 | #if 0 |
3501 | #if 0 |
3464 | if ((!new->way.next) && (abs(d) < 20)) |
3502 | if ((!new->way.next) && (abs(d) < 20)) |
3465 | { |
3503 | { |
3466 | /* No announcement necessary */ |
3504 | /* No announcement necessary */ |
3467 | r = "no: Only one possibility and less than 20° turn"; |
3505 | r = "no: Only one possibility and less than 20° turn"; |
|
|
3506 | tests_dbg(0, "no: Only one possibility and less than 20° turn"); |
3468 | dbg(0, "%s\n", r); |
3507 | dbg(0, "%s\n", r); |
3469 | } |
3508 | } |
3470 | else |
3509 | else |
3471 | { |
3510 | { |
3472 | if (abs(d) > 2) |
3511 | if (abs(d) > 2) |
… | |
… | |
3569 | if (!r) |
3608 | if (!r) |
3570 | { |
3609 | { |
3571 | if ((old->way.flags & NAVIT_AF_ROUNDABOUT) && !(new->way.flags & NAVIT_AF_ROUNDABOUT)) |
3610 | if ((old->way.flags & NAVIT_AF_ROUNDABOUT) && !(new->way.flags & NAVIT_AF_ROUNDABOUT)) |
3572 | { |
3611 | { |
3573 | r = "yes: leaving roundabout"; |
3612 | r = "yes: leaving roundabout"; |
|
|
3613 | tests_dbg(0, "yes: leaving roundabout"); |
3574 | ret = 1; |
3614 | ret = 1; |
3575 | } |
3615 | } |
3576 | else if (!(old->way.flags & NAVIT_AF_ROUNDABOUT) && (new->way.flags & NAVIT_AF_ROUNDABOUT)) |
3616 | else if (!(old->way.flags & NAVIT_AF_ROUNDABOUT) && (new->way.flags & NAVIT_AF_ROUNDABOUT)) |
3577 | { |
3617 | { |
3578 | r = "no: entering roundabout"; |
3618 | r = "no: entering roundabout"; |
|
|
3619 | tests_dbg(0, "no: entering roundabout"); |
3579 | } |
3620 | } |
3580 | else if ((old->way.flags & NAVIT_AF_ROUNDABOUT) && (new->way.flags & NAVIT_AF_ROUNDABOUT)) |
3621 | else if ((old->way.flags & NAVIT_AF_ROUNDABOUT) && (new->way.flags & NAVIT_AF_ROUNDABOUT)) |
3581 | { |
3622 | { |
3582 | r = "no: staying in roundabout"; |
3623 | r = "no: staying in roundabout"; |
|
|
3624 | tests_dbg(0, "no: staying in roundabout"); |
3583 | } |
3625 | } |
3584 | } |
3626 | } |
3585 | |
3627 | |
3586 | if ((global_vehicle_profile == 1) || (global_vehicle_profile == 2)) |
3628 | if ((global_vehicle_profile == 1) || (global_vehicle_profile == 2)) |
3587 | { |
3629 | { |
… | |
… | |
3597 | { |
3639 | { |
3598 | if (!r && abs(d) > 75) |
3640 | if (!r && abs(d) > 75) |
3599 | { |
3641 | { |
3600 | /* always make an announcement if you have to make a sharp turn */ |
3642 | /* always make an announcement if you have to make a sharp turn */ |
3601 | r = "yes: delta over 75"; |
3643 | r = "yes: delta over 75"; |
|
|
3644 | tests_dbg(0, "yes: delta over 75"); |
3602 | ret = 1; |
3645 | ret = 1; |
3603 | } |
3646 | } |
3604 | } |
3647 | } |
3605 | |
3648 | |
3606 | cat = maneuver_category(old->way.item.type); |
3649 | cat = maneuver_category(old->way.item.type); |
… | |
… | |
3708 | |
3751 | |
3709 | if (!is_same_street && is_unambigous < 1) |
3752 | if (!is_same_street && is_unambigous < 1) |
3710 | { |
3753 | { |
3711 | ret = 1; |
3754 | ret = 1; |
3712 | r = "yes: (not same street) or (ambigous [nicht eindeutig])"; |
3755 | r = "yes: (not same street) or (ambigous [nicht eindeutig])"; |
|
|
3756 | tests_dbg(0, "yes: (not same street) or (ambigous [nicht eindeutig])"); |
3713 | } |
3757 | } |
3714 | else |
3758 | else |
3715 | { |
3759 | { |
3716 | r = "no: (same street) and (unambigous [eindeutig])"; |
3760 | r = "no: (same street) and (unambigous [eindeutig])"; |
|
|
3761 | tests_dbg(0, "no: (same street) and (unambigous [eindeutig])"); |
3717 | } |
3762 | } |
3718 | |
3763 | |
3719 | if (ret == 0) |
3764 | if (ret == 0) |
3720 | { |
3765 | { |
3721 | // add a new check here: |
3766 | // add a new check here: |
… | |
… | |
3725 | dbg(0, "STRAI:11.07:4.0: cat=%d, ncat=%d, highest_other_cat=%d, d=%d, abs(d)=%d new_angle_closest_to_cur=%d original_d=%d\n", cat, ncat, highest_other_cat, d, abs(d), new_angle_closest_to_cur, original_d); |
3770 | dbg(0, "STRAI:11.07:4.0: cat=%d, ncat=%d, highest_other_cat=%d, d=%d, abs(d)=%d new_angle_closest_to_cur=%d original_d=%d\n", cat, ncat, highest_other_cat, d, abs(d), new_angle_closest_to_cur, original_d); |
3726 | |
3771 | |
3727 | if ( (cat > 6) && (ncat > 6) && (highest_other_cat <= 6) && (abs(d) < 70) ) |
3772 | if ( (cat > 6) && (ncat > 6) && (highest_other_cat <= 6) && (abs(d) < 70) ) |
3728 | { |
3773 | { |
3729 | r = "no: from highway to highway (no other highway possibilities)"; |
3774 | r = "no: from highway to highway (no other highway possibilities)"; |
|
|
3775 | tests_dbg(0, "no: from highway to highway (no other highway possibilities)"); |
3730 | dbg(0, "STRAI:011.07:4 abs(d)=%d cat=%d ncat=%d highest_other_cat=%d\n", abs(d), cat, ncat, highest_other_cat); |
3776 | dbg(0, "STRAI:011.07:4 abs(d)=%d cat=%d ncat=%d highest_other_cat=%d\n", abs(d), cat, ncat, highest_other_cat); |
3731 | } |
3777 | } |
3732 | else |
3778 | else |
3733 | { |
3779 | { |
3734 | |
3780 | |
3735 | if ((ncat == 6) && (highest_other_cat == 6) && (abs(d) < 50) && (abs(new_angle_closest_to_cur - original_d) < 65)) |
3781 | if ((ncat == 6) && (highest_other_cat == 6) && (abs(d) < 50) && (abs(new_angle_closest_to_cur - original_d) < 65)) |
3736 | { |
3782 | { |
3737 | ret = 1; |
3783 | ret = 1; |
3738 | r = "yes: we are driving onto a ramp and there a other ramps near (<50 degrees) to it"; |
3784 | r = "yes: we are driving onto a ramp and there a other ramps near (<50 degrees) to it"; |
|
|
3785 | tests_dbg(0, "yes: we are driving onto a ramp and there a other ramps near (<50 degrees) to it"); |
3739 | dbg(0, "STRAI:011.07:3.001 ncat=%d highest_other_cat=%d d=%d (new_angle_closest_to_cur=%d - original_d=%d)\n", ncat, highest_other_cat, d, new_angle_closest_to_cur, original_d); |
3786 | dbg(0, "STRAI:011.07:3.001 ncat=%d highest_other_cat=%d d=%d (new_angle_closest_to_cur=%d - original_d=%d)\n", ncat, highest_other_cat, d, new_angle_closest_to_cur, original_d); |
3740 | } |
3787 | } |
3741 | |
3788 | |
3742 | |
3789 | |
3743 | if ((d == 0) && (new_angle_abs_min_allowed >= 25)) |
3790 | if ((d == 0) && (new_angle_abs_min_allowed >= 25)) |
3744 | { |
3791 | { |
3745 | r = "no: driving almost straight, and other ways not very close to straight"; |
3792 | r = "no: driving almost straight, and other ways not very close to straight"; |
|
|
3793 | tests_dbg(0, "no: driving almost straight, and other ways not very close to straight"); |
3746 | dbg(0, "STRAI:011.07:3 abs(d)=%d new_angle_abs_min_allowed=%d\n", abs(d), new_angle_abs_min_allowed); |
3794 | dbg(0, "STRAI:011.07:3 abs(d)=%d new_angle_abs_min_allowed=%d\n", abs(d), new_angle_abs_min_allowed); |
3747 | } |
3795 | } |
3748 | else |
3796 | else |
3749 | { |
3797 | { |
3750 | |
3798 | |
3751 | if ( (d == 0) && (abs(new_angle_closest_to_cur - original_d) < 16) ) |
3799 | if ( (d == 0) && (abs(new_angle_closest_to_cur - original_d) < 16) ) |
3752 | { |
3800 | { |
3753 | ret = 1; |
3801 | ret = 1; |
3754 | r = "yes: we are going straight and some other way is very close to it"; |
3802 | r = "yes: we are going straight and some other way is very close to it"; |
|
|
3803 | tests_dbg(0, "yes: we are going straight and some other way is very close to it"); |
3755 | dbg(0, "STRAI:011.07:0 abs(d)=%d new_angle_abs_min_allowed=%d\n", abs(d), new_angle_abs_min_allowed); |
3804 | dbg(0, "STRAI:011.07:0 abs(d)=%d new_angle_abs_min_allowed=%d\n", abs(d), new_angle_abs_min_allowed); |
3756 | } |
3805 | } |
3757 | else if ( (ncat_2 <= highest_other_cat) && (d == 0) && (abs(new_angle_closest_to_cur - original_d) < 30) ) |
3806 | else if ( (ncat_2 <= highest_other_cat) && (d == 0) && (abs(new_angle_closest_to_cur - original_d) < 30) ) |
3758 | { |
3807 | { |
3759 | ret = 1; |
3808 | ret = 1; |
3760 | r = "yes: we are going straight and some other way is very close to it (same or higher cat)"; |
3809 | r = "yes: we are going straight and some other way is very close to it (same or higher cat)"; |
|
|
3810 | tests_dbg(0, "yes: we are going straight and some other way is very close to it (same or higher cat)"); |
3761 | dbg(0, "STRAI:011.07:7 abs(d)=%d new_angle_abs_min_allowed=%d\n", abs(d), new_angle_abs_min_allowed); |
3811 | dbg(0, "STRAI:011.07:7 abs(d)=%d new_angle_abs_min_allowed=%d\n", abs(d), new_angle_abs_min_allowed); |
3762 | } |
3812 | } |
3763 | else if ((abs(d) > 0) && (new_angle_abs_min_allowed < abs(d))) |
3813 | else if ((abs(d) > 0) && (new_angle_abs_min_allowed < abs(d))) |
3764 | { |
3814 | { |
3765 | ret = 1; |
3815 | ret = 1; |
3766 | r = "yes: some other way is going more straight"; |
3816 | r = "yes: some other way is going more straight"; |
|
|
3817 | tests_dbg(0, "yes: some other way is going more straight"); |
3767 | dbg(0, "STRAI:011.07:0 abs(d)=%d new_angle_abs_min_allowed=%d\n", abs(d), new_angle_abs_min_allowed); |
3818 | dbg(0, "STRAI:011.07:0 abs(d)=%d new_angle_abs_min_allowed=%d\n", abs(d), new_angle_abs_min_allowed); |
3768 | |
3819 | |
3769 | |
3820 | |
3770 | if (abs(d) < 10) |
3821 | if (abs(d) < 10) |
3771 | { |
3822 | { |
… | |
… | |
3828 | else if ((abs(d) > 0) && (new_angle_abs_min_allowed < 39) && (is_same_street)) |
3879 | else if ((abs(d) > 0) && (new_angle_abs_min_allowed < 39) && (is_same_street)) |
3829 | { |
3880 | { |
3830 | if ( (cat == ncat) && (ncat_2 > highest_other_cat) ) |
3881 | if ( (cat == ncat) && (ncat_2 > highest_other_cat) ) |
3831 | { |
3882 | { |
3832 | r = "no: we need to make a turn, but other possibilites are much lower cat roads"; |
3883 | r = "no: we need to make a turn, but other possibilites are much lower cat roads"; |
|
|
3884 | tests_dbg(0, "no: we need to make a turn, but other possibilites are much lower cat roads"); |
3833 | dbg(0, "STRAI:011.07:5iss cat=%d ncat=%d cat_2=%d ncat_2=%d highest_other_cat=%d\n", cat, ncat, cat_2, ncat_2, highest_other_cat); |
3885 | dbg(0, "STRAI:011.07:5iss cat=%d ncat=%d cat_2=%d ncat_2=%d highest_other_cat=%d\n", cat, ncat, cat_2, ncat_2, highest_other_cat); |
3834 | } |
3886 | } |
3835 | else |
3887 | else |
3836 | { |
3888 | { |
3837 | ret = 1; |
3889 | ret = 1; |
3838 | r = "yes: we need to make a turn"; |
3890 | r = "yes: we need to make a turn"; |
|
|
3891 | tests_dbg(0, "yes: we need to make a turn"); |
3839 | dbg(0, "STRAI:011.07:1iss abs(d)=%d new_angle_abs_min_allowed=%d\n", abs(d), new_angle_abs_min_allowed); |
3892 | dbg(0, "STRAI:011.07:1iss abs(d)=%d new_angle_abs_min_allowed=%d\n", abs(d), new_angle_abs_min_allowed); |
3840 | } |
3893 | } |
3841 | } |
3894 | } |
3842 | else if ((abs(d) > 0) && (new_angle_abs_min_allowed < 52) && (!is_same_street)) |
3895 | else if ((abs(d) > 0) && (new_angle_abs_min_allowed < 52) && (!is_same_street)) |
3843 | { |
3896 | { |
3844 | if ( (cat == ncat) && (ncat_2 > highest_other_cat) ) |
3897 | if ( (cat == ncat) && (ncat_2 > highest_other_cat) ) |
3845 | { |
3898 | { |
3846 | r = "no: we need to make a turn, but other possibilites are much lower cat roads"; |
3899 | r = "no: we need to make a turn, but other possibilites are much lower cat roads"; |
|
|
3900 | tests_dbg(0, "no: we need to make a turn, but other possibilites are much lower cat roads"); |
3847 | dbg(0, "STRAI:011.07:5nss cat=%d ncat=%d cat_2=%d ncat_2=%d highest_other_cat=%d\n", cat, ncat, cat_2, ncat_2, highest_other_cat); |
3901 | dbg(0, "STRAI:011.07:5nss cat=%d ncat=%d cat_2=%d ncat_2=%d highest_other_cat=%d\n", cat, ncat, cat_2, ncat_2, highest_other_cat); |
3848 | } |
3902 | } |
3849 | else |
3903 | else |
3850 | { |
3904 | { |
3851 | ret = 1; |
3905 | ret = 1; |
3852 | r = "yes: we need to make a turn"; |
3906 | r = "yes: we need to make a turn"; |
|
|
3907 | tests_dbg(0, "yes: we need to make a turn"); |
3853 | dbg(0, "STRAI:011.07:1nss abs(d)=%d new_angle_abs_min_allowed=%d\n", abs(d), new_angle_abs_min_allowed); |
3908 | dbg(0, "STRAI:011.07:1nss abs(d)=%d new_angle_abs_min_allowed=%d\n", abs(d), new_angle_abs_min_allowed); |
3854 | } |
3909 | } |
3855 | } |
3910 | } |
3856 | else |
3911 | else |
3857 | { |
3912 | { |
… | |
… | |
3861 | } |
3916 | } |
3862 | } |
3917 | } |
3863 | } |
3918 | } |
3864 | |
3919 | |
3865 | dbg(0, "STRAI:011.07 is_unambigous[eindeutig]=%d ret=%d r=%s\n", is_unambigous, ret, r); |
3920 | dbg(0, "STRAI:011.07 is_unambigous[eindeutig]=%d ret=%d r=%s\n", is_unambigous, ret, r); |
|
|
3921 | tests_dbg(0, "STRAI:011.07 is_unambigous[eindeutig]=%d ret=%d r=%s", is_unambigous, ret, r); |
3866 | |
3922 | |
3867 | #ifdef DEBUG |
3923 | #ifdef DEBUG |
3868 | // r=g_strdup_printf("yes: d %d left %d right %d dlim=%d cat old:%d new:%d max:%d unambigous=%d same_street=%d", d, left, right, dlim, cat, ncat, maxcat, is_unambigous, is_same_street); |
3924 | // r=g_strdup_printf("yes: d %d left %d right %d dlim=%d cat old:%d new:%d max:%d unambigous=%d same_street=%d", d, left, right, dlim, cat, ncat, maxcat, is_unambigous, is_same_street); |
3869 | #endif |
3925 | #endif |
3870 | } |
3926 | } |
… | |
… | |
4045 | *delta = d; |
4101 | *delta = d; |
4046 | if (reason) |
4102 | if (reason) |
4047 | { |
4103 | { |
4048 | *reason = r; |
4104 | *reason = r; |
4049 | } |
4105 | } |
|
|
4106 | |
|
|
4107 | tests_dbg(0, "=== maneuver_required2 [Exit] ==="); |
4050 | |
4108 | |
4051 | return ret; |
4109 | return ret; |
4052 | } |
4110 | } |
4053 | |
4111 | |
4054 | static struct navigation_command *command_new(struct navigation *this_, struct navigation_itm *itm, int delta, int delta_real) |
4112 | static struct navigation_command *command_new(struct navigation *this_, struct navigation_itm *itm, int delta, int delta_real) |
… | |
… | |
8048 | plugin_register_map_type("navigation", navigation_map_new); |
8106 | plugin_register_map_type("navigation", navigation_map_new); |
8049 | #endif |
8107 | #endif |
8050 | } |
8108 | } |
8051 | |
8109 | |
8052 | |
8110 | |
|
|
8111 | |