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) {
137 if (routePath ==
null) {
138 System.err.println(
"RoutePath is null");
144 double length = routePath.getLength();
145 System.out.println(
"Route length: " + length +
" meters");
150 List<LocationPoint> points = routePath.getPoints();
151 System.out.println(
"Number of route points: " + points.size());
152 for (
int i = 0; i < points.size() && i < 3; i++) {
153 System.out.println(
"Point " + (i + 1) +
": " + points.get(i));
159 List<RouteEvent> events = routePath.getEvents();
160 System.out.println(
"Number of route events: " + events.size());
161 for (
int i = 0; i < events.size() && i < 3; i++) {
170 System.out.println(
"Route head length: " + head.getLength() +
" meters");
178 System.out.println(
"Route tail length: " + tail.getLength() +
" meters");
298 System.out.println(
"=== Route Options ===");
303 System.out.println(
"Created route options with smoothRadius: " + routeOptions.getSmoothRadius() +
304 ", maxProjectionDistance: " + routeOptions.getMaxProjectionDistance() +
305 ", maxAdvance: " + routeOptions.getMaxAdvance());
315 for (
int i = 0; i < optionsList.length; i++) {
317 System.out.println(
"Options " + (i + 1) +
": smoothRadius=" + options.getSmoothRadius() +
318 ", maxProjectionDistance=" + options.getMaxProjectionDistance() +
319 ", maxAdvance=" + options.getMaxAdvance());
327 System.out.println(
"=== Advanced Async Routing Features ===");
329 if (asyncRouteManager ==
null) {
334 List<LocationPoint> destinations =
new ArrayList<>();
347 List<RouteSession> sessions =
new ArrayList<>();
348 for (
int i = 0; i < destinations.size(); i++) {
349 RouteSession session = asyncRouteManager.createRouteSession(destinations.get(i), optionsList[i]);
350 sessions.add(session);
351 System.out.println(
"Created session " + (i + 1) +
" for destination: " +
352 destinations.get(i).getPoint().getX() +
", " + destinations.get(i).getPoint().getY());
354 if (asyncRouteListener !=
null) {
360 }
catch (InterruptedException e) {
361 Thread.currentThread().interrupt();
368 }
catch (InterruptedException e) {
369 Thread.currentThread().interrupt();
373 for (
int i = 0; i < sessions.size(); i++) {
376 asyncRouteManager.cancelRouteSession(sessions.get(i));
377 System.out.println(
"Cancelled session " + (i + 1));
382 }
catch (InterruptedException e) {
383 Thread.currentThread().interrupt();
421 System.out.println(
"=== Route Session Management ===");
423 if (asyncRouteManager ==
null || asyncRouteListener ==
null) {
428 Point destinationPoint =
new Point(75.0, 75.0);
433 RouteSession defaultSession = asyncRouteManager.createRouteSession(destinationLocationPoint, routeOptions);
434 System.out.println(
"Created session with default tag");
437 RouteSession taggedSession = asyncRouteManager.createRouteSessionWithTag(destinationLocationPoint, routeOptions,
"elevator");
438 System.out.println(
"Created session with 'elevator' tag");
448 }
catch (InterruptedException e) {
449 Thread.currentThread().interrupt();
457 System.out.println(
"Removed listeners from sessions");
461 asyncRouteManager.cancelRouteSession(defaultSession);
462 asyncRouteManager.cancelRouteSession(taggedSession);
463 System.out.println(
"Cancelled both sessions");