… | |
… | |
1438 | { |
1438 | { |
1439 | send_route_rect_to_java(r.lu.x, r.lu.y, r.rl.x, r.rl.y, -99); |
1439 | send_route_rect_to_java(r.lu.x, r.lu.y, r.rl.x, r.rl.y, -99); |
1440 | } |
1440 | } |
1441 | #endif |
1441 | #endif |
1442 | |
1442 | |
1443 | if (routing_mode == 0) |
1443 | |
|
|
1444 | double len_from_start_to_dest = transform_distance(projection_mg, &c[0], &c[count - 1]); |
|
|
1445 | dbg(0, "distdist=%f\n", len_from_start_to_dest); |
|
|
1446 | |
|
|
1447 | |
|
|
1448 | if ((global_vehicle_profile == 1) || (global_vehicle_profile == 2)) // ------------ BICYCLE MODE ----------- |
|
|
1449 | { |
|
|
1450 | if (len_from_start_to_dest > 100000) |
1444 | { |
1451 | { |
1445 | // normal highway routing |
|
|
1446 | // sel=route_rect(4, &r.lu, &r.rl, 25, 0); |
|
|
1447 | sel = route_rect(try_harder ? 6 : 4, &r.lu, &r.rl, 25, 0); |
1452 | sel = route_rect(try_harder ? 6 : 4, &r.lu, &r.rl, 25, 0); |
|
|
1453 | } |
|
|
1454 | else |
|
|
1455 | { |
|
|
1456 | sel = route_rect(try_harder ? 18 : 16, &r.lu, &r.rl, 25, 0); |
|
|
1457 | } |
1448 | |
1458 | |
|
|
1459 | } // ------------ BICYCLE MODE ----------- |
|
|
1460 | |
|
|
1461 | |
|
|
1462 | |
|
|
1463 | else // ------------ CAR MODE ----------- |
|
|
1464 | { |
|
|
1465 | |
|
|
1466 | if (routing_mode == 0) |
|
|
1467 | { |
|
|
1468 | // normal highway routing |
|
|
1469 | // sel=route_rect(4, &r.lu, &r.rl, 25, 0); |
|
|
1470 | if (len_from_start_to_dest > 100000) |
|
|
1471 | { |
|
|
1472 | sel = route_rect(try_harder ? 6 : 4, &r.lu, &r.rl, 25, 0); // ORIG: try_harder ? 6 : 4, &r.lu, &r.rl, 25, 0 |
|
|
1473 | } |
|
|
1474 | else |
|
|
1475 | { |
|
|
1476 | sel = route_rect(try_harder ? 8 : 7, &r.lu, &r.rl, 25, 0); |
|
|
1477 | } |
|
|
1478 | |
1449 | // the route selection rectangle will be extened further, to find all routes (by 25%) |
1479 | // the route selection rectangle will be extened further, to find all routes (by 25%) |
1450 | #ifdef HAVE_API_ANDROID |
1480 | #ifdef HAVE_API_ANDROID |
1451 | if (global_show_route_rectangles) |
1481 | if (global_show_route_rectangles) |
1452 | { |
1482 | { |
1453 | send_route_rect_to_java(sel->u.c_rect.lu.x, sel->u.c_rect.lu.y, sel->u.c_rect.rl.x, sel->u.c_rect.rl.y, try_harder ? 6 : 4); |
1483 | send_route_rect_to_java(sel->u.c_rect.lu.x, sel->u.c_rect.lu.y, sel->u.c_rect.rl.x, sel->u.c_rect.rl.y, try_harder ? 6 : 4); |
1454 | } |
1484 | } |
1455 | #endif |
1485 | #endif |
1456 | } |
1486 | } |
1457 | else if (routing_mode == 1) |
1487 | else if (routing_mode == 1) |
1458 | { |
1488 | { |
1459 | // normal roads routing (should take longer and use more roads) |
1489 | // normal roads routing (should take longer and use more roads) |
1460 | // sel=route_rect(6, &r.lu, &r.rl, 25, 0); |
1490 | // sel=route_rect(6, &r.lu, &r.rl, 25, 0); |
1461 | sel = route_rect(try_harder ? 7 : 6, &r.lu, &r.rl, 25, 0); |
1491 | sel = route_rect(try_harder ? 7 : 6, &r.lu, &r.rl, 25, 0); |
1462 | |
1492 | |
1463 | #ifdef HAVE_API_ANDROID |
1493 | #ifdef HAVE_API_ANDROID |
1464 | if (global_show_route_rectangles) |
1494 | if (global_show_route_rectangles) |
1465 | { |
1495 | { |
1466 | send_route_rect_to_java(sel->u.c_rect.lu.x, sel->u.c_rect.lu.y, sel->u.c_rect.rl.x, sel->u.c_rect.rl.y, try_harder ? 7 : 6); |
1496 | send_route_rect_to_java(sel->u.c_rect.lu.x, sel->u.c_rect.lu.y, sel->u.c_rect.rl.x, sel->u.c_rect.rl.y, try_harder ? 7 : 6); |
1467 | } |
1497 | } |
1468 | #endif |
1498 | #endif |
1469 | } |
1499 | } |
1470 | else |
1500 | else |
1471 | { |
1501 | { |
1472 | // DEFAULT setting |
1502 | // DEFAULT setting |
1473 | // normal highway routing |
1503 | // normal highway routing |
1474 | // sel=route_rect(4, &r.lu, &r.rl, 25, 0); |
1504 | // sel=route_rect(4, &r.lu, &r.rl, 25, 0); |
|
|
1505 | if (len_from_start_to_dest > 100000) |
|
|
1506 | { |
|
|
1507 | sel = route_rect(try_harder ? 6 : 4, &r.lu, &r.rl, 25, 0); // ORIG: try_harder ? 6 : 4, &r.lu, &r.rl, 25, 0 |
|
|
1508 | } |
|
|
1509 | else |
|
|
1510 | { |
1475 | sel = route_rect(try_harder ? 6 : 4, &r.lu, &r.rl, 25, 0); |
1511 | sel = route_rect(try_harder ? 8 : 7, &r.lu, &r.rl, 25, 0); |
|
|
1512 | } |
1476 | |
1513 | |
1477 | // the route selection rectangle will be extened further, to find all routes (by 25%) |
1514 | // the route selection rectangle will be extened further, to find all routes (by 25%) |
1478 | #ifdef HAVE_API_ANDROID |
1515 | #ifdef HAVE_API_ANDROID |
1479 | if (global_show_route_rectangles) |
1516 | if (global_show_route_rectangles) |
1480 | { |
1517 | { |
1481 | send_route_rect_to_java(sel->u.c_rect.lu.x, sel->u.c_rect.lu.y, sel->u.c_rect.rl.x, sel->u.c_rect.rl.y, try_harder ? 6 : 4); |
1518 | send_route_rect_to_java(sel->u.c_rect.lu.x, sel->u.c_rect.lu.y, sel->u.c_rect.rl.x, sel->u.c_rect.rl.y, try_harder ? 6 : 4); |
1482 | } |
1519 | } |
1483 | #endif |
1520 | #endif |
1484 | |
1521 | |
1485 | } |
1522 | } |
|
|
1523 | } // ------------ CAR MODE ----------- |
|
|
1524 | |
|
|
1525 | |
|
|
1526 | |
|
|
1527 | |
|
|
1528 | |
|
|
1529 | |
1486 | |
1530 | |
1487 | ret = sel; |
1531 | ret = sel; |
1488 | for (i = 0; i < count; i++) |
1532 | for (i = 0; i < count; i++) |
1489 | { |
1533 | { |
1490 | // make 2 rectangles around every waypoint |
1534 | // make 2 rectangles around every waypoint |