97 if (asyncRouteManager ==
null) {
98 System.err.println(
"AsyncRouteManager not initialized");
103 Point destinationPoint =
new Point(100.0, 100.0);
111 RouteSession session = asyncRouteManager.createRouteSession(destinationLocationPoint, routeOptions);
112 System.out.println(
"Created route session with default graph tag");
117 RouteSession sessionWithTag = asyncRouteManager.createRouteSessionWithTag(destinationLocationPoint, routeOptions,
"main");
118 System.out.println(
"Created route session with 'main' graph tag");
122 currentSession = session;
125 if (asyncRouteListener !=
null) {
386 System.out.println(
"=== Route Options ===");
391 System.out.println(
"Created route options with smoothRadius: " + routeOptions.getSmoothRadius() +
392 ", maxProjectionDistance: " + routeOptions.getMaxProjectionDistance() +
393 ", maxAdvance: " + routeOptions.getMaxAdvance());
403 for (
int i = 0; i < optionsList.length; i++) {
405 System.out.println(
"Options " + (i + 1) +
": smoothRadius=" + options.getSmoothRadius() +
406 ", maxProjectionDistance=" + options.getMaxProjectionDistance() +
407 ", maxAdvance=" + options.getMaxAdvance());
415 System.out.println(
"=== Advanced Async Routing Features ===");
417 if (asyncRouteManager ==
null) {
422 List<LocationPoint> destinations =
new ArrayList<>();
435 List<RouteSession> sessions =
new ArrayList<>();
436 for (
int i = 0; i < destinations.size(); i++) {
437 RouteSession session = asyncRouteManager.createRouteSession(destinations.get(i), optionsList[i]);
438 sessions.add(session);
439 System.out.println(
"Created session " + (i + 1) +
" for destination: " +
440 destinations.get(i).getPoint().getX() +
", " + destinations.get(i).getPoint().getY());
442 if (asyncRouteListener !=
null) {
448 }
catch (InterruptedException e) {
449 Thread.currentThread().interrupt();
456 }
catch (InterruptedException e) {
457 Thread.currentThread().interrupt();
461 for (
int i = 0; i < sessions.size(); i++) {
464 asyncRouteManager.cancelRouteSession(sessions.get(i));
465 System.out.println(
"Cancelled session " + (i + 1));
470 }
catch (InterruptedException e) {
471 Thread.currentThread().interrupt();
509 System.out.println(
"=== Route Session Management ===");
511 if (asyncRouteManager ==
null || asyncRouteListener ==
null) {
516 Point destinationPoint =
new Point(75.0, 75.0);
521 RouteSession defaultSession = asyncRouteManager.createRouteSession(destinationLocationPoint, routeOptions);
522 System.out.println(
"Created session with default tag");
525 RouteSession taggedSession = asyncRouteManager.createRouteSessionWithTag(destinationLocationPoint, routeOptions,
"elevator");
526 System.out.println(
"Created session with 'elevator' tag");
536 }
catch (InterruptedException e) {
537 Thread.currentThread().interrupt();
545 System.out.println(
"Removed listeners from sessions");
549 asyncRouteManager.cancelRouteSession(defaultSession);
550 asyncRouteManager.cancelRouteSession(taggedSession);
551 System.out.println(
"Cancelled both sessions");